@joe-broadhead/messaging 0.0.0-stage → 0.7.0
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/CHANGELOG.md +175 -0
- package/LICENSE +21 -0
- package/NOTICE +12 -0
- package/README.md +36 -2
- package/dist/bin/messaging-mcp.js +25887 -0
- package/dist/bin/messaging-relay.js +19014 -0
- package/dist/bin/messaging.js +14732 -0
- package/dist/bin/messagingd.js +28682 -0
- package/dist/lib/core-testing.js +1 -0
- package/dist/lib/core.js +1 -0
- package/dist/lib/ipc-testing.js +1 -0
- package/dist/lib/ipc.js +1 -0
- package/dist/lib/modules/core/address.js +42 -0
- package/dist/lib/modules/core/agent/operations.js +595 -0
- package/dist/lib/modules/core/agent/present.js +244 -0
- package/dist/lib/modules/core/agent/text.js +79 -0
- package/dist/lib/modules/core/agent-tools.js +458 -0
- package/dist/lib/modules/core/b64u.js +20 -0
- package/dist/lib/modules/core/cards.js +55 -0
- package/dist/lib/modules/core/check.js +20 -0
- package/dist/lib/modules/core/consent.js +199 -0
- package/dist/lib/modules/core/contact-card.js +74 -0
- package/dist/lib/modules/core/delegation.js +174 -0
- package/dist/lib/modules/core/directory/device-log.js +258 -0
- package/dist/lib/modules/core/directory/epoch.js +103 -0
- package/dist/lib/modules/core/directory/handle.js +29 -0
- package/dist/lib/modules/core/directory/jelly-device.js +204 -0
- package/dist/lib/modules/core/directory/jelly-issuer.js +12 -0
- package/dist/lib/modules/core/directory/jelly-token.js +305 -0
- package/dist/lib/modules/core/directory/keys-statement.js +43 -0
- package/dist/lib/modules/core/directory/link.js +81 -0
- package/dist/lib/modules/core/directory/merkle-log.js +250 -0
- package/dist/lib/modules/core/directory/person-view.js +197 -0
- package/dist/lib/modules/core/directory/person.js +40 -0
- package/dist/lib/modules/core/directory/realm.js +59 -0
- package/dist/lib/modules/core/directory/smt.js +266 -0
- package/dist/lib/modules/core/envelope.js +320 -0
- package/dist/lib/modules/core/hash.js +5 -0
- package/dist/lib/modules/core/head.js +27 -0
- package/dist/lib/modules/core/identity.js +71 -0
- package/dist/lib/modules/core/index.js +44 -0
- package/dist/lib/modules/core/jcs.js +96 -0
- package/dist/lib/modules/core/jelly-host-double.js +35 -0
- package/dist/lib/modules/core/jelly-host.js +211 -0
- package/dist/lib/modules/core/keys.js +79 -0
- package/dist/lib/modules/core/peer-text.js +563 -0
- package/dist/lib/modules/core/realm.js +1 -0
- package/dist/lib/modules/core/roster.js +454 -0
- package/dist/lib/modules/core/schema/a2a.js +85 -0
- package/dist/lib/modules/core/schema/common.js +254 -0
- package/dist/lib/modules/core/schema/consent.js +120 -0
- package/dist/lib/modules/core/schema/delegation.js +58 -0
- package/dist/lib/modules/core/schema/directory-frames.js +270 -0
- package/dist/lib/modules/core/schema/directory.js +169 -0
- package/dist/lib/modules/core/schema/envelope.js +211 -0
- package/dist/lib/modules/core/schema/errors.js +65 -0
- package/dist/lib/modules/core/schema/index.js +15 -0
- package/dist/lib/modules/core/schema/ipc/consent.js +181 -0
- package/dist/lib/modules/core/schema/ipc/device.js +276 -0
- package/dist/lib/modules/core/schema/ipc/jelly.js +189 -0
- package/dist/lib/modules/core/schema/ipc/shapes.js +185 -0
- package/dist/lib/modules/core/schema/ipc/surfaces.js +223 -0
- package/dist/lib/modules/core/schema/ipc.js +451 -0
- package/dist/lib/modules/core/schema/jelly.js +122 -0
- package/dist/lib/modules/core/schema/realm.js +27 -0
- package/dist/lib/modules/core/schema/relay.js +112 -0
- package/dist/lib/modules/core/schema/roster.js +126 -0
- package/dist/lib/modules/core/sign.js +43 -0
- package/dist/lib/modules/core/task.js +37 -0
- package/dist/lib/modules/core/testing.js +20 -0
- package/dist/lib/modules/core/ulid.js +36 -0
- package/dist/lib/modules/core/version.js +6 -0
- package/dist/lib/modules/core/wire.js +255 -0
- package/dist/lib/modules/ipc/client.js +289 -0
- package/dist/lib/modules/ipc/framing.js +33 -0
- package/dist/lib/modules/ipc/index.js +6 -0
- package/dist/lib/modules/ipc/paths.js +102 -0
- package/dist/lib/modules/ipc/pipes.js +65 -0
- package/dist/lib/modules/ipc/rpc.js +8 -0
- package/dist/lib/modules/ipc/server.js +317 -0
- package/dist/lib/modules/ipc/testing.js +145 -0
- package/dist/lib/modules/ipc/trust.js +166 -0
- package/dist/lib/modules/ipc/windows-acl.js +275 -0
- package/dist/lib/modules/vendor/zod/index.js +7 -0
- package/dist/lib/modules/vendor/zod/v4/classic/checks.js +1 -0
- package/dist/lib/modules/vendor/zod/v4/classic/coerce.js +17 -0
- package/dist/lib/modules/vendor/zod/v4/classic/compat.js +31 -0
- package/dist/lib/modules/vendor/zod/v4/classic/deep-partial.js +13 -0
- package/dist/lib/modules/vendor/zod/v4/classic/errors.js +57 -0
- package/dist/lib/modules/vendor/zod/v4/classic/external.js +17 -0
- package/dist/lib/modules/vendor/zod/v4/classic/from-json-schema.js +881 -0
- package/dist/lib/modules/vendor/zod/v4/classic/in-out.js +36 -0
- package/dist/lib/modules/vendor/zod/v4/classic/iso.js +15 -0
- package/dist/lib/modules/vendor/zod/v4/classic/parse.js +16 -0
- package/dist/lib/modules/vendor/zod/v4/classic/schemas.js +1535 -0
- package/dist/lib/modules/vendor/zod/v4/core/api.js +1107 -0
- package/dist/lib/modules/vendor/zod/v4/core/checks.js +516 -0
- package/dist/lib/modules/vendor/zod/v4/core/compile.js +1866 -0
- package/dist/lib/modules/vendor/zod/v4/core/core.js +141 -0
- package/dist/lib/modules/vendor/zod/v4/core/doc.js +38 -0
- package/dist/lib/modules/vendor/zod/v4/core/errors.js +267 -0
- package/dist/lib/modules/vendor/zod/v4/core/index.js +19 -0
- package/dist/lib/modules/vendor/zod/v4/core/json-schema-generator.js +99 -0
- package/dist/lib/modules/vendor/zod/v4/core/json-schema-processors.js +843 -0
- package/dist/lib/modules/vendor/zod/v4/core/json-schema.js +1 -0
- package/dist/lib/modules/vendor/zod/v4/core/memoizer.js +311 -0
- package/dist/lib/modules/vendor/zod/v4/core/parse.js +175 -0
- package/dist/lib/modules/vendor/zod/v4/core/regexes.js +156 -0
- package/dist/lib/modules/vendor/zod/v4/core/registries.js +51 -0
- package/dist/lib/modules/vendor/zod/v4/core/schemas.js +2636 -0
- package/dist/lib/modules/vendor/zod/v4/core/to-json-schema.js +651 -0
- package/dist/lib/modules/vendor/zod/v4/core/util.js +873 -0
- package/dist/lib/modules/vendor/zod/v4/core/versions.js +5 -0
- package/dist/lib/modules/vendor/zod/v4/core/visit.js +169 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ar.js +111 -0
- package/dist/lib/modules/vendor/zod/v4/locales/az.js +110 -0
- package/dist/lib/modules/vendor/zod/v4/locales/be.js +168 -0
- package/dist/lib/modules/vendor/zod/v4/locales/bg.js +125 -0
- package/dist/lib/modules/vendor/zod/v4/locales/bn.js +113 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ca.js +112 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ckb.js +133 -0
- package/dist/lib/modules/vendor/zod/v4/locales/cs.js +116 -0
- package/dist/lib/modules/vendor/zod/v4/locales/da.js +120 -0
- package/dist/lib/modules/vendor/zod/v4/locales/de.js +113 -0
- package/dist/lib/modules/vendor/zod/v4/locales/el.js +112 -0
- package/dist/lib/modules/vendor/zod/v4/locales/en.js +125 -0
- package/dist/lib/modules/vendor/zod/v4/locales/eo.js +114 -0
- package/dist/lib/modules/vendor/zod/v4/locales/es.js +136 -0
- package/dist/lib/modules/vendor/zod/v4/locales/fa.js +119 -0
- package/dist/lib/modules/vendor/zod/v4/locales/fi.js +117 -0
- package/dist/lib/modules/vendor/zod/v4/locales/fr-CA.js +112 -0
- package/dist/lib/modules/vendor/zod/v4/locales/fr.js +129 -0
- package/dist/lib/modules/vendor/zod/v4/locales/gu.js +113 -0
- package/dist/lib/modules/vendor/zod/v4/locales/he.js +221 -0
- package/dist/lib/modules/vendor/zod/v4/locales/hi.js +111 -0
- package/dist/lib/modules/vendor/zod/v4/locales/hr.js +126 -0
- package/dist/lib/modules/vendor/zod/v4/locales/hu.js +113 -0
- package/dist/lib/modules/vendor/zod/v4/locales/hy.js +158 -0
- package/dist/lib/modules/vendor/zod/v4/locales/id.js +111 -0
- package/dist/lib/modules/vendor/zod/v4/locales/index.js +63 -0
- package/dist/lib/modules/vendor/zod/v4/locales/is.js +114 -0
- package/dist/lib/modules/vendor/zod/v4/locales/it.js +113 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ja.js +112 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ka.js +117 -0
- package/dist/lib/modules/vendor/zod/v4/locales/kh.js +5 -0
- package/dist/lib/modules/vendor/zod/v4/locales/km.js +115 -0
- package/dist/lib/modules/vendor/zod/v4/locales/kn.js +116 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ko.js +116 -0
- package/dist/lib/modules/vendor/zod/v4/locales/lt.js +207 -0
- package/dist/lib/modules/vendor/zod/v4/locales/mk.js +114 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ms.js +112 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ne.js +111 -0
- package/dist/lib/modules/vendor/zod/v4/locales/nl.js +115 -0
- package/dist/lib/modules/vendor/zod/v4/locales/nn.js +113 -0
- package/dist/lib/modules/vendor/zod/v4/locales/no.js +113 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ota.js +114 -0
- package/dist/lib/modules/vendor/zod/v4/locales/pl.js +114 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ps.js +119 -0
- package/dist/lib/modules/vendor/zod/v4/locales/pt-BR.js +143 -0
- package/dist/lib/modules/vendor/zod/v4/locales/pt.js +142 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ro.js +122 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ru.js +168 -0
- package/dist/lib/modules/vendor/zod/v4/locales/sk.js +116 -0
- package/dist/lib/modules/vendor/zod/v4/locales/sl.js +114 -0
- package/dist/lib/modules/vendor/zod/v4/locales/sv.js +115 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ta.js +115 -0
- package/dist/lib/modules/vendor/zod/v4/locales/tg.js +117 -0
- package/dist/lib/modules/vendor/zod/v4/locales/th.js +115 -0
- package/dist/lib/modules/vendor/zod/v4/locales/tk.js +107 -0
- package/dist/lib/modules/vendor/zod/v4/locales/tr.js +110 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ua.js +5 -0
- package/dist/lib/modules/vendor/zod/v4/locales/uk.js +113 -0
- package/dist/lib/modules/vendor/zod/v4/locales/ur.js +115 -0
- package/dist/lib/modules/vendor/zod/v4/locales/uz.js +113 -0
- package/dist/lib/modules/vendor/zod/v4/locales/vi.js +113 -0
- package/dist/lib/modules/vendor/zod/v4/locales/yo.js +112 -0
- package/dist/lib/modules/vendor/zod/v4/locales/zh-CN.js +114 -0
- package/dist/lib/modules/vendor/zod/v4/locales/zh-TW.js +112 -0
- package/dist/lib/testing-jelly-id.js +1219 -0
- package/dist/lib/zod.js +1 -0
- package/dist/spec/messaging-v1.md +3426 -0
- package/dist/third-party-notices.md +239 -0
- package/dist/third-party.json +88 -0
- package/dist/types/core/address.d.ts +16 -0
- package/dist/types/core/agent/operations.d.ts +129 -0
- package/dist/types/core/agent/present.d.ts +57 -0
- package/dist/types/core/agent/text.d.ts +62 -0
- package/dist/types/core/agent-tools.d.ts +948 -0
- package/dist/types/core/b64u.d.ts +6 -0
- package/dist/types/core/cards.d.ts +21 -0
- package/dist/types/core/check.d.ts +10 -0
- package/dist/types/core/consent.d.ts +132 -0
- package/dist/types/core/contact-card.d.ts +34 -0
- package/dist/types/core/delegation.d.ts +71 -0
- package/dist/types/core/directory/device-log.d.ts +119 -0
- package/dist/types/core/directory/epoch.d.ts +53 -0
- package/dist/types/core/directory/handle.d.ts +11 -0
- package/dist/types/core/directory/jelly-device.d.ts +88 -0
- package/dist/types/core/directory/jelly-issuer.d.ts +8 -0
- package/dist/types/core/directory/jelly-token.d.ts +116 -0
- package/dist/types/core/directory/keys-statement.d.ts +22 -0
- package/dist/types/core/directory/link.d.ts +36 -0
- package/dist/types/core/directory/merkle-log.d.ts +40 -0
- package/dist/types/core/directory/person-view.d.ts +90 -0
- package/dist/types/core/directory/person.d.ts +8 -0
- package/dist/types/core/directory/realm.d.ts +23 -0
- package/dist/types/core/directory/smt.d.ts +52 -0
- package/dist/types/core/envelope.d.ts +68 -0
- package/dist/types/core/hash.d.ts +2 -0
- package/dist/types/core/head.d.ts +34 -0
- package/dist/types/core/identity.d.ts +35 -0
- package/dist/types/core/index.d.ts +38 -0
- package/dist/types/core/jcs.d.ts +12 -0
- package/dist/types/core/jelly-host-double.d.ts +21 -0
- package/dist/types/core/jelly-host.d.ts +86 -0
- package/dist/types/core/keys.d.ts +16 -0
- package/dist/types/core/peer-text.d.ts +87 -0
- package/dist/types/core/realm.d.ts +36 -0
- package/dist/types/core/roster.d.ts +146 -0
- package/dist/types/core/schema/a2a.d.ts +251 -0
- package/dist/types/core/schema/common.d.ts +272 -0
- package/dist/types/core/schema/consent.d.ts +140 -0
- package/dist/types/core/schema/delegation.d.ts +58 -0
- package/dist/types/core/schema/directory-frames.d.ts +1301 -0
- package/dist/types/core/schema/directory.d.ts +375 -0
- package/dist/types/core/schema/envelope.d.ts +750 -0
- package/dist/types/core/schema/errors.d.ts +104 -0
- package/dist/types/core/schema/index.d.ts +15 -0
- package/dist/types/core/schema/ipc/consent.d.ts +555 -0
- package/dist/types/core/schema/ipc/device.d.ts +729 -0
- package/dist/types/core/schema/ipc/jelly.d.ts +501 -0
- package/dist/types/core/schema/ipc/shapes.d.ts +411 -0
- package/dist/types/core/schema/ipc/surfaces.d.ts +674 -0
- package/dist/types/core/schema/ipc.d.ts +3131 -0
- package/dist/types/core/schema/jelly.d.ts +160 -0
- package/dist/types/core/schema/realm.d.ts +38 -0
- package/dist/types/core/schema/relay.d.ts +1122 -0
- package/dist/types/core/schema/roster.d.ts +347 -0
- package/dist/types/core/sign.d.ts +13 -0
- package/dist/types/core/task.d.ts +6 -0
- package/dist/types/core/testing.d.ts +18 -0
- package/dist/types/core/ulid.d.ts +5 -0
- package/dist/types/core/version.d.ts +6 -0
- package/dist/types/core/wire.d.ts +14 -0
- package/dist/types/ipc/client.d.ts +85 -0
- package/dist/types/ipc/framing.d.ts +12 -0
- package/dist/types/ipc/index.d.ts +6 -0
- package/dist/types/ipc/paths.d.ts +39 -0
- package/dist/types/ipc/pipes.d.ts +16 -0
- package/dist/types/ipc/rpc.d.ts +13 -0
- package/dist/types/ipc/server.d.ts +94 -0
- package/dist/types/ipc/testing.d.ts +89 -0
- package/dist/types/ipc/trust.d.ts +49 -0
- package/dist/types/ipc/windows-acl.d.ts +56 -0
- package/dist/types/testing/jelly-id.d.ts +518 -0
- package/dist/types/zod.d.ts +1 -0
- package/package.json +77 -4
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import * as util from "../core/util.js";
|
|
2
|
+
const error = () => {
|
|
3
|
+
const Sizable = {
|
|
4
|
+
string: { unit: "znakov", verb: "mať" },
|
|
5
|
+
file: { unit: "bajtov", verb: "mať" },
|
|
6
|
+
array: { unit: "prvkov", verb: "mať" },
|
|
7
|
+
set: { unit: "prvkov", verb: "mať" },
|
|
8
|
+
map: { unit: "položiek", verb: "mať" },
|
|
9
|
+
};
|
|
10
|
+
function getSizing(origin) {
|
|
11
|
+
return Sizable[origin] ?? null;
|
|
12
|
+
}
|
|
13
|
+
const FormatDictionary = {
|
|
14
|
+
regex: "regulárny výraz",
|
|
15
|
+
email: "e-mailová adresa",
|
|
16
|
+
url: "URL",
|
|
17
|
+
emoji: "emoji",
|
|
18
|
+
uuid: "UUID",
|
|
19
|
+
uuidv4: "UUIDv4",
|
|
20
|
+
uuidv6: "UUIDv6",
|
|
21
|
+
nanoid: "nanoid",
|
|
22
|
+
guid: "GUID",
|
|
23
|
+
cuid: "cuid",
|
|
24
|
+
cuid2: "cuid2",
|
|
25
|
+
ulid: "ULID",
|
|
26
|
+
xid: "XID",
|
|
27
|
+
ksuid: "KSUID",
|
|
28
|
+
datetime: "dátum a čas vo formáte ISO",
|
|
29
|
+
date: "dátum vo formáte ISO",
|
|
30
|
+
time: "čas vo formáte ISO",
|
|
31
|
+
duration: "doba trvania ISO",
|
|
32
|
+
ipv4: "IPv4 adresa",
|
|
33
|
+
ipv6: "IPv6 adresa",
|
|
34
|
+
mac: "MAC adresa",
|
|
35
|
+
cidrv4: "rozsah IPv4",
|
|
36
|
+
cidrv6: "rozsah IPv6",
|
|
37
|
+
base64: "reťazec zakódovaný vo formáte base64",
|
|
38
|
+
base64url: "reťazec zakódovaný vo formáte base64url",
|
|
39
|
+
json_string: "reťazec vo formáte JSON",
|
|
40
|
+
e164: "číslo E.164",
|
|
41
|
+
credit_card: "číslo kreditnej karty",
|
|
42
|
+
currency_code: "kód meny",
|
|
43
|
+
iban: "IBAN",
|
|
44
|
+
jwt: "JWT",
|
|
45
|
+
template_literal: "vstup",
|
|
46
|
+
};
|
|
47
|
+
const TypeDictionary = {
|
|
48
|
+
nan: "NaN",
|
|
49
|
+
number: "číslo",
|
|
50
|
+
string: "reťazec",
|
|
51
|
+
function: "funkcia",
|
|
52
|
+
array: "pole",
|
|
53
|
+
};
|
|
54
|
+
return (issue) => {
|
|
55
|
+
switch (issue.code) {
|
|
56
|
+
case "invalid_type": {
|
|
57
|
+
const expected = TypeDictionary[issue.expected] ?? issue.expected;
|
|
58
|
+
const receivedType = util.parsedType(issue.input);
|
|
59
|
+
const received = TypeDictionary[receivedType] ?? receivedType;
|
|
60
|
+
if (/^[A-Z]/.test(issue.expected)) {
|
|
61
|
+
return `Neplatný vstup: očakávané instanceof ${issue.expected}, obdržané ${received}`;
|
|
62
|
+
}
|
|
63
|
+
return `Neplatný vstup: očakávané ${expected}, obdržané ${received}`;
|
|
64
|
+
}
|
|
65
|
+
case "invalid_value":
|
|
66
|
+
if (issue.values.length === 1)
|
|
67
|
+
return `Neplatný vstup: očakávané ${util.stringifyPrimitive(issue.values[0])}`;
|
|
68
|
+
return `Neplatný vstup: očakávaná jedna z hodnôt ${util.joinValues(issue.values, "|")}`;
|
|
69
|
+
case "too_big": {
|
|
70
|
+
const adj = issue.inclusive ? "<=" : "<";
|
|
71
|
+
const sizing = getSizing(issue.origin);
|
|
72
|
+
if (sizing) {
|
|
73
|
+
return `Hodnota je príliš veľká: ${issue.origin ?? "hodnota"} musí mať ${adj}${issue.maximum.toString()} ${sizing.unit ?? "prvkov"}`;
|
|
74
|
+
}
|
|
75
|
+
return `Hodnota je príliš veľká: ${issue.origin ?? "hodnota"} musí byť ${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 `Hodnota je príliš malá: ${issue.origin ?? "hodnota"} musí mať ${adj}${issue.minimum.toString()} ${sizing.unit ?? "prvkov"}`;
|
|
82
|
+
}
|
|
83
|
+
return `Hodnota je príliš malá: ${issue.origin ?? "hodnota"} musí byť ${adj}${issue.minimum.toString()}`;
|
|
84
|
+
}
|
|
85
|
+
case "invalid_format": {
|
|
86
|
+
const _issue = issue;
|
|
87
|
+
if (_issue.format === "starts_with")
|
|
88
|
+
return `Neplatný reťazec: musí začínať na "${_issue.prefix}"`;
|
|
89
|
+
if (_issue.format === "ends_with")
|
|
90
|
+
return `Neplatný reťazec: musí končiť na "${_issue.suffix}"`;
|
|
91
|
+
if (_issue.format === "includes")
|
|
92
|
+
return `Neplatný reťazec: musí obsahovať "${_issue.includes}"`;
|
|
93
|
+
if (_issue.format === "regex")
|
|
94
|
+
return `Neplatný reťazec: musí zodpovedať vzoru ${_issue.pattern}`;
|
|
95
|
+
return `Neplatný formát ${FormatDictionary[_issue.format] ?? issue.format}`;
|
|
96
|
+
}
|
|
97
|
+
case "not_multiple_of":
|
|
98
|
+
return `Neplatné číslo: musí byť násobkom ${issue.divisor}`;
|
|
99
|
+
case "unrecognized_keys":
|
|
100
|
+
return `Neznáme klúče: ${util.joinValues(issue.keys, ", ")}`;
|
|
101
|
+
case "invalid_key":
|
|
102
|
+
return `Neplatný klúč v ${issue.origin}`;
|
|
103
|
+
case "invalid_union":
|
|
104
|
+
return "Neplatný vstup";
|
|
105
|
+
case "invalid_element":
|
|
106
|
+
return `Neplatná hodnota v ${issue.origin}`;
|
|
107
|
+
default:
|
|
108
|
+
return `Neplatný vstup`;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
export default function () {
|
|
113
|
+
return {
|
|
114
|
+
localeError: error(),
|
|
115
|
+
};
|
|
116
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import * as util from "../core/util.js";
|
|
2
|
+
const error = () => {
|
|
3
|
+
const Sizable = {
|
|
4
|
+
string: { unit: "znakov", verb: "imeti" },
|
|
5
|
+
file: { unit: "bajtov", verb: "imeti" },
|
|
6
|
+
array: { unit: "elementov", verb: "imeti" },
|
|
7
|
+
set: { unit: "elementov", verb: "imeti" },
|
|
8
|
+
map: { unit: "elementov", verb: "imeti" },
|
|
9
|
+
};
|
|
10
|
+
function getSizing(origin) {
|
|
11
|
+
return Sizable[origin] ?? null;
|
|
12
|
+
}
|
|
13
|
+
const FormatDictionary = {
|
|
14
|
+
regex: "vnos",
|
|
15
|
+
email: "e-poštni naslov",
|
|
16
|
+
url: "URL",
|
|
17
|
+
emoji: "emoji",
|
|
18
|
+
uuid: "UUID",
|
|
19
|
+
uuidv4: "UUIDv4",
|
|
20
|
+
uuidv6: "UUIDv6",
|
|
21
|
+
nanoid: "nanoid",
|
|
22
|
+
guid: "GUID",
|
|
23
|
+
cuid: "cuid",
|
|
24
|
+
cuid2: "cuid2",
|
|
25
|
+
ulid: "ULID",
|
|
26
|
+
xid: "XID",
|
|
27
|
+
ksuid: "KSUID",
|
|
28
|
+
datetime: "ISO datum in čas",
|
|
29
|
+
date: "ISO datum",
|
|
30
|
+
time: "ISO čas",
|
|
31
|
+
duration: "ISO trajanje",
|
|
32
|
+
ipv4: "IPv4 naslov",
|
|
33
|
+
ipv6: "IPv6 naslov",
|
|
34
|
+
mac: "MAC naslov",
|
|
35
|
+
cidrv4: "obseg IPv4",
|
|
36
|
+
cidrv6: "obseg IPv6",
|
|
37
|
+
base64: "base64 kodiran niz",
|
|
38
|
+
base64url: "base64url kodiran niz",
|
|
39
|
+
json_string: "JSON niz",
|
|
40
|
+
e164: "E.164 številka",
|
|
41
|
+
credit_card: "številka kreditne kartice",
|
|
42
|
+
currency_code: "koda valute",
|
|
43
|
+
iban: "IBAN",
|
|
44
|
+
jwt: "JWT",
|
|
45
|
+
template_literal: "vnos",
|
|
46
|
+
};
|
|
47
|
+
const TypeDictionary = {
|
|
48
|
+
nan: "NaN",
|
|
49
|
+
number: "število",
|
|
50
|
+
array: "tabela",
|
|
51
|
+
};
|
|
52
|
+
return (issue) => {
|
|
53
|
+
switch (issue.code) {
|
|
54
|
+
case "invalid_type": {
|
|
55
|
+
const expected = TypeDictionary[issue.expected] ?? issue.expected;
|
|
56
|
+
const receivedType = util.parsedType(issue.input);
|
|
57
|
+
const received = TypeDictionary[receivedType] ?? receivedType;
|
|
58
|
+
if (/^[A-Z]/.test(issue.expected)) {
|
|
59
|
+
return `Neveljaven vnos: pričakovano instanceof ${issue.expected}, prejeto ${received}`;
|
|
60
|
+
}
|
|
61
|
+
return `Neveljaven vnos: pričakovano ${expected}, prejeto ${received}`;
|
|
62
|
+
}
|
|
63
|
+
case "invalid_value":
|
|
64
|
+
if (issue.values.length === 1)
|
|
65
|
+
return `Neveljaven vnos: pričakovano ${util.stringifyPrimitive(issue.values[0])}`;
|
|
66
|
+
return `Neveljavna možnost: pričakovano eno izmed ${util.joinValues(issue.values, "|")}`;
|
|
67
|
+
case "too_big": {
|
|
68
|
+
const adj = issue.inclusive ? "<=" : "<";
|
|
69
|
+
const sizing = getSizing(issue.origin);
|
|
70
|
+
if (sizing)
|
|
71
|
+
return `Preveliko: pričakovano, da bo ${issue.origin ?? "vrednost"} imelo ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elementov"}`;
|
|
72
|
+
return `Preveliko: pričakovano, da bo ${issue.origin ?? "vrednost"} ${adj}${issue.maximum.toString()}`;
|
|
73
|
+
}
|
|
74
|
+
case "too_small": {
|
|
75
|
+
const adj = issue.inclusive ? ">=" : ">";
|
|
76
|
+
const sizing = getSizing(issue.origin);
|
|
77
|
+
if (sizing) {
|
|
78
|
+
return `Premajhno: pričakovano, da bo ${issue.origin} imelo ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
79
|
+
}
|
|
80
|
+
return `Premajhno: pričakovano, da bo ${issue.origin} ${adj}${issue.minimum.toString()}`;
|
|
81
|
+
}
|
|
82
|
+
case "invalid_format": {
|
|
83
|
+
const _issue = issue;
|
|
84
|
+
if (_issue.format === "starts_with") {
|
|
85
|
+
return `Neveljaven niz: mora se začeti z "${_issue.prefix}"`;
|
|
86
|
+
}
|
|
87
|
+
if (_issue.format === "ends_with")
|
|
88
|
+
return `Neveljaven niz: mora se končati z "${_issue.suffix}"`;
|
|
89
|
+
if (_issue.format === "includes")
|
|
90
|
+
return `Neveljaven niz: mora vsebovati "${_issue.includes}"`;
|
|
91
|
+
if (_issue.format === "regex")
|
|
92
|
+
return `Neveljaven niz: mora ustrezati vzorcu ${_issue.pattern}`;
|
|
93
|
+
return `Neveljaven ${FormatDictionary[_issue.format] ?? issue.format}`;
|
|
94
|
+
}
|
|
95
|
+
case "not_multiple_of":
|
|
96
|
+
return `Neveljavno število: mora biti večkratnik ${issue.divisor}`;
|
|
97
|
+
case "unrecognized_keys":
|
|
98
|
+
return `Neprepoznan${issue.keys.length > 1 ? "i ključi" : " ključ"}: ${util.joinValues(issue.keys, ", ")}`;
|
|
99
|
+
case "invalid_key":
|
|
100
|
+
return `Neveljaven ključ v ${issue.origin}`;
|
|
101
|
+
case "invalid_union":
|
|
102
|
+
return "Neveljaven vnos";
|
|
103
|
+
case "invalid_element":
|
|
104
|
+
return `Neveljavna vrednost v ${issue.origin}`;
|
|
105
|
+
default:
|
|
106
|
+
return "Neveljaven vnos";
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
export default function () {
|
|
111
|
+
return {
|
|
112
|
+
localeError: error(),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import * as util from "../core/util.js";
|
|
2
|
+
const error = () => {
|
|
3
|
+
const Sizable = {
|
|
4
|
+
string: { unit: "tecken", verb: "att ha" },
|
|
5
|
+
file: { unit: "bytes", verb: "att ha" },
|
|
6
|
+
array: { unit: "objekt", verb: "att innehålla" },
|
|
7
|
+
set: { unit: "objekt", verb: "att innehålla" },
|
|
8
|
+
map: { unit: "objekt", verb: "att innehålla" },
|
|
9
|
+
};
|
|
10
|
+
function getSizing(origin) {
|
|
11
|
+
return Sizable[origin] ?? null;
|
|
12
|
+
}
|
|
13
|
+
const FormatDictionary = {
|
|
14
|
+
regex: "reguljärt uttryck",
|
|
15
|
+
email: "e-postadress",
|
|
16
|
+
url: "URL",
|
|
17
|
+
emoji: "emoji",
|
|
18
|
+
uuid: "UUID",
|
|
19
|
+
uuidv4: "UUIDv4",
|
|
20
|
+
uuidv6: "UUIDv6",
|
|
21
|
+
nanoid: "nanoid",
|
|
22
|
+
guid: "GUID",
|
|
23
|
+
cuid: "cuid",
|
|
24
|
+
cuid2: "cuid2",
|
|
25
|
+
ulid: "ULID",
|
|
26
|
+
xid: "XID",
|
|
27
|
+
ksuid: "KSUID",
|
|
28
|
+
datetime: "ISO-datum och tid",
|
|
29
|
+
date: "ISO-datum",
|
|
30
|
+
time: "ISO-tid",
|
|
31
|
+
duration: "ISO-varaktighet",
|
|
32
|
+
ipv4: "IPv4-adress",
|
|
33
|
+
ipv6: "IPv6-adress",
|
|
34
|
+
mac: "MAC-adress",
|
|
35
|
+
cidrv4: "IPv4-spektrum",
|
|
36
|
+
cidrv6: "IPv6-spektrum",
|
|
37
|
+
base64: "base64-kodad sträng",
|
|
38
|
+
base64url: "base64url-kodad sträng",
|
|
39
|
+
json_string: "JSON-sträng",
|
|
40
|
+
e164: "E.164-nummer",
|
|
41
|
+
credit_card: "kreditkortsnummer",
|
|
42
|
+
currency_code: "valutakod",
|
|
43
|
+
iban: "IBAN",
|
|
44
|
+
jwt: "JWT",
|
|
45
|
+
template_literal: "mall-literal",
|
|
46
|
+
};
|
|
47
|
+
const TypeDictionary = {
|
|
48
|
+
nan: "NaN",
|
|
49
|
+
number: "antal",
|
|
50
|
+
array: "lista",
|
|
51
|
+
};
|
|
52
|
+
return (issue) => {
|
|
53
|
+
switch (issue.code) {
|
|
54
|
+
case "invalid_type": {
|
|
55
|
+
const expected = TypeDictionary[issue.expected] ?? issue.expected;
|
|
56
|
+
const receivedType = util.parsedType(issue.input);
|
|
57
|
+
const received = TypeDictionary[receivedType] ?? receivedType;
|
|
58
|
+
if (/^[A-Z]/.test(issue.expected)) {
|
|
59
|
+
return `Ogiltig inmatning: förväntat instanceof ${issue.expected}, fick ${received}`;
|
|
60
|
+
}
|
|
61
|
+
return `Ogiltig inmatning: förväntat ${expected}, fick ${received}`;
|
|
62
|
+
}
|
|
63
|
+
case "invalid_value":
|
|
64
|
+
if (issue.values.length === 1)
|
|
65
|
+
return `Ogiltig inmatning: förväntat ${util.stringifyPrimitive(issue.values[0])}`;
|
|
66
|
+
return `Ogiltigt val: förväntade en av ${util.joinValues(issue.values, "|")}`;
|
|
67
|
+
case "too_big": {
|
|
68
|
+
const adj = issue.inclusive ? "<=" : "<";
|
|
69
|
+
const sizing = getSizing(issue.origin);
|
|
70
|
+
if (sizing) {
|
|
71
|
+
return `För stor(t): förväntade ${issue.origin ?? "värdet"} att ha ${adj}${issue.maximum.toString()} ${sizing.unit ?? "element"}`;
|
|
72
|
+
}
|
|
73
|
+
return `För stor(t): förväntat ${issue.origin ?? "värdet"} att ha ${adj}${issue.maximum.toString()}`;
|
|
74
|
+
}
|
|
75
|
+
case "too_small": {
|
|
76
|
+
const adj = issue.inclusive ? ">=" : ">";
|
|
77
|
+
const sizing = getSizing(issue.origin);
|
|
78
|
+
if (sizing) {
|
|
79
|
+
return `För lite(t): förväntade ${issue.origin ?? "värdet"} att ha ${adj}${issue.minimum.toString()} ${sizing.unit}`;
|
|
80
|
+
}
|
|
81
|
+
return `För lite(t): förväntade ${issue.origin ?? "värdet"} att ha ${adj}${issue.minimum.toString()}`;
|
|
82
|
+
}
|
|
83
|
+
case "invalid_format": {
|
|
84
|
+
const _issue = issue;
|
|
85
|
+
if (_issue.format === "starts_with") {
|
|
86
|
+
return `Ogiltig sträng: måste börja med "${_issue.prefix}"`;
|
|
87
|
+
}
|
|
88
|
+
if (_issue.format === "ends_with")
|
|
89
|
+
return `Ogiltig sträng: måste sluta med "${_issue.suffix}"`;
|
|
90
|
+
if (_issue.format === "includes")
|
|
91
|
+
return `Ogiltig sträng: måste innehålla "${_issue.includes}"`;
|
|
92
|
+
if (_issue.format === "regex")
|
|
93
|
+
return `Ogiltig sträng: måste matcha mönstret "${_issue.pattern}"`;
|
|
94
|
+
return `Ogiltig(t) ${FormatDictionary[_issue.format] ?? issue.format}`;
|
|
95
|
+
}
|
|
96
|
+
case "not_multiple_of":
|
|
97
|
+
return `Ogiltigt tal: måste vara en multipel av ${issue.divisor}`;
|
|
98
|
+
case "unrecognized_keys":
|
|
99
|
+
return `${issue.keys.length > 1 ? "Okända nycklar" : "Okänd nyckel"}: ${util.joinValues(issue.keys, ", ")}`;
|
|
100
|
+
case "invalid_key":
|
|
101
|
+
return `Ogiltig nyckel i ${issue.origin ?? "värdet"}`;
|
|
102
|
+
case "invalid_union":
|
|
103
|
+
return "Ogiltig input";
|
|
104
|
+
case "invalid_element":
|
|
105
|
+
return `Ogiltigt värde i ${issue.origin ?? "värdet"}`;
|
|
106
|
+
default:
|
|
107
|
+
return `Ogiltig input`;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
export default function () {
|
|
112
|
+
return {
|
|
113
|
+
localeError: error(),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
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
|
+
map: { unit: "உறுப்புகள்", verb: "கொண்டிருக்க வேண்டும்" },
|
|
9
|
+
};
|
|
10
|
+
function getSizing(origin) {
|
|
11
|
+
return Sizable[origin] ?? null;
|
|
12
|
+
}
|
|
13
|
+
const FormatDictionary = {
|
|
14
|
+
regex: "உள்ளீடு",
|
|
15
|
+
email: "மின்னஞ்சல் முகவரி",
|
|
16
|
+
url: "URL",
|
|
17
|
+
emoji: "emoji",
|
|
18
|
+
uuid: "UUID",
|
|
19
|
+
uuidv4: "UUIDv4",
|
|
20
|
+
uuidv6: "UUIDv6",
|
|
21
|
+
nanoid: "nanoid",
|
|
22
|
+
guid: "GUID",
|
|
23
|
+
cuid: "cuid",
|
|
24
|
+
cuid2: "cuid2",
|
|
25
|
+
ulid: "ULID",
|
|
26
|
+
xid: "XID",
|
|
27
|
+
ksuid: "KSUID",
|
|
28
|
+
datetime: "ISO தேதி நேரம்",
|
|
29
|
+
date: "ISO தேதி",
|
|
30
|
+
time: "ISO நேரம்",
|
|
31
|
+
duration: "ISO கால அளவு",
|
|
32
|
+
ipv4: "IPv4 முகவரி",
|
|
33
|
+
ipv6: "IPv6 முகவரி",
|
|
34
|
+
mac: "MAC முகவரி",
|
|
35
|
+
cidrv4: "IPv4 வரம்பு",
|
|
36
|
+
cidrv6: "IPv6 வரம்பு",
|
|
37
|
+
base64: "base64-encoded சரம்",
|
|
38
|
+
base64url: "base64url-encoded சரம்",
|
|
39
|
+
json_string: "JSON சரம்",
|
|
40
|
+
e164: "E.164 எண்",
|
|
41
|
+
credit_card: "கடன் அட்டை எண்",
|
|
42
|
+
currency_code: "நாணயக் குறியீடு",
|
|
43
|
+
iban: "IBAN",
|
|
44
|
+
jwt: "JWT",
|
|
45
|
+
template_literal: "input",
|
|
46
|
+
};
|
|
47
|
+
const TypeDictionary = {
|
|
48
|
+
nan: "NaN",
|
|
49
|
+
number: "எண்",
|
|
50
|
+
array: "அணி",
|
|
51
|
+
null: "வெறுமை",
|
|
52
|
+
};
|
|
53
|
+
return (issue) => {
|
|
54
|
+
switch (issue.code) {
|
|
55
|
+
case "invalid_type": {
|
|
56
|
+
const expected = TypeDictionary[issue.expected] ?? issue.expected;
|
|
57
|
+
const receivedType = util.parsedType(issue.input);
|
|
58
|
+
const received = TypeDictionary[receivedType] ?? receivedType;
|
|
59
|
+
if (/^[A-Z]/.test(issue.expected)) {
|
|
60
|
+
return `தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது instanceof ${issue.expected}, பெறப்பட்டது ${received}`;
|
|
61
|
+
}
|
|
62
|
+
return `தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${expected}, பெறப்பட்டது ${received}`;
|
|
63
|
+
}
|
|
64
|
+
case "invalid_value":
|
|
65
|
+
if (issue.values.length === 1)
|
|
66
|
+
return `தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${util.stringifyPrimitive(issue.values[0])}`;
|
|
67
|
+
return `தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${util.joinValues(issue.values, "|")} இல் ஒன்று`;
|
|
68
|
+
case "too_big": {
|
|
69
|
+
const adj = issue.inclusive ? "<=" : "<";
|
|
70
|
+
const sizing = getSizing(issue.origin);
|
|
71
|
+
if (sizing) {
|
|
72
|
+
return `மிக பெரியது: எதிர்பார்க்கப்பட்டது ${issue.origin ?? "மதிப்பு"} ${adj}${issue.maximum.toString()} ${sizing.unit ?? "உறுப்புகள்"} ஆக இருக்க வேண்டும்`;
|
|
73
|
+
}
|
|
74
|
+
return `மிக பெரியது: எதிர்பார்க்கப்பட்டது ${issue.origin ?? "மதிப்பு"} ${adj}${issue.maximum.toString()} ஆக இருக்க வேண்டும்`;
|
|
75
|
+
}
|
|
76
|
+
case "too_small": {
|
|
77
|
+
const adj = issue.inclusive ? ">=" : ">";
|
|
78
|
+
const sizing = getSizing(issue.origin);
|
|
79
|
+
if (sizing) {
|
|
80
|
+
return `மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${issue.origin} ${adj}${issue.minimum.toString()} ${sizing.unit} ஆக இருக்க வேண்டும்`; //
|
|
81
|
+
}
|
|
82
|
+
return `மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${issue.origin} ${adj}${issue.minimum.toString()} ஆக இருக்க வேண்டும்`;
|
|
83
|
+
}
|
|
84
|
+
case "invalid_format": {
|
|
85
|
+
const _issue = issue;
|
|
86
|
+
if (_issue.format === "starts_with")
|
|
87
|
+
return `தவறான சரம்: "${_issue.prefix}" இல் தொடங்க வேண்டும்`;
|
|
88
|
+
if (_issue.format === "ends_with")
|
|
89
|
+
return `தவறான சரம்: "${_issue.suffix}" இல் முடிவடைய வேண்டும்`;
|
|
90
|
+
if (_issue.format === "includes")
|
|
91
|
+
return `தவறான சரம்: "${_issue.includes}" ஐ உள்ளடக்க வேண்டும்`;
|
|
92
|
+
if (_issue.format === "regex")
|
|
93
|
+
return `தவறான சரம்: ${_issue.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`;
|
|
94
|
+
return `தவறான ${FormatDictionary[_issue.format] ?? issue.format}`;
|
|
95
|
+
}
|
|
96
|
+
case "not_multiple_of":
|
|
97
|
+
return `தவறான எண்: ${issue.divisor} இன் பலமாக இருக்க வேண்டும்`;
|
|
98
|
+
case "unrecognized_keys":
|
|
99
|
+
return `அடையாளம் தெரியாத விசை${issue.keys.length > 1 ? "கள்" : ""}: ${util.joinValues(issue.keys, ", ")}`;
|
|
100
|
+
case "invalid_key":
|
|
101
|
+
return `${issue.origin} இல் தவறான விசை`;
|
|
102
|
+
case "invalid_union":
|
|
103
|
+
return "தவறான உள்ளீடு";
|
|
104
|
+
case "invalid_element":
|
|
105
|
+
return `${issue.origin} இல் தவறான மதிப்பு`;
|
|
106
|
+
default:
|
|
107
|
+
return `தவறான உள்ளீடு`;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
export default function () {
|
|
112
|
+
return {
|
|
113
|
+
localeError: error(),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import * as util from "../core/util.js";
|
|
2
|
+
const error = () => {
|
|
3
|
+
// singular units after numerals in Tajik
|
|
4
|
+
const Sizable = {
|
|
5
|
+
string: { unit: "аломат", verb: "дошта бошад" },
|
|
6
|
+
file: { unit: "байт", verb: "дошта бошад" },
|
|
7
|
+
array: { unit: "унсур", verb: "дошта бошад" },
|
|
8
|
+
set: { unit: "унсур", verb: "дошта бошад" },
|
|
9
|
+
map: { unit: "сабт", verb: "дошта бошад" },
|
|
10
|
+
};
|
|
11
|
+
function getSizing(origin) {
|
|
12
|
+
return Sizable[origin] ?? null;
|
|
13
|
+
}
|
|
14
|
+
const FormatDictionary = {
|
|
15
|
+
regex: "вуруд",
|
|
16
|
+
email: "суроғаи email",
|
|
17
|
+
url: "URL",
|
|
18
|
+
emoji: "эмоҷи",
|
|
19
|
+
uuid: "UUID",
|
|
20
|
+
uuidv4: "UUIDv4",
|
|
21
|
+
uuidv6: "UUIDv6",
|
|
22
|
+
nanoid: "nanoid",
|
|
23
|
+
guid: "GUID",
|
|
24
|
+
cuid: "cuid",
|
|
25
|
+
cuid2: "cuid2",
|
|
26
|
+
ulid: "ULID",
|
|
27
|
+
xid: "XID",
|
|
28
|
+
ksuid: "KSUID",
|
|
29
|
+
datetime: "санаву вақти ISO",
|
|
30
|
+
date: "санаи ISO",
|
|
31
|
+
time: "вақти ISO",
|
|
32
|
+
duration: "давомнокии ISO",
|
|
33
|
+
ipv4: "суроғаи IPv4",
|
|
34
|
+
ipv6: "суроғаи IPv6",
|
|
35
|
+
mac: "суроғаи MAC",
|
|
36
|
+
cidrv4: "маҳдудаи IPv4",
|
|
37
|
+
cidrv6: "маҳдудаи IPv6",
|
|
38
|
+
base64: "сатри дар формати base64",
|
|
39
|
+
base64url: "сатри дар формати base64url",
|
|
40
|
+
json_string: "сатри JSON",
|
|
41
|
+
e164: "рақами E.164",
|
|
42
|
+
credit_card: "рақами корти кредитӣ",
|
|
43
|
+
currency_code: "рамзи асъор",
|
|
44
|
+
iban: "IBAN",
|
|
45
|
+
jwt: "JWT",
|
|
46
|
+
template_literal: "вуруд",
|
|
47
|
+
};
|
|
48
|
+
const TypeDictionary = {
|
|
49
|
+
nan: "NaN",
|
|
50
|
+
number: "рақам",
|
|
51
|
+
string: "сатр",
|
|
52
|
+
array: "массив",
|
|
53
|
+
object: "объект",
|
|
54
|
+
date: "сана",
|
|
55
|
+
};
|
|
56
|
+
return (issue) => {
|
|
57
|
+
switch (issue.code) {
|
|
58
|
+
case "invalid_type": {
|
|
59
|
+
const expected = TypeDictionary[issue.expected] ?? issue.expected;
|
|
60
|
+
const receivedType = util.parsedType(issue.input);
|
|
61
|
+
const received = TypeDictionary[receivedType] ?? receivedType;
|
|
62
|
+
return `Вуруди нодуруст: ${expected} интизор мерафт, ${received} гирифта шуд`;
|
|
63
|
+
}
|
|
64
|
+
case "invalid_value":
|
|
65
|
+
if (issue.values.length === 1)
|
|
66
|
+
return `Вуруди нодуруст: ${util.stringifyPrimitive(issue.values[0])} интизор мерафт`;
|
|
67
|
+
return `Интихоби нодуруст: яке аз ${util.joinValues(issue.values, "|")} интизор мерафт`;
|
|
68
|
+
case "too_big": {
|
|
69
|
+
const adj = issue.inclusive ? "<=" : "<";
|
|
70
|
+
const sizing = getSizing(issue.origin);
|
|
71
|
+
if (sizing)
|
|
72
|
+
return `Хеле калон: ${issue.origin ?? "қимат"} бояд ${adj}${issue.maximum.toString()} ${sizing.unit} ${sizing.verb}`;
|
|
73
|
+
return `Хеле калон: ${issue.origin ?? "қимат"} бояд ${adj}${issue.maximum.toString()} бошад`;
|
|
74
|
+
}
|
|
75
|
+
case "too_small": {
|
|
76
|
+
const adj = issue.inclusive ? ">=" : ">";
|
|
77
|
+
const sizing = getSizing(issue.origin);
|
|
78
|
+
if (sizing)
|
|
79
|
+
return `Хеле хурд: ${issue.origin} бояд ${adj}${issue.minimum.toString()} ${sizing.unit} ${sizing.verb}`;
|
|
80
|
+
return `Хеле хурд: ${issue.origin} бояд ${adj}${issue.minimum.toString()} бошад`;
|
|
81
|
+
}
|
|
82
|
+
case "invalid_format": {
|
|
83
|
+
const _issue = issue;
|
|
84
|
+
if (_issue.format === "starts_with")
|
|
85
|
+
return `Сатри нодуруст: бояд бо "${_issue.prefix}" оғоз шавад`;
|
|
86
|
+
if (_issue.format === "ends_with")
|
|
87
|
+
return `Сатри нодуруст: бояд бо "${_issue.suffix}" анҷом ёбад`;
|
|
88
|
+
if (_issue.format === "includes")
|
|
89
|
+
return `Сатри нодуруст: бояд "${_issue.includes}"-ро дар бар гирад`;
|
|
90
|
+
if (_issue.format === "regex")
|
|
91
|
+
return `Сатри нодуруст: бояд ба намунаи ${_issue.pattern} мувофиқат кунад`;
|
|
92
|
+
return `${FormatDictionary[_issue.format] ?? issue.format}-и нодуруст`;
|
|
93
|
+
}
|
|
94
|
+
case "not_multiple_of":
|
|
95
|
+
return `Рақами нодуруст: бояд ба ${issue.divisor} бе бақия тақсим шавад`;
|
|
96
|
+
case "unrecognized_keys":
|
|
97
|
+
return `Калид${issue.keys.length > 1 ? "ҳои" : "и"} номаълум: ${util.joinValues(issue.keys, ", ")}`;
|
|
98
|
+
case "invalid_key":
|
|
99
|
+
return `Калиди нодуруст дар ${issue.origin}`;
|
|
100
|
+
case "invalid_union":
|
|
101
|
+
if (issue.options && Array.isArray(issue.options) && issue.options.length > 0) {
|
|
102
|
+
const opts = issue.options.map((o) => `'${o}'`).join(" | ");
|
|
103
|
+
return `Қимати нодурусти дискриминатор: ${opts} интизор мерафт`;
|
|
104
|
+
}
|
|
105
|
+
return "Вуруди нодуруст";
|
|
106
|
+
case "invalid_element":
|
|
107
|
+
return `Қимати нодуруст дар ${issue.origin}`;
|
|
108
|
+
default:
|
|
109
|
+
return `Вуруди нодуруст`;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
export default function () {
|
|
114
|
+
return {
|
|
115
|
+
localeError: error(),
|
|
116
|
+
};
|
|
117
|
+
}
|