Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flexible sync #4220

Merged
merged 8 commits into from
Jan 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,14 @@
],
"cwd": "${workspaceFolder}/tests"
},
{
"type": "lldb",
"request": "launch",
"name": "LLDB Node REPL",
"program": "node",
"args": ["--expose_gc"],
"preLaunchTask": "Build Node Tests"
},
{
"type": "lldb",
"request": "launch",
Expand All @@ -102,10 +110,13 @@
"--require",
"src/node/inject-globals.ts",
"src/index.ts",
"--timeout",
"10000",
"--grep",
"${input:integrationTestFilter}"
],
"cwd": "${workspaceFolder}/integration-tests/tests"
"cwd": "${workspaceFolder}/integration-tests/tests",
"preLaunchTask": "Build Node Tests"
}
],
"compounds": [
Expand Down
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
x.x.x Release notes (yyyy-MM-dd)
=============================================================
### Notes
This release adds beta support for flexible sync. See the [backend](https://docs.mongodb.com/realm/sync/data-access-patterns/flexible-sync/) and [SDK](https://docs.mongodb.com/realm/sdk/node/fundamentals/realms/realm-sync/#flexible-sync) documentation for more information. Please report any issues with the beta through Github.

Please note the following API changes from the `10.12.0-beta.1` release of Flexible Sync:
* `Realm.getSubscriptions()` is now `Realm.subscriptions`
* `Subscriptions` has been renamed to `SubscriptionSet`, and `MutableSubscriptions` to `MutableSubscriptionSet`
* `SubscriptionSet.snaphot()` has been removed, in favour of allowing a `SubscriptionSet` to be accessed as an array
* `SubscriptionSet.find()` has been renamed to `SubscriptionSet.findByQuery()` to avoid a naming confict with the `Array.find` method
* `SubscriptionSet.empty` has been renamed to `SubscriptionSet.isEmpty`
* The result of `Realm.subscriptions.update` can be `await`ed to avoid a separate call to `waitForSynchronization`
* The spelling of `SubscriptionState.Superceded` was corrected to `SubscriptionState.Superseded`

### Enhancements
* Support arithmetic operations (+, -, *, /) in queries. Operands can be properties and/or constants of numeric types (`int`, `float`, `double` or `Decimal128`). You can now say something like `(age + 5) * 2 > child.age`.
* `Realm.writeCopyTo()` now supports creating snapshots of synced Realms, thus allowing apps to be shipped with partially-populated synced databases. ([#3782](https://github.com/realm/realm-js/issues/3782)
* Added beta support for flexible sync.

### Fixed
* Opening a Realm with a schema that has an orphaned embedded object type performed an extra empty write transaction. ([realm/realm-core#5115](https://github.com/realm/realm-core/pull/5115), since v10.5.0)
Expand Down
14 changes: 10 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Realm welcomes all contributions! The only requirement we have is that, like man

[Please submit your CLA electronically using our Google form](https://docs.google.com/forms/d/e/1FAIpQLSeQ9ROFaTu9pyrmPhXc-dEnLD84DbLuT_-tPNZDOL9J10tOKQ/viewform) so we can accept your submissions. The GitHub username you file there will need to match that of your Pull Requests. If you have any questions or cannot file the CLA electronically, you can email <[email protected]>.

### How To: Add a new function
### How To: Add a new function

Adding new functionality to Realm JavaScript requires that you modify a few places in the repository. As an example, consider adding a function `crashOnStart()` to the class `Realm`. The subsections below guides you through where and what to add.

Expand Down Expand Up @@ -89,7 +89,7 @@ In order to call the C++ implementation, the JavaScript engine has to know about

#### Update the RPC protocol

This is required for the Chrome Debugger to work with React Native. If the method added is a pure Javascript function,
This is required for the Chrome Debugger to work with React Native. If the method added is a pure Javascript function,
you can skip this step as it will work automatically. If the method is a C++ method you will
need to manually update the RPC protocol.

Expand All @@ -101,7 +101,7 @@ If the method is static method you need to:

* Add function name to `lib/browser/index.js` or the relevant class under `lib/browser/`. It should forward the method
call to an RPC method, e.g like:

```
const Sync = {
"_myMethod": function(arg) {
Expand All @@ -110,7 +110,7 @@ const Sync = {
// ...
};
```

* Add the RPC sender method to `/lib/browser/rpc.js`.
* Add the RPC receiver endpoint in `/src/rpc.cpp`.

Expand Down Expand Up @@ -198,3 +198,9 @@ Then run the following to log into the GitHub container registry, entering your
```
docker login ghcr.io
```

### How to: Run the BaaS server locally

It can be useful to run the BaaS server directly, rather than in the docker container, for example to use the latest version from a branch or for debugging.

You can do this by running: `AWS_ACCESS_KEY_ID="???" AWS_SECRET_ACCESS_KEY="???" ./vendor/realm-core/evergreen/install_baas.sh -w ../baas-work-dir -b master` from the `realm-js` root directory. Logs can be accessed in `../baas-work-dir/baas_server.log` (the `baas-work-dir` is kept one level up from the `realm-js` repo).
2 changes: 1 addition & 1 deletion contrib/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ You should check that VS Code is using the workspace version of TypeScript rathe
1. Open the `realm-js` root directory in VS Code and open any TypeScript file
2. Press Shift+Cmd+P to open the command palette
3. Start typing `select typescript version` to select the `TypeScript: Select TypeScript Version` command
4. Ensure `Use Workspace Version` is elected.
4. Ensure `Use Workspace Version` is selected.

#### C++

Expand Down
4 changes: 2 additions & 2 deletions dependencies.list
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PACKAGE_NAME=realm-js
VERSION=10.11.0
VERSION=10.12.0-beta.1
REALM_CORE_VERSION=11.8.0
NAPI_VERSION=4
OPENSSL_VERSION=1.1.1g
MDBREALM_TEST_SERVER_TAG=2021-06-01
MDBREALM_TEST_SERVER_TAG=2022-01-11
Loading