flavor-code 1.3.23 → 1.4.0-beta.1

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.
Files changed (134) hide show
  1. package/README.md +437 -434
  2. package/README.zh-CN.md +434 -431
  3. package/dist/{app-NTEUPJKJ.js → app-C5ZQUOKJ.js} +43 -155
  4. package/dist/astgraph/grammars.mjs +68 -68
  5. package/dist/astgraph/vendor/tree-sitter.js +3980 -3980
  6. package/dist/astgraph/vendor/zod/LICENSE +21 -21
  7. package/dist/astgraph/vendor/zod/index.js +4 -4
  8. package/dist/astgraph/vendor/zod/locales/index.js +1 -1
  9. package/dist/astgraph/vendor/zod/locales/package.json +7 -7
  10. package/dist/astgraph/vendor/zod/package.json +135 -135
  11. package/dist/astgraph/vendor/zod/v4/classic/checks.js +1 -1
  12. package/dist/astgraph/vendor/zod/v4/classic/coerce.js +17 -17
  13. package/dist/astgraph/vendor/zod/v4/classic/compat.js +31 -31
  14. package/dist/astgraph/vendor/zod/v4/classic/errors.js +48 -48
  15. package/dist/astgraph/vendor/zod/v4/classic/external.js +20 -20
  16. package/dist/astgraph/vendor/zod/v4/classic/from-json-schema.js +599 -599
  17. package/dist/astgraph/vendor/zod/v4/classic/index.js +4 -4
  18. package/dist/astgraph/vendor/zod/v4/classic/iso.js +30 -30
  19. package/dist/astgraph/vendor/zod/v4/classic/package.json +7 -7
  20. package/dist/astgraph/vendor/zod/v4/classic/parse.js +15 -15
  21. package/dist/astgraph/vendor/zod/v4/classic/schemas.js +1395 -1395
  22. package/dist/astgraph/vendor/zod/v4/core/api.js +1087 -1087
  23. package/dist/astgraph/vendor/zod/v4/core/checks.js +575 -575
  24. package/dist/astgraph/vendor/zod/v4/core/core.js +78 -78
  25. package/dist/astgraph/vendor/zod/v4/core/doc.js +35 -35
  26. package/dist/astgraph/vendor/zod/v4/core/errors.js +185 -185
  27. package/dist/astgraph/vendor/zod/v4/core/index.js +16 -16
  28. package/dist/astgraph/vendor/zod/v4/core/json-schema-generator.js +95 -95
  29. package/dist/astgraph/vendor/zod/v4/core/json-schema-processors.js +601 -601
  30. package/dist/astgraph/vendor/zod/v4/core/json-schema.js +1 -1
  31. package/dist/astgraph/vendor/zod/v4/core/package.json +7 -7
  32. package/dist/astgraph/vendor/zod/v4/core/parse.js +93 -93
  33. package/dist/astgraph/vendor/zod/v4/core/regexes.js +139 -139
  34. package/dist/astgraph/vendor/zod/v4/core/registries.js +51 -51
  35. package/dist/astgraph/vendor/zod/v4/core/schemas.js +2239 -2239
  36. package/dist/astgraph/vendor/zod/v4/core/standard-schema.js +1 -1
  37. package/dist/astgraph/vendor/zod/v4/core/to-json-schema.js +448 -448
  38. package/dist/astgraph/vendor/zod/v4/core/util.js +674 -674
  39. package/dist/astgraph/vendor/zod/v4/core/versions.js +5 -5
  40. package/dist/astgraph/vendor/zod/v4/index.js +3 -3
  41. package/dist/astgraph/vendor/zod/v4/locales/ar.js +106 -106
  42. package/dist/astgraph/vendor/zod/v4/locales/az.js +105 -105
  43. package/dist/astgraph/vendor/zod/v4/locales/be.js +156 -156
  44. package/dist/astgraph/vendor/zod/v4/locales/bg.js +120 -120
  45. package/dist/astgraph/vendor/zod/v4/locales/ca.js +107 -107
  46. package/dist/astgraph/vendor/zod/v4/locales/cs.js +111 -111
  47. package/dist/astgraph/vendor/zod/v4/locales/da.js +115 -115
  48. package/dist/astgraph/vendor/zod/v4/locales/de.js +108 -108
  49. package/dist/astgraph/vendor/zod/v4/locales/el.js +109 -109
  50. package/dist/astgraph/vendor/zod/v4/locales/en.js +113 -113
  51. package/dist/astgraph/vendor/zod/v4/locales/eo.js +109 -109
  52. package/dist/astgraph/vendor/zod/v4/locales/es.js +132 -132
  53. package/dist/astgraph/vendor/zod/v4/locales/fa.js +114 -114
  54. package/dist/astgraph/vendor/zod/v4/locales/fi.js +112 -112
  55. package/dist/astgraph/vendor/zod/v4/locales/fr-CA.js +107 -107
  56. package/dist/astgraph/vendor/zod/v4/locales/fr.js +125 -125
  57. package/dist/astgraph/vendor/zod/v4/locales/he.js +214 -214
  58. package/dist/astgraph/vendor/zod/v4/locales/hr.js +122 -122
  59. package/dist/astgraph/vendor/zod/v4/locales/hu.js +108 -108
  60. package/dist/astgraph/vendor/zod/v4/locales/hy.js +147 -147
  61. package/dist/astgraph/vendor/zod/v4/locales/id.js +106 -106
  62. package/dist/astgraph/vendor/zod/v4/locales/index.js +52 -52
  63. package/dist/astgraph/vendor/zod/v4/locales/is.js +109 -109
  64. package/dist/astgraph/vendor/zod/v4/locales/it.js +108 -108
  65. package/dist/astgraph/vendor/zod/v4/locales/ja.js +107 -107
  66. package/dist/astgraph/vendor/zod/v4/locales/ka.js +112 -112
  67. package/dist/astgraph/vendor/zod/v4/locales/kh.js +5 -5
  68. package/dist/astgraph/vendor/zod/v4/locales/km.js +110 -110
  69. package/dist/astgraph/vendor/zod/v4/locales/ko.js +111 -111
  70. package/dist/astgraph/vendor/zod/v4/locales/lt.js +203 -203
  71. package/dist/astgraph/vendor/zod/v4/locales/mk.js +109 -109
  72. package/dist/astgraph/vendor/zod/v4/locales/ms.js +107 -107
  73. package/dist/astgraph/vendor/zod/v4/locales/nl.js +110 -110
  74. package/dist/astgraph/vendor/zod/v4/locales/no.js +108 -108
  75. package/dist/astgraph/vendor/zod/v4/locales/ota.js +109 -109
  76. package/dist/astgraph/vendor/zod/v4/locales/package.json +7 -7
  77. package/dist/astgraph/vendor/zod/v4/locales/pl.js +109 -109
  78. package/dist/astgraph/vendor/zod/v4/locales/ps.js +114 -114
  79. package/dist/astgraph/vendor/zod/v4/locales/pt.js +108 -108
  80. package/dist/astgraph/vendor/zod/v4/locales/ro.js +119 -119
  81. package/dist/astgraph/vendor/zod/v4/locales/ru.js +156 -156
  82. package/dist/astgraph/vendor/zod/v4/locales/sl.js +109 -109
  83. package/dist/astgraph/vendor/zod/v4/locales/sv.js +110 -110
  84. package/dist/astgraph/vendor/zod/v4/locales/ta.js +110 -110
  85. package/dist/astgraph/vendor/zod/v4/locales/th.js +110 -110
  86. package/dist/astgraph/vendor/zod/v4/locales/tr.js +105 -105
  87. package/dist/astgraph/vendor/zod/v4/locales/ua.js +5 -5
  88. package/dist/astgraph/vendor/zod/v4/locales/uk.js +108 -108
  89. package/dist/astgraph/vendor/zod/v4/locales/ur.js +110 -110
  90. package/dist/astgraph/vendor/zod/v4/locales/uz.js +110 -110
  91. package/dist/astgraph/vendor/zod/v4/locales/vi.js +108 -108
  92. package/dist/astgraph/vendor/zod/v4/locales/yo.js +107 -107
  93. package/dist/astgraph/vendor/zod/v4/locales/zh-CN.js +109 -109
  94. package/dist/astgraph/vendor/zod/v4/locales/zh-TW.js +107 -107
  95. package/dist/astgraph/vendor/zod/v4/mini/checks.js +1 -1
  96. package/dist/astgraph/vendor/zod/v4/mini/coerce.js +22 -22
  97. package/dist/astgraph/vendor/zod/v4/mini/external.js +14 -14
  98. package/dist/astgraph/vendor/zod/v4/mini/index.js +3 -3
  99. package/dist/astgraph/vendor/zod/v4/mini/iso.js +34 -34
  100. package/dist/astgraph/vendor/zod/v4/mini/package.json +7 -7
  101. package/dist/astgraph/vendor/zod/v4/mini/parse.js +1 -1
  102. package/dist/astgraph/vendor/zod/v4/mini/schemas.js +961 -961
  103. package/dist/astgraph/vendor/zod/v4/package.json +7 -7
  104. package/dist/{chunk-7OICVL2M.js → chunk-2BF7CVWZ.js} +0 -42
  105. package/dist/{chunk-RQTYHUMK.js → chunk-3WCDZ6ZL.js} +15 -0
  106. package/dist/{chunk-Z62P4LL7.js → chunk-6MNOZ2TX.js} +8962 -8422
  107. package/dist/{chunk-VEUSROUQ.js → chunk-FOTMP4ZS.js} +1 -1
  108. package/dist/{chunk-SUSLIHXO.js → chunk-ODRWR4KK.js} +1 -1
  109. package/dist/{chunk-RPFWB45Y.js → chunk-URUVFECH.js} +1 -1
  110. package/dist/{claude-ink-6CEG2XZZ.js → claude-ink-LP32NSX5.js} +2 -3
  111. package/dist/cli-main.js +27 -11
  112. package/dist/config/load.d.ts +2 -0
  113. package/dist/desktop/main.js +1092 -541
  114. package/dist/desktop-renderer/assets/index-Bk6FYhyh.css +1 -0
  115. package/dist/desktop-renderer/assets/{index-D75ozXnZ.js → index-CqRIr-hz.js} +3 -3
  116. package/dist/desktop-renderer/assets/{interactive-terminal-CTFo4fK9.js → interactive-terminal-C4o7MNPO.js} +1 -1
  117. package/dist/desktop-renderer/index.html +2 -2
  118. package/dist/doctor.d.ts +38 -0
  119. package/dist/execution/docker.d.ts +5 -1
  120. package/dist/execution/types.d.ts +11 -0
  121. package/dist/jobs/registry.d.ts +1 -0
  122. package/dist/{load-4FWNXE6F.js → load-V2UIYYQI.js} +1 -1
  123. package/dist/sdk/index.js +4 -4
  124. package/dist/tools/shell.d.ts +17 -12
  125. package/dist/tools/types.d.ts +1 -0
  126. package/dist/ui/commands.d.ts +1 -1
  127. package/dist/ui/session.d.ts +1 -0
  128. package/dist/update/check.d.ts +20 -0
  129. package/dist/utils/semver.d.ts +3 -0
  130. package/dist/utils/spawn-executable.d.ts +2 -0
  131. package/package.json +1 -1
  132. package//346/212/200/346/234/257/346/226/271/346/241/210/346/212/245/345/221/212.md +5848 -5848
  133. package/dist/chunk-OTYFL4AG.js +0 -16
  134. package/dist/desktop-renderer/assets/index-ZZsUx916.css +0 -1
@@ -1,114 +1,114 @@
1
- import * as util from "../core/util.js";
2
- const error = () => {
3
- const Sizable = {
4
- string: { unit: "کاراکتر", verb: "داشته باشد" },
5
- file: { unit: "بایت", verb: "داشته باشد" },
6
- array: { unit: "آیتم", verb: "داشته باشد" },
7
- set: { unit: "آیتم", verb: "داشته باشد" },
8
- };
9
- function getSizing(origin) {
10
- return Sizable[origin] ?? null;
11
- }
12
- const FormatDictionary = {
13
- regex: "ورودی",
14
- email: "آدرس ایمیل",
15
- url: "URL",
16
- emoji: "ایموجی",
17
- uuid: "UUID",
18
- uuidv4: "UUIDv4",
19
- uuidv6: "UUIDv6",
20
- nanoid: "nanoid",
21
- guid: "GUID",
22
- cuid: "cuid",
23
- cuid2: "cuid2",
24
- ulid: "ULID",
25
- xid: "XID",
26
- ksuid: "KSUID",
27
- datetime: "تاریخ و زمان ایزو",
28
- date: "تاریخ ایزو",
29
- time: "زمان ایزو",
30
- duration: "مدت زمان ایزو",
31
- ipv4: "IPv4 آدرس",
32
- ipv6: "IPv6 آدرس",
33
- cidrv4: "IPv4 دامنه",
34
- cidrv6: "IPv6 دامنه",
35
- base64: "base64-encoded رشته",
36
- base64url: "base64url-encoded رشته",
37
- json_string: "JSON رشته",
38
- e164: "E.164 عدد",
39
- jwt: "JWT",
40
- template_literal: "ورودی",
41
- };
42
- const TypeDictionary = {
43
- nan: "NaN",
44
- number: "عدد",
45
- array: "آرایه",
46
- };
47
- return (issue) => {
48
- switch (issue.code) {
49
- case "invalid_type": {
50
- const expected = TypeDictionary[issue.expected] ?? issue.expected;
51
- const receivedType = util.parsedType(issue.input);
52
- const received = TypeDictionary[receivedType] ?? receivedType;
53
- if (/^[A-Z]/.test(issue.expected)) {
54
- return `ورودی نامعتبر: می‌بایست instanceof ${issue.expected} می‌بود، ${received} دریافت شد`;
55
- }
56
- return `ورودی نامعتبر: می‌بایست ${expected} می‌بود، ${received} دریافت شد`;
57
- }
58
- case "invalid_value":
59
- if (issue.values.length === 1) {
60
- return `ورودی نامعتبر: می‌بایست ${util.stringifyPrimitive(issue.values[0])} می‌بود`;
61
- }
62
- return `گزینه نامعتبر: می‌بایست یکی از ${util.joinValues(issue.values, "|")} می‌بود`;
63
- case "too_big": {
64
- const adj = issue.inclusive ? "<=" : "<";
65
- const sizing = getSizing(issue.origin);
66
- if (sizing) {
67
- return `خیلی بزرگ: ${issue.origin ?? "مقدار"} باید ${adj}${issue.maximum.toString()} ${sizing.unit ?? "عنصر"} باشد`;
68
- }
69
- return `خیلی بزرگ: ${issue.origin ?? "مقدار"} باید ${adj}${issue.maximum.toString()} باشد`;
70
- }
71
- case "too_small": {
72
- const adj = issue.inclusive ? ">=" : ">";
73
- const sizing = getSizing(issue.origin);
74
- if (sizing) {
75
- return `خیلی کوچک: ${issue.origin} باید ${adj}${issue.minimum.toString()} ${sizing.unit} باشد`;
76
- }
77
- return `خیلی کوچک: ${issue.origin} باید ${adj}${issue.minimum.toString()} باشد`;
78
- }
79
- case "invalid_format": {
80
- const _issue = issue;
81
- if (_issue.format === "starts_with") {
82
- return `رشته نامعتبر: باید با "${_issue.prefix}" شروع شود`;
83
- }
84
- if (_issue.format === "ends_with") {
85
- return `رشته نامعتبر: باید با "${_issue.suffix}" تمام شود`;
86
- }
87
- if (_issue.format === "includes") {
88
- return `رشته نامعتبر: باید شامل "${_issue.includes}" باشد`;
89
- }
90
- if (_issue.format === "regex") {
91
- return `رشته نامعتبر: باید با الگوی ${_issue.pattern} مطابقت داشته باشد`;
92
- }
93
- return `${FormatDictionary[_issue.format] ?? issue.format} نامعتبر`;
94
- }
95
- case "not_multiple_of":
96
- return `عدد نامعتبر: باید مضرب ${issue.divisor} باشد`;
97
- case "unrecognized_keys":
98
- return `کلید${issue.keys.length > 1 ? "های" : ""} ناشناس: ${util.joinValues(issue.keys, ", ")}`;
99
- case "invalid_key":
100
- return `کلید ناشناس در ${issue.origin}`;
101
- case "invalid_union":
102
- return `ورودی نامعتبر`;
103
- case "invalid_element":
104
- return `مقدار نامعتبر در ${issue.origin}`;
105
- default:
106
- return `ورودی نامعتبر`;
107
- }
108
- };
109
- };
110
- export default function () {
111
- return {
112
- localeError: error(),
113
- };
114
- }
1
+ import * as util from "../core/util.js";
2
+ const error = () => {
3
+ const Sizable = {
4
+ string: { unit: "کاراکتر", verb: "داشته باشد" },
5
+ file: { unit: "بایت", verb: "داشته باشد" },
6
+ array: { unit: "آیتم", verb: "داشته باشد" },
7
+ set: { unit: "آیتم", verb: "داشته باشد" },
8
+ };
9
+ function getSizing(origin) {
10
+ return Sizable[origin] ?? null;
11
+ }
12
+ const FormatDictionary = {
13
+ regex: "ورودی",
14
+ email: "آدرس ایمیل",
15
+ url: "URL",
16
+ emoji: "ایموجی",
17
+ uuid: "UUID",
18
+ uuidv4: "UUIDv4",
19
+ uuidv6: "UUIDv6",
20
+ nanoid: "nanoid",
21
+ guid: "GUID",
22
+ cuid: "cuid",
23
+ cuid2: "cuid2",
24
+ ulid: "ULID",
25
+ xid: "XID",
26
+ ksuid: "KSUID",
27
+ datetime: "تاریخ و زمان ایزو",
28
+ date: "تاریخ ایزو",
29
+ time: "زمان ایزو",
30
+ duration: "مدت زمان ایزو",
31
+ ipv4: "IPv4 آدرس",
32
+ ipv6: "IPv6 آدرس",
33
+ cidrv4: "IPv4 دامنه",
34
+ cidrv6: "IPv6 دامنه",
35
+ base64: "base64-encoded رشته",
36
+ base64url: "base64url-encoded رشته",
37
+ json_string: "JSON رشته",
38
+ e164: "E.164 عدد",
39
+ jwt: "JWT",
40
+ template_literal: "ورودی",
41
+ };
42
+ const TypeDictionary = {
43
+ nan: "NaN",
44
+ number: "عدد",
45
+ array: "آرایه",
46
+ };
47
+ return (issue) => {
48
+ switch (issue.code) {
49
+ case "invalid_type": {
50
+ const expected = TypeDictionary[issue.expected] ?? issue.expected;
51
+ const receivedType = util.parsedType(issue.input);
52
+ const received = TypeDictionary[receivedType] ?? receivedType;
53
+ if (/^[A-Z]/.test(issue.expected)) {
54
+ return `ورودی نامعتبر: می‌بایست instanceof ${issue.expected} می‌بود، ${received} دریافت شد`;
55
+ }
56
+ return `ورودی نامعتبر: می‌بایست ${expected} می‌بود، ${received} دریافت شد`;
57
+ }
58
+ case "invalid_value":
59
+ if (issue.values.length === 1) {
60
+ return `ورودی نامعتبر: می‌بایست ${util.stringifyPrimitive(issue.values[0])} می‌بود`;
61
+ }
62
+ return `گزینه نامعتبر: می‌بایست یکی از ${util.joinValues(issue.values, "|")} می‌بود`;
63
+ case "too_big": {
64
+ const adj = issue.inclusive ? "<=" : "<";
65
+ const sizing = getSizing(issue.origin);
66
+ if (sizing) {
67
+ return `خیلی بزرگ: ${issue.origin ?? "مقدار"} باید ${adj}${issue.maximum.toString()} ${sizing.unit ?? "عنصر"} باشد`;
68
+ }
69
+ return `خیلی بزرگ: ${issue.origin ?? "مقدار"} باید ${adj}${issue.maximum.toString()} باشد`;
70
+ }
71
+ case "too_small": {
72
+ const adj = issue.inclusive ? ">=" : ">";
73
+ const sizing = getSizing(issue.origin);
74
+ if (sizing) {
75
+ return `خیلی کوچک: ${issue.origin} باید ${adj}${issue.minimum.toString()} ${sizing.unit} باشد`;
76
+ }
77
+ return `خیلی کوچک: ${issue.origin} باید ${adj}${issue.minimum.toString()} باشد`;
78
+ }
79
+ case "invalid_format": {
80
+ const _issue = issue;
81
+ if (_issue.format === "starts_with") {
82
+ return `رشته نامعتبر: باید با "${_issue.prefix}" شروع شود`;
83
+ }
84
+ if (_issue.format === "ends_with") {
85
+ return `رشته نامعتبر: باید با "${_issue.suffix}" تمام شود`;
86
+ }
87
+ if (_issue.format === "includes") {
88
+ return `رشته نامعتبر: باید شامل "${_issue.includes}" باشد`;
89
+ }
90
+ if (_issue.format === "regex") {
91
+ return `رشته نامعتبر: باید با الگوی ${_issue.pattern} مطابقت داشته باشد`;
92
+ }
93
+ return `${FormatDictionary[_issue.format] ?? issue.format} نامعتبر`;
94
+ }
95
+ case "not_multiple_of":
96
+ return `عدد نامعتبر: باید مضرب ${issue.divisor} باشد`;
97
+ case "unrecognized_keys":
98
+ return `کلید${issue.keys.length > 1 ? "های" : ""} ناشناس: ${util.joinValues(issue.keys, ", ")}`;
99
+ case "invalid_key":
100
+ return `کلید ناشناس در ${issue.origin}`;
101
+ case "invalid_union":
102
+ return `ورودی نامعتبر`;
103
+ case "invalid_element":
104
+ return `مقدار نامعتبر در ${issue.origin}`;
105
+ default:
106
+ return `ورودی نامعتبر`;
107
+ }
108
+ };
109
+ };
110
+ export default function () {
111
+ return {
112
+ localeError: error(),
113
+ };
114
+ }
@@ -1,112 +1,112 @@
1
- import * as util from "../core/util.js";
2
- const error = () => {
3
- const Sizable = {
4
- string: { unit: "merkkiä", subject: "merkkijonon" },
5
- file: { unit: "tavua", subject: "tiedoston" },
6
- array: { unit: "alkiota", subject: "listan" },
7
- set: { unit: "alkiota", subject: "joukon" },
8
- number: { unit: "", subject: "luvun" },
9
- bigint: { unit: "", subject: "suuren kokonaisluvun" },
10
- int: { unit: "", subject: "kokonaisluvun" },
11
- date: { unit: "", subject: "päivämäärän" },
12
- };
13
- function getSizing(origin) {
14
- return Sizable[origin] ?? null;
15
- }
16
- const FormatDictionary = {
17
- regex: "säännöllinen lauseke",
18
- email: "sähköpostiosoite",
19
- url: "URL-osoite",
20
- emoji: "emoji",
21
- uuid: "UUID",
22
- uuidv4: "UUIDv4",
23
- uuidv6: "UUIDv6",
24
- nanoid: "nanoid",
25
- guid: "GUID",
26
- cuid: "cuid",
27
- cuid2: "cuid2",
28
- ulid: "ULID",
29
- xid: "XID",
30
- ksuid: "KSUID",
31
- datetime: "ISO-aikaleima",
32
- date: "ISO-päivämäärä",
33
- time: "ISO-aika",
34
- duration: "ISO-kesto",
35
- ipv4: "IPv4-osoite",
36
- ipv6: "IPv6-osoite",
37
- cidrv4: "IPv4-alue",
38
- cidrv6: "IPv6-alue",
39
- base64: "base64-koodattu merkkijono",
40
- base64url: "base64url-koodattu merkkijono",
41
- json_string: "JSON-merkkijono",
42
- e164: "E.164-luku",
43
- jwt: "JWT",
44
- template_literal: "templaattimerkkijono",
45
- };
46
- const TypeDictionary = {
47
- nan: "NaN",
48
- };
49
- return (issue) => {
50
- switch (issue.code) {
51
- case "invalid_type": {
52
- const expected = TypeDictionary[issue.expected] ?? issue.expected;
53
- const receivedType = util.parsedType(issue.input);
54
- const received = TypeDictionary[receivedType] ?? receivedType;
55
- if (/^[A-Z]/.test(issue.expected)) {
56
- return `Virheellinen tyyppi: odotettiin instanceof ${issue.expected}, oli ${received}`;
57
- }
58
- return `Virheellinen tyyppi: odotettiin ${expected}, oli ${received}`;
59
- }
60
- case "invalid_value":
61
- if (issue.values.length === 1)
62
- return `Virheellinen syöte: täytyy olla ${util.stringifyPrimitive(issue.values[0])}`;
63
- return `Virheellinen valinta: täytyy olla yksi seuraavista: ${util.joinValues(issue.values, "|")}`;
64
- case "too_big": {
65
- const adj = issue.inclusive ? "<=" : "<";
66
- const sizing = getSizing(issue.origin);
67
- if (sizing) {
68
- return `Liian suuri: ${sizing.subject} täytyy olla ${adj}${issue.maximum.toString()} ${sizing.unit}`.trim();
69
- }
70
- return `Liian suuri: arvon täytyy olla ${adj}${issue.maximum.toString()}`;
71
- }
72
- case "too_small": {
73
- const adj = issue.inclusive ? ">=" : ">";
74
- const sizing = getSizing(issue.origin);
75
- if (sizing) {
76
- return `Liian pieni: ${sizing.subject} täytyy olla ${adj}${issue.minimum.toString()} ${sizing.unit}`.trim();
77
- }
78
- return `Liian pieni: arvon täytyy olla ${adj}${issue.minimum.toString()}`;
79
- }
80
- case "invalid_format": {
81
- const _issue = issue;
82
- if (_issue.format === "starts_with")
83
- return `Virheellinen syöte: täytyy alkaa "${_issue.prefix}"`;
84
- if (_issue.format === "ends_with")
85
- return `Virheellinen syöte: täytyy loppua "${_issue.suffix}"`;
86
- if (_issue.format === "includes")
87
- return `Virheellinen syöte: täytyy sisältää "${_issue.includes}"`;
88
- if (_issue.format === "regex") {
89
- return `Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${_issue.pattern}`;
90
- }
91
- return `Virheellinen ${FormatDictionary[_issue.format] ?? issue.format}`;
92
- }
93
- case "not_multiple_of":
94
- return `Virheellinen luku: täytyy olla luvun ${issue.divisor} monikerta`;
95
- case "unrecognized_keys":
96
- return `${issue.keys.length > 1 ? "Tuntemattomat avaimet" : "Tuntematon avain"}: ${util.joinValues(issue.keys, ", ")}`;
97
- case "invalid_key":
98
- return "Virheellinen avain tietueessa";
99
- case "invalid_union":
100
- return "Virheellinen unioni";
101
- case "invalid_element":
102
- return "Virheellinen arvo joukossa";
103
- default:
104
- return `Virheellinen syöte`;
105
- }
106
- };
107
- };
108
- export default function () {
109
- return {
110
- localeError: error(),
111
- };
112
- }
1
+ import * as util from "../core/util.js";
2
+ const error = () => {
3
+ const Sizable = {
4
+ string: { unit: "merkkiä", subject: "merkkijonon" },
5
+ file: { unit: "tavua", subject: "tiedoston" },
6
+ array: { unit: "alkiota", subject: "listan" },
7
+ set: { unit: "alkiota", subject: "joukon" },
8
+ number: { unit: "", subject: "luvun" },
9
+ bigint: { unit: "", subject: "suuren kokonaisluvun" },
10
+ int: { unit: "", subject: "kokonaisluvun" },
11
+ date: { unit: "", subject: "päivämäärän" },
12
+ };
13
+ function getSizing(origin) {
14
+ return Sizable[origin] ?? null;
15
+ }
16
+ const FormatDictionary = {
17
+ regex: "säännöllinen lauseke",
18
+ email: "sähköpostiosoite",
19
+ url: "URL-osoite",
20
+ emoji: "emoji",
21
+ uuid: "UUID",
22
+ uuidv4: "UUIDv4",
23
+ uuidv6: "UUIDv6",
24
+ nanoid: "nanoid",
25
+ guid: "GUID",
26
+ cuid: "cuid",
27
+ cuid2: "cuid2",
28
+ ulid: "ULID",
29
+ xid: "XID",
30
+ ksuid: "KSUID",
31
+ datetime: "ISO-aikaleima",
32
+ date: "ISO-päivämäärä",
33
+ time: "ISO-aika",
34
+ duration: "ISO-kesto",
35
+ ipv4: "IPv4-osoite",
36
+ ipv6: "IPv6-osoite",
37
+ cidrv4: "IPv4-alue",
38
+ cidrv6: "IPv6-alue",
39
+ base64: "base64-koodattu merkkijono",
40
+ base64url: "base64url-koodattu merkkijono",
41
+ json_string: "JSON-merkkijono",
42
+ e164: "E.164-luku",
43
+ jwt: "JWT",
44
+ template_literal: "templaattimerkkijono",
45
+ };
46
+ const TypeDictionary = {
47
+ nan: "NaN",
48
+ };
49
+ return (issue) => {
50
+ switch (issue.code) {
51
+ case "invalid_type": {
52
+ const expected = TypeDictionary[issue.expected] ?? issue.expected;
53
+ const receivedType = util.parsedType(issue.input);
54
+ const received = TypeDictionary[receivedType] ?? receivedType;
55
+ if (/^[A-Z]/.test(issue.expected)) {
56
+ return `Virheellinen tyyppi: odotettiin instanceof ${issue.expected}, oli ${received}`;
57
+ }
58
+ return `Virheellinen tyyppi: odotettiin ${expected}, oli ${received}`;
59
+ }
60
+ case "invalid_value":
61
+ if (issue.values.length === 1)
62
+ return `Virheellinen syöte: täytyy olla ${util.stringifyPrimitive(issue.values[0])}`;
63
+ return `Virheellinen valinta: täytyy olla yksi seuraavista: ${util.joinValues(issue.values, "|")}`;
64
+ case "too_big": {
65
+ const adj = issue.inclusive ? "<=" : "<";
66
+ const sizing = getSizing(issue.origin);
67
+ if (sizing) {
68
+ return `Liian suuri: ${sizing.subject} täytyy olla ${adj}${issue.maximum.toString()} ${sizing.unit}`.trim();
69
+ }
70
+ return `Liian suuri: arvon täytyy olla ${adj}${issue.maximum.toString()}`;
71
+ }
72
+ case "too_small": {
73
+ const adj = issue.inclusive ? ">=" : ">";
74
+ const sizing = getSizing(issue.origin);
75
+ if (sizing) {
76
+ return `Liian pieni: ${sizing.subject} täytyy olla ${adj}${issue.minimum.toString()} ${sizing.unit}`.trim();
77
+ }
78
+ return `Liian pieni: arvon täytyy olla ${adj}${issue.minimum.toString()}`;
79
+ }
80
+ case "invalid_format": {
81
+ const _issue = issue;
82
+ if (_issue.format === "starts_with")
83
+ return `Virheellinen syöte: täytyy alkaa "${_issue.prefix}"`;
84
+ if (_issue.format === "ends_with")
85
+ return `Virheellinen syöte: täytyy loppua "${_issue.suffix}"`;
86
+ if (_issue.format === "includes")
87
+ return `Virheellinen syöte: täytyy sisältää "${_issue.includes}"`;
88
+ if (_issue.format === "regex") {
89
+ return `Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${_issue.pattern}`;
90
+ }
91
+ return `Virheellinen ${FormatDictionary[_issue.format] ?? issue.format}`;
92
+ }
93
+ case "not_multiple_of":
94
+ return `Virheellinen luku: täytyy olla luvun ${issue.divisor} monikerta`;
95
+ case "unrecognized_keys":
96
+ return `${issue.keys.length > 1 ? "Tuntemattomat avaimet" : "Tuntematon avain"}: ${util.joinValues(issue.keys, ", ")}`;
97
+ case "invalid_key":
98
+ return "Virheellinen avain tietueessa";
99
+ case "invalid_union":
100
+ return "Virheellinen unioni";
101
+ case "invalid_element":
102
+ return "Virheellinen arvo joukossa";
103
+ default:
104
+ return `Virheellinen syöte`;
105
+ }
106
+ };
107
+ };
108
+ export default function () {
109
+ return {
110
+ localeError: error(),
111
+ };
112
+ }