@syncular/client 0.15.48 → 0.17.0
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 +50 -0
- package/dist/bun-database.js +11 -0
- package/dist/client.d.ts +13 -20
- package/dist/client.js +78 -61
- package/dist/node-database.js +8 -0
- package/dist/outbox.d.ts +5 -1
- package/dist/outbox.js +26 -3
- package/dist/reactive-store.d.ts +12 -6
- package/dist/reactive-store.js +219 -45
- package/dist/realtime-supervisor.d.ts +1 -1
- package/dist/realtime-supervisor.js +2 -8
- package/dist/worker-entry.js +6 -10
- package/dist/worker-host.d.ts +4 -7
- package/dist/worker-host.js +3 -15
- package/dist/worker-protocol.d.ts +4 -18
- package/package.json +3 -11
- package/src/bun-database.ts +10 -0
- package/src/client.ts +124 -69
- package/src/node-database.ts +7 -0
- package/src/outbox.ts +39 -8
- package/src/reactive-store.ts +226 -56
- package/src/realtime-supervisor.ts +2 -11
- package/src/worker-entry.ts +7 -10
- package/src/worker-host.ts +5 -22
- package/src/worker-protocol.ts +7 -33
- package/dist/realtime-supervisor-observation.d.ts +0 -8
- package/dist/realtime-supervisor-observation.js +0 -15
- package/src/realtime-supervisor-observation.ts +0 -21
package/src/worker-protocol.ts
CHANGED
|
@@ -20,13 +20,11 @@ import type { WakeReason } from '@syncular/core';
|
|
|
20
20
|
import type { BlobRef, CachedBlob } from './blob';
|
|
21
21
|
import type {
|
|
22
22
|
ConflictRecord,
|
|
23
|
-
|
|
23
|
+
ClientSnapshotMethods,
|
|
24
24
|
MutationInput,
|
|
25
25
|
PresencePeer,
|
|
26
26
|
QueryReadSpec,
|
|
27
27
|
QuerySnapshot,
|
|
28
|
-
RejectionRecord,
|
|
29
|
-
SchemaFloor,
|
|
30
28
|
SecurityLifecycle,
|
|
31
29
|
SubscribeInput,
|
|
32
30
|
SyncClientLimits,
|
|
@@ -34,27 +32,15 @@ import type {
|
|
|
34
32
|
WindowState,
|
|
35
33
|
} from './client';
|
|
36
34
|
import type { SqlRow, SqlValue } from './database';
|
|
37
|
-
import type {
|
|
38
|
-
ClientDiagnosticsRequest,
|
|
39
|
-
ClientDiagnosticsSnapshot,
|
|
40
|
-
} from './diagnostics';
|
|
35
|
+
import type { ClientDiagnosticsSnapshot } from './diagnostics';
|
|
41
36
|
import type { EncryptionKeyringConfig } from './encryption';
|
|
42
|
-
import type {
|
|
43
|
-
ClientChangeBatch,
|
|
44
|
-
LocalRevision,
|
|
45
|
-
SyncStatusSnapshot,
|
|
46
|
-
} from './invalidation';
|
|
37
|
+
import type { ClientChangeBatch, LocalRevision } from './invalidation';
|
|
47
38
|
import type { LocalDataPurgeInput, LocalDataPurgeResult } from './local-purge';
|
|
48
39
|
import type {
|
|
49
40
|
LocalDataRebootstrapInput,
|
|
50
41
|
LocalDataRebootstrapResult,
|
|
51
42
|
} from './local-rebootstrap';
|
|
52
43
|
import type { OutboxCommit } from './outbox';
|
|
53
|
-
import type {
|
|
54
|
-
CommitOutcome,
|
|
55
|
-
CommitOutcomeQuery,
|
|
56
|
-
ResolveCommitOutcomeInput,
|
|
57
|
-
} from './outcomes';
|
|
58
44
|
import type { ClientSchema } from './schema';
|
|
59
45
|
import type { SubscriptionRecord } from './state';
|
|
60
46
|
import type { WindowBase } from './window';
|
|
@@ -137,7 +123,10 @@ export interface WorkerSecurityActivation {
|
|
|
137
123
|
// The logical API — the one shared shape (worker implements, handle projects)
|
|
138
124
|
// ---------------------------------------------------------------------------
|
|
139
125
|
|
|
140
|
-
export interface WorkerApi
|
|
126
|
+
export interface WorkerApi extends Omit<
|
|
127
|
+
ClientSnapshotMethods,
|
|
128
|
+
'querySnapshot'
|
|
129
|
+
> {
|
|
141
130
|
securityLifecycle(): SecurityLifecycle;
|
|
142
131
|
beginSecurityPreflight(): Promise<void>;
|
|
143
132
|
activateSecurity(options?: WorkerSecurityActivation): Promise<void>;
|
|
@@ -166,21 +155,6 @@ export interface WorkerApi {
|
|
|
166
155
|
query(sql: string, params?: readonly SqlValue[]): SqlRow[];
|
|
167
156
|
querySnapshot(spec: QueryReadSpec): QuerySnapshot;
|
|
168
157
|
localRevision(): LocalRevision;
|
|
169
|
-
statusSnapshot(): SyncStatusSnapshot;
|
|
170
|
-
diagnosticsSnapshot(
|
|
171
|
-
request?: ClientDiagnosticsRequest,
|
|
172
|
-
): ClientDiagnosticsSnapshot;
|
|
173
|
-
conflicts(): readonly ConflictRecord[];
|
|
174
|
-
rejections(): readonly RejectionRecord[];
|
|
175
|
-
commitOutcome(clientCommitId: string): CommitOutcome | undefined;
|
|
176
|
-
commitOutcomes(query?: CommitOutcomeQuery): readonly CommitOutcome[];
|
|
177
|
-
resolveCommitOutcome(input: ResolveCommitOutcomeInput): CommitOutcome;
|
|
178
|
-
schemaFloor(): SchemaFloor | undefined;
|
|
179
|
-
/** §7.3.5: the opaque auth-lease state, or undefined. */
|
|
180
|
-
leaseState(): LeaseState | undefined;
|
|
181
|
-
/** §7.4.5: true while a schema-bump reset + first re-bootstrap runs. */
|
|
182
|
-
upgrading(): boolean;
|
|
183
|
-
syncNeeded(): boolean;
|
|
184
158
|
pendingCommits(): OutboxCommit[];
|
|
185
159
|
subscriptions(): SubscriptionRecord[];
|
|
186
160
|
subscription(id: string): SubscriptionRecord | undefined;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Preserve supervisor observation across a facade without transferring
|
|
3
|
-
* transport ownership or exposing the source client. Binding packages use
|
|
4
|
-
* this when they normalize a client into another object identity.
|
|
5
|
-
*/
|
|
6
|
-
export declare function linkRealtimeSupervisorObservation<Target extends object>(target: Target, source: object): Target;
|
|
7
|
-
/** @internal Resolve one facade hop for the supervisor attachment lookup. */
|
|
8
|
-
export declare function realtimeSupervisorObservationSource(target: object): object | undefined;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const observationSources = new WeakMap();
|
|
2
|
-
/**
|
|
3
|
-
* Preserve supervisor observation across a facade without transferring
|
|
4
|
-
* transport ownership or exposing the source client. Binding packages use
|
|
5
|
-
* this when they normalize a client into another object identity.
|
|
6
|
-
*/
|
|
7
|
-
export function linkRealtimeSupervisorObservation(target, source) {
|
|
8
|
-
if (target !== source)
|
|
9
|
-
observationSources.set(target, source);
|
|
10
|
-
return target;
|
|
11
|
-
}
|
|
12
|
-
/** @internal Resolve one facade hop for the supervisor attachment lookup. */
|
|
13
|
-
export function realtimeSupervisorObservationSource(target) {
|
|
14
|
-
return observationSources.get(target);
|
|
15
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
const observationSources = new WeakMap<object, object>();
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Preserve supervisor observation across a facade without transferring
|
|
5
|
-
* transport ownership or exposing the source client. Binding packages use
|
|
6
|
-
* this when they normalize a client into another object identity.
|
|
7
|
-
*/
|
|
8
|
-
export function linkRealtimeSupervisorObservation<Target extends object>(
|
|
9
|
-
target: Target,
|
|
10
|
-
source: object,
|
|
11
|
-
): Target {
|
|
12
|
-
if (target !== source) observationSources.set(target, source);
|
|
13
|
-
return target;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/** @internal Resolve one facade hop for the supervisor attachment lookup. */
|
|
17
|
-
export function realtimeSupervisorObservationSource(
|
|
18
|
-
target: object,
|
|
19
|
-
): object | undefined {
|
|
20
|
-
return observationSources.get(target);
|
|
21
|
-
}
|