terradb 0.4.3 → 0.4.4
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.js +799 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -25500,23 +25500,800 @@ var init_postgres = __esm(() => {
|
|
|
25500
25500
|
init_errors();
|
|
25501
25501
|
});
|
|
25502
25502
|
|
|
25503
|
+
// node_modules/better-sqlite3/lib/util.js
|
|
25504
|
+
var require_util = __commonJS((exports) => {
|
|
25505
|
+
exports.getBooleanOption = (options, key) => {
|
|
25506
|
+
let value = false;
|
|
25507
|
+
if (key in options && typeof (value = options[key]) !== "boolean") {
|
|
25508
|
+
throw new TypeError(`Expected the "${key}" option to be a boolean`);
|
|
25509
|
+
}
|
|
25510
|
+
return value;
|
|
25511
|
+
};
|
|
25512
|
+
exports.cppdb = Symbol();
|
|
25513
|
+
exports.inspect = Symbol.for("nodejs.util.inspect.custom");
|
|
25514
|
+
});
|
|
25515
|
+
|
|
25516
|
+
// node_modules/better-sqlite3/lib/sqlite-error.js
|
|
25517
|
+
var require_sqlite_error = __commonJS((exports, module) => {
|
|
25518
|
+
var descriptor = { value: "SqliteError", writable: true, enumerable: false, configurable: true };
|
|
25519
|
+
function SqliteError(message, code) {
|
|
25520
|
+
if (new.target !== SqliteError) {
|
|
25521
|
+
return new SqliteError(message, code);
|
|
25522
|
+
}
|
|
25523
|
+
if (typeof code !== "string") {
|
|
25524
|
+
throw new TypeError("Expected second argument to be a string");
|
|
25525
|
+
}
|
|
25526
|
+
Error.call(this, message);
|
|
25527
|
+
descriptor.value = "" + message;
|
|
25528
|
+
Object.defineProperty(this, "message", descriptor);
|
|
25529
|
+
Error.captureStackTrace(this, SqliteError);
|
|
25530
|
+
this.code = code;
|
|
25531
|
+
}
|
|
25532
|
+
Object.setPrototypeOf(SqliteError, Error);
|
|
25533
|
+
Object.setPrototypeOf(SqliteError.prototype, Error.prototype);
|
|
25534
|
+
Object.defineProperty(SqliteError.prototype, "name", descriptor);
|
|
25535
|
+
module.exports = SqliteError;
|
|
25536
|
+
});
|
|
25537
|
+
|
|
25538
|
+
// node_modules/file-uri-to-path/index.js
|
|
25539
|
+
var require_file_uri_to_path = __commonJS((exports, module) => {
|
|
25540
|
+
var sep = __require("path").sep || "/";
|
|
25541
|
+
module.exports = fileUriToPath;
|
|
25542
|
+
function fileUriToPath(uri) {
|
|
25543
|
+
if (typeof uri != "string" || uri.length <= 7 || uri.substring(0, 7) != "file://") {
|
|
25544
|
+
throw new TypeError("must pass in a file:// URI to convert to a file path");
|
|
25545
|
+
}
|
|
25546
|
+
var rest = decodeURI(uri.substring(7));
|
|
25547
|
+
var firstSlash = rest.indexOf("/");
|
|
25548
|
+
var host = rest.substring(0, firstSlash);
|
|
25549
|
+
var path = rest.substring(firstSlash + 1);
|
|
25550
|
+
if (host == "localhost")
|
|
25551
|
+
host = "";
|
|
25552
|
+
if (host) {
|
|
25553
|
+
host = sep + sep + host;
|
|
25554
|
+
}
|
|
25555
|
+
path = path.replace(/^(.+)\|/, "$1:");
|
|
25556
|
+
if (sep == "\\") {
|
|
25557
|
+
path = path.replace(/\//g, "\\");
|
|
25558
|
+
}
|
|
25559
|
+
if (/^.+\:/.test(path)) {} else {
|
|
25560
|
+
path = sep + path;
|
|
25561
|
+
}
|
|
25562
|
+
return host + path;
|
|
25563
|
+
}
|
|
25564
|
+
});
|
|
25565
|
+
|
|
25566
|
+
// node_modules/bindings/bindings.js
|
|
25567
|
+
var require_bindings = __commonJS((exports, module) => {
|
|
25568
|
+
var __filename = "/home/runner/work/terradb/terradb/node_modules/bindings/bindings.js";
|
|
25569
|
+
var fs = __require("fs");
|
|
25570
|
+
var path = __require("path");
|
|
25571
|
+
var fileURLToPath = require_file_uri_to_path();
|
|
25572
|
+
var join = path.join;
|
|
25573
|
+
var dirname = path.dirname;
|
|
25574
|
+
var exists = fs.accessSync && function(path2) {
|
|
25575
|
+
try {
|
|
25576
|
+
fs.accessSync(path2);
|
|
25577
|
+
} catch (e) {
|
|
25578
|
+
return false;
|
|
25579
|
+
}
|
|
25580
|
+
return true;
|
|
25581
|
+
} || fs.existsSync || path.existsSync;
|
|
25582
|
+
var defaults2 = {
|
|
25583
|
+
arrow: process.env.NODE_BINDINGS_ARROW || " → ",
|
|
25584
|
+
compiled: process.env.NODE_BINDINGS_COMPILED_DIR || "compiled",
|
|
25585
|
+
platform: process.platform,
|
|
25586
|
+
arch: process.arch,
|
|
25587
|
+
nodePreGyp: "node-v" + process.versions.modules + "-" + process.platform + "-" + process.arch,
|
|
25588
|
+
version: process.versions.node,
|
|
25589
|
+
bindings: "bindings.node",
|
|
25590
|
+
try: [
|
|
25591
|
+
["module_root", "build", "bindings"],
|
|
25592
|
+
["module_root", "build", "Debug", "bindings"],
|
|
25593
|
+
["module_root", "build", "Release", "bindings"],
|
|
25594
|
+
["module_root", "out", "Debug", "bindings"],
|
|
25595
|
+
["module_root", "Debug", "bindings"],
|
|
25596
|
+
["module_root", "out", "Release", "bindings"],
|
|
25597
|
+
["module_root", "Release", "bindings"],
|
|
25598
|
+
["module_root", "build", "default", "bindings"],
|
|
25599
|
+
["module_root", "compiled", "version", "platform", "arch", "bindings"],
|
|
25600
|
+
["module_root", "addon-build", "release", "install-root", "bindings"],
|
|
25601
|
+
["module_root", "addon-build", "debug", "install-root", "bindings"],
|
|
25602
|
+
["module_root", "addon-build", "default", "install-root", "bindings"],
|
|
25603
|
+
["module_root", "lib", "binding", "nodePreGyp", "bindings"]
|
|
25604
|
+
]
|
|
25605
|
+
};
|
|
25606
|
+
function bindings(opts) {
|
|
25607
|
+
if (typeof opts == "string") {
|
|
25608
|
+
opts = { bindings: opts };
|
|
25609
|
+
} else if (!opts) {
|
|
25610
|
+
opts = {};
|
|
25611
|
+
}
|
|
25612
|
+
Object.keys(defaults2).map(function(i2) {
|
|
25613
|
+
if (!(i2 in opts))
|
|
25614
|
+
opts[i2] = defaults2[i2];
|
|
25615
|
+
});
|
|
25616
|
+
if (!opts.module_root) {
|
|
25617
|
+
opts.module_root = exports.getRoot(exports.getFileName());
|
|
25618
|
+
}
|
|
25619
|
+
if (path.extname(opts.bindings) != ".node") {
|
|
25620
|
+
opts.bindings += ".node";
|
|
25621
|
+
}
|
|
25622
|
+
var requireFunc = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
|
|
25623
|
+
var tries = [], i = 0, l = opts.try.length, n, b, err;
|
|
25624
|
+
for (;i < l; i++) {
|
|
25625
|
+
n = join.apply(null, opts.try[i].map(function(p) {
|
|
25626
|
+
return opts[p] || p;
|
|
25627
|
+
}));
|
|
25628
|
+
tries.push(n);
|
|
25629
|
+
try {
|
|
25630
|
+
b = opts.path ? requireFunc.resolve(n) : requireFunc(n);
|
|
25631
|
+
if (!opts.path) {
|
|
25632
|
+
b.path = n;
|
|
25633
|
+
}
|
|
25634
|
+
return b;
|
|
25635
|
+
} catch (e) {
|
|
25636
|
+
if (e.code !== "MODULE_NOT_FOUND" && e.code !== "QUALIFIED_PATH_RESOLUTION_FAILED" && !/not find/i.test(e.message)) {
|
|
25637
|
+
throw e;
|
|
25638
|
+
}
|
|
25639
|
+
}
|
|
25640
|
+
}
|
|
25641
|
+
err = new Error(`Could not locate the bindings file. Tried:
|
|
25642
|
+
` + tries.map(function(a) {
|
|
25643
|
+
return opts.arrow + a;
|
|
25644
|
+
}).join(`
|
|
25645
|
+
`));
|
|
25646
|
+
err.tries = tries;
|
|
25647
|
+
throw err;
|
|
25648
|
+
}
|
|
25649
|
+
module.exports = exports = bindings;
|
|
25650
|
+
exports.getFileName = function getFileName(calling_file) {
|
|
25651
|
+
var { prepareStackTrace: origPST, stackTraceLimit: origSTL } = Error, dummy = {}, fileName;
|
|
25652
|
+
Error.stackTraceLimit = 10;
|
|
25653
|
+
Error.prepareStackTrace = function(e, st) {
|
|
25654
|
+
for (var i = 0, l = st.length;i < l; i++) {
|
|
25655
|
+
fileName = st[i].getFileName();
|
|
25656
|
+
if (fileName !== __filename) {
|
|
25657
|
+
if (calling_file) {
|
|
25658
|
+
if (fileName !== calling_file) {
|
|
25659
|
+
return;
|
|
25660
|
+
}
|
|
25661
|
+
} else {
|
|
25662
|
+
return;
|
|
25663
|
+
}
|
|
25664
|
+
}
|
|
25665
|
+
}
|
|
25666
|
+
};
|
|
25667
|
+
Error.captureStackTrace(dummy);
|
|
25668
|
+
dummy.stack;
|
|
25669
|
+
Error.prepareStackTrace = origPST;
|
|
25670
|
+
Error.stackTraceLimit = origSTL;
|
|
25671
|
+
var fileSchema = "file://";
|
|
25672
|
+
if (fileName.indexOf(fileSchema) === 0) {
|
|
25673
|
+
fileName = fileURLToPath(fileName);
|
|
25674
|
+
}
|
|
25675
|
+
return fileName;
|
|
25676
|
+
};
|
|
25677
|
+
exports.getRoot = function getRoot(file) {
|
|
25678
|
+
var dir = dirname(file), prev;
|
|
25679
|
+
while (true) {
|
|
25680
|
+
if (dir === ".") {
|
|
25681
|
+
dir = process.cwd();
|
|
25682
|
+
}
|
|
25683
|
+
if (exists(join(dir, "package.json")) || exists(join(dir, "node_modules"))) {
|
|
25684
|
+
return dir;
|
|
25685
|
+
}
|
|
25686
|
+
if (prev === dir) {
|
|
25687
|
+
throw new Error('Could not find module root given file: "' + file + '". Do you have a `package.json` file? ');
|
|
25688
|
+
}
|
|
25689
|
+
prev = dir;
|
|
25690
|
+
dir = join(dir, "..");
|
|
25691
|
+
}
|
|
25692
|
+
};
|
|
25693
|
+
});
|
|
25694
|
+
|
|
25695
|
+
// node_modules/better-sqlite3/lib/methods/wrappers.js
|
|
25696
|
+
var require_wrappers = __commonJS((exports) => {
|
|
25697
|
+
var { cppdb } = require_util();
|
|
25698
|
+
exports.prepare = function prepare(sql) {
|
|
25699
|
+
return this[cppdb].prepare(sql, this, false);
|
|
25700
|
+
};
|
|
25701
|
+
exports.exec = function exec(sql) {
|
|
25702
|
+
this[cppdb].exec(sql);
|
|
25703
|
+
return this;
|
|
25704
|
+
};
|
|
25705
|
+
exports.close = function close() {
|
|
25706
|
+
this[cppdb].close();
|
|
25707
|
+
return this;
|
|
25708
|
+
};
|
|
25709
|
+
exports.loadExtension = function loadExtension(...args) {
|
|
25710
|
+
this[cppdb].loadExtension(...args);
|
|
25711
|
+
return this;
|
|
25712
|
+
};
|
|
25713
|
+
exports.defaultSafeIntegers = function defaultSafeIntegers(...args) {
|
|
25714
|
+
this[cppdb].defaultSafeIntegers(...args);
|
|
25715
|
+
return this;
|
|
25716
|
+
};
|
|
25717
|
+
exports.unsafeMode = function unsafeMode(...args) {
|
|
25718
|
+
this[cppdb].unsafeMode(...args);
|
|
25719
|
+
return this;
|
|
25720
|
+
};
|
|
25721
|
+
exports.getters = {
|
|
25722
|
+
name: {
|
|
25723
|
+
get: function name() {
|
|
25724
|
+
return this[cppdb].name;
|
|
25725
|
+
},
|
|
25726
|
+
enumerable: true
|
|
25727
|
+
},
|
|
25728
|
+
open: {
|
|
25729
|
+
get: function open() {
|
|
25730
|
+
return this[cppdb].open;
|
|
25731
|
+
},
|
|
25732
|
+
enumerable: true
|
|
25733
|
+
},
|
|
25734
|
+
inTransaction: {
|
|
25735
|
+
get: function inTransaction() {
|
|
25736
|
+
return this[cppdb].inTransaction;
|
|
25737
|
+
},
|
|
25738
|
+
enumerable: true
|
|
25739
|
+
},
|
|
25740
|
+
readonly: {
|
|
25741
|
+
get: function readonly() {
|
|
25742
|
+
return this[cppdb].readonly;
|
|
25743
|
+
},
|
|
25744
|
+
enumerable: true
|
|
25745
|
+
},
|
|
25746
|
+
memory: {
|
|
25747
|
+
get: function memory() {
|
|
25748
|
+
return this[cppdb].memory;
|
|
25749
|
+
},
|
|
25750
|
+
enumerable: true
|
|
25751
|
+
}
|
|
25752
|
+
};
|
|
25753
|
+
});
|
|
25754
|
+
|
|
25755
|
+
// node_modules/better-sqlite3/lib/methods/transaction.js
|
|
25756
|
+
var require_transaction = __commonJS((exports, module) => {
|
|
25757
|
+
var { cppdb } = require_util();
|
|
25758
|
+
var controllers = new WeakMap;
|
|
25759
|
+
module.exports = function transaction(fn) {
|
|
25760
|
+
if (typeof fn !== "function")
|
|
25761
|
+
throw new TypeError("Expected first argument to be a function");
|
|
25762
|
+
const db = this[cppdb];
|
|
25763
|
+
const controller = getController(db, this);
|
|
25764
|
+
const { apply } = Function.prototype;
|
|
25765
|
+
const properties = {
|
|
25766
|
+
default: { value: wrapTransaction(apply, fn, db, controller.default) },
|
|
25767
|
+
deferred: { value: wrapTransaction(apply, fn, db, controller.deferred) },
|
|
25768
|
+
immediate: { value: wrapTransaction(apply, fn, db, controller.immediate) },
|
|
25769
|
+
exclusive: { value: wrapTransaction(apply, fn, db, controller.exclusive) },
|
|
25770
|
+
database: { value: this, enumerable: true }
|
|
25771
|
+
};
|
|
25772
|
+
Object.defineProperties(properties.default.value, properties);
|
|
25773
|
+
Object.defineProperties(properties.deferred.value, properties);
|
|
25774
|
+
Object.defineProperties(properties.immediate.value, properties);
|
|
25775
|
+
Object.defineProperties(properties.exclusive.value, properties);
|
|
25776
|
+
return properties.default.value;
|
|
25777
|
+
};
|
|
25778
|
+
var getController = (db, self2) => {
|
|
25779
|
+
let controller = controllers.get(db);
|
|
25780
|
+
if (!controller) {
|
|
25781
|
+
const shared = {
|
|
25782
|
+
commit: db.prepare("COMMIT", self2, false),
|
|
25783
|
+
rollback: db.prepare("ROLLBACK", self2, false),
|
|
25784
|
+
savepoint: db.prepare("SAVEPOINT `\t_bs3.\t`", self2, false),
|
|
25785
|
+
release: db.prepare("RELEASE `\t_bs3.\t`", self2, false),
|
|
25786
|
+
rollbackTo: db.prepare("ROLLBACK TO `\t_bs3.\t`", self2, false)
|
|
25787
|
+
};
|
|
25788
|
+
controllers.set(db, controller = {
|
|
25789
|
+
default: Object.assign({ begin: db.prepare("BEGIN", self2, false) }, shared),
|
|
25790
|
+
deferred: Object.assign({ begin: db.prepare("BEGIN DEFERRED", self2, false) }, shared),
|
|
25791
|
+
immediate: Object.assign({ begin: db.prepare("BEGIN IMMEDIATE", self2, false) }, shared),
|
|
25792
|
+
exclusive: Object.assign({ begin: db.prepare("BEGIN EXCLUSIVE", self2, false) }, shared)
|
|
25793
|
+
});
|
|
25794
|
+
}
|
|
25795
|
+
return controller;
|
|
25796
|
+
};
|
|
25797
|
+
var wrapTransaction = (apply, fn, db, { begin, commit, rollback, savepoint, release, rollbackTo }) => function sqliteTransaction() {
|
|
25798
|
+
let before, after, undo;
|
|
25799
|
+
if (db.inTransaction) {
|
|
25800
|
+
before = savepoint;
|
|
25801
|
+
after = release;
|
|
25802
|
+
undo = rollbackTo;
|
|
25803
|
+
} else {
|
|
25804
|
+
before = begin;
|
|
25805
|
+
after = commit;
|
|
25806
|
+
undo = rollback;
|
|
25807
|
+
}
|
|
25808
|
+
before.run();
|
|
25809
|
+
try {
|
|
25810
|
+
const result = apply.call(fn, this, arguments);
|
|
25811
|
+
if (result && typeof result.then === "function") {
|
|
25812
|
+
throw new TypeError("Transaction function cannot return a promise");
|
|
25813
|
+
}
|
|
25814
|
+
after.run();
|
|
25815
|
+
return result;
|
|
25816
|
+
} catch (ex) {
|
|
25817
|
+
if (db.inTransaction) {
|
|
25818
|
+
undo.run();
|
|
25819
|
+
if (undo !== rollback)
|
|
25820
|
+
after.run();
|
|
25821
|
+
}
|
|
25822
|
+
throw ex;
|
|
25823
|
+
}
|
|
25824
|
+
};
|
|
25825
|
+
});
|
|
25826
|
+
|
|
25827
|
+
// node_modules/better-sqlite3/lib/methods/pragma.js
|
|
25828
|
+
var require_pragma = __commonJS((exports, module) => {
|
|
25829
|
+
var { getBooleanOption, cppdb } = require_util();
|
|
25830
|
+
module.exports = function pragma(source, options) {
|
|
25831
|
+
if (options == null)
|
|
25832
|
+
options = {};
|
|
25833
|
+
if (typeof source !== "string")
|
|
25834
|
+
throw new TypeError("Expected first argument to be a string");
|
|
25835
|
+
if (typeof options !== "object")
|
|
25836
|
+
throw new TypeError("Expected second argument to be an options object");
|
|
25837
|
+
const simple = getBooleanOption(options, "simple");
|
|
25838
|
+
const stmt = this[cppdb].prepare(`PRAGMA ${source}`, this, true);
|
|
25839
|
+
return simple ? stmt.pluck().get() : stmt.all();
|
|
25840
|
+
};
|
|
25841
|
+
});
|
|
25842
|
+
|
|
25843
|
+
// node_modules/better-sqlite3/lib/methods/backup.js
|
|
25844
|
+
var require_backup = __commonJS((exports, module) => {
|
|
25845
|
+
var fs = __require("fs");
|
|
25846
|
+
var path = __require("path");
|
|
25847
|
+
var { promisify } = __require("util");
|
|
25848
|
+
var { cppdb } = require_util();
|
|
25849
|
+
var fsAccess = promisify(fs.access);
|
|
25850
|
+
module.exports = async function backup(filename, options) {
|
|
25851
|
+
if (options == null)
|
|
25852
|
+
options = {};
|
|
25853
|
+
if (typeof filename !== "string")
|
|
25854
|
+
throw new TypeError("Expected first argument to be a string");
|
|
25855
|
+
if (typeof options !== "object")
|
|
25856
|
+
throw new TypeError("Expected second argument to be an options object");
|
|
25857
|
+
filename = filename.trim();
|
|
25858
|
+
const attachedName = "attached" in options ? options.attached : "main";
|
|
25859
|
+
const handler = "progress" in options ? options.progress : null;
|
|
25860
|
+
if (!filename)
|
|
25861
|
+
throw new TypeError("Backup filename cannot be an empty string");
|
|
25862
|
+
if (filename === ":memory:")
|
|
25863
|
+
throw new TypeError('Invalid backup filename ":memory:"');
|
|
25864
|
+
if (typeof attachedName !== "string")
|
|
25865
|
+
throw new TypeError('Expected the "attached" option to be a string');
|
|
25866
|
+
if (!attachedName)
|
|
25867
|
+
throw new TypeError('The "attached" option cannot be an empty string');
|
|
25868
|
+
if (handler != null && typeof handler !== "function")
|
|
25869
|
+
throw new TypeError('Expected the "progress" option to be a function');
|
|
25870
|
+
await fsAccess(path.dirname(filename)).catch(() => {
|
|
25871
|
+
throw new TypeError("Cannot save backup because the directory does not exist");
|
|
25872
|
+
});
|
|
25873
|
+
const isNewFile = await fsAccess(filename).then(() => false, () => true);
|
|
25874
|
+
return runBackup(this[cppdb].backup(this, attachedName, filename, isNewFile), handler || null);
|
|
25875
|
+
};
|
|
25876
|
+
var runBackup = (backup, handler) => {
|
|
25877
|
+
let rate = 0;
|
|
25878
|
+
let useDefault = true;
|
|
25879
|
+
return new Promise((resolve, reject) => {
|
|
25880
|
+
setImmediate(function step() {
|
|
25881
|
+
try {
|
|
25882
|
+
const progress = backup.transfer(rate);
|
|
25883
|
+
if (!progress.remainingPages) {
|
|
25884
|
+
backup.close();
|
|
25885
|
+
resolve(progress);
|
|
25886
|
+
return;
|
|
25887
|
+
}
|
|
25888
|
+
if (useDefault) {
|
|
25889
|
+
useDefault = false;
|
|
25890
|
+
rate = 100;
|
|
25891
|
+
}
|
|
25892
|
+
if (handler) {
|
|
25893
|
+
const ret = handler(progress);
|
|
25894
|
+
if (ret !== undefined) {
|
|
25895
|
+
if (typeof ret === "number" && ret === ret)
|
|
25896
|
+
rate = Math.max(0, Math.min(2147483647, Math.round(ret)));
|
|
25897
|
+
else
|
|
25898
|
+
throw new TypeError("Expected progress callback to return a number or undefined");
|
|
25899
|
+
}
|
|
25900
|
+
}
|
|
25901
|
+
setImmediate(step);
|
|
25902
|
+
} catch (err) {
|
|
25903
|
+
backup.close();
|
|
25904
|
+
reject(err);
|
|
25905
|
+
}
|
|
25906
|
+
});
|
|
25907
|
+
});
|
|
25908
|
+
};
|
|
25909
|
+
});
|
|
25910
|
+
|
|
25911
|
+
// node_modules/better-sqlite3/lib/methods/serialize.js
|
|
25912
|
+
var require_serialize = __commonJS((exports, module) => {
|
|
25913
|
+
var { cppdb } = require_util();
|
|
25914
|
+
module.exports = function serialize(options) {
|
|
25915
|
+
if (options == null)
|
|
25916
|
+
options = {};
|
|
25917
|
+
if (typeof options !== "object")
|
|
25918
|
+
throw new TypeError("Expected first argument to be an options object");
|
|
25919
|
+
const attachedName = "attached" in options ? options.attached : "main";
|
|
25920
|
+
if (typeof attachedName !== "string")
|
|
25921
|
+
throw new TypeError('Expected the "attached" option to be a string');
|
|
25922
|
+
if (!attachedName)
|
|
25923
|
+
throw new TypeError('The "attached" option cannot be an empty string');
|
|
25924
|
+
return this[cppdb].serialize(attachedName);
|
|
25925
|
+
};
|
|
25926
|
+
});
|
|
25927
|
+
|
|
25928
|
+
// node_modules/better-sqlite3/lib/methods/function.js
|
|
25929
|
+
var require_function = __commonJS((exports, module) => {
|
|
25930
|
+
var { getBooleanOption, cppdb } = require_util();
|
|
25931
|
+
module.exports = function defineFunction(name, options, fn) {
|
|
25932
|
+
if (options == null)
|
|
25933
|
+
options = {};
|
|
25934
|
+
if (typeof options === "function") {
|
|
25935
|
+
fn = options;
|
|
25936
|
+
options = {};
|
|
25937
|
+
}
|
|
25938
|
+
if (typeof name !== "string")
|
|
25939
|
+
throw new TypeError("Expected first argument to be a string");
|
|
25940
|
+
if (typeof fn !== "function")
|
|
25941
|
+
throw new TypeError("Expected last argument to be a function");
|
|
25942
|
+
if (typeof options !== "object")
|
|
25943
|
+
throw new TypeError("Expected second argument to be an options object");
|
|
25944
|
+
if (!name)
|
|
25945
|
+
throw new TypeError("User-defined function name cannot be an empty string");
|
|
25946
|
+
const safeIntegers = "safeIntegers" in options ? +getBooleanOption(options, "safeIntegers") : 2;
|
|
25947
|
+
const deterministic = getBooleanOption(options, "deterministic");
|
|
25948
|
+
const directOnly = getBooleanOption(options, "directOnly");
|
|
25949
|
+
const varargs = getBooleanOption(options, "varargs");
|
|
25950
|
+
let argCount = -1;
|
|
25951
|
+
if (!varargs) {
|
|
25952
|
+
argCount = fn.length;
|
|
25953
|
+
if (!Number.isInteger(argCount) || argCount < 0)
|
|
25954
|
+
throw new TypeError("Expected function.length to be a positive integer");
|
|
25955
|
+
if (argCount > 100)
|
|
25956
|
+
throw new RangeError("User-defined functions cannot have more than 100 arguments");
|
|
25957
|
+
}
|
|
25958
|
+
this[cppdb].function(fn, name, argCount, safeIntegers, deterministic, directOnly);
|
|
25959
|
+
return this;
|
|
25960
|
+
};
|
|
25961
|
+
});
|
|
25962
|
+
|
|
25963
|
+
// node_modules/better-sqlite3/lib/methods/aggregate.js
|
|
25964
|
+
var require_aggregate = __commonJS((exports, module) => {
|
|
25965
|
+
var { getBooleanOption, cppdb } = require_util();
|
|
25966
|
+
module.exports = function defineAggregate(name, options) {
|
|
25967
|
+
if (typeof name !== "string")
|
|
25968
|
+
throw new TypeError("Expected first argument to be a string");
|
|
25969
|
+
if (typeof options !== "object" || options === null)
|
|
25970
|
+
throw new TypeError("Expected second argument to be an options object");
|
|
25971
|
+
if (!name)
|
|
25972
|
+
throw new TypeError("User-defined function name cannot be an empty string");
|
|
25973
|
+
const start = "start" in options ? options.start : null;
|
|
25974
|
+
const step = getFunctionOption(options, "step", true);
|
|
25975
|
+
const inverse2 = getFunctionOption(options, "inverse", false);
|
|
25976
|
+
const result = getFunctionOption(options, "result", false);
|
|
25977
|
+
const safeIntegers = "safeIntegers" in options ? +getBooleanOption(options, "safeIntegers") : 2;
|
|
25978
|
+
const deterministic = getBooleanOption(options, "deterministic");
|
|
25979
|
+
const directOnly = getBooleanOption(options, "directOnly");
|
|
25980
|
+
const varargs = getBooleanOption(options, "varargs");
|
|
25981
|
+
let argCount = -1;
|
|
25982
|
+
if (!varargs) {
|
|
25983
|
+
argCount = Math.max(getLength(step), inverse2 ? getLength(inverse2) : 0);
|
|
25984
|
+
if (argCount > 0)
|
|
25985
|
+
argCount -= 1;
|
|
25986
|
+
if (argCount > 100)
|
|
25987
|
+
throw new RangeError("User-defined functions cannot have more than 100 arguments");
|
|
25988
|
+
}
|
|
25989
|
+
this[cppdb].aggregate(start, step, inverse2, result, name, argCount, safeIntegers, deterministic, directOnly);
|
|
25990
|
+
return this;
|
|
25991
|
+
};
|
|
25992
|
+
var getFunctionOption = (options, key, required) => {
|
|
25993
|
+
const value = key in options ? options[key] : null;
|
|
25994
|
+
if (typeof value === "function")
|
|
25995
|
+
return value;
|
|
25996
|
+
if (value != null)
|
|
25997
|
+
throw new TypeError(`Expected the "${key}" option to be a function`);
|
|
25998
|
+
if (required)
|
|
25999
|
+
throw new TypeError(`Missing required option "${key}"`);
|
|
26000
|
+
return null;
|
|
26001
|
+
};
|
|
26002
|
+
var getLength = ({ length }) => {
|
|
26003
|
+
if (Number.isInteger(length) && length >= 0)
|
|
26004
|
+
return length;
|
|
26005
|
+
throw new TypeError("Expected function.length to be a positive integer");
|
|
26006
|
+
};
|
|
26007
|
+
});
|
|
26008
|
+
|
|
26009
|
+
// node_modules/better-sqlite3/lib/methods/table.js
|
|
26010
|
+
var require_table = __commonJS((exports, module) => {
|
|
26011
|
+
var { cppdb } = require_util();
|
|
26012
|
+
module.exports = function defineTable(name, factory) {
|
|
26013
|
+
if (typeof name !== "string")
|
|
26014
|
+
throw new TypeError("Expected first argument to be a string");
|
|
26015
|
+
if (!name)
|
|
26016
|
+
throw new TypeError("Virtual table module name cannot be an empty string");
|
|
26017
|
+
let eponymous = false;
|
|
26018
|
+
if (typeof factory === "object" && factory !== null) {
|
|
26019
|
+
eponymous = true;
|
|
26020
|
+
factory = defer(parseTableDefinition(factory, "used", name));
|
|
26021
|
+
} else {
|
|
26022
|
+
if (typeof factory !== "function")
|
|
26023
|
+
throw new TypeError("Expected second argument to be a function or a table definition object");
|
|
26024
|
+
factory = wrapFactory(factory);
|
|
26025
|
+
}
|
|
26026
|
+
this[cppdb].table(factory, name, eponymous);
|
|
26027
|
+
return this;
|
|
26028
|
+
};
|
|
26029
|
+
function wrapFactory(factory) {
|
|
26030
|
+
return function virtualTableFactory(moduleName, databaseName, tableName, ...args) {
|
|
26031
|
+
const thisObject = {
|
|
26032
|
+
module: moduleName,
|
|
26033
|
+
database: databaseName,
|
|
26034
|
+
table: tableName
|
|
26035
|
+
};
|
|
26036
|
+
const def = apply.call(factory, thisObject, args);
|
|
26037
|
+
if (typeof def !== "object" || def === null) {
|
|
26038
|
+
throw new TypeError(`Virtual table module "${moduleName}" did not return a table definition object`);
|
|
26039
|
+
}
|
|
26040
|
+
return parseTableDefinition(def, "returned", moduleName);
|
|
26041
|
+
};
|
|
26042
|
+
}
|
|
26043
|
+
function parseTableDefinition(def, verb, moduleName) {
|
|
26044
|
+
if (!hasOwnProperty.call(def, "rows")) {
|
|
26045
|
+
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition without a "rows" property`);
|
|
26046
|
+
}
|
|
26047
|
+
if (!hasOwnProperty.call(def, "columns")) {
|
|
26048
|
+
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition without a "columns" property`);
|
|
26049
|
+
}
|
|
26050
|
+
const rows = def.rows;
|
|
26051
|
+
if (typeof rows !== "function" || Object.getPrototypeOf(rows) !== GeneratorFunctionPrototype) {
|
|
26052
|
+
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "rows" property (should be a generator function)`);
|
|
26053
|
+
}
|
|
26054
|
+
let columns = def.columns;
|
|
26055
|
+
if (!Array.isArray(columns) || !(columns = [...columns]).every((x) => typeof x === "string")) {
|
|
26056
|
+
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "columns" property (should be an array of strings)`);
|
|
26057
|
+
}
|
|
26058
|
+
if (columns.length !== new Set(columns).size) {
|
|
26059
|
+
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with duplicate column names`);
|
|
26060
|
+
}
|
|
26061
|
+
if (!columns.length) {
|
|
26062
|
+
throw new RangeError(`Virtual table module "${moduleName}" ${verb} a table definition with zero columns`);
|
|
26063
|
+
}
|
|
26064
|
+
let parameters;
|
|
26065
|
+
if (hasOwnProperty.call(def, "parameters")) {
|
|
26066
|
+
parameters = def.parameters;
|
|
26067
|
+
if (!Array.isArray(parameters) || !(parameters = [...parameters]).every((x) => typeof x === "string")) {
|
|
26068
|
+
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "parameters" property (should be an array of strings)`);
|
|
26069
|
+
}
|
|
26070
|
+
} else {
|
|
26071
|
+
parameters = inferParameters(rows);
|
|
26072
|
+
}
|
|
26073
|
+
if (parameters.length !== new Set(parameters).size) {
|
|
26074
|
+
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with duplicate parameter names`);
|
|
26075
|
+
}
|
|
26076
|
+
if (parameters.length > 32) {
|
|
26077
|
+
throw new RangeError(`Virtual table module "${moduleName}" ${verb} a table definition with more than the maximum number of 32 parameters`);
|
|
26078
|
+
}
|
|
26079
|
+
for (const parameter of parameters) {
|
|
26080
|
+
if (columns.includes(parameter)) {
|
|
26081
|
+
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with column "${parameter}" which was ambiguously defined as both a column and parameter`);
|
|
26082
|
+
}
|
|
26083
|
+
}
|
|
26084
|
+
let safeIntegers = 2;
|
|
26085
|
+
if (hasOwnProperty.call(def, "safeIntegers")) {
|
|
26086
|
+
const bool = def.safeIntegers;
|
|
26087
|
+
if (typeof bool !== "boolean") {
|
|
26088
|
+
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "safeIntegers" property (should be a boolean)`);
|
|
26089
|
+
}
|
|
26090
|
+
safeIntegers = +bool;
|
|
26091
|
+
}
|
|
26092
|
+
let directOnly = false;
|
|
26093
|
+
if (hasOwnProperty.call(def, "directOnly")) {
|
|
26094
|
+
directOnly = def.directOnly;
|
|
26095
|
+
if (typeof directOnly !== "boolean") {
|
|
26096
|
+
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "directOnly" property (should be a boolean)`);
|
|
26097
|
+
}
|
|
26098
|
+
}
|
|
26099
|
+
const columnDefinitions = [
|
|
26100
|
+
...parameters.map(identifier).map((str) => `${str} HIDDEN`),
|
|
26101
|
+
...columns.map(identifier)
|
|
26102
|
+
];
|
|
26103
|
+
return [
|
|
26104
|
+
`CREATE TABLE x(${columnDefinitions.join(", ")});`,
|
|
26105
|
+
wrapGenerator(rows, new Map(columns.map((x, i) => [x, parameters.length + i])), moduleName),
|
|
26106
|
+
parameters,
|
|
26107
|
+
safeIntegers,
|
|
26108
|
+
directOnly
|
|
26109
|
+
];
|
|
26110
|
+
}
|
|
26111
|
+
function wrapGenerator(generator, columnMap, moduleName) {
|
|
26112
|
+
return function* virtualTable(...args) {
|
|
26113
|
+
const output = args.map((x) => Buffer.isBuffer(x) ? Buffer.from(x) : x);
|
|
26114
|
+
for (let i = 0;i < columnMap.size; ++i) {
|
|
26115
|
+
output.push(null);
|
|
26116
|
+
}
|
|
26117
|
+
for (const row of generator(...args)) {
|
|
26118
|
+
if (Array.isArray(row)) {
|
|
26119
|
+
extractRowArray(row, output, columnMap.size, moduleName);
|
|
26120
|
+
yield output;
|
|
26121
|
+
} else if (typeof row === "object" && row !== null) {
|
|
26122
|
+
extractRowObject(row, output, columnMap, moduleName);
|
|
26123
|
+
yield output;
|
|
26124
|
+
} else {
|
|
26125
|
+
throw new TypeError(`Virtual table module "${moduleName}" yielded something that isn't a valid row object`);
|
|
26126
|
+
}
|
|
26127
|
+
}
|
|
26128
|
+
};
|
|
26129
|
+
}
|
|
26130
|
+
function extractRowArray(row, output, columnCount, moduleName) {
|
|
26131
|
+
if (row.length !== columnCount) {
|
|
26132
|
+
throw new TypeError(`Virtual table module "${moduleName}" yielded a row with an incorrect number of columns`);
|
|
26133
|
+
}
|
|
26134
|
+
const offset = output.length - columnCount;
|
|
26135
|
+
for (let i = 0;i < columnCount; ++i) {
|
|
26136
|
+
output[i + offset] = row[i];
|
|
26137
|
+
}
|
|
26138
|
+
}
|
|
26139
|
+
function extractRowObject(row, output, columnMap, moduleName) {
|
|
26140
|
+
let count = 0;
|
|
26141
|
+
for (const key of Object.keys(row)) {
|
|
26142
|
+
const index = columnMap.get(key);
|
|
26143
|
+
if (index === undefined) {
|
|
26144
|
+
throw new TypeError(`Virtual table module "${moduleName}" yielded a row with an undeclared column "${key}"`);
|
|
26145
|
+
}
|
|
26146
|
+
output[index] = row[key];
|
|
26147
|
+
count += 1;
|
|
26148
|
+
}
|
|
26149
|
+
if (count !== columnMap.size) {
|
|
26150
|
+
throw new TypeError(`Virtual table module "${moduleName}" yielded a row with missing columns`);
|
|
26151
|
+
}
|
|
26152
|
+
}
|
|
26153
|
+
function inferParameters({ length }) {
|
|
26154
|
+
if (!Number.isInteger(length) || length < 0) {
|
|
26155
|
+
throw new TypeError("Expected function.length to be a positive integer");
|
|
26156
|
+
}
|
|
26157
|
+
const params = [];
|
|
26158
|
+
for (let i = 0;i < length; ++i) {
|
|
26159
|
+
params.push(`$${i + 1}`);
|
|
26160
|
+
}
|
|
26161
|
+
return params;
|
|
26162
|
+
}
|
|
26163
|
+
var { hasOwnProperty } = Object.prototype;
|
|
26164
|
+
var { apply } = Function.prototype;
|
|
26165
|
+
var GeneratorFunctionPrototype = Object.getPrototypeOf(function* () {});
|
|
26166
|
+
var identifier = (str) => `"${str.replace(/"/g, '""')}"`;
|
|
26167
|
+
var defer = (x) => () => x;
|
|
26168
|
+
});
|
|
26169
|
+
|
|
26170
|
+
// node_modules/better-sqlite3/lib/methods/inspect.js
|
|
26171
|
+
var require_inspect = __commonJS((exports, module) => {
|
|
26172
|
+
var DatabaseInspection = function Database() {};
|
|
26173
|
+
module.exports = function inspect(depth, opts) {
|
|
26174
|
+
return Object.assign(new DatabaseInspection, this);
|
|
26175
|
+
};
|
|
26176
|
+
});
|
|
26177
|
+
|
|
26178
|
+
// node_modules/better-sqlite3/lib/database.js
|
|
26179
|
+
var require_database = __commonJS((exports, module) => {
|
|
26180
|
+
var fs = __require("fs");
|
|
26181
|
+
var path = __require("path");
|
|
26182
|
+
var util = require_util();
|
|
26183
|
+
var SqliteError = require_sqlite_error();
|
|
26184
|
+
var DEFAULT_ADDON;
|
|
26185
|
+
function Database(filenameGiven, options) {
|
|
26186
|
+
if (new.target == null) {
|
|
26187
|
+
return new Database(filenameGiven, options);
|
|
26188
|
+
}
|
|
26189
|
+
let buffer;
|
|
26190
|
+
if (Buffer.isBuffer(filenameGiven)) {
|
|
26191
|
+
buffer = filenameGiven;
|
|
26192
|
+
filenameGiven = ":memory:";
|
|
26193
|
+
}
|
|
26194
|
+
if (filenameGiven == null)
|
|
26195
|
+
filenameGiven = "";
|
|
26196
|
+
if (options == null)
|
|
26197
|
+
options = {};
|
|
26198
|
+
if (typeof filenameGiven !== "string")
|
|
26199
|
+
throw new TypeError("Expected first argument to be a string");
|
|
26200
|
+
if (typeof options !== "object")
|
|
26201
|
+
throw new TypeError("Expected second argument to be an options object");
|
|
26202
|
+
if ("readOnly" in options)
|
|
26203
|
+
throw new TypeError('Misspelled option "readOnly" should be "readonly"');
|
|
26204
|
+
if ("memory" in options)
|
|
26205
|
+
throw new TypeError('Option "memory" was removed in v7.0.0 (use ":memory:" filename instead)');
|
|
26206
|
+
const filename = filenameGiven.trim();
|
|
26207
|
+
const anonymous = filename === "" || filename === ":memory:";
|
|
26208
|
+
const readonly = util.getBooleanOption(options, "readonly");
|
|
26209
|
+
const fileMustExist = util.getBooleanOption(options, "fileMustExist");
|
|
26210
|
+
const timeout = "timeout" in options ? options.timeout : 5000;
|
|
26211
|
+
const verbose = "verbose" in options ? options.verbose : null;
|
|
26212
|
+
const nativeBinding = "nativeBinding" in options ? options.nativeBinding : null;
|
|
26213
|
+
if (readonly && anonymous && !buffer)
|
|
26214
|
+
throw new TypeError("In-memory/temporary databases cannot be readonly");
|
|
26215
|
+
if (!Number.isInteger(timeout) || timeout < 0)
|
|
26216
|
+
throw new TypeError('Expected the "timeout" option to be a positive integer');
|
|
26217
|
+
if (timeout > 2147483647)
|
|
26218
|
+
throw new RangeError('Option "timeout" cannot be greater than 2147483647');
|
|
26219
|
+
if (verbose != null && typeof verbose !== "function")
|
|
26220
|
+
throw new TypeError('Expected the "verbose" option to be a function');
|
|
26221
|
+
if (nativeBinding != null && typeof nativeBinding !== "string" && typeof nativeBinding !== "object")
|
|
26222
|
+
throw new TypeError('Expected the "nativeBinding" option to be a string or addon object');
|
|
26223
|
+
let addon;
|
|
26224
|
+
if (nativeBinding == null) {
|
|
26225
|
+
addon = DEFAULT_ADDON || (DEFAULT_ADDON = require_bindings()("better_sqlite3.node"));
|
|
26226
|
+
} else if (typeof nativeBinding === "string") {
|
|
26227
|
+
const requireFunc = typeof __non_webpack_require__ === "function" ? __non_webpack_require__ : __require;
|
|
26228
|
+
addon = requireFunc(path.resolve(nativeBinding).replace(/(\.node)?$/, ".node"));
|
|
26229
|
+
} else {
|
|
26230
|
+
addon = nativeBinding;
|
|
26231
|
+
}
|
|
26232
|
+
if (!addon.isInitialized) {
|
|
26233
|
+
addon.setErrorConstructor(SqliteError);
|
|
26234
|
+
addon.isInitialized = true;
|
|
26235
|
+
}
|
|
26236
|
+
if (!anonymous && !filename.startsWith("file:") && !fs.existsSync(path.dirname(filename))) {
|
|
26237
|
+
throw new TypeError("Cannot open database because the directory does not exist");
|
|
26238
|
+
}
|
|
26239
|
+
Object.defineProperties(this, {
|
|
26240
|
+
[util.cppdb]: { value: new addon.Database(filename, filenameGiven, anonymous, readonly, fileMustExist, timeout, verbose || null, buffer || null) },
|
|
26241
|
+
...wrappers.getters
|
|
26242
|
+
});
|
|
26243
|
+
}
|
|
26244
|
+
var wrappers = require_wrappers();
|
|
26245
|
+
Database.prototype.prepare = wrappers.prepare;
|
|
26246
|
+
Database.prototype.transaction = require_transaction();
|
|
26247
|
+
Database.prototype.pragma = require_pragma();
|
|
26248
|
+
Database.prototype.backup = require_backup();
|
|
26249
|
+
Database.prototype.serialize = require_serialize();
|
|
26250
|
+
Database.prototype.function = require_function();
|
|
26251
|
+
Database.prototype.aggregate = require_aggregate();
|
|
26252
|
+
Database.prototype.table = require_table();
|
|
26253
|
+
Database.prototype.loadExtension = wrappers.loadExtension;
|
|
26254
|
+
Database.prototype.exec = wrappers.exec;
|
|
26255
|
+
Database.prototype.close = wrappers.close;
|
|
26256
|
+
Database.prototype.defaultSafeIntegers = wrappers.defaultSafeIntegers;
|
|
26257
|
+
Database.prototype.unsafeMode = wrappers.unsafeMode;
|
|
26258
|
+
Database.prototype[util.inspect] = require_inspect();
|
|
26259
|
+
module.exports = Database;
|
|
26260
|
+
});
|
|
26261
|
+
|
|
26262
|
+
// node_modules/better-sqlite3/lib/index.js
|
|
26263
|
+
var require_lib3 = __commonJS((exports, module) => {
|
|
26264
|
+
module.exports = require_database();
|
|
26265
|
+
module.exports.SqliteError = require_sqlite_error();
|
|
26266
|
+
});
|
|
26267
|
+
|
|
25503
26268
|
// src/providers/sqlite/client.ts
|
|
25504
|
-
|
|
26269
|
+
async function loadDatabase(filename) {
|
|
26270
|
+
if (isBun) {
|
|
26271
|
+
const { Database } = await import("bun:sqlite");
|
|
26272
|
+
return new Database(filename);
|
|
26273
|
+
} else {
|
|
26274
|
+
const Database = (await Promise.resolve().then(() => __toESM(require_lib3(), 1))).default;
|
|
26275
|
+
return new Database(filename);
|
|
26276
|
+
}
|
|
26277
|
+
}
|
|
25505
26278
|
|
|
25506
26279
|
class SQLiteClient {
|
|
25507
26280
|
db;
|
|
25508
|
-
constructor(
|
|
25509
|
-
|
|
25510
|
-
|
|
26281
|
+
constructor() {}
|
|
26282
|
+
static async create(config6) {
|
|
26283
|
+
const client = new SQLiteClient;
|
|
26284
|
+
client.db = await loadDatabase(config6.filename);
|
|
26285
|
+
client.db.exec("PRAGMA foreign_keys = ON");
|
|
26286
|
+
return client;
|
|
25511
26287
|
}
|
|
25512
26288
|
async query(sql, params) {
|
|
25513
26289
|
const stmt = this.db.prepare(sql);
|
|
26290
|
+
const sqlParams = params;
|
|
25514
26291
|
if (sql.trim().toUpperCase().startsWith("SELECT") || sql.trim().toUpperCase().startsWith("PRAGMA")) {
|
|
25515
|
-
const rows =
|
|
26292
|
+
const rows = sqlParams ? stmt.all(...sqlParams) : stmt.all();
|
|
25516
26293
|
return { rows };
|
|
25517
26294
|
} else {
|
|
25518
|
-
if (
|
|
25519
|
-
stmt.run(...
|
|
26295
|
+
if (sqlParams) {
|
|
26296
|
+
stmt.run(...sqlParams);
|
|
25520
26297
|
} else {
|
|
25521
26298
|
stmt.run();
|
|
25522
26299
|
}
|
|
@@ -25536,7 +26313,10 @@ class SQLiteClient {
|
|
|
25536
26313
|
return this.db.transaction(fn)();
|
|
25537
26314
|
}
|
|
25538
26315
|
}
|
|
25539
|
-
var
|
|
26316
|
+
var isBun;
|
|
26317
|
+
var init_client = __esm(() => {
|
|
26318
|
+
isBun = typeof globalThis.Bun !== "undefined";
|
|
26319
|
+
});
|
|
25540
26320
|
|
|
25541
26321
|
// src/providers/sqlite/inspector.ts
|
|
25542
26322
|
class SQLiteInspector {
|
|
@@ -25691,7 +26471,7 @@ class SQLiteInspector {
|
|
|
25691
26471
|
const defMatch = row.sql?.match(/AS\s+(.+)$/is);
|
|
25692
26472
|
return {
|
|
25693
26473
|
name: row.name,
|
|
25694
|
-
definition: defMatch
|
|
26474
|
+
definition: defMatch?.[1]?.trim() ?? ""
|
|
25695
26475
|
};
|
|
25696
26476
|
});
|
|
25697
26477
|
}
|
|
@@ -28228,7 +29008,7 @@ class SQLiteParser {
|
|
|
28228
29008
|
const defMatch = sql?.match(/AS\s+(.+)$/is);
|
|
28229
29009
|
return {
|
|
28230
29010
|
name,
|
|
28231
|
-
definition: defMatch
|
|
29011
|
+
definition: defMatch?.[1]?.trim() ?? ""
|
|
28232
29012
|
};
|
|
28233
29013
|
});
|
|
28234
29014
|
}
|
|
@@ -28406,15 +29186,17 @@ class SQLiteDiffer {
|
|
|
28406
29186
|
const dSorted = [...d].sort((a, b) => a.columns.join(",").localeCompare(b.columns.join(",")));
|
|
28407
29187
|
const cSorted = [...c].sort((a, b) => a.columns.join(",").localeCompare(b.columns.join(",")));
|
|
28408
29188
|
for (let i = 0;i < dSorted.length; i++) {
|
|
28409
|
-
|
|
29189
|
+
const dItem = dSorted[i];
|
|
29190
|
+
const cItem = cSorted[i];
|
|
29191
|
+
if (dItem.columns.join(",") !== cItem.columns.join(","))
|
|
28410
29192
|
return true;
|
|
28411
|
-
if (
|
|
29193
|
+
if (dItem.referencedTable !== cItem.referencedTable)
|
|
28412
29194
|
return true;
|
|
28413
|
-
if (
|
|
29195
|
+
if (dItem.referencedColumns.join(",") !== cItem.referencedColumns.join(","))
|
|
28414
29196
|
return true;
|
|
28415
|
-
if (
|
|
29197
|
+
if (dItem.onDelete !== cItem.onDelete)
|
|
28416
29198
|
return true;
|
|
28417
|
-
if (
|
|
29199
|
+
if (dItem.onUpdate !== cItem.onUpdate)
|
|
28418
29200
|
return true;
|
|
28419
29201
|
}
|
|
28420
29202
|
return false;
|
|
@@ -28551,7 +29333,7 @@ class SQLiteProvider {
|
|
|
28551
29333
|
if (config6.dialect !== "sqlite") {
|
|
28552
29334
|
throw new Error("SQLiteProvider requires sqlite config");
|
|
28553
29335
|
}
|
|
28554
|
-
return
|
|
29336
|
+
return SQLiteClient.create(config6);
|
|
28555
29337
|
}
|
|
28556
29338
|
async parseSchema(sql, filePath) {
|
|
28557
29339
|
return this.parser.parseSchema(sql, filePath);
|
|
@@ -29417,7 +30199,7 @@ async function applyCommand(options, connectionStringOrConfig) {
|
|
|
29417
30199
|
// package.json
|
|
29418
30200
|
var package_default = {
|
|
29419
30201
|
name: "terradb",
|
|
29420
|
-
version: "0.4.
|
|
30202
|
+
version: "0.4.4",
|
|
29421
30203
|
description: "Declarative schema management for PostgreSQL and SQLite",
|
|
29422
30204
|
keywords: [
|
|
29423
30205
|
"postgres",
|