@actuallab/rpc 12.3.79 → 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.d.cts CHANGED
@@ -523,6 +523,12 @@ declare const RpcCallStage: {
523
523
  };
524
524
  type RpcCallStage = number;
525
525
 
526
+ /** Error thrown for a failed remote RPC call — carries the remote exception's type name when available. */
527
+ declare class RpcError extends Error {
528
+ readonly typeName?: string;
529
+ constructor(message: string, typeName?: string);
530
+ }
531
+
526
532
  /**
527
533
  * Compresses and decompresses monotonically increasing sequences of
528
534
  * integers using variable-length LEB128 encoding of successive deltas.
@@ -1288,4 +1294,4 @@ declare function xxh3_64str(input: string, seed?: bigint): bigint;
1288
1294
  */
1289
1295
  declare function computeMethodHash(methodName: string): number;
1290
1296
 
1291
- export { ARG_DELIMITER, ENVELOPE_DELIMITER, FRAME_DELIMITER, HANDSHAKE_TIMEOUT_MS, type IRpcObject, IncreasingSeqCompressor, type MethodMeta, RPC_CLOSE_CODE_UNSUPPORTED_FORMAT, type RemoteHandshake, type RpcCallOptions, RpcCallStage, RpcCallTypeId, RpcClientPeer, RpcClientPeerReconnectDelayer, type RpcConnection, RpcConnectionState, type RpcConnectionUrlResolver, type RpcDeserializedMessage, type RpcDispatchContext, RpcHub, RpcInboundCall, RpcInboundCallTracker, RpcJsonSerializationFormat, type RpcLogScope, type RpcMessage, RpcMessageChannelConnection, RpcMessagePackCompactSerializationFormat, RpcMessagePackSerializationFormat, type RpcMethodDef, type RpcMethodDefInput, RpcMethodRegistry, type RpcObjectId, RpcObjectKind, RpcOutboundCall, RpcOutboundCallTracker, RpcPeer, type RpcPeerFactory, RpcPeerRefBuilder, type RpcPeerState, RpcPeerStateKind, RpcPeerStateMonitor, type RpcReceivedMessage, RpcRemoteExecutionMode, RpcRemoteObjectTracker, RpcSerializationFormat, RpcSerializationFormatResolver, RpcServerPeer, type RpcServiceDef, RpcServiceHost, type RpcServiceImpl, RpcSharedObjectTracker, RpcStream, type RpcStreamOptions, type RpcStreamRef, RpcStreamSender, type RpcStreamSource, RpcSystemCallHandler, RpcSystemCallSender, RpcSystemCalls, RpcType, RpcWebSocketConnection, type RpcWireData, type ServiceMeta, type WebSocketLike, type WebSocketServer, WebSocketState, computeMethodHash, createBinaryEncoder, createMessageChannelPair, createRpcClient, defaultBinaryDecoder, defaultBinaryEncoder, defaultConnectionUrlResolver, defineRpcService, deserializeBinaryMessage, deserializeCompactBinaryMessage, deserializeMessage, getLogs, getMethodsMeta, getServiceMeta, getStateDescription, isConnected, likelyConnected, parseStreamRef, resolveStreamRefs, rpcMethod, rpcService, serializeBinaryFrame, serializeBinaryMessage, serializeCompactBinaryMessage, serializeFrame, serializeMessage, splitBinaryFrame, splitCompactBinaryFrame, splitFrame, wireMethodName, xxh3_64, xxh3_64str };
1297
+ export { ARG_DELIMITER, ENVELOPE_DELIMITER, FRAME_DELIMITER, HANDSHAKE_TIMEOUT_MS, type IRpcObject, IncreasingSeqCompressor, type MethodMeta, RPC_CLOSE_CODE_UNSUPPORTED_FORMAT, type RemoteHandshake, type RpcCallOptions, RpcCallStage, RpcCallTypeId, RpcClientPeer, RpcClientPeerReconnectDelayer, type RpcConnection, RpcConnectionState, type RpcConnectionUrlResolver, type RpcDeserializedMessage, type RpcDispatchContext, RpcError, RpcHub, RpcInboundCall, RpcInboundCallTracker, RpcJsonSerializationFormat, type RpcLogScope, type RpcMessage, RpcMessageChannelConnection, RpcMessagePackCompactSerializationFormat, RpcMessagePackSerializationFormat, type RpcMethodDef, type RpcMethodDefInput, RpcMethodRegistry, type RpcObjectId, RpcObjectKind, RpcOutboundCall, RpcOutboundCallTracker, RpcPeer, type RpcPeerFactory, RpcPeerRefBuilder, type RpcPeerState, RpcPeerStateKind, RpcPeerStateMonitor, type RpcReceivedMessage, RpcRemoteExecutionMode, RpcRemoteObjectTracker, RpcSerializationFormat, RpcSerializationFormatResolver, RpcServerPeer, type RpcServiceDef, RpcServiceHost, type RpcServiceImpl, RpcSharedObjectTracker, RpcStream, type RpcStreamOptions, type RpcStreamRef, RpcStreamSender, type RpcStreamSource, RpcSystemCallHandler, RpcSystemCallSender, RpcSystemCalls, RpcType, RpcWebSocketConnection, type RpcWireData, type ServiceMeta, type WebSocketLike, type WebSocketServer, WebSocketState, computeMethodHash, createBinaryEncoder, createMessageChannelPair, createRpcClient, defaultBinaryDecoder, defaultBinaryEncoder, defaultConnectionUrlResolver, defineRpcService, deserializeBinaryMessage, deserializeCompactBinaryMessage, deserializeMessage, getLogs, getMethodsMeta, getServiceMeta, getStateDescription, isConnected, likelyConnected, parseStreamRef, resolveStreamRefs, rpcMethod, rpcService, serializeBinaryFrame, serializeBinaryMessage, serializeCompactBinaryMessage, serializeFrame, serializeMessage, splitBinaryFrame, splitCompactBinaryFrame, splitFrame, wireMethodName, xxh3_64, xxh3_64str };
package/dist/index.d.ts CHANGED
@@ -523,6 +523,12 @@ declare const RpcCallStage: {
523
523
  };
524
524
  type RpcCallStage = number;
525
525
 
526
+ /** Error thrown for a failed remote RPC call — carries the remote exception's type name when available. */
527
+ declare class RpcError extends Error {
528
+ readonly typeName?: string;
529
+ constructor(message: string, typeName?: string);
530
+ }
531
+
526
532
  /**
527
533
  * Compresses and decompresses monotonically increasing sequences of
528
534
  * integers using variable-length LEB128 encoding of successive deltas.
@@ -1288,4 +1294,4 @@ declare function xxh3_64str(input: string, seed?: bigint): bigint;
1288
1294
  */
1289
1295
  declare function computeMethodHash(methodName: string): number;
1290
1296
 
1291
- export { ARG_DELIMITER, ENVELOPE_DELIMITER, FRAME_DELIMITER, HANDSHAKE_TIMEOUT_MS, type IRpcObject, IncreasingSeqCompressor, type MethodMeta, RPC_CLOSE_CODE_UNSUPPORTED_FORMAT, type RemoteHandshake, type RpcCallOptions, RpcCallStage, RpcCallTypeId, RpcClientPeer, RpcClientPeerReconnectDelayer, type RpcConnection, RpcConnectionState, type RpcConnectionUrlResolver, type RpcDeserializedMessage, type RpcDispatchContext, RpcHub, RpcInboundCall, RpcInboundCallTracker, RpcJsonSerializationFormat, type RpcLogScope, type RpcMessage, RpcMessageChannelConnection, RpcMessagePackCompactSerializationFormat, RpcMessagePackSerializationFormat, type RpcMethodDef, type RpcMethodDefInput, RpcMethodRegistry, type RpcObjectId, RpcObjectKind, RpcOutboundCall, RpcOutboundCallTracker, RpcPeer, type RpcPeerFactory, RpcPeerRefBuilder, type RpcPeerState, RpcPeerStateKind, RpcPeerStateMonitor, type RpcReceivedMessage, RpcRemoteExecutionMode, RpcRemoteObjectTracker, RpcSerializationFormat, RpcSerializationFormatResolver, RpcServerPeer, type RpcServiceDef, RpcServiceHost, type RpcServiceImpl, RpcSharedObjectTracker, RpcStream, type RpcStreamOptions, type RpcStreamRef, RpcStreamSender, type RpcStreamSource, RpcSystemCallHandler, RpcSystemCallSender, RpcSystemCalls, RpcType, RpcWebSocketConnection, type RpcWireData, type ServiceMeta, type WebSocketLike, type WebSocketServer, WebSocketState, computeMethodHash, createBinaryEncoder, createMessageChannelPair, createRpcClient, defaultBinaryDecoder, defaultBinaryEncoder, defaultConnectionUrlResolver, defineRpcService, deserializeBinaryMessage, deserializeCompactBinaryMessage, deserializeMessage, getLogs, getMethodsMeta, getServiceMeta, getStateDescription, isConnected, likelyConnected, parseStreamRef, resolveStreamRefs, rpcMethod, rpcService, serializeBinaryFrame, serializeBinaryMessage, serializeCompactBinaryMessage, serializeFrame, serializeMessage, splitBinaryFrame, splitCompactBinaryFrame, splitFrame, wireMethodName, xxh3_64, xxh3_64str };
1297
+ export { ARG_DELIMITER, ENVELOPE_DELIMITER, FRAME_DELIMITER, HANDSHAKE_TIMEOUT_MS, type IRpcObject, IncreasingSeqCompressor, type MethodMeta, RPC_CLOSE_CODE_UNSUPPORTED_FORMAT, type RemoteHandshake, type RpcCallOptions, RpcCallStage, RpcCallTypeId, RpcClientPeer, RpcClientPeerReconnectDelayer, type RpcConnection, RpcConnectionState, type RpcConnectionUrlResolver, type RpcDeserializedMessage, type RpcDispatchContext, RpcError, RpcHub, RpcInboundCall, RpcInboundCallTracker, RpcJsonSerializationFormat, type RpcLogScope, type RpcMessage, RpcMessageChannelConnection, RpcMessagePackCompactSerializationFormat, RpcMessagePackSerializationFormat, type RpcMethodDef, type RpcMethodDefInput, RpcMethodRegistry, type RpcObjectId, RpcObjectKind, RpcOutboundCall, RpcOutboundCallTracker, RpcPeer, type RpcPeerFactory, RpcPeerRefBuilder, type RpcPeerState, RpcPeerStateKind, RpcPeerStateMonitor, type RpcReceivedMessage, RpcRemoteExecutionMode, RpcRemoteObjectTracker, RpcSerializationFormat, RpcSerializationFormatResolver, RpcServerPeer, type RpcServiceDef, RpcServiceHost, type RpcServiceImpl, RpcSharedObjectTracker, RpcStream, type RpcStreamOptions, type RpcStreamRef, RpcStreamSender, type RpcStreamSource, RpcSystemCallHandler, RpcSystemCallSender, RpcSystemCalls, RpcType, RpcWebSocketConnection, type RpcWireData, type ServiceMeta, type WebSocketLike, type WebSocketServer, WebSocketState, computeMethodHash, createBinaryEncoder, createMessageChannelPair, createRpcClient, defaultBinaryDecoder, defaultBinaryEncoder, defaultConnectionUrlResolver, defineRpcService, deserializeBinaryMessage, deserializeCompactBinaryMessage, deserializeMessage, getLogs, getMethodsMeta, getServiceMeta, getStateDescription, isConnected, likelyConnected, parseStreamRef, resolveStreamRefs, rpcMethod, rpcService, serializeBinaryFrame, serializeBinaryMessage, serializeCompactBinaryMessage, serializeFrame, serializeMessage, splitBinaryFrame, splitCompactBinaryFrame, splitFrame, wireMethodName, xxh3_64, xxh3_64str };
package/dist/index.js CHANGED
@@ -757,6 +757,17 @@ var RpcInboundCallTracker = class {
757
757
  }
758
758
  };
759
759
 
760
+ // src/rpc-error.ts
761
+ var RpcError = class extends Error {
762
+ typeName;
763
+ constructor(message, typeName) {
764
+ super(message);
765
+ this.name = "RpcError";
766
+ if (typeName !== void 0)
767
+ this.typeName = typeName;
768
+ }
769
+ };
770
+
760
771
  // src/increasing-seq-compressor.ts
761
772
  var IncreasingSeqCompressor = {
762
773
  /**
@@ -1683,12 +1694,17 @@ var RpcSystemCallHandler = class {
1683
1694
  const errorInfo = args[0];
1684
1695
  const msg = errorInfo?.Message ?? errorInfo?.message ?? "RPC error";
1685
1696
  const errorType = errorInfo?.TypeRef ?? errorInfo?.typeRef;
1686
- if (errorType !== null && typeof errorType === "object") {
1697
+ let typeName;
1698
+ if (typeof errorType === "string") {
1699
+ const commaIdx = errorType.indexOf(",");
1700
+ typeName = commaIdx >= 0 ? errorType.slice(0, commaIdx) : errorType;
1701
+ } else if (errorType !== null && typeof errorType === "object") {
1687
1702
  const t = errorType;
1688
- if (t.TypeName === "RpcRerouteException" || t.typeName === "RpcRerouteException")
1689
- warnLog5?.log("Got RpcRerouteException from remote peer:", msg);
1703
+ typeName = t.TypeName ?? t.typeName;
1690
1704
  }
1691
- call.result.reject(new Error(msg));
1705
+ if (typeName === "ActualLab.Rpc.RpcRerouteException")
1706
+ warnLog5?.log("Got RpcRerouteException from remote peer:", msg);
1707
+ call.result.reject(new RpcError(msg, typeName));
1692
1708
  }
1693
1709
  break;
1694
1710
  }
@@ -3992,6 +4008,7 @@ export {
3992
4008
  RpcClientPeer,
3993
4009
  RpcClientPeerReconnectDelayer,
3994
4010
  RpcConnectionState,
4011
+ RpcError,
3995
4012
  RpcHub,
3996
4013
  RpcInboundCall,
3997
4014
  RpcInboundCallTracker,