@powersync/web 1.38.7 → 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 (44) hide show
  1. package/dist/index.umd.js +344 -83
  2. package/dist/index.umd.js.map +1 -1
  3. package/dist/worker/SharedSyncImplementation.umd.js +18 -9
  4. package/dist/worker/SharedSyncImplementation.umd.js.map +1 -1
  5. package/dist/worker/WASQLiteDB.umd.js +94 -60
  6. package/dist/worker/WASQLiteDB.umd.js.map +1 -1
  7. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_src_examples-833585.umd.js +1400 -0
  8. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_7_0_node_modules_journeyapps_wa-sqlite_src_examples-833585.umd.js.map +1 -0
  9. package/lib/package.json +2 -2
  10. package/lib/src/db/adapters/AsyncWebAdapter.js +1 -1
  11. package/lib/src/db/adapters/AsyncWebAdapter.js.map +1 -1
  12. package/lib/src/db/adapters/wa-sqlite/RawSqliteConnection.d.ts +8 -1
  13. package/lib/src/db/adapters/wa-sqlite/RawSqliteConnection.js +13 -9
  14. package/lib/src/db/adapters/wa-sqlite/RawSqliteConnection.js.map +1 -1
  15. package/lib/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.js +8 -2
  16. package/lib/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.js.map +1 -1
  17. package/lib/src/db/adapters/wa-sqlite/vfs.d.ts +20 -30
  18. package/lib/src/db/adapters/wa-sqlite/vfs.js +57 -39
  19. package/lib/src/db/adapters/wa-sqlite/vfs.js.map +1 -1
  20. package/lib/src/db/sync/SharedWebStreamingSyncImplementation.d.ts +1 -0
  21. package/lib/src/db/sync/SharedWebStreamingSyncImplementation.js +10 -5
  22. package/lib/src/db/sync/SharedWebStreamingSyncImplementation.js.map +1 -1
  23. package/lib/src/worker/db/MultiDatabaseServer.js +5 -3
  24. package/lib/src/worker/db/MultiDatabaseServer.js.map +1 -1
  25. package/lib/src/worker/db/open-worker-database.d.ts +3 -2
  26. package/lib/src/worker/db/open-worker-database.js +30 -22
  27. package/lib/src/worker/db/open-worker-database.js.map +1 -1
  28. package/lib/src/worker/errors.d.ts +2 -0
  29. package/lib/src/worker/errors.js +7 -0
  30. package/lib/src/worker/errors.js.map +1 -0
  31. package/lib/src/worker/sync/SharedSyncImplementation.d.ts +1 -0
  32. package/lib/src/worker/sync/SharedSyncImplementation.js +2 -1
  33. package/lib/src/worker/sync/SharedSyncImplementation.js.map +1 -1
  34. package/lib/tsconfig.tsbuildinfo +1 -1
  35. package/package.json +3 -3
  36. package/src/db/adapters/AsyncWebAdapter.ts +1 -1
  37. package/src/db/adapters/wa-sqlite/RawSqliteConnection.ts +15 -11
  38. package/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.ts +24 -9
  39. package/src/db/adapters/wa-sqlite/vfs.ts +67 -54
  40. package/src/db/sync/SharedWebStreamingSyncImplementation.ts +17 -11
  41. package/src/worker/db/MultiDatabaseServer.ts +5 -3
  42. package/src/worker/db/open-worker-database.ts +34 -22
  43. package/src/worker/errors.ts +9 -0
  44. 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.1";
12717
+ var version = "1.57.3";
12713
12718
  var PACKAGE = {
12714
12719
  version: version};
12715
12720
 
@@ -13323,6 +13328,9 @@ class AbstractRemote {
13323
13328
  if (!res.ok || !res.body) {
13324
13329
  const text = await res.text();
13325
13330
  this.logger.error(`Could not POST streaming to ${path} - ${res.status} - ${res.statusText}: ${text}`);
13331
+ if (res.status === 401) {
13332
+ this.invalidateCredentials();
13333
+ }
13326
13334
  const error = new Error(`HTTP ${res.statusText}: ${text}`);
13327
13335
  error.status = res.status;
13328
13336
  throw error;
@@ -13579,6 +13587,7 @@ class AbstractStreamingSyncImplementation extends BaseObserver {
13579
13587
  async _uploadAllCrud(signal) {
13580
13588
  return this.obtainLock({
13581
13589
  type: LockType.CRUD,
13590
+ signal,
13582
13591
  callback: async () => {
13583
13592
  /**
13584
13593
  * Keep track of the first item in the CRUD queue for the last `uploadCrud` iteration.
@@ -15203,7 +15212,7 @@ SELECT * FROM crud_entries;
15203
15212
  }
15204
15213
  /**
15205
15214
  * Open a read-only transaction.
15206
- * Read transactions can run concurrently to a write transaction.
15215
+ * When multiple connections are available, read transactions can run concurrently to a write transaction.
15207
15216
  * Changes from any write transaction are not visible to read transactions started before it.
15208
15217
  *
15209
15218
  * @param callback - Function to execute within the transaction