@hanai/ccusage 18.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2304 @@
1
+ //#region src/_consts.d.ts
2
+
3
+ /**
4
+ * Days of the week for weekly aggregation
5
+ */
6
+ declare const WEEK_DAYS: readonly ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];
7
+ /**
8
+ * Week day names type
9
+ */
10
+ type WeekDay = (typeof WEEK_DAYS)[number];
11
+ //#endregion
12
+ //#region src/_session-blocks.d.ts
13
+ /**
14
+ * Represents a single usage data entry loaded from JSONL files
15
+ */
16
+ type LoadedUsageEntry = {
17
+ timestamp: Date;
18
+ usage: {
19
+ inputTokens: number;
20
+ outputTokens: number;
21
+ cacheCreationInputTokens: number;
22
+ cacheReadInputTokens: number;
23
+ };
24
+ costUSD: number | null;
25
+ model: string;
26
+ version?: string;
27
+ usageLimitResetTime?: Date;
28
+ };
29
+ /**
30
+ * Aggregated token counts for different token types
31
+ */
32
+ type TokenCounts = {
33
+ inputTokens: number;
34
+ outputTokens: number;
35
+ cacheCreationInputTokens: number;
36
+ cacheReadInputTokens: number;
37
+ };
38
+ /**
39
+ * Represents a session block (typically 5-hour billing period) with usage data
40
+ */
41
+ type SessionBlock = {
42
+ id: string;
43
+ startTime: Date;
44
+ endTime: Date;
45
+ actualEndTime?: Date;
46
+ isActive: boolean;
47
+ isGap?: boolean;
48
+ entries: LoadedUsageEntry[];
49
+ tokenCounts: TokenCounts;
50
+ costUSD: number;
51
+ models: string[];
52
+ usageLimitResetTime?: Date;
53
+ };
54
+ //#endregion
55
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/observable-like.d.ts
56
+ declare global {
57
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
58
+ interface SymbolConstructor {
59
+ readonly observable: symbol;
60
+ }
61
+ }
62
+
63
+ /**
64
+ @remarks
65
+ The TC39 observable proposal defines a `closed` property, but some implementations (such as xstream) do not as of 10/08/2021.
66
+ As well, some guidance on making an `Observable` to not include `closed` property.
67
+ @see https://github.com/tc39/proposal-observable/blob/master/src/Observable.js#L129-L130
68
+ @see https://github.com/staltz/xstream/blob/6c22580c1d84d69773ee4b0905df44ad464955b3/src/index.ts#L79-L85
69
+ @see https://github.com/benlesh/symbol-observable#making-an-object-observable
70
+
71
+ @category Observable
72
+ */
73
+
74
+ //#endregion
75
+ //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/tuple-to-union.d.ts
76
+ /**
77
+ Convert a tuple/array into a union type of its elements.
78
+
79
+ This can be useful when you have a fixed set of allowed values and want a type defining only the allowed values, but do not want to repeat yourself.
80
+
81
+ @example
82
+ ```
83
+ import type {TupleToUnion} from 'type-fest';
84
+
85
+ const destinations = ['a', 'b', 'c'] as const;
86
+
87
+ type Destination = TupleToUnion<typeof destinations>;
88
+ //=> 'a' | 'b' | 'c'
89
+
90
+ function verifyDestination(destination: unknown): destination is Destination {
91
+ return destinations.includes(destination as any);
92
+ }
93
+
94
+ type RequestBody = {
95
+ deliverTo: Destination;
96
+ };
97
+
98
+ function verifyRequestBody(body: unknown): body is RequestBody {
99
+ const deliverTo = (body as any).deliverTo;
100
+ return typeof body === 'object' && body !== null && verifyDestination(deliverTo);
101
+ }
102
+ ```
103
+
104
+ Alternatively, you may use `typeof destinations[number]`. If `destinations` is a tuple, there is no difference. However if `destinations` is a string, the resulting type will the union of the characters in the string. Other types of `destinations` may result in a compile error. In comparison, TupleToUnion will return `never` if a tuple is not provided.
105
+
106
+ @example
107
+ ```
108
+ const destinations = ['a', 'b', 'c'] as const;
109
+
110
+ type Destination = typeof destinations[number];
111
+ //=> 'a' | 'b' | 'c'
112
+
113
+ const erroringType = new Set(['a', 'b', 'c']);
114
+
115
+ type ErroringType = typeof erroringType[number];
116
+ //=> Type 'Set<string>' has no matching index signature for type 'number'. ts(2537)
117
+
118
+ const numberBool: { [n: number]: boolean } = { 1: true };
119
+
120
+ type NumberBool = typeof numberBool[number];
121
+ //=> boolean
122
+ ```
123
+
124
+ @category Array
125
+ */
126
+ type TupleToUnion<ArrayType> = ArrayType extends readonly unknown[] ? ArrayType[number] : never;
127
+ //#endregion
128
+ //#region ../../node_modules/.pnpm/valibot@1.1.0_typescript@5.9.2/node_modules/valibot/dist/index.d.ts
129
+ /**
130
+ * Fallback type.
131
+ */
132
+ 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>>);
133
+ /**
134
+ * Schema with fallback type.
135
+ */
136
+ type SchemaWithFallback<TSchema extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, TFallback$1 extends Fallback<TSchema>> = TSchema & {
137
+ /**
138
+ * The fallback value.
139
+ */
140
+ readonly fallback: TFallback$1;
141
+ };
142
+ /**
143
+ * Returns a fallback value as output if the input does not match the schema.
144
+ *
145
+ * @param schema The schema to catch.
146
+ * @param fallback The fallback value.
147
+ *
148
+ * @returns The passed schema.
149
+ */
150
+
151
+ /**
152
+ * Fallback async type.
153
+ */
154
+ 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>>>);
155
+ /**
156
+ * Schema with fallback async type.
157
+ */
158
+ type SchemaWithFallbackAsync<TSchema extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TFallback$1 extends FallbackAsync<TSchema>> = Omit<TSchema, 'async' | '~standard' | '~run'> & {
159
+ /**
160
+ * The fallback value.
161
+ */
162
+ readonly fallback: TFallback$1;
163
+ /**
164
+ * Whether it's async.
165
+ */
166
+ readonly async: true;
167
+ /**
168
+ * The Standard Schema properties.
169
+ *
170
+ * @internal
171
+ */
172
+ readonly '~standard': StandardProps<InferInput<TSchema>, InferOutput<TSchema>>;
173
+ /**
174
+ * Parses unknown input values.
175
+ *
176
+ * @param dataset The input dataset.
177
+ * @param config The configuration.
178
+ *
179
+ * @returns The output dataset.
180
+ *
181
+ * @internal
182
+ */
183
+ readonly '~run': (dataset: UnknownDataset, config: Config<BaseIssue<unknown>>) => Promise<OutputDataset<InferOutput<TSchema>, InferIssue<TSchema>>>;
184
+ };
185
+ /**
186
+ * Returns a fallback value as output if the input does not match the schema.
187
+ *
188
+ * @param schema The schema to catch.
189
+ * @param fallback The fallback value.
190
+ *
191
+ * @returns The passed schema.
192
+ */
193
+
194
+ /**
195
+ * Schema with pipe type.
196
+ */
197
+ type SchemaWithPipe<TPipe$1 extends readonly [BaseSchema<unknown, unknown, BaseIssue<unknown>>, ...PipeItem<any, unknown, BaseIssue<unknown>>[]]> = Omit<FirstTupleItem<TPipe$1>, 'pipe' | '~standard' | '~run' | '~types'> & {
198
+ /**
199
+ * The pipe items.
200
+ */
201
+ readonly pipe: TPipe$1;
202
+ /**
203
+ * The Standard Schema properties.
204
+ *
205
+ * @internal
206
+ */
207
+ readonly '~standard': StandardProps<InferInput<FirstTupleItem<TPipe$1>>, InferOutput<LastTupleItem<TPipe$1>>>;
208
+ /**
209
+ * Parses unknown input values.
210
+ *
211
+ * @param dataset The input dataset.
212
+ * @param config The configuration.
213
+ *
214
+ * @returns The output dataset.
215
+ *
216
+ * @internal
217
+ */
218
+ readonly '~run': (dataset: UnknownDataset, config: Config<BaseIssue<unknown>>) => OutputDataset<InferOutput<LastTupleItem<TPipe$1>>, InferIssue<TPipe$1[number]>>;
219
+ /**
220
+ * The input, output and issue type.
221
+ *
222
+ * @internal
223
+ */
224
+ readonly '~types'?: {
225
+ readonly input: InferInput<FirstTupleItem<TPipe$1>>;
226
+ readonly output: InferOutput<LastTupleItem<TPipe$1>>;
227
+ readonly issue: InferIssue<TPipe$1[number]>;
228
+ } | undefined;
229
+ };
230
+ /**
231
+ * Adds a pipeline to a schema, that can validate and transform its input.
232
+ *
233
+ * @param schema The root schema.
234
+ * @param item1 The first pipe item.
235
+ *
236
+ * @returns A schema with a pipeline.
237
+ */
238
+
239
+ /**
240
+ * Schema with pipe async type.
241
+ */
242
+ type SchemaWithPipeAsync<TPipe$1 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$1>, 'async' | 'pipe' | '~standard' | '~run' | '~types'> & {
243
+ /**
244
+ * The pipe items.
245
+ */
246
+ readonly pipe: TPipe$1;
247
+ /**
248
+ * Whether it's async.
249
+ */
250
+ readonly async: true;
251
+ /**
252
+ * The Standard Schema properties.
253
+ *
254
+ * @internal
255
+ */
256
+ readonly '~standard': StandardProps<InferInput<FirstTupleItem<TPipe$1>>, InferOutput<LastTupleItem<TPipe$1>>>;
257
+ /**
258
+ * Parses unknown input values.
259
+ *
260
+ * @param dataset The input dataset.
261
+ * @param config The configuration.
262
+ *
263
+ * @returns The output dataset.
264
+ *
265
+ * @internal
266
+ */
267
+ readonly '~run': (dataset: UnknownDataset, config: Config<BaseIssue<unknown>>) => Promise<OutputDataset<InferOutput<LastTupleItem<TPipe$1>>, InferIssue<TPipe$1[number]>>>;
268
+ /**
269
+ * The input, output and issue type.
270
+ *
271
+ * @internal
272
+ */
273
+ readonly '~types'?: {
274
+ readonly input: InferInput<FirstTupleItem<TPipe$1>>;
275
+ readonly output: InferOutput<LastTupleItem<TPipe$1>>;
276
+ readonly issue: InferIssue<TPipe$1[number]>;
277
+ } | undefined;
278
+ };
279
+ /**
280
+ * Adds a pipeline to a schema, that can validate and transform its input.
281
+ *
282
+ * @param schema The root schema.
283
+ * @param item1 The first pipe item.
284
+ *
285
+ * @returns A schema with a pipeline.
286
+ */
287
+
288
+ /**
289
+ * Base metadata interface.
290
+ */
291
+ interface BaseMetadata<TInput$1> {
292
+ /**
293
+ * The object kind.
294
+ */
295
+ readonly kind: 'metadata';
296
+ /**
297
+ * The metadata type.
298
+ */
299
+ readonly type: string;
300
+ /**
301
+ * The metadata reference.
302
+ */
303
+ readonly reference: (...args: any[]) => BaseMetadata<any>;
304
+ /**
305
+ * The input, output and issue type.
306
+ *
307
+ * @internal
308
+ */
309
+ readonly '~types'?: {
310
+ readonly input: TInput$1;
311
+ readonly output: TInput$1;
312
+ readonly issue: never;
313
+ } | undefined;
314
+ }
315
+ /**
316
+ * Generic metadata type.
317
+ */
318
+
319
+ /**
320
+ * Unknown dataset interface.
321
+ */
322
+ interface UnknownDataset {
323
+ /**
324
+ * Whether is's typed.
325
+ */
326
+ typed?: false;
327
+ /**
328
+ * The dataset value.
329
+ */
330
+ value: unknown;
331
+ /**
332
+ * The dataset issues.
333
+ */
334
+ issues?: undefined;
335
+ }
336
+ /**
337
+ * Success dataset interface.
338
+ */
339
+ interface SuccessDataset<TValue$1> {
340
+ /**
341
+ * Whether is's typed.
342
+ */
343
+ typed: true;
344
+ /**
345
+ * The dataset value.
346
+ */
347
+ value: TValue$1;
348
+ /**
349
+ * The dataset issues.
350
+ */
351
+ issues?: undefined;
352
+ }
353
+ /**
354
+ * Partial dataset interface.
355
+ */
356
+ interface PartialDataset<TValue$1, TIssue extends BaseIssue<unknown>> {
357
+ /**
358
+ * Whether is's typed.
359
+ */
360
+ typed: true;
361
+ /**
362
+ * The dataset value.
363
+ */
364
+ value: TValue$1;
365
+ /**
366
+ * The dataset issues.
367
+ */
368
+ issues: [TIssue, ...TIssue[]];
369
+ }
370
+ /**
371
+ * Failure dataset interface.
372
+ */
373
+ interface FailureDataset<TIssue extends BaseIssue<unknown>> {
374
+ /**
375
+ * Whether is's typed.
376
+ */
377
+ typed: false;
378
+ /**
379
+ * The dataset value.
380
+ */
381
+ value: unknown;
382
+ /**
383
+ * The dataset issues.
384
+ */
385
+ issues: [TIssue, ...TIssue[]];
386
+ }
387
+ /**
388
+ * Output dataset type.
389
+ */
390
+ type OutputDataset<TValue$1, TIssue extends BaseIssue<unknown>> = SuccessDataset<TValue$1> | PartialDataset<TValue$1, TIssue> | FailureDataset<TIssue>;
391
+
392
+ /**
393
+ * The Standard Schema properties interface.
394
+ */
395
+ interface StandardProps<TInput$1, TOutput$1> {
396
+ /**
397
+ * The version number of the standard.
398
+ */
399
+ readonly version: 1;
400
+ /**
401
+ * The vendor name of the schema library.
402
+ */
403
+ readonly vendor: 'valibot';
404
+ /**
405
+ * Validates unknown input values.
406
+ */
407
+ readonly validate: (value: unknown) => StandardResult<TOutput$1> | Promise<StandardResult<TOutput$1>>;
408
+ /**
409
+ * Inferred types associated with the schema.
410
+ */
411
+ readonly types?: StandardTypes<TInput$1, TOutput$1> | undefined;
412
+ }
413
+ /**
414
+ * The result interface of the validate function.
415
+ */
416
+ type StandardResult<TOutput$1> = StandardSuccessResult<TOutput$1> | StandardFailureResult;
417
+ /**
418
+ * The result interface if validation succeeds.
419
+ */
420
+ interface StandardSuccessResult<TOutput$1> {
421
+ /**
422
+ * The typed output value.
423
+ */
424
+ readonly value: TOutput$1;
425
+ /**
426
+ * The non-existent issues.
427
+ */
428
+ readonly issues?: undefined;
429
+ }
430
+ /**
431
+ * The result interface if validation fails.
432
+ */
433
+ interface StandardFailureResult {
434
+ /**
435
+ * The issues of failed validation.
436
+ */
437
+ readonly issues: readonly StandardIssue[];
438
+ }
439
+ /**
440
+ * The issue interface of the failure output.
441
+ */
442
+ interface StandardIssue {
443
+ /**
444
+ * The error message of the issue.
445
+ */
446
+ readonly message: string;
447
+ /**
448
+ * The path of the issue, if any.
449
+ */
450
+ readonly path?: readonly (PropertyKey | StandardPathItem)[] | undefined;
451
+ }
452
+ /**
453
+ * The path item interface of the issue.
454
+ */
455
+ interface StandardPathItem {
456
+ /**
457
+ * The key of the path item.
458
+ */
459
+ readonly key: PropertyKey;
460
+ }
461
+ /**
462
+ * The Standard Schema types interface.
463
+ */
464
+ interface StandardTypes<TInput$1, TOutput$1> {
465
+ /**
466
+ * The input type of the schema.
467
+ */
468
+ readonly input: TInput$1;
469
+ /**
470
+ * The output type of the schema.
471
+ */
472
+ readonly output: TOutput$1;
473
+ }
474
+
475
+ /**
476
+ * Base schema interface.
477
+ */
478
+ interface BaseSchema<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> {
479
+ /**
480
+ * The object kind.
481
+ */
482
+ readonly kind: 'schema';
483
+ /**
484
+ * The schema type.
485
+ */
486
+ readonly type: string;
487
+ /**
488
+ * The schema reference.
489
+ */
490
+ readonly reference: (...args: any[]) => BaseSchema<unknown, unknown, BaseIssue<unknown>>;
491
+ /**
492
+ * The expected property.
493
+ */
494
+ readonly expects: string;
495
+ /**
496
+ * Whether it's async.
497
+ */
498
+ readonly async: false;
499
+ /**
500
+ * The Standard Schema properties.
501
+ *
502
+ * @internal
503
+ */
504
+ readonly '~standard': StandardProps<TInput$1, TOutput$1>;
505
+ /**
506
+ * Parses unknown input values.
507
+ *
508
+ * @param dataset The input dataset.
509
+ * @param config The configuration.
510
+ *
511
+ * @returns The output dataset.
512
+ *
513
+ * @internal
514
+ */
515
+ readonly '~run': (dataset: UnknownDataset, config: Config<BaseIssue<unknown>>) => OutputDataset<TOutput$1, TIssue>;
516
+ /**
517
+ * The input, output and issue type.
518
+ *
519
+ * @internal
520
+ */
521
+ readonly '~types'?: {
522
+ readonly input: TInput$1;
523
+ readonly output: TOutput$1;
524
+ readonly issue: TIssue;
525
+ } | undefined;
526
+ }
527
+ /**
528
+ * Base schema async interface.
529
+ */
530
+ interface BaseSchemaAsync<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> extends Omit<BaseSchema<TInput$1, TOutput$1, TIssue>, 'reference' | 'async' | '~run'> {
531
+ /**
532
+ * The schema reference.
533
+ */
534
+ readonly reference: (...args: any[]) => BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>;
535
+ /**
536
+ * Whether it's async.
537
+ */
538
+ readonly async: true;
539
+ /**
540
+ * Parses unknown input values.
541
+ *
542
+ * @param dataset The input dataset.
543
+ * @param config The configuration.
544
+ *
545
+ * @returns The output dataset.
546
+ *
547
+ * @internal
548
+ */
549
+ readonly '~run': (dataset: UnknownDataset, config: Config<BaseIssue<unknown>>) => Promise<OutputDataset<TOutput$1, TIssue>>;
550
+ }
551
+ /**
552
+ * Generic schema type.
553
+ */
554
+
555
+ /**
556
+ * Base transformation interface.
557
+ */
558
+ interface BaseTransformation<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> {
559
+ /**
560
+ * The object kind.
561
+ */
562
+ readonly kind: 'transformation';
563
+ /**
564
+ * The transformation type.
565
+ */
566
+ readonly type: string;
567
+ /**
568
+ * The transformation reference.
569
+ */
570
+ readonly reference: (...args: any[]) => BaseTransformation<any, any, BaseIssue<unknown>>;
571
+ /**
572
+ * Whether it's async.
573
+ */
574
+ readonly async: false;
575
+ /**
576
+ * Transforms known input values.
577
+ *
578
+ * @param dataset The input dataset.
579
+ * @param config The configuration.
580
+ *
581
+ * @returns The output dataset.
582
+ *
583
+ * @internal
584
+ */
585
+ readonly '~run': (dataset: SuccessDataset<TInput$1>, config: Config<BaseIssue<unknown>>) => OutputDataset<TOutput$1, BaseIssue<unknown> | TIssue>;
586
+ /**
587
+ * The input, output and issue type.
588
+ *
589
+ * @internal
590
+ */
591
+ readonly '~types'?: {
592
+ readonly input: TInput$1;
593
+ readonly output: TOutput$1;
594
+ readonly issue: TIssue;
595
+ } | undefined;
596
+ }
597
+ /**
598
+ * Base transformation async interface.
599
+ */
600
+ interface BaseTransformationAsync<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> extends Omit<BaseTransformation<TInput$1, TOutput$1, TIssue>, 'reference' | 'async' | '~run'> {
601
+ /**
602
+ * The transformation reference.
603
+ */
604
+ readonly reference: (...args: any[]) => BaseTransformation<any, any, BaseIssue<unknown>> | BaseTransformationAsync<any, any, BaseIssue<unknown>>;
605
+ /**
606
+ * Whether it's async.
607
+ */
608
+ readonly async: true;
609
+ /**
610
+ * Transforms known input values.
611
+ *
612
+ * @param dataset The input dataset.
613
+ * @param config The configuration.
614
+ *
615
+ * @returns The output dataset.
616
+ *
617
+ * @internal
618
+ */
619
+ readonly '~run': (dataset: SuccessDataset<TInput$1>, config: Config<BaseIssue<unknown>>) => Promise<OutputDataset<TOutput$1, BaseIssue<unknown> | TIssue>>;
620
+ }
621
+ /**
622
+ * Generic transformation type.
623
+ */
624
+
625
+ /**
626
+ * Base validation interface.
627
+ */
628
+ interface BaseValidation<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> {
629
+ /**
630
+ * The object kind.
631
+ */
632
+ readonly kind: 'validation';
633
+ /**
634
+ * The validation type.
635
+ */
636
+ readonly type: string;
637
+ /**
638
+ * The validation reference.
639
+ */
640
+ readonly reference: (...args: any[]) => BaseValidation<any, any, BaseIssue<unknown>>;
641
+ /**
642
+ * The expected property.
643
+ */
644
+ readonly expects: string | null;
645
+ /**
646
+ * Whether it's async.
647
+ */
648
+ readonly async: false;
649
+ /**
650
+ * Validates known input values.
651
+ *
652
+ * @param dataset The input dataset.
653
+ * @param config The configuration.
654
+ *
655
+ * @returns The output dataset.
656
+ *
657
+ * @internal
658
+ */
659
+ readonly '~run': (dataset: OutputDataset<TInput$1, BaseIssue<unknown>>, config: Config<BaseIssue<unknown>>) => OutputDataset<TOutput$1, BaseIssue<unknown> | TIssue>;
660
+ /**
661
+ * The input, output and issue type.
662
+ *
663
+ * @internal
664
+ */
665
+ readonly '~types'?: {
666
+ readonly input: TInput$1;
667
+ readonly output: TOutput$1;
668
+ readonly issue: TIssue;
669
+ } | undefined;
670
+ }
671
+ /**
672
+ * Base validation async interface.
673
+ */
674
+ interface BaseValidationAsync<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> extends Omit<BaseValidation<TInput$1, TOutput$1, TIssue>, 'reference' | 'async' | '~run'> {
675
+ /**
676
+ * The validation reference.
677
+ */
678
+ readonly reference: (...args: any[]) => BaseValidation<any, any, BaseIssue<unknown>> | BaseValidationAsync<any, any, BaseIssue<unknown>>;
679
+ /**
680
+ * Whether it's async.
681
+ */
682
+ readonly async: true;
683
+ /**
684
+ * Validates known input values.
685
+ *
686
+ * @param dataset The input dataset.
687
+ * @param config The configuration.
688
+ *
689
+ * @returns The output dataset.
690
+ *
691
+ * @internal
692
+ */
693
+ readonly '~run': (dataset: OutputDataset<TInput$1, BaseIssue<unknown>>, config: Config<BaseIssue<unknown>>) => Promise<OutputDataset<TOutput$1, BaseIssue<unknown> | TIssue>>;
694
+ }
695
+ /**
696
+ * Generic validation type.
697
+ */
698
+
699
+ /**
700
+ * Infer input type.
701
+ */
702
+ type InferInput<TItem$1 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$1['~types']>['input'];
703
+ /**
704
+ * Infer output type.
705
+ */
706
+ type InferOutput<TItem$1 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$1['~types']>['output'];
707
+ /**
708
+ * Infer issue type.
709
+ */
710
+ type InferIssue<TItem$1 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$1['~types']>['issue'];
711
+
712
+ /**
713
+ * Checks if a type is `any`.
714
+ */
715
+
716
+ /**
717
+ * Constructs a type that is maybe readonly.
718
+ */
719
+ type MaybeReadonly<TValue$1> = TValue$1 | Readonly<TValue$1>;
720
+ /**
721
+ * Constructs a type that is maybe a promise.
722
+ */
723
+ type MaybePromise<TValue$1> = TValue$1 | Promise<TValue$1>;
724
+ /**
725
+ * Prettifies a type for better readability.
726
+ *
727
+ * Hint: This type has no effect and is only used so that TypeScript displays
728
+ * the final type in the preview instead of the utility types used.
729
+ */
730
+ type Prettify<TObject> = { [TKey in keyof TObject]: TObject[TKey] } & {};
731
+ /**
732
+ * Marks specific keys as optional.
733
+ */
734
+ type MarkOptional<TObject, TKeys extends keyof TObject> = { [TKey in keyof TObject]?: unknown } & Omit<TObject, TKeys> & Partial<Pick<TObject, TKeys>>;
735
+ /**
736
+ * Merges two objects. Overlapping entries from the second object overwrite
737
+ * properties from the first object.
738
+ */
739
+
740
+ /**
741
+ * Extracts first tuple item.
742
+ */
743
+ type FirstTupleItem<TTuple extends readonly [unknown, ...unknown[]]> = TTuple[0];
744
+ /**
745
+ * Extracts last tuple item.
746
+ */
747
+ type LastTupleItem<TTuple extends readonly [unknown, ...unknown[]]> = TTuple[TTuple extends readonly [unknown, ...infer TRest] ? TRest['length'] : never];
748
+ /**
749
+ * Converts union to intersection type.
750
+ */
751
+
752
+ /**
753
+ * Error message type.
754
+ */
755
+ type ErrorMessage<TIssue extends BaseIssue<unknown>> = ((issue: TIssue) => string) | string;
756
+ /**
757
+ * Default type.
758
+ */
759
+ type Default<TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, TInput$1 extends null | undefined> = MaybeReadonly<InferInput<TWrapped$1> | TInput$1> | ((dataset?: UnknownDataset, config?: Config<InferIssue<TWrapped$1>>) => MaybeReadonly<InferInput<TWrapped$1> | TInput$1>) | undefined;
760
+ /**
761
+ * Default async type.
762
+ */
763
+ type DefaultAsync<TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TInput$1 extends null | undefined> = MaybeReadonly<InferInput<TWrapped$1> | TInput$1> | ((dataset?: UnknownDataset, config?: Config<InferIssue<TWrapped$1>>) => MaybePromise<MaybeReadonly<InferInput<TWrapped$1> | TInput$1>>) | undefined;
764
+ /**
765
+ * Default value type.
766
+ */
767
+ 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;
768
+
769
+ /**
770
+ * Optional entry schema type.
771
+ */
772
+ type OptionalEntrySchema = ExactOptionalSchema<BaseSchema<unknown, unknown, BaseIssue<unknown>>, unknown> | NullishSchema<BaseSchema<unknown, unknown, BaseIssue<unknown>>, unknown> | OptionalSchema<BaseSchema<unknown, unknown, BaseIssue<unknown>>, unknown>;
773
+ /**
774
+ * Optional entry schema async type.
775
+ */
776
+ 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>;
777
+ /**
778
+ * Object entries interface.
779
+ */
780
+ interface ObjectEntries {
781
+ [key: string]: BaseSchema<unknown, unknown, BaseIssue<unknown>> | SchemaWithFallback<BaseSchema<unknown, unknown, BaseIssue<unknown>>, unknown> | OptionalEntrySchema;
782
+ }
783
+ /**
784
+ * Object entries async interface.
785
+ */
786
+ interface ObjectEntriesAsync {
787
+ [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;
788
+ }
789
+ /**
790
+ * Object keys type.
791
+ */
792
+
793
+ /**
794
+ * Infer entries input type.
795
+ */
796
+ type InferEntriesInput<TEntries$1 extends ObjectEntries | ObjectEntriesAsync> = { -readonly [TKey in keyof TEntries$1]: InferInput<TEntries$1[TKey]> };
797
+ /**
798
+ * Infer entries output type.
799
+ */
800
+ type InferEntriesOutput<TEntries$1 extends ObjectEntries | ObjectEntriesAsync> = { -readonly [TKey in keyof TEntries$1]: InferOutput<TEntries$1[TKey]> };
801
+ /**
802
+ * Optional input keys type.
803
+ */
804
+ type OptionalInputKeys<TEntries$1 extends ObjectEntries | ObjectEntriesAsync> = { [TKey in keyof TEntries$1]: TEntries$1[TKey] extends OptionalEntrySchema | OptionalEntrySchemaAsync ? TKey : never }[keyof TEntries$1];
805
+ /**
806
+ * Optional output keys type.
807
+ */
808
+ type OptionalOutputKeys<TEntries$1 extends ObjectEntries | ObjectEntriesAsync> = { [TKey in keyof TEntries$1]: TEntries$1[TKey] extends OptionalEntrySchema | OptionalEntrySchemaAsync ? undefined extends TEntries$1[TKey]['default'] ? TKey : never : never }[keyof TEntries$1];
809
+ /**
810
+ * Input with question marks type.
811
+ */
812
+ type InputWithQuestionMarks<TEntries$1 extends ObjectEntries | ObjectEntriesAsync, TObject extends InferEntriesInput<TEntries$1>> = MarkOptional<TObject, OptionalInputKeys<TEntries$1>>;
813
+ /**
814
+ * Output with question marks type.
815
+ */
816
+ type OutputWithQuestionMarks<TEntries$1 extends ObjectEntries | ObjectEntriesAsync, TObject extends InferEntriesOutput<TEntries$1>> = MarkOptional<TObject, OptionalOutputKeys<TEntries$1>>;
817
+ /**
818
+ * Readonly output keys type.
819
+ */
820
+ type ReadonlyOutputKeys<TEntries$1 extends ObjectEntries | ObjectEntriesAsync> = { [TKey in keyof TEntries$1]: TEntries$1[TKey] extends SchemaWithPipe<infer TPipe> | SchemaWithPipeAsync<infer TPipe> ? ReadonlyAction<any> extends TPipe[number] ? TKey : never : never }[keyof TEntries$1];
821
+ /**
822
+ * Output with readonly type.
823
+ */
824
+ type OutputWithReadonly<TEntries$1 extends ObjectEntries | ObjectEntriesAsync, TObject extends OutputWithQuestionMarks<TEntries$1, InferEntriesOutput<TEntries$1>>> = Readonly<TObject> & Pick<TObject, Exclude<keyof TObject, ReadonlyOutputKeys<TEntries$1>>>;
825
+ /**
826
+ * Infer object input type.
827
+ */
828
+ type InferObjectInput<TEntries$1 extends ObjectEntries | ObjectEntriesAsync> = Prettify<InputWithQuestionMarks<TEntries$1, InferEntriesInput<TEntries$1>>>;
829
+ /**
830
+ * Infer object output type.
831
+ */
832
+ type InferObjectOutput<TEntries$1 extends ObjectEntries | ObjectEntriesAsync> = Prettify<OutputWithReadonly<TEntries$1, OutputWithQuestionMarks<TEntries$1, InferEntriesOutput<TEntries$1>>>>;
833
+ /**
834
+ * Infer object issue type.
835
+ */
836
+ type InferObjectIssue<TEntries$1 extends ObjectEntries | ObjectEntriesAsync> = InferIssue<TEntries$1[keyof TEntries$1]>;
837
+
838
+ /**
839
+ * Tuple items type.
840
+ */
841
+
842
+ /**
843
+ * Array path item interface.
844
+ */
845
+ interface ArrayPathItem {
846
+ /**
847
+ * The path item type.
848
+ */
849
+ readonly type: 'array';
850
+ /**
851
+ * The path item origin.
852
+ */
853
+ readonly origin: 'value';
854
+ /**
855
+ * The path item input.
856
+ */
857
+ readonly input: MaybeReadonly<unknown[]>;
858
+ /**
859
+ * The path item key.
860
+ */
861
+ readonly key: number;
862
+ /**
863
+ * The path item value.
864
+ */
865
+ readonly value: unknown;
866
+ }
867
+ /**
868
+ * Map path item interface.
869
+ */
870
+ interface MapPathItem {
871
+ /**
872
+ * The path item type.
873
+ */
874
+ readonly type: 'map';
875
+ /**
876
+ * The path item origin.
877
+ */
878
+ readonly origin: 'key' | 'value';
879
+ /**
880
+ * The path item input.
881
+ */
882
+ readonly input: Map<unknown, unknown>;
883
+ /**
884
+ * The path item key.
885
+ */
886
+ readonly key: unknown;
887
+ /**
888
+ * The path item value.
889
+ */
890
+ readonly value: unknown;
891
+ }
892
+ /**
893
+ * Object path item interface.
894
+ */
895
+ interface ObjectPathItem {
896
+ /**
897
+ * The path item type.
898
+ */
899
+ readonly type: 'object';
900
+ /**
901
+ * The path item origin.
902
+ */
903
+ readonly origin: 'key' | 'value';
904
+ /**
905
+ * The path item input.
906
+ */
907
+ readonly input: Record<string, unknown>;
908
+ /**
909
+ * The path item key.
910
+ */
911
+ readonly key: string;
912
+ /**
913
+ * The path item value.
914
+ */
915
+ readonly value: unknown;
916
+ }
917
+ /**
918
+ * Set path item interface.
919
+ */
920
+ interface SetPathItem {
921
+ /**
922
+ * The path item type.
923
+ */
924
+ readonly type: 'set';
925
+ /**
926
+ * The path item origin.
927
+ */
928
+ readonly origin: 'value';
929
+ /**
930
+ * The path item input.
931
+ */
932
+ readonly input: Set<unknown>;
933
+ /**
934
+ * The path item key.
935
+ */
936
+ readonly key: null;
937
+ /**
938
+ * The path item key.
939
+ */
940
+ readonly value: unknown;
941
+ }
942
+ /**
943
+ * Unknown path item interface.
944
+ */
945
+ interface UnknownPathItem {
946
+ /**
947
+ * The path item type.
948
+ */
949
+ readonly type: 'unknown';
950
+ /**
951
+ * The path item origin.
952
+ */
953
+ readonly origin: 'key' | 'value';
954
+ /**
955
+ * The path item input.
956
+ */
957
+ readonly input: unknown;
958
+ /**
959
+ * The path item key.
960
+ */
961
+ readonly key: unknown;
962
+ /**
963
+ * The path item value.
964
+ */
965
+ readonly value: unknown;
966
+ }
967
+ /**
968
+ * Issue path item type.
969
+ */
970
+ type IssuePathItem = ArrayPathItem | MapPathItem | ObjectPathItem | SetPathItem | UnknownPathItem;
971
+ /**
972
+ * Base issue interface.
973
+ */
974
+ interface BaseIssue<TInput$1> extends Config<BaseIssue<TInput$1>> {
975
+ /**
976
+ * The issue kind.
977
+ */
978
+ readonly kind: 'schema' | 'validation' | 'transformation';
979
+ /**
980
+ * The issue type.
981
+ */
982
+ readonly type: string;
983
+ /**
984
+ * The raw input data.
985
+ */
986
+ readonly input: TInput$1;
987
+ /**
988
+ * The expected property.
989
+ */
990
+ readonly expected: string | null;
991
+ /**
992
+ * The received property.
993
+ */
994
+ readonly received: string;
995
+ /**
996
+ * The error message.
997
+ */
998
+ readonly message: string;
999
+ /**
1000
+ * The input requirement.
1001
+ */
1002
+ readonly requirement?: unknown | undefined;
1003
+ /**
1004
+ * The issue path.
1005
+ */
1006
+ readonly path?: [IssuePathItem, ...IssuePathItem[]] | undefined;
1007
+ /**
1008
+ * The sub issues.
1009
+ */
1010
+ readonly issues?: [BaseIssue<TInput$1>, ...BaseIssue<TInput$1>[]] | undefined;
1011
+ }
1012
+ /**
1013
+ * Generic issue type.
1014
+ */
1015
+
1016
+ /**
1017
+ * Config interface.
1018
+ */
1019
+ interface Config<TIssue extends BaseIssue<unknown>> {
1020
+ /**
1021
+ * The selected language.
1022
+ */
1023
+ readonly lang?: string | undefined;
1024
+ /**
1025
+ * The error message.
1026
+ */
1027
+ readonly message?: ErrorMessage<TIssue> | undefined;
1028
+ /**
1029
+ * Whether it should be aborted early.
1030
+ */
1031
+ readonly abortEarly?: boolean | undefined;
1032
+ /**
1033
+ * Whether a pipe should be aborted early.
1034
+ */
1035
+ readonly abortPipeEarly?: boolean | undefined;
1036
+ }
1037
+
1038
+ /**
1039
+ * Pipe action type.
1040
+ */
1041
+ type PipeAction<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> = BaseValidation<TInput$1, TOutput$1, TIssue> | BaseTransformation<TInput$1, TOutput$1, TIssue> | BaseMetadata<TInput$1>;
1042
+ /**
1043
+ * Pipe action async type.
1044
+ */
1045
+ type PipeActionAsync<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> = BaseValidationAsync<TInput$1, TOutput$1, TIssue> | BaseTransformationAsync<TInput$1, TOutput$1, TIssue>;
1046
+ /**
1047
+ * Pipe item type.
1048
+ */
1049
+ type PipeItem<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> = BaseSchema<TInput$1, TOutput$1, TIssue> | PipeAction<TInput$1, TOutput$1, TIssue>;
1050
+ /**
1051
+ * Pipe item async type.
1052
+ */
1053
+ type PipeItemAsync<TInput$1, TOutput$1, TIssue extends BaseIssue<unknown>> = BaseSchemaAsync<TInput$1, TOutput$1, TIssue> | PipeActionAsync<TInput$1, TOutput$1, TIssue>;
1054
+ /**
1055
+ * Schema without pipe type.
1056
+ */
1057
+
1058
+ /**
1059
+ * Array issue interface.
1060
+ */
1061
+ interface ArrayIssue extends BaseIssue<unknown> {
1062
+ /**
1063
+ * The issue kind.
1064
+ */
1065
+ readonly kind: 'schema';
1066
+ /**
1067
+ * The issue type.
1068
+ */
1069
+ readonly type: 'array';
1070
+ /**
1071
+ * The expected property.
1072
+ */
1073
+ readonly expected: 'Array';
1074
+ }
1075
+
1076
+ /**
1077
+ * Array schema interface.
1078
+ */
1079
+ interface ArraySchema<TItem$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, TMessage extends ErrorMessage<ArrayIssue> | undefined> extends BaseSchema<InferInput<TItem$1>[], InferOutput<TItem$1>[], ArrayIssue | InferIssue<TItem$1>> {
1080
+ /**
1081
+ * The schema type.
1082
+ */
1083
+ readonly type: 'array';
1084
+ /**
1085
+ * The schema reference.
1086
+ */
1087
+ readonly reference: typeof array;
1088
+ /**
1089
+ * The expected property.
1090
+ */
1091
+ readonly expects: 'Array';
1092
+ /**
1093
+ * The array item schema.
1094
+ */
1095
+ readonly item: TItem$1;
1096
+ /**
1097
+ * The error message.
1098
+ */
1099
+ readonly message: TMessage;
1100
+ }
1101
+ /**
1102
+ * Creates an array schema.
1103
+ *
1104
+ * @param item The item schema.
1105
+ *
1106
+ * @returns An array schema.
1107
+ */
1108
+ declare function array<const TItem$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>>>(item: TItem$1): ArraySchema<TItem$1, undefined>;
1109
+ /**
1110
+ * Creates an array schema.
1111
+ *
1112
+ * @param item The item schema.
1113
+ * @param message The error message.
1114
+ *
1115
+ * @returns An array schema.
1116
+ */
1117
+ declare function array<const TItem$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, const TMessage extends ErrorMessage<ArrayIssue> | undefined>(item: TItem$1, message: TMessage): ArraySchema<TItem$1, TMessage>;
1118
+
1119
+ /**
1120
+ * Array schema interface.
1121
+ */
1122
+
1123
+ /**
1124
+ * Boolean issue interface.
1125
+ */
1126
+ interface BooleanIssue extends BaseIssue<unknown> {
1127
+ /**
1128
+ * The issue kind.
1129
+ */
1130
+ readonly kind: 'schema';
1131
+ /**
1132
+ * The issue type.
1133
+ */
1134
+ readonly type: 'boolean';
1135
+ /**
1136
+ * The expected property.
1137
+ */
1138
+ readonly expected: 'boolean';
1139
+ }
1140
+ /**
1141
+ * Boolean schema interface.
1142
+ */
1143
+ interface BooleanSchema<TMessage extends ErrorMessage<BooleanIssue> | undefined> extends BaseSchema<boolean, boolean, BooleanIssue> {
1144
+ /**
1145
+ * The schema type.
1146
+ */
1147
+ readonly type: 'boolean';
1148
+ /**
1149
+ * The schema reference.
1150
+ */
1151
+ readonly reference: typeof boolean;
1152
+ /**
1153
+ * The expected property.
1154
+ */
1155
+ readonly expects: 'boolean';
1156
+ /**
1157
+ * The error message.
1158
+ */
1159
+ readonly message: TMessage;
1160
+ }
1161
+ /**
1162
+ * Creates a boolean schema.
1163
+ *
1164
+ * @returns A boolean schema.
1165
+ */
1166
+ declare function boolean(): BooleanSchema<undefined>;
1167
+ /**
1168
+ * Creates a boolean schema.
1169
+ *
1170
+ * @param message The error message.
1171
+ *
1172
+ * @returns A boolean schema.
1173
+ */
1174
+ declare function boolean<const TMessage extends ErrorMessage<BooleanIssue> | undefined>(message: TMessage): BooleanSchema<TMessage>;
1175
+
1176
+ /**
1177
+ * Custom issue interface.
1178
+ */
1179
+
1180
+ /**
1181
+ * Exact optional schema interface.
1182
+ */
1183
+ interface ExactOptionalSchema<TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, TDefault extends Default<TWrapped$1, never>> extends BaseSchema<InferInput<TWrapped$1>, InferOutput<TWrapped$1>, InferIssue<TWrapped$1>> {
1184
+ /**
1185
+ * The schema type.
1186
+ */
1187
+ readonly type: 'exact_optional';
1188
+ /**
1189
+ * The schema reference.
1190
+ */
1191
+ readonly reference: typeof exactOptional;
1192
+ /**
1193
+ * The expected property.
1194
+ */
1195
+ readonly expects: TWrapped$1['expects'];
1196
+ /**
1197
+ * The wrapped schema.
1198
+ */
1199
+ readonly wrapped: TWrapped$1;
1200
+ /**
1201
+ * The default value.
1202
+ */
1203
+ readonly default: TDefault;
1204
+ }
1205
+ /**
1206
+ * Creates an exact optional schema.
1207
+ *
1208
+ * @param wrapped The wrapped schema.
1209
+ *
1210
+ * @returns An exact optional schema.
1211
+ */
1212
+ declare function exactOptional<const TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>>>(wrapped: TWrapped$1): ExactOptionalSchema<TWrapped$1, undefined>;
1213
+ /**
1214
+ * Creates an exact optional schema.
1215
+ *
1216
+ * @param wrapped The wrapped schema.
1217
+ * @param default_ The default value.
1218
+ *
1219
+ * @returns An exact optional schema.
1220
+ */
1221
+ declare function exactOptional<const TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, const TDefault extends Default<TWrapped$1, never>>(wrapped: TWrapped$1, default_: TDefault): ExactOptionalSchema<TWrapped$1, TDefault>;
1222
+
1223
+ /**
1224
+ * Exact optional schema async interface.
1225
+ */
1226
+ interface ExactOptionalSchemaAsync<TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TDefault extends DefaultAsync<TWrapped$1, never>> extends BaseSchemaAsync<InferInput<TWrapped$1>, InferOutput<TWrapped$1>, InferIssue<TWrapped$1>> {
1227
+ /**
1228
+ * The schema type.
1229
+ */
1230
+ readonly type: 'exact_optional';
1231
+ /**
1232
+ * The schema reference.
1233
+ */
1234
+ readonly reference: typeof exactOptional | typeof exactOptionalAsync;
1235
+ /**
1236
+ * The expected property.
1237
+ */
1238
+ readonly expects: TWrapped$1['expects'];
1239
+ /**
1240
+ * The wrapped schema.
1241
+ */
1242
+ readonly wrapped: TWrapped$1;
1243
+ /**
1244
+ * The default value.
1245
+ */
1246
+ readonly default: TDefault;
1247
+ }
1248
+ /**
1249
+ * Creates an exact optional schema.
1250
+ *
1251
+ * @param wrapped The wrapped schema.
1252
+ *
1253
+ * @returns An exact optional schema.
1254
+ */
1255
+ declare function exactOptionalAsync<const TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>>(wrapped: TWrapped$1): ExactOptionalSchemaAsync<TWrapped$1, undefined>;
1256
+ /**
1257
+ * Creates an exact optional schema.
1258
+ *
1259
+ * @param wrapped The wrapped schema.
1260
+ * @param default_ The default value.
1261
+ *
1262
+ * @returns An exact optional schema.
1263
+ */
1264
+ declare function exactOptionalAsync<const TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, const TDefault extends DefaultAsync<TWrapped$1, never>>(wrapped: TWrapped$1, default_: TDefault): ExactOptionalSchemaAsync<TWrapped$1, TDefault>;
1265
+
1266
+ /**
1267
+ * File issue interface.
1268
+ */
1269
+
1270
+ /**
1271
+ * Union issue interface.
1272
+ */
1273
+ interface UnionIssue<TSubIssue extends BaseIssue<unknown>> extends BaseIssue<unknown> {
1274
+ /**
1275
+ * The issue kind.
1276
+ */
1277
+ readonly kind: 'schema';
1278
+ /**
1279
+ * The issue type.
1280
+ */
1281
+ readonly type: 'union';
1282
+ /**
1283
+ * The expected property.
1284
+ */
1285
+ readonly expected: string;
1286
+ /**
1287
+ * The sub issues.
1288
+ */
1289
+ readonly issues?: [TSubIssue, ...TSubIssue[]];
1290
+ }
1291
+
1292
+ /**
1293
+ * Union options type.
1294
+ */
1295
+ type UnionOptions = MaybeReadonly<BaseSchema<unknown, unknown, BaseIssue<unknown>>[]>;
1296
+ /**
1297
+ * Union schema interface.
1298
+ */
1299
+ interface UnionSchema<TOptions$1 extends UnionOptions, TMessage extends ErrorMessage<UnionIssue<InferIssue<TOptions$1[number]>>> | undefined> extends BaseSchema<InferInput<TOptions$1[number]>, InferOutput<TOptions$1[number]>, UnionIssue<InferIssue<TOptions$1[number]>> | InferIssue<TOptions$1[number]>> {
1300
+ /**
1301
+ * The schema type.
1302
+ */
1303
+ readonly type: 'union';
1304
+ /**
1305
+ * The schema reference.
1306
+ */
1307
+ readonly reference: typeof union;
1308
+ /**
1309
+ * The union options.
1310
+ */
1311
+ readonly options: TOptions$1;
1312
+ /**
1313
+ * The error message.
1314
+ */
1315
+ readonly message: TMessage;
1316
+ }
1317
+ /**
1318
+ * Creates an union schema.
1319
+ *
1320
+ * @param options The union options.
1321
+ *
1322
+ * @returns An union schema.
1323
+ */
1324
+ declare function union<const TOptions$1 extends UnionOptions>(options: TOptions$1): UnionSchema<TOptions$1, undefined>;
1325
+ /**
1326
+ * Creates an union schema.
1327
+ *
1328
+ * @param options The union options.
1329
+ * @param message The error message.
1330
+ *
1331
+ * @returns An union schema.
1332
+ */
1333
+ declare function union<const TOptions$1 extends UnionOptions, const TMessage extends ErrorMessage<UnionIssue<InferIssue<TOptions$1[number]>>> | undefined>(options: TOptions$1, message: TMessage): UnionSchema<TOptions$1, TMessage>;
1334
+
1335
+ /**
1336
+ * Union options async type.
1337
+ */
1338
+
1339
+ /**
1340
+ * Infer nullish output type.
1341
+ */
1342
+ type InferNullishOutput<TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TDefault extends DefaultAsync<TWrapped$1, null | undefined>> = undefined extends TDefault ? InferOutput<TWrapped$1> | null | undefined : InferOutput<TWrapped$1> | Extract<DefaultValue<TDefault>, null | undefined>;
1343
+
1344
+ /**
1345
+ * Nullish schema interface.
1346
+ */
1347
+ interface NullishSchema<TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, TDefault extends Default<TWrapped$1, null | undefined>> extends BaseSchema<InferInput<TWrapped$1> | null | undefined, InferNullishOutput<TWrapped$1, TDefault>, InferIssue<TWrapped$1>> {
1348
+ /**
1349
+ * The schema type.
1350
+ */
1351
+ readonly type: 'nullish';
1352
+ /**
1353
+ * The schema reference.
1354
+ */
1355
+ readonly reference: typeof nullish;
1356
+ /**
1357
+ * The expected property.
1358
+ */
1359
+ readonly expects: `(${TWrapped$1['expects']} | null | undefined)`;
1360
+ /**
1361
+ * The wrapped schema.
1362
+ */
1363
+ readonly wrapped: TWrapped$1;
1364
+ /**
1365
+ * The default value.
1366
+ */
1367
+ readonly default: TDefault;
1368
+ }
1369
+ /**
1370
+ * Creates a nullish schema.
1371
+ *
1372
+ * @param wrapped The wrapped schema.
1373
+ *
1374
+ * @returns A nullish schema.
1375
+ */
1376
+ declare function nullish<const TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>>>(wrapped: TWrapped$1): NullishSchema<TWrapped$1, undefined>;
1377
+ /**
1378
+ * Creates a nullish schema.
1379
+ *
1380
+ * @param wrapped The wrapped schema.
1381
+ * @param default_ The default value.
1382
+ *
1383
+ * @returns A nullish schema.
1384
+ */
1385
+ declare function nullish<const TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, const TDefault extends Default<TWrapped$1, null | undefined>>(wrapped: TWrapped$1, default_: TDefault): NullishSchema<TWrapped$1, TDefault>;
1386
+
1387
+ /**
1388
+ * Nullish schema async interface.
1389
+ */
1390
+ interface NullishSchemaAsync<TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TDefault extends DefaultAsync<TWrapped$1, null | undefined>> extends BaseSchemaAsync<InferInput<TWrapped$1> | null | undefined, InferNullishOutput<TWrapped$1, TDefault>, InferIssue<TWrapped$1>> {
1391
+ /**
1392
+ * The schema type.
1393
+ */
1394
+ readonly type: 'nullish';
1395
+ /**
1396
+ * The schema reference.
1397
+ */
1398
+ readonly reference: typeof nullish | typeof nullishAsync;
1399
+ /**
1400
+ * The expected property.
1401
+ */
1402
+ readonly expects: `(${TWrapped$1['expects']} | null | undefined)`;
1403
+ /**
1404
+ * The wrapped schema.
1405
+ */
1406
+ readonly wrapped: TWrapped$1;
1407
+ /**
1408
+ * The default value.
1409
+ */
1410
+ readonly default: TDefault;
1411
+ }
1412
+ /**
1413
+ * Creates a nullish schema.
1414
+ *
1415
+ * @param wrapped The wrapped schema.
1416
+ *
1417
+ * @returns A nullish schema.
1418
+ */
1419
+ declare function nullishAsync<const TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>>(wrapped: TWrapped$1): NullishSchemaAsync<TWrapped$1, undefined>;
1420
+ /**
1421
+ * Creates a nullish schema.
1422
+ *
1423
+ * @param wrapped The wrapped schema.
1424
+ * @param default_ The default value.
1425
+ *
1426
+ * @returns A nullish schema.
1427
+ */
1428
+ declare function nullishAsync<const TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, const TDefault extends DefaultAsync<TWrapped$1, null | undefined>>(wrapped: TWrapped$1, default_: TDefault): NullishSchemaAsync<TWrapped$1, TDefault>;
1429
+
1430
+ /**
1431
+ * Number issue interface.
1432
+ */
1433
+ interface NumberIssue extends BaseIssue<unknown> {
1434
+ /**
1435
+ * The issue kind.
1436
+ */
1437
+ readonly kind: 'schema';
1438
+ /**
1439
+ * The issue type.
1440
+ */
1441
+ readonly type: 'number';
1442
+ /**
1443
+ * The expected property.
1444
+ */
1445
+ readonly expected: 'number';
1446
+ }
1447
+ /**
1448
+ * Number schema interface.
1449
+ */
1450
+ interface NumberSchema<TMessage extends ErrorMessage<NumberIssue> | undefined> extends BaseSchema<number, number, NumberIssue> {
1451
+ /**
1452
+ * The schema type.
1453
+ */
1454
+ readonly type: 'number';
1455
+ /**
1456
+ * The schema reference.
1457
+ */
1458
+ readonly reference: typeof number;
1459
+ /**
1460
+ * The expected property.
1461
+ */
1462
+ readonly expects: 'number';
1463
+ /**
1464
+ * The error message.
1465
+ */
1466
+ readonly message: TMessage;
1467
+ }
1468
+ /**
1469
+ * Creates a number schema.
1470
+ *
1471
+ * @returns A number schema.
1472
+ */
1473
+ declare function number(): NumberSchema<undefined>;
1474
+ /**
1475
+ * Creates a number schema.
1476
+ *
1477
+ * @param message The error message.
1478
+ *
1479
+ * @returns A number schema.
1480
+ */
1481
+ declare function number<const TMessage extends ErrorMessage<NumberIssue> | undefined>(message: TMessage): NumberSchema<TMessage>;
1482
+
1483
+ /**
1484
+ * Object issue interface.
1485
+ */
1486
+ interface ObjectIssue extends BaseIssue<unknown> {
1487
+ /**
1488
+ * The issue kind.
1489
+ */
1490
+ readonly kind: 'schema';
1491
+ /**
1492
+ * The issue type.
1493
+ */
1494
+ readonly type: 'object';
1495
+ /**
1496
+ * The expected property.
1497
+ */
1498
+ readonly expected: 'Object' | `"${string}"`;
1499
+ }
1500
+
1501
+ /**
1502
+ * Object schema interface.
1503
+ */
1504
+ interface ObjectSchema<TEntries$1 extends ObjectEntries, TMessage extends ErrorMessage<ObjectIssue> | undefined> extends BaseSchema<InferObjectInput<TEntries$1>, InferObjectOutput<TEntries$1>, ObjectIssue | InferObjectIssue<TEntries$1>> {
1505
+ /**
1506
+ * The schema type.
1507
+ */
1508
+ readonly type: 'object';
1509
+ /**
1510
+ * The schema reference.
1511
+ */
1512
+ readonly reference: typeof object;
1513
+ /**
1514
+ * The expected property.
1515
+ */
1516
+ readonly expects: 'Object';
1517
+ /**
1518
+ * The entries schema.
1519
+ */
1520
+ readonly entries: TEntries$1;
1521
+ /**
1522
+ * The error message.
1523
+ */
1524
+ readonly message: TMessage;
1525
+ }
1526
+ /**
1527
+ * Creates an object schema.
1528
+ *
1529
+ * Hint: This schema removes unknown entries. The output will only include the
1530
+ * entries you specify. To include unknown entries, use `looseObject`. To
1531
+ * return an issue for unknown entries, use `strictObject`. To include and
1532
+ * validate unknown entries, use `objectWithRest`.
1533
+ *
1534
+ * @param entries The entries schema.
1535
+ *
1536
+ * @returns An object schema.
1537
+ */
1538
+ declare function object<const TEntries$1 extends ObjectEntries>(entries: TEntries$1): ObjectSchema<TEntries$1, undefined>;
1539
+ /**
1540
+ * Creates an object schema.
1541
+ *
1542
+ * Hint: This schema removes unknown entries. The output will only include the
1543
+ * entries you specify. To include unknown entries, use `looseObject`. To
1544
+ * return an issue for unknown entries, use `strictObject`. To include and
1545
+ * validate unknown entries, use `objectWithRest`.
1546
+ *
1547
+ * @param entries The entries schema.
1548
+ * @param message The error message.
1549
+ *
1550
+ * @returns An object schema.
1551
+ */
1552
+ declare function object<const TEntries$1 extends ObjectEntries, const TMessage extends ErrorMessage<ObjectIssue> | undefined>(entries: TEntries$1, message: TMessage): ObjectSchema<TEntries$1, TMessage>;
1553
+
1554
+ /**
1555
+ * Object schema async interface.
1556
+ */
1557
+
1558
+ /**
1559
+ * Infer optional output type.
1560
+ */
1561
+ type InferOptionalOutput<TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TDefault extends DefaultAsync<TWrapped$1, undefined>> = undefined extends TDefault ? InferOutput<TWrapped$1> | undefined : InferOutput<TWrapped$1> | Extract<DefaultValue<TDefault>, undefined>;
1562
+
1563
+ /**
1564
+ * Optional schema interface.
1565
+ */
1566
+ interface OptionalSchema<TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, TDefault extends Default<TWrapped$1, undefined>> extends BaseSchema<InferInput<TWrapped$1> | undefined, InferOptionalOutput<TWrapped$1, TDefault>, InferIssue<TWrapped$1>> {
1567
+ /**
1568
+ * The schema type.
1569
+ */
1570
+ readonly type: 'optional';
1571
+ /**
1572
+ * The schema reference.
1573
+ */
1574
+ readonly reference: typeof optional;
1575
+ /**
1576
+ * The expected property.
1577
+ */
1578
+ readonly expects: `(${TWrapped$1['expects']} | undefined)`;
1579
+ /**
1580
+ * The wrapped schema.
1581
+ */
1582
+ readonly wrapped: TWrapped$1;
1583
+ /**
1584
+ * The default value.
1585
+ */
1586
+ readonly default: TDefault;
1587
+ }
1588
+ /**
1589
+ * Creates an optional schema.
1590
+ *
1591
+ * @param wrapped The wrapped schema.
1592
+ *
1593
+ * @returns An optional schema.
1594
+ */
1595
+ declare function optional<const TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>>>(wrapped: TWrapped$1): OptionalSchema<TWrapped$1, undefined>;
1596
+ /**
1597
+ * Creates an optional schema.
1598
+ *
1599
+ * @param wrapped The wrapped schema.
1600
+ * @param default_ The default value.
1601
+ *
1602
+ * @returns An optional schema.
1603
+ */
1604
+ declare function optional<const TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, const TDefault extends Default<TWrapped$1, undefined>>(wrapped: TWrapped$1, default_: TDefault): OptionalSchema<TWrapped$1, TDefault>;
1605
+
1606
+ /**
1607
+ * Optional schema async interface.
1608
+ */
1609
+ interface OptionalSchemaAsync<TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TDefault extends DefaultAsync<TWrapped$1, undefined>> extends BaseSchemaAsync<InferInput<TWrapped$1> | undefined, InferOptionalOutput<TWrapped$1, TDefault>, InferIssue<TWrapped$1>> {
1610
+ /**
1611
+ * The schema type.
1612
+ */
1613
+ readonly type: 'optional';
1614
+ /**
1615
+ * The schema reference.
1616
+ */
1617
+ readonly reference: typeof optional | typeof optionalAsync;
1618
+ /**
1619
+ * The expected property.
1620
+ */
1621
+ readonly expects: `(${TWrapped$1['expects']} | undefined)`;
1622
+ /**
1623
+ * The wrapped schema.
1624
+ */
1625
+ readonly wrapped: TWrapped$1;
1626
+ /**
1627
+ * The default value.
1628
+ */
1629
+ readonly default: TDefault;
1630
+ }
1631
+ /**
1632
+ * Creates an optional schema.
1633
+ *
1634
+ * @param wrapped The wrapped schema.
1635
+ *
1636
+ * @returns An optional schema.
1637
+ */
1638
+ declare function optionalAsync<const TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>>(wrapped: TWrapped$1): OptionalSchemaAsync<TWrapped$1, undefined>;
1639
+ /**
1640
+ * Creates an optional schema.
1641
+ *
1642
+ * @param wrapped The wrapped schema.
1643
+ * @param default_ The default value.
1644
+ *
1645
+ * @returns An optional schema.
1646
+ */
1647
+ declare function optionalAsync<const TWrapped$1 extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, const TDefault extends DefaultAsync<TWrapped$1, undefined>>(wrapped: TWrapped$1, default_: TDefault): OptionalSchemaAsync<TWrapped$1, TDefault>;
1648
+
1649
+ /**
1650
+ * Picklist options type.
1651
+ */
1652
+
1653
+ /**
1654
+ * String issue interface.
1655
+ */
1656
+ interface StringIssue extends BaseIssue<unknown> {
1657
+ /**
1658
+ * The issue kind.
1659
+ */
1660
+ readonly kind: 'schema';
1661
+ /**
1662
+ * The issue type.
1663
+ */
1664
+ readonly type: 'string';
1665
+ /**
1666
+ * The expected property.
1667
+ */
1668
+ readonly expected: 'string';
1669
+ }
1670
+ /**
1671
+ * String schema interface.
1672
+ */
1673
+ interface StringSchema<TMessage extends ErrorMessage<StringIssue> | undefined> extends BaseSchema<string, string, StringIssue> {
1674
+ /**
1675
+ * The schema type.
1676
+ */
1677
+ readonly type: 'string';
1678
+ /**
1679
+ * The schema reference.
1680
+ */
1681
+ readonly reference: typeof string;
1682
+ /**
1683
+ * The expected property.
1684
+ */
1685
+ readonly expects: 'string';
1686
+ /**
1687
+ * The error message.
1688
+ */
1689
+ readonly message: TMessage;
1690
+ }
1691
+ /**
1692
+ * Creates a string schema.
1693
+ *
1694
+ * @returns A string schema.
1695
+ */
1696
+ declare function string(): StringSchema<undefined>;
1697
+ /**
1698
+ * Creates a string schema.
1699
+ *
1700
+ * @param message The error message.
1701
+ *
1702
+ * @returns A string schema.
1703
+ */
1704
+ declare function string<const TMessage extends ErrorMessage<StringIssue> | undefined>(message: TMessage): StringSchema<TMessage>;
1705
+
1706
+ /**
1707
+ * Symbol issue interface.
1708
+ */
1709
+
1710
+ /**
1711
+ * Brand symbol.
1712
+ */
1713
+ declare const BrandSymbol: unique symbol;
1714
+ /**
1715
+ * Brand name type.
1716
+ */
1717
+ type BrandName = string | number | symbol;
1718
+ /**
1719
+ * Brand interface.
1720
+ */
1721
+ interface Brand<TName extends BrandName> {
1722
+ [BrandSymbol]: { [TValue in TName]: TValue };
1723
+ }
1724
+ /**
1725
+ * Brand action interface.
1726
+ */
1727
+ interface BrandAction<TInput$1, TName extends BrandName> extends BaseTransformation<TInput$1, TInput$1 & Brand<TName>, never> {
1728
+ /**
1729
+ * The action type.
1730
+ */
1731
+ readonly type: 'brand';
1732
+ /**
1733
+ * The action reference.
1734
+ */
1735
+ readonly reference: typeof brand;
1736
+ /**
1737
+ * The brand name.
1738
+ */
1739
+ readonly name: TName;
1740
+ }
1741
+ /**
1742
+ * Creates a brand transformation action.
1743
+ *
1744
+ * @param name The brand name.
1745
+ *
1746
+ * @returns A brand action.
1747
+ */
1748
+ declare function brand<TInput$1, TName extends BrandName>(name: TName): BrandAction<TInput$1, TName>;
1749
+
1750
+ /**
1751
+ * Bytes issue interface.
1752
+ */
1753
+
1754
+ /**
1755
+ * Length input type.
1756
+ */
1757
+ type LengthInput = string | ArrayLike<unknown>;
1758
+ /**
1759
+ * Size input type.
1760
+ */
1761
+
1762
+ /**
1763
+ * Min length issue interface.
1764
+ */
1765
+ interface MinLengthIssue<TInput$1 extends LengthInput, TRequirement extends number> extends BaseIssue<TInput$1> {
1766
+ /**
1767
+ * The issue kind.
1768
+ */
1769
+ readonly kind: 'validation';
1770
+ /**
1771
+ * The issue type.
1772
+ */
1773
+ readonly type: 'min_length';
1774
+ /**
1775
+ * The expected property.
1776
+ */
1777
+ readonly expected: `>=${TRequirement}`;
1778
+ /**
1779
+ * The received property.
1780
+ */
1781
+ readonly received: `${number}`;
1782
+ /**
1783
+ * The minimum length.
1784
+ */
1785
+ readonly requirement: TRequirement;
1786
+ }
1787
+ /**
1788
+ * Min length action interface.
1789
+ */
1790
+ interface MinLengthAction<TInput$1 extends LengthInput, TRequirement extends number, TMessage extends ErrorMessage<MinLengthIssue<TInput$1, TRequirement>> | undefined> extends BaseValidation<TInput$1, TInput$1, MinLengthIssue<TInput$1, TRequirement>> {
1791
+ /**
1792
+ * The action type.
1793
+ */
1794
+ readonly type: 'min_length';
1795
+ /**
1796
+ * The action reference.
1797
+ */
1798
+ readonly reference: typeof minLength;
1799
+ /**
1800
+ * The expected property.
1801
+ */
1802
+ readonly expects: `>=${TRequirement}`;
1803
+ /**
1804
+ * The minimum length.
1805
+ */
1806
+ readonly requirement: TRequirement;
1807
+ /**
1808
+ * The error message.
1809
+ */
1810
+ readonly message: TMessage;
1811
+ }
1812
+ /**
1813
+ * Creates a min length validation action.
1814
+ *
1815
+ * @param requirement The minimum length.
1816
+ *
1817
+ * @returns A min length action.
1818
+ */
1819
+ declare function minLength<TInput$1 extends LengthInput, const TRequirement extends number>(requirement: TRequirement): MinLengthAction<TInput$1, TRequirement, undefined>;
1820
+ /**
1821
+ * Creates a min length validation action.
1822
+ *
1823
+ * @param requirement The minimum length.
1824
+ * @param message The error message.
1825
+ *
1826
+ * @returns A min length action.
1827
+ */
1828
+ declare function minLength<TInput$1 extends LengthInput, const TRequirement extends number, const TMessage extends ErrorMessage<MinLengthIssue<TInput$1, TRequirement>> | undefined>(requirement: TRequirement, message: TMessage): MinLengthAction<TInput$1, TRequirement, TMessage>;
1829
+
1830
+ /**
1831
+ * Min size issue interface.
1832
+ */
1833
+
1834
+ /**
1835
+ * Readonly output type.
1836
+ */
1837
+ type ReadonlyOutput<TInput$1> = TInput$1 extends Map<infer TKey, infer TValue> ? ReadonlyMap<TKey, TValue> : TInput$1 extends Set<infer TValue> ? ReadonlySet<TValue> : Readonly<TInput$1>;
1838
+ /**
1839
+ * Readonly action interface.
1840
+ */
1841
+ interface ReadonlyAction<TInput$1> extends BaseTransformation<TInput$1, ReadonlyOutput<TInput$1>, never> {
1842
+ /**
1843
+ * The action type.
1844
+ */
1845
+ readonly type: 'readonly';
1846
+ /**
1847
+ * The action reference.
1848
+ */
1849
+ readonly reference: typeof readonly;
1850
+ }
1851
+ /**
1852
+ * Creates a readonly transformation action.
1853
+ *
1854
+ * @returns A readonly action.
1855
+ */
1856
+ declare function readonly<TInput$1>(): ReadonlyAction<TInput$1>;
1857
+
1858
+ /**
1859
+ * Array action type.
1860
+ */
1861
+
1862
+ /**
1863
+ * Regex issue interface.
1864
+ */
1865
+ interface RegexIssue<TInput$1 extends string> extends BaseIssue<TInput$1> {
1866
+ /**
1867
+ * The issue kind.
1868
+ */
1869
+ readonly kind: 'validation';
1870
+ /**
1871
+ * The issue type.
1872
+ */
1873
+ readonly type: 'regex';
1874
+ /**
1875
+ * The expected input.
1876
+ */
1877
+ readonly expected: string;
1878
+ /**
1879
+ * The received input.
1880
+ */
1881
+ readonly received: `"${string}"`;
1882
+ /**
1883
+ * The regex pattern.
1884
+ */
1885
+ readonly requirement: RegExp;
1886
+ }
1887
+ /**
1888
+ * Regex action interface.
1889
+ */
1890
+ interface RegexAction<TInput$1 extends string, TMessage extends ErrorMessage<RegexIssue<TInput$1>> | undefined> extends BaseValidation<TInput$1, TInput$1, RegexIssue<TInput$1>> {
1891
+ /**
1892
+ * The action type.
1893
+ */
1894
+ readonly type: 'regex';
1895
+ /**
1896
+ * The action reference.
1897
+ */
1898
+ readonly reference: typeof regex;
1899
+ /**
1900
+ * The expected property.
1901
+ */
1902
+ readonly expects: string;
1903
+ /**
1904
+ * The regex pattern.
1905
+ */
1906
+ readonly requirement: RegExp;
1907
+ /**
1908
+ * The error message.
1909
+ */
1910
+ readonly message: TMessage;
1911
+ }
1912
+ /**
1913
+ * Creates a [regex](https://en.wikipedia.org/wiki/Regular_expression) validation action.
1914
+ *
1915
+ * Hint: Be careful with the global flag `g` in your regex pattern, as it can lead to unexpected results. See [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test#using_test_on_a_regex_with_the_global_flag) for more information.
1916
+ *
1917
+ * @param requirement The regex pattern.
1918
+ *
1919
+ * @returns A regex action.
1920
+ */
1921
+ declare function regex<TInput$1 extends string>(requirement: RegExp): RegexAction<TInput$1, undefined>;
1922
+ /**
1923
+ * Creates a [regex](https://en.wikipedia.org/wiki/Regular_expression) validation action.
1924
+ *
1925
+ * Hint: Be careful with the global flag `g` in your regex pattern, as it can lead to unexpected results. See [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test#using_test_on_a_regex_with_the_global_flag) for more information.
1926
+ *
1927
+ * @param requirement The regex pattern.
1928
+ * @param message The error message.
1929
+ *
1930
+ * @returns A regex action.
1931
+ */
1932
+ declare function regex<TInput$1 extends string, const TMessage extends ErrorMessage<RegexIssue<TInput$1>> | undefined>(requirement: RegExp, message: TMessage): RegexAction<TInput$1, TMessage>;
1933
+
1934
+ /**
1935
+ * Returns action type.
1936
+ */
1937
+ //#endregion
1938
+ //#region src/_types.d.ts
1939
+ declare const monthlyDateSchema: SchemaWithPipe<readonly [StringSchema<undefined>, RegexAction<string, "Date must be in YYYY-MM format">, BrandAction<string, "MonthlyDate">]>;
1940
+ declare const weeklyDateSchema: SchemaWithPipe<readonly [StringSchema<undefined>, RegexAction<string, "Date must be in YYYY-MM-DD format">, BrandAction<string, "WeeklyDate">]>;
1941
+ type MonthlyDate = InferOutput<typeof monthlyDateSchema>;
1942
+ type WeeklyDate = InferOutput<typeof weeklyDateSchema>;
1943
+ type Bucket = MonthlyDate | WeeklyDate;
1944
+ /**
1945
+ * Available cost calculation modes
1946
+ * - auto: Use pre-calculated costs when available, otherwise calculate from tokens
1947
+ * - calculate: Always calculate costs from token counts using model pricing
1948
+ * - display: Always use pre-calculated costs, show 0 for missing costs
1949
+ */
1950
+ declare const CostModes: readonly ["auto", "calculate", "display"];
1951
+ /**
1952
+ * Union type for cost calculation modes
1953
+ */
1954
+ type CostMode = TupleToUnion<typeof CostModes>;
1955
+ /**
1956
+ * Available sort orders for data presentation
1957
+ */
1958
+ declare const SortOrders: readonly ["desc", "asc"];
1959
+ /**
1960
+ * Union type for sort order options
1961
+ */
1962
+ type SortOrder = TupleToUnion<typeof SortOrders>;
1963
+ //#endregion
1964
+ //#region src/_pricing-fetcher.d.ts
1965
+ declare class PricingFetcher extends LiteLLMPricingFetcher {
1966
+ #private;
1967
+ constructor(offline?: boolean, aliases?: Record<string, string>);
1968
+ resolveModel(modelName: string): string;
1969
+ }
1970
+ //#endregion
1971
+ //#region src/data-loader.d.ts
1972
+ /**
1973
+ * Get Claude data directories to search for usage data
1974
+ * When CLAUDE_CONFIG_DIR is set: uses only those paths
1975
+ * When not set: uses default paths (~/.config/claude and ~/.claude)
1976
+ * @returns Array of valid Claude data directory paths
1977
+ */
1978
+ declare function getClaudePaths(): string[];
1979
+ /**
1980
+ * Extract project name from Claude JSONL file path
1981
+ * @param jsonlPath - Absolute path to JSONL file
1982
+ * @returns Project name extracted from path, or "unknown" if malformed
1983
+ */
1984
+ declare function extractProjectFromPath(jsonlPath: string): string;
1985
+ /**
1986
+ * Valibot schema for validating Claude usage data from JSONL files
1987
+ */
1988
+ declare const usageDataSchema: ObjectSchema<{
1989
+ readonly cwd: OptionalSchema<StringSchema<undefined>, undefined>;
1990
+ readonly sessionId: OptionalSchema<SchemaWithPipe<readonly [StringSchema<undefined>, MinLengthAction<string, 1, "Session ID cannot be empty">, BrandAction<string, "SessionId">]>, undefined>;
1991
+ readonly timestamp: SchemaWithPipe<readonly [StringSchema<undefined>, RegexAction<string, "Invalid ISO timestamp">, BrandAction<string, "ISOTimestamp">]>;
1992
+ readonly version: OptionalSchema<SchemaWithPipe<readonly [StringSchema<undefined>, RegexAction<string, "Invalid version format">, BrandAction<string, "Version">]>, undefined>;
1993
+ readonly message: ObjectSchema<{
1994
+ readonly usage: ObjectSchema<{
1995
+ readonly input_tokens: NumberSchema<undefined>;
1996
+ readonly output_tokens: NumberSchema<undefined>;
1997
+ readonly cache_creation_input_tokens: OptionalSchema<NumberSchema<undefined>, undefined>;
1998
+ readonly cache_read_input_tokens: OptionalSchema<NumberSchema<undefined>, undefined>;
1999
+ }, undefined>;
2000
+ readonly model: OptionalSchema<SchemaWithPipe<readonly [StringSchema<undefined>, MinLengthAction<string, 1, "Model name cannot be empty">, BrandAction<string, "ModelName">]>, undefined>;
2001
+ readonly id: OptionalSchema<SchemaWithPipe<readonly [StringSchema<undefined>, MinLengthAction<string, 1, "Message ID cannot be empty">, BrandAction<string, "MessageId">]>, undefined>;
2002
+ readonly content: OptionalSchema<ArraySchema<ObjectSchema<{
2003
+ readonly text: OptionalSchema<StringSchema<undefined>, undefined>;
2004
+ }, undefined>, undefined>, undefined>;
2005
+ }, undefined>;
2006
+ readonly costUSD: OptionalSchema<NumberSchema<undefined>, undefined>;
2007
+ readonly requestId: OptionalSchema<SchemaWithPipe<readonly [StringSchema<undefined>, MinLengthAction<string, 1, "Request ID cannot be empty">, BrandAction<string, "RequestId">]>, undefined>;
2008
+ readonly isApiErrorMessage: OptionalSchema<BooleanSchema<undefined>, undefined>;
2009
+ }, undefined>;
2010
+ /**
2011
+ * Valibot schema for transcript usage data from Claude messages
2012
+ */
2013
+ declare const transcriptUsageSchema: ObjectSchema<{
2014
+ readonly input_tokens: OptionalSchema<NumberSchema<undefined>, undefined>;
2015
+ readonly cache_creation_input_tokens: OptionalSchema<NumberSchema<undefined>, undefined>;
2016
+ readonly cache_read_input_tokens: OptionalSchema<NumberSchema<undefined>, undefined>;
2017
+ readonly output_tokens: OptionalSchema<NumberSchema<undefined>, undefined>;
2018
+ }, undefined>;
2019
+ /**
2020
+ * Valibot schema for transcript message data
2021
+ */
2022
+ declare const transcriptMessageSchema: ObjectSchema<{
2023
+ readonly type: OptionalSchema<StringSchema<undefined>, undefined>;
2024
+ readonly message: OptionalSchema<ObjectSchema<{
2025
+ readonly usage: OptionalSchema<ObjectSchema<{
2026
+ readonly input_tokens: OptionalSchema<NumberSchema<undefined>, undefined>;
2027
+ readonly cache_creation_input_tokens: OptionalSchema<NumberSchema<undefined>, undefined>;
2028
+ readonly cache_read_input_tokens: OptionalSchema<NumberSchema<undefined>, undefined>;
2029
+ readonly output_tokens: OptionalSchema<NumberSchema<undefined>, undefined>;
2030
+ }, undefined>, undefined>;
2031
+ }, undefined>, undefined>;
2032
+ }, undefined>;
2033
+ /**
2034
+ * Type definition for Claude usage data entries from JSONL files
2035
+ */
2036
+ type UsageData = InferOutput<typeof usageDataSchema>;
2037
+ /**
2038
+ * Valibot schema for model-specific usage breakdown data
2039
+ */
2040
+ declare const modelBreakdownSchema: ObjectSchema<{
2041
+ readonly modelName: SchemaWithPipe<readonly [StringSchema<undefined>, MinLengthAction<string, 1, "Model name cannot be empty">, BrandAction<string, "ModelName">]>;
2042
+ readonly inputTokens: NumberSchema<undefined>;
2043
+ readonly outputTokens: NumberSchema<undefined>;
2044
+ readonly cacheCreationTokens: NumberSchema<undefined>;
2045
+ readonly cacheReadTokens: NumberSchema<undefined>;
2046
+ readonly cost: NumberSchema<undefined>;
2047
+ }, undefined>;
2048
+ /**
2049
+ * Type definition for model-specific usage breakdown
2050
+ */
2051
+ type ModelBreakdown = InferOutput<typeof modelBreakdownSchema>;
2052
+ /**
2053
+ * Valibot schema for daily usage aggregation data
2054
+ */
2055
+ declare const dailyUsageSchema: ObjectSchema<{
2056
+ readonly date: SchemaWithPipe<readonly [StringSchema<undefined>, RegexAction<string, "Date must be in YYYY-MM-DD format">, BrandAction<string, "DailyDate">]>;
2057
+ readonly inputTokens: NumberSchema<undefined>;
2058
+ readonly outputTokens: NumberSchema<undefined>;
2059
+ readonly cacheCreationTokens: NumberSchema<undefined>;
2060
+ readonly cacheReadTokens: NumberSchema<undefined>;
2061
+ readonly totalCost: NumberSchema<undefined>;
2062
+ readonly modelsUsed: ArraySchema<SchemaWithPipe<readonly [StringSchema<undefined>, MinLengthAction<string, 1, "Model name cannot be empty">, BrandAction<string, "ModelName">]>, undefined>;
2063
+ readonly modelBreakdowns: ArraySchema<ObjectSchema<{
2064
+ readonly modelName: SchemaWithPipe<readonly [StringSchema<undefined>, MinLengthAction<string, 1, "Model name cannot be empty">, BrandAction<string, "ModelName">]>;
2065
+ readonly inputTokens: NumberSchema<undefined>;
2066
+ readonly outputTokens: NumberSchema<undefined>;
2067
+ readonly cacheCreationTokens: NumberSchema<undefined>;
2068
+ readonly cacheReadTokens: NumberSchema<undefined>;
2069
+ readonly cost: NumberSchema<undefined>;
2070
+ }, undefined>, undefined>;
2071
+ readonly project: OptionalSchema<StringSchema<undefined>, undefined>;
2072
+ }, undefined>;
2073
+ /**
2074
+ * Type definition for daily usage aggregation
2075
+ */
2076
+ type DailyUsage = InferOutput<typeof dailyUsageSchema>;
2077
+ /**
2078
+ * Valibot schema for session-based usage aggregation data
2079
+ */
2080
+ declare const sessionUsageSchema: ObjectSchema<{
2081
+ readonly sessionId: SchemaWithPipe<readonly [StringSchema<undefined>, MinLengthAction<string, 1, "Session ID cannot be empty">, BrandAction<string, "SessionId">]>;
2082
+ readonly projectPath: SchemaWithPipe<readonly [StringSchema<undefined>, MinLengthAction<string, 1, "Project path cannot be empty">, BrandAction<string, "ProjectPath">]>;
2083
+ readonly inputTokens: NumberSchema<undefined>;
2084
+ readonly outputTokens: NumberSchema<undefined>;
2085
+ readonly cacheCreationTokens: NumberSchema<undefined>;
2086
+ readonly cacheReadTokens: NumberSchema<undefined>;
2087
+ readonly totalCost: NumberSchema<undefined>;
2088
+ readonly lastActivity: SchemaWithPipe<readonly [StringSchema<undefined>, RegexAction<string, "Date must be in YYYY-MM-DD format">, BrandAction<string, "ActivityDate">]>;
2089
+ readonly versions: ArraySchema<SchemaWithPipe<readonly [StringSchema<undefined>, RegexAction<string, "Invalid version format">, BrandAction<string, "Version">]>, undefined>;
2090
+ readonly modelsUsed: ArraySchema<SchemaWithPipe<readonly [StringSchema<undefined>, MinLengthAction<string, 1, "Model name cannot be empty">, BrandAction<string, "ModelName">]>, undefined>;
2091
+ readonly modelBreakdowns: ArraySchema<ObjectSchema<{
2092
+ readonly modelName: SchemaWithPipe<readonly [StringSchema<undefined>, MinLengthAction<string, 1, "Model name cannot be empty">, BrandAction<string, "ModelName">]>;
2093
+ readonly inputTokens: NumberSchema<undefined>;
2094
+ readonly outputTokens: NumberSchema<undefined>;
2095
+ readonly cacheCreationTokens: NumberSchema<undefined>;
2096
+ readonly cacheReadTokens: NumberSchema<undefined>;
2097
+ readonly cost: NumberSchema<undefined>;
2098
+ }, undefined>, undefined>;
2099
+ }, undefined>;
2100
+ /**
2101
+ * Type definition for session-based usage aggregation
2102
+ */
2103
+ type SessionUsage = InferOutput<typeof sessionUsageSchema>;
2104
+ /**
2105
+ * Valibot schema for monthly usage aggregation data
2106
+ */
2107
+ declare const monthlyUsageSchema: ObjectSchema<{
2108
+ readonly month: SchemaWithPipe<readonly [StringSchema<undefined>, RegexAction<string, "Date must be in YYYY-MM format">, BrandAction<string, "MonthlyDate">]>;
2109
+ readonly inputTokens: NumberSchema<undefined>;
2110
+ readonly outputTokens: NumberSchema<undefined>;
2111
+ readonly cacheCreationTokens: NumberSchema<undefined>;
2112
+ readonly cacheReadTokens: NumberSchema<undefined>;
2113
+ readonly totalCost: NumberSchema<undefined>;
2114
+ readonly modelsUsed: ArraySchema<SchemaWithPipe<readonly [StringSchema<undefined>, MinLengthAction<string, 1, "Model name cannot be empty">, BrandAction<string, "ModelName">]>, undefined>;
2115
+ readonly modelBreakdowns: ArraySchema<ObjectSchema<{
2116
+ readonly modelName: SchemaWithPipe<readonly [StringSchema<undefined>, MinLengthAction<string, 1, "Model name cannot be empty">, BrandAction<string, "ModelName">]>;
2117
+ readonly inputTokens: NumberSchema<undefined>;
2118
+ readonly outputTokens: NumberSchema<undefined>;
2119
+ readonly cacheCreationTokens: NumberSchema<undefined>;
2120
+ readonly cacheReadTokens: NumberSchema<undefined>;
2121
+ readonly cost: NumberSchema<undefined>;
2122
+ }, undefined>, undefined>;
2123
+ readonly project: OptionalSchema<StringSchema<undefined>, undefined>;
2124
+ }, undefined>;
2125
+ /**
2126
+ * Type definition for monthly usage aggregation
2127
+ */
2128
+ type MonthlyUsage = InferOutput<typeof monthlyUsageSchema>;
2129
+ /**
2130
+ * Valibot schema for weekly usage aggregation data
2131
+ */
2132
+ declare const weeklyUsageSchema: ObjectSchema<{
2133
+ readonly week: SchemaWithPipe<readonly [StringSchema<undefined>, RegexAction<string, "Date must be in YYYY-MM-DD format">, BrandAction<string, "WeeklyDate">]>;
2134
+ readonly inputTokens: NumberSchema<undefined>;
2135
+ readonly outputTokens: NumberSchema<undefined>;
2136
+ readonly cacheCreationTokens: NumberSchema<undefined>;
2137
+ readonly cacheReadTokens: NumberSchema<undefined>;
2138
+ readonly totalCost: NumberSchema<undefined>;
2139
+ readonly modelsUsed: ArraySchema<SchemaWithPipe<readonly [StringSchema<undefined>, MinLengthAction<string, 1, "Model name cannot be empty">, BrandAction<string, "ModelName">]>, undefined>;
2140
+ readonly modelBreakdowns: ArraySchema<ObjectSchema<{
2141
+ readonly modelName: SchemaWithPipe<readonly [StringSchema<undefined>, MinLengthAction<string, 1, "Model name cannot be empty">, BrandAction<string, "ModelName">]>;
2142
+ readonly inputTokens: NumberSchema<undefined>;
2143
+ readonly outputTokens: NumberSchema<undefined>;
2144
+ readonly cacheCreationTokens: NumberSchema<undefined>;
2145
+ readonly cacheReadTokens: NumberSchema<undefined>;
2146
+ readonly cost: NumberSchema<undefined>;
2147
+ }, undefined>, undefined>;
2148
+ readonly project: OptionalSchema<StringSchema<undefined>, undefined>;
2149
+ }, undefined>;
2150
+ /**
2151
+ * Type definition for weekly usage aggregation
2152
+ */
2153
+ type WeeklyUsage = InferOutput<typeof weeklyUsageSchema>;
2154
+ /**
2155
+ * Valibot schema for bucket usage aggregation data
2156
+ */
2157
+ declare const bucketUsageSchema: ObjectSchema<{
2158
+ readonly bucket: UnionSchema<[SchemaWithPipe<readonly [StringSchema<undefined>, RegexAction<string, "Date must be in YYYY-MM-DD format">, BrandAction<string, "WeeklyDate">]>, SchemaWithPipe<readonly [StringSchema<undefined>, RegexAction<string, "Date must be in YYYY-MM format">, BrandAction<string, "MonthlyDate">]>], undefined>;
2159
+ readonly inputTokens: NumberSchema<undefined>;
2160
+ readonly outputTokens: NumberSchema<undefined>;
2161
+ readonly cacheCreationTokens: NumberSchema<undefined>;
2162
+ readonly cacheReadTokens: NumberSchema<undefined>;
2163
+ readonly totalCost: NumberSchema<undefined>;
2164
+ readonly modelsUsed: ArraySchema<SchemaWithPipe<readonly [StringSchema<undefined>, MinLengthAction<string, 1, "Model name cannot be empty">, BrandAction<string, "ModelName">]>, undefined>;
2165
+ readonly modelBreakdowns: ArraySchema<ObjectSchema<{
2166
+ readonly modelName: SchemaWithPipe<readonly [StringSchema<undefined>, MinLengthAction<string, 1, "Model name cannot be empty">, BrandAction<string, "ModelName">]>;
2167
+ readonly inputTokens: NumberSchema<undefined>;
2168
+ readonly outputTokens: NumberSchema<undefined>;
2169
+ readonly cacheCreationTokens: NumberSchema<undefined>;
2170
+ readonly cacheReadTokens: NumberSchema<undefined>;
2171
+ readonly cost: NumberSchema<undefined>;
2172
+ }, undefined>, undefined>;
2173
+ readonly project: OptionalSchema<StringSchema<undefined>, undefined>;
2174
+ }, undefined>;
2175
+ /**
2176
+ * Type definition for bucket usage aggregation
2177
+ */
2178
+ type BucketUsage = InferOutput<typeof bucketUsageSchema>;
2179
+ /**
2180
+ * Create a unique identifier for deduplication using message ID and request ID
2181
+ */
2182
+ declare function createUniqueHash(data: UsageData): string | null;
2183
+ /**
2184
+ * Extract the earliest timestamp from a JSONL file
2185
+ * Scans through the file until it finds a valid timestamp
2186
+ * Uses streaming to handle large files without loading entire content into memory
2187
+ */
2188
+ declare function getEarliestTimestamp(filePath: string): Promise<Date | null>;
2189
+ /**
2190
+ * Sort files by their earliest timestamp
2191
+ * Files without valid timestamps are placed at the end
2192
+ */
2193
+ declare function sortFilesByTimestamp(files: string[]): Promise<string[]>;
2194
+ /**
2195
+ * Calculates cost for a single usage data entry based on the specified cost calculation mode
2196
+ * @param data - Usage data entry
2197
+ * @param mode - Cost calculation mode (auto, calculate, or display)
2198
+ * @param fetcher - Pricing fetcher instance for calculating costs from tokens
2199
+ * @returns Calculated cost in USD
2200
+ */
2201
+ declare function calculateCostForEntry(data: UsageData, mode: CostMode, fetcher: PricingFetcher): Promise<number>;
2202
+ /**
2203
+ * Get Claude Code usage limit expiration date
2204
+ * @param data - Usage data entry
2205
+ * @returns Usage limit expiration date
2206
+ */
2207
+ declare function getUsageLimitResetTime(data: UsageData): Date | null;
2208
+ /**
2209
+ * Result of glob operation with base directory information
2210
+ */
2211
+ type GlobResult = {
2212
+ file: string;
2213
+ baseDir: string;
2214
+ };
2215
+ /**
2216
+ * Glob files from multiple Claude paths in parallel
2217
+ * @param claudePaths - Array of Claude base paths
2218
+ * @returns Array of file paths with their base directories
2219
+ */
2220
+ declare function globUsageFiles(claudePaths: string[]): Promise<GlobResult[]>;
2221
+ /**
2222
+ * Date range filter for limiting usage data by date
2223
+ */
2224
+ type DateFilter = {
2225
+ since?: string;
2226
+ until?: string;
2227
+ };
2228
+ /**
2229
+ * Configuration options for loading usage data
2230
+ */
2231
+ type LoadOptions = {
2232
+ claudePath?: string;
2233
+ mode?: CostMode;
2234
+ order?: SortOrder;
2235
+ offline?: boolean;
2236
+ sessionDurationHours?: number;
2237
+ groupByProject?: boolean;
2238
+ project?: string;
2239
+ startOfWeek?: WeekDay;
2240
+ timezone?: string;
2241
+ locale?: string;
2242
+ modelAliases?: Record<string, string>;
2243
+ } & DateFilter;
2244
+ /**
2245
+ * Loads and aggregates Claude usage data by day
2246
+ * Processes all JSONL files in the Claude projects directory and groups usage by date
2247
+ * @param options - Optional configuration for loading and filtering data
2248
+ * @returns Array of daily usage summaries sorted by date
2249
+ */
2250
+ declare function loadDailyUsageData(options?: LoadOptions): Promise<DailyUsage[]>;
2251
+ /**
2252
+ * Loads and aggregates Claude usage data by session
2253
+ * Groups usage data by project path and session ID based on file structure
2254
+ * @param options - Optional configuration for loading and filtering data
2255
+ * @returns Array of session usage summaries sorted by last activity
2256
+ */
2257
+ declare function loadSessionData(options?: LoadOptions): Promise<SessionUsage[]>;
2258
+ /**
2259
+ * Loads and aggregates Claude usage data by month
2260
+ * Uses daily usage data as the source and groups by month
2261
+ * @param options - Optional configuration for loading and filtering data
2262
+ * @returns Array of monthly usage summaries sorted by month
2263
+ */
2264
+ declare function loadMonthlyUsageData(options?: LoadOptions): Promise<MonthlyUsage[]>;
2265
+ declare function loadWeeklyUsageData(options?: LoadOptions): Promise<WeeklyUsage[]>;
2266
+ /**
2267
+ * Load usage data for a specific session by sessionId
2268
+ * Searches for a JSONL file named {sessionId}.jsonl in all Claude project directories
2269
+ * @param sessionId - The session ID to load data for (matches the JSONL filename)
2270
+ * @param options - Options for loading data
2271
+ * @param options.mode - Cost calculation mode (auto, calculate, display)
2272
+ * @param options.offline - Whether to use offline pricing data
2273
+ * @param options.modelAliases - Model name aliases for pricing lookup
2274
+ * @returns Usage data for the specific session or null if not found
2275
+ */
2276
+ declare function loadSessionUsageById(sessionId: string, options?: {
2277
+ mode?: CostMode;
2278
+ offline?: boolean;
2279
+ modelAliases?: Record<string, string>;
2280
+ }): Promise<{
2281
+ totalCost: number;
2282
+ entries: UsageData[];
2283
+ } | null>;
2284
+ declare function loadBucketUsageData(groupingFn: (data: DailyUsage) => Bucket, options?: LoadOptions): Promise<BucketUsage[]>;
2285
+ /**
2286
+ * Calculate context tokens from transcript file using improved JSONL parsing
2287
+ * Based on the Python reference implementation for better accuracy
2288
+ * @param transcriptPath - Path to the transcript JSONL file
2289
+ * @returns Object with context tokens info or null if unavailable
2290
+ */
2291
+ declare function calculateContextTokens(transcriptPath: string, modelId?: string, offline?: boolean): Promise<{
2292
+ inputTokens: number;
2293
+ percentage: number;
2294
+ contextLimit: number;
2295
+ } | null>;
2296
+ /**
2297
+ * Loads usage data and organizes it into session blocks (typically 5-hour billing periods)
2298
+ * Processes all usage data and groups it into time-based blocks for billing analysis
2299
+ * @param options - Optional configuration including session duration and filtering
2300
+ * @returns Array of session blocks with usage and cost information
2301
+ */
2302
+ declare function loadSessionBlockData(options?: LoadOptions): Promise<SessionBlock[]>;
2303
+ //#endregion
2304
+ export { sessionUsageSchema as A, loadMonthlyUsageData as C, loadWeeklyUsageData as D, loadSessionUsageById as E, weeklyUsageSchema as F, transcriptMessageSchema as M, transcriptUsageSchema as N, modelBreakdownSchema as O, usageDataSchema as P, loadDailyUsageData as S, loadSessionData as T, getClaudePaths as _, LoadOptions as a, globUsageFiles as b, SessionUsage as c, bucketUsageSchema as d, calculateContextTokens as f, extractProjectFromPath as g, dailyUsageSchema as h, GlobResult as i, sortFilesByTimestamp as j, monthlyUsageSchema as k, UsageData as l, createUniqueHash as m, DailyUsage as n, ModelBreakdown as o, calculateCostForEntry as p, DateFilter as r, MonthlyUsage as s, BucketUsage as t, WeeklyUsage as u, getEarliestTimestamp as v, loadSessionBlockData as w, loadBucketUsageData as x, getUsageLimitResetTime as y };