mindkeeper-openclaw 0.2.8 → 0.2.10
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 +3111 -470
- package/package.json +5 -2
- package/skills/mindkeeper/SKILL.md +75 -23
package/dist/index.js
CHANGED
|
@@ -13,6 +13,10 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
13
13
|
var __commonJS = (cb, mod) => function __require2() {
|
|
14
14
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
15
15
|
};
|
|
16
|
+
var __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
16
20
|
var __copyProps = (to, from, except, desc) => {
|
|
17
21
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
18
22
|
for (let key of __getOwnPropNames(from))
|
|
@@ -18416,246 +18420,3057 @@ ${obj.gpgsig ? obj.gpgsig : ""}`;
|
|
|
18416
18420
|
}
|
|
18417
18421
|
});
|
|
18418
18422
|
|
|
18419
|
-
//
|
|
18420
|
-
|
|
18421
|
-
|
|
18423
|
+
// node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
|
|
18424
|
+
var value_exports = {};
|
|
18425
|
+
__export(value_exports, {
|
|
18426
|
+
HasPropertyKey: () => HasPropertyKey,
|
|
18427
|
+
IsArray: () => IsArray,
|
|
18428
|
+
IsAsyncIterator: () => IsAsyncIterator,
|
|
18429
|
+
IsBigInt: () => IsBigInt,
|
|
18430
|
+
IsBoolean: () => IsBoolean,
|
|
18431
|
+
IsDate: () => IsDate,
|
|
18432
|
+
IsFunction: () => IsFunction,
|
|
18433
|
+
IsIterator: () => IsIterator,
|
|
18434
|
+
IsNull: () => IsNull,
|
|
18435
|
+
IsNumber: () => IsNumber,
|
|
18436
|
+
IsObject: () => IsObject,
|
|
18437
|
+
IsRegExp: () => IsRegExp,
|
|
18438
|
+
IsString: () => IsString,
|
|
18439
|
+
IsSymbol: () => IsSymbol,
|
|
18440
|
+
IsUint8Array: () => IsUint8Array,
|
|
18441
|
+
IsUndefined: () => IsUndefined
|
|
18442
|
+
});
|
|
18443
|
+
function HasPropertyKey(value, key) {
|
|
18444
|
+
return key in value;
|
|
18445
|
+
}
|
|
18446
|
+
function IsAsyncIterator(value) {
|
|
18447
|
+
return IsObject(value) && !IsArray(value) && !IsUint8Array(value) && Symbol.asyncIterator in value;
|
|
18448
|
+
}
|
|
18449
|
+
function IsArray(value) {
|
|
18450
|
+
return Array.isArray(value);
|
|
18451
|
+
}
|
|
18452
|
+
function IsBigInt(value) {
|
|
18453
|
+
return typeof value === "bigint";
|
|
18454
|
+
}
|
|
18455
|
+
function IsBoolean(value) {
|
|
18456
|
+
return typeof value === "boolean";
|
|
18457
|
+
}
|
|
18458
|
+
function IsDate(value) {
|
|
18459
|
+
return value instanceof globalThis.Date;
|
|
18460
|
+
}
|
|
18461
|
+
function IsFunction(value) {
|
|
18462
|
+
return typeof value === "function";
|
|
18463
|
+
}
|
|
18464
|
+
function IsIterator(value) {
|
|
18465
|
+
return IsObject(value) && !IsArray(value) && !IsUint8Array(value) && Symbol.iterator in value;
|
|
18466
|
+
}
|
|
18467
|
+
function IsNull(value) {
|
|
18468
|
+
return value === null;
|
|
18469
|
+
}
|
|
18470
|
+
function IsNumber(value) {
|
|
18471
|
+
return typeof value === "number";
|
|
18472
|
+
}
|
|
18473
|
+
function IsObject(value) {
|
|
18474
|
+
return typeof value === "object" && value !== null;
|
|
18475
|
+
}
|
|
18476
|
+
function IsRegExp(value) {
|
|
18477
|
+
return value instanceof globalThis.RegExp;
|
|
18478
|
+
}
|
|
18479
|
+
function IsString(value) {
|
|
18480
|
+
return typeof value === "string";
|
|
18481
|
+
}
|
|
18482
|
+
function IsSymbol(value) {
|
|
18483
|
+
return typeof value === "symbol";
|
|
18484
|
+
}
|
|
18485
|
+
function IsUint8Array(value) {
|
|
18486
|
+
return value instanceof globalThis.Uint8Array;
|
|
18487
|
+
}
|
|
18488
|
+
function IsUndefined(value) {
|
|
18489
|
+
return value === void 0;
|
|
18490
|
+
}
|
|
18422
18491
|
|
|
18423
|
-
//
|
|
18424
|
-
|
|
18425
|
-
|
|
18426
|
-
|
|
18427
|
-
|
|
18428
|
-
return
|
|
18429
|
-
|
|
18430
|
-
|
|
18431
|
-
|
|
18432
|
-
|
|
18433
|
-
|
|
18434
|
-
|
|
18435
|
-
}
|
|
18436
|
-
|
|
18437
|
-
const
|
|
18438
|
-
|
|
18439
|
-
|
|
18440
|
-
|
|
18441
|
-
|
|
18442
|
-
|
|
18443
|
-
let bi = str.indexOf(b, ai + 1);
|
|
18444
|
-
let i = ai;
|
|
18445
|
-
if (ai >= 0 && bi > 0) {
|
|
18446
|
-
if (a === b) {
|
|
18447
|
-
return [ai, bi];
|
|
18448
|
-
}
|
|
18449
|
-
begs = [];
|
|
18450
|
-
left = str.length;
|
|
18451
|
-
while (i >= 0 && !result) {
|
|
18452
|
-
if (i === ai) {
|
|
18453
|
-
begs.push(i);
|
|
18454
|
-
ai = str.indexOf(a, i + 1);
|
|
18455
|
-
} else if (begs.length === 1) {
|
|
18456
|
-
const r = begs.pop();
|
|
18457
|
-
if (r !== void 0)
|
|
18458
|
-
result = [r, bi];
|
|
18459
|
-
} else {
|
|
18460
|
-
beg = begs.pop();
|
|
18461
|
-
if (beg !== void 0 && beg < left) {
|
|
18462
|
-
left = beg;
|
|
18463
|
-
right = bi;
|
|
18464
|
-
}
|
|
18465
|
-
bi = str.indexOf(b, i + 1);
|
|
18466
|
-
}
|
|
18467
|
-
i = ai < bi && ai >= 0 ? ai : bi;
|
|
18468
|
-
}
|
|
18469
|
-
if (begs.length && right !== void 0) {
|
|
18470
|
-
result = [left, right];
|
|
18471
|
-
}
|
|
18492
|
+
// node_modules/@sinclair/typebox/build/esm/type/clone/value.mjs
|
|
18493
|
+
function ArrayType(value) {
|
|
18494
|
+
return value.map((value2) => Visit(value2));
|
|
18495
|
+
}
|
|
18496
|
+
function DateType(value) {
|
|
18497
|
+
return new Date(value.getTime());
|
|
18498
|
+
}
|
|
18499
|
+
function Uint8ArrayType(value) {
|
|
18500
|
+
return new Uint8Array(value);
|
|
18501
|
+
}
|
|
18502
|
+
function RegExpType(value) {
|
|
18503
|
+
return new RegExp(value.source, value.flags);
|
|
18504
|
+
}
|
|
18505
|
+
function ObjectType(value) {
|
|
18506
|
+
const result = {};
|
|
18507
|
+
for (const key of Object.getOwnPropertyNames(value)) {
|
|
18508
|
+
result[key] = Visit(value[key]);
|
|
18509
|
+
}
|
|
18510
|
+
for (const key of Object.getOwnPropertySymbols(value)) {
|
|
18511
|
+
result[key] = Visit(value[key]);
|
|
18472
18512
|
}
|
|
18473
18513
|
return result;
|
|
18474
|
-
}
|
|
18514
|
+
}
|
|
18515
|
+
function Visit(value) {
|
|
18516
|
+
return IsArray(value) ? ArrayType(value) : IsDate(value) ? DateType(value) : IsUint8Array(value) ? Uint8ArrayType(value) : IsRegExp(value) ? RegExpType(value) : IsObject(value) ? ObjectType(value) : value;
|
|
18517
|
+
}
|
|
18518
|
+
function Clone(value) {
|
|
18519
|
+
return Visit(value);
|
|
18520
|
+
}
|
|
18475
18521
|
|
|
18476
|
-
//
|
|
18477
|
-
|
|
18478
|
-
|
|
18479
|
-
var escClose = "\0CLOSE" + Math.random() + "\0";
|
|
18480
|
-
var escComma = "\0COMMA" + Math.random() + "\0";
|
|
18481
|
-
var escPeriod = "\0PERIOD" + Math.random() + "\0";
|
|
18482
|
-
var escSlashPattern = new RegExp(escSlash, "g");
|
|
18483
|
-
var escOpenPattern = new RegExp(escOpen, "g");
|
|
18484
|
-
var escClosePattern = new RegExp(escClose, "g");
|
|
18485
|
-
var escCommaPattern = new RegExp(escComma, "g");
|
|
18486
|
-
var escPeriodPattern = new RegExp(escPeriod, "g");
|
|
18487
|
-
var slashPattern = /\\\\/g;
|
|
18488
|
-
var openPattern = /\\{/g;
|
|
18489
|
-
var closePattern = /\\}/g;
|
|
18490
|
-
var commaPattern = /\\,/g;
|
|
18491
|
-
var periodPattern = /\\\./g;
|
|
18492
|
-
var EXPANSION_MAX = 1e5;
|
|
18493
|
-
function numeric(str) {
|
|
18494
|
-
return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
|
|
18522
|
+
// node_modules/@sinclair/typebox/build/esm/type/clone/type.mjs
|
|
18523
|
+
function CloneType(schema, options) {
|
|
18524
|
+
return options === void 0 ? Clone(schema) : Clone({ ...options, ...schema });
|
|
18495
18525
|
}
|
|
18496
|
-
|
|
18497
|
-
|
|
18526
|
+
|
|
18527
|
+
// node_modules/@sinclair/typebox/build/esm/value/guard/guard.mjs
|
|
18528
|
+
function IsObject2(value) {
|
|
18529
|
+
return value !== null && typeof value === "object";
|
|
18498
18530
|
}
|
|
18499
|
-
function
|
|
18500
|
-
return
|
|
18531
|
+
function IsArray2(value) {
|
|
18532
|
+
return globalThis.Array.isArray(value) && !globalThis.ArrayBuffer.isView(value);
|
|
18501
18533
|
}
|
|
18502
|
-
function
|
|
18503
|
-
|
|
18504
|
-
return [""];
|
|
18505
|
-
}
|
|
18506
|
-
const parts = [];
|
|
18507
|
-
const m = balanced("{", "}", str);
|
|
18508
|
-
if (!m) {
|
|
18509
|
-
return str.split(",");
|
|
18510
|
-
}
|
|
18511
|
-
const { pre, body, post } = m;
|
|
18512
|
-
const p = pre.split(",");
|
|
18513
|
-
p[p.length - 1] += "{" + body + "}";
|
|
18514
|
-
const postParts = parseCommaParts(post);
|
|
18515
|
-
if (post.length) {
|
|
18516
|
-
;
|
|
18517
|
-
p[p.length - 1] += postParts.shift();
|
|
18518
|
-
p.push.apply(p, postParts);
|
|
18519
|
-
}
|
|
18520
|
-
parts.push.apply(parts, p);
|
|
18521
|
-
return parts;
|
|
18534
|
+
function IsUndefined2(value) {
|
|
18535
|
+
return value === void 0;
|
|
18522
18536
|
}
|
|
18523
|
-
function
|
|
18524
|
-
|
|
18525
|
-
return [];
|
|
18526
|
-
}
|
|
18527
|
-
const { max = EXPANSION_MAX } = options;
|
|
18528
|
-
if (str.slice(0, 2) === "{}") {
|
|
18529
|
-
str = "\\{\\}" + str.slice(2);
|
|
18530
|
-
}
|
|
18531
|
-
return expand_(escapeBraces(str), max, true).map(unescapeBraces);
|
|
18537
|
+
function IsNumber2(value) {
|
|
18538
|
+
return typeof value === "number";
|
|
18532
18539
|
}
|
|
18533
|
-
|
|
18534
|
-
|
|
18540
|
+
|
|
18541
|
+
// node_modules/@sinclair/typebox/build/esm/system/policy.mjs
|
|
18542
|
+
var TypeSystemPolicy;
|
|
18543
|
+
(function(TypeSystemPolicy2) {
|
|
18544
|
+
TypeSystemPolicy2.InstanceMode = "default";
|
|
18545
|
+
TypeSystemPolicy2.ExactOptionalPropertyTypes = false;
|
|
18546
|
+
TypeSystemPolicy2.AllowArrayObject = false;
|
|
18547
|
+
TypeSystemPolicy2.AllowNaN = false;
|
|
18548
|
+
TypeSystemPolicy2.AllowNullVoid = false;
|
|
18549
|
+
function IsExactOptionalProperty(value, key) {
|
|
18550
|
+
return TypeSystemPolicy2.ExactOptionalPropertyTypes ? key in value : value[key] !== void 0;
|
|
18551
|
+
}
|
|
18552
|
+
TypeSystemPolicy2.IsExactOptionalProperty = IsExactOptionalProperty;
|
|
18553
|
+
function IsObjectLike(value) {
|
|
18554
|
+
const isObject = IsObject2(value);
|
|
18555
|
+
return TypeSystemPolicy2.AllowArrayObject ? isObject : isObject && !IsArray2(value);
|
|
18556
|
+
}
|
|
18557
|
+
TypeSystemPolicy2.IsObjectLike = IsObjectLike;
|
|
18558
|
+
function IsRecordLike(value) {
|
|
18559
|
+
return IsObjectLike(value) && !(value instanceof Date) && !(value instanceof Uint8Array);
|
|
18560
|
+
}
|
|
18561
|
+
TypeSystemPolicy2.IsRecordLike = IsRecordLike;
|
|
18562
|
+
function IsNumberLike(value) {
|
|
18563
|
+
return TypeSystemPolicy2.AllowNaN ? IsNumber2(value) : Number.isFinite(value);
|
|
18564
|
+
}
|
|
18565
|
+
TypeSystemPolicy2.IsNumberLike = IsNumberLike;
|
|
18566
|
+
function IsVoidLike(value) {
|
|
18567
|
+
const isUndefined = IsUndefined2(value);
|
|
18568
|
+
return TypeSystemPolicy2.AllowNullVoid ? isUndefined || value === null : isUndefined;
|
|
18569
|
+
}
|
|
18570
|
+
TypeSystemPolicy2.IsVoidLike = IsVoidLike;
|
|
18571
|
+
})(TypeSystemPolicy || (TypeSystemPolicy = {}));
|
|
18572
|
+
|
|
18573
|
+
// node_modules/@sinclair/typebox/build/esm/type/create/immutable.mjs
|
|
18574
|
+
function ImmutableArray(value) {
|
|
18575
|
+
return globalThis.Object.freeze(value).map((value2) => Immutable(value2));
|
|
18535
18576
|
}
|
|
18536
|
-
function
|
|
18537
|
-
return
|
|
18577
|
+
function ImmutableDate(value) {
|
|
18578
|
+
return value;
|
|
18538
18579
|
}
|
|
18539
|
-
function
|
|
18540
|
-
return
|
|
18580
|
+
function ImmutableUint8Array(value) {
|
|
18581
|
+
return value;
|
|
18541
18582
|
}
|
|
18542
|
-
function
|
|
18543
|
-
return
|
|
18583
|
+
function ImmutableRegExp(value) {
|
|
18584
|
+
return value;
|
|
18544
18585
|
}
|
|
18545
|
-
function
|
|
18546
|
-
const
|
|
18547
|
-
const
|
|
18548
|
-
|
|
18549
|
-
return [str];
|
|
18550
|
-
const pre = m.pre;
|
|
18551
|
-
const post = m.post.length ? expand_(m.post, max, false) : [""];
|
|
18552
|
-
if (/\$$/.test(m.pre)) {
|
|
18553
|
-
for (let k = 0; k < post.length && k < max; k++) {
|
|
18554
|
-
const expansion = pre + "{" + m.body + "}" + post[k];
|
|
18555
|
-
expansions.push(expansion);
|
|
18556
|
-
}
|
|
18557
|
-
} else {
|
|
18558
|
-
const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
18559
|
-
const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
18560
|
-
const isSequence = isNumericSequence || isAlphaSequence;
|
|
18561
|
-
const isOptions = m.body.indexOf(",") >= 0;
|
|
18562
|
-
if (!isSequence && !isOptions) {
|
|
18563
|
-
if (m.post.match(/,(?!,).*\}/)) {
|
|
18564
|
-
str = m.pre + "{" + m.body + escClose + m.post;
|
|
18565
|
-
return expand_(str, max, true);
|
|
18566
|
-
}
|
|
18567
|
-
return [str];
|
|
18568
|
-
}
|
|
18569
|
-
let n;
|
|
18570
|
-
if (isSequence) {
|
|
18571
|
-
n = m.body.split(/\.\./);
|
|
18572
|
-
} else {
|
|
18573
|
-
n = parseCommaParts(m.body);
|
|
18574
|
-
if (n.length === 1 && n[0] !== void 0) {
|
|
18575
|
-
n = expand_(n[0], max, false).map(embrace);
|
|
18576
|
-
if (n.length === 1) {
|
|
18577
|
-
return post.map((p) => m.pre + n[0] + p);
|
|
18578
|
-
}
|
|
18579
|
-
}
|
|
18580
|
-
}
|
|
18581
|
-
let N;
|
|
18582
|
-
if (isSequence && n[0] !== void 0 && n[1] !== void 0) {
|
|
18583
|
-
const x = numeric(n[0]);
|
|
18584
|
-
const y = numeric(n[1]);
|
|
18585
|
-
const width = Math.max(n[0].length, n[1].length);
|
|
18586
|
-
let incr = n.length === 3 && n[2] !== void 0 ? Math.abs(numeric(n[2])) : 1;
|
|
18587
|
-
let test = lte;
|
|
18588
|
-
const reverse = y < x;
|
|
18589
|
-
if (reverse) {
|
|
18590
|
-
incr *= -1;
|
|
18591
|
-
test = gte;
|
|
18592
|
-
}
|
|
18593
|
-
const pad = n.some(isPadded);
|
|
18594
|
-
N = [];
|
|
18595
|
-
for (let i = x; test(i, y); i += incr) {
|
|
18596
|
-
let c;
|
|
18597
|
-
if (isAlphaSequence) {
|
|
18598
|
-
c = String.fromCharCode(i);
|
|
18599
|
-
if (c === "\\") {
|
|
18600
|
-
c = "";
|
|
18601
|
-
}
|
|
18602
|
-
} else {
|
|
18603
|
-
c = String(i);
|
|
18604
|
-
if (pad) {
|
|
18605
|
-
const need = width - c.length;
|
|
18606
|
-
if (need > 0) {
|
|
18607
|
-
const z = new Array(need + 1).join("0");
|
|
18608
|
-
if (i < 0) {
|
|
18609
|
-
c = "-" + z + c.slice(1);
|
|
18610
|
-
} else {
|
|
18611
|
-
c = z + c;
|
|
18612
|
-
}
|
|
18613
|
-
}
|
|
18614
|
-
}
|
|
18615
|
-
}
|
|
18616
|
-
N.push(c);
|
|
18617
|
-
}
|
|
18618
|
-
} else {
|
|
18619
|
-
N = [];
|
|
18620
|
-
for (let j = 0; j < n.length; j++) {
|
|
18621
|
-
N.push.apply(N, expand_(n[j], max, false));
|
|
18622
|
-
}
|
|
18623
|
-
}
|
|
18624
|
-
for (let j = 0; j < N.length; j++) {
|
|
18625
|
-
for (let k = 0; k < post.length && expansions.length < max; k++) {
|
|
18626
|
-
const expansion = pre + N[j] + post[k];
|
|
18627
|
-
if (!isTop || isSequence || expansion) {
|
|
18628
|
-
expansions.push(expansion);
|
|
18629
|
-
}
|
|
18630
|
-
}
|
|
18631
|
-
}
|
|
18586
|
+
function ImmutableObject(value) {
|
|
18587
|
+
const result = {};
|
|
18588
|
+
for (const key of Object.getOwnPropertyNames(value)) {
|
|
18589
|
+
result[key] = Immutable(value[key]);
|
|
18632
18590
|
}
|
|
18633
|
-
|
|
18591
|
+
for (const key of Object.getOwnPropertySymbols(value)) {
|
|
18592
|
+
result[key] = Immutable(value[key]);
|
|
18593
|
+
}
|
|
18594
|
+
return globalThis.Object.freeze(result);
|
|
18595
|
+
}
|
|
18596
|
+
function Immutable(value) {
|
|
18597
|
+
return IsArray(value) ? ImmutableArray(value) : IsDate(value) ? ImmutableDate(value) : IsUint8Array(value) ? ImmutableUint8Array(value) : IsRegExp(value) ? ImmutableRegExp(value) : IsObject(value) ? ImmutableObject(value) : value;
|
|
18634
18598
|
}
|
|
18635
18599
|
|
|
18636
|
-
//
|
|
18637
|
-
|
|
18638
|
-
|
|
18639
|
-
|
|
18640
|
-
|
|
18600
|
+
// node_modules/@sinclair/typebox/build/esm/type/create/type.mjs
|
|
18601
|
+
function CreateType(schema, options) {
|
|
18602
|
+
const result = options !== void 0 ? { ...options, ...schema } : schema;
|
|
18603
|
+
switch (TypeSystemPolicy.InstanceMode) {
|
|
18604
|
+
case "freeze":
|
|
18605
|
+
return Immutable(result);
|
|
18606
|
+
case "clone":
|
|
18607
|
+
return Clone(result);
|
|
18608
|
+
default:
|
|
18609
|
+
return result;
|
|
18641
18610
|
}
|
|
18642
|
-
|
|
18643
|
-
|
|
18611
|
+
}
|
|
18612
|
+
|
|
18613
|
+
// node_modules/@sinclair/typebox/build/esm/type/error/error.mjs
|
|
18614
|
+
var TypeBoxError = class extends Error {
|
|
18615
|
+
constructor(message) {
|
|
18616
|
+
super(message);
|
|
18644
18617
|
}
|
|
18645
18618
|
};
|
|
18646
18619
|
|
|
18647
|
-
//
|
|
18648
|
-
var
|
|
18649
|
-
|
|
18650
|
-
|
|
18651
|
-
|
|
18652
|
-
|
|
18653
|
-
|
|
18654
|
-
|
|
18655
|
-
|
|
18656
|
-
|
|
18657
|
-
|
|
18658
|
-
|
|
18620
|
+
// node_modules/@sinclair/typebox/build/esm/type/symbols/symbols.mjs
|
|
18621
|
+
var TransformKind = /* @__PURE__ */ Symbol.for("TypeBox.Transform");
|
|
18622
|
+
var ReadonlyKind = /* @__PURE__ */ Symbol.for("TypeBox.Readonly");
|
|
18623
|
+
var OptionalKind = /* @__PURE__ */ Symbol.for("TypeBox.Optional");
|
|
18624
|
+
var Hint = /* @__PURE__ */ Symbol.for("TypeBox.Hint");
|
|
18625
|
+
var Kind = /* @__PURE__ */ Symbol.for("TypeBox.Kind");
|
|
18626
|
+
|
|
18627
|
+
// node_modules/@sinclair/typebox/build/esm/type/guard/kind.mjs
|
|
18628
|
+
function IsReadonly(value) {
|
|
18629
|
+
return IsObject(value) && value[ReadonlyKind] === "Readonly";
|
|
18630
|
+
}
|
|
18631
|
+
function IsOptional(value) {
|
|
18632
|
+
return IsObject(value) && value[OptionalKind] === "Optional";
|
|
18633
|
+
}
|
|
18634
|
+
function IsAny(value) {
|
|
18635
|
+
return IsKindOf(value, "Any");
|
|
18636
|
+
}
|
|
18637
|
+
function IsArgument(value) {
|
|
18638
|
+
return IsKindOf(value, "Argument");
|
|
18639
|
+
}
|
|
18640
|
+
function IsArray3(value) {
|
|
18641
|
+
return IsKindOf(value, "Array");
|
|
18642
|
+
}
|
|
18643
|
+
function IsAsyncIterator2(value) {
|
|
18644
|
+
return IsKindOf(value, "AsyncIterator");
|
|
18645
|
+
}
|
|
18646
|
+
function IsBigInt2(value) {
|
|
18647
|
+
return IsKindOf(value, "BigInt");
|
|
18648
|
+
}
|
|
18649
|
+
function IsBoolean2(value) {
|
|
18650
|
+
return IsKindOf(value, "Boolean");
|
|
18651
|
+
}
|
|
18652
|
+
function IsComputed(value) {
|
|
18653
|
+
return IsKindOf(value, "Computed");
|
|
18654
|
+
}
|
|
18655
|
+
function IsConstructor(value) {
|
|
18656
|
+
return IsKindOf(value, "Constructor");
|
|
18657
|
+
}
|
|
18658
|
+
function IsDate2(value) {
|
|
18659
|
+
return IsKindOf(value, "Date");
|
|
18660
|
+
}
|
|
18661
|
+
function IsFunction2(value) {
|
|
18662
|
+
return IsKindOf(value, "Function");
|
|
18663
|
+
}
|
|
18664
|
+
function IsInteger(value) {
|
|
18665
|
+
return IsKindOf(value, "Integer");
|
|
18666
|
+
}
|
|
18667
|
+
function IsIntersect(value) {
|
|
18668
|
+
return IsKindOf(value, "Intersect");
|
|
18669
|
+
}
|
|
18670
|
+
function IsIterator2(value) {
|
|
18671
|
+
return IsKindOf(value, "Iterator");
|
|
18672
|
+
}
|
|
18673
|
+
function IsKindOf(value, kind) {
|
|
18674
|
+
return IsObject(value) && Kind in value && value[Kind] === kind;
|
|
18675
|
+
}
|
|
18676
|
+
function IsLiteralValue(value) {
|
|
18677
|
+
return IsBoolean(value) || IsNumber(value) || IsString(value);
|
|
18678
|
+
}
|
|
18679
|
+
function IsLiteral(value) {
|
|
18680
|
+
return IsKindOf(value, "Literal");
|
|
18681
|
+
}
|
|
18682
|
+
function IsMappedKey(value) {
|
|
18683
|
+
return IsKindOf(value, "MappedKey");
|
|
18684
|
+
}
|
|
18685
|
+
function IsMappedResult(value) {
|
|
18686
|
+
return IsKindOf(value, "MappedResult");
|
|
18687
|
+
}
|
|
18688
|
+
function IsNever(value) {
|
|
18689
|
+
return IsKindOf(value, "Never");
|
|
18690
|
+
}
|
|
18691
|
+
function IsNot(value) {
|
|
18692
|
+
return IsKindOf(value, "Not");
|
|
18693
|
+
}
|
|
18694
|
+
function IsNull2(value) {
|
|
18695
|
+
return IsKindOf(value, "Null");
|
|
18696
|
+
}
|
|
18697
|
+
function IsNumber3(value) {
|
|
18698
|
+
return IsKindOf(value, "Number");
|
|
18699
|
+
}
|
|
18700
|
+
function IsObject3(value) {
|
|
18701
|
+
return IsKindOf(value, "Object");
|
|
18702
|
+
}
|
|
18703
|
+
function IsPromise(value) {
|
|
18704
|
+
return IsKindOf(value, "Promise");
|
|
18705
|
+
}
|
|
18706
|
+
function IsRecord(value) {
|
|
18707
|
+
return IsKindOf(value, "Record");
|
|
18708
|
+
}
|
|
18709
|
+
function IsRef(value) {
|
|
18710
|
+
return IsKindOf(value, "Ref");
|
|
18711
|
+
}
|
|
18712
|
+
function IsRegExp2(value) {
|
|
18713
|
+
return IsKindOf(value, "RegExp");
|
|
18714
|
+
}
|
|
18715
|
+
function IsString2(value) {
|
|
18716
|
+
return IsKindOf(value, "String");
|
|
18717
|
+
}
|
|
18718
|
+
function IsSymbol2(value) {
|
|
18719
|
+
return IsKindOf(value, "Symbol");
|
|
18720
|
+
}
|
|
18721
|
+
function IsTemplateLiteral(value) {
|
|
18722
|
+
return IsKindOf(value, "TemplateLiteral");
|
|
18723
|
+
}
|
|
18724
|
+
function IsThis(value) {
|
|
18725
|
+
return IsKindOf(value, "This");
|
|
18726
|
+
}
|
|
18727
|
+
function IsTransform(value) {
|
|
18728
|
+
return IsObject(value) && TransformKind in value;
|
|
18729
|
+
}
|
|
18730
|
+
function IsTuple(value) {
|
|
18731
|
+
return IsKindOf(value, "Tuple");
|
|
18732
|
+
}
|
|
18733
|
+
function IsUndefined3(value) {
|
|
18734
|
+
return IsKindOf(value, "Undefined");
|
|
18735
|
+
}
|
|
18736
|
+
function IsUnion(value) {
|
|
18737
|
+
return IsKindOf(value, "Union");
|
|
18738
|
+
}
|
|
18739
|
+
function IsUint8Array2(value) {
|
|
18740
|
+
return IsKindOf(value, "Uint8Array");
|
|
18741
|
+
}
|
|
18742
|
+
function IsUnknown(value) {
|
|
18743
|
+
return IsKindOf(value, "Unknown");
|
|
18744
|
+
}
|
|
18745
|
+
function IsUnsafe(value) {
|
|
18746
|
+
return IsKindOf(value, "Unsafe");
|
|
18747
|
+
}
|
|
18748
|
+
function IsVoid(value) {
|
|
18749
|
+
return IsKindOf(value, "Void");
|
|
18750
|
+
}
|
|
18751
|
+
function IsKind(value) {
|
|
18752
|
+
return IsObject(value) && Kind in value && IsString(value[Kind]);
|
|
18753
|
+
}
|
|
18754
|
+
function IsSchema(value) {
|
|
18755
|
+
return IsAny(value) || IsArgument(value) || IsArray3(value) || IsBoolean2(value) || IsBigInt2(value) || IsAsyncIterator2(value) || IsComputed(value) || IsConstructor(value) || IsDate2(value) || IsFunction2(value) || IsInteger(value) || IsIntersect(value) || IsIterator2(value) || IsLiteral(value) || IsMappedKey(value) || IsMappedResult(value) || IsNever(value) || IsNot(value) || IsNull2(value) || IsNumber3(value) || IsObject3(value) || IsPromise(value) || IsRecord(value) || IsRef(value) || IsRegExp2(value) || IsString2(value) || IsSymbol2(value) || IsTemplateLiteral(value) || IsThis(value) || IsTuple(value) || IsUndefined3(value) || IsUnion(value) || IsUint8Array2(value) || IsUnknown(value) || IsUnsafe(value) || IsVoid(value) || IsKind(value);
|
|
18756
|
+
}
|
|
18757
|
+
|
|
18758
|
+
// node_modules/@sinclair/typebox/build/esm/type/guard/type.mjs
|
|
18759
|
+
var type_exports = {};
|
|
18760
|
+
__export(type_exports, {
|
|
18761
|
+
IsAny: () => IsAny2,
|
|
18762
|
+
IsArgument: () => IsArgument2,
|
|
18763
|
+
IsArray: () => IsArray4,
|
|
18764
|
+
IsAsyncIterator: () => IsAsyncIterator3,
|
|
18765
|
+
IsBigInt: () => IsBigInt3,
|
|
18766
|
+
IsBoolean: () => IsBoolean3,
|
|
18767
|
+
IsComputed: () => IsComputed2,
|
|
18768
|
+
IsConstructor: () => IsConstructor2,
|
|
18769
|
+
IsDate: () => IsDate3,
|
|
18770
|
+
IsFunction: () => IsFunction3,
|
|
18771
|
+
IsImport: () => IsImport,
|
|
18772
|
+
IsInteger: () => IsInteger2,
|
|
18773
|
+
IsIntersect: () => IsIntersect2,
|
|
18774
|
+
IsIterator: () => IsIterator3,
|
|
18775
|
+
IsKind: () => IsKind2,
|
|
18776
|
+
IsKindOf: () => IsKindOf2,
|
|
18777
|
+
IsLiteral: () => IsLiteral2,
|
|
18778
|
+
IsLiteralBoolean: () => IsLiteralBoolean,
|
|
18779
|
+
IsLiteralNumber: () => IsLiteralNumber,
|
|
18780
|
+
IsLiteralString: () => IsLiteralString,
|
|
18781
|
+
IsLiteralValue: () => IsLiteralValue2,
|
|
18782
|
+
IsMappedKey: () => IsMappedKey2,
|
|
18783
|
+
IsMappedResult: () => IsMappedResult2,
|
|
18784
|
+
IsNever: () => IsNever2,
|
|
18785
|
+
IsNot: () => IsNot2,
|
|
18786
|
+
IsNull: () => IsNull3,
|
|
18787
|
+
IsNumber: () => IsNumber4,
|
|
18788
|
+
IsObject: () => IsObject4,
|
|
18789
|
+
IsOptional: () => IsOptional2,
|
|
18790
|
+
IsPromise: () => IsPromise2,
|
|
18791
|
+
IsProperties: () => IsProperties,
|
|
18792
|
+
IsReadonly: () => IsReadonly2,
|
|
18793
|
+
IsRecord: () => IsRecord2,
|
|
18794
|
+
IsRecursive: () => IsRecursive,
|
|
18795
|
+
IsRef: () => IsRef2,
|
|
18796
|
+
IsRegExp: () => IsRegExp3,
|
|
18797
|
+
IsSchema: () => IsSchema2,
|
|
18798
|
+
IsString: () => IsString3,
|
|
18799
|
+
IsSymbol: () => IsSymbol3,
|
|
18800
|
+
IsTemplateLiteral: () => IsTemplateLiteral2,
|
|
18801
|
+
IsThis: () => IsThis2,
|
|
18802
|
+
IsTransform: () => IsTransform2,
|
|
18803
|
+
IsTuple: () => IsTuple2,
|
|
18804
|
+
IsUint8Array: () => IsUint8Array3,
|
|
18805
|
+
IsUndefined: () => IsUndefined4,
|
|
18806
|
+
IsUnion: () => IsUnion2,
|
|
18807
|
+
IsUnionLiteral: () => IsUnionLiteral,
|
|
18808
|
+
IsUnknown: () => IsUnknown2,
|
|
18809
|
+
IsUnsafe: () => IsUnsafe2,
|
|
18810
|
+
IsVoid: () => IsVoid2,
|
|
18811
|
+
TypeGuardUnknownTypeError: () => TypeGuardUnknownTypeError
|
|
18812
|
+
});
|
|
18813
|
+
var TypeGuardUnknownTypeError = class extends TypeBoxError {
|
|
18814
|
+
};
|
|
18815
|
+
var KnownTypes = [
|
|
18816
|
+
"Argument",
|
|
18817
|
+
"Any",
|
|
18818
|
+
"Array",
|
|
18819
|
+
"AsyncIterator",
|
|
18820
|
+
"BigInt",
|
|
18821
|
+
"Boolean",
|
|
18822
|
+
"Computed",
|
|
18823
|
+
"Constructor",
|
|
18824
|
+
"Date",
|
|
18825
|
+
"Enum",
|
|
18826
|
+
"Function",
|
|
18827
|
+
"Integer",
|
|
18828
|
+
"Intersect",
|
|
18829
|
+
"Iterator",
|
|
18830
|
+
"Literal",
|
|
18831
|
+
"MappedKey",
|
|
18832
|
+
"MappedResult",
|
|
18833
|
+
"Not",
|
|
18834
|
+
"Null",
|
|
18835
|
+
"Number",
|
|
18836
|
+
"Object",
|
|
18837
|
+
"Promise",
|
|
18838
|
+
"Record",
|
|
18839
|
+
"Ref",
|
|
18840
|
+
"RegExp",
|
|
18841
|
+
"String",
|
|
18842
|
+
"Symbol",
|
|
18843
|
+
"TemplateLiteral",
|
|
18844
|
+
"This",
|
|
18845
|
+
"Tuple",
|
|
18846
|
+
"Undefined",
|
|
18847
|
+
"Union",
|
|
18848
|
+
"Uint8Array",
|
|
18849
|
+
"Unknown",
|
|
18850
|
+
"Void"
|
|
18851
|
+
];
|
|
18852
|
+
function IsPattern(value) {
|
|
18853
|
+
try {
|
|
18854
|
+
new RegExp(value);
|
|
18855
|
+
return true;
|
|
18856
|
+
} catch {
|
|
18857
|
+
return false;
|
|
18858
|
+
}
|
|
18859
|
+
}
|
|
18860
|
+
function IsControlCharacterFree(value) {
|
|
18861
|
+
if (!IsString(value))
|
|
18862
|
+
return false;
|
|
18863
|
+
for (let i = 0; i < value.length; i++) {
|
|
18864
|
+
const code = value.charCodeAt(i);
|
|
18865
|
+
if (code >= 7 && code <= 13 || code === 27 || code === 127) {
|
|
18866
|
+
return false;
|
|
18867
|
+
}
|
|
18868
|
+
}
|
|
18869
|
+
return true;
|
|
18870
|
+
}
|
|
18871
|
+
function IsAdditionalProperties(value) {
|
|
18872
|
+
return IsOptionalBoolean(value) || IsSchema2(value);
|
|
18873
|
+
}
|
|
18874
|
+
function IsOptionalBigInt(value) {
|
|
18875
|
+
return IsUndefined(value) || IsBigInt(value);
|
|
18876
|
+
}
|
|
18877
|
+
function IsOptionalNumber(value) {
|
|
18878
|
+
return IsUndefined(value) || IsNumber(value);
|
|
18879
|
+
}
|
|
18880
|
+
function IsOptionalBoolean(value) {
|
|
18881
|
+
return IsUndefined(value) || IsBoolean(value);
|
|
18882
|
+
}
|
|
18883
|
+
function IsOptionalString(value) {
|
|
18884
|
+
return IsUndefined(value) || IsString(value);
|
|
18885
|
+
}
|
|
18886
|
+
function IsOptionalPattern(value) {
|
|
18887
|
+
return IsUndefined(value) || IsString(value) && IsControlCharacterFree(value) && IsPattern(value);
|
|
18888
|
+
}
|
|
18889
|
+
function IsOptionalFormat(value) {
|
|
18890
|
+
return IsUndefined(value) || IsString(value) && IsControlCharacterFree(value);
|
|
18891
|
+
}
|
|
18892
|
+
function IsOptionalSchema(value) {
|
|
18893
|
+
return IsUndefined(value) || IsSchema2(value);
|
|
18894
|
+
}
|
|
18895
|
+
function IsReadonly2(value) {
|
|
18896
|
+
return IsObject(value) && value[ReadonlyKind] === "Readonly";
|
|
18897
|
+
}
|
|
18898
|
+
function IsOptional2(value) {
|
|
18899
|
+
return IsObject(value) && value[OptionalKind] === "Optional";
|
|
18900
|
+
}
|
|
18901
|
+
function IsAny2(value) {
|
|
18902
|
+
return IsKindOf2(value, "Any") && IsOptionalString(value.$id);
|
|
18903
|
+
}
|
|
18904
|
+
function IsArgument2(value) {
|
|
18905
|
+
return IsKindOf2(value, "Argument") && IsNumber(value.index);
|
|
18906
|
+
}
|
|
18907
|
+
function IsArray4(value) {
|
|
18908
|
+
return IsKindOf2(value, "Array") && value.type === "array" && IsOptionalString(value.$id) && IsSchema2(value.items) && IsOptionalNumber(value.minItems) && IsOptionalNumber(value.maxItems) && IsOptionalBoolean(value.uniqueItems) && IsOptionalSchema(value.contains) && IsOptionalNumber(value.minContains) && IsOptionalNumber(value.maxContains);
|
|
18909
|
+
}
|
|
18910
|
+
function IsAsyncIterator3(value) {
|
|
18911
|
+
return IsKindOf2(value, "AsyncIterator") && value.type === "AsyncIterator" && IsOptionalString(value.$id) && IsSchema2(value.items);
|
|
18912
|
+
}
|
|
18913
|
+
function IsBigInt3(value) {
|
|
18914
|
+
return IsKindOf2(value, "BigInt") && value.type === "bigint" && IsOptionalString(value.$id) && IsOptionalBigInt(value.exclusiveMaximum) && IsOptionalBigInt(value.exclusiveMinimum) && IsOptionalBigInt(value.maximum) && IsOptionalBigInt(value.minimum) && IsOptionalBigInt(value.multipleOf);
|
|
18915
|
+
}
|
|
18916
|
+
function IsBoolean3(value) {
|
|
18917
|
+
return IsKindOf2(value, "Boolean") && value.type === "boolean" && IsOptionalString(value.$id);
|
|
18918
|
+
}
|
|
18919
|
+
function IsComputed2(value) {
|
|
18920
|
+
return IsKindOf2(value, "Computed") && IsString(value.target) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema2(schema));
|
|
18921
|
+
}
|
|
18922
|
+
function IsConstructor2(value) {
|
|
18923
|
+
return IsKindOf2(value, "Constructor") && value.type === "Constructor" && IsOptionalString(value.$id) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema2(schema)) && IsSchema2(value.returns);
|
|
18924
|
+
}
|
|
18925
|
+
function IsDate3(value) {
|
|
18926
|
+
return IsKindOf2(value, "Date") && value.type === "Date" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximumTimestamp) && IsOptionalNumber(value.exclusiveMinimumTimestamp) && IsOptionalNumber(value.maximumTimestamp) && IsOptionalNumber(value.minimumTimestamp) && IsOptionalNumber(value.multipleOfTimestamp);
|
|
18927
|
+
}
|
|
18928
|
+
function IsFunction3(value) {
|
|
18929
|
+
return IsKindOf2(value, "Function") && value.type === "Function" && IsOptionalString(value.$id) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema2(schema)) && IsSchema2(value.returns);
|
|
18930
|
+
}
|
|
18931
|
+
function IsImport(value) {
|
|
18932
|
+
return IsKindOf2(value, "Import") && HasPropertyKey(value, "$defs") && IsObject(value.$defs) && IsProperties(value.$defs) && HasPropertyKey(value, "$ref") && IsString(value.$ref) && value.$ref in value.$defs;
|
|
18933
|
+
}
|
|
18934
|
+
function IsInteger2(value) {
|
|
18935
|
+
return IsKindOf2(value, "Integer") && value.type === "integer" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximum) && IsOptionalNumber(value.exclusiveMinimum) && IsOptionalNumber(value.maximum) && IsOptionalNumber(value.minimum) && IsOptionalNumber(value.multipleOf);
|
|
18936
|
+
}
|
|
18937
|
+
function IsProperties(value) {
|
|
18938
|
+
return IsObject(value) && Object.entries(value).every(([key, schema]) => IsControlCharacterFree(key) && IsSchema2(schema));
|
|
18939
|
+
}
|
|
18940
|
+
function IsIntersect2(value) {
|
|
18941
|
+
return IsKindOf2(value, "Intersect") && (IsString(value.type) && value.type !== "object" ? false : true) && IsArray(value.allOf) && value.allOf.every((schema) => IsSchema2(schema) && !IsTransform2(schema)) && IsOptionalString(value.type) && (IsOptionalBoolean(value.unevaluatedProperties) || IsOptionalSchema(value.unevaluatedProperties)) && IsOptionalString(value.$id);
|
|
18942
|
+
}
|
|
18943
|
+
function IsIterator3(value) {
|
|
18944
|
+
return IsKindOf2(value, "Iterator") && value.type === "Iterator" && IsOptionalString(value.$id) && IsSchema2(value.items);
|
|
18945
|
+
}
|
|
18946
|
+
function IsKindOf2(value, kind) {
|
|
18947
|
+
return IsObject(value) && Kind in value && value[Kind] === kind;
|
|
18948
|
+
}
|
|
18949
|
+
function IsLiteralString(value) {
|
|
18950
|
+
return IsLiteral2(value) && IsString(value.const);
|
|
18951
|
+
}
|
|
18952
|
+
function IsLiteralNumber(value) {
|
|
18953
|
+
return IsLiteral2(value) && IsNumber(value.const);
|
|
18954
|
+
}
|
|
18955
|
+
function IsLiteralBoolean(value) {
|
|
18956
|
+
return IsLiteral2(value) && IsBoolean(value.const);
|
|
18957
|
+
}
|
|
18958
|
+
function IsLiteral2(value) {
|
|
18959
|
+
return IsKindOf2(value, "Literal") && IsOptionalString(value.$id) && IsLiteralValue2(value.const);
|
|
18960
|
+
}
|
|
18961
|
+
function IsLiteralValue2(value) {
|
|
18962
|
+
return IsBoolean(value) || IsNumber(value) || IsString(value);
|
|
18963
|
+
}
|
|
18964
|
+
function IsMappedKey2(value) {
|
|
18965
|
+
return IsKindOf2(value, "MappedKey") && IsArray(value.keys) && value.keys.every((key) => IsNumber(key) || IsString(key));
|
|
18966
|
+
}
|
|
18967
|
+
function IsMappedResult2(value) {
|
|
18968
|
+
return IsKindOf2(value, "MappedResult") && IsProperties(value.properties);
|
|
18969
|
+
}
|
|
18970
|
+
function IsNever2(value) {
|
|
18971
|
+
return IsKindOf2(value, "Never") && IsObject(value.not) && Object.getOwnPropertyNames(value.not).length === 0;
|
|
18972
|
+
}
|
|
18973
|
+
function IsNot2(value) {
|
|
18974
|
+
return IsKindOf2(value, "Not") && IsSchema2(value.not);
|
|
18975
|
+
}
|
|
18976
|
+
function IsNull3(value) {
|
|
18977
|
+
return IsKindOf2(value, "Null") && value.type === "null" && IsOptionalString(value.$id);
|
|
18978
|
+
}
|
|
18979
|
+
function IsNumber4(value) {
|
|
18980
|
+
return IsKindOf2(value, "Number") && value.type === "number" && IsOptionalString(value.$id) && IsOptionalNumber(value.exclusiveMaximum) && IsOptionalNumber(value.exclusiveMinimum) && IsOptionalNumber(value.maximum) && IsOptionalNumber(value.minimum) && IsOptionalNumber(value.multipleOf);
|
|
18981
|
+
}
|
|
18982
|
+
function IsObject4(value) {
|
|
18983
|
+
return IsKindOf2(value, "Object") && value.type === "object" && IsOptionalString(value.$id) && IsProperties(value.properties) && IsAdditionalProperties(value.additionalProperties) && IsOptionalNumber(value.minProperties) && IsOptionalNumber(value.maxProperties);
|
|
18984
|
+
}
|
|
18985
|
+
function IsPromise2(value) {
|
|
18986
|
+
return IsKindOf2(value, "Promise") && value.type === "Promise" && IsOptionalString(value.$id) && IsSchema2(value.item);
|
|
18987
|
+
}
|
|
18988
|
+
function IsRecord2(value) {
|
|
18989
|
+
return IsKindOf2(value, "Record") && value.type === "object" && IsOptionalString(value.$id) && IsAdditionalProperties(value.additionalProperties) && IsObject(value.patternProperties) && ((schema) => {
|
|
18990
|
+
const keys = Object.getOwnPropertyNames(schema.patternProperties);
|
|
18991
|
+
return keys.length === 1 && IsPattern(keys[0]) && IsObject(schema.patternProperties) && IsSchema2(schema.patternProperties[keys[0]]);
|
|
18992
|
+
})(value);
|
|
18993
|
+
}
|
|
18994
|
+
function IsRecursive(value) {
|
|
18995
|
+
return IsObject(value) && Hint in value && value[Hint] === "Recursive";
|
|
18996
|
+
}
|
|
18997
|
+
function IsRef2(value) {
|
|
18998
|
+
return IsKindOf2(value, "Ref") && IsOptionalString(value.$id) && IsString(value.$ref);
|
|
18999
|
+
}
|
|
19000
|
+
function IsRegExp3(value) {
|
|
19001
|
+
return IsKindOf2(value, "RegExp") && IsOptionalString(value.$id) && IsString(value.source) && IsString(value.flags) && IsOptionalNumber(value.maxLength) && IsOptionalNumber(value.minLength);
|
|
19002
|
+
}
|
|
19003
|
+
function IsString3(value) {
|
|
19004
|
+
return IsKindOf2(value, "String") && value.type === "string" && IsOptionalString(value.$id) && IsOptionalNumber(value.minLength) && IsOptionalNumber(value.maxLength) && IsOptionalPattern(value.pattern) && IsOptionalFormat(value.format);
|
|
19005
|
+
}
|
|
19006
|
+
function IsSymbol3(value) {
|
|
19007
|
+
return IsKindOf2(value, "Symbol") && value.type === "symbol" && IsOptionalString(value.$id);
|
|
19008
|
+
}
|
|
19009
|
+
function IsTemplateLiteral2(value) {
|
|
19010
|
+
return IsKindOf2(value, "TemplateLiteral") && value.type === "string" && IsString(value.pattern) && value.pattern[0] === "^" && value.pattern[value.pattern.length - 1] === "$";
|
|
19011
|
+
}
|
|
19012
|
+
function IsThis2(value) {
|
|
19013
|
+
return IsKindOf2(value, "This") && IsOptionalString(value.$id) && IsString(value.$ref);
|
|
19014
|
+
}
|
|
19015
|
+
function IsTransform2(value) {
|
|
19016
|
+
return IsObject(value) && TransformKind in value;
|
|
19017
|
+
}
|
|
19018
|
+
function IsTuple2(value) {
|
|
19019
|
+
return IsKindOf2(value, "Tuple") && value.type === "array" && IsOptionalString(value.$id) && IsNumber(value.minItems) && IsNumber(value.maxItems) && value.minItems === value.maxItems && // empty
|
|
19020
|
+
(IsUndefined(value.items) && IsUndefined(value.additionalItems) && value.minItems === 0 || IsArray(value.items) && value.items.every((schema) => IsSchema2(schema)));
|
|
19021
|
+
}
|
|
19022
|
+
function IsUndefined4(value) {
|
|
19023
|
+
return IsKindOf2(value, "Undefined") && value.type === "undefined" && IsOptionalString(value.$id);
|
|
19024
|
+
}
|
|
19025
|
+
function IsUnionLiteral(value) {
|
|
19026
|
+
return IsUnion2(value) && value.anyOf.every((schema) => IsLiteralString(schema) || IsLiteralNumber(schema));
|
|
19027
|
+
}
|
|
19028
|
+
function IsUnion2(value) {
|
|
19029
|
+
return IsKindOf2(value, "Union") && IsOptionalString(value.$id) && IsObject(value) && IsArray(value.anyOf) && value.anyOf.every((schema) => IsSchema2(schema));
|
|
19030
|
+
}
|
|
19031
|
+
function IsUint8Array3(value) {
|
|
19032
|
+
return IsKindOf2(value, "Uint8Array") && value.type === "Uint8Array" && IsOptionalString(value.$id) && IsOptionalNumber(value.minByteLength) && IsOptionalNumber(value.maxByteLength);
|
|
19033
|
+
}
|
|
19034
|
+
function IsUnknown2(value) {
|
|
19035
|
+
return IsKindOf2(value, "Unknown") && IsOptionalString(value.$id);
|
|
19036
|
+
}
|
|
19037
|
+
function IsUnsafe2(value) {
|
|
19038
|
+
return IsKindOf2(value, "Unsafe");
|
|
19039
|
+
}
|
|
19040
|
+
function IsVoid2(value) {
|
|
19041
|
+
return IsKindOf2(value, "Void") && value.type === "void" && IsOptionalString(value.$id);
|
|
19042
|
+
}
|
|
19043
|
+
function IsKind2(value) {
|
|
19044
|
+
return IsObject(value) && Kind in value && IsString(value[Kind]) && !KnownTypes.includes(value[Kind]);
|
|
19045
|
+
}
|
|
19046
|
+
function IsSchema2(value) {
|
|
19047
|
+
return IsObject(value) && (IsAny2(value) || IsArgument2(value) || IsArray4(value) || IsBoolean3(value) || IsBigInt3(value) || IsAsyncIterator3(value) || IsComputed2(value) || IsConstructor2(value) || IsDate3(value) || IsFunction3(value) || IsInteger2(value) || IsIntersect2(value) || IsIterator3(value) || IsLiteral2(value) || IsMappedKey2(value) || IsMappedResult2(value) || IsNever2(value) || IsNot2(value) || IsNull3(value) || IsNumber4(value) || IsObject4(value) || IsPromise2(value) || IsRecord2(value) || IsRef2(value) || IsRegExp3(value) || IsString3(value) || IsSymbol3(value) || IsTemplateLiteral2(value) || IsThis2(value) || IsTuple2(value) || IsUndefined4(value) || IsUnion2(value) || IsUint8Array3(value) || IsUnknown2(value) || IsUnsafe2(value) || IsVoid2(value) || IsKind2(value));
|
|
19048
|
+
}
|
|
19049
|
+
|
|
19050
|
+
// node_modules/@sinclair/typebox/build/esm/type/patterns/patterns.mjs
|
|
19051
|
+
var PatternBoolean = "(true|false)";
|
|
19052
|
+
var PatternNumber = "(0|[1-9][0-9]*)";
|
|
19053
|
+
var PatternString = "(.*)";
|
|
19054
|
+
var PatternNever = "(?!.*)";
|
|
19055
|
+
var PatternBooleanExact = `^${PatternBoolean}$`;
|
|
19056
|
+
var PatternNumberExact = `^${PatternNumber}$`;
|
|
19057
|
+
var PatternStringExact = `^${PatternString}$`;
|
|
19058
|
+
var PatternNeverExact = `^${PatternNever}$`;
|
|
19059
|
+
|
|
19060
|
+
// node_modules/@sinclair/typebox/build/esm/type/sets/set.mjs
|
|
19061
|
+
function SetIncludes(T, S) {
|
|
19062
|
+
return T.includes(S);
|
|
19063
|
+
}
|
|
19064
|
+
function SetDistinct(T) {
|
|
19065
|
+
return [...new Set(T)];
|
|
19066
|
+
}
|
|
19067
|
+
function SetIntersect(T, S) {
|
|
19068
|
+
return T.filter((L) => S.includes(L));
|
|
19069
|
+
}
|
|
19070
|
+
function SetIntersectManyResolve(T, Init) {
|
|
19071
|
+
return T.reduce((Acc, L) => {
|
|
19072
|
+
return SetIntersect(Acc, L);
|
|
19073
|
+
}, Init);
|
|
19074
|
+
}
|
|
19075
|
+
function SetIntersectMany(T) {
|
|
19076
|
+
return T.length === 1 ? T[0] : T.length > 1 ? SetIntersectManyResolve(T.slice(1), T[0]) : [];
|
|
19077
|
+
}
|
|
19078
|
+
function SetUnionMany(T) {
|
|
19079
|
+
const Acc = [];
|
|
19080
|
+
for (const L of T)
|
|
19081
|
+
Acc.push(...L);
|
|
19082
|
+
return Acc;
|
|
19083
|
+
}
|
|
19084
|
+
|
|
19085
|
+
// node_modules/@sinclair/typebox/build/esm/type/any/any.mjs
|
|
19086
|
+
function Any(options) {
|
|
19087
|
+
return CreateType({ [Kind]: "Any" }, options);
|
|
19088
|
+
}
|
|
19089
|
+
|
|
19090
|
+
// node_modules/@sinclair/typebox/build/esm/type/array/array.mjs
|
|
19091
|
+
function Array2(items, options) {
|
|
19092
|
+
return CreateType({ [Kind]: "Array", type: "array", items }, options);
|
|
19093
|
+
}
|
|
19094
|
+
|
|
19095
|
+
// node_modules/@sinclair/typebox/build/esm/type/argument/argument.mjs
|
|
19096
|
+
function Argument(index) {
|
|
19097
|
+
return CreateType({ [Kind]: "Argument", index });
|
|
19098
|
+
}
|
|
19099
|
+
|
|
19100
|
+
// node_modules/@sinclair/typebox/build/esm/type/async-iterator/async-iterator.mjs
|
|
19101
|
+
function AsyncIterator(items, options) {
|
|
19102
|
+
return CreateType({ [Kind]: "AsyncIterator", type: "AsyncIterator", items }, options);
|
|
19103
|
+
}
|
|
19104
|
+
|
|
19105
|
+
// node_modules/@sinclair/typebox/build/esm/type/computed/computed.mjs
|
|
19106
|
+
function Computed(target, parameters, options) {
|
|
19107
|
+
return CreateType({ [Kind]: "Computed", target, parameters }, options);
|
|
19108
|
+
}
|
|
19109
|
+
|
|
19110
|
+
// node_modules/@sinclair/typebox/build/esm/type/discard/discard.mjs
|
|
19111
|
+
function DiscardKey(value, key) {
|
|
19112
|
+
const { [key]: _, ...rest } = value;
|
|
19113
|
+
return rest;
|
|
19114
|
+
}
|
|
19115
|
+
function Discard(value, keys) {
|
|
19116
|
+
return keys.reduce((acc, key) => DiscardKey(acc, key), value);
|
|
19117
|
+
}
|
|
19118
|
+
|
|
19119
|
+
// node_modules/@sinclair/typebox/build/esm/type/never/never.mjs
|
|
19120
|
+
function Never(options) {
|
|
19121
|
+
return CreateType({ [Kind]: "Never", not: {} }, options);
|
|
19122
|
+
}
|
|
19123
|
+
|
|
19124
|
+
// node_modules/@sinclair/typebox/build/esm/type/mapped/mapped-result.mjs
|
|
19125
|
+
function MappedResult(properties) {
|
|
19126
|
+
return CreateType({
|
|
19127
|
+
[Kind]: "MappedResult",
|
|
19128
|
+
properties
|
|
19129
|
+
});
|
|
19130
|
+
}
|
|
19131
|
+
|
|
19132
|
+
// node_modules/@sinclair/typebox/build/esm/type/constructor/constructor.mjs
|
|
19133
|
+
function Constructor(parameters, returns, options) {
|
|
19134
|
+
return CreateType({ [Kind]: "Constructor", type: "Constructor", parameters, returns }, options);
|
|
19135
|
+
}
|
|
19136
|
+
|
|
19137
|
+
// node_modules/@sinclair/typebox/build/esm/type/function/function.mjs
|
|
19138
|
+
function Function2(parameters, returns, options) {
|
|
19139
|
+
return CreateType({ [Kind]: "Function", type: "Function", parameters, returns }, options);
|
|
19140
|
+
}
|
|
19141
|
+
|
|
19142
|
+
// node_modules/@sinclair/typebox/build/esm/type/union/union-create.mjs
|
|
19143
|
+
function UnionCreate(T, options) {
|
|
19144
|
+
return CreateType({ [Kind]: "Union", anyOf: T }, options);
|
|
19145
|
+
}
|
|
19146
|
+
|
|
19147
|
+
// node_modules/@sinclair/typebox/build/esm/type/union/union-evaluated.mjs
|
|
19148
|
+
function IsUnionOptional(types2) {
|
|
19149
|
+
return types2.some((type) => IsOptional(type));
|
|
19150
|
+
}
|
|
19151
|
+
function RemoveOptionalFromRest(types2) {
|
|
19152
|
+
return types2.map((left) => IsOptional(left) ? RemoveOptionalFromType(left) : left);
|
|
19153
|
+
}
|
|
19154
|
+
function RemoveOptionalFromType(T) {
|
|
19155
|
+
return Discard(T, [OptionalKind]);
|
|
19156
|
+
}
|
|
19157
|
+
function ResolveUnion(types2, options) {
|
|
19158
|
+
const isOptional = IsUnionOptional(types2);
|
|
19159
|
+
return isOptional ? Optional(UnionCreate(RemoveOptionalFromRest(types2), options)) : UnionCreate(RemoveOptionalFromRest(types2), options);
|
|
19160
|
+
}
|
|
19161
|
+
function UnionEvaluated(T, options) {
|
|
19162
|
+
return T.length === 1 ? CreateType(T[0], options) : T.length === 0 ? Never(options) : ResolveUnion(T, options);
|
|
19163
|
+
}
|
|
19164
|
+
|
|
19165
|
+
// node_modules/@sinclair/typebox/build/esm/type/union/union.mjs
|
|
19166
|
+
function Union(types2, options) {
|
|
19167
|
+
return types2.length === 0 ? Never(options) : types2.length === 1 ? CreateType(types2[0], options) : UnionCreate(types2, options);
|
|
19168
|
+
}
|
|
19169
|
+
|
|
19170
|
+
// node_modules/@sinclair/typebox/build/esm/type/template-literal/parse.mjs
|
|
19171
|
+
var TemplateLiteralParserError = class extends TypeBoxError {
|
|
19172
|
+
};
|
|
19173
|
+
function Unescape(pattern) {
|
|
19174
|
+
return pattern.replace(/\\\$/g, "$").replace(/\\\*/g, "*").replace(/\\\^/g, "^").replace(/\\\|/g, "|").replace(/\\\(/g, "(").replace(/\\\)/g, ")");
|
|
19175
|
+
}
|
|
19176
|
+
function IsNonEscaped(pattern, index, char) {
|
|
19177
|
+
return pattern[index] === char && pattern.charCodeAt(index - 1) !== 92;
|
|
19178
|
+
}
|
|
19179
|
+
function IsOpenParen(pattern, index) {
|
|
19180
|
+
return IsNonEscaped(pattern, index, "(");
|
|
19181
|
+
}
|
|
19182
|
+
function IsCloseParen(pattern, index) {
|
|
19183
|
+
return IsNonEscaped(pattern, index, ")");
|
|
19184
|
+
}
|
|
19185
|
+
function IsSeparator(pattern, index) {
|
|
19186
|
+
return IsNonEscaped(pattern, index, "|");
|
|
19187
|
+
}
|
|
19188
|
+
function IsGroup(pattern) {
|
|
19189
|
+
if (!(IsOpenParen(pattern, 0) && IsCloseParen(pattern, pattern.length - 1)))
|
|
19190
|
+
return false;
|
|
19191
|
+
let count = 0;
|
|
19192
|
+
for (let index = 0; index < pattern.length; index++) {
|
|
19193
|
+
if (IsOpenParen(pattern, index))
|
|
19194
|
+
count += 1;
|
|
19195
|
+
if (IsCloseParen(pattern, index))
|
|
19196
|
+
count -= 1;
|
|
19197
|
+
if (count === 0 && index !== pattern.length - 1)
|
|
19198
|
+
return false;
|
|
19199
|
+
}
|
|
19200
|
+
return true;
|
|
19201
|
+
}
|
|
19202
|
+
function InGroup(pattern) {
|
|
19203
|
+
return pattern.slice(1, pattern.length - 1);
|
|
19204
|
+
}
|
|
19205
|
+
function IsPrecedenceOr(pattern) {
|
|
19206
|
+
let count = 0;
|
|
19207
|
+
for (let index = 0; index < pattern.length; index++) {
|
|
19208
|
+
if (IsOpenParen(pattern, index))
|
|
19209
|
+
count += 1;
|
|
19210
|
+
if (IsCloseParen(pattern, index))
|
|
19211
|
+
count -= 1;
|
|
19212
|
+
if (IsSeparator(pattern, index) && count === 0)
|
|
19213
|
+
return true;
|
|
19214
|
+
}
|
|
19215
|
+
return false;
|
|
19216
|
+
}
|
|
19217
|
+
function IsPrecedenceAnd(pattern) {
|
|
19218
|
+
for (let index = 0; index < pattern.length; index++) {
|
|
19219
|
+
if (IsOpenParen(pattern, index))
|
|
19220
|
+
return true;
|
|
19221
|
+
}
|
|
19222
|
+
return false;
|
|
19223
|
+
}
|
|
19224
|
+
function Or(pattern) {
|
|
19225
|
+
let [count, start] = [0, 0];
|
|
19226
|
+
const expressions = [];
|
|
19227
|
+
for (let index = 0; index < pattern.length; index++) {
|
|
19228
|
+
if (IsOpenParen(pattern, index))
|
|
19229
|
+
count += 1;
|
|
19230
|
+
if (IsCloseParen(pattern, index))
|
|
19231
|
+
count -= 1;
|
|
19232
|
+
if (IsSeparator(pattern, index) && count === 0) {
|
|
19233
|
+
const range3 = pattern.slice(start, index);
|
|
19234
|
+
if (range3.length > 0)
|
|
19235
|
+
expressions.push(TemplateLiteralParse(range3));
|
|
19236
|
+
start = index + 1;
|
|
19237
|
+
}
|
|
19238
|
+
}
|
|
19239
|
+
const range2 = pattern.slice(start);
|
|
19240
|
+
if (range2.length > 0)
|
|
19241
|
+
expressions.push(TemplateLiteralParse(range2));
|
|
19242
|
+
if (expressions.length === 0)
|
|
19243
|
+
return { type: "const", const: "" };
|
|
19244
|
+
if (expressions.length === 1)
|
|
19245
|
+
return expressions[0];
|
|
19246
|
+
return { type: "or", expr: expressions };
|
|
19247
|
+
}
|
|
19248
|
+
function And(pattern) {
|
|
19249
|
+
function Group(value, index) {
|
|
19250
|
+
if (!IsOpenParen(value, index))
|
|
19251
|
+
throw new TemplateLiteralParserError(`TemplateLiteralParser: Index must point to open parens`);
|
|
19252
|
+
let count = 0;
|
|
19253
|
+
for (let scan = index; scan < value.length; scan++) {
|
|
19254
|
+
if (IsOpenParen(value, scan))
|
|
19255
|
+
count += 1;
|
|
19256
|
+
if (IsCloseParen(value, scan))
|
|
19257
|
+
count -= 1;
|
|
19258
|
+
if (count === 0)
|
|
19259
|
+
return [index, scan];
|
|
19260
|
+
}
|
|
19261
|
+
throw new TemplateLiteralParserError(`TemplateLiteralParser: Unclosed group parens in expression`);
|
|
19262
|
+
}
|
|
19263
|
+
function Range(pattern2, index) {
|
|
19264
|
+
for (let scan = index; scan < pattern2.length; scan++) {
|
|
19265
|
+
if (IsOpenParen(pattern2, scan))
|
|
19266
|
+
return [index, scan];
|
|
19267
|
+
}
|
|
19268
|
+
return [index, pattern2.length];
|
|
19269
|
+
}
|
|
19270
|
+
const expressions = [];
|
|
19271
|
+
for (let index = 0; index < pattern.length; index++) {
|
|
19272
|
+
if (IsOpenParen(pattern, index)) {
|
|
19273
|
+
const [start, end] = Group(pattern, index);
|
|
19274
|
+
const range2 = pattern.slice(start, end + 1);
|
|
19275
|
+
expressions.push(TemplateLiteralParse(range2));
|
|
19276
|
+
index = end;
|
|
19277
|
+
} else {
|
|
19278
|
+
const [start, end] = Range(pattern, index);
|
|
19279
|
+
const range2 = pattern.slice(start, end);
|
|
19280
|
+
if (range2.length > 0)
|
|
19281
|
+
expressions.push(TemplateLiteralParse(range2));
|
|
19282
|
+
index = end - 1;
|
|
19283
|
+
}
|
|
19284
|
+
}
|
|
19285
|
+
return expressions.length === 0 ? { type: "const", const: "" } : expressions.length === 1 ? expressions[0] : { type: "and", expr: expressions };
|
|
19286
|
+
}
|
|
19287
|
+
function TemplateLiteralParse(pattern) {
|
|
19288
|
+
return IsGroup(pattern) ? TemplateLiteralParse(InGroup(pattern)) : IsPrecedenceOr(pattern) ? Or(pattern) : IsPrecedenceAnd(pattern) ? And(pattern) : { type: "const", const: Unescape(pattern) };
|
|
19289
|
+
}
|
|
19290
|
+
function TemplateLiteralParseExact(pattern) {
|
|
19291
|
+
return TemplateLiteralParse(pattern.slice(1, pattern.length - 1));
|
|
19292
|
+
}
|
|
19293
|
+
|
|
19294
|
+
// node_modules/@sinclair/typebox/build/esm/type/template-literal/finite.mjs
|
|
19295
|
+
var TemplateLiteralFiniteError = class extends TypeBoxError {
|
|
19296
|
+
};
|
|
19297
|
+
function IsNumberExpression(expression) {
|
|
19298
|
+
return expression.type === "or" && expression.expr.length === 2 && expression.expr[0].type === "const" && expression.expr[0].const === "0" && expression.expr[1].type === "const" && expression.expr[1].const === "[1-9][0-9]*";
|
|
19299
|
+
}
|
|
19300
|
+
function IsBooleanExpression(expression) {
|
|
19301
|
+
return expression.type === "or" && expression.expr.length === 2 && expression.expr[0].type === "const" && expression.expr[0].const === "true" && expression.expr[1].type === "const" && expression.expr[1].const === "false";
|
|
19302
|
+
}
|
|
19303
|
+
function IsStringExpression(expression) {
|
|
19304
|
+
return expression.type === "const" && expression.const === ".*";
|
|
19305
|
+
}
|
|
19306
|
+
function IsTemplateLiteralExpressionFinite(expression) {
|
|
19307
|
+
return IsNumberExpression(expression) || IsStringExpression(expression) ? false : IsBooleanExpression(expression) ? true : expression.type === "and" ? expression.expr.every((expr) => IsTemplateLiteralExpressionFinite(expr)) : expression.type === "or" ? expression.expr.every((expr) => IsTemplateLiteralExpressionFinite(expr)) : expression.type === "const" ? true : (() => {
|
|
19308
|
+
throw new TemplateLiteralFiniteError(`Unknown expression type`);
|
|
19309
|
+
})();
|
|
19310
|
+
}
|
|
19311
|
+
function IsTemplateLiteralFinite(schema) {
|
|
19312
|
+
const expression = TemplateLiteralParseExact(schema.pattern);
|
|
19313
|
+
return IsTemplateLiteralExpressionFinite(expression);
|
|
19314
|
+
}
|
|
19315
|
+
|
|
19316
|
+
// node_modules/@sinclair/typebox/build/esm/type/template-literal/generate.mjs
|
|
19317
|
+
var TemplateLiteralGenerateError = class extends TypeBoxError {
|
|
19318
|
+
};
|
|
19319
|
+
function* GenerateReduce(buffer) {
|
|
19320
|
+
if (buffer.length === 1)
|
|
19321
|
+
return yield* buffer[0];
|
|
19322
|
+
for (const left of buffer[0]) {
|
|
19323
|
+
for (const right of GenerateReduce(buffer.slice(1))) {
|
|
19324
|
+
yield `${left}${right}`;
|
|
19325
|
+
}
|
|
19326
|
+
}
|
|
19327
|
+
}
|
|
19328
|
+
function* GenerateAnd(expression) {
|
|
19329
|
+
return yield* GenerateReduce(expression.expr.map((expr) => [...TemplateLiteralExpressionGenerate(expr)]));
|
|
19330
|
+
}
|
|
19331
|
+
function* GenerateOr(expression) {
|
|
19332
|
+
for (const expr of expression.expr)
|
|
19333
|
+
yield* TemplateLiteralExpressionGenerate(expr);
|
|
19334
|
+
}
|
|
19335
|
+
function* GenerateConst(expression) {
|
|
19336
|
+
return yield expression.const;
|
|
19337
|
+
}
|
|
19338
|
+
function* TemplateLiteralExpressionGenerate(expression) {
|
|
19339
|
+
return expression.type === "and" ? yield* GenerateAnd(expression) : expression.type === "or" ? yield* GenerateOr(expression) : expression.type === "const" ? yield* GenerateConst(expression) : (() => {
|
|
19340
|
+
throw new TemplateLiteralGenerateError("Unknown expression");
|
|
19341
|
+
})();
|
|
19342
|
+
}
|
|
19343
|
+
function TemplateLiteralGenerate(schema) {
|
|
19344
|
+
const expression = TemplateLiteralParseExact(schema.pattern);
|
|
19345
|
+
return IsTemplateLiteralExpressionFinite(expression) ? [...TemplateLiteralExpressionGenerate(expression)] : [];
|
|
19346
|
+
}
|
|
19347
|
+
|
|
19348
|
+
// node_modules/@sinclair/typebox/build/esm/type/literal/literal.mjs
|
|
19349
|
+
function Literal(value, options) {
|
|
19350
|
+
return CreateType({
|
|
19351
|
+
[Kind]: "Literal",
|
|
19352
|
+
const: value,
|
|
19353
|
+
type: typeof value
|
|
19354
|
+
}, options);
|
|
19355
|
+
}
|
|
19356
|
+
|
|
19357
|
+
// node_modules/@sinclair/typebox/build/esm/type/boolean/boolean.mjs
|
|
19358
|
+
function Boolean2(options) {
|
|
19359
|
+
return CreateType({ [Kind]: "Boolean", type: "boolean" }, options);
|
|
19360
|
+
}
|
|
19361
|
+
|
|
19362
|
+
// node_modules/@sinclair/typebox/build/esm/type/bigint/bigint.mjs
|
|
19363
|
+
function BigInt2(options) {
|
|
19364
|
+
return CreateType({ [Kind]: "BigInt", type: "bigint" }, options);
|
|
19365
|
+
}
|
|
19366
|
+
|
|
19367
|
+
// node_modules/@sinclair/typebox/build/esm/type/number/number.mjs
|
|
19368
|
+
function Number2(options) {
|
|
19369
|
+
return CreateType({ [Kind]: "Number", type: "number" }, options);
|
|
19370
|
+
}
|
|
19371
|
+
|
|
19372
|
+
// node_modules/@sinclair/typebox/build/esm/type/string/string.mjs
|
|
19373
|
+
function String2(options) {
|
|
19374
|
+
return CreateType({ [Kind]: "String", type: "string" }, options);
|
|
19375
|
+
}
|
|
19376
|
+
|
|
19377
|
+
// node_modules/@sinclair/typebox/build/esm/type/template-literal/syntax.mjs
|
|
19378
|
+
function* FromUnion(syntax) {
|
|
19379
|
+
const trim = syntax.trim().replace(/"|'/g, "");
|
|
19380
|
+
return trim === "boolean" ? yield Boolean2() : trim === "number" ? yield Number2() : trim === "bigint" ? yield BigInt2() : trim === "string" ? yield String2() : yield (() => {
|
|
19381
|
+
const literals = trim.split("|").map((literal) => Literal(literal.trim()));
|
|
19382
|
+
return literals.length === 0 ? Never() : literals.length === 1 ? literals[0] : UnionEvaluated(literals);
|
|
19383
|
+
})();
|
|
19384
|
+
}
|
|
19385
|
+
function* FromTerminal(syntax) {
|
|
19386
|
+
if (syntax[1] !== "{") {
|
|
19387
|
+
const L = Literal("$");
|
|
19388
|
+
const R = FromSyntax(syntax.slice(1));
|
|
19389
|
+
return yield* [L, ...R];
|
|
19390
|
+
}
|
|
19391
|
+
for (let i = 2; i < syntax.length; i++) {
|
|
19392
|
+
if (syntax[i] === "}") {
|
|
19393
|
+
const L = FromUnion(syntax.slice(2, i));
|
|
19394
|
+
const R = FromSyntax(syntax.slice(i + 1));
|
|
19395
|
+
return yield* [...L, ...R];
|
|
19396
|
+
}
|
|
19397
|
+
}
|
|
19398
|
+
yield Literal(syntax);
|
|
19399
|
+
}
|
|
19400
|
+
function* FromSyntax(syntax) {
|
|
19401
|
+
for (let i = 0; i < syntax.length; i++) {
|
|
19402
|
+
if (syntax[i] === "$") {
|
|
19403
|
+
const L = Literal(syntax.slice(0, i));
|
|
19404
|
+
const R = FromTerminal(syntax.slice(i));
|
|
19405
|
+
return yield* [L, ...R];
|
|
19406
|
+
}
|
|
19407
|
+
}
|
|
19408
|
+
yield Literal(syntax);
|
|
19409
|
+
}
|
|
19410
|
+
function TemplateLiteralSyntax(syntax) {
|
|
19411
|
+
return [...FromSyntax(syntax)];
|
|
19412
|
+
}
|
|
19413
|
+
|
|
19414
|
+
// node_modules/@sinclair/typebox/build/esm/type/template-literal/pattern.mjs
|
|
19415
|
+
var TemplateLiteralPatternError = class extends TypeBoxError {
|
|
19416
|
+
};
|
|
19417
|
+
function Escape(value) {
|
|
19418
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
19419
|
+
}
|
|
19420
|
+
function Visit2(schema, acc) {
|
|
19421
|
+
return IsTemplateLiteral(schema) ? schema.pattern.slice(1, schema.pattern.length - 1) : IsUnion(schema) ? `(${schema.anyOf.map((schema2) => Visit2(schema2, acc)).join("|")})` : IsNumber3(schema) ? `${acc}${PatternNumber}` : IsInteger(schema) ? `${acc}${PatternNumber}` : IsBigInt2(schema) ? `${acc}${PatternNumber}` : IsString2(schema) ? `${acc}${PatternString}` : IsLiteral(schema) ? `${acc}${Escape(schema.const.toString())}` : IsBoolean2(schema) ? `${acc}${PatternBoolean}` : (() => {
|
|
19422
|
+
throw new TemplateLiteralPatternError(`Unexpected Kind '${schema[Kind]}'`);
|
|
19423
|
+
})();
|
|
19424
|
+
}
|
|
19425
|
+
function TemplateLiteralPattern(kinds) {
|
|
19426
|
+
return `^${kinds.map((schema) => Visit2(schema, "")).join("")}$`;
|
|
19427
|
+
}
|
|
19428
|
+
|
|
19429
|
+
// node_modules/@sinclair/typebox/build/esm/type/template-literal/union.mjs
|
|
19430
|
+
function TemplateLiteralToUnion(schema) {
|
|
19431
|
+
const R = TemplateLiteralGenerate(schema);
|
|
19432
|
+
const L = R.map((S) => Literal(S));
|
|
19433
|
+
return UnionEvaluated(L);
|
|
19434
|
+
}
|
|
19435
|
+
|
|
19436
|
+
// node_modules/@sinclair/typebox/build/esm/type/template-literal/template-literal.mjs
|
|
19437
|
+
function TemplateLiteral(unresolved, options) {
|
|
19438
|
+
const pattern = IsString(unresolved) ? TemplateLiteralPattern(TemplateLiteralSyntax(unresolved)) : TemplateLiteralPattern(unresolved);
|
|
19439
|
+
return CreateType({ [Kind]: "TemplateLiteral", type: "string", pattern }, options);
|
|
19440
|
+
}
|
|
19441
|
+
|
|
19442
|
+
// node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-property-keys.mjs
|
|
19443
|
+
function FromTemplateLiteral(templateLiteral) {
|
|
19444
|
+
const keys = TemplateLiteralGenerate(templateLiteral);
|
|
19445
|
+
return keys.map((key) => key.toString());
|
|
19446
|
+
}
|
|
19447
|
+
function FromUnion2(types2) {
|
|
19448
|
+
const result = [];
|
|
19449
|
+
for (const type of types2)
|
|
19450
|
+
result.push(...IndexPropertyKeys(type));
|
|
19451
|
+
return result;
|
|
19452
|
+
}
|
|
19453
|
+
function FromLiteral(literalValue) {
|
|
19454
|
+
return [literalValue.toString()];
|
|
19455
|
+
}
|
|
19456
|
+
function IndexPropertyKeys(type) {
|
|
19457
|
+
return [...new Set(IsTemplateLiteral(type) ? FromTemplateLiteral(type) : IsUnion(type) ? FromUnion2(type.anyOf) : IsLiteral(type) ? FromLiteral(type.const) : IsNumber3(type) ? ["[number]"] : IsInteger(type) ? ["[number]"] : [])];
|
|
19458
|
+
}
|
|
19459
|
+
|
|
19460
|
+
// node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-result.mjs
|
|
19461
|
+
function FromProperties(type, properties, options) {
|
|
19462
|
+
const result = {};
|
|
19463
|
+
for (const K2 of Object.getOwnPropertyNames(properties)) {
|
|
19464
|
+
result[K2] = Index(type, IndexPropertyKeys(properties[K2]), options);
|
|
19465
|
+
}
|
|
19466
|
+
return result;
|
|
19467
|
+
}
|
|
19468
|
+
function FromMappedResult(type, mappedResult, options) {
|
|
19469
|
+
return FromProperties(type, mappedResult.properties, options);
|
|
19470
|
+
}
|
|
19471
|
+
function IndexFromMappedResult(type, mappedResult, options) {
|
|
19472
|
+
const properties = FromMappedResult(type, mappedResult, options);
|
|
19473
|
+
return MappedResult(properties);
|
|
19474
|
+
}
|
|
19475
|
+
|
|
19476
|
+
// node_modules/@sinclair/typebox/build/esm/type/indexed/indexed.mjs
|
|
19477
|
+
function FromRest(types2, key) {
|
|
19478
|
+
return types2.map((type) => IndexFromPropertyKey(type, key));
|
|
19479
|
+
}
|
|
19480
|
+
function FromIntersectRest(types2) {
|
|
19481
|
+
return types2.filter((type) => !IsNever(type));
|
|
19482
|
+
}
|
|
19483
|
+
function FromIntersect(types2, key) {
|
|
19484
|
+
return IntersectEvaluated(FromIntersectRest(FromRest(types2, key)));
|
|
19485
|
+
}
|
|
19486
|
+
function FromUnionRest(types2) {
|
|
19487
|
+
return types2.some((L) => IsNever(L)) ? [] : types2;
|
|
19488
|
+
}
|
|
19489
|
+
function FromUnion3(types2, key) {
|
|
19490
|
+
return UnionEvaluated(FromUnionRest(FromRest(types2, key)));
|
|
19491
|
+
}
|
|
19492
|
+
function FromTuple(types2, key) {
|
|
19493
|
+
return key in types2 ? types2[key] : key === "[number]" ? UnionEvaluated(types2) : Never();
|
|
19494
|
+
}
|
|
19495
|
+
function FromArray(type, key) {
|
|
19496
|
+
return key === "[number]" ? type : Never();
|
|
19497
|
+
}
|
|
19498
|
+
function FromProperty(properties, propertyKey) {
|
|
19499
|
+
return propertyKey in properties ? properties[propertyKey] : Never();
|
|
19500
|
+
}
|
|
19501
|
+
function IndexFromPropertyKey(type, propertyKey) {
|
|
19502
|
+
return IsIntersect(type) ? FromIntersect(type.allOf, propertyKey) : IsUnion(type) ? FromUnion3(type.anyOf, propertyKey) : IsTuple(type) ? FromTuple(type.items ?? [], propertyKey) : IsArray3(type) ? FromArray(type.items, propertyKey) : IsObject3(type) ? FromProperty(type.properties, propertyKey) : Never();
|
|
19503
|
+
}
|
|
19504
|
+
function IndexFromPropertyKeys(type, propertyKeys) {
|
|
19505
|
+
return propertyKeys.map((propertyKey) => IndexFromPropertyKey(type, propertyKey));
|
|
19506
|
+
}
|
|
19507
|
+
function FromSchema(type, propertyKeys) {
|
|
19508
|
+
return UnionEvaluated(IndexFromPropertyKeys(type, propertyKeys));
|
|
19509
|
+
}
|
|
19510
|
+
function Index(type, key, options) {
|
|
19511
|
+
if (IsRef(type) || IsRef(key)) {
|
|
19512
|
+
const error = `Index types using Ref parameters require both Type and Key to be of TSchema`;
|
|
19513
|
+
if (!IsSchema(type) || !IsSchema(key))
|
|
19514
|
+
throw new TypeBoxError(error);
|
|
19515
|
+
return Computed("Index", [type, key]);
|
|
19516
|
+
}
|
|
19517
|
+
if (IsMappedResult(key))
|
|
19518
|
+
return IndexFromMappedResult(type, key, options);
|
|
19519
|
+
if (IsMappedKey(key))
|
|
19520
|
+
return IndexFromMappedKey(type, key, options);
|
|
19521
|
+
return CreateType(IsSchema(key) ? FromSchema(type, IndexPropertyKeys(key)) : FromSchema(type, key), options);
|
|
19522
|
+
}
|
|
19523
|
+
|
|
19524
|
+
// node_modules/@sinclair/typebox/build/esm/type/indexed/indexed-from-mapped-key.mjs
|
|
19525
|
+
function MappedIndexPropertyKey(type, key, options) {
|
|
19526
|
+
return { [key]: Index(type, [key], Clone(options)) };
|
|
19527
|
+
}
|
|
19528
|
+
function MappedIndexPropertyKeys(type, propertyKeys, options) {
|
|
19529
|
+
return propertyKeys.reduce((result, left) => {
|
|
19530
|
+
return { ...result, ...MappedIndexPropertyKey(type, left, options) };
|
|
19531
|
+
}, {});
|
|
19532
|
+
}
|
|
19533
|
+
function MappedIndexProperties(type, mappedKey, options) {
|
|
19534
|
+
return MappedIndexPropertyKeys(type, mappedKey.keys, options);
|
|
19535
|
+
}
|
|
19536
|
+
function IndexFromMappedKey(type, mappedKey, options) {
|
|
19537
|
+
const properties = MappedIndexProperties(type, mappedKey, options);
|
|
19538
|
+
return MappedResult(properties);
|
|
19539
|
+
}
|
|
19540
|
+
|
|
19541
|
+
// node_modules/@sinclair/typebox/build/esm/type/iterator/iterator.mjs
|
|
19542
|
+
function Iterator(items, options) {
|
|
19543
|
+
return CreateType({ [Kind]: "Iterator", type: "Iterator", items }, options);
|
|
19544
|
+
}
|
|
19545
|
+
|
|
19546
|
+
// node_modules/@sinclair/typebox/build/esm/type/object/object.mjs
|
|
19547
|
+
function RequiredArray(properties) {
|
|
19548
|
+
return globalThis.Object.keys(properties).filter((key) => !IsOptional(properties[key]));
|
|
19549
|
+
}
|
|
19550
|
+
function _Object(properties, options) {
|
|
19551
|
+
const required = RequiredArray(properties);
|
|
19552
|
+
const schema = required.length > 0 ? { [Kind]: "Object", type: "object", required, properties } : { [Kind]: "Object", type: "object", properties };
|
|
19553
|
+
return CreateType(schema, options);
|
|
19554
|
+
}
|
|
19555
|
+
var Object2 = _Object;
|
|
19556
|
+
|
|
19557
|
+
// node_modules/@sinclair/typebox/build/esm/type/promise/promise.mjs
|
|
19558
|
+
function Promise2(item, options) {
|
|
19559
|
+
return CreateType({ [Kind]: "Promise", type: "Promise", item }, options);
|
|
19560
|
+
}
|
|
19561
|
+
|
|
19562
|
+
// node_modules/@sinclair/typebox/build/esm/type/readonly/readonly.mjs
|
|
19563
|
+
function RemoveReadonly(schema) {
|
|
19564
|
+
return CreateType(Discard(schema, [ReadonlyKind]));
|
|
19565
|
+
}
|
|
19566
|
+
function AddReadonly(schema) {
|
|
19567
|
+
return CreateType({ ...schema, [ReadonlyKind]: "Readonly" });
|
|
19568
|
+
}
|
|
19569
|
+
function ReadonlyWithFlag(schema, F) {
|
|
19570
|
+
return F === false ? RemoveReadonly(schema) : AddReadonly(schema);
|
|
19571
|
+
}
|
|
19572
|
+
function Readonly(schema, enable) {
|
|
19573
|
+
const F = enable ?? true;
|
|
19574
|
+
return IsMappedResult(schema) ? ReadonlyFromMappedResult(schema, F) : ReadonlyWithFlag(schema, F);
|
|
19575
|
+
}
|
|
19576
|
+
|
|
19577
|
+
// node_modules/@sinclair/typebox/build/esm/type/readonly/readonly-from-mapped-result.mjs
|
|
19578
|
+
function FromProperties2(K, F) {
|
|
19579
|
+
const Acc = {};
|
|
19580
|
+
for (const K2 of globalThis.Object.getOwnPropertyNames(K))
|
|
19581
|
+
Acc[K2] = Readonly(K[K2], F);
|
|
19582
|
+
return Acc;
|
|
19583
|
+
}
|
|
19584
|
+
function FromMappedResult2(R, F) {
|
|
19585
|
+
return FromProperties2(R.properties, F);
|
|
19586
|
+
}
|
|
19587
|
+
function ReadonlyFromMappedResult(R, F) {
|
|
19588
|
+
const P = FromMappedResult2(R, F);
|
|
19589
|
+
return MappedResult(P);
|
|
19590
|
+
}
|
|
19591
|
+
|
|
19592
|
+
// node_modules/@sinclair/typebox/build/esm/type/tuple/tuple.mjs
|
|
19593
|
+
function Tuple(types2, options) {
|
|
19594
|
+
return CreateType(types2.length > 0 ? { [Kind]: "Tuple", type: "array", items: types2, additionalItems: false, minItems: types2.length, maxItems: types2.length } : { [Kind]: "Tuple", type: "array", minItems: types2.length, maxItems: types2.length }, options);
|
|
19595
|
+
}
|
|
19596
|
+
|
|
19597
|
+
// node_modules/@sinclair/typebox/build/esm/type/mapped/mapped.mjs
|
|
19598
|
+
function FromMappedResult3(K, P) {
|
|
19599
|
+
return K in P ? FromSchemaType(K, P[K]) : MappedResult(P);
|
|
19600
|
+
}
|
|
19601
|
+
function MappedKeyToKnownMappedResultProperties(K) {
|
|
19602
|
+
return { [K]: Literal(K) };
|
|
19603
|
+
}
|
|
19604
|
+
function MappedKeyToUnknownMappedResultProperties(P) {
|
|
19605
|
+
const Acc = {};
|
|
19606
|
+
for (const L of P)
|
|
19607
|
+
Acc[L] = Literal(L);
|
|
19608
|
+
return Acc;
|
|
19609
|
+
}
|
|
19610
|
+
function MappedKeyToMappedResultProperties(K, P) {
|
|
19611
|
+
return SetIncludes(P, K) ? MappedKeyToKnownMappedResultProperties(K) : MappedKeyToUnknownMappedResultProperties(P);
|
|
19612
|
+
}
|
|
19613
|
+
function FromMappedKey(K, P) {
|
|
19614
|
+
const R = MappedKeyToMappedResultProperties(K, P);
|
|
19615
|
+
return FromMappedResult3(K, R);
|
|
19616
|
+
}
|
|
19617
|
+
function FromRest2(K, T) {
|
|
19618
|
+
return T.map((L) => FromSchemaType(K, L));
|
|
19619
|
+
}
|
|
19620
|
+
function FromProperties3(K, T) {
|
|
19621
|
+
const Acc = {};
|
|
19622
|
+
for (const K2 of globalThis.Object.getOwnPropertyNames(T))
|
|
19623
|
+
Acc[K2] = FromSchemaType(K, T[K2]);
|
|
19624
|
+
return Acc;
|
|
19625
|
+
}
|
|
19626
|
+
function FromSchemaType(K, T) {
|
|
19627
|
+
const options = { ...T };
|
|
19628
|
+
return (
|
|
19629
|
+
// unevaluated modifier types
|
|
19630
|
+
IsOptional(T) ? Optional(FromSchemaType(K, Discard(T, [OptionalKind]))) : IsReadonly(T) ? Readonly(FromSchemaType(K, Discard(T, [ReadonlyKind]))) : (
|
|
19631
|
+
// unevaluated mapped types
|
|
19632
|
+
IsMappedResult(T) ? FromMappedResult3(K, T.properties) : IsMappedKey(T) ? FromMappedKey(K, T.keys) : (
|
|
19633
|
+
// unevaluated types
|
|
19634
|
+
IsConstructor(T) ? Constructor(FromRest2(K, T.parameters), FromSchemaType(K, T.returns), options) : IsFunction2(T) ? Function2(FromRest2(K, T.parameters), FromSchemaType(K, T.returns), options) : IsAsyncIterator2(T) ? AsyncIterator(FromSchemaType(K, T.items), options) : IsIterator2(T) ? Iterator(FromSchemaType(K, T.items), options) : IsIntersect(T) ? Intersect(FromRest2(K, T.allOf), options) : IsUnion(T) ? Union(FromRest2(K, T.anyOf), options) : IsTuple(T) ? Tuple(FromRest2(K, T.items ?? []), options) : IsObject3(T) ? Object2(FromProperties3(K, T.properties), options) : IsArray3(T) ? Array2(FromSchemaType(K, T.items), options) : IsPromise(T) ? Promise2(FromSchemaType(K, T.item), options) : T
|
|
19635
|
+
)
|
|
19636
|
+
)
|
|
19637
|
+
);
|
|
19638
|
+
}
|
|
19639
|
+
function MappedFunctionReturnType(K, T) {
|
|
19640
|
+
const Acc = {};
|
|
19641
|
+
for (const L of K)
|
|
19642
|
+
Acc[L] = FromSchemaType(L, T);
|
|
19643
|
+
return Acc;
|
|
19644
|
+
}
|
|
19645
|
+
function Mapped(key, map, options) {
|
|
19646
|
+
const K = IsSchema(key) ? IndexPropertyKeys(key) : key;
|
|
19647
|
+
const RT = map({ [Kind]: "MappedKey", keys: K });
|
|
19648
|
+
const R = MappedFunctionReturnType(K, RT);
|
|
19649
|
+
return Object2(R, options);
|
|
19650
|
+
}
|
|
19651
|
+
|
|
19652
|
+
// node_modules/@sinclair/typebox/build/esm/type/optional/optional.mjs
|
|
19653
|
+
function RemoveOptional(schema) {
|
|
19654
|
+
return CreateType(Discard(schema, [OptionalKind]));
|
|
19655
|
+
}
|
|
19656
|
+
function AddOptional(schema) {
|
|
19657
|
+
return CreateType({ ...schema, [OptionalKind]: "Optional" });
|
|
19658
|
+
}
|
|
19659
|
+
function OptionalWithFlag(schema, F) {
|
|
19660
|
+
return F === false ? RemoveOptional(schema) : AddOptional(schema);
|
|
19661
|
+
}
|
|
19662
|
+
function Optional(schema, enable) {
|
|
19663
|
+
const F = enable ?? true;
|
|
19664
|
+
return IsMappedResult(schema) ? OptionalFromMappedResult(schema, F) : OptionalWithFlag(schema, F);
|
|
19665
|
+
}
|
|
19666
|
+
|
|
19667
|
+
// node_modules/@sinclair/typebox/build/esm/type/optional/optional-from-mapped-result.mjs
|
|
19668
|
+
function FromProperties4(P, F) {
|
|
19669
|
+
const Acc = {};
|
|
19670
|
+
for (const K2 of globalThis.Object.getOwnPropertyNames(P))
|
|
19671
|
+
Acc[K2] = Optional(P[K2], F);
|
|
19672
|
+
return Acc;
|
|
19673
|
+
}
|
|
19674
|
+
function FromMappedResult4(R, F) {
|
|
19675
|
+
return FromProperties4(R.properties, F);
|
|
19676
|
+
}
|
|
19677
|
+
function OptionalFromMappedResult(R, F) {
|
|
19678
|
+
const P = FromMappedResult4(R, F);
|
|
19679
|
+
return MappedResult(P);
|
|
19680
|
+
}
|
|
19681
|
+
|
|
19682
|
+
// node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-create.mjs
|
|
19683
|
+
function IntersectCreate(T, options = {}) {
|
|
19684
|
+
const allObjects = T.every((schema) => IsObject3(schema));
|
|
19685
|
+
const clonedUnevaluatedProperties = IsSchema(options.unevaluatedProperties) ? { unevaluatedProperties: options.unevaluatedProperties } : {};
|
|
19686
|
+
return CreateType(options.unevaluatedProperties === false || IsSchema(options.unevaluatedProperties) || allObjects ? { ...clonedUnevaluatedProperties, [Kind]: "Intersect", type: "object", allOf: T } : { ...clonedUnevaluatedProperties, [Kind]: "Intersect", allOf: T }, options);
|
|
19687
|
+
}
|
|
19688
|
+
|
|
19689
|
+
// node_modules/@sinclair/typebox/build/esm/type/intersect/intersect-evaluated.mjs
|
|
19690
|
+
function IsIntersectOptional(types2) {
|
|
19691
|
+
return types2.every((left) => IsOptional(left));
|
|
19692
|
+
}
|
|
19693
|
+
function RemoveOptionalFromType2(type) {
|
|
19694
|
+
return Discard(type, [OptionalKind]);
|
|
19695
|
+
}
|
|
19696
|
+
function RemoveOptionalFromRest2(types2) {
|
|
19697
|
+
return types2.map((left) => IsOptional(left) ? RemoveOptionalFromType2(left) : left);
|
|
19698
|
+
}
|
|
19699
|
+
function ResolveIntersect(types2, options) {
|
|
19700
|
+
return IsIntersectOptional(types2) ? Optional(IntersectCreate(RemoveOptionalFromRest2(types2), options)) : IntersectCreate(RemoveOptionalFromRest2(types2), options);
|
|
19701
|
+
}
|
|
19702
|
+
function IntersectEvaluated(types2, options = {}) {
|
|
19703
|
+
if (types2.length === 1)
|
|
19704
|
+
return CreateType(types2[0], options);
|
|
19705
|
+
if (types2.length === 0)
|
|
19706
|
+
return Never(options);
|
|
19707
|
+
if (types2.some((schema) => IsTransform(schema)))
|
|
19708
|
+
throw new Error("Cannot intersect transform types");
|
|
19709
|
+
return ResolveIntersect(types2, options);
|
|
19710
|
+
}
|
|
19711
|
+
|
|
19712
|
+
// node_modules/@sinclair/typebox/build/esm/type/intersect/intersect.mjs
|
|
19713
|
+
function Intersect(types2, options) {
|
|
19714
|
+
if (types2.length === 1)
|
|
19715
|
+
return CreateType(types2[0], options);
|
|
19716
|
+
if (types2.length === 0)
|
|
19717
|
+
return Never(options);
|
|
19718
|
+
if (types2.some((schema) => IsTransform(schema)))
|
|
19719
|
+
throw new Error("Cannot intersect transform types");
|
|
19720
|
+
return IntersectCreate(types2, options);
|
|
19721
|
+
}
|
|
19722
|
+
|
|
19723
|
+
// node_modules/@sinclair/typebox/build/esm/type/ref/ref.mjs
|
|
19724
|
+
function Ref(...args) {
|
|
19725
|
+
const [$ref, options] = typeof args[0] === "string" ? [args[0], args[1]] : [args[0].$id, args[1]];
|
|
19726
|
+
if (typeof $ref !== "string")
|
|
19727
|
+
throw new TypeBoxError("Ref: $ref must be a string");
|
|
19728
|
+
return CreateType({ [Kind]: "Ref", $ref }, options);
|
|
19729
|
+
}
|
|
19730
|
+
|
|
19731
|
+
// node_modules/@sinclair/typebox/build/esm/type/awaited/awaited.mjs
|
|
19732
|
+
function FromComputed(target, parameters) {
|
|
19733
|
+
return Computed("Awaited", [Computed(target, parameters)]);
|
|
19734
|
+
}
|
|
19735
|
+
function FromRef($ref) {
|
|
19736
|
+
return Computed("Awaited", [Ref($ref)]);
|
|
19737
|
+
}
|
|
19738
|
+
function FromIntersect2(types2) {
|
|
19739
|
+
return Intersect(FromRest3(types2));
|
|
19740
|
+
}
|
|
19741
|
+
function FromUnion4(types2) {
|
|
19742
|
+
return Union(FromRest3(types2));
|
|
19743
|
+
}
|
|
19744
|
+
function FromPromise(type) {
|
|
19745
|
+
return Awaited(type);
|
|
19746
|
+
}
|
|
19747
|
+
function FromRest3(types2) {
|
|
19748
|
+
return types2.map((type) => Awaited(type));
|
|
19749
|
+
}
|
|
19750
|
+
function Awaited(type, options) {
|
|
19751
|
+
return CreateType(IsComputed(type) ? FromComputed(type.target, type.parameters) : IsIntersect(type) ? FromIntersect2(type.allOf) : IsUnion(type) ? FromUnion4(type.anyOf) : IsPromise(type) ? FromPromise(type.item) : IsRef(type) ? FromRef(type.$ref) : type, options);
|
|
19752
|
+
}
|
|
19753
|
+
|
|
19754
|
+
// node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-property-keys.mjs
|
|
19755
|
+
function FromRest4(types2) {
|
|
19756
|
+
const result = [];
|
|
19757
|
+
for (const L of types2)
|
|
19758
|
+
result.push(KeyOfPropertyKeys(L));
|
|
19759
|
+
return result;
|
|
19760
|
+
}
|
|
19761
|
+
function FromIntersect3(types2) {
|
|
19762
|
+
const propertyKeysArray = FromRest4(types2);
|
|
19763
|
+
const propertyKeys = SetUnionMany(propertyKeysArray);
|
|
19764
|
+
return propertyKeys;
|
|
19765
|
+
}
|
|
19766
|
+
function FromUnion5(types2) {
|
|
19767
|
+
const propertyKeysArray = FromRest4(types2);
|
|
19768
|
+
const propertyKeys = SetIntersectMany(propertyKeysArray);
|
|
19769
|
+
return propertyKeys;
|
|
19770
|
+
}
|
|
19771
|
+
function FromTuple2(types2) {
|
|
19772
|
+
return types2.map((_, indexer) => indexer.toString());
|
|
19773
|
+
}
|
|
19774
|
+
function FromArray2(_) {
|
|
19775
|
+
return ["[number]"];
|
|
19776
|
+
}
|
|
19777
|
+
function FromProperties5(T) {
|
|
19778
|
+
return globalThis.Object.getOwnPropertyNames(T);
|
|
19779
|
+
}
|
|
19780
|
+
function FromPatternProperties(patternProperties) {
|
|
19781
|
+
if (!includePatternProperties)
|
|
19782
|
+
return [];
|
|
19783
|
+
const patternPropertyKeys = globalThis.Object.getOwnPropertyNames(patternProperties);
|
|
19784
|
+
return patternPropertyKeys.map((key) => {
|
|
19785
|
+
return key[0] === "^" && key[key.length - 1] === "$" ? key.slice(1, key.length - 1) : key;
|
|
19786
|
+
});
|
|
19787
|
+
}
|
|
19788
|
+
function KeyOfPropertyKeys(type) {
|
|
19789
|
+
return IsIntersect(type) ? FromIntersect3(type.allOf) : IsUnion(type) ? FromUnion5(type.anyOf) : IsTuple(type) ? FromTuple2(type.items ?? []) : IsArray3(type) ? FromArray2(type.items) : IsObject3(type) ? FromProperties5(type.properties) : IsRecord(type) ? FromPatternProperties(type.patternProperties) : [];
|
|
19790
|
+
}
|
|
19791
|
+
var includePatternProperties = false;
|
|
19792
|
+
|
|
19793
|
+
// node_modules/@sinclair/typebox/build/esm/type/keyof/keyof.mjs
|
|
19794
|
+
function FromComputed2(target, parameters) {
|
|
19795
|
+
return Computed("KeyOf", [Computed(target, parameters)]);
|
|
19796
|
+
}
|
|
19797
|
+
function FromRef2($ref) {
|
|
19798
|
+
return Computed("KeyOf", [Ref($ref)]);
|
|
19799
|
+
}
|
|
19800
|
+
function KeyOfFromType(type, options) {
|
|
19801
|
+
const propertyKeys = KeyOfPropertyKeys(type);
|
|
19802
|
+
const propertyKeyTypes = KeyOfPropertyKeysToRest(propertyKeys);
|
|
19803
|
+
const result = UnionEvaluated(propertyKeyTypes);
|
|
19804
|
+
return CreateType(result, options);
|
|
19805
|
+
}
|
|
19806
|
+
function KeyOfPropertyKeysToRest(propertyKeys) {
|
|
19807
|
+
return propertyKeys.map((L) => L === "[number]" ? Number2() : Literal(L));
|
|
19808
|
+
}
|
|
19809
|
+
function KeyOf(type, options) {
|
|
19810
|
+
return IsComputed(type) ? FromComputed2(type.target, type.parameters) : IsRef(type) ? FromRef2(type.$ref) : IsMappedResult(type) ? KeyOfFromMappedResult(type, options) : KeyOfFromType(type, options);
|
|
19811
|
+
}
|
|
19812
|
+
|
|
19813
|
+
// node_modules/@sinclair/typebox/build/esm/type/keyof/keyof-from-mapped-result.mjs
|
|
19814
|
+
function FromProperties6(properties, options) {
|
|
19815
|
+
const result = {};
|
|
19816
|
+
for (const K2 of globalThis.Object.getOwnPropertyNames(properties))
|
|
19817
|
+
result[K2] = KeyOf(properties[K2], Clone(options));
|
|
19818
|
+
return result;
|
|
19819
|
+
}
|
|
19820
|
+
function FromMappedResult5(mappedResult, options) {
|
|
19821
|
+
return FromProperties6(mappedResult.properties, options);
|
|
19822
|
+
}
|
|
19823
|
+
function KeyOfFromMappedResult(mappedResult, options) {
|
|
19824
|
+
const properties = FromMappedResult5(mappedResult, options);
|
|
19825
|
+
return MappedResult(properties);
|
|
19826
|
+
}
|
|
19827
|
+
|
|
19828
|
+
// node_modules/@sinclair/typebox/build/esm/type/composite/composite.mjs
|
|
19829
|
+
function CompositeKeys(T) {
|
|
19830
|
+
const Acc = [];
|
|
19831
|
+
for (const L of T)
|
|
19832
|
+
Acc.push(...KeyOfPropertyKeys(L));
|
|
19833
|
+
return SetDistinct(Acc);
|
|
19834
|
+
}
|
|
19835
|
+
function FilterNever(T) {
|
|
19836
|
+
return T.filter((L) => !IsNever(L));
|
|
19837
|
+
}
|
|
19838
|
+
function CompositeProperty(T, K) {
|
|
19839
|
+
const Acc = [];
|
|
19840
|
+
for (const L of T)
|
|
19841
|
+
Acc.push(...IndexFromPropertyKeys(L, [K]));
|
|
19842
|
+
return FilterNever(Acc);
|
|
19843
|
+
}
|
|
19844
|
+
function CompositeProperties(T, K) {
|
|
19845
|
+
const Acc = {};
|
|
19846
|
+
for (const L of K) {
|
|
19847
|
+
Acc[L] = IntersectEvaluated(CompositeProperty(T, L));
|
|
19848
|
+
}
|
|
19849
|
+
return Acc;
|
|
19850
|
+
}
|
|
19851
|
+
function Composite(T, options) {
|
|
19852
|
+
const K = CompositeKeys(T);
|
|
19853
|
+
const P = CompositeProperties(T, K);
|
|
19854
|
+
const R = Object2(P, options);
|
|
19855
|
+
return R;
|
|
19856
|
+
}
|
|
19857
|
+
|
|
19858
|
+
// node_modules/@sinclair/typebox/build/esm/type/date/date.mjs
|
|
19859
|
+
function Date2(options) {
|
|
19860
|
+
return CreateType({ [Kind]: "Date", type: "Date" }, options);
|
|
19861
|
+
}
|
|
19862
|
+
|
|
19863
|
+
// node_modules/@sinclair/typebox/build/esm/type/null/null.mjs
|
|
19864
|
+
function Null(options) {
|
|
19865
|
+
return CreateType({ [Kind]: "Null", type: "null" }, options);
|
|
19866
|
+
}
|
|
19867
|
+
|
|
19868
|
+
// node_modules/@sinclair/typebox/build/esm/type/symbol/symbol.mjs
|
|
19869
|
+
function Symbol2(options) {
|
|
19870
|
+
return CreateType({ [Kind]: "Symbol", type: "symbol" }, options);
|
|
19871
|
+
}
|
|
19872
|
+
|
|
19873
|
+
// node_modules/@sinclair/typebox/build/esm/type/undefined/undefined.mjs
|
|
19874
|
+
function Undefined(options) {
|
|
19875
|
+
return CreateType({ [Kind]: "Undefined", type: "undefined" }, options);
|
|
19876
|
+
}
|
|
19877
|
+
|
|
19878
|
+
// node_modules/@sinclair/typebox/build/esm/type/uint8array/uint8array.mjs
|
|
19879
|
+
function Uint8Array2(options) {
|
|
19880
|
+
return CreateType({ [Kind]: "Uint8Array", type: "Uint8Array" }, options);
|
|
19881
|
+
}
|
|
19882
|
+
|
|
19883
|
+
// node_modules/@sinclair/typebox/build/esm/type/unknown/unknown.mjs
|
|
19884
|
+
function Unknown(options) {
|
|
19885
|
+
return CreateType({ [Kind]: "Unknown" }, options);
|
|
19886
|
+
}
|
|
19887
|
+
|
|
19888
|
+
// node_modules/@sinclair/typebox/build/esm/type/const/const.mjs
|
|
19889
|
+
function FromArray3(T) {
|
|
19890
|
+
return T.map((L) => FromValue(L, false));
|
|
19891
|
+
}
|
|
19892
|
+
function FromProperties7(value) {
|
|
19893
|
+
const Acc = {};
|
|
19894
|
+
for (const K of globalThis.Object.getOwnPropertyNames(value))
|
|
19895
|
+
Acc[K] = Readonly(FromValue(value[K], false));
|
|
19896
|
+
return Acc;
|
|
19897
|
+
}
|
|
19898
|
+
function ConditionalReadonly(T, root) {
|
|
19899
|
+
return root === true ? T : Readonly(T);
|
|
19900
|
+
}
|
|
19901
|
+
function FromValue(value, root) {
|
|
19902
|
+
return IsAsyncIterator(value) ? ConditionalReadonly(Any(), root) : IsIterator(value) ? ConditionalReadonly(Any(), root) : IsArray(value) ? Readonly(Tuple(FromArray3(value))) : IsUint8Array(value) ? Uint8Array2() : IsDate(value) ? Date2() : IsObject(value) ? ConditionalReadonly(Object2(FromProperties7(value)), root) : IsFunction(value) ? ConditionalReadonly(Function2([], Unknown()), root) : IsUndefined(value) ? Undefined() : IsNull(value) ? Null() : IsSymbol(value) ? Symbol2() : IsBigInt(value) ? BigInt2() : IsNumber(value) ? Literal(value) : IsBoolean(value) ? Literal(value) : IsString(value) ? Literal(value) : Object2({});
|
|
19903
|
+
}
|
|
19904
|
+
function Const(T, options) {
|
|
19905
|
+
return CreateType(FromValue(T, true), options);
|
|
19906
|
+
}
|
|
19907
|
+
|
|
19908
|
+
// node_modules/@sinclair/typebox/build/esm/type/constructor-parameters/constructor-parameters.mjs
|
|
19909
|
+
function ConstructorParameters(schema, options) {
|
|
19910
|
+
return IsConstructor(schema) ? Tuple(schema.parameters, options) : Never(options);
|
|
19911
|
+
}
|
|
19912
|
+
|
|
19913
|
+
// node_modules/@sinclair/typebox/build/esm/type/enum/enum.mjs
|
|
19914
|
+
function Enum(item, options) {
|
|
19915
|
+
if (IsUndefined(item))
|
|
19916
|
+
throw new Error("Enum undefined or empty");
|
|
19917
|
+
const values1 = globalThis.Object.getOwnPropertyNames(item).filter((key) => isNaN(key)).map((key) => item[key]);
|
|
19918
|
+
const values2 = [...new Set(values1)];
|
|
19919
|
+
const anyOf = values2.map((value) => Literal(value));
|
|
19920
|
+
return Union(anyOf, { ...options, [Hint]: "Enum" });
|
|
19921
|
+
}
|
|
19922
|
+
|
|
19923
|
+
// node_modules/@sinclair/typebox/build/esm/type/extends/extends-check.mjs
|
|
19924
|
+
var ExtendsResolverError = class extends TypeBoxError {
|
|
19925
|
+
};
|
|
19926
|
+
var ExtendsResult;
|
|
19927
|
+
(function(ExtendsResult2) {
|
|
19928
|
+
ExtendsResult2[ExtendsResult2["Union"] = 0] = "Union";
|
|
19929
|
+
ExtendsResult2[ExtendsResult2["True"] = 1] = "True";
|
|
19930
|
+
ExtendsResult2[ExtendsResult2["False"] = 2] = "False";
|
|
19931
|
+
})(ExtendsResult || (ExtendsResult = {}));
|
|
19932
|
+
function IntoBooleanResult(result) {
|
|
19933
|
+
return result === ExtendsResult.False ? result : ExtendsResult.True;
|
|
19934
|
+
}
|
|
19935
|
+
function Throw(message) {
|
|
19936
|
+
throw new ExtendsResolverError(message);
|
|
19937
|
+
}
|
|
19938
|
+
function IsStructuralRight(right) {
|
|
19939
|
+
return type_exports.IsNever(right) || type_exports.IsIntersect(right) || type_exports.IsUnion(right) || type_exports.IsUnknown(right) || type_exports.IsAny(right);
|
|
19940
|
+
}
|
|
19941
|
+
function StructuralRight(left, right) {
|
|
19942
|
+
return type_exports.IsNever(right) ? FromNeverRight(left, right) : type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) ? FromUnionRight(left, right) : type_exports.IsUnknown(right) ? FromUnknownRight(left, right) : type_exports.IsAny(right) ? FromAnyRight(left, right) : Throw("StructuralRight");
|
|
19943
|
+
}
|
|
19944
|
+
function FromAnyRight(left, right) {
|
|
19945
|
+
return ExtendsResult.True;
|
|
19946
|
+
}
|
|
19947
|
+
function FromAny(left, right) {
|
|
19948
|
+
return type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) && right.anyOf.some((schema) => type_exports.IsAny(schema) || type_exports.IsUnknown(schema)) ? ExtendsResult.True : type_exports.IsUnion(right) ? ExtendsResult.Union : type_exports.IsUnknown(right) ? ExtendsResult.True : type_exports.IsAny(right) ? ExtendsResult.True : ExtendsResult.Union;
|
|
19949
|
+
}
|
|
19950
|
+
function FromArrayRight(left, right) {
|
|
19951
|
+
return type_exports.IsUnknown(left) ? ExtendsResult.False : type_exports.IsAny(left) ? ExtendsResult.Union : type_exports.IsNever(left) ? ExtendsResult.True : ExtendsResult.False;
|
|
19952
|
+
}
|
|
19953
|
+
function FromArray4(left, right) {
|
|
19954
|
+
return type_exports.IsObject(right) && IsObjectArrayLike(right) ? ExtendsResult.True : IsStructuralRight(right) ? StructuralRight(left, right) : !type_exports.IsArray(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.items, right.items));
|
|
19955
|
+
}
|
|
19956
|
+
function FromAsyncIterator(left, right) {
|
|
19957
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : !type_exports.IsAsyncIterator(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.items, right.items));
|
|
19958
|
+
}
|
|
19959
|
+
function FromBigInt(left, right) {
|
|
19960
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsBigInt(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
19961
|
+
}
|
|
19962
|
+
function FromBooleanRight(left, right) {
|
|
19963
|
+
return type_exports.IsLiteralBoolean(left) ? ExtendsResult.True : type_exports.IsBoolean(left) ? ExtendsResult.True : ExtendsResult.False;
|
|
19964
|
+
}
|
|
19965
|
+
function FromBoolean(left, right) {
|
|
19966
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsBoolean(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
19967
|
+
}
|
|
19968
|
+
function FromConstructor(left, right) {
|
|
19969
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : !type_exports.IsConstructor(right) ? ExtendsResult.False : left.parameters.length > right.parameters.length ? ExtendsResult.False : !left.parameters.every((schema, index) => IntoBooleanResult(Visit3(right.parameters[index], schema)) === ExtendsResult.True) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.returns, right.returns));
|
|
19970
|
+
}
|
|
19971
|
+
function FromDate(left, right) {
|
|
19972
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsDate(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
19973
|
+
}
|
|
19974
|
+
function FromFunction(left, right) {
|
|
19975
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : !type_exports.IsFunction(right) ? ExtendsResult.False : left.parameters.length > right.parameters.length ? ExtendsResult.False : !left.parameters.every((schema, index) => IntoBooleanResult(Visit3(right.parameters[index], schema)) === ExtendsResult.True) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.returns, right.returns));
|
|
19976
|
+
}
|
|
19977
|
+
function FromIntegerRight(left, right) {
|
|
19978
|
+
return type_exports.IsLiteral(left) && value_exports.IsNumber(left.const) ? ExtendsResult.True : type_exports.IsNumber(left) || type_exports.IsInteger(left) ? ExtendsResult.True : ExtendsResult.False;
|
|
19979
|
+
}
|
|
19980
|
+
function FromInteger(left, right) {
|
|
19981
|
+
return type_exports.IsInteger(right) || type_exports.IsNumber(right) ? ExtendsResult.True : IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : ExtendsResult.False;
|
|
19982
|
+
}
|
|
19983
|
+
function FromIntersectRight(left, right) {
|
|
19984
|
+
return right.allOf.every((schema) => Visit3(left, schema) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
|
|
19985
|
+
}
|
|
19986
|
+
function FromIntersect4(left, right) {
|
|
19987
|
+
return left.allOf.some((schema) => Visit3(schema, right) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
|
|
19988
|
+
}
|
|
19989
|
+
function FromIterator(left, right) {
|
|
19990
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : !type_exports.IsIterator(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.items, right.items));
|
|
19991
|
+
}
|
|
19992
|
+
function FromLiteral2(left, right) {
|
|
19993
|
+
return type_exports.IsLiteral(right) && right.const === left.const ? ExtendsResult.True : IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsString(right) ? FromStringRight(left, right) : type_exports.IsNumber(right) ? FromNumberRight(left, right) : type_exports.IsInteger(right) ? FromIntegerRight(left, right) : type_exports.IsBoolean(right) ? FromBooleanRight(left, right) : ExtendsResult.False;
|
|
19994
|
+
}
|
|
19995
|
+
function FromNeverRight(left, right) {
|
|
19996
|
+
return ExtendsResult.False;
|
|
19997
|
+
}
|
|
19998
|
+
function FromNever(left, right) {
|
|
19999
|
+
return ExtendsResult.True;
|
|
20000
|
+
}
|
|
20001
|
+
function UnwrapTNot(schema) {
|
|
20002
|
+
let [current, depth] = [schema, 0];
|
|
20003
|
+
while (true) {
|
|
20004
|
+
if (!type_exports.IsNot(current))
|
|
20005
|
+
break;
|
|
20006
|
+
current = current.not;
|
|
20007
|
+
depth += 1;
|
|
20008
|
+
}
|
|
20009
|
+
return depth % 2 === 0 ? current : Unknown();
|
|
20010
|
+
}
|
|
20011
|
+
function FromNot(left, right) {
|
|
20012
|
+
return type_exports.IsNot(left) ? Visit3(UnwrapTNot(left), right) : type_exports.IsNot(right) ? Visit3(left, UnwrapTNot(right)) : Throw("Invalid fallthrough for Not");
|
|
20013
|
+
}
|
|
20014
|
+
function FromNull(left, right) {
|
|
20015
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsNull(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
20016
|
+
}
|
|
20017
|
+
function FromNumberRight(left, right) {
|
|
20018
|
+
return type_exports.IsLiteralNumber(left) ? ExtendsResult.True : type_exports.IsNumber(left) || type_exports.IsInteger(left) ? ExtendsResult.True : ExtendsResult.False;
|
|
20019
|
+
}
|
|
20020
|
+
function FromNumber(left, right) {
|
|
20021
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsInteger(right) || type_exports.IsNumber(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
20022
|
+
}
|
|
20023
|
+
function IsObjectPropertyCount(schema, count) {
|
|
20024
|
+
return Object.getOwnPropertyNames(schema.properties).length === count;
|
|
20025
|
+
}
|
|
20026
|
+
function IsObjectStringLike(schema) {
|
|
20027
|
+
return IsObjectArrayLike(schema);
|
|
20028
|
+
}
|
|
20029
|
+
function IsObjectSymbolLike(schema) {
|
|
20030
|
+
return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "description" in schema.properties && type_exports.IsUnion(schema.properties.description) && schema.properties.description.anyOf.length === 2 && (type_exports.IsString(schema.properties.description.anyOf[0]) && type_exports.IsUndefined(schema.properties.description.anyOf[1]) || type_exports.IsString(schema.properties.description.anyOf[1]) && type_exports.IsUndefined(schema.properties.description.anyOf[0]));
|
|
20031
|
+
}
|
|
20032
|
+
function IsObjectNumberLike(schema) {
|
|
20033
|
+
return IsObjectPropertyCount(schema, 0);
|
|
20034
|
+
}
|
|
20035
|
+
function IsObjectBooleanLike(schema) {
|
|
20036
|
+
return IsObjectPropertyCount(schema, 0);
|
|
20037
|
+
}
|
|
20038
|
+
function IsObjectBigIntLike(schema) {
|
|
20039
|
+
return IsObjectPropertyCount(schema, 0);
|
|
20040
|
+
}
|
|
20041
|
+
function IsObjectDateLike(schema) {
|
|
20042
|
+
return IsObjectPropertyCount(schema, 0);
|
|
20043
|
+
}
|
|
20044
|
+
function IsObjectUint8ArrayLike(schema) {
|
|
20045
|
+
return IsObjectArrayLike(schema);
|
|
20046
|
+
}
|
|
20047
|
+
function IsObjectFunctionLike(schema) {
|
|
20048
|
+
const length = Number2();
|
|
20049
|
+
return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "length" in schema.properties && IntoBooleanResult(Visit3(schema.properties["length"], length)) === ExtendsResult.True;
|
|
20050
|
+
}
|
|
20051
|
+
function IsObjectConstructorLike(schema) {
|
|
20052
|
+
return IsObjectPropertyCount(schema, 0);
|
|
20053
|
+
}
|
|
20054
|
+
function IsObjectArrayLike(schema) {
|
|
20055
|
+
const length = Number2();
|
|
20056
|
+
return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "length" in schema.properties && IntoBooleanResult(Visit3(schema.properties["length"], length)) === ExtendsResult.True;
|
|
20057
|
+
}
|
|
20058
|
+
function IsObjectPromiseLike(schema) {
|
|
20059
|
+
const then = Function2([Any()], Any());
|
|
20060
|
+
return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "then" in schema.properties && IntoBooleanResult(Visit3(schema.properties["then"], then)) === ExtendsResult.True;
|
|
20061
|
+
}
|
|
20062
|
+
function Property(left, right) {
|
|
20063
|
+
return Visit3(left, right) === ExtendsResult.False ? ExtendsResult.False : type_exports.IsOptional(left) && !type_exports.IsOptional(right) ? ExtendsResult.False : ExtendsResult.True;
|
|
20064
|
+
}
|
|
20065
|
+
function FromObjectRight(left, right) {
|
|
20066
|
+
return type_exports.IsUnknown(left) ? ExtendsResult.False : type_exports.IsAny(left) ? ExtendsResult.Union : type_exports.IsNever(left) || type_exports.IsLiteralString(left) && IsObjectStringLike(right) || type_exports.IsLiteralNumber(left) && IsObjectNumberLike(right) || type_exports.IsLiteralBoolean(left) && IsObjectBooleanLike(right) || type_exports.IsSymbol(left) && IsObjectSymbolLike(right) || type_exports.IsBigInt(left) && IsObjectBigIntLike(right) || type_exports.IsString(left) && IsObjectStringLike(right) || type_exports.IsSymbol(left) && IsObjectSymbolLike(right) || type_exports.IsNumber(left) && IsObjectNumberLike(right) || type_exports.IsInteger(left) && IsObjectNumberLike(right) || type_exports.IsBoolean(left) && IsObjectBooleanLike(right) || type_exports.IsUint8Array(left) && IsObjectUint8ArrayLike(right) || type_exports.IsDate(left) && IsObjectDateLike(right) || type_exports.IsConstructor(left) && IsObjectConstructorLike(right) || type_exports.IsFunction(left) && IsObjectFunctionLike(right) ? ExtendsResult.True : type_exports.IsRecord(left) && type_exports.IsString(RecordKey(left)) ? (() => {
|
|
20067
|
+
return right[Hint] === "Record" ? ExtendsResult.True : ExtendsResult.False;
|
|
20068
|
+
})() : type_exports.IsRecord(left) && type_exports.IsNumber(RecordKey(left)) ? (() => {
|
|
20069
|
+
return IsObjectPropertyCount(right, 0) ? ExtendsResult.True : ExtendsResult.False;
|
|
20070
|
+
})() : ExtendsResult.False;
|
|
20071
|
+
}
|
|
20072
|
+
function FromObject(left, right) {
|
|
20073
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : !type_exports.IsObject(right) ? ExtendsResult.False : (() => {
|
|
20074
|
+
for (const key of Object.getOwnPropertyNames(right.properties)) {
|
|
20075
|
+
if (!(key in left.properties) && !type_exports.IsOptional(right.properties[key])) {
|
|
20076
|
+
return ExtendsResult.False;
|
|
20077
|
+
}
|
|
20078
|
+
if (type_exports.IsOptional(right.properties[key])) {
|
|
20079
|
+
return ExtendsResult.True;
|
|
20080
|
+
}
|
|
20081
|
+
if (Property(left.properties[key], right.properties[key]) === ExtendsResult.False) {
|
|
20082
|
+
return ExtendsResult.False;
|
|
20083
|
+
}
|
|
20084
|
+
}
|
|
20085
|
+
return ExtendsResult.True;
|
|
20086
|
+
})();
|
|
20087
|
+
}
|
|
20088
|
+
function FromPromise2(left, right) {
|
|
20089
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) && IsObjectPromiseLike(right) ? ExtendsResult.True : !type_exports.IsPromise(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.item, right.item));
|
|
20090
|
+
}
|
|
20091
|
+
function RecordKey(schema) {
|
|
20092
|
+
return PatternNumberExact in schema.patternProperties ? Number2() : PatternStringExact in schema.patternProperties ? String2() : Throw("Unknown record key pattern");
|
|
20093
|
+
}
|
|
20094
|
+
function RecordValue(schema) {
|
|
20095
|
+
return PatternNumberExact in schema.patternProperties ? schema.patternProperties[PatternNumberExact] : PatternStringExact in schema.patternProperties ? schema.patternProperties[PatternStringExact] : Throw("Unable to get record value schema");
|
|
20096
|
+
}
|
|
20097
|
+
function FromRecordRight(left, right) {
|
|
20098
|
+
const [Key, Value] = [RecordKey(right), RecordValue(right)];
|
|
20099
|
+
return type_exports.IsLiteralString(left) && type_exports.IsNumber(Key) && IntoBooleanResult(Visit3(left, Value)) === ExtendsResult.True ? ExtendsResult.True : type_exports.IsUint8Array(left) && type_exports.IsNumber(Key) ? Visit3(left, Value) : type_exports.IsString(left) && type_exports.IsNumber(Key) ? Visit3(left, Value) : type_exports.IsArray(left) && type_exports.IsNumber(Key) ? Visit3(left, Value) : type_exports.IsObject(left) ? (() => {
|
|
20100
|
+
for (const key of Object.getOwnPropertyNames(left.properties)) {
|
|
20101
|
+
if (Property(Value, left.properties[key]) === ExtendsResult.False) {
|
|
20102
|
+
return ExtendsResult.False;
|
|
20103
|
+
}
|
|
20104
|
+
}
|
|
20105
|
+
return ExtendsResult.True;
|
|
20106
|
+
})() : ExtendsResult.False;
|
|
20107
|
+
}
|
|
20108
|
+
function FromRecord(left, right) {
|
|
20109
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : !type_exports.IsRecord(right) ? ExtendsResult.False : Visit3(RecordValue(left), RecordValue(right));
|
|
20110
|
+
}
|
|
20111
|
+
function FromRegExp(left, right) {
|
|
20112
|
+
const L = type_exports.IsRegExp(left) ? String2() : left;
|
|
20113
|
+
const R = type_exports.IsRegExp(right) ? String2() : right;
|
|
20114
|
+
return Visit3(L, R);
|
|
20115
|
+
}
|
|
20116
|
+
function FromStringRight(left, right) {
|
|
20117
|
+
return type_exports.IsLiteral(left) && value_exports.IsString(left.const) ? ExtendsResult.True : type_exports.IsString(left) ? ExtendsResult.True : ExtendsResult.False;
|
|
20118
|
+
}
|
|
20119
|
+
function FromString(left, right) {
|
|
20120
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsString(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
20121
|
+
}
|
|
20122
|
+
function FromSymbol(left, right) {
|
|
20123
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsSymbol(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
20124
|
+
}
|
|
20125
|
+
function FromTemplateLiteral2(left, right) {
|
|
20126
|
+
return type_exports.IsTemplateLiteral(left) ? Visit3(TemplateLiteralToUnion(left), right) : type_exports.IsTemplateLiteral(right) ? Visit3(left, TemplateLiteralToUnion(right)) : Throw("Invalid fallthrough for TemplateLiteral");
|
|
20127
|
+
}
|
|
20128
|
+
function IsArrayOfTuple(left, right) {
|
|
20129
|
+
return type_exports.IsArray(right) && left.items !== void 0 && left.items.every((schema) => Visit3(schema, right.items) === ExtendsResult.True);
|
|
20130
|
+
}
|
|
20131
|
+
function FromTupleRight(left, right) {
|
|
20132
|
+
return type_exports.IsNever(left) ? ExtendsResult.True : type_exports.IsUnknown(left) ? ExtendsResult.False : type_exports.IsAny(left) ? ExtendsResult.Union : ExtendsResult.False;
|
|
20133
|
+
}
|
|
20134
|
+
function FromTuple3(left, right) {
|
|
20135
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) && IsObjectArrayLike(right) ? ExtendsResult.True : type_exports.IsArray(right) && IsArrayOfTuple(left, right) ? ExtendsResult.True : !type_exports.IsTuple(right) ? ExtendsResult.False : value_exports.IsUndefined(left.items) && !value_exports.IsUndefined(right.items) || !value_exports.IsUndefined(left.items) && value_exports.IsUndefined(right.items) ? ExtendsResult.False : value_exports.IsUndefined(left.items) && !value_exports.IsUndefined(right.items) ? ExtendsResult.True : left.items.every((schema, index) => Visit3(schema, right.items[index]) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
|
|
20136
|
+
}
|
|
20137
|
+
function FromUint8Array(left, right) {
|
|
20138
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsUint8Array(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
20139
|
+
}
|
|
20140
|
+
function FromUndefined(left, right) {
|
|
20141
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsRecord(right) ? FromRecordRight(left, right) : type_exports.IsVoid(right) ? FromVoidRight(left, right) : type_exports.IsUndefined(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
20142
|
+
}
|
|
20143
|
+
function FromUnionRight(left, right) {
|
|
20144
|
+
return right.anyOf.some((schema) => Visit3(left, schema) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
|
|
20145
|
+
}
|
|
20146
|
+
function FromUnion6(left, right) {
|
|
20147
|
+
return left.anyOf.every((schema) => Visit3(schema, right) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
|
|
20148
|
+
}
|
|
20149
|
+
function FromUnknownRight(left, right) {
|
|
20150
|
+
return ExtendsResult.True;
|
|
20151
|
+
}
|
|
20152
|
+
function FromUnknown(left, right) {
|
|
20153
|
+
return type_exports.IsNever(right) ? FromNeverRight(left, right) : type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) ? FromUnionRight(left, right) : type_exports.IsAny(right) ? FromAnyRight(left, right) : type_exports.IsString(right) ? FromStringRight(left, right) : type_exports.IsNumber(right) ? FromNumberRight(left, right) : type_exports.IsInteger(right) ? FromIntegerRight(left, right) : type_exports.IsBoolean(right) ? FromBooleanRight(left, right) : type_exports.IsArray(right) ? FromArrayRight(left, right) : type_exports.IsTuple(right) ? FromTupleRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsUnknown(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
20154
|
+
}
|
|
20155
|
+
function FromVoidRight(left, right) {
|
|
20156
|
+
return type_exports.IsUndefined(left) ? ExtendsResult.True : type_exports.IsUndefined(left) ? ExtendsResult.True : ExtendsResult.False;
|
|
20157
|
+
}
|
|
20158
|
+
function FromVoid(left, right) {
|
|
20159
|
+
return type_exports.IsIntersect(right) ? FromIntersectRight(left, right) : type_exports.IsUnion(right) ? FromUnionRight(left, right) : type_exports.IsUnknown(right) ? FromUnknownRight(left, right) : type_exports.IsAny(right) ? FromAnyRight(left, right) : type_exports.IsObject(right) ? FromObjectRight(left, right) : type_exports.IsVoid(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
20160
|
+
}
|
|
20161
|
+
function Visit3(left, right) {
|
|
20162
|
+
return (
|
|
20163
|
+
// resolvable
|
|
20164
|
+
type_exports.IsTemplateLiteral(left) || type_exports.IsTemplateLiteral(right) ? FromTemplateLiteral2(left, right) : type_exports.IsRegExp(left) || type_exports.IsRegExp(right) ? FromRegExp(left, right) : type_exports.IsNot(left) || type_exports.IsNot(right) ? FromNot(left, right) : (
|
|
20165
|
+
// standard
|
|
20166
|
+
type_exports.IsAny(left) ? FromAny(left, right) : type_exports.IsArray(left) ? FromArray4(left, right) : type_exports.IsBigInt(left) ? FromBigInt(left, right) : type_exports.IsBoolean(left) ? FromBoolean(left, right) : type_exports.IsAsyncIterator(left) ? FromAsyncIterator(left, right) : type_exports.IsConstructor(left) ? FromConstructor(left, right) : type_exports.IsDate(left) ? FromDate(left, right) : type_exports.IsFunction(left) ? FromFunction(left, right) : type_exports.IsInteger(left) ? FromInteger(left, right) : type_exports.IsIntersect(left) ? FromIntersect4(left, right) : type_exports.IsIterator(left) ? FromIterator(left, right) : type_exports.IsLiteral(left) ? FromLiteral2(left, right) : type_exports.IsNever(left) ? FromNever(left, right) : type_exports.IsNull(left) ? FromNull(left, right) : type_exports.IsNumber(left) ? FromNumber(left, right) : type_exports.IsObject(left) ? FromObject(left, right) : type_exports.IsRecord(left) ? FromRecord(left, right) : type_exports.IsString(left) ? FromString(left, right) : type_exports.IsSymbol(left) ? FromSymbol(left, right) : type_exports.IsTuple(left) ? FromTuple3(left, right) : type_exports.IsPromise(left) ? FromPromise2(left, right) : type_exports.IsUint8Array(left) ? FromUint8Array(left, right) : type_exports.IsUndefined(left) ? FromUndefined(left, right) : type_exports.IsUnion(left) ? FromUnion6(left, right) : type_exports.IsUnknown(left) ? FromUnknown(left, right) : type_exports.IsVoid(left) ? FromVoid(left, right) : Throw(`Unknown left type operand '${left[Kind]}'`)
|
|
20167
|
+
)
|
|
20168
|
+
);
|
|
20169
|
+
}
|
|
20170
|
+
function ExtendsCheck(left, right) {
|
|
20171
|
+
return Visit3(left, right);
|
|
20172
|
+
}
|
|
20173
|
+
|
|
20174
|
+
// node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-result.mjs
|
|
20175
|
+
function FromProperties8(P, Right, True, False, options) {
|
|
20176
|
+
const Acc = {};
|
|
20177
|
+
for (const K2 of globalThis.Object.getOwnPropertyNames(P))
|
|
20178
|
+
Acc[K2] = Extends(P[K2], Right, True, False, Clone(options));
|
|
20179
|
+
return Acc;
|
|
20180
|
+
}
|
|
20181
|
+
function FromMappedResult6(Left, Right, True, False, options) {
|
|
20182
|
+
return FromProperties8(Left.properties, Right, True, False, options);
|
|
20183
|
+
}
|
|
20184
|
+
function ExtendsFromMappedResult(Left, Right, True, False, options) {
|
|
20185
|
+
const P = FromMappedResult6(Left, Right, True, False, options);
|
|
20186
|
+
return MappedResult(P);
|
|
20187
|
+
}
|
|
20188
|
+
|
|
20189
|
+
// node_modules/@sinclair/typebox/build/esm/type/extends/extends.mjs
|
|
20190
|
+
function ExtendsResolve(left, right, trueType, falseType) {
|
|
20191
|
+
const R = ExtendsCheck(left, right);
|
|
20192
|
+
return R === ExtendsResult.Union ? Union([trueType, falseType]) : R === ExtendsResult.True ? trueType : falseType;
|
|
20193
|
+
}
|
|
20194
|
+
function Extends(L, R, T, F, options) {
|
|
20195
|
+
return IsMappedResult(L) ? ExtendsFromMappedResult(L, R, T, F, options) : IsMappedKey(L) ? CreateType(ExtendsFromMappedKey(L, R, T, F, options)) : CreateType(ExtendsResolve(L, R, T, F), options);
|
|
20196
|
+
}
|
|
20197
|
+
|
|
20198
|
+
// node_modules/@sinclair/typebox/build/esm/type/extends/extends-from-mapped-key.mjs
|
|
20199
|
+
function FromPropertyKey(K, U, L, R, options) {
|
|
20200
|
+
return {
|
|
20201
|
+
[K]: Extends(Literal(K), U, L, R, Clone(options))
|
|
20202
|
+
};
|
|
20203
|
+
}
|
|
20204
|
+
function FromPropertyKeys(K, U, L, R, options) {
|
|
20205
|
+
return K.reduce((Acc, LK) => {
|
|
20206
|
+
return { ...Acc, ...FromPropertyKey(LK, U, L, R, options) };
|
|
20207
|
+
}, {});
|
|
20208
|
+
}
|
|
20209
|
+
function FromMappedKey2(K, U, L, R, options) {
|
|
20210
|
+
return FromPropertyKeys(K.keys, U, L, R, options);
|
|
20211
|
+
}
|
|
20212
|
+
function ExtendsFromMappedKey(T, U, L, R, options) {
|
|
20213
|
+
const P = FromMappedKey2(T, U, L, R, options);
|
|
20214
|
+
return MappedResult(P);
|
|
20215
|
+
}
|
|
20216
|
+
|
|
20217
|
+
// node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-template-literal.mjs
|
|
20218
|
+
function ExcludeFromTemplateLiteral(L, R) {
|
|
20219
|
+
return Exclude(TemplateLiteralToUnion(L), R);
|
|
20220
|
+
}
|
|
20221
|
+
|
|
20222
|
+
// node_modules/@sinclair/typebox/build/esm/type/exclude/exclude.mjs
|
|
20223
|
+
function ExcludeRest(L, R) {
|
|
20224
|
+
const excluded = L.filter((inner) => ExtendsCheck(inner, R) === ExtendsResult.False);
|
|
20225
|
+
return excluded.length === 1 ? excluded[0] : Union(excluded);
|
|
20226
|
+
}
|
|
20227
|
+
function Exclude(L, R, options = {}) {
|
|
20228
|
+
if (IsTemplateLiteral(L))
|
|
20229
|
+
return CreateType(ExcludeFromTemplateLiteral(L, R), options);
|
|
20230
|
+
if (IsMappedResult(L))
|
|
20231
|
+
return CreateType(ExcludeFromMappedResult(L, R), options);
|
|
20232
|
+
return CreateType(IsUnion(L) ? ExcludeRest(L.anyOf, R) : ExtendsCheck(L, R) !== ExtendsResult.False ? Never() : L, options);
|
|
20233
|
+
}
|
|
20234
|
+
|
|
20235
|
+
// node_modules/@sinclair/typebox/build/esm/type/exclude/exclude-from-mapped-result.mjs
|
|
20236
|
+
function FromProperties9(P, U) {
|
|
20237
|
+
const Acc = {};
|
|
20238
|
+
for (const K2 of globalThis.Object.getOwnPropertyNames(P))
|
|
20239
|
+
Acc[K2] = Exclude(P[K2], U);
|
|
20240
|
+
return Acc;
|
|
20241
|
+
}
|
|
20242
|
+
function FromMappedResult7(R, T) {
|
|
20243
|
+
return FromProperties9(R.properties, T);
|
|
20244
|
+
}
|
|
20245
|
+
function ExcludeFromMappedResult(R, T) {
|
|
20246
|
+
const P = FromMappedResult7(R, T);
|
|
20247
|
+
return MappedResult(P);
|
|
20248
|
+
}
|
|
20249
|
+
|
|
20250
|
+
// node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-template-literal.mjs
|
|
20251
|
+
function ExtractFromTemplateLiteral(L, R) {
|
|
20252
|
+
return Extract(TemplateLiteralToUnion(L), R);
|
|
20253
|
+
}
|
|
20254
|
+
|
|
20255
|
+
// node_modules/@sinclair/typebox/build/esm/type/extract/extract.mjs
|
|
20256
|
+
function ExtractRest(L, R) {
|
|
20257
|
+
const extracted = L.filter((inner) => ExtendsCheck(inner, R) !== ExtendsResult.False);
|
|
20258
|
+
return extracted.length === 1 ? extracted[0] : Union(extracted);
|
|
20259
|
+
}
|
|
20260
|
+
function Extract(L, R, options) {
|
|
20261
|
+
if (IsTemplateLiteral(L))
|
|
20262
|
+
return CreateType(ExtractFromTemplateLiteral(L, R), options);
|
|
20263
|
+
if (IsMappedResult(L))
|
|
20264
|
+
return CreateType(ExtractFromMappedResult(L, R), options);
|
|
20265
|
+
return CreateType(IsUnion(L) ? ExtractRest(L.anyOf, R) : ExtendsCheck(L, R) !== ExtendsResult.False ? L : Never(), options);
|
|
20266
|
+
}
|
|
20267
|
+
|
|
20268
|
+
// node_modules/@sinclair/typebox/build/esm/type/extract/extract-from-mapped-result.mjs
|
|
20269
|
+
function FromProperties10(P, T) {
|
|
20270
|
+
const Acc = {};
|
|
20271
|
+
for (const K2 of globalThis.Object.getOwnPropertyNames(P))
|
|
20272
|
+
Acc[K2] = Extract(P[K2], T);
|
|
20273
|
+
return Acc;
|
|
20274
|
+
}
|
|
20275
|
+
function FromMappedResult8(R, T) {
|
|
20276
|
+
return FromProperties10(R.properties, T);
|
|
20277
|
+
}
|
|
20278
|
+
function ExtractFromMappedResult(R, T) {
|
|
20279
|
+
const P = FromMappedResult8(R, T);
|
|
20280
|
+
return MappedResult(P);
|
|
20281
|
+
}
|
|
20282
|
+
|
|
20283
|
+
// node_modules/@sinclair/typebox/build/esm/type/instance-type/instance-type.mjs
|
|
20284
|
+
function InstanceType(schema, options) {
|
|
20285
|
+
return IsConstructor(schema) ? CreateType(schema.returns, options) : Never(options);
|
|
20286
|
+
}
|
|
20287
|
+
|
|
20288
|
+
// node_modules/@sinclair/typebox/build/esm/type/readonly-optional/readonly-optional.mjs
|
|
20289
|
+
function ReadonlyOptional(schema) {
|
|
20290
|
+
return Readonly(Optional(schema));
|
|
20291
|
+
}
|
|
20292
|
+
|
|
20293
|
+
// node_modules/@sinclair/typebox/build/esm/type/record/record.mjs
|
|
20294
|
+
function RecordCreateFromPattern(pattern, T, options) {
|
|
20295
|
+
return CreateType({ [Kind]: "Record", type: "object", patternProperties: { [pattern]: T } }, options);
|
|
20296
|
+
}
|
|
20297
|
+
function RecordCreateFromKeys(K, T, options) {
|
|
20298
|
+
const result = {};
|
|
20299
|
+
for (const K2 of K)
|
|
20300
|
+
result[K2] = T;
|
|
20301
|
+
return Object2(result, { ...options, [Hint]: "Record" });
|
|
20302
|
+
}
|
|
20303
|
+
function FromTemplateLiteralKey(K, T, options) {
|
|
20304
|
+
return IsTemplateLiteralFinite(K) ? RecordCreateFromKeys(IndexPropertyKeys(K), T, options) : RecordCreateFromPattern(K.pattern, T, options);
|
|
20305
|
+
}
|
|
20306
|
+
function FromUnionKey(key, type, options) {
|
|
20307
|
+
return RecordCreateFromKeys(IndexPropertyKeys(Union(key)), type, options);
|
|
20308
|
+
}
|
|
20309
|
+
function FromLiteralKey(key, type, options) {
|
|
20310
|
+
return RecordCreateFromKeys([key.toString()], type, options);
|
|
20311
|
+
}
|
|
20312
|
+
function FromRegExpKey(key, type, options) {
|
|
20313
|
+
return RecordCreateFromPattern(key.source, type, options);
|
|
20314
|
+
}
|
|
20315
|
+
function FromStringKey(key, type, options) {
|
|
20316
|
+
const pattern = IsUndefined(key.pattern) ? PatternStringExact : key.pattern;
|
|
20317
|
+
return RecordCreateFromPattern(pattern, type, options);
|
|
20318
|
+
}
|
|
20319
|
+
function FromAnyKey(_, type, options) {
|
|
20320
|
+
return RecordCreateFromPattern(PatternStringExact, type, options);
|
|
20321
|
+
}
|
|
20322
|
+
function FromNeverKey(_key, type, options) {
|
|
20323
|
+
return RecordCreateFromPattern(PatternNeverExact, type, options);
|
|
20324
|
+
}
|
|
20325
|
+
function FromBooleanKey(_key, type, options) {
|
|
20326
|
+
return Object2({ true: type, false: type }, options);
|
|
20327
|
+
}
|
|
20328
|
+
function FromIntegerKey(_key, type, options) {
|
|
20329
|
+
return RecordCreateFromPattern(PatternNumberExact, type, options);
|
|
20330
|
+
}
|
|
20331
|
+
function FromNumberKey(_, type, options) {
|
|
20332
|
+
return RecordCreateFromPattern(PatternNumberExact, type, options);
|
|
20333
|
+
}
|
|
20334
|
+
function Record(key, type, options = {}) {
|
|
20335
|
+
return IsUnion(key) ? FromUnionKey(key.anyOf, type, options) : IsTemplateLiteral(key) ? FromTemplateLiteralKey(key, type, options) : IsLiteral(key) ? FromLiteralKey(key.const, type, options) : IsBoolean2(key) ? FromBooleanKey(key, type, options) : IsInteger(key) ? FromIntegerKey(key, type, options) : IsNumber3(key) ? FromNumberKey(key, type, options) : IsRegExp2(key) ? FromRegExpKey(key, type, options) : IsString2(key) ? FromStringKey(key, type, options) : IsAny(key) ? FromAnyKey(key, type, options) : IsNever(key) ? FromNeverKey(key, type, options) : Never(options);
|
|
20336
|
+
}
|
|
20337
|
+
function RecordPattern(record) {
|
|
20338
|
+
return globalThis.Object.getOwnPropertyNames(record.patternProperties)[0];
|
|
20339
|
+
}
|
|
20340
|
+
function RecordKey2(type) {
|
|
20341
|
+
const pattern = RecordPattern(type);
|
|
20342
|
+
return pattern === PatternStringExact ? String2() : pattern === PatternNumberExact ? Number2() : String2({ pattern });
|
|
20343
|
+
}
|
|
20344
|
+
function RecordValue2(type) {
|
|
20345
|
+
return type.patternProperties[RecordPattern(type)];
|
|
20346
|
+
}
|
|
20347
|
+
|
|
20348
|
+
// node_modules/@sinclair/typebox/build/esm/type/instantiate/instantiate.mjs
|
|
20349
|
+
function FromConstructor2(args, type) {
|
|
20350
|
+
type.parameters = FromTypes(args, type.parameters);
|
|
20351
|
+
type.returns = FromType(args, type.returns);
|
|
20352
|
+
return type;
|
|
20353
|
+
}
|
|
20354
|
+
function FromFunction2(args, type) {
|
|
20355
|
+
type.parameters = FromTypes(args, type.parameters);
|
|
20356
|
+
type.returns = FromType(args, type.returns);
|
|
20357
|
+
return type;
|
|
20358
|
+
}
|
|
20359
|
+
function FromIntersect5(args, type) {
|
|
20360
|
+
type.allOf = FromTypes(args, type.allOf);
|
|
20361
|
+
return type;
|
|
20362
|
+
}
|
|
20363
|
+
function FromUnion7(args, type) {
|
|
20364
|
+
type.anyOf = FromTypes(args, type.anyOf);
|
|
20365
|
+
return type;
|
|
20366
|
+
}
|
|
20367
|
+
function FromTuple4(args, type) {
|
|
20368
|
+
if (IsUndefined(type.items))
|
|
20369
|
+
return type;
|
|
20370
|
+
type.items = FromTypes(args, type.items);
|
|
20371
|
+
return type;
|
|
20372
|
+
}
|
|
20373
|
+
function FromArray5(args, type) {
|
|
20374
|
+
type.items = FromType(args, type.items);
|
|
20375
|
+
return type;
|
|
20376
|
+
}
|
|
20377
|
+
function FromAsyncIterator2(args, type) {
|
|
20378
|
+
type.items = FromType(args, type.items);
|
|
20379
|
+
return type;
|
|
20380
|
+
}
|
|
20381
|
+
function FromIterator2(args, type) {
|
|
20382
|
+
type.items = FromType(args, type.items);
|
|
20383
|
+
return type;
|
|
20384
|
+
}
|
|
20385
|
+
function FromPromise3(args, type) {
|
|
20386
|
+
type.item = FromType(args, type.item);
|
|
20387
|
+
return type;
|
|
20388
|
+
}
|
|
20389
|
+
function FromObject2(args, type) {
|
|
20390
|
+
const mappedProperties = FromProperties11(args, type.properties);
|
|
20391
|
+
return { ...type, ...Object2(mappedProperties) };
|
|
20392
|
+
}
|
|
20393
|
+
function FromRecord2(args, type) {
|
|
20394
|
+
const mappedKey = FromType(args, RecordKey2(type));
|
|
20395
|
+
const mappedValue = FromType(args, RecordValue2(type));
|
|
20396
|
+
const result = Record(mappedKey, mappedValue);
|
|
20397
|
+
return { ...type, ...result };
|
|
20398
|
+
}
|
|
20399
|
+
function FromArgument(args, argument) {
|
|
20400
|
+
return argument.index in args ? args[argument.index] : Unknown();
|
|
20401
|
+
}
|
|
20402
|
+
function FromProperty2(args, type) {
|
|
20403
|
+
const isReadonly = IsReadonly(type);
|
|
20404
|
+
const isOptional = IsOptional(type);
|
|
20405
|
+
const mapped = FromType(args, type);
|
|
20406
|
+
return isReadonly && isOptional ? ReadonlyOptional(mapped) : isReadonly && !isOptional ? Readonly(mapped) : !isReadonly && isOptional ? Optional(mapped) : mapped;
|
|
20407
|
+
}
|
|
20408
|
+
function FromProperties11(args, properties) {
|
|
20409
|
+
return globalThis.Object.getOwnPropertyNames(properties).reduce((result, key) => {
|
|
20410
|
+
return { ...result, [key]: FromProperty2(args, properties[key]) };
|
|
20411
|
+
}, {});
|
|
20412
|
+
}
|
|
20413
|
+
function FromTypes(args, types2) {
|
|
20414
|
+
return types2.map((type) => FromType(args, type));
|
|
20415
|
+
}
|
|
20416
|
+
function FromType(args, type) {
|
|
20417
|
+
return IsConstructor(type) ? FromConstructor2(args, type) : IsFunction2(type) ? FromFunction2(args, type) : IsIntersect(type) ? FromIntersect5(args, type) : IsUnion(type) ? FromUnion7(args, type) : IsTuple(type) ? FromTuple4(args, type) : IsArray3(type) ? FromArray5(args, type) : IsAsyncIterator2(type) ? FromAsyncIterator2(args, type) : IsIterator2(type) ? FromIterator2(args, type) : IsPromise(type) ? FromPromise3(args, type) : IsObject3(type) ? FromObject2(args, type) : IsRecord(type) ? FromRecord2(args, type) : IsArgument(type) ? FromArgument(args, type) : type;
|
|
20418
|
+
}
|
|
20419
|
+
function Instantiate(type, args) {
|
|
20420
|
+
return FromType(args, CloneType(type));
|
|
20421
|
+
}
|
|
20422
|
+
|
|
20423
|
+
// node_modules/@sinclair/typebox/build/esm/type/integer/integer.mjs
|
|
20424
|
+
function Integer(options) {
|
|
20425
|
+
return CreateType({ [Kind]: "Integer", type: "integer" }, options);
|
|
20426
|
+
}
|
|
20427
|
+
|
|
20428
|
+
// node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic-from-mapped-key.mjs
|
|
20429
|
+
function MappedIntrinsicPropertyKey(K, M, options) {
|
|
20430
|
+
return {
|
|
20431
|
+
[K]: Intrinsic(Literal(K), M, Clone(options))
|
|
20432
|
+
};
|
|
20433
|
+
}
|
|
20434
|
+
function MappedIntrinsicPropertyKeys(K, M, options) {
|
|
20435
|
+
const result = K.reduce((Acc, L) => {
|
|
20436
|
+
return { ...Acc, ...MappedIntrinsicPropertyKey(L, M, options) };
|
|
20437
|
+
}, {});
|
|
20438
|
+
return result;
|
|
20439
|
+
}
|
|
20440
|
+
function MappedIntrinsicProperties(T, M, options) {
|
|
20441
|
+
return MappedIntrinsicPropertyKeys(T["keys"], M, options);
|
|
20442
|
+
}
|
|
20443
|
+
function IntrinsicFromMappedKey(T, M, options) {
|
|
20444
|
+
const P = MappedIntrinsicProperties(T, M, options);
|
|
20445
|
+
return MappedResult(P);
|
|
20446
|
+
}
|
|
20447
|
+
|
|
20448
|
+
// node_modules/@sinclair/typebox/build/esm/type/intrinsic/intrinsic.mjs
|
|
20449
|
+
function ApplyUncapitalize(value) {
|
|
20450
|
+
const [first, rest] = [value.slice(0, 1), value.slice(1)];
|
|
20451
|
+
return [first.toLowerCase(), rest].join("");
|
|
20452
|
+
}
|
|
20453
|
+
function ApplyCapitalize(value) {
|
|
20454
|
+
const [first, rest] = [value.slice(0, 1), value.slice(1)];
|
|
20455
|
+
return [first.toUpperCase(), rest].join("");
|
|
20456
|
+
}
|
|
20457
|
+
function ApplyUppercase(value) {
|
|
20458
|
+
return value.toUpperCase();
|
|
20459
|
+
}
|
|
20460
|
+
function ApplyLowercase(value) {
|
|
20461
|
+
return value.toLowerCase();
|
|
20462
|
+
}
|
|
20463
|
+
function FromTemplateLiteral3(schema, mode, options) {
|
|
20464
|
+
const expression = TemplateLiteralParseExact(schema.pattern);
|
|
20465
|
+
const finite = IsTemplateLiteralExpressionFinite(expression);
|
|
20466
|
+
if (!finite)
|
|
20467
|
+
return { ...schema, pattern: FromLiteralValue(schema.pattern, mode) };
|
|
20468
|
+
const strings = [...TemplateLiteralExpressionGenerate(expression)];
|
|
20469
|
+
const literals = strings.map((value) => Literal(value));
|
|
20470
|
+
const mapped = FromRest5(literals, mode);
|
|
20471
|
+
const union = Union(mapped);
|
|
20472
|
+
return TemplateLiteral([union], options);
|
|
20473
|
+
}
|
|
20474
|
+
function FromLiteralValue(value, mode) {
|
|
20475
|
+
return typeof value === "string" ? mode === "Uncapitalize" ? ApplyUncapitalize(value) : mode === "Capitalize" ? ApplyCapitalize(value) : mode === "Uppercase" ? ApplyUppercase(value) : mode === "Lowercase" ? ApplyLowercase(value) : value : value.toString();
|
|
20476
|
+
}
|
|
20477
|
+
function FromRest5(T, M) {
|
|
20478
|
+
return T.map((L) => Intrinsic(L, M));
|
|
20479
|
+
}
|
|
20480
|
+
function Intrinsic(schema, mode, options = {}) {
|
|
20481
|
+
return (
|
|
20482
|
+
// Intrinsic-Mapped-Inference
|
|
20483
|
+
IsMappedKey(schema) ? IntrinsicFromMappedKey(schema, mode, options) : (
|
|
20484
|
+
// Standard-Inference
|
|
20485
|
+
IsTemplateLiteral(schema) ? FromTemplateLiteral3(schema, mode, options) : IsUnion(schema) ? Union(FromRest5(schema.anyOf, mode), options) : IsLiteral(schema) ? Literal(FromLiteralValue(schema.const, mode), options) : (
|
|
20486
|
+
// Default Type
|
|
20487
|
+
CreateType(schema, options)
|
|
20488
|
+
)
|
|
20489
|
+
)
|
|
20490
|
+
);
|
|
20491
|
+
}
|
|
20492
|
+
|
|
20493
|
+
// node_modules/@sinclair/typebox/build/esm/type/intrinsic/capitalize.mjs
|
|
20494
|
+
function Capitalize(T, options = {}) {
|
|
20495
|
+
return Intrinsic(T, "Capitalize", options);
|
|
20496
|
+
}
|
|
20497
|
+
|
|
20498
|
+
// node_modules/@sinclair/typebox/build/esm/type/intrinsic/lowercase.mjs
|
|
20499
|
+
function Lowercase(T, options = {}) {
|
|
20500
|
+
return Intrinsic(T, "Lowercase", options);
|
|
20501
|
+
}
|
|
20502
|
+
|
|
20503
|
+
// node_modules/@sinclair/typebox/build/esm/type/intrinsic/uncapitalize.mjs
|
|
20504
|
+
function Uncapitalize(T, options = {}) {
|
|
20505
|
+
return Intrinsic(T, "Uncapitalize", options);
|
|
20506
|
+
}
|
|
20507
|
+
|
|
20508
|
+
// node_modules/@sinclair/typebox/build/esm/type/intrinsic/uppercase.mjs
|
|
20509
|
+
function Uppercase(T, options = {}) {
|
|
20510
|
+
return Intrinsic(T, "Uppercase", options);
|
|
20511
|
+
}
|
|
20512
|
+
|
|
20513
|
+
// node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-result.mjs
|
|
20514
|
+
function FromProperties12(properties, propertyKeys, options) {
|
|
20515
|
+
const result = {};
|
|
20516
|
+
for (const K2 of globalThis.Object.getOwnPropertyNames(properties))
|
|
20517
|
+
result[K2] = Omit(properties[K2], propertyKeys, Clone(options));
|
|
20518
|
+
return result;
|
|
20519
|
+
}
|
|
20520
|
+
function FromMappedResult9(mappedResult, propertyKeys, options) {
|
|
20521
|
+
return FromProperties12(mappedResult.properties, propertyKeys, options);
|
|
20522
|
+
}
|
|
20523
|
+
function OmitFromMappedResult(mappedResult, propertyKeys, options) {
|
|
20524
|
+
const properties = FromMappedResult9(mappedResult, propertyKeys, options);
|
|
20525
|
+
return MappedResult(properties);
|
|
20526
|
+
}
|
|
20527
|
+
|
|
20528
|
+
// node_modules/@sinclair/typebox/build/esm/type/omit/omit.mjs
|
|
20529
|
+
function FromIntersect6(types2, propertyKeys) {
|
|
20530
|
+
return types2.map((type) => OmitResolve(type, propertyKeys));
|
|
20531
|
+
}
|
|
20532
|
+
function FromUnion8(types2, propertyKeys) {
|
|
20533
|
+
return types2.map((type) => OmitResolve(type, propertyKeys));
|
|
20534
|
+
}
|
|
20535
|
+
function FromProperty3(properties, key) {
|
|
20536
|
+
const { [key]: _, ...R } = properties;
|
|
20537
|
+
return R;
|
|
20538
|
+
}
|
|
20539
|
+
function FromProperties13(properties, propertyKeys) {
|
|
20540
|
+
return propertyKeys.reduce((T, K2) => FromProperty3(T, K2), properties);
|
|
20541
|
+
}
|
|
20542
|
+
function FromObject3(type, propertyKeys, properties) {
|
|
20543
|
+
const options = Discard(type, [TransformKind, "$id", "required", "properties"]);
|
|
20544
|
+
const mappedProperties = FromProperties13(properties, propertyKeys);
|
|
20545
|
+
return Object2(mappedProperties, options);
|
|
20546
|
+
}
|
|
20547
|
+
function UnionFromPropertyKeys(propertyKeys) {
|
|
20548
|
+
const result = propertyKeys.reduce((result2, key) => IsLiteralValue(key) ? [...result2, Literal(key)] : result2, []);
|
|
20549
|
+
return Union(result);
|
|
20550
|
+
}
|
|
20551
|
+
function OmitResolve(type, propertyKeys) {
|
|
20552
|
+
return IsIntersect(type) ? Intersect(FromIntersect6(type.allOf, propertyKeys)) : IsUnion(type) ? Union(FromUnion8(type.anyOf, propertyKeys)) : IsObject3(type) ? FromObject3(type, propertyKeys, type.properties) : Object2({});
|
|
20553
|
+
}
|
|
20554
|
+
function Omit(type, key, options) {
|
|
20555
|
+
const typeKey = IsArray(key) ? UnionFromPropertyKeys(key) : key;
|
|
20556
|
+
const propertyKeys = IsSchema(key) ? IndexPropertyKeys(key) : key;
|
|
20557
|
+
const isTypeRef = IsRef(type);
|
|
20558
|
+
const isKeyRef = IsRef(key);
|
|
20559
|
+
return IsMappedResult(type) ? OmitFromMappedResult(type, propertyKeys, options) : IsMappedKey(key) ? OmitFromMappedKey(type, key, options) : isTypeRef && isKeyRef ? Computed("Omit", [type, typeKey], options) : !isTypeRef && isKeyRef ? Computed("Omit", [type, typeKey], options) : isTypeRef && !isKeyRef ? Computed("Omit", [type, typeKey], options) : CreateType({ ...OmitResolve(type, propertyKeys), ...options });
|
|
20560
|
+
}
|
|
20561
|
+
|
|
20562
|
+
// node_modules/@sinclair/typebox/build/esm/type/omit/omit-from-mapped-key.mjs
|
|
20563
|
+
function FromPropertyKey2(type, key, options) {
|
|
20564
|
+
return { [key]: Omit(type, [key], Clone(options)) };
|
|
20565
|
+
}
|
|
20566
|
+
function FromPropertyKeys2(type, propertyKeys, options) {
|
|
20567
|
+
return propertyKeys.reduce((Acc, LK) => {
|
|
20568
|
+
return { ...Acc, ...FromPropertyKey2(type, LK, options) };
|
|
20569
|
+
}, {});
|
|
20570
|
+
}
|
|
20571
|
+
function FromMappedKey3(type, mappedKey, options) {
|
|
20572
|
+
return FromPropertyKeys2(type, mappedKey.keys, options);
|
|
20573
|
+
}
|
|
20574
|
+
function OmitFromMappedKey(type, mappedKey, options) {
|
|
20575
|
+
const properties = FromMappedKey3(type, mappedKey, options);
|
|
20576
|
+
return MappedResult(properties);
|
|
20577
|
+
}
|
|
20578
|
+
|
|
20579
|
+
// node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-result.mjs
|
|
20580
|
+
function FromProperties14(properties, propertyKeys, options) {
|
|
20581
|
+
const result = {};
|
|
20582
|
+
for (const K2 of globalThis.Object.getOwnPropertyNames(properties))
|
|
20583
|
+
result[K2] = Pick(properties[K2], propertyKeys, Clone(options));
|
|
20584
|
+
return result;
|
|
20585
|
+
}
|
|
20586
|
+
function FromMappedResult10(mappedResult, propertyKeys, options) {
|
|
20587
|
+
return FromProperties14(mappedResult.properties, propertyKeys, options);
|
|
20588
|
+
}
|
|
20589
|
+
function PickFromMappedResult(mappedResult, propertyKeys, options) {
|
|
20590
|
+
const properties = FromMappedResult10(mappedResult, propertyKeys, options);
|
|
20591
|
+
return MappedResult(properties);
|
|
20592
|
+
}
|
|
20593
|
+
|
|
20594
|
+
// node_modules/@sinclair/typebox/build/esm/type/pick/pick.mjs
|
|
20595
|
+
function FromIntersect7(types2, propertyKeys) {
|
|
20596
|
+
return types2.map((type) => PickResolve(type, propertyKeys));
|
|
20597
|
+
}
|
|
20598
|
+
function FromUnion9(types2, propertyKeys) {
|
|
20599
|
+
return types2.map((type) => PickResolve(type, propertyKeys));
|
|
20600
|
+
}
|
|
20601
|
+
function FromProperties15(properties, propertyKeys) {
|
|
20602
|
+
const result = {};
|
|
20603
|
+
for (const K2 of propertyKeys)
|
|
20604
|
+
if (K2 in properties)
|
|
20605
|
+
result[K2] = properties[K2];
|
|
20606
|
+
return result;
|
|
20607
|
+
}
|
|
20608
|
+
function FromObject4(Type2, keys, properties) {
|
|
20609
|
+
const options = Discard(Type2, [TransformKind, "$id", "required", "properties"]);
|
|
20610
|
+
const mappedProperties = FromProperties15(properties, keys);
|
|
20611
|
+
return Object2(mappedProperties, options);
|
|
20612
|
+
}
|
|
20613
|
+
function UnionFromPropertyKeys2(propertyKeys) {
|
|
20614
|
+
const result = propertyKeys.reduce((result2, key) => IsLiteralValue(key) ? [...result2, Literal(key)] : result2, []);
|
|
20615
|
+
return Union(result);
|
|
20616
|
+
}
|
|
20617
|
+
function PickResolve(type, propertyKeys) {
|
|
20618
|
+
return IsIntersect(type) ? Intersect(FromIntersect7(type.allOf, propertyKeys)) : IsUnion(type) ? Union(FromUnion9(type.anyOf, propertyKeys)) : IsObject3(type) ? FromObject4(type, propertyKeys, type.properties) : Object2({});
|
|
20619
|
+
}
|
|
20620
|
+
function Pick(type, key, options) {
|
|
20621
|
+
const typeKey = IsArray(key) ? UnionFromPropertyKeys2(key) : key;
|
|
20622
|
+
const propertyKeys = IsSchema(key) ? IndexPropertyKeys(key) : key;
|
|
20623
|
+
const isTypeRef = IsRef(type);
|
|
20624
|
+
const isKeyRef = IsRef(key);
|
|
20625
|
+
return IsMappedResult(type) ? PickFromMappedResult(type, propertyKeys, options) : IsMappedKey(key) ? PickFromMappedKey(type, key, options) : isTypeRef && isKeyRef ? Computed("Pick", [type, typeKey], options) : !isTypeRef && isKeyRef ? Computed("Pick", [type, typeKey], options) : isTypeRef && !isKeyRef ? Computed("Pick", [type, typeKey], options) : CreateType({ ...PickResolve(type, propertyKeys), ...options });
|
|
20626
|
+
}
|
|
20627
|
+
|
|
20628
|
+
// node_modules/@sinclair/typebox/build/esm/type/pick/pick-from-mapped-key.mjs
|
|
20629
|
+
function FromPropertyKey3(type, key, options) {
|
|
20630
|
+
return {
|
|
20631
|
+
[key]: Pick(type, [key], Clone(options))
|
|
20632
|
+
};
|
|
20633
|
+
}
|
|
20634
|
+
function FromPropertyKeys3(type, propertyKeys, options) {
|
|
20635
|
+
return propertyKeys.reduce((result, leftKey) => {
|
|
20636
|
+
return { ...result, ...FromPropertyKey3(type, leftKey, options) };
|
|
20637
|
+
}, {});
|
|
20638
|
+
}
|
|
20639
|
+
function FromMappedKey4(type, mappedKey, options) {
|
|
20640
|
+
return FromPropertyKeys3(type, mappedKey.keys, options);
|
|
20641
|
+
}
|
|
20642
|
+
function PickFromMappedKey(type, mappedKey, options) {
|
|
20643
|
+
const properties = FromMappedKey4(type, mappedKey, options);
|
|
20644
|
+
return MappedResult(properties);
|
|
20645
|
+
}
|
|
20646
|
+
|
|
20647
|
+
// node_modules/@sinclair/typebox/build/esm/type/partial/partial.mjs
|
|
20648
|
+
function FromComputed3(target, parameters) {
|
|
20649
|
+
return Computed("Partial", [Computed(target, parameters)]);
|
|
20650
|
+
}
|
|
20651
|
+
function FromRef3($ref) {
|
|
20652
|
+
return Computed("Partial", [Ref($ref)]);
|
|
20653
|
+
}
|
|
20654
|
+
function FromProperties16(properties) {
|
|
20655
|
+
const partialProperties = {};
|
|
20656
|
+
for (const K of globalThis.Object.getOwnPropertyNames(properties))
|
|
20657
|
+
partialProperties[K] = Optional(properties[K]);
|
|
20658
|
+
return partialProperties;
|
|
20659
|
+
}
|
|
20660
|
+
function FromObject5(type, properties) {
|
|
20661
|
+
const options = Discard(type, [TransformKind, "$id", "required", "properties"]);
|
|
20662
|
+
const mappedProperties = FromProperties16(properties);
|
|
20663
|
+
return Object2(mappedProperties, options);
|
|
20664
|
+
}
|
|
20665
|
+
function FromRest6(types2) {
|
|
20666
|
+
return types2.map((type) => PartialResolve(type));
|
|
20667
|
+
}
|
|
20668
|
+
function PartialResolve(type) {
|
|
20669
|
+
return (
|
|
20670
|
+
// Mappable
|
|
20671
|
+
IsComputed(type) ? FromComputed3(type.target, type.parameters) : IsRef(type) ? FromRef3(type.$ref) : IsIntersect(type) ? Intersect(FromRest6(type.allOf)) : IsUnion(type) ? Union(FromRest6(type.anyOf)) : IsObject3(type) ? FromObject5(type, type.properties) : (
|
|
20672
|
+
// Intrinsic
|
|
20673
|
+
IsBigInt2(type) ? type : IsBoolean2(type) ? type : IsInteger(type) ? type : IsLiteral(type) ? type : IsNull2(type) ? type : IsNumber3(type) ? type : IsString2(type) ? type : IsSymbol2(type) ? type : IsUndefined3(type) ? type : (
|
|
20674
|
+
// Passthrough
|
|
20675
|
+
Object2({})
|
|
20676
|
+
)
|
|
20677
|
+
)
|
|
20678
|
+
);
|
|
20679
|
+
}
|
|
20680
|
+
function Partial(type, options) {
|
|
20681
|
+
if (IsMappedResult(type)) {
|
|
20682
|
+
return PartialFromMappedResult(type, options);
|
|
20683
|
+
} else {
|
|
20684
|
+
return CreateType({ ...PartialResolve(type), ...options });
|
|
20685
|
+
}
|
|
20686
|
+
}
|
|
20687
|
+
|
|
20688
|
+
// node_modules/@sinclair/typebox/build/esm/type/partial/partial-from-mapped-result.mjs
|
|
20689
|
+
function FromProperties17(K, options) {
|
|
20690
|
+
const Acc = {};
|
|
20691
|
+
for (const K2 of globalThis.Object.getOwnPropertyNames(K))
|
|
20692
|
+
Acc[K2] = Partial(K[K2], Clone(options));
|
|
20693
|
+
return Acc;
|
|
20694
|
+
}
|
|
20695
|
+
function FromMappedResult11(R, options) {
|
|
20696
|
+
return FromProperties17(R.properties, options);
|
|
20697
|
+
}
|
|
20698
|
+
function PartialFromMappedResult(R, options) {
|
|
20699
|
+
const P = FromMappedResult11(R, options);
|
|
20700
|
+
return MappedResult(P);
|
|
20701
|
+
}
|
|
20702
|
+
|
|
20703
|
+
// node_modules/@sinclair/typebox/build/esm/type/required/required.mjs
|
|
20704
|
+
function FromComputed4(target, parameters) {
|
|
20705
|
+
return Computed("Required", [Computed(target, parameters)]);
|
|
20706
|
+
}
|
|
20707
|
+
function FromRef4($ref) {
|
|
20708
|
+
return Computed("Required", [Ref($ref)]);
|
|
20709
|
+
}
|
|
20710
|
+
function FromProperties18(properties) {
|
|
20711
|
+
const requiredProperties = {};
|
|
20712
|
+
for (const K of globalThis.Object.getOwnPropertyNames(properties))
|
|
20713
|
+
requiredProperties[K] = Discard(properties[K], [OptionalKind]);
|
|
20714
|
+
return requiredProperties;
|
|
20715
|
+
}
|
|
20716
|
+
function FromObject6(type, properties) {
|
|
20717
|
+
const options = Discard(type, [TransformKind, "$id", "required", "properties"]);
|
|
20718
|
+
const mappedProperties = FromProperties18(properties);
|
|
20719
|
+
return Object2(mappedProperties, options);
|
|
20720
|
+
}
|
|
20721
|
+
function FromRest7(types2) {
|
|
20722
|
+
return types2.map((type) => RequiredResolve(type));
|
|
20723
|
+
}
|
|
20724
|
+
function RequiredResolve(type) {
|
|
20725
|
+
return (
|
|
20726
|
+
// Mappable
|
|
20727
|
+
IsComputed(type) ? FromComputed4(type.target, type.parameters) : IsRef(type) ? FromRef4(type.$ref) : IsIntersect(type) ? Intersect(FromRest7(type.allOf)) : IsUnion(type) ? Union(FromRest7(type.anyOf)) : IsObject3(type) ? FromObject6(type, type.properties) : (
|
|
20728
|
+
// Intrinsic
|
|
20729
|
+
IsBigInt2(type) ? type : IsBoolean2(type) ? type : IsInteger(type) ? type : IsLiteral(type) ? type : IsNull2(type) ? type : IsNumber3(type) ? type : IsString2(type) ? type : IsSymbol2(type) ? type : IsUndefined3(type) ? type : (
|
|
20730
|
+
// Passthrough
|
|
20731
|
+
Object2({})
|
|
20732
|
+
)
|
|
20733
|
+
)
|
|
20734
|
+
);
|
|
20735
|
+
}
|
|
20736
|
+
function Required(type, options) {
|
|
20737
|
+
if (IsMappedResult(type)) {
|
|
20738
|
+
return RequiredFromMappedResult(type, options);
|
|
20739
|
+
} else {
|
|
20740
|
+
return CreateType({ ...RequiredResolve(type), ...options });
|
|
20741
|
+
}
|
|
20742
|
+
}
|
|
20743
|
+
|
|
20744
|
+
// node_modules/@sinclair/typebox/build/esm/type/required/required-from-mapped-result.mjs
|
|
20745
|
+
function FromProperties19(P, options) {
|
|
20746
|
+
const Acc = {};
|
|
20747
|
+
for (const K2 of globalThis.Object.getOwnPropertyNames(P))
|
|
20748
|
+
Acc[K2] = Required(P[K2], options);
|
|
20749
|
+
return Acc;
|
|
20750
|
+
}
|
|
20751
|
+
function FromMappedResult12(R, options) {
|
|
20752
|
+
return FromProperties19(R.properties, options);
|
|
20753
|
+
}
|
|
20754
|
+
function RequiredFromMappedResult(R, options) {
|
|
20755
|
+
const P = FromMappedResult12(R, options);
|
|
20756
|
+
return MappedResult(P);
|
|
20757
|
+
}
|
|
20758
|
+
|
|
20759
|
+
// node_modules/@sinclair/typebox/build/esm/type/module/compute.mjs
|
|
20760
|
+
function DereferenceParameters(moduleProperties, types2) {
|
|
20761
|
+
return types2.map((type) => {
|
|
20762
|
+
return IsRef(type) ? Dereference(moduleProperties, type.$ref) : FromType2(moduleProperties, type);
|
|
20763
|
+
});
|
|
20764
|
+
}
|
|
20765
|
+
function Dereference(moduleProperties, ref) {
|
|
20766
|
+
return ref in moduleProperties ? IsRef(moduleProperties[ref]) ? Dereference(moduleProperties, moduleProperties[ref].$ref) : FromType2(moduleProperties, moduleProperties[ref]) : Never();
|
|
20767
|
+
}
|
|
20768
|
+
function FromAwaited(parameters) {
|
|
20769
|
+
return Awaited(parameters[0]);
|
|
20770
|
+
}
|
|
20771
|
+
function FromIndex(parameters) {
|
|
20772
|
+
return Index(parameters[0], parameters[1]);
|
|
20773
|
+
}
|
|
20774
|
+
function FromKeyOf(parameters) {
|
|
20775
|
+
return KeyOf(parameters[0]);
|
|
20776
|
+
}
|
|
20777
|
+
function FromPartial(parameters) {
|
|
20778
|
+
return Partial(parameters[0]);
|
|
20779
|
+
}
|
|
20780
|
+
function FromOmit(parameters) {
|
|
20781
|
+
return Omit(parameters[0], parameters[1]);
|
|
20782
|
+
}
|
|
20783
|
+
function FromPick(parameters) {
|
|
20784
|
+
return Pick(parameters[0], parameters[1]);
|
|
20785
|
+
}
|
|
20786
|
+
function FromRequired(parameters) {
|
|
20787
|
+
return Required(parameters[0]);
|
|
20788
|
+
}
|
|
20789
|
+
function FromComputed5(moduleProperties, target, parameters) {
|
|
20790
|
+
const dereferenced = DereferenceParameters(moduleProperties, parameters);
|
|
20791
|
+
return target === "Awaited" ? FromAwaited(dereferenced) : target === "Index" ? FromIndex(dereferenced) : target === "KeyOf" ? FromKeyOf(dereferenced) : target === "Partial" ? FromPartial(dereferenced) : target === "Omit" ? FromOmit(dereferenced) : target === "Pick" ? FromPick(dereferenced) : target === "Required" ? FromRequired(dereferenced) : Never();
|
|
20792
|
+
}
|
|
20793
|
+
function FromArray6(moduleProperties, type) {
|
|
20794
|
+
return Array2(FromType2(moduleProperties, type));
|
|
20795
|
+
}
|
|
20796
|
+
function FromAsyncIterator3(moduleProperties, type) {
|
|
20797
|
+
return AsyncIterator(FromType2(moduleProperties, type));
|
|
20798
|
+
}
|
|
20799
|
+
function FromConstructor3(moduleProperties, parameters, instanceType) {
|
|
20800
|
+
return Constructor(FromTypes2(moduleProperties, parameters), FromType2(moduleProperties, instanceType));
|
|
20801
|
+
}
|
|
20802
|
+
function FromFunction3(moduleProperties, parameters, returnType) {
|
|
20803
|
+
return Function2(FromTypes2(moduleProperties, parameters), FromType2(moduleProperties, returnType));
|
|
20804
|
+
}
|
|
20805
|
+
function FromIntersect8(moduleProperties, types2) {
|
|
20806
|
+
return Intersect(FromTypes2(moduleProperties, types2));
|
|
20807
|
+
}
|
|
20808
|
+
function FromIterator3(moduleProperties, type) {
|
|
20809
|
+
return Iterator(FromType2(moduleProperties, type));
|
|
20810
|
+
}
|
|
20811
|
+
function FromObject7(moduleProperties, properties) {
|
|
20812
|
+
return Object2(globalThis.Object.keys(properties).reduce((result, key) => {
|
|
20813
|
+
return { ...result, [key]: FromType2(moduleProperties, properties[key]) };
|
|
20814
|
+
}, {}));
|
|
20815
|
+
}
|
|
20816
|
+
function FromRecord3(moduleProperties, type) {
|
|
20817
|
+
const [value, pattern] = [FromType2(moduleProperties, RecordValue2(type)), RecordPattern(type)];
|
|
20818
|
+
const result = CloneType(type);
|
|
20819
|
+
result.patternProperties[pattern] = value;
|
|
20820
|
+
return result;
|
|
20821
|
+
}
|
|
20822
|
+
function FromTransform(moduleProperties, transform) {
|
|
20823
|
+
return IsRef(transform) ? { ...Dereference(moduleProperties, transform.$ref), [TransformKind]: transform[TransformKind] } : transform;
|
|
20824
|
+
}
|
|
20825
|
+
function FromTuple5(moduleProperties, types2) {
|
|
20826
|
+
return Tuple(FromTypes2(moduleProperties, types2));
|
|
20827
|
+
}
|
|
20828
|
+
function FromUnion10(moduleProperties, types2) {
|
|
20829
|
+
return Union(FromTypes2(moduleProperties, types2));
|
|
20830
|
+
}
|
|
20831
|
+
function FromTypes2(moduleProperties, types2) {
|
|
20832
|
+
return types2.map((type) => FromType2(moduleProperties, type));
|
|
20833
|
+
}
|
|
20834
|
+
function FromType2(moduleProperties, type) {
|
|
20835
|
+
return (
|
|
20836
|
+
// Modifiers
|
|
20837
|
+
IsOptional(type) ? CreateType(FromType2(moduleProperties, Discard(type, [OptionalKind])), type) : IsReadonly(type) ? CreateType(FromType2(moduleProperties, Discard(type, [ReadonlyKind])), type) : (
|
|
20838
|
+
// Transform
|
|
20839
|
+
IsTransform(type) ? CreateType(FromTransform(moduleProperties, type), type) : (
|
|
20840
|
+
// Types
|
|
20841
|
+
IsArray3(type) ? CreateType(FromArray6(moduleProperties, type.items), type) : IsAsyncIterator2(type) ? CreateType(FromAsyncIterator3(moduleProperties, type.items), type) : IsComputed(type) ? CreateType(FromComputed5(moduleProperties, type.target, type.parameters)) : IsConstructor(type) ? CreateType(FromConstructor3(moduleProperties, type.parameters, type.returns), type) : IsFunction2(type) ? CreateType(FromFunction3(moduleProperties, type.parameters, type.returns), type) : IsIntersect(type) ? CreateType(FromIntersect8(moduleProperties, type.allOf), type) : IsIterator2(type) ? CreateType(FromIterator3(moduleProperties, type.items), type) : IsObject3(type) ? CreateType(FromObject7(moduleProperties, type.properties), type) : IsRecord(type) ? CreateType(FromRecord3(moduleProperties, type)) : IsTuple(type) ? CreateType(FromTuple5(moduleProperties, type.items || []), type) : IsUnion(type) ? CreateType(FromUnion10(moduleProperties, type.anyOf), type) : type
|
|
20842
|
+
)
|
|
20843
|
+
)
|
|
20844
|
+
);
|
|
20845
|
+
}
|
|
20846
|
+
function ComputeType(moduleProperties, key) {
|
|
20847
|
+
return key in moduleProperties ? FromType2(moduleProperties, moduleProperties[key]) : Never();
|
|
20848
|
+
}
|
|
20849
|
+
function ComputeModuleProperties(moduleProperties) {
|
|
20850
|
+
return globalThis.Object.getOwnPropertyNames(moduleProperties).reduce((result, key) => {
|
|
20851
|
+
return { ...result, [key]: ComputeType(moduleProperties, key) };
|
|
20852
|
+
}, {});
|
|
20853
|
+
}
|
|
20854
|
+
|
|
20855
|
+
// node_modules/@sinclair/typebox/build/esm/type/module/module.mjs
|
|
20856
|
+
var TModule = class {
|
|
20857
|
+
constructor($defs) {
|
|
20858
|
+
const computed = ComputeModuleProperties($defs);
|
|
20859
|
+
const identified = this.WithIdentifiers(computed);
|
|
20860
|
+
this.$defs = identified;
|
|
20861
|
+
}
|
|
20862
|
+
/** `[Json]` Imports a Type by Key. */
|
|
20863
|
+
Import(key, options) {
|
|
20864
|
+
const $defs = { ...this.$defs, [key]: CreateType(this.$defs[key], options) };
|
|
20865
|
+
return CreateType({ [Kind]: "Import", $defs, $ref: key });
|
|
20866
|
+
}
|
|
20867
|
+
// prettier-ignore
|
|
20868
|
+
WithIdentifiers($defs) {
|
|
20869
|
+
return globalThis.Object.getOwnPropertyNames($defs).reduce((result, key) => {
|
|
20870
|
+
return { ...result, [key]: { ...$defs[key], $id: key } };
|
|
20871
|
+
}, {});
|
|
20872
|
+
}
|
|
20873
|
+
};
|
|
20874
|
+
function Module(properties) {
|
|
20875
|
+
return new TModule(properties);
|
|
20876
|
+
}
|
|
20877
|
+
|
|
20878
|
+
// node_modules/@sinclair/typebox/build/esm/type/not/not.mjs
|
|
20879
|
+
function Not(type, options) {
|
|
20880
|
+
return CreateType({ [Kind]: "Not", not: type }, options);
|
|
20881
|
+
}
|
|
20882
|
+
|
|
20883
|
+
// node_modules/@sinclair/typebox/build/esm/type/parameters/parameters.mjs
|
|
20884
|
+
function Parameters(schema, options) {
|
|
20885
|
+
return IsFunction2(schema) ? Tuple(schema.parameters, options) : Never();
|
|
20886
|
+
}
|
|
20887
|
+
|
|
20888
|
+
// node_modules/@sinclair/typebox/build/esm/type/recursive/recursive.mjs
|
|
20889
|
+
var Ordinal = 0;
|
|
20890
|
+
function Recursive(callback, options = {}) {
|
|
20891
|
+
if (IsUndefined(options.$id))
|
|
20892
|
+
options.$id = `T${Ordinal++}`;
|
|
20893
|
+
const thisType = CloneType(callback({ [Kind]: "This", $ref: `${options.$id}` }));
|
|
20894
|
+
thisType.$id = options.$id;
|
|
20895
|
+
return CreateType({ [Hint]: "Recursive", ...thisType }, options);
|
|
20896
|
+
}
|
|
20897
|
+
|
|
20898
|
+
// node_modules/@sinclair/typebox/build/esm/type/regexp/regexp.mjs
|
|
20899
|
+
function RegExp2(unresolved, options) {
|
|
20900
|
+
const expr = IsString(unresolved) ? new globalThis.RegExp(unresolved) : unresolved;
|
|
20901
|
+
return CreateType({ [Kind]: "RegExp", type: "RegExp", source: expr.source, flags: expr.flags }, options);
|
|
20902
|
+
}
|
|
20903
|
+
|
|
20904
|
+
// node_modules/@sinclair/typebox/build/esm/type/rest/rest.mjs
|
|
20905
|
+
function RestResolve(T) {
|
|
20906
|
+
return IsIntersect(T) ? T.allOf : IsUnion(T) ? T.anyOf : IsTuple(T) ? T.items ?? [] : [];
|
|
20907
|
+
}
|
|
20908
|
+
function Rest(T) {
|
|
20909
|
+
return RestResolve(T);
|
|
20910
|
+
}
|
|
20911
|
+
|
|
20912
|
+
// node_modules/@sinclair/typebox/build/esm/type/return-type/return-type.mjs
|
|
20913
|
+
function ReturnType(schema, options) {
|
|
20914
|
+
return IsFunction2(schema) ? CreateType(schema.returns, options) : Never(options);
|
|
20915
|
+
}
|
|
20916
|
+
|
|
20917
|
+
// node_modules/@sinclair/typebox/build/esm/type/transform/transform.mjs
|
|
20918
|
+
var TransformDecodeBuilder = class {
|
|
20919
|
+
constructor(schema) {
|
|
20920
|
+
this.schema = schema;
|
|
20921
|
+
}
|
|
20922
|
+
Decode(decode) {
|
|
20923
|
+
return new TransformEncodeBuilder(this.schema, decode);
|
|
20924
|
+
}
|
|
20925
|
+
};
|
|
20926
|
+
var TransformEncodeBuilder = class {
|
|
20927
|
+
constructor(schema, decode) {
|
|
20928
|
+
this.schema = schema;
|
|
20929
|
+
this.decode = decode;
|
|
20930
|
+
}
|
|
20931
|
+
EncodeTransform(encode, schema) {
|
|
20932
|
+
const Encode = (value) => schema[TransformKind].Encode(encode(value));
|
|
20933
|
+
const Decode = (value) => this.decode(schema[TransformKind].Decode(value));
|
|
20934
|
+
const Codec = { Encode, Decode };
|
|
20935
|
+
return { ...schema, [TransformKind]: Codec };
|
|
20936
|
+
}
|
|
20937
|
+
EncodeSchema(encode, schema) {
|
|
20938
|
+
const Codec = { Decode: this.decode, Encode: encode };
|
|
20939
|
+
return { ...schema, [TransformKind]: Codec };
|
|
20940
|
+
}
|
|
20941
|
+
Encode(encode) {
|
|
20942
|
+
return IsTransform(this.schema) ? this.EncodeTransform(encode, this.schema) : this.EncodeSchema(encode, this.schema);
|
|
20943
|
+
}
|
|
20944
|
+
};
|
|
20945
|
+
function Transform(schema) {
|
|
20946
|
+
return new TransformDecodeBuilder(schema);
|
|
20947
|
+
}
|
|
20948
|
+
|
|
20949
|
+
// node_modules/@sinclair/typebox/build/esm/type/unsafe/unsafe.mjs
|
|
20950
|
+
function Unsafe(options = {}) {
|
|
20951
|
+
return CreateType({ [Kind]: options[Kind] ?? "Unsafe" }, options);
|
|
20952
|
+
}
|
|
20953
|
+
|
|
20954
|
+
// node_modules/@sinclair/typebox/build/esm/type/void/void.mjs
|
|
20955
|
+
function Void(options) {
|
|
20956
|
+
return CreateType({ [Kind]: "Void", type: "void" }, options);
|
|
20957
|
+
}
|
|
20958
|
+
|
|
20959
|
+
// node_modules/@sinclair/typebox/build/esm/type/type/type.mjs
|
|
20960
|
+
var type_exports2 = {};
|
|
20961
|
+
__export(type_exports2, {
|
|
20962
|
+
Any: () => Any,
|
|
20963
|
+
Argument: () => Argument,
|
|
20964
|
+
Array: () => Array2,
|
|
20965
|
+
AsyncIterator: () => AsyncIterator,
|
|
20966
|
+
Awaited: () => Awaited,
|
|
20967
|
+
BigInt: () => BigInt2,
|
|
20968
|
+
Boolean: () => Boolean2,
|
|
20969
|
+
Capitalize: () => Capitalize,
|
|
20970
|
+
Composite: () => Composite,
|
|
20971
|
+
Const: () => Const,
|
|
20972
|
+
Constructor: () => Constructor,
|
|
20973
|
+
ConstructorParameters: () => ConstructorParameters,
|
|
20974
|
+
Date: () => Date2,
|
|
20975
|
+
Enum: () => Enum,
|
|
20976
|
+
Exclude: () => Exclude,
|
|
20977
|
+
Extends: () => Extends,
|
|
20978
|
+
Extract: () => Extract,
|
|
20979
|
+
Function: () => Function2,
|
|
20980
|
+
Index: () => Index,
|
|
20981
|
+
InstanceType: () => InstanceType,
|
|
20982
|
+
Instantiate: () => Instantiate,
|
|
20983
|
+
Integer: () => Integer,
|
|
20984
|
+
Intersect: () => Intersect,
|
|
20985
|
+
Iterator: () => Iterator,
|
|
20986
|
+
KeyOf: () => KeyOf,
|
|
20987
|
+
Literal: () => Literal,
|
|
20988
|
+
Lowercase: () => Lowercase,
|
|
20989
|
+
Mapped: () => Mapped,
|
|
20990
|
+
Module: () => Module,
|
|
20991
|
+
Never: () => Never,
|
|
20992
|
+
Not: () => Not,
|
|
20993
|
+
Null: () => Null,
|
|
20994
|
+
Number: () => Number2,
|
|
20995
|
+
Object: () => Object2,
|
|
20996
|
+
Omit: () => Omit,
|
|
20997
|
+
Optional: () => Optional,
|
|
20998
|
+
Parameters: () => Parameters,
|
|
20999
|
+
Partial: () => Partial,
|
|
21000
|
+
Pick: () => Pick,
|
|
21001
|
+
Promise: () => Promise2,
|
|
21002
|
+
Readonly: () => Readonly,
|
|
21003
|
+
ReadonlyOptional: () => ReadonlyOptional,
|
|
21004
|
+
Record: () => Record,
|
|
21005
|
+
Recursive: () => Recursive,
|
|
21006
|
+
Ref: () => Ref,
|
|
21007
|
+
RegExp: () => RegExp2,
|
|
21008
|
+
Required: () => Required,
|
|
21009
|
+
Rest: () => Rest,
|
|
21010
|
+
ReturnType: () => ReturnType,
|
|
21011
|
+
String: () => String2,
|
|
21012
|
+
Symbol: () => Symbol2,
|
|
21013
|
+
TemplateLiteral: () => TemplateLiteral,
|
|
21014
|
+
Transform: () => Transform,
|
|
21015
|
+
Tuple: () => Tuple,
|
|
21016
|
+
Uint8Array: () => Uint8Array2,
|
|
21017
|
+
Uncapitalize: () => Uncapitalize,
|
|
21018
|
+
Undefined: () => Undefined,
|
|
21019
|
+
Union: () => Union,
|
|
21020
|
+
Unknown: () => Unknown,
|
|
21021
|
+
Unsafe: () => Unsafe,
|
|
21022
|
+
Uppercase: () => Uppercase,
|
|
21023
|
+
Void: () => Void
|
|
21024
|
+
});
|
|
21025
|
+
|
|
21026
|
+
// node_modules/@sinclair/typebox/build/esm/type/type/index.mjs
|
|
21027
|
+
var Type = type_exports2;
|
|
21028
|
+
|
|
21029
|
+
// src/tools.ts
|
|
21030
|
+
function getTracker(ref) {
|
|
21031
|
+
if (!ref.current) {
|
|
21032
|
+
throw new Error("mindkeeper: tracker not ready \u2014 workspace not initialized yet.");
|
|
21033
|
+
}
|
|
21034
|
+
return ref.current;
|
|
21035
|
+
}
|
|
21036
|
+
function jsonResult(payload) {
|
|
21037
|
+
return {
|
|
21038
|
+
content: [{ type: "text", text: JSON.stringify(payload, null, 2) }],
|
|
21039
|
+
details: payload
|
|
21040
|
+
};
|
|
21041
|
+
}
|
|
21042
|
+
function registerTrackerTools(api, trackerRef) {
|
|
21043
|
+
if (!api.registerTool) return;
|
|
21044
|
+
api.registerTool({
|
|
21045
|
+
name: "mind_history",
|
|
21046
|
+
label: "Mind History",
|
|
21047
|
+
description: "View version history of agent context files. Optionally filter by a specific file. Returns commit hashes, dates, and messages.",
|
|
21048
|
+
parameters: Type.Object({
|
|
21049
|
+
file: Type.Optional(
|
|
21050
|
+
Type.String({ description: "File path to filter history (e.g. 'SOUL.md'). Omit for all files." })
|
|
21051
|
+
),
|
|
21052
|
+
limit: Type.Optional(
|
|
21053
|
+
Type.Number({ description: "Maximum number of entries to return (default: 10)." })
|
|
21054
|
+
)
|
|
21055
|
+
}),
|
|
21056
|
+
execute: async (_id, params) => {
|
|
21057
|
+
const commits = await getTracker(trackerRef).history({
|
|
21058
|
+
file: params.file,
|
|
21059
|
+
limit: params.limit ?? 10
|
|
21060
|
+
});
|
|
21061
|
+
return jsonResult(formatHistoryResult(commits));
|
|
21062
|
+
}
|
|
21063
|
+
});
|
|
21064
|
+
api.registerTool({
|
|
21065
|
+
name: "mind_diff",
|
|
21066
|
+
label: "Mind Diff",
|
|
21067
|
+
description: "Compare two versions of an agent context file. Shows additions, deletions, and a unified diff.",
|
|
21068
|
+
parameters: Type.Object({
|
|
21069
|
+
file: Type.String({ description: "File path to compare (e.g. 'SOUL.md')." }),
|
|
21070
|
+
from: Type.String({ description: "Source commit hash." }),
|
|
21071
|
+
to: Type.Optional(
|
|
21072
|
+
Type.String({ description: "Target commit hash (defaults to HEAD)." })
|
|
21073
|
+
)
|
|
21074
|
+
}),
|
|
21075
|
+
execute: async (_id, params) => {
|
|
21076
|
+
const result = await getTracker(trackerRef).diff({
|
|
21077
|
+
file: params.file,
|
|
21078
|
+
from: params.from,
|
|
21079
|
+
to: params.to
|
|
21080
|
+
});
|
|
21081
|
+
return jsonResult(formatDiffResult(result));
|
|
21082
|
+
}
|
|
21083
|
+
});
|
|
21084
|
+
api.registerTool({
|
|
21085
|
+
name: "mind_rollback",
|
|
21086
|
+
label: "Mind Rollback",
|
|
21087
|
+
description: "Rollback an agent context file to a previous version. First call with preview=true to see the diff, then call again with preview=false to execute.",
|
|
21088
|
+
parameters: Type.Object({
|
|
21089
|
+
file: Type.String({ description: "File path to rollback (e.g. 'SOUL.md')." }),
|
|
21090
|
+
to: Type.String({ description: "Commit hash to rollback to." }),
|
|
21091
|
+
preview: Type.Optional(
|
|
21092
|
+
Type.Boolean({
|
|
21093
|
+
description: "If true, show diff preview without executing rollback. Default: true."
|
|
21094
|
+
})
|
|
21095
|
+
)
|
|
21096
|
+
}),
|
|
21097
|
+
execute: async (_id, params) => {
|
|
21098
|
+
const file = params.file;
|
|
21099
|
+
const to = params.to;
|
|
21100
|
+
const preview = params.preview ?? true;
|
|
21101
|
+
const tracker = getTracker(trackerRef);
|
|
21102
|
+
if (preview) {
|
|
21103
|
+
const diff2 = await tracker.diff({ file, from: to, to: "HEAD" });
|
|
21104
|
+
return jsonResult({
|
|
21105
|
+
preview: true,
|
|
21106
|
+
diff: formatDiffResult(diff2),
|
|
21107
|
+
instruction: "Show this diff to the user. If they confirm, call mind_rollback again with preview=false."
|
|
21108
|
+
});
|
|
21109
|
+
}
|
|
21110
|
+
const commit = await tracker.rollback({ file, to });
|
|
21111
|
+
return jsonResult({
|
|
21112
|
+
preview: false,
|
|
21113
|
+
success: true,
|
|
21114
|
+
commit: { oid: commit.oid.slice(0, 8), message: commit.message },
|
|
21115
|
+
note: "Tell the user to run /new to apply the changes to the current session."
|
|
21116
|
+
});
|
|
21117
|
+
}
|
|
21118
|
+
});
|
|
21119
|
+
api.registerTool({
|
|
21120
|
+
name: "mind_snapshot",
|
|
21121
|
+
label: "Mind Snapshot",
|
|
21122
|
+
description: "Create a named checkpoint of the current state of all agent context files. Useful before making significant changes.",
|
|
21123
|
+
parameters: Type.Object({
|
|
21124
|
+
name: Type.String({ description: "Snapshot name (e.g. 'personality-v2')." }),
|
|
21125
|
+
message: Type.Optional(
|
|
21126
|
+
Type.String({ description: "Optional description of this snapshot." })
|
|
21127
|
+
)
|
|
21128
|
+
}),
|
|
21129
|
+
execute: async (_id, params) => {
|
|
21130
|
+
const commit = await getTracker(trackerRef).snapshot({
|
|
21131
|
+
name: params.name,
|
|
21132
|
+
message: params.message
|
|
21133
|
+
});
|
|
21134
|
+
return jsonResult({
|
|
21135
|
+
success: true,
|
|
21136
|
+
snapshot: params.name,
|
|
21137
|
+
commit: { oid: commit.oid.slice(0, 8), message: commit.message }
|
|
21138
|
+
});
|
|
21139
|
+
}
|
|
21140
|
+
});
|
|
21141
|
+
api.registerTool({
|
|
21142
|
+
name: "mind_status",
|
|
21143
|
+
label: "Mind Status",
|
|
21144
|
+
description: "Show the current tracking status: whether mindkeeper is initialized, tracked files, pending changes, and named snapshots.",
|
|
21145
|
+
parameters: Type.Object({}),
|
|
21146
|
+
execute: async () => {
|
|
21147
|
+
const status = await getTracker(trackerRef).status();
|
|
21148
|
+
return jsonResult(formatStatusResult(status));
|
|
21149
|
+
}
|
|
21150
|
+
});
|
|
21151
|
+
}
|
|
21152
|
+
function formatHistoryResult(commits) {
|
|
21153
|
+
return {
|
|
21154
|
+
count: commits.length,
|
|
21155
|
+
entries: commits.map((c) => ({
|
|
21156
|
+
oid: c.oid.slice(0, 8),
|
|
21157
|
+
date: c.date.toISOString().replace("T", " ").slice(0, 19),
|
|
21158
|
+
message: c.message
|
|
21159
|
+
}))
|
|
21160
|
+
};
|
|
21161
|
+
}
|
|
21162
|
+
function formatDiffResult(result) {
|
|
21163
|
+
return {
|
|
21164
|
+
file: result.file,
|
|
21165
|
+
from: result.fromVersion,
|
|
21166
|
+
to: result.toVersion,
|
|
21167
|
+
additions: result.additions,
|
|
21168
|
+
deletions: result.deletions,
|
|
21169
|
+
unified: result.unified
|
|
21170
|
+
};
|
|
21171
|
+
}
|
|
21172
|
+
function formatStatusResult(status) {
|
|
21173
|
+
return {
|
|
21174
|
+
initialized: status.initialized,
|
|
21175
|
+
workDir: status.workDir,
|
|
21176
|
+
pendingChanges: status.pendingChanges.map((e) => ({
|
|
21177
|
+
file: e.filepath,
|
|
21178
|
+
status: e.status
|
|
21179
|
+
})),
|
|
21180
|
+
snapshots: status.snapshots.map((s) => ({
|
|
21181
|
+
name: s.name,
|
|
21182
|
+
oid: s.oid.slice(0, 8)
|
|
21183
|
+
}))
|
|
21184
|
+
};
|
|
21185
|
+
}
|
|
21186
|
+
|
|
21187
|
+
// src/cli.ts
|
|
21188
|
+
function getTracker2(ref) {
|
|
21189
|
+
if (!ref.current) {
|
|
21190
|
+
throw new Error("mindkeeper: tracker not ready \u2014 workspace not initialized yet.");
|
|
21191
|
+
}
|
|
21192
|
+
return ref.current;
|
|
21193
|
+
}
|
|
21194
|
+
function registerTrackerCli(api, trackerRef) {
|
|
21195
|
+
if (!api.registerCli) return;
|
|
21196
|
+
api.registerCli((program) => {
|
|
21197
|
+
const cmd = program;
|
|
21198
|
+
const mindCmd = cmd.command("mind");
|
|
21199
|
+
addSubcommand(mindCmd, "status", "Show tracking status", async () => {
|
|
21200
|
+
const status = await getTracker2(trackerRef).status();
|
|
21201
|
+
console.log(`Workspace: ${status.workDir}`);
|
|
21202
|
+
console.log(`Pending changes: ${status.pendingChanges.length}`);
|
|
21203
|
+
console.log(`Named snapshots: ${status.snapshots.length}`);
|
|
21204
|
+
});
|
|
21205
|
+
addSubcommand(mindCmd, "history [file]", "View change history", async (...args) => {
|
|
21206
|
+
const file = args[0];
|
|
21207
|
+
const commits = await getTracker2(trackerRef).history({ file, limit: 20 });
|
|
21208
|
+
if (commits.length === 0) {
|
|
21209
|
+
console.log("No history found.");
|
|
21210
|
+
return;
|
|
21211
|
+
}
|
|
21212
|
+
for (const c of commits) {
|
|
21213
|
+
const date = c.date.toISOString().replace("T", " ").slice(0, 19);
|
|
21214
|
+
console.log(`${c.oid.slice(0, 8)} ${date} ${c.message}`);
|
|
21215
|
+
}
|
|
21216
|
+
});
|
|
21217
|
+
addSubcommand(
|
|
21218
|
+
mindCmd,
|
|
21219
|
+
"snapshot [name]",
|
|
21220
|
+
"Create a named snapshot",
|
|
21221
|
+
async (...args) => {
|
|
21222
|
+
const name = args[0];
|
|
21223
|
+
const commit = await getTracker2(trackerRef).snapshot({ name });
|
|
21224
|
+
console.log(`Snapshot created: ${commit.oid.slice(0, 8)} ${commit.message}`);
|
|
21225
|
+
if (name) console.log(`Tagged as: ${name}`);
|
|
21226
|
+
}
|
|
21227
|
+
);
|
|
21228
|
+
});
|
|
21229
|
+
}
|
|
21230
|
+
function addSubcommand(parent, name, description, handler) {
|
|
21231
|
+
parent.command(name).description(description).action(handler);
|
|
21232
|
+
}
|
|
21233
|
+
|
|
21234
|
+
// ../core/src/tracker.ts
|
|
21235
|
+
import fsPromises3 from "node:fs/promises";
|
|
21236
|
+
import path4 from "node:path";
|
|
21237
|
+
|
|
21238
|
+
// ../../node_modules/.pnpm/balanced-match@4.0.4/node_modules/balanced-match/dist/esm/index.js
|
|
21239
|
+
var balanced = (a, b, str) => {
|
|
21240
|
+
const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
|
|
21241
|
+
const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
|
|
21242
|
+
const r = ma !== null && mb != null && range(ma, mb, str);
|
|
21243
|
+
return r && {
|
|
21244
|
+
start: r[0],
|
|
21245
|
+
end: r[1],
|
|
21246
|
+
pre: str.slice(0, r[0]),
|
|
21247
|
+
body: str.slice(r[0] + ma.length, r[1]),
|
|
21248
|
+
post: str.slice(r[1] + mb.length)
|
|
21249
|
+
};
|
|
21250
|
+
};
|
|
21251
|
+
var maybeMatch = (reg, str) => {
|
|
21252
|
+
const m = str.match(reg);
|
|
21253
|
+
return m ? m[0] : null;
|
|
21254
|
+
};
|
|
21255
|
+
var range = (a, b, str) => {
|
|
21256
|
+
let begs, beg, left, right = void 0, result;
|
|
21257
|
+
let ai = str.indexOf(a);
|
|
21258
|
+
let bi = str.indexOf(b, ai + 1);
|
|
21259
|
+
let i = ai;
|
|
21260
|
+
if (ai >= 0 && bi > 0) {
|
|
21261
|
+
if (a === b) {
|
|
21262
|
+
return [ai, bi];
|
|
21263
|
+
}
|
|
21264
|
+
begs = [];
|
|
21265
|
+
left = str.length;
|
|
21266
|
+
while (i >= 0 && !result) {
|
|
21267
|
+
if (i === ai) {
|
|
21268
|
+
begs.push(i);
|
|
21269
|
+
ai = str.indexOf(a, i + 1);
|
|
21270
|
+
} else if (begs.length === 1) {
|
|
21271
|
+
const r = begs.pop();
|
|
21272
|
+
if (r !== void 0)
|
|
21273
|
+
result = [r, bi];
|
|
21274
|
+
} else {
|
|
21275
|
+
beg = begs.pop();
|
|
21276
|
+
if (beg !== void 0 && beg < left) {
|
|
21277
|
+
left = beg;
|
|
21278
|
+
right = bi;
|
|
21279
|
+
}
|
|
21280
|
+
bi = str.indexOf(b, i + 1);
|
|
21281
|
+
}
|
|
21282
|
+
i = ai < bi && ai >= 0 ? ai : bi;
|
|
21283
|
+
}
|
|
21284
|
+
if (begs.length && right !== void 0) {
|
|
21285
|
+
result = [left, right];
|
|
21286
|
+
}
|
|
21287
|
+
}
|
|
21288
|
+
return result;
|
|
21289
|
+
};
|
|
21290
|
+
|
|
21291
|
+
// ../../node_modules/.pnpm/brace-expansion@5.0.4/node_modules/brace-expansion/dist/esm/index.js
|
|
21292
|
+
var escSlash = "\0SLASH" + Math.random() + "\0";
|
|
21293
|
+
var escOpen = "\0OPEN" + Math.random() + "\0";
|
|
21294
|
+
var escClose = "\0CLOSE" + Math.random() + "\0";
|
|
21295
|
+
var escComma = "\0COMMA" + Math.random() + "\0";
|
|
21296
|
+
var escPeriod = "\0PERIOD" + Math.random() + "\0";
|
|
21297
|
+
var escSlashPattern = new RegExp(escSlash, "g");
|
|
21298
|
+
var escOpenPattern = new RegExp(escOpen, "g");
|
|
21299
|
+
var escClosePattern = new RegExp(escClose, "g");
|
|
21300
|
+
var escCommaPattern = new RegExp(escComma, "g");
|
|
21301
|
+
var escPeriodPattern = new RegExp(escPeriod, "g");
|
|
21302
|
+
var slashPattern = /\\\\/g;
|
|
21303
|
+
var openPattern = /\\{/g;
|
|
21304
|
+
var closePattern = /\\}/g;
|
|
21305
|
+
var commaPattern = /\\,/g;
|
|
21306
|
+
var periodPattern = /\\\./g;
|
|
21307
|
+
var EXPANSION_MAX = 1e5;
|
|
21308
|
+
function numeric(str) {
|
|
21309
|
+
return !isNaN(str) ? parseInt(str, 10) : str.charCodeAt(0);
|
|
21310
|
+
}
|
|
21311
|
+
function escapeBraces(str) {
|
|
21312
|
+
return str.replace(slashPattern, escSlash).replace(openPattern, escOpen).replace(closePattern, escClose).replace(commaPattern, escComma).replace(periodPattern, escPeriod);
|
|
21313
|
+
}
|
|
21314
|
+
function unescapeBraces(str) {
|
|
21315
|
+
return str.replace(escSlashPattern, "\\").replace(escOpenPattern, "{").replace(escClosePattern, "}").replace(escCommaPattern, ",").replace(escPeriodPattern, ".");
|
|
21316
|
+
}
|
|
21317
|
+
function parseCommaParts(str) {
|
|
21318
|
+
if (!str) {
|
|
21319
|
+
return [""];
|
|
21320
|
+
}
|
|
21321
|
+
const parts = [];
|
|
21322
|
+
const m = balanced("{", "}", str);
|
|
21323
|
+
if (!m) {
|
|
21324
|
+
return str.split(",");
|
|
21325
|
+
}
|
|
21326
|
+
const { pre, body, post } = m;
|
|
21327
|
+
const p = pre.split(",");
|
|
21328
|
+
p[p.length - 1] += "{" + body + "}";
|
|
21329
|
+
const postParts = parseCommaParts(post);
|
|
21330
|
+
if (post.length) {
|
|
21331
|
+
;
|
|
21332
|
+
p[p.length - 1] += postParts.shift();
|
|
21333
|
+
p.push.apply(p, postParts);
|
|
21334
|
+
}
|
|
21335
|
+
parts.push.apply(parts, p);
|
|
21336
|
+
return parts;
|
|
21337
|
+
}
|
|
21338
|
+
function expand(str, options = {}) {
|
|
21339
|
+
if (!str) {
|
|
21340
|
+
return [];
|
|
21341
|
+
}
|
|
21342
|
+
const { max = EXPANSION_MAX } = options;
|
|
21343
|
+
if (str.slice(0, 2) === "{}") {
|
|
21344
|
+
str = "\\{\\}" + str.slice(2);
|
|
21345
|
+
}
|
|
21346
|
+
return expand_(escapeBraces(str), max, true).map(unescapeBraces);
|
|
21347
|
+
}
|
|
21348
|
+
function embrace(str) {
|
|
21349
|
+
return "{" + str + "}";
|
|
21350
|
+
}
|
|
21351
|
+
function isPadded(el) {
|
|
21352
|
+
return /^-?0\d/.test(el);
|
|
21353
|
+
}
|
|
21354
|
+
function lte(i, y) {
|
|
21355
|
+
return i <= y;
|
|
21356
|
+
}
|
|
21357
|
+
function gte(i, y) {
|
|
21358
|
+
return i >= y;
|
|
21359
|
+
}
|
|
21360
|
+
function expand_(str, max, isTop) {
|
|
21361
|
+
const expansions = [];
|
|
21362
|
+
const m = balanced("{", "}", str);
|
|
21363
|
+
if (!m)
|
|
21364
|
+
return [str];
|
|
21365
|
+
const pre = m.pre;
|
|
21366
|
+
const post = m.post.length ? expand_(m.post, max, false) : [""];
|
|
21367
|
+
if (/\$$/.test(m.pre)) {
|
|
21368
|
+
for (let k = 0; k < post.length && k < max; k++) {
|
|
21369
|
+
const expansion = pre + "{" + m.body + "}" + post[k];
|
|
21370
|
+
expansions.push(expansion);
|
|
21371
|
+
}
|
|
21372
|
+
} else {
|
|
21373
|
+
const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
21374
|
+
const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
21375
|
+
const isSequence = isNumericSequence || isAlphaSequence;
|
|
21376
|
+
const isOptions = m.body.indexOf(",") >= 0;
|
|
21377
|
+
if (!isSequence && !isOptions) {
|
|
21378
|
+
if (m.post.match(/,(?!,).*\}/)) {
|
|
21379
|
+
str = m.pre + "{" + m.body + escClose + m.post;
|
|
21380
|
+
return expand_(str, max, true);
|
|
21381
|
+
}
|
|
21382
|
+
return [str];
|
|
21383
|
+
}
|
|
21384
|
+
let n;
|
|
21385
|
+
if (isSequence) {
|
|
21386
|
+
n = m.body.split(/\.\./);
|
|
21387
|
+
} else {
|
|
21388
|
+
n = parseCommaParts(m.body);
|
|
21389
|
+
if (n.length === 1 && n[0] !== void 0) {
|
|
21390
|
+
n = expand_(n[0], max, false).map(embrace);
|
|
21391
|
+
if (n.length === 1) {
|
|
21392
|
+
return post.map((p) => m.pre + n[0] + p);
|
|
21393
|
+
}
|
|
21394
|
+
}
|
|
21395
|
+
}
|
|
21396
|
+
let N;
|
|
21397
|
+
if (isSequence && n[0] !== void 0 && n[1] !== void 0) {
|
|
21398
|
+
const x = numeric(n[0]);
|
|
21399
|
+
const y = numeric(n[1]);
|
|
21400
|
+
const width = Math.max(n[0].length, n[1].length);
|
|
21401
|
+
let incr = n.length === 3 && n[2] !== void 0 ? Math.abs(numeric(n[2])) : 1;
|
|
21402
|
+
let test = lte;
|
|
21403
|
+
const reverse = y < x;
|
|
21404
|
+
if (reverse) {
|
|
21405
|
+
incr *= -1;
|
|
21406
|
+
test = gte;
|
|
21407
|
+
}
|
|
21408
|
+
const pad = n.some(isPadded);
|
|
21409
|
+
N = [];
|
|
21410
|
+
for (let i = x; test(i, y); i += incr) {
|
|
21411
|
+
let c;
|
|
21412
|
+
if (isAlphaSequence) {
|
|
21413
|
+
c = String.fromCharCode(i);
|
|
21414
|
+
if (c === "\\") {
|
|
21415
|
+
c = "";
|
|
21416
|
+
}
|
|
21417
|
+
} else {
|
|
21418
|
+
c = String(i);
|
|
21419
|
+
if (pad) {
|
|
21420
|
+
const need = width - c.length;
|
|
21421
|
+
if (need > 0) {
|
|
21422
|
+
const z = new Array(need + 1).join("0");
|
|
21423
|
+
if (i < 0) {
|
|
21424
|
+
c = "-" + z + c.slice(1);
|
|
21425
|
+
} else {
|
|
21426
|
+
c = z + c;
|
|
21427
|
+
}
|
|
21428
|
+
}
|
|
21429
|
+
}
|
|
21430
|
+
}
|
|
21431
|
+
N.push(c);
|
|
21432
|
+
}
|
|
21433
|
+
} else {
|
|
21434
|
+
N = [];
|
|
21435
|
+
for (let j = 0; j < n.length; j++) {
|
|
21436
|
+
N.push.apply(N, expand_(n[j], max, false));
|
|
21437
|
+
}
|
|
21438
|
+
}
|
|
21439
|
+
for (let j = 0; j < N.length; j++) {
|
|
21440
|
+
for (let k = 0; k < post.length && expansions.length < max; k++) {
|
|
21441
|
+
const expansion = pre + N[j] + post[k];
|
|
21442
|
+
if (!isTop || isSequence || expansion) {
|
|
21443
|
+
expansions.push(expansion);
|
|
21444
|
+
}
|
|
21445
|
+
}
|
|
21446
|
+
}
|
|
21447
|
+
}
|
|
21448
|
+
return expansions;
|
|
21449
|
+
}
|
|
21450
|
+
|
|
21451
|
+
// ../../node_modules/.pnpm/minimatch@10.2.4/node_modules/minimatch/dist/esm/assert-valid-pattern.js
|
|
21452
|
+
var MAX_PATTERN_LENGTH = 1024 * 64;
|
|
21453
|
+
var assertValidPattern = (pattern) => {
|
|
21454
|
+
if (typeof pattern !== "string") {
|
|
21455
|
+
throw new TypeError("invalid pattern");
|
|
21456
|
+
}
|
|
21457
|
+
if (pattern.length > MAX_PATTERN_LENGTH) {
|
|
21458
|
+
throw new TypeError("pattern is too long");
|
|
21459
|
+
}
|
|
21460
|
+
};
|
|
21461
|
+
|
|
21462
|
+
// ../../node_modules/.pnpm/minimatch@10.2.4/node_modules/minimatch/dist/esm/brace-expressions.js
|
|
21463
|
+
var posixClasses = {
|
|
21464
|
+
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
|
|
21465
|
+
"[:alpha:]": ["\\p{L}\\p{Nl}", true],
|
|
21466
|
+
"[:ascii:]": ["\\x00-\\x7f", false],
|
|
21467
|
+
"[:blank:]": ["\\p{Zs}\\t", true],
|
|
21468
|
+
"[:cntrl:]": ["\\p{Cc}", true],
|
|
21469
|
+
"[:digit:]": ["\\p{Nd}", true],
|
|
21470
|
+
"[:graph:]": ["\\p{Z}\\p{C}", true, true],
|
|
21471
|
+
"[:lower:]": ["\\p{Ll}", true],
|
|
21472
|
+
"[:print:]": ["\\p{C}", true],
|
|
21473
|
+
"[:punct:]": ["\\p{P}", true],
|
|
18659
21474
|
"[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
|
|
18660
21475
|
"[:upper:]": ["\\p{Lu}", true],
|
|
18661
21476
|
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
|
|
@@ -20229,7 +23044,7 @@ minimatch.Minimatch = Minimatch;
|
|
|
20229
23044
|
minimatch.escape = escape;
|
|
20230
23045
|
minimatch.unescape = unescape;
|
|
20231
23046
|
|
|
20232
|
-
// ../core/
|
|
23047
|
+
// ../core/src/store/git-store.ts
|
|
20233
23048
|
var import_isomorphic_git = __toESM(require_isomorphic_git(), 1);
|
|
20234
23049
|
import fs from "node:fs";
|
|
20235
23050
|
import fsPromises from "node:fs/promises";
|
|
@@ -20292,8 +23107,7 @@ var IsomorphicGitStore = class {
|
|
|
20292
23107
|
const { oid, commit } = entry;
|
|
20293
23108
|
if (options?.filepath) {
|
|
20294
23109
|
const touchesFile = await this.commitTouchesFile(oid, options.filepath, entry);
|
|
20295
|
-
if (!touchesFile)
|
|
20296
|
-
continue;
|
|
23110
|
+
if (!touchesFile) continue;
|
|
20297
23111
|
}
|
|
20298
23112
|
results.push({
|
|
20299
23113
|
oid,
|
|
@@ -20447,8 +23261,7 @@ var IsomorphicGitStore = class {
|
|
|
20447
23261
|
for (const entry of entries) {
|
|
20448
23262
|
const fullPath = path2.join(dir, entry.name);
|
|
20449
23263
|
const relative3 = path2.relative(root, fullPath);
|
|
20450
|
-
if (relative3.startsWith(".mindkeeper") || relative3.startsWith(".git"))
|
|
20451
|
-
continue;
|
|
23264
|
+
if (relative3.startsWith(".mindkeeper") || relative3.startsWith(".git")) continue;
|
|
20452
23265
|
if (entry.isDirectory()) {
|
|
20453
23266
|
await this.walkDir(root, fullPath, results);
|
|
20454
23267
|
} else if (entry.isFile()) {
|
|
@@ -20464,11 +23277,9 @@ var IsomorphicGitStore = class {
|
|
|
20464
23277
|
gitdir: this.gitDir,
|
|
20465
23278
|
trees: [import_isomorphic_git.default.TREE({ ref: commitOid })],
|
|
20466
23279
|
map: async (filepath, entries) => {
|
|
20467
|
-
if (!entries || entries.length === 0)
|
|
20468
|
-
return void 0;
|
|
23280
|
+
if (!entries || entries.length === 0) return void 0;
|
|
20469
23281
|
const entry = entries[0];
|
|
20470
|
-
if (!entry)
|
|
20471
|
-
return void 0;
|
|
23282
|
+
if (!entry) return void 0;
|
|
20472
23283
|
const type = await entry.type();
|
|
20473
23284
|
if (type === "blob") {
|
|
20474
23285
|
files.push(filepath);
|
|
@@ -20480,7 +23291,7 @@ var IsomorphicGitStore = class {
|
|
|
20480
23291
|
}
|
|
20481
23292
|
};
|
|
20482
23293
|
|
|
20483
|
-
// ../core/
|
|
23294
|
+
// ../core/src/config.ts
|
|
20484
23295
|
import fsPromises2 from "node:fs/promises";
|
|
20485
23296
|
import path3 from "node:path";
|
|
20486
23297
|
import os from "node:os";
|
|
@@ -20509,7 +23320,9 @@ var DEFAULT_CONFIG = {
|
|
|
20509
23320
|
};
|
|
20510
23321
|
var SensitiveFieldError = class extends Error {
|
|
20511
23322
|
constructor(field, configPath) {
|
|
20512
|
-
super(
|
|
23323
|
+
super(
|
|
23324
|
+
`"${field}" is not allowed in workspace config (${configPath}). Move it to global config (~/.config/mindkeeper/config.json). Workspace config is tracked and may be shared.`
|
|
23325
|
+
);
|
|
20513
23326
|
this.name = "SensitiveFieldError";
|
|
20514
23327
|
}
|
|
20515
23328
|
};
|
|
@@ -20517,8 +23330,7 @@ function getNested(obj, dotPath) {
|
|
|
20517
23330
|
const parts = dotPath.split(".");
|
|
20518
23331
|
let current = obj;
|
|
20519
23332
|
for (const part of parts) {
|
|
20520
|
-
if (current == null || typeof current !== "object")
|
|
20521
|
-
return void 0;
|
|
23333
|
+
if (current == null || typeof current !== "object") return void 0;
|
|
20522
23334
|
current = current[part];
|
|
20523
23335
|
}
|
|
20524
23336
|
return current;
|
|
@@ -20545,7 +23357,10 @@ function deepMerge(target, source) {
|
|
|
20545
23357
|
const sourceVal = source[key];
|
|
20546
23358
|
const targetVal = target[key];
|
|
20547
23359
|
if (sourceVal != null && typeof sourceVal === "object" && !Array.isArray(sourceVal) && targetVal != null && typeof targetVal === "object" && !Array.isArray(targetVal)) {
|
|
20548
|
-
result[key] = deepMerge(
|
|
23360
|
+
result[key] = deepMerge(
|
|
23361
|
+
targetVal,
|
|
23362
|
+
sourceVal
|
|
23363
|
+
);
|
|
20549
23364
|
} else {
|
|
20550
23365
|
result[key] = sourceVal;
|
|
20551
23366
|
}
|
|
@@ -20559,7 +23374,9 @@ function getWorkspaceConfigPath(workDir) {
|
|
|
20559
23374
|
return path3.join(workDir, ".mindkeeper.json");
|
|
20560
23375
|
}
|
|
20561
23376
|
async function loadConfig(workDir) {
|
|
20562
|
-
let merged = structuredClone(
|
|
23377
|
+
let merged = structuredClone(
|
|
23378
|
+
DEFAULT_CONFIG
|
|
23379
|
+
);
|
|
20563
23380
|
const globalPath = getGlobalConfigPath();
|
|
20564
23381
|
const globalConfig = await readJsonFile(globalPath);
|
|
20565
23382
|
if (globalConfig) {
|
|
@@ -21379,11 +24196,27 @@ function splitLines(text) {
|
|
|
21379
24196
|
return result;
|
|
21380
24197
|
}
|
|
21381
24198
|
|
|
21382
|
-
// ../core/
|
|
24199
|
+
// ../core/src/diff.ts
|
|
21383
24200
|
function computeDiff(params) {
|
|
21384
24201
|
const { file, fromVersion, toVersion, oldContent, newContent } = params;
|
|
21385
|
-
const unified = createTwoFilesPatch(
|
|
21386
|
-
|
|
24202
|
+
const unified = createTwoFilesPatch(
|
|
24203
|
+
`a/${file}`,
|
|
24204
|
+
`b/${file}`,
|
|
24205
|
+
oldContent,
|
|
24206
|
+
newContent,
|
|
24207
|
+
fromVersion,
|
|
24208
|
+
toVersion,
|
|
24209
|
+
{ context: 3 }
|
|
24210
|
+
);
|
|
24211
|
+
const patches = structuredPatch(
|
|
24212
|
+
`a/${file}`,
|
|
24213
|
+
`b/${file}`,
|
|
24214
|
+
oldContent,
|
|
24215
|
+
newContent,
|
|
24216
|
+
fromVersion,
|
|
24217
|
+
toVersion,
|
|
24218
|
+
{ context: 3 }
|
|
24219
|
+
);
|
|
21387
24220
|
let additions = 0;
|
|
21388
24221
|
let deletions = 0;
|
|
21389
24222
|
const hunks = [];
|
|
@@ -21422,7 +24255,7 @@ function computeDiff(params) {
|
|
|
21422
24255
|
return { file, fromVersion, toVersion, hunks, additions, deletions, unified };
|
|
21423
24256
|
}
|
|
21424
24257
|
|
|
21425
|
-
// ../core/
|
|
24258
|
+
// ../core/src/message/template.ts
|
|
21426
24259
|
function generateTemplateMessage(changedFiles, options) {
|
|
21427
24260
|
if (options?.isRollback) {
|
|
21428
24261
|
const target = options.rollbackTarget ?? "unknown";
|
|
@@ -21436,10 +24269,9 @@ function generateTemplateMessage(changedFiles, options) {
|
|
|
21436
24269
|
return `[auto] Update ${files}`;
|
|
21437
24270
|
}
|
|
21438
24271
|
|
|
21439
|
-
// ../core/
|
|
24272
|
+
// ../core/src/message/llm.ts
|
|
21440
24273
|
async function generateLlmMessage(diffs, provider) {
|
|
21441
|
-
if (!provider)
|
|
21442
|
-
return null;
|
|
24274
|
+
if (!provider) return null;
|
|
21443
24275
|
try {
|
|
21444
24276
|
return await provider.generateCommitMessage(diffs);
|
|
21445
24277
|
} catch {
|
|
@@ -21447,7 +24279,7 @@ async function generateLlmMessage(diffs, provider) {
|
|
|
21447
24279
|
}
|
|
21448
24280
|
}
|
|
21449
24281
|
|
|
21450
|
-
// ../core/
|
|
24282
|
+
// ../core/src/tracker.ts
|
|
21451
24283
|
var ALWAYS_EXCLUDED = [".mindkeeper/**", ".git/**"];
|
|
21452
24284
|
var GITDIR_NAME = ".mindkeeper";
|
|
21453
24285
|
var Tracker = class {
|
|
@@ -21570,8 +24402,7 @@ var Tracker = class {
|
|
|
21570
24402
|
}
|
|
21571
24403
|
async autoSnapshot() {
|
|
21572
24404
|
const changed = await this.getTrackedChangedFiles();
|
|
21573
|
-
if (changed.length === 0)
|
|
21574
|
-
return null;
|
|
24405
|
+
if (changed.length === 0) return null;
|
|
21575
24406
|
const filesToCommit = changed.map((e) => e.filepath);
|
|
21576
24407
|
await this.store.addFiles(filesToCommit);
|
|
21577
24408
|
const diffs = [];
|
|
@@ -21613,12 +24444,10 @@ var Tracker = class {
|
|
|
21613
24444
|
isTracked(filepath) {
|
|
21614
24445
|
const allExcluded = [...this.config.tracking.exclude, ...ALWAYS_EXCLUDED];
|
|
21615
24446
|
for (const pattern of allExcluded) {
|
|
21616
|
-
if (minimatch(filepath, pattern))
|
|
21617
|
-
return false;
|
|
24447
|
+
if (minimatch(filepath, pattern)) return false;
|
|
21618
24448
|
}
|
|
21619
24449
|
for (const pattern of this.config.tracking.include) {
|
|
21620
|
-
if (minimatch(filepath, pattern))
|
|
21621
|
-
return true;
|
|
24450
|
+
if (minimatch(filepath, pattern)) return true;
|
|
21622
24451
|
}
|
|
21623
24452
|
return false;
|
|
21624
24453
|
}
|
|
@@ -21637,8 +24466,7 @@ var Tracker = class {
|
|
|
21637
24466
|
const entry = ".mindkeeper/";
|
|
21638
24467
|
try {
|
|
21639
24468
|
const content = await fsPromises3.readFile(gitignorePath, "utf-8");
|
|
21640
|
-
if (content.includes(entry))
|
|
21641
|
-
return;
|
|
24469
|
+
if (content.includes(entry)) return;
|
|
21642
24470
|
const newContent = content.endsWith("\n") ? `${content}${entry}
|
|
21643
24471
|
` : `${content}
|
|
21644
24472
|
${entry}
|
|
@@ -23341,7 +26169,7 @@ function watch(paths, options = {}) {
|
|
|
23341
26169
|
return watcher;
|
|
23342
26170
|
}
|
|
23343
26171
|
|
|
23344
|
-
// ../core/
|
|
26172
|
+
// ../core/src/watcher.ts
|
|
23345
26173
|
import fsPromises4 from "node:fs/promises";
|
|
23346
26174
|
import path5 from "node:path";
|
|
23347
26175
|
var LOCKFILE_NAME = "watcher.lock";
|
|
@@ -23364,7 +26192,9 @@ var Watcher = class {
|
|
|
23364
26192
|
async start() {
|
|
23365
26193
|
await this.acquireLock();
|
|
23366
26194
|
const config = this.tracker.getConfig();
|
|
23367
|
-
const watchPaths = config.tracking.include.map(
|
|
26195
|
+
const watchPaths = config.tracking.include.map(
|
|
26196
|
+
(pattern) => path5.join(this.tracker.workDir, pattern)
|
|
26197
|
+
);
|
|
23368
26198
|
this.watcher = watch(watchPaths, {
|
|
23369
26199
|
ignoreInitial: true,
|
|
23370
26200
|
persistent: true,
|
|
@@ -23403,8 +26233,7 @@ var Watcher = class {
|
|
|
23403
26233
|
}, this.debounceMs);
|
|
23404
26234
|
}
|
|
23405
26235
|
async flush() {
|
|
23406
|
-
if (this.pendingChanges.size === 0)
|
|
23407
|
-
return;
|
|
26236
|
+
if (this.pendingChanges.size === 0) return;
|
|
23408
26237
|
this.pendingChanges.clear();
|
|
23409
26238
|
this.debounceTimer = null;
|
|
23410
26239
|
try {
|
|
@@ -23421,7 +26250,9 @@ var Watcher = class {
|
|
|
23421
26250
|
const content = await fsPromises4.readFile(this.lockfilePath, "utf-8");
|
|
23422
26251
|
const pid = parseInt(content.trim(), 10);
|
|
23423
26252
|
if (!isNaN(pid) && isProcessRunning(pid)) {
|
|
23424
|
-
throw new Error(
|
|
26253
|
+
throw new Error(
|
|
26254
|
+
`Another watcher is already running (PID: ${pid}). Stop it first or remove ${this.lockfilePath} if the process is dead.`
|
|
26255
|
+
);
|
|
23425
26256
|
}
|
|
23426
26257
|
} catch (err) {
|
|
23427
26258
|
if (err instanceof Error && err.message.includes("Another watcher")) {
|
|
@@ -23447,228 +26278,46 @@ function isProcessRunning(pid) {
|
|
|
23447
26278
|
}
|
|
23448
26279
|
}
|
|
23449
26280
|
|
|
23450
|
-
// src/tools.ts
|
|
23451
|
-
function registerTrackerTools(api, tracker) {
|
|
23452
|
-
if (!api.registerTool) return;
|
|
23453
|
-
api.registerTool({
|
|
23454
|
-
name: "mind_history",
|
|
23455
|
-
description: "View version history of agent context files. Optionally filter by a specific file. Returns commit hashes, dates, and messages.",
|
|
23456
|
-
parameters: {
|
|
23457
|
-
type: "object",
|
|
23458
|
-
properties: {
|
|
23459
|
-
file: {
|
|
23460
|
-
type: "string",
|
|
23461
|
-
description: "File path to filter history (e.g. 'SOUL.md'). Omit for all files."
|
|
23462
|
-
},
|
|
23463
|
-
limit: {
|
|
23464
|
-
type: "number",
|
|
23465
|
-
description: "Maximum number of entries to return (default: 10)."
|
|
23466
|
-
}
|
|
23467
|
-
}
|
|
23468
|
-
},
|
|
23469
|
-
handler: async (args) => {
|
|
23470
|
-
const commits = await tracker.history({
|
|
23471
|
-
file: args.file,
|
|
23472
|
-
limit: args.limit ?? 10
|
|
23473
|
-
});
|
|
23474
|
-
return formatHistoryResult(commits);
|
|
23475
|
-
}
|
|
23476
|
-
});
|
|
23477
|
-
api.registerTool({
|
|
23478
|
-
name: "mind_diff",
|
|
23479
|
-
description: "Compare two versions of an agent context file. Shows additions, deletions, and a unified diff.",
|
|
23480
|
-
parameters: {
|
|
23481
|
-
type: "object",
|
|
23482
|
-
properties: {
|
|
23483
|
-
file: { type: "string", description: "File path to compare (e.g. 'SOUL.md')." },
|
|
23484
|
-
from: { type: "string", description: "Source commit hash." },
|
|
23485
|
-
to: { type: "string", description: "Target commit hash (defaults to HEAD)." }
|
|
23486
|
-
},
|
|
23487
|
-
required: ["file", "from"]
|
|
23488
|
-
},
|
|
23489
|
-
handler: async (args) => {
|
|
23490
|
-
const result = await tracker.diff({
|
|
23491
|
-
file: args.file,
|
|
23492
|
-
from: args.from,
|
|
23493
|
-
to: args.to
|
|
23494
|
-
});
|
|
23495
|
-
return formatDiffResult(result);
|
|
23496
|
-
}
|
|
23497
|
-
});
|
|
23498
|
-
api.registerTool({
|
|
23499
|
-
name: "mind_rollback",
|
|
23500
|
-
description: "Rollback an agent context file to a previous version. First call with preview=true to see the diff, then call again without preview to execute.",
|
|
23501
|
-
parameters: {
|
|
23502
|
-
type: "object",
|
|
23503
|
-
properties: {
|
|
23504
|
-
file: { type: "string", description: "File path to rollback (e.g. 'SOUL.md')." },
|
|
23505
|
-
to: { type: "string", description: "Commit hash to rollback to." },
|
|
23506
|
-
preview: {
|
|
23507
|
-
type: "boolean",
|
|
23508
|
-
description: "If true, show diff preview without executing rollback. Default: true."
|
|
23509
|
-
}
|
|
23510
|
-
},
|
|
23511
|
-
required: ["file", "to"]
|
|
23512
|
-
},
|
|
23513
|
-
handler: async (args) => {
|
|
23514
|
-
const file = args.file;
|
|
23515
|
-
const to = args.to;
|
|
23516
|
-
const preview = args.preview ?? true;
|
|
23517
|
-
if (preview) {
|
|
23518
|
-
const diff2 = await tracker.diff({ file, from: to, to: "HEAD" });
|
|
23519
|
-
return {
|
|
23520
|
-
preview: true,
|
|
23521
|
-
diff: formatDiffResult(diff2),
|
|
23522
|
-
instruction: "Show this diff to the user. If they confirm, call mind_rollback again with preview=false."
|
|
23523
|
-
};
|
|
23524
|
-
}
|
|
23525
|
-
const commit = await tracker.rollback({ file, to });
|
|
23526
|
-
return {
|
|
23527
|
-
preview: false,
|
|
23528
|
-
success: true,
|
|
23529
|
-
commit: { oid: commit.oid.slice(0, 8), message: commit.message },
|
|
23530
|
-
note: "Tell the user to run /new to apply the changes to the current session."
|
|
23531
|
-
};
|
|
23532
|
-
}
|
|
23533
|
-
});
|
|
23534
|
-
api.registerTool({
|
|
23535
|
-
name: "mind_snapshot",
|
|
23536
|
-
description: "Create a named checkpoint of the current state of all agent context files. Useful before making significant changes.",
|
|
23537
|
-
parameters: {
|
|
23538
|
-
type: "object",
|
|
23539
|
-
properties: {
|
|
23540
|
-
name: { type: "string", description: "Snapshot name (e.g. 'personality-v2')." },
|
|
23541
|
-
message: { type: "string", description: "Optional description of this snapshot." }
|
|
23542
|
-
},
|
|
23543
|
-
required: ["name"]
|
|
23544
|
-
},
|
|
23545
|
-
handler: async (args) => {
|
|
23546
|
-
const commit = await tracker.snapshot({
|
|
23547
|
-
name: args.name,
|
|
23548
|
-
message: args.message
|
|
23549
|
-
});
|
|
23550
|
-
return {
|
|
23551
|
-
success: true,
|
|
23552
|
-
snapshot: args.name,
|
|
23553
|
-
commit: { oid: commit.oid.slice(0, 8), message: commit.message }
|
|
23554
|
-
};
|
|
23555
|
-
}
|
|
23556
|
-
});
|
|
23557
|
-
api.registerTool({
|
|
23558
|
-
name: "mind_status",
|
|
23559
|
-
description: "Show the current tracking status: tracked files, pending changes, and named snapshots.",
|
|
23560
|
-
parameters: { type: "object", properties: {} },
|
|
23561
|
-
handler: async () => {
|
|
23562
|
-
const status = await tracker.status();
|
|
23563
|
-
return formatStatusResult(status);
|
|
23564
|
-
}
|
|
23565
|
-
});
|
|
23566
|
-
}
|
|
23567
|
-
function formatHistoryResult(commits) {
|
|
23568
|
-
return {
|
|
23569
|
-
count: commits.length,
|
|
23570
|
-
entries: commits.map((c) => ({
|
|
23571
|
-
oid: c.oid.slice(0, 8),
|
|
23572
|
-
date: c.date.toISOString().replace("T", " ").slice(0, 19),
|
|
23573
|
-
message: c.message
|
|
23574
|
-
}))
|
|
23575
|
-
};
|
|
23576
|
-
}
|
|
23577
|
-
function formatDiffResult(result) {
|
|
23578
|
-
return {
|
|
23579
|
-
file: result.file,
|
|
23580
|
-
from: result.fromVersion,
|
|
23581
|
-
to: result.toVersion,
|
|
23582
|
-
additions: result.additions,
|
|
23583
|
-
deletions: result.deletions,
|
|
23584
|
-
unified: result.unified
|
|
23585
|
-
};
|
|
23586
|
-
}
|
|
23587
|
-
function formatStatusResult(status) {
|
|
23588
|
-
return {
|
|
23589
|
-
initialized: status.initialized,
|
|
23590
|
-
workDir: status.workDir,
|
|
23591
|
-
pendingChanges: status.pendingChanges.map((e) => ({
|
|
23592
|
-
file: e.filepath,
|
|
23593
|
-
status: e.status
|
|
23594
|
-
})),
|
|
23595
|
-
snapshots: status.snapshots.map((s) => ({
|
|
23596
|
-
name: s.name,
|
|
23597
|
-
oid: s.oid.slice(0, 8)
|
|
23598
|
-
}))
|
|
23599
|
-
};
|
|
23600
|
-
}
|
|
23601
|
-
|
|
23602
|
-
// src/cli.ts
|
|
23603
|
-
function registerTrackerCli(api, tracker) {
|
|
23604
|
-
if (!api.registerCli) return;
|
|
23605
|
-
api.registerCli((program) => {
|
|
23606
|
-
const cmd = program;
|
|
23607
|
-
const mindCmd = cmd.command("mind");
|
|
23608
|
-
addSubcommand(mindCmd, "status", "Show tracking status", async () => {
|
|
23609
|
-
const status = await tracker.status();
|
|
23610
|
-
console.log(`Workspace: ${status.workDir}`);
|
|
23611
|
-
console.log(`Pending changes: ${status.pendingChanges.length}`);
|
|
23612
|
-
console.log(`Named snapshots: ${status.snapshots.length}`);
|
|
23613
|
-
});
|
|
23614
|
-
addSubcommand(mindCmd, "history [file]", "View change history", async (...args) => {
|
|
23615
|
-
const file = args[0];
|
|
23616
|
-
const commits = await tracker.history({ file, limit: 20 });
|
|
23617
|
-
if (commits.length === 0) {
|
|
23618
|
-
console.log("No history found.");
|
|
23619
|
-
return;
|
|
23620
|
-
}
|
|
23621
|
-
for (const c of commits) {
|
|
23622
|
-
const date = c.date.toISOString().replace("T", " ").slice(0, 19);
|
|
23623
|
-
console.log(`${c.oid.slice(0, 8)} ${date} ${c.message}`);
|
|
23624
|
-
}
|
|
23625
|
-
});
|
|
23626
|
-
addSubcommand(
|
|
23627
|
-
mindCmd,
|
|
23628
|
-
"snapshot [name]",
|
|
23629
|
-
"Create a named snapshot",
|
|
23630
|
-
async (...args) => {
|
|
23631
|
-
const name = args[0];
|
|
23632
|
-
const commit = await tracker.snapshot({ name });
|
|
23633
|
-
console.log(`Snapshot created: ${commit.oid.slice(0, 8)} ${commit.message}`);
|
|
23634
|
-
if (name) console.log(`Tagged as: ${name}`);
|
|
23635
|
-
}
|
|
23636
|
-
);
|
|
23637
|
-
});
|
|
23638
|
-
}
|
|
23639
|
-
function addSubcommand(parent, name, description, handler) {
|
|
23640
|
-
parent.command(name).description(description).action(handler);
|
|
23641
|
-
}
|
|
23642
|
-
|
|
23643
26281
|
// src/service.ts
|
|
23644
|
-
function createWatcherService(
|
|
26282
|
+
function createWatcherService(api, trackerRef, llmProvider) {
|
|
23645
26283
|
let watcher = null;
|
|
26284
|
+
const log = {
|
|
26285
|
+
info: (msg) => api.log?.info?.(msg),
|
|
26286
|
+
warn: (msg) => api.log?.warn?.(msg),
|
|
26287
|
+
error: (msg) => api.log?.error?.(msg)
|
|
26288
|
+
};
|
|
23646
26289
|
return {
|
|
23647
26290
|
id: "mindkeeper-watcher",
|
|
23648
|
-
async start() {
|
|
26291
|
+
async start(ctx) {
|
|
26292
|
+
const workspaceDir = ctx.workspaceDir ?? process.env.OPENCLAW_WORKSPACE;
|
|
26293
|
+
if (!workspaceDir) {
|
|
26294
|
+
log.warn("[mindkeeper] No workspace directory in service context. Watcher disabled.");
|
|
26295
|
+
return;
|
|
26296
|
+
}
|
|
26297
|
+
const tracker = new Tracker({ workDir: workspaceDir, llmProvider });
|
|
23649
26298
|
await tracker.init();
|
|
26299
|
+
trackerRef.current = tracker;
|
|
23650
26300
|
watcher = new Watcher({
|
|
23651
26301
|
tracker,
|
|
23652
26302
|
onSnapshot: (commit) => {
|
|
23653
|
-
|
|
23654
|
-
`[mindkeeper] Auto-snapshot ${commit.oid.slice(0, 8)}: ${commit.message}`
|
|
23655
|
-
);
|
|
26303
|
+
log.info(`[mindkeeper] Auto-snapshot ${commit.oid.slice(0, 8)}: ${commit.message}`);
|
|
23656
26304
|
},
|
|
23657
26305
|
onError: (err) => {
|
|
23658
|
-
|
|
26306
|
+
log.error(`[mindkeeper] Watcher error: ${err.message}`);
|
|
23659
26307
|
}
|
|
23660
26308
|
});
|
|
23661
26309
|
await watcher.start();
|
|
23662
|
-
|
|
23663
|
-
`[mindkeeper] Watching ${
|
|
26310
|
+
log.info(
|
|
26311
|
+
`[mindkeeper] Watching ${workspaceDir} (debounce: ${tracker.getConfig().snapshot.debounceMs}ms)`
|
|
23664
26312
|
);
|
|
23665
26313
|
},
|
|
23666
26314
|
async stop() {
|
|
23667
26315
|
if (watcher) {
|
|
23668
26316
|
await watcher.stop();
|
|
23669
26317
|
watcher = null;
|
|
23670
|
-
|
|
26318
|
+
log.info("[mindkeeper] Watcher stopped.");
|
|
23671
26319
|
}
|
|
26320
|
+
trackerRef.current = null;
|
|
23672
26321
|
}
|
|
23673
26322
|
};
|
|
23674
26323
|
}
|
|
@@ -23829,23 +26478,15 @@ function resolveModelFromConfig(config) {
|
|
|
23829
26478
|
|
|
23830
26479
|
// src/index.ts
|
|
23831
26480
|
async function mindkeeperPlugin(api) {
|
|
23832
|
-
const workspaceDir = api.getWorkspaceDir?.() ?? process.env.OPENCLAW_WORKSPACE;
|
|
23833
|
-
if (!workspaceDir) {
|
|
23834
|
-
api.log?.warn?.("[mindkeeper] No workspace directory found. Plugin disabled.");
|
|
23835
|
-
return;
|
|
23836
|
-
}
|
|
23837
26481
|
const llmProvider = await createOpenClawLlmProvider({
|
|
23838
26482
|
config: api.config,
|
|
23839
26483
|
pluginConfig: api.pluginConfig,
|
|
23840
26484
|
log: api.log
|
|
23841
26485
|
});
|
|
23842
|
-
const
|
|
23843
|
-
|
|
23844
|
-
|
|
23845
|
-
|
|
23846
|
-
registerTrackerTools(api, tracker);
|
|
23847
|
-
registerTrackerCli(api, tracker);
|
|
23848
|
-
const watcherService = createWatcherService(tracker, api);
|
|
26486
|
+
const trackerRef = { current: null };
|
|
26487
|
+
registerTrackerTools(api, trackerRef);
|
|
26488
|
+
registerTrackerCli(api, trackerRef);
|
|
26489
|
+
const watcherService = createWatcherService(api, trackerRef, llmProvider ?? void 0);
|
|
23849
26490
|
api.registerService?.(watcherService);
|
|
23850
26491
|
api.log?.info?.("[mindkeeper] Plugin loaded.");
|
|
23851
26492
|
}
|