die heldin script add
This commit is contained in:
19
node_modules/axios-auth-refresh/dist/index.d.ts
generated
vendored
Normal file
19
node_modules/axios-auth-refresh/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import { AxiosInstance } from 'axios';
|
||||
import { AxiosAuthRefreshOptions } from './model';
|
||||
export { AxiosAuthRefreshOptions, AxiosAuthRefreshRequestConfig } from './model';
|
||||
/**
|
||||
* Creates an authentication refresh interceptor that binds to any error response.
|
||||
* If the response status code is one of the options.statusCodes, interceptor calls the refreshAuthCall
|
||||
* which must return a Promise. While refreshAuthCall is running, all the new requests are intercepted and are waiting
|
||||
* for the refresh call to resolve. While running the refreshing call, instance provided is marked as a paused instance
|
||||
* which indicates the interceptor to not intercept any responses from it. This is because you'd otherwise need to mark
|
||||
* the specific requests you make by yourself in order to make sure it's not intercepted. This behavior can be
|
||||
* turned off, but use it with caution as you need to mark the requests with `skipAuthRefresh` flag yourself in order to
|
||||
* not run into interceptors loop.
|
||||
*
|
||||
* @param {AxiosInstance} instance - Axios HTTP client instance
|
||||
* @param {(error: any) => Promise<AxiosPromise>} refreshAuthCall - refresh token call which must return a Promise
|
||||
* @param {AxiosAuthRefreshOptions} options - options for the interceptor @see defaultOptions
|
||||
* @return {number} - interceptor id (in case you want to eject it manually)
|
||||
*/
|
||||
export default function createAuthRefreshInterceptor(instance: AxiosInstance, refreshAuthCall: (error: any) => Promise<any>, options?: AxiosAuthRefreshOptions): number;
|
||||
1
node_modules/axios-auth-refresh/dist/index.min.js
generated
vendored
Normal file
1
node_modules/axios-auth-refresh/dist/index.min.js
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("axios")):"function"==typeof define&&define.amd?define(["axios"],t):"object"==typeof exports?exports["axios-auth-refresh"]=t(require("axios")):e["axios-auth-refresh"]=t(e.axios)}(this,(function(e){return function(){"use strict";var t={593:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.resendFailedRequest=t.getRetryInstance=t.unsetCache=t.createRequestQueueInterceptor=t.createRefreshCall=t.shouldInterceptError=t.mergeOptions=t.defaultOptions=void 0;const s=r(300);t.defaultOptions={statusCodes:[401],pauseInstanceWhileRefreshing:!1},t.mergeOptions=function(e,t){return Object.assign(Object.assign(Object.assign({},e),{pauseInstanceWhileRefreshing:t.skipWhileRefreshing}),t)},t.shouldInterceptError=function(e,t,r,s){var n,o;return!!e&&(!(null===(n=e.config)||void 0===n?void 0:n.skipAuthRefresh)&&(!!(t.interceptNetworkError&&!e.response&&0===e.request.status||e.response&&((null==t?void 0:t.shouldRefresh)?t.shouldRefresh(e):null===(o=t.statusCodes)||void 0===o?void 0:o.includes(parseInt(e.response.status))))&&(e.response||(e.response={config:e.config}),!t.pauseInstanceWhileRefreshing||!s.skipInstances.includes(r))))},t.createRefreshCall=function(e,t,r){return r.refreshCall||(r.refreshCall=t(e),"function"==typeof r.refreshCall.then)?r.refreshCall:(console.warn("axios-auth-refresh requires `refreshTokenCall` to return a promise."),Promise.reject())},t.createRequestQueueInterceptor=function(e,t,r){return void 0===t.requestQueueInterceptorId&&(t.requestQueueInterceptorId=e.interceptors.request.use((e=>t.refreshCall.catch((()=>{throw new s.default.Cancel("Request call failed")})).then((()=>r.onRetry?r.onRetry(e):e))))),t.requestQueueInterceptorId},t.unsetCache=function(e,t){e.interceptors.request.eject(t.requestQueueInterceptorId),t.requestQueueInterceptorId=void 0,t.refreshCall=void 0,t.skipInstances=t.skipInstances.filter((t=>t!==e))},t.getRetryInstance=function(e,t){return t.retryInstance||e},t.resendFailedRequest=function(e,t){return e.config.skipAuthRefresh=!0,t(e.response.config)}},300:function(t){t.exports=e}},r={};function s(e){var n=r[e];if(void 0!==n)return n.exports;var o=r[e]={exports:{}};return t[e](o,o.exports,s),o.exports}var n={};return function(){var e=n;Object.defineProperty(e,"__esModule",{value:!0});const t=s(593);e.default=function(e,r,s={}){if("function"!=typeof r)throw new Error("axios-auth-refresh requires `refreshAuthCall` to be a function that returns a promise.");const n={skipInstances:[],refreshCall:void 0,requestQueueInterceptorId:void 0};return e.interceptors.response.use((e=>e),(o=>{if(s=(0,t.mergeOptions)(t.defaultOptions,s),!(0,t.shouldInterceptError)(o,s,e,n))return Promise.reject(o);s.pauseInstanceWhileRefreshing&&n.skipInstances.push(e);const u=(0,t.createRefreshCall)(o,r,n);return(0,t.createRequestQueueInterceptor)(e,n,s),u.catch((e=>Promise.reject(e))).then((()=>(0,t.resendFailedRequest)(o,(0,t.getRetryInstance)(e,s)))).finally((()=>(0,t.unsetCache)(e,n)))}))}}(),n}()}));
|
||||
1
node_modules/axios-auth-refresh/dist/index.min.js.map
generated
vendored
Normal file
1
node_modules/axios-auth-refresh/dist/index.min.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
28
node_modules/axios-auth-refresh/dist/model.d.ts
generated
vendored
Normal file
28
node_modules/axios-auth-refresh/dist/model.d.ts
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
import { AxiosError, AxiosInstance, AxiosRequestConfig } from 'axios';
|
||||
export interface AxiosAuthRefreshOptions {
|
||||
statusCodes?: Array<number>;
|
||||
/**
|
||||
* Determine whether to refresh, if "shouldRefresh" is configured, The "statusCodes" logic will be ignored
|
||||
* @param error AxiosError
|
||||
* @returns boolean
|
||||
*/
|
||||
shouldRefresh?(error: AxiosError): boolean;
|
||||
retryInstance?: AxiosInstance;
|
||||
interceptNetworkError?: boolean;
|
||||
pauseInstanceWhileRefreshing?: boolean;
|
||||
onRetry?: (requestConfig: AxiosRequestConfig) => AxiosRequestConfig | Promise<AxiosRequestConfig>;
|
||||
/**
|
||||
* @deprecated
|
||||
* This flag has been deprecated in favor of `pauseInstanceWhileRefreshing` flag.
|
||||
* Use `pauseInstanceWhileRefreshing` instead.
|
||||
*/
|
||||
skipWhileRefreshing?: boolean;
|
||||
}
|
||||
export interface AxiosAuthRefreshCache {
|
||||
skipInstances: AxiosInstance[];
|
||||
refreshCall: Promise<any> | undefined;
|
||||
requestQueueInterceptorId: number | undefined;
|
||||
}
|
||||
export interface AxiosAuthRefreshRequestConfig extends AxiosRequestConfig {
|
||||
skipAuthRefresh?: boolean;
|
||||
}
|
||||
53
node_modules/axios-auth-refresh/dist/utils.d.ts
generated
vendored
Normal file
53
node_modules/axios-auth-refresh/dist/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
import { AxiosInstance, AxiosPromise, AxiosRequestConfig } from 'axios';
|
||||
import { AxiosAuthRefreshOptions, AxiosAuthRefreshCache } from './model';
|
||||
export interface CustomAxiosRequestConfig extends AxiosRequestConfig {
|
||||
skipAuthRefresh?: boolean;
|
||||
}
|
||||
export declare const defaultOptions: AxiosAuthRefreshOptions;
|
||||
/**
|
||||
* Merges two options objects (options overwrites defaults).
|
||||
*
|
||||
* @return {AxiosAuthRefreshOptions}
|
||||
*/
|
||||
export declare function mergeOptions(defaults: AxiosAuthRefreshOptions, options: AxiosAuthRefreshOptions): AxiosAuthRefreshOptions;
|
||||
/**
|
||||
* Returns TRUE: when error.response.status is contained in options.statusCodes
|
||||
* Returns FALSE: when error or error.response doesn't exist or options.statusCodes doesn't include response status
|
||||
*
|
||||
* @return {boolean}
|
||||
*/
|
||||
export declare function shouldInterceptError(error: any, options: AxiosAuthRefreshOptions, instance: AxiosInstance, cache: AxiosAuthRefreshCache): boolean;
|
||||
/**
|
||||
* Creates refresh call if it does not exist or returns the existing one.
|
||||
*
|
||||
* @return {Promise<any>}
|
||||
*/
|
||||
export declare function createRefreshCall(error: any, fn: (error: any) => Promise<any>, cache: AxiosAuthRefreshCache): Promise<any>;
|
||||
/**
|
||||
* Creates request queue interceptor if it does not exist and returns its id.
|
||||
*
|
||||
* @return {number}
|
||||
*/
|
||||
export declare function createRequestQueueInterceptor(instance: AxiosInstance, cache: AxiosAuthRefreshCache, options: AxiosAuthRefreshOptions): number;
|
||||
/**
|
||||
* Ejects request queue interceptor and unset interceptor cached values.
|
||||
*
|
||||
* @param {AxiosInstance} instance
|
||||
* @param {AxiosAuthRefreshCache} cache
|
||||
*/
|
||||
export declare function unsetCache(instance: AxiosInstance, cache: AxiosAuthRefreshCache): void;
|
||||
/**
|
||||
* Returns instance that's going to be used when requests are retried
|
||||
*
|
||||
* @param instance
|
||||
* @param options
|
||||
*/
|
||||
export declare function getRetryInstance(instance: AxiosInstance, options: AxiosAuthRefreshOptions): AxiosInstance;
|
||||
/**
|
||||
* Resend failed axios request.
|
||||
*
|
||||
* @param {any} error
|
||||
* @param {AxiosInstance} instance
|
||||
* @return AxiosPromise
|
||||
*/
|
||||
export declare function resendFailedRequest(error: any, instance: AxiosInstance): AxiosPromise;
|
||||
Reference in New Issue
Block a user