@@ -39,7 +39,7 @@ function resolveTargetAgent(
3939}
4040
4141function formatTimestamp ( value : number | undefined ) : string | undefined {
42- if ( ! Number . isFinite ( value ) ) {
42+ if ( typeof value !== "number" || ! Number . isFinite ( value ) ) {
4343 return undefined ;
4444 }
4545 return new Date ( value ) . toISOString ( ) ;
@@ -56,6 +56,9 @@ function summarizeProfile(params: {
5656 profile : AuthProfileCredential ;
5757 usage ?: ProfileUsageStats ;
5858} ) : AuthProfileSummary {
59+ const expiresAt = resolveProfileExpiry ( params . profile ) ;
60+ const cooldownUntil = formatTimestamp ( params . usage ?. cooldownUntil ) ;
61+ const disabledUntil = formatTimestamp ( params . usage ?. disabledUntil ) ;
5962 return {
6063 id : params . profileId ,
6164 provider : normalizeProviderId ( params . profile . provider ) ,
@@ -67,15 +70,9 @@ function summarizeProfile(params: {
6770 } ) ,
6871 ...( params . profile . email ? { email : params . profile . email } : { } ) ,
6972 ...( 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 } : { } ) ,
7976 } ;
8077}
8178
0 commit comments