UNPKG

@azure/identity

Version:

Provides credential implementations for Azure SDK libraries that can authenticate with Microsoft Entra ID

54 lines (53 loc) 2.07 kB
var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var imdsRetryPolicy_exports = {}; __export(imdsRetryPolicy_exports, { imdsRetryPolicy: () => imdsRetryPolicy }); module.exports = __toCommonJS(imdsRetryPolicy_exports); var import_core_rest_pipeline = require("@azure/core-rest-pipeline"); var import_core_util = require("@azure/core-util"); const DEFAULT_CLIENT_MAX_RETRY_INTERVAL = 1e3 * 64; const MIN_DELAY_FOR_410_MS = 3e3; function imdsRetryPolicy(msiRetryConfig) { return (0, import_core_rest_pipeline.retryPolicy)( [ { name: "imdsRetryPolicy", retry: ({ retryCount, response }) => { if (response?.status !== 404 && response?.status !== 410) { return { skipStrategy: true }; } const initialDelayMs = response?.status === 410 ? Math.max(MIN_DELAY_FOR_410_MS, msiRetryConfig.startDelayInMs) : msiRetryConfig.startDelayInMs; return (0, import_core_util.calculateRetryDelay)(retryCount, { retryDelayInMs: initialDelayMs, maxRetryDelayInMs: DEFAULT_CLIENT_MAX_RETRY_INTERVAL }); } } ], { maxRetries: msiRetryConfig.maxRetries } ); } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { imdsRetryPolicy }); //# sourceMappingURL=imdsRetryPolicy.js.map