@nocobase/plugin-workflow 0.13.0-alpha.9 → 0.14.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ var L=(o,t,e)=>{if(!t.has(o))throw TypeError("Cannot "+e)};var j=(o,t,e)=>(L(o,t,"read from private field"),e?e.call(o):t.get(o)),G=(o,t,e)=>{if(t.has(o))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(o):t.set(o,e)},C=(o,t,e,i)=>(L(o,t,"write to private field"),i?i.call(o,e):t.set(o,e),e);var v=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,U=new Set,k=(o,t,e,i)=>{typeof process=="object"&&process&&typeof process.emitWarning=="function"?process.emitWarning(o,t,e,i):console.error(`[${e}] ${t}: ${o}`)},H=o=>!U.has(o),P=Symbol("type"),F=o=>o&&o===Math.floor(o)&&o>0&&isFinite(o),M=o=>F(o)?o<=Math.pow(2,8)?Uint8Array:o<=Math.pow(2,16)?Uint16Array:o<=Math.pow(2,32)?Uint32Array:o<=Number.MAX_SAFE_INTEGER?O:null:null,O=class extends Array{constructor(t){super(t),this.fill(0)}},E,T=class{heap;length;static create(t){let e=M(t);if(!e)return[];C(T,E,!0);let i=new T(t,e);return C(T,E,!1),i}constructor(t,e){if(!j(T,E))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new e(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},D=T;E=new WeakMap,G(D,E,!1);var W=class{#d;#f;#_;#g;#W;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#s;#p;#n;#i;#t;#l;#c;#o;#h;#w;#r;#F;#A;#S;#y;#T;#a;static unsafeExposeInternals(t){return{starts:t.#A,ttls:t.#S,sizes:t.#F,keyMap:t.#n,keyList:t.#i,valList:t.#t,next:t.#l,prev:t.#c,get head(){return t.#o},get tail(){return t.#h},free:t.#w,isBackgroundFetch:e=>t.#e(e),backgroundFetch:(e,i,s,n)=>t.#R(e,i,s,n),moveToTail:e=>t.#v(e),indexes:e=>t.#m(e),rindexes:e=>t.#b(e),isStale:e=>t.#u(e)}}get max(){return this.#d}get maxSize(){return this.#f}get calculatedSize(){return this.#p}get size(){return this.#s}get fetchMethod(){return this.#W}get dispose(){return this.#_}get disposeAfter(){return this.#g}constructor(t){let{max:e=0,ttl:i,ttlResolution:s=1,ttlAutopurge:n,updateAgeOnGet:h,updateAgeOnHas:f,allowStale:r,dispose:p,disposeAfter:y,noDisposeOnSet:a,noUpdateTTL:u,maxSize:g=0,maxEntrySize:A=0,sizeCalculation:c,fetchMethod:w,noDeleteOnFetchRejection:l,noDeleteOnStaleGet:S,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:d,ignoreFetchAbort:_}=t;if(e!==0&&!F(e))throw new TypeError("max option must be a nonnegative integer");let z=e?M(e):Array;if(!z)throw new Error("invalid max value: "+e);if(this.#d=e,this.#f=g,this.maxEntrySize=A||this.#f,this.sizeCalculation=c,this.sizeCalculation){if(!this.#f&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(w!==void 0&&typeof w!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#W=w,this.#T=!!w,this.#n=new Map,this.#i=new Array(e).fill(void 0),this.#t=new Array(e).fill(void 0),this.#l=new z(e),this.#c=new z(e),this.#o=0,this.#h=0,this.#w=D.create(e),this.#s=0,this.#p=0,typeof p=="function"&&(this.#_=p),typeof y=="function"?(this.#g=y,this.#r=[]):(this.#g=void 0,this.#r=void 0),this.#y=!!this.#_,this.#a=!!this.#g,this.noDisposeOnSet=!!a,this.noUpdateTTL=!!u,this.noDeleteOnFetchRejection=!!l,this.allowStaleOnFetchRejection=!!m,this.allowStaleOnFetchAbort=!!d,this.ignoreFetchAbort=!!_,this.maxEntrySize!==0){if(this.#f!==0&&!F(this.#f))throw new TypeError("maxSize must be a positive integer if specified");if(!F(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#M()}if(this.allowStale=!!r,this.noDeleteOnStaleGet=!!S,this.updateAgeOnGet=!!h,this.updateAgeOnHas=!!f,this.ttlResolution=F(s)||s===0?s:1,this.ttlAutopurge=!!n,this.ttl=i||0,this.ttl){if(!F(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#x()}if(this.#d===0&&this.ttl===0&&this.#f===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#d&&!this.#f){let b="LRU_CACHE_UNBOUNDED";H(b)&&(U.add(b),k("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",b,W))}}getRemainingTTL(t){return this.#n.has(t)?1/0:0}#x(){let t=new O(this.#d),e=new O(this.#d);this.#S=t,this.#A=e,this.#L=(n,h,f=v.now())=>{if(e[n]=h!==0?f:0,t[n]=h,h!==0&&this.ttlAutopurge){let r=setTimeout(()=>{this.#u(n)&&this.delete(this.#i[n])},h+1);r.unref&&r.unref()}},this.#O=n=>{e[n]=t[n]!==0?v.now():0},this.#z=(n,h)=>{if(t[h]){let f=t[h],r=e[h];n.ttl=f,n.start=r,n.now=i||s(),n.remainingTTL=n.now+f-r}};let i=0,s=()=>{let n=v.now();if(this.ttlResolution>0){i=n;let h=setTimeout(()=>i=0,this.ttlResolution);h.unref&&h.unref()}return n};this.getRemainingTTL=n=>{let h=this.#n.get(n);return h===void 0?0:t[h]===0||e[h]===0?1/0:e[h]+t[h]-(i||s())},this.#u=n=>t[n]!==0&&e[n]!==0&&(i||s())-e[n]>t[n]}#O=()=>{};#z=()=>{};#L=()=>{};#u=()=>!1;#M(){let t=new O(this.#d);this.#p=0,this.#F=t,this.#E=e=>{this.#p-=t[e],t[e]=0},this.#j=(e,i,s,n)=>{if(this.#e(i))return 0;if(!F(s))if(n){if(typeof n!="function")throw new TypeError("sizeCalculation must be a function");if(s=n(i,e),!F(s))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return s},this.#D=(e,i,s)=>{if(t[e]=i,this.#f){let n=this.#f-t[e];for(;this.#p>n;)this.#C(!0)}this.#p+=t[e],s&&(s.entrySize=i,s.totalCalculatedSize=this.#p)}}#E=t=>{};#D=(t,e,i)=>{};#j=(t,e,i,s)=>{if(i||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#m({allowStale:t=this.allowStale}={}){if(this.#s)for(let e=this.#h;!(!this.#G(e)||((t||!this.#u(e))&&(yield e),e===this.#o));)e=this.#c[e]}*#b({allowStale:t=this.allowStale}={}){if(this.#s)for(let e=this.#o;!(!this.#G(e)||((t||!this.#u(e))&&(yield e),e===this.#h));)e=this.#l[e]}#G(t){return t!==void 0&&this.#n.get(this.#i[t])===t}*entries(){for(let t of this.#m())this.#t[t]!==void 0&&this.#i[t]!==void 0&&!this.#e(this.#t[t])&&(yield[this.#i[t],this.#t[t]])}*rentries(){for(let t of this.#b())this.#t[t]!==void 0&&this.#i[t]!==void 0&&!this.#e(this.#t[t])&&(yield[this.#i[t],this.#t[t]])}*keys(){for(let t of this.#m()){let e=this.#i[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e)}}*rkeys(){for(let t of this.#b()){let e=this.#i[t];e!==void 0&&!this.#e(this.#t[t])&&(yield e)}}*values(){for(let t of this.#m())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t])}*rvalues(){for(let t of this.#b())this.#t[t]!==void 0&&!this.#e(this.#t[t])&&(yield this.#t[t])}[Symbol.iterator](){return this.entries()}find(t,e={}){for(let i of this.#m()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;if(n!==void 0&&t(n,this.#i[i],this))return this.get(this.#i[i],e)}}forEach(t,e=this){for(let i of this.#m()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;n!==void 0&&t.call(e,n,this.#i[i],this)}}rforEach(t,e=this){for(let i of this.#b()){let s=this.#t[i],n=this.#e(s)?s.__staleWhileFetching:s;n!==void 0&&t.call(e,n,this.#i[i],this)}}purgeStale(){let t=!1;for(let e of this.#b({allowStale:!0}))this.#u(e)&&(this.delete(this.#i[e]),t=!0);return t}dump(){let t=[];for(let e of this.#m({allowStale:!0})){let i=this.#i[e],s=this.#t[e],n=this.#e(s)?s.__staleWhileFetching:s;if(n===void 0||i===void 0)continue;let h={value:n};if(this.#S&&this.#A){h.ttl=this.#S[e];let f=v.now()-this.#A[e];h.start=Math.floor(Date.now()-f)}this.#F&&(h.size=this.#F[e]),t.unshift([i,h])}return t}load(t){this.clear();for(let[e,i]of t){if(i.start){let s=Date.now()-i.start;i.start=v.now()-s}this.set(e,i.value,i)}}set(t,e,i={}){let{ttl:s=this.ttl,start:n,noDisposeOnSet:h=this.noDisposeOnSet,sizeCalculation:f=this.sizeCalculation,status:r}=i,{noUpdateTTL:p=this.noUpdateTTL}=i,y=this.#j(t,e,i.size||0,f);if(this.maxEntrySize&&y>this.maxEntrySize)return r&&(r.set="miss",r.maxEntrySizeExceeded=!0),this.delete(t),this;let a=this.#s===0?void 0:this.#n.get(t);if(a===void 0)a=this.#s===0?this.#h:this.#w.length!==0?this.#w.pop():this.#s===this.#d?this.#C(!1):this.#s,this.#i[a]=t,this.#t[a]=e,this.#n.set(t,a),this.#l[this.#h]=a,this.#c[a]=this.#h,this.#h=a,this.#s++,this.#D(a,y,r),r&&(r.set="add"),p=!1;else{this.#v(a);let u=this.#t[a];if(e!==u){if(this.#T&&this.#e(u)?u.__abortController.abort(new Error("replaced")):h||(this.#y&&this.#_?.(u,t,"set"),this.#a&&this.#r?.push([u,t,"set"])),this.#E(a),this.#D(a,y,r),this.#t[a]=e,r){r.set="replace";let g=u&&this.#e(u)?u.__staleWhileFetching:u;g!==void 0&&(r.oldValue=g)}}else r&&(r.set="update")}if(s!==0&&!this.#S&&this.#x(),this.#S&&(p||this.#L(a,s,n),r&&this.#z(r,a)),!h&&this.#a&&this.#r){let u=this.#r,g;for(;g=u?.shift();)this.#g?.(...g)}return this}pop(){try{for(;this.#s;){let t=this.#t[this.#o];if(this.#C(!0),this.#e(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#a&&this.#r){let t=this.#r,e;for(;e=t?.shift();)this.#g?.(...e)}}}#C(t){let e=this.#o,i=this.#i[e],s=this.#t[e];return this.#T&&this.#e(s)?s.__abortController.abort(new Error("evicted")):(this.#y||this.#a)&&(this.#y&&this.#_?.(s,i,"evict"),this.#a&&this.#r?.push([s,i,"evict"])),this.#E(e),t&&(this.#i[e]=void 0,this.#t[e]=void 0,this.#w.push(e)),this.#s===1?(this.#o=this.#h=0,this.#w.length=0):this.#o=this.#l[e],this.#n.delete(i),this.#s--,e}has(t,e={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=e,n=this.#n.get(t);if(n!==void 0){let h=this.#t[n];if(this.#e(h)&&h.__staleWhileFetching===void 0)return!1;if(this.#u(n))s&&(s.has="stale",this.#z(s,n));else return i&&this.#O(n),s&&(s.has="hit",this.#z(s,n)),!0}else s&&(s.has="miss");return!1}peek(t,e={}){let{allowStale:i=this.allowStale}=e,s=this.#n.get(t);if(s!==void 0&&(i||!this.#u(s))){let n=this.#t[s];return this.#e(n)?n.__staleWhileFetching:n}}#R(t,e,i,s){let n=e===void 0?void 0:this.#t[e];if(this.#e(n))return n;let h=new AbortController,{signal:f}=i;f?.addEventListener("abort",()=>h.abort(f.reason),{signal:h.signal});let r={signal:h.signal,options:i,context:s},p=(c,w=!1)=>{let{aborted:l}=h.signal,S=i.ignoreFetchAbort&&c!==void 0;if(i.status&&(l&&!w?(i.status.fetchAborted=!0,i.status.fetchError=h.signal.reason,S&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),l&&!S&&!w)return a(h.signal.reason);let m=g;return this.#t[e]===g&&(c===void 0?m.__staleWhileFetching?this.#t[e]=m.__staleWhileFetching:this.delete(t):(i.status&&(i.status.fetchUpdated=!0),this.set(t,c,r.options))),c},y=c=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=c),a(c)),a=c=>{let{aborted:w}=h.signal,l=w&&i.allowStaleOnFetchAbort,S=l||i.allowStaleOnFetchRejection,m=S||i.noDeleteOnFetchRejection,d=g;if(this.#t[e]===g&&(!m||d.__staleWhileFetching===void 0?this.delete(t):l||(this.#t[e]=d.__staleWhileFetching)),S)return i.status&&d.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),d.__staleWhileFetching;if(d.__returned===d)throw c},u=(c,w)=>{let l=this.#W?.(t,n,r);l&&l instanceof Promise&&l.then(S=>c(S),w),h.signal.addEventListener("abort",()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(c(),i.allowStaleOnFetchAbort&&(c=S=>p(S,!0)))})};i.status&&(i.status.fetchDispatched=!0);let g=new Promise(u).then(p,y),A=Object.assign(g,{__abortController:h,__staleWhileFetching:n,__returned:void 0});return e===void 0?(this.set(t,A,{...r.options,status:void 0}),e=this.#n.get(t)):this.#t[e]=A,A}#e(t){if(!this.#T)return!1;let e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof AbortController}async fetch(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:h=this.ttl,noDisposeOnSet:f=this.noDisposeOnSet,size:r=0,sizeCalculation:p=this.sizeCalculation,noUpdateTTL:y=this.noUpdateTTL,noDeleteOnFetchRejection:a=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:u=this.allowStaleOnFetchRejection,ignoreFetchAbort:g=this.ignoreFetchAbort,allowStaleOnFetchAbort:A=this.allowStaleOnFetchAbort,context:c,forceRefresh:w=!1,status:l,signal:S}=e;if(!this.#T)return l&&(l.fetch="get"),this.get(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,status:l});let m={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,ttl:h,noDisposeOnSet:f,size:r,sizeCalculation:p,noUpdateTTL:y,noDeleteOnFetchRejection:a,allowStaleOnFetchRejection:u,allowStaleOnFetchAbort:A,ignoreFetchAbort:g,status:l,signal:S},d=this.#n.get(t);if(d===void 0){l&&(l.fetch="miss");let _=this.#R(t,d,m,c);return _.__returned=_}else{let _=this.#t[d];if(this.#e(_)){let x=i&&_.__staleWhileFetching!==void 0;return l&&(l.fetch="inflight",x&&(l.returnedStale=!0)),x?_.__staleWhileFetching:_.__returned=_}let z=this.#u(d);if(!w&&!z)return l&&(l.fetch="hit"),this.#v(d),s&&this.#O(d),l&&this.#z(l,d),_;let b=this.#R(t,d,m,c),R=b.__staleWhileFetching!==void 0&&i;return l&&(l.fetch=z?"stale":"refresh",R&&z&&(l.returnedStale=!0)),R?b.__staleWhileFetching:b.__returned=b}}get(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:h}=e,f=this.#n.get(t);if(f!==void 0){let r=this.#t[f],p=this.#e(r);return h&&this.#z(h,f),this.#u(f)?(h&&(h.get="stale"),p?(h&&i&&r.__staleWhileFetching!==void 0&&(h.returnedStale=!0),i?r.__staleWhileFetching:void 0):(n||this.delete(t),h&&i&&(h.returnedStale=!0),i?r:void 0)):(h&&(h.get="hit"),p?r.__staleWhileFetching:(this.#v(f),s&&this.#O(f),r))}else h&&(h.get="miss")}#U(t,e){this.#c[e]=t,this.#l[t]=e}#v(t){t!==this.#h&&(t===this.#o?this.#o=this.#l[t]:this.#U(this.#c[t],this.#l[t]),this.#U(this.#h,t),this.#h=t)}delete(t){let e=!1;if(this.#s!==0){let i=this.#n.get(t);if(i!==void 0)if(e=!0,this.#s===1)this.clear();else{this.#E(i);let s=this.#t[i];this.#e(s)?s.__abortController.abort(new Error("deleted")):(this.#y||this.#a)&&(this.#y&&this.#_?.(s,t,"delete"),this.#a&&this.#r?.push([s,t,"delete"])),this.#n.delete(t),this.#i[i]=void 0,this.#t[i]=void 0,i===this.#h?this.#h=this.#c[i]:i===this.#o?this.#o=this.#l[i]:(this.#l[this.#c[i]]=this.#l[i],this.#c[this.#l[i]]=this.#c[i]),this.#s--,this.#w.push(i)}}if(this.#a&&this.#r?.length){let i=this.#r,s;for(;s=i?.shift();)this.#g?.(...s)}return e}clear(){for(let t of this.#b({allowStale:!0})){let e=this.#t[t];if(this.#e(e))e.__abortController.abort(new Error("deleted"));else{let i=this.#i[t];this.#y&&this.#_?.(e,i,"delete"),this.#a&&this.#r?.push([e,i,"delete"])}}if(this.#n.clear(),this.#t.fill(void 0),this.#i.fill(void 0),this.#S&&this.#A&&(this.#S.fill(0),this.#A.fill(0)),this.#F&&this.#F.fill(0),this.#o=0,this.#h=0,this.#w.length=0,this.#p=0,this.#s=0,this.#a&&this.#r){let t=this.#r,e;for(;e=t?.shift();)this.#g?.(...e)}}},V=W;export{W as LRUCache,V as default};
2
+ //# sourceMappingURL=index.min.js.map
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
@@ -1 +1 @@
1
- {"type":"commonjs","_lastModified":"2023-09-07T05:01:34.775Z"}
1
+ {"name":"lru-cache","description":"A cache object that deletes the least-recently-used items.","version":"8.0.5","author":"Isaac Z. Schlueter <i@izs.me>","keywords":["mru","lru","cache"],"sideEffects":false,"scripts":{"build":"npm run prepare","preprepare":"rm -rf dist","prepare":"tsc -p tsconfig.json && tsc -p tsconfig-esm.json","postprepare":"bash fixup.sh","pretest":"npm run prepare","presnap":"npm run prepare","test":"c8 tap","snap":"c8 tap","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags","format":"prettier --write .","typedoc":"typedoc --tsconfig tsconfig-esm.json ./src/*.ts","benchmark-results-typedoc":"bash scripts/benchmark-results-typedoc.sh","prebenchmark":"npm run prepare","benchmark":"make -C benchmark","preprofile":"npm run prepare","profile":"make -C benchmark profile"},"main":"./dist/cjs/index-cjs.js","module":"./dist/mjs/index.js","types":"./dist/mjs/index.d.ts","exports":{"./min":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.min.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index.min.js"}},".":{"import":{"types":"./dist/mjs/index.d.ts","default":"./dist/mjs/index.js"},"require":{"types":"./dist/cjs/index.d.ts","default":"./dist/cjs/index-cjs.js"}}},"repository":"git://github.com/isaacs/node-lru-cache.git","devDependencies":{"@size-limit/preset-small-lib":"^7.0.8","@types/node":"^17.0.31","@types/tap":"^15.0.6","benchmark":"^2.1.4","c8":"^7.11.2","clock-mock":"^1.0.6","esbuild":"^0.17.11","eslint-config-prettier":"^8.5.0","marked":"^4.2.12","mkdirp":"^2.1.5","prettier":"^2.6.2","size-limit":"^7.0.8","tap":"^16.3.4","ts-node":"^10.7.0","tslib":"^2.4.0","typedoc":"^0.23.24","typescript":"^4.6.4"},"license":"ISC","files":["dist"],"engines":{"node":">=16.14"},"prettier":{"semi":false,"printWidth":70,"tabWidth":2,"useTabs":false,"singleQuote":true,"jsxSingleQuote":false,"bracketSameLine":true,"arrowParens":"avoid","endOfLine":"lf"},"tap":{"coverage":false,"node-arg":["--expose-gc","--no-warnings","--loader","ts-node/esm"],"ts":false},"size-limit":[{"path":"./dist/mjs/index.js"}],"_lastModified":"2023-09-12T20:08:52.414Z"}
@@ -11,6 +11,7 @@ export default class WorkflowPlugin extends Plugin {
11
11
  instructions: Registry<Instruction>;
12
12
  triggers: Registry<Trigger>;
13
13
  functions: Registry<CustomFunction>;
14
+ private ready;
14
15
  private executing;
15
16
  private pending;
16
17
  private events;
@@ -48,7 +48,8 @@ class WorkflowPlugin extends import_server.Plugin {
48
48
  instructions = new import_utils.Registry();
49
49
  triggers = new import_utils.Registry();
50
50
  functions = new import_utils.Registry();
51
- executing = false;
51
+ ready = false;
52
+ executing = null;
52
53
  pending = [];
53
54
  events = [];
54
55
  loggerCache;
@@ -145,7 +146,7 @@ class WorkflowPlugin extends import_server.Plugin {
145
146
  directory: import_path.default.resolve(__dirname, "collections")
146
147
  });
147
148
  this.db.addMigrations({
148
- namespace: "workflow",
149
+ namespace: this.name,
149
150
  directory: import_path.default.resolve(__dirname, "migrations"),
150
151
  context: {
151
152
  plugin: this
@@ -165,6 +166,7 @@ class WorkflowPlugin extends import_server.Plugin {
165
166
  });
166
167
  this.app.on("afterStart", () => {
167
168
  this.app.setMaintainingMessage("check for not started executions");
169
+ this.ready = true;
168
170
  this.dispatch();
169
171
  });
170
172
  this.app.on("beforeStop", async () => {
@@ -175,6 +177,11 @@ class WorkflowPlugin extends import_server.Plugin {
175
177
  workflows.forEach((workflow) => {
176
178
  this.toggle(workflow, false);
177
179
  });
180
+ this.ready = false;
181
+ await this.prepare();
182
+ if (this.executing) {
183
+ await this.executing;
184
+ }
178
185
  });
179
186
  }
180
187
  toggle(workflow, enable) {
@@ -191,7 +198,7 @@ class WorkflowPlugin extends import_server.Plugin {
191
198
  }
192
199
  }
193
200
  trigger(workflow, context, options = {}) {
194
- if (context == null) {
201
+ if (!this.ready || context == null) {
195
202
  return;
196
203
  }
197
204
  this.events.push([workflow, context, options]);
@@ -269,35 +276,36 @@ class WorkflowPlugin extends import_server.Plugin {
269
276
  this.dispatch();
270
277
  }
271
278
  };
272
- async dispatch() {
273
- if (this.executing) {
279
+ dispatch() {
280
+ if (!this.ready || this.executing) {
274
281
  return;
275
282
  }
276
- this.executing = true;
277
- let next = null;
278
- if (this.pending.length) {
279
- next = this.pending.shift();
280
- this.getLogger(next[0].workflowId).info(`pending execution (${next[0].id}) ready to process`);
281
- } else {
282
- const execution = await this.db.getRepository("executions").findOne({
283
- filter: {
284
- status: import_constants.EXECUTION_STATUS.QUEUEING
285
- },
286
- appends: ["workflow"],
287
- sort: "createdAt"
288
- });
289
- if (execution && execution.workflow.enabled) {
290
- this.getLogger(execution.workflowId).info(`execution (${execution.id}) fetched from db`);
291
- next = [execution];
283
+ this.executing = (async () => {
284
+ let next = null;
285
+ if (this.pending.length) {
286
+ next = this.pending.shift();
287
+ this.getLogger(next[0].workflowId).info(`pending execution (${next[0].id}) ready to process`);
288
+ } else {
289
+ const execution = await this.db.getRepository("executions").findOne({
290
+ filter: {
291
+ status: import_constants.EXECUTION_STATUS.QUEUEING
292
+ },
293
+ appends: ["workflow"],
294
+ sort: "createdAt"
295
+ });
296
+ if (execution && execution.workflow.enabled) {
297
+ this.getLogger(execution.workflowId).info(`execution (${execution.id}) fetched from db`);
298
+ next = [execution];
299
+ }
292
300
  }
293
- }
294
- if (next) {
295
- await this.process(...next);
296
- }
297
- this.executing = false;
298
- if (next) {
299
- this.dispatch();
300
- }
301
+ if (next) {
302
+ await this.process(...next);
303
+ }
304
+ this.executing = null;
305
+ if (next) {
306
+ this.dispatch();
307
+ }
308
+ })();
301
309
  }
302
310
  async process(execution, job) {
303
311
  var _a, _b;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "工作流",
5
5
  "description": "A powerful workflow plugin designed to support business process management and automation.",
6
6
  "description.zh-CN": "工作流插件,为业务流程管理和自动化提供支持。",
7
- "version": "0.13.0-alpha.9",
7
+ "version": "0.14.0-alpha.2",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "devDependencies": {
@@ -42,5 +42,5 @@
42
42
  "@nocobase/test": "0.x",
43
43
  "@nocobase/utils": "0.x"
44
44
  },
45
- "gitHead": "ee5825377d8bec05f968a8365a0cdcd49878ada6"
45
+ "gitHead": "ea841d4a1e8c37aa77b4fbae6a6a4937e2aa3c0a"
46
46
  }
@@ -1 +0,0 @@
1
- (function(){"use strict";var t={29:function(t,e,i){var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const n=s(i(745));t.exports=Object.assign(n.default,{default:n.default,LRUCache:n.default})},745:function(t,e){Object.defineProperty(e,"__esModule",{value:true});e.LRUCache=void 0;const i=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date;const s=new Set;const emitWarning=(t,e,i,s)=>{typeof process==="object"&&process&&typeof process.emitWarning==="function"?process.emitWarning(t,e,i,s):console.error(`[${i}] ${e}: ${t}`)};const shouldWarn=t=>!s.has(t);const n=Symbol("type");const isPosInt=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t);const getUintArray=t=>!isPosInt(t)?null:t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?ZeroArray:null;class ZeroArray extends Array{constructor(t){super(t);this.fill(0)}}class Stack{heap;length;static#t=false;static create(t){const e=getUintArray(t);if(!e)return[];Stack.#t=true;const i=new Stack(t,e);Stack.#t=false;return i}constructor(t,e){if(!Stack.#t){throw new TypeError("instantiate Stack using Stack.create(n)")}this.heap=new e(t);this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class LRUCache{#e;#i;#s;#n;#h;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#o;#r;#l;#c;#f;#d;#u;#p;#g;#S;#y;#m;#z;#w;#_;#L;static unsafeExposeInternals(t){return{starts:t.#m,ttls:t.#z,sizes:t.#y,keyMap:t.#r,keyList:t.#l,valList:t.#c,next:t.#f,prev:t.#d,get head(){return t.#u},get tail(){return t.#p},free:t.#g,isBackgroundFetch:e=>t.#v(e),backgroundFetch:(e,i,s,n)=>t.#k(e,i,s,n),moveToTail:e=>t.#x(e),indexes:e=>t.#F(e),rindexes:e=>t.#A(e),isStale:e=>t.#T(e)}}get max(){return this.#e}get maxSize(){return this.#i}get calculatedSize(){return this.#o}get size(){return this.#a}get fetchMethod(){return this.#h}get dispose(){return this.#s}get disposeAfter(){return this.#n}constructor(t){const{max:e=0,ttl:i,ttlResolution:n=1,ttlAutopurge:h,updateAgeOnGet:a,updateAgeOnHas:o,allowStale:r,dispose:l,disposeAfter:c,noDisposeOnSet:f,noUpdateTTL:d,maxSize:u=0,maxEntrySize:p=0,sizeCalculation:g,fetchMethod:S,noDeleteOnFetchRejection:y,noDeleteOnStaleGet:m,allowStaleOnFetchRejection:z,allowStaleOnFetchAbort:w,ignoreFetchAbort:_}=t;if(e!==0&&!isPosInt(e)){throw new TypeError("max option must be a nonnegative integer")}const L=e?getUintArray(e):Array;if(!L){throw new Error("invalid max value: "+e)}this.#e=e;this.#i=u;this.maxEntrySize=p||this.#i;this.sizeCalculation=g;if(this.sizeCalculation){if(!this.#i&&!this.maxEntrySize){throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize")}if(typeof this.sizeCalculation!=="function"){throw new TypeError("sizeCalculation set to non-function")}}if(S!==undefined&&typeof S!=="function"){throw new TypeError("fetchMethod must be a function if specified")}this.#h=S;this.#_=!!S;this.#r=new Map;this.#l=new Array(e).fill(undefined);this.#c=new Array(e).fill(undefined);this.#f=new L(e);this.#d=new L(e);this.#u=0;this.#p=0;this.#g=Stack.create(e);this.#a=0;this.#o=0;if(typeof l==="function"){this.#s=l}if(typeof c==="function"){this.#n=c;this.#S=[]}else{this.#n=undefined;this.#S=undefined}this.#w=!!this.#s;this.#L=!!this.#n;this.noDisposeOnSet=!!f;this.noUpdateTTL=!!d;this.noDeleteOnFetchRejection=!!y;this.allowStaleOnFetchRejection=!!z;this.allowStaleOnFetchAbort=!!w;this.ignoreFetchAbort=!!_;if(this.maxEntrySize!==0){if(this.#i!==0){if(!isPosInt(this.#i)){throw new TypeError("maxSize must be a positive integer if specified")}}if(!isPosInt(this.maxEntrySize)){throw new TypeError("maxEntrySize must be a positive integer if specified")}this.#b()}this.allowStale=!!r;this.noDeleteOnStaleGet=!!m;this.updateAgeOnGet=!!a;this.updateAgeOnHas=!!o;this.ttlResolution=isPosInt(n)||n===0?n:1;this.ttlAutopurge=!!h;this.ttl=i||0;if(this.ttl){if(!isPosInt(this.ttl)){throw new TypeError("ttl must be a positive integer if specified")}this.#O()}if(this.#e===0&&this.ttl===0&&this.#i===0){throw new TypeError("At least one of max, maxSize, or ttl is required")}if(!this.ttlAutopurge&&!this.#e&&!this.#i){const t="LRU_CACHE_UNBOUNDED";if(shouldWarn(t)){s.add(t);const e="TTL caching without ttlAutopurge, max, or maxSize can "+"result in unbounded memory consumption.";emitWarning(e,"UnboundedCacheWarning",t,LRUCache)}}}getRemainingTTL(t){return this.#r.has(t)?Infinity:0}#O(){const t=new ZeroArray(this.#e);const e=new ZeroArray(this.#e);this.#z=t;this.#m=e;this.#D=(s,n,h=i.now())=>{e[s]=n!==0?h:0;t[s]=n;if(n!==0&&this.ttlAutopurge){const t=setTimeout((()=>{if(this.#T(s)){this.delete(this.#l[s])}}),n+1);if(t.unref){t.unref()}}};this.#E=s=>{e[s]=t[s]!==0?i.now():0};this.#M=(i,n)=>{if(t[n]){const h=t[n];const a=e[n];i.ttl=h;i.start=a;i.now=s||getNow();i.remainingTTL=i.now+h-a}};let s=0;const getNow=()=>{const t=i.now();if(this.ttlResolution>0){s=t;const e=setTimeout((()=>s=0),this.ttlResolution);if(e.unref){e.unref()}}return t};this.getRemainingTTL=i=>{const n=this.#r.get(i);if(n===undefined){return 0}return t[n]===0||e[n]===0?Infinity:e[n]+t[n]-(s||getNow())};this.#T=i=>t[i]!==0&&e[i]!==0&&(s||getNow())-e[i]>t[i]}#E=()=>{};#M=()=>{};#D=()=>{};#T=()=>false;#b(){const t=new ZeroArray(this.#e);this.#o=0;this.#y=t;this.#C=e=>{this.#o-=t[e];t[e]=0};this.#R=(t,e,i,s)=>{if(this.#v(e)){return 0}if(!isPosInt(i)){if(s){if(typeof s!=="function"){throw new TypeError("sizeCalculation must be a function")}i=s(e,t);if(!isPosInt(i)){throw new TypeError("sizeCalculation return invalid (expect positive integer)")}}else{throw new TypeError("invalid size value (must be positive integer). "+"When maxSize or maxEntrySize is used, sizeCalculation "+"or size must be set.")}}return i};this.#W=(e,i,s)=>{t[e]=i;if(this.#i){const i=this.#i-t[e];while(this.#o>i){this.#B(true)}}this.#o+=t[e];if(s){s.entrySize=i;s.totalCalculatedSize=this.#o}}}#C=t=>{};#W=(t,e,i)=>{};#R=(t,e,i,s)=>{if(i||s){throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache")}return 0};*#F({allowStale:t=this.allowStale}={}){if(this.#a){for(let e=this.#p;true;){if(!this.#I(e)){break}if(t||!this.#T(e)){yield e}if(e===this.#u){break}else{e=this.#d[e]}}}}*#A({allowStale:t=this.allowStale}={}){if(this.#a){for(let e=this.#u;true;){if(!this.#I(e)){break}if(t||!this.#T(e)){yield e}if(e===this.#p){break}else{e=this.#f[e]}}}}#I(t){return t!==undefined&&this.#r.get(this.#l[t])===t}*entries(){for(const t of this.#F()){if(this.#c[t]!==undefined&&this.#l[t]!==undefined&&!this.#v(this.#c[t])){yield[this.#l[t],this.#c[t]]}}}*rentries(){for(const t of this.#A()){if(this.#c[t]!==undefined&&this.#l[t]!==undefined&&!this.#v(this.#c[t])){yield[this.#l[t],this.#c[t]]}}}*keys(){for(const t of this.#F()){const e=this.#l[t];if(e!==undefined&&!this.#v(this.#c[t])){yield e}}}*rkeys(){for(const t of this.#A()){const e=this.#l[t];if(e!==undefined&&!this.#v(this.#c[t])){yield e}}}*values(){for(const t of this.#F()){const e=this.#c[t];if(e!==undefined&&!this.#v(this.#c[t])){yield this.#c[t]}}}*rvalues(){for(const t of this.#A()){const e=this.#c[t];if(e!==undefined&&!this.#v(this.#c[t])){yield this.#c[t]}}}[Symbol.iterator](){return this.entries()}find(t,e={}){for(const i of this.#F()){const s=this.#c[i];const n=this.#v(s)?s.__staleWhileFetching:s;if(n===undefined)continue;if(t(n,this.#l[i],this)){return this.get(this.#l[i],e)}}}forEach(t,e=this){for(const i of this.#F()){const s=this.#c[i];const n=this.#v(s)?s.__staleWhileFetching:s;if(n===undefined)continue;t.call(e,n,this.#l[i],this)}}rforEach(t,e=this){for(const i of this.#A()){const s=this.#c[i];const n=this.#v(s)?s.__staleWhileFetching:s;if(n===undefined)continue;t.call(e,n,this.#l[i],this)}}purgeStale(){let t=false;for(const e of this.#A({allowStale:true})){if(this.#T(e)){this.delete(this.#l[e]);t=true}}return t}dump(){const t=[];for(const e of this.#F({allowStale:true})){const s=this.#l[e];const n=this.#c[e];const h=this.#v(n)?n.__staleWhileFetching:n;if(h===undefined||s===undefined)continue;const a={value:h};if(this.#z&&this.#m){a.ttl=this.#z[e];const t=i.now()-this.#m[e];a.start=Math.floor(Date.now()-t)}if(this.#y){a.size=this.#y[e]}t.unshift([s,a])}return t}load(t){this.clear();for(const[e,s]of t){if(s.start){const t=Date.now()-s.start;s.start=i.now()-t}this.set(e,s.value,s)}}set(t,e,i={}){const{ttl:s=this.ttl,start:n,noDisposeOnSet:h=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:o}=i;let{noUpdateTTL:r=this.noUpdateTTL}=i;const l=this.#R(t,e,i.size||0,a);if(this.maxEntrySize&&l>this.maxEntrySize){if(o){o.set="miss";o.maxEntrySizeExceeded=true}this.delete(t);return this}let c=this.#a===0?undefined:this.#r.get(t);if(c===undefined){c=this.#a===0?this.#p:this.#g.length!==0?this.#g.pop():this.#a===this.#e?this.#B(false):this.#a;this.#l[c]=t;this.#c[c]=e;this.#r.set(t,c);this.#f[this.#p]=c;this.#d[c]=this.#p;this.#p=c;this.#a++;this.#W(c,l,o);if(o)o.set="add";r=false}else{this.#x(c);const i=this.#c[c];if(e!==i){if(this.#_&&this.#v(i)){i.__abortController.abort(new Error("replaced"))}else if(!h){if(this.#w){this.#s?.(i,t,"set")}if(this.#L){this.#S?.push([i,t,"set"])}}this.#C(c);this.#W(c,l,o);this.#c[c]=e;if(o){o.set="replace";const t=i&&this.#v(i)?i.__staleWhileFetching:i;if(t!==undefined)o.oldValue=t}}else if(o){o.set="update"}}if(s!==0&&!this.#z){this.#O()}if(this.#z){if(!r){this.#D(c,s,n)}if(o)this.#M(o,c)}if(!h&&this.#L&&this.#S){const t=this.#S;let e;while(e=t?.shift()){this.#n?.(...e)}}return this}pop(){try{while(this.#a){const t=this.#c[this.#u];this.#B(true);if(this.#v(t)){if(t.__staleWhileFetching){return t.__staleWhileFetching}}else if(t!==undefined){return t}}}finally{if(this.#L&&this.#S){const t=this.#S;let e;while(e=t?.shift()){this.#n?.(...e)}}}}#B(t){const e=this.#u;const i=this.#l[e];const s=this.#c[e];if(this.#_&&this.#v(s)){s.__abortController.abort(new Error("evicted"))}else if(this.#w||this.#L){if(this.#w){this.#s?.(s,i,"evict")}if(this.#L){this.#S?.push([s,i,"evict"])}}this.#C(e);if(t){this.#l[e]=undefined;this.#c[e]=undefined;this.#g.push(e)}if(this.#a===1){this.#u=this.#p=0;this.#g.length=0}else{this.#u=this.#f[e]}this.#r.delete(i);this.#a--;return e}has(t,e={}){const{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=e;const n=this.#r.get(t);if(n!==undefined){const t=this.#c[n];if(this.#v(t)&&t.__staleWhileFetching===undefined){return false}if(!this.#T(n)){if(i){this.#E(n)}if(s){s.has="hit";this.#M(s,n)}return true}else if(s){s.has="stale";this.#M(s,n)}}else if(s){s.has="miss"}return false}peek(t,e={}){const{allowStale:i=this.allowStale}=e;const s=this.#r.get(t);if(s!==undefined&&(i||!this.#T(s))){const t=this.#c[s];return this.#v(t)?t.__staleWhileFetching:t}}#k(t,e,i,s){const n=e===undefined?undefined:this.#c[e];if(this.#v(n)){return n}const h=new AbortController;const{signal:a}=i;a?.addEventListener("abort",(()=>h.abort(a.reason)),{signal:h.signal});const o={signal:h.signal,options:i,context:s};const cb=(s,n=false)=>{const{aborted:a}=h.signal;const l=i.ignoreFetchAbort&&s!==undefined;if(i.status){if(a&&!n){i.status.fetchAborted=true;i.status.fetchError=h.signal.reason;if(l)i.status.fetchAbortIgnored=true}else{i.status.fetchResolved=true}}if(a&&!l&&!n){return fetchFail(h.signal.reason)}const c=r;if(this.#c[e]===r){if(s===undefined){if(c.__staleWhileFetching){this.#c[e]=c.__staleWhileFetching}else{this.delete(t)}}else{if(i.status)i.status.fetchUpdated=true;this.set(t,s,o.options)}}return s};const eb=t=>{if(i.status){i.status.fetchRejected=true;i.status.fetchError=t}return fetchFail(t)};const fetchFail=s=>{const{aborted:n}=h.signal;const a=n&&i.allowStaleOnFetchAbort;const o=a||i.allowStaleOnFetchRejection;const l=o||i.noDeleteOnFetchRejection;const c=r;if(this.#c[e]===r){const i=!l||c.__staleWhileFetching===undefined;if(i){this.delete(t)}else if(!a){this.#c[e]=c.__staleWhileFetching}}if(o){if(i.status&&c.__staleWhileFetching!==undefined){i.status.returnedStale=true}return c.__staleWhileFetching}else if(c.__returned===c){throw s}};const pcall=(e,s)=>{const a=this.#h?.(t,n,o);if(a&&a instanceof Promise){a.then((t=>e(t)),s)}h.signal.addEventListener("abort",(()=>{if(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort){e();if(i.allowStaleOnFetchAbort){e=t=>cb(t,true)}}}))};if(i.status)i.status.fetchDispatched=true;const r=new Promise(pcall).then(cb,eb);const l=Object.assign(r,{__abortController:h,__staleWhileFetching:n,__returned:undefined});if(e===undefined){this.set(t,l,{...o.options,status:undefined});e=this.#r.get(t)}else{this.#c[e]=l}return l}#v(t){if(!this.#_)return false;const e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof AbortController}async fetch(t,e={}){const{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:h=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:o=0,sizeCalculation:r=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:u=this.allowStaleOnFetchAbort,context:p,forceRefresh:g=false,status:S,signal:y}=e;if(!this.#_){if(S)S.fetch="get";return this.get(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,status:S})}const m={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,ttl:h,noDisposeOnSet:a,size:o,sizeCalculation:r,noUpdateTTL:l,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:u,ignoreFetchAbort:d,status:S,signal:y};let z=this.#r.get(t);if(z===undefined){if(S)S.fetch="miss";const e=this.#k(t,z,m,p);return e.__returned=e}else{const e=this.#c[z];if(this.#v(e)){const t=i&&e.__staleWhileFetching!==undefined;if(S){S.fetch="inflight";if(t)S.returnedStale=true}return t?e.__staleWhileFetching:e.__returned=e}const n=this.#T(z);if(!g&&!n){if(S)S.fetch="hit";this.#x(z);if(s){this.#E(z)}if(S)this.#M(S,z);return e}const h=this.#k(t,z,m,p);const a=h.__staleWhileFetching!==undefined;const o=a&&i;if(S){S.fetch=n?"stale":"refresh";if(o&&n)S.returnedStale=true}return o?h.__staleWhileFetching:h.__returned=h}}get(t,e={}){const{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:h}=e;const a=this.#r.get(t);if(a!==undefined){const e=this.#c[a];const o=this.#v(e);if(h)this.#M(h,a);if(this.#T(a)){if(h)h.get="stale";if(!o){if(!n){this.delete(t)}if(h&&i)h.returnedStale=true;return i?e:undefined}else{if(h&&i&&e.__staleWhileFetching!==undefined){h.returnedStale=true}return i?e.__staleWhileFetching:undefined}}else{if(h)h.get="hit";if(o){return e.__staleWhileFetching}this.#x(a);if(s){this.#E(a)}return e}}else if(h){h.get="miss"}}#U(t,e){this.#d[e]=t;this.#f[t]=e}#x(t){if(t!==this.#p){if(t===this.#u){this.#u=this.#f[t]}else{this.#U(this.#d[t],this.#f[t])}this.#U(this.#p,t);this.#p=t}}delete(t){let e=false;if(this.#a!==0){const i=this.#r.get(t);if(i!==undefined){e=true;if(this.#a===1){this.clear()}else{this.#C(i);const e=this.#c[i];if(this.#v(e)){e.__abortController.abort(new Error("deleted"))}else if(this.#w||this.#L){if(this.#w){this.#s?.(e,t,"delete")}if(this.#L){this.#S?.push([e,t,"delete"])}}this.#r.delete(t);this.#l[i]=undefined;this.#c[i]=undefined;if(i===this.#p){this.#p=this.#d[i]}else if(i===this.#u){this.#u=this.#f[i]}else{this.#f[this.#d[i]]=this.#f[i];this.#d[this.#f[i]]=this.#d[i]}this.#a--;this.#g.push(i)}}}if(this.#L&&this.#S?.length){const t=this.#S;let e;while(e=t?.shift()){this.#n?.(...e)}}return e}clear(){for(const t of this.#A({allowStale:true})){const e=this.#c[t];if(this.#v(e)){e.__abortController.abort(new Error("deleted"))}else{const i=this.#l[t];if(this.#w){this.#s?.(e,i,"delete")}if(this.#L){this.#S?.push([e,i,"delete"])}}}this.#r.clear();this.#c.fill(undefined);this.#l.fill(undefined);if(this.#z&&this.#m){this.#z.fill(0);this.#m.fill(0)}if(this.#y){this.#y.fill(0)}this.#u=0;this.#p=0;this.#g.length=0;this.#o=0;this.#a=0;if(this.#L&&this.#S){const t=this.#S;let e;while(e=t?.shift()){this.#n?.(...e)}}}}e.LRUCache=LRUCache;e["default"]=LRUCache}};var e={};function __nccwpck_require__(i){var s=e[i];if(s!==undefined){return s.exports}var n=e[i]={exports:{}};var h=true;try{t[i].call(n.exports,n,n.exports,__nccwpck_require__);h=false}finally{if(h)delete e[i]}return n.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var i=__nccwpck_require__(29);module.exports=i})();