ccusage 0.4.0 → 0.4.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.
- package/dist/{calculate-cost-DMC4FhU4.js → calculate-cost-BnufbprY.js} +1 -1
- package/dist/calculate-cost.d.ts +5 -2
- package/dist/calculate-cost.js +1 -1
- package/dist/{data-loader-DlG6jpnf.js → data-loader-B8mdiY5r.js} +122 -1608
- package/dist/data-loader-DtCt7sNl.d.ts +56 -0
- package/dist/data-loader.d.ts +4 -1
- package/dist/data-loader.js +4 -1
- package/dist/debug-Oce2b5bO.js +142 -0
- package/dist/debug.d.ts +39 -0
- package/dist/debug.js +7 -0
- package/dist/dist-D6rk8Ra5.js +462 -0
- package/dist/{data-loader-D1LHcGfa.d.ts → index-Bazt8Nfd.d.ts} +323 -76
- package/dist/index.js +37 -267
- package/dist/logger-nCODI08N.js +977 -0
- package/dist/logger.d.ts +10 -0
- package/dist/logger.js +3 -0
- package/dist/pricing-fetcher-BqlslEH3.d.ts +21 -0
- package/dist/pricing-fetcher-bvi4lbXl.js +60 -0
- package/dist/pricing-fetcher.d.ts +3 -0
- package/dist/pricing-fetcher.js +5 -0
- package/dist/shared-args-DWaGio0e.js +61 -0
- package/dist/shared-args.d.ts +94 -0
- package/dist/shared-args.js +8 -0
- package/dist/types-BfZ5dOy7.d.ts +79 -0
- package/dist/types-DjlBTM5P.js +41 -0
- package/dist/types.d.ts +3 -0
- package/dist/types.js +4 -0
- package/dist/utils-BeihwpHn.js +10 -0
- package/dist/utils.d.ts +5 -0
- package/dist/utils.js +3 -0
- package/package.json +7 -1
- /package/dist/{prompt-_w55ddDU.js → prompt-BwcIpzWm.js} +0 -0
|
@@ -994,6 +994,63 @@ declare function array<const TItem extends BaseSchema<unknown, unknown, BaseIssu
|
|
|
994
994
|
* Array schema interface.
|
|
995
995
|
*/
|
|
996
996
|
|
|
997
|
+
/**
|
|
998
|
+
* Boolean issue interface.
|
|
999
|
+
*/
|
|
1000
|
+
interface BooleanIssue extends BaseIssue<unknown> {
|
|
1001
|
+
/**
|
|
1002
|
+
* The issue kind.
|
|
1003
|
+
*/
|
|
1004
|
+
readonly kind: 'schema';
|
|
1005
|
+
/**
|
|
1006
|
+
* The issue type.
|
|
1007
|
+
*/
|
|
1008
|
+
readonly type: 'boolean';
|
|
1009
|
+
/**
|
|
1010
|
+
* The expected property.
|
|
1011
|
+
*/
|
|
1012
|
+
readonly expected: 'boolean';
|
|
1013
|
+
}
|
|
1014
|
+
/**
|
|
1015
|
+
* Boolean schema interface.
|
|
1016
|
+
*/
|
|
1017
|
+
interface BooleanSchema<TMessage extends ErrorMessage<BooleanIssue> | undefined> extends BaseSchema<boolean, boolean, BooleanIssue> {
|
|
1018
|
+
/**
|
|
1019
|
+
* The schema type.
|
|
1020
|
+
*/
|
|
1021
|
+
readonly type: 'boolean';
|
|
1022
|
+
/**
|
|
1023
|
+
* The schema reference.
|
|
1024
|
+
*/
|
|
1025
|
+
readonly reference: typeof boolean;
|
|
1026
|
+
/**
|
|
1027
|
+
* The expected property.
|
|
1028
|
+
*/
|
|
1029
|
+
readonly expects: 'boolean';
|
|
1030
|
+
/**
|
|
1031
|
+
* The error message.
|
|
1032
|
+
*/
|
|
1033
|
+
readonly message: TMessage;
|
|
1034
|
+
}
|
|
1035
|
+
/**
|
|
1036
|
+
* Creates a boolean schema.
|
|
1037
|
+
*
|
|
1038
|
+
* @returns A boolean schema.
|
|
1039
|
+
*/
|
|
1040
|
+
declare function boolean(): BooleanSchema<undefined>;
|
|
1041
|
+
/**
|
|
1042
|
+
* Creates a boolean schema.
|
|
1043
|
+
*
|
|
1044
|
+
* @param message The error message.
|
|
1045
|
+
*
|
|
1046
|
+
* @returns A boolean schema.
|
|
1047
|
+
*/
|
|
1048
|
+
declare function boolean<const TMessage extends ErrorMessage<BooleanIssue> | undefined>(message: TMessage): BooleanSchema<TMessage>;
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* Custom issue interface.
|
|
1052
|
+
*/
|
|
1053
|
+
|
|
997
1054
|
/**
|
|
998
1055
|
* Exact optional schema interface.
|
|
999
1056
|
*/
|
|
@@ -1084,6 +1141,75 @@ declare function exactOptionalAsync<const TWrapped extends BaseSchema<unknown, u
|
|
|
1084
1141
|
* File issue interface.
|
|
1085
1142
|
*/
|
|
1086
1143
|
|
|
1144
|
+
/**
|
|
1145
|
+
* Union issue interface.
|
|
1146
|
+
*/
|
|
1147
|
+
interface UnionIssue<TSubIssue extends BaseIssue<unknown>> extends BaseIssue<unknown> {
|
|
1148
|
+
/**
|
|
1149
|
+
* The issue kind.
|
|
1150
|
+
*/
|
|
1151
|
+
readonly kind: 'schema';
|
|
1152
|
+
/**
|
|
1153
|
+
* The issue type.
|
|
1154
|
+
*/
|
|
1155
|
+
readonly type: 'union';
|
|
1156
|
+
/**
|
|
1157
|
+
* The expected property.
|
|
1158
|
+
*/
|
|
1159
|
+
readonly expected: string;
|
|
1160
|
+
/**
|
|
1161
|
+
* The sub issues.
|
|
1162
|
+
*/
|
|
1163
|
+
readonly issues?: [TSubIssue, ...TSubIssue[]];
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
/**
|
|
1167
|
+
* Union options type.
|
|
1168
|
+
*/
|
|
1169
|
+
type UnionOptions = MaybeReadonly<BaseSchema<unknown, unknown, BaseIssue<unknown>>[]>;
|
|
1170
|
+
/**
|
|
1171
|
+
* Union schema interface.
|
|
1172
|
+
*/
|
|
1173
|
+
interface UnionSchema<TOptions extends UnionOptions, TMessage extends ErrorMessage<UnionIssue<InferIssue<TOptions[number]>>> | undefined> extends BaseSchema<InferInput<TOptions[number]>, InferOutput<TOptions[number]>, UnionIssue<InferIssue<TOptions[number]>> | InferIssue<TOptions[number]>> {
|
|
1174
|
+
/**
|
|
1175
|
+
* The schema type.
|
|
1176
|
+
*/
|
|
1177
|
+
readonly type: 'union';
|
|
1178
|
+
/**
|
|
1179
|
+
* The schema reference.
|
|
1180
|
+
*/
|
|
1181
|
+
readonly reference: typeof union;
|
|
1182
|
+
/**
|
|
1183
|
+
* The union options.
|
|
1184
|
+
*/
|
|
1185
|
+
readonly options: TOptions;
|
|
1186
|
+
/**
|
|
1187
|
+
* The error message.
|
|
1188
|
+
*/
|
|
1189
|
+
readonly message: TMessage;
|
|
1190
|
+
}
|
|
1191
|
+
/**
|
|
1192
|
+
* Creates an union schema.
|
|
1193
|
+
*
|
|
1194
|
+
* @param options The union options.
|
|
1195
|
+
*
|
|
1196
|
+
* @returns An union schema.
|
|
1197
|
+
*/
|
|
1198
|
+
declare function union<const TOptions extends UnionOptions>(options: TOptions): UnionSchema<TOptions, undefined>;
|
|
1199
|
+
/**
|
|
1200
|
+
* Creates an union schema.
|
|
1201
|
+
*
|
|
1202
|
+
* @param options The union options.
|
|
1203
|
+
* @param message The error message.
|
|
1204
|
+
*
|
|
1205
|
+
* @returns An union schema.
|
|
1206
|
+
*/
|
|
1207
|
+
declare function union<const TOptions extends UnionOptions, const TMessage extends ErrorMessage<UnionIssue<InferIssue<TOptions[number]>>> | undefined>(options: TOptions, message: TMessage): UnionSchema<TOptions, TMessage>;
|
|
1208
|
+
|
|
1209
|
+
/**
|
|
1210
|
+
* Union options async type.
|
|
1211
|
+
*/
|
|
1212
|
+
|
|
1087
1213
|
/**
|
|
1088
1214
|
* Infer nullish output type.
|
|
1089
1215
|
*/
|
|
@@ -1398,6 +1524,110 @@ declare function optionalAsync<const TWrapped extends BaseSchema<unknown, unknow
|
|
|
1398
1524
|
* Picklist options type.
|
|
1399
1525
|
*/
|
|
1400
1526
|
|
|
1527
|
+
/**
|
|
1528
|
+
* Record issue interface.
|
|
1529
|
+
*/
|
|
1530
|
+
interface RecordIssue extends BaseIssue<unknown> {
|
|
1531
|
+
/**
|
|
1532
|
+
* The issue kind.
|
|
1533
|
+
*/
|
|
1534
|
+
readonly kind: 'schema';
|
|
1535
|
+
/**
|
|
1536
|
+
* The issue type.
|
|
1537
|
+
*/
|
|
1538
|
+
readonly type: 'record';
|
|
1539
|
+
/**
|
|
1540
|
+
* The expected property.
|
|
1541
|
+
*/
|
|
1542
|
+
readonly expected: 'Object';
|
|
1543
|
+
}
|
|
1544
|
+
/**
|
|
1545
|
+
* Is literal type.
|
|
1546
|
+
*/
|
|
1547
|
+
type IsLiteral<TKey extends string | number | symbol> = string extends TKey ? false : number extends TKey ? false : symbol extends TKey ? false : TKey extends Brand<string | number | symbol> ? false : true;
|
|
1548
|
+
/**
|
|
1549
|
+
* Optional keys type.
|
|
1550
|
+
*/
|
|
1551
|
+
type OptionalKeys<TObject extends Record<string | number | symbol, unknown>> = { [TKey in keyof TObject]: IsLiteral<TKey> extends true ? TKey : never }[keyof TObject];
|
|
1552
|
+
/**
|
|
1553
|
+
* With question marks type.
|
|
1554
|
+
*
|
|
1555
|
+
* Hint: We mark an entry as optional if we detect that its key is a literal
|
|
1556
|
+
* type. The reason for this is that it is not technically possible to detect
|
|
1557
|
+
* missing literal keys without restricting the key schema to `string`, `enum`
|
|
1558
|
+
* and `picklist`. However, if `enum` and `picklist` are used, it is better to
|
|
1559
|
+
* use `object` with `entriesFromList` because it already covers the needed
|
|
1560
|
+
* functionality. This decision also reduces the bundle size of `record`,
|
|
1561
|
+
* because it only needs to check the entries of the input and not any missing
|
|
1562
|
+
* keys.
|
|
1563
|
+
*/
|
|
1564
|
+
type WithQuestionMarks<TObject extends Record<string | number | symbol, unknown>> = MarkOptional<TObject, OptionalKeys<TObject>>;
|
|
1565
|
+
/**
|
|
1566
|
+
* With readonly type.
|
|
1567
|
+
*/
|
|
1568
|
+
type WithReadonly<TValue extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TObject extends WithQuestionMarks<Record<string | number | symbol, unknown>>> = TValue extends SchemaWithPipe<infer TPipe> | SchemaWithPipeAsync<infer TPipe> ? ReadonlyAction<any> extends TPipe[number] ? Readonly<TObject> : TObject : TObject;
|
|
1569
|
+
/**
|
|
1570
|
+
* Infer record input type.
|
|
1571
|
+
*/
|
|
1572
|
+
type InferRecordInput<TKey extends BaseSchema<string, string | number | symbol, BaseIssue<unknown>> | BaseSchemaAsync<string, string | number | symbol, BaseIssue<unknown>>, TValue extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>> = Prettify<WithQuestionMarks<Record<InferInput<TKey>, InferInput<TValue>>>>;
|
|
1573
|
+
/**
|
|
1574
|
+
* Infer record output type.
|
|
1575
|
+
*/
|
|
1576
|
+
type InferRecordOutput<TKey extends BaseSchema<string, string | number | symbol, BaseIssue<unknown>> | BaseSchemaAsync<string, string | number | symbol, BaseIssue<unknown>>, TValue extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>> = Prettify<WithReadonly<TValue, WithQuestionMarks<Record<InferOutput<TKey>, InferOutput<TValue>>>>>;
|
|
1577
|
+
|
|
1578
|
+
/**
|
|
1579
|
+
* Record schema interface.
|
|
1580
|
+
*/
|
|
1581
|
+
interface RecordSchema<TKey extends BaseSchema<string, string | number | symbol, BaseIssue<unknown>>, TValue extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, TMessage extends ErrorMessage<RecordIssue> | undefined> extends BaseSchema<InferRecordInput<TKey, TValue>, InferRecordOutput<TKey, TValue>, RecordIssue | InferIssue<TKey> | InferIssue<TValue>> {
|
|
1582
|
+
/**
|
|
1583
|
+
* The schema type.
|
|
1584
|
+
*/
|
|
1585
|
+
readonly type: 'record';
|
|
1586
|
+
/**
|
|
1587
|
+
* The schema reference.
|
|
1588
|
+
*/
|
|
1589
|
+
readonly reference: typeof record;
|
|
1590
|
+
/**
|
|
1591
|
+
* The expected property.
|
|
1592
|
+
*/
|
|
1593
|
+
readonly expects: 'Object';
|
|
1594
|
+
/**
|
|
1595
|
+
* The record key schema.
|
|
1596
|
+
*/
|
|
1597
|
+
readonly key: TKey;
|
|
1598
|
+
/**
|
|
1599
|
+
* The record value schema.
|
|
1600
|
+
*/
|
|
1601
|
+
readonly value: TValue;
|
|
1602
|
+
/**
|
|
1603
|
+
* The error message.
|
|
1604
|
+
*/
|
|
1605
|
+
readonly message: TMessage;
|
|
1606
|
+
}
|
|
1607
|
+
/**
|
|
1608
|
+
* Creates a record schema.
|
|
1609
|
+
*
|
|
1610
|
+
* @param key The key schema.
|
|
1611
|
+
* @param value The value schema.
|
|
1612
|
+
*
|
|
1613
|
+
* @returns A record schema.
|
|
1614
|
+
*/
|
|
1615
|
+
declare function record<const TKey extends BaseSchema<string, string | number | symbol, BaseIssue<unknown>>, const TValue extends BaseSchema<unknown, unknown, BaseIssue<unknown>>>(key: TKey, value: TValue): RecordSchema<TKey, TValue, undefined>;
|
|
1616
|
+
/**
|
|
1617
|
+
* Creates a record schema.
|
|
1618
|
+
*
|
|
1619
|
+
* @param key The key schema.
|
|
1620
|
+
* @param value The value schema.
|
|
1621
|
+
* @param message The error message.
|
|
1622
|
+
*
|
|
1623
|
+
* @returns A record schema.
|
|
1624
|
+
*/
|
|
1625
|
+
declare function record<const TKey extends BaseSchema<string, string | number | symbol, BaseIssue<unknown>>, const TValue extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, const TMessage extends ErrorMessage<RecordIssue> | undefined>(key: TKey, value: TValue, message: TMessage): RecordSchema<TKey, TValue, TMessage>;
|
|
1626
|
+
|
|
1627
|
+
/**
|
|
1628
|
+
* Record schema async interface.
|
|
1629
|
+
*/
|
|
1630
|
+
|
|
1401
1631
|
/**
|
|
1402
1632
|
* String issue interface.
|
|
1403
1633
|
*/
|
|
@@ -1455,6 +1685,24 @@ declare function string<const TMessage extends ErrorMessage<StringIssue> | undef
|
|
|
1455
1685
|
* Symbol issue interface.
|
|
1456
1686
|
*/
|
|
1457
1687
|
|
|
1688
|
+
/**
|
|
1689
|
+
* Brand symbol.
|
|
1690
|
+
*/
|
|
1691
|
+
declare const BrandSymbol: unique symbol;
|
|
1692
|
+
/**
|
|
1693
|
+
* Brand name type.
|
|
1694
|
+
*/
|
|
1695
|
+
type BrandName = string | number | symbol;
|
|
1696
|
+
/**
|
|
1697
|
+
* Brand interface.
|
|
1698
|
+
*/
|
|
1699
|
+
interface Brand<TName extends BrandName> {
|
|
1700
|
+
[BrandSymbol]: { [TValue in TName]: TValue };
|
|
1701
|
+
}
|
|
1702
|
+
/**
|
|
1703
|
+
* Brand action interface.
|
|
1704
|
+
*/
|
|
1705
|
+
|
|
1458
1706
|
/**
|
|
1459
1707
|
* Readonly output type.
|
|
1460
1708
|
*/
|
|
@@ -1482,82 +1730,81 @@ declare function readonly<TInput>(): ReadonlyAction<TInput>;
|
|
|
1482
1730
|
/**
|
|
1483
1731
|
* Array action type.
|
|
1484
1732
|
*/
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
type CostMode = (typeof CostModes)[number];
|
|
1511
|
-
//#endregion
|
|
1512
|
-
//#region data-loader.d.ts
|
|
1513
|
-
declare const getDefaultClaudePath: () => string;
|
|
1514
|
-
declare const UsageDataSchema: ObjectSchema<{
|
|
1515
|
-
readonly timestamp: StringSchema<undefined>;
|
|
1516
|
-
readonly version: OptionalSchema<StringSchema<undefined>, undefined>;
|
|
1517
|
-
readonly message: ObjectSchema<{
|
|
1518
|
-
readonly usage: ObjectSchema<{
|
|
1519
|
-
readonly input_tokens: NumberSchema<undefined>;
|
|
1520
|
-
readonly output_tokens: NumberSchema<undefined>;
|
|
1521
|
-
readonly cache_creation_input_tokens: OptionalSchema<NumberSchema<undefined>, undefined>;
|
|
1522
|
-
readonly cache_read_input_tokens: OptionalSchema<NumberSchema<undefined>, undefined>;
|
|
1523
|
-
}, undefined>;
|
|
1524
|
-
readonly model: OptionalSchema<StringSchema<undefined>, undefined>;
|
|
1525
|
-
}, undefined>;
|
|
1526
|
-
readonly costUSD: OptionalSchema<NumberSchema<undefined>, undefined>;
|
|
1527
|
-
}, undefined>;
|
|
1528
|
-
type UsageData = InferOutput<typeof UsageDataSchema>;
|
|
1529
|
-
declare const DailyUsageSchema: ObjectSchema<{
|
|
1530
|
-
readonly date: StringSchema<undefined>;
|
|
1531
|
-
readonly inputTokens: NumberSchema<undefined>;
|
|
1532
|
-
readonly outputTokens: NumberSchema<undefined>;
|
|
1533
|
-
readonly cacheCreationTokens: NumberSchema<undefined>;
|
|
1534
|
-
readonly cacheReadTokens: NumberSchema<undefined>;
|
|
1535
|
-
readonly totalCost: NumberSchema<undefined>;
|
|
1536
|
-
}, undefined>;
|
|
1537
|
-
type DailyUsage = InferOutput<typeof DailyUsageSchema>;
|
|
1538
|
-
declare const SessionUsageSchema: ObjectSchema<{
|
|
1539
|
-
readonly sessionId: StringSchema<undefined>;
|
|
1540
|
-
readonly projectPath: StringSchema<undefined>;
|
|
1541
|
-
readonly inputTokens: NumberSchema<undefined>;
|
|
1542
|
-
readonly outputTokens: NumberSchema<undefined>;
|
|
1543
|
-
readonly cacheCreationTokens: NumberSchema<undefined>;
|
|
1544
|
-
readonly cacheReadTokens: NumberSchema<undefined>;
|
|
1545
|
-
readonly totalCost: NumberSchema<undefined>;
|
|
1546
|
-
readonly lastActivity: StringSchema<undefined>;
|
|
1547
|
-
readonly versions: ArraySchema<StringSchema<undefined>, undefined>;
|
|
1548
|
-
}, undefined>;
|
|
1549
|
-
type SessionUsage = InferOutput<typeof SessionUsageSchema>;
|
|
1550
|
-
declare const formatDate: (dateStr: string) => string;
|
|
1551
|
-
declare const calculateCostForEntry: (data: UsageData, mode: CostMode, modelPricing: Record<string, ModelPricing>) => number;
|
|
1552
|
-
interface DateFilter {
|
|
1553
|
-
since?: string;
|
|
1554
|
-
until?: string;
|
|
1733
|
+
|
|
1734
|
+
/**
|
|
1735
|
+
* Regex issue interface.
|
|
1736
|
+
*/
|
|
1737
|
+
interface RegexIssue<TInput extends string> extends BaseIssue<TInput> {
|
|
1738
|
+
/**
|
|
1739
|
+
* The issue kind.
|
|
1740
|
+
*/
|
|
1741
|
+
readonly kind: 'validation';
|
|
1742
|
+
/**
|
|
1743
|
+
* The issue type.
|
|
1744
|
+
*/
|
|
1745
|
+
readonly type: 'regex';
|
|
1746
|
+
/**
|
|
1747
|
+
* The expected input.
|
|
1748
|
+
*/
|
|
1749
|
+
readonly expected: string;
|
|
1750
|
+
/**
|
|
1751
|
+
* The received input.
|
|
1752
|
+
*/
|
|
1753
|
+
readonly received: `"${string}"`;
|
|
1754
|
+
/**
|
|
1755
|
+
* The regex pattern.
|
|
1756
|
+
*/
|
|
1757
|
+
readonly requirement: RegExp;
|
|
1555
1758
|
}
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1759
|
+
/**
|
|
1760
|
+
* Regex action interface.
|
|
1761
|
+
*/
|
|
1762
|
+
interface RegexAction<TInput extends string, TMessage extends ErrorMessage<RegexIssue<TInput>> | undefined> extends BaseValidation<TInput, TInput, RegexIssue<TInput>> {
|
|
1763
|
+
/**
|
|
1764
|
+
* The action type.
|
|
1765
|
+
*/
|
|
1766
|
+
readonly type: 'regex';
|
|
1767
|
+
/**
|
|
1768
|
+
* The action reference.
|
|
1769
|
+
*/
|
|
1770
|
+
readonly reference: typeof regex;
|
|
1771
|
+
/**
|
|
1772
|
+
* The expected property.
|
|
1773
|
+
*/
|
|
1774
|
+
readonly expects: string;
|
|
1775
|
+
/**
|
|
1776
|
+
* The regex pattern.
|
|
1777
|
+
*/
|
|
1778
|
+
readonly requirement: RegExp;
|
|
1779
|
+
/**
|
|
1780
|
+
* The error message.
|
|
1781
|
+
*/
|
|
1782
|
+
readonly message: TMessage;
|
|
1559
1783
|
}
|
|
1560
|
-
|
|
1561
|
-
|
|
1784
|
+
/**
|
|
1785
|
+
* Creates a [regex](https://en.wikipedia.org/wiki/Regular_expression) validation action.
|
|
1786
|
+
*
|
|
1787
|
+
* 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.
|
|
1788
|
+
*
|
|
1789
|
+
* @param requirement The regex pattern.
|
|
1790
|
+
*
|
|
1791
|
+
* @returns A regex action.
|
|
1792
|
+
*/
|
|
1793
|
+
declare function regex<TInput extends string>(requirement: RegExp): RegexAction<TInput, undefined>;
|
|
1794
|
+
/**
|
|
1795
|
+
* Creates a [regex](https://en.wikipedia.org/wiki/Regular_expression) validation action.
|
|
1796
|
+
*
|
|
1797
|
+
* 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.
|
|
1798
|
+
*
|
|
1799
|
+
* @param requirement The regex pattern.
|
|
1800
|
+
* @param message The error message.
|
|
1801
|
+
*
|
|
1802
|
+
* @returns A regex action.
|
|
1803
|
+
*/
|
|
1804
|
+
declare function regex<TInput extends string, const TMessage extends ErrorMessage<RegexIssue<TInput>> | undefined>(requirement: RegExp, message: TMessage): RegexAction<TInput, TMessage>;
|
|
1805
|
+
|
|
1806
|
+
/**
|
|
1807
|
+
* Returns action type.
|
|
1808
|
+
*/
|
|
1562
1809
|
//#endregion
|
|
1563
|
-
export {
|
|
1810
|
+
export { ArraySchema, BooleanSchema, InferOutput, NumberSchema, ObjectSchema, OptionalSchema, RecordSchema, RegexAction, SchemaWithPipe, StringSchema, UnionSchema };
|