@wecode-ai/weibo-openclaw-plugin 2.2.3 → 2.2.4
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/node_modules/tar/dist/commonjs/index.min.js +3 -3
- package/node_modules/tar/dist/commonjs/index.min.js.map +3 -3
- package/node_modules/tar/dist/commonjs/pack.d.ts +3 -1
- package/node_modules/tar/dist/commonjs/pack.d.ts.map +1 -1
- package/node_modules/tar/dist/commonjs/pack.js +33 -7
- package/node_modules/tar/dist/commonjs/pack.js.map +1 -1
- package/node_modules/tar/dist/esm/index.min.js +3 -3
- package/node_modules/tar/dist/esm/index.min.js.map +3 -3
- package/node_modules/tar/dist/esm/pack.d.ts +3 -1
- package/node_modules/tar/dist/esm/pack.d.ts.map +1 -1
- package/node_modules/tar/dist/esm/pack.js +33 -7
- package/node_modules/tar/dist/esm/pack.js.map +1 -1
- package/node_modules/tar/package.json +4 -4
- package/node_modules/zod/README.md +1 -18
- package/node_modules/zod/locales/package.json +2 -1
- package/node_modules/zod/mini/package.json +2 -1
- package/node_modules/zod/package.json +1 -1
- package/node_modules/zod/src/v3/tests/all-errors.test.ts +3 -3
- package/node_modules/zod/src/v3/tests/object.test.ts +5 -5
- package/node_modules/zod/src/v3/tests/partials.test.ts +3 -3
- package/node_modules/zod/src/v4/classic/errors.ts +2 -2
- package/node_modules/zod/src/v4/classic/external.ts +1 -0
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +39 -23
- package/node_modules/zod/src/v4/classic/parse.ts +6 -6
- package/node_modules/zod/src/v4/classic/schemas.ts +414 -151
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +6 -0
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +50 -0
- package/node_modules/zod/src/v4/classic/tests/codec.test.ts +142 -1
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +1 -1
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +1 -1
- package/node_modules/zod/src/v4/classic/tests/default.test.ts +44 -0
- package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +197 -0
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +34 -1
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +214 -2
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +161 -0
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +6 -6
- package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +39 -0
- package/node_modules/zod/src/v4/classic/tests/index.test.ts +2 -2
- package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +46 -0
- package/node_modules/zod/src/v4/classic/tests/locales_ka.test.ts +29 -0
- package/node_modules/zod/src/v4/classic/tests/locales_ro.test.ts +24 -0
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +55 -0
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +83 -6
- package/node_modules/zod/src/v4/classic/tests/optional.test.ts +114 -4
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +24 -1
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +1 -1
- package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +26 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +69 -0
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +85 -0
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +49 -0
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +63 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +50 -1
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +4 -4
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +150 -15
- package/node_modules/zod/src/v4/classic/tests/transform.test.ts +17 -0
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +315 -2
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +54 -0
- package/node_modules/zod/src/v4/core/api.ts +31 -6
- package/node_modules/zod/src/v4/core/checks.ts +1 -1
- package/node_modules/zod/src/v4/core/core.ts +17 -2
- package/node_modules/zod/src/v4/core/errors.ts +31 -24
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +17 -18
- package/node_modules/zod/src/v4/core/parse.ts +7 -7
- package/node_modules/zod/src/v4/core/regexes.ts +8 -1
- package/node_modules/zod/src/v4/core/schemas.ts +263 -71
- package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +215 -0
- package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +72 -0
- package/node_modules/zod/src/v4/core/tests/locales/hr.test.ts +163 -0
- package/node_modules/zod/src/v4/core/tests/locales/uz.test.ts +22 -0
- package/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +58 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +10 -1
- package/node_modules/zod/src/v4/core/util.ts +52 -35
- package/node_modules/zod/src/v4/core/versions.ts +2 -2
- package/node_modules/zod/src/v4/locales/el.ts +121 -0
- package/node_modules/zod/src/v4/locales/en.ts +4 -0
- package/node_modules/zod/src/v4/locales/fr.ts +24 -8
- package/node_modules/zod/src/v4/locales/hr.ts +131 -0
- package/node_modules/zod/src/v4/locales/index.ts +3 -0
- package/node_modules/zod/src/v4/locales/it.ts +1 -1
- package/node_modules/zod/src/v4/locales/ka.ts +8 -8
- package/node_modules/zod/src/v4/locales/ro.ts +129 -0
- package/node_modules/zod/src/v4/locales/uz.ts +1 -0
- package/node_modules/zod/src/v4/mini/external.ts +1 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +56 -25
- package/node_modules/zod/src/v4/mini/tests/codec.test.ts +19 -0
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +32 -2
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +9 -9
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +51 -1
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +5 -0
- package/node_modules/zod/v3/package.json +2 -1
- package/node_modules/zod/v4/classic/errors.js +2 -2
- package/node_modules/zod/v4/classic/external.d.cts +1 -0
- package/node_modules/zod/v4/classic/external.d.ts +1 -0
- package/node_modules/zod/v4/classic/from-json-schema.cjs +31 -16
- package/node_modules/zod/v4/classic/from-json-schema.js +31 -16
- package/node_modules/zod/v4/classic/package.json +2 -1
- package/node_modules/zod/v4/classic/schemas.cjs +358 -119
- package/node_modules/zod/v4/classic/schemas.d.cts +42 -14
- package/node_modules/zod/v4/classic/schemas.d.ts +42 -14
- package/node_modules/zod/v4/classic/schemas.js +356 -118
- package/node_modules/zod/v4/core/api.cjs +7 -2
- package/node_modules/zod/v4/core/api.d.cts +26 -5
- package/node_modules/zod/v4/core/api.d.ts +26 -5
- package/node_modules/zod/v4/core/api.js +7 -2
- package/node_modules/zod/v4/core/checks.d.cts +1 -1
- package/node_modules/zod/v4/core/checks.d.ts +1 -1
- package/node_modules/zod/v4/core/core.cjs +3 -1
- package/node_modules/zod/v4/core/core.js +4 -2
- package/node_modules/zod/v4/core/errors.cjs +26 -23
- package/node_modules/zod/v4/core/errors.d.cts +1 -0
- package/node_modules/zod/v4/core/errors.d.ts +1 -0
- package/node_modules/zod/v4/core/errors.js +26 -23
- package/node_modules/zod/v4/core/json-schema-processors.cjs +16 -20
- package/node_modules/zod/v4/core/json-schema-processors.js +16 -20
- package/node_modules/zod/v4/core/package.json +2 -1
- package/node_modules/zod/v4/core/parse.cjs +7 -7
- package/node_modules/zod/v4/core/parse.js +7 -7
- package/node_modules/zod/v4/core/regexes.cjs +9 -3
- package/node_modules/zod/v4/core/regexes.d.cts +6 -0
- package/node_modules/zod/v4/core/regexes.d.ts +6 -0
- package/node_modules/zod/v4/core/regexes.js +7 -1
- package/node_modules/zod/v4/core/schemas.cjs +211 -65
- package/node_modules/zod/v4/core/schemas.d.cts +39 -1
- package/node_modules/zod/v4/core/schemas.d.ts +39 -1
- package/node_modules/zod/v4/core/schemas.js +210 -64
- package/node_modules/zod/v4/core/to-json-schema.cjs +12 -1
- package/node_modules/zod/v4/core/to-json-schema.js +12 -1
- package/node_modules/zod/v4/core/util.cjs +54 -30
- package/node_modules/zod/v4/core/util.d.cts +1 -0
- package/node_modules/zod/v4/core/util.d.ts +1 -0
- package/node_modules/zod/v4/core/util.js +55 -32
- package/node_modules/zod/v4/core/versions.cjs +2 -2
- package/node_modules/zod/v4/core/versions.d.cts +1 -1
- package/node_modules/zod/v4/core/versions.d.ts +1 -1
- package/node_modules/zod/v4/core/versions.js +2 -2
- package/node_modules/zod/v4/locales/el.cjs +136 -0
- package/node_modules/zod/v4/locales/el.d.cts +5 -0
- package/node_modules/zod/v4/locales/el.d.ts +4 -0
- package/node_modules/zod/v4/locales/el.js +109 -0
- package/node_modules/zod/v4/locales/en.cjs +4 -0
- package/node_modules/zod/v4/locales/en.js +4 -0
- package/node_modules/zod/v4/locales/fr.cjs +24 -7
- package/node_modules/zod/v4/locales/fr.js +24 -7
- package/node_modules/zod/v4/locales/hr.cjs +149 -0
- package/node_modules/zod/v4/locales/hr.d.cts +5 -0
- package/node_modules/zod/v4/locales/hr.d.ts +4 -0
- package/node_modules/zod/v4/locales/hr.js +122 -0
- package/node_modules/zod/v4/locales/index.cjs +8 -1
- package/node_modules/zod/v4/locales/index.d.cts +3 -0
- package/node_modules/zod/v4/locales/index.d.ts +3 -0
- package/node_modules/zod/v4/locales/index.js +3 -0
- package/node_modules/zod/v4/locales/it.cjs +1 -1
- package/node_modules/zod/v4/locales/it.js +1 -1
- package/node_modules/zod/v4/locales/ka.cjs +8 -8
- package/node_modules/zod/v4/locales/ka.js +8 -8
- package/node_modules/zod/v4/locales/package.json +2 -1
- package/node_modules/zod/v4/locales/ro.cjs +146 -0
- package/node_modules/zod/v4/locales/ro.d.cts +5 -0
- package/node_modules/zod/v4/locales/ro.d.ts +4 -0
- package/node_modules/zod/v4/locales/ro.js +119 -0
- package/node_modules/zod/v4/locales/uz.cjs +1 -0
- package/node_modules/zod/v4/locales/uz.js +1 -0
- package/node_modules/zod/v4/mini/external.d.cts +1 -0
- package/node_modules/zod/v4/mini/external.d.ts +1 -0
- package/node_modules/zod/v4/mini/package.json +2 -1
- package/node_modules/zod/v4/mini/schemas.cjs +41 -4
- package/node_modules/zod/v4/mini/schemas.d.cts +28 -10
- package/node_modules/zod/v4/mini/schemas.d.ts +28 -10
- package/node_modules/zod/v4/mini/schemas.js +40 -4
- package/node_modules/zod/v4/package.json +2 -1
- package/node_modules/zod/v4-mini/package.json +2 -1
- package/package.json +2 -1
- package/src/accounts.js +1 -1
- package/src/accounts.js.map +1 -1
- package/src/channel.js +1 -1
- package/src/channel.js.map +1 -1
- package/src/outbound.d.ts.map +1 -1
- package/src/outbound.js +82 -4
- package/src/outbound.js.map +1 -1
- package/src/send.d.ts +23 -0
- package/src/send.d.ts.map +1 -1
- package/src/send.js +54 -2
- package/src/send.js.map +1 -1
- package/src/token.d.ts +8 -0
- package/src/token.d.ts.map +1 -1
- package/src/token.js +16 -1
- package/src/token.js.map +1 -1
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.$ZodTuple = exports.$ZodIntersection = exports.$ZodDiscriminatedUnion = exports.$ZodXor = exports.$ZodUnion = exports.$ZodObjectJIT = exports.$ZodObject = exports.$ZodArray = exports.$ZodDate = exports.$ZodVoid = exports.$ZodNever = exports.$ZodUnknown = exports.$ZodAny = exports.$ZodNull = exports.$ZodUndefined = exports.$ZodSymbol = exports.$ZodBigIntFormat = exports.$ZodBigInt = exports.$ZodBoolean = exports.$ZodNumberFormat = exports.$ZodNumber = exports.$ZodCustomStringFormat = exports.$ZodJWT = exports.$ZodE164 = exports.$ZodBase64URL = exports.$ZodBase64 = exports.$ZodCIDRv6 = exports.$ZodCIDRv4 = exports.$ZodMAC = exports.$ZodIPv6 = exports.$ZodIPv4 = exports.$ZodISODuration = exports.$ZodISOTime = exports.$ZodISODate = exports.$ZodISODateTime = exports.$ZodKSUID = exports.$ZodXID = exports.$ZodULID = exports.$ZodCUID2 = exports.$ZodCUID = exports.$ZodNanoID = exports.$ZodEmoji = exports.$ZodURL = exports.$ZodEmail = exports.$ZodUUID = exports.$ZodGUID = exports.$ZodStringFormat = exports.$ZodString = exports.clone = exports.$ZodType = void 0;
|
|
27
|
-
exports.$ZodCustom = exports.$ZodLazy = exports.$ZodPromise = exports.$ZodFunction = exports.$ZodTemplateLiteral = exports.$ZodReadonly = exports.$ZodCodec = exports.$ZodPipe = exports.$ZodNaN = exports.$ZodCatch = exports.$ZodSuccess = exports.$ZodNonOptional = exports.$ZodPrefault = exports.$ZodDefault = exports.$ZodNullable = exports.$ZodExactOptional = exports.$ZodOptional = exports.$ZodTransform = exports.$ZodFile = exports.$ZodLiteral = exports.$ZodEnum = exports.$ZodSet = exports.$ZodMap = exports.$ZodRecord = void 0;
|
|
27
|
+
exports.$ZodCustom = exports.$ZodLazy = exports.$ZodPromise = exports.$ZodFunction = exports.$ZodTemplateLiteral = exports.$ZodReadonly = exports.$ZodPreprocess = exports.$ZodCodec = exports.$ZodPipe = exports.$ZodNaN = exports.$ZodCatch = exports.$ZodSuccess = exports.$ZodNonOptional = exports.$ZodPrefault = exports.$ZodDefault = exports.$ZodNullable = exports.$ZodExactOptional = exports.$ZodOptional = exports.$ZodTransform = exports.$ZodFile = exports.$ZodLiteral = exports.$ZodEnum = exports.$ZodSet = exports.$ZodMap = exports.$ZodRecord = void 0;
|
|
28
28
|
exports.isValidBase64 = isValidBase64;
|
|
29
29
|
exports.isValidBase64URL = isValidBase64URL;
|
|
30
30
|
exports.isValidJWT = isValidJWT;
|
|
@@ -65,6 +65,8 @@ exports.$ZodType = core.$constructor("$ZodType", (inst, def) => {
|
|
|
65
65
|
let asyncResult;
|
|
66
66
|
for (const ch of checks) {
|
|
67
67
|
if (ch._zod.def.when) {
|
|
68
|
+
if (util.explicitlyAborted(payload))
|
|
69
|
+
continue;
|
|
68
70
|
const shouldRun = ch._zod.def.when(payload);
|
|
69
71
|
if (!shouldRun)
|
|
70
72
|
continue;
|
|
@@ -219,6 +221,21 @@ exports.$ZodURL = core.$constructor("$ZodURL", (inst, def) => {
|
|
|
219
221
|
try {
|
|
220
222
|
// Trim whitespace from input
|
|
221
223
|
const trimmed = payload.value.trim();
|
|
224
|
+
// When normalize is off, require :// for http/https URLs
|
|
225
|
+
// This prevents strings like "http:example.com" or "https:/path" from being silently accepted
|
|
226
|
+
if (!def.normalize && def.protocol?.source === regexes.httpProtocol.source) {
|
|
227
|
+
if (!/^https?:\/\//i.test(trimmed)) {
|
|
228
|
+
payload.issues.push({
|
|
229
|
+
code: "invalid_format",
|
|
230
|
+
format: "url",
|
|
231
|
+
note: "Invalid URL format",
|
|
232
|
+
input: payload.value,
|
|
233
|
+
inst,
|
|
234
|
+
continue: !def.abort,
|
|
235
|
+
});
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
222
239
|
// @ts-ignore
|
|
223
240
|
const url = new URL(trimmed);
|
|
224
241
|
if (def.hostname) {
|
|
@@ -279,6 +296,11 @@ exports.$ZodNanoID = core.$constructor("$ZodNanoID", (inst, def) => {
|
|
|
279
296
|
def.pattern ?? (def.pattern = regexes.nanoid);
|
|
280
297
|
exports.$ZodStringFormat.init(inst, def);
|
|
281
298
|
});
|
|
299
|
+
/**
|
|
300
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
301
|
+
* (timestamps embedded in the id). Use {@link $ZodCUID2} instead.
|
|
302
|
+
* See https://github.com/paralleldrive/cuid.
|
|
303
|
+
*/
|
|
282
304
|
exports.$ZodCUID = core.$constructor("$ZodCUID", (inst, def) => {
|
|
283
305
|
def.pattern ?? (def.pattern = regexes.cuid);
|
|
284
306
|
exports.$ZodStringFormat.init(inst, def);
|
|
@@ -384,6 +406,9 @@ exports.$ZodCIDRv6 = core.$constructor("$ZodCIDRv6", (inst, def) => {
|
|
|
384
406
|
function isValidBase64(data) {
|
|
385
407
|
if (data === "")
|
|
386
408
|
return true;
|
|
409
|
+
// atob ignores whitespace, so reject it up front.
|
|
410
|
+
if (/\s/.test(data))
|
|
411
|
+
return false;
|
|
387
412
|
if (data.length % 4 !== 0)
|
|
388
413
|
return false;
|
|
389
414
|
try {
|
|
@@ -588,8 +613,6 @@ exports.$ZodUndefined = core.$constructor("$ZodUndefined", (inst, def) => {
|
|
|
588
613
|
exports.$ZodType.init(inst, def);
|
|
589
614
|
inst._zod.pattern = regexes.undefined;
|
|
590
615
|
inst._zod.values = new Set([undefined]);
|
|
591
|
-
inst._zod.optin = "optional";
|
|
592
|
-
inst._zod.optout = "optional";
|
|
593
616
|
inst._zod.parse = (payload, _ctx) => {
|
|
594
617
|
const input = payload.value;
|
|
595
618
|
if (typeof input === "undefined")
|
|
@@ -719,16 +742,28 @@ exports.$ZodArray = core.$constructor("$ZodArray", (inst, def) => {
|
|
|
719
742
|
return payload; //handleArrayResultsAsync(parseResults, final);
|
|
720
743
|
};
|
|
721
744
|
});
|
|
722
|
-
function handlePropertyResult(result, final, key, input, isOptionalOut) {
|
|
745
|
+
function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
|
|
746
|
+
const isPresent = key in input;
|
|
723
747
|
if (result.issues.length) {
|
|
724
|
-
// For optional-out schemas, ignore errors on absent keys
|
|
725
|
-
if (isOptionalOut && !
|
|
748
|
+
// For optional-in/out schemas, ignore errors on absent keys.
|
|
749
|
+
if (isOptionalIn && isOptionalOut && !isPresent) {
|
|
726
750
|
return;
|
|
727
751
|
}
|
|
728
752
|
final.issues.push(...util.prefixIssues(key, result.issues));
|
|
729
753
|
}
|
|
754
|
+
if (!isPresent && !isOptionalIn) {
|
|
755
|
+
if (!result.issues.length) {
|
|
756
|
+
final.issues.push({
|
|
757
|
+
code: "invalid_type",
|
|
758
|
+
expected: "nonoptional",
|
|
759
|
+
input: undefined,
|
|
760
|
+
path: [key],
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
730
765
|
if (result.value === undefined) {
|
|
731
|
-
if (
|
|
766
|
+
if (isPresent) {
|
|
732
767
|
final.value[key] = undefined;
|
|
733
768
|
}
|
|
734
769
|
}
|
|
@@ -754,12 +789,16 @@ function normalizeDef(def) {
|
|
|
754
789
|
}
|
|
755
790
|
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
756
791
|
const unrecognized = [];
|
|
757
|
-
// iterate over input keys
|
|
758
792
|
const keySet = def.keySet;
|
|
759
793
|
const _catchall = def.catchall._zod;
|
|
760
794
|
const t = _catchall.def.type;
|
|
795
|
+
const isOptionalIn = _catchall.optin === "optional";
|
|
761
796
|
const isOptionalOut = _catchall.optout === "optional";
|
|
762
797
|
for (const key in input) {
|
|
798
|
+
// skip __proto__ so it can't replace the result prototype via the
|
|
799
|
+
// assignment setter on the plain {} we build into
|
|
800
|
+
if (key === "__proto__")
|
|
801
|
+
continue;
|
|
763
802
|
if (keySet.has(key))
|
|
764
803
|
continue;
|
|
765
804
|
if (t === "never") {
|
|
@@ -768,10 +807,10 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
768
807
|
}
|
|
769
808
|
const r = _catchall.run({ value: input[key], issues: [] }, ctx);
|
|
770
809
|
if (r instanceof Promise) {
|
|
771
|
-
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
|
|
810
|
+
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
|
|
772
811
|
}
|
|
773
812
|
else {
|
|
774
|
-
handlePropertyResult(r, payload, key, input, isOptionalOut);
|
|
813
|
+
handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
|
|
775
814
|
}
|
|
776
815
|
}
|
|
777
816
|
if (unrecognized.length) {
|
|
@@ -839,13 +878,14 @@ exports.$ZodObject = core.$constructor("$ZodObject", (inst, def) => {
|
|
|
839
878
|
const shape = value.shape;
|
|
840
879
|
for (const key of value.keys) {
|
|
841
880
|
const el = shape[key];
|
|
881
|
+
const isOptionalIn = el._zod.optin === "optional";
|
|
842
882
|
const isOptionalOut = el._zod.optout === "optional";
|
|
843
883
|
const r = el._zod.run({ value: input[key], issues: [] }, ctx);
|
|
844
884
|
if (r instanceof Promise) {
|
|
845
|
-
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalOut)));
|
|
885
|
+
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut)));
|
|
846
886
|
}
|
|
847
887
|
else {
|
|
848
|
-
handlePropertyResult(r, payload, key, input, isOptionalOut);
|
|
888
|
+
handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
|
|
849
889
|
}
|
|
850
890
|
}
|
|
851
891
|
if (!catchall) {
|
|
@@ -878,10 +918,11 @@ exports.$ZodObjectJIT = core.$constructor("$ZodObjectJIT", (inst, def) => {
|
|
|
878
918
|
const id = ids[key];
|
|
879
919
|
const k = util.esc(key);
|
|
880
920
|
const schema = shape[key];
|
|
921
|
+
const isOptionalIn = schema?._zod?.optin === "optional";
|
|
881
922
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
882
923
|
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
883
|
-
if (isOptionalOut) {
|
|
884
|
-
// For optional-out schemas, ignore errors on absent keys
|
|
924
|
+
if (isOptionalIn && isOptionalOut) {
|
|
925
|
+
// For optional-in/out schemas, ignore errors on absent keys
|
|
885
926
|
doc.write(`
|
|
886
927
|
if (${id}.issues.length) {
|
|
887
928
|
if (${k} in input) {
|
|
@@ -900,6 +941,34 @@ exports.$ZodObjectJIT = core.$constructor("$ZodObjectJIT", (inst, def) => {
|
|
|
900
941
|
newResult[${k}] = ${id}.value;
|
|
901
942
|
}
|
|
902
943
|
|
|
944
|
+
`);
|
|
945
|
+
}
|
|
946
|
+
else if (!isOptionalIn) {
|
|
947
|
+
doc.write(`
|
|
948
|
+
const ${id}_present = ${k} in input;
|
|
949
|
+
if (${id}.issues.length) {
|
|
950
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
951
|
+
...iss,
|
|
952
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
953
|
+
})));
|
|
954
|
+
}
|
|
955
|
+
if (!${id}_present && !${id}.issues.length) {
|
|
956
|
+
payload.issues.push({
|
|
957
|
+
code: "invalid_type",
|
|
958
|
+
expected: "nonoptional",
|
|
959
|
+
input: undefined,
|
|
960
|
+
path: [${k}]
|
|
961
|
+
});
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
if (${id}_present) {
|
|
965
|
+
if (${id}.value === undefined) {
|
|
966
|
+
newResult[${k}] = undefined;
|
|
967
|
+
} else {
|
|
968
|
+
newResult[${k}] = ${id}.value;
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
|
|
903
972
|
`);
|
|
904
973
|
}
|
|
905
974
|
else {
|
|
@@ -995,10 +1064,9 @@ exports.$ZodUnion = core.$constructor("$ZodUnion", (inst, def) => {
|
|
|
995
1064
|
}
|
|
996
1065
|
return undefined;
|
|
997
1066
|
});
|
|
998
|
-
const
|
|
999
|
-
const first = def.options[0]._zod.run;
|
|
1067
|
+
const first = def.options.length === 1 ? def.options[0]._zod.run : null;
|
|
1000
1068
|
inst._zod.parse = (payload, ctx) => {
|
|
1001
|
-
if (
|
|
1069
|
+
if (first) {
|
|
1002
1070
|
return first(payload, ctx);
|
|
1003
1071
|
}
|
|
1004
1072
|
let async = false;
|
|
@@ -1055,10 +1123,9 @@ function handleExclusiveUnionResults(results, final, inst, ctx) {
|
|
|
1055
1123
|
exports.$ZodXor = core.$constructor("$ZodXor", (inst, def) => {
|
|
1056
1124
|
exports.$ZodUnion.init(inst, def);
|
|
1057
1125
|
def.inclusive = false;
|
|
1058
|
-
const
|
|
1059
|
-
const first = def.options[0]._zod.run;
|
|
1126
|
+
const first = def.options.length === 1 ? def.options[0]._zod.run : null;
|
|
1060
1127
|
inst._zod.parse = (payload, ctx) => {
|
|
1061
|
-
if (
|
|
1128
|
+
if (first) {
|
|
1062
1129
|
return first(payload, ctx);
|
|
1063
1130
|
}
|
|
1064
1131
|
let async = false;
|
|
@@ -1136,7 +1203,11 @@ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
|
1136
1203
|
if (opt) {
|
|
1137
1204
|
return opt._zod.run(payload, ctx);
|
|
1138
1205
|
}
|
|
1139
|
-
|
|
1206
|
+
// Fall back to union matching when the fast discriminator path fails:
|
|
1207
|
+
// - explicitly enabled via unionFallback, or
|
|
1208
|
+
// - during backward direction (encode), since codec-based discriminators
|
|
1209
|
+
// have different values in forward vs backward directions
|
|
1210
|
+
if (def.unionFallback || ctx.direction === "backward") {
|
|
1140
1211
|
return _super(payload, ctx);
|
|
1141
1212
|
}
|
|
1142
1213
|
// no matching discriminator
|
|
@@ -1145,6 +1216,7 @@ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
|
1145
1216
|
errors: [],
|
|
1146
1217
|
note: "No matching discriminator",
|
|
1147
1218
|
discriminator: def.discriminator,
|
|
1219
|
+
options: Array.from(disc.value.keys()),
|
|
1148
1220
|
input,
|
|
1149
1221
|
path: [def.discriminator],
|
|
1150
1222
|
inst,
|
|
@@ -1272,67 +1344,112 @@ exports.$ZodTuple = core.$constructor("$ZodTuple", (inst, def) => {
|
|
|
1272
1344
|
}
|
|
1273
1345
|
payload.value = [];
|
|
1274
1346
|
const proms = [];
|
|
1275
|
-
const
|
|
1276
|
-
const
|
|
1347
|
+
const optinStart = getTupleOptStart(items, "optin");
|
|
1348
|
+
const optoutStart = getTupleOptStart(items, "optout");
|
|
1277
1349
|
if (!def.rest) {
|
|
1278
|
-
|
|
1279
|
-
const tooSmall = input.length < optStart - 1;
|
|
1280
|
-
if (tooBig || tooSmall) {
|
|
1350
|
+
if (input.length < optinStart) {
|
|
1281
1351
|
payload.issues.push({
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1352
|
+
code: "too_small",
|
|
1353
|
+
minimum: optinStart,
|
|
1354
|
+
inclusive: true,
|
|
1285
1355
|
input,
|
|
1286
1356
|
inst,
|
|
1287
1357
|
origin: "array",
|
|
1288
1358
|
});
|
|
1289
1359
|
return payload;
|
|
1290
1360
|
}
|
|
1361
|
+
if (input.length > items.length) {
|
|
1362
|
+
payload.issues.push({
|
|
1363
|
+
code: "too_big",
|
|
1364
|
+
maximum: items.length,
|
|
1365
|
+
inclusive: true,
|
|
1366
|
+
input,
|
|
1367
|
+
inst,
|
|
1368
|
+
origin: "array",
|
|
1369
|
+
});
|
|
1370
|
+
}
|
|
1291
1371
|
}
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
const
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
proms.push(result.then((result) => handleTupleResult(result, payload, i)));
|
|
1372
|
+
// Run every item in parallel, collecting results into an indexed
|
|
1373
|
+
// array. The post-processing in `handleTupleResults` walks them in
|
|
1374
|
+
// order so it can decide whether an absent optional-output error can
|
|
1375
|
+
// truncate the tail or must be reported to preserve required output.
|
|
1376
|
+
const itemResults = new Array(items.length);
|
|
1377
|
+
for (let i = 0; i < items.length; i++) {
|
|
1378
|
+
const r = items[i]._zod.run({ value: input[i], issues: [] }, ctx);
|
|
1379
|
+
if (r instanceof Promise) {
|
|
1380
|
+
proms.push(r.then((rr) => {
|
|
1381
|
+
itemResults[i] = rr;
|
|
1382
|
+
}));
|
|
1304
1383
|
}
|
|
1305
1384
|
else {
|
|
1306
|
-
|
|
1385
|
+
itemResults[i] = r;
|
|
1307
1386
|
}
|
|
1308
1387
|
}
|
|
1309
1388
|
if (def.rest) {
|
|
1389
|
+
let i = items.length - 1;
|
|
1310
1390
|
const rest = input.slice(items.length);
|
|
1311
1391
|
for (const el of rest) {
|
|
1312
1392
|
i++;
|
|
1313
|
-
const result = def.rest._zod.run({
|
|
1314
|
-
value: el,
|
|
1315
|
-
issues: [],
|
|
1316
|
-
}, ctx);
|
|
1393
|
+
const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
|
|
1317
1394
|
if (result instanceof Promise) {
|
|
1318
|
-
proms.push(result.then((
|
|
1395
|
+
proms.push(result.then((r) => handleTupleResult(r, payload, i)));
|
|
1319
1396
|
}
|
|
1320
1397
|
else {
|
|
1321
1398
|
handleTupleResult(result, payload, i);
|
|
1322
1399
|
}
|
|
1323
1400
|
}
|
|
1324
1401
|
}
|
|
1325
|
-
if (proms.length)
|
|
1326
|
-
return Promise.all(proms).then(() => payload);
|
|
1327
|
-
|
|
1402
|
+
if (proms.length) {
|
|
1403
|
+
return Promise.all(proms).then(() => handleTupleResults(itemResults, payload, items, input, optoutStart));
|
|
1404
|
+
}
|
|
1405
|
+
return handleTupleResults(itemResults, payload, items, input, optoutStart);
|
|
1328
1406
|
};
|
|
1329
1407
|
});
|
|
1408
|
+
function getTupleOptStart(items, key) {
|
|
1409
|
+
for (let i = items.length - 1; i >= 0; i--) {
|
|
1410
|
+
if (items[i]._zod[key] !== "optional")
|
|
1411
|
+
return i + 1;
|
|
1412
|
+
}
|
|
1413
|
+
return 0;
|
|
1414
|
+
}
|
|
1330
1415
|
function handleTupleResult(result, final, index) {
|
|
1331
1416
|
if (result.issues.length) {
|
|
1332
1417
|
final.issues.push(...util.prefixIssues(index, result.issues));
|
|
1333
1418
|
}
|
|
1334
1419
|
final.value[index] = result.value;
|
|
1335
1420
|
}
|
|
1421
|
+
function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
1422
|
+
// Walk results in order. Mirror $ZodObject's swallow-on-absent-optional
|
|
1423
|
+
// rule, but only after `optoutStart`: the first index where the output
|
|
1424
|
+
// tuple tail can be absent.
|
|
1425
|
+
for (let i = 0; i < items.length; i++) {
|
|
1426
|
+
const r = itemResults[i];
|
|
1427
|
+
const isPresent = i < input.length;
|
|
1428
|
+
if (r.issues.length) {
|
|
1429
|
+
if (!isPresent && i >= optoutStart) {
|
|
1430
|
+
final.value.length = i;
|
|
1431
|
+
break;
|
|
1432
|
+
}
|
|
1433
|
+
final.issues.push(...util.prefixIssues(i, r.issues));
|
|
1434
|
+
}
|
|
1435
|
+
final.value[i] = r.value;
|
|
1436
|
+
}
|
|
1437
|
+
// Drop trailing slots that produced `undefined` for absent input
|
|
1438
|
+
// (the array analog of an absent optional key on an object). The
|
|
1439
|
+
// `i >= input.length` floor is critical: an explicit `undefined`
|
|
1440
|
+
// *inside* the input must be preserved even when the schema is
|
|
1441
|
+
// optional-out (e.g. `z.string().or(z.undefined())` accepting an
|
|
1442
|
+
// explicit undefined value).
|
|
1443
|
+
for (let i = final.value.length - 1; i >= input.length; i--) {
|
|
1444
|
+
if (items[i]._zod.optout === "optional" && final.value[i] === undefined) {
|
|
1445
|
+
final.value.length = i;
|
|
1446
|
+
}
|
|
1447
|
+
else {
|
|
1448
|
+
break;
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
return final;
|
|
1452
|
+
}
|
|
1336
1453
|
exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
|
|
1337
1454
|
exports.$ZodType.init(inst, def);
|
|
1338
1455
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -1354,20 +1471,36 @@ exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
|
|
|
1354
1471
|
for (const key of values) {
|
|
1355
1472
|
if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
1356
1473
|
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
1474
|
+
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
1475
|
+
if (keyResult instanceof Promise) {
|
|
1476
|
+
throw new Error("Async schemas not supported in object keys currently");
|
|
1477
|
+
}
|
|
1478
|
+
if (keyResult.issues.length) {
|
|
1479
|
+
payload.issues.push({
|
|
1480
|
+
code: "invalid_key",
|
|
1481
|
+
origin: "record",
|
|
1482
|
+
issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
|
|
1483
|
+
input: key,
|
|
1484
|
+
path: [key],
|
|
1485
|
+
inst,
|
|
1486
|
+
});
|
|
1487
|
+
continue;
|
|
1488
|
+
}
|
|
1489
|
+
const outKey = keyResult.value;
|
|
1357
1490
|
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
1358
1491
|
if (result instanceof Promise) {
|
|
1359
1492
|
proms.push(result.then((result) => {
|
|
1360
1493
|
if (result.issues.length) {
|
|
1361
1494
|
payload.issues.push(...util.prefixIssues(key, result.issues));
|
|
1362
1495
|
}
|
|
1363
|
-
payload.value[
|
|
1496
|
+
payload.value[outKey] = result.value;
|
|
1364
1497
|
}));
|
|
1365
1498
|
}
|
|
1366
1499
|
else {
|
|
1367
1500
|
if (result.issues.length) {
|
|
1368
1501
|
payload.issues.push(...util.prefixIssues(key, result.issues));
|
|
1369
1502
|
}
|
|
1370
|
-
payload.value[
|
|
1503
|
+
payload.value[outKey] = result.value;
|
|
1371
1504
|
}
|
|
1372
1505
|
}
|
|
1373
1506
|
}
|
|
@@ -1389,9 +1522,12 @@ exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
|
|
|
1389
1522
|
}
|
|
1390
1523
|
else {
|
|
1391
1524
|
payload.value = {};
|
|
1525
|
+
// Reflect.ownKeys for Symbol-key support; filter non-enumerable to match z.object()
|
|
1392
1526
|
for (const key of Reflect.ownKeys(input)) {
|
|
1393
1527
|
if (key === "__proto__")
|
|
1394
1528
|
continue;
|
|
1529
|
+
if (!Object.prototype.propertyIsEnumerable.call(input, key))
|
|
1530
|
+
continue;
|
|
1395
1531
|
let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
1396
1532
|
if (keyResult instanceof Promise) {
|
|
1397
1533
|
throw new Error("Async schemas not supported in object keys currently");
|
|
@@ -1612,6 +1748,7 @@ exports.$ZodFile = core.$constructor("$ZodFile", (inst, def) => {
|
|
|
1612
1748
|
});
|
|
1613
1749
|
exports.$ZodTransform = core.$constructor("$ZodTransform", (inst, def) => {
|
|
1614
1750
|
exports.$ZodType.init(inst, def);
|
|
1751
|
+
inst._zod.optin = "optional";
|
|
1615
1752
|
inst._zod.parse = (payload, ctx) => {
|
|
1616
1753
|
if (ctx.direction === "backward") {
|
|
1617
1754
|
throw new core.$ZodEncodeError(inst.constructor.name);
|
|
@@ -1621,6 +1758,7 @@ exports.$ZodTransform = core.$constructor("$ZodTransform", (inst, def) => {
|
|
|
1621
1758
|
const output = _out instanceof Promise ? _out : Promise.resolve(_out);
|
|
1622
1759
|
return output.then((output) => {
|
|
1623
1760
|
payload.value = output;
|
|
1761
|
+
payload.fallback = true;
|
|
1624
1762
|
return payload;
|
|
1625
1763
|
});
|
|
1626
1764
|
}
|
|
@@ -1628,11 +1766,12 @@ exports.$ZodTransform = core.$constructor("$ZodTransform", (inst, def) => {
|
|
|
1628
1766
|
throw new core.$ZodAsyncError();
|
|
1629
1767
|
}
|
|
1630
1768
|
payload.value = _out;
|
|
1769
|
+
payload.fallback = true;
|
|
1631
1770
|
return payload;
|
|
1632
1771
|
};
|
|
1633
1772
|
});
|
|
1634
1773
|
function handleOptionalResult(result, input) {
|
|
1635
|
-
if (result.issues.length
|
|
1774
|
+
if (input === undefined && (result.issues.length || result.fallback)) {
|
|
1636
1775
|
return { issues: [], value: undefined };
|
|
1637
1776
|
}
|
|
1638
1777
|
return result;
|
|
@@ -1650,10 +1789,11 @@ exports.$ZodOptional = core.$constructor("$ZodOptional", (inst, def) => {
|
|
|
1650
1789
|
});
|
|
1651
1790
|
inst._zod.parse = (payload, ctx) => {
|
|
1652
1791
|
if (def.innerType._zod.optin === "optional") {
|
|
1792
|
+
const input = payload.value;
|
|
1653
1793
|
const result = def.innerType._zod.run(payload, ctx);
|
|
1654
1794
|
if (result instanceof Promise)
|
|
1655
|
-
return result.then((r) => handleOptionalResult(r,
|
|
1656
|
-
return handleOptionalResult(result,
|
|
1795
|
+
return result.then((r) => handleOptionalResult(r, input));
|
|
1796
|
+
return handleOptionalResult(result, input);
|
|
1657
1797
|
}
|
|
1658
1798
|
if (payload.value === undefined) {
|
|
1659
1799
|
return payload;
|
|
@@ -1780,7 +1920,7 @@ exports.$ZodSuccess = core.$constructor("$ZodSuccess", (inst, def) => {
|
|
|
1780
1920
|
});
|
|
1781
1921
|
exports.$ZodCatch = core.$constructor("$ZodCatch", (inst, def) => {
|
|
1782
1922
|
exports.$ZodType.init(inst, def);
|
|
1783
|
-
|
|
1923
|
+
inst._zod.optin = "optional";
|
|
1784
1924
|
util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
1785
1925
|
util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1786
1926
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -1801,6 +1941,7 @@ exports.$ZodCatch = core.$constructor("$ZodCatch", (inst, def) => {
|
|
|
1801
1941
|
input: payload.value,
|
|
1802
1942
|
});
|
|
1803
1943
|
payload.issues = [];
|
|
1944
|
+
payload.fallback = true;
|
|
1804
1945
|
}
|
|
1805
1946
|
return payload;
|
|
1806
1947
|
});
|
|
@@ -1815,6 +1956,7 @@ exports.$ZodCatch = core.$constructor("$ZodCatch", (inst, def) => {
|
|
|
1815
1956
|
input: payload.value,
|
|
1816
1957
|
});
|
|
1817
1958
|
payload.issues = [];
|
|
1959
|
+
payload.fallback = true;
|
|
1818
1960
|
}
|
|
1819
1961
|
return payload;
|
|
1820
1962
|
};
|
|
@@ -1861,7 +2003,7 @@ function handlePipeResult(left, next, ctx) {
|
|
|
1861
2003
|
left.aborted = true;
|
|
1862
2004
|
return left;
|
|
1863
2005
|
}
|
|
1864
|
-
return next._zod.run({ value: left.value, issues: left.issues }, ctx);
|
|
2006
|
+
return next._zod.run({ value: left.value, issues: left.issues, fallback: left.fallback }, ctx);
|
|
1865
2007
|
}
|
|
1866
2008
|
exports.$ZodCodec = core.$constructor("$ZodCodec", (inst, def) => {
|
|
1867
2009
|
exports.$ZodType.init(inst, def);
|
|
@@ -1917,6 +2059,9 @@ function handleCodecTxResult(left, value, nextSchema, ctx) {
|
|
|
1917
2059
|
}
|
|
1918
2060
|
return nextSchema._zod.run({ value, issues: left.issues }, ctx);
|
|
1919
2061
|
}
|
|
2062
|
+
exports.$ZodPreprocess = core.$constructor("$ZodPreprocess", (inst, def) => {
|
|
2063
|
+
exports.$ZodPipe.init(inst, def);
|
|
2064
|
+
});
|
|
1920
2065
|
exports.$ZodReadonly = core.$constructor("$ZodReadonly", (inst, def) => {
|
|
1921
2066
|
exports.$ZodType.init(inst, def);
|
|
1922
2067
|
util.defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
@@ -2074,14 +2219,15 @@ exports.$ZodPromise = core.$constructor("$ZodPromise", (inst, def) => {
|
|
|
2074
2219
|
});
|
|
2075
2220
|
exports.$ZodLazy = core.$constructor("$ZodLazy", (inst, def) => {
|
|
2076
2221
|
exports.$ZodType.init(inst, def);
|
|
2077
|
-
//
|
|
2078
|
-
//
|
|
2079
|
-
//
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2222
|
+
// Cache the resolved inner type on the shared `def` so all clones of this
|
|
2223
|
+
// lazy (e.g. via `.describe()`/`.meta()`) share the same inner instance,
|
|
2224
|
+
// preserving identity for cycle detection on recursive schemas.
|
|
2225
|
+
util.defineLazy(inst._zod, "innerType", () => {
|
|
2226
|
+
const d = def;
|
|
2227
|
+
if (!d._cachedInner)
|
|
2228
|
+
d._cachedInner = def.getter();
|
|
2229
|
+
return d._cachedInner;
|
|
2230
|
+
});
|
|
2085
2231
|
util.defineLazy(inst._zod, "pattern", () => inst._zod.innerType?._zod?.pattern);
|
|
2086
2232
|
util.defineLazy(inst._zod, "propValues", () => inst._zod.innerType?._zod?.propValues);
|
|
2087
2233
|
util.defineLazy(inst._zod, "optin", () => inst._zod.innerType?._zod?.optin ?? undefined);
|
|
@@ -23,8 +23,13 @@ export interface ParseContextInternal<T extends errors.$ZodIssueBase = never> ex
|
|
|
23
23
|
export interface ParsePayload<T = unknown> {
|
|
24
24
|
value: T;
|
|
25
25
|
issues: errors.$ZodRawIssue[];
|
|
26
|
-
/** A
|
|
26
|
+
/** A way to mark a whole payload as aborted. Used in codecs/pipes. */
|
|
27
27
|
aborted?: boolean;
|
|
28
|
+
/** @internal Marks a value as a fallback that an outer wrapper (e.g.
|
|
29
|
+
* $ZodOptional) may override with its own interpretation when input was
|
|
30
|
+
* undefined. Set by $ZodCatch when catchValue substitutes and by every
|
|
31
|
+
* $ZodTransform invocation. */
|
|
32
|
+
fallback?: boolean | undefined;
|
|
28
33
|
}
|
|
29
34
|
export type CheckFn<T> = (input: ParsePayload<T>) => util.MaybeAsync<void>;
|
|
30
35
|
export interface $ZodTypeDef {
|
|
@@ -182,13 +187,33 @@ export interface $ZodNanoID extends $ZodType {
|
|
|
182
187
|
_zod: $ZodNanoIDInternals;
|
|
183
188
|
}
|
|
184
189
|
export declare const $ZodNanoID: core.$constructor<$ZodNanoID>;
|
|
190
|
+
/**
|
|
191
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
192
|
+
* (timestamps embedded in the id). Use {@link $ZodCUID2} instead.
|
|
193
|
+
* See https://github.com/paralleldrive/cuid.
|
|
194
|
+
*/
|
|
185
195
|
export interface $ZodCUIDDef extends $ZodStringFormatDef<"cuid"> {
|
|
186
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
199
|
+
* (timestamps embedded in the id). Use {@link $ZodCUID2} instead.
|
|
200
|
+
* See https://github.com/paralleldrive/cuid.
|
|
201
|
+
*/
|
|
187
202
|
export interface $ZodCUIDInternals extends $ZodStringFormatInternals<"cuid"> {
|
|
188
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
206
|
+
* (timestamps embedded in the id). Use {@link $ZodCUID2} instead.
|
|
207
|
+
* See https://github.com/paralleldrive/cuid.
|
|
208
|
+
*/
|
|
189
209
|
export interface $ZodCUID extends $ZodType {
|
|
190
210
|
_zod: $ZodCUIDInternals;
|
|
191
211
|
}
|
|
212
|
+
/**
|
|
213
|
+
* @deprecated CUID v1 is deprecated by its authors due to information leakage
|
|
214
|
+
* (timestamps embedded in the id). Use {@link $ZodCUID2} instead.
|
|
215
|
+
* See https://github.com/paralleldrive/cuid.
|
|
216
|
+
*/
|
|
192
217
|
export declare const $ZodCUID: core.$constructor<$ZodCUID>;
|
|
193
218
|
export interface $ZodCUID2Def extends $ZodStringFormatDef<"cuid2"> {
|
|
194
219
|
}
|
|
@@ -1010,6 +1035,19 @@ export interface $ZodCodec<A extends SomeType = $ZodType, B extends SomeType = $
|
|
|
1010
1035
|
_zod: $ZodCodecInternals<A, B>;
|
|
1011
1036
|
}
|
|
1012
1037
|
export declare const $ZodCodec: core.$constructor<$ZodCodec>;
|
|
1038
|
+
export interface $ZodPreprocessDef<B extends SomeType = $ZodType> extends $ZodPipeDef<$ZodTransform, B> {
|
|
1039
|
+
in: $ZodTransform;
|
|
1040
|
+
out: B;
|
|
1041
|
+
}
|
|
1042
|
+
export interface $ZodPreprocessInternals<B extends SomeType = $ZodType> extends $ZodPipeInternals<$ZodTransform, B> {
|
|
1043
|
+
def: $ZodPreprocessDef<B>;
|
|
1044
|
+
optin: B["_zod"]["optin"];
|
|
1045
|
+
optout: B["_zod"]["optout"];
|
|
1046
|
+
}
|
|
1047
|
+
export interface $ZodPreprocess<B extends SomeType = $ZodType> extends $ZodPipe<$ZodTransform, B> {
|
|
1048
|
+
_zod: $ZodPreprocessInternals<B>;
|
|
1049
|
+
}
|
|
1050
|
+
export declare const $ZodPreprocess: core.$constructor<$ZodPreprocess>;
|
|
1013
1051
|
export interface $ZodReadonlyDef<T extends SomeType = $ZodType> extends $ZodTypeDef {
|
|
1014
1052
|
type: "readonly";
|
|
1015
1053
|
innerType: T;
|