dorkos 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -0
- package/dist/bin/cli.js +964 -50
- package/dist/client/assets/{TopologyGraph-BjcekO_O.js → TopologyGraph-YEs4uqvE.js} +1 -1
- package/dist/client/assets/{highlighted-body-TPN3WLV5-D1vgKhTK.js → highlighted-body-TPN3WLV5-CUmfCQds.js} +1 -1
- package/dist/client/assets/index-BmPQoLY4.css +1 -0
- package/dist/client/assets/{index-Crrby1Ia.js → index-DrXqypJ0.js} +272 -272
- package/dist/client/index.html +2 -2
- package/dist/server/index.js +68027 -25758
- package/dist/server/index.js.map +4 -4
- package/package.json +4 -2
- package/dist/client/assets/index-BOsZyoVQ.css +0 -1
package/dist/bin/cli.js
CHANGED
|
@@ -5,10 +5,16 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, {
|
|
9
|
+
get: (a2, b2) => (typeof require !== "undefined" ? require : a2)[b2]
|
|
10
|
+
}) : x2)(function(x2) {
|
|
11
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
+
throw Error('Dynamic require of "' + x2 + '" is not supported');
|
|
13
|
+
});
|
|
8
14
|
var __esm = (fn, res) => function __init() {
|
|
9
15
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
16
|
};
|
|
11
|
-
var __commonJS = (cb, mod) => function
|
|
17
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
12
18
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
13
19
|
};
|
|
14
20
|
var __export = (target, all) => {
|
|
@@ -284,10 +290,10 @@ function mergeDefs(...defs) {
|
|
|
284
290
|
function cloneDef(schema) {
|
|
285
291
|
return mergeDefs(schema._zod.def);
|
|
286
292
|
}
|
|
287
|
-
function getElementAtPath(obj,
|
|
288
|
-
if (!
|
|
293
|
+
function getElementAtPath(obj, path5) {
|
|
294
|
+
if (!path5)
|
|
289
295
|
return obj;
|
|
290
|
-
return
|
|
296
|
+
return path5.reduce((acc, key) => acc?.[key], obj);
|
|
291
297
|
}
|
|
292
298
|
function promiseAllObject(promisesObj) {
|
|
293
299
|
const keys = Object.keys(promisesObj);
|
|
@@ -599,11 +605,11 @@ function aborted(x2, startIndex = 0) {
|
|
|
599
605
|
}
|
|
600
606
|
return false;
|
|
601
607
|
}
|
|
602
|
-
function prefixIssues(
|
|
608
|
+
function prefixIssues(path5, issues) {
|
|
603
609
|
return issues.map((iss) => {
|
|
604
610
|
var _a2;
|
|
605
611
|
(_a2 = iss).path ?? (_a2.path = []);
|
|
606
|
-
iss.path.unshift(
|
|
612
|
+
iss.path.unshift(path5);
|
|
607
613
|
return iss;
|
|
608
614
|
});
|
|
609
615
|
}
|
|
@@ -845,7 +851,7 @@ function formatError(error48, mapper = (issue2) => issue2.message) {
|
|
|
845
851
|
}
|
|
846
852
|
function treeifyError(error48, mapper = (issue2) => issue2.message) {
|
|
847
853
|
const result = { errors: [] };
|
|
848
|
-
const processError = (error49,
|
|
854
|
+
const processError = (error49, path5 = []) => {
|
|
849
855
|
var _a2, _b;
|
|
850
856
|
for (const issue2 of error49.issues) {
|
|
851
857
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
@@ -855,7 +861,7 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
|
|
|
855
861
|
} else if (issue2.code === "invalid_element") {
|
|
856
862
|
processError({ issues: issue2.issues }, issue2.path);
|
|
857
863
|
} else {
|
|
858
|
-
const fullpath = [...
|
|
864
|
+
const fullpath = [...path5, ...issue2.path];
|
|
859
865
|
if (fullpath.length === 0) {
|
|
860
866
|
result.errors.push(mapper(issue2));
|
|
861
867
|
continue;
|
|
@@ -887,8 +893,8 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
|
|
|
887
893
|
}
|
|
888
894
|
function toDotPath(_path) {
|
|
889
895
|
const segs = [];
|
|
890
|
-
const
|
|
891
|
-
for (const seg of
|
|
896
|
+
const path5 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
897
|
+
for (const seg of path5) {
|
|
892
898
|
if (typeof seg === "number")
|
|
893
899
|
segs.push(`[${seg}]`);
|
|
894
900
|
else if (typeof seg === "symbol")
|
|
@@ -13582,13 +13588,13 @@ function resolveRef(ref, ctx) {
|
|
|
13582
13588
|
if (!ref.startsWith("#")) {
|
|
13583
13589
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
13584
13590
|
}
|
|
13585
|
-
const
|
|
13586
|
-
if (
|
|
13591
|
+
const path5 = ref.slice(1).split("/").filter(Boolean);
|
|
13592
|
+
if (path5.length === 0) {
|
|
13587
13593
|
return ctx.rootSchema;
|
|
13588
13594
|
}
|
|
13589
13595
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
13590
|
-
if (
|
|
13591
|
-
const key =
|
|
13596
|
+
if (path5[0] === defsKey) {
|
|
13597
|
+
const key = path5[1];
|
|
13592
13598
|
if (!key || !ctx.defs[key]) {
|
|
13593
13599
|
throw new Error(`Reference not found: ${ref}`);
|
|
13594
13600
|
}
|
|
@@ -14442,6 +14448,907 @@ var init_config_schema = __esm({
|
|
|
14442
14448
|
}
|
|
14443
14449
|
});
|
|
14444
14450
|
|
|
14451
|
+
// ../../node_modules/.pnpm/better-sqlite3@12.6.2/node_modules/better-sqlite3/lib/util.js
|
|
14452
|
+
var require_util = __commonJS({
|
|
14453
|
+
"../../node_modules/.pnpm/better-sqlite3@12.6.2/node_modules/better-sqlite3/lib/util.js"(exports) {
|
|
14454
|
+
"use strict";
|
|
14455
|
+
exports.getBooleanOption = (options, key) => {
|
|
14456
|
+
let value = false;
|
|
14457
|
+
if (key in options && typeof (value = options[key]) !== "boolean") {
|
|
14458
|
+
throw new TypeError(`Expected the "${key}" option to be a boolean`);
|
|
14459
|
+
}
|
|
14460
|
+
return value;
|
|
14461
|
+
};
|
|
14462
|
+
exports.cppdb = Symbol();
|
|
14463
|
+
exports.inspect = Symbol.for("nodejs.util.inspect.custom");
|
|
14464
|
+
}
|
|
14465
|
+
});
|
|
14466
|
+
|
|
14467
|
+
// ../../node_modules/.pnpm/better-sqlite3@12.6.2/node_modules/better-sqlite3/lib/sqlite-error.js
|
|
14468
|
+
var require_sqlite_error = __commonJS({
|
|
14469
|
+
"../../node_modules/.pnpm/better-sqlite3@12.6.2/node_modules/better-sqlite3/lib/sqlite-error.js"(exports, module) {
|
|
14470
|
+
"use strict";
|
|
14471
|
+
var descriptor = { value: "SqliteError", writable: true, enumerable: false, configurable: true };
|
|
14472
|
+
function SqliteError(message, code) {
|
|
14473
|
+
if (new.target !== SqliteError) {
|
|
14474
|
+
return new SqliteError(message, code);
|
|
14475
|
+
}
|
|
14476
|
+
if (typeof code !== "string") {
|
|
14477
|
+
throw new TypeError("Expected second argument to be a string");
|
|
14478
|
+
}
|
|
14479
|
+
Error.call(this, message);
|
|
14480
|
+
descriptor.value = "" + message;
|
|
14481
|
+
Object.defineProperty(this, "message", descriptor);
|
|
14482
|
+
Error.captureStackTrace(this, SqliteError);
|
|
14483
|
+
this.code = code;
|
|
14484
|
+
}
|
|
14485
|
+
Object.setPrototypeOf(SqliteError, Error);
|
|
14486
|
+
Object.setPrototypeOf(SqliteError.prototype, Error.prototype);
|
|
14487
|
+
Object.defineProperty(SqliteError.prototype, "name", descriptor);
|
|
14488
|
+
module.exports = SqliteError;
|
|
14489
|
+
}
|
|
14490
|
+
});
|
|
14491
|
+
|
|
14492
|
+
// ../../node_modules/.pnpm/file-uri-to-path@1.0.0/node_modules/file-uri-to-path/index.js
|
|
14493
|
+
var require_file_uri_to_path = __commonJS({
|
|
14494
|
+
"../../node_modules/.pnpm/file-uri-to-path@1.0.0/node_modules/file-uri-to-path/index.js"(exports, module) {
|
|
14495
|
+
var sep2 = __require("path").sep || "/";
|
|
14496
|
+
module.exports = fileUriToPath;
|
|
14497
|
+
function fileUriToPath(uri) {
|
|
14498
|
+
if ("string" != typeof uri || uri.length <= 7 || "file://" != uri.substring(0, 7)) {
|
|
14499
|
+
throw new TypeError("must pass in a file:// URI to convert to a file path");
|
|
14500
|
+
}
|
|
14501
|
+
var rest = decodeURI(uri.substring(7));
|
|
14502
|
+
var firstSlash = rest.indexOf("/");
|
|
14503
|
+
var host = rest.substring(0, firstSlash);
|
|
14504
|
+
var path5 = rest.substring(firstSlash + 1);
|
|
14505
|
+
if ("localhost" == host) host = "";
|
|
14506
|
+
if (host) {
|
|
14507
|
+
host = sep2 + sep2 + host;
|
|
14508
|
+
}
|
|
14509
|
+
path5 = path5.replace(/^(.+)\|/, "$1:");
|
|
14510
|
+
if (sep2 == "\\") {
|
|
14511
|
+
path5 = path5.replace(/\//g, "\\");
|
|
14512
|
+
}
|
|
14513
|
+
if (/^.+\:/.test(path5)) {
|
|
14514
|
+
} else {
|
|
14515
|
+
path5 = sep2 + path5;
|
|
14516
|
+
}
|
|
14517
|
+
return host + path5;
|
|
14518
|
+
}
|
|
14519
|
+
}
|
|
14520
|
+
});
|
|
14521
|
+
|
|
14522
|
+
// ../../node_modules/.pnpm/bindings@1.5.0/node_modules/bindings/bindings.js
|
|
14523
|
+
var require_bindings = __commonJS({
|
|
14524
|
+
"../../node_modules/.pnpm/bindings@1.5.0/node_modules/bindings/bindings.js"(exports, module) {
|
|
14525
|
+
var fs5 = __require("fs");
|
|
14526
|
+
var path5 = __require("path");
|
|
14527
|
+
var fileURLToPath2 = require_file_uri_to_path();
|
|
14528
|
+
var join2 = path5.join;
|
|
14529
|
+
var dirname2 = path5.dirname;
|
|
14530
|
+
var exists = fs5.accessSync && function(path6) {
|
|
14531
|
+
try {
|
|
14532
|
+
fs5.accessSync(path6);
|
|
14533
|
+
} catch (e2) {
|
|
14534
|
+
return false;
|
|
14535
|
+
}
|
|
14536
|
+
return true;
|
|
14537
|
+
} || fs5.existsSync || path5.existsSync;
|
|
14538
|
+
var defaults = {
|
|
14539
|
+
arrow: process.env.NODE_BINDINGS_ARROW || " \u2192 ",
|
|
14540
|
+
compiled: process.env.NODE_BINDINGS_COMPILED_DIR || "compiled",
|
|
14541
|
+
platform: process.platform,
|
|
14542
|
+
arch: process.arch,
|
|
14543
|
+
nodePreGyp: "node-v" + process.versions.modules + "-" + process.platform + "-" + process.arch,
|
|
14544
|
+
version: process.versions.node,
|
|
14545
|
+
bindings: "bindings.node",
|
|
14546
|
+
try: [
|
|
14547
|
+
// node-gyp's linked version in the "build" dir
|
|
14548
|
+
["module_root", "build", "bindings"],
|
|
14549
|
+
// node-waf and gyp_addon (a.k.a node-gyp)
|
|
14550
|
+
["module_root", "build", "Debug", "bindings"],
|
|
14551
|
+
["module_root", "build", "Release", "bindings"],
|
|
14552
|
+
// Debug files, for development (legacy behavior, remove for node v0.9)
|
|
14553
|
+
["module_root", "out", "Debug", "bindings"],
|
|
14554
|
+
["module_root", "Debug", "bindings"],
|
|
14555
|
+
// Release files, but manually compiled (legacy behavior, remove for node v0.9)
|
|
14556
|
+
["module_root", "out", "Release", "bindings"],
|
|
14557
|
+
["module_root", "Release", "bindings"],
|
|
14558
|
+
// Legacy from node-waf, node <= 0.4.x
|
|
14559
|
+
["module_root", "build", "default", "bindings"],
|
|
14560
|
+
// Production "Release" buildtype binary (meh...)
|
|
14561
|
+
["module_root", "compiled", "version", "platform", "arch", "bindings"],
|
|
14562
|
+
// node-qbs builds
|
|
14563
|
+
["module_root", "addon-build", "release", "install-root", "bindings"],
|
|
14564
|
+
["module_root", "addon-build", "debug", "install-root", "bindings"],
|
|
14565
|
+
["module_root", "addon-build", "default", "install-root", "bindings"],
|
|
14566
|
+
// node-pre-gyp path ./lib/binding/{node_abi}-{platform}-{arch}
|
|
14567
|
+
["module_root", "lib", "binding", "nodePreGyp", "bindings"]
|
|
14568
|
+
]
|
|
14569
|
+
};
|
|
14570
|
+
function bindings(opts) {
|
|
14571
|
+
if (typeof opts == "string") {
|
|
14572
|
+
opts = { bindings: opts };
|
|
14573
|
+
} else if (!opts) {
|
|
14574
|
+
opts = {};
|
|
14575
|
+
}
|
|
14576
|
+
Object.keys(defaults).map(function(i3) {
|
|
14577
|
+
if (!(i3 in opts)) opts[i3] = defaults[i3];
|
|
14578
|
+
});
|
|
14579
|
+
if (!opts.module_root) {
|
|
14580
|
+
opts.module_root = exports.getRoot(exports.getFileName());
|
|
14581
|
+
}
|
|
14582
|
+
if (path5.extname(opts.bindings) != ".node") {
|
|
14583
|
+
opts.bindings += ".node";
|
|
14584
|
+
}
|
|
14585
|
+
var requireFunc = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
|
|
14586
|
+
var tries = [], i2 = 0, l2 = opts.try.length, n2, b2, err;
|
|
14587
|
+
for (; i2 < l2; i2++) {
|
|
14588
|
+
n2 = join2.apply(
|
|
14589
|
+
null,
|
|
14590
|
+
opts.try[i2].map(function(p) {
|
|
14591
|
+
return opts[p] || p;
|
|
14592
|
+
})
|
|
14593
|
+
);
|
|
14594
|
+
tries.push(n2);
|
|
14595
|
+
try {
|
|
14596
|
+
b2 = opts.path ? requireFunc.resolve(n2) : requireFunc(n2);
|
|
14597
|
+
if (!opts.path) {
|
|
14598
|
+
b2.path = n2;
|
|
14599
|
+
}
|
|
14600
|
+
return b2;
|
|
14601
|
+
} catch (e2) {
|
|
14602
|
+
if (e2.code !== "MODULE_NOT_FOUND" && e2.code !== "QUALIFIED_PATH_RESOLUTION_FAILED" && !/not find/i.test(e2.message)) {
|
|
14603
|
+
throw e2;
|
|
14604
|
+
}
|
|
14605
|
+
}
|
|
14606
|
+
}
|
|
14607
|
+
err = new Error(
|
|
14608
|
+
"Could not locate the bindings file. Tried:\n" + tries.map(function(a2) {
|
|
14609
|
+
return opts.arrow + a2;
|
|
14610
|
+
}).join("\n")
|
|
14611
|
+
);
|
|
14612
|
+
err.tries = tries;
|
|
14613
|
+
throw err;
|
|
14614
|
+
}
|
|
14615
|
+
module.exports = exports = bindings;
|
|
14616
|
+
exports.getFileName = function getFileName(calling_file) {
|
|
14617
|
+
var origPST = Error.prepareStackTrace, origSTL = Error.stackTraceLimit, dummy = {}, fileName;
|
|
14618
|
+
Error.stackTraceLimit = 10;
|
|
14619
|
+
Error.prepareStackTrace = function(e2, st) {
|
|
14620
|
+
for (var i2 = 0, l2 = st.length; i2 < l2; i2++) {
|
|
14621
|
+
fileName = st[i2].getFileName();
|
|
14622
|
+
if (fileName !== __filename) {
|
|
14623
|
+
if (calling_file) {
|
|
14624
|
+
if (fileName !== calling_file) {
|
|
14625
|
+
return;
|
|
14626
|
+
}
|
|
14627
|
+
} else {
|
|
14628
|
+
return;
|
|
14629
|
+
}
|
|
14630
|
+
}
|
|
14631
|
+
}
|
|
14632
|
+
};
|
|
14633
|
+
Error.captureStackTrace(dummy);
|
|
14634
|
+
dummy.stack;
|
|
14635
|
+
Error.prepareStackTrace = origPST;
|
|
14636
|
+
Error.stackTraceLimit = origSTL;
|
|
14637
|
+
var fileSchema = "file://";
|
|
14638
|
+
if (fileName.indexOf(fileSchema) === 0) {
|
|
14639
|
+
fileName = fileURLToPath2(fileName);
|
|
14640
|
+
}
|
|
14641
|
+
return fileName;
|
|
14642
|
+
};
|
|
14643
|
+
exports.getRoot = function getRoot(file2) {
|
|
14644
|
+
var dir = dirname2(file2), prev;
|
|
14645
|
+
while (true) {
|
|
14646
|
+
if (dir === ".") {
|
|
14647
|
+
dir = process.cwd();
|
|
14648
|
+
}
|
|
14649
|
+
if (exists(join2(dir, "package.json")) || exists(join2(dir, "node_modules"))) {
|
|
14650
|
+
return dir;
|
|
14651
|
+
}
|
|
14652
|
+
if (prev === dir) {
|
|
14653
|
+
throw new Error(
|
|
14654
|
+
'Could not find module root given file: "' + file2 + '". Do you have a `package.json` file? '
|
|
14655
|
+
);
|
|
14656
|
+
}
|
|
14657
|
+
prev = dir;
|
|
14658
|
+
dir = join2(dir, "..");
|
|
14659
|
+
}
|
|
14660
|
+
};
|
|
14661
|
+
}
|
|
14662
|
+
});
|
|
14663
|
+
|
|
14664
|
+
// ../../node_modules/.pnpm/better-sqlite3@12.6.2/node_modules/better-sqlite3/lib/methods/wrappers.js
|
|
14665
|
+
var require_wrappers = __commonJS({
|
|
14666
|
+
"../../node_modules/.pnpm/better-sqlite3@12.6.2/node_modules/better-sqlite3/lib/methods/wrappers.js"(exports) {
|
|
14667
|
+
"use strict";
|
|
14668
|
+
var { cppdb } = require_util();
|
|
14669
|
+
exports.prepare = function prepare(sql) {
|
|
14670
|
+
return this[cppdb].prepare(sql, this, false);
|
|
14671
|
+
};
|
|
14672
|
+
exports.exec = function exec(sql) {
|
|
14673
|
+
this[cppdb].exec(sql);
|
|
14674
|
+
return this;
|
|
14675
|
+
};
|
|
14676
|
+
exports.close = function close() {
|
|
14677
|
+
this[cppdb].close();
|
|
14678
|
+
return this;
|
|
14679
|
+
};
|
|
14680
|
+
exports.loadExtension = function loadExtension(...args) {
|
|
14681
|
+
this[cppdb].loadExtension(...args);
|
|
14682
|
+
return this;
|
|
14683
|
+
};
|
|
14684
|
+
exports.defaultSafeIntegers = function defaultSafeIntegers(...args) {
|
|
14685
|
+
this[cppdb].defaultSafeIntegers(...args);
|
|
14686
|
+
return this;
|
|
14687
|
+
};
|
|
14688
|
+
exports.unsafeMode = function unsafeMode(...args) {
|
|
14689
|
+
this[cppdb].unsafeMode(...args);
|
|
14690
|
+
return this;
|
|
14691
|
+
};
|
|
14692
|
+
exports.getters = {
|
|
14693
|
+
name: {
|
|
14694
|
+
get: function name() {
|
|
14695
|
+
return this[cppdb].name;
|
|
14696
|
+
},
|
|
14697
|
+
enumerable: true
|
|
14698
|
+
},
|
|
14699
|
+
open: {
|
|
14700
|
+
get: function open() {
|
|
14701
|
+
return this[cppdb].open;
|
|
14702
|
+
},
|
|
14703
|
+
enumerable: true
|
|
14704
|
+
},
|
|
14705
|
+
inTransaction: {
|
|
14706
|
+
get: function inTransaction() {
|
|
14707
|
+
return this[cppdb].inTransaction;
|
|
14708
|
+
},
|
|
14709
|
+
enumerable: true
|
|
14710
|
+
},
|
|
14711
|
+
readonly: {
|
|
14712
|
+
get: function readonly2() {
|
|
14713
|
+
return this[cppdb].readonly;
|
|
14714
|
+
},
|
|
14715
|
+
enumerable: true
|
|
14716
|
+
},
|
|
14717
|
+
memory: {
|
|
14718
|
+
get: function memory() {
|
|
14719
|
+
return this[cppdb].memory;
|
|
14720
|
+
},
|
|
14721
|
+
enumerable: true
|
|
14722
|
+
}
|
|
14723
|
+
};
|
|
14724
|
+
}
|
|
14725
|
+
});
|
|
14726
|
+
|
|
14727
|
+
// ../../node_modules/.pnpm/better-sqlite3@12.6.2/node_modules/better-sqlite3/lib/methods/transaction.js
|
|
14728
|
+
var require_transaction = __commonJS({
|
|
14729
|
+
"../../node_modules/.pnpm/better-sqlite3@12.6.2/node_modules/better-sqlite3/lib/methods/transaction.js"(exports, module) {
|
|
14730
|
+
"use strict";
|
|
14731
|
+
var { cppdb } = require_util();
|
|
14732
|
+
var controllers = /* @__PURE__ */ new WeakMap();
|
|
14733
|
+
module.exports = function transaction(fn) {
|
|
14734
|
+
if (typeof fn !== "function") throw new TypeError("Expected first argument to be a function");
|
|
14735
|
+
const db = this[cppdb];
|
|
14736
|
+
const controller = getController(db, this);
|
|
14737
|
+
const { apply } = Function.prototype;
|
|
14738
|
+
const properties = {
|
|
14739
|
+
default: { value: wrapTransaction(apply, fn, db, controller.default) },
|
|
14740
|
+
deferred: { value: wrapTransaction(apply, fn, db, controller.deferred) },
|
|
14741
|
+
immediate: { value: wrapTransaction(apply, fn, db, controller.immediate) },
|
|
14742
|
+
exclusive: { value: wrapTransaction(apply, fn, db, controller.exclusive) },
|
|
14743
|
+
database: { value: this, enumerable: true }
|
|
14744
|
+
};
|
|
14745
|
+
Object.defineProperties(properties.default.value, properties);
|
|
14746
|
+
Object.defineProperties(properties.deferred.value, properties);
|
|
14747
|
+
Object.defineProperties(properties.immediate.value, properties);
|
|
14748
|
+
Object.defineProperties(properties.exclusive.value, properties);
|
|
14749
|
+
return properties.default.value;
|
|
14750
|
+
};
|
|
14751
|
+
var getController = (db, self) => {
|
|
14752
|
+
let controller = controllers.get(db);
|
|
14753
|
+
if (!controller) {
|
|
14754
|
+
const shared = {
|
|
14755
|
+
commit: db.prepare("COMMIT", self, false),
|
|
14756
|
+
rollback: db.prepare("ROLLBACK", self, false),
|
|
14757
|
+
savepoint: db.prepare("SAVEPOINT ` _bs3. `", self, false),
|
|
14758
|
+
release: db.prepare("RELEASE ` _bs3. `", self, false),
|
|
14759
|
+
rollbackTo: db.prepare("ROLLBACK TO ` _bs3. `", self, false)
|
|
14760
|
+
};
|
|
14761
|
+
controllers.set(db, controller = {
|
|
14762
|
+
default: Object.assign({ begin: db.prepare("BEGIN", self, false) }, shared),
|
|
14763
|
+
deferred: Object.assign({ begin: db.prepare("BEGIN DEFERRED", self, false) }, shared),
|
|
14764
|
+
immediate: Object.assign({ begin: db.prepare("BEGIN IMMEDIATE", self, false) }, shared),
|
|
14765
|
+
exclusive: Object.assign({ begin: db.prepare("BEGIN EXCLUSIVE", self, false) }, shared)
|
|
14766
|
+
});
|
|
14767
|
+
}
|
|
14768
|
+
return controller;
|
|
14769
|
+
};
|
|
14770
|
+
var wrapTransaction = (apply, fn, db, { begin, commit, rollback, savepoint, release, rollbackTo }) => function sqliteTransaction() {
|
|
14771
|
+
let before, after, undo;
|
|
14772
|
+
if (db.inTransaction) {
|
|
14773
|
+
before = savepoint;
|
|
14774
|
+
after = release;
|
|
14775
|
+
undo = rollbackTo;
|
|
14776
|
+
} else {
|
|
14777
|
+
before = begin;
|
|
14778
|
+
after = commit;
|
|
14779
|
+
undo = rollback;
|
|
14780
|
+
}
|
|
14781
|
+
before.run();
|
|
14782
|
+
try {
|
|
14783
|
+
const result = apply.call(fn, this, arguments);
|
|
14784
|
+
if (result && typeof result.then === "function") {
|
|
14785
|
+
throw new TypeError("Transaction function cannot return a promise");
|
|
14786
|
+
}
|
|
14787
|
+
after.run();
|
|
14788
|
+
return result;
|
|
14789
|
+
} catch (ex) {
|
|
14790
|
+
if (db.inTransaction) {
|
|
14791
|
+
undo.run();
|
|
14792
|
+
if (undo !== rollback) after.run();
|
|
14793
|
+
}
|
|
14794
|
+
throw ex;
|
|
14795
|
+
}
|
|
14796
|
+
};
|
|
14797
|
+
}
|
|
14798
|
+
});
|
|
14799
|
+
|
|
14800
|
+
// ../../node_modules/.pnpm/better-sqlite3@12.6.2/node_modules/better-sqlite3/lib/methods/pragma.js
|
|
14801
|
+
var require_pragma = __commonJS({
|
|
14802
|
+
"../../node_modules/.pnpm/better-sqlite3@12.6.2/node_modules/better-sqlite3/lib/methods/pragma.js"(exports, module) {
|
|
14803
|
+
"use strict";
|
|
14804
|
+
var { getBooleanOption, cppdb } = require_util();
|
|
14805
|
+
module.exports = function pragma(source, options) {
|
|
14806
|
+
if (options == null) options = {};
|
|
14807
|
+
if (typeof source !== "string") throw new TypeError("Expected first argument to be a string");
|
|
14808
|
+
if (typeof options !== "object") throw new TypeError("Expected second argument to be an options object");
|
|
14809
|
+
const simple = getBooleanOption(options, "simple");
|
|
14810
|
+
const stmt = this[cppdb].prepare(`PRAGMA ${source}`, this, true);
|
|
14811
|
+
return simple ? stmt.pluck().get() : stmt.all();
|
|
14812
|
+
};
|
|
14813
|
+
}
|
|
14814
|
+
});
|
|
14815
|
+
|
|
14816
|
+
// ../../node_modules/.pnpm/better-sqlite3@12.6.2/node_modules/better-sqlite3/lib/methods/backup.js
|
|
14817
|
+
var require_backup = __commonJS({
|
|
14818
|
+
"../../node_modules/.pnpm/better-sqlite3@12.6.2/node_modules/better-sqlite3/lib/methods/backup.js"(exports, module) {
|
|
14819
|
+
"use strict";
|
|
14820
|
+
var fs5 = __require("fs");
|
|
14821
|
+
var path5 = __require("path");
|
|
14822
|
+
var { promisify } = __require("util");
|
|
14823
|
+
var { cppdb } = require_util();
|
|
14824
|
+
var fsAccess = promisify(fs5.access);
|
|
14825
|
+
module.exports = async function backup(filename, options) {
|
|
14826
|
+
if (options == null) options = {};
|
|
14827
|
+
if (typeof filename !== "string") throw new TypeError("Expected first argument to be a string");
|
|
14828
|
+
if (typeof options !== "object") throw new TypeError("Expected second argument to be an options object");
|
|
14829
|
+
filename = filename.trim();
|
|
14830
|
+
const attachedName = "attached" in options ? options.attached : "main";
|
|
14831
|
+
const handler = "progress" in options ? options.progress : null;
|
|
14832
|
+
if (!filename) throw new TypeError("Backup filename cannot be an empty string");
|
|
14833
|
+
if (filename === ":memory:") throw new TypeError('Invalid backup filename ":memory:"');
|
|
14834
|
+
if (typeof attachedName !== "string") throw new TypeError('Expected the "attached" option to be a string');
|
|
14835
|
+
if (!attachedName) throw new TypeError('The "attached" option cannot be an empty string');
|
|
14836
|
+
if (handler != null && typeof handler !== "function") throw new TypeError('Expected the "progress" option to be a function');
|
|
14837
|
+
await fsAccess(path5.dirname(filename)).catch(() => {
|
|
14838
|
+
throw new TypeError("Cannot save backup because the directory does not exist");
|
|
14839
|
+
});
|
|
14840
|
+
const isNewFile = await fsAccess(filename).then(() => false, () => true);
|
|
14841
|
+
return runBackup(this[cppdb].backup(this, attachedName, filename, isNewFile), handler || null);
|
|
14842
|
+
};
|
|
14843
|
+
var runBackup = (backup, handler) => {
|
|
14844
|
+
let rate = 0;
|
|
14845
|
+
let useDefault = true;
|
|
14846
|
+
return new Promise((resolve, reject) => {
|
|
14847
|
+
setImmediate(function step() {
|
|
14848
|
+
try {
|
|
14849
|
+
const progress = backup.transfer(rate);
|
|
14850
|
+
if (!progress.remainingPages) {
|
|
14851
|
+
backup.close();
|
|
14852
|
+
resolve(progress);
|
|
14853
|
+
return;
|
|
14854
|
+
}
|
|
14855
|
+
if (useDefault) {
|
|
14856
|
+
useDefault = false;
|
|
14857
|
+
rate = 100;
|
|
14858
|
+
}
|
|
14859
|
+
if (handler) {
|
|
14860
|
+
const ret = handler(progress);
|
|
14861
|
+
if (ret !== void 0) {
|
|
14862
|
+
if (typeof ret === "number" && ret === ret) rate = Math.max(0, Math.min(2147483647, Math.round(ret)));
|
|
14863
|
+
else throw new TypeError("Expected progress callback to return a number or undefined");
|
|
14864
|
+
}
|
|
14865
|
+
}
|
|
14866
|
+
setImmediate(step);
|
|
14867
|
+
} catch (err) {
|
|
14868
|
+
backup.close();
|
|
14869
|
+
reject(err);
|
|
14870
|
+
}
|
|
14871
|
+
});
|
|
14872
|
+
});
|
|
14873
|
+
};
|
|
14874
|
+
}
|
|
14875
|
+
});
|
|
14876
|
+
|
|
14877
|
+
// ../../node_modules/.pnpm/better-sqlite3@12.6.2/node_modules/better-sqlite3/lib/methods/serialize.js
|
|
14878
|
+
var require_serialize = __commonJS({
|
|
14879
|
+
"../../node_modules/.pnpm/better-sqlite3@12.6.2/node_modules/better-sqlite3/lib/methods/serialize.js"(exports, module) {
|
|
14880
|
+
"use strict";
|
|
14881
|
+
var { cppdb } = require_util();
|
|
14882
|
+
module.exports = function serialize(options) {
|
|
14883
|
+
if (options == null) options = {};
|
|
14884
|
+
if (typeof options !== "object") throw new TypeError("Expected first argument to be an options object");
|
|
14885
|
+
const attachedName = "attached" in options ? options.attached : "main";
|
|
14886
|
+
if (typeof attachedName !== "string") throw new TypeError('Expected the "attached" option to be a string');
|
|
14887
|
+
if (!attachedName) throw new TypeError('The "attached" option cannot be an empty string');
|
|
14888
|
+
return this[cppdb].serialize(attachedName);
|
|
14889
|
+
};
|
|
14890
|
+
}
|
|
14891
|
+
});
|
|
14892
|
+
|
|
14893
|
+
// ../../node_modules/.pnpm/better-sqlite3@12.6.2/node_modules/better-sqlite3/lib/methods/function.js
|
|
14894
|
+
var require_function = __commonJS({
|
|
14895
|
+
"../../node_modules/.pnpm/better-sqlite3@12.6.2/node_modules/better-sqlite3/lib/methods/function.js"(exports, module) {
|
|
14896
|
+
"use strict";
|
|
14897
|
+
var { getBooleanOption, cppdb } = require_util();
|
|
14898
|
+
module.exports = function defineFunction(name, options, fn) {
|
|
14899
|
+
if (options == null) options = {};
|
|
14900
|
+
if (typeof options === "function") {
|
|
14901
|
+
fn = options;
|
|
14902
|
+
options = {};
|
|
14903
|
+
}
|
|
14904
|
+
if (typeof name !== "string") throw new TypeError("Expected first argument to be a string");
|
|
14905
|
+
if (typeof fn !== "function") throw new TypeError("Expected last argument to be a function");
|
|
14906
|
+
if (typeof options !== "object") throw new TypeError("Expected second argument to be an options object");
|
|
14907
|
+
if (!name) throw new TypeError("User-defined function name cannot be an empty string");
|
|
14908
|
+
const safeIntegers = "safeIntegers" in options ? +getBooleanOption(options, "safeIntegers") : 2;
|
|
14909
|
+
const deterministic = getBooleanOption(options, "deterministic");
|
|
14910
|
+
const directOnly = getBooleanOption(options, "directOnly");
|
|
14911
|
+
const varargs = getBooleanOption(options, "varargs");
|
|
14912
|
+
let argCount = -1;
|
|
14913
|
+
if (!varargs) {
|
|
14914
|
+
argCount = fn.length;
|
|
14915
|
+
if (!Number.isInteger(argCount) || argCount < 0) throw new TypeError("Expected function.length to be a positive integer");
|
|
14916
|
+
if (argCount > 100) throw new RangeError("User-defined functions cannot have more than 100 arguments");
|
|
14917
|
+
}
|
|
14918
|
+
this[cppdb].function(fn, name, argCount, safeIntegers, deterministic, directOnly);
|
|
14919
|
+
return this;
|
|
14920
|
+
};
|
|
14921
|
+
}
|
|
14922
|
+
});
|
|
14923
|
+
|
|
14924
|
+
// ../../node_modules/.pnpm/better-sqlite3@12.6.2/node_modules/better-sqlite3/lib/methods/aggregate.js
|
|
14925
|
+
var require_aggregate = __commonJS({
|
|
14926
|
+
"../../node_modules/.pnpm/better-sqlite3@12.6.2/node_modules/better-sqlite3/lib/methods/aggregate.js"(exports, module) {
|
|
14927
|
+
"use strict";
|
|
14928
|
+
var { getBooleanOption, cppdb } = require_util();
|
|
14929
|
+
module.exports = function defineAggregate(name, options) {
|
|
14930
|
+
if (typeof name !== "string") throw new TypeError("Expected first argument to be a string");
|
|
14931
|
+
if (typeof options !== "object" || options === null) throw new TypeError("Expected second argument to be an options object");
|
|
14932
|
+
if (!name) throw new TypeError("User-defined function name cannot be an empty string");
|
|
14933
|
+
const start = "start" in options ? options.start : null;
|
|
14934
|
+
const step = getFunctionOption(options, "step", true);
|
|
14935
|
+
const inverse = getFunctionOption(options, "inverse", false);
|
|
14936
|
+
const result = getFunctionOption(options, "result", false);
|
|
14937
|
+
const safeIntegers = "safeIntegers" in options ? +getBooleanOption(options, "safeIntegers") : 2;
|
|
14938
|
+
const deterministic = getBooleanOption(options, "deterministic");
|
|
14939
|
+
const directOnly = getBooleanOption(options, "directOnly");
|
|
14940
|
+
const varargs = getBooleanOption(options, "varargs");
|
|
14941
|
+
let argCount = -1;
|
|
14942
|
+
if (!varargs) {
|
|
14943
|
+
argCount = Math.max(getLength(step), inverse ? getLength(inverse) : 0);
|
|
14944
|
+
if (argCount > 0) argCount -= 1;
|
|
14945
|
+
if (argCount > 100) throw new RangeError("User-defined functions cannot have more than 100 arguments");
|
|
14946
|
+
}
|
|
14947
|
+
this[cppdb].aggregate(start, step, inverse, result, name, argCount, safeIntegers, deterministic, directOnly);
|
|
14948
|
+
return this;
|
|
14949
|
+
};
|
|
14950
|
+
var getFunctionOption = (options, key, required2) => {
|
|
14951
|
+
const value = key in options ? options[key] : null;
|
|
14952
|
+
if (typeof value === "function") return value;
|
|
14953
|
+
if (value != null) throw new TypeError(`Expected the "${key}" option to be a function`);
|
|
14954
|
+
if (required2) throw new TypeError(`Missing required option "${key}"`);
|
|
14955
|
+
return null;
|
|
14956
|
+
};
|
|
14957
|
+
var getLength = ({ length }) => {
|
|
14958
|
+
if (Number.isInteger(length) && length >= 0) return length;
|
|
14959
|
+
throw new TypeError("Expected function.length to be a positive integer");
|
|
14960
|
+
};
|
|
14961
|
+
}
|
|
14962
|
+
});
|
|
14963
|
+
|
|
14964
|
+
// ../../node_modules/.pnpm/better-sqlite3@12.6.2/node_modules/better-sqlite3/lib/methods/table.js
|
|
14965
|
+
var require_table = __commonJS({
|
|
14966
|
+
"../../node_modules/.pnpm/better-sqlite3@12.6.2/node_modules/better-sqlite3/lib/methods/table.js"(exports, module) {
|
|
14967
|
+
"use strict";
|
|
14968
|
+
var { cppdb } = require_util();
|
|
14969
|
+
module.exports = function defineTable(name, factory) {
|
|
14970
|
+
if (typeof name !== "string") throw new TypeError("Expected first argument to be a string");
|
|
14971
|
+
if (!name) throw new TypeError("Virtual table module name cannot be an empty string");
|
|
14972
|
+
let eponymous = false;
|
|
14973
|
+
if (typeof factory === "object" && factory !== null) {
|
|
14974
|
+
eponymous = true;
|
|
14975
|
+
factory = defer(parseTableDefinition(factory, "used", name));
|
|
14976
|
+
} else {
|
|
14977
|
+
if (typeof factory !== "function") throw new TypeError("Expected second argument to be a function or a table definition object");
|
|
14978
|
+
factory = wrapFactory(factory);
|
|
14979
|
+
}
|
|
14980
|
+
this[cppdb].table(factory, name, eponymous);
|
|
14981
|
+
return this;
|
|
14982
|
+
};
|
|
14983
|
+
function wrapFactory(factory) {
|
|
14984
|
+
return function virtualTableFactory(moduleName, databaseName, tableName, ...args) {
|
|
14985
|
+
const thisObject = {
|
|
14986
|
+
module: moduleName,
|
|
14987
|
+
database: databaseName,
|
|
14988
|
+
table: tableName
|
|
14989
|
+
};
|
|
14990
|
+
const def = apply.call(factory, thisObject, args);
|
|
14991
|
+
if (typeof def !== "object" || def === null) {
|
|
14992
|
+
throw new TypeError(`Virtual table module "${moduleName}" did not return a table definition object`);
|
|
14993
|
+
}
|
|
14994
|
+
return parseTableDefinition(def, "returned", moduleName);
|
|
14995
|
+
};
|
|
14996
|
+
}
|
|
14997
|
+
function parseTableDefinition(def, verb, moduleName) {
|
|
14998
|
+
if (!hasOwnProperty.call(def, "rows")) {
|
|
14999
|
+
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition without a "rows" property`);
|
|
15000
|
+
}
|
|
15001
|
+
if (!hasOwnProperty.call(def, "columns")) {
|
|
15002
|
+
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition without a "columns" property`);
|
|
15003
|
+
}
|
|
15004
|
+
const rows = def.rows;
|
|
15005
|
+
if (typeof rows !== "function" || Object.getPrototypeOf(rows) !== GeneratorFunctionPrototype) {
|
|
15006
|
+
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "rows" property (should be a generator function)`);
|
|
15007
|
+
}
|
|
15008
|
+
let columns = def.columns;
|
|
15009
|
+
if (!Array.isArray(columns) || !(columns = [...columns]).every((x2) => typeof x2 === "string")) {
|
|
15010
|
+
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "columns" property (should be an array of strings)`);
|
|
15011
|
+
}
|
|
15012
|
+
if (columns.length !== new Set(columns).size) {
|
|
15013
|
+
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with duplicate column names`);
|
|
15014
|
+
}
|
|
15015
|
+
if (!columns.length) {
|
|
15016
|
+
throw new RangeError(`Virtual table module "${moduleName}" ${verb} a table definition with zero columns`);
|
|
15017
|
+
}
|
|
15018
|
+
let parameters;
|
|
15019
|
+
if (hasOwnProperty.call(def, "parameters")) {
|
|
15020
|
+
parameters = def.parameters;
|
|
15021
|
+
if (!Array.isArray(parameters) || !(parameters = [...parameters]).every((x2) => typeof x2 === "string")) {
|
|
15022
|
+
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "parameters" property (should be an array of strings)`);
|
|
15023
|
+
}
|
|
15024
|
+
} else {
|
|
15025
|
+
parameters = inferParameters(rows);
|
|
15026
|
+
}
|
|
15027
|
+
if (parameters.length !== new Set(parameters).size) {
|
|
15028
|
+
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with duplicate parameter names`);
|
|
15029
|
+
}
|
|
15030
|
+
if (parameters.length > 32) {
|
|
15031
|
+
throw new RangeError(`Virtual table module "${moduleName}" ${verb} a table definition with more than the maximum number of 32 parameters`);
|
|
15032
|
+
}
|
|
15033
|
+
for (const parameter of parameters) {
|
|
15034
|
+
if (columns.includes(parameter)) {
|
|
15035
|
+
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with column "${parameter}" which was ambiguously defined as both a column and parameter`);
|
|
15036
|
+
}
|
|
15037
|
+
}
|
|
15038
|
+
let safeIntegers = 2;
|
|
15039
|
+
if (hasOwnProperty.call(def, "safeIntegers")) {
|
|
15040
|
+
const bool = def.safeIntegers;
|
|
15041
|
+
if (typeof bool !== "boolean") {
|
|
15042
|
+
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "safeIntegers" property (should be a boolean)`);
|
|
15043
|
+
}
|
|
15044
|
+
safeIntegers = +bool;
|
|
15045
|
+
}
|
|
15046
|
+
let directOnly = false;
|
|
15047
|
+
if (hasOwnProperty.call(def, "directOnly")) {
|
|
15048
|
+
directOnly = def.directOnly;
|
|
15049
|
+
if (typeof directOnly !== "boolean") {
|
|
15050
|
+
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "directOnly" property (should be a boolean)`);
|
|
15051
|
+
}
|
|
15052
|
+
}
|
|
15053
|
+
const columnDefinitions = [
|
|
15054
|
+
...parameters.map(identifier).map((str) => `${str} HIDDEN`),
|
|
15055
|
+
...columns.map(identifier)
|
|
15056
|
+
];
|
|
15057
|
+
return [
|
|
15058
|
+
`CREATE TABLE x(${columnDefinitions.join(", ")});`,
|
|
15059
|
+
wrapGenerator(rows, new Map(columns.map((x2, i2) => [x2, parameters.length + i2])), moduleName),
|
|
15060
|
+
parameters,
|
|
15061
|
+
safeIntegers,
|
|
15062
|
+
directOnly
|
|
15063
|
+
];
|
|
15064
|
+
}
|
|
15065
|
+
function wrapGenerator(generator, columnMap, moduleName) {
|
|
15066
|
+
return function* virtualTable(...args) {
|
|
15067
|
+
const output = args.map((x2) => Buffer.isBuffer(x2) ? Buffer.from(x2) : x2);
|
|
15068
|
+
for (let i2 = 0; i2 < columnMap.size; ++i2) {
|
|
15069
|
+
output.push(null);
|
|
15070
|
+
}
|
|
15071
|
+
for (const row of generator(...args)) {
|
|
15072
|
+
if (Array.isArray(row)) {
|
|
15073
|
+
extractRowArray(row, output, columnMap.size, moduleName);
|
|
15074
|
+
yield output;
|
|
15075
|
+
} else if (typeof row === "object" && row !== null) {
|
|
15076
|
+
extractRowObject(row, output, columnMap, moduleName);
|
|
15077
|
+
yield output;
|
|
15078
|
+
} else {
|
|
15079
|
+
throw new TypeError(`Virtual table module "${moduleName}" yielded something that isn't a valid row object`);
|
|
15080
|
+
}
|
|
15081
|
+
}
|
|
15082
|
+
};
|
|
15083
|
+
}
|
|
15084
|
+
function extractRowArray(row, output, columnCount, moduleName) {
|
|
15085
|
+
if (row.length !== columnCount) {
|
|
15086
|
+
throw new TypeError(`Virtual table module "${moduleName}" yielded a row with an incorrect number of columns`);
|
|
15087
|
+
}
|
|
15088
|
+
const offset = output.length - columnCount;
|
|
15089
|
+
for (let i2 = 0; i2 < columnCount; ++i2) {
|
|
15090
|
+
output[i2 + offset] = row[i2];
|
|
15091
|
+
}
|
|
15092
|
+
}
|
|
15093
|
+
function extractRowObject(row, output, columnMap, moduleName) {
|
|
15094
|
+
let count = 0;
|
|
15095
|
+
for (const key of Object.keys(row)) {
|
|
15096
|
+
const index = columnMap.get(key);
|
|
15097
|
+
if (index === void 0) {
|
|
15098
|
+
throw new TypeError(`Virtual table module "${moduleName}" yielded a row with an undeclared column "${key}"`);
|
|
15099
|
+
}
|
|
15100
|
+
output[index] = row[key];
|
|
15101
|
+
count += 1;
|
|
15102
|
+
}
|
|
15103
|
+
if (count !== columnMap.size) {
|
|
15104
|
+
throw new TypeError(`Virtual table module "${moduleName}" yielded a row with missing columns`);
|
|
15105
|
+
}
|
|
15106
|
+
}
|
|
15107
|
+
function inferParameters({ length }) {
|
|
15108
|
+
if (!Number.isInteger(length) || length < 0) {
|
|
15109
|
+
throw new TypeError("Expected function.length to be a positive integer");
|
|
15110
|
+
}
|
|
15111
|
+
const params = [];
|
|
15112
|
+
for (let i2 = 0; i2 < length; ++i2) {
|
|
15113
|
+
params.push(`$${i2 + 1}`);
|
|
15114
|
+
}
|
|
15115
|
+
return params;
|
|
15116
|
+
}
|
|
15117
|
+
var { hasOwnProperty } = Object.prototype;
|
|
15118
|
+
var { apply } = Function.prototype;
|
|
15119
|
+
var GeneratorFunctionPrototype = Object.getPrototypeOf(function* () {
|
|
15120
|
+
});
|
|
15121
|
+
var identifier = (str) => `"${str.replace(/"/g, '""')}"`;
|
|
15122
|
+
var defer = (x2) => () => x2;
|
|
15123
|
+
}
|
|
15124
|
+
});
|
|
15125
|
+
|
|
15126
|
+
// ../../node_modules/.pnpm/better-sqlite3@12.6.2/node_modules/better-sqlite3/lib/methods/inspect.js
|
|
15127
|
+
var require_inspect = __commonJS({
|
|
15128
|
+
"../../node_modules/.pnpm/better-sqlite3@12.6.2/node_modules/better-sqlite3/lib/methods/inspect.js"(exports, module) {
|
|
15129
|
+
"use strict";
|
|
15130
|
+
var DatabaseInspection = function Database() {
|
|
15131
|
+
};
|
|
15132
|
+
module.exports = function inspect(depth, opts) {
|
|
15133
|
+
return Object.assign(new DatabaseInspection(), this);
|
|
15134
|
+
};
|
|
15135
|
+
}
|
|
15136
|
+
});
|
|
15137
|
+
|
|
15138
|
+
// ../../node_modules/.pnpm/better-sqlite3@12.6.2/node_modules/better-sqlite3/lib/database.js
|
|
15139
|
+
var require_database = __commonJS({
|
|
15140
|
+
"../../node_modules/.pnpm/better-sqlite3@12.6.2/node_modules/better-sqlite3/lib/database.js"(exports, module) {
|
|
15141
|
+
"use strict";
|
|
15142
|
+
var fs5 = __require("fs");
|
|
15143
|
+
var path5 = __require("path");
|
|
15144
|
+
var util = require_util();
|
|
15145
|
+
var SqliteError = require_sqlite_error();
|
|
15146
|
+
var DEFAULT_ADDON;
|
|
15147
|
+
function Database(filenameGiven, options) {
|
|
15148
|
+
if (new.target == null) {
|
|
15149
|
+
return new Database(filenameGiven, options);
|
|
15150
|
+
}
|
|
15151
|
+
let buffer;
|
|
15152
|
+
if (Buffer.isBuffer(filenameGiven)) {
|
|
15153
|
+
buffer = filenameGiven;
|
|
15154
|
+
filenameGiven = ":memory:";
|
|
15155
|
+
}
|
|
15156
|
+
if (filenameGiven == null) filenameGiven = "";
|
|
15157
|
+
if (options == null) options = {};
|
|
15158
|
+
if (typeof filenameGiven !== "string") throw new TypeError("Expected first argument to be a string");
|
|
15159
|
+
if (typeof options !== "object") throw new TypeError("Expected second argument to be an options object");
|
|
15160
|
+
if ("readOnly" in options) throw new TypeError('Misspelled option "readOnly" should be "readonly"');
|
|
15161
|
+
if ("memory" in options) throw new TypeError('Option "memory" was removed in v7.0.0 (use ":memory:" filename instead)');
|
|
15162
|
+
const filename = filenameGiven.trim();
|
|
15163
|
+
const anonymous = filename === "" || filename === ":memory:";
|
|
15164
|
+
const readonly2 = util.getBooleanOption(options, "readonly");
|
|
15165
|
+
const fileMustExist = util.getBooleanOption(options, "fileMustExist");
|
|
15166
|
+
const timeout = "timeout" in options ? options.timeout : 5e3;
|
|
15167
|
+
const verbose = "verbose" in options ? options.verbose : null;
|
|
15168
|
+
const nativeBinding = "nativeBinding" in options ? options.nativeBinding : null;
|
|
15169
|
+
if (readonly2 && anonymous && !buffer) throw new TypeError("In-memory/temporary databases cannot be readonly");
|
|
15170
|
+
if (!Number.isInteger(timeout) || timeout < 0) throw new TypeError('Expected the "timeout" option to be a positive integer');
|
|
15171
|
+
if (timeout > 2147483647) throw new RangeError('Option "timeout" cannot be greater than 2147483647');
|
|
15172
|
+
if (verbose != null && typeof verbose !== "function") throw new TypeError('Expected the "verbose" option to be a function');
|
|
15173
|
+
if (nativeBinding != null && typeof nativeBinding !== "string" && typeof nativeBinding !== "object") throw new TypeError('Expected the "nativeBinding" option to be a string or addon object');
|
|
15174
|
+
let addon;
|
|
15175
|
+
if (nativeBinding == null) {
|
|
15176
|
+
addon = DEFAULT_ADDON || (DEFAULT_ADDON = require_bindings()("better_sqlite3.node"));
|
|
15177
|
+
} else if (typeof nativeBinding === "string") {
|
|
15178
|
+
const requireFunc = typeof __non_webpack_require__ === "function" ? __non_webpack_require__ : __require;
|
|
15179
|
+
addon = requireFunc(path5.resolve(nativeBinding).replace(/(\.node)?$/, ".node"));
|
|
15180
|
+
} else {
|
|
15181
|
+
addon = nativeBinding;
|
|
15182
|
+
}
|
|
15183
|
+
if (!addon.isInitialized) {
|
|
15184
|
+
addon.setErrorConstructor(SqliteError);
|
|
15185
|
+
addon.isInitialized = true;
|
|
15186
|
+
}
|
|
15187
|
+
if (!anonymous && !filename.startsWith("file:") && !fs5.existsSync(path5.dirname(filename))) {
|
|
15188
|
+
throw new TypeError("Cannot open database because the directory does not exist");
|
|
15189
|
+
}
|
|
15190
|
+
Object.defineProperties(this, {
|
|
15191
|
+
[util.cppdb]: { value: new addon.Database(filename, filenameGiven, anonymous, readonly2, fileMustExist, timeout, verbose || null, buffer || null) },
|
|
15192
|
+
...wrappers.getters
|
|
15193
|
+
});
|
|
15194
|
+
}
|
|
15195
|
+
var wrappers = require_wrappers();
|
|
15196
|
+
Database.prototype.prepare = wrappers.prepare;
|
|
15197
|
+
Database.prototype.transaction = require_transaction();
|
|
15198
|
+
Database.prototype.pragma = require_pragma();
|
|
15199
|
+
Database.prototype.backup = require_backup();
|
|
15200
|
+
Database.prototype.serialize = require_serialize();
|
|
15201
|
+
Database.prototype.function = require_function();
|
|
15202
|
+
Database.prototype.aggregate = require_aggregate();
|
|
15203
|
+
Database.prototype.table = require_table();
|
|
15204
|
+
Database.prototype.loadExtension = wrappers.loadExtension;
|
|
15205
|
+
Database.prototype.exec = wrappers.exec;
|
|
15206
|
+
Database.prototype.close = wrappers.close;
|
|
15207
|
+
Database.prototype.defaultSafeIntegers = wrappers.defaultSafeIntegers;
|
|
15208
|
+
Database.prototype.unsafeMode = wrappers.unsafeMode;
|
|
15209
|
+
Database.prototype[util.inspect] = require_inspect();
|
|
15210
|
+
module.exports = Database;
|
|
15211
|
+
}
|
|
15212
|
+
});
|
|
15213
|
+
|
|
15214
|
+
// ../../node_modules/.pnpm/better-sqlite3@12.6.2/node_modules/better-sqlite3/lib/index.js
|
|
15215
|
+
var require_lib = __commonJS({
|
|
15216
|
+
"../../node_modules/.pnpm/better-sqlite3@12.6.2/node_modules/better-sqlite3/lib/index.js"(exports, module) {
|
|
15217
|
+
"use strict";
|
|
15218
|
+
module.exports = require_database();
|
|
15219
|
+
module.exports.SqliteError = require_sqlite_error();
|
|
15220
|
+
}
|
|
15221
|
+
});
|
|
15222
|
+
|
|
15223
|
+
// src/cleanup-command.ts
|
|
15224
|
+
var cleanup_command_exports = {};
|
|
15225
|
+
__export(cleanup_command_exports, {
|
|
15226
|
+
runCleanup: () => runCleanup
|
|
15227
|
+
});
|
|
15228
|
+
import { confirm } from "@inquirer/prompts";
|
|
15229
|
+
import fs from "fs";
|
|
15230
|
+
import path from "path";
|
|
15231
|
+
import http from "node:http";
|
|
15232
|
+
function readPort(dorkHome) {
|
|
15233
|
+
try {
|
|
15234
|
+
const raw = fs.readFileSync(path.join(dorkHome, "config.json"), "utf-8");
|
|
15235
|
+
const config2 = JSON.parse(raw);
|
|
15236
|
+
const port2 = config2?.server?.port;
|
|
15237
|
+
if (typeof port2 === "number" && port2 > 0) return port2;
|
|
15238
|
+
} catch {
|
|
15239
|
+
}
|
|
15240
|
+
return DEFAULT_PORT2;
|
|
15241
|
+
}
|
|
15242
|
+
function isServerRunning(port2) {
|
|
15243
|
+
return new Promise((resolve) => {
|
|
15244
|
+
const req = http.get(`http://localhost:${port2}/api/health`, { timeout: 1e3 }, (res) => {
|
|
15245
|
+
res.resume();
|
|
15246
|
+
resolve(res.statusCode === 200);
|
|
15247
|
+
});
|
|
15248
|
+
req.on("error", () => resolve(false));
|
|
15249
|
+
req.on("timeout", () => {
|
|
15250
|
+
req.destroy();
|
|
15251
|
+
resolve(false);
|
|
15252
|
+
});
|
|
15253
|
+
});
|
|
15254
|
+
}
|
|
15255
|
+
async function findProjectPaths(dbPath) {
|
|
15256
|
+
try {
|
|
15257
|
+
const { default: Database } = await Promise.resolve().then(() => __toESM(require_lib(), 1));
|
|
15258
|
+
const db = new Database(dbPath, { readonly: true });
|
|
15259
|
+
try {
|
|
15260
|
+
const rows = db.prepare("SELECT DISTINCT project_path FROM agents").all();
|
|
15261
|
+
return rows.map((r3) => r3.project_path).filter((p) => fs.existsSync(path.join(p, ".dork")));
|
|
15262
|
+
} finally {
|
|
15263
|
+
db.close();
|
|
15264
|
+
}
|
|
15265
|
+
} catch {
|
|
15266
|
+
return [];
|
|
15267
|
+
}
|
|
15268
|
+
}
|
|
15269
|
+
async function runCleanup(options) {
|
|
15270
|
+
const { dorkHome } = options;
|
|
15271
|
+
if (!fs.existsSync(dorkHome)) {
|
|
15272
|
+
console.log("\nNo DorkOS data found. Nothing to clean up.\n");
|
|
15273
|
+
return;
|
|
15274
|
+
}
|
|
15275
|
+
const port2 = readPort(dorkHome);
|
|
15276
|
+
if (await isServerRunning(port2)) {
|
|
15277
|
+
console.log(
|
|
15278
|
+
`
|
|
15279
|
+
DorkOS server is running on port ${port2}. Stop it before running cleanup.
|
|
15280
|
+
`
|
|
15281
|
+
);
|
|
15282
|
+
process.exitCode = 1;
|
|
15283
|
+
return;
|
|
15284
|
+
}
|
|
15285
|
+
console.log("\nDorkOS Cleanup\n");
|
|
15286
|
+
const entries = fs.readdirSync(dorkHome);
|
|
15287
|
+
if (entries.length === 0) {
|
|
15288
|
+
console.log("No DorkOS data found. Nothing to clean up.\n");
|
|
15289
|
+
return;
|
|
15290
|
+
}
|
|
15291
|
+
console.log(`Global data (${dorkHome}):`);
|
|
15292
|
+
for (const entry of entries) {
|
|
15293
|
+
const description = KNOWN_ENTRIES[entry] ?? "unknown";
|
|
15294
|
+
console.log(` ${entry.padEnd(20)} (${description})`);
|
|
15295
|
+
}
|
|
15296
|
+
console.log("");
|
|
15297
|
+
const dbPath = path.join(dorkHome, "dork.db");
|
|
15298
|
+
const projectPaths = fs.existsSync(dbPath) ? await findProjectPaths(dbPath) : [];
|
|
15299
|
+
const removeGlobal = await confirm({
|
|
15300
|
+
message: `Remove global DorkOS data (${dorkHome})?`,
|
|
15301
|
+
default: false
|
|
15302
|
+
});
|
|
15303
|
+
if (!removeGlobal) {
|
|
15304
|
+
console.log("\n Aborted.\n");
|
|
15305
|
+
return;
|
|
15306
|
+
}
|
|
15307
|
+
fs.rmSync(dorkHome, { recursive: true, force: true });
|
|
15308
|
+
console.log(`
|
|
15309
|
+
Removed ${dorkHome}
|
|
15310
|
+
`);
|
|
15311
|
+
if (projectPaths.length > 0) {
|
|
15312
|
+
console.log(`Found ${projectPaths.length} project(s) with agent data:`);
|
|
15313
|
+
for (const p of projectPaths) {
|
|
15314
|
+
console.log(` ${p}/.dork/`);
|
|
15315
|
+
}
|
|
15316
|
+
console.log("");
|
|
15317
|
+
const removeProjects = await confirm({
|
|
15318
|
+
message: "Also remove per-project agent data?",
|
|
15319
|
+
default: false
|
|
15320
|
+
});
|
|
15321
|
+
if (removeProjects) {
|
|
15322
|
+
for (const p of projectPaths) {
|
|
15323
|
+
const dorkDir = path.join(p, ".dork");
|
|
15324
|
+
fs.rmSync(dorkDir, { recursive: true, force: true });
|
|
15325
|
+
console.log(` Removed ${dorkDir}`);
|
|
15326
|
+
}
|
|
15327
|
+
console.log("");
|
|
15328
|
+
} else {
|
|
15329
|
+
console.log("\n Skipped per-project data.\n");
|
|
15330
|
+
}
|
|
15331
|
+
}
|
|
15332
|
+
console.log("Will NOT touch:");
|
|
15333
|
+
console.log(" ~/.claude/ (Claude Code \u2014 not managed by DorkOS)\n");
|
|
15334
|
+
console.log("To complete uninstall: npm uninstall -g dorkos\n");
|
|
15335
|
+
}
|
|
15336
|
+
var DEFAULT_PORT2, KNOWN_ENTRIES;
|
|
15337
|
+
var init_cleanup_command = __esm({
|
|
15338
|
+
"src/cleanup-command.ts"() {
|
|
15339
|
+
"use strict";
|
|
15340
|
+
DEFAULT_PORT2 = 4242;
|
|
15341
|
+
KNOWN_ENTRIES = {
|
|
15342
|
+
"config.json": "user configuration",
|
|
15343
|
+
"dork.db": "SQLite database",
|
|
15344
|
+
"dork.db-wal": "SQLite write-ahead log",
|
|
15345
|
+
"dork.db-shm": "SQLite shared memory",
|
|
15346
|
+
logs: "server logs",
|
|
15347
|
+
relay: "adapter state"
|
|
15348
|
+
};
|
|
15349
|
+
}
|
|
15350
|
+
});
|
|
15351
|
+
|
|
14445
15352
|
// ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/core.mjs
|
|
14446
15353
|
function isPlainObject$1(value) {
|
|
14447
15354
|
if (value === null || typeof value !== "object") {
|
|
@@ -16338,8 +17245,8 @@ __export(config_manager_exports, {
|
|
|
16338
17245
|
initConfigManager: () => initConfigManager
|
|
16339
17246
|
});
|
|
16340
17247
|
import Conf from "conf";
|
|
16341
|
-
import
|
|
16342
|
-
import
|
|
17248
|
+
import fs2 from "fs";
|
|
17249
|
+
import path2 from "path";
|
|
16343
17250
|
function initConfigManager(dorkHome) {
|
|
16344
17251
|
configManager = new ConfigManager(dorkHome);
|
|
16345
17252
|
return configManager;
|
|
@@ -16360,8 +17267,8 @@ var init_config_manager = __esm({
|
|
|
16360
17267
|
_isFirstRun = false;
|
|
16361
17268
|
constructor(dorkHome) {
|
|
16362
17269
|
const configDir = dorkHome;
|
|
16363
|
-
const configPath =
|
|
16364
|
-
this._isFirstRun = !
|
|
17270
|
+
const configPath = path2.join(configDir, "config.json");
|
|
17271
|
+
this._isFirstRun = !fs2.existsSync(configPath);
|
|
16365
17272
|
try {
|
|
16366
17273
|
this.store = new Conf({
|
|
16367
17274
|
configName: "config",
|
|
@@ -16378,11 +17285,12 @@ var init_config_manager = __esm({
|
|
|
16378
17285
|
}
|
|
16379
17286
|
}
|
|
16380
17287
|
});
|
|
17288
|
+
logger.info(`[Config] Loaded from ${configPath} (first run: ${this._isFirstRun})`);
|
|
16381
17289
|
} catch (_error) {
|
|
16382
|
-
if (
|
|
17290
|
+
if (fs2.existsSync(configPath)) {
|
|
16383
17291
|
const backupPath = configPath + ".bak";
|
|
16384
|
-
|
|
16385
|
-
|
|
17292
|
+
fs2.copyFileSync(configPath, backupPath);
|
|
17293
|
+
fs2.unlinkSync(configPath);
|
|
16386
17294
|
logger.warn(`Corrupt config backed up to ${backupPath}`);
|
|
16387
17295
|
logger.warn("Creating fresh config with defaults.");
|
|
16388
17296
|
}
|
|
@@ -16625,19 +17533,19 @@ var init_wizard_exports = {};
|
|
|
16625
17533
|
__export(init_wizard_exports, {
|
|
16626
17534
|
runInitWizard: () => runInitWizard
|
|
16627
17535
|
});
|
|
16628
|
-
import { input, select, confirm } from "@inquirer/prompts";
|
|
16629
|
-
import
|
|
16630
|
-
import
|
|
17536
|
+
import { input, select, confirm as confirm2 } from "@inquirer/prompts";
|
|
17537
|
+
import fs3 from "fs";
|
|
17538
|
+
import path3 from "path";
|
|
16631
17539
|
async function runInitWizard(options) {
|
|
16632
17540
|
const { yes, dorkHome, store } = options;
|
|
16633
|
-
const configPath =
|
|
17541
|
+
const configPath = path3.join(dorkHome, "config.json");
|
|
16634
17542
|
if (yes) {
|
|
16635
17543
|
store.reset();
|
|
16636
17544
|
console.log(`Config initialized with defaults at ${configPath}`);
|
|
16637
17545
|
return;
|
|
16638
17546
|
}
|
|
16639
|
-
if (
|
|
16640
|
-
const overwrite = await
|
|
17547
|
+
if (fs3.existsSync(configPath)) {
|
|
17548
|
+
const overwrite = await confirm2({
|
|
16641
17549
|
message: "Config already exists. Overwrite with new settings?",
|
|
16642
17550
|
default: false
|
|
16643
17551
|
});
|
|
@@ -16667,7 +17575,7 @@ async function runInitWizard(options) {
|
|
|
16667
17575
|
],
|
|
16668
17576
|
default: "system"
|
|
16669
17577
|
});
|
|
16670
|
-
const tunnelEnabled = await
|
|
17578
|
+
const tunnelEnabled = await confirm2({
|
|
16671
17579
|
message: "Enable tunnel by default?",
|
|
16672
17580
|
default: false
|
|
16673
17581
|
});
|
|
@@ -16680,7 +17588,7 @@ async function runInitWizard(options) {
|
|
|
16680
17588
|
store.setDot("ui.theme", theme);
|
|
16681
17589
|
store.setDot("tunnel.enabled", tunnelEnabled);
|
|
16682
17590
|
if (cwd && cwd.trim() !== "") {
|
|
16683
|
-
store.setDot("server.cwd",
|
|
17591
|
+
store.setDot("server.cwd", path3.resolve(cwd));
|
|
16684
17592
|
}
|
|
16685
17593
|
console.log(`
|
|
16686
17594
|
Config saved to ${configPath}`);
|
|
@@ -17841,9 +18749,9 @@ var require_main = __commonJS({
|
|
|
17841
18749
|
// src/cli.ts
|
|
17842
18750
|
import { parseArgs } from "node:util";
|
|
17843
18751
|
import os, { networkInterfaces } from "os";
|
|
17844
|
-
import
|
|
18752
|
+
import path4 from "path";
|
|
17845
18753
|
import { fileURLToPath } from "url";
|
|
17846
|
-
import
|
|
18754
|
+
import fs4 from "fs";
|
|
17847
18755
|
|
|
17848
18756
|
// src/check-claude.ts
|
|
17849
18757
|
import { execSync } from "child_process";
|
|
@@ -17925,7 +18833,7 @@ var cliEnvSchema = external_exports.object({
|
|
|
17925
18833
|
var env = cliEnvSchema.parse(process.env);
|
|
17926
18834
|
|
|
17927
18835
|
// src/cli.ts
|
|
17928
|
-
var __dirname =
|
|
18836
|
+
var __dirname = path4.dirname(fileURLToPath(import.meta.url));
|
|
17929
18837
|
var { values, positionals } = parseArgs({
|
|
17930
18838
|
options: {
|
|
17931
18839
|
port: { type: "string", short: "p" },
|
|
@@ -17958,6 +18866,7 @@ Commands:
|
|
|
17958
18866
|
config validate Check config validity
|
|
17959
18867
|
init Interactive setup wizard
|
|
17960
18868
|
init --yes Accept all defaults
|
|
18869
|
+
cleanup Remove all DorkOS data
|
|
17961
18870
|
|
|
17962
18871
|
Options:
|
|
17963
18872
|
-p, --port <port> Port to listen on (default: ${DEFAULT_PORT})
|
|
@@ -17988,20 +18897,25 @@ Examples:
|
|
|
17988
18897
|
process.exit(0);
|
|
17989
18898
|
}
|
|
17990
18899
|
if (values.version) {
|
|
17991
|
-
console.log("0.
|
|
18900
|
+
console.log("0.13.0");
|
|
17992
18901
|
process.exit(0);
|
|
17993
18902
|
}
|
|
17994
18903
|
if (values["post-install-check"]) {
|
|
17995
18904
|
checkClaude();
|
|
17996
|
-
console.log(`dorkos ${"0.
|
|
18905
|
+
console.log(`dorkos ${"0.13.0"}`);
|
|
17997
18906
|
console.log("Installation verified.");
|
|
17998
18907
|
process.exit(0);
|
|
17999
18908
|
}
|
|
18000
|
-
var DORK_HOME = env.DORK_HOME ||
|
|
18001
|
-
fs3.mkdirSync(DORK_HOME, { recursive: true });
|
|
18002
|
-
fs3.mkdirSync(path3.join(DORK_HOME, "logs"), { recursive: true });
|
|
18003
|
-
process.env.DORK_HOME = DORK_HOME;
|
|
18909
|
+
var DORK_HOME = env.DORK_HOME || path4.join(os.homedir(), ".dork");
|
|
18004
18910
|
var subcommand = positionals[0];
|
|
18911
|
+
if (subcommand === "cleanup") {
|
|
18912
|
+
const { runCleanup: runCleanup2 } = await Promise.resolve().then(() => (init_cleanup_command(), cleanup_command_exports));
|
|
18913
|
+
await runCleanup2({ dorkHome: DORK_HOME });
|
|
18914
|
+
process.exit(process.exitCode ?? 0);
|
|
18915
|
+
}
|
|
18916
|
+
fs4.mkdirSync(DORK_HOME, { recursive: true });
|
|
18917
|
+
fs4.mkdirSync(path4.join(DORK_HOME, "logs"), { recursive: true });
|
|
18918
|
+
process.env.DORK_HOME = DORK_HOME;
|
|
18005
18919
|
if (subcommand === "config") {
|
|
18006
18920
|
const { initConfigManager: initConfigManager3 } = await Promise.resolve().then(() => (init_config_manager(), config_manager_exports));
|
|
18007
18921
|
const cfgMgr2 = initConfigManager3(DORK_HOME);
|
|
@@ -18030,7 +18944,7 @@ if (cliPort) {
|
|
|
18030
18944
|
process.env.DORKOS_PORT = configPort ? String(configPort) : String(DEFAULT_PORT);
|
|
18031
18945
|
}
|
|
18032
18946
|
process.env.NODE_ENV = "production";
|
|
18033
|
-
process.env.CLIENT_DIST_PATH =
|
|
18947
|
+
process.env.CLIENT_DIST_PATH = path4.join(__dirname, "../client");
|
|
18034
18948
|
if (values.tunnel) {
|
|
18035
18949
|
process.env.TUNNEL_ENABLED = "true";
|
|
18036
18950
|
} else if (!process.env.TUNNEL_ENABLED && cfgMgr.getDot("tunnel.enabled")) {
|
|
@@ -18055,30 +18969,30 @@ if (values.pulse !== void 0) {
|
|
|
18055
18969
|
}
|
|
18056
18970
|
var cliDir = values.dir;
|
|
18057
18971
|
if (cliDir) {
|
|
18058
|
-
process.env.DORKOS_DEFAULT_CWD =
|
|
18972
|
+
process.env.DORKOS_DEFAULT_CWD = path4.resolve(cliDir);
|
|
18059
18973
|
} else if (!process.env.DORKOS_DEFAULT_CWD) {
|
|
18060
18974
|
const configCwd = cfgMgr.getDot("server.cwd");
|
|
18061
|
-
process.env.DORKOS_DEFAULT_CWD = configCwd ?
|
|
18975
|
+
process.env.DORKOS_DEFAULT_CWD = configCwd ? path4.resolve(configCwd) : process.cwd();
|
|
18062
18976
|
}
|
|
18063
18977
|
var cliBoundary = values.boundary;
|
|
18064
18978
|
if (cliBoundary) {
|
|
18065
|
-
process.env.DORKOS_BOUNDARY =
|
|
18979
|
+
process.env.DORKOS_BOUNDARY = path4.resolve(cliBoundary);
|
|
18066
18980
|
} else if (!process.env.DORKOS_BOUNDARY) {
|
|
18067
18981
|
const configBoundary = cfgMgr.getDot("server.boundary");
|
|
18068
18982
|
if (configBoundary) {
|
|
18069
|
-
process.env.DORKOS_BOUNDARY =
|
|
18983
|
+
process.env.DORKOS_BOUNDARY = path4.resolve(configBoundary);
|
|
18070
18984
|
}
|
|
18071
18985
|
}
|
|
18072
18986
|
var boundaryVal = process.env.DORKOS_BOUNDARY;
|
|
18073
18987
|
var home = os.homedir();
|
|
18074
|
-
if (boundaryVal && !boundaryVal.startsWith(home +
|
|
18988
|
+
if (boundaryVal && !boundaryVal.startsWith(home + path4.sep) && boundaryVal !== home) {
|
|
18075
18989
|
console.warn(
|
|
18076
18990
|
`[Warning] Directory boundary "${boundaryVal}" is above home directory "${home}". This grants access to system directories.`
|
|
18077
18991
|
);
|
|
18078
18992
|
}
|
|
18079
18993
|
var effectiveBoundary = process.env.DORKOS_BOUNDARY || home;
|
|
18080
18994
|
var resolvedDir = process.env.DORKOS_DEFAULT_CWD;
|
|
18081
|
-
if (resolvedDir !== effectiveBoundary && !resolvedDir.startsWith(effectiveBoundary +
|
|
18995
|
+
if (resolvedDir !== effectiveBoundary && !resolvedDir.startsWith(effectiveBoundary + path4.sep)) {
|
|
18082
18996
|
console.warn(
|
|
18083
18997
|
`[Warning] Default CWD "${resolvedDir}" is outside boundary "${effectiveBoundary}". Falling back to boundary root.`
|
|
18084
18998
|
);
|
|
@@ -18086,15 +19000,15 @@ if (resolvedDir !== effectiveBoundary && !resolvedDir.startsWith(effectiveBounda
|
|
|
18086
19000
|
}
|
|
18087
19001
|
var logLevelName = values["log-level"] || env.LOG_LEVEL || cfgMgr.getDot("logging.level") || (env.NODE_ENV === "production" ? "info" : "debug");
|
|
18088
19002
|
process.env.DORKOS_LOG_LEVEL = String(LOG_LEVEL_MAP[logLevelName] ?? 3);
|
|
18089
|
-
var envPath =
|
|
18090
|
-
if (
|
|
19003
|
+
var envPath = path4.join(process.env.DORKOS_DEFAULT_CWD, ".env");
|
|
19004
|
+
if (fs4.existsSync(envPath)) {
|
|
18091
19005
|
const dotenv = await import("dotenv");
|
|
18092
19006
|
dotenv.config({ path: envPath, override: false });
|
|
18093
19007
|
}
|
|
18094
19008
|
await import("../server/index.js");
|
|
18095
19009
|
var port = process.env.DORKOS_PORT || String(DEFAULT_PORT);
|
|
18096
19010
|
console.log("");
|
|
18097
|
-
console.log(` DorkOS v${"0.
|
|
19011
|
+
console.log(` DorkOS v${"0.13.0"}`);
|
|
18098
19012
|
console.log(` Local: http://localhost:${port}`);
|
|
18099
19013
|
var nets = networkInterfaces();
|
|
18100
19014
|
var networkUrl = null;
|
|
@@ -18150,9 +19064,9 @@ console.log("");
|
|
|
18150
19064
|
}
|
|
18151
19065
|
});
|
|
18152
19066
|
}
|
|
18153
|
-
checkForUpdate("0.
|
|
19067
|
+
checkForUpdate("0.13.0").then((latestVersion) => {
|
|
18154
19068
|
if (latestVersion) {
|
|
18155
|
-
const msg = `Update available: ${"0.
|
|
19069
|
+
const msg = `Update available: ${"0.13.0"} \u2192 ${latestVersion}`;
|
|
18156
19070
|
const cmd = "Run npm install -g dorkos@latest to update";
|
|
18157
19071
|
const width = Math.max(msg.length, cmd.length) + 6;
|
|
18158
19072
|
const pad = (s2) => `\u2502 ${s2}${" ".repeat(width - s2.length - 6)} \u2502`;
|