@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,9 +1,9 @@
1
1
  import { T as TransportClientId } from '../../../message-ffacb98a.js';
2
2
  import { WebSocketServer } from 'ws';
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 { ServerTransport } from '../../index.cjs';
6
- import { a as ProvidedServerTransportOptions } from '../../../services-15a0df95.js';
6
+ import { a as ProvidedServerTransportOptions } from '../../../services-43528f4b.js';
7
7
  import { IncomingMessage } from 'http';
8
8
  import '@sinclair/typebox';
9
9
  import '@opentelemetry/api';
@@ -1,9 +1,9 @@
1
1
  import { T as TransportClientId } from '../../../message-ffacb98a.js';
2
2
  import { WebSocketServer } from 'ws';
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 { ServerTransport } from '../../index.js';
6
- import { a as ProvidedServerTransportOptions } from '../../../services-15a0df95.js';
6
+ import { a as ProvidedServerTransportOptions } from '../../../services-43528f4b.js';
7
7
  import { IncomingMessage } from 'http';
8
8
  import '@sinclair/typebox';
9
9
  import '@opentelemetry/api';
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  ServerTransport
3
- } from "../../../chunk-EMOYAUX3.js";
3
+ } from "../../../chunk-XV4RQ62N.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
 
@@ -516,6 +516,9 @@ var IdentifiedSession = class extends CommonSession {
516
516
  return metadata;
517
517
  }
518
518
  constructMsg(partialMsg) {
519
+ if (this._isConsumed) {
520
+ throw new Error(ERR_CONSUMED);
521
+ }
519
522
  const msg = {
520
523
  ...partialMsg,
521
524
  id: generateId(),
@@ -645,7 +648,7 @@ function coerceErrorString(err) {
645
648
  }
646
649
 
647
650
  // package.json
648
- var version = "0.206.0";
651
+ var version = "0.207.2";
649
652
 
650
653
  // tracing/index.ts
651
654
  function getPropagationContext(ctx) {
@@ -804,6 +807,19 @@ var SessionConnected = class extends IdentifiedSession {
804
807
  heartbeatHandle;
805
808
  heartbeatMisses = 0;
806
809
  isActivelyHeartbeating;
810
+ lastConstructedMsgs = [];
811
+ pushLastConstructedMsgs = (msg) => {
812
+ const trackedMsg = {
813
+ id: msg.id,
814
+ seq: msg.seq,
815
+ streamId: msg.streamId,
816
+ stack: new Error().stack
817
+ };
818
+ this.lastConstructedMsgs.push(trackedMsg);
819
+ if (this.lastConstructedMsgs.length > 10) {
820
+ this.lastConstructedMsgs.shift();
821
+ }
822
+ };
807
823
  updateBookkeeping(ack, seq) {
808
824
  this.sendBuffer = this.sendBuffer.filter((unacked) => unacked.seq >= ack);
809
825
  this.ack = seq + 1;
@@ -815,13 +831,17 @@ var SessionConnected = class extends IdentifiedSession {
815
831
  this.log?.error(msg, {
816
832
  ...this.loggingMetadata,
817
833
  transportMessage: constructedMsg,
818
- tags: ["invariant-violation"]
834
+ tags: ["invariant-violation"],
835
+ extras: {
836
+ lastConstructedMsgs: this.lastConstructedMsgs
837
+ }
819
838
  });
820
839
  throw new Error(msg);
821
840
  }
822
841
  }
823
842
  send(msg) {
824
843
  const constructedMsg = this.constructMsg(msg);
844
+ this.pushLastConstructedMsgs(constructedMsg);
825
845
  this.assertSendOrdering(constructedMsg);
826
846
  this.sendBuffer.push(constructedMsg);
827
847
  this.conn.send(this.options.codec.toBuffer(constructedMsg));
@@ -886,12 +906,6 @@ var SessionConnected = class extends IdentifiedSession {
886
906
  }
887
907
  });
888
908
  }
889
- closeConnection() {
890
- this.conn.removeDataListener(this.onMessageData);
891
- this.conn.removeCloseListener(this.listeners.onConnectionClosed);
892
- this.conn.removeErrorListener(this.listeners.onConnectionErrored);
893
- this.conn.close();
894
- }
895
909
  onMessageData = (msg) => {
896
910
  const parsedMsg = this.parseMsg(msg);
897
911
  if (parsedMsg === null) {
@@ -918,7 +932,7 @@ var SessionConnected = class extends IdentifiedSession {
918
932
  code: import_api3.SpanStatusCode.ERROR,
919
933
  message: reason
920
934
  });
921
- this.closeConnection();
935
+ this.conn.close();
922
936
  }
923
937
  return;
924
938
  }
@@ -936,7 +950,9 @@ var SessionConnected = class extends IdentifiedSession {
936
950
  transportMessage: parsedMsg
937
951
  });
938
952
  if (!this.isActivelyHeartbeating) {
939
- this.sendHeartbeat();
953
+ void Promise.resolve().then(() => {
954
+ this.sendHeartbeat();
955
+ });
940
956
  }
941
957
  };
942
958
  _handleStateExit() {