dsh-mcp-panel 0.6.12 → 0.6.13
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/CHANGELOG.md +7 -0
- package/lib/client.js +1886 -919
- package/lib/client.js.map +1 -1
- package/lib/index.js +2 -2
- package/lib/{schemas-BhI7GrM5.js → schemas-D2hn9ib3.js} +1898 -931
- package/lib/typert.host.js +1 -1
- package/package.json +9 -9
- package/src/probe.ts +1 -1
package/lib/client.js
CHANGED
|
@@ -1521,70 +1521,14 @@ window.__ModuleLoader__.load({
|
|
|
1521
1521
|
capPending: "Pending upstream support — the official client does not bridge this capability yet (tools are the only bridged MCP capability today)."
|
|
1522
1522
|
};
|
|
1523
1523
|
//#endregion
|
|
1524
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
1525
|
-
var _a$1;
|
|
1526
|
-
function $constructor(name, initializer, params) {
|
|
1527
|
-
function init(inst, def) {
|
|
1528
|
-
if (!inst._zod) Object.defineProperty(inst, "_zod", {
|
|
1529
|
-
value: {
|
|
1530
|
-
def,
|
|
1531
|
-
constr: _,
|
|
1532
|
-
traits: /* @__PURE__ */ new Set()
|
|
1533
|
-
},
|
|
1534
|
-
enumerable: false
|
|
1535
|
-
});
|
|
1536
|
-
if (inst._zod.traits.has(name)) return;
|
|
1537
|
-
inst._zod.traits.add(name);
|
|
1538
|
-
initializer(inst, def);
|
|
1539
|
-
const proto = _.prototype;
|
|
1540
|
-
const keys = Object.keys(proto);
|
|
1541
|
-
for (let i = 0; i < keys.length; i++) {
|
|
1542
|
-
const k = keys[i];
|
|
1543
|
-
if (!(k in inst)) inst[k] = proto[k].bind(inst);
|
|
1544
|
-
}
|
|
1545
|
-
}
|
|
1546
|
-
const Parent = params?.Parent ?? Object;
|
|
1547
|
-
class Definition extends Parent {}
|
|
1548
|
-
Object.defineProperty(Definition, "name", { value: name });
|
|
1549
|
-
function _(def) {
|
|
1550
|
-
var _a;
|
|
1551
|
-
const inst = params?.Parent ? new Definition() : this;
|
|
1552
|
-
init(inst, def);
|
|
1553
|
-
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
1554
|
-
for (const fn of inst._zod.deferred) fn();
|
|
1555
|
-
return inst;
|
|
1556
|
-
}
|
|
1557
|
-
Object.defineProperty(_, "init", { value: init });
|
|
1558
|
-
Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
|
|
1559
|
-
if (params?.Parent && inst instanceof params.Parent) return true;
|
|
1560
|
-
return inst?._zod?.traits?.has(name);
|
|
1561
|
-
} });
|
|
1562
|
-
Object.defineProperty(_, "name", { value: name });
|
|
1563
|
-
return _;
|
|
1564
|
-
}
|
|
1565
|
-
var $ZodAsyncError = class extends Error {
|
|
1566
|
-
constructor() {
|
|
1567
|
-
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
1568
|
-
}
|
|
1569
|
-
};
|
|
1570
|
-
var $ZodEncodeError = class extends Error {
|
|
1571
|
-
constructor(name) {
|
|
1572
|
-
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
1573
|
-
this.name = "ZodEncodeError";
|
|
1574
|
-
}
|
|
1575
|
-
};
|
|
1576
|
-
(_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
|
|
1577
|
-
const globalConfig = globalThis.__zod_globalConfig;
|
|
1578
|
-
function config(newConfig) {
|
|
1579
|
-
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
1580
|
-
return globalConfig;
|
|
1581
|
-
}
|
|
1582
|
-
//#endregion
|
|
1583
|
-
//#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.js
|
|
1524
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/util.js
|
|
1584
1525
|
function getEnumValues(entries) {
|
|
1585
1526
|
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
1586
1527
|
return Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
1587
1528
|
}
|
|
1529
|
+
function joinValues(array, separator = "|") {
|
|
1530
|
+
return array.map((val) => stringifyPrimitive(val)).join(separator);
|
|
1531
|
+
}
|
|
1588
1532
|
function jsonStringifyReplacer(_, value) {
|
|
1589
1533
|
if (typeof value === "bigint") return value.toString();
|
|
1590
1534
|
return value;
|
|
@@ -1609,28 +1553,10 @@ window.__ModuleLoader__.load({
|
|
|
1609
1553
|
function floatSafeRemainder(val, step) {
|
|
1610
1554
|
const ratio = val / step;
|
|
1611
1555
|
const roundedRatio = Math.round(ratio);
|
|
1612
|
-
const tolerance = Number.EPSILON * Math.max(Math.abs(ratio), 1);
|
|
1556
|
+
const tolerance = 4 * Number.EPSILON * Math.max(Math.abs(ratio), 1);
|
|
1613
1557
|
if (Math.abs(ratio - roundedRatio) < tolerance) return 0;
|
|
1614
1558
|
return ratio - roundedRatio;
|
|
1615
1559
|
}
|
|
1616
|
-
const EVALUATING = /* @__PURE__*/ Symbol("evaluating");
|
|
1617
|
-
function defineLazy(object, key, getter) {
|
|
1618
|
-
let value = void 0;
|
|
1619
|
-
Object.defineProperty(object, key, {
|
|
1620
|
-
get() {
|
|
1621
|
-
if (value === EVALUATING) return;
|
|
1622
|
-
if (value === void 0) {
|
|
1623
|
-
value = EVALUATING;
|
|
1624
|
-
value = getter();
|
|
1625
|
-
}
|
|
1626
|
-
return value;
|
|
1627
|
-
},
|
|
1628
|
-
set(v) {
|
|
1629
|
-
Object.defineProperty(object, key, { value: v });
|
|
1630
|
-
},
|
|
1631
|
-
configurable: true
|
|
1632
|
-
});
|
|
1633
|
-
}
|
|
1634
1560
|
function assignProp(target, prop, value) {
|
|
1635
1561
|
Object.defineProperty(target, prop, {
|
|
1636
1562
|
value,
|
|
@@ -1712,18 +1638,23 @@ window.__ModuleLoader__.load({
|
|
|
1712
1638
|
};
|
|
1713
1639
|
return params;
|
|
1714
1640
|
}
|
|
1641
|
+
function stringifyPrimitive(value) {
|
|
1642
|
+
if (typeof value === "bigint") return value.toString() + "n";
|
|
1643
|
+
if (typeof value === "string") return `"${value}"`;
|
|
1644
|
+
return `${value}`;
|
|
1645
|
+
}
|
|
1715
1646
|
function optionalKeys(shape) {
|
|
1716
1647
|
return Object.keys(shape).filter((k) => {
|
|
1717
|
-
return shape[k]._zod.optin
|
|
1648
|
+
return shape[k]._zod.optin !== void 0 && shape[k]._zod.optout === "optional";
|
|
1718
1649
|
});
|
|
1719
1650
|
}
|
|
1720
|
-
const NUMBER_FORMAT_RANGES = {
|
|
1651
|
+
const NUMBER_FORMAT_RANGES = /*@__PURE__*/ (() => ({
|
|
1721
1652
|
safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],
|
|
1722
1653
|
int32: [-2147483648, 2147483647],
|
|
1723
1654
|
uint32: [0, 4294967295],
|
|
1724
1655
|
float32: [-34028234663852886e22, 34028234663852886e22],
|
|
1725
1656
|
float64: [-Number.MAX_VALUE, Number.MAX_VALUE]
|
|
1726
|
-
};
|
|
1657
|
+
}))();
|
|
1727
1658
|
function pick(schema, mask) {
|
|
1728
1659
|
const currDef = schema._zod.def;
|
|
1729
1660
|
const checks = currDef.checks;
|
|
@@ -1731,10 +1662,10 @@ window.__ModuleLoader__.load({
|
|
|
1731
1662
|
return clone(schema, mergeDefs(schema._zod.def, {
|
|
1732
1663
|
get shape() {
|
|
1733
1664
|
const newShape = {};
|
|
1734
|
-
for (const key
|
|
1735
|
-
if (!(
|
|
1665
|
+
for (const key of Reflect.ownKeys(mask)) {
|
|
1666
|
+
if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
1736
1667
|
if (!mask[key]) continue;
|
|
1737
|
-
newShape
|
|
1668
|
+
assignProp(newShape, key, currDef.shape[key]);
|
|
1738
1669
|
}
|
|
1739
1670
|
assignProp(this, "shape", newShape);
|
|
1740
1671
|
return newShape;
|
|
@@ -1749,8 +1680,8 @@ window.__ModuleLoader__.load({
|
|
|
1749
1680
|
return clone(schema, mergeDefs(schema._zod.def, {
|
|
1750
1681
|
get shape() {
|
|
1751
1682
|
const newShape = { ...schema._zod.def.shape };
|
|
1752
|
-
for (const key
|
|
1753
|
-
if (!(
|
|
1683
|
+
for (const key of Reflect.ownKeys(mask)) {
|
|
1684
|
+
if (!Object.prototype.hasOwnProperty.call(currDef.shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
1754
1685
|
if (!mask[key]) continue;
|
|
1755
1686
|
delete newShape[key];
|
|
1756
1687
|
}
|
|
@@ -1765,7 +1696,7 @@ window.__ModuleLoader__.load({
|
|
|
1765
1696
|
const checks = schema._zod.def.checks;
|
|
1766
1697
|
if (checks && checks.length > 0) {
|
|
1767
1698
|
const existingShape = schema._zod.def.shape;
|
|
1768
|
-
for (const key
|
|
1699
|
+
for (const key of Reflect.ownKeys(shape)) if (Object.getOwnPropertyDescriptor(existingShape, key) !== void 0) throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.");
|
|
1769
1700
|
}
|
|
1770
1701
|
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
1771
1702
|
const _shape = {
|
|
@@ -1788,6 +1719,7 @@ window.__ModuleLoader__.load({
|
|
|
1788
1719
|
} }));
|
|
1789
1720
|
}
|
|
1790
1721
|
function merge(a, b) {
|
|
1722
|
+
if (!b?._zod?.def) throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");
|
|
1791
1723
|
if (a._zod.def.checks?.length) throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");
|
|
1792
1724
|
return clone(a, mergeDefs(a._zod.def, {
|
|
1793
1725
|
get shape() {
|
|
@@ -1804,22 +1736,22 @@ window.__ModuleLoader__.load({
|
|
|
1804
1736
|
checks: b._zod.def.checks ?? []
|
|
1805
1737
|
}));
|
|
1806
1738
|
}
|
|
1807
|
-
function partial(Class, schema, mask) {
|
|
1739
|
+
function partial(Class, schema, mask, name = "partial") {
|
|
1808
1740
|
const checks = schema._zod.def.checks;
|
|
1809
|
-
if (checks && checks.length > 0) throw new Error(
|
|
1741
|
+
if (checks && checks.length > 0) throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
|
|
1810
1742
|
return clone(schema, mergeDefs(schema._zod.def, {
|
|
1811
1743
|
get shape() {
|
|
1812
1744
|
const oldShape = schema._zod.def.shape;
|
|
1813
1745
|
const shape = { ...oldShape };
|
|
1814
|
-
if (mask) for (const key
|
|
1815
|
-
if (!(key
|
|
1746
|
+
if (mask) for (const key of Reflect.ownKeys(mask)) {
|
|
1747
|
+
if (!Object.prototype.hasOwnProperty.call(oldShape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
1816
1748
|
if (!mask[key]) continue;
|
|
1817
1749
|
shape[key] = Class ? new Class({
|
|
1818
1750
|
type: "optional",
|
|
1819
1751
|
innerType: oldShape[key]
|
|
1820
1752
|
}) : oldShape[key];
|
|
1821
1753
|
}
|
|
1822
|
-
else for (const key
|
|
1754
|
+
else for (const key of Reflect.ownKeys(oldShape)) shape[key] = Class ? new Class({
|
|
1823
1755
|
type: "optional",
|
|
1824
1756
|
innerType: oldShape[key]
|
|
1825
1757
|
}) : oldShape[key];
|
|
@@ -1833,15 +1765,15 @@ window.__ModuleLoader__.load({
|
|
|
1833
1765
|
return clone(schema, mergeDefs(schema._zod.def, { get shape() {
|
|
1834
1766
|
const oldShape = schema._zod.def.shape;
|
|
1835
1767
|
const shape = { ...oldShape };
|
|
1836
|
-
if (mask) for (const key
|
|
1837
|
-
if (!(key
|
|
1768
|
+
if (mask) for (const key of Reflect.ownKeys(mask)) {
|
|
1769
|
+
if (!Object.prototype.hasOwnProperty.call(shape, key)) throw new Error(`Unrecognized key: "${String(key)}"`);
|
|
1838
1770
|
if (!mask[key]) continue;
|
|
1839
1771
|
shape[key] = new Class({
|
|
1840
1772
|
type: "nonoptional",
|
|
1841
1773
|
innerType: oldShape[key]
|
|
1842
1774
|
});
|
|
1843
1775
|
}
|
|
1844
|
-
else for (const key
|
|
1776
|
+
else for (const key of Reflect.ownKeys(oldShape)) shape[key] = new Class({
|
|
1845
1777
|
type: "nonoptional",
|
|
1846
1778
|
innerType: oldShape[key]
|
|
1847
1779
|
});
|
|
@@ -1870,19 +1802,54 @@ window.__ModuleLoader__.load({
|
|
|
1870
1802
|
function unwrapMessage(message) {
|
|
1871
1803
|
return typeof message === "string" ? message : message?.message;
|
|
1872
1804
|
}
|
|
1805
|
+
function attachSchema(issues, start, inst) {
|
|
1806
|
+
var _a;
|
|
1807
|
+
for (let i = start; i < issues.length; i++) (_a = issues[i]).schema ?? (_a.schema = inst);
|
|
1808
|
+
}
|
|
1873
1809
|
function finalizeIssue(iss, ctx, config) {
|
|
1874
|
-
|
|
1875
|
-
const
|
|
1810
|
+
var _a;
|
|
1811
|
+
const traits = iss.inst?._zod?.traits;
|
|
1812
|
+
if (traits?.has("$ZodType")) {
|
|
1813
|
+
if (traits.has("$ZodCheck")) (_a = iss).schema ?? (_a.schema = iss.inst);
|
|
1814
|
+
else iss.schema = iss.inst;
|
|
1815
|
+
}
|
|
1816
|
+
const schemaError = iss.schema !== iss.inst ? iss.schema?._zod.def?.error : void 0;
|
|
1817
|
+
const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(schemaError?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
|
|
1818
|
+
const { inst: _inst, schema: _schema, continue: _continue, input: _input, ...rest } = iss;
|
|
1876
1819
|
rest.path ?? (rest.path = []);
|
|
1877
1820
|
rest.message = message;
|
|
1878
1821
|
if (ctx?.reportInput) rest.input = _input;
|
|
1879
1822
|
return rest;
|
|
1880
1823
|
}
|
|
1824
|
+
const highSurrogate = /[\uD800-\uDBFF]/;
|
|
1825
|
+
function codePointLength(str) {
|
|
1826
|
+
const units = str.length;
|
|
1827
|
+
if (!highSurrogate.test(str)) return units;
|
|
1828
|
+
let count = units;
|
|
1829
|
+
for (let i = 0; i < units - 1; i++) if ((str.charCodeAt(i) & 64512) === 55296 && (str.charCodeAt(i + 1) & 64512) === 56320) {
|
|
1830
|
+
count--;
|
|
1831
|
+
i++;
|
|
1832
|
+
}
|
|
1833
|
+
return count;
|
|
1834
|
+
}
|
|
1881
1835
|
function getLengthableOrigin(input) {
|
|
1882
1836
|
if (Array.isArray(input)) return "array";
|
|
1883
1837
|
if (typeof input === "string") return "string";
|
|
1884
1838
|
return "unknown";
|
|
1885
1839
|
}
|
|
1840
|
+
function parsedType(data) {
|
|
1841
|
+
const t = typeof data;
|
|
1842
|
+
switch (t) {
|
|
1843
|
+
case "number": return Number.isNaN(data) ? "nan" : "number";
|
|
1844
|
+
case "object": {
|
|
1845
|
+
if (data === null) return "null";
|
|
1846
|
+
if (Array.isArray(data)) return "array";
|
|
1847
|
+
const obj = data;
|
|
1848
|
+
if (obj && Object.getPrototypeOf(obj) !== Object.prototype && "constructor" in obj && obj.constructor) return obj.constructor.name;
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1851
|
+
return t;
|
|
1852
|
+
}
|
|
1886
1853
|
function issue(...args) {
|
|
1887
1854
|
const [iss, input, inst] = args;
|
|
1888
1855
|
if (typeof iss === "string") return {
|
|
@@ -1893,33 +1860,330 @@ window.__ModuleLoader__.load({
|
|
|
1893
1860
|
};
|
|
1894
1861
|
return { ...iss };
|
|
1895
1862
|
}
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1863
|
+
/**
|
|
1864
|
+
* Installs a trait's members on its prototype. Each value builds that member for the instance on first read; the built value shadows the accessor as an own property, so a detached `const { parse } = schema` keeps working.
|
|
1865
|
+
*
|
|
1866
|
+
* Call this from a `proto` initializer, which runs once per prototype — never per instance.
|
|
1867
|
+
*/
|
|
1868
|
+
function members(proto, table) {
|
|
1869
|
+
for (const key in table) {
|
|
1870
|
+
const desc = Object.getOwnPropertyDescriptor(table, key);
|
|
1871
|
+
if (desc.get) Object.defineProperty(proto, key, {
|
|
1872
|
+
...desc,
|
|
1873
|
+
enumerable: false
|
|
1874
|
+
});
|
|
1875
|
+
else defineBound(proto, key, desc.value);
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
/** Shadows a prototype member with an own value, so a getter that builds from the instance runs once. */
|
|
1879
|
+
function own(inst, key, value, enumerable = true) {
|
|
1880
|
+
Object.defineProperty(inst, key, {
|
|
1881
|
+
configurable: true,
|
|
1882
|
+
writable: true,
|
|
1883
|
+
enumerable,
|
|
1884
|
+
value
|
|
1903
1885
|
});
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1886
|
+
return value;
|
|
1887
|
+
}
|
|
1888
|
+
/** Like {@link own}, for a member that was never an own data property and has to stay out of `Object.keys`. */
|
|
1889
|
+
function hide(inst, key, value) {
|
|
1890
|
+
return own(inst, key, value, false);
|
|
1891
|
+
}
|
|
1892
|
+
function defineBound(proto, key, fn) {
|
|
1893
|
+
Object.defineProperty(proto, key, {
|
|
1894
|
+
configurable: true,
|
|
1895
|
+
get() {
|
|
1896
|
+
return this == null ? fn : own(this, key, fn.bind(this));
|
|
1897
|
+
},
|
|
1898
|
+
set(value) {
|
|
1899
|
+
own(this, key, value);
|
|
1900
|
+
}
|
|
1901
|
+
});
|
|
1902
|
+
}
|
|
1903
|
+
/** Returns the prototype to install on, or `undefined` if this group is already installed on it. */
|
|
1904
|
+
function claim(inst, sentinel) {
|
|
1905
|
+
const proto = Object.getPrototypeOf(inst);
|
|
1906
|
+
return sentinel in proto ? void 0 : proto;
|
|
1907
|
+
}
|
|
1908
|
+
let installing;
|
|
1909
|
+
let broke = false;
|
|
1910
|
+
const breaker = {
|
|
1911
|
+
configurable: true,
|
|
1912
|
+
get() {
|
|
1913
|
+
broke = true;
|
|
1914
|
+
}
|
|
1915
|
+
};
|
|
1916
|
+
/**
|
|
1917
|
+
* Installs a lazily-derived internal on the `_zod` prototype of `inst`'s
|
|
1918
|
+
* constructor, computed from the internals object itself and cached there on
|
|
1919
|
+
* first read. One accessor per constructor rather than one per instance.
|
|
1920
|
+
*/
|
|
1921
|
+
function defineLazyInternal(inst, key, compute) {
|
|
1922
|
+
const proto = Object.getPrototypeOf(inst._zod);
|
|
1923
|
+
if (key in proto && installing !== inst._zod) {
|
|
1924
|
+
installing = void 0;
|
|
1925
|
+
return;
|
|
1926
|
+
}
|
|
1927
|
+
installing = inst._zod;
|
|
1928
|
+
Object.defineProperty(proto, key, {
|
|
1929
|
+
configurable: true,
|
|
1930
|
+
get() {
|
|
1931
|
+
Object.defineProperty(this, key, breaker);
|
|
1932
|
+
const outer = broke;
|
|
1933
|
+
broke = false;
|
|
1934
|
+
try {
|
|
1935
|
+
const value = compute(this);
|
|
1936
|
+
if (broke) delete this[key];
|
|
1937
|
+
else Object.defineProperty(this, key, {
|
|
1938
|
+
configurable: true,
|
|
1939
|
+
writable: true,
|
|
1940
|
+
value
|
|
1941
|
+
});
|
|
1942
|
+
broke = broke || outer;
|
|
1943
|
+
return value;
|
|
1944
|
+
} catch (err) {
|
|
1945
|
+
delete this[key];
|
|
1946
|
+
broke = broke || outer;
|
|
1947
|
+
throw err;
|
|
1948
|
+
}
|
|
1949
|
+
},
|
|
1950
|
+
set(value) {
|
|
1951
|
+
Object.defineProperty(this, key, {
|
|
1952
|
+
configurable: true,
|
|
1953
|
+
writable: true,
|
|
1954
|
+
value
|
|
1955
|
+
});
|
|
1956
|
+
}
|
|
1907
1957
|
});
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1958
|
+
}
|
|
1959
|
+
/**
|
|
1960
|
+
* Installs `key` on `inst`'s prototype, computed by `make` on first read and cached there as an own
|
|
1961
|
+
* data property. One accessor per constructor rather than one per instance, because an own accessor
|
|
1962
|
+
* puts every instance after the first into v8 dictionary mode. The key doubles as the sentinel.
|
|
1963
|
+
*/
|
|
1964
|
+
function installLazyProp(inst, key, make, enumerable) {
|
|
1965
|
+
const proto = claim(inst, key);
|
|
1966
|
+
if (!proto) return;
|
|
1967
|
+
Object.defineProperty(proto, key, {
|
|
1968
|
+
configurable: true,
|
|
1969
|
+
get() {
|
|
1970
|
+
const desc = {
|
|
1971
|
+
configurable: true,
|
|
1972
|
+
writable: true,
|
|
1973
|
+
enumerable,
|
|
1974
|
+
value: void 0
|
|
1975
|
+
};
|
|
1976
|
+
Object.defineProperty(this, key, desc);
|
|
1977
|
+
desc.value = make(this);
|
|
1978
|
+
Object.defineProperty(this, key, desc);
|
|
1979
|
+
return desc.value;
|
|
1980
|
+
},
|
|
1981
|
+
set(value) {
|
|
1982
|
+
Object.defineProperty(this, key, {
|
|
1983
|
+
configurable: true,
|
|
1984
|
+
writable: true,
|
|
1985
|
+
enumerable,
|
|
1986
|
+
value
|
|
1987
|
+
});
|
|
1988
|
+
}
|
|
1912
1989
|
});
|
|
1990
|
+
}
|
|
1991
|
+
/** Marks the thunk `_catch` synthesises for a constant catch value. `Function.length` cannot tell that thunk from a user callback — rest and defaulted parameters both report arity 0 — and a user callback reads `ctx.error`, whose issues only finalize correctly against the caller's per-parse error map. Provenance can say what arity cannot. A plain string key rather than `Symbol.for`, whose call at module scope no bundler can prove pure — the same shape that anchored `urlCanParse` into every build. */
|
|
1992
|
+
const CONSTANT_CATCH = "~constantCatch";
|
|
1993
|
+
/** Wraps a constant catch value in a thunk tagged with {@link CONSTANT_CATCH}. */
|
|
1994
|
+
function constantCatch(value) {
|
|
1995
|
+
const fn = () => value;
|
|
1996
|
+
fn[CONSTANT_CATCH] = true;
|
|
1997
|
+
return fn;
|
|
1998
|
+
}
|
|
1999
|
+
//#endregion
|
|
2000
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/core.js
|
|
2001
|
+
var _a$1;
|
|
2002
|
+
const _zodDesc$1 = {
|
|
2003
|
+
value: void 0,
|
|
2004
|
+
enumerable: false
|
|
2005
|
+
};
|
|
2006
|
+
let _E = "captureStackTrace" in Error ? Error : null;
|
|
2007
|
+
function newError(Definition) {
|
|
2008
|
+
const E = _E;
|
|
2009
|
+
if (E) {
|
|
2010
|
+
const saved = E.stackTraceLimit;
|
|
2011
|
+
if (typeof saved === "number") {
|
|
2012
|
+
try {
|
|
2013
|
+
E.stackTraceLimit = 0;
|
|
2014
|
+
} catch {
|
|
2015
|
+
_E = null;
|
|
2016
|
+
return new Definition();
|
|
2017
|
+
}
|
|
2018
|
+
try {
|
|
2019
|
+
return new Definition();
|
|
2020
|
+
} finally {
|
|
2021
|
+
E.stackTraceLimit = saved;
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
return new Definition();
|
|
2026
|
+
}
|
|
2027
|
+
function $constructor(name, initializer, proto, params) {
|
|
2028
|
+
const zodProto = {};
|
|
2029
|
+
function Internals(def) {
|
|
2030
|
+
this.def = def;
|
|
2031
|
+
this.constr = _;
|
|
2032
|
+
this.traits = /* @__PURE__ */ new Set();
|
|
2033
|
+
}
|
|
2034
|
+
Internals.prototype = zodProto;
|
|
2035
|
+
const protoMembers = proto;
|
|
2036
|
+
const initialized = protoMembers && /* @__PURE__ */ new WeakSet();
|
|
2037
|
+
function init(inst, def) {
|
|
2038
|
+
if (!inst._zod) {
|
|
2039
|
+
_zodDesc$1.value = new Internals(def);
|
|
2040
|
+
try {
|
|
2041
|
+
Object.defineProperty(inst, "_zod", _zodDesc$1);
|
|
2042
|
+
} finally {
|
|
2043
|
+
_zodDesc$1.value = void 0;
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2046
|
+
if (inst._zod.traits.has(name)) return;
|
|
2047
|
+
inst._zod.traits.add(name);
|
|
2048
|
+
initializer(inst, def);
|
|
2049
|
+
if (initialized) {
|
|
2050
|
+
const own = Object.getPrototypeOf(inst);
|
|
2051
|
+
const ctorProto = inst._zod.constr.prototype;
|
|
2052
|
+
let up = own;
|
|
2053
|
+
while (up && up !== ctorProto) up = Object.getPrototypeOf(up);
|
|
2054
|
+
const target = up ?? own;
|
|
2055
|
+
if (!initialized.has(target)) {
|
|
2056
|
+
initialized.add(target);
|
|
2057
|
+
members(target, protoMembers);
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
2060
|
+
const proto = _.prototype;
|
|
2061
|
+
for (const k in proto) {
|
|
2062
|
+
if (!Object.prototype.hasOwnProperty.call(proto, k)) continue;
|
|
2063
|
+
if (!(k in inst)) inst[k] = proto[k].bind(inst);
|
|
2064
|
+
}
|
|
2065
|
+
}
|
|
2066
|
+
const Parent = params?.Parent ?? Object;
|
|
2067
|
+
class Definition extends Parent {}
|
|
2068
|
+
Object.defineProperty(Definition, "name", { value: name });
|
|
2069
|
+
function _(def) {
|
|
2070
|
+
const inst = params?.Parent ? newError(Definition) : this;
|
|
2071
|
+
init(inst, def);
|
|
2072
|
+
const deferred = inst._zod.deferred;
|
|
2073
|
+
if (deferred) {
|
|
2074
|
+
for (const fn of deferred) fn();
|
|
2075
|
+
inst._zod.deferred = void 0;
|
|
2076
|
+
}
|
|
2077
|
+
const pp = globalThis.__zod_globalConfig?.postProcessor;
|
|
2078
|
+
if (pp) pp(inst);
|
|
2079
|
+
return inst;
|
|
2080
|
+
}
|
|
2081
|
+
Object.defineProperty(_, "init", { value: init });
|
|
2082
|
+
Object.defineProperty(_, Symbol.hasInstance, { value: (inst) => {
|
|
2083
|
+
if (params?.Parent && inst instanceof params.Parent) return true;
|
|
2084
|
+
return inst?._zod?.traits?.has(name);
|
|
2085
|
+
} });
|
|
2086
|
+
Object.defineProperty(_, "name", { value: name });
|
|
2087
|
+
return _;
|
|
2088
|
+
}
|
|
2089
|
+
var $ZodAsyncError = class extends Error {
|
|
2090
|
+
constructor() {
|
|
2091
|
+
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
2092
|
+
}
|
|
2093
|
+
};
|
|
2094
|
+
var $ZodEncodeError = class extends Error {
|
|
2095
|
+
constructor(name) {
|
|
2096
|
+
super(`Encountered unidirectional transform during encode: ${name}`);
|
|
2097
|
+
this.name = "ZodEncodeError";
|
|
2098
|
+
}
|
|
2099
|
+
};
|
|
2100
|
+
(_a$1 = globalThis).__zod_globalConfig ?? (_a$1.__zod_globalConfig = {});
|
|
2101
|
+
const globalConfig = globalThis.__zod_globalConfig;
|
|
2102
|
+
function config(newConfig) {
|
|
2103
|
+
if (newConfig) Object.assign(globalConfig, newConfig);
|
|
2104
|
+
return globalConfig;
|
|
2105
|
+
}
|
|
2106
|
+
//#endregion
|
|
2107
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/errors.js
|
|
2108
|
+
function _getMessage() {
|
|
2109
|
+
const internals = this._zod;
|
|
2110
|
+
internals.message ?? (internals.message = JSON.stringify(internals.def, jsonStringifyReplacer, 2));
|
|
2111
|
+
return internals.message;
|
|
2112
|
+
}
|
|
2113
|
+
function _setMessage(value) {
|
|
2114
|
+
this._zod.message = value;
|
|
2115
|
+
}
|
|
2116
|
+
const _messageDesc = {
|
|
2117
|
+
get: _getMessage,
|
|
2118
|
+
set: _setMessage,
|
|
2119
|
+
enumerable: true,
|
|
2120
|
+
configurable: true
|
|
2121
|
+
};
|
|
2122
|
+
const _zodDesc = {
|
|
2123
|
+
value: void 0,
|
|
2124
|
+
enumerable: false
|
|
2125
|
+
};
|
|
2126
|
+
const _issuesDesc = {
|
|
2127
|
+
value: void 0,
|
|
2128
|
+
enumerable: false
|
|
2129
|
+
};
|
|
2130
|
+
const _installedToString = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
2131
|
+
const initializer$1 = (inst, def) => {
|
|
2132
|
+
inst.name = "$ZodError";
|
|
2133
|
+
_zodDesc.value = inst._zod;
|
|
2134
|
+
Object.defineProperty(inst, "_zod", _zodDesc);
|
|
2135
|
+
_issuesDesc.value = def;
|
|
2136
|
+
Object.defineProperty(inst, "issues", _issuesDesc);
|
|
2137
|
+
_zodDesc.value = void 0;
|
|
2138
|
+
_issuesDesc.value = void 0;
|
|
2139
|
+
Object.defineProperty(inst, "message", _messageDesc);
|
|
2140
|
+
const proto = Object.getPrototypeOf(inst);
|
|
2141
|
+
if (!_installedToString.has(proto)) {
|
|
2142
|
+
_installedToString.add(proto);
|
|
2143
|
+
Object.defineProperty(proto, "toString", {
|
|
2144
|
+
configurable: true,
|
|
2145
|
+
enumerable: false,
|
|
2146
|
+
get() {
|
|
2147
|
+
const value = () => this.message;
|
|
2148
|
+
Object.defineProperty(this, "toString", {
|
|
2149
|
+
value,
|
|
2150
|
+
configurable: true,
|
|
2151
|
+
writable: true
|
|
2152
|
+
});
|
|
2153
|
+
return value;
|
|
2154
|
+
},
|
|
2155
|
+
set(value) {
|
|
2156
|
+
Object.defineProperty(this, "toString", {
|
|
2157
|
+
value,
|
|
2158
|
+
configurable: true,
|
|
2159
|
+
writable: true
|
|
2160
|
+
});
|
|
2161
|
+
}
|
|
2162
|
+
});
|
|
2163
|
+
}
|
|
1913
2164
|
};
|
|
1914
2165
|
const $ZodError = $constructor("$ZodError", initializer$1);
|
|
1915
|
-
const $ZodRealError = $constructor("$ZodError", initializer$1, { Parent: Error });
|
|
2166
|
+
const $ZodRealError = $constructor("$ZodError", initializer$1, void 0, { Parent: Error });
|
|
2167
|
+
/** Get-or-create `obj[key]` as an own data property. A path segment naming an inherited member
|
|
2168
|
+
* ("toString", "constructor") would otherwise read through to the prototype, and assigning
|
|
2169
|
+
* "__proto__" would hit the setter instead of creating a key. */
|
|
2170
|
+
function node(obj, key, make) {
|
|
2171
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
2172
|
+
if (key === "__proto__") Object.defineProperty(obj, key, {
|
|
2173
|
+
value: make(),
|
|
2174
|
+
writable: true,
|
|
2175
|
+
enumerable: true,
|
|
2176
|
+
configurable: true
|
|
2177
|
+
});
|
|
2178
|
+
else obj[key] = make();
|
|
2179
|
+
}
|
|
2180
|
+
return obj[key];
|
|
2181
|
+
}
|
|
1916
2182
|
function flattenError(error, mapper = (issue) => issue.message) {
|
|
1917
2183
|
const fieldErrors = {};
|
|
1918
2184
|
const formErrors = [];
|
|
1919
|
-
for (const sub of error.issues) if (sub.path.length > 0)
|
|
1920
|
-
|
|
1921
|
-
fieldErrors[sub.path[0]].push(mapper(sub));
|
|
1922
|
-
} else formErrors.push(mapper(sub));
|
|
2185
|
+
for (const sub of error.issues) if (sub.path.length > 0) node(fieldErrors, sub.path[0], () => []).push(mapper(sub));
|
|
2186
|
+
else formErrors.push(mapper(sub));
|
|
1923
2187
|
return {
|
|
1924
2188
|
formErrors,
|
|
1925
2189
|
fieldErrors
|
|
@@ -1939,12 +2203,21 @@ window.__ModuleLoader__.load({
|
|
|
1939
2203
|
let i = 0;
|
|
1940
2204
|
while (i < fullpath.length) {
|
|
1941
2205
|
const el = fullpath[i];
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
2206
|
+
const terminal = i === fullpath.length - 1;
|
|
2207
|
+
if (el === "_errors") {
|
|
2208
|
+
if (terminal) curr._errors.push(mapper(issue));
|
|
2209
|
+
i++;
|
|
2210
|
+
continue;
|
|
1946
2211
|
}
|
|
1947
|
-
curr
|
|
2212
|
+
if (!Object.prototype.hasOwnProperty.call(curr, el)) Object.defineProperty(curr, el, {
|
|
2213
|
+
value: { _errors: [] },
|
|
2214
|
+
enumerable: true,
|
|
2215
|
+
writable: true,
|
|
2216
|
+
configurable: true
|
|
2217
|
+
});
|
|
2218
|
+
const node = curr[el];
|
|
2219
|
+
if (terminal) node._errors.push(mapper(issue));
|
|
2220
|
+
curr = node;
|
|
1948
2221
|
i++;
|
|
1949
2222
|
}
|
|
1950
2223
|
}
|
|
@@ -1954,40 +2227,52 @@ window.__ModuleLoader__.load({
|
|
|
1954
2227
|
return fieldErrors;
|
|
1955
2228
|
}
|
|
1956
2229
|
//#endregion
|
|
1957
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
}
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
2230
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/parse.js
|
|
2231
|
+
function finalizeParams(callee, params) {
|
|
2232
|
+
return {
|
|
2233
|
+
callee: params?.callee ?? callee,
|
|
2234
|
+
Err: params?.Err
|
|
2235
|
+
};
|
|
2236
|
+
}
|
|
2237
|
+
const _parse = (_Err) => {
|
|
2238
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
2239
|
+
const ctx = _ctx ? {
|
|
2240
|
+
..._ctx,
|
|
2241
|
+
async: false
|
|
2242
|
+
} : { async: false };
|
|
2243
|
+
const result = schema._zod.run({
|
|
2244
|
+
value,
|
|
2245
|
+
issues: []
|
|
2246
|
+
}, ctx);
|
|
2247
|
+
if (result instanceof Promise) throw new $ZodAsyncError();
|
|
2248
|
+
if (result.issues.length) {
|
|
2249
|
+
const e = new ((_params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
2250
|
+
captureStackTrace(e, _params?.callee ?? fn);
|
|
2251
|
+
throw e;
|
|
2252
|
+
}
|
|
2253
|
+
return result.value;
|
|
2254
|
+
};
|
|
2255
|
+
return fn;
|
|
1974
2256
|
};
|
|
1975
|
-
const _parseAsync = (_Err) =>
|
|
1976
|
-
const
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
2257
|
+
const _parseAsync = (_Err) => {
|
|
2258
|
+
const fn = async (schema, value, _ctx, params) => {
|
|
2259
|
+
const ctx = _ctx ? {
|
|
2260
|
+
..._ctx,
|
|
2261
|
+
async: true
|
|
2262
|
+
} : { async: true };
|
|
2263
|
+
let result = schema._zod.run({
|
|
2264
|
+
value,
|
|
2265
|
+
issues: []
|
|
2266
|
+
}, ctx);
|
|
2267
|
+
if (result instanceof Promise) result = await result;
|
|
2268
|
+
if (result.issues.length) {
|
|
2269
|
+
const e = new ((params?.Err) ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
|
|
2270
|
+
captureStackTrace(e, params?.callee ?? fn);
|
|
2271
|
+
throw e;
|
|
2272
|
+
}
|
|
2273
|
+
return result.value;
|
|
2274
|
+
};
|
|
2275
|
+
return fn;
|
|
1991
2276
|
};
|
|
1992
2277
|
const _safeParse = (_Err) => (schema, value, _ctx) => {
|
|
1993
2278
|
const ctx = _ctx ? {
|
|
@@ -2027,25 +2312,41 @@ window.__ModuleLoader__.load({
|
|
|
2027
2312
|
};
|
|
2028
2313
|
};
|
|
2029
2314
|
const safeParseAsync$1 = /* @__PURE__*/ _safeParseAsync($ZodRealError);
|
|
2030
|
-
const _encode = (_Err) =>
|
|
2031
|
-
const
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2315
|
+
const _encode = (_Err) => {
|
|
2316
|
+
const parse = _parse(_Err);
|
|
2317
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
2318
|
+
const ctx = _ctx ? {
|
|
2319
|
+
..._ctx,
|
|
2320
|
+
direction: "backward"
|
|
2321
|
+
} : { direction: "backward" };
|
|
2322
|
+
return parse(schema, value, ctx, finalizeParams(fn, _params));
|
|
2323
|
+
};
|
|
2324
|
+
return fn;
|
|
2036
2325
|
};
|
|
2037
|
-
const _decode = (_Err) =>
|
|
2038
|
-
|
|
2326
|
+
const _decode = (_Err) => {
|
|
2327
|
+
const parse = _parse(_Err);
|
|
2328
|
+
const fn = (schema, value, _ctx, _params) => {
|
|
2329
|
+
return parse(schema, value, _ctx, finalizeParams(fn, _params));
|
|
2330
|
+
};
|
|
2331
|
+
return fn;
|
|
2039
2332
|
};
|
|
2040
|
-
const _encodeAsync = (_Err) =>
|
|
2041
|
-
const
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2333
|
+
const _encodeAsync = (_Err) => {
|
|
2334
|
+
const parseAsync = _parseAsync(_Err);
|
|
2335
|
+
const fn = async (schema, value, _ctx, _params) => {
|
|
2336
|
+
const ctx = _ctx ? {
|
|
2337
|
+
..._ctx,
|
|
2338
|
+
direction: "backward"
|
|
2339
|
+
} : { direction: "backward" };
|
|
2340
|
+
return await parseAsync(schema, value, ctx, finalizeParams(fn, _params));
|
|
2341
|
+
};
|
|
2342
|
+
return fn;
|
|
2046
2343
|
};
|
|
2047
|
-
const _decodeAsync = (_Err) =>
|
|
2048
|
-
|
|
2344
|
+
const _decodeAsync = (_Err) => {
|
|
2345
|
+
const parseAsync = _parseAsync(_Err);
|
|
2346
|
+
const fn = async (schema, value, _ctx, _params) => {
|
|
2347
|
+
return await parseAsync(schema, value, _ctx, finalizeParams(fn, _params));
|
|
2348
|
+
};
|
|
2349
|
+
return fn;
|
|
2049
2350
|
};
|
|
2050
2351
|
const _safeEncode = (_Err) => (schema, value, _ctx) => {
|
|
2051
2352
|
const ctx = _ctx ? {
|
|
@@ -2068,7 +2369,7 @@ window.__ModuleLoader__.load({
|
|
|
2068
2369
|
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
2069
2370
|
};
|
|
2070
2371
|
//#endregion
|
|
2071
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
2372
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/regexes.js
|
|
2072
2373
|
/**
|
|
2073
2374
|
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
2074
2375
|
* (timestamps embedded in the id). Use {@link cuid2} instead.
|
|
@@ -2076,12 +2377,15 @@ window.__ModuleLoader__.load({
|
|
|
2076
2377
|
*/
|
|
2077
2378
|
const cuid = /^[cC][0-9a-z]{6,}$/;
|
|
2078
2379
|
const cuid2 = /^[0-9a-z]+$/;
|
|
2079
|
-
const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{
|
|
2380
|
+
const ulid = /^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/;
|
|
2080
2381
|
const xid = /^[0-9a-vA-V]{20}$/;
|
|
2081
2382
|
const ksuid = /^[A-Za-z0-9]{27}$/;
|
|
2082
2383
|
const nanoid = /^[a-zA-Z0-9_-]{21}$/;
|
|
2384
|
+
function nanoidOfLength(length) {
|
|
2385
|
+
return new RegExp(`^[a-zA-Z0-9_-]{${length}}$`);
|
|
2386
|
+
}
|
|
2083
2387
|
/** ISO 8601-1 duration regex. Does not support the 8601-2 extensions like negative durations or fractional/negative components. */
|
|
2084
|
-
const duration
|
|
2388
|
+
const duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
|
|
2085
2389
|
/** A regex for any UUID-like identifier: 8-4-4-4-12 hex pattern */
|
|
2086
2390
|
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})$/;
|
|
2087
2391
|
/** Returns a regex for validating an RFC 9562/4122 UUID.
|
|
@@ -2093,33 +2397,41 @@ window.__ModuleLoader__.load({
|
|
|
2093
2397
|
};
|
|
2094
2398
|
/** Practical email validation */
|
|
2095
2399
|
const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
|
|
2096
|
-
const _emoji$1 = `^
|
|
2400
|
+
const _emoji$1 = `^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;
|
|
2097
2401
|
function emoji() {
|
|
2098
2402
|
return new RegExp(_emoji$1, "u");
|
|
2099
2403
|
}
|
|
2100
2404
|
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])$/;
|
|
2101
2405
|
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}|:))$/;
|
|
2102
2406
|
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])$/;
|
|
2103
|
-
const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}
|
|
2407
|
+
const cidrv6 = /^(([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}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
|
|
2104
2408
|
const base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
|
|
2105
2409
|
const base64url = /^[A-Za-z0-9_-]*$/;
|
|
2106
2410
|
const httpProtocol = /^https?$/;
|
|
2107
2411
|
const e164 = /^\+[1-9]\d{6,14}$/;
|
|
2108
2412
|
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])))`;
|
|
2109
|
-
|
|
2413
|
+
/** Anchors a pattern source. The interpolation lives here rather than at the call site because
|
|
2414
|
+
* esbuild will not drop a `@__PURE__` call whose own argument interpolates a variable, but it
|
|
2415
|
+
* will drop `anchor(dateSource)`. Keeping it inline pinned `date` into every bundle. */
|
|
2416
|
+
function anchor(source) {
|
|
2417
|
+
return new RegExp(`^${source}$`);
|
|
2418
|
+
}
|
|
2419
|
+
const date = /*@__PURE__*/ anchor(dateSource);
|
|
2110
2420
|
function timeSource(args) {
|
|
2111
2421
|
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
2112
|
-
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+)?)?`;
|
|
2422
|
+
return typeof args.precision === "number" ? args.precision === -1 ? `${hhmm}` : args.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : args.seconds ? `${hhmm}:[0-5]\\d(?:\\.\\d+)?` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
2113
2423
|
}
|
|
2114
|
-
function time
|
|
2424
|
+
function time(args) {
|
|
2115
2425
|
return new RegExp(`^${timeSource(args)}$`);
|
|
2116
2426
|
}
|
|
2117
|
-
function datetime
|
|
2118
|
-
const time = timeSource({ precision: args.precision });
|
|
2427
|
+
function datetime(args) {
|
|
2119
2428
|
const opts = ["Z"];
|
|
2120
|
-
if (args.local) opts.push("");
|
|
2121
2429
|
if (args.offset) opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
2122
|
-
const
|
|
2430
|
+
const qualified = `${timeSource({
|
|
2431
|
+
precision: args.precision,
|
|
2432
|
+
seconds: true
|
|
2433
|
+
})}(?:${opts.join("|")})`;
|
|
2434
|
+
const timeRegex = args.local ? `${qualified}|${timeSource({ precision: args.precision })}` : qualified;
|
|
2123
2435
|
return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
|
|
2124
2436
|
}
|
|
2125
2437
|
const string$1 = (params) => {
|
|
@@ -2133,13 +2445,18 @@ window.__ModuleLoader__.load({
|
|
|
2133
2445
|
const lowercase = /^[^A-Z]*$/;
|
|
2134
2446
|
const uppercase = /^[^a-z]*$/;
|
|
2135
2447
|
//#endregion
|
|
2136
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
2448
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/checks.js
|
|
2137
2449
|
const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def) => {
|
|
2138
2450
|
var _a;
|
|
2139
2451
|
inst._zod ?? (inst._zod = {});
|
|
2140
2452
|
inst._zod.def = def;
|
|
2141
2453
|
(_a = inst._zod).onattach ?? (_a.onattach = []);
|
|
2142
2454
|
});
|
|
2455
|
+
/** Default `when` for length-based checks: run only on non-nullish values with a `length`. */
|
|
2456
|
+
const _whenHasLength = (payload) => {
|
|
2457
|
+
const val = payload.value;
|
|
2458
|
+
return !nullish(val) && val.length !== void 0;
|
|
2459
|
+
};
|
|
2143
2460
|
const numericOriginMap = {
|
|
2144
2461
|
number: "number",
|
|
2145
2462
|
bigint: "bigint",
|
|
@@ -2159,7 +2476,7 @@ window.__ModuleLoader__.load({
|
|
|
2159
2476
|
inst._zod.check = (payload) => {
|
|
2160
2477
|
if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
|
|
2161
2478
|
payload.issues.push({
|
|
2162
|
-
origin,
|
|
2479
|
+
origin: numericOriginMap[typeof payload.value] ?? origin,
|
|
2163
2480
|
code: "too_big",
|
|
2164
2481
|
maximum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
2165
2482
|
input: payload.value,
|
|
@@ -2183,7 +2500,7 @@ window.__ModuleLoader__.load({
|
|
|
2183
2500
|
inst._zod.check = (payload) => {
|
|
2184
2501
|
if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
|
|
2185
2502
|
payload.issues.push({
|
|
2186
|
-
origin,
|
|
2503
|
+
origin: numericOriginMap[typeof payload.value] ?? origin,
|
|
2187
2504
|
code: "too_small",
|
|
2188
2505
|
minimum: typeof def.value === "object" ? def.value.getTime() : def.value,
|
|
2189
2506
|
input: payload.value,
|
|
@@ -2201,7 +2518,7 @@ window.__ModuleLoader__.load({
|
|
|
2201
2518
|
});
|
|
2202
2519
|
inst._zod.check = (payload) => {
|
|
2203
2520
|
if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
|
|
2204
|
-
if (typeof payload.value === "bigint" ? payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
|
|
2521
|
+
if (typeof payload.value === "bigint" ? def.value !== BigInt(0) && payload.value % def.value === BigInt(0) : floatSafeRemainder(payload.value, def.value) === 0) return;
|
|
2205
2522
|
payload.issues.push({
|
|
2206
2523
|
origin: typeof payload.value,
|
|
2207
2524
|
code: "not_multiple_of",
|
|
@@ -2286,17 +2603,15 @@ window.__ModuleLoader__.load({
|
|
|
2286
2603
|
const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (inst, def) => {
|
|
2287
2604
|
var _a;
|
|
2288
2605
|
$ZodCheck.init(inst, def);
|
|
2289
|
-
(_a = inst._zod.def).when ?? (_a.when =
|
|
2290
|
-
const val = payload.value;
|
|
2291
|
-
return !nullish(val) && val.length !== void 0;
|
|
2292
|
-
});
|
|
2606
|
+
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
2293
2607
|
inst._zod.onattach.push((inst) => {
|
|
2294
2608
|
const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
|
|
2295
2609
|
if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
|
|
2296
2610
|
});
|
|
2297
2611
|
inst._zod.check = (payload) => {
|
|
2298
2612
|
const input = payload.value;
|
|
2299
|
-
|
|
2613
|
+
const units = input.length;
|
|
2614
|
+
if ((typeof input === "string" && units > def.maximum ? codePointLength(input) : units) <= def.maximum) return;
|
|
2300
2615
|
const origin = getLengthableOrigin(input);
|
|
2301
2616
|
payload.issues.push({
|
|
2302
2617
|
origin,
|
|
@@ -2312,17 +2627,15 @@ window.__ModuleLoader__.load({
|
|
|
2312
2627
|
const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (inst, def) => {
|
|
2313
2628
|
var _a;
|
|
2314
2629
|
$ZodCheck.init(inst, def);
|
|
2315
|
-
(_a = inst._zod.def).when ?? (_a.when =
|
|
2316
|
-
const val = payload.value;
|
|
2317
|
-
return !nullish(val) && val.length !== void 0;
|
|
2318
|
-
});
|
|
2630
|
+
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
2319
2631
|
inst._zod.onattach.push((inst) => {
|
|
2320
2632
|
const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
|
|
2321
2633
|
if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
|
|
2322
2634
|
});
|
|
2323
2635
|
inst._zod.check = (payload) => {
|
|
2324
2636
|
const input = payload.value;
|
|
2325
|
-
|
|
2637
|
+
const units = input.length;
|
|
2638
|
+
if ((typeof input === "string" && units >= def.minimum && units < def.minimum * 2 ? codePointLength(input) : units) >= def.minimum) return;
|
|
2326
2639
|
const origin = getLengthableOrigin(input);
|
|
2327
2640
|
payload.issues.push({
|
|
2328
2641
|
origin,
|
|
@@ -2338,10 +2651,7 @@ window.__ModuleLoader__.load({
|
|
|
2338
2651
|
const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals", (inst, def) => {
|
|
2339
2652
|
var _a;
|
|
2340
2653
|
$ZodCheck.init(inst, def);
|
|
2341
|
-
(_a = inst._zod.def).when ?? (_a.when =
|
|
2342
|
-
const val = payload.value;
|
|
2343
|
-
return !nullish(val) && val.length !== void 0;
|
|
2344
|
-
});
|
|
2654
|
+
(_a = inst._zod.def).when ?? (_a.when = _whenHasLength);
|
|
2345
2655
|
inst._zod.onattach.push((inst) => {
|
|
2346
2656
|
const bag = inst._zod.bag;
|
|
2347
2657
|
bag.minimum = def.length;
|
|
@@ -2350,7 +2660,8 @@ window.__ModuleLoader__.load({
|
|
|
2350
2660
|
});
|
|
2351
2661
|
inst._zod.check = (payload) => {
|
|
2352
2662
|
const input = payload.value;
|
|
2353
|
-
const
|
|
2663
|
+
const units = input.length;
|
|
2664
|
+
const length = typeof input === "string" && units >= def.length && units <= def.length * 2 ? codePointLength(input) : units;
|
|
2354
2665
|
if (length === def.length) return;
|
|
2355
2666
|
const origin = getLengthableOrigin(input);
|
|
2356
2667
|
const tooBig = length > def.length;
|
|
@@ -2424,7 +2735,7 @@ window.__ModuleLoader__.load({
|
|
|
2424
2735
|
const $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst, def) => {
|
|
2425
2736
|
$ZodCheck.init(inst, def);
|
|
2426
2737
|
const escapedRegex = escapeRegex(def.includes);
|
|
2427
|
-
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
|
|
2738
|
+
const pattern = new RegExp(typeof def.position === "number" ? `^.{${def.position},}${escapedRegex}` : escapedRegex);
|
|
2428
2739
|
def.pattern = pattern;
|
|
2429
2740
|
inst._zod.onattach.push((inst) => {
|
|
2430
2741
|
const bag = inst._zod.bag;
|
|
@@ -2495,12 +2806,13 @@ window.__ModuleLoader__.load({
|
|
|
2495
2806
|
};
|
|
2496
2807
|
});
|
|
2497
2808
|
//#endregion
|
|
2498
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
2809
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/doc.js
|
|
2499
2810
|
var Doc = class {
|
|
2500
|
-
constructor(args = []) {
|
|
2811
|
+
constructor(args = [], closed = {}) {
|
|
2501
2812
|
this.content = [];
|
|
2502
2813
|
this.indent = 0;
|
|
2503
|
-
|
|
2814
|
+
this.args = args;
|
|
2815
|
+
this.closed = closed;
|
|
2504
2816
|
}
|
|
2505
2817
|
indented(fn) {
|
|
2506
2818
|
this.indent += 1;
|
|
@@ -2520,28 +2832,27 @@ window.__ModuleLoader__.load({
|
|
|
2520
2832
|
}
|
|
2521
2833
|
compile() {
|
|
2522
2834
|
const F = Function;
|
|
2523
|
-
const
|
|
2524
|
-
|
|
2525
|
-
return new F(...args, lines.join("\n"));
|
|
2835
|
+
const content = this?.content ?? [``];
|
|
2836
|
+
return new F(...Object.keys(this.closed), `return function (${this.args.join(", ")}) {\n${content.join("\n")}\n};`)(...Object.values(this.closed));
|
|
2526
2837
|
}
|
|
2527
2838
|
};
|
|
2528
2839
|
//#endregion
|
|
2529
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
2840
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/versions.js
|
|
2530
2841
|
const version = {
|
|
2531
2842
|
major: 4,
|
|
2532
|
-
minor:
|
|
2533
|
-
patch:
|
|
2843
|
+
minor: 5,
|
|
2844
|
+
patch: 4
|
|
2534
2845
|
};
|
|
2535
2846
|
//#endregion
|
|
2536
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
2847
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/schemas.js
|
|
2537
2848
|
const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def) => {
|
|
2538
2849
|
var _a;
|
|
2539
2850
|
inst ?? (inst = {});
|
|
2540
2851
|
inst._zod.def = def;
|
|
2541
2852
|
inst._zod.bag = inst._zod.bag || {};
|
|
2542
2853
|
inst._zod.version = version;
|
|
2543
|
-
const
|
|
2544
|
-
|
|
2854
|
+
const defChecks = inst._zod.def.checks;
|
|
2855
|
+
const checks = inst._zod.traits.has("$ZodCheck") ? [inst, ...defChecks ?? []] : defChecks?.length ? [...defChecks] : [];
|
|
2545
2856
|
for (const ch of checks) for (const fn of ch._zod.onattach) fn(inst);
|
|
2546
2857
|
if (checks.length === 0) {
|
|
2547
2858
|
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
@@ -2550,6 +2861,7 @@ window.__ModuleLoader__.load({
|
|
|
2550
2861
|
});
|
|
2551
2862
|
} else {
|
|
2552
2863
|
const runChecks = (payload, checks, ctx) => {
|
|
2864
|
+
if (payload.memo) return payload;
|
|
2553
2865
|
let isAborted = aborted(payload);
|
|
2554
2866
|
let asyncResult;
|
|
2555
2867
|
for (const ch of checks) {
|
|
@@ -2563,10 +2875,12 @@ window.__ModuleLoader__.load({
|
|
|
2563
2875
|
if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
2564
2876
|
await _;
|
|
2565
2877
|
if (payload.issues.length === currLen) return;
|
|
2878
|
+
attachSchema(payload.issues, currLen, inst);
|
|
2566
2879
|
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
2567
2880
|
});
|
|
2568
2881
|
else {
|
|
2569
2882
|
if (payload.issues.length === currLen) continue;
|
|
2883
|
+
attachSchema(payload.issues, currLen, inst);
|
|
2570
2884
|
if (!isAborted) isAborted = aborted(payload, currLen);
|
|
2571
2885
|
}
|
|
2572
2886
|
}
|
|
@@ -2610,19 +2924,29 @@ window.__ModuleLoader__.load({
|
|
|
2610
2924
|
return runChecks(result, checks, ctx);
|
|
2611
2925
|
};
|
|
2612
2926
|
}
|
|
2613
|
-
|
|
2927
|
+
}, {
|
|
2928
|
+
get "~standard"() {
|
|
2929
|
+
return hide(this, "~standard", standardProps(this));
|
|
2930
|
+
},
|
|
2931
|
+
set "~standard"(value) {
|
|
2932
|
+
own(this, "~standard", value);
|
|
2933
|
+
}
|
|
2934
|
+
});
|
|
2935
|
+
/** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
|
|
2936
|
+
const toStandardResult = (r) => r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
2937
|
+
function standardProps(inst) {
|
|
2938
|
+
return {
|
|
2614
2939
|
validate: (value) => {
|
|
2615
2940
|
try {
|
|
2616
|
-
|
|
2617
|
-
return r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
2941
|
+
return toStandardResult(safeParse$1(inst, value));
|
|
2618
2942
|
} catch (_) {
|
|
2619
|
-
return safeParseAsync$1(inst, value).then(
|
|
2943
|
+
return safeParseAsync$1(inst, value).then(toStandardResult);
|
|
2620
2944
|
}
|
|
2621
2945
|
},
|
|
2622
2946
|
vendor: "zod",
|
|
2623
2947
|
version: 1
|
|
2624
|
-
}
|
|
2625
|
-
}
|
|
2948
|
+
};
|
|
2949
|
+
}
|
|
2626
2950
|
const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def) => {
|
|
2627
2951
|
$ZodType.init(inst, def);
|
|
2628
2952
|
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string$1(inst._zod.bag);
|
|
@@ -2669,51 +2993,74 @@ window.__ModuleLoader__.load({
|
|
|
2669
2993
|
def.pattern ?? (def.pattern = email);
|
|
2670
2994
|
$ZodStringFormat.init(inst, def);
|
|
2671
2995
|
});
|
|
2996
|
+
/** Parses a URL for `$ZodURL`, applying the one guard the URL constructor cannot express. Returns the parsed URL, or a code naming the stage that rejected it — the runtime needs that distinction to pick an issue note, and compiled code only needs to know it is not a URL. */
|
|
2997
|
+
function parseURLObject(trimmed, def) {
|
|
2998
|
+
if (!def.normalize && def.protocol?.source === httpProtocol.source && !/^https?:\/\//i.test(trimmed)) return 1;
|
|
2999
|
+
try {
|
|
3000
|
+
return new URL(trimmed);
|
|
3001
|
+
} catch {
|
|
3002
|
+
return 2;
|
|
3003
|
+
}
|
|
3004
|
+
}
|
|
3005
|
+
const asciiTabOrNewline = /[\t\n\r]/g;
|
|
3006
|
+
/** The URL parser deletes every ASCII tab, LF and CR from its input before it parses, so `new URL("https://exa\nmple.com")` reports on `example.com`. Applying the same deletion to the returned value closes the half of that divergence which can move the host; the parser's other rewrite, stripping C0 controls at the edges, cannot. */
|
|
3007
|
+
function stripTabAndNewline(value) {
|
|
3008
|
+
return value.replace(asciiTabOrNewline, "");
|
|
3009
|
+
}
|
|
3010
|
+
function urlHostnameOk(url, hostname) {
|
|
3011
|
+
hostname.lastIndex = 0;
|
|
3012
|
+
return hostname.test(url.hostname);
|
|
3013
|
+
}
|
|
3014
|
+
function urlProtocolOk(url, protocol) {
|
|
3015
|
+
protocol.lastIndex = 0;
|
|
3016
|
+
return protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol);
|
|
3017
|
+
}
|
|
2672
3018
|
const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def) => {
|
|
2673
3019
|
$ZodStringFormat.init(inst, def);
|
|
2674
3020
|
inst._zod.check = (payload) => {
|
|
2675
3021
|
try {
|
|
2676
3022
|
const trimmed = payload.value.trim();
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
code: "invalid_format",
|
|
2681
|
-
format: "url",
|
|
2682
|
-
note: "Invalid URL format",
|
|
2683
|
-
input: payload.value,
|
|
2684
|
-
inst,
|
|
2685
|
-
continue: !def.abort
|
|
2686
|
-
});
|
|
2687
|
-
return;
|
|
2688
|
-
}
|
|
2689
|
-
}
|
|
2690
|
-
const url = new URL(trimmed);
|
|
2691
|
-
if (def.hostname) {
|
|
2692
|
-
def.hostname.lastIndex = 0;
|
|
2693
|
-
if (!def.hostname.test(url.hostname)) payload.issues.push({
|
|
3023
|
+
const url = parseURLObject(trimmed, def);
|
|
3024
|
+
if (url === 1) {
|
|
3025
|
+
payload.issues.push({
|
|
2694
3026
|
code: "invalid_format",
|
|
2695
3027
|
format: "url",
|
|
2696
|
-
note: "Invalid
|
|
2697
|
-
pattern: def.hostname.source,
|
|
3028
|
+
note: "Invalid URL format",
|
|
2698
3029
|
input: payload.value,
|
|
2699
3030
|
inst,
|
|
2700
3031
|
continue: !def.abort
|
|
2701
3032
|
});
|
|
3033
|
+
return;
|
|
2702
3034
|
}
|
|
2703
|
-
if (
|
|
2704
|
-
|
|
2705
|
-
if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
|
|
3035
|
+
if (url === 2) {
|
|
3036
|
+
payload.issues.push({
|
|
2706
3037
|
code: "invalid_format",
|
|
2707
3038
|
format: "url",
|
|
2708
|
-
note: "Invalid protocol",
|
|
2709
|
-
pattern: def.protocol.source,
|
|
2710
3039
|
input: payload.value,
|
|
2711
3040
|
inst,
|
|
2712
3041
|
continue: !def.abort
|
|
2713
3042
|
});
|
|
3043
|
+
return;
|
|
2714
3044
|
}
|
|
2715
|
-
if (def.
|
|
2716
|
-
|
|
3045
|
+
if (def.hostname && !urlHostnameOk(url, def.hostname)) payload.issues.push({
|
|
3046
|
+
code: "invalid_format",
|
|
3047
|
+
format: "url",
|
|
3048
|
+
note: "Invalid hostname",
|
|
3049
|
+
pattern: def.hostname.source,
|
|
3050
|
+
input: payload.value,
|
|
3051
|
+
inst,
|
|
3052
|
+
continue: !def.abort
|
|
3053
|
+
});
|
|
3054
|
+
if (def.protocol && !urlProtocolOk(url, def.protocol)) payload.issues.push({
|
|
3055
|
+
code: "invalid_format",
|
|
3056
|
+
format: "url",
|
|
3057
|
+
note: "Invalid protocol",
|
|
3058
|
+
pattern: def.protocol.source,
|
|
3059
|
+
input: payload.value,
|
|
3060
|
+
inst,
|
|
3061
|
+
continue: !def.abort
|
|
3062
|
+
});
|
|
3063
|
+
payload.value = def.normalize ? url.href : stripTabAndNewline(trimmed);
|
|
2717
3064
|
return;
|
|
2718
3065
|
} catch (_) {
|
|
2719
3066
|
payload.issues.push({
|
|
@@ -2731,7 +3078,8 @@ window.__ModuleLoader__.load({
|
|
|
2731
3078
|
$ZodStringFormat.init(inst, def);
|
|
2732
3079
|
});
|
|
2733
3080
|
const $ZodNanoID = /*@__PURE__*/ $constructor("$ZodNanoID", (inst, def) => {
|
|
2734
|
-
def.
|
|
3081
|
+
if (def.length !== void 0 && (!Number.isInteger(def.length) || def.length < 1)) throw new Error(`Invalid nanoid length: ${def.length}`);
|
|
3082
|
+
def.pattern ?? (def.pattern = def.length === void 0 ? nanoid : nanoidOfLength(def.length));
|
|
2735
3083
|
$ZodStringFormat.init(inst, def);
|
|
2736
3084
|
});
|
|
2737
3085
|
/**
|
|
@@ -2760,19 +3108,25 @@ window.__ModuleLoader__.load({
|
|
|
2760
3108
|
$ZodStringFormat.init(inst, def);
|
|
2761
3109
|
});
|
|
2762
3110
|
const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def) => {
|
|
2763
|
-
def.pattern ?? (def.pattern = datetime
|
|
3111
|
+
def.pattern ?? (def.pattern = datetime(def));
|
|
2764
3112
|
$ZodStringFormat.init(inst, def);
|
|
3113
|
+
if (def.local || def.precision === -1) {
|
|
3114
|
+
inst._zod.bag.laxFormat = true;
|
|
3115
|
+
inst._zod.onattach.push((s) => {
|
|
3116
|
+
s._zod.bag.laxFormat = true;
|
|
3117
|
+
});
|
|
3118
|
+
}
|
|
2765
3119
|
});
|
|
2766
3120
|
const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def) => {
|
|
2767
|
-
def.pattern ?? (def.pattern = date
|
|
3121
|
+
def.pattern ?? (def.pattern = date);
|
|
2768
3122
|
$ZodStringFormat.init(inst, def);
|
|
2769
3123
|
});
|
|
2770
3124
|
const $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def) => {
|
|
2771
|
-
def.pattern ?? (def.pattern = time
|
|
3125
|
+
def.pattern ?? (def.pattern = time(def));
|
|
2772
3126
|
$ZodStringFormat.init(inst, def);
|
|
2773
3127
|
});
|
|
2774
3128
|
const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def) => {
|
|
2775
|
-
def.pattern ?? (def.pattern = duration
|
|
3129
|
+
def.pattern ?? (def.pattern = duration);
|
|
2776
3130
|
$ZodStringFormat.init(inst, def);
|
|
2777
3131
|
});
|
|
2778
3132
|
const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def) => {
|
|
@@ -2780,50 +3134,56 @@ window.__ModuleLoader__.load({
|
|
|
2780
3134
|
$ZodStringFormat.init(inst, def);
|
|
2781
3135
|
inst._zod.bag.format = `ipv4`;
|
|
2782
3136
|
});
|
|
3137
|
+
/** An IPv6 address is written with hex digits, colons and dots, and nothing else. The guard is what makes the check below an IPv6 check: `new URL("http://[...]")` parses an authority, not an address, so `@` and `\` re-delimit it and `"::@1\\"` validates against the host `0.0.0.1`. The URL parser also deletes ASCII tab, LF and CR rather than failing, which is how `"::1\n"` validated as `::1`. */
|
|
3138
|
+
const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
|
|
3139
|
+
function isValidIPv6(value) {
|
|
3140
|
+
if (!ipv6Alphabet.test(value)) return false;
|
|
3141
|
+
try {
|
|
3142
|
+
new URL(`http://[${value}]`);
|
|
3143
|
+
return true;
|
|
3144
|
+
} catch {
|
|
3145
|
+
return false;
|
|
3146
|
+
}
|
|
3147
|
+
}
|
|
2783
3148
|
const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def) => {
|
|
2784
3149
|
def.pattern ?? (def.pattern = ipv6);
|
|
2785
3150
|
$ZodStringFormat.init(inst, def);
|
|
2786
3151
|
inst._zod.bag.format = `ipv6`;
|
|
2787
3152
|
inst._zod.check = (payload) => {
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
payload.
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
inst,
|
|
2796
|
-
continue: !def.abort
|
|
2797
|
-
});
|
|
2798
|
-
}
|
|
3153
|
+
if (!isValidIPv6(payload.value)) payload.issues.push({
|
|
3154
|
+
code: "invalid_format",
|
|
3155
|
+
format: "ipv6",
|
|
3156
|
+
input: payload.value,
|
|
3157
|
+
inst,
|
|
3158
|
+
continue: !def.abort
|
|
3159
|
+
});
|
|
2799
3160
|
};
|
|
2800
3161
|
});
|
|
2801
3162
|
const $ZodCIDRv4 = /*@__PURE__*/ $constructor("$ZodCIDRv4", (inst, def) => {
|
|
2802
3163
|
def.pattern ?? (def.pattern = cidrv4);
|
|
2803
3164
|
$ZodStringFormat.init(inst, def);
|
|
2804
3165
|
});
|
|
3166
|
+
function isValidCIDRv6(value) {
|
|
3167
|
+
const parts = value.split("/");
|
|
3168
|
+
if (parts.length !== 2) return false;
|
|
3169
|
+
const [address, prefix] = parts;
|
|
3170
|
+
if (!prefix) return false;
|
|
3171
|
+
const prefixNum = Number(prefix);
|
|
3172
|
+
if (`${prefixNum}` !== prefix) return false;
|
|
3173
|
+
if (prefixNum < 0 || prefixNum > 128) return false;
|
|
3174
|
+
return isValidIPv6(address);
|
|
3175
|
+
}
|
|
2805
3176
|
const $ZodCIDRv6 = /*@__PURE__*/ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
2806
3177
|
def.pattern ?? (def.pattern = cidrv6);
|
|
2807
3178
|
$ZodStringFormat.init(inst, def);
|
|
2808
3179
|
inst._zod.check = (payload) => {
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
if (prefixNum < 0 || prefixNum > 128) throw new Error();
|
|
2817
|
-
new URL(`http://[${address}]`);
|
|
2818
|
-
} catch {
|
|
2819
|
-
payload.issues.push({
|
|
2820
|
-
code: "invalid_format",
|
|
2821
|
-
format: "cidrv6",
|
|
2822
|
-
input: payload.value,
|
|
2823
|
-
inst,
|
|
2824
|
-
continue: !def.abort
|
|
2825
|
-
});
|
|
2826
|
-
}
|
|
3180
|
+
if (!isValidCIDRv6(payload.value)) payload.issues.push({
|
|
3181
|
+
code: "invalid_format",
|
|
3182
|
+
format: "cidrv6",
|
|
3183
|
+
input: payload.value,
|
|
3184
|
+
inst,
|
|
3185
|
+
continue: !def.abort
|
|
3186
|
+
});
|
|
2827
3187
|
};
|
|
2828
3188
|
});
|
|
2829
3189
|
function isValidBase64(data) {
|
|
@@ -2913,7 +3273,7 @@ window.__ModuleLoader__.load({
|
|
|
2913
3273
|
} catch (_) {}
|
|
2914
3274
|
const input = payload.value;
|
|
2915
3275
|
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) return payload;
|
|
2916
|
-
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ?
|
|
3276
|
+
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? String(input) : void 0 : void 0;
|
|
2917
3277
|
payload.issues.push({
|
|
2918
3278
|
expected: "number",
|
|
2919
3279
|
code: "invalid_type",
|
|
@@ -2984,6 +3344,8 @@ window.__ModuleLoader__.load({
|
|
|
2984
3344
|
}
|
|
2985
3345
|
const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
|
|
2986
3346
|
$ZodType.init(inst, def);
|
|
3347
|
+
const memo = globalConfig.memoizer;
|
|
3348
|
+
memo?.attach(inst);
|
|
2987
3349
|
inst._zod.parse = (payload, ctx) => {
|
|
2988
3350
|
const input = payload.value;
|
|
2989
3351
|
if (!Array.isArray(input)) {
|
|
@@ -2995,7 +3357,7 @@ window.__ModuleLoader__.load({
|
|
|
2995
3357
|
});
|
|
2996
3358
|
return payload;
|
|
2997
3359
|
}
|
|
2998
|
-
payload.value = Array(input.length);
|
|
3360
|
+
payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
|
|
2999
3361
|
const proms = [];
|
|
3000
3362
|
for (let i = 0; i < input.length; i++) {
|
|
3001
3363
|
const item = input[i];
|
|
@@ -3010,13 +3372,15 @@ window.__ModuleLoader__.load({
|
|
|
3010
3372
|
return payload;
|
|
3011
3373
|
};
|
|
3012
3374
|
});
|
|
3013
|
-
function handlePropertyResult(result, final, key, input,
|
|
3375
|
+
function handlePropertyResult(result, final, key, input, optin, optout) {
|
|
3014
3376
|
const isPresent = key in input;
|
|
3377
|
+
const isOptionalOut = optout === "optional";
|
|
3378
|
+
if (!isPresent && isOptionalOut && optin === "optional") return;
|
|
3015
3379
|
if (result.issues.length) {
|
|
3016
|
-
if (
|
|
3380
|
+
if (optin !== void 0 && isOptionalOut && !isPresent) return;
|
|
3017
3381
|
final.issues.push(...prefixIssues(key, result.issues));
|
|
3018
3382
|
}
|
|
3019
|
-
if (!isPresent &&
|
|
3383
|
+
if (!isPresent && optin === void 0) {
|
|
3020
3384
|
if (!result.issues.length) final.issues.push({
|
|
3021
3385
|
code: "invalid_type",
|
|
3022
3386
|
expected: "nonoptional",
|
|
@@ -3029,13 +3393,18 @@ window.__ModuleLoader__.load({
|
|
|
3029
3393
|
if (isPresent) final.value[key] = void 0;
|
|
3030
3394
|
} else final.value[key] = result.value;
|
|
3031
3395
|
}
|
|
3396
|
+
const NO_SYMBOL_KEYS = [];
|
|
3032
3397
|
function normalizeDef(def) {
|
|
3033
3398
|
const keys = Object.keys(def.shape);
|
|
3034
|
-
|
|
3399
|
+
const ownSymbols = Object.getOwnPropertySymbols(def.shape);
|
|
3400
|
+
const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS;
|
|
3401
|
+
const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys;
|
|
3402
|
+
for (const k of allKeys) if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) throw new Error(`Invalid element at key "${String(k)}": expected a Zod schema`);
|
|
3035
3403
|
const okeys = optionalKeys(def.shape);
|
|
3036
3404
|
return {
|
|
3037
3405
|
...def,
|
|
3038
|
-
|
|
3406
|
+
allKeys,
|
|
3407
|
+
symbolKeys,
|
|
3039
3408
|
keySet: new Set(keys),
|
|
3040
3409
|
numKeys: keys.length,
|
|
3041
3410
|
optionalKeys: new Set(okeys)
|
|
@@ -3046,11 +3415,14 @@ window.__ModuleLoader__.load({
|
|
|
3046
3415
|
const keySet = def.keySet;
|
|
3047
3416
|
const _catchall = def.catchall._zod;
|
|
3048
3417
|
const t = _catchall.def.type;
|
|
3049
|
-
const
|
|
3050
|
-
const
|
|
3418
|
+
const optin = _catchall.optin;
|
|
3419
|
+
const optout = _catchall.optout;
|
|
3051
3420
|
for (const key in input) {
|
|
3052
|
-
if (key === "__proto__") continue;
|
|
3053
3421
|
if (keySet.has(key)) continue;
|
|
3422
|
+
if (key === "__proto__") {
|
|
3423
|
+
if (t === "never") unrecognized.push(key);
|
|
3424
|
+
continue;
|
|
3425
|
+
}
|
|
3054
3426
|
if (t === "never") {
|
|
3055
3427
|
unrecognized.push(key);
|
|
3056
3428
|
continue;
|
|
@@ -3059,39 +3431,44 @@ window.__ModuleLoader__.load({
|
|
|
3059
3431
|
value: input[key],
|
|
3060
3432
|
issues: []
|
|
3061
3433
|
}, ctx);
|
|
3062
|
-
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input,
|
|
3063
|
-
else handlePropertyResult(r, payload, key, input,
|
|
3434
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
|
|
3435
|
+
else handlePropertyResult(r, payload, key, input, optin, optout);
|
|
3064
3436
|
}
|
|
3065
3437
|
if (unrecognized.length) payload.issues.push({
|
|
3066
3438
|
code: "unrecognized_keys",
|
|
3067
3439
|
keys: unrecognized,
|
|
3068
3440
|
input,
|
|
3069
|
-
inst
|
|
3441
|
+
inst,
|
|
3442
|
+
continue: true
|
|
3070
3443
|
});
|
|
3071
3444
|
if (!proms.length) return payload;
|
|
3072
3445
|
return Promise.all(proms).then(() => {
|
|
3073
3446
|
return payload;
|
|
3074
3447
|
});
|
|
3075
3448
|
}
|
|
3449
|
+
const propShapes = /* @__PURE__ */ new WeakMap();
|
|
3076
3450
|
const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
|
|
3077
3451
|
$ZodType.init(inst, def);
|
|
3078
3452
|
if (!Object.getOwnPropertyDescriptor(def, "shape")?.get) {
|
|
3079
3453
|
const sh = def.shape;
|
|
3454
|
+
propShapes.set(def, sh);
|
|
3080
3455
|
Object.defineProperty(def, "shape", { get: () => {
|
|
3081
3456
|
const newSh = { ...sh };
|
|
3082
3457
|
Object.defineProperty(def, "shape", { value: newSh });
|
|
3458
|
+
propShapes.set(def, newSh);
|
|
3083
3459
|
return newSh;
|
|
3084
3460
|
} });
|
|
3085
3461
|
}
|
|
3086
3462
|
const _normalized = cached(() => normalizeDef(def));
|
|
3087
|
-
|
|
3088
|
-
const shape = def.shape;
|
|
3463
|
+
defineLazyInternal(inst, "propValues", (zod) => {
|
|
3464
|
+
const shape = zod.def.shape;
|
|
3089
3465
|
const propValues = {};
|
|
3090
3466
|
for (const key in shape) {
|
|
3091
3467
|
const field = shape[key]._zod;
|
|
3092
3468
|
if (field.values) {
|
|
3093
|
-
propValues
|
|
3469
|
+
if (!Object.prototype.hasOwnProperty.call(propValues, key)) assignProp(propValues, key, /* @__PURE__ */ new Set());
|
|
3094
3470
|
for (const v of field.values) propValues[key].add(v);
|
|
3471
|
+
if (field.optin !== void 0) propValues[key].add(void 0);
|
|
3095
3472
|
}
|
|
3096
3473
|
}
|
|
3097
3474
|
return propValues;
|
|
@@ -3099,6 +3476,8 @@ window.__ModuleLoader__.load({
|
|
|
3099
3476
|
const isObject$1 = isObject;
|
|
3100
3477
|
const catchall = def.catchall;
|
|
3101
3478
|
let value;
|
|
3479
|
+
const memo = globalConfig.memoizer;
|
|
3480
|
+
memo?.attach(inst);
|
|
3102
3481
|
inst._zod.parse = (payload, ctx) => {
|
|
3103
3482
|
value ?? (value = _normalized.value);
|
|
3104
3483
|
const input = payload.value;
|
|
@@ -3111,19 +3490,20 @@ window.__ModuleLoader__.load({
|
|
|
3111
3490
|
});
|
|
3112
3491
|
return payload;
|
|
3113
3492
|
}
|
|
3114
|
-
payload.value = {};
|
|
3493
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
3115
3494
|
const proms = [];
|
|
3116
3495
|
const shape = value.shape;
|
|
3117
|
-
for (const key of value.
|
|
3496
|
+
for (const key of value.allKeys) {
|
|
3497
|
+
if (key === "__proto__") continue;
|
|
3118
3498
|
const el = shape[key];
|
|
3119
|
-
const
|
|
3120
|
-
const
|
|
3499
|
+
const optin = el._zod.optin;
|
|
3500
|
+
const optout = el._zod.optout;
|
|
3121
3501
|
const r = el._zod.run({
|
|
3122
3502
|
value: input[key],
|
|
3123
3503
|
issues: []
|
|
3124
3504
|
}, ctx);
|
|
3125
|
-
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input,
|
|
3126
|
-
else handlePropertyResult(r, payload, key, input,
|
|
3505
|
+
if (r instanceof Promise) proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
|
|
3506
|
+
else handlePropertyResult(r, payload, key, input, optin, optout);
|
|
3127
3507
|
}
|
|
3128
3508
|
if (!catchall) return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
3129
3509
|
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
@@ -3133,55 +3513,55 @@ window.__ModuleLoader__.load({
|
|
|
3133
3513
|
$ZodObject.init(inst, def);
|
|
3134
3514
|
const superParse = inst._zod.parse;
|
|
3135
3515
|
const _normalized = cached(() => normalizeDef(def));
|
|
3516
|
+
const memo = globalConfig.memoizer;
|
|
3136
3517
|
const generateFastpass = (shape) => {
|
|
3137
|
-
const doc = new Doc([
|
|
3138
|
-
"shape",
|
|
3139
|
-
"payload",
|
|
3140
|
-
"ctx"
|
|
3141
|
-
]);
|
|
3142
3518
|
const normalized = _normalized.value;
|
|
3143
|
-
const
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3519
|
+
const syms = normalized.symbolKeys;
|
|
3520
|
+
const doc = new Doc(["payload", "ctx"], {
|
|
3521
|
+
shape,
|
|
3522
|
+
inst,
|
|
3523
|
+
memo,
|
|
3524
|
+
syms
|
|
3525
|
+
});
|
|
3526
|
+
const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
3527
|
+
const prefixStr = (id, k) => `
|
|
3528
|
+
for (let i = 0; i < ${id}.issues.length; i++) {
|
|
3529
|
+
const iss = ${id}.issues[i];
|
|
3530
|
+
iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
|
|
3531
|
+
payload.issues.push(iss);
|
|
3532
|
+
}`;
|
|
3147
3533
|
doc.write(`const input = payload.value;`);
|
|
3148
3534
|
const ids = Object.create(null);
|
|
3149
3535
|
let counter = 0;
|
|
3150
|
-
for (const key of normalized.
|
|
3151
|
-
doc.write(`const newResult = {};`);
|
|
3152
|
-
for (const key of normalized.
|
|
3536
|
+
for (const key of normalized.allKeys) ids[key] = `key_${counter++}`;
|
|
3537
|
+
doc.write(memo ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`);
|
|
3538
|
+
for (const key of normalized.allKeys) {
|
|
3539
|
+
if (key === "__proto__") continue;
|
|
3153
3540
|
const id = ids[key];
|
|
3154
|
-
const k = esc(key);
|
|
3541
|
+
const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : esc(key);
|
|
3542
|
+
const isPresent = `${k} in input`;
|
|
3155
3543
|
const schema = shape[key];
|
|
3156
|
-
const
|
|
3544
|
+
const optin = schema?._zod?.optin;
|
|
3545
|
+
const isOptionalIn = optin !== void 0;
|
|
3157
3546
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
3158
|
-
doc.write(`const ${id} = ${parseStr(
|
|
3159
|
-
if (isOptionalIn && isOptionalOut)
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
})));
|
|
3547
|
+
doc.write(`const ${id} = ${parseStr(k)};`);
|
|
3548
|
+
if (isOptionalIn && isOptionalOut) {
|
|
3549
|
+
const assign = optin === "optional" ? `${id}_present` : `${id}.value !== undefined || ${id}_present`;
|
|
3550
|
+
doc.write(`
|
|
3551
|
+
const ${id}_present = ${isPresent};
|
|
3552
|
+
if (!${id}.issues.length || ${id}_present) {
|
|
3553
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
3166
3554
|
}
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
if (${k} in input) {
|
|
3171
|
-
newResult[${k}] = undefined;
|
|
3555
|
+
|
|
3556
|
+
if (${assign}) {
|
|
3557
|
+
newResult[${k}] = ${id}.value;
|
|
3172
3558
|
}
|
|
3173
|
-
} else {
|
|
3174
|
-
newResult[${k}] = ${id}.value;
|
|
3175
3559
|
}
|
|
3176
|
-
|
|
3560
|
+
|
|
3177
3561
|
`);
|
|
3178
|
-
else if (!isOptionalIn) doc.write(`
|
|
3179
|
-
const ${id}_present = ${
|
|
3180
|
-
if (${id}.issues.length) {
|
|
3181
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
3182
|
-
...iss,
|
|
3183
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
3184
|
-
})));
|
|
3562
|
+
} else if (!isOptionalIn) doc.write(`
|
|
3563
|
+
const ${id}_present = ${isPresent};
|
|
3564
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
3185
3565
|
}
|
|
3186
3566
|
if (!${id}_present && !${id}.issues.length) {
|
|
3187
3567
|
payload.issues.push({
|
|
@@ -3193,36 +3573,27 @@ window.__ModuleLoader__.load({
|
|
|
3193
3573
|
}
|
|
3194
3574
|
|
|
3195
3575
|
if (${id}_present) {
|
|
3196
|
-
|
|
3197
|
-
newResult[${k}] = undefined;
|
|
3198
|
-
} else {
|
|
3199
|
-
newResult[${k}] = ${id}.value;
|
|
3200
|
-
}
|
|
3576
|
+
newResult[${k}] = ${id}.value;
|
|
3201
3577
|
}
|
|
3202
3578
|
|
|
3203
3579
|
`);
|
|
3204
3580
|
else doc.write(`
|
|
3205
|
-
if (${id}.issues.length) {
|
|
3206
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
3207
|
-
...iss,
|
|
3208
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
3209
|
-
})));
|
|
3581
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
3210
3582
|
}
|
|
3211
3583
|
|
|
3212
3584
|
if (${id}.value === undefined) {
|
|
3213
|
-
if (${
|
|
3585
|
+
if (${isPresent}) {
|
|
3214
3586
|
newResult[${k}] = undefined;
|
|
3215
3587
|
}
|
|
3216
3588
|
} else {
|
|
3217
3589
|
newResult[${k}] = ${id}.value;
|
|
3218
3590
|
}
|
|
3219
|
-
|
|
3591
|
+
|
|
3220
3592
|
`);
|
|
3221
3593
|
}
|
|
3222
3594
|
doc.write(`payload.value = newResult;`);
|
|
3223
3595
|
doc.write(`return payload;`);
|
|
3224
|
-
|
|
3225
|
-
return (payload, ctx) => fn(shape, payload, ctx);
|
|
3596
|
+
return doc.compile();
|
|
3226
3597
|
};
|
|
3227
3598
|
let fastpass;
|
|
3228
3599
|
const isObject$2 = isObject;
|
|
@@ -3271,14 +3642,14 @@ window.__ModuleLoader__.load({
|
|
|
3271
3642
|
}
|
|
3272
3643
|
const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
|
|
3273
3644
|
$ZodType.init(inst, def);
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
if (def.options.every((o) => o._zod.values)) return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
3645
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.options.some((o) => o._zod.optin === "defaulted") ? "defaulted" : zod.def.options.some((o) => o._zod.optin !== void 0) ? "optional" : void 0);
|
|
3646
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
|
|
3647
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
3648
|
+
if (zod.def.options.every((o) => o._zod.values)) return new Set(zod.def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
3278
3649
|
});
|
|
3279
|
-
|
|
3280
|
-
if (def.options.every((o) => o._zod.pattern)) {
|
|
3281
|
-
const patterns = def.options.map((o) => o._zod.pattern);
|
|
3650
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
3651
|
+
if (zod.def.options.every((o) => o._zod.pattern)) {
|
|
3652
|
+
const patterns = zod.def.options.map((o) => o._zod.pattern);
|
|
3282
3653
|
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
3283
3654
|
}
|
|
3284
3655
|
});
|
|
@@ -3340,7 +3711,9 @@ window.__ModuleLoader__.load({
|
|
|
3340
3711
|
...a,
|
|
3341
3712
|
...b
|
|
3342
3713
|
};
|
|
3714
|
+
if (Object.prototype.hasOwnProperty.call(newObj, "__proto__")) delete newObj.__proto__;
|
|
3343
3715
|
for (const key of sharedKeys) {
|
|
3716
|
+
if (key === "__proto__") continue;
|
|
3344
3717
|
const sharedValue = mergeValues(a[key], b[key]);
|
|
3345
3718
|
if (!sharedValue.valid) return {
|
|
3346
3719
|
valid: false,
|
|
@@ -3382,26 +3755,39 @@ window.__ModuleLoader__.load({
|
|
|
3382
3755
|
function handleIntersectionResults(result, left, right) {
|
|
3383
3756
|
const unrecKeys = /* @__PURE__ */ new Map();
|
|
3384
3757
|
let unrecIssue;
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3758
|
+
const keyIssues = /* @__PURE__ */ new Map();
|
|
3759
|
+
const collect = (iss, side) => {
|
|
3760
|
+
let keys;
|
|
3761
|
+
if (iss.code === "unrecognized_keys" && !iss.path?.length) {
|
|
3762
|
+
unrecIssue ?? (unrecIssue = iss);
|
|
3763
|
+
keys = iss.keys;
|
|
3764
|
+
} else if (iss.code === "invalid_key" && iss.origin === "record" && iss.path?.length === 1) {
|
|
3765
|
+
const k = String(iss.path[0]);
|
|
3766
|
+
if (!keyIssues.has(k)) keyIssues.set(k, iss);
|
|
3767
|
+
keys = [k];
|
|
3768
|
+
} else return false;
|
|
3769
|
+
for (const k of keys) {
|
|
3388
3770
|
if (!unrecKeys.has(k)) unrecKeys.set(k, {});
|
|
3389
|
-
unrecKeys.get(k)
|
|
3771
|
+
unrecKeys.get(k)[side] = true;
|
|
3390
3772
|
}
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
}
|
|
3396
|
-
else result.issues.push(iss);
|
|
3773
|
+
return true;
|
|
3774
|
+
};
|
|
3775
|
+
for (const iss of left.issues) if (!collect(iss, "l")) result.issues.push(iss);
|
|
3776
|
+
for (const iss of right.issues) if (!collect(iss, "r")) result.issues.push(iss);
|
|
3397
3777
|
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
3398
|
-
if (bothKeys.length
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3778
|
+
if (bothKeys.length) {
|
|
3779
|
+
const aggregated = unrecIssue ? bothKeys.filter((k) => unrecIssue.keys.includes(k)) : [];
|
|
3780
|
+
if (aggregated.length) result.issues.push({
|
|
3781
|
+
...unrecIssue,
|
|
3782
|
+
keys: aggregated
|
|
3783
|
+
});
|
|
3784
|
+
for (const k of bothKeys) if (!aggregated.includes(k) && keyIssues.has(k)) result.issues.push(keyIssues.get(k));
|
|
3785
|
+
}
|
|
3403
3786
|
const merged = mergeValues(left.value, right.value);
|
|
3404
|
-
if (!merged.valid)
|
|
3787
|
+
if (!merged.valid) {
|
|
3788
|
+
if (aborted(result)) return result;
|
|
3789
|
+
throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
|
|
3790
|
+
}
|
|
3405
3791
|
result.value = merged.data;
|
|
3406
3792
|
return result;
|
|
3407
3793
|
}
|
|
@@ -3410,7 +3796,8 @@ window.__ModuleLoader__.load({
|
|
|
3410
3796
|
const values = getEnumValues(def.entries);
|
|
3411
3797
|
const valuesSet = new Set(values);
|
|
3412
3798
|
inst._zod.values = valuesSet;
|
|
3413
|
-
|
|
3799
|
+
const patternValues = values.filter((k) => propertyKeyTypes.has(typeof k));
|
|
3800
|
+
inst._zod.pattern = new RegExp(patternValues.length ? `^(${patternValues.map((o) => escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
|
|
3414
3801
|
inst._zod.parse = (payload, _ctx) => {
|
|
3415
3802
|
const input = payload.value;
|
|
3416
3803
|
if (valuesSet.has(input)) return payload;
|
|
@@ -3425,10 +3812,9 @@ window.__ModuleLoader__.load({
|
|
|
3425
3812
|
});
|
|
3426
3813
|
const $ZodLiteral = /*@__PURE__*/ $constructor("$ZodLiteral", (inst, def) => {
|
|
3427
3814
|
$ZodType.init(inst, def);
|
|
3428
|
-
if (def.values.length === 0) throw new Error("Cannot create literal schema with no valid values");
|
|
3429
3815
|
const values = new Set(def.values);
|
|
3430
3816
|
inst._zod.values = values;
|
|
3431
|
-
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
3817
|
+
inst._zod.pattern = new RegExp(def.values.length ? `^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$` : "^[^\\s\\S]$");
|
|
3432
3818
|
inst._zod.parse = (payload, _ctx) => {
|
|
3433
3819
|
const input = payload.value;
|
|
3434
3820
|
if (values.has(input)) return payload;
|
|
@@ -3444,67 +3830,66 @@ window.__ModuleLoader__.load({
|
|
|
3444
3830
|
const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) => {
|
|
3445
3831
|
$ZodType.init(inst, def);
|
|
3446
3832
|
inst._zod.optin = "optional";
|
|
3833
|
+
globalConfig.memoizer?.guard(inst);
|
|
3447
3834
|
inst._zod.parse = (payload, ctx) => {
|
|
3448
3835
|
if (ctx.direction === "backward") throw new $ZodEncodeError(inst.constructor.name);
|
|
3449
3836
|
const _out = def.transform(payload.value, payload);
|
|
3450
3837
|
if (ctx.async) return (_out instanceof Promise ? _out : Promise.resolve(_out)).then((output) => {
|
|
3451
3838
|
payload.value = output;
|
|
3452
|
-
payload.fallback = true;
|
|
3453
3839
|
return payload;
|
|
3454
3840
|
});
|
|
3455
3841
|
if (_out instanceof Promise) throw new $ZodAsyncError();
|
|
3456
3842
|
payload.value = _out;
|
|
3457
|
-
payload.fallback = true;
|
|
3458
3843
|
return payload;
|
|
3459
3844
|
};
|
|
3460
3845
|
});
|
|
3461
|
-
function handleOptionalResult(
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
value: void 0
|
|
3465
|
-
};
|
|
3466
|
-
return result;
|
|
3846
|
+
function handleOptionalResult(payload, result) {
|
|
3847
|
+
payload.value = result.issues.length ? void 0 : result.value;
|
|
3848
|
+
return payload;
|
|
3467
3849
|
}
|
|
3468
3850
|
const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
|
|
3469
3851
|
$ZodType.init(inst, def);
|
|
3470
|
-
inst._zod.optin
|
|
3852
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
3471
3853
|
inst._zod.optout = "optional";
|
|
3472
|
-
|
|
3473
|
-
|
|
3854
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
3855
|
+
const values = zod.def.innerType._zod.values;
|
|
3856
|
+
return values ? /* @__PURE__ */ new Set([...values, void 0]) : void 0;
|
|
3474
3857
|
});
|
|
3475
|
-
|
|
3476
|
-
const pattern = def.innerType._zod.pattern;
|
|
3858
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
3859
|
+
const pattern = zod.def.innerType._zod.pattern;
|
|
3477
3860
|
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
3478
3861
|
});
|
|
3479
3862
|
inst._zod.parse = (payload, ctx) => {
|
|
3480
|
-
if (
|
|
3481
|
-
|
|
3482
|
-
const result = def.innerType._zod.run(
|
|
3483
|
-
|
|
3484
|
-
|
|
3863
|
+
if (payload.value === void 0) {
|
|
3864
|
+
if (def.innerType._zod.optin !== "defaulted") return payload;
|
|
3865
|
+
const result = def.innerType._zod.run({
|
|
3866
|
+
value: payload.value,
|
|
3867
|
+
issues: []
|
|
3868
|
+
}, ctx);
|
|
3869
|
+
if (result instanceof Promise) return result.then((result) => handleOptionalResult(payload, result));
|
|
3870
|
+
return handleOptionalResult(payload, result);
|
|
3485
3871
|
}
|
|
3486
|
-
if (payload.value === void 0) return payload;
|
|
3487
3872
|
return def.innerType._zod.run(payload, ctx);
|
|
3488
3873
|
};
|
|
3489
3874
|
});
|
|
3490
3875
|
const $ZodExactOptional = /*@__PURE__*/ $constructor("$ZodExactOptional", (inst, def) => {
|
|
3491
3876
|
$ZodOptional.init(inst, def);
|
|
3492
|
-
|
|
3493
|
-
|
|
3877
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
3878
|
+
defineLazyInternal(inst, "pattern", (zod) => zod.def.innerType._zod.pattern);
|
|
3494
3879
|
inst._zod.parse = (payload, ctx) => {
|
|
3495
3880
|
return def.innerType._zod.run(payload, ctx);
|
|
3496
3881
|
};
|
|
3497
3882
|
});
|
|
3498
3883
|
const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def) => {
|
|
3499
3884
|
$ZodType.init(inst, def);
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
const pattern = def.innerType._zod.pattern;
|
|
3885
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin);
|
|
3886
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
|
|
3887
|
+
defineLazyInternal(inst, "pattern", (zod) => {
|
|
3888
|
+
const pattern = zod.def.innerType._zod.pattern;
|
|
3504
3889
|
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
|
|
3505
3890
|
});
|
|
3506
|
-
|
|
3507
|
-
return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
|
|
3891
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
3892
|
+
return zod.def.innerType._zod.values ? /* @__PURE__ */ new Set([...zod.def.innerType._zod.values, null]) : void 0;
|
|
3508
3893
|
});
|
|
3509
3894
|
inst._zod.parse = (payload, ctx) => {
|
|
3510
3895
|
if (payload.value === null) return payload;
|
|
@@ -3513,8 +3898,8 @@ window.__ModuleLoader__.load({
|
|
|
3513
3898
|
});
|
|
3514
3899
|
const $ZodDefault = /*@__PURE__*/ $constructor("$ZodDefault", (inst, def) => {
|
|
3515
3900
|
$ZodType.init(inst, def);
|
|
3516
|
-
inst._zod.optin = "
|
|
3517
|
-
|
|
3901
|
+
inst._zod.optin = "defaulted";
|
|
3902
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
3518
3903
|
inst._zod.parse = (payload, ctx) => {
|
|
3519
3904
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
3520
3905
|
if (payload.value === void 0) {
|
|
@@ -3535,8 +3920,8 @@ window.__ModuleLoader__.load({
|
|
|
3535
3920
|
}
|
|
3536
3921
|
const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def) => {
|
|
3537
3922
|
$ZodType.init(inst, def);
|
|
3538
|
-
inst._zod.optin = "
|
|
3539
|
-
|
|
3923
|
+
inst._zod.optin = "defaulted";
|
|
3924
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
3540
3925
|
inst._zod.parse = (payload, ctx) => {
|
|
3541
3926
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
3542
3927
|
if (payload.value === void 0) payload.value = def.defaultValue;
|
|
@@ -3545,8 +3930,8 @@ window.__ModuleLoader__.load({
|
|
|
3545
3930
|
});
|
|
3546
3931
|
const $ZodNonOptional = /*@__PURE__*/ $constructor("$ZodNonOptional", (inst, def) => {
|
|
3547
3932
|
$ZodType.init(inst, def);
|
|
3548
|
-
|
|
3549
|
-
const v = def.innerType._zod.values;
|
|
3933
|
+
defineLazyInternal(inst, "values", (zod) => {
|
|
3934
|
+
const v = zod.def.innerType._zod.values;
|
|
3550
3935
|
return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
|
|
3551
3936
|
});
|
|
3552
3937
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -3564,46 +3949,41 @@ window.__ModuleLoader__.load({
|
|
|
3564
3949
|
});
|
|
3565
3950
|
return payload;
|
|
3566
3951
|
}
|
|
3952
|
+
function handleCatchResult(payload, result, def, ctx) {
|
|
3953
|
+
if (!result.issues.length) {
|
|
3954
|
+
payload.value = result.value;
|
|
3955
|
+
if (result.memo) payload.memo = true;
|
|
3956
|
+
return payload;
|
|
3957
|
+
}
|
|
3958
|
+
payload.value = def.catchValue({
|
|
3959
|
+
...result,
|
|
3960
|
+
value: payload.value,
|
|
3961
|
+
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
3962
|
+
input: payload.value
|
|
3963
|
+
});
|
|
3964
|
+
return payload;
|
|
3965
|
+
}
|
|
3567
3966
|
const $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def) => {
|
|
3568
3967
|
$ZodType.init(inst, def);
|
|
3569
|
-
inst._zod.optin
|
|
3570
|
-
|
|
3571
|
-
|
|
3968
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
3969
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
|
|
3970
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
3572
3971
|
inst._zod.parse = (payload, ctx) => {
|
|
3573
3972
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
3574
|
-
const result = def.innerType._zod.run(
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
3581
|
-
input: payload.value
|
|
3582
|
-
});
|
|
3583
|
-
payload.issues = [];
|
|
3584
|
-
payload.fallback = true;
|
|
3585
|
-
}
|
|
3586
|
-
return payload;
|
|
3587
|
-
});
|
|
3588
|
-
payload.value = result.value;
|
|
3589
|
-
if (result.issues.length) {
|
|
3590
|
-
payload.value = def.catchValue({
|
|
3591
|
-
...payload,
|
|
3592
|
-
error: { issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config())) },
|
|
3593
|
-
input: payload.value
|
|
3594
|
-
});
|
|
3595
|
-
payload.issues = [];
|
|
3596
|
-
payload.fallback = true;
|
|
3597
|
-
}
|
|
3598
|
-
return payload;
|
|
3973
|
+
const result = def.innerType._zod.run({
|
|
3974
|
+
value: payload.value,
|
|
3975
|
+
issues: []
|
|
3976
|
+
}, ctx);
|
|
3977
|
+
if (result instanceof Promise) return result.then((result) => handleCatchResult(payload, result, def, ctx));
|
|
3978
|
+
return handleCatchResult(payload, result, def, ctx);
|
|
3599
3979
|
};
|
|
3600
3980
|
});
|
|
3601
3981
|
const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => {
|
|
3602
3982
|
$ZodType.init(inst, def);
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3983
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
|
|
3984
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
|
|
3985
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
|
|
3986
|
+
defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
|
|
3607
3987
|
inst._zod.parse = (payload, ctx) => {
|
|
3608
3988
|
if (ctx.direction === "backward") {
|
|
3609
3989
|
const right = def.out._zod.run(payload, ctx);
|
|
@@ -3616,22 +3996,21 @@ window.__ModuleLoader__.load({
|
|
|
3616
3996
|
};
|
|
3617
3997
|
});
|
|
3618
3998
|
function handlePipeResult(left, next, ctx) {
|
|
3619
|
-
if (left.issues.
|
|
3999
|
+
if (left.issues.some((iss) => iss.code !== "unrecognized_keys")) {
|
|
3620
4000
|
left.aborted = true;
|
|
3621
4001
|
return left;
|
|
3622
4002
|
}
|
|
3623
4003
|
return next._zod.run({
|
|
3624
4004
|
value: left.value,
|
|
3625
|
-
issues: left.issues
|
|
3626
|
-
fallback: left.fallback
|
|
4005
|
+
issues: left.issues
|
|
3627
4006
|
}, ctx);
|
|
3628
4007
|
}
|
|
3629
4008
|
const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def) => {
|
|
3630
4009
|
$ZodType.init(inst, def);
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
4010
|
+
defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
|
|
4011
|
+
defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
4012
|
+
defineLazyInternal(inst, "optin", (zod) => zod.def.innerType?._zod?.optin);
|
|
4013
|
+
defineLazyInternal(inst, "optout", (zod) => zod.def.innerType?._zod?.optout);
|
|
3635
4014
|
inst._zod.parse = (payload, ctx) => {
|
|
3636
4015
|
if (ctx.direction === "backward") return def.innerType._zod.run(payload, ctx);
|
|
3637
4016
|
const result = def.innerType._zod.run(payload, ctx);
|
|
@@ -3640,37 +4019,362 @@ window.__ModuleLoader__.load({
|
|
|
3640
4019
|
};
|
|
3641
4020
|
});
|
|
3642
4021
|
function handleReadonlyResult(payload) {
|
|
3643
|
-
payload.value = Object.freeze(payload.value);
|
|
4022
|
+
if (!payload.memo) payload.value = Object.freeze(payload.value);
|
|
3644
4023
|
return payload;
|
|
3645
4024
|
}
|
|
3646
|
-
const $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => {
|
|
3647
|
-
$ZodCheck.init(inst, def);
|
|
3648
|
-
$ZodType.init(inst, def);
|
|
3649
|
-
inst._zod.parse = (payload, _) => {
|
|
3650
|
-
return payload;
|
|
4025
|
+
const $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def) => {
|
|
4026
|
+
$ZodCheck.init(inst, def);
|
|
4027
|
+
$ZodType.init(inst, def);
|
|
4028
|
+
inst._zod.parse = (payload, _) => {
|
|
4029
|
+
return payload;
|
|
4030
|
+
};
|
|
4031
|
+
inst._zod.check = (payload) => {
|
|
4032
|
+
const input = payload.value;
|
|
4033
|
+
const r = def.fn(input);
|
|
4034
|
+
if (r instanceof Promise) return r.then((r) => handleRefineResult(r, payload, input, inst));
|
|
4035
|
+
handleRefineResult(r, payload, input, inst);
|
|
4036
|
+
};
|
|
4037
|
+
});
|
|
4038
|
+
function handleRefineResult(result, payload, input, inst) {
|
|
4039
|
+
if (!result) {
|
|
4040
|
+
const _iss = {
|
|
4041
|
+
code: "custom",
|
|
4042
|
+
input,
|
|
4043
|
+
inst,
|
|
4044
|
+
path: [...inst._zod.def.path ?? []],
|
|
4045
|
+
continue: !inst._zod.def.abort
|
|
4046
|
+
};
|
|
4047
|
+
if (inst._zod.def.params) _iss.params = inst._zod.def.params;
|
|
4048
|
+
payload.issues.push(issue(_iss));
|
|
4049
|
+
}
|
|
4050
|
+
}
|
|
4051
|
+
//#endregion
|
|
4052
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/memoizer.js
|
|
4053
|
+
var $ZodCyclicError = class extends Error {
|
|
4054
|
+
constructor() {
|
|
4055
|
+
super(`Cannot parse a reference cycle that closes through a transform`);
|
|
4056
|
+
this.name = "ZodCyclicError";
|
|
4057
|
+
}
|
|
4058
|
+
};
|
|
4059
|
+
/** Keyed off the context object every schema in one parse call already shares. */
|
|
4060
|
+
const STATE = "~memo";
|
|
4061
|
+
const NO_ISSUES = [];
|
|
4062
|
+
function cloneIssues(issues) {
|
|
4063
|
+
return issues.map((iss) => iss.path ? {
|
|
4064
|
+
...iss,
|
|
4065
|
+
path: iss.path.slice()
|
|
4066
|
+
} : { ...iss });
|
|
4067
|
+
}
|
|
4068
|
+
const recursive = /*@__PURE__*/ new WeakMap();
|
|
4069
|
+
/** Whether this schema's subtree contains a cycle, so one parse can re-enter it. */
|
|
4070
|
+
function isRecursive(inst, stack) {
|
|
4071
|
+
const cached = recursive.get(inst);
|
|
4072
|
+
if (cached !== void 0) return cached;
|
|
4073
|
+
if (stack.has(inst)) return true;
|
|
4074
|
+
stack.add(inst);
|
|
4075
|
+
let result = false;
|
|
4076
|
+
const check = (child) => {
|
|
4077
|
+
if (!result && child?._zod && isRecursive(child, stack)) result = true;
|
|
4078
|
+
};
|
|
4079
|
+
const def = inst._zod.def;
|
|
4080
|
+
switch (def.type) {
|
|
4081
|
+
case "object":
|
|
4082
|
+
for (const key of Reflect.ownKeys(def.shape)) check(def.shape[key]);
|
|
4083
|
+
check(def.catchall);
|
|
4084
|
+
break;
|
|
4085
|
+
case "array":
|
|
4086
|
+
check(def.element);
|
|
4087
|
+
break;
|
|
4088
|
+
case "tuple":
|
|
4089
|
+
for (const el of def.items) check(el);
|
|
4090
|
+
check(def.rest);
|
|
4091
|
+
break;
|
|
4092
|
+
case "record":
|
|
4093
|
+
case "map":
|
|
4094
|
+
check(def.keyType);
|
|
4095
|
+
check(def.valueType);
|
|
4096
|
+
break;
|
|
4097
|
+
case "set":
|
|
4098
|
+
check(def.valueType);
|
|
4099
|
+
break;
|
|
4100
|
+
case "union":
|
|
4101
|
+
for (const el of def.options) check(el);
|
|
4102
|
+
break;
|
|
4103
|
+
case "intersection":
|
|
4104
|
+
check(def.left);
|
|
4105
|
+
check(def.right);
|
|
4106
|
+
break;
|
|
4107
|
+
case "optional":
|
|
4108
|
+
case "nullable":
|
|
4109
|
+
case "default":
|
|
4110
|
+
case "prefault":
|
|
4111
|
+
case "catch":
|
|
4112
|
+
case "readonly":
|
|
4113
|
+
case "nonoptional":
|
|
4114
|
+
case "promise":
|
|
4115
|
+
case "success":
|
|
4116
|
+
check(def.innerType);
|
|
4117
|
+
break;
|
|
4118
|
+
case "pipe":
|
|
4119
|
+
check(def.in);
|
|
4120
|
+
check(def.out);
|
|
4121
|
+
break;
|
|
4122
|
+
case "function":
|
|
4123
|
+
check(def.input);
|
|
4124
|
+
check(def.output);
|
|
4125
|
+
break;
|
|
4126
|
+
case "lazy":
|
|
4127
|
+
check(inst._zod.innerType);
|
|
4128
|
+
break;
|
|
4129
|
+
case "template_literal":
|
|
4130
|
+
case "string":
|
|
4131
|
+
case "number":
|
|
4132
|
+
case "int":
|
|
4133
|
+
case "boolean":
|
|
4134
|
+
case "bigint":
|
|
4135
|
+
case "symbol":
|
|
4136
|
+
case "undefined":
|
|
4137
|
+
case "null":
|
|
4138
|
+
case "void":
|
|
4139
|
+
case "never":
|
|
4140
|
+
case "any":
|
|
4141
|
+
case "unknown":
|
|
4142
|
+
case "date":
|
|
4143
|
+
case "nan":
|
|
4144
|
+
case "enum":
|
|
4145
|
+
case "literal":
|
|
4146
|
+
case "file":
|
|
4147
|
+
case "transform":
|
|
4148
|
+
case "custom": break;
|
|
4149
|
+
default: for (const key in def) {
|
|
4150
|
+
const desc = Object.getOwnPropertyDescriptor(def, key);
|
|
4151
|
+
if (!desc || desc.get) continue;
|
|
4152
|
+
const value = desc.value;
|
|
4153
|
+
if (!value || typeof value !== "object") continue;
|
|
4154
|
+
if (value._zod) check(value);
|
|
4155
|
+
else if (Array.isArray(value)) for (const el of value) check(el);
|
|
4156
|
+
}
|
|
4157
|
+
}
|
|
4158
|
+
stack.delete(inst);
|
|
4159
|
+
recursive.set(inst, result);
|
|
4160
|
+
return result;
|
|
4161
|
+
}
|
|
4162
|
+
function bucketFor(state, inst) {
|
|
4163
|
+
let bucket = state.buckets.get(inst);
|
|
4164
|
+
if (!bucket) {
|
|
4165
|
+
bucket = /* @__PURE__ */ new Map();
|
|
4166
|
+
state.buckets.set(inst, bucket);
|
|
4167
|
+
}
|
|
4168
|
+
return bucket;
|
|
4169
|
+
}
|
|
4170
|
+
let handoff;
|
|
4171
|
+
const open = [];
|
|
4172
|
+
const memo = {
|
|
4173
|
+
alloc(_inst, payload, empty) {
|
|
4174
|
+
const bucket = handoff;
|
|
4175
|
+
if (!bucket) return empty;
|
|
4176
|
+
handoff = void 0;
|
|
4177
|
+
const entry = {
|
|
4178
|
+
value: empty,
|
|
4179
|
+
issues: null
|
|
4180
|
+
};
|
|
4181
|
+
bucket.set(payload.value, entry);
|
|
4182
|
+
open.push(entry);
|
|
4183
|
+
return empty;
|
|
4184
|
+
},
|
|
4185
|
+
guard(inst) {
|
|
4186
|
+
var _a;
|
|
4187
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
4188
|
+
inst._zod.deferred.push(() => {
|
|
4189
|
+
const base = inst._zod.parse;
|
|
4190
|
+
const wrapped = (payload, ctx) => {
|
|
4191
|
+
if (ctx.direction !== "backward" && isBackEdge(ctx, payload.value)) throw new $ZodCyclicError();
|
|
4192
|
+
return base(payload, ctx);
|
|
4193
|
+
};
|
|
4194
|
+
inst._zod.parse = wrapped;
|
|
4195
|
+
if (inst._zod.run === base) inst._zod.run = wrapped;
|
|
4196
|
+
});
|
|
4197
|
+
},
|
|
4198
|
+
attach(inst) {
|
|
4199
|
+
var _a;
|
|
4200
|
+
let isRecursiveInst;
|
|
4201
|
+
let lastCtx;
|
|
4202
|
+
let lastBucket;
|
|
4203
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
4204
|
+
inst._zod.deferred.push(() => {
|
|
4205
|
+
const base = inst._zod.parse;
|
|
4206
|
+
const wrapped = (payload, ctx) => {
|
|
4207
|
+
if (isRecursiveInst === void 0) {
|
|
4208
|
+
isRecursiveInst = isRecursive(inst, /* @__PURE__ */ new Set());
|
|
4209
|
+
if (!isRecursiveInst) {
|
|
4210
|
+
inst._zod.parse = base;
|
|
4211
|
+
if (inst._zod.run === wrapped) inst._zod.run = base;
|
|
4212
|
+
return base(payload, ctx);
|
|
4213
|
+
}
|
|
4214
|
+
}
|
|
4215
|
+
const input = payload.value;
|
|
4216
|
+
if (input === null || typeof input !== "object") return base(payload, ctx);
|
|
4217
|
+
let state = ctx[STATE];
|
|
4218
|
+
if (!state) {
|
|
4219
|
+
state = {
|
|
4220
|
+
buckets: /* @__PURE__ */ new Map(),
|
|
4221
|
+
backEdges: void 0
|
|
4222
|
+
};
|
|
4223
|
+
ctx[STATE] = state;
|
|
4224
|
+
}
|
|
4225
|
+
let bucket;
|
|
4226
|
+
if (lastCtx === ctx) bucket = lastBucket;
|
|
4227
|
+
else {
|
|
4228
|
+
bucket = bucketFor(state, inst);
|
|
4229
|
+
lastCtx = ctx;
|
|
4230
|
+
lastBucket = bucket;
|
|
4231
|
+
}
|
|
4232
|
+
const hit = bucket.get(input);
|
|
4233
|
+
if (hit) {
|
|
4234
|
+
payload.value = hit.value;
|
|
4235
|
+
if (hit.issues) {
|
|
4236
|
+
if (hit.issues.length) payload.issues.push(...cloneIssues(hit.issues));
|
|
4237
|
+
} else {
|
|
4238
|
+
payload.memo = true;
|
|
4239
|
+
state.backEdges ?? (state.backEdges = /* @__PURE__ */ new Set());
|
|
4240
|
+
state.backEdges.add(hit.value);
|
|
4241
|
+
}
|
|
4242
|
+
return payload;
|
|
4243
|
+
}
|
|
4244
|
+
handoff = bucket;
|
|
4245
|
+
const depth = open.length;
|
|
4246
|
+
const result = base(payload, ctx);
|
|
4247
|
+
handoff = void 0;
|
|
4248
|
+
const entry = open.length > depth ? open.pop() : void 0;
|
|
4249
|
+
if (result instanceof Promise) return result.then((r) => {
|
|
4250
|
+
if (entry) entry.issues = r.issues.length ? cloneIssues(r.issues) : NO_ISSUES;
|
|
4251
|
+
return r;
|
|
4252
|
+
});
|
|
4253
|
+
if (entry) entry.issues = result.issues.length ? cloneIssues(result.issues) : NO_ISSUES;
|
|
4254
|
+
return result;
|
|
4255
|
+
};
|
|
4256
|
+
inst._zod.parse = wrapped;
|
|
4257
|
+
if (inst._zod.run === base) inst._zod.run = wrapped;
|
|
4258
|
+
});
|
|
4259
|
+
}
|
|
4260
|
+
};
|
|
4261
|
+
/** The memoizer that gives containers cycle support. `zod` installs it by default; `zod/mini` opts in with `config({ memoizer: memoizer() })`. */
|
|
4262
|
+
function memoizer() {
|
|
4263
|
+
return memo;
|
|
4264
|
+
}
|
|
4265
|
+
/** Whether this value is a node a back-edge resolved to before it finished. */
|
|
4266
|
+
function isBackEdge(ctx, value) {
|
|
4267
|
+
const backEdges = ctx[STATE]?.backEdges;
|
|
4268
|
+
return backEdges !== void 0 && value !== null && typeof value === "object" && backEdges.has(value);
|
|
4269
|
+
}
|
|
4270
|
+
//#endregion
|
|
4271
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/locales/en.js
|
|
4272
|
+
const error = () => {
|
|
4273
|
+
const Sizable = {
|
|
4274
|
+
string: {
|
|
4275
|
+
unit: "characters",
|
|
4276
|
+
verb: "to have"
|
|
4277
|
+
},
|
|
4278
|
+
file: {
|
|
4279
|
+
unit: "bytes",
|
|
4280
|
+
verb: "to have"
|
|
4281
|
+
},
|
|
4282
|
+
array: {
|
|
4283
|
+
unit: "items",
|
|
4284
|
+
verb: "to have"
|
|
4285
|
+
},
|
|
4286
|
+
set: {
|
|
4287
|
+
unit: "items",
|
|
4288
|
+
verb: "to have"
|
|
4289
|
+
},
|
|
4290
|
+
map: {
|
|
4291
|
+
unit: "entries",
|
|
4292
|
+
verb: "to have"
|
|
4293
|
+
}
|
|
3651
4294
|
};
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
4295
|
+
function getSizing(origin) {
|
|
4296
|
+
return Sizable[origin] ?? null;
|
|
4297
|
+
}
|
|
4298
|
+
const FormatDictionary = {
|
|
4299
|
+
regex: "input",
|
|
4300
|
+
email: "email address",
|
|
4301
|
+
url: "URL",
|
|
4302
|
+
emoji: "emoji",
|
|
4303
|
+
uuid: "UUID",
|
|
4304
|
+
uuidv4: "UUIDv4",
|
|
4305
|
+
uuidv6: "UUIDv6",
|
|
4306
|
+
nanoid: "nanoid",
|
|
4307
|
+
guid: "GUID",
|
|
4308
|
+
cuid: "cuid",
|
|
4309
|
+
cuid2: "cuid2",
|
|
4310
|
+
ulid: "ULID",
|
|
4311
|
+
xid: "XID",
|
|
4312
|
+
ksuid: "KSUID",
|
|
4313
|
+
datetime: "ISO datetime",
|
|
4314
|
+
date: "ISO date",
|
|
4315
|
+
time: "ISO time",
|
|
4316
|
+
duration: "ISO duration",
|
|
4317
|
+
ipv4: "IPv4 address",
|
|
4318
|
+
ipv6: "IPv6 address",
|
|
4319
|
+
mac: "MAC address",
|
|
4320
|
+
cidrv4: "IPv4 range",
|
|
4321
|
+
cidrv6: "IPv6 range",
|
|
4322
|
+
base64: "base64-encoded string",
|
|
4323
|
+
base64url: "base64url-encoded string",
|
|
4324
|
+
json_string: "JSON string",
|
|
4325
|
+
e164: "E.164 number",
|
|
4326
|
+
credit_card: "credit card number",
|
|
4327
|
+
jwt: "JWT",
|
|
4328
|
+
template_literal: "input"
|
|
3657
4329
|
};
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
code: "custom",
|
|
3663
|
-
input,
|
|
3664
|
-
inst,
|
|
3665
|
-
path: [...inst._zod.def.path ?? []],
|
|
3666
|
-
continue: !inst._zod.def.abort
|
|
3667
|
-
};
|
|
3668
|
-
if (inst._zod.def.params) _iss.params = inst._zod.def.params;
|
|
3669
|
-
payload.issues.push(issue(_iss));
|
|
4330
|
+
const TypeDictionary = { nan: "NaN" };
|
|
4331
|
+
function getTypeName(type, input) {
|
|
4332
|
+
if (type === "number" && typeof input === "number" && !Number.isFinite(input)) return String(input);
|
|
4333
|
+
return TypeDictionary[type] ?? type;
|
|
3670
4334
|
}
|
|
4335
|
+
return (issue) => {
|
|
4336
|
+
switch (issue.code) {
|
|
4337
|
+
case "invalid_type": return `Invalid input: expected ${getTypeName(issue.expected)}, received ${getTypeName(parsedType(issue.input), issue.input)}`;
|
|
4338
|
+
case "invalid_value":
|
|
4339
|
+
if (issue.values.length === 1) return `Invalid input: expected ${stringifyPrimitive(issue.values[0])}`;
|
|
4340
|
+
return `Invalid option: expected one of ${joinValues(issue.values, "|")}`;
|
|
4341
|
+
case "too_big": {
|
|
4342
|
+
const adj = issue.exact ? "exactly " : issue.inclusive ? "<=" : "<";
|
|
4343
|
+
const sizing = getSizing(issue.origin);
|
|
4344
|
+
if (sizing) return `Too big: expected ${issue.origin ?? "value"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
|
|
4345
|
+
return `Too big: expected ${issue.origin ?? "value"} to be ${adj}${issue.maximum.toString()}`;
|
|
4346
|
+
}
|
|
4347
|
+
case "too_small": {
|
|
4348
|
+
const adj = issue.exact ? "exactly " : issue.inclusive ? ">=" : ">";
|
|
4349
|
+
const sizing = getSizing(issue.origin);
|
|
4350
|
+
if (sizing) return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
4351
|
+
return `Too small: expected ${issue.origin} to be ${adj}${issue.minimum.toString()}`;
|
|
4352
|
+
}
|
|
4353
|
+
case "invalid_format": {
|
|
4354
|
+
const _issue = issue;
|
|
4355
|
+
if (_issue.format === "starts_with") return `Invalid string: must start with "${_issue.prefix}"`;
|
|
4356
|
+
if (_issue.format === "ends_with") return `Invalid string: must end with "${_issue.suffix}"`;
|
|
4357
|
+
if (_issue.format === "includes") return `Invalid string: must include "${_issue.includes}"`;
|
|
4358
|
+
if (_issue.format === "regex") return `Invalid string: must match pattern ${_issue.pattern}`;
|
|
4359
|
+
return `Invalid ${FormatDictionary[_issue.format] ?? issue.format}`;
|
|
4360
|
+
}
|
|
4361
|
+
case "not_multiple_of": return `Invalid number: must be a multiple of ${issue.divisor}`;
|
|
4362
|
+
case "unrecognized_keys": return `Unrecognized key${issue.keys.length > 1 ? "s" : ""}: ${joinValues(issue.keys, ", ")}`;
|
|
4363
|
+
case "invalid_key": return `Invalid key in ${issue.origin}`;
|
|
4364
|
+
case "invalid_union":
|
|
4365
|
+
if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) return `Invalid discriminator value. Expected ${issue.options.map((o) => `'${o}'`).join(" | ")}`;
|
|
4366
|
+
if (issue.inclusive === false) return "Invalid input: more than one option matched";
|
|
4367
|
+
return "Invalid input";
|
|
4368
|
+
case "invalid_element": return `Invalid value in ${issue.origin}`;
|
|
4369
|
+
default: return `Invalid input`;
|
|
4370
|
+
}
|
|
4371
|
+
};
|
|
4372
|
+
};
|
|
4373
|
+
function en_default() {
|
|
4374
|
+
return { localeError: error() };
|
|
3671
4375
|
}
|
|
3672
4376
|
//#endregion
|
|
3673
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
4377
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/registries.js
|
|
3674
4378
|
var _a;
|
|
3675
4379
|
var $ZodRegistry = class {
|
|
3676
4380
|
constructor() {
|
|
@@ -3717,7 +4421,7 @@ window.__ModuleLoader__.load({
|
|
|
3717
4421
|
(_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
|
|
3718
4422
|
const globalRegistry = globalThis.__zod_globalRegistry;
|
|
3719
4423
|
//#endregion
|
|
3720
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
4424
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/api.js
|
|
3721
4425
|
// @__NO_SIDE_EFFECTS__
|
|
3722
4426
|
function _string(Class, params) {
|
|
3723
4427
|
return new Class({
|
|
@@ -4209,7 +4913,7 @@ window.__ModuleLoader__.load({
|
|
|
4209
4913
|
const _issue = issue$2;
|
|
4210
4914
|
if (_issue.fatal) _issue.continue = false;
|
|
4211
4915
|
_issue.code ?? (_issue.code = "custom");
|
|
4212
|
-
|
|
4916
|
+
if (!("input" in _issue)) _issue.input = payload.value;
|
|
4213
4917
|
_issue.inst ?? (_issue.inst = ch);
|
|
4214
4918
|
_issue.continue ?? (_issue.continue = !ch._zod.def.abort);
|
|
4215
4919
|
payload.issues.push(issue(_issue));
|
|
@@ -4229,7 +4933,11 @@ window.__ModuleLoader__.load({
|
|
|
4229
4933
|
return ch;
|
|
4230
4934
|
}
|
|
4231
4935
|
//#endregion
|
|
4232
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
4936
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/to-json-schema.js
|
|
4937
|
+
function assignProps(target, ...sources) {
|
|
4938
|
+
for (const source of sources) for (const key of Reflect.ownKeys(source)) if (Object.prototype.propertyIsEnumerable.call(source, key)) assignProp(target, key, source[key]);
|
|
4939
|
+
return target;
|
|
4940
|
+
}
|
|
4233
4941
|
function initializeContext(params) {
|
|
4234
4942
|
let target = params?.target ?? "draft-2020-12";
|
|
4235
4943
|
if (target === "draft-4") target = "draft-04";
|
|
@@ -4243,11 +4951,31 @@ window.__ModuleLoader__.load({
|
|
|
4243
4951
|
io: params?.io ?? "output",
|
|
4244
4952
|
counter: 0,
|
|
4245
4953
|
seen: /* @__PURE__ */ new Map(),
|
|
4954
|
+
sharedDefsExtractedFor: void 0,
|
|
4955
|
+
sharedEmitDoneFor: void 0,
|
|
4246
4956
|
cycles: params?.cycles ?? "ref",
|
|
4247
4957
|
reused: params?.reused ?? "inline",
|
|
4958
|
+
intersections: [],
|
|
4959
|
+
deferred: [],
|
|
4248
4960
|
external: params?.external ?? void 0
|
|
4249
4961
|
};
|
|
4250
4962
|
}
|
|
4963
|
+
/**
|
|
4964
|
+
* Applies the `unrepresentable` setting at a site that has no JSON Schema equivalent. Throws
|
|
4965
|
+
* `message` unless the setting (or the handler's return value) says otherwise. Returns `true` if a
|
|
4966
|
+
* custom JSON Schema was written into `json`, in which case the caller must not write its own.
|
|
4967
|
+
*/
|
|
4968
|
+
function handleUnrepresentable(schema, ctx, json, params, message) {
|
|
4969
|
+
const result = typeof ctx.unrepresentable === "function" ? ctx.unrepresentable({
|
|
4970
|
+
zodSchema: schema,
|
|
4971
|
+
path: params.path,
|
|
4972
|
+
message
|
|
4973
|
+
}) : ctx.unrepresentable;
|
|
4974
|
+
if (result === "any") return false;
|
|
4975
|
+
if (result === void 0 || result === "throw") throw new Error(message);
|
|
4976
|
+
Object.assign(json, result);
|
|
4977
|
+
return true;
|
|
4978
|
+
}
|
|
4251
4979
|
function process(schema, ctx, _params = {
|
|
4252
4980
|
path: [],
|
|
4253
4981
|
schemaPath: []
|
|
@@ -4267,6 +4995,8 @@ window.__ModuleLoader__.load({
|
|
|
4267
4995
|
path: _params.path
|
|
4268
4996
|
};
|
|
4269
4997
|
ctx.seen.set(schema, result);
|
|
4998
|
+
ctx.sharedDefsExtractedFor = void 0;
|
|
4999
|
+
ctx.sharedEmitDoneFor = void 0;
|
|
4270
5000
|
const overrideSchema = schema._zod.toJSONSchema?.();
|
|
4271
5001
|
if (overrideSchema) result.schema = overrideSchema;
|
|
4272
5002
|
else {
|
|
@@ -4290,7 +5020,7 @@ window.__ModuleLoader__.load({
|
|
|
4290
5020
|
}
|
|
4291
5021
|
}
|
|
4292
5022
|
const meta = ctx.metadataRegistry.get(schema);
|
|
4293
|
-
if (meta)
|
|
5023
|
+
if (meta) assignProps(result.schema, meta);
|
|
4294
5024
|
if (ctx.io === "input" && isTransforming(schema)) {
|
|
4295
5025
|
delete result.schema.examples;
|
|
4296
5026
|
delete result.schema.default;
|
|
@@ -4299,9 +5029,13 @@ window.__ModuleLoader__.load({
|
|
|
4299
5029
|
delete result.schema._prefault;
|
|
4300
5030
|
return ctx.seen.get(schema).schema;
|
|
4301
5031
|
}
|
|
5032
|
+
function encodeJSONPointerSegment(segment) {
|
|
5033
|
+
return segment.replace(/~/g, "~0").replace(/\//g, "~1");
|
|
5034
|
+
}
|
|
4302
5035
|
function extractDefs(ctx, schema) {
|
|
4303
5036
|
const root = ctx.seen.get(schema);
|
|
4304
5037
|
if (!root) throw new Error("Unprocessed schema. This is a bug in Zod.");
|
|
5038
|
+
if (ctx.external && ctx.sharedDefsExtractedFor === ctx.external) return;
|
|
4305
5039
|
const idToSchema = /* @__PURE__ */ new Map();
|
|
4306
5040
|
for (const entry of ctx.seen.entries()) {
|
|
4307
5041
|
const id = ctx.metadataRegistry.get(entry[0])?.id;
|
|
@@ -4321,15 +5055,16 @@ window.__ModuleLoader__.load({
|
|
|
4321
5055
|
entry[1].defId = id;
|
|
4322
5056
|
return {
|
|
4323
5057
|
defId: id,
|
|
4324
|
-
ref: `${uriGenerator("__shared")}#/${defsSegment}/${id}`
|
|
5058
|
+
ref: `${uriGenerator("__shared")}#/${defsSegment}/${encodeJSONPointerSegment(id)}`
|
|
4325
5059
|
};
|
|
4326
5060
|
}
|
|
4327
|
-
|
|
4328
|
-
const defUriPrefix =
|
|
5061
|
+
const uriPrefix = `#`;
|
|
5062
|
+
const defUriPrefix = `${uriPrefix}/${defsSegment}/`;
|
|
5063
|
+
if (entry[1] === root && !entry[1].schema.id) return { ref: uriPrefix };
|
|
4329
5064
|
const defId = entry[1].schema.id ?? `__schema${ctx.counter++}`;
|
|
4330
5065
|
return {
|
|
4331
5066
|
defId,
|
|
4332
|
-
ref: defUriPrefix + defId
|
|
5067
|
+
ref: defUriPrefix + encodeJSONPointerSegment(defId)
|
|
4333
5068
|
};
|
|
4334
5069
|
};
|
|
4335
5070
|
const extractToDef = (entry) => {
|
|
@@ -4376,6 +5111,111 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4376
5111
|
}
|
|
4377
5112
|
}
|
|
4378
5113
|
}
|
|
5114
|
+
if (ctx.external) ctx.sharedDefsExtractedFor = ctx.external;
|
|
5115
|
+
}
|
|
5116
|
+
/** Rewrites `anyOf: [{type: "a"}, {type: "b"}]` to `type: ["a", "b"]`, which every JSON Schema draft treats as equivalent and most consumers render far better for the nullable case. Only branches that are a bare type assertion qualify — anything carrying a constraint, `$ref`, `const` or metadata is left alone. Runs after `flattenRef`, so a branch an override decorated or `$defs` extraction turned into a `$ref` is no longer bare and correctly stays in `anyOf`. `oneOf` is excluded: `integer` and `number` overlap, so "exactly one" and "at least one" are not the same there. OpenAPI 3.0 is excluded: its `type` must be a single string. */
|
|
5117
|
+
function compactTypeUnion(schema) {
|
|
5118
|
+
const options = schema.anyOf;
|
|
5119
|
+
if (!Array.isArray(options) || options.length === 0 || schema.type !== void 0) return;
|
|
5120
|
+
const types = [];
|
|
5121
|
+
for (const option of options) {
|
|
5122
|
+
if (!option || typeof option !== "object") return;
|
|
5123
|
+
compactTypeUnion(option);
|
|
5124
|
+
const keys = Object.keys(option);
|
|
5125
|
+
if (keys.length !== 1 || keys[0] !== "type") return;
|
|
5126
|
+
const type = option.type;
|
|
5127
|
+
for (const member of Array.isArray(type) ? type : [type]) {
|
|
5128
|
+
if (typeof member !== "string") return;
|
|
5129
|
+
if (!types.includes(member)) types.push(member);
|
|
5130
|
+
}
|
|
5131
|
+
}
|
|
5132
|
+
delete schema.anyOf;
|
|
5133
|
+
schema.type = types.length === 1 ? types[0] : types;
|
|
5134
|
+
}
|
|
5135
|
+
/** Keywords `foldIntersection` knows how to combine. Anything else — `$ref`, `patternProperties`,
|
|
5136
|
+
* an annotation like `description` — makes a member unfoldable, so a constraint this does not
|
|
5137
|
+
* understand leaves the `allOf` alone instead of being silently dropped or misattributed. */
|
|
5138
|
+
const FOLDABLE_KEYS = /* @__PURE__ */ new Set([
|
|
5139
|
+
"type",
|
|
5140
|
+
"properties",
|
|
5141
|
+
"required",
|
|
5142
|
+
"additionalProperties"
|
|
5143
|
+
]);
|
|
5144
|
+
const UNION_KEYS = ["oneOf", "anyOf"];
|
|
5145
|
+
/** A member's constraint on a key it does not declare itself. A `catchall` states one; `false`, an absent `additionalProperties`, and the empty schema a loose object emits state nothing. */
|
|
5146
|
+
function undeclaredConstraint(member) {
|
|
5147
|
+
const extra = member.additionalProperties;
|
|
5148
|
+
if (extra === void 0 || extra === false || typeof extra !== "object" || extra === null) return null;
|
|
5149
|
+
return Object.keys(extra).length ? extra : null;
|
|
5150
|
+
}
|
|
5151
|
+
/** Combines object members into the single object they describe together, or returns `null` if any of them carries a keyword outside {@link FOLDABLE_KEYS}. */
|
|
5152
|
+
function foldObjects(members) {
|
|
5153
|
+
const objects = [];
|
|
5154
|
+
for (const member of members) {
|
|
5155
|
+
if (typeof member !== "object" || member.type !== "object") return null;
|
|
5156
|
+
for (const key in member) if (!FOLDABLE_KEYS.has(key)) return null;
|
|
5157
|
+
objects.push(member);
|
|
5158
|
+
}
|
|
5159
|
+
const properties = {};
|
|
5160
|
+
const required = /* @__PURE__ */ new Set();
|
|
5161
|
+
for (const object of objects) {
|
|
5162
|
+
for (const key in object.properties) {
|
|
5163
|
+
if (Object.prototype.hasOwnProperty.call(properties, key)) continue;
|
|
5164
|
+
const parts = [];
|
|
5165
|
+
for (const other of objects) {
|
|
5166
|
+
const part = other.properties?.[key] ?? undeclaredConstraint(other);
|
|
5167
|
+
if (part === null || part === void 0) continue;
|
|
5168
|
+
if (!parts.some((seen) => JSON.stringify(seen) === JSON.stringify(part))) parts.push(part);
|
|
5169
|
+
}
|
|
5170
|
+
assignProp(properties, key, parts.length === 1 ? parts[0] : foldObjects(parts) ?? { allOf: parts });
|
|
5171
|
+
}
|
|
5172
|
+
for (const key of object.required ?? []) required.add(key);
|
|
5173
|
+
}
|
|
5174
|
+
const folded = {
|
|
5175
|
+
type: "object",
|
|
5176
|
+
properties
|
|
5177
|
+
};
|
|
5178
|
+
if (required.size) folded.required = [...required];
|
|
5179
|
+
if (objects.every((object) => object.additionalProperties === false)) folded.additionalProperties = false;
|
|
5180
|
+
else {
|
|
5181
|
+
const constraints = [];
|
|
5182
|
+
for (const object of objects) {
|
|
5183
|
+
const constraint = undeclaredConstraint(object);
|
|
5184
|
+
if (constraint && !constraints.some((seen) => JSON.stringify(seen) === JSON.stringify(constraint))) constraints.push(constraint);
|
|
5185
|
+
}
|
|
5186
|
+
if (constraints.length === 1) folded.additionalProperties = constraints[0];
|
|
5187
|
+
else if (constraints.length > 1) folded.additionalProperties = { allOf: constraints };
|
|
5188
|
+
}
|
|
5189
|
+
return folded;
|
|
5190
|
+
}
|
|
5191
|
+
/** `additionalProperties` in an `allOf` member sees only that member's own `properties`, so two
|
|
5192
|
+
* closed object members reject each other's keys and the schema validates nothing. Zod's parser
|
|
5193
|
+
* pools the key sets instead — `handleIntersectionResults` reports a key as unrecognized only when
|
|
5194
|
+
* *every* side rejects it — so the emitted schema has to pool them too, and folding the members
|
|
5195
|
+
* into one object is the encoding that says so on every target.
|
|
5196
|
+
*
|
|
5197
|
+
* This runs from `finalize`, after `extractDefs`, which is what keeps it clear of the `$ref`
|
|
5198
|
+
* machinery: a member extracted into `$defs` is already a `$ref` by now and declines to fold, so it
|
|
5199
|
+
* keeps its reference and its own closedness rather than being inlined as a stale copy. */
|
|
5200
|
+
function foldIntersection(json) {
|
|
5201
|
+
const allOf = json.allOf;
|
|
5202
|
+
if (!Array.isArray(allOf) || allOf.length < 2) return;
|
|
5203
|
+
for (const key of FOLDABLE_KEYS) if (key in json) return;
|
|
5204
|
+
const unions = allOf.filter((m) => UNION_KEYS.some((k) => Array.isArray(m[k])));
|
|
5205
|
+
let folded = null;
|
|
5206
|
+
if (!unions.length) folded = foldObjects(allOf);
|
|
5207
|
+
else {
|
|
5208
|
+
const union = unions[0];
|
|
5209
|
+
const keyword = UNION_KEYS.find((k) => Array.isArray(union[k]));
|
|
5210
|
+
if (Object.keys(union).length !== 1) return;
|
|
5211
|
+
const rest = allOf.filter((m) => m !== union);
|
|
5212
|
+
const branches = union[keyword].map((branch) => foldObjects([...rest, branch]));
|
|
5213
|
+
if (branches.some((b) => !b)) return;
|
|
5214
|
+
folded = { [keyword]: branches };
|
|
5215
|
+
}
|
|
5216
|
+
if (!folded) return;
|
|
5217
|
+
delete json.allOf;
|
|
5218
|
+
assignProps(json, folded);
|
|
4379
5219
|
}
|
|
4380
5220
|
function finalize(ctx, schema) {
|
|
4381
5221
|
const root = ctx.seen.get(schema);
|
|
@@ -4394,8 +5234,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4394
5234
|
if (refSchema.$ref && (ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0")) {
|
|
4395
5235
|
schema.allOf = schema.allOf ?? [];
|
|
4396
5236
|
schema.allOf.push(refSchema);
|
|
4397
|
-
} else
|
|
4398
|
-
|
|
5237
|
+
} else assignProps(schema, refSchema);
|
|
5238
|
+
assignProps(schema, _cached);
|
|
4399
5239
|
if (zodSchema._zod.parent === ref) for (const key in schema) {
|
|
4400
5240
|
if (key === "$ref" || key === "allOf") continue;
|
|
4401
5241
|
if (!(key in _cached)) delete schema[key];
|
|
@@ -4423,7 +5263,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4423
5263
|
path: seen.path ?? []
|
|
4424
5264
|
});
|
|
4425
5265
|
};
|
|
4426
|
-
|
|
5266
|
+
if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) {
|
|
5267
|
+
for (const entry of [...ctx.seen.entries()].reverse()) flattenRef(entry[0]);
|
|
5268
|
+
if (ctx.target !== "openapi-3.0") for (const entry of ctx.seen.entries()) compactTypeUnion(entry[1].def ?? entry[1].schema);
|
|
5269
|
+
for (const rewrite of ctx.deferred) rewrite();
|
|
5270
|
+
if (ctx.intersections.length) {
|
|
5271
|
+
const carriers = /* @__PURE__ */ new Map();
|
|
5272
|
+
for (const seen of ctx.seen.values()) for (const json of [seen.schema, seen.def]) {
|
|
5273
|
+
const allOf = json?.allOf;
|
|
5274
|
+
if (!Array.isArray(allOf)) continue;
|
|
5275
|
+
const existing = carriers.get(allOf);
|
|
5276
|
+
if (existing) existing.push(json);
|
|
5277
|
+
else carriers.set(allOf, [json]);
|
|
5278
|
+
}
|
|
5279
|
+
for (const allOf of ctx.intersections) for (const json of carriers.get(allOf) ?? []) foldIntersection(json);
|
|
5280
|
+
}
|
|
5281
|
+
}
|
|
4427
5282
|
const result = {};
|
|
4428
5283
|
if (ctx.target === "draft-2020-12") result.$schema = "https://json-schema.org/draft/2020-12/schema";
|
|
4429
5284
|
else if (ctx.target === "draft-07") result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
@@ -4434,17 +5289,18 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4434
5289
|
if (!id) throw new Error("Schema is missing an `id` property");
|
|
4435
5290
|
result.$id = ctx.external.uri(id);
|
|
4436
5291
|
}
|
|
4437
|
-
|
|
5292
|
+
assignProps(result, root.defId ? root.schema : root.def ?? root.schema);
|
|
4438
5293
|
const rootMetaId = ctx.metadataRegistry.get(schema)?.id;
|
|
4439
5294
|
if (rootMetaId !== void 0 && result.id === rootMetaId) delete result.id;
|
|
4440
5295
|
const defs = ctx.external?.defs ?? {};
|
|
4441
|
-
for (const entry of ctx.seen.entries()) {
|
|
5296
|
+
if (!ctx.external || ctx.sharedEmitDoneFor !== ctx.external) for (const entry of ctx.seen.entries()) {
|
|
4442
5297
|
const seen = entry[1];
|
|
4443
5298
|
if (seen.def && seen.defId) {
|
|
4444
5299
|
if (seen.def.id === seen.defId) delete seen.def.id;
|
|
4445
|
-
defs
|
|
5300
|
+
assignProp(defs, seen.defId, seen.def);
|
|
4446
5301
|
}
|
|
4447
5302
|
}
|
|
5303
|
+
if (ctx.external) ctx.sharedEmitDoneFor = ctx.external;
|
|
4448
5304
|
if (ctx.external) {} else if (Object.keys(defs).length > 0) {
|
|
4449
5305
|
if (ctx.target === "draft-2020-12") result.$defs = defs;
|
|
4450
5306
|
else result.definitions = defs;
|
|
@@ -4476,7 +5332,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4476
5332
|
if (def.type === "array") return isTransforming(def.element, ctx);
|
|
4477
5333
|
if (def.type === "set") return isTransforming(def.valueType, ctx);
|
|
4478
5334
|
if (def.type === "lazy") return isTransforming(def.getter(), ctx);
|
|
4479
|
-
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);
|
|
5335
|
+
if (def.type === "promise" || def.type === "optional" || def.type === "nonoptional" || def.type === "nullable" || def.type === "readonly" || def.type === "default" || def.type === "prefault" || def.type === "catch") return isTransforming(def.innerType, ctx);
|
|
4480
5336
|
if (def.type === "intersection") return isTransforming(def.left, ctx) || isTransforming(def.right, ctx);
|
|
4481
5337
|
if (def.type === "record" || def.type === "map") return isTransforming(def.keyType, ctx) || isTransforming(def.valueType, ctx);
|
|
4482
5338
|
if (def.type === "pipe") {
|
|
@@ -4524,7 +5380,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4524
5380
|
return finalize(ctx, schema);
|
|
4525
5381
|
};
|
|
4526
5382
|
//#endregion
|
|
4527
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
5383
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/core/json-schema-processors.js
|
|
4528
5384
|
const formatMap = {
|
|
4529
5385
|
guid: "uuid",
|
|
4530
5386
|
url: "uri",
|
|
@@ -4535,25 +5391,25 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4535
5391
|
const stringProcessor = (schema, ctx, _json, _params) => {
|
|
4536
5392
|
const json = _json;
|
|
4537
5393
|
json.type = "string";
|
|
4538
|
-
const { minimum, maximum, format, patterns, contentEncoding } = schema._zod.bag;
|
|
5394
|
+
const { minimum, maximum, format, patterns, contentEncoding, laxFormat } = schema._zod.bag;
|
|
4539
5395
|
if (typeof minimum === "number") json.minLength = minimum;
|
|
4540
5396
|
if (typeof maximum === "number") json.maxLength = maximum;
|
|
4541
5397
|
if (format) {
|
|
4542
5398
|
json.format = formatMap[format] ?? format;
|
|
4543
5399
|
if (json.format === "") delete json.format;
|
|
4544
|
-
if (format === "time") delete json.format;
|
|
5400
|
+
if (format === "time" || laxFormat) delete json.format;
|
|
4545
5401
|
}
|
|
4546
5402
|
if (contentEncoding) json.contentEncoding = contentEncoding;
|
|
4547
5403
|
if (patterns && patterns.size > 0) {
|
|
4548
|
-
const
|
|
4549
|
-
if (
|
|
4550
|
-
else if (
|
|
5404
|
+
const patternList = [...patterns];
|
|
5405
|
+
if (patternList.length === 1) json.pattern = patternList[0].source;
|
|
5406
|
+
else if (patternList.length > 1) json.allOf = [...patternList.map((regex) => ({
|
|
4551
5407
|
...ctx.target === "draft-07" || ctx.target === "draft-04" || ctx.target === "openapi-3.0" ? { type: "string" } : {},
|
|
4552
5408
|
pattern: regex.source
|
|
4553
5409
|
}))];
|
|
4554
5410
|
}
|
|
4555
5411
|
};
|
|
4556
|
-
const numberProcessor = (schema, ctx, _json,
|
|
5412
|
+
const numberProcessor = (schema, ctx, _json, params) => {
|
|
4557
5413
|
const json = _json;
|
|
4558
5414
|
const { minimum, maximum, format, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
|
|
4559
5415
|
if (typeof format === "string" && format.includes("int")) json.type = "integer";
|
|
@@ -4573,7 +5429,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4573
5429
|
json.exclusiveMaximum = true;
|
|
4574
5430
|
} else json.exclusiveMaximum = exclusiveMaximum;
|
|
4575
5431
|
} else if (typeof maximum === "number") json.maximum = maximum;
|
|
4576
|
-
if (typeof multipleOf === "number")
|
|
5432
|
+
if (typeof multipleOf === "number") {
|
|
5433
|
+
if (Number.isFinite(multipleOf) && multipleOf !== 0) json.multipleOf = Math.abs(multipleOf);
|
|
5434
|
+
else handleUnrepresentable(schema, ctx, json, params, `A multipleOf divisor of ${multipleOf} cannot be represented in JSON Schema`);
|
|
5435
|
+
}
|
|
4577
5436
|
};
|
|
4578
5437
|
const booleanProcessor = (_schema, _ctx, json, _params) => {
|
|
4579
5438
|
json.type = "boolean";
|
|
@@ -4591,18 +5450,26 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4591
5450
|
const enumProcessor = (schema, _ctx, json, _params) => {
|
|
4592
5451
|
const def = schema._zod.def;
|
|
4593
5452
|
const values = getEnumValues(def.entries);
|
|
5453
|
+
if (values.length === 0) {
|
|
5454
|
+
json.not = {};
|
|
5455
|
+
return;
|
|
5456
|
+
}
|
|
4594
5457
|
if (values.every((v) => typeof v === "number")) json.type = "number";
|
|
4595
5458
|
if (values.every((v) => typeof v === "string")) json.type = "string";
|
|
4596
5459
|
json.enum = values;
|
|
4597
5460
|
};
|
|
4598
|
-
const literalProcessor = (schema, ctx, json,
|
|
5461
|
+
const literalProcessor = (schema, ctx, json, params) => {
|
|
4599
5462
|
const def = schema._zod.def;
|
|
5463
|
+
if (def.values.length === 0) {
|
|
5464
|
+
json.not = {};
|
|
5465
|
+
return;
|
|
5466
|
+
}
|
|
4600
5467
|
const vals = [];
|
|
4601
5468
|
for (const val of def.values) if (val === void 0) {
|
|
4602
|
-
if (ctx
|
|
5469
|
+
if (handleUnrepresentable(schema, ctx, json, params, "Literal `undefined` cannot be represented in JSON Schema")) return;
|
|
4603
5470
|
} else if (typeof val === "bigint") {
|
|
4604
|
-
if (ctx
|
|
4605
|
-
|
|
5471
|
+
if (handleUnrepresentable(schema, ctx, json, params, "BigInt literals cannot be represented in JSON Schema")) return;
|
|
5472
|
+
vals.push(Number(val));
|
|
4606
5473
|
} else vals.push(val);
|
|
4607
5474
|
if (vals.length === 0) {} else if (vals.length === 1) {
|
|
4608
5475
|
const val = vals[0];
|
|
@@ -4617,11 +5484,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4617
5484
|
json.enum = vals;
|
|
4618
5485
|
}
|
|
4619
5486
|
};
|
|
4620
|
-
const customProcessor = (
|
|
4621
|
-
|
|
5487
|
+
const customProcessor = (schema, ctx, json, params) => {
|
|
5488
|
+
handleUnrepresentable(schema, ctx, json, params, "Custom types cannot be represented in JSON Schema");
|
|
4622
5489
|
};
|
|
4623
|
-
const transformProcessor = (
|
|
4624
|
-
|
|
5490
|
+
const transformProcessor = (schema, ctx, json, params) => {
|
|
5491
|
+
handleUnrepresentable(schema, ctx, json, params, "Transforms cannot be represented in JSON Schema");
|
|
4625
5492
|
};
|
|
4626
5493
|
const arrayProcessor = (schema, ctx, _json, params) => {
|
|
4627
5494
|
const json = _json;
|
|
@@ -4635,25 +5502,32 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4635
5502
|
path: [...params.path, "items"]
|
|
4636
5503
|
});
|
|
4637
5504
|
};
|
|
5505
|
+
function inputOptin(schema) {
|
|
5506
|
+
const def = schema._zod.def;
|
|
5507
|
+
if (def.type === "pipe" && def.in._zod.traits.has("$ZodTransform")) return inputOptin(def.out);
|
|
5508
|
+
if (def.type === "catch") return inputOptin(def.innerType);
|
|
5509
|
+
return schema._zod.optin;
|
|
5510
|
+
}
|
|
4638
5511
|
const objectProcessor = (schema, ctx, _json, params) => {
|
|
4639
5512
|
const json = _json;
|
|
4640
5513
|
const def = schema._zod.def;
|
|
5514
|
+
const shape = def.shape;
|
|
5515
|
+
if (Object.getOwnPropertySymbols(shape).length && handleUnrepresentable(schema, ctx, json, params, "Symbol keys cannot be represented in JSON Schema")) return;
|
|
4641
5516
|
json.type = "object";
|
|
4642
5517
|
json.properties = {};
|
|
4643
|
-
const shape
|
|
4644
|
-
for (const key in shape) json.properties[key] = process(shape[key], ctx, {
|
|
5518
|
+
for (const key in shape) assignProp(json.properties, key, process(shape[key], ctx, {
|
|
4645
5519
|
...params,
|
|
4646
5520
|
path: [
|
|
4647
5521
|
...params.path,
|
|
4648
5522
|
"properties",
|
|
4649
5523
|
key
|
|
4650
5524
|
]
|
|
4651
|
-
});
|
|
5525
|
+
}));
|
|
4652
5526
|
const allKeys = new Set(Object.keys(shape));
|
|
4653
5527
|
const requiredKeys = new Set([...allKeys].filter((key) => {
|
|
4654
|
-
const
|
|
4655
|
-
if (ctx.io === "input") return
|
|
4656
|
-
else return
|
|
5528
|
+
const field = def.shape[key];
|
|
5529
|
+
if (ctx.io === "input") return inputOptin(field) === void 0;
|
|
5530
|
+
else return field._zod.optout === void 0;
|
|
4657
5531
|
}));
|
|
4658
5532
|
if (requiredKeys.size > 0) json.required = Array.from(requiredKeys);
|
|
4659
5533
|
if (def.catchall?._zod.def.type === "never") json.additionalProperties = false;
|
|
@@ -4697,7 +5571,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4697
5571
|
]
|
|
4698
5572
|
});
|
|
4699
5573
|
const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
|
|
4700
|
-
|
|
5574
|
+
const allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
|
|
5575
|
+
json.allOf = allOf;
|
|
5576
|
+
ctx.intersections.push(allOf);
|
|
4701
5577
|
};
|
|
4702
5578
|
const nullableProcessor = (schema, ctx, json, params) => {
|
|
4703
5579
|
const def = schema._zod.def;
|
|
@@ -4714,19 +5590,37 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4714
5590
|
const seen = ctx.seen.get(schema);
|
|
4715
5591
|
seen.ref = def.innerType;
|
|
4716
5592
|
};
|
|
5593
|
+
/** Round-trips a default value through JSON so the emitted schema is guaranteed to be valid JSON.
|
|
5594
|
+
* A BigInt has no reliable encoding, so it goes through `unrepresentable` like any other
|
|
5595
|
+
* unrepresentable value. Returns a sentinel when the caller must not write a default of its own. */
|
|
5596
|
+
const UNREPRESENTABLE_DEFAULT = Symbol();
|
|
5597
|
+
function serializeDefaultValue(value, schema, ctx, json, params) {
|
|
5598
|
+
let unrepresentable = false;
|
|
5599
|
+
const serialized = JSON.stringify(value, (_, val) => {
|
|
5600
|
+
if (typeof val !== "bigint") return val;
|
|
5601
|
+
unrepresentable = true;
|
|
5602
|
+
return null;
|
|
5603
|
+
});
|
|
5604
|
+
if (!unrepresentable) return JSON.parse(serialized);
|
|
5605
|
+
handleUnrepresentable(schema, ctx, json, params, "BigInt defaults cannot be represented in JSON Schema");
|
|
5606
|
+
return UNREPRESENTABLE_DEFAULT;
|
|
5607
|
+
}
|
|
4717
5608
|
const defaultProcessor = (schema, ctx, json, params) => {
|
|
4718
5609
|
const def = schema._zod.def;
|
|
4719
5610
|
process(def.innerType, ctx, params);
|
|
4720
5611
|
const seen = ctx.seen.get(schema);
|
|
4721
5612
|
seen.ref = def.innerType;
|
|
4722
|
-
|
|
5613
|
+
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
|
|
5614
|
+
if (value !== UNREPRESENTABLE_DEFAULT) json.default = value;
|
|
4723
5615
|
};
|
|
4724
5616
|
const prefaultProcessor = (schema, ctx, json, params) => {
|
|
4725
5617
|
const def = schema._zod.def;
|
|
4726
5618
|
process(def.innerType, ctx, params);
|
|
4727
5619
|
const seen = ctx.seen.get(schema);
|
|
4728
5620
|
seen.ref = def.innerType;
|
|
4729
|
-
if (ctx.io
|
|
5621
|
+
if (ctx.io !== "input") return;
|
|
5622
|
+
const value = serializeDefaultValue(def.defaultValue, schema, ctx, json, params);
|
|
5623
|
+
if (value !== UNREPRESENTABLE_DEFAULT) json._prefault = value;
|
|
4730
5624
|
};
|
|
4731
5625
|
const catchProcessor = (schema, ctx, json, params) => {
|
|
4732
5626
|
const def = schema._zod.def;
|
|
@@ -4737,7 +5631,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4737
5631
|
try {
|
|
4738
5632
|
catchValue = def.catchValue(void 0);
|
|
4739
5633
|
} catch {
|
|
4740
|
-
|
|
5634
|
+
handleUnrepresentable(schema, ctx, json, params, "Dynamic catch values are not supported in JSON Schema");
|
|
5635
|
+
return;
|
|
4741
5636
|
}
|
|
4742
5637
|
json.default = catchValue;
|
|
4743
5638
|
};
|
|
@@ -4763,59 +5658,57 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4763
5658
|
seen.ref = def.innerType;
|
|
4764
5659
|
};
|
|
4765
5660
|
//#endregion
|
|
4766
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
4767
|
-
const
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
$ZodISODuration.init(inst, def);
|
|
4790
|
-
ZodStringFormat.init(inst, def);
|
|
4791
|
-
});
|
|
4792
|
-
function duration(params) {
|
|
4793
|
-
return /* @__PURE__ */ _isoDuration(ZodISODuration, params);
|
|
5661
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/errors.js
|
|
5662
|
+
const _installedErrorProtos = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]);
|
|
5663
|
+
function _lazyMethod(proto, key, make) {
|
|
5664
|
+
Object.defineProperty(proto, key, {
|
|
5665
|
+
configurable: true,
|
|
5666
|
+
enumerable: false,
|
|
5667
|
+
get() {
|
|
5668
|
+
const value = make(this);
|
|
5669
|
+
Object.defineProperty(this, key, {
|
|
5670
|
+
value,
|
|
5671
|
+
configurable: true,
|
|
5672
|
+
writable: true
|
|
5673
|
+
});
|
|
5674
|
+
return value;
|
|
5675
|
+
},
|
|
5676
|
+
set(value) {
|
|
5677
|
+
Object.defineProperty(this, key, {
|
|
5678
|
+
value,
|
|
5679
|
+
configurable: true,
|
|
5680
|
+
writable: true
|
|
5681
|
+
});
|
|
5682
|
+
}
|
|
5683
|
+
});
|
|
4794
5684
|
}
|
|
4795
|
-
//#endregion
|
|
4796
|
-
//#region node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/classic/errors.js
|
|
4797
5685
|
const initializer = (inst, issues) => {
|
|
4798
5686
|
$ZodError.init(inst, issues);
|
|
4799
5687
|
inst.name = "ZodError";
|
|
4800
|
-
Object.
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
5688
|
+
const proto = Object.getPrototypeOf(inst);
|
|
5689
|
+
if (_installedErrorProtos.has(proto)) return;
|
|
5690
|
+
_installedErrorProtos.add(proto);
|
|
5691
|
+
_lazyMethod(proto, "format", (self) => (mapper) => formatError(self, mapper));
|
|
5692
|
+
_lazyMethod(proto, "flatten", (self) => (mapper) => flattenError(self, mapper));
|
|
5693
|
+
_lazyMethod(proto, "addIssue", (self) => (issue) => {
|
|
5694
|
+
self.issues.push(issue);
|
|
5695
|
+
self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
|
|
5696
|
+
});
|
|
5697
|
+
_lazyMethod(proto, "addIssues", (self) => (issues) => {
|
|
5698
|
+
self.issues.push(...issues);
|
|
5699
|
+
self.message = JSON.stringify(self.issues, jsonStringifyReplacer, 2);
|
|
5700
|
+
});
|
|
5701
|
+
Object.defineProperty(proto, "isEmpty", {
|
|
5702
|
+
configurable: true,
|
|
5703
|
+
enumerable: false,
|
|
5704
|
+
get() {
|
|
5705
|
+
return this.issues.length === 0;
|
|
5706
|
+
}
|
|
4814
5707
|
});
|
|
4815
5708
|
};
|
|
4816
|
-
const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, { Parent: Error });
|
|
5709
|
+
const ZodRealError = /*@__PURE__*/ $constructor("ZodError", initializer, void 0, { Parent: Error });
|
|
4817
5710
|
//#endregion
|
|
4818
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
5711
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/parse.js
|
|
4819
5712
|
const parse = /* @__PURE__ */ _parse(ZodRealError);
|
|
4820
5713
|
const parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
4821
5714
|
const safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
@@ -4829,167 +5722,175 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
4829
5722
|
const safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
4830
5723
|
const safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
4831
5724
|
//#endregion
|
|
4832
|
-
//#region node_modules/.pnpm/zod@4.4
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
if (!
|
|
4838
|
-
installed = /* @__PURE__ */ new Set();
|
|
4839
|
-
_installedGroups.set(proto, installed);
|
|
4840
|
-
}
|
|
4841
|
-
if (installed.has(group)) return;
|
|
4842
|
-
installed.add(group);
|
|
4843
|
-
for (const key in methods) {
|
|
4844
|
-
const fn = methods[key];
|
|
4845
|
-
Object.defineProperty(proto, key, {
|
|
4846
|
-
configurable: true,
|
|
4847
|
-
enumerable: false,
|
|
4848
|
-
get() {
|
|
4849
|
-
const bound = fn.bind(this);
|
|
4850
|
-
Object.defineProperty(this, key, {
|
|
4851
|
-
configurable: true,
|
|
4852
|
-
writable: true,
|
|
4853
|
-
enumerable: true,
|
|
4854
|
-
value: bound
|
|
4855
|
-
});
|
|
4856
|
-
return bound;
|
|
4857
|
-
},
|
|
4858
|
-
set(v) {
|
|
4859
|
-
Object.defineProperty(this, key, {
|
|
4860
|
-
configurable: true,
|
|
4861
|
-
writable: true,
|
|
4862
|
-
enumerable: true,
|
|
4863
|
-
value: v
|
|
4864
|
-
});
|
|
4865
|
-
}
|
|
4866
|
-
});
|
|
4867
|
-
}
|
|
5725
|
+
//#region node_modules/.pnpm/zod@4.5.4/node_modules/zod/v4/classic/schemas.js
|
|
5726
|
+
function _ensureDefaultLocale() {
|
|
5727
|
+
if (!globalConfig.localeError) config(en_default());
|
|
5728
|
+
}
|
|
5729
|
+
function _ensureDefaultMemoizer() {
|
|
5730
|
+
if (!globalConfig.memoizer) config({ memoizer: memoizer() });
|
|
4868
5731
|
}
|
|
4869
5732
|
const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def) => {
|
|
5733
|
+
_ensureDefaultLocale();
|
|
4870
5734
|
$ZodType.init(inst, def);
|
|
4871
|
-
Object.assign(inst["~standard"], { jsonSchema: {
|
|
4872
|
-
input: createStandardJSONSchemaMethod(inst, "input"),
|
|
4873
|
-
output: createStandardJSONSchemaMethod(inst, "output")
|
|
4874
|
-
} });
|
|
4875
|
-
inst.toJSONSchema = createToJSONSchemaMethod(inst, {});
|
|
4876
5735
|
inst.def = def;
|
|
4877
5736
|
inst.type = def.type;
|
|
4878
|
-
Object.defineProperty(inst, "_def", { value: def });
|
|
4879
|
-
inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
|
|
4880
|
-
inst.safeParse = (data, params) => safeParse(inst, data, params);
|
|
4881
|
-
inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
|
|
4882
|
-
inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
|
|
4883
|
-
inst.spa = inst.safeParseAsync;
|
|
4884
|
-
inst.encode = (data, params) => encode(inst, data, params);
|
|
4885
|
-
inst.decode = (data, params) => decode(inst, data, params);
|
|
4886
|
-
inst.encodeAsync = async (data, params) => encodeAsync(inst, data, params);
|
|
4887
|
-
inst.decodeAsync = async (data, params) => decodeAsync(inst, data, params);
|
|
4888
|
-
inst.safeEncode = (data, params) => safeEncode(inst, data, params);
|
|
4889
|
-
inst.safeDecode = (data, params) => safeDecode(inst, data, params);
|
|
4890
|
-
inst.safeEncodeAsync = async (data, params) => safeEncodeAsync(inst, data, params);
|
|
4891
|
-
inst.safeDecodeAsync = async (data, params) => safeDecodeAsync(inst, data, params);
|
|
4892
|
-
_installLazyMethods(inst, "ZodType", {
|
|
4893
|
-
check(...chks) {
|
|
4894
|
-
const def = this.def;
|
|
4895
|
-
return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
|
|
4896
|
-
check: ch,
|
|
4897
|
-
def: { check: "custom" },
|
|
4898
|
-
onattach: []
|
|
4899
|
-
} } : ch)] }), { parent: true });
|
|
4900
|
-
},
|
|
4901
|
-
with(...chks) {
|
|
4902
|
-
return this.check(...chks);
|
|
4903
|
-
},
|
|
4904
|
-
clone(def, params) {
|
|
4905
|
-
return clone(this, def, params);
|
|
4906
|
-
},
|
|
4907
|
-
brand() {
|
|
4908
|
-
return this;
|
|
4909
|
-
},
|
|
4910
|
-
register(reg, meta) {
|
|
4911
|
-
reg.add(this, meta);
|
|
4912
|
-
return this;
|
|
4913
|
-
},
|
|
4914
|
-
refine(check, params) {
|
|
4915
|
-
return this.check(refine(check, params));
|
|
4916
|
-
},
|
|
4917
|
-
superRefine(refinement, params) {
|
|
4918
|
-
return this.check(superRefine(refinement, params));
|
|
4919
|
-
},
|
|
4920
|
-
overwrite(fn) {
|
|
4921
|
-
return this.check(/* @__PURE__ */ _overwrite(fn));
|
|
4922
|
-
},
|
|
4923
|
-
optional() {
|
|
4924
|
-
return optional(this);
|
|
4925
|
-
},
|
|
4926
|
-
exactOptional() {
|
|
4927
|
-
return exactOptional(this);
|
|
4928
|
-
},
|
|
4929
|
-
nullable() {
|
|
4930
|
-
return nullable(this);
|
|
4931
|
-
},
|
|
4932
|
-
nullish() {
|
|
4933
|
-
return optional(nullable(this));
|
|
4934
|
-
},
|
|
4935
|
-
nonoptional(params) {
|
|
4936
|
-
return nonoptional(this, params);
|
|
4937
|
-
},
|
|
4938
|
-
array() {
|
|
4939
|
-
return array(this);
|
|
4940
|
-
},
|
|
4941
|
-
or(arg) {
|
|
4942
|
-
return union([this, arg]);
|
|
4943
|
-
},
|
|
4944
|
-
and(arg) {
|
|
4945
|
-
return intersection(this, arg);
|
|
4946
|
-
},
|
|
4947
|
-
transform(tx) {
|
|
4948
|
-
return pipe(this, transform(tx));
|
|
4949
|
-
},
|
|
4950
|
-
default(d) {
|
|
4951
|
-
return _default(this, d);
|
|
4952
|
-
},
|
|
4953
|
-
prefault(d) {
|
|
4954
|
-
return prefault(this, d);
|
|
4955
|
-
},
|
|
4956
|
-
catch(params) {
|
|
4957
|
-
return _catch(this, params);
|
|
4958
|
-
},
|
|
4959
|
-
pipe(target) {
|
|
4960
|
-
return pipe(this, target);
|
|
4961
|
-
},
|
|
4962
|
-
readonly() {
|
|
4963
|
-
return readonly(this);
|
|
4964
|
-
},
|
|
4965
|
-
describe(description) {
|
|
4966
|
-
const cl = this.clone();
|
|
4967
|
-
globalRegistry.add(cl, { description });
|
|
4968
|
-
return cl;
|
|
4969
|
-
},
|
|
4970
|
-
meta(...args) {
|
|
4971
|
-
if (args.length === 0) return globalRegistry.get(this);
|
|
4972
|
-
const cl = this.clone();
|
|
4973
|
-
globalRegistry.add(cl, args[0]);
|
|
4974
|
-
return cl;
|
|
4975
|
-
},
|
|
4976
|
-
isOptional() {
|
|
4977
|
-
return this.safeParse(void 0).success;
|
|
4978
|
-
},
|
|
4979
|
-
isNullable() {
|
|
4980
|
-
return this.safeParse(null).success;
|
|
4981
|
-
},
|
|
4982
|
-
apply(fn) {
|
|
4983
|
-
return fn(this);
|
|
4984
|
-
}
|
|
4985
|
-
});
|
|
4986
|
-
Object.defineProperty(inst, "description", {
|
|
4987
|
-
get() {
|
|
4988
|
-
return globalRegistry.get(inst)?.description;
|
|
4989
|
-
},
|
|
4990
|
-
configurable: true
|
|
4991
|
-
});
|
|
4992
5737
|
return inst;
|
|
5738
|
+
}, {
|
|
5739
|
+
check(...chks) {
|
|
5740
|
+
const def = this.def;
|
|
5741
|
+
return this.clone(mergeDefs(def, { checks: [...def.checks ?? [], ...chks.map((ch) => typeof ch === "function" ? { _zod: {
|
|
5742
|
+
check: ch,
|
|
5743
|
+
def: { check: "custom" },
|
|
5744
|
+
onattach: []
|
|
5745
|
+
} } : ch)] }), { parent: true });
|
|
5746
|
+
},
|
|
5747
|
+
with(...chks) {
|
|
5748
|
+
return this.check(...chks);
|
|
5749
|
+
},
|
|
5750
|
+
clone(def, params) {
|
|
5751
|
+
return clone(this, def, params);
|
|
5752
|
+
},
|
|
5753
|
+
brand() {
|
|
5754
|
+
return this;
|
|
5755
|
+
},
|
|
5756
|
+
register(reg, meta) {
|
|
5757
|
+
reg.add(this, meta);
|
|
5758
|
+
return this;
|
|
5759
|
+
},
|
|
5760
|
+
refine(check, params) {
|
|
5761
|
+
return this.check(refine(check, params));
|
|
5762
|
+
},
|
|
5763
|
+
superRefine(refinement, params) {
|
|
5764
|
+
return this.check(superRefine(refinement, params));
|
|
5765
|
+
},
|
|
5766
|
+
overwrite(fn) {
|
|
5767
|
+
return this.check(/* @__PURE__ */ _overwrite(fn));
|
|
5768
|
+
},
|
|
5769
|
+
optional() {
|
|
5770
|
+
return optional(this);
|
|
5771
|
+
},
|
|
5772
|
+
exactOptional() {
|
|
5773
|
+
return exactOptional(this);
|
|
5774
|
+
},
|
|
5775
|
+
nullable() {
|
|
5776
|
+
return nullable(this);
|
|
5777
|
+
},
|
|
5778
|
+
nullish() {
|
|
5779
|
+
return optional(nullable(this));
|
|
5780
|
+
},
|
|
5781
|
+
nonoptional(params) {
|
|
5782
|
+
return nonoptional(this, params);
|
|
5783
|
+
},
|
|
5784
|
+
array() {
|
|
5785
|
+
return array(this);
|
|
5786
|
+
},
|
|
5787
|
+
or(arg) {
|
|
5788
|
+
return union([this, arg]);
|
|
5789
|
+
},
|
|
5790
|
+
and(arg) {
|
|
5791
|
+
return intersection(this, arg);
|
|
5792
|
+
},
|
|
5793
|
+
transform(tx) {
|
|
5794
|
+
return pipe(this, transform(tx));
|
|
5795
|
+
},
|
|
5796
|
+
default(d) {
|
|
5797
|
+
return _default(this, d);
|
|
5798
|
+
},
|
|
5799
|
+
prefault(d) {
|
|
5800
|
+
return prefault(this, d);
|
|
5801
|
+
},
|
|
5802
|
+
catch(params) {
|
|
5803
|
+
return _catch(this, params);
|
|
5804
|
+
},
|
|
5805
|
+
pipe(target) {
|
|
5806
|
+
return pipe(this, target);
|
|
5807
|
+
},
|
|
5808
|
+
readonly() {
|
|
5809
|
+
return readonly(this);
|
|
5810
|
+
},
|
|
5811
|
+
describe(description) {
|
|
5812
|
+
const cl = this.clone();
|
|
5813
|
+
globalRegistry.add(cl, { description });
|
|
5814
|
+
return cl;
|
|
5815
|
+
},
|
|
5816
|
+
meta(...args) {
|
|
5817
|
+
if (args.length === 0) return globalRegistry.get(this);
|
|
5818
|
+
const cl = this.clone();
|
|
5819
|
+
globalRegistry.add(cl, args[0]);
|
|
5820
|
+
return cl;
|
|
5821
|
+
},
|
|
5822
|
+
isOptional() {
|
|
5823
|
+
return this.safeParse(void 0).success;
|
|
5824
|
+
},
|
|
5825
|
+
isNullable() {
|
|
5826
|
+
return this.safeParse(null).success;
|
|
5827
|
+
},
|
|
5828
|
+
apply(fn, ...args) {
|
|
5829
|
+
return args.length === 0 ? fn(this) : fn(this, ...args);
|
|
5830
|
+
},
|
|
5831
|
+
get "~standard"() {
|
|
5832
|
+
return hide(this, "~standard", {
|
|
5833
|
+
...standardProps(this),
|
|
5834
|
+
jsonSchema: {
|
|
5835
|
+
input: createStandardJSONSchemaMethod(this, "input"),
|
|
5836
|
+
output: createStandardJSONSchemaMethod(this, "output")
|
|
5837
|
+
}
|
|
5838
|
+
});
|
|
5839
|
+
},
|
|
5840
|
+
set "~standard"(value) {
|
|
5841
|
+
own(this, "~standard", value);
|
|
5842
|
+
},
|
|
5843
|
+
parse: function _parse(data, params) {
|
|
5844
|
+
return parse(this, data, params, { callee: _parse });
|
|
5845
|
+
},
|
|
5846
|
+
parseAsync: async function _parseAsync(data, params) {
|
|
5847
|
+
return await parseAsync(this, data, params, { callee: _parseAsync });
|
|
5848
|
+
},
|
|
5849
|
+
safeParse(data, params) {
|
|
5850
|
+
return safeParse(this, data, params);
|
|
5851
|
+
},
|
|
5852
|
+
async safeParseAsync(data, params) {
|
|
5853
|
+
return safeParseAsync(this, data, params);
|
|
5854
|
+
},
|
|
5855
|
+
get spa() {
|
|
5856
|
+
return this?.safeParseAsync;
|
|
5857
|
+
},
|
|
5858
|
+
set spa(value) {
|
|
5859
|
+
own(this, "spa", value);
|
|
5860
|
+
},
|
|
5861
|
+
encode: function _encode(data, params) {
|
|
5862
|
+
return encode(this, data, params, { callee: _encode });
|
|
5863
|
+
},
|
|
5864
|
+
decode: function _decode(data, params) {
|
|
5865
|
+
return decode(this, data, params, { callee: _decode });
|
|
5866
|
+
},
|
|
5867
|
+
encodeAsync: async function _encodeAsync(data, params) {
|
|
5868
|
+
return await encodeAsync(this, data, params, { callee: _encodeAsync });
|
|
5869
|
+
},
|
|
5870
|
+
decodeAsync: async function _decodeAsync(data, params) {
|
|
5871
|
+
return await decodeAsync(this, data, params, { callee: _decodeAsync });
|
|
5872
|
+
},
|
|
5873
|
+
safeEncode(data, params) {
|
|
5874
|
+
return safeEncode(this, data, params);
|
|
5875
|
+
},
|
|
5876
|
+
safeDecode(data, params) {
|
|
5877
|
+
return safeDecode(this, data, params);
|
|
5878
|
+
},
|
|
5879
|
+
async safeEncodeAsync(data, params) {
|
|
5880
|
+
return safeEncodeAsync(this, data, params);
|
|
5881
|
+
},
|
|
5882
|
+
async safeDecodeAsync(data, params) {
|
|
5883
|
+
return safeDecodeAsync(this, data, params);
|
|
5884
|
+
},
|
|
5885
|
+
toJSONSchema(params) {
|
|
5886
|
+
return createToJSONSchemaMethod(this, {})(params);
|
|
5887
|
+
},
|
|
5888
|
+
get description() {
|
|
5889
|
+
return globalRegistry.get(this)?.description;
|
|
5890
|
+
},
|
|
5891
|
+
get _def() {
|
|
5892
|
+
return this._zod.def;
|
|
5893
|
+
}
|
|
4993
5894
|
});
|
|
4994
5895
|
/** @internal */
|
|
4995
5896
|
const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def) => {
|
|
@@ -5000,84 +5901,135 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5000
5901
|
inst.format = bag.format ?? null;
|
|
5001
5902
|
inst.minLength = bag.minimum ?? null;
|
|
5002
5903
|
inst.maxLength = bag.maximum ?? null;
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
|
|
5048
|
-
|
|
5049
|
-
});
|
|
5904
|
+
}, {
|
|
5905
|
+
regex(...args) {
|
|
5906
|
+
return this.check(/* @__PURE__ */ _regex(...args));
|
|
5907
|
+
},
|
|
5908
|
+
includes(...args) {
|
|
5909
|
+
return this.check(/* @__PURE__ */ _includes(...args));
|
|
5910
|
+
},
|
|
5911
|
+
startsWith(...args) {
|
|
5912
|
+
return this.check(/* @__PURE__ */ _startsWith(...args));
|
|
5913
|
+
},
|
|
5914
|
+
endsWith(...args) {
|
|
5915
|
+
return this.check(/* @__PURE__ */ _endsWith(...args));
|
|
5916
|
+
},
|
|
5917
|
+
min(...args) {
|
|
5918
|
+
return this.check(/* @__PURE__ */ _minLength(...args));
|
|
5919
|
+
},
|
|
5920
|
+
max(...args) {
|
|
5921
|
+
return this.check(/* @__PURE__ */ _maxLength(...args));
|
|
5922
|
+
},
|
|
5923
|
+
length(...args) {
|
|
5924
|
+
return this.check(/* @__PURE__ */ _length(...args));
|
|
5925
|
+
},
|
|
5926
|
+
nonempty(...args) {
|
|
5927
|
+
return this.check(/* @__PURE__ */ _minLength(1, ...args));
|
|
5928
|
+
},
|
|
5929
|
+
lowercase(params) {
|
|
5930
|
+
return this.check(/* @__PURE__ */ _lowercase(params));
|
|
5931
|
+
},
|
|
5932
|
+
uppercase(params) {
|
|
5933
|
+
return this.check(/* @__PURE__ */ _uppercase(params));
|
|
5934
|
+
},
|
|
5935
|
+
trim() {
|
|
5936
|
+
return this.check(/* @__PURE__ */ _trim());
|
|
5937
|
+
},
|
|
5938
|
+
normalize(...args) {
|
|
5939
|
+
return this.check(/* @__PURE__ */ _normalize(...args));
|
|
5940
|
+
},
|
|
5941
|
+
toLowerCase() {
|
|
5942
|
+
return this.check(/* @__PURE__ */ _toLowerCase());
|
|
5943
|
+
},
|
|
5944
|
+
toUpperCase() {
|
|
5945
|
+
return this.check(/* @__PURE__ */ _toUpperCase());
|
|
5946
|
+
},
|
|
5947
|
+
slugify() {
|
|
5948
|
+
return this.check(/* @__PURE__ */ _slugify());
|
|
5949
|
+
}
|
|
5050
5950
|
});
|
|
5051
5951
|
const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def) => {
|
|
5052
5952
|
$ZodString.init(inst, def);
|
|
5053
5953
|
_ZodString.init(inst, def);
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5954
|
+
}, {
|
|
5955
|
+
email(params) {
|
|
5956
|
+
return this.check(/* @__PURE__ */ _email(ZodEmail, params));
|
|
5957
|
+
},
|
|
5958
|
+
url(params) {
|
|
5959
|
+
return this.check(/* @__PURE__ */ _url(ZodURL, params));
|
|
5960
|
+
},
|
|
5961
|
+
jwt(params) {
|
|
5962
|
+
return this.check(/* @__PURE__ */ _jwt(ZodJWT, params));
|
|
5963
|
+
},
|
|
5964
|
+
emoji(params) {
|
|
5965
|
+
return this.check(/* @__PURE__ */ _emoji(ZodEmoji, params));
|
|
5966
|
+
},
|
|
5967
|
+
guid(params) {
|
|
5968
|
+
return this.check(/* @__PURE__ */ _guid(ZodGUID, params));
|
|
5969
|
+
},
|
|
5970
|
+
uuid(params) {
|
|
5971
|
+
return this.check(/* @__PURE__ */ _uuid(ZodUUID, params));
|
|
5972
|
+
},
|
|
5973
|
+
uuidv4(params) {
|
|
5974
|
+
return this.check(/* @__PURE__ */ _uuidv4(ZodUUID, params));
|
|
5975
|
+
},
|
|
5976
|
+
uuidv6(params) {
|
|
5977
|
+
return this.check(/* @__PURE__ */ _uuidv6(ZodUUID, params));
|
|
5978
|
+
},
|
|
5979
|
+
uuidv7(params) {
|
|
5980
|
+
return this.check(/* @__PURE__ */ _uuidv7(ZodUUID, params));
|
|
5981
|
+
},
|
|
5982
|
+
nanoid(params) {
|
|
5983
|
+
return this.check(/* @__PURE__ */ _nanoid(ZodNanoID, params));
|
|
5984
|
+
},
|
|
5985
|
+
cuid(params) {
|
|
5986
|
+
return this.check(/* @__PURE__ */ _cuid(ZodCUID, params));
|
|
5987
|
+
},
|
|
5988
|
+
cuid2(params) {
|
|
5989
|
+
return this.check(/* @__PURE__ */ _cuid2(ZodCUID2, params));
|
|
5990
|
+
},
|
|
5991
|
+
ulid(params) {
|
|
5992
|
+
return this.check(/* @__PURE__ */ _ulid(ZodULID, params));
|
|
5993
|
+
},
|
|
5994
|
+
base64(params) {
|
|
5995
|
+
return this.check(/* @__PURE__ */ _base64(ZodBase64, params));
|
|
5996
|
+
},
|
|
5997
|
+
base64url(params) {
|
|
5998
|
+
return this.check(/* @__PURE__ */ _base64url(ZodBase64URL, params));
|
|
5999
|
+
},
|
|
6000
|
+
xid(params) {
|
|
6001
|
+
return this.check(/* @__PURE__ */ _xid(ZodXID, params));
|
|
6002
|
+
},
|
|
6003
|
+
ksuid(params) {
|
|
6004
|
+
return this.check(/* @__PURE__ */ _ksuid(ZodKSUID, params));
|
|
6005
|
+
},
|
|
6006
|
+
ipv4(params) {
|
|
6007
|
+
return this.check(/* @__PURE__ */ _ipv4(ZodIPv4, params));
|
|
6008
|
+
},
|
|
6009
|
+
ipv6(params) {
|
|
6010
|
+
return this.check(/* @__PURE__ */ _ipv6(ZodIPv6, params));
|
|
6011
|
+
},
|
|
6012
|
+
cidrv4(params) {
|
|
6013
|
+
return this.check(/* @__PURE__ */ _cidrv4(ZodCIDRv4, params));
|
|
6014
|
+
},
|
|
6015
|
+
cidrv6(params) {
|
|
6016
|
+
return this.check(/* @__PURE__ */ _cidrv6(ZodCIDRv6, params));
|
|
6017
|
+
},
|
|
6018
|
+
e164(params) {
|
|
6019
|
+
return this.check(/* @__PURE__ */ _e164(ZodE164, params));
|
|
6020
|
+
},
|
|
6021
|
+
datetime(params) {
|
|
6022
|
+
return this.check(/* @__PURE__ */ _isoDateTime(ZodISODateTime, params));
|
|
6023
|
+
},
|
|
6024
|
+
date(params) {
|
|
6025
|
+
return this.check(/* @__PURE__ */ _isoDate(ZodISODate, params));
|
|
6026
|
+
},
|
|
6027
|
+
time(params) {
|
|
6028
|
+
return this.check(/* @__PURE__ */ _isoTime(ZodISOTime, params));
|
|
6029
|
+
},
|
|
6030
|
+
duration(params) {
|
|
6031
|
+
return this.check(/* @__PURE__ */ _isoDuration(ZodISODuration, params));
|
|
6032
|
+
}
|
|
5081
6033
|
});
|
|
5082
6034
|
function string(params) {
|
|
5083
6035
|
return /* @__PURE__ */ _string(ZodString, params);
|
|
@@ -5086,6 +6038,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5086
6038
|
$ZodStringFormat.init(inst, def);
|
|
5087
6039
|
_ZodString.init(inst, def);
|
|
5088
6040
|
});
|
|
6041
|
+
const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def) => {
|
|
6042
|
+
$ZodISODateTime.init(inst, def);
|
|
6043
|
+
ZodStringFormat.init(inst, def);
|
|
6044
|
+
});
|
|
6045
|
+
const ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def) => {
|
|
6046
|
+
$ZodISODate.init(inst, def);
|
|
6047
|
+
ZodStringFormat.init(inst, def);
|
|
6048
|
+
});
|
|
6049
|
+
const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def) => {
|
|
6050
|
+
$ZodISOTime.init(inst, def);
|
|
6051
|
+
ZodStringFormat.init(inst, def);
|
|
6052
|
+
});
|
|
6053
|
+
const ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def) => {
|
|
6054
|
+
$ZodISODuration.init(inst, def);
|
|
6055
|
+
ZodStringFormat.init(inst, def);
|
|
6056
|
+
});
|
|
5089
6057
|
const ZodEmail = /*@__PURE__*/ $constructor("ZodEmail", (inst, def) => {
|
|
5090
6058
|
$ZodEmail.init(inst, def);
|
|
5091
6059
|
ZodStringFormat.init(inst, def);
|
|
@@ -5171,59 +6139,58 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5171
6139
|
$ZodNumber.init(inst, def);
|
|
5172
6140
|
ZodType.init(inst, def);
|
|
5173
6141
|
inst._zod.processJSONSchema = (ctx, json, params) => numberProcessor(inst, ctx, json, params);
|
|
5174
|
-
_installLazyMethods(inst, "ZodNumber", {
|
|
5175
|
-
gt(value, params) {
|
|
5176
|
-
return this.check(/* @__PURE__ */ _gt(value, params));
|
|
5177
|
-
},
|
|
5178
|
-
gte(value, params) {
|
|
5179
|
-
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
5180
|
-
},
|
|
5181
|
-
min(value, params) {
|
|
5182
|
-
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
5183
|
-
},
|
|
5184
|
-
lt(value, params) {
|
|
5185
|
-
return this.check(/* @__PURE__ */ _lt(value, params));
|
|
5186
|
-
},
|
|
5187
|
-
lte(value, params) {
|
|
5188
|
-
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
5189
|
-
},
|
|
5190
|
-
max(value, params) {
|
|
5191
|
-
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
5192
|
-
},
|
|
5193
|
-
int(params) {
|
|
5194
|
-
return this.check(int(params));
|
|
5195
|
-
},
|
|
5196
|
-
safe(params) {
|
|
5197
|
-
return this.check(int(params));
|
|
5198
|
-
},
|
|
5199
|
-
positive(params) {
|
|
5200
|
-
return this.check(/* @__PURE__ */ _gt(0, params));
|
|
5201
|
-
},
|
|
5202
|
-
nonnegative(params) {
|
|
5203
|
-
return this.check(/* @__PURE__ */ _gte(0, params));
|
|
5204
|
-
},
|
|
5205
|
-
negative(params) {
|
|
5206
|
-
return this.check(/* @__PURE__ */ _lt(0, params));
|
|
5207
|
-
},
|
|
5208
|
-
nonpositive(params) {
|
|
5209
|
-
return this.check(/* @__PURE__ */ _lte(0, params));
|
|
5210
|
-
},
|
|
5211
|
-
multipleOf(value, params) {
|
|
5212
|
-
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
5213
|
-
},
|
|
5214
|
-
step(value, params) {
|
|
5215
|
-
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
5216
|
-
},
|
|
5217
|
-
finite() {
|
|
5218
|
-
return this;
|
|
5219
|
-
}
|
|
5220
|
-
});
|
|
5221
6142
|
const bag = inst._zod.bag;
|
|
5222
6143
|
inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
|
|
5223
6144
|
inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
|
|
5224
6145
|
inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? .5);
|
|
5225
6146
|
inst.isFinite = true;
|
|
5226
6147
|
inst.format = bag.format ?? null;
|
|
6148
|
+
}, {
|
|
6149
|
+
gt(value, params) {
|
|
6150
|
+
return this.check(/* @__PURE__ */ _gt(value, params));
|
|
6151
|
+
},
|
|
6152
|
+
gte(value, params) {
|
|
6153
|
+
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
6154
|
+
},
|
|
6155
|
+
min(value, params) {
|
|
6156
|
+
return this.check(/* @__PURE__ */ _gte(value, params));
|
|
6157
|
+
},
|
|
6158
|
+
lt(value, params) {
|
|
6159
|
+
return this.check(/* @__PURE__ */ _lt(value, params));
|
|
6160
|
+
},
|
|
6161
|
+
lte(value, params) {
|
|
6162
|
+
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
6163
|
+
},
|
|
6164
|
+
max(value, params) {
|
|
6165
|
+
return this.check(/* @__PURE__ */ _lte(value, params));
|
|
6166
|
+
},
|
|
6167
|
+
int(params) {
|
|
6168
|
+
return this.check(int(params));
|
|
6169
|
+
},
|
|
6170
|
+
safe(params) {
|
|
6171
|
+
return this.check(int(params));
|
|
6172
|
+
},
|
|
6173
|
+
positive(params) {
|
|
6174
|
+
return this.check(/* @__PURE__ */ _gt(0, params));
|
|
6175
|
+
},
|
|
6176
|
+
nonnegative(params) {
|
|
6177
|
+
return this.check(/* @__PURE__ */ _gte(0, params));
|
|
6178
|
+
},
|
|
6179
|
+
negative(params) {
|
|
6180
|
+
return this.check(/* @__PURE__ */ _lt(0, params));
|
|
6181
|
+
},
|
|
6182
|
+
nonpositive(params) {
|
|
6183
|
+
return this.check(/* @__PURE__ */ _lte(0, params));
|
|
6184
|
+
},
|
|
6185
|
+
multipleOf(value, params) {
|
|
6186
|
+
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
6187
|
+
},
|
|
6188
|
+
step(value, params) {
|
|
6189
|
+
return this.check(/* @__PURE__ */ _multipleOf(value, params));
|
|
6190
|
+
},
|
|
6191
|
+
finite() {
|
|
6192
|
+
return this;
|
|
6193
|
+
}
|
|
5227
6194
|
});
|
|
5228
6195
|
function number(params) {
|
|
5229
6196
|
return /* @__PURE__ */ _number(ZodNumber, params);
|
|
@@ -5268,94 +6235,95 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5268
6235
|
return /* @__PURE__ */ _never(ZodNever, params);
|
|
5269
6236
|
}
|
|
5270
6237
|
const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def) => {
|
|
6238
|
+
_ensureDefaultMemoizer();
|
|
5271
6239
|
$ZodArray.init(inst, def);
|
|
5272
6240
|
ZodType.init(inst, def);
|
|
5273
6241
|
inst._zod.processJSONSchema = (ctx, json, params) => arrayProcessor(inst, ctx, json, params);
|
|
5274
6242
|
inst.element = def.element;
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
});
|
|
6243
|
+
}, {
|
|
6244
|
+
min(n, params) {
|
|
6245
|
+
return this.check(/* @__PURE__ */ _minLength(n, params));
|
|
6246
|
+
},
|
|
6247
|
+
nonempty(params) {
|
|
6248
|
+
return this.check(/* @__PURE__ */ _minLength(1, params));
|
|
6249
|
+
},
|
|
6250
|
+
max(n, params) {
|
|
6251
|
+
return this.check(/* @__PURE__ */ _maxLength(n, params));
|
|
6252
|
+
},
|
|
6253
|
+
length(n, params) {
|
|
6254
|
+
return this.check(/* @__PURE__ */ _length(n, params));
|
|
6255
|
+
},
|
|
6256
|
+
unwrap() {
|
|
6257
|
+
return this.element;
|
|
6258
|
+
}
|
|
5292
6259
|
});
|
|
5293
6260
|
function array(element, params) {
|
|
5294
6261
|
return /* @__PURE__ */ _array(ZodArray, element, params);
|
|
5295
6262
|
}
|
|
5296
6263
|
const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
|
|
6264
|
+
_ensureDefaultMemoizer();
|
|
5297
6265
|
$ZodObjectJIT.init(inst, def);
|
|
5298
6266
|
ZodType.init(inst, def);
|
|
5299
6267
|
inst._zod.processJSONSchema = (ctx, json, params) => objectProcessor(inst, ctx, json, params);
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
}
|
|
6268
|
+
installLazyProp(inst, "shape", (self) => self._zod.def.shape, false);
|
|
6269
|
+
}, {
|
|
6270
|
+
keyof() {
|
|
6271
|
+
return _enum(Object.keys(this._zod.def.shape));
|
|
6272
|
+
},
|
|
6273
|
+
catchall(catchall) {
|
|
6274
|
+
return this.clone({
|
|
6275
|
+
...this._zod.def,
|
|
6276
|
+
catchall
|
|
6277
|
+
});
|
|
6278
|
+
},
|
|
6279
|
+
passthrough() {
|
|
6280
|
+
return this.clone({
|
|
6281
|
+
...this._zod.def,
|
|
6282
|
+
catchall: unknown()
|
|
6283
|
+
});
|
|
6284
|
+
},
|
|
6285
|
+
loose() {
|
|
6286
|
+
return this.clone({
|
|
6287
|
+
...this._zod.def,
|
|
6288
|
+
catchall: unknown()
|
|
6289
|
+
});
|
|
6290
|
+
},
|
|
6291
|
+
strict() {
|
|
6292
|
+
return this.clone({
|
|
6293
|
+
...this._zod.def,
|
|
6294
|
+
catchall: never()
|
|
6295
|
+
});
|
|
6296
|
+
},
|
|
6297
|
+
strip() {
|
|
6298
|
+
return this.clone({
|
|
6299
|
+
...this._zod.def,
|
|
6300
|
+
catchall: void 0
|
|
6301
|
+
});
|
|
6302
|
+
},
|
|
6303
|
+
extend(incoming) {
|
|
6304
|
+
return extend(this, incoming);
|
|
6305
|
+
},
|
|
6306
|
+
safeExtend(incoming) {
|
|
6307
|
+
return safeExtend(this, incoming);
|
|
6308
|
+
},
|
|
6309
|
+
merge(other) {
|
|
6310
|
+
return merge(this, other);
|
|
6311
|
+
},
|
|
6312
|
+
pick(mask) {
|
|
6313
|
+
return pick(this, mask);
|
|
6314
|
+
},
|
|
6315
|
+
omit(mask) {
|
|
6316
|
+
return omit(this, mask);
|
|
6317
|
+
},
|
|
6318
|
+
partial(...args) {
|
|
6319
|
+
return partial(ZodOptional, this, args[0]);
|
|
6320
|
+
},
|
|
6321
|
+
exactPartial(...args) {
|
|
6322
|
+
return partial(ZodExactOptional, this, args[0], "exactPartial");
|
|
6323
|
+
},
|
|
6324
|
+
required(...args) {
|
|
6325
|
+
return required(ZodNonOptional, this, args[0]);
|
|
6326
|
+
}
|
|
5359
6327
|
});
|
|
5360
6328
|
function object(shape, params) {
|
|
5361
6329
|
const def = {
|
|
@@ -5446,6 +6414,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5446
6414
|
});
|
|
5447
6415
|
}
|
|
5448
6416
|
const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
|
|
6417
|
+
_ensureDefaultMemoizer();
|
|
5449
6418
|
$ZodTransform.init(inst, def);
|
|
5450
6419
|
ZodType.init(inst, def);
|
|
5451
6420
|
inst._zod.processJSONSchema = (ctx, json, params) => transformProcessor(inst, ctx, json, params);
|
|
@@ -5457,7 +6426,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5457
6426
|
const _issue = issue$1;
|
|
5458
6427
|
if (_issue.fatal) _issue.continue = false;
|
|
5459
6428
|
_issue.code ?? (_issue.code = "custom");
|
|
5460
|
-
|
|
6429
|
+
if (!("input" in _issue)) _issue.input = payload.value;
|
|
5461
6430
|
_issue.inst ?? (_issue.inst = inst);
|
|
5462
6431
|
payload.issues.push(issue(_issue));
|
|
5463
6432
|
}
|
|
@@ -5465,11 +6434,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5465
6434
|
const output = def.transform(payload.value, payload);
|
|
5466
6435
|
if (output instanceof Promise) return output.then((output) => {
|
|
5467
6436
|
payload.value = output;
|
|
5468
|
-
payload.fallback = true;
|
|
5469
6437
|
return payload;
|
|
5470
6438
|
});
|
|
5471
6439
|
payload.value = output;
|
|
5472
|
-
payload.fallback = true;
|
|
5473
6440
|
return payload;
|
|
5474
6441
|
};
|
|
5475
6442
|
});
|
|
@@ -5570,7 +6537,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
5570
6537
|
return new ZodCatch({
|
|
5571
6538
|
type: "catch",
|
|
5572
6539
|
innerType,
|
|
5573
|
-
catchValue: typeof catchValue === "function" ? catchValue : ()
|
|
6540
|
+
catchValue: typeof catchValue === "function" ? catchValue : constantCatch(catchValue)
|
|
5574
6541
|
});
|
|
5575
6542
|
}
|
|
5576
6543
|
const ZodPipe = /*@__PURE__*/ $constructor("ZodPipe", (inst, def) => {
|