@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.
- package/README.md +32 -0
- package/dist/client.js +18 -3
- package/dist/multi-tab.d.ts +96 -22
- package/dist/multi-tab.js +242 -10
- package/dist/outbox.d.ts +5 -0
- package/dist/outbox.js +11 -3
- package/dist/outcomes.js +6 -2
- package/dist/previous-version.d.ts +3 -1
- package/dist/previous-version.js +24 -5
- package/dist/worker-entry.d.ts +17 -1
- package/dist/worker-entry.js +73 -4
- package/dist/worker-host.d.ts +23 -26
- package/dist/worker-host.js +122 -311
- package/dist/worker-protocol.d.ts +16 -0
- package/dist/worker-protocol.js +2 -0
- package/package.json +3 -3
- package/src/client.ts +26 -3
- package/src/multi-tab.ts +366 -34
- package/src/outbox.ts +16 -2
- package/src/outcomes.ts +6 -2
- package/src/previous-version.ts +32 -5
- package/src/worker-entry.ts +123 -4
- package/src/worker-host.ts +143 -381
- package/src/worker-protocol.ts +18 -0
package/src/worker-protocol.ts
CHANGED
|
@@ -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
|
|