@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.
- package/dist/{builder-ca6c4259.d.ts → builder-660d3140.d.ts} +1 -1
- package/dist/{chunk-FFT7PSUV.js → chunk-5TX4BKAD.js} +1 -1
- package/dist/{chunk-BSAIT634.js → chunk-MNWOTQWX.js} +1 -1
- package/dist/{chunk-IVNV5HBI.js → chunk-O6YQ3JAH.js} +14 -15
- package/dist/{connection-0c5eeb14.d.ts → connection-162c0f7b.d.ts} +1 -1
- package/dist/{connection-14675d77.d.ts → connection-93daccc3.d.ts} +1 -1
- package/dist/{index-f922ec84.d.ts → index-76b801f8.d.ts} +7 -6
- package/dist/router/index.d.cts +3 -3
- package/dist/router/index.d.ts +3 -3
- package/dist/transport/impls/uds/client.cjs +10 -5
- package/dist/transport/impls/uds/client.d.cts +2 -2
- package/dist/transport/impls/uds/client.d.ts +2 -2
- package/dist/transport/impls/uds/client.js +2 -2
- package/dist/transport/impls/uds/server.cjs +9 -4
- package/dist/transport/impls/uds/server.d.cts +2 -2
- package/dist/transport/impls/uds/server.d.ts +2 -2
- package/dist/transport/impls/uds/server.js +2 -2
- package/dist/transport/impls/ws/client.cjs +10 -5
- package/dist/transport/impls/ws/client.d.cts +2 -2
- package/dist/transport/impls/ws/client.d.ts +2 -2
- package/dist/transport/impls/ws/client.js +2 -2
- package/dist/transport/impls/ws/server.cjs +9 -4
- package/dist/transport/impls/ws/server.d.cts +2 -2
- package/dist/transport/impls/ws/server.d.ts +2 -2
- package/dist/transport/impls/ws/server.js +2 -2
- package/dist/transport/index.cjs +15 -16
- package/dist/transport/index.d.cts +1 -1
- package/dist/transport/index.d.ts +1 -1
- package/dist/transport/index.js +3 -3
- package/dist/util/testHelpers.d.cts +2 -2
- package/dist/util/testHelpers.d.ts +2 -2
- package/dist/util/testHelpers.js +1 -1
- 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-
|
|
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
|
|
@@ -16,12 +16,11 @@ import {
|
|
|
16
16
|
} from "./chunk-GZ7HCLLM.js";
|
|
17
17
|
|
|
18
18
|
// transport/events.ts
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
789
|
+
ProtocolError,
|
|
791
790
|
Connection,
|
|
792
791
|
defaultSessionOptions,
|
|
793
792
|
Session,
|
|
@@ -205,11 +205,12 @@ declare class Session<ConnType extends Connection> {
|
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
type ConnectionStatus = 'connect' | 'disconnect';
|
|
208
|
-
declare const
|
|
209
|
-
RetriesExceeded
|
|
210
|
-
HandshakeFailed
|
|
211
|
-
UseAfterDestroy
|
|
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,
|
|
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 };
|
package/dist/router/index.d.cts
CHANGED
|
@@ -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-
|
|
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-
|
|
3
|
-
import { S as ServerTransport, C as Connection, a as ClientTransport, b as TransportClientId } from '../index-
|
|
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';
|
package/dist/router/index.d.ts
CHANGED
|
@@ -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-
|
|
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-
|
|
3
|
-
import { S as ServerTransport, C as Connection, a as ClientTransport, b as TransportClientId } from '../index-
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
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-
|
|
2
|
-
import { U as UdsConnection } from '../../../connection-
|
|
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-
|
|
2
|
-
import { U as UdsConnection } from '../../../connection-
|
|
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-
|
|
3
|
+
} from "../../../chunk-MNWOTQWX.js";
|
|
4
4
|
import {
|
|
5
5
|
ClientTransport
|
|
6
|
-
} from "../../../chunk-
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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-
|
|
3
|
-
import { U as UdsConnection } from '../../../connection-
|
|
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-
|
|
3
|
-
import { U as UdsConnection } from '../../../connection-
|
|
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-
|
|
3
|
+
} from "../../../chunk-MNWOTQWX.js";
|
|
4
4
|
import {
|
|
5
5
|
ServerTransport
|
|
6
|
-
} from "../../../chunk-
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
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-
|
|
3
|
-
import { W as WebSocketConnection } from '../../../connection-
|
|
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-
|
|
3
|
-
import { W as WebSocketConnection } from '../../../connection-
|
|
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-
|
|
3
|
+
} from "../../../chunk-5TX4BKAD.js";
|
|
4
4
|
import {
|
|
5
5
|
ClientTransport
|
|
6
|
-
} from "../../../chunk-
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
3
|
+
} from "../../../chunk-5TX4BKAD.js";
|
|
4
4
|
import {
|
|
5
5
|
ServerTransport
|
|
6
|
-
} from "../../../chunk-
|
|
6
|
+
} from "../../../chunk-O6YQ3JAH.js";
|
|
7
7
|
import "../../../chunk-GFRAOY75.js";
|
|
8
8
|
import "../../../chunk-H4BYJELI.js";
|
|
9
9
|
import "../../../chunk-GZ7HCLLM.js";
|
package/dist/transport/index.cjs
CHANGED
|
@@ -23,7 +23,7 @@ __export(transport_exports, {
|
|
|
23
23
|
ClientTransport: () => ClientTransport,
|
|
24
24
|
Connection: () => Connection,
|
|
25
25
|
OpaqueTransportMessageSchema: () => OpaqueTransportMessageSchema,
|
|
26
|
-
|
|
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
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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-
|
|
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-
|
|
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';
|
package/dist/transport/index.js
CHANGED
|
@@ -2,11 +2,11 @@ import "../chunk-RPIDSIQG.js";
|
|
|
2
2
|
import {
|
|
3
3
|
ClientTransport,
|
|
4
4
|
Connection,
|
|
5
|
-
|
|
5
|
+
ProtocolError,
|
|
6
6
|
ServerTransport,
|
|
7
7
|
Session,
|
|
8
8
|
Transport
|
|
9
|
-
} from "../chunk-
|
|
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
|
-
|
|
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-
|
|
5
|
-
import { P as PayloadType, R as RiverError, a as Procedure, S as ServiceContext, b as Result, c as RiverUncaughtSchema } from '../builder-
|
|
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-
|
|
5
|
-
import { P as PayloadType, R as RiverError, a as Procedure, S as ServiceContext, b as Result, c as RiverUncaughtSchema } from '../builder-
|
|
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';
|
package/dist/util/testHelpers.js
CHANGED
package/package.json
CHANGED