@powersync/web 0.0.0-dev-20250715080712 → 0.0.0-dev-20250715104704

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 CHANGED
@@ -38555,17 +38555,11 @@ class LockedAsyncDatabaseAdapter extends _powersync_common__WEBPACK_IMPORTED_MOD
38555
38555
  _db = null;
38556
38556
  _disposeTableChangeListener = null;
38557
38557
  _config = null;
38558
- pendingAbortControllers;
38559
- closing;
38560
- closed;
38561
38558
  constructor(options) {
38562
38559
  super();
38563
38560
  this.options = options;
38564
38561
  this._dbIdentifier = options.name;
38565
38562
  this.logger = options.logger ?? (0,_powersync_common__WEBPACK_IMPORTED_MODULE_0__.createLogger)(`LockedAsyncDatabaseAdapter - ${this._dbIdentifier}`);
38566
- this.pendingAbortControllers = new Set();
38567
- this.closed = false;
38568
- this.closing = false;
38569
38563
  // Set the name if provided. We can query for the name if not available yet
38570
38564
  this.debugMode = options.debugMode ?? false;
38571
38565
  if (this.debugMode) {
@@ -38655,11 +38649,8 @@ class LockedAsyncDatabaseAdapter extends _powersync_common__WEBPACK_IMPORTED_MOD
38655
38649
  * tabs are still using it.
38656
38650
  */
38657
38651
  async close() {
38658
- this.closing = true;
38659
38652
  this._disposeTableChangeListener?.();
38660
- this.pendingAbortControllers.forEach((controller) => controller.abort('Closed'));
38661
38653
  await this.baseDB?.close?.();
38662
- this.closed = true;
38663
38654
  }
38664
38655
  async getAll(sql, parameters) {
38665
38656
  await this.waitForInitialized();
@@ -38675,37 +38666,14 @@ class LockedAsyncDatabaseAdapter extends _powersync_common__WEBPACK_IMPORTED_MOD
38675
38666
  }
38676
38667
  async readLock(fn, options) {
38677
38668
  await this.waitForInitialized();
38678
- return this.acquireLock(async () => fn(this.generateDBHelpers({ execute: this._execute, executeRaw: this._executeRaw })), {
38679
- timeoutMs: options?.timeoutMs
38680
- });
38669
+ return this.acquireLock(async () => fn(this.generateDBHelpers({ execute: this._execute, executeRaw: this._executeRaw })));
38681
38670
  }
38682
38671
  async writeLock(fn, options) {
38683
38672
  await this.waitForInitialized();
38684
- return this.acquireLock(async () => fn(this.generateDBHelpers({ execute: this._execute, executeRaw: this._executeRaw })), {
38685
- timeoutMs: options?.timeoutMs
38686
- });
38673
+ return this.acquireLock(async () => fn(this.generateDBHelpers({ execute: this._execute, executeRaw: this._executeRaw })));
38687
38674
  }
38688
- async acquireLock(callback, options) {
38689
- await this.waitForInitialized();
38690
- if (this.closing) {
38691
- throw new Error(`Cannot acquire lock, the database is closing`);
38692
- }
38693
- const abortController = new AbortController();
38694
- this.pendingAbortControllers.add(abortController);
38695
- const { timeoutMs } = options ?? {};
38696
- const timoutId = timeoutMs
38697
- ? setTimeout(() => {
38698
- abortController.abort(`Timeout after ${timeoutMs}ms`);
38699
- this.pendingAbortControllers.delete(abortController);
38700
- }, timeoutMs)
38701
- : null;
38702
- return (0,_shared_navigator__WEBPACK_IMPORTED_MODULE_1__.getNavigatorLocks)().request(`db-lock-${this._dbIdentifier}`, { signal: abortController.signal }, () => {
38703
- this.pendingAbortControllers.delete(abortController);
38704
- if (timoutId) {
38705
- clearTimeout(timoutId);
38706
- }
38707
- return callback();
38708
- });
38675
+ acquireLock(callback) {
38676
+ return (0,_shared_navigator__WEBPACK_IMPORTED_MODULE_1__.getNavigatorLocks)().request(`db-lock-${this._dbIdentifier}`, callback);
38709
38677
  }
38710
38678
  async readTransaction(fn, options) {
38711
38679
  return this.readLock(this.wrapTransaction(fn));
@@ -39947,7 +39915,6 @@ class SharedWebStreamingSyncImplementation extends _WebStreamingSyncImplementati
39947
39915
  }
39948
39916
  async dispose() {
39949
39917
  await this.waitForReady();
39950
- await super.dispose();
39951
39918
  await new Promise((resolve) => {
39952
39919
  // Listen for the close acknowledgment from the worker
39953
39920
  this.messagePort.addEventListener('message', (event) => {
@@ -40797,7 +40764,8 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
40797
40764
  */
40798
40765
  async _testUpdateAllStatuses(status) {
40799
40766
  if (!this.connectionManager.syncStreamImplementation) {
40800
- throw new Error('Cannot update status without a sync stream implementation');
40767
+ // This is just for testing purposes
40768
+ this.connectionManager.syncStreamImplementation = this.generateStreamingImplementation();
40801
40769
  }
40802
40770
  // Only assigning, don't call listeners for this test
40803
40771
  this.connectionManager.syncStreamImplementation.syncStatus = new _powersync_common__WEBPACK_IMPORTED_MODULE_0__.SyncStatus(status);