@univer-cli/generic-keyed-instance-pool 1.0.0-beta.2 → 1.0.0

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/README.md CHANGED
@@ -69,6 +69,7 @@ await pool.close();
69
69
  - After normal release, the instance can enter the idle cache.
70
70
  - Invalidation marks an instance as unsafe to reuse, so it is destroyed during release.
71
71
  - TTL and LRU only recycle idle instances and do not interrupt active leases.
72
+ - For invalidation, TTL, and LRU eviction, `destroy-start` is emitted synchronously after the instance leaves the cache and immediately before destruction starts. Use it to discard generation-specific state; `evicted` is the later completion event.
72
73
  - `close()` rejects new acquisitions, waits for or terminates remaining lifecycle work, and destroys cached instances.
73
74
 
74
75
  The key is used only for equality checks and events; the package never interprets it. The caller must ensure that a key always maps to compatible initialization data. The pool does not define the application's target-to-key algorithm.
package/README.zh-CN.md CHANGED
@@ -70,6 +70,7 @@ await pool.close();
70
70
  - 正常 release 后 instance 可以进入 idle cache。
71
71
  - invalidate 表示 instance 已不可安全复用,会在 release 时销毁。
72
72
  - TTL 和 LRU 只回收 idle instance,不中断 active lease。
73
+ - invalidate、TTL 与 LRU eviction 会在 instance 离开 cache 后、销毁开始前同步发出 `destroy-start`。调用方应在此清理与该 generation 绑定的状态;`evicted` 是随后发出的完成事件。
73
74
  - `close()` 拒绝新的 acquire,等待或终止剩余 lifecycle,并销毁缓存内容。
74
75
 
75
76
  Key 只用于相等性与事件,不会被 package 解释。调用方必须保证同一 key 对应兼容的 init;pool 不替 application
package/dist/index.d.ts CHANGED
@@ -46,6 +46,10 @@ type InstancePoolEvent = {
46
46
  } | {
47
47
  readonly key: string;
48
48
  readonly type: "cache-hit";
49
+ } | {
50
+ readonly key: string;
51
+ readonly reason: "invalidate" | "lru" | "ttl";
52
+ readonly type: "destroy-start";
49
53
  } | {
50
54
  readonly key: string;
51
55
  readonly reason: "invalidate" | "lru" | "ttl";
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- function _0x5dd4(_0x28ea46,_0x41c348){_0x28ea46=_0x28ea46-0xa3;const _0x34cb04=_0x34cb();let _0x5dd437=_0x34cb04[_0x28ea46];return _0x5dd437;}const _0x232c74=_0x5dd4;(function(_0x10d0c2,_0x2fa539){const _0x2ae9ed=_0x5dd4,_0x127dca=_0x10d0c2();while(!![]){try{const _0x378d94=-parseInt(_0x2ae9ed(0xb2))/0x1+-parseInt(_0x2ae9ed(0xbc))/0x2*(-parseInt(_0x2ae9ed(0xe1))/0x3)+parseInt(_0x2ae9ed(0xb1))/0x4+-parseInt(_0x2ae9ed(0xe0))/0x5*(-parseInt(_0x2ae9ed(0xac))/0x6)+-parseInt(_0x2ae9ed(0xc9))/0x7*(-parseInt(_0x2ae9ed(0xd6))/0x8)+-parseInt(_0x2ae9ed(0xd2))/0x9+parseInt(_0x2ae9ed(0xb3))/0xa;if(_0x378d94===_0x2fa539)break;else _0x127dca['push'](_0x127dca['shift']());}catch(_0x1c4a66){_0x127dca['push'](_0x127dca['shift']());}}}(_0x34cb,0x65cad));var e=class extends Error{[_0x232c74(0xa6)];constructor(_0x4c5530,_0x578837,_0x5608cf){const _0xb5469e=_0x232c74;super(_0x578837,_0x5608cf),this[_0xb5469e(0xdf)]=_0xb5469e(0xc5),this[_0xb5469e(0xa6)]=_0x4c5530;}},t=0x493e0,n=0x14;function r(_0x54fa67){const _0x43e4dd=_0x232c74;let _0x255ceb=new Map(),_0x4d2391=new Set(),_0x2facbf=new Map(),_0x1b7cd4=_0x54fa67[_0x43e4dd(0xb6)]?.[_0x43e4dd(0xdc)]??t,_0x37813c=_0x54fa67['cache']?.[_0x43e4dd(0xaf)]??n,_0x3afb32=!0x1,_0x42fb1c,_0x2d76c0=0x0;i(_0x1b7cd4,_0x37813c);let _0x4881da={async 'acquire'(_0x920ca2){const _0x5b84a4=_0x43e4dd;_0x43c22e(),a(_0x920ca2);let _0x242a1d=_0x255ceb['get'](_0x920ca2[_0x5b84a4(0xd0)]);if(_0x242a1d)return _0x242a1d[_0x5b84a4(0xa5)]?await o(_0x920ca2,_0x242a1d[_0x5b84a4(0xc2)]):(c(_0x242a1d),_0x242a1d['busy']=!0x0,_0x14fd0e({'key':_0x920ca2['key'],'type':_0x5b84a4(0xd5)}),_0x79cdaa(_0x920ca2['key'],_0x242a1d));let _0x156871=_0x2facbf[_0x5b84a4(0xab)](_0x920ca2[_0x5b84a4(0xd0)]);if(_0x156871)return await o(_0x920ca2,_0x156871);let _0x1d4e91,_0xa1ba0c=new Promise(_0x23ea9c=>{_0x1d4e91=_0x23ea9c;});_0x4d2391[_0x5b84a4(0xde)](_0xa1ba0c),_0x2facbf[_0x5b84a4(0xd8)](_0x920ca2[_0x5b84a4(0xd0)],[]);let _0x3b14fe=Date[_0x5b84a4(0xba)]();_0x14fd0e({'key':_0x920ca2['key'],'type':_0x5b84a4(0xd1)});try{await _0x272a11();let _0x4df960=await _0x54fa67[_0x5b84a4(0xca)][_0x5b84a4(0xae)](_0x920ca2);if(_0x3afb32)throw await _0x54fa67['factory']['destroy']({'instance':_0x4df960,'key':_0x920ca2['key']}),l();let _0x12d236={'busy':!0x0,'closed':!0x1,'instance':_0x4df960,'invalidated':!0x1,'lastIdleSequence':0x0,'waiters':_0x2facbf[_0x5b84a4(0xab)](_0x920ca2[_0x5b84a4(0xd0)])??[]};return _0x255ceb[_0x5b84a4(0xd8)](_0x920ca2[_0x5b84a4(0xd0)],_0x12d236),_0x14fd0e({'durationMs':Date['now']()-_0x3b14fe,'key':_0x920ca2[_0x5b84a4(0xd0)],'type':'create-complete'}),_0x79cdaa(_0x920ca2[_0x5b84a4(0xd0)],_0x12d236);}catch(_0x32fa5d){throw s(_0x2facbf[_0x5b84a4(0xab)](_0x920ca2[_0x5b84a4(0xd0)])??[],_0x32fa5d),_0x32fa5d;}finally{_0x2facbf[_0x5b84a4(0xaa)](_0x920ca2['key']),_0x4d2391[_0x5b84a4(0xaa)](_0xa1ba0c),_0x1d4e91();}},async 'close'(){if(_0x42fb1c)return await _0x42fb1c;_0x3afb32=!0x0,_0x42fb1c=_0x3f51d5(),await _0x42fb1c;}};return _0x4881da;function _0x79cdaa(_0x1b5cc7,_0x2e1949){const _0x364ca0=_0x43e4dd;let _0x1b9c46=!0x1;return{'instance':_0x2e1949[_0x364ca0(0xc7)],'key':_0x1b5cc7,async 'invalidate'(){const _0x4d700f=_0x364ca0;_0x1b9c46||(_0x1b9c46=!0x0,_0x2e1949[_0x4d700f(0xb0)]=!0x0,await _0x31a3ac(_0x1b5cc7,_0x2e1949,_0x4d700f(0xb7)));},async 'release'(){const _0x2dcf7d=_0x364ca0;if(_0x1b9c46||(_0x1b9c46=!0x0,_0x2e1949['closed']))return;if(_0x2e1949[_0x2dcf7d(0xb0)]){await _0x31a3ac(_0x1b5cc7,_0x2e1949,_0x2dcf7d(0xb7));return;}let _0x26c8d4=_0x2e1949[_0x2dcf7d(0xc2)][_0x2dcf7d(0xbe)]();_0x26c8d4?_0x26c8d4[_0x2dcf7d(0xd9)](_0x79cdaa(_0x1b5cc7,_0x2e1949)):(_0x2e1949[_0x2dcf7d(0xa5)]=!0x1,_0x2e1949[_0x2dcf7d(0xd7)]=++_0x2d76c0,_0x5bfc1a(_0x1b5cc7,_0x2e1949));}};}async function _0x31a3ac(_0x45f21f,_0x5d2d05,_0x4c7856){const _0x17e669=_0x43e4dd;let _0x3918ed=_0x5d2d05[_0x17e669(0xc2)][_0x17e669(0xcb)](0x0);_0x255ceb[_0x17e669(0xab)](_0x45f21f)===_0x5d2d05&&_0x255ceb['delete'](_0x45f21f);try{await _0x584b87(_0x45f21f,_0x5d2d05);}finally{_0x4c7856&&_0x14fd0e({'key':_0x45f21f,'reason':_0x4c7856,'type':'evicted'}),_0x3afb32?s(_0x3918ed,l()):_0x2aa0f7(_0x3918ed);}}function _0x5bfc1a(_0x45ad52,_0x237de4){const _0x44e373=_0x43e4dd;c(_0x237de4),_0x237de4[_0x44e373(0xbd)]=setTimeout(()=>{const _0x5d3ca5=_0x44e373;_0x237de4[_0x5d3ca5(0xa5)]||_0x255ceb[_0x5d3ca5(0xab)](_0x45ad52)!==_0x237de4||(_0x255ceb[_0x5d3ca5(0xaa)](_0x45ad52),_0x584b87(_0x45ad52,_0x237de4)[_0x5d3ca5(0xc0)](()=>_0x14fd0e({'key':_0x45ad52,'reason':_0x5d3ca5(0xb4),'type':_0x5d3ca5(0xbb)}))[_0x5d3ca5(0xa8)](()=>void 0x0));},_0x1b7cd4),_0x237de4[_0x44e373(0xbd)][_0x44e373(0xce)]?.();}async function _0x272a11(){const _0x44e473=_0x43e4dd;for(;_0x255ceb[_0x44e473(0xc4)]+_0x2facbf[_0x44e473(0xc4)]>_0x37813c;){let _0x9301e7;for(let _0x2157e1 of _0x255ceb)_0x2157e1[0x1][_0x44e473(0xa5)]||(!_0x9301e7||_0x2157e1[0x1][_0x44e473(0xd7)]<_0x9301e7[0x1][_0x44e473(0xd7)])&&(_0x9301e7=_0x2157e1);if(!_0x9301e7)throw new e(_0x44e473(0xa7),'Instance\x20pool\x20capacity\x20'+_0x37813c+_0x44e473(0xdd));_0x255ceb[_0x44e473(0xaa)](_0x9301e7[0x0]),await _0x584b87(_0x9301e7[0x0],_0x9301e7[0x1]),_0x14fd0e({'key':_0x9301e7[0x0],'reason':_0x44e473(0xd3),'type':_0x44e473(0xbb)});}}async function _0x3f51d5(){const _0x204039=_0x43e4dd;let _0x48b8ec=l(),_0x44305c=[..._0x255ceb[_0x204039(0xb9)]()];for(let [,_0x1753c7]of _0x44305c)s(_0x1753c7[_0x204039(0xc2)],_0x48b8ec);for(let _0x449801 of _0x2facbf[_0x204039(0xad)]())s(_0x449801,_0x48b8ec);_0x255ceb[_0x204039(0xcc)]();let _0x1c0be7=(await Promise[_0x204039(0xda)]([..._0x44305c['map'](async([_0x12b775,_0x4de96a])=>await _0x584b87(_0x12b775,_0x4de96a)),..._0x4d2391]))['find'](_0x1e33d1=>_0x1e33d1[_0x204039(0xbf)]==='rejected');if(_0x1c0be7?.[_0x204039(0xbf)]===_0x204039(0xb5))throw _0x1c0be7[_0x204039(0xc3)];}function _0x14fd0e(_0x13c4a9){try{_0x54fa67['onEvent']?.(_0x13c4a9);}catch{}}function _0x43c22e(){if(_0x3afb32)throw l();}function _0x2aa0f7(_0x4985f1){const _0x2ab025=_0x43e4dd;for(let _0x4ac014 of _0x4985f1)_0x4881da[_0x2ab025(0xb8)](_0x4ac014[_0x2ab025(0xcd)])[_0x2ab025(0xc0)](_0x4ac014[_0x2ab025(0xd9)],_0x4ac014[_0x2ab025(0xc8)]);}async function _0x584b87(_0x88665d,_0x921720){const _0x25274b=_0x43e4dd;_0x921720['closed']||(_0x921720[_0x25274b(0xa9)]=!0x0,c(_0x921720),await _0x54fa67[_0x25274b(0xca)][_0x25274b(0xa4)]({'instance':_0x921720[_0x25274b(0xc7)],'key':_0x88665d}));}}function i(_0x3c4746,_0x266327){const _0x5226dd=_0x232c74;if(!Number[_0x5226dd(0xc1)](_0x3c4746)||_0x3c4746<0x0)throw new e(_0x5226dd(0xcf),_0x5226dd(0xc6));if(!Number[_0x5226dd(0xe2)](_0x266327)||_0x266327<=0x0)throw new e(_0x5226dd(0xcf),_0x5226dd(0xa3));}function a(_0x198913){const _0x579c15=_0x232c74;if(_0x198913[_0x579c15(0xd0)][_0x579c15(0xd4)]===0x0)throw new e('INSTANCE_POOL_INVALID_INPUT','key\x20must\x20not\x20be\x20empty');}function o(_0x323a15,_0x4023a5){return new Promise((_0x22bcba,_0x1a378f)=>{const _0x1cab82=_0x5dd4;_0x4023a5[_0x1cab82(0xdb)]({'input':_0x323a15,'reject':_0x1a378f,'resolve':_0x22bcba});});}function s(_0x336f40,_0x2d2b1e){for(let _0x1ae6fe of _0x336f40['splice'](0x0))_0x1ae6fe['reject'](_0x2d2b1e);}function _0x34cb(){const _0x4be0c4=['idleTtlMs','\x20is\x20occupied\x20by\x20active\x20or\x20loading\x20instances','add','name','85455EdvSMx','6TrAzSR','isSafeInteger','cache.maxEntries\x20must\x20be\x20a\x20positive\x20integer','destroy','busy','code','INSTANCE_POOL_CAPACITY_EXCEEDED','catch','closed','delete','get','78BUErGd','values','create','maxEntries','invalidated','3047192UnXLtm','719539rQOLnT','5137900oVecat','ttl','rejected','cache','invalidate','acquire','entries','now','evicted','153462gYgNKf','idleTimer','shift','status','then','isFinite','waiters','reason','size','InstancePoolError','cache.idleTtlMs\x20must\x20be\x20a\x20finite\x20non-negative\x20number','instance','reject','161uOtzwM','factory','splice','clear','input','unref','INSTANCE_POOL_INVALID_INPUT','key','create-start','5305113nCWjYF','lru','length','cache-hit','25984BqWTJh','lastIdleSequence','set','resolve','allSettled','push'];_0x34cb=function(){return _0x4be0c4;};return _0x34cb();}function c(_0x2abb34){const _0x8f7e94=_0x232c74;_0x2abb34[_0x8f7e94(0xbd)]!==void 0x0&&(clearTimeout(_0x2abb34[_0x8f7e94(0xbd)]),delete _0x2abb34[_0x8f7e94(0xbd)]);}function l(){return new e('INSTANCE_POOL_CLOSED','Instance\x20pool\x20is\x20closed');}export{e as InstancePoolError,r as createGenericKeyedInstancePool};
1
+ function _0x2bf6(){const _0x50b432=['11WDMYeQ','idleTtlMs','waiters','map','isSafeInteger','find','acquire','idleTimer','input','delete','invalidated','lastIdleSequence','INSTANCE_POOL_CLOSED','rejected','clear','catch','50508QTDFCS','invalidate','73140bGaTnh','1551haZrKS','InstancePoolError','allSettled','get','length','36qYkVyj','1181068fszGSU','16359BeNIyL','cache','\x20is\x20occupied\x20by\x20active\x20or\x20loading\x20instances','cache-hit','maxEntries','add','cache.maxEntries\x20must\x20be\x20a\x20positive\x20integer','INSTANCE_POOL_INVALID_INPUT','lru','820mbdcEd','shift','INSTANCE_POOL_CAPACITY_EXCEEDED','37460obeVhS','size','closed','reason','set','factory','push','destroy','then','code','now','169DVHLzN','7xahrPZ','Instance\x20pool\x20is\x20closed','busy','66juFbbU','208262RHZimZ','cache.idleTtlMs\x20must\x20be\x20a\x20finite\x20non-negative\x20number','splice','key','status','destroy-start','resolve','9100656cnQAOg','reject','ttl'];_0x2bf6=function(){return _0x50b432;};return _0x2bf6();}(function(_0x36b7b4,_0x11f7e1){const _0x56d932=_0x5b0a,_0x1639b0=_0x36b7b4();while(!![]){try{const _0x10d07b=-parseInt(_0x56d932(0x9e))/0x1*(-parseInt(_0x56d932(0x94))/0x2)+-parseInt(_0x56d932(0xb8))/0x3*(-parseInt(_0x56d932(0xc1))/0x4)+-parseInt(_0x56d932(0xb0))/0x5*(-parseInt(_0x56d932(0x93))/0x6)+parseInt(_0x56d932(0x90))/0x7*(-parseInt(_0x56d932(0x9b))/0x8)+parseInt(_0x56d932(0xb6))/0x9*(-parseInt(_0x56d932(0xc4))/0xa)+parseInt(_0x56d932(0xb1))/0xb*(parseInt(_0x56d932(0xae))/0xc)+-parseInt(_0x56d932(0x8f))/0xd*(parseInt(_0x56d932(0xb7))/0xe);if(_0x10d07b===_0x11f7e1)break;else _0x1639b0['push'](_0x1639b0['shift']());}catch(_0x289dc5){_0x1639b0['push'](_0x1639b0['shift']());}}}(_0x2bf6,0xbb99b));var e=class extends Error{['code'];constructor(_0x19bf3a,_0x59ce12,_0xc43940){const _0x19d4a1=_0x5b0a;super(_0x59ce12,_0xc43940),this['name']=_0x19d4a1(0xb2),this[_0x19d4a1(0x8d)]=_0x19bf3a;}},t=0x493e0,n=0x14;function r(_0x34279f){const _0xf3a111=_0x5b0a;let _0x6641b6=new Map(),_0xd60387=new Set(),_0x1c478c=new Map(),_0x15fcf0=_0x34279f['cache']?.[_0xf3a111(0x9f)]??t,_0x203c6d=_0x34279f[_0xf3a111(0xb9)]?.[_0xf3a111(0xbc)]??n,_0xd1bc30=!0x1,_0x1716fa,_0x4eb9a4=0x0;i(_0x15fcf0,_0x203c6d);let _0x140b18={async 'acquire'(_0x180523){const _0x27965b=_0xf3a111;_0x3a38ad(),a(_0x180523);let _0x89a1ea=_0x6641b6[_0x27965b(0xb4)](_0x180523[_0x27965b(0x97)]);if(_0x89a1ea)return _0x89a1ea['busy']?await o(_0x180523,_0x89a1ea[_0x27965b(0xa0)]):(c(_0x89a1ea),_0x89a1ea[_0x27965b(0x92)]=!0x0,_0x177521({'key':_0x180523[_0x27965b(0x97)],'type':_0x27965b(0xbb)}),_0x3e9f1c(_0x180523[_0x27965b(0x97)],_0x89a1ea));let _0x1a77f1=_0x1c478c[_0x27965b(0xb4)](_0x180523[_0x27965b(0x97)]);if(_0x1a77f1)return await o(_0x180523,_0x1a77f1);let _0x2872cc,_0x364554=new Promise(_0x275c79=>{_0x2872cc=_0x275c79;});_0xd60387[_0x27965b(0xbd)](_0x364554),_0x1c478c[_0x27965b(0xc8)](_0x180523['key'],[]);let _0x4f7ba9=Date['now']();_0x177521({'key':_0x180523[_0x27965b(0x97)],'type':'create-start'});try{await _0x1b8459();let _0x3ebbb5=await _0x34279f['factory']['create'](_0x180523);if(_0xd1bc30)throw await _0x34279f[_0x27965b(0xc9)][_0x27965b(0xcb)]({'instance':_0x3ebbb5,'key':_0x180523['key']}),l();let _0xa03658={'busy':!0x0,'closed':!0x1,'instance':_0x3ebbb5,'invalidated':!0x1,'lastIdleSequence':0x0,'waiters':_0x1c478c[_0x27965b(0xb4)](_0x180523[_0x27965b(0x97)])??[]};return _0x6641b6[_0x27965b(0xc8)](_0x180523[_0x27965b(0x97)],_0xa03658),_0x177521({'durationMs':Date[_0x27965b(0x8e)]()-_0x4f7ba9,'key':_0x180523[_0x27965b(0x97)],'type':'create-complete'}),_0x3e9f1c(_0x180523[_0x27965b(0x97)],_0xa03658);}catch(_0x51d0f5){throw s(_0x1c478c['get'](_0x180523['key'])??[],_0x51d0f5),_0x51d0f5;}finally{_0x1c478c[_0x27965b(0xa7)](_0x180523[_0x27965b(0x97)]),_0xd60387['delete'](_0x364554),_0x2872cc();}},async 'close'(){if(_0x1716fa)return await _0x1716fa;_0xd1bc30=!0x0,_0x1716fa=_0x409f40(),await _0x1716fa;}};return _0x140b18;function _0x3e9f1c(_0x22f791,_0x3b8457){let _0x5b9a0d=!0x1;return{'instance':_0x3b8457['instance'],'key':_0x22f791,async 'invalidate'(){const _0x3dbf80=_0x5b0a;_0x5b9a0d||(_0x5b9a0d=!0x0,_0x3b8457[_0x3dbf80(0xa8)]=!0x0,await _0x57c627(_0x22f791,_0x3b8457,_0x3dbf80(0xaf)));},async 'release'(){const _0x1e2d16=_0x5b0a;if(_0x5b9a0d||(_0x5b9a0d=!0x0,_0x3b8457[_0x1e2d16(0xc6)]))return;if(_0x3b8457[_0x1e2d16(0xa8)]){await _0x57c627(_0x22f791,_0x3b8457,_0x1e2d16(0xaf));return;}let _0x65443c=_0x3b8457[_0x1e2d16(0xa0)][_0x1e2d16(0xc2)]();_0x65443c?_0x65443c[_0x1e2d16(0x9a)](_0x3e9f1c(_0x22f791,_0x3b8457)):(_0x3b8457[_0x1e2d16(0x92)]=!0x1,_0x3b8457['lastIdleSequence']=++_0x4eb9a4,_0x39c684(_0x22f791,_0x3b8457));}};}async function _0x57c627(_0x5343ed,_0x371c97,_0x1331e8){const _0x27e94f=_0xf3a111;let _0x55657e=_0x371c97[_0x27e94f(0xa0)][_0x27e94f(0x96)](0x0);_0x6641b6[_0x27e94f(0xb4)](_0x5343ed)===_0x371c97&&_0x6641b6[_0x27e94f(0xa7)](_0x5343ed);try{await _0x12006c(_0x5343ed,_0x371c97,_0x1331e8);}finally{_0x1331e8&&_0x177521({'key':_0x5343ed,'reason':_0x1331e8,'type':'evicted'}),_0xd1bc30?s(_0x55657e,l()):_0x298e16(_0x55657e);}}function _0x39c684(_0x487665,_0x550c85){const _0x15f2bc=_0xf3a111;c(_0x550c85),_0x550c85[_0x15f2bc(0xa5)]=setTimeout(()=>{const _0x4586d3=_0x15f2bc;_0x550c85[_0x4586d3(0x92)]||_0x6641b6['get'](_0x487665)!==_0x550c85||(_0x6641b6[_0x4586d3(0xa7)](_0x487665),_0x12006c(_0x487665,_0x550c85,_0x4586d3(0x9d))[_0x4586d3(0xcc)](()=>_0x177521({'key':_0x487665,'reason':_0x4586d3(0x9d),'type':'evicted'}))[_0x4586d3(0xad)](()=>void 0x0));},_0x15fcf0),_0x550c85['idleTimer']['unref']?.();}async function _0x1b8459(){const _0x360581=_0xf3a111;for(;_0x6641b6['size']+_0x1c478c[_0x360581(0xc5)]>_0x203c6d;){let _0x3b1477;for(let _0x55f5f0 of _0x6641b6)_0x55f5f0[0x1][_0x360581(0x92)]||(!_0x3b1477||_0x55f5f0[0x1]['lastIdleSequence']<_0x3b1477[0x1][_0x360581(0xa9)])&&(_0x3b1477=_0x55f5f0);if(!_0x3b1477)throw new e(_0x360581(0xc3),'Instance\x20pool\x20capacity\x20'+_0x203c6d+_0x360581(0xba));_0x6641b6[_0x360581(0xa7)](_0x3b1477[0x0]),await _0x12006c(_0x3b1477[0x0],_0x3b1477[0x1],_0x360581(0xc0)),_0x177521({'key':_0x3b1477[0x0],'reason':_0x360581(0xc0),'type':'evicted'});}}async function _0x409f40(){const _0x293a67=_0xf3a111;let _0x5342ac=l(),_0x41d7fe=[..._0x6641b6['entries']()];for(let [,_0x403728]of _0x41d7fe)s(_0x403728[_0x293a67(0xa0)],_0x5342ac);for(let _0x1096f7 of _0x1c478c['values']())s(_0x1096f7,_0x5342ac);_0x6641b6[_0x293a67(0xac)]();let _0x2d04df=(await Promise[_0x293a67(0xb3)]([..._0x41d7fe[_0x293a67(0xa1)](async([_0xadde28,_0x49b9ab])=>await _0x12006c(_0xadde28,_0x49b9ab)),..._0xd60387]))[_0x293a67(0xa3)](_0x3450bc=>_0x3450bc[_0x293a67(0x98)]===_0x293a67(0xab));if(_0x2d04df?.[_0x293a67(0x98)]===_0x293a67(0xab))throw _0x2d04df[_0x293a67(0xc7)];}function _0x177521(_0x548bcf){try{_0x34279f['onEvent']?.(_0x548bcf);}catch{}}function _0x3a38ad(){if(_0xd1bc30)throw l();}function _0x298e16(_0x4f2cf2){const _0x125b33=_0xf3a111;for(let _0x2a00db of _0x4f2cf2)_0x140b18[_0x125b33(0xa4)](_0x2a00db[_0x125b33(0xa6)])[_0x125b33(0xcc)](_0x2a00db[_0x125b33(0x9a)],_0x2a00db[_0x125b33(0x9c)]);}async function _0x12006c(_0x29758b,_0x6e6455,_0x387d6c){const _0x5d1510=_0xf3a111;_0x6e6455[_0x5d1510(0xc6)]||(_0x6e6455[_0x5d1510(0xc6)]=!0x0,c(_0x6e6455),_0x387d6c&&_0x177521({'key':_0x29758b,'reason':_0x387d6c,'type':_0x5d1510(0x99)}),await _0x34279f[_0x5d1510(0xc9)]['destroy']({'instance':_0x6e6455['instance'],'key':_0x29758b}));}}function _0x5b0a(_0x4c05dc,_0x3e227e){_0x4c05dc=_0x4c05dc-0x8d;const _0x2bf60d=_0x2bf6();let _0x5b0a60=_0x2bf60d[_0x4c05dc];return _0x5b0a60;}function i(_0x2f4f54,_0x5d2e44){const _0x28f447=_0x5b0a;if(!Number['isFinite'](_0x2f4f54)||_0x2f4f54<0x0)throw new e(_0x28f447(0xbf),_0x28f447(0x95));if(!Number[_0x28f447(0xa2)](_0x5d2e44)||_0x5d2e44<=0x0)throw new e(_0x28f447(0xbf),_0x28f447(0xbe));}function a(_0x598615){const _0x2cf786=_0x5b0a;if(_0x598615[_0x2cf786(0x97)][_0x2cf786(0xb5)]===0x0)throw new e(_0x2cf786(0xbf),'key\x20must\x20not\x20be\x20empty');}function o(_0x3ad033,_0x61eecd){return new Promise((_0x4a3d78,_0x18b3ff)=>{const _0x3f6bc1=_0x5b0a;_0x61eecd[_0x3f6bc1(0xca)]({'input':_0x3ad033,'reject':_0x18b3ff,'resolve':_0x4a3d78});});}function s(_0x38a5ea,_0x3b84a6){const _0x4fa799=_0x5b0a;for(let _0x10e205 of _0x38a5ea[_0x4fa799(0x96)](0x0))_0x10e205[_0x4fa799(0x9c)](_0x3b84a6);}function c(_0x44c222){const _0x57f339=_0x5b0a;_0x44c222[_0x57f339(0xa5)]!==void 0x0&&(clearTimeout(_0x44c222[_0x57f339(0xa5)]),delete _0x44c222[_0x57f339(0xa5)]);}function l(){const _0x53b6eb=_0x5b0a;return new e(_0x53b6eb(0xaa),_0x53b6eb(0x91));}export{e as InstancePoolError,r as createGenericKeyedInstancePool};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@univer-cli/generic-keyed-instance-pool",
3
3
  "type": "module",
4
- "version": "1.0.0-beta.2",
4
+ "version": "1.0.0",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.mjs",
7
7
  "types": "./dist/index.d.ts",