@powersync/web 0.0.0-dev-20260216124709 → 0.0.0-dev-20260225163712
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/0b773f34701fc3938b2f.wasm +0 -0
- package/dist/687fe6480511183aa1de.wasm +0 -0
- package/dist/87c58d5d82e1759b558e.wasm +0 -0
- package/dist/90aaeb7a1019ddabcbd4.wasm +0 -0
- package/dist/_journeyapps_wa-sqlite-_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapp-89f0ba.index.umd.js +70 -70
- package/dist/_journeyapps_wa-sqlite-_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapp-89f0ba.index.umd.js.map +1 -1
- package/dist/{_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530150.index.umd.js → _journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-97ebe9.index.umd.js} +77 -77
- package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-97ebe9.index.umd.js.map +1 -0
- package/dist/index.umd.js +4058 -202
- package/dist/index.umd.js.map +1 -1
- package/dist/worker/SharedSyncImplementation.umd.js +18283 -18255
- package/dist/worker/SharedSyncImplementation.umd.js.map +1 -1
- package/dist/worker/WASQLiteDB.umd.js +16948 -16920
- package/dist/worker/WASQLiteDB.umd.js.map +1 -1
- package/dist/worker/node_modules_pnpm_bson_6_10_4_node_modules_bson_lib_bson_mjs.umd.js.map +1 -1
- package/dist/worker/{node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-3622cf.umd.js → node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--2a0897.umd.js} +18 -18
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--2a0897.umd.js.map +1 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--2cbf50.umd.js +31 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--2cbf50.umd.js.map +1 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--3f11fc.umd.js +3375 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--3f11fc.umd.js.map +1 -0
- package/dist/worker/{node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-1d4e74.umd.js → node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--416f63.umd.js} +20 -20
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--416f63.umd.js.map +1 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--8c697a.umd.js +31 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--8c697a.umd.js.map +1 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--dccfb9.umd.js +31 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--dccfb9.umd.js.map +1 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--f02f25.umd.js +31 -0
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--f02f25.umd.js.map +1 -0
- package/dist/worker/{node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-0d2437.umd.js → node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--f08dda.umd.js} +24 -24
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--f08dda.umd.js.map +1 -0
- package/lib/package.json +3 -3
- package/lib/src/db/adapters/wa-sqlite/InternalWASQLiteDBAdapter.js +4 -2
- package/lib/src/db/adapters/wa-sqlite/WASQLiteConnection.d.ts +10 -1
- package/lib/src/db/adapters/wa-sqlite/WASQLiteConnection.js +36 -21
- package/lib/src/worker/db/open-worker-database.js +2 -2
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/db/adapters/wa-sqlite/InternalWASQLiteDBAdapter.ts +4 -3
- package/src/db/adapters/wa-sqlite/WASQLiteConnection.ts +41 -19
- package/src/worker/db/open-worker-database.ts +2 -2
- package/dist/0b19af1befc07ce338dd.wasm +0 -0
- package/dist/2632c3bda9473da74fd5.wasm +0 -0
- package/dist/64f5351ba3784bfe2f3e.wasm +0 -0
- package/dist/9318ca94aac4d0fe0135.wasm +0 -0
- package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530150.index.umd.js.map +0 -1
- package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530151.index.umd.js +0 -555
- package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-2530151.index.umd.js.map +0 -1
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-3a94cf.umd.js +0 -44
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-3a94cf.umd.js.map +0 -1
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-868779.umd.js +0 -44
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-868779.umd.js.map +0 -1
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_wa-sqli-f60d0d.umd.js +0 -44
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_wa-sqli-f60d0d.umd.js.map +0 -1
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js +0 -44
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs.umd.js.map +0 -1
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-0d2437.umd.js.map +0 -1
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-1d4e74.umd.js.map +0 -1
- package/dist/worker/node_modules_pnpm_journeyapps_wa-sqlite_1_4_1_node_modules_journeyapps_wa-sqlite_src_examples-3622cf.umd.js.map +0 -1
|
@@ -0,0 +1,3375 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
(self["webpackChunksdk_web"] = self["webpackChunksdk_web"] || []).push([["node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--3f11fc"],{
|
|
3
|
+
|
|
4
|
+
/***/ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@0.0.0-dev-20260225162137/node_modules/@journeyapps/wa-sqlite/src/FacadeVFS.js"
|
|
5
|
+
/*!*************************************************************************************************************************************!*\
|
|
6
|
+
!*** ../../node_modules/.pnpm/@journeyapps+wa-sqlite@0.0.0-dev-20260225162137/node_modules/@journeyapps/wa-sqlite/src/FacadeVFS.js ***!
|
|
7
|
+
\*************************************************************************************************************************************/
|
|
8
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
9
|
+
|
|
10
|
+
__webpack_require__.r(__webpack_exports__);
|
|
11
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
12
|
+
/* harmony export */ FacadeVFS: () => (/* binding */ FacadeVFS)
|
|
13
|
+
/* harmony export */ });
|
|
14
|
+
/* harmony import */ var _VFS_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./VFS.js */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@0.0.0-dev-20260225162137/node_modules/@journeyapps/wa-sqlite/src/VFS.js");
|
|
15
|
+
// Copyright 2024 Roy T. Hashimoto. All Rights Reserved.
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
const AsyncFunction = Object.getPrototypeOf(async function(){}).constructor;
|
|
19
|
+
|
|
20
|
+
// Milliseconds since Julian epoch as a BigInt.
|
|
21
|
+
// https://github.com/sqlite/sqlite/blob/e57527c14f7b7cfa6e32eeab5c549d50c4fa3674/src/os_unix.c#L6872-L6882
|
|
22
|
+
const UNIX_EPOCH = 24405875n * 8640000n;
|
|
23
|
+
|
|
24
|
+
// Convenience base class for a JavaScript VFS.
|
|
25
|
+
// The raw xOpen, xRead, etc. function signatures receive only C primitives
|
|
26
|
+
// which aren't easy to work with. This class provides corresponding calls
|
|
27
|
+
// like jOpen, jRead, etc., which receive JavaScript-friendlier arguments
|
|
28
|
+
// such as string, Uint8Array, and DataView.
|
|
29
|
+
class FacadeVFS extends _VFS_js__WEBPACK_IMPORTED_MODULE_0__.Base {
|
|
30
|
+
/**
|
|
31
|
+
* @param {string} name
|
|
32
|
+
* @param {object} module
|
|
33
|
+
*/
|
|
34
|
+
constructor(name, module) {
|
|
35
|
+
super(name, module);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Override to indicate which methods are asynchronous.
|
|
40
|
+
* @param {string} methodName
|
|
41
|
+
* @returns {boolean}
|
|
42
|
+
*/
|
|
43
|
+
hasAsyncMethod(methodName) {
|
|
44
|
+
// The input argument is a string like "xOpen", so convert to "jOpen".
|
|
45
|
+
// Then check if the method exists and is async.
|
|
46
|
+
const jMethodName = `j${methodName.slice(1)}`;
|
|
47
|
+
return this[jMethodName] instanceof AsyncFunction;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Return the filename for a file id for use by mixins.
|
|
52
|
+
* @param {number} pFile
|
|
53
|
+
* @returns {string}
|
|
54
|
+
*/
|
|
55
|
+
getFilename(pFile) {
|
|
56
|
+
throw new Error('unimplemented');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @param {string?} filename
|
|
61
|
+
* @param {number} pFile
|
|
62
|
+
* @param {number} flags
|
|
63
|
+
* @param {DataView} pOutFlags
|
|
64
|
+
* @returns {number|Promise<number>}
|
|
65
|
+
*/
|
|
66
|
+
jOpen(filename, pFile, flags, pOutFlags) {
|
|
67
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CANTOPEN;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @param {string} filename
|
|
72
|
+
* @param {number} syncDir
|
|
73
|
+
* @returns {number|Promise<number>}
|
|
74
|
+
*/
|
|
75
|
+
jDelete(filename, syncDir) {
|
|
76
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* @param {string} filename
|
|
81
|
+
* @param {number} flags
|
|
82
|
+
* @param {DataView} pResOut
|
|
83
|
+
* @returns {number|Promise<number>}
|
|
84
|
+
*/
|
|
85
|
+
jAccess(filename, flags, pResOut) {
|
|
86
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @param {string} filename
|
|
91
|
+
* @param {Uint8Array} zOut
|
|
92
|
+
* @returns {number|Promise<number>}
|
|
93
|
+
*/
|
|
94
|
+
jFullPathname(filename, zOut) {
|
|
95
|
+
// Copy the filename to the output buffer.
|
|
96
|
+
const { read, written } = new TextEncoder().encodeInto(filename, zOut);
|
|
97
|
+
if (read < filename.length) return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR;
|
|
98
|
+
if (written >= zOut.length) return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR;
|
|
99
|
+
zOut[written] = 0;
|
|
100
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @param {Uint8Array} zBuf
|
|
105
|
+
* @returns {number|Promise<number>}
|
|
106
|
+
*/
|
|
107
|
+
jGetLastError(zBuf) {
|
|
108
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @param {number} pFile
|
|
113
|
+
* @returns {number|Promise<number>}
|
|
114
|
+
*/
|
|
115
|
+
jClose(pFile) {
|
|
116
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @param {number} pFile
|
|
121
|
+
* @param {Uint8Array} pData
|
|
122
|
+
* @param {number} iOffset
|
|
123
|
+
* @returns {number|Promise<number>}
|
|
124
|
+
*/
|
|
125
|
+
jRead(pFile, pData, iOffset) {
|
|
126
|
+
pData.fill(0);
|
|
127
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_SHORT_READ;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @param {number} pFile
|
|
132
|
+
* @param {Uint8Array} pData
|
|
133
|
+
* @param {number} iOffset
|
|
134
|
+
* @returns {number|Promise<number>}
|
|
135
|
+
*/
|
|
136
|
+
jWrite(pFile, pData, iOffset) {
|
|
137
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_WRITE;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* @param {number} pFile
|
|
142
|
+
* @param {number} size
|
|
143
|
+
* @returns {number|Promise<number>}
|
|
144
|
+
*/
|
|
145
|
+
jTruncate(pFile, size) {
|
|
146
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* @param {number} pFile
|
|
151
|
+
* @param {number} flags
|
|
152
|
+
* @returns {number|Promise<number>}
|
|
153
|
+
*/
|
|
154
|
+
jSync(pFile, flags) {
|
|
155
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* @param {number} pFile
|
|
160
|
+
* @param {DataView} pSize
|
|
161
|
+
* @returns {number|Promise<number>}
|
|
162
|
+
*/
|
|
163
|
+
jFileSize(pFile, pSize) {
|
|
164
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* @param {number} pFile
|
|
169
|
+
* @param {number} lockType
|
|
170
|
+
* @returns {number|Promise<number>}
|
|
171
|
+
*/
|
|
172
|
+
jLock(pFile, lockType) {
|
|
173
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* @param {number} pFile
|
|
178
|
+
* @param {number} lockType
|
|
179
|
+
* @returns {number|Promise<number>}
|
|
180
|
+
*/
|
|
181
|
+
jUnlock(pFile, lockType) {
|
|
182
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* @param {number} pFile
|
|
187
|
+
* @param {DataView} pResOut
|
|
188
|
+
* @returns {number|Promise<number>}
|
|
189
|
+
*/
|
|
190
|
+
jCheckReservedLock(pFile, pResOut) {
|
|
191
|
+
pResOut.setInt32(0, 0, true);
|
|
192
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* @param {number} pFile
|
|
197
|
+
* @param {number} op
|
|
198
|
+
* @param {DataView} pArg
|
|
199
|
+
* @returns {number|Promise<number>}
|
|
200
|
+
*/
|
|
201
|
+
jFileControl(pFile, op, pArg) {
|
|
202
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_NOTFOUND;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* @param {number} pFile
|
|
207
|
+
* @returns {number|Promise<number>}
|
|
208
|
+
*/
|
|
209
|
+
jSectorSize(pFile) {
|
|
210
|
+
return super.xSectorSize(pFile);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* @param {number} pFile
|
|
215
|
+
* @returns {number|Promise<number>}
|
|
216
|
+
*/
|
|
217
|
+
jDeviceCharacteristics(pFile) {
|
|
218
|
+
return 0;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* @param {number} pVfs
|
|
223
|
+
* @param {number} zName
|
|
224
|
+
* @param {number} pFile
|
|
225
|
+
* @param {number} flags
|
|
226
|
+
* @param {number} pOutFlags
|
|
227
|
+
* @returns {number|Promise<number>}
|
|
228
|
+
*/
|
|
229
|
+
xOpen(pVfs, zName, pFile, flags, pOutFlags) {
|
|
230
|
+
const filename = this.#decodeFilename(zName, flags);
|
|
231
|
+
const pOutFlagsView = this.#makeTypedDataView('Int32', pOutFlags);
|
|
232
|
+
this['log']?.('jOpen', filename, pFile, '0x' + flags.toString(16));
|
|
233
|
+
return this.jOpen(filename, pFile, flags, pOutFlagsView);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* @param {number} pVfs
|
|
238
|
+
* @param {number} nByte
|
|
239
|
+
* @param {number} pCharOut
|
|
240
|
+
* @returns {number|Promise<number>}
|
|
241
|
+
*/
|
|
242
|
+
xRandomness(pVfs, nByte, pCharOut) {
|
|
243
|
+
const randomArray = new Uint8Array(nByte);
|
|
244
|
+
crypto.getRandomValues(randomArray);
|
|
245
|
+
// Copy randomArray to the WebAssembly memory
|
|
246
|
+
const buffer = pCharOut; // Pointer to memory in WebAssembly
|
|
247
|
+
this._module.HEAPU8.set(randomArray, buffer); // Copy randomArray into memory starting at buffer
|
|
248
|
+
return nByte;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Gets the current time as milliseconds since Unix epoch
|
|
253
|
+
* @param {number} pVfs pointer to the VFS
|
|
254
|
+
* @param {number} pTime pointer to write the time value
|
|
255
|
+
* @returns {number} SQLite error code
|
|
256
|
+
*/
|
|
257
|
+
xCurrentTimeInt64(pVfs, pTime) {
|
|
258
|
+
// Create a DataView to write the current time
|
|
259
|
+
const timeView = this.#makeTypedDataView('BigInt64', pTime);
|
|
260
|
+
|
|
261
|
+
const currentTime = BigInt(Date.now());
|
|
262
|
+
// Convert the current time to milliseconds since Unix epoch
|
|
263
|
+
const value = UNIX_EPOCH + currentTime;
|
|
264
|
+
|
|
265
|
+
// Write the time value to the pointer location
|
|
266
|
+
timeView.setBigInt64(0, value, true);
|
|
267
|
+
|
|
268
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* @param {number} pVfs
|
|
273
|
+
* @param {number} zName
|
|
274
|
+
* @param {number} syncDir
|
|
275
|
+
* @returns {number|Promise<number>}
|
|
276
|
+
*/
|
|
277
|
+
xDelete(pVfs, zName, syncDir) {
|
|
278
|
+
const filename = this._module.UTF8ToString(zName);
|
|
279
|
+
this['log']?.('jDelete', filename, syncDir);
|
|
280
|
+
return this.jDelete(filename, syncDir);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* @param {number} pVfs
|
|
285
|
+
* @param {number} zName
|
|
286
|
+
* @param {number} flags
|
|
287
|
+
* @param {number} pResOut
|
|
288
|
+
* @returns {number|Promise<number>}
|
|
289
|
+
*/
|
|
290
|
+
xAccess(pVfs, zName, flags, pResOut) {
|
|
291
|
+
const filename = this._module.UTF8ToString(zName);
|
|
292
|
+
const pResOutView = this.#makeTypedDataView('Int32', pResOut);
|
|
293
|
+
this['log']?.('jAccess', filename, flags);
|
|
294
|
+
return this.jAccess(filename, flags, pResOutView);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* @param {number} pVfs
|
|
299
|
+
* @param {number} zName
|
|
300
|
+
* @param {number} nOut
|
|
301
|
+
* @param {number} zOut
|
|
302
|
+
* @returns {number|Promise<number>}
|
|
303
|
+
*/
|
|
304
|
+
xFullPathname(pVfs, zName, nOut, zOut) {
|
|
305
|
+
const filename = this._module.UTF8ToString(zName);
|
|
306
|
+
const zOutArray = this._module.HEAPU8.subarray(zOut, zOut + nOut);
|
|
307
|
+
this['log']?.('jFullPathname', filename, nOut);
|
|
308
|
+
return this.jFullPathname(filename, zOutArray);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* @param {number} pVfs
|
|
313
|
+
* @param {number} nBuf
|
|
314
|
+
* @param {number} zBuf
|
|
315
|
+
* @returns {number|Promise<number>}
|
|
316
|
+
*/
|
|
317
|
+
xGetLastError(pVfs, nBuf, zBuf) {
|
|
318
|
+
const zBufArray = this._module.HEAPU8.subarray(zBuf, zBuf + nBuf);
|
|
319
|
+
this['log']?.('jGetLastError', nBuf);
|
|
320
|
+
return this.jGetLastError(zBufArray);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* @param {number} pFile
|
|
325
|
+
* @returns {number|Promise<number>}
|
|
326
|
+
*/
|
|
327
|
+
xClose(pFile) {
|
|
328
|
+
this['log']?.('jClose', pFile);
|
|
329
|
+
return this.jClose(pFile);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* @param {number} pFile
|
|
334
|
+
* @param {number} pData
|
|
335
|
+
* @param {number} iAmt
|
|
336
|
+
* @param {number} iOffsetLo
|
|
337
|
+
* @param {number} iOffsetHi
|
|
338
|
+
* @returns {number|Promise<number>}
|
|
339
|
+
*/
|
|
340
|
+
xRead(pFile, pData, iAmt, iOffsetLo, iOffsetHi) {
|
|
341
|
+
const pDataArray = this.#makeDataArray(pData, iAmt);
|
|
342
|
+
const iOffset = delegalize(iOffsetLo, iOffsetHi);
|
|
343
|
+
this['log']?.('jRead', pFile, iAmt, iOffset);
|
|
344
|
+
return this.jRead(pFile, pDataArray, iOffset);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* @param {number} pFile
|
|
349
|
+
* @param {number} pData
|
|
350
|
+
* @param {number} iAmt
|
|
351
|
+
* @param {number} iOffsetLo
|
|
352
|
+
* @param {number} iOffsetHi
|
|
353
|
+
* @returns {number|Promise<number>}
|
|
354
|
+
*/
|
|
355
|
+
xWrite(pFile, pData, iAmt, iOffsetLo, iOffsetHi) {
|
|
356
|
+
const pDataArray = this.#makeDataArray(pData, iAmt);
|
|
357
|
+
const iOffset = delegalize(iOffsetLo, iOffsetHi);
|
|
358
|
+
this['log']?.('jWrite', pFile, pDataArray, iOffset);
|
|
359
|
+
return this.jWrite(pFile, pDataArray, iOffset);
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* @param {number} pFile
|
|
364
|
+
* @param {number} sizeLo
|
|
365
|
+
* @param {number} sizeHi
|
|
366
|
+
* @returns {number|Promise<number>}
|
|
367
|
+
*/
|
|
368
|
+
xTruncate(pFile, sizeLo, sizeHi) {
|
|
369
|
+
const size = delegalize(sizeLo, sizeHi);
|
|
370
|
+
this['log']?.('jTruncate', pFile, size);
|
|
371
|
+
return this.jTruncate(pFile, size);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* @param {number} pFile
|
|
376
|
+
* @param {number} flags
|
|
377
|
+
* @returns {number|Promise<number>}
|
|
378
|
+
*/
|
|
379
|
+
xSync(pFile, flags) {
|
|
380
|
+
this['log']?.('jSync', pFile, flags);
|
|
381
|
+
return this.jSync(pFile, flags);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
*
|
|
386
|
+
* @param {number} pFile
|
|
387
|
+
* @param {number} pSize
|
|
388
|
+
* @returns {number|Promise<number>}
|
|
389
|
+
*/
|
|
390
|
+
xFileSize(pFile, pSize) {
|
|
391
|
+
const pSizeView = this.#makeTypedDataView('BigInt64', pSize);
|
|
392
|
+
this['log']?.('jFileSize', pFile);
|
|
393
|
+
return this.jFileSize(pFile, pSizeView);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* @param {number} pFile
|
|
398
|
+
* @param {number} lockType
|
|
399
|
+
* @returns {number|Promise<number>}
|
|
400
|
+
*/
|
|
401
|
+
xLock(pFile, lockType) {
|
|
402
|
+
this['log']?.('jLock', pFile, lockType);
|
|
403
|
+
return this.jLock(pFile, lockType);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* @param {number} pFile
|
|
408
|
+
* @param {number} lockType
|
|
409
|
+
* @returns {number|Promise<number>}
|
|
410
|
+
*/
|
|
411
|
+
xUnlock(pFile, lockType) {
|
|
412
|
+
this['log']?.('jUnlock', pFile, lockType);
|
|
413
|
+
return this.jUnlock(pFile, lockType);
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* @param {number} pFile
|
|
418
|
+
* @param {number} pResOut
|
|
419
|
+
* @returns {number|Promise<number>}
|
|
420
|
+
*/
|
|
421
|
+
xCheckReservedLock(pFile, pResOut) {
|
|
422
|
+
const pResOutView = this.#makeTypedDataView('Int32', pResOut);
|
|
423
|
+
this['log']?.('jCheckReservedLock', pFile);
|
|
424
|
+
return this.jCheckReservedLock(pFile, pResOutView);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* @param {number} pFile
|
|
429
|
+
* @param {number} op
|
|
430
|
+
* @param {number} pArg
|
|
431
|
+
* @returns {number|Promise<number>}
|
|
432
|
+
*/
|
|
433
|
+
xFileControl(pFile, op, pArg) {
|
|
434
|
+
const pArgView = new DataView(
|
|
435
|
+
this._module.HEAPU8.buffer,
|
|
436
|
+
this._module.HEAPU8.byteOffset + pArg);
|
|
437
|
+
this['log']?.('jFileControl', pFile, op, pArgView);
|
|
438
|
+
return this.jFileControl(pFile, op, pArgView);
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* @param {number} pFile
|
|
443
|
+
* @returns {number|Promise<number>}
|
|
444
|
+
*/
|
|
445
|
+
xSectorSize(pFile) {
|
|
446
|
+
this['log']?.('jSectorSize', pFile);
|
|
447
|
+
return this.jSectorSize(pFile);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* @param {number} pFile
|
|
452
|
+
* @returns {number|Promise<number>}
|
|
453
|
+
*/
|
|
454
|
+
xDeviceCharacteristics(pFile) {
|
|
455
|
+
this['log']?.('jDeviceCharacteristics', pFile);
|
|
456
|
+
return this.jDeviceCharacteristics(pFile);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* Wrapped DataView for pointer arguments.
|
|
461
|
+
* Pointers to a single value are passed using a DataView-like class.
|
|
462
|
+
* This wrapper class prevents use of incorrect type or endianness, and
|
|
463
|
+
* reacquires the underlying buffer when the WebAssembly memory is resized.
|
|
464
|
+
* @param {'Int32'|'BigInt64'} type
|
|
465
|
+
* @param {number} byteOffset
|
|
466
|
+
* @returns {DataView}
|
|
467
|
+
*/
|
|
468
|
+
#makeTypedDataView(type, byteOffset) {
|
|
469
|
+
// @ts-ignore
|
|
470
|
+
return new DataViewProxy(this._module, byteOffset, type);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Wrapped Uint8Array for buffer arguments.
|
|
475
|
+
* Memory blocks are passed as a Uint8Array-like class. This wrapper
|
|
476
|
+
* class reacquires the underlying buffer when the WebAssembly memory
|
|
477
|
+
* is resized.
|
|
478
|
+
* @param {number} byteOffset
|
|
479
|
+
* @param {number} byteLength
|
|
480
|
+
* @returns {Uint8Array}
|
|
481
|
+
*/
|
|
482
|
+
#makeDataArray(byteOffset, byteLength) {
|
|
483
|
+
// @ts-ignore
|
|
484
|
+
return new Uint8ArrayProxy(this._module, byteOffset, byteLength);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
#decodeFilename(zName, flags) {
|
|
488
|
+
if (flags & _VFS_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_URI) {
|
|
489
|
+
// The first null-terminated string is the URI path. Subsequent
|
|
490
|
+
// strings are query parameter keys and values.
|
|
491
|
+
// https://www.sqlite.org/c3ref/open.html#urifilenamesinsqlite3open
|
|
492
|
+
let pName = zName;
|
|
493
|
+
let state = 1;
|
|
494
|
+
const charCodes = [];
|
|
495
|
+
while (state) {
|
|
496
|
+
const charCode = this._module.HEAPU8[pName++];
|
|
497
|
+
if (charCode) {
|
|
498
|
+
charCodes.push(charCode);
|
|
499
|
+
} else {
|
|
500
|
+
if (!this._module.HEAPU8[pName]) state = null;
|
|
501
|
+
switch (state) {
|
|
502
|
+
case 1: // path
|
|
503
|
+
charCodes.push('?'.charCodeAt(0));
|
|
504
|
+
state = 2;
|
|
505
|
+
break;
|
|
506
|
+
case 2: // key
|
|
507
|
+
charCodes.push('='.charCodeAt(0));
|
|
508
|
+
state = 3;
|
|
509
|
+
break;
|
|
510
|
+
case 3: // value
|
|
511
|
+
charCodes.push('&'.charCodeAt(0));
|
|
512
|
+
state = 2;
|
|
513
|
+
break;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
return new TextDecoder().decode(new Uint8Array(charCodes));
|
|
518
|
+
}
|
|
519
|
+
return zName ? this._module.UTF8ToString(zName) : null;
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
// Emscripten "legalizes" 64-bit integer arguments by passing them as
|
|
524
|
+
// two 32-bit signed integers.
|
|
525
|
+
function delegalize(lo32, hi32) {
|
|
526
|
+
return (hi32 * 0x100000000) + lo32 + (lo32 < 0 ? 2**32 : 0);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
// This class provides a Uint8Array-like interface for a WebAssembly memory
|
|
530
|
+
// buffer. It is used to access memory blocks passed as arguments to
|
|
531
|
+
// xRead, xWrite, etc. The class reacquires the underlying buffer when the
|
|
532
|
+
// WebAssembly memory is resized, which can happen when the memory is
|
|
533
|
+
// detached and resized by the WebAssembly module.
|
|
534
|
+
//
|
|
535
|
+
// Note that although this class implements the same methods as Uint8Array,
|
|
536
|
+
// it is not a real Uint8Array and passing it to functions that expect
|
|
537
|
+
// a Uint8Array may not work. Use subarray() to get a real Uint8Array
|
|
538
|
+
// if needed.
|
|
539
|
+
class Uint8ArrayProxy {
|
|
540
|
+
#module;
|
|
541
|
+
|
|
542
|
+
#_array = new Uint8Array()
|
|
543
|
+
get #array() {
|
|
544
|
+
if (this.#_array.buffer.byteLength === 0) {
|
|
545
|
+
// WebAssembly memory resize detached the buffer so re-create the
|
|
546
|
+
// array with the new buffer.
|
|
547
|
+
this.#_array = this.#module.HEAPU8.subarray(
|
|
548
|
+
this.byteOffset,
|
|
549
|
+
this.byteOffset + this.byteLength);
|
|
550
|
+
}
|
|
551
|
+
return this.#_array;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* @param {*} module
|
|
556
|
+
* @param {number} byteOffset
|
|
557
|
+
* @param {number} byteLength
|
|
558
|
+
*/
|
|
559
|
+
constructor(module, byteOffset, byteLength) {
|
|
560
|
+
this.#module = module;
|
|
561
|
+
this.byteOffset = byteOffset;
|
|
562
|
+
this.length = this.byteLength = byteLength;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
get buffer() {
|
|
566
|
+
return this.#array.buffer;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
at(index) {
|
|
570
|
+
return this.#array.at(index);
|
|
571
|
+
}
|
|
572
|
+
copyWithin(target, start, end) {
|
|
573
|
+
this.#array.copyWithin(target, start, end);
|
|
574
|
+
}
|
|
575
|
+
entries() {
|
|
576
|
+
return this.#array.entries();
|
|
577
|
+
}
|
|
578
|
+
every(predicate) {
|
|
579
|
+
return this.#array.every(predicate);
|
|
580
|
+
}
|
|
581
|
+
fill(value, start, end) {
|
|
582
|
+
this.#array.fill(value, start, end);
|
|
583
|
+
}
|
|
584
|
+
filter(predicate) {
|
|
585
|
+
return this.#array.filter(predicate);
|
|
586
|
+
}
|
|
587
|
+
find(predicate) {
|
|
588
|
+
return this.#array.find(predicate);
|
|
589
|
+
}
|
|
590
|
+
findIndex(predicate) {
|
|
591
|
+
return this.#array.findIndex(predicate);
|
|
592
|
+
}
|
|
593
|
+
findLast(predicate) {
|
|
594
|
+
return this.#array.findLast(predicate);
|
|
595
|
+
}
|
|
596
|
+
findLastIndex(predicate) {
|
|
597
|
+
return this.#array.findLastIndex(predicate);
|
|
598
|
+
}
|
|
599
|
+
forEach(callback) {
|
|
600
|
+
this.#array.forEach(callback);
|
|
601
|
+
}
|
|
602
|
+
includes(value, start) {
|
|
603
|
+
return this.#array.includes(value, start);
|
|
604
|
+
}
|
|
605
|
+
indexOf(value, start) {
|
|
606
|
+
return this.#array.indexOf(value, start);
|
|
607
|
+
}
|
|
608
|
+
join(separator) {
|
|
609
|
+
return this.#array.join(separator);
|
|
610
|
+
}
|
|
611
|
+
keys() {
|
|
612
|
+
return this.#array.keys();
|
|
613
|
+
}
|
|
614
|
+
lastIndexOf(value, start) {
|
|
615
|
+
return this.#array.lastIndexOf(value, start);
|
|
616
|
+
}
|
|
617
|
+
map(callback) {
|
|
618
|
+
return this.#array.map(callback);
|
|
619
|
+
}
|
|
620
|
+
reduce(callback, initialValue) {
|
|
621
|
+
return this.#array.reduce(callback, initialValue);
|
|
622
|
+
}
|
|
623
|
+
reduceRight(callback, initialValue) {
|
|
624
|
+
return this.#array.reduceRight(callback, initialValue);
|
|
625
|
+
}
|
|
626
|
+
reverse() {
|
|
627
|
+
this.#array.reverse();
|
|
628
|
+
}
|
|
629
|
+
set(array, offset) {
|
|
630
|
+
this.#array.set(array, offset);
|
|
631
|
+
}
|
|
632
|
+
slice(start, end) {
|
|
633
|
+
return this.#array.slice(start, end);
|
|
634
|
+
}
|
|
635
|
+
some(predicate) {
|
|
636
|
+
return this.#array.some(predicate);
|
|
637
|
+
}
|
|
638
|
+
sort(compareFn) {
|
|
639
|
+
this.#array.sort(compareFn);
|
|
640
|
+
}
|
|
641
|
+
subarray(begin, end) {
|
|
642
|
+
return this.#array.subarray(begin, end);
|
|
643
|
+
}
|
|
644
|
+
toLocaleString(locales, options) {
|
|
645
|
+
// @ts-ignore
|
|
646
|
+
return this.#array.toLocaleString(locales, options);
|
|
647
|
+
}
|
|
648
|
+
toReversed() {
|
|
649
|
+
return this.#array.toReversed();
|
|
650
|
+
}
|
|
651
|
+
toSorted(compareFn) {
|
|
652
|
+
return this.#array.toSorted(compareFn);
|
|
653
|
+
}
|
|
654
|
+
toString() {
|
|
655
|
+
return this.#array.toString();
|
|
656
|
+
}
|
|
657
|
+
values() {
|
|
658
|
+
return this.#array.values();
|
|
659
|
+
}
|
|
660
|
+
with(index, value) {
|
|
661
|
+
return this.#array.with(index, value);
|
|
662
|
+
}
|
|
663
|
+
[Symbol.iterator]() {
|
|
664
|
+
return this.#array[Symbol.iterator]();
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
// This class provides a DataView-like interface for a WebAssembly memory
|
|
669
|
+
// buffer, restricted to either Int32 or BigInt64 types. It also reacquires
|
|
670
|
+
// the underlying buffer when the WebAssembly memory is resized, which can
|
|
671
|
+
// happen when the memory is detached and resized by the WebAssembly module.
|
|
672
|
+
class DataViewProxy {
|
|
673
|
+
#module;
|
|
674
|
+
#type;
|
|
675
|
+
|
|
676
|
+
#_view = new DataView(new ArrayBuffer(0));
|
|
677
|
+
get #view() {
|
|
678
|
+
if (this.#_view.buffer.byteLength === 0) {
|
|
679
|
+
// WebAssembly memory resize detached the buffer so re-create the
|
|
680
|
+
// view with the new buffer.
|
|
681
|
+
this.#_view = new DataView(
|
|
682
|
+
this.#module.HEAPU8.buffer,
|
|
683
|
+
this.#module.HEAPU8.byteOffset + this.byteOffset);
|
|
684
|
+
}
|
|
685
|
+
return this.#_view;
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* @param {*} module
|
|
690
|
+
* @param {number} byteOffset
|
|
691
|
+
* @param {'Int32'|'BigInt64'} type
|
|
692
|
+
*/
|
|
693
|
+
constructor(module, byteOffset, type) {
|
|
694
|
+
this.#module = module;
|
|
695
|
+
this.byteOffset = byteOffset;
|
|
696
|
+
this.#type = type;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
get buffer() {
|
|
700
|
+
return this.#view.buffer;
|
|
701
|
+
}
|
|
702
|
+
get byteLength() {
|
|
703
|
+
return this.#type === 'Int32' ? 4 : 8;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
getInt32(byteOffset, littleEndian) {
|
|
707
|
+
if (this.#type !== 'Int32') {
|
|
708
|
+
throw new Error('invalid type');
|
|
709
|
+
}
|
|
710
|
+
if (!littleEndian) throw new Error('must be little endian');
|
|
711
|
+
return this.#view.getInt32(byteOffset, littleEndian);
|
|
712
|
+
}
|
|
713
|
+
setInt32(byteOffset, value, littleEndian) {
|
|
714
|
+
if (this.#type !== 'Int32') {
|
|
715
|
+
throw new Error('invalid type');
|
|
716
|
+
}
|
|
717
|
+
if (!littleEndian) throw new Error('must be little endian');
|
|
718
|
+
this.#view.setInt32(byteOffset, value, littleEndian);
|
|
719
|
+
}
|
|
720
|
+
getBigInt64(byteOffset, littleEndian) {
|
|
721
|
+
if (this.#type !== 'BigInt64') {
|
|
722
|
+
throw new Error('invalid type');
|
|
723
|
+
}
|
|
724
|
+
if (!littleEndian) throw new Error('must be little endian');
|
|
725
|
+
return this.#view.getBigInt64(byteOffset, littleEndian);
|
|
726
|
+
}
|
|
727
|
+
setBigInt64(byteOffset, value, littleEndian) {
|
|
728
|
+
if (this.#type !== 'BigInt64') {
|
|
729
|
+
throw new Error('invalid type');
|
|
730
|
+
}
|
|
731
|
+
if (!littleEndian) throw new Error('must be little endian');
|
|
732
|
+
this.#view.setBigInt64(byteOffset, value, littleEndian);
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
/***/ },
|
|
737
|
+
|
|
738
|
+
/***/ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@0.0.0-dev-20260225162137/node_modules/@journeyapps/wa-sqlite/src/VFS.js"
|
|
739
|
+
/*!*******************************************************************************************************************************!*\
|
|
740
|
+
!*** ../../node_modules/.pnpm/@journeyapps+wa-sqlite@0.0.0-dev-20260225162137/node_modules/@journeyapps/wa-sqlite/src/VFS.js ***!
|
|
741
|
+
\*******************************************************************************************************************************/
|
|
742
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
743
|
+
|
|
744
|
+
__webpack_require__.r(__webpack_exports__);
|
|
745
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
746
|
+
/* harmony export */ Base: () => (/* binding */ Base),
|
|
747
|
+
/* harmony export */ FILE_TYPE_MASK: () => (/* binding */ FILE_TYPE_MASK),
|
|
748
|
+
/* harmony export */ SQLITE_ABORT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ABORT),
|
|
749
|
+
/* harmony export */ SQLITE_ACCESS_EXISTS: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ACCESS_EXISTS),
|
|
750
|
+
/* harmony export */ SQLITE_ACCESS_READ: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ACCESS_READ),
|
|
751
|
+
/* harmony export */ SQLITE_ACCESS_READWRITE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ACCESS_READWRITE),
|
|
752
|
+
/* harmony export */ SQLITE_ALTER_TABLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ALTER_TABLE),
|
|
753
|
+
/* harmony export */ SQLITE_ANALYZE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ANALYZE),
|
|
754
|
+
/* harmony export */ SQLITE_ATTACH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ATTACH),
|
|
755
|
+
/* harmony export */ SQLITE_AUTH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_AUTH),
|
|
756
|
+
/* harmony export */ SQLITE_BLOB: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_BLOB),
|
|
757
|
+
/* harmony export */ SQLITE_BUSY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_BUSY),
|
|
758
|
+
/* harmony export */ SQLITE_CANTOPEN: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CANTOPEN),
|
|
759
|
+
/* harmony export */ SQLITE_CONSTRAINT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT),
|
|
760
|
+
/* harmony export */ SQLITE_CONSTRAINT_CHECK: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_CHECK),
|
|
761
|
+
/* harmony export */ SQLITE_CONSTRAINT_COMMITHOOK: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_COMMITHOOK),
|
|
762
|
+
/* harmony export */ SQLITE_CONSTRAINT_FOREIGNKEY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_FOREIGNKEY),
|
|
763
|
+
/* harmony export */ SQLITE_CONSTRAINT_FUNCTION: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_FUNCTION),
|
|
764
|
+
/* harmony export */ SQLITE_CONSTRAINT_NOTNULL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_NOTNULL),
|
|
765
|
+
/* harmony export */ SQLITE_CONSTRAINT_PINNED: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_PINNED),
|
|
766
|
+
/* harmony export */ SQLITE_CONSTRAINT_PRIMARYKEY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_PRIMARYKEY),
|
|
767
|
+
/* harmony export */ SQLITE_CONSTRAINT_ROWID: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_ROWID),
|
|
768
|
+
/* harmony export */ SQLITE_CONSTRAINT_TRIGGER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_TRIGGER),
|
|
769
|
+
/* harmony export */ SQLITE_CONSTRAINT_UNIQUE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_UNIQUE),
|
|
770
|
+
/* harmony export */ SQLITE_CONSTRAINT_VTAB: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_VTAB),
|
|
771
|
+
/* harmony export */ SQLITE_COPY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_COPY),
|
|
772
|
+
/* harmony export */ SQLITE_CORRUPT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CORRUPT),
|
|
773
|
+
/* harmony export */ SQLITE_CREATE_INDEX: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CREATE_INDEX),
|
|
774
|
+
/* harmony export */ SQLITE_CREATE_TABLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CREATE_TABLE),
|
|
775
|
+
/* harmony export */ SQLITE_CREATE_TEMP_INDEX: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CREATE_TEMP_INDEX),
|
|
776
|
+
/* harmony export */ SQLITE_CREATE_TEMP_TABLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CREATE_TEMP_TABLE),
|
|
777
|
+
/* harmony export */ SQLITE_CREATE_TEMP_TRIGGER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CREATE_TEMP_TRIGGER),
|
|
778
|
+
/* harmony export */ SQLITE_CREATE_TEMP_VIEW: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CREATE_TEMP_VIEW),
|
|
779
|
+
/* harmony export */ SQLITE_CREATE_TRIGGER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CREATE_TRIGGER),
|
|
780
|
+
/* harmony export */ SQLITE_CREATE_VIEW: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CREATE_VIEW),
|
|
781
|
+
/* harmony export */ SQLITE_CREATE_VTABLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CREATE_VTABLE),
|
|
782
|
+
/* harmony export */ SQLITE_DELETE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DELETE),
|
|
783
|
+
/* harmony export */ SQLITE_DENY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DENY),
|
|
784
|
+
/* harmony export */ SQLITE_DETACH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DETACH),
|
|
785
|
+
/* harmony export */ SQLITE_DETERMINISTIC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DETERMINISTIC),
|
|
786
|
+
/* harmony export */ SQLITE_DIRECTONLY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DIRECTONLY),
|
|
787
|
+
/* harmony export */ SQLITE_DONE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DONE),
|
|
788
|
+
/* harmony export */ SQLITE_DROP_INDEX: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DROP_INDEX),
|
|
789
|
+
/* harmony export */ SQLITE_DROP_TABLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DROP_TABLE),
|
|
790
|
+
/* harmony export */ SQLITE_DROP_TEMP_INDEX: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DROP_TEMP_INDEX),
|
|
791
|
+
/* harmony export */ SQLITE_DROP_TEMP_TABLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DROP_TEMP_TABLE),
|
|
792
|
+
/* harmony export */ SQLITE_DROP_TEMP_TRIGGER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DROP_TEMP_TRIGGER),
|
|
793
|
+
/* harmony export */ SQLITE_DROP_TEMP_VIEW: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DROP_TEMP_VIEW),
|
|
794
|
+
/* harmony export */ SQLITE_DROP_TRIGGER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DROP_TRIGGER),
|
|
795
|
+
/* harmony export */ SQLITE_DROP_VIEW: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DROP_VIEW),
|
|
796
|
+
/* harmony export */ SQLITE_DROP_VTABLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DROP_VTABLE),
|
|
797
|
+
/* harmony export */ SQLITE_EMPTY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_EMPTY),
|
|
798
|
+
/* harmony export */ SQLITE_ERROR: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ERROR),
|
|
799
|
+
/* harmony export */ SQLITE_FCNTL_BEGIN_ATOMIC_WRITE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_BEGIN_ATOMIC_WRITE),
|
|
800
|
+
/* harmony export */ SQLITE_FCNTL_BUSYHANDLER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_BUSYHANDLER),
|
|
801
|
+
/* harmony export */ SQLITE_FCNTL_CHUNK_SIZE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_CHUNK_SIZE),
|
|
802
|
+
/* harmony export */ SQLITE_FCNTL_CKPT_DONE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_CKPT_DONE),
|
|
803
|
+
/* harmony export */ SQLITE_FCNTL_CKPT_START: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_CKPT_START),
|
|
804
|
+
/* harmony export */ SQLITE_FCNTL_COMMIT_ATOMIC_WRITE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_COMMIT_ATOMIC_WRITE),
|
|
805
|
+
/* harmony export */ SQLITE_FCNTL_COMMIT_PHASETWO: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_COMMIT_PHASETWO),
|
|
806
|
+
/* harmony export */ SQLITE_FCNTL_DATA_VERSION: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_DATA_VERSION),
|
|
807
|
+
/* harmony export */ SQLITE_FCNTL_FILE_POINTER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_FILE_POINTER),
|
|
808
|
+
/* harmony export */ SQLITE_FCNTL_GET_LOCKPROXYFILE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_GET_LOCKPROXYFILE),
|
|
809
|
+
/* harmony export */ SQLITE_FCNTL_HAS_MOVED: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_HAS_MOVED),
|
|
810
|
+
/* harmony export */ SQLITE_FCNTL_JOURNAL_POINTER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_JOURNAL_POINTER),
|
|
811
|
+
/* harmony export */ SQLITE_FCNTL_LAST_ERRNO: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_LAST_ERRNO),
|
|
812
|
+
/* harmony export */ SQLITE_FCNTL_LOCKSTATE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_LOCKSTATE),
|
|
813
|
+
/* harmony export */ SQLITE_FCNTL_LOCK_TIMEOUT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_LOCK_TIMEOUT),
|
|
814
|
+
/* harmony export */ SQLITE_FCNTL_MMAP_SIZE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_MMAP_SIZE),
|
|
815
|
+
/* harmony export */ SQLITE_FCNTL_OVERWRITE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_OVERWRITE),
|
|
816
|
+
/* harmony export */ SQLITE_FCNTL_PDB: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_PDB),
|
|
817
|
+
/* harmony export */ SQLITE_FCNTL_PERSIST_WAL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_PERSIST_WAL),
|
|
818
|
+
/* harmony export */ SQLITE_FCNTL_POWERSAFE_OVERWRITE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_POWERSAFE_OVERWRITE),
|
|
819
|
+
/* harmony export */ SQLITE_FCNTL_PRAGMA: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_PRAGMA),
|
|
820
|
+
/* harmony export */ SQLITE_FCNTL_RBU: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_RBU),
|
|
821
|
+
/* harmony export */ SQLITE_FCNTL_RESERVE_BYTES: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_RESERVE_BYTES),
|
|
822
|
+
/* harmony export */ SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE),
|
|
823
|
+
/* harmony export */ SQLITE_FCNTL_SET_LOCKPROXYFILE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_SET_LOCKPROXYFILE),
|
|
824
|
+
/* harmony export */ SQLITE_FCNTL_SIZE_HINT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_SIZE_HINT),
|
|
825
|
+
/* harmony export */ SQLITE_FCNTL_SIZE_LIMIT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_SIZE_LIMIT),
|
|
826
|
+
/* harmony export */ SQLITE_FCNTL_SYNC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_SYNC),
|
|
827
|
+
/* harmony export */ SQLITE_FCNTL_SYNC_OMITTED: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_SYNC_OMITTED),
|
|
828
|
+
/* harmony export */ SQLITE_FCNTL_TEMPFILENAME: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_TEMPFILENAME),
|
|
829
|
+
/* harmony export */ SQLITE_FCNTL_TRACE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_TRACE),
|
|
830
|
+
/* harmony export */ SQLITE_FCNTL_VFSNAME: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_VFSNAME),
|
|
831
|
+
/* harmony export */ SQLITE_FCNTL_VFS_POINTER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_VFS_POINTER),
|
|
832
|
+
/* harmony export */ SQLITE_FCNTL_WAL_BLOCK: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_WAL_BLOCK),
|
|
833
|
+
/* harmony export */ SQLITE_FCNTL_WIN32_AV_RETRY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_WIN32_AV_RETRY),
|
|
834
|
+
/* harmony export */ SQLITE_FCNTL_WIN32_GET_HANDLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_WIN32_GET_HANDLE),
|
|
835
|
+
/* harmony export */ SQLITE_FCNTL_WIN32_SET_HANDLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_WIN32_SET_HANDLE),
|
|
836
|
+
/* harmony export */ SQLITE_FCNTL_ZIPVFS: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_ZIPVFS),
|
|
837
|
+
/* harmony export */ SQLITE_FLOAT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FLOAT),
|
|
838
|
+
/* harmony export */ SQLITE_FORMAT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FORMAT),
|
|
839
|
+
/* harmony export */ SQLITE_FULL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FULL),
|
|
840
|
+
/* harmony export */ SQLITE_FUNCTION: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FUNCTION),
|
|
841
|
+
/* harmony export */ SQLITE_IGNORE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IGNORE),
|
|
842
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_EQ: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_EQ),
|
|
843
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_FUNCTION: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_FUNCTION),
|
|
844
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_GE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_GE),
|
|
845
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_GLOB: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_GLOB),
|
|
846
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_GT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_GT),
|
|
847
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_IS: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_IS),
|
|
848
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_ISNOT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_ISNOT),
|
|
849
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_ISNOTNULL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_ISNOTNULL),
|
|
850
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_ISNULL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_ISNULL),
|
|
851
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_LE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_LE),
|
|
852
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_LIKE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_LIKE),
|
|
853
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_LT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_LT),
|
|
854
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_MATCH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_MATCH),
|
|
855
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_NE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_NE),
|
|
856
|
+
/* harmony export */ SQLITE_INDEX_CONSTRAINT_REGEXP: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_REGEXP),
|
|
857
|
+
/* harmony export */ SQLITE_INDEX_SCAN_UNIQUE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_SCAN_UNIQUE),
|
|
858
|
+
/* harmony export */ SQLITE_INNOCUOUS: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INNOCUOUS),
|
|
859
|
+
/* harmony export */ SQLITE_INSERT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INSERT),
|
|
860
|
+
/* harmony export */ SQLITE_INTEGER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INTEGER),
|
|
861
|
+
/* harmony export */ SQLITE_INTERNAL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INTERNAL),
|
|
862
|
+
/* harmony export */ SQLITE_INTERRUPT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INTERRUPT),
|
|
863
|
+
/* harmony export */ SQLITE_IOCAP_ATOMIC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_ATOMIC),
|
|
864
|
+
/* harmony export */ SQLITE_IOCAP_ATOMIC16K: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_ATOMIC16K),
|
|
865
|
+
/* harmony export */ SQLITE_IOCAP_ATOMIC1K: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_ATOMIC1K),
|
|
866
|
+
/* harmony export */ SQLITE_IOCAP_ATOMIC2K: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_ATOMIC2K),
|
|
867
|
+
/* harmony export */ SQLITE_IOCAP_ATOMIC32K: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_ATOMIC32K),
|
|
868
|
+
/* harmony export */ SQLITE_IOCAP_ATOMIC4K: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_ATOMIC4K),
|
|
869
|
+
/* harmony export */ SQLITE_IOCAP_ATOMIC512: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_ATOMIC512),
|
|
870
|
+
/* harmony export */ SQLITE_IOCAP_ATOMIC64K: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_ATOMIC64K),
|
|
871
|
+
/* harmony export */ SQLITE_IOCAP_ATOMIC8K: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_ATOMIC8K),
|
|
872
|
+
/* harmony export */ SQLITE_IOCAP_BATCH_ATOMIC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_BATCH_ATOMIC),
|
|
873
|
+
/* harmony export */ SQLITE_IOCAP_IMMUTABLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_IMMUTABLE),
|
|
874
|
+
/* harmony export */ SQLITE_IOCAP_POWERSAFE_OVERWRITE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_POWERSAFE_OVERWRITE),
|
|
875
|
+
/* harmony export */ SQLITE_IOCAP_SAFE_APPEND: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_SAFE_APPEND),
|
|
876
|
+
/* harmony export */ SQLITE_IOCAP_SEQUENTIAL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_SEQUENTIAL),
|
|
877
|
+
/* harmony export */ SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN),
|
|
878
|
+
/* harmony export */ SQLITE_IOERR: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR),
|
|
879
|
+
/* harmony export */ SQLITE_IOERR_ACCESS: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_ACCESS),
|
|
880
|
+
/* harmony export */ SQLITE_IOERR_BEGIN_ATOMIC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_BEGIN_ATOMIC),
|
|
881
|
+
/* harmony export */ SQLITE_IOERR_CHECKRESERVEDLOCK: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_CHECKRESERVEDLOCK),
|
|
882
|
+
/* harmony export */ SQLITE_IOERR_CLOSE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_CLOSE),
|
|
883
|
+
/* harmony export */ SQLITE_IOERR_COMMIT_ATOMIC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_COMMIT_ATOMIC),
|
|
884
|
+
/* harmony export */ SQLITE_IOERR_DATA: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_DATA),
|
|
885
|
+
/* harmony export */ SQLITE_IOERR_DELETE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_DELETE),
|
|
886
|
+
/* harmony export */ SQLITE_IOERR_DELETE_NOENT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_DELETE_NOENT),
|
|
887
|
+
/* harmony export */ SQLITE_IOERR_DIR_FSYNC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_DIR_FSYNC),
|
|
888
|
+
/* harmony export */ SQLITE_IOERR_FSTAT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_FSTAT),
|
|
889
|
+
/* harmony export */ SQLITE_IOERR_FSYNC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_FSYNC),
|
|
890
|
+
/* harmony export */ SQLITE_IOERR_GETTEMPPATH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_GETTEMPPATH),
|
|
891
|
+
/* harmony export */ SQLITE_IOERR_LOCK: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_LOCK),
|
|
892
|
+
/* harmony export */ SQLITE_IOERR_NOMEM: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_NOMEM),
|
|
893
|
+
/* harmony export */ SQLITE_IOERR_RDLOCK: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_RDLOCK),
|
|
894
|
+
/* harmony export */ SQLITE_IOERR_READ: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_READ),
|
|
895
|
+
/* harmony export */ SQLITE_IOERR_ROLLBACK_ATOMIC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_ROLLBACK_ATOMIC),
|
|
896
|
+
/* harmony export */ SQLITE_IOERR_SEEK: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_SEEK),
|
|
897
|
+
/* harmony export */ SQLITE_IOERR_SHORT_READ: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_SHORT_READ),
|
|
898
|
+
/* harmony export */ SQLITE_IOERR_TRUNCATE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_TRUNCATE),
|
|
899
|
+
/* harmony export */ SQLITE_IOERR_UNLOCK: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_UNLOCK),
|
|
900
|
+
/* harmony export */ SQLITE_IOERR_VNODE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_VNODE),
|
|
901
|
+
/* harmony export */ SQLITE_IOERR_WRITE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_WRITE),
|
|
902
|
+
/* harmony export */ SQLITE_LIMIT_ATTACHED: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_ATTACHED),
|
|
903
|
+
/* harmony export */ SQLITE_LIMIT_COLUMN: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_COLUMN),
|
|
904
|
+
/* harmony export */ SQLITE_LIMIT_COMPOUND_SELECT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_COMPOUND_SELECT),
|
|
905
|
+
/* harmony export */ SQLITE_LIMIT_EXPR_DEPTH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_EXPR_DEPTH),
|
|
906
|
+
/* harmony export */ SQLITE_LIMIT_FUNCTION_ARG: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_FUNCTION_ARG),
|
|
907
|
+
/* harmony export */ SQLITE_LIMIT_LENGTH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_LENGTH),
|
|
908
|
+
/* harmony export */ SQLITE_LIMIT_LIKE_PATTERN_LENGTH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_LIKE_PATTERN_LENGTH),
|
|
909
|
+
/* harmony export */ SQLITE_LIMIT_SQL_LENGTH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_SQL_LENGTH),
|
|
910
|
+
/* harmony export */ SQLITE_LIMIT_TRIGGER_DEPTH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_TRIGGER_DEPTH),
|
|
911
|
+
/* harmony export */ SQLITE_LIMIT_VARIABLE_NUMBER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_VARIABLE_NUMBER),
|
|
912
|
+
/* harmony export */ SQLITE_LIMIT_VDBE_OP: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_VDBE_OP),
|
|
913
|
+
/* harmony export */ SQLITE_LIMIT_WORKER_THREADS: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_WORKER_THREADS),
|
|
914
|
+
/* harmony export */ SQLITE_LOCKED: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LOCKED),
|
|
915
|
+
/* harmony export */ SQLITE_LOCK_EXCLUSIVE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LOCK_EXCLUSIVE),
|
|
916
|
+
/* harmony export */ SQLITE_LOCK_NONE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LOCK_NONE),
|
|
917
|
+
/* harmony export */ SQLITE_LOCK_PENDING: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LOCK_PENDING),
|
|
918
|
+
/* harmony export */ SQLITE_LOCK_RESERVED: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LOCK_RESERVED),
|
|
919
|
+
/* harmony export */ SQLITE_LOCK_SHARED: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LOCK_SHARED),
|
|
920
|
+
/* harmony export */ SQLITE_MISMATCH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_MISMATCH),
|
|
921
|
+
/* harmony export */ SQLITE_MISUSE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_MISUSE),
|
|
922
|
+
/* harmony export */ SQLITE_NOLFS: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_NOLFS),
|
|
923
|
+
/* harmony export */ SQLITE_NOMEM: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_NOMEM),
|
|
924
|
+
/* harmony export */ SQLITE_NOTADB: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_NOTADB),
|
|
925
|
+
/* harmony export */ SQLITE_NOTFOUND: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_NOTFOUND),
|
|
926
|
+
/* harmony export */ SQLITE_NOTICE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_NOTICE),
|
|
927
|
+
/* harmony export */ SQLITE_NULL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_NULL),
|
|
928
|
+
/* harmony export */ SQLITE_OK: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK),
|
|
929
|
+
/* harmony export */ SQLITE_OPEN_AUTOPROXY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_AUTOPROXY),
|
|
930
|
+
/* harmony export */ SQLITE_OPEN_CREATE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_CREATE),
|
|
931
|
+
/* harmony export */ SQLITE_OPEN_DELETEONCLOSE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_DELETEONCLOSE),
|
|
932
|
+
/* harmony export */ SQLITE_OPEN_EXCLUSIVE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_EXCLUSIVE),
|
|
933
|
+
/* harmony export */ SQLITE_OPEN_FULLMUTEX: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_FULLMUTEX),
|
|
934
|
+
/* harmony export */ SQLITE_OPEN_MAIN_DB: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_MAIN_DB),
|
|
935
|
+
/* harmony export */ SQLITE_OPEN_MAIN_JOURNAL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_MAIN_JOURNAL),
|
|
936
|
+
/* harmony export */ SQLITE_OPEN_MEMORY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_MEMORY),
|
|
937
|
+
/* harmony export */ SQLITE_OPEN_NOFOLLOW: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_NOFOLLOW),
|
|
938
|
+
/* harmony export */ SQLITE_OPEN_NOMUTEX: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_NOMUTEX),
|
|
939
|
+
/* harmony export */ SQLITE_OPEN_PRIVATECACHE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_PRIVATECACHE),
|
|
940
|
+
/* harmony export */ SQLITE_OPEN_READONLY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_READONLY),
|
|
941
|
+
/* harmony export */ SQLITE_OPEN_READWRITE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_READWRITE),
|
|
942
|
+
/* harmony export */ SQLITE_OPEN_SHAREDCACHE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_SHAREDCACHE),
|
|
943
|
+
/* harmony export */ SQLITE_OPEN_SUBJOURNAL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_SUBJOURNAL),
|
|
944
|
+
/* harmony export */ SQLITE_OPEN_SUPER_JOURNAL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_SUPER_JOURNAL),
|
|
945
|
+
/* harmony export */ SQLITE_OPEN_TEMP_DB: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_TEMP_DB),
|
|
946
|
+
/* harmony export */ SQLITE_OPEN_TEMP_JOURNAL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_TEMP_JOURNAL),
|
|
947
|
+
/* harmony export */ SQLITE_OPEN_TRANSIENT_DB: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_TRANSIENT_DB),
|
|
948
|
+
/* harmony export */ SQLITE_OPEN_URI: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_URI),
|
|
949
|
+
/* harmony export */ SQLITE_OPEN_WAL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_WAL),
|
|
950
|
+
/* harmony export */ SQLITE_PERM: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_PERM),
|
|
951
|
+
/* harmony export */ SQLITE_PRAGMA: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_PRAGMA),
|
|
952
|
+
/* harmony export */ SQLITE_PREPARE_NORMALIZED: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_PREPARE_NORMALIZED),
|
|
953
|
+
/* harmony export */ SQLITE_PREPARE_NO_VTAB: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_PREPARE_NO_VTAB),
|
|
954
|
+
/* harmony export */ SQLITE_PREPARE_PERSISTENT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_PREPARE_PERSISTENT),
|
|
955
|
+
/* harmony export */ SQLITE_PROTOCOL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_PROTOCOL),
|
|
956
|
+
/* harmony export */ SQLITE_RANGE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_RANGE),
|
|
957
|
+
/* harmony export */ SQLITE_READ: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_READ),
|
|
958
|
+
/* harmony export */ SQLITE_READONLY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_READONLY),
|
|
959
|
+
/* harmony export */ SQLITE_RECURSIVE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_RECURSIVE),
|
|
960
|
+
/* harmony export */ SQLITE_REINDEX: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_REINDEX),
|
|
961
|
+
/* harmony export */ SQLITE_ROW: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ROW),
|
|
962
|
+
/* harmony export */ SQLITE_SAVEPOINT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_SAVEPOINT),
|
|
963
|
+
/* harmony export */ SQLITE_SCHEMA: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_SCHEMA),
|
|
964
|
+
/* harmony export */ SQLITE_SELECT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_SELECT),
|
|
965
|
+
/* harmony export */ SQLITE_STATIC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_STATIC),
|
|
966
|
+
/* harmony export */ SQLITE_SUBTYPE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_SUBTYPE),
|
|
967
|
+
/* harmony export */ SQLITE_SYNC_DATAONLY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_SYNC_DATAONLY),
|
|
968
|
+
/* harmony export */ SQLITE_SYNC_FULL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_SYNC_FULL),
|
|
969
|
+
/* harmony export */ SQLITE_SYNC_NORMAL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_SYNC_NORMAL),
|
|
970
|
+
/* harmony export */ SQLITE_TEXT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_TEXT),
|
|
971
|
+
/* harmony export */ SQLITE_TOOBIG: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_TOOBIG),
|
|
972
|
+
/* harmony export */ SQLITE_TRANSACTION: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_TRANSACTION),
|
|
973
|
+
/* harmony export */ SQLITE_TRANSIENT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_TRANSIENT),
|
|
974
|
+
/* harmony export */ SQLITE_UPDATE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_UPDATE),
|
|
975
|
+
/* harmony export */ SQLITE_UTF16: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_UTF16),
|
|
976
|
+
/* harmony export */ SQLITE_UTF16BE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_UTF16BE),
|
|
977
|
+
/* harmony export */ SQLITE_UTF16LE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_UTF16LE),
|
|
978
|
+
/* harmony export */ SQLITE_UTF8: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_UTF8),
|
|
979
|
+
/* harmony export */ SQLITE_WARNING: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_WARNING)
|
|
980
|
+
/* harmony export */ });
|
|
981
|
+
/* harmony import */ var _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./sqlite-constants.js */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@0.0.0-dev-20260225162137/node_modules/@journeyapps/wa-sqlite/src/sqlite-constants.js");
|
|
982
|
+
// Copyright 2024 Roy T. Hashimoto. All Rights Reserved.
|
|
983
|
+
|
|
984
|
+
|
|
985
|
+
|
|
986
|
+
const DEFAULT_SECTOR_SIZE = 512;
|
|
987
|
+
|
|
988
|
+
// Base class for a VFS.
|
|
989
|
+
class Base {
|
|
990
|
+
name;
|
|
991
|
+
mxPathname = 64;
|
|
992
|
+
_module;
|
|
993
|
+
|
|
994
|
+
/**
|
|
995
|
+
* @param {string} name
|
|
996
|
+
* @param {object} module
|
|
997
|
+
*/
|
|
998
|
+
constructor(name, module) {
|
|
999
|
+
this.name = name;
|
|
1000
|
+
this._module = module;
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
/**
|
|
1004
|
+
* @returns {void|Promise<void>}
|
|
1005
|
+
*/
|
|
1006
|
+
close() {
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
/**
|
|
1010
|
+
* @returns {boolean|Promise<boolean>}
|
|
1011
|
+
*/
|
|
1012
|
+
isReady() {
|
|
1013
|
+
return true;
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
/**
|
|
1017
|
+
* Overload in subclasses to indicate which methods are asynchronous.
|
|
1018
|
+
* @param {string} methodName
|
|
1019
|
+
* @returns {boolean}
|
|
1020
|
+
*/
|
|
1021
|
+
hasAsyncMethod(methodName) {
|
|
1022
|
+
return false;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
/**
|
|
1026
|
+
* @param {number} pVfs
|
|
1027
|
+
* @param {number} zName
|
|
1028
|
+
* @param {number} pFile
|
|
1029
|
+
* @param {number} flags
|
|
1030
|
+
* @param {number} pOutFlags
|
|
1031
|
+
* @returns {number|Promise<number>}
|
|
1032
|
+
*/
|
|
1033
|
+
xOpen(pVfs, zName, pFile, flags, pOutFlags) {
|
|
1034
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CANTOPEN;
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
/**
|
|
1038
|
+
* @param {number} pVfs
|
|
1039
|
+
* @param {number} zName
|
|
1040
|
+
* @param {number} syncDir
|
|
1041
|
+
* @returns {number|Promise<number>}
|
|
1042
|
+
*/
|
|
1043
|
+
xDelete(pVfs, zName, syncDir) {
|
|
1044
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
/**
|
|
1048
|
+
* @param {number} pVfs
|
|
1049
|
+
* @param {number} zName
|
|
1050
|
+
* @param {number} flags
|
|
1051
|
+
* @param {number} pResOut
|
|
1052
|
+
* @returns {number|Promise<number>}
|
|
1053
|
+
*/
|
|
1054
|
+
xAccess(pVfs, zName, flags, pResOut) {
|
|
1055
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
/**
|
|
1059
|
+
* @param {number} pVfs
|
|
1060
|
+
* @param {number} zName
|
|
1061
|
+
* @param {number} nOut
|
|
1062
|
+
* @param {number} zOut
|
|
1063
|
+
* @returns {number|Promise<number>}
|
|
1064
|
+
*/
|
|
1065
|
+
xFullPathname(pVfs, zName, nOut, zOut) {
|
|
1066
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
/**
|
|
1070
|
+
* @param {number} pVfs
|
|
1071
|
+
* @param {number} nBuf
|
|
1072
|
+
* @param {number} zBuf
|
|
1073
|
+
* @returns {number|Promise<number>}
|
|
1074
|
+
*/
|
|
1075
|
+
xGetLastError(pVfs, nBuf, zBuf) {
|
|
1076
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
/**
|
|
1080
|
+
* @param {number} pFile
|
|
1081
|
+
* @returns {number|Promise<number>}
|
|
1082
|
+
*/
|
|
1083
|
+
xClose(pFile) {
|
|
1084
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
/**
|
|
1088
|
+
* @param {number} pFile
|
|
1089
|
+
* @param {number} pData
|
|
1090
|
+
* @param {number} iAmt
|
|
1091
|
+
* @param {number} iOffsetLo
|
|
1092
|
+
* @param {number} iOffsetHi
|
|
1093
|
+
* @returns {number|Promise<number>}
|
|
1094
|
+
*/
|
|
1095
|
+
xRead(pFile, pData, iAmt, iOffsetLo, iOffsetHi) {
|
|
1096
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
/**
|
|
1100
|
+
* @param {number} pFile
|
|
1101
|
+
* @param {number} pData
|
|
1102
|
+
* @param {number} iAmt
|
|
1103
|
+
* @param {number} iOffsetLo
|
|
1104
|
+
* @param {number} iOffsetHi
|
|
1105
|
+
* @returns {number|Promise<number>}
|
|
1106
|
+
*/
|
|
1107
|
+
xWrite(pFile, pData, iAmt, iOffsetLo, iOffsetHi) {
|
|
1108
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
/**
|
|
1112
|
+
* @param {number} pFile
|
|
1113
|
+
* @param {number} sizeLo
|
|
1114
|
+
* @param {number} sizeHi
|
|
1115
|
+
* @returns {number|Promise<number>}
|
|
1116
|
+
*/
|
|
1117
|
+
xTruncate(pFile, sizeLo, sizeHi) {
|
|
1118
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
/**
|
|
1122
|
+
* @param {number} pFile
|
|
1123
|
+
* @param {number} flags
|
|
1124
|
+
* @returns {number|Promise<number>}
|
|
1125
|
+
*/
|
|
1126
|
+
xSync(pFile, flags) {
|
|
1127
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
/**
|
|
1131
|
+
*
|
|
1132
|
+
* @param {number} pFile
|
|
1133
|
+
* @param {number} pSize
|
|
1134
|
+
* @returns {number|Promise<number>}
|
|
1135
|
+
*/
|
|
1136
|
+
xFileSize(pFile, pSize) {
|
|
1137
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
/**
|
|
1141
|
+
* @param {number} pFile
|
|
1142
|
+
* @param {number} lockType
|
|
1143
|
+
* @returns {number|Promise<number>}
|
|
1144
|
+
*/
|
|
1145
|
+
xLock(pFile, lockType) {
|
|
1146
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
/**
|
|
1150
|
+
* @param {number} pFile
|
|
1151
|
+
* @param {number} lockType
|
|
1152
|
+
* @returns {number|Promise<number>}
|
|
1153
|
+
*/
|
|
1154
|
+
xUnlock(pFile, lockType) {
|
|
1155
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
/**
|
|
1159
|
+
* @param {number} pFile
|
|
1160
|
+
* @param {number} pResOut
|
|
1161
|
+
* @returns {number|Promise<number>}
|
|
1162
|
+
*/
|
|
1163
|
+
xCheckReservedLock(pFile, pResOut) {
|
|
1164
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
/**
|
|
1168
|
+
* @param {number} pFile
|
|
1169
|
+
* @param {number} op
|
|
1170
|
+
* @param {number} pArg
|
|
1171
|
+
* @returns {number|Promise<number>}
|
|
1172
|
+
*/
|
|
1173
|
+
xFileControl(pFile, op, pArg) {
|
|
1174
|
+
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_NOTFOUND;
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
/**
|
|
1178
|
+
* @param {number} pFile
|
|
1179
|
+
* @returns {number|Promise<number>}
|
|
1180
|
+
*/
|
|
1181
|
+
xSectorSize(pFile) {
|
|
1182
|
+
return DEFAULT_SECTOR_SIZE;
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
/**
|
|
1186
|
+
* @param {number} pFile
|
|
1187
|
+
* @returns {number|Promise<number>}
|
|
1188
|
+
*/
|
|
1189
|
+
xDeviceCharacteristics(pFile) {
|
|
1190
|
+
return 0;
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
const FILE_TYPE_MASK = [
|
|
1195
|
+
_sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_MAIN_DB,
|
|
1196
|
+
_sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_MAIN_JOURNAL,
|
|
1197
|
+
_sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_TEMP_DB,
|
|
1198
|
+
_sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_TEMP_JOURNAL,
|
|
1199
|
+
_sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_TRANSIENT_DB,
|
|
1200
|
+
_sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_SUBJOURNAL,
|
|
1201
|
+
_sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_SUPER_JOURNAL,
|
|
1202
|
+
_sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_WAL
|
|
1203
|
+
].reduce((mask, element) => mask | element);
|
|
1204
|
+
|
|
1205
|
+
/***/ },
|
|
1206
|
+
|
|
1207
|
+
/***/ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@0.0.0-dev-20260225162137/node_modules/@journeyapps/wa-sqlite/src/examples/LazyLock.js"
|
|
1208
|
+
/*!*********************************************************************************************************************************************!*\
|
|
1209
|
+
!*** ../../node_modules/.pnpm/@journeyapps+wa-sqlite@0.0.0-dev-20260225162137/node_modules/@journeyapps/wa-sqlite/src/examples/LazyLock.js ***!
|
|
1210
|
+
\*********************************************************************************************************************************************/
|
|
1211
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1212
|
+
|
|
1213
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1214
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1215
|
+
/* harmony export */ LazyLock: () => (/* binding */ LazyLock)
|
|
1216
|
+
/* harmony export */ });
|
|
1217
|
+
/* harmony import */ var _Lock_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Lock.js */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@0.0.0-dev-20260225162137/node_modules/@journeyapps/wa-sqlite/src/examples/Lock.js");
|
|
1218
|
+
|
|
1219
|
+
|
|
1220
|
+
class LazyLock extends _Lock_js__WEBPACK_IMPORTED_MODULE_0__.Lock {
|
|
1221
|
+
#channel;
|
|
1222
|
+
#isBusy = false;
|
|
1223
|
+
#hasReleaseRequest = false;
|
|
1224
|
+
|
|
1225
|
+
/**
|
|
1226
|
+
* @param {string} name
|
|
1227
|
+
*/
|
|
1228
|
+
constructor(name) {
|
|
1229
|
+
super(name);
|
|
1230
|
+
this.#channel = new BroadcastChannel(name);
|
|
1231
|
+
this.#channel.onmessage = (event) => {
|
|
1232
|
+
if (this.#isBusy) {
|
|
1233
|
+
// We're using the lock so postpone the release.
|
|
1234
|
+
this.#hasReleaseRequest = true;
|
|
1235
|
+
} else {
|
|
1236
|
+
this.release();
|
|
1237
|
+
}
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
close() {
|
|
1242
|
+
super.close
|
|
1243
|
+
this.#channel.onmessage = null;
|
|
1244
|
+
this.#channel.close();
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
/**
|
|
1248
|
+
* @param {LockMode} mode
|
|
1249
|
+
* @param {number} timeout
|
|
1250
|
+
* @returns {Promise<boolean>}
|
|
1251
|
+
*/
|
|
1252
|
+
async acquire(mode, timeout = -1) {
|
|
1253
|
+
this.#isBusy = true;
|
|
1254
|
+
try {
|
|
1255
|
+
if (mode === this.mode) {
|
|
1256
|
+
// We never had to release the lock.
|
|
1257
|
+
return true;
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
if (this.mode) {
|
|
1261
|
+
// Release the lock to acquire it in a different mode.
|
|
1262
|
+
super.release();
|
|
1263
|
+
} else {
|
|
1264
|
+
// Poll for the lock. This isn't necessary but if it works it avoids
|
|
1265
|
+
// the BroadcastChannel traffic.
|
|
1266
|
+
if (await super.acquire(mode, 0)) {
|
|
1267
|
+
return true;
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
// Request the lock.
|
|
1272
|
+
const pResult = super.acquire(mode, timeout)
|
|
1273
|
+
this.#channel.postMessage({});
|
|
1274
|
+
|
|
1275
|
+
return await pResult;
|
|
1276
|
+
} catch (e) {
|
|
1277
|
+
this.release();
|
|
1278
|
+
throw e;
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
/**
|
|
1283
|
+
* @param {LockMode} mode
|
|
1284
|
+
* @returns {boolean}
|
|
1285
|
+
*/
|
|
1286
|
+
acquireIfHeld(mode) {
|
|
1287
|
+
if (mode === this.mode) {
|
|
1288
|
+
this.#isBusy = true;
|
|
1289
|
+
return true;
|
|
1290
|
+
}
|
|
1291
|
+
return false;
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
release() {
|
|
1295
|
+
super.release();
|
|
1296
|
+
this.#isBusy = false;
|
|
1297
|
+
this.#hasReleaseRequest = false;
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
releaseLazy() {
|
|
1301
|
+
// Release the lock only if someone else wants it.
|
|
1302
|
+
this.#isBusy = false;
|
|
1303
|
+
if (this.#hasReleaseRequest) {
|
|
1304
|
+
this.release();
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
/***/ },
|
|
1310
|
+
|
|
1311
|
+
/***/ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@0.0.0-dev-20260225162137/node_modules/@journeyapps/wa-sqlite/src/examples/Lock.js"
|
|
1312
|
+
/*!*****************************************************************************************************************************************!*\
|
|
1313
|
+
!*** ../../node_modules/.pnpm/@journeyapps+wa-sqlite@0.0.0-dev-20260225162137/node_modules/@journeyapps/wa-sqlite/src/examples/Lock.js ***!
|
|
1314
|
+
\*****************************************************************************************************************************************/
|
|
1315
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1316
|
+
|
|
1317
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1318
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1319
|
+
/* harmony export */ Lock: () => (/* binding */ Lock)
|
|
1320
|
+
/* harmony export */ });
|
|
1321
|
+
// This is a convenience wrapper for the Web Locks API.
|
|
1322
|
+
class Lock {
|
|
1323
|
+
#name;
|
|
1324
|
+
/** @type {LockMode?} */ #mode = null;
|
|
1325
|
+
#releaser = null;
|
|
1326
|
+
|
|
1327
|
+
/**
|
|
1328
|
+
* @param {string} name
|
|
1329
|
+
*/
|
|
1330
|
+
constructor(name) {
|
|
1331
|
+
this.#name = name;
|
|
1332
|
+
}
|
|
1333
|
+
|
|
1334
|
+
get name() { return this.#name; }
|
|
1335
|
+
get mode() { return this.#mode; }
|
|
1336
|
+
|
|
1337
|
+
close() {
|
|
1338
|
+
this.release();
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
/**
|
|
1342
|
+
* @param {'shared'|'exclusive'} mode
|
|
1343
|
+
* @param {number} timeout -1 for infinite, 0 for poll, >0 for milliseconds
|
|
1344
|
+
* @return {Promise<boolean>} true if lock acquired, false on failed poll
|
|
1345
|
+
*/
|
|
1346
|
+
async acquire(mode, timeout = -1) {
|
|
1347
|
+
if (this.#releaser) {
|
|
1348
|
+
throw new Error(`Lock ${this.#name} is already acquired`);
|
|
1349
|
+
}
|
|
1350
|
+
return new Promise((resolve, reject) => {
|
|
1351
|
+
/** @type {LockOptions} */
|
|
1352
|
+
const options = { mode, ifAvailable: timeout === 0 };
|
|
1353
|
+
let timeoutId;
|
|
1354
|
+
if (timeout > 0) {
|
|
1355
|
+
const abortController = new AbortController();
|
|
1356
|
+
timeoutId = self.setTimeout(() => {
|
|
1357
|
+
abortController.abort();
|
|
1358
|
+
}, timeout);
|
|
1359
|
+
options.signal = abortController.signal;
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
navigator.locks.request(this.#name, options, lock => {
|
|
1363
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
1364
|
+
if (lock === null) {
|
|
1365
|
+
// Polling (with timeout = 0) did not acquire the lock.
|
|
1366
|
+
return resolve(false);
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
// Lock acquired. The lock is released when this returned
|
|
1370
|
+
// Promise is resolved.
|
|
1371
|
+
this.#mode = mode;
|
|
1372
|
+
return new Promise(releaser => {
|
|
1373
|
+
this.#releaser = releaser;
|
|
1374
|
+
resolve(true);
|
|
1375
|
+
})
|
|
1376
|
+
}).catch(e => {
|
|
1377
|
+
return reject(e);
|
|
1378
|
+
});
|
|
1379
|
+
});
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
release() {
|
|
1383
|
+
this.#releaser?.();
|
|
1384
|
+
this.#releaser = null;
|
|
1385
|
+
this.#mode = null;
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
|
|
1390
|
+
/***/ },
|
|
1391
|
+
|
|
1392
|
+
/***/ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@0.0.0-dev-20260225162137/node_modules/@journeyapps/wa-sqlite/src/examples/OPFSWriteAheadVFS.js"
|
|
1393
|
+
/*!******************************************************************************************************************************************************!*\
|
|
1394
|
+
!*** ../../node_modules/.pnpm/@journeyapps+wa-sqlite@0.0.0-dev-20260225162137/node_modules/@journeyapps/wa-sqlite/src/examples/OPFSWriteAheadVFS.js ***!
|
|
1395
|
+
\******************************************************************************************************************************************************/
|
|
1396
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1397
|
+
|
|
1398
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1399
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1400
|
+
/* harmony export */ OPFSWriteAheadVFS: () => (/* binding */ OPFSWriteAheadVFS)
|
|
1401
|
+
/* harmony export */ });
|
|
1402
|
+
/* harmony import */ var _FacadeVFS_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../FacadeVFS.js */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@0.0.0-dev-20260225162137/node_modules/@journeyapps/wa-sqlite/src/FacadeVFS.js");
|
|
1403
|
+
/* harmony import */ var _VFS_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../VFS.js */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@0.0.0-dev-20260225162137/node_modules/@journeyapps/wa-sqlite/src/VFS.js");
|
|
1404
|
+
/* harmony import */ var _Lock_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Lock.js */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@0.0.0-dev-20260225162137/node_modules/@journeyapps/wa-sqlite/src/examples/Lock.js");
|
|
1405
|
+
/* harmony import */ var _LazyLock_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./LazyLock.js */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@0.0.0-dev-20260225162137/node_modules/@journeyapps/wa-sqlite/src/examples/LazyLock.js");
|
|
1406
|
+
/* harmony import */ var _WriteAhead_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./WriteAhead.js */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@0.0.0-dev-20260225162137/node_modules/@journeyapps/wa-sqlite/src/examples/WriteAhead.js");
|
|
1407
|
+
|
|
1408
|
+
|
|
1409
|
+
|
|
1410
|
+
|
|
1411
|
+
|
|
1412
|
+
|
|
1413
|
+
const LIBRARY_FILES_ROOT = '.wa-sqlite';
|
|
1414
|
+
const DEFAULT_TEMP_FILES = 6;
|
|
1415
|
+
|
|
1416
|
+
const finalizationRegistry = new FinalizationRegistry((/** @type {() => void} */ f) => f());
|
|
1417
|
+
|
|
1418
|
+
/**
|
|
1419
|
+
* @typedef FileEntry
|
|
1420
|
+
* @property {string} zName
|
|
1421
|
+
* @property {number} flags
|
|
1422
|
+
* @property {FileSystemSyncAccessHandle} [accessHandle]
|
|
1423
|
+
|
|
1424
|
+
* Main database file properties:
|
|
1425
|
+
* @property {*} [retryResult]
|
|
1426
|
+
* @property {FileSystemSyncAccessHandle} [waHandle]
|
|
1427
|
+
* @property {FileSystemSyncAccessHandle} [journalHandle]
|
|
1428
|
+
*
|
|
1429
|
+
* @property {boolean} [useWriteAhead]
|
|
1430
|
+
* @property {'reserved'|'exclusive'} [writeHint]
|
|
1431
|
+
* @property {'normal'|'exclusive'|null} [lockingMode]
|
|
1432
|
+
* @property {number} [lockState] SQLITE_LOCK_*
|
|
1433
|
+
* @property {LazyLock} [readLock]
|
|
1434
|
+
* @property {Lock} [writeLock]
|
|
1435
|
+
* @property {number} [timeout]
|
|
1436
|
+
*
|
|
1437
|
+
* @property {WriteAhead} [writeAhead]
|
|
1438
|
+
*/
|
|
1439
|
+
|
|
1440
|
+
/**
|
|
1441
|
+
* @typedef OPFSWriteAheadOptions
|
|
1442
|
+
* @property {number} [nTmpFiles]
|
|
1443
|
+
* @property {number} [autoCheckpointPages]
|
|
1444
|
+
* @property {number} [heartbeatInterval]
|
|
1445
|
+
* @property {number} [heartbeatActionDelay]
|
|
1446
|
+
*/
|
|
1447
|
+
|
|
1448
|
+
class OPFSWriteAheadVFS extends _FacadeVFS_js__WEBPACK_IMPORTED_MODULE_0__.FacadeVFS {
|
|
1449
|
+
lastError = null;
|
|
1450
|
+
log = null;
|
|
1451
|
+
|
|
1452
|
+
/** @type {Map<number, FileEntry>} */ mapIdToFile = new Map();
|
|
1453
|
+
/** @type {Map<string, FileEntry>} */ mapPathToFile = new Map();
|
|
1454
|
+
|
|
1455
|
+
/** @type {Map<string, FileSystemSyncAccessHandle>} */ boundTempFiles = new Map();
|
|
1456
|
+
/** @type {Set<FileSystemSyncAccessHandle>} */ unboundTempFiles = new Set();
|
|
1457
|
+
/** @type {OPFSWriteAheadOptions} */ options = {
|
|
1458
|
+
nTmpFiles: DEFAULT_TEMP_FILES
|
|
1459
|
+
};
|
|
1460
|
+
|
|
1461
|
+
_ready;
|
|
1462
|
+
|
|
1463
|
+
static async create(name, module, options) {
|
|
1464
|
+
const vfs = new OPFSWriteAheadVFS(name, module);
|
|
1465
|
+
Object.assign(vfs.options, options);
|
|
1466
|
+
await vfs.isReady();
|
|
1467
|
+
return vfs;
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
constructor(name, module) {
|
|
1471
|
+
super(name, module);
|
|
1472
|
+
this._ready = (async () => {
|
|
1473
|
+
// Ensure the library files root directory exists.
|
|
1474
|
+
let dirHandle = await navigator.storage.getDirectory();
|
|
1475
|
+
dirHandle = await dirHandle.getDirectoryHandle(LIBRARY_FILES_ROOT, { create: true });
|
|
1476
|
+
|
|
1477
|
+
// Clean up any stale session directories.
|
|
1478
|
+
// @ts-ignore
|
|
1479
|
+
for await (const name of dirHandle.keys()) {
|
|
1480
|
+
if (name.startsWith('.session-')) {
|
|
1481
|
+
// Acquire a lock on the session directory to ensure it is not in use.
|
|
1482
|
+
await navigator.locks.request(name, { ifAvailable: true }, async lock => {
|
|
1483
|
+
if (lock) {
|
|
1484
|
+
// This directory is not in use.
|
|
1485
|
+
try {
|
|
1486
|
+
await dirHandle.removeEntry(name, { recursive: true });
|
|
1487
|
+
} catch (e) {
|
|
1488
|
+
// Ignore errors, will try again next time.
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
});
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
// Create our session directory.
|
|
1496
|
+
const dirName = `.session-${Math.random().toString(16).slice(2)}`;
|
|
1497
|
+
await new Promise(resolve => {
|
|
1498
|
+
navigator.locks.request(dirName, () => {
|
|
1499
|
+
// @ts-ignore
|
|
1500
|
+
resolve();
|
|
1501
|
+
return new Promise(release => {
|
|
1502
|
+
// @ts-ignore
|
|
1503
|
+
finalizationRegistry.register(this, release);
|
|
1504
|
+
});
|
|
1505
|
+
});
|
|
1506
|
+
});
|
|
1507
|
+
dirHandle = await dirHandle.getDirectoryHandle(dirName, { create: true });
|
|
1508
|
+
|
|
1509
|
+
// Create temporary files.
|
|
1510
|
+
for (let i = 0; i < this.options.nTmpFiles; i++) {
|
|
1511
|
+
const fileHandle= await dirHandle.getFileHandle(i.toString(), { create: true });
|
|
1512
|
+
const accessHandle = await fileHandle.createSyncAccessHandle();
|
|
1513
|
+
finalizationRegistry.register(this, () => accessHandle.close());
|
|
1514
|
+
this.unboundTempFiles.add(accessHandle);
|
|
1515
|
+
}
|
|
1516
|
+
})();
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
isReady() {
|
|
1520
|
+
return Promise.all([super.isReady(), this._ready]).then(() => true);
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
/**
|
|
1524
|
+
* @param {string?} zName
|
|
1525
|
+
* @param {number} fileId
|
|
1526
|
+
* @param {number} flags
|
|
1527
|
+
* @param {DataView} pOutFlags
|
|
1528
|
+
* @returns {number}
|
|
1529
|
+
*/
|
|
1530
|
+
jOpen(zName, fileId, flags, pOutFlags) {
|
|
1531
|
+
try {
|
|
1532
|
+
if (zName === null) {
|
|
1533
|
+
// Generate a temporary filename. This will only be used as a
|
|
1534
|
+
// key to map to a pre-opened temporary file access handle.
|
|
1535
|
+
zName = Math.random().toString(16).slice(2);
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
const file = this.mapPathToFile.get(zName) ?? {
|
|
1539
|
+
zName,
|
|
1540
|
+
flags,
|
|
1541
|
+
retryResult: null,
|
|
1542
|
+
};
|
|
1543
|
+
this.mapPathToFile.set(zName, file);
|
|
1544
|
+
|
|
1545
|
+
if (flags & _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OPEN_MAIN_DB) {
|
|
1546
|
+
// Open database and journal files with a retry operation.
|
|
1547
|
+
if (file.retryResult === null) {
|
|
1548
|
+
// This is the initial open attempt. Start the asynchronous task
|
|
1549
|
+
// and return SQLITE_BUSY to force a retry.
|
|
1550
|
+
this._module.retryOps.push(this.#retryOpen(zName, flags, fileId, pOutFlags));
|
|
1551
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_BUSY;
|
|
1552
|
+
} else if (file.retryResult instanceof Error) {
|
|
1553
|
+
throw file.retryResult;
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
// Initialize database file state.
|
|
1557
|
+
file.accessHandle = file.retryResult.accessHandle;
|
|
1558
|
+
file.journalHandle = file.retryResult.journalHandle;
|
|
1559
|
+
file.writeAhead = file.retryResult.writeAhead;
|
|
1560
|
+
file.retryResult = null;
|
|
1561
|
+
|
|
1562
|
+
file.lockState = _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_LOCK_NONE;
|
|
1563
|
+
file.lockingMode = null;
|
|
1564
|
+
file.readLock = new _LazyLock_js__WEBPACK_IMPORTED_MODULE_3__.LazyLock(`${zName}#read`);
|
|
1565
|
+
file.writeLock = new _Lock_js__WEBPACK_IMPORTED_MODULE_2__.Lock(`${zName}#write`);
|
|
1566
|
+
file.timeout = -1;
|
|
1567
|
+
file.useWriteAhead = true;
|
|
1568
|
+
file.writeHint = null;
|
|
1569
|
+
} else if (flags & _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OPEN_MAIN_JOURNAL) {
|
|
1570
|
+
// A journal file is managed with its main database so look that up.
|
|
1571
|
+
const dbFile = this.#getDbFileFromJournalName(zName);
|
|
1572
|
+
if (!dbFile) {
|
|
1573
|
+
throw new Error(`database file not found for journal ${zName}`);
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
// Determine whether to use the public journal (which is hot or
|
|
1577
|
+
// could become hot) or a private journal from the session directory.
|
|
1578
|
+
// This is necessary because read connections can test a journal
|
|
1579
|
+
// for hotness while a write-ahead transaction is in progress.
|
|
1580
|
+
if (!dbFile.useWriteAhead || dbFile.journalHandle.getSize() > 0) {
|
|
1581
|
+
// Either write-ahead is not being used, or a hot journal is being
|
|
1582
|
+
// opened for recovery. Use the public journal.
|
|
1583
|
+
file.accessHandle = dbFile.journalHandle;
|
|
1584
|
+
} else if (dbFile.useWriteAhead && dbFile.lockState > _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_LOCK_SHARED) {
|
|
1585
|
+
// The journal is being opened for a write-ahead transaction.
|
|
1586
|
+
// This journal can never be hot so don't expose it to other
|
|
1587
|
+
// connections.
|
|
1588
|
+
file.accessHandle = this.#openTemporaryFile(zName);
|
|
1589
|
+
} else {
|
|
1590
|
+
throw new Error('unexpected journal file conditions');
|
|
1591
|
+
}
|
|
1592
|
+
} else if (flags & (_VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OPEN_WAL | _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OPEN_SUPER_JOURNAL)) {
|
|
1593
|
+
throw new Error('WAL and super-journal files are not supported');
|
|
1594
|
+
} else {
|
|
1595
|
+
// This is a temporary file. Use an unbound pre-opened accessHandle.
|
|
1596
|
+
file.accessHandle = this.#openTemporaryFile(zName);
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
this.mapIdToFile.set(fileId, file);
|
|
1600
|
+
pOutFlags.setInt32(0, flags, true);
|
|
1601
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
1602
|
+
} catch (e) {
|
|
1603
|
+
console.error(e.stack);
|
|
1604
|
+
this.lastError = e;
|
|
1605
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_CANTOPEN;
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
/**
|
|
1610
|
+
* @param {string} zName
|
|
1611
|
+
* @param {number} syncDir
|
|
1612
|
+
* @returns {number}
|
|
1613
|
+
*/
|
|
1614
|
+
jDelete(zName, syncDir) {
|
|
1615
|
+
try {
|
|
1616
|
+
if (this.boundTempFiles.has(zName)) {
|
|
1617
|
+
const file = this.mapPathToFile.get(zName);
|
|
1618
|
+
this.#deleteTemporaryFile(file);
|
|
1619
|
+
} else if (zName.endsWith('-journal')) {
|
|
1620
|
+
const dbFile = this.#getDbFileFromJournalName(zName);
|
|
1621
|
+
dbFile?.journalHandle.truncate(0);
|
|
1622
|
+
dbFile?.journalHandle.flush();
|
|
1623
|
+
this.mapPathToFile.delete(zName);
|
|
1624
|
+
} else {
|
|
1625
|
+
throw new Error(`unexpected file deletion: ${zName}`);
|
|
1626
|
+
}
|
|
1627
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
1628
|
+
} catch (e) {
|
|
1629
|
+
console.error(e.stack);
|
|
1630
|
+
this.lastError = e;
|
|
1631
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_IOERR_DELETE;
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
/**
|
|
1636
|
+
* @param {string} zName
|
|
1637
|
+
* @param {number} flags
|
|
1638
|
+
* @param {DataView} pResOut
|
|
1639
|
+
* @returns {number}
|
|
1640
|
+
*/
|
|
1641
|
+
jAccess(zName, flags, pResOut) {
|
|
1642
|
+
try {
|
|
1643
|
+
// Special case main journal files.
|
|
1644
|
+
if (zName.endsWith('-journal')) {
|
|
1645
|
+
const dbFile = this.#getDbFileFromJournalName(zName);
|
|
1646
|
+
if (dbFile) {
|
|
1647
|
+
if (dbFile.lockState <= _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_LOCK_SHARED) {
|
|
1648
|
+
// SQLite is testing for a hot journal. Journals created in the
|
|
1649
|
+
// session directory for write-ahead transactions are never hot,
|
|
1650
|
+
// i.e. they are used only for rollback. So here we look for
|
|
1651
|
+
// the status of the public journal.
|
|
1652
|
+
if (dbFile.journalHandle.getSize() === 0) {
|
|
1653
|
+
// Treat an empty journal file as non-existent.
|
|
1654
|
+
pResOut.setInt32(0, 0, true);
|
|
1655
|
+
} else {
|
|
1656
|
+
pResOut.setInt32(0, 1, true);
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
1660
|
+
}
|
|
1661
|
+
}
|
|
1662
|
+
|
|
1663
|
+
const file = this.mapPathToFile.get(zName);
|
|
1664
|
+
pResOut.setInt32(0, file ? 1 : 0, true);
|
|
1665
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
1666
|
+
} catch (e) {
|
|
1667
|
+
console.error(e.stack);
|
|
1668
|
+
this.lastError = e;
|
|
1669
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_IOERR_ACCESS;
|
|
1670
|
+
}
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
/**
|
|
1674
|
+
* @param {number} fileId
|
|
1675
|
+
* @returns {number}
|
|
1676
|
+
*/
|
|
1677
|
+
jClose(fileId) {
|
|
1678
|
+
try {
|
|
1679
|
+
const file = this.mapIdToFile.get(fileId);
|
|
1680
|
+
if (file?.flags & _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OPEN_MAIN_DB) {
|
|
1681
|
+
file.writeAhead.close();
|
|
1682
|
+
file.accessHandle.close();
|
|
1683
|
+
file.waHandle.close();
|
|
1684
|
+
this.mapPathToFile.delete(file?.zName);
|
|
1685
|
+
|
|
1686
|
+
file.journalHandle.close();
|
|
1687
|
+
const journalPath = this.#getJournalNameFromDbName(file.zName);
|
|
1688
|
+
this.mapPathToFile.delete(journalPath);
|
|
1689
|
+
|
|
1690
|
+
file.readLock.close();
|
|
1691
|
+
file.writeLock.close();
|
|
1692
|
+
} else if (file?.flags & _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OPEN_MAIN_JOURNAL) {
|
|
1693
|
+
// The actual OPFS journal file is managed with the main database
|
|
1694
|
+
// file, so don't close the access handle here.
|
|
1695
|
+
} else if (file?.flags & _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OPEN_DELETEONCLOSE) {
|
|
1696
|
+
this.#deleteTemporaryFile(file);
|
|
1697
|
+
}
|
|
1698
|
+
|
|
1699
|
+
// Disassociate fileId from file entry.
|
|
1700
|
+
this.mapIdToFile.delete(fileId);
|
|
1701
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
1702
|
+
} catch (e) {
|
|
1703
|
+
console.error(e.stack);
|
|
1704
|
+
this.lastError = e;
|
|
1705
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_IOERR_CLOSE;
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
/**
|
|
1710
|
+
* @param {number} fileId
|
|
1711
|
+
* @param {Uint8Array} pData
|
|
1712
|
+
* @param {number} iOffset
|
|
1713
|
+
* @returns {number}
|
|
1714
|
+
*/
|
|
1715
|
+
jRead(fileId, pData, iOffset) {
|
|
1716
|
+
try {
|
|
1717
|
+
const file = this.mapIdToFile.get(fileId);
|
|
1718
|
+
|
|
1719
|
+
let bytesRead = null;
|
|
1720
|
+
if (file.flags & _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OPEN_MAIN_DB) {
|
|
1721
|
+
// Try reading from the write-ahead overlays first. A read on the
|
|
1722
|
+
// database file is always a complete page, except when reading
|
|
1723
|
+
// from the 100-byte header.
|
|
1724
|
+
const pageOffset = iOffset < 100 ? iOffset : 0;
|
|
1725
|
+
const page = file.writeAhead.read(iOffset - pageOffset);
|
|
1726
|
+
if (page) {
|
|
1727
|
+
const readData = page.subarray(pageOffset, pageOffset + pData.byteLength);
|
|
1728
|
+
pData.set(readData);
|
|
1729
|
+
bytesRead = readData.byteLength;
|
|
1730
|
+
}
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1733
|
+
if (bytesRead === null) {
|
|
1734
|
+
// Read directly from the OPFS file.
|
|
1735
|
+
|
|
1736
|
+
// On Chrome (at least), passing pData to accessHandle.read() is
|
|
1737
|
+
// an error because pData is a Proxy of a Uint8Array. Calling
|
|
1738
|
+
// subarray() produces a real Uint8Array and that works.
|
|
1739
|
+
bytesRead = file.accessHandle.read(pData.subarray(), { at: iOffset });
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
if (bytesRead < pData.byteLength) {
|
|
1743
|
+
pData.fill(0, bytesRead);
|
|
1744
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_IOERR_SHORT_READ;
|
|
1745
|
+
}
|
|
1746
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
1747
|
+
} catch (e) {
|
|
1748
|
+
console.error(e.stack);
|
|
1749
|
+
this.lastError = e;
|
|
1750
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_IOERR_READ;
|
|
1751
|
+
}
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
/**
|
|
1755
|
+
* @param {number} fileId
|
|
1756
|
+
* @param {Uint8Array} pData
|
|
1757
|
+
* @param {number} iOffset
|
|
1758
|
+
* @returns {number}
|
|
1759
|
+
*/
|
|
1760
|
+
jWrite(fileId, pData, iOffset) {
|
|
1761
|
+
try {
|
|
1762
|
+
const file = this.mapIdToFile.get(fileId);
|
|
1763
|
+
if (file.flags & _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OPEN_MAIN_DB) {
|
|
1764
|
+
if (file.useWriteAhead) {
|
|
1765
|
+
// Write to the write-ahead overlay.
|
|
1766
|
+
file.writeAhead.write(iOffset, pData);
|
|
1767
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
// On Chrome (at least), passing pData to accessHandle.write() is
|
|
1772
|
+
// an error because pData is a Proxy of a Uint8Array. Calling
|
|
1773
|
+
// subarray() produces a real Uint8Array and that works.
|
|
1774
|
+
file.accessHandle.write(pData.subarray(), { at: iOffset });
|
|
1775
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
1776
|
+
} catch (e) {
|
|
1777
|
+
console.error(e.stack);
|
|
1778
|
+
this.lastError = e;
|
|
1779
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_IOERR_WRITE;
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1783
|
+
/**
|
|
1784
|
+
* @param {number} fileId
|
|
1785
|
+
* @param {number} iSize
|
|
1786
|
+
* @returns {number}
|
|
1787
|
+
*/
|
|
1788
|
+
jTruncate(fileId, iSize) {
|
|
1789
|
+
try {
|
|
1790
|
+
const file = this.mapIdToFile.get(fileId);
|
|
1791
|
+
if (file.flags & _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OPEN_MAIN_DB) {
|
|
1792
|
+
if (file.useWriteAhead) {
|
|
1793
|
+
file.writeAhead.truncate(iSize);
|
|
1794
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
file.accessHandle.truncate(iSize);
|
|
1798
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
1799
|
+
} catch (e) {
|
|
1800
|
+
console.error(e.stack);
|
|
1801
|
+
this.lastError = e;
|
|
1802
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_IOERR_TRUNCATE;
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
/**
|
|
1807
|
+
* @param {number} fileId
|
|
1808
|
+
* @param {number} flags
|
|
1809
|
+
* @returns {number}
|
|
1810
|
+
*/
|
|
1811
|
+
jSync(fileId, flags) {
|
|
1812
|
+
try {
|
|
1813
|
+
const file = this.mapIdToFile.get(fileId);
|
|
1814
|
+
if (file.flags & _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OPEN_MAIN_DB) {
|
|
1815
|
+
if (file.useWriteAhead) {
|
|
1816
|
+
// TODO: Track PRAGMA synchronous setting.
|
|
1817
|
+
file.writeAhead.sync('normal');
|
|
1818
|
+
} else {
|
|
1819
|
+
file.accessHandle.flush();
|
|
1820
|
+
}
|
|
1821
|
+
} else if (!this.boundTempFiles.has(file.zName)) {
|
|
1822
|
+
// Persistent journal file requires sync.
|
|
1823
|
+
file.accessHandle.flush();
|
|
1824
|
+
} else {
|
|
1825
|
+
// This is a temporary file so sync is not needed.
|
|
1826
|
+
// Temporary journals are only used for rollback by the
|
|
1827
|
+
// connection that created them, not for recovery.
|
|
1828
|
+
}
|
|
1829
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
1830
|
+
} catch (e) {
|
|
1831
|
+
console.error(e.stack);
|
|
1832
|
+
this.lastError = e;
|
|
1833
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_IOERR_FSYNC;
|
|
1834
|
+
}
|
|
1835
|
+
}
|
|
1836
|
+
|
|
1837
|
+
/**
|
|
1838
|
+
* @param {number} fileId
|
|
1839
|
+
* @param {DataView} pSize64
|
|
1840
|
+
* @returns {number}
|
|
1841
|
+
*/
|
|
1842
|
+
jFileSize(fileId, pSize64) {
|
|
1843
|
+
try {
|
|
1844
|
+
const file = this.mapIdToFile.get(fileId);
|
|
1845
|
+
|
|
1846
|
+
let size;
|
|
1847
|
+
if (file.flags & _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OPEN_MAIN_DB) {
|
|
1848
|
+
size = file.writeAhead.getFileSize() || file.accessHandle.getSize();
|
|
1849
|
+
} else {
|
|
1850
|
+
size = file.accessHandle.getSize();
|
|
1851
|
+
}
|
|
1852
|
+
pSize64.setBigInt64(0, BigInt(size), true);
|
|
1853
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
1854
|
+
} catch (e) {
|
|
1855
|
+
console.error(e.stack);
|
|
1856
|
+
this.lastError = e;
|
|
1857
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_IOERR_FSTAT;
|
|
1858
|
+
}
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1861
|
+
/**
|
|
1862
|
+
* @param {number} pFile
|
|
1863
|
+
* @param {number} lockType
|
|
1864
|
+
* @returns {number|Promise<number>}
|
|
1865
|
+
*/
|
|
1866
|
+
jLock(pFile, lockType) {
|
|
1867
|
+
try {
|
|
1868
|
+
const file = this.mapIdToFile.get(pFile);
|
|
1869
|
+
if (file.lockState === _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_LOCK_NONE && lockType === _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_LOCK_SHARED) {
|
|
1870
|
+
// We do all our locking work in this transition.
|
|
1871
|
+
if (file.retryResult === null) {
|
|
1872
|
+
if (file.lockingMode === 'exclusive') {
|
|
1873
|
+
// SQLite exclusive locking mode really means that no unlocking
|
|
1874
|
+
// is done, not that the locking state is immediately EXCLUSIVE.
|
|
1875
|
+
// This is a problem if the first transaction after setting
|
|
1876
|
+
// exclusive locking mode does not come with a write hint, so
|
|
1877
|
+
// we force the write hint here.
|
|
1878
|
+
file.writeHint = 'exclusive';
|
|
1879
|
+
file.useWriteAhead = false;
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
if (file.writeHint || file.readLock.mode !== 'shared') {
|
|
1883
|
+
// Asynchronous lock acquisition is needed. Set retryResult to
|
|
1884
|
+
// non-null so when SQLite calls jUnlock() it knows not to reset
|
|
1885
|
+
// any locks we have in progress.
|
|
1886
|
+
file.retryResult = {};
|
|
1887
|
+
this._module.retryOps.push(this.#retryLock(pFile, lockType));
|
|
1888
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_BUSY;
|
|
1889
|
+
}
|
|
1890
|
+
|
|
1891
|
+
// This is a read transaction and we can get the shared
|
|
1892
|
+
// lock synchronously.
|
|
1893
|
+
file.readLock.acquireIfHeld('shared');
|
|
1894
|
+
} else if (file.retryResult instanceof Error) {
|
|
1895
|
+
throw file.retryResult;
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1898
|
+
// We have acquired the needed locks, either synchronously or
|
|
1899
|
+
// via retry.
|
|
1900
|
+
file.retryResult = null;
|
|
1901
|
+
if (file.writeHint === null) {
|
|
1902
|
+
// Ensure that our read-only view of the database does not change
|
|
1903
|
+
// while in the SHARED lock state. The corresponding method
|
|
1904
|
+
// isolateForWrite() is not called in this method, but instead
|
|
1905
|
+
// in retryLock() because it is asynchronous.
|
|
1906
|
+
file.writeAhead.isolateForRead();
|
|
1907
|
+
}
|
|
1908
|
+
} else if (lockType >= _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_LOCK_RESERVED && !file.writeLock.mode) {
|
|
1909
|
+
// This is a write transaction but we don't already have the write
|
|
1910
|
+
// lock. This happens when the write hint was not used, which this
|
|
1911
|
+
// VFS treats as an error.
|
|
1912
|
+
throw new Error('Multi-statement write transaction cannot use BEGIN DEFERRED');
|
|
1913
|
+
}
|
|
1914
|
+
file.lockState = lockType;
|
|
1915
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
1916
|
+
} catch (e) {
|
|
1917
|
+
if (e.name === 'AbortError') {
|
|
1918
|
+
// Timeout expired while waiting for the lock.
|
|
1919
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_BUSY;
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
console.error(e.stack);
|
|
1923
|
+
this.lastError = e;
|
|
1924
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_IOERR_LOCK;
|
|
1925
|
+
}
|
|
1926
|
+
}
|
|
1927
|
+
|
|
1928
|
+
/**
|
|
1929
|
+
* @param {number} pFile
|
|
1930
|
+
* @param {number} lockType
|
|
1931
|
+
* @returns {number}
|
|
1932
|
+
*/
|
|
1933
|
+
jUnlock(pFile, lockType) {
|
|
1934
|
+
try {
|
|
1935
|
+
const file = this.mapIdToFile.get(pFile);
|
|
1936
|
+
|
|
1937
|
+
// If retryResult is non-null, an asynchronous lock operation is in
|
|
1938
|
+
// progress. In that case, don't change any locks.
|
|
1939
|
+
if (!file.retryResult && lockType === _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_LOCK_NONE) {
|
|
1940
|
+
// In this VFS, this is the only unlock transition that matters.
|
|
1941
|
+
if (file.useWriteAhead) {
|
|
1942
|
+
// Exit write-ahead isolation.
|
|
1943
|
+
file.writeAhead.rejoin();
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
file.writeLock.release();
|
|
1947
|
+
if (file.readLock.mode === 'exclusive') {
|
|
1948
|
+
// TODO: Consider lazy release here as well.
|
|
1949
|
+
file.readLock.release();
|
|
1950
|
+
} else {
|
|
1951
|
+
file.readLock.releaseLazy();
|
|
1952
|
+
}
|
|
1953
|
+
file.writeHint = null;
|
|
1954
|
+
|
|
1955
|
+
if (file.lockingMode === 'normal') {
|
|
1956
|
+
file.useWriteAhead = true;
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
file.lockState = lockType;
|
|
1960
|
+
} catch (e) {
|
|
1961
|
+
console.error(e.stack);
|
|
1962
|
+
this.lastError = e;
|
|
1963
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_IOERR_UNLOCK;
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1967
|
+
/**
|
|
1968
|
+
* @param {number} pFile
|
|
1969
|
+
* @param {DataView} pResOut
|
|
1970
|
+
* @returns {number}
|
|
1971
|
+
*/
|
|
1972
|
+
jCheckReservedLock(pFile, pResOut) {
|
|
1973
|
+
// This function is only called in the SHARED lock state, and when
|
|
1974
|
+
// a potentially hot journal file exists. Such a journal can only
|
|
1975
|
+
// be created without using write-ahead, and such a connection
|
|
1976
|
+
// cannot co-exist with this connection in SHARED.
|
|
1977
|
+
pResOut.setInt32(0, 0, true);
|
|
1978
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1981
|
+
/**
|
|
1982
|
+
* @param {number} pFile
|
|
1983
|
+
* @param {number} op
|
|
1984
|
+
* @param {DataView} pArg
|
|
1985
|
+
* @returns {number}
|
|
1986
|
+
*/
|
|
1987
|
+
jFileControl(pFile, op, pArg) {
|
|
1988
|
+
try {
|
|
1989
|
+
const file = this.mapIdToFile.get(pFile);
|
|
1990
|
+
switch (op) {
|
|
1991
|
+
case _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_FCNTL_PRAGMA:
|
|
1992
|
+
const key = this._module.UTF8ToString(pArg.getUint32(4, true));
|
|
1993
|
+
const valueAddress = pArg.getUint32(8, true);
|
|
1994
|
+
const value = valueAddress ? this._module.UTF8ToString(valueAddress) : null;
|
|
1995
|
+
this.log?.(`PRAGMA ${key} ${value}`);
|
|
1996
|
+
switch (key.toLowerCase()) {
|
|
1997
|
+
case 'experimental_pragma_20251114':
|
|
1998
|
+
// After entering the SHARED locking state on the next
|
|
1999
|
+
// transaction, SQLite intends to immediately (barring a hot
|
|
2000
|
+
// journal) transition to RESERVED if value is '1', or
|
|
2001
|
+
// EXCLUSIVE if value is '2'.
|
|
2002
|
+
switch (value) {
|
|
2003
|
+
case '1':
|
|
2004
|
+
file.writeHint = 'reserved';
|
|
2005
|
+
break;
|
|
2006
|
+
case '2':
|
|
2007
|
+
file.writeHint = 'exclusive';
|
|
2008
|
+
break;
|
|
2009
|
+
default:
|
|
2010
|
+
throw new Error(`unexpected write hint value: ${value}`);
|
|
2011
|
+
}
|
|
2012
|
+
break;
|
|
2013
|
+
case 'busy_timeout':
|
|
2014
|
+
// Override SQLite's handling of busy timeouts with our
|
|
2015
|
+
// blocking lock timeouts.
|
|
2016
|
+
if (value !== null) {
|
|
2017
|
+
file.timeout = parseInt(value);
|
|
2018
|
+
} else {
|
|
2019
|
+
// Return current timeout.
|
|
2020
|
+
const s = file.timeout.toString();
|
|
2021
|
+
const ptr = this._module._sqlite3_malloc64(s.length + 1);
|
|
2022
|
+
this._module.stringToUTF8(s, ptr, s.length + 1);
|
|
2023
|
+
pArg.setUint32(0, ptr, true);
|
|
2024
|
+
}
|
|
2025
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
2026
|
+
case 'locking_mode':
|
|
2027
|
+
// Track SQLite locking mode. We will use write-ahead only in
|
|
2028
|
+
// normal locking mode.
|
|
2029
|
+
switch (value?.toLowerCase()) {
|
|
2030
|
+
case 'normal':
|
|
2031
|
+
file.lockingMode = 'normal';
|
|
2032
|
+
break;
|
|
2033
|
+
case 'exclusive':
|
|
2034
|
+
file.lockingMode = 'exclusive';
|
|
2035
|
+
break;
|
|
2036
|
+
}
|
|
2037
|
+
break;
|
|
2038
|
+
case 'vfs_trace':
|
|
2039
|
+
// This is a trace feature for debugging only.
|
|
2040
|
+
if (value !== null) {
|
|
2041
|
+
this.log = parseInt(value) !== 0 ? console.debug : null;
|
|
2042
|
+
file.writeAhead.log = this.log;
|
|
2043
|
+
}
|
|
2044
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
2045
|
+
case 'wal_autocheckpoint':
|
|
2046
|
+
if (value !== null) {
|
|
2047
|
+
const pageCount = parseInt(value);
|
|
2048
|
+
if (pageCount > 0) {
|
|
2049
|
+
file.writeAhead.options.autoCheckpointPages = pageCount;
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
break;
|
|
2053
|
+
case 'wal_checkpoint':
|
|
2054
|
+
const checkpointMode = (value ?? 'passive').toLowerCase();
|
|
2055
|
+
switch ((value ?? 'passive').toLowerCase()) {
|
|
2056
|
+
case 'passive':
|
|
2057
|
+
case 'full':
|
|
2058
|
+
case 'restart':
|
|
2059
|
+
case 'truncate':
|
|
2060
|
+
if (file.lockState !== _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_LOCK_NONE) {
|
|
2061
|
+
throw new Error('invalid while database is locked');
|
|
2062
|
+
}
|
|
2063
|
+
|
|
2064
|
+
this._module.pendingOps.push(this.#pendingCheckpoint(file, checkpointMode));
|
|
2065
|
+
break;
|
|
2066
|
+
case 'noop':
|
|
2067
|
+
// Return the current size of the write-ahead file. SQLite
|
|
2068
|
+
// returns different information, but that is not feasible
|
|
2069
|
+
// from a VFS.
|
|
2070
|
+
{
|
|
2071
|
+
const s = file.writeAhead.getWriteAheadSize().toString();
|
|
2072
|
+
const ptr = this._module._sqlite3_malloc64(s.length + 1);
|
|
2073
|
+
this._module.stringToUTF8(s, ptr, s.length + 1);
|
|
2074
|
+
pArg.setUint32(0, ptr, true);
|
|
2075
|
+
}
|
|
2076
|
+
break;
|
|
2077
|
+
default:
|
|
2078
|
+
throw new Error(`unexpected wal_checkpoint mode: ${value}`);
|
|
2079
|
+
}
|
|
2080
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
2081
|
+
case 'write_ahead':
|
|
2082
|
+
// For testing purposes only: enable or disable write-ahead mode.
|
|
2083
|
+
if (value !== null) {
|
|
2084
|
+
if (file.lockState !== _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_LOCK_NONE) {
|
|
2085
|
+
throw new Error('cannot change write_ahead mode while database is locked');
|
|
2086
|
+
}
|
|
2087
|
+
file.useWriteAhead = parseInt(value) !== 0;
|
|
2088
|
+
} else {
|
|
2089
|
+
const s = (file.useWriteAhead ? '1' : '0');
|
|
2090
|
+
const ptr = this._module._sqlite3_malloc64(s.length + 1);
|
|
2091
|
+
this._module.stringToUTF8(s, ptr, s.length + 1);
|
|
2092
|
+
pArg.setUint32(0, ptr, true);
|
|
2093
|
+
}
|
|
2094
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
2095
|
+
}
|
|
2096
|
+
break;
|
|
2097
|
+
|
|
2098
|
+
// Support SQLite batch atomic write transactions.
|
|
2099
|
+
case _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_FCNTL_BEGIN_ATOMIC_WRITE:
|
|
2100
|
+
case _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_FCNTL_COMMIT_ATOMIC_WRITE:
|
|
2101
|
+
if (file.flags & _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OPEN_MAIN_DB) {
|
|
2102
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
2103
|
+
}
|
|
2104
|
+
break;
|
|
2105
|
+
case _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE:
|
|
2106
|
+
if (file.flags & _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OPEN_MAIN_DB) {
|
|
2107
|
+
file.writeAhead.rollback();
|
|
2108
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK;
|
|
2109
|
+
}
|
|
2110
|
+
break;
|
|
2111
|
+
|
|
2112
|
+
case _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_FCNTL_SYNC:
|
|
2113
|
+
if (file.flags & _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OPEN_MAIN_DB) {
|
|
2114
|
+
if (file.useWriteAhead) {
|
|
2115
|
+
file.writeAhead.commit();
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
break;
|
|
2119
|
+
}
|
|
2120
|
+
} catch (e) {
|
|
2121
|
+
console.error(e.stack);
|
|
2122
|
+
this.lastError = e;
|
|
2123
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_IOERR;
|
|
2124
|
+
}
|
|
2125
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_NOTFOUND;
|
|
2126
|
+
}
|
|
2127
|
+
|
|
2128
|
+
/**
|
|
2129
|
+
* @param {number} pFile
|
|
2130
|
+
* @returns {number}
|
|
2131
|
+
*/
|
|
2132
|
+
jDeviceCharacteristics(pFile) {
|
|
2133
|
+
let result = _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN;
|
|
2134
|
+
|
|
2135
|
+
const file = this.mapIdToFile.get(pFile);
|
|
2136
|
+
if (file.useWriteAhead) {
|
|
2137
|
+
// When write-ahead is in use, we can do batch atomic writes.
|
|
2138
|
+
result |= _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_IOCAP_BATCH_ATOMIC;
|
|
2139
|
+
}
|
|
2140
|
+
return result;
|
|
2141
|
+
}
|
|
2142
|
+
|
|
2143
|
+
/**
|
|
2144
|
+
* @param {Uint8Array} zBuf
|
|
2145
|
+
* @returns {number}
|
|
2146
|
+
*/
|
|
2147
|
+
jGetLastError(zBuf) {
|
|
2148
|
+
if (this.lastError) {
|
|
2149
|
+
console.error(this.lastError);
|
|
2150
|
+
const outputArray = zBuf.subarray(0, zBuf.byteLength - 1);
|
|
2151
|
+
const { written } = new TextEncoder().encodeInto(this.lastError.message, outputArray);
|
|
2152
|
+
zBuf[written] = 0;
|
|
2153
|
+
}
|
|
2154
|
+
return _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OK
|
|
2155
|
+
}
|
|
2156
|
+
|
|
2157
|
+
/**
|
|
2158
|
+
* @param {string} zName
|
|
2159
|
+
* @returns {FileSystemSyncAccessHandle}
|
|
2160
|
+
*/
|
|
2161
|
+
#openTemporaryFile(zName) {
|
|
2162
|
+
if (this.unboundTempFiles.size === 0) {
|
|
2163
|
+
throw new Error('no temporary files available');
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
// Bind an access handle from the temporary pool.
|
|
2167
|
+
const accessHandle = this.unboundTempFiles.values().next().value;
|
|
2168
|
+
this.unboundTempFiles.delete(accessHandle);
|
|
2169
|
+
this.boundTempFiles.set(zName, accessHandle);
|
|
2170
|
+
return accessHandle;
|
|
2171
|
+
}
|
|
2172
|
+
|
|
2173
|
+
/**
|
|
2174
|
+
* @param {FileEntry} file
|
|
2175
|
+
*/
|
|
2176
|
+
#deleteTemporaryFile(file) {
|
|
2177
|
+
file.accessHandle.truncate(0);
|
|
2178
|
+
|
|
2179
|
+
// Temporary files are not actually deleted, just returned to the pool.
|
|
2180
|
+
this.mapPathToFile.delete(file.zName);
|
|
2181
|
+
this.unboundTempFiles.add(file.accessHandle);
|
|
2182
|
+
this.boundTempFiles.delete(file.zName);
|
|
2183
|
+
}
|
|
2184
|
+
|
|
2185
|
+
/**
|
|
2186
|
+
* @param {string} dbName
|
|
2187
|
+
* @returns {string}
|
|
2188
|
+
*/
|
|
2189
|
+
#getJournalNameFromDbName(dbName) {
|
|
2190
|
+
return `${dbName}-journal`;
|
|
2191
|
+
}
|
|
2192
|
+
|
|
2193
|
+
#getWriteAheadNameFromDbName(dbName) {
|
|
2194
|
+
// Our WAL file is not compatible with SQLite WAL, so use a distinct name.
|
|
2195
|
+
return `${dbName}-waf`;
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2198
|
+
/**
|
|
2199
|
+
* @param {string} journalName
|
|
2200
|
+
* @returns {FileEntry}
|
|
2201
|
+
*/
|
|
2202
|
+
#getDbFileFromJournalName(journalName) {
|
|
2203
|
+
const dbFilename = journalName.slice(0, -'-journal'.length);
|
|
2204
|
+
return this.mapPathToFile.get(dbFilename);
|
|
2205
|
+
}
|
|
2206
|
+
|
|
2207
|
+
/**
|
|
2208
|
+
*
|
|
2209
|
+
* @param {FileEntry} file
|
|
2210
|
+
* @param {'passive'|'full'|'restart'|'truncate'} mode
|
|
2211
|
+
*/
|
|
2212
|
+
async #pendingCheckpoint(file, mode) {
|
|
2213
|
+
try {
|
|
2214
|
+
const ckptLockOptions = { ifAvailable: mode === 'passive' };
|
|
2215
|
+
if (mode !== 'passive') {
|
|
2216
|
+
await file.readLock.acquire('exclusive', file.timeout);
|
|
2217
|
+
await file.writeLock.acquire('exclusive');
|
|
2218
|
+
}
|
|
2219
|
+
|
|
2220
|
+
await file.writeAhead.checkpoint(mode);
|
|
2221
|
+
} catch (e) {
|
|
2222
|
+
console.error(e);
|
|
2223
|
+
} finally {
|
|
2224
|
+
file.readLock.release();
|
|
2225
|
+
file.writeLock.release();
|
|
2226
|
+
}
|
|
2227
|
+
}
|
|
2228
|
+
|
|
2229
|
+
/**
|
|
2230
|
+
* Handle asynchronous jLock() tasks.
|
|
2231
|
+
* @param {number} pFile
|
|
2232
|
+
* @param {number} lockType
|
|
2233
|
+
*/
|
|
2234
|
+
async #retryLock(pFile, lockType) {
|
|
2235
|
+
const file = this.mapIdToFile.get(pFile);
|
|
2236
|
+
try {
|
|
2237
|
+
switch (file.writeHint) {
|
|
2238
|
+
case 'reserved':
|
|
2239
|
+
case 'exclusive':
|
|
2240
|
+
if (file.useWriteAhead) {
|
|
2241
|
+
// Write-ahead transactions only need writeLock, not readLock.
|
|
2242
|
+
await file.writeLock.acquire('exclusive', file.timeout);
|
|
2243
|
+
file.writeAhead.isolateForWrite();
|
|
2244
|
+
} else {
|
|
2245
|
+
// This transaction will write directly to the database,
|
|
2246
|
+
// i.e. not using write-ahead. Get exclusive access.
|
|
2247
|
+
await file.readLock.acquire('exclusive', file.timeout);
|
|
2248
|
+
await file.writeLock.acquire('exclusive');
|
|
2249
|
+
|
|
2250
|
+
// Transfer everything in write-ahead to the OPFS file.
|
|
2251
|
+
await file.writeAhead.checkpoint('restart');
|
|
2252
|
+
}
|
|
2253
|
+
break;
|
|
2254
|
+
default:
|
|
2255
|
+
// This transaction will only read.
|
|
2256
|
+
await file.readLock.acquire('shared', file.timeout);
|
|
2257
|
+
break;
|
|
2258
|
+
}
|
|
2259
|
+
file.retryResult = {};
|
|
2260
|
+
} catch (e) {
|
|
2261
|
+
file.retryResult = e;
|
|
2262
|
+
return;
|
|
2263
|
+
}
|
|
2264
|
+
}
|
|
2265
|
+
|
|
2266
|
+
/**
|
|
2267
|
+
* Handle asynchronous jOpen() tasks.
|
|
2268
|
+
* @param {string} zName
|
|
2269
|
+
* @param {number} flags
|
|
2270
|
+
* @param {number} fileId
|
|
2271
|
+
* @param {DataView} pOutFlags
|
|
2272
|
+
* @returns {Promise<void>}
|
|
2273
|
+
*/
|
|
2274
|
+
async #retryOpen(zName, flags, fileId, pOutFlags) {
|
|
2275
|
+
/** @type {(() => void)[]} */ const onError = [];
|
|
2276
|
+
const file = this.mapPathToFile.get(zName);
|
|
2277
|
+
try {
|
|
2278
|
+
await navigator.locks.request(`${zName}#open`, async lock => {
|
|
2279
|
+
// Parse the path components.
|
|
2280
|
+
const directoryNames = zName.split('/').filter(d => d);
|
|
2281
|
+
const dbName = directoryNames.pop();
|
|
2282
|
+
|
|
2283
|
+
// Get the OPFS directory handle.
|
|
2284
|
+
let dirHandle = await navigator.storage.getDirectory();
|
|
2285
|
+
const create = !!(flags & _VFS_js__WEBPACK_IMPORTED_MODULE_1__.SQLITE_OPEN_CREATE);
|
|
2286
|
+
for (const directoryName of directoryNames) {
|
|
2287
|
+
dirHandle = await dirHandle.getDirectoryHandle(directoryName, { create });
|
|
2288
|
+
}
|
|
2289
|
+
|
|
2290
|
+
// Open the main database OPFS file. We need to know whether the file
|
|
2291
|
+
// was created or not so we know whether to remove any existing
|
|
2292
|
+
// IndexedDB database with the same name. This will not be necessary
|
|
2293
|
+
// if the write-ahead data is moved to OPFS entirely.
|
|
2294
|
+
let created = false;
|
|
2295
|
+
/** @type {FileSystemSyncAccessHandle} */ let accessHandle;
|
|
2296
|
+
try {
|
|
2297
|
+
const fileHandle = await dirHandle.getFileHandle(dbName);
|
|
2298
|
+
// @ts-ignore
|
|
2299
|
+
accessHandle = await fileHandle.createSyncAccessHandle({
|
|
2300
|
+
mode: 'readwrite-unsafe'
|
|
2301
|
+
});
|
|
2302
|
+
} catch (e) {
|
|
2303
|
+
if (e.name === 'NotFoundError' && create) {
|
|
2304
|
+
const fileHandle = await dirHandle.getFileHandle(dbName, { create });
|
|
2305
|
+
// @ts-ignore
|
|
2306
|
+
accessHandle = await fileHandle.createSyncAccessHandle({
|
|
2307
|
+
mode: 'readwrite-unsafe'
|
|
2308
|
+
});
|
|
2309
|
+
created = true;
|
|
2310
|
+
} else {
|
|
2311
|
+
throw e;
|
|
2312
|
+
}
|
|
2313
|
+
}
|
|
2314
|
+
onError.push(() => {
|
|
2315
|
+
accessHandle.close();
|
|
2316
|
+
if (created) {
|
|
2317
|
+
dirHandle.removeEntry(dbName);
|
|
2318
|
+
}
|
|
2319
|
+
});
|
|
2320
|
+
|
|
2321
|
+
// Pre-open the journal OPFS file here.
|
|
2322
|
+
const journalName = this.#getJournalNameFromDbName(dbName);
|
|
2323
|
+
const fileHandle = await dirHandle.getFileHandle(journalName, { create: true });
|
|
2324
|
+
// @ts-ignore
|
|
2325
|
+
const journalHandle = await fileHandle.createSyncAccessHandle({
|
|
2326
|
+
mode: 'readwrite-unsafe'
|
|
2327
|
+
});
|
|
2328
|
+
onError.push(() => {
|
|
2329
|
+
journalHandle.close();
|
|
2330
|
+
if (created) {
|
|
2331
|
+
dirHandle.removeEntry(journalName);
|
|
2332
|
+
}
|
|
2333
|
+
});
|
|
2334
|
+
|
|
2335
|
+
// Open the WAL file.
|
|
2336
|
+
const waName = this.#getWriteAheadNameFromDbName(dbName);
|
|
2337
|
+
const waFileHandle = await dirHandle.getFileHandle(waName, { create: true });
|
|
2338
|
+
// @ts-ignore
|
|
2339
|
+
const waHandle = await waFileHandle.createSyncAccessHandle({
|
|
2340
|
+
mode: 'readwrite-unsafe'
|
|
2341
|
+
});
|
|
2342
|
+
onError.push(() => {
|
|
2343
|
+
waHandle.close();
|
|
2344
|
+
if (created) {
|
|
2345
|
+
dirHandle.removeEntry(waName);
|
|
2346
|
+
}
|
|
2347
|
+
});
|
|
2348
|
+
|
|
2349
|
+
// Create the write-ahead manager.
|
|
2350
|
+
const writeAhead = new _WriteAhead_js__WEBPACK_IMPORTED_MODULE_4__.WriteAhead(
|
|
2351
|
+
zName,
|
|
2352
|
+
accessHandle,
|
|
2353
|
+
waHandle,
|
|
2354
|
+
Object.assign({ create: created }, this.options));
|
|
2355
|
+
await writeAhead.ready();
|
|
2356
|
+
|
|
2357
|
+
file.retryResult = { accessHandle, waHandle, journalHandle, writeAhead };
|
|
2358
|
+
});
|
|
2359
|
+
} catch (e) {
|
|
2360
|
+
while (onError.length) {
|
|
2361
|
+
onError.pop()();
|
|
2362
|
+
}
|
|
2363
|
+
file.retryResult = e;
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2366
|
+
}
|
|
2367
|
+
|
|
2368
|
+
|
|
2369
|
+
/***/ },
|
|
2370
|
+
|
|
2371
|
+
/***/ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@0.0.0-dev-20260225162137/node_modules/@journeyapps/wa-sqlite/src/examples/WriteAhead.js"
|
|
2372
|
+
/*!***********************************************************************************************************************************************!*\
|
|
2373
|
+
!*** ../../node_modules/.pnpm/@journeyapps+wa-sqlite@0.0.0-dev-20260225162137/node_modules/@journeyapps/wa-sqlite/src/examples/WriteAhead.js ***!
|
|
2374
|
+
\***********************************************************************************************************************************************/
|
|
2375
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
2376
|
+
|
|
2377
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2378
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2379
|
+
/* harmony export */ WriteAhead: () => (/* binding */ WriteAhead)
|
|
2380
|
+
/* harmony export */ });
|
|
2381
|
+
/* harmony import */ var _Lock_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Lock.js */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@0.0.0-dev-20260225162137/node_modules/@journeyapps/wa-sqlite/src/examples/Lock.js");
|
|
2382
|
+
|
|
2383
|
+
|
|
2384
|
+
const DEFAULT_AUTOCHECKPOINT_PAGES = 1_000;
|
|
2385
|
+
const DEFAULT_BACKSTOP_INTERVAL = 30_000;
|
|
2386
|
+
|
|
2387
|
+
const SECTOR_SIZE = 4096;
|
|
2388
|
+
const WAL_FILE_HEADER_SIZE = 32;
|
|
2389
|
+
const WAL_FRAME_BASE = SECTOR_SIZE + WAL_FILE_HEADER_SIZE; // first frame starts at this offset
|
|
2390
|
+
|
|
2391
|
+
/**
|
|
2392
|
+
* @typedef PageEntry
|
|
2393
|
+
* @property {number} waOffset location in WAL file
|
|
2394
|
+
* @property {number} pageSize
|
|
2395
|
+
* @property {Uint8Array} [pageData]
|
|
2396
|
+
*/
|
|
2397
|
+
|
|
2398
|
+
/**
|
|
2399
|
+
* @typedef Transaction
|
|
2400
|
+
* @property {number} id
|
|
2401
|
+
* @property {Map<number, PageEntry>} pages address to page data mapping
|
|
2402
|
+
* @property {number} dbFileSize
|
|
2403
|
+
* @property {number} dbPageSize
|
|
2404
|
+
* @property {number} waOffsetEnd
|
|
2405
|
+
*/
|
|
2406
|
+
|
|
2407
|
+
/**
|
|
2408
|
+
* @typedef WriteAheadOptions
|
|
2409
|
+
* @property {boolean} [create=false] true if database is being created
|
|
2410
|
+
* @property {number} [autoCheckpointPages]
|
|
2411
|
+
* @property {number} [backstopInterval]
|
|
2412
|
+
*/
|
|
2413
|
+
|
|
2414
|
+
class WriteAhead {
|
|
2415
|
+
log = null;
|
|
2416
|
+
/** @type {WriteAheadOptions} */ options = {
|
|
2417
|
+
create: false,
|
|
2418
|
+
autoCheckpointPages: DEFAULT_AUTOCHECKPOINT_PAGES,
|
|
2419
|
+
backstopInterval: DEFAULT_BACKSTOP_INTERVAL,
|
|
2420
|
+
};
|
|
2421
|
+
|
|
2422
|
+
#zName;
|
|
2423
|
+
#dbHandle;
|
|
2424
|
+
#waFile;
|
|
2425
|
+
|
|
2426
|
+
#dbFileSize = 0;
|
|
2427
|
+
|
|
2428
|
+
/** @type {Promise<any>} */ #ready;
|
|
2429
|
+
/** @type {'read'|'write'} */ #isolationState = null
|
|
2430
|
+
|
|
2431
|
+
/** @type {Lock} */ #txIdLock = null;
|
|
2432
|
+
/** @type {Transaction} */ #txActive = null;
|
|
2433
|
+
|
|
2434
|
+
/** @type {Map<number, PageEntry>} */ #waOverlay = new Map();
|
|
2435
|
+
/** @type {Map<number, Transaction>} */ #mapIdToTx = new Map();
|
|
2436
|
+
/** @type {Map<number, Transaction>} */ #pendingTx = new Map();
|
|
2437
|
+
|
|
2438
|
+
#broadcastChannel;
|
|
2439
|
+
/** @type {number} */ #backstopTimer;
|
|
2440
|
+
|
|
2441
|
+
/**
|
|
2442
|
+
* @param {string} zName
|
|
2443
|
+
* @param {FileSystemSyncAccessHandle} dbHandle
|
|
2444
|
+
* @param {FileSystemSyncAccessHandle} waHandle
|
|
2445
|
+
* @param {WriteAheadOptions} options
|
|
2446
|
+
*/
|
|
2447
|
+
constructor(zName, dbHandle, waHandle, options) {
|
|
2448
|
+
this.#zName = zName;
|
|
2449
|
+
this.#dbHandle = dbHandle;
|
|
2450
|
+
this.#waFile = new WriteAheadFile(waHandle);
|
|
2451
|
+
this.options = Object.assign(this.options, options);
|
|
2452
|
+
|
|
2453
|
+
// All the asynchronous initialization is done here.
|
|
2454
|
+
this.#ready = (async () => {
|
|
2455
|
+
// Disable checkpointing by other connections until we're ready.
|
|
2456
|
+
await this.#updateTxIdLock();
|
|
2457
|
+
await navigator.locks.request(`${this.#zName}-ckpt`, async () => {
|
|
2458
|
+
// This is just a barrier; nothing needs to be done here.
|
|
2459
|
+
});
|
|
2460
|
+
|
|
2461
|
+
// Load all the transactions from the WAL file.
|
|
2462
|
+
if (this.options.create) {
|
|
2463
|
+
this.#waFile.create();
|
|
2464
|
+
}
|
|
2465
|
+
|
|
2466
|
+
this.#waFile.open();
|
|
2467
|
+
for (const tx of this.#waFile.readAllTx()) {
|
|
2468
|
+
this.#activateTx(tx);
|
|
2469
|
+
}
|
|
2470
|
+
|
|
2471
|
+
// Listen for transactions and checkpoints from other connections.
|
|
2472
|
+
this.#broadcastChannel = new BroadcastChannel(`${zName}#wa`);
|
|
2473
|
+
this.#broadcastChannel.onmessage = (event) => {
|
|
2474
|
+
this.#handleMessage(event);
|
|
2475
|
+
};
|
|
2476
|
+
|
|
2477
|
+
// Update our tx lock to reflect the current txId.
|
|
2478
|
+
await this.#updateTxIdLock();
|
|
2479
|
+
|
|
2480
|
+
// Schedule first backstop. The backstop is a guard against a crash
|
|
2481
|
+
// in another context between persisting a transaction and broadcasting
|
|
2482
|
+
// it.
|
|
2483
|
+
this.#backstop();
|
|
2484
|
+
})();
|
|
2485
|
+
}
|
|
2486
|
+
|
|
2487
|
+
/**
|
|
2488
|
+
* @returns {Promise<void>}
|
|
2489
|
+
*/
|
|
2490
|
+
ready() {
|
|
2491
|
+
return this.#ready;
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2494
|
+
close() {
|
|
2495
|
+
// Stop asynchronous maintenance.
|
|
2496
|
+
this.#broadcastChannel.onmessage = null;
|
|
2497
|
+
clearTimeout(this.#backstopTimer);
|
|
2498
|
+
|
|
2499
|
+
// Wait for any pending commit to complete.
|
|
2500
|
+
this.#txIdLock?.release();
|
|
2501
|
+
this.#broadcastChannel.close();
|
|
2502
|
+
}
|
|
2503
|
+
|
|
2504
|
+
/**
|
|
2505
|
+
* Freeze our view of the database.
|
|
2506
|
+
* The view includes the transactions received so far but is not
|
|
2507
|
+
* guaranteed to be completely up to date (this allows this method
|
|
2508
|
+
* to be synchronous). Unfreeze the view with rejoin().
|
|
2509
|
+
*/
|
|
2510
|
+
isolateForRead() {
|
|
2511
|
+
if (this.#isolationState !== null) {
|
|
2512
|
+
throw new Error('Already in isolated state');
|
|
2513
|
+
}
|
|
2514
|
+
this.#isolationState = 'read';
|
|
2515
|
+
|
|
2516
|
+
if (this.#waFile.checkReset()) {
|
|
2517
|
+
// The WAL file has been reset with a full checkpoint. Our view
|
|
2518
|
+
// must be at the final transaction before the checkpoint for
|
|
2519
|
+
// that to have happened. The previous overlay is now stale. In
|
|
2520
|
+
// case we haven't received the checkpoint broadcast, make sure
|
|
2521
|
+
// the overlay is cleared.
|
|
2522
|
+
this.#handleCheckpoint(this.#waFile.txId);
|
|
2523
|
+
}
|
|
2524
|
+
}
|
|
2525
|
+
|
|
2526
|
+
/**
|
|
2527
|
+
* Freeze our view of the database for writing.
|
|
2528
|
+
* The view includes all transactions. Unfreeze the view with rejoin().
|
|
2529
|
+
*/
|
|
2530
|
+
isolateForWrite() {
|
|
2531
|
+
if (this.#isolationState !== null) {
|
|
2532
|
+
throw new Error('Already in isolated state');
|
|
2533
|
+
}
|
|
2534
|
+
this.#isolationState = 'write';
|
|
2535
|
+
|
|
2536
|
+
// Backstop is not needed while writing because we will be current.
|
|
2537
|
+
clearTimeout(this.#backstopTimer);
|
|
2538
|
+
this.#backstopTimer = null;
|
|
2539
|
+
|
|
2540
|
+
if (this.#waFile.checkReset()) {
|
|
2541
|
+
// The WAL file has been reset with a full checkpoint. Our view
|
|
2542
|
+
// must be at the final transaction before the checkpoint for
|
|
2543
|
+
// that to have happened. The previous overlay is now stale. In
|
|
2544
|
+
// case we haven't received the checkpoint broadcast, make sure
|
|
2545
|
+
// the overlay is cleared.
|
|
2546
|
+
this.#handleCheckpoint(this.#waFile.txId);
|
|
2547
|
+
}
|
|
2548
|
+
|
|
2549
|
+
// A writer needs all previous transactions assimilated.
|
|
2550
|
+
this.#advanceTxId({ readToCurrent: true });
|
|
2551
|
+
}
|
|
2552
|
+
|
|
2553
|
+
rejoin() {
|
|
2554
|
+
if (this.#isolationState === 'write') {
|
|
2555
|
+
// Resume backstop after write isolation.
|
|
2556
|
+
this.#backstop();
|
|
2557
|
+
} else {
|
|
2558
|
+
// Catch up on new transactions that arrived while isolated.
|
|
2559
|
+
this.#advanceTxId();
|
|
2560
|
+
}
|
|
2561
|
+
this.#isolationState = null;
|
|
2562
|
+
}
|
|
2563
|
+
|
|
2564
|
+
/**
|
|
2565
|
+
* @param {number} offset
|
|
2566
|
+
* @return {Uint8Array?}
|
|
2567
|
+
*/
|
|
2568
|
+
read(offset) {
|
|
2569
|
+
// First look for the page in any write transaction in progress.
|
|
2570
|
+
// If the page is not found in the transaction overlay, look in the
|
|
2571
|
+
// write-ahead overlay.
|
|
2572
|
+
const pageEntry = this.#txActive?.pages.get(offset) ?? this.#waOverlay.get(offset);
|
|
2573
|
+
if (pageEntry) {
|
|
2574
|
+
this.log?.(`%cread page at offset ${offset} from WAL ${pageEntry.waOffset}`, 'background-color: gold;');
|
|
2575
|
+
if (pageEntry.pageData) {
|
|
2576
|
+
// Page data is cached.
|
|
2577
|
+
return pageEntry.pageData;
|
|
2578
|
+
}
|
|
2579
|
+
|
|
2580
|
+
// Read the page from the WAL file.
|
|
2581
|
+
const buffer = new Uint8Array(pageEntry.pageSize);
|
|
2582
|
+
this.#waFile.accessHandle.read(buffer, { at: pageEntry.waOffset });
|
|
2583
|
+
return buffer;
|
|
2584
|
+
}
|
|
2585
|
+
return null;
|
|
2586
|
+
}
|
|
2587
|
+
|
|
2588
|
+
/**
|
|
2589
|
+
* @param {number} offset
|
|
2590
|
+
* @param {Uint8Array} data
|
|
2591
|
+
*/
|
|
2592
|
+
write(offset, data) {
|
|
2593
|
+
if (this.#isolationState !== 'write') {
|
|
2594
|
+
throw new Error('Not in write isolated state');
|
|
2595
|
+
}
|
|
2596
|
+
|
|
2597
|
+
if (!this.#txActive) {
|
|
2598
|
+
// There is no active transaction so create one.
|
|
2599
|
+
this.#txActive = this.#waFile.beginTx();
|
|
2600
|
+
}
|
|
2601
|
+
const waOffset = this.#waFile.writePage(offset, data.slice());
|
|
2602
|
+
this.log?.(`%c#write page at ${offset} to WAL ${waOffset}`, 'background-color: lightskyblue;');
|
|
2603
|
+
}
|
|
2604
|
+
|
|
2605
|
+
/**
|
|
2606
|
+
* @param {number} newSize
|
|
2607
|
+
*/
|
|
2608
|
+
truncate(newSize) {
|
|
2609
|
+
// Remove any pages past the truncation point. We don't need to save
|
|
2610
|
+
// the file size because that will be extracted from page 1.
|
|
2611
|
+
for (const offset of this.#txActive.pages.keys()) {
|
|
2612
|
+
if (offset >= newSize) {
|
|
2613
|
+
this.#txActive.pages.delete(offset);
|
|
2614
|
+
}
|
|
2615
|
+
}
|
|
2616
|
+
}
|
|
2617
|
+
|
|
2618
|
+
getFileSize() {
|
|
2619
|
+
// If the overlay is empty, the last file size may no longer be valid
|
|
2620
|
+
// if direct changes were made to the main database file.
|
|
2621
|
+
return this.#waOverlay.size ? this.#dbFileSize : null;
|
|
2622
|
+
}
|
|
2623
|
+
|
|
2624
|
+
commit() {
|
|
2625
|
+
// Persist the final pending transaction page with the database size.
|
|
2626
|
+
this.#waFile.commitTx();
|
|
2627
|
+
|
|
2628
|
+
// Incorporate the transaction locally.
|
|
2629
|
+
this.#activateTx(this.#txActive);
|
|
2630
|
+
this.#updateTxIdLock();
|
|
2631
|
+
|
|
2632
|
+
const payload = { type: 'tx', tx: this.#txActive };
|
|
2633
|
+
// this.#handleMessage(new MessageEvent('message', { data: payload }));
|
|
2634
|
+
// this.#advanceTxId();
|
|
2635
|
+
this.#txActive = null;
|
|
2636
|
+
|
|
2637
|
+
// Send the transaction to other connections.
|
|
2638
|
+
this.#broadcastChannel.postMessage(payload);
|
|
2639
|
+
}
|
|
2640
|
+
|
|
2641
|
+
rollback() {
|
|
2642
|
+
// Discard transaction pages.
|
|
2643
|
+
this.#waFile.abortTx();
|
|
2644
|
+
this.#txActive = null;
|
|
2645
|
+
}
|
|
2646
|
+
|
|
2647
|
+
/**
|
|
2648
|
+
* @param {'normal'|'full'} mode
|
|
2649
|
+
*/
|
|
2650
|
+
sync(mode) {
|
|
2651
|
+
if (mode === 'full') {
|
|
2652
|
+
this.#waFile.accessHandle.flush();
|
|
2653
|
+
}
|
|
2654
|
+
}
|
|
2655
|
+
|
|
2656
|
+
/**
|
|
2657
|
+
* Flush all write-ahead transactions to the main database file.
|
|
2658
|
+
* There must be no other connections reading or writing.
|
|
2659
|
+
* @param {'passive'|'full'|'restart'|'truncate'} mode
|
|
2660
|
+
*/
|
|
2661
|
+
async checkpoint(mode) {
|
|
2662
|
+
if (mode !== 'passive') {
|
|
2663
|
+
this.isolateForWrite();
|
|
2664
|
+
}
|
|
2665
|
+
try {
|
|
2666
|
+
const options = {
|
|
2667
|
+
isRestart: mode !== 'passive',
|
|
2668
|
+
isRequired: mode !== 'passive'
|
|
2669
|
+
};
|
|
2670
|
+
await this.#checkpoint(options);
|
|
2671
|
+
|
|
2672
|
+
if (mode === 'truncate') {
|
|
2673
|
+
this.#waFile.accessHandle.truncate(this.#waFile.currentOffset);
|
|
2674
|
+
this.log?.(`%ccheckpoint restart WAL file`, 'background-color: lightgreen;');
|
|
2675
|
+
}
|
|
2676
|
+
} finally {
|
|
2677
|
+
if (mode !== 'passive') {
|
|
2678
|
+
this.rejoin();
|
|
2679
|
+
}
|
|
2680
|
+
}
|
|
2681
|
+
}
|
|
2682
|
+
|
|
2683
|
+
/**
|
|
2684
|
+
* Return the known usage size of the write-ahead file. Note that the
|
|
2685
|
+
* actual file size may be larger if this connection is not current
|
|
2686
|
+
* or if the file has obsolete content past the current point.
|
|
2687
|
+
* @returns {number}
|
|
2688
|
+
*/
|
|
2689
|
+
getWriteAheadSize() {
|
|
2690
|
+
return this.#waFile.currentOffset;
|
|
2691
|
+
}
|
|
2692
|
+
|
|
2693
|
+
/**
|
|
2694
|
+
* Incorporate a transaction into our view of the database.
|
|
2695
|
+
* @param {Transaction} tx
|
|
2696
|
+
*/
|
|
2697
|
+
#activateTx(tx) {
|
|
2698
|
+
// Transfer to the active collection of transactions.
|
|
2699
|
+
this.#mapIdToTx.set(tx.id, tx);
|
|
2700
|
+
|
|
2701
|
+
// Add transaction pages to the write-ahead overlay.
|
|
2702
|
+
for (const [offset, pageEntry] of tx.pages) {
|
|
2703
|
+
this.#waOverlay.set(offset, pageEntry);
|
|
2704
|
+
}
|
|
2705
|
+
this.#dbFileSize = tx.dbFileSize;
|
|
2706
|
+
}
|
|
2707
|
+
|
|
2708
|
+
/**
|
|
2709
|
+
* Advance the local view of the database. By default, advance to the
|
|
2710
|
+
* last broadcast transaction. Optionally, also advance through any
|
|
2711
|
+
* additional transactions in the WAL file to be fully current.
|
|
2712
|
+
*
|
|
2713
|
+
* @param {{readToCurrent?: boolean}} options
|
|
2714
|
+
*/
|
|
2715
|
+
#advanceTxId(options = {}) {
|
|
2716
|
+
let didAdvance = false;
|
|
2717
|
+
while (this.#pendingTx.size) {
|
|
2718
|
+
// Fetch the next transaction in sequence. Usually this will come
|
|
2719
|
+
// from pendingTx, but if it is missing then read it from the file.
|
|
2720
|
+
const nextTxId = this.#waFile.txId + 1;
|
|
2721
|
+
let tx;
|
|
2722
|
+
if (this.#pendingTx.has(nextTxId)) {
|
|
2723
|
+
tx = this.#pendingTx.get(nextTxId);
|
|
2724
|
+
this.#pendingTx.delete(tx.id);
|
|
2725
|
+
this.#waFile.skipTx(tx.id, tx.waOffsetEnd);
|
|
2726
|
+
} else {
|
|
2727
|
+
tx = this.#waFile.readTx();
|
|
2728
|
+
}
|
|
2729
|
+
|
|
2730
|
+
this.#activateTx(tx);
|
|
2731
|
+
didAdvance = true;
|
|
2732
|
+
}
|
|
2733
|
+
|
|
2734
|
+
if (options.readToCurrent) {
|
|
2735
|
+
// Read all additional transactions from the WAL file.
|
|
2736
|
+
for (const tx of this.#waFile.readAllTx()) {
|
|
2737
|
+
this.#activateTx(tx);
|
|
2738
|
+
didAdvance = true;
|
|
2739
|
+
}
|
|
2740
|
+
}
|
|
2741
|
+
|
|
2742
|
+
if (didAdvance) {
|
|
2743
|
+
// Publish our new view txId.
|
|
2744
|
+
this.#updateTxIdLock();
|
|
2745
|
+
}
|
|
2746
|
+
}
|
|
2747
|
+
|
|
2748
|
+
/**
|
|
2749
|
+
* Move pages from write-ahead to main database file.
|
|
2750
|
+
*
|
|
2751
|
+
* @param {{isRestart?: boolean, isRequired?: boolean}} options
|
|
2752
|
+
*/
|
|
2753
|
+
async #checkpoint(options = {}) {
|
|
2754
|
+
// By default, checkpointing is abandoned if another connection is
|
|
2755
|
+
// already checkpointing. With the isRequired option, a checkpoint
|
|
2756
|
+
// is always performed. This is necessary for leaving write-ahead
|
|
2757
|
+
// mode or a user-requested checkpoint.
|
|
2758
|
+
const lockOptions = {
|
|
2759
|
+
ifAvailable: !options.isRequired,
|
|
2760
|
+
};
|
|
2761
|
+
|
|
2762
|
+
await navigator.locks.request(`${this.#zName}-ckpt`, lockOptions, async lock => {
|
|
2763
|
+
if (!lock) return null;
|
|
2764
|
+
|
|
2765
|
+
/** @type {number} */ let ckptId;
|
|
2766
|
+
if (options.isRestart) {
|
|
2767
|
+
// Full checkpoint, use the current WAL file txId.
|
|
2768
|
+
ckptId = this.#waFile.txId;
|
|
2769
|
+
|
|
2770
|
+
// Wait for all connections to reach this txId. Each connection
|
|
2771
|
+
// acquires a shared lock whose name contains the database name,
|
|
2772
|
+
// the minimum and maximum txId it has in mapIdToTx. We want all
|
|
2773
|
+
// maximum txId values to be ckptId.
|
|
2774
|
+
let pendingLockNames = [];
|
|
2775
|
+
do {
|
|
2776
|
+
// Wait for connections with lower maximum txIds. When a
|
|
2777
|
+
// connection advances its txId, it will release its previous
|
|
2778
|
+
// lock and acquire a new one.
|
|
2779
|
+
await Promise.all(
|
|
2780
|
+
pendingLockNames.map(name => navigator.locks.request(name, async () => {}))
|
|
2781
|
+
);
|
|
2782
|
+
|
|
2783
|
+
// Refresh the list of locks with lower txIds.
|
|
2784
|
+
pendingLockNames = (await this.#getTxIdLocks())
|
|
2785
|
+
.filter(value => value.maxTxId < ckptId)
|
|
2786
|
+
.map(value => value.name);
|
|
2787
|
+
} while (pendingLockNames.length > 0);
|
|
2788
|
+
this.log?.(`%c#checkpoint full txId ${ckptId}`, 'background-color: lightgreen;');
|
|
2789
|
+
} else {
|
|
2790
|
+
// Not a full checkpoint, so find the lowest txId in use by any
|
|
2791
|
+
// connection.
|
|
2792
|
+
ckptId = (await this.#getTxIdLocks())
|
|
2793
|
+
.reduce((min, value) => Math.min(min, value.maxTxId), this.#waFile.txId);
|
|
2794
|
+
this.log?.(`%c#checkpoint partial txId ${ckptId}`, 'background-color: lightgreen;');
|
|
2795
|
+
}
|
|
2796
|
+
|
|
2797
|
+
// Sync the WAL file. This ensures that if there is a crash after
|
|
2798
|
+
// part of the WAL has been copied, the uncopied part will still be
|
|
2799
|
+
// available afterwards.
|
|
2800
|
+
this.#waFile.accessHandle.flush();
|
|
2801
|
+
|
|
2802
|
+
// Starting at ckptId and going backwards (earlier), write transaction
|
|
2803
|
+
// pages to the main database file. Do not overwrite a page written
|
|
2804
|
+
// by a later transaction.
|
|
2805
|
+
const writtenOffsets = new Set();
|
|
2806
|
+
let dbFileSize = 0;
|
|
2807
|
+
let tx = /** @type {Transaction} */ ({ id: ckptId + 1 });
|
|
2808
|
+
while (tx = this.#mapIdToTx.get(tx.id - 1)) {
|
|
2809
|
+
if (tx.id === ckptId) {
|
|
2810
|
+
// Set the file size from the latest transaction. This may be
|
|
2811
|
+
// unnecessary as SQLite is not known to reduce the database size
|
|
2812
|
+
// except with VACUUM.
|
|
2813
|
+
dbFileSize = tx.dbFileSize;
|
|
2814
|
+
this.#dbHandle.truncate(dbFileSize);
|
|
2815
|
+
}
|
|
2816
|
+
|
|
2817
|
+
for (const [offset, pageEntry] of tx.pages) {
|
|
2818
|
+
if (offset < dbFileSize && !writtenOffsets.has(offset)) {
|
|
2819
|
+
let pageData = pageEntry.pageData;
|
|
2820
|
+
if (!pageData) {
|
|
2821
|
+
// Page data was not cached, so read it from the WAL file.
|
|
2822
|
+
pageData = new Uint8Array(pageEntry.pageSize);
|
|
2823
|
+
const nRead = this.#waFile.accessHandle.read(
|
|
2824
|
+
pageData,
|
|
2825
|
+
{ at: pageEntry.waOffset });
|
|
2826
|
+
if (nRead !== pageData.byteLength) {
|
|
2827
|
+
throw new Error('Checkpoint read failed');
|
|
2828
|
+
}
|
|
2829
|
+
}
|
|
2830
|
+
|
|
2831
|
+
// Write the page to the database file.
|
|
2832
|
+
const nWritten = this.#dbHandle.write(pageData, { at: offset });
|
|
2833
|
+
if (nWritten !== pageData.byteLength) {
|
|
2834
|
+
throw new Error('Checkpoint write failed');
|
|
2835
|
+
}
|
|
2836
|
+
writtenOffsets.add(offset);
|
|
2837
|
+
this.log?.(`%c#checkpoint wrote txId ${tx.id} page at ${offset} to database`, 'background-color: lightgreen;');
|
|
2838
|
+
}
|
|
2839
|
+
}
|
|
2840
|
+
}
|
|
2841
|
+
|
|
2842
|
+
if (writtenOffsets.size > 0) {
|
|
2843
|
+
// Ensure data is safely in the file.
|
|
2844
|
+
this.#dbHandle.flush();
|
|
2845
|
+
|
|
2846
|
+
// Notify other connections and ourselves of the checkpoint.
|
|
2847
|
+
this.#broadcastChannel.postMessage({
|
|
2848
|
+
type: 'ckpt',
|
|
2849
|
+
ckptId,
|
|
2850
|
+
});
|
|
2851
|
+
this.#handleCheckpoint(ckptId);
|
|
2852
|
+
}
|
|
2853
|
+
|
|
2854
|
+
if (options.isRestart) {
|
|
2855
|
+
this.#waFile.reset();
|
|
2856
|
+
}
|
|
2857
|
+
});
|
|
2858
|
+
}
|
|
2859
|
+
|
|
2860
|
+
/**
|
|
2861
|
+
* After a checkpoint, remove checkpointed pages from write-ahead.
|
|
2862
|
+
* The checkpoint may be been done locally or by another connection.
|
|
2863
|
+
* @param {number} ckptId
|
|
2864
|
+
*/
|
|
2865
|
+
#handleCheckpoint(ckptId) {
|
|
2866
|
+
this.log?.(`%c#handleCheckpoint to txId ${ckptId}`, 'background-color: lightgreen;');
|
|
2867
|
+
|
|
2868
|
+
// Loop backwards from ckptId.
|
|
2869
|
+
let tx = /** @type {Transaction} */ ({ id: ckptId + 1 });
|
|
2870
|
+
while (tx = this.#mapIdToTx.get(tx.id - 1)) {
|
|
2871
|
+
// Remove pages from write-ahead overlay.
|
|
2872
|
+
for (const [offset, page] of tx.pages.entries()) {
|
|
2873
|
+
// Be sure not to remove a newer version of the page.
|
|
2874
|
+
const overlayPage = this.#waOverlay.get(offset);
|
|
2875
|
+
if (overlayPage === page) {
|
|
2876
|
+
this.log?.(`%cremove txId ${tx.id} page at offset ${offset}`, 'background-color: lightgreen;');
|
|
2877
|
+
this.#waOverlay.delete(offset);
|
|
2878
|
+
}
|
|
2879
|
+
}
|
|
2880
|
+
|
|
2881
|
+
// Remove transaction.
|
|
2882
|
+
this.#mapIdToTx.delete(tx.id);
|
|
2883
|
+
}
|
|
2884
|
+
this.#updateTxIdLock();
|
|
2885
|
+
}
|
|
2886
|
+
|
|
2887
|
+
/**
|
|
2888
|
+
* @param {MessageEvent} event
|
|
2889
|
+
*/
|
|
2890
|
+
#handleMessage(event) {
|
|
2891
|
+
if (event.data.type === 'tx') {
|
|
2892
|
+
// New transaction from another connection. Don't use it if we
|
|
2893
|
+
// already have it.
|
|
2894
|
+
/** @type {Transaction} */ const tx = event.data.tx;
|
|
2895
|
+
if (tx.id > this.#waFile.txId) {
|
|
2896
|
+
this.#pendingTx.set(tx.id, tx);
|
|
2897
|
+
if (this.#isolationState === null) {
|
|
2898
|
+
// Not in an isolated state, so advance our view of the database.
|
|
2899
|
+
this.#advanceTxId();
|
|
2900
|
+
}
|
|
2901
|
+
}
|
|
2902
|
+
} else if (event.data.type === 'ckpt') {
|
|
2903
|
+
// Checkpoint notification from another connection.
|
|
2904
|
+
/** @type {number} */ const ckptId = event.data.ckptId;
|
|
2905
|
+
this.#handleCheckpoint(ckptId);
|
|
2906
|
+
}
|
|
2907
|
+
}
|
|
2908
|
+
|
|
2909
|
+
/**
|
|
2910
|
+
* Periodic check for recovering from lost transaction broadcasts.
|
|
2911
|
+
*/
|
|
2912
|
+
async #backstop() {
|
|
2913
|
+
try {
|
|
2914
|
+
if (this.#backstopTimer) {
|
|
2915
|
+
if (this.#isolationState === null) {
|
|
2916
|
+
// Not in an isolated state, so advance our view of the database.
|
|
2917
|
+
const oldTxId = this.#waFile.txId;
|
|
2918
|
+
this.#advanceTxId({ readToCurrent: true });
|
|
2919
|
+
if (this.#waFile.txId > oldTxId) {
|
|
2920
|
+
this.log?.(`%cbackstop txId ${oldTxId} -> ${this.#waFile.txId}`, 'background-color: lightyellow;');
|
|
2921
|
+
}
|
|
2922
|
+
}
|
|
2923
|
+
}
|
|
2924
|
+
} catch (e) {
|
|
2925
|
+
console.error('Backstop failed', e);
|
|
2926
|
+
}
|
|
2927
|
+
|
|
2928
|
+
// Schedule next backstop. Add a bit of jitter to decorrelate
|
|
2929
|
+
// backstops across multiple connections.
|
|
2930
|
+
const delay = this.options.backstopInterval * (0.9 + 0.2 * Math.random());
|
|
2931
|
+
this.#backstopTimer = self.setTimeout(() => {
|
|
2932
|
+
this.#backstop();
|
|
2933
|
+
}, delay);
|
|
2934
|
+
}
|
|
2935
|
+
|
|
2936
|
+
/**
|
|
2937
|
+
* Update the lock that publishes our current txId.
|
|
2938
|
+
*/
|
|
2939
|
+
async #updateTxIdLock() {
|
|
2940
|
+
// Our view of the database, i.e. the txId, is encoded into the name
|
|
2941
|
+
// of a lock so other connections can see it. When our txId changes,
|
|
2942
|
+
// we acquire a new lock and release the old one. We must not release
|
|
2943
|
+
// the old lock until the new one is in place.
|
|
2944
|
+
const oldLock = this.#txIdLock;
|
|
2945
|
+
const newLockName = this.#encodeTxIdLockName();
|
|
2946
|
+
if (oldLock?.name !== newLockName) {
|
|
2947
|
+
this.#txIdLock = new _Lock_js__WEBPACK_IMPORTED_MODULE_0__.Lock(newLockName);
|
|
2948
|
+
await this.#txIdLock.acquire('shared').then(() => {
|
|
2949
|
+
// The new lock is acquired.
|
|
2950
|
+
oldLock?.release();
|
|
2951
|
+
});
|
|
2952
|
+
|
|
2953
|
+
if (this.log) {
|
|
2954
|
+
const { minTxId, maxTxId } = this.#decodeTxIdLockName(newLockName);
|
|
2955
|
+
this.log?.(`%ctxId to ${minTxId}:${maxTxId}`, 'background-color: pink;');
|
|
2956
|
+
}
|
|
2957
|
+
}
|
|
2958
|
+
}
|
|
2959
|
+
|
|
2960
|
+
/**
|
|
2961
|
+
* Get all txId locks for this database.
|
|
2962
|
+
* @returns {Promise<{name: string, minTxId: number, maxTxId: number}[]>}
|
|
2963
|
+
*/
|
|
2964
|
+
async #getTxIdLocks() {
|
|
2965
|
+
const { held } = await navigator.locks.query();
|
|
2966
|
+
return held
|
|
2967
|
+
.map(lock => this.#decodeTxIdLockName(lock.name))
|
|
2968
|
+
.filter(value => value !== null)
|
|
2969
|
+
}
|
|
2970
|
+
|
|
2971
|
+
/**
|
|
2972
|
+
* @returns {string}
|
|
2973
|
+
*/
|
|
2974
|
+
#encodeTxIdLockName() {
|
|
2975
|
+
// The maxTxId is our current view of the database. The minTxId is
|
|
2976
|
+
// the lowest txId we get pages from the WAL for, which is the lowest
|
|
2977
|
+
// key in mapIdToTx. If mapIdToTx is empty then we aren't reading
|
|
2978
|
+
// from the WAL at all - in this case we arbitrarily set minTxId to
|
|
2979
|
+
// invalid value maxTxId + 1.
|
|
2980
|
+
const maxTxId = this.#waFile.txId;
|
|
2981
|
+
const minTxId = this.#mapIdToTx.keys().next().value ?? (maxTxId + 1);
|
|
2982
|
+
return `${this.#zName}-txId<${minTxId}:${maxTxId}>`;
|
|
2983
|
+
}
|
|
2984
|
+
|
|
2985
|
+
/**
|
|
2986
|
+
* @param {string} lockName
|
|
2987
|
+
* @returns {{name: string, minTxId: number, maxTxId: number}}
|
|
2988
|
+
*/
|
|
2989
|
+
#decodeTxIdLockName(lockName) {
|
|
2990
|
+
const match = lockName.match(/^(.*)-txId<(\d+):(\d+)>$/);
|
|
2991
|
+
if (match?.[1] === this.#zName) {
|
|
2992
|
+
// This txId lock is for this database.
|
|
2993
|
+
return {
|
|
2994
|
+
name: match[1],
|
|
2995
|
+
minTxId: parseInt(match[2]),
|
|
2996
|
+
maxTxId: parseInt(match[3])
|
|
2997
|
+
};
|
|
2998
|
+
}
|
|
2999
|
+
return null;
|
|
3000
|
+
}
|
|
3001
|
+
}
|
|
3002
|
+
|
|
3003
|
+
class WriteAheadFile {
|
|
3004
|
+
static MAGIC = 0x377f0684;
|
|
3005
|
+
static FILE_HEADER_SIZE = 32;
|
|
3006
|
+
static FRAME_HEADER_SIZE = 32;
|
|
3007
|
+
static FRAME_TYPE_PAGE = 0;
|
|
3008
|
+
static FRAME_TYPE_COMMIT = 1;
|
|
3009
|
+
|
|
3010
|
+
/** @type {FileSystemSyncAccessHandle} */ accessHandle;
|
|
3011
|
+
/** @type {number} */ currentOffset;
|
|
3012
|
+
|
|
3013
|
+
txId = 0;
|
|
3014
|
+
salt1 = 0;
|
|
3015
|
+
salt2 = 0;
|
|
3016
|
+
|
|
3017
|
+
/** @type {Transaction} */ txInProgress = null;
|
|
3018
|
+
|
|
3019
|
+
constructor(accessHandle) {
|
|
3020
|
+
this.accessHandle = accessHandle;
|
|
3021
|
+
}
|
|
3022
|
+
|
|
3023
|
+
create() {
|
|
3024
|
+
this.accessHandle.truncate(0);
|
|
3025
|
+
this.#writeFileHeader();
|
|
3026
|
+
}
|
|
3027
|
+
|
|
3028
|
+
open() {
|
|
3029
|
+
// Read file headers from both header slots and use the one with the
|
|
3030
|
+
// higher nextTxId.
|
|
3031
|
+
const fileHeader = [0, SECTOR_SIZE]
|
|
3032
|
+
.map(offset => this.#readFileHeader(offset))
|
|
3033
|
+
.filter(h => h)
|
|
3034
|
+
.sort((a, b) => b.nextTxId - a.nextTxId)[0];
|
|
3035
|
+
|
|
3036
|
+
this.currentOffset = WAL_FRAME_BASE;
|
|
3037
|
+
this.txId = fileHeader.nextTxId - 1;
|
|
3038
|
+
this.salt1 = fileHeader.salt1;
|
|
3039
|
+
this.salt2 = fileHeader.salt2;
|
|
3040
|
+
}
|
|
3041
|
+
|
|
3042
|
+
reset(options = { truncate: true }) {
|
|
3043
|
+
const fileHeader = this.#writeFileHeader();
|
|
3044
|
+
if (options.truncate) {
|
|
3045
|
+
this.accessHandle.truncate(WAL_FRAME_BASE);
|
|
3046
|
+
}
|
|
3047
|
+
|
|
3048
|
+
this.currentOffset = WAL_FRAME_BASE;
|
|
3049
|
+
this.salt1 = fileHeader.salt1;
|
|
3050
|
+
this.salt2 = fileHeader.salt2;
|
|
3051
|
+
}
|
|
3052
|
+
|
|
3053
|
+
checkReset() {
|
|
3054
|
+
// Check for a new header. There are two header slots in the file.
|
|
3055
|
+
// Look in the slot that is not current, which will be at offset 0
|
|
3056
|
+
// or SECTOR_SIZE depending on the current salt1 value (salt1 is
|
|
3057
|
+
// incremented on each new header).
|
|
3058
|
+
const headerOffset = (this.salt1 & 0x1) ? 0 : SECTOR_SIZE;
|
|
3059
|
+
const fileHeader = this.#readFileHeader(headerOffset);
|
|
3060
|
+
if (fileHeader?.nextTxId > this.txId &&
|
|
3061
|
+
fileHeader.salt1 === ((this.salt1 + 1) | 0)) {
|
|
3062
|
+
// The WAL file has been reset.
|
|
3063
|
+
this.currentOffset = WAL_FRAME_BASE;
|
|
3064
|
+
this.salt1 = fileHeader.salt1;
|
|
3065
|
+
this.salt2 = fileHeader.salt2;
|
|
3066
|
+
return true;
|
|
3067
|
+
}
|
|
3068
|
+
return false;
|
|
3069
|
+
}
|
|
3070
|
+
|
|
3071
|
+
*readAllTx() {
|
|
3072
|
+
while (true) {
|
|
3073
|
+
const tx = this.readTx();
|
|
3074
|
+
if (!tx) break;
|
|
3075
|
+
yield tx;
|
|
3076
|
+
}
|
|
3077
|
+
}
|
|
3078
|
+
|
|
3079
|
+
/**
|
|
3080
|
+
* @returns {Transaction?}
|
|
3081
|
+
*/
|
|
3082
|
+
readTx() {
|
|
3083
|
+
// Read the next complete transaction or return null.
|
|
3084
|
+
let offset = this.currentOffset;
|
|
3085
|
+
/** @type {Transaction?} */ let tx = null;
|
|
3086
|
+
while (true) {
|
|
3087
|
+
const frame = this.#readFrame(offset);
|
|
3088
|
+
if (!frame) return null;
|
|
3089
|
+
|
|
3090
|
+
if (frame.frameType === WriteAheadFile.FRAME_TYPE_COMMIT) {
|
|
3091
|
+
// Update the instance state.
|
|
3092
|
+
this.txId += 1;
|
|
3093
|
+
this.currentOffset = offset + frame.byteLength;
|
|
3094
|
+
|
|
3095
|
+
tx.id = this.txId;
|
|
3096
|
+
tx.dbFileSize = frame.dbFileSize;
|
|
3097
|
+
tx.waOffsetEnd = this.currentOffset;
|
|
3098
|
+
return tx;
|
|
3099
|
+
}
|
|
3100
|
+
|
|
3101
|
+
// frameType === WriteAheadFile.FRAME_TYPE_PAGE
|
|
3102
|
+
if (!tx) {
|
|
3103
|
+
tx = {
|
|
3104
|
+
id: 0, // placeholder
|
|
3105
|
+
pages: new Map(),
|
|
3106
|
+
dbFileSize: 0, // placeholder
|
|
3107
|
+
dbPageSize: frame.pageData.byteLength,
|
|
3108
|
+
waOffsetEnd: 0 // placeholder
|
|
3109
|
+
};
|
|
3110
|
+
}
|
|
3111
|
+
|
|
3112
|
+
tx.pages.set(
|
|
3113
|
+
frame.pageOffset,
|
|
3114
|
+
{
|
|
3115
|
+
pageSize: frame.pageData.byteLength,
|
|
3116
|
+
waOffset: offset + WriteAheadFile.FRAME_HEADER_SIZE
|
|
3117
|
+
});
|
|
3118
|
+
|
|
3119
|
+
offset += frame.byteLength;
|
|
3120
|
+
}
|
|
3121
|
+
}
|
|
3122
|
+
|
|
3123
|
+
/**
|
|
3124
|
+
* This method is called when transaction(s) have been received by other
|
|
3125
|
+
* means than readTx(), e.g. via BroadcastChannel.
|
|
3126
|
+
*
|
|
3127
|
+
* @param {number} txId
|
|
3128
|
+
* @param {number} offset
|
|
3129
|
+
*/
|
|
3130
|
+
skipTx(txId, offset) {
|
|
3131
|
+
this.txId = txId;
|
|
3132
|
+
this.currentOffset = offset;
|
|
3133
|
+
}
|
|
3134
|
+
|
|
3135
|
+
/**
|
|
3136
|
+
*
|
|
3137
|
+
* @param {{overwrite?: boolean}} options
|
|
3138
|
+
* @returns {Transaction}
|
|
3139
|
+
*/
|
|
3140
|
+
beginTx(options = {}) {
|
|
3141
|
+
this.txInProgress = {
|
|
3142
|
+
id: this.txId + 1,
|
|
3143
|
+
pages: new Map(),
|
|
3144
|
+
dbFileSize: 0,
|
|
3145
|
+
dbPageSize: 0,
|
|
3146
|
+
waOffsetEnd: this.currentOffset
|
|
3147
|
+
};
|
|
3148
|
+
return this.txInProgress;
|
|
3149
|
+
}
|
|
3150
|
+
|
|
3151
|
+
/**
|
|
3152
|
+
* Write a page frame to the WAL file.
|
|
3153
|
+
*
|
|
3154
|
+
* @param {number} pageOffset
|
|
3155
|
+
* @param {Uint8Array} pageData
|
|
3156
|
+
*/
|
|
3157
|
+
writePage(pageOffset, pageData) {
|
|
3158
|
+
const headerView = new DataView(new ArrayBuffer(WriteAheadFile.FRAME_HEADER_SIZE));
|
|
3159
|
+
headerView.setUint8(0, WriteAheadFile.FRAME_TYPE_PAGE);
|
|
3160
|
+
headerView.setUint16(2, pageData.byteLength === 65536 ? 1 : pageData.byteLength);
|
|
3161
|
+
headerView.setBigUint64(8, BigInt(pageOffset));
|
|
3162
|
+
headerView.setUint32(16, this.salt1);
|
|
3163
|
+
headerView.setUint32(20, this.salt2);
|
|
3164
|
+
|
|
3165
|
+
const checksum = new Checksum();
|
|
3166
|
+
checksum.update(new Uint8Array(headerView.buffer, 0, WriteAheadFile.FRAME_HEADER_SIZE - 8));
|
|
3167
|
+
checksum.update(pageData);
|
|
3168
|
+
headerView.setUint32(24, checksum.s0);
|
|
3169
|
+
headerView.setUint32(28, checksum.s1);
|
|
3170
|
+
|
|
3171
|
+
const bytesWritten =
|
|
3172
|
+
this.accessHandle.write(headerView, { at: this.txInProgress.waOffsetEnd }) +
|
|
3173
|
+
this.accessHandle.write(pageData, {
|
|
3174
|
+
at: this.txInProgress.waOffsetEnd + WriteAheadFile.FRAME_HEADER_SIZE
|
|
3175
|
+
});
|
|
3176
|
+
if (bytesWritten !== headerView.byteLength + pageData.byteLength) {
|
|
3177
|
+
throw new Error('write failed');
|
|
3178
|
+
}
|
|
3179
|
+
|
|
3180
|
+
const pageEntry = {
|
|
3181
|
+
pageSize: pageData.byteLength,
|
|
3182
|
+
waOffset: this.txInProgress.waOffsetEnd + WriteAheadFile.FRAME_HEADER_SIZE
|
|
3183
|
+
};
|
|
3184
|
+
if (pageOffset === 0) {
|
|
3185
|
+
// This is page 1, which contains the database header.
|
|
3186
|
+
const dataView = new DataView(pageData.buffer, pageData.byteOffset, pageData.byteLength);
|
|
3187
|
+
const pageCount = dataView.getUint32(28);
|
|
3188
|
+
this.txInProgress.dbFileSize = pageCount * pageData.byteLength;
|
|
3189
|
+
this.txInProgress.dbPageSize = pageData.byteLength;
|
|
3190
|
+
|
|
3191
|
+
// Cache page 1 as a performance optimization and to exercise the
|
|
3192
|
+
// cache code path.
|
|
3193
|
+
pageEntry.pageData = pageData;
|
|
3194
|
+
}
|
|
3195
|
+
|
|
3196
|
+
this.txInProgress.pages.set(pageOffset, pageEntry);
|
|
3197
|
+
this.txInProgress.waOffsetEnd += bytesWritten;
|
|
3198
|
+
|
|
3199
|
+
return pageEntry.waOffset;
|
|
3200
|
+
}
|
|
3201
|
+
|
|
3202
|
+
/**
|
|
3203
|
+
* @returns {Transaction}
|
|
3204
|
+
*/
|
|
3205
|
+
commitTx() {
|
|
3206
|
+
const headerView = new DataView(new ArrayBuffer(WriteAheadFile.FRAME_HEADER_SIZE));
|
|
3207
|
+
headerView.setUint8(0, WriteAheadFile.FRAME_TYPE_COMMIT);
|
|
3208
|
+
headerView.setBigUint64(8, BigInt(this.txInProgress.dbFileSize));
|
|
3209
|
+
headerView.setUint32(16, this.salt1);
|
|
3210
|
+
headerView.setUint32(20, this.salt2);
|
|
3211
|
+
|
|
3212
|
+
const checksum = new Checksum();
|
|
3213
|
+
checksum.update(new Uint8Array(headerView.buffer, 0, WriteAheadFile.FRAME_HEADER_SIZE - 8));
|
|
3214
|
+
headerView.setUint32(24, checksum.s0);
|
|
3215
|
+
headerView.setUint32(28, checksum.s1);
|
|
3216
|
+
|
|
3217
|
+
const bytesWritten = this.accessHandle.write(headerView, {
|
|
3218
|
+
at: this.txInProgress.waOffsetEnd
|
|
3219
|
+
});
|
|
3220
|
+
if (bytesWritten !== headerView.byteLength) {
|
|
3221
|
+
throw new Error('write failed');
|
|
3222
|
+
}
|
|
3223
|
+
this.txInProgress.waOffsetEnd += bytesWritten;
|
|
3224
|
+
|
|
3225
|
+
const tx = this.txInProgress;
|
|
3226
|
+
this.txInProgress = null;
|
|
3227
|
+
this.currentOffset = tx.waOffsetEnd;
|
|
3228
|
+
this.txId = tx.id;
|
|
3229
|
+
return tx;
|
|
3230
|
+
}
|
|
3231
|
+
|
|
3232
|
+
abortTx() {
|
|
3233
|
+
this.txInProgress = null;
|
|
3234
|
+
}
|
|
3235
|
+
|
|
3236
|
+
#readFileHeader(offset) {
|
|
3237
|
+
const headerView = new DataView(new ArrayBuffer(WriteAheadFile.FILE_HEADER_SIZE));
|
|
3238
|
+
if (this.accessHandle.read(headerView, { at: offset }) !== headerView.byteLength) {
|
|
3239
|
+
return null;
|
|
3240
|
+
}
|
|
3241
|
+
|
|
3242
|
+
if (headerView.getUint32(0) !== WriteAheadFile.MAGIC) return null;
|
|
3243
|
+
|
|
3244
|
+
const checksum = new Checksum();
|
|
3245
|
+
checksum.update(new Uint8Array(headerView.buffer, 0, WriteAheadFile.FILE_HEADER_SIZE - 8));
|
|
3246
|
+
if (!checksum.matches(headerView.getUint32(24), headerView.getUint32(28))) {
|
|
3247
|
+
return null;
|
|
3248
|
+
}
|
|
3249
|
+
|
|
3250
|
+
return {
|
|
3251
|
+
nextTxId: Number(headerView.getBigUint64(8)),
|
|
3252
|
+
salt1: headerView.getUint32(16),
|
|
3253
|
+
salt2: headerView.getUint32(20)
|
|
3254
|
+
}
|
|
3255
|
+
}
|
|
3256
|
+
|
|
3257
|
+
#readFrame(offset) {
|
|
3258
|
+
const headerView = new DataView(new ArrayBuffer(WriteAheadFile.FRAME_HEADER_SIZE));
|
|
3259
|
+
if (this.accessHandle.read(headerView, { at: offset }) !== headerView.byteLength) {
|
|
3260
|
+
return null;
|
|
3261
|
+
}
|
|
3262
|
+
|
|
3263
|
+
// Verify the frame header salt values match the file header.
|
|
3264
|
+
const frameSalt1 = headerView.getUint32(16);
|
|
3265
|
+
const frameSalt2 = headerView.getUint32(20);
|
|
3266
|
+
if (frameSalt1 !== this.salt1 || frameSalt2 !== this.salt2) {
|
|
3267
|
+
return null;
|
|
3268
|
+
}
|
|
3269
|
+
|
|
3270
|
+
const payloadSize = (size => size === 1 ? 65536 : size)(headerView.getUint16(2));
|
|
3271
|
+
/** @type {Uint8Array} */ let payloadData;
|
|
3272
|
+
if (payloadSize) {
|
|
3273
|
+
payloadData = new Uint8Array(payloadSize);
|
|
3274
|
+
const payloadBytesRead = this.accessHandle.read(
|
|
3275
|
+
payloadData,
|
|
3276
|
+
{ at: offset + WriteAheadFile.FRAME_HEADER_SIZE });
|
|
3277
|
+
if (payloadBytesRead !== payloadSize ) return null;
|
|
3278
|
+
}
|
|
3279
|
+
|
|
3280
|
+
const checksum = new Checksum();
|
|
3281
|
+
checksum.update(new Uint8Array(headerView.buffer, 0, WriteAheadFile.FRAME_HEADER_SIZE - 8));
|
|
3282
|
+
if (payloadData) {
|
|
3283
|
+
checksum.update(payloadData);
|
|
3284
|
+
}
|
|
3285
|
+
if (!checksum.matches(headerView.getUint32(24), headerView.getUint32(28))) {
|
|
3286
|
+
return null;
|
|
3287
|
+
}
|
|
3288
|
+
|
|
3289
|
+
const frameType = headerView.getUint8(0);
|
|
3290
|
+
if (frameType === WriteAheadFile.FRAME_TYPE_PAGE) {
|
|
3291
|
+
return {
|
|
3292
|
+
frameType,
|
|
3293
|
+
byteLength: WriteAheadFile.FRAME_HEADER_SIZE + payloadSize,
|
|
3294
|
+
pageOffset: Number(headerView.getBigUint64(8)),
|
|
3295
|
+
pageData: payloadData
|
|
3296
|
+
}
|
|
3297
|
+
} else if (frameType === WriteAheadFile.FRAME_TYPE_COMMIT) {
|
|
3298
|
+
const flags = headerView.getUint8(1);
|
|
3299
|
+
return {
|
|
3300
|
+
frameType,
|
|
3301
|
+
byteLength: WriteAheadFile.FRAME_HEADER_SIZE,
|
|
3302
|
+
dbFileSize: Number(headerView.getBigUint64(8)),
|
|
3303
|
+
isOverwrite: !!(flags & 0x1)
|
|
3304
|
+
}
|
|
3305
|
+
}
|
|
3306
|
+
throw new Error(`Invalid frame type: ${frameType}`);
|
|
3307
|
+
}
|
|
3308
|
+
|
|
3309
|
+
#writeFileHeader() {
|
|
3310
|
+
// Derive new values from the previous values. Note that salt1 always
|
|
3311
|
+
// flips between even and odd so successive headers are written to
|
|
3312
|
+
// alternating slots. If the write fails, the file remains in a valid
|
|
3313
|
+
// state.
|
|
3314
|
+
const nextTxId = this.txId + 1;
|
|
3315
|
+
const salt1 = (this.salt1 + 1) | 0;
|
|
3316
|
+
const salt2 = Math.floor(Math.random() * 0xffffffff);
|
|
3317
|
+
const headerView = new DataView(new ArrayBuffer(WriteAheadFile.FILE_HEADER_SIZE));
|
|
3318
|
+
headerView.setUint32(0, WriteAheadFile.MAGIC);
|
|
3319
|
+
headerView.setBigUint64(8, BigInt(nextTxId));
|
|
3320
|
+
headerView.setUint32(16, salt1);
|
|
3321
|
+
headerView.setUint32(20, salt2);
|
|
3322
|
+
|
|
3323
|
+
const checksum = new Checksum();
|
|
3324
|
+
checksum.update(new Uint8Array(headerView.buffer, 0, WriteAheadFile.FILE_HEADER_SIZE - 8));
|
|
3325
|
+
headerView.setUint32(24, checksum.s0);
|
|
3326
|
+
headerView.setUint32(28, checksum.s1);
|
|
3327
|
+
|
|
3328
|
+
// A header with an even salt1 is written at offset 0, and with an
|
|
3329
|
+
// odd salt1 at SECTOR_SIZE.
|
|
3330
|
+
const headerOffset = (salt1 & 0x1) ? SECTOR_SIZE : 0;
|
|
3331
|
+
const bytesWritten = this.accessHandle.write(headerView, { at: headerOffset });
|
|
3332
|
+
if (bytesWritten !== headerView.byteLength) {
|
|
3333
|
+
throw new Error('write failed');
|
|
3334
|
+
}
|
|
3335
|
+
|
|
3336
|
+
this.accessHandle.flush();
|
|
3337
|
+
return { nextTxId, salt1, salt2 };
|
|
3338
|
+
}
|
|
3339
|
+
}
|
|
3340
|
+
|
|
3341
|
+
// https://www.sqlite.org/fileformat.html#checksum_algorithm
|
|
3342
|
+
class Checksum {
|
|
3343
|
+
/** @type {number} */ s0 = 0;
|
|
3344
|
+
/** @type {number} */ s1 = 0;
|
|
3345
|
+
|
|
3346
|
+
/**
|
|
3347
|
+
* @param {ArrayBuffer|ArrayBufferView} data
|
|
3348
|
+
*/
|
|
3349
|
+
update(data) {
|
|
3350
|
+
if ((data.byteLength % 8) !== 0) throw new Error('Data must be a multiple of 8 bytes');
|
|
3351
|
+
const words = ArrayBuffer.isView(data) ?
|
|
3352
|
+
new Uint32Array(data.buffer, data.byteOffset, data.byteLength / 4) :
|
|
3353
|
+
new Uint32Array(data);
|
|
3354
|
+
for (let i = 0; i < words.length; i += 2) {
|
|
3355
|
+
this.s0 = (this.s0 + words[i] + this.s1) >>> 0;
|
|
3356
|
+
this.s1 = (this.s1 + words[i + 1] + this.s0) >>> 0;
|
|
3357
|
+
}
|
|
3358
|
+
}
|
|
3359
|
+
|
|
3360
|
+
matches(s0, s1) {
|
|
3361
|
+
return this.s0 === s0 && this.s1 === s1;
|
|
3362
|
+
}
|
|
3363
|
+
}
|
|
3364
|
+
|
|
3365
|
+
class InvalidFrameError extends Error {
|
|
3366
|
+
constructor(message) {
|
|
3367
|
+
super(message);
|
|
3368
|
+
this.name = 'InvalidFrameError';
|
|
3369
|
+
}
|
|
3370
|
+
}
|
|
3371
|
+
|
|
3372
|
+
/***/ }
|
|
3373
|
+
|
|
3374
|
+
}]);
|
|
3375
|
+
//# sourceMappingURL=node_modules_pnpm_journeyapps_wa-sqlite_0_0_0-dev-20260225162137_node_modules_journeyapps_wa--3f11fc.umd.js.map
|