@replit/river 0.15.0 → 0.15.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 (33) hide show
  1. package/dist/{builder-ca6c4259.d.ts → builder-660d3140.d.ts} +1 -1
  2. package/dist/{chunk-FFT7PSUV.js → chunk-5TX4BKAD.js} +1 -1
  3. package/dist/{chunk-BSAIT634.js → chunk-MNWOTQWX.js} +1 -1
  4. package/dist/{chunk-IVNV5HBI.js → chunk-O6YQ3JAH.js} +14 -15
  5. package/dist/{connection-0c5eeb14.d.ts → connection-162c0f7b.d.ts} +1 -1
  6. package/dist/{connection-14675d77.d.ts → connection-93daccc3.d.ts} +1 -1
  7. package/dist/{index-f922ec84.d.ts → index-76b801f8.d.ts} +7 -6
  8. package/dist/router/index.d.cts +3 -3
  9. package/dist/router/index.d.ts +3 -3
  10. package/dist/transport/impls/uds/client.cjs +10 -5
  11. package/dist/transport/impls/uds/client.d.cts +2 -2
  12. package/dist/transport/impls/uds/client.d.ts +2 -2
  13. package/dist/transport/impls/uds/client.js +2 -2
  14. package/dist/transport/impls/uds/server.cjs +9 -4
  15. package/dist/transport/impls/uds/server.d.cts +2 -2
  16. package/dist/transport/impls/uds/server.d.ts +2 -2
  17. package/dist/transport/impls/uds/server.js +2 -2
  18. package/dist/transport/impls/ws/client.cjs +10 -5
  19. package/dist/transport/impls/ws/client.d.cts +2 -2
  20. package/dist/transport/impls/ws/client.d.ts +2 -2
  21. package/dist/transport/impls/ws/client.js +2 -2
  22. package/dist/transport/impls/ws/server.cjs +9 -4
  23. package/dist/transport/impls/ws/server.d.cts +2 -2
  24. package/dist/transport/impls/ws/server.d.ts +2 -2
  25. package/dist/transport/impls/ws/server.js +2 -2
  26. package/dist/transport/index.cjs +15 -16
  27. package/dist/transport/index.d.cts +1 -1
  28. package/dist/transport/index.d.ts +1 -1
  29. package/dist/transport/index.js +3 -3
  30. package/dist/util/testHelpers.d.cts +2 -2
  31. package/dist/util/testHelpers.d.ts +2 -2
  32. package/dist/util/testHelpers.js +1 -1
  33. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  import { TObject, TUnion, TString, TSchema, TNever, TLiteral, Static } from '@sinclair/typebox';
2
2
  import { Pushable } from 'it-pushable';
3
- import { b as TransportClientId, d as Session, C as Connection } from './index-f922ec84.js';
3
+ import { b as TransportClientId, d as Session, C as Connection } from './index-76b801f8.js';
4
4
 
5
5
  /**
6
6
  * The context for services/procedures. This is used only on
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Connection
3
- } from "./chunk-IVNV5HBI.js";
3
+ } from "./chunk-O6YQ3JAH.js";
4
4
 
5
5
  // transport/impls/ws/connection.ts
6
6
  var WebSocketConnection = class extends Connection {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Connection
3
- } from "./chunk-IVNV5HBI.js";
3
+ } from "./chunk-O6YQ3JAH.js";
4
4
 
5
5
  // transport/transforms/messageFraming.ts
6
6
  import { Transform } from "node:stream";
@@ -16,12 +16,11 @@ import {
16
16
  } from "./chunk-GZ7HCLLM.js";
17
17
 
18
18
  // transport/events.ts
19
- var ProtocolErrorType = /* @__PURE__ */ ((ProtocolErrorType2) => {
20
- ProtocolErrorType2["RetriesExceeded"] = "conn_retry_exceeded";
21
- ProtocolErrorType2["HandshakeFailed"] = "handshake_failed";
22
- ProtocolErrorType2["UseAfterDestroy"] = "use_after_destroy";
23
- return ProtocolErrorType2;
24
- })(ProtocolErrorType || {});
19
+ var ProtocolError = {
20
+ RetriesExceeded: "conn_retry_exceeded",
21
+ HandshakeFailed: "handshake_failed",
22
+ UseAfterDestroy: "use_after_destroy"
23
+ };
25
24
  var EventDispatcher = class {
26
25
  eventListeners = {};
27
26
  numberOfListeners(eventType) {
@@ -475,7 +474,7 @@ var Transport = class {
475
474
  if (this.state === "destroyed") {
476
475
  const err = "transport is destroyed, cant send";
477
476
  log?.error(`${this.clientId} -- ` + err + `: ${JSON.stringify(msg)}`);
478
- this.protocolError("use_after_destroy" /* UseAfterDestroy */, err);
477
+ this.protocolError(ProtocolError.UseAfterDestroy, err);
479
478
  return void 0;
480
479
  } else if (this.state === "closed") {
481
480
  log?.info(
@@ -585,7 +584,7 @@ var ClientTransport = class extends Transport {
585
584
  const parsed = this.parseMsg(data);
586
585
  if (!parsed) {
587
586
  this.protocolError(
588
- "handshake_failed" /* HandshakeFailed */,
587
+ ProtocolError.HandshakeFailed,
589
588
  "received non-transport message"
590
589
  );
591
590
  return false;
@@ -597,7 +596,7 @@ var ClientTransport = class extends Transport {
597
596
  )}`
598
597
  );
599
598
  this.protocolError(
600
- "handshake_failed" /* HandshakeFailed */,
599
+ ProtocolError.HandshakeFailed,
601
600
  "invalid handshake resp"
602
601
  );
603
602
  return false;
@@ -609,7 +608,7 @@ var ClientTransport = class extends Transport {
609
608
  )}`
610
609
  );
611
610
  this.protocolError(
612
- "handshake_failed" /* HandshakeFailed */,
611
+ ProtocolError.HandshakeFailed,
613
612
  parsed.payload.status.reason
614
613
  );
615
614
  return false;
@@ -650,7 +649,7 @@ var ClientTransport = class extends Transport {
650
649
  if (attempt >= this.options.retryAttemptsMax) {
651
650
  const errMsg = `connection to ${to} failed after ${attempt} attempts (${errStr}), giving up`;
652
651
  log?.error(`${this.clientId} -- ${errMsg}`);
653
- this.protocolError("conn_retry_exceeded" /* RetriesExceeded */, errMsg);
652
+ this.protocolError(ProtocolError.RetriesExceeded, errMsg);
654
653
  return;
655
654
  } else {
656
655
  const jitter = Math.floor(Math.random() * this.options.retryJitterMs);
@@ -729,7 +728,7 @@ var ServerTransport = class extends Transport {
729
728
  const parsed = this.parseMsg(data);
730
729
  if (!parsed) {
731
730
  this.protocolError(
732
- "handshake_failed" /* HandshakeFailed */,
731
+ ProtocolError.HandshakeFailed,
733
732
  "received non-transport message"
734
733
  );
735
734
  return false;
@@ -748,7 +747,7 @@ var ServerTransport = class extends Transport {
748
747
  )}`
749
748
  );
750
749
  this.protocolError(
751
- "handshake_failed" /* HandshakeFailed */,
750
+ ProtocolError.HandshakeFailed,
752
751
  "invalid handshake request"
753
752
  );
754
753
  return false;
@@ -766,7 +765,7 @@ var ServerTransport = class extends Transport {
766
765
  `${this.clientId} -- received handshake msg with incompatible protocol version (got: ${gotVersion}, expected: ${PROTOCOL_VERSION})`
767
766
  );
768
767
  this.protocolError(
769
- "handshake_failed" /* HandshakeFailed */,
768
+ ProtocolError.HandshakeFailed,
770
769
  `incorrect version (got: ${gotVersion} wanted ${PROTOCOL_VERSION})`
771
770
  );
772
771
  return false;
@@ -787,7 +786,7 @@ var ServerTransport = class extends Transport {
787
786
  };
788
787
 
789
788
  export {
790
- ProtocolErrorType,
789
+ ProtocolError,
791
790
  Connection,
792
791
  defaultSessionOptions,
793
792
  Session,
@@ -1,4 +1,4 @@
1
- import { C as Connection } from './index-f922ec84.js';
1
+ import { C as Connection } from './index-76b801f8.js';
2
2
  import { Socket } from 'node:net';
3
3
  import stream, { Transform, TransformCallback, TransformOptions } from 'node:stream';
4
4
 
@@ -1,5 +1,5 @@
1
1
  import WebSocket from 'isomorphic-ws';
2
- import { C as Connection } from './index-f922ec84.js';
2
+ import { C as Connection } from './index-76b801f8.js';
3
3
 
4
4
  declare class WebSocketConnection extends Connection {
5
5
  ws: WebSocket;
@@ -205,11 +205,12 @@ declare class Session<ConnType extends Connection> {
205
205
  }
206
206
 
207
207
  type ConnectionStatus = 'connect' | 'disconnect';
208
- declare const enum ProtocolErrorType {
209
- RetriesExceeded = "conn_retry_exceeded",
210
- HandshakeFailed = "handshake_failed",
211
- UseAfterDestroy = "use_after_destroy"
212
- }
208
+ declare const ProtocolError: {
209
+ readonly RetriesExceeded: "conn_retry_exceeded";
210
+ readonly HandshakeFailed: "handshake_failed";
211
+ readonly UseAfterDestroy: "use_after_destroy";
212
+ };
213
+ type ProtocolErrorType = (typeof ProtocolError)[keyof typeof ProtocolError];
213
214
  interface EventMap {
214
215
  message: OpaqueTransportMessage;
215
216
  connectionStatus: {
@@ -428,4 +429,4 @@ declare abstract class ServerTransport<ConnType extends Connection> extends Tran
428
429
  };
429
430
  }
430
431
 
431
- export { Connection as C, EventMap as E, OpaqueTransportMessage as O, PartialTransportMessage as P, ServerTransport as S, Transport as T, ClientTransport as a, TransportClientId as b, TransportOptions as c, Session as d, TransportStatus as e, TransportMessageSchema as f, OpaqueTransportMessageSchema as g, TransportMessage as h, isStreamOpen as i, isStreamClose as j, EventTypes as k, EventHandler as l, ProtocolErrorType as m };
432
+ export { Connection as C, EventMap as E, OpaqueTransportMessage as O, PartialTransportMessage as P, ServerTransport as S, Transport as T, ClientTransport as a, TransportClientId as b, TransportOptions as c, Session as d, TransportStatus as e, TransportMessageSchema as f, OpaqueTransportMessageSchema as g, TransportMessage as h, isStreamOpen as i, isStreamClose as j, EventTypes as k, EventHandler as l, ProtocolError as m, ProtocolErrorType as n };
@@ -1,6 +1,6 @@
1
- import { A as AnyService, P as PayloadType, b as Result, R as RiverError, S as ServiceContext, d as ProcType, e as ProcInput, f as ProcOutput, g as ProcErrors, h as ProcHasInit, i as ProcInit } from '../builder-ca6c4259.js';
2
- export { E as Err, O as Ok, m as ProcHandler, k as ProcListing, a as Procedure, p as RiverErrorSchema, c as RiverUncaughtSchema, l as Service, j as ServiceBuilder, n as ServiceContextWithState, o as ServiceContextWithTransportInfo, U as UNCAUGHT_ERROR, V as ValidProcType, s as serializeService } from '../builder-ca6c4259.js';
3
- import { S as ServerTransport, C as Connection, a as ClientTransport, b as TransportClientId } from '../index-f922ec84.js';
1
+ import { A as AnyService, P as PayloadType, b as Result, R as RiverError, S as ServiceContext, d as ProcType, e as ProcInput, f as ProcOutput, g as ProcErrors, h as ProcHasInit, i as ProcInit } from '../builder-660d3140.js';
2
+ export { E as Err, O as Ok, m as ProcHandler, k as ProcListing, a as Procedure, p as RiverErrorSchema, c as RiverUncaughtSchema, l as Service, j as ServiceBuilder, n as ServiceContextWithState, o as ServiceContextWithTransportInfo, U as UNCAUGHT_ERROR, V as ValidProcType, s as serializeService } from '../builder-660d3140.js';
3
+ import { S as ServerTransport, C as Connection, a as ClientTransport, b as TransportClientId } from '../index-76b801f8.js';
4
4
  import { Pushable } from 'it-pushable';
5
5
  import { Static } from '@sinclair/typebox';
6
6
  import '../types-3e5768ec.js';
@@ -1,6 +1,6 @@
1
- import { A as AnyService, P as PayloadType, b as Result, R as RiverError, S as ServiceContext, d as ProcType, e as ProcInput, f as ProcOutput, g as ProcErrors, h as ProcHasInit, i as ProcInit } from '../builder-ca6c4259.js';
2
- export { E as Err, O as Ok, m as ProcHandler, k as ProcListing, a as Procedure, p as RiverErrorSchema, c as RiverUncaughtSchema, l as Service, j as ServiceBuilder, n as ServiceContextWithState, o as ServiceContextWithTransportInfo, U as UNCAUGHT_ERROR, V as ValidProcType, s as serializeService } from '../builder-ca6c4259.js';
3
- import { S as ServerTransport, C as Connection, a as ClientTransport, b as TransportClientId } from '../index-f922ec84.js';
1
+ import { A as AnyService, P as PayloadType, b as Result, R as RiverError, S as ServiceContext, d as ProcType, e as ProcInput, f as ProcOutput, g as ProcErrors, h as ProcHasInit, i as ProcInit } from '../builder-660d3140.js';
2
+ export { E as Err, O as Ok, m as ProcHandler, k as ProcListing, a as Procedure, p as RiverErrorSchema, c as RiverUncaughtSchema, l as Service, j as ServiceBuilder, n as ServiceContextWithState, o as ServiceContextWithTransportInfo, U as UNCAUGHT_ERROR, V as ValidProcType, s as serializeService } from '../builder-660d3140.js';
3
+ import { S as ServerTransport, C as Connection, a as ClientTransport, b as TransportClientId } from '../index-76b801f8.js';
4
4
  import { Pushable } from 'it-pushable';
5
5
  import { Static } from '@sinclair/typebox';
6
6
  import '../types-3e5768ec.js';
@@ -450,6 +450,11 @@ var UdsConnection = class extends Connection {
450
450
  var import_value = require("@sinclair/typebox/value");
451
451
 
452
452
  // transport/events.ts
453
+ var ProtocolError = {
454
+ RetriesExceeded: "conn_retry_exceeded",
455
+ HandshakeFailed: "handshake_failed",
456
+ UseAfterDestroy: "use_after_destroy"
457
+ };
453
458
  var EventDispatcher = class {
454
459
  eventListeners = {};
455
460
  numberOfListeners(eventType) {
@@ -710,7 +715,7 @@ var Transport = class {
710
715
  if (this.state === "destroyed") {
711
716
  const err = "transport is destroyed, cant send";
712
717
  log?.error(`${this.clientId} -- ` + err + `: ${JSON.stringify(msg)}`);
713
- this.protocolError("use_after_destroy" /* UseAfterDestroy */, err);
718
+ this.protocolError(ProtocolError.UseAfterDestroy, err);
714
719
  return void 0;
715
720
  } else if (this.state === "closed") {
716
721
  log?.info(
@@ -820,7 +825,7 @@ var ClientTransport = class extends Transport {
820
825
  const parsed = this.parseMsg(data);
821
826
  if (!parsed) {
822
827
  this.protocolError(
823
- "handshake_failed" /* HandshakeFailed */,
828
+ ProtocolError.HandshakeFailed,
824
829
  "received non-transport message"
825
830
  );
826
831
  return false;
@@ -832,7 +837,7 @@ var ClientTransport = class extends Transport {
832
837
  )}`
833
838
  );
834
839
  this.protocolError(
835
- "handshake_failed" /* HandshakeFailed */,
840
+ ProtocolError.HandshakeFailed,
836
841
  "invalid handshake resp"
837
842
  );
838
843
  return false;
@@ -844,7 +849,7 @@ var ClientTransport = class extends Transport {
844
849
  )}`
845
850
  );
846
851
  this.protocolError(
847
- "handshake_failed" /* HandshakeFailed */,
852
+ ProtocolError.HandshakeFailed,
848
853
  parsed.payload.status.reason
849
854
  );
850
855
  return false;
@@ -885,7 +890,7 @@ var ClientTransport = class extends Transport {
885
890
  if (attempt >= this.options.retryAttemptsMax) {
886
891
  const errMsg = `connection to ${to} failed after ${attempt} attempts (${errStr}), giving up`;
887
892
  log?.error(`${this.clientId} -- ${errMsg}`);
888
- this.protocolError("conn_retry_exceeded" /* RetriesExceeded */, errMsg);
893
+ this.protocolError(ProtocolError.RetriesExceeded, errMsg);
889
894
  return;
890
895
  } else {
891
896
  const jitter = Math.floor(Math.random() * this.options.retryJitterMs);
@@ -1,5 +1,5 @@
1
- import { a as ClientTransport, c as TransportOptions, b as TransportClientId } from '../../../index-f922ec84.js';
2
- import { U as UdsConnection } from '../../../connection-0c5eeb14.js';
1
+ import { a as ClientTransport, c as TransportOptions, b as TransportClientId } from '../../../index-76b801f8.js';
2
+ import { U as UdsConnection } from '../../../connection-162c0f7b.js';
3
3
  import '../../../types-3e5768ec.js';
4
4
  import '@sinclair/typebox';
5
5
  import 'node:net';
@@ -1,5 +1,5 @@
1
- import { a as ClientTransport, c as TransportOptions, b as TransportClientId } from '../../../index-f922ec84.js';
2
- import { U as UdsConnection } from '../../../connection-0c5eeb14.js';
1
+ import { a as ClientTransport, c as TransportOptions, b as TransportClientId } from '../../../index-76b801f8.js';
2
+ import { U as UdsConnection } from '../../../connection-162c0f7b.js';
3
3
  import '../../../types-3e5768ec.js';
4
4
  import '@sinclair/typebox';
5
5
  import 'node:net';
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  UdsConnection
3
- } from "../../../chunk-BSAIT634.js";
3
+ } from "../../../chunk-MNWOTQWX.js";
4
4
  import {
5
5
  ClientTransport
6
- } from "../../../chunk-IVNV5HBI.js";
6
+ } from "../../../chunk-O6YQ3JAH.js";
7
7
  import "../../../chunk-GFRAOY75.js";
8
8
  import {
9
9
  log
@@ -108,6 +108,11 @@ function isAck(controlFlag) {
108
108
  }
109
109
 
110
110
  // transport/events.ts
111
+ var ProtocolError = {
112
+ RetriesExceeded: "conn_retry_exceeded",
113
+ HandshakeFailed: "handshake_failed",
114
+ UseAfterDestroy: "use_after_destroy"
115
+ };
111
116
  var EventDispatcher = class {
112
117
  eventListeners = {};
113
118
  numberOfListeners(eventType) {
@@ -624,7 +629,7 @@ var Transport = class {
624
629
  if (this.state === "destroyed") {
625
630
  const err = "transport is destroyed, cant send";
626
631
  log?.error(`${this.clientId} -- ` + err + `: ${JSON.stringify(msg)}`);
627
- this.protocolError("use_after_destroy" /* UseAfterDestroy */, err);
632
+ this.protocolError(ProtocolError.UseAfterDestroy, err);
628
633
  return void 0;
629
634
  } else if (this.state === "closed") {
630
635
  log?.info(
@@ -736,7 +741,7 @@ var ServerTransport = class extends Transport {
736
741
  const parsed = this.parseMsg(data);
737
742
  if (!parsed) {
738
743
  this.protocolError(
739
- "handshake_failed" /* HandshakeFailed */,
744
+ ProtocolError.HandshakeFailed,
740
745
  "received non-transport message"
741
746
  );
742
747
  return false;
@@ -755,7 +760,7 @@ var ServerTransport = class extends Transport {
755
760
  )}`
756
761
  );
757
762
  this.protocolError(
758
- "handshake_failed" /* HandshakeFailed */,
763
+ ProtocolError.HandshakeFailed,
759
764
  "invalid handshake request"
760
765
  );
761
766
  return false;
@@ -773,7 +778,7 @@ var ServerTransport = class extends Transport {
773
778
  `${this.clientId} -- received handshake msg with incompatible protocol version (got: ${gotVersion}, expected: ${PROTOCOL_VERSION})`
774
779
  );
775
780
  this.protocolError(
776
- "handshake_failed" /* HandshakeFailed */,
781
+ ProtocolError.HandshakeFailed,
777
782
  `incorrect version (got: ${gotVersion} wanted ${PROTOCOL_VERSION})`
778
783
  );
779
784
  return false;
@@ -1,6 +1,6 @@
1
1
  import { Server, Socket } from 'node:net';
2
- import { S as ServerTransport, b as TransportClientId, c as TransportOptions } from '../../../index-f922ec84.js';
3
- import { U as UdsConnection } from '../../../connection-0c5eeb14.js';
2
+ import { S as ServerTransport, b as TransportClientId, c as TransportOptions } from '../../../index-76b801f8.js';
3
+ import { U as UdsConnection } from '../../../connection-162c0f7b.js';
4
4
  import '../../../types-3e5768ec.js';
5
5
  import '@sinclair/typebox';
6
6
  import 'node:stream';
@@ -1,6 +1,6 @@
1
1
  import { Server, Socket } from 'node:net';
2
- import { S as ServerTransport, b as TransportClientId, c as TransportOptions } from '../../../index-f922ec84.js';
3
- import { U as UdsConnection } from '../../../connection-0c5eeb14.js';
2
+ import { S as ServerTransport, b as TransportClientId, c as TransportOptions } from '../../../index-76b801f8.js';
3
+ import { U as UdsConnection } from '../../../connection-162c0f7b.js';
4
4
  import '../../../types-3e5768ec.js';
5
5
  import '@sinclair/typebox';
6
6
  import 'node:stream';
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  UdsConnection
3
- } from "../../../chunk-BSAIT634.js";
3
+ } from "../../../chunk-MNWOTQWX.js";
4
4
  import {
5
5
  ServerTransport
6
- } from "../../../chunk-IVNV5HBI.js";
6
+ } from "../../../chunk-O6YQ3JAH.js";
7
7
  import "../../../chunk-GFRAOY75.js";
8
8
  import {
9
9
  log
@@ -100,6 +100,11 @@ function isAck(controlFlag) {
100
100
  var log;
101
101
 
102
102
  // transport/events.ts
103
+ var ProtocolError = {
104
+ RetriesExceeded: "conn_retry_exceeded",
105
+ HandshakeFailed: "handshake_failed",
106
+ UseAfterDestroy: "use_after_destroy"
107
+ };
103
108
  var EventDispatcher = class {
104
109
  eventListeners = {};
105
110
  numberOfListeners(eventType) {
@@ -616,7 +621,7 @@ var Transport = class {
616
621
  if (this.state === "destroyed") {
617
622
  const err = "transport is destroyed, cant send";
618
623
  log?.error(`${this.clientId} -- ` + err + `: ${JSON.stringify(msg)}`);
619
- this.protocolError("use_after_destroy" /* UseAfterDestroy */, err);
624
+ this.protocolError(ProtocolError.UseAfterDestroy, err);
620
625
  return void 0;
621
626
  } else if (this.state === "closed") {
622
627
  log?.info(
@@ -726,7 +731,7 @@ var ClientTransport = class extends Transport {
726
731
  const parsed = this.parseMsg(data);
727
732
  if (!parsed) {
728
733
  this.protocolError(
729
- "handshake_failed" /* HandshakeFailed */,
734
+ ProtocolError.HandshakeFailed,
730
735
  "received non-transport message"
731
736
  );
732
737
  return false;
@@ -738,7 +743,7 @@ var ClientTransport = class extends Transport {
738
743
  )}`
739
744
  );
740
745
  this.protocolError(
741
- "handshake_failed" /* HandshakeFailed */,
746
+ ProtocolError.HandshakeFailed,
742
747
  "invalid handshake resp"
743
748
  );
744
749
  return false;
@@ -750,7 +755,7 @@ var ClientTransport = class extends Transport {
750
755
  )}`
751
756
  );
752
757
  this.protocolError(
753
- "handshake_failed" /* HandshakeFailed */,
758
+ ProtocolError.HandshakeFailed,
754
759
  parsed.payload.status.reason
755
760
  );
756
761
  return false;
@@ -791,7 +796,7 @@ var ClientTransport = class extends Transport {
791
796
  if (attempt >= this.options.retryAttemptsMax) {
792
797
  const errMsg = `connection to ${to} failed after ${attempt} attempts (${errStr}), giving up`;
793
798
  log?.error(`${this.clientId} -- ${errMsg}`);
794
- this.protocolError("conn_retry_exceeded" /* RetriesExceeded */, errMsg);
799
+ this.protocolError(ProtocolError.RetriesExceeded, errMsg);
795
800
  return;
796
801
  } else {
797
802
  const jitter = Math.floor(Math.random() * this.options.retryJitterMs);
@@ -1,6 +1,6 @@
1
1
  import WebSocket from 'isomorphic-ws';
2
- import { a as ClientTransport, b as TransportClientId, c as TransportOptions } from '../../../index-f922ec84.js';
3
- import { W as WebSocketConnection } from '../../../connection-14675d77.js';
2
+ import { a as ClientTransport, b as TransportClientId, c as TransportOptions } from '../../../index-76b801f8.js';
3
+ import { W as WebSocketConnection } from '../../../connection-93daccc3.js';
4
4
  import '../../../types-3e5768ec.js';
5
5
  import '@sinclair/typebox';
6
6
 
@@ -1,6 +1,6 @@
1
1
  import WebSocket from 'isomorphic-ws';
2
- import { a as ClientTransport, b as TransportClientId, c as TransportOptions } from '../../../index-f922ec84.js';
3
- import { W as WebSocketConnection } from '../../../connection-14675d77.js';
2
+ import { a as ClientTransport, b as TransportClientId, c as TransportOptions } from '../../../index-76b801f8.js';
3
+ import { W as WebSocketConnection } from '../../../connection-93daccc3.js';
4
4
  import '../../../types-3e5768ec.js';
5
5
  import '@sinclair/typebox';
6
6
 
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  WebSocketConnection
3
- } from "../../../chunk-FFT7PSUV.js";
3
+ } from "../../../chunk-5TX4BKAD.js";
4
4
  import {
5
5
  ClientTransport
6
- } from "../../../chunk-IVNV5HBI.js";
6
+ } from "../../../chunk-O6YQ3JAH.js";
7
7
  import "../../../chunk-GFRAOY75.js";
8
8
  import {
9
9
  log
@@ -108,6 +108,11 @@ function isAck(controlFlag) {
108
108
  var log;
109
109
 
110
110
  // transport/events.ts
111
+ var ProtocolError = {
112
+ RetriesExceeded: "conn_retry_exceeded",
113
+ HandshakeFailed: "handshake_failed",
114
+ UseAfterDestroy: "use_after_destroy"
115
+ };
111
116
  var EventDispatcher = class {
112
117
  eventListeners = {};
113
118
  numberOfListeners(eventType) {
@@ -624,7 +629,7 @@ var Transport = class {
624
629
  if (this.state === "destroyed") {
625
630
  const err = "transport is destroyed, cant send";
626
631
  log?.error(`${this.clientId} -- ` + err + `: ${JSON.stringify(msg)}`);
627
- this.protocolError("use_after_destroy" /* UseAfterDestroy */, err);
632
+ this.protocolError(ProtocolError.UseAfterDestroy, err);
628
633
  return void 0;
629
634
  } else if (this.state === "closed") {
630
635
  log?.info(
@@ -736,7 +741,7 @@ var ServerTransport = class extends Transport {
736
741
  const parsed = this.parseMsg(data);
737
742
  if (!parsed) {
738
743
  this.protocolError(
739
- "handshake_failed" /* HandshakeFailed */,
744
+ ProtocolError.HandshakeFailed,
740
745
  "received non-transport message"
741
746
  );
742
747
  return false;
@@ -755,7 +760,7 @@ var ServerTransport = class extends Transport {
755
760
  )}`
756
761
  );
757
762
  this.protocolError(
758
- "handshake_failed" /* HandshakeFailed */,
763
+ ProtocolError.HandshakeFailed,
759
764
  "invalid handshake request"
760
765
  );
761
766
  return false;
@@ -773,7 +778,7 @@ var ServerTransport = class extends Transport {
773
778
  `${this.clientId} -- received handshake msg with incompatible protocol version (got: ${gotVersion}, expected: ${PROTOCOL_VERSION})`
774
779
  );
775
780
  this.protocolError(
776
- "handshake_failed" /* HandshakeFailed */,
781
+ ProtocolError.HandshakeFailed,
777
782
  `incorrect version (got: ${gotVersion} wanted ${PROTOCOL_VERSION})`
778
783
  );
779
784
  return false;
@@ -1,7 +1,7 @@
1
- import { S as ServerTransport, b as TransportClientId, c as TransportOptions } from '../../../index-f922ec84.js';
1
+ import { S as ServerTransport, b as TransportClientId, c as TransportOptions } from '../../../index-76b801f8.js';
2
2
  import { WebSocketServer } from 'ws';
3
3
  import { WebSocket } from 'isomorphic-ws';
4
- import { W as WebSocketConnection } from '../../../connection-14675d77.js';
4
+ import { W as WebSocketConnection } from '../../../connection-93daccc3.js';
5
5
  import '../../../types-3e5768ec.js';
6
6
  import '@sinclair/typebox';
7
7
 
@@ -1,7 +1,7 @@
1
- import { S as ServerTransport, b as TransportClientId, c as TransportOptions } from '../../../index-f922ec84.js';
1
+ import { S as ServerTransport, b as TransportClientId, c as TransportOptions } from '../../../index-76b801f8.js';
2
2
  import { WebSocketServer } from 'ws';
3
3
  import { WebSocket } from 'isomorphic-ws';
4
- import { W as WebSocketConnection } from '../../../connection-14675d77.js';
4
+ import { W as WebSocketConnection } from '../../../connection-93daccc3.js';
5
5
  import '../../../types-3e5768ec.js';
6
6
  import '@sinclair/typebox';
7
7
 
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  WebSocketConnection
3
- } from "../../../chunk-FFT7PSUV.js";
3
+ } from "../../../chunk-5TX4BKAD.js";
4
4
  import {
5
5
  ServerTransport
6
- } from "../../../chunk-IVNV5HBI.js";
6
+ } from "../../../chunk-O6YQ3JAH.js";
7
7
  import "../../../chunk-GFRAOY75.js";
8
8
  import "../../../chunk-H4BYJELI.js";
9
9
  import "../../../chunk-GZ7HCLLM.js";
@@ -23,7 +23,7 @@ __export(transport_exports, {
23
23
  ClientTransport: () => ClientTransport,
24
24
  Connection: () => Connection,
25
25
  OpaqueTransportMessageSchema: () => OpaqueTransportMessageSchema,
26
- ProtocolErrorType: () => ProtocolErrorType,
26
+ ProtocolError: () => ProtocolError,
27
27
  ServerTransport: () => ServerTransport,
28
28
  Session: () => Session,
29
29
  Transport: () => Transport,
@@ -131,12 +131,11 @@ function isAck(controlFlag) {
131
131
  var log;
132
132
 
133
133
  // transport/events.ts
134
- var ProtocolErrorType = /* @__PURE__ */ ((ProtocolErrorType2) => {
135
- ProtocolErrorType2["RetriesExceeded"] = "conn_retry_exceeded";
136
- ProtocolErrorType2["HandshakeFailed"] = "handshake_failed";
137
- ProtocolErrorType2["UseAfterDestroy"] = "use_after_destroy";
138
- return ProtocolErrorType2;
139
- })(ProtocolErrorType || {});
134
+ var ProtocolError = {
135
+ RetriesExceeded: "conn_retry_exceeded",
136
+ HandshakeFailed: "handshake_failed",
137
+ UseAfterDestroy: "use_after_destroy"
138
+ };
140
139
  var EventDispatcher = class {
141
140
  eventListeners = {};
142
141
  numberOfListeners(eventType) {
@@ -653,7 +652,7 @@ var Transport = class {
653
652
  if (this.state === "destroyed") {
654
653
  const err = "transport is destroyed, cant send";
655
654
  log?.error(`${this.clientId} -- ` + err + `: ${JSON.stringify(msg)}`);
656
- this.protocolError("use_after_destroy" /* UseAfterDestroy */, err);
655
+ this.protocolError(ProtocolError.UseAfterDestroy, err);
657
656
  return void 0;
658
657
  } else if (this.state === "closed") {
659
658
  log?.info(
@@ -763,7 +762,7 @@ var ClientTransport = class extends Transport {
763
762
  const parsed = this.parseMsg(data);
764
763
  if (!parsed) {
765
764
  this.protocolError(
766
- "handshake_failed" /* HandshakeFailed */,
765
+ ProtocolError.HandshakeFailed,
767
766
  "received non-transport message"
768
767
  );
769
768
  return false;
@@ -775,7 +774,7 @@ var ClientTransport = class extends Transport {
775
774
  )}`
776
775
  );
777
776
  this.protocolError(
778
- "handshake_failed" /* HandshakeFailed */,
777
+ ProtocolError.HandshakeFailed,
779
778
  "invalid handshake resp"
780
779
  );
781
780
  return false;
@@ -787,7 +786,7 @@ var ClientTransport = class extends Transport {
787
786
  )}`
788
787
  );
789
788
  this.protocolError(
790
- "handshake_failed" /* HandshakeFailed */,
789
+ ProtocolError.HandshakeFailed,
791
790
  parsed.payload.status.reason
792
791
  );
793
792
  return false;
@@ -828,7 +827,7 @@ var ClientTransport = class extends Transport {
828
827
  if (attempt >= this.options.retryAttemptsMax) {
829
828
  const errMsg = `connection to ${to} failed after ${attempt} attempts (${errStr}), giving up`;
830
829
  log?.error(`${this.clientId} -- ${errMsg}`);
831
- this.protocolError("conn_retry_exceeded" /* RetriesExceeded */, errMsg);
830
+ this.protocolError(ProtocolError.RetriesExceeded, errMsg);
832
831
  return;
833
832
  } else {
834
833
  const jitter = Math.floor(Math.random() * this.options.retryJitterMs);
@@ -907,7 +906,7 @@ var ServerTransport = class extends Transport {
907
906
  const parsed = this.parseMsg(data);
908
907
  if (!parsed) {
909
908
  this.protocolError(
910
- "handshake_failed" /* HandshakeFailed */,
909
+ ProtocolError.HandshakeFailed,
911
910
  "received non-transport message"
912
911
  );
913
912
  return false;
@@ -926,7 +925,7 @@ var ServerTransport = class extends Transport {
926
925
  )}`
927
926
  );
928
927
  this.protocolError(
929
- "handshake_failed" /* HandshakeFailed */,
928
+ ProtocolError.HandshakeFailed,
930
929
  "invalid handshake request"
931
930
  );
932
931
  return false;
@@ -944,7 +943,7 @@ var ServerTransport = class extends Transport {
944
943
  `${this.clientId} -- received handshake msg with incompatible protocol version (got: ${gotVersion}, expected: ${PROTOCOL_VERSION})`
945
944
  );
946
945
  this.protocolError(
947
- "handshake_failed" /* HandshakeFailed */,
946
+ ProtocolError.HandshakeFailed,
948
947
  `incorrect version (got: ${gotVersion} wanted ${PROTOCOL_VERSION})`
949
948
  );
950
949
  return false;
@@ -968,7 +967,7 @@ var ServerTransport = class extends Transport {
968
967
  ClientTransport,
969
968
  Connection,
970
969
  OpaqueTransportMessageSchema,
971
- ProtocolErrorType,
970
+ ProtocolError,
972
971
  ServerTransport,
973
972
  Session,
974
973
  Transport,
@@ -1,3 +1,3 @@
1
- export { a as ClientTransport, C as Connection, l as EventHandler, E as EventMap, k as EventTypes, O as OpaqueTransportMessage, g as OpaqueTransportMessageSchema, m as ProtocolErrorType, S as ServerTransport, d as Session, T as Transport, b as TransportClientId, h as TransportMessage, f as TransportMessageSchema, c as TransportOptions, e as TransportStatus, j as isStreamClose, i as isStreamOpen } from '../index-f922ec84.js';
1
+ export { a as ClientTransport, C as Connection, l as EventHandler, E as EventMap, k as EventTypes, O as OpaqueTransportMessage, g as OpaqueTransportMessageSchema, m as ProtocolError, n as ProtocolErrorType, S as ServerTransport, d as Session, T as Transport, b as TransportClientId, h as TransportMessage, f as TransportMessageSchema, c as TransportOptions, e as TransportStatus, j as isStreamClose, i as isStreamOpen } from '../index-76b801f8.js';
2
2
  import '../types-3e5768ec.js';
3
3
  import '@sinclair/typebox';
@@ -1,3 +1,3 @@
1
- export { a as ClientTransport, C as Connection, l as EventHandler, E as EventMap, k as EventTypes, O as OpaqueTransportMessage, g as OpaqueTransportMessageSchema, m as ProtocolErrorType, S as ServerTransport, d as Session, T as Transport, b as TransportClientId, h as TransportMessage, f as TransportMessageSchema, c as TransportOptions, e as TransportStatus, j as isStreamClose, i as isStreamOpen } from '../index-f922ec84.js';
1
+ export { a as ClientTransport, C as Connection, l as EventHandler, E as EventMap, k as EventTypes, O as OpaqueTransportMessage, g as OpaqueTransportMessageSchema, m as ProtocolError, n as ProtocolErrorType, S as ServerTransport, d as Session, T as Transport, b as TransportClientId, h as TransportMessage, f as TransportMessageSchema, c as TransportOptions, e as TransportStatus, j as isStreamClose, i as isStreamOpen } from '../index-76b801f8.js';
2
2
  import '../types-3e5768ec.js';
3
3
  import '@sinclair/typebox';
@@ -2,11 +2,11 @@ import "../chunk-RPIDSIQG.js";
2
2
  import {
3
3
  ClientTransport,
4
4
  Connection,
5
- ProtocolErrorType,
5
+ ProtocolError,
6
6
  ServerTransport,
7
7
  Session,
8
8
  Transport
9
- } from "../chunk-IVNV5HBI.js";
9
+ } from "../chunk-O6YQ3JAH.js";
10
10
  import {
11
11
  OpaqueTransportMessageSchema,
12
12
  TransportMessageSchema
@@ -17,7 +17,7 @@ export {
17
17
  ClientTransport,
18
18
  Connection,
19
19
  OpaqueTransportMessageSchema,
20
- ProtocolErrorType,
20
+ ProtocolError,
21
21
  ServerTransport,
22
22
  Session,
23
23
  Transport,
@@ -1,8 +1,8 @@
1
1
  import * as it_pushable from 'it-pushable';
2
2
  import WebSocket from 'isomorphic-ws';
3
3
  import http from 'node:http';
4
- import { P as PartialTransportMessage, T as Transport, C as Connection, O as OpaqueTransportMessage } from '../index-f922ec84.js';
5
- import { P as PayloadType, R as RiverError, a as Procedure, S as ServiceContext, b as Result, c as RiverUncaughtSchema } from '../builder-ca6c4259.js';
4
+ import { P as PartialTransportMessage, T as Transport, C as Connection, O as OpaqueTransportMessage } from '../index-76b801f8.js';
5
+ import { P as PayloadType, R as RiverError, a as Procedure, S as ServiceContext, b as Result, c as RiverUncaughtSchema } from '../builder-660d3140.js';
6
6
  import { Static } from '@sinclair/typebox';
7
7
  import net from 'node:net';
8
8
  import '../types-3e5768ec.js';
@@ -1,8 +1,8 @@
1
1
  import * as it_pushable from 'it-pushable';
2
2
  import WebSocket from 'isomorphic-ws';
3
3
  import http from 'node:http';
4
- import { P as PartialTransportMessage, T as Transport, C as Connection, O as OpaqueTransportMessage } from '../index-f922ec84.js';
5
- import { P as PayloadType, R as RiverError, a as Procedure, S as ServiceContext, b as Result, c as RiverUncaughtSchema } from '../builder-ca6c4259.js';
4
+ import { P as PartialTransportMessage, T as Transport, C as Connection, O as OpaqueTransportMessage } from '../index-76b801f8.js';
5
+ import { P as PayloadType, R as RiverError, a as Procedure, S as ServiceContext, b as Result, c as RiverUncaughtSchema } from '../builder-660d3140.js';
6
6
  import { Static } from '@sinclair/typebox';
7
7
  import net from 'node:net';
8
8
  import '../types-3e5768ec.js';
@@ -6,7 +6,7 @@ import "../chunk-RPIDSIQG.js";
6
6
  import {
7
7
  Session,
8
8
  defaultSessionOptions
9
- } from "../chunk-IVNV5HBI.js";
9
+ } from "../chunk-O6YQ3JAH.js";
10
10
  import {
11
11
  coerceErrorString
12
12
  } from "../chunk-GFRAOY75.js";
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.15.0",
4
+ "version": "0.15.1",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {