@univerjs/rpc-node 0.8.2-nightly.202506261607 → 0.8.3-nightly.202506271607
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 +1 -1
- package/lib/es/index.js +72 -57
- package/lib/index.js +72 -57
- package/lib/types/controllers/config.schema.d.ts +26 -0
- package/lib/types/plugin.d.ts +4 -6
- package/lib/umd/index.js +1 -1
- package/package.json +4 -4
package/lib/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var R=Object.defineProperty;var S=(n,e,r)=>e in n?R(n,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[e]=r;var d=(n,e,r)=>S(n,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("node:child_process"),u=require("node:process"),s=require("@univerjs/core"),i=require("@univerjs/rpc"),g=require("rxjs"),N="rpc-node.main-thread.config",h={},I="rpc-node.worker-thread.config",v={};var m=Object.getOwnPropertyDescriptor,C=(n,e,r,o)=>{for(var t=o>1?void 0:o?m(e,r):e,c=n.length-1,a;c>=0;c--)(a=n[c])&&(t=a(t)||t);return t},l=(n,e)=>(r,o)=>e(r,o,n),P;exports.UniverRPCNodeMainPlugin=(P=class extends s.Plugin{constructor(e=h,r,o){super(),this._config=e,this._injector=r,this._configService=o;const{...t}=s.merge({},h,this._config);this._configService.setConfig(N,t)}onStarting(){const{workerSrc:e}=this._config;if(!e)throw new Error("[UniverRPCNodeMainPlugin] workerSrc is required for UniverRPCNodeMainPlugin");const r=y(this._injector,e);[[i.IRPCChannelService,{useFactory:()=>new i.ChannelService(r)}],[i.DataSyncPrimaryController],[i.IRemoteSyncService,{useClass:i.RemoteSyncPrimaryService}]].forEach(t=>this._injector.add(t)),this._injector.get(i.DataSyncPrimaryController)}},d(P,"pluginName","UNIVER_RPC_NODE_MAIN_PLUGIN"),P);exports.UniverRPCNodeMainPlugin=C([l(1,s.Inject(s.Injector)),l(2,s.IConfigService)],exports.UniverRPCNodeMainPlugin);var _;exports.UniverRPCNodeWorkerPlugin=(_=class extends s.Plugin{constructor(e=v,r,o){super(),this._config=e,this._injector=r,this._configService=o;const{...t}=s.merge({},v,this._config);this._configService.setConfig(I,t)}onStarting(){[[i.DataSyncReplicaController],[i.IRPCChannelService,{useFactory:()=>new i.ChannelService(U())}],[i.IRemoteInstanceService,{useClass:i.WebWorkerRemoteInstanceService}]].forEach(e=>this._injector.add(e)),this._injector.get(i.DataSyncReplicaController)}},d(_,"pluginName","UNIVER_RPC_NODE_WORKER_PLUGIN"),_);exports.UniverRPCNodeWorkerPlugin=C([l(1,s.Inject(s.Injector)),l(2,s.IConfigService)],exports.UniverRPCNodeWorkerPlugin);function y(n,e){const r=n.get(s.ILogService),o=p.fork(e);return o.on("spawn",()=>r.log("Child computing process spawned!")),o.on("error",c=>r.error(c)),{send(c){o.send(c)},onMessage:new g.Observable(c=>{const a=f=>{c.next(f)};return o.on("message",a),()=>o.off("message",a)}).pipe(g.shareReplay(1))}}function U(){return{send(n){u.send(n)},onMessage:new g.Observable(n=>{const e=r=>{n.next(r)};return u.on("message",e),()=>u.off("message",e)}).pipe(g.shareReplay(1))}}
|
package/lib/es/index.js
CHANGED
|
@@ -1,83 +1,98 @@
|
|
|
1
1
|
var j = Object.defineProperty;
|
|
2
|
-
var y = (e, r,
|
|
3
|
-
var
|
|
4
|
-
import { fork as
|
|
5
|
-
import
|
|
6
|
-
import { Inject as
|
|
7
|
-
import { IRPCChannelService as
|
|
8
|
-
import { Observable as
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
var y = (e, r, n) => r in e ? j(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n;
|
|
3
|
+
var a = (e, r, n) => y(e, typeof r != "symbol" ? r + "" : r, n);
|
|
4
|
+
import { fork as U } from "node:child_process";
|
|
5
|
+
import g from "node:process";
|
|
6
|
+
import { Inject as P, Injector as v, IConfigService as C, Plugin as R, merge as S, ILogService as D } from "@univerjs/core";
|
|
7
|
+
import { IRPCChannelService as N, ChannelService as I, DataSyncPrimaryController as f, IRemoteSyncService as k, RemoteSyncPrimaryService as W, DataSyncReplicaController as d, IRemoteInstanceService as G, WebWorkerRemoteInstanceService as x } from "@univerjs/rpc";
|
|
8
|
+
import { Observable as w, shareReplay as E } from "rxjs";
|
|
9
|
+
const L = "rpc-node.main-thread.config", h = {}, b = "rpc-node.worker-thread.config", m = {};
|
|
10
|
+
var A = Object.getOwnPropertyDescriptor, M = (e, r, n, o) => {
|
|
11
|
+
for (var s = o > 1 ? void 0 : o ? A(r, n) : r, t = e.length - 1, i; t >= 0; t--)
|
|
12
|
+
(i = e[t]) && (s = i(s) || s);
|
|
12
13
|
return s;
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
}, c = (e, r) => (n, o) => r(n, o, e), l;
|
|
15
|
+
let u = (l = class extends R {
|
|
16
|
+
constructor(e = h, r, n) {
|
|
17
|
+
super(), this._config = e, this._injector = r, this._configService = n;
|
|
18
|
+
const { ...o } = S(
|
|
19
|
+
{},
|
|
20
|
+
h,
|
|
21
|
+
this._config
|
|
22
|
+
);
|
|
23
|
+
this._configService.setConfig(L, o);
|
|
19
24
|
}
|
|
20
25
|
onStarting() {
|
|
21
|
-
const { workerSrc: e } = this._config
|
|
26
|
+
const { workerSrc: e } = this._config;
|
|
27
|
+
if (!e)
|
|
28
|
+
throw new Error("[UniverRPCNodeMainPlugin] workerSrc is required for UniverRPCNodeMainPlugin");
|
|
29
|
+
const r = F(this._injector, e);
|
|
22
30
|
[
|
|
23
|
-
[
|
|
31
|
+
[N, {
|
|
24
32
|
useFactory: () => new I(r)
|
|
25
33
|
}],
|
|
26
|
-
[
|
|
27
|
-
[
|
|
28
|
-
].forEach((
|
|
34
|
+
[f],
|
|
35
|
+
[k, { useClass: W }]
|
|
36
|
+
].forEach((o) => this._injector.add(o)), this._injector.get(f);
|
|
29
37
|
}
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
],
|
|
35
|
-
var
|
|
36
|
-
let
|
|
37
|
-
constructor(e, r) {
|
|
38
|
-
super(), this._config = e, this._injector = r;
|
|
38
|
+
}, a(l, "pluginName", "UNIVER_RPC_NODE_MAIN_PLUGIN"), l);
|
|
39
|
+
u = M([
|
|
40
|
+
c(1, P(v)),
|
|
41
|
+
c(2, C)
|
|
42
|
+
], u);
|
|
43
|
+
var _;
|
|
44
|
+
let p = (_ = class extends R {
|
|
45
|
+
constructor(e = m, r, n) {
|
|
46
|
+
super(), this._config = e, this._injector = r, this._configService = n;
|
|
47
|
+
const { ...o } = S(
|
|
48
|
+
{},
|
|
49
|
+
m,
|
|
50
|
+
this._config
|
|
51
|
+
);
|
|
52
|
+
this._configService.setConfig(b, o);
|
|
39
53
|
}
|
|
40
54
|
onStarting() {
|
|
41
55
|
[
|
|
42
|
-
[
|
|
43
|
-
[
|
|
44
|
-
useFactory: () => new I(
|
|
56
|
+
[d],
|
|
57
|
+
[N, {
|
|
58
|
+
useFactory: () => new I(K())
|
|
45
59
|
}],
|
|
46
|
-
[
|
|
47
|
-
].forEach((e) => this._injector.add(e)), this._injector.get(
|
|
60
|
+
[G, { useClass: x }]
|
|
61
|
+
].forEach((e) => this._injector.add(e)), this._injector.get(d);
|
|
48
62
|
}
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
63
|
+
}, a(_, "pluginName", "UNIVER_RPC_NODE_WORKER_PLUGIN"), _);
|
|
64
|
+
p = M([
|
|
65
|
+
c(1, P(v)),
|
|
66
|
+
c(2, C)
|
|
67
|
+
], p);
|
|
68
|
+
function F(e, r) {
|
|
69
|
+
const n = e.get(D), o = U(r);
|
|
70
|
+
return o.on("spawn", () => n.log("Child computing process spawned!")), o.on("error", (t) => n.error(t)), {
|
|
56
71
|
send(t) {
|
|
57
|
-
|
|
72
|
+
o.send(t);
|
|
58
73
|
},
|
|
59
|
-
onMessage: new
|
|
60
|
-
const
|
|
61
|
-
t.next(
|
|
74
|
+
onMessage: new w((t) => {
|
|
75
|
+
const i = (O) => {
|
|
76
|
+
t.next(O);
|
|
62
77
|
};
|
|
63
|
-
return
|
|
64
|
-
}).pipe(
|
|
78
|
+
return o.on("message", i), () => o.off("message", i);
|
|
79
|
+
}).pipe(E(1))
|
|
65
80
|
};
|
|
66
81
|
}
|
|
67
|
-
function
|
|
82
|
+
function K() {
|
|
68
83
|
return {
|
|
69
84
|
send(e) {
|
|
70
|
-
|
|
85
|
+
g.send(e);
|
|
71
86
|
},
|
|
72
|
-
onMessage: new
|
|
73
|
-
const r = (
|
|
74
|
-
e.next(
|
|
87
|
+
onMessage: new w((e) => {
|
|
88
|
+
const r = (n) => {
|
|
89
|
+
e.next(n);
|
|
75
90
|
};
|
|
76
|
-
return
|
|
77
|
-
}).pipe(
|
|
91
|
+
return g.on("message", r), () => g.off("message", r);
|
|
92
|
+
}).pipe(E(1))
|
|
78
93
|
};
|
|
79
94
|
}
|
|
80
95
|
export {
|
|
81
|
-
|
|
82
|
-
|
|
96
|
+
u as UniverRPCNodeMainPlugin,
|
|
97
|
+
p as UniverRPCNodeWorkerPlugin
|
|
83
98
|
};
|
package/lib/index.js
CHANGED
|
@@ -1,83 +1,98 @@
|
|
|
1
1
|
var j = Object.defineProperty;
|
|
2
|
-
var y = (e, r,
|
|
3
|
-
var
|
|
4
|
-
import { fork as
|
|
5
|
-
import
|
|
6
|
-
import { Inject as
|
|
7
|
-
import { IRPCChannelService as
|
|
8
|
-
import { Observable as
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
var y = (e, r, n) => r in e ? j(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n;
|
|
3
|
+
var a = (e, r, n) => y(e, typeof r != "symbol" ? r + "" : r, n);
|
|
4
|
+
import { fork as U } from "node:child_process";
|
|
5
|
+
import g from "node:process";
|
|
6
|
+
import { Inject as P, Injector as v, IConfigService as C, Plugin as R, merge as S, ILogService as D } from "@univerjs/core";
|
|
7
|
+
import { IRPCChannelService as N, ChannelService as I, DataSyncPrimaryController as f, IRemoteSyncService as k, RemoteSyncPrimaryService as W, DataSyncReplicaController as d, IRemoteInstanceService as G, WebWorkerRemoteInstanceService as x } from "@univerjs/rpc";
|
|
8
|
+
import { Observable as w, shareReplay as E } from "rxjs";
|
|
9
|
+
const L = "rpc-node.main-thread.config", h = {}, b = "rpc-node.worker-thread.config", m = {};
|
|
10
|
+
var A = Object.getOwnPropertyDescriptor, M = (e, r, n, o) => {
|
|
11
|
+
for (var s = o > 1 ? void 0 : o ? A(r, n) : r, t = e.length - 1, i; t >= 0; t--)
|
|
12
|
+
(i = e[t]) && (s = i(s) || s);
|
|
12
13
|
return s;
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
}, c = (e, r) => (n, o) => r(n, o, e), l;
|
|
15
|
+
let u = (l = class extends R {
|
|
16
|
+
constructor(e = h, r, n) {
|
|
17
|
+
super(), this._config = e, this._injector = r, this._configService = n;
|
|
18
|
+
const { ...o } = S(
|
|
19
|
+
{},
|
|
20
|
+
h,
|
|
21
|
+
this._config
|
|
22
|
+
);
|
|
23
|
+
this._configService.setConfig(L, o);
|
|
19
24
|
}
|
|
20
25
|
onStarting() {
|
|
21
|
-
const { workerSrc: e } = this._config
|
|
26
|
+
const { workerSrc: e } = this._config;
|
|
27
|
+
if (!e)
|
|
28
|
+
throw new Error("[UniverRPCNodeMainPlugin] workerSrc is required for UniverRPCNodeMainPlugin");
|
|
29
|
+
const r = F(this._injector, e);
|
|
22
30
|
[
|
|
23
|
-
[
|
|
31
|
+
[N, {
|
|
24
32
|
useFactory: () => new I(r)
|
|
25
33
|
}],
|
|
26
|
-
[
|
|
27
|
-
[
|
|
28
|
-
].forEach((
|
|
34
|
+
[f],
|
|
35
|
+
[k, { useClass: W }]
|
|
36
|
+
].forEach((o) => this._injector.add(o)), this._injector.get(f);
|
|
29
37
|
}
|
|
30
|
-
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
],
|
|
35
|
-
var
|
|
36
|
-
let
|
|
37
|
-
constructor(e, r) {
|
|
38
|
-
super(), this._config = e, this._injector = r;
|
|
38
|
+
}, a(l, "pluginName", "UNIVER_RPC_NODE_MAIN_PLUGIN"), l);
|
|
39
|
+
u = M([
|
|
40
|
+
c(1, P(v)),
|
|
41
|
+
c(2, C)
|
|
42
|
+
], u);
|
|
43
|
+
var _;
|
|
44
|
+
let p = (_ = class extends R {
|
|
45
|
+
constructor(e = m, r, n) {
|
|
46
|
+
super(), this._config = e, this._injector = r, this._configService = n;
|
|
47
|
+
const { ...o } = S(
|
|
48
|
+
{},
|
|
49
|
+
m,
|
|
50
|
+
this._config
|
|
51
|
+
);
|
|
52
|
+
this._configService.setConfig(b, o);
|
|
39
53
|
}
|
|
40
54
|
onStarting() {
|
|
41
55
|
[
|
|
42
|
-
[
|
|
43
|
-
[
|
|
44
|
-
useFactory: () => new I(
|
|
56
|
+
[d],
|
|
57
|
+
[N, {
|
|
58
|
+
useFactory: () => new I(K())
|
|
45
59
|
}],
|
|
46
|
-
[
|
|
47
|
-
].forEach((e) => this._injector.add(e)), this._injector.get(
|
|
60
|
+
[G, { useClass: x }]
|
|
61
|
+
].forEach((e) => this._injector.add(e)), this._injector.get(d);
|
|
48
62
|
}
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
63
|
+
}, a(_, "pluginName", "UNIVER_RPC_NODE_WORKER_PLUGIN"), _);
|
|
64
|
+
p = M([
|
|
65
|
+
c(1, P(v)),
|
|
66
|
+
c(2, C)
|
|
67
|
+
], p);
|
|
68
|
+
function F(e, r) {
|
|
69
|
+
const n = e.get(D), o = U(r);
|
|
70
|
+
return o.on("spawn", () => n.log("Child computing process spawned!")), o.on("error", (t) => n.error(t)), {
|
|
56
71
|
send(t) {
|
|
57
|
-
|
|
72
|
+
o.send(t);
|
|
58
73
|
},
|
|
59
|
-
onMessage: new
|
|
60
|
-
const
|
|
61
|
-
t.next(
|
|
74
|
+
onMessage: new w((t) => {
|
|
75
|
+
const i = (O) => {
|
|
76
|
+
t.next(O);
|
|
62
77
|
};
|
|
63
|
-
return
|
|
64
|
-
}).pipe(
|
|
78
|
+
return o.on("message", i), () => o.off("message", i);
|
|
79
|
+
}).pipe(E(1))
|
|
65
80
|
};
|
|
66
81
|
}
|
|
67
|
-
function
|
|
82
|
+
function K() {
|
|
68
83
|
return {
|
|
69
84
|
send(e) {
|
|
70
|
-
|
|
85
|
+
g.send(e);
|
|
71
86
|
},
|
|
72
|
-
onMessage: new
|
|
73
|
-
const r = (
|
|
74
|
-
e.next(
|
|
87
|
+
onMessage: new w((e) => {
|
|
88
|
+
const r = (n) => {
|
|
89
|
+
e.next(n);
|
|
75
90
|
};
|
|
76
|
-
return
|
|
77
|
-
}).pipe(
|
|
91
|
+
return g.on("message", r), () => g.off("message", r);
|
|
92
|
+
}).pipe(E(1))
|
|
78
93
|
};
|
|
79
94
|
}
|
|
80
95
|
export {
|
|
81
|
-
|
|
82
|
-
|
|
96
|
+
u as UniverRPCNodeMainPlugin,
|
|
97
|
+
p as UniverRPCNodeWorkerPlugin
|
|
83
98
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export declare const PLUGIN_CONFIG_KEY_MAIN_THREAD = "rpc-node.main-thread.config";
|
|
17
|
+
export declare const configSymbolMainThread: unique symbol;
|
|
18
|
+
export interface IUniverRPCNodeMainConfig {
|
|
19
|
+
workerSrc?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const defaultPluginMainThreadConfig: IUniverRPCNodeMainConfig;
|
|
22
|
+
export declare const PLUGIN_CONFIG_KEY_WORKER_THREAD = "rpc-node.worker-thread.config";
|
|
23
|
+
export declare const configSymbolWorkerThread: unique symbol;
|
|
24
|
+
export interface IUniverRPCNodeWorkerThreadConfig {
|
|
25
|
+
}
|
|
26
|
+
export declare const defaultPluginWorkerThreadConfig: IUniverRPCNodeWorkerThreadConfig;
|
package/lib/types/plugin.d.ts
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
|
+
import { IUniverRPCNodeMainConfig, IUniverRPCNodeWorkerThreadConfig } from './controllers/config.schema';
|
|
1
2
|
import { IConfigService, Injector, Plugin } from '@univerjs/core';
|
|
2
|
-
export interface IUniverRPCNodeMainConfig {
|
|
3
|
-
/** Path of the computing worker scripts. */
|
|
4
|
-
workerSrc: string;
|
|
5
|
-
}
|
|
6
3
|
export declare class UniverRPCNodeMainPlugin extends Plugin {
|
|
7
4
|
private readonly _config;
|
|
8
5
|
protected readonly _injector: Injector;
|
|
9
6
|
private readonly _configService;
|
|
10
7
|
static pluginName: string;
|
|
11
|
-
constructor(_config: IUniverRPCNodeMainConfig, _injector: Injector, _configService: IConfigService);
|
|
8
|
+
constructor(_config: Partial<IUniverRPCNodeMainConfig> | undefined, _injector: Injector, _configService: IConfigService);
|
|
12
9
|
onStarting(): void;
|
|
13
10
|
}
|
|
14
11
|
export declare class UniverRPCNodeWorkerPlugin extends Plugin {
|
|
15
12
|
private readonly _config;
|
|
16
13
|
protected readonly _injector: Injector;
|
|
14
|
+
private readonly _configService;
|
|
17
15
|
static pluginName: string;
|
|
18
|
-
constructor(_config: undefined, _injector: Injector);
|
|
16
|
+
constructor(_config: Partial<IUniverRPCNodeWorkerThreadConfig> | undefined, _injector: Injector, _configService: IConfigService);
|
|
19
17
|
onStarting(): void;
|
|
20
18
|
}
|
package/lib/umd/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(e,
|
|
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,g,c,t,l){"use strict";var j=Object.defineProperty;var y=(e,o,g)=>o in e?j(e,o,{enumerable:!0,configurable:!0,writable:!0,value:g}):e[o]=g;var _=(e,o,g)=>y(e,typeof o!="symbol"?o+"":o,g);var P,v;const S="rpc-node.main-thread.config",h={},N="rpc-node.worker-thread.config",C={};var m=Object.getOwnPropertyDescriptor,R=(s,n,i,r)=>{for(var a=r>1?void 0:r?m(n,i):n,d=s.length-1,u;d>=0;d--)(u=s[d])&&(a=u(a)||a);return a},f=(s,n)=>(i,r)=>n(i,r,s);e.UniverRPCNodeMainPlugin=(P=class extends c.Plugin{constructor(n=h,i,r){super(),this._config=n,this._injector=i,this._configService=r;const{...a}=c.merge({},h,this._config);this._configService.setConfig(S,a)}onStarting(){const{workerSrc:n}=this._config;if(!n)throw new Error("[UniverRPCNodeMainPlugin] workerSrc is required for UniverRPCNodeMainPlugin");const i=I(this._injector,n);[[t.IRPCChannelService,{useFactory:()=>new t.ChannelService(i)}],[t.DataSyncPrimaryController],[t.IRemoteSyncService,{useClass:t.RemoteSyncPrimaryService}]].forEach(a=>this._injector.add(a)),this._injector.get(t.DataSyncPrimaryController)}},_(P,"pluginName","UNIVER_RPC_NODE_MAIN_PLUGIN"),P),e.UniverRPCNodeMainPlugin=R([f(1,c.Inject(c.Injector)),f(2,c.IConfigService)],e.UniverRPCNodeMainPlugin),e.UniverRPCNodeWorkerPlugin=(v=class extends c.Plugin{constructor(n=C,i,r){super(),this._config=n,this._injector=i,this._configService=r;const{...a}=c.merge({},C,this._config);this._configService.setConfig(N,a)}onStarting(){[[t.DataSyncReplicaController],[t.IRPCChannelService,{useFactory:()=>new t.ChannelService(p())}],[t.IRemoteInstanceService,{useClass:t.WebWorkerRemoteInstanceService}]].forEach(n=>this._injector.add(n)),this._injector.get(t.DataSyncReplicaController)}},_(v,"pluginName","UNIVER_RPC_NODE_WORKER_PLUGIN"),v),e.UniverRPCNodeWorkerPlugin=R([f(1,c.Inject(c.Injector)),f(2,c.IConfigService)],e.UniverRPCNodeWorkerPlugin);function I(s,n){const i=s.get(c.ILogService),r=o.fork(n);return r.on("spawn",()=>i.log("Child computing process spawned!")),r.on("error",d=>i.error(d)),{send(d){r.send(d)},onMessage:new l.Observable(d=>{const u=U=>{d.next(U)};return r.on("message",u),()=>r.off("message",u)}).pipe(l.shareReplay(1))}}function p(){return{send(s){g.send(s)},onMessage:new l.Observable(s=>{const n=i=>{s.next(i)};return g.on("message",n),()=>g.off("message",n)}).pipe(l.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.8.
|
|
3
|
+
"version": "0.8.3-nightly.202506271607",
|
|
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/
|
|
50
|
-
"@univerjs/
|
|
49
|
+
"@univerjs/rpc": "0.8.3-nightly.202506271607",
|
|
50
|
+
"@univerjs/core": "0.8.3-nightly.202506271607"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"rxjs": "^7.8.2",
|
|
54
54
|
"typescript": "^5.8.3",
|
|
55
55
|
"vite": "^6.3.5",
|
|
56
56
|
"vitest": "^3.2.4",
|
|
57
|
-
"@univerjs-infra/shared": "0.8.
|
|
57
|
+
"@univerjs-infra/shared": "0.8.3"
|
|
58
58
|
},
|
|
59
59
|
"scripts": {
|
|
60
60
|
"test": "vitest run",
|