(scopes, getTokenOptions)
| 77026 | /** |
| 77027 | * Produces true if the cycler MUST refresh (null or nearly-expired |
| 77028 | * token). |
| 77029 | */ |
| 77030 | get mustRefresh() { |
| 77031 | return token === null || token.expiresOnTimestamp - options.forcedRefreshWindowInMs < Date.now(); |
| 77032 | } |
| 77033 | }; |
| 77034 | function refresh(scopes, getTokenOptions) { |
| 77035 | var _a5; |
| 77036 | if (!cycler.isRefreshing) { |
| 77037 | const tryGetAccessToken = () => credential.getToken(scopes, getTokenOptions); |
| 77038 | refreshWorker = beginRefresh( |
| 77039 | tryGetAccessToken, |
| 77040 | options.retryIntervalInMs, |
| 77041 | // If we don't have a token, then we should timeout immediately |
| 77042 | (_a5 = token === null || token === void 0 ? void 0 : token.expiresOnTimestamp) !== null && _a5 !== void 0 ? _a5 : Date.now() |
| 77043 | ).then((_token) => { |
| 77044 | refreshWorker = null; |
| 77045 | token = _token; |
| 77046 | tenantId = getTokenOptions.tenantId; |
| 77047 | return token; |
| 77048 | }).catch((reason) => { |
| 77049 | refreshWorker = null; |
| 77050 | token = null; |
| 77051 | tenantId = void 0; |
| 77052 | throw reason; |
| 77053 | }); |
no test coverage detected
searching dependent graphs…