@replit/river 0.23.14 → 0.23.16

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 (59) hide show
  1. package/dist/{chunk-D2DHRRBN.js → chunk-JA7XGTAL.js} +4 -4
  2. package/dist/{chunk-GN4YEXT7.js → chunk-LTSLICON.js} +2 -2
  3. package/dist/{chunk-WUL63FR6.js → chunk-MQCGG6KL.js} +4 -4
  4. package/dist/{chunk-BEALFLCB.js → chunk-R47IZD67.js} +2 -2
  5. package/dist/{chunk-GCCRVSMR.js → chunk-TXSQRTZB.js} +2 -2
  6. package/dist/{chunk-GCCRVSMR.js.map → chunk-TXSQRTZB.js.map} +1 -1
  7. package/dist/{chunk-YCLZWES2.js → chunk-UDXM64QK.js} +2 -2
  8. package/dist/{chunk-OTVTKAN6.js → chunk-WN77AT67.js} +29 -4
  9. package/dist/chunk-WN77AT67.js.map +1 -0
  10. package/dist/{chunk-O2AVDJCQ.js → chunk-YXDAOVP7.js} +14 -2
  11. package/dist/{chunk-O2AVDJCQ.js.map → chunk-YXDAOVP7.js.map} +1 -1
  12. package/dist/{client-e13979ac.d.ts → client-0926d3d6.d.ts} +1 -1
  13. package/dist/{connection-e57e98ea.d.ts → connection-99a67d3e.d.ts} +1 -1
  14. package/dist/{connection-5d0978ce.d.ts → connection-d738cc08.d.ts} +1 -1
  15. package/dist/{handshake-5665ffd3.d.ts → handshake-75d0124f.d.ts} +5 -0
  16. package/dist/router/index.cjs +1 -1
  17. package/dist/router/index.cjs.map +1 -1
  18. package/dist/router/index.d.cts +7 -7
  19. package/dist/router/index.d.ts +7 -7
  20. package/dist/router/index.js +2 -2
  21. package/dist/{server-1cfc88d1.d.ts → server-3740c5d9.d.ts} +1 -1
  22. package/dist/{services-86c4d10d.d.ts → services-75e84a9f.d.ts} +2 -2
  23. package/dist/transport/impls/uds/client.cjs +39 -2
  24. package/dist/transport/impls/uds/client.cjs.map +1 -1
  25. package/dist/transport/impls/uds/client.d.cts +3 -3
  26. package/dist/transport/impls/uds/client.d.ts +3 -3
  27. package/dist/transport/impls/uds/client.js +5 -5
  28. package/dist/transport/impls/uds/server.cjs +39 -2
  29. package/dist/transport/impls/uds/server.cjs.map +1 -1
  30. package/dist/transport/impls/uds/server.d.cts +3 -3
  31. package/dist/transport/impls/uds/server.d.ts +3 -3
  32. package/dist/transport/impls/uds/server.js +5 -5
  33. package/dist/transport/impls/ws/client.cjs +39 -2
  34. package/dist/transport/impls/ws/client.cjs.map +1 -1
  35. package/dist/transport/impls/ws/client.d.cts +3 -3
  36. package/dist/transport/impls/ws/client.d.ts +3 -3
  37. package/dist/transport/impls/ws/client.js +5 -5
  38. package/dist/transport/impls/ws/server.cjs +39 -2
  39. package/dist/transport/impls/ws/server.cjs.map +1 -1
  40. package/dist/transport/impls/ws/server.d.cts +3 -3
  41. package/dist/transport/impls/ws/server.d.ts +3 -3
  42. package/dist/transport/impls/ws/server.js +5 -5
  43. package/dist/transport/index.cjs +39 -2
  44. package/dist/transport/index.cjs.map +1 -1
  45. package/dist/transport/index.d.cts +3 -3
  46. package/dist/transport/index.d.ts +3 -3
  47. package/dist/transport/index.js +5 -5
  48. package/dist/util/testHelpers.cjs +13 -1
  49. package/dist/util/testHelpers.cjs.map +1 -1
  50. package/dist/util/testHelpers.d.cts +3 -3
  51. package/dist/util/testHelpers.d.ts +3 -3
  52. package/dist/util/testHelpers.js +3 -3
  53. package/package.json +14 -13
  54. package/dist/chunk-OTVTKAN6.js.map +0 -1
  55. /package/dist/{chunk-D2DHRRBN.js.map → chunk-JA7XGTAL.js.map} +0 -0
  56. /package/dist/{chunk-GN4YEXT7.js.map → chunk-LTSLICON.js.map} +0 -0
  57. /package/dist/{chunk-WUL63FR6.js.map → chunk-MQCGG6KL.js.map} +0 -0
  58. /package/dist/{chunk-BEALFLCB.js.map → chunk-R47IZD67.js.map} +0 -0
  59. /package/dist/{chunk-YCLZWES2.js.map → chunk-UDXM64QK.js.map} +0 -0
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  ServerTransport
3
- } from "../../../chunk-WUL63FR6.js";
3
+ } from "../../../chunk-MQCGG6KL.js";
4
4
  import {
5
5
  UdsConnection
6
- } from "../../../chunk-YCLZWES2.js";
7
- import "../../../chunk-OTVTKAN6.js";
6
+ } from "../../../chunk-UDXM64QK.js";
7
+ import "../../../chunk-WN77AT67.js";
8
8
  import "../../../chunk-6LCL2ZZF.js";
9
- import "../../../chunk-O2AVDJCQ.js";
10
- import "../../../chunk-GCCRVSMR.js";
9
+ import "../../../chunk-YXDAOVP7.js";
10
+ import "../../../chunk-TXSQRTZB.js";
11
11
  import "../../../chunk-4PVU7J25.js";
12
12
 
13
13
  // transport/impls/uds/server.ts
@@ -374,7 +374,7 @@ var import_nanoid2 = require("nanoid");
374
374
  var import_api = require("@opentelemetry/api");
375
375
 
376
376
  // package.json
377
- var version = "0.23.14";
377
+ var version = "0.23.16";
378
378
 
379
379
  // tracing/index.ts
380
380
  function getPropagationContext(ctx) {
@@ -694,6 +694,18 @@ var Session = class {
694
694
  get nextExpectedSeq() {
695
695
  return this.ack;
696
696
  }
697
+ /**
698
+ * Check that the peer's next expected seq number matches something that is in our send buffer
699
+ * _or_ matches our actual next seq.
700
+ */
701
+ nextExpectedSeqInRange(nextExpectedSeq) {
702
+ for (const msg of this.sendBuffer) {
703
+ if (nextExpectedSeq === msg.seq) {
704
+ return true;
705
+ }
706
+ }
707
+ return nextExpectedSeq === this.seq;
708
+ }
697
709
  // This is only used in tests to make the session misbehave.
698
710
  /* @internal */
699
711
  advanceAckForTesting(by) {
@@ -802,6 +814,20 @@ var Transport = class {
802
814
  if (this.log) {
803
815
  session.bindLogger(this.log);
804
816
  }
817
+ const currentSession = this.sessions.get(session.to);
818
+ if (currentSession) {
819
+ this.log?.warn(
820
+ `session ${session.id} from ${session.to} surreptitiously replacing ${currentSession.id}`,
821
+ {
822
+ ...currentSession.loggingMetadata,
823
+ tags: ["invariant-violation"]
824
+ }
825
+ );
826
+ this.deleteSession({
827
+ session: currentSession,
828
+ closeHandshakingConnection: false
829
+ });
830
+ }
805
831
  this.sessions.set(session.to, session);
806
832
  this.eventDispatcher.dispatchEvent("sessionStatus", {
807
833
  status: "connect",
@@ -841,7 +867,7 @@ var Transport = class {
841
867
  if (
842
868
  // reject this request if there was no previous session to replace
843
869
  session === void 0 || // or if both parties do not agree about the next expected sequence number
844
- session.nextExpectedAck < nextExpectedSeq || // or if both parties do not agree on the advertised session id
870
+ !session.nextExpectedSeqInRange(nextExpectedSeq) || // or if both parties do not agree on the advertised session id
845
871
  session.advertisedSessionId !== sessionId
846
872
  ) {
847
873
  return false;
@@ -900,6 +926,17 @@ var Transport = class {
900
926
  }
901
927
  session.close();
902
928
  session.telemetry.span.end();
929
+ const currentSession = this.sessions.get(session.to);
930
+ if (currentSession && currentSession.id !== session.id) {
931
+ this.log?.warn(
932
+ `session ${session.id} disconnect from ${session.to}, mismatch with ${currentSession.id}`,
933
+ {
934
+ ...session.loggingMetadata,
935
+ tags: ["invariant-violation"]
936
+ }
937
+ );
938
+ return;
939
+ }
903
940
  this.sessions.delete(session.to);
904
941
  this.log?.info(
905
942
  `session ${session.id} disconnect from ${session.to}`,