zod 4.6.2 → 4.6.3
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/README.md +2 -2
- package/package.json +1 -1
- package/src/v4/classic/checks.ts +1 -0
- package/src/v4/classic/schemas.ts +3 -25
- package/src/v4/classic/tests/cyclic-data.test.ts +2 -11
- package/src/v4/classic/tests/firstparty.test.ts +0 -4
- package/src/v4/classic/tests/instanceof.test.ts +1 -1
- package/src/v4/classic/tests/properties.test.ts +34 -137
- package/src/v4/core/api.ts +4 -7
- package/src/v4/core/checks.ts +61 -1
- package/src/v4/core/compile.ts +8 -18
- package/src/v4/core/json-schema-processors.ts +0 -50
- package/src/v4/core/memoizer.ts +2 -5
- package/src/v4/core/schemas.ts +1 -98
- package/src/v4/core/to-json-schema.ts +1 -1
- package/src/v4/core/util.ts +0 -4
- package/src/v4/core/versions.ts +1 -1
- package/src/v4/core/visit.ts +0 -11
- package/src/v4/mini/checks.ts +1 -0
- package/src/v4/mini/schemas.ts +0 -19
- package/v4/classic/checks.cjs +2 -1
- package/v4/classic/checks.d.cts +1 -1
- package/v4/classic/checks.d.ts +1 -1
- package/v4/classic/checks.js +1 -1
- package/v4/classic/schemas.cjs +2 -11
- package/v4/classic/schemas.d.cts +1 -6
- package/v4/classic/schemas.d.ts +1 -6
- package/v4/classic/schemas.js +1 -9
- package/v4/core/api.cjs +2 -3
- package/v4/core/api.d.cts +2 -2
- package/v4/core/api.d.ts +2 -2
- package/v4/core/api.js +2 -3
- package/v4/core/checks.cjs +32 -1
- package/v4/core/checks.d.cts +16 -0
- package/v4/core/checks.d.ts +16 -0
- package/v4/core/checks.js +31 -0
- package/v4/core/compile.cjs +5 -11
- package/v4/core/compile.js +5 -11
- package/v4/core/json-schema-processors.cjs +1 -34
- package/v4/core/json-schema-processors.d.cts +0 -1
- package/v4/core/json-schema-processors.d.ts +0 -1
- package/v4/core/json-schema-processors.js +1 -33
- package/v4/core/memoizer.cjs +2 -5
- package/v4/core/memoizer.js +2 -5
- package/v4/core/schemas.cjs +1 -62
- package/v4/core/schemas.d.cts +2 -19
- package/v4/core/schemas.d.ts +2 -19
- package/v4/core/schemas.js +0 -61
- package/v4/core/to-json-schema.cjs +0 -1
- package/v4/core/to-json-schema.d.cts +0 -3
- package/v4/core/to-json-schema.d.ts +0 -3
- package/v4/core/to-json-schema.js +1 -1
- package/v4/core/util.cjs +0 -4
- package/v4/core/util.js +0 -4
- package/v4/core/versions.cjs +1 -1
- package/v4/core/versions.js +1 -1
- package/v4/core/visit.cjs +0 -12
- package/v4/core/visit.js +0 -12
- package/v4/mini/checks.cjs +2 -1
- package/v4/mini/checks.d.cts +1 -1
- package/v4/mini/checks.d.ts +1 -1
- package/v4/mini/checks.js +1 -1
- package/v4/mini/schemas.cjs +1 -9
- package/v4/mini/schemas.d.cts +0 -4
- package/v4/mini/schemas.d.ts +0 -4
- package/v4/mini/schemas.js +0 -7
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.allProcessors = exports.lazyProcessor = exports.optionalProcessor = exports.promiseProcessor = exports.readonlyProcessor = exports.pipeProcessor = exports.catchProcessor = exports.prefaultProcessor = exports.defaultProcessor = exports.nonoptionalProcessor = exports.nullableProcessor = exports.recordProcessor = exports.tupleProcessor = exports.intersectionProcessor = exports.unionProcessor = exports.
|
|
26
|
+
exports.allProcessors = exports.lazyProcessor = exports.optionalProcessor = exports.promiseProcessor = exports.readonlyProcessor = exports.pipeProcessor = exports.catchProcessor = exports.prefaultProcessor = exports.defaultProcessor = exports.nonoptionalProcessor = exports.nullableProcessor = exports.recordProcessor = exports.tupleProcessor = exports.intersectionProcessor = exports.unionProcessor = exports.objectProcessor = exports.arrayProcessor = exports.setProcessor = exports.mapProcessor = exports.transformProcessor = exports.functionProcessor = exports.customProcessor = exports.successProcessor = exports.fileProcessor = exports.templateLiteralProcessor = exports.nanProcessor = exports.literalProcessor = exports.enumProcessor = exports.dateProcessor = exports.unknownProcessor = exports.anyProcessor = exports.neverProcessor = exports.voidProcessor = exports.undefinedProcessor = exports.nullProcessor = exports.symbolProcessor = exports.bigintProcessor = exports.booleanProcessor = exports.numberProcessor = exports.stringProcessor = void 0;
|
|
27
27
|
exports.aggregateChecks = aggregateChecks;
|
|
28
28
|
exports.toJSONSchema = toJSONSchema;
|
|
29
29
|
const regexes = __importStar(require("./regexes.cjs"));
|
|
@@ -478,38 +478,6 @@ const objectProcessor = (schema, ctx, _json, params) => {
|
|
|
478
478
|
}
|
|
479
479
|
};
|
|
480
480
|
exports.objectProcessor = objectProcessor;
|
|
481
|
-
// asserts named properties in place and passes everything else through, so no additionalProperties constraint is emitted
|
|
482
|
-
const propertiesProcessor = (schema, ctx, _json, params) => {
|
|
483
|
-
const json = _json;
|
|
484
|
-
const def = schema._zod.def;
|
|
485
|
-
// dropping a symbol key silently would emit a schema that asserts less than this one does
|
|
486
|
-
if (Object.getOwnPropertySymbols(def.shape).length &&
|
|
487
|
-
(0, to_json_schema_js_1.handleUnrepresentable)(schema, ctx, json, params, "Symbol keys cannot be represented in JSON Schema")) {
|
|
488
|
-
return;
|
|
489
|
-
}
|
|
490
|
-
// the parsed value is the input, so an output-mode emission would describe a transformed value this schema never returns
|
|
491
|
-
if (ctx.io === "output") {
|
|
492
|
-
for (const key in def.shape) {
|
|
493
|
-
if ((0, to_json_schema_js_1.isTransforming)(def.shape[key]) &&
|
|
494
|
-
(0, to_json_schema_js_1.handleUnrepresentable)(schema, ctx, json, params, `z.properties() returns its input, so the output of a transforming schema at key "${key}" cannot be represented in JSON Schema`)) {
|
|
495
|
-
return;
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
json.type = "object";
|
|
500
|
-
json.properties = {};
|
|
501
|
-
for (const key in def.shape) {
|
|
502
|
-
(0, util_js_1.assignProp)(json.properties, key, (0, to_json_schema_js_1.processSchema)(def.shape[key], ctx, {
|
|
503
|
-
...params,
|
|
504
|
-
path: [...params.path, "properties", key],
|
|
505
|
-
}));
|
|
506
|
-
}
|
|
507
|
-
// input-side optionality in both modes: the parsed value is the input, so a defaulted key that stays absent must not be required of the output either
|
|
508
|
-
const required = Object.keys(def.shape).filter((key) => inputOptin(def.shape[key]) === undefined);
|
|
509
|
-
if (required.length > 0)
|
|
510
|
-
json.required = required;
|
|
511
|
-
};
|
|
512
|
-
exports.propertiesProcessor = propertiesProcessor;
|
|
513
481
|
const unionProcessor = (schema, ctx, json, params) => {
|
|
514
482
|
const def = schema._zod.def;
|
|
515
483
|
// Exclusive unions (inclusive === false) use oneOf (exactly one match) instead of anyOf (one or more matches). This includes both z.xor() and discriminated unions
|
|
@@ -883,7 +851,6 @@ exports.allProcessors = {
|
|
|
883
851
|
file: exports.fileProcessor,
|
|
884
852
|
success: exports.successProcessor,
|
|
885
853
|
custom: exports.customProcessor,
|
|
886
|
-
properties: exports.propertiesProcessor,
|
|
887
854
|
function: exports.functionProcessor,
|
|
888
855
|
transform: exports.transformProcessor,
|
|
889
856
|
map: exports.mapProcessor,
|
|
@@ -41,7 +41,6 @@ export declare const mapProcessor: Processor<schemas.$ZodMap>;
|
|
|
41
41
|
export declare const setProcessor: Processor<schemas.$ZodSet>;
|
|
42
42
|
export declare const arrayProcessor: Processor<schemas.$ZodArray>;
|
|
43
43
|
export declare const objectProcessor: Processor<schemas.$ZodObject>;
|
|
44
|
-
export declare const propertiesProcessor: Processor<schemas.$ZodProperties>;
|
|
45
44
|
export declare const unionProcessor: Processor<schemas.$ZodUnion>;
|
|
46
45
|
export declare const intersectionProcessor: Processor<schemas.$ZodIntersection>;
|
|
47
46
|
export declare const tupleProcessor: Processor<schemas.$ZodTuple>;
|
|
@@ -41,7 +41,6 @@ export declare const mapProcessor: Processor<schemas.$ZodMap>;
|
|
|
41
41
|
export declare const setProcessor: Processor<schemas.$ZodSet>;
|
|
42
42
|
export declare const arrayProcessor: Processor<schemas.$ZodArray>;
|
|
43
43
|
export declare const objectProcessor: Processor<schemas.$ZodObject>;
|
|
44
|
-
export declare const propertiesProcessor: Processor<schemas.$ZodProperties>;
|
|
45
44
|
export declare const unionProcessor: Processor<schemas.$ZodUnion>;
|
|
46
45
|
export declare const intersectionProcessor: Processor<schemas.$ZodIntersection>;
|
|
47
46
|
export declare const tupleProcessor: Processor<schemas.$ZodTuple>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as regexes from "./regexes.js";
|
|
2
2
|
import { base64Charset, base64urlCharset } from "./schemas.js";
|
|
3
|
-
import { extractDefs, finalize, handleUnrepresentable, initializeContext,
|
|
3
|
+
import { extractDefs, finalize, handleUnrepresentable, initializeContext, processSchema, } from "./to-json-schema.js";
|
|
4
4
|
import { BIGINT_FORMAT_RANGES, NUMBER_FORMAT_RANGES, assignProp, getEnumValues } from "./util.js";
|
|
5
5
|
const narrowMin = (agg, key, value) => {
|
|
6
6
|
if (agg[key] === undefined || value > agg[key])
|
|
@@ -425,37 +425,6 @@ export const objectProcessor = (schema, ctx, _json, params) => {
|
|
|
425
425
|
});
|
|
426
426
|
}
|
|
427
427
|
};
|
|
428
|
-
// asserts named properties in place and passes everything else through, so no additionalProperties constraint is emitted
|
|
429
|
-
export const propertiesProcessor = (schema, ctx, _json, params) => {
|
|
430
|
-
const json = _json;
|
|
431
|
-
const def = schema._zod.def;
|
|
432
|
-
// dropping a symbol key silently would emit a schema that asserts less than this one does
|
|
433
|
-
if (Object.getOwnPropertySymbols(def.shape).length &&
|
|
434
|
-
handleUnrepresentable(schema, ctx, json, params, "Symbol keys cannot be represented in JSON Schema")) {
|
|
435
|
-
return;
|
|
436
|
-
}
|
|
437
|
-
// the parsed value is the input, so an output-mode emission would describe a transformed value this schema never returns
|
|
438
|
-
if (ctx.io === "output") {
|
|
439
|
-
for (const key in def.shape) {
|
|
440
|
-
if (isTransforming(def.shape[key]) &&
|
|
441
|
-
handleUnrepresentable(schema, ctx, json, params, `z.properties() returns its input, so the output of a transforming schema at key "${key}" cannot be represented in JSON Schema`)) {
|
|
442
|
-
return;
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
json.type = "object";
|
|
447
|
-
json.properties = {};
|
|
448
|
-
for (const key in def.shape) {
|
|
449
|
-
assignProp(json.properties, key, processSchema(def.shape[key], ctx, {
|
|
450
|
-
...params,
|
|
451
|
-
path: [...params.path, "properties", key],
|
|
452
|
-
}));
|
|
453
|
-
}
|
|
454
|
-
// input-side optionality in both modes: the parsed value is the input, so a defaulted key that stays absent must not be required of the output either
|
|
455
|
-
const required = Object.keys(def.shape).filter((key) => inputOptin(def.shape[key]) === undefined);
|
|
456
|
-
if (required.length > 0)
|
|
457
|
-
json.required = required;
|
|
458
|
-
};
|
|
459
428
|
export const unionProcessor = (schema, ctx, json, params) => {
|
|
460
429
|
const def = schema._zod.def;
|
|
461
430
|
// Exclusive unions (inclusive === false) use oneOf (exactly one match) instead of anyOf (one or more matches). This includes both z.xor() and discriminated unions
|
|
@@ -815,7 +784,6 @@ export const allProcessors = {
|
|
|
815
784
|
file: fileProcessor,
|
|
816
785
|
success: successProcessor,
|
|
817
786
|
custom: customProcessor,
|
|
818
|
-
properties: propertiesProcessor,
|
|
819
787
|
function: functionProcessor,
|
|
820
788
|
transform: transformProcessor,
|
|
821
789
|
map: mapProcessor,
|
package/v4/core/memoizer.cjs
CHANGED
|
@@ -38,9 +38,9 @@ exports.$ZodCyclicError = $ZodCyclicError;
|
|
|
38
38
|
/** Keyed off the context object every schema in one parse call already shares. */
|
|
39
39
|
const STATE = "~memo";
|
|
40
40
|
const NO_ISSUES = [];
|
|
41
|
-
// a value a cycle can close through
|
|
41
|
+
// a value a cycle can close through
|
|
42
42
|
function isRef(value) {
|
|
43
|
-
return value !== null &&
|
|
43
|
+
return value !== null && typeof value === "object";
|
|
44
44
|
}
|
|
45
45
|
// Receivers prefix paths in place, so the cache and every hand-out need their own copies.
|
|
46
46
|
function cloneIssues(issues) {
|
|
@@ -97,9 +97,6 @@ function isRecursive(inst, stack, resolve) {
|
|
|
97
97
|
check(def.catchall);
|
|
98
98
|
break;
|
|
99
99
|
}
|
|
100
|
-
case "properties":
|
|
101
|
-
merge(shape(def.shape, false));
|
|
102
|
-
break;
|
|
103
100
|
case "array":
|
|
104
101
|
check(def.element);
|
|
105
102
|
break;
|
package/v4/core/memoizer.js
CHANGED
|
@@ -8,9 +8,9 @@ export class $ZodCyclicError extends Error {
|
|
|
8
8
|
/** Keyed off the context object every schema in one parse call already shares. */
|
|
9
9
|
const STATE = "~memo";
|
|
10
10
|
const NO_ISSUES = [];
|
|
11
|
-
// a value a cycle can close through
|
|
11
|
+
// a value a cycle can close through
|
|
12
12
|
function isRef(value) {
|
|
13
|
-
return value !== null &&
|
|
13
|
+
return value !== null && typeof value === "object";
|
|
14
14
|
}
|
|
15
15
|
// Receivers prefix paths in place, so the cache and every hand-out need their own copies.
|
|
16
16
|
function cloneIssues(issues) {
|
|
@@ -67,9 +67,6 @@ function isRecursive(inst, stack, resolve) {
|
|
|
67
67
|
check(def.catchall);
|
|
68
68
|
break;
|
|
69
69
|
}
|
|
70
|
-
case "properties":
|
|
71
|
-
merge(shape(def.shape, false));
|
|
72
|
-
break;
|
|
73
70
|
case "array":
|
|
74
71
|
check(def.element);
|
|
75
72
|
break;
|
package/v4/core/schemas.cjs
CHANGED
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
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.$ZodIBAN = exports.$ZodCreditCard = exports.$ZodE164 = exports.$ZodBase64URL = exports.base64urlCharset = exports.$ZodBase64 = exports.base64Charset = 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.URL_UNPARSEABLE = exports.URL_BAD_FORMAT = exports.$ZodEmail = exports.$ZodUUID = exports.$ZodGUID = exports.$ZodStringFormat = exports.$ZodString = exports.clone = exports.$ZodType = void 0;
|
|
27
|
-
exports.$
|
|
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 = exports.$ZodTuple = exports.$ZodIntersection = exports.$ZodDiscriminatedUnion = exports.$ZodXor = exports.$ZodUnion = exports.$ZodObjectJIT = void 0;
|
|
28
28
|
exports.standardProps = standardProps;
|
|
29
29
|
exports.parseURLObject = parseURLObject;
|
|
30
30
|
exports.stripTabAndNewline = stripTabAndNewline;
|
|
@@ -2627,67 +2627,6 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
2627
2627
|
payload.issues.push(util.issue(_iss));
|
|
2628
2628
|
}
|
|
2629
2629
|
}
|
|
2630
|
-
// asserts in place: the child result's value is discarded, matching z.property(), because a nested object or array schema rebuilds its output even when nothing transformed
|
|
2631
|
-
function handlePropertiesResult(result, payload, key) {
|
|
2632
|
-
if (result.issues.length) {
|
|
2633
|
-
payload.issues.push(...util.prefixIssues(key, result.issues));
|
|
2634
|
-
}
|
|
2635
|
-
}
|
|
2636
|
-
exports.$ZodProperties = core.$constructor("$ZodProperties", (inst, def) => {
|
|
2637
|
-
// $ZodType.init prepends an instance that already carries the $ZodCheck trait to its own `checks`, which would run the shape a second time and cost the parse context. Initializing the check trait after it keeps the schema role in `parse`, where the context arrives.
|
|
2638
|
-
exports.$ZodType.init(inst, def);
|
|
2639
|
-
checks.$ZodCheck.init(inst, def);
|
|
2640
|
-
const memo = core.globalConfig.memoizer;
|
|
2641
|
-
memo?.attach(inst);
|
|
2642
|
-
// key and schema snapshotted together: reading one live and the other cached lets a later mutation of the caller's shape object pair a stale key with a missing schema
|
|
2643
|
-
let entries;
|
|
2644
|
-
const runShape = (payload, ctx) => {
|
|
2645
|
-
entries ?? (entries = Reflect.ownKeys(def.shape).map((key) => [key, def.shape[key]]));
|
|
2646
|
-
const input = payload.value;
|
|
2647
|
-
let proms;
|
|
2648
|
-
for (const [key, schema] of entries) {
|
|
2649
|
-
const result = schema._zod.run({ value: input[key], issues: [] }, ctx);
|
|
2650
|
-
if (result instanceof Promise) {
|
|
2651
|
-
proms ?? (proms = []);
|
|
2652
|
-
proms.push(result.then((result) => handlePropertiesResult(result, payload, key)));
|
|
2653
|
-
}
|
|
2654
|
-
else {
|
|
2655
|
-
handlePropertiesResult(result, payload, key);
|
|
2656
|
-
}
|
|
2657
|
-
}
|
|
2658
|
-
if (proms)
|
|
2659
|
-
return Promise.all(proms).then(() => undefined);
|
|
2660
|
-
return undefined;
|
|
2661
|
-
};
|
|
2662
|
-
inst._zod.parse = (payload, ctx) => {
|
|
2663
|
-
const input = payload.value;
|
|
2664
|
-
// as a schema this is the type gate, and it infers an object shape, so a primitive is a type error. A function passes: its properties read like any other object's, and z.instanceof allows one.
|
|
2665
|
-
if (input === null || (typeof input !== "object" && typeof input !== "function")) {
|
|
2666
|
-
payload.issues.push({ expected: "object", code: "invalid_type", input, inst });
|
|
2667
|
-
return payload;
|
|
2668
|
-
}
|
|
2669
|
-
// both sides declare the shape's input type, so the assertion runs forward in either direction; encoding the children backward would reject the very type this schema claims to take
|
|
2670
|
-
if (ctx.direction === "backward")
|
|
2671
|
-
ctx = { ...ctx, direction: "forward" };
|
|
2672
|
-
// the input is its own output here, so it registers as its own memo entry: a cycle re-entering this node hits the bucket instead of recursing forever
|
|
2673
|
-
if (memo)
|
|
2674
|
-
memo.alloc(inst, payload, input, ctx);
|
|
2675
|
-
const result = runShape(payload, ctx);
|
|
2676
|
-
return result instanceof Promise ? result.then(() => payload) : payload;
|
|
2677
|
-
};
|
|
2678
|
-
// as a check the base schema already typed the value, so this only asserts the properties — which read on a primitive too, matching z.property() on a string's length. It gets no context of its own, so a cycle through a spread schema is not tracked.
|
|
2679
|
-
inst._zod.check = (payload) => {
|
|
2680
|
-
if (payload.value == null) {
|
|
2681
|
-
payload.issues.push({ expected: "object", code: "invalid_type", input: payload.value, inst });
|
|
2682
|
-
return undefined;
|
|
2683
|
-
}
|
|
2684
|
-
return runShape(payload, {});
|
|
2685
|
-
};
|
|
2686
|
-
}, {
|
|
2687
|
-
*[Symbol.iterator]() {
|
|
2688
|
-
yield this;
|
|
2689
|
-
},
|
|
2690
|
-
});
|
|
2691
2630
|
|
|
2692
2631
|
// seal-cjs-exports
|
|
2693
2632
|
(function () {
|
package/v4/core/schemas.d.cts
CHANGED
|
@@ -41,7 +41,7 @@ export interface ParsePayload<T = unknown> {
|
|
|
41
41
|
}
|
|
42
42
|
export type CheckFn<T> = (input: ParsePayload<T>) => util.MaybeAsync<void>;
|
|
43
43
|
export interface $ZodTypeDef {
|
|
44
|
-
type: "string" | "number" | "int" | "boolean" | "bigint" | "symbol" | "null" | "undefined" | "void" | "never" | "any" | "unknown" | "date" | "object" | "record" | "file" | "array" | "tuple" | "union" | "intersection" | "map" | "set" | "enum" | "literal" | "nullable" | "optional" | "nonoptional" | "success" | "transform" | "default" | "prefault" | "catch" | "nan" | "pipe" | "readonly" | "template_literal" | "promise" | "lazy" | "function" | "custom"
|
|
44
|
+
type: "string" | "number" | "int" | "boolean" | "bigint" | "symbol" | "null" | "undefined" | "void" | "never" | "any" | "unknown" | "date" | "object" | "record" | "file" | "array" | "tuple" | "union" | "intersection" | "map" | "set" | "enum" | "literal" | "nullable" | "optional" | "nonoptional" | "success" | "transform" | "default" | "prefault" | "catch" | "nan" | "pipe" | "readonly" | "template_literal" | "promise" | "lazy" | "function" | "custom";
|
|
45
45
|
error?: errors.$ZodErrorMap<never> | undefined;
|
|
46
46
|
checks?: checks.$ZodCheck<never>[];
|
|
47
47
|
}
|
|
@@ -1267,22 +1267,5 @@ export interface $ZodCustom<O = unknown, I = unknown> extends $ZodType {
|
|
|
1267
1267
|
_zod: $ZodCustomInternals<O, I>;
|
|
1268
1268
|
}
|
|
1269
1269
|
export declare const $ZodCustom: core.$constructor<$ZodCustom>;
|
|
1270
|
-
export
|
|
1271
|
-
type: "properties";
|
|
1272
|
-
check: "properties";
|
|
1273
|
-
shape: Shape;
|
|
1274
|
-
}
|
|
1275
|
-
export interface $ZodPropertiesInternals<Shape extends $ZodShape = $ZodShape> extends $ZodTypeInternals<$InferObjectInput<Shape, {}>, $InferObjectInput<Shape, {}>>, checks.$ZodCheckInternals<{
|
|
1276
|
-
-readonly [k in keyof Shape]: util.Widen<core.input<Shape[k]>>;
|
|
1277
|
-
}> {
|
|
1278
|
-
def: $ZodPropertiesDef<Shape>;
|
|
1279
|
-
isst: errors.$ZodIssueInvalidType;
|
|
1280
|
-
issc: errors.$ZodIssue;
|
|
1281
|
-
}
|
|
1282
|
-
export interface $ZodProperties<Shape extends $ZodShape = $ZodShape> extends $ZodType {
|
|
1283
|
-
_zod: $ZodPropertiesInternals<Shape>;
|
|
1284
|
-
[Symbol.iterator](): Iterator<this>;
|
|
1285
|
-
}
|
|
1286
|
-
export declare const $ZodProperties: core.$constructor<$ZodProperties>;
|
|
1287
|
-
export type $ZodTypes = $ZodString | $ZodNumber | $ZodBigInt | $ZodBoolean | $ZodDate | $ZodSymbol | $ZodUndefined | $ZodNullable | $ZodNull | $ZodAny | $ZodUnknown | $ZodNever | $ZodVoid | $ZodArray | $ZodObject | $ZodUnion | $ZodIntersection | $ZodTuple | $ZodRecord | $ZodMap | $ZodSet | $ZodLiteral | $ZodEnum | $ZodFunction | $ZodPromise | $ZodLazy | $ZodOptional | $ZodDefault | $ZodPrefault | $ZodTemplateLiteral | $ZodCustom | $ZodProperties | $ZodTransform | $ZodNonOptional | $ZodReadonly | $ZodNaN | $ZodPipe | $ZodSuccess | $ZodCatch | $ZodFile;
|
|
1270
|
+
export type $ZodTypes = $ZodString | $ZodNumber | $ZodBigInt | $ZodBoolean | $ZodDate | $ZodSymbol | $ZodUndefined | $ZodNullable | $ZodNull | $ZodAny | $ZodUnknown | $ZodNever | $ZodVoid | $ZodArray | $ZodObject | $ZodUnion | $ZodIntersection | $ZodTuple | $ZodRecord | $ZodMap | $ZodSet | $ZodLiteral | $ZodEnum | $ZodFunction | $ZodPromise | $ZodLazy | $ZodOptional | $ZodDefault | $ZodPrefault | $ZodTemplateLiteral | $ZodCustom | $ZodTransform | $ZodNonOptional | $ZodReadonly | $ZodNaN | $ZodPipe | $ZodSuccess | $ZodCatch | $ZodFile;
|
|
1288
1271
|
export type $ZodStringFormatTypes = $ZodGUID | $ZodUUID | $ZodEmail | $ZodURL | $ZodEmoji | $ZodNanoID | $ZodCUID | $ZodCUID2 | $ZodULID | $ZodXID | $ZodKSUID | $ZodISODateTime | $ZodISODate | $ZodISOTime | $ZodISODuration | $ZodIPv4 | $ZodIPv6 | $ZodMAC | $ZodCIDRv4 | $ZodCIDRv6 | $ZodBase64 | $ZodBase64URL | $ZodE164 | $ZodCreditCard | $ZodIBAN | $ZodJWT | $ZodCustomStringFormat<"hex"> | $ZodCustomStringFormat<util.HashFormat> | $ZodCustomStringFormat<"hostname">;
|
package/v4/core/schemas.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export interface ParsePayload<T = unknown> {
|
|
|
41
41
|
}
|
|
42
42
|
export type CheckFn<T> = (input: ParsePayload<T>) => util.MaybeAsync<void>;
|
|
43
43
|
export interface $ZodTypeDef {
|
|
44
|
-
type: "string" | "number" | "int" | "boolean" | "bigint" | "symbol" | "null" | "undefined" | "void" | "never" | "any" | "unknown" | "date" | "object" | "record" | "file" | "array" | "tuple" | "union" | "intersection" | "map" | "set" | "enum" | "literal" | "nullable" | "optional" | "nonoptional" | "success" | "transform" | "default" | "prefault" | "catch" | "nan" | "pipe" | "readonly" | "template_literal" | "promise" | "lazy" | "function" | "custom"
|
|
44
|
+
type: "string" | "number" | "int" | "boolean" | "bigint" | "symbol" | "null" | "undefined" | "void" | "never" | "any" | "unknown" | "date" | "object" | "record" | "file" | "array" | "tuple" | "union" | "intersection" | "map" | "set" | "enum" | "literal" | "nullable" | "optional" | "nonoptional" | "success" | "transform" | "default" | "prefault" | "catch" | "nan" | "pipe" | "readonly" | "template_literal" | "promise" | "lazy" | "function" | "custom";
|
|
45
45
|
error?: errors.$ZodErrorMap<never> | undefined;
|
|
46
46
|
checks?: checks.$ZodCheck<never>[];
|
|
47
47
|
}
|
|
@@ -1267,22 +1267,5 @@ export interface $ZodCustom<O = unknown, I = unknown> extends $ZodType {
|
|
|
1267
1267
|
_zod: $ZodCustomInternals<O, I>;
|
|
1268
1268
|
}
|
|
1269
1269
|
export declare const $ZodCustom: core.$constructor<$ZodCustom>;
|
|
1270
|
-
export
|
|
1271
|
-
type: "properties";
|
|
1272
|
-
check: "properties";
|
|
1273
|
-
shape: Shape;
|
|
1274
|
-
}
|
|
1275
|
-
export interface $ZodPropertiesInternals<Shape extends $ZodShape = $ZodShape> extends $ZodTypeInternals<$InferObjectInput<Shape, {}>, $InferObjectInput<Shape, {}>>, checks.$ZodCheckInternals<{
|
|
1276
|
-
-readonly [k in keyof Shape]: util.Widen<core.input<Shape[k]>>;
|
|
1277
|
-
}> {
|
|
1278
|
-
def: $ZodPropertiesDef<Shape>;
|
|
1279
|
-
isst: errors.$ZodIssueInvalidType;
|
|
1280
|
-
issc: errors.$ZodIssue;
|
|
1281
|
-
}
|
|
1282
|
-
export interface $ZodProperties<Shape extends $ZodShape = $ZodShape> extends $ZodType {
|
|
1283
|
-
_zod: $ZodPropertiesInternals<Shape>;
|
|
1284
|
-
[Symbol.iterator](): Iterator<this>;
|
|
1285
|
-
}
|
|
1286
|
-
export declare const $ZodProperties: core.$constructor<$ZodProperties>;
|
|
1287
|
-
export type $ZodTypes = $ZodString | $ZodNumber | $ZodBigInt | $ZodBoolean | $ZodDate | $ZodSymbol | $ZodUndefined | $ZodNullable | $ZodNull | $ZodAny | $ZodUnknown | $ZodNever | $ZodVoid | $ZodArray | $ZodObject | $ZodUnion | $ZodIntersection | $ZodTuple | $ZodRecord | $ZodMap | $ZodSet | $ZodLiteral | $ZodEnum | $ZodFunction | $ZodPromise | $ZodLazy | $ZodOptional | $ZodDefault | $ZodPrefault | $ZodTemplateLiteral | $ZodCustom | $ZodProperties | $ZodTransform | $ZodNonOptional | $ZodReadonly | $ZodNaN | $ZodPipe | $ZodSuccess | $ZodCatch | $ZodFile;
|
|
1270
|
+
export type $ZodTypes = $ZodString | $ZodNumber | $ZodBigInt | $ZodBoolean | $ZodDate | $ZodSymbol | $ZodUndefined | $ZodNullable | $ZodNull | $ZodAny | $ZodUnknown | $ZodNever | $ZodVoid | $ZodArray | $ZodObject | $ZodUnion | $ZodIntersection | $ZodTuple | $ZodRecord | $ZodMap | $ZodSet | $ZodLiteral | $ZodEnum | $ZodFunction | $ZodPromise | $ZodLazy | $ZodOptional | $ZodDefault | $ZodPrefault | $ZodTemplateLiteral | $ZodCustom | $ZodTransform | $ZodNonOptional | $ZodReadonly | $ZodNaN | $ZodPipe | $ZodSuccess | $ZodCatch | $ZodFile;
|
|
1288
1271
|
export type $ZodStringFormatTypes = $ZodGUID | $ZodUUID | $ZodEmail | $ZodURL | $ZodEmoji | $ZodNanoID | $ZodCUID | $ZodCUID2 | $ZodULID | $ZodXID | $ZodKSUID | $ZodISODateTime | $ZodISODate | $ZodISOTime | $ZodISODuration | $ZodIPv4 | $ZodIPv6 | $ZodMAC | $ZodCIDRv4 | $ZodCIDRv6 | $ZodBase64 | $ZodBase64URL | $ZodE164 | $ZodCreditCard | $ZodIBAN | $ZodJWT | $ZodCustomStringFormat<"hex"> | $ZodCustomStringFormat<util.HashFormat> | $ZodCustomStringFormat<"hostname">;
|
package/v4/core/schemas.js
CHANGED
|
@@ -2585,64 +2585,3 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
2585
2585
|
payload.issues.push(util.issue(_iss));
|
|
2586
2586
|
}
|
|
2587
2587
|
}
|
|
2588
|
-
// asserts in place: the child result's value is discarded, matching z.property(), because a nested object or array schema rebuilds its output even when nothing transformed
|
|
2589
|
-
function handlePropertiesResult(result, payload, key) {
|
|
2590
|
-
if (result.issues.length) {
|
|
2591
|
-
payload.issues.push(...util.prefixIssues(key, result.issues));
|
|
2592
|
-
}
|
|
2593
|
-
}
|
|
2594
|
-
export const $ZodProperties = /*@__PURE__*/ core.$constructor("$ZodProperties", (inst, def) => {
|
|
2595
|
-
// $ZodType.init prepends an instance that already carries the $ZodCheck trait to its own `checks`, which would run the shape a second time and cost the parse context. Initializing the check trait after it keeps the schema role in `parse`, where the context arrives.
|
|
2596
|
-
$ZodType.init(inst, def);
|
|
2597
|
-
checks.$ZodCheck.init(inst, def);
|
|
2598
|
-
const memo = core.globalConfig.memoizer;
|
|
2599
|
-
memo?.attach(inst);
|
|
2600
|
-
// key and schema snapshotted together: reading one live and the other cached lets a later mutation of the caller's shape object pair a stale key with a missing schema
|
|
2601
|
-
let entries;
|
|
2602
|
-
const runShape = (payload, ctx) => {
|
|
2603
|
-
entries ?? (entries = Reflect.ownKeys(def.shape).map((key) => [key, def.shape[key]]));
|
|
2604
|
-
const input = payload.value;
|
|
2605
|
-
let proms;
|
|
2606
|
-
for (const [key, schema] of entries) {
|
|
2607
|
-
const result = schema._zod.run({ value: input[key], issues: [] }, ctx);
|
|
2608
|
-
if (result instanceof Promise) {
|
|
2609
|
-
proms ?? (proms = []);
|
|
2610
|
-
proms.push(result.then((result) => handlePropertiesResult(result, payload, key)));
|
|
2611
|
-
}
|
|
2612
|
-
else {
|
|
2613
|
-
handlePropertiesResult(result, payload, key);
|
|
2614
|
-
}
|
|
2615
|
-
}
|
|
2616
|
-
if (proms)
|
|
2617
|
-
return Promise.all(proms).then(() => undefined);
|
|
2618
|
-
return undefined;
|
|
2619
|
-
};
|
|
2620
|
-
inst._zod.parse = (payload, ctx) => {
|
|
2621
|
-
const input = payload.value;
|
|
2622
|
-
// as a schema this is the type gate, and it infers an object shape, so a primitive is a type error. A function passes: its properties read like any other object's, and z.instanceof allows one.
|
|
2623
|
-
if (input === null || (typeof input !== "object" && typeof input !== "function")) {
|
|
2624
|
-
payload.issues.push({ expected: "object", code: "invalid_type", input, inst });
|
|
2625
|
-
return payload;
|
|
2626
|
-
}
|
|
2627
|
-
// both sides declare the shape's input type, so the assertion runs forward in either direction; encoding the children backward would reject the very type this schema claims to take
|
|
2628
|
-
if (ctx.direction === "backward")
|
|
2629
|
-
ctx = { ...ctx, direction: "forward" };
|
|
2630
|
-
// the input is its own output here, so it registers as its own memo entry: a cycle re-entering this node hits the bucket instead of recursing forever
|
|
2631
|
-
if (memo)
|
|
2632
|
-
memo.alloc(inst, payload, input, ctx);
|
|
2633
|
-
const result = runShape(payload, ctx);
|
|
2634
|
-
return result instanceof Promise ? result.then(() => payload) : payload;
|
|
2635
|
-
};
|
|
2636
|
-
// as a check the base schema already typed the value, so this only asserts the properties — which read on a primitive too, matching z.property() on a string's length. It gets no context of its own, so a cycle through a spread schema is not tracked.
|
|
2637
|
-
inst._zod.check = (payload) => {
|
|
2638
|
-
if (payload.value == null) {
|
|
2639
|
-
payload.issues.push({ expected: "object", code: "invalid_type", input: payload.value, inst });
|
|
2640
|
-
return undefined;
|
|
2641
|
-
}
|
|
2642
|
-
return runShape(payload, {});
|
|
2643
|
-
};
|
|
2644
|
-
}, {
|
|
2645
|
-
*[Symbol.iterator]() {
|
|
2646
|
-
yield this;
|
|
2647
|
-
},
|
|
2648
|
-
});
|
|
@@ -9,7 +9,6 @@ exports.processSchema = processSchema;
|
|
|
9
9
|
exports.process = processSchema;
|
|
10
10
|
exports.extractDefs = extractDefs;
|
|
11
11
|
exports.finalize = finalize;
|
|
12
|
-
exports.isTransforming = isTransforming;
|
|
13
12
|
const registries_js_1 = require("./registries.cjs");
|
|
14
13
|
const util_js_1 = require("./util.cjs");
|
|
15
14
|
function assignProps(target, ...sources) {
|
|
@@ -137,9 +137,6 @@ export declare function processSchema<T extends schemas.$ZodType>(schema: T, ctx
|
|
|
137
137
|
export { processSchema as process };
|
|
138
138
|
export declare function extractDefs<T extends schemas.$ZodType>(ctx: ToJSONSchemaContext, schema: T): void;
|
|
139
139
|
export declare function finalize<T extends schemas.$ZodType>(ctx: ToJSONSchemaContext, schema: T): ZodStandardJSONSchemaPayload<T>;
|
|
140
|
-
export declare function isTransforming(_schema: schemas.$ZodType, _ctx?: {
|
|
141
|
-
seen: Set<schemas.$ZodType>;
|
|
142
|
-
}): boolean;
|
|
143
140
|
export type ZodStandardSchemaWithJSON<T> = StandardSchemaWithJSONProps<core.input<T>, core.output<T>>;
|
|
144
141
|
export interface ZodStandardJSONSchemaPayload<T> extends JSONSchema.BaseSchema {
|
|
145
142
|
"~standard": ZodStandardSchemaWithJSON<T>;
|
|
@@ -137,9 +137,6 @@ export declare function processSchema<T extends schemas.$ZodType>(schema: T, ctx
|
|
|
137
137
|
export { processSchema as process };
|
|
138
138
|
export declare function extractDefs<T extends schemas.$ZodType>(ctx: ToJSONSchemaContext, schema: T): void;
|
|
139
139
|
export declare function finalize<T extends schemas.$ZodType>(ctx: ToJSONSchemaContext, schema: T): ZodStandardJSONSchemaPayload<T>;
|
|
140
|
-
export declare function isTransforming(_schema: schemas.$ZodType, _ctx?: {
|
|
141
|
-
seen: Set<schemas.$ZodType>;
|
|
142
|
-
}): boolean;
|
|
143
140
|
export type ZodStandardSchemaWithJSON<T> = StandardSchemaWithJSONProps<core.input<T>, core.output<T>>;
|
|
144
141
|
export interface ZodStandardJSONSchemaPayload<T> extends JSONSchema.BaseSchema {
|
|
145
142
|
"~standard": ZodStandardSchemaWithJSON<T>;
|
|
@@ -572,7 +572,7 @@ export function finalize(ctx, schema) {
|
|
|
572
572
|
throw new Error("Error converting schema to JSON.");
|
|
573
573
|
}
|
|
574
574
|
}
|
|
575
|
-
|
|
575
|
+
function isTransforming(_schema, _ctx) {
|
|
576
576
|
const ctx = _ctx ?? { seen: new Set() };
|
|
577
577
|
if (ctx.seen.has(_schema))
|
|
578
578
|
return false;
|
package/v4/core/util.cjs
CHANGED
|
@@ -796,10 +796,6 @@ function members(proto, table) {
|
|
|
796
796
|
else
|
|
797
797
|
defineBound(proto, key, desc.value);
|
|
798
798
|
}
|
|
799
|
-
// for..in sees no symbol keys, so well-known members like Symbol.iterator install here
|
|
800
|
-
for (const sym of Object.getOwnPropertySymbols(table)) {
|
|
801
|
-
defineBound(proto, sym, table[sym]);
|
|
802
|
-
}
|
|
803
799
|
}
|
|
804
800
|
/** Shadows a prototype member with an own value, so a getter that builds from the instance runs once. */
|
|
805
801
|
function own(inst, key, value, enumerable = true) {
|
package/v4/core/util.js
CHANGED
|
@@ -725,10 +725,6 @@ export function members(proto, table) {
|
|
|
725
725
|
else
|
|
726
726
|
defineBound(proto, key, desc.value);
|
|
727
727
|
}
|
|
728
|
-
// for..in sees no symbol keys, so well-known members like Symbol.iterator install here
|
|
729
|
-
for (const sym of Object.getOwnPropertySymbols(table)) {
|
|
730
|
-
defineBound(proto, sym, table[sym]);
|
|
731
|
-
}
|
|
732
728
|
}
|
|
733
729
|
/** Shadows a prototype member with an own value, so a getter that builds from the instance runs once. */
|
|
734
730
|
export function own(inst, key, value, enumerable = true) {
|
package/v4/core/versions.cjs
CHANGED
package/v4/core/versions.js
CHANGED
package/v4/core/visit.cjs
CHANGED
|
@@ -161,18 +161,6 @@ function visit(schema, fnOrHandlers) {
|
|
|
161
161
|
const { _cachedInner, ...rest } = def;
|
|
162
162
|
return (0, util_js_1.clone)(s, { ...rest, getter: () => run(original()) });
|
|
163
163
|
}
|
|
164
|
-
case "properties": {
|
|
165
|
-
const oldShape = def.shape;
|
|
166
|
-
let changed = false;
|
|
167
|
-
const newShape = {};
|
|
168
|
-
for (const k of Reflect.ownKeys(oldShape)) {
|
|
169
|
-
const mapped = run(oldShape[k]);
|
|
170
|
-
if (mapped !== oldShape[k])
|
|
171
|
-
changed = true;
|
|
172
|
-
newShape[k] = mapped;
|
|
173
|
-
}
|
|
174
|
-
return changed ? (0, util_js_1.clone)(s, { ...def, shape: newShape }) : s;
|
|
175
|
-
}
|
|
176
164
|
// A leaf by choice: `parts` are regex fragments, not data positions.
|
|
177
165
|
case "template_literal":
|
|
178
166
|
// Leaves.
|
package/v4/core/visit.js
CHANGED
|
@@ -135,18 +135,6 @@ export function visit(schema, fnOrHandlers) {
|
|
|
135
135
|
const { _cachedInner, ...rest } = def;
|
|
136
136
|
return clone(s, { ...rest, getter: () => run(original()) });
|
|
137
137
|
}
|
|
138
|
-
case "properties": {
|
|
139
|
-
const oldShape = def.shape;
|
|
140
|
-
let changed = false;
|
|
141
|
-
const newShape = {};
|
|
142
|
-
for (const k of Reflect.ownKeys(oldShape)) {
|
|
143
|
-
const mapped = run(oldShape[k]);
|
|
144
|
-
if (mapped !== oldShape[k])
|
|
145
|
-
changed = true;
|
|
146
|
-
newShape[k] = mapped;
|
|
147
|
-
}
|
|
148
|
-
return changed ? clone(s, { ...def, shape: newShape }) : s;
|
|
149
|
-
}
|
|
150
138
|
// A leaf by choice: `parts` are regex fragments, not data positions.
|
|
151
139
|
case "template_literal":
|
|
152
140
|
// Leaves.
|
package/v4/mini/checks.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toUpperCase = exports.toLowerCase = exports.trim = exports.normalize = exports.overwrite = exports.mime = exports.property = exports.endsWith = exports.startsWith = exports.includes = exports.uppercase = exports.lowercase = exports.regex = exports.length = exports.minLength = exports.maxLength = exports.size = exports.minSize = exports.maxSize = exports.multipleOf = exports.nonnegative = exports.nonpositive = exports.negative = exports.positive = exports.minimum = exports.gte = exports.gt = exports.maximum = exports.lte = exports.lt = void 0;
|
|
3
|
+
exports.toUpperCase = exports.toLowerCase = exports.trim = exports.normalize = exports.overwrite = exports.mime = exports.properties = exports.property = exports.endsWith = exports.startsWith = exports.includes = exports.uppercase = exports.lowercase = exports.regex = exports.length = exports.minLength = exports.maxLength = exports.size = exports.minSize = exports.maxSize = exports.multipleOf = exports.nonnegative = exports.nonpositive = exports.negative = exports.positive = exports.minimum = exports.gte = exports.gt = exports.maximum = exports.lte = exports.lt = void 0;
|
|
4
4
|
var index_js_1 = require("../core/index.cjs");
|
|
5
5
|
Object.defineProperty(exports, "lt", { enumerable: true, get: function () { return index_js_1._lt; } });
|
|
6
6
|
Object.defineProperty(exports, "lte", { enumerable: true, get: function () { return index_js_1._lte; } });
|
|
@@ -26,6 +26,7 @@ Object.defineProperty(exports, "includes", { enumerable: true, get: function ()
|
|
|
26
26
|
Object.defineProperty(exports, "startsWith", { enumerable: true, get: function () { return index_js_1._startsWith; } });
|
|
27
27
|
Object.defineProperty(exports, "endsWith", { enumerable: true, get: function () { return index_js_1._endsWith; } });
|
|
28
28
|
Object.defineProperty(exports, "property", { enumerable: true, get: function () { return index_js_1._property; } });
|
|
29
|
+
Object.defineProperty(exports, "properties", { enumerable: true, get: function () { return index_js_1._properties; } });
|
|
29
30
|
Object.defineProperty(exports, "mime", { enumerable: true, get: function () { return index_js_1._mime; } });
|
|
30
31
|
Object.defineProperty(exports, "overwrite", { enumerable: true, get: function () { return index_js_1._overwrite; } });
|
|
31
32
|
Object.defineProperty(exports, "normalize", { enumerable: true, get: function () { return index_js_1._normalize; } });
|
package/v4/mini/checks.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { _lt as lt, _lte as lte, _lte as maximum, _gt as gt, _gte as gte, _gte as minimum, _positive as positive, _negative as negative, _nonpositive as nonpositive, _nonnegative as nonnegative, _multipleOf as multipleOf, _maxSize as maxSize, _minSize as minSize, _size as size, _maxLength as maxLength, _minLength as minLength, _length as length, _regex as regex, _lowercase as lowercase, _uppercase as uppercase, _includes as includes, _startsWith as startsWith, _endsWith as endsWith, _property as property, _mime as mime, _overwrite as overwrite, _normalize as normalize, _trim as trim, _toLowerCase as toLowerCase, _toUpperCase as toUpperCase, } from "../core/index.cjs";
|
|
1
|
+
export { _lt as lt, _lte as lte, _lte as maximum, _gt as gt, _gte as gte, _gte as minimum, _positive as positive, _negative as negative, _nonpositive as nonpositive, _nonnegative as nonnegative, _multipleOf as multipleOf, _maxSize as maxSize, _minSize as minSize, _size as size, _maxLength as maxLength, _minLength as minLength, _length as length, _regex as regex, _lowercase as lowercase, _uppercase as uppercase, _includes as includes, _startsWith as startsWith, _endsWith as endsWith, _property as property, _properties as properties, _mime as mime, _overwrite as overwrite, _normalize as normalize, _trim as trim, _toLowerCase as toLowerCase, _toUpperCase as toUpperCase, } from "../core/index.cjs";
|
package/v4/mini/checks.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { _lt as lt, _lte as lte, _lte as maximum, _gt as gt, _gte as gte, _gte as minimum, _positive as positive, _negative as negative, _nonpositive as nonpositive, _nonnegative as nonnegative, _multipleOf as multipleOf, _maxSize as maxSize, _minSize as minSize, _size as size, _maxLength as maxLength, _minLength as minLength, _length as length, _regex as regex, _lowercase as lowercase, _uppercase as uppercase, _includes as includes, _startsWith as startsWith, _endsWith as endsWith, _property as property, _mime as mime, _overwrite as overwrite, _normalize as normalize, _trim as trim, _toLowerCase as toLowerCase, _toUpperCase as toUpperCase, } from "../core/index.js";
|
|
1
|
+
export { _lt as lt, _lte as lte, _lte as maximum, _gt as gt, _gte as gte, _gte as minimum, _positive as positive, _negative as negative, _nonpositive as nonpositive, _nonnegative as nonnegative, _multipleOf as multipleOf, _maxSize as maxSize, _minSize as minSize, _size as size, _maxLength as maxLength, _minLength as minLength, _length as length, _regex as regex, _lowercase as lowercase, _uppercase as uppercase, _includes as includes, _startsWith as startsWith, _endsWith as endsWith, _property as property, _properties as properties, _mime as mime, _overwrite as overwrite, _normalize as normalize, _trim as trim, _toLowerCase as toLowerCase, _toUpperCase as toUpperCase, } from "../core/index.js";
|
package/v4/mini/checks.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { _lt as lt, _lte as lte, _lte as maximum, _gt as gt, _gte as gte, _gte as minimum, _positive as positive, _negative as negative, _nonpositive as nonpositive, _nonnegative as nonnegative, _multipleOf as multipleOf, _maxSize as maxSize, _minSize as minSize, _size as size, _maxLength as maxLength, _minLength as minLength, _length as length, _regex as regex, _lowercase as lowercase, _uppercase as uppercase, _includes as includes, _startsWith as startsWith, _endsWith as endsWith, _property as property, _mime as mime, _overwrite as overwrite, _normalize as normalize, _trim as trim, _toLowerCase as toLowerCase, _toUpperCase as toUpperCase, } from "../core/index.js";
|
|
1
|
+
export { _lt as lt, _lte as lte, _lte as maximum, _gt as gt, _gte as gte, _gte as minimum, _positive as positive, _negative as negative, _nonpositive as nonpositive, _nonnegative as nonnegative, _multipleOf as multipleOf, _maxSize as maxSize, _minSize as minSize, _size as size, _maxLength as maxLength, _minLength as minLength, _length as length, _regex as regex, _lowercase as lowercase, _uppercase as uppercase, _includes as includes, _startsWith as startsWith, _endsWith as endsWith, _property as property, _properties as properties, _mime as mime, _overwrite as overwrite, _normalize as normalize, _trim as trim, _toLowerCase as toLowerCase, _toUpperCase as toUpperCase, } from "../core/index.js";
|
package/v4/mini/schemas.cjs
CHANGED
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.ZodMiniEnum = exports.ZodMiniSet = exports.ZodMiniMap = exports.ZodMiniRecord = exports.ZodMiniTuple = exports.ZodMiniIntersection = exports.ZodMiniDiscriminatedUnion = exports.ZodMiniXor = exports.ZodMiniUnion = exports.ZodMiniObject = exports.ZodMiniArray = exports.ZodMiniDate = exports.ZodMiniVoid = exports.ZodMiniNever = exports.ZodMiniUnknown = exports.ZodMiniAny = exports.ZodMiniNull = exports.ZodMiniUndefined = exports.ZodMiniSymbol = exports.ZodMiniBigIntFormat = exports.ZodMiniBigInt = exports.ZodMiniBoolean = exports.ZodMiniNumberFormat = exports.ZodMiniNumber = exports.ZodMiniCustomStringFormat = exports.ZodMiniJWT = exports.ZodMiniIBAN = exports.ZodMiniCreditCard = exports.ZodMiniE164 = exports.ZodMiniBase64URL = exports.ZodMiniBase64 = exports.ZodMiniMAC = exports.ZodMiniCIDRv6 = exports.ZodMiniCIDRv4 = exports.ZodMiniIPv6 = exports.ZodMiniIPv4 = exports.ZodMiniKSUID = exports.ZodMiniXID = exports.ZodMiniULID = exports.ZodMiniCUID2 = exports.ZodMiniCUID = exports.ZodMiniNanoID = exports.ZodMiniEmoji = exports.ZodMiniURL = exports.ZodMiniUUID = exports.ZodMiniGUID = exports.ZodMiniEmail = exports.ZodMiniStringFormat = exports.ZodMiniString = exports.ZodMiniType = void 0;
|
|
27
|
-
exports.ZodMiniFunction = exports.stringbool = exports.meta = exports.describe = exports.
|
|
27
|
+
exports.ZodMiniFunction = exports.stringbool = exports.meta = exports.describe = exports.ZodMiniCustom = exports.ZodMiniPromise = exports.ZodMiniLazy = exports.ZodMiniTemplateLiteral = exports.ZodMiniReadonly = exports.ZodMiniCodec = exports.ZodMiniPipe = exports.ZodMiniNaN = exports.ZodMiniCatch = exports.ZodMiniSuccess = exports.ZodMiniNonOptional = exports.ZodMiniPrefault = exports.ZodMiniDefault = exports.ZodMiniNullable = exports.ZodMiniExactOptional = exports.ZodMiniOptional = exports.ZodMiniTransform = exports.ZodMiniFile = exports.ZodMiniLiteral = void 0;
|
|
28
28
|
exports.string = string;
|
|
29
29
|
exports.email = email;
|
|
30
30
|
exports.guid = guid;
|
|
@@ -120,7 +120,6 @@ exports.readonly = readonly;
|
|
|
120
120
|
exports.templateLiteral = templateLiteral;
|
|
121
121
|
exports.lazy = _lazy;
|
|
122
122
|
exports.promise = promise;
|
|
123
|
-
exports.properties = properties;
|
|
124
123
|
exports.check = check;
|
|
125
124
|
exports.custom = custom;
|
|
126
125
|
exports.refine = refine;
|
|
@@ -1045,13 +1044,6 @@ exports.ZodMiniCustom = core.$constructor("ZodMiniCustom", (inst, def) => {
|
|
|
1045
1044
|
core.$ZodCustom.init(inst, def);
|
|
1046
1045
|
exports.ZodMiniType.init(inst, def);
|
|
1047
1046
|
});
|
|
1048
|
-
exports.ZodMiniProperties = core.$constructor("ZodMiniProperties", (inst, def) => {
|
|
1049
|
-
core.$ZodProperties.init(inst, def);
|
|
1050
|
-
exports.ZodMiniType.init(inst, def);
|
|
1051
|
-
});
|
|
1052
|
-
function properties(shape, params) {
|
|
1053
|
-
return core._properties(exports.ZodMiniProperties, shape, params);
|
|
1054
|
-
}
|
|
1055
1047
|
// custom checks
|
|
1056
1048
|
// @__NO_SIDE_EFFECTS__
|
|
1057
1049
|
function check(fn, params) {
|
package/v4/mini/schemas.d.cts
CHANGED
|
@@ -419,10 +419,6 @@ export declare function promise<T extends SomeType>(innerType: T): ZodMiniPromis
|
|
|
419
419
|
export interface ZodMiniCustom<O = unknown, I = unknown> extends _ZodMiniType<core.$ZodCustomInternals<O, I>> {
|
|
420
420
|
}
|
|
421
421
|
export declare const ZodMiniCustom: core.$constructor<ZodMiniCustom>;
|
|
422
|
-
export interface ZodMiniProperties<Shape extends core.$ZodShape = core.$ZodShape> extends _ZodMiniType<core.$ZodPropertiesInternals<Shape>>, core.$ZodProperties<Shape> {
|
|
423
|
-
}
|
|
424
|
-
export declare const ZodMiniProperties: core.$constructor<ZodMiniProperties>;
|
|
425
|
-
export declare function properties<Shape extends core.$ZodShape>(shape: Shape, params?: string | core.$ZodPropertiesParams): ZodMiniProperties<Shape>;
|
|
426
422
|
export declare function check<O = unknown>(fn: core.CheckFn<O>, params?: string | core.$ZodCustomParams): core.$ZodCheck<O>;
|
|
427
423
|
export declare function custom<O = unknown, I = O>(fn?: (data: O) => unknown, _params?: string | core.$ZodCustomParams | undefined): ZodMiniCustom<O, I>;
|
|
428
424
|
export declare function refine<T>(fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>, _params?: string | core.$ZodCustomParams): core.$ZodCheck<T>;
|
package/v4/mini/schemas.d.ts
CHANGED
|
@@ -419,10 +419,6 @@ export declare function promise<T extends SomeType>(innerType: T): ZodMiniPromis
|
|
|
419
419
|
export interface ZodMiniCustom<O = unknown, I = unknown> extends _ZodMiniType<core.$ZodCustomInternals<O, I>> {
|
|
420
420
|
}
|
|
421
421
|
export declare const ZodMiniCustom: core.$constructor<ZodMiniCustom>;
|
|
422
|
-
export interface ZodMiniProperties<Shape extends core.$ZodShape = core.$ZodShape> extends _ZodMiniType<core.$ZodPropertiesInternals<Shape>>, core.$ZodProperties<Shape> {
|
|
423
|
-
}
|
|
424
|
-
export declare const ZodMiniProperties: core.$constructor<ZodMiniProperties>;
|
|
425
|
-
export declare function properties<Shape extends core.$ZodShape>(shape: Shape, params?: string | core.$ZodPropertiesParams): ZodMiniProperties<Shape>;
|
|
426
422
|
export declare function check<O = unknown>(fn: core.CheckFn<O>, params?: string | core.$ZodCustomParams): core.$ZodCheck<O>;
|
|
427
423
|
export declare function custom<O = unknown, I = O>(fn?: (data: O) => unknown, _params?: string | core.$ZodCustomParams | undefined): ZodMiniCustom<O, I>;
|
|
428
424
|
export declare function refine<T>(fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>, _params?: string | core.$ZodCustomParams): core.$ZodCheck<T>;
|