@replit/river 0.206.0 → 0.207.2

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.
Files changed (39) hide show
  1. package/dist/{chunk-JSU537MZ.js → chunk-24EWYOGK.js} +27 -11
  2. package/dist/chunk-24EWYOGK.js.map +1 -0
  3. package/dist/{chunk-NTVJNU5K.js → chunk-46IVOKJU.js} +2 -11
  4. package/dist/{chunk-NTVJNU5K.js.map → chunk-46IVOKJU.js.map} +1 -1
  5. package/dist/{chunk-VGWFMCOP.js → chunk-4HE7UYRL.js} +2 -2
  6. package/dist/{chunk-FCQWZRES.js → chunk-A7RGOVRV.js} +3 -3
  7. package/dist/{chunk-EMOYAUX3.js → chunk-XV4RQ62N.js} +3 -3
  8. package/dist/{connection-494a5b68.d.ts → connection-a18e31d5.d.ts} +1 -1
  9. package/dist/router/index.cjs +3 -13
  10. package/dist/router/index.cjs.map +1 -1
  11. package/dist/router/index.d.cts +3 -3
  12. package/dist/router/index.d.ts +3 -3
  13. package/dist/router/index.js +2 -4
  14. package/dist/{services-15a0df95.d.ts → services-43528f4b.d.ts} +3 -9
  15. package/dist/testUtil/index.cjs +26 -10
  16. package/dist/testUtil/index.cjs.map +1 -1
  17. package/dist/testUtil/index.d.cts +1 -1
  18. package/dist/testUtil/index.d.ts +1 -1
  19. package/dist/testUtil/index.js +4 -4
  20. package/dist/transport/impls/ws/client.cjs +26 -10
  21. package/dist/transport/impls/ws/client.cjs.map +1 -1
  22. package/dist/transport/impls/ws/client.d.cts +2 -2
  23. package/dist/transport/impls/ws/client.d.ts +2 -2
  24. package/dist/transport/impls/ws/client.js +4 -4
  25. package/dist/transport/impls/ws/server.cjs +26 -10
  26. package/dist/transport/impls/ws/server.cjs.map +1 -1
  27. package/dist/transport/impls/ws/server.d.cts +2 -2
  28. package/dist/transport/impls/ws/server.d.ts +2 -2
  29. package/dist/transport/impls/ws/server.js +4 -4
  30. package/dist/transport/index.cjs +26 -10
  31. package/dist/transport/index.cjs.map +1 -1
  32. package/dist/transport/index.d.cts +2 -2
  33. package/dist/transport/index.d.ts +2 -2
  34. package/dist/transport/index.js +4 -4
  35. package/package.json +1 -1
  36. package/dist/chunk-JSU537MZ.js.map +0 -1
  37. /package/dist/{chunk-VGWFMCOP.js.map → chunk-4HE7UYRL.js.map} +0 -0
  38. /package/dist/{chunk-FCQWZRES.js.map → chunk-A7RGOVRV.js.map} +0 -0
  39. /package/dist/{chunk-EMOYAUX3.js.map → chunk-XV4RQ62N.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import { P as ProvidedClientTransportOptions, a as ProvidedServerTransportOptions, a5 as ClientHandshakeOptions, C as ClientTransport, b as Connection, S as ServerHandshakeOptions, M as BaseErrorSchemaType, B as Readable, a6 as ReadableIterator, a7 as ReadableResult, a8 as Transport, a9 as SessionOptions, aa as ClientTransportOptions, ab as SessionNoConnection, ac as SessionBoundSendFn } from '../services-15a0df95.js';
1
+ import { P as ProvidedClientTransportOptions, a as ProvidedServerTransportOptions, a4 as ClientHandshakeOptions, C as ClientTransport, b as Connection, S as ServerHandshakeOptions, M as BaseErrorSchemaType, B as Readable, a5 as ReadableIterator, a6 as ReadableResult, a7 as Transport, a8 as SessionOptions, a9 as ClientTransportOptions, aa as SessionNoConnection, ab as SessionBoundSendFn } from '../services-43528f4b.js';
2
2
  import { ServerTransport } from '../transport/index.cjs';
3
3
  import { T as TransportClientId, b as PartialTransportMessage, O as OpaqueTransportMessage } from '../message-ffacb98a.js';
4
4
  import { Static } from '@sinclair/typebox';
@@ -1,4 +1,4 @@
1
- import { P as ProvidedClientTransportOptions, a as ProvidedServerTransportOptions, a5 as ClientHandshakeOptions, C as ClientTransport, b as Connection, S as ServerHandshakeOptions, M as BaseErrorSchemaType, B as Readable, a6 as ReadableIterator, a7 as ReadableResult, a8 as Transport, a9 as SessionOptions, aa as ClientTransportOptions, ab as SessionNoConnection, ac as SessionBoundSendFn } from '../services-15a0df95.js';
1
+ import { P as ProvidedClientTransportOptions, a as ProvidedServerTransportOptions, a4 as ClientHandshakeOptions, C as ClientTransport, b as Connection, S as ServerHandshakeOptions, M as BaseErrorSchemaType, B as Readable, a5 as ReadableIterator, a6 as ReadableResult, a7 as Transport, a8 as SessionOptions, a9 as ClientTransportOptions, aa as SessionNoConnection, ab as SessionBoundSendFn } from '../services-43528f4b.js';
2
2
  import { ServerTransport } from '../transport/index.js';
3
3
  import { T as TransportClientId, b as PartialTransportMessage, O as OpaqueTransportMessage } from '../message-ffacb98a.js';
4
4
  import { Static } from '@sinclair/typebox';
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  ClientTransport
3
- } from "../chunk-FCQWZRES.js";
3
+ } from "../chunk-A7RGOVRV.js";
4
4
  import {
5
5
  ServerTransport
6
- } from "../chunk-EMOYAUX3.js";
6
+ } from "../chunk-XV4RQ62N.js";
7
7
  import {
8
8
  Connection,
9
9
  SessionStateGraph,
10
10
  defaultClientTransportOptions,
11
11
  defaultTransportOptions
12
- } from "../chunk-JSU537MZ.js";
12
+ } from "../chunk-24EWYOGK.js";
13
13
  import {
14
14
  currentProtocolVersion,
15
15
  getTracer
16
- } from "../chunk-NTVJNU5K.js";
16
+ } from "../chunk-46IVOKJU.js";
17
17
  import "../chunk-CC7RN7GI.js";
18
18
  import "../chunk-AJGIY2UB.js";
19
19
 
@@ -547,6 +547,9 @@ var IdentifiedSession = class extends CommonSession {
547
547
  return metadata;
548
548
  }
549
549
  constructMsg(partialMsg) {
550
+ if (this._isConsumed) {
551
+ throw new Error(ERR_CONSUMED);
552
+ }
550
553
  const msg = {
551
554
  ...partialMsg,
552
555
  id: generateId(),
@@ -676,7 +679,7 @@ function coerceErrorString(err) {
676
679
  }
677
680
 
678
681
  // package.json
679
- var version = "0.206.0";
682
+ var version = "0.207.2";
680
683
 
681
684
  // tracing/index.ts
682
685
  function getPropagationContext(ctx) {
@@ -835,6 +838,19 @@ var SessionConnected = class extends IdentifiedSession {
835
838
  heartbeatHandle;
836
839
  heartbeatMisses = 0;
837
840
  isActivelyHeartbeating;
841
+ lastConstructedMsgs = [];
842
+ pushLastConstructedMsgs = (msg) => {
843
+ const trackedMsg = {
844
+ id: msg.id,
845
+ seq: msg.seq,
846
+ streamId: msg.streamId,
847
+ stack: new Error().stack
848
+ };
849
+ this.lastConstructedMsgs.push(trackedMsg);
850
+ if (this.lastConstructedMsgs.length > 10) {
851
+ this.lastConstructedMsgs.shift();
852
+ }
853
+ };
838
854
  updateBookkeeping(ack, seq) {
839
855
  this.sendBuffer = this.sendBuffer.filter((unacked) => unacked.seq >= ack);
840
856
  this.ack = seq + 1;
@@ -846,13 +862,17 @@ var SessionConnected = class extends IdentifiedSession {
846
862
  this.log?.error(msg, {
847
863
  ...this.loggingMetadata,
848
864
  transportMessage: constructedMsg,
849
- tags: ["invariant-violation"]
865
+ tags: ["invariant-violation"],
866
+ extras: {
867
+ lastConstructedMsgs: this.lastConstructedMsgs
868
+ }
850
869
  });
851
870
  throw new Error(msg);
852
871
  }
853
872
  }
854
873
  send(msg) {
855
874
  const constructedMsg = this.constructMsg(msg);
875
+ this.pushLastConstructedMsgs(constructedMsg);
856
876
  this.assertSendOrdering(constructedMsg);
857
877
  this.sendBuffer.push(constructedMsg);
858
878
  this.conn.send(this.options.codec.toBuffer(constructedMsg));
@@ -917,12 +937,6 @@ var SessionConnected = class extends IdentifiedSession {
917
937
  }
918
938
  });
919
939
  }
920
- closeConnection() {
921
- this.conn.removeDataListener(this.onMessageData);
922
- this.conn.removeCloseListener(this.listeners.onConnectionClosed);
923
- this.conn.removeErrorListener(this.listeners.onConnectionErrored);
924
- this.conn.close();
925
- }
926
940
  onMessageData = (msg) => {
927
941
  const parsedMsg = this.parseMsg(msg);
928
942
  if (parsedMsg === null) {
@@ -949,7 +963,7 @@ var SessionConnected = class extends IdentifiedSession {
949
963
  code: import_api3.SpanStatusCode.ERROR,
950
964
  message: reason
951
965
  });
952
- this.closeConnection();
966
+ this.conn.close();
953
967
  }
954
968
  return;
955
969
  }
@@ -967,7 +981,9 @@ var SessionConnected = class extends IdentifiedSession {
967
981
  transportMessage: parsedMsg
968
982
  });
969
983
  if (!this.isActivelyHeartbeating) {
970
- this.sendHeartbeat();
984
+ void Promise.resolve().then(() => {
985
+ this.sendHeartbeat();
986
+ });
971
987
  }
972
988
  };
973
989
  _handleStateExit() {