MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / shouldRefreshToken

Function shouldRefreshToken

packages/core/sdk/src/oauth-helpers.ts:1804–1813  ·  view source on GitHub ↗
(input: {
  readonly expiresAt: number | null;
  readonly now?: number;
  readonly skewMs?: number;
})

Source from the content-addressed store, hash-verified

1802 * signal. Keep the two paths in sync — narrowing the reactive retry strands
1803 * every null-expiry connection with no way to recover short of a reconnect. */
1804export const shouldRefreshToken = (input: {
1805 readonly expiresAt: number | null;
1806 readonly now?: number;
1807 readonly skewMs?: number;
1808}): boolean => {
1809 if (input.expiresAt === null) return false;
1810 const now = input.now ?? Date.now();
1811 const skew = input.skewMs ?? OAUTH2_REFRESH_SKEW_MS;
1812 return input.expiresAt <= now + skew;
1813};

Callers 2

resolveConnectionValuesFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected