zod 4.1.12 → 4.1.13
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/checks.ts +1 -0
- package/src/v4/classic/schemas.ts +20 -0
- package/src/v4/classic/tests/continuability.test.ts +22 -0
- package/src/v4/classic/tests/describe-meta-checks.test.ts +27 -0
- package/src/v4/classic/tests/index.test.ts +55 -1
- package/src/v4/classic/tests/promise.test.ts +1 -1
- package/src/v4/classic/tests/readonly.test.ts +1 -1
- package/src/v4/classic/tests/record.test.ts +141 -9
- package/src/v4/classic/tests/registries.test.ts +5 -1
- package/src/v4/classic/tests/string.test.ts +72 -0
- package/src/v4/classic/tests/template-literal.test.ts +8 -0
- package/src/v4/classic/tests/to-json-schema.test.ts +97 -0
- package/src/v4/classic/tests/tuple.test.ts +18 -0
- package/src/v4/classic/tests/url.test.ts +13 -0
- package/src/v4/core/api.ts +45 -0
- package/src/v4/core/core.ts +22 -9
- package/src/v4/core/regexes.ts +6 -1
- package/src/v4/core/registries.ts +12 -1
- package/src/v4/core/schemas.ts +50 -33
- package/src/v4/core/tests/extend.test.ts +42 -1
- package/src/v4/core/tests/locales/he.test.ts +379 -0
- package/src/v4/core/tests/locales/nl.test.ts +46 -0
- package/src/v4/core/tests/record-constructor.test.ts +67 -0
- package/src/v4/core/tests/recursive-tuples.test.ts +45 -0
- package/src/v4/core/to-json-schema.ts +55 -91
- package/src/v4/core/util.ts +11 -0
- package/src/v4/core/versions.ts +1 -1
- package/src/v4/locales/en.ts +1 -0
- package/src/v4/locales/he.ts +202 -71
- package/src/v4/locales/nl.ts +10 -10
- package/src/v4/mini/iso.ts +4 -4
- package/src/v4/mini/schemas.ts +17 -0
- package/src/v4/mini/tests/functions.test.ts +0 -38
- package/src/v4/mini/tests/index.test.ts +24 -1
- package/src/v4/mini/tests/string.test.ts +32 -0
- package/v3/ZodError.d.cts +1 -1
- package/v3/ZodError.d.ts +1 -1
- 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 +15 -2
- package/v4/classic/schemas.d.cts +8 -0
- package/v4/classic/schemas.d.ts +8 -0
- package/v4/classic/schemas.js +12 -0
- package/v4/core/api.cjs +40 -0
- package/v4/core/api.d.cts +7 -0
- package/v4/core/api.d.ts +7 -0
- package/v4/core/api.js +36 -0
- package/v4/core/core.cjs +20 -11
- package/v4/core/core.js +20 -11
- package/v4/core/regexes.cjs +31 -2
- package/v4/core/regexes.d.cts +1 -0
- package/v4/core/regexes.d.ts +1 -0
- package/v4/core/regexes.js +5 -0
- package/v4/core/registries.cjs +3 -1
- package/v4/core/registries.js +3 -1
- package/v4/core/schemas.cjs +32 -33
- package/v4/core/schemas.d.cts +12 -2
- package/v4/core/schemas.d.ts +12 -2
- package/v4/core/schemas.js +30 -31
- package/v4/core/to-json-schema.cjs +55 -92
- package/v4/core/to-json-schema.js +55 -92
- package/v4/core/util.cjs +11 -0
- package/v4/core/util.d.cts +1 -0
- package/v4/core/util.d.ts +1 -0
- package/v4/core/util.js +10 -0
- package/v4/core/versions.cjs +1 -1
- package/v4/core/versions.js +1 -1
- package/v4/locales/en.cjs +1 -0
- package/v4/locales/en.js +1 -0
- package/v4/locales/he.cjs +177 -66
- package/v4/locales/he.js +177 -66
- package/v4/locales/nl.cjs +8 -8
- package/v4/locales/nl.js +8 -8
- package/v4/mini/iso.cjs +4 -4
- package/v4/mini/iso.js +4 -4
- package/v4/mini/schemas.cjs +13 -2
- package/v4/mini/schemas.d.cts +6 -0
- package/v4/mini/schemas.d.ts +6 -0
- package/v4/mini/schemas.js +10 -0
package/v4/locales/nl.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as util from "../core/util.js";
|
|
2
2
|
const error = () => {
|
|
3
3
|
const Sizable = {
|
|
4
|
-
string: { unit: "tekens" },
|
|
5
|
-
file: { unit: "bytes" },
|
|
6
|
-
array: { unit: "elementen" },
|
|
7
|
-
set: { unit: "elementen" },
|
|
4
|
+
string: { unit: "tekens", verb: "te hebben" },
|
|
5
|
+
file: { unit: "bytes", verb: "te hebben" },
|
|
6
|
+
array: { unit: "elementen", verb: "te hebben" },
|
|
7
|
+
set: { unit: "elementen", verb: "te hebben" },
|
|
8
8
|
};
|
|
9
9
|
function getSizing(origin) {
|
|
10
10
|
return Sizable[origin] ?? null;
|
|
@@ -71,16 +71,16 @@ const error = () => {
|
|
|
71
71
|
const adj = issue.inclusive ? "<=" : "<";
|
|
72
72
|
const sizing = getSizing(issue.origin);
|
|
73
73
|
if (sizing)
|
|
74
|
-
return `Te
|
|
75
|
-
return `Te
|
|
74
|
+
return `Te groot: verwacht dat ${issue.origin ?? "waarde"} ${sizing.verb} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementen"}`;
|
|
75
|
+
return `Te groot: verwacht dat ${issue.origin ?? "waarde"} ${adj}${issue.maximum.toString()} is`;
|
|
76
76
|
}
|
|
77
77
|
case "too_small": {
|
|
78
78
|
const adj = issue.inclusive ? ">=" : ">";
|
|
79
79
|
const sizing = getSizing(issue.origin);
|
|
80
80
|
if (sizing) {
|
|
81
|
-
return `Te
|
|
81
|
+
return `Te klein: verwacht dat ${issue.origin} ${sizing.verb} ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
82
82
|
}
|
|
83
|
-
return `Te
|
|
83
|
+
return `Te klein: verwacht dat ${issue.origin} ${adj}${issue.minimum.toString()} is`;
|
|
84
84
|
}
|
|
85
85
|
case "invalid_format": {
|
|
86
86
|
const _issue = issue;
|
package/v4/mini/iso.cjs
CHANGED
|
@@ -30,28 +30,28 @@ exports.time = time;
|
|
|
30
30
|
exports.duration = duration;
|
|
31
31
|
const core = __importStar(require("../core/index.cjs"));
|
|
32
32
|
const schemas = __importStar(require("./schemas.cjs"));
|
|
33
|
-
exports.ZodMiniISODateTime = core.$constructor("
|
|
33
|
+
exports.ZodMiniISODateTime = core.$constructor("ZodMiniISODateTime", (inst, def) => {
|
|
34
34
|
core.$ZodISODateTime.init(inst, def);
|
|
35
35
|
schemas.ZodMiniStringFormat.init(inst, def);
|
|
36
36
|
});
|
|
37
37
|
function datetime(params) {
|
|
38
38
|
return core._isoDateTime(exports.ZodMiniISODateTime, params);
|
|
39
39
|
}
|
|
40
|
-
exports.ZodMiniISODate = core.$constructor("
|
|
40
|
+
exports.ZodMiniISODate = core.$constructor("ZodMiniISODate", (inst, def) => {
|
|
41
41
|
core.$ZodISODate.init(inst, def);
|
|
42
42
|
schemas.ZodMiniStringFormat.init(inst, def);
|
|
43
43
|
});
|
|
44
44
|
function date(params) {
|
|
45
45
|
return core._isoDate(exports.ZodMiniISODate, params);
|
|
46
46
|
}
|
|
47
|
-
exports.ZodMiniISOTime = core.$constructor("
|
|
47
|
+
exports.ZodMiniISOTime = core.$constructor("ZodMiniISOTime", (inst, def) => {
|
|
48
48
|
core.$ZodISOTime.init(inst, def);
|
|
49
49
|
schemas.ZodMiniStringFormat.init(inst, def);
|
|
50
50
|
});
|
|
51
51
|
function time(params) {
|
|
52
52
|
return core._isoTime(exports.ZodMiniISOTime, params);
|
|
53
53
|
}
|
|
54
|
-
exports.ZodMiniISODuration = core.$constructor("
|
|
54
|
+
exports.ZodMiniISODuration = core.$constructor("ZodMiniISODuration", (inst, def) => {
|
|
55
55
|
core.$ZodISODuration.init(inst, def);
|
|
56
56
|
schemas.ZodMiniStringFormat.init(inst, def);
|
|
57
57
|
});
|
package/v4/mini/iso.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import * as core from "../core/index.js";
|
|
2
2
|
import * as schemas from "./schemas.js";
|
|
3
|
-
export const ZodMiniISODateTime = /*@__PURE__*/ core.$constructor("
|
|
3
|
+
export const ZodMiniISODateTime = /*@__PURE__*/ core.$constructor("ZodMiniISODateTime", (inst, def) => {
|
|
4
4
|
core.$ZodISODateTime.init(inst, def);
|
|
5
5
|
schemas.ZodMiniStringFormat.init(inst, def);
|
|
6
6
|
});
|
|
7
7
|
export function datetime(params) {
|
|
8
8
|
return core._isoDateTime(ZodMiniISODateTime, params);
|
|
9
9
|
}
|
|
10
|
-
export const ZodMiniISODate = /*@__PURE__*/ core.$constructor("
|
|
10
|
+
export const ZodMiniISODate = /*@__PURE__*/ core.$constructor("ZodMiniISODate", (inst, def) => {
|
|
11
11
|
core.$ZodISODate.init(inst, def);
|
|
12
12
|
schemas.ZodMiniStringFormat.init(inst, def);
|
|
13
13
|
});
|
|
14
14
|
export function date(params) {
|
|
15
15
|
return core._isoDate(ZodMiniISODate, params);
|
|
16
16
|
}
|
|
17
|
-
export const ZodMiniISOTime = /*@__PURE__*/ core.$constructor("
|
|
17
|
+
export const ZodMiniISOTime = /*@__PURE__*/ core.$constructor("ZodMiniISOTime", (inst, def) => {
|
|
18
18
|
core.$ZodISOTime.init(inst, def);
|
|
19
19
|
schemas.ZodMiniStringFormat.init(inst, def);
|
|
20
20
|
});
|
|
21
21
|
export function time(params) {
|
|
22
22
|
return core._isoTime(ZodMiniISOTime, params);
|
|
23
23
|
}
|
|
24
|
-
export const ZodMiniISODuration = /*@__PURE__*/ core.$constructor("
|
|
24
|
+
export const ZodMiniISODuration = /*@__PURE__*/ core.$constructor("ZodMiniISODuration", (inst, def) => {
|
|
25
25
|
core.$ZodISODuration.init(inst, def);
|
|
26
26
|
schemas.ZodMiniStringFormat.init(inst, def);
|
|
27
27
|
});
|
package/v4/mini/schemas.cjs
CHANGED
|
@@ -23,8 +23,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
27
|
-
exports.ZodMiniFunction = exports.stringbool = 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 = void 0;
|
|
26
|
+
exports.ZodMiniTransform = exports.ZodMiniFile = exports.ZodMiniLiteral = exports.ZodMiniEnum = exports.ZodMiniSet = exports.ZodMiniMap = exports.ZodMiniRecord = exports.ZodMiniTuple = exports.ZodMiniIntersection = exports.ZodMiniDiscriminatedUnion = 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.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.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.ZodMiniOptional = void 0;
|
|
28
28
|
exports.string = string;
|
|
29
29
|
exports.email = email;
|
|
30
30
|
exports.guid = guid;
|
|
@@ -45,6 +45,7 @@ exports.ipv4 = ipv4;
|
|
|
45
45
|
exports.ipv6 = ipv6;
|
|
46
46
|
exports.cidrv4 = cidrv4;
|
|
47
47
|
exports.cidrv6 = cidrv6;
|
|
48
|
+
exports.mac = mac;
|
|
48
49
|
exports.base64 = base64;
|
|
49
50
|
exports.base64url = base64url;
|
|
50
51
|
exports.e164 = e164;
|
|
@@ -287,6 +288,13 @@ exports.ZodMiniCIDRv6 = core.$constructor("ZodMiniCIDRv6", (inst, def) => {
|
|
|
287
288
|
function cidrv6(params) {
|
|
288
289
|
return core._cidrv6(exports.ZodMiniCIDRv6, params);
|
|
289
290
|
}
|
|
291
|
+
exports.ZodMiniMAC = core.$constructor("ZodMiniMAC", (inst, def) => {
|
|
292
|
+
core.$ZodMAC.init(inst, def);
|
|
293
|
+
exports.ZodMiniStringFormat.init(inst, def);
|
|
294
|
+
});
|
|
295
|
+
function mac(params) {
|
|
296
|
+
return core._mac(exports.ZodMiniMAC, params);
|
|
297
|
+
}
|
|
290
298
|
exports.ZodMiniBase64 = core.$constructor("ZodMiniBase64", (inst, def) => {
|
|
291
299
|
core.$ZodBase64.init(inst, def);
|
|
292
300
|
exports.ZodMiniStringFormat.init(inst, def);
|
|
@@ -855,6 +863,9 @@ function refine(fn, _params = {}) {
|
|
|
855
863
|
function superRefine(fn) {
|
|
856
864
|
return core._superRefine(fn);
|
|
857
865
|
}
|
|
866
|
+
// Re-export describe and meta from core
|
|
867
|
+
exports.describe = core.describe;
|
|
868
|
+
exports.meta = core.meta;
|
|
858
869
|
// instanceof
|
|
859
870
|
class Class {
|
|
860
871
|
constructor(..._args) { }
|
package/v4/mini/schemas.d.cts
CHANGED
|
@@ -92,6 +92,10 @@ export interface ZodMiniCIDRv6 extends _ZodMiniString<core.$ZodCIDRv6Internals>
|
|
|
92
92
|
}
|
|
93
93
|
export declare const ZodMiniCIDRv6: core.$constructor<ZodMiniCIDRv6>;
|
|
94
94
|
export declare function cidrv6(params?: string | core.$ZodCIDRv6Params): ZodMiniCIDRv6;
|
|
95
|
+
export interface ZodMiniMAC extends _ZodMiniString<core.$ZodMACInternals> {
|
|
96
|
+
}
|
|
97
|
+
export declare const ZodMiniMAC: core.$constructor<ZodMiniMAC>;
|
|
98
|
+
export declare function mac(params?: string | core.$ZodMACParams): ZodMiniMAC;
|
|
95
99
|
export interface ZodMiniBase64 extends _ZodMiniString<core.$ZodBase64Internals> {
|
|
96
100
|
}
|
|
97
101
|
export declare const ZodMiniBase64: core.$constructor<ZodMiniBase64>;
|
|
@@ -353,6 +357,8 @@ export declare function check<O = unknown>(fn: core.CheckFn<O>, params?: string
|
|
|
353
357
|
export declare function custom<O = unknown, I = O>(fn?: (data: O) => unknown, _params?: string | core.$ZodCustomParams | undefined): ZodMiniCustom<O, I>;
|
|
354
358
|
export declare function refine<T>(fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>, _params?: string | core.$ZodCustomParams): core.$ZodCheck<T>;
|
|
355
359
|
export declare function superRefine<T>(fn: (arg: T, payload: core.$RefinementCtx<T>) => void | Promise<void>): core.$ZodCheck<T>;
|
|
360
|
+
export declare const describe: typeof core.describe;
|
|
361
|
+
export declare const meta: typeof core.meta;
|
|
356
362
|
declare abstract class Class {
|
|
357
363
|
constructor(..._args: any[]);
|
|
358
364
|
}
|
package/v4/mini/schemas.d.ts
CHANGED
|
@@ -92,6 +92,10 @@ export interface ZodMiniCIDRv6 extends _ZodMiniString<core.$ZodCIDRv6Internals>
|
|
|
92
92
|
}
|
|
93
93
|
export declare const ZodMiniCIDRv6: core.$constructor<ZodMiniCIDRv6>;
|
|
94
94
|
export declare function cidrv6(params?: string | core.$ZodCIDRv6Params): ZodMiniCIDRv6;
|
|
95
|
+
export interface ZodMiniMAC extends _ZodMiniString<core.$ZodMACInternals> {
|
|
96
|
+
}
|
|
97
|
+
export declare const ZodMiniMAC: core.$constructor<ZodMiniMAC>;
|
|
98
|
+
export declare function mac(params?: string | core.$ZodMACParams): ZodMiniMAC;
|
|
95
99
|
export interface ZodMiniBase64 extends _ZodMiniString<core.$ZodBase64Internals> {
|
|
96
100
|
}
|
|
97
101
|
export declare const ZodMiniBase64: core.$constructor<ZodMiniBase64>;
|
|
@@ -353,6 +357,8 @@ export declare function check<O = unknown>(fn: core.CheckFn<O>, params?: string
|
|
|
353
357
|
export declare function custom<O = unknown, I = O>(fn?: (data: O) => unknown, _params?: string | core.$ZodCustomParams | undefined): ZodMiniCustom<O, I>;
|
|
354
358
|
export declare function refine<T>(fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>, _params?: string | core.$ZodCustomParams): core.$ZodCheck<T>;
|
|
355
359
|
export declare function superRefine<T>(fn: (arg: T, payload: core.$RefinementCtx<T>) => void | Promise<void>): core.$ZodCheck<T>;
|
|
360
|
+
export declare const describe: typeof core.describe;
|
|
361
|
+
export declare const meta: typeof core.meta;
|
|
356
362
|
declare abstract class Class {
|
|
357
363
|
constructor(..._args: any[]);
|
|
358
364
|
}
|
package/v4/mini/schemas.js
CHANGED
|
@@ -163,6 +163,13 @@ export const ZodMiniCIDRv6 = /*@__PURE__*/ core.$constructor("ZodMiniCIDRv6", (i
|
|
|
163
163
|
export function cidrv6(params) {
|
|
164
164
|
return core._cidrv6(ZodMiniCIDRv6, params);
|
|
165
165
|
}
|
|
166
|
+
export const ZodMiniMAC = /*@__PURE__*/ core.$constructor("ZodMiniMAC", (inst, def) => {
|
|
167
|
+
core.$ZodMAC.init(inst, def);
|
|
168
|
+
ZodMiniStringFormat.init(inst, def);
|
|
169
|
+
});
|
|
170
|
+
export function mac(params) {
|
|
171
|
+
return core._mac(ZodMiniMAC, params);
|
|
172
|
+
}
|
|
166
173
|
export const ZodMiniBase64 = /*@__PURE__*/ core.$constructor("ZodMiniBase64", (inst, def) => {
|
|
167
174
|
core.$ZodBase64.init(inst, def);
|
|
168
175
|
ZodMiniStringFormat.init(inst, def);
|
|
@@ -737,6 +744,9 @@ export function refine(fn, _params = {}) {
|
|
|
737
744
|
export function superRefine(fn) {
|
|
738
745
|
return core._superRefine(fn);
|
|
739
746
|
}
|
|
747
|
+
// Re-export describe and meta from core
|
|
748
|
+
export const describe = core.describe;
|
|
749
|
+
export const meta = core.meta;
|
|
740
750
|
// instanceof
|
|
741
751
|
class Class {
|
|
742
752
|
constructor(..._args) { }
|