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.10.1 to 0.10.2

2

dev/index.bundle.js

@@ -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()}("undefined"!=typeof self?self:this,(function(){return(()=>{"use strict";var e={d:(t,a)=>{for(var r in a)e.o(a,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{Header:()=>i,buildKeyGenerator:()=>j,buildMemoryStorage:()=>S,buildStorage:()=>x,buildWebStorage:()=>R,canStale:()=>y,createCacheResponse:()=>f,createValidateStatus:()=>d,defaultHeaderInterpreter:()=>s,defaultKeyGenerator:()=>E,defaultRequestInterceptor:()=>g,defaultResponseInterceptor:()=>m,isExpired:()=>w,isMethodIn:()=>u,isStorage:()=>b,setupCache:()=>O,testCachePredicate:()=>h,updateCache:()=>p,updateStaleRequest:()=>l});const a=Symbol("cache-parser");function r(e){return("string"==typeof e||"number"==typeof e)&&(e=Number(e))>=0&&e<1/0}function n(e){return!0===e||"number"==typeof e||"string"==typeof e&&"false"!==e}const o=Number;const i=Object.freeze({IfModifiedSince:"if-modified-since",LastModified:"last-modified",IfNoneMatch:"if-none-match",CacheControl:"cache-control",ETag:"etag",Expires:"expires",Age:"age",XAxiosCacheEtag:"x-axios-cache-etag",XAxiosCacheLastModified:"x-axios-cache-last-modified",XAxiosCacheStaleIfError:"x-axios-cache-stale-if-error"}),s=e=>{if(!e)return"not enough headers";const t=e[i.CacheControl];if(t){const{noCache:s,noStore:c,mustRevalidate:d,maxAge:u,immutable:l}=function(e){const t=Object.defineProperty({},a,{enumerable:!1,value:1});if(!e||"string"!=typeof e)return t;const i=function(e){const t={},a=e.toLowerCase().replace(/\s+/g,"").split(",");for(const e in a){var r;const n=a[e].split("=",2);t[n[0]]=null==(r=n[1])||r}return t}(e),s=i["max-age"],c=i["max-stale"],d=i["min-fresh"],u=i["s-maxage"],l=i["stale-if-error"],f=i["stale-while-revalidate"];return n(i.immutable)&&(t.immutable=!0),r(s)&&(t.maxAge=o(s)),r(c)&&(t.maxStale=o(c)),r(d)&&(t.minFresh=o(d)),n(i["must-revalidate"])&&(t.mustRevalidate=!0),n(i["must-understand"])&&(t.mustUnderstand=!0),n(i["no-cache"])&&(t.noCache=!0),n(i["no-store"])&&(t.noStore=!0),n(i["no-transform"])&&(t.noTransform=!0),n(i["only-if-cached"])&&(t.onlyIfCached=!0),n(i.private)&&(t.private=!0),n(i["proxy-revalidate"])&&(t.proxyRevalidate=!0),n(i.public)&&(t.public=!0),r(u)&&(t.sMaxAge=o(u)),r(l)&&(t.staleIfError=o(l)),r(f)&&(t.staleWhileRevalidate=o(f)),t}(String(t));if(s||c)return"dont cache";if(l)return 31536e6;if(d)return 0;if(u){const t=e[i.Age];return t?1e3*(u-Number(t)):1e3*u}}const s=e[i.Expires];if(s){const e=Date.parse(String(s))-Date.now();return e>=0?e:"dont cache"}return"not enough headers"},c=Symbol();function d(e){return e?t=>e(t)||304===t:e=>e>=200&&e<300||304===e}function u(e="get",t=[]){e=e.toLowerCase();for(const a of t)if(a.toLowerCase()===e)return!0;return!1}function l(e,t){var a;t.headers||(t.headers={});const{etag:r,modifiedSince:n}=t.cache;if(r){const n=!0===r?null===(a=e.data)||void 0===a?void 0:a.headers[i.ETag]:r;n&&(t.headers[i.IfNoneMatch]=n)}n&&(t.headers[i.IfModifiedSince]=!0===n?e.data.headers[i.LastModified]||new Date(e.createdAt).toUTCString():n.toUTCString())}function f(e,t){return 304===e.status&&t?(e.cached=!0,e.data=t.data,e.status=t.status,e.statusText=t.statusText,e.headers=Object.assign(Object.assign({},t.headers),e.headers),t):{data:e.data,status:e.status,statusText:e.statusText,headers:e.headers}}function g(e){const t=async t=>{var a,r,n,o,i,s,f,g,h;if(!1===t.cache)return null===(a=e.debug)||void 0===a||a.call(e,{msg:"Ignoring cache because config.cache is false",data:t}),t;if(t.cache=Object.assign(Object.assign({},e.defaults.cache),t.cache),!u(t.method,t.cache.methods))return null===(r=e.debug)||void 0===r||r.call(e,{msg:`Ignored because method (${t.method}) is not in cache.methods (${t.cache.methods})`}),t;const p=t.id=e.generateKey(t);let m,v=await e.storage.get(p);e:if("empty"===v.state||"stale"===v.state){if(e.waiting[p]){v=await e.storage.get(p),null===(n=e.debug)||void 0===n||n.call(e,{id:p,msg:"Waiting list had an deferred for this key, waiting for it to finish"});break e}return e.waiting[p]=function(){let e,t;const a=new Promise(((a,r)=>{e=a,t=r}));return a.resolve=e,a.reject=t,a[c]=1,a}(),null===(o=e.waiting[p])||void 0===o||o.catch((()=>{})),await e.storage.set(p,{state:"loading",previous:v.state,data:v.data,createdAt:v.createdAt}),"stale"===v.state&&(l(v,t),null===(i=e.debug)||void 0===i||i.call(e,{id:p,msg:"Updated stale request"})),t.validateStatus=d(t.validateStatus),null===(s=e.debug)||void 0===s||s.call(e,{id:p,msg:"Sending request, waiting for response"}),t}if("loading"===v.state){const a=e.waiting[p];if(!a)return await e.storage.remove(p),t;null===(f=e.debug)||void 0===f||f.call(e,{id:p,msg:"Detected concurrent request, waiting for it to finish"});try{m=await a}catch(a){return null===(g=e.debug)||void 0===g||g.call(e,{id:p,msg:"Deferred rejected, requesting again",data:a}),t}}else m=v.data;return t.adapter=()=>Promise.resolve({config:t,data:m.data,headers:m.headers,status:m.status,statusText:m.statusText,cached:!0,id:p}),null===(h=e.debug)||void 0===h||h.call(e,{id:p,msg:"Returning cached response"}),t};return{onFulfilled:t,apply:()=>e.interceptors.request.use(t)}}async function h(e,t){var a;if("function"==typeof t)return t(e);const{statusCheck:r,responseMatch:n,containsHeaders:o}=t;if(r&&!await r(e.status)||n&&!await n(e))return!1;if(o)for(const t in o){const r=o[t];if(r&&!await r(null!==(a=e.headers[t.toLowerCase()])&&void 0!==a?a:e.headers[t]))return!1}return!0}async function p(e,t,a){for(const r in a){const n=a[r];if("delete"===n){await e.remove(r);continue}const o=await e.get(r);if("loading"===o.state)continue;const i=await n(o,t);"delete"!==i?"ignore"!==i&&await e.set(r,i):await e.remove(r)}}function m(e){const t=async t=>{var a;await e.storage.remove(t),null===(a=e.waiting[t])||void 0===a||a.reject(null),delete e.waiting[t]},a=async a=>{var r,n,o,s,c,d,u,l,g,m,v;if(a.id=null!==(r=(v=a.config).id)&&void 0!==r?r:v.id=e.generateKey(a.config),null!==(n=a.cached)&&void 0!==n||(a.cached=!1),a.cached)return null===(o=e.debug)||void 0===o||o.call(e,{id:a.id,msg:"Returned cached response"}),a;if(!a.config.cache)return null===(s=e.debug)||void 0===s||s.call(e,{id:a.id,msg:"Response with config.cache === false",data:a}),Object.assign(Object.assign({},a),{cached:!1});const b=a.config.cache,y=await e.storage.get(a.id);if("stale"===y.state||"empty"===y.state||"cached"===y.state)return null===(c=e.debug)||void 0===c||c.call(e,{id:a.id,msg:"Response not cached but storage is not loading",data:{cache:y,response:a}}),a;if(!y.data&&!await h(a,b.cachePredicate))return await t(a.id),null===(d=e.debug)||void 0===d||d.call(e,{id:a.id,msg:"Cache predicate rejected this response"}),a;for(const e in i)e.startsWith("XAxiosCache")&&delete a.headers[e];b.etag&&!0!==b.etag&&(a.headers[i.XAxiosCacheEtag]=b.etag),b.modifiedSince&&(a.headers[i.XAxiosCacheLastModified]=!0===b.modifiedSince?"use-cache-timestamp":b.modifiedSince.toUTCString());let w=b.ttl||-1;if(null==b?void 0:b.interpretHeader){const r=e.headerInterpreter(a.headers);if("dont cache"===r)return await t(a.id),null===(u=e.debug)||void 0===u||u.call(e,{id:a.id,msg:"Cache header interpreted as 'dont cache'",data:{cache:y,response:a,expirationTime:r}}),a;w="not enough headers"===r?w:r}const x=f(a,y.data);"function"==typeof w&&(w=await w(a)),b.staleIfError&&(a.headers[i.XAxiosCacheStaleIfError]=String(w)),null===(l=e.debug)||void 0===l||l.call(e,{id:a.id,msg:"Useful response configuration found",data:{cacheConfig:b,ttl:w,cacheResponse:x}}),(null==b?void 0:b.update)&&await p(e.storage,a,b.update);const S={state:"cached",ttl:w,createdAt:Date.now(),data:x},I=e.waiting[a.id];return I&&(I.resolve(S.data),delete e.waiting[a.id],null===(g=e.debug)||void 0===g||g.call(e,{id:a.id,msg:"Found waiting deferred(s) and resolved them"})),await e.storage.set(a.id,S),null===(m=e.debug)||void 0===m||m.call(e,{id:a.id,msg:"Response cached",data:{cache:S,response:a}}),a},r=async a=>{var r,n,o,i,s,c;const d=a.config;if(!d||!1===d.cache||!d.id)throw null===(r=e.debug)||void 0===r||r.call(e,{msg:"Web request returned an error but cache handling is not enabled",data:{error:a,config:d}}),a;const u=await e.storage.get(d.id),l=d.cache;if("loading"!==u.state||"stale"!==u.previous)throw await t(d.id),null===(n=e.debug)||void 0===n||n.call(e,{msg:"Caught an error in the request interceptor",data:{error:a,config:d}}),a;if(null==l?void 0:l.staleIfError){const t="function"==typeof l.staleIfError?await l.staleIfError(a.response,u,a):l.staleIfError;if(null===(o=e.debug)||void 0===o||o.call(e,{msg:"Found cache if stale config for rejected response",data:{error:a,config:d,staleIfError:t}}),!0===t||"number"==typeof t&&u.createdAt+t>Date.now())return null===(i=e.waiting[d.id])||void 0===i||i.resolve(u.data),delete e.waiting[d.id],await e.storage.set(d.id,{state:"stale",createdAt:Date.now(),data:u.data}),null===(s=e.debug)||void 0===s||s.call(e,{msg:"staleIfError resolved this response with cached data",data:{error:a,config:d,cache:u}}),{cached:!0,config:d,id:d.id,data:u.data.data,headers:u.data.headers,status:u.data.status,statusText:u.data.statusText}}throw null===(c=e.debug)||void 0===c||c.call(e,{msg:"Received an unknown error that could not be handled",data:{error:a,config:d}}),a};return{onFulfilled:a,onRejected:r,apply:()=>e.interceptors.response.use(a,r)}}const v=Symbol(),b=e=>!!e&&!!e[v];function y(e){const t=e.data.headers;return i.ETag in t||i.LastModified in t||i.XAxiosCacheEtag in t||i.XAxiosCacheStaleIfError in t||i.XAxiosCacheLastModified in t}function w(e){return e.createdAt+e.ttl<=Date.now()}function x({set:e,find:t,remove:a}){return{[v]:1,set:e,remove:a,get:async r=>{const n=await t(r);if(!n)return{state:"empty"};if("cached"!==n.state||!w(n))return n;if(y(n)){const t={state:"stale",createdAt:n.createdAt,data:n.data};return await e(r,t),t}return await a(r),{state:"empty"}}}}function S(e=!1){const t=x({set:(e,a)=>{t.data[e]=a},remove:e=>{delete t.data[e]},find:a=>{const r=t.data[a];return e&&void 0!==r?"function"==typeof structuredClone?structuredClone(r):JSON.parse(JSON.stringify(r)):r}});return t.data=Object.create(null),t}function I(e){const t=typeof e;if(e&&"object"==t&&!(e instanceof Date||e instanceof RegExp)){const t=Array.isArray(e)?[]:{};for(const a in e)t[a]=I(e[a]);return`${e.constructor}${JSON.stringify(t,Object.keys(e).sort())}`}return`${t}${String(e)}`}function C(e){e=I(e);let t=5381,a=0;for(;a<e.length;)t=33*t^e.charCodeAt(a++);return t}const A=/^\/|\/$/g;function j(e){return t=>{if(t.id)return t.id;const a=e(t);return"string"==typeof a||"number"==typeof a?`${a}`:`${C(a)}`}}const E=j((({baseURL:e="",url:t="",method:a="get",params:r,data:n})=>(e&&(e=e.replace(A,"")),t&&(t=t.replace(A,"")),a&&(a=a.toLowerCase()),{url:e+(e&&t?"/":"")+t,params:r,method:a,data:n})));function O(e,t={}){var a,r,n,o,i;const c=e;if(c.storage=t.storage||S(),!b(c.storage))throw new Error("Use buildStorage() function");return c.waiting=t.waiting||{},c.generateKey=t.generateKey||E,c.headerInterpreter=t.headerInterpreter||s,c.requestInterceptor=t.requestInterceptor||g(c),c.responseInterceptor=t.responseInterceptor||m(c),c.debug=t.debug,c.defaults.cache={update:t.update||{},ttl:null!==(a=t.ttl)&&void 0!==a?a:3e5,methods:t.methods||["get"],cachePredicate:t.cachePredicate||{statusCheck:e=>e>=200&&e<400},etag:null===(r=t.etag)||void 0===r||r,modifiedSince:null!==(n=t.modifiedSince)&&void 0!==n?n:!1===t.etag,interpretHeader:null===(o=t.interpretHeader)||void 0===o||o,staleIfError:null===(i=t.staleIfError)||void 0===i||i},c.requestInterceptor.apply(),c.responseInterceptor.apply(),c}function R(e,t=""){return x({find:a=>{const r=e.getItem(t+a);return r?JSON.parse(r):void 0},remove:a=>{e.removeItem(t+a)},set:(a,r)=>{const n=()=>e.setItem(t+a,JSON.stringify(r));try{return n()}catch(r){const o=Object.entries(e).filter((([a])=>a.startsWith(t)&&e.getItem(a))).map((([e,t])=>[e,JSON.parse(t)]));for(const[t,a]of o)"cached"===a.state&&w(a)&&!y(a)&&e.removeItem(t);try{return n()}catch(t){const a=o.sort((([,e],[,t])=>(e.createdAt||0)-(t.createdAt||0)));for(const[t]of a){e.removeItem(t);try{return n()}catch(e){}}}e.removeItem(t+a)}}})}return console.error("You are using a development build. Make sure to use the correct build in production\nhttps://axios-cache-interceptor.js.org/#/pages/installing\n\n"),t})()}));
!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()}("undefined"!=typeof self?self:this,(function(){return(()=>{"use strict";var e={d:(t,a)=>{for(var r in a)e.o(a,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{Header:()=>i,buildKeyGenerator:()=>j,buildMemoryStorage:()=>S,buildStorage:()=>x,buildWebStorage:()=>R,canStale:()=>y,createCacheResponse:()=>f,createValidateStatus:()=>d,defaultHeaderInterpreter:()=>s,defaultKeyGenerator:()=>E,defaultRequestInterceptor:()=>g,defaultResponseInterceptor:()=>m,isExpired:()=>w,isMethodIn:()=>u,isStorage:()=>b,setupCache:()=>O,testCachePredicate:()=>h,updateCache:()=>p,updateStaleRequest:()=>l});var a=Symbol("cache-parser");function r(e){return("string"==typeof e||"number"==typeof e)&&(e=Number(e))>=0&&e<1/0}function n(e){return!0===e||"number"==typeof e||"string"==typeof e&&"false"!==e}var o=Number;const i=Object.freeze({IfModifiedSince:"if-modified-since",LastModified:"last-modified",IfNoneMatch:"if-none-match",CacheControl:"cache-control",ETag:"etag",Expires:"expires",Age:"age",XAxiosCacheEtag:"x-axios-cache-etag",XAxiosCacheLastModified:"x-axios-cache-last-modified",XAxiosCacheStaleIfError:"x-axios-cache-stale-if-error"}),s=e=>{if(!e)return"not enough headers";const t=e[i.CacheControl];if(t){const{noCache:s,noStore:c,mustRevalidate:d,maxAge:u,immutable:l}=function(e){var t=Object.defineProperty({},a,{enumerable:!1,value:1});if(!e||"string"!=typeof e)return t;var i=function(e){var t={},a=e.toLowerCase().replace(/\s+/g,"").split(",");for(var r in a){var n,o=a[r].split("=",2);t[o[0]]=null==(n=o[1])||n}return t}(e),s=i["max-age"],c=i["max-stale"],d=i["min-fresh"],u=i["s-maxage"],l=i["stale-if-error"],f=i["stale-while-revalidate"];return n(i.immutable)&&(t.immutable=!0),r(s)&&(t.maxAge=o(s)),r(c)&&(t.maxStale=o(c)),r(d)&&(t.minFresh=o(d)),n(i["must-revalidate"])&&(t.mustRevalidate=!0),n(i["must-understand"])&&(t.mustUnderstand=!0),n(i["no-cache"])&&(t.noCache=!0),n(i["no-store"])&&(t.noStore=!0),n(i["no-transform"])&&(t.noTransform=!0),n(i["only-if-cached"])&&(t.onlyIfCached=!0),n(i.private)&&(t.private=!0),n(i["proxy-revalidate"])&&(t.proxyRevalidate=!0),n(i.public)&&(t.public=!0),r(u)&&(t.sMaxAge=o(u)),r(l)&&(t.staleIfError=o(l)),r(f)&&(t.staleWhileRevalidate=o(f)),t}(String(t));if(s||c)return"dont cache";if(l)return 31536e6;if(d)return 0;if(u){const t=e[i.Age];return t?1e3*(u-Number(t)):1e3*u}}const s=e[i.Expires];if(s){const e=Date.parse(String(s))-Date.now();return e>=0?e:"dont cache"}return"not enough headers"};var c=Symbol();function d(e){return e?t=>e(t)||304===t:e=>e>=200&&e<300||304===e}function u(e="get",t=[]){e=e.toLowerCase();for(const a of t)if(a.toLowerCase()===e)return!0;return!1}function l(e,t){var a;t.headers||(t.headers={});const{etag:r,modifiedSince:n}=t.cache;if(r){const n=!0===r?null===(a=e.data)||void 0===a?void 0:a.headers[i.ETag]:r;n&&(t.headers[i.IfNoneMatch]=n)}n&&(t.headers[i.IfModifiedSince]=!0===n?e.data.headers[i.LastModified]||new Date(e.createdAt).toUTCString():n.toUTCString())}function f(e,t){return 304===e.status&&t?(e.cached=!0,e.data=t.data,e.status=t.status,e.statusText=t.statusText,e.headers=Object.assign(Object.assign({},t.headers),e.headers),t):{data:e.data,status:e.status,statusText:e.statusText,headers:e.headers}}function g(e){const t=async t=>{var a,r,n,o,i,s,f,g,h;if(!1===t.cache)return null===(a=e.debug)||void 0===a||a.call(e,{msg:"Ignoring cache because config.cache is false",data:t}),t;if(t.cache=Object.assign(Object.assign({},e.defaults.cache),t.cache),!u(t.method,t.cache.methods))return null===(r=e.debug)||void 0===r||r.call(e,{msg:`Ignored because method (${t.method}) is not in cache.methods (${t.cache.methods})`}),t;const p=t.id=e.generateKey(t);let m,v=await e.storage.get(p);e:if("empty"===v.state||"stale"===v.state){if(e.waiting[p]&&(v=await e.storage.get(p),"empty"!==v.state)){null===(n=e.debug)||void 0===n||n.call(e,{id:p,msg:"Waiting list had an deferred for this key, waiting for it to finish"});break e}return e.waiting[p]=function(){var e,t,a=new Promise((function(a,r){e=a,t=r}));return a.resolve=e,a.reject=t,a[c]=1,a}(),null===(o=e.waiting[p])||void 0===o||o.catch((()=>{})),await e.storage.set(p,{state:"loading",previous:v.state,data:v.data,createdAt:v.createdAt}),"stale"===v.state&&(l(v,t),null===(i=e.debug)||void 0===i||i.call(e,{id:p,msg:"Updated stale request"})),t.validateStatus=d(t.validateStatus),null===(s=e.debug)||void 0===s||s.call(e,{id:p,msg:"Sending request, waiting for response"}),t}if("loading"===v.state){const a=e.waiting[p];if(!a)return await e.storage.remove(p),t;null===(f=e.debug)||void 0===f||f.call(e,{id:p,msg:"Detected concurrent request, waiting for it to finish"});try{m=await a}catch(a){return null===(g=e.debug)||void 0===g||g.call(e,{id:p,msg:"Deferred rejected, requesting again",data:a}),t}}else m=v.data;return t.adapter=()=>Promise.resolve({config:t,data:m.data,headers:m.headers,status:m.status,statusText:m.statusText,cached:!0,id:p}),null===(h=e.debug)||void 0===h||h.call(e,{id:p,msg:"Returning cached response"}),t};return{onFulfilled:t,apply:()=>e.interceptors.request.use(t)}}async function h(e,t){var a;if("function"==typeof t)return t(e);const{statusCheck:r,responseMatch:n,containsHeaders:o}=t;if(r&&!await r(e.status)||n&&!await n(e))return!1;if(o)for(const t in o){const r=o[t];if(r&&!await r(null!==(a=e.headers[t.toLowerCase()])&&void 0!==a?a:e.headers[t]))return!1}return!0}async function p(e,t,a){for(const r in a){const n=a[r];if("delete"===n){await e.remove(r);continue}const o=await e.get(r);if("loading"===o.state)continue;const i=await n(o,t);"delete"!==i?"ignore"!==i&&await e.set(r,i):await e.remove(r)}}function m(e){const t=async t=>{var a;await e.storage.remove(t),null===(a=e.waiting[t])||void 0===a||a.reject(null),delete e.waiting[t]},a=async a=>{var r,n,o,s,c,d,u,l,g,m,v;const b=a.id=null!==(r=(v=a.config).id)&&void 0!==r?r:v.id=e.generateKey(a.config);if(null!==(n=a.cached)&&void 0!==n||(a.cached=!1),a.cached)return null===(o=e.debug)||void 0===o||o.call(e,{id:b,msg:"Returned cached response"}),a;if(!a.config.cache)return null===(s=e.debug)||void 0===s||s.call(e,{id:b,msg:"Response with config.cache === false",data:a}),Object.assign(Object.assign({},a),{cached:!1});const y=a.config.cache,w=await e.storage.get(b);if("stale"===w.state||"empty"===w.state||"cached"===w.state)return null===(c=e.debug)||void 0===c||c.call(e,{id:b,msg:"Response not cached but storage is not loading",data:{cache:w,response:a}}),a;if(!w.data&&!await h(a,y.cachePredicate))return await t(b),null===(d=e.debug)||void 0===d||d.call(e,{id:b,msg:"Cache predicate rejected this response"}),a;for(const e in i)e.startsWith("XAxiosCache")&&delete a.headers[e];y.etag&&!0!==y.etag&&(a.headers[i.XAxiosCacheEtag]=y.etag),y.modifiedSince&&(a.headers[i.XAxiosCacheLastModified]=!0===y.modifiedSince?"use-cache-timestamp":y.modifiedSince.toUTCString());let x=y.ttl||-1;if(null==y?void 0:y.interpretHeader){const r=e.headerInterpreter(a.headers);if("dont cache"===r)return await t(b),null===(u=e.debug)||void 0===u||u.call(e,{id:b,msg:"Cache header interpreted as 'dont cache'",data:{cache:w,response:a,expirationTime:r}}),a;x="not enough headers"===r?x:r}const S=f(a,w.data);"function"==typeof x&&(x=await x(a)),y.staleIfError&&(a.headers[i.XAxiosCacheStaleIfError]=String(x)),null===(l=e.debug)||void 0===l||l.call(e,{id:b,msg:"Useful response configuration found",data:{cacheConfig:y,ttl:x,cacheResponse:S}}),(null==y?void 0:y.update)&&await p(e.storage,a,y.update);const I={state:"cached",ttl:x,createdAt:Date.now(),data:S},C=e.waiting[b];return C&&(C.resolve(I.data),delete e.waiting[b],null===(g=e.debug)||void 0===g||g.call(e,{id:b,msg:"Found waiting deferred(s) and resolved them"})),await e.storage.set(b,I),null===(m=e.debug)||void 0===m||m.call(e,{id:b,msg:"Response cached",data:{cache:I,response:a}}),a},r=async a=>{var r,n,o,i,s,c;const d=a.config;if(!d||!1===d.cache||!d.id)throw null===(r=e.debug)||void 0===r||r.call(e,{msg:"Web request returned an error but cache handling is not enabled",data:{error:a,config:d}}),a;const u=await e.storage.get(d.id),l=d.cache;if("loading"!==u.state||"stale"!==u.previous)throw await t(d.id),null===(n=e.debug)||void 0===n||n.call(e,{msg:"Caught an error in the request interceptor",data:{error:a,config:d}}),a;if(null==l?void 0:l.staleIfError){const t="function"==typeof l.staleIfError?await l.staleIfError(a.response,u,a):l.staleIfError;if(null===(o=e.debug)||void 0===o||o.call(e,{msg:"Found cache if stale config for rejected response",data:{error:a,config:d,staleIfError:t}}),!0===t||"number"==typeof t&&u.createdAt+t>Date.now())return null===(i=e.waiting[d.id])||void 0===i||i.resolve(u.data),delete e.waiting[d.id],await e.storage.set(d.id,{state:"stale",createdAt:Date.now(),data:u.data}),null===(s=e.debug)||void 0===s||s.call(e,{msg:"staleIfError resolved this response with cached data",data:{error:a,config:d,cache:u}}),{cached:!0,config:d,id:d.id,data:u.data.data,headers:u.data.headers,status:u.data.status,statusText:u.data.statusText}}throw null===(c=e.debug)||void 0===c||c.call(e,{msg:"Received an unknown error that could not be handled",data:{error:a,config:d}}),a};return{onFulfilled:a,onRejected:r,apply:()=>e.interceptors.response.use(a,r)}}const v=Symbol(),b=e=>!!e&&!!e[v];function y(e){const t=e.data.headers;return i.ETag in t||i.LastModified in t||i.XAxiosCacheEtag in t||i.XAxiosCacheStaleIfError in t||i.XAxiosCacheLastModified in t}function w(e){return e.createdAt+e.ttl<=Date.now()}function x({set:e,find:t,remove:a}){return{[v]:1,set:e,remove:a,get:async r=>{const n=await t(r);if(!n)return{state:"empty"};if("cached"!==n.state||!w(n))return n;if(y(n)){const t={state:"stale",createdAt:n.createdAt,data:n.data};return await e(r,t),t}return await a(r),{state:"empty"}}}}function S(e=!1){const t=x({set:(e,a)=>{t.data[e]=a},remove:e=>{delete t.data[e]},find:a=>{const r=t.data[a];return e&&void 0!==r?"function"==typeof structuredClone?structuredClone(r):JSON.parse(JSON.stringify(r)):r}});return t.data=Object.create(null),t}function I(e){var t=typeof e;if(e&&"object"==t&&!(e instanceof Date||e instanceof RegExp)){var a=Array.isArray(e)?[]:{};for(var r in e)a[r]=I(e[r]);return""+e.constructor+JSON.stringify(a,Object.keys(e).sort())}return""+t+String(e)}function C(e){e=I(e);for(var t=5381,a=0;a<e.length;)t=33*t^e.charCodeAt(a++);return t}const A=/^\/|\/$/g;function j(e){return t=>{if(t.id)return t.id;const a=e(t);return"string"==typeof a||"number"==typeof a?`${a}`:`${C(a)}`}}const E=j((({baseURL:e="",url:t="",method:a="get",params:r,data:n})=>(e&&(e=e.replace(A,"")),t&&(t=t.replace(A,"")),a&&(a=a.toLowerCase()),{url:e+(e&&t?"/":"")+t,params:r,method:a,data:n})));function O(e,t={}){var a,r,n,o,i;const c=e;if(c.storage=t.storage||S(),!b(c.storage))throw new Error("Use buildStorage() function");return c.waiting=t.waiting||{},c.generateKey=t.generateKey||E,c.headerInterpreter=t.headerInterpreter||s,c.requestInterceptor=t.requestInterceptor||g(c),c.responseInterceptor=t.responseInterceptor||m(c),c.debug=t.debug,c.defaults.cache={update:t.update||{},ttl:null!==(a=t.ttl)&&void 0!==a?a:3e5,methods:t.methods||["get"],cachePredicate:t.cachePredicate||{statusCheck:e=>e>=200&&e<400},etag:null===(r=t.etag)||void 0===r||r,modifiedSince:null!==(n=t.modifiedSince)&&void 0!==n?n:!1===t.etag,interpretHeader:null===(o=t.interpretHeader)||void 0===o||o,staleIfError:null===(i=t.staleIfError)||void 0===i||i},c.requestInterceptor.apply(),c.responseInterceptor.apply(),c}function R(e,t=""){return x({find:a=>{const r=e.getItem(t+a);return r?JSON.parse(r):void 0},remove:a=>{e.removeItem(t+a)},set:(a,r)=>{const n=()=>e.setItem(t+a,JSON.stringify(r));try{return n()}catch(r){const o=Object.entries(e).filter((([a])=>a.startsWith(t)&&e.getItem(a))).map((([e,t])=>[e,JSON.parse(t)]));for(const[t,a]of o)"cached"===a.state&&w(a)&&!y(a)&&e.removeItem(t);try{return n()}catch(t){const a=o.sort((([,e],[,t])=>(e.createdAt||0)-(t.createdAt||0)));for(const[t]of a){e.removeItem(t);try{return n()}catch(e){}}}e.removeItem(t+a)}}})}return console.error("You are using a development build. Make sure to use the correct build in production\nhttps://axios-cache-interceptor.js.org/#/pages/installing\n\n"),t})()}));
//# sourceMappingURL=index.bundle.js.map

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

!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()}("undefined"!=typeof self?self:this,(function(){return function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{Header:function(){return i},buildKeyGenerator:function(){return T},buildMemoryStorage:function(){return A},buildStorage:function(){return C},buildWebStorage:function(){return L},canStale:function(){return S},createCacheResponse:function(){return p},createValidateStatus:function(){return l},defaultHeaderInterpreter:function(){return s},defaultKeyGenerator:function(){return M},defaultRequestInterceptor:function(){return g},defaultResponseInterceptor:function(){return y},isExpired:function(){return I},isMethodIn:function(){return h},isStorage:function(){return x},setupCache:function(){return P},testCachePredicate:function(){return m},updateCache:function(){return b},updateStaleRequest:function(){return v}});var r=Symbol("cache-parser");function n(e){return("string"==typeof e||"number"==typeof e)&&(e=Number(e))>=0&&e<1/0}function a(e){return!0===e||"number"==typeof e||"string"==typeof e&&"false"!==e}var o=Number;var i=Object.freeze({IfModifiedSince:"if-modified-since",LastModified:"last-modified",IfNoneMatch:"if-none-match",CacheControl:"cache-control",ETag:"etag",Expires:"expires",Age:"age",XAxiosCacheEtag:"x-axios-cache-etag",XAxiosCacheLastModified:"x-axios-cache-last-modified",XAxiosCacheStaleIfError:"x-axios-cache-stale-if-error"}),s=function(e){if(!e)return"not enough headers";var t=e[i.CacheControl];if(t){var s=function(e){var t=Object.defineProperty({},r,{enumerable:!1,value:1});if(!e||"string"!=typeof e)return t;var i=function(e){var t={},r=e.toLowerCase().replace(/\s+/g,"").split(",");for(var n in r){var a,o=r[n].split("=",2);t[o[0]]=null==(a=o[1])||a}return t}(e),s=i["max-age"],c=i["max-stale"],u=i["min-fresh"],d=i["s-maxage"],f=i["stale-if-error"],l=i["stale-while-revalidate"];return a(i.immutable)&&(t.immutable=!0),n(s)&&(t.maxAge=o(s)),n(c)&&(t.maxStale=o(c)),n(u)&&(t.minFresh=o(u)),a(i["must-revalidate"])&&(t.mustRevalidate=!0),a(i["must-understand"])&&(t.mustUnderstand=!0),a(i["no-cache"])&&(t.noCache=!0),a(i["no-store"])&&(t.noStore=!0),a(i["no-transform"])&&(t.noTransform=!0),a(i["only-if-cached"])&&(t.onlyIfCached=!0),a(i.private)&&(t.private=!0),a(i["proxy-revalidate"])&&(t.proxyRevalidate=!0),a(i.public)&&(t.public=!0),n(d)&&(t.sMaxAge=o(d)),n(f)&&(t.staleIfError=o(f)),n(l)&&(t.staleWhileRevalidate=o(l)),t}(String(t)),c=s.noCache,u=s.noStore,d=s.mustRevalidate,f=s.maxAge,l=s.immutable;if(c||u)return"dont cache";if(l)return 31536e6;if(d)return 0;if(f){var h=e[i.Age];return h?1e3*(f-Number(h)):1e3*f}}var v=e[i.Expires];if(v){var p=Date.parse(String(v))-Date.now();return p>=0?p:"dont cache"}return"not enough headers"};var c=function(){return c=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},c.apply(this,arguments)};function u(e,t,r,n){return new(r||(r=Promise))((function(a,o){function i(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}c((n=n.apply(e,t||[])).next())}))}function d(e,t){var r,n,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],n=0}finally{r=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}Object.create;Object.create;var f=Symbol();function l(e){return e?function(t){return e(t)||304===t}:function(e){return e>=200&&e<300||304===e}}function h(e,t){void 0===e&&(e="get"),void 0===t&&(t=[]),e=e.toLowerCase();for(var r=0,n=t;r<n.length;r++){if(n[r].toLowerCase()===e)return!0}return!1}function v(e,t){var r;t.headers||(t.headers={});var n=t.cache,a=n.etag,o=n.modifiedSince;if(a){var s=!0===a?null===(r=e.data)||void 0===r?void 0:r.headers[i.ETag]:a;s&&(t.headers[i.IfNoneMatch]=s)}o&&(t.headers[i.IfModifiedSince]=!0===o?e.data.headers[i.LastModified]||new Date(e.createdAt).toUTCString():o.toUTCString())}function p(e,t){return 304===e.status&&t?(e.cached=!0,e.data=t.data,e.status=t.status,e.statusText=t.statusText,e.headers=c(c({},t.headers),e.headers),t):{data:e.data,status:e.status,statusText:e.statusText,headers:e.headers}}function g(e){var t=this,r=function(r){return u(t,void 0,void 0,(function(){var t,n,a,o,i;return d(this,(function(s){switch(s.label){case 0:return!1===r.cache?[2,r]:(r.cache=c(c({},e.defaults.cache),r.cache),h(r.method,r.cache.methods)?(t=r.id=e.generateKey(r),[4,e.storage.get(t)]):[2,r]);case 1:return"empty"!==(n=s.sent()).state&&"stale"!==n.state?[3,5]:e.waiting[t]?[4,e.storage.get(t)]:[3,3];case 2:return n=s.sent(),[3,5];case 3:return e.waiting[t]=function(){var e,t,r=new Promise((function(r,n){e=r,t=n}));return r.resolve=e,r.reject=t,r[f]=1,r}(),null===(i=e.waiting[t])||void 0===i||i.catch((function(){})),[4,e.storage.set(t,{state:"loading",previous:n.state,data:n.data,createdAt:n.createdAt})];case 4:return s.sent(),"stale"===n.state&&v(n,r),r.validateStatus=l(r.validateStatus),[2,r];case 5:return"loading"!==n.state?[3,12]:(o=e.waiting[t])?[3,7]:[4,e.storage.remove(t)];case 6:return s.sent(),[2,r];case 7:0,s.label=8;case 8:return s.trys.push([8,10,,11]),[4,o];case 9:return a=s.sent(),[3,11];case 10:return s.sent(),[2,r];case 11:return[3,13];case 12:a=n.data,s.label=13;case 13:return r.adapter=function(){return Promise.resolve({config:r,data:a.data,headers:a.headers,status:a.status,statusText:a.statusText,cached:!0,id:t})},[2,r]}}))}))};return{onFulfilled:r,apply:function(){return e.interceptors.request.use(r)}}}function m(e,t){var r;return u(this,void 0,void 0,(function(){var n,a,o,i,s,c,u,f,l,h,v,p;return d(this,(function(d){switch(d.label){case 0:return"function"==typeof t?[2,t(e)]:(n=t.statusCheck,a=t.responseMatch,o=t.containsHeaders,(s=n)?[4,n(e.status)]:[3,2]);case 1:s=!d.sent(),d.label=2;case 2:return(i=s)?[3,5]:(c=a)?[4,a(e)]:[3,4];case 3:c=!d.sent(),d.label=4;case 4:i=c,d.label=5;case 5:if(i)return[2,!1];if(!o)return[3,10];for(f in u=[],o)u.push(f);l=0,d.label=6;case 6:return l<u.length?(h=u[l],v=o[h],(p=v)?[4,v(null!==(r=e.headers[h.toLowerCase()])&&void 0!==r?r:e.headers[h])]:[3,8]):[3,10];case 7:p=!d.sent(),d.label=8;case 8:if(p)return[2,!1];d.label=9;case 9:return l++,[3,6];case 10:return[2,!0]}}))}))}function b(e,t,r){return u(this,void 0,void 0,(function(){var n,a,o,i,s,c,u;return d(this,(function(d){switch(d.label){case 0:for(a in n=[],r)n.push(a);o=0,d.label=1;case 1:return o<n.length?(i=n[o],"delete"!==(s=r[i])?[3,3]:[4,e.remove(i)]):[3,10];case 2:return d.sent(),[3,9];case 3:return[4,e.get(i)];case 4:return"loading"===(c=d.sent()).state?[3,9]:[4,s(c,t)];case 5:return"delete"!==(u=d.sent())?[3,7]:[4,e.remove(i)];case 6:return d.sent(),[3,9];case 7:return"ignore"===u?[3,9]:[4,e.set(i,u)];case 8:d.sent(),d.label=9;case 9:return o++,[3,1];case 10:return[2]}}))}))}function y(e){var t=this,r=function(r){return u(t,void 0,void 0,(function(){var t;return d(this,(function(n){switch(n.label){case 0:return[4,e.storage.remove(r)];case 1:return n.sent(),null===(t=e.waiting[r])||void 0===t||t.reject(null),delete e.waiting[r],[2]}}))}))},n=function(n){return u(t,void 0,void 0,(function(){var t,a,o,s,u,f,l,h,v,g,y,w;return d(this,(function(d){switch(d.label){case 0:return n.id=null!==(g=(w=n.config).id)&&void 0!==g?g:w.id=e.generateKey(n.config),null!==(y=n.cached)&&void 0!==y||(n.cached=!1),n.cached?[2,n]:n.config.cache?(t=n.config.cache,[4,e.storage.get(n.id)]):[2,c(c({},n),{cached:!1})];case 1:return"stale"===(a=d.sent()).state||"empty"===a.state||"cached"===a.state?[2,n]:(o=!a.data)?[4,m(n,t.cachePredicate)]:[3,3];case 2:o=!d.sent(),d.label=3;case 3:return o?[4,r(n.id)]:[3,5];case 4:return d.sent(),[2,n];case 5:for(s in i)s.startsWith("XAxiosCache")&&delete n.headers[s];return t.etag&&!0!==t.etag&&(n.headers[i.XAxiosCacheEtag]=t.etag),t.modifiedSince&&(n.headers[i.XAxiosCacheLastModified]=!0===t.modifiedSince?"use-cache-timestamp":t.modifiedSince.toUTCString()),u=t.ttl||-1,(null==t?void 0:t.interpretHeader)?"dont cache"!==(f=e.headerInterpreter(n.headers))?[3,7]:[4,r(n.id)]:[3,8];case 6:return d.sent(),[2,n];case 7:u="not enough headers"===f?u:f,d.label=8;case 8:return l=p(n,a.data),"function"!=typeof u?[3,10]:[4,u(n)];case 9:u=d.sent(),d.label=10;case 10:return t.staleIfError&&(n.headers[i.XAxiosCacheStaleIfError]=String(u)),(null==t?void 0:t.update)?[4,b(e.storage,n,t.update)]:[3,12];case 11:d.sent(),d.label=12;case 12:return h={state:"cached",ttl:u,createdAt:Date.now(),data:l},(v=e.waiting[n.id])&&(v.resolve(h.data),delete e.waiting[n.id]),[4,e.storage.set(n.id,h)];case 13:return d.sent(),[2,n]}}))}))},a=function(n){return u(t,void 0,void 0,(function(){var t,a,o,i,s,c;return d(this,(function(u){switch(u.label){case 0:if(!(t=n.config)||!1===t.cache||!t.id)throw n;return[4,e.storage.get(t.id)];case 1:return a=u.sent(),o=t.cache,"loading"===a.state&&"stale"===a.previous?[3,3]:[4,r(t.id)];case 2:throw u.sent(),n;case 3:return(null==o?void 0:o.staleIfError)?"function"!=typeof o.staleIfError?[3,5]:[4,o.staleIfError(n.response,a,n)]:[3,8];case 4:return s=u.sent(),[3,6];case 5:s=o.staleIfError,u.label=6;case 6:return!0===(i=s)||"number"==typeof i&&a.createdAt+i>Date.now()?(null===(c=e.waiting[t.id])||void 0===c||c.resolve(a.data),delete e.waiting[t.id],[4,e.storage.set(t.id,{state:"stale",createdAt:Date.now(),data:a.data})]):[3,8];case 7:return u.sent(),[2,{cached:!0,config:t,id:t.id,data:a.data.data,headers:a.data.headers,status:a.data.status,statusText:a.data.statusText}];case 8:throw n}}))}))};return{onFulfilled:n,onRejected:a,apply:function(){return e.interceptors.response.use(n,a)}}}var w=Symbol(),x=function(e){return!!e&&!!e[w]};function S(e){var t=e.data.headers;return i.ETag in t||i.LastModified in t||i.XAxiosCacheEtag in t||i.XAxiosCacheStaleIfError in t||i.XAxiosCacheLastModified in t}function I(e){return e.createdAt+e.ttl<=Date.now()}function C(e){var t,r=this,n=e.set,a=e.find,o=e.remove;return(t={})[w]=1,t.set=n,t.remove=o,t.get=function(e){return u(r,void 0,void 0,(function(){var t,r;return d(this,(function(i){switch(i.label){case 0:return[4,a(e)];case 1:return(t=i.sent())?"cached"===t.state&&I(t)?S(t)?(r={state:"stale",createdAt:t.createdAt,data:t.data},[4,n(e,r)]):[3,3]:[2,t]:[2,{state:"empty"}];case 2:return i.sent(),[2,r];case 3:return[4,o(e)];case 4:return i.sent(),[2,{state:"empty"}]}}))}))},t}function A(e){void 0===e&&(e=!1);var t=C({set:function(e,r){t.data[e]=r},remove:function(e){delete t.data[e]},find:function(r){var n=t.data[r];return e&&void 0!==n?"function"==typeof structuredClone?structuredClone(n):JSON.parse(JSON.stringify(n)):n}});return t.data=Object.create(null),t}function E(e){var t=typeof e;if(e&&"object"==t&&!(e instanceof Date||e instanceof RegExp)){var r=Array.isArray(e)?[]:{};for(var n in e)r[n]=E(e[n]);return"".concat(e.constructor).concat(JSON.stringify(r,Object.keys(e).sort()))}return"".concat(t).concat(String(e))}function O(e){e=E(e);for(var t=5381,r=0;r<e.length;)t=33*t^e.charCodeAt(r++);return t}var j=/^\/|\/$/g;function T(e){return function(t){if(t.id)return t.id;var r=e(t);return"".concat("string"==typeof r||"number"==typeof r?r:O(r))}}var M=T((function(e){var t=e.baseURL,r=void 0===t?"":t,n=e.url,a=void 0===n?"":n,o=e.method,i=void 0===o?"get":o,s=e.params,c=e.data;return r&&(r=r.replace(j,"")),a&&(a=a.replace(j,"")),i&&(i=i.toLowerCase()),{url:r+(r&&a?"/":"")+a,params:s,method:i,data:c}}));function P(e,t){var r,n,a,o,i;void 0===t&&(t={});var c=e;if(c.storage=t.storage||A(),!x(c.storage))throw new Error("Use buildStorage() function");return c.waiting=t.waiting||{},c.generateKey=t.generateKey||M,c.headerInterpreter=t.headerInterpreter||s,c.requestInterceptor=t.requestInterceptor||g(c),c.responseInterceptor=t.responseInterceptor||y(c),c.debug=t.debug,c.defaults.cache={update:t.update||{},ttl:null!==(r=t.ttl)&&void 0!==r?r:3e5,methods:t.methods||["get"],cachePredicate:t.cachePredicate||{statusCheck:function(e){return e>=200&&e<400}},etag:null===(n=t.etag)||void 0===n||n,modifiedSince:null!==(a=t.modifiedSince)&&void 0!==a?a:!1===t.etag,interpretHeader:null===(o=t.interpretHeader)||void 0===o||o,staleIfError:null===(i=t.staleIfError)||void 0===i||i},c.requestInterceptor.apply(),c.responseInterceptor.apply(),c}function L(e,t){return void 0===t&&(t=""),C({find:function(r){var n=e.getItem(t+r);return n?JSON.parse(n):void 0},remove:function(r){e.removeItem(t+r)},set:function(r,n){var a=function(){return e.setItem(t+r,JSON.stringify(n))};try{return a()}catch(n){for(var o=Object.entries(e).filter((function(r){var n=r[0];return n.startsWith(t)&&e.getItem(n)})).map((function(e){var t=e[0],r=e[1];return[t,JSON.parse(r)]})),i=0,s=o;i<s.length;i++){var c=s[i],u=c[0],d=c[1];"cached"===d.state&&I(d)&&!S(d)&&e.removeItem(u)}try{return a()}catch(t){for(var f=o.sort((function(e,t){var r=e[1],n=t[1];return(r.createdAt||0)-(n.createdAt||0)})),l=0,h=f;l<h.length;l++){u=h[l][0];e.removeItem(u);try{return a()}catch(e){}}}e.removeItem(t+r)}}})}return t}()}));
!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()}("undefined"!=typeof self?self:this,(function(){return function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{Header:function(){return i},buildKeyGenerator:function(){return T},buildMemoryStorage:function(){return A},buildStorage:function(){return C},buildWebStorage:function(){return L},canStale:function(){return S},createCacheResponse:function(){return p},createValidateStatus:function(){return l},defaultHeaderInterpreter:function(){return s},defaultKeyGenerator:function(){return M},defaultRequestInterceptor:function(){return g},defaultResponseInterceptor:function(){return y},isExpired:function(){return I},isMethodIn:function(){return h},isStorage:function(){return x},setupCache:function(){return P},testCachePredicate:function(){return m},updateCache:function(){return b},updateStaleRequest:function(){return v}});var r=Symbol("cache-parser");function n(e){return("string"==typeof e||"number"==typeof e)&&(e=Number(e))>=0&&e<1/0}function a(e){return!0===e||"number"==typeof e||"string"==typeof e&&"false"!==e}var o=Number;var i=Object.freeze({IfModifiedSince:"if-modified-since",LastModified:"last-modified",IfNoneMatch:"if-none-match",CacheControl:"cache-control",ETag:"etag",Expires:"expires",Age:"age",XAxiosCacheEtag:"x-axios-cache-etag",XAxiosCacheLastModified:"x-axios-cache-last-modified",XAxiosCacheStaleIfError:"x-axios-cache-stale-if-error"}),s=function(e){if(!e)return"not enough headers";var t=e[i.CacheControl];if(t){var s=function(e){var t=Object.defineProperty({},r,{enumerable:!1,value:1});if(!e||"string"!=typeof e)return t;var i=function(e){var t={},r=e.toLowerCase().replace(/\s+/g,"").split(",");for(var n in r){var a,o=r[n].split("=",2);t[o[0]]=null==(a=o[1])||a}return t}(e),s=i["max-age"],c=i["max-stale"],u=i["min-fresh"],d=i["s-maxage"],f=i["stale-if-error"],l=i["stale-while-revalidate"];return a(i.immutable)&&(t.immutable=!0),n(s)&&(t.maxAge=o(s)),n(c)&&(t.maxStale=o(c)),n(u)&&(t.minFresh=o(u)),a(i["must-revalidate"])&&(t.mustRevalidate=!0),a(i["must-understand"])&&(t.mustUnderstand=!0),a(i["no-cache"])&&(t.noCache=!0),a(i["no-store"])&&(t.noStore=!0),a(i["no-transform"])&&(t.noTransform=!0),a(i["only-if-cached"])&&(t.onlyIfCached=!0),a(i.private)&&(t.private=!0),a(i["proxy-revalidate"])&&(t.proxyRevalidate=!0),a(i.public)&&(t.public=!0),n(d)&&(t.sMaxAge=o(d)),n(f)&&(t.staleIfError=o(f)),n(l)&&(t.staleWhileRevalidate=o(l)),t}(String(t)),c=s.noCache,u=s.noStore,d=s.mustRevalidate,f=s.maxAge,l=s.immutable;if(c||u)return"dont cache";if(l)return 31536e6;if(d)return 0;if(f){var h=e[i.Age];return h?1e3*(f-Number(h)):1e3*f}}var v=e[i.Expires];if(v){var p=Date.parse(String(v))-Date.now();return p>=0?p:"dont cache"}return"not enough headers"};var c=function(){return c=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},c.apply(this,arguments)};function u(e,t,r,n){return new(r||(r=Promise))((function(a,o){function i(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}c((n=n.apply(e,t||[])).next())}))}function d(e,t){var r,n,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!(a=i.trys,(a=a.length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],n=0}finally{r=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}Object.create;Object.create;var f=Symbol();function l(e){return e?function(t){return e(t)||304===t}:function(e){return e>=200&&e<300||304===e}}function h(e,t){void 0===e&&(e="get"),void 0===t&&(t=[]),e=e.toLowerCase();for(var r=0,n=t;r<n.length;r++){if(n[r].toLowerCase()===e)return!0}return!1}function v(e,t){var r;t.headers||(t.headers={});var n=t.cache,a=n.etag,o=n.modifiedSince;if(a){var s=!0===a?null===(r=e.data)||void 0===r?void 0:r.headers[i.ETag]:a;s&&(t.headers[i.IfNoneMatch]=s)}o&&(t.headers[i.IfModifiedSince]=!0===o?e.data.headers[i.LastModified]||new Date(e.createdAt).toUTCString():o.toUTCString())}function p(e,t){return 304===e.status&&t?(e.cached=!0,e.data=t.data,e.status=t.status,e.statusText=t.statusText,e.headers=c(c({},t.headers),e.headers),t):{data:e.data,status:e.status,statusText:e.statusText,headers:e.headers}}function g(e){var t=this,r=function(r){return u(t,void 0,void 0,(function(){var t,n,a,o,i;return d(this,(function(s){switch(s.label){case 0:return!1===r.cache?[2,r]:(r.cache=c(c({},e.defaults.cache),r.cache),h(r.method,r.cache.methods)?(t=r.id=e.generateKey(r),[4,e.storage.get(t)]):[2,r]);case 1:return"empty"!==(n=s.sent()).state&&"stale"!==n.state?[3,5]:e.waiting[t]?[4,e.storage.get(t)]:[3,3];case 2:if("empty"!==(n=s.sent()).state)return[3,5];s.label=3;case 3:return e.waiting[t]=function(){var e,t,r=new Promise((function(r,n){e=r,t=n}));return r.resolve=e,r.reject=t,r[f]=1,r}(),null===(i=e.waiting[t])||void 0===i||i.catch((function(){})),[4,e.storage.set(t,{state:"loading",previous:n.state,data:n.data,createdAt:n.createdAt})];case 4:return s.sent(),"stale"===n.state&&v(n,r),r.validateStatus=l(r.validateStatus),[2,r];case 5:return"loading"!==n.state?[3,12]:(o=e.waiting[t])?[3,7]:[4,e.storage.remove(t)];case 6:return s.sent(),[2,r];case 7:0,s.label=8;case 8:return s.trys.push([8,10,,11]),[4,o];case 9:return a=s.sent(),[3,11];case 10:return s.sent(),[2,r];case 11:return[3,13];case 12:a=n.data,s.label=13;case 13:return r.adapter=function(){return Promise.resolve({config:r,data:a.data,headers:a.headers,status:a.status,statusText:a.statusText,cached:!0,id:t})},[2,r]}}))}))};return{onFulfilled:r,apply:function(){return e.interceptors.request.use(r)}}}function m(e,t){var r;return u(this,void 0,void 0,(function(){var n,a,o,i,s,c,u,f,l,h,v,p;return d(this,(function(d){switch(d.label){case 0:return"function"==typeof t?[2,t(e)]:(n=t.statusCheck,a=t.responseMatch,o=t.containsHeaders,(s=n)?[4,n(e.status)]:[3,2]);case 1:s=!d.sent(),d.label=2;case 2:return(i=s)?[3,5]:(c=a)?[4,a(e)]:[3,4];case 3:c=!d.sent(),d.label=4;case 4:i=c,d.label=5;case 5:if(i)return[2,!1];if(!o)return[3,10];for(f in u=[],o)u.push(f);l=0,d.label=6;case 6:return l<u.length?(h=u[l],v=o[h],(p=v)?[4,v(null!==(r=e.headers[h.toLowerCase()])&&void 0!==r?r:e.headers[h])]:[3,8]):[3,10];case 7:p=!d.sent(),d.label=8;case 8:if(p)return[2,!1];d.label=9;case 9:return l++,[3,6];case 10:return[2,!0]}}))}))}function b(e,t,r){return u(this,void 0,void 0,(function(){var n,a,o,i,s,c,u;return d(this,(function(d){switch(d.label){case 0:for(a in n=[],r)n.push(a);o=0,d.label=1;case 1:return o<n.length?(i=n[o],"delete"!==(s=r[i])?[3,3]:[4,e.remove(i)]):[3,10];case 2:return d.sent(),[3,9];case 3:return[4,e.get(i)];case 4:return"loading"===(c=d.sent()).state?[3,9]:[4,s(c,t)];case 5:return"delete"!==(u=d.sent())?[3,7]:[4,e.remove(i)];case 6:return d.sent(),[3,9];case 7:return"ignore"===u?[3,9]:[4,e.set(i,u)];case 8:d.sent(),d.label=9;case 9:return o++,[3,1];case 10:return[2]}}))}))}function y(e){var t=this,r=function(r){return u(t,void 0,void 0,(function(){var t;return d(this,(function(n){switch(n.label){case 0:return[4,e.storage.remove(r)];case 1:return n.sent(),null===(t=e.waiting[r])||void 0===t||t.reject(null),delete e.waiting[r],[2]}}))}))},n=function(n){return u(t,void 0,void 0,(function(){var t,a,o,s,u,f,l,h,v,g,y,w,x;return d(this,(function(d){switch(d.label){case 0:return t=n.id=null!==(y=(x=n.config).id)&&void 0!==y?y:x.id=e.generateKey(n.config),null!==(w=n.cached)&&void 0!==w||(n.cached=!1),n.cached?[2,n]:n.config.cache?(a=n.config.cache,[4,e.storage.get(t)]):[2,c(c({},n),{cached:!1})];case 1:return"stale"===(o=d.sent()).state||"empty"===o.state||"cached"===o.state?[2,n]:(s=!o.data)?[4,m(n,a.cachePredicate)]:[3,3];case 2:s=!d.sent(),d.label=3;case 3:return s?[4,r(t)]:[3,5];case 4:return d.sent(),[2,n];case 5:for(u in i)u.startsWith("XAxiosCache")&&delete n.headers[u];return a.etag&&!0!==a.etag&&(n.headers[i.XAxiosCacheEtag]=a.etag),a.modifiedSince&&(n.headers[i.XAxiosCacheLastModified]=!0===a.modifiedSince?"use-cache-timestamp":a.modifiedSince.toUTCString()),f=a.ttl||-1,(null==a?void 0:a.interpretHeader)?"dont cache"!==(l=e.headerInterpreter(n.headers))?[3,7]:[4,r(t)]:[3,8];case 6:return d.sent(),[2,n];case 7:f="not enough headers"===l?f:l,d.label=8;case 8:return h=p(n,o.data),"function"!=typeof f?[3,10]:[4,f(n)];case 9:f=d.sent(),d.label=10;case 10:return a.staleIfError&&(n.headers[i.XAxiosCacheStaleIfError]=String(f)),(null==a?void 0:a.update)?[4,b(e.storage,n,a.update)]:[3,12];case 11:d.sent(),d.label=12;case 12:return v={state:"cached",ttl:f,createdAt:Date.now(),data:h},(g=e.waiting[t])&&(g.resolve(v.data),delete e.waiting[t]),[4,e.storage.set(t,v)];case 13:return d.sent(),[2,n]}}))}))},a=function(n){return u(t,void 0,void 0,(function(){var t,a,o,i,s,c;return d(this,(function(u){switch(u.label){case 0:if(!(t=n.config)||!1===t.cache||!t.id)throw n;return[4,e.storage.get(t.id)];case 1:return a=u.sent(),o=t.cache,"loading"===a.state&&"stale"===a.previous?[3,3]:[4,r(t.id)];case 2:throw u.sent(),n;case 3:return(null==o?void 0:o.staleIfError)?"function"!=typeof o.staleIfError?[3,5]:[4,o.staleIfError(n.response,a,n)]:[3,8];case 4:return s=u.sent(),[3,6];case 5:s=o.staleIfError,u.label=6;case 6:return!0===(i=s)||"number"==typeof i&&a.createdAt+i>Date.now()?(null===(c=e.waiting[t.id])||void 0===c||c.resolve(a.data),delete e.waiting[t.id],[4,e.storage.set(t.id,{state:"stale",createdAt:Date.now(),data:a.data})]):[3,8];case 7:return u.sent(),[2,{cached:!0,config:t,id:t.id,data:a.data.data,headers:a.data.headers,status:a.data.status,statusText:a.data.statusText}];case 8:throw n}}))}))};return{onFulfilled:n,onRejected:a,apply:function(){return e.interceptors.response.use(n,a)}}}var w=Symbol(),x=function(e){return!!e&&!!e[w]};function S(e){var t=e.data.headers;return i.ETag in t||i.LastModified in t||i.XAxiosCacheEtag in t||i.XAxiosCacheStaleIfError in t||i.XAxiosCacheLastModified in t}function I(e){return e.createdAt+e.ttl<=Date.now()}function C(e){var t,r=this,n=e.set,a=e.find,o=e.remove;return(t={})[w]=1,t.set=n,t.remove=o,t.get=function(e){return u(r,void 0,void 0,(function(){var t,r;return d(this,(function(i){switch(i.label){case 0:return[4,a(e)];case 1:return(t=i.sent())?"cached"===t.state&&I(t)?S(t)?(r={state:"stale",createdAt:t.createdAt,data:t.data},[4,n(e,r)]):[3,3]:[2,t]:[2,{state:"empty"}];case 2:return i.sent(),[2,r];case 3:return[4,o(e)];case 4:return i.sent(),[2,{state:"empty"}]}}))}))},t}function A(e){void 0===e&&(e=!1);var t=C({set:function(e,r){t.data[e]=r},remove:function(e){delete t.data[e]},find:function(r){var n=t.data[r];return e&&void 0!==n?"function"==typeof structuredClone?structuredClone(n):JSON.parse(JSON.stringify(n)):n}});return t.data=Object.create(null),t}function E(e){var t=typeof e;if(e&&"object"==t&&!(e instanceof Date||e instanceof RegExp)){var r=Array.isArray(e)?[]:{};for(var n in e)r[n]=E(e[n]);return""+e.constructor+JSON.stringify(r,Object.keys(e).sort())}return""+t+String(e)}function O(e){e=E(e);for(var t=5381,r=0;r<e.length;)t=33*t^e.charCodeAt(r++);return t}var j=/^\/|\/$/g;function T(e){return function(t){if(t.id)return t.id;var r=e(t);return"".concat("string"==typeof r||"number"==typeof r?r:O(r))}}var M=T((function(e){var t=e.baseURL,r=void 0===t?"":t,n=e.url,a=void 0===n?"":n,o=e.method,i=void 0===o?"get":o,s=e.params,c=e.data;return r&&(r=r.replace(j,"")),a&&(a=a.replace(j,"")),i&&(i=i.toLowerCase()),{url:r+(r&&a?"/":"")+a,params:s,method:i,data:c}}));function P(e,t){var r,n,a,o,i;void 0===t&&(t={});var c=e;if(c.storage=t.storage||A(),!x(c.storage))throw new Error("Use buildStorage() function");return c.waiting=t.waiting||{},c.generateKey=t.generateKey||M,c.headerInterpreter=t.headerInterpreter||s,c.requestInterceptor=t.requestInterceptor||g(c),c.responseInterceptor=t.responseInterceptor||y(c),c.debug=t.debug,c.defaults.cache={update:t.update||{},ttl:null!==(r=t.ttl)&&void 0!==r?r:3e5,methods:t.methods||["get"],cachePredicate:t.cachePredicate||{statusCheck:function(e){return e>=200&&e<400}},etag:null===(n=t.etag)||void 0===n||n,modifiedSince:null!==(a=t.modifiedSince)&&void 0!==a?a:!1===t.etag,interpretHeader:null===(o=t.interpretHeader)||void 0===o||o,staleIfError:null===(i=t.staleIfError)||void 0===i||i},c.requestInterceptor.apply(),c.responseInterceptor.apply(),c}function L(e,t){return void 0===t&&(t=""),C({find:function(r){var n=e.getItem(t+r);return n?JSON.parse(n):void 0},remove:function(r){e.removeItem(t+r)},set:function(r,n){var a=function(){return e.setItem(t+r,JSON.stringify(n))};try{return a()}catch(n){for(var o=Object.entries(e).filter((function(r){var n=r[0];return n.startsWith(t)&&e.getItem(n)})).map((function(e){var t=e[0],r=e[1];return[t,JSON.parse(r)]})),i=0,s=o;i<s.length;i++){var c=s[i],u=c[0],d=c[1];"cached"===d.state&&I(d)&&!S(d)&&e.removeItem(u)}try{return a()}catch(t){for(var f=o.sort((function(e,t){var r=e[1],n=t[1];return(r.createdAt||0)-(n.createdAt||0)})),l=0,h=f;l<h.length;l++){u=h[l][0];e.removeItem(u);try{return a()}catch(e){}}}e.removeItem(t+r)}}})}return t}()}));
{
"name": "axios-cache-interceptor",
"version": "0.10.1",
"version": "0.10.2",
"description": "Cache interceptor for axios",

@@ -48,5 +48,5 @@ "license": "MIT",

"dependencies": {
"cache-parser": "^1.2.2",
"fast-defer": "^1.1.5",
"object-code": "^1.2.0"
"cache-parser": "^1.2.4",
"fast-defer": "^1.1.7",
"object-code": "^1.2.2"
},

@@ -53,0 +53,0 @@ "devDependencies": {

@@ -58,10 +58,19 @@ import { deferred } from 'fast-defer';

if (__ACI_DEV__) {
axios.debug?.({
id: key,
msg: 'Waiting list had an deferred for this key, waiting for it to finish'
});
/**
* This check is required when a request has it own cache deleted manually, lets
* say by a `axios.storage.delete(key)` and has a concurrent loading request.
* Because in this case, the cache will be empty and may still has a pending key
* on waiting map.
*/
//@ts-expect-error read above
if (cache.state !== 'empty') {
if (__ACI_DEV__) {
axios.debug?.({
id: key,
msg: 'Waiting list had an deferred for this key, waiting for it to finish'
});
}
break emptyOrStale;
}
break emptyOrStale;
}

@@ -85,2 +94,3 @@

data: cache.data as any,
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-explicit-any

@@ -87,0 +97,0 @@ createdAt: cache.createdAt as any

@@ -31,3 +31,3 @@ import type { CacheProperties } from '..';

const onFulfilled: ResponseInterceptor['onFulfilled'] = async (response) => {
response.id = response.config.id ??= axios.generateKey(response.config);
const id = (response.id = response.config.id ??= axios.generateKey(response.config));
response.cached ??= false;

@@ -39,3 +39,3 @@

axios.debug?.({
id: response.id,
id,
msg: 'Returned cached response'

@@ -53,3 +53,3 @@ });

axios.debug?.({
id: response.id,
id,
msg: 'Response with config.cache === false',

@@ -66,3 +66,3 @@ data: response

const cache = await axios.storage.get(response.id);
const cache = await axios.storage.get(id);

@@ -78,3 +78,3 @@ if (

axios.debug?.({
id: response.id,
id,
msg: 'Response not cached but storage is not loading',

@@ -94,6 +94,7 @@ data: { cache, response }

) {
await rejectResponse(response.id);
await rejectResponse(id);
if (__ACI_DEV__) {
axios.debug?.({
id: response.id,
id,
msg: 'Cache predicate rejected this response'

@@ -133,7 +134,7 @@ });

if (expirationTime === 'dont cache') {
await rejectResponse(response.id);
await rejectResponse(id);
if (__ACI_DEV__) {
axios.debug?.({
id: response.id,
id,
msg: `Cache header interpreted as 'dont cache'`,

@@ -166,3 +167,3 @@ data: {

axios.debug?.({
id: response.id,
id,
msg: 'Useful response configuration found',

@@ -186,11 +187,11 @@ data: { cacheConfig, ttl, cacheResponse: data }

// Resolve all other requests waiting for this response
const waiting = axios.waiting[response.id];
const waiting = axios.waiting[id];
if (waiting) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
waiting.resolve(newCache.data);
delete axios.waiting[response.id];
delete axios.waiting[id];
if (__ACI_DEV__) {
axios.debug?.({
id: response.id,
id,
msg: 'Found waiting deferred(s) and resolved them'

@@ -202,7 +203,7 @@ });

// Define this key as cache on the storage
await axios.storage.set(response.id, newCache);
await axios.storage.set(id, newCache);
if (__ACI_DEV__) {
axios.debug?.({
id: response.id,
id,
msg: 'Response cached',

@@ -209,0 +210,0 @@ data: { cache: newCache, response }

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