@replit/river 0.13.1 → 0.13.2

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Connection
3
- } from "./chunk-LDUFHGZU.js";
3
+ } from "./chunk-NLWRMDT6.js";
4
4
 
5
5
  // transport/transforms/messageFraming.ts
6
6
  import { Transform } from "node:stream";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Connection
3
- } from "./chunk-LDUFHGZU.js";
3
+ } from "./chunk-NLWRMDT6.js";
4
4
 
5
5
  // transport/impls/ws/connection.ts
6
6
  var WebSocketConnection = class extends Connection {
@@ -3,7 +3,7 @@ import {
3
3
  coerceErrorString,
4
4
  isStreamClose,
5
5
  isStreamOpen
6
- } from "./chunk-SCG5S2EC.js";
6
+ } from "./chunk-GFRAOY75.js";
7
7
  import {
8
8
  log
9
9
  } from "./chunk-H4BYJELI.js";
@@ -106,7 +106,7 @@ function isStreamClose(controlFlag) {
106
106
  // util/stringify.ts
107
107
  function coerceErrorString(err) {
108
108
  if (err instanceof Error) {
109
- return err.message;
109
+ return err.message || "unknown reason";
110
110
  }
111
111
  return `[coerced to error] ${String(err)}`;
112
112
  }
@@ -7,7 +7,7 @@ import {
7
7
  handshakeRequestMessage,
8
8
  handshakeResponseMessage,
9
9
  isAck
10
- } from "./chunk-SCG5S2EC.js";
10
+ } from "./chunk-GFRAOY75.js";
11
11
  import {
12
12
  log
13
13
  } from "./chunk-H4BYJELI.js";
@@ -625,6 +625,9 @@ var ClientTransport = class extends Transport {
625
625
  } catch (error) {
626
626
  const errStr = coerceErrorString(error);
627
627
  this.inflightConnectionPromises.delete(to);
628
+ const shouldRetry = this.state === "open" && this.tryReconnecting;
629
+ if (!shouldRetry)
630
+ return;
628
631
  if (attempt >= this.options.retryAttemptsMax) {
629
632
  const errMsg = `connection to ${to} failed after ${attempt} attempts (${errStr}), giving up`;
630
633
  log?.error(`${this.clientId} -- ${errMsg}`);
@@ -793,7 +793,7 @@ var import_value = require("@sinclair/typebox/value");
793
793
  // util/stringify.ts
794
794
  function coerceErrorString(err) {
795
795
  if (err instanceof Error) {
796
- return err.message;
796
+ return err.message || "unknown reason";
797
797
  }
798
798
  return `[coerced to error] ${String(err)}`;
799
799
  }
@@ -8,8 +8,8 @@ import {
8
8
  createClient,
9
9
  createServer,
10
10
  serializeService
11
- } from "../chunk-JXKTY3GQ.js";
12
- import "../chunk-SCG5S2EC.js";
11
+ } from "../chunk-67M47YPQ.js";
12
+ import "../chunk-GFRAOY75.js";
13
13
  import "../chunk-H4BYJELI.js";
14
14
  export {
15
15
  Err,
@@ -492,7 +492,7 @@ var import_nanoid3 = require("nanoid");
492
492
  // util/stringify.ts
493
493
  function coerceErrorString(err) {
494
494
  if (err instanceof Error) {
495
- return err.message;
495
+ return err.message || "unknown reason";
496
496
  }
497
497
  return `[coerced to error] ${String(err)}`;
498
498
  }
@@ -866,6 +866,9 @@ var ClientTransport = class extends Transport {
866
866
  } catch (error) {
867
867
  const errStr = coerceErrorString(error);
868
868
  this.inflightConnectionPromises.delete(to);
869
+ const shouldRetry = this.state === "open" && this.tryReconnecting;
870
+ if (!shouldRetry)
871
+ return;
869
872
  if (attempt >= this.options.retryAttemptsMax) {
870
873
  const errMsg = `connection to ${to} failed after ${attempt} attempts (${errStr}), giving up`;
871
874
  log?.error(`${this.clientId} -- ${errMsg}`);
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  UdsConnection
3
- } from "../../../chunk-JXO2SCQB.js";
3
+ } from "../../../chunk-23MWJLVJ.js";
4
4
  import {
5
5
  ClientTransport
6
- } from "../../../chunk-LDUFHGZU.js";
7
- import "../../../chunk-SCG5S2EC.js";
6
+ } from "../../../chunk-NLWRMDT6.js";
7
+ import "../../../chunk-GFRAOY75.js";
8
8
  import {
9
9
  log
10
10
  } from "../../../chunk-H4BYJELI.js";
@@ -406,7 +406,7 @@ var import_nanoid3 = require("nanoid");
406
406
  // util/stringify.ts
407
407
  function coerceErrorString(err) {
408
408
  if (err instanceof Error) {
409
- return err.message;
409
+ return err.message || "unknown reason";
410
410
  }
411
411
  return `[coerced to error] ${String(err)}`;
412
412
  }
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  UdsConnection
3
- } from "../../../chunk-JXO2SCQB.js";
3
+ } from "../../../chunk-23MWJLVJ.js";
4
4
  import {
5
5
  ServerTransport
6
- } from "../../../chunk-LDUFHGZU.js";
7
- import "../../../chunk-SCG5S2EC.js";
6
+ } from "../../../chunk-NLWRMDT6.js";
7
+ import "../../../chunk-GFRAOY75.js";
8
8
  import {
9
9
  log
10
10
  } from "../../../chunk-H4BYJELI.js";
@@ -398,7 +398,7 @@ var import_nanoid3 = require("nanoid");
398
398
  // util/stringify.ts
399
399
  function coerceErrorString(err) {
400
400
  if (err instanceof Error) {
401
- return err.message;
401
+ return err.message || "unknown reason";
402
402
  }
403
403
  return `[coerced to error] ${String(err)}`;
404
404
  }
@@ -772,6 +772,9 @@ var ClientTransport = class extends Transport {
772
772
  } catch (error) {
773
773
  const errStr = coerceErrorString(error);
774
774
  this.inflightConnectionPromises.delete(to);
775
+ const shouldRetry = this.state === "open" && this.tryReconnecting;
776
+ if (!shouldRetry)
777
+ return;
775
778
  if (attempt >= this.options.retryAttemptsMax) {
776
779
  const errMsg = `connection to ${to} failed after ${attempt} attempts (${errStr}), giving up`;
777
780
  log?.error(`${this.clientId} -- ${errMsg}`);
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  WebSocketConnection
3
- } from "../../../chunk-Q7AWJYDQ.js";
3
+ } from "../../../chunk-3Y2K543F.js";
4
4
  import {
5
5
  ClientTransport
6
- } from "../../../chunk-LDUFHGZU.js";
7
- import "../../../chunk-SCG5S2EC.js";
6
+ } from "../../../chunk-NLWRMDT6.js";
7
+ import "../../../chunk-GFRAOY75.js";
8
8
  import {
9
9
  log
10
10
  } from "../../../chunk-H4BYJELI.js";
@@ -406,7 +406,7 @@ var import_nanoid3 = require("nanoid");
406
406
  // util/stringify.ts
407
407
  function coerceErrorString(err) {
408
408
  if (err instanceof Error) {
409
- return err.message;
409
+ return err.message || "unknown reason";
410
410
  }
411
411
  return `[coerced to error] ${String(err)}`;
412
412
  }
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  WebSocketConnection
3
- } from "../../../chunk-Q7AWJYDQ.js";
3
+ } from "../../../chunk-3Y2K543F.js";
4
4
  import {
5
5
  ServerTransport
6
- } from "../../../chunk-LDUFHGZU.js";
7
- import "../../../chunk-SCG5S2EC.js";
6
+ } from "../../../chunk-NLWRMDT6.js";
7
+ import "../../../chunk-GFRAOY75.js";
8
8
  import {
9
9
  log
10
10
  } from "../../../chunk-H4BYJELI.js";
@@ -428,7 +428,7 @@ var import_nanoid3 = require("nanoid");
428
428
  // util/stringify.ts
429
429
  function coerceErrorString(err) {
430
430
  if (err instanceof Error) {
431
- return err.message;
431
+ return err.message || "unknown reason";
432
432
  }
433
433
  return `[coerced to error] ${String(err)}`;
434
434
  }
@@ -802,6 +802,9 @@ var ClientTransport = class extends Transport {
802
802
  } catch (error) {
803
803
  const errStr = coerceErrorString(error);
804
804
  this.inflightConnectionPromises.delete(to);
805
+ const shouldRetry = this.state === "open" && this.tryReconnecting;
806
+ if (!shouldRetry)
807
+ return;
805
808
  if (attempt >= this.options.retryAttemptsMax) {
806
809
  const errMsg = `connection to ${to} failed after ${attempt} attempts (${errStr}), giving up`;
807
810
  log?.error(`${this.clientId} -- ${errMsg}`);
@@ -5,11 +5,11 @@ import {
5
5
  ServerTransport,
6
6
  Session,
7
7
  Transport
8
- } from "../chunk-LDUFHGZU.js";
8
+ } from "../chunk-NLWRMDT6.js";
9
9
  import {
10
10
  OpaqueTransportMessageSchema,
11
11
  TransportMessageSchema
12
- } from "../chunk-SCG5S2EC.js";
12
+ } from "../chunk-GFRAOY75.js";
13
13
  import "../chunk-H4BYJELI.js";
14
14
  import "../chunk-GZ7HCLLM.js";
15
15
  export {
@@ -313,7 +313,7 @@ var Session = class {
313
313
  // util/stringify.ts
314
314
  function coerceErrorString(err) {
315
315
  if (err instanceof Error) {
316
- return err.message;
316
+ return err.message || "unknown reason";
317
317
  }
318
318
  return `[coerced to error] ${String(err)}`;
319
319
  }
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  UNCAUGHT_ERROR,
3
3
  pushable
4
- } from "../chunk-JXKTY3GQ.js";
4
+ } from "../chunk-67M47YPQ.js";
5
5
  import "../chunk-5IZ2UHWV.js";
6
6
  import {
7
7
  Session,
8
8
  defaultSessionOptions
9
- } from "../chunk-LDUFHGZU.js";
9
+ } from "../chunk-NLWRMDT6.js";
10
10
  import {
11
11
  coerceErrorString
12
- } from "../chunk-SCG5S2EC.js";
12
+ } from "../chunk-GFRAOY75.js";
13
13
  import "../chunk-H4BYJELI.js";
14
14
  import "../chunk-GZ7HCLLM.js";
15
15
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@replit/river",
3
3
  "description": "It's like tRPC but... with JSON Schema Support, duplex streaming and support for service multiplexing. Transport agnostic!",
4
- "version": "0.13.1",
4
+ "version": "0.13.2",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {