@oxog/vld 2.1.0 → 2.2.5

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 (220) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/README.md +1296 -1235
  3. package/dist/chunks/errors-core-Cqi4-9ew.js +1 -0
  4. package/dist/chunks/index-CkbfQQ4n.js +1 -0
  5. package/dist/chunks/index-yjpbvFgw.js +1 -0
  6. package/dist/chunks/ip-validation-g5LWgy9t.js +1 -0
  7. package/dist/chunks/security-Dy24T8N7.js +1 -0
  8. package/dist/cjs/chunks/errors-core-DKPohm9I.cjs +1 -0
  9. package/dist/cjs/chunks/index-BEV9nG0N.cjs +1 -0
  10. package/dist/cjs/chunks/index-ZjHAxYdA.cjs +1 -0
  11. package/dist/cjs/chunks/ip-validation-BZqPamPC.cjs +1 -0
  12. package/dist/cjs/chunks/security-aXZVI7qW.cjs +1 -0
  13. package/dist/cjs/cli/bin.cjs +1 -505
  14. package/dist/cjs/cli/index.cjs +1 -209
  15. package/dist/cjs/codecs/index.cjs +1 -45
  16. package/dist/cjs/coercion/index.cjs +1 -588
  17. package/dist/cjs/compat/emitter.cjs +1 -184
  18. package/dist/cjs/compat/result.cjs +1 -189
  19. package/dist/cjs/errors.cjs +1 -180
  20. package/dist/cjs/index.cjs +1 -1894
  21. package/dist/cjs/kernel.cjs +1 -415
  22. package/dist/cjs/locales/af.cjs +1 -108
  23. package/dist/cjs/locales/ar.cjs +1 -108
  24. package/dist/cjs/locales/bn.cjs +1 -108
  25. package/dist/cjs/locales/da.cjs +1 -108
  26. package/dist/cjs/locales/de.cjs +1 -108
  27. package/dist/cjs/locales/en.cjs +1 -108
  28. package/dist/cjs/locales/es-MX.cjs +1 -107
  29. package/dist/cjs/locales/es.cjs +1 -96
  30. package/dist/cjs/locales/fi.cjs +1 -108
  31. package/dist/cjs/locales/fr.cjs +1 -96
  32. package/dist/cjs/locales/hi.cjs +1 -108
  33. package/dist/cjs/locales/id.cjs +1 -108
  34. package/dist/cjs/locales/index.cjs +1 -43
  35. package/dist/cjs/locales/it.cjs +1 -108
  36. package/dist/cjs/locales/ja.cjs +1 -108
  37. package/dist/cjs/locales/ko.cjs +1 -108
  38. package/dist/cjs/locales/lazy.cjs +1 -188
  39. package/dist/cjs/locales/nl.cjs +1 -108
  40. package/dist/cjs/locales/no.cjs +1 -108
  41. package/dist/cjs/locales/pl.cjs +1 -108
  42. package/dist/cjs/locales/pt-BR.cjs +1 -108
  43. package/dist/cjs/locales/pt.cjs +1 -108
  44. package/dist/cjs/locales/ru.cjs +1 -108
  45. package/dist/cjs/locales/runtime.cjs +1 -51
  46. package/dist/cjs/locales/sv.cjs +1 -108
  47. package/dist/cjs/locales/sw.cjs +1 -108
  48. package/dist/cjs/locales/th.cjs +1 -108
  49. package/dist/cjs/locales/tr.cjs +1 -108
  50. package/dist/cjs/locales/vi.cjs +1 -108
  51. package/dist/cjs/locales/zh.cjs +1 -108
  52. package/dist/cjs/mini.cjs +1 -242
  53. package/dist/cjs/pigment.cjs +1 -207
  54. package/dist/cjs/plugins/index.cjs +1 -12
  55. package/dist/cjs/registry.cjs +1 -37
  56. package/dist/cjs/v3/index.cjs +1 -425
  57. package/dist/cjs/v4/core/index.cjs +1 -894
  58. package/dist/cjs/v4/index.cjs +1 -425
  59. package/dist/cjs/v4/locales/index.cjs +1 -130
  60. package/dist/cjs/v4/mini/index.cjs +1 -509
  61. package/dist/cjs/v4-mini/index.cjs +1 -532
  62. package/dist/cjs/validators/any.cjs +1 -40
  63. package/dist/cjs/validators/array.cjs +1 -283
  64. package/dist/cjs/validators/base.cjs +1 -887
  65. package/dist/cjs/validators/base64.cjs +1 -73
  66. package/dist/cjs/validators/bigint.cjs +1 -232
  67. package/dist/cjs/validators/boolean.cjs +1 -146
  68. package/dist/cjs/validators/codec.cjs +1 -205
  69. package/dist/cjs/validators/custom.cjs +1 -71
  70. package/dist/cjs/validators/date.cjs +1 -278
  71. package/dist/cjs/validators/discriminated-union.cjs +1 -130
  72. package/dist/cjs/validators/enum.cjs +1 -154
  73. package/dist/cjs/validators/file.cjs +1 -130
  74. package/dist/cjs/validators/function.cjs +1 -63
  75. package/dist/cjs/validators/hex.cjs +1 -70
  76. package/dist/cjs/validators/index.cjs +1 -123
  77. package/dist/cjs/validators/intersection.cjs +1 -120
  78. package/dist/cjs/validators/json.cjs +1 -70
  79. package/dist/cjs/validators/lazy.cjs +1 -53
  80. package/dist/cjs/validators/literal.cjs +1 -64
  81. package/dist/cjs/validators/map.cjs +1 -218
  82. package/dist/cjs/validators/nan.cjs +1 -41
  83. package/dist/cjs/validators/never.cjs +1 -36
  84. package/dist/cjs/validators/null.cjs +1 -43
  85. package/dist/cjs/validators/number.cjs +1 -427
  86. package/dist/cjs/validators/object.cjs +1 -868
  87. package/dist/cjs/validators/promise.cjs +1 -115
  88. package/dist/cjs/validators/record.cjs +1 -262
  89. package/dist/cjs/validators/set.cjs +1 -203
  90. package/dist/cjs/validators/string-bool.cjs +1 -124
  91. package/dist/cjs/validators/string-formats.cjs +1 -168
  92. package/dist/cjs/validators/string.cjs +1 -12
  93. package/dist/cjs/validators/symbol.cjs +1 -62
  94. package/dist/cjs/validators/template-literal.cjs +1 -108
  95. package/dist/cjs/validators/tuple.cjs +1 -187
  96. package/dist/cjs/validators/uint8array.cjs +1 -106
  97. package/dist/cjs/validators/undefined.cjs +1 -43
  98. package/dist/cjs/validators/union.cjs +1 -191
  99. package/dist/cjs/validators/unknown.cjs +1 -40
  100. package/dist/cjs/validators/void.cjs +1 -48
  101. package/dist/cjs/validators/xor.cjs +1 -69
  102. package/dist/cli/bin.js +1 -406
  103. package/dist/cli/index.js +1 -205
  104. package/dist/codecs/index.js +1 -11
  105. package/dist/coercion/index.js +1 -579
  106. package/dist/compat/emitter.js +1 -180
  107. package/dist/compat/result.js +1 -170
  108. package/dist/errors-core.d.ts +20 -1
  109. package/dist/errors.js +1 -171
  110. package/dist/index.d.ts +248 -357
  111. package/dist/index.js +1 -1534
  112. package/dist/kernel.js +1 -409
  113. package/dist/locales/af.js +1 -106
  114. package/dist/locales/ar.js +1 -106
  115. package/dist/locales/bn.js +1 -106
  116. package/dist/locales/da.js +1 -106
  117. package/dist/locales/de.js +1 -106
  118. package/dist/locales/en.js +1 -106
  119. package/dist/locales/es-MX.js +1 -105
  120. package/dist/locales/es.js +1 -94
  121. package/dist/locales/fi.js +1 -106
  122. package/dist/locales/fr.js +1 -94
  123. package/dist/locales/hi.js +1 -106
  124. package/dist/locales/id.js +1 -106
  125. package/dist/locales/index.js +1 -29
  126. package/dist/locales/it.js +1 -106
  127. package/dist/locales/ja.js +1 -106
  128. package/dist/locales/ko.js +1 -106
  129. package/dist/locales/lazy.js +1 -177
  130. package/dist/locales/nl.js +1 -106
  131. package/dist/locales/no.js +1 -106
  132. package/dist/locales/pl.js +1 -106
  133. package/dist/locales/pt-BR.js +1 -106
  134. package/dist/locales/pt.js +1 -106
  135. package/dist/locales/ru.js +1 -106
  136. package/dist/locales/runtime.js +1 -41
  137. package/dist/locales/sv.js +1 -106
  138. package/dist/locales/sw.js +1 -106
  139. package/dist/locales/th.js +1 -106
  140. package/dist/locales/tr.js +1 -106
  141. package/dist/locales/vi.js +1 -106
  142. package/dist/locales/zh.js +1 -106
  143. package/dist/mini.d.ts +3 -3
  144. package/dist/mini.js +1 -156
  145. package/dist/pigment.js +1 -180
  146. package/dist/plugins/index.js +1 -1
  147. package/dist/registry.js +1 -34
  148. package/dist/utils/json-schema.d.ts +10 -1
  149. package/dist/v3/index.js +1 -46
  150. package/dist/v4/core/index.d.ts +28 -16
  151. package/dist/v4/core/index.js +1 -277
  152. package/dist/v4/index.js +1 -50
  153. package/dist/v4/locales/index.d.ts +4 -0
  154. package/dist/v4/locales/index.js +1 -77
  155. package/dist/v4/mini/index.js +1 -47
  156. package/dist/v4-mini/index.d.ts +1 -1
  157. package/dist/v4-mini/index.js +1 -75
  158. package/dist/validators/any.js +1 -37
  159. package/dist/validators/array.d.ts +7 -0
  160. package/dist/validators/array.js +1 -279
  161. package/dist/validators/base.d.ts +63 -8
  162. package/dist/validators/base.js +1 -868
  163. package/dist/validators/base64.js +1 -68
  164. package/dist/validators/bigint.js +1 -228
  165. package/dist/validators/boolean.js +1 -142
  166. package/dist/validators/codec.js +1 -200
  167. package/dist/validators/custom.js +1 -67
  168. package/dist/validators/date.js +1 -274
  169. package/dist/validators/discriminated-union.d.ts +2 -2
  170. package/dist/validators/discriminated-union.js +1 -123
  171. package/dist/validators/enum.js +1 -150
  172. package/dist/validators/file.js +1 -125
  173. package/dist/validators/function.js +1 -58
  174. package/dist/validators/hex.js +1 -65
  175. package/dist/validators/index.d.ts +1 -1
  176. package/dist/validators/index.js +1 -35
  177. package/dist/validators/intersection.js +1 -116
  178. package/dist/validators/json.js +1 -66
  179. package/dist/validators/lazy.js +1 -50
  180. package/dist/validators/literal.d.ts +7 -3
  181. package/dist/validators/literal.js +1 -60
  182. package/dist/validators/map.js +1 -214
  183. package/dist/validators/nan.js +1 -38
  184. package/dist/validators/never.js +1 -32
  185. package/dist/validators/null.js +1 -40
  186. package/dist/validators/number.d.ts +20 -1
  187. package/dist/validators/number.js +1 -423
  188. package/dist/validators/object.d.ts +12 -2
  189. package/dist/validators/object.js +1 -864
  190. package/dist/validators/promise.js +1 -111
  191. package/dist/validators/record.d.ts +11 -8
  192. package/dist/validators/record.js +1 -258
  193. package/dist/validators/set.js +1 -199
  194. package/dist/validators/string-bool.js +1 -120
  195. package/dist/validators/string-formats.d.ts +58 -62
  196. package/dist/validators/string-formats.js +1 -135
  197. package/dist/validators/string.d.ts +47 -10
  198. package/dist/validators/string.js +1 -4
  199. package/dist/validators/symbol.js +1 -58
  200. package/dist/validators/template-literal.js +1 -103
  201. package/dist/validators/tuple.d.ts +17 -13
  202. package/dist/validators/tuple.js +1 -183
  203. package/dist/validators/uint8array.js +1 -101
  204. package/dist/validators/undefined.js +1 -40
  205. package/dist/validators/union.js +1 -187
  206. package/dist/validators/unknown.js +1 -37
  207. package/dist/validators/void.js +1 -44
  208. package/dist/validators/xor.d.ts +2 -2
  209. package/dist/validators/xor.js +1 -66
  210. package/package.json +239 -238
  211. package/dist/chunks/errors-core-BeiFUtZM.js +0 -81
  212. package/dist/chunks/index-0R2ntSud.js +0 -508
  213. package/dist/chunks/index-BvH403Yy.js +0 -88
  214. package/dist/chunks/security-B0Pd_vSY.js +0 -35
  215. package/dist/chunks/string-BJRQod3t.js +0 -530
  216. package/dist/cjs/chunks/errors-core-DWxLFs2f.cjs +0 -83
  217. package/dist/cjs/chunks/index-BkI37108.cjs +0 -538
  218. package/dist/cjs/chunks/index-Cc3bjUMX.cjs +0 -91
  219. package/dist/cjs/chunks/security-Dc3Jh13T.cjs +0 -37
  220. package/dist/cjs/chunks/string-BKZrc4hs.cjs +0 -533
package/dist/kernel.js CHANGED
@@ -1,409 +1 @@
1
- import { createEmitter } from './compat/emitter.js';
2
-
3
- /**
4
- * VLD Kernel
5
- *
6
- * The kernel is the core of the VLD plugin system.
7
- * It manages plugins, validators, transforms, and codecs.
8
- */
9
- /**
10
- * Create the VLD kernel
11
- */
12
- function createVldKernel(options = {}) {
13
- // ============================================
14
- // State
15
- // ============================================
16
- const context = {
17
- locale: 'en',
18
- strict: false,
19
- debug: options.debug ?? false,
20
- custom: {},
21
- ...options.context
22
- };
23
- const plugins = new Map();
24
- const validators = new Map();
25
- const transforms = new Map();
26
- const codecs = new Map();
27
- const emitter = createEmitter();
28
- const errorStrategy = options.errorStrategy ?? 'throw';
29
- // ============================================
30
- // Context Management
31
- // ============================================
32
- const getContext = () => ({ ...context });
33
- const setContext = (partial) => {
34
- Object.assign(context, partial);
35
- };
36
- // ============================================
37
- // Plugin Management
38
- // ============================================
39
- const use = (plugin) => {
40
- if (plugins.has(plugin.name)) {
41
- if (errorStrategy === 'throw') {
42
- throw new Error(`Plugin "${plugin.name}" is already registered`);
43
- }
44
- return kernel;
45
- }
46
- // Register plugin validators
47
- if (plugin.validators) {
48
- for (const [name, factory] of Object.entries(plugin.validators)) {
49
- validators.set(name, factory);
50
- }
51
- }
52
- // Register plugin transforms
53
- if (plugin.transforms) {
54
- for (const [name, factory] of Object.entries(plugin.transforms)) {
55
- transforms.set(name, factory);
56
- }
57
- }
58
- // Register plugin codecs
59
- if (plugin.codecs) {
60
- for (const [name, codec] of Object.entries(plugin.codecs)) {
61
- codecs.set(name, codec);
62
- }
63
- }
64
- // Store plugin
65
- plugins.set(plugin.name, plugin);
66
- // Call install hook
67
- if (plugin.install) {
68
- try {
69
- const result = plugin.install(kernel);
70
- if (result instanceof Promise) {
71
- result.catch((err) => {
72
- if (context.debug) {
73
- console.error(`Error installing plugin "${plugin.name}":`, err);
74
- }
75
- });
76
- }
77
- }
78
- catch (err) {
79
- if (errorStrategy === 'throw') {
80
- throw err;
81
- }
82
- if (context.debug) {
83
- console.error(`Error installing plugin "${plugin.name}":`, err);
84
- }
85
- }
86
- }
87
- // Emit event
88
- emitter.emit('vld:plugin:registered', {
89
- name: plugin.name,
90
- version: plugin.version,
91
- timestamp: Date.now()
92
- });
93
- return kernel;
94
- };
95
- const remove = (name) => {
96
- const plugin = plugins.get(name);
97
- if (!plugin)
98
- return false;
99
- // Call uninstall hook
100
- if (plugin.uninstall) {
101
- try {
102
- const result = plugin.uninstall(kernel);
103
- if (result instanceof Promise) {
104
- result.catch((err) => {
105
- if (context.debug) {
106
- console.error(`Error uninstalling plugin "${name}":`, err);
107
- }
108
- });
109
- }
110
- }
111
- catch (err) {
112
- if (context.debug) {
113
- console.error(`Error uninstalling plugin "${name}":`, err);
114
- }
115
- }
116
- }
117
- // Remove plugin validators
118
- if (plugin.validators) {
119
- for (const validatorName of Object.keys(plugin.validators)) {
120
- validators.delete(validatorName);
121
- }
122
- }
123
- // Remove plugin transforms
124
- if (plugin.transforms) {
125
- for (const transformName of Object.keys(plugin.transforms)) {
126
- transforms.delete(transformName);
127
- }
128
- }
129
- // Remove plugin codecs
130
- if (plugin.codecs) {
131
- for (const codecName of Object.keys(plugin.codecs)) {
132
- codecs.delete(codecName);
133
- }
134
- }
135
- return plugins.delete(name);
136
- };
137
- const getPlugin = (name) => plugins.get(name);
138
- const getPlugins = () => Array.from(plugins.values());
139
- const hasPlugin = (name) => plugins.has(name);
140
- // ============================================
141
- // Validator Registry
142
- // ============================================
143
- const registerValidator = (name, factory) => {
144
- validators.set(name, factory);
145
- emitter.emit('vld:validator:registered', {
146
- name,
147
- timestamp: Date.now()
148
- });
149
- return kernel;
150
- };
151
- const getValidator = (name) => {
152
- const factory = validators.get(name);
153
- return factory ? factory() : undefined;
154
- };
155
- const getValidators = () => Object.fromEntries(validators);
156
- // ============================================
157
- // Transform Registry
158
- // ============================================
159
- const registerTransform = (name, factory) => {
160
- transforms.set(name, factory);
161
- return kernel;
162
- };
163
- const getTransform = (name) => transforms.get(name);
164
- // ============================================
165
- // Codec Registry
166
- // ============================================
167
- const registerCodec = (name, codec) => {
168
- codecs.set(name, codec);
169
- emitter.emit('vld:codec:registered', {
170
- name,
171
- timestamp: Date.now()
172
- });
173
- return kernel;
174
- };
175
- const getCodec = (name) => codecs.get(name);
176
- // ============================================
177
- // Hook Execution
178
- // ============================================
179
- const executeBeforeParse = (value, schema, hookContext) => {
180
- let currentValue = value;
181
- for (const plugin of plugins.values()) {
182
- if (plugin.onBeforeParse) {
183
- try {
184
- currentValue = plugin.onBeforeParse(currentValue, schema, hookContext);
185
- }
186
- catch (err) {
187
- if (errorStrategy === 'throw')
188
- throw err;
189
- if (context.debug) {
190
- console.error(`Error in onBeforeParse hook of "${plugin.name}":`, err);
191
- }
192
- }
193
- }
194
- }
195
- return currentValue;
196
- };
197
- const executeAfterParse = (result, schema, hookContext) => {
198
- let currentResult = result;
199
- for (const plugin of plugins.values()) {
200
- if (plugin.onAfterParse) {
201
- try {
202
- currentResult = plugin.onAfterParse(currentResult, schema, hookContext);
203
- }
204
- catch (err) {
205
- if (errorStrategy === 'throw')
206
- throw err;
207
- if (context.debug) {
208
- console.error(`Error in onAfterParse hook of "${plugin.name}":`, err);
209
- }
210
- }
211
- }
212
- }
213
- return currentResult;
214
- };
215
- const executeOnError = (error, schema, hookContext) => {
216
- for (const plugin of plugins.values()) {
217
- if (plugin.onError) {
218
- try {
219
- plugin.onError(error, schema, hookContext);
220
- }
221
- catch (err) {
222
- if (context.debug) {
223
- console.error(`Error in onError hook of "${plugin.name}":`, err);
224
- }
225
- }
226
- }
227
- }
228
- };
229
- const executeOnSuccess = (data, schema, hookContext) => {
230
- for (const plugin of plugins.values()) {
231
- if (plugin.onSuccess) {
232
- try {
233
- plugin.onSuccess(data, schema, hookContext);
234
- }
235
- catch (err) {
236
- if (context.debug) {
237
- console.error(`Error in onSuccess hook of "${plugin.name}":`, err);
238
- }
239
- }
240
- }
241
- }
242
- };
243
- // ============================================
244
- // Lifecycle
245
- // ============================================
246
- const dispose = async () => {
247
- // Uninstall all plugins in reverse order
248
- const pluginList = Array.from(plugins.values()).reverse();
249
- for (const plugin of pluginList) {
250
- if (plugin.uninstall) {
251
- try {
252
- await plugin.uninstall(kernel);
253
- }
254
- catch (err) {
255
- if (context.debug) {
256
- console.error(`Error uninstalling plugin "${plugin.name}":`, err);
257
- }
258
- }
259
- }
260
- }
261
- // Clear all registries
262
- plugins.clear();
263
- validators.clear();
264
- transforms.clear();
265
- codecs.clear();
266
- emitter.removeAllListeners();
267
- };
268
- // ============================================
269
- // Kernel Instance
270
- // ============================================
271
- const kernel = {
272
- // Context
273
- getContext,
274
- setContext,
275
- // Plugins
276
- use,
277
- remove,
278
- getPlugin,
279
- getPlugins,
280
- hasPlugin,
281
- // Validators
282
- registerValidator,
283
- getValidator,
284
- getValidators,
285
- // Transforms
286
- registerTransform,
287
- getTransform,
288
- // Codecs
289
- registerCodec,
290
- getCodec,
291
- // Hooks
292
- executeBeforeParse,
293
- executeAfterParse,
294
- executeOnError,
295
- executeOnSuccess,
296
- // Lifecycle
297
- dispose
298
- };
299
- // ============================================
300
- // Load Initial Plugins
301
- // ============================================
302
- if (options.plugins) {
303
- for (const plugin of options.plugins) {
304
- use(plugin);
305
- }
306
- }
307
- return kernel;
308
- }
309
- // ============================================
310
- // Plugin Builder
311
- // ============================================
312
- /**
313
- * Create a plugin using the builder pattern
314
- */
315
- function definePlugin() {
316
- let _name = '';
317
- let _version = '1.0.0';
318
- let _description = '';
319
- const _validators = {};
320
- const _transforms = {};
321
- const _codecs = {};
322
- const _hooks = {};
323
- let _install;
324
- const builder = {
325
- name(name) {
326
- _name = name;
327
- return this;
328
- },
329
- version(version) {
330
- _version = version;
331
- return this;
332
- },
333
- description(description) {
334
- _description = description;
335
- return this;
336
- },
337
- validator(name, factory) {
338
- _validators[name] = factory;
339
- return this;
340
- },
341
- transform(name, factory) {
342
- _transforms[name] = factory;
343
- return this;
344
- },
345
- codec(name, codec) {
346
- _codecs[name] = codec;
347
- return this;
348
- },
349
- hook(name, fn) {
350
- _hooks[name] = fn;
351
- return this;
352
- },
353
- install(fn) {
354
- _install = fn;
355
- return this;
356
- },
357
- build() {
358
- if (!_name) {
359
- throw new Error('Plugin name is required');
360
- }
361
- const plugin = {
362
- name: _name,
363
- version: _version,
364
- description: _description,
365
- ..._hooks
366
- };
367
- if (Object.keys(_validators).length > 0)
368
- plugin.validators = _validators;
369
- if (Object.keys(_transforms).length > 0)
370
- plugin.transforms = _transforms;
371
- if (Object.keys(_codecs).length > 0)
372
- plugin.codecs = _codecs;
373
- if (_install !== undefined)
374
- plugin.install = _install;
375
- return plugin;
376
- }
377
- };
378
- return builder;
379
- }
380
- // ============================================
381
- // Global Kernel Instance
382
- // ============================================
383
- let globalKernel = null;
384
- /**
385
- * Get or create the global VLD kernel
386
- */
387
- function getVldKernel(options) {
388
- if (!globalKernel) {
389
- globalKernel = createVldKernel(options);
390
- }
391
- return globalKernel;
392
- }
393
- /**
394
- * Reset the global VLD kernel
395
- */
396
- async function resetVldKernel() {
397
- if (globalKernel) {
398
- await globalKernel.dispose();
399
- globalKernel = null;
400
- }
401
- }
402
- /**
403
- * Use a plugin with the global kernel
404
- */
405
- function usePlugin(plugin) {
406
- return getVldKernel().use(plugin);
407
- }
408
-
409
- export { createVldKernel, definePlugin, getVldKernel, resetVldKernel, usePlugin };
1
+ import{createEmitter as e}from"./compat/emitter.js";function r(r={}){const t={locale:"en",strict:!1,debug:r.debug??!1,custom:{},...r.context},o=new Map,n=new Map,s=new Map,i=new Map,a=e(),c=r.errorStrategy??"throw",l=e=>{if(o.has(e.name)){if("throw"===c)throw new Error(`Plugin "${e.name}" is already registered`);return u}if(e.validators)for(const[r,t]of Object.entries(e.validators))n.set(r,t);if(e.transforms)for(const[r,t]of Object.entries(e.transforms))s.set(r,t);if(e.codecs)for(const[r,t]of Object.entries(e.codecs))i.set(r,t);if(o.set(e.name,e),e.install)try{const r=e.install(u);r instanceof Promise&&r.catch(r=>{t.debug&&console.error(`Error installing plugin "${e.name}":`,r)})}catch(r){if("throw"===c)throw r;t.debug&&console.error(`Error installing plugin "${e.name}":`,r)}return a.emit("vld:plugin:registered",{name:e.name,version:e.version,timestamp:Date.now()}),u},u={getContext:()=>({...t}),setContext:e=>{Object.assign(t,e)},use:l,remove:e=>{const r=o.get(e);if(!r)return!1;if(r.uninstall)try{const o=r.uninstall(u);o instanceof Promise&&o.catch(r=>{t.debug&&console.error(`Error uninstalling plugin "${e}":`,r)})}catch(r){t.debug&&console.error(`Error uninstalling plugin "${e}":`,r)}if(r.validators)for(const e of Object.keys(r.validators))n.delete(e);if(r.transforms)for(const e of Object.keys(r.transforms))s.delete(e);if(r.codecs)for(const e of Object.keys(r.codecs))i.delete(e);return o.delete(e)},getPlugin:e=>o.get(e),getPlugins:()=>Array.from(o.values()),hasPlugin:e=>o.has(e),registerValidator:(e,r)=>(n.set(e,r),a.emit("vld:validator:registered",{name:e,timestamp:Date.now()}),u),getValidator:e=>{const r=n.get(e);return r?r():void 0},getValidators:()=>Object.fromEntries(n),registerTransform:(e,r)=>(s.set(e,r),u),getTransform:e=>s.get(e),registerCodec:(e,r)=>(i.set(e,r),a.emit("vld:codec:registered",{name:e,timestamp:Date.now()}),u),getCodec:e=>i.get(e),executeBeforeParse:(e,r,n)=>{let s=e;for(const e of o.values())if(e.onBeforeParse)try{s=e.onBeforeParse(s,r,n)}catch(r){if("throw"===c)throw r;t.debug&&console.error(`Error in onBeforeParse hook of "${e.name}":`,r)}return s},executeAfterParse:(e,r,n)=>{let s=e;for(const e of o.values())if(e.onAfterParse)try{s=e.onAfterParse(s,r,n)}catch(r){if("throw"===c)throw r;t.debug&&console.error(`Error in onAfterParse hook of "${e.name}":`,r)}return s},executeOnError:(e,r,n)=>{for(const s of o.values())if(s.onError)try{s.onError(e,r,n)}catch(e){t.debug&&console.error(`Error in onError hook of "${s.name}":`,e)}},executeOnSuccess:(e,r,n)=>{for(const s of o.values())if(s.onSuccess)try{s.onSuccess(e,r,n)}catch(e){t.debug&&console.error(`Error in onSuccess hook of "${s.name}":`,e)}},dispose:async()=>{const e=Array.from(o.values()).reverse();for(const r of e)if(r.uninstall)try{await r.uninstall(u)}catch(e){t.debug&&console.error(`Error uninstalling plugin "${r.name}":`,e)}o.clear(),n.clear(),s.clear(),i.clear(),a.removeAllListeners()}};if(r.plugins)for(const e of r.plugins)l(e);return u}function t(){let e="",r="1.0.0",t="";const o={},n={},s={},i={};let a;return{name(r){return e=r,this},version(e){return r=e,this},description(e){return t=e,this},validator(e,r){return o[e]=r,this},transform(e,r){return n[e]=r,this},codec(e,r){return s[e]=r,this},hook(e,r){return i[e]=r,this},install(e){return a=e,this},build(){if(!e)throw new Error("Plugin name is required");const c={name:e,version:r,description:t,...i};return Object.keys(o).length>0&&(c.validators=o),Object.keys(n).length>0&&(c.transforms=n),Object.keys(s).length>0&&(c.codecs=s),void 0!==a&&(c.install=a),c}}}let o=null;function n(e){return o||(o=r(e)),o}async function s(){o&&(await o.dispose(),o=null)}function i(e){return n().use(e)}export{r as createVldKernel,t as definePlugin,n as getVldKernel,s as resetVldKernel,i as usePlugin};
@@ -1,106 +1 @@
1
- const af = {
2
- // String validation messages
3
- invalidString: 'Ongeldige string',
4
- stringMin: (min) => `String moet ten minste ${min} karakters lank wees`,
5
- stringMax: (max) => `String mag hoogstens ${max} karakters lank wees`,
6
- stringLength: (length) => `String moet presies ${length} karakters lank wees`,
7
- stringEmail: 'Ongeldige e-pos adres',
8
- stringUrl: 'Ongeldige URL',
9
- stringUuid: 'Ongeldige UUID',
10
- stringRegex: 'Ongeldige formaat',
11
- stringStartsWith: (prefix) => `String moet begin met "${prefix}"`,
12
- stringEndsWith: (suffix) => `String moet eindig met "${suffix}"`,
13
- stringIncludes: (substring) => `String moet "${substring}" bevat`,
14
- stringIp: 'Ongeldige IP adres',
15
- stringIpv4: 'Ongeldige IPv4 adres',
16
- stringIpv6: 'Ongeldige IPv6 adres',
17
- stringEmpty: 'String mag nie leeg wees nie',
18
- // Number validation messages
19
- invalidNumber: 'Ongeldige getal',
20
- numberMin: (min) => `Getal moet ten minste ${min} wees`,
21
- numberMax: (max) => `Getal mag hoogstens ${max} wees`,
22
- numberInt: "Getal moet 'n heelgetal wees",
23
- numberPositive: 'Getal moet positief wees',
24
- numberNegative: 'Getal moet negatief wees',
25
- numberNonnegative: 'Getal mag nie negatief wees nie',
26
- numberNonpositive: 'Getal mag nie positief wees nie',
27
- numberFinite: 'Getal moet eindig wees',
28
- numberSafe: "Getal moet 'n veilige heelgetal wees",
29
- numberMultipleOf: (value) => `Getal moet 'n veelvoud van ${value} wees`,
30
- // Boolean validation messages
31
- invalidBoolean: 'Ongeldige boolean waarde',
32
- // Date validation messages
33
- invalidDate: 'Ongeldige datum',
34
- dateMin: (date) => `Datum moet na ${date.toISOString()} wees`,
35
- dateMax: (date) => `Datum moet voor ${date.toISOString()} wees`,
36
- // Object validation messages
37
- invalidObject: 'Ongeldige objek',
38
- unexpectedKeys: (keys) => `Onverwagte sleutels: ${keys.join(', ')}`,
39
- // Array validation messages
40
- invalidArray: 'Ongeldige skikking',
41
- arrayMin: (min) => `Skikking moet ten minste ${min} elemente hê`,
42
- arrayMax: (max) => `Skikking mag hoogstens ${max} elemente hê`,
43
- arrayLength: (length) => `Skikking moet presies ${length} elemente hê`,
44
- arrayEmpty: 'Skikking mag nie leeg wees nie',
45
- arrayItem: (index, error) => `Ongeldige element by indeks ${index}: ${error}`,
46
- // Object field validation
47
- objectField: (field, error) => `Ongeldige veld "${field}": ${error}`,
48
- // Union validation messages
49
- unionNoMatch: (errors) => `Geen union lid het gepas nie: ${errors.join(', ')}`,
50
- // Intersection validation messages
51
- intersectionError: (error) => `Intersection validasie het gefaal: ${error}`,
52
- // Literal validation messages
53
- literalExpected: (expected, received) => `Verwag ${expected}, ontvang ${received}`,
54
- // Enum validation messages
55
- enumExpected: (values, received) => `Verwag een van [${values.join(', ')}], ontvang ${received}`,
56
- // Special type validation messages
57
- expectedUndefined: 'Verwag undefined',
58
- neverType: 'Never tipe kan nie geparseer word nie',
59
- // New advanced type validation messages
60
- invalidBigint: 'Ongeldige bigint',
61
- invalidSymbol: 'Ongeldige simbool',
62
- invalidTuple: 'Ongeldige tupel',
63
- tupleLength: (expected, received) => `Tupel moet presies ${expected} elemente hê, ontvang ${received}`,
64
- invalidRecord: 'Ongeldige rekord',
65
- invalidSet: 'Ongeldige Set',
66
- invalidMap: 'Ongeldige Map',
67
- // Transformation and refinement messages
68
- transformError: (error) => `Transformasie het gefaal: ${error}`,
69
- refinementError: (error) => `Verfyning het gefaal: ${error}`,
70
- customValidationError: (error) => `Pasgemaakte validasie het misluk: ${error}`,
71
- // Coercion messages
72
- coercionFailed: (type, value) => `Kan nie ${JSON.stringify(value)} na ${type} dwing nie`,
73
- // Codec messages
74
- codecDecodeFailed: 'Failed to decode value',
75
- codecEncodeFailed: 'Failed to encode value',
76
- codecAsyncNotSupported: 'Async codec operations require using parseAsync/encodeAsync methods',
77
- // Base64/Hex messages
78
- invalidBase64: 'Invalid base64 string',
79
- invalidHex: 'Invalid hexadecimal string',
80
- // Uint8Array messages
81
- expectedUint8Array: 'Expected Uint8Array',
82
- uint8ArrayMinLength: (min) => `Uint8Array must have at least ${min} bytes`,
83
- uint8ArrayMaxLength: (max) => `Uint8Array must have at most ${max} bytes`,
84
- uint8ArrayExactLength: (length) => `Uint8Array must have exactly ${length} bytes`,
85
- // Generic type error messages
86
- expectedString: 'Expected string',
87
- stringExpected: (received, expected) => `Verwag ${expected}, ontvang ${received}`,
88
- stringBoolExpected: (validValues, received) => `Ongeldige boolean string. Een van die volgende verwag: ${validValues}, ontvang: "${received}"`,
89
- invalidJson: 'Ongeldige JSON',
90
- stringPatternInvalid: 'String stem nie ooreen met die vereiste patroon nie',
91
- // File validation messages
92
- invalidFile: 'Expected a File object',
93
- fileNotSupported: 'File API not supported in this environment',
94
- fileMinSize: (min) => `File size must be at least ${min} bytes`,
95
- fileMaxSize: (max) => `File size must not exceed ${max} bytes`,
96
- fileMimeType: (allowed) => `Invalid file type. Expected: ${allowed.join(', ')}`,
97
- // Function validation messages
98
- invalidFunction: "'n Funksie word verwag",
99
- // CIDR validation messages
100
- stringCidrv4: 'Ongeldige IPv4 CIDR-blok',
101
- stringCidrv6: 'Ongeldige IPv6 CIDR-blok',
102
- // Safe extend validation messages
103
- safeExtendOverlap: (keys) => `Kan nie bestaande sleutels oorskryf nie: ${keys.join(', ')}. Gebruik extend() om te oorskryf.`
104
- };
105
-
106
- export { af };
1
+ const e={invalidString:"Ongeldige string",stringMin:e=>`String moet ten minste ${e} karakters lank wees`,stringMax:e=>`String mag hoogstens ${e} karakters lank wees`,stringLength:e=>`String moet presies ${e} karakters lank wees`,stringEmail:"Ongeldige e-pos adres",stringUrl:"Ongeldige URL",stringUuid:"Ongeldige UUID",stringRegex:"Ongeldige formaat",stringStartsWith:e=>`String moet begin met "${e}"`,stringEndsWith:e=>`String moet eindig met "${e}"`,stringIncludes:e=>`String moet "${e}" bevat`,stringIp:"Ongeldige IP adres",stringIpv4:"Ongeldige IPv4 adres",stringIpv6:"Ongeldige IPv6 adres",stringEmpty:"String mag nie leeg wees nie",invalidNumber:"Ongeldige getal",numberMin:e=>`Getal moet ten minste ${e} wees`,numberMax:e=>`Getal mag hoogstens ${e} wees`,numberInt:"Getal moet 'n heelgetal wees",numberPositive:"Getal moet positief wees",numberNegative:"Getal moet negatief wees",numberNonnegative:"Getal mag nie negatief wees nie",numberNonpositive:"Getal mag nie positief wees nie",numberFinite:"Getal moet eindig wees",numberSafe:"Getal moet 'n veilige heelgetal wees",numberMultipleOf:e=>`Getal moet 'n veelvoud van ${e} wees`,invalidBoolean:"Ongeldige boolean waarde",invalidDate:"Ongeldige datum",dateMin:e=>`Datum moet na ${e.toISOString()} wees`,dateMax:e=>`Datum moet voor ${e.toISOString()} wees`,invalidObject:"Ongeldige objek",unexpectedKeys:e=>`Onverwagte sleutels: ${e.join(", ")}`,invalidArray:"Ongeldige skikking",arrayMin:e=>`Skikking moet ten minste ${e} elemente hê`,arrayMax:e=>`Skikking mag hoogstens ${e} elemente hê`,arrayLength:e=>`Skikking moet presies ${e} elemente hê`,arrayEmpty:"Skikking mag nie leeg wees nie",arrayItem:(e,n)=>`Ongeldige element by indeks ${e}: ${n}`,objectField:(e,n)=>`Ongeldige veld "${e}": ${n}`,unionNoMatch:e=>`Geen union lid het gepas nie: ${e.join(", ")}`,intersectionError:e=>`Intersection validasie het gefaal: ${e}`,literalExpected:(e,n)=>`Verwag ${e}, ontvang ${n}`,enumExpected:(e,n)=>`Verwag een van [${e.join(", ")}], ontvang ${n}`,expectedUndefined:"Verwag undefined",neverType:"Never tipe kan nie geparseer word nie",invalidBigint:"Ongeldige bigint",invalidSymbol:"Ongeldige simbool",invalidTuple:"Ongeldige tupel",tupleLength:(e,n)=>`Tupel moet presies ${e} elemente hê, ontvang ${n}`,invalidRecord:"Ongeldige rekord",invalidSet:"Ongeldige Set",invalidMap:"Ongeldige Map",transformError:e=>`Transformasie het gefaal: ${e}`,refinementError:e=>`Verfyning het gefaal: ${e}`,customValidationError:e=>`Pasgemaakte validasie het misluk: ${e}`,coercionFailed:(e,n)=>`Kan nie ${JSON.stringify(n)} na ${e} dwing nie`,codecDecodeFailed:"Failed to decode value",codecEncodeFailed:"Failed to encode value",codecAsyncNotSupported:"Async codec operations require using parseAsync/encodeAsync methods",invalidBase64:"Invalid base64 string",invalidHex:"Invalid hexadecimal string",expectedUint8Array:"Expected Uint8Array",uint8ArrayMinLength:e=>`Uint8Array must have at least ${e} bytes`,uint8ArrayMaxLength:e=>`Uint8Array must have at most ${e} bytes`,uint8ArrayExactLength:e=>`Uint8Array must have exactly ${e} bytes`,expectedString:"Expected string",stringExpected:(e,n)=>`Verwag ${n}, ontvang ${e}`,stringBoolExpected:(e,n)=>`Ongeldige boolean string. Een van die volgende verwag: ${e}, ontvang: "${n}"`,invalidJson:"Ongeldige JSON",stringPatternInvalid:"String stem nie ooreen met die vereiste patroon nie",invalidFile:"Expected a File object",fileNotSupported:"File API not supported in this environment",fileMinSize:e=>`File size must be at least ${e} bytes`,fileMaxSize:e=>`File size must not exceed ${e} bytes`,fileMimeType:e=>`Invalid file type. Expected: ${e.join(", ")}`,invalidFunction:"'n Funksie word verwag",stringCidrv4:"Ongeldige IPv4 CIDR-blok",stringCidrv6:"Ongeldige IPv6 CIDR-blok",safeExtendOverlap:e=>`Kan nie bestaande sleutels oorskryf nie: ${e.join(", ")}. Gebruik extend() om te oorskryf.`};export{e as af};
@@ -1,106 +1 @@
1
- const ar = {
2
- // String validation messages
3
- invalidString: 'نص غير صحيح',
4
- stringMin: (min) => `يجب أن يحتوي النص على ${min} حرف على الأقل`,
5
- stringMax: (max) => `لا يمكن أن يحتوي النص على أكثر من ${max} حرف`,
6
- stringLength: (length) => `يجب أن يحتوي النص على ${length} حرف بالضبط`,
7
- stringEmail: 'عنوان بريد إلكتروني غير صحيح',
8
- stringUrl: 'رابط غير صحيح',
9
- stringUuid: 'UUID غير صحيح',
10
- stringRegex: 'تنسيق غير صحيح',
11
- stringStartsWith: (prefix) => `يجب أن يبدأ النص بـ "${prefix}"`,
12
- stringEndsWith: (suffix) => `يجب أن ينتهي النص بـ "${suffix}"`,
13
- stringIncludes: (substring) => `يجب أن يحتوي النص على "${substring}"`,
14
- stringIp: 'عنوان IP غير صحيح',
15
- stringIpv4: 'عنوان IPv4 غير صحيح',
16
- stringIpv6: 'عنوان IPv6 غير صحيح',
17
- stringEmpty: 'لا يمكن أن يكون النص فارغاً',
18
- // Number validation messages
19
- invalidNumber: 'رقم غير صحيح',
20
- numberMin: (min) => `يجب أن يكون الرقم ${min} على الأقل`,
21
- numberMax: (max) => `لا يمكن أن يكون الرقم أكبر من ${max}`,
22
- numberInt: 'يجب أن يكون الرقم صحيحاً',
23
- numberPositive: 'يجب أن يكون الرقم موجباً',
24
- numberNegative: 'يجب أن يكون الرقم سالباً',
25
- numberNonnegative: 'لا يمكن أن يكون الرقم سالباً',
26
- numberNonpositive: 'لا يمكن أن يكون الرقم موجباً',
27
- numberFinite: 'يجب أن يكون الرقم محدوداً',
28
- numberSafe: 'يجب أن يكون الرقم صحيحاً آمناً',
29
- numberMultipleOf: (value) => `يجب أن يكون الرقم مضاعفاً لـ ${value}`,
30
- // Boolean validation messages
31
- invalidBoolean: 'قيمة منطقية غير صحيحة',
32
- // Date validation messages
33
- invalidDate: 'تاريخ غير صحيح',
34
- dateMin: (date) => `يجب أن يكون التاريخ بعد ${date.toISOString()}`,
35
- dateMax: (date) => `يجب أن يكون التاريخ قبل ${date.toISOString()}`,
36
- // Object validation messages
37
- invalidObject: 'كائن غير صحيح',
38
- unexpectedKeys: (keys) => `مفاتيح غير متوقعة: ${keys.join(', ')}`,
39
- // Array validation messages
40
- invalidArray: 'مصفوفة غير صحيحة',
41
- arrayMin: (min) => `يجب أن تحتوي المصفوفة على ${min} عنصر على الأقل`,
42
- arrayMax: (max) => `لا يمكن أن تحتوي المصفوفة على أكثر من ${max} عنصر`,
43
- arrayLength: (length) => `يجب أن تحتوي المصفوفة على ${length} عنصر بالضبط`,
44
- arrayEmpty: 'لا يمكن أن تكون المصفوفة فارغة',
45
- arrayItem: (index, error) => `عنصر غير صحيح في الفهرس ${index}: ${error}`,
46
- // Object field validation
47
- objectField: (field, error) => `حقل غير صحيح "${field}": ${error}`,
48
- // Union validation messages
49
- unionNoMatch: (errors) => `لا يوجد عضو اتحاد مطابق: ${errors.join(', ')}`,
50
- // Intersection validation messages
51
- intersectionError: (error) => `فشل في التحقق من التقاطع: ${error}`,
52
- // Literal validation messages
53
- literalExpected: (expected, received) => `متوقع ${expected}، تم استلام ${received}`,
54
- // Enum validation messages
55
- enumExpected: (values, received) => `متوقع واحد من [${values.join(', ')}]، تم استلام ${received}`,
56
- // Special type validation messages
57
- expectedUndefined: 'متوقع undefined',
58
- neverType: 'لا يمكن تحليل نوع never',
59
- // New advanced type validation messages
60
- invalidBigint: 'bigint غير صحيح',
61
- invalidSymbol: 'رمز غير صحيح',
62
- invalidTuple: 'صف غير صحيح',
63
- tupleLength: (expected, received) => `يجب أن يحتوي الصف على ${expected} عنصر بالضبط، تم استلام ${received}`,
64
- invalidRecord: 'سجل غير صحيح',
65
- invalidSet: 'Set غير صحيح',
66
- invalidMap: 'Map غير صحيح',
67
- // Transformation and refinement messages
68
- transformError: (error) => `فشل التحويل: ${error}`,
69
- refinementError: (error) => `فشل التنقيح: ${error}`,
70
- customValidationError: (error) => `فشل في التحقق المخصص: ${error}`,
71
- // Coercion messages
72
- coercionFailed: (type, value) => `لا يمكن إكراه ${JSON.stringify(value)} إلى ${type}`,
73
- // Codec messages
74
- codecDecodeFailed: 'Failed to decode value',
75
- codecEncodeFailed: 'Failed to encode value',
76
- codecAsyncNotSupported: 'Async codec operations require using parseAsync/encodeAsync methods',
77
- // Base64/Hex messages
78
- invalidBase64: 'Invalid base64 string',
79
- invalidHex: 'Invalid hexadecimal string',
80
- // Uint8Array messages
81
- expectedUint8Array: 'Expected Uint8Array',
82
- uint8ArrayMinLength: (min) => `Uint8Array must have at least ${min} bytes`,
83
- uint8ArrayMaxLength: (max) => `Uint8Array must have at most ${max} bytes`,
84
- uint8ArrayExactLength: (length) => `Uint8Array must have exactly ${length} bytes`,
85
- // Generic type error messages
86
- expectedString: 'Expected string',
87
- stringExpected: (received, expected) => `متوقع ${expected}، تم استلام ${received}`,
88
- stringBoolExpected: (validValues, received) => `سلسلة منطقية غير صحيحة. متوقع واحد من: ${validValues}، تم استلام: "${received}"`,
89
- invalidJson: 'JSON غير صالح',
90
- stringPatternInvalid: 'السلسلة لا تطابق النمط المطلوب',
91
- // File validation messages
92
- invalidFile: 'Expected a File object',
93
- fileNotSupported: 'File API not supported in this environment',
94
- fileMinSize: (min) => `File size must be at least ${min} bytes`,
95
- fileMaxSize: (max) => `File size must not exceed ${max} bytes`,
96
- fileMimeType: (allowed) => `Invalid file type. Expected: ${allowed.join(", ")}`,
97
- // Function validation messages
98
- invalidFunction: 'دالة متوقعة',
99
- // CIDR validation messages
100
- stringCidrv4: 'كتلة CIDR IPv4 غير صالحة',
101
- stringCidrv6: 'كتلة CIDR IPv6 غير صالحة',
102
- // Safe extend validation messages
103
- safeExtendOverlap: (keys) => `لا يمكن استبدال المفاتيح الموجودة: ${keys.join(', ')}. استخدم extend() للاستبدال.`
104
- };
105
-
106
- export { ar };
1
+ const e={invalidString:"نص غير صحيح",stringMin:e=>`يجب أن يحتوي النص على ${e} حرف على الأقل`,stringMax:e=>`لا يمكن أن يحتوي النص على أكثر من ${e} حرف`,stringLength:e=>`يجب أن يحتوي النص على ${e} حرف بالضبط`,stringEmail:"عنوان بريد إلكتروني غير صحيح",stringUrl:"رابط غير صحيح",stringUuid:"UUID غير صحيح",stringRegex:"تنسيق غير صحيح",stringStartsWith:e=>`يجب أن يبدأ النص بـ "${e}"`,stringEndsWith:e=>`يجب أن ينتهي النص بـ "${e}"`,stringIncludes:e=>`يجب أن يحتوي النص على "${e}"`,stringIp:"عنوان IP غير صحيح",stringIpv4:"عنوان IPv4 غير صحيح",stringIpv6:"عنوان IPv6 غير صحيح",stringEmpty:"لا يمكن أن يكون النص فارغاً",invalidNumber:"رقم غير صحيح",numberMin:e=>`يجب أن يكون الرقم ${e} على الأقل`,numberMax:e=>`لا يمكن أن يكون الرقم أكبر من ${e}`,numberInt:"يجب أن يكون الرقم صحيحاً",numberPositive:"يجب أن يكون الرقم موجباً",numberNegative:"يجب أن يكون الرقم سالباً",numberNonnegative:"لا يمكن أن يكون الرقم سالباً",numberNonpositive:"لا يمكن أن يكون الرقم موجباً",numberFinite:"يجب أن يكون الرقم محدوداً",numberSafe:"يجب أن يكون الرقم صحيحاً آمناً",numberMultipleOf:e=>`يجب أن يكون الرقم مضاعفاً لـ ${e}`,invalidBoolean:"قيمة منطقية غير صحيحة",invalidDate:"تاريخ غير صحيح",dateMin:e=>`يجب أن يكون التاريخ بعد ${e.toISOString()}`,dateMax:e=>`يجب أن يكون التاريخ قبل ${e.toISOString()}`,invalidObject:"كائن غير صحيح",unexpectedKeys:e=>`مفاتيح غير متوقعة: ${e.join(", ")}`,invalidArray:"مصفوفة غير صحيحة",arrayMin:e=>`يجب أن تحتوي المصفوفة على ${e} عنصر على الأقل`,arrayMax:e=>`لا يمكن أن تحتوي المصفوفة على أكثر من ${e} عنصر`,arrayLength:e=>`يجب أن تحتوي المصفوفة على ${e} عنصر بالضبط`,arrayEmpty:"لا يمكن أن تكون المصفوفة فارغة",arrayItem:(e,i)=>`عنصر غير صحيح في الفهرس ${e}: ${i}`,objectField:(e,i)=>`حقل غير صحيح "${e}": ${i}`,unionNoMatch:e=>`لا يوجد عضو اتحاد مطابق: ${e.join(", ")}`,intersectionError:e=>`فشل في التحقق من التقاطع: ${e}`,literalExpected:(e,i)=>`متوقع ${e}، تم استلام ${i}`,enumExpected:(e,i)=>`متوقع واحد من [${e.join(", ")}]، تم استلام ${i}`,expectedUndefined:"متوقع undefined",neverType:"لا يمكن تحليل نوع never",invalidBigint:"bigint غير صحيح",invalidSymbol:"رمز غير صحيح",invalidTuple:"صف غير صحيح",tupleLength:(e,i)=>`يجب أن يحتوي الصف على ${e} عنصر بالضبط، تم استلام ${i}`,invalidRecord:"سجل غير صحيح",invalidSet:"Set غير صحيح",invalidMap:"Map غير صحيح",transformError:e=>`فشل التحويل: ${e}`,refinementError:e=>`فشل التنقيح: ${e}`,customValidationError:e=>`فشل في التحقق المخصص: ${e}`,coercionFailed:(e,i)=>`لا يمكن إكراه ${JSON.stringify(i)} إلى ${e}`,codecDecodeFailed:"Failed to decode value",codecEncodeFailed:"Failed to encode value",codecAsyncNotSupported:"Async codec operations require using parseAsync/encodeAsync methods",invalidBase64:"Invalid base64 string",invalidHex:"Invalid hexadecimal string",expectedUint8Array:"Expected Uint8Array",uint8ArrayMinLength:e=>`Uint8Array must have at least ${e} bytes`,uint8ArrayMaxLength:e=>`Uint8Array must have at most ${e} bytes`,uint8ArrayExactLength:e=>`Uint8Array must have exactly ${e} bytes`,expectedString:"Expected string",stringExpected:(e,i)=>`متوقع ${i}، تم استلام ${e}`,stringBoolExpected:(e,i)=>`سلسلة منطقية غير صحيحة. متوقع واحد من: ${e}، تم استلام: "${i}"`,invalidJson:"JSON غير صالح",stringPatternInvalid:"السلسلة لا تطابق النمط المطلوب",invalidFile:"Expected a File object",fileNotSupported:"File API not supported in this environment",fileMinSize:e=>`File size must be at least ${e} bytes`,fileMaxSize:e=>`File size must not exceed ${e} bytes`,fileMimeType:e=>`Invalid file type. Expected: ${e.join(", ")}`,invalidFunction:"دالة متوقعة",stringCidrv4:"كتلة CIDR IPv4 غير صالحة",stringCidrv6:"كتلة CIDR IPv6 غير صالحة",safeExtendOverlap:e=>`لا يمكن استبدال المفاتيح الموجودة: ${e.join(", ")}. استخدم extend() للاستبدال.`};export{e as ar};