powersync-bridge 0.0.1-alpha.0 → 0.0.1-alpha.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 +83 -20
- package/dist/{chunk-TANEBEGU.js → chunk-KAR4QIIU.js} +64 -64
- package/dist/chunk-KAR4QIIU.js.map +1 -0
- package/dist/{clock-BAt_Za0Q.d.cts → clock-DANrBsZH.d.cts} +2 -2
- package/dist/{clock-BAt_Za0Q.d.ts → clock-DANrBsZH.d.ts} +2 -2
- package/dist/index.cjs +645 -73
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +300 -171
- package/dist/index.d.ts +300 -171
- package/dist/index.js +583 -14
- package/dist/index.js.map +1 -1
- package/dist/testing.d.cts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-TANEBEGU.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,173 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as ApiOffsetPolicy,
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* External store with a stable snapshot for useSyncExternalStore (R10/R11).
|
|
6
|
-
* `replace()` swaps the snapshot and notifies once; `swapRoot()` is what an identity change
|
|
7
|
-
* calls — it is synchronous, so no committed frame can observe the outgoing state (R15).
|
|
8
|
-
*/
|
|
9
|
-
declare class SnapshotStore<S> implements Store<S> {
|
|
10
|
-
private snapshot;
|
|
11
|
-
private readonly listeners;
|
|
12
|
-
constructor(initial: S);
|
|
13
|
-
getSnapshot(): S;
|
|
14
|
-
subscribe(listener: () => void): () => void;
|
|
15
|
-
replace(next: S): void;
|
|
16
|
-
get listenerCount(): number;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
type FlagState = 'idle' | 'flagging' | 'syncing' | 'synced' | 'timeout' | 'error';
|
|
20
|
-
interface FlaggerConfig {
|
|
21
|
-
/** App-supplied backend call, e.g. POST /sync/flag. */
|
|
22
|
-
readonly requestFlag: (ids: readonly string[]) => Promise<void>;
|
|
23
|
-
/** Stream whose JOIN reads the per-user sync_requests table. */
|
|
24
|
-
readonly stream: string;
|
|
25
|
-
/** Table the flagged rows land in (for presence detection). */
|
|
26
|
-
readonly table: string;
|
|
27
|
-
readonly timeoutMs?: number;
|
|
28
|
-
}
|
|
29
|
-
interface FlagResult {
|
|
30
|
-
readonly state: FlagState;
|
|
31
|
-
readonly error?: Error;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* OPTIONAL primitive (§7): client-triggered, per-user server-side flagging. Use only for bucket
|
|
35
|
-
* economy or server-decided membership; `useOnDemandStream` is the default single-row path.
|
|
36
|
-
* `synced` is detected by watching the SPECIFIC requested ids, never by waitForFirstSync.
|
|
37
|
-
*/
|
|
38
|
-
declare class AutoSyncFlagStore {
|
|
39
|
-
private readonly driver;
|
|
40
|
-
private readonly clock;
|
|
41
|
-
private readonly config;
|
|
42
|
-
private readonly ids;
|
|
43
|
-
readonly store: SnapshotStore<FlagResult>;
|
|
44
|
-
private handle;
|
|
45
|
-
private unsubStatus;
|
|
46
|
-
private cancelTimeout;
|
|
47
|
-
private disposed;
|
|
48
|
-
private refs;
|
|
49
|
-
constructor(driver: BridgeDriver, clock: BridgeClock, config: FlaggerConfig, ids: readonly string[]);
|
|
50
|
-
retain(): void;
|
|
51
|
-
release(): void;
|
|
52
|
-
get isDisposed(): boolean;
|
|
53
|
-
swapRoot(): void;
|
|
54
|
-
dispose(): void;
|
|
55
|
-
private start;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Identity is DERIVED from the JWT the connector returns, never supplied by the app (R15, [DX]).
|
|
60
|
-
* The key is the canonical JSON of the stable claims — a cache key, not a hash.
|
|
61
|
-
*/
|
|
62
|
-
declare const DEFAULT_VOLATILE_CLAIMS: readonly string[];
|
|
63
|
-
declare function decodeJwtPayload(token: string): Record<string, unknown>;
|
|
64
|
-
interface IdentityKeyOptions {
|
|
65
|
-
readonly denyList?: readonly string[];
|
|
66
|
-
/** Connection parameters opted in BY KEY (rotating values must be excluded explicitly). */
|
|
67
|
-
readonly connectionParams?: Record<string, unknown>;
|
|
68
|
-
}
|
|
69
|
-
declare function identityKeyFromClaims(claims: Record<string, unknown>, opts?: IdentityKeyOptions): string;
|
|
70
|
-
declare function identityKeyFromToken(token: string, opts?: IdentityKeyOptions): string;
|
|
71
|
-
|
|
72
|
-
interface InfiniteDeps {
|
|
73
|
-
readonly driver: BridgeDriver;
|
|
74
|
-
readonly adapter: QueryAdapter;
|
|
75
|
-
readonly clock: BridgeClock;
|
|
76
|
-
readonly onEvicted?: ((ids: readonly string[]) => void) | undefined;
|
|
77
|
-
}
|
|
78
|
-
declare function emptyInfiniteResult<T>(): InfiniteListResult<T>;
|
|
79
|
-
/**
|
|
80
|
-
* The infinite list engine (§6.2): one global id set, a loaded-range local watch, and bounded
|
|
81
|
-
* escalation through equality partitions or API pages.
|
|
82
|
-
*/
|
|
83
|
-
declare class InfiniteListStore<TItem, TScope, K extends OrderKey<TItem>, TCursor, TPartition> {
|
|
84
|
-
private readonly deps;
|
|
85
|
-
private readonly def;
|
|
86
|
-
private readonly scope;
|
|
87
|
-
readonly store: SnapshotStore<InfiniteListResult<TItem>>;
|
|
88
|
-
private readonly compare;
|
|
89
|
-
private readonly table;
|
|
90
|
-
private readonly abort;
|
|
91
|
-
private pages;
|
|
92
|
-
private local;
|
|
93
|
-
private lookahead;
|
|
94
|
-
private emissionSeen;
|
|
95
|
-
private localError;
|
|
96
|
-
private unsubDiffs;
|
|
97
|
-
private readonly apiRows;
|
|
98
|
-
private readonly retained;
|
|
99
|
-
private readonly tombstones;
|
|
100
|
-
private readonly subs;
|
|
101
|
-
private readonly lru;
|
|
102
|
-
private probeCursor;
|
|
103
|
-
private serverFloor;
|
|
104
|
-
private floorRevalidated;
|
|
105
|
-
private boundary;
|
|
106
|
-
private reason;
|
|
107
|
-
private awaitingSync;
|
|
108
|
-
private loading;
|
|
109
|
-
private errors;
|
|
110
|
-
private warnings;
|
|
111
|
-
private errorCount;
|
|
112
|
-
private nextRetryAt;
|
|
113
|
-
private disposed;
|
|
114
|
-
private refs;
|
|
115
|
-
constructor(deps: InfiniteDeps, def: InfiniteListDefinition<TItem, TScope, K, TCursor, TPartition>, scope: TScope);
|
|
116
|
-
retain(): void;
|
|
117
|
-
release(): void;
|
|
118
|
-
get isDisposed(): boolean;
|
|
119
|
-
swapRoot(): void;
|
|
120
|
-
dispose(): void;
|
|
121
|
-
private subscribeLocal;
|
|
122
|
-
private onDiff;
|
|
123
|
-
private provenance;
|
|
124
|
-
private applyRemovals;
|
|
125
|
-
private lastCursor;
|
|
126
|
-
/** Explicit user retry clears the backoff (R16). */
|
|
127
|
-
retry(): Promise<void>;
|
|
128
|
-
loadMore(): Promise<void>;
|
|
129
|
-
private setUnknown;
|
|
130
|
-
private escalatePartition;
|
|
131
|
-
private finishEnd;
|
|
132
|
-
private track;
|
|
133
|
-
private untrack;
|
|
134
|
-
private apiGate;
|
|
135
|
-
private apiFailure;
|
|
136
|
-
private escalateApi;
|
|
137
|
-
private escalateOffset;
|
|
138
|
-
private absorbApi;
|
|
139
|
-
private mergedEntries;
|
|
140
|
-
private render;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
interface OnDemandOptions {
|
|
144
|
-
readonly ttl?: number;
|
|
145
|
-
readonly priority?: 0 | 1 | 2 | 3;
|
|
146
|
-
readonly timeoutMs?: number;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* The default "pull one row" primitive (§7, [DX]): a plain on-demand equality-parameter stream.
|
|
150
|
-
* Held while retained; the TTL keeps rows warm after release.
|
|
151
|
-
*/
|
|
152
|
-
declare class OnDemandStreamStore {
|
|
153
|
-
private readonly driver;
|
|
154
|
-
private readonly clock;
|
|
155
|
-
private readonly name;
|
|
156
|
-
private readonly params;
|
|
157
|
-
private readonly opts;
|
|
158
|
-
readonly store: SnapshotStore<OnDemandResult>;
|
|
159
|
-
private handle;
|
|
160
|
-
private readonly abort;
|
|
161
|
-
private refs;
|
|
162
|
-
private disposed;
|
|
163
|
-
constructor(driver: BridgeDriver, clock: BridgeClock, name: string, params: Params | null, opts: OnDemandOptions);
|
|
164
|
-
retain(): void;
|
|
165
|
-
release(): void;
|
|
166
|
-
get isDisposed(): boolean;
|
|
167
|
-
swapRoot(): void;
|
|
168
|
-
dispose(): void;
|
|
169
|
-
private start;
|
|
170
|
-
}
|
|
1
|
+
import { B as BridgeDriver, S as StreamDescription, O as OrderKey, C as CursorOf, a as OpaqueCursor, K as KeyOf, b as SortDirection, c as CrudDelta, P as PendingOpRef, d as BridgeClock, e as Store, Q as QueryAdapter, M as MeasureSink, R as RacedListResult, f as RacedListDefinition, g as RowsBuilder, h as PagedRow, L as ListErrors, I as InfiniteListResult, i as InfiniteListDefinition, j as OnDemandResult, k as Params } from './clock-DANrBsZH.js';
|
|
2
|
+
export { A as ApiOffsetPolicy, l as ApiPolicy, m as Boundary, n as BoundaryReason, o as CompilableQuery, p as Cursor, D as DifferentialStream, E as EscalationPolicy, q as ListState, r as OnDemandStatus, s as PageArgs, t as PartitionPolicy, u as PendingOp, v as PreparedQuery, w as PriorityStatus, x as RaceMeasurement, y as RowDiff, z as RowOrigin, F as Snapshot, G as StreamHandle, H as StreamStatus, J as SyncStatusView, N as realClock } from './clock-DANrBsZH.js';
|
|
171
3
|
|
|
172
4
|
type Clock = () => number;
|
|
173
5
|
interface CheckpointCompletion {
|
|
@@ -307,10 +139,27 @@ declare class SnapshotCache {
|
|
|
307
139
|
asOf?: string;
|
|
308
140
|
}>): Promise<SnapshotRecord<TApi>>;
|
|
309
141
|
/** Cancel every in-flight fetch under a key prefix (identity swap). */
|
|
142
|
+
invalidate(key: readonly unknown[]): void;
|
|
143
|
+
/** Cancel every in-flight fetch under a key prefix (identity swap). */
|
|
310
144
|
abortAll(prefix: readonly unknown[]): void;
|
|
311
145
|
clear(): void;
|
|
312
146
|
}
|
|
313
147
|
|
|
148
|
+
/**
|
|
149
|
+
* External store with a stable snapshot for useSyncExternalStore (R10/R11).
|
|
150
|
+
* `replace()` swaps the snapshot and notifies once; `swapRoot()` is what an identity change
|
|
151
|
+
* calls — it is synchronous, so no committed frame can observe the outgoing state (R15).
|
|
152
|
+
*/
|
|
153
|
+
declare class SnapshotStore<S> implements Store<S> {
|
|
154
|
+
private snapshot;
|
|
155
|
+
private readonly listeners;
|
|
156
|
+
constructor(initial: S);
|
|
157
|
+
readonly getSnapshot: () => S;
|
|
158
|
+
readonly subscribe: (listener: () => void) => (() => void);
|
|
159
|
+
replace(next: S): void;
|
|
160
|
+
get listenerCount(): number;
|
|
161
|
+
}
|
|
162
|
+
|
|
314
163
|
interface RacedDeps {
|
|
315
164
|
readonly driver: BridgeDriver;
|
|
316
165
|
readonly adapter: QueryAdapter;
|
|
@@ -387,6 +236,280 @@ declare class RacedListStore<TItem, TScope, TApi, K extends OrderKey<TItem>> {
|
|
|
387
236
|
lastCursor(): ReturnType<typeof cursorOfRow<TItem, K>> | undefined;
|
|
388
237
|
}
|
|
389
238
|
|
|
239
|
+
interface QueryPage<T> {
|
|
240
|
+
readonly cursor: T | undefined;
|
|
241
|
+
readonly limit: number;
|
|
242
|
+
}
|
|
243
|
+
/** Query keys include every predicate, identity and permission that can change the result. */
|
|
244
|
+
interface InfiniteQueryOptions<T extends {
|
|
245
|
+
id: string;
|
|
246
|
+
}> {
|
|
247
|
+
readonly queryKey: readonly unknown[];
|
|
248
|
+
readonly query: (page: QueryPage<T>) => RowsBuilder<T>;
|
|
249
|
+
/** Return rows in the same order as SQLite. Honor limit, including its lookahead row. */
|
|
250
|
+
readonly fetchPage: (page: QueryPage<T> & {
|
|
251
|
+
readonly signal: AbortSignal;
|
|
252
|
+
}) => Promise<readonly T[]>;
|
|
253
|
+
readonly orderBy: OrderKey<T>;
|
|
254
|
+
readonly direction?: 'asc' | 'desc';
|
|
255
|
+
readonly pageSize?: number;
|
|
256
|
+
readonly maxRows?: number;
|
|
257
|
+
readonly staleTime?: number;
|
|
258
|
+
readonly enabled?: boolean;
|
|
259
|
+
readonly table?: string;
|
|
260
|
+
/** Heterogeneous feeds identify each underlying business row for pending-write protection. */
|
|
261
|
+
readonly getRowIdentity?: (row: T) => {
|
|
262
|
+
table: string;
|
|
263
|
+
id: string;
|
|
264
|
+
};
|
|
265
|
+
readonly isInWindow?: (row: T) => boolean;
|
|
266
|
+
}
|
|
267
|
+
/** Shared by core and React so changing page configuration cannot reuse an incompatible store. */
|
|
268
|
+
declare const infiniteQueryKey: <T extends {
|
|
269
|
+
id: string;
|
|
270
|
+
}>(options: InfiniteQueryOptions<T>) => string;
|
|
271
|
+
interface InfiniteQueryResult<T> {
|
|
272
|
+
readonly data: T[];
|
|
273
|
+
readonly items: readonly PagedRow<T>[];
|
|
274
|
+
readonly isLoading: boolean;
|
|
275
|
+
readonly isFetching: boolean;
|
|
276
|
+
readonly isFetchingNextPage: boolean;
|
|
277
|
+
readonly hasNextPage: boolean;
|
|
278
|
+
readonly needsOlderWindow: boolean;
|
|
279
|
+
readonly error: Error | undefined;
|
|
280
|
+
readonly errors: ListErrors;
|
|
281
|
+
readonly isError: boolean;
|
|
282
|
+
readonly windowRevision: number;
|
|
283
|
+
}
|
|
284
|
+
declare class OfflineError extends Error {
|
|
285
|
+
readonly name = "OfflineError";
|
|
286
|
+
constructor();
|
|
287
|
+
}
|
|
288
|
+
interface QueryDeps extends RacedDeps {
|
|
289
|
+
readonly connectivity: Store<boolean | undefined>;
|
|
290
|
+
}
|
|
291
|
+
/** One loaded-range watch and one ordered API cursor chain. Every requested page races both. */
|
|
292
|
+
declare class InfiniteQueryStore<T extends {
|
|
293
|
+
id: string;
|
|
294
|
+
}> {
|
|
295
|
+
private readonly deps;
|
|
296
|
+
private readonly options;
|
|
297
|
+
readonly store: SnapshotStore<InfiniteQueryResult<T>>;
|
|
298
|
+
private readonly pageSize;
|
|
299
|
+
private readonly maxRows;
|
|
300
|
+
private readonly compare;
|
|
301
|
+
private table;
|
|
302
|
+
private target;
|
|
303
|
+
private anchor;
|
|
304
|
+
private revision;
|
|
305
|
+
private local;
|
|
306
|
+
private readonly retained;
|
|
307
|
+
private readonly tombstones;
|
|
308
|
+
private readonly filtered;
|
|
309
|
+
private readonly inSession;
|
|
310
|
+
private pages;
|
|
311
|
+
private localPending;
|
|
312
|
+
private localStamp;
|
|
313
|
+
private localError;
|
|
314
|
+
private apiError;
|
|
315
|
+
private apiPending;
|
|
316
|
+
private apiFailed;
|
|
317
|
+
private offline;
|
|
318
|
+
private generation;
|
|
319
|
+
private watchGeneration;
|
|
320
|
+
private lastLocalWatch;
|
|
321
|
+
private refs;
|
|
322
|
+
private ready;
|
|
323
|
+
private disposed;
|
|
324
|
+
private unwatch;
|
|
325
|
+
private stops;
|
|
326
|
+
private request;
|
|
327
|
+
private requestKey;
|
|
328
|
+
constructor(deps: QueryDeps, options: InfiniteQueryOptions<T>);
|
|
329
|
+
get isDisposed(): boolean;
|
|
330
|
+
retain(): void;
|
|
331
|
+
release(): void;
|
|
332
|
+
swapRoot(): void;
|
|
333
|
+
dispose(): void;
|
|
334
|
+
private readOffline;
|
|
335
|
+
private cancelRequest;
|
|
336
|
+
private networkChanged;
|
|
337
|
+
private identity;
|
|
338
|
+
private pending;
|
|
339
|
+
private localBuilder;
|
|
340
|
+
private watch;
|
|
341
|
+
private acceptLocal;
|
|
342
|
+
private checkpoint;
|
|
343
|
+
private clearPages;
|
|
344
|
+
private apiEnd;
|
|
345
|
+
private apiCount;
|
|
346
|
+
private apiCursor;
|
|
347
|
+
private cursorKey;
|
|
348
|
+
private pump;
|
|
349
|
+
private entries;
|
|
350
|
+
private result;
|
|
351
|
+
private render;
|
|
352
|
+
readonly fetchNextPage: () => void;
|
|
353
|
+
readonly retry: () => void;
|
|
354
|
+
readonly refresh: () => void;
|
|
355
|
+
readonly continueOlder: () => void;
|
|
356
|
+
private reset;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
type FlagState = 'idle' | 'flagging' | 'syncing' | 'synced' | 'timeout' | 'error';
|
|
360
|
+
interface FlaggerConfig {
|
|
361
|
+
/** App-supplied backend call, e.g. POST /sync/flag. */
|
|
362
|
+
readonly requestFlag: (ids: readonly string[]) => Promise<void>;
|
|
363
|
+
/** Stream whose JOIN reads the per-user sync_requests table. */
|
|
364
|
+
readonly stream: string;
|
|
365
|
+
/** Table the flagged rows land in (for presence detection). */
|
|
366
|
+
readonly table: string;
|
|
367
|
+
readonly timeoutMs?: number;
|
|
368
|
+
}
|
|
369
|
+
interface FlagResult {
|
|
370
|
+
readonly state: FlagState;
|
|
371
|
+
readonly error?: Error;
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* OPTIONAL primitive (§7): client-triggered, per-user server-side flagging. Use only for bucket
|
|
375
|
+
* economy or server-decided membership; `useOnDemandStream` is the default single-row path.
|
|
376
|
+
* `synced` is detected by watching the SPECIFIC requested ids, never by waitForFirstSync.
|
|
377
|
+
*/
|
|
378
|
+
declare class AutoSyncFlagStore {
|
|
379
|
+
private readonly driver;
|
|
380
|
+
private readonly clock;
|
|
381
|
+
private readonly config;
|
|
382
|
+
private readonly ids;
|
|
383
|
+
readonly store: SnapshotStore<FlagResult>;
|
|
384
|
+
private handle;
|
|
385
|
+
private unsubStatus;
|
|
386
|
+
private cancelTimeout;
|
|
387
|
+
private disposed;
|
|
388
|
+
private refs;
|
|
389
|
+
constructor(driver: BridgeDriver, clock: BridgeClock, config: FlaggerConfig, ids: readonly string[]);
|
|
390
|
+
retain(): void;
|
|
391
|
+
release(): void;
|
|
392
|
+
get isDisposed(): boolean;
|
|
393
|
+
swapRoot(): void;
|
|
394
|
+
dispose(): void;
|
|
395
|
+
private start;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Identity is DERIVED from the JWT the connector returns, never supplied by the app (R15, [DX]).
|
|
400
|
+
* The key is the canonical JSON of the stable claims — a cache key, not a hash.
|
|
401
|
+
*/
|
|
402
|
+
declare const DEFAULT_VOLATILE_CLAIMS: readonly string[];
|
|
403
|
+
declare function decodeJwtPayload(token: string): Record<string, unknown>;
|
|
404
|
+
interface IdentityKeyOptions {
|
|
405
|
+
readonly denyList?: readonly string[];
|
|
406
|
+
/** Connection parameters opted in BY KEY (rotating values must be excluded explicitly). */
|
|
407
|
+
readonly connectionParams?: Record<string, unknown>;
|
|
408
|
+
}
|
|
409
|
+
declare function identityKeyFromClaims(claims: Record<string, unknown>, opts?: IdentityKeyOptions): string;
|
|
410
|
+
declare function identityKeyFromToken(token: string, opts?: IdentityKeyOptions): string;
|
|
411
|
+
|
|
412
|
+
interface InfiniteDeps {
|
|
413
|
+
readonly driver: BridgeDriver;
|
|
414
|
+
readonly adapter: QueryAdapter;
|
|
415
|
+
readonly clock: BridgeClock;
|
|
416
|
+
readonly onEvicted?: ((ids: readonly string[]) => void) | undefined;
|
|
417
|
+
}
|
|
418
|
+
declare function emptyInfiniteResult<T>(): InfiniteListResult<T>;
|
|
419
|
+
/**
|
|
420
|
+
* The infinite list engine (§6.2): one global id set, a loaded-range local watch, and bounded
|
|
421
|
+
* escalation through equality partitions or API pages.
|
|
422
|
+
*/
|
|
423
|
+
declare class InfiniteListStore<TItem, TScope, K extends OrderKey<TItem>, TCursor, TPartition> {
|
|
424
|
+
private readonly deps;
|
|
425
|
+
private readonly def;
|
|
426
|
+
private readonly scope;
|
|
427
|
+
readonly store: SnapshotStore<InfiniteListResult<TItem>>;
|
|
428
|
+
private readonly compare;
|
|
429
|
+
private readonly table;
|
|
430
|
+
private readonly abort;
|
|
431
|
+
private pages;
|
|
432
|
+
private local;
|
|
433
|
+
private lookahead;
|
|
434
|
+
private emissionSeen;
|
|
435
|
+
private localError;
|
|
436
|
+
private unsubDiffs;
|
|
437
|
+
private readonly apiRows;
|
|
438
|
+
private readonly retained;
|
|
439
|
+
private readonly tombstones;
|
|
440
|
+
private readonly subs;
|
|
441
|
+
private readonly lru;
|
|
442
|
+
private probeCursor;
|
|
443
|
+
private serverFloor;
|
|
444
|
+
private floorRevalidated;
|
|
445
|
+
private boundary;
|
|
446
|
+
private reason;
|
|
447
|
+
private awaitingSync;
|
|
448
|
+
private loading;
|
|
449
|
+
private localPagePending;
|
|
450
|
+
private errors;
|
|
451
|
+
private warnings;
|
|
452
|
+
private errorCount;
|
|
453
|
+
private nextRetryAt;
|
|
454
|
+
private disposed;
|
|
455
|
+
private refs;
|
|
456
|
+
constructor(deps: InfiniteDeps, def: InfiniteListDefinition<TItem, TScope, K, TCursor, TPartition>, scope: TScope);
|
|
457
|
+
retain(): void;
|
|
458
|
+
release(): void;
|
|
459
|
+
get isDisposed(): boolean;
|
|
460
|
+
swapRoot(): void;
|
|
461
|
+
dispose(): void;
|
|
462
|
+
private subscribeLocal;
|
|
463
|
+
private onDiff;
|
|
464
|
+
private provenance;
|
|
465
|
+
private applyRemovals;
|
|
466
|
+
private lastCursor;
|
|
467
|
+
/** Explicit user retry clears the backoff (R16). */
|
|
468
|
+
retry(): Promise<void>;
|
|
469
|
+
loadMore(): Promise<void>;
|
|
470
|
+
private setUnknown;
|
|
471
|
+
private escalatePartition;
|
|
472
|
+
private finishEnd;
|
|
473
|
+
private track;
|
|
474
|
+
private untrack;
|
|
475
|
+
private apiGate;
|
|
476
|
+
private apiFailure;
|
|
477
|
+
private escalateApi;
|
|
478
|
+
private escalateOffset;
|
|
479
|
+
private absorbApi;
|
|
480
|
+
private mergedEntries;
|
|
481
|
+
private render;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
interface OnDemandOptions {
|
|
485
|
+
readonly ttl?: number;
|
|
486
|
+
readonly priority?: 0 | 1 | 2 | 3;
|
|
487
|
+
readonly timeoutMs?: number;
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* The default "pull one row" primitive (§7, [DX]): a plain on-demand equality-parameter stream.
|
|
491
|
+
* Held while retained; the TTL keeps rows warm after release.
|
|
492
|
+
*/
|
|
493
|
+
declare class OnDemandStreamStore {
|
|
494
|
+
private readonly driver;
|
|
495
|
+
private readonly clock;
|
|
496
|
+
private readonly name;
|
|
497
|
+
private readonly params;
|
|
498
|
+
private readonly opts;
|
|
499
|
+
readonly store: SnapshotStore<OnDemandResult>;
|
|
500
|
+
private handle;
|
|
501
|
+
private readonly abort;
|
|
502
|
+
private refs;
|
|
503
|
+
private disposed;
|
|
504
|
+
constructor(driver: BridgeDriver, clock: BridgeClock, name: string, params: Params | null, opts: OnDemandOptions);
|
|
505
|
+
retain(): void;
|
|
506
|
+
release(): void;
|
|
507
|
+
get isDisposed(): boolean;
|
|
508
|
+
swapRoot(): void;
|
|
509
|
+
dispose(): void;
|
|
510
|
+
private start;
|
|
511
|
+
}
|
|
512
|
+
|
|
390
513
|
type Platform = 'web' | 'native';
|
|
391
514
|
type RacePolicy = 'race' | 'local-first';
|
|
392
515
|
interface PlatformGates {
|
|
@@ -429,6 +552,7 @@ declare class Bridge {
|
|
|
429
552
|
readonly clock: BridgeClock;
|
|
430
553
|
/** Increments on every identity swap; hooks subscribe to re-acquire their stores. */
|
|
431
554
|
readonly epochStore: Store<number>;
|
|
555
|
+
readonly connectivity: SnapshotStore<boolean | undefined>;
|
|
432
556
|
private readonly identity;
|
|
433
557
|
private readonly freshness;
|
|
434
558
|
private readonly crud;
|
|
@@ -440,9 +564,14 @@ declare class Bridge {
|
|
|
440
564
|
private readonly identityOpts;
|
|
441
565
|
private readonly onEvicted;
|
|
442
566
|
private disposed;
|
|
567
|
+
private readonly onNetwork;
|
|
443
568
|
constructor(opts: BridgeOptions);
|
|
444
569
|
get epoch(): number;
|
|
445
570
|
get identityKey(): string | null;
|
|
571
|
+
setOnline(online: boolean | undefined): void;
|
|
572
|
+
query<T extends {
|
|
573
|
+
id: string;
|
|
574
|
+
}>(options: InfiniteQueryOptions<T>): InfiniteQueryStore<T>;
|
|
446
575
|
/** Resolves once the initial upload-queue read has landed (tests). */
|
|
447
576
|
ready(): Promise<void>;
|
|
448
577
|
/** Connect THROUGH the bridge so identity is derived from every token the connector produces. */
|
|
@@ -493,4 +622,4 @@ interface RemovalContext<T> {
|
|
|
493
622
|
declare function probePresence(driver: BridgeDriver, table: string, ids: readonly string[]): Promise<Set<string>>;
|
|
494
623
|
declare function classifyRemovals<T>(ctx: RemovalContext<T>, removed: ReadonlyMap<string, T>): Promise<Map<string, RemovalClass>>;
|
|
495
624
|
|
|
496
|
-
export { AutoSyncFlagStore, Bridge, BridgeClock, BridgeDriver, type BridgeOptions, type ConnectorLike, CrudDelta, CursorOf, DEFAULT_VOLATILE_CLAIMS, type FlagResult, type FlagState, type FlaggerConfig, type IdentityKeyOptions, InfiniteListDefinition, InfiniteListResult, InfiniteListStore, KeyOf, MeasureSink, type MinimalQueryClient, type OnDemandOptions, OnDemandResult, OnDemandStreamStore, OpaqueCursor, OrderKey, Params, PendingOpRef, type Platform, type PlatformGates, QueryAdapter, type RacePolicy, RacedListDefinition, RacedListResult, RacedListStore, type RemovalClass, SnapshotStore, SortDirection, Store, StreamDescription, classifyRemovals, createBridge, cursorOfRow, decodeCursor, decodeJwtPayload, defineInfiniteList, defineRacedList, emptyInfiniteResult, emptyRacedResult, encodeCursor, identityKeyFromClaims, identityKeyFromToken, keyColumns, probePresence, rowComparator };
|
|
625
|
+
export { AutoSyncFlagStore, Bridge, BridgeClock, BridgeDriver, type BridgeOptions, type ConnectorLike, CrudDelta, CursorOf, DEFAULT_VOLATILE_CLAIMS, type FlagResult, type FlagState, type FlaggerConfig, type IdentityKeyOptions, InfiniteListDefinition, InfiniteListResult, InfiniteListStore, type InfiniteQueryOptions, type InfiniteQueryResult, InfiniteQueryStore, KeyOf, ListErrors, MeasureSink, type MinimalQueryClient, OfflineError, type OnDemandOptions, OnDemandResult, OnDemandStreamStore, OpaqueCursor, OrderKey, PagedRow, Params, PendingOpRef, type Platform, type PlatformGates, QueryAdapter, type QueryPage, type RacePolicy, RacedListDefinition, RacedListResult, RacedListStore, type RemovalClass, RowsBuilder, SnapshotStore, SortDirection, Store, StreamDescription, classifyRemovals, createBridge, cursorOfRow, decodeCursor, decodeJwtPayload, defineInfiniteList, defineRacedList, emptyInfiniteResult, emptyRacedResult, encodeCursor, identityKeyFromClaims, identityKeyFromToken, infiniteQueryKey, keyColumns, probePresence, rowComparator };
|