@supacloud/admin 0.21.0 → 0.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -2
- package/dist/index.js +654 -2532
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
19
19
|
return cached;
|
|
20
20
|
}
|
|
21
21
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
22
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
22
|
+
const to = isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
23
23
|
if (mod && typeof mod === "object" || typeof mod === "function") {
|
|
24
24
|
for (let key of __getOwnPropNames(mod))
|
|
25
25
|
if (!__hasOwnProp.call(to, key))
|
|
@@ -167,7 +167,7 @@ var require_safer = __commonJS(function(exports, module) {
|
|
|
167
167
|
|
|
168
168
|
// node_modules/asn1/lib/ber/reader.js
|
|
169
169
|
var require_reader = __commonJS(function(exports, module) {
|
|
170
|
-
var
|
|
170
|
+
var assert = __require("assert");
|
|
171
171
|
var Buffer2 = require_safer().Buffer;
|
|
172
172
|
var ASN1 = require_types();
|
|
173
173
|
var errors = require_errors();
|
|
@@ -301,7 +301,7 @@ var require_reader = __commonJS(function(exports, module) {
|
|
|
301
301
|
return values.join(".");
|
|
302
302
|
};
|
|
303
303
|
Reader.prototype._readTag = function(tag) {
|
|
304
|
-
|
|
304
|
+
assert.ok(tag !== undefined);
|
|
305
305
|
var b = this.peek();
|
|
306
306
|
if (b === null)
|
|
307
307
|
return null;
|
|
@@ -330,7 +330,7 @@ var require_reader = __commonJS(function(exports, module) {
|
|
|
330
330
|
|
|
331
331
|
// node_modules/asn1/lib/ber/writer.js
|
|
332
332
|
var require_writer = __commonJS(function(exports, module) {
|
|
333
|
-
var
|
|
333
|
+
var assert = __require("assert");
|
|
334
334
|
var Buffer2 = require_safer().Buffer;
|
|
335
335
|
var ASN1 = require_types();
|
|
336
336
|
var errors = require_errors();
|
|
@@ -340,10 +340,10 @@ var require_writer = __commonJS(function(exports, module) {
|
|
|
340
340
|
growthFactor: 8
|
|
341
341
|
};
|
|
342
342
|
function merge(from, to) {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
343
|
+
assert.ok(from);
|
|
344
|
+
assert.equal(typeof from, "object");
|
|
345
|
+
assert.ok(to);
|
|
346
|
+
assert.equal(typeof to, "object");
|
|
347
347
|
var keys = Object.getOwnPropertyNames(from);
|
|
348
348
|
keys.forEach(function(key) {
|
|
349
349
|
if (to[key])
|
|
@@ -455,27 +455,27 @@ var require_writer = __commonJS(function(exports, module) {
|
|
|
455
455
|
tag = ASN1.OID;
|
|
456
456
|
if (!/^([0-9]+\.){3,}[0-9]+$/.test(s))
|
|
457
457
|
throw new Error("argument is not a valid OID string");
|
|
458
|
-
function encodeOctet(
|
|
458
|
+
function encodeOctet(bytes, octet) {
|
|
459
459
|
if (octet < 128) {
|
|
460
|
-
|
|
460
|
+
bytes.push(octet);
|
|
461
461
|
} else if (octet < 16384) {
|
|
462
|
-
|
|
463
|
-
|
|
462
|
+
bytes.push(octet >>> 7 | 128);
|
|
463
|
+
bytes.push(octet & 127);
|
|
464
464
|
} else if (octet < 2097152) {
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
465
|
+
bytes.push(octet >>> 14 | 128);
|
|
466
|
+
bytes.push((octet >>> 7 | 128) & 255);
|
|
467
|
+
bytes.push(octet & 127);
|
|
468
468
|
} else if (octet < 268435456) {
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
469
|
+
bytes.push(octet >>> 21 | 128);
|
|
470
|
+
bytes.push((octet >>> 14 | 128) & 255);
|
|
471
|
+
bytes.push((octet >>> 7 | 128) & 255);
|
|
472
|
+
bytes.push(octet & 127);
|
|
473
473
|
} else {
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
474
|
+
bytes.push((octet >>> 28 | 128) & 255);
|
|
475
|
+
bytes.push((octet >>> 21 | 128) & 255);
|
|
476
|
+
bytes.push((octet >>> 14 | 128) & 255);
|
|
477
|
+
bytes.push((octet >>> 7 | 128) & 255);
|
|
478
|
+
bytes.push(octet & 127);
|
|
479
479
|
}
|
|
480
480
|
}
|
|
481
481
|
var tmp = s.split(".");
|
|
@@ -548,14 +548,14 @@ var require_writer = __commonJS(function(exports, module) {
|
|
|
548
548
|
}
|
|
549
549
|
};
|
|
550
550
|
Writer.prototype._shift = function(start, len, shift) {
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
551
|
+
assert.ok(start !== undefined);
|
|
552
|
+
assert.ok(len !== undefined);
|
|
553
|
+
assert.ok(shift);
|
|
554
554
|
this._buf.copy(this._buf, start + shift, start, start + len);
|
|
555
555
|
this._offset += shift;
|
|
556
556
|
};
|
|
557
557
|
Writer.prototype._ensure = function(len) {
|
|
558
|
-
|
|
558
|
+
assert.ok(len);
|
|
559
559
|
if (this._size - this._offset < len) {
|
|
560
560
|
var sz = this._size * this._options.growthFactor;
|
|
561
561
|
if (sz - this._offset < len)
|
|
@@ -4755,10 +4755,10 @@ var require_poly1305 = __commonJS(function(exports, module) {
|
|
|
4755
4755
|
var _scriptDir = typeof document !== "undefined" && document.currentScript ? document.currentScript.src : undefined;
|
|
4756
4756
|
if (typeof __filename !== "undefined")
|
|
4757
4757
|
_scriptDir = _scriptDir || __filename;
|
|
4758
|
-
return function(
|
|
4759
|
-
|
|
4758
|
+
return function(createPoly1305) {
|
|
4759
|
+
createPoly1305 = createPoly1305 || {};
|
|
4760
4760
|
var b;
|
|
4761
|
-
b || (b = typeof
|
|
4761
|
+
b || (b = typeof createPoly1305 !== "undefined" ? createPoly1305 : {});
|
|
4762
4762
|
var q, r;
|
|
4763
4763
|
b.ready = new Promise(function(a, c) {
|
|
4764
4764
|
q = a;
|
|
@@ -4780,7 +4780,7 @@ var require_poly1305 = __commonJS(function(exports, module) {
|
|
|
4780
4780
|
}, E = function(a) {
|
|
4781
4781
|
a = C(a, true);
|
|
4782
4782
|
a.buffer || (a = new Uint8Array(a));
|
|
4783
|
-
|
|
4783
|
+
assert(a.buffer);
|
|
4784
4784
|
return a;
|
|
4785
4785
|
}, D = function(a, c, d) {
|
|
4786
4786
|
var e = H(a);
|
|
@@ -4806,7 +4806,7 @@ var require_poly1305 = __commonJS(function(exports, module) {
|
|
|
4806
4806
|
c = [];
|
|
4807
4807
|
for (var d = 0;d < a.length; d++) {
|
|
4808
4808
|
var e = a[d];
|
|
4809
|
-
255 < e && (ba &&
|
|
4809
|
+
255 < e && (ba && assert(false, "Character code " + e + " (" + String.fromCharCode(e) + ") at offset " + d + " not in 0x00-0xFF."), e &= 255);
|
|
4810
4810
|
c.push(String.fromCharCode(e));
|
|
4811
4811
|
}
|
|
4812
4812
|
return c.join("");
|
|
@@ -4850,12 +4850,12 @@ var require_poly1305 = __commonJS(function(exports, module) {
|
|
|
4850
4850
|
var noExitRuntime = b.noExitRuntime || true;
|
|
4851
4851
|
typeof WebAssembly !== "object" && K("no native wasm support detected");
|
|
4852
4852
|
var L, M = false;
|
|
4853
|
-
function
|
|
4853
|
+
function assert(a, c) {
|
|
4854
4854
|
a || K("Assertion failed: " + c);
|
|
4855
4855
|
}
|
|
4856
4856
|
function N(a) {
|
|
4857
4857
|
var c = b["_" + a];
|
|
4858
|
-
|
|
4858
|
+
assert(c, "Cannot call unknown function " + a + ", make sure it is exported");
|
|
4859
4859
|
return c;
|
|
4860
4860
|
}
|
|
4861
4861
|
function ca(a, c, d, e) {
|
|
@@ -5197,7 +5197,7 @@ var require_poly1305 = __commonJS(function(exports, module) {
|
|
|
5197
5197
|
for (typeof b.preInit == "function" && (b.preInit = [b.preInit]);0 < b.preInit.length; )
|
|
5198
5198
|
b.preInit.pop()();
|
|
5199
5199
|
Z();
|
|
5200
|
-
return
|
|
5200
|
+
return createPoly1305.ready;
|
|
5201
5201
|
};
|
|
5202
5202
|
}();
|
|
5203
5203
|
if (typeof exports === "object" && typeof module === "object")
|
|
@@ -6495,7 +6495,7 @@ ${formatted}-----END ${type} KEY-----`;
|
|
|
6495
6495
|
}
|
|
6496
6496
|
return Buffer.from(hex, "hex");
|
|
6497
6497
|
}
|
|
6498
|
-
return function
|
|
6498
|
+
return function genOpenSSLRSAPriv(n, e, d, iqmp, p, q) {
|
|
6499
6499
|
const bn_d = bigIntFromBuffer(d);
|
|
6500
6500
|
const dmp1 = bigIntToBuffer(bn_d % (bigIntFromBuffer(p) - 1n));
|
|
6501
6501
|
const dmq1 = bigIntToBuffer(bn_d % (bigIntFromBuffer(q) - 1n));
|
|
@@ -7223,8 +7223,8 @@ ${formatted}-----END ${type} KEY-----`;
|
|
|
7223
7223
|
const d = readString(privBlob, 0);
|
|
7224
7224
|
if (d === undefined)
|
|
7225
7225
|
return new Error("Malformed PPK private key");
|
|
7226
|
-
const
|
|
7227
|
-
if (
|
|
7226
|
+
const p = readString(privBlob, privBlob._pos);
|
|
7227
|
+
if (p === undefined)
|
|
7228
7228
|
return new Error("Malformed PPK private key");
|
|
7229
7229
|
const q = readString(privBlob, privBlob._pos);
|
|
7230
7230
|
if (q === undefined)
|
|
@@ -7234,12 +7234,12 @@ ${formatted}-----END ${type} KEY-----`;
|
|
|
7234
7234
|
return new Error("Malformed PPK private key");
|
|
7235
7235
|
pubPEM = genOpenSSLRSAPub(n, e);
|
|
7236
7236
|
pubSSH = genOpenSSHRSAPub(n, e);
|
|
7237
|
-
privPEM = genOpenSSLRSAPriv(n, e, d, iqmp,
|
|
7237
|
+
privPEM = genOpenSSLRSAPriv(n, e, d, iqmp, p, q);
|
|
7238
7238
|
break;
|
|
7239
7239
|
}
|
|
7240
7240
|
case "ssh-dss": {
|
|
7241
|
-
const
|
|
7242
|
-
if (
|
|
7241
|
+
const p = readString(pubBlob, pubBlob._pos);
|
|
7242
|
+
if (p === undefined)
|
|
7243
7243
|
return new Error("Malformed PPK public key");
|
|
7244
7244
|
const q = readString(pubBlob, pubBlob._pos);
|
|
7245
7245
|
if (q === undefined)
|
|
@@ -7253,9 +7253,9 @@ ${formatted}-----END ${type} KEY-----`;
|
|
|
7253
7253
|
const x = readString(privBlob, 0);
|
|
7254
7254
|
if (x === undefined)
|
|
7255
7255
|
return new Error("Malformed PPK private key");
|
|
7256
|
-
pubPEM = genOpenSSLDSAPub(
|
|
7257
|
-
pubSSH = genOpenSSHDSAPub(
|
|
7258
|
-
privPEM = genOpenSSLDSAPriv(
|
|
7256
|
+
pubPEM = genOpenSSLDSAPub(p, q, g, y);
|
|
7257
|
+
pubSSH = genOpenSSHDSAPub(p, q, g, y);
|
|
7258
|
+
privPEM = genOpenSSLDSAPriv(p, q, g, y, x);
|
|
7259
7259
|
break;
|
|
7260
7260
|
}
|
|
7261
7261
|
}
|
|
@@ -7589,15 +7589,15 @@ var require_agent = __commonJS(function(exports, module) {
|
|
|
7589
7589
|
getIdentities(cb) {
|
|
7590
7590
|
cb = once(cb);
|
|
7591
7591
|
this.getStream((err, stream) => {
|
|
7592
|
-
function onFail(
|
|
7592
|
+
function onFail(err) {
|
|
7593
7593
|
if (stream) {
|
|
7594
7594
|
try {
|
|
7595
7595
|
stream.destroy();
|
|
7596
7596
|
} catch {}
|
|
7597
7597
|
}
|
|
7598
|
-
if (!
|
|
7599
|
-
|
|
7600
|
-
cb(
|
|
7598
|
+
if (!err)
|
|
7599
|
+
err = new Error("Failed to retrieve identities from agent");
|
|
7600
|
+
cb(err);
|
|
7601
7601
|
}
|
|
7602
7602
|
if (err)
|
|
7603
7603
|
return onFail(err);
|
|
@@ -7605,9 +7605,9 @@ var require_agent = __commonJS(function(exports, module) {
|
|
|
7605
7605
|
protocol.on("error", onFail);
|
|
7606
7606
|
protocol.pipe(stream).pipe(protocol);
|
|
7607
7607
|
stream.on("close", onFail).on("end", onFail).on("error", onFail);
|
|
7608
|
-
protocol.getIdentities((
|
|
7609
|
-
if (
|
|
7610
|
-
return onFail(
|
|
7608
|
+
protocol.getIdentities((err, keys) => {
|
|
7609
|
+
if (err)
|
|
7610
|
+
return onFail(err);
|
|
7611
7611
|
try {
|
|
7612
7612
|
stream.destroy();
|
|
7613
7613
|
} catch {}
|
|
@@ -7624,15 +7624,15 @@ var require_agent = __commonJS(function(exports, module) {
|
|
|
7624
7624
|
}
|
|
7625
7625
|
cb = once(cb);
|
|
7626
7626
|
this.getStream((err, stream) => {
|
|
7627
|
-
function onFail(
|
|
7627
|
+
function onFail(err) {
|
|
7628
7628
|
if (stream) {
|
|
7629
7629
|
try {
|
|
7630
7630
|
stream.destroy();
|
|
7631
7631
|
} catch {}
|
|
7632
7632
|
}
|
|
7633
|
-
if (!
|
|
7634
|
-
|
|
7635
|
-
cb(
|
|
7633
|
+
if (!err)
|
|
7634
|
+
err = new Error("Failed to sign data with agent");
|
|
7635
|
+
cb(err);
|
|
7636
7636
|
}
|
|
7637
7637
|
if (err)
|
|
7638
7638
|
return onFail(err);
|
|
@@ -7640,9 +7640,9 @@ var require_agent = __commonJS(function(exports, module) {
|
|
|
7640
7640
|
protocol.on("error", onFail);
|
|
7641
7641
|
protocol.pipe(stream).pipe(protocol);
|
|
7642
7642
|
stream.on("close", onFail).on("end", onFail).on("error", onFail);
|
|
7643
|
-
protocol.sign(pubKey, data, options, (
|
|
7644
|
-
if (
|
|
7645
|
-
return onFail(
|
|
7643
|
+
protocol.sign(pubKey, data, options, (err, sig) => {
|
|
7644
|
+
if (err)
|
|
7645
|
+
return onFail(err);
|
|
7646
7646
|
try {
|
|
7647
7647
|
stream.destroy();
|
|
7648
7648
|
} catch {}
|
|
@@ -7702,8 +7702,8 @@ var require_agent = __commonJS(function(exports, module) {
|
|
|
7702
7702
|
this.buffer = null;
|
|
7703
7703
|
let error;
|
|
7704
7704
|
const proc = this.proc = spawn(EXEPATH, [data.length]);
|
|
7705
|
-
proc.stdout.on("data", (
|
|
7706
|
-
this.push(
|
|
7705
|
+
proc.stdout.on("data", (data) => {
|
|
7706
|
+
this.push(data);
|
|
7707
7707
|
});
|
|
7708
7708
|
proc.on("error", (err) => {
|
|
7709
7709
|
error = err;
|
|
@@ -7728,7 +7728,7 @@ var require_agent = __commonJS(function(exports, module) {
|
|
|
7728
7728
|
cb();
|
|
7729
7729
|
}
|
|
7730
7730
|
}
|
|
7731
|
-
return class
|
|
7731
|
+
return class PageantAgent extends OpenSSHAgent {
|
|
7732
7732
|
getStream(cb) {
|
|
7733
7733
|
cb(null, new PageantSocket);
|
|
7734
7734
|
}
|
|
@@ -7736,7 +7736,7 @@ var require_agent = __commonJS(function(exports, module) {
|
|
|
7736
7736
|
})();
|
|
7737
7737
|
var CygwinAgent = (() => {
|
|
7738
7738
|
const RE_CYGWIN_SOCK = /^!<socket >(\d+) s ([A-Z0-9]{8}-[A-Z0-9]{8}-[A-Z0-9]{8}-[A-Z0-9]{8})/;
|
|
7739
|
-
return class
|
|
7739
|
+
return class CygwinAgent extends OpenSSHAgent {
|
|
7740
7740
|
getStream(cb) {
|
|
7741
7741
|
cb = once(cb);
|
|
7742
7742
|
let socketPath = this.socketPath;
|
|
@@ -7745,8 +7745,8 @@ var require_agent = __commonJS(function(exports, module) {
|
|
|
7745
7745
|
if (err) {
|
|
7746
7746
|
if (triedCygpath)
|
|
7747
7747
|
return cb(new Error("Invalid cygwin unix socket path"));
|
|
7748
|
-
execFile("cygpath", ["-w", socketPath], (
|
|
7749
|
-
if (
|
|
7748
|
+
execFile("cygpath", ["-w", socketPath], (err, stdout, stderr) => {
|
|
7749
|
+
if (err || stdout.length === 0)
|
|
7750
7750
|
return cb(new Error("Invalid cygwin unix socket path"));
|
|
7751
7751
|
triedCygpath = true;
|
|
7752
7752
|
socketPath = stdout.toString().replace(/[\r\n]/g, "");
|
|
@@ -7776,8 +7776,8 @@ var require_agent = __commonJS(function(exports, module) {
|
|
|
7776
7776
|
state = "secret";
|
|
7777
7777
|
sock.write(secretBuf);
|
|
7778
7778
|
}
|
|
7779
|
-
function _ondata(
|
|
7780
|
-
bc +=
|
|
7779
|
+
function _ondata(data) {
|
|
7780
|
+
bc += data.length;
|
|
7781
7781
|
if (state === "secret") {
|
|
7782
7782
|
if (bc === 16) {
|
|
7783
7783
|
bc = 0;
|
|
@@ -7788,7 +7788,7 @@ var require_agent = __commonJS(function(exports, module) {
|
|
|
7788
7788
|
}
|
|
7789
7789
|
if (state === "creds") {
|
|
7790
7790
|
if (!isRetrying)
|
|
7791
|
-
inBuf.push(
|
|
7791
|
+
inBuf.push(data);
|
|
7792
7792
|
if (bc === 12) {
|
|
7793
7793
|
sock.removeListener("connect", _onconnect);
|
|
7794
7794
|
sock.removeListener("data", _ondata);
|
|
@@ -7906,7 +7906,7 @@ var require_agent = __commonJS(function(exports, module) {
|
|
|
7906
7906
|
const SYM_MSGLEN = Symbol("Agent Protocol Current Message Length");
|
|
7907
7907
|
const SYM_CLOSED = Symbol("Agent Protocol Closed");
|
|
7908
7908
|
const SYM_ENDED = Symbol("Agent Protocol Ended");
|
|
7909
|
-
return class
|
|
7909
|
+
return class AgentProtocol extends Duplex {
|
|
7910
7910
|
constructor(isClient) {
|
|
7911
7911
|
super({ autoDestroy: true, emitClose: false });
|
|
7912
7912
|
this[SYM_MODE] = isClient ? ROLE_CLIENT : ROLE_SERVER;
|
|
@@ -8006,20 +8006,20 @@ var require_agent = __commonJS(function(exports, module) {
|
|
|
8006
8006
|
case SSH_AGENTC_SIGN_REQUEST: {
|
|
8007
8007
|
binaryParser.init(buffer, p);
|
|
8008
8008
|
let pubKey = binaryParser.readString();
|
|
8009
|
-
const
|
|
8009
|
+
const data = binaryParser.readString();
|
|
8010
8010
|
const flagsVal = binaryParser.readUInt32BE();
|
|
8011
8011
|
p = binaryParser.pos();
|
|
8012
8012
|
binaryParser.clear();
|
|
8013
8013
|
if (flagsVal === undefined) {
|
|
8014
|
-
const
|
|
8015
|
-
this[SYM_REQS].push(
|
|
8016
|
-
return this.failureReply(
|
|
8014
|
+
const req = new AgentInboundRequest(msgType);
|
|
8015
|
+
this[SYM_REQS].push(req);
|
|
8016
|
+
return this.failureReply(req);
|
|
8017
8017
|
}
|
|
8018
8018
|
pubKey = parseKey(pubKey);
|
|
8019
8019
|
if (pubKey instanceof Error) {
|
|
8020
|
-
const
|
|
8021
|
-
this[SYM_REQS].push(
|
|
8022
|
-
return this.failureReply(
|
|
8020
|
+
const req = new AgentInboundRequest(msgType);
|
|
8021
|
+
this[SYM_REQS].push(req);
|
|
8022
|
+
return this.failureReply(req);
|
|
8023
8023
|
}
|
|
8024
8024
|
const flags = {
|
|
8025
8025
|
hash: undefined
|
|
@@ -8038,7 +8038,7 @@ var require_agent = __commonJS(function(exports, module) {
|
|
|
8038
8038
|
ctx = pubKey.type;
|
|
8039
8039
|
const req = new AgentInboundRequest(msgType, ctx);
|
|
8040
8040
|
this[SYM_REQS].push(req);
|
|
8041
|
-
this.emit("sign", req, pubKey,
|
|
8041
|
+
this.emit("sign", req, pubKey, data, flags);
|
|
8042
8042
|
break;
|
|
8043
8043
|
}
|
|
8044
8044
|
default: {
|
|
@@ -8249,8 +8249,8 @@ var require_agent = __commonJS(function(exports, module) {
|
|
|
8249
8249
|
process.nextTick(() => {
|
|
8250
8250
|
const cbs = this[SYM_AGENT_CBS];
|
|
8251
8251
|
this[SYM_AGENT_CBS] = null;
|
|
8252
|
-
for (const
|
|
8253
|
-
|
|
8252
|
+
for (const cb of cbs)
|
|
8253
|
+
cb(...args);
|
|
8254
8254
|
});
|
|
8255
8255
|
};
|
|
8256
8256
|
this[SYM_AGENT].getIdentities(once((err, keys) => {
|
|
@@ -9436,13 +9436,13 @@ var require_kex = __commonJS(function(exports, module) {
|
|
|
9436
9436
|
let localKex = local.lists.kex.array;
|
|
9437
9437
|
if (self2._compatFlags & COMPAT.BAD_DHGEX) {
|
|
9438
9438
|
let found = false;
|
|
9439
|
-
for (let
|
|
9440
|
-
if (localKex[
|
|
9439
|
+
for (let i = 0;i < localKex.length; ++i) {
|
|
9440
|
+
if (localKex[i].indexOf("group-exchange") !== -1) {
|
|
9441
9441
|
if (!found) {
|
|
9442
9442
|
found = true;
|
|
9443
9443
|
localKex = localKex.slice();
|
|
9444
9444
|
}
|
|
9445
|
-
localKex.splice(
|
|
9445
|
+
localKex.splice(i--, 1);
|
|
9446
9446
|
}
|
|
9447
9447
|
}
|
|
9448
9448
|
}
|
|
@@ -9693,30 +9693,30 @@ var require_kex = __commonJS(function(exports, module) {
|
|
|
9693
9693
|
secret.level = "handshake";
|
|
9694
9694
|
return doFatalError(this._protocol, secret, DISCONNECT_REASON.KEY_EXCHANGE_FAILED);
|
|
9695
9695
|
}
|
|
9696
|
-
const
|
|
9697
|
-
hashString(
|
|
9698
|
-
hashString(
|
|
9699
|
-
hashString(
|
|
9700
|
-
hashString(
|
|
9696
|
+
const hash = createHash(this.hashName);
|
|
9697
|
+
hashString(hash, isServer ? this._remoteIdentRaw : this._identRaw);
|
|
9698
|
+
hashString(hash, isServer ? this._identRaw : this._remoteIdentRaw);
|
|
9699
|
+
hashString(hash, isServer ? this._remoteKexinit : this._kexinit);
|
|
9700
|
+
hashString(hash, isServer ? this._kexinit : this._remoteKexinit);
|
|
9701
9701
|
const serverPublicHostKey = isServer ? this._hostKey.getPublicSSH() : this._hostKey;
|
|
9702
|
-
hashString(
|
|
9702
|
+
hashString(hash, serverPublicHostKey);
|
|
9703
9703
|
if (this.type === "groupex") {
|
|
9704
9704
|
const params = this.getDHParams();
|
|
9705
9705
|
const num = Buffer.allocUnsafe(4);
|
|
9706
9706
|
writeUInt32BE(num, this._minBits, 0);
|
|
9707
|
-
|
|
9707
|
+
hash.update(num);
|
|
9708
9708
|
writeUInt32BE(num, this._prefBits, 0);
|
|
9709
|
-
|
|
9709
|
+
hash.update(num);
|
|
9710
9710
|
writeUInt32BE(num, this._maxBits, 0);
|
|
9711
|
-
|
|
9712
|
-
hashString(
|
|
9713
|
-
hashString(
|
|
9711
|
+
hash.update(num);
|
|
9712
|
+
hashString(hash, params.prime);
|
|
9713
|
+
hashString(hash, params.generator);
|
|
9714
9714
|
}
|
|
9715
|
-
hashString(
|
|
9715
|
+
hashString(hash, isServer ? pubKey : this.getPublicKey());
|
|
9716
9716
|
const serverPublicKey = isServer ? this.getPublicKey() : pubKey;
|
|
9717
|
-
hashString(
|
|
9718
|
-
hashString(
|
|
9719
|
-
const exchangeHash =
|
|
9717
|
+
hashString(hash, serverPublicKey);
|
|
9718
|
+
hashString(hash, secret);
|
|
9719
|
+
const exchangeHash = hash.digest();
|
|
9720
9720
|
if (!isServer) {
|
|
9721
9721
|
bufferParser.init(this._sig, 0);
|
|
9722
9722
|
const sigType = bufferParser.readString(true);
|
|
@@ -10380,7 +10380,7 @@ var require_kex = __commonJS(function(exports, module) {
|
|
|
10380
10380
|
["cs", "lang"],
|
|
10381
10381
|
["sc", "lang"]
|
|
10382
10382
|
];
|
|
10383
|
-
return class
|
|
10383
|
+
return class KexInit {
|
|
10384
10384
|
constructor(obj) {
|
|
10385
10385
|
if (typeof obj !== "object" || obj === null)
|
|
10386
10386
|
throw new TypeError("Argument must be an object");
|
|
@@ -10465,10 +10465,10 @@ var require_kex = __commonJS(function(exports, module) {
|
|
|
10465
10465
|
})();
|
|
10466
10466
|
var hashString = (() => {
|
|
10467
10467
|
const LEN = Buffer.allocUnsafe(4);
|
|
10468
|
-
return (
|
|
10468
|
+
return (hash, buf) => {
|
|
10469
10469
|
writeUInt32BE(LEN, buf.length, 0);
|
|
10470
|
-
|
|
10471
|
-
|
|
10470
|
+
hash.update(LEN);
|
|
10471
|
+
hash.update(buf);
|
|
10472
10472
|
};
|
|
10473
10473
|
})();
|
|
10474
10474
|
function generateKEXVal(len, hashName, secret, exchangeHash, sessionID, char) {
|
|
@@ -11670,13 +11670,13 @@ var require_Protocol = __commonJS(function(exports, module) {
|
|
|
11670
11670
|
this._banner = undefined;
|
|
11671
11671
|
const bannerLen = Buffer.byteLength(banner);
|
|
11672
11672
|
p = this._packetRW.write.allocStart;
|
|
11673
|
-
const
|
|
11674
|
-
|
|
11675
|
-
writeUInt32BE(
|
|
11676
|
-
|
|
11677
|
-
writeUInt32BE(
|
|
11673
|
+
const packet = this._packetRW.write.alloc(1 + 4 + bannerLen + 4);
|
|
11674
|
+
packet[p] = MESSAGE.USERAUTH_BANNER;
|
|
11675
|
+
writeUInt32BE(packet, bannerLen, ++p);
|
|
11676
|
+
packet.utf8Write(banner, p += 4, bannerLen);
|
|
11677
|
+
writeUInt32BE(packet, 0, p += bannerLen);
|
|
11678
11678
|
this._debug && this._debug("Outbound: Sending USERAUTH_BANNER");
|
|
11679
|
-
sendPacket(this, this._packetRW.write.finalize(
|
|
11679
|
+
sendPacket(this, this._packetRW.write.finalize(packet));
|
|
11680
11680
|
}
|
|
11681
11681
|
}
|
|
11682
11682
|
forwardedTcpip(chan, initWindow, maxPacket, cfg) {
|
|
@@ -12082,7 +12082,7 @@ var require_Protocol = __commonJS(function(exports, module) {
|
|
|
12082
12082
|
|
|
12083
12083
|
// node_modules/ssh2/lib/protocol/node-fs-compat.js
|
|
12084
12084
|
var require_node_fs_compat = __commonJS(function(exports) {
|
|
12085
|
-
var
|
|
12085
|
+
var assert = __require("assert");
|
|
12086
12086
|
var { inspect } = __require("util");
|
|
12087
12087
|
function addNumericalSeparator(val) {
|
|
12088
12088
|
let res = "";
|
|
@@ -12093,10 +12093,10 @@ var require_node_fs_compat = __commonJS(function(exports) {
|
|
|
12093
12093
|
return `${val.slice(0, i)}${res}`;
|
|
12094
12094
|
}
|
|
12095
12095
|
function oneOf(expected, thing) {
|
|
12096
|
-
|
|
12096
|
+
assert(typeof thing === "string", "`thing` has to be of type string");
|
|
12097
12097
|
if (Array.isArray(expected)) {
|
|
12098
12098
|
const len = expected.length;
|
|
12099
|
-
|
|
12099
|
+
assert(len > 0, "At least one expected value needs to be specified");
|
|
12100
12100
|
expected = expected.map((i) => String(i));
|
|
12101
12101
|
if (len > 2) {
|
|
12102
12102
|
return `one of ${thing} ${expected.slice(0, len - 1).join(", ")}, or ` + expected[len - 1];
|
|
@@ -12128,7 +12128,7 @@ ${suffix}`;
|
|
|
12128
12128
|
constructor(str, range, input, replaceDefaultBoolean) {
|
|
12129
12129
|
super();
|
|
12130
12130
|
Error.captureStackTrace(this, ERR_OUT_OF_RANGE);
|
|
12131
|
-
|
|
12131
|
+
assert(range, 'Missing "range" argument');
|
|
12132
12132
|
let msg = replaceDefaultBoolean ? str : `The value of "${str}" is out of range.`;
|
|
12133
12133
|
let received;
|
|
12134
12134
|
if (Number.isInteger(input) && Math.abs(input) > MAX_32BIT_INT) {
|
|
@@ -12150,7 +12150,7 @@ ${suffix}`;
|
|
|
12150
12150
|
constructor(name, expected, actual) {
|
|
12151
12151
|
super();
|
|
12152
12152
|
Error.captureStackTrace(this, ERR_INVALID_ARG_TYPE);
|
|
12153
|
-
|
|
12153
|
+
assert(typeof name === "string", `'name' must be a string`);
|
|
12154
12154
|
let determiner;
|
|
12155
12155
|
if (typeof expected === "string" && expected.startsWith("not ")) {
|
|
12156
12156
|
determiner = "must not be";
|
|
@@ -12663,12 +12663,12 @@ var require_SFTP = __commonJS(function(exports, module) {
|
|
|
12663
12663
|
if (er)
|
|
12664
12664
|
return callback && callback(er);
|
|
12665
12665
|
handle = handle_;
|
|
12666
|
-
const tryStat = (
|
|
12667
|
-
if (
|
|
12666
|
+
const tryStat = (er, st) => {
|
|
12667
|
+
if (er) {
|
|
12668
12668
|
this.stat(path, (er_, st_) => {
|
|
12669
12669
|
if (er_) {
|
|
12670
12670
|
return this.close(handle, () => {
|
|
12671
|
-
callback && callback(
|
|
12671
|
+
callback && callback(er);
|
|
12672
12672
|
});
|
|
12673
12673
|
}
|
|
12674
12674
|
tryStat(null, st_);
|
|
@@ -12865,14 +12865,14 @@ var require_SFTP = __commonJS(function(exports, module) {
|
|
|
12865
12865
|
const reread = (err, handle) => {
|
|
12866
12866
|
if (err)
|
|
12867
12867
|
return cb(err);
|
|
12868
|
-
this.readdir(handle, opts, (
|
|
12869
|
-
const eof =
|
|
12870
|
-
if (
|
|
12871
|
-
return this.close(handle, () => cb(
|
|
12868
|
+
this.readdir(handle, opts, (err, list) => {
|
|
12869
|
+
const eof = err && err.code === STATUS_CODE.EOF;
|
|
12870
|
+
if (err && !eof)
|
|
12871
|
+
return this.close(handle, () => cb(err));
|
|
12872
12872
|
if (eof) {
|
|
12873
|
-
return this.close(handle, (
|
|
12874
|
-
if (
|
|
12875
|
-
return cb(
|
|
12873
|
+
return this.close(handle, (err) => {
|
|
12874
|
+
if (err)
|
|
12875
|
+
return cb(err);
|
|
12876
12876
|
cb(undefined, entries);
|
|
12877
12877
|
});
|
|
12878
12878
|
}
|
|
@@ -13721,18 +13721,18 @@ var require_SFTP = __commonJS(function(exports, module) {
|
|
|
13721
13721
|
len: undefined,
|
|
13722
13722
|
overflow: undefined,
|
|
13723
13723
|
cb: (err, data, nb) => {
|
|
13724
|
-
const
|
|
13725
|
-
const
|
|
13724
|
+
const len = req.len;
|
|
13725
|
+
const overflow = req.overflow;
|
|
13726
13726
|
if (err) {
|
|
13727
13727
|
if (cb._wantEOFError || err.code !== STATUS_CODE.EOF)
|
|
13728
13728
|
return cb(err);
|
|
13729
|
-
} else if (nb >
|
|
13729
|
+
} else if (nb > len) {
|
|
13730
13730
|
return cb(new Error("Received more data than requested"));
|
|
13731
|
-
} else if (nb ===
|
|
13731
|
+
} else if (nb === len && overflow) {
|
|
13732
13732
|
req.nb += nb;
|
|
13733
13733
|
req.position += nb;
|
|
13734
13734
|
req.off += nb;
|
|
13735
|
-
read_(self2, handle, buf, req.off,
|
|
13735
|
+
read_(self2, handle, buf, req.off, overflow, req.position, cb, req);
|
|
13736
13736
|
return;
|
|
13737
13737
|
}
|
|
13738
13738
|
nb = nb || 0;
|
|
@@ -13813,22 +13813,22 @@ var require_SFTP = __commonJS(function(exports, module) {
|
|
|
13813
13813
|
src.fstat(srcHandle, tryStat);
|
|
13814
13814
|
else
|
|
13815
13815
|
tryStat(null, { size: fileSize });
|
|
13816
|
-
function tryStat(
|
|
13817
|
-
if (
|
|
13816
|
+
function tryStat(err, attrs) {
|
|
13817
|
+
if (err) {
|
|
13818
13818
|
if (src !== fs) {
|
|
13819
13819
|
src.stat(srcPath, (err_, attrs_) => {
|
|
13820
13820
|
if (err_)
|
|
13821
|
-
return onerror(
|
|
13821
|
+
return onerror(err);
|
|
13822
13822
|
tryStat(null, attrs_);
|
|
13823
13823
|
});
|
|
13824
13824
|
return;
|
|
13825
13825
|
}
|
|
13826
|
-
return onerror(
|
|
13826
|
+
return onerror(err);
|
|
13827
13827
|
}
|
|
13828
13828
|
fsize = attrs.size;
|
|
13829
|
-
dst.open(dstPath, "w", (
|
|
13830
|
-
if (
|
|
13831
|
-
return onerror(
|
|
13829
|
+
dst.open(dstPath, "w", (err, destHandle) => {
|
|
13830
|
+
if (err)
|
|
13831
|
+
return onerror(err);
|
|
13832
13832
|
dstHandle = destHandle;
|
|
13833
13833
|
if (fsize <= 0)
|
|
13834
13834
|
return onerror();
|
|
@@ -13844,8 +13844,8 @@ var require_SFTP = __commonJS(function(exports, module) {
|
|
|
13844
13844
|
if (readbuf instanceof Error)
|
|
13845
13845
|
return onerror(readbuf);
|
|
13846
13846
|
if (mode !== undefined) {
|
|
13847
|
-
dst.fchmod(dstHandle, mode, function tryAgain(
|
|
13848
|
-
if (
|
|
13847
|
+
dst.fchmod(dstHandle, mode, function tryAgain(err) {
|
|
13848
|
+
if (err) {
|
|
13849
13849
|
dst.chmod(dstPath, mode, (err_) => tryAgain());
|
|
13850
13850
|
return;
|
|
13851
13851
|
}
|
|
@@ -13854,27 +13854,27 @@ var require_SFTP = __commonJS(function(exports, module) {
|
|
|
13854
13854
|
} else {
|
|
13855
13855
|
startReads();
|
|
13856
13856
|
}
|
|
13857
|
-
function onread(
|
|
13858
|
-
if (
|
|
13859
|
-
return onerror(
|
|
13857
|
+
function onread(err, nb, data, dstpos, datapos, origChunkLen) {
|
|
13858
|
+
if (err)
|
|
13859
|
+
return onerror(err);
|
|
13860
13860
|
datapos = datapos || 0;
|
|
13861
13861
|
dst.write(dstHandle, readbuf, datapos, nb, dstpos, writeCb);
|
|
13862
|
-
function writeCb(
|
|
13863
|
-
if (
|
|
13864
|
-
return onerror(
|
|
13862
|
+
function writeCb(err) {
|
|
13863
|
+
if (err)
|
|
13864
|
+
return onerror(err);
|
|
13865
13865
|
total += nb;
|
|
13866
13866
|
onstep && onstep(total, nb, fsize);
|
|
13867
13867
|
if (nb < origChunkLen)
|
|
13868
13868
|
return singleRead(datapos, dstpos + nb, origChunkLen - nb);
|
|
13869
13869
|
if (total === fsize) {
|
|
13870
|
-
dst.close(dstHandle, (
|
|
13870
|
+
dst.close(dstHandle, (err) => {
|
|
13871
13871
|
dstHandle = undefined;
|
|
13872
|
-
if (
|
|
13873
|
-
return onerror(
|
|
13874
|
-
src.close(srcHandle, (
|
|
13872
|
+
if (err)
|
|
13873
|
+
return onerror(err);
|
|
13874
|
+
src.close(srcHandle, (err) => {
|
|
13875
13875
|
srcHandle = undefined;
|
|
13876
|
-
if (
|
|
13877
|
-
return onerror(
|
|
13876
|
+
if (err)
|
|
13877
|
+
return onerror(err);
|
|
13878
13878
|
cb();
|
|
13879
13879
|
});
|
|
13880
13880
|
});
|
|
@@ -13887,13 +13887,13 @@ var require_SFTP = __commonJS(function(exports, module) {
|
|
|
13887
13887
|
pdst += chunk;
|
|
13888
13888
|
}
|
|
13889
13889
|
}
|
|
13890
|
-
function makeCb(psrc,
|
|
13891
|
-
return (
|
|
13892
|
-
onread(
|
|
13890
|
+
function makeCb(psrc, pdst, chunk) {
|
|
13891
|
+
return (err, nb, data) => {
|
|
13892
|
+
onread(err, nb, data, pdst, psrc, chunk);
|
|
13893
13893
|
};
|
|
13894
13894
|
}
|
|
13895
|
-
function singleRead(psrc,
|
|
13896
|
-
src.read(srcHandle, readbuf, psrc, chunk,
|
|
13895
|
+
function singleRead(psrc, pdst, chunk) {
|
|
13896
|
+
src.read(srcHandle, readbuf, psrc, chunk, pdst, makeCb(psrc, pdst, chunk));
|
|
13897
13897
|
}
|
|
13898
13898
|
function startReads() {
|
|
13899
13899
|
let reads = 0;
|
|
@@ -14977,12 +14977,12 @@ var require_SFTP = __commonJS(function(exports, module) {
|
|
|
14977
14977
|
return;
|
|
14978
14978
|
}
|
|
14979
14979
|
if (this.flags[0] === "a") {
|
|
14980
|
-
const tryStat = (
|
|
14981
|
-
if (
|
|
14980
|
+
const tryStat = (err, st) => {
|
|
14981
|
+
if (err) {
|
|
14982
14982
|
this.sftp.stat(this.path, (err_, st_) => {
|
|
14983
14983
|
if (err_) {
|
|
14984
14984
|
this.destroy();
|
|
14985
|
-
this.emit("error",
|
|
14985
|
+
this.emit("error", err);
|
|
14986
14986
|
return;
|
|
14987
14987
|
}
|
|
14988
14988
|
tryStat(null, st_);
|
|
@@ -16537,10 +16537,10 @@ var require_client = __commonJS(function(exports, module) {
|
|
|
16537
16537
|
return;
|
|
16538
16538
|
}
|
|
16539
16539
|
const todo = [];
|
|
16540
|
-
function reqCb(
|
|
16541
|
-
if (
|
|
16540
|
+
function reqCb(err) {
|
|
16541
|
+
if (err) {
|
|
16542
16542
|
chan.close();
|
|
16543
|
-
cb(
|
|
16543
|
+
cb(err);
|
|
16544
16544
|
return;
|
|
16545
16545
|
}
|
|
16546
16546
|
if (todo.length)
|
|
@@ -16584,10 +16584,10 @@ var require_client = __commonJS(function(exports, module) {
|
|
|
16584
16584
|
return;
|
|
16585
16585
|
}
|
|
16586
16586
|
const todo = [];
|
|
16587
|
-
function reqCb(
|
|
16588
|
-
if (
|
|
16587
|
+
function reqCb(err) {
|
|
16588
|
+
if (err) {
|
|
16589
16589
|
chan.close();
|
|
16590
|
-
cb(
|
|
16590
|
+
cb(err);
|
|
16591
16591
|
return;
|
|
16592
16592
|
}
|
|
16593
16593
|
if (todo.length)
|
|
@@ -16618,9 +16618,9 @@ var require_client = __commonJS(function(exports, module) {
|
|
|
16618
16618
|
cb(err);
|
|
16619
16619
|
return;
|
|
16620
16620
|
}
|
|
16621
|
-
reqSubsystem(chan, name, (
|
|
16622
|
-
if (
|
|
16623
|
-
cb(
|
|
16621
|
+
reqSubsystem(chan, name, (err, stream) => {
|
|
16622
|
+
if (err) {
|
|
16623
|
+
cb(err);
|
|
16624
16624
|
return;
|
|
16625
16625
|
}
|
|
16626
16626
|
cb(undefined, stream);
|
|
@@ -16774,9 +16774,9 @@ var require_client = __commonJS(function(exports, module) {
|
|
|
16774
16774
|
cb(err);
|
|
16775
16775
|
return;
|
|
16776
16776
|
}
|
|
16777
|
-
const reqSubsystemCb = (
|
|
16778
|
-
if (
|
|
16779
|
-
cb(
|
|
16777
|
+
const reqSubsystemCb = (err, sftp_) => {
|
|
16778
|
+
if (err) {
|
|
16779
|
+
cb(err);
|
|
16780
16780
|
return;
|
|
16781
16781
|
}
|
|
16782
16782
|
function removeListeners() {
|
|
@@ -16789,9 +16789,9 @@ var require_client = __commonJS(function(exports, module) {
|
|
|
16789
16789
|
removeListeners();
|
|
16790
16790
|
cb(undefined, sftp);
|
|
16791
16791
|
}
|
|
16792
|
-
function onError(
|
|
16792
|
+
function onError(err) {
|
|
16793
16793
|
removeListeners();
|
|
16794
|
-
cb(
|
|
16794
|
+
cb(err);
|
|
16795
16795
|
}
|
|
16796
16796
|
function onExit(code, signal) {
|
|
16797
16797
|
removeListeners();
|
|
@@ -16802,18 +16802,18 @@ var require_client = __commonJS(function(exports, module) {
|
|
|
16802
16802
|
msg = `Received signal ${signal} while establishing SFTP session`;
|
|
16803
16803
|
else
|
|
16804
16804
|
msg = "Received unexpected SFTP session termination";
|
|
16805
|
-
const
|
|
16806
|
-
|
|
16807
|
-
|
|
16808
|
-
cb(
|
|
16805
|
+
const err = new Error(msg);
|
|
16806
|
+
err.code = code;
|
|
16807
|
+
err.signal = signal;
|
|
16808
|
+
cb(err);
|
|
16809
16809
|
}
|
|
16810
16810
|
sftp.on("ready", onReady).on("error", onError).on("exit", onExit).on("close", onExit);
|
|
16811
16811
|
sftp._init();
|
|
16812
16812
|
};
|
|
16813
16813
|
if (typeof env === "object" && env !== null) {
|
|
16814
|
-
reqEnv(sftp, env, (
|
|
16815
|
-
if (
|
|
16816
|
-
cb(
|
|
16814
|
+
reqEnv(sftp, env, (err) => {
|
|
16815
|
+
if (err) {
|
|
16816
|
+
cb(err);
|
|
16817
16817
|
return;
|
|
16818
16818
|
}
|
|
16819
16819
|
reqSubsystem(sftp, "sftp", reqSubsystemCb);
|
|
@@ -18839,28 +18839,6 @@ import { fileURLToPath } from "node:url";
|
|
|
18839
18839
|
import { realpathSync } from "node:fs";
|
|
18840
18840
|
|
|
18841
18841
|
// node_modules/@sinclair/typebox/build/esm/type/guard/value.mjs
|
|
18842
|
-
var exports_value = {};
|
|
18843
|
-
__export(exports_value, {
|
|
18844
|
-
HasPropertyKey: () => HasPropertyKey,
|
|
18845
|
-
IsArray: () => IsArray,
|
|
18846
|
-
IsAsyncIterator: () => IsAsyncIterator,
|
|
18847
|
-
IsBigInt: () => IsBigInt,
|
|
18848
|
-
IsBoolean: () => IsBoolean,
|
|
18849
|
-
IsDate: () => IsDate,
|
|
18850
|
-
IsFunction: () => IsFunction,
|
|
18851
|
-
IsIterator: () => IsIterator,
|
|
18852
|
-
IsNull: () => IsNull,
|
|
18853
|
-
IsNumber: () => IsNumber,
|
|
18854
|
-
IsObject: () => IsObject,
|
|
18855
|
-
IsRegExp: () => IsRegExp,
|
|
18856
|
-
IsString: () => IsString,
|
|
18857
|
-
IsSymbol: () => IsSymbol,
|
|
18858
|
-
IsUint8Array: () => IsUint8Array,
|
|
18859
|
-
IsUndefined: () => IsUndefined
|
|
18860
|
-
});
|
|
18861
|
-
function HasPropertyKey(value, key) {
|
|
18862
|
-
return key in value;
|
|
18863
|
-
}
|
|
18864
18842
|
function IsAsyncIterator(value) {
|
|
18865
18843
|
return IsObject(value) && !IsArray(value) && !IsUint8Array(value) && Symbol.asyncIterator in value;
|
|
18866
18844
|
}
|
|
@@ -18909,7 +18887,7 @@ function IsUndefined(value) {
|
|
|
18909
18887
|
|
|
18910
18888
|
// node_modules/@sinclair/typebox/build/esm/type/clone/value.mjs
|
|
18911
18889
|
function ArrayType(value) {
|
|
18912
|
-
return value.map((
|
|
18890
|
+
return value.map((value) => Visit(value));
|
|
18913
18891
|
}
|
|
18914
18892
|
function DateType(value) {
|
|
18915
18893
|
return new Date(value.getTime());
|
|
@@ -18949,28 +18927,16 @@ function IsAsyncIterator2(value) {
|
|
|
18949
18927
|
function IsIterator2(value) {
|
|
18950
18928
|
return IsObject2(value) && globalThis.Symbol.iterator in value;
|
|
18951
18929
|
}
|
|
18952
|
-
function IsStandardObject(value) {
|
|
18953
|
-
return IsObject2(value) && (globalThis.Object.getPrototypeOf(value) === Object.prototype || globalThis.Object.getPrototypeOf(value) === null);
|
|
18954
|
-
}
|
|
18955
18930
|
function IsPromise(value) {
|
|
18956
18931
|
return value instanceof globalThis.Promise;
|
|
18957
18932
|
}
|
|
18958
18933
|
function IsDate2(value) {
|
|
18959
18934
|
return value instanceof Date && globalThis.Number.isFinite(value.getTime());
|
|
18960
18935
|
}
|
|
18961
|
-
function IsMap(value) {
|
|
18962
|
-
return value instanceof globalThis.Map;
|
|
18963
|
-
}
|
|
18964
|
-
function IsSet(value) {
|
|
18965
|
-
return value instanceof globalThis.Set;
|
|
18966
|
-
}
|
|
18967
|
-
function IsTypedArray(value) {
|
|
18968
|
-
return globalThis.ArrayBuffer.isView(value);
|
|
18969
|
-
}
|
|
18970
18936
|
function IsUint8Array2(value) {
|
|
18971
18937
|
return value instanceof globalThis.Uint8Array;
|
|
18972
18938
|
}
|
|
18973
|
-
function
|
|
18939
|
+
function HasPropertyKey(value, key) {
|
|
18974
18940
|
return key in value;
|
|
18975
18941
|
}
|
|
18976
18942
|
function IsObject2(value) {
|
|
@@ -19012,39 +18978,39 @@ function IsValueType(value) {
|
|
|
19012
18978
|
|
|
19013
18979
|
// node_modules/@sinclair/typebox/build/esm/system/policy.mjs
|
|
19014
18980
|
var TypeSystemPolicy;
|
|
19015
|
-
(function(
|
|
19016
|
-
|
|
19017
|
-
|
|
19018
|
-
|
|
19019
|
-
|
|
19020
|
-
|
|
18981
|
+
(function(TypeSystemPolicy) {
|
|
18982
|
+
TypeSystemPolicy.InstanceMode = "default";
|
|
18983
|
+
TypeSystemPolicy.ExactOptionalPropertyTypes = false;
|
|
18984
|
+
TypeSystemPolicy.AllowArrayObject = false;
|
|
18985
|
+
TypeSystemPolicy.AllowNaN = false;
|
|
18986
|
+
TypeSystemPolicy.AllowNullVoid = false;
|
|
19021
18987
|
function IsExactOptionalProperty(value, key) {
|
|
19022
|
-
return
|
|
18988
|
+
return TypeSystemPolicy.ExactOptionalPropertyTypes ? key in value : value[key] !== undefined;
|
|
19023
18989
|
}
|
|
19024
|
-
|
|
18990
|
+
TypeSystemPolicy.IsExactOptionalProperty = IsExactOptionalProperty;
|
|
19025
18991
|
function IsObjectLike(value) {
|
|
19026
18992
|
const isObject = IsObject2(value);
|
|
19027
|
-
return
|
|
18993
|
+
return TypeSystemPolicy.AllowArrayObject ? isObject : isObject && !IsArray2(value);
|
|
19028
18994
|
}
|
|
19029
|
-
|
|
18995
|
+
TypeSystemPolicy.IsObjectLike = IsObjectLike;
|
|
19030
18996
|
function IsRecordLike(value) {
|
|
19031
18997
|
return IsObjectLike(value) && !(value instanceof Date) && !(value instanceof Uint8Array);
|
|
19032
18998
|
}
|
|
19033
|
-
|
|
18999
|
+
TypeSystemPolicy.IsRecordLike = IsRecordLike;
|
|
19034
19000
|
function IsNumberLike(value) {
|
|
19035
|
-
return
|
|
19001
|
+
return TypeSystemPolicy.AllowNaN ? IsNumber2(value) : Number.isFinite(value);
|
|
19036
19002
|
}
|
|
19037
|
-
|
|
19003
|
+
TypeSystemPolicy.IsNumberLike = IsNumberLike;
|
|
19038
19004
|
function IsVoidLike(value) {
|
|
19039
19005
|
const isUndefined = IsUndefined2(value);
|
|
19040
|
-
return
|
|
19006
|
+
return TypeSystemPolicy.AllowNullVoid ? isUndefined || value === null : isUndefined;
|
|
19041
19007
|
}
|
|
19042
|
-
|
|
19008
|
+
TypeSystemPolicy.IsVoidLike = IsVoidLike;
|
|
19043
19009
|
})(TypeSystemPolicy || (TypeSystemPolicy = {}));
|
|
19044
19010
|
|
|
19045
19011
|
// node_modules/@sinclair/typebox/build/esm/type/create/immutable.mjs
|
|
19046
19012
|
function ImmutableArray(value) {
|
|
19047
|
-
return globalThis.Object.freeze(value).map((
|
|
19013
|
+
return globalThis.Object.freeze(value).map((value) => Immutable(value));
|
|
19048
19014
|
}
|
|
19049
19015
|
function ImmutableDate(value) {
|
|
19050
19016
|
return value;
|
|
@@ -19227,62 +19193,6 @@ function IsSchema(value) {
|
|
|
19227
19193
|
return IsAny(value) || IsArgument(value) || IsArray3(value) || IsBoolean3(value) || IsBigInt3(value) || IsAsyncIterator3(value) || IsComputed(value) || IsConstructor(value) || IsDate3(value) || IsFunction3(value) || IsInteger2(value) || IsIntersect(value) || IsIterator3(value) || IsLiteral(value) || IsMappedKey(value) || IsMappedResult(value) || IsNever(value) || IsNot(value) || IsNull3(value) || IsNumber3(value) || IsObject3(value) || IsPromise2(value) || IsRecord(value) || IsRef(value) || IsRegExp2(value) || IsString3(value) || IsSymbol3(value) || IsTemplateLiteral(value) || IsThis(value) || IsTuple(value) || IsUndefined3(value) || IsUnion(value) || IsUint8Array3(value) || IsUnknown(value) || IsUnsafe(value) || IsVoid(value) || IsKind(value);
|
|
19228
19194
|
}
|
|
19229
19195
|
// node_modules/@sinclair/typebox/build/esm/type/guard/type.mjs
|
|
19230
|
-
var exports_type = {};
|
|
19231
|
-
__export(exports_type, {
|
|
19232
|
-
IsAny: () => IsAny2,
|
|
19233
|
-
IsArgument: () => IsArgument2,
|
|
19234
|
-
IsArray: () => IsArray4,
|
|
19235
|
-
IsAsyncIterator: () => IsAsyncIterator4,
|
|
19236
|
-
IsBigInt: () => IsBigInt4,
|
|
19237
|
-
IsBoolean: () => IsBoolean4,
|
|
19238
|
-
IsComputed: () => IsComputed2,
|
|
19239
|
-
IsConstructor: () => IsConstructor2,
|
|
19240
|
-
IsDate: () => IsDate4,
|
|
19241
|
-
IsFunction: () => IsFunction4,
|
|
19242
|
-
IsImport: () => IsImport,
|
|
19243
|
-
IsInteger: () => IsInteger3,
|
|
19244
|
-
IsIntersect: () => IsIntersect2,
|
|
19245
|
-
IsIterator: () => IsIterator4,
|
|
19246
|
-
IsKind: () => IsKind2,
|
|
19247
|
-
IsKindOf: () => IsKindOf2,
|
|
19248
|
-
IsLiteral: () => IsLiteral2,
|
|
19249
|
-
IsLiteralBoolean: () => IsLiteralBoolean,
|
|
19250
|
-
IsLiteralNumber: () => IsLiteralNumber,
|
|
19251
|
-
IsLiteralString: () => IsLiteralString,
|
|
19252
|
-
IsLiteralValue: () => IsLiteralValue2,
|
|
19253
|
-
IsMappedKey: () => IsMappedKey2,
|
|
19254
|
-
IsMappedResult: () => IsMappedResult2,
|
|
19255
|
-
IsNever: () => IsNever2,
|
|
19256
|
-
IsNot: () => IsNot2,
|
|
19257
|
-
IsNull: () => IsNull4,
|
|
19258
|
-
IsNumber: () => IsNumber4,
|
|
19259
|
-
IsObject: () => IsObject4,
|
|
19260
|
-
IsOptional: () => IsOptional2,
|
|
19261
|
-
IsPromise: () => IsPromise3,
|
|
19262
|
-
IsProperties: () => IsProperties,
|
|
19263
|
-
IsReadonly: () => IsReadonly2,
|
|
19264
|
-
IsRecord: () => IsRecord2,
|
|
19265
|
-
IsRecursive: () => IsRecursive,
|
|
19266
|
-
IsRef: () => IsRef2,
|
|
19267
|
-
IsRegExp: () => IsRegExp3,
|
|
19268
|
-
IsSchema: () => IsSchema2,
|
|
19269
|
-
IsString: () => IsString4,
|
|
19270
|
-
IsSymbol: () => IsSymbol4,
|
|
19271
|
-
IsTemplateLiteral: () => IsTemplateLiteral2,
|
|
19272
|
-
IsThis: () => IsThis2,
|
|
19273
|
-
IsTransform: () => IsTransform2,
|
|
19274
|
-
IsTuple: () => IsTuple2,
|
|
19275
|
-
IsUint8Array: () => IsUint8Array4,
|
|
19276
|
-
IsUndefined: () => IsUndefined4,
|
|
19277
|
-
IsUnion: () => IsUnion2,
|
|
19278
|
-
IsUnionLiteral: () => IsUnionLiteral,
|
|
19279
|
-
IsUnknown: () => IsUnknown2,
|
|
19280
|
-
IsUnsafe: () => IsUnsafe2,
|
|
19281
|
-
IsVoid: () => IsVoid2,
|
|
19282
|
-
TypeGuardUnknownTypeError: () => TypeGuardUnknownTypeError
|
|
19283
|
-
});
|
|
19284
|
-
class TypeGuardUnknownTypeError extends TypeBoxError {
|
|
19285
|
-
}
|
|
19286
19196
|
var KnownTypes = [
|
|
19287
19197
|
"Argument",
|
|
19288
19198
|
"Any",
|
|
@@ -19363,9 +19273,6 @@ function IsOptionalFormat(value) {
|
|
|
19363
19273
|
function IsOptionalSchema(value) {
|
|
19364
19274
|
return IsUndefined(value) || IsSchema2(value);
|
|
19365
19275
|
}
|
|
19366
|
-
function IsReadonly2(value) {
|
|
19367
|
-
return IsObject(value) && value[ReadonlyKind] === "Readonly";
|
|
19368
|
-
}
|
|
19369
19276
|
function IsOptional2(value) {
|
|
19370
19277
|
return IsObject(value) && value[OptionalKind] === "Optional";
|
|
19371
19278
|
}
|
|
@@ -19399,9 +19306,6 @@ function IsDate4(value) {
|
|
|
19399
19306
|
function IsFunction4(value) {
|
|
19400
19307
|
return IsKindOf2(value, "Function") && value.type === "Function" && IsOptionalString(value.$id) && IsArray(value.parameters) && value.parameters.every((schema) => IsSchema2(schema)) && IsSchema2(value.returns);
|
|
19401
19308
|
}
|
|
19402
|
-
function IsImport(value) {
|
|
19403
|
-
return IsKindOf2(value, "Import") && HasPropertyKey(value, "$defs") && IsObject(value.$defs) && IsProperties(value.$defs) && HasPropertyKey(value, "$ref") && IsString(value.$ref) && value.$ref in value.$defs;
|
|
19404
|
-
}
|
|
19405
19309
|
function IsInteger3(value) {
|
|
19406
19310
|
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);
|
|
19407
19311
|
}
|
|
@@ -19462,9 +19366,6 @@ function IsRecord2(value) {
|
|
|
19462
19366
|
return keys.length === 1 && IsPattern(keys[0]) && IsObject(schema.patternProperties) && IsSchema2(schema.patternProperties[keys[0]]);
|
|
19463
19367
|
})(value);
|
|
19464
19368
|
}
|
|
19465
|
-
function IsRecursive(value) {
|
|
19466
|
-
return IsObject(value) && Hint in value && value[Hint] === "Recursive";
|
|
19467
|
-
}
|
|
19468
19369
|
function IsRef2(value) {
|
|
19469
19370
|
return IsKindOf2(value, "Ref") && IsOptionalString(value.$id) && IsString(value.$ref);
|
|
19470
19371
|
}
|
|
@@ -19492,9 +19393,6 @@ function IsTuple2(value) {
|
|
|
19492
19393
|
function IsUndefined4(value) {
|
|
19493
19394
|
return IsKindOf2(value, "Undefined") && value.type === "undefined" && IsOptionalString(value.$id);
|
|
19494
19395
|
}
|
|
19495
|
-
function IsUnionLiteral(value) {
|
|
19496
|
-
return IsUnion2(value) && value.anyOf.every((schema) => IsLiteralString(schema) || IsLiteralNumber(schema));
|
|
19497
|
-
}
|
|
19498
19396
|
function IsUnion2(value) {
|
|
19499
19397
|
return IsKindOf2(value, "Union") && IsOptionalString(value.$id) && IsObject(value) && IsArray(value.anyOf) && value.anyOf.every((schema) => IsSchema2(schema));
|
|
19500
19398
|
}
|
|
@@ -19527,60 +19425,18 @@ var PatternStringExact = `^${PatternString}$`;
|
|
|
19527
19425
|
var PatternNeverExact = `^${PatternNever}$`;
|
|
19528
19426
|
|
|
19529
19427
|
// node_modules/@sinclair/typebox/build/esm/type/registry/format.mjs
|
|
19530
|
-
var exports_format = {};
|
|
19531
|
-
__export(exports_format, {
|
|
19532
|
-
Clear: () => Clear,
|
|
19533
|
-
Delete: () => Delete,
|
|
19534
|
-
Entries: () => Entries,
|
|
19535
|
-
Get: () => Get,
|
|
19536
|
-
Has: () => Has,
|
|
19537
|
-
Set: () => Set2
|
|
19538
|
-
});
|
|
19539
19428
|
var map = new Map;
|
|
19540
|
-
function Entries() {
|
|
19541
|
-
return new Map(map);
|
|
19542
|
-
}
|
|
19543
|
-
function Clear() {
|
|
19544
|
-
return map.clear();
|
|
19545
|
-
}
|
|
19546
|
-
function Delete(format) {
|
|
19547
|
-
return map.delete(format);
|
|
19548
|
-
}
|
|
19549
19429
|
function Has(format) {
|
|
19550
19430
|
return map.has(format);
|
|
19551
19431
|
}
|
|
19552
|
-
function Set2(format, func) {
|
|
19553
|
-
map.set(format, func);
|
|
19554
|
-
}
|
|
19555
19432
|
function Get(format) {
|
|
19556
19433
|
return map.get(format);
|
|
19557
19434
|
}
|
|
19558
19435
|
// node_modules/@sinclair/typebox/build/esm/type/registry/type.mjs
|
|
19559
|
-
var exports_type2 = {};
|
|
19560
|
-
__export(exports_type2, {
|
|
19561
|
-
Clear: () => Clear2,
|
|
19562
|
-
Delete: () => Delete2,
|
|
19563
|
-
Entries: () => Entries2,
|
|
19564
|
-
Get: () => Get2,
|
|
19565
|
-
Has: () => Has2,
|
|
19566
|
-
Set: () => Set3
|
|
19567
|
-
});
|
|
19568
19436
|
var map2 = new Map;
|
|
19569
|
-
function Entries2() {
|
|
19570
|
-
return new Map(map2);
|
|
19571
|
-
}
|
|
19572
|
-
function Clear2() {
|
|
19573
|
-
return map2.clear();
|
|
19574
|
-
}
|
|
19575
|
-
function Delete2(kind) {
|
|
19576
|
-
return map2.delete(kind);
|
|
19577
|
-
}
|
|
19578
19437
|
function Has2(kind) {
|
|
19579
19438
|
return map2.has(kind);
|
|
19580
19439
|
}
|
|
19581
|
-
function Set3(kind, func) {
|
|
19582
|
-
map2.set(kind, func);
|
|
19583
|
-
}
|
|
19584
19440
|
function Get2(kind) {
|
|
19585
19441
|
return map2.get(kind);
|
|
19586
19442
|
}
|
|
@@ -19757,9 +19613,9 @@ function Or(pattern) {
|
|
|
19757
19613
|
if (IsCloseParen(pattern, index))
|
|
19758
19614
|
count -= 1;
|
|
19759
19615
|
if (IsSeparator(pattern, index) && count === 0) {
|
|
19760
|
-
const
|
|
19761
|
-
if (
|
|
19762
|
-
expressions.push(TemplateLiteralParse(
|
|
19616
|
+
const range = pattern.slice(start, index);
|
|
19617
|
+
if (range.length > 0)
|
|
19618
|
+
expressions.push(TemplateLiteralParse(range));
|
|
19763
19619
|
start = index + 1;
|
|
19764
19620
|
}
|
|
19765
19621
|
}
|
|
@@ -19787,12 +19643,12 @@ function And(pattern) {
|
|
|
19787
19643
|
}
|
|
19788
19644
|
throw new TemplateLiteralParserError(`TemplateLiteralParser: Unclosed group parens in expression`);
|
|
19789
19645
|
}
|
|
19790
|
-
function Range(
|
|
19791
|
-
for (let scan = index;scan <
|
|
19792
|
-
if (IsOpenParen(
|
|
19646
|
+
function Range(pattern, index) {
|
|
19647
|
+
for (let scan = index;scan < pattern.length; scan++) {
|
|
19648
|
+
if (IsOpenParen(pattern, scan))
|
|
19793
19649
|
return [index, scan];
|
|
19794
19650
|
}
|
|
19795
|
-
return [index,
|
|
19651
|
+
return [index, pattern.length];
|
|
19796
19652
|
}
|
|
19797
19653
|
const expressions = [];
|
|
19798
19654
|
for (let index = 0;index < pattern.length; index++) {
|
|
@@ -19945,7 +19801,7 @@ function Escape(value) {
|
|
|
19945
19801
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
19946
19802
|
}
|
|
19947
19803
|
function Visit2(schema, acc) {
|
|
19948
|
-
return IsTemplateLiteral(schema) ? schema.pattern.slice(1, schema.pattern.length - 1) : IsUnion(schema) ? `(${schema.anyOf.map((
|
|
19804
|
+
return IsTemplateLiteral(schema) ? schema.pattern.slice(1, schema.pattern.length - 1) : IsUnion(schema) ? `(${schema.anyOf.map((schema) => Visit2(schema, acc)).join("|")})` : IsNumber3(schema) ? `${acc}${PatternNumber}` : IsInteger2(schema) ? `${acc}${PatternNumber}` : IsBigInt3(schema) ? `${acc}${PatternNumber}` : IsString3(schema) ? `${acc}${PatternString}` : IsLiteral(schema) ? `${acc}${Escape(schema.const.toString())}` : IsBoolean3(schema) ? `${acc}${PatternBoolean}` : (() => {
|
|
19949
19805
|
throw new TemplateLiteralPatternError(`Unexpected Kind '${schema[Kind]}'`);
|
|
19950
19806
|
})();
|
|
19951
19807
|
}
|
|
@@ -20160,9 +20016,9 @@ function MappedFunctionReturnType(K, T) {
|
|
|
20160
20016
|
Acc[L] = FromSchemaType(L, T);
|
|
20161
20017
|
return Acc;
|
|
20162
20018
|
}
|
|
20163
|
-
function Mapped(key,
|
|
20019
|
+
function Mapped(key, map, options) {
|
|
20164
20020
|
const K = IsSchema(key) ? IndexPropertyKeys(key) : key;
|
|
20165
|
-
const RT =
|
|
20021
|
+
const RT = map({ [Kind]: "MappedKey", keys: K });
|
|
20166
20022
|
const R = MappedFunctionReturnType(K, RT);
|
|
20167
20023
|
return Object2(R, options);
|
|
20168
20024
|
}
|
|
@@ -20456,10 +20312,10 @@ function Enum(item, options) {
|
|
|
20456
20312
|
class ExtendsResolverError extends TypeBoxError {
|
|
20457
20313
|
}
|
|
20458
20314
|
var ExtendsResult;
|
|
20459
|
-
(function(
|
|
20460
|
-
|
|
20461
|
-
|
|
20462
|
-
|
|
20315
|
+
(function(ExtendsResult) {
|
|
20316
|
+
ExtendsResult[ExtendsResult["Union"] = 0] = "Union";
|
|
20317
|
+
ExtendsResult[ExtendsResult["True"] = 1] = "True";
|
|
20318
|
+
ExtendsResult[ExtendsResult["False"] = 2] = "False";
|
|
20463
20319
|
})(ExtendsResult || (ExtendsResult = {}));
|
|
20464
20320
|
function IntoBooleanResult(result) {
|
|
20465
20321
|
return result === ExtendsResult.False ? result : ExtendsResult.True;
|
|
@@ -20468,49 +20324,49 @@ function Throw(message) {
|
|
|
20468
20324
|
throw new ExtendsResolverError(message);
|
|
20469
20325
|
}
|
|
20470
20326
|
function IsStructuralRight(right) {
|
|
20471
|
-
return
|
|
20327
|
+
return IsNever2(right) || IsIntersect2(right) || IsUnion2(right) || IsUnknown2(right) || IsAny2(right);
|
|
20472
20328
|
}
|
|
20473
20329
|
function StructuralRight(left, right) {
|
|
20474
|
-
return
|
|
20330
|
+
return IsNever2(right) ? FromNeverRight(left, right) : IsIntersect2(right) ? FromIntersectRight(left, right) : IsUnion2(right) ? FromUnionRight(left, right) : IsUnknown2(right) ? FromUnknownRight(left, right) : IsAny2(right) ? FromAnyRight(left, right) : Throw("StructuralRight");
|
|
20475
20331
|
}
|
|
20476
20332
|
function FromAnyRight(left, right) {
|
|
20477
20333
|
return ExtendsResult.True;
|
|
20478
20334
|
}
|
|
20479
20335
|
function FromAny(left, right) {
|
|
20480
|
-
return
|
|
20336
|
+
return IsIntersect2(right) ? FromIntersectRight(left, right) : IsUnion2(right) && right.anyOf.some((schema) => IsAny2(schema) || IsUnknown2(schema)) ? ExtendsResult.True : IsUnion2(right) ? ExtendsResult.Union : IsUnknown2(right) ? ExtendsResult.True : IsAny2(right) ? ExtendsResult.True : ExtendsResult.Union;
|
|
20481
20337
|
}
|
|
20482
20338
|
function FromArrayRight(left, right) {
|
|
20483
|
-
return
|
|
20339
|
+
return IsUnknown2(left) ? ExtendsResult.False : IsAny2(left) ? ExtendsResult.Union : IsNever2(left) ? ExtendsResult.True : ExtendsResult.False;
|
|
20484
20340
|
}
|
|
20485
20341
|
function FromArray4(left, right) {
|
|
20486
|
-
return
|
|
20342
|
+
return IsObject4(right) && IsObjectArrayLike(right) ? ExtendsResult.True : IsStructuralRight(right) ? StructuralRight(left, right) : !IsArray4(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.items, right.items));
|
|
20487
20343
|
}
|
|
20488
20344
|
function FromAsyncIterator(left, right) {
|
|
20489
|
-
return IsStructuralRight(right) ? StructuralRight(left, right) : !
|
|
20345
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : !IsAsyncIterator4(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.items, right.items));
|
|
20490
20346
|
}
|
|
20491
20347
|
function FromBigInt(left, right) {
|
|
20492
|
-
return IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
20348
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : IsObject4(right) ? FromObjectRight(left, right) : IsRecord2(right) ? FromRecordRight(left, right) : IsBigInt4(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
20493
20349
|
}
|
|
20494
20350
|
function FromBooleanRight(left, right) {
|
|
20495
|
-
return
|
|
20351
|
+
return IsLiteralBoolean(left) ? ExtendsResult.True : IsBoolean4(left) ? ExtendsResult.True : ExtendsResult.False;
|
|
20496
20352
|
}
|
|
20497
20353
|
function FromBoolean(left, right) {
|
|
20498
|
-
return IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
20354
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : IsObject4(right) ? FromObjectRight(left, right) : IsRecord2(right) ? FromRecordRight(left, right) : IsBoolean4(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
20499
20355
|
}
|
|
20500
20356
|
function FromConstructor(left, right) {
|
|
20501
|
-
return IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
20357
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : IsObject4(right) ? FromObjectRight(left, right) : !IsConstructor2(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));
|
|
20502
20358
|
}
|
|
20503
20359
|
function FromDate(left, right) {
|
|
20504
|
-
return IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
20360
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : IsObject4(right) ? FromObjectRight(left, right) : IsRecord2(right) ? FromRecordRight(left, right) : IsDate4(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
20505
20361
|
}
|
|
20506
20362
|
function FromFunction(left, right) {
|
|
20507
|
-
return IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
20363
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : IsObject4(right) ? FromObjectRight(left, right) : !IsFunction4(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));
|
|
20508
20364
|
}
|
|
20509
20365
|
function FromIntegerRight(left, right) {
|
|
20510
|
-
return
|
|
20366
|
+
return IsLiteral2(left) && IsNumber(left.const) ? ExtendsResult.True : IsNumber4(left) || IsInteger3(left) ? ExtendsResult.True : ExtendsResult.False;
|
|
20511
20367
|
}
|
|
20512
20368
|
function FromInteger(left, right) {
|
|
20513
|
-
return
|
|
20369
|
+
return IsInteger3(right) || IsNumber4(right) ? ExtendsResult.True : IsStructuralRight(right) ? StructuralRight(left, right) : IsObject4(right) ? FromObjectRight(left, right) : IsRecord2(right) ? FromRecordRight(left, right) : ExtendsResult.False;
|
|
20514
20370
|
}
|
|
20515
20371
|
function FromIntersectRight(left, right) {
|
|
20516
20372
|
return right.allOf.every((schema) => Visit3(left, schema) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
|
|
@@ -20519,10 +20375,10 @@ function FromIntersect4(left, right) {
|
|
|
20519
20375
|
return left.allOf.some((schema) => Visit3(schema, right) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
|
|
20520
20376
|
}
|
|
20521
20377
|
function FromIterator(left, right) {
|
|
20522
|
-
return IsStructuralRight(right) ? StructuralRight(left, right) : !
|
|
20378
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : !IsIterator4(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.items, right.items));
|
|
20523
20379
|
}
|
|
20524
20380
|
function FromLiteral2(left, right) {
|
|
20525
|
-
return
|
|
20381
|
+
return IsLiteral2(right) && right.const === left.const ? ExtendsResult.True : IsStructuralRight(right) ? StructuralRight(left, right) : IsObject4(right) ? FromObjectRight(left, right) : IsRecord2(right) ? FromRecordRight(left, right) : IsString4(right) ? FromStringRight(left, right) : IsNumber4(right) ? FromNumberRight(left, right) : IsInteger3(right) ? FromIntegerRight(left, right) : IsBoolean4(right) ? FromBooleanRight(left, right) : ExtendsResult.False;
|
|
20526
20382
|
}
|
|
20527
20383
|
function FromNeverRight(left, right) {
|
|
20528
20384
|
return ExtendsResult.False;
|
|
@@ -20533,7 +20389,7 @@ function FromNever(left, right) {
|
|
|
20533
20389
|
function UnwrapTNot(schema) {
|
|
20534
20390
|
let [current, depth] = [schema, 0];
|
|
20535
20391
|
while (true) {
|
|
20536
|
-
if (!
|
|
20392
|
+
if (!IsNot2(current))
|
|
20537
20393
|
break;
|
|
20538
20394
|
current = current.not;
|
|
20539
20395
|
depth += 1;
|
|
@@ -20541,16 +20397,16 @@ function UnwrapTNot(schema) {
|
|
|
20541
20397
|
return depth % 2 === 0 ? current : Unknown();
|
|
20542
20398
|
}
|
|
20543
20399
|
function FromNot(left, right) {
|
|
20544
|
-
return
|
|
20400
|
+
return IsNot2(left) ? Visit3(UnwrapTNot(left), right) : IsNot2(right) ? Visit3(left, UnwrapTNot(right)) : Throw("Invalid fallthrough for Not");
|
|
20545
20401
|
}
|
|
20546
20402
|
function FromNull(left, right) {
|
|
20547
|
-
return IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
20403
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : IsObject4(right) ? FromObjectRight(left, right) : IsRecord2(right) ? FromRecordRight(left, right) : IsNull4(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
20548
20404
|
}
|
|
20549
20405
|
function FromNumberRight(left, right) {
|
|
20550
|
-
return
|
|
20406
|
+
return IsLiteralNumber(left) ? ExtendsResult.True : IsNumber4(left) || IsInteger3(left) ? ExtendsResult.True : ExtendsResult.False;
|
|
20551
20407
|
}
|
|
20552
20408
|
function FromNumber(left, right) {
|
|
20553
|
-
return IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
20409
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : IsObject4(right) ? FromObjectRight(left, right) : IsRecord2(right) ? FromRecordRight(left, right) : IsInteger3(right) || IsNumber4(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
20554
20410
|
}
|
|
20555
20411
|
function IsObjectPropertyCount(schema, count) {
|
|
20556
20412
|
return Object.getOwnPropertyNames(schema.properties).length === count;
|
|
@@ -20559,7 +20415,7 @@ function IsObjectStringLike(schema) {
|
|
|
20559
20415
|
return IsObjectArrayLike(schema);
|
|
20560
20416
|
}
|
|
20561
20417
|
function IsObjectSymbolLike(schema) {
|
|
20562
|
-
return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "description" in schema.properties &&
|
|
20418
|
+
return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "description" in schema.properties && IsUnion2(schema.properties.description) && schema.properties.description.anyOf.length === 2 && (IsString4(schema.properties.description.anyOf[0]) && IsUndefined4(schema.properties.description.anyOf[1]) || IsString4(schema.properties.description.anyOf[1]) && IsUndefined4(schema.properties.description.anyOf[0]));
|
|
20563
20419
|
}
|
|
20564
20420
|
function IsObjectNumberLike(schema) {
|
|
20565
20421
|
return IsObjectPropertyCount(schema, 0);
|
|
@@ -20592,22 +20448,22 @@ function IsObjectPromiseLike(schema) {
|
|
|
20592
20448
|
return IsObjectPropertyCount(schema, 0) || IsObjectPropertyCount(schema, 1) && "then" in schema.properties && IntoBooleanResult(Visit3(schema.properties["then"], then)) === ExtendsResult.True;
|
|
20593
20449
|
}
|
|
20594
20450
|
function Property(left, right) {
|
|
20595
|
-
return Visit3(left, right) === ExtendsResult.False ? ExtendsResult.False :
|
|
20451
|
+
return Visit3(left, right) === ExtendsResult.False ? ExtendsResult.False : IsOptional2(left) && !IsOptional2(right) ? ExtendsResult.False : ExtendsResult.True;
|
|
20596
20452
|
}
|
|
20597
20453
|
function FromObjectRight(left, right) {
|
|
20598
|
-
return
|
|
20454
|
+
return IsUnknown2(left) ? ExtendsResult.False : IsAny2(left) ? ExtendsResult.Union : IsNever2(left) || IsLiteralString(left) && IsObjectStringLike(right) || IsLiteralNumber(left) && IsObjectNumberLike(right) || IsLiteralBoolean(left) && IsObjectBooleanLike(right) || IsSymbol4(left) && IsObjectSymbolLike(right) || IsBigInt4(left) && IsObjectBigIntLike(right) || IsString4(left) && IsObjectStringLike(right) || IsSymbol4(left) && IsObjectSymbolLike(right) || IsNumber4(left) && IsObjectNumberLike(right) || IsInteger3(left) && IsObjectNumberLike(right) || IsBoolean4(left) && IsObjectBooleanLike(right) || IsUint8Array4(left) && IsObjectUint8ArrayLike(right) || IsDate4(left) && IsObjectDateLike(right) || IsConstructor2(left) && IsObjectConstructorLike(right) || IsFunction4(left) && IsObjectFunctionLike(right) ? ExtendsResult.True : IsRecord2(left) && IsString4(RecordKey(left)) ? (() => {
|
|
20599
20455
|
return right[Hint] === "Record" ? ExtendsResult.True : ExtendsResult.False;
|
|
20600
|
-
})() :
|
|
20456
|
+
})() : IsRecord2(left) && IsNumber4(RecordKey(left)) ? (() => {
|
|
20601
20457
|
return IsObjectPropertyCount(right, 0) ? ExtendsResult.True : ExtendsResult.False;
|
|
20602
20458
|
})() : ExtendsResult.False;
|
|
20603
20459
|
}
|
|
20604
20460
|
function FromObject(left, right) {
|
|
20605
|
-
return IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
20461
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : IsRecord2(right) ? FromRecordRight(left, right) : !IsObject4(right) ? ExtendsResult.False : (() => {
|
|
20606
20462
|
for (const key of Object.getOwnPropertyNames(right.properties)) {
|
|
20607
|
-
if (!(key in left.properties) && !
|
|
20463
|
+
if (!(key in left.properties) && !IsOptional2(right.properties[key])) {
|
|
20608
20464
|
return ExtendsResult.False;
|
|
20609
20465
|
}
|
|
20610
|
-
if (
|
|
20466
|
+
if (IsOptional2(right.properties[key])) {
|
|
20611
20467
|
return ExtendsResult.True;
|
|
20612
20468
|
}
|
|
20613
20469
|
if (Property(left.properties[key], right.properties[key]) === ExtendsResult.False) {
|
|
@@ -20618,7 +20474,7 @@ function FromObject(left, right) {
|
|
|
20618
20474
|
})();
|
|
20619
20475
|
}
|
|
20620
20476
|
function FromPromise2(left, right) {
|
|
20621
|
-
return IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
20477
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : IsObject4(right) && IsObjectPromiseLike(right) ? ExtendsResult.True : !IsPromise3(right) ? ExtendsResult.False : IntoBooleanResult(Visit3(left.item, right.item));
|
|
20622
20478
|
}
|
|
20623
20479
|
function RecordKey(schema) {
|
|
20624
20480
|
return PatternNumberExact in schema.patternProperties ? Number2() : (PatternStringExact in schema.patternProperties) ? String2() : Throw("Unknown record key pattern");
|
|
@@ -20628,7 +20484,7 @@ function RecordValue(schema) {
|
|
|
20628
20484
|
}
|
|
20629
20485
|
function FromRecordRight(left, right) {
|
|
20630
20486
|
const [Key, Value] = [RecordKey(right), RecordValue(right)];
|
|
20631
|
-
return
|
|
20487
|
+
return IsLiteralString(left) && IsNumber4(Key) && IntoBooleanResult(Visit3(left, Value)) === ExtendsResult.True ? ExtendsResult.True : IsUint8Array4(left) && IsNumber4(Key) ? Visit3(left, Value) : IsString4(left) && IsNumber4(Key) ? Visit3(left, Value) : IsArray4(left) && IsNumber4(Key) ? Visit3(left, Value) : IsObject4(left) ? (() => {
|
|
20632
20488
|
for (const key of Object.getOwnPropertyNames(left.properties)) {
|
|
20633
20489
|
if (Property(Value, left.properties[key]) === ExtendsResult.False) {
|
|
20634
20490
|
return ExtendsResult.False;
|
|
@@ -20638,39 +20494,39 @@ function FromRecordRight(left, right) {
|
|
|
20638
20494
|
})() : ExtendsResult.False;
|
|
20639
20495
|
}
|
|
20640
20496
|
function FromRecord(left, right) {
|
|
20641
|
-
return IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
20497
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : IsObject4(right) ? FromObjectRight(left, right) : !IsRecord2(right) ? ExtendsResult.False : Visit3(RecordValue(left), RecordValue(right));
|
|
20642
20498
|
}
|
|
20643
20499
|
function FromRegExp(left, right) {
|
|
20644
|
-
const L =
|
|
20645
|
-
const R =
|
|
20500
|
+
const L = IsRegExp3(left) ? String2() : left;
|
|
20501
|
+
const R = IsRegExp3(right) ? String2() : right;
|
|
20646
20502
|
return Visit3(L, R);
|
|
20647
20503
|
}
|
|
20648
20504
|
function FromStringRight(left, right) {
|
|
20649
|
-
return
|
|
20505
|
+
return IsLiteral2(left) && IsString(left.const) ? ExtendsResult.True : IsString4(left) ? ExtendsResult.True : ExtendsResult.False;
|
|
20650
20506
|
}
|
|
20651
20507
|
function FromString(left, right) {
|
|
20652
|
-
return IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
20508
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : IsObject4(right) ? FromObjectRight(left, right) : IsRecord2(right) ? FromRecordRight(left, right) : IsString4(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
20653
20509
|
}
|
|
20654
20510
|
function FromSymbol(left, right) {
|
|
20655
|
-
return IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
20511
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : IsObject4(right) ? FromObjectRight(left, right) : IsRecord2(right) ? FromRecordRight(left, right) : IsSymbol4(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
20656
20512
|
}
|
|
20657
20513
|
function FromTemplateLiteral2(left, right) {
|
|
20658
|
-
return
|
|
20514
|
+
return IsTemplateLiteral2(left) ? Visit3(TemplateLiteralToUnion(left), right) : IsTemplateLiteral2(right) ? Visit3(left, TemplateLiteralToUnion(right)) : Throw("Invalid fallthrough for TemplateLiteral");
|
|
20659
20515
|
}
|
|
20660
20516
|
function IsArrayOfTuple(left, right) {
|
|
20661
|
-
return
|
|
20517
|
+
return IsArray4(right) && left.items !== undefined && left.items.every((schema) => Visit3(schema, right.items) === ExtendsResult.True);
|
|
20662
20518
|
}
|
|
20663
20519
|
function FromTupleRight(left, right) {
|
|
20664
|
-
return
|
|
20520
|
+
return IsNever2(left) ? ExtendsResult.True : IsUnknown2(left) ? ExtendsResult.False : IsAny2(left) ? ExtendsResult.Union : ExtendsResult.False;
|
|
20665
20521
|
}
|
|
20666
20522
|
function FromTuple3(left, right) {
|
|
20667
|
-
return IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
20523
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : IsObject4(right) && IsObjectArrayLike(right) ? ExtendsResult.True : IsArray4(right) && IsArrayOfTuple(left, right) ? ExtendsResult.True : !IsTuple2(right) ? ExtendsResult.False : IsUndefined(left.items) && !IsUndefined(right.items) || !IsUndefined(left.items) && IsUndefined(right.items) ? ExtendsResult.False : IsUndefined(left.items) && !IsUndefined(right.items) ? ExtendsResult.True : left.items.every((schema, index) => Visit3(schema, right.items[index]) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
|
|
20668
20524
|
}
|
|
20669
20525
|
function FromUint8Array(left, right) {
|
|
20670
|
-
return IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
20526
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : IsObject4(right) ? FromObjectRight(left, right) : IsRecord2(right) ? FromRecordRight(left, right) : IsUint8Array4(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
20671
20527
|
}
|
|
20672
20528
|
function FromUndefined(left, right) {
|
|
20673
|
-
return IsStructuralRight(right) ? StructuralRight(left, right) :
|
|
20529
|
+
return IsStructuralRight(right) ? StructuralRight(left, right) : IsObject4(right) ? FromObjectRight(left, right) : IsRecord2(right) ? FromRecordRight(left, right) : IsVoid2(right) ? FromVoidRight(left, right) : IsUndefined4(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
20674
20530
|
}
|
|
20675
20531
|
function FromUnionRight(left, right) {
|
|
20676
20532
|
return right.anyOf.some((schema) => Visit3(left, schema) === ExtendsResult.True) ? ExtendsResult.True : ExtendsResult.False;
|
|
@@ -20682,16 +20538,16 @@ function FromUnknownRight(left, right) {
|
|
|
20682
20538
|
return ExtendsResult.True;
|
|
20683
20539
|
}
|
|
20684
20540
|
function FromUnknown(left, right) {
|
|
20685
|
-
return
|
|
20541
|
+
return IsNever2(right) ? FromNeverRight(left, right) : IsIntersect2(right) ? FromIntersectRight(left, right) : IsUnion2(right) ? FromUnionRight(left, right) : IsAny2(right) ? FromAnyRight(left, right) : IsString4(right) ? FromStringRight(left, right) : IsNumber4(right) ? FromNumberRight(left, right) : IsInteger3(right) ? FromIntegerRight(left, right) : IsBoolean4(right) ? FromBooleanRight(left, right) : IsArray4(right) ? FromArrayRight(left, right) : IsTuple2(right) ? FromTupleRight(left, right) : IsObject4(right) ? FromObjectRight(left, right) : IsUnknown2(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
20686
20542
|
}
|
|
20687
20543
|
function FromVoidRight(left, right) {
|
|
20688
|
-
return
|
|
20544
|
+
return IsUndefined4(left) ? ExtendsResult.True : IsUndefined4(left) ? ExtendsResult.True : ExtendsResult.False;
|
|
20689
20545
|
}
|
|
20690
20546
|
function FromVoid(left, right) {
|
|
20691
|
-
return
|
|
20547
|
+
return IsIntersect2(right) ? FromIntersectRight(left, right) : IsUnion2(right) ? FromUnionRight(left, right) : IsUnknown2(right) ? FromUnknownRight(left, right) : IsAny2(right) ? FromAnyRight(left, right) : IsObject4(right) ? FromObjectRight(left, right) : IsVoid2(right) ? ExtendsResult.True : ExtendsResult.False;
|
|
20692
20548
|
}
|
|
20693
20549
|
function Visit3(left, right) {
|
|
20694
|
-
return
|
|
20550
|
+
return IsTemplateLiteral2(left) || IsTemplateLiteral2(right) ? FromTemplateLiteral2(left, right) : IsRegExp3(left) || IsRegExp3(right) ? FromRegExp(left, right) : IsNot2(left) || IsNot2(right) ? FromNot(left, right) : IsAny2(left) ? FromAny(left, right) : IsArray4(left) ? FromArray4(left, right) : IsBigInt4(left) ? FromBigInt(left, right) : IsBoolean4(left) ? FromBoolean(left, right) : IsAsyncIterator4(left) ? FromAsyncIterator(left, right) : IsConstructor2(left) ? FromConstructor(left, right) : IsDate4(left) ? FromDate(left, right) : IsFunction4(left) ? FromFunction(left, right) : IsInteger3(left) ? FromInteger(left, right) : IsIntersect2(left) ? FromIntersect4(left, right) : IsIterator4(left) ? FromIterator(left, right) : IsLiteral2(left) ? FromLiteral2(left, right) : IsNever2(left) ? FromNever(left, right) : IsNull4(left) ? FromNull(left, right) : IsNumber4(left) ? FromNumber(left, right) : IsObject4(left) ? FromObject(left, right) : IsRecord2(left) ? FromRecord(left, right) : IsString4(left) ? FromString(left, right) : IsSymbol4(left) ? FromSymbol(left, right) : IsTuple2(left) ? FromTuple3(left, right) : IsPromise3(left) ? FromPromise2(left, right) : IsUint8Array4(left) ? FromUint8Array(left, right) : IsUndefined4(left) ? FromUndefined(left, right) : IsUnion2(left) ? FromUnion6(left, right) : IsUnknown2(left) ? FromUnknown(left, right) : IsVoid2(left) ? FromVoid(left, right) : Throw(`Unknown left type operand '${left[Kind]}'`);
|
|
20695
20551
|
}
|
|
20696
20552
|
function ExtendsCheck(left, right) {
|
|
20697
20553
|
return Visit3(left, right);
|
|
@@ -20742,10 +20598,10 @@ function ExtendsFromMappedKey(T, U, L, R, options) {
|
|
|
20742
20598
|
|
|
20743
20599
|
// node_modules/@sinclair/typebox/build/esm/type/extends/extends-undefined.mjs
|
|
20744
20600
|
function Intersect2(schema) {
|
|
20745
|
-
return schema.allOf.every((
|
|
20601
|
+
return schema.allOf.every((schema) => ExtendsUndefinedCheck(schema));
|
|
20746
20602
|
}
|
|
20747
20603
|
function Union2(schema) {
|
|
20748
|
-
return schema.anyOf.some((
|
|
20604
|
+
return schema.anyOf.some((schema) => ExtendsUndefinedCheck(schema));
|
|
20749
20605
|
}
|
|
20750
20606
|
function Not(schema) {
|
|
20751
20607
|
return !ExtendsUndefinedCheck(schema.not);
|
|
@@ -21076,7 +20932,7 @@ function FromObject3(type, propertyKeys, properties) {
|
|
|
21076
20932
|
return Object2(mappedProperties, options);
|
|
21077
20933
|
}
|
|
21078
20934
|
function UnionFromPropertyKeys(propertyKeys) {
|
|
21079
|
-
const result = propertyKeys.reduce((
|
|
20935
|
+
const result = propertyKeys.reduce((result, key) => IsLiteralValue(key) ? [...result, Literal(key)] : result, []);
|
|
21080
20936
|
return Union(result);
|
|
21081
20937
|
}
|
|
21082
20938
|
function OmitResolve(type, propertyKeys) {
|
|
@@ -21142,7 +20998,7 @@ function FromObject4(Type, keys, properties) {
|
|
|
21142
20998
|
return Object2(mappedProperties, options);
|
|
21143
20999
|
}
|
|
21144
21000
|
function UnionFromPropertyKeys2(propertyKeys) {
|
|
21145
|
-
const result = propertyKeys.reduce((
|
|
21001
|
+
const result = propertyKeys.reduce((result, key) => IsLiteralValue(key) ? [...result, Literal(key)] : result, []);
|
|
21146
21002
|
return Union(result);
|
|
21147
21003
|
}
|
|
21148
21004
|
function PickResolve(type, propertyKeys) {
|
|
@@ -21528,6 +21384,7 @@ __export(exports_type3, {
|
|
|
21528
21384
|
|
|
21529
21385
|
// node_modules/@sinclair/typebox/build/esm/type/type/index.mjs
|
|
21530
21386
|
var Type = exports_type3;
|
|
21387
|
+
|
|
21531
21388
|
// node_modules/@sinclair/typebox/build/esm/errors/function.mjs
|
|
21532
21389
|
function DefaultErrorFunction(error) {
|
|
21533
21390
|
switch (error.errorType) {
|
|
@@ -21676,7 +21533,7 @@ class TypeDereferenceError extends TypeBoxError {
|
|
|
21676
21533
|
}
|
|
21677
21534
|
}
|
|
21678
21535
|
function Resolve(schema, references) {
|
|
21679
|
-
const target = references.find((
|
|
21536
|
+
const target = references.find((target) => target.$id === schema.$ref);
|
|
21680
21537
|
if (target === undefined)
|
|
21681
21538
|
throw new TypeDereferenceError(schema);
|
|
21682
21539
|
return Deref(target, references);
|
|
@@ -21699,18 +21556,18 @@ class ValueHashError extends TypeBoxError {
|
|
|
21699
21556
|
}
|
|
21700
21557
|
}
|
|
21701
21558
|
var ByteMarker;
|
|
21702
|
-
(function(
|
|
21703
|
-
|
|
21704
|
-
|
|
21705
|
-
|
|
21706
|
-
|
|
21707
|
-
|
|
21708
|
-
|
|
21709
|
-
|
|
21710
|
-
|
|
21711
|
-
|
|
21712
|
-
|
|
21713
|
-
|
|
21559
|
+
(function(ByteMarker) {
|
|
21560
|
+
ByteMarker[ByteMarker["Undefined"] = 0] = "Undefined";
|
|
21561
|
+
ByteMarker[ByteMarker["Null"] = 1] = "Null";
|
|
21562
|
+
ByteMarker[ByteMarker["Boolean"] = 2] = "Boolean";
|
|
21563
|
+
ByteMarker[ByteMarker["Number"] = 3] = "Number";
|
|
21564
|
+
ByteMarker[ByteMarker["String"] = 4] = "String";
|
|
21565
|
+
ByteMarker[ByteMarker["Object"] = 5] = "Object";
|
|
21566
|
+
ByteMarker[ByteMarker["Array"] = 6] = "Array";
|
|
21567
|
+
ByteMarker[ByteMarker["Date"] = 7] = "Date";
|
|
21568
|
+
ByteMarker[ByteMarker["Uint8Array"] = 8] = "Uint8Array";
|
|
21569
|
+
ByteMarker[ByteMarker["Symbol"] = 9] = "Symbol";
|
|
21570
|
+
ByteMarker[ByteMarker["BigInt"] = 10] = "BigInt";
|
|
21714
21571
|
})(ByteMarker || (ByteMarker = {}));
|
|
21715
21572
|
var Accumulator = BigInt("14695981039346656037");
|
|
21716
21573
|
var [Prime, Size] = [BigInt("1099511628211"), BigInt("18446744073709551616")];
|
|
@@ -21868,7 +21725,7 @@ function FromArray7(schema, references, value) {
|
|
|
21868
21725
|
return true;
|
|
21869
21726
|
}
|
|
21870
21727
|
const containsSchema = IsDefined(schema.contains) ? schema.contains : Never();
|
|
21871
|
-
const containsCount = value.reduce((acc,
|
|
21728
|
+
const containsCount = value.reduce((acc, value) => Visit5(containsSchema, references, value) ? acc + 1 : acc, 0);
|
|
21872
21729
|
if (containsCount === 0) {
|
|
21873
21730
|
return false;
|
|
21874
21731
|
}
|
|
@@ -21959,7 +21816,7 @@ function FromInteger2(schema, references, value) {
|
|
|
21959
21816
|
return true;
|
|
21960
21817
|
}
|
|
21961
21818
|
function FromIntersect9(schema, references, value) {
|
|
21962
|
-
const check1 = schema.allOf.every((
|
|
21819
|
+
const check1 = schema.allOf.every((schema) => Visit5(schema, references, value));
|
|
21963
21820
|
if (schema.unevaluatedProperties === false) {
|
|
21964
21821
|
const keyPattern = new RegExp(KeyOfPattern(schema));
|
|
21965
21822
|
const check2 = Object.getOwnPropertyNames(value).every((key) => keyPattern.test(key));
|
|
@@ -22061,11 +21918,11 @@ function FromRecord4(schema, references, value) {
|
|
|
22061
21918
|
}
|
|
22062
21919
|
const [patternKey, patternSchema] = Object.entries(schema.patternProperties)[0];
|
|
22063
21920
|
const regex = new RegExp(patternKey);
|
|
22064
|
-
const check1 = Object.entries(value).every(([key,
|
|
22065
|
-
return regex.test(key) ? Visit5(patternSchema, references,
|
|
21921
|
+
const check1 = Object.entries(value).every(([key, value]) => {
|
|
21922
|
+
return regex.test(key) ? Visit5(patternSchema, references, value) : true;
|
|
22066
21923
|
});
|
|
22067
|
-
const check2 = typeof schema.additionalProperties === "object" ? Object.entries(value).every(([key,
|
|
22068
|
-
return !regex.test(key) ? Visit5(schema.additionalProperties, references,
|
|
21924
|
+
const check2 = typeof schema.additionalProperties === "object" ? Object.entries(value).every(([key, value]) => {
|
|
21925
|
+
return !regex.test(key) ? Visit5(schema.additionalProperties, references, value) : true;
|
|
22069
21926
|
}) : true;
|
|
22070
21927
|
const check3 = schema.additionalProperties === false ? Object.getOwnPropertyNames(value).every((key) => {
|
|
22071
21928
|
return regex.test(key);
|
|
@@ -22105,9 +21962,9 @@ function FromString2(schema, references, value) {
|
|
|
22105
21962
|
return false;
|
|
22106
21963
|
}
|
|
22107
21964
|
if (IsDefined(schema.format)) {
|
|
22108
|
-
if (!
|
|
21965
|
+
if (!Has(schema.format))
|
|
22109
21966
|
return false;
|
|
22110
|
-
const func =
|
|
21967
|
+
const func = Get(schema.format);
|
|
22111
21968
|
return func(value);
|
|
22112
21969
|
}
|
|
22113
21970
|
return true;
|
|
@@ -22165,9 +22022,9 @@ function FromVoid2(schema, references, value) {
|
|
|
22165
22022
|
return TypeSystemPolicy.IsVoidLike(value);
|
|
22166
22023
|
}
|
|
22167
22024
|
function FromKind(schema, references, value) {
|
|
22168
|
-
if (!
|
|
22025
|
+
if (!Has2(schema[Kind]))
|
|
22169
22026
|
return false;
|
|
22170
|
-
const func =
|
|
22027
|
+
const func = Get2(schema[Kind]);
|
|
22171
22028
|
return func(schema, value);
|
|
22172
22029
|
}
|
|
22173
22030
|
function Visit5(schema, references, value) {
|
|
@@ -22241,7 +22098,7 @@ function Visit5(schema, references, value) {
|
|
|
22241
22098
|
case "Void":
|
|
22242
22099
|
return FromVoid2(schema_, references_, value);
|
|
22243
22100
|
default:
|
|
22244
|
-
if (!
|
|
22101
|
+
if (!Has2(schema_[Kind]))
|
|
22245
22102
|
throw new ValueCheckUnknownTypeError(schema_);
|
|
22246
22103
|
return FromKind(schema_, references_, value);
|
|
22247
22104
|
}
|
|
@@ -22252,71 +22109,71 @@ function Check(...args) {
|
|
|
22252
22109
|
|
|
22253
22110
|
// node_modules/@sinclair/typebox/build/esm/errors/errors.mjs
|
|
22254
22111
|
var ValueErrorType;
|
|
22255
|
-
(function(
|
|
22256
|
-
|
|
22257
|
-
|
|
22258
|
-
|
|
22259
|
-
|
|
22260
|
-
|
|
22261
|
-
|
|
22262
|
-
|
|
22263
|
-
|
|
22264
|
-
|
|
22265
|
-
|
|
22266
|
-
|
|
22267
|
-
|
|
22268
|
-
|
|
22269
|
-
|
|
22270
|
-
|
|
22271
|
-
|
|
22272
|
-
|
|
22273
|
-
|
|
22274
|
-
|
|
22275
|
-
|
|
22276
|
-
|
|
22277
|
-
|
|
22278
|
-
|
|
22279
|
-
|
|
22280
|
-
|
|
22281
|
-
|
|
22282
|
-
|
|
22283
|
-
|
|
22284
|
-
|
|
22285
|
-
|
|
22286
|
-
|
|
22287
|
-
|
|
22288
|
-
|
|
22289
|
-
|
|
22290
|
-
|
|
22291
|
-
|
|
22292
|
-
|
|
22293
|
-
|
|
22294
|
-
|
|
22295
|
-
|
|
22296
|
-
|
|
22297
|
-
|
|
22298
|
-
|
|
22299
|
-
|
|
22300
|
-
|
|
22301
|
-
|
|
22302
|
-
|
|
22303
|
-
|
|
22304
|
-
|
|
22305
|
-
|
|
22306
|
-
|
|
22307
|
-
|
|
22308
|
-
|
|
22309
|
-
|
|
22310
|
-
|
|
22311
|
-
|
|
22312
|
-
|
|
22313
|
-
|
|
22314
|
-
|
|
22315
|
-
|
|
22316
|
-
|
|
22317
|
-
|
|
22318
|
-
|
|
22319
|
-
|
|
22112
|
+
(function(ValueErrorType) {
|
|
22113
|
+
ValueErrorType[ValueErrorType["ArrayContains"] = 0] = "ArrayContains";
|
|
22114
|
+
ValueErrorType[ValueErrorType["ArrayMaxContains"] = 1] = "ArrayMaxContains";
|
|
22115
|
+
ValueErrorType[ValueErrorType["ArrayMaxItems"] = 2] = "ArrayMaxItems";
|
|
22116
|
+
ValueErrorType[ValueErrorType["ArrayMinContains"] = 3] = "ArrayMinContains";
|
|
22117
|
+
ValueErrorType[ValueErrorType["ArrayMinItems"] = 4] = "ArrayMinItems";
|
|
22118
|
+
ValueErrorType[ValueErrorType["ArrayUniqueItems"] = 5] = "ArrayUniqueItems";
|
|
22119
|
+
ValueErrorType[ValueErrorType["Array"] = 6] = "Array";
|
|
22120
|
+
ValueErrorType[ValueErrorType["AsyncIterator"] = 7] = "AsyncIterator";
|
|
22121
|
+
ValueErrorType[ValueErrorType["BigIntExclusiveMaximum"] = 8] = "BigIntExclusiveMaximum";
|
|
22122
|
+
ValueErrorType[ValueErrorType["BigIntExclusiveMinimum"] = 9] = "BigIntExclusiveMinimum";
|
|
22123
|
+
ValueErrorType[ValueErrorType["BigIntMaximum"] = 10] = "BigIntMaximum";
|
|
22124
|
+
ValueErrorType[ValueErrorType["BigIntMinimum"] = 11] = "BigIntMinimum";
|
|
22125
|
+
ValueErrorType[ValueErrorType["BigIntMultipleOf"] = 12] = "BigIntMultipleOf";
|
|
22126
|
+
ValueErrorType[ValueErrorType["BigInt"] = 13] = "BigInt";
|
|
22127
|
+
ValueErrorType[ValueErrorType["Boolean"] = 14] = "Boolean";
|
|
22128
|
+
ValueErrorType[ValueErrorType["DateExclusiveMaximumTimestamp"] = 15] = "DateExclusiveMaximumTimestamp";
|
|
22129
|
+
ValueErrorType[ValueErrorType["DateExclusiveMinimumTimestamp"] = 16] = "DateExclusiveMinimumTimestamp";
|
|
22130
|
+
ValueErrorType[ValueErrorType["DateMaximumTimestamp"] = 17] = "DateMaximumTimestamp";
|
|
22131
|
+
ValueErrorType[ValueErrorType["DateMinimumTimestamp"] = 18] = "DateMinimumTimestamp";
|
|
22132
|
+
ValueErrorType[ValueErrorType["DateMultipleOfTimestamp"] = 19] = "DateMultipleOfTimestamp";
|
|
22133
|
+
ValueErrorType[ValueErrorType["Date"] = 20] = "Date";
|
|
22134
|
+
ValueErrorType[ValueErrorType["Function"] = 21] = "Function";
|
|
22135
|
+
ValueErrorType[ValueErrorType["IntegerExclusiveMaximum"] = 22] = "IntegerExclusiveMaximum";
|
|
22136
|
+
ValueErrorType[ValueErrorType["IntegerExclusiveMinimum"] = 23] = "IntegerExclusiveMinimum";
|
|
22137
|
+
ValueErrorType[ValueErrorType["IntegerMaximum"] = 24] = "IntegerMaximum";
|
|
22138
|
+
ValueErrorType[ValueErrorType["IntegerMinimum"] = 25] = "IntegerMinimum";
|
|
22139
|
+
ValueErrorType[ValueErrorType["IntegerMultipleOf"] = 26] = "IntegerMultipleOf";
|
|
22140
|
+
ValueErrorType[ValueErrorType["Integer"] = 27] = "Integer";
|
|
22141
|
+
ValueErrorType[ValueErrorType["IntersectUnevaluatedProperties"] = 28] = "IntersectUnevaluatedProperties";
|
|
22142
|
+
ValueErrorType[ValueErrorType["Intersect"] = 29] = "Intersect";
|
|
22143
|
+
ValueErrorType[ValueErrorType["Iterator"] = 30] = "Iterator";
|
|
22144
|
+
ValueErrorType[ValueErrorType["Kind"] = 31] = "Kind";
|
|
22145
|
+
ValueErrorType[ValueErrorType["Literal"] = 32] = "Literal";
|
|
22146
|
+
ValueErrorType[ValueErrorType["Never"] = 33] = "Never";
|
|
22147
|
+
ValueErrorType[ValueErrorType["Not"] = 34] = "Not";
|
|
22148
|
+
ValueErrorType[ValueErrorType["Null"] = 35] = "Null";
|
|
22149
|
+
ValueErrorType[ValueErrorType["NumberExclusiveMaximum"] = 36] = "NumberExclusiveMaximum";
|
|
22150
|
+
ValueErrorType[ValueErrorType["NumberExclusiveMinimum"] = 37] = "NumberExclusiveMinimum";
|
|
22151
|
+
ValueErrorType[ValueErrorType["NumberMaximum"] = 38] = "NumberMaximum";
|
|
22152
|
+
ValueErrorType[ValueErrorType["NumberMinimum"] = 39] = "NumberMinimum";
|
|
22153
|
+
ValueErrorType[ValueErrorType["NumberMultipleOf"] = 40] = "NumberMultipleOf";
|
|
22154
|
+
ValueErrorType[ValueErrorType["Number"] = 41] = "Number";
|
|
22155
|
+
ValueErrorType[ValueErrorType["ObjectAdditionalProperties"] = 42] = "ObjectAdditionalProperties";
|
|
22156
|
+
ValueErrorType[ValueErrorType["ObjectMaxProperties"] = 43] = "ObjectMaxProperties";
|
|
22157
|
+
ValueErrorType[ValueErrorType["ObjectMinProperties"] = 44] = "ObjectMinProperties";
|
|
22158
|
+
ValueErrorType[ValueErrorType["ObjectRequiredProperty"] = 45] = "ObjectRequiredProperty";
|
|
22159
|
+
ValueErrorType[ValueErrorType["Object"] = 46] = "Object";
|
|
22160
|
+
ValueErrorType[ValueErrorType["Promise"] = 47] = "Promise";
|
|
22161
|
+
ValueErrorType[ValueErrorType["RegExp"] = 48] = "RegExp";
|
|
22162
|
+
ValueErrorType[ValueErrorType["StringFormatUnknown"] = 49] = "StringFormatUnknown";
|
|
22163
|
+
ValueErrorType[ValueErrorType["StringFormat"] = 50] = "StringFormat";
|
|
22164
|
+
ValueErrorType[ValueErrorType["StringMaxLength"] = 51] = "StringMaxLength";
|
|
22165
|
+
ValueErrorType[ValueErrorType["StringMinLength"] = 52] = "StringMinLength";
|
|
22166
|
+
ValueErrorType[ValueErrorType["StringPattern"] = 53] = "StringPattern";
|
|
22167
|
+
ValueErrorType[ValueErrorType["String"] = 54] = "String";
|
|
22168
|
+
ValueErrorType[ValueErrorType["Symbol"] = 55] = "Symbol";
|
|
22169
|
+
ValueErrorType[ValueErrorType["TupleLength"] = 56] = "TupleLength";
|
|
22170
|
+
ValueErrorType[ValueErrorType["Tuple"] = 57] = "Tuple";
|
|
22171
|
+
ValueErrorType[ValueErrorType["Uint8ArrayMaxByteLength"] = 58] = "Uint8ArrayMaxByteLength";
|
|
22172
|
+
ValueErrorType[ValueErrorType["Uint8ArrayMinByteLength"] = 59] = "Uint8ArrayMinByteLength";
|
|
22173
|
+
ValueErrorType[ValueErrorType["Uint8Array"] = 60] = "Uint8Array";
|
|
22174
|
+
ValueErrorType[ValueErrorType["Undefined"] = 61] = "Undefined";
|
|
22175
|
+
ValueErrorType[ValueErrorType["Union"] = 62] = "Union";
|
|
22176
|
+
ValueErrorType[ValueErrorType["Void"] = 63] = "Void";
|
|
22320
22177
|
})(ValueErrorType || (ValueErrorType = {}));
|
|
22321
22178
|
|
|
22322
22179
|
class ValueErrorsUnknownTypeError extends TypeBoxError {
|
|
@@ -22387,7 +22244,7 @@ function* FromArray8(schema, references, path, value) {
|
|
|
22387
22244
|
return;
|
|
22388
22245
|
}
|
|
22389
22246
|
const containsSchema = IsDefined2(schema.contains) ? schema.contains : Never();
|
|
22390
|
-
const containsCount = value.reduce((acc,
|
|
22247
|
+
const containsCount = value.reduce((acc, value, index) => Visit6(containsSchema, references, `${path}${index}`, value).next().done === true ? acc + 1 : acc, 0);
|
|
22391
22248
|
if (containsCount === 0) {
|
|
22392
22249
|
yield Create(ValueErrorType.ArrayContains, schema, path, value);
|
|
22393
22250
|
}
|
|
@@ -22654,10 +22511,10 @@ function* FromString3(schema, references, path, value) {
|
|
|
22654
22511
|
}
|
|
22655
22512
|
}
|
|
22656
22513
|
if (IsString2(schema.format)) {
|
|
22657
|
-
if (!
|
|
22514
|
+
if (!Has(schema.format)) {
|
|
22658
22515
|
yield Create(ValueErrorType.StringFormatUnknown, schema, path, value);
|
|
22659
22516
|
} else {
|
|
22660
|
-
const format =
|
|
22517
|
+
const format = Get(schema.format);
|
|
22661
22518
|
if (!format(value)) {
|
|
22662
22519
|
yield Create(ValueErrorType.StringFormat, schema, path, value);
|
|
22663
22520
|
}
|
|
@@ -22721,7 +22578,7 @@ function* FromVoid3(schema, references, path, value) {
|
|
|
22721
22578
|
yield Create(ValueErrorType.Void, schema, path, value);
|
|
22722
22579
|
}
|
|
22723
22580
|
function* FromKind2(schema, references, path, value) {
|
|
22724
|
-
const check =
|
|
22581
|
+
const check = Get2(schema[Kind]);
|
|
22725
22582
|
if (!check(schema, value))
|
|
22726
22583
|
yield Create(ValueErrorType.Kind, schema, path, value);
|
|
22727
22584
|
}
|
|
@@ -22796,7 +22653,7 @@ function* Visit6(schema, references, path, value) {
|
|
|
22796
22653
|
case "Void":
|
|
22797
22654
|
return yield* FromVoid3(schema_, references_, path, value);
|
|
22798
22655
|
default:
|
|
22799
|
-
if (!
|
|
22656
|
+
if (!Has2(schema_[Kind]))
|
|
22800
22657
|
throw new ValueErrorsUnknownTypeError(schema);
|
|
22801
22658
|
return yield* FromKind2(schema_, references_, path, value);
|
|
22802
22659
|
}
|
|
@@ -22805,1406 +22662,221 @@ function Errors(...args) {
|
|
|
22805
22662
|
const iterator = args.length === 3 ? Visit6(args[0], args[1], "", args[2]) : Visit6(args[0], [], "", args[1]);
|
|
22806
22663
|
return new ValueErrorIterator(iterator);
|
|
22807
22664
|
}
|
|
22808
|
-
|
|
22809
|
-
|
|
22810
|
-
|
|
22811
|
-
|
|
22812
|
-
|
|
22813
|
-
|
|
22814
|
-
throw new TypeError("Private accessor was defined without a setter");
|
|
22815
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
22816
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
22817
|
-
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
|
22818
|
-
};
|
|
22819
|
-
var __classPrivateFieldGet = function(receiver, state, kind, f) {
|
|
22820
|
-
if (kind === "a" && !f)
|
|
22821
|
-
throw new TypeError("Private accessor was defined without a getter");
|
|
22822
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
22823
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
22824
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
22825
|
-
};
|
|
22826
|
-
var _AssertError_instances;
|
|
22827
|
-
var _AssertError_iterator;
|
|
22828
|
-
var _AssertError_Iterator;
|
|
22829
|
-
|
|
22830
|
-
class AssertError extends TypeBoxError {
|
|
22831
|
-
constructor(iterator) {
|
|
22832
|
-
const error = iterator.First();
|
|
22833
|
-
super(error === undefined ? "Invalid Value" : error.message);
|
|
22834
|
-
_AssertError_instances.add(this);
|
|
22835
|
-
_AssertError_iterator.set(this, undefined);
|
|
22836
|
-
__classPrivateFieldSet(this, _AssertError_iterator, iterator, "f");
|
|
22665
|
+
// node_modules/@sinclair/typebox/build/esm/value/transform/decode.mjs
|
|
22666
|
+
class TransformDecodeCheckError extends TypeBoxError {
|
|
22667
|
+
constructor(schema, value, error) {
|
|
22668
|
+
super(`Unable to decode value as it does not match the expected schema`);
|
|
22669
|
+
this.schema = schema;
|
|
22670
|
+
this.value = value;
|
|
22837
22671
|
this.error = error;
|
|
22838
22672
|
}
|
|
22839
|
-
|
|
22840
|
-
|
|
22673
|
+
}
|
|
22674
|
+
|
|
22675
|
+
class TransformDecodeError extends TypeBoxError {
|
|
22676
|
+
constructor(schema, path, value, error) {
|
|
22677
|
+
super(error instanceof Error ? error.message : "Unknown error");
|
|
22678
|
+
this.schema = schema;
|
|
22679
|
+
this.path = path;
|
|
22680
|
+
this.value = value;
|
|
22681
|
+
this.error = error;
|
|
22841
22682
|
}
|
|
22842
22683
|
}
|
|
22843
|
-
|
|
22844
|
-
|
|
22845
|
-
|
|
22846
|
-
|
|
22847
|
-
|
|
22848
|
-
|
|
22849
|
-
if (Check(schema, references, value))
|
|
22850
|
-
return;
|
|
22851
|
-
throw new AssertError(Errors(schema, references, value));
|
|
22684
|
+
function Default(schema, path, value) {
|
|
22685
|
+
try {
|
|
22686
|
+
return IsTransform(schema) ? schema[TransformKind].Decode(value) : value;
|
|
22687
|
+
} catch (error) {
|
|
22688
|
+
throw new TransformDecodeError(schema, path, value, error);
|
|
22689
|
+
}
|
|
22852
22690
|
}
|
|
22853
|
-
function
|
|
22854
|
-
return
|
|
22691
|
+
function FromArray9(schema, references, path, value) {
|
|
22692
|
+
return IsArray2(value) ? Default(schema, path, value.map((value, index) => Visit7(schema.items, references, `${path}/${index}`, value))) : Default(schema, path, value);
|
|
22855
22693
|
}
|
|
22856
|
-
|
|
22857
|
-
|
|
22858
|
-
|
|
22859
|
-
|
|
22860
|
-
|
|
22861
|
-
}
|
|
22862
|
-
for (const
|
|
22863
|
-
|
|
22694
|
+
function FromIntersect11(schema, references, path, value) {
|
|
22695
|
+
if (!IsObject2(value) || IsValueType(value))
|
|
22696
|
+
return Default(schema, path, value);
|
|
22697
|
+
const knownEntries = KeyOfPropertyEntries(schema);
|
|
22698
|
+
const knownKeys = knownEntries.map((entry) => entry[0]);
|
|
22699
|
+
const knownProperties = { ...value };
|
|
22700
|
+
for (const [knownKey, knownSchema] of knownEntries)
|
|
22701
|
+
if (knownKey in knownProperties) {
|
|
22702
|
+
knownProperties[knownKey] = Visit7(knownSchema, references, `${path}/${knownKey}`, knownProperties[knownKey]);
|
|
22703
|
+
}
|
|
22704
|
+
if (!IsTransform(schema.unevaluatedProperties)) {
|
|
22705
|
+
return Default(schema, path, knownProperties);
|
|
22864
22706
|
}
|
|
22865
|
-
|
|
22707
|
+
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
22708
|
+
const unevaluatedProperties = schema.unevaluatedProperties;
|
|
22709
|
+
const unknownProperties = { ...knownProperties };
|
|
22710
|
+
for (const key of unknownKeys)
|
|
22711
|
+
if (!knownKeys.includes(key)) {
|
|
22712
|
+
unknownProperties[key] = Default(unevaluatedProperties, `${path}/${key}`, unknownProperties[key]);
|
|
22713
|
+
}
|
|
22714
|
+
return Default(schema, path, unknownProperties);
|
|
22866
22715
|
}
|
|
22867
|
-
function
|
|
22868
|
-
|
|
22716
|
+
function FromImport3(schema, references, path, value) {
|
|
22717
|
+
const additional = globalThis.Object.values(schema.$defs);
|
|
22718
|
+
const target = schema.$defs[schema.$ref];
|
|
22719
|
+
const result = Visit7(target, [...references, ...additional], path, value);
|
|
22720
|
+
return Default(schema, path, result);
|
|
22869
22721
|
}
|
|
22870
|
-
function
|
|
22871
|
-
return value
|
|
22722
|
+
function FromNot4(schema, references, path, value) {
|
|
22723
|
+
return Default(schema, path, Visit7(schema.not, references, path, value));
|
|
22872
22724
|
}
|
|
22873
|
-
function
|
|
22874
|
-
|
|
22725
|
+
function FromObject10(schema, references, path, value) {
|
|
22726
|
+
if (!IsObject2(value))
|
|
22727
|
+
return Default(schema, path, value);
|
|
22728
|
+
const knownKeys = KeyOfPropertyKeys(schema);
|
|
22729
|
+
const knownProperties = { ...value };
|
|
22730
|
+
for (const key of knownKeys) {
|
|
22731
|
+
if (!HasPropertyKey(knownProperties, key))
|
|
22732
|
+
continue;
|
|
22733
|
+
if (IsUndefined2(knownProperties[key]) && (!IsUndefined3(schema.properties[key]) || TypeSystemPolicy.IsExactOptionalProperty(knownProperties, key)))
|
|
22734
|
+
continue;
|
|
22735
|
+
knownProperties[key] = Visit7(schema.properties[key], references, `${path}/${key}`, knownProperties[key]);
|
|
22736
|
+
}
|
|
22737
|
+
if (!IsSchema(schema.additionalProperties)) {
|
|
22738
|
+
return Default(schema, path, knownProperties);
|
|
22739
|
+
}
|
|
22740
|
+
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
22741
|
+
const additionalProperties = schema.additionalProperties;
|
|
22742
|
+
const unknownProperties = { ...knownProperties };
|
|
22743
|
+
for (const key of unknownKeys)
|
|
22744
|
+
if (!knownKeys.includes(key)) {
|
|
22745
|
+
unknownProperties[key] = Default(additionalProperties, `${path}/${key}`, unknownProperties[key]);
|
|
22746
|
+
}
|
|
22747
|
+
return Default(schema, path, unknownProperties);
|
|
22875
22748
|
}
|
|
22876
|
-
function
|
|
22877
|
-
|
|
22749
|
+
function FromRecord6(schema, references, path, value) {
|
|
22750
|
+
if (!IsObject2(value))
|
|
22751
|
+
return Default(schema, path, value);
|
|
22752
|
+
const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
22753
|
+
const knownKeys = new RegExp(pattern);
|
|
22754
|
+
const knownProperties = { ...value };
|
|
22755
|
+
for (const key of Object.getOwnPropertyNames(value))
|
|
22756
|
+
if (knownKeys.test(key)) {
|
|
22757
|
+
knownProperties[key] = Visit7(schema.patternProperties[pattern], references, `${path}/${key}`, knownProperties[key]);
|
|
22758
|
+
}
|
|
22759
|
+
if (!IsSchema(schema.additionalProperties)) {
|
|
22760
|
+
return Default(schema, path, knownProperties);
|
|
22761
|
+
}
|
|
22762
|
+
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
22763
|
+
const additionalProperties = schema.additionalProperties;
|
|
22764
|
+
const unknownProperties = { ...knownProperties };
|
|
22765
|
+
for (const key of unknownKeys)
|
|
22766
|
+
if (!knownKeys.test(key)) {
|
|
22767
|
+
unknownProperties[key] = Default(additionalProperties, `${path}/${key}`, unknownProperties[key]);
|
|
22768
|
+
}
|
|
22769
|
+
return Default(schema, path, unknownProperties);
|
|
22878
22770
|
}
|
|
22879
|
-
function
|
|
22880
|
-
|
|
22771
|
+
function FromRef7(schema, references, path, value) {
|
|
22772
|
+
const target = Deref(schema, references);
|
|
22773
|
+
return Default(schema, path, Visit7(target, references, path, value));
|
|
22881
22774
|
}
|
|
22882
|
-
function
|
|
22883
|
-
|
|
22775
|
+
function FromThis3(schema, references, path, value) {
|
|
22776
|
+
const target = Deref(schema, references);
|
|
22777
|
+
return Default(schema, path, Visit7(target, references, path, value));
|
|
22884
22778
|
}
|
|
22885
|
-
function
|
|
22886
|
-
|
|
22887
|
-
return FromArray9(value);
|
|
22888
|
-
if (IsDate2(value))
|
|
22889
|
-
return FromDate4(value);
|
|
22890
|
-
if (IsTypedArray(value))
|
|
22891
|
-
return FromTypedArray(value);
|
|
22892
|
-
if (IsMap(value))
|
|
22893
|
-
return FromMap(value);
|
|
22894
|
-
if (IsSet(value))
|
|
22895
|
-
return FromSet(value);
|
|
22896
|
-
if (IsObject2(value))
|
|
22897
|
-
return FromObject10(value);
|
|
22898
|
-
if (IsValueType(value))
|
|
22899
|
-
return FromValue2(value);
|
|
22900
|
-
throw new Error("ValueClone: Unable to clone value");
|
|
22779
|
+
function FromTuple8(schema, references, path, value) {
|
|
22780
|
+
return IsArray2(value) && IsArray2(schema.items) ? Default(schema, path, schema.items.map((schema, index) => Visit7(schema, references, `${path}/${index}`, value[index]))) : Default(schema, path, value);
|
|
22901
22781
|
}
|
|
22902
|
-
|
|
22903
|
-
|
|
22904
|
-
|
|
22905
|
-
|
|
22906
|
-
|
|
22907
|
-
|
|
22782
|
+
function FromUnion13(schema, references, path, value) {
|
|
22783
|
+
for (const subschema of schema.anyOf) {
|
|
22784
|
+
if (!Check(subschema, references, value))
|
|
22785
|
+
continue;
|
|
22786
|
+
const decoded = Visit7(subschema, references, path, value);
|
|
22787
|
+
return Default(schema, path, decoded);
|
|
22908
22788
|
}
|
|
22789
|
+
return Default(schema, path, value);
|
|
22909
22790
|
}
|
|
22910
|
-
function
|
|
22911
|
-
|
|
22912
|
-
|
|
22913
|
-
|
|
22914
|
-
|
|
22915
|
-
|
|
22916
|
-
|
|
22917
|
-
|
|
22791
|
+
function Visit7(schema, references, path, value) {
|
|
22792
|
+
const references_ = Pushref(schema, references);
|
|
22793
|
+
const schema_ = schema;
|
|
22794
|
+
switch (schema[Kind]) {
|
|
22795
|
+
case "Array":
|
|
22796
|
+
return FromArray9(schema_, references_, path, value);
|
|
22797
|
+
case "Import":
|
|
22798
|
+
return FromImport3(schema_, references_, path, value);
|
|
22799
|
+
case "Intersect":
|
|
22800
|
+
return FromIntersect11(schema_, references_, path, value);
|
|
22801
|
+
case "Not":
|
|
22802
|
+
return FromNot4(schema_, references_, path, value);
|
|
22803
|
+
case "Object":
|
|
22804
|
+
return FromObject10(schema_, references_, path, value);
|
|
22805
|
+
case "Record":
|
|
22806
|
+
return FromRecord6(schema_, references_, path, value);
|
|
22807
|
+
case "Ref":
|
|
22808
|
+
return FromRef7(schema_, references_, path, value);
|
|
22809
|
+
case "Symbol":
|
|
22810
|
+
return Default(schema_, path, value);
|
|
22811
|
+
case "This":
|
|
22812
|
+
return FromThis3(schema_, references_, path, value);
|
|
22813
|
+
case "Tuple":
|
|
22814
|
+
return FromTuple8(schema_, references_, path, value);
|
|
22815
|
+
case "Union":
|
|
22816
|
+
return FromUnion13(schema_, references_, path, value);
|
|
22817
|
+
default:
|
|
22818
|
+
return Default(schema_, path, value);
|
|
22918
22819
|
}
|
|
22919
22820
|
}
|
|
22920
|
-
function
|
|
22921
|
-
return
|
|
22821
|
+
function TransformDecode(schema, references, value) {
|
|
22822
|
+
return Visit7(schema, references, "", value);
|
|
22922
22823
|
}
|
|
22824
|
+
|
|
22825
|
+
// node_modules/@sinclair/typebox/build/esm/value/transform/has.mjs
|
|
22923
22826
|
function FromArray10(schema, references) {
|
|
22924
|
-
|
|
22925
|
-
throw new ValueCreateError(schema, "Array with the uniqueItems constraint requires a default value");
|
|
22926
|
-
} else if ("contains" in schema && !HasPropertyKey2(schema, "default")) {
|
|
22927
|
-
throw new ValueCreateError(schema, "Array with the contains constraint requires a default value");
|
|
22928
|
-
} else if ("default" in schema) {
|
|
22929
|
-
return FromDefault(schema.default);
|
|
22930
|
-
} else if (schema.minItems !== undefined) {
|
|
22931
|
-
return Array.from({ length: schema.minItems }).map((item) => {
|
|
22932
|
-
return Visit7(schema.items, references);
|
|
22933
|
-
});
|
|
22934
|
-
} else {
|
|
22935
|
-
return [];
|
|
22936
|
-
}
|
|
22827
|
+
return IsTransform(schema) || Visit8(schema.items, references);
|
|
22937
22828
|
}
|
|
22938
22829
|
function FromAsyncIterator6(schema, references) {
|
|
22939
|
-
|
|
22940
|
-
return FromDefault(schema.default);
|
|
22941
|
-
} else {
|
|
22942
|
-
return async function* () {}();
|
|
22943
|
-
}
|
|
22944
|
-
}
|
|
22945
|
-
function FromBigInt4(schema, references) {
|
|
22946
|
-
if (HasPropertyKey2(schema, "default")) {
|
|
22947
|
-
return FromDefault(schema.default);
|
|
22948
|
-
} else {
|
|
22949
|
-
return BigInt(0);
|
|
22950
|
-
}
|
|
22951
|
-
}
|
|
22952
|
-
function FromBoolean4(schema, references) {
|
|
22953
|
-
if (HasPropertyKey2(schema, "default")) {
|
|
22954
|
-
return FromDefault(schema.default);
|
|
22955
|
-
} else {
|
|
22956
|
-
return false;
|
|
22957
|
-
}
|
|
22830
|
+
return IsTransform(schema) || Visit8(schema.items, references);
|
|
22958
22831
|
}
|
|
22959
22832
|
function FromConstructor6(schema, references) {
|
|
22960
|
-
|
|
22961
|
-
return FromDefault(schema.default);
|
|
22962
|
-
} else {
|
|
22963
|
-
const value = Visit7(schema.returns, references);
|
|
22964
|
-
if (typeof value === "object" && !Array.isArray(value)) {
|
|
22965
|
-
return class {
|
|
22966
|
-
constructor() {
|
|
22967
|
-
for (const [key, val] of Object.entries(value)) {
|
|
22968
|
-
const self2 = this;
|
|
22969
|
-
self2[key] = val;
|
|
22970
|
-
}
|
|
22971
|
-
}
|
|
22972
|
-
};
|
|
22973
|
-
} else {
|
|
22974
|
-
return class {
|
|
22975
|
-
};
|
|
22976
|
-
}
|
|
22977
|
-
}
|
|
22978
|
-
}
|
|
22979
|
-
function FromDate5(schema, references) {
|
|
22980
|
-
if (HasPropertyKey2(schema, "default")) {
|
|
22981
|
-
return FromDefault(schema.default);
|
|
22982
|
-
} else if (schema.minimumTimestamp !== undefined) {
|
|
22983
|
-
return new Date(schema.minimumTimestamp);
|
|
22984
|
-
} else {
|
|
22985
|
-
return new Date;
|
|
22986
|
-
}
|
|
22833
|
+
return IsTransform(schema) || Visit8(schema.returns, references) || schema.parameters.some((schema) => Visit8(schema, references));
|
|
22987
22834
|
}
|
|
22988
22835
|
function FromFunction6(schema, references) {
|
|
22989
|
-
|
|
22990
|
-
return FromDefault(schema.default);
|
|
22991
|
-
} else {
|
|
22992
|
-
return () => Visit7(schema.returns, references);
|
|
22993
|
-
}
|
|
22994
|
-
}
|
|
22995
|
-
function FromImport3(schema, references) {
|
|
22996
|
-
const definitions = globalThis.Object.values(schema.$defs);
|
|
22997
|
-
const target = schema.$defs[schema.$ref];
|
|
22998
|
-
return Visit7(target, [...references, ...definitions]);
|
|
22836
|
+
return IsTransform(schema) || Visit8(schema.returns, references) || schema.parameters.some((schema) => Visit8(schema, references));
|
|
22999
22837
|
}
|
|
23000
|
-
function
|
|
23001
|
-
|
|
23002
|
-
return FromDefault(schema.default);
|
|
23003
|
-
} else if (schema.minimum !== undefined) {
|
|
23004
|
-
return schema.minimum;
|
|
23005
|
-
} else {
|
|
23006
|
-
return 0;
|
|
23007
|
-
}
|
|
22838
|
+
function FromIntersect12(schema, references) {
|
|
22839
|
+
return IsTransform(schema) || IsTransform(schema.unevaluatedProperties) || schema.allOf.some((schema) => Visit8(schema, references));
|
|
23008
22840
|
}
|
|
23009
|
-
function
|
|
23010
|
-
|
|
23011
|
-
|
|
23012
|
-
|
|
23013
|
-
const value = schema.allOf.reduce((acc, schema2) => {
|
|
23014
|
-
const next = Visit7(schema2, references);
|
|
23015
|
-
return typeof next === "object" ? { ...acc, ...next } : next;
|
|
23016
|
-
}, {});
|
|
23017
|
-
if (!Check(schema, references, value))
|
|
23018
|
-
throw new ValueCreateError(schema, "Intersect produced invalid value. Consider using a default value.");
|
|
23019
|
-
return value;
|
|
23020
|
-
}
|
|
22841
|
+
function FromImport4(schema, references) {
|
|
22842
|
+
const additional = globalThis.Object.getOwnPropertyNames(schema.$defs).reduce((result, key) => [...result, schema.$defs[key]], []);
|
|
22843
|
+
const target = schema.$defs[schema.$ref];
|
|
22844
|
+
return IsTransform(schema) || Visit8(target, [...additional, ...references]);
|
|
23021
22845
|
}
|
|
23022
22846
|
function FromIterator6(schema, references) {
|
|
23023
|
-
|
|
23024
|
-
return FromDefault(schema.default);
|
|
23025
|
-
} else {
|
|
23026
|
-
return function* () {}();
|
|
23027
|
-
}
|
|
23028
|
-
}
|
|
23029
|
-
function FromLiteral5(schema, references) {
|
|
23030
|
-
if (HasPropertyKey2(schema, "default")) {
|
|
23031
|
-
return FromDefault(schema.default);
|
|
23032
|
-
} else {
|
|
23033
|
-
return schema.const;
|
|
23034
|
-
}
|
|
23035
|
-
}
|
|
23036
|
-
function FromNever4(schema, references) {
|
|
23037
|
-
if (HasPropertyKey2(schema, "default")) {
|
|
23038
|
-
return FromDefault(schema.default);
|
|
23039
|
-
} else {
|
|
23040
|
-
throw new ValueCreateError(schema, "Never types cannot be created. Consider using a default value.");
|
|
23041
|
-
}
|
|
23042
|
-
}
|
|
23043
|
-
function FromNot4(schema, references) {
|
|
23044
|
-
if (HasPropertyKey2(schema, "default")) {
|
|
23045
|
-
return FromDefault(schema.default);
|
|
23046
|
-
} else {
|
|
23047
|
-
throw new ValueCreateError(schema, "Not types must have a default value");
|
|
23048
|
-
}
|
|
23049
|
-
}
|
|
23050
|
-
function FromNull4(schema, references) {
|
|
23051
|
-
if (HasPropertyKey2(schema, "default")) {
|
|
23052
|
-
return FromDefault(schema.default);
|
|
23053
|
-
} else {
|
|
23054
|
-
return null;
|
|
23055
|
-
}
|
|
22847
|
+
return IsTransform(schema) || Visit8(schema.items, references);
|
|
23056
22848
|
}
|
|
23057
|
-
function
|
|
23058
|
-
|
|
23059
|
-
return FromDefault(schema.default);
|
|
23060
|
-
} else if (schema.minimum !== undefined) {
|
|
23061
|
-
return schema.minimum;
|
|
23062
|
-
} else {
|
|
23063
|
-
return 0;
|
|
23064
|
-
}
|
|
22849
|
+
function FromNot5(schema, references) {
|
|
22850
|
+
return IsTransform(schema) || Visit8(schema.not, references);
|
|
23065
22851
|
}
|
|
23066
22852
|
function FromObject11(schema, references) {
|
|
23067
|
-
|
|
23068
|
-
return FromDefault(schema.default);
|
|
23069
|
-
} else {
|
|
23070
|
-
const required = new Set(schema.required);
|
|
23071
|
-
const Acc = {};
|
|
23072
|
-
for (const [key, subschema] of Object.entries(schema.properties)) {
|
|
23073
|
-
if (!required.has(key))
|
|
23074
|
-
continue;
|
|
23075
|
-
Acc[key] = Visit7(subschema, references);
|
|
23076
|
-
}
|
|
23077
|
-
return Acc;
|
|
23078
|
-
}
|
|
22853
|
+
return IsTransform(schema) || Object.values(schema.properties).some((schema) => Visit8(schema, references)) || IsSchema(schema.additionalProperties) && Visit8(schema.additionalProperties, references);
|
|
23079
22854
|
}
|
|
23080
22855
|
function FromPromise6(schema, references) {
|
|
23081
|
-
|
|
23082
|
-
return FromDefault(schema.default);
|
|
23083
|
-
} else {
|
|
23084
|
-
return Promise.resolve(Visit7(schema.item, references));
|
|
23085
|
-
}
|
|
22856
|
+
return IsTransform(schema) || Visit8(schema.item, references);
|
|
23086
22857
|
}
|
|
23087
|
-
function
|
|
23088
|
-
|
|
23089
|
-
|
|
23090
|
-
|
|
23091
|
-
return {};
|
|
23092
|
-
}
|
|
22858
|
+
function FromRecord7(schema, references) {
|
|
22859
|
+
const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
22860
|
+
const property = schema.patternProperties[pattern];
|
|
22861
|
+
return IsTransform(schema) || Visit8(property, references) || IsSchema(schema.additionalProperties) && IsTransform(schema.additionalProperties);
|
|
23093
22862
|
}
|
|
23094
|
-
function
|
|
23095
|
-
if (
|
|
23096
|
-
return
|
|
23097
|
-
|
|
23098
|
-
return Visit7(Deref(schema, references), references);
|
|
23099
|
-
}
|
|
22863
|
+
function FromRef8(schema, references) {
|
|
22864
|
+
if (IsTransform(schema))
|
|
22865
|
+
return true;
|
|
22866
|
+
return Visit8(Deref(schema, references), references);
|
|
23100
22867
|
}
|
|
23101
|
-
function
|
|
23102
|
-
if (
|
|
23103
|
-
return
|
|
23104
|
-
|
|
23105
|
-
throw new ValueCreateError(schema, "RegExp types cannot be created. Consider using a default value.");
|
|
23106
|
-
}
|
|
22868
|
+
function FromThis4(schema, references) {
|
|
22869
|
+
if (IsTransform(schema))
|
|
22870
|
+
return true;
|
|
22871
|
+
return Visit8(Deref(schema, references), references);
|
|
23107
22872
|
}
|
|
23108
|
-
function
|
|
23109
|
-
|
|
23110
|
-
if (!HasPropertyKey2(schema, "default")) {
|
|
23111
|
-
throw new ValueCreateError(schema, "String types with patterns must specify a default value");
|
|
23112
|
-
} else {
|
|
23113
|
-
return FromDefault(schema.default);
|
|
23114
|
-
}
|
|
23115
|
-
} else if (schema.format !== undefined) {
|
|
23116
|
-
if (!HasPropertyKey2(schema, "default")) {
|
|
23117
|
-
throw new ValueCreateError(schema, "String types with formats must specify a default value");
|
|
23118
|
-
} else {
|
|
23119
|
-
return FromDefault(schema.default);
|
|
23120
|
-
}
|
|
23121
|
-
} else {
|
|
23122
|
-
if (HasPropertyKey2(schema, "default")) {
|
|
23123
|
-
return FromDefault(schema.default);
|
|
23124
|
-
} else if (schema.minLength !== undefined) {
|
|
23125
|
-
return Array.from({ length: schema.minLength }).map(() => " ").join("");
|
|
23126
|
-
} else {
|
|
23127
|
-
return "";
|
|
23128
|
-
}
|
|
23129
|
-
}
|
|
22873
|
+
function FromTuple9(schema, references) {
|
|
22874
|
+
return IsTransform(schema) || !IsUndefined2(schema.items) && schema.items.some((schema) => Visit8(schema, references));
|
|
23130
22875
|
}
|
|
23131
|
-
function
|
|
23132
|
-
|
|
23133
|
-
return FromDefault(schema.default);
|
|
23134
|
-
} else if ("value" in schema) {
|
|
23135
|
-
return Symbol.for(schema.value);
|
|
23136
|
-
} else {
|
|
23137
|
-
return Symbol();
|
|
23138
|
-
}
|
|
22876
|
+
function FromUnion14(schema, references) {
|
|
22877
|
+
return IsTransform(schema) || schema.anyOf.some((schema) => Visit8(schema, references));
|
|
23139
22878
|
}
|
|
23140
|
-
function
|
|
23141
|
-
if (HasPropertyKey2(schema, "default")) {
|
|
23142
|
-
return FromDefault(schema.default);
|
|
23143
|
-
}
|
|
23144
|
-
if (!IsTemplateLiteralFinite(schema))
|
|
23145
|
-
throw new ValueCreateError(schema, "Can only create template literals that produce a finite variants. Consider using a default value.");
|
|
23146
|
-
const generated = TemplateLiteralGenerate(schema);
|
|
23147
|
-
return generated[0];
|
|
23148
|
-
}
|
|
23149
|
-
function FromThis3(schema, references) {
|
|
23150
|
-
if (recursiveDepth++ > recursiveMaxDepth)
|
|
23151
|
-
throw new ValueCreateError(schema, "Cannot create recursive type as it appears possibly infinite. Consider using a default.");
|
|
23152
|
-
if (HasPropertyKey2(schema, "default")) {
|
|
23153
|
-
return FromDefault(schema.default);
|
|
23154
|
-
} else {
|
|
23155
|
-
return Visit7(Deref(schema, references), references);
|
|
23156
|
-
}
|
|
23157
|
-
}
|
|
23158
|
-
function FromTuple8(schema, references) {
|
|
23159
|
-
if (HasPropertyKey2(schema, "default")) {
|
|
23160
|
-
return FromDefault(schema.default);
|
|
23161
|
-
}
|
|
23162
|
-
if (schema.items === undefined) {
|
|
23163
|
-
return [];
|
|
23164
|
-
} else {
|
|
23165
|
-
return Array.from({ length: schema.minItems }).map((_, index) => Visit7(schema.items[index], references));
|
|
23166
|
-
}
|
|
23167
|
-
}
|
|
23168
|
-
function FromUndefined4(schema, references) {
|
|
23169
|
-
if (HasPropertyKey2(schema, "default")) {
|
|
23170
|
-
return FromDefault(schema.default);
|
|
23171
|
-
} else {
|
|
23172
|
-
return;
|
|
23173
|
-
}
|
|
23174
|
-
}
|
|
23175
|
-
function FromUnion13(schema, references) {
|
|
23176
|
-
if (HasPropertyKey2(schema, "default")) {
|
|
23177
|
-
return FromDefault(schema.default);
|
|
23178
|
-
} else if (schema.anyOf.length === 0) {
|
|
23179
|
-
throw new Error("ValueCreate.Union: Cannot create Union with zero variants");
|
|
23180
|
-
} else {
|
|
23181
|
-
return Visit7(schema.anyOf[0], references);
|
|
23182
|
-
}
|
|
23183
|
-
}
|
|
23184
|
-
function FromUint8Array4(schema, references) {
|
|
23185
|
-
if (HasPropertyKey2(schema, "default")) {
|
|
23186
|
-
return FromDefault(schema.default);
|
|
23187
|
-
} else if (schema.minByteLength !== undefined) {
|
|
23188
|
-
return new Uint8Array(schema.minByteLength);
|
|
23189
|
-
} else {
|
|
23190
|
-
return new Uint8Array(0);
|
|
23191
|
-
}
|
|
23192
|
-
}
|
|
23193
|
-
function FromUnknown4(schema, references) {
|
|
23194
|
-
if (HasPropertyKey2(schema, "default")) {
|
|
23195
|
-
return FromDefault(schema.default);
|
|
23196
|
-
} else {
|
|
23197
|
-
return {};
|
|
23198
|
-
}
|
|
23199
|
-
}
|
|
23200
|
-
function FromVoid4(schema, references) {
|
|
23201
|
-
if (HasPropertyKey2(schema, "default")) {
|
|
23202
|
-
return FromDefault(schema.default);
|
|
23203
|
-
} else {
|
|
23204
|
-
return;
|
|
23205
|
-
}
|
|
23206
|
-
}
|
|
23207
|
-
function FromKind3(schema, references) {
|
|
23208
|
-
if (HasPropertyKey2(schema, "default")) {
|
|
23209
|
-
return FromDefault(schema.default);
|
|
23210
|
-
} else {
|
|
23211
|
-
throw new Error("User defined types must specify a default value");
|
|
23212
|
-
}
|
|
23213
|
-
}
|
|
23214
|
-
function Visit7(schema, references) {
|
|
23215
|
-
const references_ = Pushref(schema, references);
|
|
23216
|
-
const schema_ = schema;
|
|
23217
|
-
switch (schema_[Kind]) {
|
|
23218
|
-
case "Any":
|
|
23219
|
-
return FromAny4(schema_, references_);
|
|
23220
|
-
case "Argument":
|
|
23221
|
-
return FromArgument4(schema_, references_);
|
|
23222
|
-
case "Array":
|
|
23223
|
-
return FromArray10(schema_, references_);
|
|
23224
|
-
case "AsyncIterator":
|
|
23225
|
-
return FromAsyncIterator6(schema_, references_);
|
|
23226
|
-
case "BigInt":
|
|
23227
|
-
return FromBigInt4(schema_, references_);
|
|
23228
|
-
case "Boolean":
|
|
23229
|
-
return FromBoolean4(schema_, references_);
|
|
23230
|
-
case "Constructor":
|
|
23231
|
-
return FromConstructor6(schema_, references_);
|
|
23232
|
-
case "Date":
|
|
23233
|
-
return FromDate5(schema_, references_);
|
|
23234
|
-
case "Function":
|
|
23235
|
-
return FromFunction6(schema_, references_);
|
|
23236
|
-
case "Import":
|
|
23237
|
-
return FromImport3(schema_, references_);
|
|
23238
|
-
case "Integer":
|
|
23239
|
-
return FromInteger4(schema_, references_);
|
|
23240
|
-
case "Intersect":
|
|
23241
|
-
return FromIntersect11(schema_, references_);
|
|
23242
|
-
case "Iterator":
|
|
23243
|
-
return FromIterator6(schema_, references_);
|
|
23244
|
-
case "Literal":
|
|
23245
|
-
return FromLiteral5(schema_, references_);
|
|
23246
|
-
case "Never":
|
|
23247
|
-
return FromNever4(schema_, references_);
|
|
23248
|
-
case "Not":
|
|
23249
|
-
return FromNot4(schema_, references_);
|
|
23250
|
-
case "Null":
|
|
23251
|
-
return FromNull4(schema_, references_);
|
|
23252
|
-
case "Number":
|
|
23253
|
-
return FromNumber4(schema_, references_);
|
|
23254
|
-
case "Object":
|
|
23255
|
-
return FromObject11(schema_, references_);
|
|
23256
|
-
case "Promise":
|
|
23257
|
-
return FromPromise6(schema_, references_);
|
|
23258
|
-
case "Record":
|
|
23259
|
-
return FromRecord6(schema_, references_);
|
|
23260
|
-
case "Ref":
|
|
23261
|
-
return FromRef7(schema_, references_);
|
|
23262
|
-
case "RegExp":
|
|
23263
|
-
return FromRegExp4(schema_, references_);
|
|
23264
|
-
case "String":
|
|
23265
|
-
return FromString4(schema_, references_);
|
|
23266
|
-
case "Symbol":
|
|
23267
|
-
return FromSymbol4(schema_, references_);
|
|
23268
|
-
case "TemplateLiteral":
|
|
23269
|
-
return FromTemplateLiteral6(schema_, references_);
|
|
23270
|
-
case "This":
|
|
23271
|
-
return FromThis3(schema_, references_);
|
|
23272
|
-
case "Tuple":
|
|
23273
|
-
return FromTuple8(schema_, references_);
|
|
23274
|
-
case "Undefined":
|
|
23275
|
-
return FromUndefined4(schema_, references_);
|
|
23276
|
-
case "Union":
|
|
23277
|
-
return FromUnion13(schema_, references_);
|
|
23278
|
-
case "Uint8Array":
|
|
23279
|
-
return FromUint8Array4(schema_, references_);
|
|
23280
|
-
case "Unknown":
|
|
23281
|
-
return FromUnknown4(schema_, references_);
|
|
23282
|
-
case "Void":
|
|
23283
|
-
return FromVoid4(schema_, references_);
|
|
23284
|
-
default:
|
|
23285
|
-
if (!exports_type2.Has(schema_[Kind]))
|
|
23286
|
-
throw new ValueCreateError(schema_, "Unknown type");
|
|
23287
|
-
return FromKind3(schema_, references_);
|
|
23288
|
-
}
|
|
23289
|
-
}
|
|
23290
|
-
var recursiveMaxDepth = 512;
|
|
23291
|
-
var recursiveDepth = 0;
|
|
23292
|
-
function Create2(...args) {
|
|
23293
|
-
recursiveDepth = 0;
|
|
23294
|
-
return args.length === 2 ? Visit7(args[0], args[1]) : Visit7(args[0], []);
|
|
23295
|
-
}
|
|
23296
|
-
|
|
23297
|
-
// node_modules/@sinclair/typebox/build/esm/value/cast/cast.mjs
|
|
23298
|
-
class ValueCastError extends TypeBoxError {
|
|
23299
|
-
constructor(schema, message) {
|
|
23300
|
-
super(message);
|
|
23301
|
-
this.schema = schema;
|
|
23302
|
-
}
|
|
23303
|
-
}
|
|
23304
|
-
function ScoreUnion(schema, references, value) {
|
|
23305
|
-
if (schema[Kind] === "Object" && typeof value === "object" && !IsNull2(value)) {
|
|
23306
|
-
const object = schema;
|
|
23307
|
-
const keys = Object.getOwnPropertyNames(value);
|
|
23308
|
-
const entries = Object.entries(object.properties);
|
|
23309
|
-
return entries.reduce((acc, [key, schema2]) => {
|
|
23310
|
-
const literal = schema2[Kind] === "Literal" && schema2.const === value[key] ? 100 : 0;
|
|
23311
|
-
const checks = Check(schema2, references, value[key]) ? 10 : 0;
|
|
23312
|
-
const exists = keys.includes(key) ? 1 : 0;
|
|
23313
|
-
return acc + (literal + checks + exists);
|
|
23314
|
-
}, 0);
|
|
23315
|
-
} else if (schema[Kind] === "Union") {
|
|
23316
|
-
const schemas = schema.anyOf.map((schema2) => Deref(schema2, references));
|
|
23317
|
-
const scores = schemas.map((schema2) => ScoreUnion(schema2, references, value));
|
|
23318
|
-
return Math.max(...scores);
|
|
23319
|
-
} else {
|
|
23320
|
-
return Check(schema, references, value) ? 1 : 0;
|
|
23321
|
-
}
|
|
23322
|
-
}
|
|
23323
|
-
function SelectUnion(union, references, value) {
|
|
23324
|
-
const schemas = union.anyOf.map((schema) => Deref(schema, references));
|
|
23325
|
-
let [select, best] = [schemas[0], 0];
|
|
23326
|
-
for (const schema of schemas) {
|
|
23327
|
-
const score = ScoreUnion(schema, references, value);
|
|
23328
|
-
if (score > best) {
|
|
23329
|
-
select = schema;
|
|
23330
|
-
best = score;
|
|
23331
|
-
}
|
|
23332
|
-
}
|
|
23333
|
-
return select;
|
|
23334
|
-
}
|
|
23335
|
-
function CastUnion(union, references, value) {
|
|
23336
|
-
if ("default" in union) {
|
|
23337
|
-
return typeof value === "function" ? union.default : Clone2(union.default);
|
|
23338
|
-
} else {
|
|
23339
|
-
const schema = SelectUnion(union, references, value);
|
|
23340
|
-
return Cast(schema, references, value);
|
|
23341
|
-
}
|
|
23342
|
-
}
|
|
23343
|
-
function DefaultClone(schema, references, value) {
|
|
23344
|
-
return Check(schema, references, value) ? Clone2(value) : Create2(schema, references);
|
|
23345
|
-
}
|
|
23346
|
-
function Default(schema, references, value) {
|
|
23347
|
-
return Check(schema, references, value) ? value : Create2(schema, references);
|
|
23348
|
-
}
|
|
23349
|
-
function FromArray11(schema, references, value) {
|
|
23350
|
-
if (Check(schema, references, value))
|
|
23351
|
-
return Clone2(value);
|
|
23352
|
-
const created = IsArray2(value) ? Clone2(value) : Create2(schema, references);
|
|
23353
|
-
const minimum = IsNumber2(schema.minItems) && created.length < schema.minItems ? [...created, ...Array.from({ length: schema.minItems - created.length }, () => null)] : created;
|
|
23354
|
-
const maximum = IsNumber2(schema.maxItems) && minimum.length > schema.maxItems ? minimum.slice(0, schema.maxItems) : minimum;
|
|
23355
|
-
const casted = maximum.map((value2) => Visit8(schema.items, references, value2));
|
|
23356
|
-
if (schema.uniqueItems !== true)
|
|
23357
|
-
return casted;
|
|
23358
|
-
const unique = [...new Set(casted)];
|
|
23359
|
-
if (!Check(schema, references, unique))
|
|
23360
|
-
throw new ValueCastError(schema, "Array cast produced invalid data due to uniqueItems constraint");
|
|
23361
|
-
return unique;
|
|
23362
|
-
}
|
|
23363
|
-
function FromConstructor7(schema, references, value) {
|
|
23364
|
-
if (Check(schema, references, value))
|
|
23365
|
-
return Create2(schema, references);
|
|
23366
|
-
const required = new Set(schema.returns.required || []);
|
|
23367
|
-
const result = function() {};
|
|
23368
|
-
for (const [key, property] of Object.entries(schema.returns.properties)) {
|
|
23369
|
-
if (!required.has(key) && value.prototype[key] === undefined)
|
|
23370
|
-
continue;
|
|
23371
|
-
result.prototype[key] = Visit8(property, references, value.prototype[key]);
|
|
23372
|
-
}
|
|
23373
|
-
return result;
|
|
23374
|
-
}
|
|
23375
|
-
function FromImport4(schema, references, value) {
|
|
23376
|
-
const definitions = globalThis.Object.values(schema.$defs);
|
|
23377
|
-
const target = schema.$defs[schema.$ref];
|
|
23378
|
-
return Visit8(target, [...references, ...definitions], value);
|
|
23379
|
-
}
|
|
23380
|
-
function IntersectAssign(correct, value) {
|
|
23381
|
-
if (IsObject2(correct) && !IsObject2(value) || !IsObject2(correct) && IsObject2(value))
|
|
23382
|
-
return correct;
|
|
23383
|
-
if (!IsObject2(correct) || !IsObject2(value))
|
|
23384
|
-
return value;
|
|
23385
|
-
return globalThis.Object.getOwnPropertyNames(correct).reduce((result, key) => {
|
|
23386
|
-
const property = key in value ? IntersectAssign(correct[key], value[key]) : correct[key];
|
|
23387
|
-
return { ...result, [key]: property };
|
|
23388
|
-
}, {});
|
|
23389
|
-
}
|
|
23390
|
-
function FromIntersect12(schema, references, value) {
|
|
23391
|
-
if (Check(schema, references, value))
|
|
23392
|
-
return value;
|
|
23393
|
-
const correct = Create2(schema, references);
|
|
23394
|
-
const assigned = IntersectAssign(correct, value);
|
|
23395
|
-
return Check(schema, references, assigned) ? assigned : correct;
|
|
23396
|
-
}
|
|
23397
|
-
function FromNever5(schema, references, value) {
|
|
23398
|
-
throw new ValueCastError(schema, "Never types cannot be cast");
|
|
23399
|
-
}
|
|
23400
|
-
function FromObject12(schema, references, value) {
|
|
23401
|
-
if (Check(schema, references, value))
|
|
23402
|
-
return value;
|
|
23403
|
-
if (value === null || typeof value !== "object")
|
|
23404
|
-
return Create2(schema, references);
|
|
23405
|
-
const required = new Set(schema.required || []);
|
|
23406
|
-
const result = {};
|
|
23407
|
-
for (const [key, property] of Object.entries(schema.properties)) {
|
|
23408
|
-
if (!required.has(key) && value[key] === undefined)
|
|
23409
|
-
continue;
|
|
23410
|
-
result[key] = Visit8(property, references, value[key]);
|
|
23411
|
-
}
|
|
23412
|
-
if (typeof schema.additionalProperties === "object") {
|
|
23413
|
-
const propertyNames = Object.getOwnPropertyNames(schema.properties);
|
|
23414
|
-
for (const propertyName of Object.getOwnPropertyNames(value)) {
|
|
23415
|
-
if (propertyNames.includes(propertyName))
|
|
23416
|
-
continue;
|
|
23417
|
-
result[propertyName] = Visit8(schema.additionalProperties, references, value[propertyName]);
|
|
23418
|
-
}
|
|
23419
|
-
}
|
|
23420
|
-
return result;
|
|
23421
|
-
}
|
|
23422
|
-
function FromRecord7(schema, references, value) {
|
|
23423
|
-
if (Check(schema, references, value))
|
|
23424
|
-
return Clone2(value);
|
|
23425
|
-
if (value === null || typeof value !== "object" || Array.isArray(value) || value instanceof Date)
|
|
23426
|
-
return Create2(schema, references);
|
|
23427
|
-
const subschemaPropertyName = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
23428
|
-
const subschema = schema.patternProperties[subschemaPropertyName];
|
|
23429
|
-
const result = {};
|
|
23430
|
-
for (const [propKey, propValue] of Object.entries(value)) {
|
|
23431
|
-
result[propKey] = Visit8(subschema, references, propValue);
|
|
23432
|
-
}
|
|
23433
|
-
return result;
|
|
23434
|
-
}
|
|
23435
|
-
function FromRef8(schema, references, value) {
|
|
23436
|
-
return Visit8(Deref(schema, references), references, value);
|
|
23437
|
-
}
|
|
23438
|
-
function FromThis4(schema, references, value) {
|
|
23439
|
-
return Visit8(Deref(schema, references), references, value);
|
|
23440
|
-
}
|
|
23441
|
-
function FromTuple9(schema, references, value) {
|
|
23442
|
-
if (Check(schema, references, value))
|
|
23443
|
-
return Clone2(value);
|
|
23444
|
-
if (!IsArray2(value))
|
|
23445
|
-
return Create2(schema, references);
|
|
23446
|
-
if (schema.items === undefined)
|
|
23447
|
-
return [];
|
|
23448
|
-
return schema.items.map((schema2, index) => Visit8(schema2, references, value[index]));
|
|
23449
|
-
}
|
|
23450
|
-
function FromUnion14(schema, references, value) {
|
|
23451
|
-
return Check(schema, references, value) ? Clone2(value) : CastUnion(schema, references, value);
|
|
23452
|
-
}
|
|
23453
|
-
function Visit8(schema, references, value) {
|
|
23454
|
-
const references_ = IsString2(schema.$id) ? Pushref(schema, references) : references;
|
|
23455
|
-
const schema_ = schema;
|
|
23456
|
-
switch (schema[Kind]) {
|
|
23457
|
-
case "Array":
|
|
23458
|
-
return FromArray11(schema_, references_, value);
|
|
23459
|
-
case "Constructor":
|
|
23460
|
-
return FromConstructor7(schema_, references_, value);
|
|
23461
|
-
case "Import":
|
|
23462
|
-
return FromImport4(schema_, references_, value);
|
|
23463
|
-
case "Intersect":
|
|
23464
|
-
return FromIntersect12(schema_, references_, value);
|
|
23465
|
-
case "Never":
|
|
23466
|
-
return FromNever5(schema_, references_, value);
|
|
23467
|
-
case "Object":
|
|
23468
|
-
return FromObject12(schema_, references_, value);
|
|
23469
|
-
case "Record":
|
|
23470
|
-
return FromRecord7(schema_, references_, value);
|
|
23471
|
-
case "Ref":
|
|
23472
|
-
return FromRef8(schema_, references_, value);
|
|
23473
|
-
case "This":
|
|
23474
|
-
return FromThis4(schema_, references_, value);
|
|
23475
|
-
case "Tuple":
|
|
23476
|
-
return FromTuple9(schema_, references_, value);
|
|
23477
|
-
case "Union":
|
|
23478
|
-
return FromUnion14(schema_, references_, value);
|
|
23479
|
-
case "Date":
|
|
23480
|
-
case "Symbol":
|
|
23481
|
-
case "Uint8Array":
|
|
23482
|
-
return DefaultClone(schema, references, value);
|
|
23483
|
-
default:
|
|
23484
|
-
return Default(schema_, references_, value);
|
|
23485
|
-
}
|
|
23486
|
-
}
|
|
23487
|
-
function Cast(...args) {
|
|
23488
|
-
return args.length === 3 ? Visit8(args[0], args[1], args[2]) : Visit8(args[0], [], args[1]);
|
|
23489
|
-
}
|
|
23490
|
-
// node_modules/@sinclair/typebox/build/esm/value/clean/clean.mjs
|
|
23491
|
-
function IsCheckable(schema) {
|
|
23492
|
-
return IsKind(schema) && schema[Kind] !== "Unsafe";
|
|
23493
|
-
}
|
|
23494
|
-
function FromArray12(schema, references, value) {
|
|
23495
|
-
if (!IsArray2(value))
|
|
23496
|
-
return value;
|
|
23497
|
-
return value.map((value2) => Visit9(schema.items, references, value2));
|
|
23498
|
-
}
|
|
23499
|
-
function FromImport5(schema, references, value) {
|
|
23500
|
-
const definitions = globalThis.Object.values(schema.$defs);
|
|
23501
|
-
const target = schema.$defs[schema.$ref];
|
|
23502
|
-
return Visit9(target, [...references, ...definitions], value);
|
|
23503
|
-
}
|
|
23504
|
-
function FromIntersect13(schema, references, value) {
|
|
23505
|
-
const unevaluatedProperties = schema.unevaluatedProperties;
|
|
23506
|
-
const intersections = schema.allOf.map((schema2) => Visit9(schema2, references, Clone2(value)));
|
|
23507
|
-
const composite = intersections.reduce((acc, value2) => IsObject2(value2) ? { ...acc, ...value2 } : value2, {});
|
|
23508
|
-
if (!IsObject2(value) || !IsObject2(composite) || !IsKind(unevaluatedProperties))
|
|
23509
|
-
return composite;
|
|
23510
|
-
const knownkeys = KeyOfPropertyKeys(schema);
|
|
23511
|
-
for (const key of Object.getOwnPropertyNames(value)) {
|
|
23512
|
-
if (knownkeys.includes(key))
|
|
23513
|
-
continue;
|
|
23514
|
-
if (Check(unevaluatedProperties, references, value[key])) {
|
|
23515
|
-
composite[key] = Visit9(unevaluatedProperties, references, value[key]);
|
|
23516
|
-
}
|
|
23517
|
-
}
|
|
23518
|
-
return composite;
|
|
23519
|
-
}
|
|
23520
|
-
function FromObject13(schema, references, value) {
|
|
23521
|
-
if (!IsObject2(value) || IsArray2(value))
|
|
23522
|
-
return value;
|
|
23523
|
-
const additionalProperties = schema.additionalProperties;
|
|
23524
|
-
for (const key of Object.getOwnPropertyNames(value)) {
|
|
23525
|
-
if (HasPropertyKey2(schema.properties, key)) {
|
|
23526
|
-
value[key] = Visit9(schema.properties[key], references, value[key]);
|
|
23527
|
-
continue;
|
|
23528
|
-
}
|
|
23529
|
-
if (IsKind(additionalProperties) && Check(additionalProperties, references, value[key])) {
|
|
23530
|
-
value[key] = Visit9(additionalProperties, references, value[key]);
|
|
23531
|
-
continue;
|
|
23532
|
-
}
|
|
23533
|
-
delete value[key];
|
|
23534
|
-
}
|
|
23535
|
-
return value;
|
|
23536
|
-
}
|
|
23537
|
-
function FromRecord8(schema, references, value) {
|
|
23538
|
-
if (!IsObject2(value))
|
|
23539
|
-
return value;
|
|
23540
|
-
const additionalProperties = schema.additionalProperties;
|
|
23541
|
-
const propertyKeys = Object.getOwnPropertyNames(value);
|
|
23542
|
-
const [propertyKey, propertySchema] = Object.entries(schema.patternProperties)[0];
|
|
23543
|
-
const propertyKeyTest = new RegExp(propertyKey);
|
|
23544
|
-
for (const key of propertyKeys) {
|
|
23545
|
-
if (propertyKeyTest.test(key)) {
|
|
23546
|
-
value[key] = Visit9(propertySchema, references, value[key]);
|
|
23547
|
-
continue;
|
|
23548
|
-
}
|
|
23549
|
-
if (IsKind(additionalProperties) && Check(additionalProperties, references, value[key])) {
|
|
23550
|
-
value[key] = Visit9(additionalProperties, references, value[key]);
|
|
23551
|
-
continue;
|
|
23552
|
-
}
|
|
23553
|
-
delete value[key];
|
|
23554
|
-
}
|
|
23555
|
-
return value;
|
|
23556
|
-
}
|
|
23557
|
-
function FromRef9(schema, references, value) {
|
|
23558
|
-
return Visit9(Deref(schema, references), references, value);
|
|
23559
|
-
}
|
|
23560
|
-
function FromThis5(schema, references, value) {
|
|
23561
|
-
return Visit9(Deref(schema, references), references, value);
|
|
23562
|
-
}
|
|
23563
|
-
function FromTuple10(schema, references, value) {
|
|
23564
|
-
if (!IsArray2(value))
|
|
23565
|
-
return value;
|
|
23566
|
-
if (IsUndefined2(schema.items))
|
|
23567
|
-
return [];
|
|
23568
|
-
const length = Math.min(value.length, schema.items.length);
|
|
23569
|
-
for (let i = 0;i < length; i++) {
|
|
23570
|
-
value[i] = Visit9(schema.items[i], references, value[i]);
|
|
23571
|
-
}
|
|
23572
|
-
return value.length > length ? value.slice(0, length) : value;
|
|
23573
|
-
}
|
|
23574
|
-
function FromUnion15(schema, references, value) {
|
|
23575
|
-
for (const inner of schema.anyOf) {
|
|
23576
|
-
if (IsCheckable(inner) && Check(inner, references, value)) {
|
|
23577
|
-
return Visit9(inner, references, value);
|
|
23578
|
-
}
|
|
23579
|
-
}
|
|
23580
|
-
return value;
|
|
23581
|
-
}
|
|
23582
|
-
function Visit9(schema, references, value) {
|
|
23583
|
-
const references_ = IsString2(schema.$id) ? Pushref(schema, references) : references;
|
|
23584
|
-
const schema_ = schema;
|
|
23585
|
-
switch (schema_[Kind]) {
|
|
23586
|
-
case "Array":
|
|
23587
|
-
return FromArray12(schema_, references_, value);
|
|
23588
|
-
case "Import":
|
|
23589
|
-
return FromImport5(schema_, references_, value);
|
|
23590
|
-
case "Intersect":
|
|
23591
|
-
return FromIntersect13(schema_, references_, value);
|
|
23592
|
-
case "Object":
|
|
23593
|
-
return FromObject13(schema_, references_, value);
|
|
23594
|
-
case "Record":
|
|
23595
|
-
return FromRecord8(schema_, references_, value);
|
|
23596
|
-
case "Ref":
|
|
23597
|
-
return FromRef9(schema_, references_, value);
|
|
23598
|
-
case "This":
|
|
23599
|
-
return FromThis5(schema_, references_, value);
|
|
23600
|
-
case "Tuple":
|
|
23601
|
-
return FromTuple10(schema_, references_, value);
|
|
23602
|
-
case "Union":
|
|
23603
|
-
return FromUnion15(schema_, references_, value);
|
|
23604
|
-
default:
|
|
23605
|
-
return value;
|
|
23606
|
-
}
|
|
23607
|
-
}
|
|
23608
|
-
function Clean(...args) {
|
|
23609
|
-
return args.length === 3 ? Visit9(args[0], args[1], args[2]) : Visit9(args[0], [], args[1]);
|
|
23610
|
-
}
|
|
23611
|
-
// node_modules/@sinclair/typebox/build/esm/value/convert/convert.mjs
|
|
23612
|
-
function IsStringNumeric(value) {
|
|
23613
|
-
return IsString2(value) && !isNaN(value) && !isNaN(parseFloat(value));
|
|
23614
|
-
}
|
|
23615
|
-
function IsValueToString(value) {
|
|
23616
|
-
return IsBigInt2(value) || IsBoolean2(value) || IsNumber2(value);
|
|
23617
|
-
}
|
|
23618
|
-
function IsValueTrue(value) {
|
|
23619
|
-
return value === true || IsNumber2(value) && value === 1 || IsBigInt2(value) && value === BigInt("1") || IsString2(value) && (value.toLowerCase() === "true" || value === "1");
|
|
23620
|
-
}
|
|
23621
|
-
function IsValueFalse(value) {
|
|
23622
|
-
return value === false || IsNumber2(value) && (value === 0 || Object.is(value, -0)) || IsBigInt2(value) && value === BigInt("0") || IsString2(value) && (value.toLowerCase() === "false" || value === "0" || value === "-0");
|
|
23623
|
-
}
|
|
23624
|
-
function IsTimeStringWithTimeZone(value) {
|
|
23625
|
-
return IsString2(value) && /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(value);
|
|
23626
|
-
}
|
|
23627
|
-
function IsTimeStringWithoutTimeZone(value) {
|
|
23628
|
-
return IsString2(value) && /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(value);
|
|
23629
|
-
}
|
|
23630
|
-
function IsDateTimeStringWithTimeZone(value) {
|
|
23631
|
-
return IsString2(value) && /^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i.test(value);
|
|
23632
|
-
}
|
|
23633
|
-
function IsDateTimeStringWithoutTimeZone(value) {
|
|
23634
|
-
return IsString2(value) && /^\d\d\d\d-[0-1]\d-[0-3]\dt(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)?$/i.test(value);
|
|
23635
|
-
}
|
|
23636
|
-
function IsDateString(value) {
|
|
23637
|
-
return IsString2(value) && /^\d\d\d\d-[0-1]\d-[0-3]\d$/i.test(value);
|
|
23638
|
-
}
|
|
23639
|
-
function TryConvertLiteralString(value, target) {
|
|
23640
|
-
const conversion = TryConvertString(value);
|
|
23641
|
-
return conversion === target ? conversion : value;
|
|
23642
|
-
}
|
|
23643
|
-
function TryConvertLiteralNumber(value, target) {
|
|
23644
|
-
const conversion = TryConvertNumber(value);
|
|
23645
|
-
return conversion === target ? conversion : value;
|
|
23646
|
-
}
|
|
23647
|
-
function TryConvertLiteralBoolean(value, target) {
|
|
23648
|
-
const conversion = TryConvertBoolean(value);
|
|
23649
|
-
return conversion === target ? conversion : value;
|
|
23650
|
-
}
|
|
23651
|
-
function TryConvertLiteral(schema, value) {
|
|
23652
|
-
return IsString2(schema.const) ? TryConvertLiteralString(value, schema.const) : IsNumber2(schema.const) ? TryConvertLiteralNumber(value, schema.const) : IsBoolean2(schema.const) ? TryConvertLiteralBoolean(value, schema.const) : value;
|
|
23653
|
-
}
|
|
23654
|
-
function TryConvertBoolean(value) {
|
|
23655
|
-
return IsValueTrue(value) ? true : IsValueFalse(value) ? false : value;
|
|
23656
|
-
}
|
|
23657
|
-
function TryConvertBigInt(value) {
|
|
23658
|
-
const truncateInteger = (value2) => value2.split(".")[0];
|
|
23659
|
-
return IsStringNumeric(value) ? BigInt(truncateInteger(value)) : IsNumber2(value) ? BigInt(Math.trunc(value)) : IsValueFalse(value) ? BigInt(0) : IsValueTrue(value) ? BigInt(1) : value;
|
|
23660
|
-
}
|
|
23661
|
-
function TryConvertString(value) {
|
|
23662
|
-
return IsSymbol2(value) && value.description !== undefined ? value.description.toString() : IsValueToString(value) ? value.toString() : value;
|
|
23663
|
-
}
|
|
23664
|
-
function TryConvertNumber(value) {
|
|
23665
|
-
return IsStringNumeric(value) ? parseFloat(value) : IsValueTrue(value) ? 1 : IsValueFalse(value) ? 0 : value;
|
|
23666
|
-
}
|
|
23667
|
-
function TryConvertInteger(value) {
|
|
23668
|
-
return IsStringNumeric(value) ? parseInt(value) : IsNumber2(value) ? Math.trunc(value) : IsValueTrue(value) ? 1 : IsValueFalse(value) ? 0 : value;
|
|
23669
|
-
}
|
|
23670
|
-
function TryConvertNull(value) {
|
|
23671
|
-
return IsString2(value) && value.toLowerCase() === "null" ? null : value;
|
|
23672
|
-
}
|
|
23673
|
-
function TryConvertUndefined(value) {
|
|
23674
|
-
return IsString2(value) && value === "undefined" ? undefined : value;
|
|
23675
|
-
}
|
|
23676
|
-
function TryConvertDate(value) {
|
|
23677
|
-
return IsDate2(value) ? value : IsNumber2(value) ? new Date(value) : IsValueTrue(value) ? new Date(1) : IsValueFalse(value) ? new Date(0) : IsStringNumeric(value) ? new Date(parseInt(value)) : IsTimeStringWithoutTimeZone(value) ? new Date(`1970-01-01T${value}.000Z`) : IsTimeStringWithTimeZone(value) ? new Date(`1970-01-01T${value}`) : IsDateTimeStringWithoutTimeZone(value) ? new Date(`${value}.000Z`) : IsDateTimeStringWithTimeZone(value) ? new Date(value) : IsDateString(value) ? new Date(`${value}T00:00:00.000Z`) : value;
|
|
23678
|
-
}
|
|
23679
|
-
function Default2(value) {
|
|
23680
|
-
return value;
|
|
23681
|
-
}
|
|
23682
|
-
function FromArray13(schema, references, value) {
|
|
23683
|
-
const elements = IsArray2(value) ? value : [value];
|
|
23684
|
-
return elements.map((element) => Visit10(schema.items, references, element));
|
|
23685
|
-
}
|
|
23686
|
-
function FromBigInt5(schema, references, value) {
|
|
23687
|
-
return TryConvertBigInt(value);
|
|
23688
|
-
}
|
|
23689
|
-
function FromBoolean5(schema, references, value) {
|
|
23690
|
-
return TryConvertBoolean(value);
|
|
23691
|
-
}
|
|
23692
|
-
function FromDate6(schema, references, value) {
|
|
23693
|
-
return TryConvertDate(value);
|
|
23694
|
-
}
|
|
23695
|
-
function FromImport6(schema, references, value) {
|
|
23696
|
-
const definitions = globalThis.Object.values(schema.$defs);
|
|
23697
|
-
const target = schema.$defs[schema.$ref];
|
|
23698
|
-
return Visit10(target, [...references, ...definitions], value);
|
|
23699
|
-
}
|
|
23700
|
-
function FromInteger5(schema, references, value) {
|
|
23701
|
-
return TryConvertInteger(value);
|
|
23702
|
-
}
|
|
23703
|
-
function FromIntersect14(schema, references, value) {
|
|
23704
|
-
return schema.allOf.reduce((value2, schema2) => Visit10(schema2, references, value2), value);
|
|
23705
|
-
}
|
|
23706
|
-
function FromLiteral6(schema, references, value) {
|
|
23707
|
-
return TryConvertLiteral(schema, value);
|
|
23708
|
-
}
|
|
23709
|
-
function FromNull5(schema, references, value) {
|
|
23710
|
-
return TryConvertNull(value);
|
|
23711
|
-
}
|
|
23712
|
-
function FromNumber5(schema, references, value) {
|
|
23713
|
-
return TryConvertNumber(value);
|
|
23714
|
-
}
|
|
23715
|
-
function FromObject14(schema, references, value) {
|
|
23716
|
-
if (!IsObject2(value) || IsArray2(value))
|
|
23717
|
-
return value;
|
|
23718
|
-
for (const propertyKey of Object.getOwnPropertyNames(schema.properties)) {
|
|
23719
|
-
if (!HasPropertyKey2(value, propertyKey))
|
|
23720
|
-
continue;
|
|
23721
|
-
value[propertyKey] = Visit10(schema.properties[propertyKey], references, value[propertyKey]);
|
|
23722
|
-
}
|
|
23723
|
-
return value;
|
|
23724
|
-
}
|
|
23725
|
-
function FromRecord9(schema, references, value) {
|
|
23726
|
-
const isConvertable = IsObject2(value) && !IsArray2(value);
|
|
23727
|
-
if (!isConvertable)
|
|
23728
|
-
return value;
|
|
23729
|
-
const propertyKey = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
23730
|
-
const property = schema.patternProperties[propertyKey];
|
|
23731
|
-
for (const [propKey, propValue] of Object.entries(value)) {
|
|
23732
|
-
value[propKey] = Visit10(property, references, propValue);
|
|
23733
|
-
}
|
|
23734
|
-
return value;
|
|
23735
|
-
}
|
|
23736
|
-
function FromRef10(schema, references, value) {
|
|
23737
|
-
return Visit10(Deref(schema, references), references, value);
|
|
23738
|
-
}
|
|
23739
|
-
function FromString5(schema, references, value) {
|
|
23740
|
-
return TryConvertString(value);
|
|
23741
|
-
}
|
|
23742
|
-
function FromSymbol5(schema, references, value) {
|
|
23743
|
-
return IsString2(value) || IsNumber2(value) ? Symbol(value) : value;
|
|
23744
|
-
}
|
|
23745
|
-
function FromThis6(schema, references, value) {
|
|
23746
|
-
return Visit10(Deref(schema, references), references, value);
|
|
23747
|
-
}
|
|
23748
|
-
function FromTuple11(schema, references, value) {
|
|
23749
|
-
const isConvertable = IsArray2(value) && !IsUndefined2(schema.items);
|
|
23750
|
-
if (!isConvertable)
|
|
23751
|
-
return value;
|
|
23752
|
-
return value.map((value2, index) => {
|
|
23753
|
-
return index < schema.items.length ? Visit10(schema.items[index], references, value2) : value2;
|
|
23754
|
-
});
|
|
23755
|
-
}
|
|
23756
|
-
function FromUndefined5(schema, references, value) {
|
|
23757
|
-
return TryConvertUndefined(value);
|
|
23758
|
-
}
|
|
23759
|
-
function FromUnion16(schema, references, value) {
|
|
23760
|
-
for (const subschema of schema.anyOf) {
|
|
23761
|
-
if (Check(subschema, references, value)) {
|
|
23762
|
-
return value;
|
|
23763
|
-
}
|
|
23764
|
-
}
|
|
23765
|
-
for (const subschema of schema.anyOf) {
|
|
23766
|
-
const converted = Visit10(subschema, references, Clone2(value));
|
|
23767
|
-
if (!Check(subschema, references, converted))
|
|
23768
|
-
continue;
|
|
23769
|
-
return converted;
|
|
23770
|
-
}
|
|
23771
|
-
return value;
|
|
23772
|
-
}
|
|
23773
|
-
function Visit10(schema, references, value) {
|
|
23774
|
-
const references_ = Pushref(schema, references);
|
|
23775
|
-
const schema_ = schema;
|
|
23776
|
-
switch (schema[Kind]) {
|
|
23777
|
-
case "Array":
|
|
23778
|
-
return FromArray13(schema_, references_, value);
|
|
23779
|
-
case "BigInt":
|
|
23780
|
-
return FromBigInt5(schema_, references_, value);
|
|
23781
|
-
case "Boolean":
|
|
23782
|
-
return FromBoolean5(schema_, references_, value);
|
|
23783
|
-
case "Date":
|
|
23784
|
-
return FromDate6(schema_, references_, value);
|
|
23785
|
-
case "Import":
|
|
23786
|
-
return FromImport6(schema_, references_, value);
|
|
23787
|
-
case "Integer":
|
|
23788
|
-
return FromInteger5(schema_, references_, value);
|
|
23789
|
-
case "Intersect":
|
|
23790
|
-
return FromIntersect14(schema_, references_, value);
|
|
23791
|
-
case "Literal":
|
|
23792
|
-
return FromLiteral6(schema_, references_, value);
|
|
23793
|
-
case "Null":
|
|
23794
|
-
return FromNull5(schema_, references_, value);
|
|
23795
|
-
case "Number":
|
|
23796
|
-
return FromNumber5(schema_, references_, value);
|
|
23797
|
-
case "Object":
|
|
23798
|
-
return FromObject14(schema_, references_, value);
|
|
23799
|
-
case "Record":
|
|
23800
|
-
return FromRecord9(schema_, references_, value);
|
|
23801
|
-
case "Ref":
|
|
23802
|
-
return FromRef10(schema_, references_, value);
|
|
23803
|
-
case "String":
|
|
23804
|
-
return FromString5(schema_, references_, value);
|
|
23805
|
-
case "Symbol":
|
|
23806
|
-
return FromSymbol5(schema_, references_, value);
|
|
23807
|
-
case "This":
|
|
23808
|
-
return FromThis6(schema_, references_, value);
|
|
23809
|
-
case "Tuple":
|
|
23810
|
-
return FromTuple11(schema_, references_, value);
|
|
23811
|
-
case "Undefined":
|
|
23812
|
-
return FromUndefined5(schema_, references_, value);
|
|
23813
|
-
case "Union":
|
|
23814
|
-
return FromUnion16(schema_, references_, value);
|
|
23815
|
-
default:
|
|
23816
|
-
return Default2(value);
|
|
23817
|
-
}
|
|
23818
|
-
}
|
|
23819
|
-
function Convert(...args) {
|
|
23820
|
-
return args.length === 3 ? Visit10(args[0], args[1], args[2]) : Visit10(args[0], [], args[1]);
|
|
23821
|
-
}
|
|
23822
|
-
// node_modules/@sinclair/typebox/build/esm/value/transform/decode.mjs
|
|
23823
|
-
class TransformDecodeCheckError extends TypeBoxError {
|
|
23824
|
-
constructor(schema, value, error) {
|
|
23825
|
-
super(`Unable to decode value as it does not match the expected schema`);
|
|
23826
|
-
this.schema = schema;
|
|
23827
|
-
this.value = value;
|
|
23828
|
-
this.error = error;
|
|
23829
|
-
}
|
|
23830
|
-
}
|
|
23831
|
-
|
|
23832
|
-
class TransformDecodeError extends TypeBoxError {
|
|
23833
|
-
constructor(schema, path, value, error) {
|
|
23834
|
-
super(error instanceof Error ? error.message : "Unknown error");
|
|
23835
|
-
this.schema = schema;
|
|
23836
|
-
this.path = path;
|
|
23837
|
-
this.value = value;
|
|
23838
|
-
this.error = error;
|
|
23839
|
-
}
|
|
23840
|
-
}
|
|
23841
|
-
function Default3(schema, path, value) {
|
|
23842
|
-
try {
|
|
23843
|
-
return IsTransform(schema) ? schema[TransformKind].Decode(value) : value;
|
|
23844
|
-
} catch (error) {
|
|
23845
|
-
throw new TransformDecodeError(schema, path, value, error);
|
|
23846
|
-
}
|
|
23847
|
-
}
|
|
23848
|
-
function FromArray14(schema, references, path, value) {
|
|
23849
|
-
return IsArray2(value) ? Default3(schema, path, value.map((value2, index) => Visit11(schema.items, references, `${path}/${index}`, value2))) : Default3(schema, path, value);
|
|
23850
|
-
}
|
|
23851
|
-
function FromIntersect15(schema, references, path, value) {
|
|
23852
|
-
if (!IsObject2(value) || IsValueType(value))
|
|
23853
|
-
return Default3(schema, path, value);
|
|
23854
|
-
const knownEntries = KeyOfPropertyEntries(schema);
|
|
23855
|
-
const knownKeys = knownEntries.map((entry) => entry[0]);
|
|
23856
|
-
const knownProperties = { ...value };
|
|
23857
|
-
for (const [knownKey, knownSchema] of knownEntries)
|
|
23858
|
-
if (knownKey in knownProperties) {
|
|
23859
|
-
knownProperties[knownKey] = Visit11(knownSchema, references, `${path}/${knownKey}`, knownProperties[knownKey]);
|
|
23860
|
-
}
|
|
23861
|
-
if (!IsTransform(schema.unevaluatedProperties)) {
|
|
23862
|
-
return Default3(schema, path, knownProperties);
|
|
23863
|
-
}
|
|
23864
|
-
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
23865
|
-
const unevaluatedProperties = schema.unevaluatedProperties;
|
|
23866
|
-
const unknownProperties = { ...knownProperties };
|
|
23867
|
-
for (const key of unknownKeys)
|
|
23868
|
-
if (!knownKeys.includes(key)) {
|
|
23869
|
-
unknownProperties[key] = Default3(unevaluatedProperties, `${path}/${key}`, unknownProperties[key]);
|
|
23870
|
-
}
|
|
23871
|
-
return Default3(schema, path, unknownProperties);
|
|
23872
|
-
}
|
|
23873
|
-
function FromImport7(schema, references, path, value) {
|
|
23874
|
-
const additional = globalThis.Object.values(schema.$defs);
|
|
23875
|
-
const target = schema.$defs[schema.$ref];
|
|
23876
|
-
const result = Visit11(target, [...references, ...additional], path, value);
|
|
23877
|
-
return Default3(schema, path, result);
|
|
23878
|
-
}
|
|
23879
|
-
function FromNot5(schema, references, path, value) {
|
|
23880
|
-
return Default3(schema, path, Visit11(schema.not, references, path, value));
|
|
23881
|
-
}
|
|
23882
|
-
function FromObject15(schema, references, path, value) {
|
|
23883
|
-
if (!IsObject2(value))
|
|
23884
|
-
return Default3(schema, path, value);
|
|
23885
|
-
const knownKeys = KeyOfPropertyKeys(schema);
|
|
23886
|
-
const knownProperties = { ...value };
|
|
23887
|
-
for (const key of knownKeys) {
|
|
23888
|
-
if (!HasPropertyKey2(knownProperties, key))
|
|
23889
|
-
continue;
|
|
23890
|
-
if (IsUndefined2(knownProperties[key]) && (!IsUndefined3(schema.properties[key]) || TypeSystemPolicy.IsExactOptionalProperty(knownProperties, key)))
|
|
23891
|
-
continue;
|
|
23892
|
-
knownProperties[key] = Visit11(schema.properties[key], references, `${path}/${key}`, knownProperties[key]);
|
|
23893
|
-
}
|
|
23894
|
-
if (!IsSchema(schema.additionalProperties)) {
|
|
23895
|
-
return Default3(schema, path, knownProperties);
|
|
23896
|
-
}
|
|
23897
|
-
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
23898
|
-
const additionalProperties = schema.additionalProperties;
|
|
23899
|
-
const unknownProperties = { ...knownProperties };
|
|
23900
|
-
for (const key of unknownKeys)
|
|
23901
|
-
if (!knownKeys.includes(key)) {
|
|
23902
|
-
unknownProperties[key] = Default3(additionalProperties, `${path}/${key}`, unknownProperties[key]);
|
|
23903
|
-
}
|
|
23904
|
-
return Default3(schema, path, unknownProperties);
|
|
23905
|
-
}
|
|
23906
|
-
function FromRecord10(schema, references, path, value) {
|
|
23907
|
-
if (!IsObject2(value))
|
|
23908
|
-
return Default3(schema, path, value);
|
|
23909
|
-
const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
23910
|
-
const knownKeys = new RegExp(pattern);
|
|
23911
|
-
const knownProperties = { ...value };
|
|
23912
|
-
for (const key of Object.getOwnPropertyNames(value))
|
|
23913
|
-
if (knownKeys.test(key)) {
|
|
23914
|
-
knownProperties[key] = Visit11(schema.patternProperties[pattern], references, `${path}/${key}`, knownProperties[key]);
|
|
23915
|
-
}
|
|
23916
|
-
if (!IsSchema(schema.additionalProperties)) {
|
|
23917
|
-
return Default3(schema, path, knownProperties);
|
|
23918
|
-
}
|
|
23919
|
-
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
23920
|
-
const additionalProperties = schema.additionalProperties;
|
|
23921
|
-
const unknownProperties = { ...knownProperties };
|
|
23922
|
-
for (const key of unknownKeys)
|
|
23923
|
-
if (!knownKeys.test(key)) {
|
|
23924
|
-
unknownProperties[key] = Default3(additionalProperties, `${path}/${key}`, unknownProperties[key]);
|
|
23925
|
-
}
|
|
23926
|
-
return Default3(schema, path, unknownProperties);
|
|
23927
|
-
}
|
|
23928
|
-
function FromRef11(schema, references, path, value) {
|
|
23929
|
-
const target = Deref(schema, references);
|
|
23930
|
-
return Default3(schema, path, Visit11(target, references, path, value));
|
|
23931
|
-
}
|
|
23932
|
-
function FromThis7(schema, references, path, value) {
|
|
23933
|
-
const target = Deref(schema, references);
|
|
23934
|
-
return Default3(schema, path, Visit11(target, references, path, value));
|
|
23935
|
-
}
|
|
23936
|
-
function FromTuple12(schema, references, path, value) {
|
|
23937
|
-
return IsArray2(value) && IsArray2(schema.items) ? Default3(schema, path, schema.items.map((schema2, index) => Visit11(schema2, references, `${path}/${index}`, value[index]))) : Default3(schema, path, value);
|
|
23938
|
-
}
|
|
23939
|
-
function FromUnion17(schema, references, path, value) {
|
|
23940
|
-
for (const subschema of schema.anyOf) {
|
|
23941
|
-
if (!Check(subschema, references, value))
|
|
23942
|
-
continue;
|
|
23943
|
-
const decoded = Visit11(subschema, references, path, value);
|
|
23944
|
-
return Default3(schema, path, decoded);
|
|
23945
|
-
}
|
|
23946
|
-
return Default3(schema, path, value);
|
|
23947
|
-
}
|
|
23948
|
-
function Visit11(schema, references, path, value) {
|
|
23949
|
-
const references_ = Pushref(schema, references);
|
|
23950
|
-
const schema_ = schema;
|
|
23951
|
-
switch (schema[Kind]) {
|
|
23952
|
-
case "Array":
|
|
23953
|
-
return FromArray14(schema_, references_, path, value);
|
|
23954
|
-
case "Import":
|
|
23955
|
-
return FromImport7(schema_, references_, path, value);
|
|
23956
|
-
case "Intersect":
|
|
23957
|
-
return FromIntersect15(schema_, references_, path, value);
|
|
23958
|
-
case "Not":
|
|
23959
|
-
return FromNot5(schema_, references_, path, value);
|
|
23960
|
-
case "Object":
|
|
23961
|
-
return FromObject15(schema_, references_, path, value);
|
|
23962
|
-
case "Record":
|
|
23963
|
-
return FromRecord10(schema_, references_, path, value);
|
|
23964
|
-
case "Ref":
|
|
23965
|
-
return FromRef11(schema_, references_, path, value);
|
|
23966
|
-
case "Symbol":
|
|
23967
|
-
return Default3(schema_, path, value);
|
|
23968
|
-
case "This":
|
|
23969
|
-
return FromThis7(schema_, references_, path, value);
|
|
23970
|
-
case "Tuple":
|
|
23971
|
-
return FromTuple12(schema_, references_, path, value);
|
|
23972
|
-
case "Union":
|
|
23973
|
-
return FromUnion17(schema_, references_, path, value);
|
|
23974
|
-
default:
|
|
23975
|
-
return Default3(schema_, path, value);
|
|
23976
|
-
}
|
|
23977
|
-
}
|
|
23978
|
-
function TransformDecode(schema, references, value) {
|
|
23979
|
-
return Visit11(schema, references, "", value);
|
|
23980
|
-
}
|
|
23981
|
-
|
|
23982
|
-
// node_modules/@sinclair/typebox/build/esm/value/transform/encode.mjs
|
|
23983
|
-
class TransformEncodeCheckError extends TypeBoxError {
|
|
23984
|
-
constructor(schema, value, error) {
|
|
23985
|
-
super(`The encoded value does not match the expected schema`);
|
|
23986
|
-
this.schema = schema;
|
|
23987
|
-
this.value = value;
|
|
23988
|
-
this.error = error;
|
|
23989
|
-
}
|
|
23990
|
-
}
|
|
23991
|
-
|
|
23992
|
-
class TransformEncodeError extends TypeBoxError {
|
|
23993
|
-
constructor(schema, path, value, error) {
|
|
23994
|
-
super(`${error instanceof Error ? error.message : "Unknown error"}`);
|
|
23995
|
-
this.schema = schema;
|
|
23996
|
-
this.path = path;
|
|
23997
|
-
this.value = value;
|
|
23998
|
-
this.error = error;
|
|
23999
|
-
}
|
|
24000
|
-
}
|
|
24001
|
-
function Default4(schema, path, value) {
|
|
24002
|
-
try {
|
|
24003
|
-
return IsTransform(schema) ? schema[TransformKind].Encode(value) : value;
|
|
24004
|
-
} catch (error) {
|
|
24005
|
-
throw new TransformEncodeError(schema, path, value, error);
|
|
24006
|
-
}
|
|
24007
|
-
}
|
|
24008
|
-
function FromArray15(schema, references, path, value) {
|
|
24009
|
-
const defaulted = Default4(schema, path, value);
|
|
24010
|
-
return IsArray2(defaulted) ? defaulted.map((value2, index) => Visit12(schema.items, references, `${path}/${index}`, value2)) : defaulted;
|
|
24011
|
-
}
|
|
24012
|
-
function FromImport8(schema, references, path, value) {
|
|
24013
|
-
const additional = globalThis.Object.values(schema.$defs);
|
|
24014
|
-
const target = schema.$defs[schema.$ref];
|
|
24015
|
-
const result = Default4(schema, path, value);
|
|
24016
|
-
return Visit12(target, [...references, ...additional], path, result);
|
|
24017
|
-
}
|
|
24018
|
-
function FromIntersect16(schema, references, path, value) {
|
|
24019
|
-
const defaulted = Default4(schema, path, value);
|
|
24020
|
-
if (!IsObject2(value) || IsValueType(value))
|
|
24021
|
-
return defaulted;
|
|
24022
|
-
const knownEntries = KeyOfPropertyEntries(schema);
|
|
24023
|
-
const knownKeys = knownEntries.map((entry) => entry[0]);
|
|
24024
|
-
const knownProperties = { ...defaulted };
|
|
24025
|
-
for (const [knownKey, knownSchema] of knownEntries)
|
|
24026
|
-
if (knownKey in knownProperties) {
|
|
24027
|
-
knownProperties[knownKey] = Visit12(knownSchema, references, `${path}/${knownKey}`, knownProperties[knownKey]);
|
|
24028
|
-
}
|
|
24029
|
-
if (!IsTransform(schema.unevaluatedProperties)) {
|
|
24030
|
-
return knownProperties;
|
|
24031
|
-
}
|
|
24032
|
-
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
24033
|
-
const unevaluatedProperties = schema.unevaluatedProperties;
|
|
24034
|
-
const properties = { ...knownProperties };
|
|
24035
|
-
for (const key of unknownKeys)
|
|
24036
|
-
if (!knownKeys.includes(key)) {
|
|
24037
|
-
properties[key] = Default4(unevaluatedProperties, `${path}/${key}`, properties[key]);
|
|
24038
|
-
}
|
|
24039
|
-
return properties;
|
|
24040
|
-
}
|
|
24041
|
-
function FromNot6(schema, references, path, value) {
|
|
24042
|
-
return Default4(schema.not, path, Default4(schema, path, value));
|
|
24043
|
-
}
|
|
24044
|
-
function FromObject16(schema, references, path, value) {
|
|
24045
|
-
const defaulted = Default4(schema, path, value);
|
|
24046
|
-
if (!IsObject2(defaulted))
|
|
24047
|
-
return defaulted;
|
|
24048
|
-
const knownKeys = KeyOfPropertyKeys(schema);
|
|
24049
|
-
const knownProperties = { ...defaulted };
|
|
24050
|
-
for (const key of knownKeys) {
|
|
24051
|
-
if (!HasPropertyKey2(knownProperties, key))
|
|
24052
|
-
continue;
|
|
24053
|
-
if (IsUndefined2(knownProperties[key]) && (!IsUndefined3(schema.properties[key]) || TypeSystemPolicy.IsExactOptionalProperty(knownProperties, key)))
|
|
24054
|
-
continue;
|
|
24055
|
-
knownProperties[key] = Visit12(schema.properties[key], references, `${path}/${key}`, knownProperties[key]);
|
|
24056
|
-
}
|
|
24057
|
-
if (!IsSchema(schema.additionalProperties)) {
|
|
24058
|
-
return knownProperties;
|
|
24059
|
-
}
|
|
24060
|
-
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
24061
|
-
const additionalProperties = schema.additionalProperties;
|
|
24062
|
-
const properties = { ...knownProperties };
|
|
24063
|
-
for (const key of unknownKeys)
|
|
24064
|
-
if (!knownKeys.includes(key)) {
|
|
24065
|
-
properties[key] = Default4(additionalProperties, `${path}/${key}`, properties[key]);
|
|
24066
|
-
}
|
|
24067
|
-
return properties;
|
|
24068
|
-
}
|
|
24069
|
-
function FromRecord11(schema, references, path, value) {
|
|
24070
|
-
const defaulted = Default4(schema, path, value);
|
|
24071
|
-
if (!IsObject2(value))
|
|
24072
|
-
return defaulted;
|
|
24073
|
-
const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
24074
|
-
const knownKeys = new RegExp(pattern);
|
|
24075
|
-
const knownProperties = { ...defaulted };
|
|
24076
|
-
for (const key of Object.getOwnPropertyNames(value))
|
|
24077
|
-
if (knownKeys.test(key)) {
|
|
24078
|
-
knownProperties[key] = Visit12(schema.patternProperties[pattern], references, `${path}/${key}`, knownProperties[key]);
|
|
24079
|
-
}
|
|
24080
|
-
if (!IsSchema(schema.additionalProperties)) {
|
|
24081
|
-
return knownProperties;
|
|
24082
|
-
}
|
|
24083
|
-
const unknownKeys = Object.getOwnPropertyNames(knownProperties);
|
|
24084
|
-
const additionalProperties = schema.additionalProperties;
|
|
24085
|
-
const properties = { ...knownProperties };
|
|
24086
|
-
for (const key of unknownKeys)
|
|
24087
|
-
if (!knownKeys.test(key)) {
|
|
24088
|
-
properties[key] = Default4(additionalProperties, `${path}/${key}`, properties[key]);
|
|
24089
|
-
}
|
|
24090
|
-
return properties;
|
|
24091
|
-
}
|
|
24092
|
-
function FromRef12(schema, references, path, value) {
|
|
24093
|
-
const target = Deref(schema, references);
|
|
24094
|
-
const resolved = Visit12(target, references, path, value);
|
|
24095
|
-
return Default4(schema, path, resolved);
|
|
24096
|
-
}
|
|
24097
|
-
function FromThis8(schema, references, path, value) {
|
|
24098
|
-
const target = Deref(schema, references);
|
|
24099
|
-
const resolved = Visit12(target, references, path, value);
|
|
24100
|
-
return Default4(schema, path, resolved);
|
|
24101
|
-
}
|
|
24102
|
-
function FromTuple13(schema, references, path, value) {
|
|
24103
|
-
const value1 = Default4(schema, path, value);
|
|
24104
|
-
return IsArray2(schema.items) ? schema.items.map((schema2, index) => Visit12(schema2, references, `${path}/${index}`, value1[index])) : [];
|
|
24105
|
-
}
|
|
24106
|
-
function FromUnion18(schema, references, path, value) {
|
|
24107
|
-
for (const subschema of schema.anyOf) {
|
|
24108
|
-
if (!Check(subschema, references, value))
|
|
24109
|
-
continue;
|
|
24110
|
-
const value1 = Visit12(subschema, references, path, value);
|
|
24111
|
-
return Default4(schema, path, value1);
|
|
24112
|
-
}
|
|
24113
|
-
for (const subschema of schema.anyOf) {
|
|
24114
|
-
const value1 = Visit12(subschema, references, path, value);
|
|
24115
|
-
if (!Check(schema, references, value1))
|
|
24116
|
-
continue;
|
|
24117
|
-
return Default4(schema, path, value1);
|
|
24118
|
-
}
|
|
24119
|
-
return Default4(schema, path, value);
|
|
24120
|
-
}
|
|
24121
|
-
function Visit12(schema, references, path, value) {
|
|
24122
|
-
const references_ = Pushref(schema, references);
|
|
24123
|
-
const schema_ = schema;
|
|
24124
|
-
switch (schema[Kind]) {
|
|
24125
|
-
case "Array":
|
|
24126
|
-
return FromArray15(schema_, references_, path, value);
|
|
24127
|
-
case "Import":
|
|
24128
|
-
return FromImport8(schema_, references_, path, value);
|
|
24129
|
-
case "Intersect":
|
|
24130
|
-
return FromIntersect16(schema_, references_, path, value);
|
|
24131
|
-
case "Not":
|
|
24132
|
-
return FromNot6(schema_, references_, path, value);
|
|
24133
|
-
case "Object":
|
|
24134
|
-
return FromObject16(schema_, references_, path, value);
|
|
24135
|
-
case "Record":
|
|
24136
|
-
return FromRecord11(schema_, references_, path, value);
|
|
24137
|
-
case "Ref":
|
|
24138
|
-
return FromRef12(schema_, references_, path, value);
|
|
24139
|
-
case "This":
|
|
24140
|
-
return FromThis8(schema_, references_, path, value);
|
|
24141
|
-
case "Tuple":
|
|
24142
|
-
return FromTuple13(schema_, references_, path, value);
|
|
24143
|
-
case "Union":
|
|
24144
|
-
return FromUnion18(schema_, references_, path, value);
|
|
24145
|
-
default:
|
|
24146
|
-
return Default4(schema_, path, value);
|
|
24147
|
-
}
|
|
24148
|
-
}
|
|
24149
|
-
function TransformEncode(schema, references, value) {
|
|
24150
|
-
return Visit12(schema, references, "", value);
|
|
24151
|
-
}
|
|
24152
|
-
|
|
24153
|
-
// node_modules/@sinclair/typebox/build/esm/value/transform/has.mjs
|
|
24154
|
-
function FromArray16(schema, references) {
|
|
24155
|
-
return IsTransform(schema) || Visit13(schema.items, references);
|
|
24156
|
-
}
|
|
24157
|
-
function FromAsyncIterator7(schema, references) {
|
|
24158
|
-
return IsTransform(schema) || Visit13(schema.items, references);
|
|
24159
|
-
}
|
|
24160
|
-
function FromConstructor8(schema, references) {
|
|
24161
|
-
return IsTransform(schema) || Visit13(schema.returns, references) || schema.parameters.some((schema2) => Visit13(schema2, references));
|
|
24162
|
-
}
|
|
24163
|
-
function FromFunction7(schema, references) {
|
|
24164
|
-
return IsTransform(schema) || Visit13(schema.returns, references) || schema.parameters.some((schema2) => Visit13(schema2, references));
|
|
24165
|
-
}
|
|
24166
|
-
function FromIntersect17(schema, references) {
|
|
24167
|
-
return IsTransform(schema) || IsTransform(schema.unevaluatedProperties) || schema.allOf.some((schema2) => Visit13(schema2, references));
|
|
24168
|
-
}
|
|
24169
|
-
function FromImport9(schema, references) {
|
|
24170
|
-
const additional = globalThis.Object.getOwnPropertyNames(schema.$defs).reduce((result, key) => [...result, schema.$defs[key]], []);
|
|
24171
|
-
const target = schema.$defs[schema.$ref];
|
|
24172
|
-
return IsTransform(schema) || Visit13(target, [...additional, ...references]);
|
|
24173
|
-
}
|
|
24174
|
-
function FromIterator7(schema, references) {
|
|
24175
|
-
return IsTransform(schema) || Visit13(schema.items, references);
|
|
24176
|
-
}
|
|
24177
|
-
function FromNot7(schema, references) {
|
|
24178
|
-
return IsTransform(schema) || Visit13(schema.not, references);
|
|
24179
|
-
}
|
|
24180
|
-
function FromObject17(schema, references) {
|
|
24181
|
-
return IsTransform(schema) || Object.values(schema.properties).some((schema2) => Visit13(schema2, references)) || IsSchema(schema.additionalProperties) && Visit13(schema.additionalProperties, references);
|
|
24182
|
-
}
|
|
24183
|
-
function FromPromise7(schema, references) {
|
|
24184
|
-
return IsTransform(schema) || Visit13(schema.item, references);
|
|
24185
|
-
}
|
|
24186
|
-
function FromRecord12(schema, references) {
|
|
24187
|
-
const pattern = Object.getOwnPropertyNames(schema.patternProperties)[0];
|
|
24188
|
-
const property = schema.patternProperties[pattern];
|
|
24189
|
-
return IsTransform(schema) || Visit13(property, references) || IsSchema(schema.additionalProperties) && IsTransform(schema.additionalProperties);
|
|
24190
|
-
}
|
|
24191
|
-
function FromRef13(schema, references) {
|
|
24192
|
-
if (IsTransform(schema))
|
|
24193
|
-
return true;
|
|
24194
|
-
return Visit13(Deref(schema, references), references);
|
|
24195
|
-
}
|
|
24196
|
-
function FromThis9(schema, references) {
|
|
24197
|
-
if (IsTransform(schema))
|
|
24198
|
-
return true;
|
|
24199
|
-
return Visit13(Deref(schema, references), references);
|
|
24200
|
-
}
|
|
24201
|
-
function FromTuple14(schema, references) {
|
|
24202
|
-
return IsTransform(schema) || !IsUndefined2(schema.items) && schema.items.some((schema2) => Visit13(schema2, references));
|
|
24203
|
-
}
|
|
24204
|
-
function FromUnion19(schema, references) {
|
|
24205
|
-
return IsTransform(schema) || schema.anyOf.some((schema2) => Visit13(schema2, references));
|
|
24206
|
-
}
|
|
24207
|
-
function Visit13(schema, references) {
|
|
22879
|
+
function Visit8(schema, references) {
|
|
24208
22880
|
const references_ = Pushref(schema, references);
|
|
24209
22881
|
const schema_ = schema;
|
|
24210
22882
|
if (schema.$id && visited.has(schema.$id))
|
|
@@ -24213,35 +22885,35 @@ function Visit13(schema, references) {
|
|
|
24213
22885
|
visited.add(schema.$id);
|
|
24214
22886
|
switch (schema[Kind]) {
|
|
24215
22887
|
case "Array":
|
|
24216
|
-
return
|
|
22888
|
+
return FromArray10(schema_, references_);
|
|
24217
22889
|
case "AsyncIterator":
|
|
24218
|
-
return
|
|
22890
|
+
return FromAsyncIterator6(schema_, references_);
|
|
24219
22891
|
case "Constructor":
|
|
24220
|
-
return
|
|
22892
|
+
return FromConstructor6(schema_, references_);
|
|
24221
22893
|
case "Function":
|
|
24222
|
-
return
|
|
22894
|
+
return FromFunction6(schema_, references_);
|
|
24223
22895
|
case "Import":
|
|
24224
|
-
return
|
|
22896
|
+
return FromImport4(schema_, references_);
|
|
24225
22897
|
case "Intersect":
|
|
24226
|
-
return
|
|
22898
|
+
return FromIntersect12(schema_, references_);
|
|
24227
22899
|
case "Iterator":
|
|
24228
|
-
return
|
|
22900
|
+
return FromIterator6(schema_, references_);
|
|
24229
22901
|
case "Not":
|
|
24230
|
-
return
|
|
22902
|
+
return FromNot5(schema_, references_);
|
|
24231
22903
|
case "Object":
|
|
24232
|
-
return
|
|
22904
|
+
return FromObject11(schema_, references_);
|
|
24233
22905
|
case "Promise":
|
|
24234
|
-
return
|
|
22906
|
+
return FromPromise6(schema_, references_);
|
|
24235
22907
|
case "Record":
|
|
24236
|
-
return
|
|
22908
|
+
return FromRecord7(schema_, references_);
|
|
24237
22909
|
case "Ref":
|
|
24238
|
-
return
|
|
22910
|
+
return FromRef8(schema_, references_);
|
|
24239
22911
|
case "This":
|
|
24240
|
-
return
|
|
22912
|
+
return FromThis4(schema_, references_);
|
|
24241
22913
|
case "Tuple":
|
|
24242
|
-
return
|
|
22914
|
+
return FromTuple9(schema_, references_);
|
|
24243
22915
|
case "Union":
|
|
24244
|
-
return
|
|
22916
|
+
return FromUnion14(schema_, references_);
|
|
24245
22917
|
default:
|
|
24246
22918
|
return IsTransform(schema);
|
|
24247
22919
|
}
|
|
@@ -24249,7 +22921,7 @@ function Visit13(schema, references) {
|
|
|
24249
22921
|
var visited = new Set;
|
|
24250
22922
|
function HasTransform(schema, references) {
|
|
24251
22923
|
visited.clear();
|
|
24252
|
-
return
|
|
22924
|
+
return Visit8(schema, references);
|
|
24253
22925
|
}
|
|
24254
22926
|
|
|
24255
22927
|
// node_modules/@sinclair/typebox/build/esm/value/decode/decode.mjs
|
|
@@ -24259,596 +22931,12 @@ function Decode(...args) {
|
|
|
24259
22931
|
throw new TransformDecodeCheckError(schema, value, Errors(schema, references, value).First());
|
|
24260
22932
|
return HasTransform(schema, references) ? TransformDecode(schema, references, value) : value;
|
|
24261
22933
|
}
|
|
24262
|
-
// node_modules/@sinclair/typebox/build/esm/value/default/default.mjs
|
|
24263
|
-
function ValueOrDefault(schema, value) {
|
|
24264
|
-
const defaultValue = HasPropertyKey2(schema, "default") ? schema.default : undefined;
|
|
24265
|
-
const clone = IsFunction2(defaultValue) ? defaultValue() : Clone2(defaultValue);
|
|
24266
|
-
return IsUndefined2(value) ? clone : IsObject2(value) && IsObject2(clone) ? Object.assign(clone, value) : value;
|
|
24267
|
-
}
|
|
24268
|
-
function HasDefaultProperty(schema) {
|
|
24269
|
-
return IsKind(schema) && "default" in schema;
|
|
24270
|
-
}
|
|
24271
|
-
function FromArray17(schema, references, value) {
|
|
24272
|
-
if (IsArray2(value)) {
|
|
24273
|
-
for (let i = 0;i < value.length; i++) {
|
|
24274
|
-
value[i] = Visit14(schema.items, references, value[i]);
|
|
24275
|
-
}
|
|
24276
|
-
return value;
|
|
24277
|
-
}
|
|
24278
|
-
const defaulted = ValueOrDefault(schema, value);
|
|
24279
|
-
if (!IsArray2(defaulted))
|
|
24280
|
-
return defaulted;
|
|
24281
|
-
for (let i = 0;i < defaulted.length; i++) {
|
|
24282
|
-
defaulted[i] = Visit14(schema.items, references, defaulted[i]);
|
|
24283
|
-
}
|
|
24284
|
-
return defaulted;
|
|
24285
|
-
}
|
|
24286
|
-
function FromDate7(schema, references, value) {
|
|
24287
|
-
return IsDate2(value) ? value : ValueOrDefault(schema, value);
|
|
24288
|
-
}
|
|
24289
|
-
function FromImport10(schema, references, value) {
|
|
24290
|
-
const definitions = globalThis.Object.values(schema.$defs);
|
|
24291
|
-
const target = schema.$defs[schema.$ref];
|
|
24292
|
-
return Visit14(target, [...references, ...definitions], value);
|
|
24293
|
-
}
|
|
24294
|
-
function FromIntersect18(schema, references, value) {
|
|
24295
|
-
const defaulted = ValueOrDefault(schema, value);
|
|
24296
|
-
return schema.allOf.reduce((acc, schema2) => {
|
|
24297
|
-
const next = Visit14(schema2, references, defaulted);
|
|
24298
|
-
return IsObject2(next) ? { ...acc, ...next } : next;
|
|
24299
|
-
}, {});
|
|
24300
|
-
}
|
|
24301
|
-
function FromObject18(schema, references, value) {
|
|
24302
|
-
const defaulted = ValueOrDefault(schema, value);
|
|
24303
|
-
if (!IsObject2(defaulted))
|
|
24304
|
-
return defaulted;
|
|
24305
|
-
const knownPropertyKeys = Object.getOwnPropertyNames(schema.properties);
|
|
24306
|
-
for (const key of knownPropertyKeys) {
|
|
24307
|
-
const propertyValue = Visit14(schema.properties[key], references, defaulted[key]);
|
|
24308
|
-
if (IsUndefined2(propertyValue))
|
|
24309
|
-
continue;
|
|
24310
|
-
defaulted[key] = Visit14(schema.properties[key], references, defaulted[key]);
|
|
24311
|
-
}
|
|
24312
|
-
if (!HasDefaultProperty(schema.additionalProperties))
|
|
24313
|
-
return defaulted;
|
|
24314
|
-
for (const key of Object.getOwnPropertyNames(defaulted)) {
|
|
24315
|
-
if (knownPropertyKeys.includes(key))
|
|
24316
|
-
continue;
|
|
24317
|
-
defaulted[key] = Visit14(schema.additionalProperties, references, defaulted[key]);
|
|
24318
|
-
}
|
|
24319
|
-
return defaulted;
|
|
24320
|
-
}
|
|
24321
|
-
function FromRecord13(schema, references, value) {
|
|
24322
|
-
const defaulted = ValueOrDefault(schema, value);
|
|
24323
|
-
if (!IsObject2(defaulted))
|
|
24324
|
-
return defaulted;
|
|
24325
|
-
const additionalPropertiesSchema = schema.additionalProperties;
|
|
24326
|
-
const [propertyKeyPattern, propertySchema] = Object.entries(schema.patternProperties)[0];
|
|
24327
|
-
const knownPropertyKey = new RegExp(propertyKeyPattern);
|
|
24328
|
-
for (const key of Object.getOwnPropertyNames(defaulted)) {
|
|
24329
|
-
if (!(knownPropertyKey.test(key) && HasDefaultProperty(propertySchema)))
|
|
24330
|
-
continue;
|
|
24331
|
-
defaulted[key] = Visit14(propertySchema, references, defaulted[key]);
|
|
24332
|
-
}
|
|
24333
|
-
if (!HasDefaultProperty(additionalPropertiesSchema))
|
|
24334
|
-
return defaulted;
|
|
24335
|
-
for (const key of Object.getOwnPropertyNames(defaulted)) {
|
|
24336
|
-
if (knownPropertyKey.test(key))
|
|
24337
|
-
continue;
|
|
24338
|
-
defaulted[key] = Visit14(additionalPropertiesSchema, references, defaulted[key]);
|
|
24339
|
-
}
|
|
24340
|
-
return defaulted;
|
|
24341
|
-
}
|
|
24342
|
-
function FromRef14(schema, references, value) {
|
|
24343
|
-
return Visit14(Deref(schema, references), references, ValueOrDefault(schema, value));
|
|
24344
|
-
}
|
|
24345
|
-
function FromThis10(schema, references, value) {
|
|
24346
|
-
return Visit14(Deref(schema, references), references, value);
|
|
24347
|
-
}
|
|
24348
|
-
function FromTuple15(schema, references, value) {
|
|
24349
|
-
const defaulted = ValueOrDefault(schema, value);
|
|
24350
|
-
if (!IsArray2(defaulted) || IsUndefined2(schema.items))
|
|
24351
|
-
return defaulted;
|
|
24352
|
-
const [items, max] = [schema.items, Math.max(schema.items.length, defaulted.length)];
|
|
24353
|
-
for (let i = 0;i < max; i++) {
|
|
24354
|
-
if (i < items.length)
|
|
24355
|
-
defaulted[i] = Visit14(items[i], references, defaulted[i]);
|
|
24356
|
-
}
|
|
24357
|
-
return defaulted;
|
|
24358
|
-
}
|
|
24359
|
-
function FromUnion20(schema, references, value) {
|
|
24360
|
-
const defaulted = ValueOrDefault(schema, value);
|
|
24361
|
-
for (const inner of schema.anyOf) {
|
|
24362
|
-
const result = Visit14(inner, references, Clone2(defaulted));
|
|
24363
|
-
if (Check(inner, references, result)) {
|
|
24364
|
-
return result;
|
|
24365
|
-
}
|
|
24366
|
-
}
|
|
24367
|
-
return defaulted;
|
|
24368
|
-
}
|
|
24369
|
-
function Visit14(schema, references, value) {
|
|
24370
|
-
const references_ = Pushref(schema, references);
|
|
24371
|
-
const schema_ = schema;
|
|
24372
|
-
switch (schema_[Kind]) {
|
|
24373
|
-
case "Array":
|
|
24374
|
-
return FromArray17(schema_, references_, value);
|
|
24375
|
-
case "Date":
|
|
24376
|
-
return FromDate7(schema_, references_, value);
|
|
24377
|
-
case "Import":
|
|
24378
|
-
return FromImport10(schema_, references_, value);
|
|
24379
|
-
case "Intersect":
|
|
24380
|
-
return FromIntersect18(schema_, references_, value);
|
|
24381
|
-
case "Object":
|
|
24382
|
-
return FromObject18(schema_, references_, value);
|
|
24383
|
-
case "Record":
|
|
24384
|
-
return FromRecord13(schema_, references_, value);
|
|
24385
|
-
case "Ref":
|
|
24386
|
-
return FromRef14(schema_, references_, value);
|
|
24387
|
-
case "This":
|
|
24388
|
-
return FromThis10(schema_, references_, value);
|
|
24389
|
-
case "Tuple":
|
|
24390
|
-
return FromTuple15(schema_, references_, value);
|
|
24391
|
-
case "Union":
|
|
24392
|
-
return FromUnion20(schema_, references_, value);
|
|
24393
|
-
default:
|
|
24394
|
-
return ValueOrDefault(schema_, value);
|
|
24395
|
-
}
|
|
24396
|
-
}
|
|
24397
|
-
function Default5(...args) {
|
|
24398
|
-
return args.length === 3 ? Visit14(args[0], args[1], args[2]) : Visit14(args[0], [], args[1]);
|
|
24399
|
-
}
|
|
24400
|
-
// node_modules/@sinclair/typebox/build/esm/value/pointer/pointer.mjs
|
|
24401
|
-
var exports_pointer = {};
|
|
24402
|
-
__export(exports_pointer, {
|
|
24403
|
-
Delete: () => Delete3,
|
|
24404
|
-
Format: () => Format,
|
|
24405
|
-
Get: () => Get3,
|
|
24406
|
-
Has: () => Has3,
|
|
24407
|
-
Set: () => Set4,
|
|
24408
|
-
ValuePointerRootDeleteError: () => ValuePointerRootDeleteError,
|
|
24409
|
-
ValuePointerRootSetError: () => ValuePointerRootSetError
|
|
24410
|
-
});
|
|
24411
|
-
class ValuePointerRootSetError extends TypeBoxError {
|
|
24412
|
-
constructor(value, path, update) {
|
|
24413
|
-
super("Cannot set root value");
|
|
24414
|
-
this.value = value;
|
|
24415
|
-
this.path = path;
|
|
24416
|
-
this.update = update;
|
|
24417
|
-
}
|
|
24418
|
-
}
|
|
24419
|
-
|
|
24420
|
-
class ValuePointerRootDeleteError extends TypeBoxError {
|
|
24421
|
-
constructor(value, path) {
|
|
24422
|
-
super("Cannot delete root value");
|
|
24423
|
-
this.value = value;
|
|
24424
|
-
this.path = path;
|
|
24425
|
-
}
|
|
24426
|
-
}
|
|
24427
|
-
function Escape2(component) {
|
|
24428
|
-
return component.indexOf("~") === -1 ? component : component.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
24429
|
-
}
|
|
24430
|
-
function* Format(pointer) {
|
|
24431
|
-
if (pointer === "")
|
|
24432
|
-
return;
|
|
24433
|
-
let [start, end] = [0, 0];
|
|
24434
|
-
for (let i = 0;i < pointer.length; i++) {
|
|
24435
|
-
const char = pointer.charAt(i);
|
|
24436
|
-
if (char === "/") {
|
|
24437
|
-
if (i === 0) {
|
|
24438
|
-
start = i + 1;
|
|
24439
|
-
} else {
|
|
24440
|
-
end = i;
|
|
24441
|
-
yield Escape2(pointer.slice(start, end));
|
|
24442
|
-
start = i + 1;
|
|
24443
|
-
}
|
|
24444
|
-
} else {
|
|
24445
|
-
end = i;
|
|
24446
|
-
}
|
|
24447
|
-
}
|
|
24448
|
-
yield Escape2(pointer.slice(start));
|
|
24449
|
-
}
|
|
24450
|
-
function Set4(value, pointer, update) {
|
|
24451
|
-
if (pointer === "")
|
|
24452
|
-
throw new ValuePointerRootSetError(value, pointer, update);
|
|
24453
|
-
let [owner, next, key] = [null, value, ""];
|
|
24454
|
-
for (const component of Format(pointer)) {
|
|
24455
|
-
if (next[component] === undefined)
|
|
24456
|
-
next[component] = {};
|
|
24457
|
-
owner = next;
|
|
24458
|
-
next = next[component];
|
|
24459
|
-
key = component;
|
|
24460
|
-
}
|
|
24461
|
-
owner[key] = update;
|
|
24462
|
-
}
|
|
24463
|
-
function Delete3(value, pointer) {
|
|
24464
|
-
if (pointer === "")
|
|
24465
|
-
throw new ValuePointerRootDeleteError(value, pointer);
|
|
24466
|
-
let [owner, next, key] = [null, value, ""];
|
|
24467
|
-
for (const component of Format(pointer)) {
|
|
24468
|
-
if (next[component] === undefined || next[component] === null)
|
|
24469
|
-
return;
|
|
24470
|
-
owner = next;
|
|
24471
|
-
next = next[component];
|
|
24472
|
-
key = component;
|
|
24473
|
-
}
|
|
24474
|
-
if (Array.isArray(owner)) {
|
|
24475
|
-
const index = parseInt(key);
|
|
24476
|
-
owner.splice(index, 1);
|
|
24477
|
-
} else {
|
|
24478
|
-
delete owner[key];
|
|
24479
|
-
}
|
|
24480
|
-
}
|
|
24481
|
-
function Has3(value, pointer) {
|
|
24482
|
-
if (pointer === "")
|
|
24483
|
-
return true;
|
|
24484
|
-
let [owner, next, key] = [null, value, ""];
|
|
24485
|
-
for (const component of Format(pointer)) {
|
|
24486
|
-
if (next[component] === undefined)
|
|
24487
|
-
return false;
|
|
24488
|
-
owner = next;
|
|
24489
|
-
next = next[component];
|
|
24490
|
-
key = component;
|
|
24491
|
-
}
|
|
24492
|
-
return Object.getOwnPropertyNames(owner).includes(key);
|
|
24493
|
-
}
|
|
24494
|
-
function Get3(value, pointer) {
|
|
24495
|
-
if (pointer === "")
|
|
24496
|
-
return value;
|
|
24497
|
-
let current = value;
|
|
24498
|
-
for (const component of Format(pointer)) {
|
|
24499
|
-
if (current[component] === undefined)
|
|
24500
|
-
return;
|
|
24501
|
-
current = current[component];
|
|
24502
|
-
}
|
|
24503
|
-
return current;
|
|
24504
|
-
}
|
|
24505
|
-
// node_modules/@sinclair/typebox/build/esm/value/equal/equal.mjs
|
|
24506
|
-
function ObjectType3(left, right) {
|
|
24507
|
-
if (!IsObject2(right))
|
|
24508
|
-
return false;
|
|
24509
|
-
const leftKeys = [...Object.keys(left), ...Object.getOwnPropertySymbols(left)];
|
|
24510
|
-
const rightKeys = [...Object.keys(right), ...Object.getOwnPropertySymbols(right)];
|
|
24511
|
-
if (leftKeys.length !== rightKeys.length)
|
|
24512
|
-
return false;
|
|
24513
|
-
return leftKeys.every((key) => Equal(left[key], right[key]));
|
|
24514
|
-
}
|
|
24515
|
-
function DateType3(left, right) {
|
|
24516
|
-
return IsDate2(right) && left.getTime() === right.getTime();
|
|
24517
|
-
}
|
|
24518
|
-
function ArrayType3(left, right) {
|
|
24519
|
-
if (!IsArray2(right) || left.length !== right.length)
|
|
24520
|
-
return false;
|
|
24521
|
-
return left.every((value, index) => Equal(value, right[index]));
|
|
24522
|
-
}
|
|
24523
|
-
function TypedArrayType(left, right) {
|
|
24524
|
-
if (!IsTypedArray(right) || left.length !== right.length || Object.getPrototypeOf(left).constructor.name !== Object.getPrototypeOf(right).constructor.name)
|
|
24525
|
-
return false;
|
|
24526
|
-
return left.every((value, index) => Equal(value, right[index]));
|
|
24527
|
-
}
|
|
24528
|
-
function ValueType(left, right) {
|
|
24529
|
-
return left === right;
|
|
24530
|
-
}
|
|
24531
|
-
function Equal(left, right) {
|
|
24532
|
-
if (IsDate2(left))
|
|
24533
|
-
return DateType3(left, right);
|
|
24534
|
-
if (IsTypedArray(left))
|
|
24535
|
-
return TypedArrayType(left, right);
|
|
24536
|
-
if (IsArray2(left))
|
|
24537
|
-
return ArrayType3(left, right);
|
|
24538
|
-
if (IsObject2(left))
|
|
24539
|
-
return ObjectType3(left, right);
|
|
24540
|
-
if (IsValueType(left))
|
|
24541
|
-
return ValueType(left, right);
|
|
24542
|
-
throw new Error("ValueEquals: Unable to compare value");
|
|
24543
|
-
}
|
|
24544
|
-
|
|
24545
|
-
// node_modules/@sinclair/typebox/build/esm/value/delta/delta.mjs
|
|
24546
|
-
var Insert = Object2({
|
|
24547
|
-
type: Literal("insert"),
|
|
24548
|
-
path: String2(),
|
|
24549
|
-
value: Unknown()
|
|
24550
|
-
});
|
|
24551
|
-
var Update = Object2({
|
|
24552
|
-
type: Literal("update"),
|
|
24553
|
-
path: String2(),
|
|
24554
|
-
value: Unknown()
|
|
24555
|
-
});
|
|
24556
|
-
var Delete4 = Object2({
|
|
24557
|
-
type: Literal("delete"),
|
|
24558
|
-
path: String2()
|
|
24559
|
-
});
|
|
24560
|
-
var Edit = Union([Insert, Update, Delete4]);
|
|
24561
|
-
|
|
24562
|
-
class ValueDiffError extends TypeBoxError {
|
|
24563
|
-
constructor(value, message) {
|
|
24564
|
-
super(message);
|
|
24565
|
-
this.value = value;
|
|
24566
|
-
}
|
|
24567
|
-
}
|
|
24568
|
-
function CreateUpdate(path, value) {
|
|
24569
|
-
return { type: "update", path, value };
|
|
24570
|
-
}
|
|
24571
|
-
function CreateInsert(path, value) {
|
|
24572
|
-
return { type: "insert", path, value };
|
|
24573
|
-
}
|
|
24574
|
-
function CreateDelete(path) {
|
|
24575
|
-
return { type: "delete", path };
|
|
24576
|
-
}
|
|
24577
|
-
function AssertDiffable(value) {
|
|
24578
|
-
if (globalThis.Object.getOwnPropertySymbols(value).length > 0)
|
|
24579
|
-
throw new ValueDiffError(value, "Cannot diff objects with symbols");
|
|
24580
|
-
}
|
|
24581
|
-
function* ObjectType4(path, current, next) {
|
|
24582
|
-
AssertDiffable(current);
|
|
24583
|
-
AssertDiffable(next);
|
|
24584
|
-
if (!IsStandardObject(next))
|
|
24585
|
-
return yield CreateUpdate(path, next);
|
|
24586
|
-
const currentKeys = globalThis.Object.getOwnPropertyNames(current);
|
|
24587
|
-
const nextKeys = globalThis.Object.getOwnPropertyNames(next);
|
|
24588
|
-
for (const key of nextKeys) {
|
|
24589
|
-
if (HasPropertyKey2(current, key))
|
|
24590
|
-
continue;
|
|
24591
|
-
yield CreateInsert(`${path}/${key}`, next[key]);
|
|
24592
|
-
}
|
|
24593
|
-
for (const key of currentKeys) {
|
|
24594
|
-
if (!HasPropertyKey2(next, key))
|
|
24595
|
-
continue;
|
|
24596
|
-
if (Equal(current, next))
|
|
24597
|
-
continue;
|
|
24598
|
-
yield* Visit15(`${path}/${key}`, current[key], next[key]);
|
|
24599
|
-
}
|
|
24600
|
-
for (const key of currentKeys) {
|
|
24601
|
-
if (HasPropertyKey2(next, key))
|
|
24602
|
-
continue;
|
|
24603
|
-
yield CreateDelete(`${path}/${key}`);
|
|
24604
|
-
}
|
|
24605
|
-
}
|
|
24606
|
-
function* ArrayType4(path, current, next) {
|
|
24607
|
-
if (!IsArray2(next))
|
|
24608
|
-
return yield CreateUpdate(path, next);
|
|
24609
|
-
for (let i = 0;i < Math.min(current.length, next.length); i++) {
|
|
24610
|
-
yield* Visit15(`${path}/${i}`, current[i], next[i]);
|
|
24611
|
-
}
|
|
24612
|
-
for (let i = 0;i < next.length; i++) {
|
|
24613
|
-
if (i < current.length)
|
|
24614
|
-
continue;
|
|
24615
|
-
yield CreateInsert(`${path}/${i}`, next[i]);
|
|
24616
|
-
}
|
|
24617
|
-
for (let i = current.length - 1;i >= 0; i--) {
|
|
24618
|
-
if (i < next.length)
|
|
24619
|
-
continue;
|
|
24620
|
-
yield CreateDelete(`${path}/${i}`);
|
|
24621
|
-
}
|
|
24622
|
-
}
|
|
24623
|
-
function* TypedArrayType2(path, current, next) {
|
|
24624
|
-
if (!IsTypedArray(next) || current.length !== next.length || globalThis.Object.getPrototypeOf(current).constructor.name !== globalThis.Object.getPrototypeOf(next).constructor.name)
|
|
24625
|
-
return yield CreateUpdate(path, next);
|
|
24626
|
-
for (let i = 0;i < Math.min(current.length, next.length); i++) {
|
|
24627
|
-
yield* Visit15(`${path}/${i}`, current[i], next[i]);
|
|
24628
|
-
}
|
|
24629
|
-
}
|
|
24630
|
-
function* ValueType2(path, current, next) {
|
|
24631
|
-
if (current === next)
|
|
24632
|
-
return;
|
|
24633
|
-
yield CreateUpdate(path, next);
|
|
24634
|
-
}
|
|
24635
|
-
function* Visit15(path, current, next) {
|
|
24636
|
-
if (IsStandardObject(current))
|
|
24637
|
-
return yield* ObjectType4(path, current, next);
|
|
24638
|
-
if (IsArray2(current))
|
|
24639
|
-
return yield* ArrayType4(path, current, next);
|
|
24640
|
-
if (IsTypedArray(current))
|
|
24641
|
-
return yield* TypedArrayType2(path, current, next);
|
|
24642
|
-
if (IsValueType(current))
|
|
24643
|
-
return yield* ValueType2(path, current, next);
|
|
24644
|
-
throw new ValueDiffError(current, "Unable to diff value");
|
|
24645
|
-
}
|
|
24646
|
-
function Diff(current, next) {
|
|
24647
|
-
return [...Visit15("", current, next)];
|
|
24648
|
-
}
|
|
24649
|
-
function IsRootUpdate(edits) {
|
|
24650
|
-
return edits.length > 0 && edits[0].path === "" && edits[0].type === "update";
|
|
24651
|
-
}
|
|
24652
|
-
function IsIdentity(edits) {
|
|
24653
|
-
return edits.length === 0;
|
|
24654
|
-
}
|
|
24655
|
-
function Patch(current, edits) {
|
|
24656
|
-
if (IsRootUpdate(edits)) {
|
|
24657
|
-
return Clone2(edits[0].value);
|
|
24658
|
-
}
|
|
24659
|
-
if (IsIdentity(edits)) {
|
|
24660
|
-
return Clone2(current);
|
|
24661
|
-
}
|
|
24662
|
-
const clone = Clone2(current);
|
|
24663
|
-
for (const edit of edits) {
|
|
24664
|
-
switch (edit.type) {
|
|
24665
|
-
case "insert": {
|
|
24666
|
-
exports_pointer.Set(clone, edit.path, edit.value);
|
|
24667
|
-
break;
|
|
24668
|
-
}
|
|
24669
|
-
case "update": {
|
|
24670
|
-
exports_pointer.Set(clone, edit.path, edit.value);
|
|
24671
|
-
break;
|
|
24672
|
-
}
|
|
24673
|
-
case "delete": {
|
|
24674
|
-
exports_pointer.Delete(clone, edit.path);
|
|
24675
|
-
break;
|
|
24676
|
-
}
|
|
24677
|
-
}
|
|
24678
|
-
}
|
|
24679
|
-
return clone;
|
|
24680
|
-
}
|
|
24681
|
-
// node_modules/@sinclair/typebox/build/esm/value/encode/encode.mjs
|
|
24682
|
-
function Encode(...args) {
|
|
24683
|
-
const [schema, references, value] = args.length === 3 ? [args[0], args[1], args[2]] : [args[0], [], args[1]];
|
|
24684
|
-
const encoded = HasTransform(schema, references) ? TransformEncode(schema, references, value) : value;
|
|
24685
|
-
if (!Check(schema, references, encoded))
|
|
24686
|
-
throw new TransformEncodeCheckError(schema, encoded, Errors(schema, references, encoded).First());
|
|
24687
|
-
return encoded;
|
|
24688
|
-
}
|
|
24689
|
-
// node_modules/@sinclair/typebox/build/esm/value/mutate/mutate.mjs
|
|
24690
|
-
function IsStandardObject2(value) {
|
|
24691
|
-
return IsObject2(value) && !IsArray2(value);
|
|
24692
|
-
}
|
|
24693
|
-
|
|
24694
|
-
class ValueMutateError extends TypeBoxError {
|
|
24695
|
-
constructor(message) {
|
|
24696
|
-
super(message);
|
|
24697
|
-
}
|
|
24698
|
-
}
|
|
24699
|
-
function ObjectType5(root, path, current, next) {
|
|
24700
|
-
if (!IsStandardObject2(current)) {
|
|
24701
|
-
exports_pointer.Set(root, path, Clone2(next));
|
|
24702
|
-
} else {
|
|
24703
|
-
const currentKeys = Object.getOwnPropertyNames(current);
|
|
24704
|
-
const nextKeys = Object.getOwnPropertyNames(next);
|
|
24705
|
-
for (const currentKey of currentKeys) {
|
|
24706
|
-
if (!nextKeys.includes(currentKey)) {
|
|
24707
|
-
delete current[currentKey];
|
|
24708
|
-
}
|
|
24709
|
-
}
|
|
24710
|
-
for (const nextKey of nextKeys) {
|
|
24711
|
-
if (!currentKeys.includes(nextKey)) {
|
|
24712
|
-
current[nextKey] = null;
|
|
24713
|
-
}
|
|
24714
|
-
}
|
|
24715
|
-
for (const nextKey of nextKeys) {
|
|
24716
|
-
Visit16(root, `${path}/${nextKey}`, current[nextKey], next[nextKey]);
|
|
24717
|
-
}
|
|
24718
|
-
}
|
|
24719
|
-
}
|
|
24720
|
-
function ArrayType5(root, path, current, next) {
|
|
24721
|
-
if (!IsArray2(current)) {
|
|
24722
|
-
exports_pointer.Set(root, path, Clone2(next));
|
|
24723
|
-
} else {
|
|
24724
|
-
for (let index = 0;index < next.length; index++) {
|
|
24725
|
-
Visit16(root, `${path}/${index}`, current[index], next[index]);
|
|
24726
|
-
}
|
|
24727
|
-
current.splice(next.length);
|
|
24728
|
-
}
|
|
24729
|
-
}
|
|
24730
|
-
function TypedArrayType3(root, path, current, next) {
|
|
24731
|
-
if (IsTypedArray(current) && current.length === next.length) {
|
|
24732
|
-
for (let i = 0;i < current.length; i++) {
|
|
24733
|
-
current[i] = next[i];
|
|
24734
|
-
}
|
|
24735
|
-
} else {
|
|
24736
|
-
exports_pointer.Set(root, path, Clone2(next));
|
|
24737
|
-
}
|
|
24738
|
-
}
|
|
24739
|
-
function ValueType3(root, path, current, next) {
|
|
24740
|
-
if (current === next)
|
|
24741
|
-
return;
|
|
24742
|
-
exports_pointer.Set(root, path, next);
|
|
24743
|
-
}
|
|
24744
|
-
function Visit16(root, path, current, next) {
|
|
24745
|
-
if (IsArray2(next))
|
|
24746
|
-
return ArrayType5(root, path, current, next);
|
|
24747
|
-
if (IsTypedArray(next))
|
|
24748
|
-
return TypedArrayType3(root, path, current, next);
|
|
24749
|
-
if (IsStandardObject2(next))
|
|
24750
|
-
return ObjectType5(root, path, current, next);
|
|
24751
|
-
if (IsValueType(next))
|
|
24752
|
-
return ValueType3(root, path, current, next);
|
|
24753
|
-
}
|
|
24754
|
-
function IsNonMutableValue(value) {
|
|
24755
|
-
return IsTypedArray(value) || IsValueType(value);
|
|
24756
|
-
}
|
|
24757
|
-
function IsMismatchedValue(current, next) {
|
|
24758
|
-
return IsStandardObject2(current) && IsArray2(next) || IsArray2(current) && IsStandardObject2(next);
|
|
24759
|
-
}
|
|
24760
|
-
function Mutate(current, next) {
|
|
24761
|
-
if (IsNonMutableValue(current) || IsNonMutableValue(next))
|
|
24762
|
-
throw new ValueMutateError("Only object and array types can be mutated at the root level");
|
|
24763
|
-
if (IsMismatchedValue(current, next))
|
|
24764
|
-
throw new ValueMutateError("Cannot assign due type mismatch of assignable values");
|
|
24765
|
-
Visit16(current, "", current, next);
|
|
24766
|
-
}
|
|
24767
|
-
// node_modules/@sinclair/typebox/build/esm/value/parse/parse.mjs
|
|
24768
|
-
class ParseError extends TypeBoxError {
|
|
24769
|
-
constructor(message) {
|
|
24770
|
-
super(message);
|
|
24771
|
-
}
|
|
24772
|
-
}
|
|
24773
|
-
var ParseRegistry;
|
|
24774
|
-
(function(ParseRegistry2) {
|
|
24775
|
-
const registry = new Map([
|
|
24776
|
-
["Assert", (type, references, value) => {
|
|
24777
|
-
Assert(type, references, value);
|
|
24778
|
-
return value;
|
|
24779
|
-
}],
|
|
24780
|
-
["Cast", (type, references, value) => Cast(type, references, value)],
|
|
24781
|
-
["Clean", (type, references, value) => Clean(type, references, value)],
|
|
24782
|
-
["Clone", (_type, _references, value) => Clone2(value)],
|
|
24783
|
-
["Convert", (type, references, value) => Convert(type, references, value)],
|
|
24784
|
-
["Decode", (type, references, value) => HasTransform(type, references) ? TransformDecode(type, references, value) : value],
|
|
24785
|
-
["Default", (type, references, value) => Default5(type, references, value)],
|
|
24786
|
-
["Encode", (type, references, value) => HasTransform(type, references) ? TransformEncode(type, references, value) : value]
|
|
24787
|
-
]);
|
|
24788
|
-
function Delete5(key) {
|
|
24789
|
-
registry.delete(key);
|
|
24790
|
-
}
|
|
24791
|
-
ParseRegistry2.Delete = Delete5;
|
|
24792
|
-
function Set5(key, callback) {
|
|
24793
|
-
registry.set(key, callback);
|
|
24794
|
-
}
|
|
24795
|
-
ParseRegistry2.Set = Set5;
|
|
24796
|
-
function Get4(key) {
|
|
24797
|
-
return registry.get(key);
|
|
24798
|
-
}
|
|
24799
|
-
ParseRegistry2.Get = Get4;
|
|
24800
|
-
})(ParseRegistry || (ParseRegistry = {}));
|
|
24801
|
-
var ParseDefault = [
|
|
24802
|
-
"Clone",
|
|
24803
|
-
"Clean",
|
|
24804
|
-
"Default",
|
|
24805
|
-
"Convert",
|
|
24806
|
-
"Assert",
|
|
24807
|
-
"Decode"
|
|
24808
|
-
];
|
|
24809
|
-
function ParseValue(operations, type, references, value) {
|
|
24810
|
-
return operations.reduce((value2, operationKey) => {
|
|
24811
|
-
const operation = ParseRegistry.Get(operationKey);
|
|
24812
|
-
if (IsUndefined2(operation))
|
|
24813
|
-
throw new ParseError(`Unable to find Parse operation '${operationKey}'`);
|
|
24814
|
-
return operation(type, references, value2);
|
|
24815
|
-
}, value);
|
|
24816
|
-
}
|
|
24817
|
-
function Parse(...args) {
|
|
24818
|
-
const [operations, schema, references, value] = args.length === 4 ? [args[0], args[1], args[2], args[3]] : args.length === 3 ? IsArray2(args[0]) ? [args[0], args[1], [], args[2]] : [ParseDefault, args[0], args[1], args[2]] : args.length === 2 ? [ParseDefault, args[0], [], args[1]] : (() => {
|
|
24819
|
-
throw new ParseError("Invalid Arguments");
|
|
24820
|
-
})();
|
|
24821
|
-
return ParseValue(operations, schema, references, value);
|
|
24822
|
-
}
|
|
24823
|
-
// node_modules/@sinclair/typebox/build/esm/value/value/value.mjs
|
|
24824
|
-
var exports_value2 = {};
|
|
24825
|
-
__export(exports_value2, {
|
|
24826
|
-
Assert: () => Assert,
|
|
24827
|
-
Cast: () => Cast,
|
|
24828
|
-
Check: () => Check,
|
|
24829
|
-
Clean: () => Clean,
|
|
24830
|
-
Clone: () => Clone2,
|
|
24831
|
-
Convert: () => Convert,
|
|
24832
|
-
Create: () => Create2,
|
|
24833
|
-
Decode: () => Decode,
|
|
24834
|
-
Default: () => Default5,
|
|
24835
|
-
Diff: () => Diff,
|
|
24836
|
-
Edit: () => Edit,
|
|
24837
|
-
Encode: () => Encode,
|
|
24838
|
-
Equal: () => Equal,
|
|
24839
|
-
Errors: () => Errors,
|
|
24840
|
-
Hash: () => Hash,
|
|
24841
|
-
Mutate: () => Mutate,
|
|
24842
|
-
Parse: () => Parse,
|
|
24843
|
-
Patch: () => Patch,
|
|
24844
|
-
ValueErrorIterator: () => ValueErrorIterator
|
|
24845
|
-
});
|
|
24846
22934
|
// src/shared/schema.ts
|
|
24847
22935
|
function schemaErrorPath(path) {
|
|
24848
22936
|
return path.replace(/^\//, "").replaceAll("/", ".") || "args";
|
|
24849
22937
|
}
|
|
24850
22938
|
function schemaErrorLines(schema, input) {
|
|
24851
|
-
return [...
|
|
22939
|
+
return [...Errors(schema, input)].map((issue) => `- ${schemaErrorPath(issue.path)}: ${issue.message}`);
|
|
24852
22940
|
}
|
|
24853
22941
|
function transformErrorLine(error) {
|
|
24854
22942
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -24863,7 +22951,7 @@ function parseToolArguments(schema, input) {
|
|
|
24863
22951
|
${issues.join(`
|
|
24864
22952
|
`)}`);
|
|
24865
22953
|
try {
|
|
24866
|
-
return
|
|
22954
|
+
return Decode(objectSchema, input);
|
|
24867
22955
|
} catch (error) {
|
|
24868
22956
|
throw new Error(`Invalid arguments:
|
|
24869
22957
|
${transformErrorLine(error)}`);
|
|
@@ -24879,16 +22967,16 @@ function withDescription(schema, description) {
|
|
|
24879
22967
|
function optional(schema, description) {
|
|
24880
22968
|
return Type.Optional(description ? withDescription(schema, description) : schema);
|
|
24881
22969
|
}
|
|
24882
|
-
function decodedSchema(inputSchema, outputSchema,
|
|
24883
|
-
const
|
|
24884
|
-
const decoded =
|
|
22970
|
+
function decodedSchema(inputSchema, outputSchema, decode, options) {
|
|
22971
|
+
const transform = Type.Transform(inputSchema).Decode((input) => {
|
|
22972
|
+
const decoded = decode(input);
|
|
24885
22973
|
const issues = schemaErrorLines(outputSchema, decoded);
|
|
24886
22974
|
if (issues.length > 0)
|
|
24887
22975
|
throw new Error(issues.join(`
|
|
24888
22976
|
`));
|
|
24889
22977
|
return decoded;
|
|
24890
22978
|
}).Encode((output) => output);
|
|
24891
|
-
return options ? { ...
|
|
22979
|
+
return options ? { ...transform, ...options } : transform;
|
|
24892
22980
|
}
|
|
24893
22981
|
function schemaEnumValues(schema) {
|
|
24894
22982
|
if (typeof schema.const === "string" || typeof schema.const === "number") {
|
|
@@ -25419,8 +23507,8 @@ async function runCli(cliTools, args, options = {}) {
|
|
|
25419
23507
|
const getSchemaShape = (schema) => schemaProperties(schema);
|
|
25420
23508
|
const getEnumOptions = (field) => schemaEnumValues(field);
|
|
25421
23509
|
const getDescription = (field) => schemaDescription(field);
|
|
25422
|
-
const formatToolHelp = (
|
|
25423
|
-
const shape = getSchemaShape(
|
|
23510
|
+
const formatToolHelp = (toolName, tool) => {
|
|
23511
|
+
const shape = getSchemaShape(tool.schema);
|
|
25424
23512
|
const actionField = shape.action;
|
|
25425
23513
|
const actionOptions = getEnumOptions(actionField);
|
|
25426
23514
|
const otherFields = Object.entries(shape).filter(([name]) => name !== "action");
|
|
@@ -25433,7 +23521,7 @@ async function runCli(cliTools, args, options = {}) {
|
|
|
25433
23521
|
}).join(`
|
|
25434
23522
|
`) : " (no additional flags)";
|
|
25435
23523
|
return [
|
|
25436
|
-
`Usage: ${commandName} ${
|
|
23524
|
+
`Usage: ${commandName} ${toolName} <action> [--flags]`,
|
|
25437
23525
|
"",
|
|
25438
23526
|
actionLines,
|
|
25439
23527
|
"",
|
|
@@ -25442,8 +23530,8 @@ async function runCli(cliTools, args, options = {}) {
|
|
|
25442
23530
|
].join(`
|
|
25443
23531
|
`);
|
|
25444
23532
|
};
|
|
25445
|
-
const formatActionHelp = (
|
|
25446
|
-
const shape = getSchemaShape(
|
|
23533
|
+
const formatActionHelp = (toolName, action, tool) => {
|
|
23534
|
+
const shape = getSchemaShape(tool.schema);
|
|
25447
23535
|
const otherFields = Object.entries(shape).filter(([name]) => name !== "action");
|
|
25448
23536
|
const relevantFields = otherFields.filter(([, field]) => {
|
|
25449
23537
|
const description = getDescription(field);
|
|
@@ -25452,7 +23540,7 @@ async function runCli(cliTools, args, options = {}) {
|
|
|
25452
23540
|
const argLines = relevantFields.length ? relevantFields.map(([name, field]) => ` --${name} ${getDescription(field) || "(no description)"}`).join(`
|
|
25453
23541
|
`) : " (no documented action-specific flags)";
|
|
25454
23542
|
return [
|
|
25455
|
-
`Usage: ${commandName} ${
|
|
23543
|
+
`Usage: ${commandName} ${toolName} ${action} [--flags]`,
|
|
25456
23544
|
"",
|
|
25457
23545
|
"Flags:",
|
|
25458
23546
|
argLines
|
|
@@ -26172,10 +24260,10 @@ async function responseBytesFromReader(reader, maxBytes) {
|
|
|
26172
24260
|
}
|
|
26173
24261
|
async function responseBytesBeforeDeadline(reader, maxBytes, responseTimeoutMs) {
|
|
26174
24262
|
let deadlineTimer;
|
|
26175
|
-
const deadline = new Promise((
|
|
24263
|
+
const deadline = new Promise((resolve) => {
|
|
26176
24264
|
deadlineTimer = setTimeout(() => {
|
|
26177
24265
|
cancelResponseReader(reader);
|
|
26178
|
-
|
|
24266
|
+
resolve(null);
|
|
26179
24267
|
}, responseTimeoutMs);
|
|
26180
24268
|
});
|
|
26181
24269
|
try {
|
|
@@ -26285,15 +24373,15 @@ class HttpTransport {
|
|
|
26285
24373
|
}
|
|
26286
24374
|
if (maxJsonBytes !== undefined) {
|
|
26287
24375
|
try {
|
|
26288
|
-
const
|
|
26289
|
-
return { ok: response.ok, status: response.status, data
|
|
24376
|
+
const data = await strictBoundedResponseJson(response, maxJsonBytes);
|
|
24377
|
+
return { ok: response.ok, status: response.status, data };
|
|
26290
24378
|
} catch {
|
|
26291
24379
|
return responseBodyFailure(response.status);
|
|
26292
24380
|
}
|
|
26293
24381
|
}
|
|
26294
24382
|
if (maxResponseBytes !== undefined) {
|
|
26295
|
-
const
|
|
26296
|
-
return { ok: response.ok, status: response.status, data
|
|
24383
|
+
const data = await boundedResponseJson(response, maxResponseBytes);
|
|
24384
|
+
return { ok: response.ok, status: response.status, data };
|
|
26297
24385
|
}
|
|
26298
24386
|
const data = await response.json().catch(() => null);
|
|
26299
24387
|
return { ok: response.ok, status: response.status, data };
|
|
@@ -26314,8 +24402,8 @@ class HttpTransport {
|
|
|
26314
24402
|
}
|
|
26315
24403
|
if (maxJsonBytes !== undefined) {
|
|
26316
24404
|
try {
|
|
26317
|
-
const
|
|
26318
|
-
return { ok: response.ok, status: response.status, data
|
|
24405
|
+
const data = await strictBoundedResponseJson(response, maxJsonBytes, responseTimeoutMs);
|
|
24406
|
+
return { ok: response.ok, status: response.status, data };
|
|
26319
24407
|
} catch {
|
|
26320
24408
|
return responseBodyFailure(response.status);
|
|
26321
24409
|
}
|
|
@@ -26359,14 +24447,15 @@ class HttpTransport {
|
|
|
26359
24447
|
return transportFailure(error);
|
|
26360
24448
|
}
|
|
26361
24449
|
}
|
|
26362
|
-
async postMultipart(path, formData) {
|
|
24450
|
+
async postMultipart(path, formData, options) {
|
|
24451
|
+
const timeoutMs = validatedPostTimeout(options);
|
|
26363
24452
|
try {
|
|
26364
24453
|
const headers = { Authorization: `Bearer ${this.token}` };
|
|
26365
24454
|
const res = await fetchWithRetry(`${this.baseUrl}${path}`, {
|
|
26366
24455
|
method: "POST",
|
|
26367
24456
|
headers,
|
|
26368
24457
|
body: formData
|
|
26369
|
-
});
|
|
24458
|
+
}, timeoutMs);
|
|
26370
24459
|
const data = await res.json().catch(() => null);
|
|
26371
24460
|
return { ok: res.ok, status: res.status, data };
|
|
26372
24461
|
} catch (error) {
|
|
@@ -26454,10 +24543,10 @@ function quoteShell(shellText) {
|
|
|
26454
24543
|
// src/shared/releases/local-upgrade-bundle.ts
|
|
26455
24544
|
import { spawn } from "node:child_process";
|
|
26456
24545
|
import { createHash as createHash2, randomUUID as randomUUID2 } from "node:crypto";
|
|
26457
|
-
import { accessSync, chmodSync as chmodSync2, constants as fsConstants, createWriteStream, lstatSync, mkdirSync, mkdtempSync as mkdtempSync2, readFileSync as readFileSync3, readdirSync, rmSync as rmSync2, statSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
24546
|
+
import { accessSync, chmodSync as chmodSync2, constants as fsConstants, copyFileSync, createWriteStream, lstatSync, mkdirSync, mkdtempSync as mkdtempSync2, readFileSync as readFileSync3, readdirSync, rmSync as rmSync2, statSync, writeFileSync as writeFileSync2 } from "node:fs";
|
|
26458
24547
|
import { get } from "node:https";
|
|
26459
24548
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
26460
|
-
import { basename, delimiter, join } from "node:path";
|
|
24549
|
+
import { basename, delimiter, isAbsolute, join } from "node:path";
|
|
26461
24550
|
import { pipeline } from "node:stream/promises";
|
|
26462
24551
|
import { Transform as Transform2 } from "node:stream";
|
|
26463
24552
|
|
|
@@ -26743,7 +24832,7 @@ var GH_ARCHIVE_SHA256 = {
|
|
|
26743
24832
|
arm64: "06f86ec7103d41993b76cd78072f43595c34aaa56506d971d9860e67140bf909"
|
|
26744
24833
|
};
|
|
26745
24834
|
var MAX_GH_ARCHIVE_BYTES = 64 * 1024 * 1024;
|
|
26746
|
-
var DOWNLOAD_TIMEOUT_MS =
|
|
24835
|
+
var DOWNLOAD_TIMEOUT_MS = 30 * 60000;
|
|
26747
24836
|
var DOWNLOAD_IDLE_TIMEOUT_MS = 30000;
|
|
26748
24837
|
var GH_CAPABILITY_TIMEOUT_MS = 30000;
|
|
26749
24838
|
var GH_VERIFICATION_TIMEOUT_MS = 2 * 60000;
|
|
@@ -26910,9 +24999,9 @@ async function consumeDownloadResponse(response, download) {
|
|
|
26910
24999
|
await pipeline(response, boundedWriter(download.maxBytes), createWriteStream(download.destination, { flags: "wx", mode: 384 }));
|
|
26911
25000
|
}
|
|
26912
25001
|
function requestDownloadResponse(download, remainingTime) {
|
|
26913
|
-
return new Promise((
|
|
25002
|
+
return new Promise((resolve, reject) => {
|
|
26914
25003
|
const request = get(download.url, { headers: { "User-Agent": "SupaCloud-Admin" } }, (response) => {
|
|
26915
|
-
consumeDownloadResponse(response, download).then(
|
|
25004
|
+
consumeDownloadResponse(response, download).then(resolve, reject);
|
|
26916
25005
|
});
|
|
26917
25006
|
request.setTimeout(DOWNLOAD_IDLE_TIMEOUT_MS, () => request.destroy(new RetryableDownloadError("Release download connection stalled")));
|
|
26918
25007
|
request.on("error", reject);
|
|
@@ -26948,6 +25037,28 @@ async function downloadDirect(url, destination, maxBytes) {
|
|
|
26948
25037
|
throw new AggregateError(retryFailures, `Unable to download ${parsed.hostname}${parsed.pathname}`);
|
|
26949
25038
|
}
|
|
26950
25039
|
async function downloadGithubReleaseAsset(request) {
|
|
25040
|
+
const cache = process.env.SUPACLOUD_RELEASE_ASSET_CACHE_DIR?.trim();
|
|
25041
|
+
if (cache) {
|
|
25042
|
+
if (!isAbsolute(cache))
|
|
25043
|
+
throw new Error("Release asset cache directory must be absolute");
|
|
25044
|
+
const cachedPath = join(cache, request.repository, request.tag, request.assetName);
|
|
25045
|
+
let cached;
|
|
25046
|
+
try {
|
|
25047
|
+
cached = lstatSync(cachedPath);
|
|
25048
|
+
} catch (error) {
|
|
25049
|
+
if (error.code !== "ENOENT")
|
|
25050
|
+
throw error;
|
|
25051
|
+
}
|
|
25052
|
+
if (cached) {
|
|
25053
|
+
if (!cached.isFile() || cached.isSymbolicLink() || cached.size > request.maxBytes) {
|
|
25054
|
+
throw new Error("Cached release asset must be a bounded regular file");
|
|
25055
|
+
}
|
|
25056
|
+
copyFileSync(cachedPath, request.destination, fsConstants.COPYFILE_EXCL);
|
|
25057
|
+
chmodSync2(request.destination, 384);
|
|
25058
|
+
assertDownloadedReleaseAsset(request);
|
|
25059
|
+
return;
|
|
25060
|
+
}
|
|
25061
|
+
}
|
|
26951
25062
|
const download = await runGithubCliDownload([
|
|
26952
25063
|
"release",
|
|
26953
25064
|
"download",
|
|
@@ -27073,15 +25184,21 @@ function githubCliExecutable(environment) {
|
|
|
27073
25184
|
}
|
|
27074
25185
|
throw new Error("GitHub CLI executable was not found in PATH");
|
|
27075
25186
|
}
|
|
27076
|
-
function spawnGithubCli(arguments_) {
|
|
25187
|
+
function spawnGithubCli(arguments_, download = false) {
|
|
27077
25188
|
const environment = directEnvironment();
|
|
25189
|
+
if (download) {
|
|
25190
|
+
for (const key of ["HTTP_PROXY", "HTTPS_PROXY", "NO_PROXY", "http_proxy", "https_proxy", "no_proxy"]) {
|
|
25191
|
+
if (process.env[key])
|
|
25192
|
+
environment[key] = process.env[key];
|
|
25193
|
+
}
|
|
25194
|
+
}
|
|
27078
25195
|
return spawn(githubCliExecutable(environment), arguments_, {
|
|
27079
25196
|
env: environment,
|
|
27080
25197
|
stdio: ["ignore", "pipe", "pipe"]
|
|
27081
25198
|
});
|
|
27082
25199
|
}
|
|
27083
25200
|
function githubCliExitCode(child, timeoutMs) {
|
|
27084
|
-
return new Promise((
|
|
25201
|
+
return new Promise((resolve, reject) => {
|
|
27085
25202
|
let timedOut = false;
|
|
27086
25203
|
let settled = false;
|
|
27087
25204
|
let forceKillTimer;
|
|
@@ -27100,7 +25217,7 @@ function githubCliExitCode(child, timeoutMs) {
|
|
|
27100
25217
|
if (error)
|
|
27101
25218
|
reject(error);
|
|
27102
25219
|
else
|
|
27103
|
-
|
|
25220
|
+
resolve(timedOut ? 124 : exitCode);
|
|
27104
25221
|
};
|
|
27105
25222
|
child.once("error", (error) => settleExecution(error, 127));
|
|
27106
25223
|
child.once("close", (code) => settleExecution(undefined, code ?? 1));
|
|
@@ -27120,7 +25237,7 @@ async function runGithubCli(arguments_, timeoutMs) {
|
|
|
27120
25237
|
return { exitCode, stdout, stderr };
|
|
27121
25238
|
}
|
|
27122
25239
|
async function runGithubCliDownload(arguments_, destination, maxBytes, timeoutMs) {
|
|
27123
|
-
const child = spawnGithubCli(arguments_);
|
|
25240
|
+
const child = spawnGithubCli(arguments_, true);
|
|
27124
25241
|
let stderr = "";
|
|
27125
25242
|
child.stderr.on("data", (chunk) => {
|
|
27126
25243
|
stderr = `${stderr}${chunk.toString()}`.slice(-8000);
|
|
@@ -28177,7 +26294,7 @@ function failureRequiresRemoteReconciliation(error) {
|
|
|
28177
26294
|
return error instanceof RemoteUpgradeReconciliationError;
|
|
28178
26295
|
}
|
|
28179
26296
|
function delay(milliseconds) {
|
|
28180
|
-
return new Promise((
|
|
26297
|
+
return new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
28181
26298
|
}
|
|
28182
26299
|
function unitIsRunning(serviceState) {
|
|
28183
26300
|
return ["active", "activating", "deactivating", "reloading"].includes(serviceState);
|
|
@@ -28264,6 +26381,9 @@ async function throwRemoteUpgradeFailure(ssh, paths, status) {
|
|
|
28264
26381
|
throw remoteReconciliationFailure("Remote upgrade failed without valid structured failure evidence", [error], paths);
|
|
28265
26382
|
}
|
|
28266
26383
|
const failure = new Error(`Remote local upgrade failed (${status}): ${failureEvidence.summary}` + (failureEvidence.causes.length > 0 ? `; causes: ${failureEvidence.causes.join(" | ")}` : ""));
|
|
26384
|
+
if (failureEvidence.causes.some((cause) => cause.startsWith("phase="))) {
|
|
26385
|
+
throw remoteReconciliationFailure("Remote upgrade emitted only a wrapper failure; retain the runner log for diagnosis", [failure], paths);
|
|
26386
|
+
}
|
|
28267
26387
|
try {
|
|
28268
26388
|
await cleanupRemoteRecords(ssh, paths);
|
|
28269
26389
|
} catch (cleanupError) {
|
|
@@ -28704,7 +26824,7 @@ function componentBootstrapCommands(request) {
|
|
|
28704
26824
|
`MANAGEMENT_RELEASE=$(supacloud_fetch_component_release management-api ${quoteEnvValue(managementVersion)} "$MANAGEMENT_ASSET" web-console-build.tar.gz)`,
|
|
28705
26825
|
`supacloud_download_release_asset "$MANAGEMENT_RELEASE" "$MANAGEMENT_ASSET" "$STAGED_MANAGEMENT" binary`,
|
|
28706
26826
|
`chmod 0755 "$STAGED_MANAGEMENT"`,
|
|
28707
|
-
`TARGET_MANAGEMENT_VERSION=$(jq -er '.tag_name | capture("^management-api-v(?<version>(0|[1-9][0-9]*)
|
|
26827
|
+
`TARGET_MANAGEMENT_VERSION=$(jq -er '.tag_name | capture("^management-api-v(?<version>(0|[1-9][0-9]*)[.](0|[1-9][0-9]*)[.](0|[1-9][0-9]*))$").version' <<< "$MANAGEMENT_RELEASE")`,
|
|
28708
26828
|
`STAGED_VERSION=$(timeout 5s "$STAGED_MANAGEMENT" --version 2>&1 | grep -Eo '[0-9]+\\.[0-9]+\\.[0-9]+' | head -1 || true)`,
|
|
28709
26829
|
`test "$STAGED_VERSION" = "$TARGET_MANAGEMENT_VERSION" || { echo 'Target Management binary version does not match its verified release' >&2; exit 1; }`,
|
|
28710
26830
|
`supacloud_version_at_least "$STAGED_VERSION" ${quoteEnvValue(MINIMUM_COMPONENT_UPGRADE_VERSION)} || { echo 'Target Management release lacks component transaction capability' >&2; exit 1; }`,
|
|
@@ -29157,10 +27277,10 @@ function completedBinaryProbe(fields) {
|
|
|
29157
27277
|
if (hashBefore && hashAfter && hashBefore !== hashAfter) {
|
|
29158
27278
|
return { version: null, sha256: null, error: "binary_changed_during_probe" };
|
|
29159
27279
|
}
|
|
29160
|
-
const
|
|
27280
|
+
const sha256 = hashBefore && hashAfter ? hashBefore : null;
|
|
29161
27281
|
if (!version)
|
|
29162
|
-
return { version: null, sha256
|
|
29163
|
-
return
|
|
27282
|
+
return { version: null, sha256, error: "version_output_invalid" };
|
|
27283
|
+
return sha256 ? { version, sha256, error: null } : { version, sha256: null, error: "sha256_output_invalid" };
|
|
29164
27284
|
}
|
|
29165
27285
|
function reservedBinaryProbeFailure(execution, fields) {
|
|
29166
27286
|
if (execution.code === PROBE_CHANGED_DURING_READ) {
|
|
@@ -29441,6 +27561,7 @@ Actions: ping, setup, install, upgrade, upgrade_status, versions, diagnose, exec
|
|
|
29441
27561
|
postgres_password: optional(secretSchema("postgres_password"), "[install] DB password (auto-generated if empty)"),
|
|
29442
27562
|
dashboard_password: optional(secretSchema("dashboard_password"), "[install] Console password"),
|
|
29443
27563
|
edge_runtime: optional(stringEnum(["bun"]), "[install] Runtime (default: bun)"),
|
|
27564
|
+
edge_max_body_size_mb: optional(Type.Integer({ minimum: 1, maximum: 10240 }), "[install] Max Edge Runtime upload / request body size in MB (default: 30)"),
|
|
29444
27565
|
storage_type: optional(stringEnum(["juicefs", "minio"]), "[install] Storage backend configurable through Admin"),
|
|
29445
27566
|
transaction_id: optional(Type.String(), "[upgrade_status] UUID v4 transaction ID of a retained local-artifact upgrade"),
|
|
29446
27567
|
version: optional(Type.String(), "[upgrade] Specific version"),
|
|
@@ -29504,11 +27625,11 @@ ${bootstrapDeps.stderr.slice(-500)}`;
|
|
|
29504
27625
|
break;
|
|
29505
27626
|
}
|
|
29506
27627
|
const osCheck = await ssh.exec("cat /etc/os-release | grep -E 'NAME|VERSION_ID' | head -4");
|
|
29507
|
-
const
|
|
29508
|
-
if (!
|
|
27628
|
+
const clone = await ssh.exec(`set -e; umask 077; rm -rf ${quoteEnvValue(BOOTSTRAP)}; ` + `${bootstrapClone}; ` + `git -C ${quoteEnvValue(BOOTSTRAP)} remote set-url origin ${quoteEnvValue(REPO)}; ` + `test "$(git -C ${quoteEnvValue(BOOTSTRAP)} remote get-url origin)" = ${quoteEnvValue(REPO)}; ` + `test "$(git -C ${quoteEnvValue(BOOTSTRAP)} symbolic-ref --short HEAD)" = main; ` + `test -z "$(git -C ${quoteEnvValue(BOOTSTRAP)} status --porcelain --untracked-files=no)"; ` + `git -C ${quoteEnvValue(BOOTSTRAP)} ls-files --error-unmatch setup.sh scripts/lib/install_config.sh scripts/lib/release_assets.sh packages/management-api/src/assets/sigstore-public-good-trusted-root.jsonl >/dev/null; ` + `test -f ${quoteEnvValue(`${BOOTSTRAP}/setup.sh`)}; echo BOOTSTRAP_OK`, 120000);
|
|
27629
|
+
if (!clone.stdout.includes("BOOTSTRAP_OK")) {
|
|
29509
27630
|
await ssh.exec(`rm -rf ${quoteEnvValue(BOOTSTRAP)}`);
|
|
29510
27631
|
text = `❌ Trusted bootstrap clone failed
|
|
29511
|
-
${
|
|
27632
|
+
${clone.stderr.slice(-500)}`;
|
|
29512
27633
|
break;
|
|
29513
27634
|
}
|
|
29514
27635
|
const prepareProtectedPaths = await ssh.exec(`umask 077; install -d -m 700 /etc/supabase /var/log/supacloud; ` + `: > ${quoteEnvValue(LOG)}; : > ${quoteEnvValue(STATUS)}; ` + `chmod 600 ${quoteEnvValue(LOG)} ${quoteEnvValue(STATUS)}`);
|
|
@@ -29522,6 +27643,7 @@ ${prepareProtectedPaths.stderr.slice(-500)}`;
|
|
|
29522
27643
|
`SUPABASE_PUBLIC_DOMAIN=${quoteEnvValue(args.public_domain)}`,
|
|
29523
27644
|
args.studio_domain ? `SUPABASE_STUDIO_DOMAIN=${quoteEnvValue(args.studio_domain)}` : "",
|
|
29524
27645
|
args.edge_runtime ? `EDGE_RUNTIME=${quoteEnvValue(args.edge_runtime)}` : "",
|
|
27646
|
+
args.edge_max_body_size_mb ? `EDGE_MAX_BODY_SIZE_MB=${quoteEnvValue(String(args.edge_max_body_size_mb))}` : "",
|
|
29525
27647
|
args.storage_type ? `S3_STORAGE_TYPE=${quoteEnvValue(args.storage_type)}` : "",
|
|
29526
27648
|
args.postgres_password ? `POSTGRES_PASSWORD=${quoteEnvValue(args.postgres_password)}` : "",
|
|
29527
27649
|
args.dashboard_password ? `DASHBOARD_PASSWORD=${quoteEnvValue(args.dashboard_password)}` : ""
|
|
@@ -30217,16 +28339,16 @@ Actions: list, deploy, deploy_bundle, source, delete, check`, {
|
|
|
30217
28339
|
const { promisify } = __require("util");
|
|
30218
28340
|
const execAsync = promisify(__require("child_process").exec);
|
|
30219
28341
|
const stat = fs.statSync(pathArg);
|
|
30220
|
-
let
|
|
28342
|
+
let entrypoint = pathArg;
|
|
30221
28343
|
if (stat.isDirectory()) {
|
|
30222
|
-
|
|
30223
|
-
if (!fs.existsSync(
|
|
30224
|
-
throw new Error(`Directory provided but no index.ts found at ${
|
|
28344
|
+
entrypoint = `${pathArg}/index.ts`;
|
|
28345
|
+
if (!fs.existsSync(entrypoint)) {
|
|
28346
|
+
throw new Error(`Directory provided but no index.ts found at ${entrypoint}`);
|
|
30225
28347
|
}
|
|
30226
28348
|
}
|
|
30227
28349
|
const tmpOut = `${os.tmpdir()}/supacloud_bundled_${Date.now()}.js`;
|
|
30228
28350
|
try {
|
|
30229
|
-
const { stderr } = await execAsync(`bun build ${
|
|
28351
|
+
const { stderr } = await execAsync(`bun build ${entrypoint} --target bun --outfile ${tmpOut}`);
|
|
30230
28352
|
if (!fs.existsSync(tmpOut))
|
|
30231
28353
|
throw new Error(`Bundle failed: ${stderr}`);
|
|
30232
28354
|
code = fs.readFileSync(tmpOut, "utf-8");
|
|
@@ -30405,7 +28527,7 @@ Actions: metrics, list_backups, create_backup, list_logical_backups, create_logi
|
|
|
30405
28527
|
|
|
30406
28528
|
// src/shared/tools/project-create-env.ts
|
|
30407
28529
|
import { constants } from "node:fs";
|
|
30408
|
-
import { isAbsolute, basename as basename4, dirname as dirname2, join as join3, normalize, parse as parse2, resolve as resolve2 } from "node:path";
|
|
28530
|
+
import { isAbsolute as isAbsolute2, basename as basename4, dirname as dirname2, join as join3, normalize, parse as parse2, resolve as resolve2 } from "node:path";
|
|
30409
28531
|
import {
|
|
30410
28532
|
lstat,
|
|
30411
28533
|
open,
|
|
@@ -30438,7 +28560,7 @@ var nodeProjectEnvFileOperations = {
|
|
|
30438
28560
|
effectiveUid: () => process.geteuid?.() ?? -1,
|
|
30439
28561
|
lstat,
|
|
30440
28562
|
realpath,
|
|
30441
|
-
openDirectory: (
|
|
28563
|
+
openDirectory: (path) => open(path, constants.O_RDONLY | constants.O_DIRECTORY | constants.O_NOFOLLOW),
|
|
30442
28564
|
openExclusiveAt: (directory, filename, mode) => open(descriptorRelativePath(directory, filename), "wx", mode),
|
|
30443
28565
|
lstatAt: (directory, filename) => lstat(descriptorRelativePath(directory, filename)),
|
|
30444
28566
|
unlinkAt: (directory, filename) => unlink(descriptorRelativePath(directory, filename))
|
|
@@ -30448,9 +28570,9 @@ function fileSystemErrorCode(candidate) {
|
|
|
30448
28570
|
return null;
|
|
30449
28571
|
return typeof candidate.code === "string" ? candidate.code : null;
|
|
30450
28572
|
}
|
|
30451
|
-
async function assertTargetAbsent(
|
|
28573
|
+
async function assertTargetAbsent(path, operations) {
|
|
30452
28574
|
try {
|
|
30453
|
-
await operations.lstat(
|
|
28575
|
+
await operations.lstat(path);
|
|
30454
28576
|
} catch (error) {
|
|
30455
28577
|
if (fileSystemErrorCode(error) === "ENOENT")
|
|
30456
28578
|
return;
|
|
@@ -30529,7 +28651,7 @@ function sameParentIdentity(current, expected) {
|
|
|
30529
28651
|
return sameFileIdentity(current, expected) && current.mode === expected.mode && current.uid === expected.uid;
|
|
30530
28652
|
}
|
|
30531
28653
|
function hasSafeRequestedPath(requestedPath) {
|
|
30532
|
-
return Boolean(requestedPath) &&
|
|
28654
|
+
return Boolean(requestedPath) && isAbsolute2(requestedPath) && requestedPath === normalize(requestedPath) && requestedPath === resolve2(requestedPath) && Buffer.byteLength(requestedPath, "utf8") <= MAX_ENV_FILE_PATH_BYTES && !/[\0\r\n]/.test(requestedPath) && ![".", ".."].includes(basename4(requestedPath));
|
|
30533
28655
|
}
|
|
30534
28656
|
async function prepareProjectEnvFile(requestedPath, environment, operations = nodeProjectEnvFileOperations) {
|
|
30535
28657
|
if (operations.platform !== "linux") {
|
|
@@ -30540,14 +28662,14 @@ async function prepareProjectEnvFile(requestedPath, environment, operations = no
|
|
|
30540
28662
|
}
|
|
30541
28663
|
const directory = dirname2(requestedPath);
|
|
30542
28664
|
const filename = basename4(requestedPath);
|
|
30543
|
-
const
|
|
28665
|
+
const parentIdentity = await assertSafeParent(directory, operations);
|
|
30544
28666
|
await assertTargetAbsent(requestedPath, operations);
|
|
30545
28667
|
let directoryHandle = null;
|
|
30546
28668
|
let openFile = null;
|
|
30547
28669
|
let fileIdentity = null;
|
|
30548
28670
|
try {
|
|
30549
28671
|
directoryHandle = await operations.openDirectory(directory);
|
|
30550
|
-
await assertDirectoryBinding(directory, directoryHandle,
|
|
28672
|
+
await assertDirectoryBinding(directory, directoryHandle, parentIdentity, operations);
|
|
30551
28673
|
openFile = await openProjectEnvFile(directoryHandle, filename, operations);
|
|
30552
28674
|
const openFileStat = await openFile.stat();
|
|
30553
28675
|
assertSecureFileType(openFileStat);
|
|
@@ -30557,7 +28679,7 @@ async function prepareProjectEnvFile(requestedPath, environment, operations = no
|
|
|
30557
28679
|
path: requestedPath,
|
|
30558
28680
|
filename,
|
|
30559
28681
|
environment,
|
|
30560
|
-
parentIdentity
|
|
28682
|
+
parentIdentity,
|
|
30561
28683
|
fileIdentity,
|
|
30562
28684
|
directoryHandle,
|
|
30563
28685
|
openFile
|
|
@@ -30658,9 +28780,9 @@ async function openProjectEnvFile(directory, filename, operations) {
|
|
|
30658
28780
|
throw error;
|
|
30659
28781
|
}
|
|
30660
28782
|
}
|
|
30661
|
-
async function assertDirectoryBinding(
|
|
28783
|
+
async function assertDirectoryBinding(path, directoryHandle, expectedIdentity, operations) {
|
|
30662
28784
|
const heldDirectoryStat = await directoryHandle.stat();
|
|
30663
|
-
const currentPathIdentity = await assertSafeParent(
|
|
28785
|
+
const currentPathIdentity = await assertSafeParent(path, operations);
|
|
30664
28786
|
assertOwnedTargetParent(heldDirectoryStat, operations.effectiveUid());
|
|
30665
28787
|
if (!sameParentIdentity(heldDirectoryStat, expectedIdentity) || !sameParentIdentity(currentPathIdentity, expectedIdentity)) {
|
|
30666
28788
|
throw new ProjectCreateEnvError("ENV_FILE_PARENT_INVALID");
|
|
@@ -31305,8 +29427,8 @@ function hasCausalLoadTimestamps(snapshot) {
|
|
|
31305
29427
|
const capturedAt = Date.parse(snapshot.captured_at);
|
|
31306
29428
|
return [snapshot.secrets.loaded_at, snapshot.postgrest.loaded_at].every((loadedAt) => loadedAt === null || Date.parse(loadedAt) <= capturedAt);
|
|
31307
29429
|
}
|
|
31308
|
-
function parseProjectRuntimeSnapshot(payload,
|
|
31309
|
-
if (!SAFE_PROJECT_REF3.test(
|
|
29430
|
+
function parseProjectRuntimeSnapshot(payload, requestedProjectRef) {
|
|
29431
|
+
if (!SAFE_PROJECT_REF3.test(requestedProjectRef) || !isRecord2(payload) || !hasExactKeys(payload, SNAPSHOT_KEYS) || payload.schema !== RUNTIME_SNAPSHOT_SCHEMA || payload.project_ref !== requestedProjectRef || !isIsoTimestampOrNull(payload.captured_at) || payload.captured_at === null || !isRuntimeSecretsSnapshot(payload.secrets) || !isPostgrestRuntimeSnapshot(payload.postgrest, requestedProjectRef))
|
|
31310
29432
|
return null;
|
|
31311
29433
|
const snapshot = payload;
|
|
31312
29434
|
return hasCausalLoadTimestamps(snapshot) ? sanitizedSnapshot(snapshot) : null;
|
|
@@ -31952,11 +30074,11 @@ Actions: routes, upsert_route, update_route, delete_route, config, get_certifica
|
|
|
31952
30074
|
clean: optional(Type.Boolean(), "[rebuild] 清理后全量重建"),
|
|
31953
30075
|
custom_hostname: optional(Type.String(), "[set_custom_hostname] 自定义域名")
|
|
31954
30076
|
}, async (args) => {
|
|
31955
|
-
const
|
|
31956
|
-
const
|
|
31957
|
-
if (!
|
|
30077
|
+
const resolveRef = (override) => {
|
|
30078
|
+
const ref = projectRef || override;
|
|
30079
|
+
if (!ref)
|
|
31958
30080
|
throw new Error("'ref' is required for this action");
|
|
31959
|
-
return
|
|
30081
|
+
return ref;
|
|
31960
30082
|
};
|
|
31961
30083
|
const need = (field, value) => {
|
|
31962
30084
|
if (value === undefined || value === null || value === "")
|
|
@@ -31996,10 +30118,10 @@ Actions: routes, upsert_route, update_route, delete_route, config, get_certifica
|
|
|
31996
30118
|
renew,
|
|
31997
30119
|
cert,
|
|
31998
30120
|
key,
|
|
31999
|
-
clean
|
|
30121
|
+
clean,
|
|
32000
30122
|
custom_hostname
|
|
32001
30123
|
} = args;
|
|
32002
|
-
const projectRefValue =
|
|
30124
|
+
const projectRefValue = resolveRef(ref);
|
|
32003
30125
|
let text;
|
|
32004
30126
|
switch (action) {
|
|
32005
30127
|
case "routes":
|
|
@@ -32155,7 +30277,7 @@ Actions: routes, upsert_route, update_route, delete_route, config, get_certifica
|
|
|
32155
30277
|
break;
|
|
32156
30278
|
}
|
|
32157
30279
|
case "rebuild": {
|
|
32158
|
-
const query =
|
|
30280
|
+
const query = clean ? "?clean=true" : "";
|
|
32159
30281
|
text = ok2(await http.post(`/v1/projects/${projectRefValue}/gateway/rebuild-all${query}`));
|
|
32160
30282
|
break;
|
|
32161
30283
|
}
|
|
@@ -32311,20 +30433,20 @@ function sameArchiveIdentity(left, right) {
|
|
|
32311
30433
|
return left.dev === right.dev && left.ino === right.ino && left.size === right.size && left.mtimeNs === right.mtimeNs && left.ctimeNs === right.ctimeNs;
|
|
32312
30434
|
}
|
|
32313
30435
|
async function archiveSha256(handle, sizeBytes) {
|
|
32314
|
-
const
|
|
30436
|
+
const hash = createHash3("sha256");
|
|
32315
30437
|
const chunk = new Uint8Array(Math.min(sizeBytes, ARCHIVE_CHUNK_BYTES));
|
|
32316
30438
|
for (let offset = 0;offset < sizeBytes; ) {
|
|
32317
30439
|
const requested = Math.min(chunk.byteLength, sizeBytes - offset);
|
|
32318
30440
|
const { bytesRead } = await handle.read(chunk, 0, requested, offset);
|
|
32319
30441
|
if (bytesRead < 1)
|
|
32320
30442
|
throw new Error("Frontend release archive changed while it was hashed");
|
|
32321
|
-
|
|
30443
|
+
hash.update(chunk.subarray(0, bytesRead));
|
|
32322
30444
|
offset += bytesRead;
|
|
32323
30445
|
}
|
|
32324
|
-
return
|
|
30446
|
+
return hash.digest("hex");
|
|
32325
30447
|
}
|
|
32326
|
-
async function verifiedArchive(
|
|
32327
|
-
const archivePath = resolve3(
|
|
30448
|
+
async function verifiedArchive(path) {
|
|
30449
|
+
const archivePath = resolve3(path);
|
|
32328
30450
|
const handle = await open2(archivePath, fsConstants2.O_RDONLY | fsConstants2.O_NOFOLLOW);
|
|
32329
30451
|
try {
|
|
32330
30452
|
const before = await handle.stat({ bigint: true });
|
|
@@ -32332,12 +30454,12 @@ async function verifiedArchive(path2) {
|
|
|
32332
30454
|
if (!before.isFile() || sizeBytes < 1 || sizeBytes > ARCHIVE_MAX_BYTES) {
|
|
32333
30455
|
throw new Error(`Frontend release archive must be a 1-${ARCHIVE_MAX_BYTES} byte regular file`);
|
|
32334
30456
|
}
|
|
32335
|
-
const
|
|
30457
|
+
const sha256 = await archiveSha256(handle, sizeBytes);
|
|
32336
30458
|
const after = await handle.stat({ bigint: true });
|
|
32337
30459
|
if (!sameArchiveIdentity(before, after)) {
|
|
32338
30460
|
throw new Error("Frontend release archive identity changed while it was hashed");
|
|
32339
30461
|
}
|
|
32340
|
-
return { handle, sizeBytes, sha256
|
|
30462
|
+
return { handle, sizeBytes, sha256 };
|
|
32341
30463
|
} catch (error) {
|
|
32342
30464
|
await handle.close();
|
|
32343
30465
|
throw error;
|
|
@@ -32660,7 +30782,7 @@ Actions: list_releases, get_release, upload_release, activate_release`, {
|
|
|
32660
30782
|
// package.json
|
|
32661
30783
|
var package_default = {
|
|
32662
30784
|
name: "@supacloud/admin",
|
|
32663
|
-
version: "0.
|
|
30785
|
+
version: "0.22.1",
|
|
32664
30786
|
description: "Platform administration CLI for SupaCloud operators",
|
|
32665
30787
|
type: "module",
|
|
32666
30788
|
main: "./dist/index.js",
|
|
@@ -32694,7 +30816,7 @@ var package_default = {
|
|
|
32694
30816
|
ssh2: "^1.17.0"
|
|
32695
30817
|
},
|
|
32696
30818
|
devDependencies: {
|
|
32697
|
-
"@types/bun": "^1.4.
|
|
30819
|
+
"@types/bun": "^1.4.2",
|
|
32698
30820
|
"@types/ssh2": "^1.15.6",
|
|
32699
30821
|
typescript: "^7.0.2"
|
|
32700
30822
|
}
|
|
@@ -32945,17 +31067,17 @@ async function main() {
|
|
|
32945
31067
|
}
|
|
32946
31068
|
const cliTools = createAdminTools(context, globalOptions.confirmProduction);
|
|
32947
31069
|
if (args.length === 1 && cliTools[args[0]]) {
|
|
32948
|
-
const
|
|
32949
|
-
if (
|
|
32950
|
-
for (const chunk of
|
|
31070
|
+
const toolResponse = await cliTools[args[0]].callback({});
|
|
31071
|
+
if (toolResponse?.content && Array.isArray(toolResponse.content)) {
|
|
31072
|
+
for (const chunk of toolResponse.content) {
|
|
32951
31073
|
if (chunk.type === "text") {
|
|
32952
31074
|
console.log(chunk.text);
|
|
32953
31075
|
}
|
|
32954
31076
|
}
|
|
32955
31077
|
} else {
|
|
32956
|
-
console.log(JSON.stringify(
|
|
31078
|
+
console.log(JSON.stringify(toolResponse, null, 2));
|
|
32957
31079
|
}
|
|
32958
|
-
if (cliToolResultIsError(
|
|
31080
|
+
if (cliToolResultIsError(toolResponse))
|
|
32959
31081
|
process.exitCode = 1;
|
|
32960
31082
|
return;
|
|
32961
31083
|
}
|