@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,6 +1,6 @@
1
- import { C as ClientTransport, P as ProvidedClientTransportOptions } from '../../../services-15a0df95.js';
1
+ import { C as ClientTransport, P as ProvidedClientTransportOptions } from '../../../services-43528f4b.js';
2
2
  import { T as TransportClientId } from '../../../message-ffacb98a.js';
3
- import { W as WebSocketConnection } from '../../../connection-494a5b68.js';
3
+ import { W as WebSocketConnection } from '../../../connection-a18e31d5.js';
4
4
  import { W as WsLike } from '../../../wslike-e0b32dd5.js';
5
5
  import '@sinclair/typebox';
6
6
  import '@opentelemetry/api';
@@ -1,6 +1,6 @@
1
- import { C as ClientTransport, P as ProvidedClientTransportOptions } from '../../../services-15a0df95.js';
1
+ import { C as ClientTransport, P as ProvidedClientTransportOptions } from '../../../services-43528f4b.js';
2
2
  import { T as TransportClientId } from '../../../message-ffacb98a.js';
3
- import { W as WebSocketConnection } from '../../../connection-494a5b68.js';
3
+ import { W as WebSocketConnection } from '../../../connection-a18e31d5.js';
4
4
  import { W as WsLike } from '../../../wslike-e0b32dd5.js';
5
5
  import '@sinclair/typebox';
6
6
  import '@opentelemetry/api';
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  ClientTransport
3
- } from "../../../chunk-FCQWZRES.js";
3
+ } from "../../../chunk-A7RGOVRV.js";
4
4
  import {
5
5
  WebSocketConnection
6
- } from "../../../chunk-VGWFMCOP.js";
7
- import "../../../chunk-JSU537MZ.js";
8
- import "../../../chunk-NTVJNU5K.js";
6
+ } from "../../../chunk-4HE7UYRL.js";
7
+ import "../../../chunk-24EWYOGK.js";
8
+ import "../../../chunk-46IVOKJU.js";
9
9
  import "../../../chunk-CC7RN7GI.js";
10
10
  import "../../../chunk-AJGIY2UB.js";
11
11
 
@@ -608,6 +608,9 @@ var IdentifiedSession = class extends CommonSession {
608
608
  return metadata;
609
609
  }
610
610
  constructMsg(partialMsg) {
611
+ if (this._isConsumed) {
612
+ throw new Error(ERR_CONSUMED);
613
+ }
611
614
  const msg = {
612
615
  ...partialMsg,
613
616
  id: generateId(),
@@ -737,7 +740,7 @@ function coerceErrorString(err) {
737
740
  }
738
741
 
739
742
  // package.json
740
- var version = "0.206.0";
743
+ var version = "0.207.2";
741
744
 
742
745
  // tracing/index.ts
743
746
  function createSessionTelemetryInfo(tracer, sessionId, to, from, propagationCtx) {
@@ -888,6 +891,19 @@ var SessionConnected = class extends IdentifiedSession {
888
891
  heartbeatHandle;
889
892
  heartbeatMisses = 0;
890
893
  isActivelyHeartbeating;
894
+ lastConstructedMsgs = [];
895
+ pushLastConstructedMsgs = (msg) => {
896
+ const trackedMsg = {
897
+ id: msg.id,
898
+ seq: msg.seq,
899
+ streamId: msg.streamId,
900
+ stack: new Error().stack
901
+ };
902
+ this.lastConstructedMsgs.push(trackedMsg);
903
+ if (this.lastConstructedMsgs.length > 10) {
904
+ this.lastConstructedMsgs.shift();
905
+ }
906
+ };
891
907
  updateBookkeeping(ack, seq) {
892
908
  this.sendBuffer = this.sendBuffer.filter((unacked) => unacked.seq >= ack);
893
909
  this.ack = seq + 1;
@@ -899,13 +915,17 @@ var SessionConnected = class extends IdentifiedSession {
899
915
  this.log?.error(msg, {
900
916
  ...this.loggingMetadata,
901
917
  transportMessage: constructedMsg,
902
- tags: ["invariant-violation"]
918
+ tags: ["invariant-violation"],
919
+ extras: {
920
+ lastConstructedMsgs: this.lastConstructedMsgs
921
+ }
903
922
  });
904
923
  throw new Error(msg);
905
924
  }
906
925
  }
907
926
  send(msg) {
908
927
  const constructedMsg = this.constructMsg(msg);
928
+ this.pushLastConstructedMsgs(constructedMsg);
909
929
  this.assertSendOrdering(constructedMsg);
910
930
  this.sendBuffer.push(constructedMsg);
911
931
  this.conn.send(this.options.codec.toBuffer(constructedMsg));
@@ -970,12 +990,6 @@ var SessionConnected = class extends IdentifiedSession {
970
990
  }
971
991
  });
972
992
  }
973
- closeConnection() {
974
- this.conn.removeDataListener(this.onMessageData);
975
- this.conn.removeCloseListener(this.listeners.onConnectionClosed);
976
- this.conn.removeErrorListener(this.listeners.onConnectionErrored);
977
- this.conn.close();
978
- }
979
993
  onMessageData = (msg) => {
980
994
  const parsedMsg = this.parseMsg(msg);
981
995
  if (parsedMsg === null) {
@@ -1002,7 +1016,7 @@ var SessionConnected = class extends IdentifiedSession {
1002
1016
  code: import_api3.SpanStatusCode.ERROR,
1003
1017
  message: reason
1004
1018
  });
1005
- this.closeConnection();
1019
+ this.conn.close();
1006
1020
  }
1007
1021
  return;
1008
1022
  }
@@ -1020,7 +1034,9 @@ var SessionConnected = class extends IdentifiedSession {
1020
1034
  transportMessage: parsedMsg
1021
1035
  });
1022
1036
  if (!this.isActivelyHeartbeating) {
1023
- this.sendHeartbeat();
1037
+ void Promise.resolve().then(() => {
1038
+ this.sendHeartbeat();
1039
+ });
1024
1040
  }
1025
1041
  };
1026
1042
  _handleStateExit() {