zod 4.0.10 → 4.0.12
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 +11 -8
- package/src/v4/classic/checks.ts +1 -0
- package/src/v4/classic/schemas.ts +12 -28
- package/src/v4/classic/tests/datetime.test.ts +6 -0
- package/src/v4/classic/tests/number.test.ts +23 -0
- package/src/v4/classic/tests/recursive-types.test.ts +39 -0
- package/src/v4/classic/tests/string.test.ts +38 -0
- package/src/v4/classic/tests/tuple.test.ts +2 -2
- package/src/v4/core/api.ts +51 -7
- package/src/v4/core/checks.ts +2 -0
- package/src/v4/core/errors.ts +26 -23
- package/src/v4/core/regexes.ts +7 -4
- package/src/v4/core/schemas.ts +41 -4
- package/src/v4/core/util.ts +11 -1
- package/src/v4/core/versions.ts +1 -1
- package/src/v4/locales/index.ts +1 -0
- package/src/v4/locales/yo.ts +131 -0
- package/src/v4/mini/schemas.ts +11 -0
- package/v3/locales/en.cjs +1 -0
- package/v3/locales/en.d.cts +1 -1
- package/v4/classic/checks.d.cts +1 -1
- package/v4/classic/checks.d.ts +1 -1
- package/v4/classic/schemas.cjs +5 -20
- package/v4/classic/schemas.d.cts +5 -7
- package/v4/classic/schemas.d.ts +5 -7
- package/v4/classic/schemas.js +4 -20
- package/v4/core/api.cjs +33 -7
- package/v4/core/api.d.cts +12 -0
- package/v4/core/api.d.ts +12 -0
- package/v4/core/api.js +31 -7
- package/v4/core/checks.cjs +2 -0
- package/v4/core/checks.js +2 -0
- package/v4/core/errors.d.cts +17 -16
- package/v4/core/errors.d.ts +17 -16
- package/v4/core/regexes.cjs +6 -5
- package/v4/core/regexes.d.cts +1 -0
- package/v4/core/regexes.d.ts +1 -0
- package/v4/core/regexes.js +5 -4
- package/v4/core/schemas.cjs +8 -3
- package/v4/core/schemas.d.cts +3 -1
- package/v4/core/schemas.d.ts +3 -1
- package/v4/core/schemas.js +8 -3
- package/v4/core/util.cjs +9 -1
- package/v4/core/util.js +9 -1
- package/v4/core/versions.cjs +1 -1
- package/v4/core/versions.js +1 -1
- package/v4/locales/ar.cjs +1 -0
- package/v4/locales/ar.d.cts +2 -1
- package/v4/locales/az.cjs +1 -0
- package/v4/locales/az.d.cts +2 -1
- package/v4/locales/be.cjs +1 -0
- package/v4/locales/be.d.cts +2 -1
- package/v4/locales/ca.cjs +1 -0
- package/v4/locales/ca.d.cts +2 -1
- package/v4/locales/cs.cjs +1 -0
- package/v4/locales/cs.d.cts +2 -1
- package/v4/locales/da.cjs +1 -0
- package/v4/locales/da.d.cts +2 -1
- package/v4/locales/de.cjs +1 -0
- package/v4/locales/de.d.cts +2 -1
- package/v4/locales/es.cjs +1 -0
- package/v4/locales/es.d.cts +2 -1
- package/v4/locales/fa.cjs +1 -0
- package/v4/locales/fa.d.cts +2 -1
- package/v4/locales/fi.cjs +1 -0
- package/v4/locales/fi.d.cts +2 -1
- package/v4/locales/fr-CA.cjs +1 -0
- package/v4/locales/fr-CA.d.cts +2 -1
- package/v4/locales/fr.cjs +1 -0
- package/v4/locales/fr.d.cts +2 -1
- package/v4/locales/he.cjs +1 -0
- package/v4/locales/he.d.cts +2 -1
- package/v4/locales/hu.cjs +1 -0
- package/v4/locales/hu.d.cts +2 -1
- package/v4/locales/id.cjs +1 -0
- package/v4/locales/id.d.cts +2 -1
- package/v4/locales/index.cjs +3 -1
- package/v4/locales/index.d.cts +1 -0
- package/v4/locales/index.d.ts +1 -0
- package/v4/locales/index.js +1 -0
- package/v4/locales/it.cjs +1 -0
- package/v4/locales/it.d.cts +2 -1
- package/v4/locales/ja.cjs +1 -0
- package/v4/locales/ja.d.cts +2 -1
- package/v4/locales/kh.cjs +1 -0
- package/v4/locales/kh.d.cts +2 -1
- package/v4/locales/ko.cjs +1 -0
- package/v4/locales/ko.d.cts +2 -1
- package/v4/locales/mk.cjs +1 -0
- package/v4/locales/mk.d.cts +2 -1
- package/v4/locales/ms.cjs +1 -0
- package/v4/locales/ms.d.cts +2 -1
- package/v4/locales/nl.cjs +1 -0
- package/v4/locales/nl.d.cts +2 -1
- package/v4/locales/no.cjs +1 -0
- package/v4/locales/no.d.cts +2 -1
- package/v4/locales/ota.cjs +1 -0
- package/v4/locales/ota.d.cts +2 -1
- package/v4/locales/pl.cjs +1 -0
- package/v4/locales/pl.d.cts +2 -1
- package/v4/locales/ps.cjs +1 -0
- package/v4/locales/ps.d.cts +2 -1
- package/v4/locales/pt.cjs +1 -0
- package/v4/locales/pt.d.cts +2 -1
- package/v4/locales/ru.cjs +1 -0
- package/v4/locales/ru.d.cts +2 -1
- package/v4/locales/sl.cjs +1 -0
- package/v4/locales/sl.d.cts +2 -1
- package/v4/locales/sv.cjs +1 -0
- package/v4/locales/sv.d.cts +2 -1
- package/v4/locales/ta.cjs +1 -0
- package/v4/locales/ta.d.cts +2 -1
- package/v4/locales/th.cjs +1 -0
- package/v4/locales/th.d.cts +2 -1
- package/v4/locales/ua.cjs +1 -0
- package/v4/locales/ua.d.cts +2 -1
- package/v4/locales/ur.cjs +1 -0
- package/v4/locales/ur.d.cts +2 -1
- package/v4/locales/vi.cjs +1 -0
- package/v4/locales/vi.d.cts +2 -1
- package/v4/locales/yo.cjs +142 -0
- package/v4/locales/yo.d.cts +5 -0
- package/v4/locales/yo.d.ts +4 -0
- package/v4/locales/yo.js +115 -0
- package/v4/locales/zh-CN.cjs +1 -0
- package/v4/locales/zh-CN.d.cts +2 -1
- package/v4/locales/zh-TW.cjs +1 -0
- package/v4/locales/zh-TW.d.cts +2 -1
- package/v4/mini/schemas.cjs +9 -0
- package/v4/mini/schemas.d.cts +2 -0
- package/v4/mini/schemas.d.ts +2 -0
- package/v4/mini/schemas.js +7 -0
package/v4/locales/ur.d.cts
CHANGED
package/v4/locales/vi.cjs
CHANGED
package/v4/locales/vi.d.cts
CHANGED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.default = default_1;
|
|
27
|
+
const util = __importStar(require("../core/util.cjs"));
|
|
28
|
+
const error = () => {
|
|
29
|
+
const Sizable = {
|
|
30
|
+
string: { unit: "àmi", verb: "ní" },
|
|
31
|
+
file: { unit: "bytes", verb: "ní" },
|
|
32
|
+
array: { unit: "nkan", verb: "ní" },
|
|
33
|
+
set: { unit: "nkan", verb: "ní" },
|
|
34
|
+
};
|
|
35
|
+
function getSizing(origin) {
|
|
36
|
+
return Sizable[origin] ?? null;
|
|
37
|
+
}
|
|
38
|
+
const parsedType = (data) => {
|
|
39
|
+
const t = typeof data;
|
|
40
|
+
switch (t) {
|
|
41
|
+
case "number": {
|
|
42
|
+
return Number.isNaN(data) ? "NaN" : "nọ́mbà";
|
|
43
|
+
}
|
|
44
|
+
case "object": {
|
|
45
|
+
if (Array.isArray(data)) {
|
|
46
|
+
return "akopọ";
|
|
47
|
+
}
|
|
48
|
+
if (data === null) {
|
|
49
|
+
return "null";
|
|
50
|
+
}
|
|
51
|
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
|
52
|
+
return data.constructor.name;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return t;
|
|
57
|
+
};
|
|
58
|
+
const Nouns = {
|
|
59
|
+
regex: "ẹ̀rọ ìbáwọlé",
|
|
60
|
+
email: "àdírẹ́sì ìmẹ́lì",
|
|
61
|
+
url: "URL",
|
|
62
|
+
emoji: "emoji",
|
|
63
|
+
uuid: "UUID",
|
|
64
|
+
uuidv4: "UUIDv4",
|
|
65
|
+
uuidv6: "UUIDv6",
|
|
66
|
+
nanoid: "nanoid",
|
|
67
|
+
guid: "GUID",
|
|
68
|
+
cuid: "cuid",
|
|
69
|
+
cuid2: "cuid2",
|
|
70
|
+
ulid: "ULID",
|
|
71
|
+
xid: "XID",
|
|
72
|
+
ksuid: "KSUID",
|
|
73
|
+
datetime: "àkókò ISO",
|
|
74
|
+
date: "ọjọ́ ISO",
|
|
75
|
+
time: "àkókò ISO",
|
|
76
|
+
duration: "àkókò tó pé ISO",
|
|
77
|
+
ipv4: "àdírẹ́sì IPv4",
|
|
78
|
+
ipv6: "àdírẹ́sì IPv6",
|
|
79
|
+
cidrv4: "àgbègbè IPv4",
|
|
80
|
+
cidrv6: "àgbègbè IPv6",
|
|
81
|
+
base64: "ọ̀rọ̀ tí a kọ́ ní base64",
|
|
82
|
+
base64url: "ọ̀rọ̀ base64url",
|
|
83
|
+
json_string: "ọ̀rọ̀ JSON",
|
|
84
|
+
e164: "nọ́mbà E.164",
|
|
85
|
+
jwt: "JWT",
|
|
86
|
+
template_literal: "ẹ̀rọ ìbáwọlé",
|
|
87
|
+
};
|
|
88
|
+
return (issue) => {
|
|
89
|
+
switch (issue.code) {
|
|
90
|
+
case "invalid_type":
|
|
91
|
+
return `Ìbáwọlé aṣìṣe: a ní láti fi ${issue.expected}, àmọ̀ a rí ${parsedType(issue.input)}`;
|
|
92
|
+
case "invalid_value":
|
|
93
|
+
if (issue.values.length === 1)
|
|
94
|
+
return `Ìbáwọlé aṣìṣe: a ní láti fi ${util.stringifyPrimitive(issue.values[0])}`;
|
|
95
|
+
return `Àṣàyàn aṣìṣe: yan ọ̀kan lára ${util.joinValues(issue.values, "|")}`;
|
|
96
|
+
case "too_big": {
|
|
97
|
+
const adj = issue.inclusive ? "<=" : "<";
|
|
98
|
+
const sizing = getSizing(issue.origin);
|
|
99
|
+
if (sizing)
|
|
100
|
+
return `Tó pọ̀ jù: a ní láti jẹ́ pé ${issue.origin ?? "iye"} ${sizing.verb} ${adj}${issue.maximum} ${sizing.unit}`;
|
|
101
|
+
return `Tó pọ̀ jù: a ní láti jẹ́ ${adj}${issue.maximum}`;
|
|
102
|
+
}
|
|
103
|
+
case "too_small": {
|
|
104
|
+
const adj = issue.inclusive ? ">=" : ">";
|
|
105
|
+
const sizing = getSizing(issue.origin);
|
|
106
|
+
if (sizing)
|
|
107
|
+
return `Kéré ju: a ní láti jẹ́ pé ${issue.origin} ${sizing.verb} ${adj}${issue.minimum} ${sizing.unit}`;
|
|
108
|
+
return `Kéré ju: a ní láti jẹ́ ${adj}${issue.minimum}`;
|
|
109
|
+
}
|
|
110
|
+
case "invalid_format": {
|
|
111
|
+
const _issue = issue;
|
|
112
|
+
if (_issue.format === "starts_with")
|
|
113
|
+
return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${_issue.prefix}"`;
|
|
114
|
+
if (_issue.format === "ends_with")
|
|
115
|
+
return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${_issue.suffix}"`;
|
|
116
|
+
if (_issue.format === "includes")
|
|
117
|
+
return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${_issue.includes}"`;
|
|
118
|
+
if (_issue.format === "regex")
|
|
119
|
+
return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${_issue.pattern}`;
|
|
120
|
+
return `Aṣìṣe: ${Nouns[_issue.format] ?? issue.format}`;
|
|
121
|
+
}
|
|
122
|
+
case "not_multiple_of":
|
|
123
|
+
return `Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${issue.divisor}`;
|
|
124
|
+
case "unrecognized_keys":
|
|
125
|
+
return `Bọtìnì àìmọ̀: ${util.joinValues(issue.keys, ", ")}`;
|
|
126
|
+
case "invalid_key":
|
|
127
|
+
return `Bọtìnì aṣìṣe nínú ${issue.origin}`;
|
|
128
|
+
case "invalid_union":
|
|
129
|
+
return "Ìbáwọlé aṣìṣe";
|
|
130
|
+
case "invalid_element":
|
|
131
|
+
return `Iye aṣìṣe nínú ${issue.origin}`;
|
|
132
|
+
default:
|
|
133
|
+
return "Ìbáwọlé aṣìṣe";
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
function default_1() {
|
|
138
|
+
return {
|
|
139
|
+
localeError: error(),
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
module.exports = exports.default;
|
package/v4/locales/yo.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import * as util from "../core/util.js";
|
|
2
|
+
const error = () => {
|
|
3
|
+
const Sizable = {
|
|
4
|
+
string: { unit: "àmi", verb: "ní" },
|
|
5
|
+
file: { unit: "bytes", verb: "ní" },
|
|
6
|
+
array: { unit: "nkan", verb: "ní" },
|
|
7
|
+
set: { unit: "nkan", verb: "ní" },
|
|
8
|
+
};
|
|
9
|
+
function getSizing(origin) {
|
|
10
|
+
return Sizable[origin] ?? null;
|
|
11
|
+
}
|
|
12
|
+
const parsedType = (data) => {
|
|
13
|
+
const t = typeof data;
|
|
14
|
+
switch (t) {
|
|
15
|
+
case "number": {
|
|
16
|
+
return Number.isNaN(data) ? "NaN" : "nọ́mbà";
|
|
17
|
+
}
|
|
18
|
+
case "object": {
|
|
19
|
+
if (Array.isArray(data)) {
|
|
20
|
+
return "akopọ";
|
|
21
|
+
}
|
|
22
|
+
if (data === null) {
|
|
23
|
+
return "null";
|
|
24
|
+
}
|
|
25
|
+
if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
|
|
26
|
+
return data.constructor.name;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return t;
|
|
31
|
+
};
|
|
32
|
+
const Nouns = {
|
|
33
|
+
regex: "ẹ̀rọ ìbáwọlé",
|
|
34
|
+
email: "àdírẹ́sì ìmẹ́lì",
|
|
35
|
+
url: "URL",
|
|
36
|
+
emoji: "emoji",
|
|
37
|
+
uuid: "UUID",
|
|
38
|
+
uuidv4: "UUIDv4",
|
|
39
|
+
uuidv6: "UUIDv6",
|
|
40
|
+
nanoid: "nanoid",
|
|
41
|
+
guid: "GUID",
|
|
42
|
+
cuid: "cuid",
|
|
43
|
+
cuid2: "cuid2",
|
|
44
|
+
ulid: "ULID",
|
|
45
|
+
xid: "XID",
|
|
46
|
+
ksuid: "KSUID",
|
|
47
|
+
datetime: "àkókò ISO",
|
|
48
|
+
date: "ọjọ́ ISO",
|
|
49
|
+
time: "àkókò ISO",
|
|
50
|
+
duration: "àkókò tó pé ISO",
|
|
51
|
+
ipv4: "àdírẹ́sì IPv4",
|
|
52
|
+
ipv6: "àdírẹ́sì IPv6",
|
|
53
|
+
cidrv4: "àgbègbè IPv4",
|
|
54
|
+
cidrv6: "àgbègbè IPv6",
|
|
55
|
+
base64: "ọ̀rọ̀ tí a kọ́ ní base64",
|
|
56
|
+
base64url: "ọ̀rọ̀ base64url",
|
|
57
|
+
json_string: "ọ̀rọ̀ JSON",
|
|
58
|
+
e164: "nọ́mbà E.164",
|
|
59
|
+
jwt: "JWT",
|
|
60
|
+
template_literal: "ẹ̀rọ ìbáwọlé",
|
|
61
|
+
};
|
|
62
|
+
return (issue) => {
|
|
63
|
+
switch (issue.code) {
|
|
64
|
+
case "invalid_type":
|
|
65
|
+
return `Ìbáwọlé aṣìṣe: a ní láti fi ${issue.expected}, àmọ̀ a rí ${parsedType(issue.input)}`;
|
|
66
|
+
case "invalid_value":
|
|
67
|
+
if (issue.values.length === 1)
|
|
68
|
+
return `Ìbáwọlé aṣìṣe: a ní láti fi ${util.stringifyPrimitive(issue.values[0])}`;
|
|
69
|
+
return `Àṣàyàn aṣìṣe: yan ọ̀kan lára ${util.joinValues(issue.values, "|")}`;
|
|
70
|
+
case "too_big": {
|
|
71
|
+
const adj = issue.inclusive ? "<=" : "<";
|
|
72
|
+
const sizing = getSizing(issue.origin);
|
|
73
|
+
if (sizing)
|
|
74
|
+
return `Tó pọ̀ jù: a ní láti jẹ́ pé ${issue.origin ?? "iye"} ${sizing.verb} ${adj}${issue.maximum} ${sizing.unit}`;
|
|
75
|
+
return `Tó pọ̀ jù: a ní láti jẹ́ ${adj}${issue.maximum}`;
|
|
76
|
+
}
|
|
77
|
+
case "too_small": {
|
|
78
|
+
const adj = issue.inclusive ? ">=" : ">";
|
|
79
|
+
const sizing = getSizing(issue.origin);
|
|
80
|
+
if (sizing)
|
|
81
|
+
return `Kéré ju: a ní láti jẹ́ pé ${issue.origin} ${sizing.verb} ${adj}${issue.minimum} ${sizing.unit}`;
|
|
82
|
+
return `Kéré ju: a ní láti jẹ́ ${adj}${issue.minimum}`;
|
|
83
|
+
}
|
|
84
|
+
case "invalid_format": {
|
|
85
|
+
const _issue = issue;
|
|
86
|
+
if (_issue.format === "starts_with")
|
|
87
|
+
return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${_issue.prefix}"`;
|
|
88
|
+
if (_issue.format === "ends_with")
|
|
89
|
+
return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${_issue.suffix}"`;
|
|
90
|
+
if (_issue.format === "includes")
|
|
91
|
+
return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${_issue.includes}"`;
|
|
92
|
+
if (_issue.format === "regex")
|
|
93
|
+
return `Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${_issue.pattern}`;
|
|
94
|
+
return `Aṣìṣe: ${Nouns[_issue.format] ?? issue.format}`;
|
|
95
|
+
}
|
|
96
|
+
case "not_multiple_of":
|
|
97
|
+
return `Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${issue.divisor}`;
|
|
98
|
+
case "unrecognized_keys":
|
|
99
|
+
return `Bọtìnì àìmọ̀: ${util.joinValues(issue.keys, ", ")}`;
|
|
100
|
+
case "invalid_key":
|
|
101
|
+
return `Bọtìnì aṣìṣe nínú ${issue.origin}`;
|
|
102
|
+
case "invalid_union":
|
|
103
|
+
return "Ìbáwọlé aṣìṣe";
|
|
104
|
+
case "invalid_element":
|
|
105
|
+
return `Iye aṣìṣe nínú ${issue.origin}`;
|
|
106
|
+
default:
|
|
107
|
+
return "Ìbáwọlé aṣìṣe";
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
export default function () {
|
|
112
|
+
return {
|
|
113
|
+
localeError: error(),
|
|
114
|
+
};
|
|
115
|
+
}
|
package/v4/locales/zh-CN.cjs
CHANGED
package/v4/locales/zh-CN.d.cts
CHANGED
package/v4/locales/zh-TW.cjs
CHANGED
package/v4/locales/zh-TW.d.cts
CHANGED
package/v4/mini/schemas.cjs
CHANGED
|
@@ -49,6 +49,7 @@ exports.base64url = base64url;
|
|
|
49
49
|
exports.e164 = e164;
|
|
50
50
|
exports.jwt = jwt;
|
|
51
51
|
exports.stringFormat = stringFormat;
|
|
52
|
+
exports.hostname = hostname;
|
|
52
53
|
exports.number = number;
|
|
53
54
|
exports.int = int;
|
|
54
55
|
exports.float32 = float32;
|
|
@@ -109,6 +110,7 @@ exports.promise = promise;
|
|
|
109
110
|
exports.check = check;
|
|
110
111
|
exports.custom = custom;
|
|
111
112
|
exports.refine = refine;
|
|
113
|
+
exports.superRefine = superRefine;
|
|
112
114
|
exports.instanceof = _instanceof;
|
|
113
115
|
exports.json = json;
|
|
114
116
|
const core = __importStar(require("../core/index.cjs"));
|
|
@@ -303,6 +305,9 @@ exports.ZodMiniCustomStringFormat = core.$constructor("ZodMiniCustomStringFormat
|
|
|
303
305
|
function stringFormat(format, fnOrRegex, _params = {}) {
|
|
304
306
|
return core._stringFormat(exports.ZodMiniCustomStringFormat, format, fnOrRegex, _params);
|
|
305
307
|
}
|
|
308
|
+
function hostname(_params) {
|
|
309
|
+
return core._stringFormat(exports.ZodMiniCustomStringFormat, "hostname", core.regexes.hostname, _params);
|
|
310
|
+
}
|
|
306
311
|
exports.ZodMiniNumber = core.$constructor("ZodMiniNumber", (inst, def) => {
|
|
307
312
|
core.$ZodNumber.init(inst, def);
|
|
308
313
|
exports.ZodMiniType.init(inst, def);
|
|
@@ -814,6 +819,10 @@ function custom(fn, _params) {
|
|
|
814
819
|
function refine(fn, _params = {}) {
|
|
815
820
|
return core._refine(exports.ZodMiniCustom, fn, _params);
|
|
816
821
|
}
|
|
822
|
+
// superRefine
|
|
823
|
+
function superRefine(fn) {
|
|
824
|
+
return core._superRefine(fn);
|
|
825
|
+
}
|
|
817
826
|
// instanceof
|
|
818
827
|
class Class {
|
|
819
828
|
constructor(..._args) { }
|
package/v4/mini/schemas.d.cts
CHANGED
|
@@ -111,6 +111,7 @@ export interface ZodMiniCustomStringFormat<Format extends string = string> exten
|
|
|
111
111
|
}
|
|
112
112
|
export declare const ZodMiniCustomStringFormat: core.$constructor<ZodMiniCustomStringFormat>;
|
|
113
113
|
export declare function stringFormat<Format extends string>(format: Format, fnOrRegex: ((arg: string) => util.MaybeAsync<unknown>) | RegExp, _params?: string | core.$ZodStringFormatParams): ZodMiniCustomStringFormat<Format>;
|
|
114
|
+
export declare function hostname(_params?: string | core.$ZodStringFormatParams): ZodMiniCustomStringFormat<"hostname">;
|
|
114
115
|
interface _ZodMiniNumber<T extends core.$ZodNumberInternals<unknown> = core.$ZodNumberInternals<unknown>> extends _ZodMiniType<T>, core.$ZodNumber<T["input"]> {
|
|
115
116
|
_zod: T;
|
|
116
117
|
}
|
|
@@ -331,6 +332,7 @@ export declare const ZodMiniCustom: core.$constructor<ZodMiniCustom>;
|
|
|
331
332
|
export declare function check<O = unknown>(fn: core.CheckFn<O>, params?: string | core.$ZodCustomParams): core.$ZodCheck<O>;
|
|
332
333
|
export declare function custom<O = unknown, I = O>(fn?: (data: O) => unknown, _params?: string | core.$ZodCustomParams | undefined): ZodMiniCustom<O, I>;
|
|
333
334
|
export declare function refine<T>(fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>, _params?: string | core.$ZodCustomParams): core.$ZodCheck<T>;
|
|
335
|
+
export declare function superRefine<T>(fn: (arg: T, payload: core.$RefinementCtx<T>) => void | Promise<void>): core.$ZodCheck<T>;
|
|
334
336
|
declare abstract class Class {
|
|
335
337
|
constructor(..._args: any[]);
|
|
336
338
|
}
|
package/v4/mini/schemas.d.ts
CHANGED
|
@@ -111,6 +111,7 @@ export interface ZodMiniCustomStringFormat<Format extends string = string> exten
|
|
|
111
111
|
}
|
|
112
112
|
export declare const ZodMiniCustomStringFormat: core.$constructor<ZodMiniCustomStringFormat>;
|
|
113
113
|
export declare function stringFormat<Format extends string>(format: Format, fnOrRegex: ((arg: string) => util.MaybeAsync<unknown>) | RegExp, _params?: string | core.$ZodStringFormatParams): ZodMiniCustomStringFormat<Format>;
|
|
114
|
+
export declare function hostname(_params?: string | core.$ZodStringFormatParams): ZodMiniCustomStringFormat<"hostname">;
|
|
114
115
|
interface _ZodMiniNumber<T extends core.$ZodNumberInternals<unknown> = core.$ZodNumberInternals<unknown>> extends _ZodMiniType<T>, core.$ZodNumber<T["input"]> {
|
|
115
116
|
_zod: T;
|
|
116
117
|
}
|
|
@@ -331,6 +332,7 @@ export declare const ZodMiniCustom: core.$constructor<ZodMiniCustom>;
|
|
|
331
332
|
export declare function check<O = unknown>(fn: core.CheckFn<O>, params?: string | core.$ZodCustomParams): core.$ZodCheck<O>;
|
|
332
333
|
export declare function custom<O = unknown, I = O>(fn?: (data: O) => unknown, _params?: string | core.$ZodCustomParams | undefined): ZodMiniCustom<O, I>;
|
|
333
334
|
export declare function refine<T>(fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>, _params?: string | core.$ZodCustomParams): core.$ZodCheck<T>;
|
|
335
|
+
export declare function superRefine<T>(fn: (arg: T, payload: core.$RefinementCtx<T>) => void | Promise<void>): core.$ZodCheck<T>;
|
|
334
336
|
declare abstract class Class {
|
|
335
337
|
constructor(..._args: any[]);
|
|
336
338
|
}
|
package/v4/mini/schemas.js
CHANGED
|
@@ -190,6 +190,9 @@ export const ZodMiniCustomStringFormat = /*@__PURE__*/ core.$constructor("ZodMin
|
|
|
190
190
|
export function stringFormat(format, fnOrRegex, _params = {}) {
|
|
191
191
|
return core._stringFormat(ZodMiniCustomStringFormat, format, fnOrRegex, _params);
|
|
192
192
|
}
|
|
193
|
+
export function hostname(_params) {
|
|
194
|
+
return core._stringFormat(ZodMiniCustomStringFormat, "hostname", core.regexes.hostname, _params);
|
|
195
|
+
}
|
|
193
196
|
export const ZodMiniNumber = /*@__PURE__*/ core.$constructor("ZodMiniNumber", (inst, def) => {
|
|
194
197
|
core.$ZodNumber.init(inst, def);
|
|
195
198
|
ZodMiniType.init(inst, def);
|
|
@@ -707,6 +710,10 @@ export function custom(fn, _params) {
|
|
|
707
710
|
export function refine(fn, _params = {}) {
|
|
708
711
|
return core._refine(ZodMiniCustom, fn, _params);
|
|
709
712
|
}
|
|
713
|
+
// superRefine
|
|
714
|
+
export function superRefine(fn) {
|
|
715
|
+
return core._superRefine(fn);
|
|
716
|
+
}
|
|
710
717
|
// instanceof
|
|
711
718
|
class Class {
|
|
712
719
|
constructor(..._args) { }
|