(input: {
readonly expiresAt: number | null;
readonly now?: number;
readonly skewMs?: number;
})
| 882 | * signal. Keep the two paths in sync — narrowing the reactive retry strands |
| 883 | * every null-expiry connection with no way to recover short of a reconnect. */ |
| 884 | export const shouldRefreshToken = (input: { |
| 885 | readonly expiresAt: number | null; |
| 886 | readonly now?: number; |
| 887 | readonly skewMs?: number; |
| 888 | }): boolean => { |
| 889 | if (input.expiresAt === null) return false; |
| 890 | const now = input.now ?? Date.now(); |
| 891 | const skew = input.skewMs ?? OAUTH2_REFRESH_SKEW_MS; |
| 892 | return input.expiresAt <= now + skew; |
| 893 | }; |
no outgoing calls
no test coverage detected