@replit/river 0.26.2 → 0.26.4

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-NC54BC47.js → chunk-42SXIIHP.js} +45 -17
  2. package/dist/chunk-42SXIIHP.js.map +1 -0
  3. package/dist/{chunk-M75K5TJS.js → chunk-65EMTMCV.js} +2 -2
  4. package/dist/{chunk-M75K5TJS.js.map → chunk-65EMTMCV.js.map} +1 -1
  5. package/dist/{chunk-AWCUCZY4.js → chunk-CYD6GTCU.js} +2 -2
  6. package/dist/{chunk-YQABPD3C.js → chunk-DS5LF6PS.js} +51 -56
  7. package/dist/chunk-DS5LF6PS.js.map +1 -0
  8. package/dist/{chunk-IV27BICV.js → chunk-HPOR6FST.js} +30 -31
  9. package/dist/chunk-HPOR6FST.js.map +1 -0
  10. package/dist/{chunk-MREEJE3X.js → chunk-PXRKBNWN.js} +2 -2
  11. package/dist/{chunk-M5X4JTU3.js → chunk-RSCUADHY.js} +5 -4
  12. package/dist/{chunk-M5X4JTU3.js.map → chunk-RSCUADHY.js.map} +1 -1
  13. package/dist/{client-654098be.d.ts → client-6c67339a.d.ts} +3 -3
  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-6140f578.d.ts} +3 -3
  26. package/dist/transport/impls/ws/client.cjs +75 -46
  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 +93 -69
  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 +119 -96
  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 +44 -16
  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-AWCUCZY4.js.map → chunk-CYD6GTCU.js.map} +0 -0
  52. /package/dist/{chunk-MREEJE3X.js.map → chunk-PXRKBNWN.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-6c67339a.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-6c67339a.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-HPOR6FST.js";
4
4
  import {
5
5
  ServerTransport
6
- } from "../chunk-YQABPD3C.js";
6
+ } from "../chunk-DS5LF6PS.js";
7
7
  import {
8
8
  Connection,
9
9
  ProtocolError,
10
10
  Transport
11
- } from "../chunk-M5X4JTU3.js";
11
+ } from "../chunk-RSCUADHY.js";
12
12
  import "../chunk-TAH2GVTJ.js";
13
13
  import {
14
14
  SessionState
15
- } from "../chunk-NC54BC47.js";
15
+ } from "../chunk-42SXIIHP.js";
16
16
  import {
17
17
  OpaqueTransportMessageSchema,
18
18
  TransportMessageSchema
19
- } from "../chunk-M75K5TJS.js";
19
+ } from "../chunk-65EMTMCV.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.4";
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 = {
@@ -745,9 +749,6 @@ var SessionConnecting = class extends IdentifiedSessionWithGracePeriod {
745
749
  super(props);
746
750
  this.connPromise = props.connPromise;
747
751
  this.listeners = props.listeners;
748
- this.connectionTimeout = setTimeout(() => {
749
- this.listeners.onConnectionTimeout();
750
- }, this.options.connectionTimeoutMs);
751
752
  this.connPromise.then(
752
753
  (conn) => {
753
754
  if (this._isConsumed)
@@ -760,11 +761,25 @@ var SessionConnecting = class extends IdentifiedSessionWithGracePeriod {
760
761
  this.listeners.onConnectionFailed(err);
761
762
  }
762
763
  );
764
+ this.connectionTimeout = setTimeout(() => {
765
+ this.listeners.onConnectionTimeout();
766
+ }, this.options.connectionTimeoutMs);
763
767
  }
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
+ const logger = this.log;
772
+ const metadata = this.loggingMetadata;
773
+ this.connPromise.then((conn) => {
774
+ conn.close();
775
+ logger?.info(
776
+ "connection eventually resolved but session has transitioned, closed connection",
777
+ {
778
+ ...metadata,
779
+ ...conn.loggingMetadata
780
+ }
781
+ );
782
+ }).catch(() => {
768
783
  });
769
784
  }
770
785
  _handleStateExit() {
@@ -808,6 +823,13 @@ var SessionWaitingForHandshake = class extends CommonSession {
808
823
  this.conn.addErrorListener(this.listeners.onConnectionErrored);
809
824
  this.conn.addCloseListener(this.listeners.onConnectionClosed);
810
825
  }
826
+ get loggingMetadata() {
827
+ return {
828
+ clientId: this.from,
829
+ connId: this.conn.id,
830
+ ...this.conn.loggingMetadata
831
+ };
832
+ }
811
833
  onHandshakeData = (msg) => {
812
834
  const parsedMsg = this.parseMsg(msg);
813
835
  if (parsedMsg === null) {
@@ -819,12 +841,6 @@ var SessionWaitingForHandshake = class extends CommonSession {
819
841
  }
820
842
  this.listeners.onHandshake(parsedMsg);
821
843
  };
822
- get loggingMetadata() {
823
- return {
824
- clientId: this.from,
825
- connId: this.conn.id
826
- };
827
- }
828
844
  sendHandshake(msg) {
829
845
  return this.conn.send(this.options.codec.toBuffer(msg));
830
846
  }
@@ -857,6 +873,12 @@ var SessionHandshaking = class extends IdentifiedSessionWithGracePeriod {
857
873
  this.conn.addErrorListener(this.listeners.onConnectionErrored);
858
874
  this.conn.addCloseListener(this.listeners.onConnectionClosed);
859
875
  }
876
+ get loggingMetadata() {
877
+ return {
878
+ ...super.loggingMetadata,
879
+ ...this.conn.loggingMetadata
880
+ };
881
+ }
860
882
  onHandshakeData = (msg) => {
861
883
  const parsedMsg = this.parseMsg(msg);
862
884
  if (parsedMsg === null) {
@@ -944,6 +966,12 @@ var SessionConnected = class extends IdentifiedSession {
944
966
  this.heartbeatMisses++;
945
967
  }, this.options.heartbeatIntervalMs);
946
968
  }
969
+ get loggingMetadata() {
970
+ return {
971
+ ...super.loggingMetadata,
972
+ ...this.conn.loggingMetadata
973
+ };
974
+ }
947
975
  startActiveHeartbeat() {
948
976
  this.isActivelyHeartbeating = true;
949
977
  }