zod 4.1.0-canary.20250723T214008 → 4.1.0-canary.20250723T215716

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod",
3
- "version": "4.1.0-canary.20250723T214008",
3
+ "version": "4.1.0-canary.20250723T215716",
4
4
  "type": "module",
5
5
  "author": "Colin McDonnell <zod@colinhacks.com>",
6
6
  "description": "TypeScript-first schema declaration and validation library with static type inference",
@@ -0,0 +1,136 @@
1
+ import type { $ZodStringFormats } from "../core/checks.js";
2
+ import type * as errors from "../core/errors.js";
3
+ import * as util from "../core/util.js";
4
+
5
+ export const parsedType = (data: any): string => {
6
+ const t = typeof data;
7
+
8
+ switch (t) {
9
+ case "number": {
10
+ return Number.isNaN(data) ? "NaN" : "число";
11
+ }
12
+ case "object": {
13
+ if (Array.isArray(data)) {
14
+ return "масив";
15
+ }
16
+ if (data === null) {
17
+ return "null";
18
+ }
19
+
20
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
21
+ return data.constructor.name;
22
+ }
23
+ }
24
+ }
25
+ return t;
26
+ };
27
+
28
+ const error: () => errors.$ZodErrorMap = () => {
29
+ const Sizable: Record<string, { unit: string; verb: string }> = {
30
+ string: { unit: "символа", verb: "да съдържа" },
31
+ file: { unit: "байта", verb: "да съдържа" },
32
+ array: { unit: "елемента", verb: "да съдържа" },
33
+ set: { unit: "елемента", verb: "да съдържа" },
34
+ };
35
+
36
+ function getSizing(origin: string): { unit: string; verb: string } | null {
37
+ return Sizable[origin] ?? null;
38
+ }
39
+
40
+ const Nouns: {
41
+ [k in $ZodStringFormats | (string & {})]?: string;
42
+ } = {
43
+ regex: "вход",
44
+ email: "имейл адрес",
45
+ url: "URL",
46
+ emoji: "емоджи",
47
+ uuid: "UUID",
48
+ uuidv4: "UUIDv4",
49
+ uuidv6: "UUIDv6",
50
+ nanoid: "nanoid",
51
+ guid: "GUID",
52
+ cuid: "cuid",
53
+ cuid2: "cuid2",
54
+ ulid: "ULID",
55
+ xid: "XID",
56
+ ksuid: "KSUID",
57
+ datetime: "ISO време",
58
+ date: "ISO дата",
59
+ time: "ISO време",
60
+ duration: "ISO продължителност",
61
+ ipv4: "IPv4 адрес",
62
+ ipv6: "IPv6 адрес",
63
+ cidrv4: "IPv4 диапазон",
64
+ cidrv6: "IPv6 диапазон",
65
+ base64: "base64-кодиран низ",
66
+ base64url: "base64url-кодиран низ",
67
+ json_string: "JSON низ",
68
+ e164: "E.164 номер",
69
+ jwt: "JWT",
70
+ template_literal: "вход",
71
+ };
72
+
73
+ return (issue) => {
74
+ switch (issue.code) {
75
+ case "invalid_type":
76
+ return `Невалиден вход: очакван ${issue.expected}, получен ${parsedType(issue.input)}`;
77
+
78
+ case "invalid_value":
79
+ if (issue.values.length === 1) return `Невалиден вход: очакван ${util.stringifyPrimitive(issue.values[0])}`;
80
+ return `Невалидна опция: очаквано едно от ${util.joinValues(issue.values, "|")}`;
81
+ case "too_big": {
82
+ const adj = issue.inclusive ? "<=" : "<";
83
+ const sizing = getSizing(issue.origin);
84
+ if (sizing)
85
+ return `Твърде голямо: очаква се ${issue.origin ?? "стойност"} да съдържа ${adj}${issue.maximum.toString()} ${sizing.unit ?? "елемента"}`;
86
+ return `Твърде голямо: очаква се ${issue.origin ?? "стойност"} да бъде ${adj}${issue.maximum.toString()}`;
87
+ }
88
+ case "too_small": {
89
+ const adj = issue.inclusive ? ">=" : ">";
90
+ const sizing = getSizing(issue.origin);
91
+ if (sizing) {
92
+ return `Твърде малко: очаква се ${issue.origin} да съдържа ${adj}${issue.minimum.toString()} ${sizing.unit}`;
93
+ }
94
+
95
+ return `Твърде малко: очаква се ${issue.origin} да бъде ${adj}${issue.minimum.toString()}`;
96
+ }
97
+ case "invalid_format": {
98
+ const _issue = issue as errors.$ZodStringFormatIssues;
99
+ if (_issue.format === "starts_with") {
100
+ return `Невалиден низ: трябва да започва с "${_issue.prefix}"`;
101
+ }
102
+ if (_issue.format === "ends_with") return `Невалиден низ: трябва да завършва с "${_issue.suffix}"`;
103
+ if (_issue.format === "includes") return `Невалиден низ: трябва да включва "${_issue.includes}"`;
104
+ if (_issue.format === "regex") return `Невалиден низ: трябва да съвпада с ${_issue.pattern}`;
105
+
106
+ let invalid_adj = "Невалиден";
107
+
108
+ if (_issue.format === "emoji") invalid_adj = "Невалидно";
109
+ if (_issue.format === "datetime") invalid_adj = "Невалидно";
110
+ if (_issue.format === "date") invalid_adj = "Невалидна";
111
+ if (_issue.format === "time") invalid_adj = "Невалидно";
112
+ if (_issue.format === "duration") invalid_adj = "Невалидна";
113
+
114
+ return `${invalid_adj} ${Nouns[_issue.format] ?? issue.format}`;
115
+ }
116
+ case "not_multiple_of":
117
+ return `Невалидно число: трябва да бъде кратно на ${issue.divisor}`;
118
+ case "unrecognized_keys":
119
+ return `Неразпознат${issue.keys.length > 1 ? "и" : ""} ключ${issue.keys.length > 1 ? "ове" : ""}: ${util.joinValues(issue.keys, ", ")}`;
120
+ case "invalid_key":
121
+ return `Невалиден ключ в ${issue.origin}`;
122
+ case "invalid_union":
123
+ return "Невалиден вход";
124
+ case "invalid_element":
125
+ return `Невалидна стойност в ${issue.origin}`;
126
+ default:
127
+ return `Невалиден вход`;
128
+ }
129
+ };
130
+ };
131
+
132
+ export default function (): { localeError: errors.$ZodErrorMap } {
133
+ return {
134
+ localeError: error(),
135
+ };
136
+ }
@@ -0,0 +1,141 @@
1
+ import type { $ZodStringFormats } from "../core/checks.js";
2
+ import type * as errors from "../core/errors.js";
3
+ import * as util from "../core/util.js";
4
+
5
+ const error: () => errors.$ZodErrorMap = () => {
6
+ const Sizable: Record<string, { unit: string; verb: string }> = {
7
+ string: { unit: "tegn", verb: "havde" },
8
+ file: { unit: "bytes", verb: "havde" },
9
+ array: { unit: "elementer", verb: "indeholdt" },
10
+ set: { unit: "elementer", verb: "indeholdt" },
11
+ };
12
+
13
+ const TypeNames: Record<string, string> = {
14
+ string: "streng",
15
+ number: "tal",
16
+ boolean: "boolean",
17
+ array: "liste",
18
+ object: "objekt",
19
+ set: "sæt",
20
+ file: "fil",
21
+ };
22
+
23
+ function getSizing(origin: string): { unit: string; verb: string } | null {
24
+ return Sizable[origin] ?? null;
25
+ }
26
+
27
+ function getTypeName(type: string): string {
28
+ return TypeNames[type] ?? type;
29
+ }
30
+
31
+ const parsedType = (data: any): string => {
32
+ const t = typeof data;
33
+
34
+ switch (t) {
35
+ case "number": {
36
+ return Number.isNaN(data) ? "NaN" : "tal";
37
+ }
38
+ case "object": {
39
+ if (Array.isArray(data)) {
40
+ return "liste";
41
+ }
42
+ if (data === null) {
43
+ return "null";
44
+ }
45
+
46
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
47
+ return data.constructor.name;
48
+ }
49
+ return "objekt";
50
+ }
51
+ }
52
+ return t;
53
+ };
54
+
55
+ const Nouns: {
56
+ [k in $ZodStringFormats | (string & {})]?: string;
57
+ } = {
58
+ regex: "input",
59
+ email: "e-mailadresse",
60
+ url: "URL",
61
+ emoji: "emoji",
62
+ uuid: "UUID",
63
+ uuidv4: "UUIDv4",
64
+ uuidv6: "UUIDv6",
65
+ nanoid: "nanoid",
66
+ guid: "GUID",
67
+ cuid: "cuid",
68
+ cuid2: "cuid2",
69
+ ulid: "ULID",
70
+ xid: "XID",
71
+ ksuid: "KSUID",
72
+ datetime: "ISO dato- og klokkeslæt",
73
+ date: "ISO-dato",
74
+ time: "ISO-klokkeslæt",
75
+ duration: "ISO-varighed",
76
+ ipv4: "IPv4-område",
77
+ ipv6: "IPv6-område",
78
+ cidrv4: "IPv4-spektrum",
79
+ cidrv6: "IPv6-spektrum",
80
+ base64: "base64-kodet streng",
81
+ base64url: "base64url-kodet streng",
82
+ json_string: "JSON-streng",
83
+ e164: "E.164-nummer",
84
+ jwt: "JWT",
85
+ template_literal: "input",
86
+ };
87
+
88
+ return (issue) => {
89
+ switch (issue.code) {
90
+ case "invalid_type":
91
+ return `Ugyldigt input: forventede ${getTypeName(issue.expected)}, fik ${getTypeName(parsedType(issue.input))}`;
92
+ case "invalid_value":
93
+ if (issue.values.length === 1) return `Ugyldig værdi: forventede ${util.stringifyPrimitive(issue.values[0])}`;
94
+ return `Ugyldigt valg: forventede en af følgende ${util.joinValues(issue.values, "|")}`;
95
+ case "too_big": {
96
+ const adj = issue.inclusive ? "<=" : "<";
97
+ const sizing = getSizing(issue.origin);
98
+ const origin = getTypeName(issue.origin);
99
+ if (sizing)
100
+ return `For stor: forventede ${origin ?? "value"} ${sizing.verb} ${adj} ${issue.maximum.toString()} ${sizing.unit ?? "elementer"}`;
101
+ return `For stor: forventede ${origin ?? "value"} havde ${adj} ${issue.maximum.toString()}`;
102
+ }
103
+ case "too_small": {
104
+ const adj = issue.inclusive ? ">=" : ">";
105
+ const sizing = getSizing(issue.origin);
106
+ const origin = getTypeName(issue.origin);
107
+ if (sizing) {
108
+ return `For lille: forventede ${origin} ${sizing.verb} ${adj} ${issue.minimum.toString()} ${sizing.unit}`;
109
+ }
110
+
111
+ return `For lille: forventede ${origin} havde ${adj} ${issue.minimum.toString()}`;
112
+ }
113
+ case "invalid_format": {
114
+ const _issue = issue as errors.$ZodStringFormatIssues;
115
+ if (_issue.format === "starts_with") return `Ugyldig streng: skal starte med "${_issue.prefix}"`;
116
+ if (_issue.format === "ends_with") return `Ugyldig streng: skal ende med "${_issue.suffix}"`;
117
+ if (_issue.format === "includes") return `Ugyldig streng: skal indeholde "${_issue.includes}"`;
118
+ if (_issue.format === "regex") return `Ugyldig streng: skal matche mønsteret ${_issue.pattern}`;
119
+ return `Ugyldig ${Nouns[_issue.format] ?? issue.format}`;
120
+ }
121
+ case "not_multiple_of":
122
+ return `Ugyldigt tal: skal være deleligt med ${issue.divisor}`;
123
+ case "unrecognized_keys":
124
+ return `${issue.keys.length > 1 ? "Ukendte nøgler" : "Ukendt nøgle"}: ${util.joinValues(issue.keys, ", ")}`;
125
+ case "invalid_key":
126
+ return `Ugyldig nøgle i ${issue.origin}`;
127
+ case "invalid_union":
128
+ return "Ugyldigt input: matcher ingen af de tilladte typer";
129
+ case "invalid_element":
130
+ return `Ugyldig værdi i ${issue.origin}`;
131
+ default:
132
+ return `Ugyldigt input`;
133
+ }
134
+ };
135
+ };
136
+
137
+ export default function (): { localeError: errors.$ZodErrorMap } {
138
+ return {
139
+ localeError: error(),
140
+ };
141
+ }
@@ -3,6 +3,7 @@ export { default as az } from "./az.js";
3
3
  export { default as be } from "./be.js";
4
4
  export { default as ca } from "./ca.js";
5
5
  export { default as cs } from "./cs.js";
6
+ export { default as da } from "./da.js";
6
7
  export { default as de } from "./de.js";
7
8
  export { default as en } from "./en.js";
8
9
  export { default as eo } from "./eo.js";
@@ -0,0 +1,156 @@
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.parsedType = void 0;
27
+ exports.default = default_1;
28
+ const util = __importStar(require("../core/util.cjs"));
29
+ const parsedType = (data) => {
30
+ const t = typeof data;
31
+ switch (t) {
32
+ case "number": {
33
+ return Number.isNaN(data) ? "NaN" : "число";
34
+ }
35
+ case "object": {
36
+ if (Array.isArray(data)) {
37
+ return "масив";
38
+ }
39
+ if (data === null) {
40
+ return "null";
41
+ }
42
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
43
+ return data.constructor.name;
44
+ }
45
+ }
46
+ }
47
+ return t;
48
+ };
49
+ exports.parsedType = parsedType;
50
+ const error = () => {
51
+ const Sizable = {
52
+ string: { unit: "символа", verb: "да съдържа" },
53
+ file: { unit: "байта", verb: "да съдържа" },
54
+ array: { unit: "елемента", verb: "да съдържа" },
55
+ set: { unit: "елемента", verb: "да съдържа" },
56
+ };
57
+ function getSizing(origin) {
58
+ return Sizable[origin] ?? null;
59
+ }
60
+ const Nouns = {
61
+ regex: "вход",
62
+ email: "имейл адрес",
63
+ url: "URL",
64
+ emoji: "емоджи",
65
+ uuid: "UUID",
66
+ uuidv4: "UUIDv4",
67
+ uuidv6: "UUIDv6",
68
+ nanoid: "nanoid",
69
+ guid: "GUID",
70
+ cuid: "cuid",
71
+ cuid2: "cuid2",
72
+ ulid: "ULID",
73
+ xid: "XID",
74
+ ksuid: "KSUID",
75
+ datetime: "ISO време",
76
+ date: "ISO дата",
77
+ time: "ISO време",
78
+ duration: "ISO продължителност",
79
+ ipv4: "IPv4 адрес",
80
+ ipv6: "IPv6 адрес",
81
+ cidrv4: "IPv4 диапазон",
82
+ cidrv6: "IPv6 диапазон",
83
+ base64: "base64-кодиран низ",
84
+ base64url: "base64url-кодиран низ",
85
+ json_string: "JSON низ",
86
+ e164: "E.164 номер",
87
+ jwt: "JWT",
88
+ template_literal: "вход",
89
+ };
90
+ return (issue) => {
91
+ switch (issue.code) {
92
+ case "invalid_type":
93
+ return `Невалиден вход: очакван ${issue.expected}, получен ${(0, exports.parsedType)(issue.input)}`;
94
+ case "invalid_value":
95
+ if (issue.values.length === 1)
96
+ return `Невалиден вход: очакван ${util.stringifyPrimitive(issue.values[0])}`;
97
+ return `Невалидна опция: очаквано едно от ${util.joinValues(issue.values, "|")}`;
98
+ case "too_big": {
99
+ const adj = issue.inclusive ? "<=" : "<";
100
+ const sizing = getSizing(issue.origin);
101
+ if (sizing)
102
+ return `Твърде голямо: очаква се ${issue.origin ?? "стойност"} да съдържа ${adj}${issue.maximum.toString()} ${sizing.unit ?? "елемента"}`;
103
+ return `Твърде голямо: очаква се ${issue.origin ?? "стойност"} да бъде ${adj}${issue.maximum.toString()}`;
104
+ }
105
+ case "too_small": {
106
+ const adj = issue.inclusive ? ">=" : ">";
107
+ const sizing = getSizing(issue.origin);
108
+ if (sizing) {
109
+ return `Твърде малко: очаква се ${issue.origin} да съдържа ${adj}${issue.minimum.toString()} ${sizing.unit}`;
110
+ }
111
+ return `Твърде малко: очаква се ${issue.origin} да бъде ${adj}${issue.minimum.toString()}`;
112
+ }
113
+ case "invalid_format": {
114
+ const _issue = issue;
115
+ if (_issue.format === "starts_with") {
116
+ return `Невалиден низ: трябва да започва с "${_issue.prefix}"`;
117
+ }
118
+ if (_issue.format === "ends_with")
119
+ return `Невалиден низ: трябва да завършва с "${_issue.suffix}"`;
120
+ if (_issue.format === "includes")
121
+ return `Невалиден низ: трябва да включва "${_issue.includes}"`;
122
+ if (_issue.format === "regex")
123
+ return `Невалиден низ: трябва да съвпада с ${_issue.pattern}`;
124
+ let invalid_adj = "Невалиден";
125
+ if (_issue.format === "emoji")
126
+ invalid_adj = "Невалидно";
127
+ if (_issue.format === "datetime")
128
+ invalid_adj = "Невалидно";
129
+ if (_issue.format === "date")
130
+ invalid_adj = "Невалидна";
131
+ if (_issue.format === "time")
132
+ invalid_adj = "Невалидно";
133
+ if (_issue.format === "duration")
134
+ invalid_adj = "Невалидна";
135
+ return `${invalid_adj} ${Nouns[_issue.format] ?? issue.format}`;
136
+ }
137
+ case "not_multiple_of":
138
+ return `Невалидно число: трябва да бъде кратно на ${issue.divisor}`;
139
+ case "unrecognized_keys":
140
+ return `Неразпознат${issue.keys.length > 1 ? "и" : ""} ключ${issue.keys.length > 1 ? "ове" : ""}: ${util.joinValues(issue.keys, ", ")}`;
141
+ case "invalid_key":
142
+ return `Невалиден ключ в ${issue.origin}`;
143
+ case "invalid_union":
144
+ return "Невалиден вход";
145
+ case "invalid_element":
146
+ return `Невалидна стойност в ${issue.origin}`;
147
+ default:
148
+ return `Невалиден вход`;
149
+ }
150
+ };
151
+ };
152
+ function default_1() {
153
+ return {
154
+ localeError: error(),
155
+ };
156
+ }
@@ -0,0 +1,5 @@
1
+ import type * as errors from "../core/errors.cjs";
2
+ export declare const parsedType: (data: any) => string;
3
+ export default function (): {
4
+ localeError: errors.$ZodErrorMap;
5
+ };
@@ -0,0 +1,5 @@
1
+ import type * as errors from "../core/errors.js";
2
+ export declare const parsedType: (data: any) => string;
3
+ export default function (): {
4
+ localeError: errors.$ZodErrorMap;
5
+ };
@@ -0,0 +1,128 @@
1
+ import * as util from "../core/util.js";
2
+ export const parsedType = (data) => {
3
+ const t = typeof data;
4
+ switch (t) {
5
+ case "number": {
6
+ return Number.isNaN(data) ? "NaN" : "число";
7
+ }
8
+ case "object": {
9
+ if (Array.isArray(data)) {
10
+ return "масив";
11
+ }
12
+ if (data === null) {
13
+ return "null";
14
+ }
15
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
16
+ return data.constructor.name;
17
+ }
18
+ }
19
+ }
20
+ return t;
21
+ };
22
+ const error = () => {
23
+ const Sizable = {
24
+ string: { unit: "символа", verb: "да съдържа" },
25
+ file: { unit: "байта", verb: "да съдържа" },
26
+ array: { unit: "елемента", verb: "да съдържа" },
27
+ set: { unit: "елемента", verb: "да съдържа" },
28
+ };
29
+ function getSizing(origin) {
30
+ return Sizable[origin] ?? null;
31
+ }
32
+ const Nouns = {
33
+ regex: "вход",
34
+ email: "имейл адрес",
35
+ url: "URL",
36
+ 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: "ISO време",
48
+ date: "ISO дата",
49
+ time: "ISO време",
50
+ duration: "ISO продължителност",
51
+ ipv4: "IPv4 адрес",
52
+ ipv6: "IPv6 адрес",
53
+ cidrv4: "IPv4 диапазон",
54
+ cidrv6: "IPv6 диапазон",
55
+ base64: "base64-кодиран низ",
56
+ base64url: "base64url-кодиран низ",
57
+ json_string: "JSON низ",
58
+ e164: "E.164 номер",
59
+ jwt: "JWT",
60
+ template_literal: "вход",
61
+ };
62
+ return (issue) => {
63
+ switch (issue.code) {
64
+ case "invalid_type":
65
+ return `Невалиден вход: очакван ${issue.expected}, получен ${parsedType(issue.input)}`;
66
+ case "invalid_value":
67
+ if (issue.values.length === 1)
68
+ return `Невалиден вход: очакван ${util.stringifyPrimitive(issue.values[0])}`;
69
+ return `Невалидна опция: очаквано едно от ${util.joinValues(issue.values, "|")}`;
70
+ case "too_big": {
71
+ const adj = issue.inclusive ? "<=" : "<";
72
+ const sizing = getSizing(issue.origin);
73
+ if (sizing)
74
+ return `Твърде голямо: очаква се ${issue.origin ?? "стойност"} да съдържа ${adj}${issue.maximum.toString()} ${sizing.unit ?? "елемента"}`;
75
+ return `Твърде голямо: очаква се ${issue.origin ?? "стойност"} да бъде ${adj}${issue.maximum.toString()}`;
76
+ }
77
+ case "too_small": {
78
+ const adj = issue.inclusive ? ">=" : ">";
79
+ const sizing = getSizing(issue.origin);
80
+ if (sizing) {
81
+ return `Твърде малко: очаква се ${issue.origin} да съдържа ${adj}${issue.minimum.toString()} ${sizing.unit}`;
82
+ }
83
+ return `Твърде малко: очаква се ${issue.origin} да бъде ${adj}${issue.minimum.toString()}`;
84
+ }
85
+ case "invalid_format": {
86
+ const _issue = issue;
87
+ if (_issue.format === "starts_with") {
88
+ return `Невалиден низ: трябва да започва с "${_issue.prefix}"`;
89
+ }
90
+ if (_issue.format === "ends_with")
91
+ return `Невалиден низ: трябва да завършва с "${_issue.suffix}"`;
92
+ if (_issue.format === "includes")
93
+ return `Невалиден низ: трябва да включва "${_issue.includes}"`;
94
+ if (_issue.format === "regex")
95
+ return `Невалиден низ: трябва да съвпада с ${_issue.pattern}`;
96
+ let invalid_adj = "Невалиден";
97
+ if (_issue.format === "emoji")
98
+ invalid_adj = "Невалидно";
99
+ if (_issue.format === "datetime")
100
+ invalid_adj = "Невалидно";
101
+ if (_issue.format === "date")
102
+ invalid_adj = "Невалидна";
103
+ if (_issue.format === "time")
104
+ invalid_adj = "Невалидно";
105
+ if (_issue.format === "duration")
106
+ invalid_adj = "Невалидна";
107
+ return `${invalid_adj} ${Nouns[_issue.format] ?? issue.format}`;
108
+ }
109
+ case "not_multiple_of":
110
+ return `Невалидно число: трябва да бъде кратно на ${issue.divisor}`;
111
+ case "unrecognized_keys":
112
+ return `Неразпознат${issue.keys.length > 1 ? "и" : ""} ключ${issue.keys.length > 1 ? "ове" : ""}: ${util.joinValues(issue.keys, ", ")}`;
113
+ case "invalid_key":
114
+ return `Невалиден ключ в ${issue.origin}`;
115
+ case "invalid_union":
116
+ return "Невалиден вход";
117
+ case "invalid_element":
118
+ return `Невалидна стойност в ${issue.origin}`;
119
+ default:
120
+ return `Невалиден вход`;
121
+ }
122
+ };
123
+ };
124
+ export default function () {
125
+ return {
126
+ localeError: error(),
127
+ };
128
+ }
@@ -0,0 +1,157 @@
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: "tegn", verb: "havde" },
31
+ file: { unit: "bytes", verb: "havde" },
32
+ array: { unit: "elementer", verb: "indeholdt" },
33
+ set: { unit: "elementer", verb: "indeholdt" },
34
+ };
35
+ const TypeNames = {
36
+ string: "streng",
37
+ number: "tal",
38
+ boolean: "boolean",
39
+ array: "liste",
40
+ object: "objekt",
41
+ set: "sæt",
42
+ file: "fil",
43
+ };
44
+ function getSizing(origin) {
45
+ return Sizable[origin] ?? null;
46
+ }
47
+ function getTypeName(type) {
48
+ return TypeNames[type] ?? type;
49
+ }
50
+ const parsedType = (data) => {
51
+ const t = typeof data;
52
+ switch (t) {
53
+ case "number": {
54
+ return Number.isNaN(data) ? "NaN" : "tal";
55
+ }
56
+ case "object": {
57
+ if (Array.isArray(data)) {
58
+ return "liste";
59
+ }
60
+ if (data === null) {
61
+ return "null";
62
+ }
63
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
64
+ return data.constructor.name;
65
+ }
66
+ return "objekt";
67
+ }
68
+ }
69
+ return t;
70
+ };
71
+ const Nouns = {
72
+ regex: "input",
73
+ email: "e-mailadresse",
74
+ url: "URL",
75
+ emoji: "emoji",
76
+ uuid: "UUID",
77
+ uuidv4: "UUIDv4",
78
+ uuidv6: "UUIDv6",
79
+ nanoid: "nanoid",
80
+ guid: "GUID",
81
+ cuid: "cuid",
82
+ cuid2: "cuid2",
83
+ ulid: "ULID",
84
+ xid: "XID",
85
+ ksuid: "KSUID",
86
+ datetime: "ISO dato- og klokkeslæt",
87
+ date: "ISO-dato",
88
+ time: "ISO-klokkeslæt",
89
+ duration: "ISO-varighed",
90
+ ipv4: "IPv4-område",
91
+ ipv6: "IPv6-område",
92
+ cidrv4: "IPv4-spektrum",
93
+ cidrv6: "IPv6-spektrum",
94
+ base64: "base64-kodet streng",
95
+ base64url: "base64url-kodet streng",
96
+ json_string: "JSON-streng",
97
+ e164: "E.164-nummer",
98
+ jwt: "JWT",
99
+ template_literal: "input",
100
+ };
101
+ return (issue) => {
102
+ switch (issue.code) {
103
+ case "invalid_type":
104
+ return `Ugyldigt input: forventede ${getTypeName(issue.expected)}, fik ${getTypeName(parsedType(issue.input))}`;
105
+ case "invalid_value":
106
+ if (issue.values.length === 1)
107
+ return `Ugyldig værdi: forventede ${util.stringifyPrimitive(issue.values[0])}`;
108
+ return `Ugyldigt valg: forventede en af følgende ${util.joinValues(issue.values, "|")}`;
109
+ case "too_big": {
110
+ const adj = issue.inclusive ? "<=" : "<";
111
+ const sizing = getSizing(issue.origin);
112
+ const origin = getTypeName(issue.origin);
113
+ if (sizing)
114
+ return `For stor: forventede ${origin ?? "value"} ${sizing.verb} ${adj} ${issue.maximum.toString()} ${sizing.unit ?? "elementer"}`;
115
+ return `For stor: forventede ${origin ?? "value"} havde ${adj} ${issue.maximum.toString()}`;
116
+ }
117
+ case "too_small": {
118
+ const adj = issue.inclusive ? ">=" : ">";
119
+ const sizing = getSizing(issue.origin);
120
+ const origin = getTypeName(issue.origin);
121
+ if (sizing) {
122
+ return `For lille: forventede ${origin} ${sizing.verb} ${adj} ${issue.minimum.toString()} ${sizing.unit}`;
123
+ }
124
+ return `For lille: forventede ${origin} havde ${adj} ${issue.minimum.toString()}`;
125
+ }
126
+ case "invalid_format": {
127
+ const _issue = issue;
128
+ if (_issue.format === "starts_with")
129
+ return `Ugyldig streng: skal starte med "${_issue.prefix}"`;
130
+ if (_issue.format === "ends_with")
131
+ return `Ugyldig streng: skal ende med "${_issue.suffix}"`;
132
+ if (_issue.format === "includes")
133
+ return `Ugyldig streng: skal indeholde "${_issue.includes}"`;
134
+ if (_issue.format === "regex")
135
+ return `Ugyldig streng: skal matche mønsteret ${_issue.pattern}`;
136
+ return `Ugyldig ${Nouns[_issue.format] ?? issue.format}`;
137
+ }
138
+ case "not_multiple_of":
139
+ return `Ugyldigt tal: skal være deleligt med ${issue.divisor}`;
140
+ case "unrecognized_keys":
141
+ return `${issue.keys.length > 1 ? "Ukendte nøgler" : "Ukendt nøgle"}: ${util.joinValues(issue.keys, ", ")}`;
142
+ case "invalid_key":
143
+ return `Ugyldig nøgle i ${issue.origin}`;
144
+ case "invalid_union":
145
+ return "Ugyldigt input: matcher ingen af de tilladte typer";
146
+ case "invalid_element":
147
+ return `Ugyldig værdi i ${issue.origin}`;
148
+ default:
149
+ return `Ugyldigt input`;
150
+ }
151
+ };
152
+ };
153
+ function default_1() {
154
+ return {
155
+ localeError: error(),
156
+ };
157
+ }
@@ -0,0 +1,4 @@
1
+ import type * as errors from "../core/errors.cjs";
2
+ export default function (): {
3
+ localeError: errors.$ZodErrorMap;
4
+ };
@@ -0,0 +1,4 @@
1
+ import type * as errors from "../core/errors.js";
2
+ export default function (): {
3
+ localeError: errors.$ZodErrorMap;
4
+ };
@@ -0,0 +1,131 @@
1
+ import * as util from "../core/util.js";
2
+ const error = () => {
3
+ const Sizable = {
4
+ string: { unit: "tegn", verb: "havde" },
5
+ file: { unit: "bytes", verb: "havde" },
6
+ array: { unit: "elementer", verb: "indeholdt" },
7
+ set: { unit: "elementer", verb: "indeholdt" },
8
+ };
9
+ const TypeNames = {
10
+ string: "streng",
11
+ number: "tal",
12
+ boolean: "boolean",
13
+ array: "liste",
14
+ object: "objekt",
15
+ set: "sæt",
16
+ file: "fil",
17
+ };
18
+ function getSizing(origin) {
19
+ return Sizable[origin] ?? null;
20
+ }
21
+ function getTypeName(type) {
22
+ return TypeNames[type] ?? type;
23
+ }
24
+ const parsedType = (data) => {
25
+ const t = typeof data;
26
+ switch (t) {
27
+ case "number": {
28
+ return Number.isNaN(data) ? "NaN" : "tal";
29
+ }
30
+ case "object": {
31
+ if (Array.isArray(data)) {
32
+ return "liste";
33
+ }
34
+ if (data === null) {
35
+ return "null";
36
+ }
37
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
38
+ return data.constructor.name;
39
+ }
40
+ return "objekt";
41
+ }
42
+ }
43
+ return t;
44
+ };
45
+ const Nouns = {
46
+ regex: "input",
47
+ email: "e-mailadresse",
48
+ url: "URL",
49
+ emoji: "emoji",
50
+ uuid: "UUID",
51
+ uuidv4: "UUIDv4",
52
+ uuidv6: "UUIDv6",
53
+ nanoid: "nanoid",
54
+ guid: "GUID",
55
+ cuid: "cuid",
56
+ cuid2: "cuid2",
57
+ ulid: "ULID",
58
+ xid: "XID",
59
+ ksuid: "KSUID",
60
+ datetime: "ISO dato- og klokkeslæt",
61
+ date: "ISO-dato",
62
+ time: "ISO-klokkeslæt",
63
+ duration: "ISO-varighed",
64
+ ipv4: "IPv4-område",
65
+ ipv6: "IPv6-område",
66
+ cidrv4: "IPv4-spektrum",
67
+ cidrv6: "IPv6-spektrum",
68
+ base64: "base64-kodet streng",
69
+ base64url: "base64url-kodet streng",
70
+ json_string: "JSON-streng",
71
+ e164: "E.164-nummer",
72
+ jwt: "JWT",
73
+ template_literal: "input",
74
+ };
75
+ return (issue) => {
76
+ switch (issue.code) {
77
+ case "invalid_type":
78
+ return `Ugyldigt input: forventede ${getTypeName(issue.expected)}, fik ${getTypeName(parsedType(issue.input))}`;
79
+ case "invalid_value":
80
+ if (issue.values.length === 1)
81
+ return `Ugyldig værdi: forventede ${util.stringifyPrimitive(issue.values[0])}`;
82
+ return `Ugyldigt valg: forventede en af følgende ${util.joinValues(issue.values, "|")}`;
83
+ case "too_big": {
84
+ const adj = issue.inclusive ? "<=" : "<";
85
+ const sizing = getSizing(issue.origin);
86
+ const origin = getTypeName(issue.origin);
87
+ if (sizing)
88
+ return `For stor: forventede ${origin ?? "value"} ${sizing.verb} ${adj} ${issue.maximum.toString()} ${sizing.unit ?? "elementer"}`;
89
+ return `For stor: forventede ${origin ?? "value"} havde ${adj} ${issue.maximum.toString()}`;
90
+ }
91
+ case "too_small": {
92
+ const adj = issue.inclusive ? ">=" : ">";
93
+ const sizing = getSizing(issue.origin);
94
+ const origin = getTypeName(issue.origin);
95
+ if (sizing) {
96
+ return `For lille: forventede ${origin} ${sizing.verb} ${adj} ${issue.minimum.toString()} ${sizing.unit}`;
97
+ }
98
+ return `For lille: forventede ${origin} havde ${adj} ${issue.minimum.toString()}`;
99
+ }
100
+ case "invalid_format": {
101
+ const _issue = issue;
102
+ if (_issue.format === "starts_with")
103
+ return `Ugyldig streng: skal starte med "${_issue.prefix}"`;
104
+ if (_issue.format === "ends_with")
105
+ return `Ugyldig streng: skal ende med "${_issue.suffix}"`;
106
+ if (_issue.format === "includes")
107
+ return `Ugyldig streng: skal indeholde "${_issue.includes}"`;
108
+ if (_issue.format === "regex")
109
+ return `Ugyldig streng: skal matche mønsteret ${_issue.pattern}`;
110
+ return `Ugyldig ${Nouns[_issue.format] ?? issue.format}`;
111
+ }
112
+ case "not_multiple_of":
113
+ return `Ugyldigt tal: skal være deleligt med ${issue.divisor}`;
114
+ case "unrecognized_keys":
115
+ return `${issue.keys.length > 1 ? "Ukendte nøgler" : "Ukendt nøgle"}: ${util.joinValues(issue.keys, ", ")}`;
116
+ case "invalid_key":
117
+ return `Ugyldig nøgle i ${issue.origin}`;
118
+ case "invalid_union":
119
+ return "Ugyldigt input: matcher ingen af de tilladte typer";
120
+ case "invalid_element":
121
+ return `Ugyldig værdi i ${issue.origin}`;
122
+ default:
123
+ return `Ugyldigt input`;
124
+ }
125
+ };
126
+ };
127
+ export default function () {
128
+ return {
129
+ localeError: error(),
130
+ };
131
+ }
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.zhTW = exports.zhCN = exports.vi = exports.ur = exports.ua = exports.tr = exports.th = exports.ta = exports.sv = exports.sl = exports.ru = exports.pt = exports.pl = exports.ps = exports.ota = exports.no = exports.nl = exports.ms = exports.mk = exports.ko = exports.kh = exports.ja = exports.it = exports.is = exports.id = exports.hu = exports.he = exports.frCA = exports.fr = exports.fi = exports.fa = exports.es = exports.eo = exports.en = exports.de = exports.cs = exports.ca = exports.be = exports.az = exports.ar = void 0;
6
+ exports.zhTW = exports.zhCN = exports.vi = exports.ur = exports.ua = exports.tr = exports.th = exports.ta = exports.sv = exports.sl = exports.ru = exports.pt = exports.pl = exports.ps = exports.ota = exports.no = exports.nl = exports.ms = exports.mk = exports.ko = exports.kh = exports.ja = exports.it = exports.is = exports.id = exports.hu = exports.he = exports.frCA = exports.fr = exports.fi = exports.fa = exports.es = exports.eo = exports.en = exports.de = exports.da = exports.cs = exports.ca = exports.be = exports.az = exports.ar = void 0;
7
7
  var ar_js_1 = require("./ar.cjs");
8
8
  Object.defineProperty(exports, "ar", { enumerable: true, get: function () { return __importDefault(ar_js_1).default; } });
9
9
  var az_js_1 = require("./az.cjs");
@@ -14,6 +14,8 @@ var ca_js_1 = require("./ca.cjs");
14
14
  Object.defineProperty(exports, "ca", { enumerable: true, get: function () { return __importDefault(ca_js_1).default; } });
15
15
  var cs_js_1 = require("./cs.cjs");
16
16
  Object.defineProperty(exports, "cs", { enumerable: true, get: function () { return __importDefault(cs_js_1).default; } });
17
+ var da_js_1 = require("./da.cjs");
18
+ Object.defineProperty(exports, "da", { enumerable: true, get: function () { return __importDefault(da_js_1).default; } });
17
19
  var de_js_1 = require("./de.cjs");
18
20
  Object.defineProperty(exports, "de", { enumerable: true, get: function () { return __importDefault(de_js_1).default; } });
19
21
  var en_js_1 = require("./en.cjs");
@@ -3,6 +3,7 @@ export { default as az } from "./az.cjs";
3
3
  export { default as be } from "./be.cjs";
4
4
  export { default as ca } from "./ca.cjs";
5
5
  export { default as cs } from "./cs.cjs";
6
+ export { default as da } from "./da.cjs";
6
7
  export { default as de } from "./de.cjs";
7
8
  export { default as en } from "./en.cjs";
8
9
  export { default as eo } from "./eo.cjs";
@@ -3,6 +3,7 @@ export { default as az } from "./az.js";
3
3
  export { default as be } from "./be.js";
4
4
  export { default as ca } from "./ca.js";
5
5
  export { default as cs } from "./cs.js";
6
+ export { default as da } from "./da.js";
6
7
  export { default as de } from "./de.js";
7
8
  export { default as en } from "./en.js";
8
9
  export { default as eo } from "./eo.js";
@@ -3,6 +3,7 @@ export { default as az } from "./az.js";
3
3
  export { default as be } from "./be.js";
4
4
  export { default as ca } from "./ca.js";
5
5
  export { default as cs } from "./cs.js";
6
+ export { default as da } from "./da.js";
6
7
  export { default as de } from "./de.js";
7
8
  export { default as en } from "./en.js";
8
9
  export { default as eo } from "./eo.js";