@@ -39,7 +39,7 @@ function resolveTargetAgent(
|
39 | 39 | } |
40 | 40 | |
41 | 41 | function formatTimestamp(value: number | undefined): string | undefined { |
42 | | -if (!Number.isFinite(value)) { |
| 42 | +if (typeof value !== "number" || !Number.isFinite(value)) { |
43 | 43 | return undefined; |
44 | 44 | } |
45 | 45 | return new Date(value).toISOString(); |
@@ -56,6 +56,9 @@ function summarizeProfile(params: {
|
56 | 56 | profile: AuthProfileCredential; |
57 | 57 | usage?: ProfileUsageStats; |
58 | 58 | }): AuthProfileSummary { |
| 59 | +const expiresAt = resolveProfileExpiry(params.profile); |
| 60 | +const cooldownUntil = formatTimestamp(params.usage?.cooldownUntil); |
| 61 | +const disabledUntil = formatTimestamp(params.usage?.disabledUntil); |
59 | 62 | return { |
60 | 63 | id: params.profileId, |
61 | 64 | provider: normalizeProviderId(params.profile.provider), |
@@ -67,15 +70,9 @@ function summarizeProfile(params: {
|
67 | 70 | }), |
68 | 71 | ...(params.profile.email ? { email: params.profile.email } : {}), |
69 | 72 | ...(params.profile.displayName ? { displayName: params.profile.displayName } : {}), |
70 | | - ...(resolveProfileExpiry(params.profile) |
71 | | - ? { expiresAt: resolveProfileExpiry(params.profile) } |
72 | | - : {}), |
73 | | - ...(formatTimestamp(params.usage?.cooldownUntil) |
74 | | - ? { cooldownUntil: formatTimestamp(params.usage?.cooldownUntil) } |
75 | | - : {}), |
76 | | - ...(formatTimestamp(params.usage?.disabledUntil) |
77 | | - ? { disabledUntil: formatTimestamp(params.usage?.disabledUntil) } |
78 | | - : {}), |
| 73 | + ...(expiresAt ? { expiresAt } : {}), |
| 74 | + ...(cooldownUntil ? { cooldownUntil } : {}), |
| 75 | + ...(disabledUntil ? { disabledUntil } : {}), |
79 | 76 | }; |
80 | 77 | } |
81 | 78 | |
|