Skip to content

Commit

Permalink
Merge branch 'main' into fp/collections-mixed-sync-tests
Browse files Browse the repository at this point in the history
* main:
  Installing dependencies again after checkout
  [12.7.1] Bump version (#6632)
  RJS-2806: Upgrade to Realm Core v14.5.2 (#6629)
  RJS-2804: remove incorrect privacy manifest for iOS (#6627)
  Adding permissions fix "Resource not accessible by integration"
  RJS-2143: Tests to clarify number conversion (#6623)
  Fixing unstable test (#6625)
  Adding a script to update submodules
  Update to the new documentation URL (#6597)
  Prepare for vNext
  [12.7.0] Bump version (#6622)
  RJS-2757: Add Apple Privacy Manifest (#6605)
  RJS-2784: Clear internal state to avoid crashes when React Native app is reloaded (#6612)
  Use CMake 3.29.2 (#6619)
  RJS-2801: Upgrade to Realm Core v14.5.1 (#6611)
  • Loading branch information
papafe committed Apr 24, 2024
2 parents 97e9f85 + 6269081 commit 2487ddb
Show file tree
Hide file tree
Showing 17 changed files with 202 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: Setup node version
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 20.11.1
cache: npm

- name: Setup Wireit cache
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/pr-realm-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
- name: Setup node version
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 20.11.1
cache: npm

- name: Get NPM cache directory
Expand All @@ -108,6 +108,11 @@ jobs:
if: ${{ runner.os == 'Windows' }}
uses: ilammy/msvc-dev-cmd@v1

- name: Setup CMake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.29.2'

# ninja-build is used by default if available and results in faster build times
# On linux, electron requires a connected display. We fake this by giving it a headless environment using xvfb
# Relevant issue: https://github.com/juliangruber/browser-run/issues/147
Expand Down Expand Up @@ -318,6 +323,13 @@ jobs:
if: ${{ runner.os == 'Windows' }}
uses: ilammy/msvc-dev-cmd@v1

# we use a different version for Android, and it is specified below
- name: Setup CMake
if: ${{ matrix.variant.os != 'android' }}
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.29.2'

- name: ccache
uses: hendrikmuhs/ccache-action@v1
if: ${{ matrix.variant.environment == 'react-native-test-app' }}
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
pull-requests: write
steps:

- name: Checkout code
Expand Down Expand Up @@ -49,7 +51,7 @@ jobs:
${{ runner.os }}-node-
- name: Install node modules
run: npm ci --ignore-scripts
run: npm ci

- name: Download prebuild artifacts from PR
uses: dawidd6/action-download-artifact@d0f291cf39bd21965ea9c4c6e210fc355c3844ed
Expand Down Expand Up @@ -116,6 +118,9 @@ jobs:
submodules: recursive
ref: ${{ steps.find-pull-request.outputs.base-ref }}

- name: Install node modules (again)
run: npm ci

- name: Extract Changelog
run: node scripts/extract-changelog.js ${{ steps.get-version.outputs.version }} > EXTRACTED_CHANGELOG.md

Expand Down
22 changes: 20 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
## vNext (TBD)
## 12.7.1 (2024-04-19)

### Fixed
* Fixed a crash when integrating removal of already removed dictionary key. ([realm/realm-core#7488](https://github.com/realm/realm-core/issues/7488), since v10.0.0)
* Removed incorrect privacy manifest for iOS. ([#6624](https://github.com/realm/realm-js/issues/6624), since v12.7.0)

### Compatibility
* React Native >= v0.71.4
* Realm Studio v15.0.0.
* File format: generates Realms with format v24 (reads and upgrades file format v10 or later).

### Internal
* Upgraded Realm Core from v14.5.1 to v14.5.2. ([#6628](https://github.com/realm/realm-js/issues/6628))
* Update URLs to documentation.

## 12.7.0 (2024-04-17)

> [!NOTE]
> This version bumps the Realm file format to version 24. It is not possible to downgrade to earlier versions. Older files will automatically be upgraded to the new file format. Files created by Realm JavaScript prior to v6.0.0, might not be upgradeable. **Only Realm Studio 15.0.0 or later** will be able to open the new file format.
Expand All @@ -7,6 +22,7 @@
> This version communicates with Atlas Device Services through a different URL (https://services.cloud.mongodb.com). While we consider this an internal detail of the SDK, you might need to update rules in firewalls or other configuration that you've used to limit connections made by your app.
### Enhancements
* Added [iOS Privacy Manifest](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files?language=objc). ([#6547](https://github.com/realm/realm-js/issues/6547)
* Updated bundled OpenSSL version to 3.2.0. ([realm/realm-core#7303](https://github.com/realm/realm-core/pull/7303))
* Improved performance of object notifiers with complex schemas by ~20%. ([realm/realm-core#7424](https://github.com/realm/realm-core/pull/7424))
* Improved performance with very large number of notifiers by ~75%. ([realm/realm-core#7424](https://github.com/realm/realm-core/pull/7424))
Expand Down Expand Up @@ -95,6 +111,7 @@ function expectDictionary(value: unknown): asserts value is Realm.Dictionary {
* `data` and `string` are now strongly typed for comparisons and queries. This change is especially relevant when querying for a string constant on a Mixed property, as now only strings will be returned. If searching for `data` is desired, then that type must be specified by the constant. In RQL the new way to specify a binary constant is to use `mixed = bin('xyz')` or `mixed = binary('xyz')`. ([realm/realm-core#6407](https://github.com/realm/realm-core/issues/6407))
* Fixed diverging history due to a bug in the replication code when setting default null values (embedded objects included). ([realm/realm-core#7536](https://github.com/realm/realm-core/issues/7536))
* Null pointer exception may be triggered when logging out and async commits callbacks not executed. ([realm/realm-core#7434](https://github.com/realm/realm-core/issues/7434), since v12.6.0)
* Fixed a bug which caused crashes when reloading React Native apps. ([#6579](https://github.com/realm/realm-js/issues/6579), since v12.0.0)

### Compatibility
* React Native >= v0.71.4
Expand All @@ -103,8 +120,9 @@ function expectDictionary(value: unknown): asserts value is Realm.Dictionary {

### Internal
* The base URL used to communicate with the Atlas App Services was changed from "https://realm.mongodb.com" to "https://services.cloud.mongodb.com". ([realm/realm-core#7534](https://github.com/realm/realm-core/pull/7534)).
* Upgraded Realm Core from v13.26.0 to v14.5.0. ([#6499](https://github.com/realm/realm-js/issues/6499), [#6541](https://github.com/realm/realm-js/issues/6541), [#6568](https://github.com/realm/realm-js/issues/6568), [#6572](https://github.com/realm/realm-js/issues/6572), and [#6599](https://github.com/realm/realm-js/issues/6599))
* Upgraded Realm Core from v13.26.0 to v14.5.1. ([#6499](https://github.com/realm/realm-js/issues/6499), [#6541](https://github.com/realm/realm-js/issues/6541), [#6568](https://github.com/realm/realm-js/issues/6568), [#6572](https://github.com/realm/realm-js/issues/6572), [#6599](https://github.com/realm/realm-js/issues/6599), and [#6610](https://github.com/realm/realm-js/issues/6610))
* Publish releases with [provenance statements](https://docs.npmjs.com/generating-provenance-statements).
* Use CMake v3.29.2 and Node v20.11.1 on Github Actions.

## 12.7.0-rc.0 (2024-03-26)

Expand Down
60 changes: 60 additions & 0 deletions integration-tests/tests/src/tests/shared-realms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,64 @@ describe("SharedRealm operations", () => {
expect(this.realm.objectForPrimaryKey("Person", "Bob")).primaryKey.equals("Bob");
});
});

describe("Number conversion", () => {
beforeEach(() => {
Realm.clearTestState();
});

it("Int field does not accept Infinity", async () => {
const IntSchema = {
name: "IntSchema",
properties: {
id: "int",
number: "int",
},
primaryKey: "id",
};

const realm = await Realm.open({
inMemory: true,
schema: [IntSchema],
});

// Infinity is not a valid integer. Node and RN throw different error messages so we only
// check if throws.
// node: "The number Infinity cannot be converted to a BigInt because it is not an integer"
// RN: "number is not integral"
expect(() => {
realm.write(() => {
realm.create(IntSchema.name, {
id: 1,
number: Infinity,
});
});
}).to.throw();
});

it("Double field accepts Infinity", async () => {
const DoubleSchema = {
name: "DoubleSchema",
properties: {
id: "int",
number: "double",
},
primaryKey: "id",
};

const realm = await Realm.open({
inMemory: true,
schema: [DoubleSchema],
});

const obj = realm.write(() => {
return realm.create(DoubleSchema.name, {
id: 1,
number: Infinity,
});
});

expect(obj.number).equals(Infinity);
});
});
});
16 changes: 16 additions & 0 deletions integration-tests/tests/src/tests/sync/geospatial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ describe(`GeoSpatial`, () => {

describe("Base cases", () => {
it("GeoCircle basic", async function (this: RealmContext) {
this.longTimeout();

let circle: GeoCircle = {
center: [0, 0],
distance: 0.001,
Expand Down Expand Up @@ -308,6 +310,8 @@ describe(`GeoSpatial`, () => {
});

it("GeoBox basic", async function (this: RealmContext) {
this.longTimeout();

let box: GeoBox = {
bottomLeft: [-1, -1],
topRight: [1, 1],
Expand Down Expand Up @@ -362,6 +366,8 @@ describe(`GeoSpatial`, () => {
});

it("GeoPolygon basic", async function (this: RealmContext) {
this.longTimeout();

let polygon: GeoPolygon = {
outerRing: [
[-2, -2],
Expand Down Expand Up @@ -453,6 +459,8 @@ describe(`GeoSpatial`, () => {
});

it("Alternative GeoPoint", async function (this: RealmContext) {
this.longTimeout();

//Circle
let circle: GeoCircle = {
center: [-32.34, -25],
Expand Down Expand Up @@ -512,6 +520,8 @@ describe(`GeoSpatial`, () => {
});

it("Alternative GeoPolygon", async function (this: RealmContext) {
this.longTimeout();

//Polygon
let polygon: CanonicalGeoPolygon = {
type: "Polygon",
Expand Down Expand Up @@ -557,6 +567,8 @@ describe(`GeoSpatial`, () => {

// Altitude throws an error in sync queries
it("Altitude is supported but ignored", async function (this: RealmContext) {
this.longTimeout();

let box: GeoBox = {
bottomLeft: [50, 50, 10],
topRight: [52, 52, 10],
Expand Down Expand Up @@ -588,6 +600,8 @@ describe(`GeoSpatial`, () => {
});

it("Coordinate Substitution", async function (this: RealmContext) {
this.longTimeout();

//Circle
const circle: GeoCircle = {
center: [0, 0],
Expand Down Expand Up @@ -647,6 +661,8 @@ describe(`GeoSpatial`, () => {

// Not sync relevant, so we can skip doing this twice
it("Distance conversions", function (this: RealmContext) {
this.longTimeout();

//Test with about 60 centimeters accuracy
const km = 20;
expect(kmToRadians(km)).to.be.approximately(0.00313573007, 0.0000001);
Expand Down
1 change: 1 addition & 0 deletions integration-tests/tests/src/tests/sync/sync-session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -965,6 +965,7 @@ describe("SessionTest", () => {
realm1.syncSession?.resume();
user1 = await this.app.logIn(credentials1);
await realm1.syncSession?.uploadAllLocalChanges();
await realm1.syncSession?.downloadAllServerChanges();

// create copy no. 2 of the realm
realm1.writeCopyTo(outputConfig2);
Expand Down

0 comments on commit 2487ddb

Please sign in to comment.