@replit/river 0.23.10 → 0.23.12

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-FRICSBDW.js → chunk-7RUKEUKE.js} +2 -2
  2. package/dist/{chunk-FRICSBDW.js.map → chunk-7RUKEUKE.js.map} +1 -1
  3. package/dist/{chunk-UXQMGZKP.js → chunk-H6KTH6W6.js} +2 -2
  4. package/dist/{chunk-Z4G27Y2I.js → chunk-HDBVL7EF.js} +2 -2
  5. package/dist/{chunk-KBAZ5TWE.js → chunk-VRU4IKRT.js} +62 -50
  6. package/dist/chunk-VRU4IKRT.js.map +1 -0
  7. package/dist/{chunk-B323CECK.js → chunk-XZ6IOBM5.js} +9 -9
  8. package/dist/chunk-XZ6IOBM5.js.map +1 -0
  9. package/dist/{connection-efcd4e1a.d.ts → connection-581558f8.d.ts} +1 -1
  10. package/dist/{connection-700340c4.d.ts → connection-8debd45f.d.ts} +1 -1
  11. package/dist/router/index.cjs +8 -8
  12. package/dist/router/index.cjs.map +1 -1
  13. package/dist/router/index.d.cts +11 -7
  14. package/dist/router/index.d.ts +11 -7
  15. package/dist/router/index.js +2 -2
  16. package/dist/{services-409c5545.d.ts → services-ca72c9f8.d.ts} +1 -1
  17. package/dist/transport/impls/uds/client.cjs +59 -47
  18. package/dist/transport/impls/uds/client.cjs.map +1 -1
  19. package/dist/transport/impls/uds/client.d.cts +2 -2
  20. package/dist/transport/impls/uds/client.d.ts +2 -2
  21. package/dist/transport/impls/uds/client.js +3 -3
  22. package/dist/transport/impls/uds/server.cjs +20 -38
  23. package/dist/transport/impls/uds/server.cjs.map +1 -1
  24. package/dist/transport/impls/uds/server.d.cts +2 -2
  25. package/dist/transport/impls/uds/server.d.ts +2 -2
  26. package/dist/transport/impls/uds/server.js +3 -3
  27. package/dist/transport/impls/ws/client.cjs +59 -47
  28. package/dist/transport/impls/ws/client.cjs.map +1 -1
  29. package/dist/transport/impls/ws/client.d.cts +2 -2
  30. package/dist/transport/impls/ws/client.d.ts +2 -2
  31. package/dist/transport/impls/ws/client.js +3 -3
  32. package/dist/transport/impls/ws/server.cjs +20 -38
  33. package/dist/transport/impls/ws/server.cjs.map +1 -1
  34. package/dist/transport/impls/ws/server.d.cts +2 -2
  35. package/dist/transport/impls/ws/server.d.ts +2 -2
  36. package/dist/transport/impls/ws/server.js +3 -3
  37. package/dist/transport/index.cjs +61 -49
  38. package/dist/transport/index.cjs.map +1 -1
  39. package/dist/transport/index.d.cts +1 -1
  40. package/dist/transport/index.d.ts +1 -1
  41. package/dist/transport/index.js +2 -2
  42. package/dist/{transport-cf856c41.d.ts → transport-47af1c81.d.ts} +4 -5
  43. package/dist/util/testHelpers.cjs +8 -23
  44. package/dist/util/testHelpers.cjs.map +1 -1
  45. package/dist/util/testHelpers.d.cts +2 -2
  46. package/dist/util/testHelpers.d.ts +2 -2
  47. package/dist/util/testHelpers.js +3 -3
  48. package/package.json +1 -1
  49. package/dist/chunk-B323CECK.js.map +0 -1
  50. package/dist/chunk-KBAZ5TWE.js.map +0 -1
  51. /package/dist/{chunk-UXQMGZKP.js.map → chunk-H6KTH6W6.js.map} +0 -0
  52. /package/dist/{chunk-Z4G27Y2I.js.map → chunk-HDBVL7EF.js.map} +0 -0
@@ -199,7 +199,7 @@ var import_nanoid2 = require("nanoid");
199
199
  var import_api = require("@opentelemetry/api");
200
200
 
201
201
  // package.json
202
- var version = "0.23.10";
202
+ var version = "0.23.12";
203
203
 
204
204
  // tracing/index.ts
205
205
  function createSessionTelemetryInfo(session, propagationCtx) {
@@ -449,10 +449,12 @@ var Session = class {
449
449
  this.connection.close();
450
450
  this.connection = void 0;
451
451
  }
452
- replaceWithNewConnection(newConn) {
452
+ replaceWithNewConnection(newConn, isTransparentReconnect) {
453
453
  this.closeStaleConnection(newConn);
454
454
  this.cancelGrace();
455
- this.sendBufferedMessages(newConn);
455
+ if (isTransparentReconnect) {
456
+ this.sendBufferedMessages(newConn);
457
+ }
456
458
  this.connection = newConn;
457
459
  this.handshakingConnection = void 0;
458
460
  }
@@ -464,19 +466,8 @@ var Session = class {
464
466
  `starting ${this.options.sessionDisconnectGraceMs}ms grace period until session to ${this.to} is closed`,
465
467
  this.loggingMetadata
466
468
  );
467
- this.cancelGrace({ keepHeartbeatMisses: true });
469
+ this.cancelGrace();
468
470
  this.disconnectionGrace = setTimeout(() => {
469
- if (this.connection !== void 0) {
470
- this.log?.warn(
471
- `grace period for ${this.to} elapsed while connected. not calling callback`,
472
- {
473
- ...this.loggingMetadata,
474
- connId: this.connection.id,
475
- tags: ["invariant-violation"]
476
- }
477
- );
478
- return;
479
- }
480
471
  this.log?.info(
481
472
  `grace period for ${this.to} elapsed`,
482
473
  this.loggingMetadata
@@ -485,14 +476,8 @@ var Session = class {
485
476
  }, this.options.sessionDisconnectGraceMs);
486
477
  }
487
478
  // called on reconnect of the underlying session
488
- cancelGrace({ keepHeartbeatMisses } = {
489
- keepHeartbeatMisses: false
490
- }) {
491
- if (!keepHeartbeatMisses) {
492
- this.heartbeatMisses = 0;
493
- }
494
- if (this.disconnectionGrace === void 0)
495
- return;
479
+ cancelGrace() {
480
+ this.heartbeatMisses = 0;
496
481
  clearTimeout(this.disconnectionGrace);
497
482
  this.disconnectionGrace = void 0;
498
483
  }
@@ -682,21 +667,17 @@ var Transport = class {
682
667
  * and we know the identity of the connected client.
683
668
  * @param conn The connection object.
684
669
  */
685
- onConnect(conn, connectedTo, session, isReconnect) {
670
+ onConnect(conn, session, isTransparentReconnect) {
686
671
  this.eventDispatcher.dispatchEvent("connectionStatus", {
687
672
  status: "connect",
688
673
  conn
689
674
  });
690
675
  conn.telemetry = createConnectionTelemetryInfo(conn, session.telemetry);
691
- if (isReconnect) {
692
- session.replaceWithNewConnection(conn);
693
- this.log?.info(`reconnected to ${connectedTo}`, {
694
- ...conn.loggingMetadata,
695
- ...session.loggingMetadata,
696
- clientId: this.clientId,
697
- connectedTo
698
- });
699
- }
676
+ session.replaceWithNewConnection(conn, isTransparentReconnect);
677
+ this.log?.info(`connected to ${session.to}`, {
678
+ ...conn.loggingMetadata,
679
+ ...session.loggingMetadata
680
+ });
700
681
  }
701
682
  createSession(to, conn, propagationCtx) {
702
683
  const session = new Session(
@@ -724,7 +705,8 @@ var Transport = class {
724
705
  propagationCtx
725
706
  }) {
726
707
  let session = this.sessions.get(to);
727
- let isReconnect = session !== void 0;
708
+ const isReconnect = session !== void 0;
709
+ let isTransparentReconnect = isReconnect;
728
710
  if (session?.advertisedSessionId !== void 0 && sessionId !== void 0 && session.advertisedSessionId !== sessionId) {
729
711
  this.log?.info(
730
712
  `session for ${to} already exists but has a different session id (expected: ${session.advertisedSessionId}, got: ${sessionId}), creating a new one`,
@@ -735,7 +717,7 @@ var Transport = class {
735
717
  closeHandshakingConnection: handshakingConn !== void 0,
736
718
  handshakingConn
737
719
  });
738
- isReconnect = false;
720
+ isTransparentReconnect = false;
739
721
  session = void 0;
740
722
  }
741
723
  if (!session) {
@@ -751,7 +733,7 @@ var Transport = class {
751
733
  if (handshakingConn !== void 0) {
752
734
  session.replaceWithNewHandshakingConnection(handshakingConn);
753
735
  }
754
- return { session, isReconnect };
736
+ return { session, isReconnect, isTransparentReconnect };
755
737
  }
756
738
  deleteSession({
757
739
  session,
@@ -1182,7 +1164,7 @@ var ServerTransport = class extends Transport {
1182
1164
  if (parsedMetadata === false) {
1183
1165
  return false;
1184
1166
  }
1185
- const { session, isReconnect } = this.getOrCreateSession({
1167
+ const { session, isTransparentReconnect } = this.getOrCreateSession({
1186
1168
  to: parsed.from,
1187
1169
  conn,
1188
1170
  sessionId: parsed.payload.sessionId,
@@ -1198,7 +1180,7 @@ var ServerTransport = class extends Transport {
1198
1180
  sessionId: session.id
1199
1181
  });
1200
1182
  conn.send(this.codec.toBuffer(responseMsg));
1201
- this.onConnect(conn, parsed.from, session, isReconnect);
1183
+ this.onConnect(conn, session, isTransparentReconnect);
1202
1184
  return session;
1203
1185
  }
1204
1186
  };