@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
@@ -2414,12 +2414,21 @@ class DatabaseServer {
2414
2414
 
2415
2415
  __webpack_require__.r(__webpack_exports__);
2416
2416
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2417
- /* harmony export */ RawSqliteConnection: () => (/* binding */ RawSqliteConnection)
2417
+ /* harmony export */ RawSqliteConnection: () => (/* binding */ RawSqliteConnection),
2418
+ /* harmony export */ maxPathNameLength: () => (/* binding */ maxPathNameLength)
2418
2419
  /* harmony export */ });
2419
2420
  /* harmony import */ var _journeyapps_wa_sqlite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @journeyapps/wa-sqlite */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.7.0/node_modules/@journeyapps/wa-sqlite/src/sqlite-api.js");
2420
2421
  /* harmony import */ var _vfs_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./vfs.js */ "./lib/src/db/adapters/wa-sqlite/vfs.js");
2421
2422
 
2422
2423
 
2424
+ /**
2425
+ * The maximum length of a db filename we support.
2426
+ *
2427
+ * We configure the same on WA-SQLite (which otherwise defaults to a maximum length of 64). We don't want to support
2428
+ * very long path names as Safari maps OPFS files directly to OS files, and APFS has a 255-byte filename limit. Since
2429
+ * some VFS append additional characters for pooled file access handles, we want to stay well below that.
2430
+ */
2431
+ const maxPathNameLength = 128;
2423
2432
  /**
2424
2433
  * A small wrapper around WA-sqlite to help with opening databases and running statements by preparing them internally.
2425
2434
  *
@@ -2452,6 +2461,7 @@ class RawSqliteConnection {
2452
2461
  }
2453
2462
  async openSQLiteAPI() {
2454
2463
  const { module, vfs } = await (0,_vfs_js__WEBPACK_IMPORTED_MODULE_1__.loadModuleAndVfs)(this.options);
2464
+ vfs.mxPathname = maxPathNameLength;
2455
2465
  const sqlite3 = (0,_journeyapps_wa_sqlite__WEBPACK_IMPORTED_MODULE_0__.Factory)(module);
2456
2466
  sqlite3.vfs_register(vfs, true);
2457
2467
  /**
@@ -5298,12 +5308,16 @@ class ControlledExecutor {
5298
5308
  }
5299
5309
  async execute(param) {
5300
5310
  this.runningTask = this.task(param);
5301
- await this.runningTask;
5302
- this.runningTask = undefined;
5303
- if (this.pendingTaskParam) {
5304
- const pendingParam = this.pendingTaskParam;
5305
- this.pendingTaskParam = undefined;
5306
- this.execute(pendingParam);
5311
+ try {
5312
+ await this.runningTask;
5313
+ }
5314
+ finally {
5315
+ this.runningTask = undefined;
5316
+ if (this.pendingTaskParam) {
5317
+ const pendingParam = this.pendingTaskParam;
5318
+ this.pendingTaskParam = undefined;
5319
+ this.execute(pendingParam);
5320
+ }
5307
5321
  }
5308
5322
  }
5309
5323
  }
@@ -13883,7 +13897,7 @@ function requireDist () {
13883
13897
 
13884
13898
  var distExports = requireDist();
13885
13899
 
13886
- var version = "1.57.2";
13900
+ var version = "1.57.3";
13887
13901
  var PACKAGE = {
13888
13902
  version: version};
13889
13903
 
@@ -14756,6 +14770,7 @@ class AbstractStreamingSyncImplementation extends BaseObserver {
14756
14770
  async _uploadAllCrud(signal) {
14757
14771
  return this.obtainLock({
14758
14772
  type: LockType.CRUD,
14773
+ signal,
14759
14774
  callback: async () => {
14760
14775
  /**
14761
14776
  * Keep track of the first item in the CRUD queue for the last `uploadCrud` iteration.
@@ -16380,7 +16395,7 @@ SELECT * FROM crud_entries;
16380
16395
  }
16381
16396
  /**
16382
16397
  * Open a read-only transaction.
16383
- * Read transactions can run concurrently to a write transaction.
16398
+ * When multiple connections are available, read transactions can run concurrently to a write transaction.
16384
16399
  * Changes from any write transaction are not visible to read transactions started before it.
16385
16400
  *
16386
16401
  * @param callback - Function to execute within the transaction