unischema 1.0.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +780 -228
- package/dist/adapters/backend/index.d.mts +2 -1
- package/dist/adapters/backend/index.d.ts +2 -1
- package/dist/adapters/backend/index.js +17 -441
- package/dist/adapters/backend/index.mjs +9 -433
- package/dist/adapters/frontend/index.d.mts +2 -1
- package/dist/adapters/frontend/index.d.ts +2 -1
- package/dist/adapters/frontend/index.js +10 -421
- package/dist/adapters/frontend/index.mjs +8 -419
- package/dist/chunk-5A4ITJVD.mjs +124 -0
- package/dist/chunk-66RFUBVU.js +131 -0
- package/dist/chunk-75YSYC4K.mjs +85 -0
- package/dist/chunk-76BBWQDH.js +90 -0
- package/dist/chunk-7XES4A3M.mjs +237 -0
- package/dist/chunk-BVRXGZLS.js +17 -0
- package/dist/chunk-COMVAVFU.mjs +335 -0
- package/dist/chunk-DT2TQZU7.js +796 -0
- package/dist/chunk-FPCCH55A.js +103 -0
- package/dist/chunk-IUXRLMET.js +206 -0
- package/dist/chunk-JEW6U6CB.js +353 -0
- package/dist/chunk-KZCV5IW4.mjs +97 -0
- package/dist/chunk-KZZ7NVU3.mjs +41 -0
- package/dist/chunk-MFEBMQAU.mjs +779 -0
- package/dist/chunk-OIYG5D2I.js +50 -0
- package/dist/chunk-RW6HDA5H.mjs +194 -0
- package/dist/chunk-TTK77YBI.mjs +15 -0
- package/dist/chunk-TXT36BCE.js +248 -0
- package/dist/index-C17xs-fU.d.mts +140 -0
- package/dist/index-C17xs-fU.d.ts +140 -0
- package/dist/index.d.mts +26 -7
- package/dist/index.d.ts +26 -7
- package/dist/index.js +769 -499
- package/dist/index.mjs +695 -487
- package/dist/{schema-D9DGC9E_.d.ts → schema-DYE8Wz8X.d.mts} +264 -79
- package/dist/{schema-D9DGC9E_.d.mts → schema-Dtp-joeT.d.ts} +264 -79
- package/dist/validators/array.d.mts +15 -0
- package/dist/validators/array.d.ts +15 -0
- package/dist/validators/array.js +31 -0
- package/dist/validators/array.mjs +2 -0
- package/dist/validators/common.d.mts +13 -0
- package/dist/validators/common.d.ts +13 -0
- package/dist/validators/common.js +27 -0
- package/dist/validators/common.mjs +2 -0
- package/dist/validators/date.d.mts +23 -0
- package/dist/validators/date.d.ts +23 -0
- package/dist/validators/date.js +47 -0
- package/dist/validators/date.mjs +2 -0
- package/dist/validators/index.d.mts +46 -0
- package/dist/validators/index.d.ts +46 -0
- package/dist/validators/index.js +256 -0
- package/dist/validators/index.mjs +7 -0
- package/dist/validators/number.d.mts +25 -0
- package/dist/validators/number.d.ts +25 -0
- package/dist/validators/number.js +51 -0
- package/dist/validators/number.mjs +2 -0
- package/dist/validators/object.d.mts +11 -0
- package/dist/validators/object.d.ts +11 -0
- package/dist/validators/object.js +23 -0
- package/dist/validators/object.mjs +2 -0
- package/dist/validators/string.d.mts +37 -0
- package/dist/validators/string.d.ts +37 -0
- package/dist/validators/string.js +75 -0
- package/dist/validators/string.mjs +2 -0
- package/package.json +82 -5
- package/dist/adapters/backend/index.js.map +0 -1
- package/dist/adapters/backend/index.mjs.map +0 -1
- package/dist/adapters/frontend/index.js.map +0 -1
- package/dist/adapters/frontend/index.mjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
|
@@ -1,81 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Core types for the FormSchema validation engine
|
|
3
|
-
*/
|
|
4
|
-
type ValidationSeverity = 'hard' | 'soft';
|
|
5
|
-
interface ValidationError {
|
|
6
|
-
/** Field path (e.g., "email" or "address.city") */
|
|
7
|
-
field: string;
|
|
8
|
-
/** Error code for programmatic handling */
|
|
9
|
-
code: string;
|
|
10
|
-
/** Human-readable error message */
|
|
11
|
-
message: string;
|
|
12
|
-
/** Severity level - hard errors block submission, soft are warnings */
|
|
13
|
-
severity: ValidationSeverity;
|
|
14
|
-
}
|
|
15
|
-
interface ValidationResult {
|
|
16
|
-
/** True if no hard errors exist */
|
|
17
|
-
valid: boolean;
|
|
18
|
-
/** Errors that block form submission */
|
|
19
|
-
hardErrors: ValidationError[];
|
|
20
|
-
/** Warnings that don't block submission */
|
|
21
|
-
softErrors: ValidationError[];
|
|
22
|
-
}
|
|
23
|
-
type FieldType = 'string' | 'number' | 'boolean' | 'date' | 'array' | 'object';
|
|
24
|
-
interface ValidationRule {
|
|
25
|
-
/** Rule type identifier */
|
|
26
|
-
type: string;
|
|
27
|
-
/** Rule parameters */
|
|
28
|
-
params?: Record<string, unknown>;
|
|
29
|
-
/** Custom error message */
|
|
30
|
-
message?: string;
|
|
31
|
-
/** Is this a soft validation (warning only)? */
|
|
32
|
-
soft?: boolean;
|
|
33
|
-
}
|
|
34
|
-
interface FieldDefinition<T = unknown> {
|
|
35
|
-
/** The base type of this field */
|
|
36
|
-
type: FieldType;
|
|
37
|
-
/** Validation rules to apply */
|
|
38
|
-
rules: ValidationRule[];
|
|
39
|
-
/** Is this field required? */
|
|
40
|
-
required: boolean;
|
|
41
|
-
/** Default value */
|
|
42
|
-
defaultValue?: T;
|
|
43
|
-
/** For nested schemas */
|
|
44
|
-
schema?: SchemaDefinition;
|
|
45
|
-
/** For array items */
|
|
46
|
-
items?: FieldDefinition;
|
|
47
|
-
/** Field metadata */
|
|
48
|
-
meta?: Record<string, unknown>;
|
|
49
|
-
}
|
|
50
|
-
interface SchemaDefinition {
|
|
51
|
-
/** Field definitions keyed by field name */
|
|
52
|
-
fields: Record<string, FieldDefinition>;
|
|
53
|
-
/** Schema metadata */
|
|
54
|
-
meta?: Record<string, unknown>;
|
|
55
|
-
}
|
|
56
|
-
interface ValidatorContext {
|
|
57
|
-
/** Current field path */
|
|
58
|
-
path: string;
|
|
59
|
-
/** Full data object being validated */
|
|
60
|
-
root: unknown;
|
|
61
|
-
/** Parent object containing this field */
|
|
62
|
-
parent?: unknown;
|
|
63
|
-
}
|
|
64
|
-
type ValidatorFn = (value: unknown, params: Record<string, unknown> | undefined, context: ValidatorContext) => ValidationError | null;
|
|
65
|
-
interface EnterpriseValidationResponse {
|
|
66
|
-
status: 'success' | 'validation_error';
|
|
67
|
-
data?: unknown;
|
|
68
|
-
errors: ValidationError[];
|
|
69
|
-
msg: string;
|
|
70
|
-
validation: {
|
|
71
|
-
hard_validations: ValidationError[];
|
|
72
|
-
soft_validations: ValidationError[];
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Convert ValidationResult to enterprise-compatible response format
|
|
77
|
-
*/
|
|
78
|
-
declare function toEnterpriseResponse(result: ValidationResult, data?: unknown): EnterpriseValidationResponse;
|
|
1
|
+
import { F as FieldDefinition, c as ValidationRule, V as ValidatorContext, A as AsyncRefineFn, d as AsyncValidationOptions, S as SchemaDefinition } from './index-C17xs-fU.js';
|
|
79
2
|
|
|
80
3
|
/**
|
|
81
4
|
* Fluent field builder for schema definitions
|
|
@@ -87,6 +10,10 @@ declare class BaseFieldBuilder<T> {
|
|
|
87
10
|
protected _required: boolean;
|
|
88
11
|
protected _defaultValue?: T;
|
|
89
12
|
protected _meta: Record<string, unknown>;
|
|
13
|
+
protected _transforms: Array<(value: unknown) => unknown>;
|
|
14
|
+
protected _preprocess?: (value: unknown) => unknown;
|
|
15
|
+
protected _nullable: boolean;
|
|
16
|
+
protected _nullish: boolean;
|
|
90
17
|
constructor(type: FieldDefinition['type']);
|
|
91
18
|
/**
|
|
92
19
|
* Mark field as required
|
|
@@ -114,10 +41,51 @@ declare class BaseFieldBuilder<T> {
|
|
|
114
41
|
valid: boolean;
|
|
115
42
|
message?: string;
|
|
116
43
|
} | boolean, message?: string): this;
|
|
44
|
+
/**
|
|
45
|
+
* Add async custom validation
|
|
46
|
+
*/
|
|
47
|
+
refineAsync(validate: AsyncRefineFn<T>, options?: AsyncValidationOptions | string): this;
|
|
48
|
+
/**
|
|
49
|
+
* Add async soft validation (warning only)
|
|
50
|
+
*/
|
|
51
|
+
refineAsyncSoft(validate: AsyncRefineFn<T>, options?: Omit<AsyncValidationOptions, 'soft'> | string): this;
|
|
52
|
+
/**
|
|
53
|
+
* Transform value before validation (applied after preprocessing)
|
|
54
|
+
*/
|
|
55
|
+
transform<U = T>(transformer: (value: T) => U): BaseFieldBuilder<U>;
|
|
56
|
+
/**
|
|
57
|
+
* Preprocess value before transformations and validation
|
|
58
|
+
* Useful for handling null/undefined values
|
|
59
|
+
*/
|
|
60
|
+
preprocess(preprocessor: (value: unknown) => unknown): this;
|
|
61
|
+
/**
|
|
62
|
+
* Allow null values
|
|
63
|
+
*/
|
|
64
|
+
nullable(): this;
|
|
65
|
+
/**
|
|
66
|
+
* Allow null or undefined values
|
|
67
|
+
*/
|
|
68
|
+
nullish(): this;
|
|
117
69
|
/**
|
|
118
70
|
* Add field metadata
|
|
119
71
|
*/
|
|
120
72
|
meta(data: Record<string, unknown>): this;
|
|
73
|
+
/**
|
|
74
|
+
* Field must not match another field
|
|
75
|
+
*/
|
|
76
|
+
notMatches(field: string, message?: string): this;
|
|
77
|
+
/**
|
|
78
|
+
* Field must be greater than another field (for numbers)
|
|
79
|
+
*/
|
|
80
|
+
greaterThan(field: string, message?: string): this;
|
|
81
|
+
/**
|
|
82
|
+
* Field must be less than another field (for numbers)
|
|
83
|
+
*/
|
|
84
|
+
lessThan(field: string, message?: string): this;
|
|
85
|
+
/**
|
|
86
|
+
* Field depends on another field being set
|
|
87
|
+
*/
|
|
88
|
+
dependsOn(field: string, message?: string): this;
|
|
121
89
|
/**
|
|
122
90
|
* Build the field definition
|
|
123
91
|
*/
|
|
@@ -153,6 +121,62 @@ declare class StringFieldBuilder extends BaseFieldBuilder<string> {
|
|
|
153
121
|
* Validate as IP address (IPv4)
|
|
154
122
|
*/
|
|
155
123
|
ipAddress(message?: string): this;
|
|
124
|
+
/**
|
|
125
|
+
* Validate as IPv6 address
|
|
126
|
+
*/
|
|
127
|
+
ipv6(message?: string): this;
|
|
128
|
+
/**
|
|
129
|
+
* Only alphabetic characters (a-zA-Z)
|
|
130
|
+
*/
|
|
131
|
+
alpha(message?: string): this;
|
|
132
|
+
/**
|
|
133
|
+
* Only alphanumeric characters (a-zA-Z0-9)
|
|
134
|
+
*/
|
|
135
|
+
alphanumeric(message?: string): this;
|
|
136
|
+
/**
|
|
137
|
+
* Only numeric digits
|
|
138
|
+
*/
|
|
139
|
+
numeric(message?: string): this;
|
|
140
|
+
/**
|
|
141
|
+
* Must be lowercase
|
|
142
|
+
*/
|
|
143
|
+
lowercase(message?: string): this;
|
|
144
|
+
/**
|
|
145
|
+
* Must be uppercase
|
|
146
|
+
*/
|
|
147
|
+
uppercase(message?: string): this;
|
|
148
|
+
/**
|
|
149
|
+
* URL-friendly slug (lowercase, alphanumeric, hyphens)
|
|
150
|
+
*/
|
|
151
|
+
slug(message?: string): this;
|
|
152
|
+
/**
|
|
153
|
+
* Hexadecimal string
|
|
154
|
+
*/
|
|
155
|
+
hex(message?: string): this;
|
|
156
|
+
/**
|
|
157
|
+
* Base64 encoded string
|
|
158
|
+
*/
|
|
159
|
+
base64(message?: string): this;
|
|
160
|
+
/**
|
|
161
|
+
* Valid JSON string
|
|
162
|
+
*/
|
|
163
|
+
json(message?: string): this;
|
|
164
|
+
/**
|
|
165
|
+
* Exact length
|
|
166
|
+
*/
|
|
167
|
+
length(len: number, message?: string): this;
|
|
168
|
+
/**
|
|
169
|
+
* Must contain substring
|
|
170
|
+
*/
|
|
171
|
+
contains(substring: string, message?: string): this;
|
|
172
|
+
/**
|
|
173
|
+
* Must start with prefix
|
|
174
|
+
*/
|
|
175
|
+
startsWith(prefix: string, message?: string): this;
|
|
176
|
+
/**
|
|
177
|
+
* Must end with suffix
|
|
178
|
+
*/
|
|
179
|
+
endsWith(suffix: string, message?: string): this;
|
|
156
180
|
/**
|
|
157
181
|
* Match a regex pattern
|
|
158
182
|
*/
|
|
@@ -213,6 +237,50 @@ declare class NumberFieldBuilder extends BaseFieldBuilder<number> {
|
|
|
213
237
|
* Must be negative
|
|
214
238
|
*/
|
|
215
239
|
negative(message?: string): this;
|
|
240
|
+
/**
|
|
241
|
+
* Must be a valid port number (0-65535)
|
|
242
|
+
*/
|
|
243
|
+
port(message?: string): this;
|
|
244
|
+
/**
|
|
245
|
+
* Must be a valid latitude (-90 to 90)
|
|
246
|
+
*/
|
|
247
|
+
latitude(message?: string): this;
|
|
248
|
+
/**
|
|
249
|
+
* Must be a valid longitude (-180 to 180)
|
|
250
|
+
*/
|
|
251
|
+
longitude(message?: string): this;
|
|
252
|
+
/**
|
|
253
|
+
* Must be a percentage (0-100)
|
|
254
|
+
*/
|
|
255
|
+
percentage(message?: string): this;
|
|
256
|
+
/**
|
|
257
|
+
* Must be between min and max (inclusive)
|
|
258
|
+
*/
|
|
259
|
+
between(min: number, max: number, message?: string): this;
|
|
260
|
+
/**
|
|
261
|
+
* Must be divisible by a number
|
|
262
|
+
*/
|
|
263
|
+
divisibleBy(divisor: number, message?: string): this;
|
|
264
|
+
/**
|
|
265
|
+
* Must be a multiple of a number
|
|
266
|
+
*/
|
|
267
|
+
multipleOf(multiple: number, message?: string): this;
|
|
268
|
+
/**
|
|
269
|
+
* Must be an even number
|
|
270
|
+
*/
|
|
271
|
+
even(message?: string): this;
|
|
272
|
+
/**
|
|
273
|
+
* Must be an odd number
|
|
274
|
+
*/
|
|
275
|
+
odd(message?: string): this;
|
|
276
|
+
/**
|
|
277
|
+
* Must be a safe integer
|
|
278
|
+
*/
|
|
279
|
+
safe(message?: string): this;
|
|
280
|
+
/**
|
|
281
|
+
* Must be a finite number
|
|
282
|
+
*/
|
|
283
|
+
finite(message?: string): this;
|
|
216
284
|
/**
|
|
217
285
|
* Add a soft validation with message
|
|
218
286
|
*/
|
|
@@ -255,6 +323,46 @@ declare class DateFieldBuilder extends BaseFieldBuilder<Date> {
|
|
|
255
323
|
* Must be in the future
|
|
256
324
|
*/
|
|
257
325
|
future(message?: string): this;
|
|
326
|
+
/**
|
|
327
|
+
* Must be today
|
|
328
|
+
*/
|
|
329
|
+
today(message?: string): this;
|
|
330
|
+
/**
|
|
331
|
+
* Must be yesterday
|
|
332
|
+
*/
|
|
333
|
+
yesterday(message?: string): this;
|
|
334
|
+
/**
|
|
335
|
+
* Must be tomorrow
|
|
336
|
+
*/
|
|
337
|
+
tomorrow(message?: string): this;
|
|
338
|
+
/**
|
|
339
|
+
* Must be within this week
|
|
340
|
+
*/
|
|
341
|
+
thisWeek(message?: string): this;
|
|
342
|
+
/**
|
|
343
|
+
* Must be within this month
|
|
344
|
+
*/
|
|
345
|
+
thisMonth(message?: string): this;
|
|
346
|
+
/**
|
|
347
|
+
* Must be within this year
|
|
348
|
+
*/
|
|
349
|
+
thisYear(message?: string): this;
|
|
350
|
+
/**
|
|
351
|
+
* Must be a weekday
|
|
352
|
+
*/
|
|
353
|
+
weekday(message?: string): this;
|
|
354
|
+
/**
|
|
355
|
+
* Must be a weekend
|
|
356
|
+
*/
|
|
357
|
+
weekend(message?: string): this;
|
|
358
|
+
/**
|
|
359
|
+
* Validate age is within range
|
|
360
|
+
*/
|
|
361
|
+
age(min?: number, max?: number, message?: string): this;
|
|
362
|
+
/**
|
|
363
|
+
* Must be between two dates
|
|
364
|
+
*/
|
|
365
|
+
between(start: Date | string, end: Date | string, message?: string): this;
|
|
258
366
|
}
|
|
259
367
|
declare class ArrayFieldBuilder<T> extends BaseFieldBuilder<T[]> {
|
|
260
368
|
private _itemDef?;
|
|
@@ -275,6 +383,30 @@ declare class ArrayFieldBuilder<T> extends BaseFieldBuilder<T[]> {
|
|
|
275
383
|
* All items must be unique
|
|
276
384
|
*/
|
|
277
385
|
unique(message?: string): this;
|
|
386
|
+
/**
|
|
387
|
+
* Must include a specific item
|
|
388
|
+
*/
|
|
389
|
+
includes(item: T, message?: string): this;
|
|
390
|
+
/**
|
|
391
|
+
* Must not include a specific item
|
|
392
|
+
*/
|
|
393
|
+
excludes(item: T, message?: string): this;
|
|
394
|
+
/**
|
|
395
|
+
* Must be empty
|
|
396
|
+
*/
|
|
397
|
+
empty(message?: string): this;
|
|
398
|
+
/**
|
|
399
|
+
* Must not be empty
|
|
400
|
+
*/
|
|
401
|
+
notEmpty(message?: string): this;
|
|
402
|
+
/**
|
|
403
|
+
* Must be sorted
|
|
404
|
+
*/
|
|
405
|
+
sorted(order?: 'asc' | 'desc', message?: string): this;
|
|
406
|
+
/**
|
|
407
|
+
* Must not contain falsy values
|
|
408
|
+
*/
|
|
409
|
+
compact(message?: string): this;
|
|
278
410
|
build(): FieldDefinition<T[]>;
|
|
279
411
|
}
|
|
280
412
|
declare class ObjectFieldBuilder<T extends Record<string, unknown>> extends BaseFieldBuilder<T> {
|
|
@@ -282,6 +414,31 @@ declare class ObjectFieldBuilder<T extends Record<string, unknown>> extends Base
|
|
|
282
414
|
constructor(schemaFields: Record<string, BaseFieldBuilder<unknown>>);
|
|
283
415
|
build(): FieldDefinition<T>;
|
|
284
416
|
}
|
|
417
|
+
/**
|
|
418
|
+
* Coercion namespace for automatic type conversion
|
|
419
|
+
*/
|
|
420
|
+
declare const coerce: {
|
|
421
|
+
/**
|
|
422
|
+
* Coerce value to string
|
|
423
|
+
*/
|
|
424
|
+
string(): StringFieldBuilder;
|
|
425
|
+
/**
|
|
426
|
+
* Coerce value to number
|
|
427
|
+
*/
|
|
428
|
+
number(): NumberFieldBuilder;
|
|
429
|
+
/**
|
|
430
|
+
* Coerce value to boolean
|
|
431
|
+
*/
|
|
432
|
+
boolean(): BooleanFieldBuilder;
|
|
433
|
+
/**
|
|
434
|
+
* Coerce value to date
|
|
435
|
+
*/
|
|
436
|
+
date(): DateFieldBuilder;
|
|
437
|
+
/**
|
|
438
|
+
* Coerce value to array
|
|
439
|
+
*/
|
|
440
|
+
array<T>(itemBuilder?: BaseFieldBuilder<T>): ArrayFieldBuilder<T>;
|
|
441
|
+
};
|
|
285
442
|
|
|
286
443
|
/**
|
|
287
444
|
* Schema builder and type inference
|
|
@@ -315,6 +472,30 @@ declare function omit<T extends Record<string, unknown>, K extends keyof T>(base
|
|
|
315
472
|
* Make all fields optional
|
|
316
473
|
*/
|
|
317
474
|
declare function partial<T extends Record<string, unknown>>(baseSchema: SchemaBuilder<T>): SchemaBuilder<Partial<T>>;
|
|
475
|
+
/**
|
|
476
|
+
* Make all fields optional recursively (deep partial)
|
|
477
|
+
*/
|
|
478
|
+
declare function deepPartial<T extends Record<string, unknown>>(baseSchema: SchemaBuilder<T>): SchemaBuilder<DeepPartial<T>>;
|
|
479
|
+
/**
|
|
480
|
+
* Allow unknown keys to pass through
|
|
481
|
+
*/
|
|
482
|
+
declare function passthrough<T extends Record<string, unknown>>(baseSchema: SchemaBuilder<T>): SchemaBuilder<T>;
|
|
483
|
+
/**
|
|
484
|
+
* Strict mode - reject unknown keys
|
|
485
|
+
*/
|
|
486
|
+
declare function strict<T extends Record<string, unknown>>(baseSchema: SchemaBuilder<T>): SchemaBuilder<T>;
|
|
487
|
+
/**
|
|
488
|
+
* Default handler for unknown keys (catchall)
|
|
489
|
+
*/
|
|
490
|
+
declare function catchall<T extends Record<string, unknown>>(baseSchema: SchemaBuilder<T>, fieldBuilder: BaseFieldBuilder<unknown>): SchemaBuilder<T>;
|
|
491
|
+
/**
|
|
492
|
+
* Make specific fields required
|
|
493
|
+
*/
|
|
494
|
+
declare function required<T extends Record<string, unknown>, K extends keyof T>(baseSchema: SchemaBuilder<T>, keys: K[]): SchemaBuilder<T>;
|
|
495
|
+
/**
|
|
496
|
+
* Make specific fields optional
|
|
497
|
+
*/
|
|
498
|
+
declare function optional<T extends Record<string, unknown>, K extends keyof T>(baseSchema: SchemaBuilder<T>, keys: K[]): SchemaBuilder<T>;
|
|
318
499
|
/**
|
|
319
500
|
* Merge multiple schemas
|
|
320
501
|
*/
|
|
@@ -329,6 +510,10 @@ type InferFields<F extends Record<string, BaseFieldBuilder<unknown>>> = {
|
|
|
329
510
|
type InferInput<S> = S extends SchemaBuilder<infer T> ? T : never;
|
|
330
511
|
/** Infer output type from a schema (validated data) */
|
|
331
512
|
type InferOutput<S> = S extends SchemaBuilder<infer T> ? T : never;
|
|
513
|
+
/** Deep partial type helper */
|
|
514
|
+
type DeepPartial<T> = T extends object ? {
|
|
515
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
516
|
+
} : T;
|
|
332
517
|
/**
|
|
333
518
|
* Field factory for creating typed field builders
|
|
334
519
|
*/
|
|
@@ -363,4 +548,4 @@ declare const field: {
|
|
|
363
548
|
enum<E extends string>(values: readonly E[]): StringFieldBuilder;
|
|
364
549
|
};
|
|
365
550
|
|
|
366
|
-
export { ArrayFieldBuilder as A, BaseFieldBuilder as B,
|
|
551
|
+
export { ArrayFieldBuilder as A, BaseFieldBuilder as B, type DeepPartial as D, EnumFieldBuilder as E, type InferInput as I, NumberFieldBuilder as N, ObjectFieldBuilder as O, type SchemaBuilder as S, partial as a, passthrough as b, strict as c, deepPartial as d, extend as e, catchall as f, optional as g, field as h, coerce as i, type InferOutput as j, StringFieldBuilder as k, BooleanFieldBuilder as l, merge as m, DateFieldBuilder as n, omit as o, pick as p, required as r, schema as s };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { f as ValidatorFn } from '../index-C17xs-fU.mjs';
|
|
2
|
+
|
|
3
|
+
declare const includesValidator: ValidatorFn;
|
|
4
|
+
|
|
5
|
+
declare const excludesValidator: ValidatorFn;
|
|
6
|
+
|
|
7
|
+
declare const emptyValidator: ValidatorFn;
|
|
8
|
+
|
|
9
|
+
declare const notEmptyValidator: ValidatorFn;
|
|
10
|
+
|
|
11
|
+
declare const sortedValidator: ValidatorFn;
|
|
12
|
+
|
|
13
|
+
declare const compactValidator: ValidatorFn;
|
|
14
|
+
|
|
15
|
+
export { compactValidator, emptyValidator, excludesValidator, includesValidator, notEmptyValidator, sortedValidator };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { f as ValidatorFn } from '../index-C17xs-fU.js';
|
|
2
|
+
|
|
3
|
+
declare const includesValidator: ValidatorFn;
|
|
4
|
+
|
|
5
|
+
declare const excludesValidator: ValidatorFn;
|
|
6
|
+
|
|
7
|
+
declare const emptyValidator: ValidatorFn;
|
|
8
|
+
|
|
9
|
+
declare const notEmptyValidator: ValidatorFn;
|
|
10
|
+
|
|
11
|
+
declare const sortedValidator: ValidatorFn;
|
|
12
|
+
|
|
13
|
+
declare const compactValidator: ValidatorFn;
|
|
14
|
+
|
|
15
|
+
export { compactValidator, emptyValidator, excludesValidator, includesValidator, notEmptyValidator, sortedValidator };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk66RFUBVU_js = require('../chunk-66RFUBVU.js');
|
|
4
|
+
require('../chunk-OIYG5D2I.js');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, "compactValidator", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return chunk66RFUBVU_js.compactValidator; }
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "emptyValidator", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return chunk66RFUBVU_js.emptyValidator; }
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "excludesValidator", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return chunk66RFUBVU_js.excludesValidator; }
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, "includesValidator", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return chunk66RFUBVU_js.includesValidator; }
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "notEmptyValidator", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () { return chunk66RFUBVU_js.notEmptyValidator; }
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports, "sortedValidator", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () { return chunk66RFUBVU_js.sortedValidator; }
|
|
31
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { f as ValidatorFn } from '../index-C17xs-fU.mjs';
|
|
2
|
+
|
|
3
|
+
declare const notMatchesValidator: ValidatorFn;
|
|
4
|
+
|
|
5
|
+
declare const greaterThanValidator: ValidatorFn;
|
|
6
|
+
|
|
7
|
+
declare const lessThanValidator: ValidatorFn;
|
|
8
|
+
|
|
9
|
+
declare const whenValidator: ValidatorFn;
|
|
10
|
+
|
|
11
|
+
declare const dependsOnValidator: ValidatorFn;
|
|
12
|
+
|
|
13
|
+
export { dependsOnValidator, greaterThanValidator, lessThanValidator, notMatchesValidator, whenValidator };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { f as ValidatorFn } from '../index-C17xs-fU.js';
|
|
2
|
+
|
|
3
|
+
declare const notMatchesValidator: ValidatorFn;
|
|
4
|
+
|
|
5
|
+
declare const greaterThanValidator: ValidatorFn;
|
|
6
|
+
|
|
7
|
+
declare const lessThanValidator: ValidatorFn;
|
|
8
|
+
|
|
9
|
+
declare const whenValidator: ValidatorFn;
|
|
10
|
+
|
|
11
|
+
declare const dependsOnValidator: ValidatorFn;
|
|
12
|
+
|
|
13
|
+
export { dependsOnValidator, greaterThanValidator, lessThanValidator, notMatchesValidator, whenValidator };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkFPCCH55A_js = require('../chunk-FPCCH55A.js');
|
|
4
|
+
require('../chunk-OIYG5D2I.js');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, "dependsOnValidator", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return chunkFPCCH55A_js.dependsOnValidator; }
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "greaterThanValidator", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return chunkFPCCH55A_js.greaterThanValidator; }
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "lessThanValidator", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return chunkFPCCH55A_js.lessThanValidator; }
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, "notMatchesValidator", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return chunkFPCCH55A_js.notMatchesValidator; }
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "whenValidator", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () { return chunkFPCCH55A_js.whenValidator; }
|
|
27
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { f as ValidatorFn } from '../index-C17xs-fU.mjs';
|
|
2
|
+
|
|
3
|
+
declare const todayValidator: ValidatorFn;
|
|
4
|
+
|
|
5
|
+
declare const yesterdayValidator: ValidatorFn;
|
|
6
|
+
|
|
7
|
+
declare const tomorrowValidator: ValidatorFn;
|
|
8
|
+
|
|
9
|
+
declare const thisWeekValidator: ValidatorFn;
|
|
10
|
+
|
|
11
|
+
declare const thisMonthValidator: ValidatorFn;
|
|
12
|
+
|
|
13
|
+
declare const thisYearValidator: ValidatorFn;
|
|
14
|
+
|
|
15
|
+
declare const weekdayValidator: ValidatorFn;
|
|
16
|
+
|
|
17
|
+
declare const weekendValidator: ValidatorFn;
|
|
18
|
+
|
|
19
|
+
declare const ageValidator: ValidatorFn;
|
|
20
|
+
|
|
21
|
+
declare const betweenValidator: ValidatorFn;
|
|
22
|
+
|
|
23
|
+
export { ageValidator, betweenValidator, thisMonthValidator, thisWeekValidator, thisYearValidator, todayValidator, tomorrowValidator, weekdayValidator, weekendValidator, yesterdayValidator };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { f as ValidatorFn } from '../index-C17xs-fU.js';
|
|
2
|
+
|
|
3
|
+
declare const todayValidator: ValidatorFn;
|
|
4
|
+
|
|
5
|
+
declare const yesterdayValidator: ValidatorFn;
|
|
6
|
+
|
|
7
|
+
declare const tomorrowValidator: ValidatorFn;
|
|
8
|
+
|
|
9
|
+
declare const thisWeekValidator: ValidatorFn;
|
|
10
|
+
|
|
11
|
+
declare const thisMonthValidator: ValidatorFn;
|
|
12
|
+
|
|
13
|
+
declare const thisYearValidator: ValidatorFn;
|
|
14
|
+
|
|
15
|
+
declare const weekdayValidator: ValidatorFn;
|
|
16
|
+
|
|
17
|
+
declare const weekendValidator: ValidatorFn;
|
|
18
|
+
|
|
19
|
+
declare const ageValidator: ValidatorFn;
|
|
20
|
+
|
|
21
|
+
declare const betweenValidator: ValidatorFn;
|
|
22
|
+
|
|
23
|
+
export { ageValidator, betweenValidator, thisMonthValidator, thisWeekValidator, thisYearValidator, todayValidator, tomorrowValidator, weekdayValidator, weekendValidator, yesterdayValidator };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkTXT36BCE_js = require('../chunk-TXT36BCE.js');
|
|
4
|
+
require('../chunk-OIYG5D2I.js');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, "ageValidator", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return chunkTXT36BCE_js.ageValidator; }
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "betweenValidator", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return chunkTXT36BCE_js.betweenValidator; }
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "thisMonthValidator", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return chunkTXT36BCE_js.thisMonthValidator; }
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports, "thisWeekValidator", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
get: function () { return chunkTXT36BCE_js.thisWeekValidator; }
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "thisYearValidator", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () { return chunkTXT36BCE_js.thisYearValidator; }
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports, "todayValidator", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () { return chunkTXT36BCE_js.todayValidator; }
|
|
31
|
+
});
|
|
32
|
+
Object.defineProperty(exports, "tomorrowValidator", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () { return chunkTXT36BCE_js.tomorrowValidator; }
|
|
35
|
+
});
|
|
36
|
+
Object.defineProperty(exports, "weekdayValidator", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () { return chunkTXT36BCE_js.weekdayValidator; }
|
|
39
|
+
});
|
|
40
|
+
Object.defineProperty(exports, "weekendValidator", {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function () { return chunkTXT36BCE_js.weekendValidator; }
|
|
43
|
+
});
|
|
44
|
+
Object.defineProperty(exports, "yesterdayValidator", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function () { return chunkTXT36BCE_js.yesterdayValidator; }
|
|
47
|
+
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export { alphaValidator, alphanumericValidator, base64Validator, containsValidator, emailValidator, endsWithValidator, hexValidator, ipAddressValidator, ipv6Validator, jsonValidator, lengthValidator, lowercaseValidator, numericValidator, slugValidator, startsWithValidator, uppercaseValidator, urlValidator } from './string.mjs';
|
|
2
|
+
export { divisibleByValidator, evenValidator, finiteValidator, latitudeValidator, longitudeValidator, multipleOfValidator, betweenValidator as numberBetweenValidator, oddValidator, percentageValidator, portValidator, safeValidator } from './number.mjs';
|
|
3
|
+
export { ageValidator, betweenValidator as dateBetweenValidator, thisMonthValidator, thisWeekValidator, thisYearValidator, todayValidator, tomorrowValidator, weekdayValidator, weekendValidator, yesterdayValidator } from './date.mjs';
|
|
4
|
+
export { compactValidator, emptyValidator, excludesValidator, includesValidator, notEmptyValidator, sortedValidator } from './array.mjs';
|
|
5
|
+
export { keysValidator, omitValidator, pickValidator, strictValidator } from './object.mjs';
|
|
6
|
+
export { dependsOnValidator, greaterThanValidator, lessThanValidator, notMatchesValidator, whenValidator } from './common.mjs';
|
|
7
|
+
import { V as ValidatorContext, a as ValidationError } from '../index-C17xs-fU.mjs';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Shared utilities for validators
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Create a validation error
|
|
15
|
+
*/
|
|
16
|
+
declare function createError(context: ValidatorContext, code: string, message: string, soft?: boolean, received?: unknown, expected?: unknown): ValidationError;
|
|
17
|
+
/**
|
|
18
|
+
* Check if value is empty (null, undefined, or empty string)
|
|
19
|
+
*/
|
|
20
|
+
declare function isEmpty(value: unknown): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Check if value is a valid string
|
|
23
|
+
*/
|
|
24
|
+
declare function isString(value: unknown): value is string;
|
|
25
|
+
/**
|
|
26
|
+
* Check if value is a valid number
|
|
27
|
+
*/
|
|
28
|
+
declare function isNumber(value: unknown): value is number;
|
|
29
|
+
/**
|
|
30
|
+
* Check if value is a valid date
|
|
31
|
+
*/
|
|
32
|
+
declare function isDate(value: unknown): value is Date;
|
|
33
|
+
/**
|
|
34
|
+
* Parse a date from various formats
|
|
35
|
+
*/
|
|
36
|
+
declare function parseDate(value: unknown): Date | null;
|
|
37
|
+
/**
|
|
38
|
+
* Check if value is an array
|
|
39
|
+
*/
|
|
40
|
+
declare function isArray(value: unknown): value is unknown[];
|
|
41
|
+
/**
|
|
42
|
+
* Check if value is a plain object
|
|
43
|
+
*/
|
|
44
|
+
declare function isObject(value: unknown): value is Record<string, unknown>;
|
|
45
|
+
|
|
46
|
+
export { createError, isArray, isDate, isEmpty, isNumber, isObject, isString, parseDate };
|