@powersync/web 0.0.0-dev-20251129133952 → 0.0.0-dev-20251203144301
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.
- package/dist/1807036ae51c10ee4d23.wasm +0 -0
- package/dist/{10072fe45f0a8fab0a0e.wasm → 307d8ce2280e3bae09d5.wasm} +0 -0
- package/dist/{6e435e51534839845554.wasm → cd8b9e8f4c87bf81c169.wasm} +0 -0
- package/dist/e797080f5ed0b5324166.wasm +0 -0
- package/dist/index.umd.js +2551 -161
- package/dist/index.umd.js.map +1 -1
- package/dist/worker/SharedSyncImplementation.umd.js +2020 -148
- package/dist/worker/SharedSyncImplementation.umd.js.map +1 -1
- package/dist/worker/WASQLiteDB.umd.js +1824 -9
- package/dist/worker/WASQLiteDB.umd.js.map +1 -1
- package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_mc-wa-sqlite-async_mjs.umd.js +2 -2
- package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_mc-wa-sqlite-async_mjs.umd.js.map +1 -1
- package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_mc-wa-sqlite_mjs.umd.js +2 -2
- package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_mc-wa-sqlite_mjs.umd.js.map +1 -1
- package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_wa-sqlite-async_mjs.umd.js +2 -2
- package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_wa-sqlite-async_mjs.umd.js.map +1 -1
- package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js +2 -2
- package/dist/worker/node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js.map +1 -1
- package/dist/worker/node_modules_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js.umd.js +0 -1203
- package/dist/worker/node_modules_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js.umd.js.map +1 -1
- package/dist/worker/node_modules_journeyapps_wa-sqlite_src_examples_IDBBatchAtomicVFS_js.umd.js +20 -1226
- package/dist/worker/node_modules_journeyapps_wa-sqlite_src_examples_IDBBatchAtomicVFS_js.umd.js.map +1 -1
- package/lib/package.json +2 -2
- package/lib/src/db/PowerSyncDatabase.d.ts +1 -1
- package/lib/src/db/PowerSyncDatabase.js +4 -4
- package/lib/src/db/adapters/AsyncDatabaseConnection.d.ts +5 -0
- package/lib/src/db/adapters/AsyncDatabaseConnection.js +5 -0
- package/lib/src/db/adapters/LockedAsyncDatabaseAdapter.d.ts +10 -2
- package/lib/src/db/adapters/LockedAsyncDatabaseAdapter.js +72 -33
- package/lib/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.d.ts +5 -1
- package/lib/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.js +12 -5
- package/lib/src/db/adapters/wa-sqlite/WASQLiteConnection.js +3 -3
- package/lib/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.d.ts +1 -1
- package/lib/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.js +2 -2
- package/lib/src/db/sync/SharedWebStreamingSyncImplementation.d.ts +0 -4
- package/lib/src/db/sync/SharedWebStreamingSyncImplementation.js +3 -8
- package/lib/src/worker/db/WASQLiteDB.worker.js +0 -1
- package/lib/src/worker/db/opfs.d.ts +96 -0
- package/lib/src/worker/db/opfs.js +582 -0
- package/lib/src/worker/sync/SharedSyncImplementation.d.ts +6 -11
- package/lib/src/worker/sync/SharedSyncImplementation.js +95 -67
- package/lib/src/worker/sync/SharedSyncImplementation.worker.js +1 -1
- package/lib/src/worker/sync/WorkerClient.d.ts +1 -3
- package/lib/src/worker/sync/WorkerClient.js +3 -27
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/db/PowerSyncDatabase.ts +13 -15
- package/src/db/adapters/AsyncDatabaseConnection.ts +5 -0
- package/src/db/adapters/LockedAsyncDatabaseAdapter.ts +91 -51
- package/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.ts +16 -4
- package/src/db/adapters/wa-sqlite/WASQLiteConnection.ts +3 -4
- package/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.ts +3 -3
- package/src/db/sync/SharedWebStreamingSyncImplementation.ts +5 -11
- package/src/worker/db/WASQLiteDB.worker.ts +0 -2
- package/src/worker/db/opfs.ts +623 -0
- package/src/worker/sync/SharedSyncImplementation.ts +106 -78
- package/src/worker/sync/SharedSyncImplementation.worker.ts +1 -1
- package/src/worker/sync/WorkerClient.ts +4 -30
- package/dist/a730f7ca717b02234beb.wasm +0 -0
- package/dist/aa2f408d64445fed090e.wasm +0 -0
- package/dist/worker/node_modules_journeyapps_wa-sqlite_src_examples_OPFSCoopSyncVFS_js.umd.js +0 -1813
- package/dist/worker/node_modules_journeyapps_wa-sqlite_src_examples_OPFSCoopSyncVFS_js.umd.js.map +0 -1
|
@@ -3,6 +3,1209 @@ var sdk_web;
|
|
|
3
3
|
/******/ "use strict";
|
|
4
4
|
/******/ var __webpack_modules__ = ({
|
|
5
5
|
|
|
6
|
+
/***/ "../../node_modules/@journeyapps/wa-sqlite/src/FacadeVFS.js":
|
|
7
|
+
/*!******************************************************************!*\
|
|
8
|
+
!*** ../../node_modules/@journeyapps/wa-sqlite/src/FacadeVFS.js ***!
|
|
9
|
+
\******************************************************************/
|
|
10
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
11
|
+
|
|
12
|
+
__webpack_require__.r(__webpack_exports__);
|
|
13
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
14
|
+
/* harmony export */ FacadeVFS: () => (/* binding */ FacadeVFS)
|
|
15
|
+
/* harmony export */ });
|
|
16
|
+
/* harmony import */ var _VFS_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./VFS.js */ "../../node_modules/@journeyapps/wa-sqlite/src/VFS.js");
|
|
17
|
+
// Copyright 2024 Roy T. Hashimoto. All Rights Reserved.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
const AsyncFunction = Object.getPrototypeOf(async function(){}).constructor;
|
|
21
|
+
|
|
22
|
+
// Milliseconds since Julian epoch as a BigInt.
|
|
23
|
+
// https://github.com/sqlite/sqlite/blob/e57527c14f7b7cfa6e32eeab5c549d50c4fa3674/src/os_unix.c#L6872-L6882
|
|
24
|
+
const UNIX_EPOCH = 24405875n * 8640000n;
|
|
25
|
+
|
|
26
|
+
// Convenience base class for a JavaScript VFS.
|
|
27
|
+
// The raw xOpen, xRead, etc. function signatures receive only C primitives
|
|
28
|
+
// which aren't easy to work with. This class provides corresponding calls
|
|
29
|
+
// like jOpen, jRead, etc., which receive JavaScript-friendlier arguments
|
|
30
|
+
// such as string, Uint8Array, and DataView.
|
|
31
|
+
class FacadeVFS extends _VFS_js__WEBPACK_IMPORTED_MODULE_0__.Base {
|
|
32
|
+
/**
|
|
33
|
+
* @param {string} name
|
|
34
|
+
* @param {object} module
|
|
35
|
+
*/
|
|
36
|
+
constructor(name, module) {
|
|
37
|
+
super(name, module);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Override to indicate which methods are asynchronous.
|
|
42
|
+
* @param {string} methodName
|
|
43
|
+
* @returns {boolean}
|
|
44
|
+
*/
|
|
45
|
+
hasAsyncMethod(methodName) {
|
|
46
|
+
// The input argument is a string like "xOpen", so convert to "jOpen".
|
|
47
|
+
// Then check if the method exists and is async.
|
|
48
|
+
const jMethodName = `j${methodName.slice(1)}`;
|
|
49
|
+
return this[jMethodName] instanceof AsyncFunction;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Return the filename for a file id for use by mixins.
|
|
54
|
+
* @param {number} pFile
|
|
55
|
+
* @returns {string}
|
|
56
|
+
*/
|
|
57
|
+
getFilename(pFile) {
|
|
58
|
+
throw new Error('unimplemented');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @param {string?} filename
|
|
63
|
+
* @param {number} pFile
|
|
64
|
+
* @param {number} flags
|
|
65
|
+
* @param {DataView} pOutFlags
|
|
66
|
+
* @returns {number|Promise<number>}
|
|
67
|
+
*/
|
|
68
|
+
jOpen(filename, pFile, flags, pOutFlags) {
|
|
69
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CANTOPEN;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @param {string} filename
|
|
74
|
+
* @param {number} syncDir
|
|
75
|
+
* @returns {number|Promise<number>}
|
|
76
|
+
*/
|
|
77
|
+
jDelete(filename, syncDir) {
|
|
78
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* @param {string} filename
|
|
83
|
+
* @param {number} flags
|
|
84
|
+
* @param {DataView} pResOut
|
|
85
|
+
* @returns {number|Promise<number>}
|
|
86
|
+
*/
|
|
87
|
+
jAccess(filename, flags, pResOut) {
|
|
88
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @param {string} filename
|
|
93
|
+
* @param {Uint8Array} zOut
|
|
94
|
+
* @returns {number|Promise<number>}
|
|
95
|
+
*/
|
|
96
|
+
jFullPathname(filename, zOut) {
|
|
97
|
+
// Copy the filename to the output buffer.
|
|
98
|
+
const { read, written } = new TextEncoder().encodeInto(filename, zOut);
|
|
99
|
+
if (read < filename.length) return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR;
|
|
100
|
+
if (written >= zOut.length) return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR;
|
|
101
|
+
zOut[written] = 0;
|
|
102
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* @param {Uint8Array} zBuf
|
|
107
|
+
* @returns {number|Promise<number>}
|
|
108
|
+
*/
|
|
109
|
+
jGetLastError(zBuf) {
|
|
110
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @param {number} pFile
|
|
115
|
+
* @returns {number|Promise<number>}
|
|
116
|
+
*/
|
|
117
|
+
jClose(pFile) {
|
|
118
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @param {number} pFile
|
|
123
|
+
* @param {Uint8Array} pData
|
|
124
|
+
* @param {number} iOffset
|
|
125
|
+
* @returns {number|Promise<number>}
|
|
126
|
+
*/
|
|
127
|
+
jRead(pFile, pData, iOffset) {
|
|
128
|
+
pData.fill(0);
|
|
129
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_SHORT_READ;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* @param {number} pFile
|
|
134
|
+
* @param {Uint8Array} pData
|
|
135
|
+
* @param {number} iOffset
|
|
136
|
+
* @returns {number|Promise<number>}
|
|
137
|
+
*/
|
|
138
|
+
jWrite(pFile, pData, iOffset) {
|
|
139
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_WRITE;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* @param {number} pFile
|
|
144
|
+
* @param {number} size
|
|
145
|
+
* @returns {number|Promise<number>}
|
|
146
|
+
*/
|
|
147
|
+
jTruncate(pFile, size) {
|
|
148
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* @param {number} pFile
|
|
153
|
+
* @param {number} flags
|
|
154
|
+
* @returns {number|Promise<number>}
|
|
155
|
+
*/
|
|
156
|
+
jSync(pFile, flags) {
|
|
157
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @param {number} pFile
|
|
162
|
+
* @param {DataView} pSize
|
|
163
|
+
* @returns {number|Promise<number>}
|
|
164
|
+
*/
|
|
165
|
+
jFileSize(pFile, pSize) {
|
|
166
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* @param {number} pFile
|
|
171
|
+
* @param {number} lockType
|
|
172
|
+
* @returns {number|Promise<number>}
|
|
173
|
+
*/
|
|
174
|
+
jLock(pFile, lockType) {
|
|
175
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* @param {number} pFile
|
|
180
|
+
* @param {number} lockType
|
|
181
|
+
* @returns {number|Promise<number>}
|
|
182
|
+
*/
|
|
183
|
+
jUnlock(pFile, lockType) {
|
|
184
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @param {number} pFile
|
|
189
|
+
* @param {DataView} pResOut
|
|
190
|
+
* @returns {number|Promise<number>}
|
|
191
|
+
*/
|
|
192
|
+
jCheckReservedLock(pFile, pResOut) {
|
|
193
|
+
pResOut.setInt32(0, 0, true);
|
|
194
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* @param {number} pFile
|
|
199
|
+
* @param {number} op
|
|
200
|
+
* @param {DataView} pArg
|
|
201
|
+
* @returns {number|Promise<number>}
|
|
202
|
+
*/
|
|
203
|
+
jFileControl(pFile, op, pArg) {
|
|
204
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_NOTFOUND;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* @param {number} pFile
|
|
209
|
+
* @returns {number|Promise<number>}
|
|
210
|
+
*/
|
|
211
|
+
jSectorSize(pFile) {
|
|
212
|
+
return super.xSectorSize(pFile);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* @param {number} pFile
|
|
217
|
+
* @returns {number|Promise<number>}
|
|
218
|
+
*/
|
|
219
|
+
jDeviceCharacteristics(pFile) {
|
|
220
|
+
return 0;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* @param {number} pVfs
|
|
225
|
+
* @param {number} zName
|
|
226
|
+
* @param {number} pFile
|
|
227
|
+
* @param {number} flags
|
|
228
|
+
* @param {number} pOutFlags
|
|
229
|
+
* @returns {number|Promise<number>}
|
|
230
|
+
*/
|
|
231
|
+
xOpen(pVfs, zName, pFile, flags, pOutFlags) {
|
|
232
|
+
const filename = this.#decodeFilename(zName, flags);
|
|
233
|
+
const pOutFlagsView = this.#makeTypedDataView('Int32', pOutFlags);
|
|
234
|
+
this['log']?.('jOpen', filename, pFile, '0x' + flags.toString(16));
|
|
235
|
+
return this.jOpen(filename, pFile, flags, pOutFlagsView);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* @param {number} pVfs
|
|
240
|
+
* @param {number} nByte
|
|
241
|
+
* @param {number} pCharOut
|
|
242
|
+
* @returns {number|Promise<number>}
|
|
243
|
+
*/
|
|
244
|
+
xRandomness(pVfs, nByte, pCharOut) {
|
|
245
|
+
const randomArray = new Uint8Array(nByte);
|
|
246
|
+
crypto.getRandomValues(randomArray);
|
|
247
|
+
// Copy randomArray to the WebAssembly memory
|
|
248
|
+
const buffer = pCharOut; // Pointer to memory in WebAssembly
|
|
249
|
+
this._module.HEAPU8.set(randomArray, buffer); // Copy randomArray into memory starting at buffer
|
|
250
|
+
return nByte;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Gets the current time as milliseconds since Unix epoch
|
|
255
|
+
* @param {number} pVfs pointer to the VFS
|
|
256
|
+
* @param {number} pTime pointer to write the time value
|
|
257
|
+
* @returns {number} SQLite error code
|
|
258
|
+
*/
|
|
259
|
+
xCurrentTimeInt64(pVfs, pTime) {
|
|
260
|
+
// Create a DataView to write the current time
|
|
261
|
+
const timeView = this.#makeTypedDataView('BigInt64', pTime);
|
|
262
|
+
|
|
263
|
+
const currentTime = BigInt(Date.now());
|
|
264
|
+
// Convert the current time to milliseconds since Unix epoch
|
|
265
|
+
const value = UNIX_EPOCH + currentTime;
|
|
266
|
+
|
|
267
|
+
// Write the time value to the pointer location
|
|
268
|
+
timeView.setBigInt64(0, value, true);
|
|
269
|
+
|
|
270
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* @param {number} pVfs
|
|
275
|
+
* @param {number} zName
|
|
276
|
+
* @param {number} syncDir
|
|
277
|
+
* @returns {number|Promise<number>}
|
|
278
|
+
*/
|
|
279
|
+
xDelete(pVfs, zName, syncDir) {
|
|
280
|
+
const filename = this._module.UTF8ToString(zName);
|
|
281
|
+
this['log']?.('jDelete', filename, syncDir);
|
|
282
|
+
return this.jDelete(filename, syncDir);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* @param {number} pVfs
|
|
287
|
+
* @param {number} zName
|
|
288
|
+
* @param {number} flags
|
|
289
|
+
* @param {number} pResOut
|
|
290
|
+
* @returns {number|Promise<number>}
|
|
291
|
+
*/
|
|
292
|
+
xAccess(pVfs, zName, flags, pResOut) {
|
|
293
|
+
const filename = this._module.UTF8ToString(zName);
|
|
294
|
+
const pResOutView = this.#makeTypedDataView('Int32', pResOut);
|
|
295
|
+
this['log']?.('jAccess', filename, flags);
|
|
296
|
+
return this.jAccess(filename, flags, pResOutView);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* @param {number} pVfs
|
|
301
|
+
* @param {number} zName
|
|
302
|
+
* @param {number} nOut
|
|
303
|
+
* @param {number} zOut
|
|
304
|
+
* @returns {number|Promise<number>}
|
|
305
|
+
*/
|
|
306
|
+
xFullPathname(pVfs, zName, nOut, zOut) {
|
|
307
|
+
const filename = this._module.UTF8ToString(zName);
|
|
308
|
+
const zOutArray = this._module.HEAPU8.subarray(zOut, zOut + nOut);
|
|
309
|
+
this['log']?.('jFullPathname', filename, nOut);
|
|
310
|
+
return this.jFullPathname(filename, zOutArray);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* @param {number} pVfs
|
|
315
|
+
* @param {number} nBuf
|
|
316
|
+
* @param {number} zBuf
|
|
317
|
+
* @returns {number|Promise<number>}
|
|
318
|
+
*/
|
|
319
|
+
xGetLastError(pVfs, nBuf, zBuf) {
|
|
320
|
+
const zBufArray = this._module.HEAPU8.subarray(zBuf, zBuf + nBuf);
|
|
321
|
+
this['log']?.('jGetLastError', nBuf);
|
|
322
|
+
return this.jGetLastError(zBufArray);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* @param {number} pFile
|
|
327
|
+
* @returns {number|Promise<number>}
|
|
328
|
+
*/
|
|
329
|
+
xClose(pFile) {
|
|
330
|
+
this['log']?.('jClose', pFile);
|
|
331
|
+
return this.jClose(pFile);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* @param {number} pFile
|
|
336
|
+
* @param {number} pData
|
|
337
|
+
* @param {number} iAmt
|
|
338
|
+
* @param {number} iOffsetLo
|
|
339
|
+
* @param {number} iOffsetHi
|
|
340
|
+
* @returns {number|Promise<number>}
|
|
341
|
+
*/
|
|
342
|
+
xRead(pFile, pData, iAmt, iOffsetLo, iOffsetHi) {
|
|
343
|
+
const pDataArray = this.#makeDataArray(pData, iAmt);
|
|
344
|
+
const iOffset = delegalize(iOffsetLo, iOffsetHi);
|
|
345
|
+
this['log']?.('jRead', pFile, iAmt, iOffset);
|
|
346
|
+
return this.jRead(pFile, pDataArray, iOffset);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* @param {number} pFile
|
|
351
|
+
* @param {number} pData
|
|
352
|
+
* @param {number} iAmt
|
|
353
|
+
* @param {number} iOffsetLo
|
|
354
|
+
* @param {number} iOffsetHi
|
|
355
|
+
* @returns {number|Promise<number>}
|
|
356
|
+
*/
|
|
357
|
+
xWrite(pFile, pData, iAmt, iOffsetLo, iOffsetHi) {
|
|
358
|
+
const pDataArray = this.#makeDataArray(pData, iAmt);
|
|
359
|
+
const iOffset = delegalize(iOffsetLo, iOffsetHi);
|
|
360
|
+
this['log']?.('jWrite', pFile, pDataArray, iOffset);
|
|
361
|
+
return this.jWrite(pFile, pDataArray, iOffset);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* @param {number} pFile
|
|
366
|
+
* @param {number} sizeLo
|
|
367
|
+
* @param {number} sizeHi
|
|
368
|
+
* @returns {number|Promise<number>}
|
|
369
|
+
*/
|
|
370
|
+
xTruncate(pFile, sizeLo, sizeHi) {
|
|
371
|
+
const size = delegalize(sizeLo, sizeHi);
|
|
372
|
+
this['log']?.('jTruncate', pFile, size);
|
|
373
|
+
return this.jTruncate(pFile, size);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* @param {number} pFile
|
|
378
|
+
* @param {number} flags
|
|
379
|
+
* @returns {number|Promise<number>}
|
|
380
|
+
*/
|
|
381
|
+
xSync(pFile, flags) {
|
|
382
|
+
this['log']?.('jSync', pFile, flags);
|
|
383
|
+
return this.jSync(pFile, flags);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
*
|
|
388
|
+
* @param {number} pFile
|
|
389
|
+
* @param {number} pSize
|
|
390
|
+
* @returns {number|Promise<number>}
|
|
391
|
+
*/
|
|
392
|
+
xFileSize(pFile, pSize) {
|
|
393
|
+
const pSizeView = this.#makeTypedDataView('BigInt64', pSize);
|
|
394
|
+
this['log']?.('jFileSize', pFile);
|
|
395
|
+
return this.jFileSize(pFile, pSizeView);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* @param {number} pFile
|
|
400
|
+
* @param {number} lockType
|
|
401
|
+
* @returns {number|Promise<number>}
|
|
402
|
+
*/
|
|
403
|
+
xLock(pFile, lockType) {
|
|
404
|
+
this['log']?.('jLock', pFile, lockType);
|
|
405
|
+
return this.jLock(pFile, lockType);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* @param {number} pFile
|
|
410
|
+
* @param {number} lockType
|
|
411
|
+
* @returns {number|Promise<number>}
|
|
412
|
+
*/
|
|
413
|
+
xUnlock(pFile, lockType) {
|
|
414
|
+
this['log']?.('jUnlock', pFile, lockType);
|
|
415
|
+
return this.jUnlock(pFile, lockType);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* @param {number} pFile
|
|
420
|
+
* @param {number} pResOut
|
|
421
|
+
* @returns {number|Promise<number>}
|
|
422
|
+
*/
|
|
423
|
+
xCheckReservedLock(pFile, pResOut) {
|
|
424
|
+
const pResOutView = this.#makeTypedDataView('Int32', pResOut);
|
|
425
|
+
this['log']?.('jCheckReservedLock', pFile);
|
|
426
|
+
return this.jCheckReservedLock(pFile, pResOutView);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* @param {number} pFile
|
|
431
|
+
* @param {number} op
|
|
432
|
+
* @param {number} pArg
|
|
433
|
+
* @returns {number|Promise<number>}
|
|
434
|
+
*/
|
|
435
|
+
xFileControl(pFile, op, pArg) {
|
|
436
|
+
const pArgView = new DataView(
|
|
437
|
+
this._module.HEAPU8.buffer,
|
|
438
|
+
this._module.HEAPU8.byteOffset + pArg);
|
|
439
|
+
this['log']?.('jFileControl', pFile, op, pArgView);
|
|
440
|
+
return this.jFileControl(pFile, op, pArgView);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* @param {number} pFile
|
|
445
|
+
* @returns {number|Promise<number>}
|
|
446
|
+
*/
|
|
447
|
+
xSectorSize(pFile) {
|
|
448
|
+
this['log']?.('jSectorSize', pFile);
|
|
449
|
+
return this.jSectorSize(pFile);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* @param {number} pFile
|
|
454
|
+
* @returns {number|Promise<number>}
|
|
455
|
+
*/
|
|
456
|
+
xDeviceCharacteristics(pFile) {
|
|
457
|
+
this['log']?.('jDeviceCharacteristics', pFile);
|
|
458
|
+
return this.jDeviceCharacteristics(pFile);
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Wrapped DataView for pointer arguments.
|
|
463
|
+
* Pointers to a single value are passed using a DataView-like class.
|
|
464
|
+
* This wrapper class prevents use of incorrect type or endianness, and
|
|
465
|
+
* reacquires the underlying buffer when the WebAssembly memory is resized.
|
|
466
|
+
* @param {'Int32'|'BigInt64'} type
|
|
467
|
+
* @param {number} byteOffset
|
|
468
|
+
* @returns {DataView}
|
|
469
|
+
*/
|
|
470
|
+
#makeTypedDataView(type, byteOffset) {
|
|
471
|
+
// @ts-ignore
|
|
472
|
+
return new DataViewProxy(this._module, byteOffset, type);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* Wrapped Uint8Array for buffer arguments.
|
|
477
|
+
* Memory blocks are passed as a Uint8Array-like class. This wrapper
|
|
478
|
+
* class reacquires the underlying buffer when the WebAssembly memory
|
|
479
|
+
* is resized.
|
|
480
|
+
* @param {number} byteOffset
|
|
481
|
+
* @param {number} byteLength
|
|
482
|
+
* @returns {Uint8Array}
|
|
483
|
+
*/
|
|
484
|
+
#makeDataArray(byteOffset, byteLength) {
|
|
485
|
+
// @ts-ignore
|
|
486
|
+
return new Uint8ArrayProxy(this._module, byteOffset, byteLength);
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
#decodeFilename(zName, flags) {
|
|
490
|
+
if (flags & _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_URI) {
|
|
491
|
+
// The first null-terminated string is the URI path. Subsequent
|
|
492
|
+
// strings are query parameter keys and values.
|
|
493
|
+
// https://www.sqlite.org/c3ref/open.html#urifilenamesinsqlite3open
|
|
494
|
+
let pName = zName;
|
|
495
|
+
let state = 1;
|
|
496
|
+
const charCodes = [];
|
|
497
|
+
while (state) {
|
|
498
|
+
const charCode = this._module.HEAPU8[pName++];
|
|
499
|
+
if (charCode) {
|
|
500
|
+
charCodes.push(charCode);
|
|
501
|
+
} else {
|
|
502
|
+
if (!this._module.HEAPU8[pName]) state = null;
|
|
503
|
+
switch (state) {
|
|
504
|
+
case 1: // path
|
|
505
|
+
charCodes.push('?'.charCodeAt(0));
|
|
506
|
+
state = 2;
|
|
507
|
+
break;
|
|
508
|
+
case 2: // key
|
|
509
|
+
charCodes.push('='.charCodeAt(0));
|
|
510
|
+
state = 3;
|
|
511
|
+
break;
|
|
512
|
+
case 3: // value
|
|
513
|
+
charCodes.push('&'.charCodeAt(0));
|
|
514
|
+
state = 2;
|
|
515
|
+
break;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
return new TextDecoder().decode(new Uint8Array(charCodes));
|
|
520
|
+
}
|
|
521
|
+
return zName ? this._module.UTF8ToString(zName) : null;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
// Emscripten "legalizes" 64-bit integer arguments by passing them as
|
|
526
|
+
// two 32-bit signed integers.
|
|
527
|
+
function delegalize(lo32, hi32) {
|
|
528
|
+
return (hi32 * 0x100000000) + lo32 + (lo32 < 0 ? 2**32 : 0);
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// This class provides a Uint8Array-like interface for a WebAssembly memory
|
|
532
|
+
// buffer. It is used to access memory blocks passed as arguments to
|
|
533
|
+
// xRead, xWrite, etc. The class reacquires the underlying buffer when the
|
|
534
|
+
// WebAssembly memory is resized, which can happen when the memory is
|
|
535
|
+
// detached and resized by the WebAssembly module.
|
|
536
|
+
//
|
|
537
|
+
// Note that although this class implements the same methods as Uint8Array,
|
|
538
|
+
// it is not a real Uint8Array and passing it to functions that expect
|
|
539
|
+
// a Uint8Array may not work. Use subarray() to get a real Uint8Array
|
|
540
|
+
// if needed.
|
|
541
|
+
class Uint8ArrayProxy {
|
|
542
|
+
#module;
|
|
543
|
+
|
|
544
|
+
#_array = new Uint8Array()
|
|
545
|
+
get #array() {
|
|
546
|
+
if (this.#_array.buffer.byteLength === 0) {
|
|
547
|
+
// WebAssembly memory resize detached the buffer so re-create the
|
|
548
|
+
// array with the new buffer.
|
|
549
|
+
this.#_array = this.#module.HEAPU8.subarray(
|
|
550
|
+
this.byteOffset,
|
|
551
|
+
this.byteOffset + this.byteLength);
|
|
552
|
+
}
|
|
553
|
+
return this.#_array;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* @param {*} module
|
|
558
|
+
* @param {number} byteOffset
|
|
559
|
+
* @param {number} byteLength
|
|
560
|
+
*/
|
|
561
|
+
constructor(module, byteOffset, byteLength) {
|
|
562
|
+
this.#module = module;
|
|
563
|
+
this.byteOffset = byteOffset;
|
|
564
|
+
this.length = this.byteLength = byteLength;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
get buffer() {
|
|
568
|
+
return this.#array.buffer;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
at(index) {
|
|
572
|
+
return this.#array.at(index);
|
|
573
|
+
}
|
|
574
|
+
copyWithin(target, start, end) {
|
|
575
|
+
this.#array.copyWithin(target, start, end);
|
|
576
|
+
}
|
|
577
|
+
entries() {
|
|
578
|
+
return this.#array.entries();
|
|
579
|
+
}
|
|
580
|
+
every(predicate) {
|
|
581
|
+
return this.#array.every(predicate);
|
|
582
|
+
}
|
|
583
|
+
fill(value, start, end) {
|
|
584
|
+
this.#array.fill(value, start, end);
|
|
585
|
+
}
|
|
586
|
+
filter(predicate) {
|
|
587
|
+
return this.#array.filter(predicate);
|
|
588
|
+
}
|
|
589
|
+
find(predicate) {
|
|
590
|
+
return this.#array.find(predicate);
|
|
591
|
+
}
|
|
592
|
+
findIndex(predicate) {
|
|
593
|
+
return this.#array.findIndex(predicate);
|
|
594
|
+
}
|
|
595
|
+
findLast(predicate) {
|
|
596
|
+
return this.#array.findLast(predicate);
|
|
597
|
+
}
|
|
598
|
+
findLastIndex(predicate) {
|
|
599
|
+
return this.#array.findLastIndex(predicate);
|
|
600
|
+
}
|
|
601
|
+
forEach(callback) {
|
|
602
|
+
this.#array.forEach(callback);
|
|
603
|
+
}
|
|
604
|
+
includes(value, start) {
|
|
605
|
+
return this.#array.includes(value, start);
|
|
606
|
+
}
|
|
607
|
+
indexOf(value, start) {
|
|
608
|
+
return this.#array.indexOf(value, start);
|
|
609
|
+
}
|
|
610
|
+
join(separator) {
|
|
611
|
+
return this.#array.join(separator);
|
|
612
|
+
}
|
|
613
|
+
keys() {
|
|
614
|
+
return this.#array.keys();
|
|
615
|
+
}
|
|
616
|
+
lastIndexOf(value, start) {
|
|
617
|
+
return this.#array.lastIndexOf(value, start);
|
|
618
|
+
}
|
|
619
|
+
map(callback) {
|
|
620
|
+
return this.#array.map(callback);
|
|
621
|
+
}
|
|
622
|
+
reduce(callback, initialValue) {
|
|
623
|
+
return this.#array.reduce(callback, initialValue);
|
|
624
|
+
}
|
|
625
|
+
reduceRight(callback, initialValue) {
|
|
626
|
+
return this.#array.reduceRight(callback, initialValue);
|
|
627
|
+
}
|
|
628
|
+
reverse() {
|
|
629
|
+
this.#array.reverse();
|
|
630
|
+
}
|
|
631
|
+
set(array, offset) {
|
|
632
|
+
this.#array.set(array, offset);
|
|
633
|
+
}
|
|
634
|
+
slice(start, end) {
|
|
635
|
+
return this.#array.slice(start, end);
|
|
636
|
+
}
|
|
637
|
+
some(predicate) {
|
|
638
|
+
return this.#array.some(predicate);
|
|
639
|
+
}
|
|
640
|
+
sort(compareFn) {
|
|
641
|
+
this.#array.sort(compareFn);
|
|
642
|
+
}
|
|
643
|
+
subarray(begin, end) {
|
|
644
|
+
return this.#array.subarray(begin, end);
|
|
645
|
+
}
|
|
646
|
+
toLocaleString(locales, options) {
|
|
647
|
+
// @ts-ignore
|
|
648
|
+
return this.#array.toLocaleString(locales, options);
|
|
649
|
+
}
|
|
650
|
+
toReversed() {
|
|
651
|
+
return this.#array.toReversed();
|
|
652
|
+
}
|
|
653
|
+
toSorted(compareFn) {
|
|
654
|
+
return this.#array.toSorted(compareFn);
|
|
655
|
+
}
|
|
656
|
+
toString() {
|
|
657
|
+
return this.#array.toString();
|
|
658
|
+
}
|
|
659
|
+
values() {
|
|
660
|
+
return this.#array.values();
|
|
661
|
+
}
|
|
662
|
+
with(index, value) {
|
|
663
|
+
return this.#array.with(index, value);
|
|
664
|
+
}
|
|
665
|
+
[Symbol.iterator]() {
|
|
666
|
+
return this.#array[Symbol.iterator]();
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
// This class provides a DataView-like interface for a WebAssembly memory
|
|
671
|
+
// buffer, restricted to either Int32 or BigInt64 types. It also reacquires
|
|
672
|
+
// the underlying buffer when the WebAssembly memory is resized, which can
|
|
673
|
+
// happen when the memory is detached and resized by the WebAssembly module.
|
|
674
|
+
class DataViewProxy {
|
|
675
|
+
#module;
|
|
676
|
+
#type;
|
|
677
|
+
|
|
678
|
+
#_view = new DataView(new ArrayBuffer(0));
|
|
679
|
+
get #view() {
|
|
680
|
+
if (this.#_view.buffer.byteLength === 0) {
|
|
681
|
+
// WebAssembly memory resize detached the buffer so re-create the
|
|
682
|
+
// view with the new buffer.
|
|
683
|
+
this.#_view = new DataView(
|
|
684
|
+
this.#module.HEAPU8.buffer,
|
|
685
|
+
this.#module.HEAPU8.byteOffset + this.byteOffset);
|
|
686
|
+
}
|
|
687
|
+
return this.#_view;
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* @param {*} module
|
|
692
|
+
* @param {number} byteOffset
|
|
693
|
+
* @param {'Int32'|'BigInt64'} type
|
|
694
|
+
*/
|
|
695
|
+
constructor(module, byteOffset, type) {
|
|
696
|
+
this.#module = module;
|
|
697
|
+
this.byteOffset = byteOffset;
|
|
698
|
+
this.#type = type;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
get buffer() {
|
|
702
|
+
return this.#view.buffer;
|
|
703
|
+
}
|
|
704
|
+
get byteLength() {
|
|
705
|
+
return this.#type === 'Int32' ? 4 : 8;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
getInt32(byteOffset, littleEndian) {
|
|
709
|
+
if (this.#type !== 'Int32') {
|
|
710
|
+
throw new Error('invalid type');
|
|
711
|
+
}
|
|
712
|
+
if (!littleEndian) throw new Error('must be little endian');
|
|
713
|
+
return this.#view.getInt32(byteOffset, littleEndian);
|
|
714
|
+
}
|
|
715
|
+
setInt32(byteOffset, value, littleEndian) {
|
|
716
|
+
if (this.#type !== 'Int32') {
|
|
717
|
+
throw new Error('invalid type');
|
|
718
|
+
}
|
|
719
|
+
if (!littleEndian) throw new Error('must be little endian');
|
|
720
|
+
this.#view.setInt32(byteOffset, value, littleEndian);
|
|
721
|
+
}
|
|
722
|
+
getBigInt64(byteOffset, littleEndian) {
|
|
723
|
+
if (this.#type !== 'BigInt64') {
|
|
724
|
+
throw new Error('invalid type');
|
|
725
|
+
}
|
|
726
|
+
if (!littleEndian) throw new Error('must be little endian');
|
|
727
|
+
return this.#view.getBigInt64(byteOffset, littleEndian);
|
|
728
|
+
}
|
|
729
|
+
setBigInt64(byteOffset, value, littleEndian) {
|
|
730
|
+
if (this.#type !== 'BigInt64') {
|
|
731
|
+
throw new Error('invalid type');
|
|
732
|
+
}
|
|
733
|
+
if (!littleEndian) throw new Error('must be little endian');
|
|
734
|
+
this.#view.setBigInt64(byteOffset, value, littleEndian);
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
/***/ }),
|
|
739
|
+
|
|
740
|
+
/***/ "../../node_modules/@journeyapps/wa-sqlite/src/VFS.js":
|
|
741
|
+
/*!************************************************************!*\
|
|
742
|
+
!*** ../../node_modules/@journeyapps/wa-sqlite/src/VFS.js ***!
|
|
743
|
+
\************************************************************/
|
|
744
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
745
|
+
|
|
746
|
+
__webpack_require__.r(__webpack_exports__);
|
|
747
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
748
|
+
/* harmony export */ Base: () => (/* binding */ Base),
|
|
749
|
+
/* harmony export */ FILE_TYPE_MASK: () => (/* binding */ FILE_TYPE_MASK),
|
|
750
|
+
/* harmony export */ SQLITE_ABORT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ABORT),
|
|
751
|
+
/* harmony export */ SQLITE_ACCESS_EXISTS: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ACCESS_EXISTS),
|
|
752
|
+
/* harmony export */ SQLITE_ACCESS_READ: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ACCESS_READ),
|
|
753
|
+
/* harmony export */ SQLITE_ACCESS_READWRITE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ACCESS_READWRITE),
|
|
754
|
+
/* harmony export */ SQLITE_ALTER_TABLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ALTER_TABLE),
|
|
755
|
+
/* harmony export */ SQLITE_ANALYZE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ANALYZE),
|
|
756
|
+
/* harmony export */ SQLITE_ATTACH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ATTACH),
|
|
757
|
+
/* harmony export */ SQLITE_AUTH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_AUTH),
|
|
758
|
+
/* harmony export */ SQLITE_BLOB: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_BLOB),
|
|
759
|
+
/* harmony export */ SQLITE_BUSY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_BUSY),
|
|
760
|
+
/* harmony export */ SQLITE_CANTOPEN: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CANTOPEN),
|
|
761
|
+
/* harmony export */ SQLITE_CONSTRAINT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT),
|
|
762
|
+
/* harmony export */ SQLITE_CONSTRAINT_CHECK: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_CHECK),
|
|
763
|
+
/* harmony export */ SQLITE_CONSTRAINT_COMMITHOOK: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_COMMITHOOK),
|
|
764
|
+
/* harmony export */ SQLITE_CONSTRAINT_FOREIGNKEY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_FOREIGNKEY),
|
|
765
|
+
/* harmony export */ SQLITE_CONSTRAINT_FUNCTION: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_FUNCTION),
|
|
766
|
+
/* harmony export */ SQLITE_CONSTRAINT_NOTNULL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_NOTNULL),
|
|
767
|
+
/* harmony export */ SQLITE_CONSTRAINT_PINNED: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_PINNED),
|
|
768
|
+
/* harmony export */ SQLITE_CONSTRAINT_PRIMARYKEY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_PRIMARYKEY),
|
|
769
|
+
/* harmony export */ SQLITE_CONSTRAINT_ROWID: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_ROWID),
|
|
770
|
+
/* harmony export */ SQLITE_CONSTRAINT_TRIGGER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_TRIGGER),
|
|
771
|
+
/* harmony export */ SQLITE_CONSTRAINT_UNIQUE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_UNIQUE),
|
|
772
|
+
/* harmony export */ SQLITE_CONSTRAINT_VTAB: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_VTAB),
|
|
773
|
+
/* harmony export */ SQLITE_COPY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_COPY),
|
|
774
|
+
/* harmony export */ SQLITE_CORRUPT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CORRUPT),
|
|
775
|
+
/* harmony export */ SQLITE_CREATE_INDEX: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CREATE_INDEX),
|
|
776
|
+
/* harmony export */ SQLITE_CREATE_TABLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CREATE_TABLE),
|
|
777
|
+
/* harmony export */ SQLITE_CREATE_TEMP_INDEX: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CREATE_TEMP_INDEX),
|
|
778
|
+
/* harmony export */ SQLITE_CREATE_TEMP_TABLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CREATE_TEMP_TABLE),
|
|
779
|
+
/* harmony export */ SQLITE_CREATE_TEMP_TRIGGER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CREATE_TEMP_TRIGGER),
|
|
780
|
+
/* harmony export */ SQLITE_CREATE_TEMP_VIEW: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CREATE_TEMP_VIEW),
|
|
781
|
+
/* harmony export */ SQLITE_CREATE_TRIGGER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CREATE_TRIGGER),
|
|
782
|
+
/* harmony export */ SQLITE_CREATE_VIEW: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CREATE_VIEW),
|
|
783
|
+
/* harmony export */ SQLITE_CREATE_VTABLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CREATE_VTABLE),
|
|
784
|
+
/* harmony export */ SQLITE_DELETE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DELETE),
|
|
785
|
+
/* harmony export */ SQLITE_DENY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DENY),
|
|
786
|
+
/* harmony export */ SQLITE_DETACH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DETACH),
|
|
787
|
+
/* harmony export */ SQLITE_DETERMINISTIC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DETERMINISTIC),
|
|
788
|
+
/* harmony export */ SQLITE_DIRECTONLY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DIRECTONLY),
|
|
789
|
+
/* harmony export */ SQLITE_DONE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DONE),
|
|
790
|
+
/* harmony export */ SQLITE_DROP_INDEX: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DROP_INDEX),
|
|
791
|
+
/* harmony export */ SQLITE_DROP_TABLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DROP_TABLE),
|
|
792
|
+
/* harmony export */ SQLITE_DROP_TEMP_INDEX: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DROP_TEMP_INDEX),
|
|
793
|
+
/* harmony export */ SQLITE_DROP_TEMP_TABLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DROP_TEMP_TABLE),
|
|
794
|
+
/* harmony export */ SQLITE_DROP_TEMP_TRIGGER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DROP_TEMP_TRIGGER),
|
|
795
|
+
/* harmony export */ SQLITE_DROP_TEMP_VIEW: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DROP_TEMP_VIEW),
|
|
796
|
+
/* harmony export */ SQLITE_DROP_TRIGGER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DROP_TRIGGER),
|
|
797
|
+
/* harmony export */ SQLITE_DROP_VIEW: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DROP_VIEW),
|
|
798
|
+
/* harmony export */ SQLITE_DROP_VTABLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DROP_VTABLE),
|
|
799
|
+
/* harmony export */ SQLITE_EMPTY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_EMPTY),
|
|
800
|
+
/* harmony export */ SQLITE_ERROR: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ERROR),
|
|
801
|
+
/* harmony export */ SQLITE_FCNTL_BEGIN_ATOMIC_WRITE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_BEGIN_ATOMIC_WRITE),
|
|
802
|
+
/* harmony export */ SQLITE_FCNTL_BUSYHANDLER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_BUSYHANDLER),
|
|
803
|
+
/* harmony export */ SQLITE_FCNTL_CHUNK_SIZE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_CHUNK_SIZE),
|
|
804
|
+
/* harmony export */ SQLITE_FCNTL_CKPT_DONE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_CKPT_DONE),
|
|
805
|
+
/* harmony export */ SQLITE_FCNTL_CKPT_START: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_CKPT_START),
|
|
806
|
+
/* harmony export */ SQLITE_FCNTL_COMMIT_ATOMIC_WRITE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_COMMIT_ATOMIC_WRITE),
|
|
807
|
+
/* harmony export */ SQLITE_FCNTL_COMMIT_PHASETWO: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_COMMIT_PHASETWO),
|
|
808
|
+
/* harmony export */ SQLITE_FCNTL_DATA_VERSION: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_DATA_VERSION),
|
|
809
|
+
/* harmony export */ SQLITE_FCNTL_FILE_POINTER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_FILE_POINTER),
|
|
810
|
+
/* harmony export */ SQLITE_FCNTL_GET_LOCKPROXYFILE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_GET_LOCKPROXYFILE),
|
|
811
|
+
/* harmony export */ SQLITE_FCNTL_HAS_MOVED: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_HAS_MOVED),
|
|
812
|
+
/* harmony export */ SQLITE_FCNTL_JOURNAL_POINTER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_JOURNAL_POINTER),
|
|
813
|
+
/* harmony export */ SQLITE_FCNTL_LAST_ERRNO: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_LAST_ERRNO),
|
|
814
|
+
/* harmony export */ SQLITE_FCNTL_LOCKSTATE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_LOCKSTATE),
|
|
815
|
+
/* harmony export */ SQLITE_FCNTL_LOCK_TIMEOUT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_LOCK_TIMEOUT),
|
|
816
|
+
/* harmony export */ SQLITE_FCNTL_MMAP_SIZE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_MMAP_SIZE),
|
|
817
|
+
/* harmony export */ SQLITE_FCNTL_OVERWRITE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_OVERWRITE),
|
|
818
|
+
/* harmony export */ SQLITE_FCNTL_PDB: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_PDB),
|
|
819
|
+
/* harmony export */ SQLITE_FCNTL_PERSIST_WAL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_PERSIST_WAL),
|
|
820
|
+
/* harmony export */ SQLITE_FCNTL_POWERSAFE_OVERWRITE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_POWERSAFE_OVERWRITE),
|
|
821
|
+
/* harmony export */ SQLITE_FCNTL_PRAGMA: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_PRAGMA),
|
|
822
|
+
/* harmony export */ SQLITE_FCNTL_RBU: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_RBU),
|
|
823
|
+
/* harmony export */ SQLITE_FCNTL_RESERVE_BYTES: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_RESERVE_BYTES),
|
|
824
|
+
/* harmony export */ SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE),
|
|
825
|
+
/* harmony export */ SQLITE_FCNTL_SET_LOCKPROXYFILE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_SET_LOCKPROXYFILE),
|
|
826
|
+
/* harmony export */ SQLITE_FCNTL_SIZE_HINT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_SIZE_HINT),
|
|
827
|
+
/* harmony export */ SQLITE_FCNTL_SIZE_LIMIT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_SIZE_LIMIT),
|
|
828
|
+
/* harmony export */ SQLITE_FCNTL_SYNC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_SYNC),
|
|
829
|
+
/* harmony export */ SQLITE_FCNTL_SYNC_OMITTED: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_SYNC_OMITTED),
|
|
830
|
+
/* harmony export */ SQLITE_FCNTL_TEMPFILENAME: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_TEMPFILENAME),
|
|
831
|
+
/* harmony export */ SQLITE_FCNTL_TRACE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_TRACE),
|
|
832
|
+
/* harmony export */ SQLITE_FCNTL_VFSNAME: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_VFSNAME),
|
|
833
|
+
/* harmony export */ SQLITE_FCNTL_VFS_POINTER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_VFS_POINTER),
|
|
834
|
+
/* harmony export */ SQLITE_FCNTL_WAL_BLOCK: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_WAL_BLOCK),
|
|
835
|
+
/* harmony export */ SQLITE_FCNTL_WIN32_AV_RETRY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_WIN32_AV_RETRY),
|
|
836
|
+
/* harmony export */ SQLITE_FCNTL_WIN32_GET_HANDLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_WIN32_GET_HANDLE),
|
|
837
|
+
/* harmony export */ SQLITE_FCNTL_WIN32_SET_HANDLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_WIN32_SET_HANDLE),
|
|
838
|
+
/* harmony export */ SQLITE_FCNTL_ZIPVFS: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_ZIPVFS),
|
|
839
|
+
/* harmony export */ SQLITE_FLOAT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FLOAT),
|
|
840
|
+
/* harmony export */ SQLITE_FORMAT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FORMAT),
|
|
841
|
+
/* harmony export */ SQLITE_FULL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FULL),
|
|
842
|
+
/* harmony export */ SQLITE_FUNCTION: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FUNCTION),
|
|
843
|
+
/* harmony export */ SQLITE_IGNORE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IGNORE),
|
|
844
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_EQ: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_EQ),
|
|
845
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_FUNCTION: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_FUNCTION),
|
|
846
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_GE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_GE),
|
|
847
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_GLOB: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_GLOB),
|
|
848
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_GT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_GT),
|
|
849
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_IS: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_IS),
|
|
850
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_ISNOT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_ISNOT),
|
|
851
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_ISNOTNULL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_ISNOTNULL),
|
|
852
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_ISNULL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_ISNULL),
|
|
853
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_LE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_LE),
|
|
854
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_LIKE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_LIKE),
|
|
855
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_LT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_LT),
|
|
856
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_MATCH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_MATCH),
|
|
857
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_NE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_NE),
|
|
858
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_REGEXP: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_REGEXP),
|
|
859
|
+
/* harmony export */ SQLITE_INDEX_SCAN_UNIQUE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_SCAN_UNIQUE),
|
|
860
|
+
/* harmony export */ SQLITE_INNOCUOUS: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INNOCUOUS),
|
|
861
|
+
/* harmony export */ SQLITE_INSERT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INSERT),
|
|
862
|
+
/* harmony export */ SQLITE_INTEGER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INTEGER),
|
|
863
|
+
/* harmony export */ SQLITE_INTERNAL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INTERNAL),
|
|
864
|
+
/* harmony export */ SQLITE_INTERRUPT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INTERRUPT),
|
|
865
|
+
/* harmony export */ SQLITE_IOCAP_ATOMIC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_ATOMIC),
|
|
866
|
+
/* harmony export */ SQLITE_IOCAP_ATOMIC16K: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_ATOMIC16K),
|
|
867
|
+
/* harmony export */ SQLITE_IOCAP_ATOMIC1K: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_ATOMIC1K),
|
|
868
|
+
/* harmony export */ SQLITE_IOCAP_ATOMIC2K: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_ATOMIC2K),
|
|
869
|
+
/* harmony export */ SQLITE_IOCAP_ATOMIC32K: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_ATOMIC32K),
|
|
870
|
+
/* harmony export */ SQLITE_IOCAP_ATOMIC4K: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_ATOMIC4K),
|
|
871
|
+
/* harmony export */ SQLITE_IOCAP_ATOMIC512: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_ATOMIC512),
|
|
872
|
+
/* harmony export */ SQLITE_IOCAP_ATOMIC64K: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_ATOMIC64K),
|
|
873
|
+
/* harmony export */ SQLITE_IOCAP_ATOMIC8K: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_ATOMIC8K),
|
|
874
|
+
/* harmony export */ SQLITE_IOCAP_BATCH_ATOMIC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_BATCH_ATOMIC),
|
|
875
|
+
/* harmony export */ SQLITE_IOCAP_IMMUTABLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_IMMUTABLE),
|
|
876
|
+
/* harmony export */ SQLITE_IOCAP_POWERSAFE_OVERWRITE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_POWERSAFE_OVERWRITE),
|
|
877
|
+
/* harmony export */ SQLITE_IOCAP_SAFE_APPEND: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_SAFE_APPEND),
|
|
878
|
+
/* harmony export */ SQLITE_IOCAP_SEQUENTIAL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_SEQUENTIAL),
|
|
879
|
+
/* harmony export */ SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN),
|
|
880
|
+
/* harmony export */ SQLITE_IOERR: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR),
|
|
881
|
+
/* harmony export */ SQLITE_IOERR_ACCESS: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_ACCESS),
|
|
882
|
+
/* harmony export */ SQLITE_IOERR_BEGIN_ATOMIC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_BEGIN_ATOMIC),
|
|
883
|
+
/* harmony export */ SQLITE_IOERR_CHECKRESERVEDLOCK: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_CHECKRESERVEDLOCK),
|
|
884
|
+
/* harmony export */ SQLITE_IOERR_CLOSE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_CLOSE),
|
|
885
|
+
/* harmony export */ SQLITE_IOERR_COMMIT_ATOMIC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_COMMIT_ATOMIC),
|
|
886
|
+
/* harmony export */ SQLITE_IOERR_DATA: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_DATA),
|
|
887
|
+
/* harmony export */ SQLITE_IOERR_DELETE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_DELETE),
|
|
888
|
+
/* harmony export */ SQLITE_IOERR_DELETE_NOENT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_DELETE_NOENT),
|
|
889
|
+
/* harmony export */ SQLITE_IOERR_DIR_FSYNC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_DIR_FSYNC),
|
|
890
|
+
/* harmony export */ SQLITE_IOERR_FSTAT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_FSTAT),
|
|
891
|
+
/* harmony export */ SQLITE_IOERR_FSYNC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_FSYNC),
|
|
892
|
+
/* harmony export */ SQLITE_IOERR_GETTEMPPATH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_GETTEMPPATH),
|
|
893
|
+
/* harmony export */ SQLITE_IOERR_LOCK: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_LOCK),
|
|
894
|
+
/* harmony export */ SQLITE_IOERR_NOMEM: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_NOMEM),
|
|
895
|
+
/* harmony export */ SQLITE_IOERR_RDLOCK: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_RDLOCK),
|
|
896
|
+
/* harmony export */ SQLITE_IOERR_READ: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_READ),
|
|
897
|
+
/* harmony export */ SQLITE_IOERR_ROLLBACK_ATOMIC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_ROLLBACK_ATOMIC),
|
|
898
|
+
/* harmony export */ SQLITE_IOERR_SEEK: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_SEEK),
|
|
899
|
+
/* harmony export */ SQLITE_IOERR_SHORT_READ: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_SHORT_READ),
|
|
900
|
+
/* harmony export */ SQLITE_IOERR_TRUNCATE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_TRUNCATE),
|
|
901
|
+
/* harmony export */ SQLITE_IOERR_UNLOCK: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_UNLOCK),
|
|
902
|
+
/* harmony export */ SQLITE_IOERR_VNODE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_VNODE),
|
|
903
|
+
/* harmony export */ SQLITE_IOERR_WRITE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_WRITE),
|
|
904
|
+
/* harmony export */ SQLITE_LIMIT_ATTACHED: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_ATTACHED),
|
|
905
|
+
/* harmony export */ SQLITE_LIMIT_COLUMN: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_COLUMN),
|
|
906
|
+
/* harmony export */ SQLITE_LIMIT_COMPOUND_SELECT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_COMPOUND_SELECT),
|
|
907
|
+
/* harmony export */ SQLITE_LIMIT_EXPR_DEPTH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_EXPR_DEPTH),
|
|
908
|
+
/* harmony export */ SQLITE_LIMIT_FUNCTION_ARG: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_FUNCTION_ARG),
|
|
909
|
+
/* harmony export */ SQLITE_LIMIT_LENGTH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_LENGTH),
|
|
910
|
+
/* harmony export */ SQLITE_LIMIT_LIKE_PATTERN_LENGTH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_LIKE_PATTERN_LENGTH),
|
|
911
|
+
/* harmony export */ SQLITE_LIMIT_SQL_LENGTH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_SQL_LENGTH),
|
|
912
|
+
/* harmony export */ SQLITE_LIMIT_TRIGGER_DEPTH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_TRIGGER_DEPTH),
|
|
913
|
+
/* harmony export */ SQLITE_LIMIT_VARIABLE_NUMBER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_VARIABLE_NUMBER),
|
|
914
|
+
/* harmony export */ SQLITE_LIMIT_VDBE_OP: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_VDBE_OP),
|
|
915
|
+
/* harmony export */ SQLITE_LIMIT_WORKER_THREADS: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_WORKER_THREADS),
|
|
916
|
+
/* harmony export */ SQLITE_LOCKED: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LOCKED),
|
|
917
|
+
/* harmony export */ SQLITE_LOCK_EXCLUSIVE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LOCK_EXCLUSIVE),
|
|
918
|
+
/* harmony export */ SQLITE_LOCK_NONE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LOCK_NONE),
|
|
919
|
+
/* harmony export */ SQLITE_LOCK_PENDING: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LOCK_PENDING),
|
|
920
|
+
/* harmony export */ SQLITE_LOCK_RESERVED: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LOCK_RESERVED),
|
|
921
|
+
/* harmony export */ SQLITE_LOCK_SHARED: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LOCK_SHARED),
|
|
922
|
+
/* harmony export */ SQLITE_MISMATCH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_MISMATCH),
|
|
923
|
+
/* harmony export */ SQLITE_MISUSE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_MISUSE),
|
|
924
|
+
/* harmony export */ SQLITE_NOLFS: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_NOLFS),
|
|
925
|
+
/* harmony export */ SQLITE_NOMEM: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_NOMEM),
|
|
926
|
+
/* harmony export */ SQLITE_NOTADB: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_NOTADB),
|
|
927
|
+
/* harmony export */ SQLITE_NOTFOUND: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_NOTFOUND),
|
|
928
|
+
/* harmony export */ SQLITE_NOTICE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_NOTICE),
|
|
929
|
+
/* harmony export */ SQLITE_NULL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_NULL),
|
|
930
|
+
/* harmony export */ SQLITE_OK: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK),
|
|
931
|
+
/* harmony export */ SQLITE_OPEN_AUTOPROXY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_AUTOPROXY),
|
|
932
|
+
/* harmony export */ SQLITE_OPEN_CREATE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_CREATE),
|
|
933
|
+
/* harmony export */ SQLITE_OPEN_DELETEONCLOSE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_DELETEONCLOSE),
|
|
934
|
+
/* harmony export */ SQLITE_OPEN_EXCLUSIVE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_EXCLUSIVE),
|
|
935
|
+
/* harmony export */ SQLITE_OPEN_FULLMUTEX: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_FULLMUTEX),
|
|
936
|
+
/* harmony export */ SQLITE_OPEN_MAIN_DB: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_MAIN_DB),
|
|
937
|
+
/* harmony export */ SQLITE_OPEN_MAIN_JOURNAL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_MAIN_JOURNAL),
|
|
938
|
+
/* harmony export */ SQLITE_OPEN_MEMORY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_MEMORY),
|
|
939
|
+
/* harmony export */ SQLITE_OPEN_NOFOLLOW: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_NOFOLLOW),
|
|
940
|
+
/* harmony export */ SQLITE_OPEN_NOMUTEX: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_NOMUTEX),
|
|
941
|
+
/* harmony export */ SQLITE_OPEN_PRIVATECACHE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_PRIVATECACHE),
|
|
942
|
+
/* harmony export */ SQLITE_OPEN_READONLY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_READONLY),
|
|
943
|
+
/* harmony export */ SQLITE_OPEN_READWRITE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_READWRITE),
|
|
944
|
+
/* harmony export */ SQLITE_OPEN_SHAREDCACHE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_SHAREDCACHE),
|
|
945
|
+
/* harmony export */ SQLITE_OPEN_SUBJOURNAL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_SUBJOURNAL),
|
|
946
|
+
/* harmony export */ SQLITE_OPEN_SUPER_JOURNAL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_SUPER_JOURNAL),
|
|
947
|
+
/* harmony export */ SQLITE_OPEN_TEMP_DB: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_TEMP_DB),
|
|
948
|
+
/* harmony export */ SQLITE_OPEN_TEMP_JOURNAL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_TEMP_JOURNAL),
|
|
949
|
+
/* harmony export */ SQLITE_OPEN_TRANSIENT_DB: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_TRANSIENT_DB),
|
|
950
|
+
/* harmony export */ SQLITE_OPEN_URI: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_URI),
|
|
951
|
+
/* harmony export */ SQLITE_OPEN_WAL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_WAL),
|
|
952
|
+
/* harmony export */ SQLITE_PERM: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_PERM),
|
|
953
|
+
/* harmony export */ SQLITE_PRAGMA: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_PRAGMA),
|
|
954
|
+
/* harmony export */ SQLITE_PREPARE_NORMALIZED: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_PREPARE_NORMALIZED),
|
|
955
|
+
/* harmony export */ SQLITE_PREPARE_NO_VTAB: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_PREPARE_NO_VTAB),
|
|
956
|
+
/* harmony export */ SQLITE_PREPARE_PERSISTENT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_PREPARE_PERSISTENT),
|
|
957
|
+
/* harmony export */ SQLITE_PROTOCOL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_PROTOCOL),
|
|
958
|
+
/* harmony export */ SQLITE_RANGE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_RANGE),
|
|
959
|
+
/* harmony export */ SQLITE_READ: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_READ),
|
|
960
|
+
/* harmony export */ SQLITE_READONLY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_READONLY),
|
|
961
|
+
/* harmony export */ SQLITE_RECURSIVE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_RECURSIVE),
|
|
962
|
+
/* harmony export */ SQLITE_REINDEX: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_REINDEX),
|
|
963
|
+
/* harmony export */ SQLITE_ROW: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ROW),
|
|
964
|
+
/* harmony export */ SQLITE_SAVEPOINT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_SAVEPOINT),
|
|
965
|
+
/* harmony export */ SQLITE_SCHEMA: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_SCHEMA),
|
|
966
|
+
/* harmony export */ SQLITE_SELECT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_SELECT),
|
|
967
|
+
/* harmony export */ SQLITE_STATIC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_STATIC),
|
|
968
|
+
/* harmony export */ SQLITE_SUBTYPE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_SUBTYPE),
|
|
969
|
+
/* harmony export */ SQLITE_SYNC_DATAONLY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_SYNC_DATAONLY),
|
|
970
|
+
/* harmony export */ SQLITE_SYNC_FULL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_SYNC_FULL),
|
|
971
|
+
/* harmony export */ SQLITE_SYNC_NORMAL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_SYNC_NORMAL),
|
|
972
|
+
/* harmony export */ SQLITE_TEXT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_TEXT),
|
|
973
|
+
/* harmony export */ SQLITE_TOOBIG: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_TOOBIG),
|
|
974
|
+
/* harmony export */ SQLITE_TRANSACTION: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_TRANSACTION),
|
|
975
|
+
/* harmony export */ SQLITE_TRANSIENT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_TRANSIENT),
|
|
976
|
+
/* harmony export */ SQLITE_UPDATE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_UPDATE),
|
|
977
|
+
/* harmony export */ SQLITE_UTF16: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_UTF16),
|
|
978
|
+
/* harmony export */ SQLITE_UTF16BE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_UTF16BE),
|
|
979
|
+
/* harmony export */ SQLITE_UTF16LE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_UTF16LE),
|
|
980
|
+
/* harmony export */ SQLITE_UTF8: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_UTF8),
|
|
981
|
+
/* harmony export */ SQLITE_WARNING: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_WARNING)
|
|
982
|
+
/* harmony export */ });
|
|
983
|
+
/* harmony import */ var _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./sqlite-constants.js */ "../../node_modules/@journeyapps/wa-sqlite/src/sqlite-constants.js");
|
|
984
|
+
// Copyright 2024 Roy T. Hashimoto. All Rights Reserved.
|
|
985
|
+
|
|
986
|
+
|
|
987
|
+
|
|
988
|
+
const DEFAULT_SECTOR_SIZE = 512;
|
|
989
|
+
|
|
990
|
+
// Base class for a VFS.
|
|
991
|
+
class Base {
|
|
992
|
+
name;
|
|
993
|
+
mxPathname = 64;
|
|
994
|
+
_module;
|
|
995
|
+
|
|
996
|
+
/**
|
|
997
|
+
* @param {string} name
|
|
998
|
+
* @param {object} module
|
|
999
|
+
*/
|
|
1000
|
+
constructor(name, module) {
|
|
1001
|
+
this.name = name;
|
|
1002
|
+
this._module = module;
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
/**
|
|
1006
|
+
* @returns {void|Promise<void>}
|
|
1007
|
+
*/
|
|
1008
|
+
close() {
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
/**
|
|
1012
|
+
* @returns {boolean|Promise<boolean>}
|
|
1013
|
+
*/
|
|
1014
|
+
isReady() {
|
|
1015
|
+
return true;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
/**
|
|
1019
|
+
* Overload in subclasses to indicate which methods are asynchronous.
|
|
1020
|
+
* @param {string} methodName
|
|
1021
|
+
* @returns {boolean}
|
|
1022
|
+
*/
|
|
1023
|
+
hasAsyncMethod(methodName) {
|
|
1024
|
+
return false;
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
/**
|
|
1028
|
+
* @param {number} pVfs
|
|
1029
|
+
* @param {number} zName
|
|
1030
|
+
* @param {number} pFile
|
|
1031
|
+
* @param {number} flags
|
|
1032
|
+
* @param {number} pOutFlags
|
|
1033
|
+
* @returns {number|Promise<number>}
|
|
1034
|
+
*/
|
|
1035
|
+
xOpen(pVfs, zName, pFile, flags, pOutFlags) {
|
|
1036
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CANTOPEN;
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
/**
|
|
1040
|
+
* @param {number} pVfs
|
|
1041
|
+
* @param {number} zName
|
|
1042
|
+
* @param {number} syncDir
|
|
1043
|
+
* @returns {number|Promise<number>}
|
|
1044
|
+
*/
|
|
1045
|
+
xDelete(pVfs, zName, syncDir) {
|
|
1046
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
/**
|
|
1050
|
+
* @param {number} pVfs
|
|
1051
|
+
* @param {number} zName
|
|
1052
|
+
* @param {number} flags
|
|
1053
|
+
* @param {number} pResOut
|
|
1054
|
+
* @returns {number|Promise<number>}
|
|
1055
|
+
*/
|
|
1056
|
+
xAccess(pVfs, zName, flags, pResOut) {
|
|
1057
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
/**
|
|
1061
|
+
* @param {number} pVfs
|
|
1062
|
+
* @param {number} zName
|
|
1063
|
+
* @param {number} nOut
|
|
1064
|
+
* @param {number} zOut
|
|
1065
|
+
* @returns {number|Promise<number>}
|
|
1066
|
+
*/
|
|
1067
|
+
xFullPathname(pVfs, zName, nOut, zOut) {
|
|
1068
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
/**
|
|
1072
|
+
* @param {number} pVfs
|
|
1073
|
+
* @param {number} nBuf
|
|
1074
|
+
* @param {number} zBuf
|
|
1075
|
+
* @returns {number|Promise<number>}
|
|
1076
|
+
*/
|
|
1077
|
+
xGetLastError(pVfs, nBuf, zBuf) {
|
|
1078
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
/**
|
|
1082
|
+
* @param {number} pFile
|
|
1083
|
+
* @returns {number|Promise<number>}
|
|
1084
|
+
*/
|
|
1085
|
+
xClose(pFile) {
|
|
1086
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
/**
|
|
1090
|
+
* @param {number} pFile
|
|
1091
|
+
* @param {number} pData
|
|
1092
|
+
* @param {number} iAmt
|
|
1093
|
+
* @param {number} iOffsetLo
|
|
1094
|
+
* @param {number} iOffsetHi
|
|
1095
|
+
* @returns {number|Promise<number>}
|
|
1096
|
+
*/
|
|
1097
|
+
xRead(pFile, pData, iAmt, iOffsetLo, iOffsetHi) {
|
|
1098
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1099
|
+
}
|
|
1100
|
+
|
|
1101
|
+
/**
|
|
1102
|
+
* @param {number} pFile
|
|
1103
|
+
* @param {number} pData
|
|
1104
|
+
* @param {number} iAmt
|
|
1105
|
+
* @param {number} iOffsetLo
|
|
1106
|
+
* @param {number} iOffsetHi
|
|
1107
|
+
* @returns {number|Promise<number>}
|
|
1108
|
+
*/
|
|
1109
|
+
xWrite(pFile, pData, iAmt, iOffsetLo, iOffsetHi) {
|
|
1110
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
/**
|
|
1114
|
+
* @param {number} pFile
|
|
1115
|
+
* @param {number} sizeLo
|
|
1116
|
+
* @param {number} sizeHi
|
|
1117
|
+
* @returns {number|Promise<number>}
|
|
1118
|
+
*/
|
|
1119
|
+
xTruncate(pFile, sizeLo, sizeHi) {
|
|
1120
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
/**
|
|
1124
|
+
* @param {number} pFile
|
|
1125
|
+
* @param {number} flags
|
|
1126
|
+
* @returns {number|Promise<number>}
|
|
1127
|
+
*/
|
|
1128
|
+
xSync(pFile, flags) {
|
|
1129
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
/**
|
|
1133
|
+
*
|
|
1134
|
+
* @param {number} pFile
|
|
1135
|
+
* @param {number} pSize
|
|
1136
|
+
* @returns {number|Promise<number>}
|
|
1137
|
+
*/
|
|
1138
|
+
xFileSize(pFile, pSize) {
|
|
1139
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
/**
|
|
1143
|
+
* @param {number} pFile
|
|
1144
|
+
* @param {number} lockType
|
|
1145
|
+
* @returns {number|Promise<number>}
|
|
1146
|
+
*/
|
|
1147
|
+
xLock(pFile, lockType) {
|
|
1148
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
/**
|
|
1152
|
+
* @param {number} pFile
|
|
1153
|
+
* @param {number} lockType
|
|
1154
|
+
* @returns {number|Promise<number>}
|
|
1155
|
+
*/
|
|
1156
|
+
xUnlock(pFile, lockType) {
|
|
1157
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
/**
|
|
1161
|
+
* @param {number} pFile
|
|
1162
|
+
* @param {number} pResOut
|
|
1163
|
+
* @returns {number|Promise<number>}
|
|
1164
|
+
*/
|
|
1165
|
+
xCheckReservedLock(pFile, pResOut) {
|
|
1166
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
/**
|
|
1170
|
+
* @param {number} pFile
|
|
1171
|
+
* @param {number} op
|
|
1172
|
+
* @param {number} pArg
|
|
1173
|
+
* @returns {number|Promise<number>}
|
|
1174
|
+
*/
|
|
1175
|
+
xFileControl(pFile, op, pArg) {
|
|
1176
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_NOTFOUND;
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
/**
|
|
1180
|
+
* @param {number} pFile
|
|
1181
|
+
* @returns {number|Promise<number>}
|
|
1182
|
+
*/
|
|
1183
|
+
xSectorSize(pFile) {
|
|
1184
|
+
return DEFAULT_SECTOR_SIZE;
|
|
1185
|
+
}
|
|
1186
|
+
|
|
1187
|
+
/**
|
|
1188
|
+
* @param {number} pFile
|
|
1189
|
+
* @returns {number|Promise<number>}
|
|
1190
|
+
*/
|
|
1191
|
+
xDeviceCharacteristics(pFile) {
|
|
1192
|
+
return 0;
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
const FILE_TYPE_MASK = [
|
|
1197
|
+
_sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_MAIN_DB,
|
|
1198
|
+
_sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_MAIN_JOURNAL,
|
|
1199
|
+
_sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_TEMP_DB,
|
|
1200
|
+
_sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_TEMP_JOURNAL,
|
|
1201
|
+
_sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_TRANSIENT_DB,
|
|
1202
|
+
_sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_SUBJOURNAL,
|
|
1203
|
+
_sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_SUPER_JOURNAL,
|
|
1204
|
+
_sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_WAL
|
|
1205
|
+
].reduce((mask, element) => mask | element);
|
|
1206
|
+
|
|
1207
|
+
/***/ }),
|
|
1208
|
+
|
|
6
1209
|
/***/ "../../node_modules/@journeyapps/wa-sqlite/src/sqlite-api.js":
|
|
7
1210
|
/*!*******************************************************************!*\
|
|
8
1211
|
!*** ../../node_modules/@journeyapps/wa-sqlite/src/sqlite-api.js ***!
|
|
@@ -3228,12 +4431,26 @@ class SyncStatus {
|
|
|
3228
4431
|
return {
|
|
3229
4432
|
connected: this.connected,
|
|
3230
4433
|
connecting: this.connecting,
|
|
3231
|
-
dataFlow:
|
|
4434
|
+
dataFlow: {
|
|
4435
|
+
...this.dataFlowStatus,
|
|
4436
|
+
uploadError: this.serializeError(this.dataFlowStatus.uploadError),
|
|
4437
|
+
downloadError: this.serializeError(this.dataFlowStatus.downloadError)
|
|
4438
|
+
},
|
|
3232
4439
|
lastSyncedAt: this.lastSyncedAt,
|
|
3233
4440
|
hasSynced: this.hasSynced,
|
|
3234
4441
|
priorityStatusEntries: this.priorityStatusEntries
|
|
3235
4442
|
};
|
|
3236
4443
|
}
|
|
4444
|
+
serializeError(error) {
|
|
4445
|
+
if (typeof error == 'undefined') {
|
|
4446
|
+
return undefined;
|
|
4447
|
+
}
|
|
4448
|
+
return {
|
|
4449
|
+
name: error.name,
|
|
4450
|
+
message: error.message,
|
|
4451
|
+
stack: error.stack
|
|
4452
|
+
};
|
|
4453
|
+
}
|
|
3237
4454
|
static comparePriorities(a, b) {
|
|
3238
4455
|
return b.priority - a.priority; // Reverse because higher priorities have lower numbers
|
|
3239
4456
|
}
|
|
@@ -14659,7 +15876,7 @@ The next upload iteration will be delayed.`);
|
|
|
14659
15876
|
uploadError: ex
|
|
14660
15877
|
}
|
|
14661
15878
|
});
|
|
14662
|
-
await this.delayRetry(controller.signal
|
|
15879
|
+
await this.delayRetry(controller.signal);
|
|
14663
15880
|
if (!this.isConnected) {
|
|
14664
15881
|
// Exit the upload loop if the sync stream is no longer connected
|
|
14665
15882
|
break;
|
|
@@ -15370,14 +16587,14 @@ The next upload iteration will be delayed.`);
|
|
|
15370
16587
|
// trigger this for all updates
|
|
15371
16588
|
this.iterateListeners((cb) => cb.statusUpdated?.(options));
|
|
15372
16589
|
}
|
|
15373
|
-
async delayRetry(signal
|
|
16590
|
+
async delayRetry(signal) {
|
|
15374
16591
|
return new Promise((resolve) => {
|
|
15375
16592
|
if (signal?.aborted) {
|
|
15376
16593
|
// If the signal is already aborted, resolve immediately
|
|
15377
16594
|
resolve();
|
|
15378
16595
|
return;
|
|
15379
16596
|
}
|
|
15380
|
-
const
|
|
16597
|
+
const { retryDelayMs } = this.options;
|
|
15381
16598
|
let timeoutId;
|
|
15382
16599
|
const endDelay = () => {
|
|
15383
16600
|
resolve();
|
|
@@ -15388,7 +16605,7 @@ The next upload iteration will be delayed.`);
|
|
|
15388
16605
|
signal?.removeEventListener('abort', endDelay);
|
|
15389
16606
|
};
|
|
15390
16607
|
signal?.addEventListener('abort', endDelay, { once: true });
|
|
15391
|
-
timeoutId = setTimeout(endDelay,
|
|
16608
|
+
timeoutId = setTimeout(endDelay, retryDelayMs);
|
|
15392
16609
|
});
|
|
15393
16610
|
}
|
|
15394
16611
|
updateSubscriptions(subscriptions) {
|
|
@@ -17612,6 +18829,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
17612
18829
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
17613
18830
|
/* harmony export */ ConnectionClosedError: () => (/* binding */ ConnectionClosedError)
|
|
17614
18831
|
/* harmony export */ });
|
|
18832
|
+
/**
|
|
18833
|
+
* Thrown when an underlying database connection is closed.
|
|
18834
|
+
* This is particularly relevant when worker connections are marked as closed while
|
|
18835
|
+
* operations are still in progress.
|
|
18836
|
+
*/
|
|
17615
18837
|
class ConnectionClosedError extends Error {
|
|
17616
18838
|
constructor(message) {
|
|
17617
18839
|
super(message);
|
|
@@ -17633,7 +18855,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
17633
18855
|
/* harmony export */ LockedAsyncDatabaseAdapter: () => (/* binding */ LockedAsyncDatabaseAdapter)
|
|
17634
18856
|
/* harmony export */ });
|
|
17635
18857
|
/* harmony import */ var _powersync_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @powersync/common */ "../common/dist/bundle.mjs");
|
|
17636
|
-
/* harmony import */ var _shared_navigator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*!
|
|
18858
|
+
/* harmony import */ var _shared_navigator__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../shared/navigator */ "./lib/src/shared/navigator.js");
|
|
17637
18859
|
/* harmony import */ var _AsyncDatabaseConnection__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./AsyncDatabaseConnection */ "./lib/src/db/adapters/AsyncDatabaseConnection.js");
|
|
17638
18860
|
/* harmony import */ var _WorkerWrappedAsyncDatabaseConnection__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./WorkerWrappedAsyncDatabaseConnection */ "./lib/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.js");
|
|
17639
18861
|
/* harmony import */ var _wa_sqlite_WASQLiteConnection__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./wa-sqlite/WASQLiteConnection */ "./lib/src/db/adapters/wa-sqlite/WASQLiteConnection.js");
|
|
@@ -17659,7 +18881,6 @@ class LockedAsyncDatabaseAdapter extends _powersync_common__WEBPACK_IMPORTED_MOD
|
|
|
17659
18881
|
_config = null;
|
|
17660
18882
|
pendingAbortControllers;
|
|
17661
18883
|
requiresHolds;
|
|
17662
|
-
requiresReOpen;
|
|
17663
18884
|
databaseOpenPromise = null;
|
|
17664
18885
|
closing;
|
|
17665
18886
|
closed;
|
|
@@ -17672,7 +18893,6 @@ class LockedAsyncDatabaseAdapter extends _powersync_common__WEBPACK_IMPORTED_MOD
|
|
|
17672
18893
|
this.closed = false;
|
|
17673
18894
|
this.closing = false;
|
|
17674
18895
|
this.requiresHolds = null;
|
|
17675
|
-
this.requiresReOpen = false;
|
|
17676
18896
|
// Set the name if provided. We can query for the name if not available yet
|
|
17677
18897
|
this.debugMode = options.debugMode ?? false;
|
|
17678
18898
|
if (this.debugMode) {
|
|
@@ -17712,24 +18932,67 @@ class LockedAsyncDatabaseAdapter extends _powersync_common__WEBPACK_IMPORTED_MOD
|
|
|
17712
18932
|
return this.initPromise;
|
|
17713
18933
|
}
|
|
17714
18934
|
async openInternalDB() {
|
|
17715
|
-
// Dispose any previous table change listener.
|
|
17716
|
-
this._disposeTableChangeListener?.();
|
|
17717
|
-
this._disposeTableChangeListener = null;
|
|
17718
|
-
const isReOpen = !!this._db;
|
|
17719
|
-
this._db = await this.options.openConnection();
|
|
17720
|
-
await this._db.init();
|
|
17721
|
-
this._config = await this._db.getConfig();
|
|
17722
|
-
await this.registerOnChangeListener(this._db);
|
|
17723
|
-
if (isReOpen) {
|
|
17724
|
-
this.iterateListeners((cb) => cb.databaseReOpened?.());
|
|
17725
|
-
}
|
|
17726
18935
|
/**
|
|
17727
|
-
*
|
|
18936
|
+
* Execute opening of the db in a lock in order not to interfere with other operations.
|
|
17728
18937
|
*/
|
|
17729
|
-
this.
|
|
18938
|
+
return this._acquireLock(async () => {
|
|
18939
|
+
// Dispose any previous table change listener.
|
|
18940
|
+
this._disposeTableChangeListener?.();
|
|
18941
|
+
this._disposeTableChangeListener = null;
|
|
18942
|
+
this._db?.close().catch((ex) => this.logger.warn(`Error closing database before opening new instance`, ex));
|
|
18943
|
+
const isReOpen = !!this._db;
|
|
18944
|
+
this._db = null;
|
|
18945
|
+
this._db = await this.options.openConnection();
|
|
18946
|
+
await this._db.init();
|
|
18947
|
+
this._config = await this._db.getConfig();
|
|
18948
|
+
await this.registerOnChangeListener(this._db);
|
|
18949
|
+
if (isReOpen) {
|
|
18950
|
+
this.iterateListeners((cb) => cb.databaseReOpened?.());
|
|
18951
|
+
}
|
|
18952
|
+
/**
|
|
18953
|
+
* This is only required for the long-lived shared IndexedDB connections.
|
|
18954
|
+
*/
|
|
18955
|
+
this.requiresHolds = this._config.vfs == _wa_sqlite_WASQLiteConnection__WEBPACK_IMPORTED_MODULE_4__.WASQLiteVFS.IDBBatchAtomicVFS;
|
|
18956
|
+
});
|
|
18957
|
+
}
|
|
18958
|
+
_reOpen() {
|
|
18959
|
+
this.databaseOpenPromise = this.openInternalDB().finally(() => {
|
|
18960
|
+
this.databaseOpenPromise = null;
|
|
18961
|
+
});
|
|
18962
|
+
return this.databaseOpenPromise;
|
|
18963
|
+
}
|
|
18964
|
+
/**
|
|
18965
|
+
* Re-opens the underlying database.
|
|
18966
|
+
* Returns a pending operation if one is already in progress.
|
|
18967
|
+
*/
|
|
18968
|
+
async reOpenInternalDB() {
|
|
18969
|
+
if (!this.options.reOpenOnConnectionClosed) {
|
|
18970
|
+
throw new Error(`Cannot re-open underlying database, reOpenOnConnectionClosed is not enabled`);
|
|
18971
|
+
}
|
|
18972
|
+
if (this.databaseOpenPromise) {
|
|
18973
|
+
return this.databaseOpenPromise;
|
|
18974
|
+
}
|
|
18975
|
+
return this._reOpen();
|
|
17730
18976
|
}
|
|
17731
18977
|
async _init() {
|
|
17732
|
-
|
|
18978
|
+
/**
|
|
18979
|
+
* For OPFS, we can see this open call sometimes fail due to NoModificationAllowedError.
|
|
18980
|
+
* We should be able to recover from this by re-opening the database.
|
|
18981
|
+
*/
|
|
18982
|
+
const maxAttempts = 3;
|
|
18983
|
+
for (let count = 0; count < maxAttempts; count++) {
|
|
18984
|
+
try {
|
|
18985
|
+
await this.openInternalDB();
|
|
18986
|
+
break;
|
|
18987
|
+
}
|
|
18988
|
+
catch (ex) {
|
|
18989
|
+
if (count == maxAttempts - 1) {
|
|
18990
|
+
throw ex;
|
|
18991
|
+
}
|
|
18992
|
+
this.logger.warn(`Attempt ${count + 1} of ${maxAttempts} to open database failed, retrying in 1 second...`, ex);
|
|
18993
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
18994
|
+
}
|
|
18995
|
+
}
|
|
17733
18996
|
this.iterateListeners((cb) => cb.initialized?.());
|
|
17734
18997
|
}
|
|
17735
18998
|
getConfiguration() {
|
|
@@ -17806,8 +19069,7 @@ class LockedAsyncDatabaseAdapter extends _powersync_common__WEBPACK_IMPORTED_MOD
|
|
|
17806
19069
|
timeoutMs: options?.timeoutMs ?? this.options.defaultLockTimeoutMs
|
|
17807
19070
|
});
|
|
17808
19071
|
}
|
|
17809
|
-
async
|
|
17810
|
-
await this.waitForInitialized();
|
|
19072
|
+
async _acquireLock(callback, options) {
|
|
17811
19073
|
if (this.closing) {
|
|
17812
19074
|
throw new Error(`Cannot acquire lock, the database is closing`);
|
|
17813
19075
|
}
|
|
@@ -17825,30 +19087,29 @@ class LockedAsyncDatabaseAdapter extends _powersync_common__WEBPACK_IMPORTED_MOD
|
|
|
17825
19087
|
if (timeoutId) {
|
|
17826
19088
|
clearTimeout(timeoutId);
|
|
17827
19089
|
}
|
|
19090
|
+
return await callback();
|
|
19091
|
+
});
|
|
19092
|
+
}
|
|
19093
|
+
async acquireLock(callback, options) {
|
|
19094
|
+
await this.waitForInitialized();
|
|
19095
|
+
return this._acquireLock(async () => {
|
|
17828
19096
|
let holdId = null;
|
|
17829
19097
|
try {
|
|
17830
19098
|
// The database is being opened in the background. Wait for it here.
|
|
17831
19099
|
if (this.databaseOpenPromise) {
|
|
17832
|
-
|
|
17833
|
-
|
|
17834
|
-
|
|
17835
|
-
|
|
17836
|
-
// This will cause a retry of opening the database.
|
|
17837
|
-
const wrappedError = new _AsyncDatabaseConnection__WEBPACK_IMPORTED_MODULE_2__.ConnectionClosedError('Could not open database');
|
|
17838
|
-
wrappedError.cause = ex;
|
|
17839
|
-
throw wrappedError;
|
|
17840
|
-
}
|
|
19100
|
+
/**
|
|
19101
|
+
* We can't await this since it uses the same lock as we're in now.
|
|
19102
|
+
*/
|
|
19103
|
+
throw new _AsyncDatabaseConnection__WEBPACK_IMPORTED_MODULE_2__.ConnectionClosedError('Connection is busy re-opening');
|
|
17841
19104
|
}
|
|
17842
19105
|
holdId = this.requiresHolds ? await this.baseDB.markHold() : null;
|
|
17843
19106
|
return await callback();
|
|
17844
19107
|
}
|
|
17845
19108
|
catch (ex) {
|
|
17846
|
-
if (ex instanceof _AsyncDatabaseConnection__WEBPACK_IMPORTED_MODULE_2__.ConnectionClosedError) {
|
|
19109
|
+
if (ex instanceof _AsyncDatabaseConnection__WEBPACK_IMPORTED_MODULE_2__.ConnectionClosedError || (ex instanceof Error && ex.name === 'NoModificationAllowedError')) {
|
|
17847
19110
|
if (this.options.reOpenOnConnectionClosed && !this.databaseOpenPromise && !this.closing) {
|
|
17848
19111
|
// Immediately re-open the database. We need to miss as little table updates as possible.
|
|
17849
|
-
this.
|
|
17850
|
-
this.databaseOpenPromise = null;
|
|
17851
|
-
});
|
|
19112
|
+
this.reOpenInternalDB();
|
|
17852
19113
|
}
|
|
17853
19114
|
}
|
|
17854
19115
|
throw ex;
|
|
@@ -17858,7 +19119,7 @@ class LockedAsyncDatabaseAdapter extends _powersync_common__WEBPACK_IMPORTED_MOD
|
|
|
17858
19119
|
await this.baseDB.releaseHold(holdId);
|
|
17859
19120
|
}
|
|
17860
19121
|
}
|
|
17861
|
-
});
|
|
19122
|
+
}, options);
|
|
17862
19123
|
}
|
|
17863
19124
|
async readTransaction(fn, options) {
|
|
17864
19125
|
return this.readLock(this.wrapTransaction(fn));
|
|
@@ -17985,19 +19246,22 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
17985
19246
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
17986
19247
|
/* harmony export */ WorkerWrappedAsyncDatabaseConnection: () => (/* binding */ WorkerWrappedAsyncDatabaseConnection)
|
|
17987
19248
|
/* harmony export */ });
|
|
17988
|
-
/* harmony import */ var
|
|
17989
|
-
/* harmony import */ var
|
|
19249
|
+
/* harmony import */ var _powersync_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @powersync/common */ "../common/dist/bundle.mjs");
|
|
19250
|
+
/* harmony import */ var comlink__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! comlink */ "../../node_modules/comlink/dist/esm/comlink.mjs");
|
|
19251
|
+
/* harmony import */ var _AsyncDatabaseConnection__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AsyncDatabaseConnection */ "./lib/src/db/adapters/AsyncDatabaseConnection.js");
|
|
19252
|
+
|
|
17990
19253
|
|
|
17991
19254
|
|
|
17992
19255
|
/**
|
|
17993
19256
|
* Wraps a provided instance of {@link AsyncDatabaseConnection}, providing necessary proxy
|
|
17994
19257
|
* functions for worker listeners.
|
|
17995
19258
|
*/
|
|
17996
|
-
class WorkerWrappedAsyncDatabaseConnection {
|
|
19259
|
+
class WorkerWrappedAsyncDatabaseConnection extends _powersync_common__WEBPACK_IMPORTED_MODULE_0__.BaseObserver {
|
|
17997
19260
|
options;
|
|
17998
19261
|
lockAbortController = new AbortController();
|
|
17999
19262
|
notifyRemoteClosed;
|
|
18000
19263
|
constructor(options) {
|
|
19264
|
+
super();
|
|
18001
19265
|
this.options = options;
|
|
18002
19266
|
if (options.remoteCanCloseUnexpectedly) {
|
|
18003
19267
|
this.notifyRemoteClosed = new AbortController();
|
|
@@ -18030,17 +19294,20 @@ class WorkerWrappedAsyncDatabaseConnection {
|
|
|
18030
19294
|
isAutoCommit() {
|
|
18031
19295
|
return this.withRemote(() => this.baseConnection.isAutoCommit());
|
|
18032
19296
|
}
|
|
18033
|
-
withRemote(workerPromise) {
|
|
19297
|
+
withRemote(workerPromise, fireActionOnAbort = false) {
|
|
18034
19298
|
const controller = this.notifyRemoteClosed;
|
|
18035
19299
|
if (controller) {
|
|
18036
19300
|
return new Promise((resolve, reject) => {
|
|
18037
19301
|
if (controller.signal.aborted) {
|
|
18038
|
-
reject(new
|
|
18039
|
-
|
|
18040
|
-
|
|
19302
|
+
reject(new _AsyncDatabaseConnection__WEBPACK_IMPORTED_MODULE_1__.ConnectionClosedError('Called operation on closed remote'));
|
|
19303
|
+
if (!fireActionOnAbort) {
|
|
19304
|
+
// Don't run the operation if we're going to reject
|
|
19305
|
+
// We might want to fire-and-forget the operation in some cases (like a close operation)
|
|
19306
|
+
return;
|
|
19307
|
+
}
|
|
18041
19308
|
}
|
|
18042
19309
|
function handleAbort() {
|
|
18043
|
-
reject(new
|
|
19310
|
+
reject(new _AsyncDatabaseConnection__WEBPACK_IMPORTED_MODULE_1__.ConnectionClosedError('Remote peer closed with request in flight'));
|
|
18044
19311
|
}
|
|
18045
19312
|
function completePromise(action) {
|
|
18046
19313
|
controller.signal.removeEventListener('abort', handleAbort);
|
|
@@ -18094,7 +19361,7 @@ class WorkerWrappedAsyncDatabaseConnection {
|
|
|
18094
19361
|
reject(ex);
|
|
18095
19362
|
}
|
|
18096
19363
|
}));
|
|
18097
|
-
const newPort = await remote[
|
|
19364
|
+
const newPort = await remote[comlink__WEBPACK_IMPORTED_MODULE_2__.createEndpoint]();
|
|
18098
19365
|
return { port: newPort, identifier };
|
|
18099
19366
|
}
|
|
18100
19367
|
/**
|
|
@@ -18102,17 +19369,19 @@ class WorkerWrappedAsyncDatabaseConnection {
|
|
|
18102
19369
|
* This can be extended by custom implementations in order to handle proxy events.
|
|
18103
19370
|
*/
|
|
18104
19371
|
async registerOnTableChange(callback) {
|
|
18105
|
-
return this.baseConnection.registerOnTableChange(
|
|
19372
|
+
return this.baseConnection.registerOnTableChange(comlink__WEBPACK_IMPORTED_MODULE_2__.proxy(callback));
|
|
18106
19373
|
}
|
|
18107
19374
|
async close() {
|
|
18108
19375
|
// Abort any pending lock requests.
|
|
18109
19376
|
this.lockAbortController.abort();
|
|
18110
19377
|
try {
|
|
18111
|
-
|
|
19378
|
+
// fire and forget the close operation
|
|
19379
|
+
await this.withRemote(() => this.baseConnection.close(), true);
|
|
18112
19380
|
}
|
|
18113
19381
|
finally {
|
|
18114
|
-
this.options.remote[
|
|
19382
|
+
this.options.remote[comlink__WEBPACK_IMPORTED_MODULE_2__.releaseProxy]();
|
|
18115
19383
|
this.options.onClose?.();
|
|
19384
|
+
this.iterateListeners((l) => l.closing?.());
|
|
18116
19385
|
}
|
|
18117
19386
|
}
|
|
18118
19387
|
execute(sql, params) {
|
|
@@ -18151,6 +19420,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
18151
19420
|
/* harmony import */ var _journeyapps_wa_sqlite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @journeyapps/wa-sqlite */ "../../node_modules/@journeyapps/wa-sqlite/src/sqlite-api.js");
|
|
18152
19421
|
/* harmony import */ var _powersync_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @powersync/common */ "../common/dist/bundle.mjs");
|
|
18153
19422
|
/* harmony import */ var async_mutex__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! async-mutex */ "../../node_modules/async-mutex/index.mjs");
|
|
19423
|
+
/* harmony import */ var _worker_db_opfs__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../worker/db/opfs */ "./lib/src/worker/db/opfs.js");
|
|
19424
|
+
|
|
18154
19425
|
|
|
18155
19426
|
|
|
18156
19427
|
|
|
@@ -18233,11 +19504,10 @@ const DEFAULT_MODULE_FACTORIES = {
|
|
|
18233
19504
|
else {
|
|
18234
19505
|
module = await SyncWASQLiteModuleFactory();
|
|
18235
19506
|
}
|
|
18236
|
-
|
|
18237
|
-
const { OPFSCoopSyncVFS } = await __webpack_require__.e(/*! import() */ "node_modules_journeyapps_wa-sqlite_src_examples_OPFSCoopSyncVFS_js").then(__webpack_require__.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js */ "../../node_modules/@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js"));
|
|
19507
|
+
const vfs = await _worker_db_opfs__WEBPACK_IMPORTED_MODULE_3__.OPFSCoopSyncVFS.create(options.dbFileName, module);
|
|
18238
19508
|
return {
|
|
18239
19509
|
module,
|
|
18240
|
-
vfs:
|
|
19510
|
+
vfs: vfs
|
|
18241
19511
|
};
|
|
18242
19512
|
}
|
|
18243
19513
|
};
|
|
@@ -18737,6 +20007,604 @@ const getNavigatorLocks = () => {
|
|
|
18737
20007
|
};
|
|
18738
20008
|
|
|
18739
20009
|
|
|
20010
|
+
/***/ }),
|
|
20011
|
+
|
|
20012
|
+
/***/ "./lib/src/worker/db/opfs.js":
|
|
20013
|
+
/*!***********************************!*\
|
|
20014
|
+
!*** ./lib/src/worker/db/opfs.js ***!
|
|
20015
|
+
\***********************************/
|
|
20016
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
20017
|
+
|
|
20018
|
+
__webpack_require__.r(__webpack_exports__);
|
|
20019
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
20020
|
+
/* harmony export */ OPFSCoopSyncVFS: () => (/* binding */ OPFSCoopSyncVFS)
|
|
20021
|
+
/* harmony export */ });
|
|
20022
|
+
/* harmony import */ var _journeyapps_wa_sqlite_src_FacadeVFS_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @journeyapps/wa-sqlite/src/FacadeVFS.js */ "../../node_modules/@journeyapps/wa-sqlite/src/FacadeVFS.js");
|
|
20023
|
+
/* harmony import */ var _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @journeyapps/wa-sqlite/src/VFS.js */ "../../node_modules/@journeyapps/wa-sqlite/src/VFS.js");
|
|
20024
|
+
// Copyright 2024 Roy T. Hashimoto. All Rights Reserved.
|
|
20025
|
+
// @ts-nocheck
|
|
20026
|
+
|
|
20027
|
+
|
|
20028
|
+
const DEFAULT_TEMPORARY_FILES = 10;
|
|
20029
|
+
const LOCK_NOTIFY_INTERVAL = 1000;
|
|
20030
|
+
const DB_RELATED_FILE_SUFFIXES = ['', '-journal', '-wal'];
|
|
20031
|
+
const finalizationRegistry = new FinalizationRegistry((releaser) => releaser());
|
|
20032
|
+
class File {
|
|
20033
|
+
/** @type {string} */ path;
|
|
20034
|
+
/** @type {number} */ flags;
|
|
20035
|
+
/** @type {FileSystemSyncAccessHandle} */ accessHandle;
|
|
20036
|
+
/** @type {PersistentFile?} */ persistentFile;
|
|
20037
|
+
constructor(path, flags) {
|
|
20038
|
+
this.path = path;
|
|
20039
|
+
this.flags = flags;
|
|
20040
|
+
}
|
|
20041
|
+
}
|
|
20042
|
+
class PersistentFile {
|
|
20043
|
+
/** @type {FileSystemFileHandle} */ fileHandle;
|
|
20044
|
+
/** @type {FileSystemSyncAccessHandle} */ accessHandle = null;
|
|
20045
|
+
// The following properties are for main database files.
|
|
20046
|
+
/** @type {boolean} */ isLockBusy = false;
|
|
20047
|
+
/** @type {boolean} */ isFileLocked = false;
|
|
20048
|
+
/** @type {boolean} */ isRequestInProgress = false;
|
|
20049
|
+
/** @type {function} */ handleLockReleaser = null;
|
|
20050
|
+
/** @type {BroadcastChannel} */ handleRequestChannel;
|
|
20051
|
+
/** @type {boolean} */ isHandleRequested = false;
|
|
20052
|
+
constructor(fileHandle) {
|
|
20053
|
+
this.fileHandle = fileHandle;
|
|
20054
|
+
}
|
|
20055
|
+
}
|
|
20056
|
+
class OPFSCoopSyncVFS extends _journeyapps_wa_sqlite_src_FacadeVFS_js__WEBPACK_IMPORTED_MODULE_0__.FacadeVFS {
|
|
20057
|
+
/** @type {Map<number, File>} */ mapIdToFile = new Map();
|
|
20058
|
+
lastError = null;
|
|
20059
|
+
log = null; //function(...args) { console.log(`[${contextName}]`, ...args) };
|
|
20060
|
+
/** @type {Map<string, PersistentFile>} */ persistentFiles = new Map();
|
|
20061
|
+
/** @type {Map<string, FileSystemSyncAccessHandle>} */ boundAccessHandles = new Map();
|
|
20062
|
+
/** @type {Set<FileSystemSyncAccessHandle>} */ unboundAccessHandles = new Set();
|
|
20063
|
+
/** @type {Set<string>} */ accessiblePaths = new Set();
|
|
20064
|
+
releaser = null;
|
|
20065
|
+
static async create(name, module) {
|
|
20066
|
+
const vfs = new OPFSCoopSyncVFS(name, module);
|
|
20067
|
+
await Promise.all([vfs.isReady(), vfs.#initialize(DEFAULT_TEMPORARY_FILES)]);
|
|
20068
|
+
return vfs;
|
|
20069
|
+
}
|
|
20070
|
+
constructor(name, module) {
|
|
20071
|
+
super(name, module);
|
|
20072
|
+
}
|
|
20073
|
+
async #initialize(nTemporaryFiles) {
|
|
20074
|
+
// Delete temporary directories no longer in use.
|
|
20075
|
+
const root = await navigator.storage.getDirectory();
|
|
20076
|
+
// @ts-ignore
|
|
20077
|
+
for await (const entry of root.values()) {
|
|
20078
|
+
if (entry.kind === 'directory' && entry.name.startsWith('.ahp-')) {
|
|
20079
|
+
// A lock with the same name as the directory protects it from
|
|
20080
|
+
// being deleted.
|
|
20081
|
+
await navigator.locks.request(entry.name, { ifAvailable: true }, async (lock) => {
|
|
20082
|
+
if (lock) {
|
|
20083
|
+
this.log?.(`Deleting temporary directory ${entry.name}`);
|
|
20084
|
+
await root.removeEntry(entry.name, { recursive: true });
|
|
20085
|
+
}
|
|
20086
|
+
else {
|
|
20087
|
+
this.log?.(`Temporary directory ${entry.name} is in use`);
|
|
20088
|
+
}
|
|
20089
|
+
});
|
|
20090
|
+
}
|
|
20091
|
+
}
|
|
20092
|
+
// Create our temporary directory.
|
|
20093
|
+
const tmpDirName = `.ahp-${Math.random().toString(36).slice(2)}`;
|
|
20094
|
+
this.releaser = await new Promise((resolve) => {
|
|
20095
|
+
navigator.locks.request(tmpDirName, () => {
|
|
20096
|
+
return new Promise((release) => {
|
|
20097
|
+
resolve(release);
|
|
20098
|
+
});
|
|
20099
|
+
});
|
|
20100
|
+
});
|
|
20101
|
+
const releaseHandle = async () => {
|
|
20102
|
+
await Promise.all(this.persistentFiles.values().map(async (file) => {
|
|
20103
|
+
try {
|
|
20104
|
+
await this.#releaseAccessHandle(file);
|
|
20105
|
+
}
|
|
20106
|
+
catch (e) {
|
|
20107
|
+
this.log?.('error releasing access handle', e);
|
|
20108
|
+
}
|
|
20109
|
+
finally {
|
|
20110
|
+
release();
|
|
20111
|
+
}
|
|
20112
|
+
}));
|
|
20113
|
+
};
|
|
20114
|
+
finalizationRegistry.register(this, releaseHandle);
|
|
20115
|
+
finalizationRegistry.register(this, this.releaser);
|
|
20116
|
+
const tmpDir = await root.getDirectoryHandle(tmpDirName, { create: true });
|
|
20117
|
+
// Populate temporary directory.
|
|
20118
|
+
for (let i = 0; i < nTemporaryFiles; i++) {
|
|
20119
|
+
const tmpFile = await tmpDir.getFileHandle(`${i}.tmp`, { create: true });
|
|
20120
|
+
const tmpAccessHandle = await tmpFile.createSyncAccessHandle();
|
|
20121
|
+
this.unboundAccessHandles.add(tmpAccessHandle);
|
|
20122
|
+
}
|
|
20123
|
+
}
|
|
20124
|
+
/**
|
|
20125
|
+
* @param {string?} zName
|
|
20126
|
+
* @param {number} fileId
|
|
20127
|
+
* @param {number} flags
|
|
20128
|
+
* @param {DataView} pOutFlags
|
|
20129
|
+
* @returns {number}
|
|
20130
|
+
*/
|
|
20131
|
+
jOpen(zName, fileId, flags, pOutFlags) {
|
|
20132
|
+
try {
|
|
20133
|
+
const url = new URL(zName || Math.random().toString(36).slice(2), 'file://');
|
|
20134
|
+
const path = url.pathname;
|
|
20135
|
+
if (flags & _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OPEN_MAIN_DB) {
|
|
20136
|
+
const persistentFile = this.persistentFiles.get(path);
|
|
20137
|
+
if (persistentFile?.isRequestInProgress) {
|
|
20138
|
+
// Should not reach here unless SQLite itself retries an open.
|
|
20139
|
+
// Otherwise, asynchronous operations started on a previous
|
|
20140
|
+
// open try should have completed.
|
|
20141
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_BUSY;
|
|
20142
|
+
}
|
|
20143
|
+
else if (!persistentFile) {
|
|
20144
|
+
// This is the usual starting point for opening a database.
|
|
20145
|
+
// Register a Promise that resolves when the database and related
|
|
20146
|
+
// files are ready to be used.
|
|
20147
|
+
this.log?.(`creating persistent file for ${path}`);
|
|
20148
|
+
const create = !!(flags & _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OPEN_CREATE);
|
|
20149
|
+
this._module.retryOps.push((async () => {
|
|
20150
|
+
try {
|
|
20151
|
+
// Get the path directory handle.
|
|
20152
|
+
let dirHandle = await navigator.storage.getDirectory();
|
|
20153
|
+
const directories = path.split('/').filter((d) => d);
|
|
20154
|
+
const filename = directories.pop();
|
|
20155
|
+
for (const directory of directories) {
|
|
20156
|
+
dirHandle = await dirHandle.getDirectoryHandle(directory, { create });
|
|
20157
|
+
}
|
|
20158
|
+
// Get file handles for the database and related files,
|
|
20159
|
+
// and create persistent file instances.
|
|
20160
|
+
for (const suffix of DB_RELATED_FILE_SUFFIXES) {
|
|
20161
|
+
const fileHandle = await dirHandle.getFileHandle(filename + suffix, { create });
|
|
20162
|
+
await this.#createPersistentFile(fileHandle);
|
|
20163
|
+
}
|
|
20164
|
+
// Get access handles for the files.
|
|
20165
|
+
const file = new File(path, flags);
|
|
20166
|
+
file.persistentFile = this.persistentFiles.get(path);
|
|
20167
|
+
await this.#requestAccessHandle(file);
|
|
20168
|
+
}
|
|
20169
|
+
catch (e) {
|
|
20170
|
+
// Use an invalid persistent file to signal this error
|
|
20171
|
+
// for the retried open.
|
|
20172
|
+
const persistentFile = new PersistentFile(null);
|
|
20173
|
+
this.persistentFiles.set(path, persistentFile);
|
|
20174
|
+
console.error(e);
|
|
20175
|
+
}
|
|
20176
|
+
})());
|
|
20177
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_BUSY;
|
|
20178
|
+
}
|
|
20179
|
+
else if (!persistentFile.fileHandle) {
|
|
20180
|
+
// The asynchronous open operation failed.
|
|
20181
|
+
this.persistentFiles.delete(path);
|
|
20182
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_CANTOPEN;
|
|
20183
|
+
}
|
|
20184
|
+
else if (!persistentFile.accessHandle) {
|
|
20185
|
+
// This branch is reached if the database was previously opened
|
|
20186
|
+
// and closed.
|
|
20187
|
+
this._module.retryOps.push((async () => {
|
|
20188
|
+
const file = new File(path, flags);
|
|
20189
|
+
file.persistentFile = this.persistentFiles.get(path);
|
|
20190
|
+
await this.#requestAccessHandle(file);
|
|
20191
|
+
})());
|
|
20192
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_BUSY;
|
|
20193
|
+
}
|
|
20194
|
+
}
|
|
20195
|
+
if (!this.accessiblePaths.has(path) && !(flags & _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OPEN_CREATE)) {
|
|
20196
|
+
throw new Error(`File ${path} not found`);
|
|
20197
|
+
}
|
|
20198
|
+
const file = new File(path, flags);
|
|
20199
|
+
this.mapIdToFile.set(fileId, file);
|
|
20200
|
+
if (this.persistentFiles.has(path)) {
|
|
20201
|
+
file.persistentFile = this.persistentFiles.get(path);
|
|
20202
|
+
}
|
|
20203
|
+
else if (this.boundAccessHandles.has(path)) {
|
|
20204
|
+
// This temporary file was previously created and closed. Reopen
|
|
20205
|
+
// the same access handle.
|
|
20206
|
+
file.accessHandle = this.boundAccessHandles.get(path);
|
|
20207
|
+
}
|
|
20208
|
+
else if (this.unboundAccessHandles.size) {
|
|
20209
|
+
// Associate an unbound access handle to this file.
|
|
20210
|
+
file.accessHandle = this.unboundAccessHandles.values().next().value;
|
|
20211
|
+
file.accessHandle.truncate(0);
|
|
20212
|
+
this.unboundAccessHandles.delete(file.accessHandle);
|
|
20213
|
+
this.boundAccessHandles.set(path, file.accessHandle);
|
|
20214
|
+
}
|
|
20215
|
+
this.accessiblePaths.add(path);
|
|
20216
|
+
pOutFlags.setInt32(0, flags, true);
|
|
20217
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
20218
|
+
}
|
|
20219
|
+
catch (e) {
|
|
20220
|
+
this.lastError = e;
|
|
20221
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_CANTOPEN;
|
|
20222
|
+
}
|
|
20223
|
+
}
|
|
20224
|
+
/**
|
|
20225
|
+
* @param {string} zName
|
|
20226
|
+
* @param {number} syncDir
|
|
20227
|
+
* @returns {number}
|
|
20228
|
+
*/
|
|
20229
|
+
jDelete(zName, syncDir) {
|
|
20230
|
+
try {
|
|
20231
|
+
const url = new URL(zName, 'file://');
|
|
20232
|
+
const path = url.pathname;
|
|
20233
|
+
if (this.persistentFiles.has(path)) {
|
|
20234
|
+
const persistentFile = this.persistentFiles.get(path);
|
|
20235
|
+
persistentFile.accessHandle.truncate(0);
|
|
20236
|
+
}
|
|
20237
|
+
else {
|
|
20238
|
+
this.boundAccessHandles.get(path)?.truncate(0);
|
|
20239
|
+
}
|
|
20240
|
+
this.accessiblePaths.delete(path);
|
|
20241
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
20242
|
+
}
|
|
20243
|
+
catch (e) {
|
|
20244
|
+
this.lastError = e;
|
|
20245
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_IOERR_DELETE;
|
|
20246
|
+
}
|
|
20247
|
+
}
|
|
20248
|
+
/**
|
|
20249
|
+
* @param {string} zName
|
|
20250
|
+
* @param {number} flags
|
|
20251
|
+
* @param {DataView} pResOut
|
|
20252
|
+
* @returns {number}
|
|
20253
|
+
*/
|
|
20254
|
+
jAccess(zName, flags, pResOut) {
|
|
20255
|
+
try {
|
|
20256
|
+
const url = new URL(zName, 'file://');
|
|
20257
|
+
const path = url.pathname;
|
|
20258
|
+
pResOut.setInt32(0, this.accessiblePaths.has(path) ? 1 : 0, true);
|
|
20259
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
20260
|
+
}
|
|
20261
|
+
catch (e) {
|
|
20262
|
+
this.lastError = e;
|
|
20263
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_IOERR_ACCESS;
|
|
20264
|
+
}
|
|
20265
|
+
}
|
|
20266
|
+
/**
|
|
20267
|
+
* @param {number} fileId
|
|
20268
|
+
* @returns {number}
|
|
20269
|
+
*/
|
|
20270
|
+
jClose(fileId) {
|
|
20271
|
+
try {
|
|
20272
|
+
const file = this.mapIdToFile.get(fileId);
|
|
20273
|
+
this.mapIdToFile.delete(fileId);
|
|
20274
|
+
if (file?.flags & _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OPEN_MAIN_DB) {
|
|
20275
|
+
if (file.persistentFile?.accessHandle) {
|
|
20276
|
+
this.#releaseAccessHandle(file);
|
|
20277
|
+
}
|
|
20278
|
+
}
|
|
20279
|
+
else if (file?.flags & _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OPEN_DELETEONCLOSE) {
|
|
20280
|
+
file.accessHandle.truncate(0);
|
|
20281
|
+
this.accessiblePaths.delete(file.path);
|
|
20282
|
+
if (!this.persistentFiles.has(file.path)) {
|
|
20283
|
+
this.boundAccessHandles.delete(file.path);
|
|
20284
|
+
this.unboundAccessHandles.add(file.accessHandle);
|
|
20285
|
+
}
|
|
20286
|
+
}
|
|
20287
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
20288
|
+
}
|
|
20289
|
+
catch (e) {
|
|
20290
|
+
this.lastError = e;
|
|
20291
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_IOERR_CLOSE;
|
|
20292
|
+
}
|
|
20293
|
+
}
|
|
20294
|
+
/**
|
|
20295
|
+
* @param {number} fileId
|
|
20296
|
+
* @param {Uint8Array} pData
|
|
20297
|
+
* @param {number} iOffset
|
|
20298
|
+
* @returns {number}
|
|
20299
|
+
*/
|
|
20300
|
+
jRead(fileId, pData, iOffset) {
|
|
20301
|
+
try {
|
|
20302
|
+
const file = this.mapIdToFile.get(fileId);
|
|
20303
|
+
// On Chrome (at least), passing pData to accessHandle.read() is
|
|
20304
|
+
// an error because pData is a Proxy of a Uint8Array. Calling
|
|
20305
|
+
// subarray() produces a real Uint8Array and that works.
|
|
20306
|
+
const accessHandle = file.accessHandle || file.persistentFile.accessHandle;
|
|
20307
|
+
const bytesRead = accessHandle.read(pData.subarray(), { at: iOffset });
|
|
20308
|
+
// Opening a database file performs one read without a xLock call.
|
|
20309
|
+
if (file.flags & _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OPEN_MAIN_DB && !file.persistentFile.isFileLocked) {
|
|
20310
|
+
this.#releaseAccessHandle(file);
|
|
20311
|
+
}
|
|
20312
|
+
if (bytesRead < pData.byteLength) {
|
|
20313
|
+
pData.fill(0, bytesRead);
|
|
20314
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_IOERR_SHORT_READ;
|
|
20315
|
+
}
|
|
20316
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
20317
|
+
}
|
|
20318
|
+
catch (e) {
|
|
20319
|
+
this.lastError = e;
|
|
20320
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_IOERR_READ;
|
|
20321
|
+
}
|
|
20322
|
+
}
|
|
20323
|
+
/**
|
|
20324
|
+
* @param {number} fileId
|
|
20325
|
+
* @param {Uint8Array} pData
|
|
20326
|
+
* @param {number} iOffset
|
|
20327
|
+
* @returns {number}
|
|
20328
|
+
*/
|
|
20329
|
+
jWrite(fileId, pData, iOffset) {
|
|
20330
|
+
try {
|
|
20331
|
+
const file = this.mapIdToFile.get(fileId);
|
|
20332
|
+
// On Chrome (at least), passing pData to accessHandle.write() is
|
|
20333
|
+
// an error because pData is a Proxy of a Uint8Array. Calling
|
|
20334
|
+
// subarray() produces a real Uint8Array and that works.
|
|
20335
|
+
const accessHandle = file.accessHandle || file.persistentFile.accessHandle;
|
|
20336
|
+
const nBytes = accessHandle.write(pData.subarray(), { at: iOffset });
|
|
20337
|
+
if (nBytes !== pData.byteLength)
|
|
20338
|
+
throw new Error('short write');
|
|
20339
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
20340
|
+
}
|
|
20341
|
+
catch (e) {
|
|
20342
|
+
this.lastError = e;
|
|
20343
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_IOERR_WRITE;
|
|
20344
|
+
}
|
|
20345
|
+
}
|
|
20346
|
+
/**
|
|
20347
|
+
* @param {number} fileId
|
|
20348
|
+
* @param {number} iSize
|
|
20349
|
+
* @returns {number}
|
|
20350
|
+
*/
|
|
20351
|
+
jTruncate(fileId, iSize) {
|
|
20352
|
+
try {
|
|
20353
|
+
const file = this.mapIdToFile.get(fileId);
|
|
20354
|
+
const accessHandle = file.accessHandle || file.persistentFile.accessHandle;
|
|
20355
|
+
accessHandle.truncate(iSize);
|
|
20356
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
20357
|
+
}
|
|
20358
|
+
catch (e) {
|
|
20359
|
+
this.lastError = e;
|
|
20360
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_IOERR_TRUNCATE;
|
|
20361
|
+
}
|
|
20362
|
+
}
|
|
20363
|
+
/**
|
|
20364
|
+
* @param {number} fileId
|
|
20365
|
+
* @param {number} flags
|
|
20366
|
+
* @returns {number}
|
|
20367
|
+
*/
|
|
20368
|
+
jSync(fileId, flags) {
|
|
20369
|
+
try {
|
|
20370
|
+
const file = this.mapIdToFile.get(fileId);
|
|
20371
|
+
const accessHandle = file.accessHandle || file.persistentFile.accessHandle;
|
|
20372
|
+
accessHandle.flush();
|
|
20373
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
20374
|
+
}
|
|
20375
|
+
catch (e) {
|
|
20376
|
+
this.lastError = e;
|
|
20377
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_IOERR_FSYNC;
|
|
20378
|
+
}
|
|
20379
|
+
}
|
|
20380
|
+
/**
|
|
20381
|
+
* @param {number} fileId
|
|
20382
|
+
* @param {DataView} pSize64
|
|
20383
|
+
* @returns {number}
|
|
20384
|
+
*/
|
|
20385
|
+
jFileSize(fileId, pSize64) {
|
|
20386
|
+
try {
|
|
20387
|
+
const file = this.mapIdToFile.get(fileId);
|
|
20388
|
+
const accessHandle = file.accessHandle || file.persistentFile.accessHandle;
|
|
20389
|
+
const size = accessHandle.getSize();
|
|
20390
|
+
pSize64.setBigInt64(0, BigInt(size), true);
|
|
20391
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
20392
|
+
}
|
|
20393
|
+
catch (e) {
|
|
20394
|
+
this.lastError = e;
|
|
20395
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_IOERR_FSTAT;
|
|
20396
|
+
}
|
|
20397
|
+
}
|
|
20398
|
+
/**
|
|
20399
|
+
* @param {number} fileId
|
|
20400
|
+
* @param {number} lockType
|
|
20401
|
+
* @returns {number}
|
|
20402
|
+
*/
|
|
20403
|
+
jLock(fileId, lockType) {
|
|
20404
|
+
const file = this.mapIdToFile.get(fileId);
|
|
20405
|
+
if (file.persistentFile.isRequestInProgress) {
|
|
20406
|
+
file.persistentFile.isLockBusy = true;
|
|
20407
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_BUSY;
|
|
20408
|
+
}
|
|
20409
|
+
file.persistentFile.isFileLocked = true;
|
|
20410
|
+
if (!file.persistentFile.handleLockReleaser) {
|
|
20411
|
+
// Start listening for notifications from other connections.
|
|
20412
|
+
// This is before we actually get access handles, but waiting to
|
|
20413
|
+
// listen until then allows a race condition where notifications
|
|
20414
|
+
// are missed.
|
|
20415
|
+
file.persistentFile.handleRequestChannel.onmessage = () => {
|
|
20416
|
+
this.log?.(`received notification for ${file.path}`);
|
|
20417
|
+
if (file.persistentFile.isFileLocked) {
|
|
20418
|
+
// We're still using the access handle, so mark it to be
|
|
20419
|
+
// released when we're done.
|
|
20420
|
+
file.persistentFile.isHandleRequested = true;
|
|
20421
|
+
}
|
|
20422
|
+
else {
|
|
20423
|
+
// Release the access handles immediately.
|
|
20424
|
+
this.#releaseAccessHandle(file);
|
|
20425
|
+
}
|
|
20426
|
+
file.persistentFile.handleRequestChannel.onmessage = null;
|
|
20427
|
+
};
|
|
20428
|
+
this.#requestAccessHandle(file);
|
|
20429
|
+
this.log?.('returning SQLITE_BUSY');
|
|
20430
|
+
file.persistentFile.isLockBusy = true;
|
|
20431
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_BUSY;
|
|
20432
|
+
}
|
|
20433
|
+
file.persistentFile.isLockBusy = false;
|
|
20434
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
20435
|
+
}
|
|
20436
|
+
/**
|
|
20437
|
+
* @param {number} fileId
|
|
20438
|
+
* @param {number} lockType
|
|
20439
|
+
* @returns {number}
|
|
20440
|
+
*/
|
|
20441
|
+
jUnlock(fileId, lockType) {
|
|
20442
|
+
const file = this.mapIdToFile.get(fileId);
|
|
20443
|
+
if (lockType === _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_LOCK_NONE) {
|
|
20444
|
+
// Don't change any state if this unlock is because xLock returned
|
|
20445
|
+
// SQLITE_BUSY.
|
|
20446
|
+
if (!file.persistentFile.isLockBusy) {
|
|
20447
|
+
if (file.persistentFile.isHandleRequested) {
|
|
20448
|
+
// Another connection wants the access handle.
|
|
20449
|
+
this.#releaseAccessHandle(file);
|
|
20450
|
+
file.persistentFile.isHandleRequested = false;
|
|
20451
|
+
}
|
|
20452
|
+
file.persistentFile.isFileLocked = false;
|
|
20453
|
+
}
|
|
20454
|
+
}
|
|
20455
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
20456
|
+
}
|
|
20457
|
+
/**
|
|
20458
|
+
* @param {number} fileId
|
|
20459
|
+
* @param {number} op
|
|
20460
|
+
* @param {DataView} pArg
|
|
20461
|
+
* @returns {number|Promise<number>}
|
|
20462
|
+
*/
|
|
20463
|
+
jFileControl(fileId, op, pArg) {
|
|
20464
|
+
try {
|
|
20465
|
+
const file = this.mapIdToFile.get(fileId);
|
|
20466
|
+
switch (op) {
|
|
20467
|
+
case _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_FCNTL_PRAGMA:
|
|
20468
|
+
const key = extractString(pArg, 4);
|
|
20469
|
+
const value = extractString(pArg, 8);
|
|
20470
|
+
this.log?.('xFileControl', file.path, 'PRAGMA', key, value);
|
|
20471
|
+
switch (key.toLowerCase()) {
|
|
20472
|
+
case 'journal_mode':
|
|
20473
|
+
if (value && !['off', 'memory', 'delete', 'wal'].includes(value.toLowerCase())) {
|
|
20474
|
+
throw new Error('journal_mode must be "off", "memory", "delete", or "wal"');
|
|
20475
|
+
}
|
|
20476
|
+
break;
|
|
20477
|
+
}
|
|
20478
|
+
break;
|
|
20479
|
+
}
|
|
20480
|
+
}
|
|
20481
|
+
catch (e) {
|
|
20482
|
+
this.lastError = e;
|
|
20483
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_IOERR;
|
|
20484
|
+
}
|
|
20485
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_NOTFOUND;
|
|
20486
|
+
}
|
|
20487
|
+
/**
|
|
20488
|
+
* @param {Uint8Array} zBuf
|
|
20489
|
+
* @returns
|
|
20490
|
+
*/
|
|
20491
|
+
jGetLastError(zBuf) {
|
|
20492
|
+
if (this.lastError) {
|
|
20493
|
+
console.error(this.lastError);
|
|
20494
|
+
const outputArray = zBuf.subarray(0, zBuf.byteLength - 1);
|
|
20495
|
+
const { written } = new TextEncoder().encodeInto(this.lastError.message, outputArray);
|
|
20496
|
+
zBuf[written] = 0;
|
|
20497
|
+
}
|
|
20498
|
+
return _journeyapps_wa_sqlite_src_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
20499
|
+
}
|
|
20500
|
+
/**
|
|
20501
|
+
* @param {FileSystemFileHandle} fileHandle
|
|
20502
|
+
* @returns {Promise<PersistentFile>}
|
|
20503
|
+
*/
|
|
20504
|
+
async #createPersistentFile(fileHandle) {
|
|
20505
|
+
const persistentFile = new PersistentFile(fileHandle);
|
|
20506
|
+
const root = await navigator.storage.getDirectory();
|
|
20507
|
+
const relativePath = await root.resolve(fileHandle);
|
|
20508
|
+
const path = `/${relativePath.join('/')}`;
|
|
20509
|
+
persistentFile.handleRequestChannel = new BroadcastChannel(`ahp:${path}`);
|
|
20510
|
+
this.persistentFiles.set(path, persistentFile);
|
|
20511
|
+
const f = await fileHandle.getFile();
|
|
20512
|
+
if (f.size) {
|
|
20513
|
+
this.accessiblePaths.add(path);
|
|
20514
|
+
}
|
|
20515
|
+
return persistentFile;
|
|
20516
|
+
}
|
|
20517
|
+
/**
|
|
20518
|
+
* @param {File} file
|
|
20519
|
+
*/
|
|
20520
|
+
#requestAccessHandle(file) {
|
|
20521
|
+
console.assert(!file.persistentFile.handleLockReleaser);
|
|
20522
|
+
if (!file.persistentFile.isRequestInProgress) {
|
|
20523
|
+
file.persistentFile.isRequestInProgress = true;
|
|
20524
|
+
this._module.retryOps.push((async () => {
|
|
20525
|
+
// Acquire the Web Lock.
|
|
20526
|
+
file.persistentFile.handleLockReleaser = await this.#acquireLock(file.persistentFile);
|
|
20527
|
+
try {
|
|
20528
|
+
// Get access handles for the database and releated files in parallel.
|
|
20529
|
+
this.log?.(`creating access handles for ${file.path}`);
|
|
20530
|
+
await Promise.all(DB_RELATED_FILE_SUFFIXES.map(async (suffix) => {
|
|
20531
|
+
const persistentFile = this.persistentFiles.get(file.path + suffix);
|
|
20532
|
+
if (persistentFile) {
|
|
20533
|
+
persistentFile.accessHandle = await persistentFile.fileHandle.createSyncAccessHandle();
|
|
20534
|
+
}
|
|
20535
|
+
}));
|
|
20536
|
+
}
|
|
20537
|
+
catch (e) {
|
|
20538
|
+
this.log?.(`failed to create access handles for ${file.path}`, e);
|
|
20539
|
+
// Close any of the potentially opened access handles
|
|
20540
|
+
DB_RELATED_FILE_SUFFIXES.forEach(async (suffix) => {
|
|
20541
|
+
const persistentFile = this.persistentFiles.get(file.path + suffix);
|
|
20542
|
+
if (persistentFile) {
|
|
20543
|
+
persistentFile.accessHandle?.close();
|
|
20544
|
+
}
|
|
20545
|
+
});
|
|
20546
|
+
// Release the lock, if we failed here, we'd need to obtain the lock later in order to retry
|
|
20547
|
+
file.persistentFile.handleLockReleaser();
|
|
20548
|
+
throw e;
|
|
20549
|
+
}
|
|
20550
|
+
finally {
|
|
20551
|
+
file.persistentFile.isRequestInProgress = false;
|
|
20552
|
+
}
|
|
20553
|
+
})());
|
|
20554
|
+
return this._module.retryOps.at(-1);
|
|
20555
|
+
}
|
|
20556
|
+
return Promise.resolve();
|
|
20557
|
+
}
|
|
20558
|
+
/**
|
|
20559
|
+
* @param {File} file
|
|
20560
|
+
*/
|
|
20561
|
+
async #releaseAccessHandle(file) {
|
|
20562
|
+
DB_RELATED_FILE_SUFFIXES.forEach(async (suffix) => {
|
|
20563
|
+
const persistentFile = this.persistentFiles.get(file.path + suffix);
|
|
20564
|
+
if (persistentFile) {
|
|
20565
|
+
persistentFile.accessHandle?.close();
|
|
20566
|
+
persistentFile.accessHandle = null;
|
|
20567
|
+
}
|
|
20568
|
+
});
|
|
20569
|
+
this.log?.(`access handles closed for ${file.path}`);
|
|
20570
|
+
file.persistentFile.handleLockReleaser?.();
|
|
20571
|
+
file.persistentFile.handleLockReleaser = null;
|
|
20572
|
+
this.log?.(`lock released for ${file.path}`);
|
|
20573
|
+
}
|
|
20574
|
+
/**
|
|
20575
|
+
* @param {PersistentFile} persistentFile
|
|
20576
|
+
* @returns {Promise<function>} lock releaser
|
|
20577
|
+
*/
|
|
20578
|
+
#acquireLock(persistentFile) {
|
|
20579
|
+
return new Promise((resolve) => {
|
|
20580
|
+
// Tell other connections we want the access handle.
|
|
20581
|
+
const lockName = persistentFile.handleRequestChannel.name;
|
|
20582
|
+
const notify = () => {
|
|
20583
|
+
this.log?.(`notifying for ${lockName}`);
|
|
20584
|
+
persistentFile.handleRequestChannel.postMessage(null);
|
|
20585
|
+
};
|
|
20586
|
+
const notifyId = setInterval(notify, LOCK_NOTIFY_INTERVAL);
|
|
20587
|
+
setTimeout(notify);
|
|
20588
|
+
this.log?.(`lock requested: ${lockName}`);
|
|
20589
|
+
navigator.locks.request(lockName, (lock) => {
|
|
20590
|
+
// We have the lock. Stop asking other connections for it.
|
|
20591
|
+
this.log?.(`lock acquired: ${lockName}`, lock);
|
|
20592
|
+
clearInterval(notifyId);
|
|
20593
|
+
return new Promise(resolve);
|
|
20594
|
+
});
|
|
20595
|
+
});
|
|
20596
|
+
}
|
|
20597
|
+
}
|
|
20598
|
+
function extractString(dataView, offset) {
|
|
20599
|
+
const p = dataView.getUint32(offset, true);
|
|
20600
|
+
if (p) {
|
|
20601
|
+
const chars = new Uint8Array(dataView.buffer, p);
|
|
20602
|
+
return new TextDecoder().decode(chars.subarray(0, chars.indexOf(0)));
|
|
20603
|
+
}
|
|
20604
|
+
return null;
|
|
20605
|
+
}
|
|
20606
|
+
|
|
20607
|
+
|
|
18740
20608
|
/***/ }),
|
|
18741
20609
|
|
|
18742
20610
|
/***/ "./lib/src/worker/sync/BroadcastLogger.js":
|
|
@@ -18992,14 +20860,25 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
18992
20860
|
/**
|
|
18993
20861
|
* Gets the last client port which we know is safe from unexpected closes.
|
|
18994
20862
|
*/
|
|
18995
|
-
|
|
18996
|
-
// Find the last port which is
|
|
18997
|
-
|
|
18998
|
-
|
|
18999
|
-
|
|
20863
|
+
async getLastWrappedPort() {
|
|
20864
|
+
// Find the last port which is not closing
|
|
20865
|
+
return await this.portMutex.runExclusive(() => {
|
|
20866
|
+
for (let i = this.ports.length - 1; i >= 0; i--) {
|
|
20867
|
+
if (!this.ports[i].isClosing) {
|
|
20868
|
+
return this.ports[i];
|
|
20869
|
+
}
|
|
19000
20870
|
}
|
|
19001
|
-
|
|
19002
|
-
|
|
20871
|
+
return;
|
|
20872
|
+
});
|
|
20873
|
+
}
|
|
20874
|
+
/**
|
|
20875
|
+
* In some very rare cases a specific tab might not respond to requests.
|
|
20876
|
+
* This returns a random port which is not closing.
|
|
20877
|
+
*/
|
|
20878
|
+
async getRandomWrappedPort() {
|
|
20879
|
+
return await this.portMutex.runExclusive(() => {
|
|
20880
|
+
return this.ports[Math.floor(Math.random() * this.ports.length)];
|
|
20881
|
+
});
|
|
19003
20882
|
}
|
|
19004
20883
|
async waitForStatus(status) {
|
|
19005
20884
|
return this.withSyncImplementation(async (sync) => {
|
|
@@ -19041,39 +20920,45 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
19041
20920
|
async setParams(params) {
|
|
19042
20921
|
await this.portMutex.runExclusive(async () => {
|
|
19043
20922
|
this.collectActiveSubscriptions();
|
|
19044
|
-
|
|
19045
|
-
|
|
19046
|
-
|
|
19047
|
-
|
|
19048
|
-
|
|
19049
|
-
|
|
19050
|
-
|
|
19051
|
-
|
|
20923
|
+
});
|
|
20924
|
+
if (this.syncParams) {
|
|
20925
|
+
// Cannot modify already existing sync implementation params
|
|
20926
|
+
return;
|
|
20927
|
+
}
|
|
20928
|
+
// First time setting params
|
|
20929
|
+
this.syncParams = params;
|
|
20930
|
+
if (params.streamOptions?.flags?.broadcastLogs) {
|
|
20931
|
+
this.logger = this.broadCastLogger;
|
|
20932
|
+
}
|
|
20933
|
+
const lockedAdapter = new _db_adapters_LockedAsyncDatabaseAdapter__WEBPACK_IMPORTED_MODULE_4__.LockedAsyncDatabaseAdapter({
|
|
20934
|
+
name: params.dbParams.dbFilename,
|
|
20935
|
+
openConnection: async () => {
|
|
20936
|
+
// Gets a connection from the clients when a new connection is requested.
|
|
20937
|
+
const db = await this.openInternalDB();
|
|
20938
|
+
db.registerListener({
|
|
20939
|
+
closing: () => {
|
|
20940
|
+
lockedAdapter.reOpenInternalDB();
|
|
20941
|
+
}
|
|
20942
|
+
});
|
|
20943
|
+
return db;
|
|
20944
|
+
},
|
|
20945
|
+
logger: this.logger,
|
|
20946
|
+
reOpenOnConnectionClosed: true
|
|
20947
|
+
});
|
|
20948
|
+
this.distributedDB = lockedAdapter;
|
|
20949
|
+
await lockedAdapter.init();
|
|
20950
|
+
lockedAdapter.registerListener({
|
|
20951
|
+
databaseReOpened: () => {
|
|
20952
|
+
// We may have missed some table updates while the database was closed.
|
|
20953
|
+
// We can poke the crud in case we missed any updates.
|
|
20954
|
+
this.connectionManager.syncStreamImplementation?.triggerCrudUpload();
|
|
19052
20955
|
}
|
|
19053
|
-
const lockedAdapter = new _db_adapters_LockedAsyncDatabaseAdapter__WEBPACK_IMPORTED_MODULE_4__.LockedAsyncDatabaseAdapter({
|
|
19054
|
-
name: params.dbParams.dbFilename,
|
|
19055
|
-
openConnection: async () => {
|
|
19056
|
-
// Gets a connection from the clients when a new connection is requested.
|
|
19057
|
-
return await this.openInternalDB();
|
|
19058
|
-
},
|
|
19059
|
-
logger: this.logger,
|
|
19060
|
-
reOpenOnConnectionClosed: true
|
|
19061
|
-
});
|
|
19062
|
-
this.distributedDB = lockedAdapter;
|
|
19063
|
-
await lockedAdapter.init();
|
|
19064
|
-
lockedAdapter.registerListener({
|
|
19065
|
-
databaseReOpened: () => {
|
|
19066
|
-
// We may have missed some table updates while the database was closed.
|
|
19067
|
-
// We can poke the crud in case we missed any updates.
|
|
19068
|
-
this.connectionManager.syncStreamImplementation?.triggerCrudUpload();
|
|
19069
|
-
}
|
|
19070
|
-
});
|
|
19071
|
-
self.onerror = (event) => {
|
|
19072
|
-
// Share any uncaught events on the broadcast logger
|
|
19073
|
-
this.logger.error('Uncaught exception in PowerSync shared sync worker', event);
|
|
19074
|
-
};
|
|
19075
|
-
this.iterateListeners((l) => l.initialized?.());
|
|
19076
20956
|
});
|
|
20957
|
+
self.onerror = (event) => {
|
|
20958
|
+
// Share any uncaught events on the broadcast logger
|
|
20959
|
+
this.logger.error('Uncaught exception in PowerSync shared sync worker', event);
|
|
20960
|
+
};
|
|
20961
|
+
this.iterateListeners((l) => l.initialized?.());
|
|
19077
20962
|
}
|
|
19078
20963
|
async dispose() {
|
|
19079
20964
|
await this.waitForReady();
|
|
@@ -19103,7 +20988,6 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
19103
20988
|
clientProvider: comlink__WEBPACK_IMPORTED_MODULE_7__.wrap(port),
|
|
19104
20989
|
currentSubscriptions: [],
|
|
19105
20990
|
closeListeners: [],
|
|
19106
|
-
isProtectedFromClose: false,
|
|
19107
20991
|
isClosing: false
|
|
19108
20992
|
};
|
|
19109
20993
|
this.ports.push(portProvider);
|
|
@@ -19189,7 +21073,7 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
19189
21073
|
adapter: new _powersync_common__WEBPACK_IMPORTED_MODULE_0__.SqliteBucketStorage(this.distributedDB, this.logger),
|
|
19190
21074
|
remote: new _db_sync_WebRemote__WEBPACK_IMPORTED_MODULE_2__.WebRemote({
|
|
19191
21075
|
invalidateCredentials: async () => {
|
|
19192
|
-
const lastPort = this.
|
|
21076
|
+
const lastPort = await this.getLastWrappedPort();
|
|
19193
21077
|
if (!lastPort) {
|
|
19194
21078
|
throw new Error('No client port found to invalidate credentials');
|
|
19195
21079
|
}
|
|
@@ -19202,7 +21086,7 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
19202
21086
|
}
|
|
19203
21087
|
},
|
|
19204
21088
|
fetchCredentials: async () => {
|
|
19205
|
-
const lastPort = this.
|
|
21089
|
+
const lastPort = await this.getLastWrappedPort();
|
|
19206
21090
|
if (!lastPort) {
|
|
19207
21091
|
throw new Error('No client port found to fetch credentials');
|
|
19208
21092
|
}
|
|
@@ -19227,7 +21111,7 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
19227
21111
|
}
|
|
19228
21112
|
}, this.logger),
|
|
19229
21113
|
uploadCrud: async () => {
|
|
19230
|
-
const lastPort = this.
|
|
21114
|
+
const lastPort = await this.getLastWrappedPort();
|
|
19231
21115
|
if (!lastPort) {
|
|
19232
21116
|
throw new Error('No client port found to upload crud');
|
|
19233
21117
|
}
|
|
@@ -19262,11 +21146,15 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
19262
21146
|
async openInternalDB() {
|
|
19263
21147
|
while (true) {
|
|
19264
21148
|
try {
|
|
19265
|
-
const
|
|
19266
|
-
if (!
|
|
21149
|
+
const client = await this.getRandomWrappedPort();
|
|
21150
|
+
if (!client) {
|
|
19267
21151
|
// Should not really happen in practice
|
|
19268
21152
|
throw new Error(`Could not open DB connection since no client is connected.`);
|
|
19269
21153
|
}
|
|
21154
|
+
// Fail-safe timeout for opening a database connection.
|
|
21155
|
+
const timeout = setTimeout(() => {
|
|
21156
|
+
abortController.abort();
|
|
21157
|
+
}, 10_000);
|
|
19270
21158
|
/**
|
|
19271
21159
|
* Handle cases where the client might close while opening a connection.
|
|
19272
21160
|
*/
|
|
@@ -19275,13 +21163,19 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
19275
21163
|
abortController.abort();
|
|
19276
21164
|
};
|
|
19277
21165
|
const removeCloseListener = () => {
|
|
19278
|
-
const index =
|
|
21166
|
+
const index = client.closeListeners.indexOf(closeListener);
|
|
19279
21167
|
if (index >= 0) {
|
|
19280
|
-
|
|
21168
|
+
client.closeListeners.splice(index, 1);
|
|
19281
21169
|
}
|
|
19282
21170
|
};
|
|
19283
|
-
|
|
19284
|
-
const workerPort = await withAbort(
|
|
21171
|
+
client.closeListeners.push(closeListener);
|
|
21172
|
+
const workerPort = await withAbort({
|
|
21173
|
+
action: () => client.clientProvider.getDBWorkerPort(),
|
|
21174
|
+
signal: abortController.signal,
|
|
21175
|
+
cleanupOnAbort: (port) => {
|
|
21176
|
+
port.close();
|
|
21177
|
+
}
|
|
21178
|
+
}).catch((ex) => {
|
|
19285
21179
|
removeCloseListener();
|
|
19286
21180
|
throw ex;
|
|
19287
21181
|
});
|
|
@@ -19293,10 +21187,17 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
19293
21187
|
* We typically execute the closeListeners using the portMutex in a different context.
|
|
19294
21188
|
* We can't rely on the closeListeners to abort the operation if the tab is closed.
|
|
19295
21189
|
*/
|
|
19296
|
-
const db = await withAbort(
|
|
21190
|
+
const db = await withAbort({
|
|
21191
|
+
action: () => remote(this.syncParams.dbParams),
|
|
21192
|
+
signal: abortController.signal,
|
|
21193
|
+
cleanupOnAbort: (db) => {
|
|
21194
|
+
db.close();
|
|
21195
|
+
}
|
|
21196
|
+
}).finally(() => {
|
|
19297
21197
|
// We can remove the close listener here since we no longer need it past this point.
|
|
19298
21198
|
removeCloseListener();
|
|
19299
21199
|
});
|
|
21200
|
+
clearTimeout(timeout);
|
|
19300
21201
|
const wrapped = new _db_adapters_WorkerWrappedAsyncDatabaseConnection__WEBPACK_IMPORTED_MODULE_5__.WorkerWrappedAsyncDatabaseConnection({
|
|
19301
21202
|
remote,
|
|
19302
21203
|
baseConnection: db,
|
|
@@ -19305,15 +21206,15 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
19305
21206
|
// that and ensure pending requests are aborted when the tab is closed.
|
|
19306
21207
|
remoteCanCloseUnexpectedly: true
|
|
19307
21208
|
});
|
|
19308
|
-
|
|
21209
|
+
client.closeListeners.push(async () => {
|
|
19309
21210
|
this.logger.info('Aborting open connection because associated tab closed.');
|
|
19310
21211
|
/**
|
|
19311
21212
|
* Don't await this close operation. It might never resolve if the tab is closed.
|
|
19312
|
-
* We
|
|
19313
|
-
*
|
|
21213
|
+
* We mark the remote as closed first, this will reject any pending requests.
|
|
21214
|
+
* We then call close. The close operation is configured to fire-and-forget, the main promise will reject immediately.
|
|
19314
21215
|
*/
|
|
19315
|
-
wrapped.close().catch((ex) => this.logger.warn('error closing database connection', ex));
|
|
19316
21216
|
wrapped.markRemoteClosed();
|
|
21217
|
+
wrapped.close().catch((ex) => this.logger.warn('error closing database connection', ex));
|
|
19317
21218
|
});
|
|
19318
21219
|
return wrapped;
|
|
19319
21220
|
}
|
|
@@ -19331,23 +21232,12 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
19331
21232
|
this.syncStatus = new _powersync_common__WEBPACK_IMPORTED_MODULE_0__.SyncStatus(status);
|
|
19332
21233
|
this.ports.forEach((p) => p.clientProvider.statusChanged(status));
|
|
19333
21234
|
}
|
|
19334
|
-
/**
|
|
19335
|
-
* A function only used for unit tests which updates the internal
|
|
19336
|
-
* sync stream client and all tab client's sync status
|
|
19337
|
-
*/
|
|
19338
|
-
async _testUpdateAllStatuses(status) {
|
|
19339
|
-
if (!this.connectionManager.syncStreamImplementation) {
|
|
19340
|
-
throw new Error('Cannot update status without a sync stream implementation');
|
|
19341
|
-
}
|
|
19342
|
-
// Only assigning, don't call listeners for this test
|
|
19343
|
-
this.connectionManager.syncStreamImplementation.syncStatus = new _powersync_common__WEBPACK_IMPORTED_MODULE_0__.SyncStatus(status);
|
|
19344
|
-
this.updateAllStatuses(status);
|
|
19345
|
-
}
|
|
19346
21235
|
}
|
|
19347
21236
|
/**
|
|
19348
21237
|
* Runs the action with an abort controller.
|
|
19349
21238
|
*/
|
|
19350
|
-
function withAbort(
|
|
21239
|
+
function withAbort(options) {
|
|
21240
|
+
const { action, signal, cleanupOnAbort } = options;
|
|
19351
21241
|
return new Promise((resolve, reject) => {
|
|
19352
21242
|
if (signal.aborted) {
|
|
19353
21243
|
reject(new _powersync_common__WEBPACK_IMPORTED_MODULE_0__.AbortOperation('Operation aborted by abort controller'));
|
|
@@ -19363,7 +21253,13 @@ function withAbort(action, signal) {
|
|
|
19363
21253
|
action();
|
|
19364
21254
|
}
|
|
19365
21255
|
action()
|
|
19366
|
-
.then((data) =>
|
|
21256
|
+
.then((data) => {
|
|
21257
|
+
// We already rejected due to the abort, allow for cleanup
|
|
21258
|
+
if (signal.aborted) {
|
|
21259
|
+
return completePromise(() => cleanupOnAbort?.(data));
|
|
21260
|
+
}
|
|
21261
|
+
completePromise(() => resolve(data));
|
|
21262
|
+
})
|
|
19367
21263
|
.catch((e) => completePromise(() => reject(e)));
|
|
19368
21264
|
});
|
|
19369
21265
|
}
|
|
@@ -19402,8 +21298,6 @@ class WorkerClient {
|
|
|
19402
21298
|
this.sync = sync;
|
|
19403
21299
|
this.port = port;
|
|
19404
21300
|
comlink__WEBPACK_IMPORTED_MODULE_2__.expose(this, this.port);
|
|
19405
|
-
}
|
|
19406
|
-
async initialize() {
|
|
19407
21301
|
/**
|
|
19408
21302
|
* Adds an extra listener which can remove this port
|
|
19409
21303
|
* from the list of monitored ports.
|
|
@@ -19414,15 +21308,6 @@ class WorkerClient {
|
|
|
19414
21308
|
await this.removePort();
|
|
19415
21309
|
}
|
|
19416
21310
|
});
|
|
19417
|
-
/**
|
|
19418
|
-
* Keep a reference to the resolved port promise.
|
|
19419
|
-
* The init timing is difficult to predict due to the async message passing.
|
|
19420
|
-
* We only want to use a port if we are know it's been protected from being closed.
|
|
19421
|
-
* The lock based close signal will be added asynchronously. We need to use the
|
|
19422
|
-
* added port once the lock is configured.
|
|
19423
|
-
*/
|
|
19424
|
-
this.resolvedPortPromise = this.sync.addPort(this.port);
|
|
19425
|
-
this.resolvedPort = await this.resolvedPortPromise;
|
|
19426
21311
|
}
|
|
19427
21312
|
async removePort() {
|
|
19428
21313
|
if (this.resolvedPort) {
|
|
@@ -19444,19 +21329,9 @@ class WorkerClient {
|
|
|
19444
21329
|
* it can consider the connection to be closed.
|
|
19445
21330
|
*/
|
|
19446
21331
|
async addLockBasedCloseSignal(name) {
|
|
19447
|
-
|
|
19448
|
-
|
|
19449
|
-
|
|
19450
|
-
}
|
|
19451
|
-
else {
|
|
19452
|
-
const wrappedPort = await this.resolvedPortPromise;
|
|
19453
|
-
/**
|
|
19454
|
-
* The client registered a navigator lock. We now can guarantee detecting if the client has closed.
|
|
19455
|
-
* E.g. before this point: It's possible some ports might have been created and closed before the
|
|
19456
|
-
* lock based close signal is added. We should not trust those ports.
|
|
19457
|
-
*/
|
|
19458
|
-
wrappedPort.isProtectedFromClose = true;
|
|
19459
|
-
}
|
|
21332
|
+
// Only add the port once the lock has been obtained on the client.
|
|
21333
|
+
this.resolvedPort = await this.sync.addPort(this.port);
|
|
21334
|
+
// Don't await this lock request
|
|
19460
21335
|
(0,_shared_navigator__WEBPACK_IMPORTED_MODULE_0__.getNavigatorLocks)().request(name, async () => {
|
|
19461
21336
|
await this.removePort();
|
|
19462
21337
|
});
|
|
@@ -19488,9 +21363,6 @@ class WorkerClient {
|
|
|
19488
21363
|
disconnect() {
|
|
19489
21364
|
return this.sync.disconnect();
|
|
19490
21365
|
}
|
|
19491
|
-
async _testUpdateAllStatuses(status) {
|
|
19492
|
-
return this.sync._testUpdateAllStatuses(status);
|
|
19493
|
-
}
|
|
19494
21366
|
}
|
|
19495
21367
|
|
|
19496
21368
|
|
|
@@ -19672,7 +21544,7 @@ logger.useDefaults();
|
|
|
19672
21544
|
const sharedSyncImplementation = new _SharedSyncImplementation__WEBPACK_IMPORTED_MODULE_1__.SharedSyncImplementation();
|
|
19673
21545
|
_self.onconnect = async function (event) {
|
|
19674
21546
|
const port = event.ports[0];
|
|
19675
|
-
|
|
21547
|
+
new _WorkerClient__WEBPACK_IMPORTED_MODULE_2__.WorkerClient(sharedSyncImplementation, port);
|
|
19676
21548
|
};
|
|
19677
21549
|
|
|
19678
21550
|
})();
|