@kelceyp/caw-server 0.0.11 → 0.0.12
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/main.js +3 -768
- package/dist/main.js.map +3 -18
- package/package.json +2 -2
package/dist/main.js
CHANGED
|
@@ -35962,771 +35962,6 @@ var require_websocket_server = __commonJS((exports, module) => {
|
|
|
35962
35962
|
}
|
|
35963
35963
|
});
|
|
35964
35964
|
|
|
35965
|
-
// node_modules/better-sqlite3/lib/util.js
|
|
35966
|
-
var require_util2 = __commonJS((exports) => {
|
|
35967
|
-
exports.getBooleanOption = (options, key) => {
|
|
35968
|
-
let value = false;
|
|
35969
|
-
if (key in options && typeof (value = options[key]) !== "boolean") {
|
|
35970
|
-
throw new TypeError(`Expected the "${key}" option to be a boolean`);
|
|
35971
|
-
}
|
|
35972
|
-
return value;
|
|
35973
|
-
};
|
|
35974
|
-
exports.cppdb = Symbol();
|
|
35975
|
-
exports.inspect = Symbol.for("nodejs.util.inspect.custom");
|
|
35976
|
-
});
|
|
35977
|
-
|
|
35978
|
-
// node_modules/better-sqlite3/lib/sqlite-error.js
|
|
35979
|
-
var require_sqlite_error = __commonJS((exports, module) => {
|
|
35980
|
-
var descriptor = { value: "SqliteError", writable: true, enumerable: false, configurable: true };
|
|
35981
|
-
function SqliteError(message, code) {
|
|
35982
|
-
if (new.target !== SqliteError) {
|
|
35983
|
-
return new SqliteError(message, code);
|
|
35984
|
-
}
|
|
35985
|
-
if (typeof code !== "string") {
|
|
35986
|
-
throw new TypeError("Expected second argument to be a string");
|
|
35987
|
-
}
|
|
35988
|
-
Error.call(this, message);
|
|
35989
|
-
descriptor.value = "" + message;
|
|
35990
|
-
Object.defineProperty(this, "message", descriptor);
|
|
35991
|
-
Error.captureStackTrace(this, SqliteError);
|
|
35992
|
-
this.code = code;
|
|
35993
|
-
}
|
|
35994
|
-
Object.setPrototypeOf(SqliteError, Error);
|
|
35995
|
-
Object.setPrototypeOf(SqliteError.prototype, Error.prototype);
|
|
35996
|
-
Object.defineProperty(SqliteError.prototype, "name", descriptor);
|
|
35997
|
-
module.exports = SqliteError;
|
|
35998
|
-
});
|
|
35999
|
-
|
|
36000
|
-
// node_modules/file-uri-to-path/index.js
|
|
36001
|
-
var require_file_uri_to_path = __commonJS((exports, module) => {
|
|
36002
|
-
var sep = __require("path").sep || "/";
|
|
36003
|
-
module.exports = fileUriToPath;
|
|
36004
|
-
function fileUriToPath(uri) {
|
|
36005
|
-
if (typeof uri != "string" || uri.length <= 7 || uri.substring(0, 7) != "file://") {
|
|
36006
|
-
throw new TypeError("must pass in a file:// URI to convert to a file path");
|
|
36007
|
-
}
|
|
36008
|
-
var rest = decodeURI(uri.substring(7));
|
|
36009
|
-
var firstSlash = rest.indexOf("/");
|
|
36010
|
-
var host = rest.substring(0, firstSlash);
|
|
36011
|
-
var path2 = rest.substring(firstSlash + 1);
|
|
36012
|
-
if (host == "localhost")
|
|
36013
|
-
host = "";
|
|
36014
|
-
if (host) {
|
|
36015
|
-
host = sep + sep + host;
|
|
36016
|
-
}
|
|
36017
|
-
path2 = path2.replace(/^(.+)\|/, "$1:");
|
|
36018
|
-
if (sep == "\\") {
|
|
36019
|
-
path2 = path2.replace(/\//g, "\\");
|
|
36020
|
-
}
|
|
36021
|
-
if (/^.+\:/.test(path2)) {} else {
|
|
36022
|
-
path2 = sep + path2;
|
|
36023
|
-
}
|
|
36024
|
-
return host + path2;
|
|
36025
|
-
}
|
|
36026
|
-
});
|
|
36027
|
-
|
|
36028
|
-
// node_modules/bindings/bindings.js
|
|
36029
|
-
var require_bindings = __commonJS((exports, module) => {
|
|
36030
|
-
var __filename = "/Users/paulkelcey/Dev/gh/kelceyp-mcp-servers/caw/server/node_modules/bindings/bindings.js";
|
|
36031
|
-
var fs2 = __require("fs");
|
|
36032
|
-
var path2 = __require("path");
|
|
36033
|
-
var fileURLToPath = require_file_uri_to_path();
|
|
36034
|
-
var join = path2.join;
|
|
36035
|
-
var dirname = path2.dirname;
|
|
36036
|
-
var exists = fs2.accessSync && function(path3) {
|
|
36037
|
-
try {
|
|
36038
|
-
fs2.accessSync(path3);
|
|
36039
|
-
} catch (e) {
|
|
36040
|
-
return false;
|
|
36041
|
-
}
|
|
36042
|
-
return true;
|
|
36043
|
-
} || fs2.existsSync || path2.existsSync;
|
|
36044
|
-
var defaults = {
|
|
36045
|
-
arrow: process.env.NODE_BINDINGS_ARROW || " → ",
|
|
36046
|
-
compiled: process.env.NODE_BINDINGS_COMPILED_DIR || "compiled",
|
|
36047
|
-
platform: process.platform,
|
|
36048
|
-
arch: process.arch,
|
|
36049
|
-
nodePreGyp: "node-v" + process.versions.modules + "-" + process.platform + "-" + process.arch,
|
|
36050
|
-
version: process.versions.node,
|
|
36051
|
-
bindings: "bindings.node",
|
|
36052
|
-
try: [
|
|
36053
|
-
["module_root", "build", "bindings"],
|
|
36054
|
-
["module_root", "build", "Debug", "bindings"],
|
|
36055
|
-
["module_root", "build", "Release", "bindings"],
|
|
36056
|
-
["module_root", "out", "Debug", "bindings"],
|
|
36057
|
-
["module_root", "Debug", "bindings"],
|
|
36058
|
-
["module_root", "out", "Release", "bindings"],
|
|
36059
|
-
["module_root", "Release", "bindings"],
|
|
36060
|
-
["module_root", "build", "default", "bindings"],
|
|
36061
|
-
["module_root", "compiled", "version", "platform", "arch", "bindings"],
|
|
36062
|
-
["module_root", "addon-build", "release", "install-root", "bindings"],
|
|
36063
|
-
["module_root", "addon-build", "debug", "install-root", "bindings"],
|
|
36064
|
-
["module_root", "addon-build", "default", "install-root", "bindings"],
|
|
36065
|
-
["module_root", "lib", "binding", "nodePreGyp", "bindings"]
|
|
36066
|
-
]
|
|
36067
|
-
};
|
|
36068
|
-
function bindings(opts) {
|
|
36069
|
-
if (typeof opts == "string") {
|
|
36070
|
-
opts = { bindings: opts };
|
|
36071
|
-
} else if (!opts) {
|
|
36072
|
-
opts = {};
|
|
36073
|
-
}
|
|
36074
|
-
Object.keys(defaults).map(function(i2) {
|
|
36075
|
-
if (!(i2 in opts))
|
|
36076
|
-
opts[i2] = defaults[i2];
|
|
36077
|
-
});
|
|
36078
|
-
if (!opts.module_root) {
|
|
36079
|
-
opts.module_root = exports.getRoot(exports.getFileName());
|
|
36080
|
-
}
|
|
36081
|
-
if (path2.extname(opts.bindings) != ".node") {
|
|
36082
|
-
opts.bindings += ".node";
|
|
36083
|
-
}
|
|
36084
|
-
var requireFunc = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
|
|
36085
|
-
var tries = [], i = 0, l = opts.try.length, n, b, err;
|
|
36086
|
-
for (;i < l; i++) {
|
|
36087
|
-
n = join.apply(null, opts.try[i].map(function(p) {
|
|
36088
|
-
return opts[p] || p;
|
|
36089
|
-
}));
|
|
36090
|
-
tries.push(n);
|
|
36091
|
-
try {
|
|
36092
|
-
b = opts.path ? requireFunc.resolve(n) : requireFunc(n);
|
|
36093
|
-
if (!opts.path) {
|
|
36094
|
-
b.path = n;
|
|
36095
|
-
}
|
|
36096
|
-
return b;
|
|
36097
|
-
} catch (e) {
|
|
36098
|
-
if (e.code !== "MODULE_NOT_FOUND" && e.code !== "QUALIFIED_PATH_RESOLUTION_FAILED" && !/not find/i.test(e.message)) {
|
|
36099
|
-
throw e;
|
|
36100
|
-
}
|
|
36101
|
-
}
|
|
36102
|
-
}
|
|
36103
|
-
err = new Error(`Could not locate the bindings file. Tried:
|
|
36104
|
-
` + tries.map(function(a) {
|
|
36105
|
-
return opts.arrow + a;
|
|
36106
|
-
}).join(`
|
|
36107
|
-
`));
|
|
36108
|
-
err.tries = tries;
|
|
36109
|
-
throw err;
|
|
36110
|
-
}
|
|
36111
|
-
module.exports = exports = bindings;
|
|
36112
|
-
exports.getFileName = function getFileName(calling_file) {
|
|
36113
|
-
var { prepareStackTrace: origPST, stackTraceLimit: origSTL } = Error, dummy = {}, fileName;
|
|
36114
|
-
Error.stackTraceLimit = 10;
|
|
36115
|
-
Error.prepareStackTrace = function(e, st) {
|
|
36116
|
-
for (var i = 0, l = st.length;i < l; i++) {
|
|
36117
|
-
fileName = st[i].getFileName();
|
|
36118
|
-
if (fileName !== __filename) {
|
|
36119
|
-
if (calling_file) {
|
|
36120
|
-
if (fileName !== calling_file) {
|
|
36121
|
-
return;
|
|
36122
|
-
}
|
|
36123
|
-
} else {
|
|
36124
|
-
return;
|
|
36125
|
-
}
|
|
36126
|
-
}
|
|
36127
|
-
}
|
|
36128
|
-
};
|
|
36129
|
-
Error.captureStackTrace(dummy);
|
|
36130
|
-
dummy.stack;
|
|
36131
|
-
Error.prepareStackTrace = origPST;
|
|
36132
|
-
Error.stackTraceLimit = origSTL;
|
|
36133
|
-
var fileSchema = "file://";
|
|
36134
|
-
if (fileName.indexOf(fileSchema) === 0) {
|
|
36135
|
-
fileName = fileURLToPath(fileName);
|
|
36136
|
-
}
|
|
36137
|
-
return fileName;
|
|
36138
|
-
};
|
|
36139
|
-
exports.getRoot = function getRoot(file) {
|
|
36140
|
-
var dir = dirname(file), prev;
|
|
36141
|
-
while (true) {
|
|
36142
|
-
if (dir === ".") {
|
|
36143
|
-
dir = process.cwd();
|
|
36144
|
-
}
|
|
36145
|
-
if (exists(join(dir, "package.json")) || exists(join(dir, "node_modules"))) {
|
|
36146
|
-
return dir;
|
|
36147
|
-
}
|
|
36148
|
-
if (prev === dir) {
|
|
36149
|
-
throw new Error('Could not find module root given file: "' + file + '". Do you have a `package.json` file? ');
|
|
36150
|
-
}
|
|
36151
|
-
prev = dir;
|
|
36152
|
-
dir = join(dir, "..");
|
|
36153
|
-
}
|
|
36154
|
-
};
|
|
36155
|
-
});
|
|
36156
|
-
|
|
36157
|
-
// node_modules/better-sqlite3/lib/methods/wrappers.js
|
|
36158
|
-
var require_wrappers = __commonJS((exports) => {
|
|
36159
|
-
var { cppdb } = require_util2();
|
|
36160
|
-
exports.prepare = function prepare(sql) {
|
|
36161
|
-
return this[cppdb].prepare(sql, this, false);
|
|
36162
|
-
};
|
|
36163
|
-
exports.exec = function exec(sql) {
|
|
36164
|
-
this[cppdb].exec(sql);
|
|
36165
|
-
return this;
|
|
36166
|
-
};
|
|
36167
|
-
exports.close = function close() {
|
|
36168
|
-
this[cppdb].close();
|
|
36169
|
-
return this;
|
|
36170
|
-
};
|
|
36171
|
-
exports.loadExtension = function loadExtension(...args) {
|
|
36172
|
-
this[cppdb].loadExtension(...args);
|
|
36173
|
-
return this;
|
|
36174
|
-
};
|
|
36175
|
-
exports.defaultSafeIntegers = function defaultSafeIntegers(...args) {
|
|
36176
|
-
this[cppdb].defaultSafeIntegers(...args);
|
|
36177
|
-
return this;
|
|
36178
|
-
};
|
|
36179
|
-
exports.unsafeMode = function unsafeMode(...args) {
|
|
36180
|
-
this[cppdb].unsafeMode(...args);
|
|
36181
|
-
return this;
|
|
36182
|
-
};
|
|
36183
|
-
exports.getters = {
|
|
36184
|
-
name: {
|
|
36185
|
-
get: function name() {
|
|
36186
|
-
return this[cppdb].name;
|
|
36187
|
-
},
|
|
36188
|
-
enumerable: true
|
|
36189
|
-
},
|
|
36190
|
-
open: {
|
|
36191
|
-
get: function open() {
|
|
36192
|
-
return this[cppdb].open;
|
|
36193
|
-
},
|
|
36194
|
-
enumerable: true
|
|
36195
|
-
},
|
|
36196
|
-
inTransaction: {
|
|
36197
|
-
get: function inTransaction() {
|
|
36198
|
-
return this[cppdb].inTransaction;
|
|
36199
|
-
},
|
|
36200
|
-
enumerable: true
|
|
36201
|
-
},
|
|
36202
|
-
readonly: {
|
|
36203
|
-
get: function readonly() {
|
|
36204
|
-
return this[cppdb].readonly;
|
|
36205
|
-
},
|
|
36206
|
-
enumerable: true
|
|
36207
|
-
},
|
|
36208
|
-
memory: {
|
|
36209
|
-
get: function memory() {
|
|
36210
|
-
return this[cppdb].memory;
|
|
36211
|
-
},
|
|
36212
|
-
enumerable: true
|
|
36213
|
-
}
|
|
36214
|
-
};
|
|
36215
|
-
});
|
|
36216
|
-
|
|
36217
|
-
// node_modules/better-sqlite3/lib/methods/transaction.js
|
|
36218
|
-
var require_transaction = __commonJS((exports, module) => {
|
|
36219
|
-
var { cppdb } = require_util2();
|
|
36220
|
-
var controllers = new WeakMap;
|
|
36221
|
-
module.exports = function transaction(fn) {
|
|
36222
|
-
if (typeof fn !== "function")
|
|
36223
|
-
throw new TypeError("Expected first argument to be a function");
|
|
36224
|
-
const db = this[cppdb];
|
|
36225
|
-
const controller = getController(db, this);
|
|
36226
|
-
const { apply } = Function.prototype;
|
|
36227
|
-
const properties = {
|
|
36228
|
-
default: { value: wrapTransaction(apply, fn, db, controller.default) },
|
|
36229
|
-
deferred: { value: wrapTransaction(apply, fn, db, controller.deferred) },
|
|
36230
|
-
immediate: { value: wrapTransaction(apply, fn, db, controller.immediate) },
|
|
36231
|
-
exclusive: { value: wrapTransaction(apply, fn, db, controller.exclusive) },
|
|
36232
|
-
database: { value: this, enumerable: true }
|
|
36233
|
-
};
|
|
36234
|
-
Object.defineProperties(properties.default.value, properties);
|
|
36235
|
-
Object.defineProperties(properties.deferred.value, properties);
|
|
36236
|
-
Object.defineProperties(properties.immediate.value, properties);
|
|
36237
|
-
Object.defineProperties(properties.exclusive.value, properties);
|
|
36238
|
-
return properties.default.value;
|
|
36239
|
-
};
|
|
36240
|
-
var getController = (db, self) => {
|
|
36241
|
-
let controller = controllers.get(db);
|
|
36242
|
-
if (!controller) {
|
|
36243
|
-
const shared = {
|
|
36244
|
-
commit: db.prepare("COMMIT", self, false),
|
|
36245
|
-
rollback: db.prepare("ROLLBACK", self, false),
|
|
36246
|
-
savepoint: db.prepare("SAVEPOINT ` _bs3. `", self, false),
|
|
36247
|
-
release: db.prepare("RELEASE ` _bs3. `", self, false),
|
|
36248
|
-
rollbackTo: db.prepare("ROLLBACK TO ` _bs3. `", self, false)
|
|
36249
|
-
};
|
|
36250
|
-
controllers.set(db, controller = {
|
|
36251
|
-
default: Object.assign({ begin: db.prepare("BEGIN", self, false) }, shared),
|
|
36252
|
-
deferred: Object.assign({ begin: db.prepare("BEGIN DEFERRED", self, false) }, shared),
|
|
36253
|
-
immediate: Object.assign({ begin: db.prepare("BEGIN IMMEDIATE", self, false) }, shared),
|
|
36254
|
-
exclusive: Object.assign({ begin: db.prepare("BEGIN EXCLUSIVE", self, false) }, shared)
|
|
36255
|
-
});
|
|
36256
|
-
}
|
|
36257
|
-
return controller;
|
|
36258
|
-
};
|
|
36259
|
-
var wrapTransaction = (apply, fn, db, { begin, commit, rollback, savepoint, release, rollbackTo }) => function sqliteTransaction() {
|
|
36260
|
-
let before, after, undo;
|
|
36261
|
-
if (db.inTransaction) {
|
|
36262
|
-
before = savepoint;
|
|
36263
|
-
after = release;
|
|
36264
|
-
undo = rollbackTo;
|
|
36265
|
-
} else {
|
|
36266
|
-
before = begin;
|
|
36267
|
-
after = commit;
|
|
36268
|
-
undo = rollback;
|
|
36269
|
-
}
|
|
36270
|
-
before.run();
|
|
36271
|
-
try {
|
|
36272
|
-
const result = apply.call(fn, this, arguments);
|
|
36273
|
-
if (result && typeof result.then === "function") {
|
|
36274
|
-
throw new TypeError("Transaction function cannot return a promise");
|
|
36275
|
-
}
|
|
36276
|
-
after.run();
|
|
36277
|
-
return result;
|
|
36278
|
-
} catch (ex) {
|
|
36279
|
-
if (db.inTransaction) {
|
|
36280
|
-
undo.run();
|
|
36281
|
-
if (undo !== rollback)
|
|
36282
|
-
after.run();
|
|
36283
|
-
}
|
|
36284
|
-
throw ex;
|
|
36285
|
-
}
|
|
36286
|
-
};
|
|
36287
|
-
});
|
|
36288
|
-
|
|
36289
|
-
// node_modules/better-sqlite3/lib/methods/pragma.js
|
|
36290
|
-
var require_pragma = __commonJS((exports, module) => {
|
|
36291
|
-
var { getBooleanOption, cppdb } = require_util2();
|
|
36292
|
-
module.exports = function pragma(source, options) {
|
|
36293
|
-
if (options == null)
|
|
36294
|
-
options = {};
|
|
36295
|
-
if (typeof source !== "string")
|
|
36296
|
-
throw new TypeError("Expected first argument to be a string");
|
|
36297
|
-
if (typeof options !== "object")
|
|
36298
|
-
throw new TypeError("Expected second argument to be an options object");
|
|
36299
|
-
const simple = getBooleanOption(options, "simple");
|
|
36300
|
-
const stmt = this[cppdb].prepare(`PRAGMA ${source}`, this, true);
|
|
36301
|
-
return simple ? stmt.pluck().get() : stmt.all();
|
|
36302
|
-
};
|
|
36303
|
-
});
|
|
36304
|
-
|
|
36305
|
-
// node_modules/better-sqlite3/lib/methods/backup.js
|
|
36306
|
-
var require_backup = __commonJS((exports, module) => {
|
|
36307
|
-
var fs2 = __require("fs");
|
|
36308
|
-
var path2 = __require("path");
|
|
36309
|
-
var { promisify } = __require("util");
|
|
36310
|
-
var { cppdb } = require_util2();
|
|
36311
|
-
var fsAccess = promisify(fs2.access);
|
|
36312
|
-
module.exports = async function backup(filename, options) {
|
|
36313
|
-
if (options == null)
|
|
36314
|
-
options = {};
|
|
36315
|
-
if (typeof filename !== "string")
|
|
36316
|
-
throw new TypeError("Expected first argument to be a string");
|
|
36317
|
-
if (typeof options !== "object")
|
|
36318
|
-
throw new TypeError("Expected second argument to be an options object");
|
|
36319
|
-
filename = filename.trim();
|
|
36320
|
-
const attachedName = "attached" in options ? options.attached : "main";
|
|
36321
|
-
const handler = "progress" in options ? options.progress : null;
|
|
36322
|
-
if (!filename)
|
|
36323
|
-
throw new TypeError("Backup filename cannot be an empty string");
|
|
36324
|
-
if (filename === ":memory:")
|
|
36325
|
-
throw new TypeError('Invalid backup filename ":memory:"');
|
|
36326
|
-
if (typeof attachedName !== "string")
|
|
36327
|
-
throw new TypeError('Expected the "attached" option to be a string');
|
|
36328
|
-
if (!attachedName)
|
|
36329
|
-
throw new TypeError('The "attached" option cannot be an empty string');
|
|
36330
|
-
if (handler != null && typeof handler !== "function")
|
|
36331
|
-
throw new TypeError('Expected the "progress" option to be a function');
|
|
36332
|
-
await fsAccess(path2.dirname(filename)).catch(() => {
|
|
36333
|
-
throw new TypeError("Cannot save backup because the directory does not exist");
|
|
36334
|
-
});
|
|
36335
|
-
const isNewFile = await fsAccess(filename).then(() => false, () => true);
|
|
36336
|
-
return runBackup(this[cppdb].backup(this, attachedName, filename, isNewFile), handler || null);
|
|
36337
|
-
};
|
|
36338
|
-
var runBackup = (backup, handler) => {
|
|
36339
|
-
let rate = 0;
|
|
36340
|
-
let useDefault = true;
|
|
36341
|
-
return new Promise((resolve, reject) => {
|
|
36342
|
-
setImmediate(function step() {
|
|
36343
|
-
try {
|
|
36344
|
-
const progress = backup.transfer(rate);
|
|
36345
|
-
if (!progress.remainingPages) {
|
|
36346
|
-
backup.close();
|
|
36347
|
-
resolve(progress);
|
|
36348
|
-
return;
|
|
36349
|
-
}
|
|
36350
|
-
if (useDefault) {
|
|
36351
|
-
useDefault = false;
|
|
36352
|
-
rate = 100;
|
|
36353
|
-
}
|
|
36354
|
-
if (handler) {
|
|
36355
|
-
const ret = handler(progress);
|
|
36356
|
-
if (ret !== undefined) {
|
|
36357
|
-
if (typeof ret === "number" && ret === ret)
|
|
36358
|
-
rate = Math.max(0, Math.min(2147483647, Math.round(ret)));
|
|
36359
|
-
else
|
|
36360
|
-
throw new TypeError("Expected progress callback to return a number or undefined");
|
|
36361
|
-
}
|
|
36362
|
-
}
|
|
36363
|
-
setImmediate(step);
|
|
36364
|
-
} catch (err) {
|
|
36365
|
-
backup.close();
|
|
36366
|
-
reject(err);
|
|
36367
|
-
}
|
|
36368
|
-
});
|
|
36369
|
-
});
|
|
36370
|
-
};
|
|
36371
|
-
});
|
|
36372
|
-
|
|
36373
|
-
// node_modules/better-sqlite3/lib/methods/serialize.js
|
|
36374
|
-
var require_serialize = __commonJS((exports, module) => {
|
|
36375
|
-
var { cppdb } = require_util2();
|
|
36376
|
-
module.exports = function serialize(options) {
|
|
36377
|
-
if (options == null)
|
|
36378
|
-
options = {};
|
|
36379
|
-
if (typeof options !== "object")
|
|
36380
|
-
throw new TypeError("Expected first argument to be an options object");
|
|
36381
|
-
const attachedName = "attached" in options ? options.attached : "main";
|
|
36382
|
-
if (typeof attachedName !== "string")
|
|
36383
|
-
throw new TypeError('Expected the "attached" option to be a string');
|
|
36384
|
-
if (!attachedName)
|
|
36385
|
-
throw new TypeError('The "attached" option cannot be an empty string');
|
|
36386
|
-
return this[cppdb].serialize(attachedName);
|
|
36387
|
-
};
|
|
36388
|
-
});
|
|
36389
|
-
|
|
36390
|
-
// node_modules/better-sqlite3/lib/methods/function.js
|
|
36391
|
-
var require_function = __commonJS((exports, module) => {
|
|
36392
|
-
var { getBooleanOption, cppdb } = require_util2();
|
|
36393
|
-
module.exports = function defineFunction(name, options, fn) {
|
|
36394
|
-
if (options == null)
|
|
36395
|
-
options = {};
|
|
36396
|
-
if (typeof options === "function") {
|
|
36397
|
-
fn = options;
|
|
36398
|
-
options = {};
|
|
36399
|
-
}
|
|
36400
|
-
if (typeof name !== "string")
|
|
36401
|
-
throw new TypeError("Expected first argument to be a string");
|
|
36402
|
-
if (typeof fn !== "function")
|
|
36403
|
-
throw new TypeError("Expected last argument to be a function");
|
|
36404
|
-
if (typeof options !== "object")
|
|
36405
|
-
throw new TypeError("Expected second argument to be an options object");
|
|
36406
|
-
if (!name)
|
|
36407
|
-
throw new TypeError("User-defined function name cannot be an empty string");
|
|
36408
|
-
const safeIntegers = "safeIntegers" in options ? +getBooleanOption(options, "safeIntegers") : 2;
|
|
36409
|
-
const deterministic = getBooleanOption(options, "deterministic");
|
|
36410
|
-
const directOnly = getBooleanOption(options, "directOnly");
|
|
36411
|
-
const varargs = getBooleanOption(options, "varargs");
|
|
36412
|
-
let argCount = -1;
|
|
36413
|
-
if (!varargs) {
|
|
36414
|
-
argCount = fn.length;
|
|
36415
|
-
if (!Number.isInteger(argCount) || argCount < 0)
|
|
36416
|
-
throw new TypeError("Expected function.length to be a positive integer");
|
|
36417
|
-
if (argCount > 100)
|
|
36418
|
-
throw new RangeError("User-defined functions cannot have more than 100 arguments");
|
|
36419
|
-
}
|
|
36420
|
-
this[cppdb].function(fn, name, argCount, safeIntegers, deterministic, directOnly);
|
|
36421
|
-
return this;
|
|
36422
|
-
};
|
|
36423
|
-
});
|
|
36424
|
-
|
|
36425
|
-
// node_modules/better-sqlite3/lib/methods/aggregate.js
|
|
36426
|
-
var require_aggregate = __commonJS((exports, module) => {
|
|
36427
|
-
var { getBooleanOption, cppdb } = require_util2();
|
|
36428
|
-
module.exports = function defineAggregate(name, options) {
|
|
36429
|
-
if (typeof name !== "string")
|
|
36430
|
-
throw new TypeError("Expected first argument to be a string");
|
|
36431
|
-
if (typeof options !== "object" || options === null)
|
|
36432
|
-
throw new TypeError("Expected second argument to be an options object");
|
|
36433
|
-
if (!name)
|
|
36434
|
-
throw new TypeError("User-defined function name cannot be an empty string");
|
|
36435
|
-
const start = "start" in options ? options.start : null;
|
|
36436
|
-
const step = getFunctionOption(options, "step", true);
|
|
36437
|
-
const inverse = getFunctionOption(options, "inverse", false);
|
|
36438
|
-
const result = getFunctionOption(options, "result", false);
|
|
36439
|
-
const safeIntegers = "safeIntegers" in options ? +getBooleanOption(options, "safeIntegers") : 2;
|
|
36440
|
-
const deterministic = getBooleanOption(options, "deterministic");
|
|
36441
|
-
const directOnly = getBooleanOption(options, "directOnly");
|
|
36442
|
-
const varargs = getBooleanOption(options, "varargs");
|
|
36443
|
-
let argCount = -1;
|
|
36444
|
-
if (!varargs) {
|
|
36445
|
-
argCount = Math.max(getLength(step), inverse ? getLength(inverse) : 0);
|
|
36446
|
-
if (argCount > 0)
|
|
36447
|
-
argCount -= 1;
|
|
36448
|
-
if (argCount > 100)
|
|
36449
|
-
throw new RangeError("User-defined functions cannot have more than 100 arguments");
|
|
36450
|
-
}
|
|
36451
|
-
this[cppdb].aggregate(start, step, inverse, result, name, argCount, safeIntegers, deterministic, directOnly);
|
|
36452
|
-
return this;
|
|
36453
|
-
};
|
|
36454
|
-
var getFunctionOption = (options, key, required) => {
|
|
36455
|
-
const value = key in options ? options[key] : null;
|
|
36456
|
-
if (typeof value === "function")
|
|
36457
|
-
return value;
|
|
36458
|
-
if (value != null)
|
|
36459
|
-
throw new TypeError(`Expected the "${key}" option to be a function`);
|
|
36460
|
-
if (required)
|
|
36461
|
-
throw new TypeError(`Missing required option "${key}"`);
|
|
36462
|
-
return null;
|
|
36463
|
-
};
|
|
36464
|
-
var getLength = ({ length }) => {
|
|
36465
|
-
if (Number.isInteger(length) && length >= 0)
|
|
36466
|
-
return length;
|
|
36467
|
-
throw new TypeError("Expected function.length to be a positive integer");
|
|
36468
|
-
};
|
|
36469
|
-
});
|
|
36470
|
-
|
|
36471
|
-
// node_modules/better-sqlite3/lib/methods/table.js
|
|
36472
|
-
var require_table = __commonJS((exports, module) => {
|
|
36473
|
-
var { cppdb } = require_util2();
|
|
36474
|
-
module.exports = function defineTable(name, factory) {
|
|
36475
|
-
if (typeof name !== "string")
|
|
36476
|
-
throw new TypeError("Expected first argument to be a string");
|
|
36477
|
-
if (!name)
|
|
36478
|
-
throw new TypeError("Virtual table module name cannot be an empty string");
|
|
36479
|
-
let eponymous = false;
|
|
36480
|
-
if (typeof factory === "object" && factory !== null) {
|
|
36481
|
-
eponymous = true;
|
|
36482
|
-
factory = defer(parseTableDefinition(factory, "used", name));
|
|
36483
|
-
} else {
|
|
36484
|
-
if (typeof factory !== "function")
|
|
36485
|
-
throw new TypeError("Expected second argument to be a function or a table definition object");
|
|
36486
|
-
factory = wrapFactory(factory);
|
|
36487
|
-
}
|
|
36488
|
-
this[cppdb].table(factory, name, eponymous);
|
|
36489
|
-
return this;
|
|
36490
|
-
};
|
|
36491
|
-
function wrapFactory(factory) {
|
|
36492
|
-
return function virtualTableFactory(moduleName, databaseName, tableName, ...args) {
|
|
36493
|
-
const thisObject = {
|
|
36494
|
-
module: moduleName,
|
|
36495
|
-
database: databaseName,
|
|
36496
|
-
table: tableName
|
|
36497
|
-
};
|
|
36498
|
-
const def = apply.call(factory, thisObject, args);
|
|
36499
|
-
if (typeof def !== "object" || def === null) {
|
|
36500
|
-
throw new TypeError(`Virtual table module "${moduleName}" did not return a table definition object`);
|
|
36501
|
-
}
|
|
36502
|
-
return parseTableDefinition(def, "returned", moduleName);
|
|
36503
|
-
};
|
|
36504
|
-
}
|
|
36505
|
-
function parseTableDefinition(def, verb, moduleName) {
|
|
36506
|
-
if (!hasOwnProperty.call(def, "rows")) {
|
|
36507
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition without a "rows" property`);
|
|
36508
|
-
}
|
|
36509
|
-
if (!hasOwnProperty.call(def, "columns")) {
|
|
36510
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition without a "columns" property`);
|
|
36511
|
-
}
|
|
36512
|
-
const rows = def.rows;
|
|
36513
|
-
if (typeof rows !== "function" || Object.getPrototypeOf(rows) !== GeneratorFunctionPrototype) {
|
|
36514
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "rows" property (should be a generator function)`);
|
|
36515
|
-
}
|
|
36516
|
-
let columns = def.columns;
|
|
36517
|
-
if (!Array.isArray(columns) || !(columns = [...columns]).every((x) => typeof x === "string")) {
|
|
36518
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "columns" property (should be an array of strings)`);
|
|
36519
|
-
}
|
|
36520
|
-
if (columns.length !== new Set(columns).size) {
|
|
36521
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with duplicate column names`);
|
|
36522
|
-
}
|
|
36523
|
-
if (!columns.length) {
|
|
36524
|
-
throw new RangeError(`Virtual table module "${moduleName}" ${verb} a table definition with zero columns`);
|
|
36525
|
-
}
|
|
36526
|
-
let parameters;
|
|
36527
|
-
if (hasOwnProperty.call(def, "parameters")) {
|
|
36528
|
-
parameters = def.parameters;
|
|
36529
|
-
if (!Array.isArray(parameters) || !(parameters = [...parameters]).every((x) => typeof x === "string")) {
|
|
36530
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "parameters" property (should be an array of strings)`);
|
|
36531
|
-
}
|
|
36532
|
-
} else {
|
|
36533
|
-
parameters = inferParameters(rows);
|
|
36534
|
-
}
|
|
36535
|
-
if (parameters.length !== new Set(parameters).size) {
|
|
36536
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with duplicate parameter names`);
|
|
36537
|
-
}
|
|
36538
|
-
if (parameters.length > 32) {
|
|
36539
|
-
throw new RangeError(`Virtual table module "${moduleName}" ${verb} a table definition with more than the maximum number of 32 parameters`);
|
|
36540
|
-
}
|
|
36541
|
-
for (const parameter of parameters) {
|
|
36542
|
-
if (columns.includes(parameter)) {
|
|
36543
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with column "${parameter}" which was ambiguously defined as both a column and parameter`);
|
|
36544
|
-
}
|
|
36545
|
-
}
|
|
36546
|
-
let safeIntegers = 2;
|
|
36547
|
-
if (hasOwnProperty.call(def, "safeIntegers")) {
|
|
36548
|
-
const bool = def.safeIntegers;
|
|
36549
|
-
if (typeof bool !== "boolean") {
|
|
36550
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "safeIntegers" property (should be a boolean)`);
|
|
36551
|
-
}
|
|
36552
|
-
safeIntegers = +bool;
|
|
36553
|
-
}
|
|
36554
|
-
let directOnly = false;
|
|
36555
|
-
if (hasOwnProperty.call(def, "directOnly")) {
|
|
36556
|
-
directOnly = def.directOnly;
|
|
36557
|
-
if (typeof directOnly !== "boolean") {
|
|
36558
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "directOnly" property (should be a boolean)`);
|
|
36559
|
-
}
|
|
36560
|
-
}
|
|
36561
|
-
const columnDefinitions = [
|
|
36562
|
-
...parameters.map(identifier).map((str) => `${str} HIDDEN`),
|
|
36563
|
-
...columns.map(identifier)
|
|
36564
|
-
];
|
|
36565
|
-
return [
|
|
36566
|
-
`CREATE TABLE x(${columnDefinitions.join(", ")});`,
|
|
36567
|
-
wrapGenerator(rows, new Map(columns.map((x, i) => [x, parameters.length + i])), moduleName),
|
|
36568
|
-
parameters,
|
|
36569
|
-
safeIntegers,
|
|
36570
|
-
directOnly
|
|
36571
|
-
];
|
|
36572
|
-
}
|
|
36573
|
-
function wrapGenerator(generator, columnMap, moduleName) {
|
|
36574
|
-
return function* virtualTable(...args) {
|
|
36575
|
-
const output = args.map((x) => Buffer.isBuffer(x) ? Buffer.from(x) : x);
|
|
36576
|
-
for (let i = 0;i < columnMap.size; ++i) {
|
|
36577
|
-
output.push(null);
|
|
36578
|
-
}
|
|
36579
|
-
for (const row of generator(...args)) {
|
|
36580
|
-
if (Array.isArray(row)) {
|
|
36581
|
-
extractRowArray(row, output, columnMap.size, moduleName);
|
|
36582
|
-
yield output;
|
|
36583
|
-
} else if (typeof row === "object" && row !== null) {
|
|
36584
|
-
extractRowObject(row, output, columnMap, moduleName);
|
|
36585
|
-
yield output;
|
|
36586
|
-
} else {
|
|
36587
|
-
throw new TypeError(`Virtual table module "${moduleName}" yielded something that isn't a valid row object`);
|
|
36588
|
-
}
|
|
36589
|
-
}
|
|
36590
|
-
};
|
|
36591
|
-
}
|
|
36592
|
-
function extractRowArray(row, output, columnCount, moduleName) {
|
|
36593
|
-
if (row.length !== columnCount) {
|
|
36594
|
-
throw new TypeError(`Virtual table module "${moduleName}" yielded a row with an incorrect number of columns`);
|
|
36595
|
-
}
|
|
36596
|
-
const offset = output.length - columnCount;
|
|
36597
|
-
for (let i = 0;i < columnCount; ++i) {
|
|
36598
|
-
output[i + offset] = row[i];
|
|
36599
|
-
}
|
|
36600
|
-
}
|
|
36601
|
-
function extractRowObject(row, output, columnMap, moduleName) {
|
|
36602
|
-
let count = 0;
|
|
36603
|
-
for (const key of Object.keys(row)) {
|
|
36604
|
-
const index = columnMap.get(key);
|
|
36605
|
-
if (index === undefined) {
|
|
36606
|
-
throw new TypeError(`Virtual table module "${moduleName}" yielded a row with an undeclared column "${key}"`);
|
|
36607
|
-
}
|
|
36608
|
-
output[index] = row[key];
|
|
36609
|
-
count += 1;
|
|
36610
|
-
}
|
|
36611
|
-
if (count !== columnMap.size) {
|
|
36612
|
-
throw new TypeError(`Virtual table module "${moduleName}" yielded a row with missing columns`);
|
|
36613
|
-
}
|
|
36614
|
-
}
|
|
36615
|
-
function inferParameters({ length }) {
|
|
36616
|
-
if (!Number.isInteger(length) || length < 0) {
|
|
36617
|
-
throw new TypeError("Expected function.length to be a positive integer");
|
|
36618
|
-
}
|
|
36619
|
-
const params = [];
|
|
36620
|
-
for (let i = 0;i < length; ++i) {
|
|
36621
|
-
params.push(`$${i + 1}`);
|
|
36622
|
-
}
|
|
36623
|
-
return params;
|
|
36624
|
-
}
|
|
36625
|
-
var { hasOwnProperty } = Object.prototype;
|
|
36626
|
-
var { apply } = Function.prototype;
|
|
36627
|
-
var GeneratorFunctionPrototype = Object.getPrototypeOf(function* () {});
|
|
36628
|
-
var identifier = (str) => `"${str.replace(/"/g, '""')}"`;
|
|
36629
|
-
var defer = (x) => () => x;
|
|
36630
|
-
});
|
|
36631
|
-
|
|
36632
|
-
// node_modules/better-sqlite3/lib/methods/inspect.js
|
|
36633
|
-
var require_inspect = __commonJS((exports, module) => {
|
|
36634
|
-
var DatabaseInspection = function Database() {};
|
|
36635
|
-
module.exports = function inspect(depth, opts) {
|
|
36636
|
-
return Object.assign(new DatabaseInspection, this);
|
|
36637
|
-
};
|
|
36638
|
-
});
|
|
36639
|
-
|
|
36640
|
-
// node_modules/better-sqlite3/lib/database.js
|
|
36641
|
-
var require_database = __commonJS((exports, module) => {
|
|
36642
|
-
var fs2 = __require("fs");
|
|
36643
|
-
var path2 = __require("path");
|
|
36644
|
-
var util3 = require_util2();
|
|
36645
|
-
var SqliteError = require_sqlite_error();
|
|
36646
|
-
var DEFAULT_ADDON;
|
|
36647
|
-
function Database(filenameGiven, options) {
|
|
36648
|
-
if (new.target == null) {
|
|
36649
|
-
return new Database(filenameGiven, options);
|
|
36650
|
-
}
|
|
36651
|
-
let buffer;
|
|
36652
|
-
if (Buffer.isBuffer(filenameGiven)) {
|
|
36653
|
-
buffer = filenameGiven;
|
|
36654
|
-
filenameGiven = ":memory:";
|
|
36655
|
-
}
|
|
36656
|
-
if (filenameGiven == null)
|
|
36657
|
-
filenameGiven = "";
|
|
36658
|
-
if (options == null)
|
|
36659
|
-
options = {};
|
|
36660
|
-
if (typeof filenameGiven !== "string")
|
|
36661
|
-
throw new TypeError("Expected first argument to be a string");
|
|
36662
|
-
if (typeof options !== "object")
|
|
36663
|
-
throw new TypeError("Expected second argument to be an options object");
|
|
36664
|
-
if ("readOnly" in options)
|
|
36665
|
-
throw new TypeError('Misspelled option "readOnly" should be "readonly"');
|
|
36666
|
-
if ("memory" in options)
|
|
36667
|
-
throw new TypeError('Option "memory" was removed in v7.0.0 (use ":memory:" filename instead)');
|
|
36668
|
-
const filename = filenameGiven.trim();
|
|
36669
|
-
const anonymous = filename === "" || filename === ":memory:";
|
|
36670
|
-
const readonly2 = util3.getBooleanOption(options, "readonly");
|
|
36671
|
-
const fileMustExist = util3.getBooleanOption(options, "fileMustExist");
|
|
36672
|
-
const timeout = "timeout" in options ? options.timeout : 5000;
|
|
36673
|
-
const verbose = "verbose" in options ? options.verbose : null;
|
|
36674
|
-
const nativeBinding = "nativeBinding" in options ? options.nativeBinding : null;
|
|
36675
|
-
if (readonly2 && anonymous && !buffer)
|
|
36676
|
-
throw new TypeError("In-memory/temporary databases cannot be readonly");
|
|
36677
|
-
if (!Number.isInteger(timeout) || timeout < 0)
|
|
36678
|
-
throw new TypeError('Expected the "timeout" option to be a positive integer');
|
|
36679
|
-
if (timeout > 2147483647)
|
|
36680
|
-
throw new RangeError('Option "timeout" cannot be greater than 2147483647');
|
|
36681
|
-
if (verbose != null && typeof verbose !== "function")
|
|
36682
|
-
throw new TypeError('Expected the "verbose" option to be a function');
|
|
36683
|
-
if (nativeBinding != null && typeof nativeBinding !== "string" && typeof nativeBinding !== "object")
|
|
36684
|
-
throw new TypeError('Expected the "nativeBinding" option to be a string or addon object');
|
|
36685
|
-
let addon;
|
|
36686
|
-
if (nativeBinding == null) {
|
|
36687
|
-
addon = DEFAULT_ADDON || (DEFAULT_ADDON = require_bindings()("better_sqlite3.node"));
|
|
36688
|
-
} else if (typeof nativeBinding === "string") {
|
|
36689
|
-
const requireFunc = typeof __non_webpack_require__ === "function" ? __non_webpack_require__ : __require;
|
|
36690
|
-
addon = requireFunc(path2.resolve(nativeBinding).replace(/(\.node)?$/, ".node"));
|
|
36691
|
-
} else {
|
|
36692
|
-
addon = nativeBinding;
|
|
36693
|
-
}
|
|
36694
|
-
if (!addon.isInitialized) {
|
|
36695
|
-
addon.setErrorConstructor(SqliteError);
|
|
36696
|
-
addon.isInitialized = true;
|
|
36697
|
-
}
|
|
36698
|
-
if (!anonymous && !filename.startsWith("file:") && !fs2.existsSync(path2.dirname(filename))) {
|
|
36699
|
-
throw new TypeError("Cannot open database because the directory does not exist");
|
|
36700
|
-
}
|
|
36701
|
-
Object.defineProperties(this, {
|
|
36702
|
-
[util3.cppdb]: { value: new addon.Database(filename, filenameGiven, anonymous, readonly2, fileMustExist, timeout, verbose || null, buffer || null) },
|
|
36703
|
-
...wrappers.getters
|
|
36704
|
-
});
|
|
36705
|
-
}
|
|
36706
|
-
var wrappers = require_wrappers();
|
|
36707
|
-
Database.prototype.prepare = wrappers.prepare;
|
|
36708
|
-
Database.prototype.transaction = require_transaction();
|
|
36709
|
-
Database.prototype.pragma = require_pragma();
|
|
36710
|
-
Database.prototype.backup = require_backup();
|
|
36711
|
-
Database.prototype.serialize = require_serialize();
|
|
36712
|
-
Database.prototype.function = require_function();
|
|
36713
|
-
Database.prototype.aggregate = require_aggregate();
|
|
36714
|
-
Database.prototype.table = require_table();
|
|
36715
|
-
Database.prototype.loadExtension = wrappers.loadExtension;
|
|
36716
|
-
Database.prototype.exec = wrappers.exec;
|
|
36717
|
-
Database.prototype.close = wrappers.close;
|
|
36718
|
-
Database.prototype.defaultSafeIntegers = wrappers.defaultSafeIntegers;
|
|
36719
|
-
Database.prototype.unsafeMode = wrappers.unsafeMode;
|
|
36720
|
-
Database.prototype[util3.inspect] = require_inspect();
|
|
36721
|
-
module.exports = Database;
|
|
36722
|
-
});
|
|
36723
|
-
|
|
36724
|
-
// node_modules/better-sqlite3/lib/index.js
|
|
36725
|
-
var require_lib5 = __commonJS((exports, module) => {
|
|
36726
|
-
module.exports = require_database();
|
|
36727
|
-
module.exports.SqliteError = require_sqlite_error();
|
|
36728
|
-
});
|
|
36729
|
-
|
|
36730
35965
|
// src/Server.js
|
|
36731
35966
|
var import_express2 = __toESM(require_express2(), 1);
|
|
36732
35967
|
var import_cors = __toESM(require_lib3(), 1);
|
|
@@ -45908,7 +45143,7 @@ import os2 from "os";
|
|
|
45908
45143
|
import path3 from "path";
|
|
45909
45144
|
|
|
45910
45145
|
// src/core/db.js
|
|
45911
|
-
|
|
45146
|
+
import Database from "better-sqlite3";
|
|
45912
45147
|
import fs2 from "fs";
|
|
45913
45148
|
import path2 from "path";
|
|
45914
45149
|
import { fileURLToPath } from "url";
|
|
@@ -45921,7 +45156,7 @@ var openDatabase = (filepath) => {
|
|
|
45921
45156
|
if (!fs2.existsSync(dir)) {
|
|
45922
45157
|
fs2.mkdirSync(dir, { recursive: true });
|
|
45923
45158
|
}
|
|
45924
|
-
const db = new
|
|
45159
|
+
const db = new Database(filepath);
|
|
45925
45160
|
db.pragma("foreign_keys = ON");
|
|
45926
45161
|
db.pragma("journal_mode = WAL");
|
|
45927
45162
|
const schema = fs2.readFileSync(SCHEMA_PATH, "utf8");
|
|
@@ -46180,4 +45415,4 @@ ${signal} received, shutting down gracefully...`);
|
|
|
46180
45415
|
process.on("SIGINT", () => shutdown("SIGINT"));
|
|
46181
45416
|
process.on("SIGTERM", () => shutdown("SIGTERM"));
|
|
46182
45417
|
|
|
46183
|
-
//# debugId=
|
|
45418
|
+
//# debugId=E4238B48CE310B7864756E2164756E21
|