@miriad-systems/nuum 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +109 -1106
- package/package.json +2 -4
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
2
|
-
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
// @bun
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __getProtoOf = Object.getPrototypeOf;
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
@@ -26,7 +26,7 @@ var __export = (target, all) => {
|
|
|
26
26
|
set: (newValue) => all[name] = () => newValue
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
|
-
var __require =
|
|
29
|
+
var __require = import.meta.require;
|
|
30
30
|
|
|
31
31
|
// node_modules/drizzle-orm/entity.cjs
|
|
32
32
|
var require_entity = __commonJS((exports, module) => {
|
|
@@ -8968,1007 +8968,6 @@ var require_bun_sqlite = __commonJS((exports, module) => {
|
|
|
8968
8968
|
__reExport(bun_sqlite_exports, require_session2(), module.exports);
|
|
8969
8969
|
});
|
|
8970
8970
|
|
|
8971
|
-
// node_modules/better-sqlite3/lib/util.js
|
|
8972
|
-
var require_util = __commonJS((exports) => {
|
|
8973
|
-
exports.getBooleanOption = (options, key) => {
|
|
8974
|
-
let value = false;
|
|
8975
|
-
if (key in options && typeof (value = options[key]) !== "boolean") {
|
|
8976
|
-
throw new TypeError(`Expected the "${key}" option to be a boolean`);
|
|
8977
|
-
}
|
|
8978
|
-
return value;
|
|
8979
|
-
};
|
|
8980
|
-
exports.cppdb = Symbol();
|
|
8981
|
-
exports.inspect = Symbol.for("nodejs.util.inspect.custom");
|
|
8982
|
-
});
|
|
8983
|
-
|
|
8984
|
-
// node_modules/better-sqlite3/lib/sqlite-error.js
|
|
8985
|
-
var require_sqlite_error = __commonJS((exports, module) => {
|
|
8986
|
-
var descriptor = { value: "SqliteError", writable: true, enumerable: false, configurable: true };
|
|
8987
|
-
function SqliteError(message, code) {
|
|
8988
|
-
if (new.target !== SqliteError) {
|
|
8989
|
-
return new SqliteError(message, code);
|
|
8990
|
-
}
|
|
8991
|
-
if (typeof code !== "string") {
|
|
8992
|
-
throw new TypeError("Expected second argument to be a string");
|
|
8993
|
-
}
|
|
8994
|
-
Error.call(this, message);
|
|
8995
|
-
descriptor.value = "" + message;
|
|
8996
|
-
Object.defineProperty(this, "message", descriptor);
|
|
8997
|
-
Error.captureStackTrace(this, SqliteError);
|
|
8998
|
-
this.code = code;
|
|
8999
|
-
}
|
|
9000
|
-
Object.setPrototypeOf(SqliteError, Error);
|
|
9001
|
-
Object.setPrototypeOf(SqliteError.prototype, Error.prototype);
|
|
9002
|
-
Object.defineProperty(SqliteError.prototype, "name", descriptor);
|
|
9003
|
-
module.exports = SqliteError;
|
|
9004
|
-
});
|
|
9005
|
-
|
|
9006
|
-
// node_modules/file-uri-to-path/index.js
|
|
9007
|
-
var require_file_uri_to_path = __commonJS((exports, module) => {
|
|
9008
|
-
var sep = __require("path").sep || "/";
|
|
9009
|
-
module.exports = fileUriToPath;
|
|
9010
|
-
function fileUriToPath(uri) {
|
|
9011
|
-
if (typeof uri != "string" || uri.length <= 7 || uri.substring(0, 7) != "file://") {
|
|
9012
|
-
throw new TypeError("must pass in a file:// URI to convert to a file path");
|
|
9013
|
-
}
|
|
9014
|
-
var rest = decodeURI(uri.substring(7));
|
|
9015
|
-
var firstSlash = rest.indexOf("/");
|
|
9016
|
-
var host = rest.substring(0, firstSlash);
|
|
9017
|
-
var path = rest.substring(firstSlash + 1);
|
|
9018
|
-
if (host == "localhost")
|
|
9019
|
-
host = "";
|
|
9020
|
-
if (host) {
|
|
9021
|
-
host = sep + sep + host;
|
|
9022
|
-
}
|
|
9023
|
-
path = path.replace(/^(.+)\|/, "$1:");
|
|
9024
|
-
if (sep == "\\") {
|
|
9025
|
-
path = path.replace(/\//g, "\\");
|
|
9026
|
-
}
|
|
9027
|
-
if (/^.+\:/.test(path)) {} else {
|
|
9028
|
-
path = sep + path;
|
|
9029
|
-
}
|
|
9030
|
-
return host + path;
|
|
9031
|
-
}
|
|
9032
|
-
});
|
|
9033
|
-
|
|
9034
|
-
// node_modules/bindings/bindings.js
|
|
9035
|
-
var require_bindings = __commonJS((exports, module) => {
|
|
9036
|
-
var __filename = "/Users/simen/dev/miriad-code/node_modules/bindings/bindings.js";
|
|
9037
|
-
var fs = __require("fs");
|
|
9038
|
-
var path = __require("path");
|
|
9039
|
-
var fileURLToPath = require_file_uri_to_path();
|
|
9040
|
-
var join = path.join;
|
|
9041
|
-
var dirname = path.dirname;
|
|
9042
|
-
var exists = fs.accessSync && function(path2) {
|
|
9043
|
-
try {
|
|
9044
|
-
fs.accessSync(path2);
|
|
9045
|
-
} catch (e) {
|
|
9046
|
-
return false;
|
|
9047
|
-
}
|
|
9048
|
-
return true;
|
|
9049
|
-
} || fs.existsSync || path.existsSync;
|
|
9050
|
-
var defaults = {
|
|
9051
|
-
arrow: process.env.NODE_BINDINGS_ARROW || " → ",
|
|
9052
|
-
compiled: process.env.NODE_BINDINGS_COMPILED_DIR || "compiled",
|
|
9053
|
-
platform: process.platform,
|
|
9054
|
-
arch: process.arch,
|
|
9055
|
-
nodePreGyp: "node-v" + process.versions.modules + "-" + process.platform + "-" + process.arch,
|
|
9056
|
-
version: process.versions.node,
|
|
9057
|
-
bindings: "bindings.node",
|
|
9058
|
-
try: [
|
|
9059
|
-
["module_root", "build", "bindings"],
|
|
9060
|
-
["module_root", "build", "Debug", "bindings"],
|
|
9061
|
-
["module_root", "build", "Release", "bindings"],
|
|
9062
|
-
["module_root", "out", "Debug", "bindings"],
|
|
9063
|
-
["module_root", "Debug", "bindings"],
|
|
9064
|
-
["module_root", "out", "Release", "bindings"],
|
|
9065
|
-
["module_root", "Release", "bindings"],
|
|
9066
|
-
["module_root", "build", "default", "bindings"],
|
|
9067
|
-
["module_root", "compiled", "version", "platform", "arch", "bindings"],
|
|
9068
|
-
["module_root", "addon-build", "release", "install-root", "bindings"],
|
|
9069
|
-
["module_root", "addon-build", "debug", "install-root", "bindings"],
|
|
9070
|
-
["module_root", "addon-build", "default", "install-root", "bindings"],
|
|
9071
|
-
["module_root", "lib", "binding", "nodePreGyp", "bindings"]
|
|
9072
|
-
]
|
|
9073
|
-
};
|
|
9074
|
-
function bindings(opts) {
|
|
9075
|
-
if (typeof opts == "string") {
|
|
9076
|
-
opts = { bindings: opts };
|
|
9077
|
-
} else if (!opts) {
|
|
9078
|
-
opts = {};
|
|
9079
|
-
}
|
|
9080
|
-
Object.keys(defaults).map(function(i2) {
|
|
9081
|
-
if (!(i2 in opts))
|
|
9082
|
-
opts[i2] = defaults[i2];
|
|
9083
|
-
});
|
|
9084
|
-
if (!opts.module_root) {
|
|
9085
|
-
opts.module_root = exports.getRoot(exports.getFileName());
|
|
9086
|
-
}
|
|
9087
|
-
if (path.extname(opts.bindings) != ".node") {
|
|
9088
|
-
opts.bindings += ".node";
|
|
9089
|
-
}
|
|
9090
|
-
var requireFunc = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
|
|
9091
|
-
var tries = [], i = 0, l = opts.try.length, n, b, err;
|
|
9092
|
-
for (;i < l; i++) {
|
|
9093
|
-
n = join.apply(null, opts.try[i].map(function(p) {
|
|
9094
|
-
return opts[p] || p;
|
|
9095
|
-
}));
|
|
9096
|
-
tries.push(n);
|
|
9097
|
-
try {
|
|
9098
|
-
b = opts.path ? requireFunc.resolve(n) : requireFunc(n);
|
|
9099
|
-
if (!opts.path) {
|
|
9100
|
-
b.path = n;
|
|
9101
|
-
}
|
|
9102
|
-
return b;
|
|
9103
|
-
} catch (e) {
|
|
9104
|
-
if (e.code !== "MODULE_NOT_FOUND" && e.code !== "QUALIFIED_PATH_RESOLUTION_FAILED" && !/not find/i.test(e.message)) {
|
|
9105
|
-
throw e;
|
|
9106
|
-
}
|
|
9107
|
-
}
|
|
9108
|
-
}
|
|
9109
|
-
err = new Error(`Could not locate the bindings file. Tried:
|
|
9110
|
-
` + tries.map(function(a) {
|
|
9111
|
-
return opts.arrow + a;
|
|
9112
|
-
}).join(`
|
|
9113
|
-
`));
|
|
9114
|
-
err.tries = tries;
|
|
9115
|
-
throw err;
|
|
9116
|
-
}
|
|
9117
|
-
module.exports = exports = bindings;
|
|
9118
|
-
exports.getFileName = function getFileName(calling_file) {
|
|
9119
|
-
var { prepareStackTrace: origPST, stackTraceLimit: origSTL } = Error, dummy = {}, fileName;
|
|
9120
|
-
Error.stackTraceLimit = 10;
|
|
9121
|
-
Error.prepareStackTrace = function(e, st) {
|
|
9122
|
-
for (var i = 0, l = st.length;i < l; i++) {
|
|
9123
|
-
fileName = st[i].getFileName();
|
|
9124
|
-
if (fileName !== __filename) {
|
|
9125
|
-
if (calling_file) {
|
|
9126
|
-
if (fileName !== calling_file) {
|
|
9127
|
-
return;
|
|
9128
|
-
}
|
|
9129
|
-
} else {
|
|
9130
|
-
return;
|
|
9131
|
-
}
|
|
9132
|
-
}
|
|
9133
|
-
}
|
|
9134
|
-
};
|
|
9135
|
-
Error.captureStackTrace(dummy);
|
|
9136
|
-
dummy.stack;
|
|
9137
|
-
Error.prepareStackTrace = origPST;
|
|
9138
|
-
Error.stackTraceLimit = origSTL;
|
|
9139
|
-
var fileSchema = "file://";
|
|
9140
|
-
if (fileName.indexOf(fileSchema) === 0) {
|
|
9141
|
-
fileName = fileURLToPath(fileName);
|
|
9142
|
-
}
|
|
9143
|
-
return fileName;
|
|
9144
|
-
};
|
|
9145
|
-
exports.getRoot = function getRoot(file) {
|
|
9146
|
-
var dir = dirname(file), prev;
|
|
9147
|
-
while (true) {
|
|
9148
|
-
if (dir === ".") {
|
|
9149
|
-
dir = process.cwd();
|
|
9150
|
-
}
|
|
9151
|
-
if (exists(join(dir, "package.json")) || exists(join(dir, "node_modules"))) {
|
|
9152
|
-
return dir;
|
|
9153
|
-
}
|
|
9154
|
-
if (prev === dir) {
|
|
9155
|
-
throw new Error('Could not find module root given file: "' + file + '". Do you have a `package.json` file? ');
|
|
9156
|
-
}
|
|
9157
|
-
prev = dir;
|
|
9158
|
-
dir = join(dir, "..");
|
|
9159
|
-
}
|
|
9160
|
-
};
|
|
9161
|
-
});
|
|
9162
|
-
|
|
9163
|
-
// node_modules/better-sqlite3/lib/methods/wrappers.js
|
|
9164
|
-
var require_wrappers = __commonJS((exports) => {
|
|
9165
|
-
var { cppdb } = require_util();
|
|
9166
|
-
exports.prepare = function prepare(sql2) {
|
|
9167
|
-
return this[cppdb].prepare(sql2, this, false);
|
|
9168
|
-
};
|
|
9169
|
-
exports.exec = function exec(sql2) {
|
|
9170
|
-
this[cppdb].exec(sql2);
|
|
9171
|
-
return this;
|
|
9172
|
-
};
|
|
9173
|
-
exports.close = function close() {
|
|
9174
|
-
this[cppdb].close();
|
|
9175
|
-
return this;
|
|
9176
|
-
};
|
|
9177
|
-
exports.loadExtension = function loadExtension(...args) {
|
|
9178
|
-
this[cppdb].loadExtension(...args);
|
|
9179
|
-
return this;
|
|
9180
|
-
};
|
|
9181
|
-
exports.defaultSafeIntegers = function defaultSafeIntegers(...args) {
|
|
9182
|
-
this[cppdb].defaultSafeIntegers(...args);
|
|
9183
|
-
return this;
|
|
9184
|
-
};
|
|
9185
|
-
exports.unsafeMode = function unsafeMode(...args) {
|
|
9186
|
-
this[cppdb].unsafeMode(...args);
|
|
9187
|
-
return this;
|
|
9188
|
-
};
|
|
9189
|
-
exports.getters = {
|
|
9190
|
-
name: {
|
|
9191
|
-
get: function name() {
|
|
9192
|
-
return this[cppdb].name;
|
|
9193
|
-
},
|
|
9194
|
-
enumerable: true
|
|
9195
|
-
},
|
|
9196
|
-
open: {
|
|
9197
|
-
get: function open() {
|
|
9198
|
-
return this[cppdb].open;
|
|
9199
|
-
},
|
|
9200
|
-
enumerable: true
|
|
9201
|
-
},
|
|
9202
|
-
inTransaction: {
|
|
9203
|
-
get: function inTransaction() {
|
|
9204
|
-
return this[cppdb].inTransaction;
|
|
9205
|
-
},
|
|
9206
|
-
enumerable: true
|
|
9207
|
-
},
|
|
9208
|
-
readonly: {
|
|
9209
|
-
get: function readonly() {
|
|
9210
|
-
return this[cppdb].readonly;
|
|
9211
|
-
},
|
|
9212
|
-
enumerable: true
|
|
9213
|
-
},
|
|
9214
|
-
memory: {
|
|
9215
|
-
get: function memory() {
|
|
9216
|
-
return this[cppdb].memory;
|
|
9217
|
-
},
|
|
9218
|
-
enumerable: true
|
|
9219
|
-
}
|
|
9220
|
-
};
|
|
9221
|
-
});
|
|
9222
|
-
|
|
9223
|
-
// node_modules/better-sqlite3/lib/methods/transaction.js
|
|
9224
|
-
var require_transaction = __commonJS((exports, module) => {
|
|
9225
|
-
var { cppdb } = require_util();
|
|
9226
|
-
var controllers = new WeakMap;
|
|
9227
|
-
module.exports = function transaction(fn) {
|
|
9228
|
-
if (typeof fn !== "function")
|
|
9229
|
-
throw new TypeError("Expected first argument to be a function");
|
|
9230
|
-
const db = this[cppdb];
|
|
9231
|
-
const controller = getController(db, this);
|
|
9232
|
-
const { apply } = Function.prototype;
|
|
9233
|
-
const properties = {
|
|
9234
|
-
default: { value: wrapTransaction(apply, fn, db, controller.default) },
|
|
9235
|
-
deferred: { value: wrapTransaction(apply, fn, db, controller.deferred) },
|
|
9236
|
-
immediate: { value: wrapTransaction(apply, fn, db, controller.immediate) },
|
|
9237
|
-
exclusive: { value: wrapTransaction(apply, fn, db, controller.exclusive) },
|
|
9238
|
-
database: { value: this, enumerable: true }
|
|
9239
|
-
};
|
|
9240
|
-
Object.defineProperties(properties.default.value, properties);
|
|
9241
|
-
Object.defineProperties(properties.deferred.value, properties);
|
|
9242
|
-
Object.defineProperties(properties.immediate.value, properties);
|
|
9243
|
-
Object.defineProperties(properties.exclusive.value, properties);
|
|
9244
|
-
return properties.default.value;
|
|
9245
|
-
};
|
|
9246
|
-
var getController = (db, self) => {
|
|
9247
|
-
let controller = controllers.get(db);
|
|
9248
|
-
if (!controller) {
|
|
9249
|
-
const shared = {
|
|
9250
|
-
commit: db.prepare("COMMIT", self, false),
|
|
9251
|
-
rollback: db.prepare("ROLLBACK", self, false),
|
|
9252
|
-
savepoint: db.prepare("SAVEPOINT `\t_bs3.\t`", self, false),
|
|
9253
|
-
release: db.prepare("RELEASE `\t_bs3.\t`", self, false),
|
|
9254
|
-
rollbackTo: db.prepare("ROLLBACK TO `\t_bs3.\t`", self, false)
|
|
9255
|
-
};
|
|
9256
|
-
controllers.set(db, controller = {
|
|
9257
|
-
default: Object.assign({ begin: db.prepare("BEGIN", self, false) }, shared),
|
|
9258
|
-
deferred: Object.assign({ begin: db.prepare("BEGIN DEFERRED", self, false) }, shared),
|
|
9259
|
-
immediate: Object.assign({ begin: db.prepare("BEGIN IMMEDIATE", self, false) }, shared),
|
|
9260
|
-
exclusive: Object.assign({ begin: db.prepare("BEGIN EXCLUSIVE", self, false) }, shared)
|
|
9261
|
-
});
|
|
9262
|
-
}
|
|
9263
|
-
return controller;
|
|
9264
|
-
};
|
|
9265
|
-
var wrapTransaction = (apply, fn, db, { begin, commit, rollback, savepoint, release, rollbackTo }) => function sqliteTransaction() {
|
|
9266
|
-
let before, after, undo;
|
|
9267
|
-
if (db.inTransaction) {
|
|
9268
|
-
before = savepoint;
|
|
9269
|
-
after = release;
|
|
9270
|
-
undo = rollbackTo;
|
|
9271
|
-
} else {
|
|
9272
|
-
before = begin;
|
|
9273
|
-
after = commit;
|
|
9274
|
-
undo = rollback;
|
|
9275
|
-
}
|
|
9276
|
-
before.run();
|
|
9277
|
-
try {
|
|
9278
|
-
const result = apply.call(fn, this, arguments);
|
|
9279
|
-
if (result && typeof result.then === "function") {
|
|
9280
|
-
throw new TypeError("Transaction function cannot return a promise");
|
|
9281
|
-
}
|
|
9282
|
-
after.run();
|
|
9283
|
-
return result;
|
|
9284
|
-
} catch (ex) {
|
|
9285
|
-
if (db.inTransaction) {
|
|
9286
|
-
undo.run();
|
|
9287
|
-
if (undo !== rollback)
|
|
9288
|
-
after.run();
|
|
9289
|
-
}
|
|
9290
|
-
throw ex;
|
|
9291
|
-
}
|
|
9292
|
-
};
|
|
9293
|
-
});
|
|
9294
|
-
|
|
9295
|
-
// node_modules/better-sqlite3/lib/methods/pragma.js
|
|
9296
|
-
var require_pragma = __commonJS((exports, module) => {
|
|
9297
|
-
var { getBooleanOption, cppdb } = require_util();
|
|
9298
|
-
module.exports = function pragma(source, options) {
|
|
9299
|
-
if (options == null)
|
|
9300
|
-
options = {};
|
|
9301
|
-
if (typeof source !== "string")
|
|
9302
|
-
throw new TypeError("Expected first argument to be a string");
|
|
9303
|
-
if (typeof options !== "object")
|
|
9304
|
-
throw new TypeError("Expected second argument to be an options object");
|
|
9305
|
-
const simple = getBooleanOption(options, "simple");
|
|
9306
|
-
const stmt = this[cppdb].prepare(`PRAGMA ${source}`, this, true);
|
|
9307
|
-
return simple ? stmt.pluck().get() : stmt.all();
|
|
9308
|
-
};
|
|
9309
|
-
});
|
|
9310
|
-
|
|
9311
|
-
// node_modules/better-sqlite3/lib/methods/backup.js
|
|
9312
|
-
var require_backup = __commonJS((exports, module) => {
|
|
9313
|
-
var fs = __require("fs");
|
|
9314
|
-
var path = __require("path");
|
|
9315
|
-
var { promisify } = __require("util");
|
|
9316
|
-
var { cppdb } = require_util();
|
|
9317
|
-
var fsAccess = promisify(fs.access);
|
|
9318
|
-
module.exports = async function backup(filename, options) {
|
|
9319
|
-
if (options == null)
|
|
9320
|
-
options = {};
|
|
9321
|
-
if (typeof filename !== "string")
|
|
9322
|
-
throw new TypeError("Expected first argument to be a string");
|
|
9323
|
-
if (typeof options !== "object")
|
|
9324
|
-
throw new TypeError("Expected second argument to be an options object");
|
|
9325
|
-
filename = filename.trim();
|
|
9326
|
-
const attachedName = "attached" in options ? options.attached : "main";
|
|
9327
|
-
const handler = "progress" in options ? options.progress : null;
|
|
9328
|
-
if (!filename)
|
|
9329
|
-
throw new TypeError("Backup filename cannot be an empty string");
|
|
9330
|
-
if (filename === ":memory:")
|
|
9331
|
-
throw new TypeError('Invalid backup filename ":memory:"');
|
|
9332
|
-
if (typeof attachedName !== "string")
|
|
9333
|
-
throw new TypeError('Expected the "attached" option to be a string');
|
|
9334
|
-
if (!attachedName)
|
|
9335
|
-
throw new TypeError('The "attached" option cannot be an empty string');
|
|
9336
|
-
if (handler != null && typeof handler !== "function")
|
|
9337
|
-
throw new TypeError('Expected the "progress" option to be a function');
|
|
9338
|
-
await fsAccess(path.dirname(filename)).catch(() => {
|
|
9339
|
-
throw new TypeError("Cannot save backup because the directory does not exist");
|
|
9340
|
-
});
|
|
9341
|
-
const isNewFile = await fsAccess(filename).then(() => false, () => true);
|
|
9342
|
-
return runBackup(this[cppdb].backup(this, attachedName, filename, isNewFile), handler || null);
|
|
9343
|
-
};
|
|
9344
|
-
var runBackup = (backup, handler) => {
|
|
9345
|
-
let rate = 0;
|
|
9346
|
-
let useDefault = true;
|
|
9347
|
-
return new Promise((resolve, reject) => {
|
|
9348
|
-
setImmediate(function step() {
|
|
9349
|
-
try {
|
|
9350
|
-
const progress = backup.transfer(rate);
|
|
9351
|
-
if (!progress.remainingPages) {
|
|
9352
|
-
backup.close();
|
|
9353
|
-
resolve(progress);
|
|
9354
|
-
return;
|
|
9355
|
-
}
|
|
9356
|
-
if (useDefault) {
|
|
9357
|
-
useDefault = false;
|
|
9358
|
-
rate = 100;
|
|
9359
|
-
}
|
|
9360
|
-
if (handler) {
|
|
9361
|
-
const ret = handler(progress);
|
|
9362
|
-
if (ret !== undefined) {
|
|
9363
|
-
if (typeof ret === "number" && ret === ret)
|
|
9364
|
-
rate = Math.max(0, Math.min(2147483647, Math.round(ret)));
|
|
9365
|
-
else
|
|
9366
|
-
throw new TypeError("Expected progress callback to return a number or undefined");
|
|
9367
|
-
}
|
|
9368
|
-
}
|
|
9369
|
-
setImmediate(step);
|
|
9370
|
-
} catch (err) {
|
|
9371
|
-
backup.close();
|
|
9372
|
-
reject(err);
|
|
9373
|
-
}
|
|
9374
|
-
});
|
|
9375
|
-
});
|
|
9376
|
-
};
|
|
9377
|
-
});
|
|
9378
|
-
|
|
9379
|
-
// node_modules/better-sqlite3/lib/methods/serialize.js
|
|
9380
|
-
var require_serialize = __commonJS((exports, module) => {
|
|
9381
|
-
var { cppdb } = require_util();
|
|
9382
|
-
module.exports = function serialize(options) {
|
|
9383
|
-
if (options == null)
|
|
9384
|
-
options = {};
|
|
9385
|
-
if (typeof options !== "object")
|
|
9386
|
-
throw new TypeError("Expected first argument to be an options object");
|
|
9387
|
-
const attachedName = "attached" in options ? options.attached : "main";
|
|
9388
|
-
if (typeof attachedName !== "string")
|
|
9389
|
-
throw new TypeError('Expected the "attached" option to be a string');
|
|
9390
|
-
if (!attachedName)
|
|
9391
|
-
throw new TypeError('The "attached" option cannot be an empty string');
|
|
9392
|
-
return this[cppdb].serialize(attachedName);
|
|
9393
|
-
};
|
|
9394
|
-
});
|
|
9395
|
-
|
|
9396
|
-
// node_modules/better-sqlite3/lib/methods/function.js
|
|
9397
|
-
var require_function = __commonJS((exports, module) => {
|
|
9398
|
-
var { getBooleanOption, cppdb } = require_util();
|
|
9399
|
-
module.exports = function defineFunction(name, options, fn) {
|
|
9400
|
-
if (options == null)
|
|
9401
|
-
options = {};
|
|
9402
|
-
if (typeof options === "function") {
|
|
9403
|
-
fn = options;
|
|
9404
|
-
options = {};
|
|
9405
|
-
}
|
|
9406
|
-
if (typeof name !== "string")
|
|
9407
|
-
throw new TypeError("Expected first argument to be a string");
|
|
9408
|
-
if (typeof fn !== "function")
|
|
9409
|
-
throw new TypeError("Expected last argument to be a function");
|
|
9410
|
-
if (typeof options !== "object")
|
|
9411
|
-
throw new TypeError("Expected second argument to be an options object");
|
|
9412
|
-
if (!name)
|
|
9413
|
-
throw new TypeError("User-defined function name cannot be an empty string");
|
|
9414
|
-
const safeIntegers = "safeIntegers" in options ? +getBooleanOption(options, "safeIntegers") : 2;
|
|
9415
|
-
const deterministic = getBooleanOption(options, "deterministic");
|
|
9416
|
-
const directOnly = getBooleanOption(options, "directOnly");
|
|
9417
|
-
const varargs = getBooleanOption(options, "varargs");
|
|
9418
|
-
let argCount = -1;
|
|
9419
|
-
if (!varargs) {
|
|
9420
|
-
argCount = fn.length;
|
|
9421
|
-
if (!Number.isInteger(argCount) || argCount < 0)
|
|
9422
|
-
throw new TypeError("Expected function.length to be a positive integer");
|
|
9423
|
-
if (argCount > 100)
|
|
9424
|
-
throw new RangeError("User-defined functions cannot have more than 100 arguments");
|
|
9425
|
-
}
|
|
9426
|
-
this[cppdb].function(fn, name, argCount, safeIntegers, deterministic, directOnly);
|
|
9427
|
-
return this;
|
|
9428
|
-
};
|
|
9429
|
-
});
|
|
9430
|
-
|
|
9431
|
-
// node_modules/better-sqlite3/lib/methods/aggregate.js
|
|
9432
|
-
var require_aggregate2 = __commonJS((exports, module) => {
|
|
9433
|
-
var { getBooleanOption, cppdb } = require_util();
|
|
9434
|
-
module.exports = function defineAggregate(name, options) {
|
|
9435
|
-
if (typeof name !== "string")
|
|
9436
|
-
throw new TypeError("Expected first argument to be a string");
|
|
9437
|
-
if (typeof options !== "object" || options === null)
|
|
9438
|
-
throw new TypeError("Expected second argument to be an options object");
|
|
9439
|
-
if (!name)
|
|
9440
|
-
throw new TypeError("User-defined function name cannot be an empty string");
|
|
9441
|
-
const start = "start" in options ? options.start : null;
|
|
9442
|
-
const step = getFunctionOption(options, "step", true);
|
|
9443
|
-
const inverse = getFunctionOption(options, "inverse", false);
|
|
9444
|
-
const result = getFunctionOption(options, "result", false);
|
|
9445
|
-
const safeIntegers = "safeIntegers" in options ? +getBooleanOption(options, "safeIntegers") : 2;
|
|
9446
|
-
const deterministic = getBooleanOption(options, "deterministic");
|
|
9447
|
-
const directOnly = getBooleanOption(options, "directOnly");
|
|
9448
|
-
const varargs = getBooleanOption(options, "varargs");
|
|
9449
|
-
let argCount = -1;
|
|
9450
|
-
if (!varargs) {
|
|
9451
|
-
argCount = Math.max(getLength(step), inverse ? getLength(inverse) : 0);
|
|
9452
|
-
if (argCount > 0)
|
|
9453
|
-
argCount -= 1;
|
|
9454
|
-
if (argCount > 100)
|
|
9455
|
-
throw new RangeError("User-defined functions cannot have more than 100 arguments");
|
|
9456
|
-
}
|
|
9457
|
-
this[cppdb].aggregate(start, step, inverse, result, name, argCount, safeIntegers, deterministic, directOnly);
|
|
9458
|
-
return this;
|
|
9459
|
-
};
|
|
9460
|
-
var getFunctionOption = (options, key, required) => {
|
|
9461
|
-
const value = key in options ? options[key] : null;
|
|
9462
|
-
if (typeof value === "function")
|
|
9463
|
-
return value;
|
|
9464
|
-
if (value != null)
|
|
9465
|
-
throw new TypeError(`Expected the "${key}" option to be a function`);
|
|
9466
|
-
if (required)
|
|
9467
|
-
throw new TypeError(`Missing required option "${key}"`);
|
|
9468
|
-
return null;
|
|
9469
|
-
};
|
|
9470
|
-
var getLength = ({ length }) => {
|
|
9471
|
-
if (Number.isInteger(length) && length >= 0)
|
|
9472
|
-
return length;
|
|
9473
|
-
throw new TypeError("Expected function.length to be a positive integer");
|
|
9474
|
-
};
|
|
9475
|
-
});
|
|
9476
|
-
|
|
9477
|
-
// node_modules/better-sqlite3/lib/methods/table.js
|
|
9478
|
-
var require_table4 = __commonJS((exports, module) => {
|
|
9479
|
-
var { cppdb } = require_util();
|
|
9480
|
-
module.exports = function defineTable(name, factory) {
|
|
9481
|
-
if (typeof name !== "string")
|
|
9482
|
-
throw new TypeError("Expected first argument to be a string");
|
|
9483
|
-
if (!name)
|
|
9484
|
-
throw new TypeError("Virtual table module name cannot be an empty string");
|
|
9485
|
-
let eponymous = false;
|
|
9486
|
-
if (typeof factory === "object" && factory !== null) {
|
|
9487
|
-
eponymous = true;
|
|
9488
|
-
factory = defer(parseTableDefinition(factory, "used", name));
|
|
9489
|
-
} else {
|
|
9490
|
-
if (typeof factory !== "function")
|
|
9491
|
-
throw new TypeError("Expected second argument to be a function or a table definition object");
|
|
9492
|
-
factory = wrapFactory(factory);
|
|
9493
|
-
}
|
|
9494
|
-
this[cppdb].table(factory, name, eponymous);
|
|
9495
|
-
return this;
|
|
9496
|
-
};
|
|
9497
|
-
function wrapFactory(factory) {
|
|
9498
|
-
return function virtualTableFactory(moduleName, databaseName, tableName, ...args) {
|
|
9499
|
-
const thisObject = {
|
|
9500
|
-
module: moduleName,
|
|
9501
|
-
database: databaseName,
|
|
9502
|
-
table: tableName
|
|
9503
|
-
};
|
|
9504
|
-
const def = apply.call(factory, thisObject, args);
|
|
9505
|
-
if (typeof def !== "object" || def === null) {
|
|
9506
|
-
throw new TypeError(`Virtual table module "${moduleName}" did not return a table definition object`);
|
|
9507
|
-
}
|
|
9508
|
-
return parseTableDefinition(def, "returned", moduleName);
|
|
9509
|
-
};
|
|
9510
|
-
}
|
|
9511
|
-
function parseTableDefinition(def, verb, moduleName) {
|
|
9512
|
-
if (!hasOwnProperty.call(def, "rows")) {
|
|
9513
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition without a "rows" property`);
|
|
9514
|
-
}
|
|
9515
|
-
if (!hasOwnProperty.call(def, "columns")) {
|
|
9516
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition without a "columns" property`);
|
|
9517
|
-
}
|
|
9518
|
-
const rows = def.rows;
|
|
9519
|
-
if (typeof rows !== "function" || Object.getPrototypeOf(rows) !== GeneratorFunctionPrototype) {
|
|
9520
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "rows" property (should be a generator function)`);
|
|
9521
|
-
}
|
|
9522
|
-
let columns = def.columns;
|
|
9523
|
-
if (!Array.isArray(columns) || !(columns = [...columns]).every((x) => typeof x === "string")) {
|
|
9524
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "columns" property (should be an array of strings)`);
|
|
9525
|
-
}
|
|
9526
|
-
if (columns.length !== new Set(columns).size) {
|
|
9527
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with duplicate column names`);
|
|
9528
|
-
}
|
|
9529
|
-
if (!columns.length) {
|
|
9530
|
-
throw new RangeError(`Virtual table module "${moduleName}" ${verb} a table definition with zero columns`);
|
|
9531
|
-
}
|
|
9532
|
-
let parameters;
|
|
9533
|
-
if (hasOwnProperty.call(def, "parameters")) {
|
|
9534
|
-
parameters = def.parameters;
|
|
9535
|
-
if (!Array.isArray(parameters) || !(parameters = [...parameters]).every((x) => typeof x === "string")) {
|
|
9536
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "parameters" property (should be an array of strings)`);
|
|
9537
|
-
}
|
|
9538
|
-
} else {
|
|
9539
|
-
parameters = inferParameters(rows);
|
|
9540
|
-
}
|
|
9541
|
-
if (parameters.length !== new Set(parameters).size) {
|
|
9542
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with duplicate parameter names`);
|
|
9543
|
-
}
|
|
9544
|
-
if (parameters.length > 32) {
|
|
9545
|
-
throw new RangeError(`Virtual table module "${moduleName}" ${verb} a table definition with more than the maximum number of 32 parameters`);
|
|
9546
|
-
}
|
|
9547
|
-
for (const parameter of parameters) {
|
|
9548
|
-
if (columns.includes(parameter)) {
|
|
9549
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with column "${parameter}" which was ambiguously defined as both a column and parameter`);
|
|
9550
|
-
}
|
|
9551
|
-
}
|
|
9552
|
-
let safeIntegers = 2;
|
|
9553
|
-
if (hasOwnProperty.call(def, "safeIntegers")) {
|
|
9554
|
-
const bool = def.safeIntegers;
|
|
9555
|
-
if (typeof bool !== "boolean") {
|
|
9556
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "safeIntegers" property (should be a boolean)`);
|
|
9557
|
-
}
|
|
9558
|
-
safeIntegers = +bool;
|
|
9559
|
-
}
|
|
9560
|
-
let directOnly = false;
|
|
9561
|
-
if (hasOwnProperty.call(def, "directOnly")) {
|
|
9562
|
-
directOnly = def.directOnly;
|
|
9563
|
-
if (typeof directOnly !== "boolean") {
|
|
9564
|
-
throw new TypeError(`Virtual table module "${moduleName}" ${verb} a table definition with an invalid "directOnly" property (should be a boolean)`);
|
|
9565
|
-
}
|
|
9566
|
-
}
|
|
9567
|
-
const columnDefinitions = [
|
|
9568
|
-
...parameters.map(identifier).map((str) => `${str} HIDDEN`),
|
|
9569
|
-
...columns.map(identifier)
|
|
9570
|
-
];
|
|
9571
|
-
return [
|
|
9572
|
-
`CREATE TABLE x(${columnDefinitions.join(", ")});`,
|
|
9573
|
-
wrapGenerator(rows, new Map(columns.map((x, i) => [x, parameters.length + i])), moduleName),
|
|
9574
|
-
parameters,
|
|
9575
|
-
safeIntegers,
|
|
9576
|
-
directOnly
|
|
9577
|
-
];
|
|
9578
|
-
}
|
|
9579
|
-
function wrapGenerator(generator, columnMap, moduleName) {
|
|
9580
|
-
return function* virtualTable(...args) {
|
|
9581
|
-
const output = args.map((x) => Buffer.isBuffer(x) ? Buffer.from(x) : x);
|
|
9582
|
-
for (let i = 0;i < columnMap.size; ++i) {
|
|
9583
|
-
output.push(null);
|
|
9584
|
-
}
|
|
9585
|
-
for (const row of generator(...args)) {
|
|
9586
|
-
if (Array.isArray(row)) {
|
|
9587
|
-
extractRowArray(row, output, columnMap.size, moduleName);
|
|
9588
|
-
yield output;
|
|
9589
|
-
} else if (typeof row === "object" && row !== null) {
|
|
9590
|
-
extractRowObject(row, output, columnMap, moduleName);
|
|
9591
|
-
yield output;
|
|
9592
|
-
} else {
|
|
9593
|
-
throw new TypeError(`Virtual table module "${moduleName}" yielded something that isn't a valid row object`);
|
|
9594
|
-
}
|
|
9595
|
-
}
|
|
9596
|
-
};
|
|
9597
|
-
}
|
|
9598
|
-
function extractRowArray(row, output, columnCount, moduleName) {
|
|
9599
|
-
if (row.length !== columnCount) {
|
|
9600
|
-
throw new TypeError(`Virtual table module "${moduleName}" yielded a row with an incorrect number of columns`);
|
|
9601
|
-
}
|
|
9602
|
-
const offset = output.length - columnCount;
|
|
9603
|
-
for (let i = 0;i < columnCount; ++i) {
|
|
9604
|
-
output[i + offset] = row[i];
|
|
9605
|
-
}
|
|
9606
|
-
}
|
|
9607
|
-
function extractRowObject(row, output, columnMap, moduleName) {
|
|
9608
|
-
let count = 0;
|
|
9609
|
-
for (const key of Object.keys(row)) {
|
|
9610
|
-
const index2 = columnMap.get(key);
|
|
9611
|
-
if (index2 === undefined) {
|
|
9612
|
-
throw new TypeError(`Virtual table module "${moduleName}" yielded a row with an undeclared column "${key}"`);
|
|
9613
|
-
}
|
|
9614
|
-
output[index2] = row[key];
|
|
9615
|
-
count += 1;
|
|
9616
|
-
}
|
|
9617
|
-
if (count !== columnMap.size) {
|
|
9618
|
-
throw new TypeError(`Virtual table module "${moduleName}" yielded a row with missing columns`);
|
|
9619
|
-
}
|
|
9620
|
-
}
|
|
9621
|
-
function inferParameters({ length }) {
|
|
9622
|
-
if (!Number.isInteger(length) || length < 0) {
|
|
9623
|
-
throw new TypeError("Expected function.length to be a positive integer");
|
|
9624
|
-
}
|
|
9625
|
-
const params = [];
|
|
9626
|
-
for (let i = 0;i < length; ++i) {
|
|
9627
|
-
params.push(`$${i + 1}`);
|
|
9628
|
-
}
|
|
9629
|
-
return params;
|
|
9630
|
-
}
|
|
9631
|
-
var { hasOwnProperty } = Object.prototype;
|
|
9632
|
-
var { apply } = Function.prototype;
|
|
9633
|
-
var GeneratorFunctionPrototype = Object.getPrototypeOf(function* () {});
|
|
9634
|
-
var identifier = (str) => `"${str.replace(/"/g, '""')}"`;
|
|
9635
|
-
var defer = (x) => () => x;
|
|
9636
|
-
});
|
|
9637
|
-
|
|
9638
|
-
// node_modules/better-sqlite3/lib/methods/inspect.js
|
|
9639
|
-
var require_inspect = __commonJS((exports, module) => {
|
|
9640
|
-
var DatabaseInspection = function Database() {};
|
|
9641
|
-
module.exports = function inspect(depth, opts) {
|
|
9642
|
-
return Object.assign(new DatabaseInspection, this);
|
|
9643
|
-
};
|
|
9644
|
-
});
|
|
9645
|
-
|
|
9646
|
-
// node_modules/better-sqlite3/lib/database.js
|
|
9647
|
-
var require_database = __commonJS((exports, module) => {
|
|
9648
|
-
var fs = __require("fs");
|
|
9649
|
-
var path = __require("path");
|
|
9650
|
-
var util = require_util();
|
|
9651
|
-
var SqliteError = require_sqlite_error();
|
|
9652
|
-
var DEFAULT_ADDON;
|
|
9653
|
-
function Database(filenameGiven, options) {
|
|
9654
|
-
if (new.target == null) {
|
|
9655
|
-
return new Database(filenameGiven, options);
|
|
9656
|
-
}
|
|
9657
|
-
let buffer;
|
|
9658
|
-
if (Buffer.isBuffer(filenameGiven)) {
|
|
9659
|
-
buffer = filenameGiven;
|
|
9660
|
-
filenameGiven = ":memory:";
|
|
9661
|
-
}
|
|
9662
|
-
if (filenameGiven == null)
|
|
9663
|
-
filenameGiven = "";
|
|
9664
|
-
if (options == null)
|
|
9665
|
-
options = {};
|
|
9666
|
-
if (typeof filenameGiven !== "string")
|
|
9667
|
-
throw new TypeError("Expected first argument to be a string");
|
|
9668
|
-
if (typeof options !== "object")
|
|
9669
|
-
throw new TypeError("Expected second argument to be an options object");
|
|
9670
|
-
if ("readOnly" in options)
|
|
9671
|
-
throw new TypeError('Misspelled option "readOnly" should be "readonly"');
|
|
9672
|
-
if ("memory" in options)
|
|
9673
|
-
throw new TypeError('Option "memory" was removed in v7.0.0 (use ":memory:" filename instead)');
|
|
9674
|
-
const filename = filenameGiven.trim();
|
|
9675
|
-
const anonymous = filename === "" || filename === ":memory:";
|
|
9676
|
-
const readonly = util.getBooleanOption(options, "readonly");
|
|
9677
|
-
const fileMustExist = util.getBooleanOption(options, "fileMustExist");
|
|
9678
|
-
const timeout = "timeout" in options ? options.timeout : 5000;
|
|
9679
|
-
const verbose = "verbose" in options ? options.verbose : null;
|
|
9680
|
-
const nativeBinding = "nativeBinding" in options ? options.nativeBinding : null;
|
|
9681
|
-
if (readonly && anonymous && !buffer)
|
|
9682
|
-
throw new TypeError("In-memory/temporary databases cannot be readonly");
|
|
9683
|
-
if (!Number.isInteger(timeout) || timeout < 0)
|
|
9684
|
-
throw new TypeError('Expected the "timeout" option to be a positive integer');
|
|
9685
|
-
if (timeout > 2147483647)
|
|
9686
|
-
throw new RangeError('Option "timeout" cannot be greater than 2147483647');
|
|
9687
|
-
if (verbose != null && typeof verbose !== "function")
|
|
9688
|
-
throw new TypeError('Expected the "verbose" option to be a function');
|
|
9689
|
-
if (nativeBinding != null && typeof nativeBinding !== "string" && typeof nativeBinding !== "object")
|
|
9690
|
-
throw new TypeError('Expected the "nativeBinding" option to be a string or addon object');
|
|
9691
|
-
let addon;
|
|
9692
|
-
if (nativeBinding == null) {
|
|
9693
|
-
addon = DEFAULT_ADDON || (DEFAULT_ADDON = require_bindings()("better_sqlite3.node"));
|
|
9694
|
-
} else if (typeof nativeBinding === "string") {
|
|
9695
|
-
const requireFunc = typeof __non_webpack_require__ === "function" ? __non_webpack_require__ : __require;
|
|
9696
|
-
addon = requireFunc(path.resolve(nativeBinding).replace(/(\.node)?$/, ".node"));
|
|
9697
|
-
} else {
|
|
9698
|
-
addon = nativeBinding;
|
|
9699
|
-
}
|
|
9700
|
-
if (!addon.isInitialized) {
|
|
9701
|
-
addon.setErrorConstructor(SqliteError);
|
|
9702
|
-
addon.isInitialized = true;
|
|
9703
|
-
}
|
|
9704
|
-
if (!anonymous && !filename.startsWith("file:") && !fs.existsSync(path.dirname(filename))) {
|
|
9705
|
-
throw new TypeError("Cannot open database because the directory does not exist");
|
|
9706
|
-
}
|
|
9707
|
-
Object.defineProperties(this, {
|
|
9708
|
-
[util.cppdb]: { value: new addon.Database(filename, filenameGiven, anonymous, readonly, fileMustExist, timeout, verbose || null, buffer || null) },
|
|
9709
|
-
...wrappers.getters
|
|
9710
|
-
});
|
|
9711
|
-
}
|
|
9712
|
-
var wrappers = require_wrappers();
|
|
9713
|
-
Database.prototype.prepare = wrappers.prepare;
|
|
9714
|
-
Database.prototype.transaction = require_transaction();
|
|
9715
|
-
Database.prototype.pragma = require_pragma();
|
|
9716
|
-
Database.prototype.backup = require_backup();
|
|
9717
|
-
Database.prototype.serialize = require_serialize();
|
|
9718
|
-
Database.prototype.function = require_function();
|
|
9719
|
-
Database.prototype.aggregate = require_aggregate2();
|
|
9720
|
-
Database.prototype.table = require_table4();
|
|
9721
|
-
Database.prototype.loadExtension = wrappers.loadExtension;
|
|
9722
|
-
Database.prototype.exec = wrappers.exec;
|
|
9723
|
-
Database.prototype.close = wrappers.close;
|
|
9724
|
-
Database.prototype.defaultSafeIntegers = wrappers.defaultSafeIntegers;
|
|
9725
|
-
Database.prototype.unsafeMode = wrappers.unsafeMode;
|
|
9726
|
-
Database.prototype[util.inspect] = require_inspect();
|
|
9727
|
-
module.exports = Database;
|
|
9728
|
-
});
|
|
9729
|
-
|
|
9730
|
-
// node_modules/better-sqlite3/lib/index.js
|
|
9731
|
-
var require_lib = __commonJS((exports, module) => {
|
|
9732
|
-
module.exports = require_database();
|
|
9733
|
-
module.exports.SqliteError = require_sqlite_error();
|
|
9734
|
-
});
|
|
9735
|
-
|
|
9736
|
-
// node_modules/drizzle-orm/better-sqlite3/session.cjs
|
|
9737
|
-
var require_session3 = __commonJS((exports, module) => {
|
|
9738
|
-
var __defProp2 = Object.defineProperty;
|
|
9739
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9740
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
9741
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
9742
|
-
var __export2 = (target, all) => {
|
|
9743
|
-
for (var name in all)
|
|
9744
|
-
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
9745
|
-
};
|
|
9746
|
-
var __copyProps = (to, from, except, desc2) => {
|
|
9747
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
9748
|
-
for (let key of __getOwnPropNames2(from))
|
|
9749
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
9750
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc2 = __getOwnPropDesc(from, key)) || desc2.enumerable });
|
|
9751
|
-
}
|
|
9752
|
-
return to;
|
|
9753
|
-
};
|
|
9754
|
-
var __toCommonJS = (mod) => __copyProps(__defProp2({}, "__esModule", { value: true }), mod);
|
|
9755
|
-
var session_exports = {};
|
|
9756
|
-
__export2(session_exports, {
|
|
9757
|
-
BetterSQLiteSession: () => BetterSQLiteSession,
|
|
9758
|
-
BetterSQLiteTransaction: () => BetterSQLiteTransaction,
|
|
9759
|
-
PreparedQuery: () => PreparedQuery
|
|
9760
|
-
});
|
|
9761
|
-
module.exports = __toCommonJS(session_exports);
|
|
9762
|
-
var import_entity19 = require_entity();
|
|
9763
|
-
var import_logger = require_logger();
|
|
9764
|
-
var import_sql4 = require_sql();
|
|
9765
|
-
var import_sqlite_core2 = require_sqlite_core();
|
|
9766
|
-
var import_session = require_session();
|
|
9767
|
-
var import_utils5 = require_utils();
|
|
9768
|
-
|
|
9769
|
-
class BetterSQLiteSession extends import_session.SQLiteSession {
|
|
9770
|
-
constructor(client, dialect, schema, options = {}) {
|
|
9771
|
-
super(dialect);
|
|
9772
|
-
this.client = client;
|
|
9773
|
-
this.schema = schema;
|
|
9774
|
-
this.logger = options.logger ?? new import_logger.NoopLogger;
|
|
9775
|
-
}
|
|
9776
|
-
static [import_entity19.entityKind] = "BetterSQLiteSession";
|
|
9777
|
-
logger;
|
|
9778
|
-
prepareQuery(query, fields, executeMethod, isResponseInArrayMode, customResultMapper) {
|
|
9779
|
-
const stmt = this.client.prepare(query.sql);
|
|
9780
|
-
return new PreparedQuery(stmt, query, this.logger, fields, executeMethod, isResponseInArrayMode, customResultMapper);
|
|
9781
|
-
}
|
|
9782
|
-
transaction(transaction, config = {}) {
|
|
9783
|
-
const tx = new BetterSQLiteTransaction("sync", this.dialect, this, this.schema);
|
|
9784
|
-
const nativeTx = this.client.transaction(transaction);
|
|
9785
|
-
return nativeTx[config.behavior ?? "deferred"](tx);
|
|
9786
|
-
}
|
|
9787
|
-
}
|
|
9788
|
-
|
|
9789
|
-
class BetterSQLiteTransaction extends import_sqlite_core2.SQLiteTransaction {
|
|
9790
|
-
static [import_entity19.entityKind] = "BetterSQLiteTransaction";
|
|
9791
|
-
transaction(transaction) {
|
|
9792
|
-
const savepointName = `sp${this.nestedIndex}`;
|
|
9793
|
-
const tx = new BetterSQLiteTransaction("sync", this.dialect, this.session, this.schema, this.nestedIndex + 1);
|
|
9794
|
-
this.session.run(import_sql4.sql.raw(`savepoint ${savepointName}`));
|
|
9795
|
-
try {
|
|
9796
|
-
const result = transaction(tx);
|
|
9797
|
-
this.session.run(import_sql4.sql.raw(`release savepoint ${savepointName}`));
|
|
9798
|
-
return result;
|
|
9799
|
-
} catch (err) {
|
|
9800
|
-
this.session.run(import_sql4.sql.raw(`rollback to savepoint ${savepointName}`));
|
|
9801
|
-
throw err;
|
|
9802
|
-
}
|
|
9803
|
-
}
|
|
9804
|
-
}
|
|
9805
|
-
|
|
9806
|
-
class PreparedQuery extends import_session.SQLitePreparedQuery {
|
|
9807
|
-
constructor(stmt, query, logger, fields, executeMethod, _isResponseInArrayMode, customResultMapper) {
|
|
9808
|
-
super("sync", executeMethod, query);
|
|
9809
|
-
this.stmt = stmt;
|
|
9810
|
-
this.logger = logger;
|
|
9811
|
-
this.fields = fields;
|
|
9812
|
-
this._isResponseInArrayMode = _isResponseInArrayMode;
|
|
9813
|
-
this.customResultMapper = customResultMapper;
|
|
9814
|
-
}
|
|
9815
|
-
static [import_entity19.entityKind] = "BetterSQLitePreparedQuery";
|
|
9816
|
-
run(placeholderValues) {
|
|
9817
|
-
const params = (0, import_sql4.fillPlaceholders)(this.query.params, placeholderValues ?? {});
|
|
9818
|
-
this.logger.logQuery(this.query.sql, params);
|
|
9819
|
-
return this.stmt.run(...params);
|
|
9820
|
-
}
|
|
9821
|
-
all(placeholderValues) {
|
|
9822
|
-
const { fields, joinsNotNullableMap, query, logger, stmt, customResultMapper } = this;
|
|
9823
|
-
if (!fields && !customResultMapper) {
|
|
9824
|
-
const params = (0, import_sql4.fillPlaceholders)(query.params, placeholderValues ?? {});
|
|
9825
|
-
logger.logQuery(query.sql, params);
|
|
9826
|
-
return stmt.all(...params);
|
|
9827
|
-
}
|
|
9828
|
-
const rows = this.values(placeholderValues);
|
|
9829
|
-
if (customResultMapper) {
|
|
9830
|
-
return customResultMapper(rows);
|
|
9831
|
-
}
|
|
9832
|
-
return rows.map((row) => (0, import_utils5.mapResultRow)(fields, row, joinsNotNullableMap));
|
|
9833
|
-
}
|
|
9834
|
-
get(placeholderValues) {
|
|
9835
|
-
const params = (0, import_sql4.fillPlaceholders)(this.query.params, placeholderValues ?? {});
|
|
9836
|
-
this.logger.logQuery(this.query.sql, params);
|
|
9837
|
-
const { fields, stmt, joinsNotNullableMap, customResultMapper } = this;
|
|
9838
|
-
if (!fields && !customResultMapper) {
|
|
9839
|
-
return stmt.get(...params);
|
|
9840
|
-
}
|
|
9841
|
-
const row = stmt.raw().get(...params);
|
|
9842
|
-
if (!row) {
|
|
9843
|
-
return;
|
|
9844
|
-
}
|
|
9845
|
-
if (customResultMapper) {
|
|
9846
|
-
return customResultMapper([row]);
|
|
9847
|
-
}
|
|
9848
|
-
return (0, import_utils5.mapResultRow)(fields, row, joinsNotNullableMap);
|
|
9849
|
-
}
|
|
9850
|
-
values(placeholderValues) {
|
|
9851
|
-
const params = (0, import_sql4.fillPlaceholders)(this.query.params, placeholderValues ?? {});
|
|
9852
|
-
this.logger.logQuery(this.query.sql, params);
|
|
9853
|
-
return this.stmt.raw().all(...params);
|
|
9854
|
-
}
|
|
9855
|
-
isResponseInArrayMode() {
|
|
9856
|
-
return this._isResponseInArrayMode;
|
|
9857
|
-
}
|
|
9858
|
-
}
|
|
9859
|
-
});
|
|
9860
|
-
|
|
9861
|
-
// node_modules/drizzle-orm/better-sqlite3/driver.cjs
|
|
9862
|
-
var require_driver2 = __commonJS((exports, module) => {
|
|
9863
|
-
var __create2 = Object.create;
|
|
9864
|
-
var __defProp2 = Object.defineProperty;
|
|
9865
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9866
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
9867
|
-
var __getProtoOf2 = Object.getPrototypeOf;
|
|
9868
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
9869
|
-
var __export2 = (target, all) => {
|
|
9870
|
-
for (var name in all)
|
|
9871
|
-
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
9872
|
-
};
|
|
9873
|
-
var __copyProps = (to, from, except, desc2) => {
|
|
9874
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
9875
|
-
for (let key of __getOwnPropNames2(from))
|
|
9876
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
9877
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc2 = __getOwnPropDesc(from, key)) || desc2.enumerable });
|
|
9878
|
-
}
|
|
9879
|
-
return to;
|
|
9880
|
-
};
|
|
9881
|
-
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
9882
|
-
var __toCommonJS = (mod) => __copyProps(__defProp2({}, "__esModule", { value: true }), mod);
|
|
9883
|
-
var driver_exports = {};
|
|
9884
|
-
__export2(driver_exports, {
|
|
9885
|
-
BetterSQLite3Database: () => BetterSQLite3Database,
|
|
9886
|
-
drizzle: () => drizzle
|
|
9887
|
-
});
|
|
9888
|
-
module.exports = __toCommonJS(driver_exports);
|
|
9889
|
-
var import_better_sqlite3 = __toESM2(require_lib(), 1);
|
|
9890
|
-
var import_entity19 = require_entity();
|
|
9891
|
-
var import_logger = require_logger();
|
|
9892
|
-
var import_relations = require_relations();
|
|
9893
|
-
var import_db = require_db();
|
|
9894
|
-
var import_dialect = require_dialect();
|
|
9895
|
-
var import_utils5 = require_utils();
|
|
9896
|
-
var import_session = require_session3();
|
|
9897
|
-
|
|
9898
|
-
class BetterSQLite3Database extends import_db.BaseSQLiteDatabase {
|
|
9899
|
-
static [import_entity19.entityKind] = "BetterSQLite3Database";
|
|
9900
|
-
}
|
|
9901
|
-
function construct(client, config = {}) {
|
|
9902
|
-
const dialect = new import_dialect.SQLiteSyncDialect({ casing: config.casing });
|
|
9903
|
-
let logger;
|
|
9904
|
-
if (config.logger === true) {
|
|
9905
|
-
logger = new import_logger.DefaultLogger;
|
|
9906
|
-
} else if (config.logger !== false) {
|
|
9907
|
-
logger = config.logger;
|
|
9908
|
-
}
|
|
9909
|
-
let schema;
|
|
9910
|
-
if (config.schema) {
|
|
9911
|
-
const tablesConfig = (0, import_relations.extractTablesRelationalConfig)(config.schema, import_relations.createTableRelationsHelpers);
|
|
9912
|
-
schema = {
|
|
9913
|
-
fullSchema: config.schema,
|
|
9914
|
-
schema: tablesConfig.tables,
|
|
9915
|
-
tableNamesMap: tablesConfig.tableNamesMap
|
|
9916
|
-
};
|
|
9917
|
-
}
|
|
9918
|
-
const session = new import_session.BetterSQLiteSession(client, dialect, schema, { logger });
|
|
9919
|
-
const db = new BetterSQLite3Database("sync", dialect, session, schema);
|
|
9920
|
-
db.$client = client;
|
|
9921
|
-
return db;
|
|
9922
|
-
}
|
|
9923
|
-
function drizzle(...params) {
|
|
9924
|
-
if (params[0] === undefined || typeof params[0] === "string") {
|
|
9925
|
-
const instance = params[0] === undefined ? new import_better_sqlite3.default : new import_better_sqlite3.default(params[0]);
|
|
9926
|
-
return construct(instance, params[1]);
|
|
9927
|
-
}
|
|
9928
|
-
if ((0, import_utils5.isConfig)(params[0])) {
|
|
9929
|
-
const { connection, client, ...drizzleConfig } = params[0];
|
|
9930
|
-
if (client)
|
|
9931
|
-
return construct(client, drizzleConfig);
|
|
9932
|
-
if (typeof connection === "object") {
|
|
9933
|
-
const { source, ...options } = connection;
|
|
9934
|
-
const instance2 = new import_better_sqlite3.default(source, options);
|
|
9935
|
-
return construct(instance2, drizzleConfig);
|
|
9936
|
-
}
|
|
9937
|
-
const instance = new import_better_sqlite3.default(connection);
|
|
9938
|
-
return construct(instance, drizzleConfig);
|
|
9939
|
-
}
|
|
9940
|
-
return construct(params[0], params[1]);
|
|
9941
|
-
}
|
|
9942
|
-
((drizzle2) => {
|
|
9943
|
-
function mock(config) {
|
|
9944
|
-
return construct({}, config);
|
|
9945
|
-
}
|
|
9946
|
-
drizzle2.mock = mock;
|
|
9947
|
-
})(drizzle || (drizzle = {}));
|
|
9948
|
-
});
|
|
9949
|
-
|
|
9950
|
-
// node_modules/drizzle-orm/better-sqlite3/index.cjs
|
|
9951
|
-
var require_better_sqlite3 = __commonJS((exports, module) => {
|
|
9952
|
-
var __defProp2 = Object.defineProperty;
|
|
9953
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9954
|
-
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
9955
|
-
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
9956
|
-
var __copyProps = (to, from, except, desc2) => {
|
|
9957
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
9958
|
-
for (let key of __getOwnPropNames2(from))
|
|
9959
|
-
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
9960
|
-
__defProp2(to, key, { get: () => from[key], enumerable: !(desc2 = __getOwnPropDesc(from, key)) || desc2.enumerable });
|
|
9961
|
-
}
|
|
9962
|
-
return to;
|
|
9963
|
-
};
|
|
9964
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
9965
|
-
var __toCommonJS = (mod) => __copyProps(__defProp2({}, "__esModule", { value: true }), mod);
|
|
9966
|
-
var better_sqlite3_exports = {};
|
|
9967
|
-
module.exports = __toCommonJS(better_sqlite3_exports);
|
|
9968
|
-
__reExport(better_sqlite3_exports, require_driver2(), module.exports);
|
|
9969
|
-
__reExport(better_sqlite3_exports, require_session3(), module.exports);
|
|
9970
|
-
});
|
|
9971
|
-
|
|
9972
8971
|
// node_modules/secure-json-parse/index.js
|
|
9973
8972
|
var require_secure_json_parse = __commonJS((exports, module) => {
|
|
9974
8973
|
var hasBuffer = typeof Buffer !== "undefined";
|
|
@@ -12482,7 +11481,7 @@ var require_codegen = __commonJS((exports) => {
|
|
|
12482
11481
|
});
|
|
12483
11482
|
|
|
12484
11483
|
// node_modules/ajv/dist/compile/util.js
|
|
12485
|
-
var
|
|
11484
|
+
var require_util = __commonJS((exports) => {
|
|
12486
11485
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12487
11486
|
exports.checkStrictMode = exports.getErrorPath = exports.Type = exports.useFunc = exports.setEvaluated = exports.evaluatedPropsToName = exports.mergeEvaluated = exports.eachItem = exports.unescapeJsonPointer = exports.escapeJsonPointer = exports.escapeFragment = exports.unescapeFragment = exports.schemaRefOrVal = exports.schemaHasRulesButRef = exports.schemaHasRules = exports.checkUnknownRules = exports.alwaysValidSchema = exports.toHash = undefined;
|
|
12488
11487
|
var codegen_1 = require_codegen();
|
|
@@ -12675,7 +11674,7 @@ var require_errors2 = __commonJS((exports) => {
|
|
|
12675
11674
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12676
11675
|
exports.extendErrors = exports.resetErrorsCount = exports.reportExtraError = exports.reportError = exports.keyword$DataError = exports.keywordError = undefined;
|
|
12677
11676
|
var codegen_1 = require_codegen();
|
|
12678
|
-
var util_1 =
|
|
11677
|
+
var util_1 = require_util();
|
|
12679
11678
|
var names_1 = require_names();
|
|
12680
11679
|
exports.keywordError = {
|
|
12681
11680
|
message: ({ keyword }) => (0, codegen_1.str)`must pass "${keyword}" keyword validation`
|
|
@@ -12892,7 +11891,7 @@ var require_dataType = __commonJS((exports) => {
|
|
|
12892
11891
|
var applicability_1 = require_applicability();
|
|
12893
11892
|
var errors_1 = require_errors2();
|
|
12894
11893
|
var codegen_1 = require_codegen();
|
|
12895
|
-
var util_1 =
|
|
11894
|
+
var util_1 = require_util();
|
|
12896
11895
|
var DataType;
|
|
12897
11896
|
(function(DataType2) {
|
|
12898
11897
|
DataType2[DataType2["Correct"] = 0] = "Correct";
|
|
@@ -13070,7 +12069,7 @@ var require_defaults = __commonJS((exports) => {
|
|
|
13070
12069
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13071
12070
|
exports.assignDefaults = undefined;
|
|
13072
12071
|
var codegen_1 = require_codegen();
|
|
13073
|
-
var util_1 =
|
|
12072
|
+
var util_1 = require_util();
|
|
13074
12073
|
function assignDefaults(it, ty) {
|
|
13075
12074
|
const { properties, items } = it.schema;
|
|
13076
12075
|
if (ty === "object" && properties) {
|
|
@@ -13104,9 +12103,9 @@ var require_code2 = __commonJS((exports) => {
|
|
|
13104
12103
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13105
12104
|
exports.validateUnion = exports.validateArray = exports.usePattern = exports.callValidateCode = exports.schemaProperties = exports.allSchemaProperties = exports.noPropertyInData = exports.propertyInData = exports.isOwnProperty = exports.hasPropFunc = exports.reportMissingProp = exports.checkMissingProp = exports.checkReportMissingProp = undefined;
|
|
13106
12105
|
var codegen_1 = require_codegen();
|
|
13107
|
-
var util_1 =
|
|
12106
|
+
var util_1 = require_util();
|
|
13108
12107
|
var names_1 = require_names();
|
|
13109
|
-
var util_2 =
|
|
12108
|
+
var util_2 = require_util();
|
|
13110
12109
|
function checkReportMissingProp(cxt, prop) {
|
|
13111
12110
|
const { gen, data, it } = cxt;
|
|
13112
12111
|
gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => {
|
|
@@ -13348,7 +12347,7 @@ var require_subschema = __commonJS((exports) => {
|
|
|
13348
12347
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13349
12348
|
exports.extendSubschemaMode = exports.extendSubschemaData = exports.getSubschema = undefined;
|
|
13350
12349
|
var codegen_1 = require_codegen();
|
|
13351
|
-
var util_1 =
|
|
12350
|
+
var util_1 = require_util();
|
|
13352
12351
|
function getSubschema(it, { keyword, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }) {
|
|
13353
12352
|
if (keyword !== undefined && schema !== undefined) {
|
|
13354
12353
|
throw new Error('both "keyword" and "schema" passed, only one allowed');
|
|
@@ -13552,7 +12551,7 @@ var require_json_schema_traverse = __commonJS((exports, module) => {
|
|
|
13552
12551
|
var require_resolve = __commonJS((exports) => {
|
|
13553
12552
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13554
12553
|
exports.getSchemaRefs = exports.resolveUrl = exports.normalizeId = exports._getFullPath = exports.getFullPath = exports.inlineRef = undefined;
|
|
13555
|
-
var util_1 =
|
|
12554
|
+
var util_1 = require_util();
|
|
13556
12555
|
var equal = require_fast_deep_equal();
|
|
13557
12556
|
var traverse = require_json_schema_traverse();
|
|
13558
12557
|
var SIMPLE_INLINED = new Set([
|
|
@@ -13715,7 +12714,7 @@ var require_validate = __commonJS((exports) => {
|
|
|
13715
12714
|
var codegen_1 = require_codegen();
|
|
13716
12715
|
var names_1 = require_names();
|
|
13717
12716
|
var resolve_1 = require_resolve();
|
|
13718
|
-
var util_1 =
|
|
12717
|
+
var util_1 = require_util();
|
|
13719
12718
|
var errors_1 = require_errors2();
|
|
13720
12719
|
function validateFunctionCode(it) {
|
|
13721
12720
|
if (isSchemaObj(it)) {
|
|
@@ -14243,7 +13242,7 @@ var require_compile = __commonJS((exports) => {
|
|
|
14243
13242
|
var validation_error_1 = require_validation_error();
|
|
14244
13243
|
var names_1 = require_names();
|
|
14245
13244
|
var resolve_1 = require_resolve();
|
|
14246
|
-
var util_1 =
|
|
13245
|
+
var util_1 = require_util();
|
|
14247
13246
|
var validate_1 = require_validate();
|
|
14248
13247
|
|
|
14249
13248
|
class SchemaEnv {
|
|
@@ -15195,7 +14194,7 @@ var require_core = __commonJS((exports) => {
|
|
|
15195
14194
|
var codegen_2 = require_codegen();
|
|
15196
14195
|
var resolve_1 = require_resolve();
|
|
15197
14196
|
var dataType_1 = require_dataType();
|
|
15198
|
-
var util_1 =
|
|
14197
|
+
var util_1 = require_util();
|
|
15199
14198
|
var $dataRefSchema = require_data();
|
|
15200
14199
|
var uri_1 = require_uri();
|
|
15201
14200
|
var defaultRegExp = (str, flags) => new RegExp(str, flags);
|
|
@@ -15775,7 +14774,7 @@ var require_ref = __commonJS((exports) => {
|
|
|
15775
14774
|
var codegen_1 = require_codegen();
|
|
15776
14775
|
var names_1 = require_names();
|
|
15777
14776
|
var compile_1 = require_compile();
|
|
15778
|
-
var util_1 =
|
|
14777
|
+
var util_1 = require_util();
|
|
15779
14778
|
var def = {
|
|
15780
14779
|
keyword: "$ref",
|
|
15781
14780
|
schemaType: "string",
|
|
@@ -15984,7 +14983,7 @@ var require_ucs2length = __commonJS((exports) => {
|
|
|
15984
14983
|
var require_limitLength = __commonJS((exports) => {
|
|
15985
14984
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15986
14985
|
var codegen_1 = require_codegen();
|
|
15987
|
-
var util_1 =
|
|
14986
|
+
var util_1 = require_util();
|
|
15988
14987
|
var ucs2length_1 = require_ucs2length();
|
|
15989
14988
|
var error2 = {
|
|
15990
14989
|
message({ keyword, schemaCode }) {
|
|
@@ -16065,7 +15064,7 @@ var require_required = __commonJS((exports) => {
|
|
|
16065
15064
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16066
15065
|
var code_1 = require_code2();
|
|
16067
15066
|
var codegen_1 = require_codegen();
|
|
16068
|
-
var util_1 =
|
|
15067
|
+
var util_1 = require_util();
|
|
16069
15068
|
var error2 = {
|
|
16070
15069
|
message: ({ params: { missingProperty } }) => (0, codegen_1.str)`must have required property '${missingProperty}'`,
|
|
16071
15070
|
params: ({ params: { missingProperty } }) => (0, codegen_1._)`{missingProperty: ${missingProperty}}`
|
|
@@ -16178,7 +15177,7 @@ var require_uniqueItems = __commonJS((exports) => {
|
|
|
16178
15177
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16179
15178
|
var dataType_1 = require_dataType();
|
|
16180
15179
|
var codegen_1 = require_codegen();
|
|
16181
|
-
var util_1 =
|
|
15180
|
+
var util_1 = require_util();
|
|
16182
15181
|
var equal_1 = require_equal();
|
|
16183
15182
|
var error2 = {
|
|
16184
15183
|
message: ({ params: { i, j } }) => (0, codegen_1.str)`must NOT have duplicate items (items ## ${j} and ${i} are identical)`,
|
|
@@ -16241,7 +15240,7 @@ var require_uniqueItems = __commonJS((exports) => {
|
|
|
16241
15240
|
var require_const = __commonJS((exports) => {
|
|
16242
15241
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16243
15242
|
var codegen_1 = require_codegen();
|
|
16244
|
-
var util_1 =
|
|
15243
|
+
var util_1 = require_util();
|
|
16245
15244
|
var equal_1 = require_equal();
|
|
16246
15245
|
var error2 = {
|
|
16247
15246
|
message: "must be equal to constant",
|
|
@@ -16267,7 +15266,7 @@ var require_const = __commonJS((exports) => {
|
|
|
16267
15266
|
var require_enum2 = __commonJS((exports) => {
|
|
16268
15267
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16269
15268
|
var codegen_1 = require_codegen();
|
|
16270
|
-
var util_1 =
|
|
15269
|
+
var util_1 = require_util();
|
|
16271
15270
|
var equal_1 = require_equal();
|
|
16272
15271
|
var error2 = {
|
|
16273
15272
|
message: "must be equal to one of the allowed values",
|
|
@@ -16344,7 +15343,7 @@ var require_additionalItems = __commonJS((exports) => {
|
|
|
16344
15343
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16345
15344
|
exports.validateAdditionalItems = undefined;
|
|
16346
15345
|
var codegen_1 = require_codegen();
|
|
16347
|
-
var util_1 =
|
|
15346
|
+
var util_1 = require_util();
|
|
16348
15347
|
var error2 = {
|
|
16349
15348
|
message: ({ params: { len } }) => (0, codegen_1.str)`must NOT have more than ${len} items`,
|
|
16350
15349
|
params: ({ params: { len } }) => (0, codegen_1._)`{limit: ${len}}`
|
|
@@ -16394,7 +15393,7 @@ var require_items = __commonJS((exports) => {
|
|
|
16394
15393
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16395
15394
|
exports.validateTuple = undefined;
|
|
16396
15395
|
var codegen_1 = require_codegen();
|
|
16397
|
-
var util_1 =
|
|
15396
|
+
var util_1 = require_util();
|
|
16398
15397
|
var code_1 = require_code2();
|
|
16399
15398
|
var def = {
|
|
16400
15399
|
keyword: "items",
|
|
@@ -16461,7 +15460,7 @@ var require_prefixItems = __commonJS((exports) => {
|
|
|
16461
15460
|
var require_items2020 = __commonJS((exports) => {
|
|
16462
15461
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16463
15462
|
var codegen_1 = require_codegen();
|
|
16464
|
-
var util_1 =
|
|
15463
|
+
var util_1 = require_util();
|
|
16465
15464
|
var code_1 = require_code2();
|
|
16466
15465
|
var additionalItems_1 = require_additionalItems();
|
|
16467
15466
|
var error2 = {
|
|
@@ -16493,7 +15492,7 @@ var require_items2020 = __commonJS((exports) => {
|
|
|
16493
15492
|
var require_contains = __commonJS((exports) => {
|
|
16494
15493
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16495
15494
|
var codegen_1 = require_codegen();
|
|
16496
|
-
var util_1 =
|
|
15495
|
+
var util_1 = require_util();
|
|
16497
15496
|
var error2 = {
|
|
16498
15497
|
message: ({ params: { min, max } }) => max === undefined ? (0, codegen_1.str)`must contain at least ${min} valid item(s)` : (0, codegen_1.str)`must contain at least ${min} and no more than ${max} valid item(s)`,
|
|
16499
15498
|
params: ({ params: { min, max } }) => max === undefined ? (0, codegen_1._)`{minContains: ${min}}` : (0, codegen_1._)`{minContains: ${min}, maxContains: ${max}}`
|
|
@@ -16585,7 +15584,7 @@ var require_dependencies = __commonJS((exports) => {
|
|
|
16585
15584
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16586
15585
|
exports.validateSchemaDeps = exports.validatePropertyDeps = exports.error = undefined;
|
|
16587
15586
|
var codegen_1 = require_codegen();
|
|
16588
|
-
var util_1 =
|
|
15587
|
+
var util_1 = require_util();
|
|
16589
15588
|
var code_1 = require_code2();
|
|
16590
15589
|
exports.error = {
|
|
16591
15590
|
message: ({ params: { property, depsCount, deps } }) => {
|
|
@@ -16669,7 +15668,7 @@ var require_dependencies = __commonJS((exports) => {
|
|
|
16669
15668
|
var require_propertyNames = __commonJS((exports) => {
|
|
16670
15669
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16671
15670
|
var codegen_1 = require_codegen();
|
|
16672
|
-
var util_1 =
|
|
15671
|
+
var util_1 = require_util();
|
|
16673
15672
|
var error2 = {
|
|
16674
15673
|
message: "property name must be valid",
|
|
16675
15674
|
params: ({ params }) => (0, codegen_1._)`{propertyName: ${params.propertyName}}`
|
|
@@ -16711,7 +15710,7 @@ var require_additionalProperties = __commonJS((exports) => {
|
|
|
16711
15710
|
var code_1 = require_code2();
|
|
16712
15711
|
var codegen_1 = require_codegen();
|
|
16713
15712
|
var names_1 = require_names();
|
|
16714
|
-
var util_1 =
|
|
15713
|
+
var util_1 = require_util();
|
|
16715
15714
|
var error2 = {
|
|
16716
15715
|
message: "must NOT have additional properties",
|
|
16717
15716
|
params: ({ params }) => (0, codegen_1._)`{additionalProperty: ${params.additionalProperty}}`
|
|
@@ -16813,7 +15812,7 @@ var require_properties = __commonJS((exports) => {
|
|
|
16813
15812
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16814
15813
|
var validate_1 = require_validate();
|
|
16815
15814
|
var code_1 = require_code2();
|
|
16816
|
-
var util_1 =
|
|
15815
|
+
var util_1 = require_util();
|
|
16817
15816
|
var additionalProperties_1 = require_additionalProperties();
|
|
16818
15817
|
var def = {
|
|
16819
15818
|
keyword: "properties",
|
|
@@ -16868,8 +15867,8 @@ var require_patternProperties = __commonJS((exports) => {
|
|
|
16868
15867
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16869
15868
|
var code_1 = require_code2();
|
|
16870
15869
|
var codegen_1 = require_codegen();
|
|
16871
|
-
var util_1 =
|
|
16872
|
-
var util_2 =
|
|
15870
|
+
var util_1 = require_util();
|
|
15871
|
+
var util_2 = require_util();
|
|
16873
15872
|
var def = {
|
|
16874
15873
|
keyword: "patternProperties",
|
|
16875
15874
|
type: "object",
|
|
@@ -16937,7 +15936,7 @@ var require_patternProperties = __commonJS((exports) => {
|
|
|
16937
15936
|
// node_modules/ajv/dist/vocabularies/applicator/not.js
|
|
16938
15937
|
var require_not = __commonJS((exports) => {
|
|
16939
15938
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16940
|
-
var util_1 =
|
|
15939
|
+
var util_1 = require_util();
|
|
16941
15940
|
var def = {
|
|
16942
15941
|
keyword: "not",
|
|
16943
15942
|
schemaType: ["object", "boolean"],
|
|
@@ -16980,7 +15979,7 @@ var require_anyOf = __commonJS((exports) => {
|
|
|
16980
15979
|
var require_oneOf = __commonJS((exports) => {
|
|
16981
15980
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16982
15981
|
var codegen_1 = require_codegen();
|
|
16983
|
-
var util_1 =
|
|
15982
|
+
var util_1 = require_util();
|
|
16984
15983
|
var error2 = {
|
|
16985
15984
|
message: "must match exactly one schema in oneOf",
|
|
16986
15985
|
params: ({ params }) => (0, codegen_1._)`{passingSchemas: ${params.passing}}`
|
|
@@ -17034,7 +16033,7 @@ var require_oneOf = __commonJS((exports) => {
|
|
|
17034
16033
|
// node_modules/ajv/dist/vocabularies/applicator/allOf.js
|
|
17035
16034
|
var require_allOf = __commonJS((exports) => {
|
|
17036
16035
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17037
|
-
var util_1 =
|
|
16036
|
+
var util_1 = require_util();
|
|
17038
16037
|
var def = {
|
|
17039
16038
|
keyword: "allOf",
|
|
17040
16039
|
schemaType: "array",
|
|
@@ -17059,7 +16058,7 @@ var require_allOf = __commonJS((exports) => {
|
|
|
17059
16058
|
var require_if = __commonJS((exports) => {
|
|
17060
16059
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17061
16060
|
var codegen_1 = require_codegen();
|
|
17062
|
-
var util_1 =
|
|
16061
|
+
var util_1 = require_util();
|
|
17063
16062
|
var error2 = {
|
|
17064
16063
|
message: ({ params }) => (0, codegen_1.str)`must match "${params.ifClause}" schema`,
|
|
17065
16064
|
params: ({ params }) => (0, codegen_1._)`{failingKeyword: ${params.ifClause}}`
|
|
@@ -17124,7 +16123,7 @@ var require_if = __commonJS((exports) => {
|
|
|
17124
16123
|
// node_modules/ajv/dist/vocabularies/applicator/thenElse.js
|
|
17125
16124
|
var require_thenElse = __commonJS((exports) => {
|
|
17126
16125
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17127
|
-
var util_1 =
|
|
16126
|
+
var util_1 = require_util();
|
|
17128
16127
|
var def = {
|
|
17129
16128
|
keyword: ["then", "else"],
|
|
17130
16129
|
schemaType: ["object", "boolean"],
|
|
@@ -17331,7 +16330,7 @@ var require_discriminator = __commonJS((exports) => {
|
|
|
17331
16330
|
var types_1 = require_types2();
|
|
17332
16331
|
var compile_1 = require_compile();
|
|
17333
16332
|
var ref_error_1 = require_ref_error();
|
|
17334
|
-
var util_1 =
|
|
16333
|
+
var util_1 = require_util();
|
|
17335
16334
|
var error2 = {
|
|
17336
16335
|
message: ({ params: { discrError, tagName } }) => discrError === types_1.DiscrError.Tag ? `tag "${tagName}" must be string` : `value of tag "${tagName}" must be in oneOf`,
|
|
17337
16336
|
params: ({ params: { discrError, tag, tagName } }) => (0, codegen_1._)`{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}`
|
|
@@ -17934,7 +16933,7 @@ var require_dist = __commonJS((exports, module) => {
|
|
|
17934
16933
|
exports.default = formatsPlugin;
|
|
17935
16934
|
});
|
|
17936
16935
|
|
|
17937
|
-
// node_modules/cross-spawn/node_modules/isexe/windows.js
|
|
16936
|
+
// node_modules/cross-spawn/node_modules/which/node_modules/isexe/windows.js
|
|
17938
16937
|
var require_windows = __commonJS((exports, module) => {
|
|
17939
16938
|
module.exports = isexe;
|
|
17940
16939
|
isexe.sync = sync;
|
|
@@ -17972,7 +16971,7 @@ var require_windows = __commonJS((exports, module) => {
|
|
|
17972
16971
|
}
|
|
17973
16972
|
});
|
|
17974
16973
|
|
|
17975
|
-
// node_modules/cross-spawn/node_modules/isexe/mode.js
|
|
16974
|
+
// node_modules/cross-spawn/node_modules/which/node_modules/isexe/mode.js
|
|
17976
16975
|
var require_mode = __commonJS((exports, module) => {
|
|
17977
16976
|
module.exports = isexe;
|
|
17978
16977
|
isexe.sync = sync;
|
|
@@ -18003,7 +17002,7 @@ var require_mode = __commonJS((exports, module) => {
|
|
|
18003
17002
|
}
|
|
18004
17003
|
});
|
|
18005
17004
|
|
|
18006
|
-
// node_modules/cross-spawn/node_modules/isexe/index.js
|
|
17005
|
+
// node_modules/cross-spawn/node_modules/which/node_modules/isexe/index.js
|
|
18007
17006
|
var require_isexe = __commonJS((exports, module) => {
|
|
18008
17007
|
var fs7 = __require("fs");
|
|
18009
17008
|
var core2;
|
|
@@ -19698,11 +18697,11 @@ var workers = sqliteTable("workers", {
|
|
|
19698
18697
|
|
|
19699
18698
|
// src/storage/db.ts
|
|
19700
18699
|
var isBun = typeof globalThis.Bun !== "undefined";
|
|
18700
|
+
if (!isBun) {
|
|
18701
|
+
throw new Error("Nuum requires Bun runtime. Install Bun: https://bun.sh");
|
|
18702
|
+
}
|
|
19701
18703
|
function createDb(dbPath) {
|
|
19702
|
-
|
|
19703
|
-
return createBunDb(dbPath);
|
|
19704
|
-
}
|
|
19705
|
-
return createNodeDb(dbPath);
|
|
18704
|
+
return createBunDb(dbPath);
|
|
19706
18705
|
}
|
|
19707
18706
|
function createBunDb(dbPath) {
|
|
19708
18707
|
const BunDatabase = __require("bun:sqlite").default;
|
|
@@ -19717,19 +18716,6 @@ function createBunDb(dbPath) {
|
|
|
19717
18716
|
db._rawDb = sqlite;
|
|
19718
18717
|
return db;
|
|
19719
18718
|
}
|
|
19720
|
-
function createNodeDb(dbPath) {
|
|
19721
|
-
const Database = require_lib();
|
|
19722
|
-
const { drizzle } = require_better_sqlite3();
|
|
19723
|
-
const sqlite = new Database(dbPath);
|
|
19724
|
-
if (dbPath !== ":memory:") {
|
|
19725
|
-
sqlite.exec("PRAGMA journal_mode=WAL");
|
|
19726
|
-
sqlite.exec("PRAGMA busy_timeout=5000");
|
|
19727
|
-
}
|
|
19728
|
-
sqlite.exec("PRAGMA foreign_keys=ON");
|
|
19729
|
-
const db = drizzle(sqlite, { schema: exports_schema });
|
|
19730
|
-
db._rawDb = sqlite;
|
|
19731
|
-
return db;
|
|
19732
|
-
}
|
|
19733
18719
|
|
|
19734
18720
|
// src/storage/migrate.ts
|
|
19735
18721
|
import { readdirSync, readFileSync } from "fs";
|
|
@@ -23898,8 +22884,25 @@ function runMigrations(db) {
|
|
|
23898
22884
|
if (result.applied.length > 0) {
|
|
23899
22885
|
log.info("migrations complete", { applied: result.applied.length });
|
|
23900
22886
|
}
|
|
22887
|
+
rebuildFTSIndexes(db);
|
|
23901
22888
|
return result;
|
|
23902
22889
|
}
|
|
22890
|
+
function rebuildFTSIndexes(db) {
|
|
22891
|
+
try {
|
|
22892
|
+
const tables = db.prepare?.("SELECT name FROM sqlite_master WHERE type='table' AND name LIKE '%_fts'")?.all?.() ?? db.query?.("SELECT name FROM sqlite_master WHERE type='table' AND name LIKE '%_fts'")?.all?.() ?? [];
|
|
22893
|
+
for (const table of tables) {
|
|
22894
|
+
const tableName = table.name;
|
|
22895
|
+
try {
|
|
22896
|
+
db.exec(`INSERT INTO ${tableName}(${tableName}) VALUES('rebuild')`);
|
|
22897
|
+
log.debug("rebuilt FTS index", { table: tableName });
|
|
22898
|
+
} catch (error) {
|
|
22899
|
+
log.debug("skipped FTS rebuild", { table: tableName, reason: String(error) });
|
|
22900
|
+
}
|
|
22901
|
+
}
|
|
22902
|
+
} catch (error) {
|
|
22903
|
+
log.debug("FTS rebuild skipped", { reason: String(error) });
|
|
22904
|
+
}
|
|
22905
|
+
}
|
|
23903
22906
|
|
|
23904
22907
|
// src/storage/temporal.ts
|
|
23905
22908
|
var log2 = Log.create({ service: "temporal-storage" });
|
|
@@ -34965,7 +33968,7 @@ function extractRealUrl(ddgUrl) {
|
|
|
34965
33968
|
return null;
|
|
34966
33969
|
}
|
|
34967
33970
|
function cleanHtml(html) {
|
|
34968
|
-
return html.replace(/<[^>]+>/g, "").replace(/ /g, " ").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/—/g, "
|
|
33971
|
+
return html.replace(/<[^>]+>/g, "").replace(/ /g, " ").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/—/g, "\u2014").replace(/–/g, "\u2013").replace(/…/g, "...").trim();
|
|
34969
33972
|
}
|
|
34970
33973
|
function parseSearchResults(html) {
|
|
34971
33974
|
const results = [];
|
|
@@ -35086,7 +34089,7 @@ function simplifyHtml(html) {
|
|
|
35086
34089
|
`);
|
|
35087
34090
|
content = content.replace(/<a[^>]*href="([^"]*)"[^>]*>([^<]*)<\/a>/gi, "[$2]($1)");
|
|
35088
34091
|
content = content.replace(/<[^>]+>/g, " ");
|
|
35089
|
-
content = content.replace(/ /g, " ").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/—/g, "
|
|
34092
|
+
content = content.replace(/ /g, " ").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/—/g, "\u2014").replace(/–/g, "\u2013").replace(/…/g, "...");
|
|
35090
34093
|
content = content.replace(/[ \t]+/g, " ");
|
|
35091
34094
|
content = content.replace(/\n\s*\n/g, `
|
|
35092
34095
|
|
|
@@ -35193,19 +34196,19 @@ QUESTION: ${question}`
|
|
|
35193
34196
|
// src/util/activity-log.ts
|
|
35194
34197
|
var ICONS = {
|
|
35195
34198
|
tool_call: "\uD83D\uDD27",
|
|
35196
|
-
tool_result: "
|
|
35197
|
-
tool_error: "
|
|
34199
|
+
tool_result: "\u2713",
|
|
34200
|
+
tool_error: "\u2717",
|
|
35198
34201
|
search: "\uD83D\uDD0D",
|
|
35199
34202
|
create: "\uD83D\uDCDD",
|
|
35200
34203
|
update: "\uD83D\uDCDD",
|
|
35201
|
-
delete: "\uD83D\uDDD1
|
|
35202
|
-
start: "
|
|
35203
|
-
complete: "
|
|
35204
|
-
skip: "
|
|
34204
|
+
delete: "\uD83D\uDDD1\uFE0F",
|
|
34205
|
+
start: "\u25B6",
|
|
34206
|
+
complete: "\u2713",
|
|
34207
|
+
skip: "\u2298",
|
|
35205
34208
|
thinking: "\uD83D\uDCAD",
|
|
35206
|
-
info: "
|
|
35207
|
-
warn: "
|
|
35208
|
-
error: "
|
|
34209
|
+
info: "\u2139",
|
|
34210
|
+
warn: "\u26A0",
|
|
34211
|
+
error: "\u2717"
|
|
35209
34212
|
};
|
|
35210
34213
|
function formatWorker(worker) {
|
|
35211
34214
|
return `[${worker}]`;
|
|
@@ -35268,7 +34271,7 @@ class ActivityLog {
|
|
|
35268
34271
|
}
|
|
35269
34272
|
searchResult(type, count, query) {
|
|
35270
34273
|
const queryStr = query ? ` "${truncate(query, 30)}"` : "";
|
|
35271
|
-
write(`${formatWorker(this.worker)} ${ICONS.search} ${type}${queryStr}
|
|
34274
|
+
write(`${formatWorker(this.worker)} ${ICONS.search} ${type}${queryStr} \u2192 ${count} results`);
|
|
35272
34275
|
}
|
|
35273
34276
|
ltmOperation(op, slug, detail) {
|
|
35274
34277
|
const icon = op === "archive" ? ICONS.delete : ICONS.update;
|
|
@@ -35300,7 +34303,7 @@ class ActivityLog {
|
|
|
35300
34303
|
tokens(before, after, detail) {
|
|
35301
34304
|
const reduction = Math.round((1 - after / before) * 100);
|
|
35302
34305
|
const detailStr = detail ? `, ${detail}` : "";
|
|
35303
|
-
write(`${formatWorker(this.worker)} ${ICONS.info} ${before.toLocaleString()}
|
|
34306
|
+
write(`${formatWorker(this.worker)} ${ICONS.info} ${before.toLocaleString()} \u2192 ${after.toLocaleString()} tokens (${reduction}% reduction${detailStr})`);
|
|
35304
34307
|
}
|
|
35305
34308
|
}
|
|
35306
34309
|
var activity = {
|
|
@@ -35450,7 +34453,7 @@ ${summary.narrative}`;
|
|
|
35450
34453
|
summaryContent += `
|
|
35451
34454
|
|
|
35452
34455
|
Retained facts:
|
|
35453
|
-
` + observations.map((o) =>
|
|
34456
|
+
` + observations.map((o) => `\u2022 ${o}`).join(`
|
|
35454
34457
|
`);
|
|
35455
34458
|
}
|
|
35456
34459
|
turns.push({
|
|
@@ -35868,17 +34871,17 @@ function buildCreateDistillationTool(ctx, results) {
|
|
|
35868
34871
|
};
|
|
35869
34872
|
await storage.temporal.createSummary(summaryInsert);
|
|
35870
34873
|
const wasAdjusted = adjustedStartId !== startId || adjustedEndId !== endId;
|
|
35871
|
-
const adjustmentNote = wasAdjusted ? ` (adjusted to ${adjustedStartId}
|
|
34874
|
+
const adjustmentNote = wasAdjusted ? ` (adjusted to ${adjustedStartId} \u2192 ${adjustedEndId} to preserve tool call pairs)` : "";
|
|
35872
34875
|
const currentTokens = await getEffectiveViewTokens(storage.temporal);
|
|
35873
34876
|
const atTarget = currentTokens <= targetTokens;
|
|
35874
34877
|
const tokenStatus = atTarget ? `
|
|
35875
34878
|
|
|
35876
|
-
**Status:** ${currentTokens.toLocaleString()} tokens (
|
|
34879
|
+
**Status:** ${currentTokens.toLocaleString()} tokens (\u2713 at/under target of ${targetTokens.toLocaleString()}). You may call finish_distillation or continue cleaning up.` : `
|
|
35877
34880
|
|
|
35878
34881
|
**Status:** ${currentTokens.toLocaleString()} tokens (target: ${targetTokens.toLocaleString()}, need to distill ~${(currentTokens - targetTokens).toLocaleString()} more)`;
|
|
35879
|
-
activity.distillation.info(`Created order-${newOrder} distillation (${summaryInsert.tokenEstimate} tokens, ${retainedFacts.length} facts)
|
|
34882
|
+
activity.distillation.info(`Created order-${newOrder} distillation (${summaryInsert.tokenEstimate} tokens, ${retainedFacts.length} facts) \u2192 ${currentTokens.toLocaleString()} tokens${atTarget ? " \u2713" : ""}`);
|
|
35880
34883
|
const result = {
|
|
35881
|
-
output: `Created order-${newOrder} distillation covering ${adjustedStartId}
|
|
34884
|
+
output: `Created order-${newOrder} distillation covering ${adjustedStartId} \u2192 ${adjustedEndId} (~${summaryInsert.tokenEstimate} tokens, ${retainedFacts.length} facts retained).${adjustmentNote}${subsumedSummaries.length > 0 ? ` Subsumed ${subsumedSummaries.length} existing distillations.` : ""}${tokenStatus}`,
|
|
35882
34885
|
done: false,
|
|
35883
34886
|
distillationCreated: true
|
|
35884
34887
|
};
|
|
@@ -42600,8 +41603,8 @@ class Client extends Protocol {
|
|
|
42600
41603
|
|
|
42601
41604
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
|
|
42602
41605
|
var import_cross_spawn = __toESM(require_cross_spawn(), 1);
|
|
42603
|
-
import process2 from "
|
|
42604
|
-
import { PassThrough } from "
|
|
41606
|
+
import process2 from "process";
|
|
41607
|
+
import { PassThrough } from "stream";
|
|
42605
41608
|
|
|
42606
41609
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
|
|
42607
41610
|
class ReadBuffer {
|
|
@@ -42808,7 +41811,7 @@ function createFetchWithInit(baseFetch = fetch, baseInit) {
|
|
|
42808
41811
|
|
|
42809
41812
|
// node_modules/pkce-challenge/dist/index.node.js
|
|
42810
41813
|
var crypto;
|
|
42811
|
-
crypto = globalThis.crypto?.webcrypto ?? globalThis.crypto ?? import("
|
|
41814
|
+
crypto = globalThis.crypto?.webcrypto ?? globalThis.crypto ?? import("crypto").then((m) => m.webcrypto);
|
|
42812
41815
|
async function getRandomValues(size) {
|
|
42813
41816
|
return (await crypto).getRandomValues(new Uint8Array(size));
|
|
42814
41817
|
}
|
|
@@ -43666,7 +42669,7 @@ function createParser(callbacks) {
|
|
|
43666
42669
|
}));
|
|
43667
42670
|
break;
|
|
43668
42671
|
default:
|
|
43669
|
-
onError(new ParseError(`Unknown field "${field.length > 20 ? `${field.slice(0, 20)}
|
|
42672
|
+
onError(new ParseError(`Unknown field "${field.length > 20 ? `${field.slice(0, 20)}\u2026` : field}"`, { type: "unknown-field", field, value, line }));
|
|
43670
42673
|
break;
|
|
43671
42674
|
}
|
|
43672
42675
|
}
|
|
@@ -44474,9 +43477,9 @@ class SSEClientTransport {
|
|
|
44474
43477
|
}
|
|
44475
43478
|
|
|
44476
43479
|
// src/mcp/index.ts
|
|
44477
|
-
import * as fs7 from "
|
|
44478
|
-
import * as path8 from "
|
|
44479
|
-
import * as os2 from "
|
|
43480
|
+
import * as fs7 from "fs/promises";
|
|
43481
|
+
import * as path8 from "path";
|
|
43482
|
+
import * as os2 from "os";
|
|
44480
43483
|
var Mcp;
|
|
44481
43484
|
((Mcp) => {
|
|
44482
43485
|
Mcp.StdioServerConfigSchema = exports_external.object({
|
|
@@ -44770,7 +43773,7 @@ Use this when:
|
|
|
44770
43773
|
}
|
|
44771
43774
|
let connectedCount = 0;
|
|
44772
43775
|
for (const server of status) {
|
|
44773
|
-
const statusIcon = server.status === "connected" ? "
|
|
43776
|
+
const statusIcon = server.status === "connected" ? "\u2713" : server.status === "connecting" ? "\u22EF" : "\u2717";
|
|
44774
43777
|
output += `### ${server.name} ${statusIcon}
|
|
44775
43778
|
`;
|
|
44776
43779
|
output += `- Status: ${server.status}
|
|
@@ -45185,7 +44188,7 @@ Updates all paths. Children keep their relative position.`,
|
|
|
45185
44188
|
return {
|
|
45186
44189
|
title: `ltm_rename("${slug}")`,
|
|
45187
44190
|
metadata: { entrySlug: slug, operation: "rename" },
|
|
45188
|
-
output: `Renamed entry: ${slug}
|
|
44191
|
+
output: `Renamed entry: ${slug} \u2192 ${newSlug}`
|
|
45189
44192
|
};
|
|
45190
44193
|
} catch (e) {
|
|
45191
44194
|
const msg = e instanceof Error ? e.message : String(e);
|
|
@@ -45380,7 +44383,7 @@ function buildConsolidationTools(storage) {
|
|
|
45380
44383
|
const toolResult = await LTMReparentTool.definition.execute(args, createLTMContext2(toolCallId));
|
|
45381
44384
|
const entryUpdated = toolResult.output.startsWith("Moved entry:");
|
|
45382
44385
|
if (entryUpdated) {
|
|
45383
|
-
activity.ltmCurator.ltmOperation("reparent", args.slug,
|
|
44386
|
+
activity.ltmCurator.ltmOperation("reparent", args.slug, `\u2192 ${args.newParentSlug ?? "root"}`);
|
|
45384
44387
|
}
|
|
45385
44388
|
const result = { output: toolResult.output, done: false, entryUpdated };
|
|
45386
44389
|
results.set(toolCallId, result);
|
|
@@ -45394,7 +44397,7 @@ function buildConsolidationTools(storage) {
|
|
|
45394
44397
|
const toolResult = await LTMRenameTool.definition.execute(args, createLTMContext2(toolCallId));
|
|
45395
44398
|
const entryUpdated = toolResult.output.startsWith("Renamed entry:");
|
|
45396
44399
|
if (entryUpdated) {
|
|
45397
|
-
activity.ltmCurator.ltmOperation("rename", args.slug,
|
|
44400
|
+
activity.ltmCurator.ltmOperation("rename", args.slug, `\u2192 ${args.newSlug}`);
|
|
45398
44401
|
}
|
|
45399
44402
|
const result = { output: toolResult.output, done: false, entryUpdated };
|
|
45400
44403
|
results.set(toolCallId, result);
|
|
@@ -45548,20 +44551,20 @@ ${recentlyUpdatedEntries.map((e) => `- **${e.slug}**: ${e.title}`).join(`
|
|
|
45548
44551
|
### What Makes a GREAT Entry
|
|
45549
44552
|
|
|
45550
44553
|
**Accumulated wisdom (learnings, preferences, gotchas):**
|
|
45551
|
-
-
|
|
45552
|
-
-
|
|
45553
|
-
-
|
|
45554
|
-
-
|
|
44554
|
+
- \u2713 "User prefers simplicity over backwards compatibility - don't maintain legacy paths"
|
|
44555
|
+
- \u2713 "Haiku is unreliable with complex tool schemas - use workhorse tier instead"
|
|
44556
|
+
- \u2713 "MCP servers must be initialized before building tools - order matters"
|
|
44557
|
+
- \u2717 "We discussed the protocol today" (too vague, no actionable content)
|
|
45555
44558
|
|
|
45556
44559
|
**Decision rationale (the WHY matters):**
|
|
45557
|
-
-
|
|
45558
|
-
-
|
|
44560
|
+
- \u2713 "Chose raw NDJSON over JSON-RPC envelope because: simpler, matches Claude Code SDK, no users to migrate"
|
|
44561
|
+
- \u2717 "Using NDJSON format" (missing the WHY - useless for future decisions)
|
|
45559
44562
|
|
|
45560
44563
|
**Codebase documentation (valuable for complex projects!):**
|
|
45561
|
-
-
|
|
45562
|
-
-
|
|
45563
|
-
-
|
|
45564
|
-
-
|
|
44564
|
+
- \u2713 "src/jsonrpc/index.ts: Protocol server - handles stdin/stdout, message queuing, mid-turn injection via onBeforeTurn callback"
|
|
44565
|
+
- \u2713 "src/temporal/: Working memory system - compaction.ts (token budgets), view.ts (reconstruction), compaction-agent.ts (distillation)"
|
|
44566
|
+
- \u2713 "Tool pattern: parameters must be defined BEFORE Tool.define() call due to initialization order"
|
|
44567
|
+
- \u2717 "The config module handles configuration" (too obvious, adds no value)
|
|
45565
44568
|
|
|
45566
44569
|
**When to document code structure:**
|
|
45567
44570
|
- Complex modules with non-obvious responsibilities
|
|
@@ -46232,7 +45235,7 @@ async function runAgent(prompt, options) {
|
|
|
46232
45235
|
}
|
|
46233
45236
|
|
|
46234
45237
|
// src/cli/verbose.ts
|
|
46235
|
-
var SEPARATOR = "
|
|
45238
|
+
var SEPARATOR = "\u2500".repeat(70);
|
|
46236
45239
|
function formatTimestamp() {
|
|
46237
45240
|
return new Date().toISOString().slice(11, 23);
|
|
46238
45241
|
}
|
|
@@ -46267,7 +45270,7 @@ ${SEPARATOR}`);
|
|
|
46267
45270
|
const completed = present.tasks.filter((t) => t.status === "completed").length;
|
|
46268
45271
|
const total = present.tasks.length;
|
|
46269
45272
|
if (total > 0) {
|
|
46270
|
-
const bar = "
|
|
45273
|
+
const bar = "\u2588".repeat(completed) + "\u2591".repeat(total - completed);
|
|
46271
45274
|
this.log(` Tasks: [${completed}/${total} complete] ${bar}`);
|
|
46272
45275
|
} else {
|
|
46273
45276
|
this.log(` Tasks: (none)`);
|
|
@@ -46297,14 +45300,14 @@ LTM:`);
|
|
|
46297
45300
|
this.separator("TOKEN BUDGET");
|
|
46298
45301
|
const pct = (n) => (n / budget.total * 100).toFixed(1);
|
|
46299
45302
|
this.log(`Component Tokens % of ${(budget.total / 1000).toFixed(0)}k`);
|
|
46300
|
-
this.log("
|
|
45303
|
+
this.log("\u2500".repeat(41));
|
|
46301
45304
|
this.log(`System prompt ${budget.systemPrompt.toString().padStart(7)} ${pct(budget.systemPrompt).padStart(5)}%`);
|
|
46302
45305
|
this.log(`Identity/behavior ${(budget.identity + budget.behavior).toString().padStart(7)} ${pct(budget.identity + budget.behavior).padStart(5)}%`);
|
|
46303
45306
|
this.log(`Temporal summaries ${budget.temporalSummaries.toString().padStart(7)} ${pct(budget.temporalSummaries).padStart(5)}%`);
|
|
46304
45307
|
this.log(`Temporal messages ${budget.temporalMessages.toString().padStart(7)} ${pct(budget.temporalMessages).padStart(5)}%`);
|
|
46305
45308
|
this.log(`Present state ${budget.present.toString().padStart(7)} ${pct(budget.present).padStart(5)}%`);
|
|
46306
45309
|
this.log(`Tools ${budget.tools.toString().padStart(7)} ${pct(budget.tools).padStart(5)}%`);
|
|
46307
|
-
this.log("
|
|
45310
|
+
this.log("\u2500".repeat(41));
|
|
46308
45311
|
this.log(`Total used ${budget.used.toString().padStart(7)} ${pct(budget.used).padStart(5)}%`);
|
|
46309
45312
|
this.log(`Available ${budget.available.toString().padStart(7)} ${pct(budget.available).padStart(5)}%`);
|
|
46310
45313
|
}
|
|
@@ -46314,7 +45317,7 @@ LTM:`);
|
|
|
46314
45317
|
}
|
|
46315
45318
|
event(event) {
|
|
46316
45319
|
const ts = event.timestamp ?? formatTimestamp();
|
|
46317
|
-
const arrow = event.type === "user" || event.type === "tool_result" ? "
|
|
45320
|
+
const arrow = event.type === "user" || event.type === "tool_result" ? "\u2192" : "\u2190";
|
|
46318
45321
|
const typeLabel = event.type.replace("_", " ");
|
|
46319
45322
|
const content = event.content.length > 100 ? event.content.slice(0, 100) + "..." : event.content;
|
|
46320
45323
|
this.log(`[${ts}] ${arrow} ${typeLabel}: ${content}`);
|
|
@@ -46328,7 +45331,7 @@ LTM:`);
|
|
|
46328
45331
|
const completed = present.tasks.filter((t) => t.status === "completed").length;
|
|
46329
45332
|
const total = present.tasks.length;
|
|
46330
45333
|
if (total > 0) {
|
|
46331
|
-
const bar = "
|
|
45334
|
+
const bar = "\u2588".repeat(completed) + "\u2591".repeat(total - completed);
|
|
46332
45335
|
this.log(` Tasks: [${completed}/${total} complete] ${bar}`);
|
|
46333
45336
|
} else {
|
|
46334
45337
|
this.log(` Tasks: (none)`);
|
|
@@ -46531,8 +45534,8 @@ async function runBatch(options) {
|
|
|
46531
45534
|
}
|
|
46532
45535
|
|
|
46533
45536
|
// src/cli/inspect.ts
|
|
46534
|
-
var SEPARATOR2 = "
|
|
46535
|
-
var SUBSEPARATOR = "
|
|
45537
|
+
var SEPARATOR2 = "\u2550".repeat(70);
|
|
45538
|
+
var SUBSEPARATOR = "\u2500".repeat(70);
|
|
46536
45539
|
function estimateTokens4(text3) {
|
|
46537
45540
|
return Math.ceil(text3.length / 4);
|
|
46538
45541
|
}
|
|
@@ -46818,7 +45821,7 @@ async function runCompact(dbPath) {
|
|
|
46818
45821
|
const d = result.distillation;
|
|
46819
45822
|
console.log(`Distillation:`);
|
|
46820
45823
|
console.log(` Distillations created: ${d.distillationsCreated}`);
|
|
46821
|
-
console.log(` Tokens: ${fmt(d.tokensBefore)}
|
|
45824
|
+
console.log(` Tokens: ${fmt(d.tokensBefore)} \u2192 ${fmt(d.tokensAfter)}`);
|
|
46822
45825
|
console.log(` Turns used: ${d.turnsUsed}`);
|
|
46823
45826
|
console.log(` LLM usage: ${fmt(d.usage.inputTokens)} input, ${fmt(d.usage.outputTokens)} output`);
|
|
46824
45827
|
}
|
|
@@ -47551,7 +46554,7 @@ Server exited with code ${code}`);
|
|
|
47551
46554
|
break;
|
|
47552
46555
|
case "result":
|
|
47553
46556
|
this.isRunning = false;
|
|
47554
|
-
const status = msg.subtype === "success" ? "\x1B[32m
|
|
46557
|
+
const status = msg.subtype === "success" ? "\x1B[32m\u2713\x1B[0m" : msg.subtype === "cancelled" ? "\x1B[33m\u2298\x1B[0m" : "\x1B[31m\u2717\x1B[0m";
|
|
47555
46558
|
console.log(`
|
|
47556
46559
|
${status} ${msg.subtype} (${msg.duration_ms}ms, ${msg.num_turns} turns)`);
|
|
47557
46560
|
if (msg.usage) {
|