@evolu/common 8.1.0 → 8.3.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.
Files changed (232) hide show
  1. package/dist/src/Function.d.ts +1 -0
  2. package/dist/src/Function.d.ts.map +1 -1
  3. package/dist/src/Http.d.ts +9 -0
  4. package/dist/src/Http.d.ts.map +1 -1
  5. package/dist/src/Number.d.ts +66 -6
  6. package/dist/src/Number.d.ts.map +1 -1
  7. package/dist/src/Number.js +11 -3
  8. package/dist/src/Object.d.ts +1 -0
  9. package/dist/src/Object.d.ts.map +1 -1
  10. package/dist/src/RefCount.d.ts +1 -0
  11. package/dist/src/RefCount.d.ts.map +1 -1
  12. package/dist/src/Relation.d.ts +2 -0
  13. package/dist/src/Relation.d.ts.map +1 -1
  14. package/dist/src/Resource.d.ts +1 -0
  15. package/dist/src/Resource.d.ts.map +1 -1
  16. package/dist/src/Result.d.ts +383 -548
  17. package/dist/src/Result.d.ts.map +1 -1
  18. package/dist/src/Result.js +296 -46
  19. package/dist/src/Schedule.d.ts +2 -2
  20. package/dist/src/Schedule.d.ts.map +1 -1
  21. package/dist/src/StackTrace.d.ts +1 -0
  22. package/dist/src/StackTrace.d.ts.map +1 -1
  23. package/dist/src/Task.d.ts +978 -1061
  24. package/dist/src/Task.d.ts.map +1 -1
  25. package/dist/src/Task.js +1010 -159
  26. package/dist/src/Time.d.ts +71 -34
  27. package/dist/src/Time.d.ts.map +1 -1
  28. package/dist/src/Time.js +77 -1
  29. package/dist/src/Type.d.ts +1740 -795
  30. package/dist/src/Type.d.ts.map +1 -1
  31. package/dist/src/Type.js +1634 -211
  32. package/dist/src/Types.d.ts +0 -24
  33. package/dist/src/Types.d.ts.map +1 -1
  34. package/dist/src/intl/_en.d.ts +126 -0
  35. package/dist/src/intl/_en.d.ts.map +1 -0
  36. package/dist/src/intl/_en.js +267 -0
  37. package/dist/src/intl/ar.d.ts +117 -0
  38. package/dist/src/intl/ar.d.ts.map +1 -0
  39. package/dist/src/intl/ar.js +245 -0
  40. package/dist/src/intl/bn.d.ts +117 -0
  41. package/dist/src/intl/bn.d.ts.map +1 -0
  42. package/dist/src/intl/bn.js +258 -0
  43. package/dist/src/intl/ca.d.ts +117 -0
  44. package/dist/src/intl/ca.d.ts.map +1 -0
  45. package/dist/src/intl/ca.js +258 -0
  46. package/dist/src/intl/cs.d.ts +30 -7
  47. package/dist/src/intl/cs.d.ts.map +1 -1
  48. package/dist/src/intl/cs.js +65 -28
  49. package/dist/src/intl/da.d.ts +117 -0
  50. package/dist/src/intl/da.d.ts.map +1 -0
  51. package/dist/src/intl/da.js +258 -0
  52. package/dist/src/intl/de.d.ts +117 -0
  53. package/dist/src/intl/de.d.ts.map +1 -0
  54. package/dist/src/intl/de.js +258 -0
  55. package/dist/src/intl/el.d.ts +117 -0
  56. package/dist/src/intl/el.d.ts.map +1 -0
  57. package/dist/src/intl/el.js +265 -0
  58. package/dist/src/intl/es.d.ts +117 -0
  59. package/dist/src/intl/es.d.ts.map +1 -0
  60. package/dist/src/intl/es.js +258 -0
  61. package/dist/src/intl/fa.d.ts +117 -0
  62. package/dist/src/intl/fa.d.ts.map +1 -0
  63. package/dist/src/intl/fa.js +258 -0
  64. package/dist/src/intl/fi.d.ts +117 -0
  65. package/dist/src/intl/fi.d.ts.map +1 -0
  66. package/dist/src/intl/fi.js +258 -0
  67. package/dist/src/intl/fil.d.ts +117 -0
  68. package/dist/src/intl/fil.d.ts.map +1 -0
  69. package/dist/src/intl/fil.js +258 -0
  70. package/dist/src/intl/fr.d.ts +117 -0
  71. package/dist/src/intl/fr.d.ts.map +1 -0
  72. package/dist/src/intl/fr.js +258 -0
  73. package/dist/src/intl/he.d.ts +117 -0
  74. package/dist/src/intl/he.d.ts.map +1 -0
  75. package/dist/src/intl/he.js +258 -0
  76. package/dist/src/intl/hi.d.ts +117 -0
  77. package/dist/src/intl/hi.d.ts.map +1 -0
  78. package/dist/src/intl/hi.js +258 -0
  79. package/dist/src/intl/hr.d.ts +117 -0
  80. package/dist/src/intl/hr.d.ts.map +1 -0
  81. package/dist/src/intl/hr.js +265 -0
  82. package/dist/src/intl/hu.d.ts +63 -0
  83. package/dist/src/intl/hu.d.ts.map +1 -0
  84. package/dist/src/intl/hu.js +204 -0
  85. package/dist/src/intl/id.d.ts +117 -0
  86. package/dist/src/intl/id.d.ts.map +1 -0
  87. package/dist/src/intl/id.js +258 -0
  88. package/dist/src/intl/index.d.ts +42 -0
  89. package/dist/src/intl/index.d.ts.map +1 -1
  90. package/dist/src/intl/index.js +42 -0
  91. package/dist/src/intl/it.d.ts +117 -0
  92. package/dist/src/intl/it.d.ts.map +1 -0
  93. package/dist/src/intl/it.js +258 -0
  94. package/dist/src/intl/ja.d.ts +117 -0
  95. package/dist/src/intl/ja.d.ts.map +1 -0
  96. package/dist/src/intl/ja.js +258 -0
  97. package/dist/src/intl/ko.d.ts +117 -0
  98. package/dist/src/intl/ko.d.ts.map +1 -0
  99. package/dist/src/intl/ko.js +258 -0
  100. package/dist/src/intl/ml.d.ts +117 -0
  101. package/dist/src/intl/ml.d.ts.map +1 -0
  102. package/dist/src/intl/ml.js +258 -0
  103. package/dist/src/intl/mr.d.ts +117 -0
  104. package/dist/src/intl/mr.d.ts.map +1 -0
  105. package/dist/src/intl/mr.js +258 -0
  106. package/dist/src/intl/ms.d.ts +117 -0
  107. package/dist/src/intl/ms.d.ts.map +1 -0
  108. package/dist/src/intl/ms.js +245 -0
  109. package/dist/src/intl/nb.d.ts +63 -0
  110. package/dist/src/intl/nb.d.ts.map +1 -0
  111. package/dist/src/intl/nb.js +191 -0
  112. package/dist/src/intl/nl.d.ts +117 -0
  113. package/dist/src/intl/nl.d.ts.map +1 -0
  114. package/dist/src/intl/nl.js +258 -0
  115. package/dist/src/intl/pa.d.ts +117 -0
  116. package/dist/src/intl/pa.d.ts.map +1 -0
  117. package/dist/src/intl/pa.js +258 -0
  118. package/dist/src/intl/pl.d.ts +117 -0
  119. package/dist/src/intl/pl.d.ts.map +1 -0
  120. package/dist/src/intl/pl.js +242 -0
  121. package/dist/src/intl/pt-BR.d.ts +117 -0
  122. package/dist/src/intl/pt-BR.d.ts.map +1 -0
  123. package/dist/src/intl/pt-BR.js +258 -0
  124. package/dist/src/intl/pt.d.ts +117 -0
  125. package/dist/src/intl/pt.d.ts.map +1 -0
  126. package/dist/src/intl/pt.js +246 -0
  127. package/dist/src/intl/ro.d.ts +117 -0
  128. package/dist/src/intl/ro.d.ts.map +1 -0
  129. package/dist/src/intl/ro.js +258 -0
  130. package/dist/src/intl/sk.d.ts +117 -0
  131. package/dist/src/intl/sk.d.ts.map +1 -0
  132. package/dist/src/intl/sk.js +244 -0
  133. package/dist/src/intl/sl.d.ts +117 -0
  134. package/dist/src/intl/sl.d.ts.map +1 -0
  135. package/dist/src/intl/sl.js +258 -0
  136. package/dist/src/intl/sv.d.ts +117 -0
  137. package/dist/src/intl/sv.d.ts.map +1 -0
  138. package/dist/src/intl/sv.js +258 -0
  139. package/dist/src/intl/sw.d.ts +63 -0
  140. package/dist/src/intl/sw.d.ts.map +1 -0
  141. package/dist/src/intl/sw.js +191 -0
  142. package/dist/src/intl/ta.d.ts +117 -0
  143. package/dist/src/intl/ta.d.ts.map +1 -0
  144. package/dist/src/intl/ta.js +258 -0
  145. package/dist/src/intl/te.d.ts +117 -0
  146. package/dist/src/intl/te.d.ts.map +1 -0
  147. package/dist/src/intl/te.js +258 -0
  148. package/dist/src/intl/th.d.ts +117 -0
  149. package/dist/src/intl/th.d.ts.map +1 -0
  150. package/dist/src/intl/th.js +258 -0
  151. package/dist/src/intl/tr.d.ts +117 -0
  152. package/dist/src/intl/tr.d.ts.map +1 -0
  153. package/dist/src/intl/tr.js +255 -0
  154. package/dist/src/intl/uk.d.ts +117 -0
  155. package/dist/src/intl/uk.d.ts.map +1 -0
  156. package/dist/src/intl/uk.js +258 -0
  157. package/dist/src/intl/ur.d.ts +117 -0
  158. package/dist/src/intl/ur.d.ts.map +1 -0
  159. package/dist/src/intl/ur.js +245 -0
  160. package/dist/src/intl/vi.d.ts +117 -0
  161. package/dist/src/intl/vi.d.ts.map +1 -0
  162. package/dist/src/intl/vi.js +255 -0
  163. package/dist/src/intl/zh-CN.d.ts +117 -0
  164. package/dist/src/intl/zh-CN.d.ts.map +1 -0
  165. package/dist/src/intl/zh-CN.js +258 -0
  166. package/dist/src/intl/zh-TW.d.ts +117 -0
  167. package/dist/src/intl/zh-TW.d.ts.map +1 -0
  168. package/dist/src/intl/zh-TW.js +258 -0
  169. package/dist/src/local-first/Owner.d.ts +156 -62
  170. package/dist/src/local-first/Owner.d.ts.map +1 -1
  171. package/dist/src/local-first/Owner.js +119 -20
  172. package/package.json +1 -1
  173. package/src/Function.ts +2 -0
  174. package/src/Http.ts +9 -0
  175. package/src/Number.ts +85 -14
  176. package/src/Object.ts +2 -0
  177. package/src/RefCount.ts +2 -0
  178. package/src/Relation.ts +4 -0
  179. package/src/Resource.ts +2 -0
  180. package/src/Result.ts +397 -560
  181. package/src/Schedule.ts +1 -1
  182. package/src/StackTrace.ts +2 -0
  183. package/src/Task.ts +1145 -1225
  184. package/src/Time.ts +110 -62
  185. package/src/Type.ts +2842 -835
  186. package/src/Types.ts +0 -49
  187. package/src/intl/_en.ts +497 -0
  188. package/src/intl/ar.ts +417 -0
  189. package/src/intl/bn.ts +486 -0
  190. package/src/intl/ca.ts +488 -0
  191. package/src/intl/cs.ts +131 -32
  192. package/src/intl/da.ts +488 -0
  193. package/src/intl/de.ts +488 -0
  194. package/src/intl/el.ts +494 -0
  195. package/src/intl/es.ts +488 -0
  196. package/src/intl/fa.ts +487 -0
  197. package/src/intl/fi.ts +487 -0
  198. package/src/intl/fil.ts +488 -0
  199. package/src/intl/fr.ts +488 -0
  200. package/src/intl/he.ts +486 -0
  201. package/src/intl/hi.ts +487 -0
  202. package/src/intl/hr.ts +494 -0
  203. package/src/intl/hu.ts +387 -0
  204. package/src/intl/id.ts +487 -0
  205. package/src/intl/index.ts +42 -0
  206. package/src/intl/it.ts +488 -0
  207. package/src/intl/ja.ts +488 -0
  208. package/src/intl/ko.ts +487 -0
  209. package/src/intl/ml.ts +487 -0
  210. package/src/intl/mr.ts +487 -0
  211. package/src/intl/ms.ts +410 -0
  212. package/src/intl/nb.ts +364 -0
  213. package/src/intl/nl.ts +488 -0
  214. package/src/intl/pa.ts +487 -0
  215. package/src/intl/pl.ts +450 -0
  216. package/src/intl/pt-BR.ts +487 -0
  217. package/src/intl/pt.ts +424 -0
  218. package/src/intl/ro.ts +488 -0
  219. package/src/intl/sk.ts +412 -0
  220. package/src/intl/sl.ts +487 -0
  221. package/src/intl/sv.ts +488 -0
  222. package/src/intl/sw.ts +324 -0
  223. package/src/intl/ta.ts +487 -0
  224. package/src/intl/te.ts +487 -0
  225. package/src/intl/th.ts +484 -0
  226. package/src/intl/tr.ts +487 -0
  227. package/src/intl/uk.ts +488 -0
  228. package/src/intl/ur.ts +410 -0
  229. package/src/intl/vi.ts +435 -0
  230. package/src/intl/zh-CN.ts +482 -0
  231. package/src/intl/zh-TW.ts +482 -0
  232. package/src/local-first/Owner.ts +156 -62
package/src/intl/hr.ts ADDED
@@ -0,0 +1,494 @@
1
+ /**
2
+ * Croatian Evolu Type error formatters.
3
+ *
4
+ * @module
5
+ */
6
+
7
+ import { assertNonNullable } from "../Assert.ts";
8
+ import { safelyStringifyUnknownValue } from "../String.ts";
9
+ import type {
10
+ ArrayError,
11
+ Base64UrlError,
12
+ BetweenError,
13
+ CapitalizedError,
14
+ DateIsoError,
15
+ DateIsoFromDateError,
16
+ DecimalStringError,
17
+ DiscriminatedUnionError,
18
+ EvoluTypeError,
19
+ FiniteError,
20
+ GreaterThanError,
21
+ GreaterThanOrEqualToError,
22
+ InstanceOfError,
23
+ Int64Error,
24
+ Int64StringError,
25
+ IntError,
26
+ IdError,
27
+ JsonError,
28
+ JsonValueError,
29
+ LengthError,
30
+ LessThanError,
31
+ LessThanOrEqualToError,
32
+ LiteralError,
33
+ MaxLengthError,
34
+ MinLengthError,
35
+ MnemonicError,
36
+ MultipleOfError,
37
+ NegativeDecimalStringError,
38
+ NegativeError,
39
+ NameError,
40
+ NeverError,
41
+ NonNaNError,
42
+ NonNegativeDecimalStringError,
43
+ NonNegativeError,
44
+ NonPositiveDecimalStringError,
45
+ NonPositiveError,
46
+ ObjectError,
47
+ ObjectNotObjectError,
48
+ ObjectPropertyAccessError,
49
+ ObjectTagError,
50
+ ObjectUnexpectedPrototypeError,
51
+ PositiveDecimalStringError,
52
+ PositiveError,
53
+ RecordError,
54
+ RegexError,
55
+ SetError,
56
+ TableIdError,
57
+ TemplateLiteralError,
58
+ TrimmedError,
59
+ TupleElementsError,
60
+ TupleError,
61
+ TypeError,
62
+ TypeErrorFormatter,
63
+ TypeOfError,
64
+ UInt64Error,
65
+ UnionError,
66
+ } from "../Type.ts";
67
+
68
+ const formatTypeOfError = (
69
+ error: TypeOfError<
70
+ "String" | "Number" | "BigInt" | "Boolean" | "Symbol" | "Function"
71
+ >,
72
+ ): string => {
73
+ const typeOf = {
74
+ String: "niz znakova",
75
+ Number: "broj",
76
+ BigInt: "bigint",
77
+ Boolean: "logička vrijednost",
78
+ Symbol: "simbol",
79
+ Function: "funkcija",
80
+ }[error.expected];
81
+
82
+ return `Vrijednost ${safelyStringifyUnknownValue(error.value)} nije ${typeOf}.`;
83
+ };
84
+
85
+ const formatPlainObjectRootError = (
86
+ reason:
87
+ ObjectNotObjectError["reason"] | ObjectUnexpectedPrototypeError["reason"],
88
+ ): string =>
89
+ reason.kind === "NotObject"
90
+ ? `Vrijednost ${safelyStringifyUnknownValue(reason.value)} nije objekt.`
91
+ : "Vrijednost je objekt, ali izlaz tipa Object mora biti običan objekt ili imati prototip null.";
92
+
93
+ /** Formats a NeverError in Croatian. */
94
+ export const formatNeverError: TypeErrorFormatter<NeverError> = (error) =>
95
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} nije valjana za tip Never.`;
96
+
97
+ /** Formats a String TypeOfError in Croatian. */
98
+ export const formatStringError: TypeErrorFormatter<TypeOfError<"String">> =
99
+ formatTypeOfError;
100
+
101
+ /** Formats a TemplateLiteralError in Croatian. */
102
+ export const formatTemplateLiteralError: TypeErrorFormatter<
103
+ TemplateLiteralError
104
+ > = (error) =>
105
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} ne odgovara predlošku stringa.`;
106
+
107
+ /** Formats a Number TypeOfError in Croatian. */
108
+ export const formatNumberError: TypeErrorFormatter<TypeOfError<"Number">> =
109
+ formatTypeOfError;
110
+
111
+ /** Formats a BigInt TypeOfError in Croatian. */
112
+ export const formatBigIntError: TypeErrorFormatter<TypeOfError<"BigInt">> =
113
+ formatTypeOfError;
114
+
115
+ /** Formats a Boolean TypeOfError in Croatian. */
116
+ export const formatBooleanError: TypeErrorFormatter<TypeOfError<"Boolean">> =
117
+ formatTypeOfError;
118
+
119
+ /** Formats a Symbol TypeOfError in Croatian. */
120
+ export const formatSymbolError: TypeErrorFormatter<TypeOfError<"Symbol">> =
121
+ formatTypeOfError;
122
+
123
+ /** Formats a Function TypeOfError in Croatian. */
124
+ export const formatFunctionError: TypeErrorFormatter<TypeOfError<"Function">> =
125
+ formatTypeOfError;
126
+
127
+ /** Formats an EvoluTypeError in Croatian. */
128
+ export const formatEvoluTypeError: TypeErrorFormatter<EvoluTypeError> = (
129
+ error,
130
+ ) => `Vrijednost ${safelyStringifyUnknownValue(error.value)} nije Evolu Type.`;
131
+
132
+ /** Formats an ObjectTagError in Croatian. */
133
+ export const formatObjectTagError: TypeErrorFormatter<ObjectTagError> = (
134
+ error,
135
+ ) =>
136
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} nema očekivanu oznaku objekta ${safelyStringifyUnknownValue(error.expected)}.`;
137
+
138
+ /** Formats an InstanceOfError in Croatian. */
139
+ export const formatInstanceOfError: TypeErrorFormatter<InstanceOfError> = (
140
+ error,
141
+ ) =>
142
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} nije instanca klase ${error.constructorName}.`;
143
+
144
+ /** Formats a LiteralError in Croatian. */
145
+ export const formatLiteralError: TypeErrorFormatter<LiteralError> = (error) =>
146
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} nije strogo jednaka očekivanom literalu: ${globalThis.String(error.expected)}.`;
147
+
148
+ /** Formats a UnionError in Croatian. */
149
+ export const formatUnionError: TypeErrorFormatter<UnionError> = () =>
150
+ "Vrijednost ne odgovara nijednoj dopuštenoj varijanti.";
151
+
152
+ /** Formats a DateIsoError in Croatian. */
153
+ export const formatDateIsoError: TypeErrorFormatter<DateIsoError> = (error) =>
154
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} nije kanonski ISO niz datuma i vremena.`;
155
+
156
+ /** Formats a DateIsoFromDateError in Croatian. */
157
+ export const formatDateIsoFromDateError: TypeErrorFormatter<
158
+ DateIsoFromDateError
159
+ > = () => "Date se ne može predstaviti kao DateIso.";
160
+
161
+ /** Formats a DecimalStringError in Croatian. */
162
+ export const formatDecimalStringError: TypeErrorFormatter<
163
+ DecimalStringError
164
+ > = (error) =>
165
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} mora biti kanonski decimalni niz.`;
166
+
167
+ /** Formats an Int64Error in Croatian. */
168
+ export const formatInt64Error: TypeErrorFormatter<Int64Error> = (error) =>
169
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} nije valjani predznačeni 64-bitni cijeli broj (Int64).`;
170
+
171
+ /** Formats a UInt64Error in Croatian. */
172
+ export const formatUInt64Error: TypeErrorFormatter<UInt64Error> = (error) =>
173
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} nije valjani nepredznačeni 64-bitni cijeli broj (UInt64).`;
174
+
175
+ /** Formats an Int64StringError in Croatian. */
176
+ export const formatInt64StringError: TypeErrorFormatter<Int64StringError> = (
177
+ error,
178
+ ) =>
179
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} nije valjani Int64 niz.`;
180
+
181
+ /** Formats a CapitalizedError in Croatian. */
182
+ export const formatCapitalizedError: TypeErrorFormatter<CapitalizedError> = (
183
+ error,
184
+ ) =>
185
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} mora počinjati velikim slovom.`;
186
+
187
+ /** Formats a TrimmedError in Croatian. */
188
+ export const formatTrimmedError: TypeErrorFormatter<TrimmedError> = (error) =>
189
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} ne smije imati razmake na početku ni na kraju.`;
190
+
191
+ /** Formats a MinLengthError in Croatian. */
192
+ export const formatMinLengthError: TypeErrorFormatter<MinLengthError> = (
193
+ error,
194
+ ) =>
195
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} ne zadovoljava najmanju duljinu od ${error.min}.`;
196
+
197
+ /** Formats a MaxLengthError in Croatian. */
198
+ export const formatMaxLengthError: TypeErrorFormatter<MaxLengthError> = (
199
+ error,
200
+ ) =>
201
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} premašuje najveću duljinu od ${error.max}.`;
202
+
203
+ /** Formats a LengthError in Croatian. */
204
+ export const formatLengthError: TypeErrorFormatter<LengthError> = (error) =>
205
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} nema potrebnu duljinu od ${error.exact}.`;
206
+
207
+ /** Formats a RegexError in Croatian. */
208
+ export const formatRegexError: TypeErrorFormatter<RegexError> = (error) =>
209
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} ne odgovara /${error.source}/${error.flags}.`;
210
+
211
+ /** Formats a Base64UrlError in Croatian. */
212
+ export const formatBase64UrlError: TypeErrorFormatter<Base64UrlError> = (
213
+ error,
214
+ ) =>
215
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} nije valjani Base64Url niz.`;
216
+
217
+ /** Formats a NameError in Croatian. */
218
+ export const formatNameError: TypeErrorFormatter<NameError> = (error) =>
219
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} nije valjani Name.`;
220
+
221
+ /** Formats a MnemonicError in Croatian. */
222
+ export const formatMnemonicError: TypeErrorFormatter<MnemonicError> = (error) =>
223
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} nije valjana engleska BIP39 mnemonika.`;
224
+
225
+ /** Formats an IdError in Croatian. */
226
+ export const formatIdError: TypeErrorFormatter<IdError> = (error) =>
227
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} nije valjani Id.`;
228
+
229
+ /** Formats a TableIdError in Croatian. */
230
+ export const formatTableIdError: TypeErrorFormatter<TableIdError> = (error) =>
231
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} nije valjani Id za tablicu ${error.table}.`;
232
+
233
+ /** Formats a NonNegativeError in Croatian. */
234
+ export const formatNonNegativeError: TypeErrorFormatter<NonNegativeError> = (
235
+ error,
236
+ ) =>
237
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} mora biti nenegativna (>= 0).`;
238
+
239
+ /** Formats a NonNegativeDecimalStringError in Croatian. */
240
+ export const formatNonNegativeDecimalStringError: TypeErrorFormatter<
241
+ NonNegativeDecimalStringError
242
+ > = (error) =>
243
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} mora biti nenegativni decimalni niz.`;
244
+
245
+ /** Formats a PositiveError in Croatian. */
246
+ export const formatPositiveError: TypeErrorFormatter<PositiveError> = (error) =>
247
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} mora biti pozitivna (> 0).`;
248
+
249
+ /** Formats a PositiveDecimalStringError in Croatian. */
250
+ export const formatPositiveDecimalStringError: TypeErrorFormatter<
251
+ PositiveDecimalStringError
252
+ > = (error) =>
253
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} mora biti pozitivni decimalni niz.`;
254
+
255
+ /** Formats a NonPositiveError in Croatian. */
256
+ export const formatNonPositiveError: TypeErrorFormatter<NonPositiveError> = (
257
+ error,
258
+ ) =>
259
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} mora biti nepozitivna (<= 0).`;
260
+
261
+ /** Formats a NonPositiveDecimalStringError in Croatian. */
262
+ export const formatNonPositiveDecimalStringError: TypeErrorFormatter<
263
+ NonPositiveDecimalStringError
264
+ > = (error) =>
265
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} mora biti nepozitivni decimalni niz.`;
266
+
267
+ /** Formats a NegativeError in Croatian. */
268
+ export const formatNegativeError: TypeErrorFormatter<NegativeError> = (error) =>
269
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} mora biti negativna (< 0).`;
270
+
271
+ /** Formats a NegativeDecimalStringError in Croatian. */
272
+ export const formatNegativeDecimalStringError: TypeErrorFormatter<
273
+ NegativeDecimalStringError
274
+ > = (error) =>
275
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} mora biti negativni decimalni niz.`;
276
+
277
+ /** Formats an IntError in Croatian. */
278
+ export const formatIntError: TypeErrorFormatter<IntError> = (error) =>
279
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} mora biti siguran cijeli broj.`;
280
+
281
+ /** Formats a GreaterThanError in Croatian. */
282
+ export const formatGreaterThanError: TypeErrorFormatter<GreaterThanError> = (
283
+ error,
284
+ ) =>
285
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} mora biti veća od ${error.min}.`;
286
+
287
+ /** Formats a GreaterThanOrEqualToError in Croatian. */
288
+ export const formatGreaterThanOrEqualToError: TypeErrorFormatter<
289
+ GreaterThanOrEqualToError
290
+ > = (error) =>
291
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} mora biti veća ili jednaka ${error.min}.`;
292
+
293
+ /** Formats a LessThanError in Croatian. */
294
+ export const formatLessThanError: TypeErrorFormatter<LessThanError> = (error) =>
295
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} mora biti manja od ${error.max}.`;
296
+
297
+ /** Formats a LessThanOrEqualToError in Croatian. */
298
+ export const formatLessThanOrEqualToError: TypeErrorFormatter<
299
+ LessThanOrEqualToError
300
+ > = (error) =>
301
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} mora biti manja ili jednaka ${error.max}.`;
302
+
303
+ /** Formats a NonNaNError in Croatian. */
304
+ export const formatNonNaNError: TypeErrorFormatter<NonNaNError> = () =>
305
+ "Vrijednost ne smije biti NaN.";
306
+
307
+ /** Formats a FiniteError in Croatian. */
308
+ export const formatFiniteError: TypeErrorFormatter<FiniteError> = (error) =>
309
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} mora biti konačna.`;
310
+
311
+ /** Formats a MultipleOfError in Croatian. */
312
+ export const formatMultipleOfError: TypeErrorFormatter<MultipleOfError> = (
313
+ error,
314
+ ) =>
315
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} mora biti višekratnik broja ${error.divisor}.`;
316
+
317
+ /** Formats a BetweenError in Croatian. */
318
+ export const formatBetweenError: TypeErrorFormatter<BetweenError> = (error) =>
319
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} mora biti između ${error.min} i ${error.max}, uključujući granice.`;
320
+
321
+ /** Formats an ArrayError in Croatian. */
322
+ export const formatArrayError: TypeErrorFormatter<ArrayError> = (error) => {
323
+ if (error.reason.kind === "NotArray") {
324
+ return `Vrijednost ${safelyStringifyUnknownValue(error.reason.value)} nije polje.`;
325
+ }
326
+ const issue = error.reason.issues[0];
327
+
328
+ switch (issue.kind) {
329
+ case "Hole":
330
+ return `Element polja na indeksu ${issue.index} nedostaje.`;
331
+ case "Accessor":
332
+ return `Element polja na indeksu ${issue.index} mora biti podatkovno svojstvo.`;
333
+ case "ExcessProperty":
334
+ return "Dodatno svojstvo polja nije dopušteno. Uklonite ga ili upotrijebite drugi Type.";
335
+ case "Element":
336
+ return `Element polja na indeksu ${issue.index} nije valjan.`;
337
+ }
338
+ };
339
+
340
+ /** Formats a SetError in Croatian. */
341
+ export const formatSetError: TypeErrorFormatter<SetError> = (error) => {
342
+ if (error.reason.kind === "NotSet") {
343
+ return `Vrijednost ${safelyStringifyUnknownValue(error.reason.value)} nije Set.`;
344
+ }
345
+ if (error.reason.kind === "UnexpectedPrototype") {
346
+ return "Vrijednost je instanca podklase Set, ali izlaz tipa Set mora biti izravna instanca Set-a.";
347
+ }
348
+
349
+ const issue = error.reason.issues[0];
350
+
351
+ switch (issue.kind) {
352
+ case "ExcessProperty":
353
+ return `Dodatno svojstvo Set-a ${safelyStringifyUnknownValue(issue.key)} nije dopušteno.`;
354
+ case "Element":
355
+ return `Element Set-a na indeksu ${issue.index} nije valjan.`;
356
+ }
357
+ };
358
+
359
+ /** Formats a TupleError in Croatian. */
360
+ export const formatTupleError: TypeErrorFormatter<
361
+ TupleError | TupleElementsError<TypeError>
362
+ > = (error) => {
363
+ if (error.reason.kind === "NotArray") {
364
+ return `Vrijednost ${safelyStringifyUnknownValue(error.reason.value)} nije torka.`;
365
+ }
366
+ if (error.reason.kind === "InvalidLength") {
367
+ return `Torka mora sadržavati točno ${error.reason.expected} elemenata, ali vrijednost sadrži ${error.reason.actual}.`;
368
+ }
369
+
370
+ const issue = error.reason.issues[0];
371
+
372
+ switch (issue.kind) {
373
+ case "Hole":
374
+ return `Element torke na indeksu ${issue.index} nedostaje.`;
375
+ case "Accessor":
376
+ return `Element torke na indeksu ${issue.index} mora biti podatkovno svojstvo.`;
377
+ case "ExcessProperty":
378
+ return "Dodatno svojstvo torke nije dopušteno. Uklonite ga ili upotrijebite drugi Type.";
379
+ case "Element":
380
+ return `Element torke na indeksu ${issue.index} nije valjan.`;
381
+ }
382
+ };
383
+
384
+ /** Formats a RecordError in Croatian. */
385
+ export const formatRecordError: TypeErrorFormatter<RecordError> = (error) => {
386
+ if (error.reason.kind === "NotRecord") {
387
+ return `Vrijednost ${safelyStringifyUnknownValue(error.reason.value)} nije Record.`;
388
+ }
389
+ if (error.reason.kind === "NotPlainRecord") {
390
+ return "Vrijednost je objekt, ali izlaz tipa Record mora biti običan objekt ili imati prototip null.";
391
+ }
392
+
393
+ const issue = error.reason.issues[0];
394
+
395
+ switch (issue.kind) {
396
+ case "Key":
397
+ return `Ključ svojstva ${safelyStringifyUnknownValue(issue.key)} nije valjan.`;
398
+ case "Value":
399
+ return `Vrijednost svojstva ${safelyStringifyUnknownValue(issue.key)} nije valjana.`;
400
+ case "Accessor":
401
+ return `Svojstvo Record-a ${safelyStringifyUnknownValue(issue.key)} mora biti podatkovno svojstvo.`;
402
+ case "NonEnumerable":
403
+ return `Svojstvo Record-a ${safelyStringifyUnknownValue(issue.key)} mora biti nabrojivo.`;
404
+ case "Collision":
405
+ return `Ključevi Record-a ${safelyStringifyUnknownValue(issue.previousKey)} i ${safelyStringifyUnknownValue(issue.key)} dekodiraju se u isti ključ ${safelyStringifyUnknownValue(issue.outputKey)}.`;
406
+ }
407
+ };
408
+
409
+ /** Formats an ObjectError in Croatian. */
410
+ export const formatObjectError: TypeErrorFormatter<ObjectError> = (error) => {
411
+ if (error.reason.kind !== "Properties") {
412
+ return formatPlainObjectRootError(error.reason);
413
+ }
414
+
415
+ const key = Reflect.ownKeys(error.reason.errors).at(0);
416
+ assertNonNullable(key);
417
+ const propertyError = error.reason.errors[key];
418
+ assertNonNullable(propertyError);
419
+
420
+ if (propertyError.type === "ObjectPropertyAccess") {
421
+ switch ((propertyError as ObjectPropertyAccessError).reason) {
422
+ case "Accessor":
423
+ return "Svojstvo Object-a mora biti podatkovno svojstvo. Prije upotrebe ovog Type-a pretvorite vrijednosti pristupnika u obične podatke ili upotrijebite drugi Type.";
424
+ case "NonEnumerable":
425
+ return "Svojstvo Object-a mora biti nabrojivo. Učinite ga nabrojivim ili upotrijebite drugi Type.";
426
+ }
427
+ }
428
+ if (propertyError.type === "ObjectMissingProperty") {
429
+ return `Obavezno svojstvo ${safelyStringifyUnknownValue(key)} nedostaje.`;
430
+ }
431
+ if (typeof key === "symbol") {
432
+ return "Ključ svojstva Object-a mora biti niz. Uklonite svojstvo sa simbolom ili upotrijebite drugi Type.";
433
+ }
434
+ if (propertyError.type === "ObjectExcessProperty") {
435
+ return `Svojstvo ${safelyStringifyUnknownValue(key)} nije dopušteno. Uklonite ga ili upotrijebite drugi Type.`;
436
+ }
437
+ return `Svojstvo ${safelyStringifyUnknownValue(key)} nije valjano.`;
438
+ };
439
+
440
+ /** Formats a DiscriminatedUnionError in Croatian. */
441
+ export const formatDiscriminatedUnionError: TypeErrorFormatter<
442
+ DiscriminatedUnionError
443
+ > = (error) => {
444
+ switch (error.reason.kind) {
445
+ case "Object":
446
+ return formatPlainObjectRootError(error.reason.error.reason);
447
+ case "PropertyAccess": {
448
+ const property = `Svojstvo diskriminatora ${safelyStringifyUnknownValue(error.reason.key)}`;
449
+ if (error.reason.reason === "Accessor") {
450
+ return `${property} mora biti podatkovno svojstvo.`;
451
+ }
452
+ if (error.reason.reason === "Inherited") {
453
+ return `${property} mora biti vlastito svojstvo.`;
454
+ }
455
+ return `${property} mora biti nabrojivo.`;
456
+ }
457
+ case "Discriminator":
458
+ return `Svojstvo diskriminatora ${safelyStringifyUnknownValue(error.reason.key)} ima neočekivanu vrijednost ${safelyStringifyUnknownValue(error.reason.value)}.`;
459
+ case "Member":
460
+ return `Odabrana varijanta ${safelyStringifyUnknownValue(error.reason.discriminator)} nije valjana.`;
461
+ }
462
+ };
463
+
464
+ /** Formats a JsonValueError in Croatian. */
465
+ export const formatJsonValueError: TypeErrorFormatter<JsonValueError> = (
466
+ error,
467
+ ) => {
468
+ const issue = error.reason.issues[0];
469
+
470
+ switch (issue.kind) {
471
+ case "InvalidType":
472
+ return `Vrijednost ${safelyStringifyUnknownValue(issue.value)} nije JSON vrijednost.`;
473
+ case "NonFiniteNumber":
474
+ return "JSON broj mora biti konačan.";
475
+ case "UnexpectedPrototype":
476
+ return "Vrijednost je objekt, ali objekt JsonValue mora biti običan objekt ili imati prototip null.";
477
+ case "Accessor":
478
+ return "JSON svojstvo mora biti podatkovno svojstvo. Prije upotrebe ovog Type-a pretvorite vrijednosti pristupnika u obične podatke ili upotrijebite drugi Type.";
479
+ case "NonEnumerable":
480
+ return "Svojstvo JSON objekta mora biti nabrojivo. Uklonite ga ili upotrijebite drugi Type.";
481
+ case "SymbolProperty":
482
+ return "Ključ svojstva JSON objekta mora biti niz. Uklonite svojstvo sa simbolom ili upotrijebite drugi Type.";
483
+ case "Hole":
484
+ return "Element JSON polja nedostaje.";
485
+ case "ExcessProperty":
486
+ return "Dodatno svojstvo JSON polja nije dopušteno. Uklonite ga ili upotrijebite drugi Type.";
487
+ case "CircularReference":
488
+ return "JsonValue ne smije sadržavati kružne reference.";
489
+ }
490
+ };
491
+
492
+ /** Formats a JsonError in Croatian. */
493
+ export const formatJsonError: TypeErrorFormatter<JsonError> = (error) =>
494
+ `Vrijednost ${safelyStringifyUnknownValue(error.value)} ne može se analizirati kao JsonValue.`;