(input: {
readonly expiresAt: number | null;
readonly now?: number;
readonly skewMs?: number;
})
| 760 | * signal. Keep the two paths in sync — narrowing the reactive retry strands |
| 761 | * every null-expiry connection with no way to recover short of a reconnect. */ |
| 762 | export const shouldRefreshToken = (input: { |
| 763 | readonly expiresAt: number | null; |
| 764 | readonly now?: number; |
| 765 | readonly skewMs?: number; |
| 766 | }): boolean => { |
| 767 | if (input.expiresAt === null) return false; |
| 768 | const now = input.now ?? Date.now(); |
| 769 | const skew = input.skewMs ?? OAUTH2_REFRESH_SKEW_MS; |
| 770 | return input.expiresAt <= now + skew; |
| 771 | }; |
no outgoing calls
no test coverage detected