push neon reactor
This commit is contained in:
Generated
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
/// <reference types="node" resolution-mode="require"/>
|
||||
import { IncomingHttpHeaders } from "http";
|
||||
import { Logger } from "@azure/msal-common";
|
||||
import { IHttpRetryPolicy } from "./IHttpRetryPolicy.js";
|
||||
export declare const DEFAULT_MANAGED_IDENTITY_MAX_RETRIES: number;
|
||||
export declare class DefaultManagedIdentityRetryPolicy implements IHttpRetryPolicy {
|
||||
static get DEFAULT_MANAGED_IDENTITY_RETRY_DELAY_MS(): number;
|
||||
private linearRetryStrategy;
|
||||
pauseForRetry(httpStatusCode: number, currentRetry: number, logger: Logger, retryAfterHeader: IncomingHttpHeaders["retry-after"]): Promise<boolean>;
|
||||
}
|
||||
//# sourceMappingURL=DefaultManagedIdentityRetryPolicy.d.ts.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DefaultManagedIdentityRetryPolicy.d.ts","sourceRoot":"","sources":["../../src/retry/DefaultManagedIdentityRetryPolicy.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAC3C,OAAO,EAAc,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD,eAAO,MAAM,oCAAoC,EAAE,MAAU,CAAC;AAW9D,qBAAa,iCAAkC,YAAW,gBAAgB;IAKtE,MAAM,KAAK,uCAAuC,IAAI,MAAM,CAE3D;IAED,OAAO,CAAC,mBAAmB,CACG;IAExB,aAAa,CACf,cAAc,EAAE,MAAM,EACtB,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,mBAAmB,CAAC,aAAa,CAAC,GACrD,OAAO,CAAC,OAAO,CAAC;CA+BtB"}
|
||||
Generated
Vendored
+49
@@ -0,0 +1,49 @@
|
||||
/*! @azure/msal-node v3.6.3 2025-07-08 */
|
||||
'use strict';
|
||||
import { HttpStatus } from '@azure/msal-common';
|
||||
import { LinearRetryStrategy } from './LinearRetryStrategy.mjs';
|
||||
|
||||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
const DEFAULT_MANAGED_IDENTITY_MAX_RETRIES = 3; // referenced in unit test
|
||||
const DEFAULT_MANAGED_IDENTITY_RETRY_DELAY_MS = 1000;
|
||||
const DEFAULT_MANAGED_IDENTITY_HTTP_STATUS_CODES_TO_RETRY_ON = [
|
||||
HttpStatus.NOT_FOUND,
|
||||
HttpStatus.REQUEST_TIMEOUT,
|
||||
HttpStatus.TOO_MANY_REQUESTS,
|
||||
HttpStatus.SERVER_ERROR,
|
||||
HttpStatus.SERVICE_UNAVAILABLE,
|
||||
HttpStatus.GATEWAY_TIMEOUT,
|
||||
];
|
||||
class DefaultManagedIdentityRetryPolicy {
|
||||
constructor() {
|
||||
this.linearRetryStrategy = new LinearRetryStrategy();
|
||||
}
|
||||
/*
|
||||
* this is defined here as a static variable despite being defined as a constant outside of the
|
||||
* class because it needs to be overridden in the unit tests so that the unit tests run faster
|
||||
*/
|
||||
static get DEFAULT_MANAGED_IDENTITY_RETRY_DELAY_MS() {
|
||||
return DEFAULT_MANAGED_IDENTITY_RETRY_DELAY_MS;
|
||||
}
|
||||
async pauseForRetry(httpStatusCode, currentRetry, logger, retryAfterHeader) {
|
||||
if (DEFAULT_MANAGED_IDENTITY_HTTP_STATUS_CODES_TO_RETRY_ON.includes(httpStatusCode) &&
|
||||
currentRetry < DEFAULT_MANAGED_IDENTITY_MAX_RETRIES) {
|
||||
const retryAfterDelay = this.linearRetryStrategy.calculateDelay(retryAfterHeader, DefaultManagedIdentityRetryPolicy.DEFAULT_MANAGED_IDENTITY_RETRY_DELAY_MS);
|
||||
logger.verbose(`Retrying request in ${retryAfterDelay}ms (retry attempt: ${currentRetry + 1})`);
|
||||
// pause execution for the calculated delay
|
||||
await new Promise((resolve) => {
|
||||
// retryAfterHeader value of 0 evaluates to false, and DEFAULT_MANAGED_IDENTITY_RETRY_DELAY_MS will be used
|
||||
return setTimeout(resolve, retryAfterDelay);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
// if the status code is not retriable or max retries have been reached, do not retry
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export { DEFAULT_MANAGED_IDENTITY_MAX_RETRIES, DefaultManagedIdentityRetryPolicy };
|
||||
//# sourceMappingURL=DefaultManagedIdentityRetryPolicy.mjs.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DefaultManagedIdentityRetryPolicy.mjs","sources":["../../src/retry/DefaultManagedIdentityRetryPolicy.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAAA;;;AAGG;AAOU,MAAA,oCAAoC,GAAW,EAAE;AAC9D,MAAM,uCAAuC,GAAW,IAAI,CAAC;AAC7D,MAAM,sDAAsD,GAAkB;AAC1E,IAAA,UAAU,CAAC,SAAS;AACpB,IAAA,UAAU,CAAC,eAAe;AAC1B,IAAA,UAAU,CAAC,iBAAiB;AAC5B,IAAA,UAAU,CAAC,YAAY;AACvB,IAAA,UAAU,CAAC,mBAAmB;AAC9B,IAAA,UAAU,CAAC,eAAe;CAC7B,CAAC;MAEW,iCAAiC,CAAA;AAA9C,IAAA,WAAA,GAAA;AASY,QAAA,IAAA,CAAA,mBAAmB,GACvB,IAAI,mBAAmB,EAAE,CAAC;KAsCjC;AA/CG;;;AAGG;AACH,IAAA,WAAW,uCAAuC,GAAA;AAC9C,QAAA,OAAO,uCAAuC,CAAC;KAClD;IAKD,MAAM,aAAa,CACf,cAAsB,EACtB,YAAoB,EACpB,MAAc,EACd,gBAAoD,EAAA;AAEpD,QAAA,IACI,sDAAsD,CAAC,QAAQ,CAC3D,cAAc,CACjB;YACD,YAAY,GAAG,oCAAoC,EACrD;AACE,YAAA,MAAM,eAAe,GACjB,IAAI,CAAC,mBAAmB,CAAC,cAAc,CACnC,gBAAgB,EAChB,iCAAiC,CAAC,uCAAuC,CAC5E,CAAC;YAEN,MAAM,CAAC,OAAO,CACV,CAAuB,oBAAA,EAAA,eAAe,CAClC,mBAAA,EAAA,YAAY,GAAG,CACnB,CAAG,CAAA,CAAA,CACN,CAAC;;AAGF,YAAA,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,KAAI;;AAE1B,gBAAA,OAAO,UAAU,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;AAChD,aAAC,CAAC,CAAC;AAEH,YAAA,OAAO,IAAI,CAAC;AACf,SAAA;;AAGD,QAAA,OAAO,KAAK,CAAC;KAChB;AACJ;;;;"}
|
||||
Generated
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
export declare class ExponentialRetryStrategy {
|
||||
private minExponentialBackoff;
|
||||
private maxExponentialBackoff;
|
||||
private exponentialDeltaBackoff;
|
||||
constructor(minExponentialBackoff: number, maxExponentialBackoff: number, exponentialDeltaBackoff: number);
|
||||
/**
|
||||
* Calculates the exponential delay based on the current retry attempt.
|
||||
*
|
||||
* @param {number} currentRetry - The current retry attempt number.
|
||||
* @returns {number} - The calculated exponential delay in milliseconds.
|
||||
*
|
||||
* The delay is calculated using the formula:
|
||||
* - If `currentRetry` is 0, it returns the minimum backoff time.
|
||||
* - Otherwise, it calculates the delay as the minimum of:
|
||||
* - `(2^(currentRetry - 1)) * deltaBackoff`
|
||||
* - `maxBackoff`
|
||||
*
|
||||
* This ensures that the delay increases exponentially with each retry attempt,
|
||||
* but does not exceed the maximum backoff time.
|
||||
*/
|
||||
calculateDelay(currentRetry: number): number;
|
||||
}
|
||||
//# sourceMappingURL=ExponentialRetryStrategy.d.ts.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ExponentialRetryStrategy.d.ts","sourceRoot":"","sources":["../../src/retry/ExponentialRetryStrategy.ts"],"names":[],"mappings":"AAKA,qBAAa,wBAAwB;IAEjC,OAAO,CAAC,qBAAqB,CAAS;IAEtC,OAAO,CAAC,qBAAqB,CAAS;IAEtC,OAAO,CAAC,uBAAuB,CAAS;gBAGpC,qBAAqB,EAAE,MAAM,EAC7B,qBAAqB,EAAE,MAAM,EAC7B,uBAAuB,EAAE,MAAM;IAOnC;;;;;;;;;;;;;;OAcG;IACI,cAAc,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;CActD"}
|
||||
Generated
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
/*! @azure/msal-node v3.6.3 2025-07-08 */
|
||||
'use strict';
|
||||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
class ExponentialRetryStrategy {
|
||||
constructor(minExponentialBackoff, maxExponentialBackoff, exponentialDeltaBackoff) {
|
||||
this.minExponentialBackoff = minExponentialBackoff;
|
||||
this.maxExponentialBackoff = maxExponentialBackoff;
|
||||
this.exponentialDeltaBackoff = exponentialDeltaBackoff;
|
||||
}
|
||||
/**
|
||||
* Calculates the exponential delay based on the current retry attempt.
|
||||
*
|
||||
* @param {number} currentRetry - The current retry attempt number.
|
||||
* @returns {number} - The calculated exponential delay in milliseconds.
|
||||
*
|
||||
* The delay is calculated using the formula:
|
||||
* - If `currentRetry` is 0, it returns the minimum backoff time.
|
||||
* - Otherwise, it calculates the delay as the minimum of:
|
||||
* - `(2^(currentRetry - 1)) * deltaBackoff`
|
||||
* - `maxBackoff`
|
||||
*
|
||||
* This ensures that the delay increases exponentially with each retry attempt,
|
||||
* but does not exceed the maximum backoff time.
|
||||
*/
|
||||
calculateDelay(currentRetry) {
|
||||
// Attempt 1
|
||||
if (currentRetry === 0) {
|
||||
return this.minExponentialBackoff;
|
||||
}
|
||||
// Attempt 2+
|
||||
const exponentialDelay = Math.min(Math.pow(2, currentRetry - 1) * this.exponentialDeltaBackoff, this.maxExponentialBackoff);
|
||||
return exponentialDelay;
|
||||
}
|
||||
}
|
||||
|
||||
export { ExponentialRetryStrategy };
|
||||
//# sourceMappingURL=ExponentialRetryStrategy.mjs.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ExponentialRetryStrategy.mjs","sources":["../../src/retry/ExponentialRetryStrategy.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;AAGG;MAEU,wBAAwB,CAAA;AAQjC,IAAA,WAAA,CACI,qBAA6B,EAC7B,qBAA6B,EAC7B,uBAA+B,EAAA;AAE/B,QAAA,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;AACnD,QAAA,IAAI,CAAC,qBAAqB,GAAG,qBAAqB,CAAC;AACnD,QAAA,IAAI,CAAC,uBAAuB,GAAG,uBAAuB,CAAC;KAC1D;AAED;;;;;;;;;;;;;;AAcG;AACI,IAAA,cAAc,CAAC,YAAoB,EAAA;;QAEtC,IAAI,YAAY,KAAK,CAAC,EAAE;YACpB,OAAO,IAAI,CAAC,qBAAqB,CAAC;AACrC,SAAA;;QAGD,MAAM,gBAAgB,GAAG,IAAI,CAAC,GAAG,CAC7B,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,uBAAuB,EAC5D,IAAI,CAAC,qBAAqB,CAC7B,CAAC;AAEF,QAAA,OAAO,gBAAgB,CAAC;KAC3B;AACJ;;;;"}
|
||||
Generated
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
/// <reference types="node" resolution-mode="require"/>
|
||||
import { IncomingHttpHeaders } from "http";
|
||||
import { Logger } from "@azure/msal-common";
|
||||
export interface IHttpRetryPolicy {
|
||||
_isNewRequest?: boolean;
|
||||
/**
|
||||
* Pauses execution for a specified amount of time before retrying an HTTP request.
|
||||
*
|
||||
* @param httpStatusCode - The HTTP status code of the response.
|
||||
* @param currentRetry - The current retry attempt number.
|
||||
* @param retryAfterHeader - The value of the `retry-after` HTTP header, if present.
|
||||
* @returns A promise that resolves to a boolean indicating whether to retry the request.
|
||||
*/
|
||||
pauseForRetry(httpStatusCode: number, currentRetry: number, logger: Logger, retryAfterHeader?: IncomingHttpHeaders["retry-after"]): Promise<boolean>;
|
||||
}
|
||||
//# sourceMappingURL=IHttpRetryPolicy.d.ts.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IHttpRetryPolicy.d.ts","sourceRoot":"","sources":["../../src/retry/IHttpRetryPolicy.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,MAAM,WAAW,gBAAgB;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAC;IAGxB;;;;;;;OAOG;IACH,aAAa,CACT,cAAc,EAAE,MAAM,EACtB,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EACd,gBAAgB,CAAC,EAAE,mBAAmB,CAAC,aAAa,CAAC,GACtD,OAAO,CAAC,OAAO,CAAC,CAAC;CACvB"}
|
||||
Generated
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
import { Logger } from "@azure/msal-common";
|
||||
import { IHttpRetryPolicy } from "./IHttpRetryPolicy.js";
|
||||
export declare class ImdsRetryPolicy implements IHttpRetryPolicy {
|
||||
static get MIN_EXPONENTIAL_BACKOFF_MS(): number;
|
||||
static get MAX_EXPONENTIAL_BACKOFF_MS(): number;
|
||||
static get EXPONENTIAL_DELTA_BACKOFF_MS(): number;
|
||||
static get HTTP_STATUS_GONE_RETRY_AFTER_MS(): number;
|
||||
_isNewRequest: boolean;
|
||||
set isNewRequest(value: boolean);
|
||||
private maxRetries;
|
||||
private exponentialRetryStrategy;
|
||||
/**
|
||||
* Pauses execution for a calculated delay before retrying a request.
|
||||
*
|
||||
* @param httpStatusCode - The HTTP status code of the response.
|
||||
* @param currentRetry - The current retry attempt number.
|
||||
* @param retryAfterHeader - The value of the "retry-after" header from the response.
|
||||
* @returns A promise that resolves to a boolean indicating whether a retry should be attempted.
|
||||
*/
|
||||
pauseForRetry(httpStatusCode: number, currentRetry: number, logger: Logger): Promise<boolean>;
|
||||
}
|
||||
//# sourceMappingURL=ImdsRetryPolicy.d.ts.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ImdsRetryPolicy.d.ts","sourceRoot":"","sources":["../../src/retry/ImdsRetryPolicy.ts"],"names":[],"mappings":"AAKA,OAAO,EAAc,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAkBzD,qBAAa,eAAgB,YAAW,gBAAgB;IAKpD,MAAM,KAAK,0BAA0B,IAAI,MAAM,CAE9C;IACD,MAAM,KAAK,0BAA0B,IAAI,MAAM,CAE9C;IACD,MAAM,KAAK,4BAA4B,IAAI,MAAM,CAEhD;IACD,MAAM,KAAK,+BAA+B,IAAI,MAAM,CAEnD;IAEM,aAAa,EAAE,OAAO,CAAC;IAC9B,IAAI,YAAY,CAAC,KAAK,EAAE,OAAO,EAE9B;IAED,OAAO,CAAC,UAAU,CAAS;IAE3B,OAAO,CAAC,wBAAwB,CAK1B;IAEN;;;;;;;OAOG;IACG,aAAa,CACf,cAAc,EAAE,MAAM,EACtB,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,CAAC;CAmDtB"}
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
/*! @azure/msal-node v3.6.3 2025-07-08 */
|
||||
'use strict';
|
||||
import { HttpStatus } from '@azure/msal-common';
|
||||
import { ExponentialRetryStrategy } from './ExponentialRetryStrategy.mjs';
|
||||
|
||||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
const HTTP_STATUS_400_CODES_FOR_EXPONENTIAL_STRATEGY = [
|
||||
HttpStatus.NOT_FOUND,
|
||||
HttpStatus.REQUEST_TIMEOUT,
|
||||
HttpStatus.GONE,
|
||||
HttpStatus.TOO_MANY_REQUESTS,
|
||||
];
|
||||
const EXPONENTIAL_STRATEGY_NUM_RETRIES = 3;
|
||||
const LINEAR_STRATEGY_NUM_RETRIES = 7;
|
||||
const MIN_EXPONENTIAL_BACKOFF_MS = 1000;
|
||||
const MAX_EXPONENTIAL_BACKOFF_MS = 4000;
|
||||
const EXPONENTIAL_DELTA_BACKOFF_MS = 2000;
|
||||
const HTTP_STATUS_GONE_RETRY_AFTER_MS = 10 * 1000; // 10 seconds
|
||||
class ImdsRetryPolicy {
|
||||
constructor() {
|
||||
this.exponentialRetryStrategy = new ExponentialRetryStrategy(ImdsRetryPolicy.MIN_EXPONENTIAL_BACKOFF_MS, ImdsRetryPolicy.MAX_EXPONENTIAL_BACKOFF_MS, ImdsRetryPolicy.EXPONENTIAL_DELTA_BACKOFF_MS);
|
||||
}
|
||||
/*
|
||||
* these are defined here as static variables despite being defined as constants outside of the
|
||||
* class because they need to be overridden in the unit tests so that the unit tests run faster
|
||||
*/
|
||||
static get MIN_EXPONENTIAL_BACKOFF_MS() {
|
||||
return MIN_EXPONENTIAL_BACKOFF_MS;
|
||||
}
|
||||
static get MAX_EXPONENTIAL_BACKOFF_MS() {
|
||||
return MAX_EXPONENTIAL_BACKOFF_MS;
|
||||
}
|
||||
static get EXPONENTIAL_DELTA_BACKOFF_MS() {
|
||||
return EXPONENTIAL_DELTA_BACKOFF_MS;
|
||||
}
|
||||
static get HTTP_STATUS_GONE_RETRY_AFTER_MS() {
|
||||
return HTTP_STATUS_GONE_RETRY_AFTER_MS;
|
||||
}
|
||||
set isNewRequest(value) {
|
||||
this._isNewRequest = value;
|
||||
}
|
||||
/**
|
||||
* Pauses execution for a calculated delay before retrying a request.
|
||||
*
|
||||
* @param httpStatusCode - The HTTP status code of the response.
|
||||
* @param currentRetry - The current retry attempt number.
|
||||
* @param retryAfterHeader - The value of the "retry-after" header from the response.
|
||||
* @returns A promise that resolves to a boolean indicating whether a retry should be attempted.
|
||||
*/
|
||||
async pauseForRetry(httpStatusCode, currentRetry, logger) {
|
||||
if (this._isNewRequest) {
|
||||
this._isNewRequest = false;
|
||||
// calculate the maxRetries based on the status code, once per request
|
||||
this.maxRetries =
|
||||
httpStatusCode === HttpStatus.GONE
|
||||
? LINEAR_STRATEGY_NUM_RETRIES
|
||||
: EXPONENTIAL_STRATEGY_NUM_RETRIES;
|
||||
}
|
||||
/**
|
||||
* (status code is one of the retriable 400 status code
|
||||
* or
|
||||
* status code is >= 500 and <= 599)
|
||||
* and
|
||||
* current count of retries is less than the max number of retries
|
||||
*/
|
||||
if ((HTTP_STATUS_400_CODES_FOR_EXPONENTIAL_STRATEGY.includes(httpStatusCode) ||
|
||||
(httpStatusCode >= HttpStatus.SERVER_ERROR_RANGE_START &&
|
||||
httpStatusCode <= HttpStatus.SERVER_ERROR_RANGE_END &&
|
||||
currentRetry < this.maxRetries)) &&
|
||||
currentRetry < this.maxRetries) {
|
||||
const retryAfterDelay = httpStatusCode === HttpStatus.GONE
|
||||
? ImdsRetryPolicy.HTTP_STATUS_GONE_RETRY_AFTER_MS
|
||||
: this.exponentialRetryStrategy.calculateDelay(currentRetry);
|
||||
logger.verbose(`Retrying request in ${retryAfterDelay}ms (retry attempt: ${currentRetry + 1})`);
|
||||
// pause execution for the calculated delay
|
||||
await new Promise((resolve) => {
|
||||
return setTimeout(resolve, retryAfterDelay);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
// if the status code is not retriable or max retries have been reached, do not retry
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export { ImdsRetryPolicy };
|
||||
//# sourceMappingURL=ImdsRetryPolicy.mjs.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ImdsRetryPolicy.mjs","sources":["../../src/retry/ImdsRetryPolicy.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAAA;;;AAGG;AAMH,MAAM,8CAA8C,GAAkB;AAClE,IAAA,UAAU,CAAC,SAAS;AACpB,IAAA,UAAU,CAAC,eAAe;AAC1B,IAAA,UAAU,CAAC,IAAI;AACf,IAAA,UAAU,CAAC,iBAAiB;CAC/B,CAAC;AAEF,MAAM,gCAAgC,GAAG,CAAC,CAAC;AAC3C,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAEtC,MAAM,0BAA0B,GAAW,IAAI,CAAC;AAChD,MAAM,0BAA0B,GAAW,IAAI,CAAC;AAChD,MAAM,4BAA4B,GAAW,IAAI,CAAC;AAElD,MAAM,+BAA+B,GAAW,EAAE,GAAG,IAAI,CAAC;MAE7C,eAAe,CAAA;AAA5B,IAAA,WAAA,GAAA;AAyBY,QAAA,IAAA,CAAA,wBAAwB,GAC5B,IAAI,wBAAwB,CACxB,eAAe,CAAC,0BAA0B,EAC1C,eAAe,CAAC,0BAA0B,EAC1C,eAAe,CAAC,4BAA4B,CAC/C,CAAC;KAiET;AA9FG;;;AAGG;AACH,IAAA,WAAW,0BAA0B,GAAA;AACjC,QAAA,OAAO,0BAA0B,CAAC;KACrC;AACD,IAAA,WAAW,0BAA0B,GAAA;AACjC,QAAA,OAAO,0BAA0B,CAAC;KACrC;AACD,IAAA,WAAW,4BAA4B,GAAA;AACnC,QAAA,OAAO,4BAA4B,CAAC;KACvC;AACD,IAAA,WAAW,+BAA+B,GAAA;AACtC,QAAA,OAAO,+BAA+B,CAAC;KAC1C;IAGD,IAAI,YAAY,CAAC,KAAc,EAAA;AAC3B,QAAA,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;KAC9B;AAWD;;;;;;;AAOG;AACH,IAAA,MAAM,aAAa,CACf,cAAsB,EACtB,YAAoB,EACpB,MAAc,EAAA;QAEd,IAAI,IAAI,CAAC,aAAa,EAAE;AACpB,YAAA,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;;AAG3B,YAAA,IAAI,CAAC,UAAU;gBACX,cAAc,KAAK,UAAU,CAAC,IAAI;AAC9B,sBAAE,2BAA2B;sBAC3B,gCAAgC,CAAC;AAC9C,SAAA;AAED;;;;;;AAMG;AACH,QAAA,IACI,CAAC,8CAA8C,CAAC,QAAQ,CACpD,cAAc,CACjB;AACG,aAAC,cAAc,IAAI,UAAU,CAAC,wBAAwB;gBAClD,cAAc,IAAI,UAAU,CAAC,sBAAsB;AACnD,gBAAA,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC;AACvC,YAAA,YAAY,GAAG,IAAI,CAAC,UAAU,EAChC;AACE,YAAA,MAAM,eAAe,GACjB,cAAc,KAAK,UAAU,CAAC,IAAI;kBAC5B,eAAe,CAAC,+BAA+B;kBAC/C,IAAI,CAAC,wBAAwB,CAAC,cAAc,CACxC,YAAY,CACf,CAAC;YAEZ,MAAM,CAAC,OAAO,CACV,CAAuB,oBAAA,EAAA,eAAe,CAClC,mBAAA,EAAA,YAAY,GAAG,CACnB,CAAG,CAAA,CAAA,CACN,CAAC;;AAGF,YAAA,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,KAAI;AAC1B,gBAAA,OAAO,UAAU,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;AAChD,aAAC,CAAC,CAAC;AAEH,YAAA,OAAO,IAAI,CAAC;AACf,SAAA;;AAGD,QAAA,OAAO,KAAK,CAAC;KAChB;AACJ;;;;"}
|
||||
Generated
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
/// <reference types="node" resolution-mode="require"/>
|
||||
import { IncomingHttpHeaders } from "http";
|
||||
export declare class LinearRetryStrategy {
|
||||
/**
|
||||
* Calculates the number of milliseconds to sleep based on the `retry-after` HTTP header.
|
||||
*
|
||||
* @param retryHeader - The value of the `retry-after` HTTP header. This can be either a number of seconds
|
||||
* or an HTTP date string.
|
||||
* @returns The number of milliseconds to sleep before retrying the request. If the `retry-after` header is not
|
||||
* present or cannot be parsed, returns 0.
|
||||
*/
|
||||
calculateDelay(retryHeader: IncomingHttpHeaders["retry-after"], minimumDelay: number): number;
|
||||
}
|
||||
//# sourceMappingURL=LinearRetryStrategy.d.ts.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"LinearRetryStrategy.d.ts","sourceRoot":"","sources":["../../src/retry/LinearRetryStrategy.ts"],"names":[],"mappings":";AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAC;AAE3C,qBAAa,mBAAmB;IAC5B;;;;;;;OAOG;IACI,cAAc,CACjB,WAAW,EAAE,mBAAmB,CAAC,aAAa,CAAC,EAC/C,YAAY,EAAE,MAAM,GACrB,MAAM;CAoBZ"}
|
||||
Generated
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
/*! @azure/msal-node v3.6.3 2025-07-08 */
|
||||
'use strict';
|
||||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
class LinearRetryStrategy {
|
||||
/**
|
||||
* Calculates the number of milliseconds to sleep based on the `retry-after` HTTP header.
|
||||
*
|
||||
* @param retryHeader - The value of the `retry-after` HTTP header. This can be either a number of seconds
|
||||
* or an HTTP date string.
|
||||
* @returns The number of milliseconds to sleep before retrying the request. If the `retry-after` header is not
|
||||
* present or cannot be parsed, returns 0.
|
||||
*/
|
||||
calculateDelay(retryHeader, minimumDelay) {
|
||||
if (!retryHeader) {
|
||||
return minimumDelay;
|
||||
}
|
||||
// retry-after header is in seconds
|
||||
let millisToSleep = Math.round(parseFloat(retryHeader) * 1000);
|
||||
/*
|
||||
* retry-after header is in HTTP Date format
|
||||
* <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT
|
||||
*/
|
||||
if (isNaN(millisToSleep)) {
|
||||
// .valueOf() is needed to subtract dates in TypeScript
|
||||
millisToSleep =
|
||||
new Date(retryHeader).valueOf() - new Date().valueOf();
|
||||
}
|
||||
return Math.max(minimumDelay, millisToSleep);
|
||||
}
|
||||
}
|
||||
|
||||
export { LinearRetryStrategy };
|
||||
//# sourceMappingURL=LinearRetryStrategy.mjs.map
|
||||
Generated
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"LinearRetryStrategy.mjs","sources":["../../src/retry/LinearRetryStrategy.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;AAGG;MAIU,mBAAmB,CAAA;AAC5B;;;;;;;AAOG;IACI,cAAc,CACjB,WAA+C,EAC/C,YAAoB,EAAA;QAEpB,IAAI,CAAC,WAAW,EAAE;AACd,YAAA,OAAO,YAAY,CAAC;AACvB,SAAA;;AAGD,QAAA,IAAI,aAAa,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,CAAC;AAE/D;;;AAGG;AACH,QAAA,IAAI,KAAK,CAAC,aAAa,CAAC,EAAE;;YAEtB,aAAa;AACT,gBAAA,IAAI,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;AAC9D,SAAA;QAED,OAAO,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;KAChD;AACJ;;;;"}
|
||||
Reference in New Issue
Block a user