@powersync/web 0.0.0-dev-20250722092404 → 0.0.0-dev-20250728125748
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/dist/index.umd.js +6 -38
- package/dist/index.umd.js.map +1 -1
- package/dist/worker/SharedSyncImplementation.umd.js +78 -118
- package/dist/worker/SharedSyncImplementation.umd.js.map +1 -1
- package/dist/worker/WASQLiteDB.umd.js +72 -81
- package/dist/worker/WASQLiteDB.umd.js.map +1 -1
- package/lib/src/db/adapters/LockedAsyncDatabaseAdapter.d.ts +1 -6
- package/lib/src/db/adapters/LockedAsyncDatabaseAdapter.js +4 -36
- package/lib/src/db/sync/SharedWebStreamingSyncImplementation.js +0 -1
- package/lib/src/worker/sync/SharedSyncImplementation.js +2 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
package/dist/index.umd.js
CHANGED
|
@@ -38569,17 +38569,11 @@ class LockedAsyncDatabaseAdapter extends _powersync_common__WEBPACK_IMPORTED_MOD
|
|
|
38569
38569
|
_db = null;
|
|
38570
38570
|
_disposeTableChangeListener = null;
|
|
38571
38571
|
_config = null;
|
|
38572
|
-
pendingAbortControllers;
|
|
38573
|
-
closing;
|
|
38574
|
-
closed;
|
|
38575
38572
|
constructor(options) {
|
|
38576
38573
|
super();
|
|
38577
38574
|
this.options = options;
|
|
38578
38575
|
this._dbIdentifier = options.name;
|
|
38579
38576
|
this.logger = options.logger ?? (0,_powersync_common__WEBPACK_IMPORTED_MODULE_0__.createLogger)(`LockedAsyncDatabaseAdapter - ${this._dbIdentifier}`);
|
|
38580
|
-
this.pendingAbortControllers = new Set();
|
|
38581
|
-
this.closed = false;
|
|
38582
|
-
this.closing = false;
|
|
38583
38577
|
// Set the name if provided. We can query for the name if not available yet
|
|
38584
38578
|
this.debugMode = options.debugMode ?? false;
|
|
38585
38579
|
if (this.debugMode) {
|
|
@@ -38669,11 +38663,8 @@ class LockedAsyncDatabaseAdapter extends _powersync_common__WEBPACK_IMPORTED_MOD
|
|
|
38669
38663
|
* tabs are still using it.
|
|
38670
38664
|
*/
|
|
38671
38665
|
async close() {
|
|
38672
|
-
this.closing = true;
|
|
38673
38666
|
this._disposeTableChangeListener?.();
|
|
38674
|
-
this.pendingAbortControllers.forEach((controller) => controller.abort('Closed'));
|
|
38675
38667
|
await this.baseDB?.close?.();
|
|
38676
|
-
this.closed = true;
|
|
38677
38668
|
}
|
|
38678
38669
|
async getAll(sql, parameters) {
|
|
38679
38670
|
await this.waitForInitialized();
|
|
@@ -38689,37 +38680,14 @@ class LockedAsyncDatabaseAdapter extends _powersync_common__WEBPACK_IMPORTED_MOD
|
|
|
38689
38680
|
}
|
|
38690
38681
|
async readLock(fn, options) {
|
|
38691
38682
|
await this.waitForInitialized();
|
|
38692
|
-
return this.acquireLock(async () => fn(this.generateDBHelpers({ execute: this._execute, executeRaw: this._executeRaw }))
|
|
38693
|
-
timeoutMs: options?.timeoutMs
|
|
38694
|
-
});
|
|
38683
|
+
return this.acquireLock(async () => fn(this.generateDBHelpers({ execute: this._execute, executeRaw: this._executeRaw })));
|
|
38695
38684
|
}
|
|
38696
38685
|
async writeLock(fn, options) {
|
|
38697
38686
|
await this.waitForInitialized();
|
|
38698
|
-
return this.acquireLock(async () => fn(this.generateDBHelpers({ execute: this._execute, executeRaw: this._executeRaw }))
|
|
38699
|
-
timeoutMs: options?.timeoutMs
|
|
38700
|
-
});
|
|
38687
|
+
return this.acquireLock(async () => fn(this.generateDBHelpers({ execute: this._execute, executeRaw: this._executeRaw })));
|
|
38701
38688
|
}
|
|
38702
|
-
|
|
38703
|
-
|
|
38704
|
-
if (this.closing) {
|
|
38705
|
-
throw new Error(`Cannot acquire lock, the database is closing`);
|
|
38706
|
-
}
|
|
38707
|
-
const abortController = new AbortController();
|
|
38708
|
-
this.pendingAbortControllers.add(abortController);
|
|
38709
|
-
const { timeoutMs } = options ?? {};
|
|
38710
|
-
const timoutId = timeoutMs
|
|
38711
|
-
? setTimeout(() => {
|
|
38712
|
-
abortController.abort(`Timeout after ${timeoutMs}ms`);
|
|
38713
|
-
this.pendingAbortControllers.delete(abortController);
|
|
38714
|
-
}, timeoutMs)
|
|
38715
|
-
: null;
|
|
38716
|
-
return (0,_shared_navigator__WEBPACK_IMPORTED_MODULE_1__.getNavigatorLocks)().request(`db-lock-${this._dbIdentifier}`, { signal: abortController.signal }, () => {
|
|
38717
|
-
this.pendingAbortControllers.delete(abortController);
|
|
38718
|
-
if (timoutId) {
|
|
38719
|
-
clearTimeout(timoutId);
|
|
38720
|
-
}
|
|
38721
|
-
return callback();
|
|
38722
|
-
});
|
|
38689
|
+
acquireLock(callback) {
|
|
38690
|
+
return (0,_shared_navigator__WEBPACK_IMPORTED_MODULE_1__.getNavigatorLocks)().request(`db-lock-${this._dbIdentifier}`, callback);
|
|
38723
38691
|
}
|
|
38724
38692
|
async readTransaction(fn, options) {
|
|
38725
38693
|
return this.readLock(this.wrapTransaction(fn));
|
|
@@ -39961,7 +39929,6 @@ class SharedWebStreamingSyncImplementation extends _WebStreamingSyncImplementati
|
|
|
39961
39929
|
}
|
|
39962
39930
|
async dispose() {
|
|
39963
39931
|
await this.waitForReady();
|
|
39964
|
-
await super.dispose();
|
|
39965
39932
|
await new Promise((resolve) => {
|
|
39966
39933
|
// Listen for the close acknowledgment from the worker
|
|
39967
39934
|
this.messagePort.addEventListener('message', (event) => {
|
|
@@ -40811,7 +40778,8 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
40811
40778
|
*/
|
|
40812
40779
|
async _testUpdateAllStatuses(status) {
|
|
40813
40780
|
if (!this.connectionManager.syncStreamImplementation) {
|
|
40814
|
-
|
|
40781
|
+
// This is just for testing purposes
|
|
40782
|
+
this.connectionManager.syncStreamImplementation = this.generateStreamingImplementation();
|
|
40815
40783
|
}
|
|
40816
40784
|
// Only assigning, don't call listeners for this test
|
|
40817
40785
|
this.connectionManager.syncStreamImplementation.syncStatus = new _powersync_common__WEBPACK_IMPORTED_MODULE_0__.SyncStatus(status);
|