@xpadev-net/niconicomments 0.2.65 → 0.2.67
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/bundle.d.ts +488 -44
- package/dist/bundle.js +378 -490
- package/package.json +11 -11
package/dist/bundle.d.ts
CHANGED
|
@@ -8,19 +8,66 @@ export type IssueReason = "any" | "array" | "bigint" | "blob" | "boolean" | "dat
|
|
|
8
8
|
* Issue origin type.
|
|
9
9
|
*/
|
|
10
10
|
export type IssueOrigin = "key" | "value";
|
|
11
|
+
/**
|
|
12
|
+
* Unknown path item type.
|
|
13
|
+
*/
|
|
14
|
+
export type UnknownPathItem = {
|
|
15
|
+
type: "unknown";
|
|
16
|
+
input: unknown;
|
|
17
|
+
key: unknown;
|
|
18
|
+
value: unknown;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Path item type.
|
|
22
|
+
*/
|
|
23
|
+
export type PathItem = ArrayPathItem | MapPathItem | ObjectPathItem | RecordPathItem | SetPathItem | TuplePathItem | UnknownPathItem;
|
|
11
24
|
/**
|
|
12
25
|
* Issue type.
|
|
13
26
|
*/
|
|
14
27
|
export type Issue = {
|
|
28
|
+
/**
|
|
29
|
+
* The issue reason.
|
|
30
|
+
*/
|
|
15
31
|
reason: IssueReason;
|
|
32
|
+
/**
|
|
33
|
+
* The validation name.
|
|
34
|
+
*/
|
|
16
35
|
validation: string;
|
|
36
|
+
/**
|
|
37
|
+
* The issue origin.
|
|
38
|
+
*/
|
|
17
39
|
origin: IssueOrigin;
|
|
40
|
+
/**
|
|
41
|
+
* The error message.
|
|
42
|
+
*/
|
|
18
43
|
message: string;
|
|
19
|
-
|
|
44
|
+
/**
|
|
45
|
+
* The input data.
|
|
46
|
+
*/
|
|
47
|
+
input: unknown;
|
|
48
|
+
/**
|
|
49
|
+
* The validation requirement
|
|
50
|
+
*/
|
|
51
|
+
requirement?: unknown;
|
|
52
|
+
/**
|
|
53
|
+
* The issue path.
|
|
54
|
+
*/
|
|
20
55
|
path?: PathItem[];
|
|
56
|
+
/**
|
|
57
|
+
* The sub issues.
|
|
58
|
+
*/
|
|
21
59
|
issues?: Issues;
|
|
60
|
+
/**
|
|
61
|
+
* Whether it was abort early.
|
|
62
|
+
*/
|
|
22
63
|
abortEarly?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Whether the pipe was abort early.
|
|
66
|
+
*/
|
|
23
67
|
abortPipeEarly?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Whether the pipe was skipped.
|
|
70
|
+
*/
|
|
24
71
|
skipPipe?: boolean;
|
|
25
72
|
};
|
|
26
73
|
/**
|
|
@@ -30,30 +77,92 @@ export type Issues = [
|
|
|
30
77
|
Issue,
|
|
31
78
|
...Issue[]
|
|
32
79
|
];
|
|
80
|
+
/**
|
|
81
|
+
* Error message type.
|
|
82
|
+
*/
|
|
83
|
+
export type ErrorMessage = string | (() => string);
|
|
84
|
+
/**
|
|
85
|
+
* Resolve type.
|
|
86
|
+
*
|
|
87
|
+
* Hint: This type has no effect and is only used so that TypeScript displays
|
|
88
|
+
* the final type in the preview instead of the utility types used.
|
|
89
|
+
*/
|
|
90
|
+
export type Resolve<T> = T;
|
|
91
|
+
/**
|
|
92
|
+
* Resolve object type.
|
|
93
|
+
*
|
|
94
|
+
* Hint: This type has no effect and is only used so that TypeScript displays
|
|
95
|
+
* the final type in the preview instead of the utility types used.
|
|
96
|
+
*/
|
|
97
|
+
export type ResolveObject<T> = Resolve<{
|
|
98
|
+
[k in keyof T]: T[k];
|
|
99
|
+
}>;
|
|
33
100
|
/**
|
|
34
101
|
* Parse info type.
|
|
35
102
|
*/
|
|
36
103
|
export type ParseInfo = Partial<Pick<Issue, "origin" | "abortEarly" | "abortPipeEarly" | "skipPipe">>;
|
|
37
104
|
/**
|
|
38
|
-
*
|
|
105
|
+
* Typed schema result type.
|
|
39
106
|
*/
|
|
40
|
-
export type
|
|
107
|
+
export type TypedSchemaResult<TOutput> = {
|
|
108
|
+
/**
|
|
109
|
+
* Whether is's typed.
|
|
110
|
+
*/
|
|
111
|
+
typed: true;
|
|
112
|
+
/**
|
|
113
|
+
* The parse output.
|
|
114
|
+
*/
|
|
115
|
+
output: TOutput;
|
|
116
|
+
/**
|
|
117
|
+
* The parse issues.
|
|
118
|
+
*/
|
|
119
|
+
issues?: Issues;
|
|
120
|
+
};
|
|
41
121
|
/**
|
|
42
|
-
*
|
|
122
|
+
* Untyped parse result type.
|
|
43
123
|
*/
|
|
44
|
-
export type
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
124
|
+
export type UntypedSchemaResult = {
|
|
125
|
+
/**
|
|
126
|
+
* Whether is's typed.
|
|
127
|
+
*/
|
|
128
|
+
typed: false;
|
|
129
|
+
/**
|
|
130
|
+
* The parse output.
|
|
131
|
+
*/
|
|
132
|
+
output: unknown;
|
|
133
|
+
/**
|
|
134
|
+
* The parse issues.
|
|
135
|
+
*/
|
|
49
136
|
issues: Issues;
|
|
50
137
|
};
|
|
138
|
+
/**
|
|
139
|
+
* Schema result type.
|
|
140
|
+
*/
|
|
141
|
+
export type SchemaResult<TOutput> = TypedSchemaResult<TOutput> | UntypedSchemaResult;
|
|
51
142
|
/**
|
|
52
143
|
* Base schema type.
|
|
53
144
|
*/
|
|
54
145
|
export type BaseSchema<TInput = any, TOutput = TInput> = {
|
|
146
|
+
/**
|
|
147
|
+
* Whether it's async.
|
|
148
|
+
*/
|
|
55
149
|
async: false;
|
|
56
|
-
|
|
150
|
+
/**
|
|
151
|
+
* Parses unknown input based on its schema.
|
|
152
|
+
*
|
|
153
|
+
* @param input The input to be parsed.
|
|
154
|
+
* @param info The parse info.
|
|
155
|
+
*
|
|
156
|
+
* @returns The parse result.
|
|
157
|
+
*
|
|
158
|
+
* @internal
|
|
159
|
+
*/
|
|
160
|
+
_parse(input: unknown, info?: ParseInfo): SchemaResult<TOutput>;
|
|
161
|
+
/**
|
|
162
|
+
* Input and output type.
|
|
163
|
+
*
|
|
164
|
+
* @internal
|
|
165
|
+
*/
|
|
57
166
|
_types?: {
|
|
58
167
|
input: TInput;
|
|
59
168
|
output: TOutput;
|
|
@@ -63,8 +172,26 @@ export type BaseSchema<TInput = any, TOutput = TInput> = {
|
|
|
63
172
|
* Base schema async type.
|
|
64
173
|
*/
|
|
65
174
|
export type BaseSchemaAsync<TInput = any, TOutput = TInput> = {
|
|
175
|
+
/**
|
|
176
|
+
* Whether it's async.
|
|
177
|
+
*/
|
|
66
178
|
async: true;
|
|
67
|
-
|
|
179
|
+
/**
|
|
180
|
+
* Parses unknown input based on its schema.
|
|
181
|
+
*
|
|
182
|
+
* @param input The input to be parsed.
|
|
183
|
+
* @param info The parse info.
|
|
184
|
+
*
|
|
185
|
+
* @returns The parse result.
|
|
186
|
+
*
|
|
187
|
+
* @internal
|
|
188
|
+
*/
|
|
189
|
+
_parse(input: unknown, info?: ParseInfo): Promise<SchemaResult<TOutput>>;
|
|
190
|
+
/**
|
|
191
|
+
* Input and output type.
|
|
192
|
+
*
|
|
193
|
+
* @internal
|
|
194
|
+
*/
|
|
68
195
|
_types?: {
|
|
69
196
|
input: TInput;
|
|
70
197
|
output: TOutput;
|
|
@@ -79,42 +206,173 @@ export type Input<TSchema extends BaseSchema | BaseSchemaAsync> = NonNullable<TS
|
|
|
79
206
|
*/
|
|
80
207
|
export type Output<TSchema extends BaseSchema | BaseSchemaAsync> = NonNullable<TSchema["_types"]>["output"];
|
|
81
208
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* Hint: This type has no effect and is only used so that TypeScript displays
|
|
85
|
-
* the final type in the preview instead of the utility types used.
|
|
209
|
+
* Valid action result type.
|
|
86
210
|
*/
|
|
87
|
-
export type
|
|
211
|
+
export type ValidActionResult<TOutput> = {
|
|
212
|
+
/**
|
|
213
|
+
* The pipe output.
|
|
214
|
+
*/
|
|
215
|
+
output: TOutput;
|
|
216
|
+
/**
|
|
217
|
+
* The pipe issues.
|
|
218
|
+
*/
|
|
219
|
+
issues?: undefined;
|
|
220
|
+
};
|
|
88
221
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* Hint: This type has no effect and is only used so that TypeScript displays
|
|
92
|
-
* the final type in the preview instead of the utility types used.
|
|
222
|
+
* Invalid action result type.
|
|
93
223
|
*/
|
|
94
|
-
export type
|
|
95
|
-
|
|
96
|
-
|
|
224
|
+
export type InvalidActionResult = {
|
|
225
|
+
/**
|
|
226
|
+
* The pipe output.
|
|
227
|
+
*/
|
|
228
|
+
output?: undefined;
|
|
229
|
+
/**
|
|
230
|
+
* The pipe issues.
|
|
231
|
+
*/
|
|
232
|
+
issues: Pick<Issue, "validation" | "message" | "input" | "requirement" | "path">[];
|
|
233
|
+
};
|
|
234
|
+
/**
|
|
235
|
+
* Pipe action result type.
|
|
236
|
+
*/
|
|
237
|
+
export type PipeActionResult<TOutput> = ValidActionResult<TOutput> | InvalidActionResult;
|
|
238
|
+
/**
|
|
239
|
+
* Base validation type.
|
|
240
|
+
*/
|
|
241
|
+
export type BaseValidation<TInput = any> = {
|
|
242
|
+
/**
|
|
243
|
+
* Whether it's async.
|
|
244
|
+
*/
|
|
245
|
+
async: false;
|
|
246
|
+
/**
|
|
247
|
+
* The error message.
|
|
248
|
+
*/
|
|
249
|
+
message: ErrorMessage;
|
|
250
|
+
/**
|
|
251
|
+
* Parses unknown input based on its requirement.
|
|
252
|
+
*
|
|
253
|
+
* @param input The input to be parsed.
|
|
254
|
+
*
|
|
255
|
+
* @returns The parse result.
|
|
256
|
+
*
|
|
257
|
+
* @internal
|
|
258
|
+
*/
|
|
259
|
+
_parse(input: TInput): PipeActionResult<TInput>;
|
|
260
|
+
};
|
|
261
|
+
/**
|
|
262
|
+
* Base validation async type.
|
|
263
|
+
*/
|
|
264
|
+
export type BaseValidationAsync<TInput = any> = {
|
|
265
|
+
/**
|
|
266
|
+
* Whether it's async.
|
|
267
|
+
*/
|
|
268
|
+
async: true;
|
|
269
|
+
/**
|
|
270
|
+
* The error message.
|
|
271
|
+
*/
|
|
272
|
+
message: ErrorMessage;
|
|
273
|
+
/**
|
|
274
|
+
* Parses unknown input based on its requirement.
|
|
275
|
+
*
|
|
276
|
+
* @param input The input to be parsed.
|
|
277
|
+
*
|
|
278
|
+
* @returns The parse result.
|
|
279
|
+
*
|
|
280
|
+
* @internal
|
|
281
|
+
*/
|
|
282
|
+
_parse(input: TInput): Promise<PipeActionResult<TInput>>;
|
|
283
|
+
};
|
|
284
|
+
/**
|
|
285
|
+
* Base transformation type.
|
|
286
|
+
*/
|
|
287
|
+
export type BaseTransformation<TInput = any> = {
|
|
288
|
+
/**
|
|
289
|
+
* Whether it's async.
|
|
290
|
+
*/
|
|
291
|
+
async: false;
|
|
292
|
+
/**
|
|
293
|
+
* Parses unknown input based on its requirement.
|
|
294
|
+
*
|
|
295
|
+
* @param input The input to be parsed.
|
|
296
|
+
*
|
|
297
|
+
* @returns The parse result.
|
|
298
|
+
*
|
|
299
|
+
* @internal
|
|
300
|
+
*/
|
|
301
|
+
_parse(input: TInput): PipeActionResult<TInput>;
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
* Base transformation async type.
|
|
305
|
+
*/
|
|
306
|
+
export type BaseTransformationAsync<TInput = any> = {
|
|
307
|
+
/**
|
|
308
|
+
* Whether it's async.
|
|
309
|
+
*/
|
|
310
|
+
async: true;
|
|
311
|
+
/**
|
|
312
|
+
* Parses unknown input based on its requirement.
|
|
313
|
+
*
|
|
314
|
+
* @param input The input to be parsed.
|
|
315
|
+
*
|
|
316
|
+
* @returns The parse result.
|
|
317
|
+
*
|
|
318
|
+
* @internal
|
|
319
|
+
*/
|
|
320
|
+
_parse(input: TInput): Promise<PipeActionResult<TInput>>;
|
|
321
|
+
};
|
|
322
|
+
/**
|
|
323
|
+
* Pipe type.
|
|
324
|
+
*/
|
|
325
|
+
export type Pipe<TInput> = (BaseValidation<TInput> | BaseTransformation<TInput>)[];
|
|
326
|
+
/**
|
|
327
|
+
* Pipe async type.
|
|
328
|
+
*/
|
|
329
|
+
export type PipeAsync<TInput> = (BaseValidation<TInput> | BaseValidationAsync<TInput> | BaseTransformation<TInput> | BaseTransformationAsync<TInput>)[];
|
|
97
330
|
/**
|
|
98
331
|
* Array schema type.
|
|
99
332
|
*/
|
|
100
333
|
export type ArraySchema<TItem extends BaseSchema, TOutput = Output<TItem>[]> = BaseSchema<Input<TItem>[], TOutput> & {
|
|
334
|
+
/**
|
|
335
|
+
* The schema type.
|
|
336
|
+
*/
|
|
101
337
|
type: "array";
|
|
338
|
+
/**
|
|
339
|
+
* The array item schema.
|
|
340
|
+
*/
|
|
102
341
|
item: TItem;
|
|
342
|
+
/**
|
|
343
|
+
* The error message.
|
|
344
|
+
*/
|
|
345
|
+
message: ErrorMessage;
|
|
346
|
+
/**
|
|
347
|
+
* The validation and transformation pipeline.
|
|
348
|
+
*/
|
|
349
|
+
pipe: Pipe<Output<TItem>[]> | undefined;
|
|
103
350
|
};
|
|
104
351
|
/**
|
|
105
352
|
* Array path item type.
|
|
106
353
|
*/
|
|
107
354
|
export type ArrayPathItem = {
|
|
108
355
|
type: "array";
|
|
109
|
-
input:
|
|
356
|
+
input: unknown[];
|
|
110
357
|
key: number;
|
|
111
|
-
value:
|
|
358
|
+
value: unknown;
|
|
112
359
|
};
|
|
113
360
|
/**
|
|
114
361
|
* Boolean schema type.
|
|
115
362
|
*/
|
|
116
363
|
export type BooleanSchema<TOutput = boolean> = BaseSchema<boolean, TOutput> & {
|
|
364
|
+
/**
|
|
365
|
+
* The schema type.
|
|
366
|
+
*/
|
|
117
367
|
type: "boolean";
|
|
368
|
+
/**
|
|
369
|
+
* The error message.
|
|
370
|
+
*/
|
|
371
|
+
message: ErrorMessage;
|
|
372
|
+
/**
|
|
373
|
+
* The validation and transformation pipeline.
|
|
374
|
+
*/
|
|
375
|
+
pipe: Pipe<boolean> | undefined;
|
|
118
376
|
};
|
|
119
377
|
/**
|
|
120
378
|
* Enum type.
|
|
@@ -127,15 +385,35 @@ export type Enum = {
|
|
|
127
385
|
* Native enum schema type.
|
|
128
386
|
*/
|
|
129
387
|
export type EnumSchema<TEnum extends Enum, TOutput = TEnum[keyof TEnum]> = BaseSchema<TEnum[keyof TEnum], TOutput> & {
|
|
388
|
+
/**
|
|
389
|
+
* The schema type.
|
|
390
|
+
*/
|
|
130
391
|
type: "enum";
|
|
392
|
+
/**
|
|
393
|
+
* The enum value.
|
|
394
|
+
*/
|
|
131
395
|
enum: TEnum;
|
|
396
|
+
/**
|
|
397
|
+
* The error message.
|
|
398
|
+
*/
|
|
399
|
+
message: ErrorMessage;
|
|
132
400
|
};
|
|
133
401
|
/**
|
|
134
402
|
* Native enum schema async type.
|
|
135
403
|
*/
|
|
136
404
|
export type EnumSchemaAsync<TEnum extends Enum, TOutput = TEnum[keyof TEnum]> = BaseSchemaAsync<TEnum[keyof TEnum], TOutput> & {
|
|
405
|
+
/**
|
|
406
|
+
* The schema type.
|
|
407
|
+
*/
|
|
137
408
|
type: "enum";
|
|
409
|
+
/**
|
|
410
|
+
* The enum value.
|
|
411
|
+
*/
|
|
138
412
|
enum: TEnum;
|
|
413
|
+
/**
|
|
414
|
+
* The error message.
|
|
415
|
+
*/
|
|
416
|
+
message: ErrorMessage;
|
|
139
417
|
};
|
|
140
418
|
/**
|
|
141
419
|
* Intersect options async type.
|
|
@@ -175,8 +453,18 @@ export type IntersectOptions = [
|
|
|
175
453
|
* Intersect schema type.
|
|
176
454
|
*/
|
|
177
455
|
export type IntersectSchema<TOptions extends IntersectOptions, TOutput = IntersectOutput<TOptions>> = BaseSchema<IntersectInput<TOptions>, TOutput> & {
|
|
456
|
+
/**
|
|
457
|
+
* The schema type.
|
|
458
|
+
*/
|
|
178
459
|
type: "intersect";
|
|
460
|
+
/**
|
|
461
|
+
* The intersect options.
|
|
462
|
+
*/
|
|
179
463
|
options: TOptions;
|
|
464
|
+
/**
|
|
465
|
+
* The error message.
|
|
466
|
+
*/
|
|
467
|
+
message: ErrorMessage;
|
|
180
468
|
};
|
|
181
469
|
/**
|
|
182
470
|
* Literal type.
|
|
@@ -186,43 +474,87 @@ export type Literal = number | string | boolean | symbol | bigint;
|
|
|
186
474
|
* Literal schema type.
|
|
187
475
|
*/
|
|
188
476
|
export type LiteralSchema<TLiteral extends Literal, TOutput = TLiteral> = BaseSchema<TLiteral, TOutput> & {
|
|
477
|
+
/**
|
|
478
|
+
* The schema type.
|
|
479
|
+
*/
|
|
189
480
|
type: "literal";
|
|
481
|
+
/**
|
|
482
|
+
* The literal value.
|
|
483
|
+
*/
|
|
190
484
|
literal: TLiteral;
|
|
485
|
+
/**
|
|
486
|
+
* The error message.
|
|
487
|
+
*/
|
|
488
|
+
message: ErrorMessage;
|
|
191
489
|
};
|
|
192
490
|
/**
|
|
193
491
|
* Map path item type.
|
|
194
492
|
*/
|
|
195
493
|
export type MapPathItem = {
|
|
196
494
|
type: "map";
|
|
197
|
-
input: Map<
|
|
198
|
-
key:
|
|
199
|
-
value:
|
|
495
|
+
input: Map<unknown, unknown>;
|
|
496
|
+
key: unknown;
|
|
497
|
+
value: unknown;
|
|
200
498
|
};
|
|
201
499
|
/**
|
|
202
500
|
* Never schema type.
|
|
203
501
|
*/
|
|
204
502
|
export type NeverSchema = BaseSchema<never> & {
|
|
503
|
+
/**
|
|
504
|
+
* The schema type.
|
|
505
|
+
*/
|
|
205
506
|
type: "never";
|
|
507
|
+
/**
|
|
508
|
+
* The error message.
|
|
509
|
+
*/
|
|
510
|
+
message: ErrorMessage;
|
|
206
511
|
};
|
|
207
512
|
/**
|
|
208
513
|
* Never schema async type.
|
|
209
514
|
*/
|
|
210
515
|
export type NeverSchemaAsync = BaseSchemaAsync<never> & {
|
|
516
|
+
/**
|
|
517
|
+
* The schema type.
|
|
518
|
+
*/
|
|
211
519
|
type: "never";
|
|
520
|
+
/**
|
|
521
|
+
* The error message.
|
|
522
|
+
*/
|
|
523
|
+
message: ErrorMessage;
|
|
212
524
|
};
|
|
213
525
|
/**
|
|
214
526
|
* Nullable schema type.
|
|
215
527
|
*/
|
|
216
|
-
export type NullableSchema<TWrapped extends BaseSchema, TDefault extends Input<TWrapped> | undefined = undefined, TOutput = TDefault extends Input<TWrapped> ? Output<TWrapped> : Output<TWrapped> | null> = BaseSchema<Input<TWrapped> | null, TOutput> & {
|
|
528
|
+
export type NullableSchema<TWrapped extends BaseSchema, TDefault extends Input<TWrapped> | (() => Input<TWrapped> | undefined) | undefined = undefined, TOutput = TDefault extends Input<TWrapped> ? Output<TWrapped> : Output<TWrapped> | null> = BaseSchema<Input<TWrapped> | null, TOutput> & {
|
|
529
|
+
/**
|
|
530
|
+
* The schema type.
|
|
531
|
+
*/
|
|
217
532
|
type: "nullable";
|
|
533
|
+
/**
|
|
534
|
+
* The wrapped schema.
|
|
535
|
+
*/
|
|
218
536
|
wrapped: TWrapped;
|
|
219
|
-
|
|
537
|
+
/**
|
|
538
|
+
* The default value.
|
|
539
|
+
*/
|
|
540
|
+
default: TDefault;
|
|
220
541
|
};
|
|
221
542
|
/**
|
|
222
543
|
* Number schema type.
|
|
223
544
|
*/
|
|
224
545
|
export type NumberSchema<TOutput = number> = BaseSchema<number, TOutput> & {
|
|
546
|
+
/**
|
|
547
|
+
* The schema type.
|
|
548
|
+
*/
|
|
225
549
|
type: "number";
|
|
550
|
+
/**
|
|
551
|
+
* The error message.
|
|
552
|
+
*/
|
|
553
|
+
message: ErrorMessage;
|
|
554
|
+
/**
|
|
555
|
+
* The validation and transformation pipeline.
|
|
556
|
+
*/
|
|
557
|
+
pipe: Pipe<number> | undefined;
|
|
226
558
|
};
|
|
227
559
|
/**
|
|
228
560
|
* Object entries async type.
|
|
@@ -233,9 +565,9 @@ export type ObjectEntriesAsync = Record<string, BaseSchema | BaseSchemaAsync>;
|
|
|
233
565
|
*/
|
|
234
566
|
export type ObjectPathItem = {
|
|
235
567
|
type: "object";
|
|
236
|
-
input: Record<string,
|
|
568
|
+
input: Record<string, unknown>;
|
|
237
569
|
key: string;
|
|
238
|
-
value:
|
|
570
|
+
value: unknown;
|
|
239
571
|
};
|
|
240
572
|
/**
|
|
241
573
|
* Required object keys type.
|
|
@@ -277,17 +609,43 @@ export type ObjectEntries = Record<string, BaseSchema>;
|
|
|
277
609
|
* Object schema type.
|
|
278
610
|
*/
|
|
279
611
|
export type ObjectSchema<TEntries extends ObjectEntries, TRest extends BaseSchema | undefined = undefined, TOutput = ObjectOutput<TEntries, TRest>> = BaseSchema<ObjectInput<TEntries, TRest>, TOutput> & {
|
|
612
|
+
/**
|
|
613
|
+
* The schema type.
|
|
614
|
+
*/
|
|
280
615
|
type: "object";
|
|
616
|
+
/**
|
|
617
|
+
* The object entries schema.
|
|
618
|
+
*/
|
|
281
619
|
entries: TEntries;
|
|
620
|
+
/**
|
|
621
|
+
* The object rest schema.
|
|
622
|
+
*/
|
|
282
623
|
rest: TRest;
|
|
624
|
+
/**
|
|
625
|
+
* The error message.
|
|
626
|
+
*/
|
|
627
|
+
message: ErrorMessage;
|
|
628
|
+
/**
|
|
629
|
+
* The validation and transformation pipeline.
|
|
630
|
+
*/
|
|
631
|
+
pipe: Pipe<ObjectOutput<TEntries, TRest>> | undefined;
|
|
283
632
|
};
|
|
284
633
|
/**
|
|
285
634
|
* Optional schema type.
|
|
286
635
|
*/
|
|
287
|
-
export type OptionalSchema<TWrapped extends BaseSchema, TDefault extends Input<TWrapped> | undefined = undefined, TOutput = TDefault extends Input<TWrapped> ? Output<TWrapped> : Output<TWrapped> | undefined> = BaseSchema<Input<TWrapped> | undefined, TOutput> & {
|
|
636
|
+
export type OptionalSchema<TWrapped extends BaseSchema, TDefault extends Input<TWrapped> | (() => Input<TWrapped> | undefined) | undefined = undefined, TOutput = TDefault extends Input<TWrapped> ? Output<TWrapped> : Output<TWrapped> | undefined> = BaseSchema<Input<TWrapped> | undefined, TOutput> & {
|
|
637
|
+
/**
|
|
638
|
+
* The schema type.
|
|
639
|
+
*/
|
|
288
640
|
type: "optional";
|
|
641
|
+
/**
|
|
642
|
+
* The wrapped schema.
|
|
643
|
+
*/
|
|
289
644
|
wrapped: TWrapped;
|
|
290
|
-
|
|
645
|
+
/**
|
|
646
|
+
* Returns the default value.
|
|
647
|
+
*/
|
|
648
|
+
default: TDefault;
|
|
291
649
|
};
|
|
292
650
|
/**
|
|
293
651
|
* Picklist options type.
|
|
@@ -302,28 +660,70 @@ export type PicklistOptions<TOption extends string = string> = Readonly<[
|
|
|
302
660
|
/**
|
|
303
661
|
* Picklist schema type.
|
|
304
662
|
*/
|
|
305
|
-
export type PicklistSchema<
|
|
663
|
+
export type PicklistSchema<TOptions extends PicklistOptions, TOutput = TOptions[number]> = BaseSchema<TOptions[number], TOutput> & {
|
|
664
|
+
/**
|
|
665
|
+
* The schema type.
|
|
666
|
+
*/
|
|
306
667
|
type: "picklist";
|
|
307
|
-
|
|
668
|
+
/**
|
|
669
|
+
* The picklist options.
|
|
670
|
+
*/
|
|
671
|
+
options: TOptions;
|
|
672
|
+
/**
|
|
673
|
+
* The error message.
|
|
674
|
+
*/
|
|
675
|
+
message: ErrorMessage;
|
|
308
676
|
};
|
|
309
677
|
/**
|
|
310
678
|
* Picklist schema async type.
|
|
311
679
|
*/
|
|
312
680
|
export type PicklistSchemaAsync<TOptions extends PicklistOptions, TOutput = TOptions[number]> = BaseSchemaAsync<TOptions[number], TOutput> & {
|
|
681
|
+
/**
|
|
682
|
+
* The schema type.
|
|
683
|
+
*/
|
|
313
684
|
type: "picklist";
|
|
685
|
+
/**
|
|
686
|
+
* The picklist value.
|
|
687
|
+
*/
|
|
314
688
|
options: TOptions;
|
|
689
|
+
/**
|
|
690
|
+
* The error message.
|
|
691
|
+
*/
|
|
692
|
+
message: ErrorMessage;
|
|
315
693
|
};
|
|
316
694
|
/**
|
|
317
695
|
* String schema type.
|
|
318
696
|
*/
|
|
319
697
|
export type StringSchema<TOutput = string> = BaseSchema<string, TOutput> & {
|
|
698
|
+
/**
|
|
699
|
+
* The schema type.
|
|
700
|
+
*/
|
|
320
701
|
type: "string";
|
|
702
|
+
/**
|
|
703
|
+
* The error message.
|
|
704
|
+
*/
|
|
705
|
+
message: ErrorMessage;
|
|
706
|
+
/**
|
|
707
|
+
* The validation and transformation pipeline.
|
|
708
|
+
*/
|
|
709
|
+
pipe: Pipe<string> | undefined;
|
|
321
710
|
};
|
|
322
711
|
/**
|
|
323
712
|
* String schema async type.
|
|
324
713
|
*/
|
|
325
714
|
export type StringSchemaAsync<TOutput = string> = BaseSchemaAsync<string, TOutput> & {
|
|
715
|
+
/**
|
|
716
|
+
* The schema type.
|
|
717
|
+
*/
|
|
326
718
|
type: "string";
|
|
719
|
+
/**
|
|
720
|
+
* The error message.
|
|
721
|
+
*/
|
|
722
|
+
message: ErrorMessage;
|
|
723
|
+
/**
|
|
724
|
+
* The validation and transformation pipeline.
|
|
725
|
+
*/
|
|
726
|
+
pipe: PipeAsync<string> | undefined;
|
|
327
727
|
};
|
|
328
728
|
/**
|
|
329
729
|
* Union options type.
|
|
@@ -337,8 +737,18 @@ export type UnionOptions = [
|
|
|
337
737
|
* Union schema type.
|
|
338
738
|
*/
|
|
339
739
|
export type UnionSchema<TOptions extends UnionOptions, TOutput = Output<TOptions[number]>> = BaseSchema<Input<TOptions[number]>, TOutput> & {
|
|
740
|
+
/**
|
|
741
|
+
* The schema type.
|
|
742
|
+
*/
|
|
340
743
|
type: "union";
|
|
744
|
+
/**
|
|
745
|
+
* The union options.
|
|
746
|
+
*/
|
|
341
747
|
options: TOptions;
|
|
748
|
+
/**
|
|
749
|
+
* The error message.
|
|
750
|
+
*/
|
|
751
|
+
message: ErrorMessage;
|
|
342
752
|
};
|
|
343
753
|
/**
|
|
344
754
|
* Union options async type.
|
|
@@ -352,8 +762,18 @@ export type UnionOptionsAsync = [
|
|
|
352
762
|
* Union schema async type.
|
|
353
763
|
*/
|
|
354
764
|
export type UnionSchemaAsync<TOptions extends UnionOptionsAsync, TOutput = Output<TOptions[number]>> = BaseSchemaAsync<Input<TOptions[number]>, TOutput> & {
|
|
765
|
+
/**
|
|
766
|
+
* The schema type.
|
|
767
|
+
*/
|
|
355
768
|
type: "union";
|
|
769
|
+
/**
|
|
770
|
+
* The union options.
|
|
771
|
+
*/
|
|
356
772
|
options: TOptions;
|
|
773
|
+
/**
|
|
774
|
+
* The error message.
|
|
775
|
+
*/
|
|
776
|
+
message: ErrorMessage;
|
|
357
777
|
};
|
|
358
778
|
/**
|
|
359
779
|
* Record key type.
|
|
@@ -364,14 +784,14 @@ export type RecordKeyAsync = EnumSchema<any, string | number | symbol> | EnumSch
|
|
|
364
784
|
*/
|
|
365
785
|
export type RecordPathItem = {
|
|
366
786
|
type: "record";
|
|
367
|
-
input: Record<string | number | symbol,
|
|
787
|
+
input: Record<string | number | symbol, unknown>;
|
|
368
788
|
key: string | number | symbol;
|
|
369
|
-
value:
|
|
789
|
+
value: unknown;
|
|
370
790
|
};
|
|
371
791
|
/**
|
|
372
792
|
* Partial key schema type.
|
|
373
793
|
*/
|
|
374
|
-
export type PartialKeySchema = PicklistSchema<any> | PicklistSchemaAsync<any> | EnumSchema<any> | EnumSchemaAsync<any> | UnionSchema<any>;
|
|
794
|
+
export type PartialKeySchema = PicklistSchema<any> | PicklistSchemaAsync<any> | EnumSchema<any> | EnumSchemaAsync<any> | UnionSchema<any> | UnionSchemaAsync<any>;
|
|
375
795
|
/**
|
|
376
796
|
* Record input inference type.
|
|
377
797
|
*/
|
|
@@ -388,18 +808,35 @@ export type RecordKey = EnumSchema<any, string | number | symbol> | PicklistSche
|
|
|
388
808
|
* Record schema type.
|
|
389
809
|
*/
|
|
390
810
|
export type RecordSchema<TKey extends RecordKey, TValue extends BaseSchema, TOutput = RecordOutput<TKey, TValue>> = BaseSchema<RecordInput<TKey, TValue>, TOutput> & {
|
|
811
|
+
/**
|
|
812
|
+
* The schema type.
|
|
813
|
+
*/
|
|
391
814
|
type: "record";
|
|
815
|
+
/**
|
|
816
|
+
* The record key schema.
|
|
817
|
+
*/
|
|
392
818
|
key: TKey;
|
|
819
|
+
/**
|
|
820
|
+
* The record value schema.
|
|
821
|
+
*/
|
|
393
822
|
value: TValue;
|
|
823
|
+
/**
|
|
824
|
+
* The error message.
|
|
825
|
+
*/
|
|
826
|
+
message: ErrorMessage;
|
|
827
|
+
/**
|
|
828
|
+
* The validation and transformation pipeline.
|
|
829
|
+
*/
|
|
830
|
+
pipe: Pipe<RecordOutput<TKey, TValue>> | undefined;
|
|
394
831
|
};
|
|
395
832
|
/**
|
|
396
833
|
* Set path item type.
|
|
397
834
|
*/
|
|
398
835
|
export type SetPathItem = {
|
|
399
836
|
type: "set";
|
|
400
|
-
input: Set<
|
|
837
|
+
input: Set<unknown>;
|
|
401
838
|
key: number;
|
|
402
|
-
value:
|
|
839
|
+
value: unknown;
|
|
403
840
|
};
|
|
404
841
|
/**
|
|
405
842
|
* Tuple path item type.
|
|
@@ -407,17 +844,24 @@ export type SetPathItem = {
|
|
|
407
844
|
export type TuplePathItem = {
|
|
408
845
|
type: "tuple";
|
|
409
846
|
input: [
|
|
410
|
-
|
|
411
|
-
...
|
|
847
|
+
unknown,
|
|
848
|
+
...unknown[]
|
|
412
849
|
];
|
|
413
850
|
key: number;
|
|
414
|
-
value:
|
|
851
|
+
value: unknown;
|
|
415
852
|
};
|
|
416
853
|
/**
|
|
417
854
|
* Unknown schema type.
|
|
418
855
|
*/
|
|
419
856
|
export type UnknownSchema<TOutput = unknown> = BaseSchema<unknown, TOutput> & {
|
|
857
|
+
/**
|
|
858
|
+
* The schema type.
|
|
859
|
+
*/
|
|
420
860
|
type: "unknown";
|
|
861
|
+
/**
|
|
862
|
+
* The validation and transformation pipeline.
|
|
863
|
+
*/
|
|
864
|
+
pipe: Pipe<unknown> | undefined;
|
|
421
865
|
};
|
|
422
866
|
export type ButtonList = {
|
|
423
867
|
left: ButtonPartLeft;
|