@replit/river 0.23.10 → 0.23.11

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-KBAZ5TWE.js → chunk-EOJMKMDO.js} +32 -40
  2. package/dist/chunk-EOJMKMDO.js.map +1 -0
  3. package/dist/{chunk-Z4G27Y2I.js → chunk-HM7VDTDJ.js} +2 -2
  4. package/dist/{chunk-FRICSBDW.js → chunk-MEHCOYKJ.js} +2 -2
  5. package/dist/{chunk-FRICSBDW.js.map → chunk-MEHCOYKJ.js.map} +1 -1
  6. package/dist/{chunk-UXQMGZKP.js → chunk-T6YEMFUF.js} +2 -2
  7. package/dist/{chunk-B323CECK.js → chunk-ZSKCZYVU.js} +9 -9
  8. package/dist/chunk-ZSKCZYVU.js.map +1 -0
  9. package/dist/{connection-700340c4.d.ts → connection-261eee8f.d.ts} +1 -1
  10. package/dist/{connection-efcd4e1a.d.ts → connection-c1eeb95d.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-524bab79.d.ts} +1 -1
  17. package/dist/transport/impls/uds/client.cjs +30 -38
  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 +10 -29
  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 +30 -38
  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 +10 -29
  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 +31 -39
  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-c8f36f6d.d.ts} +2 -4
  43. package/dist/util/testHelpers.cjs +4 -21
  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-Z4G27Y2I.js.map → chunk-HM7VDTDJ.js.map} +0 -0
  52. /package/dist/{chunk-UXQMGZKP.js.map → chunk-T6YEMFUF.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import { Server, Socket } from 'node:net';
2
- import { d as ServerTransport, e as ProvidedServerTransportOptions } from '../../../transport-cf856c41.js';
2
+ import { d as ServerTransport, e as ProvidedServerTransportOptions } from '../../../transport-c8f36f6d.js';
3
3
  import { T as TransportClientId } from '../../../index-60f03cb7.js';
4
- import { U as UdsConnection } from '../../../connection-efcd4e1a.js';
4
+ import { U as UdsConnection } from '../../../connection-c1eeb95d.js';
5
5
  import '../../../types-3e5768ec.js';
6
6
  import '@sinclair/typebox';
7
7
  import '@sinclair/typebox/value';
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  UdsConnection
3
- } from "../../../chunk-UXQMGZKP.js";
3
+ } from "../../../chunk-T6YEMFUF.js";
4
4
  import {
5
5
  ServerTransport
6
- } from "../../../chunk-KBAZ5TWE.js";
7
- import "../../../chunk-FRICSBDW.js";
6
+ } from "../../../chunk-EOJMKMDO.js";
7
+ import "../../../chunk-MEHCOYKJ.js";
8
8
  import "../../../chunk-6LCL2ZZF.js";
9
9
  import "../../../chunk-3AW3IXVD.js";
10
10
 
@@ -202,7 +202,7 @@ var import_nanoid2 = require("nanoid");
202
202
  var import_api = require("@opentelemetry/api");
203
203
 
204
204
  // package.json
205
- var version = "0.23.10";
205
+ var version = "0.23.11";
206
206
 
207
207
  // tracing/index.ts
208
208
  function getPropagationContext(ctx) {
@@ -476,19 +476,8 @@ var Session = class {
476
476
  `starting ${this.options.sessionDisconnectGraceMs}ms grace period until session to ${this.to} is closed`,
477
477
  this.loggingMetadata
478
478
  );
479
- this.cancelGrace({ keepHeartbeatMisses: true });
479
+ this.cancelGrace();
480
480
  this.disconnectionGrace = setTimeout(() => {
481
- if (this.connection !== void 0) {
482
- this.log?.warn(
483
- `grace period for ${this.to} elapsed while connected. not calling callback`,
484
- {
485
- ...this.loggingMetadata,
486
- connId: this.connection.id,
487
- tags: ["invariant-violation"]
488
- }
489
- );
490
- return;
491
- }
492
481
  this.log?.info(
493
482
  `grace period for ${this.to} elapsed`,
494
483
  this.loggingMetadata
@@ -497,14 +486,8 @@ var Session = class {
497
486
  }, this.options.sessionDisconnectGraceMs);
498
487
  }
499
488
  // called on reconnect of the underlying session
500
- cancelGrace({ keepHeartbeatMisses } = {
501
- keepHeartbeatMisses: false
502
- }) {
503
- if (!keepHeartbeatMisses) {
504
- this.heartbeatMisses = 0;
505
- }
506
- if (this.disconnectionGrace === void 0)
507
- return;
489
+ cancelGrace() {
490
+ this.heartbeatMisses = 0;
508
491
  clearTimeout(this.disconnectionGrace);
509
492
  this.disconnectionGrace = void 0;
510
493
  }
@@ -765,7 +748,7 @@ var Transport = class {
765
748
  * and we know the identity of the connected client.
766
749
  * @param conn The connection object.
767
750
  */
768
- onConnect(conn, connectedTo, session, isReconnect) {
751
+ onConnect(conn, session, isReconnect) {
769
752
  this.eventDispatcher.dispatchEvent("connectionStatus", {
770
753
  status: "connect",
771
754
  conn
@@ -773,13 +756,11 @@ var Transport = class {
773
756
  conn.telemetry = createConnectionTelemetryInfo(conn, session.telemetry);
774
757
  if (isReconnect) {
775
758
  session.replaceWithNewConnection(conn);
776
- this.log?.info(`reconnected to ${connectedTo}`, {
777
- ...conn.loggingMetadata,
778
- ...session.loggingMetadata,
779
- clientId: this.clientId,
780
- connectedTo
781
- });
782
759
  }
760
+ this.log?.info(`connected to ${session.to}`, {
761
+ ...conn.loggingMetadata,
762
+ ...session.loggingMetadata
763
+ });
783
764
  }
784
765
  createSession(to, conn, propagationCtx) {
785
766
  const session = new Session(
@@ -1110,12 +1091,16 @@ var ClientTransport = class extends Transport {
1110
1091
  if (session) {
1111
1092
  this.onDisconnect(conn, session);
1112
1093
  }
1113
- this.log?.info(`connection to ${to} disconnected`, {
1114
- ...conn.loggingMetadata,
1115
- ...session?.loggingMetadata,
1116
- clientId: this.clientId,
1117
- connectedTo: to
1118
- });
1094
+ const willReconnect = this.reconnectOnConnectionDrop && this.getStatus() === "open";
1095
+ this.log?.info(
1096
+ `connection to ${to} disconnected` + (willReconnect ? ", reconnecting" : ""),
1097
+ {
1098
+ ...conn.loggingMetadata,
1099
+ ...session?.loggingMetadata,
1100
+ clientId: this.clientId,
1101
+ connectedTo: to
1102
+ }
1103
+ );
1119
1104
  this.inflightConnectionPromises.delete(to);
1120
1105
  if (this.reconnectOnConnectionDrop) {
1121
1106
  void this.connect(to);
@@ -1201,8 +1186,8 @@ var ClientTransport = class extends Transport {
1201
1186
  conn,
1202
1187
  sessionId: parsed.payload.status.sessionId
1203
1188
  });
1204
- this.onConnect(conn, parsed.from, session, isReconnect);
1205
- this.retryBudget.startRestoringBudget(parsed.from);
1189
+ this.onConnect(conn, session, isReconnect);
1190
+ this.retryBudget.startRestoringBudget(session.to);
1206
1191
  return session;
1207
1192
  }
1208
1193
  /**
@@ -1210,6 +1195,13 @@ var ClientTransport = class extends Transport {
1210
1195
  * @param to The client ID of the node to connect to.
1211
1196
  */
1212
1197
  async connect(to) {
1198
+ if (this.connections.has(to)) {
1199
+ this.log?.info(`already connected to ${to}, skipping connect attempt`, {
1200
+ clientId: this.clientId,
1201
+ connectedTo: to
1202
+ });
1203
+ return;
1204
+ }
1213
1205
  const canProceedWithConnection = () => this.getStatus() === "open";
1214
1206
  if (!canProceedWithConnection()) {
1215
1207
  this.log?.info(
@@ -1220,8 +1212,8 @@ var ClientTransport = class extends Transport {
1220
1212
  }
1221
1213
  let reconnectPromise = this.inflightConnectionPromises.get(to);
1222
1214
  if (!reconnectPromise) {
1223
- const budgetConsumed = this.retryBudget.getBudgetConsumed(to);
1224
1215
  if (!this.retryBudget.hasBudget(to)) {
1216
+ const budgetConsumed = this.retryBudget.getBudgetConsumed(to);
1225
1217
  const errMsg = `tried to connect to ${to} but retry budget exceeded (more than ${budgetConsumed} attempts in the last ${this.retryBudget.totalBudgetRestoreTime}ms)`;
1226
1218
  this.log?.error(errMsg, { clientId: this.clientId, connectedTo: to });
1227
1219
  this.protocolError(ProtocolError.RetriesExceeded, errMsg);
@@ -1302,7 +1294,7 @@ var ClientTransport = class extends Transport {
1302
1294
  clientId: this.clientId,
1303
1295
  connectedTo: to
1304
1296
  });
1305
- return this.connect(to);
1297
+ await this.connect(to);
1306
1298
  }
1307
1299
  }
1308
1300
  }