Realm是一个移动的数据库。一个替代用来SQLite & key-value 存储

Breaking Changes

Reworked the internal implementation of the permission API. For the most part, the method signatures haven't changed or where they have changed, the API have remained close to the original (e.g. Results<T> has changed to T[]).

Changed the return type of User.getGrantedPermissions from Results<Permission> to Permission[]. This means that the collection is no longer observable like regular Realm-backed collections. If you need to be notified for changes of this collection, you need to implement a polling-based mechanism yourself.

Permission.mayRead/mayWrite/mayManage have been deprecated in favor of a more-consistent AccessLevel API.

Removed the User.openManagementRealm method.

Changed the return type of User.applyPermissions from Promise<PermissionChange> to Promise<void>.

Enhancements

Added User.getPermissionOffers API to get a collection of all permission offers the user has created.

Fixed

Named pipes on Android are now created with 0666 permissions instead of 0600. This fixes a bug on Huawei devices which caused named pipes to change owners during app upgrades causing subsequent ACCESS DENIED errors. This should have no practical security implications. (realm/realm-core#3328, since v0.10.0)

Internal

Enhancements

For synchronized Realms it is now possible to choose the behavior when opening the Realm. You can either choose to open the local Realm immediately or wait for it to be synchronized with the server first. These options are controlled through Realm.Sync.SyncConfiguration.newRealmFileBehavior and Realm.Sync.SyncConfiguration.existingRealmFileBehavior. See the docs for more information.

Fixed

A React Native iOS app could crash on the first launch. Thanks to @max-zu. (#2400, since v1.0.0)

When creating objects using migration, a native crash could occur if a new optional property was added to the schema. (#1612, since v1.0.0)

Constructing an inclusions made unnecessary table comparisons. This resulted in poor performance for subscriptions using the includeLinkingObjects functionality. (realm/realm-core#3311, since v2.27.0-rc.3)

Compatibility

Realm Object Server: 3.21.0 or later.

APIs are backwards compatible with all previous release of realm in the 2.x.y series.

NOTE: The minimum version of Realm Object Server has been increased to 3.21.0 and attempting to connect to older versions will produce protocol mismatch errors. Realm Cloud has already been upgraded to this version, and users using that do not need to worry about this.

Changes since v2.26.1 (including v2.27.0-rc.2 and v2.27.0-rc.3):

Enhancements

Add an optional parameter to the SubscriptionOptions: inclusions which is an array of linkingObjects properties. This tells subscriptions to include objects linked through these relationships as well (links and lists are already included by default). (#2296

Added Realm.Sync.localListenerRealms(regex) to return the list of local Realms downloaded by the global notifier. (realm-js-private#521).

Fixed

Making a query that compares two integer properties could cause a segmentation fault in the server or x86 node apps. (realm-core#3253)

Fix an error in the calculation of the transferable value supplied to the progress callback. (realm-sync#2695, since v1.12.0)

HTTP requests made by the Sync client now always include a Host: header, as required by HTTP/1.1, although its value will be empty if no value is specified by the application. (realm-sync#2861, since v1.0.0)

Added UpdateMode type to support the three modes of Realm.create(). (#2359, since v2.26.1)

Fixed an issue where calling user.logout() would not revoke the refresh token on the server. (#2348, since v2.24.0)

Fixed types of the level argument passed to the callback provided to Realm.Sync.setLogger, it was a string type but actually a numeric value is passed. (#2125, since v2.25.0)

kneth released this
Apr 4, 2019
· 1 commit to master since this release

Enhancements

Add 4 new fields to NamedSubscription which reprents query-based subscriptions: createdAt, updatedAt, expiresAt and timeToLive. These make it possible to better reason about and control current subscriptions. (#2266)

Add the option of updating the query controlled by a subscription using either Results.subscribe({name: 'name', update: true}) or the NamedSubscription.query property. (#2266)

Add the option of setting a time-to-live for subscriptions using either Results.subscribe({name: 'name', timeToLive: <valueInMs>}) or the NamedSubscription.timeToLive property. (#2266)

Add Realm.Results.description() which returns a string representation of the query.

Add support for defining mapped properties in the schema using name: { type: 'int', mapTo: 'internalName' }. In that case the mapped name is used internally in the underlying Realm file, while the property key is used for reading/writing the property as well as querying it.

Add RealmObject.addListener(), RealmObject.removeListener(), and RealmObject.removeAllListeners() to set up and remove object-level notifications. (#763)

Add a new Realm.UpdateMode enum with the values: never, modified, all. This replaces the currentRealm.create(type, properties, update) with Realm.create(type, properties, updateMode).Realm.create(type, properties, 'modified') is a new mode that only update existing properties that actually changed, while Realm.create(type, properties, 'never') is equal to Realm.create(type, properties, false) andRealm.create(type, properties, 'all') is equal to Realm.create(type, properties, true).Realm.create(type, properties, update) is now deprecated. (#2089)

Fixed

Fixed retrying authentication requests. The issue could be observed as "Cannot read property 'get' of undefined." errors being thrown when the authenticate requests were retried. (#2297, since v2.24.0)

Due to a rare race condition in some Android devices (including Samsung SM-T111), an app could crash hard. A workaround was introduced but never included in any releases. (#1895, since v2.11.0)

Compatibility

Realm Object Server: 3.11.0 or later.

APIs are backwards compatible with all previous release of realm in the 2.x.y series.

Fix an occasional crash due to an uncaught realm::IncorrectThreadException when a client reset error occurs. (#2193#2193)

When a sync worker is called with no arguments, a runtime error can occur. Thanks to @radovanstevanovic. (#2195, since v2.2.2)

Fix an occasional crash due to an uncaught realm::IncorrectThreadException when a client reset error occurs. (#2193)

A crash bug could be triggered in some situations by creating, deleting, then recreating tables with primary keys. This could be seen observed as a crash with the message Row index out of range. (realm/realm-sync#2651, since v2.0.0)

Compatibility

Realm Object Server: 3.11.0 or later.

APIs are backwards compatible with all previous release of realm in the 2.x.y series.

Enhancements

Fixed

ReactNative for Android no longer uses deprecated methods and can build using Gradle 5.0 and above. (#1995)

A bug caused loading the binary component of the SDK to hang on Windows. (#2169, since v2.21.0)

Fix occasional FATAL ERROR: v8::String::Cast Could not convert to string crashes when reading a property from a Realm object. (#2172, since v2.19.0)

Reverted support for n as it prevents users to include Realm in iOS apps. We restore the old behaviour as a temporary solution, and we will reenable support of n in the near future. (#2099, since v2.19.0-rc.5)

Compatibility

Realm Object Server: 3.11.0 or later.

APIs are backwards compatible with all previous release of realm in the 2.x.y series.

Enhancements

Adds support for setting a custom User-Agent string using Realm.Sync.setUserAgent(...). This string will be sent to the server when creating a connection. (#2102)

Adds support for uploading and downloading changes using Realm.Sync.Session.uploadAllLocalChanges(timeout) and Realm.Sync.Session.downloadAllRemoteChanges(timeout). (#2122)

Fixed

Tokens are refreshed ahead of time. If the lifetime of the token is lower than the threshold for refreshing it will cause the client to continously refresh, spamming the server with refresh requests. A lower bound of 10 seconds has been introduced. (#2115, since v1.0.2)

Prevent automatic token refreshes for Realms that have been closed. Previously, these could have resulted in obscure Unhandled session token refresh error messages in the logs that were benign. (#2119)

When trying to debug, users could experience a crash with the message this._constructor is not a function. (#491 (comment), since v2.19.0-rc.4)

Check the correct name when automatically adding the permission object schemas to the schema for query-based sync realms so that defining types with the same name works correctly. (#2121, since 2.15.0)

Fixes a bug where the JS engine might garbage collect an object prematurely leading to a native crash. (#496, since v2.19.0)

Compatibility

Realm Object Server: 3.11.0 or later.

APIs are backwards compatible with all previous release of realm in the 2.x.y series.

Enhancements

None.

Fixed

The Typescript definition for Realm.Permissions.Permission did not have the correct role property defined. This could result in compilation errors like this error TS2339: Property 'role' does not exist on type 'Permission'. (#2106, since v2.3.0.)

Removes calls to new Buffer() as this is deprecated with Node 10. (#2107, since v2.19.0)

Updates the type definitions to be explicit that the return type of the generics Realm.objects<T>, Realm.objectForPrimaryKey<T>, etc. is an intersection of T & Realm.Object. (#1838)

A set of bugs that could lead to bad changesets have been fixed. An example of error message is Failed to parse, or apply received changeset: ndx out of range. (Fixed by Realm Sync v3.13.3)

Compatibility

Realm Object Server: 3.11.0 or later.

APIs are backwards compatible with all previous release of realm in the 2.x.y series.

Enhancements

Adds SyncConfig.customQueryBasedSyncIdentifier to allow customizing the identifier appended to the Realm path when opening a query based Realm. This identifier is used to distinguish between query based Realms opened on different devices and by default Realm builds it as a combination of a user's id and a random string, allowing the same user to subscribe to different queries on different devices. In very rare cases, you may want to share query based Realms between devices and specifying the customQueryBasedSyncIdentifier allows you to do that.

Adds Realm.subscriptions() to query active query-based sync subscriptions. This method is in beta and might change in future releases. (#2052)

Adds Realm.unsubscribe() to unsubscribe by name an active query-based sync subscription. This method is in beta and might change in future releases. (#2052)

Improves the proactive token refresh mechanism to make several attempts to refresh the token before it expires and to also ensure that there is only one ongoing refresh timer for a combination of user and realm path. Previously it was possible to end up in a situation where many redundant refreshes were scheduled for the same Realm. (#2071)

A more meaningful exception will be thrown when trying to refresh the access token for a Realm with an invalid url. Previously, trying to connect to a Realm with an url that lacks the path component (e.g. realm://foo.com) would result in errors like Cannot read property ‘token_data’ of undefined. Instead, now we'll print out the Realm url and provide a more meaningful exception message. (#ROS-1310)

Adds support for Node 10. Pre-gyp'ed binaries are available for Node 6, 8, and 10. (#1813 and #2087)

Fixed

Fixes the TypeScript definitions for User.login to make it explicit in which cases a promise and in which a User is returned. (#2050, since 2.16.0).

Fixes the exception being thrown when using the deprecated User.registerWithProvider API and not providing a value for userInfo. (#2050, since 2.16.0).

Fixes the signature of user.logout to return a Promise<void> rather than void. It has always done asynchronous work, but previously, it was impossible to be notified that the call has completed. Since that is now possible, the superfluous User is logged out message printed in the console upon logout has been removed. (#2071, since v2.3.0)

Fixes opening query-based Realms with a dynamic schema. Previously the schema would always contain only the types present when the Realm was first added and not any types added later. (#2077, since v2.3.0)

Compatibility

Realm Object Server: 3.11.0 or later.

APIs are backwards compatible with all previous release of realm in the 2.x.y series.