@univerjs/rpc-node 0.16.1 → 0.17.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/lib/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var R=Object.defineProperty;var N=(n,e,r)=>e in n?R(n,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[e]=r;var a=(n,e,r)=>N(n,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("node:child_process"),P=require("node:process"),c=require("@univerjs/core"),s=require("@univerjs/rpc"),u=require("rxjs"),m="@univerjs/rpc-node",I="0.17.0",h={name:m,version:I},y="rpc-node.main-thread.config",v={},U="rpc-node.worker-thread.config",p={};var j=Object.getOwnPropertyDescriptor,f=(n,e,r,o)=>{for(var t=o>1?void 0:o?j(e,r):e,i=n.length-1,l;i>=0;i--)(l=n[i])&&(t=l(t)||t);return t},_=(n,e)=>(r,o)=>e(r,o,n),g;exports.UniverRPCNodeMainPlugin=(g=class extends c.Plugin{constructor(r=v,o,t){super();a(this,"_child",null);this._config=r,this._injector=o,this._configService=t;const{...i}=c.merge({},v,this._config);this._configService.setConfig(y,i)}onStarting(){const{workerSrc:r}=this._config;if(!r)throw new Error("[UniverRPCNodeMainPlugin] workerSrc is required for UniverRPCNodeMainPlugin");const[o,t]=k(this._injector,r);[[s.IRPCChannelService,{useFactory:()=>new s.ChannelService(o)}],[s.DataSyncPrimaryController],[s.IRemoteSyncService,{useClass:s.RemoteSyncPrimaryService}]].forEach(l=>this._injector.add(l)),this._injector.get(s.DataSyncPrimaryController),this._child=t}dispose(){if(super.dispose(),this._child){try{this._child.kill()}catch(r){console.error("Failed to kill child process:",r)}this._child=null}}},a(g,"pluginName","UNIVER_RPC_NODE_MAIN_PLUGIN"),a(g,"packageName",h.name),a(g,"version",h.version),g);exports.UniverRPCNodeMainPlugin=f([_(1,c.Inject(c.Injector)),_(2,c.IConfigService)],exports.UniverRPCNodeMainPlugin);var d;exports.UniverRPCNodeWorkerPlugin=(d=class extends c.Plugin{constructor(e=p,r,o){super(),this._config=e,this._injector=r,this._configService=o;const{...t}=c.merge({},p,this._config);this._configService.setConfig(U,t)}onStarting(){[[s.DataSyncReplicaController],[s.IRPCChannelService,{useFactory:()=>new s.ChannelService(M())}],[s.IRemoteInstanceService,{useClass:s.WebWorkerRemoteInstanceService}]].forEach(e=>this._injector.add(e)),this._injector.get(s.DataSyncReplicaController)}},a(d,"pluginName","UNIVER_RPC_NODE_WORKER_PLUGIN"),a(d,"packageName",h.name),a(d,"version",h.version),d);exports.UniverRPCNodeWorkerPlugin=f([_(1,c.Inject(c.Injector)),_(2,c.IConfigService)],exports.UniverRPCNodeWorkerPlugin);function k(n,e){const r=n.get(c.ILogService),o=S.fork(e);return o.on("spawn",()=>r.log("Child computing process spawned!")),o.on("error",i=>r.error(i)),[{send(i){o.send(i)},onMessage:new u.Observable(i=>{const l=C=>{i.next(C)};return o.on("message",l),()=>o.off("message",l)}).pipe(u.shareReplay(1))},o]}function M(){return{send(n){P.send(n)},onMessage:new u.Observable(n=>{const e=r=>{n.next(r)};return P.on("message",e),()=>P.off("message",e)}).pipe(u.shareReplay(1))}}
|
package/lib/es/index.js
CHANGED
|
@@ -1,41 +1,45 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var M = Object.defineProperty;
|
|
2
|
+
var O = (r, e, n) => e in r ? M(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
|
|
3
|
+
var s = (r, e, n) => O(r, typeof e != "symbol" ? e + "" : e, n);
|
|
4
4
|
import { fork as U } from "node:child_process";
|
|
5
|
-
import
|
|
6
|
-
import { Inject as P, Injector as
|
|
7
|
-
import { IRPCChannelService as
|
|
8
|
-
import { Observable as
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
import h from "node:process";
|
|
6
|
+
import { Inject as P, Injector as C, IConfigService as N, Plugin as R, merge as S, ILogService as D } from "@univerjs/core";
|
|
7
|
+
import { IRPCChannelService as I, ChannelService as w, DataSyncPrimaryController as _, IRemoteSyncService as W, RemoteSyncPrimaryService as G, DataSyncReplicaController as f, IRemoteInstanceService as x, WebWorkerRemoteInstanceService as F } from "@univerjs/rpc";
|
|
8
|
+
import { Observable as E, shareReplay as k } from "rxjs";
|
|
9
|
+
const L = "@univerjs/rpc-node", b = "0.17.0", g = {
|
|
10
|
+
name: L,
|
|
11
|
+
version: b
|
|
12
|
+
}, A = "rpc-node.main-thread.config", p = {}, K = "rpc-node.worker-thread.config", m = {};
|
|
13
|
+
var T = Object.getOwnPropertyDescriptor, j = (r, e, n, o) => {
|
|
14
|
+
for (var i = o > 1 ? void 0 : o ? T(e, n) : e, t = r.length - 1, c; t >= 0; t--)
|
|
15
|
+
(c = r[t]) && (i = c(i) || i);
|
|
13
16
|
return i;
|
|
14
|
-
},
|
|
15
|
-
let u = (
|
|
16
|
-
constructor(e =
|
|
17
|
+
}, d = (r, e) => (n, o) => e(n, o, r), a;
|
|
18
|
+
let u = (a = class extends R {
|
|
19
|
+
constructor(e = p, n, o) {
|
|
17
20
|
super();
|
|
18
|
-
|
|
19
|
-
this._config = e, this._injector =
|
|
21
|
+
s(this, "_child", null);
|
|
22
|
+
this._config = e, this._injector = n, this._configService = o;
|
|
20
23
|
const { ...i } = S(
|
|
21
24
|
{},
|
|
22
|
-
|
|
25
|
+
p,
|
|
23
26
|
this._config
|
|
24
27
|
);
|
|
25
|
-
this._configService.setConfig(
|
|
28
|
+
this._configService.setConfig(A, i);
|
|
26
29
|
}
|
|
27
30
|
onStarting() {
|
|
28
31
|
const { workerSrc: e } = this._config;
|
|
29
32
|
if (!e)
|
|
30
33
|
throw new Error("[UniverRPCNodeMainPlugin] workerSrc is required for UniverRPCNodeMainPlugin");
|
|
31
|
-
const [
|
|
34
|
+
const [n, o] = H(this._injector, e);
|
|
32
35
|
[
|
|
33
|
-
[
|
|
34
|
-
|
|
36
|
+
[I, {
|
|
37
|
+
// eslint-disable-next-line react/no-unnecessary-use-prefix
|
|
38
|
+
useFactory: () => new w(n)
|
|
35
39
|
}],
|
|
36
|
-
[
|
|
37
|
-
[
|
|
38
|
-
].forEach((t) => this._injector.add(t)), this._injector.get(
|
|
40
|
+
[_],
|
|
41
|
+
[W, { useClass: G }]
|
|
42
|
+
].forEach((t) => this._injector.add(t)), this._injector.get(_), this._child = o;
|
|
39
43
|
}
|
|
40
44
|
dispose() {
|
|
41
45
|
if (super.dispose(), this._child) {
|
|
@@ -47,64 +51,65 @@ let u = (g = class extends R {
|
|
|
47
51
|
this._child = null;
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
|
-
},
|
|
51
|
-
u =
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
}, s(a, "pluginName", "UNIVER_RPC_NODE_MAIN_PLUGIN"), s(a, "packageName", g.name), s(a, "version", g.version), a);
|
|
55
|
+
u = j([
|
|
56
|
+
d(1, P(C)),
|
|
57
|
+
d(2, N)
|
|
54
58
|
], u);
|
|
55
|
-
var
|
|
56
|
-
let
|
|
57
|
-
constructor(r =
|
|
58
|
-
super(), this._config = r, this._injector = e, this._configService =
|
|
59
|
-
const { ...
|
|
59
|
+
var l;
|
|
60
|
+
let v = (l = class extends R {
|
|
61
|
+
constructor(r = m, e, n) {
|
|
62
|
+
super(), this._config = r, this._injector = e, this._configService = n;
|
|
63
|
+
const { ...o } = S(
|
|
60
64
|
{},
|
|
61
|
-
|
|
65
|
+
m,
|
|
62
66
|
this._config
|
|
63
67
|
);
|
|
64
|
-
this._configService.setConfig(
|
|
68
|
+
this._configService.setConfig(K, o);
|
|
65
69
|
}
|
|
66
70
|
onStarting() {
|
|
67
71
|
[
|
|
68
|
-
[
|
|
69
|
-
[
|
|
70
|
-
|
|
72
|
+
[f],
|
|
73
|
+
[I, {
|
|
74
|
+
// eslint-disable-next-line react/no-unnecessary-use-prefix
|
|
75
|
+
useFactory: () => new w(V())
|
|
71
76
|
}],
|
|
72
|
-
[
|
|
73
|
-
].forEach((r) => this._injector.add(r)), this._injector.get(
|
|
77
|
+
[x, { useClass: F }]
|
|
78
|
+
].forEach((r) => this._injector.add(r)), this._injector.get(f);
|
|
74
79
|
}
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
],
|
|
80
|
-
function
|
|
81
|
-
const
|
|
82
|
-
return
|
|
80
|
+
}, s(l, "pluginName", "UNIVER_RPC_NODE_WORKER_PLUGIN"), s(l, "packageName", g.name), s(l, "version", g.version), l);
|
|
81
|
+
v = j([
|
|
82
|
+
d(1, P(C)),
|
|
83
|
+
d(2, N)
|
|
84
|
+
], v);
|
|
85
|
+
function H(r, e) {
|
|
86
|
+
const n = r.get(D), o = U(e);
|
|
87
|
+
return o.on("spawn", () => n.log("Child computing process spawned!")), o.on("error", (t) => n.error(t)), [{
|
|
83
88
|
send(t) {
|
|
84
|
-
|
|
89
|
+
o.send(t);
|
|
85
90
|
},
|
|
86
|
-
onMessage: new
|
|
87
|
-
const
|
|
88
|
-
t.next(
|
|
91
|
+
onMessage: new E((t) => {
|
|
92
|
+
const c = (y) => {
|
|
93
|
+
t.next(y);
|
|
89
94
|
};
|
|
90
|
-
return
|
|
91
|
-
}).pipe(
|
|
92
|
-
},
|
|
95
|
+
return o.on("message", c), () => o.off("message", c);
|
|
96
|
+
}).pipe(k(1))
|
|
97
|
+
}, o];
|
|
93
98
|
}
|
|
94
|
-
function
|
|
99
|
+
function V() {
|
|
95
100
|
return {
|
|
96
101
|
send(r) {
|
|
97
|
-
|
|
102
|
+
h.send(r);
|
|
98
103
|
},
|
|
99
|
-
onMessage: new
|
|
100
|
-
const e = (
|
|
101
|
-
r.next(
|
|
104
|
+
onMessage: new E((r) => {
|
|
105
|
+
const e = (n) => {
|
|
106
|
+
r.next(n);
|
|
102
107
|
};
|
|
103
|
-
return
|
|
104
|
-
}).pipe(
|
|
108
|
+
return h.on("message", e), () => h.off("message", e);
|
|
109
|
+
}).pipe(k(1))
|
|
105
110
|
};
|
|
106
111
|
}
|
|
107
112
|
export {
|
|
108
113
|
u as UniverRPCNodeMainPlugin,
|
|
109
|
-
|
|
114
|
+
v as UniverRPCNodeWorkerPlugin
|
|
110
115
|
};
|
package/lib/index.js
CHANGED
|
@@ -1,41 +1,45 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var M = Object.defineProperty;
|
|
2
|
+
var O = (r, e, n) => e in r ? M(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
|
|
3
|
+
var s = (r, e, n) => O(r, typeof e != "symbol" ? e + "" : e, n);
|
|
4
4
|
import { fork as U } from "node:child_process";
|
|
5
|
-
import
|
|
6
|
-
import { Inject as P, Injector as
|
|
7
|
-
import { IRPCChannelService as
|
|
8
|
-
import { Observable as
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
import h from "node:process";
|
|
6
|
+
import { Inject as P, Injector as C, IConfigService as N, Plugin as R, merge as S, ILogService as D } from "@univerjs/core";
|
|
7
|
+
import { IRPCChannelService as I, ChannelService as w, DataSyncPrimaryController as _, IRemoteSyncService as W, RemoteSyncPrimaryService as G, DataSyncReplicaController as f, IRemoteInstanceService as x, WebWorkerRemoteInstanceService as F } from "@univerjs/rpc";
|
|
8
|
+
import { Observable as E, shareReplay as k } from "rxjs";
|
|
9
|
+
const L = "@univerjs/rpc-node", b = "0.17.0", g = {
|
|
10
|
+
name: L,
|
|
11
|
+
version: b
|
|
12
|
+
}, A = "rpc-node.main-thread.config", p = {}, K = "rpc-node.worker-thread.config", m = {};
|
|
13
|
+
var T = Object.getOwnPropertyDescriptor, j = (r, e, n, o) => {
|
|
14
|
+
for (var i = o > 1 ? void 0 : o ? T(e, n) : e, t = r.length - 1, c; t >= 0; t--)
|
|
15
|
+
(c = r[t]) && (i = c(i) || i);
|
|
13
16
|
return i;
|
|
14
|
-
},
|
|
15
|
-
let u = (
|
|
16
|
-
constructor(e =
|
|
17
|
+
}, d = (r, e) => (n, o) => e(n, o, r), a;
|
|
18
|
+
let u = (a = class extends R {
|
|
19
|
+
constructor(e = p, n, o) {
|
|
17
20
|
super();
|
|
18
|
-
|
|
19
|
-
this._config = e, this._injector =
|
|
21
|
+
s(this, "_child", null);
|
|
22
|
+
this._config = e, this._injector = n, this._configService = o;
|
|
20
23
|
const { ...i } = S(
|
|
21
24
|
{},
|
|
22
|
-
|
|
25
|
+
p,
|
|
23
26
|
this._config
|
|
24
27
|
);
|
|
25
|
-
this._configService.setConfig(
|
|
28
|
+
this._configService.setConfig(A, i);
|
|
26
29
|
}
|
|
27
30
|
onStarting() {
|
|
28
31
|
const { workerSrc: e } = this._config;
|
|
29
32
|
if (!e)
|
|
30
33
|
throw new Error("[UniverRPCNodeMainPlugin] workerSrc is required for UniverRPCNodeMainPlugin");
|
|
31
|
-
const [
|
|
34
|
+
const [n, o] = H(this._injector, e);
|
|
32
35
|
[
|
|
33
|
-
[
|
|
34
|
-
|
|
36
|
+
[I, {
|
|
37
|
+
// eslint-disable-next-line react/no-unnecessary-use-prefix
|
|
38
|
+
useFactory: () => new w(n)
|
|
35
39
|
}],
|
|
36
|
-
[
|
|
37
|
-
[
|
|
38
|
-
].forEach((t) => this._injector.add(t)), this._injector.get(
|
|
40
|
+
[_],
|
|
41
|
+
[W, { useClass: G }]
|
|
42
|
+
].forEach((t) => this._injector.add(t)), this._injector.get(_), this._child = o;
|
|
39
43
|
}
|
|
40
44
|
dispose() {
|
|
41
45
|
if (super.dispose(), this._child) {
|
|
@@ -47,64 +51,65 @@ let u = (g = class extends R {
|
|
|
47
51
|
this._child = null;
|
|
48
52
|
}
|
|
49
53
|
}
|
|
50
|
-
},
|
|
51
|
-
u =
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
}, s(a, "pluginName", "UNIVER_RPC_NODE_MAIN_PLUGIN"), s(a, "packageName", g.name), s(a, "version", g.version), a);
|
|
55
|
+
u = j([
|
|
56
|
+
d(1, P(C)),
|
|
57
|
+
d(2, N)
|
|
54
58
|
], u);
|
|
55
|
-
var
|
|
56
|
-
let
|
|
57
|
-
constructor(r =
|
|
58
|
-
super(), this._config = r, this._injector = e, this._configService =
|
|
59
|
-
const { ...
|
|
59
|
+
var l;
|
|
60
|
+
let v = (l = class extends R {
|
|
61
|
+
constructor(r = m, e, n) {
|
|
62
|
+
super(), this._config = r, this._injector = e, this._configService = n;
|
|
63
|
+
const { ...o } = S(
|
|
60
64
|
{},
|
|
61
|
-
|
|
65
|
+
m,
|
|
62
66
|
this._config
|
|
63
67
|
);
|
|
64
|
-
this._configService.setConfig(
|
|
68
|
+
this._configService.setConfig(K, o);
|
|
65
69
|
}
|
|
66
70
|
onStarting() {
|
|
67
71
|
[
|
|
68
|
-
[
|
|
69
|
-
[
|
|
70
|
-
|
|
72
|
+
[f],
|
|
73
|
+
[I, {
|
|
74
|
+
// eslint-disable-next-line react/no-unnecessary-use-prefix
|
|
75
|
+
useFactory: () => new w(V())
|
|
71
76
|
}],
|
|
72
|
-
[
|
|
73
|
-
].forEach((r) => this._injector.add(r)), this._injector.get(
|
|
77
|
+
[x, { useClass: F }]
|
|
78
|
+
].forEach((r) => this._injector.add(r)), this._injector.get(f);
|
|
74
79
|
}
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
],
|
|
80
|
-
function
|
|
81
|
-
const
|
|
82
|
-
return
|
|
80
|
+
}, s(l, "pluginName", "UNIVER_RPC_NODE_WORKER_PLUGIN"), s(l, "packageName", g.name), s(l, "version", g.version), l);
|
|
81
|
+
v = j([
|
|
82
|
+
d(1, P(C)),
|
|
83
|
+
d(2, N)
|
|
84
|
+
], v);
|
|
85
|
+
function H(r, e) {
|
|
86
|
+
const n = r.get(D), o = U(e);
|
|
87
|
+
return o.on("spawn", () => n.log("Child computing process spawned!")), o.on("error", (t) => n.error(t)), [{
|
|
83
88
|
send(t) {
|
|
84
|
-
|
|
89
|
+
o.send(t);
|
|
85
90
|
},
|
|
86
|
-
onMessage: new
|
|
87
|
-
const
|
|
88
|
-
t.next(
|
|
91
|
+
onMessage: new E((t) => {
|
|
92
|
+
const c = (y) => {
|
|
93
|
+
t.next(y);
|
|
89
94
|
};
|
|
90
|
-
return
|
|
91
|
-
}).pipe(
|
|
92
|
-
},
|
|
95
|
+
return o.on("message", c), () => o.off("message", c);
|
|
96
|
+
}).pipe(k(1))
|
|
97
|
+
}, o];
|
|
93
98
|
}
|
|
94
|
-
function
|
|
99
|
+
function V() {
|
|
95
100
|
return {
|
|
96
101
|
send(r) {
|
|
97
|
-
|
|
102
|
+
h.send(r);
|
|
98
103
|
},
|
|
99
|
-
onMessage: new
|
|
100
|
-
const e = (
|
|
101
|
-
r.next(
|
|
104
|
+
onMessage: new E((r) => {
|
|
105
|
+
const e = (n) => {
|
|
106
|
+
r.next(n);
|
|
102
107
|
};
|
|
103
|
-
return
|
|
104
|
-
}).pipe(
|
|
108
|
+
return h.on("message", e), () => h.off("message", e);
|
|
109
|
+
}).pipe(k(1))
|
|
105
110
|
};
|
|
106
111
|
}
|
|
107
112
|
export {
|
|
108
113
|
u as UniverRPCNodeMainPlugin,
|
|
109
|
-
|
|
114
|
+
v as UniverRPCNodeWorkerPlugin
|
|
110
115
|
};
|
package/lib/types/plugin.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { IUniverRPCNodeMainConfig, IUniverRPCNodeWorkerThreadConfig } from './
|
|
1
|
+
import { IUniverRPCNodeMainConfig, IUniverRPCNodeWorkerThreadConfig } from './config/config';
|
|
2
2
|
import { IConfigService, Injector, Plugin } from '@univerjs/core';
|
|
3
3
|
export declare class UniverRPCNodeMainPlugin extends Plugin {
|
|
4
4
|
private readonly _config;
|
|
5
5
|
protected readonly _injector: Injector;
|
|
6
6
|
private readonly _configService;
|
|
7
7
|
static pluginName: string;
|
|
8
|
+
static packageName: string;
|
|
9
|
+
static version: string;
|
|
8
10
|
private _child;
|
|
9
11
|
constructor(_config: Partial<IUniverRPCNodeMainConfig> | undefined, _injector: Injector, _configService: IConfigService);
|
|
10
12
|
onStarting(): void;
|
|
@@ -15,6 +17,8 @@ export declare class UniverRPCNodeWorkerPlugin extends Plugin {
|
|
|
15
17
|
protected readonly _injector: Injector;
|
|
16
18
|
private readonly _configService;
|
|
17
19
|
static pluginName: string;
|
|
20
|
+
static packageName: string;
|
|
21
|
+
static version: string;
|
|
18
22
|
constructor(_config: Partial<IUniverRPCNodeWorkerThreadConfig> | undefined, _injector: Injector, _configService: IConfigService);
|
|
19
23
|
onStarting(): void;
|
|
20
24
|
}
|
package/lib/umd/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("node:child_process"),require("node:process"),require("@univerjs/core"),require("@univerjs/rpc"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","node:child_process","node:process","@univerjs/core","@univerjs/rpc","rxjs"],o):(e=typeof globalThis<"u"?globalThis:e||self,o(e.UniverRpcNode={},e.node_child_process,e.process,e.UniverCore,e.UniverRpc,e.rxjs))})(this,(function(e,o,l,a,s,
|
|
1
|
+
(function(e,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("node:child_process"),require("node:process"),require("@univerjs/core"),require("@univerjs/rpc"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","node:child_process","node:process","@univerjs/core","@univerjs/rpc","rxjs"],o):(e=typeof globalThis<"u"?globalThis:e||self,o(e.UniverRpcNode={},e.node_child_process,e.process,e.UniverCore,e.UniverRpc,e.rxjs))})(this,(function(e,o,l,a,s,_){"use strict";var U=Object.defineProperty;var k=(e,o,l)=>o in e?U(e,o,{enumerable:!0,configurable:!0,writable:!0,value:l}):e[o]=l;var u=(e,o,l)=>k(e,typeof o!="symbol"?o+"":o,l);var h,v;const f={name:"@univerjs/rpc-node",version:"0.17.0"},p="rpc-node.main-thread.config",C={},N="rpc-node.worker-thread.config",R={};var S=Object.getOwnPropertyDescriptor,m=(t,r,n,i)=>{for(var d=i>1?void 0:i?S(r,n):r,c=t.length-1,g;c>=0;c--)(g=t[c])&&(d=g(d)||d);return d},P=(t,r)=>(n,i)=>r(n,i,t);e.UniverRPCNodeMainPlugin=(h=class extends a.Plugin{constructor(n=C,i,d){super();u(this,"_child",null);this._config=n,this._injector=i,this._configService=d;const{...c}=a.merge({},C,this._config);this._configService.setConfig(p,c)}onStarting(){const{workerSrc:n}=this._config;if(!n)throw new Error("[UniverRPCNodeMainPlugin] workerSrc is required for UniverRPCNodeMainPlugin");const[i,d]=I(this._injector,n);[[s.IRPCChannelService,{useFactory:()=>new s.ChannelService(i)}],[s.DataSyncPrimaryController],[s.IRemoteSyncService,{useClass:s.RemoteSyncPrimaryService}]].forEach(g=>this._injector.add(g)),this._injector.get(s.DataSyncPrimaryController),this._child=d}dispose(){if(super.dispose(),this._child){try{this._child.kill()}catch(n){console.error("Failed to kill child process:",n)}this._child=null}}},u(h,"pluginName","UNIVER_RPC_NODE_MAIN_PLUGIN"),u(h,"packageName",f.name),u(h,"version",f.version),h),e.UniverRPCNodeMainPlugin=m([P(1,a.Inject(a.Injector)),P(2,a.IConfigService)],e.UniverRPCNodeMainPlugin),e.UniverRPCNodeWorkerPlugin=(v=class extends a.Plugin{constructor(r=R,n,i){super(),this._config=r,this._injector=n,this._configService=i;const{...d}=a.merge({},R,this._config);this._configService.setConfig(N,d)}onStarting(){[[s.DataSyncReplicaController],[s.IRPCChannelService,{useFactory:()=>new s.ChannelService(j())}],[s.IRemoteInstanceService,{useClass:s.WebWorkerRemoteInstanceService}]].forEach(r=>this._injector.add(r)),this._injector.get(s.DataSyncReplicaController)}},u(v,"pluginName","UNIVER_RPC_NODE_WORKER_PLUGIN"),u(v,"packageName",f.name),u(v,"version",f.version),v),e.UniverRPCNodeWorkerPlugin=m([P(1,a.Inject(a.Injector)),P(2,a.IConfigService)],e.UniverRPCNodeWorkerPlugin);function I(t,r){const n=t.get(a.ILogService),i=o.fork(r);return i.on("spawn",()=>n.log("Child computing process spawned!")),i.on("error",c=>n.error(c)),[{send(c){i.send(c)},onMessage:new _.Observable(c=>{const g=y=>{c.next(y)};return i.on("message",g),()=>i.off("message",g)}).pipe(_.shareReplay(1))},i]}function j(){return{send(t){l.send(t)},onMessage:new _.Observable(t=>{const r=n=>{t.next(n)};return l.on("message",r),()=>l.off("message",r)}).pipe(_.shareReplay(1))}}Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/rpc-node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -46,15 +46,15 @@
|
|
|
46
46
|
"rxjs": ">=7.0.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@univerjs/core": "0.
|
|
50
|
-
"@univerjs/rpc": "0.
|
|
49
|
+
"@univerjs/core": "0.17.0",
|
|
50
|
+
"@univerjs/rpc": "0.17.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"rxjs": "^7.8.2",
|
|
54
54
|
"typescript": "^5.9.3",
|
|
55
55
|
"vite": "^7.3.1",
|
|
56
56
|
"vitest": "^4.0.18",
|
|
57
|
-
"@univerjs-infra/shared": "0.
|
|
57
|
+
"@univerjs-infra/shared": "0.17.0"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"test": "vitest run",
|
|
File without changes
|