@replit/river 0.26.2 → 0.26.3

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 (52) hide show
  1. package/dist/{chunk-MREEJE3X.js → chunk-3JCZNGF7.js} +2 -2
  2. package/dist/{chunk-IV27BICV.js → chunk-BB2E5L4U.js} +12 -13
  3. package/dist/chunk-BB2E5L4U.js.map +1 -0
  4. package/dist/{chunk-M5X4JTU3.js → chunk-JI6FFDY5.js} +5 -4
  5. package/dist/{chunk-M5X4JTU3.js.map → chunk-JI6FFDY5.js.map} +1 -1
  6. package/dist/{chunk-M75K5TJS.js → chunk-MZELCWJK.js} +2 -2
  7. package/dist/{chunk-M75K5TJS.js.map → chunk-MZELCWJK.js.map} +1 -1
  8. package/dist/{chunk-NC54BC47.js → chunk-OCL2FUTQ.js} +40 -14
  9. package/dist/chunk-OCL2FUTQ.js.map +1 -0
  10. package/dist/{chunk-YQABPD3C.js → chunk-X35QRIA5.js} +51 -56
  11. package/dist/chunk-X35QRIA5.js.map +1 -0
  12. package/dist/{chunk-AWCUCZY4.js → chunk-ZY2HYJ5Y.js} +2 -2
  13. package/dist/{client-654098be.d.ts → client-1894a9c9.d.ts} +2 -2
  14. package/dist/{connection-bc2454dc.d.ts → connection-03ffb583.d.ts} +1 -1
  15. package/dist/{handshake-1a86f06d.d.ts → handshake-154a0bb2.d.ts} +30 -1
  16. package/dist/logging/index.d.cts +1 -1
  17. package/dist/logging/index.d.ts +1 -1
  18. package/dist/{message-57296605.d.ts → message-ff78a233.d.ts} +1 -1
  19. package/dist/router/index.cjs +1 -1
  20. package/dist/router/index.cjs.map +1 -1
  21. package/dist/router/index.d.cts +9 -8
  22. package/dist/router/index.d.ts +9 -8
  23. package/dist/router/index.js +2 -2
  24. package/dist/{server-9a6b5a8e.d.ts → server-1f5eb427.d.ts} +17 -4
  25. package/dist/{services-7daa60a0.d.ts → services-491d8c32.d.ts} +3 -3
  26. package/dist/transport/impls/ws/client.cjs +52 -25
  27. package/dist/transport/impls/ws/client.cjs.map +1 -1
  28. package/dist/transport/impls/ws/client.d.cts +5 -4
  29. package/dist/transport/impls/ws/client.d.ts +5 -4
  30. package/dist/transport/impls/ws/client.js +8 -7
  31. package/dist/transport/impls/ws/client.js.map +1 -1
  32. package/dist/transport/impls/ws/server.cjs +88 -66
  33. package/dist/transport/impls/ws/server.cjs.map +1 -1
  34. package/dist/transport/impls/ws/server.d.cts +5 -4
  35. package/dist/transport/impls/ws/server.d.ts +5 -4
  36. package/dist/transport/impls/ws/server.js +5 -5
  37. package/dist/transport/index.cjs +96 -75
  38. package/dist/transport/index.cjs.map +1 -1
  39. package/dist/transport/index.d.cts +5 -4
  40. package/dist/transport/index.d.ts +5 -4
  41. package/dist/transport/index.js +5 -5
  42. package/dist/util/testHelpers.cjs +39 -13
  43. package/dist/util/testHelpers.cjs.map +1 -1
  44. package/dist/util/testHelpers.d.cts +5 -4
  45. package/dist/util/testHelpers.d.ts +5 -4
  46. package/dist/util/testHelpers.js +3 -3
  47. package/package.json +1 -1
  48. package/dist/chunk-IV27BICV.js.map +0 -1
  49. package/dist/chunk-NC54BC47.js.map +0 -1
  50. package/dist/chunk-YQABPD3C.js.map +0 -1
  51. /package/dist/{chunk-MREEJE3X.js.map → chunk-3JCZNGF7.js.map} +0 -0
  52. /package/dist/{chunk-AWCUCZY4.js.map → chunk-ZY2HYJ5Y.js.map} +0 -0
@@ -1,8 +1,9 @@
1
- export { b as ClientTransportOptions, C as Connection, j as EventHandler, E as EventMap, i as EventTypes, k as ProtocolError, l as ProtocolErrorType, c as ServerTransportOptions, S as Session, h as SessionConnected, f as SessionConnecting, g as SessionHandshaking, e as SessionNoConnection, d as SessionState, T as Transport, P as TransportOptions, a as TransportStatus } from '../handshake-1a86f06d.js';
2
- export { C as ClientTransport } from '../client-654098be.js';
3
- export { S as ServerTransport, a as SessionWaitingForHandshake } from '../server-9a6b5a8e.js';
4
- export { b as OpaqueTransportMessage, O as OpaqueTransportMessageSchema, c as TransportClientId, a as TransportMessage, T as TransportMessageSchema, d as isStreamClose, i as isStreamOpen } from '../message-57296605.js';
1
+ export { b as ClientTransportOptions, C as Connection, j as EventHandler, E as EventMap, i as EventTypes, k as ProtocolError, l as ProtocolErrorType, c as ServerTransportOptions, S as Session, h as SessionConnected, f as SessionConnecting, g as SessionHandshaking, e as SessionNoConnection, d as SessionState, T as Transport, P as TransportOptions, a as TransportStatus } from '../handshake-154a0bb2.js';
2
+ export { C as ClientTransport } from '../client-1894a9c9.js';
3
+ export { S as ServerTransport, a as SessionWaitingForHandshake } from '../server-1f5eb427.js';
4
+ export { b as OpaqueTransportMessage, O as OpaqueTransportMessageSchema, c as TransportClientId, a as TransportMessage, T as TransportMessageSchema, d as isStreamClose, i as isStreamOpen } from '../message-ff78a233.js';
5
5
  import '@sinclair/typebox';
6
+ import '@sinclair/typebox/errors';
6
7
  import '../types-3e5768ec.js';
7
8
  import '@sinclair/typebox/value';
8
9
  import '@opentelemetry/api';
@@ -1,8 +1,9 @@
1
- export { b as ClientTransportOptions, C as Connection, j as EventHandler, E as EventMap, i as EventTypes, k as ProtocolError, l as ProtocolErrorType, c as ServerTransportOptions, S as Session, h as SessionConnected, f as SessionConnecting, g as SessionHandshaking, e as SessionNoConnection, d as SessionState, T as Transport, P as TransportOptions, a as TransportStatus } from '../handshake-1a86f06d.js';
2
- export { C as ClientTransport } from '../client-654098be.js';
3
- export { S as ServerTransport, a as SessionWaitingForHandshake } from '../server-9a6b5a8e.js';
4
- export { b as OpaqueTransportMessage, O as OpaqueTransportMessageSchema, c as TransportClientId, a as TransportMessage, T as TransportMessageSchema, d as isStreamClose, i as isStreamOpen } from '../message-57296605.js';
1
+ export { b as ClientTransportOptions, C as Connection, j as EventHandler, E as EventMap, i as EventTypes, k as ProtocolError, l as ProtocolErrorType, c as ServerTransportOptions, S as Session, h as SessionConnected, f as SessionConnecting, g as SessionHandshaking, e as SessionNoConnection, d as SessionState, T as Transport, P as TransportOptions, a as TransportStatus } from '../handshake-154a0bb2.js';
2
+ export { C as ClientTransport } from '../client-1894a9c9.js';
3
+ export { S as ServerTransport, a as SessionWaitingForHandshake } from '../server-1f5eb427.js';
4
+ export { b as OpaqueTransportMessage, O as OpaqueTransportMessageSchema, c as TransportClientId, a as TransportMessage, T as TransportMessageSchema, d as isStreamClose, i as isStreamOpen } from '../message-ff78a233.js';
5
5
  import '@sinclair/typebox';
6
+ import '@sinclair/typebox/errors';
6
7
  import '../types-3e5768ec.js';
7
8
  import '@sinclair/typebox/value';
8
9
  import '@opentelemetry/api';
@@ -1,22 +1,22 @@
1
1
  import {
2
2
  ClientTransport
3
- } from "../chunk-IV27BICV.js";
3
+ } from "../chunk-BB2E5L4U.js";
4
4
  import {
5
5
  ServerTransport
6
- } from "../chunk-YQABPD3C.js";
6
+ } from "../chunk-X35QRIA5.js";
7
7
  import {
8
8
  Connection,
9
9
  ProtocolError,
10
10
  Transport
11
- } from "../chunk-M5X4JTU3.js";
11
+ } from "../chunk-JI6FFDY5.js";
12
12
  import "../chunk-TAH2GVTJ.js";
13
13
  import {
14
14
  SessionState
15
- } from "../chunk-NC54BC47.js";
15
+ } from "../chunk-OCL2FUTQ.js";
16
16
  import {
17
17
  OpaqueTransportMessageSchema,
18
18
  TransportMessageSchema
19
- } from "../chunk-M75K5TJS.js";
19
+ } from "../chunk-MZELCWJK.js";
20
20
  import "../chunk-4PVU7J25.js";
21
21
  export {
22
22
  ClientTransport,
@@ -460,7 +460,7 @@ function Err(error) {
460
460
  var import_api = require("@opentelemetry/api");
461
461
 
462
462
  // package.json
463
- var version = "0.26.2";
463
+ var version = "0.26.3";
464
464
 
465
465
  // tracing/index.ts
466
466
  function createSessionTelemetryInfo(sessionId, to, from, propagationCtx) {
@@ -594,6 +594,7 @@ var StateMachineState = class {
594
594
  }
595
595
  if (prop === "_handleClose") {
596
596
  return () => {
597
+ target._isConsumed = true;
597
598
  target._handleStateExit();
598
599
  target._handleClose();
599
600
  };
@@ -674,15 +675,18 @@ var IdentifiedSession = class extends CommonSession {
674
675
  }
675
676
  get loggingMetadata() {
676
677
  const spanContext = this.telemetry.span.spanContext();
677
- return {
678
+ const metadata = {
678
679
  clientId: this.from,
679
680
  connectedTo: this.to,
680
- sessionId: this.id,
681
- telemetry: {
681
+ sessionId: this.id
682
+ };
683
+ if (this.telemetry.span.isRecording()) {
684
+ metadata.telemetry = {
682
685
  traceId: spanContext.traceId,
683
686
  spanId: spanContext.spanId
684
- }
685
- };
687
+ };
688
+ }
689
+ return metadata;
686
690
  }
687
691
  constructMsg(partialMsg) {
688
692
  const msg = {
@@ -764,7 +768,16 @@ var SessionConnecting = class extends IdentifiedSessionWithGracePeriod {
764
768
  // close a pending connection if it resolves, ignore errors if the promise
765
769
  // ends up rejected anyways
766
770
  bestEffortClose() {
767
- void this.connPromise.then((conn) => conn.close()).catch(() => {
771
+ void this.connPromise.then((conn) => {
772
+ conn.close();
773
+ this.log?.info(
774
+ "connection eventually resolved but session has transitioned, closed connection",
775
+ {
776
+ ...this.loggingMetadata,
777
+ ...conn.loggingMetadata
778
+ }
779
+ );
780
+ }).catch(() => {
768
781
  });
769
782
  }
770
783
  _handleStateExit() {
@@ -808,6 +821,13 @@ var SessionWaitingForHandshake = class extends CommonSession {
808
821
  this.conn.addErrorListener(this.listeners.onConnectionErrored);
809
822
  this.conn.addCloseListener(this.listeners.onConnectionClosed);
810
823
  }
824
+ get loggingMetadata() {
825
+ return {
826
+ clientId: this.from,
827
+ connId: this.conn.id,
828
+ ...this.conn.loggingMetadata
829
+ };
830
+ }
811
831
  onHandshakeData = (msg) => {
812
832
  const parsedMsg = this.parseMsg(msg);
813
833
  if (parsedMsg === null) {
@@ -819,12 +839,6 @@ var SessionWaitingForHandshake = class extends CommonSession {
819
839
  }
820
840
  this.listeners.onHandshake(parsedMsg);
821
841
  };
822
- get loggingMetadata() {
823
- return {
824
- clientId: this.from,
825
- connId: this.conn.id
826
- };
827
- }
828
842
  sendHandshake(msg) {
829
843
  return this.conn.send(this.options.codec.toBuffer(msg));
830
844
  }
@@ -857,6 +871,12 @@ var SessionHandshaking = class extends IdentifiedSessionWithGracePeriod {
857
871
  this.conn.addErrorListener(this.listeners.onConnectionErrored);
858
872
  this.conn.addCloseListener(this.listeners.onConnectionClosed);
859
873
  }
874
+ get loggingMetadata() {
875
+ return {
876
+ ...super.loggingMetadata,
877
+ ...this.conn.loggingMetadata
878
+ };
879
+ }
860
880
  onHandshakeData = (msg) => {
861
881
  const parsedMsg = this.parseMsg(msg);
862
882
  if (parsedMsg === null) {
@@ -944,6 +964,12 @@ var SessionConnected = class extends IdentifiedSession {
944
964
  this.heartbeatMisses++;
945
965
  }, this.options.heartbeatIntervalMs);
946
966
  }
967
+ get loggingMetadata() {
968
+ return {
969
+ ...super.loggingMetadata,
970
+ ...this.conn.loggingMetadata
971
+ };
972
+ }
947
973
  startActiveHeartbeat() {
948
974
  this.isActivelyHeartbeating = true;
949
975
  }