@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.cjs CHANGED
@@ -56,9 +56,9 @@ __export(index_exports, {
56
56
  RpcOutboundCall: () => RpcOutboundCall,
57
57
  RpcOutboundCallTracker: () => RpcOutboundCallTracker,
58
58
  RpcPeer: () => RpcPeer,
59
- RpcPeerRefBuilder: () => RpcPeerRefBuilder,
60
59
  RpcPeerStateKind: () => RpcPeerStateKind,
61
60
  RpcPeerStateMonitor: () => RpcPeerStateMonitor,
61
+ RpcRefBuilder: () => RpcRefBuilder,
62
62
  RpcRemoteExecutionMode: () => RpcRemoteExecutionMode,
63
63
  RpcRemoteObjectTracker: () => RpcRemoteObjectTracker,
64
64
  RpcSerializationFormat: () => RpcSerializationFormat,
@@ -1472,13 +1472,18 @@ var RpcStreamSender = class _RpcStreamSender {
1472
1472
  }
1473
1473
  }
1474
1474
  /* eslint-enable @typescript-eslint/no-unnecessary-condition */
1475
- /** Drain all queued ACKs, returning the most recent one (or null if none). */
1475
+ /** Drain all queued ACKs, returning the most recent one (or null if none).
1476
+ * A reconnect's reset ACK may be drained in one batch with regular
1477
+ * consumption ACKs the client sends right after it, so `mustReset` is
1478
+ * OR-ed over the whole batch — the last ACK alone can't represent it. */
1476
1479
  _tryProcessAcks() {
1477
1480
  if (this._acks.length === 0) return null;
1478
- let last = null;
1481
+ let nextIndex = 0;
1482
+ let mustReset = false;
1479
1483
  while (this._acks.length > 0) {
1480
1484
  const a = this._acks.shift();
1481
- last = a;
1485
+ nextIndex = a.nextIndex;
1486
+ mustReset ||= a.mustReset;
1482
1487
  if (a.mustReset || this._nextIndex < a.nextIndex) {
1483
1488
  this._nextIndex = a.nextIndex;
1484
1489
  }
@@ -1487,7 +1492,7 @@ var RpcStreamSender = class _RpcStreamSender {
1487
1492
  this.onAckProcessed?.();
1488
1493
  } catch {
1489
1494
  }
1490
- return last;
1495
+ return { nextIndex, mustReset };
1491
1496
  }
1492
1497
  /** Wait for the ACK queue to have at least one entry (or `_ended`). */
1493
1498
  async _waitAckReady() {
@@ -3067,7 +3072,7 @@ var RpcClientPeer = class extends RpcPeer {
3067
3072
  * @param url Full WebSocket URL — the serialization format is taken from
3068
3073
  * the `f=` query parameter (e.g. `wss://host/rpc/ws?f=msgpack6`);
3069
3074
  * falls back to the resolver's default when absent. Use
3070
- * {@link RpcPeerRefBuilder.forClient} to compose URLs with a format.
3075
+ * {@link RpcRefBuilder.forClient} to compose URLs with a format.
3071
3076
  * @param mustStart Kick off the reconnect loop automatically at the end of
3072
3077
  * construction (default `true`). Pass `false` if you need to
3073
3078
  * tweak `reconnectDelayer`, `handshakeTimeoutMs`, or similar
@@ -4387,8 +4392,8 @@ function isSameWireMethod(a, b) {
4387
4392
  return a.wireArgCount === b.wireArgCount && a.callTypeId === b.callTypeId && a.stream === b.stream && a.noWait === b.noWait && a.remoteExecutionMode === b.remoteExecutionMode;
4388
4393
  }
4389
4394
 
4390
- // src/rpc-peer-ref-builder.ts
4391
- var RpcPeerRefBuilder = class {
4395
+ // src/rpc-ref-builder.ts
4396
+ var RpcRefBuilder = class {
4392
4397
  /** Build a client peer ref from a WebSocket URL, optionally baking in the
4393
4398
  * serialization format as a `f=` query parameter.
4394
4399
  * @param url Base WebSocket URL, e.g. `wss://host/rpc/ws`.
@@ -4670,9 +4675,9 @@ var RpcPeerStateMonitor = class {
4670
4675
  RpcOutboundCall,
4671
4676
  RpcOutboundCallTracker,
4672
4677
  RpcPeer,
4673
- RpcPeerRefBuilder,
4674
4678
  RpcPeerStateKind,
4675
4679
  RpcPeerStateMonitor,
4680
+ RpcRefBuilder,
4676
4681
  RpcRemoteExecutionMode,
4677
4682
  RpcRemoteObjectTracker,
4678
4683
  RpcSerializationFormat,