@powersync/web 0.0.0-dev-20260128170935 → 0.0.0-dev-20260202160933

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 (100) hide show
  1. package/package.json +3 -3
  2. package/src/db/adapters/LockedAsyncDatabaseAdapter.ts +19 -11
  3. package/dist/0b19af1befc07ce338dd.wasm +0 -0
  4. package/dist/2632c3bda9473da74fd5.wasm +0 -0
  5. package/dist/64f5351ba3784bfe2f3e.wasm +0 -0
  6. package/dist/9318ca94aac4d0fe0135.wasm +0 -0
  7. package/dist/_journeyapps_wa-sqlite-_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapp-89f0ba.index.umd.js +0 -1867
  8. package/dist/_journeyapps_wa-sqlite-_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapp-89f0ba.index.umd.js.map +0 -1
  9. package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530150.index.umd.js +0 -555
  10. package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530150.index.umd.js.map +0 -1
  11. package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530151.index.umd.js +0 -555
  12. package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530151.index.umd.js.map +0 -1
  13. package/dist/index.umd.js +0 -8242
  14. package/dist/index.umd.js.map +0 -1
  15. package/dist/worker/SharedSyncImplementation.umd.js +0 -19034
  16. package/dist/worker/SharedSyncImplementation.umd.js.map +0 -1
  17. package/dist/worker/WASQLiteDB.umd.js +0 -17722
  18. package/dist/worker/WASQLiteDB.umd.js.map +0 -1
  19. package/dist/worker/node_modules_pnpm_bson_6_10_4_node_modules_bson_lib_bson_mjs.umd.js +0 -4646
  20. package/dist/worker/node_modules_pnpm_bson_6_10_4_node_modules_bson_lib_bson_mjs.umd.js.map +0 -1
  21. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-3a94cf.umd.js +0 -44
  22. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-3a94cf.umd.js.map +0 -1
  23. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-868779.umd.js +0 -44
  24. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-868779.umd.js.map +0 -1
  25. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_wa-sqli-f60d0d.umd.js +0 -44
  26. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_wa-sqli-f60d0d.umd.js.map +0 -1
  27. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js +0 -44
  28. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js.map +0 -1
  29. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-0d2437.umd.js +0 -2478
  30. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-0d2437.umd.js.map +0 -1
  31. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-1d4e74.umd.js +0 -1820
  32. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-1d4e74.umd.js.map +0 -1
  33. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-3622cf.umd.js +0 -1681
  34. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-3622cf.umd.js.map +0 -1
  35. package/lib/package.json +0 -95
  36. package/lib/src/attachments/IndexDBFileSystemAdapter.d.ts +0 -25
  37. package/lib/src/attachments/IndexDBFileSystemAdapter.js +0 -104
  38. package/lib/src/db/NavigatorTriggerClaimManager.d.ts +0 -6
  39. package/lib/src/db/NavigatorTriggerClaimManager.js +0 -20
  40. package/lib/src/db/PowerSyncDatabase.d.ts +0 -79
  41. package/lib/src/db/PowerSyncDatabase.js +0 -166
  42. package/lib/src/db/adapters/AbstractWebPowerSyncDatabaseOpenFactory.d.ts +0 -23
  43. package/lib/src/db/adapters/AbstractWebPowerSyncDatabaseOpenFactory.js +0 -26
  44. package/lib/src/db/adapters/AbstractWebSQLOpenFactory.d.ts +0 -17
  45. package/lib/src/db/adapters/AbstractWebSQLOpenFactory.js +0 -33
  46. package/lib/src/db/adapters/AsyncDatabaseConnection.d.ts +0 -49
  47. package/lib/src/db/adapters/AsyncDatabaseConnection.js +0 -1
  48. package/lib/src/db/adapters/LockedAsyncDatabaseAdapter.d.ts +0 -109
  49. package/lib/src/db/adapters/LockedAsyncDatabaseAdapter.js +0 -390
  50. package/lib/src/db/adapters/SSRDBAdapter.d.ts +0 -31
  51. package/lib/src/db/adapters/SSRDBAdapter.js +0 -69
  52. package/lib/src/db/adapters/WebDBAdapter.d.ts +0 -20
  53. package/lib/src/db/adapters/WebDBAdapter.js +0 -1
  54. package/lib/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.d.ts +0 -59
  55. package/lib/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.js +0 -147
  56. package/lib/src/db/adapters/wa-sqlite/InternalWASQLiteDBAdapter.d.ts +0 -12
  57. package/lib/src/db/adapters/wa-sqlite/InternalWASQLiteDBAdapter.js +0 -19
  58. package/lib/src/db/adapters/wa-sqlite/WASQLiteConnection.d.ts +0 -155
  59. package/lib/src/db/adapters/wa-sqlite/WASQLiteConnection.js +0 -401
  60. package/lib/src/db/adapters/wa-sqlite/WASQLiteDBAdapter.d.ts +0 -32
  61. package/lib/src/db/adapters/wa-sqlite/WASQLiteDBAdapter.js +0 -49
  62. package/lib/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.d.ts +0 -23
  63. package/lib/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.js +0 -96
  64. package/lib/src/db/adapters/wa-sqlite/WASQLitePowerSyncDatabaseOpenFactory.d.ts +0 -15
  65. package/lib/src/db/adapters/wa-sqlite/WASQLitePowerSyncDatabaseOpenFactory.js +0 -21
  66. package/lib/src/db/adapters/web-sql-flags.d.ts +0 -87
  67. package/lib/src/db/adapters/web-sql-flags.js +0 -36
  68. package/lib/src/db/sync/SSRWebStreamingSyncImplementation.d.ts +0 -48
  69. package/lib/src/db/sync/SSRWebStreamingSyncImplementation.js +0 -65
  70. package/lib/src/db/sync/SharedWebStreamingSyncImplementation.d.ts +0 -57
  71. package/lib/src/db/sync/SharedWebStreamingSyncImplementation.js +0 -237
  72. package/lib/src/db/sync/WebRemote.d.ts +0 -9
  73. package/lib/src/db/sync/WebRemote.js +0 -44
  74. package/lib/src/db/sync/WebStreamingSyncImplementation.d.ts +0 -13
  75. package/lib/src/db/sync/WebStreamingSyncImplementation.js +0 -18
  76. package/lib/src/db/sync/userAgent.d.ts +0 -17
  77. package/lib/src/db/sync/userAgent.js +0 -64
  78. package/lib/src/index.d.ts +0 -14
  79. package/lib/src/index.js +0 -14
  80. package/lib/src/shared/navigator.d.ts +0 -1
  81. package/lib/src/shared/navigator.js +0 -6
  82. package/lib/src/worker/db/SharedWASQLiteConnection.d.ts +0 -42
  83. package/lib/src/worker/db/SharedWASQLiteConnection.js +0 -90
  84. package/lib/src/worker/db/WASQLiteDB.worker.d.ts +0 -4
  85. package/lib/src/worker/db/WASQLiteDB.worker.js +0 -69
  86. package/lib/src/worker/db/WorkerWASQLiteConnection.d.ts +0 -9
  87. package/lib/src/worker/db/WorkerWASQLiteConnection.js +0 -12
  88. package/lib/src/worker/db/open-worker-database.d.ts +0 -14
  89. package/lib/src/worker/db/open-worker-database.js +0 -52
  90. package/lib/src/worker/sync/AbstractSharedSyncClientProvider.d.ts +0 -19
  91. package/lib/src/worker/sync/AbstractSharedSyncClientProvider.js +0 -5
  92. package/lib/src/worker/sync/BroadcastLogger.d.ts +0 -47
  93. package/lib/src/worker/sync/BroadcastLogger.js +0 -128
  94. package/lib/src/worker/sync/SharedSyncImplementation.d.ts +0 -137
  95. package/lib/src/worker/sync/SharedSyncImplementation.js +0 -495
  96. package/lib/src/worker/sync/SharedSyncImplementation.worker.d.ts +0 -1
  97. package/lib/src/worker/sync/SharedSyncImplementation.worker.js +0 -11
  98. package/lib/src/worker/sync/WorkerClient.d.ts +0 -31
  99. package/lib/src/worker/sync/WorkerClient.js +0 -84
  100. package/lib/tsconfig.tsbuildinfo +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powersync/web",
3
- "version": "0.0.0-dev-20260128170935",
3
+ "version": "0.0.0-dev-20260202160933",
4
4
  "description": "PowerSync Web SDK",
5
5
  "main": "lib/src/index.js",
6
6
  "module": "lib/src/index.js",
@@ -56,14 +56,14 @@
56
56
  "license": "Apache-2.0",
57
57
  "peerDependencies": {
58
58
  "@journeyapps/wa-sqlite": "^1.4.1",
59
- "@powersync/common": "0.0.0-dev-20260128170935"
59
+ "@powersync/common": "0.0.0-dev-20260202160933"
60
60
  },
61
61
  "dependencies": {
62
62
  "async-mutex": "^0.5.0",
63
63
  "bson": "^6.10.4",
64
64
  "comlink": "^4.4.2",
65
65
  "commander": "^12.1.0",
66
- "@powersync/common": "0.0.0-dev-20260128170935"
66
+ "@powersync/common": "0.0.0-dev-20260202160933"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@journeyapps/wa-sqlite": "^1.4.1",
@@ -151,13 +151,15 @@ export class LockedAsyncDatabaseAdapter
151
151
  * Returns a pending operation if one is already in progress.
152
152
  */
153
153
  async reOpenInternalDB(): Promise<void> {
154
- if (!this.options.reOpenOnConnectionClosed) {
155
- throw new Error(`Cannot re-open underlying database, reOpenOnConnectionClosed is not enabled`);
156
- }
157
- if (this.databaseOpenPromise) {
154
+ if (this.closing || !this.options.reOpenOnConnectionClosed) {
155
+ // No-op
156
+ return;
157
+ } else if (this.databaseOpenPromise) {
158
+ // Already busy opening
158
159
  return this.databaseOpenPromise;
160
+ } else {
161
+ return this._reOpen();
159
162
  }
160
- return this._reOpen();
161
163
  }
162
164
 
163
165
  protected async _init() {
@@ -317,9 +319,17 @@ export class LockedAsyncDatabaseAdapter
317
319
  protected async acquireLock(callback: () => Promise<any>, options?: { timeoutMs?: number }): Promise<any> {
318
320
  await this.waitForInitialized();
319
321
 
320
- // The database is being opened in the background. Wait for it here.
322
+ // The database is being (re)opened in the background. Wait for it here.
321
323
  if (this.databaseOpenPromise) {
322
324
  await this.databaseOpenPromise;
325
+ } else if (!this._db) {
326
+ /**
327
+ * The database is not open anymore, we might need to re-open it.
328
+ * Typically, _db, can be `null` if we tried to reOpen the database, but failed to succeed in re-opening.
329
+ * This can happen when disconnecting the client.
330
+ * Note: It is safe to re-enter this method multiple times.
331
+ */
332
+ await this.reOpenInternalDB();
323
333
  }
324
334
 
325
335
  return this._acquireLock(async () => {
@@ -339,11 +349,9 @@ export class LockedAsyncDatabaseAdapter
339
349
  return await callback();
340
350
  } catch (ex) {
341
351
  if (ConnectionClosedError.MATCHES(ex)) {
342
- if (this.options.reOpenOnConnectionClosed && !this.databaseOpenPromise && !this.closing) {
343
- // Immediately re-open the database. We need to miss as little table updates as possible.
344
- // Note, don't await this since it uses the same lock as we're in now.
345
- this.reOpenInternalDB();
346
- }
352
+ // Immediately re-open the database. We need to miss as little table updates as possible.
353
+ // Note, don't await this since it uses the same lock as we're in now.
354
+ this.reOpenInternalDB();
347
355
  }
348
356
  throw ex;
349
357
  } finally {
Binary file
Binary file
Binary file
Binary file