Skip to content

Commit

Permalink
Upgrade to Realm Core v13.23.2 (#6225)
Browse files Browse the repository at this point in the history
* Upgrade to Realm Core v13.23.2
---------
Co-authored-by: LJ <[email protected]>
  • Loading branch information
kneth authored Nov 2, 2023
1 parent 791d4d4 commit 99ba0a3
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 58 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,23 @@
* None

### Enhancements
* None
* Allow asymmetric objects to contain fields with non-embedded (top-level) links (rather than only embedded links). ([realm/realm-core#7003](https://github.com/realm/realm-core/pull/7003))

### Fixed
* The `onBefore`, `onAfter`, and `onFallback` client reset callbacks were not called. ([#6201](https://github.com/realm/realm-js/issues/6201), since v12.0.0)
* `Symbol.unscopables` has been implemented on the base class of `Realm.Results`, `Realm.List`, and `Realm.Set`. ([#6215](https://github.com/realm/realm-js/pull/6215))

* Deleting an object in an asymmetric table would cause a crash. ([realm/realm-kotlin#1537](https://github.com/realm/realm-kotlin/issues/1537), since v10.19.0)
* Updating subscriptions did not trigger Realm auto-refreshes, sometimes resulting in async refresh hanging until another write was performed by something else. ([realm/realm-core#7031](https://github.com/realm/realm-core/pull/7031))
* Fix inter-process locking for concurrent Realm file access resulting in an inter-process deadlock on FAT32/exFAT file systems. ([realm/realm-core#6959](https://github.com/realm/realm-core/pull/6959))

### Compatibility
* React Native >= v0.71.4
* Realm Studio v14.0.0.
* File format: generates Realms with format v23 (reads and upgrades file format v5 or later for non-synced Realm, upgrades file format v10 or later for synced Realms).

### Internal
* Some disabled tests for client reset (partition based sync) have been enabled. ([#6201](https://github.com/realm/realm-js/issues/6201)
* Upgraded Realm Core from v13.22.0 to v13.23.2. ([#6220](https://github.com/realm/realm-js/issues/6220))

## 12.2.1 (2023-10-05)

Expand Down
134 changes: 83 additions & 51 deletions integration-tests/tests/src/tests/sync/asymmetric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,65 +23,97 @@ import { authenticateUserBefore, importAppBefore, openRealmBeforeEach } from "..
import { buildAppConfig } from "../../utils/build-app-config";

describe.skipIf(environment.missingServer, "Asymmetric sync", function () {
describe("Configuration and schema", function () {
this.longTimeout();
const PersonSchema: Realm.ObjectSchema = {
name: "Person",
asymmetric: true,
embedded: false,
primaryKey: "_id",
properties: {
_id: "objectId",
age: "int",
name: "string",
},
};
[true, false].forEach((embeddedAndAsymmetric) => {
describe(`Configuration and schema (embedded = ${embeddedAndAsymmetric})`, function () {
this.longTimeout();
const PersonSchema: Realm.ObjectSchema = {
name: "Person",
asymmetric: true,
embedded: false,
primaryKey: "_id",
properties: {
_id: "objectId",
age: "int",
name: "string",
dogs: "Dog[]",
},
};

importAppBefore(buildAppConfig("with-flx").anonAuth().flexibleSync());
authenticateUserBefore();
openRealmBeforeEach({
schema: [PersonSchema],
sync: {
flexible: true,
},
});
const DogSchema: Realm.ObjectSchema = {
name: "Dog",
asymmetric: embeddedAndAsymmetric,
embedded: embeddedAndAsymmetric,
primaryKey: embeddedAndAsymmetric ? undefined : "_id",
properties: {
_id: "objectId",
name: "string",
},
};

it("Schema with asymmetric = true and embedded = false", function (this: RealmContext) {
const schema = this.realm.schema;
expect(schema.length).to.equal(1);
expect(schema[0].asymmetric).to.be.true;
expect(schema[0].embedded).to.be.false;
});
importAppBefore(buildAppConfig("with-flx").anonAuth().flexibleSync());
authenticateUserBefore();
openRealmBeforeEach({
schema: [PersonSchema, DogSchema],
sync: {
flexible: true,
},
});

it("creating an object for an asymmetric schema returns undefined", function (this: RealmContext) {
this.realm.write(() => {
const returnValue = this.realm.create(PersonSchema.name, {
_id: new BSON.ObjectId(),
name: "Joe",
age: 12,
it("Schema with asymmetric = true and embedded = false", function (this: RealmContext) {
const schema = this.realm.schema.find((s) => s.name === PersonSchema.name);
expect(schema?.asymmetric).to.be.true;
expect(schema?.embedded).to.be.false;
});

it("creating an object for an asymmetric schema returns undefined", function (this: RealmContext) {
this.realm.write(() => {
const returnValue = this.realm.create(PersonSchema.name, {
_id: new BSON.ObjectId(),
name: "Joe",
age: 12,
});
expect(returnValue).to.be.undefined;
});
expect(returnValue).to.be.undefined;
});
});

it("an asymmetric schema cannot be queried through 'objects()'", function (this: RealmContext) {
expect(() => {
this.realm.objects(PersonSchema.name);
}).to.throw("You cannot query an asymmetric object.");
});
it("an asymmetric schema cannot be queried through 'objects()'", function (this: RealmContext) {
expect(() => {
this.realm.objects(PersonSchema.name);
}).to.throw("You cannot query an asymmetric object.");
});

it("an asymmetric schema cannot be queried through 'objectForPrimaryKey()'", function (this: RealmContext) {
expect(() => {
this.realm.objectForPrimaryKey(PersonSchema.name, new BSON.ObjectId());
}).to.throw("You cannot query an asymmetric object.");
});
it("an asymmetric schema cannot be queried through 'objectForPrimaryKey()'", function (this: RealmContext) {
expect(() => {
this.realm.objectForPrimaryKey(PersonSchema.name, new BSON.ObjectId());
}).to.throw("You cannot query an asymmetric object.");
});

it("an asymmetric schema cannot be queried through '_objectForObjectKey()'", function (this: RealmContext) {
expect(() => {
// A valid objectKey is not needed for this test
//@ts-expect-error Internal method
this.realm._objectForObjectKey(PersonSchema.name, "12345");
}).to.throw("You cannot query an asymmetric object.");
it("an asymmetric schema cannot be queried through '_objectForObjectKey()'", function (this: RealmContext) {
expect(() => {
// A valid objectKey is not needed for this test
//@ts-expect-error Internal method
this.realm._objectForObjectKey(PersonSchema.name, "12345");
}).to.throw("You cannot query an asymmetric object.");
});

it("relationships", async function (this: RealmContext) {
if (!embeddedAndAsymmetric) {
await this.realm.objects(DogSchema.name).subscribe();
}
expect(() => {
this.realm.write(() => {
this.realm.create(PersonSchema.name, {
_id: new BSON.ObjectId(),
name: "Joe",
age: 12,
dogs: [
{ _id: new BSON.ObjectId(), name: "Rex" },
{ _id: new BSON.ObjectId(), name: "Fido" },
],
});
});
}).not.throw();
});
});
});
});
2 changes: 1 addition & 1 deletion packages/realm/bindgen/js_opt_in_spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ classes:
- get_or_create_object_with_primary_key
- make_network_transport
- delete_data_for_object
- is_empty_realm
- base64_decode
- make_logger_factory
- make_logger
Expand Down Expand Up @@ -330,6 +329,7 @@ classes:
- is_in_transaction
- is_in_migration
- is_closed
- is_empty
- sync_session
- get_latest_subscription_set
- begin_transaction
Expand Down
2 changes: 1 addition & 1 deletion packages/realm/bindgen/vendor/realm-core
Submodule realm-core updated 110 files
2 changes: 1 addition & 1 deletion packages/realm/dependencies.list
Original file line number Diff line number Diff line change
@@ -1 +1 @@
REALM_CORE_VERSION=13.22.0
REALM_CORE_VERSION=13.23.2
2 changes: 1 addition & 1 deletion packages/realm/src/Realm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,7 @@ export class Realm {
* @since 1.10.0
*/
get isEmpty(): boolean {
return binding.Helpers.isEmptyRealm(this.internal);
return this.internal.isEmpty;
}

/**
Expand Down
1 change: 0 additions & 1 deletion packages/realm/src/schema/normalize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ export function normalizeObjectSchema(arg: RealmObjectConstructor | ObjectSchema
!primaryKeyFieldIsMissing,
objectError(name, `'${primaryKey}' is set as the primary key field but was not found in 'properties'.`),
);
assert(!asymmetric || !embedded, objectError(name, "Cannot be both asymmetric and embedded."));

return {
name,
Expand Down

0 comments on commit 99ba0a3

Please sign in to comment.