@powersync/web 1.31.0 → 1.32.0

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 (110) hide show
  1. package/dist/_journeyapps_wa-sqlite-_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapp-89f0ba.index.umd.js +1867 -0
  2. package/dist/_journeyapps_wa-sqlite-_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapp-89f0ba.index.umd.js.map +1 -0
  3. package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530150.index.umd.js +555 -0
  4. package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530150.index.umd.js.map +1 -0
  5. package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530151.index.umd.js +555 -0
  6. package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530151.index.umd.js.map +1 -0
  7. package/dist/index.umd.js +4575 -43416
  8. package/dist/index.umd.js.map +1 -1
  9. package/dist/worker/SharedSyncImplementation.umd.js +402 -2053
  10. package/dist/worker/SharedSyncImplementation.umd.js.map +1 -1
  11. package/dist/worker/WASQLiteDB.umd.js +449 -2104
  12. package/dist/worker/WASQLiteDB.umd.js.map +1 -1
  13. package/dist/worker/{node_modules_bson_lib_bson_mjs.umd.js → node_modules_pnpm_bson_6_10_4_node_modules_bson_lib_bson_mjs.umd.js} +6 -6
  14. package/dist/worker/node_modules_pnpm_bson_6_10_4_node_modules_bson_lib_bson_mjs.umd.js.map +1 -0
  15. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-3a94cf.umd.js +44 -0
  16. 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 +1 -0
  17. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-868779.umd.js +44 -0
  18. 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 +1 -0
  19. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_wa-sqli-f60d0d.umd.js +44 -0
  20. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_wa-sqli-f60d0d.umd.js.map +1 -0
  21. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js +44 -0
  22. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js.map +1 -0
  23. package/dist/worker/{node_modules_journeyapps_wa-sqlite_src_examples_IDBBatchAtomicVFS_js.umd.js → node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-0d2437.umd.js} +24 -24
  24. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-0d2437.umd.js.map +1 -0
  25. package/dist/worker/{node_modules_journeyapps_wa-sqlite_src_examples_OPFSCoopSyncVFS_js.umd.js → node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-1d4e74.umd.js} +18 -18
  26. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-1d4e74.umd.js.map +1 -0
  27. package/dist/worker/{node_modules_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js.umd.js → node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-3622cf.umd.js} +18 -18
  28. package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-3622cf.umd.js.map +1 -0
  29. package/lib/package.json +26 -22
  30. package/lib/src/db/NavigatorTriggerClaimManager.d.ts +6 -0
  31. package/lib/src/db/NavigatorTriggerClaimManager.js +20 -0
  32. package/lib/src/db/PowerSyncDatabase.d.ts +5 -2
  33. package/lib/src/db/PowerSyncDatabase.js +46 -8
  34. package/lib/src/db/adapters/AbstractWebPowerSyncDatabaseOpenFactory.d.ts +1 -1
  35. package/lib/src/db/adapters/AbstractWebPowerSyncDatabaseOpenFactory.js +1 -1
  36. package/lib/src/db/adapters/AbstractWebSQLOpenFactory.d.ts +2 -2
  37. package/lib/src/db/adapters/AbstractWebSQLOpenFactory.js +2 -2
  38. package/lib/src/db/adapters/AsyncDatabaseConnection.d.ts +1 -1
  39. package/lib/src/db/adapters/LockedAsyncDatabaseAdapter.d.ts +4 -4
  40. package/lib/src/db/adapters/LockedAsyncDatabaseAdapter.js +8 -4
  41. package/lib/src/db/adapters/WebDBAdapter.d.ts +5 -2
  42. package/lib/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.d.ts +2 -2
  43. package/lib/src/db/adapters/wa-sqlite/InternalWASQLiteDBAdapter.d.ts +12 -0
  44. package/lib/src/db/adapters/wa-sqlite/InternalWASQLiteDBAdapter.js +19 -0
  45. package/lib/src/db/adapters/wa-sqlite/WASQLiteConnection.d.ts +2 -2
  46. package/lib/src/db/adapters/wa-sqlite/WASQLiteDBAdapter.d.ts +4 -4
  47. package/lib/src/db/adapters/wa-sqlite/WASQLiteDBAdapter.js +6 -6
  48. package/lib/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.d.ts +4 -4
  49. package/lib/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.js +7 -7
  50. package/lib/src/db/adapters/wa-sqlite/WASQLitePowerSyncDatabaseOpenFactory.d.ts +1 -1
  51. package/lib/src/db/adapters/wa-sqlite/WASQLitePowerSyncDatabaseOpenFactory.js +3 -3
  52. package/lib/src/db/sync/SharedWebStreamingSyncImplementation.d.ts +5 -5
  53. package/lib/src/db/sync/SharedWebStreamingSyncImplementation.js +5 -5
  54. package/lib/src/db/sync/WebRemote.js +1 -1
  55. package/lib/src/db/sync/WebStreamingSyncImplementation.d.ts +1 -1
  56. package/lib/src/db/sync/WebStreamingSyncImplementation.js +1 -1
  57. package/lib/src/index.d.ts +12 -12
  58. package/lib/src/index.js +12 -12
  59. package/lib/src/worker/db/SharedWASQLiteConnection.d.ts +2 -2
  60. package/lib/src/worker/db/WASQLiteDB.worker.js +3 -3
  61. package/lib/src/worker/db/WorkerWASQLiteConnection.d.ts +2 -2
  62. package/lib/src/worker/db/WorkerWASQLiteConnection.js +1 -1
  63. package/lib/src/worker/db/open-worker-database.d.ts +2 -2
  64. package/lib/src/worker/db/open-worker-database.js +1 -1
  65. package/lib/src/worker/sync/BroadcastLogger.d.ts +1 -1
  66. package/lib/src/worker/sync/SharedSyncImplementation.d.ts +4 -4
  67. package/lib/src/worker/sync/SharedSyncImplementation.js +5 -5
  68. package/lib/src/worker/sync/SharedSyncImplementation.worker.js +2 -2
  69. package/lib/src/worker/sync/WorkerClient.d.ts +1 -1
  70. package/lib/src/worker/sync/WorkerClient.js +2 -2
  71. package/lib/tsconfig.tsbuildinfo +1 -1
  72. package/package.json +21 -17
  73. package/src/db/NavigatorTriggerClaimManager.ts +23 -0
  74. package/src/db/PowerSyncDatabase.ts +53 -9
  75. package/src/db/adapters/AbstractWebPowerSyncDatabaseOpenFactory.ts +1 -1
  76. package/src/db/adapters/AbstractWebSQLOpenFactory.ts +3 -3
  77. package/src/db/adapters/AsyncDatabaseConnection.ts +1 -1
  78. package/src/db/adapters/LockedAsyncDatabaseAdapter.ts +13 -9
  79. package/src/db/adapters/WebDBAdapter.ts +6 -2
  80. package/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.ts +2 -2
  81. package/src/db/adapters/wa-sqlite/InternalWASQLiteDBAdapter.ts +23 -0
  82. package/src/db/adapters/wa-sqlite/WASQLiteConnection.ts +2 -2
  83. package/src/db/adapters/wa-sqlite/WASQLiteDBAdapter.ts +8 -8
  84. package/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.ts +8 -8
  85. package/src/db/adapters/wa-sqlite/WASQLitePowerSyncDatabaseOpenFactory.ts +3 -3
  86. package/src/db/sync/SharedWebStreamingSyncImplementation.ts +7 -7
  87. package/src/db/sync/WebRemote.ts +1 -1
  88. package/src/db/sync/WebStreamingSyncImplementation.ts +2 -2
  89. package/src/index.ts +12 -12
  90. package/src/worker/db/SharedWASQLiteConnection.ts +2 -2
  91. package/src/worker/db/WASQLiteDB.worker.ts +5 -5
  92. package/src/worker/db/WorkerWASQLiteConnection.ts +2 -2
  93. package/src/worker/db/open-worker-database.ts +2 -2
  94. package/src/worker/sync/BroadcastLogger.ts +1 -1
  95. package/src/worker/sync/SharedSyncImplementation.ts +9 -9
  96. package/src/worker/sync/SharedSyncImplementation.worker.ts +2 -2
  97. package/src/worker/sync/WorkerClient.ts +2 -2
  98. package/dist/worker/node_modules_bson_lib_bson_mjs.umd.js.map +0 -1
  99. package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_mc-wa-sqlite-async_mjs.umd.js +0 -44
  100. package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_mc-wa-sqlite-async_mjs.umd.js.map +0 -1
  101. package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_mc-wa-sqlite_mjs.umd.js +0 -44
  102. package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_mc-wa-sqlite_mjs.umd.js.map +0 -1
  103. package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_wa-sqlite-async_mjs.umd.js +0 -44
  104. package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_wa-sqlite-async_mjs.umd.js.map +0 -1
  105. package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js +0 -44
  106. package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js.map +0 -1
  107. package/dist/worker/node_modules_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js.umd.js.map +0 -1
  108. package/dist/worker/node_modules_journeyapps_wa-sqlite_src_examples_IDBBatchAtomicVFS_js.umd.js.map +0 -1
  109. package/dist/worker/node_modules_journeyapps_wa-sqlite_src_examples_OPFSCoopSyncVFS_js.umd.js.map +0 -1
  110. /package/bin/{powersync.js → powersync.cjs} +0 -0
@@ -0,0 +1,555 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory(require("@journeyapps/wa-sqlite"), require("@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js"), require("@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js"), require("@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js"), require("@powersync/common"), require("async-mutex"), require("comlink"));
4
+ else if(typeof define === 'function' && define.amd)
5
+ define(["@journeyapps/wa-sqlite", "@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js", "@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js", "@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js", "@powersync/common", "async-mutex", "comlink"], factory);
6
+ else if(typeof exports === 'object')
7
+ exports["sdk_web"] = factory(require("@journeyapps/wa-sqlite"), require("@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js"), require("@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js"), require("@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js"), require("@powersync/common"), require("async-mutex"), require("comlink"));
8
+ else
9
+ root["sdk_web"] = factory(root["@journeyapps/wa-sqlite"], root["@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js"], root["@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js"], root["@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js"], root["@powersync/common"], root["async-mutex"], root["comlink"]);
10
+ })(self, (__WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite__, __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite_src_examples_AccessHandlePoolVFS_js__, __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite_src_examples_IDBBatchAtomicVFS_js__, __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite_src_examples_OPFSCoopSyncVFS_js__, __WEBPACK_EXTERNAL_MODULE__powersync_common__, __WEBPACK_EXTERNAL_MODULE_async_mutex__, __WEBPACK_EXTERNAL_MODULE_comlink__) => {
11
+ return /******/ (() => { // webpackBootstrap
12
+ /******/ "use strict";
13
+ /******/ var __webpack_modules__ = ({
14
+
15
+ /***/ "./lib/src/worker/db/SharedWASQLiteConnection.js"
16
+ /*!*******************************************************!*\
17
+ !*** ./lib/src/worker/db/SharedWASQLiteConnection.js ***!
18
+ \*******************************************************/
19
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
20
+
21
+ __webpack_require__.r(__webpack_exports__);
22
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
23
+ /* harmony export */ SharedWASQLiteConnection: () => (/* binding */ SharedWASQLiteConnection)
24
+ /* harmony export */ });
25
+ class SharedWASQLiteConnection {
26
+ options;
27
+ isClosing;
28
+ // Keeps track if this current hold if the shared connection has a hold
29
+ activeHoldId;
30
+ constructor(options) {
31
+ this.options = options;
32
+ // Add this client ID to the set of known clients
33
+ this.clientIds.add(options.clientId);
34
+ this.isClosing = false;
35
+ this.activeHoldId = null;
36
+ }
37
+ get logger() {
38
+ return this.options.logger;
39
+ }
40
+ get dbEntry() {
41
+ return this.options.dbMap.get(this.options.dbFilename);
42
+ }
43
+ get connection() {
44
+ return this.dbEntry.db;
45
+ }
46
+ get clientIds() {
47
+ return this.dbEntry.clientIds;
48
+ }
49
+ async init() {
50
+ // No-op since the connection is already initialized when it was created
51
+ }
52
+ async markHold() {
53
+ this.activeHoldId = await this.connection.markHold();
54
+ return this.activeHoldId;
55
+ }
56
+ async releaseHold(id) {
57
+ try {
58
+ await this.connection.releaseHold(id);
59
+ }
60
+ finally {
61
+ this.activeHoldId = null;
62
+ }
63
+ }
64
+ async isAutoCommit() {
65
+ return this.connection.isAutoCommit();
66
+ }
67
+ /**
68
+ * Handles closing of a shared connection.
69
+ * The connection is only closed if there are no active clients using it.
70
+ */
71
+ async close() {
72
+ // This prevents further statements on this connection from being executed
73
+ this.isClosing = true;
74
+ const { clientIds, logger } = this;
75
+ const { clientId, dbFilename, dbMap } = this.options;
76
+ logger.debug(`Close requested from client ${clientId} of ${[...clientIds]}`);
77
+ clientIds.delete(clientId);
78
+ if (this.activeHoldId) {
79
+ // We can't cleanup here since we're not in a lock context.
80
+ // The cleanup will occur once a new hold is acquired.
81
+ this.logger.info(`Hold ${this.activeHoldId} was still active when the connection was closed. Cleanup will occur once a new hold is acquired.`);
82
+ }
83
+ if (clientIds.size == 0) {
84
+ logger.debug(`Closing connection to ${this.options}.`);
85
+ const connection = this.connection;
86
+ dbMap.delete(dbFilename);
87
+ await connection.close();
88
+ return;
89
+ }
90
+ logger.debug(`Connection to ${dbFilename} not closed yet due to active clients.`);
91
+ return;
92
+ }
93
+ async withClosing(action) {
94
+ if (this.isClosing) {
95
+ throw new Error('Connection is closing');
96
+ }
97
+ return action();
98
+ }
99
+ async execute(sql, params) {
100
+ return this.withClosing(() => this.connection.execute(sql, params));
101
+ }
102
+ async executeRaw(sql, params) {
103
+ return this.withClosing(() => this.connection.executeRaw(sql, params));
104
+ }
105
+ executeBatch(sql, params) {
106
+ return this.withClosing(() => this.connection.executeBatch(sql, params));
107
+ }
108
+ registerOnTableChange(callback) {
109
+ return this.connection.registerOnTableChange(callback);
110
+ }
111
+ getConfig() {
112
+ return this.connection.getConfig();
113
+ }
114
+ }
115
+
116
+
117
+ /***/ },
118
+
119
+ /***/ "./lib/src/worker/db/WASQLiteDB.worker.js"
120
+ /*!************************************************!*\
121
+ !*** ./lib/src/worker/db/WASQLiteDB.worker.js ***!
122
+ \************************************************/
123
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
124
+
125
+ __webpack_require__.r(__webpack_exports__);
126
+ /* harmony import */ var _journeyapps_wa_sqlite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @journeyapps/wa-sqlite */ "@journeyapps/wa-sqlite");
127
+ /* harmony import */ var _powersync_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @powersync/common */ "@powersync/common");
128
+ /* harmony import */ var comlink__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! comlink */ "comlink");
129
+ /* harmony import */ var _shared_navigator_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../shared/navigator.js */ "./lib/src/shared/navigator.js");
130
+ /* harmony import */ var _SharedWASQLiteConnection_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./SharedWASQLiteConnection.js */ "./lib/src/worker/db/SharedWASQLiteConnection.js");
131
+ /* harmony import */ var _WorkerWASQLiteConnection_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./WorkerWASQLiteConnection.js */ "./lib/src/worker/db/WorkerWASQLiteConnection.js");
132
+ /**
133
+ * Supports both shared and dedicated workers, based on how the worker is constructed (new SharedWorker vs new Worker()).
134
+ */
135
+
136
+
137
+
138
+
139
+
140
+
141
+ const baseLogger = (0,_powersync_common__WEBPACK_IMPORTED_MODULE_1__.createBaseLogger)();
142
+ baseLogger.useDefaults();
143
+ const logger = (0,_powersync_common__WEBPACK_IMPORTED_MODULE_1__.createLogger)('db-worker');
144
+ const DBMap = new Map();
145
+ const OPEN_DB_LOCK = 'open-wasqlite-db';
146
+ let nextClientId = 1;
147
+ const openDBShared = async (options) => {
148
+ // Prevent multiple simultaneous opens from causing race conditions
149
+ return (0,_shared_navigator_js__WEBPACK_IMPORTED_MODULE_3__.getNavigatorLocks)().request(OPEN_DB_LOCK, async () => {
150
+ const clientId = nextClientId++;
151
+ const { dbFilename, logLevel } = options;
152
+ logger.setLevel(logLevel);
153
+ if (!DBMap.has(dbFilename)) {
154
+ const clientIds = new Set();
155
+ // This format returns proxy objects for function callbacks
156
+ const connection = new _WorkerWASQLiteConnection_js__WEBPACK_IMPORTED_MODULE_5__.WorkerWASQLiteConnection(options);
157
+ await connection.init();
158
+ connection.registerListener({
159
+ holdOverwritten: async () => {
160
+ /**
161
+ * The previous hold has been overwritten, without being released.
162
+ * we need to cleanup any resources associated with it.
163
+ * We can perform a rollback to release any potential transactions that were started.
164
+ */
165
+ await connection.execute('ROLLBACK').catch(() => { });
166
+ }
167
+ });
168
+ DBMap.set(dbFilename, {
169
+ clientIds,
170
+ db: connection
171
+ });
172
+ }
173
+ // Associates this clientId with the shared connection entry
174
+ const sharedConnection = new _SharedWASQLiteConnection_js__WEBPACK_IMPORTED_MODULE_4__.SharedWASQLiteConnection({
175
+ dbMap: DBMap,
176
+ dbFilename,
177
+ clientId,
178
+ logger
179
+ });
180
+ return comlink__WEBPACK_IMPORTED_MODULE_2__.proxy(sharedConnection);
181
+ });
182
+ };
183
+ // Check if we're in a SharedWorker context
184
+ if (typeof SharedWorkerGlobalScope !== 'undefined') {
185
+ const _self = self;
186
+ _self.onconnect = function (event) {
187
+ const port = event.ports[0];
188
+ comlink__WEBPACK_IMPORTED_MODULE_2__.expose(openDBShared, port);
189
+ };
190
+ }
191
+ else {
192
+ // A dedicated worker can be shared externally
193
+ comlink__WEBPACK_IMPORTED_MODULE_2__.expose(openDBShared);
194
+ }
195
+ addEventListener('unload', () => {
196
+ Array.from(DBMap.values()).forEach(async (dbConnection) => {
197
+ const { db } = dbConnection;
198
+ db.close?.();
199
+ });
200
+ });
201
+
202
+
203
+ /***/ },
204
+
205
+ /***/ "./lib/src/worker/db/WorkerWASQLiteConnection.js"
206
+ /*!*******************************************************!*\
207
+ !*** ./lib/src/worker/db/WorkerWASQLiteConnection.js ***!
208
+ \*******************************************************/
209
+ (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
210
+
211
+ __webpack_require__.r(__webpack_exports__);
212
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
213
+ /* harmony export */ WorkerWASQLiteConnection: () => (/* binding */ WorkerWASQLiteConnection)
214
+ /* harmony export */ });
215
+ /* harmony import */ var comlink__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! comlink */ "comlink");
216
+ /* harmony import */ var _db_adapters_wa_sqlite_WASQLiteConnection_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../db/adapters/wa-sqlite/WASQLiteConnection.js */ "./lib/src/db/adapters/wa-sqlite/WASQLiteConnection.js");
217
+
218
+
219
+ /**
220
+ * A Small proxy wrapper around the WASqliteConnection.
221
+ * This ensures that certain return types are properly proxied.
222
+ */
223
+ class WorkerWASQLiteConnection extends _db_adapters_wa_sqlite_WASQLiteConnection_js__WEBPACK_IMPORTED_MODULE_1__.WASqliteConnection {
224
+ async registerOnTableChange(callback) {
225
+ // Proxy the callback remove function
226
+ return comlink__WEBPACK_IMPORTED_MODULE_0__.proxy(await super.registerOnTableChange(callback));
227
+ }
228
+ }
229
+
230
+
231
+ /***/ },
232
+
233
+ /***/ "@journeyapps/wa-sqlite"
234
+ /*!*****************************************!*\
235
+ !*** external "@journeyapps/wa-sqlite" ***!
236
+ \*****************************************/
237
+ (module) {
238
+
239
+ module.exports = __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite__;
240
+
241
+ /***/ },
242
+
243
+ /***/ "@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js"
244
+ /*!*****************************************************************************!*\
245
+ !*** external "@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js" ***!
246
+ \*****************************************************************************/
247
+ (module) {
248
+
249
+ module.exports = __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite_src_examples_AccessHandlePoolVFS_js__;
250
+
251
+ /***/ },
252
+
253
+ /***/ "@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js"
254
+ /*!***************************************************************************!*\
255
+ !*** external "@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js" ***!
256
+ \***************************************************************************/
257
+ (module) {
258
+
259
+ module.exports = __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite_src_examples_IDBBatchAtomicVFS_js__;
260
+
261
+ /***/ },
262
+
263
+ /***/ "@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js"
264
+ /*!*************************************************************************!*\
265
+ !*** external "@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js" ***!
266
+ \*************************************************************************/
267
+ (module) {
268
+
269
+ module.exports = __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite_src_examples_OPFSCoopSyncVFS_js__;
270
+
271
+ /***/ },
272
+
273
+ /***/ "@powersync/common"
274
+ /*!************************************!*\
275
+ !*** external "@powersync/common" ***!
276
+ \************************************/
277
+ (module) {
278
+
279
+ module.exports = __WEBPACK_EXTERNAL_MODULE__powersync_common__;
280
+
281
+ /***/ },
282
+
283
+ /***/ "async-mutex"
284
+ /*!******************************!*\
285
+ !*** external "async-mutex" ***!
286
+ \******************************/
287
+ (module) {
288
+
289
+ module.exports = __WEBPACK_EXTERNAL_MODULE_async_mutex__;
290
+
291
+ /***/ },
292
+
293
+ /***/ "comlink"
294
+ /*!**************************!*\
295
+ !*** external "comlink" ***!
296
+ \**************************/
297
+ (module) {
298
+
299
+ module.exports = __WEBPACK_EXTERNAL_MODULE_comlink__;
300
+
301
+ /***/ }
302
+
303
+ /******/ });
304
+ /************************************************************************/
305
+ /******/ // The module cache
306
+ /******/ var __webpack_module_cache__ = {};
307
+ /******/
308
+ /******/ // The require function
309
+ /******/ function __webpack_require__(moduleId) {
310
+ /******/ // Check if module is in cache
311
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
312
+ /******/ if (cachedModule !== undefined) {
313
+ /******/ return cachedModule.exports;
314
+ /******/ }
315
+ /******/ // Check if module exists (development only)
316
+ /******/ if (__webpack_modules__[moduleId] === undefined) {
317
+ /******/ var e = new Error("Cannot find module '" + moduleId + "'");
318
+ /******/ e.code = 'MODULE_NOT_FOUND';
319
+ /******/ throw e;
320
+ /******/ }
321
+ /******/ // Create a new module (and put it into the cache)
322
+ /******/ var module = __webpack_module_cache__[moduleId] = {
323
+ /******/ // no module.id needed
324
+ /******/ // no module.loaded needed
325
+ /******/ exports: {}
326
+ /******/ };
327
+ /******/
328
+ /******/ // Execute the module function
329
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
330
+ /******/
331
+ /******/ // Return the exports of the module
332
+ /******/ return module.exports;
333
+ /******/ }
334
+ /******/
335
+ /******/ // expose the modules object (__webpack_modules__)
336
+ /******/ __webpack_require__.m = __webpack_modules__;
337
+ /******/
338
+ /******/ // the startup function
339
+ /******/ __webpack_require__.x = () => {
340
+ /******/ // Load entry module and return exports
341
+ /******/ // This entry module depends on other loaded chunks and execution need to be delayed
342
+ /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["main"], () => (__webpack_require__("./lib/src/worker/db/WASQLiteDB.worker.js")))
343
+ /******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
344
+ /******/ return __webpack_exports__;
345
+ /******/ };
346
+ /******/
347
+ /************************************************************************/
348
+ /******/ /* webpack/runtime/chunk loaded */
349
+ /******/ (() => {
350
+ /******/ var deferred = [];
351
+ /******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
352
+ /******/ if(chunkIds) {
353
+ /******/ priority = priority || 0;
354
+ /******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
355
+ /******/ deferred[i] = [chunkIds, fn, priority];
356
+ /******/ return;
357
+ /******/ }
358
+ /******/ var notFulfilled = Infinity;
359
+ /******/ for (var i = 0; i < deferred.length; i++) {
360
+ /******/ var [chunkIds, fn, priority] = deferred[i];
361
+ /******/ var fulfilled = true;
362
+ /******/ for (var j = 0; j < chunkIds.length; j++) {
363
+ /******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
364
+ /******/ chunkIds.splice(j--, 1);
365
+ /******/ } else {
366
+ /******/ fulfilled = false;
367
+ /******/ if(priority < notFulfilled) notFulfilled = priority;
368
+ /******/ }
369
+ /******/ }
370
+ /******/ if(fulfilled) {
371
+ /******/ deferred.splice(i--, 1)
372
+ /******/ var r = fn();
373
+ /******/ if (r !== undefined) result = r;
374
+ /******/ }
375
+ /******/ }
376
+ /******/ return result;
377
+ /******/ };
378
+ /******/ })();
379
+ /******/
380
+ /******/ /* webpack/runtime/create fake namespace object */
381
+ /******/ (() => {
382
+ /******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);
383
+ /******/ var leafPrototypes;
384
+ /******/ // create a fake namespace object
385
+ /******/ // mode & 1: value is a module id, require it
386
+ /******/ // mode & 2: merge all properties of value into the ns
387
+ /******/ // mode & 4: return value when already ns object
388
+ /******/ // mode & 16: return value when it's Promise-like
389
+ /******/ // mode & 8|1: behave like require
390
+ /******/ __webpack_require__.t = function(value, mode) {
391
+ /******/ if(mode & 1) value = this(value);
392
+ /******/ if(mode & 8) return value;
393
+ /******/ if(typeof value === 'object' && value) {
394
+ /******/ if((mode & 4) && value.__esModule) return value;
395
+ /******/ if((mode & 16) && typeof value.then === 'function') return value;
396
+ /******/ }
397
+ /******/ var ns = Object.create(null);
398
+ /******/ __webpack_require__.r(ns);
399
+ /******/ var def = {};
400
+ /******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];
401
+ /******/ for(var current = mode & 2 && value; (typeof current == 'object' || typeof current == 'function') && !~leafPrototypes.indexOf(current); current = getProto(current)) {
402
+ /******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));
403
+ /******/ }
404
+ /******/ def['default'] = () => (value);
405
+ /******/ __webpack_require__.d(ns, def);
406
+ /******/ return ns;
407
+ /******/ };
408
+ /******/ })();
409
+ /******/
410
+ /******/ /* webpack/runtime/define property getters */
411
+ /******/ (() => {
412
+ /******/ // define getter functions for harmony exports
413
+ /******/ __webpack_require__.d = (exports, definition) => {
414
+ /******/ for(var key in definition) {
415
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
416
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
417
+ /******/ }
418
+ /******/ }
419
+ /******/ };
420
+ /******/ })();
421
+ /******/
422
+ /******/ /* webpack/runtime/ensure chunk */
423
+ /******/ (() => {
424
+ /******/ __webpack_require__.f = {};
425
+ /******/ // This file contains only the entry chunk.
426
+ /******/ // The chunk loading function for additional chunks
427
+ /******/ __webpack_require__.e = (chunkId) => {
428
+ /******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
429
+ /******/ __webpack_require__.f[key](chunkId, promises);
430
+ /******/ return promises;
431
+ /******/ }, []));
432
+ /******/ };
433
+ /******/ })();
434
+ /******/
435
+ /******/ /* webpack/runtime/get javascript chunk filename */
436
+ /******/ (() => {
437
+ /******/ // This function allow to reference async chunks and chunks that the entrypoint depends on
438
+ /******/ __webpack_require__.u = (chunkId) => {
439
+ /******/ // return url for filenames based on template
440
+ /******/ return undefined;
441
+ /******/ };
442
+ /******/ })();
443
+ /******/
444
+ /******/ /* webpack/runtime/global */
445
+ /******/ (() => {
446
+ /******/ __webpack_require__.g = (function() {
447
+ /******/ if (typeof globalThis === 'object') return globalThis;
448
+ /******/ try {
449
+ /******/ return this || new Function('return this')();
450
+ /******/ } catch (e) {
451
+ /******/ if (typeof window === 'object') return window;
452
+ /******/ }
453
+ /******/ })();
454
+ /******/ })();
455
+ /******/
456
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
457
+ /******/ (() => {
458
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
459
+ /******/ })();
460
+ /******/
461
+ /******/ /* webpack/runtime/make namespace object */
462
+ /******/ (() => {
463
+ /******/ // define __esModule on exports
464
+ /******/ __webpack_require__.r = (exports) => {
465
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
466
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
467
+ /******/ }
468
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
469
+ /******/ };
470
+ /******/ })();
471
+ /******/
472
+ /******/ /* webpack/runtime/publicPath */
473
+ /******/ (() => {
474
+ /******/ var scriptUrl;
475
+ /******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
476
+ /******/ var document = __webpack_require__.g.document;
477
+ /******/ if (!scriptUrl && document) {
478
+ /******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
479
+ /******/ scriptUrl = document.currentScript.src;
480
+ /******/ if (!scriptUrl) {
481
+ /******/ var scripts = document.getElementsByTagName("script");
482
+ /******/ if(scripts.length) {
483
+ /******/ var i = scripts.length - 1;
484
+ /******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
485
+ /******/ }
486
+ /******/ }
487
+ /******/ }
488
+ /******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
489
+ /******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
490
+ /******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
491
+ /******/ scriptUrl = scriptUrl.replace(/^blob:/, "").replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
492
+ /******/ __webpack_require__.p = scriptUrl;
493
+ /******/ })();
494
+ /******/
495
+ /******/ /* webpack/runtime/importScripts chunk loading */
496
+ /******/ (() => {
497
+ /******/ __webpack_require__.b = self.location + "";
498
+ /******/
499
+ /******/ // object to store loaded chunks
500
+ /******/ // "1" means "already loaded"
501
+ /******/ var installedChunks = {
502
+ /******/ "_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530150": 1
503
+ /******/ };
504
+ /******/
505
+ /******/ // importScripts chunk loading
506
+ /******/ var installChunk = (data) => {
507
+ /******/ var [chunkIds, moreModules, runtime] = data;
508
+ /******/ for(var moduleId in moreModules) {
509
+ /******/ if(__webpack_require__.o(moreModules, moduleId)) {
510
+ /******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
511
+ /******/ }
512
+ /******/ }
513
+ /******/ if(runtime) runtime(__webpack_require__);
514
+ /******/ while(chunkIds.length)
515
+ /******/ installedChunks[chunkIds.pop()] = 1;
516
+ /******/ parentChunkLoadingFunction(data);
517
+ /******/ };
518
+ /******/ __webpack_require__.f.i = (chunkId, promises) => {
519
+ /******/ // "1" is the signal for "already loaded"
520
+ /******/ if(!installedChunks[chunkId]) {
521
+ /******/ if(true) { // all chunks have JS
522
+ /******/ importScripts(__webpack_require__.p + __webpack_require__.u(chunkId));
523
+ /******/ }
524
+ /******/ }
525
+ /******/ };
526
+ /******/
527
+ /******/ var chunkLoadingGlobal = self["webpackChunksdk_web"] = self["webpackChunksdk_web"] || [];
528
+ /******/ var parentChunkLoadingFunction = chunkLoadingGlobal.push.bind(chunkLoadingGlobal);
529
+ /******/ chunkLoadingGlobal.push = installChunk;
530
+ /******/
531
+ /******/ // no HMR
532
+ /******/
533
+ /******/ // no HMR manifest
534
+ /******/ })();
535
+ /******/
536
+ /******/ /* webpack/runtime/startup chunk dependencies */
537
+ /******/ (() => {
538
+ /******/ var next = __webpack_require__.x;
539
+ /******/ __webpack_require__.x = () => {
540
+ /******/ return Promise.all([
541
+ /******/
542
+ /******/ ]).then(next);
543
+ /******/ };
544
+ /******/ })();
545
+ /******/
546
+ /************************************************************************/
547
+ /******/
548
+ /******/ // run startup
549
+ /******/ var __webpack_exports__ = __webpack_require__.x();
550
+ /******/
551
+ /******/ return __webpack_exports__;
552
+ /******/ })()
553
+ ;
554
+ });
555
+ //# sourceMappingURL=_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530150.index.umd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530150.index.umd.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;ACzFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;ACpEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;ACXA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACzCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACRA;AACA;AACA;AACA;AACA;;;;;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACPA;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AClBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;ACpCA;AACA;AACA;AACA;AACA;AACA;;;;;AELA;AACA","sources":["webpack://sdk_web/webpack/universalModuleDefinition","webpack://sdk_web/./lib/src/worker/db/SharedWASQLiteConnection.js","webpack://sdk_web/./lib/src/worker/db/WASQLiteDB.worker.js","webpack://sdk_web/./lib/src/worker/db/WorkerWASQLiteConnection.js","webpack://sdk_web/external umd \"@journeyapps/wa-sqlite\"","webpack://sdk_web/external umd \"@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js\"","webpack://sdk_web/external umd \"@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js\"","webpack://sdk_web/external umd \"@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js\"","webpack://sdk_web/external umd \"@powersync/common\"","webpack://sdk_web/external umd \"async-mutex\"","webpack://sdk_web/external umd \"comlink\"","webpack://sdk_web/webpack/bootstrap","webpack://sdk_web/webpack/runtime/chunk loaded","webpack://sdk_web/webpack/runtime/create fake namespace object","webpack://sdk_web/webpack/runtime/define property getters","webpack://sdk_web/webpack/runtime/ensure chunk","webpack://sdk_web/webpack/runtime/get javascript chunk filename","webpack://sdk_web/webpack/runtime/global","webpack://sdk_web/webpack/runtime/hasOwnProperty shorthand","webpack://sdk_web/webpack/runtime/make namespace object","webpack://sdk_web/webpack/runtime/publicPath","webpack://sdk_web/webpack/runtime/importScripts chunk loading","webpack://sdk_web/webpack/runtime/startup chunk dependencies","webpack://sdk_web/webpack/before-startup","webpack://sdk_web/webpack/startup","webpack://sdk_web/webpack/after-startup"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory(require(\"@journeyapps/wa-sqlite\"), require(\"@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js\"), require(\"@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js\"), require(\"@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js\"), require(\"@powersync/common\"), require(\"async-mutex\"), require(\"comlink\"));\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([\"@journeyapps/wa-sqlite\", \"@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js\", \"@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js\", \"@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js\", \"@powersync/common\", \"async-mutex\", \"comlink\"], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"sdk_web\"] = factory(require(\"@journeyapps/wa-sqlite\"), require(\"@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js\"), require(\"@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js\"), require(\"@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js\"), require(\"@powersync/common\"), require(\"async-mutex\"), require(\"comlink\"));\n\telse\n\t\troot[\"sdk_web\"] = factory(root[\"@journeyapps/wa-sqlite\"], root[\"@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js\"], root[\"@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js\"], root[\"@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js\"], root[\"@powersync/common\"], root[\"async-mutex\"], root[\"comlink\"]);\n})(self, (__WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite__, __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite_src_examples_AccessHandlePoolVFS_js__, __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite_src_examples_IDBBatchAtomicVFS_js__, __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite_src_examples_OPFSCoopSyncVFS_js__, __WEBPACK_EXTERNAL_MODULE__powersync_common__, __WEBPACK_EXTERNAL_MODULE_async_mutex__, __WEBPACK_EXTERNAL_MODULE_comlink__) => {\nreturn ","export class SharedWASQLiteConnection {\n options;\n isClosing;\n // Keeps track if this current hold if the shared connection has a hold\n activeHoldId;\n constructor(options) {\n this.options = options;\n // Add this client ID to the set of known clients\n this.clientIds.add(options.clientId);\n this.isClosing = false;\n this.activeHoldId = null;\n }\n get logger() {\n return this.options.logger;\n }\n get dbEntry() {\n return this.options.dbMap.get(this.options.dbFilename);\n }\n get connection() {\n return this.dbEntry.db;\n }\n get clientIds() {\n return this.dbEntry.clientIds;\n }\n async init() {\n // No-op since the connection is already initialized when it was created\n }\n async markHold() {\n this.activeHoldId = await this.connection.markHold();\n return this.activeHoldId;\n }\n async releaseHold(id) {\n try {\n await this.connection.releaseHold(id);\n }\n finally {\n this.activeHoldId = null;\n }\n }\n async isAutoCommit() {\n return this.connection.isAutoCommit();\n }\n /**\n * Handles closing of a shared connection.\n * The connection is only closed if there are no active clients using it.\n */\n async close() {\n // This prevents further statements on this connection from being executed\n this.isClosing = true;\n const { clientIds, logger } = this;\n const { clientId, dbFilename, dbMap } = this.options;\n logger.debug(`Close requested from client ${clientId} of ${[...clientIds]}`);\n clientIds.delete(clientId);\n if (this.activeHoldId) {\n // We can't cleanup here since we're not in a lock context.\n // The cleanup will occur once a new hold is acquired.\n this.logger.info(`Hold ${this.activeHoldId} was still active when the connection was closed. Cleanup will occur once a new hold is acquired.`);\n }\n if (clientIds.size == 0) {\n logger.debug(`Closing connection to ${this.options}.`);\n const connection = this.connection;\n dbMap.delete(dbFilename);\n await connection.close();\n return;\n }\n logger.debug(`Connection to ${dbFilename} not closed yet due to active clients.`);\n return;\n }\n async withClosing(action) {\n if (this.isClosing) {\n throw new Error('Connection is closing');\n }\n return action();\n }\n async execute(sql, params) {\n return this.withClosing(() => this.connection.execute(sql, params));\n }\n async executeRaw(sql, params) {\n return this.withClosing(() => this.connection.executeRaw(sql, params));\n }\n executeBatch(sql, params) {\n return this.withClosing(() => this.connection.executeBatch(sql, params));\n }\n registerOnTableChange(callback) {\n return this.connection.registerOnTableChange(callback);\n }\n getConfig() {\n return this.connection.getConfig();\n }\n}\n","/**\n * Supports both shared and dedicated workers, based on how the worker is constructed (new SharedWorker vs new Worker()).\n */\nimport '@journeyapps/wa-sqlite';\nimport { createBaseLogger, createLogger } from '@powersync/common';\nimport * as Comlink from 'comlink';\nimport { getNavigatorLocks } from '../../shared/navigator.js';\nimport { SharedWASQLiteConnection } from './SharedWASQLiteConnection.js';\nimport { WorkerWASQLiteConnection } from './WorkerWASQLiteConnection.js';\nconst baseLogger = createBaseLogger();\nbaseLogger.useDefaults();\nconst logger = createLogger('db-worker');\nconst DBMap = new Map();\nconst OPEN_DB_LOCK = 'open-wasqlite-db';\nlet nextClientId = 1;\nconst openDBShared = async (options) => {\n // Prevent multiple simultaneous opens from causing race conditions\n return getNavigatorLocks().request(OPEN_DB_LOCK, async () => {\n const clientId = nextClientId++;\n const { dbFilename, logLevel } = options;\n logger.setLevel(logLevel);\n if (!DBMap.has(dbFilename)) {\n const clientIds = new Set();\n // This format returns proxy objects for function callbacks\n const connection = new WorkerWASQLiteConnection(options);\n await connection.init();\n connection.registerListener({\n holdOverwritten: async () => {\n /**\n * The previous hold has been overwritten, without being released.\n * we need to cleanup any resources associated with it.\n * We can perform a rollback to release any potential transactions that were started.\n */\n await connection.execute('ROLLBACK').catch(() => { });\n }\n });\n DBMap.set(dbFilename, {\n clientIds,\n db: connection\n });\n }\n // Associates this clientId with the shared connection entry\n const sharedConnection = new SharedWASQLiteConnection({\n dbMap: DBMap,\n dbFilename,\n clientId,\n logger\n });\n return Comlink.proxy(sharedConnection);\n });\n};\n// Check if we're in a SharedWorker context\nif (typeof SharedWorkerGlobalScope !== 'undefined') {\n const _self = self;\n _self.onconnect = function (event) {\n const port = event.ports[0];\n Comlink.expose(openDBShared, port);\n };\n}\nelse {\n // A dedicated worker can be shared externally\n Comlink.expose(openDBShared);\n}\naddEventListener('unload', () => {\n Array.from(DBMap.values()).forEach(async (dbConnection) => {\n const { db } = dbConnection;\n db.close?.();\n });\n});\n","import * as Comlink from 'comlink';\nimport { WASqliteConnection } from '../../db/adapters/wa-sqlite/WASQLiteConnection.js';\n/**\n * A Small proxy wrapper around the WASqliteConnection.\n * This ensures that certain return types are properly proxied.\n */\nexport class WorkerWASQLiteConnection extends WASqliteConnection {\n async registerOnTableChange(callback) {\n // Proxy the callback remove function\n return Comlink.proxy(await super.registerOnTableChange(callback));\n }\n}\n","module.exports = __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite__;","module.exports = __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite_src_examples_AccessHandlePoolVFS_js__;","module.exports = __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite_src_examples_IDBBatchAtomicVFS_js__;","module.exports = __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite_src_examples_OPFSCoopSyncVFS_js__;","module.exports = __WEBPACK_EXTERNAL_MODULE__powersync_common__;","module.exports = __WEBPACK_EXTERNAL_MODULE_async_mutex__;","module.exports = __WEBPACK_EXTERNAL_MODULE_comlink__;","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Check if module exists (development only)\n\tif (__webpack_modules__[moduleId] === undefined) {\n\t\tvar e = new Error(\"Cannot find module '\" + moduleId + \"'\");\n\t\te.code = 'MODULE_NOT_FOUND';\n\t\tthrow e;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n// the startup function\n__webpack_require__.x = () => {\n\t// Load entry module and return exports\n\t// This entry module depends on other loaded chunks and execution need to be delayed\n\tvar __webpack_exports__ = __webpack_require__.O(undefined, [\"main\"], () => (__webpack_require__(\"./lib/src/worker/db/WASQLiteDB.worker.js\")))\n\t__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n\treturn __webpack_exports__;\n};\n\n","var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar [chunkIds, fn, priority] = deferred[i];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);\nvar leafPrototypes;\n// create a fake namespace object\n// mode & 1: value is a module id, require it\n// mode & 2: merge all properties of value into the ns\n// mode & 4: return value when already ns object\n// mode & 16: return value when it's Promise-like\n// mode & 8|1: behave like require\n__webpack_require__.t = function(value, mode) {\n\tif(mode & 1) value = this(value);\n\tif(mode & 8) return value;\n\tif(typeof value === 'object' && value) {\n\t\tif((mode & 4) && value.__esModule) return value;\n\t\tif((mode & 16) && typeof value.then === 'function') return value;\n\t}\n\tvar ns = Object.create(null);\n\t__webpack_require__.r(ns);\n\tvar def = {};\n\tleafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];\n\tfor(var current = mode & 2 && value; (typeof current == 'object' || typeof current == 'function') && !~leafPrototypes.indexOf(current); current = getProto(current)) {\n\t\tObject.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));\n\t}\n\tdef['default'] = () => (value);\n\t__webpack_require__.d(ns, def);\n\treturn ns;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = (chunkId) => {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};","// This function allow to reference async chunks and chunks that the entrypoint depends on\n__webpack_require__.u = (chunkId) => {\n\t// return url for filenames based on template\n\treturn undefined;\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","var scriptUrl;\nif (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + \"\";\nvar document = __webpack_require__.g.document;\nif (!scriptUrl && document) {\n\tif (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')\n\t\tscriptUrl = document.currentScript.src;\n\tif (!scriptUrl) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tif(scripts.length) {\n\t\t\tvar i = scripts.length - 1;\n\t\t\twhile (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;\n\t\t}\n\t}\n}\n// When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration\n// or pass an empty string (\"\") and set the __webpack_public_path__ variable from your code to use your own logic.\nif (!scriptUrl) throw new Error(\"Automatic publicPath is not supported in this browser\");\nscriptUrl = scriptUrl.replace(/^blob:/, \"\").replace(/#.*$/, \"\").replace(/\\?.*$/, \"\").replace(/\\/[^\\/]+$/, \"/\");\n__webpack_require__.p = scriptUrl;","__webpack_require__.b = self.location + \"\";\n\n// object to store loaded chunks\n// \"1\" means \"already loaded\"\nvar installedChunks = {\n\t\"_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530150\": 1\n};\n\n// importScripts chunk loading\nvar installChunk = (data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\tfor(var moduleId in moreModules) {\n\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t}\n\t}\n\tif(runtime) runtime(__webpack_require__);\n\twhile(chunkIds.length)\n\t\tinstalledChunks[chunkIds.pop()] = 1;\n\tparentChunkLoadingFunction(data);\n};\n__webpack_require__.f.i = (chunkId, promises) => {\n\t// \"1\" is the signal for \"already loaded\"\n\tif(!installedChunks[chunkId]) {\n\t\tif(true) { // all chunks have JS\n\t\t\timportScripts(__webpack_require__.p + __webpack_require__.u(chunkId));\n\t\t}\n\t}\n};\n\nvar chunkLoadingGlobal = self[\"webpackChunksdk_web\"] = self[\"webpackChunksdk_web\"] || [];\nvar parentChunkLoadingFunction = chunkLoadingGlobal.push.bind(chunkLoadingGlobal);\nchunkLoadingGlobal.push = installChunk;\n\n// no HMR\n\n// no HMR manifest","var next = __webpack_require__.x;\n__webpack_require__.x = () => {\n\treturn Promise.all([\n\n\t]).then(next);\n};","","// run startup\nvar __webpack_exports__ = __webpack_require__.x();\n",""],"names":[],"ignoreList":[],"sourceRoot":""}