@syncular/client 0.15.47 → 0.15.48
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 +17 -0
- package/dist/bun-database.d.ts +5 -0
- package/dist/bun-database.js +5 -0
- package/dist/client.d.ts +4 -0
- package/dist/client.js +127 -17
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/remote.d.ts +2 -0
- package/dist/remote.js +10 -2
- package/dist/sync-scheduler.d.ts +23 -0
- package/dist/sync-scheduler.js +122 -0
- package/dist/window.d.ts +5 -0
- package/dist/window.js +39 -0
- package/dist/worker-entry.js +2 -9
- package/package.json +3 -3
- package/src/bun-database.ts +11 -0
- package/src/client.ts +144 -16
- package/src/index.ts +1 -0
- package/src/remote.ts +11 -2
- package/src/sync-scheduler.ts +154 -0
- package/src/window.ts +65 -0
- package/src/worker-entry.ts +3 -11
package/src/worker-entry.ts
CHANGED
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
httpSyncTransport,
|
|
28
28
|
webSocketRealtimeConnector,
|
|
29
29
|
} from './http';
|
|
30
|
-
import type {
|
|
30
|
+
import type { SyncIntent } from './invalidation';
|
|
31
31
|
import type {
|
|
32
32
|
RealtimeConnector,
|
|
33
33
|
SegmentDownloader,
|
|
@@ -211,10 +211,6 @@ export function startSyncWorker(overrides: SyncWorkerOverrides = {}): void {
|
|
|
211
211
|
queueMicrotask(runAutoSync);
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
function consumeEffects(effects: CommandEffects): void {
|
|
215
|
-
consumeSyncIntent(effects.sync);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
214
|
function requireClient(): SyncClient {
|
|
219
215
|
if (client === undefined) {
|
|
220
216
|
throw new ClientSyncError(
|
|
@@ -398,14 +394,11 @@ export function startSyncWorker(overrides: SyncWorkerOverrides = {}): void {
|
|
|
398
394
|
subscribe: (input) => requireClient().subscribe(input),
|
|
399
395
|
unsubscribe: (id) => requireClient().unsubscribe(id),
|
|
400
396
|
setWindow: async (base, units) => {
|
|
401
|
-
|
|
402
|
-
consumeEffects(result.effects);
|
|
397
|
+
await requireClient().setWindowCommand(base, units);
|
|
403
398
|
},
|
|
404
399
|
windowState: (base) => requireClient().windowState(base),
|
|
405
400
|
mutate: (mutations) => {
|
|
406
|
-
|
|
407
|
-
consumeEffects(result.effects);
|
|
408
|
-
return result.value;
|
|
401
|
+
return requireClient().mutateCommand(mutations).value;
|
|
409
402
|
},
|
|
410
403
|
patch: (table, rowId, partial, options) => {
|
|
411
404
|
// Same §8.4 rule as `mutate`: a local write must push without the app
|
|
@@ -416,7 +409,6 @@ export function startSyncWorker(overrides: SyncWorkerOverrides = {}): void {
|
|
|
416
409
|
partial,
|
|
417
410
|
options,
|
|
418
411
|
);
|
|
419
|
-
consumeEffects(result.effects);
|
|
420
412
|
return result.value;
|
|
421
413
|
},
|
|
422
414
|
purgeLocalData: (input) => requireClient().purgeLocalData(input),
|