powersync-bridge 0.0.1-alpha.1 → 0.0.1-alpha.2
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 +28 -0
- package/dist/{chunk-KAR4QIIU.js → chunk-WJDQWVO5.js} +2 -5
- package/dist/chunk-WJDQWVO5.js.map +1 -0
- package/dist/index.cjs +298 -92
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -6
- package/dist/index.d.ts +29 -6
- package/dist/index.js +300 -91
- package/dist/index.js.map +1 -1
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-KAR4QIIU.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -30,7 +30,6 @@ declare class FreshnessTracker {
|
|
|
30
30
|
private lastHasSynced;
|
|
31
31
|
private readonly streamFreshAt;
|
|
32
32
|
private readonly streamSeenSyncedAt;
|
|
33
|
-
private readonly completions;
|
|
34
33
|
private readonly completionListeners;
|
|
35
34
|
private readonly clearListeners;
|
|
36
35
|
private unsubscribe;
|
|
@@ -108,8 +107,20 @@ declare class CrudMirror {
|
|
|
108
107
|
onChange(l: () => void): () => void;
|
|
109
108
|
}
|
|
110
109
|
|
|
110
|
+
/** Checkpoint maintenance has one shared slot; first reads and pagination bypass it. */
|
|
111
|
+
declare class BackgroundReads {
|
|
112
|
+
private running;
|
|
113
|
+
private readonly queue;
|
|
114
|
+
run<T>(read: () => Promise<T>, signal: AbortSignal): Promise<T>;
|
|
115
|
+
private drain;
|
|
116
|
+
}
|
|
117
|
+
|
|
111
118
|
/** Minimal TanStack QueryClient surface the bridge relies on (R11: fetchQuery + keying only). */
|
|
112
119
|
interface MinimalQueryClient {
|
|
120
|
+
cancelQueries?(filters: {
|
|
121
|
+
queryKey: readonly unknown[];
|
|
122
|
+
exact: boolean;
|
|
123
|
+
}): Promise<unknown>;
|
|
113
124
|
fetchQuery<T>(opts: {
|
|
114
125
|
queryKey: readonly unknown[];
|
|
115
126
|
queryFn: (ctx: {
|
|
@@ -171,6 +182,7 @@ interface RacedDeps {
|
|
|
171
182
|
readonly identityKey: string | null;
|
|
172
183
|
readonly apiLegEnabled: boolean;
|
|
173
184
|
readonly measure: MeasureSink | undefined;
|
|
185
|
+
readonly backgroundReads?: BackgroundReads;
|
|
174
186
|
}
|
|
175
187
|
declare function emptyRacedResult<T>(): RacedListResult<T>;
|
|
176
188
|
/**
|
|
@@ -184,7 +196,10 @@ declare class RacedListStore<TItem, TScope, TApi, K extends OrderKey<TItem>> {
|
|
|
184
196
|
readonly store: SnapshotStore<RacedListResult<TItem>>;
|
|
185
197
|
private readonly compare;
|
|
186
198
|
private readonly table;
|
|
187
|
-
private
|
|
199
|
+
private abort;
|
|
200
|
+
private observation;
|
|
201
|
+
private readonly checkpointRefresh;
|
|
202
|
+
private localFreshAt;
|
|
188
203
|
private readonly startedAt;
|
|
189
204
|
private snap;
|
|
190
205
|
private snapPending;
|
|
@@ -203,18 +218,21 @@ declare class RacedListStore<TItem, TScope, TApi, K extends OrderKey<TItem>> {
|
|
|
203
218
|
private readonly tombstones;
|
|
204
219
|
private disposed;
|
|
205
220
|
private refs;
|
|
221
|
+
private activeRefs;
|
|
206
222
|
private measured;
|
|
207
223
|
private localMs;
|
|
208
224
|
private apiMs;
|
|
209
225
|
constructor(deps: RacedDeps, def: RacedListDefinition<TItem, TScope, TApi, K>, scope: TScope, scopeKey: string);
|
|
210
|
-
retain(): void;
|
|
211
|
-
release(): void;
|
|
226
|
+
retain(active?: boolean): void;
|
|
227
|
+
release(active?: boolean): void;
|
|
212
228
|
get isDisposed(): boolean;
|
|
213
229
|
/** Synchronous part of an identity swap: the snapshot becomes empty 'pending' at once (R15). */
|
|
214
230
|
swapRoot(): void;
|
|
215
231
|
dispose(): void;
|
|
232
|
+
private pause;
|
|
216
233
|
private start;
|
|
217
234
|
private startApiLeg;
|
|
235
|
+
private snapshotKey;
|
|
218
236
|
/**
|
|
219
237
|
* A checkpoint completed. Status events and diff emissions are separate SDK events with no
|
|
220
238
|
* ordering guarantee; taking ownership on the stale local map would render the pre-checkpoint
|
|
@@ -319,6 +337,9 @@ declare class InfiniteQueryStore<T extends {
|
|
|
319
337
|
private watchGeneration;
|
|
320
338
|
private lastLocalWatch;
|
|
321
339
|
private refs;
|
|
340
|
+
private activeRefs;
|
|
341
|
+
private readonly checkpointRefresh;
|
|
342
|
+
private localAbort;
|
|
322
343
|
private ready;
|
|
323
344
|
private disposed;
|
|
324
345
|
private unwatch;
|
|
@@ -327,10 +348,11 @@ declare class InfiniteQueryStore<T extends {
|
|
|
327
348
|
private requestKey;
|
|
328
349
|
constructor(deps: QueryDeps, options: InfiniteQueryOptions<T>);
|
|
329
350
|
get isDisposed(): boolean;
|
|
330
|
-
retain(): void;
|
|
331
|
-
release(): void;
|
|
351
|
+
retain(active?: boolean): void;
|
|
352
|
+
release(active?: boolean): void;
|
|
332
353
|
swapRoot(): void;
|
|
333
354
|
dispose(): void;
|
|
355
|
+
private pause;
|
|
334
356
|
private readOffline;
|
|
335
357
|
private cancelRequest;
|
|
336
358
|
private networkChanged;
|
|
@@ -557,6 +579,7 @@ declare class Bridge {
|
|
|
557
579
|
private readonly freshness;
|
|
558
580
|
private readonly crud;
|
|
559
581
|
private readonly snapshots;
|
|
582
|
+
private readonly backgroundReads;
|
|
560
583
|
private readonly epochSnapshot;
|
|
561
584
|
private readonly stores;
|
|
562
585
|
private readonly gates;
|
package/dist/index.d.ts
CHANGED
|
@@ -30,7 +30,6 @@ declare class FreshnessTracker {
|
|
|
30
30
|
private lastHasSynced;
|
|
31
31
|
private readonly streamFreshAt;
|
|
32
32
|
private readonly streamSeenSyncedAt;
|
|
33
|
-
private readonly completions;
|
|
34
33
|
private readonly completionListeners;
|
|
35
34
|
private readonly clearListeners;
|
|
36
35
|
private unsubscribe;
|
|
@@ -108,8 +107,20 @@ declare class CrudMirror {
|
|
|
108
107
|
onChange(l: () => void): () => void;
|
|
109
108
|
}
|
|
110
109
|
|
|
110
|
+
/** Checkpoint maintenance has one shared slot; first reads and pagination bypass it. */
|
|
111
|
+
declare class BackgroundReads {
|
|
112
|
+
private running;
|
|
113
|
+
private readonly queue;
|
|
114
|
+
run<T>(read: () => Promise<T>, signal: AbortSignal): Promise<T>;
|
|
115
|
+
private drain;
|
|
116
|
+
}
|
|
117
|
+
|
|
111
118
|
/** Minimal TanStack QueryClient surface the bridge relies on (R11: fetchQuery + keying only). */
|
|
112
119
|
interface MinimalQueryClient {
|
|
120
|
+
cancelQueries?(filters: {
|
|
121
|
+
queryKey: readonly unknown[];
|
|
122
|
+
exact: boolean;
|
|
123
|
+
}): Promise<unknown>;
|
|
113
124
|
fetchQuery<T>(opts: {
|
|
114
125
|
queryKey: readonly unknown[];
|
|
115
126
|
queryFn: (ctx: {
|
|
@@ -171,6 +182,7 @@ interface RacedDeps {
|
|
|
171
182
|
readonly identityKey: string | null;
|
|
172
183
|
readonly apiLegEnabled: boolean;
|
|
173
184
|
readonly measure: MeasureSink | undefined;
|
|
185
|
+
readonly backgroundReads?: BackgroundReads;
|
|
174
186
|
}
|
|
175
187
|
declare function emptyRacedResult<T>(): RacedListResult<T>;
|
|
176
188
|
/**
|
|
@@ -184,7 +196,10 @@ declare class RacedListStore<TItem, TScope, TApi, K extends OrderKey<TItem>> {
|
|
|
184
196
|
readonly store: SnapshotStore<RacedListResult<TItem>>;
|
|
185
197
|
private readonly compare;
|
|
186
198
|
private readonly table;
|
|
187
|
-
private
|
|
199
|
+
private abort;
|
|
200
|
+
private observation;
|
|
201
|
+
private readonly checkpointRefresh;
|
|
202
|
+
private localFreshAt;
|
|
188
203
|
private readonly startedAt;
|
|
189
204
|
private snap;
|
|
190
205
|
private snapPending;
|
|
@@ -203,18 +218,21 @@ declare class RacedListStore<TItem, TScope, TApi, K extends OrderKey<TItem>> {
|
|
|
203
218
|
private readonly tombstones;
|
|
204
219
|
private disposed;
|
|
205
220
|
private refs;
|
|
221
|
+
private activeRefs;
|
|
206
222
|
private measured;
|
|
207
223
|
private localMs;
|
|
208
224
|
private apiMs;
|
|
209
225
|
constructor(deps: RacedDeps, def: RacedListDefinition<TItem, TScope, TApi, K>, scope: TScope, scopeKey: string);
|
|
210
|
-
retain(): void;
|
|
211
|
-
release(): void;
|
|
226
|
+
retain(active?: boolean): void;
|
|
227
|
+
release(active?: boolean): void;
|
|
212
228
|
get isDisposed(): boolean;
|
|
213
229
|
/** Synchronous part of an identity swap: the snapshot becomes empty 'pending' at once (R15). */
|
|
214
230
|
swapRoot(): void;
|
|
215
231
|
dispose(): void;
|
|
232
|
+
private pause;
|
|
216
233
|
private start;
|
|
217
234
|
private startApiLeg;
|
|
235
|
+
private snapshotKey;
|
|
218
236
|
/**
|
|
219
237
|
* A checkpoint completed. Status events and diff emissions are separate SDK events with no
|
|
220
238
|
* ordering guarantee; taking ownership on the stale local map would render the pre-checkpoint
|
|
@@ -319,6 +337,9 @@ declare class InfiniteQueryStore<T extends {
|
|
|
319
337
|
private watchGeneration;
|
|
320
338
|
private lastLocalWatch;
|
|
321
339
|
private refs;
|
|
340
|
+
private activeRefs;
|
|
341
|
+
private readonly checkpointRefresh;
|
|
342
|
+
private localAbort;
|
|
322
343
|
private ready;
|
|
323
344
|
private disposed;
|
|
324
345
|
private unwatch;
|
|
@@ -327,10 +348,11 @@ declare class InfiniteQueryStore<T extends {
|
|
|
327
348
|
private requestKey;
|
|
328
349
|
constructor(deps: QueryDeps, options: InfiniteQueryOptions<T>);
|
|
329
350
|
get isDisposed(): boolean;
|
|
330
|
-
retain(): void;
|
|
331
|
-
release(): void;
|
|
351
|
+
retain(active?: boolean): void;
|
|
352
|
+
release(active?: boolean): void;
|
|
332
353
|
swapRoot(): void;
|
|
333
354
|
dispose(): void;
|
|
355
|
+
private pause;
|
|
334
356
|
private readOffline;
|
|
335
357
|
private cancelRequest;
|
|
336
358
|
private networkChanged;
|
|
@@ -557,6 +579,7 @@ declare class Bridge {
|
|
|
557
579
|
private readonly freshness;
|
|
558
580
|
private readonly crud;
|
|
559
581
|
private readonly snapshots;
|
|
582
|
+
private readonly backgroundReads;
|
|
560
583
|
private readonly epochSnapshot;
|
|
561
584
|
private readonly stores;
|
|
562
585
|
private readonly gates;
|