@univer-cli/univer-collaboration-runtime-pool 1.0.0-beta.2 → 1.0.0-rc.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 +1 -1
- package/README.zh-CN.md +3 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.mjs +1 -1
- package/dist/worker-child.mjs +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -62,7 +62,7 @@ The lease proxies the collaboration runtime's complete public interface, so call
|
|
|
62
62
|
|
|
63
63
|
## Pool behavior
|
|
64
64
|
|
|
65
|
-
Creation for a key is single-flight, and leases for the same key are granted in FIFO order. Idle runtimes can be evicted by TTL and LRU; idle eviction never interrupts an active lease. Invalidation marks a worker/runtime as untrustworthy, so it is destroyed during release. Pool events can feed logs and metrics.
|
|
65
|
+
Creation for a key is single-flight, and leases for the same key are granted in FIFO order. Idle runtimes can be evicted by TTL and LRU; idle eviction never interrupts an active lease. Invalidation marks a worker/runtime as untrustworthy, so it is destroyed during release. For invalidation, TTL, and LRU eviction, `destroy-start` is emitted synchronously before worker destruction starts; generation-specific state should be discarded then rather than waiting for the later `evicted` event. Pool events can feed logs and metrics.
|
|
66
66
|
|
|
67
67
|
The application defines both key and initialization data. The pool knows nothing about Workspace, Worktree, URLs, authentication, or target-to-key algorithms, and does not verify whether two initialization values for the same key are semantically compatible.
|
|
68
68
|
|
package/README.zh-CN.md
CHANGED
|
@@ -66,7 +66,9 @@ Lease 代理 collaboration runtime 的完整 public interface;调用方不需
|
|
|
66
66
|
## Pool 行为
|
|
67
67
|
|
|
68
68
|
同一个 key 使用 single-flight 创建和 FIFO lease;idle runtime 可按 TTL 与 LRU 回收。Active lease 不会被 idle
|
|
69
|
-
eviction 中断。Invalidate 表示 worker/runtime 已不可信,会在 release 时销毁。
|
|
69
|
+
eviction 中断。Invalidate 表示 worker/runtime 已不可信,会在 release 时销毁。Invalidate、TTL 与 LRU eviction 会在
|
|
70
|
+
worker 销毁开始前同步发出 `destroy-start`;与该 generation 绑定的状态应在此清理,不要等待随后发出的 `evicted`。
|
|
71
|
+
Pool event 可用于日志和 metrics。
|
|
70
72
|
|
|
71
73
|
Key 与 init 完全由 application 定义。Pool 不知道 Workspace、Worktree、URL、认证或 target-to-key 算法,也不会
|
|
72
74
|
验证相同 key 的两次 init 是否语义兼容。
|
package/dist/index.d.ts
CHANGED
|
@@ -52,6 +52,10 @@ type UniverCollaborationRuntimePoolEvent = {
|
|
|
52
52
|
} | {
|
|
53
53
|
readonly key: string;
|
|
54
54
|
readonly type: "cache-hit";
|
|
55
|
+
} | {
|
|
56
|
+
readonly key: string;
|
|
57
|
+
readonly reason: "invalidate" | "lru" | "ttl";
|
|
58
|
+
readonly type: "destroy-start";
|
|
55
59
|
} | {
|
|
56
60
|
readonly key: string;
|
|
57
61
|
readonly reason: "invalidate" | "lru" | "ttl";
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x38413c=_0x1657;(function(_0x21f983,_0x314797){const _0x5ad315=_0x1657,_0x535c60=_0x21f983();while(!![]){try{const _0x5b4e3b=parseInt(_0x5ad315(0x1b6))/0x1+parseInt(_0x5ad315(0x225))/0x2*(-parseInt(_0x5ad315(0x1cb))/0x3)+parseInt(_0x5ad315(0x1cd))/0x4+-parseInt(_0x5ad315(0x227))/0x5+parseInt(_0x5ad315(0x211))/0x6*(-parseInt(_0x5ad315(0x215))/0x7)+-parseInt(_0x5ad315(0x210))/0x8+parseInt(_0x5ad315(0x1e4))/0x9;if(_0x5b4e3b===_0x314797)break;else _0x535c60['push'](_0x535c60['shift']());}catch(_0x4db8d9){_0x535c60['push'](_0x535c60['shift']());}}}(_0x4986,0xc2d72));import{InstancePoolError as _0x2c54fc,createGenericKeyedInstancePool as _0x534d32}from'@univer-cli/generic-keyed-instance-pool';import{CollaborationRuntimeError as _0x33013f}from'@univer-cli/univer-collaboration-runtime';import{fork as _0x5d1cd4}from'node:child_process';import{dirname as _0x160833,extname as _0x3a8f78,join as _0x15b21d}from'node:path';import{fileURLToPath as _0x1bbb87}from'node:url';var c=class extends Error{[_0x38413c(0x1dc)];[_0x38413c(0x202)];constructor(_0x346ea7,_0x2768aa,_0x6f5958={}){const _0x2df228=_0x38413c;super(_0x2768aa,_0x6f5958),this[_0x2df228(0x209)]=_0x2df228(0x21e),this[_0x2df228(0x1dc)]=_0x346ea7,this[_0x2df228(0x202)]=_0x6f5958[_0x2df228(0x202)]??!0x1;}};async function l(_0x22ef9c){const _0x239e41=_0x38413c;let _0x413433=_0x1bbb87(import.meta.url),_0x23f0f9=_0x160833(_0x413433),_0x571d38=_0x15b21d(_0x23f0f9,_0x3a8f78(_0x413433)===_0x239e41(0x1f7)?_0x239e41(0x1ba):_0x239e41(0x1f0)),_0xc8425e=u(_0x5d1cd4(_0x571d38,[],{..._0x22ef9c['env']===void 0x0?{}:{'env':_0x22ef9c['env']},'serialization':_0x239e41(0x220),'stdio':[_0x239e41(0x1df),_0x239e41(0x1df),'ignore',_0x239e41(0x201)]}),_0x22ef9c[_0x239e41(0x20a)]);try{let _0xaf7b91=d(await _0xc8425e[_0x239e41(0x1a4)]({'entry':_0x22ef9c[_0x239e41(0x1d9)],'id':_0xc8425e['nextId'](),'init':_0x22ef9c[_0x239e41(0x207)],'type':_0x239e41(0x22c)},_0x22ef9c['openTimeoutMs'],_0x239e41(0x1ab))),_0x8c547,_0x14d157=async _0x8fa896=>await _0xc8425e['request']({..._0x8fa896,'id':_0xc8425e[_0x239e41(0x1f2)]()},_0x22ef9c['operationTimeoutMs']);return{..._0xaf7b91,async 'close'(){const _0x4f2280=_0x239e41;_0x8c547??=_0xc8425e[_0x4f2280(0x1d7)](),await _0x8c547;},async 'getState'(){const _0x57073d=_0x239e41;return f(await _0x14d157({'type':_0x57073d(0x1b7)}));},async 'getPendingMutations'(){const _0x5228bc=_0x239e41;let _0x3f5305=await _0x14d157({'type':'get-pending-mutations'});if(!C(_0x3f5305))throw _(_0x5228bc(0x1af));return _0x3f5305;},async 'executeReadCode'(_0x57a6c8){const _0x2f9838=_0x239e41;let _0xe3197c=p(await _0x14d157({'code':_0x57a6c8,'type':_0x2f9838(0x1ed)}));if(!(_0x2f9838(0x20e)in _0xe3197c)||!w(_0xe3197c[_0x2f9838(0x20e)]))throw _(_0x2f9838(0x1a8));return _0xe3197c;},async 'executeWriteCode'(_0x5ba130){const _0x97a429=_0x239e41;let _0xdb7a82=p(await _0x14d157({'code':_0x5ba130,'type':_0x97a429(0x1d4)}));if(!w(_0xdb7a82[_0x97a429(0x20e)])||!C(_0xdb7a82[_0x97a429(0x200)]))throw _(_0x97a429(0x223));return _0xdb7a82;},async 'replacePendingMutations'(_0x3e24f6){const _0x285eef=_0x239e41;let _0x557b53=p(await _0x14d157({'mutations':_0x3e24f6,'type':_0x285eef(0x1ee)}));if(!T(_0x557b53[_0x285eef(0x1ad)])||!T(_0x557b53[_0x285eef(0x1c3)]))throw _(_0x285eef(0x1c4));return _0x557b53;},async 'fetch'(){const _0x4b2bbb=_0x239e41;return m(await _0x14d157({'type':_0x4b2bbb(0x1a1)}),[_0x4b2bbb(0x20c),_0x4b2bbb(0x21a)]);},async 'pull'(){const _0x10dba0=_0x239e41;return m(await _0x14d157({'type':_0x10dba0(0x1bd)}),[_0x10dba0(0x1c9),_0x10dba0(0x1c8),_0x10dba0(0x229)]);},async 'commit'(){const _0x57faee=_0x239e41;return m(await _0x14d157({'type':'commit'}),[_0x57faee(0x1eb),_0x57faee(0x1e6),'confirmed','retry',_0x57faee(0x218),_0x57faee(0x229)]);},async 'exportUnitData'(){const _0x491f33=_0x239e41;let _0x59847e=await _0x14d157({'type':'export'});if(!E(_0x59847e))throw _(_0x491f33(0x1fb));return _0x59847e;}};}catch(_0x1987fc){throw await _0xc8425e[_0x239e41(0x1d7)](),_0x1987fc;}}function u(_0xf6533c,_0x5322cc){const _0x32de35=_0x38413c;let _0x94b44e=new Map(),_0x3e397a=0x0,_0x1943ec,_0x597d26=!0x1,_0x4bb8dd,_0x1e9f78,_0x10e383=new Promise(_0xa3ccc=>{_0x1e9f78=_0xa3ccc;});return _0xf6533c['on']('message',_0x2cf22f=>{const _0x30f7ac=_0x1657;if(!v(_0x2cf22f))return;let _0x5b0102=_0x94b44e[_0x30f7ac(0x1c0)](_0x2cf22f['id']);_0x5b0102&&(_0x94b44e['delete'](_0x2cf22f['id']),_0x5b0102[_0x30f7ac(0x224)]&&clearTimeout(_0x5b0102[_0x30f7ac(0x224)]),_0x2cf22f[_0x30f7ac(0x204)]===_0x30f7ac(0x1fe)?_0x5b0102[_0x30f7ac(0x1d6)](h(_0x2cf22f[_0x30f7ac(0x1fe)])):_0x5b0102['resolve'](_0x2cf22f[_0x30f7ac(0x1e7)]));}),_0xf6533c['on'](_0x32de35(0x1fe),_0xef3b79=>_0xed8d9e(g(_0x32de35(0x1c2)+_0x5322cc+'\x20failed:\x20'+_0xef3b79[_0x32de35(0x1be)],_0xef3b79))),_0xf6533c['on'](_0x32de35(0x1f3),(_0x1ccdab,_0x4d4e70)=>{const _0x733b42=_0x32de35;_0x597d26||_0xed8d9e(g(_0x733b42(0x1c2)+_0x5322cc+'\x20exited\x20unexpectedly\x20with\x20'+(_0x4d4e70?'signal\x20'+_0x4d4e70:_0x733b42(0x1e1)+String(_0x1ccdab))));}),_0xf6533c['on'](_0x32de35(0x1d7),()=>_0x1e9f78()),{async 'close'(){if(_0x4bb8dd)return await _0x4bb8dd;_0x4bb8dd=_0x420d8a(),await _0x4bb8dd;},'nextId'(){return++_0x3e397a;},async 'request'(_0x42553c,_0x301de5,_0x332ef5=_0x32de35(0x228)){if(_0x1943ec)throw _0x1943ec;return await new Promise((_0x55845b,_0x349e02)=>{const _0xe3209b=_0x1657;let _0x4ae013={'reject':_0x349e02,'resolve':_0x55845b,'timer':setTimeout(()=>{_0xed8d9e(new c(_0x332ef5,'Collaboration\x20worker\x20'+_0x5322cc+'\x20timed\x20out\x20after\x20'+_0x301de5+'ms',{'invalidatesInstance':!0x0})),_0x51960c();},_0x301de5)};_0x94b44e[_0xe3209b(0x1b8)](_0x42553c['id'],_0x4ae013),_0xf6533c[_0xe3209b(0x1cc)](_0x42553c,_0x423951=>{const _0x288ccf=_0xe3209b;_0x423951&&_0xed8d9e(g(_0x288ccf(0x222)+_0x5322cc,_0x423951));});});}};async function _0x420d8a(){const _0x22ce5e=_0x32de35;if(_0x597d26=!0x0,!_0x1943ec&&_0xf6533c[_0x22ce5e(0x21c)])try{await Promise[_0x22ce5e(0x1b4)]([new Promise((_0x5e3dbb,_0x3446c7)=>{const _0x2eb8ac=_0x22ce5e;let _0x3c7ceb=++_0x3e397a;_0x94b44e[_0x2eb8ac(0x1b8)](_0x3c7ceb,{'reject':_0x3446c7,'resolve':_0x5e3dbb}),_0xf6533c[_0x2eb8ac(0x1cc)]({'id':_0x3c7ceb,'type':_0x2eb8ac(0x1d7)},_0x143ace=>{_0x143ace&&_0x3446c7(_0x143ace);});}),new Promise((_0x391072,_0x1fc5e8)=>{const _0x2f18bf=_0x22ce5e;setTimeout(()=>_0x1fc5e8(Error(_0x2f18bf(0x1ca))),0x1388)[_0x2f18bf(0x1ac)]();})]);}catch{}_0x51960c(),await _0x10e383,_0xed8d9e(new c(_0x22ce5e(0x217),_0x22ce5e(0x1f1)+_0x5322cc+'\x20is\x20closed',{'invalidatesInstance':!0x0}));}function _0xed8d9e(_0x2ff675){const _0x4546ff=_0x32de35;_0x1943ec??=_0x2ff675;for(let _0xa0ed86 of _0x94b44e[_0x4546ff(0x1e2)]())_0xa0ed86[_0x4546ff(0x224)]&&clearTimeout(_0xa0ed86[_0x4546ff(0x224)]),_0xa0ed86[_0x4546ff(0x1d6)](_0x1943ec);_0x94b44e['clear']();}function _0x51960c(){const _0x24b4dd=_0x32de35;_0xf6533c[_0x24b4dd(0x1f4)]===null&&_0xf6533c[_0x24b4dd(0x20d)]===null&&_0xf6533c[_0x24b4dd(0x1a3)](_0x24b4dd(0x1d1));}}function _0x1657(_0x25f24e,_0x1e2ed0){_0x25f24e=_0x25f24e-0x1a1;const _0x49860a=_0x4986();let _0x165791=_0x49860a[_0x25f24e];return _0x165791;}function d(_0x2afb76){const _0x425468=_0x38413c;if(!E(_0x2afb76)||typeof _0x2afb76[_0x425468(0x1f9)]!=_0x425468(0x1ff)||!y(_0x2afb76['unitType']))throw _(_0x425468(0x1c7));return{'unitId':_0x2afb76['unitId'],'unitType':_0x2afb76['unitType']};}function f(_0x541bdd){const _0x5b5581=_0x38413c;if(!E(_0x541bdd)||!b(_0x541bdd['connection'])||!T(_0x541bdd['baseRevision'])||!T(_0x541bdd[_0x5b5581(0x1d2)])||Number(_0x541bdd['knownHeadRevision'])<Number(_0x541bdd[_0x5b5581(0x1fd)])||!T(_0x541bdd[_0x5b5581(0x1c3)])||!T(_0x541bdd[_0x5b5581(0x1a9)])||!x(_0x541bdd['awaitingChangeset'])||!S(_0x541bdd[_0x5b5581(0x229)]))throw _(_0x5b5581(0x1da));return _0x541bdd;}function p(_0x4a81d1){const _0x23431a=_0x38413c;if(!E(_0x4a81d1))throw _(_0x23431a(0x203));return{..._0x4a81d1,'state':f(_0x4a81d1[_0x23431a(0x1ef)])};}function _0x4986(){const _0x35c313=['reconnecting','race','release','391462vhplvR','get-state','set','entry\x20must\x20not\x20be\x20empty','worker-child.ts','online','export','pull','message','COLLABORATION_WORKER_PROTOCOL_ERROR','get','pending-mutations','Worker\x20','pendingMutationCount','Worker\x20returned\x20an\x20invalid\x20mutation\x20replacement\x20result','COLLABORATION_WORKER_CRASHED','openTimeoutMs','Worker\x20returned\x20invalid\x20collaboration\x20runtime\x20metadata','pulled','up-to-date','Worker\x20close\x20timed\x20out','4450614ECMLXx','send','2410136FUFPOF','number','acquire','isFinite','SIGKILL','knownHeadRevision','onEvent','execute-write','assign','reject','close','INSTANCE_POOL_CAPACITY_EXCEEDED','entry','Worker\x20returned\x20invalid\x20collaboration\x20runtime\x20state','Collaboration\x20runtime\x20lease\x20','code','executeWriteCode','includes','ignore','isArray','exit\x20code\x20','values','operation','43842951TsLHkz','length','pull-required','result','COLLABORATION_POOL_CLOSED','reason','now','nothing-to-commit','reqId','execute-read','replace-mutations','state','worker-child.mjs','Collaboration\x20worker\x20','nextId','exit','exitCode','href','status','.ts','exportUnitData','unitId','mutationCount','Worker\x20returned\x20invalid\x20UnitData','stack','baseRevision','error','string','mutations','ipc','invalidatesInstance','Worker\x20returned\x20an\x20invalid\x20operation\x20result','type','Worker\x20returned\x20an\x20invalid\x20operation\x20status','COLLABORATION_POOL_CAPACITY_EXCEEDED','init','sid','name','key','read','unchanged','signalCode','value','operationTimeoutMs','10816096QkpQJt','618IeYsth','cache','COLLABORATION_POOL_INVALID_INPUT','COLLABORATION_','89922aIUFJH','executeReadCode','COLLABORATION_WORKER_CLOSED','unknown','\x20must\x20be\x20a\x20finite\x20positive\x20number','fetched','instance-failed','connected','retryable','UniverCollaborationRuntimePoolError','COLLABORATION_LEASE_CLOSED','advanced','mode','Failed\x20to\x20send\x20a\x20request\x20to\x20worker\x20','Worker\x20returned\x20an\x20invalid\x20write\x20result','timer','2JJfSir','offline','4543405xxyNId','COLLABORATION_WORKER_OPERATION_TIMEOUT','conflict','env','revision','open','getPendingMutations','fetch','closed','kill','request','isSafeInteger','operation-complete','every','Worker\x20returned\x20an\x20invalid\x20read\x20value','bufferedChangesetCount','startsWith','COLLABORATION_WORKER_OPEN_TIMEOUT','unref','previousMutationCount','invalidate','Worker\x20returned\x20invalid\x20pending\x20mutations','transform-failed','commit','unitType'];_0x4986=function(){return _0x35c313;};return _0x4986();}function m(_0x4aa6fb,_0xd5be6d){const _0x446059=_0x38413c;let _0x4effdd=p(_0x4aa6fb);if(typeof _0x4effdd[_0x446059(0x1f6)]!='string'||!_0xd5be6d[_0x446059(0x1de)](_0x4effdd[_0x446059(0x1f6)]))throw _(_0x446059(0x205));return _0x4effdd;}function h(_0x3fe16f){const _0x2c5136=_0x38413c;if(_0x3fe16f['code']?.[_0x2c5136(0x1aa)](_0x2c5136(0x214))&&!_0x3fe16f[_0x2c5136(0x1dc)][_0x2c5136(0x1aa)]('COLLABORATION_WORKER_')){let _0x565555=new _0x33013f(_0x3fe16f[_0x2c5136(0x1dc)],_0x3fe16f[_0x2c5136(0x1be)],{'retryable':_0x3fe16f[_0x2c5136(0x21d)]??!0x1});return _0x3fe16f[_0x2c5136(0x1fc)]!==void 0x0&&(_0x565555[_0x2c5136(0x1fc)]=_0x3fe16f[_0x2c5136(0x1fc)]),_0x3fe16f[_0x2c5136(0x202)]&&Object[_0x2c5136(0x1d5)](_0x565555,{'invalidatesInstance':!0x0}),_0x565555;}let _0xe7b35b=Error(_0x3fe16f[_0x2c5136(0x1be)]);return _0xe7b35b[_0x2c5136(0x209)]=_0x3fe16f[_0x2c5136(0x209)],_0x3fe16f[_0x2c5136(0x1dc)]!==void 0x0&&Object[_0x2c5136(0x1d5)](_0xe7b35b,{'code':_0x3fe16f['code']}),_0x3fe16f['invalidatesInstance']&&Object[_0x2c5136(0x1d5)](_0xe7b35b,{'invalidatesInstance':!0x0}),_0x3fe16f['stack']!==void 0x0&&(_0xe7b35b[_0x2c5136(0x1fc)]=_0x3fe16f[_0x2c5136(0x1fc)]),_0xe7b35b;}function g(_0x565754,_0x1e4ccc){const _0x34c6b8=_0x38413c;return new c(_0x34c6b8(0x1c5),_0x565754,{..._0x1e4ccc===void 0x0?{}:{'cause':_0x1e4ccc},'invalidatesInstance':!0x0});}function _(_0x3c89ff){const _0x480986=_0x38413c;return new c(_0x480986(0x1bf),_0x3c89ff,{'invalidatesInstance':!0x0});}function v(_0x38832a){const _0x751cd1=_0x38413c;return E(_0x38832a)&&Number[_0x751cd1(0x1a5)](_0x38832a['id'])&&(_0x38832a[_0x751cd1(0x204)]===_0x751cd1(0x1e7)||_0x38832a[_0x751cd1(0x204)]===_0x751cd1(0x1fe));}function y(_0x218014){return _0x218014===0x1||_0x218014===0x2||_0x218014===0x3||_0x218014===0x5||_0x218014===0x6;}function b(_0x3ca808){const _0x101475=_0x38413c;return _0x3ca808===_0x101475(0x1bb)||_0x3ca808===_0x101475(0x1b3)||_0x3ca808===_0x101475(0x226)||_0x3ca808===_0x101475(0x1a2);}function x(_0x3510c4){const _0x5c0143=_0x38413c;return _0x3510c4===null||E(_0x3510c4)&&T(_0x3510c4[_0x5c0143(0x1fd)])&&T(_0x3510c4[_0x5c0143(0x22b)])&&T(_0x3510c4[_0x5c0143(0x1fa)])&&(_0x3510c4[_0x5c0143(0x208)]===void 0x0||typeof _0x3510c4['sid']=='string')&&(_0x3510c4[_0x5c0143(0x1ec)]===void 0x0||T(_0x3510c4[_0x5c0143(0x1ec)]));}function S(_0x5197b5){const _0x27addf=_0x38413c;return _0x5197b5===null||E(_0x5197b5)&&(_0x5197b5[_0x27addf(0x1e3)]===_0x27addf(0x1bd)||_0x5197b5[_0x27addf(0x1e3)]===_0x27addf(0x1b1))&&(_0x5197b5[_0x27addf(0x1e9)]===_0x27addf(0x1b0)||_0x5197b5[_0x27addf(0x1e9)]==='changeset-rejected'||_0x5197b5['reason']==='permission-rejected')&&typeof _0x5197b5['message']=='string';}function C(_0x94bf6f){const _0x50ef29=_0x38413c;return Array[_0x50ef29(0x1e0)](_0x94bf6f)&&_0x94bf6f[_0x50ef29(0x1a7)](_0x567112=>E(_0x567112)&&typeof _0x567112['id']==_0x50ef29(0x1ff)&&_0x567112['id'][_0x50ef29(0x1e5)]>0x0&&typeof _0x567112['data']=='string');}function w(_0x1899fc){const _0x33a55e=_0x38413c;return _0x1899fc===null||typeof _0x1899fc=='boolean'||typeof _0x1899fc==_0x33a55e(0x1ff)||typeof _0x1899fc==_0x33a55e(0x1ce)&&Number['isFinite'](_0x1899fc)?!0x0:Array[_0x33a55e(0x1e0)](_0x1899fc)?_0x1899fc[_0x33a55e(0x1a7)](w):E(_0x1899fc)&&Object[_0x33a55e(0x1e2)](_0x1899fc)[_0x33a55e(0x1a7)](w);}function T(_0x45116b){const _0x1cddb8=_0x38413c;return Number[_0x1cddb8(0x1a5)](_0x45116b)&&Number(_0x45116b)>=0x0;}function E(_0x506820){const _0x32c2bc=_0x38413c;return typeof _0x506820=='object'&&!!_0x506820&&!Array[_0x32c2bc(0x1e0)](_0x506820);}var D=0x7530,O=0x7530;function k(_0x257a44){const _0x39b952=_0x38413c;let _0x48dc71=A(_0x257a44[_0x39b952(0x1d9)]),_0x1e164e=_0x257a44['openTimeoutMs']??D,_0x4b2599=_0x257a44['operationTimeoutMs']??O;j(_0x1e164e,_0x39b952(0x1c6)),j(_0x4b2599,_0x39b952(0x20f));let _0x233a45;try{_0x233a45=_0x534d32({'factory':{async 'create'(_0x228313){const _0xa987b1=_0x39b952;return await l({'entry':_0x48dc71,..._0x257a44[_0xa987b1(0x22a)]===void 0x0?{}:{'env':_0x257a44[_0xa987b1(0x22a)]},'init':_0x228313[_0xa987b1(0x207)],'key':_0x228313[_0xa987b1(0x20a)],'openTimeoutMs':_0x1e164e,'operationTimeoutMs':_0x4b2599});},async 'destroy'({instance:_0x34b455}){const _0x53705b=_0x39b952;await _0x34b455[_0x53705b(0x1d7)]();}},..._0x257a44[_0x39b952(0x212)]===void 0x0?{}:{'cache':_0x257a44['cache']},'onEvent':_0x13cf47});}catch(_0x57e397){throw M(_0x57e397);}return{async 'acquire'(_0x4dd775){const _0x7d692f=_0x39b952;let _0x3b8afb;try{_0x3b8afb=await _0x233a45[_0x7d692f(0x1cf)](_0x4dd775);}catch(_0x2fc4e){throw M(_0x2fc4e);}return _0x490685(_0x3b8afb);},async 'close'(){const _0x17abbd=_0x39b952;try{await _0x233a45[_0x17abbd(0x1d7)]();}catch(_0x591d2e){throw M(_0x591d2e);}}};function _0x490685(_0x449c6c){const _0x243f89=_0x39b952;let _0x8d5d86=_0x449c6c['instance'],_0x3bba7f=!0x1,_0x4e43d1,_0x57c303=!0x1;return{'key':_0x449c6c[_0x243f89(0x20a)],'unitId':_0x8d5d86['unitId'],'unitType':_0x8d5d86[_0x243f89(0x1b2)],async 'getState'(){const _0x3fe269=_0x243f89;return await _0x493232(_0x3fe269(0x1ef),async()=>await _0x8d5d86['getState']());},async 'getPendingMutations'(){const _0xe43be6=_0x243f89;return await _0x493232(_0xe43be6(0x1c1),async()=>await _0x8d5d86[_0xe43be6(0x22d)]());},async 'execute'(_0x1df187){const _0x4825d9=_0x243f89;return _0x1df187[_0x4825d9(0x221)]===_0x4825d9(0x20b)?await _0x493232(_0x4825d9(0x20b),async()=>await _0x8d5d86[_0x4825d9(0x216)](_0x1df187[_0x4825d9(0x1dc)])):await _0x493232('write',async()=>await _0x8d5d86[_0x4825d9(0x1dd)](_0x1df187[_0x4825d9(0x1dc)]));},async 'replacePendingMutations'(_0x96e65b){return await _0x493232('replace-mutations',async()=>await _0x8d5d86['replacePendingMutations'](_0x96e65b));},async 'fetch'(){const _0x188fa5=_0x243f89;return await _0x493232(_0x188fa5(0x1a1),async()=>await _0x8d5d86[_0x188fa5(0x1a1)]());},async 'pull'(){const _0x48988a=_0x243f89;return await _0x493232(_0x48988a(0x1bd),async()=>await _0x8d5d86[_0x48988a(0x1bd)]());},async 'commit'(){const _0x547c69=_0x243f89;return await _0x493232(_0x547c69(0x1b1),async()=>await _0x8d5d86[_0x547c69(0x1b1)]());},async 'exportUnitData'(){const _0x3d1bcc=_0x243f89;return await _0x493232(_0x3d1bcc(0x1bc),async()=>await _0x8d5d86[_0x3d1bcc(0x1f8)]());},async 'invalidate'(){_0x3bba7f||(_0x3bba7f=!0x0,await _0x449c6c['invalidate']());},async 'release'(){const _0x521543=_0x243f89;_0x3bba7f||(_0x3bba7f=!0x0,_0x57c303?await _0x449c6c[_0x521543(0x1ae)]():await _0x449c6c[_0x521543(0x1b5)]());}};async function _0x493232(_0xdf7897,_0x21b9e0){const _0xe24dd4=_0x243f89;_0x53ef36();try{return await _0x482576(_0x449c6c[_0xe24dd4(0x20a)],_0xdf7897,_0x21b9e0);}catch(_0x208350){throw _0x131e39(_0x208350),_0x208350;}}function _0x53ef36(){const _0x672125=_0x243f89;if(_0x3bba7f)throw new c(_0x672125(0x21f),_0x672125(0x1db)+_0x449c6c['key']+'\x20is\x20closed');if(_0x4e43d1)throw _0x4e43d1;}function _0x131e39(_0x3a3b62){const _0x11abeb=_0x243f89;(_0x3a3b62 instanceof c&&_0x3a3b62[_0x11abeb(0x202)]||_0x3a3b62 instanceof _0x33013f&&(_0x3a3b62[_0x11abeb(0x1dc)]==='COLLABORATION_PROTOCOL_ERROR'||_0x3a3b62['code']==='COLLABORATION_CLOSED'||_0x3a3b62[_0x11abeb(0x1dc)]==='COLLABORATION_LOAD_FAILED')||typeof _0x3a3b62=='object'&&_0x3a3b62&&_0x11abeb(0x202)in _0x3a3b62&&_0x3a3b62['invalidatesInstance']===!0x0)&&(_0x57c303=!0x0,_0x4e43d1=_0x3a3b62,_0x35ca01({'errorCode':N(_0x3a3b62),'key':_0x449c6c[_0x11abeb(0x20a)],'type':_0x11abeb(0x21b)}));}}async function _0x482576(_0x5c7a30,_0x7dd907,_0x7c135c){const _0xa54ce=_0x39b952;let _0xe82570=Date[_0xa54ce(0x1ea)](),_0x2bd7b9=await _0x7c135c();return _0x35ca01({'durationMs':Date[_0xa54ce(0x1ea)]()-_0xe82570,'key':_0x5c7a30,'operation':_0x7dd907,'type':_0xa54ce(0x1a6)}),_0x2bd7b9;}function _0x13cf47(_0x139e4a){_0x35ca01(_0x139e4a);}function _0x35ca01(_0x6d0e1a){const _0x356b98=_0x39b952;try{_0x257a44[_0x356b98(0x1d3)]?.(_0x6d0e1a);}catch{}}}function A(_0x31b657){const _0xeccdd8=_0x38413c;let _0x123f95=_0x31b657 instanceof URL?_0x31b657['href']:_0x31b657;if(_0x123f95[_0xeccdd8(0x1e5)]===0x0)throw new c(_0xeccdd8(0x213),_0xeccdd8(0x1b9));try{return new URL(_0x123f95)[_0xeccdd8(0x1f5)];}catch{throw new c(_0xeccdd8(0x213),'entry\x20must\x20be\x20an\x20absolute\x20file\x20URL\x20or\x20another\x20importable\x20URL');}}function j(_0x32a428,_0x13a156){const _0x140e28=_0x38413c;if(!Number[_0x140e28(0x1d0)](_0x32a428)||_0x32a428<=0x0)throw new c(_0x140e28(0x213),_0x13a156+_0x140e28(0x219));}function M(_0xb2bacb){const _0x43b78c=_0x38413c;return _0xb2bacb instanceof _0x2c54fc?new c(_0xb2bacb[_0x43b78c(0x1dc)]===_0x43b78c(0x1d8)?_0x43b78c(0x206):_0xb2bacb['code']==='INSTANCE_POOL_CLOSED'?_0x43b78c(0x1e8):_0x43b78c(0x213),_0xb2bacb[_0x43b78c(0x1be)],{'cause':_0xb2bacb}):_0xb2bacb;}function N(_0x45afbf){const _0x323fae=_0x38413c;return typeof _0x45afbf=='object'&&_0x45afbf&&'code'in _0x45afbf&&typeof _0x45afbf['code']==_0x323fae(0x1ff)?_0x45afbf[_0x323fae(0x1dc)]:'UNKNOWN';}function P(_0x1df8af){return _0x1df8af;}export{c as UniverCollaborationRuntimePoolError,k as createUniverCollaborationRuntimePool,P as defineUniverCollaborationRuntimeWorker};
|
|
1
|
+
const _0x440440=_0x52a6;(function(_0x4b9c5a,_0x4cde52){const _0x109727=_0x52a6,_0x3d2b9d=_0x4b9c5a();while(!![]){try{const _0x73fb28=-parseInt(_0x109727(0x199))/0x1*(parseInt(_0x109727(0x1cd))/0x2)+parseInt(_0x109727(0x1c4))/0x3+-parseInt(_0x109727(0x175))/0x4+parseInt(_0x109727(0x19a))/0x5*(-parseInt(_0x109727(0x1d5))/0x6)+-parseInt(_0x109727(0x16a))/0x7+parseInt(_0x109727(0x1e6))/0x8+-parseInt(_0x109727(0x1a8))/0x9*(-parseInt(_0x109727(0x1c6))/0xa);if(_0x73fb28===_0x4cde52)break;else _0x3d2b9d['push'](_0x3d2b9d['shift']());}catch(_0x3dee7b){_0x3d2b9d['push'](_0x3d2b9d['shift']());}}}(_0x190f,0xbc576));import{InstancePoolError as _0x316f6f,createGenericKeyedInstancePool as _0x2cb8cd}from'@univer-cli/generic-keyed-instance-pool';import{CollaborationRuntimeError as _0x33df9a}from'@univer-cli/univer-collaboration-runtime';import{fork as _0x1fad84}from'node:child_process';import{dirname as _0x15ac1b,extname as _0x524ce0,join as _0x2a8b7b}from'node:path';import{fileURLToPath as _0x5695a5}from'node:url';var c=class extends Error{[_0x440440(0x168)];[_0x440440(0x18e)];constructor(_0x2903bf,_0x32fa99,_0x310cd9={}){const _0x2ebb4f=_0x440440;super(_0x32fa99,_0x310cd9),this[_0x2ebb4f(0x1ba)]=_0x2ebb4f(0x1a5),this[_0x2ebb4f(0x168)]=_0x2903bf,this['invalidatesInstance']=_0x310cd9['invalidatesInstance']??!0x1;}};async function l(_0x1c0bd0){const _0x45f66d=_0x440440;let _0x293c46=_0x5695a5(import.meta.url),_0x520b4e=_0x15ac1b(_0x293c46),_0x5b8596=_0x2a8b7b(_0x520b4e,_0x524ce0(_0x293c46)===_0x45f66d(0x1d3)?_0x45f66d(0x15b):_0x45f66d(0x182)),_0x175a51=u(_0x1fad84(_0x5b8596,[],{..._0x1c0bd0[_0x45f66d(0x1a2)]===void 0x0?{}:{'env':_0x1c0bd0[_0x45f66d(0x1a2)]},'serialization':_0x45f66d(0x17c),'stdio':[_0x45f66d(0x17d),_0x45f66d(0x17d),_0x45f66d(0x17d),_0x45f66d(0x16d)]}),_0x1c0bd0[_0x45f66d(0x180)]);try{let _0x10b4f2=d(await _0x175a51['request']({'entry':_0x1c0bd0['entry'],'id':_0x175a51['nextId'](),'init':_0x1c0bd0['init'],'type':_0x45f66d(0x176)},_0x1c0bd0[_0x45f66d(0x1b7)],'COLLABORATION_WORKER_OPEN_TIMEOUT')),_0x138c69,_0x5b6916=async _0x255fbc=>await _0x175a51['request']({..._0x255fbc,'id':_0x175a51[_0x45f66d(0x19b)]()},_0x1c0bd0[_0x45f66d(0x1dd)]);return{..._0x10b4f2,async 'close'(){const _0x161e59=_0x45f66d;_0x138c69??=_0x175a51[_0x161e59(0x18b)](),await _0x138c69;},async 'getState'(){const _0x1c9517=_0x45f66d;return f(await _0x5b6916({'type':_0x1c9517(0x1b3)}));},async 'getPendingMutations'(){const _0x45c288=_0x45f66d;let _0x211f9e=await _0x5b6916({'type':_0x45c288(0x172)});if(!C(_0x211f9e))throw _(_0x45c288(0x1bb));return _0x211f9e;},async 'executeReadCode'(_0x25af75){const _0x557792=_0x45f66d;let _0x1a0aa1=p(await _0x5b6916({'code':_0x25af75,'type':_0x557792(0x1b9)}));if(!('value'in _0x1a0aa1)||!w(_0x1a0aa1['value']))throw _(_0x557792(0x158));return _0x1a0aa1;},async 'executeWriteCode'(_0xeb5ed3){const _0x63f758=_0x45f66d;let _0x5c1725=p(await _0x5b6916({'code':_0xeb5ed3,'type':_0x63f758(0x1bc)}));if(!w(_0x5c1725['value'])||!C(_0x5c1725[_0x63f758(0x159)]))throw _(_0x63f758(0x1ae));return _0x5c1725;},async 'replacePendingMutations'(_0xd124a2){const _0x5ac3a1=_0x45f66d;let _0x42397e=p(await _0x5b6916({'mutations':_0xd124a2,'type':_0x5ac3a1(0x193)}));if(!T(_0x42397e[_0x5ac3a1(0x17a)])||!T(_0x42397e['pendingMutationCount']))throw _('Worker\x20returned\x20an\x20invalid\x20mutation\x20replacement\x20result');return _0x42397e;},async 'fetch'(){const _0x4f96d8=_0x45f66d;return m(await _0x5b6916({'type':_0x4f96d8(0x1b5)}),[_0x4f96d8(0x18a),_0x4f96d8(0x1de)]);},async 'pull'(){const _0x302cfc=_0x45f66d;return m(await _0x5b6916({'type':_0x302cfc(0x17b)}),['up-to-date','pulled',_0x302cfc(0x196)]);},async 'commit'(){const _0x179fd5=_0x45f66d;return m(await _0x5b6916({'type':_0x179fd5(0x19e)}),[_0x179fd5(0x1e2),_0x179fd5(0x167),_0x179fd5(0x1a6),_0x179fd5(0x1d8),_0x179fd5(0x19f),_0x179fd5(0x196)]);},async 'exportUnitData'(){const _0x34186a=_0x45f66d;let _0x5d0522=await _0x5b6916({'type':_0x34186a(0x1ac)});if(!E(_0x5d0522))throw _(_0x34186a(0x1c9));return _0x5d0522;}};}catch(_0x1d6b35){throw await _0x175a51[_0x45f66d(0x18b)](),_0x1d6b35;}}function u(_0x869d7a,_0x423a62){const _0x457dd2=_0x440440;let _0x333551=new Map(),_0x30d1b3=0x0,_0x3833e8,_0x2c6ca1=!0x1,_0x43d74a,_0x2dd73e,_0x38f4ba=new Promise(_0x2125eb=>{_0x2dd73e=_0x2125eb;});return _0x869d7a['on']('message',_0x3bf0ed=>{const _0xb72695=_0x52a6;if(!v(_0x3bf0ed))return;let _0x57cf3f=_0x333551[_0xb72695(0x164)](_0x3bf0ed['id']);_0x57cf3f&&(_0x333551[_0xb72695(0x191)](_0x3bf0ed['id']),_0x57cf3f[_0xb72695(0x1ca)]&&clearTimeout(_0x57cf3f[_0xb72695(0x1ca)]),_0x3bf0ed[_0xb72695(0x190)]===_0xb72695(0x1b0)?_0x57cf3f[_0xb72695(0x1b8)](h(_0x3bf0ed[_0xb72695(0x1b0)])):_0x57cf3f[_0xb72695(0x1d9)](_0x3bf0ed[_0xb72695(0x19d)]));}),_0x869d7a['on']('error',_0x208ad0=>_0x181aba(g(_0x457dd2(0x15c)+_0x423a62+_0x457dd2(0x15d)+_0x208ad0['message'],_0x208ad0))),_0x869d7a['on'](_0x457dd2(0x16c),(_0x1ccbc5,_0x17043d)=>{const _0x3b6bb6=_0x457dd2;_0x2c6ca1||_0x181aba(g('Worker\x20'+_0x423a62+_0x3b6bb6(0x1b6)+(_0x17043d?_0x3b6bb6(0x183)+_0x17043d:_0x3b6bb6(0x18d)+String(_0x1ccbc5))));}),_0x869d7a['on'](_0x457dd2(0x18b),()=>_0x2dd73e()),{async 'close'(){if(_0x43d74a)return await _0x43d74a;_0x43d74a=_0x51cedf(),await _0x43d74a;},'nextId'(){return++_0x30d1b3;},async 'request'(_0x358393,_0x21a728,_0x35dede=_0x457dd2(0x1bd)){if(_0x3833e8)throw _0x3833e8;return await new Promise((_0x278e5d,_0x1cafe6)=>{const _0x42e44a=_0x52a6;let _0x4d43cb={'reject':_0x1cafe6,'resolve':_0x278e5d,'timer':setTimeout(()=>{const _0x330948=_0x52a6;_0x181aba(new c(_0x35dede,_0x330948(0x1a3)+_0x423a62+_0x330948(0x1dc)+_0x21a728+'ms',{'invalidatesInstance':!0x0})),_0xb47f2d();},_0x21a728)};_0x333551[_0x42e44a(0x1c7)](_0x358393['id'],_0x4d43cb),_0x869d7a[_0x42e44a(0x17e)](_0x358393,_0x586f5e=>{const _0x55a07e=_0x42e44a;_0x586f5e&&_0x181aba(g(_0x55a07e(0x15e)+_0x423a62,_0x586f5e));});});}};async function _0x51cedf(){const _0x5f318f=_0x457dd2;if(_0x2c6ca1=!0x0,!_0x3833e8&&_0x869d7a['connected'])try{await Promise[_0x5f318f(0x1a1)]([new Promise((_0x49d782,_0x2dd77d)=>{const _0x756632=_0x5f318f;let _0x346c77=++_0x30d1b3;_0x333551[_0x756632(0x1c7)](_0x346c77,{'reject':_0x2dd77d,'resolve':_0x49d782}),_0x869d7a[_0x756632(0x17e)]({'id':_0x346c77,'type':_0x756632(0x18b)},_0x2fde45=>{_0x2fde45&&_0x2dd77d(_0x2fde45);});}),new Promise((_0x44da24,_0x57de59)=>{setTimeout(()=>_0x57de59(Error('Worker\x20close\x20timed\x20out')),0x1388)['unref']();})]);}catch{}_0xb47f2d(),await _0x38f4ba,_0x181aba(new c(_0x5f318f(0x187),_0x5f318f(0x1a3)+_0x423a62+'\x20is\x20closed',{'invalidatesInstance':!0x0}));}function _0x181aba(_0x44c1df){const _0x1218fc=_0x457dd2;_0x3833e8??=_0x44c1df;for(let _0x19568d of _0x333551[_0x1218fc(0x194)]())_0x19568d[_0x1218fc(0x1ca)]&&clearTimeout(_0x19568d[_0x1218fc(0x1ca)]),_0x19568d[_0x1218fc(0x1b8)](_0x3833e8);_0x333551[_0x1218fc(0x16e)]();}function _0xb47f2d(){const _0x2d11c1=_0x457dd2;_0x869d7a[_0x2d11c1(0x195)]===null&&_0x869d7a['signalCode']===null&&_0x869d7a[_0x2d11c1(0x1c1)]('SIGKILL');}}function d(_0x359343){const _0x35b8a5=_0x440440;if(!E(_0x359343)||typeof _0x359343['unitId']!=_0x35b8a5(0x1e1)||!y(_0x359343['unitType']))throw _('Worker\x20returned\x20invalid\x20collaboration\x20runtime\x20metadata');return{'unitId':_0x359343['unitId'],'unitType':_0x359343['unitType']};}function f(_0x2744a6){const _0x5610f5=_0x440440;if(!E(_0x2744a6)||!b(_0x2744a6[_0x5610f5(0x1d0)])||!T(_0x2744a6[_0x5610f5(0x1af)])||!T(_0x2744a6[_0x5610f5(0x1e0)])||Number(_0x2744a6[_0x5610f5(0x1e0)])<Number(_0x2744a6[_0x5610f5(0x1af)])||!T(_0x2744a6[_0x5610f5(0x1aa)])||!T(_0x2744a6[_0x5610f5(0x1a4)])||!x(_0x2744a6[_0x5610f5(0x186)])||!S(_0x2744a6['conflict']))throw _('Worker\x20returned\x20invalid\x20collaboration\x20runtime\x20state');return _0x2744a6;}function p(_0x3bdc30){const _0x2382a7=_0x440440;if(!E(_0x3bdc30))throw _(_0x2382a7(0x15f));return{..._0x3bdc30,'state':f(_0x3bdc30[_0x2382a7(0x161)])};}function _0x190f(){const _0x5b7758=['reason','startsWith','4704240zlCgQL','open','exportUnitData','isSafeInteger','operation','previousMutationCount','pull','advanced','ignore','send','COLLABORATION_WORKER_PROTOCOL_ERROR','key','COLLABORATION_LOAD_FAILED','worker-child.mjs','signal\x20','isArray','stack','awaitingChangeset','COLLABORATION_WORKER_CLOSED','unitType','pending-mutations','unchanged','close','acquire','exit\x20code\x20','invalidatesInstance','online','type','delete','every','replace-mutations','values','exitCode','conflict','number','includes','131mNGUSP','5rzimAM','nextId','read','result','commit','unknown','COLLABORATION_POOL_CLOSED','race','env','Collaboration\x20worker\x20','bufferedChangesetCount','UniverCollaborationRuntimePoolError','confirmed','COLLABORATION_PROTOCOL_ERROR','952947bsTFCh','getState','pendingMutationCount','entry\x20must\x20not\x20be\x20empty','export','changeset-rejected','Worker\x20returned\x20an\x20invalid\x20write\x20result','baseRevision','error','message','mode','get-state','Worker\x20returned\x20an\x20invalid\x20operation\x20status','fetch','\x20exited\x20unexpectedly\x20with\x20','openTimeoutMs','reject','execute-read','name','Worker\x20returned\x20invalid\x20pending\x20mutations','execute-write','COLLABORATION_WORKER_OPERATION_TIMEOUT','executeWriteCode','object','length','kill','assign','offline','3598497kraFvj','reqId','260IhCYxv','set','closed','Worker\x20returned\x20invalid\x20UnitData','timer','permission-rejected','INSTANCE_POOL_CAPACITY_EXCEEDED','8444NlQTsg','operation-complete','isFinite','connection','COLLABORATION_POOL_CAPACITY_EXCEEDED','sid','.ts','INSTANCE_POOL_CLOSED','5085330yNlGCQ','href','Collaboration\x20runtime\x20lease\x20','retry','resolve','COLLABORATION_CLOSED','write','\x20timed\x20out\x20after\x20','operationTimeoutMs','fetched','COLLABORATION_WORKER_CRASHED','knownHeadRevision','string','nothing-to-commit','cache','instance-failed','invalidate','4638488Qrkhwl','entry\x20must\x20be\x20an\x20absolute\x20file\x20URL\x20or\x20another\x20importable\x20URL','Worker\x20returned\x20an\x20invalid\x20read\x20value','mutations','release','worker-child.ts','Worker\x20','\x20failed:\x20','Failed\x20to\x20send\x20a\x20request\x20to\x20worker\x20','Worker\x20returned\x20an\x20invalid\x20operation\x20result','COLLABORATION_','state','init','status','get','retryable','boolean','pull-required','code','COLLABORATION_LEASE_CLOSED','8288875xPRaxF','COLLABORATION_POOL_INVALID_INPUT','exit','ipc','clear','reconnecting','executeReadCode','replacePendingMutations','get-pending-mutations'];_0x190f=function(){return _0x5b7758;};return _0x190f();}function m(_0x55c85f,_0xad450f){const _0x1f7bf5=_0x440440;let _0x4253a2=p(_0x55c85f);if(typeof _0x4253a2[_0x1f7bf5(0x163)]!=_0x1f7bf5(0x1e1)||!_0xad450f[_0x1f7bf5(0x198)](_0x4253a2[_0x1f7bf5(0x163)]))throw _(_0x1f7bf5(0x1b4));return _0x4253a2;}function h(_0x21acf3){const _0x4eadf3=_0x440440;if(_0x21acf3[_0x4eadf3(0x168)]?.[_0x4eadf3(0x174)](_0x4eadf3(0x160))&&!_0x21acf3[_0x4eadf3(0x168)][_0x4eadf3(0x174)]('COLLABORATION_WORKER_')){let _0x1d27ec=new _0x33df9a(_0x21acf3['code'],_0x21acf3['message'],{'retryable':_0x21acf3[_0x4eadf3(0x165)]??!0x1});return _0x21acf3[_0x4eadf3(0x185)]!==void 0x0&&(_0x1d27ec['stack']=_0x21acf3['stack']),_0x21acf3[_0x4eadf3(0x18e)]&&Object[_0x4eadf3(0x1c2)](_0x1d27ec,{'invalidatesInstance':!0x0}),_0x1d27ec;}let _0x31ee41=Error(_0x21acf3[_0x4eadf3(0x1b1)]);return _0x31ee41[_0x4eadf3(0x1ba)]=_0x21acf3[_0x4eadf3(0x1ba)],_0x21acf3['code']!==void 0x0&&Object[_0x4eadf3(0x1c2)](_0x31ee41,{'code':_0x21acf3['code']}),_0x21acf3[_0x4eadf3(0x18e)]&&Object['assign'](_0x31ee41,{'invalidatesInstance':!0x0}),_0x21acf3[_0x4eadf3(0x185)]!==void 0x0&&(_0x31ee41[_0x4eadf3(0x185)]=_0x21acf3['stack']),_0x31ee41;}function g(_0xb0a07a,_0x40fcf1){const _0x198a97=_0x440440;return new c(_0x198a97(0x1df),_0xb0a07a,{..._0x40fcf1===void 0x0?{}:{'cause':_0x40fcf1},'invalidatesInstance':!0x0});}function _(_0x2d7b62){const _0x1ea09e=_0x440440;return new c(_0x1ea09e(0x17f),_0x2d7b62,{'invalidatesInstance':!0x0});}function v(_0x585188){const _0x4aba48=_0x440440;return E(_0x585188)&&Number[_0x4aba48(0x178)](_0x585188['id'])&&(_0x585188[_0x4aba48(0x190)]===_0x4aba48(0x19d)||_0x585188[_0x4aba48(0x190)]===_0x4aba48(0x1b0));}function y(_0x4d7246){return _0x4d7246===0x1||_0x4d7246===0x2||_0x4d7246===0x3||_0x4d7246===0x5||_0x4d7246===0x6;}function b(_0x37f9f1){const _0x12d82b=_0x440440;return _0x37f9f1===_0x12d82b(0x18f)||_0x37f9f1===_0x12d82b(0x16f)||_0x37f9f1===_0x12d82b(0x1c3)||_0x37f9f1===_0x12d82b(0x1c8);}function x(_0x39fc58){const _0xc6ad2=_0x440440;return _0x39fc58===null||E(_0x39fc58)&&T(_0x39fc58['baseRevision'])&&T(_0x39fc58['revision'])&&T(_0x39fc58['mutationCount'])&&(_0x39fc58[_0xc6ad2(0x1d2)]===void 0x0||typeof _0x39fc58[_0xc6ad2(0x1d2)]==_0xc6ad2(0x1e1))&&(_0x39fc58[_0xc6ad2(0x1c5)]===void 0x0||T(_0x39fc58['reqId']));}function S(_0x755b7d){const _0x16145e=_0x440440;return _0x755b7d===null||E(_0x755b7d)&&(_0x755b7d[_0x16145e(0x179)]===_0x16145e(0x17b)||_0x755b7d[_0x16145e(0x179)]===_0x16145e(0x19e))&&(_0x755b7d[_0x16145e(0x173)]==='transform-failed'||_0x755b7d[_0x16145e(0x173)]===_0x16145e(0x1ad)||_0x755b7d[_0x16145e(0x173)]===_0x16145e(0x1cb))&&typeof _0x755b7d[_0x16145e(0x1b1)]==_0x16145e(0x1e1);}function C(_0xb42182){const _0xdf2b03=_0x440440;return Array[_0xdf2b03(0x184)](_0xb42182)&&_0xb42182[_0xdf2b03(0x192)](_0x3f8580=>E(_0x3f8580)&&typeof _0x3f8580['id']=='string'&&_0x3f8580['id'][_0xdf2b03(0x1c0)]>0x0&&typeof _0x3f8580['data']==_0xdf2b03(0x1e1));}function w(_0x5d59d2){const _0x5b5e7a=_0x440440;return _0x5d59d2===null||typeof _0x5d59d2==_0x5b5e7a(0x166)||typeof _0x5d59d2==_0x5b5e7a(0x1e1)||typeof _0x5d59d2==_0x5b5e7a(0x197)&&Number['isFinite'](_0x5d59d2)?!0x0:Array[_0x5b5e7a(0x184)](_0x5d59d2)?_0x5d59d2[_0x5b5e7a(0x192)](w):E(_0x5d59d2)&&Object[_0x5b5e7a(0x194)](_0x5d59d2)['every'](w);}function T(_0x283ad8){const _0x136fc5=_0x440440;return Number[_0x136fc5(0x178)](_0x283ad8)&&Number(_0x283ad8)>=0x0;}function E(_0x269b6c){return typeof _0x269b6c=='object'&&!!_0x269b6c&&!Array['isArray'](_0x269b6c);}var D=0x7530,O=0x7530;function k(_0x965232){const _0x5a0388=_0x440440;let _0x2da6ef=A(_0x965232['entry']),_0x1a47e2=_0x965232['openTimeoutMs']??D,_0x115607=_0x965232['operationTimeoutMs']??O;j(_0x1a47e2,_0x5a0388(0x1b7)),j(_0x115607,'operationTimeoutMs');let _0x1544dc;try{_0x1544dc=_0x2cb8cd({'factory':{async 'create'(_0x54e7bd){const _0x3c16b7=_0x5a0388;return await l({'entry':_0x2da6ef,..._0x965232[_0x3c16b7(0x1a2)]===void 0x0?{}:{'env':_0x965232[_0x3c16b7(0x1a2)]},'init':_0x54e7bd[_0x3c16b7(0x162)],'key':_0x54e7bd['key'],'openTimeoutMs':_0x1a47e2,'operationTimeoutMs':_0x115607});},async 'destroy'({instance:_0x1543f1}){const _0x31cc0e=_0x5a0388;await _0x1543f1[_0x31cc0e(0x18b)]();}},..._0x965232[_0x5a0388(0x1e3)]===void 0x0?{}:{'cache':_0x965232[_0x5a0388(0x1e3)]},'onEvent':_0x54fb52});}catch(_0x37a4d9){throw M(_0x37a4d9);}return{async 'acquire'(_0x6bea62){const _0x412b50=_0x5a0388;let _0x2c8a9f;try{_0x2c8a9f=await _0x1544dc[_0x412b50(0x18c)](_0x6bea62);}catch(_0x139c52){throw M(_0x139c52);}return _0x3bef0d(_0x2c8a9f);},async 'close'(){try{await _0x1544dc['close']();}catch(_0x430915){throw M(_0x430915);}}};function _0x3bef0d(_0x597135){const _0x3213dd=_0x5a0388;let _0x50433e=_0x597135['instance'],_0x111405=!0x1,_0x486209,_0x3a3957=!0x1;return{'key':_0x597135[_0x3213dd(0x180)],'unitId':_0x50433e['unitId'],'unitType':_0x50433e[_0x3213dd(0x188)],async 'getState'(){const _0x34b779=_0x3213dd;return await _0x3eda95(_0x34b779(0x161),async()=>await _0x50433e[_0x34b779(0x1a9)]());},async 'getPendingMutations'(){const _0x19337b=_0x3213dd;return await _0x3eda95(_0x19337b(0x189),async()=>await _0x50433e['getPendingMutations']());},async 'execute'(_0xfe31e0){const _0x4dedde=_0x3213dd;return _0xfe31e0[_0x4dedde(0x1b2)]==='read'?await _0x3eda95(_0x4dedde(0x19c),async()=>await _0x50433e[_0x4dedde(0x170)](_0xfe31e0['code'])):await _0x3eda95(_0x4dedde(0x1db),async()=>await _0x50433e[_0x4dedde(0x1be)](_0xfe31e0[_0x4dedde(0x168)]));},async 'replacePendingMutations'(_0x14922b){const _0x39d5da=_0x3213dd;return await _0x3eda95('replace-mutations',async()=>await _0x50433e[_0x39d5da(0x171)](_0x14922b));},async 'fetch'(){const _0x56569b=_0x3213dd;return await _0x3eda95(_0x56569b(0x1b5),async()=>await _0x50433e['fetch']());},async 'pull'(){const _0x50d88e=_0x3213dd;return await _0x3eda95(_0x50d88e(0x17b),async()=>await _0x50433e['pull']());},async 'commit'(){return await _0x3eda95('commit',async()=>await _0x50433e['commit']());},async 'exportUnitData'(){const _0x20f305=_0x3213dd;return await _0x3eda95(_0x20f305(0x1ac),async()=>await _0x50433e[_0x20f305(0x177)]());},async 'invalidate'(){const _0x45b260=_0x3213dd;_0x111405||(_0x111405=!0x0,await _0x597135[_0x45b260(0x1e5)]());},async 'release'(){const _0x2ab04d=_0x3213dd;_0x111405||(_0x111405=!0x0,_0x3a3957?await _0x597135[_0x2ab04d(0x1e5)]():await _0x597135[_0x2ab04d(0x15a)]());}};async function _0x3eda95(_0x3842f7,_0x358070){_0x1a9f0e();try{return await _0x592316(_0x597135['key'],_0x3842f7,_0x358070);}catch(_0xd24824){throw _0x40adc2(_0xd24824),_0xd24824;}}function _0x1a9f0e(){const _0x2495d8=_0x3213dd;if(_0x111405)throw new c(_0x2495d8(0x169),_0x2495d8(0x1d7)+_0x597135[_0x2495d8(0x180)]+'\x20is\x20closed');if(_0x486209)throw _0x486209;}function _0x40adc2(_0x33edd2){const _0x3358f6=_0x3213dd;(_0x33edd2 instanceof c&&_0x33edd2[_0x3358f6(0x18e)]||_0x33edd2 instanceof _0x33df9a&&(_0x33edd2['code']===_0x3358f6(0x1a7)||_0x33edd2[_0x3358f6(0x168)]===_0x3358f6(0x1da)||_0x33edd2[_0x3358f6(0x168)]===_0x3358f6(0x181))||typeof _0x33edd2==_0x3358f6(0x1bf)&&_0x33edd2&&_0x3358f6(0x18e)in _0x33edd2&&_0x33edd2[_0x3358f6(0x18e)]===!0x0)&&(_0x3a3957=!0x0,_0x486209=_0x33edd2,_0x542bd6({'errorCode':N(_0x33edd2),'key':_0x597135[_0x3358f6(0x180)],'type':_0x3358f6(0x1e4)}));}}async function _0x592316(_0xec5d96,_0x39c312,_0x3820f1){const _0x4701b0=_0x5a0388;let _0x27eb36=Date['now'](),_0x1d51fc=await _0x3820f1();return _0x542bd6({'durationMs':Date['now']()-_0x27eb36,'key':_0xec5d96,'operation':_0x39c312,'type':_0x4701b0(0x1ce)}),_0x1d51fc;}function _0x54fb52(_0x2368d1){_0x542bd6(_0x2368d1);}function _0x542bd6(_0x28f7f8){try{_0x965232['onEvent']?.(_0x28f7f8);}catch{}}}function A(_0x58c2b0){const _0x448014=_0x440440;let _0x4a0b47=_0x58c2b0 instanceof URL?_0x58c2b0[_0x448014(0x1d6)]:_0x58c2b0;if(_0x4a0b47[_0x448014(0x1c0)]===0x0)throw new c('COLLABORATION_POOL_INVALID_INPUT',_0x448014(0x1ab));try{return new URL(_0x4a0b47)[_0x448014(0x1d6)];}catch{throw new c(_0x448014(0x16b),_0x448014(0x1e7));}}function j(_0x4874ea,_0x4d0699){const _0x40ecf8=_0x440440;if(!Number[_0x40ecf8(0x1cf)](_0x4874ea)||_0x4874ea<=0x0)throw new c(_0x40ecf8(0x16b),_0x4d0699+'\x20must\x20be\x20a\x20finite\x20positive\x20number');}function M(_0x222c72){const _0x4b70f5=_0x440440;return _0x222c72 instanceof _0x316f6f?new c(_0x222c72['code']===_0x4b70f5(0x1cc)?_0x4b70f5(0x1d1):_0x222c72[_0x4b70f5(0x168)]===_0x4b70f5(0x1d4)?_0x4b70f5(0x1a0):_0x4b70f5(0x16b),_0x222c72[_0x4b70f5(0x1b1)],{'cause':_0x222c72}):_0x222c72;}function N(_0x1d90c2){const _0xcbfc4c=_0x440440;return typeof _0x1d90c2==_0xcbfc4c(0x1bf)&&_0x1d90c2&&_0xcbfc4c(0x168)in _0x1d90c2&&typeof _0x1d90c2[_0xcbfc4c(0x168)]==_0xcbfc4c(0x1e1)?_0x1d90c2[_0xcbfc4c(0x168)]:'UNKNOWN';}function P(_0xf6519e){return _0xf6519e;}function _0x52a6(_0x78233,_0x79571b){_0x78233=_0x78233-0x158;const _0x190f89=_0x190f();let _0x52a6df=_0x190f89[_0x78233];return _0x52a6df;}export{c as UniverCollaborationRuntimePoolError,k as createUniverCollaborationRuntimePool,P as defineUniverCollaborationRuntimeWorker};
|
package/dist/worker-child.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function _0x98ea(){const _0x5d1aa4=['error','closed','unitType','195854soFwUd','connected','replace-mutations','exportUnitData','string','read','Collaboration\x20worker\x20is\x20not\x20open','open','type','get-state','default','fetch','retryable','1346268btkHfX','unitId','mutations','stack','connection','Collaboration\x20worker\x20entry\x20must\x20default-export\x20a\x20worker\x20definition','5uOFBRq','8aFdMxI','isSafeInteger','2339776hataiP','object','114ZtCOvo','5672034QLhUuW','14935160kBPhXi','name','createRuntime','replacePendingMutations','Error','init','getState','close','function','code','pull','result','getPendingMutations','commit','4301895RWoZXn','179249pSTwGA'];_0x98ea=function(){return _0x5d1aa4;};return _0x98ea();}(function(_0x1691f7,_0x616d7f){const _0x5beb03=_0x7747,_0x9e5038=_0x1691f7();while(!![]){try{const _0x4382fb=parseInt(_0x5beb03(0x197))/0x1*(-parseInt(_0x5beb03(0x184))/0x2)+-parseInt(_0x5beb03(0x191))/0x3+-parseInt(_0x5beb03(0x16d))/0x4+parseInt(_0x5beb03(0x17f))/0x5+parseInt(_0x5beb03(0x16f))/0x6*(parseInt(_0x5beb03(0x180))/0x7)+parseInt(_0x5beb03(0x198))/0x8*(-parseInt(_0x5beb03(0x170))/0x9)+parseInt(_0x5beb03(0x171))/0xa;if(_0x4382fb===_0x616d7f)break;else _0x9e5038['push'](_0x9e5038['shift']());}catch(_0x4fa10b){_0x9e5038['push'](_0x9e5038['shift']());}}}(_0x98ea,0xa7b13));function _0x7747(_0xe1dcc,_0x1ff5f2){_0xe1dcc=_0xe1dcc-0x16d;const _0x98ea52=_0x98ea();let _0x77476d=_0x98ea52[_0xe1dcc];return _0x77476d;}var e;process['on']('message',_0x37b714=>{const _0x37739d=_0x7747;a(_0x37b714)&&t(_0x37b714)['then'](_0x3e52ad=>s({'id':_0x37b714['id'],'result':_0x3e52ad,'type':_0x37739d(0x17c)}),_0x2c4aff=>s({'error':o(_0x2c4aff,e?.[_0x37739d(0x177)]()[_0x37739d(0x195)]===_0x37739d(0x182)),'id':_0x37b714['id'],'type':_0x37739d(0x181)}));});async function t(_0x5e14e5){const _0x3b1f2a=_0x7747;if(_0x5e14e5['type']===_0x3b1f2a(0x18b)){if(e!==void 0x0)throw Error('Collaboration\x20worker\x20is\x20already\x20open');let _0x37a9ca=await import(_0x5e14e5.entry);if(!i(_0x37a9ca[_0x3b1f2a(0x18e)]))throw Error(_0x3b1f2a(0x196));return e=await _0x37a9ca[_0x3b1f2a(0x18e)][_0x3b1f2a(0x173)](_0x5e14e5[_0x3b1f2a(0x176)]),r(e);}if(_0x5e14e5['type']===_0x3b1f2a(0x178))return await e?.[_0x3b1f2a(0x178)](),e=void 0x0,null;let _0x218feb=n();return _0x5e14e5[_0x3b1f2a(0x18c)]===_0x3b1f2a(0x18d)?_0x218feb[_0x3b1f2a(0x177)]():_0x5e14e5['type']==='get-pending-mutations'?_0x218feb[_0x3b1f2a(0x17d)]():_0x5e14e5[_0x3b1f2a(0x18c)]==='execute-read'?await _0x218feb['execute']({'code':_0x5e14e5[_0x3b1f2a(0x17a)],'mode':_0x3b1f2a(0x189)}):_0x5e14e5[_0x3b1f2a(0x18c)]==='execute-write'?await _0x218feb['execute']({'code':_0x5e14e5[_0x3b1f2a(0x17a)],'mode':'write'}):_0x5e14e5[_0x3b1f2a(0x18c)]===_0x3b1f2a(0x186)?await _0x218feb[_0x3b1f2a(0x174)](_0x5e14e5[_0x3b1f2a(0x193)]):_0x5e14e5[_0x3b1f2a(0x18c)]===_0x3b1f2a(0x18f)?await _0x218feb['fetch']():_0x5e14e5[_0x3b1f2a(0x18c)]===_0x3b1f2a(0x17b)?await _0x218feb[_0x3b1f2a(0x17b)]():_0x5e14e5[_0x3b1f2a(0x18c)]==='commit'?await _0x218feb[_0x3b1f2a(0x17e)]():await _0x218feb[_0x3b1f2a(0x187)]();}function n(){const _0x38474d=_0x7747;if(!e)throw Error(_0x38474d(0x18a));return e;}function r(_0x43617b){const _0x5de497=_0x7747;return{'unitId':_0x43617b[_0x5de497(0x192)],'unitType':_0x43617b[_0x5de497(0x183)]};}function i(_0x3c7113){const _0x411d2f=_0x7747;return typeof _0x3c7113==_0x411d2f(0x16e)&&!!_0x3c7113&&_0x411d2f(0x173)in _0x3c7113&&typeof _0x3c7113[_0x411d2f(0x173)]==_0x411d2f(0x179);}function a(_0x566fa5){const _0x163ecd=_0x7747;return typeof _0x566fa5==_0x163ecd(0x16e)&&!!_0x566fa5&&'id'in _0x566fa5&&Number[_0x163ecd(0x199)](_0x566fa5['id'])&&_0x163ecd(0x18c)in _0x566fa5&&typeof _0x566fa5[_0x163ecd(0x18c)]==_0x163ecd(0x188);}function o(_0x5bb02c,_0x1d9f23){const _0x44b40c=_0x7747;if(!(_0x5bb02c instanceof Error))return{'invalidatesInstance':_0x1d9f23,'message':String(_0x5bb02c),'name':_0x44b40c(0x175)};let _0x417e82=_0x5bb02c;return{...typeof _0x417e82[_0x44b40c(0x17a)]==_0x44b40c(0x188)?{'code':_0x417e82['code']}:{},..._0x1d9f23?{'invalidatesInstance':!0x0}:{},'message':_0x5bb02c['message'],'name':_0x5bb02c[_0x44b40c(0x172)],...typeof _0x417e82['retryable']=='boolean'?{'retryable':_0x417e82[_0x44b40c(0x190)]}:{},..._0x5bb02c['stack']===void 0x0?{}:{'stack':_0x5bb02c[_0x44b40c(0x194)]}};}function s(_0x56b3c4){const _0x41167c=_0x7747;process[_0x41167c(0x185)]&&process['send']?.(_0x56b3c4);}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univer-cli/univer-collaboration-runtime-pool",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-
|
|
4
|
+
"version": "1.0.0-rc.0",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"README.zh-CN.md"
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@univer-cli/generic-keyed-instance-pool": "1.0.0-
|
|
22
|
-
"@univer-cli/univer-collaboration-runtime": "1.0.0-
|
|
23
|
-
"@univerjs/protocol": "1.0.0-
|
|
21
|
+
"@univer-cli/generic-keyed-instance-pool": "1.0.0-rc.0",
|
|
22
|
+
"@univer-cli/univer-collaboration-runtime": "1.0.0-rc.0",
|
|
23
|
+
"@univerjs/protocol": "1.0.0-rc.0"
|
|
24
24
|
}
|
|
25
25
|
}
|