@replit/river 0.14.1 → 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-dfe46874.d.ts → builder-660d3140.d.ts} +1 -1
- package/dist/{chunk-WYUFVZC3.js → chunk-5TX4BKAD.js} +1 -1
- package/dist/{chunk-ZD5NJJXR.js → chunk-MNWOTQWX.js} +1 -1
- package/dist/{chunk-NJ25LQPI.js → chunk-O6YQ3JAH.js} +41 -4
- package/dist/{connection-6c569569.d.ts → connection-162c0f7b.d.ts} +1 -1
- package/dist/{connection-ec72fdb0.d.ts → connection-93daccc3.d.ts} +1 -1
- package/dist/{index-d1452d8f.d.ts → index-76b801f8.d.ts} +12 -1
- package/dist/router/index.d.cts +3 -3
- package/dist/router/index.d.ts +3 -3
- package/dist/transport/impls/uds/client.cjs +26 -3
- 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 +24 -2
- 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 +26 -3
- 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 +24 -2
- 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 +42 -4
- package/dist/transport/index.d.cts +1 -1
- package/dist/transport/index.d.ts +1 -1
- package/dist/transport/index.js +4 -2
- package/dist/util/testHelpers.cjs +1 -0
- package/dist/util/testHelpers.d.cts +2 -2
- package/dist/util/testHelpers.d.ts +2 -2
- package/dist/util/testHelpers.js +3 -2
- package/package.json +1 -1
- /package/dist/{chunk-5IZ2UHWV.js → chunk-RPIDSIQG.js} +0 -0
|
@@ -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,6 +16,11 @@ import {
|
|
|
16
16
|
} from "./chunk-GZ7HCLLM.js";
|
|
17
17
|
|
|
18
18
|
// transport/events.ts
|
|
19
|
+
var ProtocolError = {
|
|
20
|
+
RetriesExceeded: "conn_retry_exceeded",
|
|
21
|
+
HandshakeFailed: "handshake_failed",
|
|
22
|
+
UseAfterDestroy: "use_after_destroy"
|
|
23
|
+
};
|
|
19
24
|
var EventDispatcher = class {
|
|
20
25
|
eventListeners = {};
|
|
21
26
|
numberOfListeners(eventType) {
|
|
@@ -469,7 +474,8 @@ var Transport = class {
|
|
|
469
474
|
if (this.state === "destroyed") {
|
|
470
475
|
const err = "transport is destroyed, cant send";
|
|
471
476
|
log?.error(`${this.clientId} -- ` + err + `: ${JSON.stringify(msg)}`);
|
|
472
|
-
|
|
477
|
+
this.protocolError(ProtocolError.UseAfterDestroy, err);
|
|
478
|
+
return void 0;
|
|
473
479
|
} else if (this.state === "closed") {
|
|
474
480
|
log?.info(
|
|
475
481
|
`${this.clientId} -- transport closed when sending, discarding : ${JSON.stringify(
|
|
@@ -497,6 +503,9 @@ var Transport = class {
|
|
|
497
503
|
}
|
|
498
504
|
});
|
|
499
505
|
}
|
|
506
|
+
protocolError(type, message) {
|
|
507
|
+
this.eventDispatcher.dispatchEvent("protocolError", { type, message });
|
|
508
|
+
}
|
|
500
509
|
/**
|
|
501
510
|
* Default close implementation for transports. You should override this in the downstream
|
|
502
511
|
* implementation if you need to do any additional cleanup and call super.close() at the end.
|
|
@@ -573,14 +582,23 @@ var ClientTransport = class extends Transport {
|
|
|
573
582
|
}
|
|
574
583
|
receiveHandshakeResponseMessage(data) {
|
|
575
584
|
const parsed = this.parseMsg(data);
|
|
576
|
-
if (!parsed)
|
|
585
|
+
if (!parsed) {
|
|
586
|
+
this.protocolError(
|
|
587
|
+
ProtocolError.HandshakeFailed,
|
|
588
|
+
"received non-transport message"
|
|
589
|
+
);
|
|
577
590
|
return false;
|
|
591
|
+
}
|
|
578
592
|
if (!Value.Check(ControlMessageHandshakeResponseSchema, parsed.payload)) {
|
|
579
593
|
log?.warn(
|
|
580
594
|
`${this.clientId} -- received invalid handshake resp: ${JSON.stringify(
|
|
581
595
|
parsed
|
|
582
596
|
)}`
|
|
583
597
|
);
|
|
598
|
+
this.protocolError(
|
|
599
|
+
ProtocolError.HandshakeFailed,
|
|
600
|
+
"invalid handshake resp"
|
|
601
|
+
);
|
|
584
602
|
return false;
|
|
585
603
|
}
|
|
586
604
|
if (!parsed.payload.status.ok) {
|
|
@@ -589,6 +607,10 @@ var ClientTransport = class extends Transport {
|
|
|
589
607
|
parsed
|
|
590
608
|
)}`
|
|
591
609
|
);
|
|
610
|
+
this.protocolError(
|
|
611
|
+
ProtocolError.HandshakeFailed,
|
|
612
|
+
parsed.payload.status.reason
|
|
613
|
+
);
|
|
592
614
|
return false;
|
|
593
615
|
}
|
|
594
616
|
const instanceId = parsed.payload.status.instanceId;
|
|
@@ -627,7 +649,8 @@ var ClientTransport = class extends Transport {
|
|
|
627
649
|
if (attempt >= this.options.retryAttemptsMax) {
|
|
628
650
|
const errMsg = `connection to ${to} failed after ${attempt} attempts (${errStr}), giving up`;
|
|
629
651
|
log?.error(`${this.clientId} -- ${errMsg}`);
|
|
630
|
-
|
|
652
|
+
this.protocolError(ProtocolError.RetriesExceeded, errMsg);
|
|
653
|
+
return;
|
|
631
654
|
} else {
|
|
632
655
|
const jitter = Math.floor(Math.random() * this.options.retryJitterMs);
|
|
633
656
|
const backoffMs = this.options.retryIntervalMs * 2 ** attempt + jitter;
|
|
@@ -703,8 +726,13 @@ var ServerTransport = class extends Transport {
|
|
|
703
726
|
}
|
|
704
727
|
receiveHandshakeRequestMessage(data, conn) {
|
|
705
728
|
const parsed = this.parseMsg(data);
|
|
706
|
-
if (!parsed)
|
|
729
|
+
if (!parsed) {
|
|
730
|
+
this.protocolError(
|
|
731
|
+
ProtocolError.HandshakeFailed,
|
|
732
|
+
"received non-transport message"
|
|
733
|
+
);
|
|
707
734
|
return false;
|
|
735
|
+
}
|
|
708
736
|
if (!Value.Check(ControlMessageHandshakeRequestSchema, parsed.payload)) {
|
|
709
737
|
const responseMsg2 = handshakeResponseMessage(
|
|
710
738
|
this.clientId,
|
|
@@ -718,6 +746,10 @@ var ServerTransport = class extends Transport {
|
|
|
718
746
|
parsed
|
|
719
747
|
)}`
|
|
720
748
|
);
|
|
749
|
+
this.protocolError(
|
|
750
|
+
ProtocolError.HandshakeFailed,
|
|
751
|
+
"invalid handshake request"
|
|
752
|
+
);
|
|
721
753
|
return false;
|
|
722
754
|
}
|
|
723
755
|
const gotVersion = parsed.payload.protocolVersion;
|
|
@@ -732,6 +764,10 @@ var ServerTransport = class extends Transport {
|
|
|
732
764
|
log?.warn(
|
|
733
765
|
`${this.clientId} -- received handshake msg with incompatible protocol version (got: ${gotVersion}, expected: ${PROTOCOL_VERSION})`
|
|
734
766
|
);
|
|
767
|
+
this.protocolError(
|
|
768
|
+
ProtocolError.HandshakeFailed,
|
|
769
|
+
`incorrect version (got: ${gotVersion} wanted ${PROTOCOL_VERSION})`
|
|
770
|
+
);
|
|
735
771
|
return false;
|
|
736
772
|
}
|
|
737
773
|
const instanceId = parsed.payload.instanceId;
|
|
@@ -750,6 +786,7 @@ var ServerTransport = class extends Transport {
|
|
|
750
786
|
};
|
|
751
787
|
|
|
752
788
|
export {
|
|
789
|
+
ProtocolError,
|
|
753
790
|
Connection,
|
|
754
791
|
defaultSessionOptions,
|
|
755
792
|
Session,
|
|
@@ -205,6 +205,12 @@ declare class Session<ConnType extends Connection> {
|
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
type ConnectionStatus = 'connect' | 'disconnect';
|
|
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];
|
|
208
214
|
interface EventMap {
|
|
209
215
|
message: OpaqueTransportMessage;
|
|
210
216
|
connectionStatus: {
|
|
@@ -215,6 +221,10 @@ interface EventMap {
|
|
|
215
221
|
status: ConnectionStatus;
|
|
216
222
|
session: Session<Connection>;
|
|
217
223
|
};
|
|
224
|
+
protocolError: {
|
|
225
|
+
type: ProtocolErrorType;
|
|
226
|
+
message: string;
|
|
227
|
+
};
|
|
218
228
|
}
|
|
219
229
|
type EventTypes = keyof EventMap;
|
|
220
230
|
type EventHandler<K extends EventTypes> = (event: EventMap[K]) => unknown;
|
|
@@ -367,6 +377,7 @@ declare abstract class Transport<ConnType extends Connection> {
|
|
|
367
377
|
*/
|
|
368
378
|
send(to: TransportClientId, msg: PartialTransportMessage): string | undefined;
|
|
369
379
|
sendCloseStream(to: TransportClientId, streamId: string): string | undefined;
|
|
380
|
+
protected protocolError(type: ProtocolErrorType, message: string): void;
|
|
370
381
|
/**
|
|
371
382
|
* Default close implementation for transports. You should override this in the downstream
|
|
372
383
|
* implementation if you need to do any additional cleanup and call super.close() at the end.
|
|
@@ -418,4 +429,4 @@ declare abstract class ServerTransport<ConnType extends Connection> extends Tran
|
|
|
418
429
|
};
|
|
419
430
|
}
|
|
420
431
|
|
|
421
|
-
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,8 @@ 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
|
-
|
|
718
|
+
this.protocolError(ProtocolError.UseAfterDestroy, err);
|
|
719
|
+
return void 0;
|
|
714
720
|
} else if (this.state === "closed") {
|
|
715
721
|
log?.info(
|
|
716
722
|
`${this.clientId} -- transport closed when sending, discarding : ${JSON.stringify(
|
|
@@ -738,6 +744,9 @@ var Transport = class {
|
|
|
738
744
|
}
|
|
739
745
|
});
|
|
740
746
|
}
|
|
747
|
+
protocolError(type, message) {
|
|
748
|
+
this.eventDispatcher.dispatchEvent("protocolError", { type, message });
|
|
749
|
+
}
|
|
741
750
|
/**
|
|
742
751
|
* Default close implementation for transports. You should override this in the downstream
|
|
743
752
|
* implementation if you need to do any additional cleanup and call super.close() at the end.
|
|
@@ -814,14 +823,23 @@ var ClientTransport = class extends Transport {
|
|
|
814
823
|
}
|
|
815
824
|
receiveHandshakeResponseMessage(data) {
|
|
816
825
|
const parsed = this.parseMsg(data);
|
|
817
|
-
if (!parsed)
|
|
826
|
+
if (!parsed) {
|
|
827
|
+
this.protocolError(
|
|
828
|
+
ProtocolError.HandshakeFailed,
|
|
829
|
+
"received non-transport message"
|
|
830
|
+
);
|
|
818
831
|
return false;
|
|
832
|
+
}
|
|
819
833
|
if (!import_value.Value.Check(ControlMessageHandshakeResponseSchema, parsed.payload)) {
|
|
820
834
|
log?.warn(
|
|
821
835
|
`${this.clientId} -- received invalid handshake resp: ${JSON.stringify(
|
|
822
836
|
parsed
|
|
823
837
|
)}`
|
|
824
838
|
);
|
|
839
|
+
this.protocolError(
|
|
840
|
+
ProtocolError.HandshakeFailed,
|
|
841
|
+
"invalid handshake resp"
|
|
842
|
+
);
|
|
825
843
|
return false;
|
|
826
844
|
}
|
|
827
845
|
if (!parsed.payload.status.ok) {
|
|
@@ -830,6 +848,10 @@ var ClientTransport = class extends Transport {
|
|
|
830
848
|
parsed
|
|
831
849
|
)}`
|
|
832
850
|
);
|
|
851
|
+
this.protocolError(
|
|
852
|
+
ProtocolError.HandshakeFailed,
|
|
853
|
+
parsed.payload.status.reason
|
|
854
|
+
);
|
|
833
855
|
return false;
|
|
834
856
|
}
|
|
835
857
|
const instanceId = parsed.payload.status.instanceId;
|
|
@@ -868,7 +890,8 @@ var ClientTransport = class extends Transport {
|
|
|
868
890
|
if (attempt >= this.options.retryAttemptsMax) {
|
|
869
891
|
const errMsg = `connection to ${to} failed after ${attempt} attempts (${errStr}), giving up`;
|
|
870
892
|
log?.error(`${this.clientId} -- ${errMsg}`);
|
|
871
|
-
|
|
893
|
+
this.protocolError(ProtocolError.RetriesExceeded, errMsg);
|
|
894
|
+
return;
|
|
872
895
|
} else {
|
|
873
896
|
const jitter = Math.floor(Math.random() * this.options.retryJitterMs);
|
|
874
897
|
const backoffMs = this.options.retryIntervalMs * 2 ** attempt + jitter;
|
|
@@ -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,8 @@ 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
|
-
|
|
632
|
+
this.protocolError(ProtocolError.UseAfterDestroy, err);
|
|
633
|
+
return void 0;
|
|
628
634
|
} else if (this.state === "closed") {
|
|
629
635
|
log?.info(
|
|
630
636
|
`${this.clientId} -- transport closed when sending, discarding : ${JSON.stringify(
|
|
@@ -652,6 +658,9 @@ var Transport = class {
|
|
|
652
658
|
}
|
|
653
659
|
});
|
|
654
660
|
}
|
|
661
|
+
protocolError(type, message) {
|
|
662
|
+
this.eventDispatcher.dispatchEvent("protocolError", { type, message });
|
|
663
|
+
}
|
|
655
664
|
/**
|
|
656
665
|
* Default close implementation for transports. You should override this in the downstream
|
|
657
666
|
* implementation if you need to do any additional cleanup and call super.close() at the end.
|
|
@@ -730,8 +739,13 @@ var ServerTransport = class extends Transport {
|
|
|
730
739
|
}
|
|
731
740
|
receiveHandshakeRequestMessage(data, conn) {
|
|
732
741
|
const parsed = this.parseMsg(data);
|
|
733
|
-
if (!parsed)
|
|
742
|
+
if (!parsed) {
|
|
743
|
+
this.protocolError(
|
|
744
|
+
ProtocolError.HandshakeFailed,
|
|
745
|
+
"received non-transport message"
|
|
746
|
+
);
|
|
734
747
|
return false;
|
|
748
|
+
}
|
|
735
749
|
if (!import_value.Value.Check(ControlMessageHandshakeRequestSchema, parsed.payload)) {
|
|
736
750
|
const responseMsg2 = handshakeResponseMessage(
|
|
737
751
|
this.clientId,
|
|
@@ -745,6 +759,10 @@ var ServerTransport = class extends Transport {
|
|
|
745
759
|
parsed
|
|
746
760
|
)}`
|
|
747
761
|
);
|
|
762
|
+
this.protocolError(
|
|
763
|
+
ProtocolError.HandshakeFailed,
|
|
764
|
+
"invalid handshake request"
|
|
765
|
+
);
|
|
748
766
|
return false;
|
|
749
767
|
}
|
|
750
768
|
const gotVersion = parsed.payload.protocolVersion;
|
|
@@ -759,6 +777,10 @@ var ServerTransport = class extends Transport {
|
|
|
759
777
|
log?.warn(
|
|
760
778
|
`${this.clientId} -- received handshake msg with incompatible protocol version (got: ${gotVersion}, expected: ${PROTOCOL_VERSION})`
|
|
761
779
|
);
|
|
780
|
+
this.protocolError(
|
|
781
|
+
ProtocolError.HandshakeFailed,
|
|
782
|
+
`incorrect version (got: ${gotVersion} wanted ${PROTOCOL_VERSION})`
|
|
783
|
+
);
|
|
762
784
|
return false;
|
|
763
785
|
}
|
|
764
786
|
const instanceId = parsed.payload.instanceId;
|
|
@@ -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,8 @@ 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
|
-
|
|
624
|
+
this.protocolError(ProtocolError.UseAfterDestroy, err);
|
|
625
|
+
return void 0;
|
|
620
626
|
} else if (this.state === "closed") {
|
|
621
627
|
log?.info(
|
|
622
628
|
`${this.clientId} -- transport closed when sending, discarding : ${JSON.stringify(
|
|
@@ -644,6 +650,9 @@ var Transport = class {
|
|
|
644
650
|
}
|
|
645
651
|
});
|
|
646
652
|
}
|
|
653
|
+
protocolError(type, message) {
|
|
654
|
+
this.eventDispatcher.dispatchEvent("protocolError", { type, message });
|
|
655
|
+
}
|
|
647
656
|
/**
|
|
648
657
|
* Default close implementation for transports. You should override this in the downstream
|
|
649
658
|
* implementation if you need to do any additional cleanup and call super.close() at the end.
|
|
@@ -720,14 +729,23 @@ var ClientTransport = class extends Transport {
|
|
|
720
729
|
}
|
|
721
730
|
receiveHandshakeResponseMessage(data) {
|
|
722
731
|
const parsed = this.parseMsg(data);
|
|
723
|
-
if (!parsed)
|
|
732
|
+
if (!parsed) {
|
|
733
|
+
this.protocolError(
|
|
734
|
+
ProtocolError.HandshakeFailed,
|
|
735
|
+
"received non-transport message"
|
|
736
|
+
);
|
|
724
737
|
return false;
|
|
738
|
+
}
|
|
725
739
|
if (!import_value.Value.Check(ControlMessageHandshakeResponseSchema, parsed.payload)) {
|
|
726
740
|
log?.warn(
|
|
727
741
|
`${this.clientId} -- received invalid handshake resp: ${JSON.stringify(
|
|
728
742
|
parsed
|
|
729
743
|
)}`
|
|
730
744
|
);
|
|
745
|
+
this.protocolError(
|
|
746
|
+
ProtocolError.HandshakeFailed,
|
|
747
|
+
"invalid handshake resp"
|
|
748
|
+
);
|
|
731
749
|
return false;
|
|
732
750
|
}
|
|
733
751
|
if (!parsed.payload.status.ok) {
|
|
@@ -736,6 +754,10 @@ var ClientTransport = class extends Transport {
|
|
|
736
754
|
parsed
|
|
737
755
|
)}`
|
|
738
756
|
);
|
|
757
|
+
this.protocolError(
|
|
758
|
+
ProtocolError.HandshakeFailed,
|
|
759
|
+
parsed.payload.status.reason
|
|
760
|
+
);
|
|
739
761
|
return false;
|
|
740
762
|
}
|
|
741
763
|
const instanceId = parsed.payload.status.instanceId;
|
|
@@ -774,7 +796,8 @@ var ClientTransport = class extends Transport {
|
|
|
774
796
|
if (attempt >= this.options.retryAttemptsMax) {
|
|
775
797
|
const errMsg = `connection to ${to} failed after ${attempt} attempts (${errStr}), giving up`;
|
|
776
798
|
log?.error(`${this.clientId} -- ${errMsg}`);
|
|
777
|
-
|
|
799
|
+
this.protocolError(ProtocolError.RetriesExceeded, errMsg);
|
|
800
|
+
return;
|
|
778
801
|
} else {
|
|
779
802
|
const jitter = Math.floor(Math.random() * this.options.retryJitterMs);
|
|
780
803
|
const backoffMs = this.options.retryIntervalMs * 2 ** attempt + jitter;
|
|
@@ -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,8 @@ 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
|
-
|
|
632
|
+
this.protocolError(ProtocolError.UseAfterDestroy, err);
|
|
633
|
+
return void 0;
|
|
628
634
|
} else if (this.state === "closed") {
|
|
629
635
|
log?.info(
|
|
630
636
|
`${this.clientId} -- transport closed when sending, discarding : ${JSON.stringify(
|
|
@@ -652,6 +658,9 @@ var Transport = class {
|
|
|
652
658
|
}
|
|
653
659
|
});
|
|
654
660
|
}
|
|
661
|
+
protocolError(type, message) {
|
|
662
|
+
this.eventDispatcher.dispatchEvent("protocolError", { type, message });
|
|
663
|
+
}
|
|
655
664
|
/**
|
|
656
665
|
* Default close implementation for transports. You should override this in the downstream
|
|
657
666
|
* implementation if you need to do any additional cleanup and call super.close() at the end.
|
|
@@ -730,8 +739,13 @@ var ServerTransport = class extends Transport {
|
|
|
730
739
|
}
|
|
731
740
|
receiveHandshakeRequestMessage(data, conn) {
|
|
732
741
|
const parsed = this.parseMsg(data);
|
|
733
|
-
if (!parsed)
|
|
742
|
+
if (!parsed) {
|
|
743
|
+
this.protocolError(
|
|
744
|
+
ProtocolError.HandshakeFailed,
|
|
745
|
+
"received non-transport message"
|
|
746
|
+
);
|
|
734
747
|
return false;
|
|
748
|
+
}
|
|
735
749
|
if (!import_value.Value.Check(ControlMessageHandshakeRequestSchema, parsed.payload)) {
|
|
736
750
|
const responseMsg2 = handshakeResponseMessage(
|
|
737
751
|
this.clientId,
|
|
@@ -745,6 +759,10 @@ var ServerTransport = class extends Transport {
|
|
|
745
759
|
parsed
|
|
746
760
|
)}`
|
|
747
761
|
);
|
|
762
|
+
this.protocolError(
|
|
763
|
+
ProtocolError.HandshakeFailed,
|
|
764
|
+
"invalid handshake request"
|
|
765
|
+
);
|
|
748
766
|
return false;
|
|
749
767
|
}
|
|
750
768
|
const gotVersion = parsed.payload.protocolVersion;
|
|
@@ -759,6 +777,10 @@ var ServerTransport = class extends Transport {
|
|
|
759
777
|
log?.warn(
|
|
760
778
|
`${this.clientId} -- received handshake msg with incompatible protocol version (got: ${gotVersion}, expected: ${PROTOCOL_VERSION})`
|
|
761
779
|
);
|
|
780
|
+
this.protocolError(
|
|
781
|
+
ProtocolError.HandshakeFailed,
|
|
782
|
+
`incorrect version (got: ${gotVersion} wanted ${PROTOCOL_VERSION})`
|
|
783
|
+
);
|
|
762
784
|
return false;
|
|
763
785
|
}
|
|
764
786
|
const instanceId = parsed.payload.instanceId;
|
|
@@ -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,6 +23,7 @@ __export(transport_exports, {
|
|
|
23
23
|
ClientTransport: () => ClientTransport,
|
|
24
24
|
Connection: () => Connection,
|
|
25
25
|
OpaqueTransportMessageSchema: () => OpaqueTransportMessageSchema,
|
|
26
|
+
ProtocolError: () => ProtocolError,
|
|
26
27
|
ServerTransport: () => ServerTransport,
|
|
27
28
|
Session: () => Session,
|
|
28
29
|
Transport: () => Transport,
|
|
@@ -130,6 +131,11 @@ function isAck(controlFlag) {
|
|
|
130
131
|
var log;
|
|
131
132
|
|
|
132
133
|
// transport/events.ts
|
|
134
|
+
var ProtocolError = {
|
|
135
|
+
RetriesExceeded: "conn_retry_exceeded",
|
|
136
|
+
HandshakeFailed: "handshake_failed",
|
|
137
|
+
UseAfterDestroy: "use_after_destroy"
|
|
138
|
+
};
|
|
133
139
|
var EventDispatcher = class {
|
|
134
140
|
eventListeners = {};
|
|
135
141
|
numberOfListeners(eventType) {
|
|
@@ -646,7 +652,8 @@ var Transport = class {
|
|
|
646
652
|
if (this.state === "destroyed") {
|
|
647
653
|
const err = "transport is destroyed, cant send";
|
|
648
654
|
log?.error(`${this.clientId} -- ` + err + `: ${JSON.stringify(msg)}`);
|
|
649
|
-
|
|
655
|
+
this.protocolError(ProtocolError.UseAfterDestroy, err);
|
|
656
|
+
return void 0;
|
|
650
657
|
} else if (this.state === "closed") {
|
|
651
658
|
log?.info(
|
|
652
659
|
`${this.clientId} -- transport closed when sending, discarding : ${JSON.stringify(
|
|
@@ -674,6 +681,9 @@ var Transport = class {
|
|
|
674
681
|
}
|
|
675
682
|
});
|
|
676
683
|
}
|
|
684
|
+
protocolError(type, message) {
|
|
685
|
+
this.eventDispatcher.dispatchEvent("protocolError", { type, message });
|
|
686
|
+
}
|
|
677
687
|
/**
|
|
678
688
|
* Default close implementation for transports. You should override this in the downstream
|
|
679
689
|
* implementation if you need to do any additional cleanup and call super.close() at the end.
|
|
@@ -750,14 +760,23 @@ var ClientTransport = class extends Transport {
|
|
|
750
760
|
}
|
|
751
761
|
receiveHandshakeResponseMessage(data) {
|
|
752
762
|
const parsed = this.parseMsg(data);
|
|
753
|
-
if (!parsed)
|
|
763
|
+
if (!parsed) {
|
|
764
|
+
this.protocolError(
|
|
765
|
+
ProtocolError.HandshakeFailed,
|
|
766
|
+
"received non-transport message"
|
|
767
|
+
);
|
|
754
768
|
return false;
|
|
769
|
+
}
|
|
755
770
|
if (!import_value.Value.Check(ControlMessageHandshakeResponseSchema, parsed.payload)) {
|
|
756
771
|
log?.warn(
|
|
757
772
|
`${this.clientId} -- received invalid handshake resp: ${JSON.stringify(
|
|
758
773
|
parsed
|
|
759
774
|
)}`
|
|
760
775
|
);
|
|
776
|
+
this.protocolError(
|
|
777
|
+
ProtocolError.HandshakeFailed,
|
|
778
|
+
"invalid handshake resp"
|
|
779
|
+
);
|
|
761
780
|
return false;
|
|
762
781
|
}
|
|
763
782
|
if (!parsed.payload.status.ok) {
|
|
@@ -766,6 +785,10 @@ var ClientTransport = class extends Transport {
|
|
|
766
785
|
parsed
|
|
767
786
|
)}`
|
|
768
787
|
);
|
|
788
|
+
this.protocolError(
|
|
789
|
+
ProtocolError.HandshakeFailed,
|
|
790
|
+
parsed.payload.status.reason
|
|
791
|
+
);
|
|
769
792
|
return false;
|
|
770
793
|
}
|
|
771
794
|
const instanceId = parsed.payload.status.instanceId;
|
|
@@ -804,7 +827,8 @@ var ClientTransport = class extends Transport {
|
|
|
804
827
|
if (attempt >= this.options.retryAttemptsMax) {
|
|
805
828
|
const errMsg = `connection to ${to} failed after ${attempt} attempts (${errStr}), giving up`;
|
|
806
829
|
log?.error(`${this.clientId} -- ${errMsg}`);
|
|
807
|
-
|
|
830
|
+
this.protocolError(ProtocolError.RetriesExceeded, errMsg);
|
|
831
|
+
return;
|
|
808
832
|
} else {
|
|
809
833
|
const jitter = Math.floor(Math.random() * this.options.retryJitterMs);
|
|
810
834
|
const backoffMs = this.options.retryIntervalMs * 2 ** attempt + jitter;
|
|
@@ -880,8 +904,13 @@ var ServerTransport = class extends Transport {
|
|
|
880
904
|
}
|
|
881
905
|
receiveHandshakeRequestMessage(data, conn) {
|
|
882
906
|
const parsed = this.parseMsg(data);
|
|
883
|
-
if (!parsed)
|
|
907
|
+
if (!parsed) {
|
|
908
|
+
this.protocolError(
|
|
909
|
+
ProtocolError.HandshakeFailed,
|
|
910
|
+
"received non-transport message"
|
|
911
|
+
);
|
|
884
912
|
return false;
|
|
913
|
+
}
|
|
885
914
|
if (!import_value.Value.Check(ControlMessageHandshakeRequestSchema, parsed.payload)) {
|
|
886
915
|
const responseMsg2 = handshakeResponseMessage(
|
|
887
916
|
this.clientId,
|
|
@@ -895,6 +924,10 @@ var ServerTransport = class extends Transport {
|
|
|
895
924
|
parsed
|
|
896
925
|
)}`
|
|
897
926
|
);
|
|
927
|
+
this.protocolError(
|
|
928
|
+
ProtocolError.HandshakeFailed,
|
|
929
|
+
"invalid handshake request"
|
|
930
|
+
);
|
|
898
931
|
return false;
|
|
899
932
|
}
|
|
900
933
|
const gotVersion = parsed.payload.protocolVersion;
|
|
@@ -909,6 +942,10 @@ var ServerTransport = class extends Transport {
|
|
|
909
942
|
log?.warn(
|
|
910
943
|
`${this.clientId} -- received handshake msg with incompatible protocol version (got: ${gotVersion}, expected: ${PROTOCOL_VERSION})`
|
|
911
944
|
);
|
|
945
|
+
this.protocolError(
|
|
946
|
+
ProtocolError.HandshakeFailed,
|
|
947
|
+
`incorrect version (got: ${gotVersion} wanted ${PROTOCOL_VERSION})`
|
|
948
|
+
);
|
|
912
949
|
return false;
|
|
913
950
|
}
|
|
914
951
|
const instanceId = parsed.payload.instanceId;
|
|
@@ -930,6 +967,7 @@ var ServerTransport = class extends Transport {
|
|
|
930
967
|
ClientTransport,
|
|
931
968
|
Connection,
|
|
932
969
|
OpaqueTransportMessageSchema,
|
|
970
|
+
ProtocolError,
|
|
933
971
|
ServerTransport,
|
|
934
972
|
Session,
|
|
935
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, 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, 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
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-RPIDSIQG.js";
|
|
2
2
|
import {
|
|
3
3
|
ClientTransport,
|
|
4
4
|
Connection,
|
|
5
|
+
ProtocolError,
|
|
5
6
|
ServerTransport,
|
|
6
7
|
Session,
|
|
7
8
|
Transport
|
|
8
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-O6YQ3JAH.js";
|
|
9
10
|
import {
|
|
10
11
|
OpaqueTransportMessageSchema,
|
|
11
12
|
TransportMessageSchema
|
|
@@ -16,6 +17,7 @@ export {
|
|
|
16
17
|
ClientTransport,
|
|
17
18
|
Connection,
|
|
18
19
|
OpaqueTransportMessageSchema,
|
|
20
|
+
ProtocolError,
|
|
19
21
|
ServerTransport,
|
|
20
22
|
Session,
|
|
21
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
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
UNCAUGHT_ERROR,
|
|
3
3
|
pushable
|
|
4
4
|
} from "../chunk-KWXQLQAF.js";
|
|
5
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-RPIDSIQG.js";
|
|
6
6
|
import {
|
|
7
7
|
Session,
|
|
8
8
|
defaultSessionOptions
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-O6YQ3JAH.js";
|
|
10
10
|
import {
|
|
11
11
|
coerceErrorString
|
|
12
12
|
} from "../chunk-GFRAOY75.js";
|
|
@@ -68,6 +68,7 @@ async function waitForMessage(t, filter, rejectMismatch) {
|
|
|
68
68
|
cleanup();
|
|
69
69
|
resolve(msg.payload);
|
|
70
70
|
} else if (rejectMismatch) {
|
|
71
|
+
cleanup();
|
|
71
72
|
reject(new Error("message didnt match the filter"));
|
|
72
73
|
}
|
|
73
74
|
}
|
package/package.json
CHANGED
|
File without changes
|