@powersync/web 0.0.0-dev-20251120085122 → 0.0.0-dev-20251127205344

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 (28) hide show
  1. package/dist/index.umd.js +63 -41
  2. package/dist/index.umd.js.map +1 -1
  3. package/dist/worker/SharedSyncImplementation.umd.js +14914 -10959
  4. package/dist/worker/SharedSyncImplementation.umd.js.map +1 -1
  5. package/dist/worker/WASQLiteDB.umd.js +12708 -10895
  6. package/dist/worker/WASQLiteDB.umd.js.map +1 -1
  7. package/lib/package.json +2 -2
  8. package/lib/src/db/adapters/LockedAsyncDatabaseAdapter.d.ts +1 -0
  9. package/lib/src/db/adapters/LockedAsyncDatabaseAdapter.js +11 -2
  10. package/lib/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.js +1 -1
  11. package/lib/src/db/sync/SharedWebStreamingSyncImplementation.d.ts +1 -1
  12. package/lib/src/db/sync/SharedWebStreamingSyncImplementation.js +15 -13
  13. package/lib/src/worker/db/SharedWASQLiteConnection.js +1 -0
  14. package/lib/src/worker/sync/SharedSyncImplementation.js +22 -12
  15. package/lib/src/worker/sync/WorkerClient.d.ts +1 -1
  16. package/lib/src/worker/sync/WorkerClient.js +2 -2
  17. package/lib/tsconfig.tsbuildinfo +1 -1
  18. package/package.json +3 -3
  19. package/src/db/adapters/LockedAsyncDatabaseAdapter.ts +12 -2
  20. package/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.ts +1 -1
  21. package/src/db/sync/SharedWebStreamingSyncImplementation.ts +18 -16
  22. package/src/worker/db/SharedWASQLiteConnection.ts +1 -0
  23. package/src/worker/sync/SharedSyncImplementation.ts +24 -14
  24. package/src/worker/sync/WorkerClient.ts +5 -4
  25. package/dist/_journeyapps_wa-sqlite-_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapp-81d3460.index.umd.js +0 -355
  26. package/dist/_journeyapps_wa-sqlite-_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapp-81d3460.index.umd.js.map +0 -1
  27. package/dist/_journeyapps_wa-sqlite-_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapp-81d3461.index.umd.js +0 -355
  28. package/dist/_journeyapps_wa-sqlite-_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapp-81d3461.index.umd.js.map +0 -1
@@ -6,16 +6,16 @@ import {
6
6
  SyncStatusOptions
7
7
  } from '@powersync/common';
8
8
  import * as Comlink from 'comlink';
9
+ import { getNavigatorLocks } from '../../shared/navigator';
9
10
  import { AbstractSharedSyncClientProvider } from '../../worker/sync/AbstractSharedSyncClientProvider';
10
11
  import { ManualSharedSyncPayload, SharedSyncClientEvent } from '../../worker/sync/SharedSyncImplementation';
11
- import { DEFAULT_CACHE_SIZE_KB, resolveWebSQLFlags, TemporaryStorageOption } from '../adapters/web-sql-flags';
12
+ import { WorkerClient } from '../../worker/sync/WorkerClient';
12
13
  import { WebDBAdapter } from '../adapters/WebDBAdapter';
14
+ import { DEFAULT_CACHE_SIZE_KB, TemporaryStorageOption, resolveWebSQLFlags } from '../adapters/web-sql-flags';
13
15
  import {
14
16
  WebStreamingSyncImplementation,
15
17
  WebStreamingSyncImplementationOptions
16
18
  } from './WebStreamingSyncImplementation';
17
- import { WorkerClient } from '../../worker/sync/WorkerClient';
18
- import { getNavigatorLocks } from '../../shared/navigator';
19
19
 
20
20
  /**
21
21
  * The shared worker will trigger methods on this side of the message port
@@ -160,6 +160,21 @@ export class SharedWebStreamingSyncImplementation extends WebStreamingSyncImplem
160
160
  const { crudUploadThrottleMs, identifier, retryDelayMs } = this.options;
161
161
  const flags = { ...this.webOptions.flags, workers: undefined };
162
162
 
163
+ // Request a random lock until this client is disposed. The name of the lock is sent to the shared worker, which
164
+ // will also attempt to acquire it. Since the lock is returned when the tab is closed, this allows the share worker
165
+ // to free resources associated with this tab.
166
+ // We take hold of this lock as soon-as-possible in order to cater for potentially closed tabs.
167
+ getNavigatorLocks().request(`tab-close-signal-${crypto.randomUUID()}`, async (lock) => {
168
+ if (!this.abortOnClose.signal.aborted) {
169
+ // Awaiting here ensures the worker is waiting for the lock
170
+ await this.syncManager.addLockBasedCloseSignal(lock!.name);
171
+
172
+ await new Promise<void>((r) => {
173
+ this.abortOnClose.signal.onabort = () => r();
174
+ });
175
+ }
176
+ });
177
+
163
178
  this.isInitialized = this.syncManager.setParams(
164
179
  {
165
180
  dbParams: this.dbAdapter.getConfiguration(),
@@ -190,19 +205,6 @@ export class SharedWebStreamingSyncImplementation extends WebStreamingSyncImplem
190
205
  * This performs bi-directional method calling.
191
206
  */
192
207
  Comlink.expose(this.clientProvider, this.messagePort);
193
-
194
- // Request a random lock until this client is disposed. The name of the lock is sent to the shared worker, which
195
- // will also attempt to acquire it. Since the lock is returned when the tab is closed, this allows the share worker
196
- // to free resources associated with this tab.
197
- getNavigatorLocks().request(`tab-close-signal-${crypto.randomUUID()}`, async (lock) => {
198
- if (!this.abortOnClose.signal.aborted) {
199
- this.syncManager.addLockBasedCloseSignal(lock!.name);
200
-
201
- await new Promise<void>((r) => {
202
- this.abortOnClose.signal.onabort = () => r();
203
- });
204
- }
205
- });
206
208
  }
207
209
 
208
210
  /**
@@ -96,6 +96,7 @@ export class SharedWASQLiteConnection implements AsyncDatabaseConnection {
96
96
  const connection = this.connection;
97
97
  dbMap.delete(dbFilename);
98
98
  await connection.close();
99
+ return;
99
100
  }
100
101
  logger.debug(`Connection to ${dbFilename} not closed yet due to active clients.`);
101
102
  return;
@@ -322,6 +322,22 @@ export class SharedSyncImplementation extends BaseObserver<SharedSyncImplementat
322
322
  });
323
323
 
324
324
  const shouldReconnect = !!this.connectionManager.syncStreamImplementation && this.ports.length > 0;
325
+
326
+ /**
327
+ * If the current database adapter is the one that is being closed, we need to disconnect from the backend.
328
+ * We can disconnect in the portMutex lock. This ensures the disconnect is not affected by potential other
329
+ * connect operations coming from other tabs.
330
+ */
331
+ if (this.dbAdapter && this.dbAdapter == trackedPort.db) {
332
+ this.logger.debug(`Disconnecting due to closed database: should reconnect: ${shouldReconnect}`);
333
+ this.dbAdapter = null;
334
+ // Unconditionally close the connection because the database it's writing to has just been closed.
335
+ // The connection has been closed previously, this might throw. We should be able to ignore it.
336
+ await this.connectionManager
337
+ .disconnect()
338
+ .catch((ex) => this.logger.warn('Error while disconnecting. Will attempt to reconnect.', ex));
339
+ }
340
+
325
341
  return {
326
342
  shouldReconnect,
327
343
  trackedPort
@@ -337,19 +353,8 @@ export class SharedSyncImplementation extends BaseObserver<SharedSyncImplementat
337
353
  await closeListener();
338
354
  }
339
355
 
340
- if (this.dbAdapter && this.dbAdapter == trackedPort.db) {
341
- // Unconditionally close the connection because the database it's writing to has just been closed.
342
- // The connection has been closed previously, this might throw. We should be able to ignore it.
343
- await this.connectionManager
344
- .disconnect()
345
- .catch((ex) => this.logger.warn('Error while disconnecting. Will attempt to reconnect.', ex));
346
-
347
- // Clearing the adapter will result in a new one being opened in connect
348
- this.dbAdapter = null;
349
-
350
- if (shouldReconnect) {
351
- await this.connectionManager.connect(CONNECTOR_PLACEHOLDER, this.lastConnectOptions ?? {});
352
- }
356
+ if (shouldReconnect) {
357
+ await this.connectionManager.connect(CONNECTOR_PLACEHOLDER, this.lastConnectOptions ?? {});
353
358
  }
354
359
 
355
360
  // Re-index subscriptions, the subscriptions of the removed port would no longer be considered.
@@ -487,7 +492,12 @@ export class SharedSyncImplementation extends BaseObserver<SharedSyncImplementat
487
492
  });
488
493
  lastClient.closeListeners.push(async () => {
489
494
  this.logger.info('Aborting open connection because associated tab closed.');
490
- await wrapped.close().catch((ex) => this.logger.warn('error closing database connection', ex));
495
+ /**
496
+ * Don't await this close operation. It might never resolve if the tab is closed.
497
+ * We run the close operation first, before marking the remote as closed. This gives the database some chance
498
+ * to close the connection.
499
+ */
500
+ wrapped.close().catch((ex) => this.logger.warn('error closing database connection', ex));
491
501
  wrapped.markRemoteClosed();
492
502
  });
493
503
 
@@ -1,4 +1,6 @@
1
+ import { ILogLevel, PowerSyncConnectionOptions, SubscribedStream, SyncStatusOptions } from '@powersync/common';
1
2
  import * as Comlink from 'comlink';
3
+ import { getNavigatorLocks } from '../../shared/navigator';
2
4
  import {
3
5
  ManualSharedSyncPayload,
4
6
  SharedSyncClientEvent,
@@ -6,8 +8,6 @@ import {
6
8
  SharedSyncInitOptions,
7
9
  WrappedSyncPort
8
10
  } from './SharedSyncImplementation';
9
- import { ILogLevel, PowerSyncConnectionOptions, SubscribedStream, SyncStatusOptions } from '@powersync/common';
10
- import { getNavigatorLocks } from '../../shared/navigator';
11
11
 
12
12
  /**
13
13
  * A client to the shared sync worker.
@@ -21,7 +21,9 @@ export class WorkerClient {
21
21
  constructor(
22
22
  private readonly sync: SharedSyncImplementation,
23
23
  private readonly port: MessagePort
24
- ) {}
24
+ ) {
25
+ Comlink.expose(this, this.port);
26
+ }
25
27
 
26
28
  async initialize() {
27
29
  /**
@@ -36,7 +38,6 @@ export class WorkerClient {
36
38
  });
37
39
 
38
40
  this.resolvedPort = await this.sync.addPort(this.port);
39
- Comlink.expose(this, this.port);
40
41
  }
41
42
 
42
43
  private async removePort() {
@@ -1,355 +0,0 @@
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
- /***/ "@journeyapps/wa-sqlite":
16
- /*!*****************************************!*\
17
- !*** external "@journeyapps/wa-sqlite" ***!
18
- \*****************************************/
19
- /***/ ((module) => {
20
-
21
- module.exports = __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite__;
22
-
23
- /***/ }),
24
-
25
- /***/ "@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js":
26
- /*!*****************************************************************************!*\
27
- !*** external "@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js" ***!
28
- \*****************************************************************************/
29
- /***/ ((module) => {
30
-
31
- module.exports = __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite_src_examples_AccessHandlePoolVFS_js__;
32
-
33
- /***/ }),
34
-
35
- /***/ "@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js":
36
- /*!***************************************************************************!*\
37
- !*** external "@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js" ***!
38
- \***************************************************************************/
39
- /***/ ((module) => {
40
-
41
- module.exports = __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite_src_examples_IDBBatchAtomicVFS_js__;
42
-
43
- /***/ }),
44
-
45
- /***/ "@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js":
46
- /*!*************************************************************************!*\
47
- !*** external "@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js" ***!
48
- \*************************************************************************/
49
- /***/ ((module) => {
50
-
51
- module.exports = __WEBPACK_EXTERNAL_MODULE__journeyapps_wa_sqlite_src_examples_OPFSCoopSyncVFS_js__;
52
-
53
- /***/ }),
54
-
55
- /***/ "@powersync/common":
56
- /*!************************************!*\
57
- !*** external "@powersync/common" ***!
58
- \************************************/
59
- /***/ ((module) => {
60
-
61
- module.exports = __WEBPACK_EXTERNAL_MODULE__powersync_common__;
62
-
63
- /***/ }),
64
-
65
- /***/ "async-mutex":
66
- /*!******************************!*\
67
- !*** external "async-mutex" ***!
68
- \******************************/
69
- /***/ ((module) => {
70
-
71
- module.exports = __WEBPACK_EXTERNAL_MODULE_async_mutex__;
72
-
73
- /***/ }),
74
-
75
- /***/ "comlink":
76
- /*!**************************!*\
77
- !*** external "comlink" ***!
78
- \**************************/
79
- /***/ ((module) => {
80
-
81
- module.exports = __WEBPACK_EXTERNAL_MODULE_comlink__;
82
-
83
- /***/ })
84
-
85
- /******/ });
86
- /************************************************************************/
87
- /******/ // The module cache
88
- /******/ var __webpack_module_cache__ = {};
89
- /******/
90
- /******/ // The require function
91
- /******/ function __webpack_require__(moduleId) {
92
- /******/ // Check if module is in cache
93
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
94
- /******/ if (cachedModule !== undefined) {
95
- /******/ return cachedModule.exports;
96
- /******/ }
97
- /******/ // Create a new module (and put it into the cache)
98
- /******/ var module = __webpack_module_cache__[moduleId] = {
99
- /******/ id: moduleId,
100
- /******/ loaded: false,
101
- /******/ exports: {}
102
- /******/ };
103
- /******/
104
- /******/ // Execute the module function
105
- /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
106
- /******/
107
- /******/ // Flag the module as loaded
108
- /******/ module.loaded = true;
109
- /******/
110
- /******/ // Return the exports of the module
111
- /******/ return module.exports;
112
- /******/ }
113
- /******/
114
- /******/ // expose the modules object (__webpack_modules__)
115
- /******/ __webpack_require__.m = __webpack_modules__;
116
- /******/
117
- /******/ // the startup function
118
- /******/ __webpack_require__.x = () => {
119
- /******/ // Load entry module and return exports
120
- /******/ // This entry module depends on other loaded chunks and execution need to be delayed
121
- /******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["lib_src_worker_db_WASQLiteDB_worker_js-lib_src_worker_sync_SharedSyncImplementation_worker_js"], () => (__webpack_require__("./lib/src/worker/db/WASQLiteDB.worker.js")))
122
- /******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
123
- /******/ return __webpack_exports__;
124
- /******/ };
125
- /******/
126
- /************************************************************************/
127
- /******/ /* webpack/runtime/chunk loaded */
128
- /******/ (() => {
129
- /******/ var deferred = [];
130
- /******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
131
- /******/ if(chunkIds) {
132
- /******/ priority = priority || 0;
133
- /******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
134
- /******/ deferred[i] = [chunkIds, fn, priority];
135
- /******/ return;
136
- /******/ }
137
- /******/ var notFulfilled = Infinity;
138
- /******/ for (var i = 0; i < deferred.length; i++) {
139
- /******/ var [chunkIds, fn, priority] = deferred[i];
140
- /******/ var fulfilled = true;
141
- /******/ for (var j = 0; j < chunkIds.length; j++) {
142
- /******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
143
- /******/ chunkIds.splice(j--, 1);
144
- /******/ } else {
145
- /******/ fulfilled = false;
146
- /******/ if(priority < notFulfilled) notFulfilled = priority;
147
- /******/ }
148
- /******/ }
149
- /******/ if(fulfilled) {
150
- /******/ deferred.splice(i--, 1)
151
- /******/ var r = fn();
152
- /******/ if (r !== undefined) result = r;
153
- /******/ }
154
- /******/ }
155
- /******/ return result;
156
- /******/ };
157
- /******/ })();
158
- /******/
159
- /******/ /* webpack/runtime/compat get default export */
160
- /******/ (() => {
161
- /******/ // getDefaultExport function for compatibility with non-harmony modules
162
- /******/ __webpack_require__.n = (module) => {
163
- /******/ var getter = module && module.__esModule ?
164
- /******/ () => (module['default']) :
165
- /******/ () => (module);
166
- /******/ __webpack_require__.d(getter, { a: getter });
167
- /******/ return getter;
168
- /******/ };
169
- /******/ })();
170
- /******/
171
- /******/ /* webpack/runtime/create fake namespace object */
172
- /******/ (() => {
173
- /******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);
174
- /******/ var leafPrototypes;
175
- /******/ // create a fake namespace object
176
- /******/ // mode & 1: value is a module id, require it
177
- /******/ // mode & 2: merge all properties of value into the ns
178
- /******/ // mode & 4: return value when already ns object
179
- /******/ // mode & 16: return value when it's Promise-like
180
- /******/ // mode & 8|1: behave like require
181
- /******/ __webpack_require__.t = function(value, mode) {
182
- /******/ if(mode & 1) value = this(value);
183
- /******/ if(mode & 8) return value;
184
- /******/ if(typeof value === 'object' && value) {
185
- /******/ if((mode & 4) && value.__esModule) return value;
186
- /******/ if((mode & 16) && typeof value.then === 'function') return value;
187
- /******/ }
188
- /******/ var ns = Object.create(null);
189
- /******/ __webpack_require__.r(ns);
190
- /******/ var def = {};
191
- /******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];
192
- /******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {
193
- /******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));
194
- /******/ }
195
- /******/ def['default'] = () => (value);
196
- /******/ __webpack_require__.d(ns, def);
197
- /******/ return ns;
198
- /******/ };
199
- /******/ })();
200
- /******/
201
- /******/ /* webpack/runtime/define property getters */
202
- /******/ (() => {
203
- /******/ // define getter functions for harmony exports
204
- /******/ __webpack_require__.d = (exports, definition) => {
205
- /******/ for(var key in definition) {
206
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
207
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
208
- /******/ }
209
- /******/ }
210
- /******/ };
211
- /******/ })();
212
- /******/
213
- /******/ /* webpack/runtime/ensure chunk */
214
- /******/ (() => {
215
- /******/ __webpack_require__.f = {};
216
- /******/ // This file contains only the entry chunk.
217
- /******/ // The chunk loading function for additional chunks
218
- /******/ __webpack_require__.e = (chunkId) => {
219
- /******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
220
- /******/ __webpack_require__.f[key](chunkId, promises);
221
- /******/ return promises;
222
- /******/ }, []));
223
- /******/ };
224
- /******/ })();
225
- /******/
226
- /******/ /* webpack/runtime/get javascript chunk filename */
227
- /******/ (() => {
228
- /******/ // This function allow to reference async chunks and sibling chunks for the entrypoint
229
- /******/ __webpack_require__.u = (chunkId) => {
230
- /******/ // return url for filenames based on template
231
- /******/ return "index.umd.js";
232
- /******/ };
233
- /******/ })();
234
- /******/
235
- /******/ /* webpack/runtime/global */
236
- /******/ (() => {
237
- /******/ __webpack_require__.g = (function() {
238
- /******/ if (typeof globalThis === 'object') return globalThis;
239
- /******/ try {
240
- /******/ return this || new Function('return this')();
241
- /******/ } catch (e) {
242
- /******/ if (typeof window === 'object') return window;
243
- /******/ }
244
- /******/ })();
245
- /******/ })();
246
- /******/
247
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
248
- /******/ (() => {
249
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
250
- /******/ })();
251
- /******/
252
- /******/ /* webpack/runtime/make namespace object */
253
- /******/ (() => {
254
- /******/ // define __esModule on exports
255
- /******/ __webpack_require__.r = (exports) => {
256
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
257
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
258
- /******/ }
259
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
260
- /******/ };
261
- /******/ })();
262
- /******/
263
- /******/ /* webpack/runtime/node module decorator */
264
- /******/ (() => {
265
- /******/ __webpack_require__.nmd = (module) => {
266
- /******/ module.paths = [];
267
- /******/ if (!module.children) module.children = [];
268
- /******/ return module;
269
- /******/ };
270
- /******/ })();
271
- /******/
272
- /******/ /* webpack/runtime/publicPath */
273
- /******/ (() => {
274
- /******/ var scriptUrl;
275
- /******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
276
- /******/ var document = __webpack_require__.g.document;
277
- /******/ if (!scriptUrl && document) {
278
- /******/ if (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT')
279
- /******/ scriptUrl = document.currentScript.src;
280
- /******/ if (!scriptUrl) {
281
- /******/ var scripts = document.getElementsByTagName("script");
282
- /******/ if(scripts.length) {
283
- /******/ var i = scripts.length - 1;
284
- /******/ while (i > -1 && (!scriptUrl || !/^http(s?):/.test(scriptUrl))) scriptUrl = scripts[i--].src;
285
- /******/ }
286
- /******/ }
287
- /******/ }
288
- /******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
289
- /******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
290
- /******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
291
- /******/ scriptUrl = scriptUrl.replace(/^blob:/, "").replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
292
- /******/ __webpack_require__.p = scriptUrl;
293
- /******/ })();
294
- /******/
295
- /******/ /* webpack/runtime/importScripts chunk loading */
296
- /******/ (() => {
297
- /******/ __webpack_require__.b = self.location + "";
298
- /******/
299
- /******/ // object to store loaded chunks
300
- /******/ // "1" means "already loaded"
301
- /******/ var installedChunks = {
302
- /******/ "_journeyapps_wa-sqlite-_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapp-81d3460": 1
303
- /******/ };
304
- /******/
305
- /******/ // importScripts chunk loading
306
- /******/ var installChunk = (data) => {
307
- /******/ var [chunkIds, moreModules, runtime] = data;
308
- /******/ for(var moduleId in moreModules) {
309
- /******/ if(__webpack_require__.o(moreModules, moduleId)) {
310
- /******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
311
- /******/ }
312
- /******/ }
313
- /******/ if(runtime) runtime(__webpack_require__);
314
- /******/ while(chunkIds.length)
315
- /******/ installedChunks[chunkIds.pop()] = 1;
316
- /******/ parentChunkLoadingFunction(data);
317
- /******/ };
318
- /******/ __webpack_require__.f.i = (chunkId, promises) => {
319
- /******/ // "1" is the signal for "already loaded"
320
- /******/ if(!installedChunks[chunkId]) {
321
- /******/ if(true) { // all chunks have JS
322
- /******/ importScripts(__webpack_require__.p + __webpack_require__.u(chunkId));
323
- /******/ }
324
- /******/ }
325
- /******/ };
326
- /******/
327
- /******/ var chunkLoadingGlobal = self["webpackChunksdk_web"] = self["webpackChunksdk_web"] || [];
328
- /******/ var parentChunkLoadingFunction = chunkLoadingGlobal.push.bind(chunkLoadingGlobal);
329
- /******/ chunkLoadingGlobal.push = installChunk;
330
- /******/
331
- /******/ // no HMR
332
- /******/
333
- /******/ // no HMR manifest
334
- /******/ })();
335
- /******/
336
- /******/ /* webpack/runtime/startup chunk dependencies */
337
- /******/ (() => {
338
- /******/ var next = __webpack_require__.x;
339
- /******/ __webpack_require__.x = () => {
340
- /******/ return Promise.all([
341
- /******/
342
- /******/ ]).then(next);
343
- /******/ };
344
- /******/ })();
345
- /******/
346
- /************************************************************************/
347
- /******/
348
- /******/ // run startup
349
- /******/ var __webpack_exports__ = __webpack_require__.x();
350
- /******/
351
- /******/ return __webpack_exports__;
352
- /******/ })()
353
- ;
354
- });
355
- //# sourceMappingURL=_journeyapps_wa-sqlite-_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapp-81d3460.index.umd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_journeyapps_wa-sqlite-_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapp-81d3460.index.umd.js","mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;ACVA;;;;;;;;;;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;;;;ACtCA;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;;;;;ACPA;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;;;;;ACJA;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/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/compat get default export","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/node module decorator","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 ","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// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\tloaded: false,\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Flag the module as loaded\n\tmodule.loaded = true;\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, [\"lib_src_worker_db_WASQLiteDB_worker_js-lib_src_worker_sync_SharedSyncImplementation_worker_js\"], () => (__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};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\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' && !~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 sibling chunks for the entrypoint\n__webpack_require__.u = (chunkId) => {\n\t// return url for filenames based on template\n\treturn \"index.umd.js\";\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};","__webpack_require__.nmd = (module) => {\n\tmodule.paths = [];\n\tif (!module.children) module.children = [];\n\treturn module;\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-_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapp-81d3460\": 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":[],"sourceRoot":""}