@nocobase/plugin-workflow 2.1.0-beta.2 → 2.1.0-beta.20
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.
- package/LICENSE +201 -661
- package/README.md +79 -10
- package/dist/client/214.7e602cfe7a8251b8.js +10 -0
- package/dist/client/261.7722d7400942730e.js +10 -0
- package/dist/client/67.f904ef4520868b8a.js +10 -0
- package/dist/client/964.6251d37b35710747.js +10 -0
- package/dist/client/hooks/{useWorkflowFilterActionProps.d.ts → useResourceFilterActionProps.d.ts} +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/nodes/create.d.ts +10 -0
- package/dist/client/nodes/destroy.d.ts +10 -0
- package/dist/client/nodes/index.d.ts +3 -0
- package/dist/client/nodes/query.d.ts +18 -2
- package/dist/client/nodes/update.d.ts +10 -0
- package/dist/client/schemas/collection.d.ts +8 -2
- package/dist/client/schemas/executions.d.ts +41 -23
- package/dist/client/triggers/collection.d.ts +14 -1
- package/dist/client/triggers/index.d.ts +4 -0
- package/dist/client/triggers/schedule/constants.d.ts +4 -0
- package/dist/client/triggers/schedule/index.d.ts +15 -0
- package/dist/common/collections/executions.d.ts +22 -22
- package/dist/common/collections/executions.js +12 -0
- package/dist/common/collections/jobs.js +7 -0
- package/dist/common/collections/workflows.d.ts +22 -9
- package/dist/common/collections/workflows.js +9 -1
- package/dist/externalVersion.js +15 -13
- package/dist/locale/zh-CN.json +4 -1
- package/dist/node_modules/cron-parser/lib/parser.js +1 -1
- package/dist/node_modules/cron-parser/package.json +1 -1
- package/dist/node_modules/joi/dist/joi-browser.min.js +1 -0
- package/dist/node_modules/joi/lib/annotate.js +175 -0
- package/dist/node_modules/joi/lib/base.js +1069 -0
- package/dist/node_modules/joi/lib/cache.js +143 -0
- package/dist/node_modules/joi/lib/common.js +216 -0
- package/dist/node_modules/joi/lib/compile.js +283 -0
- package/dist/node_modules/joi/lib/errors.js +271 -0
- package/dist/node_modules/joi/lib/extend.js +312 -0
- package/dist/node_modules/joi/lib/index.d.ts +2365 -0
- package/dist/node_modules/joi/lib/index.js +1 -0
- package/dist/node_modules/joi/lib/manifest.js +476 -0
- package/dist/node_modules/joi/lib/messages.js +178 -0
- package/dist/node_modules/joi/lib/modify.js +267 -0
- package/dist/node_modules/joi/lib/ref.js +414 -0
- package/dist/node_modules/joi/lib/schemas.js +302 -0
- package/dist/node_modules/joi/lib/state.js +166 -0
- package/dist/node_modules/joi/lib/template.js +463 -0
- package/dist/node_modules/joi/lib/trace.js +346 -0
- package/dist/node_modules/joi/lib/types/alternatives.js +364 -0
- package/dist/node_modules/joi/lib/types/any.js +174 -0
- package/dist/node_modules/joi/lib/types/array.js +809 -0
- package/dist/node_modules/joi/lib/types/binary.js +100 -0
- package/dist/node_modules/joi/lib/types/boolean.js +150 -0
- package/dist/node_modules/joi/lib/types/date.js +233 -0
- package/dist/node_modules/joi/lib/types/function.js +93 -0
- package/dist/node_modules/joi/lib/types/keys.js +1067 -0
- package/dist/node_modules/joi/lib/types/link.js +168 -0
- package/dist/node_modules/joi/lib/types/number.js +363 -0
- package/dist/node_modules/joi/lib/types/object.js +22 -0
- package/dist/node_modules/joi/lib/types/string.js +850 -0
- package/dist/node_modules/joi/lib/types/symbol.js +102 -0
- package/dist/node_modules/joi/lib/validator.js +750 -0
- package/dist/node_modules/joi/lib/values.js +263 -0
- package/dist/node_modules/joi/node_modules/@hapi/topo/lib/index.d.ts +60 -0
- package/dist/node_modules/joi/node_modules/@hapi/topo/lib/index.js +225 -0
- package/dist/node_modules/joi/node_modules/@hapi/topo/package.json +30 -0
- package/dist/node_modules/joi/package.json +1 -0
- package/dist/node_modules/lru-cache/dist/commonjs/diagnostics-channel.d.ts +5 -0
- package/dist/node_modules/lru-cache/dist/commonjs/diagnostics-channel.js +10 -0
- package/dist/node_modules/lru-cache/dist/commonjs/index.d.ts +1381 -0
- package/dist/node_modules/lru-cache/dist/commonjs/index.js +1692 -0
- package/dist/node_modules/lru-cache/dist/commonjs/index.min.js +1 -0
- package/dist/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.d.ts +5 -0
- package/dist/node_modules/lru-cache/dist/esm/browser/diagnostics-channel.js +4 -0
- package/dist/node_modules/lru-cache/dist/esm/browser/index.d.ts +1381 -0
- package/dist/node_modules/lru-cache/dist/{mjs → esm/browser}/index.js +537 -179
- package/dist/node_modules/lru-cache/dist/esm/browser/index.min.js +2 -0
- package/dist/node_modules/lru-cache/dist/esm/diagnostics-channel.d.ts +5 -0
- package/dist/node_modules/lru-cache/dist/esm/diagnostics-channel.js +19 -0
- package/dist/node_modules/lru-cache/dist/esm/index.d.ts +1381 -0
- package/dist/node_modules/lru-cache/dist/{cjs → esm}/index.js +538 -184
- package/dist/node_modules/lru-cache/dist/esm/index.min.js +2 -0
- package/dist/node_modules/lru-cache/dist/esm/node/diagnostics-channel.d.ts +5 -0
- package/dist/node_modules/lru-cache/dist/esm/node/diagnostics-channel.js +7 -0
- package/dist/node_modules/lru-cache/dist/esm/node/index.d.ts +1381 -0
- package/dist/node_modules/lru-cache/dist/esm/node/index.js +1688 -0
- package/dist/node_modules/lru-cache/dist/esm/node/index.min.js +2 -0
- package/dist/node_modules/lru-cache/package.json +1 -1
- package/dist/node_modules/nodejs-snowflake/nodejs_snowflake.js +1 -1
- package/dist/node_modules/nodejs-snowflake/package.json +1 -1
- package/dist/server/Dispatcher.d.ts +3 -2
- package/dist/server/Dispatcher.js +74 -61
- package/dist/server/Plugin.d.ts +1 -0
- package/dist/server/Plugin.js +28 -3
- package/dist/server/actions/nodes.d.ts +5 -0
- package/dist/server/actions/nodes.js +38 -5
- package/dist/server/actions/workflows.d.ts +6 -0
- package/dist/server/actions/workflows.js +38 -0
- package/dist/server/instructions/ConditionInstruction.d.ts +2 -0
- package/dist/server/instructions/ConditionInstruction.js +17 -0
- package/dist/server/instructions/CreateInstruction.d.ts +3 -0
- package/dist/server/instructions/CreateInstruction.js +25 -0
- package/dist/server/instructions/DestroyInstruction.d.ts +3 -0
- package/dist/server/instructions/DestroyInstruction.js +25 -0
- package/dist/server/instructions/EndInstruction.d.ts +2 -0
- package/dist/server/instructions/EndInstruction.js +4 -0
- package/dist/server/instructions/MultiConditionsInstruction.d.ts +2 -0
- package/dist/server/instructions/MultiConditionsInstruction.js +23 -0
- package/dist/server/instructions/OutputInstruction.d.ts +2 -0
- package/dist/server/instructions/OutputInstruction.js +14 -0
- package/dist/server/instructions/QueryInstruction.d.ts +3 -0
- package/dist/server/instructions/QueryInstruction.js +32 -7
- package/dist/server/instructions/UpdateInstruction.d.ts +3 -0
- package/dist/server/instructions/UpdateInstruction.js +27 -0
- package/dist/server/instructions/index.d.ts +15 -2
- package/dist/server/instructions/index.js +18 -0
- package/dist/server/triggers/CollectionTrigger.d.ts +3 -0
- package/dist/server/triggers/CollectionTrigger.js +28 -0
- package/dist/server/triggers/ScheduleTrigger/index.d.ts +3 -0
- package/dist/server/triggers/ScheduleTrigger/index.js +18 -3
- package/dist/server/triggers/index.d.ts +3 -0
- package/dist/server/triggers/index.js +18 -0
- package/dist/server/utils.d.ts +17 -0
- package/dist/server/utils.js +51 -2
- package/dist/swagger/index.d.ts +830 -109
- package/dist/swagger/index.js +947 -208
- package/package.json +6 -5
- package/dist/client/27bd65abee87cafa.js +0 -10
- package/dist/client/478692c1637f2742.js +0 -10
- package/dist/client/c1347b9d21f864d9.js +0 -10
- package/dist/client/f39e94207f92e352.js +0 -10
- package/dist/node_modules/lru-cache/LICENSE +0 -15
- package/dist/node_modules/lru-cache/dist/cjs/index-cjs.d.ts +0 -7
- package/dist/node_modules/lru-cache/dist/cjs/index-cjs.js +0 -1
- package/dist/node_modules/lru-cache/dist/cjs/index.d.ts +0 -807
- package/dist/node_modules/lru-cache/dist/cjs/index.min.js +0 -2
- package/dist/node_modules/lru-cache/dist/mjs/index.d.ts +0 -807
- package/dist/node_modules/lru-cache/dist/mjs/index.min.js +0 -2
- /package/dist/node_modules/lru-cache/dist/{cjs → commonjs}/package.json +0 -0
- /package/dist/node_modules/lru-cache/dist/{mjs → esm}/package.json +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{"use strict";var t={714:t=>{t.exports=require("node:diagnostics_channel")}};var e={};function __nccwpck_require__(i){var s=e[i];if(s!==undefined){return s.exports}var h=e[i]={exports:{}};var r=true;try{t[i](h,h.exports,__nccwpck_require__);r=false}finally{if(r)delete e[i]}return h.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var i={};(()=>{var t=i;var G=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var e=G((t=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.tracing=t.metrics=void 0;var e=__nccwpck_require__(714);t.metrics=(0,e.channel)("lru-cache:metrics");t.tracing=(0,e.tracingChannel)("lru-cache")}));Object.defineProperty(t,"__esModule",{value:!0});t.LRUCache=void 0;var s=e(),D=()=>s.metrics.hasSubscribers||s.tracing.hasSubscribers,h=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,r=new Set,l=typeof process=="object"&&process?process:{},H=(t,e,i,s)=>{typeof l.emitWarning=="function"?l.emitWarning(t,e,i,s):console.error(`[${i}] ${e}: ${t}`)},N=t=>!r.has(t),n=Symbol("type"),F=t=>!!t&&t===Math.floor(t)&&t>0&&isFinite(t),I=t=>F(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?u:null:null,u=class extends Array{constructor(t){super(t),this.fill(0)}},g=class c{heap;length;static#t=!1;static create(t){let e=I(t);if(!e)return[];c.#t=!0;let i=new c(t,e);return c.#t=!1,i}constructor(t,e){if(!c.#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]}},v=class c{#t;#e;#i;#s;#h;#r;#o;#l;get perf(){return this.#l}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#n;#a;#u;#c;#f;#d;#p;#g;#v;#m;#w;#_;#S;#b;#y;#F;#A;#O;#x;static unsafeExposeInternals(t){return{starts:t.#S,ttls:t.#b,autopurgeTimers:t.#y,sizes:t.#_,keyMap:t.#u,keyList:t.#c,valList:t.#f,next:t.#d,prev:t.#p,get head(){return t.#g},get tail(){return t.#v},free:t.#m,isBackgroundFetch:e=>t.#T(e),backgroundFetch:(e,i,s,h)=>t.#z(e,i,s,h),moveToTail:e=>t.#E(e),indexes:e=>t.#R(e),rindexes:e=>t.#C(e),isStale:e=>t.#D(e)}}get max(){return this.#t}get maxSize(){return this.#e}get calculatedSize(){return this.#a}get size(){return this.#n}get fetchMethod(){return this.#r}get memoMethod(){return this.#o}get dispose(){return this.#i}get onInsert(){return this.#s}get disposeAfter(){return this.#h}constructor(t){let{max:e=0,ttl:i,ttlResolution:s=1,ttlAutopurge:l,updateAgeOnGet:n,updateAgeOnHas:u,allowStale:v,dispose:m,onInsert:w,disposeAfter:_,noDisposeOnSet:S,noUpdateTTL:b,maxSize:y=0,maxEntrySize:A=0,sizeCalculation:O,fetchMethod:x,memoMethod:T,noDeleteOnFetchRejection:z,noDeleteOnStaleGet:E,allowStaleOnFetchRejection:R,allowStaleOnFetchAbort:C,ignoreFetchAbort:W,perf:k}=t;if(k!==void 0&&typeof k?.now!="function")throw new TypeError("perf option must have a now() method if specified");if(this.#l=k??h,e!==0&&!F(e))throw new TypeError("max option must be a nonnegative integer");let L=e?I(e):Array;if(!L)throw new Error("invalid max value: "+e);if(this.#t=e,this.#e=y,this.maxEntrySize=A||this.#e,this.sizeCalculation=O,this.sizeCalculation){if(!this.#e&&!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(T!==void 0&&typeof T!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#o=T,x!==void 0&&typeof x!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#r=x,this.#A=!!x,this.#u=new Map,this.#c=Array.from({length:e}).fill(void 0),this.#f=Array.from({length:e}).fill(void 0),this.#d=new L(e),this.#p=new L(e),this.#g=0,this.#v=0,this.#m=g.create(e),this.#n=0,this.#a=0,typeof m=="function"&&(this.#i=m),typeof w=="function"&&(this.#s=w),typeof _=="function"?(this.#h=_,this.#w=[]):(this.#h=void 0,this.#w=void 0),this.#F=!!this.#i,this.#x=!!this.#s,this.#O=!!this.#h,this.noDisposeOnSet=!!S,this.noUpdateTTL=!!b,this.noDeleteOnFetchRejection=!!z,this.allowStaleOnFetchRejection=!!R,this.allowStaleOnFetchAbort=!!C,this.ignoreFetchAbort=!!W,this.maxEntrySize!==0){if(this.#e!==0&&!F(this.#e))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.#W()}if(this.allowStale=!!v,this.noDeleteOnStaleGet=!!E,this.updateAgeOnGet=!!n,this.updateAgeOnHas=!!u,this.ttlResolution=F(s)||s===0?s:1,this.ttlAutopurge=!!l,this.ttl=i||0,this.ttl){if(!F(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#k()}if(this.#t===0&&this.ttl===0&&this.#e===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#t&&!this.#e){let t="LRU_CACHE_UNBOUNDED";N(t)&&(r.add(t),H("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",t,c))}}getRemainingTTL(t){return this.#u.has(t)?1/0:0}#k(){let t=new u(this.#t),e=new u(this.#t);this.#b=t,this.#S=e;let i=this.ttlAutopurge?Array.from({length:this.#t}):void 0;this.#y=i,this.#L=(i,h,r=this.#l.now())=>{e[i]=h!==0?r:0,t[i]=h,s(i,h)},this.#j=i=>{e[i]=t[i]!==0?this.#l.now():0,s(i,t[i])};let s=this.ttlAutopurge?(t,e)=>{if(i?.[t]&&(clearTimeout(i[t]),i[t]=void 0),e&&e!==0&&i){let s=setTimeout((()=>{this.#D(t)&&this.#G(this.#c[t],"expire")}),e+1);s.unref&&s.unref(),i[t]=s}}:()=>{};this.#U=(i,s)=>{if(t[s]){let r=t[s],l=e[s];if(!r||!l)return;i.ttl=r,i.start=l,i.now=h||o();let n=i.now-l;i.remainingTTL=r-n}};let h=0,o=()=>{let t=this.#l.now();if(this.ttlResolution>0){h=t;let e=setTimeout((()=>h=0),this.ttlResolution);e.unref&&e.unref()}return t};this.getRemainingTTL=i=>{let s=this.#u.get(i);if(s===void 0)return 0;let r=t[s],l=e[s];if(!r||!l)return 1/0;let n=(h||o())-l;return r-n},this.#D=i=>{let s=e[i],r=t[i];return!!r&&!!s&&(h||o())-s>r}}#j=()=>{};#U=()=>{};#L=()=>{};#D=()=>!1;#W(){let t=new u(this.#t);this.#a=0,this.#_=t,this.#M=e=>{this.#a-=t[e],t[e]=0},this.#P=(t,e,i,s)=>{if(this.#T(e))return 0;if(!F(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(e,t),!F(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.#q=(e,i,s)=>{if(t[e]=i,this.#e){let i=this.#e-t[e];for(;this.#a>i;)this.#I(!0)}this.#a+=t[e],s&&(s.entrySize=i,s.totalCalculatedSize=this.#a)}}#M=t=>{};#q=(t,e,i)=>{};#P=(t,e,i,s)=>{if(i||s)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#R({allowStale:t=this.allowStale}={}){if(this.#n)for(let e=this.#v;this.#H(e)&&((t||!this.#D(e))&&(yield e),e!==this.#g);)e=this.#p[e]}*#C({allowStale:t=this.allowStale}={}){if(this.#n)for(let e=this.#g;this.#H(e)&&((t||!this.#D(e))&&(yield e),e!==this.#v);)e=this.#d[e]}#H(t){return t!==void 0&&this.#u.get(this.#c[t])===t}*entries(){for(let t of this.#R())this.#f[t]!==void 0&&this.#c[t]!==void 0&&!this.#T(this.#f[t])&&(yield[this.#c[t],this.#f[t]])}*rentries(){for(let t of this.#C())this.#f[t]!==void 0&&this.#c[t]!==void 0&&!this.#T(this.#f[t])&&(yield[this.#c[t],this.#f[t]])}*keys(){for(let t of this.#R()){let e=this.#c[t];e!==void 0&&!this.#T(this.#f[t])&&(yield e)}}*rkeys(){for(let t of this.#C()){let e=this.#c[t];e!==void 0&&!this.#T(this.#f[t])&&(yield e)}}*values(){for(let t of this.#R())this.#f[t]!==void 0&&!this.#T(this.#f[t])&&(yield this.#f[t])}*rvalues(){for(let t of this.#C())this.#f[t]!==void 0&&!this.#T(this.#f[t])&&(yield this.#f[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,e={}){for(let i of this.#R()){let s=this.#f[i],h=this.#T(s)?s.__staleWhileFetching:s;if(h!==void 0&&t(h,this.#c[i],this))return this.#N(this.#c[i],e)}}forEach(t,e=this){for(let i of this.#R()){let s=this.#f[i],h=this.#T(s)?s.__staleWhileFetching:s;h!==void 0&&t.call(e,h,this.#c[i],this)}}rforEach(t,e=this){for(let i of this.#C()){let s=this.#f[i],h=this.#T(s)?s.__staleWhileFetching:s;h!==void 0&&t.call(e,h,this.#c[i],this)}}purgeStale(){let t=!1;for(let e of this.#C({allowStale:!0}))this.#D(e)&&(this.#G(this.#c[e],"expire"),t=!0);return t}info(t){let e=this.#u.get(t);if(e===void 0)return;let i=this.#f[e],s=this.#T(i)?i.__staleWhileFetching:i;if(s===void 0)return;let h={value:s};if(this.#b&&this.#S){let t=this.#b[e],i=this.#S[e];if(t&&i){let e=t-(this.#l.now()-i);h.ttl=e,h.start=Date.now()}}return this.#_&&(h.size=this.#_[e]),h}dump(){let t=[];for(let e of this.#R({allowStale:!0})){let i=this.#c[e],s=this.#f[e],h=this.#T(s)?s.__staleWhileFetching:s;if(h===void 0||i===void 0)continue;let r={value:h};if(this.#b&&this.#S){r.ttl=this.#b[e];let t=this.#l.now()-this.#S[e];r.start=Math.floor(Date.now()-t)}this.#_&&(r.size=this.#_[e]),t.unshift([i,r])}return t}load(t){this.clear();for(let[e,i]of t){if(i.start){let t=Date.now()-i.start;i.start=this.#l.now()-t}this.#$(e,i.value,i)}}set(t,e,i={}){let{status:h=(s.metrics.hasSubscribers?{}:void 0)}=i;i.status=h,h&&(h.op="set",h.key=t,e!==void 0&&(h.value=e));let r=this.#$(t,e,i);return h&&s.metrics.hasSubscribers&&s.metrics.publish(h),r}#$(t,e,i={}){let{ttl:s=this.ttl,start:h,noDisposeOnSet:r=this.noDisposeOnSet,sizeCalculation:l=this.sizeCalculation,status:n}=i;if(e===void 0)return n&&(n.set="deleted"),this.delete(t),this;let{noUpdateTTL:u=this.noUpdateTTL}=i;n&&!this.#T(e)&&(n.value=e);let g=this.#P(t,e,i.size||0,l,n);if(this.maxEntrySize&&g>this.maxEntrySize)return this.#G(t,"set"),n&&(n.set="miss",n.maxEntrySizeExceeded=!0),this;let v=this.#n===0?void 0:this.#u.get(t);if(v===void 0)v=this.#n===0?this.#v:this.#m.length!==0?this.#m.pop():this.#n===this.#t?this.#I(!1):this.#n,this.#c[v]=t,this.#f[v]=e,this.#u.set(t,v),this.#d[this.#v]=v,this.#p[v]=this.#v,this.#v=v,this.#n++,this.#q(v,g,n),n&&(n.set="add"),u=!1,this.#x&&this.#s?.(e,t,"add");else{this.#E(v);let i=this.#f[v];if(e!==i){if(this.#A&&this.#T(i)){i.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:e}=i;e!==void 0&&!r&&(this.#F&&this.#i?.(e,t,"set"),this.#O&&this.#w?.push([e,t,"set"]))}else r||(this.#F&&this.#i?.(i,t,"set"),this.#O&&this.#w?.push([i,t,"set"]));if(this.#M(v),this.#q(v,g,n),this.#f[v]=e,n){n.set="replace";let t=i&&this.#T(i)?i.__staleWhileFetching:i;t!==void 0&&(n.oldValue=t)}}else n&&(n.set="update");this.#x&&this.onInsert?.(e,t,e===i?"update":"replace")}if(s!==0&&!this.#b&&this.#k(),this.#b&&(u||this.#L(v,s,h),n&&this.#U(n,v)),!r&&this.#O&&this.#w){let t=this.#w,e;for(;e=t?.shift();)this.#h?.(...e)}return this}pop(){try{for(;this.#n;){let t=this.#f[this.#g];if(this.#I(!0),this.#T(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#O&&this.#w){let t=this.#w,e;for(;e=t?.shift();)this.#h?.(...e)}}}#I(t){let e=this.#g,i=this.#c[e],s=this.#f[e];return this.#A&&this.#T(s)?s.__abortController.abort(new Error("evicted")):(this.#F||this.#O)&&(this.#F&&this.#i?.(s,i,"evict"),this.#O&&this.#w?.push([s,i,"evict"])),this.#M(e),this.#y?.[e]&&(clearTimeout(this.#y[e]),this.#y[e]=void 0),t&&(this.#c[e]=void 0,this.#f[e]=void 0,this.#m.push(e)),this.#n===1?(this.#g=this.#v=0,this.#m.length=0):this.#g=this.#d[e],this.#u.delete(i),this.#n--,e}has(t,e={}){let{status:i=(s.metrics.hasSubscribers?{}:void 0)}=e;e.status=i,i&&(i.op="has",i.key=t);let h=this.#B(t,e);return s.metrics.hasSubscribers&&s.metrics.publish(i),h}#B(t,e={}){let{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=e,h=this.#u.get(t);if(h!==void 0){let t=this.#f[h];if(this.#T(t)&&t.__staleWhileFetching===void 0)return!1;if(this.#D(h))s&&(s.has="stale",this.#U(s,h));else return i&&this.#j(h),s&&(s.has="hit",this.#U(s,h)),!0}else s&&(s.has="miss");return!1}peek(t,e={}){let{status:i=(D()?{}:void 0)}=e;i&&(i.op="peek",i.key=t),e.status=i;let h=this.#V(t,e);return s.metrics.hasSubscribers&&s.metrics.publish(i),h}#V(t,e){let{status:i,allowStale:s=this.allowStale}=e,h=this.#u.get(t);if(h===void 0||!s&&this.#D(h)){i&&(i.peek=h===void 0?"miss":"stale");return}let r=this.#f[h],l=this.#T(r)?r.__staleWhileFetching:r;return i&&(l!==void 0?(i.peek="hit",i.value=l):i.peek="miss"),l}#z(t,e,i,s){let h=e===void 0?void 0:this.#f[e];if(this.#T(h))return h;let r=new AbortController,{signal:l}=i;l?.addEventListener("abort",(()=>r.abort(l.reason)),{signal:r.signal});let n={signal:r.signal,options:i,context:s},a=(s,h=!1)=>{let{aborted:l}=r.signal,g=i.ignoreFetchAbort&&s!==void 0,v=i.ignoreFetchAbort||!!(i.allowStaleOnFetchAbort&&s!==void 0);if(i.status&&(l&&!h?(i.status.fetchAborted=!0,i.status.fetchError=r.signal.reason,g&&(i.status.fetchAbortIgnored=!0)):i.status.fetchResolved=!0),l&&!g&&!h)return f(r.signal.reason,v);let m=u,w=this.#f[e];return(w===u||w===void 0&&g&&h)&&(s===void 0?m.__staleWhileFetching!==void 0?this.#f[e]=m.__staleWhileFetching:this.#G(t,"fetch"):(i.status&&(i.status.fetchUpdated=!0),this.#$(t,s,n.options))),s},d=t=>(i.status&&(i.status.fetchRejected=!0,i.status.fetchError=t),f(t,!1)),f=(s,h)=>{let{aborted:l}=r.signal,n=l&&i.allowStaleOnFetchAbort,g=n||i.allowStaleOnFetchRejection,v=g||i.noDeleteOnFetchRejection,m=u;if(this.#f[e]===u&&(!v||!h&&m.__staleWhileFetching===void 0?this.#G(t,"fetch"):n||(this.#f[e]=m.__staleWhileFetching)),g)return i.status&&m.__staleWhileFetching!==void 0&&(i.status.returnedStale=!0),m.__staleWhileFetching;if(m.__returned===m)throw s},p=(e,s)=>{let l=this.#r?.(t,h,n);l&&l instanceof Promise&&l.then((t=>e(t===void 0?void 0:t)),s),r.signal.addEventListener("abort",(()=>{(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort)&&(e(void 0),i.allowStaleOnFetchAbort&&(e=t=>a(t,!0)))}))};i.status&&(i.status.fetchDispatched=!0);let u=new Promise(p).then(a,d),g=Object.assign(u,{__abortController:r,__staleWhileFetching:h,__returned:void 0});return e===void 0?(this.#$(t,g,{...n.options,status:void 0}),e=this.#u.get(t)):this.#f[e]=g,g}#T(t){if(!this.#A)return!1;let e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof AbortController}fetch(t,e={}){let i=s.tracing.hasSubscribers,{status:h=(D()?{}:void 0)}=e;e.status=h,h&&e.context&&(h.context=e.context);let r=this.#X(t,e);return h&&D()&&i&&(h.trace=!0,s.tracing.tracePromise((()=>r),h).catch((()=>{}))),r}async#X(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:h=this.noDeleteOnStaleGet,ttl:r=this.ttl,noDisposeOnSet:l=this.noDisposeOnSet,size:n=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:g=this.noUpdateTTL,noDeleteOnFetchRejection:v=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:m=this.allowStaleOnFetchRejection,ignoreFetchAbort:w=this.ignoreFetchAbort,allowStaleOnFetchAbort:_=this.allowStaleOnFetchAbort,context:S,forceRefresh:b=!1,status:y,signal:A}=e;if(y&&(y.op="fetch",y.key=t,b&&(y.forceRefresh=!0)),!this.#A)return y&&(y.fetch="get"),this.#N(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:h,status:y});let O={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:h,ttl:r,noDisposeOnSet:l,size:n,sizeCalculation:u,noUpdateTTL:g,noDeleteOnFetchRejection:v,allowStaleOnFetchRejection:m,allowStaleOnFetchAbort:_,ignoreFetchAbort:w,status:y,signal:A},x=this.#u.get(t);if(x===void 0){y&&(y.fetch="miss");let e=this.#z(t,x,O,S);return e.__returned=e}else{let e=this.#f[x];if(this.#T(e)){let t=i&&e.__staleWhileFetching!==void 0;return y&&(y.fetch="inflight",t&&(y.returnedStale=!0)),t?e.__staleWhileFetching:e.__returned=e}let h=this.#D(x);if(!b&&!h)return y&&(y.fetch="hit"),this.#E(x),s&&this.#j(x),y&&this.#U(y,x),e;let r=this.#z(t,x,O,S),l=r.__staleWhileFetching!==void 0&&i;return y&&(y.fetch=h?"stale":"refresh",l&&h&&(y.returnedStale=!0)),l?r.__staleWhileFetching:r.__returned=r}}forceFetch(t,e={}){let i=s.tracing.hasSubscribers,{status:h=(D()?{}:void 0)}=e;e.status=h,h&&e.context&&(h.context=e.context);let r=this.#J(t,e);return h&&D()&&i&&(h.trace=!0,s.tracing.tracePromise((()=>r),h).catch((()=>{}))),r}async#J(t,e={}){let i=await this.#X(t,e);if(i===void 0)throw new Error("fetch() returned undefined");return i}memo(t,e={}){let{status:i=(s.metrics.hasSubscribers?{}:void 0)}=e;e.status=i,i&&(i.op="memo",i.key=t,e.context&&(i.context=e.context));let h=this.#K(t,e);return i&&(i.value=h),s.metrics.hasSubscribers&&s.metrics.publish(i),h}#K(t,e={}){let i=this.#o;if(!i)throw new Error("no memoMethod provided to constructor");let{context:s,status:h,forceRefresh:r,...l}=e;h&&r&&(h.forceRefresh=!0);let n=this.#N(t,l),u=r||n===void 0;if(h&&(h.memo=u?"miss":"hit",u||(h.value=n)),!u)return n;let g=i(t,n,{options:l,context:s});return h&&(h.value=g),this.#$(t,g,l),g}get(t,e={}){let{status:i=(s.metrics.hasSubscribers?{}:void 0)}=e;e.status=i,i&&(i.op="get",i.key=t);let h=this.#N(t,e);return i&&(h!==void 0&&(i.value=h),s.metrics.hasSubscribers&&s.metrics.publish(i)),h}#N(t,e={}){let{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:h=this.noDeleteOnStaleGet,status:r}=e,l=this.#u.get(t);if(l===void 0){r&&(r.get="miss");return}let n=this.#f[l],u=this.#T(n);return r&&this.#U(r,l),this.#D(l)?u?(r&&(r.get="stale-fetching"),i&&n.__staleWhileFetching!==void 0?(r&&(r.returnedStale=!0),n.__staleWhileFetching):void 0):(h||this.#G(t,"expire"),r&&(r.get="stale"),i?(r&&(r.returnedStale=!0),n):void 0):(r&&(r.get=u?"fetching":"hit"),this.#E(l),s&&this.#j(l),u?n.__staleWhileFetching:n)}#Q(t,e){this.#p[e]=t,this.#d[t]=e}#E(t){t!==this.#v&&(t===this.#g?this.#g=this.#d[t]:this.#Q(this.#p[t],this.#d[t]),this.#Q(this.#v,t),this.#v=t)}delete(t){return this.#G(t,"delete")}#G(t,e){s.metrics.hasSubscribers&&s.metrics.publish({op:"delete",delete:e,key:t});let i=!1;if(this.#n!==0){let s=this.#u.get(t);if(s!==void 0)if(this.#y?.[s]&&(clearTimeout(this.#y?.[s]),this.#y[s]=void 0),i=!0,this.#n===1)this.#Y(e);else{this.#M(s);let i=this.#f[s];if(this.#T(i)?i.__abortController.abort(new Error("deleted")):(this.#F||this.#O)&&(this.#F&&this.#i?.(i,t,e),this.#O&&this.#w?.push([i,t,e])),this.#u.delete(t),this.#c[s]=void 0,this.#f[s]=void 0,s===this.#v)this.#v=this.#p[s];else if(s===this.#g)this.#g=this.#d[s];else{let t=this.#p[s];this.#d[t]=this.#d[s];let e=this.#d[s];this.#p[e]=this.#p[s]}this.#n--,this.#m.push(s)}}if(this.#O&&this.#w?.length){let t=this.#w,e;for(;e=t?.shift();)this.#h?.(...e)}return i}clear(){return this.#Y("delete")}#Y(t){for(let e of this.#C({allowStale:!0})){let i=this.#f[e];if(this.#T(i))i.__abortController.abort(new Error("deleted"));else{let s=this.#c[e];this.#F&&this.#i?.(i,s,t),this.#O&&this.#w?.push([i,s,t])}}if(this.#u.clear(),this.#f.fill(void 0),this.#c.fill(void 0),this.#b&&this.#S){this.#b.fill(0),this.#S.fill(0);for(let t of this.#y??[])t!==void 0&&clearTimeout(t);this.#y?.fill(void 0)}if(this.#_&&this.#_.fill(0),this.#g=0,this.#v=0,this.#m.length=0,this.#a=0,this.#n=0,this.#O&&this.#w){let t=this.#w,e;for(;e=t?.shift();)this.#h?.(...e)}}};t.LRUCache=v})();module.exports=i})();
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type Channel, type TracingChannel } from 'node:diagnostics_channel';
|
|
2
|
+
export type { TracingChannel, Channel };
|
|
3
|
+
export declare const metrics: Channel<unknown>;
|
|
4
|
+
export declare const tracing: TracingChannel<unknown>;
|
|
5
|
+
//# sourceMappingURL=diagnostics-channel-browser.d.mts.map
|