@actuallab/rpc 13.0.167 → 14.1.5

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
@@ -790,7 +790,7 @@ declare class RpcSystemCallSender {
790
790
  }
791
791
 
792
792
  /** Factory signature shared by all peer lookup/creation methods. Serialization
793
- * format is encoded in the URL via `?f=...` (see {@link RpcPeerRefBuilder}),
793
+ * format is encoded in the URL via `?f=...` (see {@link RpcRefBuilder}),
794
794
  * so the factory doesn't need an extra parameter for it. `getClientPeer` /
795
795
  * `getServerPeer` cast the result, so the factory returns RpcPeer. */
796
796
  type RpcPeerFactory = (hub: RpcHub, ref: string) => RpcPeer;
@@ -1097,7 +1097,7 @@ declare class RpcClientPeer extends RpcPeer {
1097
1097
  * @param url Full WebSocket URL — the serialization format is taken from
1098
1098
  * the `f=` query parameter (e.g. `wss://host/rpc/ws?f=msgpack6`);
1099
1099
  * falls back to the resolver's default when absent. Use
1100
- * {@link RpcPeerRefBuilder.forClient} to compose URLs with a format.
1100
+ * {@link RpcRefBuilder.forClient} to compose URLs with a format.
1101
1101
  * @param mustStart Kick off the reconnect loop automatically at the end of
1102
1102
  * construction (default `true`). Pass `false` if you need to
1103
1103
  * tweak `reconnectDelayer`, `handshakeTimeoutMs`, or similar
@@ -1332,7 +1332,10 @@ declare class RpcStreamSender<T> implements IRpcObject {
1332
1332
  * in-flight window — real-time mode uses the extra space to pre-buffer.
1333
1333
  */
1334
1334
  private _run;
1335
- /** Drain all queued ACKs, returning the most recent one (or null if none). */
1335
+ /** Drain all queued ACKs, returning the most recent one (or null if none).
1336
+ * A reconnect's reset ACK may be drained in one batch with regular
1337
+ * consumption ACKs the client sends right after it, so `mustReset` is
1338
+ * OR-ed over the whole batch — the last ACK alone can't represent it. */
1336
1339
  private _tryProcessAcks;
1337
1340
  /** Wait for the ACK queue to have at least one entry (or `_ended`). */
1338
1341
  private _waitAckReady;
@@ -1481,7 +1484,7 @@ declare class RpcStream<T> implements AsyncIterable<T>, IRpcObject {
1481
1484
  */
1482
1485
  declare function resolveStreamRefs(value: unknown, peer: RpcPeer): unknown;
1483
1486
 
1484
- declare class RpcPeerRefBuilder {
1487
+ declare class RpcRefBuilder {
1485
1488
  /** Build a client peer ref from a WebSocket URL, optionally baking in the
1486
1489
  * serialization format as a `f=` query parameter.
1487
1490
  * @param url Base WebSocket URL, e.g. `wss://host/rpc/ws`.
@@ -1556,4 +1559,4 @@ declare function xxh3_64str(input: string, seed?: bigint): bigint;
1556
1559
  */
1557
1560
  declare function computeMethodHash(methodName: string): number;
1558
1561
 
1559
- export { ARG_DELIMITER, ENVELOPE_DELIMITER, FRAME_DELIMITER, type IRpcObject, IncreasingSeqCompressor, type MethodMeta, REMOTE_EXCEPTION_TYPE_REF, RPC_CLOSE_CODE_UNSUPPORTED_FORMAT, type RemoteHandshake, type RpcCallOptions, RpcCallStage, RpcCallTimeouts, RpcCallTypeId, RpcClientPeer, RpcClientPeerReconnectDelayer, type RpcConnection, RpcConnectionState, type RpcConnectionUrlResolver, type RpcDeserializedMessage, type RpcDispatchContext, RpcError, RpcHub, RpcInboundCall, RpcInboundCallTracker, RpcJsonSerializationFormat, RpcLimits, 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, readPolymorphismMarker, resolveStreamRefs, rpcMethod, rpcService, serializeBinaryFrame, serializeBinaryMessage, serializeCompactBinaryMessage, serializeFrame, serializeMessage, splitBinaryFrame, splitCompactBinaryFrame, splitFrame, toExceptionInfo, wireMethodName, xxh3_64, xxh3_64str };
1562
+ export { ARG_DELIMITER, ENVELOPE_DELIMITER, FRAME_DELIMITER, type IRpcObject, IncreasingSeqCompressor, type MethodMeta, REMOTE_EXCEPTION_TYPE_REF, RPC_CLOSE_CODE_UNSUPPORTED_FORMAT, type RemoteHandshake, type RpcCallOptions, RpcCallStage, RpcCallTimeouts, RpcCallTypeId, RpcClientPeer, RpcClientPeerReconnectDelayer, type RpcConnection, RpcConnectionState, type RpcConnectionUrlResolver, type RpcDeserializedMessage, type RpcDispatchContext, RpcError, RpcHub, RpcInboundCall, RpcInboundCallTracker, RpcJsonSerializationFormat, RpcLimits, type RpcLogScope, type RpcMessage, RpcMessageChannelConnection, RpcMessagePackCompactSerializationFormat, RpcMessagePackSerializationFormat, type RpcMethodDef, type RpcMethodDefInput, RpcMethodRegistry, type RpcObjectId, RpcObjectKind, RpcOutboundCall, RpcOutboundCallTracker, RpcPeer, type RpcPeerFactory, type RpcPeerState, RpcPeerStateKind, RpcPeerStateMonitor, type RpcReceivedMessage, RpcRefBuilder, 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, readPolymorphismMarker, resolveStreamRefs, rpcMethod, rpcService, serializeBinaryFrame, serializeBinaryMessage, serializeCompactBinaryMessage, serializeFrame, serializeMessage, splitBinaryFrame, splitCompactBinaryFrame, splitFrame, toExceptionInfo, wireMethodName, xxh3_64, xxh3_64str };
package/dist/index.d.ts CHANGED
@@ -790,7 +790,7 @@ declare class RpcSystemCallSender {
790
790
  }
791
791
 
792
792
  /** Factory signature shared by all peer lookup/creation methods. Serialization
793
- * format is encoded in the URL via `?f=...` (see {@link RpcPeerRefBuilder}),
793
+ * format is encoded in the URL via `?f=...` (see {@link RpcRefBuilder}),
794
794
  * so the factory doesn't need an extra parameter for it. `getClientPeer` /
795
795
  * `getServerPeer` cast the result, so the factory returns RpcPeer. */
796
796
  type RpcPeerFactory = (hub: RpcHub, ref: string) => RpcPeer;
@@ -1097,7 +1097,7 @@ declare class RpcClientPeer extends RpcPeer {
1097
1097
  * @param url Full WebSocket URL — the serialization format is taken from
1098
1098
  * the `f=` query parameter (e.g. `wss://host/rpc/ws?f=msgpack6`);
1099
1099
  * falls back to the resolver's default when absent. Use
1100
- * {@link RpcPeerRefBuilder.forClient} to compose URLs with a format.
1100
+ * {@link RpcRefBuilder.forClient} to compose URLs with a format.
1101
1101
  * @param mustStart Kick off the reconnect loop automatically at the end of
1102
1102
  * construction (default `true`). Pass `false` if you need to
1103
1103
  * tweak `reconnectDelayer`, `handshakeTimeoutMs`, or similar
@@ -1332,7 +1332,10 @@ declare class RpcStreamSender<T> implements IRpcObject {
1332
1332
  * in-flight window — real-time mode uses the extra space to pre-buffer.
1333
1333
  */
1334
1334
  private _run;
1335
- /** Drain all queued ACKs, returning the most recent one (or null if none). */
1335
+ /** Drain all queued ACKs, returning the most recent one (or null if none).
1336
+ * A reconnect's reset ACK may be drained in one batch with regular
1337
+ * consumption ACKs the client sends right after it, so `mustReset` is
1338
+ * OR-ed over the whole batch — the last ACK alone can't represent it. */
1336
1339
  private _tryProcessAcks;
1337
1340
  /** Wait for the ACK queue to have at least one entry (or `_ended`). */
1338
1341
  private _waitAckReady;
@@ -1481,7 +1484,7 @@ declare class RpcStream<T> implements AsyncIterable<T>, IRpcObject {
1481
1484
  */
1482
1485
  declare function resolveStreamRefs(value: unknown, peer: RpcPeer): unknown;
1483
1486
 
1484
- declare class RpcPeerRefBuilder {
1487
+ declare class RpcRefBuilder {
1485
1488
  /** Build a client peer ref from a WebSocket URL, optionally baking in the
1486
1489
  * serialization format as a `f=` query parameter.
1487
1490
  * @param url Base WebSocket URL, e.g. `wss://host/rpc/ws`.
@@ -1556,4 +1559,4 @@ declare function xxh3_64str(input: string, seed?: bigint): bigint;
1556
1559
  */
1557
1560
  declare function computeMethodHash(methodName: string): number;
1558
1561
 
1559
- export { ARG_DELIMITER, ENVELOPE_DELIMITER, FRAME_DELIMITER, type IRpcObject, IncreasingSeqCompressor, type MethodMeta, REMOTE_EXCEPTION_TYPE_REF, RPC_CLOSE_CODE_UNSUPPORTED_FORMAT, type RemoteHandshake, type RpcCallOptions, RpcCallStage, RpcCallTimeouts, RpcCallTypeId, RpcClientPeer, RpcClientPeerReconnectDelayer, type RpcConnection, RpcConnectionState, type RpcConnectionUrlResolver, type RpcDeserializedMessage, type RpcDispatchContext, RpcError, RpcHub, RpcInboundCall, RpcInboundCallTracker, RpcJsonSerializationFormat, RpcLimits, 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, readPolymorphismMarker, resolveStreamRefs, rpcMethod, rpcService, serializeBinaryFrame, serializeBinaryMessage, serializeCompactBinaryMessage, serializeFrame, serializeMessage, splitBinaryFrame, splitCompactBinaryFrame, splitFrame, toExceptionInfo, wireMethodName, xxh3_64, xxh3_64str };
1562
+ export { ARG_DELIMITER, ENVELOPE_DELIMITER, FRAME_DELIMITER, type IRpcObject, IncreasingSeqCompressor, type MethodMeta, REMOTE_EXCEPTION_TYPE_REF, RPC_CLOSE_CODE_UNSUPPORTED_FORMAT, type RemoteHandshake, type RpcCallOptions, RpcCallStage, RpcCallTimeouts, RpcCallTypeId, RpcClientPeer, RpcClientPeerReconnectDelayer, type RpcConnection, RpcConnectionState, type RpcConnectionUrlResolver, type RpcDeserializedMessage, type RpcDispatchContext, RpcError, RpcHub, RpcInboundCall, RpcInboundCallTracker, RpcJsonSerializationFormat, RpcLimits, type RpcLogScope, type RpcMessage, RpcMessageChannelConnection, RpcMessagePackCompactSerializationFormat, RpcMessagePackSerializationFormat, type RpcMethodDef, type RpcMethodDefInput, RpcMethodRegistry, type RpcObjectId, RpcObjectKind, RpcOutboundCall, RpcOutboundCallTracker, RpcPeer, type RpcPeerFactory, type RpcPeerState, RpcPeerStateKind, RpcPeerStateMonitor, type RpcReceivedMessage, RpcRefBuilder, 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, readPolymorphismMarker, resolveStreamRefs, rpcMethod, rpcService, serializeBinaryFrame, serializeBinaryMessage, serializeCompactBinaryMessage, serializeFrame, serializeMessage, splitBinaryFrame, splitCompactBinaryFrame, splitFrame, toExceptionInfo, wireMethodName, xxh3_64, xxh3_64str };
package/dist/index.js CHANGED
@@ -1362,13 +1362,18 @@ var RpcStreamSender = class _RpcStreamSender {
1362
1362
  }
1363
1363
  }
1364
1364
  /* eslint-enable @typescript-eslint/no-unnecessary-condition */
1365
- /** Drain all queued ACKs, returning the most recent one (or null if none). */
1365
+ /** Drain all queued ACKs, returning the most recent one (or null if none).
1366
+ * A reconnect's reset ACK may be drained in one batch with regular
1367
+ * consumption ACKs the client sends right after it, so `mustReset` is
1368
+ * OR-ed over the whole batch — the last ACK alone can't represent it. */
1366
1369
  _tryProcessAcks() {
1367
1370
  if (this._acks.length === 0) return null;
1368
- let last = null;
1371
+ let nextIndex = 0;
1372
+ let mustReset = false;
1369
1373
  while (this._acks.length > 0) {
1370
1374
  const a = this._acks.shift();
1371
- last = a;
1375
+ nextIndex = a.nextIndex;
1376
+ mustReset ||= a.mustReset;
1372
1377
  if (a.mustReset || this._nextIndex < a.nextIndex) {
1373
1378
  this._nextIndex = a.nextIndex;
1374
1379
  }
@@ -1377,7 +1382,7 @@ var RpcStreamSender = class _RpcStreamSender {
1377
1382
  this.onAckProcessed?.();
1378
1383
  } catch {
1379
1384
  }
1380
- return last;
1385
+ return { nextIndex, mustReset };
1381
1386
  }
1382
1387
  /** Wait for the ACK queue to have at least one entry (or `_ended`). */
1383
1388
  async _waitAckReady() {
@@ -2957,7 +2962,7 @@ var RpcClientPeer = class extends RpcPeer {
2957
2962
  * @param url Full WebSocket URL — the serialization format is taken from
2958
2963
  * the `f=` query parameter (e.g. `wss://host/rpc/ws?f=msgpack6`);
2959
2964
  * falls back to the resolver's default when absent. Use
2960
- * {@link RpcPeerRefBuilder.forClient} to compose URLs with a format.
2965
+ * {@link RpcRefBuilder.forClient} to compose URLs with a format.
2961
2966
  * @param mustStart Kick off the reconnect loop automatically at the end of
2962
2967
  * construction (default `true`). Pass `false` if you need to
2963
2968
  * tweak `reconnectDelayer`, `handshakeTimeoutMs`, or similar
@@ -4277,8 +4282,8 @@ function isSameWireMethod(a, b) {
4277
4282
  return a.wireArgCount === b.wireArgCount && a.callTypeId === b.callTypeId && a.stream === b.stream && a.noWait === b.noWait && a.remoteExecutionMode === b.remoteExecutionMode;
4278
4283
  }
4279
4284
 
4280
- // src/rpc-peer-ref-builder.ts
4281
- var RpcPeerRefBuilder = class {
4285
+ // src/rpc-ref-builder.ts
4286
+ var RpcRefBuilder = class {
4282
4287
  /** Build a client peer ref from a WebSocket URL, optionally baking in the
4283
4288
  * serialization format as a `f=` query parameter.
4284
4289
  * @param url Base WebSocket URL, e.g. `wss://host/rpc/ws`.
@@ -4559,9 +4564,9 @@ export {
4559
4564
  RpcOutboundCall,
4560
4565
  RpcOutboundCallTracker,
4561
4566
  RpcPeer,
4562
- RpcPeerRefBuilder,
4563
4567
  RpcPeerStateKind,
4564
4568
  RpcPeerStateMonitor,
4569
+ RpcRefBuilder,
4565
4570
  RpcRemoteExecutionMode,
4566
4571
  RpcRemoteObjectTracker,
4567
4572
  RpcSerializationFormat,