@supatest/cli 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +675 -734
- package/package.json +3 -6
package/dist/index.js
CHANGED
|
@@ -756,6 +756,23 @@ ${config2.logs}
|
|
|
756
756
|
${projectInstructions}`
|
|
757
757
|
].filter(Boolean).join("\n") || void 0;
|
|
758
758
|
}
|
|
759
|
+
const cleanEnv = {};
|
|
760
|
+
const excludeKeys = /* @__PURE__ */ new Set([
|
|
761
|
+
"ANTHROPIC_API_KEY",
|
|
762
|
+
"ANTHROPIC_BASE_URL",
|
|
763
|
+
"ANTHROPIC_AUTH_TOKEN",
|
|
764
|
+
"CLAUDE_CODE_AUTH_TOKEN",
|
|
765
|
+
"CLAUDE_API_KEY"
|
|
766
|
+
]);
|
|
767
|
+
for (const [key, value] of Object.entries(process.env)) {
|
|
768
|
+
if (value !== void 0 && !excludeKeys.has(key)) {
|
|
769
|
+
cleanEnv[key] = value;
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
cleanEnv.ANTHROPIC_API_KEY = config2.supatestApiKey || "";
|
|
773
|
+
cleanEnv.ANTHROPIC_BASE_URL = process.env.ANTHROPIC_BASE_URL || "";
|
|
774
|
+
cleanEnv.ANTHROPIC_AUTH_TOKEN = "";
|
|
775
|
+
cleanEnv.CLAUDE_CODE_AUTH_TOKEN = "";
|
|
759
776
|
const queryOptions = {
|
|
760
777
|
// AbortController for cancellation support
|
|
761
778
|
abortController: this.abortController,
|
|
@@ -788,13 +805,7 @@ ${projectInstructions}`
|
|
|
788
805
|
append: systemPromptAppend
|
|
789
806
|
}
|
|
790
807
|
},
|
|
791
|
-
env:
|
|
792
|
-
...process.env,
|
|
793
|
-
ANTHROPIC_API_KEY: config2.supatestApiKey,
|
|
794
|
-
ANTHROPIC_BASE_URL: process.env.ANTHROPIC_BASE_URL || "",
|
|
795
|
-
ANTHROPIC_AUTH_TOKEN: "",
|
|
796
|
-
CLAUDE_CODE_AUTH_TOKEN: ""
|
|
797
|
-
},
|
|
808
|
+
env: cleanEnv,
|
|
798
809
|
stderr: (msg) => {
|
|
799
810
|
this.presenter.onLog(`[Claude Code stderr] ${msg}`);
|
|
800
811
|
}
|
|
@@ -936,11 +947,11 @@ Set CLAUDE_CODE_EXECUTABLE_PATH environment variable to override.`;
|
|
|
936
947
|
});
|
|
937
948
|
|
|
938
949
|
// ../shared/dist/shared.es.mjs
|
|
939
|
-
function
|
|
940
|
-
return
|
|
950
|
+
function me() {
|
|
951
|
+
return Be;
|
|
941
952
|
}
|
|
942
953
|
function d(t, e) {
|
|
943
|
-
const r =
|
|
954
|
+
const r = me(), n = _e({
|
|
944
955
|
issueData: e,
|
|
945
956
|
data: t.data,
|
|
946
957
|
path: t.path,
|
|
@@ -951,13 +962,13 @@ function d(t, e) {
|
|
|
951
962
|
// then schema-bound map if available
|
|
952
963
|
r,
|
|
953
964
|
// then global override map
|
|
954
|
-
r ===
|
|
965
|
+
r === H ? void 0 : H
|
|
955
966
|
// then global default map
|
|
956
967
|
].filter((s) => !!s)
|
|
957
968
|
});
|
|
958
969
|
t.common.issues.push(n);
|
|
959
970
|
}
|
|
960
|
-
function
|
|
971
|
+
function g(t) {
|
|
961
972
|
if (!t)
|
|
962
973
|
return {};
|
|
963
974
|
const { errorMap: e, invalid_type_error: r, required_error: n, description: s } = t;
|
|
@@ -968,25 +979,25 @@ function y(t) {
|
|
|
968
979
|
return i.code === "invalid_enum_value" ? { message: h ?? c.defaultError } : typeof c.data > "u" ? { message: h ?? n ?? c.defaultError } : i.code !== "invalid_type" ? { message: c.defaultError } : { message: h ?? r ?? c.defaultError };
|
|
969
980
|
}, description: s };
|
|
970
981
|
}
|
|
971
|
-
function
|
|
982
|
+
function Ce(t) {
|
|
972
983
|
let e = "[0-5]\\d";
|
|
973
984
|
t.precision ? e = `${e}\\.\\d{${t.precision}}` : t.precision == null && (e = `${e}(\\.\\d+)?`);
|
|
974
985
|
const r = t.precision ? "+" : "?";
|
|
975
986
|
return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`;
|
|
976
987
|
}
|
|
977
|
-
function it(t) {
|
|
978
|
-
return new RegExp(`^${je(t)}$`);
|
|
979
|
-
}
|
|
980
988
|
function ct(t) {
|
|
981
|
-
|
|
989
|
+
return new RegExp(`^${Ce(t)}$`);
|
|
990
|
+
}
|
|
991
|
+
function ot(t) {
|
|
992
|
+
let e = `${je}T${Ce(t)}`;
|
|
982
993
|
const r = [];
|
|
983
994
|
return r.push(t.local ? "Z?" : "Z"), t.offset && r.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${r.join("|")})`, new RegExp(`^${e}$`);
|
|
984
995
|
}
|
|
985
|
-
function ot(t, e) {
|
|
986
|
-
return !!((e === "v4" || !e) && He.test(t) || (e === "v6" || !e) && tt.test(t));
|
|
987
|
-
}
|
|
988
996
|
function dt(t, e) {
|
|
989
|
-
|
|
997
|
+
return !!((e === "v4" || !e) && et.test(t) || (e === "v6" || !e) && rt.test(t));
|
|
998
|
+
}
|
|
999
|
+
function ut(t, e) {
|
|
1000
|
+
if (!Xe.test(t))
|
|
990
1001
|
return false;
|
|
991
1002
|
try {
|
|
992
1003
|
const [r] = t.split(".");
|
|
@@ -998,31 +1009,31 @@ function dt(t, e) {
|
|
|
998
1009
|
return false;
|
|
999
1010
|
}
|
|
1000
1011
|
}
|
|
1001
|
-
function ut(t, e) {
|
|
1002
|
-
return !!((e === "v4" || !e) && et.test(t) || (e === "v6" || !e) && rt.test(t));
|
|
1003
|
-
}
|
|
1004
1012
|
function lt(t, e) {
|
|
1013
|
+
return !!((e === "v4" || !e) && tt.test(t) || (e === "v6" || !e) && nt.test(t));
|
|
1014
|
+
}
|
|
1015
|
+
function ht(t, e) {
|
|
1005
1016
|
const r = (t.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, s = r > n ? r : n, a = Number.parseInt(t.toFixed(s).replace(".", "")), i = Number.parseInt(e.toFixed(s).replace(".", ""));
|
|
1006
1017
|
return a % i / 10 ** s;
|
|
1007
1018
|
}
|
|
1008
|
-
function
|
|
1019
|
+
function q(t) {
|
|
1009
1020
|
if (t instanceof x) {
|
|
1010
1021
|
const e = {};
|
|
1011
1022
|
for (const r in t.shape) {
|
|
1012
1023
|
const n = t.shape[r];
|
|
1013
|
-
e[r] =
|
|
1024
|
+
e[r] = L.create(q(n));
|
|
1014
1025
|
}
|
|
1015
1026
|
return new x({
|
|
1016
1027
|
...t._def,
|
|
1017
1028
|
shape: () => e
|
|
1018
1029
|
});
|
|
1019
|
-
} else return t instanceof
|
|
1030
|
+
} else return t instanceof D ? new D({
|
|
1020
1031
|
...t._def,
|
|
1021
|
-
type:
|
|
1022
|
-
}) : t instanceof
|
|
1032
|
+
type: q(t.element)
|
|
1033
|
+
}) : t instanceof L ? L.create(q(t.unwrap())) : t instanceof B ? B.create(q(t.unwrap())) : t instanceof S ? S.create(t.items.map((e) => q(e))) : t;
|
|
1023
1034
|
}
|
|
1024
1035
|
function ge(t, e) {
|
|
1025
|
-
const r =
|
|
1036
|
+
const r = j(t), n = j(e);
|
|
1026
1037
|
if (t === e)
|
|
1027
1038
|
return { valid: true, data: t };
|
|
1028
1039
|
if (r === u.object && n === u.object) {
|
|
@@ -1048,20 +1059,21 @@ function ge(t, e) {
|
|
|
1048
1059
|
} else return r === u.date && n === u.date && +t == +e ? { valid: true, data: t } : { valid: false };
|
|
1049
1060
|
}
|
|
1050
1061
|
function $e(t, e) {
|
|
1051
|
-
return new
|
|
1062
|
+
return new F({
|
|
1052
1063
|
values: t,
|
|
1053
1064
|
typeName: p.ZodEnum,
|
|
1054
|
-
...
|
|
1065
|
+
...g(e)
|
|
1055
1066
|
});
|
|
1056
1067
|
}
|
|
1057
|
-
function
|
|
1068
|
+
function qt(t) {
|
|
1058
1069
|
return {
|
|
1059
1070
|
Grep: "Search",
|
|
1060
1071
|
Glob: "Search",
|
|
1072
|
+
Bash: "Command",
|
|
1061
1073
|
BashOutput: "Command Output"
|
|
1062
1074
|
}[t] || t;
|
|
1063
1075
|
}
|
|
1064
|
-
var E,
|
|
1076
|
+
var E, Oe, u, j, o, R, H, Be, _e, O, _, K, N, Ne, Ae, W, ne, m, M, Re, v, Ge, qe, Ye, We, Qe, Xe, Ke, Je, He, fe, et, tt, rt, nt, st, at, je, it, w, $, V, se, Q, Ie, pe, ye, we, Y, C, De, D, x, ae, Z, Ee, ie, S, ce, Me, ee, J, ve, oe, F, Te, te, z, L, B, de, ue, Ze, Ve, ke, le, p, f, k, xe, I, re, P, y, ft, Fe, X, Le, b, U, mt, Se, Pe, Nt, At, Rt, It, wt, _t, Ue, pt, Dt, yt, gt, vt, Tt, Et, kt, G, Zt, Lt, St, Pt, Ut, jt, Ct, xt, bt, Ot, $t, Vt;
|
|
1065
1077
|
var init_shared_es = __esm({
|
|
1066
1078
|
"../shared/dist/shared.es.mjs"() {
|
|
1067
1079
|
"use strict";
|
|
@@ -1107,7 +1119,7 @@ var init_shared_es = __esm({
|
|
|
1107
1119
|
...r
|
|
1108
1120
|
// second overwrites first
|
|
1109
1121
|
});
|
|
1110
|
-
})(
|
|
1122
|
+
})(Oe || (Oe = {}));
|
|
1111
1123
|
u = E.arrayToEnum([
|
|
1112
1124
|
"string",
|
|
1113
1125
|
"nan",
|
|
@@ -1130,7 +1142,7 @@ var init_shared_es = __esm({
|
|
|
1130
1142
|
"map",
|
|
1131
1143
|
"set"
|
|
1132
1144
|
]);
|
|
1133
|
-
|
|
1145
|
+
j = (t) => {
|
|
1134
1146
|
switch (typeof t) {
|
|
1135
1147
|
case "undefined":
|
|
1136
1148
|
return u.undefined;
|
|
@@ -1170,7 +1182,7 @@ var init_shared_es = __esm({
|
|
|
1170
1182
|
"not_multiple_of",
|
|
1171
1183
|
"not_finite"
|
|
1172
1184
|
]);
|
|
1173
|
-
|
|
1185
|
+
R = class _R extends Error {
|
|
1174
1186
|
get errors() {
|
|
1175
1187
|
return this.issues;
|
|
1176
1188
|
}
|
|
@@ -1207,7 +1219,7 @@ var init_shared_es = __esm({
|
|
|
1207
1219
|
return s(this), n;
|
|
1208
1220
|
}
|
|
1209
1221
|
static assert(e) {
|
|
1210
|
-
if (!(e instanceof
|
|
1222
|
+
if (!(e instanceof _R))
|
|
1211
1223
|
throw new Error(`Not a ZodError: ${e}`);
|
|
1212
1224
|
}
|
|
1213
1225
|
toString() {
|
|
@@ -1233,8 +1245,8 @@ var init_shared_es = __esm({
|
|
|
1233
1245
|
return this.flatten();
|
|
1234
1246
|
}
|
|
1235
1247
|
};
|
|
1236
|
-
|
|
1237
|
-
|
|
1248
|
+
R.create = (t) => new R(t);
|
|
1249
|
+
H = (t, e) => {
|
|
1238
1250
|
let r;
|
|
1239
1251
|
switch (t.code) {
|
|
1240
1252
|
case o.invalid_type:
|
|
@@ -1290,8 +1302,8 @@ var init_shared_es = __esm({
|
|
|
1290
1302
|
}
|
|
1291
1303
|
return { message: r };
|
|
1292
1304
|
};
|
|
1293
|
-
|
|
1294
|
-
|
|
1305
|
+
Be = H;
|
|
1306
|
+
_e = (t) => {
|
|
1295
1307
|
const { data: e, path: r, errorMaps: n, issueData: s } = t, a = [...r, ...s.path || []], i = {
|
|
1296
1308
|
...s,
|
|
1297
1309
|
path: a
|
|
@@ -1312,7 +1324,7 @@ var init_shared_es = __esm({
|
|
|
1312
1324
|
message: c
|
|
1313
1325
|
};
|
|
1314
1326
|
};
|
|
1315
|
-
|
|
1327
|
+
O = class _O {
|
|
1316
1328
|
constructor() {
|
|
1317
1329
|
this.value = "valid";
|
|
1318
1330
|
}
|
|
@@ -1340,7 +1352,7 @@ var init_shared_es = __esm({
|
|
|
1340
1352
|
value: i
|
|
1341
1353
|
});
|
|
1342
1354
|
}
|
|
1343
|
-
return
|
|
1355
|
+
return _O.mergeObjectSync(e, n);
|
|
1344
1356
|
}
|
|
1345
1357
|
static mergeObjectSync(e, r) {
|
|
1346
1358
|
const n = {};
|
|
@@ -1356,16 +1368,16 @@ var init_shared_es = __esm({
|
|
|
1356
1368
|
_ = Object.freeze({
|
|
1357
1369
|
status: "aborted"
|
|
1358
1370
|
});
|
|
1359
|
-
|
|
1360
|
-
|
|
1371
|
+
K = (t) => ({ status: "dirty", value: t });
|
|
1372
|
+
N = (t) => ({ status: "valid", value: t });
|
|
1361
1373
|
Ne = (t) => t.status === "aborted";
|
|
1362
1374
|
Ae = (t) => t.status === "dirty";
|
|
1363
|
-
|
|
1364
|
-
|
|
1375
|
+
W = (t) => t.status === "valid";
|
|
1376
|
+
ne = (t) => typeof Promise < "u" && t instanceof Promise;
|
|
1365
1377
|
(function(t) {
|
|
1366
1378
|
t.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, t.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
1367
|
-
})(
|
|
1368
|
-
|
|
1379
|
+
})(m || (m = {}));
|
|
1380
|
+
M = class {
|
|
1369
1381
|
constructor(e, r, n, s) {
|
|
1370
1382
|
this._cachedPath = [], this.parent = e, this.data = r, this._path = n, this._key = s;
|
|
1371
1383
|
}
|
|
@@ -1374,7 +1386,7 @@ var init_shared_es = __esm({
|
|
|
1374
1386
|
}
|
|
1375
1387
|
};
|
|
1376
1388
|
Re = (t, e) => {
|
|
1377
|
-
if (
|
|
1389
|
+
if (W(e))
|
|
1378
1390
|
return { success: true, data: e.value };
|
|
1379
1391
|
if (!t.common.issues.length)
|
|
1380
1392
|
throw new Error("Validation failed but no issues detected.");
|
|
@@ -1383,23 +1395,23 @@ var init_shared_es = __esm({
|
|
|
1383
1395
|
get error() {
|
|
1384
1396
|
if (this._error)
|
|
1385
1397
|
return this._error;
|
|
1386
|
-
const r = new
|
|
1398
|
+
const r = new R(t.common.issues);
|
|
1387
1399
|
return this._error = r, this._error;
|
|
1388
1400
|
}
|
|
1389
1401
|
};
|
|
1390
1402
|
};
|
|
1391
|
-
|
|
1403
|
+
v = class {
|
|
1392
1404
|
get description() {
|
|
1393
1405
|
return this._def.description;
|
|
1394
1406
|
}
|
|
1395
1407
|
_getType(e) {
|
|
1396
|
-
return
|
|
1408
|
+
return j(e.data);
|
|
1397
1409
|
}
|
|
1398
1410
|
_getOrReturnCtx(e, r) {
|
|
1399
1411
|
return r || {
|
|
1400
1412
|
common: e.parent.common,
|
|
1401
1413
|
data: e.data,
|
|
1402
|
-
parsedType:
|
|
1414
|
+
parsedType: j(e.data),
|
|
1403
1415
|
schemaErrorMap: this._def.errorMap,
|
|
1404
1416
|
path: e.path,
|
|
1405
1417
|
parent: e.parent
|
|
@@ -1407,11 +1419,11 @@ var init_shared_es = __esm({
|
|
|
1407
1419
|
}
|
|
1408
1420
|
_processInputParams(e) {
|
|
1409
1421
|
return {
|
|
1410
|
-
status: new
|
|
1422
|
+
status: new O(),
|
|
1411
1423
|
ctx: {
|
|
1412
1424
|
common: e.parent.common,
|
|
1413
1425
|
data: e.data,
|
|
1414
|
-
parsedType:
|
|
1426
|
+
parsedType: j(e.data),
|
|
1415
1427
|
schemaErrorMap: this._def.errorMap,
|
|
1416
1428
|
path: e.path,
|
|
1417
1429
|
parent: e.parent
|
|
@@ -1420,7 +1432,7 @@ var init_shared_es = __esm({
|
|
|
1420
1432
|
}
|
|
1421
1433
|
_parseSync(e) {
|
|
1422
1434
|
const r = this._parse(e);
|
|
1423
|
-
if (
|
|
1435
|
+
if (ne(r))
|
|
1424
1436
|
throw new Error("Synchronous parse encountered promise.");
|
|
1425
1437
|
return r;
|
|
1426
1438
|
}
|
|
@@ -1445,7 +1457,7 @@ var init_shared_es = __esm({
|
|
|
1445
1457
|
schemaErrorMap: this._def.errorMap,
|
|
1446
1458
|
parent: null,
|
|
1447
1459
|
data: e,
|
|
1448
|
-
parsedType:
|
|
1460
|
+
parsedType: j(e)
|
|
1449
1461
|
}, s = this._parseSync({ data: e, path: n.path, parent: n });
|
|
1450
1462
|
return Re(n, s);
|
|
1451
1463
|
}
|
|
@@ -1460,12 +1472,12 @@ var init_shared_es = __esm({
|
|
|
1460
1472
|
schemaErrorMap: this._def.errorMap,
|
|
1461
1473
|
parent: null,
|
|
1462
1474
|
data: e,
|
|
1463
|
-
parsedType:
|
|
1475
|
+
parsedType: j(e)
|
|
1464
1476
|
};
|
|
1465
1477
|
if (!this["~standard"].async)
|
|
1466
1478
|
try {
|
|
1467
1479
|
const a = this._parseSync({ data: e, path: [], parent: r });
|
|
1468
|
-
return
|
|
1480
|
+
return W(a) ? {
|
|
1469
1481
|
value: a.value
|
|
1470
1482
|
} : {
|
|
1471
1483
|
issues: r.common.issues
|
|
@@ -1476,7 +1488,7 @@ var init_shared_es = __esm({
|
|
|
1476
1488
|
async: true
|
|
1477
1489
|
};
|
|
1478
1490
|
}
|
|
1479
|
-
return this._parseAsync({ data: e, path: [], parent: r }).then((a) =>
|
|
1491
|
+
return this._parseAsync({ data: e, path: [], parent: r }).then((a) => W(a) ? {
|
|
1480
1492
|
value: a.value
|
|
1481
1493
|
} : {
|
|
1482
1494
|
issues: r.common.issues
|
|
@@ -1499,8 +1511,8 @@ var init_shared_es = __esm({
|
|
|
1499
1511
|
schemaErrorMap: this._def.errorMap,
|
|
1500
1512
|
parent: null,
|
|
1501
1513
|
data: e,
|
|
1502
|
-
parsedType:
|
|
1503
|
-
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (
|
|
1514
|
+
parsedType: j(e)
|
|
1515
|
+
}, s = this._parse({ data: e, path: n.path, parent: n }), a = await (ne(s) ? s : Promise.resolve(s));
|
|
1504
1516
|
return Re(n, a);
|
|
1505
1517
|
}
|
|
1506
1518
|
refine(e, r) {
|
|
@@ -1517,7 +1529,7 @@ var init_shared_es = __esm({
|
|
|
1517
1529
|
return this._refinement((n, s) => e(n) ? true : (s.addIssue(typeof r == "function" ? r(n, s) : r), false));
|
|
1518
1530
|
}
|
|
1519
1531
|
_refinement(e) {
|
|
1520
|
-
return new
|
|
1532
|
+
return new z({
|
|
1521
1533
|
schema: this,
|
|
1522
1534
|
typeName: p.ZodEffects,
|
|
1523
1535
|
effect: { type: "refinement", refinement: e }
|
|
@@ -1534,29 +1546,29 @@ var init_shared_es = __esm({
|
|
|
1534
1546
|
};
|
|
1535
1547
|
}
|
|
1536
1548
|
optional() {
|
|
1537
|
-
return
|
|
1549
|
+
return L.create(this, this._def);
|
|
1538
1550
|
}
|
|
1539
1551
|
nullable() {
|
|
1540
|
-
return
|
|
1552
|
+
return B.create(this, this._def);
|
|
1541
1553
|
}
|
|
1542
1554
|
nullish() {
|
|
1543
1555
|
return this.nullable().optional();
|
|
1544
1556
|
}
|
|
1545
1557
|
array() {
|
|
1546
|
-
return
|
|
1558
|
+
return D.create(this);
|
|
1547
1559
|
}
|
|
1548
1560
|
promise() {
|
|
1549
|
-
return
|
|
1561
|
+
return te.create(this, this._def);
|
|
1550
1562
|
}
|
|
1551
1563
|
or(e) {
|
|
1552
|
-
return
|
|
1564
|
+
return ae.create([this, e], this._def);
|
|
1553
1565
|
}
|
|
1554
1566
|
and(e) {
|
|
1555
|
-
return
|
|
1567
|
+
return ie.create(this, e, this._def);
|
|
1556
1568
|
}
|
|
1557
1569
|
transform(e) {
|
|
1558
|
-
return new
|
|
1559
|
-
...
|
|
1570
|
+
return new z({
|
|
1571
|
+
...g(this._def),
|
|
1560
1572
|
schema: this,
|
|
1561
1573
|
typeName: p.ZodEffects,
|
|
1562
1574
|
effect: { type: "transform", transform: e }
|
|
@@ -1564,24 +1576,24 @@ var init_shared_es = __esm({
|
|
|
1564
1576
|
}
|
|
1565
1577
|
default(e) {
|
|
1566
1578
|
const r = typeof e == "function" ? e : () => e;
|
|
1567
|
-
return new
|
|
1568
|
-
...
|
|
1579
|
+
return new de({
|
|
1580
|
+
...g(this._def),
|
|
1569
1581
|
innerType: this,
|
|
1570
1582
|
defaultValue: r,
|
|
1571
1583
|
typeName: p.ZodDefault
|
|
1572
1584
|
});
|
|
1573
1585
|
}
|
|
1574
1586
|
brand() {
|
|
1575
|
-
return new
|
|
1587
|
+
return new Ve({
|
|
1576
1588
|
typeName: p.ZodBranded,
|
|
1577
1589
|
type: this,
|
|
1578
|
-
...
|
|
1590
|
+
...g(this._def)
|
|
1579
1591
|
});
|
|
1580
1592
|
}
|
|
1581
1593
|
catch(e) {
|
|
1582
1594
|
const r = typeof e == "function" ? e : () => e;
|
|
1583
|
-
return new
|
|
1584
|
-
...
|
|
1595
|
+
return new ue({
|
|
1596
|
+
...g(this._def),
|
|
1585
1597
|
innerType: this,
|
|
1586
1598
|
catchValue: r,
|
|
1587
1599
|
typeName: p.ZodCatch
|
|
@@ -1595,10 +1607,10 @@ var init_shared_es = __esm({
|
|
|
1595
1607
|
});
|
|
1596
1608
|
}
|
|
1597
1609
|
pipe(e) {
|
|
1598
|
-
return
|
|
1610
|
+
return ke.create(this, e);
|
|
1599
1611
|
}
|
|
1600
1612
|
readonly() {
|
|
1601
|
-
return
|
|
1613
|
+
return le.create(this);
|
|
1602
1614
|
}
|
|
1603
1615
|
isOptional() {
|
|
1604
1616
|
return this.safeParse(void 0).success;
|
|
@@ -1607,24 +1619,24 @@ var init_shared_es = __esm({
|
|
|
1607
1619
|
return this.safeParse(null).success;
|
|
1608
1620
|
}
|
|
1609
1621
|
};
|
|
1610
|
-
|
|
1611
|
-
|
|
1622
|
+
Ge = /^c[^\s-]{8,}$/i;
|
|
1623
|
+
qe = /^[0-9a-z]+$/;
|
|
1612
1624
|
Ye = /^[0-9A-HJKMNP-TV-Z]{26}$/i;
|
|
1613
1625
|
We = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1626
|
+
Qe = /^[a-z0-9_-]{21}$/i;
|
|
1627
|
+
Xe = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;
|
|
1628
|
+
Ke = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/;
|
|
1629
|
+
Je = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
|
|
1630
|
+
He = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1631
|
+
et = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
|
|
1632
|
+
tt = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/;
|
|
1633
|
+
rt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/;
|
|
1634
|
+
nt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
1635
|
+
st = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
|
1636
|
+
at = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/;
|
|
1637
|
+
je = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))";
|
|
1638
|
+
it = new RegExp(`^${je}$`);
|
|
1639
|
+
w = class _w extends v {
|
|
1628
1640
|
_parse(e) {
|
|
1629
1641
|
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== u.string) {
|
|
1630
1642
|
const a = this._getOrReturnCtx(e);
|
|
@@ -1634,7 +1646,7 @@ var init_shared_es = __esm({
|
|
|
1634
1646
|
received: a.parsedType
|
|
1635
1647
|
}), _;
|
|
1636
1648
|
}
|
|
1637
|
-
const n = new
|
|
1649
|
+
const n = new O();
|
|
1638
1650
|
let s;
|
|
1639
1651
|
for (const a of this._def.checks)
|
|
1640
1652
|
if (a.kind === "min")
|
|
@@ -1673,13 +1685,13 @@ var init_shared_es = __esm({
|
|
|
1673
1685
|
message: a.message
|
|
1674
1686
|
}), n.dirty());
|
|
1675
1687
|
} else if (a.kind === "email")
|
|
1676
|
-
|
|
1688
|
+
Je.test(e.data) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
1677
1689
|
validation: "email",
|
|
1678
1690
|
code: o.invalid_string,
|
|
1679
1691
|
message: a.message
|
|
1680
1692
|
}), n.dirty());
|
|
1681
1693
|
else if (a.kind === "emoji")
|
|
1682
|
-
|
|
1694
|
+
fe || (fe = new RegExp(He, "u")), fe.test(e.data) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
1683
1695
|
validation: "emoji",
|
|
1684
1696
|
code: o.invalid_string,
|
|
1685
1697
|
message: a.message
|
|
@@ -1691,19 +1703,19 @@ var init_shared_es = __esm({
|
|
|
1691
1703
|
message: a.message
|
|
1692
1704
|
}), n.dirty());
|
|
1693
1705
|
else if (a.kind === "nanoid")
|
|
1694
|
-
|
|
1706
|
+
Qe.test(e.data) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
1695
1707
|
validation: "nanoid",
|
|
1696
1708
|
code: o.invalid_string,
|
|
1697
1709
|
message: a.message
|
|
1698
1710
|
}), n.dirty());
|
|
1699
1711
|
else if (a.kind === "cuid")
|
|
1700
|
-
|
|
1712
|
+
Ge.test(e.data) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
1701
1713
|
validation: "cuid",
|
|
1702
1714
|
code: o.invalid_string,
|
|
1703
1715
|
message: a.message
|
|
1704
1716
|
}), n.dirty());
|
|
1705
1717
|
else if (a.kind === "cuid2")
|
|
1706
|
-
|
|
1718
|
+
qe.test(e.data) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
1707
1719
|
validation: "cuid2",
|
|
1708
1720
|
code: o.invalid_string,
|
|
1709
1721
|
message: a.message
|
|
@@ -1740,39 +1752,39 @@ var init_shared_es = __esm({
|
|
|
1740
1752
|
code: o.invalid_string,
|
|
1741
1753
|
validation: { endsWith: a.value },
|
|
1742
1754
|
message: a.message
|
|
1743
|
-
}), n.dirty()) : a.kind === "datetime" ?
|
|
1755
|
+
}), n.dirty()) : a.kind === "datetime" ? ot(a).test(e.data) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
1744
1756
|
code: o.invalid_string,
|
|
1745
1757
|
validation: "datetime",
|
|
1746
1758
|
message: a.message
|
|
1747
|
-
}), n.dirty()) : a.kind === "date" ?
|
|
1759
|
+
}), n.dirty()) : a.kind === "date" ? it.test(e.data) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
1748
1760
|
code: o.invalid_string,
|
|
1749
1761
|
validation: "date",
|
|
1750
1762
|
message: a.message
|
|
1751
|
-
}), n.dirty()) : a.kind === "time" ?
|
|
1763
|
+
}), n.dirty()) : a.kind === "time" ? ct(a).test(e.data) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
1752
1764
|
code: o.invalid_string,
|
|
1753
1765
|
validation: "time",
|
|
1754
1766
|
message: a.message
|
|
1755
|
-
}), n.dirty()) : a.kind === "duration" ?
|
|
1767
|
+
}), n.dirty()) : a.kind === "duration" ? Ke.test(e.data) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
1756
1768
|
validation: "duration",
|
|
1757
1769
|
code: o.invalid_string,
|
|
1758
1770
|
message: a.message
|
|
1759
|
-
}), n.dirty()) : a.kind === "ip" ?
|
|
1771
|
+
}), n.dirty()) : a.kind === "ip" ? dt(e.data, a.version) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
1760
1772
|
validation: "ip",
|
|
1761
1773
|
code: o.invalid_string,
|
|
1762
1774
|
message: a.message
|
|
1763
|
-
}), n.dirty()) : a.kind === "jwt" ?
|
|
1775
|
+
}), n.dirty()) : a.kind === "jwt" ? ut(e.data, a.alg) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
1764
1776
|
validation: "jwt",
|
|
1765
1777
|
code: o.invalid_string,
|
|
1766
1778
|
message: a.message
|
|
1767
|
-
}), n.dirty()) : a.kind === "cidr" ?
|
|
1779
|
+
}), n.dirty()) : a.kind === "cidr" ? lt(e.data, a.version) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
1768
1780
|
validation: "cidr",
|
|
1769
1781
|
code: o.invalid_string,
|
|
1770
1782
|
message: a.message
|
|
1771
|
-
}), n.dirty()) : a.kind === "base64" ?
|
|
1783
|
+
}), n.dirty()) : a.kind === "base64" ? st.test(e.data) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
1772
1784
|
validation: "base64",
|
|
1773
1785
|
code: o.invalid_string,
|
|
1774
1786
|
message: a.message
|
|
1775
|
-
}), n.dirty()) : a.kind === "base64url" ?
|
|
1787
|
+
}), n.dirty()) : a.kind === "base64url" ? at.test(e.data) || (s = this._getOrReturnCtx(e, s), d(s, {
|
|
1776
1788
|
validation: "base64url",
|
|
1777
1789
|
code: o.invalid_string,
|
|
1778
1790
|
message: a.message
|
|
@@ -1783,56 +1795,56 @@ var init_shared_es = __esm({
|
|
|
1783
1795
|
return this.refinement((s) => e.test(s), {
|
|
1784
1796
|
validation: r,
|
|
1785
1797
|
code: o.invalid_string,
|
|
1786
|
-
...
|
|
1798
|
+
...m.errToObj(n)
|
|
1787
1799
|
});
|
|
1788
1800
|
}
|
|
1789
1801
|
_addCheck(e) {
|
|
1790
|
-
return new
|
|
1802
|
+
return new _w({
|
|
1791
1803
|
...this._def,
|
|
1792
1804
|
checks: [...this._def.checks, e]
|
|
1793
1805
|
});
|
|
1794
1806
|
}
|
|
1795
1807
|
email(e) {
|
|
1796
|
-
return this._addCheck({ kind: "email", ...
|
|
1808
|
+
return this._addCheck({ kind: "email", ...m.errToObj(e) });
|
|
1797
1809
|
}
|
|
1798
1810
|
url(e) {
|
|
1799
|
-
return this._addCheck({ kind: "url", ...
|
|
1811
|
+
return this._addCheck({ kind: "url", ...m.errToObj(e) });
|
|
1800
1812
|
}
|
|
1801
1813
|
emoji(e) {
|
|
1802
|
-
return this._addCheck({ kind: "emoji", ...
|
|
1814
|
+
return this._addCheck({ kind: "emoji", ...m.errToObj(e) });
|
|
1803
1815
|
}
|
|
1804
1816
|
uuid(e) {
|
|
1805
|
-
return this._addCheck({ kind: "uuid", ...
|
|
1817
|
+
return this._addCheck({ kind: "uuid", ...m.errToObj(e) });
|
|
1806
1818
|
}
|
|
1807
1819
|
nanoid(e) {
|
|
1808
|
-
return this._addCheck({ kind: "nanoid", ...
|
|
1820
|
+
return this._addCheck({ kind: "nanoid", ...m.errToObj(e) });
|
|
1809
1821
|
}
|
|
1810
1822
|
cuid(e) {
|
|
1811
|
-
return this._addCheck({ kind: "cuid", ...
|
|
1823
|
+
return this._addCheck({ kind: "cuid", ...m.errToObj(e) });
|
|
1812
1824
|
}
|
|
1813
1825
|
cuid2(e) {
|
|
1814
|
-
return this._addCheck({ kind: "cuid2", ...
|
|
1826
|
+
return this._addCheck({ kind: "cuid2", ...m.errToObj(e) });
|
|
1815
1827
|
}
|
|
1816
1828
|
ulid(e) {
|
|
1817
|
-
return this._addCheck({ kind: "ulid", ...
|
|
1829
|
+
return this._addCheck({ kind: "ulid", ...m.errToObj(e) });
|
|
1818
1830
|
}
|
|
1819
1831
|
base64(e) {
|
|
1820
|
-
return this._addCheck({ kind: "base64", ...
|
|
1832
|
+
return this._addCheck({ kind: "base64", ...m.errToObj(e) });
|
|
1821
1833
|
}
|
|
1822
1834
|
base64url(e) {
|
|
1823
1835
|
return this._addCheck({
|
|
1824
1836
|
kind: "base64url",
|
|
1825
|
-
...
|
|
1837
|
+
...m.errToObj(e)
|
|
1826
1838
|
});
|
|
1827
1839
|
}
|
|
1828
1840
|
jwt(e) {
|
|
1829
|
-
return this._addCheck({ kind: "jwt", ...
|
|
1841
|
+
return this._addCheck({ kind: "jwt", ...m.errToObj(e) });
|
|
1830
1842
|
}
|
|
1831
1843
|
ip(e) {
|
|
1832
|
-
return this._addCheck({ kind: "ip", ...
|
|
1844
|
+
return this._addCheck({ kind: "ip", ...m.errToObj(e) });
|
|
1833
1845
|
}
|
|
1834
1846
|
cidr(e) {
|
|
1835
|
-
return this._addCheck({ kind: "cidr", ...
|
|
1847
|
+
return this._addCheck({ kind: "cidr", ...m.errToObj(e) });
|
|
1836
1848
|
}
|
|
1837
1849
|
datetime(e) {
|
|
1838
1850
|
return typeof e == "string" ? this._addCheck({
|
|
@@ -1846,7 +1858,7 @@ var init_shared_es = __esm({
|
|
|
1846
1858
|
precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
|
|
1847
1859
|
offset: (e == null ? void 0 : e.offset) ?? false,
|
|
1848
1860
|
local: (e == null ? void 0 : e.local) ?? false,
|
|
1849
|
-
...
|
|
1861
|
+
...m.errToObj(e == null ? void 0 : e.message)
|
|
1850
1862
|
});
|
|
1851
1863
|
}
|
|
1852
1864
|
date(e) {
|
|
@@ -1860,17 +1872,17 @@ var init_shared_es = __esm({
|
|
|
1860
1872
|
}) : this._addCheck({
|
|
1861
1873
|
kind: "time",
|
|
1862
1874
|
precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
|
|
1863
|
-
...
|
|
1875
|
+
...m.errToObj(e == null ? void 0 : e.message)
|
|
1864
1876
|
});
|
|
1865
1877
|
}
|
|
1866
1878
|
duration(e) {
|
|
1867
|
-
return this._addCheck({ kind: "duration", ...
|
|
1879
|
+
return this._addCheck({ kind: "duration", ...m.errToObj(e) });
|
|
1868
1880
|
}
|
|
1869
1881
|
regex(e, r) {
|
|
1870
1882
|
return this._addCheck({
|
|
1871
1883
|
kind: "regex",
|
|
1872
1884
|
regex: e,
|
|
1873
|
-
...
|
|
1885
|
+
...m.errToObj(r)
|
|
1874
1886
|
});
|
|
1875
1887
|
}
|
|
1876
1888
|
includes(e, r) {
|
|
@@ -1878,64 +1890,64 @@ var init_shared_es = __esm({
|
|
|
1878
1890
|
kind: "includes",
|
|
1879
1891
|
value: e,
|
|
1880
1892
|
position: r == null ? void 0 : r.position,
|
|
1881
|
-
...
|
|
1893
|
+
...m.errToObj(r == null ? void 0 : r.message)
|
|
1882
1894
|
});
|
|
1883
1895
|
}
|
|
1884
1896
|
startsWith(e, r) {
|
|
1885
1897
|
return this._addCheck({
|
|
1886
1898
|
kind: "startsWith",
|
|
1887
1899
|
value: e,
|
|
1888
|
-
...
|
|
1900
|
+
...m.errToObj(r)
|
|
1889
1901
|
});
|
|
1890
1902
|
}
|
|
1891
1903
|
endsWith(e, r) {
|
|
1892
1904
|
return this._addCheck({
|
|
1893
1905
|
kind: "endsWith",
|
|
1894
1906
|
value: e,
|
|
1895
|
-
...
|
|
1907
|
+
...m.errToObj(r)
|
|
1896
1908
|
});
|
|
1897
1909
|
}
|
|
1898
1910
|
min(e, r) {
|
|
1899
1911
|
return this._addCheck({
|
|
1900
1912
|
kind: "min",
|
|
1901
1913
|
value: e,
|
|
1902
|
-
...
|
|
1914
|
+
...m.errToObj(r)
|
|
1903
1915
|
});
|
|
1904
1916
|
}
|
|
1905
1917
|
max(e, r) {
|
|
1906
1918
|
return this._addCheck({
|
|
1907
1919
|
kind: "max",
|
|
1908
1920
|
value: e,
|
|
1909
|
-
...
|
|
1921
|
+
...m.errToObj(r)
|
|
1910
1922
|
});
|
|
1911
1923
|
}
|
|
1912
1924
|
length(e, r) {
|
|
1913
1925
|
return this._addCheck({
|
|
1914
1926
|
kind: "length",
|
|
1915
1927
|
value: e,
|
|
1916
|
-
...
|
|
1928
|
+
...m.errToObj(r)
|
|
1917
1929
|
});
|
|
1918
1930
|
}
|
|
1919
1931
|
/**
|
|
1920
1932
|
* Equivalent to `.min(1)`
|
|
1921
1933
|
*/
|
|
1922
1934
|
nonempty(e) {
|
|
1923
|
-
return this.min(1,
|
|
1935
|
+
return this.min(1, m.errToObj(e));
|
|
1924
1936
|
}
|
|
1925
1937
|
trim() {
|
|
1926
|
-
return new
|
|
1938
|
+
return new _w({
|
|
1927
1939
|
...this._def,
|
|
1928
1940
|
checks: [...this._def.checks, { kind: "trim" }]
|
|
1929
1941
|
});
|
|
1930
1942
|
}
|
|
1931
1943
|
toLowerCase() {
|
|
1932
|
-
return new
|
|
1944
|
+
return new _w({
|
|
1933
1945
|
...this._def,
|
|
1934
1946
|
checks: [...this._def.checks, { kind: "toLowerCase" }]
|
|
1935
1947
|
});
|
|
1936
1948
|
}
|
|
1937
1949
|
toUpperCase() {
|
|
1938
|
-
return new
|
|
1950
|
+
return new _w({
|
|
1939
1951
|
...this._def,
|
|
1940
1952
|
checks: [...this._def.checks, { kind: "toUpperCase" }]
|
|
1941
1953
|
});
|
|
@@ -2001,13 +2013,13 @@ var init_shared_es = __esm({
|
|
|
2001
2013
|
return e;
|
|
2002
2014
|
}
|
|
2003
2015
|
};
|
|
2004
|
-
|
|
2016
|
+
w.create = (t) => new w({
|
|
2005
2017
|
checks: [],
|
|
2006
2018
|
typeName: p.ZodString,
|
|
2007
2019
|
coerce: (t == null ? void 0 : t.coerce) ?? false,
|
|
2008
|
-
...
|
|
2020
|
+
...g(t)
|
|
2009
2021
|
});
|
|
2010
|
-
|
|
2022
|
+
$ = class _$ extends v {
|
|
2011
2023
|
constructor() {
|
|
2012
2024
|
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
2013
2025
|
}
|
|
@@ -2021,7 +2033,7 @@ var init_shared_es = __esm({
|
|
|
2021
2033
|
}), _;
|
|
2022
2034
|
}
|
|
2023
2035
|
let n;
|
|
2024
|
-
const s = new
|
|
2036
|
+
const s = new O();
|
|
2025
2037
|
for (const a of this._def.checks)
|
|
2026
2038
|
a.kind === "int" ? E.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), d(n, {
|
|
2027
2039
|
code: o.invalid_type,
|
|
@@ -2042,7 +2054,7 @@ var init_shared_es = __esm({
|
|
|
2042
2054
|
inclusive: a.inclusive,
|
|
2043
2055
|
exact: false,
|
|
2044
2056
|
message: a.message
|
|
2045
|
-
}), s.dirty()) : a.kind === "multipleOf" ?
|
|
2057
|
+
}), s.dirty()) : a.kind === "multipleOf" ? ht(e.data, a.value) !== 0 && (n = this._getOrReturnCtx(e, n), d(n, {
|
|
2046
2058
|
code: o.not_multiple_of,
|
|
2047
2059
|
multipleOf: a.value,
|
|
2048
2060
|
message: a.message
|
|
@@ -2053,19 +2065,19 @@ var init_shared_es = __esm({
|
|
|
2053
2065
|
return { status: s.value, value: e.data };
|
|
2054
2066
|
}
|
|
2055
2067
|
gte(e, r) {
|
|
2056
|
-
return this.setLimit("min", e, true,
|
|
2068
|
+
return this.setLimit("min", e, true, m.toString(r));
|
|
2057
2069
|
}
|
|
2058
2070
|
gt(e, r) {
|
|
2059
|
-
return this.setLimit("min", e, false,
|
|
2071
|
+
return this.setLimit("min", e, false, m.toString(r));
|
|
2060
2072
|
}
|
|
2061
2073
|
lte(e, r) {
|
|
2062
|
-
return this.setLimit("max", e, true,
|
|
2074
|
+
return this.setLimit("max", e, true, m.toString(r));
|
|
2063
2075
|
}
|
|
2064
2076
|
lt(e, r) {
|
|
2065
|
-
return this.setLimit("max", e, false,
|
|
2077
|
+
return this.setLimit("max", e, false, m.toString(r));
|
|
2066
2078
|
}
|
|
2067
2079
|
setLimit(e, r, n, s) {
|
|
2068
|
-
return new
|
|
2080
|
+
return new _$({
|
|
2069
2081
|
...this._def,
|
|
2070
2082
|
checks: [
|
|
2071
2083
|
...this._def.checks,
|
|
@@ -2073,13 +2085,13 @@ var init_shared_es = __esm({
|
|
|
2073
2085
|
kind: e,
|
|
2074
2086
|
value: r,
|
|
2075
2087
|
inclusive: n,
|
|
2076
|
-
message:
|
|
2088
|
+
message: m.toString(s)
|
|
2077
2089
|
}
|
|
2078
2090
|
]
|
|
2079
2091
|
});
|
|
2080
2092
|
}
|
|
2081
2093
|
_addCheck(e) {
|
|
2082
|
-
return new
|
|
2094
|
+
return new _$({
|
|
2083
2095
|
...this._def,
|
|
2084
2096
|
checks: [...this._def.checks, e]
|
|
2085
2097
|
});
|
|
@@ -2087,7 +2099,7 @@ var init_shared_es = __esm({
|
|
|
2087
2099
|
int(e) {
|
|
2088
2100
|
return this._addCheck({
|
|
2089
2101
|
kind: "int",
|
|
2090
|
-
message:
|
|
2102
|
+
message: m.toString(e)
|
|
2091
2103
|
});
|
|
2092
2104
|
}
|
|
2093
2105
|
positive(e) {
|
|
@@ -2095,7 +2107,7 @@ var init_shared_es = __esm({
|
|
|
2095
2107
|
kind: "min",
|
|
2096
2108
|
value: 0,
|
|
2097
2109
|
inclusive: false,
|
|
2098
|
-
message:
|
|
2110
|
+
message: m.toString(e)
|
|
2099
2111
|
});
|
|
2100
2112
|
}
|
|
2101
2113
|
negative(e) {
|
|
@@ -2103,7 +2115,7 @@ var init_shared_es = __esm({
|
|
|
2103
2115
|
kind: "max",
|
|
2104
2116
|
value: 0,
|
|
2105
2117
|
inclusive: false,
|
|
2106
|
-
message:
|
|
2118
|
+
message: m.toString(e)
|
|
2107
2119
|
});
|
|
2108
2120
|
}
|
|
2109
2121
|
nonpositive(e) {
|
|
@@ -2111,7 +2123,7 @@ var init_shared_es = __esm({
|
|
|
2111
2123
|
kind: "max",
|
|
2112
2124
|
value: 0,
|
|
2113
2125
|
inclusive: true,
|
|
2114
|
-
message:
|
|
2126
|
+
message: m.toString(e)
|
|
2115
2127
|
});
|
|
2116
2128
|
}
|
|
2117
2129
|
nonnegative(e) {
|
|
@@ -2119,20 +2131,20 @@ var init_shared_es = __esm({
|
|
|
2119
2131
|
kind: "min",
|
|
2120
2132
|
value: 0,
|
|
2121
2133
|
inclusive: true,
|
|
2122
|
-
message:
|
|
2134
|
+
message: m.toString(e)
|
|
2123
2135
|
});
|
|
2124
2136
|
}
|
|
2125
2137
|
multipleOf(e, r) {
|
|
2126
2138
|
return this._addCheck({
|
|
2127
2139
|
kind: "multipleOf",
|
|
2128
2140
|
value: e,
|
|
2129
|
-
message:
|
|
2141
|
+
message: m.toString(r)
|
|
2130
2142
|
});
|
|
2131
2143
|
}
|
|
2132
2144
|
finite(e) {
|
|
2133
2145
|
return this._addCheck({
|
|
2134
2146
|
kind: "finite",
|
|
2135
|
-
message:
|
|
2147
|
+
message: m.toString(e)
|
|
2136
2148
|
});
|
|
2137
2149
|
}
|
|
2138
2150
|
safe(e) {
|
|
@@ -2140,12 +2152,12 @@ var init_shared_es = __esm({
|
|
|
2140
2152
|
kind: "min",
|
|
2141
2153
|
inclusive: true,
|
|
2142
2154
|
value: Number.MIN_SAFE_INTEGER,
|
|
2143
|
-
message:
|
|
2155
|
+
message: m.toString(e)
|
|
2144
2156
|
})._addCheck({
|
|
2145
2157
|
kind: "max",
|
|
2146
2158
|
inclusive: true,
|
|
2147
2159
|
value: Number.MAX_SAFE_INTEGER,
|
|
2148
|
-
message:
|
|
2160
|
+
message: m.toString(e)
|
|
2149
2161
|
});
|
|
2150
2162
|
}
|
|
2151
2163
|
get minValue() {
|
|
@@ -2173,13 +2185,13 @@ var init_shared_es = __esm({
|
|
|
2173
2185
|
return Number.isFinite(r) && Number.isFinite(e);
|
|
2174
2186
|
}
|
|
2175
2187
|
};
|
|
2176
|
-
|
|
2188
|
+
$.create = (t) => new $({
|
|
2177
2189
|
checks: [],
|
|
2178
2190
|
typeName: p.ZodNumber,
|
|
2179
2191
|
coerce: (t == null ? void 0 : t.coerce) || false,
|
|
2180
|
-
...
|
|
2192
|
+
...g(t)
|
|
2181
2193
|
});
|
|
2182
|
-
|
|
2194
|
+
V = class _V extends v {
|
|
2183
2195
|
constructor() {
|
|
2184
2196
|
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
2185
2197
|
}
|
|
@@ -2193,7 +2205,7 @@ var init_shared_es = __esm({
|
|
|
2193
2205
|
if (this._getType(e) !== u.bigint)
|
|
2194
2206
|
return this._getInvalidInput(e);
|
|
2195
2207
|
let n;
|
|
2196
|
-
const s = new
|
|
2208
|
+
const s = new O();
|
|
2197
2209
|
for (const a of this._def.checks)
|
|
2198
2210
|
a.kind === "min" ? (a.inclusive ? e.data < a.value : e.data <= a.value) && (n = this._getOrReturnCtx(e, n), d(n, {
|
|
2199
2211
|
code: o.too_small,
|
|
@@ -2223,19 +2235,19 @@ var init_shared_es = __esm({
|
|
|
2223
2235
|
}), _;
|
|
2224
2236
|
}
|
|
2225
2237
|
gte(e, r) {
|
|
2226
|
-
return this.setLimit("min", e, true,
|
|
2238
|
+
return this.setLimit("min", e, true, m.toString(r));
|
|
2227
2239
|
}
|
|
2228
2240
|
gt(e, r) {
|
|
2229
|
-
return this.setLimit("min", e, false,
|
|
2241
|
+
return this.setLimit("min", e, false, m.toString(r));
|
|
2230
2242
|
}
|
|
2231
2243
|
lte(e, r) {
|
|
2232
|
-
return this.setLimit("max", e, true,
|
|
2244
|
+
return this.setLimit("max", e, true, m.toString(r));
|
|
2233
2245
|
}
|
|
2234
2246
|
lt(e, r) {
|
|
2235
|
-
return this.setLimit("max", e, false,
|
|
2247
|
+
return this.setLimit("max", e, false, m.toString(r));
|
|
2236
2248
|
}
|
|
2237
2249
|
setLimit(e, r, n, s) {
|
|
2238
|
-
return new
|
|
2250
|
+
return new _V({
|
|
2239
2251
|
...this._def,
|
|
2240
2252
|
checks: [
|
|
2241
2253
|
...this._def.checks,
|
|
@@ -2243,13 +2255,13 @@ var init_shared_es = __esm({
|
|
|
2243
2255
|
kind: e,
|
|
2244
2256
|
value: r,
|
|
2245
2257
|
inclusive: n,
|
|
2246
|
-
message:
|
|
2258
|
+
message: m.toString(s)
|
|
2247
2259
|
}
|
|
2248
2260
|
]
|
|
2249
2261
|
});
|
|
2250
2262
|
}
|
|
2251
2263
|
_addCheck(e) {
|
|
2252
|
-
return new
|
|
2264
|
+
return new _V({
|
|
2253
2265
|
...this._def,
|
|
2254
2266
|
checks: [...this._def.checks, e]
|
|
2255
2267
|
});
|
|
@@ -2259,7 +2271,7 @@ var init_shared_es = __esm({
|
|
|
2259
2271
|
kind: "min",
|
|
2260
2272
|
value: BigInt(0),
|
|
2261
2273
|
inclusive: false,
|
|
2262
|
-
message:
|
|
2274
|
+
message: m.toString(e)
|
|
2263
2275
|
});
|
|
2264
2276
|
}
|
|
2265
2277
|
negative(e) {
|
|
@@ -2267,7 +2279,7 @@ var init_shared_es = __esm({
|
|
|
2267
2279
|
kind: "max",
|
|
2268
2280
|
value: BigInt(0),
|
|
2269
2281
|
inclusive: false,
|
|
2270
|
-
message:
|
|
2282
|
+
message: m.toString(e)
|
|
2271
2283
|
});
|
|
2272
2284
|
}
|
|
2273
2285
|
nonpositive(e) {
|
|
@@ -2275,7 +2287,7 @@ var init_shared_es = __esm({
|
|
|
2275
2287
|
kind: "max",
|
|
2276
2288
|
value: BigInt(0),
|
|
2277
2289
|
inclusive: true,
|
|
2278
|
-
message:
|
|
2290
|
+
message: m.toString(e)
|
|
2279
2291
|
});
|
|
2280
2292
|
}
|
|
2281
2293
|
nonnegative(e) {
|
|
@@ -2283,14 +2295,14 @@ var init_shared_es = __esm({
|
|
|
2283
2295
|
kind: "min",
|
|
2284
2296
|
value: BigInt(0),
|
|
2285
2297
|
inclusive: true,
|
|
2286
|
-
message:
|
|
2298
|
+
message: m.toString(e)
|
|
2287
2299
|
});
|
|
2288
2300
|
}
|
|
2289
2301
|
multipleOf(e, r) {
|
|
2290
2302
|
return this._addCheck({
|
|
2291
2303
|
kind: "multipleOf",
|
|
2292
2304
|
value: e,
|
|
2293
|
-
message:
|
|
2305
|
+
message: m.toString(r)
|
|
2294
2306
|
});
|
|
2295
2307
|
}
|
|
2296
2308
|
get minValue() {
|
|
@@ -2306,13 +2318,13 @@ var init_shared_es = __esm({
|
|
|
2306
2318
|
return e;
|
|
2307
2319
|
}
|
|
2308
2320
|
};
|
|
2309
|
-
|
|
2321
|
+
V.create = (t) => new V({
|
|
2310
2322
|
checks: [],
|
|
2311
2323
|
typeName: p.ZodBigInt,
|
|
2312
2324
|
coerce: (t == null ? void 0 : t.coerce) ?? false,
|
|
2313
|
-
...
|
|
2325
|
+
...g(t)
|
|
2314
2326
|
});
|
|
2315
|
-
|
|
2327
|
+
se = class extends v {
|
|
2316
2328
|
_parse(e) {
|
|
2317
2329
|
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== u.boolean) {
|
|
2318
2330
|
const n = this._getOrReturnCtx(e);
|
|
@@ -2322,15 +2334,15 @@ var init_shared_es = __esm({
|
|
|
2322
2334
|
received: n.parsedType
|
|
2323
2335
|
}), _;
|
|
2324
2336
|
}
|
|
2325
|
-
return
|
|
2337
|
+
return N(e.data);
|
|
2326
2338
|
}
|
|
2327
2339
|
};
|
|
2328
|
-
|
|
2340
|
+
se.create = (t) => new se({
|
|
2329
2341
|
typeName: p.ZodBoolean,
|
|
2330
2342
|
coerce: (t == null ? void 0 : t.coerce) || false,
|
|
2331
|
-
...
|
|
2343
|
+
...g(t)
|
|
2332
2344
|
});
|
|
2333
|
-
|
|
2345
|
+
Q = class _Q extends v {
|
|
2334
2346
|
_parse(e) {
|
|
2335
2347
|
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== u.date) {
|
|
2336
2348
|
const a = this._getOrReturnCtx(e);
|
|
@@ -2346,7 +2358,7 @@ var init_shared_es = __esm({
|
|
|
2346
2358
|
code: o.invalid_date
|
|
2347
2359
|
}), _;
|
|
2348
2360
|
}
|
|
2349
|
-
const n = new
|
|
2361
|
+
const n = new O();
|
|
2350
2362
|
let s;
|
|
2351
2363
|
for (const a of this._def.checks)
|
|
2352
2364
|
a.kind === "min" ? e.data.getTime() < a.value && (s = this._getOrReturnCtx(e, s), d(s, {
|
|
@@ -2370,7 +2382,7 @@ var init_shared_es = __esm({
|
|
|
2370
2382
|
};
|
|
2371
2383
|
}
|
|
2372
2384
|
_addCheck(e) {
|
|
2373
|
-
return new
|
|
2385
|
+
return new _Q({
|
|
2374
2386
|
...this._def,
|
|
2375
2387
|
checks: [...this._def.checks, e]
|
|
2376
2388
|
});
|
|
@@ -2379,14 +2391,14 @@ var init_shared_es = __esm({
|
|
|
2379
2391
|
return this._addCheck({
|
|
2380
2392
|
kind: "min",
|
|
2381
2393
|
value: e.getTime(),
|
|
2382
|
-
message:
|
|
2394
|
+
message: m.toString(r)
|
|
2383
2395
|
});
|
|
2384
2396
|
}
|
|
2385
2397
|
max(e, r) {
|
|
2386
2398
|
return this._addCheck({
|
|
2387
2399
|
kind: "max",
|
|
2388
2400
|
value: e.getTime(),
|
|
2389
|
-
message:
|
|
2401
|
+
message: m.toString(r)
|
|
2390
2402
|
});
|
|
2391
2403
|
}
|
|
2392
2404
|
get minDate() {
|
|
@@ -2402,13 +2414,13 @@ var init_shared_es = __esm({
|
|
|
2402
2414
|
return e != null ? new Date(e) : null;
|
|
2403
2415
|
}
|
|
2404
2416
|
};
|
|
2405
|
-
|
|
2417
|
+
Q.create = (t) => new Q({
|
|
2406
2418
|
checks: [],
|
|
2407
2419
|
coerce: (t == null ? void 0 : t.coerce) || false,
|
|
2408
2420
|
typeName: p.ZodDate,
|
|
2409
|
-
...
|
|
2421
|
+
...g(t)
|
|
2410
2422
|
});
|
|
2411
|
-
Ie = class extends
|
|
2423
|
+
Ie = class extends v {
|
|
2412
2424
|
_parse(e) {
|
|
2413
2425
|
if (this._getType(e) !== u.symbol) {
|
|
2414
2426
|
const n = this._getOrReturnCtx(e);
|
|
@@ -2418,14 +2430,14 @@ var init_shared_es = __esm({
|
|
|
2418
2430
|
received: n.parsedType
|
|
2419
2431
|
}), _;
|
|
2420
2432
|
}
|
|
2421
|
-
return
|
|
2433
|
+
return N(e.data);
|
|
2422
2434
|
}
|
|
2423
2435
|
};
|
|
2424
2436
|
Ie.create = (t) => new Ie({
|
|
2425
2437
|
typeName: p.ZodSymbol,
|
|
2426
|
-
...
|
|
2438
|
+
...g(t)
|
|
2427
2439
|
});
|
|
2428
|
-
pe = class extends
|
|
2440
|
+
pe = class extends v {
|
|
2429
2441
|
_parse(e) {
|
|
2430
2442
|
if (this._getType(e) !== u.undefined) {
|
|
2431
2443
|
const n = this._getOrReturnCtx(e);
|
|
@@ -2435,14 +2447,14 @@ var init_shared_es = __esm({
|
|
|
2435
2447
|
received: n.parsedType
|
|
2436
2448
|
}), _;
|
|
2437
2449
|
}
|
|
2438
|
-
return
|
|
2450
|
+
return N(e.data);
|
|
2439
2451
|
}
|
|
2440
2452
|
};
|
|
2441
2453
|
pe.create = (t) => new pe({
|
|
2442
2454
|
typeName: p.ZodUndefined,
|
|
2443
|
-
...
|
|
2455
|
+
...g(t)
|
|
2444
2456
|
});
|
|
2445
|
-
ye = class extends
|
|
2457
|
+
ye = class extends v {
|
|
2446
2458
|
_parse(e) {
|
|
2447
2459
|
if (this._getType(e) !== u.null) {
|
|
2448
2460
|
const n = this._getOrReturnCtx(e);
|
|
@@ -2452,38 +2464,38 @@ var init_shared_es = __esm({
|
|
|
2452
2464
|
received: n.parsedType
|
|
2453
2465
|
}), _;
|
|
2454
2466
|
}
|
|
2455
|
-
return
|
|
2467
|
+
return N(e.data);
|
|
2456
2468
|
}
|
|
2457
2469
|
};
|
|
2458
2470
|
ye.create = (t) => new ye({
|
|
2459
2471
|
typeName: p.ZodNull,
|
|
2460
|
-
...
|
|
2472
|
+
...g(t)
|
|
2461
2473
|
});
|
|
2462
|
-
we = class extends
|
|
2474
|
+
we = class extends v {
|
|
2463
2475
|
constructor() {
|
|
2464
2476
|
super(...arguments), this._any = true;
|
|
2465
2477
|
}
|
|
2466
2478
|
_parse(e) {
|
|
2467
|
-
return
|
|
2479
|
+
return N(e.data);
|
|
2468
2480
|
}
|
|
2469
2481
|
};
|
|
2470
2482
|
we.create = (t) => new we({
|
|
2471
2483
|
typeName: p.ZodAny,
|
|
2472
|
-
...
|
|
2484
|
+
...g(t)
|
|
2473
2485
|
});
|
|
2474
|
-
|
|
2486
|
+
Y = class extends v {
|
|
2475
2487
|
constructor() {
|
|
2476
2488
|
super(...arguments), this._unknown = true;
|
|
2477
2489
|
}
|
|
2478
2490
|
_parse(e) {
|
|
2479
|
-
return
|
|
2491
|
+
return N(e.data);
|
|
2480
2492
|
}
|
|
2481
2493
|
};
|
|
2482
|
-
|
|
2494
|
+
Y.create = (t) => new Y({
|
|
2483
2495
|
typeName: p.ZodUnknown,
|
|
2484
|
-
...
|
|
2496
|
+
...g(t)
|
|
2485
2497
|
});
|
|
2486
|
-
|
|
2498
|
+
C = class extends v {
|
|
2487
2499
|
_parse(e) {
|
|
2488
2500
|
const r = this._getOrReturnCtx(e);
|
|
2489
2501
|
return d(r, {
|
|
@@ -2493,11 +2505,11 @@ var init_shared_es = __esm({
|
|
|
2493
2505
|
}), _;
|
|
2494
2506
|
}
|
|
2495
2507
|
};
|
|
2496
|
-
|
|
2508
|
+
C.create = (t) => new C({
|
|
2497
2509
|
typeName: p.ZodNever,
|
|
2498
|
-
...
|
|
2510
|
+
...g(t)
|
|
2499
2511
|
});
|
|
2500
|
-
De = class extends
|
|
2512
|
+
De = class extends v {
|
|
2501
2513
|
_parse(e) {
|
|
2502
2514
|
if (this._getType(e) !== u.undefined) {
|
|
2503
2515
|
const n = this._getOrReturnCtx(e);
|
|
@@ -2507,14 +2519,14 @@ var init_shared_es = __esm({
|
|
|
2507
2519
|
received: n.parsedType
|
|
2508
2520
|
}), _;
|
|
2509
2521
|
}
|
|
2510
|
-
return
|
|
2522
|
+
return N(e.data);
|
|
2511
2523
|
}
|
|
2512
2524
|
};
|
|
2513
2525
|
De.create = (t) => new De({
|
|
2514
2526
|
typeName: p.ZodVoid,
|
|
2515
|
-
...
|
|
2527
|
+
...g(t)
|
|
2516
2528
|
});
|
|
2517
|
-
|
|
2529
|
+
D = class _D extends v {
|
|
2518
2530
|
_parse(e) {
|
|
2519
2531
|
const { ctx: r, status: n } = this._processInputParams(e), s = this._def;
|
|
2520
2532
|
if (r.parsedType !== u.array)
|
|
@@ -2550,44 +2562,44 @@ var init_shared_es = __esm({
|
|
|
2550
2562
|
exact: false,
|
|
2551
2563
|
message: s.maxLength.message
|
|
2552
2564
|
}), n.dirty()), r.common.async)
|
|
2553
|
-
return Promise.all([...r.data].map((i, c) => s.type._parseAsync(new
|
|
2554
|
-
const a = [...r.data].map((i, c) => s.type._parseSync(new
|
|
2555
|
-
return
|
|
2565
|
+
return Promise.all([...r.data].map((i, c) => s.type._parseAsync(new M(r, i, r.path, c)))).then((i) => O.mergeArray(n, i));
|
|
2566
|
+
const a = [...r.data].map((i, c) => s.type._parseSync(new M(r, i, r.path, c)));
|
|
2567
|
+
return O.mergeArray(n, a);
|
|
2556
2568
|
}
|
|
2557
2569
|
get element() {
|
|
2558
2570
|
return this._def.type;
|
|
2559
2571
|
}
|
|
2560
2572
|
min(e, r) {
|
|
2561
|
-
return new
|
|
2573
|
+
return new _D({
|
|
2562
2574
|
...this._def,
|
|
2563
|
-
minLength: { value: e, message:
|
|
2575
|
+
minLength: { value: e, message: m.toString(r) }
|
|
2564
2576
|
});
|
|
2565
2577
|
}
|
|
2566
2578
|
max(e, r) {
|
|
2567
|
-
return new
|
|
2579
|
+
return new _D({
|
|
2568
2580
|
...this._def,
|
|
2569
|
-
maxLength: { value: e, message:
|
|
2581
|
+
maxLength: { value: e, message: m.toString(r) }
|
|
2570
2582
|
});
|
|
2571
2583
|
}
|
|
2572
2584
|
length(e, r) {
|
|
2573
|
-
return new
|
|
2585
|
+
return new _D({
|
|
2574
2586
|
...this._def,
|
|
2575
|
-
exactLength: { value: e, message:
|
|
2587
|
+
exactLength: { value: e, message: m.toString(r) }
|
|
2576
2588
|
});
|
|
2577
2589
|
}
|
|
2578
2590
|
nonempty(e) {
|
|
2579
2591
|
return this.min(1, e);
|
|
2580
2592
|
}
|
|
2581
2593
|
};
|
|
2582
|
-
|
|
2594
|
+
D.create = (t, e) => new D({
|
|
2583
2595
|
type: t,
|
|
2584
2596
|
minLength: null,
|
|
2585
2597
|
maxLength: null,
|
|
2586
2598
|
exactLength: null,
|
|
2587
2599
|
typeName: p.ZodArray,
|
|
2588
|
-
...
|
|
2600
|
+
...g(e)
|
|
2589
2601
|
});
|
|
2590
|
-
x = class _x extends
|
|
2602
|
+
x = class _x extends v {
|
|
2591
2603
|
constructor() {
|
|
2592
2604
|
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
2593
2605
|
}
|
|
@@ -2607,25 +2619,25 @@ var init_shared_es = __esm({
|
|
|
2607
2619
|
}), _;
|
|
2608
2620
|
}
|
|
2609
2621
|
const { status: n, ctx: s } = this._processInputParams(e), { shape: a, keys: i } = this._getCached(), c = [];
|
|
2610
|
-
if (!(this._def.catchall instanceof
|
|
2622
|
+
if (!(this._def.catchall instanceof C && this._def.unknownKeys === "strip"))
|
|
2611
2623
|
for (const l in s.data)
|
|
2612
2624
|
i.includes(l) || c.push(l);
|
|
2613
2625
|
const h = [];
|
|
2614
2626
|
for (const l of i) {
|
|
2615
|
-
const
|
|
2627
|
+
const T = a[l], A = s.data[l];
|
|
2616
2628
|
h.push({
|
|
2617
2629
|
key: { status: "valid", value: l },
|
|
2618
|
-
value:
|
|
2630
|
+
value: T._parse(new M(s, A, s.path, l)),
|
|
2619
2631
|
alwaysSet: l in s.data
|
|
2620
2632
|
});
|
|
2621
2633
|
}
|
|
2622
|
-
if (this._def.catchall instanceof
|
|
2634
|
+
if (this._def.catchall instanceof C) {
|
|
2623
2635
|
const l = this._def.unknownKeys;
|
|
2624
2636
|
if (l === "passthrough")
|
|
2625
|
-
for (const
|
|
2637
|
+
for (const T of c)
|
|
2626
2638
|
h.push({
|
|
2627
|
-
key: { status: "valid", value:
|
|
2628
|
-
value: { status: "valid", value: s.data[
|
|
2639
|
+
key: { status: "valid", value: T },
|
|
2640
|
+
value: { status: "valid", value: s.data[T] }
|
|
2629
2641
|
});
|
|
2630
2642
|
else if (l === "strict")
|
|
2631
2643
|
c.length > 0 && (d(s, {
|
|
@@ -2635,36 +2647,36 @@ var init_shared_es = __esm({
|
|
|
2635
2647
|
else if (l !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
2636
2648
|
} else {
|
|
2637
2649
|
const l = this._def.catchall;
|
|
2638
|
-
for (const
|
|
2639
|
-
const
|
|
2650
|
+
for (const T of c) {
|
|
2651
|
+
const A = s.data[T];
|
|
2640
2652
|
h.push({
|
|
2641
|
-
key: { status: "valid", value:
|
|
2653
|
+
key: { status: "valid", value: T },
|
|
2642
2654
|
value: l._parse(
|
|
2643
|
-
new
|
|
2655
|
+
new M(s, A, s.path, T)
|
|
2644
2656
|
//, ctx.child(key), value, getParsedType(value)
|
|
2645
2657
|
),
|
|
2646
|
-
alwaysSet:
|
|
2658
|
+
alwaysSet: T in s.data
|
|
2647
2659
|
});
|
|
2648
2660
|
}
|
|
2649
2661
|
}
|
|
2650
2662
|
return s.common.async ? Promise.resolve().then(async () => {
|
|
2651
2663
|
const l = [];
|
|
2652
|
-
for (const
|
|
2653
|
-
const
|
|
2664
|
+
for (const T of h) {
|
|
2665
|
+
const A = await T.key, be = await T.value;
|
|
2654
2666
|
l.push({
|
|
2655
|
-
key:
|
|
2656
|
-
value:
|
|
2657
|
-
alwaysSet:
|
|
2667
|
+
key: A,
|
|
2668
|
+
value: be,
|
|
2669
|
+
alwaysSet: T.alwaysSet
|
|
2658
2670
|
});
|
|
2659
2671
|
}
|
|
2660
2672
|
return l;
|
|
2661
|
-
}).then((l) =>
|
|
2673
|
+
}).then((l) => O.mergeObjectSync(n, l)) : O.mergeObjectSync(n, h);
|
|
2662
2674
|
}
|
|
2663
2675
|
get shape() {
|
|
2664
2676
|
return this._def.shape();
|
|
2665
2677
|
}
|
|
2666
2678
|
strict(e) {
|
|
2667
|
-
return
|
|
2679
|
+
return m.errToObj, new _x({
|
|
2668
2680
|
...this._def,
|
|
2669
2681
|
unknownKeys: "strict",
|
|
2670
2682
|
...e !== void 0 ? {
|
|
@@ -2672,7 +2684,7 @@ var init_shared_es = __esm({
|
|
|
2672
2684
|
var a, i;
|
|
2673
2685
|
const s = ((i = (a = this._def).errorMap) == null ? void 0 : i.call(a, r, n).message) ?? n.defaultError;
|
|
2674
2686
|
return r.code === "unrecognized_keys" ? {
|
|
2675
|
-
message:
|
|
2687
|
+
message: m.errToObj(e).message ?? s
|
|
2676
2688
|
} : {
|
|
2677
2689
|
message: s
|
|
2678
2690
|
};
|
|
@@ -2821,7 +2833,7 @@ var init_shared_es = __esm({
|
|
|
2821
2833
|
* @deprecated
|
|
2822
2834
|
*/
|
|
2823
2835
|
deepPartial() {
|
|
2824
|
-
return
|
|
2836
|
+
return q(this);
|
|
2825
2837
|
}
|
|
2826
2838
|
partial(e) {
|
|
2827
2839
|
const r = {};
|
|
@@ -2841,7 +2853,7 @@ var init_shared_es = __esm({
|
|
|
2841
2853
|
r[n] = this.shape[n];
|
|
2842
2854
|
else {
|
|
2843
2855
|
let a = this.shape[n];
|
|
2844
|
-
for (; a instanceof
|
|
2856
|
+
for (; a instanceof L; )
|
|
2845
2857
|
a = a._def.innerType;
|
|
2846
2858
|
r[n] = a;
|
|
2847
2859
|
}
|
|
@@ -2857,25 +2869,25 @@ var init_shared_es = __esm({
|
|
|
2857
2869
|
x.create = (t, e) => new x({
|
|
2858
2870
|
shape: () => t,
|
|
2859
2871
|
unknownKeys: "strip",
|
|
2860
|
-
catchall:
|
|
2872
|
+
catchall: C.create(),
|
|
2861
2873
|
typeName: p.ZodObject,
|
|
2862
|
-
...
|
|
2874
|
+
...g(e)
|
|
2863
2875
|
});
|
|
2864
2876
|
x.strictCreate = (t, e) => new x({
|
|
2865
2877
|
shape: () => t,
|
|
2866
2878
|
unknownKeys: "strict",
|
|
2867
|
-
catchall:
|
|
2879
|
+
catchall: C.create(),
|
|
2868
2880
|
typeName: p.ZodObject,
|
|
2869
|
-
...
|
|
2881
|
+
...g(e)
|
|
2870
2882
|
});
|
|
2871
2883
|
x.lazycreate = (t, e) => new x({
|
|
2872
2884
|
shape: t,
|
|
2873
2885
|
unknownKeys: "strip",
|
|
2874
|
-
catchall:
|
|
2886
|
+
catchall: C.create(),
|
|
2875
2887
|
typeName: p.ZodObject,
|
|
2876
|
-
...
|
|
2888
|
+
...g(e)
|
|
2877
2889
|
});
|
|
2878
|
-
|
|
2890
|
+
ae = class extends v {
|
|
2879
2891
|
_parse(e) {
|
|
2880
2892
|
const { ctx: r } = this._processInputParams(e), n = this._def.options;
|
|
2881
2893
|
function s(a) {
|
|
@@ -2885,7 +2897,7 @@ var init_shared_es = __esm({
|
|
|
2885
2897
|
for (const c of a)
|
|
2886
2898
|
if (c.result.status === "dirty")
|
|
2887
2899
|
return r.common.issues.push(...c.ctx.common.issues), c.result;
|
|
2888
|
-
const i = a.map((c) => new
|
|
2900
|
+
const i = a.map((c) => new R(c.ctx.common.issues));
|
|
2889
2901
|
return d(r, {
|
|
2890
2902
|
code: o.invalid_union,
|
|
2891
2903
|
unionErrors: i
|
|
@@ -2921,18 +2933,18 @@ var init_shared_es = __esm({
|
|
|
2921
2933
|
issues: []
|
|
2922
2934
|
},
|
|
2923
2935
|
parent: null
|
|
2924
|
-
},
|
|
2936
|
+
}, T = h._parseSync({
|
|
2925
2937
|
data: r.data,
|
|
2926
2938
|
path: r.path,
|
|
2927
2939
|
parent: l
|
|
2928
2940
|
});
|
|
2929
|
-
if (
|
|
2930
|
-
return
|
|
2931
|
-
|
|
2941
|
+
if (T.status === "valid")
|
|
2942
|
+
return T;
|
|
2943
|
+
T.status === "dirty" && !a && (a = { result: T, ctx: l }), l.common.issues.length && i.push(l.common.issues);
|
|
2932
2944
|
}
|
|
2933
2945
|
if (a)
|
|
2934
2946
|
return r.common.issues.push(...a.ctx.common.issues), a.result;
|
|
2935
|
-
const c = i.map((h) => new
|
|
2947
|
+
const c = i.map((h) => new R(h));
|
|
2936
2948
|
return d(r, {
|
|
2937
2949
|
code: o.invalid_union,
|
|
2938
2950
|
unionErrors: c
|
|
@@ -2943,13 +2955,13 @@ var init_shared_es = __esm({
|
|
|
2943
2955
|
return this._def.options;
|
|
2944
2956
|
}
|
|
2945
2957
|
};
|
|
2946
|
-
|
|
2958
|
+
ae.create = (t, e) => new ae({
|
|
2947
2959
|
options: t,
|
|
2948
2960
|
typeName: p.ZodUnion,
|
|
2949
|
-
...
|
|
2961
|
+
...g(e)
|
|
2950
2962
|
});
|
|
2951
|
-
|
|
2952
|
-
Ee = class _Ee extends
|
|
2963
|
+
Z = (t) => t instanceof ve ? Z(t.schema) : t instanceof z ? Z(t.innerType()) : t instanceof oe ? [t.value] : t instanceof F ? t.options : t instanceof Te ? E.objectValues(t.enum) : t instanceof de ? Z(t._def.innerType) : t instanceof pe ? [void 0] : t instanceof ye ? [null] : t instanceof L ? [void 0, ...Z(t.unwrap())] : t instanceof B ? [null, ...Z(t.unwrap())] : t instanceof Ve || t instanceof le ? Z(t.unwrap()) : t instanceof ue ? Z(t._def.innerType) : [];
|
|
2964
|
+
Ee = class _Ee extends v {
|
|
2953
2965
|
_parse(e) {
|
|
2954
2966
|
const { ctx: r } = this._processInputParams(e);
|
|
2955
2967
|
if (r.parsedType !== u.object)
|
|
@@ -2993,7 +3005,7 @@ var init_shared_es = __esm({
|
|
|
2993
3005
|
static create(e, r, n) {
|
|
2994
3006
|
const s = /* @__PURE__ */ new Map();
|
|
2995
3007
|
for (const a of r) {
|
|
2996
|
-
const i =
|
|
3008
|
+
const i = Z(a.shape[e]);
|
|
2997
3009
|
if (!i.length)
|
|
2998
3010
|
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
2999
3011
|
for (const c of i) {
|
|
@@ -3007,11 +3019,11 @@ var init_shared_es = __esm({
|
|
|
3007
3019
|
discriminator: e,
|
|
3008
3020
|
options: r,
|
|
3009
3021
|
optionsMap: s,
|
|
3010
|
-
...
|
|
3022
|
+
...g(n)
|
|
3011
3023
|
});
|
|
3012
3024
|
}
|
|
3013
3025
|
};
|
|
3014
|
-
|
|
3026
|
+
ie = class extends v {
|
|
3015
3027
|
_parse(e) {
|
|
3016
3028
|
const { status: r, ctx: n } = this._processInputParams(e), s = (a, i) => {
|
|
3017
3029
|
if (Ne(a) || Ne(i))
|
|
@@ -3043,13 +3055,13 @@ var init_shared_es = __esm({
|
|
|
3043
3055
|
}));
|
|
3044
3056
|
}
|
|
3045
3057
|
};
|
|
3046
|
-
|
|
3058
|
+
ie.create = (t, e, r) => new ie({
|
|
3047
3059
|
left: t,
|
|
3048
3060
|
right: e,
|
|
3049
3061
|
typeName: p.ZodIntersection,
|
|
3050
|
-
...
|
|
3062
|
+
...g(r)
|
|
3051
3063
|
});
|
|
3052
|
-
|
|
3064
|
+
S = class _S extends v {
|
|
3053
3065
|
_parse(e) {
|
|
3054
3066
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
3055
3067
|
if (n.parsedType !== u.array)
|
|
@@ -3075,31 +3087,31 @@ var init_shared_es = __esm({
|
|
|
3075
3087
|
}), r.dirty());
|
|
3076
3088
|
const a = [...n.data].map((i, c) => {
|
|
3077
3089
|
const h = this._def.items[c] || this._def.rest;
|
|
3078
|
-
return h ? h._parse(new
|
|
3090
|
+
return h ? h._parse(new M(n, i, n.path, c)) : null;
|
|
3079
3091
|
}).filter((i) => !!i);
|
|
3080
|
-
return n.common.async ? Promise.all(a).then((i) =>
|
|
3092
|
+
return n.common.async ? Promise.all(a).then((i) => O.mergeArray(r, i)) : O.mergeArray(r, a);
|
|
3081
3093
|
}
|
|
3082
3094
|
get items() {
|
|
3083
3095
|
return this._def.items;
|
|
3084
3096
|
}
|
|
3085
3097
|
rest(e) {
|
|
3086
|
-
return new
|
|
3098
|
+
return new _S({
|
|
3087
3099
|
...this._def,
|
|
3088
3100
|
rest: e
|
|
3089
3101
|
});
|
|
3090
3102
|
}
|
|
3091
3103
|
};
|
|
3092
|
-
|
|
3104
|
+
S.create = (t, e) => {
|
|
3093
3105
|
if (!Array.isArray(t))
|
|
3094
3106
|
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
3095
|
-
return new
|
|
3107
|
+
return new S({
|
|
3096
3108
|
items: t,
|
|
3097
3109
|
typeName: p.ZodTuple,
|
|
3098
3110
|
rest: null,
|
|
3099
|
-
...
|
|
3111
|
+
...g(e)
|
|
3100
3112
|
});
|
|
3101
3113
|
};
|
|
3102
|
-
|
|
3114
|
+
ce = class _ce extends v {
|
|
3103
3115
|
get keySchema() {
|
|
3104
3116
|
return this._def.keyType;
|
|
3105
3117
|
}
|
|
@@ -3117,30 +3129,30 @@ var init_shared_es = __esm({
|
|
|
3117
3129
|
const s = [], a = this._def.keyType, i = this._def.valueType;
|
|
3118
3130
|
for (const c in n.data)
|
|
3119
3131
|
s.push({
|
|
3120
|
-
key: a._parse(new
|
|
3121
|
-
value: i._parse(new
|
|
3132
|
+
key: a._parse(new M(n, c, n.path, c)),
|
|
3133
|
+
value: i._parse(new M(n, n.data[c], n.path, c)),
|
|
3122
3134
|
alwaysSet: c in n.data
|
|
3123
3135
|
});
|
|
3124
|
-
return n.common.async ?
|
|
3136
|
+
return n.common.async ? O.mergeObjectAsync(r, s) : O.mergeObjectSync(r, s);
|
|
3125
3137
|
}
|
|
3126
3138
|
get element() {
|
|
3127
3139
|
return this._def.valueType;
|
|
3128
3140
|
}
|
|
3129
3141
|
static create(e, r, n) {
|
|
3130
|
-
return r instanceof
|
|
3142
|
+
return r instanceof v ? new _ce({
|
|
3131
3143
|
keyType: e,
|
|
3132
3144
|
valueType: r,
|
|
3133
3145
|
typeName: p.ZodRecord,
|
|
3134
|
-
...
|
|
3135
|
-
}) : new
|
|
3136
|
-
keyType:
|
|
3146
|
+
...g(n)
|
|
3147
|
+
}) : new _ce({
|
|
3148
|
+
keyType: w.create(),
|
|
3137
3149
|
valueType: e,
|
|
3138
3150
|
typeName: p.ZodRecord,
|
|
3139
|
-
...
|
|
3151
|
+
...g(r)
|
|
3140
3152
|
});
|
|
3141
3153
|
}
|
|
3142
3154
|
};
|
|
3143
|
-
|
|
3155
|
+
Me = class extends v {
|
|
3144
3156
|
get keySchema() {
|
|
3145
3157
|
return this._def.keyType;
|
|
3146
3158
|
}
|
|
@@ -3156,39 +3168,39 @@ var init_shared_es = __esm({
|
|
|
3156
3168
|
received: n.parsedType
|
|
3157
3169
|
}), _;
|
|
3158
3170
|
const s = this._def.keyType, a = this._def.valueType, i = [...n.data.entries()].map(([c, h], l) => ({
|
|
3159
|
-
key: s._parse(new
|
|
3160
|
-
value: a._parse(new
|
|
3171
|
+
key: s._parse(new M(n, c, n.path, [l, "key"])),
|
|
3172
|
+
value: a._parse(new M(n, h, n.path, [l, "value"]))
|
|
3161
3173
|
}));
|
|
3162
3174
|
if (n.common.async) {
|
|
3163
3175
|
const c = /* @__PURE__ */ new Map();
|
|
3164
3176
|
return Promise.resolve().then(async () => {
|
|
3165
3177
|
for (const h of i) {
|
|
3166
|
-
const l = await h.key,
|
|
3167
|
-
if (l.status === "aborted" ||
|
|
3178
|
+
const l = await h.key, T = await h.value;
|
|
3179
|
+
if (l.status === "aborted" || T.status === "aborted")
|
|
3168
3180
|
return _;
|
|
3169
|
-
(l.status === "dirty" ||
|
|
3181
|
+
(l.status === "dirty" || T.status === "dirty") && r.dirty(), c.set(l.value, T.value);
|
|
3170
3182
|
}
|
|
3171
3183
|
return { status: r.value, value: c };
|
|
3172
3184
|
});
|
|
3173
3185
|
} else {
|
|
3174
3186
|
const c = /* @__PURE__ */ new Map();
|
|
3175
3187
|
for (const h of i) {
|
|
3176
|
-
const l = h.key,
|
|
3177
|
-
if (l.status === "aborted" ||
|
|
3188
|
+
const l = h.key, T = h.value;
|
|
3189
|
+
if (l.status === "aborted" || T.status === "aborted")
|
|
3178
3190
|
return _;
|
|
3179
|
-
(l.status === "dirty" ||
|
|
3191
|
+
(l.status === "dirty" || T.status === "dirty") && r.dirty(), c.set(l.value, T.value);
|
|
3180
3192
|
}
|
|
3181
3193
|
return { status: r.value, value: c };
|
|
3182
3194
|
}
|
|
3183
3195
|
}
|
|
3184
3196
|
};
|
|
3185
|
-
|
|
3197
|
+
Me.create = (t, e, r) => new Me({
|
|
3186
3198
|
valueType: e,
|
|
3187
3199
|
keyType: t,
|
|
3188
3200
|
typeName: p.ZodMap,
|
|
3189
|
-
...
|
|
3201
|
+
...g(r)
|
|
3190
3202
|
});
|
|
3191
|
-
|
|
3203
|
+
ee = class _ee extends v {
|
|
3192
3204
|
_parse(e) {
|
|
3193
3205
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
3194
3206
|
if (n.parsedType !== u.set)
|
|
@@ -3216,26 +3228,26 @@ var init_shared_es = __esm({
|
|
|
3216
3228
|
const a = this._def.valueType;
|
|
3217
3229
|
function i(h) {
|
|
3218
3230
|
const l = /* @__PURE__ */ new Set();
|
|
3219
|
-
for (const
|
|
3220
|
-
if (
|
|
3231
|
+
for (const T of h) {
|
|
3232
|
+
if (T.status === "aborted")
|
|
3221
3233
|
return _;
|
|
3222
|
-
|
|
3234
|
+
T.status === "dirty" && r.dirty(), l.add(T.value);
|
|
3223
3235
|
}
|
|
3224
3236
|
return { status: r.value, value: l };
|
|
3225
3237
|
}
|
|
3226
|
-
const c = [...n.data.values()].map((h, l) => a._parse(new
|
|
3238
|
+
const c = [...n.data.values()].map((h, l) => a._parse(new M(n, h, n.path, l)));
|
|
3227
3239
|
return n.common.async ? Promise.all(c).then((h) => i(h)) : i(c);
|
|
3228
3240
|
}
|
|
3229
3241
|
min(e, r) {
|
|
3230
|
-
return new
|
|
3242
|
+
return new _ee({
|
|
3231
3243
|
...this._def,
|
|
3232
|
-
minSize: { value: e, message:
|
|
3244
|
+
minSize: { value: e, message: m.toString(r) }
|
|
3233
3245
|
});
|
|
3234
3246
|
}
|
|
3235
3247
|
max(e, r) {
|
|
3236
|
-
return new
|
|
3248
|
+
return new _ee({
|
|
3237
3249
|
...this._def,
|
|
3238
|
-
maxSize: { value: e, message:
|
|
3250
|
+
maxSize: { value: e, message: m.toString(r) }
|
|
3239
3251
|
});
|
|
3240
3252
|
}
|
|
3241
3253
|
size(e, r) {
|
|
@@ -3245,14 +3257,14 @@ var init_shared_es = __esm({
|
|
|
3245
3257
|
return this.min(1, e);
|
|
3246
3258
|
}
|
|
3247
3259
|
};
|
|
3248
|
-
|
|
3260
|
+
ee.create = (t, e) => new ee({
|
|
3249
3261
|
valueType: t,
|
|
3250
3262
|
minSize: null,
|
|
3251
3263
|
maxSize: null,
|
|
3252
3264
|
typeName: p.ZodSet,
|
|
3253
|
-
...
|
|
3265
|
+
...g(e)
|
|
3254
3266
|
});
|
|
3255
|
-
|
|
3267
|
+
J = class _J extends v {
|
|
3256
3268
|
constructor() {
|
|
3257
3269
|
super(...arguments), this.validate = this.implement;
|
|
3258
3270
|
}
|
|
@@ -3265,10 +3277,10 @@ var init_shared_es = __esm({
|
|
|
3265
3277
|
received: r.parsedType
|
|
3266
3278
|
}), _;
|
|
3267
3279
|
function n(c, h) {
|
|
3268
|
-
return
|
|
3280
|
+
return _e({
|
|
3269
3281
|
data: c,
|
|
3270
3282
|
path: r.path,
|
|
3271
|
-
errorMaps: [r.common.contextualErrorMap, r.schemaErrorMap,
|
|
3283
|
+
errorMaps: [r.common.contextualErrorMap, r.schemaErrorMap, me(), H].filter((l) => !!l),
|
|
3272
3284
|
issueData: {
|
|
3273
3285
|
code: o.invalid_arguments,
|
|
3274
3286
|
argumentsError: h
|
|
@@ -3276,10 +3288,10 @@ var init_shared_es = __esm({
|
|
|
3276
3288
|
});
|
|
3277
3289
|
}
|
|
3278
3290
|
function s(c, h) {
|
|
3279
|
-
return
|
|
3291
|
+
return _e({
|
|
3280
3292
|
data: c,
|
|
3281
3293
|
path: r.path,
|
|
3282
|
-
errorMaps: [r.common.contextualErrorMap, r.schemaErrorMap,
|
|
3294
|
+
errorMaps: [r.common.contextualErrorMap, r.schemaErrorMap, me(), H].filter((l) => !!l),
|
|
3283
3295
|
issueData: {
|
|
3284
3296
|
code: o.invalid_return_type,
|
|
3285
3297
|
returnTypeError: h
|
|
@@ -3287,26 +3299,26 @@ var init_shared_es = __esm({
|
|
|
3287
3299
|
});
|
|
3288
3300
|
}
|
|
3289
3301
|
const a = { errorMap: r.common.contextualErrorMap }, i = r.data;
|
|
3290
|
-
if (this._def.returns instanceof
|
|
3302
|
+
if (this._def.returns instanceof te) {
|
|
3291
3303
|
const c = this;
|
|
3292
|
-
return
|
|
3293
|
-
const l = new
|
|
3294
|
-
throw l.addIssue(n(h,
|
|
3295
|
-
}),
|
|
3296
|
-
return await c._def.returns._def.type.parseAsync(
|
|
3297
|
-
throw l.addIssue(s(
|
|
3304
|
+
return N(async function(...h) {
|
|
3305
|
+
const l = new R([]), T = await c._def.args.parseAsync(h, a).catch((he) => {
|
|
3306
|
+
throw l.addIssue(n(h, he)), l;
|
|
3307
|
+
}), A = await Reflect.apply(i, this, T);
|
|
3308
|
+
return await c._def.returns._def.type.parseAsync(A, a).catch((he) => {
|
|
3309
|
+
throw l.addIssue(s(A, he)), l;
|
|
3298
3310
|
});
|
|
3299
3311
|
});
|
|
3300
3312
|
} else {
|
|
3301
3313
|
const c = this;
|
|
3302
|
-
return
|
|
3314
|
+
return N(function(...h) {
|
|
3303
3315
|
const l = c._def.args.safeParse(h, a);
|
|
3304
3316
|
if (!l.success)
|
|
3305
|
-
throw new
|
|
3306
|
-
const
|
|
3307
|
-
if (!
|
|
3308
|
-
throw new
|
|
3309
|
-
return
|
|
3317
|
+
throw new R([n(h, l.error)]);
|
|
3318
|
+
const T = Reflect.apply(i, this, l.data), A = c._def.returns.safeParse(T, a);
|
|
3319
|
+
if (!A.success)
|
|
3320
|
+
throw new R([s(T, A.error)]);
|
|
3321
|
+
return A.data;
|
|
3310
3322
|
});
|
|
3311
3323
|
}
|
|
3312
3324
|
}
|
|
@@ -3317,13 +3329,13 @@ var init_shared_es = __esm({
|
|
|
3317
3329
|
return this._def.returns;
|
|
3318
3330
|
}
|
|
3319
3331
|
args(...e) {
|
|
3320
|
-
return new
|
|
3332
|
+
return new _J({
|
|
3321
3333
|
...this._def,
|
|
3322
|
-
args:
|
|
3334
|
+
args: S.create(e).rest(Y.create())
|
|
3323
3335
|
});
|
|
3324
3336
|
}
|
|
3325
3337
|
returns(e) {
|
|
3326
|
-
return new
|
|
3338
|
+
return new _J({
|
|
3327
3339
|
...this._def,
|
|
3328
3340
|
returns: e
|
|
3329
3341
|
});
|
|
@@ -3335,15 +3347,15 @@ var init_shared_es = __esm({
|
|
|
3335
3347
|
return this.parse(e);
|
|
3336
3348
|
}
|
|
3337
3349
|
static create(e, r, n) {
|
|
3338
|
-
return new
|
|
3339
|
-
args: e ||
|
|
3340
|
-
returns: r ||
|
|
3350
|
+
return new _J({
|
|
3351
|
+
args: e || S.create([]).rest(Y.create()),
|
|
3352
|
+
returns: r || Y.create(),
|
|
3341
3353
|
typeName: p.ZodFunction,
|
|
3342
|
-
...
|
|
3354
|
+
...g(n)
|
|
3343
3355
|
});
|
|
3344
3356
|
}
|
|
3345
3357
|
};
|
|
3346
|
-
ve = class extends
|
|
3358
|
+
ve = class extends v {
|
|
3347
3359
|
get schema() {
|
|
3348
3360
|
return this._def.getter();
|
|
3349
3361
|
}
|
|
@@ -3355,9 +3367,9 @@ var init_shared_es = __esm({
|
|
|
3355
3367
|
ve.create = (t, e) => new ve({
|
|
3356
3368
|
getter: t,
|
|
3357
3369
|
typeName: p.ZodLazy,
|
|
3358
|
-
...
|
|
3370
|
+
...g(e)
|
|
3359
3371
|
});
|
|
3360
|
-
|
|
3372
|
+
oe = class extends v {
|
|
3361
3373
|
_parse(e) {
|
|
3362
3374
|
if (e.data !== this._def.value) {
|
|
3363
3375
|
const r = this._getOrReturnCtx(e);
|
|
@@ -3373,12 +3385,12 @@ var init_shared_es = __esm({
|
|
|
3373
3385
|
return this._def.value;
|
|
3374
3386
|
}
|
|
3375
3387
|
};
|
|
3376
|
-
|
|
3388
|
+
oe.create = (t, e) => new oe({
|
|
3377
3389
|
value: t,
|
|
3378
3390
|
typeName: p.ZodLiteral,
|
|
3379
|
-
...
|
|
3391
|
+
...g(e)
|
|
3380
3392
|
});
|
|
3381
|
-
|
|
3393
|
+
F = class _F extends v {
|
|
3382
3394
|
_parse(e) {
|
|
3383
3395
|
if (typeof e.data != "string") {
|
|
3384
3396
|
const r = this._getOrReturnCtx(e), n = this._def.values;
|
|
@@ -3396,7 +3408,7 @@ var init_shared_es = __esm({
|
|
|
3396
3408
|
options: n
|
|
3397
3409
|
}), _;
|
|
3398
3410
|
}
|
|
3399
|
-
return
|
|
3411
|
+
return N(e.data);
|
|
3400
3412
|
}
|
|
3401
3413
|
get options() {
|
|
3402
3414
|
return this._def.values;
|
|
@@ -3420,20 +3432,20 @@ var init_shared_es = __esm({
|
|
|
3420
3432
|
return e;
|
|
3421
3433
|
}
|
|
3422
3434
|
extract(e, r = this._def) {
|
|
3423
|
-
return
|
|
3435
|
+
return _F.create(e, {
|
|
3424
3436
|
...this._def,
|
|
3425
3437
|
...r
|
|
3426
3438
|
});
|
|
3427
3439
|
}
|
|
3428
3440
|
exclude(e, r = this._def) {
|
|
3429
|
-
return
|
|
3441
|
+
return _F.create(this.options.filter((n) => !e.includes(n)), {
|
|
3430
3442
|
...this._def,
|
|
3431
3443
|
...r
|
|
3432
3444
|
});
|
|
3433
3445
|
}
|
|
3434
3446
|
};
|
|
3435
|
-
|
|
3436
|
-
Te = class extends
|
|
3447
|
+
F.create = $e;
|
|
3448
|
+
Te = class extends v {
|
|
3437
3449
|
_parse(e) {
|
|
3438
3450
|
const r = E.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
|
|
3439
3451
|
if (n.parsedType !== u.string && n.parsedType !== u.number) {
|
|
@@ -3452,7 +3464,7 @@ var init_shared_es = __esm({
|
|
|
3452
3464
|
options: s
|
|
3453
3465
|
}), _;
|
|
3454
3466
|
}
|
|
3455
|
-
return
|
|
3467
|
+
return N(e.data);
|
|
3456
3468
|
}
|
|
3457
3469
|
get enum() {
|
|
3458
3470
|
return this._def.values;
|
|
@@ -3461,9 +3473,9 @@ var init_shared_es = __esm({
|
|
|
3461
3473
|
Te.create = (t, e) => new Te({
|
|
3462
3474
|
values: t,
|
|
3463
3475
|
typeName: p.ZodNativeEnum,
|
|
3464
|
-
...
|
|
3476
|
+
...g(e)
|
|
3465
3477
|
});
|
|
3466
|
-
|
|
3478
|
+
te = class extends v {
|
|
3467
3479
|
unwrap() {
|
|
3468
3480
|
return this._def.type;
|
|
3469
3481
|
}
|
|
@@ -3476,18 +3488,18 @@ var init_shared_es = __esm({
|
|
|
3476
3488
|
received: r.parsedType
|
|
3477
3489
|
}), _;
|
|
3478
3490
|
const n = r.parsedType === u.promise ? r.data : Promise.resolve(r.data);
|
|
3479
|
-
return
|
|
3491
|
+
return N(n.then((s) => this._def.type.parseAsync(s, {
|
|
3480
3492
|
path: r.path,
|
|
3481
3493
|
errorMap: r.common.contextualErrorMap
|
|
3482
3494
|
})));
|
|
3483
3495
|
}
|
|
3484
3496
|
};
|
|
3485
|
-
|
|
3497
|
+
te.create = (t, e) => new te({
|
|
3486
3498
|
type: t,
|
|
3487
3499
|
typeName: p.ZodPromise,
|
|
3488
|
-
...
|
|
3500
|
+
...g(e)
|
|
3489
3501
|
});
|
|
3490
|
-
|
|
3502
|
+
z = class extends v {
|
|
3491
3503
|
innerType() {
|
|
3492
3504
|
return this._def.schema;
|
|
3493
3505
|
}
|
|
@@ -3514,7 +3526,7 @@ var init_shared_es = __esm({
|
|
|
3514
3526
|
path: n.path,
|
|
3515
3527
|
parent: n
|
|
3516
3528
|
});
|
|
3517
|
-
return h.status === "aborted" ? _ : h.status === "dirty" || r.value === "dirty" ?
|
|
3529
|
+
return h.status === "aborted" ? _ : h.status === "dirty" || r.value === "dirty" ? K(h.value) : h;
|
|
3518
3530
|
});
|
|
3519
3531
|
{
|
|
3520
3532
|
if (r.value === "aborted")
|
|
@@ -3524,7 +3536,7 @@ var init_shared_es = __esm({
|
|
|
3524
3536
|
path: n.path,
|
|
3525
3537
|
parent: n
|
|
3526
3538
|
});
|
|
3527
|
-
return c.status === "aborted" ? _ : c.status === "dirty" || r.value === "dirty" ?
|
|
3539
|
+
return c.status === "aborted" ? _ : c.status === "dirty" || r.value === "dirty" ? K(c.value) : c;
|
|
3528
3540
|
}
|
|
3529
3541
|
}
|
|
3530
3542
|
if (s.type === "refinement") {
|
|
@@ -3553,59 +3565,59 @@ var init_shared_es = __esm({
|
|
|
3553
3565
|
path: n.path,
|
|
3554
3566
|
parent: n
|
|
3555
3567
|
});
|
|
3556
|
-
if (!
|
|
3568
|
+
if (!W(i))
|
|
3557
3569
|
return _;
|
|
3558
3570
|
const c = s.transform(i.value, a);
|
|
3559
3571
|
if (c instanceof Promise)
|
|
3560
3572
|
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
3561
3573
|
return { status: r.value, value: c };
|
|
3562
3574
|
} else
|
|
3563
|
-
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) =>
|
|
3575
|
+
return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) => W(i) ? Promise.resolve(s.transform(i.value, a)).then((c) => ({
|
|
3564
3576
|
status: r.value,
|
|
3565
3577
|
value: c
|
|
3566
3578
|
})) : _);
|
|
3567
3579
|
E.assertNever(s);
|
|
3568
3580
|
}
|
|
3569
3581
|
};
|
|
3570
|
-
|
|
3582
|
+
z.create = (t, e, r) => new z({
|
|
3571
3583
|
schema: t,
|
|
3572
3584
|
typeName: p.ZodEffects,
|
|
3573
3585
|
effect: e,
|
|
3574
|
-
...
|
|
3586
|
+
...g(r)
|
|
3575
3587
|
});
|
|
3576
|
-
|
|
3588
|
+
z.createWithPreprocess = (t, e, r) => new z({
|
|
3577
3589
|
schema: e,
|
|
3578
3590
|
effect: { type: "preprocess", transform: t },
|
|
3579
3591
|
typeName: p.ZodEffects,
|
|
3580
|
-
...
|
|
3592
|
+
...g(r)
|
|
3581
3593
|
});
|
|
3582
|
-
|
|
3594
|
+
L = class extends v {
|
|
3583
3595
|
_parse(e) {
|
|
3584
|
-
return this._getType(e) === u.undefined ?
|
|
3596
|
+
return this._getType(e) === u.undefined ? N(void 0) : this._def.innerType._parse(e);
|
|
3585
3597
|
}
|
|
3586
3598
|
unwrap() {
|
|
3587
3599
|
return this._def.innerType;
|
|
3588
3600
|
}
|
|
3589
3601
|
};
|
|
3590
|
-
|
|
3602
|
+
L.create = (t, e) => new L({
|
|
3591
3603
|
innerType: t,
|
|
3592
3604
|
typeName: p.ZodOptional,
|
|
3593
|
-
...
|
|
3605
|
+
...g(e)
|
|
3594
3606
|
});
|
|
3595
|
-
|
|
3607
|
+
B = class extends v {
|
|
3596
3608
|
_parse(e) {
|
|
3597
|
-
return this._getType(e) === u.null ?
|
|
3609
|
+
return this._getType(e) === u.null ? N(null) : this._def.innerType._parse(e);
|
|
3598
3610
|
}
|
|
3599
3611
|
unwrap() {
|
|
3600
3612
|
return this._def.innerType;
|
|
3601
3613
|
}
|
|
3602
3614
|
};
|
|
3603
|
-
|
|
3615
|
+
B.create = (t, e) => new B({
|
|
3604
3616
|
innerType: t,
|
|
3605
3617
|
typeName: p.ZodNullable,
|
|
3606
|
-
...
|
|
3618
|
+
...g(e)
|
|
3607
3619
|
});
|
|
3608
|
-
|
|
3620
|
+
de = class extends v {
|
|
3609
3621
|
_parse(e) {
|
|
3610
3622
|
const { ctx: r } = this._processInputParams(e);
|
|
3611
3623
|
let n = r.data;
|
|
@@ -3619,13 +3631,13 @@ var init_shared_es = __esm({
|
|
|
3619
3631
|
return this._def.innerType;
|
|
3620
3632
|
}
|
|
3621
3633
|
};
|
|
3622
|
-
|
|
3634
|
+
de.create = (t, e) => new de({
|
|
3623
3635
|
innerType: t,
|
|
3624
3636
|
typeName: p.ZodDefault,
|
|
3625
3637
|
defaultValue: typeof e.default == "function" ? e.default : () => e.default,
|
|
3626
|
-
...
|
|
3638
|
+
...g(e)
|
|
3627
3639
|
});
|
|
3628
|
-
|
|
3640
|
+
ue = class extends v {
|
|
3629
3641
|
_parse(e) {
|
|
3630
3642
|
const { ctx: r } = this._processInputParams(e), n = {
|
|
3631
3643
|
...r,
|
|
@@ -3640,11 +3652,11 @@ var init_shared_es = __esm({
|
|
|
3640
3652
|
...n
|
|
3641
3653
|
}
|
|
3642
3654
|
});
|
|
3643
|
-
return
|
|
3655
|
+
return ne(s) ? s.then((a) => ({
|
|
3644
3656
|
status: "valid",
|
|
3645
3657
|
value: a.status === "valid" ? a.value : this._def.catchValue({
|
|
3646
3658
|
get error() {
|
|
3647
|
-
return new
|
|
3659
|
+
return new R(n.common.issues);
|
|
3648
3660
|
},
|
|
3649
3661
|
input: n.data
|
|
3650
3662
|
})
|
|
@@ -3652,7 +3664,7 @@ var init_shared_es = __esm({
|
|
|
3652
3664
|
status: "valid",
|
|
3653
3665
|
value: s.status === "valid" ? s.value : this._def.catchValue({
|
|
3654
3666
|
get error() {
|
|
3655
|
-
return new
|
|
3667
|
+
return new R(n.common.issues);
|
|
3656
3668
|
},
|
|
3657
3669
|
input: n.data
|
|
3658
3670
|
})
|
|
@@ -3662,13 +3674,13 @@ var init_shared_es = __esm({
|
|
|
3662
3674
|
return this._def.innerType;
|
|
3663
3675
|
}
|
|
3664
3676
|
};
|
|
3665
|
-
|
|
3677
|
+
ue.create = (t, e) => new ue({
|
|
3666
3678
|
innerType: t,
|
|
3667
3679
|
typeName: p.ZodCatch,
|
|
3668
3680
|
catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
|
|
3669
|
-
...
|
|
3681
|
+
...g(e)
|
|
3670
3682
|
});
|
|
3671
|
-
|
|
3683
|
+
Ze = class extends v {
|
|
3672
3684
|
_parse(e) {
|
|
3673
3685
|
if (this._getType(e) !== u.nan) {
|
|
3674
3686
|
const n = this._getOrReturnCtx(e);
|
|
@@ -3681,11 +3693,11 @@ var init_shared_es = __esm({
|
|
|
3681
3693
|
return { status: "valid", value: e.data };
|
|
3682
3694
|
}
|
|
3683
3695
|
};
|
|
3684
|
-
|
|
3696
|
+
Ze.create = (t) => new Ze({
|
|
3685
3697
|
typeName: p.ZodNaN,
|
|
3686
|
-
...
|
|
3698
|
+
...g(t)
|
|
3687
3699
|
});
|
|
3688
|
-
|
|
3700
|
+
Ve = class extends v {
|
|
3689
3701
|
_parse(e) {
|
|
3690
3702
|
const { ctx: r } = this._processInputParams(e), n = r.data;
|
|
3691
3703
|
return this._def.type._parse({
|
|
@@ -3698,7 +3710,7 @@ var init_shared_es = __esm({
|
|
|
3698
3710
|
return this._def.type;
|
|
3699
3711
|
}
|
|
3700
3712
|
};
|
|
3701
|
-
|
|
3713
|
+
ke = class _ke extends v {
|
|
3702
3714
|
_parse(e) {
|
|
3703
3715
|
const { status: r, ctx: n } = this._processInputParams(e);
|
|
3704
3716
|
if (n.common.async)
|
|
@@ -3708,7 +3720,7 @@ var init_shared_es = __esm({
|
|
|
3708
3720
|
path: n.path,
|
|
3709
3721
|
parent: n
|
|
3710
3722
|
});
|
|
3711
|
-
return a.status === "aborted" ? _ : a.status === "dirty" ? (r.dirty(),
|
|
3723
|
+
return a.status === "aborted" ? _ : a.status === "dirty" ? (r.dirty(), K(a.value)) : this._def.out._parseAsync({
|
|
3712
3724
|
data: a.value,
|
|
3713
3725
|
path: n.path,
|
|
3714
3726
|
parent: n
|
|
@@ -3731,243 +3743,319 @@ var init_shared_es = __esm({
|
|
|
3731
3743
|
}
|
|
3732
3744
|
}
|
|
3733
3745
|
static create(e, r) {
|
|
3734
|
-
return new
|
|
3746
|
+
return new _ke({
|
|
3735
3747
|
in: e,
|
|
3736
3748
|
out: r,
|
|
3737
3749
|
typeName: p.ZodPipeline
|
|
3738
3750
|
});
|
|
3739
3751
|
}
|
|
3740
3752
|
};
|
|
3741
|
-
|
|
3753
|
+
le = class extends v {
|
|
3742
3754
|
_parse(e) {
|
|
3743
|
-
const r = this._def.innerType._parse(e), n = (s) => (
|
|
3744
|
-
return
|
|
3755
|
+
const r = this._def.innerType._parse(e), n = (s) => (W(s) && (s.value = Object.freeze(s.value)), s);
|
|
3756
|
+
return ne(r) ? r.then((s) => n(s)) : n(r);
|
|
3745
3757
|
}
|
|
3746
3758
|
unwrap() {
|
|
3747
3759
|
return this._def.innerType;
|
|
3748
3760
|
}
|
|
3749
3761
|
};
|
|
3750
|
-
|
|
3762
|
+
le.create = (t, e) => new le({
|
|
3751
3763
|
innerType: t,
|
|
3752
3764
|
typeName: p.ZodReadonly,
|
|
3753
|
-
...
|
|
3765
|
+
...g(e)
|
|
3754
3766
|
});
|
|
3755
3767
|
(function(t) {
|
|
3756
3768
|
t.ZodString = "ZodString", t.ZodNumber = "ZodNumber", t.ZodNaN = "ZodNaN", t.ZodBigInt = "ZodBigInt", t.ZodBoolean = "ZodBoolean", t.ZodDate = "ZodDate", t.ZodSymbol = "ZodSymbol", t.ZodUndefined = "ZodUndefined", t.ZodNull = "ZodNull", t.ZodAny = "ZodAny", t.ZodUnknown = "ZodUnknown", t.ZodNever = "ZodNever", t.ZodVoid = "ZodVoid", t.ZodArray = "ZodArray", t.ZodObject = "ZodObject", t.ZodUnion = "ZodUnion", t.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", t.ZodIntersection = "ZodIntersection", t.ZodTuple = "ZodTuple", t.ZodRecord = "ZodRecord", t.ZodMap = "ZodMap", t.ZodSet = "ZodSet", t.ZodFunction = "ZodFunction", t.ZodLazy = "ZodLazy", t.ZodLiteral = "ZodLiteral", t.ZodEnum = "ZodEnum", t.ZodEffects = "ZodEffects", t.ZodNativeEnum = "ZodNativeEnum", t.ZodOptional = "ZodOptional", t.ZodNullable = "ZodNullable", t.ZodDefault = "ZodDefault", t.ZodCatch = "ZodCatch", t.ZodPromise = "ZodPromise", t.ZodBranded = "ZodBranded", t.ZodPipeline = "ZodPipeline", t.ZodReadonly = "ZodReadonly";
|
|
3757
3769
|
})(p || (p = {}));
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
ee = I.create;
|
|
3765
|
-
T = x.create;
|
|
3766
|
-
ht = ne.create;
|
|
3767
|
-
Ve = Ee.create;
|
|
3768
|
-
se.create;
|
|
3769
|
-
P.create;
|
|
3770
|
-
Y = ae.create;
|
|
3771
|
-
Me = q.create;
|
|
3772
|
-
O = ie.create;
|
|
3773
|
-
G = j.create;
|
|
3774
|
-
ft = H.create;
|
|
3775
|
-
M.create;
|
|
3770
|
+
f = w.create;
|
|
3771
|
+
k = $.create;
|
|
3772
|
+
V.create;
|
|
3773
|
+
xe = se.create;
|
|
3774
|
+
I = Q.create;
|
|
3775
|
+
re = Y.create;
|
|
3776
3776
|
C.create;
|
|
3777
|
+
P = D.create;
|
|
3778
|
+
y = x.create;
|
|
3779
|
+
ft = ae.create;
|
|
3780
|
+
Fe = Ee.create;
|
|
3781
|
+
ie.create;
|
|
3782
|
+
S.create;
|
|
3783
|
+
X = ce.create;
|
|
3784
|
+
Le = J.create;
|
|
3785
|
+
b = oe.create;
|
|
3786
|
+
U = F.create;
|
|
3787
|
+
mt = te.create;
|
|
3788
|
+
L.create;
|
|
3789
|
+
B.create;
|
|
3790
|
+
Se = {
|
|
3791
|
+
string: (t) => w.create({ ...t, coerce: true }),
|
|
3792
|
+
number: (t) => $.create({ ...t, coerce: true }),
|
|
3793
|
+
boolean: (t) => se.create({
|
|
3794
|
+
...t,
|
|
3795
|
+
coerce: true
|
|
3796
|
+
}),
|
|
3797
|
+
bigint: (t) => V.create({ ...t, coerce: true }),
|
|
3798
|
+
date: (t) => Q.create({ ...t, coerce: true })
|
|
3799
|
+
};
|
|
3777
3800
|
Pe = 100;
|
|
3778
|
-
|
|
3779
|
-
id:
|
|
3780
|
-
organizationId:
|
|
3781
|
-
name:
|
|
3782
|
-
keyHash:
|
|
3783
|
-
keyPrefix:
|
|
3784
|
-
keySuffix:
|
|
3785
|
-
isActive:
|
|
3786
|
-
lastUsedAt:
|
|
3787
|
-
createdAt:
|
|
3788
|
-
updatedAt:
|
|
3801
|
+
Nt = y({
|
|
3802
|
+
id: f().uuid(),
|
|
3803
|
+
organizationId: f().uuid(),
|
|
3804
|
+
name: f(),
|
|
3805
|
+
keyHash: f(),
|
|
3806
|
+
keyPrefix: f(),
|
|
3807
|
+
keySuffix: f(),
|
|
3808
|
+
isActive: xe(),
|
|
3809
|
+
lastUsedAt: I().nullable(),
|
|
3810
|
+
createdAt: I(),
|
|
3811
|
+
updatedAt: I()
|
|
3789
3812
|
});
|
|
3790
|
-
|
|
3791
|
-
id:
|
|
3792
|
-
apiKeyId:
|
|
3793
|
-
organizationId:
|
|
3794
|
-
tokensUsed:
|
|
3795
|
-
model:
|
|
3796
|
-
statusCode:
|
|
3797
|
-
createdAt:
|
|
3813
|
+
At = y({
|
|
3814
|
+
id: f().uuid(),
|
|
3815
|
+
apiKeyId: f().uuid(),
|
|
3816
|
+
organizationId: f().uuid(),
|
|
3817
|
+
tokensUsed: k().int().positive(),
|
|
3818
|
+
model: f(),
|
|
3819
|
+
statusCode: k().int(),
|
|
3820
|
+
createdAt: I()
|
|
3798
3821
|
});
|
|
3799
|
-
|
|
3800
|
-
name:
|
|
3822
|
+
Rt = y({
|
|
3823
|
+
name: f().min(1, "API key name is required").max(
|
|
3801
3824
|
Pe,
|
|
3802
3825
|
`API key name must be less than ${Pe} characters`
|
|
3803
3826
|
)
|
|
3804
3827
|
});
|
|
3805
|
-
|
|
3806
|
-
id:
|
|
3807
|
-
name:
|
|
3808
|
-
keyPrefix:
|
|
3809
|
-
keySuffix:
|
|
3810
|
-
lastUsedAt:
|
|
3811
|
-
createdAt:
|
|
3812
|
-
currentMonthUsage:
|
|
3828
|
+
It = y({
|
|
3829
|
+
id: f().uuid(),
|
|
3830
|
+
name: f(),
|
|
3831
|
+
keyPrefix: f(),
|
|
3832
|
+
keySuffix: f(),
|
|
3833
|
+
lastUsedAt: I().nullable(),
|
|
3834
|
+
createdAt: I(),
|
|
3835
|
+
currentMonthUsage: k().int().nonnegative(),
|
|
3813
3836
|
// Full key is only returned once at creation
|
|
3814
|
-
key:
|
|
3837
|
+
key: f().optional()
|
|
3815
3838
|
});
|
|
3816
|
-
|
|
3817
|
-
totalTokens:
|
|
3818
|
-
totalRequests:
|
|
3819
|
-
successfulRequests:
|
|
3820
|
-
failedRequests:
|
|
3839
|
+
wt = y({
|
|
3840
|
+
totalTokens: k().int(),
|
|
3841
|
+
totalRequests: k().int(),
|
|
3842
|
+
successfulRequests: k().int(),
|
|
3843
|
+
failedRequests: k().int()
|
|
3821
3844
|
});
|
|
3822
|
-
|
|
3823
|
-
error:
|
|
3845
|
+
_t = y({
|
|
3846
|
+
error: f().describe("The error message")
|
|
3824
3847
|
});
|
|
3825
|
-
|
|
3826
|
-
error:
|
|
3848
|
+
y({
|
|
3849
|
+
error: f().describe("The error message")
|
|
3827
3850
|
});
|
|
3828
|
-
|
|
3829
|
-
errors:
|
|
3830
|
-
message:
|
|
3851
|
+
Ue = y({
|
|
3852
|
+
errors: X(P(f())).describe("Field validation errors"),
|
|
3853
|
+
message: f().optional().describe("General error message")
|
|
3831
3854
|
});
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
response:
|
|
3837
|
-
clone:
|
|
3838
|
-
|
|
3839
|
-
json:
|
|
3855
|
+
ft([
|
|
3856
|
+
_t,
|
|
3857
|
+
Ue,
|
|
3858
|
+
y({
|
|
3859
|
+
response: y({
|
|
3860
|
+
clone: Le().returns(
|
|
3861
|
+
y({
|
|
3862
|
+
json: Le().returns(mt(Ue))
|
|
3840
3863
|
})
|
|
3841
3864
|
)
|
|
3842
3865
|
})
|
|
3843
3866
|
})
|
|
3844
3867
|
]);
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
id:
|
|
3848
|
-
orgId:
|
|
3849
|
-
timezone:
|
|
3850
|
-
monthlyTokenLimit:
|
|
3851
|
-
createdAt:
|
|
3852
|
-
updatedAt:
|
|
3868
|
+
pt = 100;
|
|
3869
|
+
Dt = y({
|
|
3870
|
+
id: f().uuid(),
|
|
3871
|
+
orgId: f(),
|
|
3872
|
+
timezone: f().nullable(),
|
|
3873
|
+
monthlyTokenLimit: k().int().positive(),
|
|
3874
|
+
createdAt: I(),
|
|
3875
|
+
updatedAt: I()
|
|
3853
3876
|
});
|
|
3854
|
-
|
|
3855
|
-
timezone:
|
|
3856
|
-
monthlyTokenLimit:
|
|
3877
|
+
yt = y({
|
|
3878
|
+
timezone: f().max(pt, "Timezone must be less than 100 characters").nullable().optional(),
|
|
3879
|
+
monthlyTokenLimit: k().int().positive().optional()
|
|
3857
3880
|
});
|
|
3858
|
-
|
|
3859
|
-
type:
|
|
3860
|
-
text:
|
|
3881
|
+
gt = y({
|
|
3882
|
+
type: b("text"),
|
|
3883
|
+
text: f()
|
|
3861
3884
|
});
|
|
3862
|
-
|
|
3863
|
-
type:
|
|
3864
|
-
id:
|
|
3865
|
-
name:
|
|
3866
|
-
input:
|
|
3885
|
+
vt = y({
|
|
3886
|
+
type: b("tool_use"),
|
|
3887
|
+
id: f(),
|
|
3888
|
+
name: f(),
|
|
3889
|
+
input: X(re())
|
|
3867
3890
|
});
|
|
3868
|
-
|
|
3869
|
-
type:
|
|
3870
|
-
tool_use_id:
|
|
3871
|
-
content:
|
|
3872
|
-
is_error:
|
|
3891
|
+
Tt = y({
|
|
3892
|
+
type: b("tool_result"),
|
|
3893
|
+
tool_use_id: f(),
|
|
3894
|
+
content: f(),
|
|
3895
|
+
is_error: xe().optional()
|
|
3873
3896
|
});
|
|
3874
|
-
|
|
3875
|
-
type:
|
|
3876
|
-
thinking:
|
|
3897
|
+
Et = y({
|
|
3898
|
+
type: b("thinking"),
|
|
3899
|
+
thinking: f()
|
|
3877
3900
|
});
|
|
3878
|
-
|
|
3879
|
-
type:
|
|
3880
|
-
source:
|
|
3881
|
-
type:
|
|
3882
|
-
media_type:
|
|
3883
|
-
data:
|
|
3901
|
+
kt = y({
|
|
3902
|
+
type: b("image"),
|
|
3903
|
+
source: y({
|
|
3904
|
+
type: b("base64"),
|
|
3905
|
+
media_type: f(),
|
|
3906
|
+
data: f()
|
|
3884
3907
|
})
|
|
3885
3908
|
});
|
|
3886
|
-
|
|
3887
|
-
yt,
|
|
3909
|
+
G = Fe("type", [
|
|
3888
3910
|
gt,
|
|
3889
3911
|
vt,
|
|
3890
3912
|
Tt,
|
|
3891
|
-
Et
|
|
3913
|
+
Et,
|
|
3914
|
+
kt
|
|
3892
3915
|
]);
|
|
3893
|
-
|
|
3894
|
-
id:
|
|
3895
|
-
orgId:
|
|
3896
|
-
userId:
|
|
3897
|
-
title:
|
|
3898
|
-
origin:
|
|
3899
|
-
originMetadata:
|
|
3900
|
-
authMethod:
|
|
3901
|
-
authId:
|
|
3916
|
+
Zt = y({
|
|
3917
|
+
id: f().uuid(),
|
|
3918
|
+
orgId: f(),
|
|
3919
|
+
userId: f().uuid(),
|
|
3920
|
+
title: f().nullable(),
|
|
3921
|
+
origin: U(["cli", "web", "github"]).default("web"),
|
|
3922
|
+
originMetadata: X(re()).nullable().optional(),
|
|
3923
|
+
authMethod: U(["clerk", "cli-token", "api-key"]).default("clerk"),
|
|
3924
|
+
authId: f().nullable().optional(),
|
|
3902
3925
|
// Claude Agent SDK session ID for resuming conversations
|
|
3903
3926
|
// Sessions expire after ~30 days due to Anthropic's data retention policy
|
|
3904
|
-
providerSessionId:
|
|
3905
|
-
createdAt:
|
|
3906
|
-
updatedAt:
|
|
3927
|
+
providerSessionId: f().nullable().optional(),
|
|
3928
|
+
createdAt: I(),
|
|
3929
|
+
updatedAt: I()
|
|
3907
3930
|
});
|
|
3908
|
-
|
|
3909
|
-
title:
|
|
3910
|
-
origin:
|
|
3911
|
-
originMetadata:
|
|
3931
|
+
Lt = y({
|
|
3932
|
+
title: f().optional(),
|
|
3933
|
+
origin: U(["cli", "web", "github"]).optional(),
|
|
3934
|
+
originMetadata: X(re()).optional()
|
|
3912
3935
|
});
|
|
3913
|
-
|
|
3914
|
-
title:
|
|
3915
|
-
providerSessionId:
|
|
3936
|
+
St = y({
|
|
3937
|
+
title: f().optional(),
|
|
3938
|
+
providerSessionId: f().optional()
|
|
3916
3939
|
});
|
|
3917
|
-
|
|
3918
|
-
id:
|
|
3919
|
-
conversationId:
|
|
3920
|
-
role:
|
|
3921
|
-
content:
|
|
3922
|
-
createdAt:
|
|
3940
|
+
Pt = y({
|
|
3941
|
+
id: f().uuid(),
|
|
3942
|
+
conversationId: f().uuid(),
|
|
3943
|
+
role: U(["user", "assistant"]),
|
|
3944
|
+
content: P(G),
|
|
3945
|
+
createdAt: I()
|
|
3923
3946
|
});
|
|
3924
|
-
|
|
3925
|
-
role:
|
|
3926
|
-
content:
|
|
3947
|
+
Ut = y({
|
|
3948
|
+
role: U(["user", "assistant"]),
|
|
3949
|
+
content: P(G)
|
|
3927
3950
|
});
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
type:
|
|
3931
|
-
content:
|
|
3951
|
+
jt = Fe("type", [
|
|
3952
|
+
y({
|
|
3953
|
+
type: b("user_message"),
|
|
3954
|
+
content: P(G)
|
|
3932
3955
|
}),
|
|
3933
|
-
|
|
3934
|
-
type:
|
|
3935
|
-
delta:
|
|
3956
|
+
y({
|
|
3957
|
+
type: b("assistant_text"),
|
|
3958
|
+
delta: f()
|
|
3936
3959
|
}),
|
|
3937
|
-
|
|
3938
|
-
type:
|
|
3939
|
-
delta:
|
|
3960
|
+
y({
|
|
3961
|
+
type: b("assistant_thinking"),
|
|
3962
|
+
delta: f()
|
|
3940
3963
|
}),
|
|
3941
|
-
|
|
3942
|
-
type:
|
|
3943
|
-
id:
|
|
3944
|
-
name:
|
|
3945
|
-
input:
|
|
3964
|
+
y({
|
|
3965
|
+
type: b("tool_use"),
|
|
3966
|
+
id: f(),
|
|
3967
|
+
name: f(),
|
|
3968
|
+
input: X(re())
|
|
3946
3969
|
}),
|
|
3947
|
-
|
|
3948
|
-
type:
|
|
3949
|
-
tool_use_id:
|
|
3950
|
-
content:
|
|
3951
|
-
is_error:
|
|
3970
|
+
y({
|
|
3971
|
+
type: b("tool_result"),
|
|
3972
|
+
tool_use_id: f(),
|
|
3973
|
+
content: f(),
|
|
3974
|
+
is_error: xe().optional()
|
|
3952
3975
|
}),
|
|
3953
|
-
|
|
3954
|
-
type:
|
|
3955
|
-
message:
|
|
3956
|
-
role:
|
|
3957
|
-
content:
|
|
3976
|
+
y({
|
|
3977
|
+
type: b("message_complete"),
|
|
3978
|
+
message: y({
|
|
3979
|
+
role: U(["user", "assistant"]),
|
|
3980
|
+
content: P(G)
|
|
3958
3981
|
})
|
|
3959
3982
|
}),
|
|
3960
|
-
|
|
3961
|
-
type:
|
|
3983
|
+
y({
|
|
3984
|
+
type: b("session_complete")
|
|
3962
3985
|
}),
|
|
3963
|
-
|
|
3964
|
-
type:
|
|
3965
|
-
error:
|
|
3986
|
+
y({
|
|
3987
|
+
type: b("session_error"),
|
|
3988
|
+
error: f()
|
|
3989
|
+
}),
|
|
3990
|
+
y({
|
|
3991
|
+
type: b("query_start"),
|
|
3992
|
+
prompt: f()
|
|
3993
|
+
}),
|
|
3994
|
+
y({
|
|
3995
|
+
type: b("query_complete"),
|
|
3996
|
+
usage: y({
|
|
3997
|
+
model: f(),
|
|
3998
|
+
numTurns: k(),
|
|
3999
|
+
durationMs: k(),
|
|
4000
|
+
inputTokens: k(),
|
|
4001
|
+
outputTokens: k(),
|
|
4002
|
+
cacheReadTokens: k(),
|
|
4003
|
+
cacheCreationTokens: k(),
|
|
4004
|
+
costUsd: k()
|
|
4005
|
+
}),
|
|
4006
|
+
result: y({
|
|
4007
|
+
status: U(["success", "error", "interrupted"]),
|
|
4008
|
+
summary: f(),
|
|
4009
|
+
error: f().optional()
|
|
4010
|
+
})
|
|
3966
4011
|
})
|
|
3967
4012
|
]);
|
|
3968
|
-
|
|
3969
|
-
title:
|
|
3970
|
-
originMetadata:
|
|
4013
|
+
Ct = y({
|
|
4014
|
+
title: f(),
|
|
4015
|
+
originMetadata: X(re()).optional()
|
|
4016
|
+
});
|
|
4017
|
+
xt = y({
|
|
4018
|
+
summary: f(),
|
|
4019
|
+
status: U(["success", "error_max_turns", "error_during_execution", "interrupted"]),
|
|
4020
|
+
error: f().optional()
|
|
4021
|
+
});
|
|
4022
|
+
bt = y({
|
|
4023
|
+
assistant: P(G),
|
|
4024
|
+
toolResults: P(G).optional()
|
|
4025
|
+
});
|
|
4026
|
+
Ot = y({
|
|
4027
|
+
userMessage: P(G),
|
|
4028
|
+
turns: P(bt),
|
|
4029
|
+
result: xt
|
|
4030
|
+
});
|
|
4031
|
+
$t = y({
|
|
4032
|
+
model: f(),
|
|
4033
|
+
numTurns: k(),
|
|
4034
|
+
durationMs: k(),
|
|
4035
|
+
inputTokens: k(),
|
|
4036
|
+
outputTokens: k(),
|
|
4037
|
+
cacheReadTokens: k(),
|
|
4038
|
+
cacheCreationTokens: k(),
|
|
4039
|
+
costUsd: k()
|
|
4040
|
+
});
|
|
4041
|
+
Vt = y({
|
|
4042
|
+
id: f().uuid(),
|
|
4043
|
+
sessionId: f().uuid(),
|
|
4044
|
+
sequence: k(),
|
|
4045
|
+
prompt: f(),
|
|
4046
|
+
content: Ot,
|
|
4047
|
+
model: f(),
|
|
4048
|
+
numTurns: k(),
|
|
4049
|
+
durationMs: k().nullable(),
|
|
4050
|
+
inputTokens: k(),
|
|
4051
|
+
outputTokens: k(),
|
|
4052
|
+
cacheReadTokens: k(),
|
|
4053
|
+
cacheCreationTokens: k(),
|
|
4054
|
+
costUsd: k(),
|
|
4055
|
+
status: U(["running", "success", "error", "interrupted"]),
|
|
4056
|
+
errorMessage: f().nullable(),
|
|
4057
|
+
startedAt: Se.date(),
|
|
4058
|
+
completedAt: Se.date().nullable()
|
|
3971
4059
|
});
|
|
3972
4060
|
}
|
|
3973
4061
|
});
|
|
@@ -4429,7 +4517,7 @@ var CLI_VERSION;
|
|
|
4429
4517
|
var init_version = __esm({
|
|
4430
4518
|
"src/version.ts"() {
|
|
4431
4519
|
"use strict";
|
|
4432
|
-
CLI_VERSION = "0.0.
|
|
4520
|
+
CLI_VERSION = "0.0.9";
|
|
4433
4521
|
}
|
|
4434
4522
|
});
|
|
4435
4523
|
|
|
@@ -4502,103 +4590,6 @@ var init_encryption = __esm({
|
|
|
4502
4590
|
}
|
|
4503
4591
|
});
|
|
4504
4592
|
|
|
4505
|
-
// src/utils/keychain-storage.ts
|
|
4506
|
-
import crypto2 from "crypto";
|
|
4507
|
-
async function getKeytar() {
|
|
4508
|
-
if (keytarLoadAttempted) {
|
|
4509
|
-
return keytarModule;
|
|
4510
|
-
}
|
|
4511
|
-
keytarLoadAttempted = true;
|
|
4512
|
-
try {
|
|
4513
|
-
const moduleName = "keytar";
|
|
4514
|
-
const mod = await import(moduleName);
|
|
4515
|
-
keytarModule = mod.default || mod;
|
|
4516
|
-
} catch {
|
|
4517
|
-
keytarModule = null;
|
|
4518
|
-
}
|
|
4519
|
-
return keytarModule;
|
|
4520
|
-
}
|
|
4521
|
-
async function isKeychainAvailable() {
|
|
4522
|
-
if (keychainAvailable !== null) {
|
|
4523
|
-
return keychainAvailable;
|
|
4524
|
-
}
|
|
4525
|
-
if (process.env.SUPATEST_FORCE_FILE_STORAGE === "true") {
|
|
4526
|
-
keychainAvailable = false;
|
|
4527
|
-
return false;
|
|
4528
|
-
}
|
|
4529
|
-
try {
|
|
4530
|
-
const keytar = await getKeytar();
|
|
4531
|
-
if (!keytar) {
|
|
4532
|
-
keychainAvailable = false;
|
|
4533
|
-
return false;
|
|
4534
|
-
}
|
|
4535
|
-
const testAccount = `${KEYCHAIN_TEST_PREFIX}${crypto2.randomBytes(8).toString("hex")}`;
|
|
4536
|
-
const testPassword = "test";
|
|
4537
|
-
await keytar.setPassword(SERVICE_NAME, testAccount, testPassword);
|
|
4538
|
-
const retrieved = await keytar.getPassword(SERVICE_NAME, testAccount);
|
|
4539
|
-
const deleted = await keytar.deletePassword(SERVICE_NAME, testAccount);
|
|
4540
|
-
keychainAvailable = deleted && retrieved === testPassword;
|
|
4541
|
-
} catch {
|
|
4542
|
-
keychainAvailable = false;
|
|
4543
|
-
}
|
|
4544
|
-
return keychainAvailable;
|
|
4545
|
-
}
|
|
4546
|
-
async function saveToKeychain(token, expiresAt) {
|
|
4547
|
-
const keytar = await getKeytar();
|
|
4548
|
-
if (!keytar) {
|
|
4549
|
-
return false;
|
|
4550
|
-
}
|
|
4551
|
-
const payload = {
|
|
4552
|
-
token,
|
|
4553
|
-
expiresAt,
|
|
4554
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
4555
|
-
};
|
|
4556
|
-
try {
|
|
4557
|
-
await keytar.setPassword(SERVICE_NAME, ACCOUNT_NAME, JSON.stringify(payload));
|
|
4558
|
-
return true;
|
|
4559
|
-
} catch {
|
|
4560
|
-
return false;
|
|
4561
|
-
}
|
|
4562
|
-
}
|
|
4563
|
-
async function loadFromKeychain() {
|
|
4564
|
-
const keytar = await getKeytar();
|
|
4565
|
-
if (!keytar) {
|
|
4566
|
-
return null;
|
|
4567
|
-
}
|
|
4568
|
-
try {
|
|
4569
|
-
const data = await keytar.getPassword(SERVICE_NAME, ACCOUNT_NAME);
|
|
4570
|
-
if (!data) {
|
|
4571
|
-
return null;
|
|
4572
|
-
}
|
|
4573
|
-
return JSON.parse(data);
|
|
4574
|
-
} catch {
|
|
4575
|
-
return null;
|
|
4576
|
-
}
|
|
4577
|
-
}
|
|
4578
|
-
async function removeFromKeychain() {
|
|
4579
|
-
const keytar = await getKeytar();
|
|
4580
|
-
if (!keytar) {
|
|
4581
|
-
return false;
|
|
4582
|
-
}
|
|
4583
|
-
try {
|
|
4584
|
-
return await keytar.deletePassword(SERVICE_NAME, ACCOUNT_NAME);
|
|
4585
|
-
} catch {
|
|
4586
|
-
return false;
|
|
4587
|
-
}
|
|
4588
|
-
}
|
|
4589
|
-
var SERVICE_NAME, ACCOUNT_NAME, KEYCHAIN_TEST_PREFIX, keytarModule, keytarLoadAttempted, keychainAvailable;
|
|
4590
|
-
var init_keychain_storage = __esm({
|
|
4591
|
-
"src/utils/keychain-storage.ts"() {
|
|
4592
|
-
"use strict";
|
|
4593
|
-
SERVICE_NAME = "supatest-cli";
|
|
4594
|
-
ACCOUNT_NAME = "cli-token";
|
|
4595
|
-
KEYCHAIN_TEST_PREFIX = "__keychain_test__";
|
|
4596
|
-
keytarModule = null;
|
|
4597
|
-
keytarLoadAttempted = false;
|
|
4598
|
-
keychainAvailable = null;
|
|
4599
|
-
}
|
|
4600
|
-
});
|
|
4601
|
-
|
|
4602
4593
|
// src/utils/token-storage.ts
|
|
4603
4594
|
import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, unlinkSync, writeFileSync } from "fs";
|
|
4604
4595
|
import { homedir } from "os";
|
|
@@ -4611,24 +4602,7 @@ function ensureConfigDir() {
|
|
|
4611
4602
|
mkdirSync(CONFIG_DIR, { recursive: true, mode: 448 });
|
|
4612
4603
|
}
|
|
4613
4604
|
}
|
|
4614
|
-
|
|
4615
|
-
if (await isKeychainAvailable()) {
|
|
4616
|
-
activeStorageType = "keychain" /* KEYCHAIN */;
|
|
4617
|
-
} else {
|
|
4618
|
-
activeStorageType = "encrypted_file" /* ENCRYPTED_FILE */;
|
|
4619
|
-
}
|
|
4620
|
-
return activeStorageType;
|
|
4621
|
-
}
|
|
4622
|
-
async function getStorageType() {
|
|
4623
|
-
if (activeStorageType !== null) {
|
|
4624
|
-
return activeStorageType;
|
|
4625
|
-
}
|
|
4626
|
-
if (!storageInitPromise) {
|
|
4627
|
-
storageInitPromise = initializeStorage();
|
|
4628
|
-
}
|
|
4629
|
-
return storageInitPromise;
|
|
4630
|
-
}
|
|
4631
|
-
function saveTokenToFile(token, expiresAt) {
|
|
4605
|
+
function saveToken(token, expiresAt) {
|
|
4632
4606
|
ensureConfigDir();
|
|
4633
4607
|
const payload = {
|
|
4634
4608
|
token,
|
|
@@ -4641,17 +4615,27 @@ function saveTokenToFile(token, expiresAt) {
|
|
|
4641
4615
|
};
|
|
4642
4616
|
writeFileSync(TOKEN_FILE, JSON.stringify(stored, null, 2), { mode: 384 });
|
|
4643
4617
|
}
|
|
4644
|
-
function
|
|
4618
|
+
function loadToken() {
|
|
4645
4619
|
if (!existsSync2(TOKEN_FILE)) {
|
|
4646
4620
|
return null;
|
|
4647
4621
|
}
|
|
4648
4622
|
try {
|
|
4649
4623
|
const data = readFileSync2(TOKEN_FILE, "utf8");
|
|
4650
4624
|
const stored = JSON.parse(data);
|
|
4625
|
+
let payload;
|
|
4651
4626
|
if (isV2Format(stored)) {
|
|
4652
|
-
|
|
4627
|
+
payload = JSON.parse(decrypt(stored.encryptedData));
|
|
4628
|
+
} else {
|
|
4629
|
+
payload = stored;
|
|
4630
|
+
}
|
|
4631
|
+
if (payload.expiresAt) {
|
|
4632
|
+
const expiresAt = new Date(payload.expiresAt);
|
|
4633
|
+
if (expiresAt < /* @__PURE__ */ new Date()) {
|
|
4634
|
+
console.warn("CLI token has expired. Please run 'supatest login' again.");
|
|
4635
|
+
return null;
|
|
4636
|
+
}
|
|
4653
4637
|
}
|
|
4654
|
-
return
|
|
4638
|
+
return payload.token;
|
|
4655
4639
|
} catch (error) {
|
|
4656
4640
|
const err = error;
|
|
4657
4641
|
if (err.message?.includes("Invalid encrypted data format") || err.message?.includes("Unsupported state or unable to authenticate data")) {
|
|
@@ -4663,65 +4647,19 @@ function loadTokenFromFile() {
|
|
|
4663
4647
|
return null;
|
|
4664
4648
|
}
|
|
4665
4649
|
}
|
|
4666
|
-
function
|
|
4650
|
+
function removeToken() {
|
|
4667
4651
|
if (existsSync2(TOKEN_FILE)) {
|
|
4668
4652
|
unlinkSync(TOKEN_FILE);
|
|
4669
4653
|
}
|
|
4670
4654
|
}
|
|
4671
|
-
|
|
4672
|
-
const payload = loadTokenFromFile();
|
|
4673
|
-
if (!payload) {
|
|
4674
|
-
return null;
|
|
4675
|
-
}
|
|
4676
|
-
if (payload.expiresAt) {
|
|
4677
|
-
const expiresAt = new Date(payload.expiresAt);
|
|
4678
|
-
if (expiresAt < /* @__PURE__ */ new Date()) {
|
|
4679
|
-
console.warn("CLI token has expired. Please run 'supatest login' again.");
|
|
4680
|
-
return null;
|
|
4681
|
-
}
|
|
4682
|
-
}
|
|
4683
|
-
return payload.token;
|
|
4684
|
-
}
|
|
4685
|
-
async function saveTokenAsync(token, expiresAt) {
|
|
4686
|
-
const storageType = await getStorageType();
|
|
4687
|
-
if (storageType === "keychain" /* KEYCHAIN */) {
|
|
4688
|
-
const saved = await saveToKeychain(token, expiresAt);
|
|
4689
|
-
if (saved) {
|
|
4690
|
-
removeTokenFile();
|
|
4691
|
-
return;
|
|
4692
|
-
}
|
|
4693
|
-
}
|
|
4694
|
-
saveTokenToFile(token, expiresAt);
|
|
4695
|
-
}
|
|
4696
|
-
async function loadTokenAsync() {
|
|
4697
|
-
const storageType = await getStorageType();
|
|
4698
|
-
if (storageType === "keychain" /* KEYCHAIN */) {
|
|
4699
|
-
const payload = await loadFromKeychain();
|
|
4700
|
-
if (payload) {
|
|
4701
|
-
if (payload.expiresAt && new Date(payload.expiresAt) < /* @__PURE__ */ new Date()) {
|
|
4702
|
-
console.warn("CLI token has expired. Please run 'supatest login' again.");
|
|
4703
|
-
return null;
|
|
4704
|
-
}
|
|
4705
|
-
return payload.token;
|
|
4706
|
-
}
|
|
4707
|
-
}
|
|
4708
|
-
return loadToken();
|
|
4709
|
-
}
|
|
4710
|
-
async function removeTokenAsync() {
|
|
4711
|
-
await removeFromKeychain();
|
|
4712
|
-
removeTokenFile();
|
|
4713
|
-
}
|
|
4714
|
-
var CONFIG_DIR, TOKEN_FILE, STORAGE_VERSION, activeStorageType, storageInitPromise;
|
|
4655
|
+
var CONFIG_DIR, TOKEN_FILE, STORAGE_VERSION;
|
|
4715
4656
|
var init_token_storage = __esm({
|
|
4716
4657
|
"src/utils/token-storage.ts"() {
|
|
4717
4658
|
"use strict";
|
|
4718
4659
|
init_encryption();
|
|
4719
|
-
init_keychain_storage();
|
|
4720
4660
|
CONFIG_DIR = join4(homedir(), ".supatest");
|
|
4721
4661
|
TOKEN_FILE = join4(CONFIG_DIR, "token.json");
|
|
4722
4662
|
STORAGE_VERSION = 2;
|
|
4723
|
-
activeStorageType = null;
|
|
4724
|
-
storageInitPromise = null;
|
|
4725
4663
|
}
|
|
4726
4664
|
});
|
|
4727
4665
|
|
|
@@ -4835,7 +4773,7 @@ var init_react = __esm({
|
|
|
4835
4773
|
const message = {
|
|
4836
4774
|
type: "tool",
|
|
4837
4775
|
content: getToolDescription(tool, input),
|
|
4838
|
-
toolName:
|
|
4776
|
+
toolName: qt(tool),
|
|
4839
4777
|
toolInput: input,
|
|
4840
4778
|
toolResult: void 0,
|
|
4841
4779
|
isExpanded: false,
|
|
@@ -4930,14 +4868,14 @@ var init_react = __esm({
|
|
|
4930
4868
|
|
|
4931
4869
|
// src/commands/login.ts
|
|
4932
4870
|
import { spawn } from "child_process";
|
|
4933
|
-
import
|
|
4871
|
+
import crypto2 from "crypto";
|
|
4934
4872
|
import http from "http";
|
|
4935
4873
|
import { platform } from "os";
|
|
4936
4874
|
function escapeHtml(text) {
|
|
4937
4875
|
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
4938
4876
|
}
|
|
4939
4877
|
function generateState() {
|
|
4940
|
-
return
|
|
4878
|
+
return crypto2.randomBytes(STATE_LENGTH).toString("hex");
|
|
4941
4879
|
}
|
|
4942
4880
|
async function exchangeCodeForToken(code, state) {
|
|
4943
4881
|
const response = await fetch(`${API_URL}/web/auth/cli-token-exchange`, {
|
|
@@ -7342,7 +7280,7 @@ var init_ToolMessage = __esm({
|
|
|
7342
7280
|
result,
|
|
7343
7281
|
isExpanded = true
|
|
7344
7282
|
}) => {
|
|
7345
|
-
const displayName =
|
|
7283
|
+
const displayName = qt(toolName);
|
|
7346
7284
|
const { icon, color } = getToolStyle(toolName);
|
|
7347
7285
|
const resultSummary = result ? getResultSummary(toolName, result) : null;
|
|
7348
7286
|
const hasExpandableContent = !!result;
|
|
@@ -8034,7 +7972,7 @@ var init_App = __esm({
|
|
|
8034
7972
|
};
|
|
8035
7973
|
AppContent = ({ config: config2, sessionId, webUrl, queuedTasks = [], onExit, onSubmitTask, apiClient, onResumeSession }) => {
|
|
8036
7974
|
const { exit } = useApp();
|
|
8037
|
-
const { addMessage, clearMessages, isAgentRunning, messages, setSessionId, setWebUrl, setShouldInterruptAgent, toggleAllToolOutputs, allToolsExpanded } = useSession();
|
|
7975
|
+
const { addMessage, clearMessages, isAgentRunning, messages, setSessionId, setWebUrl, setShouldInterruptAgent, setIsAgentRunning, toggleAllToolOutputs, allToolsExpanded } = useSession();
|
|
8038
7976
|
useModeToggle();
|
|
8039
7977
|
const [terminalWidth, setTerminalWidth] = useState7(process.stdout.columns || 80);
|
|
8040
7978
|
const [terminalHeight, setTerminalHeight] = useState7(process.stdout.rows || 24);
|
|
@@ -8072,7 +8010,7 @@ var init_App = __esm({
|
|
|
8072
8010
|
});
|
|
8073
8011
|
try {
|
|
8074
8012
|
const result = await loginCommand();
|
|
8075
|
-
|
|
8013
|
+
saveToken(result.token, result.expiresAt);
|
|
8076
8014
|
if (apiClient) {
|
|
8077
8015
|
apiClient.setApiKey(result.token);
|
|
8078
8016
|
}
|
|
@@ -8126,7 +8064,7 @@ var init_App = __esm({
|
|
|
8126
8064
|
});
|
|
8127
8065
|
return;
|
|
8128
8066
|
}
|
|
8129
|
-
|
|
8067
|
+
removeToken();
|
|
8130
8068
|
if (apiClient) {
|
|
8131
8069
|
apiClient.clearApiKey();
|
|
8132
8070
|
}
|
|
@@ -8181,6 +8119,11 @@ var init_App = __esm({
|
|
|
8181
8119
|
}
|
|
8182
8120
|
setHasInputContent(false);
|
|
8183
8121
|
setExitWarning(null);
|
|
8122
|
+
addMessage({
|
|
8123
|
+
type: "user",
|
|
8124
|
+
content: task
|
|
8125
|
+
});
|
|
8126
|
+
setIsAgentRunning(true);
|
|
8184
8127
|
if (onSubmitTask) {
|
|
8185
8128
|
onSubmitTask(task);
|
|
8186
8129
|
}
|
|
@@ -8566,7 +8509,8 @@ var init_interactive = __esm({
|
|
|
8566
8509
|
const {
|
|
8567
8510
|
addMessage,
|
|
8568
8511
|
loadMessages,
|
|
8569
|
-
setSessionId: setContextSessionId
|
|
8512
|
+
setSessionId: setContextSessionId,
|
|
8513
|
+
setIsAgentRunning
|
|
8570
8514
|
} = useSession();
|
|
8571
8515
|
const [sessionId, setSessionId] = React22.useState(initialSessionId);
|
|
8572
8516
|
const [currentTask, setCurrentTask] = React22.useState(config2.task);
|
|
@@ -8591,6 +8535,7 @@ var init_interactive = __esm({
|
|
|
8591
8535
|
content: errorMessage,
|
|
8592
8536
|
errorType: error instanceof ApiError && error.isAuthError ? "warning" : "error"
|
|
8593
8537
|
});
|
|
8538
|
+
setIsAgentRunning(false);
|
|
8594
8539
|
return;
|
|
8595
8540
|
}
|
|
8596
8541
|
}
|
|
@@ -8598,10 +8543,6 @@ var init_interactive = __esm({
|
|
|
8598
8543
|
setTaskQueue((prev) => [...prev, task]);
|
|
8599
8544
|
} else {
|
|
8600
8545
|
setCurrentTask(task);
|
|
8601
|
-
addMessage({
|
|
8602
|
-
type: "user",
|
|
8603
|
-
content: task
|
|
8604
|
-
});
|
|
8605
8546
|
setTaskId((prev) => prev + 1);
|
|
8606
8547
|
setShouldRunAgent(true);
|
|
8607
8548
|
}
|
|
@@ -8948,7 +8889,7 @@ var ConsolePresenter = class {
|
|
|
8948
8889
|
}
|
|
8949
8890
|
onToolUse(tool, input, _toolId) {
|
|
8950
8891
|
if (this.spinner) {
|
|
8951
|
-
const displayName =
|
|
8892
|
+
const displayName = qt(tool);
|
|
8952
8893
|
this.spinner.text = `Using ${displayName}...`;
|
|
8953
8894
|
}
|
|
8954
8895
|
this.stopSpinner();
|
|
@@ -9472,7 +9413,7 @@ program.name("supatest").description(
|
|
|
9472
9413
|
process.exit(1);
|
|
9473
9414
|
}
|
|
9474
9415
|
} else {
|
|
9475
|
-
const cliToken =
|
|
9416
|
+
const cliToken = loadToken();
|
|
9476
9417
|
if (cliToken) {
|
|
9477
9418
|
supatestApiKey = cliToken;
|
|
9478
9419
|
} else {
|