With async callbacks, in-process listeners need to be able to wait for anything
currently in progress to complete just like out-of-process listeners. In
addition, removeListener() needs to be declared as returning a Promise so that
typescript code can actually use it.
* When refreshing the token, look up the user in a way that doesn't suffer
from #1586
Expose a means of looking up a user by identity and server to avoid
problems if the same user identity exists for multiple servers, which
can happen when connecting to the same server via different hostnames.
* Return undefined if the user doesn't exist rather than returning an object wrapping a null SyncUser.
* Perform a pseudo-refresh for admin token users
Although we don't need to actually refresh the token, when multiplexing is
enabled we do still need to hit ROS to let it know we're accessing a Realm and
get the sync label.
* Adding brief JSdoc and TS definition for isAdminToken.
* Perform a pseudo-refresh for admin token users
Although we don't need to actually refresh the token, when multiplexing is
enabled we do still need to hit ROS to let it know we're accessing a Realm and
get the sync label.
* Adding brief JSdoc and TS definition for isAdminToken.
* Make the timeout consistent
* Add basic docs for multiprocess notifications (#1594)
* Add basic docs for multiprocess notifications
* Adopt core's query parser and update to core v5.1.2 (#1563)
* Adopt core's query parser.
* Realm Core 5.1.2
* Realm Sync 2.2.9
* Remove tar.xz (#1585)
* remove tar.xz decompression and lzma deps
* Fixing merge
* Updating object store
* Adding method Realm.Sync.User.authenticate()
* Adding JWT provider support to Realm.Sync.User.authenticate()
* Adding password provider support to Realm.Sync.User.authenticate()
being open with a different schema version
In order to correctly open read-only synchronized Realms, `Realm.open`
would open the Realm without specifying a schema or schema version, wait
for any remote changes to be downloaded (if appropriate), and then
re-open the Realm with the specified schema and schema version. This
would lead to an exception about the Realm being open with a different
schema version if the Realm had previously been opened with a different
schema version, due to the way `RealmCoordinator` caches information
about the schema of open Realms.
We address this by making two changes:
1. `Realm.open` for non-synchronized Realms no longer goes through
`_waitForDownload`. This means the dance described above where the Realm
is opened twice is not used for local Realms.
2. `_waitForDownload` no longer keeps the `Realm` alive until after its
callback has returned. It instead keeps the `SyncSession` alive. This is
sufficient to avoid the connection being torn down and having to
reconnect when `_waitForDownload`'s callback later opens the Realm with
the correct schema and schema version, while also allowing for
`RealmCoordinator`'s cached information to be cleared when the
schemaless Realm is closed prior to the Realm being reopened.
In addition, tests have been added that reproduced the problem in both a
local and sync context.