@powersync/web 1.36.0 → 1.37.1
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 +1127 -1235
- package/dist/index.umd.js.map +1 -1
- package/dist/worker/SharedSyncImplementation.umd.js +550 -3089
- package/dist/worker/SharedSyncImplementation.umd.js.map +1 -1
- package/dist/worker/WASQLiteDB.umd.js +797 -854
- 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 -1881
- 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 -404
- 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 -489
- 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,2723 +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
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
/**
|
|
2431
|
-
* @internal
|
|
2432
|
-
* Wraps a {@link AsyncDatabaseConnection} and provides exclusive locking functions in
|
|
2433
|
-
* order to implement {@link DBAdapter}.
|
|
2434
|
-
*/
|
|
2435
|
-
class LockedAsyncDatabaseAdapter extends _powersync_common__WEBPACK_IMPORTED_MODULE_0__.BaseObserver {
|
|
2436
|
-
options;
|
|
2437
|
-
logger;
|
|
2438
|
-
dbGetHelpers;
|
|
2439
|
-
debugMode;
|
|
2440
|
-
_dbIdentifier;
|
|
2441
|
-
initPromise;
|
|
2442
|
-
_db = null;
|
|
2443
|
-
_disposeTableChangeListener = null;
|
|
2444
|
-
_config = null;
|
|
2445
|
-
pendingAbortControllers;
|
|
2446
|
-
requiresHolds;
|
|
2447
|
-
databaseOpenPromise = null;
|
|
2448
|
-
closing;
|
|
2449
|
-
closed;
|
|
2450
|
-
constructor(options) {
|
|
2451
|
-
super();
|
|
2452
|
-
this.options = options;
|
|
2453
|
-
this._dbIdentifier = options.name;
|
|
2454
|
-
this.logger = options.logger ?? (0,_powersync_common__WEBPACK_IMPORTED_MODULE_0__.createLogger)(`LockedAsyncDatabaseAdapter - ${this._dbIdentifier}`);
|
|
2455
|
-
this.pendingAbortControllers = new Set();
|
|
2456
|
-
this.closed = false;
|
|
2457
|
-
this.closing = false;
|
|
2458
|
-
this.requiresHolds = null;
|
|
2459
|
-
// Set the name if provided. We can query for the name if not available yet
|
|
2460
|
-
this.debugMode = options.debugMode ?? false;
|
|
2461
|
-
if (this.debugMode) {
|
|
2462
|
-
const originalExecute = this._execute.bind(this);
|
|
2463
|
-
this._execute = async (sql, bindings) => {
|
|
2464
|
-
const start = performance.now();
|
|
2465
|
-
try {
|
|
2466
|
-
const r = await originalExecute(sql, bindings);
|
|
2467
|
-
performance.measure(`[SQL] ${sql}`, { start });
|
|
2468
|
-
return r;
|
|
2469
|
-
}
|
|
2470
|
-
catch (e) {
|
|
2471
|
-
performance.measure(`[SQL] [ERROR: ${e.message}] ${sql}`, { start });
|
|
2472
|
-
throw e;
|
|
2473
|
-
}
|
|
2474
|
-
};
|
|
2475
|
-
}
|
|
2476
|
-
this.dbGetHelpers = this.generateDBHelpers({
|
|
2477
|
-
execute: (query, params) => this.acquireLock(() => this._execute(query, params)),
|
|
2478
|
-
executeRaw: (query, params) => this.acquireLock(() => this._executeRaw(query, params)),
|
|
2479
|
-
executeBatch: (query, params) => this.acquireLock(() => this._executeBatch(query, params))
|
|
2480
|
-
});
|
|
2481
|
-
this.initPromise = this._init();
|
|
2482
|
-
}
|
|
2483
|
-
get baseDB() {
|
|
2484
|
-
if (!this._db) {
|
|
2485
|
-
throw new Error(`Initialization has not completed yet. Cannot access base db`);
|
|
2486
|
-
}
|
|
2487
|
-
return this._db;
|
|
2488
|
-
}
|
|
2489
|
-
get name() {
|
|
2490
|
-
return this._dbIdentifier;
|
|
2491
|
-
}
|
|
2492
|
-
/**
|
|
2493
|
-
* Init is automatic, this helps catch errors or explicitly await initialization
|
|
2494
|
-
*/
|
|
2495
|
-
async init() {
|
|
2496
|
-
return this.initPromise;
|
|
2497
|
-
}
|
|
2498
|
-
async openInternalDB() {
|
|
2499
|
-
/**
|
|
2500
|
-
* Execute opening of the db in a lock in order not to interfere with other operations.
|
|
2501
|
-
*/
|
|
2502
|
-
return this._acquireLock(async () => {
|
|
2503
|
-
// Dispose any previous table change listener.
|
|
2504
|
-
this._disposeTableChangeListener?.();
|
|
2505
|
-
this._disposeTableChangeListener = null;
|
|
2506
|
-
this._db?.close().catch((ex) => this.logger.warn(`Error closing database before opening new instance`, ex));
|
|
2507
|
-
const isReOpen = !!this._db;
|
|
2508
|
-
this._db = null;
|
|
2509
|
-
this._db = await this.options.openConnection();
|
|
2510
|
-
await this._db.init();
|
|
2511
|
-
this._config = await this._db.getConfig();
|
|
2512
|
-
await this.registerOnChangeListener(this._db);
|
|
2513
|
-
if (isReOpen) {
|
|
2514
|
-
this.iterateListeners((cb) => cb.databaseReOpened?.());
|
|
2515
|
-
}
|
|
2516
|
-
/**
|
|
2517
|
-
* This is only required for the long-lived shared IndexedDB connections.
|
|
2518
|
-
*/
|
|
2519
|
-
this.requiresHolds = this._config.vfs == _wa_sqlite_WASQLiteConnection_js__WEBPACK_IMPORTED_MODULE_3__.WASQLiteVFS.IDBBatchAtomicVFS;
|
|
2520
|
-
});
|
|
2521
|
-
}
|
|
2522
|
-
_reOpen() {
|
|
2523
|
-
this.databaseOpenPromise = this.openInternalDB().finally(() => {
|
|
2524
|
-
this.databaseOpenPromise = null;
|
|
2525
|
-
});
|
|
2526
|
-
return this.databaseOpenPromise;
|
|
2527
|
-
}
|
|
2528
|
-
/**
|
|
2529
|
-
* Re-opens the underlying database.
|
|
2530
|
-
* Returns a pending operation if one is already in progress.
|
|
2531
|
-
*/
|
|
2532
|
-
async reOpenInternalDB() {
|
|
2533
|
-
if (this.closing || !this.options.reOpenOnConnectionClosed) {
|
|
2534
|
-
// No-op
|
|
2535
|
-
return;
|
|
2536
|
-
}
|
|
2537
|
-
else if (this.databaseOpenPromise) {
|
|
2538
|
-
// Already busy opening
|
|
2539
|
-
return this.databaseOpenPromise;
|
|
2540
|
-
}
|
|
2541
|
-
else {
|
|
2542
|
-
return this._reOpen();
|
|
2543
|
-
}
|
|
2544
|
-
}
|
|
2545
|
-
async _init() {
|
|
2546
|
-
/**
|
|
2547
|
-
* For OPFS, we can see this open call sometimes fail due to NoModificationAllowedError.
|
|
2548
|
-
* We should be able to recover from this by re-opening the database.
|
|
2549
|
-
*/
|
|
2550
|
-
const maxAttempts = 3;
|
|
2551
|
-
for (let count = 0; count < maxAttempts; count++) {
|
|
2552
|
-
try {
|
|
2553
|
-
await this.openInternalDB();
|
|
2554
|
-
break;
|
|
2555
|
-
}
|
|
2556
|
-
catch (ex) {
|
|
2557
|
-
if (count == maxAttempts - 1) {
|
|
2558
|
-
throw ex;
|
|
2559
|
-
}
|
|
2560
|
-
this.logger.warn(`Attempt ${count + 1} of ${maxAttempts} to open database failed, retrying in 1 second...`, ex);
|
|
2561
|
-
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
2562
|
-
}
|
|
2563
|
-
}
|
|
2564
|
-
this.iterateListeners((cb) => cb.initialized?.());
|
|
2565
|
-
}
|
|
2566
|
-
getConfiguration() {
|
|
2567
|
-
if (!this._config) {
|
|
2568
|
-
throw new Error(`Cannot get config before initialization is completed`);
|
|
2569
|
-
}
|
|
2570
|
-
return {
|
|
2571
|
-
...this._config,
|
|
2572
|
-
// This can be overridden by the adapter later
|
|
2573
|
-
requiresPersistentTriggers: false
|
|
2574
|
-
};
|
|
2575
|
-
}
|
|
2576
|
-
async waitForInitialized() {
|
|
2577
|
-
// Awaiting this will expose errors on function calls like .execute etc
|
|
2578
|
-
await this.initPromise;
|
|
2579
|
-
}
|
|
2580
|
-
async shareConnection() {
|
|
2581
|
-
if (false == this._db instanceof _WorkerWrappedAsyncDatabaseConnection_js__WEBPACK_IMPORTED_MODULE_2__.WorkerWrappedAsyncDatabaseConnection) {
|
|
2582
|
-
throw new Error(`Only worker connections can be shared`);
|
|
2583
|
-
}
|
|
2584
|
-
return this._db.shareConnection();
|
|
2585
|
-
}
|
|
2586
|
-
/**
|
|
2587
|
-
* Registers a table change notification callback with the base database.
|
|
2588
|
-
* This can be extended by custom implementations in order to handle proxy events.
|
|
2589
|
-
*/
|
|
2590
|
-
async registerOnChangeListener(db) {
|
|
2591
|
-
this._disposeTableChangeListener = await db.registerOnTableChange((event) => {
|
|
2592
|
-
this.iterateListeners((cb) => cb.tablesUpdated?.(event));
|
|
2593
|
-
});
|
|
2594
|
-
}
|
|
2595
|
-
/**
|
|
2596
|
-
* This is currently a no-op on web
|
|
2597
|
-
*/
|
|
2598
|
-
async refreshSchema() { }
|
|
2599
|
-
async execute(query, params) {
|
|
2600
|
-
return this.writeLock((ctx) => ctx.execute(query, params));
|
|
2601
|
-
}
|
|
2602
|
-
async executeRaw(query, params) {
|
|
2603
|
-
return this.writeLock((ctx) => ctx.executeRaw(query, params));
|
|
2604
|
-
}
|
|
2605
|
-
async executeBatch(query, params) {
|
|
2606
|
-
return this.writeLock((ctx) => this._executeBatch(query, params));
|
|
2607
|
-
}
|
|
2608
|
-
/**
|
|
2609
|
-
* Attempts to close the connection.
|
|
2610
|
-
* Shared workers might not actually close the connection if other
|
|
2611
|
-
* tabs are still using it.
|
|
2612
|
-
*/
|
|
2613
|
-
async close() {
|
|
2614
|
-
this.closing = true;
|
|
2615
|
-
/**
|
|
2616
|
-
* Note that we obtain a reference to the callback to avoid calling the callback with `this` as the context.
|
|
2617
|
-
* This is to avoid Comlink attempting to clone `this` when calling the method.
|
|
2618
|
-
*/
|
|
2619
|
-
const dispose = this._disposeTableChangeListener;
|
|
2620
|
-
if (dispose) {
|
|
2621
|
-
dispose();
|
|
2622
|
-
}
|
|
2623
|
-
this.pendingAbortControllers.forEach((controller) => controller.abort('Closed'));
|
|
2624
|
-
await this.baseDB?.close?.();
|
|
2625
|
-
this.closed = true;
|
|
2626
|
-
}
|
|
2627
|
-
async getAll(sql, parameters) {
|
|
2628
|
-
await this.waitForInitialized();
|
|
2629
|
-
return this.dbGetHelpers.getAll(sql, parameters);
|
|
2630
|
-
}
|
|
2631
|
-
async getOptional(sql, parameters) {
|
|
2632
|
-
await this.waitForInitialized();
|
|
2633
|
-
return this.dbGetHelpers.getOptional(sql, parameters);
|
|
2634
|
-
}
|
|
2635
|
-
async get(sql, parameters) {
|
|
2636
|
-
await this.waitForInitialized();
|
|
2637
|
-
return this.dbGetHelpers.get(sql, parameters);
|
|
2638
|
-
}
|
|
2639
|
-
async readLock(fn, options) {
|
|
2640
|
-
// Read and write locks are the same because we only have one underlying connection.
|
|
2641
|
-
return this.writeLock(fn, options);
|
|
2642
|
-
}
|
|
2643
|
-
async writeLock(fn, options) {
|
|
2644
|
-
await this.waitForInitialized();
|
|
2645
|
-
return this.acquireLock(async () => fn(this.generateDBHelpers({
|
|
2646
|
-
execute: this._execute,
|
|
2647
|
-
executeRaw: this._executeRaw,
|
|
2648
|
-
executeBatch: this._executeBatch
|
|
2649
|
-
})), {
|
|
2650
|
-
timeoutMs: options?.timeoutMs ?? this.options.defaultLockTimeoutMs
|
|
2651
|
-
});
|
|
2652
|
-
}
|
|
2653
|
-
async _acquireLock(callback, options) {
|
|
2654
|
-
if (this.closing) {
|
|
2655
|
-
throw new Error(`Cannot acquire lock, the database is closing`);
|
|
2656
|
-
}
|
|
2657
|
-
const abortController = new AbortController();
|
|
2658
|
-
this.pendingAbortControllers.add(abortController);
|
|
2659
|
-
const { timeoutMs } = options ?? {};
|
|
2660
|
-
const timeoutId = timeoutMs
|
|
2661
|
-
? setTimeout(() => {
|
|
2662
|
-
abortController.abort(`Timeout after ${timeoutMs}ms`);
|
|
2663
|
-
this.pendingAbortControllers.delete(abortController);
|
|
2664
|
-
}, timeoutMs)
|
|
2665
|
-
: null;
|
|
2666
|
-
return (0,_shared_navigator_js__WEBPACK_IMPORTED_MODULE_1__.getNavigatorLocks)().request(`db-lock-${this._dbIdentifier}`, { signal: abortController.signal }, async () => {
|
|
2667
|
-
this.pendingAbortControllers.delete(abortController);
|
|
2668
|
-
if (timeoutId) {
|
|
2669
|
-
clearTimeout(timeoutId);
|
|
2670
|
-
}
|
|
2671
|
-
return await callback();
|
|
2672
|
-
});
|
|
2673
|
-
}
|
|
2674
|
-
async acquireLock(callback, options) {
|
|
2675
|
-
await this.waitForInitialized();
|
|
2676
|
-
// The database is being (re)opened in the background. Wait for it here.
|
|
2677
|
-
if (this.databaseOpenPromise) {
|
|
2678
|
-
await this.databaseOpenPromise;
|
|
2679
|
-
}
|
|
2680
|
-
else if (!this._db) {
|
|
2681
|
-
/**
|
|
2682
|
-
* The database is not open anymore, we might need to re-open it.
|
|
2683
|
-
* Typically, _db, can be `null` if we tried to reOpen the database, but failed to succeed in re-opening.
|
|
2684
|
-
* This can happen when disconnecting the client.
|
|
2685
|
-
* Note: It is safe to re-enter this method multiple times.
|
|
2686
|
-
*/
|
|
2687
|
-
await this.reOpenInternalDB();
|
|
2688
|
-
}
|
|
2689
|
-
return this._acquireLock(async () => {
|
|
2690
|
-
let holdId = null;
|
|
2691
|
-
try {
|
|
2692
|
-
/**
|
|
2693
|
-
* We can't await this since it uses the same lock as we're in now.
|
|
2694
|
-
* If there is a pending open, this call will throw.
|
|
2695
|
-
* If there is no pending open, but there is also no database - the open
|
|
2696
|
-
* might have failed. We need to re-open the database.
|
|
2697
|
-
*/
|
|
2698
|
-
if (this.databaseOpenPromise || !this._db) {
|
|
2699
|
-
throw new _powersync_common__WEBPACK_IMPORTED_MODULE_0__.ConnectionClosedError('Connection is busy re-opening');
|
|
2700
|
-
}
|
|
2701
|
-
holdId = this.requiresHolds ? await this.baseDB.markHold() : null;
|
|
2702
|
-
return await callback();
|
|
2703
|
-
}
|
|
2704
|
-
catch (ex) {
|
|
2705
|
-
if (_powersync_common__WEBPACK_IMPORTED_MODULE_0__.ConnectionClosedError.MATCHES(ex)) {
|
|
2706
|
-
// Immediately re-open the database. We need to miss as little table updates as possible.
|
|
2707
|
-
// Note, don't await this since it uses the same lock as we're in now.
|
|
2708
|
-
this.reOpenInternalDB();
|
|
2709
|
-
}
|
|
2710
|
-
throw ex;
|
|
2711
|
-
}
|
|
2712
|
-
finally {
|
|
2713
|
-
if (holdId) {
|
|
2714
|
-
await this.baseDB.releaseHold(holdId);
|
|
2715
|
-
}
|
|
2716
|
-
}
|
|
2717
|
-
}, options);
|
|
2718
|
-
}
|
|
2719
|
-
async readTransaction(fn, options) {
|
|
2720
|
-
return this.readLock(this.wrapTransaction(fn));
|
|
2721
|
-
}
|
|
2722
|
-
writeTransaction(fn, options) {
|
|
2723
|
-
return this.writeLock(this.wrapTransaction(fn, true));
|
|
2724
|
-
}
|
|
2725
|
-
generateDBHelpers(tx) {
|
|
2726
|
-
return {
|
|
2727
|
-
...tx,
|
|
2728
|
-
/**
|
|
2729
|
-
* Execute a read-only query and return results
|
|
2730
|
-
*/
|
|
2731
|
-
async getAll(sql, parameters) {
|
|
2732
|
-
const res = await tx.execute(sql, parameters);
|
|
2733
|
-
return res.rows?._array ?? [];
|
|
2734
|
-
},
|
|
2735
|
-
/**
|
|
2736
|
-
* Execute a read-only query and return the first result, or null if the ResultSet is empty.
|
|
2737
|
-
*/
|
|
2738
|
-
async getOptional(sql, parameters) {
|
|
2739
|
-
const res = await tx.execute(sql, parameters);
|
|
2740
|
-
return res.rows?.item(0) ?? null;
|
|
2741
|
-
},
|
|
2742
|
-
/**
|
|
2743
|
-
* Execute a read-only query and return the first result, error if the ResultSet is empty.
|
|
2744
|
-
*/
|
|
2745
|
-
async get(sql, parameters) {
|
|
2746
|
-
const res = await tx.execute(sql, parameters);
|
|
2747
|
-
const first = res.rows?.item(0);
|
|
2748
|
-
if (!first) {
|
|
2749
|
-
throw new Error('Result set is empty');
|
|
2750
|
-
}
|
|
2751
|
-
return first;
|
|
2752
|
-
}
|
|
2753
|
-
};
|
|
2754
|
-
}
|
|
2755
|
-
/**
|
|
2756
|
-
* Wraps a lock context into a transaction context
|
|
2757
|
-
*/
|
|
2758
|
-
wrapTransaction(cb, write = false) {
|
|
2759
|
-
return async (tx) => {
|
|
2760
|
-
await this._execute(write ? 'BEGIN EXCLUSIVE' : 'BEGIN');
|
|
2761
|
-
let finalized = false;
|
|
2762
|
-
const commit = async () => {
|
|
2763
|
-
if (finalized) {
|
|
2764
|
-
return { rowsAffected: 0 };
|
|
2765
|
-
}
|
|
2766
|
-
finalized = true;
|
|
2767
|
-
return this._execute('COMMIT');
|
|
2768
|
-
};
|
|
2769
|
-
const rollback = () => {
|
|
2770
|
-
finalized = true;
|
|
2771
|
-
return this._execute('ROLLBACK');
|
|
2772
|
-
};
|
|
2773
|
-
try {
|
|
2774
|
-
const result = await cb({
|
|
2775
|
-
...tx,
|
|
2776
|
-
commit,
|
|
2777
|
-
rollback
|
|
2778
|
-
});
|
|
2779
|
-
if (!finalized) {
|
|
2780
|
-
await commit();
|
|
2781
|
-
}
|
|
2782
|
-
return result;
|
|
2783
|
-
}
|
|
2784
|
-
catch (ex) {
|
|
2785
|
-
this.logger.debug('Caught ex in transaction', ex);
|
|
2786
|
-
try {
|
|
2787
|
-
await rollback();
|
|
2788
|
-
}
|
|
2789
|
-
catch (ex2) {
|
|
2790
|
-
// In rare cases, a rollback may fail.
|
|
2791
|
-
// Safe to ignore.
|
|
2792
|
-
}
|
|
2793
|
-
throw ex;
|
|
2794
|
-
}
|
|
2795
|
-
};
|
|
2796
|
-
}
|
|
2797
|
-
/**
|
|
2798
|
-
* Wraps the worker execute function, awaiting for it to be available
|
|
2799
|
-
*/
|
|
2800
|
-
_execute = async (sql, bindings) => {
|
|
2801
|
-
await this.waitForInitialized();
|
|
2802
|
-
const result = await this.baseDB.execute(sql, bindings);
|
|
2803
|
-
return {
|
|
2804
|
-
...result,
|
|
2805
|
-
rows: {
|
|
2806
|
-
...result.rows,
|
|
2807
|
-
item: (idx) => result.rows._array[idx]
|
|
2808
|
-
}
|
|
2809
|
-
};
|
|
2810
|
-
};
|
|
2811
|
-
/**
|
|
2812
|
-
* Wraps the worker executeRaw function, awaiting for it to be available
|
|
2813
|
-
*/
|
|
2814
|
-
_executeRaw = async (sql, bindings) => {
|
|
2815
|
-
await this.waitForInitialized();
|
|
2816
|
-
return await this.baseDB.executeRaw(sql, bindings);
|
|
2817
|
-
};
|
|
2818
|
-
/**
|
|
2819
|
-
* Wraps the worker executeBatch function, awaiting for it to be available
|
|
2820
|
-
*/
|
|
2821
|
-
_executeBatch = async (query, params) => {
|
|
2822
|
-
await this.waitForInitialized();
|
|
2823
|
-
const result = await this.baseDB.executeBatch(query, params);
|
|
2824
|
-
return {
|
|
2825
|
-
...result,
|
|
2826
|
-
rows: undefined
|
|
2827
|
-
};
|
|
2828
|
-
};
|
|
2829
|
-
}
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
/***/ },
|
|
2833
|
-
|
|
2834
|
-
/***/ "./lib/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.js"
|
|
2835
|
-
/*!*********************************************************************!*\
|
|
2836
|
-
!*** ./lib/src/db/adapters/WorkerWrappedAsyncDatabaseConnection.js ***!
|
|
2837
|
-
\*********************************************************************/
|
|
2838
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
2839
|
-
|
|
2840
|
-
__webpack_require__.r(__webpack_exports__);
|
|
2841
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
2842
|
-
/* harmony export */ WorkerWrappedAsyncDatabaseConnection: () => (/* binding */ WorkerWrappedAsyncDatabaseConnection)
|
|
2843
|
-
/* harmony export */ });
|
|
2844
|
-
/* harmony import */ var _powersync_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @powersync/common */ "../common/dist/bundle.mjs");
|
|
2845
|
-
/* 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");
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
/**
|
|
2849
|
-
* Wraps a provided instance of {@link AsyncDatabaseConnection}, providing necessary proxy
|
|
2850
|
-
* functions for worker listeners.
|
|
2851
|
-
*/
|
|
2852
|
-
class WorkerWrappedAsyncDatabaseConnection extends _powersync_common__WEBPACK_IMPORTED_MODULE_0__.BaseObserver {
|
|
2853
|
-
options;
|
|
2854
|
-
lockAbortController = new AbortController();
|
|
2855
|
-
notifyRemoteClosed;
|
|
2856
|
-
constructor(options) {
|
|
2857
|
-
super();
|
|
2858
|
-
this.options = options;
|
|
2859
|
-
if (options.remoteCanCloseUnexpectedly) {
|
|
2860
|
-
this.notifyRemoteClosed = new AbortController();
|
|
2861
|
-
}
|
|
2862
|
-
}
|
|
2863
|
-
get baseConnection() {
|
|
2864
|
-
return this.options.baseConnection;
|
|
2865
|
-
}
|
|
2866
|
-
init() {
|
|
2867
|
-
return this.baseConnection.init();
|
|
2868
|
-
}
|
|
2869
|
-
/**
|
|
2870
|
-
* Marks the remote as closed.
|
|
2871
|
-
*
|
|
2872
|
-
* This can sometimes happen outside of our control, e.g. when a shared worker requests a connection from a tab. When
|
|
2873
|
-
* it happens, all methods on the {@link baseConnection} would never resolve. To avoid livelocks in this scenario, we
|
|
2874
|
-
* throw on all outstanding promises and forbid new calls.
|
|
2875
|
-
*/
|
|
2876
|
-
markRemoteClosed() {
|
|
2877
|
-
// Can non-null assert here because this function is only supposed to be called when remoteCanCloseUnexpectedly was
|
|
2878
|
-
// set.
|
|
2879
|
-
this.notifyRemoteClosed.abort();
|
|
2880
|
-
}
|
|
2881
|
-
markHold() {
|
|
2882
|
-
return this.withRemote(() => this.baseConnection.markHold());
|
|
2883
|
-
}
|
|
2884
|
-
releaseHold(holdId) {
|
|
2885
|
-
return this.withRemote(() => this.baseConnection.releaseHold(holdId));
|
|
2886
|
-
}
|
|
2887
|
-
isAutoCommit() {
|
|
2888
|
-
return this.withRemote(() => this.baseConnection.isAutoCommit());
|
|
2889
|
-
}
|
|
2890
|
-
withRemote(workerPromise, fireActionOnAbort = false) {
|
|
2891
|
-
const controller = this.notifyRemoteClosed;
|
|
2892
|
-
if (controller) {
|
|
2893
|
-
return new Promise((resolve, reject) => {
|
|
2894
|
-
if (controller.signal.aborted) {
|
|
2895
|
-
reject(new _powersync_common__WEBPACK_IMPORTED_MODULE_0__.ConnectionClosedError('Called operation on closed remote'));
|
|
2896
|
-
if (!fireActionOnAbort) {
|
|
2897
|
-
// Don't run the operation if we're going to reject
|
|
2898
|
-
// We might want to fire-and-forget the operation in some cases (like a close operation)
|
|
2899
|
-
return;
|
|
2900
|
-
}
|
|
2901
|
-
}
|
|
2902
|
-
function handleAbort() {
|
|
2903
|
-
reject(new _powersync_common__WEBPACK_IMPORTED_MODULE_0__.ConnectionClosedError('Remote peer closed with request in flight'));
|
|
2904
|
-
}
|
|
2905
|
-
function completePromise(action) {
|
|
2906
|
-
controller.signal.removeEventListener('abort', handleAbort);
|
|
2907
|
-
action();
|
|
2908
|
-
}
|
|
2909
|
-
controller.signal.addEventListener('abort', handleAbort);
|
|
2910
|
-
workerPromise()
|
|
2911
|
-
.then((data) => completePromise(() => resolve(data)))
|
|
2912
|
-
.catch((e) => completePromise(() => reject(e)));
|
|
2913
|
-
});
|
|
2914
|
-
}
|
|
2915
|
-
else {
|
|
2916
|
-
// Can't close, so just return the inner worker promise unguarded.
|
|
2917
|
-
return workerPromise();
|
|
2918
|
-
}
|
|
2919
|
-
}
|
|
2920
|
-
/**
|
|
2921
|
-
* Get a MessagePort which can be used to share the internals of this connection.
|
|
2922
|
-
*/
|
|
2923
|
-
async shareConnection() {
|
|
2924
|
-
const { identifier, remote } = this.options;
|
|
2925
|
-
/**
|
|
2926
|
-
* Hold a navigator lock in order to avoid features such as Chrome's frozen tabs,
|
|
2927
|
-
* or Edge's sleeping tabs from pausing the thread for this connection.
|
|
2928
|
-
* This promise resolves once a lock is obtained.
|
|
2929
|
-
* This lock will be held as long as this connection is open.
|
|
2930
|
-
* The `shareConnection` method should not be called on multiple tabs concurrently.
|
|
2931
|
-
*/
|
|
2932
|
-
await new Promise((resolve, reject) => navigator.locks
|
|
2933
|
-
.request(`shared-connection-${this.options.identifier}-${Date.now()}-${Math.round(Math.random() * 10000)}`, {
|
|
2934
|
-
signal: this.lockAbortController.signal
|
|
2935
|
-
}, async () => {
|
|
2936
|
-
resolve();
|
|
2937
|
-
// Free the lock when the connection is already closed.
|
|
2938
|
-
if (this.lockAbortController.signal.aborted) {
|
|
2939
|
-
return;
|
|
2940
|
-
}
|
|
2941
|
-
// Hold the lock while the shared connection is in use.
|
|
2942
|
-
await new Promise((releaseLock) => {
|
|
2943
|
-
this.lockAbortController.signal.addEventListener('abort', () => {
|
|
2944
|
-
releaseLock();
|
|
2945
|
-
});
|
|
2946
|
-
});
|
|
2947
|
-
})
|
|
2948
|
-
// We aren't concerned with abort errors here
|
|
2949
|
-
.catch((ex) => {
|
|
2950
|
-
if (ex.name == 'AbortError') {
|
|
2951
|
-
resolve();
|
|
2952
|
-
}
|
|
2953
|
-
else {
|
|
2954
|
-
reject(ex);
|
|
2955
|
-
}
|
|
2956
|
-
}));
|
|
2957
|
-
const newPort = await remote[comlink__WEBPACK_IMPORTED_MODULE_1__.createEndpoint]();
|
|
2958
|
-
return { port: newPort, identifier };
|
|
2959
|
-
}
|
|
2960
|
-
/**
|
|
2961
|
-
* Registers a table change notification callback with the base database.
|
|
2962
|
-
* This can be extended by custom implementations in order to handle proxy events.
|
|
2963
|
-
*/
|
|
2964
|
-
async registerOnTableChange(callback) {
|
|
2965
|
-
return this.baseConnection.registerOnTableChange(comlink__WEBPACK_IMPORTED_MODULE_1__.proxy(callback));
|
|
2966
|
-
}
|
|
2967
|
-
async close() {
|
|
2968
|
-
// Abort any pending lock requests.
|
|
2969
|
-
this.lockAbortController.abort();
|
|
2970
|
-
try {
|
|
2971
|
-
// fire and forget the close operation
|
|
2972
|
-
await this.withRemote(() => this.baseConnection.close(), true);
|
|
2973
|
-
}
|
|
2974
|
-
finally {
|
|
2975
|
-
this.options.remote[comlink__WEBPACK_IMPORTED_MODULE_1__.releaseProxy]();
|
|
2976
|
-
this.options.onClose?.();
|
|
2977
|
-
this.iterateListeners((l) => l.closing?.());
|
|
2978
|
-
}
|
|
2979
|
-
}
|
|
2980
|
-
execute(sql, params) {
|
|
2981
|
-
return this.withRemote(() => this.baseConnection.execute(sql, params));
|
|
2982
|
-
}
|
|
2983
|
-
executeRaw(sql, params) {
|
|
2984
|
-
return this.withRemote(() => this.baseConnection.executeRaw(sql, params));
|
|
2985
|
-
}
|
|
2986
|
-
executeBatch(sql, params) {
|
|
2987
|
-
return this.withRemote(() => this.baseConnection.executeBatch(sql, params));
|
|
2988
|
-
}
|
|
2989
|
-
getConfig() {
|
|
2990
|
-
return this.withRemote(() => this.baseConnection.getConfig());
|
|
2991
|
-
}
|
|
2992
|
-
}
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
/***/ },
|
|
2996
|
-
|
|
2997
|
-
/***/ "./lib/src/db/adapters/wa-sqlite/WASQLiteConnection.js"
|
|
2998
|
-
/*!*************************************************************!*\
|
|
2999
|
-
!*** ./lib/src/db/adapters/wa-sqlite/WASQLiteConnection.js ***!
|
|
3000
|
-
\*************************************************************/
|
|
3001
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
3002
|
-
|
|
3003
|
-
__webpack_require__.r(__webpack_exports__);
|
|
3004
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
3005
|
-
/* harmony export */ AsyncWASQLiteModuleFactory: () => (/* binding */ AsyncWASQLiteModuleFactory),
|
|
3006
|
-
/* harmony export */ DEFAULT_MODULE_FACTORIES: () => (/* binding */ DEFAULT_MODULE_FACTORIES),
|
|
3007
|
-
/* harmony export */ MultiCipherAsyncWASQLiteModuleFactory: () => (/* binding */ MultiCipherAsyncWASQLiteModuleFactory),
|
|
3008
|
-
/* harmony export */ MultiCipherSyncWASQLiteModuleFactory: () => (/* binding */ MultiCipherSyncWASQLiteModuleFactory),
|
|
3009
|
-
/* harmony export */ SyncWASQLiteModuleFactory: () => (/* binding */ SyncWASQLiteModuleFactory),
|
|
3010
|
-
/* harmony export */ WASQLiteVFS: () => (/* binding */ WASQLiteVFS),
|
|
3011
|
-
/* harmony export */ WASqliteConnection: () => (/* binding */ WASqliteConnection)
|
|
3012
|
-
/* harmony export */ });
|
|
3013
|
-
/* 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");
|
|
3014
|
-
/* harmony import */ var _powersync_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @powersync/common */ "../common/dist/bundle.mjs");
|
|
3015
|
-
/* 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");
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
/**
|
|
3020
|
-
* List of currently tested virtual filesystems
|
|
3021
|
-
*/
|
|
3022
|
-
var WASQLiteVFS;
|
|
3023
|
-
(function (WASQLiteVFS) {
|
|
3024
|
-
WASQLiteVFS["IDBBatchAtomicVFS"] = "IDBBatchAtomicVFS";
|
|
3025
|
-
WASQLiteVFS["OPFSCoopSyncVFS"] = "OPFSCoopSyncVFS";
|
|
3026
|
-
WASQLiteVFS["AccessHandlePoolVFS"] = "AccessHandlePoolVFS";
|
|
3027
|
-
})(WASQLiteVFS || (WASQLiteVFS = {}));
|
|
3028
|
-
/**
|
|
3029
|
-
* @internal
|
|
3030
|
-
*/
|
|
3031
|
-
const AsyncWASQLiteModuleFactory = async () => {
|
|
3032
|
-
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"));
|
|
3033
|
-
return factory();
|
|
3034
|
-
};
|
|
3035
|
-
/**
|
|
3036
|
-
* @internal
|
|
3037
|
-
*/
|
|
3038
|
-
const MultiCipherAsyncWASQLiteModuleFactory = async () => {
|
|
3039
|
-
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"));
|
|
3040
|
-
return factory();
|
|
3041
|
-
};
|
|
3042
|
-
/**
|
|
3043
|
-
* @internal
|
|
3044
|
-
*/
|
|
3045
|
-
const SyncWASQLiteModuleFactory = async () => {
|
|
3046
|
-
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"));
|
|
3047
|
-
return factory();
|
|
3048
|
-
};
|
|
3049
|
-
/**
|
|
3050
|
-
* @internal
|
|
3051
|
-
*/
|
|
3052
|
-
const MultiCipherSyncWASQLiteModuleFactory = async () => {
|
|
3053
|
-
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"));
|
|
3054
|
-
return factory();
|
|
3055
|
-
};
|
|
3056
|
-
/**
|
|
3057
|
-
* @internal
|
|
3058
|
-
*/
|
|
3059
|
-
const DEFAULT_MODULE_FACTORIES = {
|
|
3060
|
-
[WASQLiteVFS.IDBBatchAtomicVFS]: async (options) => {
|
|
3061
|
-
let module;
|
|
3062
|
-
if (options.encryptionKey) {
|
|
3063
|
-
module = await MultiCipherAsyncWASQLiteModuleFactory();
|
|
3064
|
-
}
|
|
3065
|
-
else {
|
|
3066
|
-
module = await AsyncWASQLiteModuleFactory();
|
|
3067
|
-
}
|
|
3068
|
-
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"));
|
|
3069
|
-
return {
|
|
3070
|
-
module,
|
|
3071
|
-
// @ts-expect-error The types for this static method are missing upstream
|
|
3072
|
-
vfs: await IDBBatchAtomicVFS.create(options.dbFileName, module, { lockPolicy: 'exclusive' })
|
|
3073
|
-
};
|
|
3074
|
-
},
|
|
3075
|
-
[WASQLiteVFS.AccessHandlePoolVFS]: async (options) => {
|
|
3076
|
-
let module;
|
|
3077
|
-
if (options.encryptionKey) {
|
|
3078
|
-
module = await MultiCipherSyncWASQLiteModuleFactory();
|
|
3079
|
-
}
|
|
3080
|
-
else {
|
|
3081
|
-
module = await SyncWASQLiteModuleFactory();
|
|
3082
|
-
}
|
|
3083
|
-
// @ts-expect-error The types for this static method are missing upstream
|
|
3084
|
-
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"));
|
|
3085
|
-
return {
|
|
3086
|
-
module,
|
|
3087
|
-
vfs: await AccessHandlePoolVFS.create(options.dbFileName, module)
|
|
3088
|
-
};
|
|
3089
|
-
},
|
|
3090
|
-
[WASQLiteVFS.OPFSCoopSyncVFS]: async (options) => {
|
|
3091
|
-
let module;
|
|
3092
|
-
if (options.encryptionKey) {
|
|
3093
|
-
module = await MultiCipherSyncWASQLiteModuleFactory();
|
|
3094
|
-
}
|
|
3095
|
-
else {
|
|
3096
|
-
module = await SyncWASQLiteModuleFactory();
|
|
3097
|
-
}
|
|
3098
|
-
// @ts-expect-error The types for this static method are missing upstream
|
|
3099
|
-
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"));
|
|
3100
|
-
const vfs = await OPFSCoopSyncVFS.create(options.dbFileName, module);
|
|
3101
|
-
return {
|
|
3102
|
-
module,
|
|
3103
|
-
vfs
|
|
3104
|
-
};
|
|
3105
|
-
}
|
|
3106
|
-
};
|
|
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");
|
|
399
|
+
|
|
400
|
+
|
|
3107
401
|
/**
|
|
3108
|
-
* @
|
|
3109
|
-
* WA-SQLite connection which directly interfaces with WA-SQLite.
|
|
3110
|
-
* This is usually instantiated inside a worker.
|
|
402
|
+
* A single-connection {@link ConnectionPool} implementation based on a worker connection.
|
|
3111
403
|
*/
|
|
3112
|
-
class
|
|
404
|
+
class DatabaseClient extends _powersync_common__WEBPACK_IMPORTED_MODULE_0__.BaseObserver {
|
|
3113
405
|
options;
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
statementMutex;
|
|
3120
|
-
broadcastChannel;
|
|
3121
|
-
/**
|
|
3122
|
-
* Unique id for this specific connection. This is used to prevent broadcast table change
|
|
3123
|
-
* notification loops.
|
|
3124
|
-
*/
|
|
3125
|
-
connectionId;
|
|
3126
|
-
_holdCounter;
|
|
3127
|
-
_holdId;
|
|
3128
|
-
constructor(options) {
|
|
406
|
+
config;
|
|
407
|
+
#connection;
|
|
408
|
+
#shareConnectionAbortController = new AbortController();
|
|
409
|
+
#receiveTableUpdates;
|
|
410
|
+
constructor(options, config) {
|
|
3129
411
|
super();
|
|
3130
412
|
this.options = options;
|
|
3131
|
-
this.
|
|
3132
|
-
this
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
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: []
|
|
428
|
+
};
|
|
429
|
+
this.iterateListeners((l) => {
|
|
430
|
+
l.tablesUpdated && l.tablesUpdated(notification);
|
|
431
|
+
});
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
get name() {
|
|
435
|
+
return this.config.dbFilename;
|
|
3139
436
|
}
|
|
3140
437
|
/**
|
|
3141
|
-
*
|
|
3142
|
-
*
|
|
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.
|
|
3143
443
|
*/
|
|
3144
|
-
|
|
3145
|
-
|
|
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();
|
|
3146
448
|
}
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
449
|
+
async close() {
|
|
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]();
|
|
3152
456
|
}
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
throw new Error(`Initialization has not completed`);
|
|
3156
|
-
}
|
|
3157
|
-
return this._dbP;
|
|
457
|
+
readLock(fn, options) {
|
|
458
|
+
return this.#lock(false, fn, options);
|
|
3158
459
|
}
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
* @returns true if in autocommit mode, false if in a transaction
|
|
3162
|
-
*/
|
|
3163
|
-
async isAutoCommit() {
|
|
3164
|
-
return this.sqliteAPI.get_autocommit(this.dbP) != 0;
|
|
3165
|
-
}
|
|
3166
|
-
async markHold() {
|
|
3167
|
-
const previousHoldId = this._holdId;
|
|
3168
|
-
this._holdId = `${++this._holdCounter}`;
|
|
3169
|
-
if (previousHoldId) {
|
|
3170
|
-
await this.iterateAsyncListeners(async (cb) => cb.holdOverwritten?.(previousHoldId));
|
|
3171
|
-
}
|
|
3172
|
-
return this._holdId;
|
|
460
|
+
writeLock(fn, options) {
|
|
461
|
+
return this.#lock(true, fn, options);
|
|
3173
462
|
}
|
|
3174
|
-
async
|
|
3175
|
-
|
|
3176
|
-
|
|
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));
|
|
3177
467
|
}
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
async openDB() {
|
|
3181
|
-
this._dbP = await this.sqliteAPI.open_v2(this.options.dbFilename);
|
|
3182
|
-
return this._dbP;
|
|
3183
|
-
}
|
|
3184
|
-
async executeEncryptionPragma() {
|
|
3185
|
-
if (this.options.encryptionKey) {
|
|
3186
|
-
await this.executeSingleStatement(`PRAGMA key = "${this.options.encryptionKey}"`);
|
|
468
|
+
finally {
|
|
469
|
+
await useConnectionState(this.#connection, (c) => c.completeAccess(token));
|
|
3187
470
|
}
|
|
3188
|
-
return;
|
|
3189
471
|
}
|
|
3190
|
-
async
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
});
|
|
3195
|
-
const sqlite3 = _journeyapps_wa_sqlite__WEBPACK_IMPORTED_MODULE_0__.Factory(module);
|
|
3196
|
-
sqlite3.vfs_register(vfs, true);
|
|
3197
|
-
/**
|
|
3198
|
-
* Register the PowerSync core SQLite extension
|
|
3199
|
-
*/
|
|
3200
|
-
module.ccall('powersync_init_static', 'int', []);
|
|
472
|
+
async refreshSchema() {
|
|
473
|
+
// Currently a no-op on the web.
|
|
474
|
+
}
|
|
475
|
+
async shareConnection() {
|
|
3201
476
|
/**
|
|
3202
|
-
*
|
|
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.
|
|
3203
482
|
*/
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
}
|
|
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.`);
|
|
3209
487
|
}
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
if (
|
|
3217
|
-
// 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) {
|
|
3218
495
|
return;
|
|
3219
496
|
}
|
|
3220
|
-
//
|
|
3221
|
-
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
this._sqliteAPI = await this.openSQLiteAPI();
|
|
3232
|
-
await this.openDB();
|
|
3233
|
-
this.registerBroadcastListeners();
|
|
3234
|
-
await this.executeSingleStatement(`PRAGMA temp_store = ${this.options.temporaryStorage};`);
|
|
3235
|
-
await this.executeEncryptionPragma();
|
|
3236
|
-
await this.executeSingleStatement(`PRAGMA cache_size = -${this.options.cacheSizeKb};`);
|
|
3237
|
-
this.sqliteAPI.update_hook(this.dbP, (updateType, dbName, tableName) => {
|
|
3238
|
-
if (!tableName) {
|
|
3239
|
-
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();
|
|
3240
508
|
}
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
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 };
|
|
3244
515
|
}
|
|
3245
|
-
|
|
3246
|
-
return this.
|
|
516
|
+
getConfiguration() {
|
|
517
|
+
return this.config;
|
|
3247
518
|
}
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
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;
|
|
3260
532
|
}
|
|
3261
533
|
/**
|
|
3262
|
-
*
|
|
534
|
+
* Requests an operation from the worker, potentially tracing it if that option has been enabled.
|
|
3263
535
|
*/
|
|
3264
|
-
async
|
|
3265
|
-
|
|
3266
|
-
|
|
536
|
+
async maybeTrace(fn, describeForTrace) {
|
|
537
|
+
if (this.#connection.traceQueries) {
|
|
538
|
+
const start = performance.now();
|
|
539
|
+
const description = describeForTrace();
|
|
3267
540
|
try {
|
|
3268
|
-
await this
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
if (stmt === null) {
|
|
3272
|
-
return {
|
|
3273
|
-
rowsAffected: 0,
|
|
3274
|
-
rows: { _array: [], length: 0 }
|
|
3275
|
-
};
|
|
3276
|
-
}
|
|
3277
|
-
//Prepare statement once
|
|
3278
|
-
for (const binding of wrappedBindings) {
|
|
3279
|
-
// TODO not sure why this is needed currently, but booleans break
|
|
3280
|
-
for (let i = 0; i < binding.length; i++) {
|
|
3281
|
-
const b = binding[i];
|
|
3282
|
-
if (typeof b == 'boolean') {
|
|
3283
|
-
binding[i] = b ? 1 : 0;
|
|
3284
|
-
}
|
|
3285
|
-
}
|
|
3286
|
-
if (bindings) {
|
|
3287
|
-
this.sqliteAPI.bind_collection(stmt, binding);
|
|
3288
|
-
}
|
|
3289
|
-
const result = await this.sqliteAPI.step(stmt);
|
|
3290
|
-
if (result === _journeyapps_wa_sqlite__WEBPACK_IMPORTED_MODULE_0__.SQLITE_DONE) {
|
|
3291
|
-
//The value returned by sqlite3_changes() immediately after an INSERT, UPDATE or DELETE statement run on a view is always zero.
|
|
3292
|
-
affectedRows += this.sqliteAPI.changes(this.dbP);
|
|
3293
|
-
}
|
|
3294
|
-
this.sqliteAPI.reset(stmt);
|
|
3295
|
-
}
|
|
3296
|
-
}
|
|
3297
|
-
await this.executeSingleStatement('COMMIT');
|
|
541
|
+
const r = await useConnectionState(this.#connection, fn);
|
|
542
|
+
performance.measure(`[SQL] ${description}`, { start });
|
|
543
|
+
return r;
|
|
3298
544
|
}
|
|
3299
|
-
catch (
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
rowsAffected: 0,
|
|
3303
|
-
rows: { _array: [], length: 0 }
|
|
3304
|
-
};
|
|
545
|
+
catch (e) {
|
|
546
|
+
performance.measure(`[SQL] [ERROR: ${e.message}] ${description}`, { start });
|
|
547
|
+
throw e;
|
|
3305
548
|
}
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
return result;
|
|
3311
|
-
});
|
|
3312
|
-
}
|
|
3313
|
-
/**
|
|
3314
|
-
* This executes single SQL statements inside a requested lock.
|
|
3315
|
-
*/
|
|
3316
|
-
async execute(sql, bindings) {
|
|
3317
|
-
// Running multiple statements on the same connection concurrently should not be allowed
|
|
3318
|
-
return this.acquireExecuteLock(async () => {
|
|
3319
|
-
return this.executeSingleStatement(sql, bindings);
|
|
3320
|
-
});
|
|
549
|
+
}
|
|
550
|
+
else {
|
|
551
|
+
return useConnectionState(this.#connection, fn);
|
|
552
|
+
}
|
|
3321
553
|
}
|
|
3322
|
-
async
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
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
|
+
};
|
|
3326
576
|
}
|
|
3327
|
-
async
|
|
3328
|
-
this
|
|
3329
|
-
|
|
3330
|
-
/**
|
|
3331
|
-
* Running the close operation inside the same execute mutex prevents errors like:
|
|
3332
|
-
* ```
|
|
3333
|
-
* unable to close due to unfinalized statements or unfinished backups
|
|
3334
|
-
* ```
|
|
3335
|
-
*/
|
|
3336
|
-
await this.sqliteAPI.close(this.dbP);
|
|
3337
|
-
});
|
|
577
|
+
async executeRaw(query, params) {
|
|
578
|
+
const rs = await this.#executeOnWorker(query, params);
|
|
579
|
+
return rs.resultSet?.rows ?? [];
|
|
3338
580
|
}
|
|
3339
|
-
async
|
|
3340
|
-
return this.
|
|
3341
|
-
tablesUpdated: (event) => callback(event)
|
|
3342
|
-
});
|
|
581
|
+
async #executeOnWorker(query, params) {
|
|
582
|
+
return this.maybeTrace((c) => c.execute(this.#token, query, params), () => query);
|
|
3343
583
|
}
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
};
|
|
3351
|
-
/**
|
|
3352
|
-
* This executes a single statement using SQLite3.
|
|
3353
|
-
*/
|
|
3354
|
-
async executeSingleStatement(sql, bindings) {
|
|
3355
|
-
const results = await this._execute(sql, bindings);
|
|
3356
|
-
const rows = [];
|
|
3357
|
-
for (const resultSet of results) {
|
|
3358
|
-
for (const row of resultSet.rows) {
|
|
3359
|
-
const outRow = {};
|
|
3360
|
-
resultSet.columns.forEach((key, index) => {
|
|
3361
|
-
outRow[key] = row[index];
|
|
3362
|
-
});
|
|
3363
|
-
rows.push(outRow);
|
|
3364
|
-
}
|
|
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;
|
|
3365
590
|
}
|
|
3366
|
-
const result = {
|
|
3367
|
-
insertId: this.sqliteAPI.last_insert_id(this.dbP),
|
|
3368
|
-
rowsAffected: this.sqliteAPI.changes(this.dbP),
|
|
3369
|
-
rows: {
|
|
3370
|
-
_array: rows,
|
|
3371
|
-
length: rows.length
|
|
3372
|
-
}
|
|
3373
|
-
};
|
|
3374
591
|
return result;
|
|
3375
592
|
}
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
// TODO not sure why this is needed currently, but booleans break
|
|
3390
|
-
binding.forEach((b, index, arr) => {
|
|
3391
|
-
if (typeof b == 'boolean') {
|
|
3392
|
-
arr[index] = b ? 1 : 0;
|
|
3393
|
-
}
|
|
3394
|
-
});
|
|
3395
|
-
this.sqliteAPI.reset(stmt);
|
|
3396
|
-
if (bindings) {
|
|
3397
|
-
this.sqliteAPI.bind_collection(stmt, binding);
|
|
3398
|
-
}
|
|
3399
|
-
const rows = [];
|
|
3400
|
-
while ((await this.sqliteAPI.step(stmt)) === _journeyapps_wa_sqlite__WEBPACK_IMPORTED_MODULE_0__.SQLITE_ROW) {
|
|
3401
|
-
const row = this.sqliteAPI.row(stmt);
|
|
3402
|
-
rows.push(row);
|
|
3403
|
-
}
|
|
3404
|
-
columns = columns ?? this.sqliteAPI.column_names(stmt);
|
|
3405
|
-
if (columns.length) {
|
|
3406
|
-
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;
|
|
3407
606
|
}
|
|
3408
607
|
}
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
break;
|
|
608
|
+
function handleAbort() {
|
|
609
|
+
reject(new _powersync_common__WEBPACK_IMPORTED_MODULE_0__.ConnectionClosedError('Remote peer closed with request in flight'));
|
|
3412
610
|
}
|
|
3413
|
-
|
|
3414
|
-
|
|
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);
|
|
3415
624
|
}
|
|
3416
625
|
}
|
|
3417
626
|
|
|
@@ -3608,6 +817,47 @@ const getNavigatorLocks = () => {
|
|
|
3608
817
|
};
|
|
3609
818
|
|
|
3610
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
|
+
|
|
3611
861
|
/***/ },
|
|
3612
862
|
|
|
3613
863
|
/***/ "./lib/src/worker/sync/BroadcastLogger.js"
|
|
@@ -3765,14 +1015,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
3765
1015
|
/* harmony export */ SharedSyncImplementation: () => (/* binding */ SharedSyncImplementation)
|
|
3766
1016
|
/* harmony export */ });
|
|
3767
1017
|
/* harmony import */ var _powersync_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @powersync/common */ "../common/dist/bundle.mjs");
|
|
3768
|
-
/* harmony import */ var
|
|
3769
|
-
/* harmony import */ var
|
|
3770
|
-
/* harmony import */ var
|
|
3771
|
-
/* harmony import */ var
|
|
3772
|
-
/* harmony import */ var
|
|
3773
|
-
/* harmony import */ var
|
|
3774
|
-
/* harmony import */ var _BroadcastLogger_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./BroadcastLogger.js */ "./lib/src/worker/sync/BroadcastLogger.js");
|
|
3775
|
-
|
|
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");
|
|
3776
1024
|
|
|
3777
1025
|
|
|
3778
1026
|
|
|
@@ -3817,14 +1065,14 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
3817
1065
|
connectionManager;
|
|
3818
1066
|
syncStatus;
|
|
3819
1067
|
broadCastLogger;
|
|
3820
|
-
|
|
1068
|
+
database = this.generateReconnectableDatabase();
|
|
3821
1069
|
constructor() {
|
|
3822
1070
|
super();
|
|
3823
1071
|
this.ports = [];
|
|
3824
1072
|
this.syncParams = null;
|
|
3825
1073
|
this.logger = (0,_powersync_common__WEBPACK_IMPORTED_MODULE_0__.createLogger)('shared-sync');
|
|
3826
1074
|
this.lastConnectOptions = undefined;
|
|
3827
|
-
this.portMutex = new
|
|
1075
|
+
this.portMutex = new _powersync_common__WEBPACK_IMPORTED_MODULE_0__.Mutex();
|
|
3828
1076
|
this.isInitialized = new Promise((resolve) => {
|
|
3829
1077
|
const callback = this.registerListener({
|
|
3830
1078
|
initialized: () => {
|
|
@@ -3833,10 +1081,8 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
3833
1081
|
}
|
|
3834
1082
|
});
|
|
3835
1083
|
});
|
|
3836
|
-
// Should be configured once we get params
|
|
3837
|
-
this.distributedDB = null;
|
|
3838
1084
|
this.syncStatus = new _powersync_common__WEBPACK_IMPORTED_MODULE_0__.SyncStatus({});
|
|
3839
|
-
this.broadCastLogger = new
|
|
1085
|
+
this.broadCastLogger = new _BroadcastLogger_js__WEBPACK_IMPORTED_MODULE_4__.BroadcastLogger(this.ports);
|
|
3840
1086
|
this.connectionManager = new _powersync_common__WEBPACK_IMPORTED_MODULE_0__.ConnectionManager({
|
|
3841
1087
|
createSyncImplementation: async () => {
|
|
3842
1088
|
await this.waitForReady();
|
|
@@ -3934,38 +1180,8 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
3934
1180
|
if (params.streamOptions?.flags?.broadcastLogs) {
|
|
3935
1181
|
this.logger = this.broadCastLogger;
|
|
3936
1182
|
}
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
openConnection: async () => {
|
|
3940
|
-
// Gets a connection from the clients when a new connection is requested.
|
|
3941
|
-
const db = await this.openInternalDB();
|
|
3942
|
-
db.registerListener({
|
|
3943
|
-
closing: () => {
|
|
3944
|
-
lockedAdapter.reOpenInternalDB();
|
|
3945
|
-
}
|
|
3946
|
-
});
|
|
3947
|
-
return db;
|
|
3948
|
-
},
|
|
3949
|
-
logger: this.logger,
|
|
3950
|
-
reOpenOnConnectionClosed: true
|
|
3951
|
-
});
|
|
3952
|
-
this.distributedDB = lockedAdapter;
|
|
3953
|
-
await lockedAdapter.init();
|
|
3954
|
-
lockedAdapter.registerListener({
|
|
3955
|
-
databaseReOpened: () => {
|
|
3956
|
-
// We may have missed some table updates while the database was closed.
|
|
3957
|
-
// We can poke the crud in case we missed any updates.
|
|
3958
|
-
this.connectionManager.syncStreamImplementation?.triggerCrudUpload();
|
|
3959
|
-
/**
|
|
3960
|
-
* FIXME or IMPROVE ME
|
|
3961
|
-
* The Rust client implementation stores sync state on the connection level.
|
|
3962
|
-
* Reopening the database causes a state machine error which should cause the
|
|
3963
|
-
* StreamingSyncImplementation to reconnect. It would be nicer if we could trigger
|
|
3964
|
-
* this reconnect earlier.
|
|
3965
|
-
* This reconnect is not required for IndexedDB.
|
|
3966
|
-
*/
|
|
3967
|
-
}
|
|
3968
|
-
});
|
|
1183
|
+
// Ensure we have a usable database connection, the reconnectable database will connect lazily on first use.
|
|
1184
|
+
await this.database.readLock(async () => { });
|
|
3969
1185
|
self.onerror = (event) => {
|
|
3970
1186
|
// Share any uncaught events on the broadcast logger
|
|
3971
1187
|
this.logger.error('Uncaught exception in PowerSync shared sync worker', event);
|
|
@@ -3997,7 +1213,7 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
3997
1213
|
return await this.portMutex.runExclusive(() => {
|
|
3998
1214
|
const portProvider = {
|
|
3999
1215
|
port,
|
|
4000
|
-
clientProvider:
|
|
1216
|
+
clientProvider: comlink__WEBPACK_IMPORTED_MODULE_1__.wrap(port),
|
|
4001
1217
|
currentSubscriptions: [],
|
|
4002
1218
|
closeListeners: [],
|
|
4003
1219
|
isClosing: false
|
|
@@ -4044,7 +1260,7 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
4044
1260
|
await closeListener();
|
|
4045
1261
|
}
|
|
4046
1262
|
this.collectActiveSubscriptions();
|
|
4047
|
-
return () => trackedPort.clientProvider[
|
|
1263
|
+
return () => trackedPort.clientProvider[comlink__WEBPACK_IMPORTED_MODULE_1__.releaseProxy]();
|
|
4048
1264
|
});
|
|
4049
1265
|
}
|
|
4050
1266
|
triggerCrudUpload() {
|
|
@@ -4081,9 +1297,9 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
4081
1297
|
// This should only be called after initialization has completed
|
|
4082
1298
|
const syncParams = this.syncParams;
|
|
4083
1299
|
// Create a new StreamingSyncImplementation for each connect call. This is usually done is all SDKs.
|
|
4084
|
-
return new
|
|
4085
|
-
adapter: new _powersync_common__WEBPACK_IMPORTED_MODULE_0__.SqliteBucketStorage(this.
|
|
4086
|
-
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({
|
|
4087
1303
|
invalidateCredentials: async () => {
|
|
4088
1304
|
const lastPort = await this.getLastWrappedPort();
|
|
4089
1305
|
if (!lastPort) {
|
|
@@ -4153,9 +1369,9 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
4153
1369
|
});
|
|
4154
1370
|
}
|
|
4155
1371
|
/**
|
|
4156
|
-
*
|
|
1372
|
+
* Requests a random client to share its database connection with us.
|
|
4157
1373
|
*/
|
|
4158
|
-
async openInternalDB() {
|
|
1374
|
+
async openInternalDB(handleClosed) {
|
|
4159
1375
|
const client = await this.getRandomWrappedPort();
|
|
4160
1376
|
if (!client) {
|
|
4161
1377
|
// Should not really happen in practice
|
|
@@ -4189,8 +1405,9 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
4189
1405
|
removeCloseListener();
|
|
4190
1406
|
throw ex;
|
|
4191
1407
|
});
|
|
4192
|
-
const remote =
|
|
1408
|
+
const remote = comlink__WEBPACK_IMPORTED_MODULE_1__.wrap(workerPort);
|
|
4193
1409
|
const identifier = this.syncParams.dbParams.dbFilename;
|
|
1410
|
+
const clientLockName = await (0,_shared_tab_close_signal_js__WEBPACK_IMPORTED_MODULE_6__.generateTabCloseSignal)();
|
|
4194
1411
|
/**
|
|
4195
1412
|
* The open could fail if the tab is closed while we're busy opening the database.
|
|
4196
1413
|
* This operation is typically executed inside an exclusive portMutex lock.
|
|
@@ -4198,7 +1415,16 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
4198
1415
|
* We can't rely on the closeListeners to abort the operation if the tab is closed.
|
|
4199
1416
|
*/
|
|
4200
1417
|
const db = await withAbort({
|
|
4201
|
-
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
|
+
},
|
|
4202
1428
|
signal: abortController.signal,
|
|
4203
1429
|
cleanupOnAbort: (db) => {
|
|
4204
1430
|
db.close();
|
|
@@ -4208,25 +1434,86 @@ class SharedSyncImplementation extends _powersync_common__WEBPACK_IMPORTED_MODUL
|
|
|
4208
1434
|
removeCloseListener();
|
|
4209
1435
|
});
|
|
4210
1436
|
clearTimeout(timeout);
|
|
4211
|
-
const wrapped = new _db_adapters_WorkerWrappedAsyncDatabaseConnection_js__WEBPACK_IMPORTED_MODULE_6__.WorkerWrappedAsyncDatabaseConnection({
|
|
4212
|
-
remote,
|
|
4213
|
-
baseConnection: db,
|
|
4214
|
-
identifier,
|
|
4215
|
-
// It's possible for this worker to outlive the client hosting the database for us. We need to be prepared for
|
|
4216
|
-
// that and ensure pending requests are aborted when the tab is closed.
|
|
4217
|
-
remoteCanCloseUnexpectedly: true
|
|
4218
|
-
});
|
|
4219
1437
|
client.closeListeners.push(async () => {
|
|
4220
1438
|
this.logger.info('Aborting open connection because associated tab closed.');
|
|
1439
|
+
handleClosed(db);
|
|
4221
1440
|
/**
|
|
4222
1441
|
* Don't await this close operation. It might never resolve if the tab is closed.
|
|
4223
1442
|
* We mark the remote as closed first, this will reject any pending requests.
|
|
4224
1443
|
* We then call close. The close operation is configured to fire-and-forget, the main promise will reject immediately.
|
|
4225
1444
|
*/
|
|
4226
|
-
|
|
4227
|
-
|
|
1445
|
+
db.markRemoteClosed();
|
|
1446
|
+
db.close().catch((ex) => this.logger.warn('error closing database connection', ex));
|
|
4228
1447
|
});
|
|
4229
|
-
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();
|
|
4230
1517
|
}
|
|
4231
1518
|
/**
|
|
4232
1519
|
* A method to update the all shared statuses for each
|
|
@@ -4439,6 +1726,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4439
1726
|
/* harmony export */ MAX_AMOUNT_OF_COLUMNS: () => (/* binding */ MAX_AMOUNT_OF_COLUMNS),
|
|
4440
1727
|
/* harmony export */ MAX_OP_ID: () => (/* binding */ MAX_OP_ID),
|
|
4441
1728
|
/* harmony export */ MEMORY_TRIGGER_CLAIM_MANAGER: () => (/* binding */ MEMORY_TRIGGER_CLAIM_MANAGER),
|
|
1729
|
+
/* harmony export */ Mutex: () => (/* binding */ Mutex),
|
|
4442
1730
|
/* harmony export */ OnChangeQueryProcessor: () => (/* binding */ OnChangeQueryProcessor),
|
|
4443
1731
|
/* harmony export */ OpType: () => (/* binding */ OpType),
|
|
4444
1732
|
/* harmony export */ OpTypeEnum: () => (/* binding */ OpTypeEnum),
|
|
@@ -4447,6 +1735,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4447
1735
|
/* harmony export */ PowerSyncControlCommand: () => (/* binding */ PowerSyncControlCommand),
|
|
4448
1736
|
/* harmony export */ RowUpdateType: () => (/* binding */ RowUpdateType),
|
|
4449
1737
|
/* harmony export */ Schema: () => (/* binding */ Schema),
|
|
1738
|
+
/* harmony export */ Semaphore: () => (/* binding */ Semaphore),
|
|
4450
1739
|
/* harmony export */ SqliteBucketStorage: () => (/* binding */ SqliteBucketStorage),
|
|
4451
1740
|
/* harmony export */ SyncClientImplementation: () => (/* binding */ SyncClientImplementation),
|
|
4452
1741
|
/* harmony export */ SyncDataBatch: () => (/* binding */ SyncDataBatch),
|
|
@@ -4480,15 +1769,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
4480
1769
|
/* harmony export */ isStreamingSyncCheckpointPartiallyComplete: () => (/* binding */ isStreamingSyncCheckpointPartiallyComplete),
|
|
4481
1770
|
/* harmony export */ isStreamingSyncData: () => (/* binding */ isStreamingSyncData),
|
|
4482
1771
|
/* harmony export */ isSyncNewCheckpointRequest: () => (/* binding */ isSyncNewCheckpointRequest),
|
|
4483
|
-
/* harmony export */ mutexRunExclusive: () => (/* binding */ mutexRunExclusive),
|
|
4484
1772
|
/* harmony export */ parseQuery: () => (/* binding */ parseQuery),
|
|
4485
1773
|
/* harmony export */ runOnSchemaChange: () => (/* binding */ runOnSchemaChange),
|
|
4486
1774
|
/* harmony export */ sanitizeSQL: () => (/* binding */ sanitizeSQL),
|
|
4487
|
-
/* harmony export */ sanitizeUUID: () => (/* binding */ sanitizeUUID)
|
|
1775
|
+
/* harmony export */ sanitizeUUID: () => (/* binding */ sanitizeUUID),
|
|
1776
|
+
/* harmony export */ timeoutSignal: () => (/* binding */ timeoutSignal)
|
|
4488
1777
|
/* harmony export */ });
|
|
4489
|
-
/* 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");
|
|
4490
|
-
|
|
4491
|
-
|
|
4492
1778
|
// https://www.sqlite.org/lang_expr.html#castexpr
|
|
4493
1779
|
var ColumnType;
|
|
4494
1780
|
(function (ColumnType) {
|
|
@@ -5146,7 +2432,7 @@ class SyncingService {
|
|
|
5146
2432
|
updatedAttachments.push(downloaded);
|
|
5147
2433
|
break;
|
|
5148
2434
|
case AttachmentState.QUEUED_DELETE:
|
|
5149
|
-
const deleted = await this.deleteAttachment(attachment);
|
|
2435
|
+
const deleted = await this.deleteAttachment(attachment, context);
|
|
5150
2436
|
updatedAttachments.push(deleted);
|
|
5151
2437
|
break;
|
|
5152
2438
|
}
|
|
@@ -5224,17 +2510,16 @@ class SyncingService {
|
|
|
5224
2510
|
* On failure, defers to error handler or archives.
|
|
5225
2511
|
*
|
|
5226
2512
|
* @param attachment - The attachment record to delete
|
|
2513
|
+
* @param context - Attachment context for database operations
|
|
5227
2514
|
* @returns Updated attachment record
|
|
5228
2515
|
*/
|
|
5229
|
-
async deleteAttachment(attachment) {
|
|
2516
|
+
async deleteAttachment(attachment, context) {
|
|
5230
2517
|
try {
|
|
5231
2518
|
await this.remoteStorage.deleteFile(attachment);
|
|
5232
2519
|
if (attachment.localUri) {
|
|
5233
2520
|
await this.localStorage.deleteFile(attachment.localUri);
|
|
5234
2521
|
}
|
|
5235
|
-
await
|
|
5236
|
-
await ctx.deleteAttachment(attachment.id);
|
|
5237
|
-
});
|
|
2522
|
+
await context.deleteAttachment(attachment.id);
|
|
5238
2523
|
return {
|
|
5239
2524
|
...attachment,
|
|
5240
2525
|
state: AttachmentState.ARCHIVED
|
|
@@ -5272,32 +2557,198 @@ class SyncingService {
|
|
|
5272
2557
|
}
|
|
5273
2558
|
|
|
5274
2559
|
/**
|
|
5275
|
-
*
|
|
2560
|
+
* A simple fixed-capacity queue implementation.
|
|
2561
|
+
*
|
|
2562
|
+
* Unlike a naive queue implemented by `array.push()` and `array.shift()`, this avoids moving array elements around
|
|
2563
|
+
* and is `O(1)` for {@link addLast} and {@link removeFirst}.
|
|
5276
2564
|
*/
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
2565
|
+
class Queue {
|
|
2566
|
+
table;
|
|
2567
|
+
// Index of the first element in the table.
|
|
2568
|
+
head;
|
|
2569
|
+
// Amount of items currently in the queue.
|
|
2570
|
+
_length;
|
|
2571
|
+
constructor(initialItems) {
|
|
2572
|
+
this.table = [...initialItems];
|
|
2573
|
+
this.head = 0;
|
|
2574
|
+
this._length = this.table.length;
|
|
2575
|
+
}
|
|
2576
|
+
get isEmpty() {
|
|
2577
|
+
return this.length == 0;
|
|
2578
|
+
}
|
|
2579
|
+
get length() {
|
|
2580
|
+
return this._length;
|
|
2581
|
+
}
|
|
2582
|
+
removeFirst() {
|
|
2583
|
+
if (this.isEmpty) {
|
|
2584
|
+
throw new Error('Queue is empty');
|
|
2585
|
+
}
|
|
2586
|
+
const result = this.table[this.head];
|
|
2587
|
+
this._length--;
|
|
2588
|
+
this.table[this.head] = undefined;
|
|
2589
|
+
this.head = (this.head + 1) % this.table.length;
|
|
2590
|
+
return result;
|
|
2591
|
+
}
|
|
2592
|
+
addLast(element) {
|
|
2593
|
+
if (this.length == this.table.length) {
|
|
2594
|
+
throw new Error('Queue is full');
|
|
2595
|
+
}
|
|
2596
|
+
this.table[(this.head + this._length) % this.table.length] = element;
|
|
2597
|
+
this._length++;
|
|
2598
|
+
}
|
|
2599
|
+
}
|
|
2600
|
+
|
|
2601
|
+
/**
|
|
2602
|
+
* An asynchronous semaphore implementation with associated items per lease.
|
|
2603
|
+
*
|
|
2604
|
+
* @internal This class is meant to be used in PowerSync SDKs only, and is not part of the public API.
|
|
2605
|
+
*/
|
|
2606
|
+
class Semaphore {
|
|
2607
|
+
// Available items that are not currently assigned to a waiter.
|
|
2608
|
+
available;
|
|
2609
|
+
size;
|
|
2610
|
+
// Linked list of waiters. We don't expect the wait list to become particularly large, and this allows removing
|
|
2611
|
+
// aborted waiters from the middle of the list efficiently.
|
|
2612
|
+
firstWaiter;
|
|
2613
|
+
lastWaiter;
|
|
2614
|
+
constructor(elements) {
|
|
2615
|
+
this.available = new Queue(elements);
|
|
2616
|
+
this.size = this.available.length;
|
|
2617
|
+
}
|
|
2618
|
+
addWaiter(requestedItems, onAcquire) {
|
|
2619
|
+
const node = {
|
|
2620
|
+
isActive: true,
|
|
2621
|
+
acquiredItems: [],
|
|
2622
|
+
remainingItems: requestedItems,
|
|
2623
|
+
onAcquire,
|
|
2624
|
+
prev: this.lastWaiter
|
|
2625
|
+
};
|
|
2626
|
+
if (this.lastWaiter) {
|
|
2627
|
+
this.lastWaiter.next = node;
|
|
2628
|
+
this.lastWaiter = node;
|
|
2629
|
+
}
|
|
2630
|
+
else {
|
|
2631
|
+
// First waiter
|
|
2632
|
+
this.lastWaiter = this.firstWaiter = node;
|
|
2633
|
+
}
|
|
2634
|
+
return node;
|
|
2635
|
+
}
|
|
2636
|
+
deactivateWaiter(waiter) {
|
|
2637
|
+
const { prev, next } = waiter;
|
|
2638
|
+
waiter.isActive = false;
|
|
2639
|
+
if (prev)
|
|
2640
|
+
prev.next = next;
|
|
2641
|
+
if (next)
|
|
2642
|
+
next.prev = prev;
|
|
2643
|
+
if (waiter == this.firstWaiter)
|
|
2644
|
+
this.firstWaiter = next;
|
|
2645
|
+
if (waiter == this.lastWaiter)
|
|
2646
|
+
this.lastWaiter = prev;
|
|
2647
|
+
}
|
|
2648
|
+
requestPermits(amount, abort) {
|
|
2649
|
+
if (amount <= 0 || amount > this.size) {
|
|
2650
|
+
throw new Error(`Invalid amount of items requested (${amount}), must be between 1 and ${this.size}`);
|
|
2651
|
+
}
|
|
2652
|
+
return new Promise((resolve, reject) => {
|
|
2653
|
+
function rejectAborted() {
|
|
2654
|
+
reject(abort?.reason ?? new Error('Semaphore acquire aborted'));
|
|
5290
2655
|
}
|
|
5291
|
-
if (
|
|
5292
|
-
return;
|
|
5293
|
-
try {
|
|
5294
|
-
resolve(await callback());
|
|
2656
|
+
if (abort?.aborted) {
|
|
2657
|
+
return rejectAborted();
|
|
5295
2658
|
}
|
|
5296
|
-
|
|
5297
|
-
|
|
2659
|
+
let waiter;
|
|
2660
|
+
const markCompleted = () => {
|
|
2661
|
+
const items = waiter.acquiredItems;
|
|
2662
|
+
waiter.acquiredItems = []; // Avoid releasing items twice.
|
|
2663
|
+
for (const element of items) {
|
|
2664
|
+
// Give to next waiter, if possible.
|
|
2665
|
+
const nextWaiter = this.firstWaiter;
|
|
2666
|
+
if (nextWaiter) {
|
|
2667
|
+
nextWaiter.acquiredItems.push(element);
|
|
2668
|
+
nextWaiter.remainingItems--;
|
|
2669
|
+
if (nextWaiter.remainingItems == 0) {
|
|
2670
|
+
nextWaiter.onAcquire();
|
|
2671
|
+
}
|
|
2672
|
+
}
|
|
2673
|
+
else {
|
|
2674
|
+
// No pending waiter, return lease into pool.
|
|
2675
|
+
this.available.addLast(element);
|
|
2676
|
+
}
|
|
2677
|
+
}
|
|
2678
|
+
};
|
|
2679
|
+
const onAbort = () => {
|
|
2680
|
+
abort?.removeEventListener('abort', onAbort);
|
|
2681
|
+
if (waiter.isActive) {
|
|
2682
|
+
this.deactivateWaiter(waiter);
|
|
2683
|
+
rejectAborted();
|
|
2684
|
+
}
|
|
2685
|
+
};
|
|
2686
|
+
const resolvePromise = () => {
|
|
2687
|
+
this.deactivateWaiter(waiter);
|
|
2688
|
+
abort?.removeEventListener('abort', onAbort);
|
|
2689
|
+
const items = waiter.acquiredItems;
|
|
2690
|
+
resolve({ items, release: markCompleted });
|
|
2691
|
+
};
|
|
2692
|
+
waiter = this.addWaiter(amount, resolvePromise);
|
|
2693
|
+
// If there are items in the pool that haven't been assigned, we can pull them into this waiter. Note that this is
|
|
2694
|
+
// only the case if we're the first waiter (otherwise, items would have been assigned to an earlier waiter).
|
|
2695
|
+
while (!this.available.isEmpty && waiter.remainingItems > 0) {
|
|
2696
|
+
waiter.acquiredItems.push(this.available.removeFirst());
|
|
2697
|
+
waiter.remainingItems--;
|
|
2698
|
+
}
|
|
2699
|
+
if (waiter.remainingItems == 0) {
|
|
2700
|
+
return resolvePromise();
|
|
5298
2701
|
}
|
|
2702
|
+
abort?.addEventListener('abort', onAbort);
|
|
5299
2703
|
});
|
|
5300
|
-
}
|
|
2704
|
+
}
|
|
2705
|
+
/**
|
|
2706
|
+
* Requests a single item from the pool.
|
|
2707
|
+
*
|
|
2708
|
+
* The returned `release` callback must be invoked to return the item into the pool.
|
|
2709
|
+
*/
|
|
2710
|
+
async requestOne(abort) {
|
|
2711
|
+
const { items, release } = await this.requestPermits(1, abort);
|
|
2712
|
+
return { release, item: items[0] };
|
|
2713
|
+
}
|
|
2714
|
+
/**
|
|
2715
|
+
* Requests access to all items from the pool.
|
|
2716
|
+
*
|
|
2717
|
+
* The returned `release` callback must be invoked to return items into the pool.
|
|
2718
|
+
*/
|
|
2719
|
+
requestAll(abort) {
|
|
2720
|
+
return this.requestPermits(this.size, abort);
|
|
2721
|
+
}
|
|
2722
|
+
}
|
|
2723
|
+
/**
|
|
2724
|
+
* An asynchronous mutex implementation.
|
|
2725
|
+
*
|
|
2726
|
+
* @internal This class is meant to be used in PowerSync SDKs only, and is not part of the public API.
|
|
2727
|
+
*/
|
|
2728
|
+
class Mutex {
|
|
2729
|
+
inner = new Semaphore([null]);
|
|
2730
|
+
async acquire(abort) {
|
|
2731
|
+
const { release } = await this.inner.requestOne(abort);
|
|
2732
|
+
return release;
|
|
2733
|
+
}
|
|
2734
|
+
async runExclusive(fn, abort) {
|
|
2735
|
+
const returnMutex = await this.acquire(abort);
|
|
2736
|
+
try {
|
|
2737
|
+
return await fn();
|
|
2738
|
+
}
|
|
2739
|
+
finally {
|
|
2740
|
+
returnMutex();
|
|
2741
|
+
}
|
|
2742
|
+
}
|
|
2743
|
+
}
|
|
2744
|
+
function timeoutSignal(timeout) {
|
|
2745
|
+
if (timeout == null)
|
|
2746
|
+
return;
|
|
2747
|
+
if ('timeout' in AbortSignal)
|
|
2748
|
+
return AbortSignal.timeout(timeout);
|
|
2749
|
+
const controller = new AbortController();
|
|
2750
|
+
setTimeout(() => controller.abort(new Error('Timeout waiting for lock')), timeout);
|
|
2751
|
+
return controller.signal;
|
|
5301
2752
|
}
|
|
5302
2753
|
|
|
5303
2754
|
/**
|
|
@@ -5309,7 +2760,7 @@ class AttachmentService {
|
|
|
5309
2760
|
db;
|
|
5310
2761
|
logger;
|
|
5311
2762
|
tableName;
|
|
5312
|
-
mutex = new
|
|
2763
|
+
mutex = new Mutex();
|
|
5313
2764
|
context;
|
|
5314
2765
|
constructor(db, logger, tableName = 'attachments', archivedCacheLimit = 100) {
|
|
5315
2766
|
this.db = db;
|
|
@@ -5346,7 +2797,7 @@ class AttachmentService {
|
|
|
5346
2797
|
* Executes a callback with exclusive access to the attachment context.
|
|
5347
2798
|
*/
|
|
5348
2799
|
async withContext(callback) {
|
|
5349
|
-
return
|
|
2800
|
+
return this.mutex.runExclusive(async () => {
|
|
5350
2801
|
return callback(this.context);
|
|
5351
2802
|
});
|
|
5352
2803
|
}
|
|
@@ -5382,9 +2833,15 @@ class AttachmentQueue {
|
|
|
5382
2833
|
tableName;
|
|
5383
2834
|
/** Logger instance for diagnostic information */
|
|
5384
2835
|
logger;
|
|
5385
|
-
/** Interval in milliseconds between periodic sync operations.
|
|
2836
|
+
/** Interval in milliseconds between periodic sync operations. Acts as a polling timer to retry
|
|
2837
|
+
* failed uploads/downloads, especially after the app goes offline. Default: 30000 (30 seconds) */
|
|
5386
2838
|
syncIntervalMs = 30 * 1000;
|
|
5387
|
-
/**
|
|
2839
|
+
/** Throttle duration in milliseconds for the reactive watch query on the attachments table.
|
|
2840
|
+
* When attachment records change, a watch query detects the change and triggers a sync.
|
|
2841
|
+
* This throttle prevents the sync from firing too rapidly when many changes happen in
|
|
2842
|
+
* quick succession (e.g., bulk inserts). This is distinct from syncIntervalMs — it controls
|
|
2843
|
+
* how quickly the queue reacts to changes, while syncIntervalMs controls how often it polls
|
|
2844
|
+
* for retries. Default: 30 (from DEFAULT_WATCH_THROTTLE_MS) */
|
|
5388
2845
|
syncThrottleDuration;
|
|
5389
2846
|
/** Whether to automatically download remote attachments. Default: true */
|
|
5390
2847
|
downloadAttachments = true;
|
|
@@ -5408,8 +2865,8 @@ class AttachmentQueue {
|
|
|
5408
2865
|
* @param options.watchAttachments - Callback for monitoring attachment changes in your data model
|
|
5409
2866
|
* @param options.tableName - Name of the table to store attachment records. Default: 'ps_attachment_queue'
|
|
5410
2867
|
* @param options.logger - Logger instance. Defaults to db.logger
|
|
5411
|
-
* @param options.syncIntervalMs -
|
|
5412
|
-
* @param options.syncThrottleDuration - Throttle duration for
|
|
2868
|
+
* @param options.syncIntervalMs - Periodic polling interval in milliseconds for retrying failed uploads/downloads. Default: 30000
|
|
2869
|
+
* @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
|
|
5413
2870
|
* @param options.downloadAttachments - Whether to automatically download remote attachments. Default: true
|
|
5414
2871
|
* @param options.archivedCacheLimit - Maximum archived attachments before cleanup. Default: 100
|
|
5415
2872
|
*/
|
|
@@ -15070,7 +12527,7 @@ function requireDist () {
|
|
|
15070
12527
|
|
|
15071
12528
|
var distExports = requireDist();
|
|
15072
12529
|
|
|
15073
|
-
var version = "1.
|
|
12530
|
+
var version = "1.51.0";
|
|
15074
12531
|
var PACKAGE = {
|
|
15075
12532
|
version: version};
|
|
15076
12533
|
|
|
@@ -17462,7 +14919,7 @@ class AbstractPowerSyncDatabase extends BaseObserver {
|
|
|
17462
14919
|
this._schema = schema;
|
|
17463
14920
|
this.ready = false;
|
|
17464
14921
|
this.sdkVersion = '';
|
|
17465
|
-
this.runExclusiveMutex = new
|
|
14922
|
+
this.runExclusiveMutex = new Mutex();
|
|
17466
14923
|
// Start async init
|
|
17467
14924
|
this.subscriptions = {
|
|
17468
14925
|
firstStatusMatching: (predicate, abort) => this.waitForStatus(predicate, abort),
|
|
@@ -17927,6 +15384,10 @@ SELECT * FROM crud_entries;
|
|
|
17927
15384
|
* Execute a SQL write (INSERT/UPDATE/DELETE) query
|
|
17928
15385
|
* and optionally return results.
|
|
17929
15386
|
*
|
|
15387
|
+
* When using the default client-side [JSON-based view system](https://docs.powersync.com/architecture/client-architecture#client-side-schema-and-sqlite-database-structure),
|
|
15388
|
+
* the returned result's `rowsAffected` may be `0` for successful `UPDATE` and `DELETE` statements.
|
|
15389
|
+
* Use a `RETURNING` clause and inspect `result.rows` when you need to confirm which rows changed.
|
|
15390
|
+
*
|
|
17930
15391
|
* @param sql The SQL query to execute
|
|
17931
15392
|
* @param parameters Optional array of parameters to bind to the query
|
|
17932
15393
|
* @returns The query result as an object with structured key-value pairs
|
|
@@ -18023,7 +15484,7 @@ SELECT * FROM crud_entries;
|
|
|
18023
15484
|
async readTransaction(callback, lockTimeout = DEFAULT_LOCK_TIMEOUT_MS) {
|
|
18024
15485
|
await this.waitForReady();
|
|
18025
15486
|
return this.database.readTransaction(async (tx) => {
|
|
18026
|
-
const res = await callback(
|
|
15487
|
+
const res = await callback(tx);
|
|
18027
15488
|
await tx.rollback();
|
|
18028
15489
|
return res;
|
|
18029
15490
|
}, { timeoutMs: lockTimeout });
|
|
@@ -19129,7 +16590,7 @@ const parseQuery = (query, parameters) => {
|
|
|
19129
16590
|
/******/
|
|
19130
16591
|
/******/ /* webpack/runtime/importScripts chunk loading */
|
|
19131
16592
|
/******/ (() => {
|
|
19132
|
-
/******/
|
|
16593
|
+
/******/ // no baseURI
|
|
19133
16594
|
/******/
|
|
19134
16595
|
/******/ // object to store loaded chunks
|
|
19135
16596
|
/******/ // "1" means "already loaded"
|