zod 4.2.0-canary.20251207T223211 → 4.2.0-canary.20251213T203150
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/classic/schemas.ts +97 -5
- package/src/v4/classic/tests/json.test.ts +4 -3
- package/src/v4/classic/tests/standard-schema.test.ts +77 -0
- package/src/v4/classic/tests/to-json-schema-methods.test.ts +438 -0
- package/src/v4/classic/tests/to-json-schema.test.ts +66 -30
- package/src/v4/core/index.ts +2 -0
- package/src/v4/core/json-schema-generator.ts +124 -0
- package/src/v4/core/json-schema-processors.ts +630 -0
- package/src/v4/core/schemas.ts +8 -13
- package/src/v4/core/standard-schema.ts +114 -19
- package/src/v4/core/to-json-schema.ts +373 -827
- package/src/v4/mini/tests/standard-schema.test.ts +17 -0
- package/v4/classic/schemas.cjs +48 -0
- package/v4/classic/schemas.d.cts +35 -0
- package/v4/classic/schemas.d.ts +35 -0
- package/v4/classic/schemas.js +48 -0
- package/v4/core/index.cjs +5 -1
- package/v4/core/index.d.cts +2 -0
- package/v4/core/index.d.ts +2 -0
- package/v4/core/index.js +2 -0
- package/v4/core/json-schema-generator.cjs +99 -0
- package/v4/core/json-schema-generator.d.cts +64 -0
- package/v4/core/json-schema-generator.d.ts +64 -0
- package/v4/core/json-schema-generator.js +95 -0
- package/v4/core/json-schema-processors.cjs +617 -0
- package/v4/core/json-schema-processors.d.cts +49 -0
- package/v4/core/json-schema-processors.d.ts +49 -0
- package/v4/core/json-schema-processors.js +574 -0
- package/v4/core/schemas.cjs +0 -10
- package/v4/core/schemas.d.cts +4 -1
- package/v4/core/schemas.d.ts +4 -1
- package/v4/core/schemas.js +0 -10
- package/v4/core/standard-schema.d.cts +90 -19
- package/v4/core/standard-schema.d.ts +90 -19
- package/v4/core/to-json-schema.cjs +302 -793
- package/v4/core/to-json-schema.d.cts +56 -33
- package/v4/core/to-json-schema.d.ts +56 -33
- package/v4/core/to-json-schema.js +296 -791
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { test } from "vitest";
|
|
2
|
+
import type { StandardSchemaWithJSON } from "../../core/standard-schema.js";
|
|
3
|
+
import * as z from "../index.js";
|
|
4
|
+
|
|
5
|
+
function acceptSchema(schema: StandardSchemaWithJSON) {
|
|
6
|
+
return schema;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
test("Zod Mini schemas are NOT assignable to StandardJSONSchema", () => {
|
|
10
|
+
const schema = z.string();
|
|
11
|
+
|
|
12
|
+
// @ts-expect-error
|
|
13
|
+
const _standard: StandardSchemaWithJSON["~standard"] = schema;
|
|
14
|
+
|
|
15
|
+
// @ts-expect-error
|
|
16
|
+
acceptSchema(schema);
|
|
17
|
+
});
|
package/v4/classic/schemas.cjs
CHANGED
|
@@ -118,11 +118,20 @@ exports.json = json;
|
|
|
118
118
|
exports.preprocess = preprocess;
|
|
119
119
|
const core = __importStar(require("../core/index.cjs"));
|
|
120
120
|
const index_js_1 = require("../core/index.cjs");
|
|
121
|
+
const processors = __importStar(require("../core/json-schema-processors.cjs"));
|
|
122
|
+
const to_json_schema_js_1 = require("../core/to-json-schema.cjs");
|
|
121
123
|
const checks = __importStar(require("./checks.cjs"));
|
|
122
124
|
const iso = __importStar(require("./iso.cjs"));
|
|
123
125
|
const parse = __importStar(require("./parse.cjs"));
|
|
124
126
|
exports.ZodType = core.$constructor("ZodType", (inst, def) => {
|
|
125
127
|
core.$ZodType.init(inst, def);
|
|
128
|
+
Object.assign(inst["~standard"], {
|
|
129
|
+
jsonSchema: {
|
|
130
|
+
input: (0, to_json_schema_js_1.createStandardJSONSchemaMethod)(inst, "input"),
|
|
131
|
+
output: (0, to_json_schema_js_1.createStandardJSONSchemaMethod)(inst, "output"),
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
inst.toJSONSchema = (0, to_json_schema_js_1.createToJSONSchemaMethod)(inst, {});
|
|
126
135
|
inst.def = def;
|
|
127
136
|
inst.type = def.type;
|
|
128
137
|
Object.defineProperty(inst, "_def", { value: def });
|
|
@@ -204,6 +213,7 @@ exports.ZodType = core.$constructor("ZodType", (inst, def) => {
|
|
|
204
213
|
exports._ZodString = core.$constructor("_ZodString", (inst, def) => {
|
|
205
214
|
core.$ZodString.init(inst, def);
|
|
206
215
|
exports.ZodType.init(inst, def);
|
|
216
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.stringProcessor(inst, ctx, json, params);
|
|
207
217
|
const bag = inst._zod.bag;
|
|
208
218
|
inst.format = bag.format ?? null;
|
|
209
219
|
inst.minLength = bag.minimum ?? null;
|
|
@@ -466,6 +476,7 @@ function hash(alg, params) {
|
|
|
466
476
|
exports.ZodNumber = core.$constructor("ZodNumber", (inst, def) => {
|
|
467
477
|
core.$ZodNumber.init(inst, def);
|
|
468
478
|
exports.ZodType.init(inst, def);
|
|
479
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.numberProcessor(inst, ctx, json, params);
|
|
469
480
|
inst.gt = (value, params) => inst.check(checks.gt(value, params));
|
|
470
481
|
inst.gte = (value, params) => inst.check(checks.gte(value, params));
|
|
471
482
|
inst.min = (value, params) => inst.check(checks.gte(value, params));
|
|
@@ -516,6 +527,7 @@ function uint32(params) {
|
|
|
516
527
|
exports.ZodBoolean = core.$constructor("ZodBoolean", (inst, def) => {
|
|
517
528
|
core.$ZodBoolean.init(inst, def);
|
|
518
529
|
exports.ZodType.init(inst, def);
|
|
530
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.booleanProcessor(inst, ctx, json, params);
|
|
519
531
|
});
|
|
520
532
|
function boolean(params) {
|
|
521
533
|
return core._boolean(exports.ZodBoolean, params);
|
|
@@ -523,6 +535,7 @@ function boolean(params) {
|
|
|
523
535
|
exports.ZodBigInt = core.$constructor("ZodBigInt", (inst, def) => {
|
|
524
536
|
core.$ZodBigInt.init(inst, def);
|
|
525
537
|
exports.ZodType.init(inst, def);
|
|
538
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.bigintProcessor(inst, ctx, json, params);
|
|
526
539
|
inst.gte = (value, params) => inst.check(checks.gte(value, params));
|
|
527
540
|
inst.min = (value, params) => inst.check(checks.gte(value, params));
|
|
528
541
|
inst.gt = (value, params) => inst.check(checks.gt(value, params));
|
|
@@ -559,6 +572,7 @@ function uint64(params) {
|
|
|
559
572
|
exports.ZodSymbol = core.$constructor("ZodSymbol", (inst, def) => {
|
|
560
573
|
core.$ZodSymbol.init(inst, def);
|
|
561
574
|
exports.ZodType.init(inst, def);
|
|
575
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.symbolProcessor(inst, ctx, json, params);
|
|
562
576
|
});
|
|
563
577
|
function symbol(params) {
|
|
564
578
|
return core._symbol(exports.ZodSymbol, params);
|
|
@@ -566,6 +580,7 @@ function symbol(params) {
|
|
|
566
580
|
exports.ZodUndefined = core.$constructor("ZodUndefined", (inst, def) => {
|
|
567
581
|
core.$ZodUndefined.init(inst, def);
|
|
568
582
|
exports.ZodType.init(inst, def);
|
|
583
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.undefinedProcessor(inst, ctx, json, params);
|
|
569
584
|
});
|
|
570
585
|
function _undefined(params) {
|
|
571
586
|
return core._undefined(exports.ZodUndefined, params);
|
|
@@ -573,6 +588,7 @@ function _undefined(params) {
|
|
|
573
588
|
exports.ZodNull = core.$constructor("ZodNull", (inst, def) => {
|
|
574
589
|
core.$ZodNull.init(inst, def);
|
|
575
590
|
exports.ZodType.init(inst, def);
|
|
591
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.nullProcessor(inst, ctx, json, params);
|
|
576
592
|
});
|
|
577
593
|
function _null(params) {
|
|
578
594
|
return core._null(exports.ZodNull, params);
|
|
@@ -580,6 +596,7 @@ function _null(params) {
|
|
|
580
596
|
exports.ZodAny = core.$constructor("ZodAny", (inst, def) => {
|
|
581
597
|
core.$ZodAny.init(inst, def);
|
|
582
598
|
exports.ZodType.init(inst, def);
|
|
599
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.anyProcessor(inst, ctx, json, params);
|
|
583
600
|
});
|
|
584
601
|
function any() {
|
|
585
602
|
return core._any(exports.ZodAny);
|
|
@@ -587,6 +604,7 @@ function any() {
|
|
|
587
604
|
exports.ZodUnknown = core.$constructor("ZodUnknown", (inst, def) => {
|
|
588
605
|
core.$ZodUnknown.init(inst, def);
|
|
589
606
|
exports.ZodType.init(inst, def);
|
|
607
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.unknownProcessor(inst, ctx, json, params);
|
|
590
608
|
});
|
|
591
609
|
function unknown() {
|
|
592
610
|
return core._unknown(exports.ZodUnknown);
|
|
@@ -594,6 +612,7 @@ function unknown() {
|
|
|
594
612
|
exports.ZodNever = core.$constructor("ZodNever", (inst, def) => {
|
|
595
613
|
core.$ZodNever.init(inst, def);
|
|
596
614
|
exports.ZodType.init(inst, def);
|
|
615
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.neverProcessor(inst, ctx, json, params);
|
|
597
616
|
});
|
|
598
617
|
function never(params) {
|
|
599
618
|
return core._never(exports.ZodNever, params);
|
|
@@ -601,6 +620,7 @@ function never(params) {
|
|
|
601
620
|
exports.ZodVoid = core.$constructor("ZodVoid", (inst, def) => {
|
|
602
621
|
core.$ZodVoid.init(inst, def);
|
|
603
622
|
exports.ZodType.init(inst, def);
|
|
623
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.voidProcessor(inst, ctx, json, params);
|
|
604
624
|
});
|
|
605
625
|
function _void(params) {
|
|
606
626
|
return core._void(exports.ZodVoid, params);
|
|
@@ -608,6 +628,7 @@ function _void(params) {
|
|
|
608
628
|
exports.ZodDate = core.$constructor("ZodDate", (inst, def) => {
|
|
609
629
|
core.$ZodDate.init(inst, def);
|
|
610
630
|
exports.ZodType.init(inst, def);
|
|
631
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.dateProcessor(inst, ctx, json, params);
|
|
611
632
|
inst.min = (value, params) => inst.check(checks.gte(value, params));
|
|
612
633
|
inst.max = (value, params) => inst.check(checks.lte(value, params));
|
|
613
634
|
const c = inst._zod.bag;
|
|
@@ -620,6 +641,7 @@ function date(params) {
|
|
|
620
641
|
exports.ZodArray = core.$constructor("ZodArray", (inst, def) => {
|
|
621
642
|
core.$ZodArray.init(inst, def);
|
|
622
643
|
exports.ZodType.init(inst, def);
|
|
644
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.arrayProcessor(inst, ctx, json, params);
|
|
623
645
|
inst.element = def.element;
|
|
624
646
|
inst.min = (minLength, params) => inst.check(checks.minLength(minLength, params));
|
|
625
647
|
inst.nonempty = (params) => inst.check(checks.minLength(1, params));
|
|
@@ -638,6 +660,7 @@ function keyof(schema) {
|
|
|
638
660
|
exports.ZodObject = core.$constructor("ZodObject", (inst, def) => {
|
|
639
661
|
core.$ZodObjectJIT.init(inst, def);
|
|
640
662
|
exports.ZodType.init(inst, def);
|
|
663
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.objectProcessor(inst, ctx, json, params);
|
|
641
664
|
index_js_1.util.defineLazy(inst, "shape", () => {
|
|
642
665
|
return def.shape;
|
|
643
666
|
});
|
|
@@ -688,6 +711,7 @@ function looseObject(shape, params) {
|
|
|
688
711
|
exports.ZodUnion = core.$constructor("ZodUnion", (inst, def) => {
|
|
689
712
|
core.$ZodUnion.init(inst, def);
|
|
690
713
|
exports.ZodType.init(inst, def);
|
|
714
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.unionProcessor(inst, ctx, json, params);
|
|
691
715
|
inst.options = def.options;
|
|
692
716
|
});
|
|
693
717
|
function union(options, params) {
|
|
@@ -713,6 +737,7 @@ function discriminatedUnion(discriminator, options, params) {
|
|
|
713
737
|
exports.ZodIntersection = core.$constructor("ZodIntersection", (inst, def) => {
|
|
714
738
|
core.$ZodIntersection.init(inst, def);
|
|
715
739
|
exports.ZodType.init(inst, def);
|
|
740
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.intersectionProcessor(inst, ctx, json, params);
|
|
716
741
|
});
|
|
717
742
|
function intersection(left, right) {
|
|
718
743
|
return new exports.ZodIntersection({
|
|
@@ -724,6 +749,7 @@ function intersection(left, right) {
|
|
|
724
749
|
exports.ZodTuple = core.$constructor("ZodTuple", (inst, def) => {
|
|
725
750
|
core.$ZodTuple.init(inst, def);
|
|
726
751
|
exports.ZodType.init(inst, def);
|
|
752
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.tupleProcessor(inst, ctx, json, params);
|
|
727
753
|
inst.rest = (rest) => inst.clone({
|
|
728
754
|
...inst._zod.def,
|
|
729
755
|
rest: rest,
|
|
@@ -743,6 +769,7 @@ function tuple(items, _paramsOrRest, _params) {
|
|
|
743
769
|
exports.ZodRecord = core.$constructor("ZodRecord", (inst, def) => {
|
|
744
770
|
core.$ZodRecord.init(inst, def);
|
|
745
771
|
exports.ZodType.init(inst, def);
|
|
772
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.recordProcessor(inst, ctx, json, params);
|
|
746
773
|
inst.keyType = def.keyType;
|
|
747
774
|
inst.valueType = def.valueType;
|
|
748
775
|
});
|
|
@@ -768,6 +795,7 @@ function partialRecord(keyType, valueType, params) {
|
|
|
768
795
|
exports.ZodMap = core.$constructor("ZodMap", (inst, def) => {
|
|
769
796
|
core.$ZodMap.init(inst, def);
|
|
770
797
|
exports.ZodType.init(inst, def);
|
|
798
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.mapProcessor(inst, ctx, json, params);
|
|
771
799
|
inst.keyType = def.keyType;
|
|
772
800
|
inst.valueType = def.valueType;
|
|
773
801
|
});
|
|
@@ -782,6 +810,7 @@ function map(keyType, valueType, params) {
|
|
|
782
810
|
exports.ZodSet = core.$constructor("ZodSet", (inst, def) => {
|
|
783
811
|
core.$ZodSet.init(inst, def);
|
|
784
812
|
exports.ZodType.init(inst, def);
|
|
813
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.setProcessor(inst, ctx, json, params);
|
|
785
814
|
inst.min = (...args) => inst.check(core._minSize(...args));
|
|
786
815
|
inst.nonempty = (params) => inst.check(core._minSize(1, params));
|
|
787
816
|
inst.max = (...args) => inst.check(core._maxSize(...args));
|
|
@@ -797,6 +826,7 @@ function set(valueType, params) {
|
|
|
797
826
|
exports.ZodEnum = core.$constructor("ZodEnum", (inst, def) => {
|
|
798
827
|
core.$ZodEnum.init(inst, def);
|
|
799
828
|
exports.ZodType.init(inst, def);
|
|
829
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.enumProcessor(inst, ctx, json, params);
|
|
800
830
|
inst.enum = def.entries;
|
|
801
831
|
inst.options = Object.values(def.entries);
|
|
802
832
|
const keys = new Set(Object.keys(def.entries));
|
|
@@ -858,6 +888,7 @@ function nativeEnum(entries, params) {
|
|
|
858
888
|
exports.ZodLiteral = core.$constructor("ZodLiteral", (inst, def) => {
|
|
859
889
|
core.$ZodLiteral.init(inst, def);
|
|
860
890
|
exports.ZodType.init(inst, def);
|
|
891
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.literalProcessor(inst, ctx, json, params);
|
|
861
892
|
inst.values = new Set(def.values);
|
|
862
893
|
Object.defineProperty(inst, "value", {
|
|
863
894
|
get() {
|
|
@@ -878,6 +909,7 @@ function literal(value, params) {
|
|
|
878
909
|
exports.ZodFile = core.$constructor("ZodFile", (inst, def) => {
|
|
879
910
|
core.$ZodFile.init(inst, def);
|
|
880
911
|
exports.ZodType.init(inst, def);
|
|
912
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.fileProcessor(inst, ctx, json, params);
|
|
881
913
|
inst.min = (size, params) => inst.check(core._minSize(size, params));
|
|
882
914
|
inst.max = (size, params) => inst.check(core._maxSize(size, params));
|
|
883
915
|
inst.mime = (types, params) => inst.check(core._mime(Array.isArray(types) ? types : [types], params));
|
|
@@ -888,6 +920,7 @@ function file(params) {
|
|
|
888
920
|
exports.ZodTransform = core.$constructor("ZodTransform", (inst, def) => {
|
|
889
921
|
core.$ZodTransform.init(inst, def);
|
|
890
922
|
exports.ZodType.init(inst, def);
|
|
923
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.transformProcessor(inst, ctx, json, params);
|
|
891
924
|
inst._zod.parse = (payload, _ctx) => {
|
|
892
925
|
if (_ctx.direction === "backward") {
|
|
893
926
|
throw new core.$ZodEncodeError(inst.constructor.name);
|
|
@@ -928,6 +961,7 @@ function transform(fn) {
|
|
|
928
961
|
exports.ZodOptional = core.$constructor("ZodOptional", (inst, def) => {
|
|
929
962
|
core.$ZodOptional.init(inst, def);
|
|
930
963
|
exports.ZodType.init(inst, def);
|
|
964
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.optionalProcessor(inst, ctx, json, params);
|
|
931
965
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
932
966
|
});
|
|
933
967
|
function optional(innerType) {
|
|
@@ -939,6 +973,7 @@ function optional(innerType) {
|
|
|
939
973
|
exports.ZodNullable = core.$constructor("ZodNullable", (inst, def) => {
|
|
940
974
|
core.$ZodNullable.init(inst, def);
|
|
941
975
|
exports.ZodType.init(inst, def);
|
|
976
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.nullableProcessor(inst, ctx, json, params);
|
|
942
977
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
943
978
|
});
|
|
944
979
|
function nullable(innerType) {
|
|
@@ -954,6 +989,7 @@ function nullish(innerType) {
|
|
|
954
989
|
exports.ZodDefault = core.$constructor("ZodDefault", (inst, def) => {
|
|
955
990
|
core.$ZodDefault.init(inst, def);
|
|
956
991
|
exports.ZodType.init(inst, def);
|
|
992
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.defaultProcessor(inst, ctx, json, params);
|
|
957
993
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
958
994
|
inst.removeDefault = inst.unwrap;
|
|
959
995
|
});
|
|
@@ -969,6 +1005,7 @@ function _default(innerType, defaultValue) {
|
|
|
969
1005
|
exports.ZodPrefault = core.$constructor("ZodPrefault", (inst, def) => {
|
|
970
1006
|
core.$ZodPrefault.init(inst, def);
|
|
971
1007
|
exports.ZodType.init(inst, def);
|
|
1008
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.prefaultProcessor(inst, ctx, json, params);
|
|
972
1009
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
973
1010
|
});
|
|
974
1011
|
function prefault(innerType, defaultValue) {
|
|
@@ -983,6 +1020,7 @@ function prefault(innerType, defaultValue) {
|
|
|
983
1020
|
exports.ZodNonOptional = core.$constructor("ZodNonOptional", (inst, def) => {
|
|
984
1021
|
core.$ZodNonOptional.init(inst, def);
|
|
985
1022
|
exports.ZodType.init(inst, def);
|
|
1023
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.nonoptionalProcessor(inst, ctx, json, params);
|
|
986
1024
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
987
1025
|
});
|
|
988
1026
|
function nonoptional(innerType, params) {
|
|
@@ -995,6 +1033,7 @@ function nonoptional(innerType, params) {
|
|
|
995
1033
|
exports.ZodSuccess = core.$constructor("ZodSuccess", (inst, def) => {
|
|
996
1034
|
core.$ZodSuccess.init(inst, def);
|
|
997
1035
|
exports.ZodType.init(inst, def);
|
|
1036
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.successProcessor(inst, ctx, json, params);
|
|
998
1037
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
999
1038
|
});
|
|
1000
1039
|
function success(innerType) {
|
|
@@ -1006,6 +1045,7 @@ function success(innerType) {
|
|
|
1006
1045
|
exports.ZodCatch = core.$constructor("ZodCatch", (inst, def) => {
|
|
1007
1046
|
core.$ZodCatch.init(inst, def);
|
|
1008
1047
|
exports.ZodType.init(inst, def);
|
|
1048
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.catchProcessor(inst, ctx, json, params);
|
|
1009
1049
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
1010
1050
|
inst.removeCatch = inst.unwrap;
|
|
1011
1051
|
});
|
|
@@ -1019,6 +1059,7 @@ function _catch(innerType, catchValue) {
|
|
|
1019
1059
|
exports.ZodNaN = core.$constructor("ZodNaN", (inst, def) => {
|
|
1020
1060
|
core.$ZodNaN.init(inst, def);
|
|
1021
1061
|
exports.ZodType.init(inst, def);
|
|
1062
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.nanProcessor(inst, ctx, json, params);
|
|
1022
1063
|
});
|
|
1023
1064
|
function nan(params) {
|
|
1024
1065
|
return core._nan(exports.ZodNaN, params);
|
|
@@ -1026,6 +1067,7 @@ function nan(params) {
|
|
|
1026
1067
|
exports.ZodPipe = core.$constructor("ZodPipe", (inst, def) => {
|
|
1027
1068
|
core.$ZodPipe.init(inst, def);
|
|
1028
1069
|
exports.ZodType.init(inst, def);
|
|
1070
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.pipeProcessor(inst, ctx, json, params);
|
|
1029
1071
|
inst.in = def.in;
|
|
1030
1072
|
inst.out = def.out;
|
|
1031
1073
|
});
|
|
@@ -1053,6 +1095,7 @@ function codec(in_, out, params) {
|
|
|
1053
1095
|
exports.ZodReadonly = core.$constructor("ZodReadonly", (inst, def) => {
|
|
1054
1096
|
core.$ZodReadonly.init(inst, def);
|
|
1055
1097
|
exports.ZodType.init(inst, def);
|
|
1098
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.readonlyProcessor(inst, ctx, json, params);
|
|
1056
1099
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
1057
1100
|
});
|
|
1058
1101
|
function readonly(innerType) {
|
|
@@ -1064,6 +1107,7 @@ function readonly(innerType) {
|
|
|
1064
1107
|
exports.ZodTemplateLiteral = core.$constructor("ZodTemplateLiteral", (inst, def) => {
|
|
1065
1108
|
core.$ZodTemplateLiteral.init(inst, def);
|
|
1066
1109
|
exports.ZodType.init(inst, def);
|
|
1110
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.templateLiteralProcessor(inst, ctx, json, params);
|
|
1067
1111
|
});
|
|
1068
1112
|
function templateLiteral(parts, params) {
|
|
1069
1113
|
return new exports.ZodTemplateLiteral({
|
|
@@ -1075,6 +1119,7 @@ function templateLiteral(parts, params) {
|
|
|
1075
1119
|
exports.ZodLazy = core.$constructor("ZodLazy", (inst, def) => {
|
|
1076
1120
|
core.$ZodLazy.init(inst, def);
|
|
1077
1121
|
exports.ZodType.init(inst, def);
|
|
1122
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.lazyProcessor(inst, ctx, json, params);
|
|
1078
1123
|
inst.unwrap = () => inst._zod.def.getter();
|
|
1079
1124
|
});
|
|
1080
1125
|
function lazy(getter) {
|
|
@@ -1086,6 +1131,7 @@ function lazy(getter) {
|
|
|
1086
1131
|
exports.ZodPromise = core.$constructor("ZodPromise", (inst, def) => {
|
|
1087
1132
|
core.$ZodPromise.init(inst, def);
|
|
1088
1133
|
exports.ZodType.init(inst, def);
|
|
1134
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.promiseProcessor(inst, ctx, json, params);
|
|
1089
1135
|
inst.unwrap = () => inst._zod.def.innerType;
|
|
1090
1136
|
});
|
|
1091
1137
|
function promise(innerType) {
|
|
@@ -1097,6 +1143,7 @@ function promise(innerType) {
|
|
|
1097
1143
|
exports.ZodFunction = core.$constructor("ZodFunction", (inst, def) => {
|
|
1098
1144
|
core.$ZodFunction.init(inst, def);
|
|
1099
1145
|
exports.ZodType.init(inst, def);
|
|
1146
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.functionProcessor(inst, ctx, json, params);
|
|
1100
1147
|
});
|
|
1101
1148
|
function _function(params) {
|
|
1102
1149
|
return new exports.ZodFunction({
|
|
@@ -1108,6 +1155,7 @@ function _function(params) {
|
|
|
1108
1155
|
exports.ZodCustom = core.$constructor("ZodCustom", (inst, def) => {
|
|
1109
1156
|
core.$ZodCustom.init(inst, def);
|
|
1110
1157
|
exports.ZodType.init(inst, def);
|
|
1158
|
+
inst._zod.processJSONSchema = (ctx, json, params) => processors.customProcessor(inst, ctx, json, params);
|
|
1111
1159
|
});
|
|
1112
1160
|
// custom checks
|
|
1113
1161
|
function check(fn) {
|
package/v4/classic/schemas.d.cts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as core from "../core/index.cjs";
|
|
2
2
|
import { util } from "../core/index.cjs";
|
|
3
|
+
import type { StandardSchemaWithJSONProps } from "../core/standard-schema.cjs";
|
|
3
4
|
import * as parse from "./parse.cjs";
|
|
5
|
+
export type ZodStandardSchemaWithJSON<T> = StandardSchemaWithJSONProps<core.input<T>, core.output<T>>;
|
|
4
6
|
export interface ZodType<out Output = unknown, out Input = unknown, out Internals extends core.$ZodTypeInternals<Output, Input> = core.$ZodTypeInternals<Output, Input>> extends core.$ZodType<Output, Input, Internals> {
|
|
5
7
|
def: Internals["def"];
|
|
6
8
|
type: Internals["def"]["type"];
|
|
@@ -10,6 +12,9 @@ export interface ZodType<out Output = unknown, out Input = unknown, out Internal
|
|
|
10
12
|
_output: Internals["output"];
|
|
11
13
|
/** @deprecated Use `z.input<typeof schema>` instead. */
|
|
12
14
|
_input: Internals["input"];
|
|
15
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
16
|
+
/** Converts this schema to a JSON Schema representation. */
|
|
17
|
+
toJSONSchema(params?: core.ToJSONSchemaParams): core.ZodStandardJSONSchemaPayload<this>;
|
|
13
18
|
check(...checks: (core.CheckFn<core.output<this>> | core.$ZodCheck<core.output<this>>)[]): this;
|
|
14
19
|
clone(def?: Internals["def"], params?: {
|
|
15
20
|
parent: boolean;
|
|
@@ -266,6 +271,7 @@ export declare const ZodJWT: core.$constructor<ZodJWT>;
|
|
|
266
271
|
export declare function jwt(params?: string | core.$ZodJWTParams): ZodJWT;
|
|
267
272
|
export interface ZodCustomStringFormat<Format extends string = string> extends ZodStringFormat<Format>, core.$ZodCustomStringFormat<Format> {
|
|
268
273
|
_zod: core.$ZodCustomStringFormatInternals<Format>;
|
|
274
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
269
275
|
}
|
|
270
276
|
export declare const ZodCustomStringFormat: core.$constructor<ZodCustomStringFormat>;
|
|
271
277
|
export declare function stringFormat<Format extends string>(format: Format, fnOrRegex: ((arg: string) => util.MaybeAsync<unknown>) | RegExp, _params?: string | core.$ZodStringFormatParams): ZodCustomStringFormat<Format>;
|
|
@@ -411,6 +417,7 @@ export interface ZodArray<T extends core.SomeType = core.$ZodType> extends _ZodT
|
|
|
411
417
|
max(maxLength: number, params?: string | core.$ZodCheckMaxLengthParams): this;
|
|
412
418
|
length(len: number, params?: string | core.$ZodCheckLengthEqualsParams): this;
|
|
413
419
|
unwrap(): T;
|
|
420
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
414
421
|
}
|
|
415
422
|
export declare const ZodArray: core.$constructor<ZodArray>;
|
|
416
423
|
export declare function array<T extends core.SomeType>(element: T, params?: string | core.$ZodArrayParams): ZodArray<T>;
|
|
@@ -421,6 +428,7 @@ export type SafeExtendShape<Base extends core.$ZodShape, Ext extends core.$ZodLo
|
|
|
421
428
|
export interface ZodObject<
|
|
422
429
|
/** @ts-ignore Cast variance */
|
|
423
430
|
out Shape extends core.$ZodShape = core.$ZodLooseShape, out Config extends core.$ZodObjectConfig = core.$strip> extends _ZodType<core.$ZodObjectInternals<Shape, Config>>, core.$ZodObject<Shape, Config> {
|
|
431
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
424
432
|
shape: Shape;
|
|
425
433
|
keyof(): ZodEnum<util.ToEnum<keyof Shape & string>>;
|
|
426
434
|
/** Define a schema to validate all unrecognized keys. This overrides the existing strict/loose behavior. */
|
|
@@ -459,21 +467,25 @@ export declare function object<T extends core.$ZodLooseShape = Partial<Record<ne
|
|
|
459
467
|
export declare function strictObject<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodObjectParams): ZodObject<T, core.$strict>;
|
|
460
468
|
export declare function looseObject<T extends core.$ZodLooseShape>(shape: T, params?: string | core.$ZodObjectParams): ZodObject<T, core.$loose>;
|
|
461
469
|
export interface ZodUnion<T extends readonly core.SomeType[] = readonly core.$ZodType[]> extends _ZodType<core.$ZodUnionInternals<T>>, core.$ZodUnion<T> {
|
|
470
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
462
471
|
options: T;
|
|
463
472
|
}
|
|
464
473
|
export declare const ZodUnion: core.$constructor<ZodUnion>;
|
|
465
474
|
export declare function union<const T extends readonly core.SomeType[]>(options: T, params?: string | core.$ZodUnionParams): ZodUnion<T>;
|
|
466
475
|
export interface ZodDiscriminatedUnion<Options extends readonly core.SomeType[] = readonly core.$ZodType[], Disc extends string = string> extends ZodUnion<Options>, core.$ZodDiscriminatedUnion<Options, Disc> {
|
|
476
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
467
477
|
_zod: core.$ZodDiscriminatedUnionInternals<Options, Disc>;
|
|
468
478
|
def: core.$ZodDiscriminatedUnionDef<Options, Disc>;
|
|
469
479
|
}
|
|
470
480
|
export declare const ZodDiscriminatedUnion: core.$constructor<ZodDiscriminatedUnion>;
|
|
471
481
|
export declare function discriminatedUnion<Types extends readonly [core.$ZodTypeDiscriminable, ...core.$ZodTypeDiscriminable[]], Disc extends string>(discriminator: Disc, options: Types, params?: string | core.$ZodDiscriminatedUnionParams): ZodDiscriminatedUnion<Types, Disc>;
|
|
472
482
|
export interface ZodIntersection<A extends core.SomeType = core.$ZodType, B extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodIntersectionInternals<A, B>>, core.$ZodIntersection<A, B> {
|
|
483
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
473
484
|
}
|
|
474
485
|
export declare const ZodIntersection: core.$constructor<ZodIntersection>;
|
|
475
486
|
export declare function intersection<T extends core.SomeType, U extends core.SomeType>(left: T, right: U): ZodIntersection<T, U>;
|
|
476
487
|
export interface ZodTuple<T extends util.TupleItems = readonly core.$ZodType[], Rest extends core.SomeType | null = core.$ZodType | null> extends _ZodType<core.$ZodTupleInternals<T, Rest>>, core.$ZodTuple<T, Rest> {
|
|
488
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
477
489
|
rest<Rest extends core.SomeType = core.$ZodType>(rest: Rest): ZodTuple<T, Rest>;
|
|
478
490
|
}
|
|
479
491
|
export declare const ZodTuple: core.$constructor<ZodTuple>;
|
|
@@ -481,6 +493,7 @@ export declare function tuple<T extends readonly [core.SomeType, ...core.SomeTyp
|
|
|
481
493
|
export declare function tuple<T extends readonly [core.SomeType, ...core.SomeType[]], Rest extends core.SomeType>(items: T, rest: Rest, params?: string | core.$ZodTupleParams): ZodTuple<T, Rest>;
|
|
482
494
|
export declare function tuple(items: [], params?: string | core.$ZodTupleParams): ZodTuple<[], null>;
|
|
483
495
|
export interface ZodRecord<Key extends core.$ZodRecordKey = core.$ZodRecordKey, Value extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodRecordInternals<Key, Value>>, core.$ZodRecord<Key, Value> {
|
|
496
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
484
497
|
keyType: Key;
|
|
485
498
|
valueType: Value;
|
|
486
499
|
}
|
|
@@ -488,12 +501,14 @@ export declare const ZodRecord: core.$constructor<ZodRecord>;
|
|
|
488
501
|
export declare function record<Key extends core.$ZodRecordKey, Value extends core.SomeType>(keyType: Key, valueType: Value, params?: string | core.$ZodRecordParams): ZodRecord<Key, Value>;
|
|
489
502
|
export declare function partialRecord<Key extends core.$ZodRecordKey, Value extends core.SomeType>(keyType: Key, valueType: Value, params?: string | core.$ZodRecordParams): ZodRecord<Key & core.$partial, Value>;
|
|
490
503
|
export interface ZodMap<Key extends core.SomeType = core.$ZodType, Value extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodMapInternals<Key, Value>>, core.$ZodMap<Key, Value> {
|
|
504
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
491
505
|
keyType: Key;
|
|
492
506
|
valueType: Value;
|
|
493
507
|
}
|
|
494
508
|
export declare const ZodMap: core.$constructor<ZodMap>;
|
|
495
509
|
export declare function map<Key extends core.SomeType, Value extends core.SomeType>(keyType: Key, valueType: Value, params?: string | core.$ZodMapParams): ZodMap<Key, Value>;
|
|
496
510
|
export interface ZodSet<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodSetInternals<T>>, core.$ZodSet<T> {
|
|
511
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
497
512
|
min(minSize: number, params?: string | core.$ZodCheckMinSizeParams): this;
|
|
498
513
|
nonempty(params?: string | core.$ZodCheckMinSizeParams): this;
|
|
499
514
|
max(maxSize: number, params?: string | core.$ZodCheckMaxSizeParams): this;
|
|
@@ -504,6 +519,7 @@ export declare function set<Value extends core.SomeType>(valueType: Value, param
|
|
|
504
519
|
export interface ZodEnum<
|
|
505
520
|
/** @ts-ignore Cast variance */
|
|
506
521
|
out T extends util.EnumLike = util.EnumLike> extends _ZodType<core.$ZodEnumInternals<T>>, core.$ZodEnum<T> {
|
|
522
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
507
523
|
enum: T;
|
|
508
524
|
options: Array<T[keyof T]>;
|
|
509
525
|
extract<const U extends readonly (keyof T)[]>(values: U, params?: string | core.$ZodEnumParams): ZodEnum<util.Flatten<Pick<T, U[number]>>>;
|
|
@@ -522,6 +538,7 @@ export { _enum as enum };
|
|
|
522
538
|
*/
|
|
523
539
|
export declare function nativeEnum<T extends util.EnumLike>(entries: T, params?: string | core.$ZodEnumParams): ZodEnum<T>;
|
|
524
540
|
export interface ZodLiteral<T extends util.Literal = util.Literal> extends _ZodType<core.$ZodLiteralInternals<T>>, core.$ZodLiteral<T> {
|
|
541
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
525
542
|
values: Set<T>;
|
|
526
543
|
/** @legacy Use `.values` instead. Accessing this property will throw an error if the literal accepts multiple values. */
|
|
527
544
|
value: T;
|
|
@@ -530,6 +547,7 @@ export declare const ZodLiteral: core.$constructor<ZodLiteral>;
|
|
|
530
547
|
export declare function literal<const T extends ReadonlyArray<util.Literal>>(value: T, params?: string | core.$ZodLiteralParams): ZodLiteral<T[number]>;
|
|
531
548
|
export declare function literal<const T extends util.Literal>(value: T, params?: string | core.$ZodLiteralParams): ZodLiteral<T>;
|
|
532
549
|
export interface ZodFile extends _ZodType<core.$ZodFileInternals>, core.$ZodFile {
|
|
550
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
533
551
|
min(size: number, params?: string | core.$ZodCheckMinSizeParams): this;
|
|
534
552
|
max(size: number, params?: string | core.$ZodCheckMaxSizeParams): this;
|
|
535
553
|
mime(types: util.MimeTypes | Array<util.MimeTypes>, params?: string | core.$ZodCheckMimeTypeParams): this;
|
|
@@ -537,21 +555,25 @@ export interface ZodFile extends _ZodType<core.$ZodFileInternals>, core.$ZodFile
|
|
|
537
555
|
export declare const ZodFile: core.$constructor<ZodFile>;
|
|
538
556
|
export declare function file(params?: string | core.$ZodFileParams): ZodFile;
|
|
539
557
|
export interface ZodTransform<O = unknown, I = unknown> extends _ZodType<core.$ZodTransformInternals<O, I>>, core.$ZodTransform<O, I> {
|
|
558
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
540
559
|
}
|
|
541
560
|
export declare const ZodTransform: core.$constructor<ZodTransform>;
|
|
542
561
|
export declare function transform<I = unknown, O = I>(fn: (input: I, ctx: core.ParsePayload) => O): ZodTransform<Awaited<O>, I>;
|
|
543
562
|
export interface ZodOptional<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodOptionalInternals<T>>, core.$ZodOptional<T> {
|
|
563
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
544
564
|
unwrap(): T;
|
|
545
565
|
}
|
|
546
566
|
export declare const ZodOptional: core.$constructor<ZodOptional>;
|
|
547
567
|
export declare function optional<T extends core.SomeType>(innerType: T): ZodOptional<T>;
|
|
548
568
|
export interface ZodNullable<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodNullableInternals<T>>, core.$ZodNullable<T> {
|
|
569
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
549
570
|
unwrap(): T;
|
|
550
571
|
}
|
|
551
572
|
export declare const ZodNullable: core.$constructor<ZodNullable>;
|
|
552
573
|
export declare function nullable<T extends core.SomeType>(innerType: T): ZodNullable<T>;
|
|
553
574
|
export declare function nullish<T extends core.SomeType>(innerType: T): ZodOptional<ZodNullable<T>>;
|
|
554
575
|
export interface ZodDefault<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodDefaultInternals<T>>, core.$ZodDefault<T> {
|
|
576
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
555
577
|
unwrap(): T;
|
|
556
578
|
/** @deprecated Use `.unwrap()` instead. */
|
|
557
579
|
removeDefault(): T;
|
|
@@ -559,21 +581,25 @@ export interface ZodDefault<T extends core.SomeType = core.$ZodType> extends _Zo
|
|
|
559
581
|
export declare const ZodDefault: core.$constructor<ZodDefault>;
|
|
560
582
|
export declare function _default<T extends core.SomeType>(innerType: T, defaultValue: util.NoUndefined<core.output<T>> | (() => util.NoUndefined<core.output<T>>)): ZodDefault<T>;
|
|
561
583
|
export interface ZodPrefault<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodPrefaultInternals<T>>, core.$ZodPrefault<T> {
|
|
584
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
562
585
|
unwrap(): T;
|
|
563
586
|
}
|
|
564
587
|
export declare const ZodPrefault: core.$constructor<ZodPrefault>;
|
|
565
588
|
export declare function prefault<T extends core.SomeType>(innerType: T, defaultValue: core.input<T> | (() => core.input<T>)): ZodPrefault<T>;
|
|
566
589
|
export interface ZodNonOptional<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodNonOptionalInternals<T>>, core.$ZodNonOptional<T> {
|
|
590
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
567
591
|
unwrap(): T;
|
|
568
592
|
}
|
|
569
593
|
export declare const ZodNonOptional: core.$constructor<ZodNonOptional>;
|
|
570
594
|
export declare function nonoptional<T extends core.SomeType>(innerType: T, params?: string | core.$ZodNonOptionalParams): ZodNonOptional<T>;
|
|
571
595
|
export interface ZodSuccess<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodSuccessInternals<T>>, core.$ZodSuccess<T> {
|
|
596
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
572
597
|
unwrap(): T;
|
|
573
598
|
}
|
|
574
599
|
export declare const ZodSuccess: core.$constructor<ZodSuccess>;
|
|
575
600
|
export declare function success<T extends core.SomeType>(innerType: T): ZodSuccess<T>;
|
|
576
601
|
export interface ZodCatch<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodCatchInternals<T>>, core.$ZodCatch<T> {
|
|
602
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
577
603
|
unwrap(): T;
|
|
578
604
|
/** @deprecated Use `.unwrap()` instead. */
|
|
579
605
|
removeCatch(): T;
|
|
@@ -582,16 +608,19 @@ export declare const ZodCatch: core.$constructor<ZodCatch>;
|
|
|
582
608
|
declare function _catch<T extends core.SomeType>(innerType: T, catchValue: core.output<T> | ((ctx: core.$ZodCatchCtx) => core.output<T>)): ZodCatch<T>;
|
|
583
609
|
export { _catch as catch };
|
|
584
610
|
export interface ZodNaN extends _ZodType<core.$ZodNaNInternals>, core.$ZodNaN {
|
|
611
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
585
612
|
}
|
|
586
613
|
export declare const ZodNaN: core.$constructor<ZodNaN>;
|
|
587
614
|
export declare function nan(params?: string | core.$ZodNaNParams): ZodNaN;
|
|
588
615
|
export interface ZodPipe<A extends core.SomeType = core.$ZodType, B extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodPipeInternals<A, B>>, core.$ZodPipe<A, B> {
|
|
616
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
589
617
|
in: A;
|
|
590
618
|
out: B;
|
|
591
619
|
}
|
|
592
620
|
export declare const ZodPipe: core.$constructor<ZodPipe>;
|
|
593
621
|
export declare function pipe<const A extends core.SomeType, B extends core.$ZodType<unknown, core.output<A>> = core.$ZodType<unknown, core.output<A>>>(in_: A, out: B | core.$ZodType<unknown, core.output<A>>): ZodPipe<A, B>;
|
|
594
622
|
export interface ZodCodec<A extends core.SomeType = core.$ZodType, B extends core.SomeType = core.$ZodType> extends ZodPipe<A, B>, core.$ZodCodec<A, B> {
|
|
623
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
595
624
|
_zod: core.$ZodCodecInternals<A, B>;
|
|
596
625
|
def: core.$ZodCodecDef<A, B>;
|
|
597
626
|
}
|
|
@@ -601,25 +630,30 @@ export declare function codec<const A extends core.SomeType, B extends core.Some
|
|
|
601
630
|
encode: (value: core.input<B>, payload: core.ParsePayload<core.input<B>>) => core.util.MaybeAsync<core.output<A>>;
|
|
602
631
|
}): ZodCodec<A, B>;
|
|
603
632
|
export interface ZodReadonly<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodReadonlyInternals<T>>, core.$ZodReadonly<T> {
|
|
633
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
604
634
|
unwrap(): T;
|
|
605
635
|
}
|
|
606
636
|
export declare const ZodReadonly: core.$constructor<ZodReadonly>;
|
|
607
637
|
export declare function readonly<T extends core.SomeType>(innerType: T): ZodReadonly<T>;
|
|
608
638
|
export interface ZodTemplateLiteral<Template extends string = string> extends _ZodType<core.$ZodTemplateLiteralInternals<Template>>, core.$ZodTemplateLiteral<Template> {
|
|
639
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
609
640
|
}
|
|
610
641
|
export declare const ZodTemplateLiteral: core.$constructor<ZodTemplateLiteral>;
|
|
611
642
|
export declare function templateLiteral<const Parts extends core.$ZodTemplateLiteralPart[]>(parts: Parts, params?: string | core.$ZodTemplateLiteralParams): ZodTemplateLiteral<core.$PartsToTemplateLiteral<Parts>>;
|
|
612
643
|
export interface ZodLazy<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodLazyInternals<T>>, core.$ZodLazy<T> {
|
|
644
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
613
645
|
unwrap(): T;
|
|
614
646
|
}
|
|
615
647
|
export declare const ZodLazy: core.$constructor<ZodLazy>;
|
|
616
648
|
export declare function lazy<T extends core.SomeType>(getter: () => T): ZodLazy<T>;
|
|
617
649
|
export interface ZodPromise<T extends core.SomeType = core.$ZodType> extends _ZodType<core.$ZodPromiseInternals<T>>, core.$ZodPromise<T> {
|
|
650
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
618
651
|
unwrap(): T;
|
|
619
652
|
}
|
|
620
653
|
export declare const ZodPromise: core.$constructor<ZodPromise>;
|
|
621
654
|
export declare function promise<T extends core.SomeType>(innerType: T): ZodPromise<T>;
|
|
622
655
|
export interface ZodFunction<Args extends core.$ZodFunctionIn = core.$ZodFunctionIn, Returns extends core.$ZodFunctionOut = core.$ZodFunctionOut> extends _ZodType<core.$ZodFunctionInternals<Args, Returns>>, core.$ZodFunction<Args, Returns> {
|
|
656
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
623
657
|
_def: core.$ZodFunctionDef<Args, Returns>;
|
|
624
658
|
_input: core.$InferInnerFunctionType<Args, Returns>;
|
|
625
659
|
_output: core.$InferOuterFunctionType<Args, Returns>;
|
|
@@ -649,6 +683,7 @@ export declare function _function<In extends core.$ZodFunctionIn = core.$ZodFunc
|
|
|
649
683
|
}): ZodFunction<In, Out>;
|
|
650
684
|
export { _function as function };
|
|
651
685
|
export interface ZodCustom<O = unknown, I = unknown> extends _ZodType<core.$ZodCustomInternals<O, I>>, core.$ZodCustom<O, I> {
|
|
686
|
+
"~standard": ZodStandardSchemaWithJSON<this>;
|
|
652
687
|
}
|
|
653
688
|
export declare const ZodCustom: core.$constructor<ZodCustom>;
|
|
654
689
|
export declare function check<O = unknown>(fn: core.CheckFn<O>): core.$ZodCheck<O>;
|