@syncular/client 0.47.0 → 0.49.1

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)
@@ -116,6 +122,12 @@ export interface WorkerInitConfig {
116
122
  readonly authorityReads?: readonly import('./authority').AuthorityReadDeclaration[];
117
123
  readonly securityPreflight?: boolean;
118
124
  readonly transportEnabled?: boolean;
125
+ /**
126
+ * SPEC §12: sync against a local authority in a sibling file until
127
+ * `attachLocalAuthority` moves its rows to `endpoints.syncUrl`. Requires
128
+ * `startSyncWorker({ openLocalAuthority })`.
129
+ */
130
+ readonly localAuthority?: boolean;
119
131
  readonly clientId?: string;
120
132
  readonly limits?: SyncClientLimits;
121
133
  readonly retainFailedCommits?: boolean;
@@ -213,6 +225,12 @@ export interface WorkerApi extends Omit<
213
225
  setHeaders(headers: Readonly<Record<string, string>>): void;
214
226
  /** Sever/restore the transport + realtime (offline simulation, demos). */
215
227
  setOffline(offline: boolean): void;
228
+ /** SPEC §12.3 state; `undefined` when init did not enable the local authority. */
229
+ localAuthorityState(): LocalAuthorityState | undefined;
230
+ /** SPEC §12.3: upload the local authority's rows to `endpoints.syncUrl`. */
231
+ attachLocalAuthority(): Promise<void>;
232
+ /** SPEC §12.3: roll back a stopped attach and sync locally again. */
233
+ abandonLocalAuthorityAttach(): Promise<void>;
216
234
  close(): Promise<void>;
217
235
  }
218
236