@keystrokehq/cli 0.0.105 → 0.0.108
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/{dist-DvDsEErE.mjs → dist-D1ip549D.mjs} +2 -2
- package/dist/{dist-DvDsEErE.mjs.map → dist-D1ip549D.mjs.map} +1 -1
- package/dist/index.mjs +48 -4402
- package/dist/index.mjs.map +1 -1
- package/dist/maybe-auto-update-DCsPT080.mjs +247 -0
- package/dist/maybe-auto-update-DCsPT080.mjs.map +1 -0
- package/dist/schemas-DwAYtN9C.mjs +4296 -0
- package/dist/schemas-DwAYtN9C.mjs.map +1 -0
- package/dist/skills-bundle/_AGENTS.md +12 -12
- package/dist/skills-bundle/skills/{actions → keystroke-actions}/SKILL.md +2 -2
- package/dist/skills-bundle/skills/{agents → keystroke-agents}/SKILL.md +2 -2
- package/dist/skills-bundle/skills/{cli → keystroke-cli}/SKILL.md +2 -2
- package/dist/skills-bundle/skills/{credentials → keystroke-credentials}/SKILL.md +2 -2
- package/dist/skills-bundle/skills/{credentials → keystroke-credentials}/references/cli-and-oauth.md +1 -1
- package/dist/skills-bundle/skills/{files → keystroke-files}/SKILL.md +2 -2
- package/dist/skills-bundle/skills/{gateways → keystroke-gateways}/SKILL.md +2 -2
- package/dist/skills-bundle/skills/{skills → keystroke-skills}/SKILL.md +2 -2
- package/dist/skills-bundle/skills/{triggers → keystroke-triggers}/SKILL.md +2 -2
- package/dist/skills-bundle/skills/{workflows → keystroke-workflows}/SKILL.md +2 -2
- package/dist/version-DESgLEkE.mjs +94 -0
- package/dist/version-DESgLEkE.mjs.map +1 -0
- package/package.json +1 -1
- /package/dist/skills-bundle/skills/{actions → keystroke-actions}/references/catalog-and-imports.md +0 -0
- /package/dist/skills-bundle/skills/{agents → keystroke-agents}/references/models.md +0 -0
- /package/dist/skills-bundle/skills/{agents → keystroke-agents}/references/tools-mcp-codemode.md +0 -0
- /package/dist/skills-bundle/skills/{agents → keystroke-agents}/references/workflows-and-testing.md +0 -0
- /package/dist/skills-bundle/skills/{cli → keystroke-cli}/references/api-targets.md +0 -0
- /package/dist/skills-bundle/skills/{gateways → keystroke-gateways}/references/slack-setup.md +0 -0
- /package/dist/skills-bundle/skills/{workflows → keystroke-workflows}/references/authoring.md +0 -0
- /package/dist/skills-bundle/skills/{workflows → keystroke-workflows}/references/testing.md +0 -0
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { a as boolean, c as literal, d as record, f as string, h as _coercedNumber, i as array, l as number$1, m as unknown, n as ZodType, o as custom, p as union, r as _enum, s as discriminatedUnion, t as ZodNumber, u as object } from "./schemas-DwAYtN9C.mjs";
|
|
3
|
+
import { a as installPlaygroundDependencies, i as installDependencies, n as buildPlaygroundWorkspace, o as resolvePackageManager, s as resolveCliRoot, t as readCliVersion } from "./version-DESgLEkE.mjs";
|
|
2
4
|
import { createRequire } from "node:module";
|
|
3
5
|
import { Command } from "commander";
|
|
4
6
|
import { Entry } from "@napi-rs/keyring";
|
|
@@ -8,7 +10,7 @@ import { basename, dirname, isAbsolute, join, relative, resolve } from "node:pat
|
|
|
8
10
|
import { confirm, input, select } from "@inquirer/prompts";
|
|
9
11
|
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
|
|
10
12
|
import { spawn, spawnSync } from "node:child_process";
|
|
11
|
-
import {
|
|
13
|
+
import { pathToFileURL } from "node:url";
|
|
12
14
|
import { access, copyFile, cp, mkdir, readFile, readdir, stat, symlink, unlink, writeFile } from "node:fs/promises";
|
|
13
15
|
//#region ../../node_modules/.pnpm/ky@2.0.2/node_modules/ky/distribution/errors/KyError.js
|
|
14
16
|
/**
|
|
@@ -396,11 +398,11 @@ const streamRequest = (request, onUploadProgress, originalBody) => {
|
|
|
396
398
|
};
|
|
397
399
|
//#endregion
|
|
398
400
|
//#region ../../node_modules/.pnpm/ky@2.0.2/node_modules/ky/distribution/utils/is.js
|
|
399
|
-
const isObject
|
|
401
|
+
const isObject = (value) => value !== null && typeof value === "object";
|
|
400
402
|
//#endregion
|
|
401
403
|
//#region ../../node_modules/.pnpm/ky@2.0.2/node_modules/ky/distribution/utils/merge.js
|
|
402
404
|
const replaceSymbol = Symbol("replaceOption");
|
|
403
|
-
const getReplaceState = (value) => isObject
|
|
405
|
+
const getReplaceState = (value) => isObject(value) && value[replaceSymbol] === true ? {
|
|
404
406
|
isReplace: true,
|
|
405
407
|
value: value.value
|
|
406
408
|
} : {
|
|
@@ -408,7 +410,7 @@ const getReplaceState = (value) => isObject$1(value) && value[replaceSymbol] ===
|
|
|
408
410
|
value
|
|
409
411
|
};
|
|
410
412
|
const validateAndMerge = (...sources) => {
|
|
411
|
-
for (const source of sources) if ((!isObject
|
|
413
|
+
for (const source of sources) if ((!isObject(source) || Array.isArray(source)) && source !== void 0) throw new TypeError("The `options` argument must be an object");
|
|
412
414
|
return deepMerge({}, ...sources);
|
|
413
415
|
};
|
|
414
416
|
const mergeHeaders = (source1 = {}, source2 = {}) => {
|
|
@@ -419,8 +421,8 @@ const mergeHeaders = (source1 = {}, source2 = {}) => {
|
|
|
419
421
|
else result.set(key, value);
|
|
420
422
|
return result;
|
|
421
423
|
};
|
|
422
|
-
const isPlainObject$
|
|
423
|
-
if (!isObject
|
|
424
|
+
const isPlainObject$1 = (value) => {
|
|
425
|
+
if (!isObject(value) || Array.isArray(value)) return false;
|
|
424
426
|
const prototype = Object.getPrototypeOf(value);
|
|
425
427
|
return prototype === Object.prototype || prototype === null;
|
|
426
428
|
};
|
|
@@ -433,12 +435,12 @@ const cloneShallow = (value) => {
|
|
|
433
435
|
}
|
|
434
436
|
if (value instanceof globalThis.Headers) return new globalThis.Headers(value);
|
|
435
437
|
if (Array.isArray(value)) return [...value];
|
|
436
|
-
if (isPlainObject$
|
|
438
|
+
if (isPlainObject$1(value)) return { ...value };
|
|
437
439
|
return value;
|
|
438
440
|
};
|
|
439
441
|
const normalizeHeaderObject = (headers) => Object.fromEntries(Object.entries(headers).filter((entry) => entry[1] !== void 0));
|
|
440
442
|
const mergeHeaderContainers = (source1, source2) => {
|
|
441
|
-
if (isPlainObject$
|
|
443
|
+
if (isPlainObject$1(source1) && isPlainObject$1(source2)) return normalizeHeaderObject({
|
|
442
444
|
...source1,
|
|
443
445
|
...source2
|
|
444
446
|
});
|
|
@@ -475,7 +477,7 @@ const appendSearchParameters = (target, source) => {
|
|
|
475
477
|
result.append(String(pair[0]), String(pair[1]));
|
|
476
478
|
deleted.delete(String(pair[0]));
|
|
477
479
|
}
|
|
478
|
-
else if (isObject
|
|
480
|
+
else if (isObject(input)) for (const [key, value] of Object.entries(input)) if (value === void 0) {
|
|
479
481
|
result.delete(key);
|
|
480
482
|
deleted.add(key);
|
|
481
483
|
} else {
|
|
@@ -502,7 +504,7 @@ const deepMerge = (...sources) => {
|
|
|
502
504
|
for (const source of sources) if (Array.isArray(source)) {
|
|
503
505
|
if (!Array.isArray(returnValue)) returnValue = [];
|
|
504
506
|
returnValue = [...returnValue, ...source];
|
|
505
|
-
} else if (isObject
|
|
507
|
+
} else if (isObject(source)) {
|
|
506
508
|
for (let [key, value] of Object.entries(source)) {
|
|
507
509
|
if (key === "signal" && value instanceof globalThis.AbortSignal) {
|
|
508
510
|
signals.push(value);
|
|
@@ -512,7 +514,7 @@ const deepMerge = (...sources) => {
|
|
|
512
514
|
const { isReplace } = replaceState;
|
|
513
515
|
value = replaceState.value;
|
|
514
516
|
if (key === "context") {
|
|
515
|
-
if (value !== void 0 && value !== null && (!isObject
|
|
517
|
+
if (value !== void 0 && value !== null && (!isObject(value) || Array.isArray(value))) throw new TypeError("The `context` option must be an object");
|
|
516
518
|
returnValue = {
|
|
517
519
|
...returnValue,
|
|
518
520
|
context: value === void 0 || value === null ? {} : isReplace ? { ...value } : {
|
|
@@ -528,18 +530,18 @@ const deepMerge = (...sources) => {
|
|
|
528
530
|
else searchParameters = searchParameters === void 0 ? value : appendSearchParameters(searchParameters, value);
|
|
529
531
|
continue;
|
|
530
532
|
}
|
|
531
|
-
if (isObject
|
|
533
|
+
if (isObject(value) && !isReplace && key in returnValue) value = deepMerge(returnValue[key], value);
|
|
532
534
|
returnValue = {
|
|
533
535
|
...returnValue,
|
|
534
536
|
[key]: value
|
|
535
537
|
};
|
|
536
538
|
}
|
|
537
|
-
if (isObject
|
|
539
|
+
if (isObject(source.hooks)) {
|
|
538
540
|
const { value: hookValue, isReplace } = getReplaceState(source.hooks);
|
|
539
541
|
hooks = isReplace ? mergeHooks({}, hookValue) : mergeHooks(hooks, hookValue);
|
|
540
542
|
returnValue.hooks = hooks;
|
|
541
543
|
}
|
|
542
|
-
if (isObject
|
|
544
|
+
if (isObject(source.headers)) {
|
|
543
545
|
const { value: headerValue, isReplace } = getReplaceState(source.headers);
|
|
544
546
|
headers = isReplace ? cloneShallow(headerValue) : mergeHeaderContainers(headers, headerValue);
|
|
545
547
|
returnValue.headers = headers;
|
|
@@ -1289,4287 +1291,9 @@ const createInstance = (defaults) => {
|
|
|
1289
1291
|
};
|
|
1290
1292
|
const ky = createInstance();
|
|
1291
1293
|
//#endregion
|
|
1292
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
|
|
1293
|
-
var _a$1;
|
|
1294
|
-
function $constructor(name, initializer, params) {
|
|
1295
|
-
function init(inst, def) {
|
|
1296
|
-
if (!inst._zod) Object.defineProperty(inst, "_zod", {
|
|
1297
|
-
value: {
|
|
1298
|
-
def,
|
|
1299
|
-
constr: _,
|
|
1300
|
-
traits: /* @__PURE__ */ new Set()
|
|
1301
|
-
},
|
|
1302
|
-
enumerable: false
|
|
1303
|
-
});
|
|
1304
|
-
if (inst._zod.traits.has(name)) return;
|
|
1305
|
-
inst._zod.traits.add(name);
|
|
1306
|
-
initializer(inst, def);
|
|
1307
|
-
const proto = _.prototype;
|
|
1308
|
-
const keys = Object.keys(proto);
|
|
1309
|
-
for (let i = 0; i < keys.length; i++) {
|
|
1310
|
-
const k = keys[i];
|
|
1311
|
-
if (!(k in inst)) inst[k] = proto[k].bind(inst);
|
|
1312
|
-
}
|
|
1313
|
-
}
|
|
1314
|
-
const Parent = params?.Parent ?? Object;
|
|
1315
|
-
class Definition extends Parent {}
|
|
1316
|
-
Object.defineProperty(Definition, "name", { value: name });
|
|
1317
|
-
function _(def) {
|
|
1318
|
-
var _a;
|
|
1319
|
-
const inst = params?.Parent ? new Definition() : this;
|
|
1320
|
-
init(inst, def);
|
|
1321
|
-
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
1322
|
-
for (const fn of inst._zod.deferred) fn();
|
|
1323
|
-
return inst;
|
|
1324
|
-
}
|
|
1325
|
-
Object.defineProperty(_, "init", { value: init });
|
|
1326
|
-
Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
|
|
1327
|
-
if (params?.Parent && inst instanceof params.Parent) return true;
|
|
1328
|
-
return inst?._zod?.traits?.has(name);
|
|
1329
|
-
} });
|
|
1330
|
-
Object.defineProperty(_, "name", { value: name });
|
|
1331
|
-
return _;
|
|
1332
|
-
}
|
|
1333
|
-
var $ZodAsyncError = class extends Error {
|
|
1334
|
-
constructor() {
|
|
1335
|
-
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
1336
|
-
}
|
|
1337
|
-
};
|
|
1338
|
-
var $ZodEncodeError = class extends Error {
|
|
1339
|
-
constructor(name) {
|
|
1340
|
-
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
1341
|
-
this.name = "ZodEncodeError";
|
|
1342
|
-
}
|
|
1343
|
-
};
|
|
1344
|
-
(_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
|
|
1345
|
-
const globalConfig = globalThis.__zod_globalConfig;
|
|
1346
|
-
function config(newConfig) {
|
|
1347
|
-
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
1348
|
-
return globalConfig;
|
|
1349
|
-
}
|
|
1350
|
-
//#endregion
|
|
1351
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.js
|
|
1352
|
-
function getEnumValues(entries) {
|
|
1353
|
-
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
1354
|
-
return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
1355
|
-
}
|
|
1356
|
-
function jsonStringifyReplacer(_, value) {
|
|
1357
|
-
if (typeof value === "bigint") return value.toString();
|
|
1358
|
-
return value;
|
|
1359
|
-
}
|
|
1360
|
-
function cached(getter) {
|
|
1361
|
-
return { get value() {
|
|
1362
|
-
{
|
|
1363
|
-
const value = getter();
|
|
1364
|
-
Object.defineProperty(this, "value", { value });
|
|
1365
|
-
return value;
|
|
1366
|
-
}
|
|
1367
|
-
throw new Error("cached value already set");
|
|
1368
|
-
} };
|
|
1369
|
-
}
|
|
1370
|
-
function nullish(input) {
|
|
1371
|
-
return input === null || input === void 0;
|
|
1372
|
-
}
|
|
1373
|
-
function cleanRegex(source) {
|
|
1374
|
-
const start = source.startsWith("^") ? 1 : 0;
|
|
1375
|
-
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
1376
|
-
return source.slice(start, end);
|
|
1377
|
-
}
|
|
1378
|
-
function floatSafeRemainder(val, step) {
|
|
1379
|
-
const ratio = val / step;
|
|
1380
|
-
const roundedRatio = Math.round(ratio);
|
|
1381
|
-
const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
|
|
1382
|
-
if (Math.abs(ratio - roundedRatio) < tolerance) return 0;
|
|
1383
|
-
return ratio - roundedRatio;
|
|
1384
|
-
}
|
|
1385
|
-
const EVALUATING = /* @__PURE__ */ Symbol("evaluating");
|
|
1386
|
-
function defineLazy(object, key, getter) {
|
|
1387
|
-
let value = void 0;
|
|
1388
|
-
Object.defineProperty(object, key, {
|
|
1389
|
-
get() {
|
|
1390
|
-
if (value === EVALUATING) return;
|
|
1391
|
-
if (value === void 0) {
|
|
1392
|
-
value = EVALUATING;
|
|
1393
|
-
value = getter();
|
|
1394
|
-
}
|
|
1395
|
-
return value;
|
|
1396
|
-
},
|
|
1397
|
-
set(v) {
|
|
1398
|
-
Object.defineProperty(object, key, { value: v });
|
|
1399
|
-
},
|
|
1400
|
-
configurable: true
|
|
1401
|
-
});
|
|
1402
|
-
}
|
|
1403
|
-
function assignProp(target, prop, value) {
|
|
1404
|
-
Object.defineProperty(target, prop, {
|
|
1405
|
-
value,
|
|
1406
|
-
writable: true,
|
|
1407
|
-
enumerable: true,
|
|
1408
|
-
configurable: true
|
|
1409
|
-
});
|
|
1410
|
-
}
|
|
1411
|
-
function mergeDefs(...defs) {
|
|
1412
|
-
const mergedDescriptors = {};
|
|
1413
|
-
for (const def of defs) Object.assign(mergedDescriptors, Object.getOwnPropertyDescriptors(def));
|
|
1414
|
-
return Object.defineProperties({}, mergedDescriptors);
|
|
1415
|
-
}
|
|
1416
|
-
function esc(str) {
|
|
1417
|
-
return JSON.stringify(str);
|
|
1418
|
-
}
|
|
1419
|
-
function slugify(input) {
|
|
1420
|
-
return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
1421
|
-
}
|
|
1422
|
-
const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
|
|
1423
|
-
function isObject(data) {
|
|
1424
|
-
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
1425
|
-
}
|
|
1426
|
-
const allowsEval = /* @__PURE__ */ cached(() => {
|
|
1427
|
-
if (globalConfig.jitless) return false;
|
|
1428
|
-
if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) return false;
|
|
1429
|
-
try {
|
|
1430
|
-
new Function("");
|
|
1431
|
-
return true;
|
|
1432
|
-
} catch (_) {
|
|
1433
|
-
return false;
|
|
1434
|
-
}
|
|
1435
|
-
});
|
|
1436
|
-
function isPlainObject$1(o) {
|
|
1437
|
-
if (isObject(o) === false) return false;
|
|
1438
|
-
const ctor = o.constructor;
|
|
1439
|
-
if (ctor === void 0) return true;
|
|
1440
|
-
if (typeof ctor !== "function") return true;
|
|
1441
|
-
const prot = ctor.prototype;
|
|
1442
|
-
if (isObject(prot) === false) return false;
|
|
1443
|
-
if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) return false;
|
|
1444
|
-
return true;
|
|
1445
|
-
}
|
|
1446
|
-
function shallowClone(o) {
|
|
1447
|
-
if (isPlainObject$1(o)) return { ...o };
|
|
1448
|
-
if (Array.isArray(o)) return [...o];
|
|
1449
|
-
if (o instanceof Map) return new Map(o);
|
|
1450
|
-
if (o instanceof Set) return new Set(o);
|
|
1451
|
-
return o;
|
|
1452
|
-
}
|
|
1453
|
-
const propertyKeyTypes = /* @__PURE__ */ new Set([
|
|
1454
|
-
"string",
|
|
1455
|
-
"number",
|
|
1456
|
-
"symbol"
|
|
1457
|
-
]);
|
|
1458
|
-
function escapeRegex(str) {
|
|
1459
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1460
|
-
}
|
|
1461
|
-
function clone$1(inst, def, params) {
|
|
1462
|
-
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
|
1463
|
-
if (!def || params?.parent) cl._zod.parent = inst;
|
|
1464
|
-
return cl;
|
|
1465
|
-
}
|
|
1466
|
-
function normalizeParams(_params) {
|
|
1467
|
-
const params = _params;
|
|
1468
|
-
if (!params) return {};
|
|
1469
|
-
if (typeof params === "string") return { error: () => params };
|
|
1470
|
-
if (params?.message !== void 0) {
|
|
1471
|
-
if (params?.error !== void 0) throw new Error("Cannot specify both `message` and `error` params");
|
|
1472
|
-
params.error = params.message;
|
|
1473
|
-
}
|
|
1474
|
-
delete params.message;
|
|
1475
|
-
if (typeof params.error === "string") return {
|
|
1476
|
-
...params,
|
|
1477
|
-
error: () => params.error
|
|
1478
|
-
};
|
|
1479
|
-
return params;
|
|
1480
|
-
}
|
|
1481
|
-
function optionalKeys(shape) {
|
|
1482
|
-
return Object.keys(shape).filter((k) => {
|
|
1483
|
-
return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
|
|
1484
|
-
});
|
|
1485
|
-
}
|
|
1486
|
-
const NUMBER_FORMAT_RANGES = {
|
|
1487
|
-
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
1488
|
-
int32: [-2147483648, 2147483647],
|
|
1489
|
-
uint32: [0, 4294967295],
|
|
1490
|
-
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
1491
|
-
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
1492
|
-
};
|
|
1493
|
-
function pick(schema, mask) {
|
|
1494
|
-
const currDef = schema._zod.def;
|
|
1495
|
-
const checks = currDef.checks;
|
|
1496
|
-
if (checks && checks.length > 0) throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
1497
|
-
return clone$1(schema, mergeDefs(schema._zod.def, {
|
|
1498
|
-
get shape() {
|
|
1499
|
-
const newShape = {};
|
|
1500
|
-
for (const key in mask) {
|
|
1501
|
-
if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
1502
|
-
if (!mask[key]) continue;
|
|
1503
|
-
newShape[key] = currDef.shape[key];
|
|
1504
|
-
}
|
|
1505
|
-
assignProp(this, "shape", newShape);
|
|
1506
|
-
return newShape;
|
|
1507
|
-
},
|
|
1508
|
-
checks: []
|
|
1509
|
-
}));
|
|
1510
|
-
}
|
|
1511
|
-
function omit(schema, mask) {
|
|
1512
|
-
const currDef = schema._zod.def;
|
|
1513
|
-
const checks = currDef.checks;
|
|
1514
|
-
if (checks && checks.length > 0) throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
1515
|
-
return clone$1(schema, mergeDefs(schema._zod.def, {
|
|
1516
|
-
get shape() {
|
|
1517
|
-
const newShape = { ...schema._zod.def.shape };
|
|
1518
|
-
for (const key in mask) {
|
|
1519
|
-
if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
1520
|
-
if (!mask[key]) continue;
|
|
1521
|
-
delete newShape[key];
|
|
1522
|
-
}
|
|
1523
|
-
assignProp(this, "shape", newShape);
|
|
1524
|
-
return newShape;
|
|
1525
|
-
},
|
|
1526
|
-
checks: []
|
|
1527
|
-
}));
|
|
1528
|
-
}
|
|
1529
|
-
function extend(schema, shape) {
|
|
1530
|
-
if (!isPlainObject$1(shape)) throw new Error("Invalid input to extend: expected a plain object");
|
|
1531
|
-
const checks = schema._zod.def.checks;
|
|
1532
|
-
if (checks && checks.length > 0) {
|
|
1533
|
-
const existingShape = schema._zod.def.shape;
|
|
1534
|
-
for (const key in shape) if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
1535
|
-
}
|
|
1536
|
-
return clone$1(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
1537
|
-
const _shape = {
|
|
1538
|
-
...schema._zod.def.shape,
|
|
1539
|
-
...shape
|
|
1540
|
-
};
|
|
1541
|
-
assignProp(this, "shape", _shape);
|
|
1542
|
-
return _shape;
|
|
1543
|
-
} }));
|
|
1544
|
-
}
|
|
1545
|
-
function safeExtend(schema, shape) {
|
|
1546
|
-
if (!isPlainObject$1(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
|
|
1547
|
-
return clone$1(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
1548
|
-
const _shape = {
|
|
1549
|
-
...schema._zod.def.shape,
|
|
1550
|
-
...shape
|
|
1551
|
-
};
|
|
1552
|
-
assignProp(this, "shape", _shape);
|
|
1553
|
-
return _shape;
|
|
1554
|
-
} }));
|
|
1555
|
-
}
|
|
1556
|
-
function merge(a, b) {
|
|
1557
|
-
if (a._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
1558
|
-
return clone$1(a, mergeDefs(a._zod.def, {
|
|
1559
|
-
get shape() {
|
|
1560
|
-
const _shape = {
|
|
1561
|
-
...a._zod.def.shape,
|
|
1562
|
-
...b._zod.def.shape
|
|
1563
|
-
};
|
|
1564
|
-
assignProp(this, "shape", _shape);
|
|
1565
|
-
return _shape;
|
|
1566
|
-
},
|
|
1567
|
-
get catchall() {
|
|
1568
|
-
return b._zod.def.catchall;
|
|
1569
|
-
},
|
|
1570
|
-
checks: b._zod.def.checks ?? []
|
|
1571
|
-
}));
|
|
1572
|
-
}
|
|
1573
|
-
function partial(Class, schema, mask) {
|
|
1574
|
-
const checks = schema._zod.def.checks;
|
|
1575
|
-
if (checks && checks.length > 0) throw new Error(".partial() cannot be used on object schemas containing refinements");
|
|
1576
|
-
return clone$1(schema, mergeDefs(schema._zod.def, {
|
|
1577
|
-
get shape() {
|
|
1578
|
-
const oldShape = schema._zod.def.shape;
|
|
1579
|
-
const shape = { ...oldShape };
|
|
1580
|
-
if (mask) for (const key in mask) {
|
|
1581
|
-
if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
1582
|
-
if (!mask[key]) continue;
|
|
1583
|
-
shape[key] = Class ? new Class({
|
|
1584
|
-
type: "optional",
|
|
1585
|
-
innerType: oldShape[key]
|
|
1586
|
-
}) : oldShape[key];
|
|
1587
|
-
}
|
|
1588
|
-
else for (const key in oldShape) shape[key] = Class ? new Class({
|
|
1589
|
-
type: "optional",
|
|
1590
|
-
innerType: oldShape[key]
|
|
1591
|
-
}) : oldShape[key];
|
|
1592
|
-
assignProp(this, "shape", shape);
|
|
1593
|
-
return shape;
|
|
1594
|
-
},
|
|
1595
|
-
checks: []
|
|
1596
|
-
}));
|
|
1597
|
-
}
|
|
1598
|
-
function required(Class, schema, mask) {
|
|
1599
|
-
return clone$1(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
1600
|
-
const oldShape = schema._zod.def.shape;
|
|
1601
|
-
const shape = { ...oldShape };
|
|
1602
|
-
if (mask) for (const key in mask) {
|
|
1603
|
-
if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
|
|
1604
|
-
if (!mask[key]) continue;
|
|
1605
|
-
shape[key] = new Class({
|
|
1606
|
-
type: "nonoptional",
|
|
1607
|
-
innerType: oldShape[key]
|
|
1608
|
-
});
|
|
1609
|
-
}
|
|
1610
|
-
else for (const key in oldShape) shape[key] = new Class({
|
|
1611
|
-
type: "nonoptional",
|
|
1612
|
-
innerType: oldShape[key]
|
|
1613
|
-
});
|
|
1614
|
-
assignProp(this, "shape", shape);
|
|
1615
|
-
return shape;
|
|
1616
|
-
} }));
|
|
1617
|
-
}
|
|
1618
|
-
function aborted(x, startIndex = 0) {
|
|
1619
|
-
if (x.aborted === true) return true;
|
|
1620
|
-
for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue !== true) return true;
|
|
1621
|
-
return false;
|
|
1622
|
-
}
|
|
1623
|
-
function explicitlyAborted(x, startIndex = 0) {
|
|
1624
|
-
if (x.aborted === true) return true;
|
|
1625
|
-
for (let i = startIndex; i < x.issues.length; i++) if (x.issues[i]?.continue === false) return true;
|
|
1626
|
-
return false;
|
|
1627
|
-
}
|
|
1628
|
-
function prefixIssues(path, issues) {
|
|
1629
|
-
return issues.map((iss) => {
|
|
1630
|
-
var _a;
|
|
1631
|
-
(_a = iss).path ?? (_a.path = []);
|
|
1632
|
-
iss.path.unshift(path);
|
|
1633
|
-
return iss;
|
|
1634
|
-
});
|
|
1635
|
-
}
|
|
1636
|
-
function unwrapMessage(message) {
|
|
1637
|
-
return typeof message === "string" ? message : message?.message;
|
|
1638
|
-
}
|
|
1639
|
-
function finalizeIssue(iss, ctx, config) {
|
|
1640
|
-
const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
|
|
1641
|
-
const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;
|
|
1642
|
-
rest.path ?? (rest.path = []);
|
|
1643
|
-
rest.message = message;
|
|
1644
|
-
if (ctx?.reportInput) rest.input = _input;
|
|
1645
|
-
return rest;
|
|
1646
|
-
}
|
|
1647
|
-
function getLengthableOrigin(input) {
|
|
1648
|
-
if (Array.isArray(input)) return "array";
|
|
1649
|
-
if (typeof input === "string") return "string";
|
|
1650
|
-
return "unknown";
|
|
1651
|
-
}
|
|
1652
|
-
function issue(...args) {
|
|
1653
|
-
const [iss, input, inst] = args;
|
|
1654
|
-
if (typeof iss === "string") return {
|
|
1655
|
-
message: iss,
|
|
1656
|
-
code: "custom",
|
|
1657
|
-
input,
|
|
1658
|
-
inst
|
|
1659
|
-
};
|
|
1660
|
-
return { ...iss };
|
|
1661
|
-
}
|
|
1662
|
-
//#endregion
|
|
1663
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/errors.js
|
|
1664
|
-
const initializer$1 = (inst, def) => {
|
|
1665
|
-
inst.name = "$ZodError";
|
|
1666
|
-
Object.defineProperty(inst, "_zod", {
|
|
1667
|
-
value: inst._zod,
|
|
1668
|
-
enumerable: false
|
|
1669
|
-
});
|
|
1670
|
-
Object.defineProperty(inst, "issues", {
|
|
1671
|
-
value: def,
|
|
1672
|
-
enumerable: false
|
|
1673
|
-
});
|
|
1674
|
-
inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
|
|
1675
|
-
Object.defineProperty(inst, "toString", {
|
|
1676
|
-
value: () => inst.message,
|
|
1677
|
-
enumerable: false
|
|
1678
|
-
});
|
|
1679
|
-
};
|
|
1680
|
-
const $ZodError = $constructor("$ZodError", initializer$1);
|
|
1681
|
-
const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
|
|
1682
|
-
function flattenError(error, mapper = (issue) => issue.message) {
|
|
1683
|
-
const fieldErrors = {};
|
|
1684
|
-
const formErrors = [];
|
|
1685
|
-
for (const sub of error.issues) if (sub.path.length > 0) {
|
|
1686
|
-
fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
|
|
1687
|
-
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
1688
|
-
} else formErrors.push(mapper(sub));
|
|
1689
|
-
return {
|
|
1690
|
-
formErrors,
|
|
1691
|
-
fieldErrors
|
|
1692
|
-
};
|
|
1693
|
-
}
|
|
1694
|
-
function formatError(error, mapper = (issue) => issue.message) {
|
|
1695
|
-
const fieldErrors = { _errors: [] };
|
|
1696
|
-
const processError = (error, path = []) => {
|
|
1697
|
-
for (const issue of error.issues) if (issue.code === "invalid_union" && issue.errors.length) issue.errors.map((issues) => processError({ issues }, [...path, ...issue.path]));
|
|
1698
|
-
else if (issue.code === "invalid_key") processError({ issues: issue.issues }, [...path, ...issue.path]);
|
|
1699
|
-
else if (issue.code === "invalid_element") processError({ issues: issue.issues }, [...path, ...issue.path]);
|
|
1700
|
-
else {
|
|
1701
|
-
const fullpath = [...path, ...issue.path];
|
|
1702
|
-
if (fullpath.length === 0) fieldErrors._errors.push(mapper(issue));
|
|
1703
|
-
else {
|
|
1704
|
-
let curr = fieldErrors;
|
|
1705
|
-
let i = 0;
|
|
1706
|
-
while (i < fullpath.length) {
|
|
1707
|
-
const el = fullpath[i];
|
|
1708
|
-
if (!(i === fullpath.length - 1)) curr[el] = curr[el] || { _errors: [] };
|
|
1709
|
-
else {
|
|
1710
|
-
curr[el] = curr[el] || { _errors: [] };
|
|
1711
|
-
curr[el]._errors.push(mapper(issue));
|
|
1712
|
-
}
|
|
1713
|
-
curr = curr[el];
|
|
1714
|
-
i++;
|
|
1715
|
-
}
|
|
1716
|
-
}
|
|
1717
|
-
}
|
|
1718
|
-
};
|
|
1719
|
-
processError(error);
|
|
1720
|
-
return fieldErrors;
|
|
1721
|
-
}
|
|
1722
|
-
//#endregion
|
|
1723
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/parse.js
|
|
1724
|
-
const _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
1725
|
-
const ctx = _ctx ? {
|
|
1726
|
-
..._ctx,
|
|
1727
|
-
async: false
|
|
1728
|
-
} : { async: false };
|
|
1729
|
-
const result = schema._zod.run({
|
|
1730
|
-
value,
|
|
1731
|
-
issues: []
|
|
1732
|
-
}, ctx);
|
|
1733
|
-
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
1734
|
-
if (result.issues.length) {
|
|
1735
|
-
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
1736
|
-
captureStackTrace(e, _params?.callee);
|
|
1737
|
-
throw e;
|
|
1738
|
-
}
|
|
1739
|
-
return result.value;
|
|
1740
|
-
};
|
|
1741
|
-
const _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
|
|
1742
|
-
const ctx = _ctx ? {
|
|
1743
|
-
..._ctx,
|
|
1744
|
-
async: true
|
|
1745
|
-
} : { async: true };
|
|
1746
|
-
let result = schema._zod.run({
|
|
1747
|
-
value,
|
|
1748
|
-
issues: []
|
|
1749
|
-
}, ctx);
|
|
1750
|
-
if (result instanceof Promise) result = await result;
|
|
1751
|
-
if (result.issues.length) {
|
|
1752
|
-
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
1753
|
-
captureStackTrace(e, params?.callee);
|
|
1754
|
-
throw e;
|
|
1755
|
-
}
|
|
1756
|
-
return result.value;
|
|
1757
|
-
};
|
|
1758
|
-
const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
1759
|
-
const ctx = _ctx ? {
|
|
1760
|
-
..._ctx,
|
|
1761
|
-
async: false
|
|
1762
|
-
} : { async: false };
|
|
1763
|
-
const result = schema._zod.run({
|
|
1764
|
-
value,
|
|
1765
|
-
issues: []
|
|
1766
|
-
}, ctx);
|
|
1767
|
-
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
1768
|
-
return result.issues.length ? {
|
|
1769
|
-
success: false,
|
|
1770
|
-
error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
1771
|
-
} : {
|
|
1772
|
-
success: true,
|
|
1773
|
-
data: result.value
|
|
1774
|
-
};
|
|
1775
|
-
};
|
|
1776
|
-
const safeParse$1 = /* @__PURE__ */ _safeParse($ZodRealError);
|
|
1777
|
-
const _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
1778
|
-
const ctx = _ctx ? {
|
|
1779
|
-
..._ctx,
|
|
1780
|
-
async: true
|
|
1781
|
-
} : { async: true };
|
|
1782
|
-
let result = schema._zod.run({
|
|
1783
|
-
value,
|
|
1784
|
-
issues: []
|
|
1785
|
-
}, ctx);
|
|
1786
|
-
if (result instanceof Promise) result = await result;
|
|
1787
|
-
return result.issues.length ? {
|
|
1788
|
-
success: false,
|
|
1789
|
-
error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
1790
|
-
} : {
|
|
1791
|
-
success: true,
|
|
1792
|
-
data: result.value
|
|
1793
|
-
};
|
|
1794
|
-
};
|
|
1795
|
-
const safeParseAsync$1 = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
1796
|
-
const _encode = (_Err) => (schema, value, _ctx) => {
|
|
1797
|
-
const ctx = _ctx ? {
|
|
1798
|
-
..._ctx,
|
|
1799
|
-
direction: "backward"
|
|
1800
|
-
} : { direction: "backward" };
|
|
1801
|
-
return _parse(_Err)(schema, value, ctx);
|
|
1802
|
-
};
|
|
1803
|
-
const _decode = (_Err) => (schema, value, _ctx) => {
|
|
1804
|
-
return _parse(_Err)(schema, value, _ctx);
|
|
1805
|
-
};
|
|
1806
|
-
const _encodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
1807
|
-
const ctx = _ctx ? {
|
|
1808
|
-
..._ctx,
|
|
1809
|
-
direction: "backward"
|
|
1810
|
-
} : { direction: "backward" };
|
|
1811
|
-
return _parseAsync(_Err)(schema, value, ctx);
|
|
1812
|
-
};
|
|
1813
|
-
const _decodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
1814
|
-
return _parseAsync(_Err)(schema, value, _ctx);
|
|
1815
|
-
};
|
|
1816
|
-
const _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
1817
|
-
const ctx = _ctx ? {
|
|
1818
|
-
..._ctx,
|
|
1819
|
-
direction: "backward"
|
|
1820
|
-
} : { direction: "backward" };
|
|
1821
|
-
return _safeParse(_Err)(schema, value, ctx);
|
|
1822
|
-
};
|
|
1823
|
-
const _safeDecode = (_Err) => (schema, value, _ctx) => {
|
|
1824
|
-
return _safeParse(_Err)(schema, value, _ctx);
|
|
1825
|
-
};
|
|
1826
|
-
const _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
1827
|
-
const ctx = _ctx ? {
|
|
1828
|
-
..._ctx,
|
|
1829
|
-
direction: "backward"
|
|
1830
|
-
} : { direction: "backward" };
|
|
1831
|
-
return _safeParseAsync(_Err)(schema, value, ctx);
|
|
1832
|
-
};
|
|
1833
|
-
const _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
1834
|
-
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
1835
|
-
};
|
|
1836
|
-
//#endregion
|
|
1837
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/regexes.js
|
|
1838
|
-
/**
|
|
1839
|
-
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
1840
|
-
* (timestamps embedded in the id). Use {@link cuid2} instead.
|
|
1841
|
-
* See https://github.com/paralleldrive/cuid.
|
|
1842
|
-
*/
|
|
1843
|
-
const cuid = /^[cC][0-9a-z]{6,}$/;
|
|
1844
|
-
const cuid2 = /^[0-9a-z]+$/;
|
|
1845
|
-
const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
1846
|
-
const xid = /^[0-9a-vA-V]{20}$/;
|
|
1847
|
-
const ksuid = /^[A-Za-z0-9]{27}$/;
|
|
1848
|
-
const nanoid = /^[a-zA-Z0-9_-]{21}$/;
|
|
1849
|
-
/** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
|
|
1850
|
-
const duration$1 = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
1851
|
-
/** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
|
|
1852
|
-
const guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
|
|
1853
|
-
/** Returns a regex for validating an RFC 9562/4122 UUID.
|
|
1854
|
-
*
|
|
1855
|
-
* @param version Optionally specify a version 1-8. If no version is specified, all versions are supported. */
|
|
1856
|
-
const uuid = (version) => {
|
|
1857
|
-
if (!version) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
|
|
1858
|
-
return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
|
|
1859
|
-
};
|
|
1860
|
-
/** Practical email validation */
|
|
1861
|
-
const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
1862
|
-
const _emoji$1 = `^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;
|
|
1863
|
-
function emoji() {
|
|
1864
|
-
return new RegExp(_emoji$1, "u");
|
|
1865
|
-
}
|
|
1866
|
-
const ipv4 = /^(?:(?: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])$/;
|
|
1867
|
-
const ipv6 = /^(([0-9a-fA-F]{1,4}:){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}|:))$/;
|
|
1868
|
-
const cidrv4 = /^((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])\/([0-9]|[1-2][0-9]|3[0-2])$/;
|
|
1869
|
-
const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
1870
|
-
const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
1871
|
-
const base64url = /^[A-Za-z0-9_-]*$/;
|
|
1872
|
-
const httpProtocol = /^https?$/;
|
|
1873
|
-
const e164 = /^\+[1-9]\d{6,14}$/;
|
|
1874
|
-
const dateSource = `(?:(?:\\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])))`;
|
|
1875
|
-
const date$1 = /* @__PURE__ */ new RegExp(`^${dateSource}$`);
|
|
1876
|
-
function timeSource(args) {
|
|
1877
|
-
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
1878
|
-
return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
1879
|
-
}
|
|
1880
|
-
function time$1(args) {
|
|
1881
|
-
return new RegExp(`^${timeSource(args)}$`);
|
|
1882
|
-
}
|
|
1883
|
-
function datetime$1(args) {
|
|
1884
|
-
const time = timeSource({ precision: args.precision });
|
|
1885
|
-
const opts = ["Z"];
|
|
1886
|
-
if (args.local) opts.push("");
|
|
1887
|
-
if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
1888
|
-
const timeRegex = `${time}(?:${opts.join("|")})`;
|
|
1889
|
-
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
1890
|
-
}
|
|
1891
|
-
const string$1 = (params) => {
|
|
1892
|
-
const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
|
|
1893
|
-
return new RegExp(`^${regex}$`);
|
|
1894
|
-
};
|
|
1895
|
-
const integer = /^-?\d+$/;
|
|
1896
|
-
const number$2 = /^-?\d+(?:\.\d+)?$/;
|
|
1897
|
-
const boolean$1 = /^(?:true|false)$/i;
|
|
1898
|
-
const lowercase = /^[^A-Z]*$/;
|
|
1899
|
-
const uppercase = /^[^a-z]*$/;
|
|
1900
|
-
//#endregion
|
|
1901
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/checks.js
|
|
1902
|
-
const $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
1903
|
-
var _a;
|
|
1904
|
-
inst._zod ?? (inst._zod = {});
|
|
1905
|
-
inst._zod.def = def;
|
|
1906
|
-
(_a = inst._zod).onattach ?? (_a.onattach = []);
|
|
1907
|
-
});
|
|
1908
|
-
const numericOriginMap = {
|
|
1909
|
-
number: "number",
|
|
1910
|
-
bigint: "bigint",
|
|
1911
|
-
object: "date"
|
|
1912
|
-
};
|
|
1913
|
-
const $ZodCheckLessThan = /* @__PURE__ */ $constructor("$ZodCheckLessThan", (inst, def) => {
|
|
1914
|
-
$ZodCheck.init(inst, def);
|
|
1915
|
-
const origin = numericOriginMap[typeof def.value];
|
|
1916
|
-
inst._zod.onattach.push((inst) => {
|
|
1917
|
-
const bag = inst._zod.bag;
|
|
1918
|
-
const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
|
|
1919
|
-
if (def.value < curr) if (def.inclusive) bag.maximum = def.value;
|
|
1920
|
-
else bag.exclusiveMaximum = def.value;
|
|
1921
|
-
});
|
|
1922
|
-
inst._zod.check = (payload) => {
|
|
1923
|
-
if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
|
|
1924
|
-
payload.issues.push({
|
|
1925
|
-
origin,
|
|
1926
|
-
code: "too_big",
|
|
1927
|
-
maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
1928
|
-
input: payload.value,
|
|
1929
|
-
inclusive: def.inclusive,
|
|
1930
|
-
inst,
|
|
1931
|
-
continue: !def.abort
|
|
1932
|
-
});
|
|
1933
|
-
};
|
|
1934
|
-
});
|
|
1935
|
-
const $ZodCheckGreaterThan = /* @__PURE__ */ $constructor("$ZodCheckGreaterThan", (inst, def) => {
|
|
1936
|
-
$ZodCheck.init(inst, def);
|
|
1937
|
-
const origin = numericOriginMap[typeof def.value];
|
|
1938
|
-
inst._zod.onattach.push((inst) => {
|
|
1939
|
-
const bag = inst._zod.bag;
|
|
1940
|
-
const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
|
|
1941
|
-
if (def.value > curr) if (def.inclusive) bag.minimum = def.value;
|
|
1942
|
-
else bag.exclusiveMinimum = def.value;
|
|
1943
|
-
});
|
|
1944
|
-
inst._zod.check = (payload) => {
|
|
1945
|
-
if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
|
|
1946
|
-
payload.issues.push({
|
|
1947
|
-
origin,
|
|
1948
|
-
code: "too_small",
|
|
1949
|
-
minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
1950
|
-
input: payload.value,
|
|
1951
|
-
inclusive: def.inclusive,
|
|
1952
|
-
inst,
|
|
1953
|
-
continue: !def.abort
|
|
1954
|
-
});
|
|
1955
|
-
};
|
|
1956
|
-
});
|
|
1957
|
-
const $ZodCheckMultipleOf = /* @__PURE__ */ $constructor("$ZodCheckMultipleOf", (inst, def) => {
|
|
1958
|
-
$ZodCheck.init(inst, def);
|
|
1959
|
-
inst._zod.onattach.push((inst) => {
|
|
1960
|
-
var _a;
|
|
1961
|
-
(_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
|
|
1962
|
-
});
|
|
1963
|
-
inst._zod.check = (payload) => {
|
|
1964
|
-
if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
1965
|
-
if (typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
|
|
1966
|
-
payload.issues.push({
|
|
1967
|
-
origin: typeof payload.value,
|
|
1968
|
-
code: "not_multiple_of",
|
|
1969
|
-
divisor: def.value,
|
|
1970
|
-
input: payload.value,
|
|
1971
|
-
inst,
|
|
1972
|
-
continue: !def.abort
|
|
1973
|
-
});
|
|
1974
|
-
};
|
|
1975
|
-
});
|
|
1976
|
-
const $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat", (inst, def) => {
|
|
1977
|
-
$ZodCheck.init(inst, def);
|
|
1978
|
-
def.format = def.format || "float64";
|
|
1979
|
-
const isInt = def.format?.includes("int");
|
|
1980
|
-
const origin = isInt ? "int" : "number";
|
|
1981
|
-
const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
|
|
1982
|
-
inst._zod.onattach.push((inst) => {
|
|
1983
|
-
const bag = inst._zod.bag;
|
|
1984
|
-
bag.format = def.format;
|
|
1985
|
-
bag.minimum = minimum;
|
|
1986
|
-
bag.maximum = maximum;
|
|
1987
|
-
if (isInt) bag.pattern = integer;
|
|
1988
|
-
});
|
|
1989
|
-
inst._zod.check = (payload) => {
|
|
1990
|
-
const input = payload.value;
|
|
1991
|
-
if (isInt) {
|
|
1992
|
-
if (!Number.isInteger(input)) {
|
|
1993
|
-
payload.issues.push({
|
|
1994
|
-
expected: origin,
|
|
1995
|
-
format: def.format,
|
|
1996
|
-
code: "invalid_type",
|
|
1997
|
-
continue: false,
|
|
1998
|
-
input,
|
|
1999
|
-
inst
|
|
2000
|
-
});
|
|
2001
|
-
return;
|
|
2002
|
-
}
|
|
2003
|
-
if (!Number.isSafeInteger(input)) {
|
|
2004
|
-
if (input > 0) payload.issues.push({
|
|
2005
|
-
input,
|
|
2006
|
-
code: "too_big",
|
|
2007
|
-
maximum: Number.MAX_SAFE_INTEGER,
|
|
2008
|
-
note: "Integers must be within the safe integer range.",
|
|
2009
|
-
inst,
|
|
2010
|
-
origin,
|
|
2011
|
-
inclusive: true,
|
|
2012
|
-
continue: !def.abort
|
|
2013
|
-
});
|
|
2014
|
-
else payload.issues.push({
|
|
2015
|
-
input,
|
|
2016
|
-
code: "too_small",
|
|
2017
|
-
minimum: Number.MIN_SAFE_INTEGER,
|
|
2018
|
-
note: "Integers must be within the safe integer range.",
|
|
2019
|
-
inst,
|
|
2020
|
-
origin,
|
|
2021
|
-
inclusive: true,
|
|
2022
|
-
continue: !def.abort
|
|
2023
|
-
});
|
|
2024
|
-
return;
|
|
2025
|
-
}
|
|
2026
|
-
}
|
|
2027
|
-
if (input < minimum) payload.issues.push({
|
|
2028
|
-
origin: "number",
|
|
2029
|
-
input,
|
|
2030
|
-
code: "too_small",
|
|
2031
|
-
minimum,
|
|
2032
|
-
inclusive: true,
|
|
2033
|
-
inst,
|
|
2034
|
-
continue: !def.abort
|
|
2035
|
-
});
|
|
2036
|
-
if (input > maximum) payload.issues.push({
|
|
2037
|
-
origin: "number",
|
|
2038
|
-
input,
|
|
2039
|
-
code: "too_big",
|
|
2040
|
-
maximum,
|
|
2041
|
-
inclusive: true,
|
|
2042
|
-
inst,
|
|
2043
|
-
continue: !def.abort
|
|
2044
|
-
});
|
|
2045
|
-
};
|
|
2046
|
-
});
|
|
2047
|
-
const $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
2048
|
-
var _a;
|
|
2049
|
-
$ZodCheck.init(inst, def);
|
|
2050
|
-
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
2051
|
-
const val = payload.value;
|
|
2052
|
-
return !nullish(val) && val.length !== void 0;
|
|
2053
|
-
});
|
|
2054
|
-
inst._zod.onattach.push((inst) => {
|
|
2055
|
-
const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
2056
|
-
if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
|
|
2057
|
-
});
|
|
2058
|
-
inst._zod.check = (payload) => {
|
|
2059
|
-
const input = payload.value;
|
|
2060
|
-
if (input.length <= def.maximum) return;
|
|
2061
|
-
const origin = getLengthableOrigin(input);
|
|
2062
|
-
payload.issues.push({
|
|
2063
|
-
origin,
|
|
2064
|
-
code: "too_big",
|
|
2065
|
-
maximum: def.maximum,
|
|
2066
|
-
inclusive: true,
|
|
2067
|
-
input,
|
|
2068
|
-
inst,
|
|
2069
|
-
continue: !def.abort
|
|
2070
|
-
});
|
|
2071
|
-
};
|
|
2072
|
-
});
|
|
2073
|
-
const $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
2074
|
-
var _a;
|
|
2075
|
-
$ZodCheck.init(inst, def);
|
|
2076
|
-
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
2077
|
-
const val = payload.value;
|
|
2078
|
-
return !nullish(val) && val.length !== void 0;
|
|
2079
|
-
});
|
|
2080
|
-
inst._zod.onattach.push((inst) => {
|
|
2081
|
-
const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
2082
|
-
if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
|
|
2083
|
-
});
|
|
2084
|
-
inst._zod.check = (payload) => {
|
|
2085
|
-
const input = payload.value;
|
|
2086
|
-
if (input.length >= def.minimum) return;
|
|
2087
|
-
const origin = getLengthableOrigin(input);
|
|
2088
|
-
payload.issues.push({
|
|
2089
|
-
origin,
|
|
2090
|
-
code: "too_small",
|
|
2091
|
-
minimum: def.minimum,
|
|
2092
|
-
inclusive: true,
|
|
2093
|
-
input,
|
|
2094
|
-
inst,
|
|
2095
|
-
continue: !def.abort
|
|
2096
|
-
});
|
|
2097
|
-
};
|
|
2098
|
-
});
|
|
2099
|
-
const $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
2100
|
-
var _a;
|
|
2101
|
-
$ZodCheck.init(inst, def);
|
|
2102
|
-
(_a = inst._zod.def).when ?? (_a.when = (payload) => {
|
|
2103
|
-
const val = payload.value;
|
|
2104
|
-
return !nullish(val) && val.length !== void 0;
|
|
2105
|
-
});
|
|
2106
|
-
inst._zod.onattach.push((inst) => {
|
|
2107
|
-
const bag = inst._zod.bag;
|
|
2108
|
-
bag.minimum = def.length;
|
|
2109
|
-
bag.maximum = def.length;
|
|
2110
|
-
bag.length = def.length;
|
|
2111
|
-
});
|
|
2112
|
-
inst._zod.check = (payload) => {
|
|
2113
|
-
const input = payload.value;
|
|
2114
|
-
const length = input.length;
|
|
2115
|
-
if (length === def.length) return;
|
|
2116
|
-
const origin = getLengthableOrigin(input);
|
|
2117
|
-
const tooBig = length > def.length;
|
|
2118
|
-
payload.issues.push({
|
|
2119
|
-
origin,
|
|
2120
|
-
...tooBig ? {
|
|
2121
|
-
code: "too_big",
|
|
2122
|
-
maximum: def.length
|
|
2123
|
-
} : {
|
|
2124
|
-
code: "too_small",
|
|
2125
|
-
minimum: def.length
|
|
2126
|
-
},
|
|
2127
|
-
inclusive: true,
|
|
2128
|
-
exact: true,
|
|
2129
|
-
input: payload.value,
|
|
2130
|
-
inst,
|
|
2131
|
-
continue: !def.abort
|
|
2132
|
-
});
|
|
2133
|
-
};
|
|
2134
|
-
});
|
|
2135
|
-
const $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
|
|
2136
|
-
var _a, _b;
|
|
2137
|
-
$ZodCheck.init(inst, def);
|
|
2138
|
-
inst._zod.onattach.push((inst) => {
|
|
2139
|
-
const bag = inst._zod.bag;
|
|
2140
|
-
bag.format = def.format;
|
|
2141
|
-
if (def.pattern) {
|
|
2142
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
2143
|
-
bag.patterns.add(def.pattern);
|
|
2144
|
-
}
|
|
2145
|
-
});
|
|
2146
|
-
if (def.pattern) (_a = inst._zod).check ?? (_a.check = (payload) => {
|
|
2147
|
-
def.pattern.lastIndex = 0;
|
|
2148
|
-
if (def.pattern.test(payload.value)) return;
|
|
2149
|
-
payload.issues.push({
|
|
2150
|
-
origin: "string",
|
|
2151
|
-
code: "invalid_format",
|
|
2152
|
-
format: def.format,
|
|
2153
|
-
input: payload.value,
|
|
2154
|
-
...def.pattern ? { pattern: def.pattern.toString() } : {},
|
|
2155
|
-
inst,
|
|
2156
|
-
continue: !def.abort
|
|
2157
|
-
});
|
|
2158
|
-
});
|
|
2159
|
-
else (_b = inst._zod).check ?? (_b.check = () => {});
|
|
2160
|
-
});
|
|
2161
|
-
const $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
|
|
2162
|
-
$ZodCheckStringFormat.init(inst, def);
|
|
2163
|
-
inst._zod.check = (payload) => {
|
|
2164
|
-
def.pattern.lastIndex = 0;
|
|
2165
|
-
if (def.pattern.test(payload.value)) return;
|
|
2166
|
-
payload.issues.push({
|
|
2167
|
-
origin: "string",
|
|
2168
|
-
code: "invalid_format",
|
|
2169
|
-
format: "regex",
|
|
2170
|
-
input: payload.value,
|
|
2171
|
-
pattern: def.pattern.toString(),
|
|
2172
|
-
inst,
|
|
2173
|
-
continue: !def.abort
|
|
2174
|
-
});
|
|
2175
|
-
};
|
|
2176
|
-
});
|
|
2177
|
-
const $ZodCheckLowerCase = /* @__PURE__ */ $constructor("$ZodCheckLowerCase", (inst, def) => {
|
|
2178
|
-
def.pattern ?? (def.pattern = lowercase);
|
|
2179
|
-
$ZodCheckStringFormat.init(inst, def);
|
|
2180
|
-
});
|
|
2181
|
-
const $ZodCheckUpperCase = /* @__PURE__ */ $constructor("$ZodCheckUpperCase", (inst, def) => {
|
|
2182
|
-
def.pattern ?? (def.pattern = uppercase);
|
|
2183
|
-
$ZodCheckStringFormat.init(inst, def);
|
|
2184
|
-
});
|
|
2185
|
-
const $ZodCheckIncludes = /* @__PURE__ */ $constructor("$ZodCheckIncludes", (inst, def) => {
|
|
2186
|
-
$ZodCheck.init(inst, def);
|
|
2187
|
-
const escapedRegex = escapeRegex(def.includes);
|
|
2188
|
-
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
|
|
2189
|
-
def.pattern = pattern;
|
|
2190
|
-
inst._zod.onattach.push((inst) => {
|
|
2191
|
-
const bag = inst._zod.bag;
|
|
2192
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
2193
|
-
bag.patterns.add(pattern);
|
|
2194
|
-
});
|
|
2195
|
-
inst._zod.check = (payload) => {
|
|
2196
|
-
if (payload.value.includes(def.includes, def.position)) return;
|
|
2197
|
-
payload.issues.push({
|
|
2198
|
-
origin: "string",
|
|
2199
|
-
code: "invalid_format",
|
|
2200
|
-
format: "includes",
|
|
2201
|
-
includes: def.includes,
|
|
2202
|
-
input: payload.value,
|
|
2203
|
-
inst,
|
|
2204
|
-
continue: !def.abort
|
|
2205
|
-
});
|
|
2206
|
-
};
|
|
2207
|
-
});
|
|
2208
|
-
const $ZodCheckStartsWith = /* @__PURE__ */ $constructor("$ZodCheckStartsWith", (inst, def) => {
|
|
2209
|
-
$ZodCheck.init(inst, def);
|
|
2210
|
-
const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
|
|
2211
|
-
def.pattern ?? (def.pattern = pattern);
|
|
2212
|
-
inst._zod.onattach.push((inst) => {
|
|
2213
|
-
const bag = inst._zod.bag;
|
|
2214
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
2215
|
-
bag.patterns.add(pattern);
|
|
2216
|
-
});
|
|
2217
|
-
inst._zod.check = (payload) => {
|
|
2218
|
-
if (payload.value.startsWith(def.prefix)) return;
|
|
2219
|
-
payload.issues.push({
|
|
2220
|
-
origin: "string",
|
|
2221
|
-
code: "invalid_format",
|
|
2222
|
-
format: "starts_with",
|
|
2223
|
-
prefix: def.prefix,
|
|
2224
|
-
input: payload.value,
|
|
2225
|
-
inst,
|
|
2226
|
-
continue: !def.abort
|
|
2227
|
-
});
|
|
2228
|
-
};
|
|
2229
|
-
});
|
|
2230
|
-
const $ZodCheckEndsWith = /* @__PURE__ */ $constructor("$ZodCheckEndsWith", (inst, def) => {
|
|
2231
|
-
$ZodCheck.init(inst, def);
|
|
2232
|
-
const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
|
|
2233
|
-
def.pattern ?? (def.pattern = pattern);
|
|
2234
|
-
inst._zod.onattach.push((inst) => {
|
|
2235
|
-
const bag = inst._zod.bag;
|
|
2236
|
-
bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
|
|
2237
|
-
bag.patterns.add(pattern);
|
|
2238
|
-
});
|
|
2239
|
-
inst._zod.check = (payload) => {
|
|
2240
|
-
if (payload.value.endsWith(def.suffix)) return;
|
|
2241
|
-
payload.issues.push({
|
|
2242
|
-
origin: "string",
|
|
2243
|
-
code: "invalid_format",
|
|
2244
|
-
format: "ends_with",
|
|
2245
|
-
suffix: def.suffix,
|
|
2246
|
-
input: payload.value,
|
|
2247
|
-
inst,
|
|
2248
|
-
continue: !def.abort
|
|
2249
|
-
});
|
|
2250
|
-
};
|
|
2251
|
-
});
|
|
2252
|
-
const $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
|
|
2253
|
-
$ZodCheck.init(inst, def);
|
|
2254
|
-
inst._zod.check = (payload) => {
|
|
2255
|
-
payload.value = def.tx(payload.value);
|
|
2256
|
-
};
|
|
2257
|
-
});
|
|
2258
|
-
//#endregion
|
|
2259
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/doc.js
|
|
2260
|
-
var Doc = class {
|
|
2261
|
-
constructor(args = []) {
|
|
2262
|
-
this.content = [];
|
|
2263
|
-
this.indent = 0;
|
|
2264
|
-
if (this) this.args = args;
|
|
2265
|
-
}
|
|
2266
|
-
indented(fn) {
|
|
2267
|
-
this.indent += 1;
|
|
2268
|
-
fn(this);
|
|
2269
|
-
this.indent -= 1;
|
|
2270
|
-
}
|
|
2271
|
-
write(arg) {
|
|
2272
|
-
if (typeof arg === "function") {
|
|
2273
|
-
arg(this, { execution: "sync" });
|
|
2274
|
-
arg(this, { execution: "async" });
|
|
2275
|
-
return;
|
|
2276
|
-
}
|
|
2277
|
-
const lines = arg.split("\n").filter((x) => x);
|
|
2278
|
-
const minIndent = Math.min(...lines.map((x) => x.length - x.trimStart().length));
|
|
2279
|
-
const dedented = lines.map((x) => x.slice(minIndent)).map((x) => " ".repeat(this.indent * 2) + x);
|
|
2280
|
-
for (const line of dedented) this.content.push(line);
|
|
2281
|
-
}
|
|
2282
|
-
compile() {
|
|
2283
|
-
const F = Function;
|
|
2284
|
-
const args = this?.args;
|
|
2285
|
-
const lines = [...(this?.content ?? [``]).map((x) => ` ${x}`)];
|
|
2286
|
-
return new F(...args, lines.join("\n"));
|
|
2287
|
-
}
|
|
2288
|
-
};
|
|
2289
|
-
//#endregion
|
|
2290
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/versions.js
|
|
2291
|
-
const version$1 = {
|
|
2292
|
-
major: 4,
|
|
2293
|
-
minor: 4,
|
|
2294
|
-
patch: 3
|
|
2295
|
-
};
|
|
2296
|
-
//#endregion
|
|
2297
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/schemas.js
|
|
2298
|
-
const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
2299
|
-
var _a;
|
|
2300
|
-
inst ?? (inst = {});
|
|
2301
|
-
inst._zod.def = def;
|
|
2302
|
-
inst._zod.bag = inst._zod.bag || {};
|
|
2303
|
-
inst._zod.version = version$1;
|
|
2304
|
-
const checks = [...inst._zod.def.checks ?? []];
|
|
2305
|
-
if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
|
|
2306
|
-
for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
|
|
2307
|
-
if (checks.length === 0) {
|
|
2308
|
-
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
2309
|
-
inst._zod.deferred?.push(() => {
|
|
2310
|
-
inst._zod.run = inst._zod.parse;
|
|
2311
|
-
});
|
|
2312
|
-
} else {
|
|
2313
|
-
const runChecks = (payload, checks, ctx) => {
|
|
2314
|
-
let isAborted = aborted(payload);
|
|
2315
|
-
let asyncResult;
|
|
2316
|
-
for (const ch of checks) {
|
|
2317
|
-
if (ch._zod.def.when) {
|
|
2318
|
-
if (explicitlyAborted(payload)) continue;
|
|
2319
|
-
if (!ch._zod.def.when(payload)) continue;
|
|
2320
|
-
} else if (isAborted) continue;
|
|
2321
|
-
const currLen = payload.issues.length;
|
|
2322
|
-
const _ = ch._zod.check(payload);
|
|
2323
|
-
if (_ instanceof Promise && ctx?.async === false) throw new $ZodAsyncError();
|
|
2324
|
-
if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
2325
|
-
await _;
|
|
2326
|
-
if (payload.issues.length === currLen) return;
|
|
2327
|
-
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
2328
|
-
});
|
|
2329
|
-
else {
|
|
2330
|
-
if (payload.issues.length === currLen) continue;
|
|
2331
|
-
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
2332
|
-
}
|
|
2333
|
-
}
|
|
2334
|
-
if (asyncResult) return asyncResult.then(() => {
|
|
2335
|
-
return payload;
|
|
2336
|
-
});
|
|
2337
|
-
return payload;
|
|
2338
|
-
};
|
|
2339
|
-
const handleCanaryResult = (canary, payload, ctx) => {
|
|
2340
|
-
if (aborted(canary)) {
|
|
2341
|
-
canary.aborted = true;
|
|
2342
|
-
return canary;
|
|
2343
|
-
}
|
|
2344
|
-
const checkResult = runChecks(payload, checks, ctx);
|
|
2345
|
-
if (checkResult instanceof Promise) {
|
|
2346
|
-
if (ctx.async === false) throw new $ZodAsyncError();
|
|
2347
|
-
return checkResult.then((checkResult) => inst._zod.parse(checkResult, ctx));
|
|
2348
|
-
}
|
|
2349
|
-
return inst._zod.parse(checkResult, ctx);
|
|
2350
|
-
};
|
|
2351
|
-
inst._zod.run = (payload, ctx) => {
|
|
2352
|
-
if (ctx.skipChecks) return inst._zod.parse(payload, ctx);
|
|
2353
|
-
if (ctx.direction === "backward") {
|
|
2354
|
-
const canary = inst._zod.parse({
|
|
2355
|
-
value: payload.value,
|
|
2356
|
-
issues: []
|
|
2357
|
-
}, {
|
|
2358
|
-
...ctx,
|
|
2359
|
-
skipChecks: true
|
|
2360
|
-
});
|
|
2361
|
-
if (canary instanceof Promise) return canary.then((canary) => {
|
|
2362
|
-
return handleCanaryResult(canary, payload, ctx);
|
|
2363
|
-
});
|
|
2364
|
-
return handleCanaryResult(canary, payload, ctx);
|
|
2365
|
-
}
|
|
2366
|
-
const result = inst._zod.parse(payload, ctx);
|
|
2367
|
-
if (result instanceof Promise) {
|
|
2368
|
-
if (ctx.async === false) throw new $ZodAsyncError();
|
|
2369
|
-
return result.then((result) => runChecks(result, checks, ctx));
|
|
2370
|
-
}
|
|
2371
|
-
return runChecks(result, checks, ctx);
|
|
2372
|
-
};
|
|
2373
|
-
}
|
|
2374
|
-
defineLazy(inst, "~standard", () => ({
|
|
2375
|
-
validate: (value) => {
|
|
2376
|
-
try {
|
|
2377
|
-
const r = safeParse$1(inst, value);
|
|
2378
|
-
return r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
2379
|
-
} catch (_) {
|
|
2380
|
-
return safeParseAsync$1(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
|
|
2381
|
-
}
|
|
2382
|
-
},
|
|
2383
|
-
vendor: "zod",
|
|
2384
|
-
version: 1
|
|
2385
|
-
}));
|
|
2386
|
-
});
|
|
2387
|
-
const $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
2388
|
-
$ZodType.init(inst, def);
|
|
2389
|
-
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag);
|
|
2390
|
-
inst._zod.parse = (payload, _) => {
|
|
2391
|
-
if (def.coerce) try {
|
|
2392
|
-
payload.value = String(payload.value);
|
|
2393
|
-
} catch (_) {}
|
|
2394
|
-
if (typeof payload.value === "string") return payload;
|
|
2395
|
-
payload.issues.push({
|
|
2396
|
-
expected: "string",
|
|
2397
|
-
code: "invalid_type",
|
|
2398
|
-
input: payload.value,
|
|
2399
|
-
inst
|
|
2400
|
-
});
|
|
2401
|
-
return payload;
|
|
2402
|
-
};
|
|
2403
|
-
});
|
|
2404
|
-
const $ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, def) => {
|
|
2405
|
-
$ZodCheckStringFormat.init(inst, def);
|
|
2406
|
-
$ZodString.init(inst, def);
|
|
2407
|
-
});
|
|
2408
|
-
const $ZodGUID = /* @__PURE__ */ $constructor("$ZodGUID", (inst, def) => {
|
|
2409
|
-
def.pattern ?? (def.pattern = guid);
|
|
2410
|
-
$ZodStringFormat.init(inst, def);
|
|
2411
|
-
});
|
|
2412
|
-
const $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
|
|
2413
|
-
if (def.version) {
|
|
2414
|
-
const v = {
|
|
2415
|
-
v1: 1,
|
|
2416
|
-
v2: 2,
|
|
2417
|
-
v3: 3,
|
|
2418
|
-
v4: 4,
|
|
2419
|
-
v5: 5,
|
|
2420
|
-
v6: 6,
|
|
2421
|
-
v7: 7,
|
|
2422
|
-
v8: 8
|
|
2423
|
-
}[def.version];
|
|
2424
|
-
if (v === void 0) throw new Error(`Invalid UUID version: "${def.version}"`);
|
|
2425
|
-
def.pattern ?? (def.pattern = uuid(v));
|
|
2426
|
-
} else def.pattern ?? (def.pattern = uuid());
|
|
2427
|
-
$ZodStringFormat.init(inst, def);
|
|
2428
|
-
});
|
|
2429
|
-
const $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
|
|
2430
|
-
def.pattern ?? (def.pattern = email);
|
|
2431
|
-
$ZodStringFormat.init(inst, def);
|
|
2432
|
-
});
|
|
2433
|
-
const $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
2434
|
-
$ZodStringFormat.init(inst, def);
|
|
2435
|
-
inst._zod.check = (payload) => {
|
|
2436
|
-
try {
|
|
2437
|
-
const trimmed = payload.value.trim();
|
|
2438
|
-
if (!def.normalize && def.protocol?.source === httpProtocol.source) {
|
|
2439
|
-
if (!/^https?:\/\//i.test(trimmed)) {
|
|
2440
|
-
payload.issues.push({
|
|
2441
|
-
code: "invalid_format",
|
|
2442
|
-
format: "url",
|
|
2443
|
-
note: "Invalid URL format",
|
|
2444
|
-
input: payload.value,
|
|
2445
|
-
inst,
|
|
2446
|
-
continue: !def.abort
|
|
2447
|
-
});
|
|
2448
|
-
return;
|
|
2449
|
-
}
|
|
2450
|
-
}
|
|
2451
|
-
const url = new URL(trimmed);
|
|
2452
|
-
if (def.hostname) {
|
|
2453
|
-
def.hostname.lastIndex = 0;
|
|
2454
|
-
if (!def.hostname.test(url.hostname)) payload.issues.push({
|
|
2455
|
-
code: "invalid_format",
|
|
2456
|
-
format: "url",
|
|
2457
|
-
note: "Invalid hostname",
|
|
2458
|
-
pattern: def.hostname.source,
|
|
2459
|
-
input: payload.value,
|
|
2460
|
-
inst,
|
|
2461
|
-
continue: !def.abort
|
|
2462
|
-
});
|
|
2463
|
-
}
|
|
2464
|
-
if (def.protocol) {
|
|
2465
|
-
def.protocol.lastIndex = 0;
|
|
2466
|
-
if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
|
|
2467
|
-
code: "invalid_format",
|
|
2468
|
-
format: "url",
|
|
2469
|
-
note: "Invalid protocol",
|
|
2470
|
-
pattern: def.protocol.source,
|
|
2471
|
-
input: payload.value,
|
|
2472
|
-
inst,
|
|
2473
|
-
continue: !def.abort
|
|
2474
|
-
});
|
|
2475
|
-
}
|
|
2476
|
-
if (def.normalize) payload.value = url.href;
|
|
2477
|
-
else payload.value = trimmed;
|
|
2478
|
-
return;
|
|
2479
|
-
} catch (_) {
|
|
2480
|
-
payload.issues.push({
|
|
2481
|
-
code: "invalid_format",
|
|
2482
|
-
format: "url",
|
|
2483
|
-
input: payload.value,
|
|
2484
|
-
inst,
|
|
2485
|
-
continue: !def.abort
|
|
2486
|
-
});
|
|
2487
|
-
}
|
|
2488
|
-
};
|
|
2489
|
-
});
|
|
2490
|
-
const $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => {
|
|
2491
|
-
def.pattern ?? (def.pattern = emoji());
|
|
2492
|
-
$ZodStringFormat.init(inst, def);
|
|
2493
|
-
});
|
|
2494
|
-
const $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {
|
|
2495
|
-
def.pattern ?? (def.pattern = nanoid);
|
|
2496
|
-
$ZodStringFormat.init(inst, def);
|
|
2497
|
-
});
|
|
2498
|
-
/**
|
|
2499
|
-
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
2500
|
-
* (timestamps embedded in the id). Use {@link $ZodCUID2} instead.
|
|
2501
|
-
* See https://github.com/paralleldrive/cuid.
|
|
2502
|
-
*/
|
|
2503
|
-
const $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {
|
|
2504
|
-
def.pattern ?? (def.pattern = cuid);
|
|
2505
|
-
$ZodStringFormat.init(inst, def);
|
|
2506
|
-
});
|
|
2507
|
-
const $ZodCUID2 = /* @__PURE__ */ $constructor("$ZodCUID2", (inst, def) => {
|
|
2508
|
-
def.pattern ?? (def.pattern = cuid2);
|
|
2509
|
-
$ZodStringFormat.init(inst, def);
|
|
2510
|
-
});
|
|
2511
|
-
const $ZodULID = /* @__PURE__ */ $constructor("$ZodULID", (inst, def) => {
|
|
2512
|
-
def.pattern ?? (def.pattern = ulid);
|
|
2513
|
-
$ZodStringFormat.init(inst, def);
|
|
2514
|
-
});
|
|
2515
|
-
const $ZodXID = /* @__PURE__ */ $constructor("$ZodXID", (inst, def) => {
|
|
2516
|
-
def.pattern ?? (def.pattern = xid);
|
|
2517
|
-
$ZodStringFormat.init(inst, def);
|
|
2518
|
-
});
|
|
2519
|
-
const $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
|
|
2520
|
-
def.pattern ?? (def.pattern = ksuid);
|
|
2521
|
-
$ZodStringFormat.init(inst, def);
|
|
2522
|
-
});
|
|
2523
|
-
const $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
|
|
2524
|
-
def.pattern ?? (def.pattern = datetime$1(def));
|
|
2525
|
-
$ZodStringFormat.init(inst, def);
|
|
2526
|
-
});
|
|
2527
|
-
const $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
|
|
2528
|
-
def.pattern ?? (def.pattern = date$1);
|
|
2529
|
-
$ZodStringFormat.init(inst, def);
|
|
2530
|
-
});
|
|
2531
|
-
const $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => {
|
|
2532
|
-
def.pattern ?? (def.pattern = time$1(def));
|
|
2533
|
-
$ZodStringFormat.init(inst, def);
|
|
2534
|
-
});
|
|
2535
|
-
const $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def) => {
|
|
2536
|
-
def.pattern ?? (def.pattern = duration$1);
|
|
2537
|
-
$ZodStringFormat.init(inst, def);
|
|
2538
|
-
});
|
|
2539
|
-
const $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
|
|
2540
|
-
def.pattern ?? (def.pattern = ipv4);
|
|
2541
|
-
$ZodStringFormat.init(inst, def);
|
|
2542
|
-
inst._zod.bag.format = `ipv4`;
|
|
2543
|
-
});
|
|
2544
|
-
const $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
|
|
2545
|
-
def.pattern ?? (def.pattern = ipv6);
|
|
2546
|
-
$ZodStringFormat.init(inst, def);
|
|
2547
|
-
inst._zod.bag.format = `ipv6`;
|
|
2548
|
-
inst._zod.check = (payload) => {
|
|
2549
|
-
try {
|
|
2550
|
-
new URL(`http://[${payload.value}]`);
|
|
2551
|
-
} catch {
|
|
2552
|
-
payload.issues.push({
|
|
2553
|
-
code: "invalid_format",
|
|
2554
|
-
format: "ipv6",
|
|
2555
|
-
input: payload.value,
|
|
2556
|
-
inst,
|
|
2557
|
-
continue: !def.abort
|
|
2558
|
-
});
|
|
2559
|
-
}
|
|
2560
|
-
};
|
|
2561
|
-
});
|
|
2562
|
-
const $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
|
|
2563
|
-
def.pattern ?? (def.pattern = cidrv4);
|
|
2564
|
-
$ZodStringFormat.init(inst, def);
|
|
2565
|
-
});
|
|
2566
|
-
const $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
2567
|
-
def.pattern ?? (def.pattern = cidrv6);
|
|
2568
|
-
$ZodStringFormat.init(inst, def);
|
|
2569
|
-
inst._zod.check = (payload) => {
|
|
2570
|
-
const parts = payload.value.split("/");
|
|
2571
|
-
try {
|
|
2572
|
-
if (parts.length !== 2) throw new Error();
|
|
2573
|
-
const [address, prefix] = parts;
|
|
2574
|
-
if (!prefix) throw new Error();
|
|
2575
|
-
const prefixNum = Number(prefix);
|
|
2576
|
-
if (`${prefixNum}` !== prefix) throw new Error();
|
|
2577
|
-
if (prefixNum < 0 || prefixNum > 128) throw new Error();
|
|
2578
|
-
new URL(`http://[${address}]`);
|
|
2579
|
-
} catch {
|
|
2580
|
-
payload.issues.push({
|
|
2581
|
-
code: "invalid_format",
|
|
2582
|
-
format: "cidrv6",
|
|
2583
|
-
input: payload.value,
|
|
2584
|
-
inst,
|
|
2585
|
-
continue: !def.abort
|
|
2586
|
-
});
|
|
2587
|
-
}
|
|
2588
|
-
};
|
|
2589
|
-
});
|
|
2590
|
-
function isValidBase64(data) {
|
|
2591
|
-
if (data === "") return true;
|
|
2592
|
-
if (/\s/.test(data)) return false;
|
|
2593
|
-
if (data.length % 4 !== 0) return false;
|
|
2594
|
-
try {
|
|
2595
|
-
atob(data);
|
|
2596
|
-
return true;
|
|
2597
|
-
} catch {
|
|
2598
|
-
return false;
|
|
2599
|
-
}
|
|
2600
|
-
}
|
|
2601
|
-
const $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
2602
|
-
def.pattern ?? (def.pattern = base64);
|
|
2603
|
-
$ZodStringFormat.init(inst, def);
|
|
2604
|
-
inst._zod.bag.contentEncoding = "base64";
|
|
2605
|
-
inst._zod.check = (payload) => {
|
|
2606
|
-
if (isValidBase64(payload.value)) return;
|
|
2607
|
-
payload.issues.push({
|
|
2608
|
-
code: "invalid_format",
|
|
2609
|
-
format: "base64",
|
|
2610
|
-
input: payload.value,
|
|
2611
|
-
inst,
|
|
2612
|
-
continue: !def.abort
|
|
2613
|
-
});
|
|
2614
|
-
};
|
|
2615
|
-
});
|
|
2616
|
-
function isValidBase64URL(data) {
|
|
2617
|
-
if (!base64url.test(data)) return false;
|
|
2618
|
-
const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
2619
|
-
return isValidBase64(base64.padEnd(Math.ceil(base64.length / 4) * 4, "="));
|
|
2620
|
-
}
|
|
2621
|
-
const $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
2622
|
-
def.pattern ?? (def.pattern = base64url);
|
|
2623
|
-
$ZodStringFormat.init(inst, def);
|
|
2624
|
-
inst._zod.bag.contentEncoding = "base64url";
|
|
2625
|
-
inst._zod.check = (payload) => {
|
|
2626
|
-
if (isValidBase64URL(payload.value)) return;
|
|
2627
|
-
payload.issues.push({
|
|
2628
|
-
code: "invalid_format",
|
|
2629
|
-
format: "base64url",
|
|
2630
|
-
input: payload.value,
|
|
2631
|
-
inst,
|
|
2632
|
-
continue: !def.abort
|
|
2633
|
-
});
|
|
2634
|
-
};
|
|
2635
|
-
});
|
|
2636
|
-
const $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => {
|
|
2637
|
-
def.pattern ?? (def.pattern = e164);
|
|
2638
|
-
$ZodStringFormat.init(inst, def);
|
|
2639
|
-
});
|
|
2640
|
-
function isValidJWT(token, algorithm = null) {
|
|
2641
|
-
try {
|
|
2642
|
-
const tokensParts = token.split(".");
|
|
2643
|
-
if (tokensParts.length !== 3) return false;
|
|
2644
|
-
const [header] = tokensParts;
|
|
2645
|
-
if (!header) return false;
|
|
2646
|
-
const parsedHeader = JSON.parse(atob(header));
|
|
2647
|
-
if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") return false;
|
|
2648
|
-
if (!parsedHeader.alg) return false;
|
|
2649
|
-
if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm)) return false;
|
|
2650
|
-
return true;
|
|
2651
|
-
} catch {
|
|
2652
|
-
return false;
|
|
2653
|
-
}
|
|
2654
|
-
}
|
|
2655
|
-
const $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
|
|
2656
|
-
$ZodStringFormat.init(inst, def);
|
|
2657
|
-
inst._zod.check = (payload) => {
|
|
2658
|
-
if (isValidJWT(payload.value, def.alg)) return;
|
|
2659
|
-
payload.issues.push({
|
|
2660
|
-
code: "invalid_format",
|
|
2661
|
-
format: "jwt",
|
|
2662
|
-
input: payload.value,
|
|
2663
|
-
inst,
|
|
2664
|
-
continue: !def.abort
|
|
2665
|
-
});
|
|
2666
|
-
};
|
|
2667
|
-
});
|
|
2668
|
-
const $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
2669
|
-
$ZodType.init(inst, def);
|
|
2670
|
-
inst._zod.pattern = inst._zod.bag.pattern ?? number$2;
|
|
2671
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
2672
|
-
if (def.coerce) try {
|
|
2673
|
-
payload.value = Number(payload.value);
|
|
2674
|
-
} catch (_) {}
|
|
2675
|
-
const input = payload.value;
|
|
2676
|
-
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) return payload;
|
|
2677
|
-
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
|
|
2678
|
-
payload.issues.push({
|
|
2679
|
-
expected: "number",
|
|
2680
|
-
code: "invalid_type",
|
|
2681
|
-
input,
|
|
2682
|
-
inst,
|
|
2683
|
-
...received ? { received } : {}
|
|
2684
|
-
});
|
|
2685
|
-
return payload;
|
|
2686
|
-
};
|
|
2687
|
-
});
|
|
2688
|
-
const $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumberFormat", (inst, def) => {
|
|
2689
|
-
$ZodCheckNumberFormat.init(inst, def);
|
|
2690
|
-
$ZodNumber.init(inst, def);
|
|
2691
|
-
});
|
|
2692
|
-
const $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
2693
|
-
$ZodType.init(inst, def);
|
|
2694
|
-
inst._zod.pattern = boolean$1;
|
|
2695
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
2696
|
-
if (def.coerce) try {
|
|
2697
|
-
payload.value = Boolean(payload.value);
|
|
2698
|
-
} catch (_) {}
|
|
2699
|
-
const input = payload.value;
|
|
2700
|
-
if (typeof input === "boolean") return payload;
|
|
2701
|
-
payload.issues.push({
|
|
2702
|
-
expected: "boolean",
|
|
2703
|
-
code: "invalid_type",
|
|
2704
|
-
input,
|
|
2705
|
-
inst
|
|
2706
|
-
});
|
|
2707
|
-
return payload;
|
|
2708
|
-
};
|
|
2709
|
-
});
|
|
2710
|
-
const $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
|
|
2711
|
-
$ZodType.init(inst, def);
|
|
2712
|
-
inst._zod.parse = (payload) => payload;
|
|
2713
|
-
});
|
|
2714
|
-
const $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
|
|
2715
|
-
$ZodType.init(inst, def);
|
|
2716
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
2717
|
-
payload.issues.push({
|
|
2718
|
-
expected: "never",
|
|
2719
|
-
code: "invalid_type",
|
|
2720
|
-
input: payload.value,
|
|
2721
|
-
inst
|
|
2722
|
-
});
|
|
2723
|
-
return payload;
|
|
2724
|
-
};
|
|
2725
|
-
});
|
|
2726
|
-
function handleArrayResult(result, final, index) {
|
|
2727
|
-
if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
|
|
2728
|
-
final.value[index] = result.value;
|
|
2729
|
-
}
|
|
2730
|
-
const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
2731
|
-
$ZodType.init(inst, def);
|
|
2732
|
-
inst._zod.parse = (payload, ctx) => {
|
|
2733
|
-
const input = payload.value;
|
|
2734
|
-
if (!Array.isArray(input)) {
|
|
2735
|
-
payload.issues.push({
|
|
2736
|
-
expected: "array",
|
|
2737
|
-
code: "invalid_type",
|
|
2738
|
-
input,
|
|
2739
|
-
inst
|
|
2740
|
-
});
|
|
2741
|
-
return payload;
|
|
2742
|
-
}
|
|
2743
|
-
payload.value = Array(input.length);
|
|
2744
|
-
const proms = [];
|
|
2745
|
-
for (let i = 0; i < input.length; i++) {
|
|
2746
|
-
const item = input[i];
|
|
2747
|
-
const result = def.element._zod.run({
|
|
2748
|
-
value: item,
|
|
2749
|
-
issues: []
|
|
2750
|
-
}, ctx);
|
|
2751
|
-
if (result instanceof Promise) proms.push(result.then((result) => handleArrayResult(result, payload, i)));
|
|
2752
|
-
else handleArrayResult(result, payload, i);
|
|
2753
|
-
}
|
|
2754
|
-
if (proms.length) return Promise.all(proms).then(() => payload);
|
|
2755
|
-
return payload;
|
|
2756
|
-
};
|
|
2757
|
-
});
|
|
2758
|
-
function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
|
|
2759
|
-
const isPresent = key in input;
|
|
2760
|
-
if (result.issues.length) {
|
|
2761
|
-
if (isOptionalIn && isOptionalOut && !isPresent) return;
|
|
2762
|
-
final.issues.push(...prefixIssues(key, result.issues));
|
|
2763
|
-
}
|
|
2764
|
-
if (!isPresent && !isOptionalIn) {
|
|
2765
|
-
if (!result.issues.length) final.issues.push({
|
|
2766
|
-
code: "invalid_type",
|
|
2767
|
-
expected: "nonoptional",
|
|
2768
|
-
input: void 0,
|
|
2769
|
-
path: [key]
|
|
2770
|
-
});
|
|
2771
|
-
return;
|
|
2772
|
-
}
|
|
2773
|
-
if (result.value === void 0) {
|
|
2774
|
-
if (isPresent) final.value[key] = void 0;
|
|
2775
|
-
} else final.value[key] = result.value;
|
|
2776
|
-
}
|
|
2777
|
-
function normalizeDef(def) {
|
|
2778
|
-
const keys = Object.keys(def.shape);
|
|
2779
|
-
for (const k of keys) if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
2780
|
-
const okeys = optionalKeys(def.shape);
|
|
2781
|
-
return {
|
|
2782
|
-
...def,
|
|
2783
|
-
keys,
|
|
2784
|
-
keySet: new Set(keys),
|
|
2785
|
-
numKeys: keys.length,
|
|
2786
|
-
optionalKeys: new Set(okeys)
|
|
2787
|
-
};
|
|
2788
|
-
}
|
|
2789
|
-
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
2790
|
-
const unrecognized = [];
|
|
2791
|
-
const keySet = def.keySet;
|
|
2792
|
-
const _catchall = def.catchall._zod;
|
|
2793
|
-
const t = _catchall.def.type;
|
|
2794
|
-
const isOptionalIn = _catchall.optin === "optional";
|
|
2795
|
-
const isOptionalOut = _catchall.optout === "optional";
|
|
2796
|
-
for (const key in input) {
|
|
2797
|
-
if (key === "__proto__") continue;
|
|
2798
|
-
if (keySet.has(key)) continue;
|
|
2799
|
-
if (t === "never") {
|
|
2800
|
-
unrecognized.push(key);
|
|
2801
|
-
continue;
|
|
2802
|
-
}
|
|
2803
|
-
const r = _catchall.run({
|
|
2804
|
-
value: input[key],
|
|
2805
|
-
issues: []
|
|
2806
|
-
}, ctx);
|
|
2807
|
-
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
|
|
2808
|
-
else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
|
|
2809
|
-
}
|
|
2810
|
-
if (unrecognized.length) payload.issues.push({
|
|
2811
|
-
code: "unrecognized_keys",
|
|
2812
|
-
keys: unrecognized,
|
|
2813
|
-
input,
|
|
2814
|
-
inst
|
|
2815
|
-
});
|
|
2816
|
-
if (!proms.length) return payload;
|
|
2817
|
-
return Promise.all(proms).then(() => {
|
|
2818
|
-
return payload;
|
|
2819
|
-
});
|
|
2820
|
-
}
|
|
2821
|
-
const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
2822
|
-
$ZodType.init(inst, def);
|
|
2823
|
-
if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
|
|
2824
|
-
const sh = def.shape;
|
|
2825
|
-
Object.defineProperty(def, "shape", { get: () => {
|
|
2826
|
-
const newSh = { ...sh };
|
|
2827
|
-
Object.defineProperty(def, "shape", { value: newSh });
|
|
2828
|
-
return newSh;
|
|
2829
|
-
} });
|
|
2830
|
-
}
|
|
2831
|
-
const _normalized = cached(() => normalizeDef(def));
|
|
2832
|
-
defineLazy(inst._zod, "propValues", () => {
|
|
2833
|
-
const shape = def.shape;
|
|
2834
|
-
const propValues = {};
|
|
2835
|
-
for (const key in shape) {
|
|
2836
|
-
const field = shape[key]._zod;
|
|
2837
|
-
if (field.values) {
|
|
2838
|
-
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
2839
|
-
for (const v of field.values) propValues[key].add(v);
|
|
2840
|
-
}
|
|
2841
|
-
}
|
|
2842
|
-
return propValues;
|
|
2843
|
-
});
|
|
2844
|
-
const isObject$2 = isObject;
|
|
2845
|
-
const catchall = def.catchall;
|
|
2846
|
-
let value;
|
|
2847
|
-
inst._zod.parse = (payload, ctx) => {
|
|
2848
|
-
value ?? (value = _normalized.value);
|
|
2849
|
-
const input = payload.value;
|
|
2850
|
-
if (!isObject$2(input)) {
|
|
2851
|
-
payload.issues.push({
|
|
2852
|
-
expected: "object",
|
|
2853
|
-
code: "invalid_type",
|
|
2854
|
-
input,
|
|
2855
|
-
inst
|
|
2856
|
-
});
|
|
2857
|
-
return payload;
|
|
2858
|
-
}
|
|
2859
|
-
payload.value = {};
|
|
2860
|
-
const proms = [];
|
|
2861
|
-
const shape = value.shape;
|
|
2862
|
-
for (const key of value.keys) {
|
|
2863
|
-
const el = shape[key];
|
|
2864
|
-
const isOptionalIn = el._zod.optin === "optional";
|
|
2865
|
-
const isOptionalOut = el._zod.optout === "optional";
|
|
2866
|
-
const r = el._zod.run({
|
|
2867
|
-
value: input[key],
|
|
2868
|
-
issues: []
|
|
2869
|
-
}, ctx);
|
|
2870
|
-
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
|
|
2871
|
-
else handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
|
|
2872
|
-
}
|
|
2873
|
-
if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
2874
|
-
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
2875
|
-
};
|
|
2876
|
-
});
|
|
2877
|
-
const $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
2878
|
-
$ZodObject.init(inst, def);
|
|
2879
|
-
const superParse = inst._zod.parse;
|
|
2880
|
-
const _normalized = cached(() => normalizeDef(def));
|
|
2881
|
-
const generateFastpass = (shape) => {
|
|
2882
|
-
const doc = new Doc([
|
|
2883
|
-
"shape",
|
|
2884
|
-
"payload",
|
|
2885
|
-
"ctx"
|
|
2886
|
-
]);
|
|
2887
|
-
const normalized = _normalized.value;
|
|
2888
|
-
const parseStr = (key) => {
|
|
2889
|
-
const k = esc(key);
|
|
2890
|
-
return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
2891
|
-
};
|
|
2892
|
-
doc.write(`const input = payload.value;`);
|
|
2893
|
-
const ids = Object.create(null);
|
|
2894
|
-
let counter = 0;
|
|
2895
|
-
for (const key of normalized.keys) ids[key] = `key_${counter++}`;
|
|
2896
|
-
doc.write(`const newResult = {};`);
|
|
2897
|
-
for (const key of normalized.keys) {
|
|
2898
|
-
const id = ids[key];
|
|
2899
|
-
const k = esc(key);
|
|
2900
|
-
const schema = shape[key];
|
|
2901
|
-
const isOptionalIn = schema?._zod?.optin === "optional";
|
|
2902
|
-
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
2903
|
-
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
2904
|
-
if (isOptionalIn && isOptionalOut) doc.write(`
|
|
2905
|
-
if (${id}.issues.length) {
|
|
2906
|
-
if (${k} in input) {
|
|
2907
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
2908
|
-
...iss,
|
|
2909
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
2910
|
-
})));
|
|
2911
|
-
}
|
|
2912
|
-
}
|
|
2913
|
-
|
|
2914
|
-
if (${id}.value === undefined) {
|
|
2915
|
-
if (${k} in input) {
|
|
2916
|
-
newResult[${k}] = undefined;
|
|
2917
|
-
}
|
|
2918
|
-
} else {
|
|
2919
|
-
newResult[${k}] = ${id}.value;
|
|
2920
|
-
}
|
|
2921
|
-
|
|
2922
|
-
`);
|
|
2923
|
-
else if (!isOptionalIn) doc.write(`
|
|
2924
|
-
const ${id}_present = ${k} in input;
|
|
2925
|
-
if (${id}.issues.length) {
|
|
2926
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
2927
|
-
...iss,
|
|
2928
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
2929
|
-
})));
|
|
2930
|
-
}
|
|
2931
|
-
if (!${id}_present && !${id}.issues.length) {
|
|
2932
|
-
payload.issues.push({
|
|
2933
|
-
code: "invalid_type",
|
|
2934
|
-
expected: "nonoptional",
|
|
2935
|
-
input: undefined,
|
|
2936
|
-
path: [${k}]
|
|
2937
|
-
});
|
|
2938
|
-
}
|
|
2939
|
-
|
|
2940
|
-
if (${id}_present) {
|
|
2941
|
-
if (${id}.value === undefined) {
|
|
2942
|
-
newResult[${k}] = undefined;
|
|
2943
|
-
} else {
|
|
2944
|
-
newResult[${k}] = ${id}.value;
|
|
2945
|
-
}
|
|
2946
|
-
}
|
|
2947
|
-
|
|
2948
|
-
`);
|
|
2949
|
-
else doc.write(`
|
|
2950
|
-
if (${id}.issues.length) {
|
|
2951
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
2952
|
-
...iss,
|
|
2953
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
2954
|
-
})));
|
|
2955
|
-
}
|
|
2956
|
-
|
|
2957
|
-
if (${id}.value === undefined) {
|
|
2958
|
-
if (${k} in input) {
|
|
2959
|
-
newResult[${k}] = undefined;
|
|
2960
|
-
}
|
|
2961
|
-
} else {
|
|
2962
|
-
newResult[${k}] = ${id}.value;
|
|
2963
|
-
}
|
|
2964
|
-
|
|
2965
|
-
`);
|
|
2966
|
-
}
|
|
2967
|
-
doc.write(`payload.value = newResult;`);
|
|
2968
|
-
doc.write(`return payload;`);
|
|
2969
|
-
const fn = doc.compile();
|
|
2970
|
-
return (payload, ctx) => fn(shape, payload, ctx);
|
|
2971
|
-
};
|
|
2972
|
-
let fastpass;
|
|
2973
|
-
const isObject$3 = isObject;
|
|
2974
|
-
const jit = !globalConfig.jitless;
|
|
2975
|
-
const fastEnabled = jit && allowsEval.value;
|
|
2976
|
-
const catchall = def.catchall;
|
|
2977
|
-
let value;
|
|
2978
|
-
inst._zod.parse = (payload, ctx) => {
|
|
2979
|
-
value ?? (value = _normalized.value);
|
|
2980
|
-
const input = payload.value;
|
|
2981
|
-
if (!isObject$3(input)) {
|
|
2982
|
-
payload.issues.push({
|
|
2983
|
-
expected: "object",
|
|
2984
|
-
code: "invalid_type",
|
|
2985
|
-
input,
|
|
2986
|
-
inst
|
|
2987
|
-
});
|
|
2988
|
-
return payload;
|
|
2989
|
-
}
|
|
2990
|
-
if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
|
|
2991
|
-
if (!fastpass) fastpass = generateFastpass(def.shape);
|
|
2992
|
-
payload = fastpass(payload, ctx);
|
|
2993
|
-
if (!catchall) return payload;
|
|
2994
|
-
return handleCatchall([], input, payload, ctx, value, inst);
|
|
2995
|
-
}
|
|
2996
|
-
return superParse(payload, ctx);
|
|
2997
|
-
};
|
|
2998
|
-
});
|
|
2999
|
-
function handleUnionResults(results, final, inst, ctx) {
|
|
3000
|
-
for (const result of results) if (result.issues.length === 0) {
|
|
3001
|
-
final.value = result.value;
|
|
3002
|
-
return final;
|
|
3003
|
-
}
|
|
3004
|
-
const nonaborted = results.filter((r) => !aborted(r));
|
|
3005
|
-
if (nonaborted.length === 1) {
|
|
3006
|
-
final.value = nonaborted[0].value;
|
|
3007
|
-
return nonaborted[0];
|
|
3008
|
-
}
|
|
3009
|
-
final.issues.push({
|
|
3010
|
-
code: "invalid_union",
|
|
3011
|
-
input: final.value,
|
|
3012
|
-
inst,
|
|
3013
|
-
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
3014
|
-
});
|
|
3015
|
-
return final;
|
|
3016
|
-
}
|
|
3017
|
-
const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
3018
|
-
$ZodType.init(inst, def);
|
|
3019
|
-
defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
|
|
3020
|
-
defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
|
|
3021
|
-
defineLazy(inst._zod, "values", () => {
|
|
3022
|
-
if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
3023
|
-
});
|
|
3024
|
-
defineLazy(inst._zod, "pattern", () => {
|
|
3025
|
-
if (def.options.every((o) => o._zod.pattern)) {
|
|
3026
|
-
const patterns = def.options.map((o) => o._zod.pattern);
|
|
3027
|
-
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
3028
|
-
}
|
|
3029
|
-
});
|
|
3030
|
-
const first = def.options.length === 1 ? def.options[0]._zod.run : null;
|
|
3031
|
-
inst._zod.parse = (payload, ctx) => {
|
|
3032
|
-
if (first) return first(payload, ctx);
|
|
3033
|
-
let async = false;
|
|
3034
|
-
const results = [];
|
|
3035
|
-
for (const option of def.options) {
|
|
3036
|
-
const result = option._zod.run({
|
|
3037
|
-
value: payload.value,
|
|
3038
|
-
issues: []
|
|
3039
|
-
}, ctx);
|
|
3040
|
-
if (result instanceof Promise) {
|
|
3041
|
-
results.push(result);
|
|
3042
|
-
async = true;
|
|
3043
|
-
} else {
|
|
3044
|
-
if (result.issues.length === 0) return result;
|
|
3045
|
-
results.push(result);
|
|
3046
|
-
}
|
|
3047
|
-
}
|
|
3048
|
-
if (!async) return handleUnionResults(results, payload, inst, ctx);
|
|
3049
|
-
return Promise.all(results).then((results) => {
|
|
3050
|
-
return handleUnionResults(results, payload, inst, ctx);
|
|
3051
|
-
});
|
|
3052
|
-
};
|
|
3053
|
-
});
|
|
3054
|
-
const $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
3055
|
-
def.inclusive = false;
|
|
3056
|
-
$ZodUnion.init(inst, def);
|
|
3057
|
-
const _super = inst._zod.parse;
|
|
3058
|
-
defineLazy(inst._zod, "propValues", () => {
|
|
3059
|
-
const propValues = {};
|
|
3060
|
-
for (const option of def.options) {
|
|
3061
|
-
const pv = option._zod.propValues;
|
|
3062
|
-
if (!pv || Object.keys(pv).length === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
3063
|
-
for (const [k, v] of Object.entries(pv)) {
|
|
3064
|
-
if (!propValues[k]) propValues[k] = /* @__PURE__ */ new Set();
|
|
3065
|
-
for (const val of v) propValues[k].add(val);
|
|
3066
|
-
}
|
|
3067
|
-
}
|
|
3068
|
-
return propValues;
|
|
3069
|
-
});
|
|
3070
|
-
const disc = cached(() => {
|
|
3071
|
-
const opts = def.options;
|
|
3072
|
-
const map = /* @__PURE__ */ new Map();
|
|
3073
|
-
for (const o of opts) {
|
|
3074
|
-
const values = o._zod.propValues?.[def.discriminator];
|
|
3075
|
-
if (!values || values.size === 0) throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
|
|
3076
|
-
for (const v of values) {
|
|
3077
|
-
if (map.has(v)) throw new Error(`Duplicate discriminator value "${String(v)}"`);
|
|
3078
|
-
map.set(v, o);
|
|
3079
|
-
}
|
|
3080
|
-
}
|
|
3081
|
-
return map;
|
|
3082
|
-
});
|
|
3083
|
-
inst._zod.parse = (payload, ctx) => {
|
|
3084
|
-
const input = payload.value;
|
|
3085
|
-
if (!isObject(input)) {
|
|
3086
|
-
payload.issues.push({
|
|
3087
|
-
code: "invalid_type",
|
|
3088
|
-
expected: "object",
|
|
3089
|
-
input,
|
|
3090
|
-
inst
|
|
3091
|
-
});
|
|
3092
|
-
return payload;
|
|
3093
|
-
}
|
|
3094
|
-
const opt = disc.value.get(input?.[def.discriminator]);
|
|
3095
|
-
if (opt) return opt._zod.run(payload, ctx);
|
|
3096
|
-
if (def.unionFallback || ctx.direction === "backward") return _super(payload, ctx);
|
|
3097
|
-
payload.issues.push({
|
|
3098
|
-
code: "invalid_union",
|
|
3099
|
-
errors: [],
|
|
3100
|
-
note: "No matching discriminator",
|
|
3101
|
-
discriminator: def.discriminator,
|
|
3102
|
-
options: Array.from(disc.value.keys()),
|
|
3103
|
-
input,
|
|
3104
|
-
path: [def.discriminator],
|
|
3105
|
-
inst
|
|
3106
|
-
});
|
|
3107
|
-
return payload;
|
|
3108
|
-
};
|
|
3109
|
-
});
|
|
3110
|
-
const $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
|
|
3111
|
-
$ZodType.init(inst, def);
|
|
3112
|
-
inst._zod.parse = (payload, ctx) => {
|
|
3113
|
-
const input = payload.value;
|
|
3114
|
-
const left = def.left._zod.run({
|
|
3115
|
-
value: input,
|
|
3116
|
-
issues: []
|
|
3117
|
-
}, ctx);
|
|
3118
|
-
const right = def.right._zod.run({
|
|
3119
|
-
value: input,
|
|
3120
|
-
issues: []
|
|
3121
|
-
}, ctx);
|
|
3122
|
-
if (left instanceof Promise || right instanceof Promise) return Promise.all([left, right]).then(([left, right]) => {
|
|
3123
|
-
return handleIntersectionResults(payload, left, right);
|
|
3124
|
-
});
|
|
3125
|
-
return handleIntersectionResults(payload, left, right);
|
|
3126
|
-
};
|
|
3127
|
-
});
|
|
3128
|
-
function mergeValues(a, b) {
|
|
3129
|
-
if (a === b) return {
|
|
3130
|
-
valid: true,
|
|
3131
|
-
data: a
|
|
3132
|
-
};
|
|
3133
|
-
if (a instanceof Date && b instanceof Date && +a === +b) return {
|
|
3134
|
-
valid: true,
|
|
3135
|
-
data: a
|
|
3136
|
-
};
|
|
3137
|
-
if (isPlainObject$1(a) && isPlainObject$1(b)) {
|
|
3138
|
-
const bKeys = Object.keys(b);
|
|
3139
|
-
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
3140
|
-
const newObj = {
|
|
3141
|
-
...a,
|
|
3142
|
-
...b
|
|
3143
|
-
};
|
|
3144
|
-
for (const key of sharedKeys) {
|
|
3145
|
-
const sharedValue = mergeValues(a[key], b[key]);
|
|
3146
|
-
if (!sharedValue.valid) return {
|
|
3147
|
-
valid: false,
|
|
3148
|
-
mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
|
|
3149
|
-
};
|
|
3150
|
-
newObj[key] = sharedValue.data;
|
|
3151
|
-
}
|
|
3152
|
-
return {
|
|
3153
|
-
valid: true,
|
|
3154
|
-
data: newObj
|
|
3155
|
-
};
|
|
3156
|
-
}
|
|
3157
|
-
if (Array.isArray(a) && Array.isArray(b)) {
|
|
3158
|
-
if (a.length !== b.length) return {
|
|
3159
|
-
valid: false,
|
|
3160
|
-
mergeErrorPath: []
|
|
3161
|
-
};
|
|
3162
|
-
const newArray = [];
|
|
3163
|
-
for (let index = 0; index < a.length; index++) {
|
|
3164
|
-
const itemA = a[index];
|
|
3165
|
-
const itemB = b[index];
|
|
3166
|
-
const sharedValue = mergeValues(itemA, itemB);
|
|
3167
|
-
if (!sharedValue.valid) return {
|
|
3168
|
-
valid: false,
|
|
3169
|
-
mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
|
|
3170
|
-
};
|
|
3171
|
-
newArray.push(sharedValue.data);
|
|
3172
|
-
}
|
|
3173
|
-
return {
|
|
3174
|
-
valid: true,
|
|
3175
|
-
data: newArray
|
|
3176
|
-
};
|
|
3177
|
-
}
|
|
3178
|
-
return {
|
|
3179
|
-
valid: false,
|
|
3180
|
-
mergeErrorPath: []
|
|
3181
|
-
};
|
|
3182
|
-
}
|
|
3183
|
-
function handleIntersectionResults(result, left, right) {
|
|
3184
|
-
const unrecKeys = /* @__PURE__ */ new Map();
|
|
3185
|
-
let unrecIssue;
|
|
3186
|
-
for (const iss of left.issues) if (iss.code === "unrecognized_keys") {
|
|
3187
|
-
unrecIssue ?? (unrecIssue = iss);
|
|
3188
|
-
for (const k of iss.keys) {
|
|
3189
|
-
if (!unrecKeys.has(k)) unrecKeys.set(k, {});
|
|
3190
|
-
unrecKeys.get(k).l = true;
|
|
3191
|
-
}
|
|
3192
|
-
} else result.issues.push(iss);
|
|
3193
|
-
for (const iss of right.issues) if (iss.code === "unrecognized_keys") for (const k of iss.keys) {
|
|
3194
|
-
if (!unrecKeys.has(k)) unrecKeys.set(k, {});
|
|
3195
|
-
unrecKeys.get(k).r = true;
|
|
3196
|
-
}
|
|
3197
|
-
else result.issues.push(iss);
|
|
3198
|
-
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
3199
|
-
if (bothKeys.length && unrecIssue) result.issues.push({
|
|
3200
|
-
...unrecIssue,
|
|
3201
|
-
keys: bothKeys
|
|
3202
|
-
});
|
|
3203
|
-
if (aborted(result)) return result;
|
|
3204
|
-
const merged = mergeValues(left.value, right.value);
|
|
3205
|
-
if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
|
|
3206
|
-
result.value = merged.data;
|
|
3207
|
-
return result;
|
|
3208
|
-
}
|
|
3209
|
-
const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
3210
|
-
$ZodType.init(inst, def);
|
|
3211
|
-
inst._zod.parse = (payload, ctx) => {
|
|
3212
|
-
const input = payload.value;
|
|
3213
|
-
if (!isPlainObject$1(input)) {
|
|
3214
|
-
payload.issues.push({
|
|
3215
|
-
expected: "record",
|
|
3216
|
-
code: "invalid_type",
|
|
3217
|
-
input,
|
|
3218
|
-
inst
|
|
3219
|
-
});
|
|
3220
|
-
return payload;
|
|
3221
|
-
}
|
|
3222
|
-
const proms = [];
|
|
3223
|
-
const values = def.keyType._zod.values;
|
|
3224
|
-
if (values) {
|
|
3225
|
-
payload.value = {};
|
|
3226
|
-
const recordKeys = /* @__PURE__ */ new Set();
|
|
3227
|
-
for (const key of values) if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
3228
|
-
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
3229
|
-
const keyResult = def.keyType._zod.run({
|
|
3230
|
-
value: key,
|
|
3231
|
-
issues: []
|
|
3232
|
-
}, ctx);
|
|
3233
|
-
if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
|
|
3234
|
-
if (keyResult.issues.length) {
|
|
3235
|
-
payload.issues.push({
|
|
3236
|
-
code: "invalid_key",
|
|
3237
|
-
origin: "record",
|
|
3238
|
-
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
3239
|
-
input: key,
|
|
3240
|
-
path: [key],
|
|
3241
|
-
inst
|
|
3242
|
-
});
|
|
3243
|
-
continue;
|
|
3244
|
-
}
|
|
3245
|
-
const outKey = keyResult.value;
|
|
3246
|
-
const result = def.valueType._zod.run({
|
|
3247
|
-
value: input[key],
|
|
3248
|
-
issues: []
|
|
3249
|
-
}, ctx);
|
|
3250
|
-
if (result instanceof Promise) proms.push(result.then((result) => {
|
|
3251
|
-
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
3252
|
-
payload.value[outKey] = result.value;
|
|
3253
|
-
}));
|
|
3254
|
-
else {
|
|
3255
|
-
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
3256
|
-
payload.value[outKey] = result.value;
|
|
3257
|
-
}
|
|
3258
|
-
}
|
|
3259
|
-
let unrecognized;
|
|
3260
|
-
for (const key in input) if (!recordKeys.has(key)) {
|
|
3261
|
-
unrecognized = unrecognized ?? [];
|
|
3262
|
-
unrecognized.push(key);
|
|
3263
|
-
}
|
|
3264
|
-
if (unrecognized && unrecognized.length > 0) payload.issues.push({
|
|
3265
|
-
code: "unrecognized_keys",
|
|
3266
|
-
input,
|
|
3267
|
-
inst,
|
|
3268
|
-
keys: unrecognized
|
|
3269
|
-
});
|
|
3270
|
-
} else {
|
|
3271
|
-
payload.value = {};
|
|
3272
|
-
for (const key of Reflect.ownKeys(input)) {
|
|
3273
|
-
if (key === "__proto__") continue;
|
|
3274
|
-
if (!Object.prototype.propertyIsEnumerable.call(input, key)) continue;
|
|
3275
|
-
let keyResult = def.keyType._zod.run({
|
|
3276
|
-
value: key,
|
|
3277
|
-
issues: []
|
|
3278
|
-
}, ctx);
|
|
3279
|
-
if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
|
|
3280
|
-
if (typeof key === "string" && number$2.test(key) && keyResult.issues.length) {
|
|
3281
|
-
const retryResult = def.keyType._zod.run({
|
|
3282
|
-
value: Number(key),
|
|
3283
|
-
issues: []
|
|
3284
|
-
}, ctx);
|
|
3285
|
-
if (retryResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
|
|
3286
|
-
if (retryResult.issues.length === 0) keyResult = retryResult;
|
|
3287
|
-
}
|
|
3288
|
-
if (keyResult.issues.length) {
|
|
3289
|
-
if (def.mode === "loose") payload.value[key] = input[key];
|
|
3290
|
-
else payload.issues.push({
|
|
3291
|
-
code: "invalid_key",
|
|
3292
|
-
origin: "record",
|
|
3293
|
-
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
3294
|
-
input: key,
|
|
3295
|
-
path: [key],
|
|
3296
|
-
inst
|
|
3297
|
-
});
|
|
3298
|
-
continue;
|
|
3299
|
-
}
|
|
3300
|
-
const result = def.valueType._zod.run({
|
|
3301
|
-
value: input[key],
|
|
3302
|
-
issues: []
|
|
3303
|
-
}, ctx);
|
|
3304
|
-
if (result instanceof Promise) proms.push(result.then((result) => {
|
|
3305
|
-
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
3306
|
-
payload.value[keyResult.value] = result.value;
|
|
3307
|
-
}));
|
|
3308
|
-
else {
|
|
3309
|
-
if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
|
|
3310
|
-
payload.value[keyResult.value] = result.value;
|
|
3311
|
-
}
|
|
3312
|
-
}
|
|
3313
|
-
}
|
|
3314
|
-
if (proms.length) return Promise.all(proms).then(() => payload);
|
|
3315
|
-
return payload;
|
|
3316
|
-
};
|
|
3317
|
-
});
|
|
3318
|
-
const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
3319
|
-
$ZodType.init(inst, def);
|
|
3320
|
-
const values = getEnumValues(def.entries);
|
|
3321
|
-
const valuesSet = new Set(values);
|
|
3322
|
-
inst._zod.values = valuesSet;
|
|
3323
|
-
inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
3324
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
3325
|
-
const input = payload.value;
|
|
3326
|
-
if (valuesSet.has(input)) return payload;
|
|
3327
|
-
payload.issues.push({
|
|
3328
|
-
code: "invalid_value",
|
|
3329
|
-
values,
|
|
3330
|
-
input,
|
|
3331
|
-
inst
|
|
3332
|
-
});
|
|
3333
|
-
return payload;
|
|
3334
|
-
};
|
|
3335
|
-
});
|
|
3336
|
-
const $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
3337
|
-
$ZodType.init(inst, def);
|
|
3338
|
-
if (def.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
|
|
3339
|
-
const values = new Set(def.values);
|
|
3340
|
-
inst._zod.values = values;
|
|
3341
|
-
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
3342
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
3343
|
-
const input = payload.value;
|
|
3344
|
-
if (values.has(input)) return payload;
|
|
3345
|
-
payload.issues.push({
|
|
3346
|
-
code: "invalid_value",
|
|
3347
|
-
values: def.values,
|
|
3348
|
-
input,
|
|
3349
|
-
inst
|
|
3350
|
-
});
|
|
3351
|
-
return payload;
|
|
3352
|
-
};
|
|
3353
|
-
});
|
|
3354
|
-
const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
|
|
3355
|
-
$ZodType.init(inst, def);
|
|
3356
|
-
inst._zod.optin = "optional";
|
|
3357
|
-
inst._zod.parse = (payload, ctx) => {
|
|
3358
|
-
if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
3359
|
-
const _out = def.transform(payload.value, payload);
|
|
3360
|
-
if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
|
|
3361
|
-
payload.value = output;
|
|
3362
|
-
payload.fallback = true;
|
|
3363
|
-
return payload;
|
|
3364
|
-
});
|
|
3365
|
-
if (_out instanceof Promise) throw new $ZodAsyncError();
|
|
3366
|
-
payload.value = _out;
|
|
3367
|
-
payload.fallback = true;
|
|
3368
|
-
return payload;
|
|
3369
|
-
};
|
|
3370
|
-
});
|
|
3371
|
-
function handleOptionalResult(result, input) {
|
|
3372
|
-
if (input === void 0 && (result.issues.length || result.fallback)) return {
|
|
3373
|
-
issues: [],
|
|
3374
|
-
value: void 0
|
|
3375
|
-
};
|
|
3376
|
-
return result;
|
|
3377
|
-
}
|
|
3378
|
-
const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
3379
|
-
$ZodType.init(inst, def);
|
|
3380
|
-
inst._zod.optin = "optional";
|
|
3381
|
-
inst._zod.optout = "optional";
|
|
3382
|
-
defineLazy(inst._zod, "values", () => {
|
|
3383
|
-
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, void 0]) : void 0;
|
|
3384
|
-
});
|
|
3385
|
-
defineLazy(inst._zod, "pattern", () => {
|
|
3386
|
-
const pattern = def.innerType._zod.pattern;
|
|
3387
|
-
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
3388
|
-
});
|
|
3389
|
-
inst._zod.parse = (payload, ctx) => {
|
|
3390
|
-
if (def.innerType._zod.optin === "optional") {
|
|
3391
|
-
const input = payload.value;
|
|
3392
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
3393
|
-
if (result instanceof Promise) return result.then((r) => handleOptionalResult(r, input));
|
|
3394
|
-
return handleOptionalResult(result, input);
|
|
3395
|
-
}
|
|
3396
|
-
if (payload.value === void 0) return payload;
|
|
3397
|
-
return def.innerType._zod.run(payload, ctx);
|
|
3398
|
-
};
|
|
3399
|
-
});
|
|
3400
|
-
const $ZodExactOptional = /* @__PURE__ */ $constructor("$ZodExactOptional", (inst, def) => {
|
|
3401
|
-
$ZodOptional.init(inst, def);
|
|
3402
|
-
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
3403
|
-
defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
|
|
3404
|
-
inst._zod.parse = (payload, ctx) => {
|
|
3405
|
-
return def.innerType._zod.run(payload, ctx);
|
|
3406
|
-
};
|
|
3407
|
-
});
|
|
3408
|
-
const $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
|
|
3409
|
-
$ZodType.init(inst, def);
|
|
3410
|
-
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
3411
|
-
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
3412
|
-
defineLazy(inst._zod, "pattern", () => {
|
|
3413
|
-
const pattern = def.innerType._zod.pattern;
|
|
3414
|
-
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
|
|
3415
|
-
});
|
|
3416
|
-
defineLazy(inst._zod, "values", () => {
|
|
3417
|
-
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : void 0;
|
|
3418
|
-
});
|
|
3419
|
-
inst._zod.parse = (payload, ctx) => {
|
|
3420
|
-
if (payload.value === null) return payload;
|
|
3421
|
-
return def.innerType._zod.run(payload, ctx);
|
|
3422
|
-
};
|
|
3423
|
-
});
|
|
3424
|
-
const $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
|
|
3425
|
-
$ZodType.init(inst, def);
|
|
3426
|
-
inst._zod.optin = "optional";
|
|
3427
|
-
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
3428
|
-
inst._zod.parse = (payload, ctx) => {
|
|
3429
|
-
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
3430
|
-
if (payload.value === void 0) {
|
|
3431
|
-
payload.value = def.defaultValue;
|
|
3432
|
-
/**
|
|
3433
|
-
* $ZodDefault returns the default value immediately in forward direction.
|
|
3434
|
-
* It doesn't pass the default value into the validator ("prefault"). There's no reason to pass the default value through validation. The validity of the default is enforced by TypeScript statically. Otherwise, it's the responsibility of the user to ensure the default is valid. In the case of pipes with divergent in/out types, you can specify the default on the `in` schema of your ZodPipe to set a "prefault" for the pipe. */
|
|
3435
|
-
return payload;
|
|
3436
|
-
}
|
|
3437
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
3438
|
-
if (result instanceof Promise) return result.then((result) => handleDefaultResult(result, def));
|
|
3439
|
-
return handleDefaultResult(result, def);
|
|
3440
|
-
};
|
|
3441
|
-
});
|
|
3442
|
-
function handleDefaultResult(payload, def) {
|
|
3443
|
-
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
3444
|
-
return payload;
|
|
3445
|
-
}
|
|
3446
|
-
const $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
|
|
3447
|
-
$ZodType.init(inst, def);
|
|
3448
|
-
inst._zod.optin = "optional";
|
|
3449
|
-
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
3450
|
-
inst._zod.parse = (payload, ctx) => {
|
|
3451
|
-
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
3452
|
-
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
3453
|
-
return def.innerType._zod.run(payload, ctx);
|
|
3454
|
-
};
|
|
3455
|
-
});
|
|
3456
|
-
const $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
|
|
3457
|
-
$ZodType.init(inst, def);
|
|
3458
|
-
defineLazy(inst._zod, "values", () => {
|
|
3459
|
-
const v = def.innerType._zod.values;
|
|
3460
|
-
return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
|
|
3461
|
-
});
|
|
3462
|
-
inst._zod.parse = (payload, ctx) => {
|
|
3463
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
3464
|
-
if (result instanceof Promise) return result.then((result) => handleNonOptionalResult(result, inst));
|
|
3465
|
-
return handleNonOptionalResult(result, inst);
|
|
3466
|
-
};
|
|
3467
|
-
});
|
|
3468
|
-
function handleNonOptionalResult(payload, inst) {
|
|
3469
|
-
if (!payload.issues.length && payload.value === void 0) payload.issues.push({
|
|
3470
|
-
code: "invalid_type",
|
|
3471
|
-
expected: "nonoptional",
|
|
3472
|
-
input: payload.value,
|
|
3473
|
-
inst
|
|
3474
|
-
});
|
|
3475
|
-
return payload;
|
|
3476
|
-
}
|
|
3477
|
-
const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
3478
|
-
$ZodType.init(inst, def);
|
|
3479
|
-
inst._zod.optin = "optional";
|
|
3480
|
-
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
3481
|
-
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
3482
|
-
inst._zod.parse = (payload, ctx) => {
|
|
3483
|
-
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
3484
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
3485
|
-
if (result instanceof Promise) return result.then((result) => {
|
|
3486
|
-
payload.value = result.value;
|
|
3487
|
-
if (result.issues.length) {
|
|
3488
|
-
payload.value = def.catchValue({
|
|
3489
|
-
...payload,
|
|
3490
|
-
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
3491
|
-
input: payload.value
|
|
3492
|
-
});
|
|
3493
|
-
payload.issues = [];
|
|
3494
|
-
payload.fallback = true;
|
|
3495
|
-
}
|
|
3496
|
-
return payload;
|
|
3497
|
-
});
|
|
3498
|
-
payload.value = result.value;
|
|
3499
|
-
if (result.issues.length) {
|
|
3500
|
-
payload.value = def.catchValue({
|
|
3501
|
-
...payload,
|
|
3502
|
-
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
3503
|
-
input: payload.value
|
|
3504
|
-
});
|
|
3505
|
-
payload.issues = [];
|
|
3506
|
-
payload.fallback = true;
|
|
3507
|
-
}
|
|
3508
|
-
return payload;
|
|
3509
|
-
};
|
|
3510
|
-
});
|
|
3511
|
-
const $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
|
|
3512
|
-
$ZodType.init(inst, def);
|
|
3513
|
-
defineLazy(inst._zod, "values", () => def.in._zod.values);
|
|
3514
|
-
defineLazy(inst._zod, "optin", () => def.in._zod.optin);
|
|
3515
|
-
defineLazy(inst._zod, "optout", () => def.out._zod.optout);
|
|
3516
|
-
defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
|
|
3517
|
-
inst._zod.parse = (payload, ctx) => {
|
|
3518
|
-
if (ctx.direction === "backward") {
|
|
3519
|
-
const right = def.out._zod.run(payload, ctx);
|
|
3520
|
-
if (right instanceof Promise) return right.then((right) => handlePipeResult(right, def.in, ctx));
|
|
3521
|
-
return handlePipeResult(right, def.in, ctx);
|
|
3522
|
-
}
|
|
3523
|
-
const left = def.in._zod.run(payload, ctx);
|
|
3524
|
-
if (left instanceof Promise) return left.then((left) => handlePipeResult(left, def.out, ctx));
|
|
3525
|
-
return handlePipeResult(left, def.out, ctx);
|
|
3526
|
-
};
|
|
3527
|
-
});
|
|
3528
|
-
function handlePipeResult(left, next, ctx) {
|
|
3529
|
-
if (left.issues.length) {
|
|
3530
|
-
left.aborted = true;
|
|
3531
|
-
return left;
|
|
3532
|
-
}
|
|
3533
|
-
return next._zod.run({
|
|
3534
|
-
value: left.value,
|
|
3535
|
-
issues: left.issues,
|
|
3536
|
-
fallback: left.fallback
|
|
3537
|
-
}, ctx);
|
|
3538
|
-
}
|
|
3539
|
-
const $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
|
|
3540
|
-
$ZodType.init(inst, def);
|
|
3541
|
-
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
3542
|
-
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
3543
|
-
defineLazy(inst._zod, "optin", () => def.innerType?._zod?.optin);
|
|
3544
|
-
defineLazy(inst._zod, "optout", () => def.innerType?._zod?.optout);
|
|
3545
|
-
inst._zod.parse = (payload, ctx) => {
|
|
3546
|
-
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
3547
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
3548
|
-
if (result instanceof Promise) return result.then(handleReadonlyResult);
|
|
3549
|
-
return handleReadonlyResult(result);
|
|
3550
|
-
};
|
|
3551
|
-
});
|
|
3552
|
-
function handleReadonlyResult(payload) {
|
|
3553
|
-
payload.value = Object.freeze(payload.value);
|
|
3554
|
-
return payload;
|
|
3555
|
-
}
|
|
3556
|
-
const $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
3557
|
-
$ZodCheck.init(inst, def);
|
|
3558
|
-
$ZodType.init(inst, def);
|
|
3559
|
-
inst._zod.parse = (payload, _) => {
|
|
3560
|
-
return payload;
|
|
3561
|
-
};
|
|
3562
|
-
inst._zod.check = (payload) => {
|
|
3563
|
-
const input = payload.value;
|
|
3564
|
-
const r = def.fn(input);
|
|
3565
|
-
if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst));
|
|
3566
|
-
handleRefineResult(r, payload, input, inst);
|
|
3567
|
-
};
|
|
3568
|
-
});
|
|
3569
|
-
function handleRefineResult(result, payload, input, inst) {
|
|
3570
|
-
if (!result) {
|
|
3571
|
-
const _iss = {
|
|
3572
|
-
code: "custom",
|
|
3573
|
-
input,
|
|
3574
|
-
inst,
|
|
3575
|
-
path: [...inst._zod.def.path ?? []],
|
|
3576
|
-
continue: !inst._zod.def.abort
|
|
3577
|
-
};
|
|
3578
|
-
if (inst._zod.def.params) _iss.params = inst._zod.def.params;
|
|
3579
|
-
payload.issues.push(issue(_iss));
|
|
3580
|
-
}
|
|
3581
|
-
}
|
|
3582
|
-
//#endregion
|
|
3583
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/registries.js
|
|
3584
|
-
var _a;
|
|
3585
|
-
var $ZodRegistry = class {
|
|
3586
|
-
constructor() {
|
|
3587
|
-
this._map = /* @__PURE__ */ new WeakMap();
|
|
3588
|
-
this._idmap = /* @__PURE__ */ new Map();
|
|
3589
|
-
}
|
|
3590
|
-
add(schema, ..._meta) {
|
|
3591
|
-
const meta = _meta[0];
|
|
3592
|
-
this._map.set(schema, meta);
|
|
3593
|
-
if (meta && typeof meta === "object" && "id" in meta) this._idmap.set(meta.id, schema);
|
|
3594
|
-
return this;
|
|
3595
|
-
}
|
|
3596
|
-
clear() {
|
|
3597
|
-
this._map = /* @__PURE__ */ new WeakMap();
|
|
3598
|
-
this._idmap = /* @__PURE__ */ new Map();
|
|
3599
|
-
return this;
|
|
3600
|
-
}
|
|
3601
|
-
remove(schema) {
|
|
3602
|
-
const meta = this._map.get(schema);
|
|
3603
|
-
if (meta && typeof meta === "object" && "id" in meta) this._idmap.delete(meta.id);
|
|
3604
|
-
this._map.delete(schema);
|
|
3605
|
-
return this;
|
|
3606
|
-
}
|
|
3607
|
-
get(schema) {
|
|
3608
|
-
const p = schema._zod.parent;
|
|
3609
|
-
if (p) {
|
|
3610
|
-
const pm = { ...this.get(p) ?? {} };
|
|
3611
|
-
delete pm.id;
|
|
3612
|
-
const f = {
|
|
3613
|
-
...pm,
|
|
3614
|
-
...this._map.get(schema)
|
|
3615
|
-
};
|
|
3616
|
-
return Object.keys(f).length ? f : void 0;
|
|
3617
|
-
}
|
|
3618
|
-
return this._map.get(schema);
|
|
3619
|
-
}
|
|
3620
|
-
has(schema) {
|
|
3621
|
-
return this._map.has(schema);
|
|
3622
|
-
}
|
|
3623
|
-
};
|
|
3624
|
-
function registry$1() {
|
|
3625
|
-
return new $ZodRegistry();
|
|
3626
|
-
}
|
|
3627
|
-
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry$1());
|
|
3628
|
-
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
3629
|
-
//#endregion
|
|
3630
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.js
|
|
3631
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3632
|
-
function _string(Class, params) {
|
|
3633
|
-
return new Class({
|
|
3634
|
-
type: "string",
|
|
3635
|
-
...normalizeParams(params)
|
|
3636
|
-
});
|
|
3637
|
-
}
|
|
3638
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3639
|
-
function _email(Class, params) {
|
|
3640
|
-
return new Class({
|
|
3641
|
-
type: "string",
|
|
3642
|
-
format: "email",
|
|
3643
|
-
check: "string_format",
|
|
3644
|
-
abort: false,
|
|
3645
|
-
...normalizeParams(params)
|
|
3646
|
-
});
|
|
3647
|
-
}
|
|
3648
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3649
|
-
function _guid(Class, params) {
|
|
3650
|
-
return new Class({
|
|
3651
|
-
type: "string",
|
|
3652
|
-
format: "guid",
|
|
3653
|
-
check: "string_format",
|
|
3654
|
-
abort: false,
|
|
3655
|
-
...normalizeParams(params)
|
|
3656
|
-
});
|
|
3657
|
-
}
|
|
3658
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3659
|
-
function _uuid(Class, params) {
|
|
3660
|
-
return new Class({
|
|
3661
|
-
type: "string",
|
|
3662
|
-
format: "uuid",
|
|
3663
|
-
check: "string_format",
|
|
3664
|
-
abort: false,
|
|
3665
|
-
...normalizeParams(params)
|
|
3666
|
-
});
|
|
3667
|
-
}
|
|
3668
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3669
|
-
function _uuidv4(Class, params) {
|
|
3670
|
-
return new Class({
|
|
3671
|
-
type: "string",
|
|
3672
|
-
format: "uuid",
|
|
3673
|
-
check: "string_format",
|
|
3674
|
-
abort: false,
|
|
3675
|
-
version: "v4",
|
|
3676
|
-
...normalizeParams(params)
|
|
3677
|
-
});
|
|
3678
|
-
}
|
|
3679
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3680
|
-
function _uuidv6(Class, params) {
|
|
3681
|
-
return new Class({
|
|
3682
|
-
type: "string",
|
|
3683
|
-
format: "uuid",
|
|
3684
|
-
check: "string_format",
|
|
3685
|
-
abort: false,
|
|
3686
|
-
version: "v6",
|
|
3687
|
-
...normalizeParams(params)
|
|
3688
|
-
});
|
|
3689
|
-
}
|
|
3690
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3691
|
-
function _uuidv7(Class, params) {
|
|
3692
|
-
return new Class({
|
|
3693
|
-
type: "string",
|
|
3694
|
-
format: "uuid",
|
|
3695
|
-
check: "string_format",
|
|
3696
|
-
abort: false,
|
|
3697
|
-
version: "v7",
|
|
3698
|
-
...normalizeParams(params)
|
|
3699
|
-
});
|
|
3700
|
-
}
|
|
3701
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3702
|
-
function _url(Class, params) {
|
|
3703
|
-
return new Class({
|
|
3704
|
-
type: "string",
|
|
3705
|
-
format: "url",
|
|
3706
|
-
check: "string_format",
|
|
3707
|
-
abort: false,
|
|
3708
|
-
...normalizeParams(params)
|
|
3709
|
-
});
|
|
3710
|
-
}
|
|
3711
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3712
|
-
function _emoji(Class, params) {
|
|
3713
|
-
return new Class({
|
|
3714
|
-
type: "string",
|
|
3715
|
-
format: "emoji",
|
|
3716
|
-
check: "string_format",
|
|
3717
|
-
abort: false,
|
|
3718
|
-
...normalizeParams(params)
|
|
3719
|
-
});
|
|
3720
|
-
}
|
|
3721
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3722
|
-
function _nanoid(Class, params) {
|
|
3723
|
-
return new Class({
|
|
3724
|
-
type: "string",
|
|
3725
|
-
format: "nanoid",
|
|
3726
|
-
check: "string_format",
|
|
3727
|
-
abort: false,
|
|
3728
|
-
...normalizeParams(params)
|
|
3729
|
-
});
|
|
3730
|
-
}
|
|
3731
|
-
/**
|
|
3732
|
-
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
3733
|
-
* (timestamps embedded in the id). Use {@link _cuid2} instead.
|
|
3734
|
-
* See https://github.com/paralleldrive/cuid.
|
|
3735
|
-
*/
|
|
3736
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3737
|
-
function _cuid(Class, params) {
|
|
3738
|
-
return new Class({
|
|
3739
|
-
type: "string",
|
|
3740
|
-
format: "cuid",
|
|
3741
|
-
check: "string_format",
|
|
3742
|
-
abort: false,
|
|
3743
|
-
...normalizeParams(params)
|
|
3744
|
-
});
|
|
3745
|
-
}
|
|
3746
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3747
|
-
function _cuid2(Class, params) {
|
|
3748
|
-
return new Class({
|
|
3749
|
-
type: "string",
|
|
3750
|
-
format: "cuid2",
|
|
3751
|
-
check: "string_format",
|
|
3752
|
-
abort: false,
|
|
3753
|
-
...normalizeParams(params)
|
|
3754
|
-
});
|
|
3755
|
-
}
|
|
3756
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3757
|
-
function _ulid(Class, params) {
|
|
3758
|
-
return new Class({
|
|
3759
|
-
type: "string",
|
|
3760
|
-
format: "ulid",
|
|
3761
|
-
check: "string_format",
|
|
3762
|
-
abort: false,
|
|
3763
|
-
...normalizeParams(params)
|
|
3764
|
-
});
|
|
3765
|
-
}
|
|
3766
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3767
|
-
function _xid(Class, params) {
|
|
3768
|
-
return new Class({
|
|
3769
|
-
type: "string",
|
|
3770
|
-
format: "xid",
|
|
3771
|
-
check: "string_format",
|
|
3772
|
-
abort: false,
|
|
3773
|
-
...normalizeParams(params)
|
|
3774
|
-
});
|
|
3775
|
-
}
|
|
3776
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3777
|
-
function _ksuid(Class, params) {
|
|
3778
|
-
return new Class({
|
|
3779
|
-
type: "string",
|
|
3780
|
-
format: "ksuid",
|
|
3781
|
-
check: "string_format",
|
|
3782
|
-
abort: false,
|
|
3783
|
-
...normalizeParams(params)
|
|
3784
|
-
});
|
|
3785
|
-
}
|
|
3786
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3787
|
-
function _ipv4(Class, params) {
|
|
3788
|
-
return new Class({
|
|
3789
|
-
type: "string",
|
|
3790
|
-
format: "ipv4",
|
|
3791
|
-
check: "string_format",
|
|
3792
|
-
abort: false,
|
|
3793
|
-
...normalizeParams(params)
|
|
3794
|
-
});
|
|
3795
|
-
}
|
|
3796
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3797
|
-
function _ipv6(Class, params) {
|
|
3798
|
-
return new Class({
|
|
3799
|
-
type: "string",
|
|
3800
|
-
format: "ipv6",
|
|
3801
|
-
check: "string_format",
|
|
3802
|
-
abort: false,
|
|
3803
|
-
...normalizeParams(params)
|
|
3804
|
-
});
|
|
3805
|
-
}
|
|
3806
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3807
|
-
function _cidrv4(Class, params) {
|
|
3808
|
-
return new Class({
|
|
3809
|
-
type: "string",
|
|
3810
|
-
format: "cidrv4",
|
|
3811
|
-
check: "string_format",
|
|
3812
|
-
abort: false,
|
|
3813
|
-
...normalizeParams(params)
|
|
3814
|
-
});
|
|
3815
|
-
}
|
|
3816
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3817
|
-
function _cidrv6(Class, params) {
|
|
3818
|
-
return new Class({
|
|
3819
|
-
type: "string",
|
|
3820
|
-
format: "cidrv6",
|
|
3821
|
-
check: "string_format",
|
|
3822
|
-
abort: false,
|
|
3823
|
-
...normalizeParams(params)
|
|
3824
|
-
});
|
|
3825
|
-
}
|
|
3826
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3827
|
-
function _base64(Class, params) {
|
|
3828
|
-
return new Class({
|
|
3829
|
-
type: "string",
|
|
3830
|
-
format: "base64",
|
|
3831
|
-
check: "string_format",
|
|
3832
|
-
abort: false,
|
|
3833
|
-
...normalizeParams(params)
|
|
3834
|
-
});
|
|
3835
|
-
}
|
|
3836
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3837
|
-
function _base64url(Class, params) {
|
|
3838
|
-
return new Class({
|
|
3839
|
-
type: "string",
|
|
3840
|
-
format: "base64url",
|
|
3841
|
-
check: "string_format",
|
|
3842
|
-
abort: false,
|
|
3843
|
-
...normalizeParams(params)
|
|
3844
|
-
});
|
|
3845
|
-
}
|
|
3846
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3847
|
-
function _e164(Class, params) {
|
|
3848
|
-
return new Class({
|
|
3849
|
-
type: "string",
|
|
3850
|
-
format: "e164",
|
|
3851
|
-
check: "string_format",
|
|
3852
|
-
abort: false,
|
|
3853
|
-
...normalizeParams(params)
|
|
3854
|
-
});
|
|
3855
|
-
}
|
|
3856
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3857
|
-
function _jwt(Class, params) {
|
|
3858
|
-
return new Class({
|
|
3859
|
-
type: "string",
|
|
3860
|
-
format: "jwt",
|
|
3861
|
-
check: "string_format",
|
|
3862
|
-
abort: false,
|
|
3863
|
-
...normalizeParams(params)
|
|
3864
|
-
});
|
|
3865
|
-
}
|
|
3866
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3867
|
-
function _isoDateTime(Class, params) {
|
|
3868
|
-
return new Class({
|
|
3869
|
-
type: "string",
|
|
3870
|
-
format: "datetime",
|
|
3871
|
-
check: "string_format",
|
|
3872
|
-
offset: false,
|
|
3873
|
-
local: false,
|
|
3874
|
-
precision: null,
|
|
3875
|
-
...normalizeParams(params)
|
|
3876
|
-
});
|
|
3877
|
-
}
|
|
3878
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3879
|
-
function _isoDate(Class, params) {
|
|
3880
|
-
return new Class({
|
|
3881
|
-
type: "string",
|
|
3882
|
-
format: "date",
|
|
3883
|
-
check: "string_format",
|
|
3884
|
-
...normalizeParams(params)
|
|
3885
|
-
});
|
|
3886
|
-
}
|
|
3887
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3888
|
-
function _isoTime(Class, params) {
|
|
3889
|
-
return new Class({
|
|
3890
|
-
type: "string",
|
|
3891
|
-
format: "time",
|
|
3892
|
-
check: "string_format",
|
|
3893
|
-
precision: null,
|
|
3894
|
-
...normalizeParams(params)
|
|
3895
|
-
});
|
|
3896
|
-
}
|
|
3897
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3898
|
-
function _isoDuration(Class, params) {
|
|
3899
|
-
return new Class({
|
|
3900
|
-
type: "string",
|
|
3901
|
-
format: "duration",
|
|
3902
|
-
check: "string_format",
|
|
3903
|
-
...normalizeParams(params)
|
|
3904
|
-
});
|
|
3905
|
-
}
|
|
3906
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3907
|
-
function _number(Class, params) {
|
|
3908
|
-
return new Class({
|
|
3909
|
-
type: "number",
|
|
3910
|
-
checks: [],
|
|
3911
|
-
...normalizeParams(params)
|
|
3912
|
-
});
|
|
3913
|
-
}
|
|
3914
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3915
|
-
function _coercedNumber(Class, params) {
|
|
3916
|
-
return new Class({
|
|
3917
|
-
type: "number",
|
|
3918
|
-
coerce: true,
|
|
3919
|
-
checks: [],
|
|
3920
|
-
...normalizeParams(params)
|
|
3921
|
-
});
|
|
3922
|
-
}
|
|
3923
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3924
|
-
function _int(Class, params) {
|
|
3925
|
-
return new Class({
|
|
3926
|
-
type: "number",
|
|
3927
|
-
check: "number_format",
|
|
3928
|
-
abort: false,
|
|
3929
|
-
format: "safeint",
|
|
3930
|
-
...normalizeParams(params)
|
|
3931
|
-
});
|
|
3932
|
-
}
|
|
3933
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3934
|
-
function _boolean(Class, params) {
|
|
3935
|
-
return new Class({
|
|
3936
|
-
type: "boolean",
|
|
3937
|
-
...normalizeParams(params)
|
|
3938
|
-
});
|
|
3939
|
-
}
|
|
3940
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3941
|
-
function _unknown(Class) {
|
|
3942
|
-
return new Class({ type: "unknown" });
|
|
3943
|
-
}
|
|
3944
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3945
|
-
function _never(Class, params) {
|
|
3946
|
-
return new Class({
|
|
3947
|
-
type: "never",
|
|
3948
|
-
...normalizeParams(params)
|
|
3949
|
-
});
|
|
3950
|
-
}
|
|
3951
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3952
|
-
function _lt(value, params) {
|
|
3953
|
-
return new $ZodCheckLessThan({
|
|
3954
|
-
check: "less_than",
|
|
3955
|
-
...normalizeParams(params),
|
|
3956
|
-
value,
|
|
3957
|
-
inclusive: false
|
|
3958
|
-
});
|
|
3959
|
-
}
|
|
3960
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3961
|
-
function _lte(value, params) {
|
|
3962
|
-
return new $ZodCheckLessThan({
|
|
3963
|
-
check: "less_than",
|
|
3964
|
-
...normalizeParams(params),
|
|
3965
|
-
value,
|
|
3966
|
-
inclusive: true
|
|
3967
|
-
});
|
|
3968
|
-
}
|
|
3969
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3970
|
-
function _gt(value, params) {
|
|
3971
|
-
return new $ZodCheckGreaterThan({
|
|
3972
|
-
check: "greater_than",
|
|
3973
|
-
...normalizeParams(params),
|
|
3974
|
-
value,
|
|
3975
|
-
inclusive: false
|
|
3976
|
-
});
|
|
3977
|
-
}
|
|
3978
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3979
|
-
function _gte(value, params) {
|
|
3980
|
-
return new $ZodCheckGreaterThan({
|
|
3981
|
-
check: "greater_than",
|
|
3982
|
-
...normalizeParams(params),
|
|
3983
|
-
value,
|
|
3984
|
-
inclusive: true
|
|
3985
|
-
});
|
|
3986
|
-
}
|
|
3987
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3988
|
-
function _multipleOf(value, params) {
|
|
3989
|
-
return new $ZodCheckMultipleOf({
|
|
3990
|
-
check: "multiple_of",
|
|
3991
|
-
...normalizeParams(params),
|
|
3992
|
-
value
|
|
3993
|
-
});
|
|
3994
|
-
}
|
|
3995
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
3996
|
-
function _maxLength(maximum, params) {
|
|
3997
|
-
return new $ZodCheckMaxLength({
|
|
3998
|
-
check: "max_length",
|
|
3999
|
-
...normalizeParams(params),
|
|
4000
|
-
maximum
|
|
4001
|
-
});
|
|
4002
|
-
}
|
|
4003
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
4004
|
-
function _minLength(minimum, params) {
|
|
4005
|
-
return new $ZodCheckMinLength({
|
|
4006
|
-
check: "min_length",
|
|
4007
|
-
...normalizeParams(params),
|
|
4008
|
-
minimum
|
|
4009
|
-
});
|
|
4010
|
-
}
|
|
4011
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
4012
|
-
function _length(length, params) {
|
|
4013
|
-
return new $ZodCheckLengthEquals({
|
|
4014
|
-
check: "length_equals",
|
|
4015
|
-
...normalizeParams(params),
|
|
4016
|
-
length
|
|
4017
|
-
});
|
|
4018
|
-
}
|
|
4019
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
4020
|
-
function _regex(pattern, params) {
|
|
4021
|
-
return new $ZodCheckRegex({
|
|
4022
|
-
check: "string_format",
|
|
4023
|
-
format: "regex",
|
|
4024
|
-
...normalizeParams(params),
|
|
4025
|
-
pattern
|
|
4026
|
-
});
|
|
4027
|
-
}
|
|
4028
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
4029
|
-
function _lowercase(params) {
|
|
4030
|
-
return new $ZodCheckLowerCase({
|
|
4031
|
-
check: "string_format",
|
|
4032
|
-
format: "lowercase",
|
|
4033
|
-
...normalizeParams(params)
|
|
4034
|
-
});
|
|
4035
|
-
}
|
|
4036
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
4037
|
-
function _uppercase(params) {
|
|
4038
|
-
return new $ZodCheckUpperCase({
|
|
4039
|
-
check: "string_format",
|
|
4040
|
-
format: "uppercase",
|
|
4041
|
-
...normalizeParams(params)
|
|
4042
|
-
});
|
|
4043
|
-
}
|
|
4044
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
4045
|
-
function _includes(includes, params) {
|
|
4046
|
-
return new $ZodCheckIncludes({
|
|
4047
|
-
check: "string_format",
|
|
4048
|
-
format: "includes",
|
|
4049
|
-
...normalizeParams(params),
|
|
4050
|
-
includes
|
|
4051
|
-
});
|
|
4052
|
-
}
|
|
4053
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
4054
|
-
function _startsWith(prefix, params) {
|
|
4055
|
-
return new $ZodCheckStartsWith({
|
|
4056
|
-
check: "string_format",
|
|
4057
|
-
format: "starts_with",
|
|
4058
|
-
...normalizeParams(params),
|
|
4059
|
-
prefix
|
|
4060
|
-
});
|
|
4061
|
-
}
|
|
4062
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
4063
|
-
function _endsWith(suffix, params) {
|
|
4064
|
-
return new $ZodCheckEndsWith({
|
|
4065
|
-
check: "string_format",
|
|
4066
|
-
format: "ends_with",
|
|
4067
|
-
...normalizeParams(params),
|
|
4068
|
-
suffix
|
|
4069
|
-
});
|
|
4070
|
-
}
|
|
4071
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
4072
|
-
function _overwrite(tx) {
|
|
4073
|
-
return new $ZodCheckOverwrite({
|
|
4074
|
-
check: "overwrite",
|
|
4075
|
-
tx
|
|
4076
|
-
});
|
|
4077
|
-
}
|
|
4078
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
4079
|
-
function _normalize(form) {
|
|
4080
|
-
return /* @__PURE__ */ _overwrite((input) => input.normalize(form));
|
|
4081
|
-
}
|
|
4082
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
4083
|
-
function _trim() {
|
|
4084
|
-
return /* @__PURE__ */ _overwrite((input) => input.trim());
|
|
4085
|
-
}
|
|
4086
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
4087
|
-
function _toLowerCase() {
|
|
4088
|
-
return /* @__PURE__ */ _overwrite((input) => input.toLowerCase());
|
|
4089
|
-
}
|
|
4090
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
4091
|
-
function _toUpperCase() {
|
|
4092
|
-
return /* @__PURE__ */ _overwrite((input) => input.toUpperCase());
|
|
4093
|
-
}
|
|
4094
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
4095
|
-
function _slugify() {
|
|
4096
|
-
return /* @__PURE__ */ _overwrite((input) => slugify(input));
|
|
4097
|
-
}
|
|
4098
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
4099
|
-
function _array(Class, element, params) {
|
|
4100
|
-
return new Class({
|
|
4101
|
-
type: "array",
|
|
4102
|
-
element,
|
|
4103
|
-
...normalizeParams(params)
|
|
4104
|
-
});
|
|
4105
|
-
}
|
|
4106
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
4107
|
-
function _refine(Class, fn, _params) {
|
|
4108
|
-
return new Class({
|
|
4109
|
-
type: "custom",
|
|
4110
|
-
check: "custom",
|
|
4111
|
-
fn,
|
|
4112
|
-
...normalizeParams(_params)
|
|
4113
|
-
});
|
|
4114
|
-
}
|
|
4115
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
4116
|
-
function _superRefine(fn, params) {
|
|
4117
|
-
const ch = /* @__PURE__ */ _check((payload) => {
|
|
4118
|
-
payload.addIssue = (issue$2) => {
|
|
4119
|
-
if (typeof issue$2 === "string") payload.issues.push(issue(issue$2, payload.value, ch._zod.def));
|
|
4120
|
-
else {
|
|
4121
|
-
const _issue = issue$2;
|
|
4122
|
-
if (_issue.fatal) _issue.continue = false;
|
|
4123
|
-
_issue.code ?? (_issue.code = "custom");
|
|
4124
|
-
_issue.input ?? (_issue.input = payload.value);
|
|
4125
|
-
_issue.inst ?? (_issue.inst = ch);
|
|
4126
|
-
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
4127
|
-
payload.issues.push(issue(_issue));
|
|
4128
|
-
}
|
|
4129
|
-
};
|
|
4130
|
-
return fn(payload.value, payload);
|
|
4131
|
-
}, params);
|
|
4132
|
-
return ch;
|
|
4133
|
-
}
|
|
4134
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
4135
|
-
function _check(fn, params) {
|
|
4136
|
-
const ch = new $ZodCheck({
|
|
4137
|
-
check: "custom",
|
|
4138
|
-
...normalizeParams(params)
|
|
4139
|
-
});
|
|
4140
|
-
ch._zod.check = fn;
|
|
4141
|
-
return ch;
|
|
4142
|
-
}
|
|
4143
|
-
//#endregion
|
|
4144
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/to-json-schema.js
|
|
4145
|
-
function initializeContext(params) {
|
|
4146
|
-
let target = params?.target ?? "draft-2020-12";
|
|
4147
|
-
if (target === "draft-4") target = "draft-04";
|
|
4148
|
-
if (target === "draft-7") target = "draft-07";
|
|
4149
|
-
return {
|
|
4150
|
-
processors: params.processors ?? {},
|
|
4151
|
-
metadataRegistry: params?.metadata ?? globalRegistry,
|
|
4152
|
-
target,
|
|
4153
|
-
unrepresentable: params?.unrepresentable ?? "throw",
|
|
4154
|
-
override: params?.override ?? (() => {}),
|
|
4155
|
-
io: params?.io ?? "output",
|
|
4156
|
-
counter: 0,
|
|
4157
|
-
seen: /* @__PURE__ */ new Map(),
|
|
4158
|
-
cycles: params?.cycles ?? "ref",
|
|
4159
|
-
reused: params?.reused ?? "inline",
|
|
4160
|
-
external: params?.external ?? void 0
|
|
4161
|
-
};
|
|
4162
|
-
}
|
|
4163
|
-
function process$1(schema, ctx, _params = {
|
|
4164
|
-
path: [],
|
|
4165
|
-
schemaPath: []
|
|
4166
|
-
}) {
|
|
4167
|
-
var _a;
|
|
4168
|
-
const def = schema._zod.def;
|
|
4169
|
-
const seen = ctx.seen.get(schema);
|
|
4170
|
-
if (seen) {
|
|
4171
|
-
seen.count++;
|
|
4172
|
-
if (_params.schemaPath.includes(schema)) seen.cycle = _params.path;
|
|
4173
|
-
return seen.schema;
|
|
4174
|
-
}
|
|
4175
|
-
const result = {
|
|
4176
|
-
schema: {},
|
|
4177
|
-
count: 1,
|
|
4178
|
-
cycle: void 0,
|
|
4179
|
-
path: _params.path
|
|
4180
|
-
};
|
|
4181
|
-
ctx.seen.set(schema, result);
|
|
4182
|
-
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
4183
|
-
if (overrideSchema) result.schema = overrideSchema;
|
|
4184
|
-
else {
|
|
4185
|
-
const params = {
|
|
4186
|
-
..._params,
|
|
4187
|
-
schemaPath: [..._params.schemaPath, schema],
|
|
4188
|
-
path: _params.path
|
|
4189
|
-
};
|
|
4190
|
-
if (schema._zod.processJSONSchema) schema._zod.processJSONSchema(ctx, result.schema, params);
|
|
4191
|
-
else {
|
|
4192
|
-
const _json = result.schema;
|
|
4193
|
-
const processor = ctx.processors[def.type];
|
|
4194
|
-
if (!processor) throw new Error(`[toJSONSchema]: Non-representable type encountered: ${def.type}`);
|
|
4195
|
-
processor(schema, ctx, _json, params);
|
|
4196
|
-
}
|
|
4197
|
-
const parent = schema._zod.parent;
|
|
4198
|
-
if (parent) {
|
|
4199
|
-
if (!result.ref) result.ref = parent;
|
|
4200
|
-
process$1(parent, ctx, params);
|
|
4201
|
-
ctx.seen.get(parent).isParent = true;
|
|
4202
|
-
}
|
|
4203
|
-
}
|
|
4204
|
-
const meta = ctx.metadataRegistry.get(schema);
|
|
4205
|
-
if (meta) Object.assign(result.schema, meta);
|
|
4206
|
-
if (ctx.io === "input" && isTransforming(schema)) {
|
|
4207
|
-
delete result.schema.examples;
|
|
4208
|
-
delete result.schema.default;
|
|
4209
|
-
}
|
|
4210
|
-
if (ctx.io === "input" && "_prefault" in result.schema) (_a = result.schema).default ?? (_a.default = result.schema._prefault);
|
|
4211
|
-
delete result.schema._prefault;
|
|
4212
|
-
return ctx.seen.get(schema).schema;
|
|
4213
|
-
}
|
|
4214
|
-
function extractDefs(ctx, schema) {
|
|
4215
|
-
const root = ctx.seen.get(schema);
|
|
4216
|
-
if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
4217
|
-
const idToSchema = /* @__PURE__ */ new Map();
|
|
4218
|
-
for (const entry of ctx.seen.entries()) {
|
|
4219
|
-
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
4220
|
-
if (id) {
|
|
4221
|
-
const existing = idToSchema.get(id);
|
|
4222
|
-
if (existing && existing !== entry[0]) throw new Error(`Duplicate schema id "${id}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);
|
|
4223
|
-
idToSchema.set(id, entry[0]);
|
|
4224
|
-
}
|
|
4225
|
-
}
|
|
4226
|
-
const makeURI = (entry) => {
|
|
4227
|
-
const defsSegment = ctx.target === "draft-2020-12" ? "$defs" : "definitions";
|
|
4228
|
-
if (ctx.external) {
|
|
4229
|
-
const externalId = ctx.external.registry.get(entry[0])?.id;
|
|
4230
|
-
const uriGenerator = ctx.external.uri ?? ((id) => id);
|
|
4231
|
-
if (externalId) return { ref: uriGenerator(externalId) };
|
|
4232
|
-
const id = entry[1].defId ?? entry[1].schema.id ?? `schema${ctx.counter++}`;
|
|
4233
|
-
entry[1].defId = id;
|
|
4234
|
-
return {
|
|
4235
|
-
defId: id,
|
|
4236
|
-
ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}`
|
|
4237
|
-
};
|
|
4238
|
-
}
|
|
4239
|
-
if (entry[1] === root) return { ref: "#" };
|
|
4240
|
-
const defUriPrefix = `#/${defsSegment}/`;
|
|
4241
|
-
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
4242
|
-
return {
|
|
4243
|
-
defId,
|
|
4244
|
-
ref: defUriPrefix + defId
|
|
4245
|
-
};
|
|
4246
|
-
};
|
|
4247
|
-
const extractToDef = (entry) => {
|
|
4248
|
-
if (entry[1].schema.$ref) return;
|
|
4249
|
-
const seen = entry[1];
|
|
4250
|
-
const { ref, defId } = makeURI(entry);
|
|
4251
|
-
seen.def = { ...seen.schema };
|
|
4252
|
-
if (defId) seen.defId = defId;
|
|
4253
|
-
const schema = seen.schema;
|
|
4254
|
-
for (const key in schema) delete schema[key];
|
|
4255
|
-
schema.$ref = ref;
|
|
4256
|
-
};
|
|
4257
|
-
if (ctx.cycles === "throw") for (const entry of ctx.seen.entries()) {
|
|
4258
|
-
const seen = entry[1];
|
|
4259
|
-
if (seen.cycle) throw new Error(`Cycle detected: #/${seen.cycle?.join("/")}/<root>
|
|
4260
|
-
|
|
4261
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`);
|
|
4262
|
-
}
|
|
4263
|
-
for (const entry of ctx.seen.entries()) {
|
|
4264
|
-
const seen = entry[1];
|
|
4265
|
-
if (schema === entry[0]) {
|
|
4266
|
-
extractToDef(entry);
|
|
4267
|
-
continue;
|
|
4268
|
-
}
|
|
4269
|
-
if (ctx.external) {
|
|
4270
|
-
const ext = ctx.external.registry.get(entry[0])?.id;
|
|
4271
|
-
if (schema !== entry[0] && ext) {
|
|
4272
|
-
extractToDef(entry);
|
|
4273
|
-
continue;
|
|
4274
|
-
}
|
|
4275
|
-
}
|
|
4276
|
-
if (ctx.metadataRegistry.get(entry[0])?.id) {
|
|
4277
|
-
extractToDef(entry);
|
|
4278
|
-
continue;
|
|
4279
|
-
}
|
|
4280
|
-
if (seen.cycle) {
|
|
4281
|
-
extractToDef(entry);
|
|
4282
|
-
continue;
|
|
4283
|
-
}
|
|
4284
|
-
if (seen.count > 1) {
|
|
4285
|
-
if (ctx.reused === "ref") {
|
|
4286
|
-
extractToDef(entry);
|
|
4287
|
-
continue;
|
|
4288
|
-
}
|
|
4289
|
-
}
|
|
4290
|
-
}
|
|
4291
|
-
}
|
|
4292
|
-
function finalize(ctx, schema) {
|
|
4293
|
-
const root = ctx.seen.get(schema);
|
|
4294
|
-
if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
4295
|
-
const flattenRef = (zodSchema) => {
|
|
4296
|
-
const seen = ctx.seen.get(zodSchema);
|
|
4297
|
-
if (seen.ref === null) return;
|
|
4298
|
-
const schema = seen.def ?? seen.schema;
|
|
4299
|
-
const _cached = { ...schema };
|
|
4300
|
-
const ref = seen.ref;
|
|
4301
|
-
seen.ref = null;
|
|
4302
|
-
if (ref) {
|
|
4303
|
-
flattenRef(ref);
|
|
4304
|
-
const refSeen = ctx.seen.get(ref);
|
|
4305
|
-
const refSchema = refSeen.schema;
|
|
4306
|
-
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
4307
|
-
schema.allOf = schema.allOf ?? [];
|
|
4308
|
-
schema.allOf.push(refSchema);
|
|
4309
|
-
} else Object.assign(schema, refSchema);
|
|
4310
|
-
Object.assign(schema, _cached);
|
|
4311
|
-
if (zodSchema._zod.parent === ref) for (const key in schema) {
|
|
4312
|
-
if (key === "$ref" || key === "allOf") continue;
|
|
4313
|
-
if (!(key in _cached)) delete schema[key];
|
|
4314
|
-
}
|
|
4315
|
-
if (refSchema.$ref && refSeen.def) for (const key in schema) {
|
|
4316
|
-
if (key === "$ref" || key === "allOf") continue;
|
|
4317
|
-
if (key in refSeen.def && JSON.stringify(schema[key]) === JSON.stringify(refSeen.def[key])) delete schema[key];
|
|
4318
|
-
}
|
|
4319
|
-
}
|
|
4320
|
-
const parent = zodSchema._zod.parent;
|
|
4321
|
-
if (parent && parent !== ref) {
|
|
4322
|
-
flattenRef(parent);
|
|
4323
|
-
const parentSeen = ctx.seen.get(parent);
|
|
4324
|
-
if (parentSeen?.schema.$ref) {
|
|
4325
|
-
schema.$ref = parentSeen.schema.$ref;
|
|
4326
|
-
if (parentSeen.def) for (const key in schema) {
|
|
4327
|
-
if (key === "$ref" || key === "allOf") continue;
|
|
4328
|
-
if (key in parentSeen.def && JSON.stringify(schema[key]) === JSON.stringify(parentSeen.def[key])) delete schema[key];
|
|
4329
|
-
}
|
|
4330
|
-
}
|
|
4331
|
-
}
|
|
4332
|
-
ctx.override({
|
|
4333
|
-
zodSchema,
|
|
4334
|
-
jsonSchema: schema,
|
|
4335
|
-
path: seen.path ?? []
|
|
4336
|
-
});
|
|
4337
|
-
};
|
|
4338
|
-
for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
|
|
4339
|
-
const result = {};
|
|
4340
|
-
if (ctx.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
|
4341
|
-
else if (ctx.target === "draft-07") result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
4342
|
-
else if (ctx.target === "draft-04") result.$schema = "http://json-schema.org/draft-04/schema#";
|
|
4343
|
-
else if (ctx.target === "openapi-3.0") {}
|
|
4344
|
-
if (ctx.external?.uri) {
|
|
4345
|
-
const id = ctx.external.registry.get(schema)?.id;
|
|
4346
|
-
if (!id) throw new Error("Schema is missing an `id` property");
|
|
4347
|
-
result.$id = ctx.external.uri(id);
|
|
4348
|
-
}
|
|
4349
|
-
Object.assign(result, root.def ?? root.schema);
|
|
4350
|
-
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
4351
|
-
if (rootMetaId !== void 0 && result.id === rootMetaId) delete result.id;
|
|
4352
|
-
const defs = ctx.external?.defs ?? {};
|
|
4353
|
-
for (const entry of ctx.seen.entries()) {
|
|
4354
|
-
const seen = entry[1];
|
|
4355
|
-
if (seen.def && seen.defId) {
|
|
4356
|
-
if (seen.def.id === seen.defId) delete seen.def.id;
|
|
4357
|
-
defs[seen.defId] = seen.def;
|
|
4358
|
-
}
|
|
4359
|
-
}
|
|
4360
|
-
if (ctx.external) {} else if (Object.keys(defs).length > 0) if (ctx.target === "draft-2020-12") result.$defs = defs;
|
|
4361
|
-
else result.definitions = defs;
|
|
4362
|
-
try {
|
|
4363
|
-
const finalized = JSON.parse(JSON.stringify(result));
|
|
4364
|
-
Object.defineProperty(finalized, "~standard", {
|
|
4365
|
-
value: {
|
|
4366
|
-
...schema["~standard"],
|
|
4367
|
-
jsonSchema: {
|
|
4368
|
-
input: createStandardJSONSchemaMethod(schema, "input", ctx.processors),
|
|
4369
|
-
output: createStandardJSONSchemaMethod(schema, "output", ctx.processors)
|
|
4370
|
-
}
|
|
4371
|
-
},
|
|
4372
|
-
enumerable: false,
|
|
4373
|
-
writable: false
|
|
4374
|
-
});
|
|
4375
|
-
return finalized;
|
|
4376
|
-
} catch (_err) {
|
|
4377
|
-
throw new Error("Error converting schema to JSON.");
|
|
4378
|
-
}
|
|
4379
|
-
}
|
|
4380
|
-
function isTransforming(_schema, _ctx) {
|
|
4381
|
-
const ctx = _ctx ?? { seen: /* @__PURE__ */ new Set() };
|
|
4382
|
-
if (ctx.seen.has(_schema)) return false;
|
|
4383
|
-
ctx.seen.add(_schema);
|
|
4384
|
-
const def = _schema._zod.def;
|
|
4385
|
-
if (def.type === "transform") return true;
|
|
4386
|
-
if (def.type === "array") return isTransforming(def.element, ctx);
|
|
4387
|
-
if (def.type === "set") return isTransforming(def.valueType, ctx);
|
|
4388
|
-
if (def.type === "lazy") return isTransforming(def.getter(), ctx);
|
|
4389
|
-
if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault") return isTransforming(def.innerType, ctx);
|
|
4390
|
-
if (def.type === "intersection") return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
|
|
4391
|
-
if (def.type === "record" || def.type === "map") return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
|
4392
|
-
if (def.type === "pipe") {
|
|
4393
|
-
if (_schema._zod.traits.has("$ZodCodec")) return true;
|
|
4394
|
-
return isTransforming(def.in, ctx) || isTransforming(def.out, ctx);
|
|
4395
|
-
}
|
|
4396
|
-
if (def.type === "object") {
|
|
4397
|
-
for (const key in def.shape) if (isTransforming(def.shape[key], ctx)) return true;
|
|
4398
|
-
return false;
|
|
4399
|
-
}
|
|
4400
|
-
if (def.type === "union") {
|
|
4401
|
-
for (const option of def.options) if (isTransforming(option, ctx)) return true;
|
|
4402
|
-
return false;
|
|
4403
|
-
}
|
|
4404
|
-
if (def.type === "tuple") {
|
|
4405
|
-
for (const item of def.items) if (isTransforming(item, ctx)) return true;
|
|
4406
|
-
if (def.rest && isTransforming(def.rest, ctx)) return true;
|
|
4407
|
-
return false;
|
|
4408
|
-
}
|
|
4409
|
-
return false;
|
|
4410
|
-
}
|
|
4411
|
-
/**
|
|
4412
|
-
* Creates a toJSONSchema method for a schema instance.
|
|
4413
|
-
* This encapsulates the logic of initializing context, processing, extracting defs, and finalizing.
|
|
4414
|
-
*/
|
|
4415
|
-
const createToJSONSchemaMethod = (schema, processors = {}) => (params) => {
|
|
4416
|
-
const ctx = initializeContext({
|
|
4417
|
-
...params,
|
|
4418
|
-
processors
|
|
4419
|
-
});
|
|
4420
|
-
process$1(schema, ctx);
|
|
4421
|
-
extractDefs(ctx, schema);
|
|
4422
|
-
return finalize(ctx, schema);
|
|
4423
|
-
};
|
|
4424
|
-
const createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) => {
|
|
4425
|
-
const { libraryOptions, target } = params ?? {};
|
|
4426
|
-
const ctx = initializeContext({
|
|
4427
|
-
...libraryOptions ?? {},
|
|
4428
|
-
target,
|
|
4429
|
-
io,
|
|
4430
|
-
processors
|
|
4431
|
-
});
|
|
4432
|
-
process$1(schema, ctx);
|
|
4433
|
-
extractDefs(ctx, schema);
|
|
4434
|
-
return finalize(ctx, schema);
|
|
4435
|
-
};
|
|
4436
|
-
//#endregion
|
|
4437
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/json-schema-processors.js
|
|
4438
|
-
const formatMap = {
|
|
4439
|
-
guid: "uuid",
|
|
4440
|
-
url: "uri",
|
|
4441
|
-
datetime: "date-time",
|
|
4442
|
-
json_string: "json-string",
|
|
4443
|
-
regex: ""
|
|
4444
|
-
};
|
|
4445
|
-
const stringProcessor = (schema, ctx, _json, _params) => {
|
|
4446
|
-
const json = _json;
|
|
4447
|
-
json.type = "string";
|
|
4448
|
-
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
4449
|
-
if (typeof minimum === "number") json.minLength = minimum;
|
|
4450
|
-
if (typeof maximum === "number") json.maxLength = maximum;
|
|
4451
|
-
if (format) {
|
|
4452
|
-
json.format = formatMap[format] ?? format;
|
|
4453
|
-
if (json.format === "") delete json.format;
|
|
4454
|
-
if (format === "time") delete json.format;
|
|
4455
|
-
}
|
|
4456
|
-
if (contentEncoding) json.contentEncoding = contentEncoding;
|
|
4457
|
-
if (patterns && patterns.size > 0) {
|
|
4458
|
-
const regexes = [...patterns];
|
|
4459
|
-
if (regexes.length === 1) json.pattern = regexes[0].source;
|
|
4460
|
-
else if (regexes.length > 1) json.allOf = [...regexes.map((regex) => ({
|
|
4461
|
-
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
4462
|
-
pattern: regex.source
|
|
4463
|
-
}))];
|
|
4464
|
-
}
|
|
4465
|
-
};
|
|
4466
|
-
const numberProcessor = (schema, ctx, _json, _params) => {
|
|
4467
|
-
const json = _json;
|
|
4468
|
-
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
4469
|
-
if (typeof format === "string" && format.includes("int")) json.type = "integer";
|
|
4470
|
-
else json.type = "number";
|
|
4471
|
-
const exMin = typeof exclusiveMinimum === "number" && exclusiveMinimum >= (minimum ?? Number.NEGATIVE_INFINITY);
|
|
4472
|
-
const exMax = typeof exclusiveMaximum === "number" && exclusiveMaximum <= (maximum ?? Number.POSITIVE_INFINITY);
|
|
4473
|
-
const legacy = ctx.target === "draft-04" || ctx.target === "openapi-3.0";
|
|
4474
|
-
if (exMin) if (legacy) {
|
|
4475
|
-
json.minimum = exclusiveMinimum;
|
|
4476
|
-
json.exclusiveMinimum = true;
|
|
4477
|
-
} else json.exclusiveMinimum = exclusiveMinimum;
|
|
4478
|
-
else if (typeof minimum === "number") json.minimum = minimum;
|
|
4479
|
-
if (exMax) if (legacy) {
|
|
4480
|
-
json.maximum = exclusiveMaximum;
|
|
4481
|
-
json.exclusiveMaximum = true;
|
|
4482
|
-
} else json.exclusiveMaximum = exclusiveMaximum;
|
|
4483
|
-
else if (typeof maximum === "number") json.maximum = maximum;
|
|
4484
|
-
if (typeof multipleOf === "number") json.multipleOf = multipleOf;
|
|
4485
|
-
};
|
|
4486
|
-
const booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
4487
|
-
json.type = "boolean";
|
|
4488
|
-
};
|
|
4489
|
-
const neverProcessor = (_schema, _ctx, json, _params) => {
|
|
4490
|
-
json.not = {};
|
|
4491
|
-
};
|
|
4492
|
-
const enumProcessor = (schema, _ctx, json, _params) => {
|
|
4493
|
-
const def = schema._zod.def;
|
|
4494
|
-
const values = getEnumValues(def.entries);
|
|
4495
|
-
if (values.every((v) => typeof v === "number")) json.type = "number";
|
|
4496
|
-
if (values.every((v) => typeof v === "string")) json.type = "string";
|
|
4497
|
-
json.enum = values;
|
|
4498
|
-
};
|
|
4499
|
-
const literalProcessor = (schema, ctx, json, _params) => {
|
|
4500
|
-
const def = schema._zod.def;
|
|
4501
|
-
const vals = [];
|
|
4502
|
-
for (const val of def.values) if (val === void 0) {
|
|
4503
|
-
if (ctx.unrepresentable === "throw") throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
4504
|
-
} else if (typeof val === "bigint") if (ctx.unrepresentable === "throw") throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
4505
|
-
else vals.push(Number(val));
|
|
4506
|
-
else vals.push(val);
|
|
4507
|
-
if (vals.length === 0) {} else if (vals.length === 1) {
|
|
4508
|
-
const val = vals[0];
|
|
4509
|
-
json.type = val === null ? "null" : typeof val;
|
|
4510
|
-
if (ctx.target === "draft-04" || ctx.target === "openapi-3.0") json.enum = [val];
|
|
4511
|
-
else json.const = val;
|
|
4512
|
-
} else {
|
|
4513
|
-
if (vals.every((v) => typeof v === "number")) json.type = "number";
|
|
4514
|
-
if (vals.every((v) => typeof v === "string")) json.type = "string";
|
|
4515
|
-
if (vals.every((v) => typeof v === "boolean")) json.type = "boolean";
|
|
4516
|
-
if (vals.every((v) => v === null)) json.type = "null";
|
|
4517
|
-
json.enum = vals;
|
|
4518
|
-
}
|
|
4519
|
-
};
|
|
4520
|
-
const customProcessor = (_schema, ctx, _json, _params) => {
|
|
4521
|
-
if (ctx.unrepresentable === "throw") throw new Error("Custom types cannot be represented in JSON Schema");
|
|
4522
|
-
};
|
|
4523
|
-
const transformProcessor = (_schema, ctx, _json, _params) => {
|
|
4524
|
-
if (ctx.unrepresentable === "throw") throw new Error("Transforms cannot be represented in JSON Schema");
|
|
4525
|
-
};
|
|
4526
|
-
const arrayProcessor = (schema, ctx, _json, params) => {
|
|
4527
|
-
const json = _json;
|
|
4528
|
-
const def = schema._zod.def;
|
|
4529
|
-
const { minimum, maximum } = schema._zod.bag;
|
|
4530
|
-
if (typeof minimum === "number") json.minItems = minimum;
|
|
4531
|
-
if (typeof maximum === "number") json.maxItems = maximum;
|
|
4532
|
-
json.type = "array";
|
|
4533
|
-
json.items = process$1(def.element, ctx, {
|
|
4534
|
-
...params,
|
|
4535
|
-
path: [...params.path, "items"]
|
|
4536
|
-
});
|
|
4537
|
-
};
|
|
4538
|
-
const objectProcessor = (schema, ctx, _json, params) => {
|
|
4539
|
-
const json = _json;
|
|
4540
|
-
const def = schema._zod.def;
|
|
4541
|
-
json.type = "object";
|
|
4542
|
-
json.properties = {};
|
|
4543
|
-
const shape = def.shape;
|
|
4544
|
-
for (const key in shape) json.properties[key] = process$1(shape[key], ctx, {
|
|
4545
|
-
...params,
|
|
4546
|
-
path: [
|
|
4547
|
-
...params.path,
|
|
4548
|
-
"properties",
|
|
4549
|
-
key
|
|
4550
|
-
]
|
|
4551
|
-
});
|
|
4552
|
-
const allKeys = new Set(Object.keys(shape));
|
|
4553
|
-
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
4554
|
-
const v = def.shape[key]._zod;
|
|
4555
|
-
if (ctx.io === "input") return v.optin === void 0;
|
|
4556
|
-
else return v.optout === void 0;
|
|
4557
|
-
}));
|
|
4558
|
-
if (requiredKeys.size > 0) json.required = Array.from(requiredKeys);
|
|
4559
|
-
if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
|
|
4560
|
-
else if (!def.catchall) {
|
|
4561
|
-
if (ctx.io === "output") json.additionalProperties = false;
|
|
4562
|
-
} else if (def.catchall) json.additionalProperties = process$1(def.catchall, ctx, {
|
|
4563
|
-
...params,
|
|
4564
|
-
path: [...params.path, "additionalProperties"]
|
|
4565
|
-
});
|
|
4566
|
-
};
|
|
4567
|
-
const unionProcessor = (schema, ctx, json, params) => {
|
|
4568
|
-
const def = schema._zod.def;
|
|
4569
|
-
const isExclusive = def.inclusive === false;
|
|
4570
|
-
const options = def.options.map((x, i) => process$1(x, ctx, {
|
|
4571
|
-
...params,
|
|
4572
|
-
path: [
|
|
4573
|
-
...params.path,
|
|
4574
|
-
isExclusive ? "oneOf" : "anyOf",
|
|
4575
|
-
i
|
|
4576
|
-
]
|
|
4577
|
-
}));
|
|
4578
|
-
if (isExclusive) json.oneOf = options;
|
|
4579
|
-
else json.anyOf = options;
|
|
4580
|
-
};
|
|
4581
|
-
const intersectionProcessor = (schema, ctx, json, params) => {
|
|
4582
|
-
const def = schema._zod.def;
|
|
4583
|
-
const a = process$1(def.left, ctx, {
|
|
4584
|
-
...params,
|
|
4585
|
-
path: [
|
|
4586
|
-
...params.path,
|
|
4587
|
-
"allOf",
|
|
4588
|
-
0
|
|
4589
|
-
]
|
|
4590
|
-
});
|
|
4591
|
-
const b = process$1(def.right, ctx, {
|
|
4592
|
-
...params,
|
|
4593
|
-
path: [
|
|
4594
|
-
...params.path,
|
|
4595
|
-
"allOf",
|
|
4596
|
-
1
|
|
4597
|
-
]
|
|
4598
|
-
});
|
|
4599
|
-
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
4600
|
-
json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
|
|
4601
|
-
};
|
|
4602
|
-
const recordProcessor = (schema, ctx, _json, params) => {
|
|
4603
|
-
const json = _json;
|
|
4604
|
-
const def = schema._zod.def;
|
|
4605
|
-
json.type = "object";
|
|
4606
|
-
const keyType = def.keyType;
|
|
4607
|
-
const patterns = keyType._zod.bag?.patterns;
|
|
4608
|
-
if (def.mode === "loose" && patterns && patterns.size > 0) {
|
|
4609
|
-
const valueSchema = process$1(def.valueType, ctx, {
|
|
4610
|
-
...params,
|
|
4611
|
-
path: [
|
|
4612
|
-
...params.path,
|
|
4613
|
-
"patternProperties",
|
|
4614
|
-
"*"
|
|
4615
|
-
]
|
|
4616
|
-
});
|
|
4617
|
-
json.patternProperties = {};
|
|
4618
|
-
for (const pattern of patterns) json.patternProperties[pattern.source] = valueSchema;
|
|
4619
|
-
} else {
|
|
4620
|
-
if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") json.propertyNames = process$1(def.keyType, ctx, {
|
|
4621
|
-
...params,
|
|
4622
|
-
path: [...params.path, "propertyNames"]
|
|
4623
|
-
});
|
|
4624
|
-
json.additionalProperties = process$1(def.valueType, ctx, {
|
|
4625
|
-
...params,
|
|
4626
|
-
path: [...params.path, "additionalProperties"]
|
|
4627
|
-
});
|
|
4628
|
-
}
|
|
4629
|
-
const keyValues = keyType._zod.values;
|
|
4630
|
-
if (keyValues) {
|
|
4631
|
-
const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
|
|
4632
|
-
if (validKeyValues.length > 0) json.required = validKeyValues;
|
|
4633
|
-
}
|
|
4634
|
-
};
|
|
4635
|
-
const nullableProcessor = (schema, ctx, json, params) => {
|
|
4636
|
-
const def = schema._zod.def;
|
|
4637
|
-
const inner = process$1(def.innerType, ctx, params);
|
|
4638
|
-
const seen = ctx.seen.get(schema);
|
|
4639
|
-
if (ctx.target === "openapi-3.0") {
|
|
4640
|
-
seen.ref = def.innerType;
|
|
4641
|
-
json.nullable = true;
|
|
4642
|
-
} else json.anyOf = [inner, { type: "null" }];
|
|
4643
|
-
};
|
|
4644
|
-
const nonoptionalProcessor = (schema, ctx, _json, params) => {
|
|
4645
|
-
const def = schema._zod.def;
|
|
4646
|
-
process$1(def.innerType, ctx, params);
|
|
4647
|
-
const seen = ctx.seen.get(schema);
|
|
4648
|
-
seen.ref = def.innerType;
|
|
4649
|
-
};
|
|
4650
|
-
const defaultProcessor = (schema, ctx, json, params) => {
|
|
4651
|
-
const def = schema._zod.def;
|
|
4652
|
-
process$1(def.innerType, ctx, params);
|
|
4653
|
-
const seen = ctx.seen.get(schema);
|
|
4654
|
-
seen.ref = def.innerType;
|
|
4655
|
-
json.default = JSON.parse(JSON.stringify(def.defaultValue));
|
|
4656
|
-
};
|
|
4657
|
-
const prefaultProcessor = (schema, ctx, json, params) => {
|
|
4658
|
-
const def = schema._zod.def;
|
|
4659
|
-
process$1(def.innerType, ctx, params);
|
|
4660
|
-
const seen = ctx.seen.get(schema);
|
|
4661
|
-
seen.ref = def.innerType;
|
|
4662
|
-
if (ctx.io === "input") json._prefault = JSON.parse(JSON.stringify(def.defaultValue));
|
|
4663
|
-
};
|
|
4664
|
-
const catchProcessor = (schema, ctx, json, params) => {
|
|
4665
|
-
const def = schema._zod.def;
|
|
4666
|
-
process$1(def.innerType, ctx, params);
|
|
4667
|
-
const seen = ctx.seen.get(schema);
|
|
4668
|
-
seen.ref = def.innerType;
|
|
4669
|
-
let catchValue;
|
|
4670
|
-
try {
|
|
4671
|
-
catchValue = def.catchValue(void 0);
|
|
4672
|
-
} catch {
|
|
4673
|
-
throw new Error("Dynamic catch values are not supported in JSON Schema");
|
|
4674
|
-
}
|
|
4675
|
-
json.default = catchValue;
|
|
4676
|
-
};
|
|
4677
|
-
const pipeProcessor = (schema, ctx, _json, params) => {
|
|
4678
|
-
const def = schema._zod.def;
|
|
4679
|
-
const inIsTransform = def.in._zod.traits.has("$ZodTransform");
|
|
4680
|
-
const innerType = ctx.io === "input" ? inIsTransform ? def.out : def.in : def.out;
|
|
4681
|
-
process$1(innerType, ctx, params);
|
|
4682
|
-
const seen = ctx.seen.get(schema);
|
|
4683
|
-
seen.ref = innerType;
|
|
4684
|
-
};
|
|
4685
|
-
const readonlyProcessor = (schema, ctx, json, params) => {
|
|
4686
|
-
const def = schema._zod.def;
|
|
4687
|
-
process$1(def.innerType, ctx, params);
|
|
4688
|
-
const seen = ctx.seen.get(schema);
|
|
4689
|
-
seen.ref = def.innerType;
|
|
4690
|
-
json.readOnly = true;
|
|
4691
|
-
};
|
|
4692
|
-
const optionalProcessor = (schema, ctx, _json, params) => {
|
|
4693
|
-
const def = schema._zod.def;
|
|
4694
|
-
process$1(def.innerType, ctx, params);
|
|
4695
|
-
const seen = ctx.seen.get(schema);
|
|
4696
|
-
seen.ref = def.innerType;
|
|
4697
|
-
};
|
|
4698
|
-
//#endregion
|
|
4699
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/iso.js
|
|
4700
|
-
const ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
|
|
4701
|
-
$ZodISODateTime.init(inst, def);
|
|
4702
|
-
ZodStringFormat.init(inst, def);
|
|
4703
|
-
});
|
|
4704
|
-
function datetime(params) {
|
|
4705
|
-
return /* @__PURE__ */ _isoDateTime(ZodISODateTime, params);
|
|
4706
|
-
}
|
|
4707
|
-
const ZodISODate = /* @__PURE__ */ $constructor("ZodISODate", (inst, def) => {
|
|
4708
|
-
$ZodISODate.init(inst, def);
|
|
4709
|
-
ZodStringFormat.init(inst, def);
|
|
4710
|
-
});
|
|
4711
|
-
function date(params) {
|
|
4712
|
-
return /* @__PURE__ */ _isoDate(ZodISODate, params);
|
|
4713
|
-
}
|
|
4714
|
-
const ZodISOTime = /* @__PURE__ */ $constructor("ZodISOTime", (inst, def) => {
|
|
4715
|
-
$ZodISOTime.init(inst, def);
|
|
4716
|
-
ZodStringFormat.init(inst, def);
|
|
4717
|
-
});
|
|
4718
|
-
function time(params) {
|
|
4719
|
-
return /* @__PURE__ */ _isoTime(ZodISOTime, params);
|
|
4720
|
-
}
|
|
4721
|
-
const ZodISODuration = /* @__PURE__ */ $constructor("ZodISODuration", (inst, def) => {
|
|
4722
|
-
$ZodISODuration.init(inst, def);
|
|
4723
|
-
ZodStringFormat.init(inst, def);
|
|
4724
|
-
});
|
|
4725
|
-
function duration(params) {
|
|
4726
|
-
return /* @__PURE__ */ _isoDuration(ZodISODuration, params);
|
|
4727
|
-
}
|
|
4728
|
-
//#endregion
|
|
4729
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.js
|
|
4730
|
-
const initializer = (inst, issues) => {
|
|
4731
|
-
$ZodError.init(inst, issues);
|
|
4732
|
-
inst.name = "ZodError";
|
|
4733
|
-
Object.defineProperties(inst, {
|
|
4734
|
-
format: { value: (mapper) => formatError(inst, mapper) },
|
|
4735
|
-
flatten: { value: (mapper) => flattenError(inst, mapper) },
|
|
4736
|
-
addIssue: { value: (issue) => {
|
|
4737
|
-
inst.issues.push(issue);
|
|
4738
|
-
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
4739
|
-
} },
|
|
4740
|
-
addIssues: { value: (issues) => {
|
|
4741
|
-
inst.issues.push(...issues);
|
|
4742
|
-
inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
|
|
4743
|
-
} },
|
|
4744
|
-
isEmpty: { get() {
|
|
4745
|
-
return inst.issues.length === 0;
|
|
4746
|
-
} }
|
|
4747
|
-
});
|
|
4748
|
-
};
|
|
4749
|
-
const ZodRealError = /* @__PURE__ */ $constructor("ZodError", initializer, { Parent: Error });
|
|
4750
|
-
//#endregion
|
|
4751
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/parse.js
|
|
4752
|
-
const parse = /* @__PURE__ */ _parse(ZodRealError);
|
|
4753
|
-
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
4754
|
-
const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
4755
|
-
const safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
4756
|
-
const encode = /* @__PURE__ */ _encode(ZodRealError);
|
|
4757
|
-
const decode = /* @__PURE__ */ _decode(ZodRealError);
|
|
4758
|
-
const encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
|
|
4759
|
-
const decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
|
|
4760
|
-
const safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
|
|
4761
|
-
const safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
4762
|
-
const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
4763
|
-
const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
4764
|
-
//#endregion
|
|
4765
|
-
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/schemas.js
|
|
4766
|
-
const _installedGroups = /* @__PURE__ */ new WeakMap();
|
|
4767
|
-
function _installLazyMethods(inst, group, methods) {
|
|
4768
|
-
const proto = Object.getPrototypeOf(inst);
|
|
4769
|
-
let installed = _installedGroups.get(proto);
|
|
4770
|
-
if (!installed) {
|
|
4771
|
-
installed = /* @__PURE__ */ new Set();
|
|
4772
|
-
_installedGroups.set(proto, installed);
|
|
4773
|
-
}
|
|
4774
|
-
if (installed.has(group)) return;
|
|
4775
|
-
installed.add(group);
|
|
4776
|
-
for (const key in methods) {
|
|
4777
|
-
const fn = methods[key];
|
|
4778
|
-
Object.defineProperty(proto, key, {
|
|
4779
|
-
configurable: true,
|
|
4780
|
-
enumerable: false,
|
|
4781
|
-
get() {
|
|
4782
|
-
const bound = fn.bind(this);
|
|
4783
|
-
Object.defineProperty(this, key, {
|
|
4784
|
-
configurable: true,
|
|
4785
|
-
writable: true,
|
|
4786
|
-
enumerable: true,
|
|
4787
|
-
value: bound
|
|
4788
|
-
});
|
|
4789
|
-
return bound;
|
|
4790
|
-
},
|
|
4791
|
-
set(v) {
|
|
4792
|
-
Object.defineProperty(this, key, {
|
|
4793
|
-
configurable: true,
|
|
4794
|
-
writable: true,
|
|
4795
|
-
enumerable: true,
|
|
4796
|
-
value: v
|
|
4797
|
-
});
|
|
4798
|
-
}
|
|
4799
|
-
});
|
|
4800
|
-
}
|
|
4801
|
-
}
|
|
4802
|
-
const ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
4803
|
-
$ZodType.init(inst, def);
|
|
4804
|
-
Object.assign(inst["~standard"], { jsonSchema: {
|
|
4805
|
-
input: createStandardJSONSchemaMethod(inst, "input"),
|
|
4806
|
-
output: createStandardJSONSchemaMethod(inst, "output")
|
|
4807
|
-
} });
|
|
4808
|
-
inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
|
|
4809
|
-
inst.def = def;
|
|
4810
|
-
inst.type = def.type;
|
|
4811
|
-
Object.defineProperty(inst, "_def", { value: def });
|
|
4812
|
-
inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
|
|
4813
|
-
inst.safeParse = (data, params) => safeParse(inst, data, params);
|
|
4814
|
-
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
4815
|
-
inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
|
|
4816
|
-
inst.spa = inst.safeParseAsync;
|
|
4817
|
-
inst.encode = (data, params) => encode(inst, data, params);
|
|
4818
|
-
inst.decode = (data, params) => decode(inst, data, params);
|
|
4819
|
-
inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
|
|
4820
|
-
inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
|
|
4821
|
-
inst.safeEncode = (data, params) => safeEncode(inst, data, params);
|
|
4822
|
-
inst.safeDecode = (data, params) => safeDecode(inst, data, params);
|
|
4823
|
-
inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
|
|
4824
|
-
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
|
|
4825
|
-
_installLazyMethods(inst, "ZodType", {
|
|
4826
|
-
check(...chks) {
|
|
4827
|
-
const def = this.def;
|
|
4828
|
-
return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
|
|
4829
|
-
check: ch,
|
|
4830
|
-
def: { check: "custom" },
|
|
4831
|
-
onattach: []
|
|
4832
|
-
} } : ch)] }), { parent: true });
|
|
4833
|
-
},
|
|
4834
|
-
with(...chks) {
|
|
4835
|
-
return this.check(...chks);
|
|
4836
|
-
},
|
|
4837
|
-
clone(def, params) {
|
|
4838
|
-
return clone$1(this, def, params);
|
|
4839
|
-
},
|
|
4840
|
-
brand() {
|
|
4841
|
-
return this;
|
|
4842
|
-
},
|
|
4843
|
-
register(reg, meta) {
|
|
4844
|
-
reg.add(this, meta);
|
|
4845
|
-
return this;
|
|
4846
|
-
},
|
|
4847
|
-
refine(check, params) {
|
|
4848
|
-
return this.check(refine(check, params));
|
|
4849
|
-
},
|
|
4850
|
-
superRefine(refinement, params) {
|
|
4851
|
-
return this.check(superRefine(refinement, params));
|
|
4852
|
-
},
|
|
4853
|
-
overwrite(fn) {
|
|
4854
|
-
return this.check(/* @__PURE__ */ _overwrite(fn));
|
|
4855
|
-
},
|
|
4856
|
-
optional() {
|
|
4857
|
-
return optional(this);
|
|
4858
|
-
},
|
|
4859
|
-
exactOptional() {
|
|
4860
|
-
return exactOptional(this);
|
|
4861
|
-
},
|
|
4862
|
-
nullable() {
|
|
4863
|
-
return nullable(this);
|
|
4864
|
-
},
|
|
4865
|
-
nullish() {
|
|
4866
|
-
return optional(nullable(this));
|
|
4867
|
-
},
|
|
4868
|
-
nonoptional(params) {
|
|
4869
|
-
return nonoptional(this, params);
|
|
4870
|
-
},
|
|
4871
|
-
array() {
|
|
4872
|
-
return array(this);
|
|
4873
|
-
},
|
|
4874
|
-
or(arg) {
|
|
4875
|
-
return union([this, arg]);
|
|
4876
|
-
},
|
|
4877
|
-
and(arg) {
|
|
4878
|
-
return intersection(this, arg);
|
|
4879
|
-
},
|
|
4880
|
-
transform(tx) {
|
|
4881
|
-
return pipe(this, transform(tx));
|
|
4882
|
-
},
|
|
4883
|
-
default(d) {
|
|
4884
|
-
return _default(this, d);
|
|
4885
|
-
},
|
|
4886
|
-
prefault(d) {
|
|
4887
|
-
return prefault(this, d);
|
|
4888
|
-
},
|
|
4889
|
-
catch(params) {
|
|
4890
|
-
return _catch(this, params);
|
|
4891
|
-
},
|
|
4892
|
-
pipe(target) {
|
|
4893
|
-
return pipe(this, target);
|
|
4894
|
-
},
|
|
4895
|
-
readonly() {
|
|
4896
|
-
return readonly(this);
|
|
4897
|
-
},
|
|
4898
|
-
describe(description) {
|
|
4899
|
-
const cl = this.clone();
|
|
4900
|
-
globalRegistry.add(cl, { description });
|
|
4901
|
-
return cl;
|
|
4902
|
-
},
|
|
4903
|
-
meta(...args) {
|
|
4904
|
-
if (args.length === 0) return globalRegistry.get(this);
|
|
4905
|
-
const cl = this.clone();
|
|
4906
|
-
globalRegistry.add(cl, args[0]);
|
|
4907
|
-
return cl;
|
|
4908
|
-
},
|
|
4909
|
-
isOptional() {
|
|
4910
|
-
return this.safeParse(void 0).success;
|
|
4911
|
-
},
|
|
4912
|
-
isNullable() {
|
|
4913
|
-
return this.safeParse(null).success;
|
|
4914
|
-
},
|
|
4915
|
-
apply(fn) {
|
|
4916
|
-
return fn(this);
|
|
4917
|
-
}
|
|
4918
|
-
});
|
|
4919
|
-
Object.defineProperty(inst, "description", {
|
|
4920
|
-
get() {
|
|
4921
|
-
return globalRegistry.get(inst)?.description;
|
|
4922
|
-
},
|
|
4923
|
-
configurable: true
|
|
4924
|
-
});
|
|
4925
|
-
return inst;
|
|
4926
|
-
});
|
|
4927
|
-
/** @internal */
|
|
4928
|
-
const _ZodString = /* @__PURE__ */ $constructor("_ZodString", (inst, def) => {
|
|
4929
|
-
$ZodString.init(inst, def);
|
|
4930
|
-
ZodType.init(inst, def);
|
|
4931
|
-
inst._zod.processJSONSchema = (ctx, json, params) => stringProcessor(inst, ctx, json, params);
|
|
4932
|
-
const bag = inst._zod.bag;
|
|
4933
|
-
inst.format = bag.format ?? null;
|
|
4934
|
-
inst.minLength = bag.minimum ?? null;
|
|
4935
|
-
inst.maxLength = bag.maximum ?? null;
|
|
4936
|
-
_installLazyMethods(inst, "_ZodString", {
|
|
4937
|
-
regex(...args) {
|
|
4938
|
-
return this.check(/* @__PURE__ */ _regex(...args));
|
|
4939
|
-
},
|
|
4940
|
-
includes(...args) {
|
|
4941
|
-
return this.check(/* @__PURE__ */ _includes(...args));
|
|
4942
|
-
},
|
|
4943
|
-
startsWith(...args) {
|
|
4944
|
-
return this.check(/* @__PURE__ */ _startsWith(...args));
|
|
4945
|
-
},
|
|
4946
|
-
endsWith(...args) {
|
|
4947
|
-
return this.check(/* @__PURE__ */ _endsWith(...args));
|
|
4948
|
-
},
|
|
4949
|
-
min(...args) {
|
|
4950
|
-
return this.check(/* @__PURE__ */ _minLength(...args));
|
|
4951
|
-
},
|
|
4952
|
-
max(...args) {
|
|
4953
|
-
return this.check(/* @__PURE__ */ _maxLength(...args));
|
|
4954
|
-
},
|
|
4955
|
-
length(...args) {
|
|
4956
|
-
return this.check(/* @__PURE__ */ _length(...args));
|
|
4957
|
-
},
|
|
4958
|
-
nonempty(...args) {
|
|
4959
|
-
return this.check(/* @__PURE__ */ _minLength(1, ...args));
|
|
4960
|
-
},
|
|
4961
|
-
lowercase(params) {
|
|
4962
|
-
return this.check(/* @__PURE__ */ _lowercase(params));
|
|
4963
|
-
},
|
|
4964
|
-
uppercase(params) {
|
|
4965
|
-
return this.check(/* @__PURE__ */ _uppercase(params));
|
|
4966
|
-
},
|
|
4967
|
-
trim() {
|
|
4968
|
-
return this.check(/* @__PURE__ */ _trim());
|
|
4969
|
-
},
|
|
4970
|
-
normalize(...args) {
|
|
4971
|
-
return this.check(/* @__PURE__ */ _normalize(...args));
|
|
4972
|
-
},
|
|
4973
|
-
toLowerCase() {
|
|
4974
|
-
return this.check(/* @__PURE__ */ _toLowerCase());
|
|
4975
|
-
},
|
|
4976
|
-
toUpperCase() {
|
|
4977
|
-
return this.check(/* @__PURE__ */ _toUpperCase());
|
|
4978
|
-
},
|
|
4979
|
-
slugify() {
|
|
4980
|
-
return this.check(/* @__PURE__ */ _slugify());
|
|
4981
|
-
}
|
|
4982
|
-
});
|
|
4983
|
-
});
|
|
4984
|
-
const ZodString = /* @__PURE__ */ $constructor("ZodString", (inst, def) => {
|
|
4985
|
-
$ZodString.init(inst, def);
|
|
4986
|
-
_ZodString.init(inst, def);
|
|
4987
|
-
inst.email = (params) => inst.check(/* @__PURE__ */ _email(ZodEmail, params));
|
|
4988
|
-
inst.url = (params) => inst.check(/* @__PURE__ */ _url(ZodURL, params));
|
|
4989
|
-
inst.jwt = (params) => inst.check(/* @__PURE__ */ _jwt(ZodJWT, params));
|
|
4990
|
-
inst.emoji = (params) => inst.check(/* @__PURE__ */ _emoji(ZodEmoji, params));
|
|
4991
|
-
inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
|
|
4992
|
-
inst.uuid = (params) => inst.check(/* @__PURE__ */ _uuid(ZodUUID, params));
|
|
4993
|
-
inst.uuidv4 = (params) => inst.check(/* @__PURE__ */ _uuidv4(ZodUUID, params));
|
|
4994
|
-
inst.uuidv6 = (params) => inst.check(/* @__PURE__ */ _uuidv6(ZodUUID, params));
|
|
4995
|
-
inst.uuidv7 = (params) => inst.check(/* @__PURE__ */ _uuidv7(ZodUUID, params));
|
|
4996
|
-
inst.nanoid = (params) => inst.check(/* @__PURE__ */ _nanoid(ZodNanoID, params));
|
|
4997
|
-
inst.guid = (params) => inst.check(/* @__PURE__ */ _guid(ZodGUID, params));
|
|
4998
|
-
inst.cuid = (params) => inst.check(/* @__PURE__ */ _cuid(ZodCUID, params));
|
|
4999
|
-
inst.cuid2 = (params) => inst.check(/* @__PURE__ */ _cuid2(ZodCUID2, params));
|
|
5000
|
-
inst.ulid = (params) => inst.check(/* @__PURE__ */ _ulid(ZodULID, params));
|
|
5001
|
-
inst.base64 = (params) => inst.check(/* @__PURE__ */ _base64(ZodBase64, params));
|
|
5002
|
-
inst.base64url = (params) => inst.check(/* @__PURE__ */ _base64url(ZodBase64URL, params));
|
|
5003
|
-
inst.xid = (params) => inst.check(/* @__PURE__ */ _xid(ZodXID, params));
|
|
5004
|
-
inst.ksuid = (params) => inst.check(/* @__PURE__ */ _ksuid(ZodKSUID, params));
|
|
5005
|
-
inst.ipv4 = (params) => inst.check(/* @__PURE__ */ _ipv4(ZodIPv4, params));
|
|
5006
|
-
inst.ipv6 = (params) => inst.check(/* @__PURE__ */ _ipv6(ZodIPv6, params));
|
|
5007
|
-
inst.cidrv4 = (params) => inst.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params));
|
|
5008
|
-
inst.cidrv6 = (params) => inst.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
|
|
5009
|
-
inst.e164 = (params) => inst.check(/* @__PURE__ */ _e164(ZodE164, params));
|
|
5010
|
-
inst.datetime = (params) => inst.check(datetime(params));
|
|
5011
|
-
inst.date = (params) => inst.check(date(params));
|
|
5012
|
-
inst.time = (params) => inst.check(time(params));
|
|
5013
|
-
inst.duration = (params) => inst.check(duration(params));
|
|
5014
|
-
});
|
|
5015
|
-
function string(params) {
|
|
5016
|
-
return /* @__PURE__ */ _string(ZodString, params);
|
|
5017
|
-
}
|
|
5018
|
-
const ZodStringFormat = /* @__PURE__ */ $constructor("ZodStringFormat", (inst, def) => {
|
|
5019
|
-
$ZodStringFormat.init(inst, def);
|
|
5020
|
-
_ZodString.init(inst, def);
|
|
5021
|
-
});
|
|
5022
|
-
const ZodEmail = /* @__PURE__ */ $constructor("ZodEmail", (inst, def) => {
|
|
5023
|
-
$ZodEmail.init(inst, def);
|
|
5024
|
-
ZodStringFormat.init(inst, def);
|
|
5025
|
-
});
|
|
5026
|
-
const ZodGUID = /* @__PURE__ */ $constructor("ZodGUID", (inst, def) => {
|
|
5027
|
-
$ZodGUID.init(inst, def);
|
|
5028
|
-
ZodStringFormat.init(inst, def);
|
|
5029
|
-
});
|
|
5030
|
-
const ZodUUID = /* @__PURE__ */ $constructor("ZodUUID", (inst, def) => {
|
|
5031
|
-
$ZodUUID.init(inst, def);
|
|
5032
|
-
ZodStringFormat.init(inst, def);
|
|
5033
|
-
});
|
|
5034
|
-
const ZodURL = /* @__PURE__ */ $constructor("ZodURL", (inst, def) => {
|
|
5035
|
-
$ZodURL.init(inst, def);
|
|
5036
|
-
ZodStringFormat.init(inst, def);
|
|
5037
|
-
});
|
|
5038
|
-
const ZodEmoji = /* @__PURE__ */ $constructor("ZodEmoji", (inst, def) => {
|
|
5039
|
-
$ZodEmoji.init(inst, def);
|
|
5040
|
-
ZodStringFormat.init(inst, def);
|
|
5041
|
-
});
|
|
5042
|
-
const ZodNanoID = /* @__PURE__ */ $constructor("ZodNanoID", (inst, def) => {
|
|
5043
|
-
$ZodNanoID.init(inst, def);
|
|
5044
|
-
ZodStringFormat.init(inst, def);
|
|
5045
|
-
});
|
|
5046
|
-
/**
|
|
5047
|
-
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
5048
|
-
* (timestamps embedded in the id). Use {@link ZodCUID2} instead.
|
|
5049
|
-
* See https://github.com/paralleldrive/cuid.
|
|
5050
|
-
*/
|
|
5051
|
-
const ZodCUID = /* @__PURE__ */ $constructor("ZodCUID", (inst, def) => {
|
|
5052
|
-
$ZodCUID.init(inst, def);
|
|
5053
|
-
ZodStringFormat.init(inst, def);
|
|
5054
|
-
});
|
|
5055
|
-
const ZodCUID2 = /* @__PURE__ */ $constructor("ZodCUID2", (inst, def) => {
|
|
5056
|
-
$ZodCUID2.init(inst, def);
|
|
5057
|
-
ZodStringFormat.init(inst, def);
|
|
5058
|
-
});
|
|
5059
|
-
const ZodULID = /* @__PURE__ */ $constructor("ZodULID", (inst, def) => {
|
|
5060
|
-
$ZodULID.init(inst, def);
|
|
5061
|
-
ZodStringFormat.init(inst, def);
|
|
5062
|
-
});
|
|
5063
|
-
const ZodXID = /* @__PURE__ */ $constructor("ZodXID", (inst, def) => {
|
|
5064
|
-
$ZodXID.init(inst, def);
|
|
5065
|
-
ZodStringFormat.init(inst, def);
|
|
5066
|
-
});
|
|
5067
|
-
const ZodKSUID = /* @__PURE__ */ $constructor("ZodKSUID", (inst, def) => {
|
|
5068
|
-
$ZodKSUID.init(inst, def);
|
|
5069
|
-
ZodStringFormat.init(inst, def);
|
|
5070
|
-
});
|
|
5071
|
-
const ZodIPv4 = /* @__PURE__ */ $constructor("ZodIPv4", (inst, def) => {
|
|
5072
|
-
$ZodIPv4.init(inst, def);
|
|
5073
|
-
ZodStringFormat.init(inst, def);
|
|
5074
|
-
});
|
|
5075
|
-
const ZodIPv6 = /* @__PURE__ */ $constructor("ZodIPv6", (inst, def) => {
|
|
5076
|
-
$ZodIPv6.init(inst, def);
|
|
5077
|
-
ZodStringFormat.init(inst, def);
|
|
5078
|
-
});
|
|
5079
|
-
const ZodCIDRv4 = /* @__PURE__ */ $constructor("ZodCIDRv4", (inst, def) => {
|
|
5080
|
-
$ZodCIDRv4.init(inst, def);
|
|
5081
|
-
ZodStringFormat.init(inst, def);
|
|
5082
|
-
});
|
|
5083
|
-
const ZodCIDRv6 = /* @__PURE__ */ $constructor("ZodCIDRv6", (inst, def) => {
|
|
5084
|
-
$ZodCIDRv6.init(inst, def);
|
|
5085
|
-
ZodStringFormat.init(inst, def);
|
|
5086
|
-
});
|
|
5087
|
-
const ZodBase64 = /* @__PURE__ */ $constructor("ZodBase64", (inst, def) => {
|
|
5088
|
-
$ZodBase64.init(inst, def);
|
|
5089
|
-
ZodStringFormat.init(inst, def);
|
|
5090
|
-
});
|
|
5091
|
-
const ZodBase64URL = /* @__PURE__ */ $constructor("ZodBase64URL", (inst, def) => {
|
|
5092
|
-
$ZodBase64URL.init(inst, def);
|
|
5093
|
-
ZodStringFormat.init(inst, def);
|
|
5094
|
-
});
|
|
5095
|
-
const ZodE164 = /* @__PURE__ */ $constructor("ZodE164", (inst, def) => {
|
|
5096
|
-
$ZodE164.init(inst, def);
|
|
5097
|
-
ZodStringFormat.init(inst, def);
|
|
5098
|
-
});
|
|
5099
|
-
const ZodJWT = /* @__PURE__ */ $constructor("ZodJWT", (inst, def) => {
|
|
5100
|
-
$ZodJWT.init(inst, def);
|
|
5101
|
-
ZodStringFormat.init(inst, def);
|
|
5102
|
-
});
|
|
5103
|
-
const ZodNumber = /* @__PURE__ */ $constructor("ZodNumber", (inst, def) => {
|
|
5104
|
-
$ZodNumber.init(inst, def);
|
|
5105
|
-
ZodType.init(inst, def);
|
|
5106
|
-
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
5107
|
-
_installLazyMethods(inst, "ZodNumber", {
|
|
5108
|
-
gt(value, params) {
|
|
5109
|
-
return this.check(/* @__PURE__ */ _gt(value, params));
|
|
5110
|
-
},
|
|
5111
|
-
gte(value, params) {
|
|
5112
|
-
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
5113
|
-
},
|
|
5114
|
-
min(value, params) {
|
|
5115
|
-
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
5116
|
-
},
|
|
5117
|
-
lt(value, params) {
|
|
5118
|
-
return this.check(/* @__PURE__ */ _lt(value, params));
|
|
5119
|
-
},
|
|
5120
|
-
lte(value, params) {
|
|
5121
|
-
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
5122
|
-
},
|
|
5123
|
-
max(value, params) {
|
|
5124
|
-
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
5125
|
-
},
|
|
5126
|
-
int(params) {
|
|
5127
|
-
return this.check(int(params));
|
|
5128
|
-
},
|
|
5129
|
-
safe(params) {
|
|
5130
|
-
return this.check(int(params));
|
|
5131
|
-
},
|
|
5132
|
-
positive(params) {
|
|
5133
|
-
return this.check(/* @__PURE__ */ _gt(0, params));
|
|
5134
|
-
},
|
|
5135
|
-
nonnegative(params) {
|
|
5136
|
-
return this.check(/* @__PURE__ */ _gte(0, params));
|
|
5137
|
-
},
|
|
5138
|
-
negative(params) {
|
|
5139
|
-
return this.check(/* @__PURE__ */ _lt(0, params));
|
|
5140
|
-
},
|
|
5141
|
-
nonpositive(params) {
|
|
5142
|
-
return this.check(/* @__PURE__ */ _lte(0, params));
|
|
5143
|
-
},
|
|
5144
|
-
multipleOf(value, params) {
|
|
5145
|
-
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
5146
|
-
},
|
|
5147
|
-
step(value, params) {
|
|
5148
|
-
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
5149
|
-
},
|
|
5150
|
-
finite() {
|
|
5151
|
-
return this;
|
|
5152
|
-
}
|
|
5153
|
-
});
|
|
5154
|
-
const bag = inst._zod.bag;
|
|
5155
|
-
inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
5156
|
-
inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
|
|
5157
|
-
inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5);
|
|
5158
|
-
inst.isFinite = true;
|
|
5159
|
-
inst.format = bag.format ?? null;
|
|
5160
|
-
});
|
|
5161
|
-
function number$1(params) {
|
|
5162
|
-
return /* @__PURE__ */ _number(ZodNumber, params);
|
|
5163
|
-
}
|
|
5164
|
-
const ZodNumberFormat = /* @__PURE__ */ $constructor("ZodNumberFormat", (inst, def) => {
|
|
5165
|
-
$ZodNumberFormat.init(inst, def);
|
|
5166
|
-
ZodNumber.init(inst, def);
|
|
5167
|
-
});
|
|
5168
|
-
function int(params) {
|
|
5169
|
-
return /* @__PURE__ */ _int(ZodNumberFormat, params);
|
|
5170
|
-
}
|
|
5171
|
-
const ZodBoolean = /* @__PURE__ */ $constructor("ZodBoolean", (inst, def) => {
|
|
5172
|
-
$ZodBoolean.init(inst, def);
|
|
5173
|
-
ZodType.init(inst, def);
|
|
5174
|
-
inst._zod.processJSONSchema = (ctx, json, params) => booleanProcessor(inst, ctx, json, params);
|
|
5175
|
-
});
|
|
5176
|
-
function boolean(params) {
|
|
5177
|
-
return /* @__PURE__ */ _boolean(ZodBoolean, params);
|
|
5178
|
-
}
|
|
5179
|
-
const ZodUnknown = /* @__PURE__ */ $constructor("ZodUnknown", (inst, def) => {
|
|
5180
|
-
$ZodUnknown.init(inst, def);
|
|
5181
|
-
ZodType.init(inst, def);
|
|
5182
|
-
inst._zod.processJSONSchema = (ctx, json, params) => void 0;
|
|
5183
|
-
});
|
|
5184
|
-
function unknown() {
|
|
5185
|
-
return /* @__PURE__ */ _unknown(ZodUnknown);
|
|
5186
|
-
}
|
|
5187
|
-
const ZodNever = /* @__PURE__ */ $constructor("ZodNever", (inst, def) => {
|
|
5188
|
-
$ZodNever.init(inst, def);
|
|
5189
|
-
ZodType.init(inst, def);
|
|
5190
|
-
inst._zod.processJSONSchema = (ctx, json, params) => neverProcessor(inst, ctx, json, params);
|
|
5191
|
-
});
|
|
5192
|
-
function never(params) {
|
|
5193
|
-
return /* @__PURE__ */ _never(ZodNever, params);
|
|
5194
|
-
}
|
|
5195
|
-
const ZodArray = /* @__PURE__ */ $constructor("ZodArray", (inst, def) => {
|
|
5196
|
-
$ZodArray.init(inst, def);
|
|
5197
|
-
ZodType.init(inst, def);
|
|
5198
|
-
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
5199
|
-
inst.element = def.element;
|
|
5200
|
-
_installLazyMethods(inst, "ZodArray", {
|
|
5201
|
-
min(n, params) {
|
|
5202
|
-
return this.check(/* @__PURE__ */ _minLength(n, params));
|
|
5203
|
-
},
|
|
5204
|
-
nonempty(params) {
|
|
5205
|
-
return this.check(/* @__PURE__ */ _minLength(1, params));
|
|
5206
|
-
},
|
|
5207
|
-
max(n, params) {
|
|
5208
|
-
return this.check(/* @__PURE__ */ _maxLength(n, params));
|
|
5209
|
-
},
|
|
5210
|
-
length(n, params) {
|
|
5211
|
-
return this.check(/* @__PURE__ */ _length(n, params));
|
|
5212
|
-
},
|
|
5213
|
-
unwrap() {
|
|
5214
|
-
return this.element;
|
|
5215
|
-
}
|
|
5216
|
-
});
|
|
5217
|
-
});
|
|
5218
|
-
function array(element, params) {
|
|
5219
|
-
return /* @__PURE__ */ _array(ZodArray, element, params);
|
|
5220
|
-
}
|
|
5221
|
-
const ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
5222
|
-
$ZodObjectJIT.init(inst, def);
|
|
5223
|
-
ZodType.init(inst, def);
|
|
5224
|
-
inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
|
|
5225
|
-
defineLazy(inst, "shape", () => {
|
|
5226
|
-
return def.shape;
|
|
5227
|
-
});
|
|
5228
|
-
_installLazyMethods(inst, "ZodObject", {
|
|
5229
|
-
keyof() {
|
|
5230
|
-
return _enum(Object.keys(this._zod.def.shape));
|
|
5231
|
-
},
|
|
5232
|
-
catchall(catchall) {
|
|
5233
|
-
return this.clone({
|
|
5234
|
-
...this._zod.def,
|
|
5235
|
-
catchall
|
|
5236
|
-
});
|
|
5237
|
-
},
|
|
5238
|
-
passthrough() {
|
|
5239
|
-
return this.clone({
|
|
5240
|
-
...this._zod.def,
|
|
5241
|
-
catchall: unknown()
|
|
5242
|
-
});
|
|
5243
|
-
},
|
|
5244
|
-
loose() {
|
|
5245
|
-
return this.clone({
|
|
5246
|
-
...this._zod.def,
|
|
5247
|
-
catchall: unknown()
|
|
5248
|
-
});
|
|
5249
|
-
},
|
|
5250
|
-
strict() {
|
|
5251
|
-
return this.clone({
|
|
5252
|
-
...this._zod.def,
|
|
5253
|
-
catchall: never()
|
|
5254
|
-
});
|
|
5255
|
-
},
|
|
5256
|
-
strip() {
|
|
5257
|
-
return this.clone({
|
|
5258
|
-
...this._zod.def,
|
|
5259
|
-
catchall: void 0
|
|
5260
|
-
});
|
|
5261
|
-
},
|
|
5262
|
-
extend(incoming) {
|
|
5263
|
-
return extend(this, incoming);
|
|
5264
|
-
},
|
|
5265
|
-
safeExtend(incoming) {
|
|
5266
|
-
return safeExtend(this, incoming);
|
|
5267
|
-
},
|
|
5268
|
-
merge(other) {
|
|
5269
|
-
return merge(this, other);
|
|
5270
|
-
},
|
|
5271
|
-
pick(mask) {
|
|
5272
|
-
return pick(this, mask);
|
|
5273
|
-
},
|
|
5274
|
-
omit(mask) {
|
|
5275
|
-
return omit(this, mask);
|
|
5276
|
-
},
|
|
5277
|
-
partial(...args) {
|
|
5278
|
-
return partial(ZodOptional, this, args[0]);
|
|
5279
|
-
},
|
|
5280
|
-
required(...args) {
|
|
5281
|
-
return required(ZodNonOptional, this, args[0]);
|
|
5282
|
-
}
|
|
5283
|
-
});
|
|
5284
|
-
});
|
|
5285
|
-
function object(shape, params) {
|
|
5286
|
-
return new ZodObject({
|
|
5287
|
-
type: "object",
|
|
5288
|
-
shape: shape ?? {},
|
|
5289
|
-
...normalizeParams(params)
|
|
5290
|
-
});
|
|
5291
|
-
}
|
|
5292
|
-
const ZodUnion = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
5293
|
-
$ZodUnion.init(inst, def);
|
|
5294
|
-
ZodType.init(inst, def);
|
|
5295
|
-
inst._zod.processJSONSchema = (ctx, json, params) => unionProcessor(inst, ctx, json, params);
|
|
5296
|
-
inst.options = def.options;
|
|
5297
|
-
});
|
|
5298
|
-
function union(options, params) {
|
|
5299
|
-
return new ZodUnion({
|
|
5300
|
-
type: "union",
|
|
5301
|
-
options,
|
|
5302
|
-
...normalizeParams(params)
|
|
5303
|
-
});
|
|
5304
|
-
}
|
|
5305
|
-
const ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("ZodDiscriminatedUnion", (inst, def) => {
|
|
5306
|
-
ZodUnion.init(inst, def);
|
|
5307
|
-
$ZodDiscriminatedUnion.init(inst, def);
|
|
5308
|
-
});
|
|
5309
|
-
function discriminatedUnion(discriminator, options, params) {
|
|
5310
|
-
return new ZodDiscriminatedUnion({
|
|
5311
|
-
type: "union",
|
|
5312
|
-
options,
|
|
5313
|
-
discriminator,
|
|
5314
|
-
...normalizeParams(params)
|
|
5315
|
-
});
|
|
5316
|
-
}
|
|
5317
|
-
const ZodIntersection = /* @__PURE__ */ $constructor("ZodIntersection", (inst, def) => {
|
|
5318
|
-
$ZodIntersection.init(inst, def);
|
|
5319
|
-
ZodType.init(inst, def);
|
|
5320
|
-
inst._zod.processJSONSchema = (ctx, json, params) => intersectionProcessor(inst, ctx, json, params);
|
|
5321
|
-
});
|
|
5322
|
-
function intersection(left, right) {
|
|
5323
|
-
return new ZodIntersection({
|
|
5324
|
-
type: "intersection",
|
|
5325
|
-
left,
|
|
5326
|
-
right
|
|
5327
|
-
});
|
|
5328
|
-
}
|
|
5329
|
-
const ZodRecord = /* @__PURE__ */ $constructor("ZodRecord", (inst, def) => {
|
|
5330
|
-
$ZodRecord.init(inst, def);
|
|
5331
|
-
ZodType.init(inst, def);
|
|
5332
|
-
inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
|
|
5333
|
-
inst.keyType = def.keyType;
|
|
5334
|
-
inst.valueType = def.valueType;
|
|
5335
|
-
});
|
|
5336
|
-
function record(keyType, valueType, params) {
|
|
5337
|
-
if (!valueType || !valueType._zod) return new ZodRecord({
|
|
5338
|
-
type: "record",
|
|
5339
|
-
keyType: string(),
|
|
5340
|
-
valueType: keyType,
|
|
5341
|
-
...normalizeParams(valueType)
|
|
5342
|
-
});
|
|
5343
|
-
return new ZodRecord({
|
|
5344
|
-
type: "record",
|
|
5345
|
-
keyType,
|
|
5346
|
-
valueType,
|
|
5347
|
-
...normalizeParams(params)
|
|
5348
|
-
});
|
|
5349
|
-
}
|
|
5350
|
-
const ZodEnum = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
5351
|
-
$ZodEnum.init(inst, def);
|
|
5352
|
-
ZodType.init(inst, def);
|
|
5353
|
-
inst._zod.processJSONSchema = (ctx, json, params) => enumProcessor(inst, ctx, json, params);
|
|
5354
|
-
inst.enum = def.entries;
|
|
5355
|
-
inst.options = Object.values(def.entries);
|
|
5356
|
-
const keys = new Set(Object.keys(def.entries));
|
|
5357
|
-
inst.extract = (values, params) => {
|
|
5358
|
-
const newEntries = {};
|
|
5359
|
-
for (const value of values) if (keys.has(value)) newEntries[value] = def.entries[value];
|
|
5360
|
-
else throw new Error(`Key ${value} not found in enum`);
|
|
5361
|
-
return new ZodEnum({
|
|
5362
|
-
...def,
|
|
5363
|
-
checks: [],
|
|
5364
|
-
...normalizeParams(params),
|
|
5365
|
-
entries: newEntries
|
|
5366
|
-
});
|
|
5367
|
-
};
|
|
5368
|
-
inst.exclude = (values, params) => {
|
|
5369
|
-
const newEntries = { ...def.entries };
|
|
5370
|
-
for (const value of values) if (keys.has(value)) delete newEntries[value];
|
|
5371
|
-
else throw new Error(`Key ${value} not found in enum`);
|
|
5372
|
-
return new ZodEnum({
|
|
5373
|
-
...def,
|
|
5374
|
-
checks: [],
|
|
5375
|
-
...normalizeParams(params),
|
|
5376
|
-
entries: newEntries
|
|
5377
|
-
});
|
|
5378
|
-
};
|
|
5379
|
-
});
|
|
5380
|
-
function _enum(values, params) {
|
|
5381
|
-
return new ZodEnum({
|
|
5382
|
-
type: "enum",
|
|
5383
|
-
entries: Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values,
|
|
5384
|
-
...normalizeParams(params)
|
|
5385
|
-
});
|
|
5386
|
-
}
|
|
5387
|
-
const ZodLiteral = /* @__PURE__ */ $constructor("ZodLiteral", (inst, def) => {
|
|
5388
|
-
$ZodLiteral.init(inst, def);
|
|
5389
|
-
ZodType.init(inst, def);
|
|
5390
|
-
inst._zod.processJSONSchema = (ctx, json, params) => literalProcessor(inst, ctx, json, params);
|
|
5391
|
-
inst.values = new Set(def.values);
|
|
5392
|
-
Object.defineProperty(inst, "value", { get() {
|
|
5393
|
-
if (def.values.length > 1) throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");
|
|
5394
|
-
return def.values[0];
|
|
5395
|
-
} });
|
|
5396
|
-
});
|
|
5397
|
-
function literal(value, params) {
|
|
5398
|
-
return new ZodLiteral({
|
|
5399
|
-
type: "literal",
|
|
5400
|
-
values: Array.isArray(value) ? value : [value],
|
|
5401
|
-
...normalizeParams(params)
|
|
5402
|
-
});
|
|
5403
|
-
}
|
|
5404
|
-
const ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
5405
|
-
$ZodTransform.init(inst, def);
|
|
5406
|
-
ZodType.init(inst, def);
|
|
5407
|
-
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
5408
|
-
inst._zod.parse = (payload, _ctx) => {
|
|
5409
|
-
if (_ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
5410
|
-
payload.addIssue = (issue$1) => {
|
|
5411
|
-
if (typeof issue$1 === "string") payload.issues.push(issue(issue$1, payload.value, def));
|
|
5412
|
-
else {
|
|
5413
|
-
const _issue = issue$1;
|
|
5414
|
-
if (_issue.fatal) _issue.continue = false;
|
|
5415
|
-
_issue.code ?? (_issue.code = "custom");
|
|
5416
|
-
_issue.input ?? (_issue.input = payload.value);
|
|
5417
|
-
_issue.inst ?? (_issue.inst = inst);
|
|
5418
|
-
payload.issues.push(issue(_issue));
|
|
5419
|
-
}
|
|
5420
|
-
};
|
|
5421
|
-
const output = def.transform(payload.value, payload);
|
|
5422
|
-
if (output instanceof Promise) return output.then((output) => {
|
|
5423
|
-
payload.value = output;
|
|
5424
|
-
payload.fallback = true;
|
|
5425
|
-
return payload;
|
|
5426
|
-
});
|
|
5427
|
-
payload.value = output;
|
|
5428
|
-
payload.fallback = true;
|
|
5429
|
-
return payload;
|
|
5430
|
-
};
|
|
5431
|
-
});
|
|
5432
|
-
function transform(fn) {
|
|
5433
|
-
return new ZodTransform({
|
|
5434
|
-
type: "transform",
|
|
5435
|
-
transform: fn
|
|
5436
|
-
});
|
|
5437
|
-
}
|
|
5438
|
-
const ZodOptional = /* @__PURE__ */ $constructor("ZodOptional", (inst, def) => {
|
|
5439
|
-
$ZodOptional.init(inst, def);
|
|
5440
|
-
ZodType.init(inst, def);
|
|
5441
|
-
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
5442
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
5443
|
-
});
|
|
5444
|
-
function optional(innerType) {
|
|
5445
|
-
return new ZodOptional({
|
|
5446
|
-
type: "optional",
|
|
5447
|
-
innerType
|
|
5448
|
-
});
|
|
5449
|
-
}
|
|
5450
|
-
const ZodExactOptional = /* @__PURE__ */ $constructor("ZodExactOptional", (inst, def) => {
|
|
5451
|
-
$ZodExactOptional.init(inst, def);
|
|
5452
|
-
ZodType.init(inst, def);
|
|
5453
|
-
inst._zod.processJSONSchema = (ctx, json, params) => optionalProcessor(inst, ctx, json, params);
|
|
5454
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
5455
|
-
});
|
|
5456
|
-
function exactOptional(innerType) {
|
|
5457
|
-
return new ZodExactOptional({
|
|
5458
|
-
type: "optional",
|
|
5459
|
-
innerType
|
|
5460
|
-
});
|
|
5461
|
-
}
|
|
5462
|
-
const ZodNullable = /* @__PURE__ */ $constructor("ZodNullable", (inst, def) => {
|
|
5463
|
-
$ZodNullable.init(inst, def);
|
|
5464
|
-
ZodType.init(inst, def);
|
|
5465
|
-
inst._zod.processJSONSchema = (ctx, json, params) => nullableProcessor(inst, ctx, json, params);
|
|
5466
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
5467
|
-
});
|
|
5468
|
-
function nullable(innerType) {
|
|
5469
|
-
return new ZodNullable({
|
|
5470
|
-
type: "nullable",
|
|
5471
|
-
innerType
|
|
5472
|
-
});
|
|
5473
|
-
}
|
|
5474
|
-
const ZodDefault = /* @__PURE__ */ $constructor("ZodDefault", (inst, def) => {
|
|
5475
|
-
$ZodDefault.init(inst, def);
|
|
5476
|
-
ZodType.init(inst, def);
|
|
5477
|
-
inst._zod.processJSONSchema = (ctx, json, params) => defaultProcessor(inst, ctx, json, params);
|
|
5478
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
5479
|
-
inst.removeDefault = inst.unwrap;
|
|
5480
|
-
});
|
|
5481
|
-
function _default(innerType, defaultValue) {
|
|
5482
|
-
return new ZodDefault({
|
|
5483
|
-
type: "default",
|
|
5484
|
-
innerType,
|
|
5485
|
-
get defaultValue() {
|
|
5486
|
-
return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
|
|
5487
|
-
}
|
|
5488
|
-
});
|
|
5489
|
-
}
|
|
5490
|
-
const ZodPrefault = /* @__PURE__ */ $constructor("ZodPrefault", (inst, def) => {
|
|
5491
|
-
$ZodPrefault.init(inst, def);
|
|
5492
|
-
ZodType.init(inst, def);
|
|
5493
|
-
inst._zod.processJSONSchema = (ctx, json, params) => prefaultProcessor(inst, ctx, json, params);
|
|
5494
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
5495
|
-
});
|
|
5496
|
-
function prefault(innerType, defaultValue) {
|
|
5497
|
-
return new ZodPrefault({
|
|
5498
|
-
type: "prefault",
|
|
5499
|
-
innerType,
|
|
5500
|
-
get defaultValue() {
|
|
5501
|
-
return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
|
|
5502
|
-
}
|
|
5503
|
-
});
|
|
5504
|
-
}
|
|
5505
|
-
const ZodNonOptional = /* @__PURE__ */ $constructor("ZodNonOptional", (inst, def) => {
|
|
5506
|
-
$ZodNonOptional.init(inst, def);
|
|
5507
|
-
ZodType.init(inst, def);
|
|
5508
|
-
inst._zod.processJSONSchema = (ctx, json, params) => nonoptionalProcessor(inst, ctx, json, params);
|
|
5509
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
5510
|
-
});
|
|
5511
|
-
function nonoptional(innerType, params) {
|
|
5512
|
-
return new ZodNonOptional({
|
|
5513
|
-
type: "nonoptional",
|
|
5514
|
-
innerType,
|
|
5515
|
-
...normalizeParams(params)
|
|
5516
|
-
});
|
|
5517
|
-
}
|
|
5518
|
-
const ZodCatch = /* @__PURE__ */ $constructor("ZodCatch", (inst, def) => {
|
|
5519
|
-
$ZodCatch.init(inst, def);
|
|
5520
|
-
ZodType.init(inst, def);
|
|
5521
|
-
inst._zod.processJSONSchema = (ctx, json, params) => catchProcessor(inst, ctx, json, params);
|
|
5522
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
5523
|
-
inst.removeCatch = inst.unwrap;
|
|
5524
|
-
});
|
|
5525
|
-
function _catch(innerType, catchValue) {
|
|
5526
|
-
return new ZodCatch({
|
|
5527
|
-
type: "catch",
|
|
5528
|
-
innerType,
|
|
5529
|
-
catchValue: typeof catchValue === "function" ? catchValue : () => catchValue
|
|
5530
|
-
});
|
|
5531
|
-
}
|
|
5532
|
-
const ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
|
|
5533
|
-
$ZodPipe.init(inst, def);
|
|
5534
|
-
ZodType.init(inst, def);
|
|
5535
|
-
inst._zod.processJSONSchema = (ctx, json, params) => pipeProcessor(inst, ctx, json, params);
|
|
5536
|
-
inst.in = def.in;
|
|
5537
|
-
inst.out = def.out;
|
|
5538
|
-
});
|
|
5539
|
-
function pipe(in_, out) {
|
|
5540
|
-
return new ZodPipe({
|
|
5541
|
-
type: "pipe",
|
|
5542
|
-
in: in_,
|
|
5543
|
-
out
|
|
5544
|
-
});
|
|
5545
|
-
}
|
|
5546
|
-
const ZodReadonly = /* @__PURE__ */ $constructor("ZodReadonly", (inst, def) => {
|
|
5547
|
-
$ZodReadonly.init(inst, def);
|
|
5548
|
-
ZodType.init(inst, def);
|
|
5549
|
-
inst._zod.processJSONSchema = (ctx, json, params) => readonlyProcessor(inst, ctx, json, params);
|
|
5550
|
-
inst.unwrap = () => inst._zod.def.innerType;
|
|
5551
|
-
});
|
|
5552
|
-
function readonly(innerType) {
|
|
5553
|
-
return new ZodReadonly({
|
|
5554
|
-
type: "readonly",
|
|
5555
|
-
innerType
|
|
5556
|
-
});
|
|
5557
|
-
}
|
|
5558
|
-
const ZodCustom = /* @__PURE__ */ $constructor("ZodCustom", (inst, def) => {
|
|
5559
|
-
$ZodCustom.init(inst, def);
|
|
5560
|
-
ZodType.init(inst, def);
|
|
5561
|
-
inst._zod.processJSONSchema = (ctx, json, params) => customProcessor(inst, ctx, json, params);
|
|
5562
|
-
});
|
|
5563
|
-
function refine(fn, _params = {}) {
|
|
5564
|
-
return /* @__PURE__ */ _refine(ZodCustom, fn, _params);
|
|
5565
|
-
}
|
|
5566
|
-
function superRefine(fn, params) {
|
|
5567
|
-
return /* @__PURE__ */ _superRefine(fn, params);
|
|
5568
|
-
}
|
|
5569
|
-
//#endregion
|
|
5570
1294
|
//#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/coerce.js
|
|
5571
1295
|
function number(params) {
|
|
5572
|
-
return
|
|
1296
|
+
return _coercedNumber(ZodNumber, params);
|
|
5573
1297
|
}
|
|
5574
1298
|
//#endregion
|
|
5575
1299
|
//#region ../../packages/shared/dist/index.mjs
|
|
@@ -6302,6 +2026,12 @@ const CredentialScopeLevelSchema = _enum([
|
|
|
6302
2026
|
CredentialAuthKindSchema.options;
|
|
6303
2027
|
CredentialScopeTypeSchema.options;
|
|
6304
2028
|
CredentialScopeLevelSchema.options;
|
|
2029
|
+
function isCredentialInput(value) {
|
|
2030
|
+
if (typeof value !== "object" || value === null) return false;
|
|
2031
|
+
const candidate = value;
|
|
2032
|
+
return typeof candidate.key === "string" && CredentialAuthKindSchema.safeParse(candidate.kind).success && candidate.schema instanceof ZodType;
|
|
2033
|
+
}
|
|
2034
|
+
custom((value) => isCredentialInput(value), "must be a credential requirement");
|
|
6305
2035
|
const OrganizationSlugErrorCodeSchema = _enum([
|
|
6306
2036
|
"slug_taken",
|
|
6307
2037
|
"slug_reserved",
|
|
@@ -11849,7 +7579,7 @@ function registerCredentialsCommand(program) {
|
|
|
11849
7579
|
/** OAuth device-flow client id for `keystroke auth login`. */
|
|
11850
7580
|
const CLI_CLIENT_ID = "keystroke-cli";
|
|
11851
7581
|
//#endregion
|
|
11852
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.
|
|
7582
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.25_crossws@0.4.5_srvx@0.11.15__react-dom_58475d05a96f62cc1b6c1cd2acbead1f/node_modules/better-auth/dist/version.mjs
|
|
11853
7583
|
const PACKAGE_VERSION = "1.6.11";
|
|
11854
7584
|
//#endregion
|
|
11855
7585
|
//#region ../../node_modules/.pnpm/better-call@1.3.5_zod@4.4.3/node_modules/better-call/dist/error.mjs
|
|
@@ -11974,7 +7704,7 @@ var BetterAuthError = class extends Error {
|
|
|
11974
7704
|
}
|
|
11975
7705
|
};
|
|
11976
7706
|
//#endregion
|
|
11977
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.
|
|
7707
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.25_crossws@0.4.5_srvx@0.11.15__react-dom_58475d05a96f62cc1b6c1cd2acbead1f/node_modules/better-auth/dist/plugins/device-authorization/client.mjs
|
|
11978
7708
|
const deviceAuthorizationClient = () => {
|
|
11979
7709
|
return {
|
|
11980
7710
|
id: "device-authorization",
|
|
@@ -12119,7 +7849,7 @@ let onMount = ($store, initialize) => {
|
|
|
12119
7849
|
});
|
|
12120
7850
|
};
|
|
12121
7851
|
//#endregion
|
|
12122
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.
|
|
7852
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.25_crossws@0.4.5_srvx@0.11.15__react-dom_58475d05a96f62cc1b6c1cd2acbead1f/node_modules/better-auth/dist/client/query.mjs
|
|
12123
7853
|
const isServer = () => typeof window === "undefined";
|
|
12124
7854
|
const useAuthQuery = (initializedAtom, path, $fetch, options) => {
|
|
12125
7855
|
const value = /* @__PURE__ */ atom({
|
|
@@ -12213,7 +7943,7 @@ const useAuthQuery = (initializedAtom, path, $fetch, options) => {
|
|
|
12213
7943
|
return value;
|
|
12214
7944
|
};
|
|
12215
7945
|
//#endregion
|
|
12216
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.
|
|
7946
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.25_crossws@0.4.5_srvx@0.11.15__react-dom_58475d05a96f62cc1b6c1cd2acbead1f/node_modules/better-auth/dist/client/broadcast-channel.mjs
|
|
12217
7947
|
const kBroadcastChannel = Symbol.for("better-auth:broadcast-channel");
|
|
12218
7948
|
const now$1 = () => Math.floor(Date.now() / 1e3);
|
|
12219
7949
|
var WindowBroadcastChannel = class {
|
|
@@ -12256,7 +7986,7 @@ function getGlobalBroadcastChannel(name = "better-auth.message") {
|
|
|
12256
7986
|
return globalThis[kBroadcastChannel];
|
|
12257
7987
|
}
|
|
12258
7988
|
//#endregion
|
|
12259
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.
|
|
7989
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.25_crossws@0.4.5_srvx@0.11.15__react-dom_58475d05a96f62cc1b6c1cd2acbead1f/node_modules/better-auth/dist/client/focus-manager.mjs
|
|
12260
7990
|
const kFocusManager = Symbol.for("better-auth:focus-manager");
|
|
12261
7991
|
var WindowFocusManager = class {
|
|
12262
7992
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -12285,7 +8015,7 @@ function getGlobalFocusManager() {
|
|
|
12285
8015
|
return globalThis[kFocusManager];
|
|
12286
8016
|
}
|
|
12287
8017
|
//#endregion
|
|
12288
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.
|
|
8018
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.25_crossws@0.4.5_srvx@0.11.15__react-dom_58475d05a96f62cc1b6c1cd2acbead1f/node_modules/better-auth/dist/client/online-manager.mjs
|
|
12289
8019
|
const kOnlineManager = Symbol.for("better-auth:online-manager");
|
|
12290
8020
|
var WindowOnlineManager = class {
|
|
12291
8021
|
listeners = /* @__PURE__ */ new Set();
|
|
@@ -12317,7 +8047,7 @@ function getGlobalOnlineManager() {
|
|
|
12317
8047
|
return globalThis[kOnlineManager];
|
|
12318
8048
|
}
|
|
12319
8049
|
//#endregion
|
|
12320
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.
|
|
8050
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.25_crossws@0.4.5_srvx@0.11.15__react-dom_58475d05a96f62cc1b6c1cd2acbead1f/node_modules/better-auth/dist/client/parser.mjs
|
|
12321
8051
|
const PROTO_POLLUTION_PATTERNS = {
|
|
12322
8052
|
proto: /"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,
|
|
12323
8053
|
constructor: /"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,
|
|
@@ -12387,7 +8117,7 @@ function parseJSON(value, options = { strict: true }) {
|
|
|
12387
8117
|
return betterJSONParse(value, options);
|
|
12388
8118
|
}
|
|
12389
8119
|
//#endregion
|
|
12390
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.
|
|
8120
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.25_crossws@0.4.5_srvx@0.11.15__react-dom_58475d05a96f62cc1b6c1cd2acbead1f/node_modules/better-auth/dist/client/session-refresh.mjs
|
|
12391
8121
|
const now = () => Math.floor(Date.now() / 1e3);
|
|
12392
8122
|
/**
|
|
12393
8123
|
* Normalize $fetch response: `throw: true` returns data directly, otherwise `{ data, error }`.
|
|
@@ -12585,7 +8315,7 @@ Object.freeze({
|
|
|
12585
8315
|
}
|
|
12586
8316
|
});
|
|
12587
8317
|
//#endregion
|
|
12588
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.
|
|
8318
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.25_crossws@0.4.5_srvx@0.11.15__react-dom_58475d05a96f62cc1b6c1cd2acbead1f/node_modules/better-auth/dist/utils/url.mjs
|
|
12589
8319
|
function checkHasPath(url) {
|
|
12590
8320
|
try {
|
|
12591
8321
|
return (new URL(url).pathname.replace(/\/+$/, "") || "/") !== "/";
|
|
@@ -12657,7 +8387,7 @@ function getOrigin(url) {
|
|
|
12657
8387
|
}
|
|
12658
8388
|
}
|
|
12659
8389
|
//#endregion
|
|
12660
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.
|
|
8390
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.25_crossws@0.4.5_srvx@0.11.15__react-dom_58475d05a96f62cc1b6c1cd2acbead1f/node_modules/better-auth/dist/client/fetch-plugins.mjs
|
|
12661
8391
|
const redirectPlugin = {
|
|
12662
8392
|
id: "redirect",
|
|
12663
8393
|
name: "Redirect",
|
|
@@ -12672,7 +8402,7 @@ const redirectPlugin = {
|
|
|
12672
8402
|
} }
|
|
12673
8403
|
};
|
|
12674
8404
|
//#endregion
|
|
12675
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.
|
|
8405
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.25_crossws@0.4.5_srvx@0.11.15__react-dom_58475d05a96f62cc1b6c1cd2acbead1f/node_modules/better-auth/dist/client/session-atom.mjs
|
|
12676
8406
|
function getSessionAtom($fetch, options) {
|
|
12677
8407
|
const $signal = /* @__PURE__ */ atom(false);
|
|
12678
8408
|
const session = useAuthQuery($signal, "/get-session", $fetch, { method: "GET" });
|
|
@@ -13159,7 +8889,7 @@ var betterFetch = async (url, options) => {
|
|
|
13159
8889
|
};
|
|
13160
8890
|
};
|
|
13161
8891
|
//#endregion
|
|
13162
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.
|
|
8892
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.25_crossws@0.4.5_srvx@0.11.15__react-dom_58475d05a96f62cc1b6c1cd2acbead1f/node_modules/better-auth/dist/client/config.mjs
|
|
13163
8893
|
const resolvePublicAuthUrl = (basePath) => {
|
|
13164
8894
|
if (typeof process === "undefined") return void 0;
|
|
13165
8895
|
const path = basePath ?? "/api/auth";
|
|
@@ -13257,12 +8987,12 @@ const getClientConfig = (options, loadEnv) => {
|
|
|
13257
8987
|
};
|
|
13258
8988
|
};
|
|
13259
8989
|
//#endregion
|
|
13260
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.
|
|
8990
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.25_crossws@0.4.5_srvx@0.11.15__react-dom_58475d05a96f62cc1b6c1cd2acbead1f/node_modules/better-auth/dist/utils/is-atom.mjs
|
|
13261
8991
|
function isAtom(value) {
|
|
13262
8992
|
return typeof value === "object" && value !== null && "get" in value && typeof value.get === "function" && "lc" in value && typeof value.lc === "number";
|
|
13263
8993
|
}
|
|
13264
8994
|
//#endregion
|
|
13265
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.
|
|
8995
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.25_crossws@0.4.5_srvx@0.11.15__react-dom_58475d05a96f62cc1b6c1cd2acbead1f/node_modules/better-auth/dist/client/proxy.mjs
|
|
13266
8996
|
function getMethod(path, knownPathMethods, args) {
|
|
13267
8997
|
const method = knownPathMethods[path];
|
|
13268
8998
|
const { fetchOptions, query: _query, ...body } = args || {};
|
|
@@ -13342,7 +9072,7 @@ function capitalizeFirstLetter(str) {
|
|
|
13342
9072
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
13343
9073
|
}
|
|
13344
9074
|
//#endregion
|
|
13345
|
-
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.
|
|
9075
|
+
//#region ../../node_modules/.pnpm/better-auth@1.6.11_@tanstack+react-start@1.168.25_crossws@0.4.5_srvx@0.11.15__react-dom_58475d05a96f62cc1b6c1cd2acbead1f/node_modules/better-auth/dist/client/vanilla.mjs
|
|
13346
9076
|
function createAuthClient(options) {
|
|
13347
9077
|
const { pluginPathMethods, pluginsActions, pluginsAtoms, $fetch, atomListeners, $store } = getClientConfig(options);
|
|
13348
9078
|
const resolvedHooks = {};
|
|
@@ -13524,7 +9254,7 @@ function registerBuildCommand(program) {
|
|
|
13524
9254
|
program.command("build").description("Build the keystroke project for production").option("--dir <path>", "Project directory", process.cwd()).action(async (options) => {
|
|
13525
9255
|
try {
|
|
13526
9256
|
const root = resolveProjectRoot(options.dir);
|
|
13527
|
-
const { buildApp } = await import("./dist-
|
|
9257
|
+
const { buildApp } = await import("./dist-D1ip549D.mjs");
|
|
13528
9258
|
await buildApp({ root });
|
|
13529
9259
|
process.stdout.write(`Built ${root}\n`);
|
|
13530
9260
|
} catch (error) {
|
|
@@ -13580,7 +9310,7 @@ async function runDeploy(options) {
|
|
|
13580
9310
|
const config = createCliConfig();
|
|
13581
9311
|
const client = createCliPlatformClient(config);
|
|
13582
9312
|
if (!options.skipBuild) {
|
|
13583
|
-
const { buildApp } = await import("./dist-
|
|
9313
|
+
const { buildApp } = await import("./dist-D1ip549D.mjs");
|
|
13584
9314
|
await buildApp({ root });
|
|
13585
9315
|
}
|
|
13586
9316
|
const archive = packProjectArtifact(root);
|
|
@@ -13671,7 +9401,7 @@ function runtimeChildEnv(parentEnv, overrides) {
|
|
|
13671
9401
|
//#region src/project/bootstrap-run.ts
|
|
13672
9402
|
/** Node args + env for `@keystrokehq/build` bootstrap (shared by start + dev). */
|
|
13673
9403
|
async function resolveBootstrapRun(options) {
|
|
13674
|
-
const { resolveRuntimeBuildArtifact } = await import("./dist-
|
|
9404
|
+
const { resolveRuntimeBuildArtifact } = await import("./dist-D1ip549D.mjs");
|
|
13675
9405
|
const loader = pathToFileURL(resolveRuntimeBuildArtifact(options.runtimeNodeModules, "dist/runtime-loader.mjs")).href;
|
|
13676
9406
|
const bootstrap = resolveRuntimeBuildArtifact(options.runtimeNodeModules, "dist/bootstrap.mjs");
|
|
13677
9407
|
const args = [`--import=${loader}`];
|
|
@@ -13691,21 +9421,6 @@ async function resolveBootstrapRun(options) {
|
|
|
13691
9421
|
};
|
|
13692
9422
|
}
|
|
13693
9423
|
//#endregion
|
|
13694
|
-
//#region src/project/resolve-cli-root.ts
|
|
13695
|
-
function isCliPackage(dir) {
|
|
13696
|
-
const packageJsonPath = join(dir, "package.json");
|
|
13697
|
-
if (!existsSync(packageJsonPath)) return false;
|
|
13698
|
-
return JSON.parse(readFileSync(packageJsonPath, "utf8")).name === "@keystrokehq/cli";
|
|
13699
|
-
}
|
|
13700
|
-
function resolveCliRoot(fromModuleUrl) {
|
|
13701
|
-
let dir = dirname(fileURLToPath(fromModuleUrl));
|
|
13702
|
-
while (dir !== dirname(dir)) {
|
|
13703
|
-
if (isCliPackage(dir)) return dir;
|
|
13704
|
-
dir = dirname(dir);
|
|
13705
|
-
}
|
|
13706
|
-
throw new Error("Could not resolve keystroke CLI package root");
|
|
13707
|
-
}
|
|
13708
|
-
//#endregion
|
|
13709
9424
|
//#region src/process/run-processes.ts
|
|
13710
9425
|
function waitForExit(child) {
|
|
13711
9426
|
return new Promise((resolve) => {
|
|
@@ -13836,7 +9551,7 @@ async function runDev(options) {
|
|
|
13836
9551
|
process.on("SIGINT", shutdown);
|
|
13837
9552
|
process.on("SIGTERM", shutdown);
|
|
13838
9553
|
try {
|
|
13839
|
-
const { watchApp } = await import("./dist-
|
|
9554
|
+
const { watchApp } = await import("./dist-D1ip549D.mjs");
|
|
13840
9555
|
await watchApp({
|
|
13841
9556
|
root,
|
|
13842
9557
|
clean: false,
|
|
@@ -13872,71 +9587,6 @@ function registerHealthCommand(program) {
|
|
|
13872
9587
|
}));
|
|
13873
9588
|
}
|
|
13874
9589
|
//#endregion
|
|
13875
|
-
//#region src/init/package-manager.ts
|
|
13876
|
-
const MANAGERS = [
|
|
13877
|
-
"pnpm",
|
|
13878
|
-
"npm",
|
|
13879
|
-
"yarn",
|
|
13880
|
-
"bun"
|
|
13881
|
-
];
|
|
13882
|
-
function detectPackageManager() {
|
|
13883
|
-
const userAgent = process.env.npm_config_user_agent ?? "";
|
|
13884
|
-
for (const manager of MANAGERS) if (userAgent.startsWith(manager)) return manager;
|
|
13885
|
-
if (process.env.PNPM_HOME) return "pnpm";
|
|
13886
|
-
return "npm";
|
|
13887
|
-
}
|
|
13888
|
-
function resolvePackageManager(explicit) {
|
|
13889
|
-
if (!explicit) return detectPackageManager();
|
|
13890
|
-
const normalized = explicit.trim().toLowerCase();
|
|
13891
|
-
if (!MANAGERS.includes(normalized)) throw new Error(`Unsupported package manager "${explicit}". Use npm, pnpm, yarn, or bun.`);
|
|
13892
|
-
return normalized;
|
|
13893
|
-
}
|
|
13894
|
-
/** Resolve GitHub Packages auth for @keystrokehq/* when NODE_AUTH_TOKEN is unset. */
|
|
13895
|
-
function resolveGithubPackagesToken() {
|
|
13896
|
-
if (process.env.NODE_AUTH_TOKEN) return process.env.NODE_AUTH_TOKEN;
|
|
13897
|
-
for (const key of ["GITHUB_TOKEN", "GH_TOKEN"]) {
|
|
13898
|
-
const value = process.env[key];
|
|
13899
|
-
if (value) return value;
|
|
13900
|
-
}
|
|
13901
|
-
const gh = spawnSync("gh", ["auth", "token"], { encoding: "utf8" });
|
|
13902
|
-
if (gh.status === 0) {
|
|
13903
|
-
const token = gh.stdout.trim();
|
|
13904
|
-
if (token) return token;
|
|
13905
|
-
}
|
|
13906
|
-
}
|
|
13907
|
-
function installDependencies(cwd, manager) {
|
|
13908
|
-
const token = resolveGithubPackagesToken();
|
|
13909
|
-
if (spawnSync(manager, ["install"], {
|
|
13910
|
-
cwd,
|
|
13911
|
-
stdio: "inherit",
|
|
13912
|
-
env: token ? {
|
|
13913
|
-
...process.env,
|
|
13914
|
-
NODE_AUTH_TOKEN: token
|
|
13915
|
-
} : process.env
|
|
13916
|
-
}).status !== 0) throw new Error(`${manager} install failed`);
|
|
13917
|
-
}
|
|
13918
|
-
function installPlaygroundDependencies(cwd) {
|
|
13919
|
-
if (spawnSync("pnpm", ["install", "--ignore-workspace"], {
|
|
13920
|
-
cwd,
|
|
13921
|
-
stdio: "inherit",
|
|
13922
|
-
env: process.env
|
|
13923
|
-
}).status !== 0) throw new Error("pnpm install failed");
|
|
13924
|
-
}
|
|
13925
|
-
/**
|
|
13926
|
-
* Build every workspace package so the playground's `link:` deps resolve to
|
|
13927
|
-
* compiled `dist/`. Without this, `keystroke dev` fails with
|
|
13928
|
-
* `ERR_MODULE_NOT_FOUND` against whichever package was never built. Turbo
|
|
13929
|
-
* caches, so this is only slow on the first run.
|
|
13930
|
-
*/
|
|
13931
|
-
function buildPlaygroundWorkspace(monorepoRoot) {
|
|
13932
|
-
const { NODE_OPTIONS: _drop, ...buildEnv } = process.env;
|
|
13933
|
-
if (spawnSync("pnpm", ["run", "build"], {
|
|
13934
|
-
cwd: monorepoRoot,
|
|
13935
|
-
stdio: "inherit",
|
|
13936
|
-
env: buildEnv
|
|
13937
|
-
}).status !== 0) throw new Error("workspace build failed (pnpm run build)");
|
|
13938
|
-
}
|
|
13939
|
-
//#endregion
|
|
13940
9590
|
//#region src/init/project-name.ts
|
|
13941
9591
|
const KEBAB_CASE = /^[a-z][a-z0-9-]*$/;
|
|
13942
9592
|
const HAS_EMOJI = /\p{Extended_Pictographic}/u;
|
|
@@ -14191,12 +9841,6 @@ async function runInit(options) {
|
|
|
14191
9841
|
};
|
|
14192
9842
|
}
|
|
14193
9843
|
//#endregion
|
|
14194
|
-
//#region src/version.ts
|
|
14195
|
-
function readCliVersion() {
|
|
14196
|
-
const packageJsonPath = join(resolveCliRoot(import.meta.url), "package.json");
|
|
14197
|
-
return JSON.parse(readFileSync(packageJsonPath, "utf8")).version ?? "0.0.0";
|
|
14198
|
-
}
|
|
14199
|
-
//#endregion
|
|
14200
9844
|
//#region src/commands/init.ts
|
|
14201
9845
|
function registerInitCommand(program) {
|
|
14202
9846
|
program.command("init").description("Create a new keystroke project from a template").argument("[directory]", "Directory to create the project in").option("--name <name>", "Project name (kebab-case)").option("--template <name>", "Template to use", "hello-world").option("-y, --yes", "Skip prompts (headless mode for scripts and AI agents)").option("--skip-install", "Skip dependency installation").option("--pm <manager>", "Package manager: npm, pnpm, yarn, or bun").action(async (directory, options) => {
|
|
@@ -14302,7 +9946,7 @@ async function runStart(options) {
|
|
|
14302
9946
|
const apiPort = Number(new URL(serverUrl).port || 80);
|
|
14303
9947
|
const runtimeNodeModules = resolveCliRuntimeNodeModules(resolveCliRoot(import.meta.url));
|
|
14304
9948
|
ensureNativeDeps(runtimeNodeModules);
|
|
14305
|
-
const { buildApp } = await import("./dist-
|
|
9949
|
+
const { buildApp } = await import("./dist-D1ip549D.mjs");
|
|
14306
9950
|
await buildApp({
|
|
14307
9951
|
root,
|
|
14308
9952
|
clean: false
|
|
@@ -14535,13 +10179,15 @@ function createProgram() {
|
|
|
14535
10179
|
registerTriggerCommand(program);
|
|
14536
10180
|
return program;
|
|
14537
10181
|
}
|
|
14538
|
-
function runCli(argv) {
|
|
10182
|
+
async function runCli(argv) {
|
|
10183
|
+
const { maybeAutoUpdate } = await import("./maybe-auto-update-DCsPT080.mjs");
|
|
10184
|
+
await maybeAutoUpdate(argv);
|
|
14539
10185
|
createProgram().parse(argv);
|
|
14540
10186
|
}
|
|
14541
10187
|
//#endregion
|
|
14542
10188
|
//#region src/index.ts
|
|
14543
|
-
runCli(process.argv);
|
|
10189
|
+
await runCli(process.argv);
|
|
14544
10190
|
//#endregion
|
|
14545
|
-
export {
|
|
10191
|
+
export {};
|
|
14546
10192
|
|
|
14547
10193
|
//# sourceMappingURL=index.mjs.map
|