@replit/river 0.26.0 → 0.26.1

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-BNNELZM4.js → chunk-4W5LENT2.js} +2 -2
  2. package/dist/{chunk-5FDAIAQ5.js → chunk-6UVTCZ6K.js} +5 -5
  3. package/dist/chunk-6UVTCZ6K.js.map +1 -0
  4. package/dist/{chunk-KP4UB5NW.js → chunk-AYIMQWS7.js} +2 -2
  5. package/dist/{chunk-7ETNUCOL.js → chunk-IVNX5H6C.js} +19 -8
  6. package/dist/chunk-IVNX5H6C.js.map +1 -0
  7. package/dist/{chunk-JSU2KACV.js → chunk-M43R4RPL.js} +10 -4
  8. package/dist/chunk-M43R4RPL.js.map +1 -0
  9. package/dist/{chunk-CCUYKR5C.js → chunk-UQOD22AN.js} +2 -2
  10. package/dist/{chunk-CCUYKR5C.js.map → chunk-UQOD22AN.js.map} +1 -1
  11. package/dist/{chunk-5S64PXTU.js → chunk-XRI2BXMM.js} +23 -9
  12. package/dist/chunk-XRI2BXMM.js.map +1 -0
  13. package/dist/{client-162c509c.d.ts → client-0f636b3a.d.ts} +2 -2
  14. package/dist/{connection-6a404bb8.d.ts → connection-07e97a79.d.ts} +1 -1
  15. package/dist/{handshake-3342bb94.d.ts → handshake-8752f79e.d.ts} +9 -5
  16. package/dist/logging/index.d.cts +1 -1
  17. package/dist/logging/index.d.ts +1 -1
  18. package/dist/{message-1a434848.d.ts → message-57296605.d.ts} +2 -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 +8 -8
  22. package/dist/router/index.d.ts +8 -8
  23. package/dist/router/index.js +2 -2
  24. package/dist/{server-1b695374.d.ts → server-e304daec.d.ts} +2 -2
  25. package/dist/{services-c17f7eff.d.ts → services-fc99aae1.d.ts} +3 -3
  26. package/dist/transport/impls/ws/client.cjs +30 -10
  27. package/dist/transport/impls/ws/client.cjs.map +1 -1
  28. package/dist/transport/impls/ws/client.d.cts +4 -4
  29. package/dist/transport/impls/ws/client.d.ts +4 -4
  30. package/dist/transport/impls/ws/client.js +5 -5
  31. package/dist/transport/impls/ws/server.cjs +26 -9
  32. package/dist/transport/impls/ws/server.cjs.map +1 -1
  33. package/dist/transport/impls/ws/server.d.cts +4 -4
  34. package/dist/transport/impls/ws/server.d.ts +4 -4
  35. package/dist/transport/impls/ws/server.js +5 -5
  36. package/dist/transport/index.cjs +45 -14
  37. package/dist/transport/index.cjs.map +1 -1
  38. package/dist/transport/index.d.cts +4 -4
  39. package/dist/transport/index.d.ts +4 -4
  40. package/dist/transport/index.js +5 -5
  41. package/dist/util/testHelpers.cjs +9 -3
  42. package/dist/util/testHelpers.cjs.map +1 -1
  43. package/dist/util/testHelpers.d.cts +4 -4
  44. package/dist/util/testHelpers.d.ts +4 -4
  45. package/dist/util/testHelpers.js +3 -3
  46. package/package.json +1 -1
  47. package/dist/chunk-5FDAIAQ5.js.map +0 -1
  48. package/dist/chunk-5S64PXTU.js.map +0 -1
  49. package/dist/chunk-7ETNUCOL.js.map +0 -1
  50. package/dist/chunk-JSU2KACV.js.map +0 -1
  51. /package/dist/{chunk-BNNELZM4.js.map → chunk-4W5LENT2.js.map} +0 -0
  52. /package/dist/{chunk-KP4UB5NW.js.map → chunk-AYIMQWS7.js.map} +0 -0
@@ -1,9 +1,9 @@
1
- import { c as TransportClientId } from '../../../message-1a434848.js';
1
+ import { c as TransportClientId } from '../../../message-57296605.js';
2
2
  import { WebSocketServer } from 'ws';
3
- import { W as WebSocketConnection } from '../../../connection-6a404bb8.js';
3
+ import { W as WebSocketConnection } from '../../../connection-07e97a79.js';
4
4
  import { W as WsLike } from '../../../wslike-e0b32dd5.js';
5
- import { S as ServerTransport } from '../../../server-1b695374.js';
6
- import { c as ProvidedServerTransportOptions } from '../../../handshake-3342bb94.js';
5
+ import { S as ServerTransport } from '../../../server-e304daec.js';
6
+ import { c as ProvidedServerTransportOptions } from '../../../handshake-8752f79e.js';
7
7
  import '@sinclair/typebox/value';
8
8
  import '@sinclair/typebox';
9
9
  import '@opentelemetry/api';
@@ -1,9 +1,9 @@
1
- import { c as TransportClientId } from '../../../message-1a434848.js';
1
+ import { c as TransportClientId } from '../../../message-57296605.js';
2
2
  import { WebSocketServer } from 'ws';
3
- import { W as WebSocketConnection } from '../../../connection-6a404bb8.js';
3
+ import { W as WebSocketConnection } from '../../../connection-07e97a79.js';
4
4
  import { W as WsLike } from '../../../wslike-e0b32dd5.js';
5
- import { S as ServerTransport } from '../../../server-1b695374.js';
6
- import { c as ProvidedServerTransportOptions } from '../../../handshake-3342bb94.js';
5
+ import { S as ServerTransport } from '../../../server-e304daec.js';
6
+ import { c as ProvidedServerTransportOptions } from '../../../handshake-8752f79e.js';
7
7
  import '@sinclair/typebox/value';
8
8
  import '@sinclair/typebox';
9
9
  import '@opentelemetry/api';
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  ServerTransport
3
- } from "../../../chunk-7ETNUCOL.js";
3
+ } from "../../../chunk-IVNX5H6C.js";
4
4
  import {
5
5
  WebSocketConnection
6
- } from "../../../chunk-KP4UB5NW.js";
7
- import "../../../chunk-5FDAIAQ5.js";
6
+ } from "../../../chunk-AYIMQWS7.js";
7
+ import "../../../chunk-6UVTCZ6K.js";
8
8
  import "../../../chunk-TAH2GVTJ.js";
9
- import "../../../chunk-JSU2KACV.js";
10
- import "../../../chunk-CCUYKR5C.js";
9
+ import "../../../chunk-M43R4RPL.js";
10
+ import "../../../chunk-UQOD22AN.js";
11
11
  import "../../../chunk-4PVU7J25.js";
12
12
 
13
13
  // transport/impls/ws/server.ts
@@ -573,7 +573,7 @@ var SessionNoConnection = class extends IdentifiedSession {
573
573
  var import_api = require("@opentelemetry/api");
574
574
 
575
575
  // package.json
576
- var version = "0.26.0";
576
+ var version = "0.26.1";
577
577
 
578
578
  // tracing/index.ts
579
579
  function getPropagationContext(ctx) {
@@ -624,7 +624,10 @@ var SessionWaitingForHandshake = class extends CommonSession {
624
624
  onHandshakeData = (msg) => {
625
625
  const parsedMsg = this.parseMsg(msg);
626
626
  if (parsedMsg === null) {
627
- this.listeners.onInvalidHandshake("could not parse message");
627
+ this.listeners.onInvalidHandshake(
628
+ "could not parse message",
629
+ "MALFORMED_HANDSHAKE"
630
+ );
628
631
  return;
629
632
  }
630
633
  this.listeners.onHandshake(parsedMsg);
@@ -670,7 +673,10 @@ var SessionHandshaking = class extends IdentifiedSession {
670
673
  onHandshakeData = (msg) => {
671
674
  const parsedMsg = this.parseMsg(msg);
672
675
  if (parsedMsg === null) {
673
- this.listeners.onInvalidHandshake("could not parse message");
676
+ this.listeners.onInvalidHandshake(
677
+ "could not parse message",
678
+ "MALFORMED_HANDSHAKE"
679
+ );
674
680
  return;
675
681
  }
676
682
  this.listeners.onHandshake(parsedMsg);
@@ -1160,8 +1166,8 @@ var Transport = class {
1160
1166
  removeEventListener(type, handler) {
1161
1167
  this.eventDispatcher.removeEventListener(type, handler);
1162
1168
  }
1163
- protocolError(type, message) {
1164
- this.eventDispatcher.dispatchEvent("protocolError", { type, message });
1169
+ protocolError(message) {
1170
+ this.eventDispatcher.dispatchEvent("protocolError", message);
1165
1171
  }
1166
1172
  /**
1167
1173
  * Default close implementation for transports. You should override this in the downstream
@@ -1425,13 +1431,17 @@ var ClientTransport = class extends Transport {
1425
1431
  onHandshake: (msg) => {
1426
1432
  this.onHandshakeResponse(handshakingSession, msg);
1427
1433
  },
1428
- onInvalidHandshake: (reason) => {
1434
+ onInvalidHandshake: (reason, code) => {
1429
1435
  this.log?.error(
1430
1436
  `invalid handshake: ${reason}`,
1431
1437
  handshakingSession.loggingMetadata
1432
1438
  );
1433
1439
  this.deleteSession(session);
1434
- this.protocolError(ProtocolError.HandshakeFailed, reason);
1440
+ this.protocolError({
1441
+ type: ProtocolError.HandshakeFailed,
1442
+ code,
1443
+ message: reason
1444
+ });
1435
1445
  },
1436
1446
  onHandshakeTimeout: () => {
1437
1447
  this.log?.error(
@@ -1480,7 +1490,11 @@ var ClientTransport = class extends Transport {
1480
1490
  this.tryReconnecting(session.to);
1481
1491
  } else {
1482
1492
  this.deleteSession(session);
1483
- this.protocolError(ProtocolError.HandshakeFailed, reason);
1493
+ this.protocolError({
1494
+ type: ProtocolError.HandshakeFailed,
1495
+ code: msg.payload.status.code,
1496
+ message: reason
1497
+ });
1484
1498
  }
1485
1499
  return;
1486
1500
  }
@@ -1514,7 +1528,10 @@ var ClientTransport = class extends Transport {
1514
1528
  onMessage: (msg2) => this.handleMsg(msg2),
1515
1529
  onInvalidMessage: (reason) => {
1516
1530
  this.deleteSession(connectedSession);
1517
- this.protocolError(ProtocolError.MessageOrderingViolated, reason);
1531
+ this.protocolError({
1532
+ type: ProtocolError.MessageOrderingViolated,
1533
+ message: reason
1534
+ });
1518
1535
  }
1519
1536
  });
1520
1537
  this.updateSession(connectedSession);
@@ -1545,7 +1562,10 @@ var ClientTransport = class extends Transport {
1545
1562
  const budgetConsumed = this.retryBudget.getBudgetConsumed();
1546
1563
  const errMsg = `tried to connect to ${to} but retry budget exceeded (more than ${budgetConsumed} attempts in the last ${this.retryBudget.totalBudgetRestoreTime}ms)`;
1547
1564
  this.log?.error(errMsg, session.loggingMetadata);
1548
- this.protocolError(ProtocolError.RetriesExceeded, errMsg);
1565
+ this.protocolError({
1566
+ type: ProtocolError.RetriesExceeded,
1567
+ message: errMsg
1568
+ });
1549
1569
  return;
1550
1570
  }
1551
1571
  const backoffMs = this.retryBudget.getBackoffMs();
@@ -1752,13 +1772,17 @@ var ServerTransport = class extends Transport {
1752
1772
  receivedHandshake = true;
1753
1773
  void this.onHandshakeRequest(pendingSession, msg);
1754
1774
  },
1755
- onInvalidHandshake: (reason) => {
1775
+ onInvalidHandshake: (reason, code) => {
1756
1776
  this.log?.error(
1757
1777
  `invalid handshake: ${reason}`,
1758
1778
  pendingSession.loggingMetadata
1759
1779
  );
1760
1780
  this.deletePendingSession(pendingSession);
1761
- this.protocolError(ProtocolError.HandshakeFailed, reason);
1781
+ this.protocolError({
1782
+ type: ProtocolError.HandshakeFailed,
1783
+ code,
1784
+ message: reason
1785
+ });
1762
1786
  }
1763
1787
  },
1764
1788
  this.options,
@@ -1783,7 +1807,11 @@ var ServerTransport = class extends Transport {
1783
1807
  }
1784
1808
  })
1785
1809
  );
1786
- this.protocolError(ProtocolError.HandshakeFailed, reason);
1810
+ this.protocolError({
1811
+ type: ProtocolError.HandshakeFailed,
1812
+ code,
1813
+ message: reason
1814
+ });
1787
1815
  this.deletePendingSession(session);
1788
1816
  }
1789
1817
  async onHandshakeRequest(session, msg) {
@@ -1945,7 +1973,10 @@ var ServerTransport = class extends Transport {
1945
1973
  },
1946
1974
  onMessage: (msg2) => this.handleMsg(msg2),
1947
1975
  onInvalidMessage: (reason) => {
1948
- this.protocolError(ProtocolError.MessageOrderingViolated, reason);
1976
+ this.protocolError({
1977
+ type: ProtocolError.MessageOrderingViolated,
1978
+ message: reason
1979
+ });
1949
1980
  this.deleteSession(connectedSession);
1950
1981
  }
1951
1982
  }