We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3c9acfa commit 0ebf80eCopy full SHA for 0ebf80e
1 file changed
lib/usage.ts
@@ -13,13 +13,8 @@ const tokensSchema = z.object({
13
const detailSchema = z.object({
14
timestamp: z.string().optional(),
15
source: z.string().optional(),
16
- // auth_index may arrive as non-numeric string; drop invalid values instead of failing parse
17
- auth_index: z
18
- .preprocess((value) => {
19
- if (value === undefined || value === null) return undefined;
20
- const num = Number(value);
21
- return Number.isNaN(num) ? undefined : num;
22
- }, z.number().optional()),
+ // 保留 auth_index 原值(字符串或数字),避免历史/异构格式被丢弃
+ auth_index: z.union([z.string(), z.number()]).optional(),
23
tokens: tokensSchema.optional(),
24
failed: z.boolean().optional(),
25
// 兼容旧格式
0 commit comments