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