@powersync/web 1.39.0 → 1.39.1

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.
Files changed (35) hide show
  1. package/dist/index.umd.js +85 -32
  2. package/dist/index.umd.js.map +1 -1
  3. package/dist/worker/SharedSyncImplementation.umd.js +15 -9
  4. package/dist/worker/SharedSyncImplementation.umd.js.map +1 -1
  5. package/dist/worker/WASQLiteDB.umd.js +24 -9
  6. package/dist/worker/WASQLiteDB.umd.js.map +1 -1
  7. package/lib/package.json +2 -2
  8. package/lib/src/db/adapters/AsyncWebAdapter.js +1 -1
  9. package/lib/src/db/adapters/AsyncWebAdapter.js.map +1 -1
  10. package/lib/src/db/adapters/wa-sqlite/RawSqliteConnection.d.ts +8 -0
  11. package/lib/src/db/adapters/wa-sqlite/RawSqliteConnection.js +9 -0
  12. package/lib/src/db/adapters/wa-sqlite/RawSqliteConnection.js.map +1 -1
  13. package/lib/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.js +8 -2
  14. package/lib/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.js.map +1 -1
  15. package/lib/src/db/sync/SharedWebStreamingSyncImplementation.d.ts +1 -0
  16. package/lib/src/db/sync/SharedWebStreamingSyncImplementation.js +10 -5
  17. package/lib/src/db/sync/SharedWebStreamingSyncImplementation.js.map +1 -1
  18. package/lib/src/worker/db/open-worker-database.d.ts +3 -2
  19. package/lib/src/worker/db/open-worker-database.js +30 -22
  20. package/lib/src/worker/db/open-worker-database.js.map +1 -1
  21. package/lib/src/worker/errors.d.ts +2 -0
  22. package/lib/src/worker/errors.js +7 -0
  23. package/lib/src/worker/errors.js.map +1 -0
  24. package/lib/src/worker/sync/SharedSyncImplementation.d.ts +1 -0
  25. package/lib/src/worker/sync/SharedSyncImplementation.js +2 -1
  26. package/lib/src/worker/sync/SharedSyncImplementation.js.map +1 -1
  27. package/lib/tsconfig.tsbuildinfo +1 -1
  28. package/package.json +3 -3
  29. package/src/db/adapters/AsyncWebAdapter.ts +1 -1
  30. package/src/db/adapters/wa-sqlite/RawSqliteConnection.ts +10 -0
  31. package/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.ts +24 -9
  32. package/src/db/sync/SharedWebStreamingSyncImplementation.ts +17 -11
  33. package/src/worker/db/open-worker-database.ts +34 -22
  34. package/src/worker/errors.ts +9 -0
  35. package/src/worker/sync/SharedSyncImplementation.ts +3 -1
@@ -1054,6 +1054,7 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
1054
1054
  syncStatus;
1055
1055
  broadCastLogger;
1056
1056
  database = this.generateReconnectableDatabase();
1057
+ sharedCloseSignal = (0,_shared_tab_close_signal_js__WEBPACK_IMPORTED_MODULE_6__.generateTabCloseSignal)();
1057
1058
  constructor() {
1058
1059
  super();
1059
1060
  this.ports = [];
@@ -1387,7 +1388,7 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
1387
1388
  });
1388
1389
  const remote = comlink__WEBPACK_IMPORTED_MODULE_1__.wrap(workerPort);
1389
1390
  const identifier = this.syncParams.dbParams.dbFilename;
1390
- const clientLockName = await (0,_shared_tab_close_signal_js__WEBPACK_IMPORTED_MODULE_6__.generateTabCloseSignal)();
1391
+ const clientLockName = await this.sharedCloseSignal;
1391
1392
  /**
1392
1393
  * The open could fail if the tab is closed while we're busy opening the database.
1393
1394
  * This operation is typically executed inside an exclusive portMutex lock.
@@ -4124,12 +4125,16 @@ class ControlledExecutor {
4124
4125
  }
4125
4126
  async execute(param) {
4126
4127
  this.runningTask = this.task(param);
4127
- await this.runningTask;
4128
- this.runningTask = undefined;
4129
- if (this.pendingTaskParam) {
4130
- const pendingParam = this.pendingTaskParam;
4131
- this.pendingTaskParam = undefined;
4132
- this.execute(pendingParam);
4128
+ try {
4129
+ await this.runningTask;
4130
+ }
4131
+ finally {
4132
+ this.runningTask = undefined;
4133
+ if (this.pendingTaskParam) {
4134
+ const pendingParam = this.pendingTaskParam;
4135
+ this.pendingTaskParam = undefined;
4136
+ this.execute(pendingParam);
4137
+ }
4133
4138
  }
4134
4139
  }
4135
4140
  }
@@ -12709,7 +12714,7 @@ function requireDist () {
12709
12714
 
12710
12715
  var distExports = requireDist();
12711
12716
 
12712
- var version = "1.57.2";
12717
+ var version = "1.57.3";
12713
12718
  var PACKAGE = {
12714
12719
  version: version};
12715
12720
 
@@ -13582,6 +13587,7 @@ class AbstractStreamingSyncImplementation extends BaseObserver {
13582
13587
  async _uploadAllCrud(signal) {
13583
13588
  return this.obtainLock({
13584
13589
  type: LockType.CRUD,
13590
+ signal,
13585
13591
  callback: async () => {
13586
13592
  /**
13587
13593
  * Keep track of the first item in the CRUD queue for the last `uploadCrud` iteration.
@@ -15206,7 +15212,7 @@ SELECT * FROM crud_entries;
15206
15212
  }
15207
15213
  /**
15208
15214
  * Open a read-only transaction.
15209
- * Read transactions can run concurrently to a write transaction.
15215
+ * When multiple connections are available, read transactions can run concurrently to a write transaction.
15210
15216
  * Changes from any write transaction are not visible to read transactions started before it.
15211
15217
  *
15212
15218
  * @param callback - Function to execute within the transaction