@dzeio/schema 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Schema.d.mts +60 -65
- package/dist/Schema.d.ts +60 -65
- package/dist/Schema.js +193 -131
- package/dist/Schema.mjs +195 -132
- package/package.json +1 -1
package/dist/Schema.d.mts
CHANGED
|
@@ -4,13 +4,6 @@ declare abstract class SchemaItem<Output = any, Input = Output> implements Stand
|
|
|
4
4
|
readonly _output: Output;
|
|
5
5
|
readonly _input: Input;
|
|
6
6
|
'~standard': StandardSchemaV1.Props<Input, Output>;
|
|
7
|
-
/**
|
|
8
|
-
* keep public ?
|
|
9
|
-
*/
|
|
10
|
-
protected readonly validations: Array<{
|
|
11
|
-
fn: (input: Output) => boolean;
|
|
12
|
-
error?: string | undefined;
|
|
13
|
-
}>;
|
|
14
7
|
/**
|
|
15
8
|
* Function calls saved for serialization
|
|
16
9
|
*/
|
|
@@ -18,6 +11,17 @@ declare abstract class SchemaItem<Output = any, Input = Output> implements Stand
|
|
|
18
11
|
name: string;
|
|
19
12
|
args: Array<string> | IArguments | undefined;
|
|
20
13
|
}>;
|
|
14
|
+
/**
|
|
15
|
+
* list of attributes for custom works
|
|
16
|
+
*/
|
|
17
|
+
readonly attributes: Array<string>;
|
|
18
|
+
/**
|
|
19
|
+
* keep public ?
|
|
20
|
+
*/
|
|
21
|
+
protected readonly validations: Array<{
|
|
22
|
+
fn: (input: Output) => boolean;
|
|
23
|
+
error?: string | undefined;
|
|
24
|
+
}>;
|
|
21
25
|
/**
|
|
22
26
|
* Pre process the variable for various reasons
|
|
23
27
|
*
|
|
@@ -34,13 +38,10 @@ declare abstract class SchemaItem<Output = any, Input = Output> implements Stand
|
|
|
34
38
|
* note: the type of the final post-process MUST be valid
|
|
35
39
|
*/
|
|
36
40
|
protected readonly postProcess: Array<(input: Output) => Output>;
|
|
37
|
-
/**
|
|
38
|
-
* list of attributes for custom works
|
|
39
|
-
*/
|
|
40
|
-
readonly attributes: Array<string>;
|
|
41
41
|
protected readonly items?: Array<unknown>;
|
|
42
42
|
private invalidError;
|
|
43
43
|
constructor(items?: Array<unknown> | IArguments);
|
|
44
|
+
parseJSON(): this;
|
|
44
45
|
/**
|
|
45
46
|
* make sure the value is one of the `values`
|
|
46
47
|
* @param values the values the item MUST contains
|
|
@@ -64,6 +65,15 @@ declare abstract class SchemaItem<Output = any, Input = Output> implements Stand
|
|
|
64
65
|
* es2: s.nullable(s.string()) returns s.string()
|
|
65
66
|
*/
|
|
66
67
|
unwrap?(): SchemaItem;
|
|
68
|
+
parse(input: unknown, options?: ValidationOptions): ValidationResult<Output>;
|
|
69
|
+
toJSON(): SchemaJSON;
|
|
70
|
+
private deepSerializeItem;
|
|
71
|
+
addValidation(fn: ((input: Output) => boolean) | {
|
|
72
|
+
fn: (input: Output) => boolean;
|
|
73
|
+
error?: string;
|
|
74
|
+
}, error?: string): this;
|
|
75
|
+
addPreProcess(fn: (input: unknown) => Input | unknown): this;
|
|
76
|
+
addPostProcess(fn: (input: Output) => Output): this;
|
|
67
77
|
/** Returns the sub values of the input, the schema item to handle them, and the path to it */
|
|
68
78
|
protected getSubInputs(_input: unknown): Array<{
|
|
69
79
|
item: SchemaItem;
|
|
@@ -76,21 +86,12 @@ declare abstract class SchemaItem<Output = any, Input = Output> implements Stand
|
|
|
76
86
|
input: unknown;
|
|
77
87
|
errors?: Array<ValidationError>;
|
|
78
88
|
};
|
|
79
|
-
parse(input: unknown, options?: ValidationOptions): ValidationResult<Output>;
|
|
80
|
-
toJSON(): SchemaJSON;
|
|
81
|
-
addValidation(fn: ((input: Output) => boolean) | {
|
|
82
|
-
fn: (input: Output) => boolean;
|
|
83
|
-
error?: string;
|
|
84
|
-
}, error?: string): this;
|
|
85
|
-
addPreProcess(fn: (input: unknown) => Input | unknown): this;
|
|
86
|
-
addPostProcess(fn: (input: Output) => Output): this;
|
|
87
|
-
parseJSON(): this;
|
|
88
89
|
abstract isOfType(input: unknown): input is Output;
|
|
89
90
|
}
|
|
90
91
|
|
|
91
|
-
type SchemaInfer<Type extends SchemaItem> = Type[
|
|
92
|
+
type SchemaInfer<Type extends SchemaItem> = Type['_output']
|
|
92
93
|
type Infer<Type extends SchemaItem> = SchemaInfer<Type>
|
|
93
|
-
type SchemaInputInfer<Type extends SchemaItem> = Type[
|
|
94
|
+
type SchemaInputInfer<Type extends SchemaItem> = Type['_input']
|
|
94
95
|
type InputInfer<Type extends SchemaItem> = SchemaInputInfer<Type>
|
|
95
96
|
|
|
96
97
|
interface ValidationOptions {
|
|
@@ -128,7 +129,7 @@ type ValidationResultOld<T> = {
|
|
|
128
129
|
*/
|
|
129
130
|
interface SchemaJSON {
|
|
130
131
|
/** Id of the schema item (name of the constructor) */
|
|
131
|
-
|
|
132
|
+
_i: string
|
|
132
133
|
/** Attributes */
|
|
133
134
|
a?: Array<string> | undefined
|
|
134
135
|
/** Children schema items */
|
|
@@ -159,6 +160,8 @@ type ModelInfer$1<M extends Model> = {
|
|
|
159
160
|
[key in keyof M]: SchemaInfer<M[key]>
|
|
160
161
|
}
|
|
161
162
|
|
|
163
|
+
type Literal = string | number | bigint | boolean | null | undefined
|
|
164
|
+
|
|
162
165
|
declare class SchemaAny extends SchemaItem {
|
|
163
166
|
isOfType(_input: unknown): _input is any;
|
|
164
167
|
}
|
|
@@ -173,11 +176,11 @@ declare class SchemaRecord<Keys extends SchemaItem<string | number | symbol>, Va
|
|
|
173
176
|
private readonly keys;
|
|
174
177
|
private readonly values;
|
|
175
178
|
constructor(keys: Keys, values: Values);
|
|
179
|
+
isOfType(input: unknown): input is Record<SchemaInfer<Keys>, SchemaInfer<Values>>;
|
|
176
180
|
protected parseSubItems(input: unknown, options?: ValidationOptions): {
|
|
177
181
|
input: unknown;
|
|
178
|
-
errors?: ValidationError
|
|
182
|
+
errors?: Array<ValidationError>;
|
|
179
183
|
};
|
|
180
|
-
isOfType(input: unknown): input is Record<SchemaInfer<Keys>, SchemaInfer<Values>>;
|
|
181
184
|
}
|
|
182
185
|
|
|
183
186
|
declare class SchemaArray<Child extends SchemaItem, Output = SchemaInfer<Child>, Input = SchemaInputInfer<Child>> extends SchemaItem<Array<Output>, Array<Input>> {
|
|
@@ -187,18 +190,19 @@ declare class SchemaArray<Child extends SchemaItem, Output = SchemaInfer<Child>,
|
|
|
187
190
|
* transform the array so it only contains one of each elements
|
|
188
191
|
*/
|
|
189
192
|
unique(): this;
|
|
193
|
+
clean(): this;
|
|
190
194
|
/**
|
|
191
195
|
* split a string into an array
|
|
192
196
|
* @param [separator] default:`,` the separator to use
|
|
193
197
|
*/
|
|
194
198
|
split(separator?: string): this;
|
|
199
|
+
unwrap(): Child;
|
|
200
|
+
isOfType(input: unknown): input is Array<Output>;
|
|
195
201
|
protected getSubInputs(input: unknown): Array<{
|
|
196
202
|
item: SchemaItem;
|
|
197
203
|
value: unknown;
|
|
198
204
|
path: string | undefined;
|
|
199
205
|
}>;
|
|
200
|
-
unwrap(): Child;
|
|
201
|
-
isOfType(input: unknown): input is Array<Output>;
|
|
202
206
|
}
|
|
203
207
|
|
|
204
208
|
declare class SchemaBoolean extends SchemaItem<boolean> {
|
|
@@ -221,17 +225,20 @@ declare class SchemaEnum<E extends EnumLike> extends SchemaItem<E[keyof E]> {
|
|
|
221
225
|
isOfType(input: unknown): input is E[keyof E];
|
|
222
226
|
}
|
|
223
227
|
|
|
224
|
-
declare class SchemaLiteral<
|
|
225
|
-
private readonly
|
|
226
|
-
constructor(
|
|
227
|
-
isOfType(input: unknown): input is
|
|
228
|
+
declare class SchemaLiteral<Types extends Array<Literal>> extends SchemaItem<Types[number]> {
|
|
229
|
+
private readonly values;
|
|
230
|
+
constructor(...values: Types);
|
|
231
|
+
isOfType(input: unknown): input is Types[number];
|
|
228
232
|
}
|
|
229
233
|
|
|
230
234
|
declare class SchemaNullable<Child extends SchemaItem, Output = SchemaInfer<Child>, Input = SchemaInputInfer<Child>> extends SchemaItem<Output | undefined, Input | null | undefined> {
|
|
231
235
|
private readonly child;
|
|
232
236
|
constructor(child: Child);
|
|
233
237
|
falsyAsNull(): this;
|
|
238
|
+
emptyAsNull(): this;
|
|
239
|
+
emptyFileAsNull(): this;
|
|
234
240
|
unwrap(): Child;
|
|
241
|
+
isOfType(input: unknown): input is Output | undefined;
|
|
235
242
|
protected getSubInputs(input: unknown): Array<{
|
|
236
243
|
item: SchemaItem;
|
|
237
244
|
value: unknown;
|
|
@@ -241,7 +248,6 @@ declare class SchemaNullable<Child extends SchemaItem, Output = SchemaInfer<Chil
|
|
|
241
248
|
input: unknown;
|
|
242
249
|
errors?: Array<ValidationError>;
|
|
243
250
|
};
|
|
244
|
-
isOfType(input: unknown): input is Output | undefined;
|
|
245
251
|
}
|
|
246
252
|
|
|
247
253
|
declare class SchemaNumber extends SchemaItem<number> {
|
|
@@ -285,12 +291,12 @@ declare class SchemaObject<T extends Record<string, SchemaItem> = any> extends S
|
|
|
285
291
|
readonly model: T;
|
|
286
292
|
id: string;
|
|
287
293
|
constructor(model: T);
|
|
294
|
+
isOfType(input: unknown): input is ModelInfer<T>;
|
|
288
295
|
protected getSubInputs(input: unknown): Array<{
|
|
289
296
|
item: SchemaItem;
|
|
290
297
|
value: unknown;
|
|
291
298
|
path: string | undefined;
|
|
292
299
|
}>;
|
|
293
|
-
isOfType(input: unknown): input is ModelInfer<T>;
|
|
294
300
|
}
|
|
295
301
|
|
|
296
302
|
declare class SchemaString extends SchemaItem<string> {
|
|
@@ -323,6 +329,11 @@ declare class SchemaString extends SchemaItem<string> {
|
|
|
323
329
|
* @param message the message to display on an error
|
|
324
330
|
*/
|
|
325
331
|
regex(regex: RegExp, message?: string): this;
|
|
332
|
+
/**
|
|
333
|
+
* force the input text to be an email
|
|
334
|
+
* @param message the message to display on an error
|
|
335
|
+
*/
|
|
336
|
+
email(message?: string): this;
|
|
326
337
|
minLength(value: number, message?: string): this;
|
|
327
338
|
maxLength(value: number, message?: string): this;
|
|
328
339
|
isOfType(input: unknown): input is string;
|
|
@@ -331,11 +342,11 @@ declare class SchemaString extends SchemaItem<string> {
|
|
|
331
342
|
declare class SchemaUnion<Children extends Array<SchemaItem>, Outputs = SchemaInfer<Children[number]>, Inputs = SchemaInputInfer<Children[number]>> extends SchemaItem<Outputs, Inputs> {
|
|
332
343
|
private readonly schemas;
|
|
333
344
|
constructor(...schemas: Children);
|
|
345
|
+
isOfType(input: unknown): input is Outputs;
|
|
334
346
|
protected parseSubItems(input: unknown, options?: ValidationOptions): {
|
|
335
347
|
input: unknown;
|
|
336
348
|
errors?: Array<ValidationError>;
|
|
337
349
|
};
|
|
338
|
-
isOfType(input: unknown): input is Outputs;
|
|
339
350
|
}
|
|
340
351
|
|
|
341
352
|
type Prettify<T> = T extends unknown ? {
|
|
@@ -345,11 +356,11 @@ type UnionToIntersection<U> = (U extends U ? (x: U) => void : never) extends ((x
|
|
|
345
356
|
declare class SchemaIntersection<Children extends Array<SchemaItem>, Outputs = Prettify<UnionToIntersection<SchemaInfer<Children[number]>>>, Inputs = Prettify<UnionToIntersection<SchemaInfer<Children[number]>>>> extends SchemaItem<Outputs, Inputs> {
|
|
346
357
|
private readonly schemas;
|
|
347
358
|
constructor(...schemas: Children);
|
|
359
|
+
isOfType(input: unknown): input is Outputs;
|
|
348
360
|
protected parseSubItems(input: unknown, options?: ValidationOptions): {
|
|
349
361
|
input: unknown;
|
|
350
362
|
errors?: Array<ValidationError>;
|
|
351
363
|
};
|
|
352
|
-
isOfType(input: unknown): input is Outputs;
|
|
353
364
|
}
|
|
354
365
|
|
|
355
366
|
declare class SchemaDefault<Child extends SchemaItem, Output = SchemaInfer<Child>, Input = SchemaInputInfer<Child>> extends SchemaItem<Output, Input | null | undefined> {
|
|
@@ -358,12 +369,12 @@ declare class SchemaDefault<Child extends SchemaItem, Output = SchemaInfer<Child
|
|
|
358
369
|
private readonly strict;
|
|
359
370
|
constructor(child: Child, defaultVal: Output, strict?: boolean);
|
|
360
371
|
unwrap(): Child;
|
|
372
|
+
isOfType(input: unknown): input is Output;
|
|
361
373
|
protected getSubInputs(input: unknown): Array<{
|
|
362
374
|
item: SchemaItem;
|
|
363
375
|
value: unknown;
|
|
364
376
|
path: string | undefined;
|
|
365
377
|
}>;
|
|
366
|
-
isOfType(input: unknown): input is Output;
|
|
367
378
|
}
|
|
368
379
|
|
|
369
380
|
declare class SchemaFile extends SchemaItem<File> {
|
|
@@ -373,17 +384,17 @@ declare class SchemaFile extends SchemaItem<File> {
|
|
|
373
384
|
isOfType(input: unknown): input is File;
|
|
374
385
|
}
|
|
375
386
|
|
|
376
|
-
type TupleToOutputs<Tuple extends Array<SchemaItem>, Result extends any
|
|
377
|
-
type TupleToInputs<Tuple extends Array<SchemaItem>, Result extends any
|
|
387
|
+
type TupleToOutputs<Tuple extends Array<SchemaItem>, Result extends Array<any> = []> = number extends Tuple['length'] ? Array<SchemaInfer<Tuple[number]>> : Tuple[Result['length']] extends undefined ? Result : TupleToOutputs<Tuple, [...Result, SchemaInfer<Tuple[Result['length']]>]>;
|
|
388
|
+
type TupleToInputs<Tuple extends Array<SchemaItem>, Result extends Array<any> = []> = number extends Tuple['length'] ? Array<SchemaInputInfer<Tuple[number]>> : Tuple[Result['length']] extends undefined ? Result : TupleToInputs<Tuple, [...Result, SchemaInputInfer<Tuple[Result['length']]>]>;
|
|
378
389
|
declare class SchemaTuple<Children extends Array<SchemaItem>, Outputs = TupleToOutputs<Children>, Inputs = TupleToInputs<Children>> extends SchemaItem<Outputs, Inputs> {
|
|
379
390
|
private readonly children;
|
|
380
391
|
constructor(...children: Children);
|
|
392
|
+
isOfType(input: unknown): input is Outputs;
|
|
381
393
|
protected getSubInputs(input: unknown): Array<{
|
|
382
394
|
item: SchemaItem;
|
|
383
395
|
value: unknown;
|
|
384
396
|
path: string | undefined;
|
|
385
397
|
}>;
|
|
386
|
-
isOfType(input: unknown): input is Outputs;
|
|
387
398
|
}
|
|
388
399
|
|
|
389
400
|
declare class SchemaUndefined extends SchemaItem<undefined> {
|
|
@@ -403,7 +414,10 @@ declare class SchemaNever extends SchemaItem<never> {
|
|
|
403
414
|
}
|
|
404
415
|
|
|
405
416
|
declare function isNull(value: unknown): value is undefined | null;
|
|
406
|
-
declare function parseQuery<T extends SchemaItem>(
|
|
417
|
+
declare function parseQuery<T extends SchemaItem>(schema: T, query: URLSearchParams, opts?: Parameters<T['parse']>[1]): ReturnType<T['parse']>;
|
|
418
|
+
/**
|
|
419
|
+
* (Note: be carefull : missing key/value associated to schema "s.boolean().nullable" or "s.boolean()" will be transform into false)
|
|
420
|
+
*/
|
|
407
421
|
declare function parseFormData<T extends SchemaItem>(schema: T, data: FormData, opts?: Parameters<T['parse']>[1]): ReturnType<T['parse']>;
|
|
408
422
|
declare function parseForm<T extends SchemaItem>(model: T, form: HTMLFormElement, opts?: Parameters<T['parse']>[1]): ReturnType<T['parse']>;
|
|
409
423
|
|
|
@@ -412,30 +426,10 @@ declare function parseForm<T extends SchemaItem>(model: T, form: HTMLFormElement
|
|
|
412
426
|
*/
|
|
413
427
|
declare function parsable(): (target: object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<any>) => TypedPropertyDescriptor<any>;
|
|
414
428
|
type SchemaItemStatic = new (...args: Array<any>) => SchemaItem;
|
|
415
|
-
declare const Types: {
|
|
416
|
-
readonly Any: typeof SchemaAny;
|
|
417
|
-
readonly Array: typeof SchemaArray;
|
|
418
|
-
readonly Tuple: typeof SchemaTuple;
|
|
419
|
-
readonly Boolean: typeof SchemaBoolean;
|
|
420
|
-
readonly Date: typeof SchemaDate;
|
|
421
|
-
readonly Enum: typeof SchemaEnum;
|
|
422
|
-
readonly Literal: typeof SchemaLiteral;
|
|
423
|
-
readonly Nullable: typeof SchemaNullable;
|
|
424
|
-
readonly Object: typeof SchemaObject;
|
|
425
|
-
readonly Record: typeof SchemaRecord;
|
|
426
|
-
readonly String: typeof SchemaString;
|
|
427
|
-
readonly Union: typeof SchemaUnion;
|
|
428
|
-
readonly Intersection: typeof SchemaIntersection;
|
|
429
|
-
readonly Default: typeof SchemaDefault;
|
|
430
|
-
readonly Undefined: typeof SchemaUndefined;
|
|
431
|
-
readonly Void: typeof SchemaVoid;
|
|
432
|
-
readonly Null: typeof SchemaNull;
|
|
433
|
-
readonly Nullish: typeof SchemaNullish;
|
|
434
|
-
};
|
|
435
429
|
declare class Schema<T extends Record<string, SchemaItem> = Record<string, SchemaItem>> extends SchemaObject<T> {
|
|
436
430
|
private static readonly registeredModules;
|
|
437
431
|
static register(module: SchemaItemStatic): void;
|
|
438
|
-
static getModule(name: string): SchemaItemStatic
|
|
432
|
+
static getModule(name: string): SchemaItemStatic;
|
|
439
433
|
static any(): SchemaAny;
|
|
440
434
|
static array<Type extends SchemaItem>(...inputs: ConstructorParameters<typeof SchemaArray<Type>>): SchemaArray<Type>;
|
|
441
435
|
static boolean(...inputs: ConstructorParameters<typeof SchemaBoolean>): SchemaBoolean;
|
|
@@ -446,7 +440,7 @@ declare class Schema<T extends Record<string, SchemaItem> = Record<string, Schem
|
|
|
446
440
|
* @param input the literal value (note: append `as const` else the typing won't work correctly)
|
|
447
441
|
* @returns
|
|
448
442
|
*/
|
|
449
|
-
static literal<Type
|
|
443
|
+
static literal<Type extends Array<Literal>>(...inputs: ConstructorParameters<typeof SchemaLiteral<Type>>): SchemaLiteral<Type>;
|
|
450
444
|
static nullable<Type extends SchemaItem>(...inputs: ConstructorParameters<typeof SchemaNullable<Type>>): SchemaNullable<Type>;
|
|
451
445
|
static number(...inputs: ConstructorParameters<typeof SchemaNumber>): SchemaNumber;
|
|
452
446
|
static object<Type extends Record<string, SchemaItem>>(...inputs: ConstructorParameters<typeof SchemaObject<Type>>): SchemaObject<Type>;
|
|
@@ -457,14 +451,15 @@ declare class Schema<T extends Record<string, SchemaItem> = Record<string, Schem
|
|
|
457
451
|
static string(...inputs: ConstructorParameters<typeof SchemaString>): SchemaString;
|
|
458
452
|
static file(...inputs: ConstructorParameters<typeof SchemaFile>): SchemaFile;
|
|
459
453
|
static union<Type extends Array<SchemaItem>>(...inputs: ConstructorParameters<typeof SchemaUnion<Type>>): SchemaUnion<Type>;
|
|
460
|
-
static intersection<Type extends SchemaItem
|
|
461
|
-
static tuple<Items extends SchemaItem
|
|
454
|
+
static intersection<Type extends Array<SchemaItem>>(...inputs: ConstructorParameters<typeof SchemaIntersection<Type>>): SchemaIntersection<Type>;
|
|
455
|
+
static tuple<Items extends Array<SchemaItem>>(...inputs: ConstructorParameters<typeof SchemaTuple<Items>>): SchemaTuple<Items>;
|
|
462
456
|
static undefined(...inputs: ConstructorParameters<typeof SchemaUndefined>): SchemaUndefined;
|
|
463
457
|
static null(...inputs: ConstructorParameters<typeof SchemaNull>): SchemaNull;
|
|
464
458
|
static nullish(...inputs: ConstructorParameters<typeof SchemaNullish>): SchemaNullish;
|
|
465
459
|
static void(...inputs: ConstructorParameters<typeof SchemaVoid>): SchemaVoid;
|
|
466
460
|
static never(...inputs: ConstructorParameters<typeof SchemaNever>): SchemaNever;
|
|
467
461
|
static fromJSON(json: SchemaJSON): SchemaItem;
|
|
462
|
+
static deepParseSchemaJSON(item: unknown): unknown;
|
|
468
463
|
static isSchemaJSON(data: unknown): data is SchemaJSON;
|
|
469
464
|
/**
|
|
470
465
|
* @deprecated use helper `parseQuery`
|
|
@@ -485,4 +480,4 @@ declare class Schema<T extends Record<string, SchemaItem> = Record<string, Schem
|
|
|
485
480
|
}
|
|
486
481
|
declare const s: typeof Schema;
|
|
487
482
|
|
|
488
|
-
export { type Infer, type InputInfer, type Model, type ModelInfer$1 as ModelInfer, SchemaAny, SchemaArray, SchemaBoolean, SchemaDate, SchemaDefault, SchemaEnum, SchemaFile, type SchemaInfer, type SchemaInputInfer, SchemaIntersection, SchemaItem, type SchemaItemJSON, type SchemaJSON, SchemaLiteral, SchemaNever, SchemaNull, SchemaNullable, SchemaNullish, SchemaNumber, SchemaObject, SchemaRecord, SchemaString, SchemaUndefined, SchemaUnion, SchemaVoid,
|
|
483
|
+
export { type Infer, type InputInfer, type Literal, type Model, type ModelInfer$1 as ModelInfer, SchemaAny, SchemaArray, SchemaBoolean, SchemaDate, SchemaDefault, SchemaEnum, SchemaFile, type SchemaInfer, type SchemaInputInfer, SchemaIntersection, SchemaItem, type SchemaItemJSON, type SchemaJSON, SchemaLiteral, SchemaNever, SchemaNull, SchemaNullable, SchemaNullish, SchemaNumber, SchemaObject, SchemaRecord, SchemaString, SchemaUndefined, SchemaUnion, SchemaVoid, type ValidationError, type ValidationOptions, type ValidationResult, type ValidationResultOld, Schema as default, isNull, parsable, parseForm, parseFormData, parseQuery, s };
|
package/dist/Schema.d.ts
CHANGED
|
@@ -4,13 +4,6 @@ declare abstract class SchemaItem<Output = any, Input = Output> implements Stand
|
|
|
4
4
|
readonly _output: Output;
|
|
5
5
|
readonly _input: Input;
|
|
6
6
|
'~standard': StandardSchemaV1.Props<Input, Output>;
|
|
7
|
-
/**
|
|
8
|
-
* keep public ?
|
|
9
|
-
*/
|
|
10
|
-
protected readonly validations: Array<{
|
|
11
|
-
fn: (input: Output) => boolean;
|
|
12
|
-
error?: string | undefined;
|
|
13
|
-
}>;
|
|
14
7
|
/**
|
|
15
8
|
* Function calls saved for serialization
|
|
16
9
|
*/
|
|
@@ -18,6 +11,17 @@ declare abstract class SchemaItem<Output = any, Input = Output> implements Stand
|
|
|
18
11
|
name: string;
|
|
19
12
|
args: Array<string> | IArguments | undefined;
|
|
20
13
|
}>;
|
|
14
|
+
/**
|
|
15
|
+
* list of attributes for custom works
|
|
16
|
+
*/
|
|
17
|
+
readonly attributes: Array<string>;
|
|
18
|
+
/**
|
|
19
|
+
* keep public ?
|
|
20
|
+
*/
|
|
21
|
+
protected readonly validations: Array<{
|
|
22
|
+
fn: (input: Output) => boolean;
|
|
23
|
+
error?: string | undefined;
|
|
24
|
+
}>;
|
|
21
25
|
/**
|
|
22
26
|
* Pre process the variable for various reasons
|
|
23
27
|
*
|
|
@@ -34,13 +38,10 @@ declare abstract class SchemaItem<Output = any, Input = Output> implements Stand
|
|
|
34
38
|
* note: the type of the final post-process MUST be valid
|
|
35
39
|
*/
|
|
36
40
|
protected readonly postProcess: Array<(input: Output) => Output>;
|
|
37
|
-
/**
|
|
38
|
-
* list of attributes for custom works
|
|
39
|
-
*/
|
|
40
|
-
readonly attributes: Array<string>;
|
|
41
41
|
protected readonly items?: Array<unknown>;
|
|
42
42
|
private invalidError;
|
|
43
43
|
constructor(items?: Array<unknown> | IArguments);
|
|
44
|
+
parseJSON(): this;
|
|
44
45
|
/**
|
|
45
46
|
* make sure the value is one of the `values`
|
|
46
47
|
* @param values the values the item MUST contains
|
|
@@ -64,6 +65,15 @@ declare abstract class SchemaItem<Output = any, Input = Output> implements Stand
|
|
|
64
65
|
* es2: s.nullable(s.string()) returns s.string()
|
|
65
66
|
*/
|
|
66
67
|
unwrap?(): SchemaItem;
|
|
68
|
+
parse(input: unknown, options?: ValidationOptions): ValidationResult<Output>;
|
|
69
|
+
toJSON(): SchemaJSON;
|
|
70
|
+
private deepSerializeItem;
|
|
71
|
+
addValidation(fn: ((input: Output) => boolean) | {
|
|
72
|
+
fn: (input: Output) => boolean;
|
|
73
|
+
error?: string;
|
|
74
|
+
}, error?: string): this;
|
|
75
|
+
addPreProcess(fn: (input: unknown) => Input | unknown): this;
|
|
76
|
+
addPostProcess(fn: (input: Output) => Output): this;
|
|
67
77
|
/** Returns the sub values of the input, the schema item to handle them, and the path to it */
|
|
68
78
|
protected getSubInputs(_input: unknown): Array<{
|
|
69
79
|
item: SchemaItem;
|
|
@@ -76,21 +86,12 @@ declare abstract class SchemaItem<Output = any, Input = Output> implements Stand
|
|
|
76
86
|
input: unknown;
|
|
77
87
|
errors?: Array<ValidationError>;
|
|
78
88
|
};
|
|
79
|
-
parse(input: unknown, options?: ValidationOptions): ValidationResult<Output>;
|
|
80
|
-
toJSON(): SchemaJSON;
|
|
81
|
-
addValidation(fn: ((input: Output) => boolean) | {
|
|
82
|
-
fn: (input: Output) => boolean;
|
|
83
|
-
error?: string;
|
|
84
|
-
}, error?: string): this;
|
|
85
|
-
addPreProcess(fn: (input: unknown) => Input | unknown): this;
|
|
86
|
-
addPostProcess(fn: (input: Output) => Output): this;
|
|
87
|
-
parseJSON(): this;
|
|
88
89
|
abstract isOfType(input: unknown): input is Output;
|
|
89
90
|
}
|
|
90
91
|
|
|
91
|
-
type SchemaInfer<Type extends SchemaItem> = Type[
|
|
92
|
+
type SchemaInfer<Type extends SchemaItem> = Type['_output']
|
|
92
93
|
type Infer<Type extends SchemaItem> = SchemaInfer<Type>
|
|
93
|
-
type SchemaInputInfer<Type extends SchemaItem> = Type[
|
|
94
|
+
type SchemaInputInfer<Type extends SchemaItem> = Type['_input']
|
|
94
95
|
type InputInfer<Type extends SchemaItem> = SchemaInputInfer<Type>
|
|
95
96
|
|
|
96
97
|
interface ValidationOptions {
|
|
@@ -128,7 +129,7 @@ type ValidationResultOld<T> = {
|
|
|
128
129
|
*/
|
|
129
130
|
interface SchemaJSON {
|
|
130
131
|
/** Id of the schema item (name of the constructor) */
|
|
131
|
-
|
|
132
|
+
_i: string
|
|
132
133
|
/** Attributes */
|
|
133
134
|
a?: Array<string> | undefined
|
|
134
135
|
/** Children schema items */
|
|
@@ -159,6 +160,8 @@ type ModelInfer$1<M extends Model> = {
|
|
|
159
160
|
[key in keyof M]: SchemaInfer<M[key]>
|
|
160
161
|
}
|
|
161
162
|
|
|
163
|
+
type Literal = string | number | bigint | boolean | null | undefined
|
|
164
|
+
|
|
162
165
|
declare class SchemaAny extends SchemaItem {
|
|
163
166
|
isOfType(_input: unknown): _input is any;
|
|
164
167
|
}
|
|
@@ -173,11 +176,11 @@ declare class SchemaRecord<Keys extends SchemaItem<string | number | symbol>, Va
|
|
|
173
176
|
private readonly keys;
|
|
174
177
|
private readonly values;
|
|
175
178
|
constructor(keys: Keys, values: Values);
|
|
179
|
+
isOfType(input: unknown): input is Record<SchemaInfer<Keys>, SchemaInfer<Values>>;
|
|
176
180
|
protected parseSubItems(input: unknown, options?: ValidationOptions): {
|
|
177
181
|
input: unknown;
|
|
178
|
-
errors?: ValidationError
|
|
182
|
+
errors?: Array<ValidationError>;
|
|
179
183
|
};
|
|
180
|
-
isOfType(input: unknown): input is Record<SchemaInfer<Keys>, SchemaInfer<Values>>;
|
|
181
184
|
}
|
|
182
185
|
|
|
183
186
|
declare class SchemaArray<Child extends SchemaItem, Output = SchemaInfer<Child>, Input = SchemaInputInfer<Child>> extends SchemaItem<Array<Output>, Array<Input>> {
|
|
@@ -187,18 +190,19 @@ declare class SchemaArray<Child extends SchemaItem, Output = SchemaInfer<Child>,
|
|
|
187
190
|
* transform the array so it only contains one of each elements
|
|
188
191
|
*/
|
|
189
192
|
unique(): this;
|
|
193
|
+
clean(): this;
|
|
190
194
|
/**
|
|
191
195
|
* split a string into an array
|
|
192
196
|
* @param [separator] default:`,` the separator to use
|
|
193
197
|
*/
|
|
194
198
|
split(separator?: string): this;
|
|
199
|
+
unwrap(): Child;
|
|
200
|
+
isOfType(input: unknown): input is Array<Output>;
|
|
195
201
|
protected getSubInputs(input: unknown): Array<{
|
|
196
202
|
item: SchemaItem;
|
|
197
203
|
value: unknown;
|
|
198
204
|
path: string | undefined;
|
|
199
205
|
}>;
|
|
200
|
-
unwrap(): Child;
|
|
201
|
-
isOfType(input: unknown): input is Array<Output>;
|
|
202
206
|
}
|
|
203
207
|
|
|
204
208
|
declare class SchemaBoolean extends SchemaItem<boolean> {
|
|
@@ -221,17 +225,20 @@ declare class SchemaEnum<E extends EnumLike> extends SchemaItem<E[keyof E]> {
|
|
|
221
225
|
isOfType(input: unknown): input is E[keyof E];
|
|
222
226
|
}
|
|
223
227
|
|
|
224
|
-
declare class SchemaLiteral<
|
|
225
|
-
private readonly
|
|
226
|
-
constructor(
|
|
227
|
-
isOfType(input: unknown): input is
|
|
228
|
+
declare class SchemaLiteral<Types extends Array<Literal>> extends SchemaItem<Types[number]> {
|
|
229
|
+
private readonly values;
|
|
230
|
+
constructor(...values: Types);
|
|
231
|
+
isOfType(input: unknown): input is Types[number];
|
|
228
232
|
}
|
|
229
233
|
|
|
230
234
|
declare class SchemaNullable<Child extends SchemaItem, Output = SchemaInfer<Child>, Input = SchemaInputInfer<Child>> extends SchemaItem<Output | undefined, Input | null | undefined> {
|
|
231
235
|
private readonly child;
|
|
232
236
|
constructor(child: Child);
|
|
233
237
|
falsyAsNull(): this;
|
|
238
|
+
emptyAsNull(): this;
|
|
239
|
+
emptyFileAsNull(): this;
|
|
234
240
|
unwrap(): Child;
|
|
241
|
+
isOfType(input: unknown): input is Output | undefined;
|
|
235
242
|
protected getSubInputs(input: unknown): Array<{
|
|
236
243
|
item: SchemaItem;
|
|
237
244
|
value: unknown;
|
|
@@ -241,7 +248,6 @@ declare class SchemaNullable<Child extends SchemaItem, Output = SchemaInfer<Chil
|
|
|
241
248
|
input: unknown;
|
|
242
249
|
errors?: Array<ValidationError>;
|
|
243
250
|
};
|
|
244
|
-
isOfType(input: unknown): input is Output | undefined;
|
|
245
251
|
}
|
|
246
252
|
|
|
247
253
|
declare class SchemaNumber extends SchemaItem<number> {
|
|
@@ -285,12 +291,12 @@ declare class SchemaObject<T extends Record<string, SchemaItem> = any> extends S
|
|
|
285
291
|
readonly model: T;
|
|
286
292
|
id: string;
|
|
287
293
|
constructor(model: T);
|
|
294
|
+
isOfType(input: unknown): input is ModelInfer<T>;
|
|
288
295
|
protected getSubInputs(input: unknown): Array<{
|
|
289
296
|
item: SchemaItem;
|
|
290
297
|
value: unknown;
|
|
291
298
|
path: string | undefined;
|
|
292
299
|
}>;
|
|
293
|
-
isOfType(input: unknown): input is ModelInfer<T>;
|
|
294
300
|
}
|
|
295
301
|
|
|
296
302
|
declare class SchemaString extends SchemaItem<string> {
|
|
@@ -323,6 +329,11 @@ declare class SchemaString extends SchemaItem<string> {
|
|
|
323
329
|
* @param message the message to display on an error
|
|
324
330
|
*/
|
|
325
331
|
regex(regex: RegExp, message?: string): this;
|
|
332
|
+
/**
|
|
333
|
+
* force the input text to be an email
|
|
334
|
+
* @param message the message to display on an error
|
|
335
|
+
*/
|
|
336
|
+
email(message?: string): this;
|
|
326
337
|
minLength(value: number, message?: string): this;
|
|
327
338
|
maxLength(value: number, message?: string): this;
|
|
328
339
|
isOfType(input: unknown): input is string;
|
|
@@ -331,11 +342,11 @@ declare class SchemaString extends SchemaItem<string> {
|
|
|
331
342
|
declare class SchemaUnion<Children extends Array<SchemaItem>, Outputs = SchemaInfer<Children[number]>, Inputs = SchemaInputInfer<Children[number]>> extends SchemaItem<Outputs, Inputs> {
|
|
332
343
|
private readonly schemas;
|
|
333
344
|
constructor(...schemas: Children);
|
|
345
|
+
isOfType(input: unknown): input is Outputs;
|
|
334
346
|
protected parseSubItems(input: unknown, options?: ValidationOptions): {
|
|
335
347
|
input: unknown;
|
|
336
348
|
errors?: Array<ValidationError>;
|
|
337
349
|
};
|
|
338
|
-
isOfType(input: unknown): input is Outputs;
|
|
339
350
|
}
|
|
340
351
|
|
|
341
352
|
type Prettify<T> = T extends unknown ? {
|
|
@@ -345,11 +356,11 @@ type UnionToIntersection<U> = (U extends U ? (x: U) => void : never) extends ((x
|
|
|
345
356
|
declare class SchemaIntersection<Children extends Array<SchemaItem>, Outputs = Prettify<UnionToIntersection<SchemaInfer<Children[number]>>>, Inputs = Prettify<UnionToIntersection<SchemaInfer<Children[number]>>>> extends SchemaItem<Outputs, Inputs> {
|
|
346
357
|
private readonly schemas;
|
|
347
358
|
constructor(...schemas: Children);
|
|
359
|
+
isOfType(input: unknown): input is Outputs;
|
|
348
360
|
protected parseSubItems(input: unknown, options?: ValidationOptions): {
|
|
349
361
|
input: unknown;
|
|
350
362
|
errors?: Array<ValidationError>;
|
|
351
363
|
};
|
|
352
|
-
isOfType(input: unknown): input is Outputs;
|
|
353
364
|
}
|
|
354
365
|
|
|
355
366
|
declare class SchemaDefault<Child extends SchemaItem, Output = SchemaInfer<Child>, Input = SchemaInputInfer<Child>> extends SchemaItem<Output, Input | null | undefined> {
|
|
@@ -358,12 +369,12 @@ declare class SchemaDefault<Child extends SchemaItem, Output = SchemaInfer<Child
|
|
|
358
369
|
private readonly strict;
|
|
359
370
|
constructor(child: Child, defaultVal: Output, strict?: boolean);
|
|
360
371
|
unwrap(): Child;
|
|
372
|
+
isOfType(input: unknown): input is Output;
|
|
361
373
|
protected getSubInputs(input: unknown): Array<{
|
|
362
374
|
item: SchemaItem;
|
|
363
375
|
value: unknown;
|
|
364
376
|
path: string | undefined;
|
|
365
377
|
}>;
|
|
366
|
-
isOfType(input: unknown): input is Output;
|
|
367
378
|
}
|
|
368
379
|
|
|
369
380
|
declare class SchemaFile extends SchemaItem<File> {
|
|
@@ -373,17 +384,17 @@ declare class SchemaFile extends SchemaItem<File> {
|
|
|
373
384
|
isOfType(input: unknown): input is File;
|
|
374
385
|
}
|
|
375
386
|
|
|
376
|
-
type TupleToOutputs<Tuple extends Array<SchemaItem>, Result extends any
|
|
377
|
-
type TupleToInputs<Tuple extends Array<SchemaItem>, Result extends any
|
|
387
|
+
type TupleToOutputs<Tuple extends Array<SchemaItem>, Result extends Array<any> = []> = number extends Tuple['length'] ? Array<SchemaInfer<Tuple[number]>> : Tuple[Result['length']] extends undefined ? Result : TupleToOutputs<Tuple, [...Result, SchemaInfer<Tuple[Result['length']]>]>;
|
|
388
|
+
type TupleToInputs<Tuple extends Array<SchemaItem>, Result extends Array<any> = []> = number extends Tuple['length'] ? Array<SchemaInputInfer<Tuple[number]>> : Tuple[Result['length']] extends undefined ? Result : TupleToInputs<Tuple, [...Result, SchemaInputInfer<Tuple[Result['length']]>]>;
|
|
378
389
|
declare class SchemaTuple<Children extends Array<SchemaItem>, Outputs = TupleToOutputs<Children>, Inputs = TupleToInputs<Children>> extends SchemaItem<Outputs, Inputs> {
|
|
379
390
|
private readonly children;
|
|
380
391
|
constructor(...children: Children);
|
|
392
|
+
isOfType(input: unknown): input is Outputs;
|
|
381
393
|
protected getSubInputs(input: unknown): Array<{
|
|
382
394
|
item: SchemaItem;
|
|
383
395
|
value: unknown;
|
|
384
396
|
path: string | undefined;
|
|
385
397
|
}>;
|
|
386
|
-
isOfType(input: unknown): input is Outputs;
|
|
387
398
|
}
|
|
388
399
|
|
|
389
400
|
declare class SchemaUndefined extends SchemaItem<undefined> {
|
|
@@ -403,7 +414,10 @@ declare class SchemaNever extends SchemaItem<never> {
|
|
|
403
414
|
}
|
|
404
415
|
|
|
405
416
|
declare function isNull(value: unknown): value is undefined | null;
|
|
406
|
-
declare function parseQuery<T extends SchemaItem>(
|
|
417
|
+
declare function parseQuery<T extends SchemaItem>(schema: T, query: URLSearchParams, opts?: Parameters<T['parse']>[1]): ReturnType<T['parse']>;
|
|
418
|
+
/**
|
|
419
|
+
* (Note: be carefull : missing key/value associated to schema "s.boolean().nullable" or "s.boolean()" will be transform into false)
|
|
420
|
+
*/
|
|
407
421
|
declare function parseFormData<T extends SchemaItem>(schema: T, data: FormData, opts?: Parameters<T['parse']>[1]): ReturnType<T['parse']>;
|
|
408
422
|
declare function parseForm<T extends SchemaItem>(model: T, form: HTMLFormElement, opts?: Parameters<T['parse']>[1]): ReturnType<T['parse']>;
|
|
409
423
|
|
|
@@ -412,30 +426,10 @@ declare function parseForm<T extends SchemaItem>(model: T, form: HTMLFormElement
|
|
|
412
426
|
*/
|
|
413
427
|
declare function parsable(): (target: object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<any>) => TypedPropertyDescriptor<any>;
|
|
414
428
|
type SchemaItemStatic = new (...args: Array<any>) => SchemaItem;
|
|
415
|
-
declare const Types: {
|
|
416
|
-
readonly Any: typeof SchemaAny;
|
|
417
|
-
readonly Array: typeof SchemaArray;
|
|
418
|
-
readonly Tuple: typeof SchemaTuple;
|
|
419
|
-
readonly Boolean: typeof SchemaBoolean;
|
|
420
|
-
readonly Date: typeof SchemaDate;
|
|
421
|
-
readonly Enum: typeof SchemaEnum;
|
|
422
|
-
readonly Literal: typeof SchemaLiteral;
|
|
423
|
-
readonly Nullable: typeof SchemaNullable;
|
|
424
|
-
readonly Object: typeof SchemaObject;
|
|
425
|
-
readonly Record: typeof SchemaRecord;
|
|
426
|
-
readonly String: typeof SchemaString;
|
|
427
|
-
readonly Union: typeof SchemaUnion;
|
|
428
|
-
readonly Intersection: typeof SchemaIntersection;
|
|
429
|
-
readonly Default: typeof SchemaDefault;
|
|
430
|
-
readonly Undefined: typeof SchemaUndefined;
|
|
431
|
-
readonly Void: typeof SchemaVoid;
|
|
432
|
-
readonly Null: typeof SchemaNull;
|
|
433
|
-
readonly Nullish: typeof SchemaNullish;
|
|
434
|
-
};
|
|
435
429
|
declare class Schema<T extends Record<string, SchemaItem> = Record<string, SchemaItem>> extends SchemaObject<T> {
|
|
436
430
|
private static readonly registeredModules;
|
|
437
431
|
static register(module: SchemaItemStatic): void;
|
|
438
|
-
static getModule(name: string): SchemaItemStatic
|
|
432
|
+
static getModule(name: string): SchemaItemStatic;
|
|
439
433
|
static any(): SchemaAny;
|
|
440
434
|
static array<Type extends SchemaItem>(...inputs: ConstructorParameters<typeof SchemaArray<Type>>): SchemaArray<Type>;
|
|
441
435
|
static boolean(...inputs: ConstructorParameters<typeof SchemaBoolean>): SchemaBoolean;
|
|
@@ -446,7 +440,7 @@ declare class Schema<T extends Record<string, SchemaItem> = Record<string, Schem
|
|
|
446
440
|
* @param input the literal value (note: append `as const` else the typing won't work correctly)
|
|
447
441
|
* @returns
|
|
448
442
|
*/
|
|
449
|
-
static literal<Type
|
|
443
|
+
static literal<Type extends Array<Literal>>(...inputs: ConstructorParameters<typeof SchemaLiteral<Type>>): SchemaLiteral<Type>;
|
|
450
444
|
static nullable<Type extends SchemaItem>(...inputs: ConstructorParameters<typeof SchemaNullable<Type>>): SchemaNullable<Type>;
|
|
451
445
|
static number(...inputs: ConstructorParameters<typeof SchemaNumber>): SchemaNumber;
|
|
452
446
|
static object<Type extends Record<string, SchemaItem>>(...inputs: ConstructorParameters<typeof SchemaObject<Type>>): SchemaObject<Type>;
|
|
@@ -457,14 +451,15 @@ declare class Schema<T extends Record<string, SchemaItem> = Record<string, Schem
|
|
|
457
451
|
static string(...inputs: ConstructorParameters<typeof SchemaString>): SchemaString;
|
|
458
452
|
static file(...inputs: ConstructorParameters<typeof SchemaFile>): SchemaFile;
|
|
459
453
|
static union<Type extends Array<SchemaItem>>(...inputs: ConstructorParameters<typeof SchemaUnion<Type>>): SchemaUnion<Type>;
|
|
460
|
-
static intersection<Type extends SchemaItem
|
|
461
|
-
static tuple<Items extends SchemaItem
|
|
454
|
+
static intersection<Type extends Array<SchemaItem>>(...inputs: ConstructorParameters<typeof SchemaIntersection<Type>>): SchemaIntersection<Type>;
|
|
455
|
+
static tuple<Items extends Array<SchemaItem>>(...inputs: ConstructorParameters<typeof SchemaTuple<Items>>): SchemaTuple<Items>;
|
|
462
456
|
static undefined(...inputs: ConstructorParameters<typeof SchemaUndefined>): SchemaUndefined;
|
|
463
457
|
static null(...inputs: ConstructorParameters<typeof SchemaNull>): SchemaNull;
|
|
464
458
|
static nullish(...inputs: ConstructorParameters<typeof SchemaNullish>): SchemaNullish;
|
|
465
459
|
static void(...inputs: ConstructorParameters<typeof SchemaVoid>): SchemaVoid;
|
|
466
460
|
static never(...inputs: ConstructorParameters<typeof SchemaNever>): SchemaNever;
|
|
467
461
|
static fromJSON(json: SchemaJSON): SchemaItem;
|
|
462
|
+
static deepParseSchemaJSON(item: unknown): unknown;
|
|
468
463
|
static isSchemaJSON(data: unknown): data is SchemaJSON;
|
|
469
464
|
/**
|
|
470
465
|
* @deprecated use helper `parseQuery`
|
|
@@ -485,4 +480,4 @@ declare class Schema<T extends Record<string, SchemaItem> = Record<string, Schem
|
|
|
485
480
|
}
|
|
486
481
|
declare const s: typeof Schema;
|
|
487
482
|
|
|
488
|
-
export { type Infer, type InputInfer, type Model, type ModelInfer$1 as ModelInfer, SchemaAny, SchemaArray, SchemaBoolean, SchemaDate, SchemaDefault, SchemaEnum, SchemaFile, type SchemaInfer, type SchemaInputInfer, SchemaIntersection, SchemaItem, type SchemaItemJSON, type SchemaJSON, SchemaLiteral, SchemaNever, SchemaNull, SchemaNullable, SchemaNullish, SchemaNumber, SchemaObject, SchemaRecord, SchemaString, SchemaUndefined, SchemaUnion, SchemaVoid,
|
|
483
|
+
export { type Infer, type InputInfer, type Literal, type Model, type ModelInfer$1 as ModelInfer, SchemaAny, SchemaArray, SchemaBoolean, SchemaDate, SchemaDefault, SchemaEnum, SchemaFile, type SchemaInfer, type SchemaInputInfer, SchemaIntersection, SchemaItem, type SchemaItemJSON, type SchemaJSON, SchemaLiteral, SchemaNever, SchemaNull, SchemaNullable, SchemaNullish, SchemaNumber, SchemaObject, SchemaRecord, SchemaString, SchemaUndefined, SchemaUnion, SchemaVoid, type ValidationError, type ValidationOptions, type ValidationResult, type ValidationResultOld, Schema as default, isNull, parsable, parseForm, parseFormData, parseQuery, s };
|