@syncular/client 0.65.1 → 0.66.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 +15 -7
- package/dist/apply.d.ts +4 -4
- package/dist/apply.js +55 -66
- package/dist/client.js +29 -9
- package/dist/progress.d.ts +4 -0
- package/dist/realtime-supervisor.d.ts +47 -13
- package/dist/realtime-supervisor.js +374 -277
- package/dist/wasm-database.js +9 -20
- package/package.json +3 -3
- package/src/apply.ts +77 -77
- package/src/client.ts +24 -3
- package/src/progress.ts +4 -0
- package/src/realtime-supervisor.ts +408 -303
- package/src/wasm-database.ts +11 -25
package/src/wasm-database.ts
CHANGED
|
@@ -419,12 +419,9 @@ function opfsSahPoolError(error: unknown, directory: string): ClientSyncError {
|
|
|
419
419
|
}
|
|
420
420
|
return new ClientSyncError(
|
|
421
421
|
STORAGE_BUSY_CODE,
|
|
422
|
-
'
|
|
423
|
-
`${JSON.stringify(directory)}. Another live engine may still own its ` +
|
|
424
|
-
'SAH pool, or the browser may still be releasing it after a reload. ' +
|
|
425
|
-
'Close the other instance or retry after a short delay; do not delete ' +
|
|
426
|
-
`or rename the directory. Underlying error: ${detail}`,
|
|
422
|
+
'Another engine holds the OPFS storage directory, or the browser is still releasing it; retry after it closes',
|
|
427
423
|
true,
|
|
424
|
+
{ directory, cause: detail },
|
|
428
425
|
);
|
|
429
426
|
}
|
|
430
427
|
|
|
@@ -454,24 +451,18 @@ function configureSahCrashRecovery(
|
|
|
454
451
|
const stack = wasm.pstack.pointer;
|
|
455
452
|
try {
|
|
456
453
|
const output = wasm.pstack.allocPtr();
|
|
457
|
-
|
|
458
|
-
db.pointer
|
|
454
|
+
const filePointer =
|
|
455
|
+
db.pointer !== undefined &&
|
|
459
456
|
capi.sqlite3_file_control(
|
|
460
457
|
db.pointer,
|
|
461
458
|
'main',
|
|
462
459
|
capi.SQLITE_FCNTL_FILE_POINTER,
|
|
463
460
|
output,
|
|
464
|
-
)
|
|
465
|
-
|
|
466
|
-
)
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
'Could not configure OPFS crash recovery',
|
|
470
|
-
);
|
|
471
|
-
}
|
|
472
|
-
const file = new capi.sqlite3_file(wasm.peekPtr(output));
|
|
473
|
-
const methodsPointer = file.$pMethods;
|
|
474
|
-
file.dispose(); // Borrowed struct view; SQLite still owns the file.
|
|
461
|
+
) === 0 &&
|
|
462
|
+
wasm.peekPtr(output);
|
|
463
|
+
const file = filePointer ? new capi.sqlite3_file(filePointer) : undefined;
|
|
464
|
+
const methodsPointer = file?.$pMethods;
|
|
465
|
+
file?.dispose(); // Borrowed struct view; SQLite still owns the file.
|
|
475
466
|
if (!methodsPointer) {
|
|
476
467
|
throw new ClientSyncError(
|
|
477
468
|
STORAGE_UNAVAILABLE_CODE,
|
|
@@ -514,10 +505,7 @@ export async function openPersistentWasmDatabase(
|
|
|
514
505
|
}
|
|
515
506
|
if (!inWorkerContext()) {
|
|
516
507
|
throw invalidRequest(
|
|
517
|
-
'openPersistentWasmDatabase() must run inside a Web Worker
|
|
518
|
-
'persistent mode is whole-core-in-a-worker by design (Direction ' +
|
|
519
|
-
'decision 2, 2026-07-03). Use the worker handle from the main ' +
|
|
520
|
-
'thread, or openWasmDatabase() for explicitly ephemeral state.',
|
|
508
|
+
'openPersistentWasmDatabase() must run inside a Web Worker; use the worker handle on the main thread, or openWasmDatabase() for ephemeral state',
|
|
521
509
|
);
|
|
522
510
|
}
|
|
523
511
|
const storage = (
|
|
@@ -526,9 +514,7 @@ export async function openPersistentWasmDatabase(
|
|
|
526
514
|
if (typeof storage?.getDirectory !== 'function') {
|
|
527
515
|
throw new ClientSyncError(
|
|
528
516
|
STORAGE_UNAVAILABLE_CODE,
|
|
529
|
-
'
|
|
530
|
-
'requires OPFS (~2023+ browsers). There is no IndexedDB or ' +
|
|
531
|
-
'in-memory fallback for persistent mode.',
|
|
517
|
+
'Persistent storage requires OPFS, which this browser lacks',
|
|
532
518
|
);
|
|
533
519
|
}
|
|
534
520
|
if (!navigator.locks) {
|