![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/ts.corals.io/frontend/node_modules/axios-retry/lib/esm/ |
{"version":3,"sources":["../../es/index.mjs"],"names":["isRetryAllowed","namespace","isNetworkError","error","response","Boolean","code","SAFE_HTTP_METHODS","IDEMPOTENT_HTTP_METHODS","concat","isRetryableError","status","isSafeRequestError","config","indexOf","method","isIdempotentRequestError","isNetworkOrIdempotentRequestError","noDelay","exponentialDelay","retryNumber","delay","Math","pow","randomSum","random","getCurrentState","currentState","retryCount","getRequestOptions","defaultOptions","fixConfig","axios","defaults","agent","httpAgent","httpsAgent","shouldRetry","retries","retryCondition","shouldRetryOrPromise","shouldRetryPromiseResult","_err","axiosRetry","interceptors","request","use","lastRequestTime","Date","now","Promise","reject","retryDelay","shouldResetTimeout","timeout","lastRequestDuration","max","transformRequest","data","resolve","setTimeout"],"mappings":";;;;;;;;;;AAAA,OAAOA,cAAP,MAA2B,kBAA3B;AAEA,IAAMC,SAAS,GAAG,aAAlB;AAEA;AACA;AACA;AACA;;AACA,OAAO,SAASC,cAAT,CAAwBC,KAAxB,EAA+B;AACpC,SACE,CAACA,KAAK,CAACC,QAAP,IACAC,OAAO,CAACF,KAAK,CAACG,IAAP,CADP,IACuB;AACvBH,EAAAA,KAAK,CAACG,IAAN,KAAe,cAFf,IAEiC;AACjCN,EAAAA,cAAc,CAACG,KAAD,CAJhB,CADoC,CAMjC;AACJ;AAED,IAAMI,iBAAiB,GAAG,CAAC,KAAD,EAAQ,MAAR,EAAgB,SAAhB,CAA1B;AACA,IAAMC,uBAAuB,GAAGD,iBAAiB,CAACE,MAAlB,CAAyB,CAAC,KAAD,EAAQ,QAAR,CAAzB,CAAhC;AAEA;AACA;AACA;AACA;;AACA,OAAO,SAASC,gBAAT,CAA0BP,KAA1B,EAAiC;AACt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AAGG,SAAf;AACD;AAED;AACA;AACA;AACA;AACA;;AACA,SAASE,eAAT,CAAyBb,MAAzB,EAAiC;AAC/B,MAAMc,YAAY,GAAGd,MAAM,CAACZ,SAAD,CAAN,IAAqB,EAA1C;AACA0B,EAAAA,YAAY,CAACC,UAAb,GAA0BD,YAAY,CAACC,UAAb,IAA2B,CAArD;AACAf,EAAAA,MAAM,CAACZ,SAAD,CAAN,GAAoB0B,YAApB;AACA,SAAOA,YAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASE,iBAAT,CAA2BhB,MAA3B,EAAmCiB,cAAnC,EAAmD;AACjD,yCAAYA,cAAZ,GAA+BjB,MAAM,CAACZ,SAAD,CAArC;AACD;AAED;AACA;AACA;AACA;;;AACA,SAAS8B,SAAT,CAAmBC,KAAnB,EAA0BnB,MAA1B,EAAkC;AAChC,MAAImB,KAAK,CAACC,QAAN,CAAeC,KAAf,KAAyBrB,MAAM,CAACqB,KAApC,EAA2C;AACzC,WAAOrB,MAAM,CAACqB,KAAd;AACD;;AACD,MAAIF,KAAK,CAACC,QAAN,CAAeE,SAAf,KAA6BtB,MAAM,CAACsB,SAAxC,EAAmD;AACjD,WAAOtB,MAAM,CAACsB,SAAd;AACD;;AACD,MAAIH,KAAK,CAACC,QAAN,CAAeG,UAAf,KAA8BvB,MAAM,CAACuB,UAAzC,EAAqD;AACnD,WAAOvB,MAAM,CAACuB,UAAd;AACD;AACF;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;SACeC,W;;;AAgBf;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;mCAnEA,WAA2BC,OAA3B,EAAo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allowed';\n\nconst namespace = 'axios-retry';\n\n/**\n * @param {Error} error\n * @return {boolean}\n */\nexport function isNetworkError(error) {\n return (\n !error.response &&\n Boolean(error.code) && // Prevents retrying cancelled requests\n error.code !== 'ECONNABORTED' && // Prevents retrying timed out requests\n isRetryAllowed(error)\n ); // Prevents retrying unsafe errors\n}\n\nconst SAFE_HTTP_METHODS = ['get', 'head', 'options'];\nconst IDEMPOTENT_HTTP_METHODS = SAFE_HTTP_METHODS.concat(['put', 'delete']);\n\n/**\n * @param {Error} error\n * @return {boolean}\n */\nexport function isRetryableError(error) {\n return (\n error.code !== 'ECONNABORTED' &&\n (!error.response || (error.response.status >= 500 && error.response.status <= 599))\n );\n}\n\n/**\n * @param {Error} error\n * @return {boolean}\n */\nexport function isSafeRequestError(error) {\n if (!error.config) {\n // Cannot determine if the request can be retried\n return false;\n }\n\n return isRetryableError(error) && SAFE_HTTP_METHODS.indexOf(error.config.method) !== -1;\n}\n\n/**\n * @param {Error} error\n * @return {boolean}\n */\nexport function isIdempotentRequestError(error) {\n if (!error.config) {\n // Cannot determine if the request can be retried\n return false;\n }\n\n return isRetryableError(error) && IDEMPOTENT_HTTP_METHODS.indexOf(error.config.method) !== -1;\n}\n\n/**\n * @param {Error} error\n * @return {boolean}\n */\nexport function isNetworkOrIdempotentRequestError(error) {\n return isNetworkError(error) || isIdempotentRequestError(error);\n}\n\n/**\n * @return {number} - delay in milliseconds, always 0\n */\nfunction noDelay() {\n return 0;\n}\n\n/**\n * @param {number} [retryNumber=0]\n * @return {number} - delay in milliseconds\n */\nexport function exponentialDelay(retryNumber = 0) {\n const delay = Math.pow(2, retryNumber) * 100;\n const randomSum = delay * 0.2 * Math.random(); // 0-20% of the delay\n return delay + randomSum;\n}\n\n/**\n * Initializes and returns the retry state for the given request/config\n * @param {AxiosRequestConfig} config\n * @return {Object}\n */\nfunction getCurrentState(config) {\n const currentState = config[namespace] || {};\n currentState.retryCount = currentState.retryCount || 0;\n config[namespace] = currentState;\n return currentState;\n}\n\n/**\n * Returns the axios-retry options for the current request\n * @param {AxiosRequestConfig} config\n * @param {AxiosRetryConfig} defaultOptions\n * @return {AxiosRetryConfig}\n */\nfunction getRequestOptions(config, defaultOptions) {\n return { ...defaultOptions, ...config[namespace] };\n}\n\n/**\n * @param {Axios} axios\n * @param {AxiosRequestConfig} config\n */\nfunction fixConfig(axios, config) {\n if (axios.defaults.agent === config.agent) {\n delete config.agent;\n }\n if (axios.defaults.httpAgent === config.httpAgent) {\n delete config.httpAgent;\n }\n if (axios.defaults.httpsAgent === config.httpsAgent) {\n delete config.httpsAgent;\n }\n}\n\n/**\n * Checks retryCondition if request can be retried. Handles it's retruning value or Promise.\n * @param {number} retries\n * @param {Function} retryCondition\n * @param {Object} currentState\n * @param {Error} error\n * @return {boolean}\n */\nasync function shouldRetry(retries, retryCondition, currentState, error) {\n const shouldRetryOrPromise = currentState.retryCount < retries && retryCondition(error);\n\n // This could be a promise\n if (typeof shouldRetryOrPromise === 'object') {\n try {\n const shouldRetryPromiseResult = await shouldRetryOrPromise;\n // keep return true unless shouldRetryPromiseResult return false for compatibility\n return shouldRetryPromiseResult !== false;\n } catch (_err) {\n return false;\n }\n }\n return shouldRetryOrPromise;\n}\n\n/**\n * Adds response interceptors to an axios instance to retry requests failed due to network issues\n *\n * @example\n *\n * import axios from 'axios';\n *\n * axiosRetry(axios, { retries: 3 });\n *\n * axios.get('http://example.com/test') // The first request fails and the second returns 'ok'\n * .then(result => {\n * result.data; // 'ok'\n * });\n *\n * // Exponential back-off retry delay between requests\n * axiosRetry(axios, { retryDelay : axiosRetry.exponentialDelay});\n *\n * // Custom retry delay\n * axiosRetry(axios, { retryDelay : (retryCount) => {\n * return retryCount * 1000;\n * }});\n *\n * // Also works with custom axios instances\n * const client = axios.create({ baseURL: 'http://example.com' });\n * axiosRetry(client, { retries: 3 });\n *\n * client.get('/test') // The first request fails and the second returns 'ok'\n * .then(result => {\n * result.data; // 'ok'\n * });\n *\n * // Allows request-specific configuration\n * client\n * .get('/test', {\n * 'axios-retry': {\n * retries: 0\n * }\n * })\n * .catch(error => { // The first request fails\n * error !== undefined\n * });\n *\n * @param {Axios} axios An axios instance (the axios object or one created from axios.create)\n * @param {Object} [defaultOptions]\n * @param {number} [defaultOptions.retries=3] Number of retries\n * @param {boolean} [defaultOptions.shouldResetTimeout=false]\n * Defines if the timeout should be reset between retries\n * @param {Function} [defaultOptions.retryCondition=isNetworkOrIdempotentRequestError]\n * A function to determine if the error can be retried\n * @param {Function} [defaultOptions.retryDelay=noDelay]\n * A function to determine the delay between retry requests\n */\nexport default function axiosRetry(axios, defaultOptions) {\n axios.interceptors.request.use((config) => {\n const currentState = getCurrentState(config);\n currentState.lastRequestTime = Date.now();\n return config;\n });\n\n axios.interceptors.response.use(null, async (error) => {\n const { config } = error;\n\n // If we have no information to retry the request\n if (!config) {\n return Promise.reject(error);\n }\n\n const {\n retries = 3,\n retryCondition = isNetworkOrIdempotentRequestError,\n retryDelay = noDelay,\n shouldResetTimeout = false\n } = getRequestOptions(config, defaultOptions);\n\n const currentState = getCurrentState(config);\n\n if (await shouldRetry(retries, retryCondition, currentState, error)) {\n currentState.retryCount += 1;\n const delay = retryDelay(currentState.retryCount, error);\n\n // Axios fails merging this configuration to the default configuration because it has an issue\n // with circular structures: https://github.com/mzabriskie/axios/issues/370\n fixConfig(axios, config);\n\n if (!shouldResetTimeout && config.timeout && currentState.lastRequestTime) {\n const lastRequestDuration = Date.now() - currentState.lastRequestTime;\n // Minimum 1ms timeout (passing 0 or less to XHR means no timeout)\n config.timeout = Math.max(config.timeout - lastRequestDuration - delay, 1);\n }\n\n config.transformRequest = [(data) => data];\n\n return new Promise((resolve) => setTimeout(() => resolve(axios(config)), delay));\n }\n\n return Promise.reject(error);\n });\n}\n\n// Compatibility with CommonJS\naxiosRetry.isNetworkError = isNetworkError;\naxiosRetry.isSafeRequestError = isSafeRequestError;\naxiosRetry.isIdempotentRequestError = isIdempotentRequestError;\naxiosRetry.isNetworkOrIdempotentRequestError = isNetworkOrIdempotentRequestError;\naxiosRetry.exponentialDelay = exponentialDelay;\naxiosRetry.isRetryableError = isRetryableError;\n"],"file":"index.js"}