From 4a73a4660451db3b22f351279e01178e1c9fa7b4 Mon Sep 17 00:00:00 2001 From: Kenneth Geisshirt Date: Tue, 9 Aug 2022 15:20:24 +0200 Subject: [PATCH] Update API --- src/js_sync.hpp | 4 ++-- types/index.d.ts | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/js_sync.hpp b/src/js_sync.hpp index 04760dc775..e632a21737 100644 --- a/src/js_sync.hpp +++ b/src/js_sync.hpp @@ -1017,9 +1017,9 @@ void SyncClass::populate_sync_config(ContextType ctx, ObjectType realm_constr // iii) recover: // iv) recoverOrDiscard: // - // The default setting is manual + // The default setting is recoverOrDiscard - config.sync_config->client_resync_mode = realm::ClientResyncMode::Manual; + config.sync_config->client_resync_mode = realm::ClientResyncMode::RecoverOrDiscard; ValueType client_reset_value = Object::get_property(ctx, sync_config_object, "clientReset"); if (!Value::is_undefined(ctx, client_reset_value)) { auto client_reset_object = Value::validated_to_object(ctx, client_reset_value); diff --git a/types/index.d.ts b/types/index.d.ts index b6907f044f..0d902dd3ec 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -151,8 +151,8 @@ declare namespace Realm { type ClientResetBeforeCallback = (localRealm: Realm) => void; type ClientResetAfterCallback = (localRealm: Realm, remoteRealm: Realm, didRecover?: boolean) => void; - interface ClientResetConfiguration { - mode: ClientResetModeT; + interface ClientResetConfiguration { + mode: ClientResetMode; clientResetBefore?: ClientResetBeforeCallback; clientResetAfter?: ClientResetAfterCallback; } @@ -165,6 +165,7 @@ declare namespace Realm { newRealmFileBehavior?: OpenRealmBehaviorConfiguration; existingRealmFileBehavior?: OpenRealmBehaviorConfiguration; error?: ErrorCallback; + clientReset?: ClientResetConfiguration; } // We only allow `flexible` to be `true` or `undefined` - `{ flexible: false }` @@ -174,7 +175,6 @@ declare namespace Realm { interface FlexibleSyncConfiguration extends BaseSyncConfiguration { flexible: true; partitionValue?: never; - clientReset?: ClientResetConfiguration; /** * Optional object to configure the setup of an initial set of flexible * sync subscriptions to be used when opening the Realm. If this is specified, @@ -221,7 +221,6 @@ declare namespace Realm { interface PartitionSyncConfiguration extends BaseSyncConfiguration { flexible?: never; partitionValue: Realm.App.Sync.PartitionValue; - clientReset?: ClientResetConfiguration; } type SyncConfiguration = FlexibleSyncConfiguration | PartitionSyncConfiguration;