@syncular/client 0.25.2 → 0.26.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 +35 -7
- package/dist/client.d.ts +10 -1
- package/dist/client.js +153 -63
- package/dist/diagnostics.d.ts +13 -2
- package/dist/errors.d.ts +20 -1
- package/dist/errors.js +23 -0
- package/dist/http.d.ts +6 -1
- package/dist/http.js +10 -6
- package/dist/multi-tab.d.ts +11 -12
- package/dist/multi-tab.js +86 -78
- package/dist/realtime-supervisor.js +12 -2
- package/dist/worker-entry.d.ts +5 -1
- package/dist/worker-entry.js +13 -4
- package/dist/worker-host.d.ts +25 -2
- package/dist/worker-host.js +17 -4
- package/dist/worker-protocol.d.ts +14 -1
- package/package.json +3 -3
- package/src/client.ts +212 -81
- package/src/diagnostics.ts +17 -2
- package/src/errors.ts +38 -1
- package/src/http.ts +21 -7
- package/src/multi-tab.ts +99 -92
- package/src/realtime-supervisor.ts +16 -2
- package/src/worker-entry.ts +18 -4
- package/src/worker-host.ts +39 -11
- package/src/worker-protocol.ts +14 -1
package/src/worker-protocol.ts
CHANGED
|
@@ -34,7 +34,7 @@ import type {
|
|
|
34
34
|
WindowState,
|
|
35
35
|
} from './client';
|
|
36
36
|
import type { SqlRow, SqlValue } from './database';
|
|
37
|
-
import type { ClientDiagnosticsSnapshot } from './diagnostics';
|
|
37
|
+
import type { ClientDiagnosticsSnapshot, RealtimePolicy } from './diagnostics';
|
|
38
38
|
import type { EncryptionKeyringConfig } from './encryption';
|
|
39
39
|
import type { ClientChangeBatch, LocalRevision } from './invalidation';
|
|
40
40
|
import type { LocalDataPurgeInput, LocalDataPurgeResult } from './local-purge';
|
|
@@ -102,12 +102,23 @@ export interface WorkerInitConfig {
|
|
|
102
102
|
readonly schema: ClientSchema;
|
|
103
103
|
readonly database: WorkerDatabaseInit;
|
|
104
104
|
readonly endpoints: WorkerEndpoints;
|
|
105
|
+
/**
|
|
106
|
+
* Host auth headers for sync, segment, and blob requests. `setHeaders`
|
|
107
|
+
* replaces the whole set at runtime. WebSockets cannot carry headers, so
|
|
108
|
+
* realtime authenticates through `realtimeUrl` (cookie or ticket).
|
|
109
|
+
*/
|
|
110
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
105
111
|
/** Portable raw keyring installed inside the worker-owned client core. */
|
|
106
112
|
readonly encryption?: EncryptionKeyringConfig;
|
|
107
113
|
/** Open the worker-owned replica behind the fail-closed security gate. */
|
|
108
114
|
readonly securityPreflight?: boolean;
|
|
109
115
|
readonly clientId?: string;
|
|
110
116
|
readonly limits?: SyncClientLimits;
|
|
117
|
+
/**
|
|
118
|
+
* SPEC §8.8 realtime policy for the worker-owned core; forwarded verbatim.
|
|
119
|
+
* Absent ⇒ `optional` (a connected socket, otherwise `POST /sync`).
|
|
120
|
+
*/
|
|
121
|
+
readonly realtimePolicy?: RealtimePolicy;
|
|
111
122
|
/**
|
|
112
123
|
* RFC 0005 previous-version context, forwarded verbatim into the worker's
|
|
113
124
|
* `SyncClientConfig`. Absent ⇒ the feature stays off (default-off).
|
|
@@ -190,6 +201,8 @@ export interface WorkerApi extends Omit<
|
|
|
190
201
|
options?: { readonly mediaType?: string; readonly name?: string },
|
|
191
202
|
): Promise<BlobRef>;
|
|
192
203
|
fetchBlob(blobIdOrRef: string): Promise<CachedBlob>;
|
|
204
|
+
/** Replace the host auth header set; the next HTTP request uses it. */
|
|
205
|
+
setHeaders(headers: Readonly<Record<string, string>>): void;
|
|
193
206
|
/** Sever/restore the transport + realtime (offline simulation, demos). */
|
|
194
207
|
setOffline(offline: boolean): void;
|
|
195
208
|
close(): Promise<void>;
|