Comparing version 1.11.1 to 1.11.2
@@ -1,2 +0,2 @@ | ||
/*! idmp v1.11.1 | (c) github/haozi | MIT */ | ||
/*! idmp v1.11.2 | (c) github/haozi | MIT */ | ||
const l = () => { | ||
@@ -148,3 +148,4 @@ }; | ||
A as default, | ||
o as g | ||
o as g, | ||
x as getOptions | ||
}; |
@@ -1,2 +0,2 @@ | ||
/*! idmp v1.11.1 | (c) github/haozi | MIT */ | ||
(function(n,f){typeof exports=="object"&&typeof module!="undefined"?f(exports):typeof define=="function"&&define.amd?define(["exports"],f):(n=typeof globalThis!="undefined"?globalThis:n||self,f(n.idmp={}))})(this,function(n){"use strict";const A=()=>{},_=t=>t<0?0:t>6048e5?6048e5:t;n.g={};const a=t=>{const{maxRetry:u=30,maxAge:h=3e3,onBeforeRetry:i=A}=t||{},m=_(h);return{maxRetry:u,maxAge:m,onBeforeRetry:i}},d=t=>{t&&delete n.g[t]},g=()=>{n.g={}},r=(t,u,h)=>{if(!t)return u();const{maxRetry:i,maxAge:m,onBeforeRetry:p}=a(h);n.g[t]=n.g[t]||{0:0,1:0,4:[]};const e=n.g[t],R=()=>{e[1]=0,e[2]=void 0,e[3]=void 0},T=()=>{const o=e[4].length;for(let s=0;s<o;++s)e[4][s][0](e[2]);e[4]=[],setTimeout(()=>{d(t)},m)},M=()=>{const o=e[4].length-i;for(let s=0;s<o;++s)e[4][s][1](e[3]);d(t)},l=()=>new Promise((o,s)=>{if(!e[5]&&(e[5]=u),e[2]){o(e[2]);return}e[1]===0?(e[1]=1,e[4].push([o,s]),e[5]().then(c=>{e[2]=c,T(),e[1]=4}).catch(c=>{e[1]=3,e[3]=c,++e[0],e[0]>i?M():(p(c,{globalKey:t,retryCount:e[0]}),R(),setTimeout(l,(e[0]-1)*50))})):e[1]===1&&e[4].push([o,s])});return l()};r.flush=d,r.flushAll=g,n.default=r,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); | ||
/*! idmp v1.11.2 | (c) github/haozi | MIT */ | ||
(function(n,f){typeof exports=="object"&&typeof module!="undefined"?f(exports):typeof define=="function"&&define.amd?define(["exports"],f):(n=typeof globalThis!="undefined"?globalThis:n||self,f(n.idmp={}))})(this,function(n){"use strict";const g=()=>{},_=t=>t<0?0:t>6048e5?6048e5:t;n.g={};const l=t=>{const{maxRetry:i=30,maxAge:h=3e3,onBeforeRetry:u=g}=t||{},m=_(h);return{maxRetry:i,maxAge:m,onBeforeRetry:u}},d=t=>{t&&delete n.g[t]},a=()=>{n.g={}},r=(t,i,h)=>{if(!t)return i();const{maxRetry:u,maxAge:m,onBeforeRetry:p}=l(h);n.g[t]=n.g[t]||{0:0,1:0,4:[]};const e=n.g[t],R=()=>{e[1]=0,e[2]=void 0,e[3]=void 0},T=()=>{const o=e[4].length;for(let s=0;s<o;++s)e[4][s][0](e[2]);e[4]=[],setTimeout(()=>{d(t)},m)},M=()=>{const o=e[4].length-u;for(let s=0;s<o;++s)e[4][s][1](e[3]);d(t)},A=()=>new Promise((o,s)=>{if(!e[5]&&(e[5]=i),e[2]){o(e[2]);return}e[1]===0?(e[1]=1,e[4].push([o,s]),e[5]().then(c=>{e[2]=c,T(),e[1]=4}).catch(c=>{e[1]=3,e[3]=c,++e[0],e[0]>u?M():(p(c,{globalKey:t,retryCount:e[0]}),R(),setTimeout(A,(e[0]-1)*50))})):e[1]===1&&e[4].push([o,s])});return A()};r.flush=d,r.flushAll=a,n.default=r,n.getOptions=l,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}); |
@@ -62,2 +62,10 @@ /** | ||
}>; | ||
declare const getOptions: (options?: IdmpOptions) => { | ||
maxRetry: number; | ||
maxAge: number; | ||
onBeforeRetry: (err: any, extra: { | ||
globalKey: IdmpGlobalKey; | ||
retryCount: number; | ||
}) => void; | ||
}; | ||
declare const idmp: { | ||
@@ -70,2 +78,2 @@ <T>(globalKey: IdmpGlobalKey, promiseFunc: IdmpPromise<T>, options?: IdmpOptions): Promise<T>; | ||
export default idmp; | ||
export { _globalStore as g, type Idmp, type IdmpGlobalKey, type IdmpOptions, type IdmpPromise, }; | ||
export { _globalStore as g, getOptions, type Idmp, type IdmpGlobalKey, type IdmpOptions, type IdmpPromise, }; |
@@ -1,2 +0,2 @@ | ||
/*! idmp v1.11.1 | (c) github/haozi | MIT */ | ||
/*! idmp v1.11.2 | (c) github/haozi | MIT */ | ||
const DEFAULT_MAX_AGE = 3e3; | ||
@@ -203,3 +203,4 @@ const _7days = 6048e5; | ||
idmp as default, | ||
_globalStore as g | ||
_globalStore as g, | ||
getOptions | ||
}; |
@@ -1,2 +0,2 @@ | ||
/*! idmp v1.11.1 | (c) github/haozi | MIT */ | ||
/*! idmp v1.11.2 | (c) github/haozi | MIT */ | ||
const DEFAULT_MAX_AGE = 3e3; | ||
@@ -331,4 +331,5 @@ const _7days = 6048e5; | ||
idmp as default, | ||
_globalStore as g | ||
_globalStore as g, | ||
getOptions | ||
}; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "idmp", | ||
"version": "1.11.1", | ||
"version": "1.11.2", | ||
"keywords": [ | ||
"cache response", | ||
"deduplicate network requests", | ||
"idempotent function", | ||
"duplicate API calls", | ||
"swr without hooks", | ||
"deduplicate network requests" | ||
"request deduplication", | ||
"network request caching", | ||
"API caching", | ||
"cache API responses", | ||
"concurrent API calls", | ||
"eliminate duplicate requests", | ||
"retry failed requests", | ||
"immutable data", | ||
"auto retry" | ||
], | ||
@@ -9,0 +19,0 @@ "homepage": "https://ha0z1.github.io/idmp/", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69749
1104