ccusage 0.3.1 → 0.3.2

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.
@@ -0,0 +1,1467 @@
1
+ //#region node_modules/valibot/dist/index.d.ts
2
+
3
+ /**
4
+ * Fallback type.
5
+ */
6
+ type Fallback<TSchema extends BaseSchema<unknown, unknown, BaseIssue<unknown>>> = MaybeReadonly<InferOutput<TSchema>> | ((dataset?: OutputDataset<InferOutput<TSchema>, InferIssue<TSchema>>, config?: Config<InferIssue<TSchema>>) => MaybeReadonly<InferOutput<TSchema>>);
7
+ /**
8
+ * Schema with fallback type.
9
+ */
10
+ type SchemaWithFallback<TSchema extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, TFallback extends Fallback<TSchema>> = TSchema & {
11
+ /**
12
+ * The fallback value.
13
+ */
14
+ readonly fallback: TFallback;
15
+ };
16
+ /**
17
+ * Returns a fallback value as output if the input does not match the schema.
18
+ *
19
+ * @param schema The schema to catch.
20
+ * @param fallback The fallback value.
21
+ *
22
+ * @returns The passed schema.
23
+ */
24
+
25
+ /**
26
+ * Fallback async type.
27
+ */
28
+ type FallbackAsync<TSchema extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>> = MaybeReadonly<InferOutput<TSchema>> | ((dataset?: OutputDataset<InferOutput<TSchema>, InferIssue<TSchema>>, config?: Config<InferIssue<TSchema>>) => MaybePromise<MaybeReadonly<InferOutput<TSchema>>>);
29
+ /**
30
+ * Schema with fallback async type.
31
+ */
32
+ type SchemaWithFallbackAsync<TSchema extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TFallback extends FallbackAsync<TSchema>> = Omit<TSchema, 'async' | '~standard' | '~run'> & {
33
+ /**
34
+ * The fallback value.
35
+ */
36
+ readonly fallback: TFallback;
37
+ /**
38
+ * Whether it's async.
39
+ */
40
+ readonly async: true;
41
+ /**
42
+ * The Standard Schema properties.
43
+ *
44
+ * @internal
45
+ */
46
+ readonly '~standard': StandardProps<InferInput<TSchema>, InferOutput<TSchema>>;
47
+ /**
48
+ * Parses unknown input values.
49
+ *
50
+ * @param dataset The input dataset.
51
+ * @param config The configuration.
52
+ *
53
+ * @returns The output dataset.
54
+ *
55
+ * @internal
56
+ */
57
+ readonly '~run': (dataset: UnknownDataset, config: Config<BaseIssue<unknown>>) => Promise<OutputDataset<InferOutput<TSchema>, InferIssue<TSchema>>>;
58
+ };
59
+ /**
60
+ * Returns a fallback value as output if the input does not match the schema.
61
+ *
62
+ * @param schema The schema to catch.
63
+ * @param fallback The fallback value.
64
+ *
65
+ * @returns The passed schema.
66
+ */
67
+
68
+ /**
69
+ * Schema with pipe type.
70
+ */
71
+ type SchemaWithPipe<TPipe extends readonly [BaseSchema<unknown, unknown, BaseIssue<unknown>>, ...PipeItem<any, unknown, BaseIssue<unknown>>[]]> = Omit<FirstTupleItem<TPipe>, 'pipe' | '~standard' | '~run' | '~types'> & {
72
+ /**
73
+ * The pipe items.
74
+ */
75
+ readonly pipe: TPipe;
76
+ /**
77
+ * The Standard Schema properties.
78
+ *
79
+ * @internal
80
+ */
81
+ readonly '~standard': StandardProps<InferInput<FirstTupleItem<TPipe>>, InferOutput<LastTupleItem<TPipe>>>;
82
+ /**
83
+ * Parses unknown input values.
84
+ *
85
+ * @param dataset The input dataset.
86
+ * @param config The configuration.
87
+ *
88
+ * @returns The output dataset.
89
+ *
90
+ * @internal
91
+ */
92
+ readonly '~run': (dataset: UnknownDataset, config: Config<BaseIssue<unknown>>) => OutputDataset<InferOutput<LastTupleItem<TPipe>>, InferIssue<TPipe[number]>>;
93
+ /**
94
+ * The input, output and issue type.
95
+ *
96
+ * @internal
97
+ */
98
+ readonly '~types'?: {
99
+ readonly input: InferInput<FirstTupleItem<TPipe>>;
100
+ readonly output: InferOutput<LastTupleItem<TPipe>>;
101
+ readonly issue: InferIssue<TPipe[number]>;
102
+ } | undefined;
103
+ };
104
+ /**
105
+ * Adds a pipeline to a schema, that can validate and transform its input.
106
+ *
107
+ * @param schema The root schema.
108
+ * @param item1 The first pipe item.
109
+ *
110
+ * @returns A schema with a pipeline.
111
+ */
112
+
113
+ /**
114
+ * Schema with pipe async type.
115
+ */
116
+ type SchemaWithPipeAsync<TPipe extends readonly [(BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>), ...(PipeItem<any, unknown, BaseIssue<unknown>> | PipeItemAsync<any, unknown, BaseIssue<unknown>>)[]]> = Omit<FirstTupleItem<TPipe>, 'async' | 'pipe' | '~standard' | '~run' | '~types'> & {
117
+ /**
118
+ * The pipe items.
119
+ */
120
+ readonly pipe: TPipe;
121
+ /**
122
+ * Whether it's async.
123
+ */
124
+ readonly async: true;
125
+ /**
126
+ * The Standard Schema properties.
127
+ *
128
+ * @internal
129
+ */
130
+ readonly '~standard': StandardProps<InferInput<FirstTupleItem<TPipe>>, InferOutput<LastTupleItem<TPipe>>>;
131
+ /**
132
+ * Parses unknown input values.
133
+ *
134
+ * @param dataset The input dataset.
135
+ * @param config The configuration.
136
+ *
137
+ * @returns The output dataset.
138
+ *
139
+ * @internal
140
+ */
141
+ readonly '~run': (dataset: UnknownDataset, config: Config<BaseIssue<unknown>>) => Promise<OutputDataset<InferOutput<LastTupleItem<TPipe>>, InferIssue<TPipe[number]>>>;
142
+ /**
143
+ * The input, output and issue type.
144
+ *
145
+ * @internal
146
+ */
147
+ readonly '~types'?: {
148
+ readonly input: InferInput<FirstTupleItem<TPipe>>;
149
+ readonly output: InferOutput<LastTupleItem<TPipe>>;
150
+ readonly issue: InferIssue<TPipe[number]>;
151
+ } | undefined;
152
+ };
153
+ /**
154
+ * Adds a pipeline to a schema, that can validate and transform its input.
155
+ *
156
+ * @param schema The root schema.
157
+ * @param item1 The first pipe item.
158
+ *
159
+ * @returns A schema with a pipeline.
160
+ */
161
+
162
+ /**
163
+ * Base metadata interface.
164
+ */
165
+ interface BaseMetadata<TInput> {
166
+ /**
167
+ * The object kind.
168
+ */
169
+ readonly kind: 'metadata';
170
+ /**
171
+ * The metadata type.
172
+ */
173
+ readonly type: string;
174
+ /**
175
+ * The metadata reference.
176
+ */
177
+ readonly reference: (...args: any[]) => BaseMetadata<any>;
178
+ /**
179
+ * The input, output and issue type.
180
+ *
181
+ * @internal
182
+ */
183
+ readonly '~types'?: {
184
+ readonly input: TInput;
185
+ readonly output: TInput;
186
+ readonly issue: never;
187
+ } | undefined;
188
+ }
189
+ /**
190
+ * Generic metadata type.
191
+ */
192
+
193
+ /**
194
+ * Unknown dataset interface.
195
+ */
196
+ interface UnknownDataset {
197
+ /**
198
+ * Whether is's typed.
199
+ */
200
+ typed?: false;
201
+ /**
202
+ * The dataset value.
203
+ */
204
+ value: unknown;
205
+ /**
206
+ * The dataset issues.
207
+ */
208
+ issues?: undefined;
209
+ }
210
+ /**
211
+ * Success dataset interface.
212
+ */
213
+ interface SuccessDataset<TValue> {
214
+ /**
215
+ * Whether is's typed.
216
+ */
217
+ typed: true;
218
+ /**
219
+ * The dataset value.
220
+ */
221
+ value: TValue;
222
+ /**
223
+ * The dataset issues.
224
+ */
225
+ issues?: undefined;
226
+ }
227
+ /**
228
+ * Partial dataset interface.
229
+ */
230
+ interface PartialDataset<TValue, TIssue extends BaseIssue<unknown>> {
231
+ /**
232
+ * Whether is's typed.
233
+ */
234
+ typed: true;
235
+ /**
236
+ * The dataset value.
237
+ */
238
+ value: TValue;
239
+ /**
240
+ * The dataset issues.
241
+ */
242
+ issues: [TIssue, ...TIssue[]];
243
+ }
244
+ /**
245
+ * Failure dataset interface.
246
+ */
247
+ interface FailureDataset<TIssue extends BaseIssue<unknown>> {
248
+ /**
249
+ * Whether is's typed.
250
+ */
251
+ typed: false;
252
+ /**
253
+ * The dataset value.
254
+ */
255
+ value: unknown;
256
+ /**
257
+ * The dataset issues.
258
+ */
259
+ issues: [TIssue, ...TIssue[]];
260
+ }
261
+ /**
262
+ * Output dataset type.
263
+ */
264
+ type OutputDataset<TValue, TIssue extends BaseIssue<unknown>> = SuccessDataset<TValue> | PartialDataset<TValue, TIssue> | FailureDataset<TIssue>;
265
+
266
+ /**
267
+ * The Standard Schema properties interface.
268
+ */
269
+ interface StandardProps<TInput, TOutput> {
270
+ /**
271
+ * The version number of the standard.
272
+ */
273
+ readonly version: 1;
274
+ /**
275
+ * The vendor name of the schema library.
276
+ */
277
+ readonly vendor: 'valibot';
278
+ /**
279
+ * Validates unknown input values.
280
+ */
281
+ readonly validate: (value: unknown) => StandardResult<TOutput> | Promise<StandardResult<TOutput>>;
282
+ /**
283
+ * Inferred types associated with the schema.
284
+ */
285
+ readonly types?: StandardTypes<TInput, TOutput> | undefined;
286
+ }
287
+ /**
288
+ * The result interface of the validate function.
289
+ */
290
+ type StandardResult<TOutput> = StandardSuccessResult<TOutput> | StandardFailureResult;
291
+ /**
292
+ * The result interface if validation succeeds.
293
+ */
294
+ interface StandardSuccessResult<TOutput> {
295
+ /**
296
+ * The typed output value.
297
+ */
298
+ readonly value: TOutput;
299
+ /**
300
+ * The non-existent issues.
301
+ */
302
+ readonly issues?: undefined;
303
+ }
304
+ /**
305
+ * The result interface if validation fails.
306
+ */
307
+ interface StandardFailureResult {
308
+ /**
309
+ * The issues of failed validation.
310
+ */
311
+ readonly issues: readonly StandardIssue[];
312
+ }
313
+ /**
314
+ * The issue interface of the failure output.
315
+ */
316
+ interface StandardIssue {
317
+ /**
318
+ * The error message of the issue.
319
+ */
320
+ readonly message: string;
321
+ /**
322
+ * The path of the issue, if any.
323
+ */
324
+ readonly path?: readonly (PropertyKey | StandardPathItem)[] | undefined;
325
+ }
326
+ /**
327
+ * The path item interface of the issue.
328
+ */
329
+ interface StandardPathItem {
330
+ /**
331
+ * The key of the path item.
332
+ */
333
+ readonly key: PropertyKey;
334
+ }
335
+ /**
336
+ * The Standard Schema types interface.
337
+ */
338
+ interface StandardTypes<TInput, TOutput> {
339
+ /**
340
+ * The input type of the schema.
341
+ */
342
+ readonly input: TInput;
343
+ /**
344
+ * The output type of the schema.
345
+ */
346
+ readonly output: TOutput;
347
+ }
348
+
349
+ /**
350
+ * Base schema interface.
351
+ */
352
+ interface BaseSchema<TInput, TOutput, TIssue extends BaseIssue<unknown>> {
353
+ /**
354
+ * The object kind.
355
+ */
356
+ readonly kind: 'schema';
357
+ /**
358
+ * The schema type.
359
+ */
360
+ readonly type: string;
361
+ /**
362
+ * The schema reference.
363
+ */
364
+ readonly reference: (...args: any[]) => BaseSchema<unknown, unknown, BaseIssue<unknown>>;
365
+ /**
366
+ * The expected property.
367
+ */
368
+ readonly expects: string;
369
+ /**
370
+ * Whether it's async.
371
+ */
372
+ readonly async: false;
373
+ /**
374
+ * The Standard Schema properties.
375
+ *
376
+ * @internal
377
+ */
378
+ readonly '~standard': StandardProps<TInput, TOutput>;
379
+ /**
380
+ * Parses unknown input values.
381
+ *
382
+ * @param dataset The input dataset.
383
+ * @param config The configuration.
384
+ *
385
+ * @returns The output dataset.
386
+ *
387
+ * @internal
388
+ */
389
+ readonly '~run': (dataset: UnknownDataset, config: Config<BaseIssue<unknown>>) => OutputDataset<TOutput, TIssue>;
390
+ /**
391
+ * The input, output and issue type.
392
+ *
393
+ * @internal
394
+ */
395
+ readonly '~types'?: {
396
+ readonly input: TInput;
397
+ readonly output: TOutput;
398
+ readonly issue: TIssue;
399
+ } | undefined;
400
+ }
401
+ /**
402
+ * Base schema async interface.
403
+ */
404
+ interface BaseSchemaAsync<TInput, TOutput, TIssue extends BaseIssue<unknown>> extends Omit<BaseSchema<TInput, TOutput, TIssue>, 'reference' | 'async' | '~run'> {
405
+ /**
406
+ * The schema reference.
407
+ */
408
+ readonly reference: (...args: any[]) => BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>;
409
+ /**
410
+ * Whether it's async.
411
+ */
412
+ readonly async: true;
413
+ /**
414
+ * Parses unknown input values.
415
+ *
416
+ * @param dataset The input dataset.
417
+ * @param config The configuration.
418
+ *
419
+ * @returns The output dataset.
420
+ *
421
+ * @internal
422
+ */
423
+ readonly '~run': (dataset: UnknownDataset, config: Config<BaseIssue<unknown>>) => Promise<OutputDataset<TOutput, TIssue>>;
424
+ }
425
+ /**
426
+ * Generic schema type.
427
+ */
428
+
429
+ /**
430
+ * Base transformation interface.
431
+ */
432
+ interface BaseTransformation<TInput, TOutput, TIssue extends BaseIssue<unknown>> {
433
+ /**
434
+ * The object kind.
435
+ */
436
+ readonly kind: 'transformation';
437
+ /**
438
+ * The transformation type.
439
+ */
440
+ readonly type: string;
441
+ /**
442
+ * The transformation reference.
443
+ */
444
+ readonly reference: (...args: any[]) => BaseTransformation<any, any, BaseIssue<unknown>>;
445
+ /**
446
+ * Whether it's async.
447
+ */
448
+ readonly async: false;
449
+ /**
450
+ * Transforms known input values.
451
+ *
452
+ * @param dataset The input dataset.
453
+ * @param config The configuration.
454
+ *
455
+ * @returns The output dataset.
456
+ *
457
+ * @internal
458
+ */
459
+ readonly '~run': (dataset: SuccessDataset<TInput>, config: Config<BaseIssue<unknown>>) => OutputDataset<TOutput, BaseIssue<unknown> | TIssue>;
460
+ /**
461
+ * The input, output and issue type.
462
+ *
463
+ * @internal
464
+ */
465
+ readonly '~types'?: {
466
+ readonly input: TInput;
467
+ readonly output: TOutput;
468
+ readonly issue: TIssue;
469
+ } | undefined;
470
+ }
471
+ /**
472
+ * Base transformation async interface.
473
+ */
474
+ interface BaseTransformationAsync<TInput, TOutput, TIssue extends BaseIssue<unknown>> extends Omit<BaseTransformation<TInput, TOutput, TIssue>, 'reference' | 'async' | '~run'> {
475
+ /**
476
+ * The transformation reference.
477
+ */
478
+ readonly reference: (...args: any[]) => BaseTransformation<any, any, BaseIssue<unknown>> | BaseTransformationAsync<any, any, BaseIssue<unknown>>;
479
+ /**
480
+ * Whether it's async.
481
+ */
482
+ readonly async: true;
483
+ /**
484
+ * Transforms known input values.
485
+ *
486
+ * @param dataset The input dataset.
487
+ * @param config The configuration.
488
+ *
489
+ * @returns The output dataset.
490
+ *
491
+ * @internal
492
+ */
493
+ readonly '~run': (dataset: SuccessDataset<TInput>, config: Config<BaseIssue<unknown>>) => Promise<OutputDataset<TOutput, BaseIssue<unknown> | TIssue>>;
494
+ }
495
+ /**
496
+ * Generic transformation type.
497
+ */
498
+
499
+ /**
500
+ * Base validation interface.
501
+ */
502
+ interface BaseValidation<TInput, TOutput, TIssue extends BaseIssue<unknown>> {
503
+ /**
504
+ * The object kind.
505
+ */
506
+ readonly kind: 'validation';
507
+ /**
508
+ * The validation type.
509
+ */
510
+ readonly type: string;
511
+ /**
512
+ * The validation reference.
513
+ */
514
+ readonly reference: (...args: any[]) => BaseValidation<any, any, BaseIssue<unknown>>;
515
+ /**
516
+ * The expected property.
517
+ */
518
+ readonly expects: string | null;
519
+ /**
520
+ * Whether it's async.
521
+ */
522
+ readonly async: false;
523
+ /**
524
+ * Validates known input values.
525
+ *
526
+ * @param dataset The input dataset.
527
+ * @param config The configuration.
528
+ *
529
+ * @returns The output dataset.
530
+ *
531
+ * @internal
532
+ */
533
+ readonly '~run': (dataset: OutputDataset<TInput, BaseIssue<unknown>>, config: Config<BaseIssue<unknown>>) => OutputDataset<TOutput, BaseIssue<unknown> | TIssue>;
534
+ /**
535
+ * The input, output and issue type.
536
+ *
537
+ * @internal
538
+ */
539
+ readonly '~types'?: {
540
+ readonly input: TInput;
541
+ readonly output: TOutput;
542
+ readonly issue: TIssue;
543
+ } | undefined;
544
+ }
545
+ /**
546
+ * Base validation async interface.
547
+ */
548
+ interface BaseValidationAsync<TInput, TOutput, TIssue extends BaseIssue<unknown>> extends Omit<BaseValidation<TInput, TOutput, TIssue>, 'reference' | 'async' | '~run'> {
549
+ /**
550
+ * The validation reference.
551
+ */
552
+ readonly reference: (...args: any[]) => BaseValidation<any, any, BaseIssue<unknown>> | BaseValidationAsync<any, any, BaseIssue<unknown>>;
553
+ /**
554
+ * Whether it's async.
555
+ */
556
+ readonly async: true;
557
+ /**
558
+ * Validates known input values.
559
+ *
560
+ * @param dataset The input dataset.
561
+ * @param config The configuration.
562
+ *
563
+ * @returns The output dataset.
564
+ *
565
+ * @internal
566
+ */
567
+ readonly '~run': (dataset: OutputDataset<TInput, BaseIssue<unknown>>, config: Config<BaseIssue<unknown>>) => Promise<OutputDataset<TOutput, BaseIssue<unknown> | TIssue>>;
568
+ }
569
+ /**
570
+ * Generic validation type.
571
+ */
572
+
573
+ /**
574
+ * Infer input type.
575
+ */
576
+ type InferInput<TItem extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>> | BaseValidation<any, unknown, BaseIssue<unknown>> | BaseValidationAsync<any, unknown, BaseIssue<unknown>> | BaseTransformation<any, unknown, BaseIssue<unknown>> | BaseTransformationAsync<any, unknown, BaseIssue<unknown>> | BaseMetadata<any>> = NonNullable<TItem['~types']>['input'];
577
+ /**
578
+ * Infer output type.
579
+ */
580
+ type InferOutput<TItem extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>> | BaseValidation<any, unknown, BaseIssue<unknown>> | BaseValidationAsync<any, unknown, BaseIssue<unknown>> | BaseTransformation<any, unknown, BaseIssue<unknown>> | BaseTransformationAsync<any, unknown, BaseIssue<unknown>> | BaseMetadata<any>> = NonNullable<TItem['~types']>['output'];
581
+ /**
582
+ * Infer issue type.
583
+ */
584
+ type InferIssue<TItem extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>> | BaseValidation<any, unknown, BaseIssue<unknown>> | BaseValidationAsync<any, unknown, BaseIssue<unknown>> | BaseTransformation<any, unknown, BaseIssue<unknown>> | BaseTransformationAsync<any, unknown, BaseIssue<unknown>> | BaseMetadata<any>> = NonNullable<TItem['~types']>['issue'];
585
+
586
+ /**
587
+ * Checks if a type is `any`.
588
+ */
589
+
590
+ /**
591
+ * Constructs a type that is maybe readonly.
592
+ */
593
+ type MaybeReadonly<TValue> = TValue | Readonly<TValue>;
594
+ /**
595
+ * Constructs a type that is maybe a promise.
596
+ */
597
+ type MaybePromise<TValue> = TValue | Promise<TValue>;
598
+ /**
599
+ * Prettifies a type for better readability.
600
+ *
601
+ * Hint: This type has no effect and is only used so that TypeScript displays
602
+ * the final type in the preview instead of the utility types used.
603
+ */
604
+ type Prettify<TObject> = { [TKey in keyof TObject]: TObject[TKey] } & {};
605
+ /**
606
+ * Marks specific keys as optional.
607
+ */
608
+ type MarkOptional<TObject, TKeys extends keyof TObject> = { [TKey in keyof TObject]?: unknown } & Omit<TObject, TKeys> & Partial<Pick<TObject, TKeys>>;
609
+ /**
610
+ * Merges two objects. Overlapping entries from the second object overwrite
611
+ * properties from the first object.
612
+ */
613
+
614
+ /**
615
+ * Extracts first tuple item.
616
+ */
617
+ type FirstTupleItem<TTuple extends readonly [unknown, ...unknown[]]> = TTuple[0];
618
+ /**
619
+ * Extracts last tuple item.
620
+ */
621
+ type LastTupleItem<TTuple extends readonly [unknown, ...unknown[]]> = TTuple[TTuple extends readonly [unknown, ...infer TRest] ? TRest['length'] : never];
622
+ /**
623
+ * Converts union to intersection type.
624
+ */
625
+
626
+ /**
627
+ * Error message type.
628
+ */
629
+ type ErrorMessage<TIssue extends BaseIssue<unknown>> = ((issue: TIssue) => string) | string;
630
+ /**
631
+ * Default type.
632
+ */
633
+ type Default<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, TInput extends null | undefined> = MaybeReadonly<InferInput<TWrapped> | TInput> | ((dataset?: UnknownDataset, config?: Config<InferIssue<TWrapped>>) => MaybeReadonly<InferInput<TWrapped> | TInput>) | undefined;
634
+ /**
635
+ * Default async type.
636
+ */
637
+ type DefaultAsync<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TInput extends null | undefined> = MaybeReadonly<InferInput<TWrapped> | TInput> | ((dataset?: UnknownDataset, config?: Config<InferIssue<TWrapped>>) => MaybePromise<MaybeReadonly<InferInput<TWrapped> | TInput>>) | undefined;
638
+ /**
639
+ * Default value type.
640
+ */
641
+ type DefaultValue<TDefault extends Default<BaseSchema<unknown, unknown, BaseIssue<unknown>>, null | undefined> | DefaultAsync<BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, null | undefined>> = TDefault extends DefaultAsync<infer TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, infer TInput> ? TDefault extends ((dataset?: UnknownDataset, config?: Config<InferIssue<TWrapped>>) => MaybePromise<InferInput<TWrapped> | TInput>) ? Awaited<ReturnType<TDefault>> : TDefault : never;
642
+
643
+ /**
644
+ * Optional entry schema type.
645
+ */
646
+ type OptionalEntrySchema = ExactOptionalSchema<BaseSchema<unknown, unknown, BaseIssue<unknown>>, unknown> | NullishSchema<BaseSchema<unknown, unknown, BaseIssue<unknown>>, unknown> | OptionalSchema<BaseSchema<unknown, unknown, BaseIssue<unknown>>, unknown>;
647
+ /**
648
+ * Optional entry schema async type.
649
+ */
650
+ type OptionalEntrySchemaAsync = ExactOptionalSchemaAsync<BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, unknown> | NullishSchemaAsync<BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, unknown> | OptionalSchemaAsync<BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, unknown>;
651
+ /**
652
+ * Object entries interface.
653
+ */
654
+ interface ObjectEntries {
655
+ [key: string]: BaseSchema<unknown, unknown, BaseIssue<unknown>> | SchemaWithFallback<BaseSchema<unknown, unknown, BaseIssue<unknown>>, unknown> | OptionalEntrySchema;
656
+ }
657
+ /**
658
+ * Object entries async interface.
659
+ */
660
+ interface ObjectEntriesAsync {
661
+ [key: string]: BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>> | SchemaWithFallback<BaseSchema<unknown, unknown, BaseIssue<unknown>>, unknown> | SchemaWithFallbackAsync<BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, unknown> | OptionalEntrySchema | OptionalEntrySchemaAsync;
662
+ }
663
+ /**
664
+ * Object keys type.
665
+ */
666
+
667
+ /**
668
+ * Infer entries input type.
669
+ */
670
+ type InferEntriesInput<TEntries extends ObjectEntries | ObjectEntriesAsync> = { -readonly [TKey in keyof TEntries]: InferInput<TEntries[TKey]> };
671
+ /**
672
+ * Infer entries output type.
673
+ */
674
+ type InferEntriesOutput<TEntries extends ObjectEntries | ObjectEntriesAsync> = { -readonly [TKey in keyof TEntries]: InferOutput<TEntries[TKey]> };
675
+ /**
676
+ * Optional input keys type.
677
+ */
678
+ type OptionalInputKeys<TEntries extends ObjectEntries | ObjectEntriesAsync> = { [TKey in keyof TEntries]: TEntries[TKey] extends OptionalEntrySchema | OptionalEntrySchemaAsync ? TKey : never }[keyof TEntries];
679
+ /**
680
+ * Optional output keys type.
681
+ */
682
+ type OptionalOutputKeys<TEntries extends ObjectEntries | ObjectEntriesAsync> = { [TKey in keyof TEntries]: TEntries[TKey] extends OptionalEntrySchema | OptionalEntrySchemaAsync ? undefined extends TEntries[TKey]['default'] ? TKey : never : never }[keyof TEntries];
683
+ /**
684
+ * Input with question marks type.
685
+ */
686
+ type InputWithQuestionMarks<TEntries extends ObjectEntries | ObjectEntriesAsync, TObject extends InferEntriesInput<TEntries>> = MarkOptional<TObject, OptionalInputKeys<TEntries>>;
687
+ /**
688
+ * Output with question marks type.
689
+ */
690
+ type OutputWithQuestionMarks<TEntries extends ObjectEntries | ObjectEntriesAsync, TObject extends InferEntriesOutput<TEntries>> = MarkOptional<TObject, OptionalOutputKeys<TEntries>>;
691
+ /**
692
+ * Readonly output keys type.
693
+ */
694
+ type ReadonlyOutputKeys<TEntries extends ObjectEntries | ObjectEntriesAsync> = { [TKey in keyof TEntries]: TEntries[TKey] extends SchemaWithPipe<infer TPipe> | SchemaWithPipeAsync<infer TPipe> ? ReadonlyAction<any> extends TPipe[number] ? TKey : never : never }[keyof TEntries];
695
+ /**
696
+ * Output with readonly type.
697
+ */
698
+ type OutputWithReadonly<TEntries extends ObjectEntries | ObjectEntriesAsync, TObject extends OutputWithQuestionMarks<TEntries, InferEntriesOutput<TEntries>>> = Readonly<TObject> & Pick<TObject, Exclude<keyof TObject, ReadonlyOutputKeys<TEntries>>>;
699
+ /**
700
+ * Infer object input type.
701
+ */
702
+ type InferObjectInput<TEntries extends ObjectEntries | ObjectEntriesAsync> = Prettify<InputWithQuestionMarks<TEntries, InferEntriesInput<TEntries>>>;
703
+ /**
704
+ * Infer object output type.
705
+ */
706
+ type InferObjectOutput<TEntries extends ObjectEntries | ObjectEntriesAsync> = Prettify<OutputWithReadonly<TEntries, OutputWithQuestionMarks<TEntries, InferEntriesOutput<TEntries>>>>;
707
+ /**
708
+ * Infer object issue type.
709
+ */
710
+ type InferObjectIssue<TEntries extends ObjectEntries | ObjectEntriesAsync> = InferIssue<TEntries[keyof TEntries]>;
711
+
712
+ /**
713
+ * Tuple items type.
714
+ */
715
+
716
+ /**
717
+ * Array path item interface.
718
+ */
719
+ interface ArrayPathItem {
720
+ /**
721
+ * The path item type.
722
+ */
723
+ readonly type: 'array';
724
+ /**
725
+ * The path item origin.
726
+ */
727
+ readonly origin: 'value';
728
+ /**
729
+ * The path item input.
730
+ */
731
+ readonly input: MaybeReadonly<unknown[]>;
732
+ /**
733
+ * The path item key.
734
+ */
735
+ readonly key: number;
736
+ /**
737
+ * The path item value.
738
+ */
739
+ readonly value: unknown;
740
+ }
741
+ /**
742
+ * Map path item interface.
743
+ */
744
+ interface MapPathItem {
745
+ /**
746
+ * The path item type.
747
+ */
748
+ readonly type: 'map';
749
+ /**
750
+ * The path item origin.
751
+ */
752
+ readonly origin: 'key' | 'value';
753
+ /**
754
+ * The path item input.
755
+ */
756
+ readonly input: Map<unknown, unknown>;
757
+ /**
758
+ * The path item key.
759
+ */
760
+ readonly key: unknown;
761
+ /**
762
+ * The path item value.
763
+ */
764
+ readonly value: unknown;
765
+ }
766
+ /**
767
+ * Object path item interface.
768
+ */
769
+ interface ObjectPathItem {
770
+ /**
771
+ * The path item type.
772
+ */
773
+ readonly type: 'object';
774
+ /**
775
+ * The path item origin.
776
+ */
777
+ readonly origin: 'key' | 'value';
778
+ /**
779
+ * The path item input.
780
+ */
781
+ readonly input: Record<string, unknown>;
782
+ /**
783
+ * The path item key.
784
+ */
785
+ readonly key: string;
786
+ /**
787
+ * The path item value.
788
+ */
789
+ readonly value: unknown;
790
+ }
791
+ /**
792
+ * Set path item interface.
793
+ */
794
+ interface SetPathItem {
795
+ /**
796
+ * The path item type.
797
+ */
798
+ readonly type: 'set';
799
+ /**
800
+ * The path item origin.
801
+ */
802
+ readonly origin: 'value';
803
+ /**
804
+ * The path item input.
805
+ */
806
+ readonly input: Set<unknown>;
807
+ /**
808
+ * The path item key.
809
+ */
810
+ readonly key: null;
811
+ /**
812
+ * The path item key.
813
+ */
814
+ readonly value: unknown;
815
+ }
816
+ /**
817
+ * Unknown path item interface.
818
+ */
819
+ interface UnknownPathItem {
820
+ /**
821
+ * The path item type.
822
+ */
823
+ readonly type: 'unknown';
824
+ /**
825
+ * The path item origin.
826
+ */
827
+ readonly origin: 'key' | 'value';
828
+ /**
829
+ * The path item input.
830
+ */
831
+ readonly input: unknown;
832
+ /**
833
+ * The path item key.
834
+ */
835
+ readonly key: unknown;
836
+ /**
837
+ * The path item value.
838
+ */
839
+ readonly value: unknown;
840
+ }
841
+ /**
842
+ * Issue path item type.
843
+ */
844
+ type IssuePathItem = ArrayPathItem | MapPathItem | ObjectPathItem | SetPathItem | UnknownPathItem;
845
+ /**
846
+ * Base issue interface.
847
+ */
848
+ interface BaseIssue<TInput> extends Config<BaseIssue<TInput>> {
849
+ /**
850
+ * The issue kind.
851
+ */
852
+ readonly kind: 'schema' | 'validation' | 'transformation';
853
+ /**
854
+ * The issue type.
855
+ */
856
+ readonly type: string;
857
+ /**
858
+ * The raw input data.
859
+ */
860
+ readonly input: TInput;
861
+ /**
862
+ * The expected property.
863
+ */
864
+ readonly expected: string | null;
865
+ /**
866
+ * The received property.
867
+ */
868
+ readonly received: string;
869
+ /**
870
+ * The error message.
871
+ */
872
+ readonly message: string;
873
+ /**
874
+ * The input requirement.
875
+ */
876
+ readonly requirement?: unknown | undefined;
877
+ /**
878
+ * The issue path.
879
+ */
880
+ readonly path?: [IssuePathItem, ...IssuePathItem[]] | undefined;
881
+ /**
882
+ * The sub issues.
883
+ */
884
+ readonly issues?: [BaseIssue<TInput>, ...BaseIssue<TInput>[]] | undefined;
885
+ }
886
+ /**
887
+ * Generic issue type.
888
+ */
889
+
890
+ /**
891
+ * Config interface.
892
+ */
893
+ interface Config<TIssue extends BaseIssue<unknown>> {
894
+ /**
895
+ * The selected language.
896
+ */
897
+ readonly lang?: string | undefined;
898
+ /**
899
+ * The error message.
900
+ */
901
+ readonly message?: ErrorMessage<TIssue> | undefined;
902
+ /**
903
+ * Whether it should be aborted early.
904
+ */
905
+ readonly abortEarly?: boolean | undefined;
906
+ /**
907
+ * Whether a pipe should be aborted early.
908
+ */
909
+ readonly abortPipeEarly?: boolean | undefined;
910
+ }
911
+
912
+ /**
913
+ * Pipe action type.
914
+ */
915
+ type PipeAction<TInput, TOutput, TIssue extends BaseIssue<unknown>> = BaseValidation<TInput, TOutput, TIssue> | BaseTransformation<TInput, TOutput, TIssue> | BaseMetadata<TInput>;
916
+ /**
917
+ * Pipe action async type.
918
+ */
919
+ type PipeActionAsync<TInput, TOutput, TIssue extends BaseIssue<unknown>> = BaseValidationAsync<TInput, TOutput, TIssue> | BaseTransformationAsync<TInput, TOutput, TIssue>;
920
+ /**
921
+ * Pipe item type.
922
+ */
923
+ type PipeItem<TInput, TOutput, TIssue extends BaseIssue<unknown>> = BaseSchema<TInput, TOutput, TIssue> | PipeAction<TInput, TOutput, TIssue>;
924
+ /**
925
+ * Pipe item async type.
926
+ */
927
+ type PipeItemAsync<TInput, TOutput, TIssue extends BaseIssue<unknown>> = BaseSchemaAsync<TInput, TOutput, TIssue> | PipeActionAsync<TInput, TOutput, TIssue>;
928
+ /**
929
+ * Schema without pipe type.
930
+ */
931
+
932
+ /**
933
+ * Exact optional schema interface.
934
+ */
935
+ interface ExactOptionalSchema<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, TDefault extends Default<TWrapped, never>> extends BaseSchema<InferInput<TWrapped>, InferOutput<TWrapped>, InferIssue<TWrapped>> {
936
+ /**
937
+ * The schema type.
938
+ */
939
+ readonly type: 'exact_optional';
940
+ /**
941
+ * The schema reference.
942
+ */
943
+ readonly reference: typeof exactOptional;
944
+ /**
945
+ * The expected property.
946
+ */
947
+ readonly expects: TWrapped['expects'];
948
+ /**
949
+ * The wrapped schema.
950
+ */
951
+ readonly wrapped: TWrapped;
952
+ /**
953
+ * The default value.
954
+ */
955
+ readonly default: TDefault;
956
+ }
957
+ /**
958
+ * Creates an exact optional schema.
959
+ *
960
+ * @param wrapped The wrapped schema.
961
+ *
962
+ * @returns An exact optional schema.
963
+ */
964
+ declare function exactOptional<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>>>(wrapped: TWrapped): ExactOptionalSchema<TWrapped, undefined>;
965
+ /**
966
+ * Creates an exact optional schema.
967
+ *
968
+ * @param wrapped The wrapped schema.
969
+ * @param default_ The default value.
970
+ *
971
+ * @returns An exact optional schema.
972
+ */
973
+ declare function exactOptional<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, const TDefault extends Default<TWrapped, never>>(wrapped: TWrapped, default_: TDefault): ExactOptionalSchema<TWrapped, TDefault>;
974
+
975
+ /**
976
+ * Exact optional schema async interface.
977
+ */
978
+ interface ExactOptionalSchemaAsync<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TDefault extends DefaultAsync<TWrapped, never>> extends BaseSchemaAsync<InferInput<TWrapped>, InferOutput<TWrapped>, InferIssue<TWrapped>> {
979
+ /**
980
+ * The schema type.
981
+ */
982
+ readonly type: 'exact_optional';
983
+ /**
984
+ * The schema reference.
985
+ */
986
+ readonly reference: typeof exactOptional | typeof exactOptionalAsync;
987
+ /**
988
+ * The expected property.
989
+ */
990
+ readonly expects: TWrapped['expects'];
991
+ /**
992
+ * The wrapped schema.
993
+ */
994
+ readonly wrapped: TWrapped;
995
+ /**
996
+ * The default value.
997
+ */
998
+ readonly default: TDefault;
999
+ }
1000
+ /**
1001
+ * Creates an exact optional schema.
1002
+ *
1003
+ * @param wrapped The wrapped schema.
1004
+ *
1005
+ * @returns An exact optional schema.
1006
+ */
1007
+ declare function exactOptionalAsync<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>>(wrapped: TWrapped): ExactOptionalSchemaAsync<TWrapped, undefined>;
1008
+ /**
1009
+ * Creates an exact optional schema.
1010
+ *
1011
+ * @param wrapped The wrapped schema.
1012
+ * @param default_ The default value.
1013
+ *
1014
+ * @returns An exact optional schema.
1015
+ */
1016
+ declare function exactOptionalAsync<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, const TDefault extends DefaultAsync<TWrapped, never>>(wrapped: TWrapped, default_: TDefault): ExactOptionalSchemaAsync<TWrapped, TDefault>;
1017
+
1018
+ /**
1019
+ * File issue interface.
1020
+ */
1021
+
1022
+ /**
1023
+ * Infer nullish output type.
1024
+ */
1025
+ type InferNullishOutput<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TDefault extends DefaultAsync<TWrapped, null | undefined>> = undefined extends TDefault ? InferOutput<TWrapped> | null | undefined : InferOutput<TWrapped> | Extract<DefaultValue<TDefault>, null | undefined>;
1026
+
1027
+ /**
1028
+ * Nullish schema interface.
1029
+ */
1030
+ interface NullishSchema<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, TDefault extends Default<TWrapped, null | undefined>> extends BaseSchema<InferInput<TWrapped> | null | undefined, InferNullishOutput<TWrapped, TDefault>, InferIssue<TWrapped>> {
1031
+ /**
1032
+ * The schema type.
1033
+ */
1034
+ readonly type: 'nullish';
1035
+ /**
1036
+ * The schema reference.
1037
+ */
1038
+ readonly reference: typeof nullish;
1039
+ /**
1040
+ * The expected property.
1041
+ */
1042
+ readonly expects: `(${TWrapped['expects']} | null | undefined)`;
1043
+ /**
1044
+ * The wrapped schema.
1045
+ */
1046
+ readonly wrapped: TWrapped;
1047
+ /**
1048
+ * The default value.
1049
+ */
1050
+ readonly default: TDefault;
1051
+ }
1052
+ /**
1053
+ * Creates a nullish schema.
1054
+ *
1055
+ * @param wrapped The wrapped schema.
1056
+ *
1057
+ * @returns A nullish schema.
1058
+ */
1059
+ declare function nullish<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>>>(wrapped: TWrapped): NullishSchema<TWrapped, undefined>;
1060
+ /**
1061
+ * Creates a nullish schema.
1062
+ *
1063
+ * @param wrapped The wrapped schema.
1064
+ * @param default_ The default value.
1065
+ *
1066
+ * @returns A nullish schema.
1067
+ */
1068
+ declare function nullish<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, const TDefault extends Default<TWrapped, null | undefined>>(wrapped: TWrapped, default_: TDefault): NullishSchema<TWrapped, TDefault>;
1069
+
1070
+ /**
1071
+ * Nullish schema async interface.
1072
+ */
1073
+ interface NullishSchemaAsync<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TDefault extends DefaultAsync<TWrapped, null | undefined>> extends BaseSchemaAsync<InferInput<TWrapped> | null | undefined, InferNullishOutput<TWrapped, TDefault>, InferIssue<TWrapped>> {
1074
+ /**
1075
+ * The schema type.
1076
+ */
1077
+ readonly type: 'nullish';
1078
+ /**
1079
+ * The schema reference.
1080
+ */
1081
+ readonly reference: typeof nullish | typeof nullishAsync;
1082
+ /**
1083
+ * The expected property.
1084
+ */
1085
+ readonly expects: `(${TWrapped['expects']} | null | undefined)`;
1086
+ /**
1087
+ * The wrapped schema.
1088
+ */
1089
+ readonly wrapped: TWrapped;
1090
+ /**
1091
+ * The default value.
1092
+ */
1093
+ readonly default: TDefault;
1094
+ }
1095
+ /**
1096
+ * Creates a nullish schema.
1097
+ *
1098
+ * @param wrapped The wrapped schema.
1099
+ *
1100
+ * @returns A nullish schema.
1101
+ */
1102
+ declare function nullishAsync<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>>(wrapped: TWrapped): NullishSchemaAsync<TWrapped, undefined>;
1103
+ /**
1104
+ * Creates a nullish schema.
1105
+ *
1106
+ * @param wrapped The wrapped schema.
1107
+ * @param default_ The default value.
1108
+ *
1109
+ * @returns A nullish schema.
1110
+ */
1111
+ declare function nullishAsync<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, const TDefault extends DefaultAsync<TWrapped, null | undefined>>(wrapped: TWrapped, default_: TDefault): NullishSchemaAsync<TWrapped, TDefault>;
1112
+
1113
+ /**
1114
+ * Number issue interface.
1115
+ */
1116
+ interface NumberIssue extends BaseIssue<unknown> {
1117
+ /**
1118
+ * The issue kind.
1119
+ */
1120
+ readonly kind: 'schema';
1121
+ /**
1122
+ * The issue type.
1123
+ */
1124
+ readonly type: 'number';
1125
+ /**
1126
+ * The expected property.
1127
+ */
1128
+ readonly expected: 'number';
1129
+ }
1130
+ /**
1131
+ * Number schema interface.
1132
+ */
1133
+ interface NumberSchema<TMessage extends ErrorMessage<NumberIssue> | undefined> extends BaseSchema<number, number, NumberIssue> {
1134
+ /**
1135
+ * The schema type.
1136
+ */
1137
+ readonly type: 'number';
1138
+ /**
1139
+ * The schema reference.
1140
+ */
1141
+ readonly reference: typeof number;
1142
+ /**
1143
+ * The expected property.
1144
+ */
1145
+ readonly expects: 'number';
1146
+ /**
1147
+ * The error message.
1148
+ */
1149
+ readonly message: TMessage;
1150
+ }
1151
+ /**
1152
+ * Creates a number schema.
1153
+ *
1154
+ * @returns A number schema.
1155
+ */
1156
+ declare function number(): NumberSchema<undefined>;
1157
+ /**
1158
+ * Creates a number schema.
1159
+ *
1160
+ * @param message The error message.
1161
+ *
1162
+ * @returns A number schema.
1163
+ */
1164
+ declare function number<const TMessage extends ErrorMessage<NumberIssue> | undefined>(message: TMessage): NumberSchema<TMessage>;
1165
+
1166
+ /**
1167
+ * Object issue interface.
1168
+ */
1169
+ interface ObjectIssue extends BaseIssue<unknown> {
1170
+ /**
1171
+ * The issue kind.
1172
+ */
1173
+ readonly kind: 'schema';
1174
+ /**
1175
+ * The issue type.
1176
+ */
1177
+ readonly type: 'object';
1178
+ /**
1179
+ * The expected property.
1180
+ */
1181
+ readonly expected: 'Object' | `"${string}"`;
1182
+ }
1183
+
1184
+ /**
1185
+ * Object schema interface.
1186
+ */
1187
+ interface ObjectSchema<TEntries extends ObjectEntries, TMessage extends ErrorMessage<ObjectIssue> | undefined> extends BaseSchema<InferObjectInput<TEntries>, InferObjectOutput<TEntries>, ObjectIssue | InferObjectIssue<TEntries>> {
1188
+ /**
1189
+ * The schema type.
1190
+ */
1191
+ readonly type: 'object';
1192
+ /**
1193
+ * The schema reference.
1194
+ */
1195
+ readonly reference: typeof object;
1196
+ /**
1197
+ * The expected property.
1198
+ */
1199
+ readonly expects: 'Object';
1200
+ /**
1201
+ * The entries schema.
1202
+ */
1203
+ readonly entries: TEntries;
1204
+ /**
1205
+ * The error message.
1206
+ */
1207
+ readonly message: TMessage;
1208
+ }
1209
+ /**
1210
+ * Creates an object schema.
1211
+ *
1212
+ * Hint: This schema removes unknown entries. The output will only include the
1213
+ * entries you specify. To include unknown entries, use `looseObject`. To
1214
+ * return an issue for unknown entries, use `strictObject`. To include and
1215
+ * validate unknown entries, use `objectWithRest`.
1216
+ *
1217
+ * @param entries The entries schema.
1218
+ *
1219
+ * @returns An object schema.
1220
+ */
1221
+ declare function object<const TEntries extends ObjectEntries>(entries: TEntries): ObjectSchema<TEntries, undefined>;
1222
+ /**
1223
+ * Creates an object schema.
1224
+ *
1225
+ * Hint: This schema removes unknown entries. The output will only include the
1226
+ * entries you specify. To include unknown entries, use `looseObject`. To
1227
+ * return an issue for unknown entries, use `strictObject`. To include and
1228
+ * validate unknown entries, use `objectWithRest`.
1229
+ *
1230
+ * @param entries The entries schema.
1231
+ * @param message The error message.
1232
+ *
1233
+ * @returns An object schema.
1234
+ */
1235
+ declare function object<const TEntries extends ObjectEntries, const TMessage extends ErrorMessage<ObjectIssue> | undefined>(entries: TEntries, message: TMessage): ObjectSchema<TEntries, TMessage>;
1236
+
1237
+ /**
1238
+ * Object schema async interface.
1239
+ */
1240
+
1241
+ /**
1242
+ * Infer optional output type.
1243
+ */
1244
+ type InferOptionalOutput<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TDefault extends DefaultAsync<TWrapped, undefined>> = undefined extends TDefault ? InferOutput<TWrapped> | undefined : InferOutput<TWrapped> | Extract<DefaultValue<TDefault>, undefined>;
1245
+
1246
+ /**
1247
+ * Optional schema interface.
1248
+ */
1249
+ interface OptionalSchema<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, TDefault extends Default<TWrapped, undefined>> extends BaseSchema<InferInput<TWrapped> | undefined, InferOptionalOutput<TWrapped, TDefault>, InferIssue<TWrapped>> {
1250
+ /**
1251
+ * The schema type.
1252
+ */
1253
+ readonly type: 'optional';
1254
+ /**
1255
+ * The schema reference.
1256
+ */
1257
+ readonly reference: typeof optional;
1258
+ /**
1259
+ * The expected property.
1260
+ */
1261
+ readonly expects: `(${TWrapped['expects']} | undefined)`;
1262
+ /**
1263
+ * The wrapped schema.
1264
+ */
1265
+ readonly wrapped: TWrapped;
1266
+ /**
1267
+ * The default value.
1268
+ */
1269
+ readonly default: TDefault;
1270
+ }
1271
+ /**
1272
+ * Creates an optional schema.
1273
+ *
1274
+ * @param wrapped The wrapped schema.
1275
+ *
1276
+ * @returns An optional schema.
1277
+ */
1278
+ declare function optional<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>>>(wrapped: TWrapped): OptionalSchema<TWrapped, undefined>;
1279
+ /**
1280
+ * Creates an optional schema.
1281
+ *
1282
+ * @param wrapped The wrapped schema.
1283
+ * @param default_ The default value.
1284
+ *
1285
+ * @returns An optional schema.
1286
+ */
1287
+ declare function optional<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, const TDefault extends Default<TWrapped, undefined>>(wrapped: TWrapped, default_: TDefault): OptionalSchema<TWrapped, TDefault>;
1288
+
1289
+ /**
1290
+ * Optional schema async interface.
1291
+ */
1292
+ interface OptionalSchemaAsync<TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TDefault extends DefaultAsync<TWrapped, undefined>> extends BaseSchemaAsync<InferInput<TWrapped> | undefined, InferOptionalOutput<TWrapped, TDefault>, InferIssue<TWrapped>> {
1293
+ /**
1294
+ * The schema type.
1295
+ */
1296
+ readonly type: 'optional';
1297
+ /**
1298
+ * The schema reference.
1299
+ */
1300
+ readonly reference: typeof optional | typeof optionalAsync;
1301
+ /**
1302
+ * The expected property.
1303
+ */
1304
+ readonly expects: `(${TWrapped['expects']} | undefined)`;
1305
+ /**
1306
+ * The wrapped schema.
1307
+ */
1308
+ readonly wrapped: TWrapped;
1309
+ /**
1310
+ * The default value.
1311
+ */
1312
+ readonly default: TDefault;
1313
+ }
1314
+ /**
1315
+ * Creates an optional schema.
1316
+ *
1317
+ * @param wrapped The wrapped schema.
1318
+ *
1319
+ * @returns An optional schema.
1320
+ */
1321
+ declare function optionalAsync<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>>(wrapped: TWrapped): OptionalSchemaAsync<TWrapped, undefined>;
1322
+ /**
1323
+ * Creates an optional schema.
1324
+ *
1325
+ * @param wrapped The wrapped schema.
1326
+ * @param default_ The default value.
1327
+ *
1328
+ * @returns An optional schema.
1329
+ */
1330
+ declare function optionalAsync<const TWrapped extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, const TDefault extends DefaultAsync<TWrapped, undefined>>(wrapped: TWrapped, default_: TDefault): OptionalSchemaAsync<TWrapped, TDefault>;
1331
+
1332
+ /**
1333
+ * Picklist options type.
1334
+ */
1335
+
1336
+ /**
1337
+ * String issue interface.
1338
+ */
1339
+ interface StringIssue extends BaseIssue<unknown> {
1340
+ /**
1341
+ * The issue kind.
1342
+ */
1343
+ readonly kind: 'schema';
1344
+ /**
1345
+ * The issue type.
1346
+ */
1347
+ readonly type: 'string';
1348
+ /**
1349
+ * The expected property.
1350
+ */
1351
+ readonly expected: 'string';
1352
+ }
1353
+ /**
1354
+ * String schema interface.
1355
+ */
1356
+ interface StringSchema<TMessage extends ErrorMessage<StringIssue> | undefined> extends BaseSchema<string, string, StringIssue> {
1357
+ /**
1358
+ * The schema type.
1359
+ */
1360
+ readonly type: 'string';
1361
+ /**
1362
+ * The schema reference.
1363
+ */
1364
+ readonly reference: typeof string;
1365
+ /**
1366
+ * The expected property.
1367
+ */
1368
+ readonly expects: 'string';
1369
+ /**
1370
+ * The error message.
1371
+ */
1372
+ readonly message: TMessage;
1373
+ }
1374
+ /**
1375
+ * Creates a string schema.
1376
+ *
1377
+ * @returns A string schema.
1378
+ */
1379
+ declare function string(): StringSchema<undefined>;
1380
+ /**
1381
+ * Creates a string schema.
1382
+ *
1383
+ * @param message The error message.
1384
+ *
1385
+ * @returns A string schema.
1386
+ */
1387
+ declare function string<const TMessage extends ErrorMessage<StringIssue> | undefined>(message: TMessage): StringSchema<TMessage>;
1388
+
1389
+ /**
1390
+ * Symbol issue interface.
1391
+ */
1392
+
1393
+ /**
1394
+ * Readonly output type.
1395
+ */
1396
+ type ReadonlyOutput<TInput> = TInput extends Map<infer TKey, infer TValue> ? ReadonlyMap<TKey, TValue> : TInput extends Set<infer TValue> ? ReadonlySet<TValue> : Readonly<TInput>;
1397
+ /**
1398
+ * Readonly action interface.
1399
+ */
1400
+ interface ReadonlyAction<TInput> extends BaseTransformation<TInput, ReadonlyOutput<TInput>, never> {
1401
+ /**
1402
+ * The action type.
1403
+ */
1404
+ readonly type: 'readonly';
1405
+ /**
1406
+ * The action reference.
1407
+ */
1408
+ readonly reference: typeof readonly;
1409
+ }
1410
+ /**
1411
+ * Creates a readonly transformation action.
1412
+ *
1413
+ * @returns A readonly action.
1414
+ */
1415
+ declare function readonly<TInput>(): ReadonlyAction<TInput>;
1416
+
1417
+ /**
1418
+ * Array action type.
1419
+ */
1420
+ //#endregion
1421
+ //#region data-loader.d.ts
1422
+ declare const getDefaultClaudePath: () => string;
1423
+ declare const UsageDataSchema: ObjectSchema<{
1424
+ readonly timestamp: StringSchema<undefined>;
1425
+ readonly message: ObjectSchema<{
1426
+ readonly usage: ObjectSchema<{
1427
+ readonly input_tokens: NumberSchema<undefined>;
1428
+ readonly output_tokens: NumberSchema<undefined>;
1429
+ readonly cache_creation_input_tokens: OptionalSchema<NumberSchema<undefined>, undefined>;
1430
+ readonly cache_read_input_tokens: OptionalSchema<NumberSchema<undefined>, undefined>;
1431
+ }, undefined>;
1432
+ }, undefined>;
1433
+ readonly costUSD: NumberSchema<undefined>;
1434
+ }, undefined>;
1435
+ type UsageData = InferOutput<typeof UsageDataSchema>;
1436
+ declare const DailyUsageSchema: ObjectSchema<{
1437
+ readonly date: StringSchema<undefined>;
1438
+ readonly inputTokens: NumberSchema<undefined>;
1439
+ readonly outputTokens: NumberSchema<undefined>;
1440
+ readonly cacheCreationTokens: NumberSchema<undefined>;
1441
+ readonly cacheReadTokens: NumberSchema<undefined>;
1442
+ readonly totalCost: NumberSchema<undefined>;
1443
+ }, undefined>;
1444
+ type DailyUsage = InferOutput<typeof DailyUsageSchema>;
1445
+ declare const SessionUsageSchema: ObjectSchema<{
1446
+ readonly sessionId: StringSchema<undefined>;
1447
+ readonly projectPath: StringSchema<undefined>;
1448
+ readonly inputTokens: NumberSchema<undefined>;
1449
+ readonly outputTokens: NumberSchema<undefined>;
1450
+ readonly cacheCreationTokens: NumberSchema<undefined>;
1451
+ readonly cacheReadTokens: NumberSchema<undefined>;
1452
+ readonly totalCost: NumberSchema<undefined>;
1453
+ readonly lastActivity: StringSchema<undefined>;
1454
+ }, undefined>;
1455
+ type SessionUsage = InferOutput<typeof SessionUsageSchema>;
1456
+ declare const formatDate: (dateStr: string) => string;
1457
+ interface DateFilter {
1458
+ since?: string;
1459
+ until?: string;
1460
+ }
1461
+ interface LoadOptions extends DateFilter {
1462
+ claudePath?: string;
1463
+ }
1464
+ declare function loadUsageData(options?: LoadOptions): Promise<DailyUsage[]>;
1465
+ declare function loadSessionData(options?: LoadOptions): Promise<SessionUsage[]>;
1466
+ //#endregion
1467
+ export { DailyUsage, DailyUsageSchema as DailyUsageSchema$1, DateFilter, LoadOptions, SessionUsage, SessionUsageSchema as SessionUsageSchema$1, UsageData, UsageDataSchema as UsageDataSchema$1, formatDate as formatDate$1, getDefaultClaudePath as getDefaultClaudePath$1, loadSessionData as loadSessionData$1, loadUsageData as loadUsageData$1 };