@actuallab/rpc 12.3.76 → 12.3.81
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/dist/index.cjs +24 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +23 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -41,6 +41,7 @@ __export(index_exports, {
|
|
|
41
41
|
RpcClientPeer: () => RpcClientPeer,
|
|
42
42
|
RpcClientPeerReconnectDelayer: () => RpcClientPeerReconnectDelayer,
|
|
43
43
|
RpcConnectionState: () => RpcConnectionState,
|
|
44
|
+
RpcError: () => RpcError,
|
|
44
45
|
RpcHub: () => RpcHub,
|
|
45
46
|
RpcInboundCall: () => RpcInboundCall,
|
|
46
47
|
RpcInboundCallTracker: () => RpcInboundCallTracker,
|
|
@@ -862,6 +863,17 @@ var RpcInboundCallTracker = class {
|
|
|
862
863
|
}
|
|
863
864
|
};
|
|
864
865
|
|
|
866
|
+
// src/rpc-error.ts
|
|
867
|
+
var RpcError = class extends Error {
|
|
868
|
+
typeName;
|
|
869
|
+
constructor(message, typeName) {
|
|
870
|
+
super(message);
|
|
871
|
+
this.name = "RpcError";
|
|
872
|
+
if (typeName !== void 0)
|
|
873
|
+
this.typeName = typeName;
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
|
|
865
877
|
// src/increasing-seq-compressor.ts
|
|
866
878
|
var IncreasingSeqCompressor = {
|
|
867
879
|
/**
|
|
@@ -1788,12 +1800,17 @@ var RpcSystemCallHandler = class {
|
|
|
1788
1800
|
const errorInfo = args[0];
|
|
1789
1801
|
const msg = errorInfo?.Message ?? errorInfo?.message ?? "RPC error";
|
|
1790
1802
|
const errorType = errorInfo?.TypeRef ?? errorInfo?.typeRef;
|
|
1791
|
-
|
|
1803
|
+
let typeName;
|
|
1804
|
+
if (typeof errorType === "string") {
|
|
1805
|
+
const commaIdx = errorType.indexOf(",");
|
|
1806
|
+
typeName = commaIdx >= 0 ? errorType.slice(0, commaIdx) : errorType;
|
|
1807
|
+
} else if (errorType !== null && typeof errorType === "object") {
|
|
1792
1808
|
const t = errorType;
|
|
1793
|
-
|
|
1794
|
-
warnLog5?.log("Got RpcRerouteException from remote peer:", msg);
|
|
1809
|
+
typeName = t.TypeName ?? t.typeName;
|
|
1795
1810
|
}
|
|
1796
|
-
|
|
1811
|
+
if (typeName === "ActualLab.Rpc.RpcRerouteException")
|
|
1812
|
+
warnLog5?.log("Got RpcRerouteException from remote peer:", msg);
|
|
1813
|
+
call.result.reject(new RpcError(msg, typeName));
|
|
1797
1814
|
}
|
|
1798
1815
|
break;
|
|
1799
1816
|
}
|
|
@@ -2364,6 +2381,7 @@ var RpcPeer = class {
|
|
|
2364
2381
|
this._connection = conn;
|
|
2365
2382
|
conn.messageReceived.add((raw) => this._handleMessage(raw));
|
|
2366
2383
|
conn.closed.add((ev) => {
|
|
2384
|
+
if (this._connection !== conn) return;
|
|
2367
2385
|
this._connection = void 0;
|
|
2368
2386
|
this._isConnected = false;
|
|
2369
2387
|
if (ev.reason)
|
|
@@ -2982,6 +3000,7 @@ var RpcServerPeer = class extends RpcPeer {
|
|
|
2982
3000
|
this._setConnectionState(1 /* Connecting */);
|
|
2983
3001
|
this.setupConnection(conn);
|
|
2984
3002
|
conn.closed.add(() => {
|
|
3003
|
+
if (this._connection !== conn && this._connection !== void 0) return;
|
|
2985
3004
|
this.sharedObjects.disconnectAll();
|
|
2986
3005
|
});
|
|
2987
3006
|
}
|
|
@@ -4096,6 +4115,7 @@ var RpcPeerStateMonitor = class {
|
|
|
4096
4115
|
RpcClientPeer,
|
|
4097
4116
|
RpcClientPeerReconnectDelayer,
|
|
4098
4117
|
RpcConnectionState,
|
|
4118
|
+
RpcError,
|
|
4099
4119
|
RpcHub,
|
|
4100
4120
|
RpcInboundCall,
|
|
4101
4121
|
RpcInboundCallTracker,
|