zod 4.3.4 → 4.3.5
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/package.json +1 -1
- package/src/v4/core/versions.ts +1 -1
- package/src/v4/mini/schemas.ts +1 -1
- package/v4/core/versions.cjs +1 -1
- package/v4/core/versions.js +1 -1
- package/v4/mini/schemas.cjs +31 -31
- package/v4/mini/schemas.d.cts +1 -1
- package/v4/mini/schemas.d.ts +1 -1
- package/v4/mini/schemas.js +1 -1
package/package.json
CHANGED
package/src/v4/core/versions.ts
CHANGED
package/src/v4/mini/schemas.ts
CHANGED
package/v4/core/versions.cjs
CHANGED
package/v4/core/versions.js
CHANGED
package/v4/mini/schemas.cjs
CHANGED
|
@@ -127,7 +127,7 @@ exports.function = _function;
|
|
|
127
127
|
exports._function = _function;
|
|
128
128
|
exports.function = _function;
|
|
129
129
|
const core = __importStar(require("../core/index.cjs"));
|
|
130
|
-
const
|
|
130
|
+
const util = __importStar(require("../core/util.cjs"));
|
|
131
131
|
const parse = __importStar(require("./parse.cjs"));
|
|
132
132
|
exports.ZodMiniType = core.$constructor("ZodMiniType", (inst, def) => {
|
|
133
133
|
if (!inst._zod)
|
|
@@ -220,7 +220,7 @@ function httpUrl(params) {
|
|
|
220
220
|
return core._url(exports.ZodMiniURL, {
|
|
221
221
|
protocol: /^https?$/,
|
|
222
222
|
hostname: core.regexes.domain,
|
|
223
|
-
...
|
|
223
|
+
...util.normalizeParams(params),
|
|
224
224
|
});
|
|
225
225
|
}
|
|
226
226
|
exports.ZodMiniEmoji = core.$constructor("ZodMiniEmoji", (inst, def) => {
|
|
@@ -517,7 +517,7 @@ function array(element, params) {
|
|
|
517
517
|
return new exports.ZodMiniArray({
|
|
518
518
|
type: "array",
|
|
519
519
|
element: element,
|
|
520
|
-
...
|
|
520
|
+
...util.normalizeParams(params),
|
|
521
521
|
});
|
|
522
522
|
}
|
|
523
523
|
// .keyof
|
|
@@ -529,14 +529,14 @@ function keyof(schema) {
|
|
|
529
529
|
exports.ZodMiniObject = core.$constructor("ZodMiniObject", (inst, def) => {
|
|
530
530
|
core.$ZodObject.init(inst, def);
|
|
531
531
|
exports.ZodMiniType.init(inst, def);
|
|
532
|
-
|
|
532
|
+
util.defineLazy(inst, "shape", () => def.shape);
|
|
533
533
|
});
|
|
534
534
|
// @__NO_SIDE_EFFECTS__
|
|
535
535
|
function object(shape, params) {
|
|
536
536
|
const def = {
|
|
537
537
|
type: "object",
|
|
538
538
|
shape: shape ?? {},
|
|
539
|
-
...
|
|
539
|
+
...util.normalizeParams(params),
|
|
540
540
|
};
|
|
541
541
|
return new exports.ZodMiniObject(def);
|
|
542
542
|
}
|
|
@@ -547,7 +547,7 @@ function strictObject(shape, params) {
|
|
|
547
547
|
type: "object",
|
|
548
548
|
shape,
|
|
549
549
|
catchall: never(),
|
|
550
|
-
...
|
|
550
|
+
...util.normalizeParams(params),
|
|
551
551
|
});
|
|
552
552
|
}
|
|
553
553
|
// looseObject
|
|
@@ -557,38 +557,38 @@ function looseObject(shape, params) {
|
|
|
557
557
|
type: "object",
|
|
558
558
|
shape,
|
|
559
559
|
catchall: unknown(),
|
|
560
|
-
...
|
|
560
|
+
...util.normalizeParams(params),
|
|
561
561
|
});
|
|
562
562
|
}
|
|
563
563
|
// object methods
|
|
564
564
|
// @__NO_SIDE_EFFECTS__
|
|
565
565
|
function extend(schema, shape) {
|
|
566
|
-
return
|
|
566
|
+
return util.extend(schema, shape);
|
|
567
567
|
}
|
|
568
568
|
// @__NO_SIDE_EFFECTS__
|
|
569
569
|
function safeExtend(schema, shape) {
|
|
570
|
-
return
|
|
570
|
+
return util.safeExtend(schema, shape);
|
|
571
571
|
}
|
|
572
572
|
// @__NO_SIDE_EFFECTS__
|
|
573
573
|
function merge(schema, shape) {
|
|
574
|
-
return
|
|
574
|
+
return util.extend(schema, shape);
|
|
575
575
|
}
|
|
576
576
|
// @__NO_SIDE_EFFECTS__
|
|
577
577
|
function pick(schema, mask) {
|
|
578
|
-
return
|
|
578
|
+
return util.pick(schema, mask);
|
|
579
579
|
}
|
|
580
580
|
// .omit
|
|
581
581
|
// @__NO_SIDE_EFFECTS__
|
|
582
582
|
function omit(schema, mask) {
|
|
583
|
-
return
|
|
583
|
+
return util.omit(schema, mask);
|
|
584
584
|
}
|
|
585
585
|
// @__NO_SIDE_EFFECTS__
|
|
586
586
|
function partial(schema, mask) {
|
|
587
|
-
return
|
|
587
|
+
return util.partial(exports.ZodMiniOptional, schema, mask);
|
|
588
588
|
}
|
|
589
589
|
// @__NO_SIDE_EFFECTS__
|
|
590
590
|
function required(schema, mask) {
|
|
591
|
-
return
|
|
591
|
+
return util.required(exports.ZodMiniNonOptional, schema, mask);
|
|
592
592
|
}
|
|
593
593
|
// @__NO_SIDE_EFFECTS__
|
|
594
594
|
function catchall(inst, catchall) {
|
|
@@ -603,7 +603,7 @@ function union(options, params) {
|
|
|
603
603
|
return new exports.ZodMiniUnion({
|
|
604
604
|
type: "union",
|
|
605
605
|
options: options,
|
|
606
|
-
...
|
|
606
|
+
...util.normalizeParams(params),
|
|
607
607
|
});
|
|
608
608
|
}
|
|
609
609
|
exports.ZodMiniXor = core.$constructor("ZodMiniXor", (inst, def) => {
|
|
@@ -618,7 +618,7 @@ function xor(options, params) {
|
|
|
618
618
|
type: "union",
|
|
619
619
|
options: options,
|
|
620
620
|
inclusive: false,
|
|
621
|
-
...
|
|
621
|
+
...util.normalizeParams(params),
|
|
622
622
|
});
|
|
623
623
|
}
|
|
624
624
|
exports.ZodMiniDiscriminatedUnion = core.$constructor("ZodMiniDiscriminatedUnion", (inst, def) => {
|
|
@@ -631,7 +631,7 @@ function discriminatedUnion(discriminator, options, params) {
|
|
|
631
631
|
type: "union",
|
|
632
632
|
options,
|
|
633
633
|
discriminator,
|
|
634
|
-
...
|
|
634
|
+
...util.normalizeParams(params),
|
|
635
635
|
});
|
|
636
636
|
}
|
|
637
637
|
exports.ZodMiniIntersection = core.$constructor("ZodMiniIntersection", (inst, def) => {
|
|
@@ -659,7 +659,7 @@ function tuple(items, _paramsOrRest, _params) {
|
|
|
659
659
|
type: "tuple",
|
|
660
660
|
items: items,
|
|
661
661
|
rest,
|
|
662
|
-
...
|
|
662
|
+
...util.normalizeParams(params),
|
|
663
663
|
});
|
|
664
664
|
}
|
|
665
665
|
exports.ZodMiniRecord = core.$constructor("ZodMiniRecord", (inst, def) => {
|
|
@@ -672,7 +672,7 @@ function record(keyType, valueType, params) {
|
|
|
672
672
|
type: "record",
|
|
673
673
|
keyType,
|
|
674
674
|
valueType: valueType,
|
|
675
|
-
...
|
|
675
|
+
...util.normalizeParams(params),
|
|
676
676
|
});
|
|
677
677
|
}
|
|
678
678
|
// @__NO_SIDE_EFFECTS__
|
|
@@ -683,7 +683,7 @@ function partialRecord(keyType, valueType, params) {
|
|
|
683
683
|
type: "record",
|
|
684
684
|
keyType: k,
|
|
685
685
|
valueType: valueType,
|
|
686
|
-
...
|
|
686
|
+
...util.normalizeParams(params),
|
|
687
687
|
});
|
|
688
688
|
}
|
|
689
689
|
function looseRecord(keyType, valueType, params) {
|
|
@@ -692,7 +692,7 @@ function looseRecord(keyType, valueType, params) {
|
|
|
692
692
|
keyType,
|
|
693
693
|
valueType: valueType,
|
|
694
694
|
mode: "loose",
|
|
695
|
-
...
|
|
695
|
+
...util.normalizeParams(params),
|
|
696
696
|
});
|
|
697
697
|
}
|
|
698
698
|
exports.ZodMiniMap = core.$constructor("ZodMiniMap", (inst, def) => {
|
|
@@ -705,7 +705,7 @@ function map(keyType, valueType, params) {
|
|
|
705
705
|
type: "map",
|
|
706
706
|
keyType: keyType,
|
|
707
707
|
valueType: valueType,
|
|
708
|
-
...
|
|
708
|
+
...util.normalizeParams(params),
|
|
709
709
|
});
|
|
710
710
|
}
|
|
711
711
|
exports.ZodMiniSet = core.$constructor("ZodMiniSet", (inst, def) => {
|
|
@@ -717,7 +717,7 @@ function set(valueType, params) {
|
|
|
717
717
|
return new exports.ZodMiniSet({
|
|
718
718
|
type: "set",
|
|
719
719
|
valueType: valueType,
|
|
720
|
-
...
|
|
720
|
+
...util.normalizeParams(params),
|
|
721
721
|
});
|
|
722
722
|
}
|
|
723
723
|
exports.ZodMiniEnum = core.$constructor("ZodMiniEnum", (inst, def) => {
|
|
@@ -731,7 +731,7 @@ function _enum(values, params) {
|
|
|
731
731
|
return new exports.ZodMiniEnum({
|
|
732
732
|
type: "enum",
|
|
733
733
|
entries,
|
|
734
|
-
...
|
|
734
|
+
...util.normalizeParams(params),
|
|
735
735
|
});
|
|
736
736
|
}
|
|
737
737
|
// @__NO_SIDE_EFFECTS__
|
|
@@ -746,7 +746,7 @@ function nativeEnum(entries, params) {
|
|
|
746
746
|
return new exports.ZodMiniEnum({
|
|
747
747
|
type: "enum",
|
|
748
748
|
entries,
|
|
749
|
-
...
|
|
749
|
+
...util.normalizeParams(params),
|
|
750
750
|
});
|
|
751
751
|
}
|
|
752
752
|
exports.ZodMiniLiteral = core.$constructor("ZodMiniLiteral", (inst, def) => {
|
|
@@ -758,7 +758,7 @@ function literal(value, params) {
|
|
|
758
758
|
return new exports.ZodMiniLiteral({
|
|
759
759
|
type: "literal",
|
|
760
760
|
values: Array.isArray(value) ? value : [value],
|
|
761
|
-
...
|
|
761
|
+
...util.normalizeParams(params),
|
|
762
762
|
});
|
|
763
763
|
}
|
|
764
764
|
exports.ZodMiniFile = core.$constructor("ZodMiniFile", (inst, def) => {
|
|
@@ -828,7 +828,7 @@ function _default(innerType, defaultValue) {
|
|
|
828
828
|
type: "default",
|
|
829
829
|
innerType: innerType,
|
|
830
830
|
get defaultValue() {
|
|
831
|
-
return typeof defaultValue === "function" ? defaultValue() :
|
|
831
|
+
return typeof defaultValue === "function" ? defaultValue() : util.shallowClone(defaultValue);
|
|
832
832
|
},
|
|
833
833
|
});
|
|
834
834
|
}
|
|
@@ -842,7 +842,7 @@ function prefault(innerType, defaultValue) {
|
|
|
842
842
|
type: "prefault",
|
|
843
843
|
innerType: innerType,
|
|
844
844
|
get defaultValue() {
|
|
845
|
-
return typeof defaultValue === "function" ? defaultValue() :
|
|
845
|
+
return typeof defaultValue === "function" ? defaultValue() : util.shallowClone(defaultValue);
|
|
846
846
|
},
|
|
847
847
|
});
|
|
848
848
|
}
|
|
@@ -855,7 +855,7 @@ function nonoptional(innerType, params) {
|
|
|
855
855
|
return new exports.ZodMiniNonOptional({
|
|
856
856
|
type: "nonoptional",
|
|
857
857
|
innerType: innerType,
|
|
858
|
-
...
|
|
858
|
+
...util.normalizeParams(params),
|
|
859
859
|
});
|
|
860
860
|
}
|
|
861
861
|
exports.ZodMiniSuccess = core.$constructor("ZodMiniSuccess", (inst, def) => {
|
|
@@ -935,7 +935,7 @@ function templateLiteral(parts, params) {
|
|
|
935
935
|
return new exports.ZodMiniTemplateLiteral({
|
|
936
936
|
type: "template_literal",
|
|
937
937
|
parts,
|
|
938
|
-
...
|
|
938
|
+
...util.normalizeParams(params),
|
|
939
939
|
});
|
|
940
940
|
}
|
|
941
941
|
exports.ZodMiniLazy = core.$constructor("ZodMiniLazy", (inst, def) => {
|
|
@@ -972,7 +972,7 @@ exports.ZodMiniCustom = core.$constructor("ZodMiniCustom", (inst, def) => {
|
|
|
972
972
|
function check(fn, params) {
|
|
973
973
|
const ch = new core.$ZodCheck({
|
|
974
974
|
check: "custom",
|
|
975
|
-
...
|
|
975
|
+
...util.normalizeParams(params),
|
|
976
976
|
});
|
|
977
977
|
ch._zod.check = fn;
|
|
978
978
|
return ch;
|
package/v4/mini/schemas.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as core from "../core/index.cjs";
|
|
2
|
-
import
|
|
2
|
+
import * as util from "../core/util.cjs";
|
|
3
3
|
type SomeType = core.SomeType;
|
|
4
4
|
export interface ZodMiniType<out Output = unknown, out Input = unknown, out Internals extends core.$ZodTypeInternals<Output, Input> = core.$ZodTypeInternals<Output, Input>> extends core.$ZodType<Output, Input, Internals> {
|
|
5
5
|
type: Internals["def"]["type"];
|
package/v4/mini/schemas.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as core from "../core/index.js";
|
|
2
|
-
import
|
|
2
|
+
import * as util from "../core/util.js";
|
|
3
3
|
type SomeType = core.SomeType;
|
|
4
4
|
export interface ZodMiniType<out Output = unknown, out Input = unknown, out Internals extends core.$ZodTypeInternals<Output, Input> = core.$ZodTypeInternals<Output, Input>> extends core.$ZodType<Output, Input, Internals> {
|
|
5
5
|
type: Internals["def"]["type"];
|
package/v4/mini/schemas.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as core from "../core/index.js";
|
|
2
|
-
import
|
|
2
|
+
import * as util from "../core/util.js";
|
|
3
3
|
import * as parse from "./parse.js";
|
|
4
4
|
export const ZodMiniType = /*@__PURE__*/ core.$constructor("ZodMiniType", (inst, def) => {
|
|
5
5
|
if (!inst._zod)
|