@peerbit/indexer-sqlite3 1.2.28 → 1.2.30-d375893
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/peerbit/sqlite3.min.js +110 -44
- package/dist/peerbit/sqlite3.worker.min.js +148 -90
- package/dist/src/engine.d.ts +2 -0
- package/dist/src/engine.d.ts.map +1 -1
- package/dist/src/engine.js +12 -4
- package/dist/src/engine.js.map +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/sqlite3.wasm.d.ts +1 -1
- package/dist/src/sqlite3.wasm.d.ts.map +1 -1
- package/dist/src/sqlite3.wasm.js +72 -5
- package/dist/src/sqlite3.wasm.js.map +1 -1
- package/dist/src/types.d.ts +1 -1
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +87 -78
- package/src/engine.ts +14 -4
- package/src/index.ts +1 -1
- package/src/sqlite3.wasm.ts +73 -5
- package/src/types.ts +1 -1
|
@@ -30,9 +30,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
mod
|
|
31
31
|
));
|
|
32
32
|
|
|
33
|
-
// ../../../../node_modules/@protobufjs/float/index.js
|
|
33
|
+
// ../../../../node_modules/.pnpm/@protobufjs+float@1.0.2/node_modules/@protobufjs/float/index.js
|
|
34
34
|
var require_float = __commonJS({
|
|
35
|
-
"../../../../node_modules/@protobufjs/float/index.js"(exports, module) {
|
|
35
|
+
"../../../../node_modules/.pnpm/@protobufjs+float@1.0.2/node_modules/@protobufjs/float/index.js"(exports, module) {
|
|
36
36
|
"use strict";
|
|
37
37
|
module.exports = factory(factory);
|
|
38
38
|
function factory(exports2) {
|
|
@@ -224,9 +224,9 @@ var require_float = __commonJS({
|
|
|
224
224
|
}
|
|
225
225
|
});
|
|
226
226
|
|
|
227
|
-
// ../../../../node_modules/@protobufjs/utf8/index.js
|
|
227
|
+
// ../../../../node_modules/.pnpm/@protobufjs+utf8@1.1.0/node_modules/@protobufjs/utf8/index.js
|
|
228
228
|
var require_utf8 = __commonJS({
|
|
229
|
-
"../../../../node_modules/@protobufjs/utf8/index.js"(exports) {
|
|
229
|
+
"../../../../node_modules/.pnpm/@protobufjs+utf8@1.1.0/node_modules/@protobufjs/utf8/index.js"(exports) {
|
|
230
230
|
"use strict";
|
|
231
231
|
var utf82 = exports;
|
|
232
232
|
utf82.length = function utf8_length(string) {
|
|
@@ -307,15 +307,15 @@ var require_fs = __commonJS({
|
|
|
307
307
|
}
|
|
308
308
|
});
|
|
309
309
|
|
|
310
|
-
// (disabled):../../../../node_modules/path/path.js
|
|
310
|
+
// (disabled):../../../../node_modules/.pnpm/path@0.12.7/node_modules/path/path.js
|
|
311
311
|
var require_path = __commonJS({
|
|
312
|
-
"(disabled):../../../../node_modules/path/path.js"() {
|
|
312
|
+
"(disabled):../../../../node_modules/.pnpm/path@0.12.7/node_modules/path/path.js"() {
|
|
313
313
|
}
|
|
314
314
|
});
|
|
315
315
|
|
|
316
|
-
// ../../../../node_modules/libsodium/dist/modules/libsodium.js
|
|
316
|
+
// ../../../../node_modules/.pnpm/libsodium@0.7.15/node_modules/libsodium/dist/modules/libsodium.js
|
|
317
317
|
var require_libsodium = __commonJS({
|
|
318
|
-
"../../../../node_modules/libsodium/dist/modules/libsodium.js"(exports, module) {
|
|
318
|
+
"../../../../node_modules/.pnpm/libsodium@0.7.15/node_modules/libsodium/dist/modules/libsodium.js"(exports, module) {
|
|
319
319
|
!function(A) {
|
|
320
320
|
function I(A2) {
|
|
321
321
|
"use strict";
|
|
@@ -2919,9 +2919,9 @@ var require_libsodium = __commonJS({
|
|
|
2919
2919
|
}
|
|
2920
2920
|
});
|
|
2921
2921
|
|
|
2922
|
-
// ../../../../node_modules/libsodium-wrappers/dist/modules/libsodium-wrappers.js
|
|
2922
|
+
// ../../../../node_modules/.pnpm/libsodium-wrappers@0.7.15/node_modules/libsodium-wrappers/dist/modules/libsodium-wrappers.js
|
|
2923
2923
|
var require_libsodium_wrappers = __commonJS({
|
|
2924
|
-
"../../../../node_modules/libsodium-wrappers/dist/modules/libsodium-wrappers.js"(exports) {
|
|
2924
|
+
"../../../../node_modules/.pnpm/libsodium-wrappers@0.7.15/node_modules/libsodium-wrappers/dist/modules/libsodium-wrappers.js"(exports) {
|
|
2925
2925
|
!function(e) {
|
|
2926
2926
|
function a(e2, a2) {
|
|
2927
2927
|
"use strict";
|
|
@@ -5522,11 +5522,11 @@ var require_libsodium_wrappers = __commonJS({
|
|
|
5522
5522
|
}
|
|
5523
5523
|
});
|
|
5524
5524
|
|
|
5525
|
-
// ../../../../node_modules/@dao-xyz/borsh/lib/esm/binary.js
|
|
5525
|
+
// ../../../../node_modules/.pnpm/@dao-xyz+borsh@5.2.4/node_modules/@dao-xyz/borsh/lib/esm/binary.js
|
|
5526
5526
|
var import_float = __toESM(require_float(), 1);
|
|
5527
5527
|
var import_utf8 = __toESM(require_utf8(), 1);
|
|
5528
5528
|
|
|
5529
|
-
// ../../../../node_modules/@dao-xyz/borsh/lib/esm/bigint.js
|
|
5529
|
+
// ../../../../node_modules/.pnpm/@dao-xyz+borsh@5.2.4/node_modules/@dao-xyz/borsh/lib/esm/bigint.js
|
|
5530
5530
|
function arrayToHex(arr, reverse = false) {
|
|
5531
5531
|
return [...reverse ? new Uint8Array(arr).reverse() : new Uint8Array(arr)].map((b) => b.toString(16).padStart(2, "0")).join("");
|
|
5532
5532
|
}
|
|
@@ -5639,7 +5639,7 @@ var checkInt = (value, min, max, byteLength) => {
|
|
|
5639
5639
|
}
|
|
5640
5640
|
};
|
|
5641
5641
|
|
|
5642
|
-
// ../../../../node_modules/@dao-xyz/borsh/lib/esm/error.js
|
|
5642
|
+
// ../../../../node_modules/.pnpm/@dao-xyz+borsh@5.2.4/node_modules/@dao-xyz/borsh/lib/esm/error.js
|
|
5643
5643
|
var BorshError = class extends Error {
|
|
5644
5644
|
constructor(message) {
|
|
5645
5645
|
super(message);
|
|
@@ -5652,7 +5652,7 @@ var BorshError = class extends Error {
|
|
|
5652
5652
|
}
|
|
5653
5653
|
};
|
|
5654
5654
|
|
|
5655
|
-
// ../../../../node_modules/@dao-xyz/borsh/lib/esm/binary.js
|
|
5655
|
+
// ../../../../node_modules/.pnpm/@dao-xyz+borsh@5.2.4/node_modules/@dao-xyz/borsh/lib/esm/binary.js
|
|
5656
5656
|
var allocUnsafeFn = () => {
|
|
5657
5657
|
if (globalThis.Buffer) {
|
|
5658
5658
|
return globalThis.Buffer.allocUnsafe;
|
|
@@ -6074,7 +6074,7 @@ var BinaryReader = class _BinaryReader {
|
|
|
6074
6074
|
}
|
|
6075
6075
|
};
|
|
6076
6076
|
|
|
6077
|
-
// ../../../../node_modules/@dao-xyz/borsh/lib/esm/types.js
|
|
6077
|
+
// ../../../../node_modules/.pnpm/@dao-xyz+borsh@5.2.4/node_modules/@dao-xyz/borsh/lib/esm/types.js
|
|
6078
6078
|
var extendingClasses = (clazz) => {
|
|
6079
6079
|
let ret = [];
|
|
6080
6080
|
if (clazz instanceof Function) {
|
|
@@ -6153,7 +6153,7 @@ var StructKind = class {
|
|
|
6153
6153
|
}
|
|
6154
6154
|
};
|
|
6155
6155
|
|
|
6156
|
-
// ../../../../node_modules/@dao-xyz/borsh/lib/esm/index.js
|
|
6156
|
+
// ../../../../node_modules/.pnpm/@dao-xyz+borsh@5.2.4/node_modules/@dao-xyz/borsh/lib/esm/index.js
|
|
6157
6157
|
var MAX_PROTOTYPE_SEARCH = 250;
|
|
6158
6158
|
var PROTOTYPE_POLLUTION_CONTEXT_RANGE = 500;
|
|
6159
6159
|
var PROTOTYPE_DESERIALIZATION_HANDLER_OFFSET = 500;
|
|
@@ -6669,7 +6669,7 @@ var resize = (arr, newSize, defaultValue) => {
|
|
|
6669
6669
|
arr.length = newSize;
|
|
6670
6670
|
};
|
|
6671
6671
|
|
|
6672
|
-
// ../../../../node_modules/multiformats/dist/src/bytes.js
|
|
6672
|
+
// ../../../../node_modules/.pnpm/multiformats@13.4.1/node_modules/multiformats/dist/src/bytes.js
|
|
6673
6673
|
var empty = new Uint8Array(0);
|
|
6674
6674
|
function coerce(o) {
|
|
6675
6675
|
if (o instanceof Uint8Array && o.constructor.name === "Uint8Array") {
|
|
@@ -6684,7 +6684,7 @@ function coerce(o) {
|
|
|
6684
6684
|
throw new Error("Unknown type, must be binary type");
|
|
6685
6685
|
}
|
|
6686
6686
|
|
|
6687
|
-
// ../../../../node_modules/multiformats/dist/src/vendor/base-x.js
|
|
6687
|
+
// ../../../../node_modules/.pnpm/multiformats@13.4.1/node_modules/multiformats/dist/src/vendor/base-x.js
|
|
6688
6688
|
function base(ALPHABET, name) {
|
|
6689
6689
|
if (ALPHABET.length >= 255) {
|
|
6690
6690
|
throw new TypeError("Alphabet too long");
|
|
@@ -6820,7 +6820,7 @@ var src = base;
|
|
|
6820
6820
|
var _brrp__multiformats_scope_baseX = src;
|
|
6821
6821
|
var base_x_default = _brrp__multiformats_scope_baseX;
|
|
6822
6822
|
|
|
6823
|
-
// ../../../../node_modules/multiformats/dist/src/bases/base.js
|
|
6823
|
+
// ../../../../node_modules/.pnpm/multiformats@13.4.1/node_modules/multiformats/dist/src/bases/base.js
|
|
6824
6824
|
var Encoder = class {
|
|
6825
6825
|
name;
|
|
6826
6826
|
prefix;
|
|
@@ -6926,7 +6926,7 @@ function baseX({ name, prefix, alphabet }) {
|
|
|
6926
6926
|
});
|
|
6927
6927
|
}
|
|
6928
6928
|
|
|
6929
|
-
// ../../../../node_modules/multiformats/dist/src/bases/base58.js
|
|
6929
|
+
// ../../../../node_modules/.pnpm/multiformats@13.4.1/node_modules/multiformats/dist/src/bases/base58.js
|
|
6930
6930
|
var base58btc = baseX({
|
|
6931
6931
|
name: "base58btc",
|
|
6932
6932
|
prefix: "z",
|
|
@@ -6938,12 +6938,12 @@ var base58flickr = baseX({
|
|
|
6938
6938
|
alphabet: "123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
|
|
6939
6939
|
});
|
|
6940
6940
|
|
|
6941
|
-
// ../../../../node_modules/@stablelib/int/lib/int.js
|
|
6941
|
+
// ../../../../node_modules/.pnpm/@stablelib+int@2.0.1/node_modules/@stablelib/int/lib/int.js
|
|
6942
6942
|
var isInteger = Number.isInteger;
|
|
6943
6943
|
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER;
|
|
6944
6944
|
var isSafeInteger = Number.isSafeInteger;
|
|
6945
6945
|
|
|
6946
|
-
// ../../../../node_modules/@stablelib/binary/lib/binary.js
|
|
6946
|
+
// ../../../../node_modules/.pnpm/@stablelib+binary@2.0.1/node_modules/@stablelib/binary/lib/binary.js
|
|
6947
6947
|
function readUint32BE(array, offset = 0) {
|
|
6948
6948
|
return (array[offset] << 24 | array[offset + 1] << 16 | array[offset + 2] << 8 | array[offset + 3]) >>> 0;
|
|
6949
6949
|
}
|
|
@@ -6955,7 +6955,7 @@ function writeUint32BE(value, out = new Uint8Array(4), offset = 0) {
|
|
|
6955
6955
|
return out;
|
|
6956
6956
|
}
|
|
6957
6957
|
|
|
6958
|
-
// ../../../../node_modules/@stablelib/wipe/lib/wipe.js
|
|
6958
|
+
// ../../../../node_modules/.pnpm/@stablelib+wipe@2.0.1/node_modules/@stablelib/wipe/lib/wipe.js
|
|
6959
6959
|
function wipe(array) {
|
|
6960
6960
|
for (let i = 0; i < array.length; i++) {
|
|
6961
6961
|
array[i] = 0;
|
|
@@ -6963,7 +6963,7 @@ function wipe(array) {
|
|
|
6963
6963
|
return array;
|
|
6964
6964
|
}
|
|
6965
6965
|
|
|
6966
|
-
// ../../../../node_modules/@stablelib/sha256/lib/sha256.js
|
|
6966
|
+
// ../../../../node_modules/.pnpm/@stablelib+sha256@2.0.1/node_modules/@stablelib/sha256/lib/sha256.js
|
|
6967
6967
|
var DIGEST_LENGTH = 32;
|
|
6968
6968
|
var BLOCK_SIZE = 64;
|
|
6969
6969
|
var SHA256 = class {
|
|
@@ -7253,7 +7253,7 @@ var toBase58 = (arr) => {
|
|
|
7253
7253
|
var sha256Base64Sync = (bytes) => toBase64(new SHA256().update(bytes).digest());
|
|
7254
7254
|
var sha256Sync = (bytes) => new SHA256().update(bytes).digest();
|
|
7255
7255
|
|
|
7256
|
-
// ../../../../node_modules/uint8-varint/dist/src/index.js
|
|
7256
|
+
// ../../../../node_modules/.pnpm/uint8-varint@2.0.4/node_modules/uint8-varint/dist/src/index.js
|
|
7257
7257
|
var N1 = Math.pow(2, 7);
|
|
7258
7258
|
var N2 = Math.pow(2, 14);
|
|
7259
7259
|
var N3 = Math.pow(2, 21);
|
|
@@ -7562,7 +7562,7 @@ var toId = (obj) => {
|
|
|
7562
7562
|
throw new Error("Unexpected index key: " + typeof obj + ", expected: string, number, bigint or Uint8Array");
|
|
7563
7563
|
};
|
|
7564
7564
|
|
|
7565
|
-
// ../../../../node_modules/uuid/dist/esm-browser/stringify.js
|
|
7565
|
+
// ../../../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-browser/stringify.js
|
|
7566
7566
|
var byteToHex = [];
|
|
7567
7567
|
for (i = 0; i < 256; ++i) {
|
|
7568
7568
|
byteToHex.push((i + 256).toString(16).slice(1));
|
|
@@ -7572,7 +7572,7 @@ function unsafeStringify(arr, offset = 0) {
|
|
|
7572
7572
|
return (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase();
|
|
7573
7573
|
}
|
|
7574
7574
|
|
|
7575
|
-
// ../../../../node_modules/uuid/dist/esm-browser/rng.js
|
|
7575
|
+
// ../../../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-browser/rng.js
|
|
7576
7576
|
var getRandomValues;
|
|
7577
7577
|
var rnds8 = new Uint8Array(16);
|
|
7578
7578
|
function rng() {
|
|
@@ -7585,13 +7585,13 @@ function rng() {
|
|
|
7585
7585
|
return getRandomValues(rnds8);
|
|
7586
7586
|
}
|
|
7587
7587
|
|
|
7588
|
-
// ../../../../node_modules/uuid/dist/esm-browser/native.js
|
|
7588
|
+
// ../../../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-browser/native.js
|
|
7589
7589
|
var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
7590
7590
|
var native_default = {
|
|
7591
7591
|
randomUUID
|
|
7592
7592
|
};
|
|
7593
7593
|
|
|
7594
|
-
// ../../../../node_modules/uuid/dist/esm-browser/v4.js
|
|
7594
|
+
// ../../../../node_modules/.pnpm/uuid@10.0.0/node_modules/uuid/dist/esm-browser/v4.js
|
|
7595
7595
|
function v4(options, buf, offset) {
|
|
7596
7596
|
if (native_default.randomUUID && !buf && !options) {
|
|
7597
7597
|
return native_default.randomUUID();
|
|
@@ -7989,7 +7989,7 @@ hrtime.bigint = (time) => {
|
|
|
7989
7989
|
return BigInt(diff[0] * NS_PER_SEC + diff[1]);
|
|
7990
7990
|
};
|
|
7991
7991
|
|
|
7992
|
-
// ../../../../node_modules/p-defer/index.js
|
|
7992
|
+
// ../../../../node_modules/.pnpm/p-defer@4.0.1/node_modules/p-defer/index.js
|
|
7993
7993
|
function pDefer() {
|
|
7994
7994
|
const deferred = {};
|
|
7995
7995
|
deferred.promise = new Promise((resolve, reject) => {
|
|
@@ -9681,11 +9681,18 @@ var SQLLiteIndex = class {
|
|
|
9681
9681
|
await this.planner.stop();
|
|
9682
9682
|
}
|
|
9683
9683
|
async drop() {
|
|
9684
|
-
if (this.closed) {
|
|
9685
|
-
|
|
9684
|
+
if (!this.closed) {
|
|
9685
|
+
this.closed = true;
|
|
9686
|
+
}
|
|
9687
|
+
if (this.cursorPruner != null) {
|
|
9688
|
+
clearInterval(this.cursorPruner);
|
|
9689
|
+
this.cursorPruner = void 0;
|
|
9690
|
+
}
|
|
9691
|
+
const status = await this.properties.db.status?.();
|
|
9692
|
+
if (status === "closed") {
|
|
9693
|
+
this._tables.clear();
|
|
9694
|
+
return;
|
|
9686
9695
|
}
|
|
9687
|
-
this.closed = true;
|
|
9688
|
-
clearInterval(this.cursorPruner);
|
|
9689
9696
|
await this.clearStatements();
|
|
9690
9697
|
for (const table of this._rootTables) {
|
|
9691
9698
|
await this.properties.db.exec(`drop table if exists ${table.name}`);
|
|
@@ -9984,7 +9991,8 @@ var SQLiteIndices = class _SQLiteIndices {
|
|
|
9984
9991
|
const scope2 = new _SQLiteIndices({
|
|
9985
9992
|
scope: [...this._scope, name],
|
|
9986
9993
|
db: this.properties.db,
|
|
9987
|
-
parent: this
|
|
9994
|
+
parent: this,
|
|
9995
|
+
directory: this.properties.directory
|
|
9988
9996
|
});
|
|
9989
9997
|
if (!this.closed) {
|
|
9990
9998
|
await scope2.start();
|
|
@@ -10048,7 +10056,7 @@ var encodeValue = (value) => {
|
|
|
10048
10056
|
return { type: "simple", value };
|
|
10049
10057
|
};
|
|
10050
10058
|
|
|
10051
|
-
// ../../../../node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-bundler-friendly.mjs
|
|
10059
|
+
// ../../../../node_modules/.pnpm/@sqlite.org+sqlite-wasm@3.50.4-build1/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-bundler-friendly.mjs
|
|
10052
10060
|
var sqlite3InitModule = (() => {
|
|
10053
10061
|
var _scriptName = import.meta.url;
|
|
10054
10062
|
return function(moduleArg = {}) {
|
|
@@ -21344,7 +21352,7 @@ var toExportForESM = function() {
|
|
|
21344
21352
|
sqlite3InitModule = toExportForESM;
|
|
21345
21353
|
var sqlite3_bundler_friendly_default = sqlite3InitModule;
|
|
21346
21354
|
|
|
21347
|
-
// ../../../../node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-worker1-promiser.mjs
|
|
21355
|
+
// ../../../../node_modules/.pnpm/@sqlite.org+sqlite-wasm@3.50.4-build1/node_modules/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-worker1-promiser.mjs
|
|
21348
21356
|
globalThis.sqlite3Worker1Promiser = function callee(config = callee.defaultConfig) {
|
|
21349
21357
|
if (1 === arguments.length && "function" === typeof arguments[0]) {
|
|
21350
21358
|
const f = config;
|
|
@@ -21499,7 +21507,7 @@ sqlite3Worker1Promiser.v2 = function(config) {
|
|
|
21499
21507
|
});
|
|
21500
21508
|
var sqlite3_worker1_promiser_default = sqlite3Worker1Promiser.v2;
|
|
21501
21509
|
|
|
21502
|
-
// ../../../../node_modules/@sqlite.org/sqlite-wasm/index.mjs
|
|
21510
|
+
// ../../../../node_modules/.pnpm/@sqlite.org+sqlite-wasm@3.50.4-build1/node_modules/@sqlite.org/sqlite-wasm/index.mjs
|
|
21503
21511
|
var sqlite3Worker1Promiser2 = globalThis.sqlite3Worker1Promiser;
|
|
21504
21512
|
var sqlite_wasm_default = sqlite3_bundler_friendly_default;
|
|
21505
21513
|
|
|
@@ -21577,18 +21585,76 @@ var create = async (directory) => {
|
|
|
21577
21585
|
let statements = /* @__PURE__ */ new Map();
|
|
21578
21586
|
sqlite3 = sqlite3 || await sqlite_wasm_default({ print: log, printErr: error });
|
|
21579
21587
|
let sqliteDb = void 0;
|
|
21580
|
-
let
|
|
21588
|
+
let closeInternal = async () => {
|
|
21581
21589
|
await Promise.all([...statements.values()].map((x) => x.finalize?.()));
|
|
21582
21590
|
statements.clear();
|
|
21583
21591
|
await sqliteDb?.close();
|
|
21584
21592
|
sqliteDb = void 0;
|
|
21585
21593
|
};
|
|
21586
21594
|
let dbFileName;
|
|
21587
|
-
|
|
21588
|
-
if (poolUtil
|
|
21589
|
-
|
|
21595
|
+
const cleanupPool = async (_label, preserveDbFile) => {
|
|
21596
|
+
if (!poolUtil || dbFileName == null) {
|
|
21597
|
+
return;
|
|
21598
|
+
}
|
|
21599
|
+
const relatedFiles = /* @__PURE__ */ new Set([
|
|
21600
|
+
dbFileName,
|
|
21601
|
+
`${dbFileName}-journal`,
|
|
21602
|
+
`${dbFileName}-wal`,
|
|
21603
|
+
`${dbFileName}-shm`
|
|
21604
|
+
]);
|
|
21605
|
+
for (const fileName of relatedFiles) {
|
|
21606
|
+
if (preserveDbFile && fileName === dbFileName) {
|
|
21607
|
+
continue;
|
|
21608
|
+
}
|
|
21609
|
+
try {
|
|
21610
|
+
poolUtil.unlink(fileName);
|
|
21611
|
+
} catch {
|
|
21612
|
+
}
|
|
21613
|
+
}
|
|
21614
|
+
const wipePool = async () => {
|
|
21615
|
+
if (preserveDbFile || !poolUtil?.wipeFiles) {
|
|
21616
|
+
return;
|
|
21617
|
+
}
|
|
21618
|
+
try {
|
|
21619
|
+
await poolUtil.wipeFiles();
|
|
21620
|
+
} catch {
|
|
21621
|
+
}
|
|
21622
|
+
};
|
|
21623
|
+
const directoryPrefix = directory ? `${directory.replace(/\/$/, "")}/` : void 0;
|
|
21624
|
+
if (!directoryPrefix) {
|
|
21625
|
+
await wipePool();
|
|
21626
|
+
return;
|
|
21627
|
+
}
|
|
21628
|
+
let poolFiles = [];
|
|
21629
|
+
try {
|
|
21630
|
+
poolFiles = poolUtil.getFileNames?.() ?? [];
|
|
21631
|
+
} catch {
|
|
21632
|
+
poolFiles = [];
|
|
21633
|
+
}
|
|
21634
|
+
for (const name of poolFiles) {
|
|
21635
|
+
if (preserveDbFile && name === dbFileName) {
|
|
21636
|
+
continue;
|
|
21637
|
+
}
|
|
21638
|
+
if (relatedFiles.has(name)) {
|
|
21639
|
+
continue;
|
|
21640
|
+
}
|
|
21641
|
+
if (name.startsWith(directoryPrefix)) {
|
|
21642
|
+
try {
|
|
21643
|
+
poolUtil.unlink(name);
|
|
21644
|
+
} catch {
|
|
21645
|
+
}
|
|
21646
|
+
}
|
|
21590
21647
|
}
|
|
21591
|
-
|
|
21648
|
+
await wipePool();
|
|
21649
|
+
};
|
|
21650
|
+
let close = async () => {
|
|
21651
|
+
await closeInternal();
|
|
21652
|
+
const preserve = Boolean(directory);
|
|
21653
|
+
await cleanupPool("close", preserve);
|
|
21654
|
+
};
|
|
21655
|
+
let drop = async () => {
|
|
21656
|
+
await closeInternal();
|
|
21657
|
+
await cleanupPool("drop", false);
|
|
21592
21658
|
};
|
|
21593
21659
|
let open = async () => {
|
|
21594
21660
|
if (sqliteDb) {
|
|
@@ -21841,7 +21907,7 @@ var encodeName = (name) => {
|
|
|
21841
21907
|
};
|
|
21842
21908
|
var create3 = async (directory) => {
|
|
21843
21909
|
const db = await create2(directory);
|
|
21844
|
-
return new SQLiteIndices({ db });
|
|
21910
|
+
return new SQLiteIndices({ db, directory });
|
|
21845
21911
|
};
|
|
21846
21912
|
export {
|
|
21847
21913
|
SQLLiteIndex,
|