Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR was automatically created by Snyk using the credentials of a real user.
Snyk has created this PR to fix one or more vulnerable packages in the `npm` dependencies of this project.
Changes included in this PR
Vulnerabilities that will be fixed
With an upgrade:
Why? Confidentiality impact: None, Integrity impact: None, Availability impact: High, Scope: Unchanged, Exploit Maturity: Proof of Concept, User Interaction (UI): None, Privileges Required (PR): None, Attack Complexity: Low, Attack Vector: Network, EPSS: 0.00299, Social Trends: No, Days since published: 806, Reachable: No, Transitive dependency: Yes, Is Malicious: No, Business Criticality: High, Provider Urgency: High, Package Popularity Score: 99, Impact: 5.99, Likelihood: 2.65, Score Version: V5
SNYK-JS-ANSIREGEX-1583908
Why? Confidentiality impact: High, Integrity impact: None, Availability impact: None, Scope: Changed, Exploit Maturity: Proof of Concept, User Interaction (UI): None, Privileges Required (PR): Low, Attack Complexity: High, Attack Vector: Network, EPSS: 0.00619, Social Trends: No, Days since published: 1369, Reachable: No, Transitive dependency: Yes, Is Malicious: No, Business Criticality: High, Provider Urgency: Medium, Package Popularity Score: 99, Impact: 6.65, Likelihood: 2.27, Score Version: V5
SNYK-JS-DECOMPRESSTAR-559095
Why? Confidentiality impact: Low, Integrity impact: Low, Availability impact: None, Scope: Unchanged, Exploit Maturity: Proof of Concept, User Interaction (UI): None, Privileges Required (PR): None, Attack Complexity: High, Attack Vector: Network, EPSS: 0.00181, Social Trends: No, Days since published: 1001, Reachable: No, Transitive dependency: Yes, Is Malicious: No, Business Criticality: High, Provider Urgency: Medium, Package Popularity Score: 98, Impact: 4.19, Likelihood: 2.42, Score Version: V5
SNYK-JS-HTMLPARSESTRINGIFY2-1079307
Why? Confidentiality impact: Low, Integrity impact: Low, Availability impact: None, Scope: Unchanged, Exploit Maturity: Proof of Concept, User Interaction (UI): None, Privileges Required (PR): None, Attack Complexity: Low, Attack Vector: Network, EPSS: 0.00063, Social Trends: No, Days since published: 255, Reachable: No, Transitive dependency: Yes, Is Malicious: No, Business Criticality: High, Provider Urgency: Medium, Package Popularity Score: 99, Impact: 4.19, Likelihood: 2.81, Score Version: V5
SNYK-JS-REQUEST-3361831
Why? Confidentiality impact: Low, Integrity impact: Low, Availability impact: None, Scope: Unchanged, Exploit Maturity: Proof of Concept, User Interaction (UI): None, Privileges Required (PR): None, Attack Complexity: Low, Attack Vector: Network, EPSS: 0.00173, Social Trends: No, Days since published: 150, Reachable: No, Transitive dependency: Yes, Is Malicious: No, Business Criticality: High, Provider Urgency: Medium, Package Popularity Score: 99, Impact: 4.19, Likelihood: 2.81, Score Version: V5
SNYK-JS-TOUGHCOOKIE-5672873
(*) Note that the real score may have changed since the PR was raised.
Release notes
Package name: react-i18next
11.8.13
11.8.12
11.8.11
11.8.10
11.8.9
11.8.8
11.8.7
11.8.6
11.8.5
11.8.4
Package name: realm
NOTE: This combines all changelog entries for prereleases of v12.0.0.
Breaking changes
Although this is a complete rewrite of our SDK, we've strived to keep breakages to a minimum and expect our users to upgrade from v11 without any significant changes to their code-base.
Realm.BSON
, to simplify the new SDK we want to export only the BSON types that our SDK database component supports (ObjectId, Decimal128 and UUID). See #4934.Realm.Object
via the standardObject.keys(obj)
. As a side-effect we stopped supporting the object spread operator{...obj}
and introducedRealm.Object#keys()
,Realm.Object#entries()
andRealm.Object#toJSON()
methods were introduced as a workaround. The new SDK wraps its accessor objects in a Proxy trapping the ownKeys operation which enables calls to the standardObject.keys(obj)
and the spread operator{...obj}
to work correctly, with minimal performance impact on normal accesses. Therefore, we are deprecating the APIs with the @ Deprecation annotation and aconsole.warn
when callingRealmObject#keys()
andRealmObject#entries()
.RealmObject#toJSON
still serves the purpose of producing a circularly referencing object graph. We would love the community's feedback on this!Results
,List
andSet
used to inherit directly fromCollection
but now inherits from an abstractOrderedCollection
, which extendsCollection
.PropertySchema
andPropertySchemaShorthand
types.)// Example object schema
const TaskSchema: ObjectSchema = {
name: "Task",
properties: {
description: /* property schema (shorthand or object form) */,
},
};
// Explicitness
"[]" // Bad (previously parsed as implicit "mixed")
"mixed[]" // Good
{ type: "list" } // Bad
{ type: "list", objectType: "mixed" } // Good
// Mixing shorthand and object form
{ type: "int[]" } // Bad
"int[]" // Good
{ type: "list", objectType: "int" } // Good
{ type: "int?" } // Bad
"int?" // Good
{ type: "int", optional: true } // Good
// Specifying object types
{ type: "SomeType" } // Bad
"SomeType" // Good
{ type: "object", objectType: "SomeType" } // Good
{ type: "object[]", objectType: "SomeType" } // Bad
"SomeType[]" // Good
{ type: "list", objectType: "SomeType" } // Good
{ type: "linkingObjects", objectType: "SomeType", property: "someProperty" } // Good
ObjectSchema
when using the object representation for property schemas.// If using classes:
class Task extends Realm.Object {
description!: string;
// Add type annotation (
ObjectSchema
).static schema: ObjectSchema = {
name: "Task",
properties: {
description: { type: "string" },
},
};
}
// If using object literal:
// Add type annotation (
ObjectSchema
).const TaskSchema: ObjectSchema = {
name: "Task",
properties: {
description: { type: "string" },
},
};
instanceof SomeClass
checks, however, code which is directly using prototype or constructor comparisons will fail:Symbol
type). In the new SDK, using a Symbol as a key in a dictionary will throw.SubscriptionSet
, since (a) the team saw little actual use-case for it, (b) it would bloat our SDK code, and (c) there is a simple workaround if needed (spreading into an array[...realm.subscriptions]
). (The propertylength
is available.) Again, something we would love feedback on.ObjectPropsType
,UserMap
,UserType
,BaseFunctionsFactory
,AuthProviders
,PropertyType
,HTTP
,*Details
interfaces of theEmailPasswordAuthClient
andAuthError
types, since they weren't used internally and not expected to be used by users. Moreover, most of these are very simple to type out for any user relying on it. Similarly, theDictionaryBase
type was introduced to help work around an issue (declaring string index accessors on a class with methods) in our declarations. We consider it an internal detail that got introduced as part of our public API by accident; thus, we ask users to use theDictionary
type directly. We also decided to rename theSession
class toSyncSession
since it’s now exported directly on the package namespace.Session
will still be available (but deprecated) asRealm.Sync.Session
. We’re no longer using the*Payload
types (they were only used by Realm Web) and we don’t expect end-users to be relying directly on these, hence they were deleted."list"
instead of"array"
.undefined
or some other default value when calling methods or accessing properties on the JSSyncSession
object, even if that would violate our declared TS types. Now, in v12, we will throw from all methods and property accessors in this case.Deprecations
SubscriptionsState
enum (will be removed in v13) in favor of the now-namedSubscriptionSetState
. (#5773)Notable new features
Realm.setLogger
, that allows to setup a single static logger for the duration of the app lifetime. Differently from the now deprecated sync logger (that was setup withSync.setLogger
), this new one will emit messages coming also from the local database, and not only from sync. It is also possible to change the log level during the whole duration of the app lifetime withRealm.setLogLevel
. (#2546)CompensatingWriteError
which indicates that one or more object changes have been reverted by the server.This can happen when the client creates/updates objects that do not match any subscription, or performs writes on an object it didn't have permission to access. (#5599)
Results
instance viaResults.subscribe()
(asynchronous) andResults.unsubscribe()
(synchronous). (#5772)WaitForSync
enum specifying whether to wait or not wait for subscribed objects to be downloaded before resolving the promise returned fromResults.subscribe()
.SubscriptionOptions
to take aWaitForSync
behavior and a maximum waiting timeout before returning fromResults.subscribe()
.MutableSubscriptionSet.removeUnnamed()
for removing only unnamed subscriptions.CanonicalGeoPoint
can be queried. (#5850)geoWithin
operator in the query string toResults.filtered()
.GeoCircle
type, defined by its center and radius in radians), box (GeoBox
type, defined by its bottom left and upper right corners) and polygon (GeoPolygon
type, defined by its vertices).kmToRadians()
andmiToRadians()
, that can be used to convert kilometers and miles to radians respectively, simplifying conversion of a circle's radius.ObjectSchema,
GeoCircle,
CanonicalGeoPoint,
GeoPosition,
kmToRadians,
} from "realm";
// Example of a user-defined point class that can be queried using geospatial queries
class MyGeoPoint extends Realm.Object implements CanonicalGeoPoint {
coordinates!: GeoPosition;
type = "Point" as const;
static schema: ObjectSchema = {
name: "MyGeoPoint",
embedded: true,
properties: {
type: "string",
coordinates: "double[]",
},
};
}
class PointOfInterest extends Realm.Object {
name!: string;
location!: MyGeoPoint;
static schema: ObjectSchema = {
name: "PointOfInterest",
properties: {
name: "string",
location: "MyGeoPoint",
},
};
}
realm.write(() => {
realm.create(PointOfInterest, {
name: "Copenhagen",
location: {
coordinates: [12.558892784045568, 55.66717839648401],
type: "Point",
} as MyGeoPoint
});
realm.create(PointOfInterest, {
name: "New York",
location: {
coordinates: [-73.92474936213434, 40.700090994927415],
type: "Point",
} as MyGeoPoint
});
});
const pois = realm.objects(PointOfInterest);
const berlinCoordinates: GeoPoint = [13.397255909303222, 52.51174463251085];
const radius = kmToRadians(500); //500 km = 0.0783932519 rad
// Circle with a radius of 500kms centered in Berlin
const circleShape: GeoCircle = {
center: berlinCoordinates,
distance: radius,
};
// All points of interest in a 500kms radius from Berlin
let result = pois.filtered("location geoWithin $0", circleShape);
// Equivalent string query without arguments
result = pois.filtered("location geoWithin geoCircle([13.397255909303222, 52.51174463251085], 0.0783932519)");
Enhancements
Nikolai Samorodov / @ zabutok for contributing the fix. (#5032)
SchemaParseError
(or one of its subtypesObjectSchemaParseError
andPropertySchemaParseError
) rather than anAssertionError
orError
. (#5198)SSLConfiguration
with a custom function for validating the server's SSL certificate. (#5485)PropertySchema.indexed
with thefull-text
option, that allows to create an index for full-text search queries. (#5755)TRUEPREDICATE SORT(meta['age'])
. (realm/realm-core#5311)SyncError.logUrl
which contains the URL to the server log related to the sync error. (#5609)Realm.Results#length
) the number of exact matches (with no other query conditions) on astring
/int
/uuid
/objectId
property that has an index. This improvement will be especially noticeable if there are a large number of results returned (duplicate values).date
property that has an index.mixed
property that has an index.bool
property that has an index.mixed
property that does not have an index.THROW_ON_GLOBAL_REALM
which will enable throwing when the app is accessing theRealm
without first importing it from the Realm package.Fixed
yarn
and thebson
dependency. (#6040)realm
binary is missing and provide guidance in theREADME.md
. (#5981)UpdateMode
recursively to all objects when passed toRealm.create()
. (#5933)Realm
was still open (realm/realm-core#6050).User.state
and changed theUserState
enum values to use pascal case to conform to the v11 implementation (except forUserState.Active
that we now deprecate in favor ofUserState.LoggedIn
). (#5686)App.currentUser()
when being called on a new instance ofApp
(#5790)mixed
property with a string operator (contains
/like
/beginswith
/endswith
) or with case insensitivity. ([realm/realm-core#6376](realm/realm-core#6376, since v10.5.0)mixed
property was returning case insensitive matches. For example querying formyIndexedMixed == "Foo"
would incorrectly match on values of"foo"
or"FOO"
. (realm/realm-core#6376, since v10.5.0)mixed
property on a non-empty class/objectType would crash with an assertion. (realm/realm-core#6376, since v10.5.0)Realm.App.Sync#pause()
could hold a reference to the database open after shutting down the sync session, preventing users from being able to delete the Realm. (realm/realm-core#6372, since v11.5.0)Realm.Results
andRealm.List
being in different orders on different devices. Moreover, some cases of the error messageInvalid prior_size
may have be fixed too. (realm/realm-core#6191, since v10.15.0)Sync
as named export. #5649App.allUsers
to return a record with theUser.id
as the key and theUser
as the value. #5671@ keys
in a Dictionary would throw an exception. (realm/realm-core#6831, since v12.0.0-rc.3)Compatibility
Internal
REALM_DISABLE_ANALYTICS
, and you can print out what is submitted by setting the environment variableREALM_PRINT_ANALYTICS
.Fixed
Compatibility
Internal
Using Realm Core from v13.15.1 to v13.17.1
Fixed
ClassMap
) used byRealm
before notifying schema change listeners when the schema is changed during runtime. (#5574)UpdateMode
recursively to all objects when passed toRealm.create()
. (#5933)Compatibility
Internal
fs-extra
), and the post-install script has been refactored to usefs
instead.Fixed
Compatibility
Breaking changes
Realm
to use default or* as Realm
imports of theRealm
constructor. (#5882)SyncSession
JS objects no longer keep their associated C++ objects, and therefore the sync network connection, alive. This was causing issues because JS garbage collection is lazy so theSyncSession
may survive much longer than the last reference held to it. We now use the same technique as v11 to avoid keeping the C++ object alive (std::weak_ptr
). (#5815, since v12.0.0-alpha.0)undefined
or some other default value when calling methods or accessing properties on the JSSyncSession
object, even if that would violate our declared TS types. Now, in v12, we will throw from all methods and property accessors in this case.Deprecations
SubscriptionsState
enum (will be removed in v13) in favor of the now-namedSubscriptionSetState
. (#5773)Realm
namespace, to align with v11 and ease the adoption of this major version. (#5883)Enhancements
Opening a Realm with invalid schemas will throw a
SchemaParseError
(or one of its subtypesObjectSchemaParseError
andPropertySchemaParseError
) rather than anAssertionError
orError
. (#5198)Enable multiple processes to operate on an encrypted Realm simultaneously. (realm/realm-core#1845)
Added
Realm.setLogger
, that allows to setup a single static logger for the duration of the app lifetime. Differently from the now deprecated sync logger (that was setup withSync.setLogger
), this new one will emit messages coming also from the local database, and not only from sync. It is also possible to change the log level during the whole duration of the app lifetime withRealm.setLogLevel
. (