Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

axios-cache-interceptor

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios-cache-interceptor - npm Package Compare versions

Comparing version 0.7.3 to 0.7.4

dist/tsconfig.build.tsbuildinfo

81

dist/cache/axios.d.ts
import type { AxiosDefaults, AxiosInstance, AxiosInterceptorManager, AxiosRequestConfig, AxiosResponse } from 'axios';
import type { CacheInstance, CacheProperties } from './cache';
/**
* @template R The type returned by this response
* @template D The type that the request body was
*/
export declare type CacheAxiosResponse<R = any, D = any> = AxiosResponse<R, D> & {
config: CacheRequestConfig<D>;
/** The id used for this request. if config specified an id, the id will be returned */
id: string;
/** A simple boolean to check whether this request was cached or not */
cached: boolean;
};
/**
* Options that can be overridden per request
*
* @template D The type for the request body
*/
export declare type CacheRequestConfig<D = any> = AxiosRequestConfig<D> & {
/**
* An id for this request, if this request is used in cache, only the last request made
* with this id will be returned.
*
* @default undefined
*/
id?: string;
/**
* All cache options for the request.
*
* False means ignore everything about cache, for this request.
*/
cache?: false | Partial<CacheProperties>;
};
/**
* Same as the AxiosInstance but with CacheRequestConfig as a config type and
* CacheAxiosResponse as response type.
*
* @see AxiosInstance
* @see CacheRequestConfig
* @see CacheInstance
*/
export interface AxiosCacheInstance extends CacheInstance, AxiosInstance {
/**
* @template T The type returned by this response
* @template R The custom response type that the request can return
* @template D The type that the request body use
*/
<T = any, D = any, R = CacheAxiosResponse<T, D>>(config: CacheRequestConfig<D>): Promise<R>;
/**
* @template T The type returned by this response
* @template R The custom response type that the request can return
* @template D The type that the request body use
*/
<T = any, D = any, R = CacheAxiosResponse<T, D>>(url: string, config?: CacheRequestConfig<D>): Promise<R>;

@@ -62,53 +22,12 @@ defaults: AxiosDefaults<any> & {

};
/** @template D The type that the request body use */
getUri<D>(config?: CacheRequestConfig<D>): string;
/**
* @template T The type returned by this response
* @template R The custom response type that the request can return
* @template D The type that the request body use
*/
request<T = any, D = any, R = CacheAxiosResponse<T, D>>(config?: CacheRequestConfig<D>): Promise<R>;
/**
* @template T The type returned by this response
* @template R The custom response type that the request can return
* @template D The type that the request body use
*/
get<T = any, D = any, R = CacheAxiosResponse<T, D>>(url: string, config?: CacheRequestConfig<D>): Promise<R>;
/**
* @template T The type returned by this response
* @template R The custom response type that the request can return
* @template D The type that the request body use
*/
delete<T = any, D = any, R = CacheAxiosResponse<T, D>>(url: string, config?: CacheRequestConfig<D>): Promise<R>;
/**
* @template T The type returned by this response
* @template R The custom response type that the request can return
* @template D The type that the request body use
*/
head<T = any, D = any, R = CacheAxiosResponse<T, D>>(url: string, config?: CacheRequestConfig<D>): Promise<R>;
/**
* @template T The type returned by this response
* @template R The custom response type that the request can return
* @template D The type that the request body use
*/
options<T = any, D = any, R = CacheAxiosResponse<T, D>>(url: string, config?: CacheRequestConfig<D>): Promise<R>;
/**
* @template T The type returned by this response
* @template R The custom response type that the request can return
* @template D The type that the request body use
*/
post<T = any, D = any, R = CacheAxiosResponse<T, D>>(url: string, data?: D, config?: CacheRequestConfig<D>): Promise<R>;
/**
* @template T The type returned by this response
* @template R The custom response type that the request can return
* @template D The type that the request body use
*/
put<T = any, D = any, R = CacheAxiosResponse<T, D>>(url: string, data?: D, config?: CacheRequestConfig<D>): Promise<R>;
/**
* @template T The type returned by this response
* @template R The custom response type that the request can return
* @template D The type that the request body use
*/
patch<T = any, D = any, R = CacheAxiosResponse<T, D>>(url: string, data?: D, config?: CacheRequestConfig<D>): Promise<R>;
}
//# sourceMappingURL=axios.d.ts.map

3

dist/cache/axios.js

@@ -1,1 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -11,91 +11,18 @@ import type { Method } from 'axios';

export declare type CacheProperties = {
/**
* The time until the cached value is expired in milliseconds.
*
* When using `interpretHeader: true`, this value will only be used if the interpreter
* can't determine their TTL value to override this
*
* **Note**: a custom storage implementation may not respect this.
*
* @default 1000 * 60 * 5 // 5 Minutes
*/
ttl: number;
/**
* If this interceptor should configure the cache from the request cache header When
* used, the ttl property is ignored
*
* @default false
*/
interpretHeader: boolean;
/**
* All methods that should be cached.
*
* @default ['get']
*/
methods: Lowercase<Method>[];
/**
* The function to check if the response code permit being cached.
*
* @default {statusCheck: [200, 399]}
*/
cachePredicate: CachePredicate;
/**
* Once the request is resolved, this specifies what requests should we change the
* cache. Can be used to update the request or delete other caches.
*
* If the function returns nothing, the entry is deleted
*
* This is independent if the request made was cached or not.
*
* The id used is the same as the id on `CacheRequestConfig['id']`, auto-generated or not.
*
* @default {{}}
*/
update: Record<string, CacheUpdater>;
/**
* If the request should handle ETag and If-None-Match support. Use a string to force a
* custom value or true to use the response ETag
*
* @default false
* @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag
*/
etag: string | boolean;
/**
* Use If-Modified-Since header in this request. Use a date to force a custom value or
* true to use the last cached timestamp. If never cached before, the header is not set.
*
* @default false
* @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since
*/
modifiedSince: Date | boolean;
};
export interface CacheInstance {
/**
* The storage to save the cache data.
*
* @default new MemoryAxiosStorage()
*/
storage: AxiosStorage;
/**
* The function used to create different keys for each request. Defaults to a function
* that priorizes the id, and if not specified, a string is generated using the method,
* baseUrl, params, and url
*/
generateKey: KeyGenerator;
/**
* A simple object that holds all deferred objects until it is resolved or rejected.
*
* Can be used to listen when a request is cached or not.
*/
waiting: Record<string, Deferred<CachedResponse>>;
/**
* The function to parse and interpret response headers. Only used if
* cache.interpretHeader is true.
*/
headerInterpreter: HeadersInterpreter;
/** The request interceptor that will be used to handle the cache. */
requestInterceptor: AxiosInterceptor<CacheRequestConfig<any>>;
/** The response interceptor that will be used to handle the cache. */
responseInterceptor: AxiosInterceptor<CacheAxiosResponse<any, any>>;
}
//# sourceMappingURL=cache.d.ts.map

@@ -1,1 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -5,10 +5,3 @@ import type { AxiosInstance } from 'axios';

export declare type CacheOptions = Partial<CacheInstance> & Partial<CacheProperties>;
/**
* Apply the caching interceptors for a already created axios instance.
*
* @param axios The already created axios instance
* @param config The config for the caching interceptors
* @returns The same instance but with caching enabled
*/
export declare function useCache(axios: AxiosInstance, { storage, generateKey, waiting, headerInterpreter, requestInterceptor, responseInterceptor, ...cacheOptions }?: CacheOptions): AxiosCacheInstance;
//# sourceMappingURL=create.d.ts.map

@@ -1,1 +0,36 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.useCache=useCache;var _interpreter=require("../header/interpreter");var _request=require("../interceptors/request");var _response=require("../interceptors/response");var _memory=require("../storage/memory");var _keyGenerator=require("../util/key-generator");var _excluded=["storage","generateKey","waiting","headerInterpreter","requestInterceptor","responseInterceptor"];function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});}keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}function useCache(axios){var _ref=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},storage=_ref.storage,generateKey=_ref.generateKey,waiting=_ref.waiting,headerInterpreter=_ref.headerInterpreter,requestInterceptor=_ref.requestInterceptor,responseInterceptor=_ref.responseInterceptor,cacheOptions=_objectWithoutProperties(_ref,_excluded);var axiosCache=axios;axiosCache.storage=storage||new _memory.MemoryAxiosStorage();axiosCache.generateKey=generateKey||_keyGenerator.defaultKeyGenerator;axiosCache.waiting=waiting||{};axiosCache.headerInterpreter=headerInterpreter||_interpreter.defaultHeaderInterpreter;axiosCache.requestInterceptor=requestInterceptor||new _request.CacheRequestInterceptor(axiosCache);axiosCache.responseInterceptor=responseInterceptor||new _response.CacheResponseInterceptor(axiosCache);axiosCache.defaults=_objectSpread(_objectSpread({},axios.defaults),{},{cache:_objectSpread({ttl:1000*60*5,interpretHeader:false,methods:['get'],cachePredicate:{statusCheck:[200,399]},etag:false,modifiedSince:false,update:{}},cacheOptions)});axiosCache.requestInterceptor.use();axiosCache.responseInterceptor.use();return axiosCache;}
"use strict";
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.useCache = void 0;
const interpreter_1 = require("../header/interpreter");
const request_1 = require("../interceptors/request");
const response_1 = require("../interceptors/response");
const memory_1 = require("../storage/memory");
const key_generator_1 = require("../util/key-generator");
function useCache(axios, _a = {}) {
var { storage, generateKey, waiting, headerInterpreter, requestInterceptor, responseInterceptor } = _a, cacheOptions = __rest(_a, ["storage", "generateKey", "waiting", "headerInterpreter", "requestInterceptor", "responseInterceptor"]);
const axiosCache = axios;
axiosCache.storage = storage || new memory_1.MemoryAxiosStorage();
axiosCache.generateKey = generateKey || key_generator_1.defaultKeyGenerator;
axiosCache.waiting = waiting || {};
axiosCache.headerInterpreter = headerInterpreter || interpreter_1.defaultHeaderInterpreter;
axiosCache.requestInterceptor =
requestInterceptor || new request_1.CacheRequestInterceptor(axiosCache);
axiosCache.responseInterceptor =
responseInterceptor || new response_1.CacheResponseInterceptor(axiosCache);
axiosCache.defaults = Object.assign(Object.assign({}, axios.defaults), { cache: Object.assign({ ttl: 1000 * 60 * 5, interpretHeader: false, methods: ['get'], cachePredicate: { statusCheck: [200, 399] }, etag: false, modifiedSince: false, update: {} }, cacheOptions) });
axiosCache.requestInterceptor.use();
axiosCache.responseInterceptor.use();
return axiosCache;
}
exports.useCache = useCache;

@@ -1,1 +0,39 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.defaultHeaderInterpreter=void 0;var _cacheParser=require("cache-parser");var _headers=require("../util/headers");var defaultHeaderInterpreter=function defaultHeaderInterpreter(){var headers=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(_headers.Header.CacheControl in headers){return interpretCacheControl(headers[_headers.Header.CacheControl],headers);}if(_headers.Header.Expires in headers){return interpretExpires(headers[_headers.Header.Expires],headers);}return undefined;};exports.defaultHeaderInterpreter=defaultHeaderInterpreter;var interpretExpires=function interpretExpires(expires){var milliseconds=Date.parse(expires)-Date.now();return milliseconds>=0?milliseconds:false;};var interpretCacheControl=function interpretCacheControl(cacheControl,headers){var _parse=(0,_cacheParser.parse)(cacheControl),noCache=_parse.noCache,noStore=_parse.noStore,mustRevalidate=_parse.mustRevalidate,maxAge=_parse.maxAge,immutable=_parse.immutable;if(noCache||noStore){return false;}if(immutable){return 1000*60*60*24*365;}if(mustRevalidate){return 0;}if(maxAge){var age=headers[_headers.Header.Age];if(!age){return maxAge*1000;}return maxAge*1000-Number(age)*1000;}return undefined;};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultHeaderInterpreter = void 0;
const cache_parser_1 = require("cache-parser");
const headers_1 = require("../util/headers");
const defaultHeaderInterpreter = (headers = {}) => {
if (headers_1.Header.CacheControl in headers) {
return interpretCacheControl(headers[headers_1.Header.CacheControl], headers);
}
if (headers_1.Header.Expires in headers) {
return interpretExpires(headers[headers_1.Header.Expires], headers);
}
return undefined;
};
exports.defaultHeaderInterpreter = defaultHeaderInterpreter;
const interpretExpires = (expires) => {
const milliseconds = Date.parse(expires) - Date.now();
return milliseconds >= 0 ? milliseconds : false;
};
const interpretCacheControl = (cacheControl, headers) => {
const { noCache, noStore, mustRevalidate, maxAge, immutable } = (0, cache_parser_1.parse)(cacheControl);
if (noCache || noStore) {
return false;
}
if (immutable) {
return 1000 * 60 * 60 * 24 * 365;
}
if (mustRevalidate) {
return 0;
}
if (maxAge) {
const age = headers[headers_1.Header.Age];
if (!age) {
return maxAge * 1000;
}
return maxAge * 1000 - Number(age) * 1000;
}
return undefined;
};

@@ -1,28 +0,5 @@

/**
* `false` if cache should not be used.
*
* `undefined` when provided headers was not enough to determine a valid value.
*
* `number` containing the number of **milliseconds** to cache the response.
*/
declare type MaybeTtl = false | undefined | number;
/**
* Interpret all http headers to determina a time to live.
*
* @param header The header object to interpret.
* @returns `false` if cache should not be used. `undefined` when provided headers was not
* enough to determine a valid value. Or a `number` containing the number of
* **milliseconds** to cache the response.
*/
export declare type HeadersInterpreter = (headers?: Record<string, string>) => MaybeTtl;
/**
* Interpret a single string header
*
* @param header The header string to interpret.
* @returns `false` if cache should not be used. `undefined` when provided headers was not
* enough to determine a valid value. Or a `number` containing the number of
* **milliseconds** to cache the response.
*/
export declare type HeaderInterpreter = (header: string, headers: Record<string, string>) => MaybeTtl;
export {};
//# sourceMappingURL=types.d.ts.map

@@ -1,1 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AxiosCacheInterceptor=t():e.AxiosCacheInterceptor=t()}(self,(function(){return e={623:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.useCache=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.storage,s=t.generateKey,l=t.waiting,d=t.headerInterpreter,h=t.requestInterceptor,v=t.responseInterceptor,y=p(t,c),b=e;return b.storage=r||new i.MemoryAxiosStorage,b.generateKey=s||u.defaultKeyGenerator,b.waiting=l||{},b.headerInterpreter=d||n.defaultHeaderInterpreter,b.requestInterceptor=h||new a.CacheRequestInterceptor(b),b.responseInterceptor=v||new o.CacheResponseInterceptor(b),b.defaults=f(f({},e.defaults),{},{cache:f({ttl:3e5,interpretHeader:!1,methods:["get"],cachePredicate:{statusCheck:[200,399]},etag:!1,modifiedSince:!1,update:{}},y)}),b.requestInterceptor.use(),b.responseInterceptor.use(),b};var n=r(110),a=r(278),o=r(299),i=r(470),u=r(571),c=["storage","generateKey","waiting","headerInterpreter","requestInterceptor","responseInterceptor"];function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function f(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){l(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function p(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}},110:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultHeaderInterpreter=void 0;var n=r(86),a=r(50);t.defaultHeaderInterpreter=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return a.Header.CacheControl in e?i(e[a.Header.CacheControl],e):a.Header.Expires in e?o(e[a.Header.Expires],e):void 0};var o=function(e){var t=Date.parse(e)-Date.now();return t>=0&&t},i=function(e,t){var r=(0,n.parse)(e),o=r.noCache,i=r.noStore,u=r.mustRevalidate,c=r.maxAge,s=r.immutable;if(o||i)return!1;if(s)return 31536e6;if(u)return 0;if(c){var f=t[a.Header.Age];return f?1e3*c-1e3*Number(f):1e3*c}}},138:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(623);Object.keys(n).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===n[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}}))}));var a=r(795);Object.keys(a).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===a[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}}))}));var o=r(470);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===o[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}}))}));var i=r(433);Object.keys(i).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===i[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return i[e]}}))}))},278:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CacheRequestInterceptor=void 0;var n=r(549),a=r(50);function o(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return i(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return u=e.done,e},e:function(e){c=!0,o=e},f:function(){try{u||null==r.return||r.return()}finally{if(c)throw o}}}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function u(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u(Object(r),!0).forEach((function(t){f(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function s(e,t,r,n,a,o,i){try{var u=e[o](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,a)}function f(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var l=function e(t){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),f(this,"use",(function(){r.axios.interceptors.request.use(r.onFulfilled)})),f(this,"onFulfilled",function(){var t,a=(t=regeneratorRuntime.mark((function t(a){var o,i,u,s,f;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!1!==a.cache){t.next=2;break}return t.abrupt("return",a);case 2:if(a.cache=c(c({},r.axios.defaults.cache),a.cache),e.isMethodAllowed(a.method,a.cache)){t.next=5;break}return t.abrupt("return",a);case 5:return o=r.axios.generateKey(a),t.next=8,r.axios.storage.get(o);case 8:if("empty"!=(i=t.sent).state&&"stale"!==i.state){t.next=22;break}if(!r.axios.waiting[o]){t.next=15;break}return t.next=13,r.axios.storage.get(o);case 13:return i=t.sent,t.abrupt("break",22);case 15:return r.axios.waiting[o]=(0,n.deferred)(),null===(u=r.axios.waiting[o])||void 0===u||u.catch((function(){})),t.next=19,r.axios.storage.set(o,{state:"loading",data:i.data});case 19:return"stale"===i.state&&e.setRevalidationHeaders(i,a),a.validateStatus=e.createValidateStatus(a.validateStatus),t.abrupt("return",a);case 22:if("loading"!==i.state){t.next=39;break}if(f=r.axios.waiting[o]){t.next=28;break}return t.next=27,r.axios.storage.remove(o);case 27:return t.abrupt("return",a);case 28:return t.prev=28,t.next=31,f;case 31:s=t.sent,t.next=37;break;case 34:return t.prev=34,t.t0=t.catch(28),t.abrupt("return",a);case 37:t.next=40;break;case 39:s=i.data;case 40:return a.adapter=function(){return Promise.resolve({config:a,data:s.data,headers:s.headers,status:s.status,statusText:s.statusText,cached:!0,id:o})},t.abrupt("return",a);case 42:case"end":return t.stop()}}),t,null,[[28,34]])})),function(){var e=this,r=arguments;return new Promise((function(n,a){var o=t.apply(e,r);function i(e){s(o,n,a,i,u,"next",e)}function u(e){s(o,n,a,i,u,"throw",e)}i(void 0)}))});return function(e){return a.apply(this,arguments)}}()),this.axios=t};t.CacheRequestInterceptor=l,f(l,"isMethodAllowed",(function(e,t){var r,n=e.toLowerCase(),a=o(t.methods||[]);try{for(a.s();!(r=a.n()).done;)if(r.value.toLowerCase()===n)return!0}catch(e){a.e(e)}finally{a.f()}return!1})),f(l,"setRevalidationHeaders",(function(e,t){t.headers||(t.headers={});var r=t.cache,n=r.etag,o=r.modifiedSince;if(n){var i,u=!0===n?null===(i=e.data)||void 0===i?void 0:i.headers[a.Header.ETag]:n;u&&(t.headers[a.Header.IfNoneMatch]=u)}o&&(t.headers[a.Header.IfModifiedSince]=!0===o?e.data.headers[a.Header.LastModified]||new Date(e.createdAt).toUTCString():o.toUTCString())})),f(l,"createValidateStatus",(function(e){return function(t){return e?e(t)||304===t:t>=200&&t<300||304===t}}))},299:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CacheResponseInterceptor=void 0;var n=r(904),a=r(50),o=r(939);function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function u(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){f(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t,r,n,a,o,i){try{var u=e[o](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,a)}function s(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){c(o,n,a,i,u,"next",e)}function u(e){c(o,n,a,i,u,"throw",e)}i(void 0)}))}}function f(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var l=function e(t){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),f(this,"use",(function(){r.axios.interceptors.response.use(r.onFulfilled)})),f(this,"onFulfilled",function(){var t=s(regeneratorRuntime.mark((function t(i){var c,s,f,l,p,d,h,v;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(c=r.cachedResponse(i)).cached){t.next=3;break}return t.abrupt("return",c);case 3:if(c.config.cache){t.next=5;break}return t.abrupt("return",u(u({},c),{},{cached:!1}));case 5:return s=c.config.cache,t.next=8,r.axios.storage.get(c.id);case 8:if("stale"!==(f=t.sent).state&&"empty"!==f.state&&"cached"!==f.state){t.next=11;break}return t.abrupt("return",c);case 11:if(f.data||(0,n.shouldCacheResponse)(c,s)){t.next=15;break}return t.next=14,r.rejectResponse(c.id);case 14:return t.abrupt("return",c);case 15:if(delete c.headers[a.Header.XAxiosCacheEtag],delete c.headers[a.Header.XAxiosCacheLastModified],s.etag&&!0!==s.etag&&(c.headers[a.Header.XAxiosCacheEtag]=s.etag),s.modifiedSince&&(c.headers[a.Header.XAxiosCacheLastModified]=!0===s.modifiedSince?"use-cache-timestamp":s.modifiedSince.toUTCString()),l=s.ttl||-1,null==s||!s.interpretHeader){t.next=27;break}if(!1!==(p=r.axios.headerInterpreter(c.headers))){t.next=26;break}return t.next=25,r.rejectResponse(c.id);case 25:return t.abrupt("return",c);case 26:l=p||0===p?p:l;case 27:return d=e.createCacheData(c,f.data),h={state:"cached",ttl:l,createdAt:Date.now(),data:d},null!=s&&s.update&&(0,o.updateCache)(r.axios.storage,c.data,s.update),v=r.axios.waiting[c.id],t.next=33,null==v?void 0:v.resolve(h.data);case 33:return delete r.axios.waiting[c.id],t.next=36,r.axios.storage.set(c.id,h);case 36:return t.abrupt("return",c);case 37:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),f(this,"rejectResponse",function(){var e=s(regeneratorRuntime.mark((function e(t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.axios.storage.remove(t);case 2:null===(n=r.axios.waiting[t])||void 0===n||n.reject(null),delete r.axios.waiting[t];case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),f(this,"cachedResponse",(function(e){return u({id:r.axios.generateKey(e.config),cached:e.cached||!1},e)})),this.axios=t};t.CacheResponseInterceptor=l,f(l,"createCacheData",(function(e,t){return 304===e.status&&t?(e.cached=!0,e.data=t.data,e.status=t.status,e.statusText=t.statusText,e.headers=u(u({},t.headers),e.headers),t):{data:e.data,status:e.status,statusText:e.statusText,headers:e.headers}}))},795:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function a(e,t,r,n,a,o,i){try{var u=e[o](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,a)}function o(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function u(e){a(i,n,o,u,c,"next",e)}function c(e){a(i,n,o,u,c,"throw",e)}u(void 0)}))}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){return u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},u(e,t)}function c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(t){var a=l(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return s(this,r)}}function s(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return f(e)}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0}),t.BrowserAxiosStorage=void 0;var d=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}(r,e);var t=c(r);function r(e){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.DEFAULT_KEY_PREFIX;return i(this,r),p(f(n=t.call(this)),"find",function(){var e=o(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.storage.getItem("".concat(n.prefix,":").concat(t)),e.abrupt("return",r?JSON.parse(r):{state:"empty"});case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),p(f(n),"set",function(){var e=o(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.storage.setItem("".concat(n.prefix,":").concat(t),JSON.stringify(r)));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()),p(f(n),"remove",function(){var e=o(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.storage.removeItem("".concat(n.prefix,":").concat(t)));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),n.storage=e,n.prefix=a,n}return r}(r(433).AxiosStorage);t.BrowserAxiosStorage=d,p(d,"DEFAULT_KEY_PREFIX","a-c-i")},470:(e,t,r)=>{"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function a(e,t,r,n,a,o,i){try{var u=e[o](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,a)}function o(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function u(e){a(i,n,o,u,c,"next",e)}function c(e){a(i,n,o,u,c,"throw",e)}u(void 0)}))}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){return u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},u(e,t)}function c(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(t){var a=l(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return s(this,r)}}function s(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return f(e)}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){return l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},l(e)}function p(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Object.defineProperty(t,"__esModule",{value:!0}),t.MemoryAxiosStorage=void 0;var d=function(e){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}(r,e);var t=c(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i(this,r),p(f(e=t.call(this)),"find",function(){var t=o(regeneratorRuntime.mark((function t(r){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",e.storage[r]||{state:"empty"});case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),p(f(e),"set",function(){var t=o(regeneratorRuntime.mark((function t(r,n){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.storage[r]=n;case 1:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()),p(f(e),"remove",function(){var t=o(regeneratorRuntime.mark((function t(r){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:delete e.storage[r];case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),e.storage=n,e}return r}(r(433).AxiosStorage);t.MemoryAxiosStorage=d},433:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AxiosStorage=void 0;var n=r(50);function a(e,t,r,n,a,o,i){try{var u=e[o](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,a)}function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var i=function e(){var t=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),o(this,"get",function(){var r,n=(r=regeneratorRuntime.mark((function r(n){var a,o;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t.find(n);case 2:if(!("cached"!==(a=r.sent).state||a.createdAt+a.ttl>Date.now())){r.next=5;break}return r.abrupt("return",a);case 5:if(!e.keepIfStale(a)){r.next=10;break}return o={data:a.data,state:"stale",createdAt:a.createdAt},r.next=9,t.set(n,o);case 9:return r.abrupt("return",o);case 10:return r.next=12,t.remove(n);case 12:return r.abrupt("return",{state:"empty"});case 13:case"end":return r.stop()}}),r)})),function(){var e=this,t=arguments;return new Promise((function(n,o){var i=r.apply(e,t);function u(e){a(i,n,o,u,c,"next",e)}function c(e){a(i,n,o,u,c,"throw",e)}u(void 0)}))});return function(e){return n.apply(this,arguments)}}())};t.AxiosStorage=i,o(i,"keepIfStale",(function(e){var t=e.data;return!(null==t||!t.headers)&&(n.Header.ETag in t.headers||n.Header.LastModified in t.headers||n.Header.XAxiosCacheEtag in t.headers||n.Header.XAxiosCacheLastModified in t.headers)}))},904:(e,t)=>{"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function n(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],i=!0,u=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);i=!0);}catch(e){u=!0,a=e}finally{try{i||null==r.return||r.return()}finally{if(u)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return a(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?a(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function o(e,t){var a=t.statusCheck,o=t.containsHeaders,i=t.responseMatch;if(a)if("function"==typeof a){if(!a(e.status))return!1}else{var u=n(a,2),c=u[0],s=u[1];if(e.status<c||e.status>s)return!1}if(o)for(var f in o){var l=o[f],p=e.headers[f];if(!p)return!1;switch(r(l)){case"string":if(p!=l)return!1;break;case"function":if(!l(p))return!1}}return!(i&&!i(e.data))}Object.defineProperty(t,"__esModule",{value:!0}),t.isCachePredicateValid=o,t.shouldCacheResponse=function(e,t){var r=t.cachePredicate;return"function"==typeof r?r(e):o(e,r)}},50:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.Header=void 0,t.Header=r,function(e){e.IfModifiedSince="if-modified-since",e.LastModified="last-modified",e.IfNoneMatch="if-none-match",e.CacheControl="cache-control",e.ETag="etag",e.Expires="expires",e.Age="age",e.ContentType="content-type",e.XAxiosCacheEtag="x-axios-cache-etag",e.XAxiosCacheLastModified="x-axios-cache-last-modified"}(r||(t.Header=r={}))},571:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.defaultKeyGenerator=void 0;var r=/^\/|\/+$/g;t.defaultKeyGenerator=function(e){var t=e.baseURL,n=void 0===t?"":t,a=e.url,o=void 0===a?"":a,i=e.method,u=e.params,c=e.id;if(c)return String(c);n=n.replace(r,""),o=o.replace(r,"");var s=(null==i?void 0:i.toLowerCase())||"get",f=u?JSON.stringify(u,Object.keys(u).sort()):"{}";return"".concat(s,"::").concat(n+(o&&n?"/":"")+o,"::").concat(f)}},939:(e,t)=>{"use strict";function r(e,t,r,n,a,o,i){try{var u=e[o](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,a)}function n(e){return function(){var t=this,n=arguments;return new Promise((function(a,o){var i=e.apply(t,n);function u(e){r(i,a,o,u,c,"next",e)}function c(e){r(i,a,o,u,c,"throw",e)}u(void 0)}))}}function a(){return(a=n(regeneratorRuntime.mark((function e(t,r,n){var a,o,i,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=regeneratorRuntime.keys(n);case 1:if((e.t1=e.t0()).done){e.next=22;break}if(a=e.t1.value,"delete"!==(o=n[a])){e.next=8;break}return e.next=7,t.remove(a);case 7:return e.abrupt("continue",1);case 8:return e.next=10,t.get(a);case 10:if("loading"!==(i=e.sent).state){e.next=13;break}throw new Error("cannot update the cache while loading");case 13:if(void 0!==(u=o(i,r))){e.next=18;break}return e.next=17,t.remove(a);case 17:return e.abrupt("continue",1);case 18:return e.next=20,t.set(a,u);case 20:e.next=1;break;case 22:case"end":return e.stop()}}),e)})))).apply(this,arguments)}Object.defineProperty(t,"__esModule",{value:!0}),t.updateCache=function(e,t,r){return a.apply(this,arguments)}},86:(e,t)=>{!function(e){var t=Symbol("cache-parser"),r={immutable:"immutable",maxAge:"max-age",maxStale:"max-stale",minFresh:"min-fresh",mustRevalidate:"must-revalidate",mustUnderstand:"must-understand",noCache:"no-cache",noStore:"no-store",noTransform:"no-transform",onlyIfCached:"only-if-cached",private:"private",proxyRevalidate:"proxy-revalidate",public:"public",sMaxAge:"s-maxage",staleIfError:"stale-if-error",staleWhileRevalidate:"stale-while-revalidate"};for(var n in r)r[r[n]]=n;function a(e){return("string"==typeof e||"number"==typeof e)&&(e=Number(e))>=0&&e<1/0}function o(e){return!0===e||"number"==typeof e||"string"==typeof e&&"false"!==e}e.Directive=r,e.toDuration=a,e.toBoolean=o,e.isCacheControl=function(e){return!!e&&!!e[t]},e.tokenize=function(e){if(!e||"object"!=typeof e)return[];var t=[];return o(e.immutable)&&t.push(r.immutable),a(e.maxAge)&&t.push(r.maxAge+"="+Number(e.maxAge)),a(e.maxStale)&&t.push(r.maxStale+"="+Number(e.maxStale)),a(e.minFresh)&&t.push(r.minFresh+"="+Number(e.minFresh)),o(e.mustRevalidate)&&t.push(r.mustRevalidate),o(e.mustUnderstand)&&t.push(r.mustUnderstand),o(e.noCache)&&t.push(r.noCache),o(e.noStore)&&t.push(r.noStore),o(e.noTransform)&&t.push(r.noTransform),o(e.onlyIfCached)&&t.push(r.onlyIfCached),o(e.private)&&t.push(r.private),o(e.proxyRevalidate)&&t.push(r.proxyRevalidate),o(e.public)&&t.push(r.public),a(e.sMaxAge)&&t.push(r.sMaxAge+"="+Number(e.sMaxAge)),a(e.staleIfError)&&t.push(r.staleIfError+"="+Number(e.staleIfError)),a(e.staleWhileRevalidate)&&t.push(r.staleWhileRevalidate+"="+Number(e.staleWhileRevalidate)),t},e.parse=function(e){var n=Object.defineProperty({},t,{configurable:!1,enumerable:!1,writable:!1,value:1});if(!e||"string"!=typeof e)return n;var i={},u=e.toLowerCase().replace(/\s+/g,"").split(",");for(var c in u){var s=u[c].split("=",2);i[s[0]]=1===s.length||s[1]}return o(i[r.immutable])&&(n.immutable=!0),a(i[r.maxAge])&&(n.maxAge=Number(i[r.maxAge])),a(i[r.maxStale])&&(n.maxStale=Number(i[r.maxStale])),a(i[r.minFresh])&&(n.minFresh=Number(i[r.minFresh])),o(i[r.mustRevalidate])&&(n.mustRevalidate=!0),o(i[r.mustUnderstand])&&(n.mustUnderstand=!0),o(i[r.noCache])&&(n.noCache=!0),o(i[r.noStore])&&(n.noStore=!0),o(i[r.noTransform])&&(n.noTransform=!0),o(i[r.onlyIfCached])&&(n.onlyIfCached=!0),o(i[r.private])&&(n.private=!0),o(i[r.proxyRevalidate])&&(n.proxyRevalidate=!0),o(i[r.public])&&(n.public=!0),a(i[r.sMaxAge])&&(n.sMaxAge=Number(i[r.sMaxAge])),a(i[r.staleIfError])&&(n.staleIfError=Number(i[r.staleIfError])),a(i[r.staleWhileRevalidate])&&(n.staleWhileRevalidate=Number(i[r.staleWhileRevalidate])),n}}(t)},549:(e,t)=>{var r,n;r=t,n=Symbol("fast-defer"),r.deferred=function(){var e,t,r=new Promise(((r,n)=>{e=r,t=n}));return r.resolve=e,r.reject=t,r[n]=1,r},r.isDeferred=function(e){return!!e&&!!e[n]}}},t={},r=function r(n){var a=t[n];if(void 0!==a)return a.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}(138),r;var e,t,r}));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AxiosCacheInterceptor=t():e.AxiosCacheInterceptor=t()}(self,(function(){return(()=>{"use strict";var e={834:e=>{e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n},e.exports.default=e.exports,e.exports.__esModule=!0},141:e=>{e.exports=function(e){if(Array.isArray(e))return e},e.exports.default=e.exports,e.exports.__esModule=!0},734:e=>{e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.default=e.exports,e.exports.__esModule=!0},357:e=>{function t(e,t,r,n,a,o,u){try{var i=e[o](u),s=i.value}catch(e){return void r(e)}i.done?t(s):Promise.resolve(s).then(n,a)}e.exports=function(e){return function(){var r=this,n=arguments;return new Promise((function(a,o){var u=e.apply(r,n);function i(e){t(u,a,o,i,s,"next",e)}function s(e){t(u,a,o,i,s,"throw",e)}i(void 0)}))}},e.exports.default=e.exports,e.exports.__esModule=!0},853:e=>{e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.default=e.exports,e.exports.__esModule=!0},156:e=>{e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.default=e.exports,e.exports.__esModule=!0},377:e=>{function t(r){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.default=e.exports,e.exports.__esModule=!0,t(r)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0},101:(e,t,r)=>{var n=r(204);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&n(e,t)},e.exports.default=e.exports,e.exports.__esModule=!0},489:e=>{e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.default=e.exports,e.exports.__esModule=!0},830:e=>{e.exports=function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o=[],u=!0,i=!1;try{for(r=r.call(e);!(u=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);u=!0);}catch(e){i=!0,a=e}finally{try{u||null==r.return||r.return()}finally{if(i)throw a}}return o}},e.exports.default=e.exports,e.exports.__esModule=!0},48:e=>{e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.default=e.exports,e.exports.__esModule=!0},305:(e,t,r)=>{var n=r(564);e.exports=function(e,t){if(null==e)return{};var r,a,o=n(e,t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(a=0;a<u.length;a++)r=u[a],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o},e.exports.default=e.exports,e.exports.__esModule=!0},564:e=>{e.exports=function(e,t){if(null==e)return{};var r,n,a={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(a[r]=e[r]);return a},e.exports.default=e.exports,e.exports.__esModule=!0},56:(e,t,r)=>{var n=r(559).default,a=r(734);e.exports=function(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return a(e)},e.exports.default=e.exports,e.exports.__esModule=!0},204:e=>{function t(r,n){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.default=e.exports,e.exports.__esModule=!0,t(r,n)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0},432:(e,t,r)=>{var n=r(141),a=r(830),o=r(798),u=r(48);e.exports=function(e,t){return n(e)||a(e,t)||o(e,t)||u()},e.exports.default=e.exports,e.exports.__esModule=!0},559:e=>{function t(r){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(e.exports=t=function(e){return typeof e},e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.default=e.exports,e.exports.__esModule=!0),t(r)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0},798:(e,t,r)=>{var n=r(834);e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(e,t):void 0}},e.exports.default=e.exports,e.exports.__esModule=!0},129:(e,t,r)=>{e.exports=r(760)},923:(e,t,r)=>{var n=r(489)(r(559));!function(e){var t=Symbol("cache-parser"),r={immutable:"immutable",maxAge:"max-age",maxStale:"max-stale",minFresh:"min-fresh",mustRevalidate:"must-revalidate",mustUnderstand:"must-understand",noCache:"no-cache",noStore:"no-store",noTransform:"no-transform",onlyIfCached:"only-if-cached",private:"private",proxyRevalidate:"proxy-revalidate",public:"public",sMaxAge:"s-maxage",staleIfError:"stale-if-error",staleWhileRevalidate:"stale-while-revalidate"};for(var a in r)r[r[a]]=a;function o(e){return("string"==typeof e||"number"==typeof e)&&(e=Number(e))>=0&&e<1/0}function u(e){return!0===e||"number"==typeof e||"string"==typeof e&&"false"!==e}e.Directive=r,e.toDuration=o,e.toBoolean=u,e.isCacheControl=function(e){return!!e&&!!e[t]},e.tokenize=function(e){if(!e||"object"!=(0,n.default)(e))return[];var t=[];return u(e.immutable)&&t.push(r.immutable),o(e.maxAge)&&t.push(r.maxAge+"="+Number(e.maxAge)),o(e.maxStale)&&t.push(r.maxStale+"="+Number(e.maxStale)),o(e.minFresh)&&t.push(r.minFresh+"="+Number(e.minFresh)),u(e.mustRevalidate)&&t.push(r.mustRevalidate),u(e.mustUnderstand)&&t.push(r.mustUnderstand),u(e.noCache)&&t.push(r.noCache),u(e.noStore)&&t.push(r.noStore),u(e.noTransform)&&t.push(r.noTransform),u(e.onlyIfCached)&&t.push(r.onlyIfCached),u(e.private)&&t.push(r.private),u(e.proxyRevalidate)&&t.push(r.proxyRevalidate),u(e.public)&&t.push(r.public),o(e.sMaxAge)&&t.push(r.sMaxAge+"="+Number(e.sMaxAge)),o(e.staleIfError)&&t.push(r.staleIfError+"="+Number(e.staleIfError)),o(e.staleWhileRevalidate)&&t.push(r.staleWhileRevalidate+"="+Number(e.staleWhileRevalidate)),t},e.parse=function(e){var n=Object.defineProperty({},t,{configurable:!1,enumerable:!1,writable:!1,value:1});if(!e||"string"!=typeof e)return n;var a={},i=e.toLowerCase().replace(/\s+/g,"").split(",");for(var s in i){var c=i[s].split("=",2);a[c[0]]=1===c.length||c[1]}return u(a[r.immutable])&&(n.immutable=!0),o(a[r.maxAge])&&(n.maxAge=Number(a[r.maxAge])),o(a[r.maxStale])&&(n.maxStale=Number(a[r.maxStale])),o(a[r.minFresh])&&(n.minFresh=Number(a[r.minFresh])),u(a[r.mustRevalidate])&&(n.mustRevalidate=!0),u(a[r.mustUnderstand])&&(n.mustUnderstand=!0),u(a[r.noCache])&&(n.noCache=!0),u(a[r.noStore])&&(n.noStore=!0),u(a[r.noTransform])&&(n.noTransform=!0),u(a[r.onlyIfCached])&&(n.onlyIfCached=!0),u(a[r.private])&&(n.private=!0),u(a[r.proxyRevalidate])&&(n.proxyRevalidate=!0),u(a[r.public])&&(n.public=!0),o(a[r.sMaxAge])&&(n.sMaxAge=Number(a[r.sMaxAge])),o(a[r.staleIfError])&&(n.staleIfError=Number(a[r.staleIfError])),o(a[r.staleWhileRevalidate])&&(n.staleWhileRevalidate=Number(a[r.staleWhileRevalidate])),n}}(t)},79:(e,t)=>{var r,n;r=t,n=Symbol("fast-defer"),r.deferred=function(){var e,t,r=new Promise((function(r,n){e=r,t=n}));return r.resolve=e,r.reject=t,r[n]=1,r},r.isDeferred=function(e){return!!e&&!!e[n]}},760:(e,t,r)=>{e=r.nmd(e);var n=r(489)(r(559)),a=function(e){var t,r=Object.prototype,a=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},u=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function f(e,t,r,n){var a=t&&t.prototype instanceof x?t:x,o=Object.create(a.prototype),u=new A(n||[]);return o._invoke=function(e,t,r){var n=d;return function(a,o){if(n===h)throw new Error("Generator is already running");if(n===v){if("throw"===a)throw o;return C()}for(r.method=a,r.arg=o;;){var u=r.delegate;if(u){var i=M(u,r);if(i){if(i===y)continue;return i}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===d)throw n=v,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=h;var s=l(e,t,r);if("normal"===s.type){if(n=r.done?v:p,s.arg===y)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n=v,r.method="throw",r.arg=s.arg)}}}(e,r,u),o}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=f;var d="suspendedStart",p="suspendedYield",h="executing",v="completed",y={};function x(){}function m(){}function b(){}var g={};c(g,u,(function(){return this}));var w=Object.getPrototypeOf,O=w&&w(w(k([])));O&&O!==r&&a.call(O,u)&&(g=O);var _=b.prototype=x.prototype=Object.create(g);function j(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function r(o,u,i,s){var c=l(e[o],e,u);if("throw"!==c.type){var f=c.arg,d=f.value;return d&&"object"===(0,n.default)(d)&&a.call(d,"__await")?t.resolve(d.__await).then((function(e){r("next",e,i,s)}),(function(e){r("throw",e,i,s)})):t.resolve(d).then((function(e){f.value=e,i(f)}),(function(e){return r("throw",e,i,s)}))}s(c.arg)}var o;this._invoke=function(e,n){function a(){return new t((function(t,a){r(e,n,t,a)}))}return o=o?o.then(a,a):a()}}function M(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,M(e,r),"throw"===r.method))return y;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}var a=l(n,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,y;var o=a.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function E(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function k(e){if(e){var r=e[u];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,o=function r(){for(;++n<e.length;)if(a.call(e,n))return r.value=e[n],r.done=!1,r;return r.value=t,r.done=!0,r};return o.next=o}}return{next:C}}function C(){return{value:t,done:!0}}return m.prototype=b,c(_,"constructor",b),c(b,"constructor",m),m.displayName=c(b,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===m||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,c(e,s,"GeneratorFunction")),e.prototype=Object.create(_),e},e.awrap=function(e){return{__await:e}},j(S.prototype),c(S.prototype,i,(function(){return this})),e.AsyncIterator=S,e.async=function(t,r,n,a,o){void 0===o&&(o=Promise);var u=new S(f(t,r,n,a),o);return e.isGeneratorFunction(r)?u:u.next().then((function(e){return e.done?e.value:u.next()}))},j(_),c(_,s,"Generator"),c(_,u,(function(){return this})),c(_,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=k,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(E),!e)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,a){return i.type="throw",i.arg=e,r.next=n,a&&(r.method="next",r.arg=t),!!a}for(var o=this.tryEntries.length-1;o>=0;--o){var u=this.tryEntries[o],i=u.completion;if("root"===u.tryLoc)return n("end");if(u.tryLoc<=this.prev){var s=a.call(u,"catchLoc"),c=a.call(u,"finallyLoc");if(s&&c){if(this.prev<u.catchLoc)return n(u.catchLoc,!0);if(this.prev<u.finallyLoc)return n(u.finallyLoc)}else if(s){if(this.prev<u.catchLoc)return n(u.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return n(u.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var u=o?o.completion:{};return u.type=e,u.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(u)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),E(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;E(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:k(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y}},e}("object"===(0,n.default)(e)?e.exports:{});try{regeneratorRuntime=a}catch(e){"object"===("undefined"==typeof globalThis?"undefined":(0,n.default)(globalThis))?globalThis.regeneratorRuntime=a:Function("r","regeneratorRuntime = r")(a)}},623:(e,t,r)=>{var n=r(489);Object.defineProperty(t,"__esModule",{value:!0}),t.useCache=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.storage,n=t.generateKey,a=t.waiting,d=t.headerInterpreter,h=t.requestInterceptor,v=t.responseInterceptor,y=(0,o.default)(t,l),x=e;return x.storage=r||new c.MemoryAxiosStorage,x.generateKey=n||f.defaultKeyGenerator,x.waiting=a||{},x.headerInterpreter=d||u.defaultHeaderInterpreter,x.requestInterceptor=h||new i.CacheRequestInterceptor(x),x.responseInterceptor=v||new s.CacheResponseInterceptor(x),x.defaults=p(p({},e.defaults),{},{cache:p({ttl:3e5,interpretHeader:!1,methods:["get"],cachePredicate:{statusCheck:[200,399]},etag:!1,modifiedSince:!1,update:{}},y)}),x.requestInterceptor.use(),x.responseInterceptor.use(),x};var a=n(r(156)),o=n(r(305)),u=r(110),i=r(278),s=r(299),c=r(470),f=r(571),l=["storage","generateKey","waiting","headerInterpreter","requestInterceptor","responseInterceptor"];function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){(0,a.default)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}},110:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.defaultHeaderInterpreter=void 0;var n=r(923),a=r(50);t.defaultHeaderInterpreter=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return a.Header.CacheControl in e?u(e[a.Header.CacheControl],e):a.Header.Expires in e?o(e[a.Header.Expires],e):void 0};var o=function(e){var t=Date.parse(e)-Date.now();return t>=0&&t},u=function(e,t){var r=(0,n.parse)(e),o=r.noCache,u=r.noStore,i=r.mustRevalidate,s=r.maxAge,c=r.immutable;if(o||u)return!1;if(c)return 31536e6;if(i)return 0;if(s){var f=t[a.Header.Age];return f?1e3*s-1e3*Number(f):1e3*s}}},138:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});var n=r(623);Object.keys(n).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===n[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return n[e]}}))}));var a=r(795);Object.keys(a).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===a[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return a[e]}}))}));var o=r(470);Object.keys(o).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===o[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return o[e]}}))}));var u=r(433);Object.keys(u).forEach((function(e){"default"!==e&&"__esModule"!==e&&(e in t&&t[e]===u[e]||Object.defineProperty(t,e,{enumerable:!0,get:function(){return u[e]}}))}))},278:(e,t,r)=>{var n=r(489);Object.defineProperty(t,"__esModule",{value:!0}),t.CacheRequestInterceptor=void 0;var a=n(r(129)),o=n(r(357)),u=n(r(853)),i=n(r(156)),s=r(79),c=r(50);function f(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return l(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,u=!0,i=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return u=e.done,e},e:function(e){i=!0,o=e},f:function(){try{u||null==r.return||r.return()}finally{if(i)throw o}}}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){(0,i.default)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var h=function e(t){var r=this;(0,u.default)(this,e),(0,i.default)(this,"use",(function(){r.axios.interceptors.request.use(r.onFulfilled)})),(0,i.default)(this,"onFulfilled",function(){var t=(0,o.default)(a.default.mark((function t(n){var o,u,i,c,f;return a.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!1!==n.cache){t.next=2;break}return t.abrupt("return",n);case 2:if(n.cache=p(p({},r.axios.defaults.cache),n.cache),e.isMethodAllowed(n.method,n.cache)){t.next=5;break}return t.abrupt("return",n);case 5:return o=r.axios.generateKey(n),t.next=8,r.axios.storage.get(o);case 8:if("empty"!=(u=t.sent).state&&"stale"!==u.state){t.next=22;break}if(!r.axios.waiting[o]){t.next=15;break}return t.next=13,r.axios.storage.get(o);case 13:return u=t.sent,t.abrupt("break",22);case 15:return r.axios.waiting[o]=(0,s.deferred)(),null===(i=r.axios.waiting[o])||void 0===i||i.catch((function(){})),t.next=19,r.axios.storage.set(o,{state:"loading",data:u.data});case 19:return"stale"===u.state&&e.setRevalidationHeaders(u,n),n.validateStatus=e.createValidateStatus(n.validateStatus),t.abrupt("return",n);case 22:if("loading"!==u.state){t.next=39;break}if(f=r.axios.waiting[o]){t.next=28;break}return t.next=27,r.axios.storage.remove(o);case 27:return t.abrupt("return",n);case 28:return t.prev=28,t.next=31,f;case 31:c=t.sent,t.next=37;break;case 34:return t.prev=34,t.t0=t.catch(28),t.abrupt("return",n);case 37:t.next=40;break;case 39:c=u.data;case 40:return n.adapter=function(){return Promise.resolve({config:n,data:c.data,headers:c.headers,status:c.status,statusText:c.statusText,cached:!0,id:o})},t.abrupt("return",n);case 42:case"end":return t.stop()}}),t,null,[[28,34]])})));return function(e){return t.apply(this,arguments)}}()),this.axios=t};t.CacheRequestInterceptor=h,(0,i.default)(h,"isMethodAllowed",(function(e,t){var r,n=e.toLowerCase(),a=f(t.methods||[]);try{for(a.s();!(r=a.n()).done;){if(r.value.toLowerCase()===n)return!0}}catch(e){a.e(e)}finally{a.f()}return!1})),(0,i.default)(h,"setRevalidationHeaders",(function(e,t){t.headers||(t.headers={});var r=t.cache,n=r.etag,a=r.modifiedSince;if(n){var o,u=!0===n?null===(o=e.data)||void 0===o?void 0:o.headers[c.Header.ETag]:n;u&&(t.headers[c.Header.IfNoneMatch]=u)}a&&(t.headers[c.Header.IfModifiedSince]=!0===a?e.data.headers[c.Header.LastModified]||new Date(e.createdAt).toUTCString():a.toUTCString())})),(0,i.default)(h,"createValidateStatus",(function(e){return function(t){return e?e(t)||304===t:t>=200&&t<300||304===t}}))},299:(e,t,r)=>{var n=r(489);Object.defineProperty(t,"__esModule",{value:!0}),t.CacheResponseInterceptor=void 0;var a=n(r(129)),o=n(r(357)),u=n(r(853)),i=n(r(156)),s=r(904),c=r(50),f=r(939);function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function d(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?l(Object(r),!0).forEach((function(t){(0,i.default)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var p=function e(t){var r=this;(0,u.default)(this,e),(0,i.default)(this,"use",(function(){r.axios.interceptors.response.use(r.onFulfilled)})),(0,i.default)(this,"onFulfilled",function(){var t=(0,o.default)(a.default.mark((function t(n){var o,u,i,l,p,h,v,y;return a.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(o=r.cachedResponse(n)).cached){t.next=3;break}return t.abrupt("return",o);case 3:if(o.config.cache){t.next=5;break}return t.abrupt("return",d(d({},o),{},{cached:!1}));case 5:return u=o.config.cache,t.next=8,r.axios.storage.get(o.id);case 8:if("stale"!==(i=t.sent).state&&"empty"!==i.state&&"cached"!==i.state){t.next=11;break}return t.abrupt("return",o);case 11:if(i.data||(0,s.shouldCacheResponse)(o,u)){t.next=15;break}return t.next=14,r.rejectResponse(o.id);case 14:return t.abrupt("return",o);case 15:if(delete o.headers[c.Header.XAxiosCacheEtag],delete o.headers[c.Header.XAxiosCacheLastModified],u.etag&&!0!==u.etag&&(o.headers[c.Header.XAxiosCacheEtag]=u.etag),u.modifiedSince&&(o.headers[c.Header.XAxiosCacheLastModified]=!0===u.modifiedSince?"use-cache-timestamp":u.modifiedSince.toUTCString()),l=u.ttl||-1,null==u||!u.interpretHeader){t.next=27;break}if(!1!==(p=r.axios.headerInterpreter(o.headers))){t.next=26;break}return t.next=25,r.rejectResponse(o.id);case 25:return t.abrupt("return",o);case 26:l=p||0===p?p:l;case 27:return h=e.createCacheData(o,i.data),v={state:"cached",ttl:l,createdAt:Date.now(),data:h},null!=u&&u.update&&(0,f.updateCache)(r.axios.storage,o.data,u.update),y=r.axios.waiting[o.id],t.next=33,null==y?void 0:y.resolve(v.data);case 33:return delete r.axios.waiting[o.id],t.next=36,r.axios.storage.set(o.id,v);case 36:return t.abrupt("return",o);case 37:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),(0,i.default)(this,"rejectResponse",function(){var e=(0,o.default)(a.default.mark((function e(t){var n;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.axios.storage.remove(t);case 2:null===(n=r.axios.waiting[t])||void 0===n||n.reject(null),delete r.axios.waiting[t];case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),(0,i.default)(this,"cachedResponse",(function(e){return d({id:r.axios.generateKey(e.config),cached:e.cached||!1},e)})),this.axios=t};t.CacheResponseInterceptor=p,(0,i.default)(p,"createCacheData",(function(e,t){return 304===e.status&&t?(e.cached=!0,e.data=t.data,e.status=t.status,e.statusText=t.statusText,e.headers=d(d({},t.headers),e.headers),t):{data:e.data,status:e.status,statusText:e.statusText,headers:e.headers}}))},795:(e,t,r)=>{var n=r(489);Object.defineProperty(t,"__esModule",{value:!0}),t.BrowserAxiosStorage=void 0;var a=n(r(129)),o=n(r(357)),u=n(r(853)),i=n(r(734)),s=n(r(101)),c=n(r(56)),f=n(r(377)),l=n(r(156));function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=(0,f.default)(e);if(t){var a=(0,f.default)(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return(0,c.default)(this,r)}}var p=function(e){(0,s.default)(r,e);var t=d(r);function r(e){var n,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.DEFAULT_KEY_PREFIX;return(0,u.default)(this,r),n=t.call(this),(0,l.default)((0,i.default)(n),"find",function(){var e=(0,o.default)(a.default.mark((function e(t){var r;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.storage.getItem("".concat(n.prefix,":").concat(t)),e.abrupt("return",r?JSON.parse(r):{state:"empty"});case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),(0,l.default)((0,i.default)(n),"set",function(){var e=(0,o.default)(a.default.mark((function e(t,r){return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.storage.setItem("".concat(n.prefix,":").concat(t),JSON.stringify(r)));case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()),(0,l.default)((0,i.default)(n),"remove",function(){var e=(0,o.default)(a.default.mark((function e(t){return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.storage.removeItem("".concat(n.prefix,":").concat(t)));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),n.storage=e,n.prefix=s,n}return r}(r(433).AxiosStorage);t.BrowserAxiosStorage=p,(0,l.default)(p,"DEFAULT_KEY_PREFIX","a-c-i")},470:(e,t,r)=>{var n=r(489);Object.defineProperty(t,"__esModule",{value:!0}),t.MemoryAxiosStorage=void 0;var a=n(r(129)),o=n(r(357)),u=n(r(853)),i=n(r(734)),s=n(r(101)),c=n(r(56)),f=n(r(377)),l=n(r(156));function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=(0,f.default)(e);if(t){var a=(0,f.default)(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return(0,c.default)(this,r)}}var p=function(e){(0,s.default)(r,e);var t=d(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,u.default)(this,r),e=t.call(this),(0,l.default)((0,i.default)(e),"find",function(){var t=(0,o.default)(a.default.mark((function t(r){return a.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",e.storage[r]||{state:"empty"});case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),(0,l.default)((0,i.default)(e),"set",function(){var t=(0,o.default)(a.default.mark((function t(r,n){return a.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.storage[r]=n;case 1:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}()),(0,l.default)((0,i.default)(e),"remove",function(){var t=(0,o.default)(a.default.mark((function t(r){return a.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:delete e.storage[r];case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),e.storage=n,e}return r}(r(433).AxiosStorage);t.MemoryAxiosStorage=p},433:(e,t,r)=>{var n=r(489);Object.defineProperty(t,"__esModule",{value:!0}),t.AxiosStorage=void 0;var a=n(r(129)),o=n(r(357)),u=n(r(853)),i=n(r(156)),s=r(50),c=function e(){var t=this;(0,u.default)(this,e),(0,i.default)(this,"get",function(){var r=(0,o.default)(a.default.mark((function r(n){var o,u;return a.default.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t.find(n);case 2:if(!("cached"!==(o=r.sent).state||o.createdAt+o.ttl>Date.now())){r.next=5;break}return r.abrupt("return",o);case 5:if(!e.keepIfStale(o)){r.next=10;break}return u={data:o.data,state:"stale",createdAt:o.createdAt},r.next=9,t.set(n,u);case 9:return r.abrupt("return",u);case 10:return r.next=12,t.remove(n);case 12:return r.abrupt("return",{state:"empty"});case 13:case"end":return r.stop()}}),r)})));return function(e){return r.apply(this,arguments)}}())};t.AxiosStorage=c,(0,i.default)(c,"keepIfStale",(function(e){var t=e.data;return!(null==t||!t.headers)&&(s.Header.ETag in t.headers||s.Header.LastModified in t.headers||s.Header.XAxiosCacheEtag in t.headers||s.Header.XAxiosCacheLastModified in t.headers)}))},904:(e,t,r)=>{var n=r(489);Object.defineProperty(t,"__esModule",{value:!0}),t.isCachePredicateValid=u,t.shouldCacheResponse=function(e,t){var r=t.cachePredicate;if("function"==typeof r)return r(e);return u(e,r)};var a=n(r(559)),o=n(r(432));function u(e,t){var r=t.statusCheck,n=t.containsHeaders,u=t.responseMatch;if(r)if("function"==typeof r){if(!r(e.status))return!1}else{var i=(0,o.default)(r,2),s=i[0],c=i[1];if(e.status<s||e.status>c)return!1}if(n)for(var f in n){var l=n[f],d=e.headers[f];if(!d)return!1;switch((0,a.default)(l)){case"string":if(d!=l)return!1;break;case"function":if(!l(d))return!1}}return!(u&&!u(e.data))}},50:(e,t)=>{var r;Object.defineProperty(t,"__esModule",{value:!0}),t.Header=void 0,t.Header=r,function(e){e.IfModifiedSince="if-modified-since",e.LastModified="last-modified",e.IfNoneMatch="if-none-match",e.CacheControl="cache-control",e.ETag="etag",e.Expires="expires",e.Age="age",e.ContentType="content-type",e.XAxiosCacheEtag="x-axios-cache-etag",e.XAxiosCacheLastModified="x-axios-cache-last-modified"}(r||(t.Header=r={}))},571:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.defaultKeyGenerator=void 0;var r=/^\/|\/+$/g;t.defaultKeyGenerator=function(e){var t=e.baseURL,n=void 0===t?"":t,a=e.url,o=void 0===a?"":a,u=e.method,i=e.params,s=e.id;if(s)return String(s);n=n.replace(r,""),o=o.replace(r,"");var c=(null==u?void 0:u.toLowerCase())||"get",f=i?JSON.stringify(i,Object.keys(i).sort()):"{}";return"".concat(c,"::").concat(n+(o&&n?"/":"")+o,"::").concat(f)}},939:(e,t,r)=>{var n=r(489);Object.defineProperty(t,"__esModule",{value:!0}),t.updateCache=function(e,t,r){return u.apply(this,arguments)};var a=n(r(129)),o=n(r(357));function u(){return(u=(0,o.default)(a.default.mark((function e(t,r,n){var o,u,i,s;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:e.t0=a.default.keys(n);case 1:if((e.t1=e.t0()).done){e.next=22;break}if(o=e.t1.value,"delete"!==(u=n[o])){e.next=8;break}return e.next=7,t.remove(o);case 7:return e.abrupt("continue",1);case 8:return e.next=10,t.get(o);case 10:if("loading"!==(i=e.sent).state){e.next=13;break}throw new Error("cannot update the cache while loading");case 13:if(void 0!==(s=u(i,r))){e.next=18;break}return e.next=17,t.remove(o);case 17:return e.abrupt("continue",1);case 18:return e.next=20,t.set(o,s);case 20:e.next=1;break;case 22:case"end":return e.stop()}}),e)})))).apply(this,arguments)}}},t={};function r(n){var a=t[n];if(void 0!==a)return a.exports;var o=t[n]={id:n,loaded:!1,exports:{}};return e[n](o,o.exports,r),o.loaded=!0,o.exports}return r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),r(138)})()}));
//# sourceMappingURL=index.bundle.js.map

@@ -1,1 +0,20 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});var _axios=require("./cache/axios");Object.keys(_axios).forEach(function(key){if(key==="default"||key==="__esModule")return;if(key in exports&&exports[key]===_axios[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _axios[key];}});});var _cache=require("./cache/cache");Object.keys(_cache).forEach(function(key){if(key==="default"||key==="__esModule")return;if(key in exports&&exports[key]===_cache[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _cache[key];}});});var _create=require("./cache/create");Object.keys(_create).forEach(function(key){if(key==="default"||key==="__esModule")return;if(key in exports&&exports[key]===_create[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _create[key];}});});var _types=require("./header/types");Object.keys(_types).forEach(function(key){if(key==="default"||key==="__esModule")return;if(key in exports&&exports[key]===_types[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _types[key];}});});var _types2=require("./interceptors/types");Object.keys(_types2).forEach(function(key){if(key==="default"||key==="__esModule")return;if(key in exports&&exports[key]===_types2[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _types2[key];}});});var _storage=require("./storage/storage");Object.keys(_storage).forEach(function(key){if(key==="default"||key==="__esModule")return;if(key in exports&&exports[key]===_storage[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _storage[key];}});});var _types3=require("./storage/types");Object.keys(_types3).forEach(function(key){if(key==="default"||key==="__esModule")return;if(key in exports&&exports[key]===_types3[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _types3[key];}});});var _types4=require("./util/types");Object.keys(_types4).forEach(function(key){if(key==="default"||key==="__esModule")return;if(key in exports&&exports[key]===_types4[key])return;Object.defineProperty(exports,key,{enumerable:true,get:function get(){return _types4[key];}});});
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./cache/axios"), exports);
__exportStar(require("./cache/cache"), exports);
__exportStar(require("./cache/create"), exports);
__exportStar(require("./header/types"), exports);
__exportStar(require("./interceptors/types"), exports);
__exportStar(require("./storage/storage"), exports);
__exportStar(require("./storage/types"), exports);
__exportStar(require("./util/types"), exports);

@@ -18,8 +18,4 @@ import type { AxiosRequestConfig, Method } from 'axios';

}) => void;
/**
* Creates a new validateStatus function that will use the one already used and also
* accept status code 304.
*/
static readonly createValidateStatus: (oldValidate?: AxiosRequestConfig['validateStatus']) => (status: number) => boolean;
}
//# sourceMappingURL=request.d.ts.map

@@ -1,1 +0,114 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.CacheRequestInterceptor=void 0;var _fastDefer=require("fast-defer");var _headers=require("../util/headers");function _createForOfIteratorHelper(o,allowArrayLike){var it=typeof Symbol!=="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&typeof o.length==="number"){if(it)o=it;var i=0;var F=function F(){};return{s:F,n:function n(){if(i>=o.length)return{done:true};return{done:false,value:o[i++]};},e:function e(_e){throw _e;},f:F};}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}var normalCompletion=true,didErr=false,err;return{s:function s(){it=it.call(o);},n:function n(){var step=it.next();normalCompletion=step.done;return step;},e:function e(_e2){didErr=true;err=_e2;},f:function f(){try{if(!normalCompletion&&it.return!=null)it.return();}finally{if(didErr)throw err;}}};}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});}keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}var CacheRequestInterceptor=function CacheRequestInterceptor(axios){var _this=this;_classCallCheck(this,CacheRequestInterceptor);_defineProperty(this,"use",function(){_this.axios.interceptors.request.use(_this.onFulfilled);});_defineProperty(this,"onFulfilled",function(){var _ref=_asyncToGenerator(regeneratorRuntime.mark(function _callee(config){var key,cache,_this$axios$waiting$k,cachedResponse,_deferred;return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:if(!(config.cache===false)){_context.next=2;break;}return _context.abrupt("return",config);case 2:config.cache=_objectSpread(_objectSpread({},_this.axios.defaults.cache),config.cache);if(CacheRequestInterceptor.isMethodAllowed(config.method,config.cache)){_context.next=5;break;}return _context.abrupt("return",config);case 5:key=_this.axios.generateKey(config);_context.next=8;return _this.axios.storage.get(key);case 8:cache=_context.sent;if(!(cache.state=='empty'||cache.state==='stale')){_context.next=22;break;}if(!_this.axios.waiting[key]){_context.next=15;break;}_context.next=13;return _this.axios.storage.get(key);case 13:cache=_context.sent;return _context.abrupt("break",22);case 15:_this.axios.waiting[key]=(0,_fastDefer.deferred)();(_this$axios$waiting$k=_this.axios.waiting[key])===null||_this$axios$waiting$k===void 0?void 0:_this$axios$waiting$k.catch(function(){return undefined;});_context.next=19;return _this.axios.storage.set(key,{state:'loading',data:cache.data});case 19:if(cache.state==='stale'){CacheRequestInterceptor.setRevalidationHeaders(cache,config);}config.validateStatus=CacheRequestInterceptor.createValidateStatus(config.validateStatus);return _context.abrupt("return",config);case 22:if(!(cache.state==='loading')){_context.next=39;break;}_deferred=_this.axios.waiting[key];if(_deferred){_context.next=28;break;}_context.next=27;return _this.axios.storage.remove(key);case 27:return _context.abrupt("return",config);case 28:_context.prev=28;_context.next=31;return _deferred;case 31:cachedResponse=_context.sent;_context.next=37;break;case 34:_context.prev=34;_context.t0=_context["catch"](28);return _context.abrupt("return",config);case 37:_context.next=40;break;case 39:cachedResponse=cache.data;case 40:config.adapter=function(){return Promise.resolve({config:config,data:cachedResponse.data,headers:cachedResponse.headers,status:cachedResponse.status,statusText:cachedResponse.statusText,cached:true,id:key});};return _context.abrupt("return",config);case 42:case"end":return _context.stop();}}},_callee,null,[[28,34]]);}));return function(_x){return _ref.apply(this,arguments);};}());this.axios=axios;};exports.CacheRequestInterceptor=CacheRequestInterceptor;_defineProperty(CacheRequestInterceptor,"isMethodAllowed",function(method,properties){var requestMethod=method.toLowerCase();var _iterator=_createForOfIteratorHelper(properties.methods||[]),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var _method=_step.value;if(_method.toLowerCase()===requestMethod){return true;}}}catch(err){_iterator.e(err);}finally{_iterator.f();}return false;});_defineProperty(CacheRequestInterceptor,"setRevalidationHeaders",function(cache,config){config.headers||(config.headers={});var _config$cache=config.cache,etag=_config$cache.etag,modifiedSince=_config$cache.modifiedSince;if(etag){var _cache$data;var etagValue=etag===true?(_cache$data=cache.data)===null||_cache$data===void 0?void 0:_cache$data.headers[_headers.Header.ETag]:etag;if(etagValue){config.headers[_headers.Header.IfNoneMatch]=etagValue;}}if(modifiedSince){config.headers[_headers.Header.IfModifiedSince]=modifiedSince===true?cache.data.headers[_headers.Header.LastModified]||new Date(cache.createdAt).toUTCString():modifiedSince.toUTCString();}});_defineProperty(CacheRequestInterceptor,"createValidateStatus",function(oldValidate){return function(status){return oldValidate?oldValidate(status)||status===304:status>=200&&status<300||status===304;};});
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CacheRequestInterceptor = void 0;
const fast_defer_1 = require("fast-defer");
const headers_1 = require("../util/headers");
class CacheRequestInterceptor {
constructor(axios) {
this.axios = axios;
this.use = () => {
this.axios.interceptors.request.use(this.onFulfilled);
};
this.onFulfilled = (config) => __awaiter(this, void 0, void 0, function* () {
var _a;
if (config.cache === false) {
return config;
}
config.cache = Object.assign(Object.assign({}, this.axios.defaults.cache), config.cache);
if (!CacheRequestInterceptor.isMethodAllowed(config.method, config.cache)) {
return config;
}
const key = this.axios.generateKey(config);
let cache = yield this.axios.storage.get(key);
emptyOrStale: if (cache.state == 'empty' || cache.state === 'stale') {
if (this.axios.waiting[key]) {
cache = (yield this.axios.storage.get(key));
break emptyOrStale;
}
this.axios.waiting[key] = (0, fast_defer_1.deferred)();
(_a = this.axios.waiting[key]) === null || _a === void 0 ? void 0 : _a.catch(() => undefined);
yield this.axios.storage.set(key, {
state: 'loading',
data: cache.data
});
if (cache.state === 'stale') {
CacheRequestInterceptor.setRevalidationHeaders(cache, config);
}
config.validateStatus = CacheRequestInterceptor.createValidateStatus(config.validateStatus);
return config;
}
let cachedResponse;
if (cache.state === 'loading') {
const deferred = this.axios.waiting[key];
if (!deferred) {
yield this.axios.storage.remove(key);
return config;
}
try {
cachedResponse = yield deferred;
}
catch (_b) {
return config;
}
}
else {
cachedResponse = cache.data;
}
config.adapter = () => Promise.resolve({
config: config,
data: cachedResponse.data,
headers: cachedResponse.headers,
status: cachedResponse.status,
statusText: cachedResponse.statusText,
cached: true,
id: key
});
return config;
});
}
}
exports.CacheRequestInterceptor = CacheRequestInterceptor;
CacheRequestInterceptor.isMethodAllowed = (method, properties) => {
const requestMethod = method.toLowerCase();
for (const method of properties.methods || []) {
if (method.toLowerCase() === requestMethod) {
return true;
}
}
return false;
};
CacheRequestInterceptor.setRevalidationHeaders = (cache, config) => {
var _a;
config.headers || (config.headers = {});
const { etag, modifiedSince } = config.cache;
if (etag) {
const etagValue = etag === true ? (_a = cache.data) === null || _a === void 0 ? void 0 : _a.headers[headers_1.Header.ETag] : etag;
if (etagValue) {
config.headers[headers_1.Header.IfNoneMatch] = etagValue;
}
}
if (modifiedSince) {
config.headers[headers_1.Header.IfModifiedSince] =
modifiedSince === true
?
cache.data.headers[headers_1.Header.LastModified] ||
new Date(cache.createdAt).toUTCString()
: modifiedSince.toUTCString();
}
};
CacheRequestInterceptor.createValidateStatus = (oldValidate) => {
return (status) => {
return oldValidate
? oldValidate(status) || status === 304
: (status >= 200 && status < 300) || status === 304;
};
};

@@ -10,11 +10,6 @@ import type { AxiosResponse } from 'axios';

readonly onFulfilled: (axiosResponse: AxiosResponse<R, D>) => Promise<CacheAxiosResponse<R, D>>;
/** Rejects cache for this response. Also update the waiting list for this key by rejecting it. */
readonly rejectResponse: (key: string) => Promise<void>;
readonly cachedResponse: (response: AxiosResponse<R, D>) => CacheAxiosResponse<R, D>;
/**
* Creates the new date to the cache by the provided response. Also handles possible 304
* Not Modified by updating response properties.
*/
static readonly createCacheData: <R_1, D_1>(response: CacheAxiosResponse<R_1, D_1>, cache?: CachedResponse | undefined) => CachedResponse;
}
//# sourceMappingURL=response.d.ts.map

@@ -1,1 +0,105 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.CacheResponseInterceptor=void 0;var _cachePredicate=require("../util/cache-predicate");var _headers=require("../util/headers");var _updateCache=require("../util/update-cache");function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);if(enumerableOnly){symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;});}keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=arguments[i]!=null?arguments[i]:{};if(i%2){ownKeys(Object(source),true).forEach(function(key){_defineProperty(target,key,source[key]);});}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(target,Object.getOwnPropertyDescriptors(source));}else{ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}}return target;}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}var CacheResponseInterceptor=function CacheResponseInterceptor(axios){var _this=this;_classCallCheck(this,CacheResponseInterceptor);_defineProperty(this,"use",function(){_this.axios.interceptors.response.use(_this.onFulfilled);});_defineProperty(this,"onFulfilled",function(){var _ref=_asyncToGenerator(regeneratorRuntime.mark(function _callee(axiosResponse){var response,cacheConfig,cache,ttl,expirationTime,data,newCache,deferred;return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:response=_this.cachedResponse(axiosResponse);if(!response.cached){_context.next=3;break;}return _context.abrupt("return",response);case 3:if(response.config.cache){_context.next=5;break;}return _context.abrupt("return",_objectSpread(_objectSpread({},response),{},{cached:false}));case 5:cacheConfig=response.config.cache;_context.next=8;return _this.axios.storage.get(response.id);case 8:cache=_context.sent;if(!(cache.state==='stale'||cache.state==='empty'||cache.state==='cached')){_context.next=11;break;}return _context.abrupt("return",response);case 11:if(!(!cache.data&&!(0,_cachePredicate.shouldCacheResponse)(response,cacheConfig))){_context.next=15;break;}_context.next=14;return _this.rejectResponse(response.id);case 14:return _context.abrupt("return",response);case 15:delete response.headers[_headers.Header.XAxiosCacheEtag];delete response.headers[_headers.Header.XAxiosCacheLastModified];if(cacheConfig.etag&&cacheConfig.etag!==true){response.headers[_headers.Header.XAxiosCacheEtag]=cacheConfig.etag;}if(cacheConfig.modifiedSince){response.headers[_headers.Header.XAxiosCacheLastModified]=cacheConfig.modifiedSince===true?'use-cache-timestamp':cacheConfig.modifiedSince.toUTCString();}ttl=cacheConfig.ttl||-1;if(!(cacheConfig!==null&&cacheConfig!==void 0&&cacheConfig.interpretHeader)){_context.next=27;break;}expirationTime=_this.axios.headerInterpreter(response.headers);if(!(expirationTime===false)){_context.next=26;break;}_context.next=25;return _this.rejectResponse(response.id);case 25:return _context.abrupt("return",response);case 26:ttl=expirationTime||expirationTime===0?expirationTime:ttl;case 27:data=CacheResponseInterceptor.createCacheData(response,cache.data);newCache={state:'cached',ttl:ttl,createdAt:Date.now(),data:data};if(cacheConfig!==null&&cacheConfig!==void 0&&cacheConfig.update){(0,_updateCache.updateCache)(_this.axios.storage,response.data,cacheConfig.update);}deferred=_this.axios.waiting[response.id];_context.next=33;return deferred===null||deferred===void 0?void 0:deferred.resolve(newCache.data);case 33:delete _this.axios.waiting[response.id];_context.next=36;return _this.axios.storage.set(response.id,newCache);case 36:return _context.abrupt("return",response);case 37:case"end":return _context.stop();}}},_callee);}));return function(_x){return _ref.apply(this,arguments);};}());_defineProperty(this,"rejectResponse",function(){var _ref2=_asyncToGenerator(regeneratorRuntime.mark(function _callee2(key){var _this$axios$waiting$k;return regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_context2.next=2;return _this.axios.storage.remove(key);case 2:(_this$axios$waiting$k=_this.axios.waiting[key])===null||_this$axios$waiting$k===void 0?void 0:_this$axios$waiting$k.reject(null);delete _this.axios.waiting[key];case 4:case"end":return _context2.stop();}}},_callee2);}));return function(_x2){return _ref2.apply(this,arguments);};}());_defineProperty(this,"cachedResponse",function(response){return _objectSpread({id:_this.axios.generateKey(response.config),cached:response.cached||false},response);});this.axios=axios;};exports.CacheResponseInterceptor=CacheResponseInterceptor;_defineProperty(CacheResponseInterceptor,"createCacheData",function(response,cache){if(response.status===304&&cache){response.cached=true;response.data=cache.data;response.status=cache.status;response.statusText=cache.statusText;response.headers=_objectSpread(_objectSpread({},cache.headers),response.headers);return cache;}return{data:response.data,status:response.status,statusText:response.statusText,headers:response.headers};});
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CacheResponseInterceptor = void 0;
const cache_predicate_1 = require("../util/cache-predicate");
const headers_1 = require("../util/headers");
const update_cache_1 = require("../util/update-cache");
class CacheResponseInterceptor {
constructor(axios) {
this.axios = axios;
this.use = () => {
this.axios.interceptors.response.use(this.onFulfilled);
};
this.onFulfilled = (axiosResponse) => __awaiter(this, void 0, void 0, function* () {
const response = this.cachedResponse(axiosResponse);
if (response.cached) {
return response;
}
if (!response.config.cache) {
return Object.assign(Object.assign({}, response), { cached: false });
}
const cacheConfig = response.config.cache;
const cache = yield this.axios.storage.get(response.id);
if (cache.state === 'stale' ||
cache.state === 'empty' ||
cache.state === 'cached') {
return response;
}
if (!cache.data &&
!(0, cache_predicate_1.shouldCacheResponse)(response, cacheConfig)) {
yield this.rejectResponse(response.id);
return response;
}
delete response.headers[headers_1.Header.XAxiosCacheEtag];
delete response.headers[headers_1.Header.XAxiosCacheLastModified];
if (cacheConfig.etag && cacheConfig.etag !== true) {
response.headers[headers_1.Header.XAxiosCacheEtag] = cacheConfig.etag;
}
if (cacheConfig.modifiedSince) {
response.headers[headers_1.Header.XAxiosCacheLastModified] =
cacheConfig.modifiedSince === true
? 'use-cache-timestamp'
: cacheConfig.modifiedSince.toUTCString();
}
let ttl = cacheConfig.ttl || -1;
if (cacheConfig === null || cacheConfig === void 0 ? void 0 : cacheConfig.interpretHeader) {
const expirationTime = this.axios.headerInterpreter(response.headers);
if (expirationTime === false) {
yield this.rejectResponse(response.id);
return response;
}
ttl = expirationTime || expirationTime === 0 ? expirationTime : ttl;
}
const data = CacheResponseInterceptor.createCacheData(response, cache.data);
const newCache = {
state: 'cached',
ttl,
createdAt: Date.now(),
data
};
if (cacheConfig === null || cacheConfig === void 0 ? void 0 : cacheConfig.update) {
(0, update_cache_1.updateCache)(this.axios.storage, response.data, cacheConfig.update);
}
const deferred = this.axios.waiting[response.id];
yield (deferred === null || deferred === void 0 ? void 0 : deferred.resolve(newCache.data));
delete this.axios.waiting[response.id];
yield this.axios.storage.set(response.id, newCache);
return response;
});
this.rejectResponse = (key) => __awaiter(this, void 0, void 0, function* () {
var _a;
yield this.axios.storage.remove(key);
(_a = this.axios.waiting[key]) === null || _a === void 0 ? void 0 : _a.reject(null);
delete this.axios.waiting[key];
});
this.cachedResponse = (response) => {
return Object.assign({ id: this.axios.generateKey(response.config), cached: response.cached || false }, response);
};
}
}
exports.CacheResponseInterceptor = CacheResponseInterceptor;
CacheResponseInterceptor.createCacheData = (response, cache) => {
if (response.status === 304 && cache) {
response.cached = true;
response.data = cache.data;
response.status = cache.status;
response.statusText = cache.statusText;
response.headers = Object.assign(Object.assign({}, cache.headers), response.headers);
return cache;
}
return {
data: response.data,
status: response.status,
statusText: response.statusText,
headers: response.headers
};
};
export interface AxiosInterceptor<T> {
onFulfilled?(value: T): T | Promise<T>;
onRejected?(error: any): any;
/**
* Should apply this interceptor to an already provided axios instance. Does not call
* this method explicitly.
*/
use(): void;
}
//# sourceMappingURL=types.d.ts.map

@@ -1,1 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

@@ -8,6 +8,2 @@ import type { NotEmptyStorageValue } from '..';

static readonly DEFAULT_KEY_PREFIX = "a-c-i";
/**
* @param storage Any browser storage, like sessionStorage or localStorage
* @param prefix The key prefix to use on all keys.
*/
constructor(storage: Storage, prefix?: string);

@@ -14,0 +10,0 @@ readonly find: (key: string) => Promise<StorageValue>;

@@ -1,1 +0,32 @@

"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}Object.defineProperty(exports,"__esModule",{value:true});exports.BrowserAxiosStorage=void 0;var _storage=require("./storage");function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}var BrowserAxiosStorage=function(_AxiosStorage){_inherits(BrowserAxiosStorage,_AxiosStorage);var _super=_createSuper(BrowserAxiosStorage);function BrowserAxiosStorage(storage){var _this;var prefix=arguments.length>1&&arguments[1]!==undefined?arguments[1]:BrowserAxiosStorage.DEFAULT_KEY_PREFIX;_classCallCheck(this,BrowserAxiosStorage);_this=_super.call(this);_defineProperty(_assertThisInitialized(_this),"find",function(){var _ref=_asyncToGenerator(regeneratorRuntime.mark(function _callee(key){var json;return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:json=_this.storage.getItem("".concat(_this.prefix,":").concat(key));return _context.abrupt("return",json?JSON.parse(json):{state:'empty'});case 2:case"end":return _context.stop();}}},_callee);}));return function(_x){return _ref.apply(this,arguments);};}());_defineProperty(_assertThisInitialized(_this),"set",function(){var _ref2=_asyncToGenerator(regeneratorRuntime.mark(function _callee2(key,value){return regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:return _context2.abrupt("return",_this.storage.setItem("".concat(_this.prefix,":").concat(key),JSON.stringify(value)));case 1:case"end":return _context2.stop();}}},_callee2);}));return function(_x2,_x3){return _ref2.apply(this,arguments);};}());_defineProperty(_assertThisInitialized(_this),"remove",function(){var _ref3=_asyncToGenerator(regeneratorRuntime.mark(function _callee3(key){return regeneratorRuntime.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:return _context3.abrupt("return",_this.storage.removeItem("".concat(_this.prefix,":").concat(key)));case 1:case"end":return _context3.stop();}}},_callee3);}));return function(_x4){return _ref3.apply(this,arguments);};}());_this.storage=storage;_this.prefix=prefix;return _this;}return BrowserAxiosStorage;}(_storage.AxiosStorage);exports.BrowserAxiosStorage=BrowserAxiosStorage;_defineProperty(BrowserAxiosStorage,"DEFAULT_KEY_PREFIX",'a-c-i');
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BrowserAxiosStorage = void 0;
const storage_1 = require("./storage");
class BrowserAxiosStorage extends storage_1.AxiosStorage {
constructor(storage, prefix = BrowserAxiosStorage.DEFAULT_KEY_PREFIX) {
super();
this.storage = storage;
this.prefix = prefix;
this.find = (key) => __awaiter(this, void 0, void 0, function* () {
const json = this.storage.getItem(`${this.prefix}:${key}`);
return json ? JSON.parse(json) : { state: 'empty' };
});
this.set = (key, value) => __awaiter(this, void 0, void 0, function* () {
return this.storage.setItem(`${this.prefix}:${key}`, JSON.stringify(value));
});
this.remove = (key) => __awaiter(this, void 0, void 0, function* () {
return this.storage.removeItem(`${this.prefix}:${key}`);
});
}
}
exports.BrowserAxiosStorage = BrowserAxiosStorage;
BrowserAxiosStorage.DEFAULT_KEY_PREFIX = 'a-c-i';

@@ -1,1 +0,29 @@

"use strict";function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}Object.defineProperty(exports,"__esModule",{value:true});exports.MemoryAxiosStorage=void 0;var _storage=require("./storage");function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}var MemoryAxiosStorage=function(_AxiosStorage){_inherits(MemoryAxiosStorage,_AxiosStorage);var _super=_createSuper(MemoryAxiosStorage);function MemoryAxiosStorage(){var _this;var storage=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};_classCallCheck(this,MemoryAxiosStorage);_this=_super.call(this);_defineProperty(_assertThisInitialized(_this),"find",function(){var _ref=_asyncToGenerator(regeneratorRuntime.mark(function _callee(key){return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:return _context.abrupt("return",_this.storage[key]||{state:'empty'});case 1:case"end":return _context.stop();}}},_callee);}));return function(_x){return _ref.apply(this,arguments);};}());_defineProperty(_assertThisInitialized(_this),"set",function(){var _ref2=_asyncToGenerator(regeneratorRuntime.mark(function _callee2(key,value){return regeneratorRuntime.wrap(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_this.storage[key]=value;case 1:case"end":return _context2.stop();}}},_callee2);}));return function(_x2,_x3){return _ref2.apply(this,arguments);};}());_defineProperty(_assertThisInitialized(_this),"remove",function(){var _ref3=_asyncToGenerator(regeneratorRuntime.mark(function _callee3(key){return regeneratorRuntime.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:delete _this.storage[key];case 1:case"end":return _context3.stop();}}},_callee3);}));return function(_x4){return _ref3.apply(this,arguments);};}());_this.storage=storage;return _this;}return MemoryAxiosStorage;}(_storage.AxiosStorage);exports.MemoryAxiosStorage=MemoryAxiosStorage;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MemoryAxiosStorage = void 0;
const storage_1 = require("./storage");
class MemoryAxiosStorage extends storage_1.AxiosStorage {
constructor(storage = {}) {
super();
this.storage = storage;
this.find = (key) => __awaiter(this, void 0, void 0, function* () {
return this.storage[key] || { state: 'empty' };
});
this.set = (key, value) => __awaiter(this, void 0, void 0, function* () {
this.storage[key] = value;
});
this.remove = (key) => __awaiter(this, void 0, void 0, function* () {
delete this.storage[key];
});
}
}
exports.MemoryAxiosStorage = MemoryAxiosStorage;
import type { CachedStorageValue, NotEmptyStorageValue } from '..';
import type { StorageValue } from './types';
export declare abstract class AxiosStorage {
/**
* Returns the cached value for the given key. The get method is what takes care to
* invalidate the values.
*/
protected abstract readonly find: (key: string) => Promise<StorageValue>;
/**
* Sets a new value for the given key
*
* Use CacheStorage.remove(key) to define a key to 'empty' state.
*/
abstract readonly set: (key: string, value: NotEmptyStorageValue) => Promise<void>;
/** Removes the value for the given key */
abstract readonly remove: (key: string) => Promise<void>;
readonly get: (key: string) => Promise<StorageValue>;
/** Returns true if a invalid cache should still be kept */
static readonly keepIfStale: ({ data }: CachedStorageValue) => boolean;
}
//# sourceMappingURL=storage.d.ts.map

@@ -1,1 +0,45 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.AxiosStorage=void 0;var _headers=require("../util/headers");function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}var AxiosStorage=function AxiosStorage(){var _this=this;_classCallCheck(this,AxiosStorage);_defineProperty(this,"get",function(){var _ref=_asyncToGenerator(regeneratorRuntime.mark(function _callee(key){var value,stale;return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return _this.find(key);case 2:value=_context.sent;if(!(value.state!=='cached'||value.createdAt+value.ttl>Date.now())){_context.next=5;break;}return _context.abrupt("return",value);case 5:if(!AxiosStorage.keepIfStale(value)){_context.next=10;break;}stale={data:value.data,state:'stale',createdAt:value.createdAt};_context.next=9;return _this.set(key,stale);case 9:return _context.abrupt("return",stale);case 10:_context.next=12;return _this.remove(key);case 12:return _context.abrupt("return",{state:'empty'});case 13:case"end":return _context.stop();}}},_callee);}));return function(_x){return _ref.apply(this,arguments);};}());};exports.AxiosStorage=AxiosStorage;_defineProperty(AxiosStorage,"keepIfStale",function(_ref2){var data=_ref2.data;if(data!==null&&data!==void 0&&data.headers){return _headers.Header.ETag in data.headers||_headers.Header.LastModified in data.headers||_headers.Header.XAxiosCacheEtag in data.headers||_headers.Header.XAxiosCacheLastModified in data.headers;}return false;});
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AxiosStorage = void 0;
const headers_1 = require("../util/headers");
class AxiosStorage {
constructor() {
this.get = (key) => __awaiter(this, void 0, void 0, function* () {
const value = yield this.find(key);
if (value.state !== 'cached' ||
value.createdAt + value.ttl > Date.now()) {
return value;
}
if (AxiosStorage.keepIfStale(value)) {
const stale = {
data: value.data,
state: 'stale',
createdAt: value.createdAt
};
yield this.set(key, stale);
return stale;
}
yield this.remove(key);
return { state: 'empty' };
});
}
}
exports.AxiosStorage = AxiosStorage;
AxiosStorage.keepIfStale = ({ data }) => {
if (data === null || data === void 0 ? void 0 : data.headers) {
return (headers_1.Header.ETag in data.headers ||
headers_1.Header.LastModified in data.headers ||
headers_1.Header.XAxiosCacheEtag in data.headers ||
headers_1.Header.XAxiosCacheLastModified in data.headers);
}
return false;
};

@@ -7,3 +7,2 @@ export declare type CachedResponse = {

};
/** The value returned for a given key. */
export declare type StorageValue = StaleStorageValue | CachedStorageValue | LoadingStorageValue | EmptyStorageValue;

@@ -19,3 +18,2 @@ export declare type NotEmptyStorageValue = Exclude<StorageValue, EmptyStorageValue>;

data: CachedResponse;
/** The number in milliseconds to wait after createdAt before the value is considered stale. */
ttl: number;

@@ -26,9 +24,4 @@ createdAt: number;

export declare type LoadingStorageValue = {
/**
* Only present if the previous state was `stale`. So, in case the new response comes
* without a value, this data is used
*/
data?: CachedResponse;
ttl?: number;
/** Defined when the state is cached */
createdAt?: undefined;

@@ -40,3 +33,2 @@ state: 'loading';

ttl?: undefined;
/** Defined when the state is cached */
createdAt?: undefined;

@@ -43,0 +35,0 @@ state: 'empty';

@@ -1,1 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
import type { AxiosResponse } from 'axios';
import type { CacheProperties } from '..';
import type { CachePredicateObject } from './types';
/** Returns true if the response should be cached */
export declare function shouldCacheResponse<R>(response: AxiosResponse<R>, { cachePredicate }: CacheProperties): boolean;
export declare function isCachePredicateValid<R>(response: AxiosResponse<R>, { statusCheck, containsHeaders, responseMatch }: CachePredicateObject): boolean;
//# sourceMappingURL=cache-predicate.d.ts.map

@@ -1,1 +0,52 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.isCachePredicateValid=isCachePredicateValid;exports.shouldCacheResponse=shouldCacheResponse;function _typeof(obj){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++){arr2[i]=arr[i];}return arr2;}function _iterableToArrayLimit(arr,i){var _i=arr==null?null:typeof Symbol!=="undefined"&&arr[Symbol.iterator]||arr["@@iterator"];if(_i==null)return;var _arr=[];var _n=true;var _d=false;var _s,_e;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function shouldCacheResponse(response,_ref){var cachePredicate=_ref.cachePredicate;if(typeof cachePredicate==='function'){return cachePredicate(response);}return isCachePredicateValid(response,cachePredicate);}function isCachePredicateValid(response,_ref2){var statusCheck=_ref2.statusCheck,containsHeaders=_ref2.containsHeaders,responseMatch=_ref2.responseMatch;if(statusCheck){if(typeof statusCheck==='function'){if(!statusCheck(response.status)){return false;}}else{var _statusCheck=_slicedToArray(statusCheck,2),start=_statusCheck[0],end=_statusCheck[1];if(response.status<start||response.status>end){return false;}}}if(containsHeaders){for(var headerName in containsHeaders){var value=containsHeaders[headerName];var header=response.headers[headerName];if(!header){return false;}switch(_typeof(value)){case'string':if(header!=value){return false;}break;case'function':if(!value(header)){return false;}break;}}}if(responseMatch&&!responseMatch(response.data)){return false;}return true;}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isCachePredicateValid = exports.shouldCacheResponse = void 0;
function shouldCacheResponse(response, { cachePredicate }) {
if (typeof cachePredicate === 'function') {
return cachePredicate(response);
}
return isCachePredicateValid(response, cachePredicate);
}
exports.shouldCacheResponse = shouldCacheResponse;
function isCachePredicateValid(response, { statusCheck, containsHeaders, responseMatch }) {
if (statusCheck) {
if (typeof statusCheck === 'function') {
if (!statusCheck(response.status)) {
return false;
}
}
else {
const [start, end] = statusCheck;
if (response.status < start ||
response.status > end) {
return false;
}
}
}
if (containsHeaders) {
for (const headerName in containsHeaders) {
const value = containsHeaders[headerName];
const header = response.headers[headerName];
if (!header) {
return false;
}
switch (typeof value) {
case 'string':
if (header != value) {
return false;
}
break;
case 'function':
if (!value(header)) {
return false;
}
break;
}
}
}
if (responseMatch && !responseMatch(response.data)) {
return false;
}
return true;
}
exports.isCachePredicateValid = isCachePredicateValid;
export declare enum Header {
/**
* ```txt
* If-Modified-Since: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT
* ```
*
* @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since
*/
IfModifiedSince = "if-modified-since",
/**
* ```txt
* Last-Modified: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT
* ```
*
* @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified
*/
LastModified = "last-modified",
/**
* ```txt
* If-None-Match: "<etag_value>"
* If-None-Match: "<etag_value>", "<etag_value>", …
* If-None-Match: *
* ```
*
* @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-None-Match
*/
IfNoneMatch = "if-none-match",
/** @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control */
CacheControl = "cache-control",
/**
* ```txt
* ETag: W / '<etag_value>';
* ETag: '<etag_value>';
* ```
*
* @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag
*/
ETag = "etag",
/**
* ```txt
* Expires: <http-date>
* ```
*
* @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expires
*/
Expires = "expires",
/**
* ```txt
* Age: <delta-seconds>
* ```
*
* @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Age
*/
Age = "age",
/**
* ```txt
* Content-Type: text/html; charset=UTF-8
* Content-Type: multipart/form-data; boundary=something
* ```
*
* @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type
*/
ContentType = "content-type",
/**
* Used internally to mark the cache item as being revalidatable and enabling stale
* cache state Contains a string of ASCII characters that can be used as ETag for
* `If-Match` header Provided by user using `cache.etag` value.
*
* ```txt
* X-Axios-Cache-Etag: "<etag_value>"
* ```
*/
XAxiosCacheEtag = "x-axios-cache-etag",
/**
* Used internally to mark the cache item as being revalidatable and enabling stale
* cache state may contain `'use-cache-timestamp'` if `cache.modifiedSince` is `true`,
* otherwise will contain a date from `cache.modifiedSince`. If a date is provided, it
* can be used for `If-Modified-Since` header, otherwise the cache timestamp can be used
* for `If-Modified-Since` header.
*
* ```txt
* X-Axios-Cache-Last-Modified: <day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT
* X-Axios-Cache-Last-Modified: use-cache-timestamp
* ```
*/
XAxiosCacheLastModified = "x-axios-cache-last-modified"
}
//# sourceMappingURL=headers.d.ts.map

@@ -1,1 +0,16 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.Header=void 0;var Header;exports.Header=Header;(function(Header){Header["IfModifiedSince"]="if-modified-since";Header["LastModified"]="last-modified";Header["IfNoneMatch"]="if-none-match";Header["CacheControl"]="cache-control";Header["ETag"]="etag";Header["Expires"]="expires";Header["Age"]="age";Header["ContentType"]="content-type";Header["XAxiosCacheEtag"]="x-axios-cache-etag";Header["XAxiosCacheLastModified"]="x-axios-cache-last-modified";})(Header||(exports.Header=Header={}));
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Header = void 0;
var Header;
(function (Header) {
Header["IfModifiedSince"] = "if-modified-since";
Header["LastModified"] = "last-modified";
Header["IfNoneMatch"] = "if-none-match";
Header["CacheControl"] = "cache-control";
Header["ETag"] = "etag";
Header["Expires"] = "expires";
Header["Age"] = "age";
Header["ContentType"] = "content-type";
Header["XAxiosCacheEtag"] = "x-axios-cache-etag";
Header["XAxiosCacheLastModified"] = "x-axios-cache-last-modified";
})(Header = exports.Header || (exports.Header = {}));

@@ -1,1 +0,14 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.defaultKeyGenerator=void 0;var SLASHES_REGEX=/^\/|\/+$/g;var defaultKeyGenerator=function defaultKeyGenerator(_ref){var _ref$baseURL=_ref.baseURL,baseURL=_ref$baseURL===void 0?'':_ref$baseURL,_ref$url=_ref.url,url=_ref$url===void 0?'':_ref$url,nullableMethod=_ref.method,params=_ref.params,id=_ref.id;if(id)return String(id);baseURL=baseURL.replace(SLASHES_REGEX,'');url=url.replace(SLASHES_REGEX,'');var method=(nullableMethod===null||nullableMethod===void 0?void 0:nullableMethod.toLowerCase())||'get';var jsonParams=params?JSON.stringify(params,Object.keys(params).sort()):'{}';return"".concat(method,"::").concat(baseURL+(url&&baseURL?'/':'')+url,"::").concat(jsonParams);};exports.defaultKeyGenerator=defaultKeyGenerator;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultKeyGenerator = void 0;
const SLASHES_REGEX = /^\/|\/+$/g;
const defaultKeyGenerator = ({ baseURL = '', url = '', method: nullableMethod, params, id }) => {
if (id)
return String(id);
baseURL = baseURL.replace(SLASHES_REGEX, '');
url = url.replace(SLASHES_REGEX, '');
const method = (nullableMethod === null || nullableMethod === void 0 ? void 0 : nullableMethod.toLowerCase()) || 'get';
const jsonParams = params ? JSON.stringify(params, Object.keys(params).sort()) : '{}';
return `${method}::${baseURL + (url && baseURL ? '/' : '') + url}::${jsonParams}`;
};
exports.defaultKeyGenerator = defaultKeyGenerator;

@@ -5,17 +5,7 @@ import type { AxiosResponse } from 'axios';

export declare type CachePredicateObject = {
/**
* The status predicate, if a tuple is returned, the first and seconds value means the
* interval (inclusive) accepted. Can also be a function.
*/
statusCheck?: [start: number, end: number] | ((status: number) => boolean);
/**
* Matches if the response header container all keys. A tuple also checks for values.
* Can also be a predicate.
*/
containsHeaders?: Record<string, true | string | ((header: string) => boolean)>;
/** Check if the desired response matches this predicate. */
responseMatch?: <T = any>(res: T | undefined) => boolean;
};
/** A simple function that receives a cache request config and should return a string id for it. */
export declare type KeyGenerator = <R>(options: CacheRequestConfig<R>) => string;
//# sourceMappingURL=types.d.ts.map

@@ -1,1 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
import type { AxiosStorage } from '../storage/storage';
import type { CachedStorageValue, LoadingStorageValue, StorageValue } from '../storage/types';
export declare type CacheUpdater = 'delete' | ((cached: Exclude<StorageValue, LoadingStorageValue>, newData: any) => CachedStorageValue | void);
/** Function to update all caches, from CacheProperties.update, with the new data. */
export declare function updateCache<T = any>(storage: AxiosStorage, data: T, entries: Record<string, CacheUpdater>): Promise<void>;
//# sourceMappingURL=update-cache.d.ts.map

@@ -1,1 +0,34 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.updateCache=updateCache;function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}function updateCache(_x,_x2,_x3){return _updateCache.apply(this,arguments);}function _updateCache(){_updateCache=_asyncToGenerator(regeneratorRuntime.mark(function _callee(storage,data,entries){var cacheKey,value,oldValue,newValue;return regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.t0=regeneratorRuntime.keys(entries);case 1:if((_context.t1=_context.t0()).done){_context.next=22;break;}cacheKey=_context.t1.value;value=entries[cacheKey];if(!(value==='delete')){_context.next=8;break;}_context.next=7;return storage.remove(cacheKey);case 7:return _context.abrupt("continue",1);case 8:_context.next=10;return storage.get(cacheKey);case 10:oldValue=_context.sent;if(!(oldValue.state==='loading')){_context.next=13;break;}throw new Error('cannot update the cache while loading');case 13:newValue=value(oldValue,data);if(!(newValue===undefined)){_context.next=18;break;}_context.next=17;return storage.remove(cacheKey);case 17:return _context.abrupt("continue",1);case 18:_context.next=20;return storage.set(cacheKey,newValue);case 20:_context.next=1;break;case 22:case"end":return _context.stop();}}},_callee);}));return _updateCache.apply(this,arguments);}
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.updateCache = void 0;
function updateCache(storage, data, entries) {
return __awaiter(this, void 0, void 0, function* () {
for (const cacheKey in entries) {
const value = entries[cacheKey];
if (value === 'delete') {
yield storage.remove(cacheKey);
continue;
}
const oldValue = yield storage.get(cacheKey);
if (oldValue.state === 'loading') {
throw new Error('cannot update the cache while loading');
}
const newValue = value(oldValue, data);
if (newValue === undefined) {
yield storage.remove(cacheKey);
continue;
}
yield storage.set(cacheKey, newValue);
}
});
}
exports.updateCache = updateCache;
{
"name": "axios-cache-interceptor",
"version": "0.7.3",
"version": "0.7.4",
"description": "Cache interceptor for axios",

@@ -9,7 +9,7 @@ "main": "./dist/index.js",

"unpkg": "./dist/index.bundle.js",
"runkitExampleFilename": "./examples/runkit.js",
"scripts": {
"build": "concurrently 'npm:build:*'",
"build:node": "babel src --out-dir dist --extensions '.ts' --ignore src/index.bundle.ts",
"build:browser": "webpack",
"build:types": "tsc -p tsconfig.types.json",
"build:node": "tsc -p tsconfig.build.json",
"test": "jest",

@@ -55,4 +55,6 @@ "test:watch": "jest --watch",

"@babel/plugin-transform-modules-commonjs": "^7.16.0",
"@babel/plugin-transform-runtime": "^7.16.4",
"@babel/preset-env": "^7.16.4",
"@babel/preset-typescript": "^7.16.0",
"@babel/runtime": "^7.16.3",
"@types/jest": "^27.0.2",

@@ -59,0 +61,0 @@ "@types/node": "^16.7.10",

@@ -53,6 +53,12 @@ <br />

></code>
<code
><a href="https://npm.runkit.com/axios-cache-interceptor"
><img
src="https://img.shields.io/badge/try%20on-RunKit-brightgreen"
target="_blank"
alt="Try on RunKit" /></a
></code>
</div>
<h1></h1>
<br />

@@ -59,0 +65,0 @@ <br />

@@ -14,3 +14,3 @@ {

/* Language and Environment */
"target": "ES2020" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
"target": "ES6" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */

@@ -49,6 +49,6 @@ // "jsx": "preserve", /* Specify what JSX code is generated. */

// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
"sourceMap": true /* Create source map files for emitted JavaScript files. */,
// "sourceMap": true /* Create source map files for emitted JavaScript files. */,
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
"outDir": "./dist" /* Specify an output folder for all emitted files. */,
// "removeComments": true, /* Disable emitting comments. */
"removeComments": true, /* Disable emitting comments. */
"noEmit": true, /* Disable emitting files from a compilation. */

@@ -55,0 +55,0 @@ // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc