@univerjs/rpc-node 0.5.3 → 0.5.4

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 C=Object.defineProperty;var h=(n,e,r)=>e in n?C(n,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[e]=r;var g=(n,e,r)=>h(n,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("node:child_process"),P=require("node:process"),c=require("@univerjs/core"),s=require("@univerjs/rpc"),l=require("rxjs");var f=Object.defineProperty,N=Object.getOwnPropertyDescriptor,v=(n,e,r,o)=>{for(var t=o>1?void 0:o?N(e,r):e,i=n.length-1,a;i>=0;i--)(a=n[i])&&(t=(o?a(e,r,t):a(t))||t);return o&&t&&f(e,r,t),t},d=(n,e)=>(r,o)=>e(r,o,n);const S="node-rpc.main.config";var u;exports.UniverRPCNodeMainPlugin=(u=class extends c.Plugin{constructor(e,r,o){super(),this._config=e,this._injector=r,this._configService=o,this._configService.setConfig(S,this._config)}onStarting(){const{workerSrc:e}=this._config,r=I(this._injector,e);[[s.IRPCChannelService,{useFactory:()=>new s.ChannelService(r)}],[s.DataSyncPrimaryController],[s.IRemoteSyncService,{useClass:s.RemoteSyncPrimaryService}]].forEach(t=>this._injector.add(t)),this._injector.get(s.DataSyncPrimaryController)}},g(u,"pluginName","UNIVER_RPC_NODE_MAIN_PLUGIN"),u);exports.UniverRPCNodeMainPlugin=v([d(1,c.Inject(c.Injector)),d(2,c.IConfigService)],exports.UniverRPCNodeMainPlugin);var _;exports.UniverRPCNodeWorkerPlugin=(_=class extends c.Plugin{constructor(e,r){super(),this._config=e,this._injector=r}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)}},g(_,"pluginName","UNIVER_RPC_NODE_WORKER_PLUGIN"),_);exports.UniverRPCNodeWorkerPlugin=v([d(1,c.Inject(c.Injector))],exports.UniverRPCNodeWorkerPlugin);function I(n,e){const r=n.get(c.ILogService),o=R.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 l.Observable(i=>{const a=p=>{i.next(p)};return o.on("message",a),()=>o.off("message",a)}).pipe(l.shareReplay(1))}}function m(){return{send(n){P.send(n)},onMessage:new l.Observable(n=>{const e=r=>{n.next(r)};return P.on("message",e),()=>P.off("message",e)}).pipe(l.shareReplay(1))}}
1
+ "use strict";var C=Object.defineProperty;var h=(r,e,n)=>e in r?C(r,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[e]=n;var g=(r,e,n)=>h(r,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("node:child_process"),P=require("node:process"),c=require("@univerjs/core"),s=require("@univerjs/rpc"),l=require("rxjs");var f=Object.defineProperty,N=Object.getOwnPropertyDescriptor,v=(r,e,n,o)=>{for(var t=o>1?void 0:o?N(e,n):e,i=r.length-1,a;i>=0;i--)(a=r[i])&&(t=(o?a(e,n,t):a(t))||t);return o&&t&&f(e,n,t),t},d=(r,e)=>(n,o)=>e(n,o,r);const S="node-rpc.main.config";var u;exports.UniverRPCNodeMainPlugin=(u=class extends c.Plugin{constructor(e,n,o){super(),this._config=e,this._injector=n,this._configService=o,this._configService.setConfig(S,this._config)}onStarting(){const{workerSrc:e}=this._config,n=I(this._injector,e);[[s.IRPCChannelService,{useFactory:()=>new s.ChannelService(n)}],[s.DataSyncPrimaryController],[s.IRemoteSyncService,{useClass:s.RemoteSyncPrimaryService}]].forEach(t=>this._injector.add(t)),this._injector.get(s.DataSyncPrimaryController)}},g(u,"pluginName","UNIVER_RPC_NODE_MAIN_PLUGIN"),u);exports.UniverRPCNodeMainPlugin=v([d(1,c.Inject(c.Injector)),d(2,c.IConfigService)],exports.UniverRPCNodeMainPlugin);var _;exports.UniverRPCNodeWorkerPlugin=(_=class extends c.Plugin{constructor(e,n){super(),this._config=e,this._injector=n}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)}},g(_,"pluginName","UNIVER_RPC_NODE_WORKER_PLUGIN"),_);exports.UniverRPCNodeWorkerPlugin=v([d(1,c.Inject(c.Injector))],exports.UniverRPCNodeWorkerPlugin);function I(r,e){const n=r.get(c.ILogService),o=R.fork(e);return o.on("spawn",()=>n.log("Child computing process spawned!")),o.on("error",i=>n.error(i)),{send(i){o.send(i)},onMessage:new l.Observable(i=>{const a=p=>{i.next(p)};return o.on("message",a),()=>o.off("message",a)}).pipe(l.shareReplay(1))}}function m(){return{send(r){P.send(r)},onMessage:new l.Observable(r=>{const e=n=>{r.next(n)};return P.on("message",e),()=>P.off("message",e)}).pipe(l.shareReplay(1))}}
package/lib/es/index.js CHANGED
@@ -1,21 +1,21 @@
1
1
  var j = Object.defineProperty;
2
- var O = (r, e, o) => e in r ? j(r, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : r[e] = o;
3
- var i = (r, e, o) => O(r, typeof e != "symbol" ? e + "" : e, o);
2
+ var O = (r, e, n) => e in r ? j(r, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[e] = n;
3
+ var i = (r, e, n) => O(r, typeof e != "symbol" ? e + "" : e, n);
4
4
  import { fork as E } from "node:child_process";
5
5
  import a from "node:process";
6
- import { Inject as d, Injector as h, Plugin as u, IConfigService as w, ILogService as y } from "@univerjs/core";
7
- import { DataSyncPrimaryController as p, DataSyncReplicaController as f, IRPCChannelService as v, ChannelService as I, IRemoteInstanceService as M, WebWorkerRemoteInstanceService as U, IRemoteSyncService as D, RemoteSyncPrimaryService as b } from "@univerjs/rpc";
6
+ import { Inject as P, Injector as h, Plugin as u, IConfigService as w, ILogService as y } from "@univerjs/core";
7
+ import { DataSyncPrimaryController as f, DataSyncReplicaController as p, IRPCChannelService as v, ChannelService as I, IRemoteInstanceService as M, WebWorkerRemoteInstanceService as U, IRemoteSyncService as D, RemoteSyncPrimaryService as b } from "@univerjs/rpc";
8
8
  import { Observable as N, shareReplay as S } from "rxjs";
9
- var x = Object.defineProperty, W = Object.getOwnPropertyDescriptor, C = (r, e, o, n) => {
10
- for (var s = n > 1 ? void 0 : n ? W(e, o) : e, t = r.length - 1, c; t >= 0; t--)
11
- (c = r[t]) && (s = (n ? c(e, o, s) : c(s)) || s);
12
- return n && s && x(e, o, s), s;
13
- }, l = (r, e) => (o, n) => e(o, n, r);
9
+ var x = Object.defineProperty, W = Object.getOwnPropertyDescriptor, C = (r, e, n, o) => {
10
+ for (var s = o > 1 ? void 0 : o ? W(e, n) : e, t = r.length - 1, c; t >= 0; t--)
11
+ (c = r[t]) && (s = (o ? c(e, n, s) : c(s)) || s);
12
+ return o && s && x(e, n, s), s;
13
+ }, l = (r, e) => (n, o) => e(n, o, r);
14
14
  const G = "node-rpc.main.config";
15
15
  var _;
16
16
  let m = (_ = class extends u {
17
- constructor(r, e, o) {
18
- super(), this._config = r, this._injector = e, this._configService = o, this._configService.setConfig(G, this._config);
17
+ constructor(r, e, n) {
18
+ super(), this._config = r, this._injector = e, this._configService = n, this._configService.setConfig(G, this._config);
19
19
  }
20
20
  onStarting() {
21
21
  const { workerSrc: r } = this._config, e = L(this._injector, r);
@@ -23,44 +23,44 @@ let m = (_ = class extends u {
23
23
  [v, {
24
24
  useFactory: () => new I(e)
25
25
  }],
26
- [p],
26
+ [f],
27
27
  [D, { useClass: b }]
28
- ].forEach((n) => this._injector.add(n)), this._injector.get(p);
28
+ ].forEach((o) => this._injector.add(o)), this._injector.get(f);
29
29
  }
30
30
  }, i(_, "pluginName", "UNIVER_RPC_NODE_MAIN_PLUGIN"), _);
31
31
  m = C([
32
- l(1, d(h)),
32
+ l(1, P(h)),
33
33
  l(2, w)
34
34
  ], m);
35
35
  var g;
36
- let P = (g = class extends u {
36
+ let d = (g = class extends u {
37
37
  constructor(r, e) {
38
38
  super(), this._config = r, this._injector = e;
39
39
  }
40
40
  onStarting() {
41
41
  [
42
- [f],
42
+ [p],
43
43
  [v, {
44
44
  useFactory: () => new I(F())
45
45
  }],
46
46
  [M, { useClass: U }]
47
- ].forEach((r) => this._injector.add(r)), this._injector.get(f);
47
+ ].forEach((r) => this._injector.add(r)), this._injector.get(p);
48
48
  }
49
49
  }, i(g, "pluginName", "UNIVER_RPC_NODE_WORKER_PLUGIN"), g);
50
- P = C([
51
- l(1, d(h))
52
- ], P);
50
+ d = C([
51
+ l(1, P(h))
52
+ ], d);
53
53
  function L(r, e) {
54
- const o = r.get(y), n = E(e);
55
- return n.on("spawn", () => o.log("Child computing process spawned!")), n.on("error", (t) => o.error(t)), {
54
+ const n = r.get(y), o = E(e);
55
+ return o.on("spawn", () => n.log("Child computing process spawned!")), o.on("error", (t) => n.error(t)), {
56
56
  send(t) {
57
- n.send(t);
57
+ o.send(t);
58
58
  },
59
59
  onMessage: new N((t) => {
60
60
  const c = (R) => {
61
61
  t.next(R);
62
62
  };
63
- return n.on("message", c), () => n.off("message", c);
63
+ return o.on("message", c), () => o.off("message", c);
64
64
  }).pipe(S(1))
65
65
  };
66
66
  }
@@ -70,8 +70,8 @@ function F() {
70
70
  a.send(r);
71
71
  },
72
72
  onMessage: new N((r) => {
73
- const e = (o) => {
74
- r.next(o);
73
+ const e = (n) => {
74
+ r.next(n);
75
75
  };
76
76
  return a.on("message", e), () => a.off("message", e);
77
77
  }).pipe(S(1))
@@ -79,5 +79,5 @@ function F() {
79
79
  }
80
80
  export {
81
81
  m as UniverRPCNodeMainPlugin,
82
- P as UniverRPCNodeWorkerPlugin
82
+ d as UniverRPCNodeWorkerPlugin
83
83
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@univerjs/rpc-node",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
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.5.3",
50
- "@univerjs/rpc": "0.5.3"
49
+ "@univerjs/core": "0.5.4",
50
+ "@univerjs/rpc": "0.5.4"
51
51
  },
52
52
  "devDependencies": {
53
53
  "rxjs": "^7.8.1",
54
54
  "typescript": "^5.7.2",
55
- "vite": "^6.0.6",
55
+ "vite": "^6.0.7",
56
56
  "vitest": "^2.1.8",
57
- "@univerjs-infra/shared": "0.5.3"
57
+ "@univerjs-infra/shared": "0.5.4"
58
58
  },
59
59
  "scripts": {
60
60
  "test": "vitest run",