langgraph-ui-components 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es100.js +25 -157
- package/dist/index.es100.js.map +1 -1
- package/dist/index.es101.js +3130 -176
- package/dist/index.es101.js.map +1 -1
- package/dist/index.es102.js +36 -13
- package/dist/index.es102.js.map +1 -1
- package/dist/index.es103.js +5 -30
- package/dist/index.es103.js.map +1 -1
- package/dist/index.es104.js +69 -30
- package/dist/index.es104.js.map +1 -1
- package/dist/index.es105.js +28 -3148
- package/dist/index.es105.js.map +1 -1
- package/dist/index.es106.js +5 -16
- package/dist/index.es106.js.map +1 -1
- package/dist/index.es107.js +2 -7
- package/dist/index.es107.js.map +1 -1
- package/dist/index.es108.js +13 -2
- package/dist/index.es108.js.map +1 -1
- package/dist/index.es109.js +499 -9
- package/dist/index.es109.js.map +1 -1
- package/dist/index.es11.js +2 -2
- package/dist/index.es11.js.map +1 -1
- package/dist/index.es110.js +5 -501
- package/dist/index.es110.js.map +1 -1
- package/dist/index.es111.js +2 -7
- package/dist/index.es111.js.map +1 -1
- package/dist/index.es112.js +148 -2
- package/dist/index.es112.js.map +1 -1
- package/dist/index.es113.js +878 -118
- package/dist/index.es113.js.map +1 -1
- package/dist/index.es114.js +251 -877
- package/dist/index.es114.js.map +1 -1
- package/dist/index.es115.js +3 -281
- package/dist/index.es115.js.map +1 -1
- package/dist/index.es116.js +445 -3
- package/dist/index.es116.js.map +1 -1
- package/dist/index.es117.js +39 -437
- package/dist/index.es117.js.map +1 -1
- package/dist/index.es118.js +22 -46
- package/dist/index.es118.js.map +1 -1
- package/dist/index.es119.js +78 -21
- package/dist/index.es119.js.map +1 -1
- package/dist/index.es120.js +126 -76
- package/dist/index.es120.js.map +1 -1
- package/dist/index.es121.js +45 -125
- package/dist/index.es121.js.map +1 -1
- package/dist/index.es122.js +9 -48
- package/dist/index.es122.js.map +1 -1
- package/dist/index.es123.js +45 -10
- package/dist/index.es123.js.map +1 -1
- package/dist/index.es124.js +97 -43
- package/dist/index.es124.js.map +1 -1
- package/dist/index.es125.js +48 -94
- package/dist/index.es125.js.map +1 -1
- package/dist/index.es126.js +14 -51
- package/dist/index.es126.js.map +1 -1
- package/dist/index.es127.js +13 -162
- package/dist/index.es127.js.map +1 -1
- package/dist/index.es128.js +89 -2
- package/dist/index.es128.js.map +1 -1
- package/dist/index.es129.js +2 -15
- package/dist/index.es129.js.map +1 -1
- package/dist/index.es130.js +54 -87
- package/dist/index.es130.js.map +1 -1
- package/dist/index.es131.js +100 -2
- package/dist/index.es131.js.map +1 -1
- package/dist/index.es132.js +186 -51
- package/dist/index.es132.js.map +1 -1
- package/dist/index.es133.js +97 -87
- package/dist/index.es133.js.map +1 -1
- package/dist/index.es134.js +31 -187
- package/dist/index.es134.js.map +1 -1
- package/dist/index.es135.js +10 -110
- package/dist/index.es135.js.map +1 -1
- package/dist/index.es136.js +11 -35
- package/dist/index.es136.js.map +1 -1
- package/dist/index.es137.js +12 -10
- package/dist/index.es137.js.map +1 -1
- package/dist/index.es138.js +90 -10
- package/dist/index.es138.js.map +1 -1
- package/dist/index.es139.js +274 -11
- package/dist/index.es139.js.map +1 -1
- package/dist/index.es140.js +2 -91
- package/dist/index.es140.js.map +1 -1
- package/dist/index.es141.js +150 -261
- package/dist/index.es141.js.map +1 -1
- package/dist/index.es142.js +51 -2
- package/dist/index.es142.js.map +1 -1
- package/dist/index.es143.js +34 -158
- package/dist/index.es143.js.map +1 -1
- package/dist/index.es144.js +34 -50
- package/dist/index.es144.js.map +1 -1
- package/dist/index.es145.js +32 -32
- package/dist/index.es145.js.map +1 -1
- package/dist/index.es146.js +23 -34
- package/dist/index.es146.js.map +1 -1
- package/dist/index.es147.js +583 -32
- package/dist/index.es147.js.map +1 -1
- package/dist/index.es148.js +121 -20
- package/dist/index.es148.js.map +1 -1
- package/dist/index.es149.js +158 -585
- package/dist/index.es149.js.map +1 -1
- package/dist/index.es15.js +15 -15
- package/dist/index.es150.js +2 -125
- package/dist/index.es150.js.map +1 -1
- package/dist/index.es157.js +2 -2
- package/dist/index.es159.js +2 -2
- package/dist/index.es161.js +64 -25
- package/dist/index.es161.js.map +1 -1
- package/dist/index.es162.js +22 -12
- package/dist/index.es162.js.map +1 -1
- package/dist/index.es163.js +5 -53
- package/dist/index.es163.js.map +1 -1
- package/dist/index.es164.js +337 -52
- package/dist/index.es164.js.map +1 -1
- package/dist/index.es165.js +24 -21
- package/dist/index.es165.js.map +1 -1
- package/dist/index.es166.js +12 -6
- package/dist/index.es166.js.map +1 -1
- package/dist/index.es167.js +49 -344
- package/dist/index.es167.js.map +1 -1
- package/dist/index.es175.js +1 -1
- package/dist/index.es178.js +1 -1
- package/dist/index.es183.js +1 -1
- package/dist/index.es195.js +2 -2
- package/dist/index.es197.js +2 -2
- package/dist/index.es200.js +1 -1
- package/dist/index.es201.js +1 -1
- package/dist/index.es203.js +1 -1
- package/dist/index.es204.js +2 -2
- package/dist/index.es206.js +1 -1
- package/dist/index.es209.js +3 -3
- package/dist/index.es21.js +1 -1
- package/dist/index.es210.js +2 -2
- package/dist/index.es212.js +1 -1
- package/dist/index.es214.js +1 -1
- package/dist/index.es215.js +1 -1
- package/dist/index.es217.js +1 -1
- package/dist/index.es218.js +2 -2
- package/dist/index.es219.js +1 -1
- package/dist/index.es220.js +1 -1
- package/dist/index.es221.js +1 -1
- package/dist/index.es222.js +1 -1
- package/dist/index.es223.js +1 -1
- package/dist/index.es224.js +1 -1
- package/dist/index.es225.js +1 -1
- package/dist/index.es229.js +2 -2
- package/dist/index.es28.js +7 -7
- package/dist/index.es29.js +1 -1
- package/dist/index.es32.js +4 -4
- package/dist/index.es33.js +15 -1191
- package/dist/index.es33.js.map +1 -1
- package/dist/index.es34.js +117 -6
- package/dist/index.es34.js.map +1 -1
- package/dist/index.es35.js +70 -8
- package/dist/index.es35.js.map +1 -1
- package/dist/index.es36.js +19 -148
- package/dist/index.es36.js.map +1 -1
- package/dist/index.es37.js +255 -112
- package/dist/index.es37.js.map +1 -1
- package/dist/index.es38.js +40 -68
- package/dist/index.es38.js.map +1 -1
- package/dist/index.es39.js +214 -17
- package/dist/index.es39.js.map +1 -1
- package/dist/index.es40.js +53 -247
- package/dist/index.es40.js.map +1 -1
- package/dist/index.es41.js +123 -24
- package/dist/index.es41.js.map +1 -1
- package/dist/index.es42.js +14 -205
- package/dist/index.es42.js.map +1 -1
- package/dist/index.es43.js +221 -58
- package/dist/index.es43.js.map +1 -1
- package/dist/index.es44.js +7 -140
- package/dist/index.es44.js.map +1 -1
- package/dist/index.es45.js +1185 -17
- package/dist/index.es45.js.map +1 -1
- package/dist/index.es46.js +6 -229
- package/dist/index.es46.js.map +1 -1
- package/dist/index.es47.js +146 -15
- package/dist/index.es47.js.map +1 -1
- package/dist/index.es49.js +7 -90
- package/dist/index.es49.js.map +1 -1
- package/dist/index.es50.js +92 -6
- package/dist/index.es50.js.map +1 -1
- package/dist/index.es51.js +3 -14
- package/dist/index.es51.js.map +1 -1
- package/dist/index.es52.js +36 -8
- package/dist/index.es52.js.map +1 -1
- package/dist/index.es53.js +61 -83
- package/dist/index.es53.js.map +1 -1
- package/dist/index.es54.js +37 -3
- package/dist/index.es54.js.map +1 -1
- package/dist/index.es55.js +304 -34
- package/dist/index.es55.js.map +1 -1
- package/dist/index.es56.js +9 -72
- package/dist/index.es56.js.map +1 -1
- package/dist/index.es57.js +85 -32
- package/dist/index.es57.js.map +1 -1
- package/dist/index.es58.js +6 -304
- package/dist/index.es58.js.map +1 -1
- package/dist/index.es59.js +15 -9
- package/dist/index.es59.js.map +1 -1
- package/dist/index.es60.js +142 -5
- package/dist/index.es60.js.map +1 -1
- package/dist/index.es61.js +285 -148
- package/dist/index.es61.js.map +1 -1
- package/dist/index.es62.js +62 -668
- package/dist/index.es62.js.map +1 -1
- package/dist/index.es63.js +201 -131
- package/dist/index.es63.js.map +1 -1
- package/dist/index.es64.js +29 -295
- package/dist/index.es64.js.map +1 -1
- package/dist/index.es65.js +8 -65
- package/dist/index.es65.js.map +1 -1
- package/dist/index.es66.js +9 -210
- package/dist/index.es66.js.map +1 -1
- package/dist/index.es67.js +181 -28
- package/dist/index.es67.js.map +1 -1
- package/dist/index.es68.js +23 -8
- package/dist/index.es68.js.map +1 -1
- package/dist/index.es69.js +1397 -9
- package/dist/index.es69.js.map +1 -1
- package/dist/index.es70.js +9 -187
- package/dist/index.es70.js.map +1 -1
- package/dist/index.es71.js +8 -24
- package/dist/index.es71.js.map +1 -1
- package/dist/index.es72.js +5 -1399
- package/dist/index.es72.js.map +1 -1
- package/dist/index.es73.js +163 -9
- package/dist/index.es73.js.map +1 -1
- package/dist/index.es74.js +672 -8
- package/dist/index.es74.js.map +1 -1
- package/dist/index.es75.js +11 -36
- package/dist/index.es75.js.map +1 -1
- package/dist/index.es76.js +40 -5
- package/dist/index.es76.js.map +1 -1
- package/dist/index.es77.js +32 -71
- package/dist/index.es77.js.map +1 -1
- package/dist/index.es78.js +225 -30
- package/dist/index.es78.js.map +1 -1
- package/dist/index.es79.js +29 -11
- package/dist/index.es79.js.map +1 -1
- package/dist/index.es80.js +72 -37
- package/dist/index.es80.js.map +1 -1
- package/dist/index.es81.js +74 -32
- package/dist/index.es81.js.map +1 -1
- package/dist/index.es82.js +46 -226
- package/dist/index.es82.js.map +1 -1
- package/dist/index.es83.js +6 -6
- package/dist/index.es83.js.map +1 -1
- package/dist/index.es84.js +39 -71
- package/dist/index.es84.js.map +1 -1
- package/dist/index.es85.js +54 -73
- package/dist/index.es85.js.map +1 -1
- package/dist/index.es86.js +13 -52
- package/dist/index.es86.js.map +1 -1
- package/dist/index.es87.js +135 -28
- package/dist/index.es87.js.map +1 -1
- package/dist/index.es88.js +20 -42
- package/dist/index.es88.js.map +1 -1
- package/dist/index.es89.js +175 -50
- package/dist/index.es89.js.map +1 -1
- package/dist/index.es90.js +240 -12
- package/dist/index.es90.js.map +1 -1
- package/dist/index.es91.js +348 -130
- package/dist/index.es91.js.map +1 -1
- package/dist/index.es92.js +134 -18
- package/dist/index.es92.js.map +1 -1
- package/dist/index.es93.js +62 -174
- package/dist/index.es93.js.map +1 -1
- package/dist/index.es94.js +30 -234
- package/dist/index.es94.js.map +1 -1
- package/dist/index.es95.js +26 -344
- package/dist/index.es95.js.map +1 -1
- package/dist/index.es96.js +156 -127
- package/dist/index.es96.js.map +1 -1
- package/dist/index.es97.js +196 -63
- package/dist/index.es97.js.map +1 -1
- package/dist/index.es98.js +14 -37
- package/dist/index.es98.js.map +1 -1
- package/dist/index.es99.js +27 -34
- package/dist/index.es99.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es119.js
CHANGED
|
@@ -1,25 +1,82 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
function getEnumValues(entries) {
|
|
2
|
+
const numericValues = Object.values(entries).filter((v) => typeof v === "number");
|
|
3
|
+
const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
|
|
4
|
+
return values;
|
|
5
|
+
}
|
|
6
|
+
function jsonStringifyReplacer(_, value) {
|
|
7
|
+
if (typeof value === "bigint")
|
|
8
|
+
return value.toString();
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
11
|
+
const EVALUATING = /* @__PURE__ */ Symbol("evaluating");
|
|
12
|
+
function defineLazy(object, key, getter) {
|
|
13
|
+
let value = void 0;
|
|
14
|
+
Object.defineProperty(object, key, {
|
|
15
|
+
get() {
|
|
16
|
+
if (value === EVALUATING) {
|
|
17
|
+
return void 0;
|
|
18
|
+
}
|
|
19
|
+
if (value === void 0) {
|
|
20
|
+
value = EVALUATING;
|
|
21
|
+
value = getter();
|
|
22
|
+
}
|
|
23
|
+
return value;
|
|
24
|
+
},
|
|
25
|
+
set(v) {
|
|
26
|
+
Object.defineProperty(object, key, {
|
|
27
|
+
value: v
|
|
28
|
+
// configurable: true,
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
configurable: true
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
|
|
35
|
+
};
|
|
36
|
+
function clone(inst, def, params) {
|
|
37
|
+
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
|
38
|
+
if (!def || params?.parent)
|
|
39
|
+
cl._zod.parent = inst;
|
|
40
|
+
return cl;
|
|
41
|
+
}
|
|
42
|
+
function normalizeParams(_params) {
|
|
43
|
+
return {};
|
|
44
|
+
}
|
|
45
|
+
function aborted(x, startIndex = 0) {
|
|
46
|
+
if (x.aborted === true)
|
|
47
|
+
return true;
|
|
48
|
+
for (let i = startIndex; i < x.issues.length; i++) {
|
|
49
|
+
if (x.issues[i]?.continue !== true) {
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
function unwrapMessage(message) {
|
|
56
|
+
return typeof message === "string" ? message : message?.message;
|
|
57
|
+
}
|
|
58
|
+
function finalizeIssue(iss, ctx, config) {
|
|
59
|
+
const full = { ...iss, path: iss.path ?? [] };
|
|
60
|
+
if (!iss.message) {
|
|
61
|
+
const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
|
|
62
|
+
full.message = message;
|
|
63
|
+
}
|
|
64
|
+
delete full.inst;
|
|
65
|
+
delete full.continue;
|
|
66
|
+
if (!ctx?.reportInput) {
|
|
67
|
+
delete full.input;
|
|
68
|
+
}
|
|
69
|
+
return full;
|
|
21
70
|
}
|
|
22
71
|
export {
|
|
23
|
-
|
|
72
|
+
aborted,
|
|
73
|
+
captureStackTrace,
|
|
74
|
+
clone,
|
|
75
|
+
defineLazy,
|
|
76
|
+
finalizeIssue,
|
|
77
|
+
getEnumValues,
|
|
78
|
+
jsonStringifyReplacer,
|
|
79
|
+
normalizeParams,
|
|
80
|
+
unwrapMessage
|
|
24
81
|
};
|
|
25
82
|
//# sourceMappingURL=index.es119.js.map
|
package/dist/index.es119.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.es119.js","sources":["../node_modules/.pnpm/@langchain+core@1.1.13_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/is-network-error/index.js"],"sourcesContent":["//#region src/utils/is-network-error/index.js\nconst objectToString = Object.prototype.toString;\nconst isError = (value) => objectToString.call(value) === \"[object Error]\";\nconst errorMessages = new Set([\n\t\"network error\",\n\t\"Failed to fetch\",\n\t\"NetworkError when attempting to fetch resource.\",\n\t\"The Internet connection appears to be offline.\",\n\t\"Network request failed\",\n\t\"fetch failed\",\n\t\"terminated\",\n\t\" A network error occurred.\",\n\t\"Network connection lost\"\n]);\nfunction isNetworkError(error) {\n\tconst isValid = error && isError(error) && error.name === \"TypeError\" && typeof error.message === \"string\";\n\tif (!isValid) return false;\n\tconst { message, stack } = error;\n\tif (message === \"Load failed\") return stack === void 0 || \"__sentry_captured__\" in error;\n\tif (message.startsWith(\"error sending request for url\")) return true;\n\treturn errorMessages.has(message);\n}\n\n//#endregion\nexport { isNetworkError };\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":"AACA,MAAM,iBAAiB,OAAO,UAAU;AACxC,MAAM,UAAU,CAAC,UAAU,eAAe,KAAK,KAAK,MAAM;AAC1D,MAAM,gBAAgB,oBAAI,IAAI;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAC;AACD,SAAS,eAAe,OAAO;AAC9B,QAAM,UAAU,SAAS,QAAQ,KAAK,KAAK,MAAM,SAAS,eAAe,OAAO,MAAM,YAAY;AAClG,MAAI,CAAC,QAAS,QAAO;AACrB,QAAM,EAAE,SAAS,MAAK,IAAK;AAC3B,MAAI,YAAY,cAAe,QAAO,UAAU,UAAU,yBAAyB;AACnF,MAAI,QAAQ,WAAW,+BAA+B,EAAG,QAAO;AAChE,SAAO,cAAc,IAAI,OAAO;AACjC;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index.es119.js","sources":["../node_modules/.pnpm/zod@4.3.5/node_modules/zod/v4/core/util.js"],"sourcesContent":["// functions\nexport function assertEqual(val) {\n return val;\n}\nexport function assertNotEqual(val) {\n return val;\n}\nexport function assertIs(_arg) { }\nexport function assertNever(_x) {\n throw new Error(\"Unexpected value in exhaustive check\");\n}\nexport function assert(_) { }\nexport function getEnumValues(entries) {\n const numericValues = Object.values(entries).filter((v) => typeof v === \"number\");\n const values = Object.entries(entries)\n .filter(([k, _]) => numericValues.indexOf(+k) === -1)\n .map(([_, v]) => v);\n return values;\n}\nexport function joinValues(array, separator = \"|\") {\n return array.map((val) => stringifyPrimitive(val)).join(separator);\n}\nexport function jsonStringifyReplacer(_, value) {\n if (typeof value === \"bigint\")\n return value.toString();\n return value;\n}\nexport function cached(getter) {\n const set = false;\n return {\n get value() {\n if (!set) {\n const value = getter();\n Object.defineProperty(this, \"value\", { value });\n return value;\n }\n throw new Error(\"cached value already set\");\n },\n };\n}\nexport function nullish(input) {\n return input === null || input === undefined;\n}\nexport function cleanRegex(source) {\n const start = source.startsWith(\"^\") ? 1 : 0;\n const end = source.endsWith(\"$\") ? source.length - 1 : source.length;\n return source.slice(start, end);\n}\nexport function floatSafeRemainder(val, step) {\n const valDecCount = (val.toString().split(\".\")[1] || \"\").length;\n const stepString = step.toString();\n let stepDecCount = (stepString.split(\".\")[1] || \"\").length;\n if (stepDecCount === 0 && /\\d?e-\\d?/.test(stepString)) {\n const match = stepString.match(/\\d?e-(\\d?)/);\n if (match?.[1]) {\n stepDecCount = Number.parseInt(match[1]);\n }\n }\n const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;\n const valInt = Number.parseInt(val.toFixed(decCount).replace(\".\", \"\"));\n const stepInt = Number.parseInt(step.toFixed(decCount).replace(\".\", \"\"));\n return (valInt % stepInt) / 10 ** decCount;\n}\nconst EVALUATING = Symbol(\"evaluating\");\nexport function defineLazy(object, key, getter) {\n let value = undefined;\n Object.defineProperty(object, key, {\n get() {\n if (value === EVALUATING) {\n // Circular reference detected, return undefined to break the cycle\n return undefined;\n }\n if (value === undefined) {\n value = EVALUATING;\n value = getter();\n }\n return value;\n },\n set(v) {\n Object.defineProperty(object, key, {\n value: v,\n // configurable: true,\n });\n // object[key] = v;\n },\n configurable: true,\n });\n}\nexport function objectClone(obj) {\n return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj));\n}\nexport function assignProp(target, prop, value) {\n Object.defineProperty(target, prop, {\n value,\n writable: true,\n enumerable: true,\n configurable: true,\n });\n}\nexport function mergeDefs(...defs) {\n const mergedDescriptors = {};\n for (const def of defs) {\n const descriptors = Object.getOwnPropertyDescriptors(def);\n Object.assign(mergedDescriptors, descriptors);\n }\n return Object.defineProperties({}, mergedDescriptors);\n}\nexport function cloneDef(schema) {\n return mergeDefs(schema._zod.def);\n}\nexport function getElementAtPath(obj, path) {\n if (!path)\n return obj;\n return path.reduce((acc, key) => acc?.[key], obj);\n}\nexport function promiseAllObject(promisesObj) {\n const keys = Object.keys(promisesObj);\n const promises = keys.map((key) => promisesObj[key]);\n return Promise.all(promises).then((results) => {\n const resolvedObj = {};\n for (let i = 0; i < keys.length; i++) {\n resolvedObj[keys[i]] = results[i];\n }\n return resolvedObj;\n });\n}\nexport function randomString(length = 10) {\n const chars = \"abcdefghijklmnopqrstuvwxyz\";\n let str = \"\";\n for (let i = 0; i < length; i++) {\n str += chars[Math.floor(Math.random() * chars.length)];\n }\n return str;\n}\nexport function esc(str) {\n return JSON.stringify(str);\n}\nexport function slugify(input) {\n return input\n .toLowerCase()\n .trim()\n .replace(/[^\\w\\s-]/g, \"\")\n .replace(/[\\s_-]+/g, \"-\")\n .replace(/^-+|-+$/g, \"\");\n}\nexport const captureStackTrace = (\"captureStackTrace\" in Error ? Error.captureStackTrace : (..._args) => { });\nexport function isObject(data) {\n return typeof data === \"object\" && data !== null && !Array.isArray(data);\n}\nexport const allowsEval = cached(() => {\n // @ts-ignore\n if (typeof navigator !== \"undefined\" && navigator?.userAgent?.includes(\"Cloudflare\")) {\n return false;\n }\n try {\n const F = Function;\n new F(\"\");\n return true;\n }\n catch (_) {\n return false;\n }\n});\nexport function isPlainObject(o) {\n if (isObject(o) === false)\n return false;\n // modified constructor\n const ctor = o.constructor;\n if (ctor === undefined)\n return true;\n if (typeof ctor !== \"function\")\n return true;\n // modified prototype\n const prot = ctor.prototype;\n if (isObject(prot) === false)\n return false;\n // ctor doesn't have static `isPrototypeOf`\n if (Object.prototype.hasOwnProperty.call(prot, \"isPrototypeOf\") === false) {\n return false;\n }\n return true;\n}\nexport function shallowClone(o) {\n if (isPlainObject(o))\n return { ...o };\n if (Array.isArray(o))\n return [...o];\n return o;\n}\nexport function numKeys(data) {\n let keyCount = 0;\n for (const key in data) {\n if (Object.prototype.hasOwnProperty.call(data, key)) {\n keyCount++;\n }\n }\n return keyCount;\n}\nexport const getParsedType = (data) => {\n const t = typeof data;\n switch (t) {\n case \"undefined\":\n return \"undefined\";\n case \"string\":\n return \"string\";\n case \"number\":\n return Number.isNaN(data) ? \"nan\" : \"number\";\n case \"boolean\":\n return \"boolean\";\n case \"function\":\n return \"function\";\n case \"bigint\":\n return \"bigint\";\n case \"symbol\":\n return \"symbol\";\n case \"object\":\n if (Array.isArray(data)) {\n return \"array\";\n }\n if (data === null) {\n return \"null\";\n }\n if (data.then && typeof data.then === \"function\" && data.catch && typeof data.catch === \"function\") {\n return \"promise\";\n }\n if (typeof Map !== \"undefined\" && data instanceof Map) {\n return \"map\";\n }\n if (typeof Set !== \"undefined\" && data instanceof Set) {\n return \"set\";\n }\n if (typeof Date !== \"undefined\" && data instanceof Date) {\n return \"date\";\n }\n // @ts-ignore\n if (typeof File !== \"undefined\" && data instanceof File) {\n return \"file\";\n }\n return \"object\";\n default:\n throw new Error(`Unknown data type: ${t}`);\n }\n};\nexport const propertyKeyTypes = new Set([\"string\", \"number\", \"symbol\"]);\nexport const primitiveTypes = new Set([\"string\", \"number\", \"bigint\", \"boolean\", \"symbol\", \"undefined\"]);\nexport function escapeRegex(str) {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n// zod-specific utils\nexport function clone(inst, def, params) {\n const cl = new inst._zod.constr(def ?? inst._zod.def);\n if (!def || params?.parent)\n cl._zod.parent = inst;\n return cl;\n}\nexport function normalizeParams(_params) {\n const params = _params;\n if (!params)\n return {};\n if (typeof params === \"string\")\n return { error: () => params };\n if (params?.message !== undefined) {\n if (params?.error !== undefined)\n throw new Error(\"Cannot specify both `message` and `error` params\");\n params.error = params.message;\n }\n delete params.message;\n if (typeof params.error === \"string\")\n return { ...params, error: () => params.error };\n return params;\n}\nexport function createTransparentProxy(getter) {\n let target;\n return new Proxy({}, {\n get(_, prop, receiver) {\n target ?? (target = getter());\n return Reflect.get(target, prop, receiver);\n },\n set(_, prop, value, receiver) {\n target ?? (target = getter());\n return Reflect.set(target, prop, value, receiver);\n },\n has(_, prop) {\n target ?? (target = getter());\n return Reflect.has(target, prop);\n },\n deleteProperty(_, prop) {\n target ?? (target = getter());\n return Reflect.deleteProperty(target, prop);\n },\n ownKeys(_) {\n target ?? (target = getter());\n return Reflect.ownKeys(target);\n },\n getOwnPropertyDescriptor(_, prop) {\n target ?? (target = getter());\n return Reflect.getOwnPropertyDescriptor(target, prop);\n },\n defineProperty(_, prop, descriptor) {\n target ?? (target = getter());\n return Reflect.defineProperty(target, prop, descriptor);\n },\n });\n}\nexport function stringifyPrimitive(value) {\n if (typeof value === \"bigint\")\n return value.toString() + \"n\";\n if (typeof value === \"string\")\n return `\"${value}\"`;\n return `${value}`;\n}\nexport function optionalKeys(shape) {\n return Object.keys(shape).filter((k) => {\n return shape[k]._zod.optin === \"optional\" && shape[k]._zod.optout === \"optional\";\n });\n}\nexport const NUMBER_FORMAT_RANGES = {\n safeint: [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER],\n int32: [-2147483648, 2147483647],\n uint32: [0, 4294967295],\n float32: [-3.4028234663852886e38, 3.4028234663852886e38],\n float64: [-Number.MAX_VALUE, Number.MAX_VALUE],\n};\nexport const BIGINT_FORMAT_RANGES = {\n int64: [/* @__PURE__*/ BigInt(\"-9223372036854775808\"), /* @__PURE__*/ BigInt(\"9223372036854775807\")],\n uint64: [/* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt(\"18446744073709551615\")],\n};\nexport function pick(schema, mask) {\n const currDef = schema._zod.def;\n const checks = currDef.checks;\n const hasChecks = checks && checks.length > 0;\n if (hasChecks) {\n throw new Error(\".pick() cannot be used on object schemas containing refinements\");\n }\n const def = mergeDefs(schema._zod.def, {\n get shape() {\n const newShape = {};\n for (const key in mask) {\n if (!(key in currDef.shape)) {\n throw new Error(`Unrecognized key: \"${key}\"`);\n }\n if (!mask[key])\n continue;\n newShape[key] = currDef.shape[key];\n }\n assignProp(this, \"shape\", newShape); // self-caching\n return newShape;\n },\n checks: [],\n });\n return clone(schema, def);\n}\nexport function omit(schema, mask) {\n const currDef = schema._zod.def;\n const checks = currDef.checks;\n const hasChecks = checks && checks.length > 0;\n if (hasChecks) {\n throw new Error(\".omit() cannot be used on object schemas containing refinements\");\n }\n const def = mergeDefs(schema._zod.def, {\n get shape() {\n const newShape = { ...schema._zod.def.shape };\n for (const key in mask) {\n if (!(key in currDef.shape)) {\n throw new Error(`Unrecognized key: \"${key}\"`);\n }\n if (!mask[key])\n continue;\n delete newShape[key];\n }\n assignProp(this, \"shape\", newShape); // self-caching\n return newShape;\n },\n checks: [],\n });\n return clone(schema, def);\n}\nexport function extend(schema, shape) {\n if (!isPlainObject(shape)) {\n throw new Error(\"Invalid input to extend: expected a plain object\");\n }\n const checks = schema._zod.def.checks;\n const hasChecks = checks && checks.length > 0;\n if (hasChecks) {\n // Only throw if new shape overlaps with existing shape\n // Use getOwnPropertyDescriptor to check key existence without accessing values\n const existingShape = schema._zod.def.shape;\n for (const key in shape) {\n if (Object.getOwnPropertyDescriptor(existingShape, key) !== undefined) {\n throw new Error(\"Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.\");\n }\n }\n }\n const def = mergeDefs(schema._zod.def, {\n get shape() {\n const _shape = { ...schema._zod.def.shape, ...shape };\n assignProp(this, \"shape\", _shape); // self-caching\n return _shape;\n },\n });\n return clone(schema, def);\n}\nexport function safeExtend(schema, shape) {\n if (!isPlainObject(shape)) {\n throw new Error(\"Invalid input to safeExtend: expected a plain object\");\n }\n const def = mergeDefs(schema._zod.def, {\n get shape() {\n const _shape = { ...schema._zod.def.shape, ...shape };\n assignProp(this, \"shape\", _shape); // self-caching\n return _shape;\n },\n });\n return clone(schema, def);\n}\nexport function merge(a, b) {\n const def = mergeDefs(a._zod.def, {\n get shape() {\n const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };\n assignProp(this, \"shape\", _shape); // self-caching\n return _shape;\n },\n get catchall() {\n return b._zod.def.catchall;\n },\n checks: [], // delete existing checks\n });\n return clone(a, def);\n}\nexport function partial(Class, schema, mask) {\n const currDef = schema._zod.def;\n const checks = currDef.checks;\n const hasChecks = checks && checks.length > 0;\n if (hasChecks) {\n throw new Error(\".partial() cannot be used on object schemas containing refinements\");\n }\n const def = mergeDefs(schema._zod.def, {\n get shape() {\n const oldShape = schema._zod.def.shape;\n const shape = { ...oldShape };\n if (mask) {\n for (const key in mask) {\n if (!(key in oldShape)) {\n throw new Error(`Unrecognized key: \"${key}\"`);\n }\n if (!mask[key])\n continue;\n // if (oldShape[key]!._zod.optin === \"optional\") continue;\n shape[key] = Class\n ? new Class({\n type: \"optional\",\n innerType: oldShape[key],\n })\n : oldShape[key];\n }\n }\n else {\n for (const key in oldShape) {\n // if (oldShape[key]!._zod.optin === \"optional\") continue;\n shape[key] = Class\n ? new Class({\n type: \"optional\",\n innerType: oldShape[key],\n })\n : oldShape[key];\n }\n }\n assignProp(this, \"shape\", shape); // self-caching\n return shape;\n },\n checks: [],\n });\n return clone(schema, def);\n}\nexport function required(Class, schema, mask) {\n const def = mergeDefs(schema._zod.def, {\n get shape() {\n const oldShape = schema._zod.def.shape;\n const shape = { ...oldShape };\n if (mask) {\n for (const key in mask) {\n if (!(key in shape)) {\n throw new Error(`Unrecognized key: \"${key}\"`);\n }\n if (!mask[key])\n continue;\n // overwrite with non-optional\n shape[key] = new Class({\n type: \"nonoptional\",\n innerType: oldShape[key],\n });\n }\n }\n else {\n for (const key in oldShape) {\n // overwrite with non-optional\n shape[key] = new Class({\n type: \"nonoptional\",\n innerType: oldShape[key],\n });\n }\n }\n assignProp(this, \"shape\", shape); // self-caching\n return shape;\n },\n });\n return clone(schema, def);\n}\n// invalid_type | too_big | too_small | invalid_format | not_multiple_of | unrecognized_keys | invalid_union | invalid_key | invalid_element | invalid_value | custom\nexport function aborted(x, startIndex = 0) {\n if (x.aborted === true)\n return true;\n for (let i = startIndex; i < x.issues.length; i++) {\n if (x.issues[i]?.continue !== true) {\n return true;\n }\n }\n return false;\n}\nexport function prefixIssues(path, issues) {\n return issues.map((iss) => {\n var _a;\n (_a = iss).path ?? (_a.path = []);\n iss.path.unshift(path);\n return iss;\n });\n}\nexport function unwrapMessage(message) {\n return typeof message === \"string\" ? message : message?.message;\n}\nexport function finalizeIssue(iss, ctx, config) {\n const full = { ...iss, path: iss.path ?? [] };\n // for backwards compatibility\n if (!iss.message) {\n const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ??\n unwrapMessage(ctx?.error?.(iss)) ??\n unwrapMessage(config.customError?.(iss)) ??\n unwrapMessage(config.localeError?.(iss)) ??\n \"Invalid input\";\n full.message = message;\n }\n // delete (full as any).def;\n delete full.inst;\n delete full.continue;\n if (!ctx?.reportInput) {\n delete full.input;\n }\n return full;\n}\nexport function getSizableOrigin(input) {\n if (input instanceof Set)\n return \"set\";\n if (input instanceof Map)\n return \"map\";\n // @ts-ignore\n if (input instanceof File)\n return \"file\";\n return \"unknown\";\n}\nexport function getLengthableOrigin(input) {\n if (Array.isArray(input))\n return \"array\";\n if (typeof input === \"string\")\n return \"string\";\n return \"unknown\";\n}\nexport function parsedType(data) {\n const t = typeof data;\n switch (t) {\n case \"number\": {\n return Number.isNaN(data) ? \"nan\" : \"number\";\n }\n case \"object\": {\n if (data === null) {\n return \"null\";\n }\n if (Array.isArray(data)) {\n return \"array\";\n }\n const obj = data;\n if (obj && Object.getPrototypeOf(obj) !== Object.prototype && \"constructor\" in obj && obj.constructor) {\n return obj.constructor.name;\n }\n }\n }\n return t;\n}\nexport function issue(...args) {\n const [iss, input, inst] = args;\n if (typeof iss === \"string\") {\n return {\n message: iss,\n code: \"custom\",\n input,\n inst,\n };\n }\n return { ...iss };\n}\nexport function cleanEnum(obj) {\n return Object.entries(obj)\n .filter(([k, _]) => {\n // return true if NaN, meaning it's not a number, thus a string key\n return Number.isNaN(Number.parseInt(k, 10));\n })\n .map((el) => el[1]);\n}\n// Codec utility functions\nexport function base64ToUint8Array(base64) {\n const binaryString = atob(base64);\n const bytes = new Uint8Array(binaryString.length);\n for (let i = 0; i < binaryString.length; i++) {\n bytes[i] = binaryString.charCodeAt(i);\n }\n return bytes;\n}\nexport function uint8ArrayToBase64(bytes) {\n let binaryString = \"\";\n for (let i = 0; i < bytes.length; i++) {\n binaryString += String.fromCharCode(bytes[i]);\n }\n return btoa(binaryString);\n}\nexport function base64urlToUint8Array(base64url) {\n const base64 = base64url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const padding = \"=\".repeat((4 - (base64.length % 4)) % 4);\n return base64ToUint8Array(base64 + padding);\n}\nexport function uint8ArrayToBase64url(bytes) {\n return uint8ArrayToBase64(bytes).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=/g, \"\");\n}\nexport function hexToUint8Array(hex) {\n const cleanHex = hex.replace(/^0x/, \"\");\n if (cleanHex.length % 2 !== 0) {\n throw new Error(\"Invalid hex string length\");\n }\n const bytes = new Uint8Array(cleanHex.length / 2);\n for (let i = 0; i < cleanHex.length; i += 2) {\n bytes[i / 2] = Number.parseInt(cleanHex.slice(i, i + 2), 16);\n }\n return bytes;\n}\nexport function uint8ArrayToHex(bytes) {\n return Array.from(bytes)\n .map((b) => b.toString(16).padStart(2, \"0\"))\n .join(\"\");\n}\n// instanceof\nexport class Class {\n constructor(..._args) { }\n}\n"],"names":[],"mappings":"AAYO,SAAS,cAAc,SAAS;AACnC,QAAM,gBAAgB,OAAO,OAAO,OAAO,EAAE,OAAO,CAAC,MAAM,OAAO,MAAM,QAAQ;AAChF,QAAM,SAAS,OAAO,QAAQ,OAAO,EAChC,OAAO,CAAC,CAAC,GAAG,CAAC,MAAM,cAAc,QAAQ,CAAC,CAAC,MAAM,EAAE,EACnD,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;AACtB,SAAO;AACX;AAIO,SAAS,sBAAsB,GAAG,OAAO;AAC5C,MAAI,OAAO,UAAU;AACjB,WAAO,MAAM,SAAQ;AACzB,SAAO;AACX;AAqCA,MAAM,aAAa,uBAAO,YAAY;AAC/B,SAAS,WAAW,QAAQ,KAAK,QAAQ;AAC5C,MAAI,QAAQ;AACZ,SAAO,eAAe,QAAQ,KAAK;AAAA,IAC/B,MAAM;AACF,UAAI,UAAU,YAAY;AAEtB,eAAO;AAAA,MACX;AACA,UAAI,UAAU,QAAW;AACrB,gBAAQ;AACR,gBAAQ,OAAM;AAAA,MAClB;AACA,aAAO;AAAA,IACX;AAAA,IACA,IAAI,GAAG;AACH,aAAO,eAAe,QAAQ,KAAK;AAAA,QAC/B,OAAO;AAAA;AAAA,MAEvB,CAAa;AAAA,IAEL;AAAA,IACA,cAAc;AAAA,EACtB,CAAK;AACL;AA0DY,MAAC,oBAAqB,uBAAuB,QAAQ,MAAM,oBAAoB,IAAI,UAAU;AAAE;AAwGpG,SAAS,MAAM,MAAM,KAAK,QAAQ;AACrC,QAAM,KAAK,IAAI,KAAK,KAAK,OAAO,OAAO,KAAK,KAAK,GAAG;AACpD,MAAI,CAAC,OAAO,QAAQ;AAChB,OAAG,KAAK,SAAS;AACrB,SAAO;AACX;AACO,SAAS,gBAAgB,SAAS;AAGjC,SAAO,CAAA;AAYf;AA+OO,SAAS,QAAQ,GAAG,aAAa,GAAG;AACvC,MAAI,EAAE,YAAY;AACd,WAAO;AACX,WAAS,IAAI,YAAY,IAAI,EAAE,OAAO,QAAQ,KAAK;AAC/C,QAAI,EAAE,OAAO,CAAC,GAAG,aAAa,MAAM;AAChC,aAAO;AAAA,IACX;AAAA,EACJ;AACA,SAAO;AACX;AASO,SAAS,cAAc,SAAS;AACnC,SAAO,OAAO,YAAY,WAAW,UAAU,SAAS;AAC5D;AACO,SAAS,cAAc,KAAK,KAAK,QAAQ;AAC5C,QAAM,OAAO,EAAE,GAAG,KAAK,MAAM,IAAI,QAAQ,GAAE;AAE3C,MAAI,CAAC,IAAI,SAAS;AACd,UAAM,UAAU,cAAc,IAAI,MAAM,KAAK,KAAK,QAAQ,GAAG,CAAC,KAC1D,cAAc,KAAK,QAAQ,GAAG,CAAC,KAC/B,cAAc,OAAO,cAAc,GAAG,CAAC,KACvC,cAAc,OAAO,cAAc,GAAG,CAAC,KACvC;AACJ,SAAK,UAAU;AAAA,EACnB;AAEA,SAAO,KAAK;AACZ,SAAO,KAAK;AACZ,MAAI,CAAC,KAAK,aAAa;AACnB,WAAO,KAAK;AAAA,EAChB;AACA,SAAO;AACX;","x_google_ignoreList":[0]}
|
package/dist/index.es120.js
CHANGED
|
@@ -1,82 +1,132 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
get() {
|
|
16
|
-
if (value === EVALUATING) {
|
|
17
|
-
return void 0;
|
|
18
|
-
}
|
|
19
|
-
if (value === void 0) {
|
|
20
|
-
value = EVALUATING;
|
|
21
|
-
value = getter();
|
|
22
|
-
}
|
|
23
|
-
return value;
|
|
24
|
-
},
|
|
25
|
-
set(v) {
|
|
26
|
-
Object.defineProperty(object, key, {
|
|
27
|
-
value: v
|
|
28
|
-
// configurable: true,
|
|
29
|
-
});
|
|
30
|
-
},
|
|
31
|
-
configurable: true
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
|
|
35
|
-
};
|
|
36
|
-
function clone(inst, def, params) {
|
|
37
|
-
const cl = new inst._zod.constr(def ?? inst._zod.def);
|
|
38
|
-
if (!def || params?.parent)
|
|
39
|
-
cl._zod.parent = inst;
|
|
40
|
-
return cl;
|
|
41
|
-
}
|
|
42
|
-
function normalizeParams(_params) {
|
|
43
|
-
return {};
|
|
44
|
-
}
|
|
45
|
-
function aborted(x, startIndex = 0) {
|
|
46
|
-
if (x.aborted === true)
|
|
47
|
-
return true;
|
|
48
|
-
for (let i = startIndex; i < x.issues.length; i++) {
|
|
49
|
-
if (x.issues[i]?.continue !== true) {
|
|
50
|
-
return true;
|
|
51
|
-
}
|
|
1
|
+
import { $constructor, $ZodAsyncError } from "./index.es161.js";
|
|
2
|
+
import { defineLazy, aborted } from "./index.es119.js";
|
|
3
|
+
import { clone } from "./index.es119.js";
|
|
4
|
+
import { safeParse, safeParseAsync } from "./index.es123.js";
|
|
5
|
+
import { version } from "./index.es163.js";
|
|
6
|
+
const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
7
|
+
var _a;
|
|
8
|
+
inst ?? (inst = {});
|
|
9
|
+
inst._zod.def = def;
|
|
10
|
+
inst._zod.bag = inst._zod.bag || {};
|
|
11
|
+
inst._zod.version = version;
|
|
12
|
+
const checks = [...inst._zod.def.checks ?? []];
|
|
13
|
+
if (inst._zod.traits.has("$ZodCheck")) {
|
|
14
|
+
checks.unshift(inst);
|
|
52
15
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
function finalizeIssue(iss, ctx, config) {
|
|
59
|
-
const full = { ...iss, path: iss.path ?? [] };
|
|
60
|
-
if (!iss.message) {
|
|
61
|
-
const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
|
|
62
|
-
full.message = message;
|
|
16
|
+
for (const ch of checks) {
|
|
17
|
+
for (const fn of ch._zod.onattach) {
|
|
18
|
+
fn(inst);
|
|
19
|
+
}
|
|
63
20
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
21
|
+
if (checks.length === 0) {
|
|
22
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
23
|
+
inst._zod.deferred?.push(() => {
|
|
24
|
+
inst._zod.run = inst._zod.parse;
|
|
25
|
+
});
|
|
26
|
+
} else {
|
|
27
|
+
const runChecks = (payload, checks2, ctx) => {
|
|
28
|
+
let isAborted = aborted(payload);
|
|
29
|
+
let asyncResult;
|
|
30
|
+
for (const ch of checks2) {
|
|
31
|
+
if (ch._zod.def.when) {
|
|
32
|
+
const shouldRun = ch._zod.def.when(payload);
|
|
33
|
+
if (!shouldRun)
|
|
34
|
+
continue;
|
|
35
|
+
} else if (isAborted) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const currLen = payload.issues.length;
|
|
39
|
+
const _ = ch._zod.check(payload);
|
|
40
|
+
if (_ instanceof Promise && ctx?.async === false) {
|
|
41
|
+
throw new $ZodAsyncError();
|
|
42
|
+
}
|
|
43
|
+
if (asyncResult || _ instanceof Promise) {
|
|
44
|
+
asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
45
|
+
await _;
|
|
46
|
+
const nextLen = payload.issues.length;
|
|
47
|
+
if (nextLen === currLen)
|
|
48
|
+
return;
|
|
49
|
+
if (!isAborted)
|
|
50
|
+
isAborted = aborted(payload, currLen);
|
|
51
|
+
});
|
|
52
|
+
} else {
|
|
53
|
+
const nextLen = payload.issues.length;
|
|
54
|
+
if (nextLen === currLen)
|
|
55
|
+
continue;
|
|
56
|
+
if (!isAborted)
|
|
57
|
+
isAborted = aborted(payload, currLen);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (asyncResult) {
|
|
61
|
+
return asyncResult.then(() => {
|
|
62
|
+
return payload;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return payload;
|
|
66
|
+
};
|
|
67
|
+
const handleCanaryResult = (canary, payload, ctx) => {
|
|
68
|
+
if (aborted(canary)) {
|
|
69
|
+
canary.aborted = true;
|
|
70
|
+
return canary;
|
|
71
|
+
}
|
|
72
|
+
const checkResult = runChecks(payload, checks, ctx);
|
|
73
|
+
if (checkResult instanceof Promise) {
|
|
74
|
+
if (ctx.async === false)
|
|
75
|
+
throw new $ZodAsyncError();
|
|
76
|
+
return checkResult.then((checkResult2) => inst._zod.parse(checkResult2, ctx));
|
|
77
|
+
}
|
|
78
|
+
return inst._zod.parse(checkResult, ctx);
|
|
79
|
+
};
|
|
80
|
+
inst._zod.run = (payload, ctx) => {
|
|
81
|
+
if (ctx.skipChecks) {
|
|
82
|
+
return inst._zod.parse(payload, ctx);
|
|
83
|
+
}
|
|
84
|
+
if (ctx.direction === "backward") {
|
|
85
|
+
const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
|
|
86
|
+
if (canary instanceof Promise) {
|
|
87
|
+
return canary.then((canary2) => {
|
|
88
|
+
return handleCanaryResult(canary2, payload, ctx);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
return handleCanaryResult(canary, payload, ctx);
|
|
92
|
+
}
|
|
93
|
+
const result = inst._zod.parse(payload, ctx);
|
|
94
|
+
if (result instanceof Promise) {
|
|
95
|
+
if (ctx.async === false)
|
|
96
|
+
throw new $ZodAsyncError();
|
|
97
|
+
return result.then((result2) => runChecks(result2, checks, ctx));
|
|
98
|
+
}
|
|
99
|
+
return runChecks(result, checks, ctx);
|
|
100
|
+
};
|
|
68
101
|
}
|
|
69
|
-
|
|
70
|
-
|
|
102
|
+
defineLazy(inst, "~standard", () => ({
|
|
103
|
+
validate: (value) => {
|
|
104
|
+
try {
|
|
105
|
+
const r = safeParse(inst, value);
|
|
106
|
+
return r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
107
|
+
} catch (_) {
|
|
108
|
+
return safeParseAsync(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
vendor: "zod",
|
|
112
|
+
version: 1
|
|
113
|
+
}));
|
|
114
|
+
});
|
|
115
|
+
const $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
|
|
116
|
+
$ZodType.init(inst, def);
|
|
117
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
118
|
+
payload.issues.push({
|
|
119
|
+
expected: "never",
|
|
120
|
+
code: "invalid_type",
|
|
121
|
+
input: payload.value,
|
|
122
|
+
inst
|
|
123
|
+
});
|
|
124
|
+
return payload;
|
|
125
|
+
};
|
|
126
|
+
});
|
|
71
127
|
export {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
clone
|
|
75
|
-
defineLazy,
|
|
76
|
-
finalizeIssue,
|
|
77
|
-
getEnumValues,
|
|
78
|
-
jsonStringifyReplacer,
|
|
79
|
-
normalizeParams,
|
|
80
|
-
unwrapMessage
|
|
128
|
+
$ZodNever,
|
|
129
|
+
$ZodType,
|
|
130
|
+
clone
|
|
81
131
|
};
|
|
82
132
|
//# sourceMappingURL=index.es120.js.map
|