@powersync/web 1.35.0 → 1.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.umd.js +1126 -1231
- package/dist/index.umd.js.map +1 -1
- package/dist/worker/SharedSyncImplementation.umd.js +599 -3086
- package/dist/worker/SharedSyncImplementation.umd.js.map +1 -1
- package/dist/worker/WASQLiteDB.umd.js +860 -868
- package/dist/worker/WASQLiteDB.umd.js.map +1 -1
- package/lib/package.json +2 -3
- package/lib/src/db/PowerSyncDatabase.d.ts +1 -2
- package/lib/src/db/PowerSyncDatabase.js +3 -4
- package/lib/src/db/adapters/AsyncWebAdapter.d.ts +40 -0
- package/lib/src/db/adapters/AsyncWebAdapter.js +69 -0
- package/lib/src/db/adapters/SSRDBAdapter.d.ts +1 -2
- package/lib/src/db/adapters/SSRDBAdapter.js +5 -6
- package/lib/src/db/adapters/wa-sqlite/ConcurrentConnection.d.ts +56 -0
- package/lib/src/db/adapters/wa-sqlite/ConcurrentConnection.js +121 -0
- package/lib/src/db/adapters/wa-sqlite/DatabaseClient.d.ts +54 -0
- package/lib/src/db/adapters/wa-sqlite/DatabaseClient.js +227 -0
- package/lib/src/db/adapters/wa-sqlite/DatabaseServer.d.ts +47 -0
- package/lib/src/db/adapters/wa-sqlite/DatabaseServer.js +146 -0
- package/lib/src/db/adapters/wa-sqlite/RawSqliteConnection.d.ts +46 -0
- package/lib/src/db/adapters/wa-sqlite/RawSqliteConnection.js +147 -0
- package/lib/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.d.ts +14 -6
- package/lib/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.js +66 -39
- package/lib/src/db/adapters/wa-sqlite/vfs.d.ts +61 -0
- package/lib/src/db/adapters/wa-sqlite/vfs.js +91 -0
- package/lib/src/db/adapters/web-sql-flags.d.ts +5 -0
- package/lib/src/db/sync/SSRWebStreamingSyncImplementation.d.ts +1 -2
- package/lib/src/db/sync/SSRWebStreamingSyncImplementation.js +2 -3
- package/lib/src/db/sync/SharedWebStreamingSyncImplementation.js +4 -19
- package/lib/src/index.d.ts +1 -4
- package/lib/src/index.js +1 -4
- package/lib/src/shared/tab_close_signal.d.ts +11 -0
- package/lib/src/shared/tab_close_signal.js +26 -0
- package/lib/src/worker/db/MultiDatabaseServer.d.ts +17 -0
- package/lib/src/worker/db/MultiDatabaseServer.js +86 -0
- package/lib/src/worker/db/WASQLiteDB.worker.js +9 -48
- package/lib/src/worker/db/open-worker-database.d.ts +3 -3
- package/lib/src/worker/db/open-worker-database.js +1 -1
- package/lib/src/worker/sync/SharedSyncImplementation.d.ts +5 -6
- package/lib/src/worker/sync/SharedSyncImplementation.js +92 -54
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -4
- package/src/db/PowerSyncDatabase.ts +3 -3
- package/src/db/adapters/AsyncWebAdapter.ts +91 -0
- package/src/db/adapters/SSRDBAdapter.ts +7 -7
- package/src/db/adapters/wa-sqlite/ConcurrentConnection.ts +137 -0
- package/src/db/adapters/wa-sqlite/DatabaseClient.ts +325 -0
- package/src/db/adapters/wa-sqlite/DatabaseServer.ts +201 -0
- package/src/db/adapters/wa-sqlite/RawSqliteConnection.ts +191 -0
- package/src/db/adapters/wa-sqlite/WASQLiteOpenFactory.ts +87 -43
- package/src/db/adapters/wa-sqlite/vfs.ts +112 -0
- package/src/db/adapters/web-sql-flags.ts +6 -0
- package/src/db/sync/SSRWebStreamingSyncImplementation.ts +2 -3
- package/src/db/sync/SharedWebStreamingSyncImplementation.ts +4 -20
- package/src/index.ts +1 -4
- package/src/shared/tab_close_signal.ts +28 -0
- package/src/worker/db/MultiDatabaseServer.ts +104 -0
- package/src/worker/db/WASQLiteDB.worker.ts +10 -57
- package/src/worker/db/open-worker-database.ts +3 -3
- package/src/worker/sync/SharedSyncImplementation.ts +118 -58
- package/dist/_journeyapps_wa-sqlite-_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapp-89f0ba.index.umd.js +0 -1878
- package/dist/_journeyapps_wa-sqlite-_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapp-89f0ba.index.umd.js.map +0 -1
- package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-97ebe9.index.umd.js +0 -555
- package/dist/_journeyapps_wa-sqlite_src_examples_AccessHandlePoolVFS_js-_journeyapps_wa-sqlite_src_example-97ebe9.index.umd.js.map +0 -1
- package/lib/src/db/adapters/AbstractWebSQLOpenFactory.d.ts +0 -17
- package/lib/src/db/adapters/AbstractWebSQLOpenFactory.js +0 -33
- package/lib/src/db/adapters/AsyncDatabaseConnection.d.ts +0 -49
- package/lib/src/db/adapters/AsyncDatabaseConnection.js +0 -1
- package/lib/src/db/adapters/LockedAsyncDatabaseAdapter.d.ts +0 -109
- package/lib/src/db/adapters/LockedAsyncDatabaseAdapter.js +0 -401
- package/lib/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.d.ts +0 -59
- package/lib/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.js +0 -147
- package/lib/src/db/adapters/wa-sqlite/InternalWASQLiteDBAdapter.d.ts +0 -12
- package/lib/src/db/adapters/wa-sqlite/InternalWASQLiteDBAdapter.js +0 -19
- package/lib/src/db/adapters/wa-sqlite/WASQLiteConnection.d.ts +0 -155
- package/lib/src/db/adapters/wa-sqlite/WASQLiteConnection.js +0 -401
- package/lib/src/db/adapters/wa-sqlite/WASQLiteDBAdapter.d.ts +0 -32
- package/lib/src/db/adapters/wa-sqlite/WASQLiteDBAdapter.js +0 -49
- package/lib/src/worker/db/SharedWASQLiteConnection.d.ts +0 -42
- package/lib/src/worker/db/SharedWASQLiteConnection.js +0 -90
- package/lib/src/worker/db/WorkerWASQLiteConnection.d.ts +0 -9
- package/lib/src/worker/db/WorkerWASQLiteConnection.js +0 -12
- package/src/db/adapters/AbstractWebSQLOpenFactory.ts +0 -48
- package/src/db/adapters/AsyncDatabaseConnection.ts +0 -55
- package/src/db/adapters/LockedAsyncDatabaseAdapter.ts +0 -490
- package/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.ts +0 -201
- package/src/db/adapters/wa-sqlite/InternalWASQLiteDBAdapter.ts +0 -23
- package/src/db/adapters/wa-sqlite/WASQLiteConnection.ts +0 -497
- package/src/db/adapters/wa-sqlite/WASQLiteDBAdapter.ts +0 -86
- package/src/worker/db/SharedWASQLiteConnection.ts +0 -131
- package/src/worker/db/WorkerWASQLiteConnection.ts +0 -14
|
@@ -3,317 +3,6 @@ var sdk_web;
|
|
|
3
3
|
/******/ "use strict";
|
|
4
4
|
/******/ var __webpack_modules__ = ({
|
|
5
5
|
|
|
6
|
-
/***/ "../../node_modules/.pnpm/async-mutex@0.5.0/node_modules/async-mutex/index.mjs"
|
|
7
|
-
/*!*************************************************************************************!*\
|
|
8
|
-
!*** ../../node_modules/.pnpm/async-mutex@0.5.0/node_modules/async-mutex/index.mjs ***!
|
|
9
|
-
\*************************************************************************************/
|
|
10
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
11
|
-
|
|
12
|
-
__webpack_require__.r(__webpack_exports__);
|
|
13
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
14
|
-
/* harmony export */ E_ALREADY_LOCKED: () => (/* binding */ E_ALREADY_LOCKED),
|
|
15
|
-
/* harmony export */ E_CANCELED: () => (/* binding */ E_CANCELED),
|
|
16
|
-
/* harmony export */ E_TIMEOUT: () => (/* binding */ E_TIMEOUT),
|
|
17
|
-
/* harmony export */ Mutex: () => (/* binding */ Mutex),
|
|
18
|
-
/* harmony export */ Semaphore: () => (/* binding */ Semaphore),
|
|
19
|
-
/* harmony export */ tryAcquire: () => (/* binding */ tryAcquire),
|
|
20
|
-
/* harmony export */ withTimeout: () => (/* binding */ withTimeout)
|
|
21
|
-
/* harmony export */ });
|
|
22
|
-
const E_TIMEOUT = new Error('timeout while waiting for mutex to become available');
|
|
23
|
-
const E_ALREADY_LOCKED = new Error('mutex already locked');
|
|
24
|
-
const E_CANCELED = new Error('request for lock canceled');
|
|
25
|
-
|
|
26
|
-
var __awaiter$2 = ( false) || function (thisArg, _arguments, P, generator) {
|
|
27
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
28
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
29
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
30
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
31
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
32
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
class Semaphore {
|
|
36
|
-
constructor(_value, _cancelError = E_CANCELED) {
|
|
37
|
-
this._value = _value;
|
|
38
|
-
this._cancelError = _cancelError;
|
|
39
|
-
this._queue = [];
|
|
40
|
-
this._weightedWaiters = [];
|
|
41
|
-
}
|
|
42
|
-
acquire(weight = 1, priority = 0) {
|
|
43
|
-
if (weight <= 0)
|
|
44
|
-
throw new Error(`invalid weight ${weight}: must be positive`);
|
|
45
|
-
return new Promise((resolve, reject) => {
|
|
46
|
-
const task = { resolve, reject, weight, priority };
|
|
47
|
-
const i = findIndexFromEnd(this._queue, (other) => priority <= other.priority);
|
|
48
|
-
if (i === -1 && weight <= this._value) {
|
|
49
|
-
// Needs immediate dispatch, skip the queue
|
|
50
|
-
this._dispatchItem(task);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
this._queue.splice(i + 1, 0, task);
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
runExclusive(callback_1) {
|
|
58
|
-
return __awaiter$2(this, arguments, void 0, function* (callback, weight = 1, priority = 0) {
|
|
59
|
-
const [value, release] = yield this.acquire(weight, priority);
|
|
60
|
-
try {
|
|
61
|
-
return yield callback(value);
|
|
62
|
-
}
|
|
63
|
-
finally {
|
|
64
|
-
release();
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
waitForUnlock(weight = 1, priority = 0) {
|
|
69
|
-
if (weight <= 0)
|
|
70
|
-
throw new Error(`invalid weight ${weight}: must be positive`);
|
|
71
|
-
if (this._couldLockImmediately(weight, priority)) {
|
|
72
|
-
return Promise.resolve();
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
return new Promise((resolve) => {
|
|
76
|
-
if (!this._weightedWaiters[weight - 1])
|
|
77
|
-
this._weightedWaiters[weight - 1] = [];
|
|
78
|
-
insertSorted(this._weightedWaiters[weight - 1], { resolve, priority });
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
isLocked() {
|
|
83
|
-
return this._value <= 0;
|
|
84
|
-
}
|
|
85
|
-
getValue() {
|
|
86
|
-
return this._value;
|
|
87
|
-
}
|
|
88
|
-
setValue(value) {
|
|
89
|
-
this._value = value;
|
|
90
|
-
this._dispatchQueue();
|
|
91
|
-
}
|
|
92
|
-
release(weight = 1) {
|
|
93
|
-
if (weight <= 0)
|
|
94
|
-
throw new Error(`invalid weight ${weight}: must be positive`);
|
|
95
|
-
this._value += weight;
|
|
96
|
-
this._dispatchQueue();
|
|
97
|
-
}
|
|
98
|
-
cancel() {
|
|
99
|
-
this._queue.forEach((entry) => entry.reject(this._cancelError));
|
|
100
|
-
this._queue = [];
|
|
101
|
-
}
|
|
102
|
-
_dispatchQueue() {
|
|
103
|
-
this._drainUnlockWaiters();
|
|
104
|
-
while (this._queue.length > 0 && this._queue[0].weight <= this._value) {
|
|
105
|
-
this._dispatchItem(this._queue.shift());
|
|
106
|
-
this._drainUnlockWaiters();
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
_dispatchItem(item) {
|
|
110
|
-
const previousValue = this._value;
|
|
111
|
-
this._value -= item.weight;
|
|
112
|
-
item.resolve([previousValue, this._newReleaser(item.weight)]);
|
|
113
|
-
}
|
|
114
|
-
_newReleaser(weight) {
|
|
115
|
-
let called = false;
|
|
116
|
-
return () => {
|
|
117
|
-
if (called)
|
|
118
|
-
return;
|
|
119
|
-
called = true;
|
|
120
|
-
this.release(weight);
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
_drainUnlockWaiters() {
|
|
124
|
-
if (this._queue.length === 0) {
|
|
125
|
-
for (let weight = this._value; weight > 0; weight--) {
|
|
126
|
-
const waiters = this._weightedWaiters[weight - 1];
|
|
127
|
-
if (!waiters)
|
|
128
|
-
continue;
|
|
129
|
-
waiters.forEach((waiter) => waiter.resolve());
|
|
130
|
-
this._weightedWaiters[weight - 1] = [];
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
const queuedPriority = this._queue[0].priority;
|
|
135
|
-
for (let weight = this._value; weight > 0; weight--) {
|
|
136
|
-
const waiters = this._weightedWaiters[weight - 1];
|
|
137
|
-
if (!waiters)
|
|
138
|
-
continue;
|
|
139
|
-
const i = waiters.findIndex((waiter) => waiter.priority <= queuedPriority);
|
|
140
|
-
(i === -1 ? waiters : waiters.splice(0, i))
|
|
141
|
-
.forEach((waiter => waiter.resolve()));
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
_couldLockImmediately(weight, priority) {
|
|
146
|
-
return (this._queue.length === 0 || this._queue[0].priority < priority) &&
|
|
147
|
-
weight <= this._value;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
function insertSorted(a, v) {
|
|
151
|
-
const i = findIndexFromEnd(a, (other) => v.priority <= other.priority);
|
|
152
|
-
a.splice(i + 1, 0, v);
|
|
153
|
-
}
|
|
154
|
-
function findIndexFromEnd(a, predicate) {
|
|
155
|
-
for (let i = a.length - 1; i >= 0; i--) {
|
|
156
|
-
if (predicate(a[i])) {
|
|
157
|
-
return i;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
return -1;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
var __awaiter$1 = ( false) || function (thisArg, _arguments, P, generator) {
|
|
164
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
165
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
166
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
167
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
168
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
169
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
170
|
-
});
|
|
171
|
-
};
|
|
172
|
-
class Mutex {
|
|
173
|
-
constructor(cancelError) {
|
|
174
|
-
this._semaphore = new Semaphore(1, cancelError);
|
|
175
|
-
}
|
|
176
|
-
acquire() {
|
|
177
|
-
return __awaiter$1(this, arguments, void 0, function* (priority = 0) {
|
|
178
|
-
const [, releaser] = yield this._semaphore.acquire(1, priority);
|
|
179
|
-
return releaser;
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
runExclusive(callback, priority = 0) {
|
|
183
|
-
return this._semaphore.runExclusive(() => callback(), 1, priority);
|
|
184
|
-
}
|
|
185
|
-
isLocked() {
|
|
186
|
-
return this._semaphore.isLocked();
|
|
187
|
-
}
|
|
188
|
-
waitForUnlock(priority = 0) {
|
|
189
|
-
return this._semaphore.waitForUnlock(1, priority);
|
|
190
|
-
}
|
|
191
|
-
release() {
|
|
192
|
-
if (this._semaphore.isLocked())
|
|
193
|
-
this._semaphore.release();
|
|
194
|
-
}
|
|
195
|
-
cancel() {
|
|
196
|
-
return this._semaphore.cancel();
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
var __awaiter = ( false) || function (thisArg, _arguments, P, generator) {
|
|
201
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
202
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
203
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
204
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
205
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
206
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
207
|
-
});
|
|
208
|
-
};
|
|
209
|
-
function withTimeout(sync, timeout, timeoutError = E_TIMEOUT) {
|
|
210
|
-
return {
|
|
211
|
-
acquire: (weightOrPriority, priority) => {
|
|
212
|
-
let weight;
|
|
213
|
-
if (isSemaphore(sync)) {
|
|
214
|
-
weight = weightOrPriority;
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
217
|
-
weight = undefined;
|
|
218
|
-
priority = weightOrPriority;
|
|
219
|
-
}
|
|
220
|
-
if (weight !== undefined && weight <= 0) {
|
|
221
|
-
throw new Error(`invalid weight ${weight}: must be positive`);
|
|
222
|
-
}
|
|
223
|
-
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
224
|
-
let isTimeout = false;
|
|
225
|
-
const handle = setTimeout(() => {
|
|
226
|
-
isTimeout = true;
|
|
227
|
-
reject(timeoutError);
|
|
228
|
-
}, timeout);
|
|
229
|
-
try {
|
|
230
|
-
const ticket = yield (isSemaphore(sync)
|
|
231
|
-
? sync.acquire(weight, priority)
|
|
232
|
-
: sync.acquire(priority));
|
|
233
|
-
if (isTimeout) {
|
|
234
|
-
const release = Array.isArray(ticket) ? ticket[1] : ticket;
|
|
235
|
-
release();
|
|
236
|
-
}
|
|
237
|
-
else {
|
|
238
|
-
clearTimeout(handle);
|
|
239
|
-
resolve(ticket);
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
catch (e) {
|
|
243
|
-
if (!isTimeout) {
|
|
244
|
-
clearTimeout(handle);
|
|
245
|
-
reject(e);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}));
|
|
249
|
-
},
|
|
250
|
-
runExclusive(callback, weight, priority) {
|
|
251
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
252
|
-
let release = () => undefined;
|
|
253
|
-
try {
|
|
254
|
-
const ticket = yield this.acquire(weight, priority);
|
|
255
|
-
if (Array.isArray(ticket)) {
|
|
256
|
-
release = ticket[1];
|
|
257
|
-
return yield callback(ticket[0]);
|
|
258
|
-
}
|
|
259
|
-
else {
|
|
260
|
-
release = ticket;
|
|
261
|
-
return yield callback();
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
finally {
|
|
265
|
-
release();
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
},
|
|
269
|
-
release(weight) {
|
|
270
|
-
sync.release(weight);
|
|
271
|
-
},
|
|
272
|
-
cancel() {
|
|
273
|
-
return sync.cancel();
|
|
274
|
-
},
|
|
275
|
-
waitForUnlock: (weightOrPriority, priority) => {
|
|
276
|
-
let weight;
|
|
277
|
-
if (isSemaphore(sync)) {
|
|
278
|
-
weight = weightOrPriority;
|
|
279
|
-
}
|
|
280
|
-
else {
|
|
281
|
-
weight = undefined;
|
|
282
|
-
priority = weightOrPriority;
|
|
283
|
-
}
|
|
284
|
-
if (weight !== undefined && weight <= 0) {
|
|
285
|
-
throw new Error(`invalid weight ${weight}: must be positive`);
|
|
286
|
-
}
|
|
287
|
-
return new Promise((resolve, reject) => {
|
|
288
|
-
const handle = setTimeout(() => reject(timeoutError), timeout);
|
|
289
|
-
(isSemaphore(sync)
|
|
290
|
-
? sync.waitForUnlock(weight, priority)
|
|
291
|
-
: sync.waitForUnlock(priority)).then(() => {
|
|
292
|
-
clearTimeout(handle);
|
|
293
|
-
resolve();
|
|
294
|
-
});
|
|
295
|
-
});
|
|
296
|
-
},
|
|
297
|
-
isLocked: () => sync.isLocked(),
|
|
298
|
-
getValue: () => sync.getValue(),
|
|
299
|
-
setValue: (value) => sync.setValue(value),
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
function isSemaphore(sync) {
|
|
303
|
-
return sync.getValue !== undefined;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
// eslint-disable-next-lisne @typescript-eslint/explicit-module-boundary-types
|
|
307
|
-
function tryAcquire(sync, alreadyAcquiredError = E_ALREADY_LOCKED) {
|
|
308
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
309
|
-
return withTimeout(sync, 0, alreadyAcquiredError);
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
/***/ },
|
|
316
|
-
|
|
317
6
|
/***/ "../../node_modules/.pnpm/comlink@4.4.2/node_modules/comlink/dist/esm/comlink.mjs"
|
|
318
7
|
/*!****************************************************************************************!*\
|
|
319
8
|
!*** ../../node_modules/.pnpm/comlink@4.4.2/node_modules/comlink/dist/esm/comlink.mjs ***!
|
|
@@ -695,2720 +384,243 @@ function generateUUID() {
|
|
|
695
384
|
|
|
696
385
|
/***/ },
|
|
697
386
|
|
|
698
|
-
/***/ "
|
|
699
|
-
|
|
700
|
-
!***
|
|
701
|
-
|
|
702
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
703
|
-
|
|
704
|
-
__webpack_require__.r(__webpack_exports__);
|
|
705
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
706
|
-
/* harmony export */ Factory: () => (/* binding */ Factory),
|
|
707
|
-
/* harmony export */ SQLITE_ABORT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ABORT),
|
|
708
|
-
/* harmony export */ SQLITE_ACCESS_EXISTS: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ACCESS_EXISTS),
|
|
709
|
-
/* harmony export */ SQLITE_ACCESS_READ: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ACCESS_READ),
|
|
710
|
-
/* harmony export */ SQLITE_ACCESS_READWRITE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ACCESS_READWRITE),
|
|
711
|
-
/* harmony export */ SQLITE_ALTER_TABLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ALTER_TABLE),
|
|
712
|
-
/* harmony export */ SQLITE_ANALYZE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ANALYZE),
|
|
713
|
-
/* harmony export */ SQLITE_ATTACH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ATTACH),
|
|
714
|
-
/* harmony export */ SQLITE_AUTH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_AUTH),
|
|
715
|
-
/* harmony export */ SQLITE_BLOB: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_BLOB),
|
|
716
|
-
/* harmony export */ SQLITE_BUSY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_BUSY),
|
|
717
|
-
/* harmony export */ SQLITE_CANTOPEN: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CANTOPEN),
|
|
718
|
-
/* harmony export */ SQLITE_CONSTRAINT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT),
|
|
719
|
-
/* harmony export */ SQLITE_CONSTRAINT_CHECK: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_CHECK),
|
|
720
|
-
/* harmony export */ SQLITE_CONSTRAINT_COMMITHOOK: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_COMMITHOOK),
|
|
721
|
-
/* harmony export */ SQLITE_CONSTRAINT_FOREIGNKEY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_FOREIGNKEY),
|
|
722
|
-
/* harmony export */ SQLITE_CONSTRAINT_FUNCTION: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_FUNCTION),
|
|
723
|
-
/* harmony export */ SQLITE_CONSTRAINT_NOTNULL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_NOTNULL),
|
|
724
|
-
/* harmony export */ SQLITE_CONSTRAINT_PINNED: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_PINNED),
|
|
725
|
-
/* harmony export */ SQLITE_CONSTRAINT_PRIMARYKEY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_PRIMARYKEY),
|
|
726
|
-
/* harmony export */ SQLITE_CONSTRAINT_ROWID: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_ROWID),
|
|
727
|
-
/* harmony export */ SQLITE_CONSTRAINT_TRIGGER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_TRIGGER),
|
|
728
|
-
/* harmony export */ SQLITE_CONSTRAINT_UNIQUE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_UNIQUE),
|
|
729
|
-
/* harmony export */ SQLITE_CONSTRAINT_VTAB: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CONSTRAINT_VTAB),
|
|
730
|
-
/* harmony export */ SQLITE_COPY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_COPY),
|
|
731
|
-
/* harmony export */ SQLITE_CORRUPT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CORRUPT),
|
|
732
|
-
/* harmony export */ SQLITE_CREATE_INDEX: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CREATE_INDEX),
|
|
733
|
-
/* harmony export */ SQLITE_CREATE_TABLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CREATE_TABLE),
|
|
734
|
-
/* harmony export */ SQLITE_CREATE_TEMP_INDEX: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CREATE_TEMP_INDEX),
|
|
735
|
-
/* harmony export */ SQLITE_CREATE_TEMP_TABLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CREATE_TEMP_TABLE),
|
|
736
|
-
/* harmony export */ SQLITE_CREATE_TEMP_TRIGGER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CREATE_TEMP_TRIGGER),
|
|
737
|
-
/* harmony export */ SQLITE_CREATE_TEMP_VIEW: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CREATE_TEMP_VIEW),
|
|
738
|
-
/* harmony export */ SQLITE_CREATE_TRIGGER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CREATE_TRIGGER),
|
|
739
|
-
/* harmony export */ SQLITE_CREATE_VIEW: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CREATE_VIEW),
|
|
740
|
-
/* harmony export */ SQLITE_CREATE_VTABLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_CREATE_VTABLE),
|
|
741
|
-
/* harmony export */ SQLITE_DELETE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DELETE),
|
|
742
|
-
/* harmony export */ SQLITE_DENY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DENY),
|
|
743
|
-
/* harmony export */ SQLITE_DETACH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DETACH),
|
|
744
|
-
/* harmony export */ SQLITE_DETERMINISTIC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DETERMINISTIC),
|
|
745
|
-
/* harmony export */ SQLITE_DIRECTONLY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DIRECTONLY),
|
|
746
|
-
/* harmony export */ SQLITE_DONE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DONE),
|
|
747
|
-
/* harmony export */ SQLITE_DROP_INDEX: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DROP_INDEX),
|
|
748
|
-
/* harmony export */ SQLITE_DROP_TABLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DROP_TABLE),
|
|
749
|
-
/* harmony export */ SQLITE_DROP_TEMP_INDEX: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DROP_TEMP_INDEX),
|
|
750
|
-
/* harmony export */ SQLITE_DROP_TEMP_TABLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DROP_TEMP_TABLE),
|
|
751
|
-
/* harmony export */ SQLITE_DROP_TEMP_TRIGGER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DROP_TEMP_TRIGGER),
|
|
752
|
-
/* harmony export */ SQLITE_DROP_TEMP_VIEW: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DROP_TEMP_VIEW),
|
|
753
|
-
/* harmony export */ SQLITE_DROP_TRIGGER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DROP_TRIGGER),
|
|
754
|
-
/* harmony export */ SQLITE_DROP_VIEW: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DROP_VIEW),
|
|
755
|
-
/* harmony export */ SQLITE_DROP_VTABLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DROP_VTABLE),
|
|
756
|
-
/* harmony export */ SQLITE_EMPTY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_EMPTY),
|
|
757
|
-
/* harmony export */ SQLITE_ERROR: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ERROR),
|
|
758
|
-
/* harmony export */ SQLITE_FCNTL_BEGIN_ATOMIC_WRITE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_BEGIN_ATOMIC_WRITE),
|
|
759
|
-
/* harmony export */ SQLITE_FCNTL_BUSYHANDLER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_BUSYHANDLER),
|
|
760
|
-
/* harmony export */ SQLITE_FCNTL_CHUNK_SIZE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_CHUNK_SIZE),
|
|
761
|
-
/* harmony export */ SQLITE_FCNTL_CKPT_DONE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_CKPT_DONE),
|
|
762
|
-
/* harmony export */ SQLITE_FCNTL_CKPT_START: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_CKPT_START),
|
|
763
|
-
/* harmony export */ SQLITE_FCNTL_COMMIT_ATOMIC_WRITE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_COMMIT_ATOMIC_WRITE),
|
|
764
|
-
/* harmony export */ SQLITE_FCNTL_COMMIT_PHASETWO: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_COMMIT_PHASETWO),
|
|
765
|
-
/* harmony export */ SQLITE_FCNTL_DATA_VERSION: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_DATA_VERSION),
|
|
766
|
-
/* harmony export */ SQLITE_FCNTL_FILE_POINTER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_FILE_POINTER),
|
|
767
|
-
/* harmony export */ SQLITE_FCNTL_GET_LOCKPROXYFILE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_GET_LOCKPROXYFILE),
|
|
768
|
-
/* harmony export */ SQLITE_FCNTL_HAS_MOVED: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_HAS_MOVED),
|
|
769
|
-
/* harmony export */ SQLITE_FCNTL_JOURNAL_POINTER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_JOURNAL_POINTER),
|
|
770
|
-
/* harmony export */ SQLITE_FCNTL_LAST_ERRNO: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_LAST_ERRNO),
|
|
771
|
-
/* harmony export */ SQLITE_FCNTL_LOCKSTATE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_LOCKSTATE),
|
|
772
|
-
/* harmony export */ SQLITE_FCNTL_LOCK_TIMEOUT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_LOCK_TIMEOUT),
|
|
773
|
-
/* harmony export */ SQLITE_FCNTL_MMAP_SIZE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_MMAP_SIZE),
|
|
774
|
-
/* harmony export */ SQLITE_FCNTL_OVERWRITE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_OVERWRITE),
|
|
775
|
-
/* harmony export */ SQLITE_FCNTL_PDB: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_PDB),
|
|
776
|
-
/* harmony export */ SQLITE_FCNTL_PERSIST_WAL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_PERSIST_WAL),
|
|
777
|
-
/* harmony export */ SQLITE_FCNTL_POWERSAFE_OVERWRITE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_POWERSAFE_OVERWRITE),
|
|
778
|
-
/* harmony export */ SQLITE_FCNTL_PRAGMA: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_PRAGMA),
|
|
779
|
-
/* harmony export */ SQLITE_FCNTL_RBU: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_RBU),
|
|
780
|
-
/* harmony export */ SQLITE_FCNTL_RESERVE_BYTES: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_RESERVE_BYTES),
|
|
781
|
-
/* harmony export */ SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE),
|
|
782
|
-
/* harmony export */ SQLITE_FCNTL_SET_LOCKPROXYFILE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_SET_LOCKPROXYFILE),
|
|
783
|
-
/* harmony export */ SQLITE_FCNTL_SIZE_HINT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_SIZE_HINT),
|
|
784
|
-
/* harmony export */ SQLITE_FCNTL_SIZE_LIMIT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_SIZE_LIMIT),
|
|
785
|
-
/* harmony export */ SQLITE_FCNTL_SYNC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_SYNC),
|
|
786
|
-
/* harmony export */ SQLITE_FCNTL_SYNC_OMITTED: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_SYNC_OMITTED),
|
|
787
|
-
/* harmony export */ SQLITE_FCNTL_TEMPFILENAME: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_TEMPFILENAME),
|
|
788
|
-
/* harmony export */ SQLITE_FCNTL_TRACE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_TRACE),
|
|
789
|
-
/* harmony export */ SQLITE_FCNTL_VFSNAME: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_VFSNAME),
|
|
790
|
-
/* harmony export */ SQLITE_FCNTL_VFS_POINTER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_VFS_POINTER),
|
|
791
|
-
/* harmony export */ SQLITE_FCNTL_WAL_BLOCK: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_WAL_BLOCK),
|
|
792
|
-
/* harmony export */ SQLITE_FCNTL_WIN32_AV_RETRY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_WIN32_AV_RETRY),
|
|
793
|
-
/* harmony export */ SQLITE_FCNTL_WIN32_GET_HANDLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_WIN32_GET_HANDLE),
|
|
794
|
-
/* harmony export */ SQLITE_FCNTL_WIN32_SET_HANDLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_WIN32_SET_HANDLE),
|
|
795
|
-
/* harmony export */ SQLITE_FCNTL_ZIPVFS: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FCNTL_ZIPVFS),
|
|
796
|
-
/* harmony export */ SQLITE_FLOAT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FLOAT),
|
|
797
|
-
/* harmony export */ SQLITE_FORMAT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FORMAT),
|
|
798
|
-
/* harmony export */ SQLITE_FULL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FULL),
|
|
799
|
-
/* harmony export */ SQLITE_FUNCTION: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FUNCTION),
|
|
800
|
-
/* harmony export */ SQLITE_IGNORE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IGNORE),
|
|
801
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_EQ: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_EQ),
|
|
802
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_FUNCTION: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_FUNCTION),
|
|
803
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_GE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_GE),
|
|
804
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_GLOB: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_GLOB),
|
|
805
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_GT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_GT),
|
|
806
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_IS: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_IS),
|
|
807
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_ISNOT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_ISNOT),
|
|
808
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_ISNOTNULL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_ISNOTNULL),
|
|
809
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_ISNULL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_ISNULL),
|
|
810
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_LE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_LE),
|
|
811
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_LIKE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_LIKE),
|
|
812
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_LT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_LT),
|
|
813
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_MATCH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_MATCH),
|
|
814
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_NE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_NE),
|
|
815
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_REGEXP: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_CONSTRAINT_REGEXP),
|
|
816
|
-
/* harmony export */ SQLITE_INDEX_SCAN_UNIQUE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INDEX_SCAN_UNIQUE),
|
|
817
|
-
/* harmony export */ SQLITE_INNOCUOUS: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INNOCUOUS),
|
|
818
|
-
/* harmony export */ SQLITE_INSERT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INSERT),
|
|
819
|
-
/* harmony export */ SQLITE_INTEGER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INTEGER),
|
|
820
|
-
/* harmony export */ SQLITE_INTERNAL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INTERNAL),
|
|
821
|
-
/* harmony export */ SQLITE_INTERRUPT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INTERRUPT),
|
|
822
|
-
/* harmony export */ SQLITE_IOCAP_ATOMIC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_ATOMIC),
|
|
823
|
-
/* harmony export */ SQLITE_IOCAP_ATOMIC16K: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_ATOMIC16K),
|
|
824
|
-
/* harmony export */ SQLITE_IOCAP_ATOMIC1K: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_ATOMIC1K),
|
|
825
|
-
/* harmony export */ SQLITE_IOCAP_ATOMIC2K: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_ATOMIC2K),
|
|
826
|
-
/* harmony export */ SQLITE_IOCAP_ATOMIC32K: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_ATOMIC32K),
|
|
827
|
-
/* harmony export */ SQLITE_IOCAP_ATOMIC4K: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_ATOMIC4K),
|
|
828
|
-
/* harmony export */ SQLITE_IOCAP_ATOMIC512: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_ATOMIC512),
|
|
829
|
-
/* harmony export */ SQLITE_IOCAP_ATOMIC64K: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_ATOMIC64K),
|
|
830
|
-
/* harmony export */ SQLITE_IOCAP_ATOMIC8K: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_ATOMIC8K),
|
|
831
|
-
/* harmony export */ SQLITE_IOCAP_BATCH_ATOMIC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_BATCH_ATOMIC),
|
|
832
|
-
/* harmony export */ SQLITE_IOCAP_IMMUTABLE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_IMMUTABLE),
|
|
833
|
-
/* harmony export */ SQLITE_IOCAP_POWERSAFE_OVERWRITE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_POWERSAFE_OVERWRITE),
|
|
834
|
-
/* harmony export */ SQLITE_IOCAP_SAFE_APPEND: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_SAFE_APPEND),
|
|
835
|
-
/* harmony export */ SQLITE_IOCAP_SEQUENTIAL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_SEQUENTIAL),
|
|
836
|
-
/* harmony export */ SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN),
|
|
837
|
-
/* harmony export */ SQLITE_IOERR: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR),
|
|
838
|
-
/* harmony export */ SQLITE_IOERR_ACCESS: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_ACCESS),
|
|
839
|
-
/* harmony export */ SQLITE_IOERR_BEGIN_ATOMIC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_BEGIN_ATOMIC),
|
|
840
|
-
/* harmony export */ SQLITE_IOERR_CHECKRESERVEDLOCK: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_CHECKRESERVEDLOCK),
|
|
841
|
-
/* harmony export */ SQLITE_IOERR_CLOSE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_CLOSE),
|
|
842
|
-
/* harmony export */ SQLITE_IOERR_COMMIT_ATOMIC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_COMMIT_ATOMIC),
|
|
843
|
-
/* harmony export */ SQLITE_IOERR_DATA: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_DATA),
|
|
844
|
-
/* harmony export */ SQLITE_IOERR_DELETE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_DELETE),
|
|
845
|
-
/* harmony export */ SQLITE_IOERR_DELETE_NOENT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_DELETE_NOENT),
|
|
846
|
-
/* harmony export */ SQLITE_IOERR_DIR_FSYNC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_DIR_FSYNC),
|
|
847
|
-
/* harmony export */ SQLITE_IOERR_FSTAT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_FSTAT),
|
|
848
|
-
/* harmony export */ SQLITE_IOERR_FSYNC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_FSYNC),
|
|
849
|
-
/* harmony export */ SQLITE_IOERR_GETTEMPPATH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_GETTEMPPATH),
|
|
850
|
-
/* harmony export */ SQLITE_IOERR_LOCK: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_LOCK),
|
|
851
|
-
/* harmony export */ SQLITE_IOERR_NOMEM: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_NOMEM),
|
|
852
|
-
/* harmony export */ SQLITE_IOERR_RDLOCK: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_RDLOCK),
|
|
853
|
-
/* harmony export */ SQLITE_IOERR_READ: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_READ),
|
|
854
|
-
/* harmony export */ SQLITE_IOERR_ROLLBACK_ATOMIC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_ROLLBACK_ATOMIC),
|
|
855
|
-
/* harmony export */ SQLITE_IOERR_SEEK: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_SEEK),
|
|
856
|
-
/* harmony export */ SQLITE_IOERR_SHORT_READ: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_SHORT_READ),
|
|
857
|
-
/* harmony export */ SQLITE_IOERR_TRUNCATE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_TRUNCATE),
|
|
858
|
-
/* harmony export */ SQLITE_IOERR_UNLOCK: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_UNLOCK),
|
|
859
|
-
/* harmony export */ SQLITE_IOERR_VNODE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_VNODE),
|
|
860
|
-
/* harmony export */ SQLITE_IOERR_WRITE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_IOERR_WRITE),
|
|
861
|
-
/* harmony export */ SQLITE_LIMIT_ATTACHED: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_ATTACHED),
|
|
862
|
-
/* harmony export */ SQLITE_LIMIT_COLUMN: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_COLUMN),
|
|
863
|
-
/* harmony export */ SQLITE_LIMIT_COMPOUND_SELECT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_COMPOUND_SELECT),
|
|
864
|
-
/* harmony export */ SQLITE_LIMIT_EXPR_DEPTH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_EXPR_DEPTH),
|
|
865
|
-
/* harmony export */ SQLITE_LIMIT_FUNCTION_ARG: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_FUNCTION_ARG),
|
|
866
|
-
/* harmony export */ SQLITE_LIMIT_LENGTH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_LENGTH),
|
|
867
|
-
/* harmony export */ SQLITE_LIMIT_LIKE_PATTERN_LENGTH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_LIKE_PATTERN_LENGTH),
|
|
868
|
-
/* harmony export */ SQLITE_LIMIT_SQL_LENGTH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_SQL_LENGTH),
|
|
869
|
-
/* harmony export */ SQLITE_LIMIT_TRIGGER_DEPTH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_TRIGGER_DEPTH),
|
|
870
|
-
/* harmony export */ SQLITE_LIMIT_VARIABLE_NUMBER: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_VARIABLE_NUMBER),
|
|
871
|
-
/* harmony export */ SQLITE_LIMIT_VDBE_OP: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_VDBE_OP),
|
|
872
|
-
/* harmony export */ SQLITE_LIMIT_WORKER_THREADS: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LIMIT_WORKER_THREADS),
|
|
873
|
-
/* harmony export */ SQLITE_LOCKED: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LOCKED),
|
|
874
|
-
/* harmony export */ SQLITE_LOCK_EXCLUSIVE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LOCK_EXCLUSIVE),
|
|
875
|
-
/* harmony export */ SQLITE_LOCK_NONE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LOCK_NONE),
|
|
876
|
-
/* harmony export */ SQLITE_LOCK_PENDING: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LOCK_PENDING),
|
|
877
|
-
/* harmony export */ SQLITE_LOCK_RESERVED: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LOCK_RESERVED),
|
|
878
|
-
/* harmony export */ SQLITE_LOCK_SHARED: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_LOCK_SHARED),
|
|
879
|
-
/* harmony export */ SQLITE_MISMATCH: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_MISMATCH),
|
|
880
|
-
/* harmony export */ SQLITE_MISUSE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_MISUSE),
|
|
881
|
-
/* harmony export */ SQLITE_NOLFS: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_NOLFS),
|
|
882
|
-
/* harmony export */ SQLITE_NOMEM: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_NOMEM),
|
|
883
|
-
/* harmony export */ SQLITE_NOTADB: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_NOTADB),
|
|
884
|
-
/* harmony export */ SQLITE_NOTFOUND: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_NOTFOUND),
|
|
885
|
-
/* harmony export */ SQLITE_NOTICE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_NOTICE),
|
|
886
|
-
/* harmony export */ SQLITE_NULL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_NULL),
|
|
887
|
-
/* harmony export */ SQLITE_OK: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK),
|
|
888
|
-
/* harmony export */ SQLITE_OPEN_AUTOPROXY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_AUTOPROXY),
|
|
889
|
-
/* harmony export */ SQLITE_OPEN_CREATE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_CREATE),
|
|
890
|
-
/* harmony export */ SQLITE_OPEN_DELETEONCLOSE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_DELETEONCLOSE),
|
|
891
|
-
/* harmony export */ SQLITE_OPEN_EXCLUSIVE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_EXCLUSIVE),
|
|
892
|
-
/* harmony export */ SQLITE_OPEN_FULLMUTEX: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_FULLMUTEX),
|
|
893
|
-
/* harmony export */ SQLITE_OPEN_MAIN_DB: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_MAIN_DB),
|
|
894
|
-
/* harmony export */ SQLITE_OPEN_MAIN_JOURNAL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_MAIN_JOURNAL),
|
|
895
|
-
/* harmony export */ SQLITE_OPEN_MEMORY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_MEMORY),
|
|
896
|
-
/* harmony export */ SQLITE_OPEN_NOFOLLOW: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_NOFOLLOW),
|
|
897
|
-
/* harmony export */ SQLITE_OPEN_NOMUTEX: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_NOMUTEX),
|
|
898
|
-
/* harmony export */ SQLITE_OPEN_PRIVATECACHE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_PRIVATECACHE),
|
|
899
|
-
/* harmony export */ SQLITE_OPEN_READONLY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_READONLY),
|
|
900
|
-
/* harmony export */ SQLITE_OPEN_READWRITE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_READWRITE),
|
|
901
|
-
/* harmony export */ SQLITE_OPEN_SHAREDCACHE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_SHAREDCACHE),
|
|
902
|
-
/* harmony export */ SQLITE_OPEN_SUBJOURNAL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_SUBJOURNAL),
|
|
903
|
-
/* harmony export */ SQLITE_OPEN_SUPER_JOURNAL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_SUPER_JOURNAL),
|
|
904
|
-
/* harmony export */ SQLITE_OPEN_TEMP_DB: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_TEMP_DB),
|
|
905
|
-
/* harmony export */ SQLITE_OPEN_TEMP_JOURNAL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_TEMP_JOURNAL),
|
|
906
|
-
/* harmony export */ SQLITE_OPEN_TRANSIENT_DB: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_TRANSIENT_DB),
|
|
907
|
-
/* harmony export */ SQLITE_OPEN_URI: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_URI),
|
|
908
|
-
/* harmony export */ SQLITE_OPEN_WAL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_WAL),
|
|
909
|
-
/* harmony export */ SQLITE_PERM: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_PERM),
|
|
910
|
-
/* harmony export */ SQLITE_PRAGMA: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_PRAGMA),
|
|
911
|
-
/* harmony export */ SQLITE_PREPARE_NORMALIZED: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_PREPARE_NORMALIZED),
|
|
912
|
-
/* harmony export */ SQLITE_PREPARE_NO_VTAB: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_PREPARE_NO_VTAB),
|
|
913
|
-
/* harmony export */ SQLITE_PREPARE_PERSISTENT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_PREPARE_PERSISTENT),
|
|
914
|
-
/* harmony export */ SQLITE_PROTOCOL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_PROTOCOL),
|
|
915
|
-
/* harmony export */ SQLITE_RANGE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_RANGE),
|
|
916
|
-
/* harmony export */ SQLITE_READ: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_READ),
|
|
917
|
-
/* harmony export */ SQLITE_READONLY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_READONLY),
|
|
918
|
-
/* harmony export */ SQLITE_RECURSIVE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_RECURSIVE),
|
|
919
|
-
/* harmony export */ SQLITE_REINDEX: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_REINDEX),
|
|
920
|
-
/* harmony export */ SQLITE_ROW: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ROW),
|
|
921
|
-
/* harmony export */ SQLITE_SAVEPOINT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_SAVEPOINT),
|
|
922
|
-
/* harmony export */ SQLITE_SCHEMA: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_SCHEMA),
|
|
923
|
-
/* harmony export */ SQLITE_SELECT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_SELECT),
|
|
924
|
-
/* harmony export */ SQLITE_STATIC: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_STATIC),
|
|
925
|
-
/* harmony export */ SQLITE_SUBTYPE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_SUBTYPE),
|
|
926
|
-
/* harmony export */ SQLITE_SYNC_DATAONLY: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_SYNC_DATAONLY),
|
|
927
|
-
/* harmony export */ SQLITE_SYNC_FULL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_SYNC_FULL),
|
|
928
|
-
/* harmony export */ SQLITE_SYNC_NORMAL: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_SYNC_NORMAL),
|
|
929
|
-
/* harmony export */ SQLITE_TEXT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_TEXT),
|
|
930
|
-
/* harmony export */ SQLITE_TOOBIG: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_TOOBIG),
|
|
931
|
-
/* harmony export */ SQLITE_TRANSACTION: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_TRANSACTION),
|
|
932
|
-
/* harmony export */ SQLITE_TRANSIENT: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_TRANSIENT),
|
|
933
|
-
/* harmony export */ SQLITE_UPDATE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_UPDATE),
|
|
934
|
-
/* harmony export */ SQLITE_UTF16: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_UTF16),
|
|
935
|
-
/* harmony export */ SQLITE_UTF16BE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_UTF16BE),
|
|
936
|
-
/* harmony export */ SQLITE_UTF16LE: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_UTF16LE),
|
|
937
|
-
/* harmony export */ SQLITE_UTF8: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_UTF8),
|
|
938
|
-
/* harmony export */ SQLITE_WARNING: () => (/* reexport safe */ _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_WARNING),
|
|
939
|
-
/* harmony export */ SQLiteError: () => (/* binding */ SQLiteError)
|
|
940
|
-
/* harmony export */ });
|
|
941
|
-
/* harmony import */ var _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./sqlite-constants.js */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.5.0/node_modules/@journeyapps/wa-sqlite/src/sqlite-constants.js");
|
|
942
|
-
// Copyright 2021 Roy T. Hashimoto. All Rights Reserved.
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
/**
|
|
948
|
-
* Need to have a serializer for bigint
|
|
949
|
-
* https://github.com/GoogleChromeLabs/jsbi/issues/30
|
|
950
|
-
*/
|
|
951
|
-
if (typeof BigInt.prototype['toJSON'] == 'undefined') {
|
|
952
|
-
BigInt.prototype['toJSON'] = function() {
|
|
953
|
-
return this.toString();
|
|
954
|
-
};
|
|
955
|
-
}
|
|
956
|
-
|
|
957
|
-
const MAX_INT64 = 0x7fffffffffffffffn;
|
|
958
|
-
const MIN_INT64 = -0x8000000000000000n;
|
|
959
|
-
|
|
960
|
-
const AsyncFunction = Object.getPrototypeOf(async function(){}).constructor;
|
|
961
|
-
|
|
962
|
-
class SQLiteError extends Error {
|
|
963
|
-
constructor(message, code) {
|
|
964
|
-
super(message);
|
|
965
|
-
this.code = code;
|
|
966
|
-
}
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
const async = true;
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
/**
|
|
973
|
-
* Builds a Javascript API from the Emscripten module. This API is still
|
|
974
|
-
* low-level and closely corresponds to the C API exported by the module,
|
|
975
|
-
* but differs in some specifics like throwing exceptions on errors.
|
|
976
|
-
* @param {*} Module SQLite Emscripten module
|
|
977
|
-
* @returns {SQLiteAPI}
|
|
978
|
-
*/
|
|
979
|
-
function Factory(Module) {
|
|
980
|
-
/** @type {SQLiteAPI} */ const sqlite3 = {};
|
|
981
|
-
|
|
982
|
-
Module.retryOps = [];
|
|
983
|
-
const sqliteFreeAddress = Module._getSqliteFree();
|
|
984
|
-
|
|
985
|
-
// Allocate some space for 32-bit returned values.
|
|
986
|
-
const tmp = Module._malloc(8);
|
|
987
|
-
const tmpPtr = [tmp, tmp + 4];
|
|
988
|
-
|
|
989
|
-
const textEncoder = new TextEncoder();
|
|
990
|
-
// Convert a JS string to a C string. sqlite3_malloc is used to allocate
|
|
991
|
-
// memory (use sqlite3_free to deallocate).
|
|
992
|
-
function createUTF8(s) {
|
|
993
|
-
if (typeof s !== 'string') return 0;
|
|
994
|
-
const utf8 = textEncoder.encode(s);
|
|
995
|
-
const zts = Module._sqlite3_malloc(utf8.byteLength + 1);
|
|
996
|
-
Module.HEAPU8.set(utf8, zts);
|
|
997
|
-
Module.HEAPU8[zts + utf8.byteLength] = 0;
|
|
998
|
-
return zts;
|
|
999
|
-
}
|
|
1000
|
-
|
|
1001
|
-
/**
|
|
1002
|
-
* Concatenate 32-bit numbers into a 64-bit (signed) BigInt.
|
|
1003
|
-
* @param {number} lo32
|
|
1004
|
-
* @param {number} hi32
|
|
1005
|
-
* @returns {bigint}
|
|
1006
|
-
*/
|
|
1007
|
-
function cvt32x2ToBigInt(lo32, hi32) {
|
|
1008
|
-
return (BigInt(hi32) << 32n) | (BigInt(lo32) & 0xffffffffn);
|
|
1009
|
-
}
|
|
1010
|
-
|
|
1011
|
-
// /**
|
|
1012
|
-
// * Setup table change update callback
|
|
1013
|
-
// */
|
|
1014
|
-
// var onTableChangedFunctionPointer = Module.addFunction(onTableUpdate);
|
|
1015
|
-
// var passFnPointer = Module.cwrap('passFnPointer', 'undefined', ['number']);
|
|
1016
|
-
// passFnPointer(onTableChangedFunctionPointer);
|
|
1017
|
-
/**
|
|
1018
|
-
* Concatenate 32-bit numbers and return as number or BigInt, depending
|
|
1019
|
-
* on the value.
|
|
1020
|
-
* @param {number} lo32
|
|
1021
|
-
* @param {number} hi32
|
|
1022
|
-
* @returns {number|bigint}
|
|
1023
|
-
*/
|
|
1024
|
-
const cvt32x2AsSafe = (function() {
|
|
1025
|
-
const hiMax = BigInt(Number.MAX_SAFE_INTEGER) >> 32n;
|
|
1026
|
-
const hiMin = BigInt(Number.MIN_SAFE_INTEGER) >> 32n;
|
|
1027
|
-
|
|
1028
|
-
return function(lo32, hi32) {
|
|
1029
|
-
if (hi32 > hiMax || hi32 < hiMin) {
|
|
1030
|
-
// Can't be expressed as a Number so use BigInt.
|
|
1031
|
-
return cvt32x2ToBigInt(lo32, hi32);
|
|
1032
|
-
} else {
|
|
1033
|
-
// Combine the upper and lower 32-bit numbers. The complication is
|
|
1034
|
-
// that lo32 is a signed integer which makes manipulating its bits
|
|
1035
|
-
// a little tricky - the sign bit gets handled separately.
|
|
1036
|
-
return hi32 * 0x100000000 + (lo32 & 0x7fffffff) - (lo32 & 0x80000000);
|
|
1037
|
-
}
|
|
1038
|
-
};
|
|
1039
|
-
})();
|
|
1040
|
-
|
|
1041
|
-
const databases = new Set();
|
|
1042
|
-
function verifyDatabase(db) {
|
|
1043
|
-
if (!databases.has(db)) {
|
|
1044
|
-
throw new SQLiteError('not a database', _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_MISUSE);
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
const mapStmtToDB = new Map();
|
|
1049
|
-
function verifyStatement(stmt) {
|
|
1050
|
-
if (!mapStmtToDB.has(stmt)) {
|
|
1051
|
-
throw new SQLiteError('not a statement', _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_MISUSE);
|
|
1052
|
-
}
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
sqlite3.bind_collection = function(stmt, bindings) {
|
|
1056
|
-
verifyStatement(stmt);
|
|
1057
|
-
const isArray = Array.isArray(bindings);
|
|
1058
|
-
const nBindings = sqlite3.bind_parameter_count(stmt);
|
|
1059
|
-
for (let i = 1; i <= nBindings; ++i) {
|
|
1060
|
-
const key = isArray ? i - 1 : sqlite3.bind_parameter_name(stmt, i);
|
|
1061
|
-
const value = bindings[key];
|
|
1062
|
-
if (value !== undefined) {
|
|
1063
|
-
sqlite3.bind(stmt, i, value);
|
|
1064
|
-
}
|
|
1065
|
-
}
|
|
1066
|
-
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1067
|
-
};
|
|
1068
|
-
|
|
1069
|
-
sqlite3.bind = function(stmt, i, value) {
|
|
1070
|
-
verifyStatement(stmt);
|
|
1071
|
-
switch (typeof value) {
|
|
1072
|
-
case 'number':
|
|
1073
|
-
if (value === (value | 0)) {
|
|
1074
|
-
return sqlite3.bind_int(stmt, i, value);
|
|
1075
|
-
} else {
|
|
1076
|
-
return sqlite3.bind_double(stmt, i, value);
|
|
1077
|
-
}
|
|
1078
|
-
case 'string':
|
|
1079
|
-
return sqlite3.bind_text(stmt, i, value);
|
|
1080
|
-
case "boolean":
|
|
1081
|
-
return sqlite3.bind_int(stmt, i, value ? 1 : 0);
|
|
1082
|
-
default:
|
|
1083
|
-
if (value instanceof Uint8Array || Array.isArray(value)) {
|
|
1084
|
-
return sqlite3.bind_blob(stmt, i, value);
|
|
1085
|
-
} else if (value === null) {
|
|
1086
|
-
return sqlite3.bind_null(stmt, i);
|
|
1087
|
-
} else if (typeof value === 'bigint') {
|
|
1088
|
-
return sqlite3.bind_int64(stmt, i, value);
|
|
1089
|
-
} else if (value === undefined) {
|
|
1090
|
-
// Existing binding (or NULL) will be used.
|
|
1091
|
-
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_NOTICE;
|
|
1092
|
-
} else {
|
|
1093
|
-
console.warn('unknown binding converted to null', value);
|
|
1094
|
-
return sqlite3.bind_null(stmt, i);
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
};
|
|
1098
|
-
|
|
1099
|
-
sqlite3.bind_blob = (function() {
|
|
1100
|
-
const fname = 'sqlite3_bind_blob';
|
|
1101
|
-
const f = Module.cwrap(fname, ...decl('nnnnn:n'));
|
|
1102
|
-
return function(stmt, i, value) {
|
|
1103
|
-
verifyStatement(stmt);
|
|
1104
|
-
// @ts-ignore
|
|
1105
|
-
const byteLength = value.byteLength ?? value.length;
|
|
1106
|
-
const ptr = Module._sqlite3_malloc(byteLength);
|
|
1107
|
-
Module.HEAPU8.subarray(ptr).set(value);
|
|
1108
|
-
const result = f(stmt, i, ptr, byteLength, sqliteFreeAddress);
|
|
1109
|
-
return check(fname, result, mapStmtToDB.get(stmt));
|
|
1110
|
-
};
|
|
1111
|
-
})();
|
|
1112
|
-
|
|
1113
|
-
sqlite3.bind_parameter_count = (function() {
|
|
1114
|
-
const fname = 'sqlite3_bind_parameter_count';
|
|
1115
|
-
const f = Module.cwrap(fname, ...decl('n:n'));
|
|
1116
|
-
return function(stmt) {
|
|
1117
|
-
verifyStatement(stmt);
|
|
1118
|
-
const result = f(stmt);
|
|
1119
|
-
return result;
|
|
1120
|
-
};
|
|
1121
|
-
})();
|
|
1122
|
-
|
|
1123
|
-
sqlite3.bind_double = (function() {
|
|
1124
|
-
const fname = 'sqlite3_bind_double';
|
|
1125
|
-
const f = Module.cwrap(fname, ...decl('nnn:n'));
|
|
1126
|
-
return function(stmt, i, value) {
|
|
1127
|
-
verifyStatement(stmt);
|
|
1128
|
-
const result = f(stmt, i, value);
|
|
1129
|
-
return check(fname, result, mapStmtToDB.get(stmt));
|
|
1130
|
-
};
|
|
1131
|
-
})();
|
|
1132
|
-
|
|
1133
|
-
sqlite3.bind_int = (function() {
|
|
1134
|
-
const fname = 'sqlite3_bind_int';
|
|
1135
|
-
const f = Module.cwrap(fname, ...decl('nnn:n'));
|
|
1136
|
-
return function(stmt, i, value) {
|
|
1137
|
-
verifyStatement(stmt);
|
|
1138
|
-
if (value > 0x7fffffff || value < -0x80000000) return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_RANGE;
|
|
1139
|
-
|
|
1140
|
-
const result = f(stmt, i, value);
|
|
1141
|
-
return check(fname, result, mapStmtToDB.get(stmt));
|
|
1142
|
-
};
|
|
1143
|
-
})();
|
|
1144
|
-
|
|
1145
|
-
sqlite3.bind_int64 = (function() {
|
|
1146
|
-
const fname = 'sqlite3_bind_int64';
|
|
1147
|
-
const f = Module.cwrap(fname, ...decl('nnnn:n'));
|
|
1148
|
-
return function(stmt, i, value) {
|
|
1149
|
-
verifyStatement(stmt);
|
|
1150
|
-
if (value > MAX_INT64 || value < MIN_INT64) return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_RANGE;
|
|
1151
|
-
|
|
1152
|
-
const lo32 = value & 0xffffffffn;
|
|
1153
|
-
const hi32 = value >> 32n;
|
|
1154
|
-
const result = f(stmt, i, Number(lo32), Number(hi32));
|
|
1155
|
-
return check(fname, result, mapStmtToDB.get(stmt));
|
|
1156
|
-
};
|
|
1157
|
-
})();
|
|
1158
|
-
|
|
1159
|
-
sqlite3.bind_null = (function() {
|
|
1160
|
-
const fname = 'sqlite3_bind_null';
|
|
1161
|
-
const f = Module.cwrap(fname, ...decl('nn:n'));
|
|
1162
|
-
return function(stmt, i) {
|
|
1163
|
-
verifyStatement(stmt);
|
|
1164
|
-
const result = f(stmt, i);
|
|
1165
|
-
return check(fname, result, mapStmtToDB.get(stmt));
|
|
1166
|
-
};
|
|
1167
|
-
})();
|
|
1168
|
-
|
|
1169
|
-
sqlite3.bind_parameter_name = (function() {
|
|
1170
|
-
const fname = 'sqlite3_bind_parameter_name';
|
|
1171
|
-
const f = Module.cwrap(fname, ...decl('n:s'));
|
|
1172
|
-
return function(stmt, i) {
|
|
1173
|
-
verifyStatement(stmt);
|
|
1174
|
-
const result = f(stmt, i);
|
|
1175
|
-
return result;
|
|
1176
|
-
};
|
|
1177
|
-
})();
|
|
1178
|
-
|
|
1179
|
-
sqlite3.bind_text = (function() {
|
|
1180
|
-
const fname = 'sqlite3_bind_text';
|
|
1181
|
-
const f = Module.cwrap(fname, ...decl('nnnnn:n'));
|
|
1182
|
-
return function(stmt, i, value) {
|
|
1183
|
-
verifyStatement(stmt);
|
|
1184
|
-
const ptr = createUTF8(value);
|
|
1185
|
-
const result = f(stmt, i, ptr, -1, sqliteFreeAddress);
|
|
1186
|
-
return check(fname, result, mapStmtToDB.get(stmt));
|
|
1187
|
-
};
|
|
1188
|
-
})();
|
|
1189
|
-
|
|
1190
|
-
sqlite3.changes = (function() {
|
|
1191
|
-
const fname = 'sqlite3_changes';
|
|
1192
|
-
const f = Module.cwrap(fname, ...decl('n:n'));
|
|
1193
|
-
return function(db) {
|
|
1194
|
-
verifyDatabase(db);
|
|
1195
|
-
const result = f(db);
|
|
1196
|
-
return result;
|
|
1197
|
-
};
|
|
1198
|
-
})();
|
|
1199
|
-
|
|
1200
|
-
sqlite3.clear_bindings = (function() {
|
|
1201
|
-
const fname = 'sqlite3_clear_bindings';
|
|
1202
|
-
const f = Module.cwrap(fname, ...decl('n:n'));
|
|
1203
|
-
return function(stmt) {
|
|
1204
|
-
verifyStatement(stmt);
|
|
1205
|
-
const result = f(stmt);
|
|
1206
|
-
return check(fname, result, mapStmtToDB.get(stmt));
|
|
1207
|
-
};
|
|
1208
|
-
})();
|
|
1209
|
-
|
|
1210
|
-
sqlite3.last_insert_id = (function() {
|
|
1211
|
-
const fname = 'sqlite3_last_insert_rowid';
|
|
1212
|
-
const f = Module.cwrap(fname, ...decl('n:n'));
|
|
1213
|
-
return function(db) {
|
|
1214
|
-
verifyDatabase(db);
|
|
1215
|
-
const result = f(db);
|
|
1216
|
-
// trace(fname, result);
|
|
1217
|
-
return result;
|
|
1218
|
-
};
|
|
1219
|
-
})();
|
|
1220
|
-
|
|
1221
|
-
sqlite3.close = (function() {
|
|
1222
|
-
const fname = 'sqlite3_close';
|
|
1223
|
-
const f = Module.cwrap(fname, ...decl('n:n'), { async });
|
|
1224
|
-
return async function(db) {
|
|
1225
|
-
verifyDatabase(db);
|
|
1226
|
-
const result = await f(db);
|
|
1227
|
-
databases.delete(db);
|
|
1228
|
-
return check(fname, result, db);
|
|
1229
|
-
};
|
|
1230
|
-
})();
|
|
1231
|
-
|
|
1232
|
-
sqlite3.column = function(stmt, iCol) {
|
|
1233
|
-
verifyStatement(stmt);
|
|
1234
|
-
const type = sqlite3.column_type(stmt, iCol);
|
|
1235
|
-
switch (type) {
|
|
1236
|
-
case _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_BLOB:
|
|
1237
|
-
return sqlite3.column_blob(stmt, iCol);
|
|
1238
|
-
case _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FLOAT:
|
|
1239
|
-
return sqlite3.column_double(stmt, iCol);
|
|
1240
|
-
case _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INTEGER:
|
|
1241
|
-
const lo32 = sqlite3.column_int(stmt, iCol);
|
|
1242
|
-
const hi32 = Module.getTempRet0();
|
|
1243
|
-
return cvt32x2AsSafe(lo32, hi32);
|
|
1244
|
-
case _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_NULL:
|
|
1245
|
-
return null;
|
|
1246
|
-
case _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_TEXT:
|
|
1247
|
-
return sqlite3.column_text(stmt, iCol);
|
|
1248
|
-
default:
|
|
1249
|
-
throw new SQLiteError('unknown type', type);
|
|
1250
|
-
}
|
|
1251
|
-
};
|
|
1252
|
-
|
|
1253
|
-
sqlite3.column_blob = (function() {
|
|
1254
|
-
const fname = 'sqlite3_column_blob';
|
|
1255
|
-
const f = Module.cwrap(fname, ...decl('nn:n'));
|
|
1256
|
-
return function(stmt, iCol) {
|
|
1257
|
-
verifyStatement(stmt);
|
|
1258
|
-
const nBytes = sqlite3.column_bytes(stmt, iCol);
|
|
1259
|
-
const address = f(stmt, iCol);
|
|
1260
|
-
const result = Module.HEAPU8.subarray(address, address + nBytes);
|
|
1261
|
-
return result;
|
|
1262
|
-
};
|
|
1263
|
-
})();
|
|
1264
|
-
|
|
1265
|
-
sqlite3.column_bytes = (function() {
|
|
1266
|
-
const fname = 'sqlite3_column_bytes';
|
|
1267
|
-
const f = Module.cwrap(fname, ...decl('nn:n'));
|
|
1268
|
-
return function(stmt, iCol) {
|
|
1269
|
-
verifyStatement(stmt);
|
|
1270
|
-
const result = f(stmt, iCol);
|
|
1271
|
-
return result;
|
|
1272
|
-
};
|
|
1273
|
-
})();
|
|
1274
|
-
|
|
1275
|
-
sqlite3.column_count = (function() {
|
|
1276
|
-
const fname = 'sqlite3_column_count';
|
|
1277
|
-
const f = Module.cwrap(fname, ...decl('n:n'));
|
|
1278
|
-
return function(stmt) {
|
|
1279
|
-
verifyStatement(stmt);
|
|
1280
|
-
const result = f(stmt);
|
|
1281
|
-
return result;
|
|
1282
|
-
};
|
|
1283
|
-
})();
|
|
1284
|
-
|
|
1285
|
-
sqlite3.column_double = (function() {
|
|
1286
|
-
const fname = 'sqlite3_column_double';
|
|
1287
|
-
const f = Module.cwrap(fname, ...decl('nn:n'));
|
|
1288
|
-
return function(stmt, iCol) {
|
|
1289
|
-
verifyStatement(stmt);
|
|
1290
|
-
const result = f(stmt, iCol);
|
|
1291
|
-
return result;
|
|
1292
|
-
};
|
|
1293
|
-
})();
|
|
1294
|
-
|
|
1295
|
-
sqlite3.column_int = (function() {
|
|
1296
|
-
// Retrieve int64 but use only the lower 32 bits. The upper 32-bits are
|
|
1297
|
-
// accessible with Module.getTempRet0().
|
|
1298
|
-
const fname = 'sqlite3_column_int64';
|
|
1299
|
-
const f = Module.cwrap(fname, ...decl('nn:n'));
|
|
1300
|
-
return function(stmt, iCol) {
|
|
1301
|
-
verifyStatement(stmt);
|
|
1302
|
-
const result = f(stmt, iCol);
|
|
1303
|
-
return result;
|
|
1304
|
-
};
|
|
1305
|
-
})();
|
|
1306
|
-
|
|
1307
|
-
sqlite3.column_int64 = (function() {
|
|
1308
|
-
const fname = 'sqlite3_column_int64';
|
|
1309
|
-
const f = Module.cwrap(fname, ...decl('nn:n'));
|
|
1310
|
-
return function(stmt, iCol) {
|
|
1311
|
-
verifyStatement(stmt);
|
|
1312
|
-
const lo32 = f(stmt, iCol);
|
|
1313
|
-
const hi32 = Module.getTempRet0();
|
|
1314
|
-
const result = cvt32x2ToBigInt(lo32, hi32);
|
|
1315
|
-
return result;
|
|
1316
|
-
};
|
|
1317
|
-
})();
|
|
1318
|
-
|
|
1319
|
-
sqlite3.column_name = (function() {
|
|
1320
|
-
const fname = 'sqlite3_column_name';
|
|
1321
|
-
const f = Module.cwrap(fname, ...decl('nn:s'));
|
|
1322
|
-
return function(stmt, iCol) {
|
|
1323
|
-
verifyStatement(stmt);
|
|
1324
|
-
const result = f(stmt, iCol);
|
|
1325
|
-
return result;
|
|
1326
|
-
};
|
|
1327
|
-
})();
|
|
1328
|
-
|
|
1329
|
-
sqlite3.column_names = function(stmt) {
|
|
1330
|
-
const columns = [];
|
|
1331
|
-
const nColumns = sqlite3.column_count(stmt);
|
|
1332
|
-
for (let i = 0; i < nColumns; ++i) {
|
|
1333
|
-
columns.push(sqlite3.column_name(stmt, i));
|
|
1334
|
-
}
|
|
1335
|
-
return columns;
|
|
1336
|
-
};
|
|
1337
|
-
|
|
1338
|
-
sqlite3.column_text = (function() {
|
|
1339
|
-
const fname = 'sqlite3_column_text';
|
|
1340
|
-
const f = Module.cwrap(fname, ...decl('nn:s'));
|
|
1341
|
-
return function(stmt, iCol) {
|
|
1342
|
-
verifyStatement(stmt);
|
|
1343
|
-
const result = f(stmt, iCol);
|
|
1344
|
-
return result;
|
|
1345
|
-
};
|
|
1346
|
-
})();
|
|
1347
|
-
|
|
1348
|
-
sqlite3.column_type = (function() {
|
|
1349
|
-
const fname = 'sqlite3_column_type';
|
|
1350
|
-
const f = Module.cwrap(fname, ...decl('nn:n'));
|
|
1351
|
-
return function(stmt, iCol) {
|
|
1352
|
-
verifyStatement(stmt);
|
|
1353
|
-
const result = f(stmt, iCol);
|
|
1354
|
-
return result;
|
|
1355
|
-
};
|
|
1356
|
-
})();
|
|
1357
|
-
|
|
1358
|
-
sqlite3.create_function = function(db, zFunctionName, nArg, eTextRep, pApp, xFunc, xStep, xFinal) {
|
|
1359
|
-
verifyDatabase(db);
|
|
1360
|
-
|
|
1361
|
-
// Convert SQLite callback arguments to JavaScript-friendly arguments.
|
|
1362
|
-
function adapt(f) {
|
|
1363
|
-
return f instanceof AsyncFunction ?
|
|
1364
|
-
(async (ctx, n, values) => f(ctx, Module.HEAP32.subarray(values / 4, values / 4 + n))) :
|
|
1365
|
-
((ctx, n, values) => f(ctx, Module.HEAP32.subarray(values / 4, values / 4 + n)));
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
const result = Module.create_function(
|
|
1369
|
-
db,
|
|
1370
|
-
zFunctionName,
|
|
1371
|
-
nArg,
|
|
1372
|
-
eTextRep,
|
|
1373
|
-
pApp,
|
|
1374
|
-
xFunc && adapt(xFunc),
|
|
1375
|
-
xStep && adapt(xStep),
|
|
1376
|
-
xFinal);
|
|
1377
|
-
return check('sqlite3_create_function', result, db);
|
|
1378
|
-
};
|
|
1379
|
-
|
|
1380
|
-
sqlite3.data_count = (function() {
|
|
1381
|
-
const fname = 'sqlite3_data_count';
|
|
1382
|
-
const f = Module.cwrap(fname, ...decl('n:n'));
|
|
1383
|
-
return function(stmt) {
|
|
1384
|
-
verifyStatement(stmt);
|
|
1385
|
-
const result = f(stmt);
|
|
1386
|
-
return result;
|
|
1387
|
-
};
|
|
1388
|
-
})();
|
|
1389
|
-
|
|
1390
|
-
sqlite3.exec = async function(db, sql, callback) {
|
|
1391
|
-
for await (const stmt of sqlite3.statements(db, sql)) {
|
|
1392
|
-
let columns;
|
|
1393
|
-
while ((await sqlite3.step(stmt)) === _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ROW) {
|
|
1394
|
-
if (callback) {
|
|
1395
|
-
columns = columns ?? sqlite3.column_names(stmt);
|
|
1396
|
-
const row = sqlite3.row(stmt);
|
|
1397
|
-
await callback(row, columns);
|
|
1398
|
-
}
|
|
1399
|
-
}
|
|
1400
|
-
}
|
|
1401
|
-
return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK;
|
|
1402
|
-
};
|
|
1403
|
-
|
|
1404
|
-
sqlite3.finalize = (function() {
|
|
1405
|
-
const fname = 'sqlite3_finalize';
|
|
1406
|
-
const f = Module.cwrap(fname, ...decl('n:n'), { async });
|
|
1407
|
-
return async function(stmt) {
|
|
1408
|
-
const result = await f(stmt);
|
|
1409
|
-
mapStmtToDB.delete(stmt)
|
|
1410
|
-
|
|
1411
|
-
// Don't throw on error here. Typically the error has already been
|
|
1412
|
-
// thrown and finalize() is part of the cleanup.
|
|
1413
|
-
return result;
|
|
1414
|
-
};
|
|
1415
|
-
})();
|
|
1416
|
-
|
|
1417
|
-
sqlite3.get_autocommit = (function() {
|
|
1418
|
-
const fname = 'sqlite3_get_autocommit';
|
|
1419
|
-
const f = Module.cwrap(fname, ...decl('n:n'));
|
|
1420
|
-
return function(db) {
|
|
1421
|
-
const result = f(db);
|
|
1422
|
-
return result;
|
|
1423
|
-
};
|
|
1424
|
-
})();
|
|
1425
|
-
|
|
1426
|
-
sqlite3.libversion = (function() {
|
|
1427
|
-
const fname = 'sqlite3_libversion';
|
|
1428
|
-
const f = Module.cwrap(fname, ...decl(':s'));
|
|
1429
|
-
return function() {
|
|
1430
|
-
const result = f();
|
|
1431
|
-
return result;
|
|
1432
|
-
};
|
|
1433
|
-
})();
|
|
1434
|
-
|
|
1435
|
-
sqlite3.libversion_number = (function() {
|
|
1436
|
-
const fname = 'sqlite3_libversion_number';
|
|
1437
|
-
const f = Module.cwrap(fname, ...decl(':n'));
|
|
1438
|
-
return function() {
|
|
1439
|
-
const result = f();
|
|
1440
|
-
return result;
|
|
1441
|
-
};
|
|
1442
|
-
})();
|
|
1443
|
-
|
|
1444
|
-
sqlite3.limit = (function() {
|
|
1445
|
-
const fname = 'sqlite3_limit';
|
|
1446
|
-
const f = Module.cwrap(fname, ...decl('nnn:n'));
|
|
1447
|
-
return function(db, id, newVal) {
|
|
1448
|
-
const result = f(db, id, newVal);
|
|
1449
|
-
return result;
|
|
1450
|
-
};
|
|
1451
|
-
})();
|
|
1452
|
-
|
|
1453
|
-
sqlite3.open_v2 = (function() {
|
|
1454
|
-
const fname = 'sqlite3_open_v2';
|
|
1455
|
-
const f = Module.cwrap(fname, ...decl('snnn:n'), { async });
|
|
1456
|
-
return async function(zFilename, flags, zVfs) {
|
|
1457
|
-
flags = flags || _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_CREATE | _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OPEN_READWRITE;
|
|
1458
|
-
zVfs = createUTF8(zVfs);
|
|
1459
|
-
try {
|
|
1460
|
-
// Allow retry operations.
|
|
1461
|
-
const rc = await retry(() => f(zFilename, tmpPtr[0], flags, zVfs));
|
|
1462
|
-
|
|
1463
|
-
const db = Module.getValue(tmpPtr[0], '*');
|
|
1464
|
-
databases.add(db);
|
|
1465
|
-
|
|
1466
|
-
Module.ccall('RegisterExtensionFunctions', 'number', ['number'], [db]);
|
|
1467
|
-
check(fname, rc);
|
|
1468
|
-
return db;
|
|
1469
|
-
} finally {
|
|
1470
|
-
Module._sqlite3_free(zVfs);
|
|
1471
|
-
}
|
|
1472
|
-
};
|
|
1473
|
-
})();
|
|
1474
|
-
|
|
1475
|
-
sqlite3.progress_handler = function(db, nProgressOps, handler, userData) {
|
|
1476
|
-
verifyDatabase(db);
|
|
1477
|
-
Module.progress_handler(db, nProgressOps, handler, userData);
|
|
1478
|
-
};;
|
|
1479
|
-
|
|
1480
|
-
sqlite3.reset = (function() {
|
|
1481
|
-
const fname = 'sqlite3_reset';
|
|
1482
|
-
const f = Module.cwrap(fname, ...decl('n:n'), { async });
|
|
1483
|
-
return async function(stmt) {
|
|
1484
|
-
verifyStatement(stmt);
|
|
1485
|
-
const result = await f(stmt);
|
|
1486
|
-
return check(fname, result, mapStmtToDB.get(stmt));
|
|
1487
|
-
};
|
|
1488
|
-
})();
|
|
1489
|
-
|
|
1490
|
-
sqlite3.result = function(context, value) {
|
|
1491
|
-
switch (typeof value) {
|
|
1492
|
-
case 'number':
|
|
1493
|
-
if (value === (value | 0)) {
|
|
1494
|
-
sqlite3.result_int(context, value);
|
|
1495
|
-
} else {
|
|
1496
|
-
sqlite3.result_double(context, value);
|
|
1497
|
-
}
|
|
1498
|
-
break;
|
|
1499
|
-
case 'string':
|
|
1500
|
-
sqlite3.result_text(context, value);
|
|
1501
|
-
break;
|
|
1502
|
-
default:
|
|
1503
|
-
if (value instanceof Uint8Array || Array.isArray(value)) {
|
|
1504
|
-
sqlite3.result_blob(context, value);
|
|
1505
|
-
} else if (value === null) {
|
|
1506
|
-
sqlite3.result_null(context);
|
|
1507
|
-
} else if (typeof value === 'bigint') {
|
|
1508
|
-
return sqlite3.result_int64(context, value);
|
|
1509
|
-
} else {
|
|
1510
|
-
console.warn('unknown result converted to null', value);
|
|
1511
|
-
sqlite3.result_null(context);
|
|
1512
|
-
}
|
|
1513
|
-
break;
|
|
1514
|
-
}
|
|
1515
|
-
};
|
|
1516
|
-
|
|
1517
|
-
sqlite3.result_blob = (function() {
|
|
1518
|
-
const fname = 'sqlite3_result_blob';
|
|
1519
|
-
const f = Module.cwrap(fname, ...decl('nnnn:n'));
|
|
1520
|
-
return function(context, value) {
|
|
1521
|
-
// @ts-ignore
|
|
1522
|
-
const byteLength = value.byteLength ?? value.length;
|
|
1523
|
-
const ptr = Module._sqlite3_malloc(byteLength);
|
|
1524
|
-
Module.HEAPU8.subarray(ptr).set(value);
|
|
1525
|
-
f(context, ptr, byteLength, sqliteFreeAddress); // void return
|
|
1526
|
-
};
|
|
1527
|
-
})();
|
|
1528
|
-
|
|
1529
|
-
sqlite3.result_double = (function() {
|
|
1530
|
-
const fname = 'sqlite3_result_double';
|
|
1531
|
-
const f = Module.cwrap(fname, ...decl('nn:n'));
|
|
1532
|
-
return function(context, value) {
|
|
1533
|
-
f(context, value); // void return
|
|
1534
|
-
};
|
|
1535
|
-
})();
|
|
1536
|
-
|
|
1537
|
-
sqlite3.result_int = (function() {
|
|
1538
|
-
const fname = 'sqlite3_result_int';
|
|
1539
|
-
const f = Module.cwrap(fname, ...decl('nn:n'));
|
|
1540
|
-
return function(context, value) {
|
|
1541
|
-
f(context, value); // void return
|
|
1542
|
-
};
|
|
1543
|
-
})();
|
|
1544
|
-
|
|
1545
|
-
sqlite3.result_int64 = (function() {
|
|
1546
|
-
const fname = 'sqlite3_result_int64';
|
|
1547
|
-
const f = Module.cwrap(fname, ...decl('nnn:n'));
|
|
1548
|
-
return function(context, value) {
|
|
1549
|
-
if (value > MAX_INT64 || value < MIN_INT64) return _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_RANGE;
|
|
1550
|
-
|
|
1551
|
-
const lo32 = value & 0xffffffffn;
|
|
1552
|
-
const hi32 = value >> 32n;
|
|
1553
|
-
f(context, Number(lo32), Number(hi32)); // void return
|
|
1554
|
-
};
|
|
1555
|
-
})();
|
|
1556
|
-
|
|
1557
|
-
sqlite3.result_null = (function() {
|
|
1558
|
-
const fname = 'sqlite3_result_null';
|
|
1559
|
-
const f = Module.cwrap(fname, ...decl('n:n'));
|
|
1560
|
-
return function(context) {
|
|
1561
|
-
f(context); // void return
|
|
1562
|
-
};
|
|
1563
|
-
})();
|
|
1564
|
-
|
|
1565
|
-
sqlite3.result_text = (function() {
|
|
1566
|
-
const fname = 'sqlite3_result_text';
|
|
1567
|
-
const f = Module.cwrap(fname, ...decl('nnnn:n'));
|
|
1568
|
-
return function(context, value) {
|
|
1569
|
-
const ptr = createUTF8(value);
|
|
1570
|
-
f(context, ptr, -1, sqliteFreeAddress); // void return
|
|
1571
|
-
};
|
|
1572
|
-
})();
|
|
1573
|
-
|
|
1574
|
-
sqlite3.row = function(stmt) {
|
|
1575
|
-
const row = [];
|
|
1576
|
-
const nColumns = sqlite3.data_count(stmt);
|
|
1577
|
-
for (let i = 0; i < nColumns; ++i) {
|
|
1578
|
-
const value = sqlite3.column(stmt, i);
|
|
1579
|
-
|
|
1580
|
-
// Copy blob if aliasing volatile WebAssembly memory. This avoids an
|
|
1581
|
-
// unnecessary copy if users monkey patch column_blob to copy.
|
|
1582
|
-
// @ts-ignore
|
|
1583
|
-
row.push(value?.buffer === Module.HEAPU8.buffer ? value.slice() : value);
|
|
1584
|
-
}
|
|
1585
|
-
return row;
|
|
1586
|
-
};
|
|
1587
|
-
|
|
1588
|
-
sqlite3.set_authorizer = function(db, xAuth, pApp) {
|
|
1589
|
-
verifyDatabase(db);
|
|
1590
|
-
|
|
1591
|
-
// Convert SQLite callback arguments to JavaScript-friendly arguments.
|
|
1592
|
-
function cvtArgs(_, iAction, p3, p4, p5, p6) {
|
|
1593
|
-
return [
|
|
1594
|
-
_,
|
|
1595
|
-
iAction,
|
|
1596
|
-
Module.UTF8ToString(p3),
|
|
1597
|
-
Module.UTF8ToString(p4),
|
|
1598
|
-
Module.UTF8ToString(p5),
|
|
1599
|
-
Module.UTF8ToString(p6)
|
|
1600
|
-
];
|
|
1601
|
-
};
|
|
1602
|
-
function adapt(f) {
|
|
1603
|
-
return f instanceof AsyncFunction ?
|
|
1604
|
-
(async (_, iAction, p3, p4, p5, p6) => f(...cvtArgs(_, iAction, p3, p4, p5, p6))) :
|
|
1605
|
-
((_, iAction, p3, p4, p5, p6) => f(...cvtArgs(_, iAction, p3, p4, p5, p6)));
|
|
1606
|
-
}
|
|
1607
|
-
|
|
1608
|
-
const result = Module.set_authorizer(db, adapt(xAuth), pApp);
|
|
1609
|
-
return check('sqlite3_set_authorizer', result, db);
|
|
1610
|
-
};
|
|
1611
|
-
|
|
1612
|
-
sqlite3.sql = (function() {
|
|
1613
|
-
const fname = 'sqlite3_sql';
|
|
1614
|
-
const f = Module.cwrap(fname, ...decl('n:s'));
|
|
1615
|
-
return function(stmt) {
|
|
1616
|
-
verifyStatement(stmt);
|
|
1617
|
-
const result = f(stmt);
|
|
1618
|
-
return result;
|
|
1619
|
-
};
|
|
1620
|
-
})();
|
|
1621
|
-
|
|
1622
|
-
sqlite3.statements = function(db, sql, options = {}) {
|
|
1623
|
-
const prepare = Module.cwrap(
|
|
1624
|
-
'sqlite3_prepare_v3',
|
|
1625
|
-
'number',
|
|
1626
|
-
['number', 'number', 'number', 'number', 'number', 'number'],
|
|
1627
|
-
{ async: true });
|
|
1628
|
-
|
|
1629
|
-
return (async function*() {
|
|
1630
|
-
const onFinally = [];
|
|
1631
|
-
try {
|
|
1632
|
-
// Encode SQL string to UTF-8.
|
|
1633
|
-
const utf8 = textEncoder.encode(sql);
|
|
1634
|
-
|
|
1635
|
-
// Copy encoded string to WebAssembly memory. The SQLite docs say
|
|
1636
|
-
// zero-termination is a minor optimization so add room for that.
|
|
1637
|
-
// Also add space for the statement handle and SQL tail pointer.
|
|
1638
|
-
const allocSize = utf8.byteLength - (utf8.byteLength % 4) + 12;
|
|
1639
|
-
const pzHead = Module._sqlite3_malloc(allocSize);
|
|
1640
|
-
const pzEnd = pzHead + utf8.byteLength + 1;
|
|
1641
|
-
onFinally.push(() => Module._sqlite3_free(pzHead));
|
|
1642
|
-
Module.HEAPU8.set(utf8, pzHead);
|
|
1643
|
-
Module.HEAPU8[pzEnd - 1] = 0;
|
|
1644
|
-
|
|
1645
|
-
// Use extra space for the statement handle and SQL tail pointer.
|
|
1646
|
-
const pStmt = pzHead + allocSize - 8;
|
|
1647
|
-
const pzTail = pzHead + allocSize - 4;
|
|
1648
|
-
|
|
1649
|
-
// Ensure that statement handles are not leaked.
|
|
1650
|
-
let stmt;
|
|
1651
|
-
function maybeFinalize() {
|
|
1652
|
-
if (stmt && !options.unscoped) {
|
|
1653
|
-
sqlite3.finalize(stmt);
|
|
1654
|
-
}
|
|
1655
|
-
stmt = 0;
|
|
1656
|
-
}
|
|
1657
|
-
onFinally.push(maybeFinalize);
|
|
1658
|
-
|
|
1659
|
-
// Loop over statements.
|
|
1660
|
-
Module.setValue(pzTail, pzHead, '*');
|
|
1661
|
-
do {
|
|
1662
|
-
// Reclaim resources for the previous iteration.
|
|
1663
|
-
maybeFinalize();
|
|
1664
|
-
|
|
1665
|
-
// Call sqlite3_prepare_v3() for the next statement.
|
|
1666
|
-
// Allow retry operations.
|
|
1667
|
-
const zTail = Module.getValue(pzTail, '*');
|
|
1668
|
-
const rc = await retry(() => {
|
|
1669
|
-
return prepare(
|
|
1670
|
-
db,
|
|
1671
|
-
zTail,
|
|
1672
|
-
pzEnd - pzTail,
|
|
1673
|
-
options.flags || 0,
|
|
1674
|
-
pStmt,
|
|
1675
|
-
pzTail);
|
|
1676
|
-
});
|
|
1677
|
-
|
|
1678
|
-
if (rc !== _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK) {
|
|
1679
|
-
check('sqlite3_prepare_v3', rc, db);
|
|
1680
|
-
}
|
|
1681
|
-
|
|
1682
|
-
stmt = Module.getValue(pStmt, '*');
|
|
1683
|
-
if (stmt) {
|
|
1684
|
-
mapStmtToDB.set(stmt, db);
|
|
1685
|
-
yield stmt;
|
|
1686
|
-
}
|
|
1687
|
-
} while (stmt);
|
|
1688
|
-
} finally {
|
|
1689
|
-
while (onFinally.length) {
|
|
1690
|
-
onFinally.pop()();
|
|
1691
|
-
}
|
|
1692
|
-
}
|
|
1693
|
-
})();
|
|
1694
|
-
};
|
|
1695
|
-
|
|
1696
|
-
sqlite3.step = (function() {
|
|
1697
|
-
const fname = 'sqlite3_step';
|
|
1698
|
-
const f = Module.cwrap(fname, ...decl('n:n'), { async });
|
|
1699
|
-
return async function(stmt) {
|
|
1700
|
-
verifyStatement(stmt);
|
|
1701
|
-
|
|
1702
|
-
// Allow retry operations.
|
|
1703
|
-
const rc = await retry(() => f(stmt));
|
|
1704
|
-
|
|
1705
|
-
return check(fname, rc, mapStmtToDB.get(stmt), [_sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ROW, _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DONE]);
|
|
1706
|
-
};
|
|
1707
|
-
})();
|
|
1708
|
-
|
|
1709
|
-
sqlite3.commit_hook = function(db, xCommitHook) {
|
|
1710
|
-
verifyDatabase(db);
|
|
1711
|
-
Module.commit_hook(db, xCommitHook);
|
|
1712
|
-
};
|
|
1713
|
-
|
|
1714
|
-
sqlite3.update_hook = function(db, xUpdateHook) {
|
|
1715
|
-
verifyDatabase(db);
|
|
1716
|
-
|
|
1717
|
-
// Convert SQLite callback arguments to JavaScript-friendly arguments.
|
|
1718
|
-
function cvtArgs(iUpdateType, dbName, tblName, lo32, hi32) {
|
|
1719
|
-
return [
|
|
1720
|
-
iUpdateType,
|
|
1721
|
-
Module.UTF8ToString(dbName),
|
|
1722
|
-
Module.UTF8ToString(tblName),
|
|
1723
|
-
cvt32x2ToBigInt(lo32, hi32)
|
|
1724
|
-
];
|
|
1725
|
-
};
|
|
1726
|
-
function adapt(f) {
|
|
1727
|
-
return f instanceof AsyncFunction ?
|
|
1728
|
-
(async (iUpdateType, dbName, tblName, lo32, hi32) => f(...cvtArgs(iUpdateType, dbName, tblName, lo32, hi32))) :
|
|
1729
|
-
((iUpdateType, dbName, tblName, lo32, hi32) => f(...cvtArgs(iUpdateType, dbName, tblName, lo32, hi32)));
|
|
1730
|
-
}
|
|
1731
|
-
|
|
1732
|
-
Module.update_hook(db, adapt(xUpdateHook));
|
|
1733
|
-
};;
|
|
1734
|
-
|
|
1735
|
-
sqlite3.value = function(pValue) {
|
|
1736
|
-
const type = sqlite3.value_type(pValue);
|
|
1737
|
-
switch (type) {
|
|
1738
|
-
case _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_BLOB:
|
|
1739
|
-
return sqlite3.value_blob(pValue);
|
|
1740
|
-
case _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_FLOAT:
|
|
1741
|
-
return sqlite3.value_double(pValue);
|
|
1742
|
-
case _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_INTEGER:
|
|
1743
|
-
const lo32 = sqlite3.value_int(pValue);
|
|
1744
|
-
const hi32 = Module.getTempRet0();
|
|
1745
|
-
return cvt32x2AsSafe(lo32, hi32);
|
|
1746
|
-
case _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_NULL:
|
|
1747
|
-
return null;
|
|
1748
|
-
case _sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_TEXT:
|
|
1749
|
-
return sqlite3.value_text(pValue);
|
|
1750
|
-
default:
|
|
1751
|
-
throw new SQLiteError('unknown type', type);
|
|
1752
|
-
}
|
|
1753
|
-
};
|
|
1754
|
-
|
|
1755
|
-
sqlite3.value_blob = (function() {
|
|
1756
|
-
const fname = 'sqlite3_value_blob';
|
|
1757
|
-
const f = Module.cwrap(fname, ...decl('n:n'));
|
|
1758
|
-
return function(pValue) {
|
|
1759
|
-
const nBytes = sqlite3.value_bytes(pValue);
|
|
1760
|
-
const address = f(pValue);
|
|
1761
|
-
const result = Module.HEAPU8.subarray(address, address + nBytes);
|
|
1762
|
-
return result;
|
|
1763
|
-
};
|
|
1764
|
-
})();
|
|
1765
|
-
|
|
1766
|
-
sqlite3.value_bytes = (function() {
|
|
1767
|
-
const fname = 'sqlite3_value_bytes';
|
|
1768
|
-
const f = Module.cwrap(fname, ...decl('n:n'));
|
|
1769
|
-
return function(pValue) {
|
|
1770
|
-
const result = f(pValue);
|
|
1771
|
-
return result;
|
|
1772
|
-
};
|
|
1773
|
-
})();
|
|
1774
|
-
|
|
1775
|
-
sqlite3.value_double = (function() {
|
|
1776
|
-
const fname = 'sqlite3_value_double';
|
|
1777
|
-
const f = Module.cwrap(fname, ...decl('n:n'));
|
|
1778
|
-
return function(pValue) {
|
|
1779
|
-
const result = f(pValue);
|
|
1780
|
-
return result;
|
|
1781
|
-
};
|
|
1782
|
-
})();
|
|
1783
|
-
|
|
1784
|
-
sqlite3.value_int = (function() {
|
|
1785
|
-
const fname = 'sqlite3_value_int64';
|
|
1786
|
-
const f = Module.cwrap(fname, ...decl('n:n'));
|
|
1787
|
-
return function(pValue) {
|
|
1788
|
-
const result = f(pValue);
|
|
1789
|
-
return result;
|
|
1790
|
-
};
|
|
1791
|
-
})();
|
|
1792
|
-
|
|
1793
|
-
sqlite3.value_int64 = (function() {
|
|
1794
|
-
const fname = 'sqlite3_value_int64';
|
|
1795
|
-
const f = Module.cwrap(fname, ...decl('n:n'));
|
|
1796
|
-
return function(pValue) {
|
|
1797
|
-
const lo32 = f(pValue);
|
|
1798
|
-
const hi32 = Module.getTempRet0();
|
|
1799
|
-
const result = cvt32x2ToBigInt(lo32, hi32);
|
|
1800
|
-
return result;
|
|
1801
|
-
};
|
|
1802
|
-
})();
|
|
1803
|
-
|
|
1804
|
-
sqlite3.value_text = (function() {
|
|
1805
|
-
const fname = 'sqlite3_value_text';
|
|
1806
|
-
const f = Module.cwrap(fname, ...decl('n:s'));
|
|
1807
|
-
return function(pValue) {
|
|
1808
|
-
const result = f(pValue);
|
|
1809
|
-
return result;
|
|
1810
|
-
};
|
|
1811
|
-
})();
|
|
1812
|
-
|
|
1813
|
-
sqlite3.value_type = (function() {
|
|
1814
|
-
const fname = 'sqlite3_value_type';
|
|
1815
|
-
const f = Module.cwrap(fname, ...decl('n:n'));
|
|
1816
|
-
return function(pValue) {
|
|
1817
|
-
const result = f(pValue);
|
|
1818
|
-
return result;
|
|
1819
|
-
};
|
|
1820
|
-
})();
|
|
1821
|
-
|
|
1822
|
-
sqlite3.vfs_register = function(vfs, makeDefault) {
|
|
1823
|
-
const result = Module.vfs_register(vfs, makeDefault);
|
|
1824
|
-
return check('sqlite3_vfs_register', result);
|
|
1825
|
-
};
|
|
1826
|
-
|
|
1827
|
-
function check(fname, result, db = null, allowed = [_sqlite_constants_js__WEBPACK_IMPORTED_MODULE_0__.SQLITE_OK]) {
|
|
1828
|
-
if (allowed.includes(result)) return result;
|
|
1829
|
-
const message = db ? Module.ccall('sqlite3_errmsg', 'string', ['number'], [db]) : fname;
|
|
1830
|
-
throw new SQLiteError(message, result);
|
|
1831
|
-
}
|
|
1832
|
-
|
|
1833
|
-
// This function is used to automatically retry failed calls that
|
|
1834
|
-
// have pending retry operations that should allow the retry to
|
|
1835
|
-
// succeed.
|
|
1836
|
-
async function retry(f) {
|
|
1837
|
-
let rc;
|
|
1838
|
-
do {
|
|
1839
|
-
// Wait for all pending retry operations to complete. This is
|
|
1840
|
-
// normally empty on the first loop iteration.
|
|
1841
|
-
if (Module.retryOps.length) {
|
|
1842
|
-
try {
|
|
1843
|
-
await Promise.all(Module.retryOps);
|
|
1844
|
-
} finally {
|
|
1845
|
-
Module.retryOps = [];
|
|
1846
|
-
}
|
|
1847
|
-
}
|
|
1848
|
-
|
|
1849
|
-
rc = await f();
|
|
1850
|
-
|
|
1851
|
-
// Retry on failure with new pending retry operations.
|
|
1852
|
-
} while (rc && Module.retryOps.length);
|
|
1853
|
-
return rc;
|
|
1854
|
-
}
|
|
1855
|
-
|
|
1856
|
-
return sqlite3;
|
|
1857
|
-
}
|
|
1858
|
-
|
|
1859
|
-
// Helper function to use a more compact signature specification.
|
|
1860
|
-
function decl(s) {
|
|
1861
|
-
const result = [];
|
|
1862
|
-
const m = s.match(/([ns@]*):([nsv@])/);
|
|
1863
|
-
switch (m[2]) {
|
|
1864
|
-
case 'n':
|
|
1865
|
-
result.push('number');
|
|
1866
|
-
break;
|
|
1867
|
-
case 's':
|
|
1868
|
-
result.push('string');
|
|
1869
|
-
break;
|
|
1870
|
-
case 'v':
|
|
1871
|
-
result.push(null);
|
|
1872
|
-
break;
|
|
1873
|
-
}
|
|
1874
|
-
|
|
1875
|
-
const args = [];
|
|
1876
|
-
for (let c of m[1]) {
|
|
1877
|
-
switch (c) {
|
|
1878
|
-
case 'n':
|
|
1879
|
-
args.push('number');
|
|
1880
|
-
break;
|
|
1881
|
-
case 's':
|
|
1882
|
-
args.push('string');
|
|
1883
|
-
break;
|
|
1884
|
-
}
|
|
1885
|
-
}
|
|
1886
|
-
result.push(args);
|
|
1887
|
-
return result;
|
|
1888
|
-
}
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
/***/ },
|
|
1892
|
-
|
|
1893
|
-
/***/ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.5.0/node_modules/@journeyapps/wa-sqlite/src/sqlite-constants.js"
|
|
1894
|
-
/*!*************************************************************************************************************************!*\
|
|
1895
|
-
!*** ../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.5.0/node_modules/@journeyapps/wa-sqlite/src/sqlite-constants.js ***!
|
|
1896
|
-
\*************************************************************************************************************************/
|
|
1897
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1898
|
-
|
|
1899
|
-
__webpack_require__.r(__webpack_exports__);
|
|
1900
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1901
|
-
/* harmony export */ SQLITE_ABORT: () => (/* binding */ SQLITE_ABORT),
|
|
1902
|
-
/* harmony export */ SQLITE_ACCESS_EXISTS: () => (/* binding */ SQLITE_ACCESS_EXISTS),
|
|
1903
|
-
/* harmony export */ SQLITE_ACCESS_READ: () => (/* binding */ SQLITE_ACCESS_READ),
|
|
1904
|
-
/* harmony export */ SQLITE_ACCESS_READWRITE: () => (/* binding */ SQLITE_ACCESS_READWRITE),
|
|
1905
|
-
/* harmony export */ SQLITE_ALTER_TABLE: () => (/* binding */ SQLITE_ALTER_TABLE),
|
|
1906
|
-
/* harmony export */ SQLITE_ANALYZE: () => (/* binding */ SQLITE_ANALYZE),
|
|
1907
|
-
/* harmony export */ SQLITE_ATTACH: () => (/* binding */ SQLITE_ATTACH),
|
|
1908
|
-
/* harmony export */ SQLITE_AUTH: () => (/* binding */ SQLITE_AUTH),
|
|
1909
|
-
/* harmony export */ SQLITE_BLOB: () => (/* binding */ SQLITE_BLOB),
|
|
1910
|
-
/* harmony export */ SQLITE_BUSY: () => (/* binding */ SQLITE_BUSY),
|
|
1911
|
-
/* harmony export */ SQLITE_CANTOPEN: () => (/* binding */ SQLITE_CANTOPEN),
|
|
1912
|
-
/* harmony export */ SQLITE_CONSTRAINT: () => (/* binding */ SQLITE_CONSTRAINT),
|
|
1913
|
-
/* harmony export */ SQLITE_CONSTRAINT_CHECK: () => (/* binding */ SQLITE_CONSTRAINT_CHECK),
|
|
1914
|
-
/* harmony export */ SQLITE_CONSTRAINT_COMMITHOOK: () => (/* binding */ SQLITE_CONSTRAINT_COMMITHOOK),
|
|
1915
|
-
/* harmony export */ SQLITE_CONSTRAINT_FOREIGNKEY: () => (/* binding */ SQLITE_CONSTRAINT_FOREIGNKEY),
|
|
1916
|
-
/* harmony export */ SQLITE_CONSTRAINT_FUNCTION: () => (/* binding */ SQLITE_CONSTRAINT_FUNCTION),
|
|
1917
|
-
/* harmony export */ SQLITE_CONSTRAINT_NOTNULL: () => (/* binding */ SQLITE_CONSTRAINT_NOTNULL),
|
|
1918
|
-
/* harmony export */ SQLITE_CONSTRAINT_PINNED: () => (/* binding */ SQLITE_CONSTRAINT_PINNED),
|
|
1919
|
-
/* harmony export */ SQLITE_CONSTRAINT_PRIMARYKEY: () => (/* binding */ SQLITE_CONSTRAINT_PRIMARYKEY),
|
|
1920
|
-
/* harmony export */ SQLITE_CONSTRAINT_ROWID: () => (/* binding */ SQLITE_CONSTRAINT_ROWID),
|
|
1921
|
-
/* harmony export */ SQLITE_CONSTRAINT_TRIGGER: () => (/* binding */ SQLITE_CONSTRAINT_TRIGGER),
|
|
1922
|
-
/* harmony export */ SQLITE_CONSTRAINT_UNIQUE: () => (/* binding */ SQLITE_CONSTRAINT_UNIQUE),
|
|
1923
|
-
/* harmony export */ SQLITE_CONSTRAINT_VTAB: () => (/* binding */ SQLITE_CONSTRAINT_VTAB),
|
|
1924
|
-
/* harmony export */ SQLITE_COPY: () => (/* binding */ SQLITE_COPY),
|
|
1925
|
-
/* harmony export */ SQLITE_CORRUPT: () => (/* binding */ SQLITE_CORRUPT),
|
|
1926
|
-
/* harmony export */ SQLITE_CREATE_INDEX: () => (/* binding */ SQLITE_CREATE_INDEX),
|
|
1927
|
-
/* harmony export */ SQLITE_CREATE_TABLE: () => (/* binding */ SQLITE_CREATE_TABLE),
|
|
1928
|
-
/* harmony export */ SQLITE_CREATE_TEMP_INDEX: () => (/* binding */ SQLITE_CREATE_TEMP_INDEX),
|
|
1929
|
-
/* harmony export */ SQLITE_CREATE_TEMP_TABLE: () => (/* binding */ SQLITE_CREATE_TEMP_TABLE),
|
|
1930
|
-
/* harmony export */ SQLITE_CREATE_TEMP_TRIGGER: () => (/* binding */ SQLITE_CREATE_TEMP_TRIGGER),
|
|
1931
|
-
/* harmony export */ SQLITE_CREATE_TEMP_VIEW: () => (/* binding */ SQLITE_CREATE_TEMP_VIEW),
|
|
1932
|
-
/* harmony export */ SQLITE_CREATE_TRIGGER: () => (/* binding */ SQLITE_CREATE_TRIGGER),
|
|
1933
|
-
/* harmony export */ SQLITE_CREATE_VIEW: () => (/* binding */ SQLITE_CREATE_VIEW),
|
|
1934
|
-
/* harmony export */ SQLITE_CREATE_VTABLE: () => (/* binding */ SQLITE_CREATE_VTABLE),
|
|
1935
|
-
/* harmony export */ SQLITE_DELETE: () => (/* binding */ SQLITE_DELETE),
|
|
1936
|
-
/* harmony export */ SQLITE_DENY: () => (/* binding */ SQLITE_DENY),
|
|
1937
|
-
/* harmony export */ SQLITE_DETACH: () => (/* binding */ SQLITE_DETACH),
|
|
1938
|
-
/* harmony export */ SQLITE_DETERMINISTIC: () => (/* binding */ SQLITE_DETERMINISTIC),
|
|
1939
|
-
/* harmony export */ SQLITE_DIRECTONLY: () => (/* binding */ SQLITE_DIRECTONLY),
|
|
1940
|
-
/* harmony export */ SQLITE_DONE: () => (/* binding */ SQLITE_DONE),
|
|
1941
|
-
/* harmony export */ SQLITE_DROP_INDEX: () => (/* binding */ SQLITE_DROP_INDEX),
|
|
1942
|
-
/* harmony export */ SQLITE_DROP_TABLE: () => (/* binding */ SQLITE_DROP_TABLE),
|
|
1943
|
-
/* harmony export */ SQLITE_DROP_TEMP_INDEX: () => (/* binding */ SQLITE_DROP_TEMP_INDEX),
|
|
1944
|
-
/* harmony export */ SQLITE_DROP_TEMP_TABLE: () => (/* binding */ SQLITE_DROP_TEMP_TABLE),
|
|
1945
|
-
/* harmony export */ SQLITE_DROP_TEMP_TRIGGER: () => (/* binding */ SQLITE_DROP_TEMP_TRIGGER),
|
|
1946
|
-
/* harmony export */ SQLITE_DROP_TEMP_VIEW: () => (/* binding */ SQLITE_DROP_TEMP_VIEW),
|
|
1947
|
-
/* harmony export */ SQLITE_DROP_TRIGGER: () => (/* binding */ SQLITE_DROP_TRIGGER),
|
|
1948
|
-
/* harmony export */ SQLITE_DROP_VIEW: () => (/* binding */ SQLITE_DROP_VIEW),
|
|
1949
|
-
/* harmony export */ SQLITE_DROP_VTABLE: () => (/* binding */ SQLITE_DROP_VTABLE),
|
|
1950
|
-
/* harmony export */ SQLITE_EMPTY: () => (/* binding */ SQLITE_EMPTY),
|
|
1951
|
-
/* harmony export */ SQLITE_ERROR: () => (/* binding */ SQLITE_ERROR),
|
|
1952
|
-
/* harmony export */ SQLITE_FCNTL_BEGIN_ATOMIC_WRITE: () => (/* binding */ SQLITE_FCNTL_BEGIN_ATOMIC_WRITE),
|
|
1953
|
-
/* harmony export */ SQLITE_FCNTL_BUSYHANDLER: () => (/* binding */ SQLITE_FCNTL_BUSYHANDLER),
|
|
1954
|
-
/* harmony export */ SQLITE_FCNTL_CHUNK_SIZE: () => (/* binding */ SQLITE_FCNTL_CHUNK_SIZE),
|
|
1955
|
-
/* harmony export */ SQLITE_FCNTL_CKPT_DONE: () => (/* binding */ SQLITE_FCNTL_CKPT_DONE),
|
|
1956
|
-
/* harmony export */ SQLITE_FCNTL_CKPT_START: () => (/* binding */ SQLITE_FCNTL_CKPT_START),
|
|
1957
|
-
/* harmony export */ SQLITE_FCNTL_COMMIT_ATOMIC_WRITE: () => (/* binding */ SQLITE_FCNTL_COMMIT_ATOMIC_WRITE),
|
|
1958
|
-
/* harmony export */ SQLITE_FCNTL_COMMIT_PHASETWO: () => (/* binding */ SQLITE_FCNTL_COMMIT_PHASETWO),
|
|
1959
|
-
/* harmony export */ SQLITE_FCNTL_DATA_VERSION: () => (/* binding */ SQLITE_FCNTL_DATA_VERSION),
|
|
1960
|
-
/* harmony export */ SQLITE_FCNTL_FILE_POINTER: () => (/* binding */ SQLITE_FCNTL_FILE_POINTER),
|
|
1961
|
-
/* harmony export */ SQLITE_FCNTL_GET_LOCKPROXYFILE: () => (/* binding */ SQLITE_FCNTL_GET_LOCKPROXYFILE),
|
|
1962
|
-
/* harmony export */ SQLITE_FCNTL_HAS_MOVED: () => (/* binding */ SQLITE_FCNTL_HAS_MOVED),
|
|
1963
|
-
/* harmony export */ SQLITE_FCNTL_JOURNAL_POINTER: () => (/* binding */ SQLITE_FCNTL_JOURNAL_POINTER),
|
|
1964
|
-
/* harmony export */ SQLITE_FCNTL_LAST_ERRNO: () => (/* binding */ SQLITE_FCNTL_LAST_ERRNO),
|
|
1965
|
-
/* harmony export */ SQLITE_FCNTL_LOCKSTATE: () => (/* binding */ SQLITE_FCNTL_LOCKSTATE),
|
|
1966
|
-
/* harmony export */ SQLITE_FCNTL_LOCK_TIMEOUT: () => (/* binding */ SQLITE_FCNTL_LOCK_TIMEOUT),
|
|
1967
|
-
/* harmony export */ SQLITE_FCNTL_MMAP_SIZE: () => (/* binding */ SQLITE_FCNTL_MMAP_SIZE),
|
|
1968
|
-
/* harmony export */ SQLITE_FCNTL_OVERWRITE: () => (/* binding */ SQLITE_FCNTL_OVERWRITE),
|
|
1969
|
-
/* harmony export */ SQLITE_FCNTL_PDB: () => (/* binding */ SQLITE_FCNTL_PDB),
|
|
1970
|
-
/* harmony export */ SQLITE_FCNTL_PERSIST_WAL: () => (/* binding */ SQLITE_FCNTL_PERSIST_WAL),
|
|
1971
|
-
/* harmony export */ SQLITE_FCNTL_POWERSAFE_OVERWRITE: () => (/* binding */ SQLITE_FCNTL_POWERSAFE_OVERWRITE),
|
|
1972
|
-
/* harmony export */ SQLITE_FCNTL_PRAGMA: () => (/* binding */ SQLITE_FCNTL_PRAGMA),
|
|
1973
|
-
/* harmony export */ SQLITE_FCNTL_RBU: () => (/* binding */ SQLITE_FCNTL_RBU),
|
|
1974
|
-
/* harmony export */ SQLITE_FCNTL_RESERVE_BYTES: () => (/* binding */ SQLITE_FCNTL_RESERVE_BYTES),
|
|
1975
|
-
/* harmony export */ SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE: () => (/* binding */ SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE),
|
|
1976
|
-
/* harmony export */ SQLITE_FCNTL_SET_LOCKPROXYFILE: () => (/* binding */ SQLITE_FCNTL_SET_LOCKPROXYFILE),
|
|
1977
|
-
/* harmony export */ SQLITE_FCNTL_SIZE_HINT: () => (/* binding */ SQLITE_FCNTL_SIZE_HINT),
|
|
1978
|
-
/* harmony export */ SQLITE_FCNTL_SIZE_LIMIT: () => (/* binding */ SQLITE_FCNTL_SIZE_LIMIT),
|
|
1979
|
-
/* harmony export */ SQLITE_FCNTL_SYNC: () => (/* binding */ SQLITE_FCNTL_SYNC),
|
|
1980
|
-
/* harmony export */ SQLITE_FCNTL_SYNC_OMITTED: () => (/* binding */ SQLITE_FCNTL_SYNC_OMITTED),
|
|
1981
|
-
/* harmony export */ SQLITE_FCNTL_TEMPFILENAME: () => (/* binding */ SQLITE_FCNTL_TEMPFILENAME),
|
|
1982
|
-
/* harmony export */ SQLITE_FCNTL_TRACE: () => (/* binding */ SQLITE_FCNTL_TRACE),
|
|
1983
|
-
/* harmony export */ SQLITE_FCNTL_VFSNAME: () => (/* binding */ SQLITE_FCNTL_VFSNAME),
|
|
1984
|
-
/* harmony export */ SQLITE_FCNTL_VFS_POINTER: () => (/* binding */ SQLITE_FCNTL_VFS_POINTER),
|
|
1985
|
-
/* harmony export */ SQLITE_FCNTL_WAL_BLOCK: () => (/* binding */ SQLITE_FCNTL_WAL_BLOCK),
|
|
1986
|
-
/* harmony export */ SQLITE_FCNTL_WIN32_AV_RETRY: () => (/* binding */ SQLITE_FCNTL_WIN32_AV_RETRY),
|
|
1987
|
-
/* harmony export */ SQLITE_FCNTL_WIN32_GET_HANDLE: () => (/* binding */ SQLITE_FCNTL_WIN32_GET_HANDLE),
|
|
1988
|
-
/* harmony export */ SQLITE_FCNTL_WIN32_SET_HANDLE: () => (/* binding */ SQLITE_FCNTL_WIN32_SET_HANDLE),
|
|
1989
|
-
/* harmony export */ SQLITE_FCNTL_ZIPVFS: () => (/* binding */ SQLITE_FCNTL_ZIPVFS),
|
|
1990
|
-
/* harmony export */ SQLITE_FLOAT: () => (/* binding */ SQLITE_FLOAT),
|
|
1991
|
-
/* harmony export */ SQLITE_FORMAT: () => (/* binding */ SQLITE_FORMAT),
|
|
1992
|
-
/* harmony export */ SQLITE_FULL: () => (/* binding */ SQLITE_FULL),
|
|
1993
|
-
/* harmony export */ SQLITE_FUNCTION: () => (/* binding */ SQLITE_FUNCTION),
|
|
1994
|
-
/* harmony export */ SQLITE_IGNORE: () => (/* binding */ SQLITE_IGNORE),
|
|
1995
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_EQ: () => (/* binding */ SQLITE_INDEX_CONSTRAINT_EQ),
|
|
1996
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_FUNCTION: () => (/* binding */ SQLITE_INDEX_CONSTRAINT_FUNCTION),
|
|
1997
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_GE: () => (/* binding */ SQLITE_INDEX_CONSTRAINT_GE),
|
|
1998
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_GLOB: () => (/* binding */ SQLITE_INDEX_CONSTRAINT_GLOB),
|
|
1999
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_GT: () => (/* binding */ SQLITE_INDEX_CONSTRAINT_GT),
|
|
2000
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_IS: () => (/* binding */ SQLITE_INDEX_CONSTRAINT_IS),
|
|
2001
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_ISNOT: () => (/* binding */ SQLITE_INDEX_CONSTRAINT_ISNOT),
|
|
2002
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_ISNOTNULL: () => (/* binding */ SQLITE_INDEX_CONSTRAINT_ISNOTNULL),
|
|
2003
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_ISNULL: () => (/* binding */ SQLITE_INDEX_CONSTRAINT_ISNULL),
|
|
2004
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_LE: () => (/* binding */ SQLITE_INDEX_CONSTRAINT_LE),
|
|
2005
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_LIKE: () => (/* binding */ SQLITE_INDEX_CONSTRAINT_LIKE),
|
|
2006
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_LT: () => (/* binding */ SQLITE_INDEX_CONSTRAINT_LT),
|
|
2007
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_MATCH: () => (/* binding */ SQLITE_INDEX_CONSTRAINT_MATCH),
|
|
2008
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_NE: () => (/* binding */ SQLITE_INDEX_CONSTRAINT_NE),
|
|
2009
|
-
/* harmony export */ SQLITE_INDEX_CONSTRAINT_REGEXP: () => (/* binding */ SQLITE_INDEX_CONSTRAINT_REGEXP),
|
|
2010
|
-
/* harmony export */ SQLITE_INDEX_SCAN_UNIQUE: () => (/* binding */ SQLITE_INDEX_SCAN_UNIQUE),
|
|
2011
|
-
/* harmony export */ SQLITE_INNOCUOUS: () => (/* binding */ SQLITE_INNOCUOUS),
|
|
2012
|
-
/* harmony export */ SQLITE_INSERT: () => (/* binding */ SQLITE_INSERT),
|
|
2013
|
-
/* harmony export */ SQLITE_INTEGER: () => (/* binding */ SQLITE_INTEGER),
|
|
2014
|
-
/* harmony export */ SQLITE_INTERNAL: () => (/* binding */ SQLITE_INTERNAL),
|
|
2015
|
-
/* harmony export */ SQLITE_INTERRUPT: () => (/* binding */ SQLITE_INTERRUPT),
|
|
2016
|
-
/* harmony export */ SQLITE_IOCAP_ATOMIC: () => (/* binding */ SQLITE_IOCAP_ATOMIC),
|
|
2017
|
-
/* harmony export */ SQLITE_IOCAP_ATOMIC16K: () => (/* binding */ SQLITE_IOCAP_ATOMIC16K),
|
|
2018
|
-
/* harmony export */ SQLITE_IOCAP_ATOMIC1K: () => (/* binding */ SQLITE_IOCAP_ATOMIC1K),
|
|
2019
|
-
/* harmony export */ SQLITE_IOCAP_ATOMIC2K: () => (/* binding */ SQLITE_IOCAP_ATOMIC2K),
|
|
2020
|
-
/* harmony export */ SQLITE_IOCAP_ATOMIC32K: () => (/* binding */ SQLITE_IOCAP_ATOMIC32K),
|
|
2021
|
-
/* harmony export */ SQLITE_IOCAP_ATOMIC4K: () => (/* binding */ SQLITE_IOCAP_ATOMIC4K),
|
|
2022
|
-
/* harmony export */ SQLITE_IOCAP_ATOMIC512: () => (/* binding */ SQLITE_IOCAP_ATOMIC512),
|
|
2023
|
-
/* harmony export */ SQLITE_IOCAP_ATOMIC64K: () => (/* binding */ SQLITE_IOCAP_ATOMIC64K),
|
|
2024
|
-
/* harmony export */ SQLITE_IOCAP_ATOMIC8K: () => (/* binding */ SQLITE_IOCAP_ATOMIC8K),
|
|
2025
|
-
/* harmony export */ SQLITE_IOCAP_BATCH_ATOMIC: () => (/* binding */ SQLITE_IOCAP_BATCH_ATOMIC),
|
|
2026
|
-
/* harmony export */ SQLITE_IOCAP_IMMUTABLE: () => (/* binding */ SQLITE_IOCAP_IMMUTABLE),
|
|
2027
|
-
/* harmony export */ SQLITE_IOCAP_POWERSAFE_OVERWRITE: () => (/* binding */ SQLITE_IOCAP_POWERSAFE_OVERWRITE),
|
|
2028
|
-
/* harmony export */ SQLITE_IOCAP_SAFE_APPEND: () => (/* binding */ SQLITE_IOCAP_SAFE_APPEND),
|
|
2029
|
-
/* harmony export */ SQLITE_IOCAP_SEQUENTIAL: () => (/* binding */ SQLITE_IOCAP_SEQUENTIAL),
|
|
2030
|
-
/* harmony export */ SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN: () => (/* binding */ SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN),
|
|
2031
|
-
/* harmony export */ SQLITE_IOERR: () => (/* binding */ SQLITE_IOERR),
|
|
2032
|
-
/* harmony export */ SQLITE_IOERR_ACCESS: () => (/* binding */ SQLITE_IOERR_ACCESS),
|
|
2033
|
-
/* harmony export */ SQLITE_IOERR_BEGIN_ATOMIC: () => (/* binding */ SQLITE_IOERR_BEGIN_ATOMIC),
|
|
2034
|
-
/* harmony export */ SQLITE_IOERR_CHECKRESERVEDLOCK: () => (/* binding */ SQLITE_IOERR_CHECKRESERVEDLOCK),
|
|
2035
|
-
/* harmony export */ SQLITE_IOERR_CLOSE: () => (/* binding */ SQLITE_IOERR_CLOSE),
|
|
2036
|
-
/* harmony export */ SQLITE_IOERR_COMMIT_ATOMIC: () => (/* binding */ SQLITE_IOERR_COMMIT_ATOMIC),
|
|
2037
|
-
/* harmony export */ SQLITE_IOERR_DATA: () => (/* binding */ SQLITE_IOERR_DATA),
|
|
2038
|
-
/* harmony export */ SQLITE_IOERR_DELETE: () => (/* binding */ SQLITE_IOERR_DELETE),
|
|
2039
|
-
/* harmony export */ SQLITE_IOERR_DELETE_NOENT: () => (/* binding */ SQLITE_IOERR_DELETE_NOENT),
|
|
2040
|
-
/* harmony export */ SQLITE_IOERR_DIR_FSYNC: () => (/* binding */ SQLITE_IOERR_DIR_FSYNC),
|
|
2041
|
-
/* harmony export */ SQLITE_IOERR_FSTAT: () => (/* binding */ SQLITE_IOERR_FSTAT),
|
|
2042
|
-
/* harmony export */ SQLITE_IOERR_FSYNC: () => (/* binding */ SQLITE_IOERR_FSYNC),
|
|
2043
|
-
/* harmony export */ SQLITE_IOERR_GETTEMPPATH: () => (/* binding */ SQLITE_IOERR_GETTEMPPATH),
|
|
2044
|
-
/* harmony export */ SQLITE_IOERR_LOCK: () => (/* binding */ SQLITE_IOERR_LOCK),
|
|
2045
|
-
/* harmony export */ SQLITE_IOERR_NOMEM: () => (/* binding */ SQLITE_IOERR_NOMEM),
|
|
2046
|
-
/* harmony export */ SQLITE_IOERR_RDLOCK: () => (/* binding */ SQLITE_IOERR_RDLOCK),
|
|
2047
|
-
/* harmony export */ SQLITE_IOERR_READ: () => (/* binding */ SQLITE_IOERR_READ),
|
|
2048
|
-
/* harmony export */ SQLITE_IOERR_ROLLBACK_ATOMIC: () => (/* binding */ SQLITE_IOERR_ROLLBACK_ATOMIC),
|
|
2049
|
-
/* harmony export */ SQLITE_IOERR_SEEK: () => (/* binding */ SQLITE_IOERR_SEEK),
|
|
2050
|
-
/* harmony export */ SQLITE_IOERR_SHORT_READ: () => (/* binding */ SQLITE_IOERR_SHORT_READ),
|
|
2051
|
-
/* harmony export */ SQLITE_IOERR_TRUNCATE: () => (/* binding */ SQLITE_IOERR_TRUNCATE),
|
|
2052
|
-
/* harmony export */ SQLITE_IOERR_UNLOCK: () => (/* binding */ SQLITE_IOERR_UNLOCK),
|
|
2053
|
-
/* harmony export */ SQLITE_IOERR_VNODE: () => (/* binding */ SQLITE_IOERR_VNODE),
|
|
2054
|
-
/* harmony export */ SQLITE_IOERR_WRITE: () => (/* binding */ SQLITE_IOERR_WRITE),
|
|
2055
|
-
/* harmony export */ SQLITE_LIMIT_ATTACHED: () => (/* binding */ SQLITE_LIMIT_ATTACHED),
|
|
2056
|
-
/* harmony export */ SQLITE_LIMIT_COLUMN: () => (/* binding */ SQLITE_LIMIT_COLUMN),
|
|
2057
|
-
/* harmony export */ SQLITE_LIMIT_COMPOUND_SELECT: () => (/* binding */ SQLITE_LIMIT_COMPOUND_SELECT),
|
|
2058
|
-
/* harmony export */ SQLITE_LIMIT_EXPR_DEPTH: () => (/* binding */ SQLITE_LIMIT_EXPR_DEPTH),
|
|
2059
|
-
/* harmony export */ SQLITE_LIMIT_FUNCTION_ARG: () => (/* binding */ SQLITE_LIMIT_FUNCTION_ARG),
|
|
2060
|
-
/* harmony export */ SQLITE_LIMIT_LENGTH: () => (/* binding */ SQLITE_LIMIT_LENGTH),
|
|
2061
|
-
/* harmony export */ SQLITE_LIMIT_LIKE_PATTERN_LENGTH: () => (/* binding */ SQLITE_LIMIT_LIKE_PATTERN_LENGTH),
|
|
2062
|
-
/* harmony export */ SQLITE_LIMIT_SQL_LENGTH: () => (/* binding */ SQLITE_LIMIT_SQL_LENGTH),
|
|
2063
|
-
/* harmony export */ SQLITE_LIMIT_TRIGGER_DEPTH: () => (/* binding */ SQLITE_LIMIT_TRIGGER_DEPTH),
|
|
2064
|
-
/* harmony export */ SQLITE_LIMIT_VARIABLE_NUMBER: () => (/* binding */ SQLITE_LIMIT_VARIABLE_NUMBER),
|
|
2065
|
-
/* harmony export */ SQLITE_LIMIT_VDBE_OP: () => (/* binding */ SQLITE_LIMIT_VDBE_OP),
|
|
2066
|
-
/* harmony export */ SQLITE_LIMIT_WORKER_THREADS: () => (/* binding */ SQLITE_LIMIT_WORKER_THREADS),
|
|
2067
|
-
/* harmony export */ SQLITE_LOCKED: () => (/* binding */ SQLITE_LOCKED),
|
|
2068
|
-
/* harmony export */ SQLITE_LOCK_EXCLUSIVE: () => (/* binding */ SQLITE_LOCK_EXCLUSIVE),
|
|
2069
|
-
/* harmony export */ SQLITE_LOCK_NONE: () => (/* binding */ SQLITE_LOCK_NONE),
|
|
2070
|
-
/* harmony export */ SQLITE_LOCK_PENDING: () => (/* binding */ SQLITE_LOCK_PENDING),
|
|
2071
|
-
/* harmony export */ SQLITE_LOCK_RESERVED: () => (/* binding */ SQLITE_LOCK_RESERVED),
|
|
2072
|
-
/* harmony export */ SQLITE_LOCK_SHARED: () => (/* binding */ SQLITE_LOCK_SHARED),
|
|
2073
|
-
/* harmony export */ SQLITE_MISMATCH: () => (/* binding */ SQLITE_MISMATCH),
|
|
2074
|
-
/* harmony export */ SQLITE_MISUSE: () => (/* binding */ SQLITE_MISUSE),
|
|
2075
|
-
/* harmony export */ SQLITE_NOLFS: () => (/* binding */ SQLITE_NOLFS),
|
|
2076
|
-
/* harmony export */ SQLITE_NOMEM: () => (/* binding */ SQLITE_NOMEM),
|
|
2077
|
-
/* harmony export */ SQLITE_NOTADB: () => (/* binding */ SQLITE_NOTADB),
|
|
2078
|
-
/* harmony export */ SQLITE_NOTFOUND: () => (/* binding */ SQLITE_NOTFOUND),
|
|
2079
|
-
/* harmony export */ SQLITE_NOTICE: () => (/* binding */ SQLITE_NOTICE),
|
|
2080
|
-
/* harmony export */ SQLITE_NULL: () => (/* binding */ SQLITE_NULL),
|
|
2081
|
-
/* harmony export */ SQLITE_OK: () => (/* binding */ SQLITE_OK),
|
|
2082
|
-
/* harmony export */ SQLITE_OPEN_AUTOPROXY: () => (/* binding */ SQLITE_OPEN_AUTOPROXY),
|
|
2083
|
-
/* harmony export */ SQLITE_OPEN_CREATE: () => (/* binding */ SQLITE_OPEN_CREATE),
|
|
2084
|
-
/* harmony export */ SQLITE_OPEN_DELETEONCLOSE: () => (/* binding */ SQLITE_OPEN_DELETEONCLOSE),
|
|
2085
|
-
/* harmony export */ SQLITE_OPEN_EXCLUSIVE: () => (/* binding */ SQLITE_OPEN_EXCLUSIVE),
|
|
2086
|
-
/* harmony export */ SQLITE_OPEN_FULLMUTEX: () => (/* binding */ SQLITE_OPEN_FULLMUTEX),
|
|
2087
|
-
/* harmony export */ SQLITE_OPEN_MAIN_DB: () => (/* binding */ SQLITE_OPEN_MAIN_DB),
|
|
2088
|
-
/* harmony export */ SQLITE_OPEN_MAIN_JOURNAL: () => (/* binding */ SQLITE_OPEN_MAIN_JOURNAL),
|
|
2089
|
-
/* harmony export */ SQLITE_OPEN_MEMORY: () => (/* binding */ SQLITE_OPEN_MEMORY),
|
|
2090
|
-
/* harmony export */ SQLITE_OPEN_NOFOLLOW: () => (/* binding */ SQLITE_OPEN_NOFOLLOW),
|
|
2091
|
-
/* harmony export */ SQLITE_OPEN_NOMUTEX: () => (/* binding */ SQLITE_OPEN_NOMUTEX),
|
|
2092
|
-
/* harmony export */ SQLITE_OPEN_PRIVATECACHE: () => (/* binding */ SQLITE_OPEN_PRIVATECACHE),
|
|
2093
|
-
/* harmony export */ SQLITE_OPEN_READONLY: () => (/* binding */ SQLITE_OPEN_READONLY),
|
|
2094
|
-
/* harmony export */ SQLITE_OPEN_READWRITE: () => (/* binding */ SQLITE_OPEN_READWRITE),
|
|
2095
|
-
/* harmony export */ SQLITE_OPEN_SHAREDCACHE: () => (/* binding */ SQLITE_OPEN_SHAREDCACHE),
|
|
2096
|
-
/* harmony export */ SQLITE_OPEN_SUBJOURNAL: () => (/* binding */ SQLITE_OPEN_SUBJOURNAL),
|
|
2097
|
-
/* harmony export */ SQLITE_OPEN_SUPER_JOURNAL: () => (/* binding */ SQLITE_OPEN_SUPER_JOURNAL),
|
|
2098
|
-
/* harmony export */ SQLITE_OPEN_TEMP_DB: () => (/* binding */ SQLITE_OPEN_TEMP_DB),
|
|
2099
|
-
/* harmony export */ SQLITE_OPEN_TEMP_JOURNAL: () => (/* binding */ SQLITE_OPEN_TEMP_JOURNAL),
|
|
2100
|
-
/* harmony export */ SQLITE_OPEN_TRANSIENT_DB: () => (/* binding */ SQLITE_OPEN_TRANSIENT_DB),
|
|
2101
|
-
/* harmony export */ SQLITE_OPEN_URI: () => (/* binding */ SQLITE_OPEN_URI),
|
|
2102
|
-
/* harmony export */ SQLITE_OPEN_WAL: () => (/* binding */ SQLITE_OPEN_WAL),
|
|
2103
|
-
/* harmony export */ SQLITE_PERM: () => (/* binding */ SQLITE_PERM),
|
|
2104
|
-
/* harmony export */ SQLITE_PRAGMA: () => (/* binding */ SQLITE_PRAGMA),
|
|
2105
|
-
/* harmony export */ SQLITE_PREPARE_NORMALIZED: () => (/* binding */ SQLITE_PREPARE_NORMALIZED),
|
|
2106
|
-
/* harmony export */ SQLITE_PREPARE_NO_VTAB: () => (/* binding */ SQLITE_PREPARE_NO_VTAB),
|
|
2107
|
-
/* harmony export */ SQLITE_PREPARE_PERSISTENT: () => (/* binding */ SQLITE_PREPARE_PERSISTENT),
|
|
2108
|
-
/* harmony export */ SQLITE_PROTOCOL: () => (/* binding */ SQLITE_PROTOCOL),
|
|
2109
|
-
/* harmony export */ SQLITE_RANGE: () => (/* binding */ SQLITE_RANGE),
|
|
2110
|
-
/* harmony export */ SQLITE_READ: () => (/* binding */ SQLITE_READ),
|
|
2111
|
-
/* harmony export */ SQLITE_READONLY: () => (/* binding */ SQLITE_READONLY),
|
|
2112
|
-
/* harmony export */ SQLITE_RECURSIVE: () => (/* binding */ SQLITE_RECURSIVE),
|
|
2113
|
-
/* harmony export */ SQLITE_REINDEX: () => (/* binding */ SQLITE_REINDEX),
|
|
2114
|
-
/* harmony export */ SQLITE_ROW: () => (/* binding */ SQLITE_ROW),
|
|
2115
|
-
/* harmony export */ SQLITE_SAVEPOINT: () => (/* binding */ SQLITE_SAVEPOINT),
|
|
2116
|
-
/* harmony export */ SQLITE_SCHEMA: () => (/* binding */ SQLITE_SCHEMA),
|
|
2117
|
-
/* harmony export */ SQLITE_SELECT: () => (/* binding */ SQLITE_SELECT),
|
|
2118
|
-
/* harmony export */ SQLITE_STATIC: () => (/* binding */ SQLITE_STATIC),
|
|
2119
|
-
/* harmony export */ SQLITE_SUBTYPE: () => (/* binding */ SQLITE_SUBTYPE),
|
|
2120
|
-
/* harmony export */ SQLITE_SYNC_DATAONLY: () => (/* binding */ SQLITE_SYNC_DATAONLY),
|
|
2121
|
-
/* harmony export */ SQLITE_SYNC_FULL: () => (/* binding */ SQLITE_SYNC_FULL),
|
|
2122
|
-
/* harmony export */ SQLITE_SYNC_NORMAL: () => (/* binding */ SQLITE_SYNC_NORMAL),
|
|
2123
|
-
/* harmony export */ SQLITE_TEXT: () => (/* binding */ SQLITE_TEXT),
|
|
2124
|
-
/* harmony export */ SQLITE_TOOBIG: () => (/* binding */ SQLITE_TOOBIG),
|
|
2125
|
-
/* harmony export */ SQLITE_TRANSACTION: () => (/* binding */ SQLITE_TRANSACTION),
|
|
2126
|
-
/* harmony export */ SQLITE_TRANSIENT: () => (/* binding */ SQLITE_TRANSIENT),
|
|
2127
|
-
/* harmony export */ SQLITE_UPDATE: () => (/* binding */ SQLITE_UPDATE),
|
|
2128
|
-
/* harmony export */ SQLITE_UTF16: () => (/* binding */ SQLITE_UTF16),
|
|
2129
|
-
/* harmony export */ SQLITE_UTF16BE: () => (/* binding */ SQLITE_UTF16BE),
|
|
2130
|
-
/* harmony export */ SQLITE_UTF16LE: () => (/* binding */ SQLITE_UTF16LE),
|
|
2131
|
-
/* harmony export */ SQLITE_UTF8: () => (/* binding */ SQLITE_UTF8),
|
|
2132
|
-
/* harmony export */ SQLITE_WARNING: () => (/* binding */ SQLITE_WARNING)
|
|
2133
|
-
/* harmony export */ });
|
|
2134
|
-
// Primary result codes.
|
|
2135
|
-
// https://www.sqlite.org/rescode.html
|
|
2136
|
-
const SQLITE_OK = 0;
|
|
2137
|
-
const SQLITE_ERROR = 1;
|
|
2138
|
-
const SQLITE_INTERNAL = 2;
|
|
2139
|
-
const SQLITE_PERM = 3;
|
|
2140
|
-
const SQLITE_ABORT = 4;
|
|
2141
|
-
const SQLITE_BUSY = 5;
|
|
2142
|
-
const SQLITE_LOCKED = 6;
|
|
2143
|
-
const SQLITE_NOMEM = 7;
|
|
2144
|
-
const SQLITE_READONLY = 8;
|
|
2145
|
-
const SQLITE_INTERRUPT = 9;
|
|
2146
|
-
const SQLITE_IOERR = 10;
|
|
2147
|
-
const SQLITE_CORRUPT = 11;
|
|
2148
|
-
const SQLITE_NOTFOUND = 12;
|
|
2149
|
-
const SQLITE_FULL = 13;
|
|
2150
|
-
const SQLITE_CANTOPEN = 14;
|
|
2151
|
-
const SQLITE_PROTOCOL = 15;
|
|
2152
|
-
const SQLITE_EMPTY = 16;
|
|
2153
|
-
const SQLITE_SCHEMA = 17;
|
|
2154
|
-
const SQLITE_TOOBIG = 18;
|
|
2155
|
-
const SQLITE_CONSTRAINT = 19;
|
|
2156
|
-
const SQLITE_MISMATCH = 20;
|
|
2157
|
-
const SQLITE_MISUSE = 21;
|
|
2158
|
-
const SQLITE_NOLFS = 22;
|
|
2159
|
-
const SQLITE_AUTH = 23;
|
|
2160
|
-
const SQLITE_FORMAT = 24;
|
|
2161
|
-
const SQLITE_RANGE = 25;
|
|
2162
|
-
const SQLITE_NOTADB = 26;
|
|
2163
|
-
const SQLITE_NOTICE = 27;
|
|
2164
|
-
const SQLITE_WARNING = 28;
|
|
2165
|
-
const SQLITE_ROW = 100;
|
|
2166
|
-
const SQLITE_DONE = 101;
|
|
2167
|
-
|
|
2168
|
-
// Extended error codes.
|
|
2169
|
-
const SQLITE_IOERR_ACCESS = 3338;
|
|
2170
|
-
const SQLITE_IOERR_CHECKRESERVEDLOCK = 3594;
|
|
2171
|
-
const SQLITE_IOERR_CLOSE = 4106;
|
|
2172
|
-
const SQLITE_IOERR_DATA = 8202;
|
|
2173
|
-
const SQLITE_IOERR_DELETE = 2570;
|
|
2174
|
-
const SQLITE_IOERR_DELETE_NOENT = 5898;
|
|
2175
|
-
const SQLITE_IOERR_DIR_FSYNC = 1290;
|
|
2176
|
-
const SQLITE_IOERR_FSTAT = 1802;
|
|
2177
|
-
const SQLITE_IOERR_FSYNC = 1034;
|
|
2178
|
-
const SQLITE_IOERR_GETTEMPPATH = 6410;
|
|
2179
|
-
const SQLITE_IOERR_LOCK = 3850;
|
|
2180
|
-
const SQLITE_IOERR_NOMEM = 3082;
|
|
2181
|
-
const SQLITE_IOERR_READ = 266;
|
|
2182
|
-
const SQLITE_IOERR_RDLOCK = 2314;
|
|
2183
|
-
const SQLITE_IOERR_SEEK = 5642;
|
|
2184
|
-
const SQLITE_IOERR_SHORT_READ = 522;
|
|
2185
|
-
const SQLITE_IOERR_TRUNCATE = 1546;
|
|
2186
|
-
const SQLITE_IOERR_UNLOCK = 2058;
|
|
2187
|
-
const SQLITE_IOERR_VNODE = 6922;
|
|
2188
|
-
const SQLITE_IOERR_WRITE = 778;
|
|
2189
|
-
const SQLITE_IOERR_BEGIN_ATOMIC = 7434;
|
|
2190
|
-
const SQLITE_IOERR_COMMIT_ATOMIC = 7690;
|
|
2191
|
-
const SQLITE_IOERR_ROLLBACK_ATOMIC = 7946;
|
|
2192
|
-
|
|
2193
|
-
// Other extended result codes.
|
|
2194
|
-
const SQLITE_CONSTRAINT_CHECK = 275;
|
|
2195
|
-
const SQLITE_CONSTRAINT_COMMITHOOK = 531;
|
|
2196
|
-
const SQLITE_CONSTRAINT_FOREIGNKEY = 787;
|
|
2197
|
-
const SQLITE_CONSTRAINT_FUNCTION = 1043;
|
|
2198
|
-
const SQLITE_CONSTRAINT_NOTNULL = 1299;
|
|
2199
|
-
const SQLITE_CONSTRAINT_PINNED = 2835;
|
|
2200
|
-
const SQLITE_CONSTRAINT_PRIMARYKEY = 1555;
|
|
2201
|
-
const SQLITE_CONSTRAINT_ROWID = 2579;
|
|
2202
|
-
const SQLITE_CONSTRAINT_TRIGGER = 1811;
|
|
2203
|
-
const SQLITE_CONSTRAINT_UNIQUE = 2067;
|
|
2204
|
-
const SQLITE_CONSTRAINT_VTAB = 2323;
|
|
2205
|
-
|
|
2206
|
-
// Open flags.
|
|
2207
|
-
// https://www.sqlite.org/c3ref/c_open_autoproxy.html
|
|
2208
|
-
const SQLITE_OPEN_READONLY = 0x00000001;
|
|
2209
|
-
const SQLITE_OPEN_READWRITE = 0x00000002;
|
|
2210
|
-
const SQLITE_OPEN_CREATE = 0x00000004;
|
|
2211
|
-
const SQLITE_OPEN_DELETEONCLOSE = 0x00000008;
|
|
2212
|
-
const SQLITE_OPEN_EXCLUSIVE = 0x00000010;
|
|
2213
|
-
const SQLITE_OPEN_AUTOPROXY = 0x00000020;
|
|
2214
|
-
const SQLITE_OPEN_URI = 0x00000040;
|
|
2215
|
-
const SQLITE_OPEN_MEMORY = 0x00000080;
|
|
2216
|
-
const SQLITE_OPEN_MAIN_DB = 0x00000100;
|
|
2217
|
-
const SQLITE_OPEN_TEMP_DB = 0x00000200;
|
|
2218
|
-
const SQLITE_OPEN_TRANSIENT_DB = 0x00000400;
|
|
2219
|
-
const SQLITE_OPEN_MAIN_JOURNAL = 0x00000800;
|
|
2220
|
-
const SQLITE_OPEN_TEMP_JOURNAL = 0x00001000;
|
|
2221
|
-
const SQLITE_OPEN_SUBJOURNAL = 0x00002000;
|
|
2222
|
-
const SQLITE_OPEN_SUPER_JOURNAL = 0x00004000;
|
|
2223
|
-
const SQLITE_OPEN_NOMUTEX = 0x00008000;
|
|
2224
|
-
const SQLITE_OPEN_FULLMUTEX = 0x00010000;
|
|
2225
|
-
const SQLITE_OPEN_SHAREDCACHE = 0x00020000;
|
|
2226
|
-
const SQLITE_OPEN_PRIVATECACHE = 0x00040000;
|
|
2227
|
-
const SQLITE_OPEN_WAL = 0x00080000;
|
|
2228
|
-
const SQLITE_OPEN_NOFOLLOW = 0x01000000;
|
|
2229
|
-
|
|
2230
|
-
// Locking levels.
|
|
2231
|
-
// https://www.sqlite.org/c3ref/c_lock_exclusive.html
|
|
2232
|
-
const SQLITE_LOCK_NONE = 0;
|
|
2233
|
-
const SQLITE_LOCK_SHARED = 1;
|
|
2234
|
-
const SQLITE_LOCK_RESERVED = 2;
|
|
2235
|
-
const SQLITE_LOCK_PENDING = 3;
|
|
2236
|
-
const SQLITE_LOCK_EXCLUSIVE = 4;
|
|
2237
|
-
|
|
2238
|
-
// Device characteristics.
|
|
2239
|
-
// https://www.sqlite.org/c3ref/c_iocap_atomic.html
|
|
2240
|
-
const SQLITE_IOCAP_ATOMIC = 0x00000001;
|
|
2241
|
-
const SQLITE_IOCAP_ATOMIC512 = 0x00000002;
|
|
2242
|
-
const SQLITE_IOCAP_ATOMIC1K = 0x00000004;
|
|
2243
|
-
const SQLITE_IOCAP_ATOMIC2K = 0x00000008;
|
|
2244
|
-
const SQLITE_IOCAP_ATOMIC4K = 0x00000010;
|
|
2245
|
-
const SQLITE_IOCAP_ATOMIC8K = 0x00000020;
|
|
2246
|
-
const SQLITE_IOCAP_ATOMIC16K = 0x00000040;
|
|
2247
|
-
const SQLITE_IOCAP_ATOMIC32K = 0x00000080;
|
|
2248
|
-
const SQLITE_IOCAP_ATOMIC64K = 0x00000100;
|
|
2249
|
-
const SQLITE_IOCAP_SAFE_APPEND = 0x00000200;
|
|
2250
|
-
const SQLITE_IOCAP_SEQUENTIAL = 0x00000400;
|
|
2251
|
-
const SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN = 0x00000800;
|
|
2252
|
-
const SQLITE_IOCAP_POWERSAFE_OVERWRITE = 0x00001000;
|
|
2253
|
-
const SQLITE_IOCAP_IMMUTABLE = 0x00002000;
|
|
2254
|
-
const SQLITE_IOCAP_BATCH_ATOMIC = 0x00004000;
|
|
2255
|
-
|
|
2256
|
-
// xAccess flags.
|
|
2257
|
-
// https://www.sqlite.org/c3ref/c_access_exists.html
|
|
2258
|
-
const SQLITE_ACCESS_EXISTS = 0;
|
|
2259
|
-
const SQLITE_ACCESS_READWRITE = 1;
|
|
2260
|
-
const SQLITE_ACCESS_READ = 2;
|
|
2261
|
-
|
|
2262
|
-
// File control opcodes
|
|
2263
|
-
// https://www.sqlite.org/c3ref/c_fcntl_begin_atomic_write.html#sqlitefcntlbeginatomicwrite
|
|
2264
|
-
const SQLITE_FCNTL_LOCKSTATE = 1;
|
|
2265
|
-
const SQLITE_FCNTL_GET_LOCKPROXYFILE = 2;
|
|
2266
|
-
const SQLITE_FCNTL_SET_LOCKPROXYFILE = 3;
|
|
2267
|
-
const SQLITE_FCNTL_LAST_ERRNO = 4;
|
|
2268
|
-
const SQLITE_FCNTL_SIZE_HINT = 5;
|
|
2269
|
-
const SQLITE_FCNTL_CHUNK_SIZE = 6;
|
|
2270
|
-
const SQLITE_FCNTL_FILE_POINTER = 7;
|
|
2271
|
-
const SQLITE_FCNTL_SYNC_OMITTED = 8;
|
|
2272
|
-
const SQLITE_FCNTL_WIN32_AV_RETRY = 9;
|
|
2273
|
-
const SQLITE_FCNTL_PERSIST_WAL = 10;
|
|
2274
|
-
const SQLITE_FCNTL_OVERWRITE = 11;
|
|
2275
|
-
const SQLITE_FCNTL_VFSNAME = 12;
|
|
2276
|
-
const SQLITE_FCNTL_POWERSAFE_OVERWRITE = 13;
|
|
2277
|
-
const SQLITE_FCNTL_PRAGMA = 14;
|
|
2278
|
-
const SQLITE_FCNTL_BUSYHANDLER = 15;
|
|
2279
|
-
const SQLITE_FCNTL_TEMPFILENAME = 16;
|
|
2280
|
-
const SQLITE_FCNTL_MMAP_SIZE = 18;
|
|
2281
|
-
const SQLITE_FCNTL_TRACE = 19;
|
|
2282
|
-
const SQLITE_FCNTL_HAS_MOVED = 20;
|
|
2283
|
-
const SQLITE_FCNTL_SYNC = 21;
|
|
2284
|
-
const SQLITE_FCNTL_COMMIT_PHASETWO = 22;
|
|
2285
|
-
const SQLITE_FCNTL_WIN32_SET_HANDLE = 23;
|
|
2286
|
-
const SQLITE_FCNTL_WAL_BLOCK = 24;
|
|
2287
|
-
const SQLITE_FCNTL_ZIPVFS = 25;
|
|
2288
|
-
const SQLITE_FCNTL_RBU = 26;
|
|
2289
|
-
const SQLITE_FCNTL_VFS_POINTER = 27;
|
|
2290
|
-
const SQLITE_FCNTL_JOURNAL_POINTER = 28;
|
|
2291
|
-
const SQLITE_FCNTL_WIN32_GET_HANDLE = 29;
|
|
2292
|
-
const SQLITE_FCNTL_PDB = 30;
|
|
2293
|
-
const SQLITE_FCNTL_BEGIN_ATOMIC_WRITE = 31;
|
|
2294
|
-
const SQLITE_FCNTL_COMMIT_ATOMIC_WRITE = 32;
|
|
2295
|
-
const SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE = 33;
|
|
2296
|
-
const SQLITE_FCNTL_LOCK_TIMEOUT = 34;
|
|
2297
|
-
const SQLITE_FCNTL_DATA_VERSION = 35;
|
|
2298
|
-
const SQLITE_FCNTL_SIZE_LIMIT = 36;
|
|
2299
|
-
const SQLITE_FCNTL_CKPT_DONE = 37;
|
|
2300
|
-
const SQLITE_FCNTL_RESERVE_BYTES = 38;
|
|
2301
|
-
const SQLITE_FCNTL_CKPT_START = 39;
|
|
2302
|
-
|
|
2303
|
-
// Fundamental datatypes.
|
|
2304
|
-
// https://www.sqlite.org/c3ref/c_blob.html
|
|
2305
|
-
const SQLITE_INTEGER = 1;
|
|
2306
|
-
const SQLITE_FLOAT = 2;
|
|
2307
|
-
const SQLITE_TEXT = 3;
|
|
2308
|
-
const SQLITE_BLOB = 4;
|
|
2309
|
-
const SQLITE_NULL = 5;
|
|
2310
|
-
|
|
2311
|
-
// Special destructor behavior.
|
|
2312
|
-
// https://www.sqlite.org/c3ref/c_static.html
|
|
2313
|
-
const SQLITE_STATIC = 0;
|
|
2314
|
-
const SQLITE_TRANSIENT = -1;
|
|
2315
|
-
|
|
2316
|
-
// Text encodings.
|
|
2317
|
-
// https://sqlite.org/c3ref/c_any.html
|
|
2318
|
-
const SQLITE_UTF8 = 1; /* IMP: R-37514-35566 */
|
|
2319
|
-
const SQLITE_UTF16LE = 2; /* IMP: R-03371-37637 */
|
|
2320
|
-
const SQLITE_UTF16BE = 3; /* IMP: R-51971-34154 */
|
|
2321
|
-
const SQLITE_UTF16 = 4; /* Use native byte order */
|
|
2322
|
-
|
|
2323
|
-
// Module constraint ops.
|
|
2324
|
-
const SQLITE_INDEX_CONSTRAINT_EQ = 2;
|
|
2325
|
-
const SQLITE_INDEX_CONSTRAINT_GT = 4;
|
|
2326
|
-
const SQLITE_INDEX_CONSTRAINT_LE = 8;
|
|
2327
|
-
const SQLITE_INDEX_CONSTRAINT_LT = 16;
|
|
2328
|
-
const SQLITE_INDEX_CONSTRAINT_GE = 32;
|
|
2329
|
-
const SQLITE_INDEX_CONSTRAINT_MATCH = 64;
|
|
2330
|
-
const SQLITE_INDEX_CONSTRAINT_LIKE = 65;
|
|
2331
|
-
const SQLITE_INDEX_CONSTRAINT_GLOB = 66;
|
|
2332
|
-
const SQLITE_INDEX_CONSTRAINT_REGEXP = 67;
|
|
2333
|
-
const SQLITE_INDEX_CONSTRAINT_NE = 68;
|
|
2334
|
-
const SQLITE_INDEX_CONSTRAINT_ISNOT = 69;
|
|
2335
|
-
const SQLITE_INDEX_CONSTRAINT_ISNOTNULL = 70;
|
|
2336
|
-
const SQLITE_INDEX_CONSTRAINT_ISNULL = 71;
|
|
2337
|
-
const SQLITE_INDEX_CONSTRAINT_IS = 72;
|
|
2338
|
-
const SQLITE_INDEX_CONSTRAINT_FUNCTION = 150;
|
|
2339
|
-
const SQLITE_INDEX_SCAN_UNIQUE = 1; /* Scan visits at most = 1 row */
|
|
2340
|
-
|
|
2341
|
-
// Function flags
|
|
2342
|
-
const SQLITE_DETERMINISTIC = 0x000000800;
|
|
2343
|
-
const SQLITE_DIRECTONLY = 0x000080000;
|
|
2344
|
-
const SQLITE_SUBTYPE = 0x000100000;
|
|
2345
|
-
const SQLITE_INNOCUOUS = 0x000200000;
|
|
2346
|
-
|
|
2347
|
-
// Sync flags
|
|
2348
|
-
const SQLITE_SYNC_NORMAL = 0x00002;
|
|
2349
|
-
const SQLITE_SYNC_FULL = 0x00003;
|
|
2350
|
-
const SQLITE_SYNC_DATAONLY = 0x00010;
|
|
2351
|
-
|
|
2352
|
-
// Authorizer action codes
|
|
2353
|
-
const SQLITE_CREATE_INDEX = 1;
|
|
2354
|
-
const SQLITE_CREATE_TABLE = 2;
|
|
2355
|
-
const SQLITE_CREATE_TEMP_INDEX = 3;
|
|
2356
|
-
const SQLITE_CREATE_TEMP_TABLE = 4;
|
|
2357
|
-
const SQLITE_CREATE_TEMP_TRIGGER = 5;
|
|
2358
|
-
const SQLITE_CREATE_TEMP_VIEW = 6;
|
|
2359
|
-
const SQLITE_CREATE_TRIGGER = 7;
|
|
2360
|
-
const SQLITE_CREATE_VIEW = 8;
|
|
2361
|
-
const SQLITE_DELETE = 9;
|
|
2362
|
-
const SQLITE_DROP_INDEX = 10;
|
|
2363
|
-
const SQLITE_DROP_TABLE = 11;
|
|
2364
|
-
const SQLITE_DROP_TEMP_INDEX = 12;
|
|
2365
|
-
const SQLITE_DROP_TEMP_TABLE = 13;
|
|
2366
|
-
const SQLITE_DROP_TEMP_TRIGGER = 14;
|
|
2367
|
-
const SQLITE_DROP_TEMP_VIEW = 15;
|
|
2368
|
-
const SQLITE_DROP_TRIGGER = 16;
|
|
2369
|
-
const SQLITE_DROP_VIEW = 17;
|
|
2370
|
-
const SQLITE_INSERT = 18;
|
|
2371
|
-
const SQLITE_PRAGMA = 19;
|
|
2372
|
-
const SQLITE_READ = 20;
|
|
2373
|
-
const SQLITE_SELECT = 21;
|
|
2374
|
-
const SQLITE_TRANSACTION = 22;
|
|
2375
|
-
const SQLITE_UPDATE = 23;
|
|
2376
|
-
const SQLITE_ATTACH = 24;
|
|
2377
|
-
const SQLITE_DETACH = 25;
|
|
2378
|
-
const SQLITE_ALTER_TABLE = 26;
|
|
2379
|
-
const SQLITE_REINDEX = 27;
|
|
2380
|
-
const SQLITE_ANALYZE = 28;
|
|
2381
|
-
const SQLITE_CREATE_VTABLE = 29;
|
|
2382
|
-
const SQLITE_DROP_VTABLE = 30;
|
|
2383
|
-
const SQLITE_FUNCTION = 31;
|
|
2384
|
-
const SQLITE_SAVEPOINT = 32;
|
|
2385
|
-
const SQLITE_COPY = 0;
|
|
2386
|
-
const SQLITE_RECURSIVE = 33;
|
|
2387
|
-
|
|
2388
|
-
// Authorizer return codes
|
|
2389
|
-
const SQLITE_DENY = 1;
|
|
2390
|
-
const SQLITE_IGNORE = 2;
|
|
2391
|
-
|
|
2392
|
-
// Limit categories
|
|
2393
|
-
const SQLITE_LIMIT_LENGTH = 0;
|
|
2394
|
-
const SQLITE_LIMIT_SQL_LENGTH = 1;
|
|
2395
|
-
const SQLITE_LIMIT_COLUMN = 2;
|
|
2396
|
-
const SQLITE_LIMIT_EXPR_DEPTH = 3;
|
|
2397
|
-
const SQLITE_LIMIT_COMPOUND_SELECT = 4;
|
|
2398
|
-
const SQLITE_LIMIT_VDBE_OP = 5;
|
|
2399
|
-
const SQLITE_LIMIT_FUNCTION_ARG = 6;
|
|
2400
|
-
const SQLITE_LIMIT_ATTACHED = 7;
|
|
2401
|
-
const SQLITE_LIMIT_LIKE_PATTERN_LENGTH = 8;
|
|
2402
|
-
const SQLITE_LIMIT_VARIABLE_NUMBER = 9;
|
|
2403
|
-
const SQLITE_LIMIT_TRIGGER_DEPTH = 10;
|
|
2404
|
-
const SQLITE_LIMIT_WORKER_THREADS = 11;
|
|
2405
|
-
|
|
2406
|
-
const SQLITE_PREPARE_PERSISTENT = 0x01;
|
|
2407
|
-
const SQLITE_PREPARE_NORMALIZED = 0x02;
|
|
2408
|
-
const SQLITE_PREPARE_NO_VTAB = 0x04;
|
|
2409
|
-
|
|
2410
|
-
/***/ },
|
|
2411
|
-
|
|
2412
|
-
/***/ "./lib/src/db/adapters/LockedAsyncDatabaseAdapter.js"
|
|
2413
|
-
/*!***********************************************************!*\
|
|
2414
|
-
!*** ./lib/src/db/adapters/LockedAsyncDatabaseAdapter.js ***!
|
|
2415
|
-
\***********************************************************/
|
|
387
|
+
/***/ "./lib/src/db/adapters/wa-sqlite/DatabaseClient.js"
|
|
388
|
+
/*!*********************************************************!*\
|
|
389
|
+
!*** ./lib/src/db/adapters/wa-sqlite/DatabaseClient.js ***!
|
|
390
|
+
\*********************************************************/
|
|
2416
391
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
2417
392
|
|
|
2418
393
|
__webpack_require__.r(__webpack_exports__);
|
|
2419
394
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2420
|
-
/* harmony export */
|
|
395
|
+
/* harmony export */ DatabaseClient: () => (/* binding */ DatabaseClient)
|
|
2421
396
|
/* harmony export */ });
|
|
2422
397
|
/* harmony import */ var _powersync_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @powersync/common */ "../common/dist/bundle.mjs");
|
|
2423
|
-
/* harmony import */ var
|
|
2424
|
-
/* harmony import */ var _WorkerWrappedAsyncDatabaseConnection_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./WorkerWrappedAsyncDatabaseConnection.js */ "./lib/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.js");
|
|
2425
|
-
/* harmony import */ var _wa_sqlite_WASQLiteConnection_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./wa-sqlite/WASQLiteConnection.js */ "./lib/src/db/adapters/wa-sqlite/WASQLiteConnection.js");
|
|
2426
|
-
|
|
2427
|
-
|
|
398
|
+
/* harmony import */ var comlink__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! comlink */ "../../node_modules/.pnpm/comlink@4.4.2/node_modules/comlink/dist/esm/comlink.mjs");
|
|
2428
399
|
|
|
2429
400
|
|
|
2430
401
|
/**
|
|
2431
|
-
* @
|
|
2432
|
-
* Wraps a {@link AsyncDatabaseConnection} and provides exclusive locking functions in
|
|
2433
|
-
* order to implement {@link DBAdapter}.
|
|
402
|
+
* A single-connection {@link ConnectionPool} implementation based on a worker connection.
|
|
2434
403
|
*/
|
|
2435
|
-
class
|
|
404
|
+
class DatabaseClient extends _powersync_common__WEBPACK_IMPORTED_MODULE_0__.BaseObserver {
|
|
2436
405
|
options;
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
_db = null;
|
|
2443
|
-
_disposeTableChangeListener = null;
|
|
2444
|
-
_config = null;
|
|
2445
|
-
pendingAbortControllers;
|
|
2446
|
-
requiresHolds;
|
|
2447
|
-
databaseOpenPromise = null;
|
|
2448
|
-
closing;
|
|
2449
|
-
closed;
|
|
2450
|
-
constructor(options) {
|
|
406
|
+
config;
|
|
407
|
+
#connection;
|
|
408
|
+
#shareConnectionAbortController = new AbortController();
|
|
409
|
+
#receiveTableUpdates;
|
|
410
|
+
constructor(options, config) {
|
|
2451
411
|
super();
|
|
2452
412
|
this.options = options;
|
|
2453
|
-
this.
|
|
2454
|
-
this
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
return r;
|
|
2469
|
-
}
|
|
2470
|
-
catch (e) {
|
|
2471
|
-
performance.measure(`[SQL] [ERROR: ${e.message}] ${sql}`, { start });
|
|
2472
|
-
throw e;
|
|
2473
|
-
}
|
|
413
|
+
this.config = config;
|
|
414
|
+
this.#connection = {
|
|
415
|
+
connection: options.connection,
|
|
416
|
+
notifyRemoteClosed: options.remoteCanCloseUnexpectedly ? new AbortController() : undefined,
|
|
417
|
+
traceQueries: config.debugMode === true
|
|
418
|
+
};
|
|
419
|
+
const { port1, port2 } = new MessageChannel();
|
|
420
|
+
options.connection.setUpdateListener(comlink__WEBPACK_IMPORTED_MODULE_1__.transfer(port1, [port1]));
|
|
421
|
+
this.#receiveTableUpdates = port2;
|
|
422
|
+
port2.onmessage = (event) => {
|
|
423
|
+
const tables = event.data;
|
|
424
|
+
const notification = {
|
|
425
|
+
tables,
|
|
426
|
+
groupedUpdates: {},
|
|
427
|
+
rawUpdates: []
|
|
2474
428
|
};
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
});
|
|
2480
|
-
this.initPromise = this._init();
|
|
2481
|
-
}
|
|
2482
|
-
get baseDB() {
|
|
2483
|
-
if (!this._db) {
|
|
2484
|
-
throw new Error(`Initialization has not completed yet. Cannot access base db`);
|
|
2485
|
-
}
|
|
2486
|
-
return this._db;
|
|
429
|
+
this.iterateListeners((l) => {
|
|
430
|
+
l.tablesUpdated && l.tablesUpdated(notification);
|
|
431
|
+
});
|
|
432
|
+
};
|
|
2487
433
|
}
|
|
2488
434
|
get name() {
|
|
2489
|
-
return this.
|
|
435
|
+
return this.config.dbFilename;
|
|
2490
436
|
}
|
|
2491
437
|
/**
|
|
2492
|
-
*
|
|
438
|
+
* Marks the remote as closed.
|
|
439
|
+
*
|
|
440
|
+
* This can sometimes happen outside of our control, e.g. when a shared worker requests a connection from a tab. When
|
|
441
|
+
* it happens, all outstanding requests on this pool would never resolve. To avoid livelocks in this scenario, we
|
|
442
|
+
* throw on all outstanding promises and forbid new calls.
|
|
2493
443
|
*/
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
/**
|
|
2499
|
-
* Execute opening of the db in a lock in order not to interfere with other operations.
|
|
2500
|
-
*/
|
|
2501
|
-
return this._acquireLock(async () => {
|
|
2502
|
-
// Dispose any previous table change listener.
|
|
2503
|
-
this._disposeTableChangeListener?.();
|
|
2504
|
-
this._disposeTableChangeListener = null;
|
|
2505
|
-
this._db?.close().catch((ex) => this.logger.warn(`Error closing database before opening new instance`, ex));
|
|
2506
|
-
const isReOpen = !!this._db;
|
|
2507
|
-
this._db = null;
|
|
2508
|
-
this._db = await this.options.openConnection();
|
|
2509
|
-
await this._db.init();
|
|
2510
|
-
this._config = await this._db.getConfig();
|
|
2511
|
-
await this.registerOnChangeListener(this._db);
|
|
2512
|
-
if (isReOpen) {
|
|
2513
|
-
this.iterateListeners((cb) => cb.databaseReOpened?.());
|
|
2514
|
-
}
|
|
2515
|
-
/**
|
|
2516
|
-
* This is only required for the long-lived shared IndexedDB connections.
|
|
2517
|
-
*/
|
|
2518
|
-
this.requiresHolds = this._config.vfs == _wa_sqlite_WASQLiteConnection_js__WEBPACK_IMPORTED_MODULE_3__.WASQLiteVFS.IDBBatchAtomicVFS;
|
|
2519
|
-
});
|
|
2520
|
-
}
|
|
2521
|
-
_reOpen() {
|
|
2522
|
-
this.databaseOpenPromise = this.openInternalDB().finally(() => {
|
|
2523
|
-
this.databaseOpenPromise = null;
|
|
2524
|
-
});
|
|
2525
|
-
return this.databaseOpenPromise;
|
|
2526
|
-
}
|
|
2527
|
-
/**
|
|
2528
|
-
* Re-opens the underlying database.
|
|
2529
|
-
* Returns a pending operation if one is already in progress.
|
|
2530
|
-
*/
|
|
2531
|
-
async reOpenInternalDB() {
|
|
2532
|
-
if (this.closing || !this.options.reOpenOnConnectionClosed) {
|
|
2533
|
-
// No-op
|
|
2534
|
-
return;
|
|
2535
|
-
}
|
|
2536
|
-
else if (this.databaseOpenPromise) {
|
|
2537
|
-
// Already busy opening
|
|
2538
|
-
return this.databaseOpenPromise;
|
|
2539
|
-
}
|
|
2540
|
-
else {
|
|
2541
|
-
return this._reOpen();
|
|
2542
|
-
}
|
|
2543
|
-
}
|
|
2544
|
-
async _init() {
|
|
2545
|
-
/**
|
|
2546
|
-
* For OPFS, we can see this open call sometimes fail due to NoModificationAllowedError.
|
|
2547
|
-
* We should be able to recover from this by re-opening the database.
|
|
2548
|
-
*/
|
|
2549
|
-
const maxAttempts = 3;
|
|
2550
|
-
for (let count = 0; count < maxAttempts; count++) {
|
|
2551
|
-
try {
|
|
2552
|
-
await this.openInternalDB();
|
|
2553
|
-
break;
|
|
2554
|
-
}
|
|
2555
|
-
catch (ex) {
|
|
2556
|
-
if (count == maxAttempts - 1) {
|
|
2557
|
-
throw ex;
|
|
2558
|
-
}
|
|
2559
|
-
this.logger.warn(`Attempt ${count + 1} of ${maxAttempts} to open database failed, retrying in 1 second...`, ex);
|
|
2560
|
-
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
2561
|
-
}
|
|
2562
|
-
}
|
|
2563
|
-
this.iterateListeners((cb) => cb.initialized?.());
|
|
2564
|
-
}
|
|
2565
|
-
getConfiguration() {
|
|
2566
|
-
if (!this._config) {
|
|
2567
|
-
throw new Error(`Cannot get config before initialization is completed`);
|
|
2568
|
-
}
|
|
2569
|
-
return {
|
|
2570
|
-
...this._config,
|
|
2571
|
-
// This can be overridden by the adapter later
|
|
2572
|
-
requiresPersistentTriggers: false
|
|
2573
|
-
};
|
|
2574
|
-
}
|
|
2575
|
-
async waitForInitialized() {
|
|
2576
|
-
// Awaiting this will expose errors on function calls like .execute etc
|
|
2577
|
-
await this.initPromise;
|
|
2578
|
-
}
|
|
2579
|
-
async shareConnection() {
|
|
2580
|
-
if (false == this._db instanceof _WorkerWrappedAsyncDatabaseConnection_js__WEBPACK_IMPORTED_MODULE_2__.WorkerWrappedAsyncDatabaseConnection) {
|
|
2581
|
-
throw new Error(`Only worker connections can be shared`);
|
|
2582
|
-
}
|
|
2583
|
-
return this._db.shareConnection();
|
|
2584
|
-
}
|
|
2585
|
-
/**
|
|
2586
|
-
* Registers a table change notification callback with the base database.
|
|
2587
|
-
* This can be extended by custom implementations in order to handle proxy events.
|
|
2588
|
-
*/
|
|
2589
|
-
async registerOnChangeListener(db) {
|
|
2590
|
-
this._disposeTableChangeListener = await db.registerOnTableChange((event) => {
|
|
2591
|
-
this.iterateListeners((cb) => cb.tablesUpdated?.(event));
|
|
2592
|
-
});
|
|
2593
|
-
}
|
|
2594
|
-
/**
|
|
2595
|
-
* This is currently a no-op on web
|
|
2596
|
-
*/
|
|
2597
|
-
async refreshSchema() { }
|
|
2598
|
-
async execute(query, params) {
|
|
2599
|
-
return this.writeLock((ctx) => ctx.execute(query, params));
|
|
2600
|
-
}
|
|
2601
|
-
async executeRaw(query, params) {
|
|
2602
|
-
return this.writeLock((ctx) => ctx.executeRaw(query, params));
|
|
2603
|
-
}
|
|
2604
|
-
async executeBatch(query, params) {
|
|
2605
|
-
return this.writeLock((ctx) => this._executeBatch(query, params));
|
|
2606
|
-
}
|
|
2607
|
-
/**
|
|
2608
|
-
* Attempts to close the connection.
|
|
2609
|
-
* Shared workers might not actually close the connection if other
|
|
2610
|
-
* tabs are still using it.
|
|
2611
|
-
*/
|
|
2612
|
-
async close() {
|
|
2613
|
-
this.closing = true;
|
|
2614
|
-
/**
|
|
2615
|
-
* Note that we obtain a reference to the callback to avoid calling the callback with `this` as the context.
|
|
2616
|
-
* This is to avoid Comlink attempting to clone `this` when calling the method.
|
|
2617
|
-
*/
|
|
2618
|
-
const dispose = this._disposeTableChangeListener;
|
|
2619
|
-
if (dispose) {
|
|
2620
|
-
dispose();
|
|
2621
|
-
}
|
|
2622
|
-
this.pendingAbortControllers.forEach((controller) => controller.abort('Closed'));
|
|
2623
|
-
await this.baseDB?.close?.();
|
|
2624
|
-
this.closed = true;
|
|
2625
|
-
}
|
|
2626
|
-
async getAll(sql, parameters) {
|
|
2627
|
-
await this.waitForInitialized();
|
|
2628
|
-
return this.dbGetHelpers.getAll(sql, parameters);
|
|
2629
|
-
}
|
|
2630
|
-
async getOptional(sql, parameters) {
|
|
2631
|
-
await this.waitForInitialized();
|
|
2632
|
-
return this.dbGetHelpers.getOptional(sql, parameters);
|
|
2633
|
-
}
|
|
2634
|
-
async get(sql, parameters) {
|
|
2635
|
-
await this.waitForInitialized();
|
|
2636
|
-
return this.dbGetHelpers.get(sql, parameters);
|
|
2637
|
-
}
|
|
2638
|
-
async readLock(fn, options) {
|
|
2639
|
-
await this.waitForInitialized();
|
|
2640
|
-
return this.acquireLock(async () => fn(this.generateDBHelpers({ execute: this._execute, executeRaw: this._executeRaw })), {
|
|
2641
|
-
timeoutMs: options?.timeoutMs ?? this.options.defaultLockTimeoutMs
|
|
2642
|
-
});
|
|
2643
|
-
}
|
|
2644
|
-
async writeLock(fn, options) {
|
|
2645
|
-
await this.waitForInitialized();
|
|
2646
|
-
return this.acquireLock(async () => fn(this.generateDBHelpers({ execute: this._execute, executeRaw: this._executeRaw })), {
|
|
2647
|
-
timeoutMs: options?.timeoutMs ?? this.options.defaultLockTimeoutMs
|
|
2648
|
-
});
|
|
2649
|
-
}
|
|
2650
|
-
async _acquireLock(callback, options) {
|
|
2651
|
-
if (this.closing) {
|
|
2652
|
-
throw new Error(`Cannot acquire lock, the database is closing`);
|
|
2653
|
-
}
|
|
2654
|
-
const abortController = new AbortController();
|
|
2655
|
-
this.pendingAbortControllers.add(abortController);
|
|
2656
|
-
const { timeoutMs } = options ?? {};
|
|
2657
|
-
const timeoutId = timeoutMs
|
|
2658
|
-
? setTimeout(() => {
|
|
2659
|
-
abortController.abort(`Timeout after ${timeoutMs}ms`);
|
|
2660
|
-
this.pendingAbortControllers.delete(abortController);
|
|
2661
|
-
}, timeoutMs)
|
|
2662
|
-
: null;
|
|
2663
|
-
return (0,_shared_navigator_js__WEBPACK_IMPORTED_MODULE_1__.getNavigatorLocks)().request(`db-lock-${this._dbIdentifier}`, { signal: abortController.signal }, async () => {
|
|
2664
|
-
this.pendingAbortControllers.delete(abortController);
|
|
2665
|
-
if (timeoutId) {
|
|
2666
|
-
clearTimeout(timeoutId);
|
|
2667
|
-
}
|
|
2668
|
-
return await callback();
|
|
2669
|
-
});
|
|
2670
|
-
}
|
|
2671
|
-
async acquireLock(callback, options) {
|
|
2672
|
-
await this.waitForInitialized();
|
|
2673
|
-
// The database is being (re)opened in the background. Wait for it here.
|
|
2674
|
-
if (this.databaseOpenPromise) {
|
|
2675
|
-
await this.databaseOpenPromise;
|
|
2676
|
-
}
|
|
2677
|
-
else if (!this._db) {
|
|
2678
|
-
/**
|
|
2679
|
-
* The database is not open anymore, we might need to re-open it.
|
|
2680
|
-
* Typically, _db, can be `null` if we tried to reOpen the database, but failed to succeed in re-opening.
|
|
2681
|
-
* This can happen when disconnecting the client.
|
|
2682
|
-
* Note: It is safe to re-enter this method multiple times.
|
|
2683
|
-
*/
|
|
2684
|
-
await this.reOpenInternalDB();
|
|
2685
|
-
}
|
|
2686
|
-
return this._acquireLock(async () => {
|
|
2687
|
-
let holdId = null;
|
|
2688
|
-
try {
|
|
2689
|
-
/**
|
|
2690
|
-
* We can't await this since it uses the same lock as we're in now.
|
|
2691
|
-
* If there is a pending open, this call will throw.
|
|
2692
|
-
* If there is no pending open, but there is also no database - the open
|
|
2693
|
-
* might have failed. We need to re-open the database.
|
|
2694
|
-
*/
|
|
2695
|
-
if (this.databaseOpenPromise || !this._db) {
|
|
2696
|
-
throw new _powersync_common__WEBPACK_IMPORTED_MODULE_0__.ConnectionClosedError('Connection is busy re-opening');
|
|
2697
|
-
}
|
|
2698
|
-
holdId = this.requiresHolds ? await this.baseDB.markHold() : null;
|
|
2699
|
-
return await callback();
|
|
2700
|
-
}
|
|
2701
|
-
catch (ex) {
|
|
2702
|
-
if (_powersync_common__WEBPACK_IMPORTED_MODULE_0__.ConnectionClosedError.MATCHES(ex)) {
|
|
2703
|
-
// Immediately re-open the database. We need to miss as little table updates as possible.
|
|
2704
|
-
// Note, don't await this since it uses the same lock as we're in now.
|
|
2705
|
-
this.reOpenInternalDB();
|
|
2706
|
-
}
|
|
2707
|
-
throw ex;
|
|
2708
|
-
}
|
|
2709
|
-
finally {
|
|
2710
|
-
if (holdId) {
|
|
2711
|
-
await this.baseDB.releaseHold(holdId);
|
|
2712
|
-
}
|
|
2713
|
-
}
|
|
2714
|
-
}, options);
|
|
2715
|
-
}
|
|
2716
|
-
async readTransaction(fn, options) {
|
|
2717
|
-
return this.readLock(this.wrapTransaction(fn));
|
|
2718
|
-
}
|
|
2719
|
-
writeTransaction(fn, options) {
|
|
2720
|
-
return this.writeLock(this.wrapTransaction(fn, true));
|
|
2721
|
-
}
|
|
2722
|
-
generateDBHelpers(tx) {
|
|
2723
|
-
return {
|
|
2724
|
-
...tx,
|
|
2725
|
-
/**
|
|
2726
|
-
* Execute a read-only query and return results
|
|
2727
|
-
*/
|
|
2728
|
-
async getAll(sql, parameters) {
|
|
2729
|
-
const res = await tx.execute(sql, parameters);
|
|
2730
|
-
return res.rows?._array ?? [];
|
|
2731
|
-
},
|
|
2732
|
-
/**
|
|
2733
|
-
* Execute a read-only query and return the first result, or null if the ResultSet is empty.
|
|
2734
|
-
*/
|
|
2735
|
-
async getOptional(sql, parameters) {
|
|
2736
|
-
const res = await tx.execute(sql, parameters);
|
|
2737
|
-
return res.rows?.item(0) ?? null;
|
|
2738
|
-
},
|
|
2739
|
-
/**
|
|
2740
|
-
* Execute a read-only query and return the first result, error if the ResultSet is empty.
|
|
2741
|
-
*/
|
|
2742
|
-
async get(sql, parameters) {
|
|
2743
|
-
const res = await tx.execute(sql, parameters);
|
|
2744
|
-
const first = res.rows?.item(0);
|
|
2745
|
-
if (!first) {
|
|
2746
|
-
throw new Error('Result set is empty');
|
|
2747
|
-
}
|
|
2748
|
-
return first;
|
|
2749
|
-
}
|
|
2750
|
-
};
|
|
2751
|
-
}
|
|
2752
|
-
/**
|
|
2753
|
-
* Wraps a lock context into a transaction context
|
|
2754
|
-
*/
|
|
2755
|
-
wrapTransaction(cb, write = false) {
|
|
2756
|
-
return async (tx) => {
|
|
2757
|
-
await this._execute(write ? 'BEGIN EXCLUSIVE' : 'BEGIN');
|
|
2758
|
-
let finalized = false;
|
|
2759
|
-
const commit = async () => {
|
|
2760
|
-
if (finalized) {
|
|
2761
|
-
return { rowsAffected: 0 };
|
|
2762
|
-
}
|
|
2763
|
-
finalized = true;
|
|
2764
|
-
return this._execute('COMMIT');
|
|
2765
|
-
};
|
|
2766
|
-
const rollback = () => {
|
|
2767
|
-
finalized = true;
|
|
2768
|
-
return this._execute('ROLLBACK');
|
|
2769
|
-
};
|
|
2770
|
-
try {
|
|
2771
|
-
const result = await cb({
|
|
2772
|
-
...tx,
|
|
2773
|
-
commit,
|
|
2774
|
-
rollback
|
|
2775
|
-
});
|
|
2776
|
-
if (!finalized) {
|
|
2777
|
-
await commit();
|
|
2778
|
-
}
|
|
2779
|
-
return result;
|
|
2780
|
-
}
|
|
2781
|
-
catch (ex) {
|
|
2782
|
-
this.logger.debug('Caught ex in transaction', ex);
|
|
2783
|
-
try {
|
|
2784
|
-
await rollback();
|
|
2785
|
-
}
|
|
2786
|
-
catch (ex2) {
|
|
2787
|
-
// In rare cases, a rollback may fail.
|
|
2788
|
-
// Safe to ignore.
|
|
2789
|
-
}
|
|
2790
|
-
throw ex;
|
|
2791
|
-
}
|
|
2792
|
-
};
|
|
2793
|
-
}
|
|
2794
|
-
/**
|
|
2795
|
-
* Wraps the worker execute function, awaiting for it to be available
|
|
2796
|
-
*/
|
|
2797
|
-
_execute = async (sql, bindings) => {
|
|
2798
|
-
await this.waitForInitialized();
|
|
2799
|
-
const result = await this.baseDB.execute(sql, bindings);
|
|
2800
|
-
return {
|
|
2801
|
-
...result,
|
|
2802
|
-
rows: {
|
|
2803
|
-
...result.rows,
|
|
2804
|
-
item: (idx) => result.rows._array[idx]
|
|
2805
|
-
}
|
|
2806
|
-
};
|
|
2807
|
-
};
|
|
2808
|
-
/**
|
|
2809
|
-
* Wraps the worker executeRaw function, awaiting for it to be available
|
|
2810
|
-
*/
|
|
2811
|
-
_executeRaw = async (sql, bindings) => {
|
|
2812
|
-
await this.waitForInitialized();
|
|
2813
|
-
return await this.baseDB.executeRaw(sql, bindings);
|
|
2814
|
-
};
|
|
2815
|
-
/**
|
|
2816
|
-
* Wraps the worker executeBatch function, awaiting for it to be available
|
|
2817
|
-
*/
|
|
2818
|
-
_executeBatch = async (query, params) => {
|
|
2819
|
-
await this.waitForInitialized();
|
|
2820
|
-
const result = await this.baseDB.executeBatch(query, params);
|
|
2821
|
-
return {
|
|
2822
|
-
...result,
|
|
2823
|
-
rows: undefined
|
|
2824
|
-
};
|
|
2825
|
-
};
|
|
2826
|
-
}
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
/***/ },
|
|
2830
|
-
|
|
2831
|
-
/***/ "./lib/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.js"
|
|
2832
|
-
/*!*********************************************************************!*\
|
|
2833
|
-
!*** ./lib/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.js ***!
|
|
2834
|
-
\*********************************************************************/
|
|
2835
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
2836
|
-
|
|
2837
|
-
__webpack_require__.r(__webpack_exports__);
|
|
2838
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2839
|
-
/* harmony export */ WorkerWrappedAsyncDatabaseConnection: () => (/* binding */ WorkerWrappedAsyncDatabaseConnection)
|
|
2840
|
-
/* harmony export */ });
|
|
2841
|
-
/* harmony import */ var _powersync_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @powersync/common */ "../common/dist/bundle.mjs");
|
|
2842
|
-
/* harmony import */ var comlink__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! comlink */ "../../node_modules/.pnpm/comlink@4.4.2/node_modules/comlink/dist/esm/comlink.mjs");
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
/**
|
|
2846
|
-
* Wraps a provided instance of {@link AsyncDatabaseConnection}, providing necessary proxy
|
|
2847
|
-
* functions for worker listeners.
|
|
2848
|
-
*/
|
|
2849
|
-
class WorkerWrappedAsyncDatabaseConnection extends _powersync_common__WEBPACK_IMPORTED_MODULE_0__.BaseObserver {
|
|
2850
|
-
options;
|
|
2851
|
-
lockAbortController = new AbortController();
|
|
2852
|
-
notifyRemoteClosed;
|
|
2853
|
-
constructor(options) {
|
|
2854
|
-
super();
|
|
2855
|
-
this.options = options;
|
|
2856
|
-
if (options.remoteCanCloseUnexpectedly) {
|
|
2857
|
-
this.notifyRemoteClosed = new AbortController();
|
|
2858
|
-
}
|
|
2859
|
-
}
|
|
2860
|
-
get baseConnection() {
|
|
2861
|
-
return this.options.baseConnection;
|
|
2862
|
-
}
|
|
2863
|
-
init() {
|
|
2864
|
-
return this.baseConnection.init();
|
|
2865
|
-
}
|
|
2866
|
-
/**
|
|
2867
|
-
* Marks the remote as closed.
|
|
2868
|
-
*
|
|
2869
|
-
* This can sometimes happen outside of our control, e.g. when a shared worker requests a connection from a tab. When
|
|
2870
|
-
* it happens, all methods on the {@link baseConnection} would never resolve. To avoid livelocks in this scenario, we
|
|
2871
|
-
* throw on all outstanding promises and forbid new calls.
|
|
2872
|
-
*/
|
|
2873
|
-
markRemoteClosed() {
|
|
2874
|
-
// Can non-null assert here because this function is only supposed to be called when remoteCanCloseUnexpectedly was
|
|
2875
|
-
// set.
|
|
2876
|
-
this.notifyRemoteClosed.abort();
|
|
2877
|
-
}
|
|
2878
|
-
markHold() {
|
|
2879
|
-
return this.withRemote(() => this.baseConnection.markHold());
|
|
2880
|
-
}
|
|
2881
|
-
releaseHold(holdId) {
|
|
2882
|
-
return this.withRemote(() => this.baseConnection.releaseHold(holdId));
|
|
2883
|
-
}
|
|
2884
|
-
isAutoCommit() {
|
|
2885
|
-
return this.withRemote(() => this.baseConnection.isAutoCommit());
|
|
2886
|
-
}
|
|
2887
|
-
withRemote(workerPromise, fireActionOnAbort = false) {
|
|
2888
|
-
const controller = this.notifyRemoteClosed;
|
|
2889
|
-
if (controller) {
|
|
2890
|
-
return new Promise((resolve, reject) => {
|
|
2891
|
-
if (controller.signal.aborted) {
|
|
2892
|
-
reject(new _powersync_common__WEBPACK_IMPORTED_MODULE_0__.ConnectionClosedError('Called operation on closed remote'));
|
|
2893
|
-
if (!fireActionOnAbort) {
|
|
2894
|
-
// Don't run the operation if we're going to reject
|
|
2895
|
-
// We might want to fire-and-forget the operation in some cases (like a close operation)
|
|
2896
|
-
return;
|
|
2897
|
-
}
|
|
2898
|
-
}
|
|
2899
|
-
function handleAbort() {
|
|
2900
|
-
reject(new _powersync_common__WEBPACK_IMPORTED_MODULE_0__.ConnectionClosedError('Remote peer closed with request in flight'));
|
|
2901
|
-
}
|
|
2902
|
-
function completePromise(action) {
|
|
2903
|
-
controller.signal.removeEventListener('abort', handleAbort);
|
|
2904
|
-
action();
|
|
2905
|
-
}
|
|
2906
|
-
controller.signal.addEventListener('abort', handleAbort);
|
|
2907
|
-
workerPromise()
|
|
2908
|
-
.then((data) => completePromise(() => resolve(data)))
|
|
2909
|
-
.catch((e) => completePromise(() => reject(e)));
|
|
2910
|
-
});
|
|
2911
|
-
}
|
|
2912
|
-
else {
|
|
2913
|
-
// Can't close, so just return the inner worker promise unguarded.
|
|
2914
|
-
return workerPromise();
|
|
2915
|
-
}
|
|
2916
|
-
}
|
|
2917
|
-
/**
|
|
2918
|
-
* Get a MessagePort which can be used to share the internals of this connection.
|
|
2919
|
-
*/
|
|
2920
|
-
async shareConnection() {
|
|
2921
|
-
const { identifier, remote } = this.options;
|
|
2922
|
-
/**
|
|
2923
|
-
* Hold a navigator lock in order to avoid features such as Chrome's frozen tabs,
|
|
2924
|
-
* or Edge's sleeping tabs from pausing the thread for this connection.
|
|
2925
|
-
* This promise resolves once a lock is obtained.
|
|
2926
|
-
* This lock will be held as long as this connection is open.
|
|
2927
|
-
* The `shareConnection` method should not be called on multiple tabs concurrently.
|
|
2928
|
-
*/
|
|
2929
|
-
await new Promise((resolve, reject) => navigator.locks
|
|
2930
|
-
.request(`shared-connection-${this.options.identifier}-${Date.now()}-${Math.round(Math.random() * 10000)}`, {
|
|
2931
|
-
signal: this.lockAbortController.signal
|
|
2932
|
-
}, async () => {
|
|
2933
|
-
resolve();
|
|
2934
|
-
// Free the lock when the connection is already closed.
|
|
2935
|
-
if (this.lockAbortController.signal.aborted) {
|
|
2936
|
-
return;
|
|
2937
|
-
}
|
|
2938
|
-
// Hold the lock while the shared connection is in use.
|
|
2939
|
-
await new Promise((releaseLock) => {
|
|
2940
|
-
this.lockAbortController.signal.addEventListener('abort', () => {
|
|
2941
|
-
releaseLock();
|
|
2942
|
-
});
|
|
2943
|
-
});
|
|
2944
|
-
})
|
|
2945
|
-
// We aren't concerned with abort errors here
|
|
2946
|
-
.catch((ex) => {
|
|
2947
|
-
if (ex.name == 'AbortError') {
|
|
2948
|
-
resolve();
|
|
2949
|
-
}
|
|
2950
|
-
else {
|
|
2951
|
-
reject(ex);
|
|
2952
|
-
}
|
|
2953
|
-
}));
|
|
2954
|
-
const newPort = await remote[comlink__WEBPACK_IMPORTED_MODULE_1__.createEndpoint]();
|
|
2955
|
-
return { port: newPort, identifier };
|
|
2956
|
-
}
|
|
2957
|
-
/**
|
|
2958
|
-
* Registers a table change notification callback with the base database.
|
|
2959
|
-
* This can be extended by custom implementations in order to handle proxy events.
|
|
2960
|
-
*/
|
|
2961
|
-
async registerOnTableChange(callback) {
|
|
2962
|
-
return this.baseConnection.registerOnTableChange(comlink__WEBPACK_IMPORTED_MODULE_1__.proxy(callback));
|
|
444
|
+
markRemoteClosed() {
|
|
445
|
+
// Can non-null assert here because this function is only supposed to be called when remoteCanCloseUnexpectedly was
|
|
446
|
+
// set.
|
|
447
|
+
this.#connection.notifyRemoteClosed.abort();
|
|
2963
448
|
}
|
|
2964
449
|
async close() {
|
|
2965
|
-
//
|
|
2966
|
-
this.
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
|
|
2971
|
-
finally {
|
|
2972
|
-
this.options.remote[comlink__WEBPACK_IMPORTED_MODULE_1__.releaseProxy]();
|
|
2973
|
-
this.options.onClose?.();
|
|
2974
|
-
this.iterateListeners((l) => l.closing?.());
|
|
2975
|
-
}
|
|
2976
|
-
}
|
|
2977
|
-
execute(sql, params) {
|
|
2978
|
-
return this.withRemote(() => this.baseConnection.execute(sql, params));
|
|
2979
|
-
}
|
|
2980
|
-
executeRaw(sql, params) {
|
|
2981
|
-
return this.withRemote(() => this.baseConnection.executeRaw(sql, params));
|
|
2982
|
-
}
|
|
2983
|
-
executeBatch(sql, params) {
|
|
2984
|
-
return this.withRemote(() => this.baseConnection.executeBatch(sql, params));
|
|
2985
|
-
}
|
|
2986
|
-
getConfig() {
|
|
2987
|
-
return this.withRemote(() => this.baseConnection.getConfig());
|
|
2988
|
-
}
|
|
2989
|
-
}
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
/***/ },
|
|
2993
|
-
|
|
2994
|
-
/***/ "./lib/src/db/adapters/wa-sqlite/WASQLiteConnection.js"
|
|
2995
|
-
/*!*************************************************************!*\
|
|
2996
|
-
!*** ./lib/src/db/adapters/wa-sqlite/WASQLiteConnection.js ***!
|
|
2997
|
-
\*************************************************************/
|
|
2998
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
2999
|
-
|
|
3000
|
-
__webpack_require__.r(__webpack_exports__);
|
|
3001
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3002
|
-
/* harmony export */ AsyncWASQLiteModuleFactory: () => (/* binding */ AsyncWASQLiteModuleFactory),
|
|
3003
|
-
/* harmony export */ DEFAULT_MODULE_FACTORIES: () => (/* binding */ DEFAULT_MODULE_FACTORIES),
|
|
3004
|
-
/* harmony export */ MultiCipherAsyncWASQLiteModuleFactory: () => (/* binding */ MultiCipherAsyncWASQLiteModuleFactory),
|
|
3005
|
-
/* harmony export */ MultiCipherSyncWASQLiteModuleFactory: () => (/* binding */ MultiCipherSyncWASQLiteModuleFactory),
|
|
3006
|
-
/* harmony export */ SyncWASQLiteModuleFactory: () => (/* binding */ SyncWASQLiteModuleFactory),
|
|
3007
|
-
/* harmony export */ WASQLiteVFS: () => (/* binding */ WASQLiteVFS),
|
|
3008
|
-
/* harmony export */ WASqliteConnection: () => (/* binding */ WASqliteConnection)
|
|
3009
|
-
/* harmony export */ });
|
|
3010
|
-
/* harmony import */ var _journeyapps_wa_sqlite__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @journeyapps/wa-sqlite */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.5.0/node_modules/@journeyapps/wa-sqlite/src/sqlite-api.js");
|
|
3011
|
-
/* harmony import */ var _powersync_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @powersync/common */ "../common/dist/bundle.mjs");
|
|
3012
|
-
/* harmony import */ var async_mutex__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! async-mutex */ "../../node_modules/.pnpm/async-mutex@0.5.0/node_modules/async-mutex/index.mjs");
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
/**
|
|
3017
|
-
* List of currently tested virtual filesystems
|
|
3018
|
-
*/
|
|
3019
|
-
var WASQLiteVFS;
|
|
3020
|
-
(function (WASQLiteVFS) {
|
|
3021
|
-
WASQLiteVFS["IDBBatchAtomicVFS"] = "IDBBatchAtomicVFS";
|
|
3022
|
-
WASQLiteVFS["OPFSCoopSyncVFS"] = "OPFSCoopSyncVFS";
|
|
3023
|
-
WASQLiteVFS["AccessHandlePoolVFS"] = "AccessHandlePoolVFS";
|
|
3024
|
-
})(WASQLiteVFS || (WASQLiteVFS = {}));
|
|
3025
|
-
/**
|
|
3026
|
-
* @internal
|
|
3027
|
-
*/
|
|
3028
|
-
const AsyncWASQLiteModuleFactory = async () => {
|
|
3029
|
-
const { default: factory } = await __webpack_require__.e(/*! import() */ "node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_dist_wa-sqli-cc5fcc").then(__webpack_require__.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/dist/wa-sqlite-async.mjs */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.5.0/node_modules/@journeyapps/wa-sqlite/dist/wa-sqlite-async.mjs"));
|
|
3030
|
-
return factory();
|
|
3031
|
-
};
|
|
3032
|
-
/**
|
|
3033
|
-
* @internal
|
|
3034
|
-
*/
|
|
3035
|
-
const MultiCipherAsyncWASQLiteModuleFactory = async () => {
|
|
3036
|
-
const { default: factory } = await __webpack_require__.e(/*! import() */ "node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-c99c07").then(__webpack_require__.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/dist/mc-wa-sqlite-async.mjs */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.5.0/node_modules/@journeyapps/wa-sqlite/dist/mc-wa-sqlite-async.mjs"));
|
|
3037
|
-
return factory();
|
|
3038
|
-
};
|
|
3039
|
-
/**
|
|
3040
|
-
* @internal
|
|
3041
|
-
*/
|
|
3042
|
-
const SyncWASQLiteModuleFactory = async () => {
|
|
3043
|
-
const { default: factory } = await __webpack_require__.e(/*! import() */ "node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_dist_wa-sqlite_mjs").then(__webpack_require__.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/dist/wa-sqlite.mjs */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.5.0/node_modules/@journeyapps/wa-sqlite/dist/wa-sqlite.mjs"));
|
|
3044
|
-
return factory();
|
|
3045
|
-
};
|
|
3046
|
-
/**
|
|
3047
|
-
* @internal
|
|
3048
|
-
*/
|
|
3049
|
-
const MultiCipherSyncWASQLiteModuleFactory = async () => {
|
|
3050
|
-
const { default: factory } = await __webpack_require__.e(/*! import() */ "node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_dist_mc-wa-s-b9c070").then(__webpack_require__.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/dist/mc-wa-sqlite.mjs */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.5.0/node_modules/@journeyapps/wa-sqlite/dist/mc-wa-sqlite.mjs"));
|
|
3051
|
-
return factory();
|
|
3052
|
-
};
|
|
3053
|
-
/**
|
|
3054
|
-
* @internal
|
|
3055
|
-
*/
|
|
3056
|
-
const DEFAULT_MODULE_FACTORIES = {
|
|
3057
|
-
[WASQLiteVFS.IDBBatchAtomicVFS]: async (options) => {
|
|
3058
|
-
let module;
|
|
3059
|
-
if (options.encryptionKey) {
|
|
3060
|
-
module = await MultiCipherAsyncWASQLiteModuleFactory();
|
|
3061
|
-
}
|
|
3062
|
-
else {
|
|
3063
|
-
module = await AsyncWASQLiteModuleFactory();
|
|
3064
|
-
}
|
|
3065
|
-
const { IDBBatchAtomicVFS } = await __webpack_require__.e(/*! import() */ "node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_src_examples-0df390").then(__webpack_require__.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.5.0/node_modules/@journeyapps/wa-sqlite/src/examples/IDBBatchAtomicVFS.js"));
|
|
3066
|
-
return {
|
|
3067
|
-
module,
|
|
3068
|
-
// @ts-expect-error The types for this static method are missing upstream
|
|
3069
|
-
vfs: await IDBBatchAtomicVFS.create(options.dbFileName, module, { lockPolicy: 'exclusive' })
|
|
3070
|
-
};
|
|
3071
|
-
},
|
|
3072
|
-
[WASQLiteVFS.AccessHandlePoolVFS]: async (options) => {
|
|
3073
|
-
let module;
|
|
3074
|
-
if (options.encryptionKey) {
|
|
3075
|
-
module = await MultiCipherSyncWASQLiteModuleFactory();
|
|
3076
|
-
}
|
|
3077
|
-
else {
|
|
3078
|
-
module = await SyncWASQLiteModuleFactory();
|
|
3079
|
-
}
|
|
3080
|
-
// @ts-expect-error The types for this static method are missing upstream
|
|
3081
|
-
const { AccessHandlePoolVFS } = await __webpack_require__.e(/*! import() */ "node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_src_examples-151024").then(__webpack_require__.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.5.0/node_modules/@journeyapps/wa-sqlite/src/examples/AccessHandlePoolVFS.js"));
|
|
3082
|
-
return {
|
|
3083
|
-
module,
|
|
3084
|
-
vfs: await AccessHandlePoolVFS.create(options.dbFileName, module)
|
|
3085
|
-
};
|
|
3086
|
-
},
|
|
3087
|
-
[WASQLiteVFS.OPFSCoopSyncVFS]: async (options) => {
|
|
3088
|
-
let module;
|
|
3089
|
-
if (options.encryptionKey) {
|
|
3090
|
-
module = await MultiCipherSyncWASQLiteModuleFactory();
|
|
3091
|
-
}
|
|
3092
|
-
else {
|
|
3093
|
-
module = await SyncWASQLiteModuleFactory();
|
|
3094
|
-
}
|
|
3095
|
-
// @ts-expect-error The types for this static method are missing upstream
|
|
3096
|
-
const { OPFSCoopSyncVFS } = await __webpack_require__.e(/*! import() */ "node_modules_pnpm_journeyapps_wa-sqlite_1_5_0_node_modules_journeyapps_wa-sqlite_src_examples-c01ef0").then(__webpack_require__.bind(__webpack_require__, /*! @journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js */ "../../node_modules/.pnpm/@journeyapps+wa-sqlite@1.5.0/node_modules/@journeyapps/wa-sqlite/src/examples/OPFSCoopSyncVFS.js"));
|
|
3097
|
-
const vfs = await OPFSCoopSyncVFS.create(options.dbFileName, module);
|
|
3098
|
-
return {
|
|
3099
|
-
module,
|
|
3100
|
-
vfs
|
|
3101
|
-
};
|
|
3102
|
-
}
|
|
3103
|
-
};
|
|
3104
|
-
/**
|
|
3105
|
-
* @internal
|
|
3106
|
-
* WA-SQLite connection which directly interfaces with WA-SQLite.
|
|
3107
|
-
* This is usually instantiated inside a worker.
|
|
3108
|
-
*/
|
|
3109
|
-
class WASqliteConnection extends _powersync_common__WEBPACK_IMPORTED_MODULE_1__.BaseObserver {
|
|
3110
|
-
options;
|
|
3111
|
-
_sqliteAPI = null;
|
|
3112
|
-
_dbP = null;
|
|
3113
|
-
_moduleFactory;
|
|
3114
|
-
updatedTables;
|
|
3115
|
-
updateTimer;
|
|
3116
|
-
statementMutex;
|
|
3117
|
-
broadcastChannel;
|
|
3118
|
-
/**
|
|
3119
|
-
* Unique id for this specific connection. This is used to prevent broadcast table change
|
|
3120
|
-
* notification loops.
|
|
3121
|
-
*/
|
|
3122
|
-
connectionId;
|
|
3123
|
-
_holdCounter;
|
|
3124
|
-
_holdId;
|
|
3125
|
-
constructor(options) {
|
|
3126
|
-
super();
|
|
3127
|
-
this.options = options;
|
|
3128
|
-
this.updatedTables = new Set();
|
|
3129
|
-
this.updateTimer = null;
|
|
3130
|
-
this.broadcastChannel = null;
|
|
3131
|
-
this.connectionId = new Date().valueOf() + Math.random();
|
|
3132
|
-
this.statementMutex = new async_mutex__WEBPACK_IMPORTED_MODULE_2__.Mutex();
|
|
3133
|
-
this._moduleFactory = DEFAULT_MODULE_FACTORIES[this.options.vfs];
|
|
3134
|
-
this._holdCounter = 0;
|
|
3135
|
-
this._holdId = null;
|
|
3136
|
-
}
|
|
3137
|
-
/**
|
|
3138
|
-
* Gets the id for the current hold.
|
|
3139
|
-
* This can be used to check for invalid states.
|
|
3140
|
-
*/
|
|
3141
|
-
get currentHoldId() {
|
|
3142
|
-
return this._holdId;
|
|
450
|
+
// This connection is no longer shared, so we can close locks held for shareConnection calls.
|
|
451
|
+
this.#shareConnectionAbortController.abort();
|
|
452
|
+
this.#receiveTableUpdates.close();
|
|
453
|
+
await useConnectionState(this.#connection, (c) => c.close(), true);
|
|
454
|
+
this.options.onClose?.();
|
|
455
|
+
this.options.source?.[comlink__WEBPACK_IMPORTED_MODULE_1__.releaseProxy]();
|
|
3143
456
|
}
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
throw new Error(`Initialization has not completed`);
|
|
3147
|
-
}
|
|
3148
|
-
return this._sqliteAPI;
|
|
457
|
+
readLock(fn, options) {
|
|
458
|
+
return this.#lock(false, fn, options);
|
|
3149
459
|
}
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
throw new Error(`Initialization has not completed`);
|
|
3153
|
-
}
|
|
3154
|
-
return this._dbP;
|
|
460
|
+
writeLock(fn, options) {
|
|
461
|
+
return this.#lock(true, fn, options);
|
|
3155
462
|
}
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
async isAutoCommit() {
|
|
3161
|
-
return this.sqliteAPI.get_autocommit(this.dbP) != 0;
|
|
3162
|
-
}
|
|
3163
|
-
async markHold() {
|
|
3164
|
-
const previousHoldId = this._holdId;
|
|
3165
|
-
this._holdId = `${++this._holdCounter}`;
|
|
3166
|
-
if (previousHoldId) {
|
|
3167
|
-
await this.iterateAsyncListeners(async (cb) => cb.holdOverwritten?.(previousHoldId));
|
|
463
|
+
async #lock(write, fn, options) {
|
|
464
|
+
const token = await useConnectionState(this.#connection, (c) => c.requestAccess(write, options?.timeoutMs));
|
|
465
|
+
try {
|
|
466
|
+
return await fn(new ClientLockContext(this.#connection, token));
|
|
3168
467
|
}
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
async releaseHold(holdId) {
|
|
3172
|
-
if (holdId != this._holdId) {
|
|
3173
|
-
throw new Error(`Invalid hold state, expected ${this._holdId} but got ${holdId}`);
|
|
468
|
+
finally {
|
|
469
|
+
await useConnectionState(this.#connection, (c) => c.completeAccess(token));
|
|
3174
470
|
}
|
|
3175
|
-
this._holdId = null;
|
|
3176
|
-
}
|
|
3177
|
-
async openDB() {
|
|
3178
|
-
this._dbP = await this.sqliteAPI.open_v2(this.options.dbFilename);
|
|
3179
|
-
return this._dbP;
|
|
3180
471
|
}
|
|
3181
|
-
async
|
|
3182
|
-
|
|
3183
|
-
await this.executeSingleStatement(`PRAGMA key = "${this.options.encryptionKey}"`);
|
|
3184
|
-
}
|
|
3185
|
-
return;
|
|
472
|
+
async refreshSchema() {
|
|
473
|
+
// Currently a no-op on the web.
|
|
3186
474
|
}
|
|
3187
|
-
async
|
|
3188
|
-
const { module, vfs } = await this._moduleFactory({
|
|
3189
|
-
dbFileName: this.options.dbFilename,
|
|
3190
|
-
encryptionKey: this.options.encryptionKey
|
|
3191
|
-
});
|
|
3192
|
-
const sqlite3 = _journeyapps_wa_sqlite__WEBPACK_IMPORTED_MODULE_0__.Factory(module);
|
|
3193
|
-
sqlite3.vfs_register(vfs, true);
|
|
3194
|
-
/**
|
|
3195
|
-
* Register the PowerSync core SQLite extension
|
|
3196
|
-
*/
|
|
3197
|
-
module.ccall('powersync_init_static', 'int', []);
|
|
475
|
+
async shareConnection() {
|
|
3198
476
|
/**
|
|
3199
|
-
*
|
|
477
|
+
* Hold a navigator lock in order to avoid features such as Chrome's frozen tabs,
|
|
478
|
+
* or Edge's sleeping tabs from pausing the thread for this connection.
|
|
479
|
+
* This promise resolves once a lock is obtained.
|
|
480
|
+
* This lock will be held as long as this connection is open.
|
|
481
|
+
* The `shareConnection` method should not be called on multiple tabs concurrently.
|
|
3200
482
|
*/
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
}
|
|
483
|
+
const abort = this.#shareConnectionAbortController;
|
|
484
|
+
const source = this.options.source;
|
|
485
|
+
if (source == null) {
|
|
486
|
+
throw new Error(`shareConnection() is only available for connections based by workers.`);
|
|
3206
487
|
}
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
if (
|
|
3214
|
-
// Ignore messages from the same connection
|
|
488
|
+
await new Promise((resolve, reject) => navigator.locks
|
|
489
|
+
.request(`shared-connection-${this.name}-${Date.now()}-${Math.round(Math.random() * 10000)}`, {
|
|
490
|
+
signal: abort.signal
|
|
491
|
+
}, async () => {
|
|
492
|
+
resolve();
|
|
493
|
+
// Free the lock when the connection is already closed.
|
|
494
|
+
if (abort.signal.aborted) {
|
|
3215
495
|
return;
|
|
3216
496
|
}
|
|
3217
|
-
//
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
this._sqliteAPI = await this.openSQLiteAPI();
|
|
3229
|
-
await this.openDB();
|
|
3230
|
-
this.registerBroadcastListeners();
|
|
3231
|
-
await this.executeSingleStatement(`PRAGMA temp_store = ${this.options.temporaryStorage};`);
|
|
3232
|
-
await this.executeEncryptionPragma();
|
|
3233
|
-
await this.executeSingleStatement(`PRAGMA cache_size = -${this.options.cacheSizeKb};`);
|
|
3234
|
-
this.sqliteAPI.update_hook(this.dbP, (updateType, dbName, tableName) => {
|
|
3235
|
-
if (!tableName) {
|
|
3236
|
-
return;
|
|
497
|
+
// Hold the lock while the shared connection is in use.
|
|
498
|
+
await new Promise((releaseLock) => {
|
|
499
|
+
abort.signal.addEventListener('abort', () => {
|
|
500
|
+
releaseLock();
|
|
501
|
+
});
|
|
502
|
+
});
|
|
503
|
+
})
|
|
504
|
+
// We aren't concerned with abort errors here
|
|
505
|
+
.catch((ex) => {
|
|
506
|
+
if (ex.name == 'AbortError') {
|
|
507
|
+
resolve();
|
|
3237
508
|
}
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
509
|
+
else {
|
|
510
|
+
reject(ex);
|
|
511
|
+
}
|
|
512
|
+
}));
|
|
513
|
+
const newPort = await source[comlink__WEBPACK_IMPORTED_MODULE_1__.createEndpoint]();
|
|
514
|
+
return { port: newPort, identifier: this.name };
|
|
3241
515
|
}
|
|
3242
|
-
|
|
3243
|
-
return this.
|
|
516
|
+
getConfiguration() {
|
|
517
|
+
return this.config;
|
|
3244
518
|
}
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
this
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* A {@link SqlExecutor} implemented by sending commands to a worker.
|
|
522
|
+
*
|
|
523
|
+
* While an instance is active, it has exclusive access to the underlying database connection (as represented by its
|
|
524
|
+
* token).
|
|
525
|
+
*/
|
|
526
|
+
class ClientSqlExecutor {
|
|
527
|
+
#connection;
|
|
528
|
+
#token;
|
|
529
|
+
constructor(connection, token) {
|
|
530
|
+
this.#connection = connection;
|
|
531
|
+
this.#token = token;
|
|
3257
532
|
}
|
|
3258
533
|
/**
|
|
3259
|
-
*
|
|
534
|
+
* Requests an operation from the worker, potentially tracing it if that option has been enabled.
|
|
3260
535
|
*/
|
|
3261
|
-
async
|
|
3262
|
-
|
|
3263
|
-
|
|
536
|
+
async maybeTrace(fn, describeForTrace) {
|
|
537
|
+
if (this.#connection.traceQueries) {
|
|
538
|
+
const start = performance.now();
|
|
539
|
+
const description = describeForTrace();
|
|
3264
540
|
try {
|
|
3265
|
-
await this
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
if (stmt === null) {
|
|
3269
|
-
return {
|
|
3270
|
-
rowsAffected: 0,
|
|
3271
|
-
rows: { _array: [], length: 0 }
|
|
3272
|
-
};
|
|
3273
|
-
}
|
|
3274
|
-
//Prepare statement once
|
|
3275
|
-
for (const binding of wrappedBindings) {
|
|
3276
|
-
// TODO not sure why this is needed currently, but booleans break
|
|
3277
|
-
for (let i = 0; i < binding.length; i++) {
|
|
3278
|
-
const b = binding[i];
|
|
3279
|
-
if (typeof b == 'boolean') {
|
|
3280
|
-
binding[i] = b ? 1 : 0;
|
|
3281
|
-
}
|
|
3282
|
-
}
|
|
3283
|
-
if (bindings) {
|
|
3284
|
-
this.sqliteAPI.bind_collection(stmt, binding);
|
|
3285
|
-
}
|
|
3286
|
-
const result = await this.sqliteAPI.step(stmt);
|
|
3287
|
-
if (result === _journeyapps_wa_sqlite__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DONE) {
|
|
3288
|
-
//The value returned by sqlite3_changes() immediately after an INSERT, UPDATE or DELETE statement run on a view is always zero.
|
|
3289
|
-
affectedRows += this.sqliteAPI.changes(this.dbP);
|
|
3290
|
-
}
|
|
3291
|
-
this.sqliteAPI.reset(stmt);
|
|
3292
|
-
}
|
|
3293
|
-
}
|
|
3294
|
-
await this.executeSingleStatement('COMMIT');
|
|
541
|
+
const r = await useConnectionState(this.#connection, fn);
|
|
542
|
+
performance.measure(`[SQL] ${description}`, { start });
|
|
543
|
+
return r;
|
|
3295
544
|
}
|
|
3296
|
-
catch (
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
rowsAffected: 0,
|
|
3300
|
-
rows: { _array: [], length: 0 }
|
|
3301
|
-
};
|
|
545
|
+
catch (e) {
|
|
546
|
+
performance.measure(`[SQL] [ERROR: ${e.message}] ${description}`, { start });
|
|
547
|
+
throw e;
|
|
3302
548
|
}
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
return result;
|
|
3308
|
-
});
|
|
3309
|
-
}
|
|
3310
|
-
/**
|
|
3311
|
-
* This executes single SQL statements inside a requested lock.
|
|
3312
|
-
*/
|
|
3313
|
-
async execute(sql, bindings) {
|
|
3314
|
-
// Running multiple statements on the same connection concurrently should not be allowed
|
|
3315
|
-
return this.acquireExecuteLock(async () => {
|
|
3316
|
-
return this.executeSingleStatement(sql, bindings);
|
|
3317
|
-
});
|
|
549
|
+
}
|
|
550
|
+
else {
|
|
551
|
+
return useConnectionState(this.#connection, fn);
|
|
552
|
+
}
|
|
3318
553
|
}
|
|
3319
|
-
async
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
554
|
+
async execute(query, params) {
|
|
555
|
+
const rs = await this.#executeOnWorker(query, params);
|
|
556
|
+
let rows;
|
|
557
|
+
if (rs.resultSet) {
|
|
558
|
+
const resultSet = rs.resultSet;
|
|
559
|
+
function rowToJavaScriptObject(row) {
|
|
560
|
+
const obj = {};
|
|
561
|
+
resultSet.columns.forEach((key, idx) => (obj[key] = row[idx]));
|
|
562
|
+
return obj;
|
|
563
|
+
}
|
|
564
|
+
const mapped = resultSet.rows.map(rowToJavaScriptObject);
|
|
565
|
+
rows = {
|
|
566
|
+
_array: mapped,
|
|
567
|
+
length: mapped.length,
|
|
568
|
+
item: (idx) => mapped[idx]
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
return {
|
|
572
|
+
rowsAffected: rs.changes,
|
|
573
|
+
insertId: rs.lastInsertRowId,
|
|
574
|
+
rows
|
|
575
|
+
};
|
|
3323
576
|
}
|
|
3324
|
-
async
|
|
3325
|
-
this
|
|
3326
|
-
|
|
3327
|
-
/**
|
|
3328
|
-
* Running the close operation inside the same execute mutex prevents errors like:
|
|
3329
|
-
* ```
|
|
3330
|
-
* unable to close due to unfinalized statements or unfinished backups
|
|
3331
|
-
* ```
|
|
3332
|
-
*/
|
|
3333
|
-
await this.sqliteAPI.close(this.dbP);
|
|
3334
|
-
});
|
|
577
|
+
async executeRaw(query, params) {
|
|
578
|
+
const rs = await this.#executeOnWorker(query, params);
|
|
579
|
+
return rs.resultSet?.rows ?? [];
|
|
3335
580
|
}
|
|
3336
|
-
async
|
|
3337
|
-
return this.
|
|
3338
|
-
tablesUpdated: (event) => callback(event)
|
|
3339
|
-
});
|
|
581
|
+
async #executeOnWorker(query, params) {
|
|
582
|
+
return this.maybeTrace((c) => c.execute(this.#token, query, params), () => query);
|
|
3340
583
|
}
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
};
|
|
3348
|
-
/**
|
|
3349
|
-
* This executes a single statement using SQLite3.
|
|
3350
|
-
*/
|
|
3351
|
-
async executeSingleStatement(sql, bindings) {
|
|
3352
|
-
const results = await this._execute(sql, bindings);
|
|
3353
|
-
const rows = [];
|
|
3354
|
-
for (const resultSet of results) {
|
|
3355
|
-
for (const row of resultSet.rows) {
|
|
3356
|
-
const outRow = {};
|
|
3357
|
-
resultSet.columns.forEach((key, index) => {
|
|
3358
|
-
outRow[key] = row[index];
|
|
3359
|
-
});
|
|
3360
|
-
rows.push(outRow);
|
|
3361
|
-
}
|
|
584
|
+
async executeBatch(query, params = []) {
|
|
585
|
+
const results = await this.maybeTrace((c) => c.executeBatch(this.#token, query, params), () => `${query} (batch of ${params.length})`);
|
|
586
|
+
const result = { insertId: undefined, rowsAffected: 0 };
|
|
587
|
+
for (const source of results) {
|
|
588
|
+
result.insertId = source.lastInsertRowId;
|
|
589
|
+
result.rowsAffected += source.changes;
|
|
3362
590
|
}
|
|
3363
|
-
const result = {
|
|
3364
|
-
insertId: this.sqliteAPI.last_insert_id(this.dbP),
|
|
3365
|
-
rowsAffected: this.sqliteAPI.changes(this.dbP),
|
|
3366
|
-
rows: {
|
|
3367
|
-
_array: rows,
|
|
3368
|
-
length: rows.length
|
|
3369
|
-
}
|
|
3370
|
-
};
|
|
3371
591
|
return result;
|
|
3372
592
|
}
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
// TODO not sure why this is needed currently, but booleans break
|
|
3387
|
-
binding.forEach((b, index, arr) => {
|
|
3388
|
-
if (typeof b == 'boolean') {
|
|
3389
|
-
arr[index] = b ? 1 : 0;
|
|
3390
|
-
}
|
|
3391
|
-
});
|
|
3392
|
-
this.sqliteAPI.reset(stmt);
|
|
3393
|
-
if (bindings) {
|
|
3394
|
-
this.sqliteAPI.bind_collection(stmt, binding);
|
|
3395
|
-
}
|
|
3396
|
-
const rows = [];
|
|
3397
|
-
while ((await this.sqliteAPI.step(stmt)) === _journeyapps_wa_sqlite__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ROW) {
|
|
3398
|
-
const row = this.sqliteAPI.row(stmt);
|
|
3399
|
-
rows.push(row);
|
|
3400
|
-
}
|
|
3401
|
-
columns = columns ?? this.sqliteAPI.column_names(stmt);
|
|
3402
|
-
if (columns.length) {
|
|
3403
|
-
results.push({ columns, rows });
|
|
593
|
+
}
|
|
594
|
+
class ClientLockContext extends (0,_powersync_common__WEBPACK_IMPORTED_MODULE_0__.DBGetUtilsDefaultMixin)(ClientSqlExecutor) {
|
|
595
|
+
}
|
|
596
|
+
async function useConnectionState(state, workerPromise, fireActionOnAbort = false) {
|
|
597
|
+
const controller = state.notifyRemoteClosed;
|
|
598
|
+
if (controller) {
|
|
599
|
+
return new Promise((resolve, reject) => {
|
|
600
|
+
if (controller.signal.aborted) {
|
|
601
|
+
reject(new _powersync_common__WEBPACK_IMPORTED_MODULE_0__.ConnectionClosedError('Called operation on closed remote'));
|
|
602
|
+
if (!fireActionOnAbort) {
|
|
603
|
+
// Don't run the operation if we're going to reject
|
|
604
|
+
// We might want to fire-and-forget the operation in some cases (like a close operation)
|
|
605
|
+
return;
|
|
3404
606
|
}
|
|
3405
607
|
}
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
break;
|
|
608
|
+
function handleAbort() {
|
|
609
|
+
reject(new _powersync_common__WEBPACK_IMPORTED_MODULE_0__.ConnectionClosedError('Remote peer closed with request in flight'));
|
|
3409
610
|
}
|
|
3410
|
-
|
|
3411
|
-
|
|
611
|
+
function completePromise(action) {
|
|
612
|
+
controller.signal.removeEventListener('abort', handleAbort);
|
|
613
|
+
action();
|
|
614
|
+
}
|
|
615
|
+
controller.signal.addEventListener('abort', handleAbort);
|
|
616
|
+
workerPromise(state.connection)
|
|
617
|
+
.then((data) => completePromise(() => resolve(data)))
|
|
618
|
+
.catch((e) => completePromise(() => reject(e)));
|
|
619
|
+
});
|
|
620
|
+
}
|
|
621
|
+
else {
|
|
622
|
+
// Can't close, so just return the inner worker promise unguarded.
|
|
623
|
+
return workerPromise(state.connection);
|
|
3412
624
|
}
|
|
3413
625
|
}
|
|
3414
626
|
|
|
@@ -3605,6 +817,47 @@ const getNavigatorLocks = () => {
|
|
|
3605
817
|
};
|
|
3606
818
|
|
|
3607
819
|
|
|
820
|
+
/***/ },
|
|
821
|
+
|
|
822
|
+
/***/ "./lib/src/shared/tab_close_signal.js"
|
|
823
|
+
/*!********************************************!*\
|
|
824
|
+
!*** ./lib/src/shared/tab_close_signal.js ***!
|
|
825
|
+
\********************************************/
|
|
826
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
827
|
+
|
|
828
|
+
__webpack_require__.r(__webpack_exports__);
|
|
829
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
830
|
+
/* harmony export */ generateTabCloseSignal: () => (/* binding */ generateTabCloseSignal)
|
|
831
|
+
/* harmony export */ });
|
|
832
|
+
/* harmony import */ var _navigator_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./navigator.js */ "./lib/src/shared/navigator.js");
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* Requests a random lock that will be released once the optional signal is aborted (or, if no signal is given, when the
|
|
836
|
+
* tab is closed).
|
|
837
|
+
*
|
|
838
|
+
* This allows sending the name of the lock to another context (e.g. a shared worker), which will also attempt to
|
|
839
|
+
* acquire it. Since the lock is returned when the tab is closed, this allows the shared worker to free resources
|
|
840
|
+
* assocatiated with this tab.
|
|
841
|
+
*
|
|
842
|
+
* We take hold of this lock as soon-as-possible in order to cater for potentially closed tabs.
|
|
843
|
+
*/
|
|
844
|
+
function generateTabCloseSignal(abort) {
|
|
845
|
+
return new Promise((resolve, reject) => {
|
|
846
|
+
const options = { signal: abort };
|
|
847
|
+
(0,_navigator_js__WEBPACK_IMPORTED_MODULE_0__.getNavigatorLocks)()
|
|
848
|
+
.request(`tab-close-signal-${crypto.randomUUID()}`, options, (lock) => {
|
|
849
|
+
resolve(lock.name);
|
|
850
|
+
return new Promise((resolve) => {
|
|
851
|
+
if (abort) {
|
|
852
|
+
abort.addEventListener('abort', () => resolve());
|
|
853
|
+
}
|
|
854
|
+
});
|
|
855
|
+
})
|
|
856
|
+
.catch(reject);
|
|
857
|
+
});
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
|
|
3608
861
|
/***/ },
|
|
3609
862
|
|
|
3610
863
|
/***/ "./lib/src/worker/sync/BroadcastLogger.js"
|
|
@@ -3762,14 +1015,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3762
1015
|
/* harmony export */ SharedSyncImplementation: () => (/* binding */ SharedSyncImplementation)
|
|
3763
1016
|
/* harmony export */ });
|
|
3764
1017
|
/* harmony import */ var _powersync_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @powersync/common */ "../common/dist/bundle.mjs");
|
|
3765
|
-
/* harmony import */ var
|
|
3766
|
-
/* harmony import */ var
|
|
3767
|
-
/* harmony import */ var
|
|
3768
|
-
/* harmony import */ var
|
|
3769
|
-
/* harmony import */ var
|
|
3770
|
-
/* harmony import */ var
|
|
3771
|
-
/* harmony import */ var _BroadcastLogger_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./BroadcastLogger.js */ "./lib/src/worker/sync/BroadcastLogger.js");
|
|
3772
|
-
|
|
1018
|
+
/* harmony import */ var comlink__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! comlink */ "../../node_modules/.pnpm/comlink@4.4.2/node_modules/comlink/dist/esm/comlink.mjs");
|
|
1019
|
+
/* harmony import */ var _db_sync_WebRemote_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../db/sync/WebRemote.js */ "./lib/src/db/sync/WebRemote.js");
|
|
1020
|
+
/* harmony import */ var _db_sync_WebStreamingSyncImplementation_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../db/sync/WebStreamingSyncImplementation.js */ "./lib/src/db/sync/WebStreamingSyncImplementation.js");
|
|
1021
|
+
/* harmony import */ var _BroadcastLogger_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./BroadcastLogger.js */ "./lib/src/worker/sync/BroadcastLogger.js");
|
|
1022
|
+
/* harmony import */ var _db_adapters_wa_sqlite_DatabaseClient_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../db/adapters/wa-sqlite/DatabaseClient.js */ "./lib/src/db/adapters/wa-sqlite/DatabaseClient.js");
|
|
1023
|
+
/* harmony import */ var _shared_tab_close_signal_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../shared/tab_close_signal.js */ "./lib/src/shared/tab_close_signal.js");
|
|
3773
1024
|
|
|
3774
1025
|
|
|
3775
1026
|
|
|
@@ -3814,14 +1065,14 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
3814
1065
|
connectionManager;
|
|
3815
1066
|
syncStatus;
|
|
3816
1067
|
broadCastLogger;
|
|
3817
|
-
|
|
1068
|
+
database = this.generateReconnectableDatabase();
|
|
3818
1069
|
constructor() {
|
|
3819
1070
|
super();
|
|
3820
1071
|
this.ports = [];
|
|
3821
1072
|
this.syncParams = null;
|
|
3822
1073
|
this.logger = (0,_powersync_common__WEBPACK_IMPORTED_MODULE_0__.createLogger)('shared-sync');
|
|
3823
1074
|
this.lastConnectOptions = undefined;
|
|
3824
|
-
this.portMutex = new
|
|
1075
|
+
this.portMutex = new _powersync_common__WEBPACK_IMPORTED_MODULE_0__.Mutex();
|
|
3825
1076
|
this.isInitialized = new Promise((resolve) => {
|
|
3826
1077
|
const callback = this.registerListener({
|
|
3827
1078
|
initialized: () => {
|
|
@@ -3830,10 +1081,8 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
3830
1081
|
}
|
|
3831
1082
|
});
|
|
3832
1083
|
});
|
|
3833
|
-
// Should be configured once we get params
|
|
3834
|
-
this.distributedDB = null;
|
|
3835
1084
|
this.syncStatus = new _powersync_common__WEBPACK_IMPORTED_MODULE_0__.SyncStatus({});
|
|
3836
|
-
this.broadCastLogger = new
|
|
1085
|
+
this.broadCastLogger = new _BroadcastLogger_js__WEBPACK_IMPORTED_MODULE_4__.BroadcastLogger(this.ports);
|
|
3837
1086
|
this.connectionManager = new _powersync_common__WEBPACK_IMPORTED_MODULE_0__.ConnectionManager({
|
|
3838
1087
|
createSyncImplementation: async () => {
|
|
3839
1088
|
await this.waitForReady();
|
|
@@ -3931,38 +1180,8 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
3931
1180
|
if (params.streamOptions?.flags?.broadcastLogs) {
|
|
3932
1181
|
this.logger = this.broadCastLogger;
|
|
3933
1182
|
}
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
openConnection: async () => {
|
|
3937
|
-
// Gets a connection from the clients when a new connection is requested.
|
|
3938
|
-
const db = await this.openInternalDB();
|
|
3939
|
-
db.registerListener({
|
|
3940
|
-
closing: () => {
|
|
3941
|
-
lockedAdapter.reOpenInternalDB();
|
|
3942
|
-
}
|
|
3943
|
-
});
|
|
3944
|
-
return db;
|
|
3945
|
-
},
|
|
3946
|
-
logger: this.logger,
|
|
3947
|
-
reOpenOnConnectionClosed: true
|
|
3948
|
-
});
|
|
3949
|
-
this.distributedDB = lockedAdapter;
|
|
3950
|
-
await lockedAdapter.init();
|
|
3951
|
-
lockedAdapter.registerListener({
|
|
3952
|
-
databaseReOpened: () => {
|
|
3953
|
-
// We may have missed some table updates while the database was closed.
|
|
3954
|
-
// We can poke the crud in case we missed any updates.
|
|
3955
|
-
this.connectionManager.syncStreamImplementation?.triggerCrudUpload();
|
|
3956
|
-
/**
|
|
3957
|
-
* FIXME or IMPROVE ME
|
|
3958
|
-
* The Rust client implementation stores sync state on the connection level.
|
|
3959
|
-
* Reopening the database causes a state machine error which should cause the
|
|
3960
|
-
* StreamingSyncImplementation to reconnect. It would be nicer if we could trigger
|
|
3961
|
-
* this reconnect earlier.
|
|
3962
|
-
* This reconnect is not required for IndexedDB.
|
|
3963
|
-
*/
|
|
3964
|
-
}
|
|
3965
|
-
});
|
|
1183
|
+
// Ensure we have a usable database connection, the reconnectable database will connect lazily on first use.
|
|
1184
|
+
await this.database.readLock(async () => { });
|
|
3966
1185
|
self.onerror = (event) => {
|
|
3967
1186
|
// Share any uncaught events on the broadcast logger
|
|
3968
1187
|
this.logger.error('Uncaught exception in PowerSync shared sync worker', event);
|
|
@@ -3994,7 +1213,7 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
3994
1213
|
return await this.portMutex.runExclusive(() => {
|
|
3995
1214
|
const portProvider = {
|
|
3996
1215
|
port,
|
|
3997
|
-
clientProvider:
|
|
1216
|
+
clientProvider: comlink__WEBPACK_IMPORTED_MODULE_1__.wrap(port),
|
|
3998
1217
|
currentSubscriptions: [],
|
|
3999
1218
|
closeListeners: [],
|
|
4000
1219
|
isClosing: false
|
|
@@ -4041,7 +1260,7 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
4041
1260
|
await closeListener();
|
|
4042
1261
|
}
|
|
4043
1262
|
this.collectActiveSubscriptions();
|
|
4044
|
-
return () => trackedPort.clientProvider[
|
|
1263
|
+
return () => trackedPort.clientProvider[comlink__WEBPACK_IMPORTED_MODULE_1__.releaseProxy]();
|
|
4045
1264
|
});
|
|
4046
1265
|
}
|
|
4047
1266
|
triggerCrudUpload() {
|
|
@@ -4078,9 +1297,9 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
4078
1297
|
// This should only be called after initialization has completed
|
|
4079
1298
|
const syncParams = this.syncParams;
|
|
4080
1299
|
// Create a new StreamingSyncImplementation for each connect call. This is usually done is all SDKs.
|
|
4081
|
-
return new
|
|
4082
|
-
adapter: new _powersync_common__WEBPACK_IMPORTED_MODULE_0__.SqliteBucketStorage(this.
|
|
4083
|
-
remote: new
|
|
1300
|
+
return new _db_sync_WebStreamingSyncImplementation_js__WEBPACK_IMPORTED_MODULE_3__.WebStreamingSyncImplementation({
|
|
1301
|
+
adapter: new _powersync_common__WEBPACK_IMPORTED_MODULE_0__.SqliteBucketStorage(this.database, this.logger),
|
|
1302
|
+
remote: new _db_sync_WebRemote_js__WEBPACK_IMPORTED_MODULE_2__.WebRemote({
|
|
4084
1303
|
invalidateCredentials: async () => {
|
|
4085
1304
|
const lastPort = await this.getLastWrappedPort();
|
|
4086
1305
|
if (!lastPort) {
|
|
@@ -4150,9 +1369,9 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
4150
1369
|
});
|
|
4151
1370
|
}
|
|
4152
1371
|
/**
|
|
4153
|
-
*
|
|
1372
|
+
* Requests a random client to share its database connection with us.
|
|
4154
1373
|
*/
|
|
4155
|
-
async openInternalDB() {
|
|
1374
|
+
async openInternalDB(handleClosed) {
|
|
4156
1375
|
const client = await this.getRandomWrappedPort();
|
|
4157
1376
|
if (!client) {
|
|
4158
1377
|
// Should not really happen in practice
|
|
@@ -4186,8 +1405,9 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
4186
1405
|
removeCloseListener();
|
|
4187
1406
|
throw ex;
|
|
4188
1407
|
});
|
|
4189
|
-
const remote =
|
|
1408
|
+
const remote = comlink__WEBPACK_IMPORTED_MODULE_1__.wrap(workerPort);
|
|
4190
1409
|
const identifier = this.syncParams.dbParams.dbFilename;
|
|
1410
|
+
const clientLockName = await (0,_shared_tab_close_signal_js__WEBPACK_IMPORTED_MODULE_6__.generateTabCloseSignal)();
|
|
4191
1411
|
/**
|
|
4192
1412
|
* The open could fail if the tab is closed while we're busy opening the database.
|
|
4193
1413
|
* This operation is typically executed inside an exclusive portMutex lock.
|
|
@@ -4195,7 +1415,16 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
4195
1415
|
* We can't rely on the closeListeners to abort the operation if the tab is closed.
|
|
4196
1416
|
*/
|
|
4197
1417
|
const db = await withAbort({
|
|
4198
|
-
action: () =>
|
|
1418
|
+
action: async () => {
|
|
1419
|
+
const clientView = await remote.connectToExisting({ identifier, lockName: clientLockName });
|
|
1420
|
+
return new _db_adapters_wa_sqlite_DatabaseClient_js__WEBPACK_IMPORTED_MODULE_5__.DatabaseClient({
|
|
1421
|
+
connection: clientView,
|
|
1422
|
+
source: remote,
|
|
1423
|
+
// It's possible for this worker to outlive the client hosting the database for us. We need to be prepared for
|
|
1424
|
+
// that and ensure pending requests are aborted when the tab is closed.
|
|
1425
|
+
remoteCanCloseUnexpectedly: true
|
|
1426
|
+
}, this.syncParams.dbParams);
|
|
1427
|
+
},
|
|
4199
1428
|
signal: abortController.signal,
|
|
4200
1429
|
cleanupOnAbort: (db) => {
|
|
4201
1430
|
db.close();
|
|
@@ -4205,25 +1434,86 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
4205
1434
|
removeCloseListener();
|
|
4206
1435
|
});
|
|
4207
1436
|
clearTimeout(timeout);
|
|
4208
|
-
const wrapped = new _db_adapters_WorkerWrappedAsyncDatabaseConnection_js__WEBPACK_IMPORTED_MODULE_6__.WorkerWrappedAsyncDatabaseConnection({
|
|
4209
|
-
remote,
|
|
4210
|
-
baseConnection: db,
|
|
4211
|
-
identifier,
|
|
4212
|
-
// It's possible for this worker to outlive the client hosting the database for us. We need to be prepared for
|
|
4213
|
-
// that and ensure pending requests are aborted when the tab is closed.
|
|
4214
|
-
remoteCanCloseUnexpectedly: true
|
|
4215
|
-
});
|
|
4216
1437
|
client.closeListeners.push(async () => {
|
|
4217
1438
|
this.logger.info('Aborting open connection because associated tab closed.');
|
|
1439
|
+
handleClosed(db);
|
|
4218
1440
|
/**
|
|
4219
1441
|
* Don't await this close operation. It might never resolve if the tab is closed.
|
|
4220
1442
|
* We mark the remote as closed first, this will reject any pending requests.
|
|
4221
1443
|
* We then call close. The close operation is configured to fire-and-forget, the main promise will reject immediately.
|
|
4222
1444
|
*/
|
|
4223
|
-
|
|
4224
|
-
|
|
1445
|
+
db.markRemoteClosed();
|
|
1446
|
+
db.close().catch((ex) => this.logger.warn('error closing database connection', ex));
|
|
4225
1447
|
});
|
|
4226
|
-
return
|
|
1448
|
+
return db;
|
|
1449
|
+
}
|
|
1450
|
+
generateReconnectableDatabase() {
|
|
1451
|
+
const syncParams = this.syncParams;
|
|
1452
|
+
const sharedSync = this;
|
|
1453
|
+
class ReconnectPool extends _powersync_common__WEBPACK_IMPORTED_MODULE_0__.BaseObserver {
|
|
1454
|
+
connectionState = null;
|
|
1455
|
+
get name() {
|
|
1456
|
+
return syncParams?.dbParams.dbFilename;
|
|
1457
|
+
}
|
|
1458
|
+
async connect() {
|
|
1459
|
+
if (this.connectionState == null) {
|
|
1460
|
+
const handleClosed = this.handleClientClosed.bind(this);
|
|
1461
|
+
this.connectionState = (async () => {
|
|
1462
|
+
try {
|
|
1463
|
+
const db = await sharedSync.openInternalDB(handleClosed);
|
|
1464
|
+
db.registerListener({
|
|
1465
|
+
tablesUpdated: (notification) => {
|
|
1466
|
+
this.iterateListeners((l) => l.tablesUpdated?.(notification));
|
|
1467
|
+
}
|
|
1468
|
+
});
|
|
1469
|
+
this.connectionState = db;
|
|
1470
|
+
return db;
|
|
1471
|
+
}
|
|
1472
|
+
catch (e) {
|
|
1473
|
+
// Allow reconnecting when the database is used again.
|
|
1474
|
+
this.connectionState = null;
|
|
1475
|
+
throw e;
|
|
1476
|
+
}
|
|
1477
|
+
})();
|
|
1478
|
+
}
|
|
1479
|
+
return await this.connectionState;
|
|
1480
|
+
}
|
|
1481
|
+
async close() {
|
|
1482
|
+
if (this.connectionState != null) {
|
|
1483
|
+
await (await this.connectionState).close();
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
handleClientClosed(client) {
|
|
1487
|
+
if (client === this.connectionState) {
|
|
1488
|
+
this.connectionState = null;
|
|
1489
|
+
// We may have missed some table updates while the database was closed.
|
|
1490
|
+
// We can poke the crud in case we missed any updates.
|
|
1491
|
+
const impl = sharedSync.connectionManager.syncStreamImplementation;
|
|
1492
|
+
impl?.triggerCrudUpload();
|
|
1493
|
+
/**
|
|
1494
|
+
* FIXME or IMPROVE ME
|
|
1495
|
+
* The Rust client implementation stores sync state on the connection level.
|
|
1496
|
+
* Reopening the database causes a state machine error which should cause the
|
|
1497
|
+
* StreamingSyncImplementation to reconnect. It would be nicer if we could trigger
|
|
1498
|
+
* this reconnect earlier.
|
|
1499
|
+
* This reconnect is not required for IndexedDB.
|
|
1500
|
+
*/
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
async readLock(fn, options) {
|
|
1504
|
+
const db = await this.connect();
|
|
1505
|
+
return db.readLock(fn, options);
|
|
1506
|
+
}
|
|
1507
|
+
async writeLock(fn, options) {
|
|
1508
|
+
const db = await this.connect();
|
|
1509
|
+
return db.writeLock(fn, options);
|
|
1510
|
+
}
|
|
1511
|
+
async refreshSchema() {
|
|
1512
|
+
// Not used by sync client.
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1515
|
+
const Adapter = (0,_powersync_common__WEBPACK_IMPORTED_MODULE_0__.DBAdapterDefaultMixin)(ReconnectPool);
|
|
1516
|
+
return new Adapter();
|
|
4227
1517
|
}
|
|
4228
1518
|
/**
|
|
4229
1519
|
* A method to update the all shared statuses for each
|
|
@@ -4399,6 +1689,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4399
1689
|
/* harmony export */ CrudBatch: () => (/* binding */ CrudBatch),
|
|
4400
1690
|
/* harmony export */ CrudEntry: () => (/* binding */ CrudEntry),
|
|
4401
1691
|
/* harmony export */ CrudTransaction: () => (/* binding */ CrudTransaction),
|
|
1692
|
+
/* harmony export */ DBAdapterDefaultMixin: () => (/* binding */ DBAdapterDefaultMixin),
|
|
1693
|
+
/* harmony export */ DBGetUtilsDefaultMixin: () => (/* binding */ DBGetUtilsDefaultMixin),
|
|
4402
1694
|
/* harmony export */ DEFAULT_CRUD_BATCH_LIMIT: () => (/* binding */ DEFAULT_CRUD_BATCH_LIMIT),
|
|
4403
1695
|
/* harmony export */ DEFAULT_CRUD_UPLOAD_THROTTLE_MS: () => (/* binding */ DEFAULT_CRUD_UPLOAD_THROTTLE_MS),
|
|
4404
1696
|
/* harmony export */ DEFAULT_INDEX_COLUMN_OPTIONS: () => (/* binding */ DEFAULT_INDEX_COLUMN_OPTIONS),
|
|
@@ -4434,6 +1726,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4434
1726
|
/* harmony export */ MAX_AMOUNT_OF_COLUMNS: () => (/* binding */ MAX_AMOUNT_OF_COLUMNS),
|
|
4435
1727
|
/* harmony export */ MAX_OP_ID: () => (/* binding */ MAX_OP_ID),
|
|
4436
1728
|
/* harmony export */ MEMORY_TRIGGER_CLAIM_MANAGER: () => (/* binding */ MEMORY_TRIGGER_CLAIM_MANAGER),
|
|
1729
|
+
/* harmony export */ Mutex: () => (/* binding */ Mutex),
|
|
4437
1730
|
/* harmony export */ OnChangeQueryProcessor: () => (/* binding */ OnChangeQueryProcessor),
|
|
4438
1731
|
/* harmony export */ OpType: () => (/* binding */ OpType),
|
|
4439
1732
|
/* harmony export */ OpTypeEnum: () => (/* binding */ OpTypeEnum),
|
|
@@ -4475,15 +1768,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4475
1768
|
/* harmony export */ isStreamingSyncCheckpointPartiallyComplete: () => (/* binding */ isStreamingSyncCheckpointPartiallyComplete),
|
|
4476
1769
|
/* harmony export */ isStreamingSyncData: () => (/* binding */ isStreamingSyncData),
|
|
4477
1770
|
/* harmony export */ isSyncNewCheckpointRequest: () => (/* binding */ isSyncNewCheckpointRequest),
|
|
4478
|
-
/* harmony export */ mutexRunExclusive: () => (/* binding */ mutexRunExclusive),
|
|
4479
1771
|
/* harmony export */ parseQuery: () => (/* binding */ parseQuery),
|
|
4480
1772
|
/* harmony export */ runOnSchemaChange: () => (/* binding */ runOnSchemaChange),
|
|
4481
1773
|
/* harmony export */ sanitizeSQL: () => (/* binding */ sanitizeSQL),
|
|
4482
|
-
/* harmony export */ sanitizeUUID: () => (/* binding */ sanitizeUUID)
|
|
1774
|
+
/* harmony export */ sanitizeUUID: () => (/* binding */ sanitizeUUID),
|
|
1775
|
+
/* harmony export */ timeoutSignal: () => (/* binding */ timeoutSignal)
|
|
4483
1776
|
/* harmony export */ });
|
|
4484
|
-
/* harmony import */ var async_mutex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! async-mutex */ "../../node_modules/.pnpm/async-mutex@0.5.0/node_modules/async-mutex/index.mjs");
|
|
4485
|
-
|
|
4486
|
-
|
|
4487
1777
|
// https://www.sqlite.org/lang_expr.html#castexpr
|
|
4488
1778
|
var ColumnType;
|
|
4489
1779
|
(function (ColumnType) {
|
|
@@ -5141,7 +2431,7 @@ class SyncingService {
|
|
|
5141
2431
|
updatedAttachments.push(downloaded);
|
|
5142
2432
|
break;
|
|
5143
2433
|
case AttachmentState.QUEUED_DELETE:
|
|
5144
|
-
const deleted = await this.deleteAttachment(attachment);
|
|
2434
|
+
const deleted = await this.deleteAttachment(attachment, context);
|
|
5145
2435
|
updatedAttachments.push(deleted);
|
|
5146
2436
|
break;
|
|
5147
2437
|
}
|
|
@@ -5219,17 +2509,16 @@ class SyncingService {
|
|
|
5219
2509
|
* On failure, defers to error handler or archives.
|
|
5220
2510
|
*
|
|
5221
2511
|
* @param attachment - The attachment record to delete
|
|
2512
|
+
* @param context - Attachment context for database operations
|
|
5222
2513
|
* @returns Updated attachment record
|
|
5223
2514
|
*/
|
|
5224
|
-
async deleteAttachment(attachment) {
|
|
2515
|
+
async deleteAttachment(attachment, context) {
|
|
5225
2516
|
try {
|
|
5226
2517
|
await this.remoteStorage.deleteFile(attachment);
|
|
5227
2518
|
if (attachment.localUri) {
|
|
5228
2519
|
await this.localStorage.deleteFile(attachment.localUri);
|
|
5229
2520
|
}
|
|
5230
|
-
await
|
|
5231
|
-
await ctx.deleteAttachment(attachment.id);
|
|
5232
|
-
});
|
|
2521
|
+
await context.deleteAttachment(attachment.id);
|
|
5233
2522
|
return {
|
|
5234
2523
|
...attachment,
|
|
5235
2524
|
state: AttachmentState.ARCHIVED
|
|
@@ -5267,32 +2556,108 @@ class SyncingService {
|
|
|
5267
2556
|
}
|
|
5268
2557
|
|
|
5269
2558
|
/**
|
|
5270
|
-
*
|
|
2559
|
+
* An asynchronous mutex implementation.
|
|
2560
|
+
*
|
|
2561
|
+
* @internal This class is meant to be used in PowerSync SDKs only, and is not part of the public API.
|
|
5271
2562
|
*/
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
2563
|
+
class Mutex {
|
|
2564
|
+
inCriticalSection = false;
|
|
2565
|
+
// Linked list of waiters. We don't expect the wait list to become particularly large, and this allows removing
|
|
2566
|
+
// aborted waiters from the middle of the list efficiently.
|
|
2567
|
+
firstWaiter;
|
|
2568
|
+
lastWaiter;
|
|
2569
|
+
addWaiter(onAcquire) {
|
|
2570
|
+
const node = {
|
|
2571
|
+
isActive: true,
|
|
2572
|
+
onAcquire,
|
|
2573
|
+
prev: this.lastWaiter
|
|
2574
|
+
};
|
|
2575
|
+
if (this.lastWaiter) {
|
|
2576
|
+
this.lastWaiter.next = node;
|
|
2577
|
+
this.lastWaiter = node;
|
|
2578
|
+
}
|
|
2579
|
+
else {
|
|
2580
|
+
// First waiter
|
|
2581
|
+
this.lastWaiter = this.firstWaiter = node;
|
|
2582
|
+
}
|
|
2583
|
+
return node;
|
|
2584
|
+
}
|
|
2585
|
+
deactivateWaiter(waiter) {
|
|
2586
|
+
const { prev, next } = waiter;
|
|
2587
|
+
waiter.isActive = false;
|
|
2588
|
+
if (prev)
|
|
2589
|
+
prev.next = next;
|
|
2590
|
+
if (next)
|
|
2591
|
+
next.prev = prev;
|
|
2592
|
+
if (waiter == this.firstWaiter)
|
|
2593
|
+
this.firstWaiter = next;
|
|
2594
|
+
if (waiter == this.lastWaiter)
|
|
2595
|
+
this.lastWaiter = prev;
|
|
2596
|
+
}
|
|
2597
|
+
acquire(abort) {
|
|
2598
|
+
return new Promise((resolve, reject) => {
|
|
2599
|
+
function rejectAborted() {
|
|
2600
|
+
reject(abort?.reason ?? new Error('Mutex acquire aborted'));
|
|
5285
2601
|
}
|
|
5286
|
-
if (
|
|
5287
|
-
return;
|
|
5288
|
-
try {
|
|
5289
|
-
resolve(await callback());
|
|
2602
|
+
if (abort?.aborted) {
|
|
2603
|
+
return rejectAborted();
|
|
5290
2604
|
}
|
|
5291
|
-
|
|
5292
|
-
|
|
2605
|
+
let holdsMutex = false;
|
|
2606
|
+
const markCompleted = () => {
|
|
2607
|
+
if (!holdsMutex)
|
|
2608
|
+
return;
|
|
2609
|
+
holdsMutex = false;
|
|
2610
|
+
const waiter = this.firstWaiter;
|
|
2611
|
+
if (waiter) {
|
|
2612
|
+
this.deactivateWaiter(waiter);
|
|
2613
|
+
// Still in critical section, but owned by next waiter now.
|
|
2614
|
+
waiter.onAcquire();
|
|
2615
|
+
}
|
|
2616
|
+
else {
|
|
2617
|
+
this.inCriticalSection = false;
|
|
2618
|
+
}
|
|
2619
|
+
};
|
|
2620
|
+
if (!this.inCriticalSection) {
|
|
2621
|
+
this.inCriticalSection = true;
|
|
2622
|
+
holdsMutex = true;
|
|
2623
|
+
return resolve(markCompleted);
|
|
2624
|
+
}
|
|
2625
|
+
else {
|
|
2626
|
+
let node;
|
|
2627
|
+
const onAbort = () => {
|
|
2628
|
+
abort?.removeEventListener('abort', onAbort);
|
|
2629
|
+
if (node.isActive) {
|
|
2630
|
+
this.deactivateWaiter(node);
|
|
2631
|
+
rejectAborted();
|
|
2632
|
+
}
|
|
2633
|
+
};
|
|
2634
|
+
node = this.addWaiter(() => {
|
|
2635
|
+
abort?.removeEventListener('abort', onAbort);
|
|
2636
|
+
holdsMutex = true;
|
|
2637
|
+
resolve(markCompleted);
|
|
2638
|
+
});
|
|
2639
|
+
abort?.addEventListener('abort', onAbort);
|
|
5293
2640
|
}
|
|
5294
2641
|
});
|
|
5295
|
-
}
|
|
2642
|
+
}
|
|
2643
|
+
async runExclusive(fn, abort) {
|
|
2644
|
+
const returnMutex = await this.acquire(abort);
|
|
2645
|
+
try {
|
|
2646
|
+
return await fn();
|
|
2647
|
+
}
|
|
2648
|
+
finally {
|
|
2649
|
+
returnMutex();
|
|
2650
|
+
}
|
|
2651
|
+
}
|
|
2652
|
+
}
|
|
2653
|
+
function timeoutSignal(timeout) {
|
|
2654
|
+
if (timeout == null)
|
|
2655
|
+
return;
|
|
2656
|
+
if ('timeout' in AbortSignal)
|
|
2657
|
+
return AbortSignal.timeout(timeout);
|
|
2658
|
+
const controller = new AbortController();
|
|
2659
|
+
setTimeout(() => controller.abort(new Error('Timeout waiting for lock')), timeout);
|
|
2660
|
+
return controller.signal;
|
|
5296
2661
|
}
|
|
5297
2662
|
|
|
5298
2663
|
/**
|
|
@@ -5304,7 +2669,7 @@ class AttachmentService {
|
|
|
5304
2669
|
db;
|
|
5305
2670
|
logger;
|
|
5306
2671
|
tableName;
|
|
5307
|
-
mutex = new
|
|
2672
|
+
mutex = new Mutex();
|
|
5308
2673
|
context;
|
|
5309
2674
|
constructor(db, logger, tableName = 'attachments', archivedCacheLimit = 100) {
|
|
5310
2675
|
this.db = db;
|
|
@@ -5341,7 +2706,7 @@ class AttachmentService {
|
|
|
5341
2706
|
* Executes a callback with exclusive access to the attachment context.
|
|
5342
2707
|
*/
|
|
5343
2708
|
async withContext(callback) {
|
|
5344
|
-
return
|
|
2709
|
+
return this.mutex.runExclusive(async () => {
|
|
5345
2710
|
return callback(this.context);
|
|
5346
2711
|
});
|
|
5347
2712
|
}
|
|
@@ -5377,9 +2742,15 @@ class AttachmentQueue {
|
|
|
5377
2742
|
tableName;
|
|
5378
2743
|
/** Logger instance for diagnostic information */
|
|
5379
2744
|
logger;
|
|
5380
|
-
/** Interval in milliseconds between periodic sync operations.
|
|
2745
|
+
/** Interval in milliseconds between periodic sync operations. Acts as a polling timer to retry
|
|
2746
|
+
* failed uploads/downloads, especially after the app goes offline. Default: 30000 (30 seconds) */
|
|
5381
2747
|
syncIntervalMs = 30 * 1000;
|
|
5382
|
-
/**
|
|
2748
|
+
/** Throttle duration in milliseconds for the reactive watch query on the attachments table.
|
|
2749
|
+
* When attachment records change, a watch query detects the change and triggers a sync.
|
|
2750
|
+
* This throttle prevents the sync from firing too rapidly when many changes happen in
|
|
2751
|
+
* quick succession (e.g., bulk inserts). This is distinct from syncIntervalMs — it controls
|
|
2752
|
+
* how quickly the queue reacts to changes, while syncIntervalMs controls how often it polls
|
|
2753
|
+
* for retries. Default: 30 (from DEFAULT_WATCH_THROTTLE_MS) */
|
|
5383
2754
|
syncThrottleDuration;
|
|
5384
2755
|
/** Whether to automatically download remote attachments. Default: true */
|
|
5385
2756
|
downloadAttachments = true;
|
|
@@ -5403,8 +2774,8 @@ class AttachmentQueue {
|
|
|
5403
2774
|
* @param options.watchAttachments - Callback for monitoring attachment changes in your data model
|
|
5404
2775
|
* @param options.tableName - Name of the table to store attachment records. Default: 'ps_attachment_queue'
|
|
5405
2776
|
* @param options.logger - Logger instance. Defaults to db.logger
|
|
5406
|
-
* @param options.syncIntervalMs -
|
|
5407
|
-
* @param options.syncThrottleDuration - Throttle duration for
|
|
2777
|
+
* @param options.syncIntervalMs - Periodic polling interval in milliseconds for retrying failed uploads/downloads. Default: 30000
|
|
2778
|
+
* @param options.syncThrottleDuration - Throttle duration in milliseconds for the reactive watch query that detects attachment changes. Prevents rapid-fire syncs during bulk changes. Default: 30
|
|
5408
2779
|
* @param options.downloadAttachments - Whether to automatically download remote attachments. Default: true
|
|
5409
2780
|
* @param options.archivedCacheLimit - Maximum archived attachments before cleanup. Default: 100
|
|
5410
2781
|
*/
|
|
@@ -6165,6 +3536,49 @@ var Logger = /*@__PURE__*/getDefaultExportFromCjs(loggerExports);
|
|
|
6165
3536
|
* Set of generic interfaces to allow PowerSync compatibility with
|
|
6166
3537
|
* different SQLite DB implementations.
|
|
6167
3538
|
*/
|
|
3539
|
+
/**
|
|
3540
|
+
* Implements {@link DBGetUtils} on a {@link SqlRunner}.
|
|
3541
|
+
*/
|
|
3542
|
+
function DBGetUtilsDefaultMixin(Base) {
|
|
3543
|
+
return class extends Base {
|
|
3544
|
+
async getAll(sql, parameters) {
|
|
3545
|
+
const res = await this.execute(sql, parameters);
|
|
3546
|
+
return res.rows?._array ?? [];
|
|
3547
|
+
}
|
|
3548
|
+
async getOptional(sql, parameters) {
|
|
3549
|
+
const res = await this.execute(sql, parameters);
|
|
3550
|
+
return res.rows?.item(0) ?? null;
|
|
3551
|
+
}
|
|
3552
|
+
async get(sql, parameters) {
|
|
3553
|
+
const res = await this.execute(sql, parameters);
|
|
3554
|
+
const first = res.rows?.item(0);
|
|
3555
|
+
if (!first) {
|
|
3556
|
+
throw new Error('Result set is empty');
|
|
3557
|
+
}
|
|
3558
|
+
return first;
|
|
3559
|
+
}
|
|
3560
|
+
async executeBatch(query, params = []) {
|
|
3561
|
+
// If this context can run batch statements natively, use that.
|
|
3562
|
+
// @ts-ignore
|
|
3563
|
+
if (super.executeBatch) {
|
|
3564
|
+
// @ts-ignore
|
|
3565
|
+
return super.executeBatch(query, params);
|
|
3566
|
+
}
|
|
3567
|
+
// Emulate executeBatch by running statements individually.
|
|
3568
|
+
let lastInsertId;
|
|
3569
|
+
let rowsAffected = 0;
|
|
3570
|
+
for (const set of params) {
|
|
3571
|
+
const result = await this.execute(query, set);
|
|
3572
|
+
lastInsertId = result.insertId;
|
|
3573
|
+
rowsAffected += result.rowsAffected;
|
|
3574
|
+
}
|
|
3575
|
+
return {
|
|
3576
|
+
rowsAffected,
|
|
3577
|
+
insertId: lastInsertId
|
|
3578
|
+
};
|
|
3579
|
+
}
|
|
3580
|
+
};
|
|
3581
|
+
}
|
|
6168
3582
|
/**
|
|
6169
3583
|
* Update table operation numbers from SQLite
|
|
6170
3584
|
*/
|
|
@@ -6174,6 +3588,89 @@ var RowUpdateType;
|
|
|
6174
3588
|
RowUpdateType[RowUpdateType["SQLITE_DELETE"] = 9] = "SQLITE_DELETE";
|
|
6175
3589
|
RowUpdateType[RowUpdateType["SQLITE_UPDATE"] = 23] = "SQLITE_UPDATE";
|
|
6176
3590
|
})(RowUpdateType || (RowUpdateType = {}));
|
|
3591
|
+
/**
|
|
3592
|
+
* A mixin to implement {@link DBAdapter} by delegating to {@link ConnectionPool.readLock} and
|
|
3593
|
+
* {@link ConnectionPool.writeLock}.
|
|
3594
|
+
*/
|
|
3595
|
+
function DBAdapterDefaultMixin(Base) {
|
|
3596
|
+
return class extends Base {
|
|
3597
|
+
readTransaction(fn, options) {
|
|
3598
|
+
return this.readLock((ctx) => TransactionImplementation.runWith(ctx, fn), options);
|
|
3599
|
+
}
|
|
3600
|
+
writeTransaction(fn, options) {
|
|
3601
|
+
return this.writeLock((ctx) => TransactionImplementation.runWith(ctx, fn), options);
|
|
3602
|
+
}
|
|
3603
|
+
getAll(sql, parameters) {
|
|
3604
|
+
return this.readLock((ctx) => ctx.getAll(sql, parameters));
|
|
3605
|
+
}
|
|
3606
|
+
getOptional(sql, parameters) {
|
|
3607
|
+
return this.readLock((ctx) => ctx.getOptional(sql, parameters));
|
|
3608
|
+
}
|
|
3609
|
+
get(sql, parameters) {
|
|
3610
|
+
return this.readLock((ctx) => ctx.get(sql, parameters));
|
|
3611
|
+
}
|
|
3612
|
+
execute(query, params) {
|
|
3613
|
+
return this.writeLock((ctx) => ctx.execute(query, params));
|
|
3614
|
+
}
|
|
3615
|
+
executeRaw(query, params) {
|
|
3616
|
+
return this.writeLock((ctx) => ctx.executeRaw(query, params));
|
|
3617
|
+
}
|
|
3618
|
+
executeBatch(query, params) {
|
|
3619
|
+
return this.writeTransaction((tx) => tx.executeBatch(query, params));
|
|
3620
|
+
}
|
|
3621
|
+
};
|
|
3622
|
+
}
|
|
3623
|
+
class BaseTransaction {
|
|
3624
|
+
inner;
|
|
3625
|
+
finalized = false;
|
|
3626
|
+
constructor(inner) {
|
|
3627
|
+
this.inner = inner;
|
|
3628
|
+
}
|
|
3629
|
+
async commit() {
|
|
3630
|
+
if (this.finalized) {
|
|
3631
|
+
return { rowsAffected: 0 };
|
|
3632
|
+
}
|
|
3633
|
+
this.finalized = true;
|
|
3634
|
+
return this.inner.execute('COMMIT');
|
|
3635
|
+
}
|
|
3636
|
+
async rollback() {
|
|
3637
|
+
if (this.finalized) {
|
|
3638
|
+
return { rowsAffected: 0 };
|
|
3639
|
+
}
|
|
3640
|
+
this.finalized = true;
|
|
3641
|
+
return this.inner.execute('ROLLBACK');
|
|
3642
|
+
}
|
|
3643
|
+
execute(query, params) {
|
|
3644
|
+
return this.inner.execute(query, params);
|
|
3645
|
+
}
|
|
3646
|
+
executeRaw(query, params) {
|
|
3647
|
+
return this.inner.executeRaw(query, params);
|
|
3648
|
+
}
|
|
3649
|
+
executeBatch(query, params) {
|
|
3650
|
+
return this.inner.executeBatch(query, params);
|
|
3651
|
+
}
|
|
3652
|
+
}
|
|
3653
|
+
class TransactionImplementation extends DBGetUtilsDefaultMixin(BaseTransaction) {
|
|
3654
|
+
static async runWith(ctx, fn) {
|
|
3655
|
+
let tx = new TransactionImplementation(ctx);
|
|
3656
|
+
try {
|
|
3657
|
+
await ctx.execute('BEGIN IMMEDIATE');
|
|
3658
|
+
const result = await fn(tx);
|
|
3659
|
+
await tx.commit();
|
|
3660
|
+
return result;
|
|
3661
|
+
}
|
|
3662
|
+
catch (ex) {
|
|
3663
|
+
try {
|
|
3664
|
+
await tx.rollback();
|
|
3665
|
+
}
|
|
3666
|
+
catch (ex2) {
|
|
3667
|
+
// In rare cases, a rollback may fail.
|
|
3668
|
+
// Safe to ignore.
|
|
3669
|
+
}
|
|
3670
|
+
throw ex;
|
|
3671
|
+
}
|
|
3672
|
+
}
|
|
3673
|
+
}
|
|
6177
3674
|
function isBatchedUpdateNotification(update) {
|
|
6178
3675
|
return 'tables' in update;
|
|
6179
3676
|
}
|
|
@@ -14939,7 +12436,7 @@ function requireDist () {
|
|
|
14939
12436
|
|
|
14940
12437
|
var distExports = requireDist();
|
|
14941
12438
|
|
|
14942
|
-
var version = "1.
|
|
12439
|
+
var version = "1.50.0";
|
|
14943
12440
|
var PACKAGE = {
|
|
14944
12441
|
version: version};
|
|
14945
12442
|
|
|
@@ -16972,7 +14469,7 @@ class TriggerManagerImpl {
|
|
|
16972
14469
|
}
|
|
16973
14470
|
async createDiffTrigger(options) {
|
|
16974
14471
|
await this.db.waitForReady();
|
|
16975
|
-
const { source, destination, columns, when, hooks,
|
|
14472
|
+
const { source, destination, columns, when, hooks, setupContext,
|
|
16976
14473
|
// Fall back to the provided default if not given on this level
|
|
16977
14474
|
useStorage = this.defaultConfig.useStorageByDefault } = options;
|
|
16978
14475
|
const operations = Object.keys(when);
|
|
@@ -17027,13 +14524,20 @@ class TriggerManagerImpl {
|
|
|
17027
14524
|
* we need to ensure we can cleanup the created resources.
|
|
17028
14525
|
* We unfortunately cannot rely on transaction rollback.
|
|
17029
14526
|
*/
|
|
17030
|
-
const cleanup = async () => {
|
|
14527
|
+
const cleanup = async (options) => {
|
|
14528
|
+
const { context } = options ?? {};
|
|
17031
14529
|
disposeWarningListener();
|
|
17032
|
-
|
|
14530
|
+
const doCleanup = async (tx) => {
|
|
17033
14531
|
await this.removeTriggers(tx, triggerIds);
|
|
17034
|
-
await tx.execute(
|
|
14532
|
+
await tx.execute(`DROP TABLE IF EXISTS ${destination};`);
|
|
17035
14533
|
await releaseStorageClaim?.();
|
|
17036
|
-
}
|
|
14534
|
+
};
|
|
14535
|
+
if (context) {
|
|
14536
|
+
await doCleanup(context);
|
|
14537
|
+
}
|
|
14538
|
+
else {
|
|
14539
|
+
await this.db.writeLock(doCleanup);
|
|
14540
|
+
}
|
|
17037
14541
|
};
|
|
17038
14542
|
const setup = async (tx) => {
|
|
17039
14543
|
// Allow user code to execute in this lock context before the trigger is created.
|
|
@@ -17107,12 +14611,17 @@ class TriggerManagerImpl {
|
|
|
17107
14611
|
}
|
|
17108
14612
|
};
|
|
17109
14613
|
try {
|
|
17110
|
-
|
|
14614
|
+
if (setupContext) {
|
|
14615
|
+
await setup(setupContext);
|
|
14616
|
+
}
|
|
14617
|
+
else {
|
|
14618
|
+
await this.db.writeLock(setup);
|
|
14619
|
+
}
|
|
17111
14620
|
return cleanup;
|
|
17112
14621
|
}
|
|
17113
14622
|
catch (error) {
|
|
17114
14623
|
try {
|
|
17115
|
-
await cleanup();
|
|
14624
|
+
await cleanup(setupContext ? { context: setupContext } : undefined);
|
|
17116
14625
|
}
|
|
17117
14626
|
catch (cleanupError) {
|
|
17118
14627
|
throw new AggregateError([error, cleanupError], 'Error during operation and cleanup');
|
|
@@ -17319,7 +14828,7 @@ class AbstractPowerSyncDatabase extends BaseObserver {
|
|
|
17319
14828
|
this._schema = schema;
|
|
17320
14829
|
this.ready = false;
|
|
17321
14830
|
this.sdkVersion = '';
|
|
17322
|
-
this.runExclusiveMutex = new
|
|
14831
|
+
this.runExclusiveMutex = new Mutex();
|
|
17323
14832
|
// Start async init
|
|
17324
14833
|
this.subscriptions = {
|
|
17325
14834
|
firstStatusMatching: (predicate, abort) => this.waitForStatus(predicate, abort),
|
|
@@ -17784,6 +15293,10 @@ SELECT * FROM crud_entries;
|
|
|
17784
15293
|
* Execute a SQL write (INSERT/UPDATE/DELETE) query
|
|
17785
15294
|
* and optionally return results.
|
|
17786
15295
|
*
|
|
15296
|
+
* When using the default client-side [JSON-based view system](https://docs.powersync.com/architecture/client-architecture#client-side-schema-and-sqlite-database-structure),
|
|
15297
|
+
* the returned result's `rowsAffected` may be `0` for successful `UPDATE` and `DELETE` statements.
|
|
15298
|
+
* Use a `RETURNING` clause and inspect `result.rows` when you need to confirm which rows changed.
|
|
15299
|
+
*
|
|
17787
15300
|
* @param sql The SQL query to execute
|
|
17788
15301
|
* @param parameters Optional array of parameters to bind to the query
|
|
17789
15302
|
* @returns The query result as an object with structured key-value pairs
|
|
@@ -17880,7 +15393,7 @@ SELECT * FROM crud_entries;
|
|
|
17880
15393
|
async readTransaction(callback, lockTimeout = DEFAULT_LOCK_TIMEOUT_MS) {
|
|
17881
15394
|
await this.waitForReady();
|
|
17882
15395
|
return this.database.readTransaction(async (tx) => {
|
|
17883
|
-
const res = await callback(
|
|
15396
|
+
const res = await callback(tx);
|
|
17884
15397
|
await tx.rollback();
|
|
17885
15398
|
return res;
|
|
17886
15399
|
}, { timeoutMs: lockTimeout });
|
|
@@ -18986,7 +16499,7 @@ const parseQuery = (query, parameters) => {
|
|
|
18986
16499
|
/******/
|
|
18987
16500
|
/******/ /* webpack/runtime/importScripts chunk loading */
|
|
18988
16501
|
/******/ (() => {
|
|
18989
|
-
/******/
|
|
16502
|
+
/******/ // no baseURI
|
|
18990
16503
|
/******/
|
|
18991
16504
|
/******/ // object to store loaded chunks
|
|
18992
16505
|
/******/ // "1" means "already loaded"
|