@syncular/client 0.48.0 → 0.49.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -64,6 +64,12 @@ export const NOT_LEADER_CODE = 'client.not_leader';
64
64
  export const WORKER_FAILED_CODE = 'client.worker_failed';
65
65
  /** A page/worker bundle identity changed and a full host reload is required. */
66
66
  export const WORKER_RESTART_REQUIRED_CODE = 'client.worker_restart_required';
67
+ /** SPEC §12: local-authority use without `startSyncWorker({ openLocalAuthority })`. */
68
+ export const LOCAL_AUTHORITY_UNCONFIGURED_CODE =
69
+ 'client.local_authority_unconfigured';
70
+
71
+ /** SPEC §12.3 local-authority state. */
72
+ export type LocalAuthorityState = 'local' | 'attaching' | 'attached';
67
73
 
68
74
  // ---------------------------------------------------------------------------
69
75
  // Init configuration (structured-clone safe)
@@ -112,10 +118,22 @@ export interface WorkerInitConfig {
112
118
  readonly headers?: Readonly<Record<string, string>>;
113
119
  /** Portable raw keyring installed inside the worker-owned client core. */
114
120
  readonly encryption?: EncryptionKeyringConfig;
121
+ /**
122
+ * This tab took the lock from an unreachable leader: take the storage lock
123
+ * from that leader's worker, which fences its database, and retry the open
124
+ * while its OPFS handles drain.
125
+ */
126
+ readonly takeOverStorage?: boolean;
115
127
  /** Open the worker-owned replica behind the fail-closed security gate. */
116
128
  readonly authorityReads?: readonly import('./authority').AuthorityReadDeclaration[];
117
129
  readonly securityPreflight?: boolean;
118
130
  readonly transportEnabled?: boolean;
131
+ /**
132
+ * SPEC §12: sync against a local authority in a sibling file until
133
+ * `attachLocalAuthority` moves its rows to `endpoints.syncUrl`. Requires
134
+ * `startSyncWorker({ openLocalAuthority })`.
135
+ */
136
+ readonly localAuthority?: boolean;
119
137
  readonly clientId?: string;
120
138
  readonly limits?: SyncClientLimits;
121
139
  readonly retainFailedCommits?: boolean;
@@ -213,6 +231,12 @@ export interface WorkerApi extends Omit<
213
231
  setHeaders(headers: Readonly<Record<string, string>>): void;
214
232
  /** Sever/restore the transport + realtime (offline simulation, demos). */
215
233
  setOffline(offline: boolean): void;
234
+ /** SPEC §12.3 state; `undefined` when init did not enable the local authority. */
235
+ localAuthorityState(): LocalAuthorityState | undefined;
236
+ /** SPEC §12.3: upload the local authority's rows to `endpoints.syncUrl`. */
237
+ attachLocalAuthority(): Promise<void>;
238
+ /** SPEC §12.3: roll back a stopped attach and sync locally again. */
239
+ abandonLocalAuthorityAttach(): Promise<void>;
216
240
  close(): Promise<void>;
217
241
  }
218
242