Skip to content

Commit

Permalink
Update API
Browse files Browse the repository at this point in the history
  • Loading branch information
kneth committed Aug 9, 2022
1 parent a5371ce commit 4a73a46
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/js_sync.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1017,9 +1017,9 @@ void SyncClass<T>::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);
Expand Down
7 changes: 3 additions & 4 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ declare namespace Realm {

type ClientResetBeforeCallback = (localRealm: Realm) => void;
type ClientResetAfterCallback = (localRealm: Realm, remoteRealm: Realm, didRecover?: boolean) => void;
interface ClientResetConfiguration<ClientResetModeT = ClientResetMode> {
mode: ClientResetModeT;
interface ClientResetConfiguration {
mode: ClientResetMode;
clientResetBefore?: ClientResetBeforeCallback;
clientResetAfter?: ClientResetAfterCallback;
}
Expand All @@ -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 }`
Expand All @@ -174,7 +175,6 @@ declare namespace Realm {
interface FlexibleSyncConfiguration extends BaseSyncConfiguration {
flexible: true;
partitionValue?: never;
clientReset?: ClientResetConfiguration<ClientResetMode.Manual>;
/**
* 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,
Expand Down Expand Up @@ -221,7 +221,6 @@ declare namespace Realm {
interface PartitionSyncConfiguration extends BaseSyncConfiguration {
flexible?: never;
partitionValue: Realm.App.Sync.PartitionValue;
clientReset?: ClientResetConfiguration<ClientResetMode>;
}

type SyncConfiguration = FlexibleSyncConfiguration | PartitionSyncConfiguration;
Expand Down

0 comments on commit 4a73a46

Please sign in to comment.