@replit/river 0.209.3 → 0.209.5

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 (47) hide show
  1. package/dist/{chunk-EHTVQM2C.js → chunk-JY4555JT.js} +2 -2
  2. package/dist/chunk-JY4555JT.js.map +1 -0
  3. package/dist/{chunk-I24PIZXW.js → chunk-Y6YEPMH6.js} +72 -7
  4. package/dist/chunk-Y6YEPMH6.js.map +1 -0
  5. package/dist/{client-aETS93z1.d.cts → client-DXJRow2s.d.cts} +1 -1
  6. package/dist/{client-BzJwq-hg.d.ts → client-Dw0JBBs3.d.ts} +1 -1
  7. package/dist/codec/index.js +2 -2
  8. package/dist/{connection-b1wd5XrC.d.ts → connection-C2lYgRh0.d.ts} +7 -2
  9. package/dist/{connection-hUWlS-hg.d.cts → connection-Dzkqj18h.d.cts} +7 -2
  10. package/dist/router/index.cjs +1 -1
  11. package/dist/router/index.cjs.map +1 -1
  12. package/dist/router/index.d.cts +7 -7
  13. package/dist/router/index.d.ts +7 -7
  14. package/dist/router/index.js +1 -1
  15. package/dist/{server-BBgDVOzk.d.cts → server-BDSYa-CO.d.cts} +1 -1
  16. package/dist/{server-DZ0Yzmpf.d.ts → server-DFOzjvLh.d.ts} +1 -1
  17. package/dist/{services-C53K219K.d.cts → services-BXjRTxa7.d.cts} +5 -5
  18. package/dist/{services-DYik59tk.d.ts → services-BsHCCIEq.d.ts} +5 -5
  19. package/dist/testUtil/index.cjs +15 -6
  20. package/dist/testUtil/index.cjs.map +1 -1
  21. package/dist/testUtil/index.d.cts +5 -5
  22. package/dist/testUtil/index.d.ts +5 -5
  23. package/dist/testUtil/index.js +2 -2
  24. package/dist/transport/impls/ws/client.cjs +69 -53
  25. package/dist/transport/impls/ws/client.cjs.map +1 -1
  26. package/dist/transport/impls/ws/client.d.cts +3 -3
  27. package/dist/transport/impls/ws/client.d.ts +3 -3
  28. package/dist/transport/impls/ws/client.js +3 -5
  29. package/dist/transport/impls/ws/client.js.map +1 -1
  30. package/dist/transport/impls/ws/server.cjs +13 -5
  31. package/dist/transport/impls/ws/server.cjs.map +1 -1
  32. package/dist/transport/impls/ws/server.d.cts +3 -3
  33. package/dist/transport/impls/ws/server.d.ts +3 -3
  34. package/dist/transport/impls/ws/server.js +3 -5
  35. package/dist/transport/impls/ws/server.js.map +1 -1
  36. package/dist/transport/index.cjs +75 -8
  37. package/dist/transport/index.cjs.map +1 -1
  38. package/dist/transport/index.d.cts +5 -3
  39. package/dist/transport/index.d.ts +5 -3
  40. package/dist/transport/index.js +8 -4
  41. package/dist/{transport-CxjUaGhi.d.cts → transport-CxT7y8Qk.d.cts} +5 -0
  42. package/dist/{transport-DwEB67zY.d.ts → transport-pdbkDzmJ.d.ts} +5 -0
  43. package/package.json +1 -9
  44. package/dist/chunk-EHTVQM2C.js.map +0 -1
  45. package/dist/chunk-I24PIZXW.js.map +0 -1
  46. package/dist/chunk-JRBDMLR3.js +0 -55
  47. package/dist/chunk-JRBDMLR3.js.map +0 -1
@@ -1,12 +1,12 @@
1
- import { b as ProvidedClientTransportOptions, c as ProvidedServerTransportOptions, n as ClientHandshakeOptions, C as Connection, q as ServerHandshakeOptions, T as Transport, x as SessionOptions, m as ClientTransportOptions, e as SessionNoConnection, y as SessionBoundSendFn } from '../transport-CxjUaGhi.cjs';
2
- import { C as ClientTransport } from '../client-aETS93z1.cjs';
3
- import { S as ServerTransport } from '../server-BBgDVOzk.cjs';
1
+ import { b as ProvidedClientTransportOptions, c as ProvidedServerTransportOptions, n as ClientHandshakeOptions, C as Connection, q as ServerHandshakeOptions, T as Transport, x as SessionOptions, m as ClientTransportOptions, e as SessionNoConnection, y as SessionBoundSendFn } from '../transport-CxT7y8Qk.cjs';
2
+ import { C as ClientTransport } from '../client-DXJRow2s.cjs';
3
+ import { S as ServerTransport } from '../server-BDSYa-CO.cjs';
4
4
  import { c as TransportClientId, e as PartialTransportMessage, b as OpaqueTransportMessage } from '../message-Dlsh5WDF.cjs';
5
5
  import { TSchema, Static } from '@sinclair/typebox';
6
- import { J as BaseErrorSchemaType, v as Readable, _ as ReadableIterator, w as ReadableResult } from '../services-C53K219K.cjs';
6
+ import { J as BaseErrorSchemaType, v as Readable, _ as ReadableIterator, w as ReadableResult } from '../services-BXjRTxa7.cjs';
7
+ import { W as WsLike } from '../wslike-Dng9H1C7.cjs';
7
8
  import NodeWs from 'ws';
8
9
  import http from 'node:http';
9
- import { W as WsLike } from '../wslike-Dng9H1C7.cjs';
10
10
  import { Duplex } from 'node:stream';
11
11
  import '../index-D9R6UTMl.cjs';
12
12
  import '../adapter-DjiEwOYi.cjs';
@@ -1,12 +1,12 @@
1
- import { b as ProvidedClientTransportOptions, c as ProvidedServerTransportOptions, n as ClientHandshakeOptions, C as Connection, q as ServerHandshakeOptions, T as Transport, x as SessionOptions, m as ClientTransportOptions, e as SessionNoConnection, y as SessionBoundSendFn } from '../transport-DwEB67zY.js';
2
- import { C as ClientTransport } from '../client-BzJwq-hg.js';
3
- import { S as ServerTransport } from '../server-DZ0Yzmpf.js';
1
+ import { b as ProvidedClientTransportOptions, c as ProvidedServerTransportOptions, n as ClientHandshakeOptions, C as Connection, q as ServerHandshakeOptions, T as Transport, x as SessionOptions, m as ClientTransportOptions, e as SessionNoConnection, y as SessionBoundSendFn } from '../transport-pdbkDzmJ.js';
2
+ import { C as ClientTransport } from '../client-Dw0JBBs3.js';
3
+ import { S as ServerTransport } from '../server-DFOzjvLh.js';
4
4
  import { c as TransportClientId, e as PartialTransportMessage, b as OpaqueTransportMessage } from '../message-Dlsh5WDF.js';
5
5
  import { TSchema, Static } from '@sinclair/typebox';
6
- import { J as BaseErrorSchemaType, v as Readable, _ as ReadableIterator, w as ReadableResult } from '../services-DYik59tk.js';
6
+ import { J as BaseErrorSchemaType, v as Readable, _ as ReadableIterator, w as ReadableResult } from '../services-BsHCCIEq.js';
7
+ import { W as WsLike } from '../wslike-Dng9H1C7.js';
7
8
  import NodeWs from 'ws';
8
9
  import http from 'node:http';
9
- import { W as WsLike } from '../wslike-Dng9H1C7.js';
10
10
  import { Duplex } from 'node:stream';
11
11
  import '../index-CSM8soK7.js';
12
12
  import '../adapter-Cp7_gIVA.js';
@@ -5,12 +5,12 @@ import {
5
5
  SessionStateGraph,
6
6
  defaultClientTransportOptions,
7
7
  defaultTransportOptions
8
- } from "../chunk-I24PIZXW.js";
8
+ } from "../chunk-Y6YEPMH6.js";
9
9
  import "../chunk-CC7RN7GI.js";
10
10
  import {
11
11
  currentProtocolVersion,
12
12
  getTracer
13
- } from "../chunk-EHTVQM2C.js";
13
+ } from "../chunk-JY4555JT.js";
14
14
 
15
15
  // testUtil/index.ts
16
16
  import NodeWs, { WebSocketServer } from "ws";
@@ -218,7 +218,8 @@ var defaultConnectionRetryOptions = {
218
218
  maxJitterMs: 200,
219
219
  maxBackoffMs: 32e3,
220
220
  attemptBudgetCapacity: 5,
221
- budgetRestoreIntervalMs: 200
221
+ budgetRestoreIntervalMs: 200,
222
+ isFatalConnectionError: () => false
222
223
  };
223
224
  var defaultClientTransportOptions = {
224
225
  ...defaultTransportOptions,
@@ -673,7 +674,7 @@ function coerceErrorString(err) {
673
674
  }
674
675
 
675
676
  // package.json
676
- var version = "0.209.3";
677
+ var version = "0.209.5";
677
678
 
678
679
  // tracing/index.ts
679
680
  function getPropagationContext(ctx) {
@@ -1094,6 +1095,60 @@ var Connection = class {
1094
1095
  }
1095
1096
  };
1096
1097
 
1098
+ // transport/impls/ws/connection.ts
1099
+ var WS_HEALTHY_CLOSE_CODE = 1e3;
1100
+ var WebSocketCloseError = class extends Error {
1101
+ code;
1102
+ reason;
1103
+ constructor(code, reason) {
1104
+ super(`websocket closed with code and reason: ${code} - ${reason}`);
1105
+ this.code = code;
1106
+ this.reason = reason;
1107
+ }
1108
+ };
1109
+ var WebSocketConnection = class extends Connection {
1110
+ ws;
1111
+ extras;
1112
+ get loggingMetadata() {
1113
+ const metadata = super.loggingMetadata;
1114
+ if (this.extras) {
1115
+ metadata.extras = this.extras;
1116
+ }
1117
+ return metadata;
1118
+ }
1119
+ constructor(ws, extras) {
1120
+ super();
1121
+ this.ws = ws;
1122
+ this.extras = extras;
1123
+ this.ws.binaryType = "arraybuffer";
1124
+ let didError = false;
1125
+ this.ws.onerror = () => {
1126
+ didError = true;
1127
+ };
1128
+ this.ws.onclose = ({ code, reason }) => {
1129
+ if (didError) {
1130
+ const err = new WebSocketCloseError(code, reason);
1131
+ this.onError(err);
1132
+ }
1133
+ this.onClose();
1134
+ };
1135
+ this.ws.onmessage = (msg) => {
1136
+ this.onData(msg.data);
1137
+ };
1138
+ }
1139
+ send(payload) {
1140
+ try {
1141
+ this.ws.send(payload);
1142
+ return true;
1143
+ } catch {
1144
+ return false;
1145
+ }
1146
+ }
1147
+ close() {
1148
+ this.ws.close(WS_HEALTHY_CLOSE_CODE);
1149
+ }
1150
+ };
1151
+
1097
1152
  // codec/adapter.ts
1098
1153
  var CodecMessageAdapter = class {
1099
1154
  constructor(codec) {
@@ -1853,10 +1908,18 @@ var ClientTransport = class extends Transport {
1853
1908
  const connectedSession = ClientSessionStateGraph.transition.HandshakingToConnected(session, {
1854
1909
  onConnectionErrored: (err) => {
1855
1910
  const errStr = coerceErrorString(err);
1856
- this.log?.warn(
1857
- `connection to ${connectedSession.to} errored: ${errStr}`,
1858
- connectedSession.loggingMetadata
1859
- );
1911
+ if (err instanceof Error && this.options.isFatalConnectionError(err)) {
1912
+ this.log?.warn(
1913
+ `connection to ${connectedSession.to} fatally errored: ${errStr}`,
1914
+ connectedSession.loggingMetadata
1915
+ );
1916
+ this.reconnectOnConnectionDrop = false;
1917
+ } else {
1918
+ this.log?.warn(
1919
+ `connection to ${connectedSession.to} errored: ${errStr}`,
1920
+ connectedSession.loggingMetadata
1921
+ );
1922
+ }
1860
1923
  },
1861
1924
  onConnectionClosed: () => {
1862
1925
  this.log?.info(
@@ -2052,53 +2115,6 @@ var ClientTransport = class extends Transport {
2052
2115
  }
2053
2116
  };
2054
2117
 
2055
- // transport/impls/ws/connection.ts
2056
- var WS_HEALTHY_CLOSE_CODE = 1e3;
2057
- var WebSocketConnection = class extends Connection {
2058
- ws;
2059
- extras;
2060
- get loggingMetadata() {
2061
- const metadata = super.loggingMetadata;
2062
- if (this.extras) {
2063
- metadata.extras = this.extras;
2064
- }
2065
- return metadata;
2066
- }
2067
- constructor(ws, extras) {
2068
- super();
2069
- this.ws = ws;
2070
- this.extras = extras;
2071
- this.ws.binaryType = "arraybuffer";
2072
- let didError = false;
2073
- this.ws.onerror = () => {
2074
- didError = true;
2075
- };
2076
- this.ws.onclose = ({ code, reason }) => {
2077
- if (didError) {
2078
- const err = new Error(
2079
- `websocket closed with code and reason: ${code} - ${reason}`
2080
- );
2081
- this.onError(err);
2082
- }
2083
- this.onClose();
2084
- };
2085
- this.ws.onmessage = (msg) => {
2086
- this.onData(msg.data);
2087
- };
2088
- }
2089
- send(payload) {
2090
- try {
2091
- this.ws.send(payload);
2092
- return true;
2093
- } catch {
2094
- return false;
2095
- }
2096
- }
2097
- close() {
2098
- this.ws.close(WS_HEALTHY_CLOSE_CODE);
2099
- }
2100
- };
2101
-
2102
2118
  // transport/impls/ws/client.ts
2103
2119
  var WebSocketClientTransport = class extends ClientTransport {
2104
2120
  /**