@replit/river 0.207.3 → 0.208.0
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/{adapter-f2b6e211.d.ts → adapter-ChksXKVN.d.ts} +2 -2
- package/dist/adapter-Cuc4JtfV.d.cts +46 -0
- package/dist/{chunk-BO7MFCO6.js → chunk-2JNVDUMN.js} +55 -97
- package/dist/chunk-2JNVDUMN.js.map +1 -0
- package/dist/{chunk-B7REV3ZV.js → chunk-DKW3GC3M.js} +2 -2
- package/dist/{chunk-QGPYCXV4.js → chunk-ETZAHFGQ.js} +80 -61
- package/dist/chunk-ETZAHFGQ.js.map +1 -0
- package/dist/codec/index.d.cts +3 -3
- package/dist/codec/index.d.ts +3 -3
- package/dist/codec/index.js +2 -2
- package/dist/connection-BF4zg6Qv.d.cts +35 -0
- package/dist/{connection-06d72f2e.d.ts → connection-Donr3JRB.d.ts} +4 -4
- package/dist/index-C9tpZjBN.d.cts +37 -0
- package/dist/{index-02554794.d.ts → index-D8IOd3LG.d.ts} +2 -2
- package/dist/logging/index.d.cts +2 -2
- package/dist/logging/index.d.ts +2 -2
- package/dist/{message-01c3e85a.d.ts → message-Di94OL80.d.cts} +1 -1
- package/dist/message-Di94OL80.d.ts +108 -0
- package/dist/router/index.cjs +62 -43
- package/dist/router/index.cjs.map +1 -1
- package/dist/router/index.d.cts +27 -8
- package/dist/router/index.d.ts +27 -8
- package/dist/router/index.js +1 -1
- package/dist/testUtil/index.cjs +56 -105
- package/dist/testUtil/index.cjs.map +1 -1
- package/dist/testUtil/index.d.cts +5 -5
- package/dist/testUtil/index.d.ts +5 -5
- package/dist/testUtil/index.js +7 -14
- package/dist/testUtil/index.js.map +1 -1
- package/dist/transport/impls/ws/client.cjs +51 -80
- package/dist/transport/impls/ws/client.cjs.map +1 -1
- package/dist/transport/impls/ws/client.d.cts +6 -6
- package/dist/transport/impls/ws/client.d.ts +6 -6
- package/dist/transport/impls/ws/client.js +3 -3
- package/dist/transport/impls/ws/server.cjs +52 -85
- package/dist/transport/impls/ws/server.cjs.map +1 -1
- package/dist/transport/impls/ws/server.d.cts +6 -6
- package/dist/transport/impls/ws/server.d.ts +6 -6
- package/dist/transport/impls/ws/server.js +3 -3
- package/dist/transport/index.cjs +52 -94
- package/dist/transport/index.cjs.map +1 -1
- package/dist/transport/index.d.cts +6 -6
- package/dist/transport/index.d.ts +6 -6
- package/dist/transport/index.js +3 -3
- package/dist/transport-CCaWx1Rb.d.cts +1566 -0
- package/dist/{services-87887bc5.d.ts → transport-CZb3vdB4.d.ts} +344 -347
- package/dist/{wslike-e0b32dd5.d.ts → wslike-Dng9H1C7.d.cts} +1 -1
- package/dist/wslike-Dng9H1C7.d.ts +40 -0
- package/package.json +3 -3
- package/dist/chunk-BO7MFCO6.js.map +0 -1
- package/dist/chunk-QGPYCXV4.js.map +0 -1
- /package/dist/{chunk-B7REV3ZV.js.map → chunk-DKW3GC3M.js.map} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { C as ClientTransport, P as ProvidedClientTransportOptions } from '../../../
|
|
2
|
-
import { T as TransportClientId } from '../../../message-
|
|
3
|
-
import { W as WebSocketConnection } from '../../../connection-
|
|
4
|
-
import { W as WsLike } from '../../../wslike-
|
|
1
|
+
import { C as ClientTransport, P as ProvidedClientTransportOptions } from '../../../transport-CCaWx1Rb.cjs';
|
|
2
|
+
import { T as TransportClientId } from '../../../message-Di94OL80.cjs';
|
|
3
|
+
import { W as WebSocketConnection } from '../../../connection-BF4zg6Qv.cjs';
|
|
4
|
+
import { W as WsLike } from '../../../wslike-Dng9H1C7.cjs';
|
|
5
5
|
import '@sinclair/typebox';
|
|
6
6
|
import '@opentelemetry/api';
|
|
7
|
-
import '../../../index-
|
|
8
|
-
import '../../../adapter-
|
|
7
|
+
import '../../../index-C9tpZjBN.cjs';
|
|
8
|
+
import '../../../adapter-Cuc4JtfV.cjs';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* A transport implementation that uses a WebSocket connection with automatic reconnection.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { C as ClientTransport, P as ProvidedClientTransportOptions } from '../../../
|
|
2
|
-
import { T as TransportClientId } from '../../../message-
|
|
3
|
-
import { W as WebSocketConnection } from '../../../connection-
|
|
4
|
-
import { W as WsLike } from '../../../wslike-
|
|
1
|
+
import { C as ClientTransport, P as ProvidedClientTransportOptions } from '../../../transport-CZb3vdB4.js';
|
|
2
|
+
import { T as TransportClientId } from '../../../message-Di94OL80.js';
|
|
3
|
+
import { W as WebSocketConnection } from '../../../connection-Donr3JRB.js';
|
|
4
|
+
import { W as WsLike } from '../../../wslike-Dng9H1C7.js';
|
|
5
5
|
import '@sinclair/typebox';
|
|
6
6
|
import '@opentelemetry/api';
|
|
7
|
-
import '../../../index-
|
|
8
|
-
import '../../../adapter-
|
|
7
|
+
import '../../../index-D8IOd3LG.js';
|
|
8
|
+
import '../../../adapter-ChksXKVN.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* A transport implementation that uses a WebSocket connection with automatic reconnection.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WebSocketConnection
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-DKW3GC3M.js";
|
|
4
4
|
import {
|
|
5
5
|
ClientTransport
|
|
6
|
-
} from "../../../chunk-
|
|
7
|
-
import "../../../chunk-QGPYCXV4.js";
|
|
6
|
+
} from "../../../chunk-2JNVDUMN.js";
|
|
8
7
|
import "../../../chunk-CC7RN7GI.js";
|
|
8
|
+
import "../../../chunk-ETZAHFGQ.js";
|
|
9
9
|
|
|
10
10
|
// transport/impls/ws/client.ts
|
|
11
11
|
var WebSocketClientTransport = class extends ClientTransport {
|
|
@@ -49,60 +49,44 @@ var Connection = class {
|
|
|
49
49
|
}
|
|
50
50
|
return metadata;
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
_errorListeners = /* @__PURE__ */ new Set();
|
|
56
|
-
get dataListeners() {
|
|
57
|
-
return [...this._dataListeners];
|
|
58
|
-
}
|
|
59
|
-
get closeListeners() {
|
|
60
|
-
return [...this._closeListeners];
|
|
61
|
-
}
|
|
62
|
-
get errorListeners() {
|
|
63
|
-
return [...this._errorListeners];
|
|
64
|
-
}
|
|
52
|
+
dataListener;
|
|
53
|
+
closeListener;
|
|
54
|
+
errorListener;
|
|
65
55
|
onData(msg) {
|
|
66
|
-
|
|
67
|
-
cb(msg);
|
|
68
|
-
}
|
|
56
|
+
this.dataListener?.(msg);
|
|
69
57
|
}
|
|
70
58
|
onError(err) {
|
|
71
|
-
|
|
72
|
-
cb(err);
|
|
73
|
-
}
|
|
59
|
+
this.errorListener?.(err);
|
|
74
60
|
}
|
|
75
61
|
onClose() {
|
|
76
|
-
|
|
77
|
-
cb();
|
|
78
|
-
}
|
|
62
|
+
this.closeListener?.();
|
|
79
63
|
this.telemetry?.span.end();
|
|
80
64
|
}
|
|
81
65
|
/**
|
|
82
|
-
*
|
|
83
|
-
* @param
|
|
66
|
+
* Set the callback for when a message is received.
|
|
67
|
+
* @param cb The message handler callback.
|
|
84
68
|
*/
|
|
85
|
-
|
|
86
|
-
this.
|
|
69
|
+
setDataListener(cb) {
|
|
70
|
+
this.dataListener = cb;
|
|
87
71
|
}
|
|
88
|
-
removeDataListener(
|
|
89
|
-
this.
|
|
72
|
+
removeDataListener() {
|
|
73
|
+
this.dataListener = void 0;
|
|
90
74
|
}
|
|
91
75
|
/**
|
|
92
|
-
*
|
|
93
|
-
* This should also be called if an error happens and after notifying
|
|
76
|
+
* Set the callback for when the connection is closed.
|
|
77
|
+
* This should also be called if an error happens and after notifying the error listener.
|
|
94
78
|
* @param cb The callback to call when the connection is closed.
|
|
95
79
|
*/
|
|
96
|
-
|
|
97
|
-
this.
|
|
80
|
+
setCloseListener(cb) {
|
|
81
|
+
this.closeListener = cb;
|
|
98
82
|
}
|
|
99
|
-
removeCloseListener(
|
|
100
|
-
this.
|
|
83
|
+
removeCloseListener() {
|
|
84
|
+
this.closeListener = void 0;
|
|
101
85
|
}
|
|
102
86
|
/**
|
|
103
|
-
*
|
|
104
|
-
* This should only be used for
|
|
105
|
-
* should be delegated to
|
|
87
|
+
* Set the callback for when an error is received.
|
|
88
|
+
* This should only be used for logging errors, all cleanup
|
|
89
|
+
* should be delegated to setCloseListener.
|
|
106
90
|
*
|
|
107
91
|
* The implementer should take care such that the implemented
|
|
108
92
|
* connection will call both the close and error callbacks
|
|
@@ -110,11 +94,11 @@ var Connection = class {
|
|
|
110
94
|
*
|
|
111
95
|
* @param cb The callback to call when an error is received.
|
|
112
96
|
*/
|
|
113
|
-
|
|
114
|
-
this.
|
|
97
|
+
setErrorListener(cb) {
|
|
98
|
+
this.errorListener = cb;
|
|
115
99
|
}
|
|
116
|
-
removeErrorListener(
|
|
117
|
-
this.
|
|
100
|
+
removeErrorListener() {
|
|
101
|
+
this.errorListener = void 0;
|
|
118
102
|
}
|
|
119
103
|
};
|
|
120
104
|
|
|
@@ -670,13 +654,11 @@ var SessionConnecting = class extends IdentifiedSessionWithGracePeriod {
|
|
|
670
654
|
this.listeners = props.listeners;
|
|
671
655
|
this.connPromise.then(
|
|
672
656
|
(conn) => {
|
|
673
|
-
if (this._isConsumed)
|
|
674
|
-
return;
|
|
657
|
+
if (this._isConsumed) return;
|
|
675
658
|
this.listeners.onConnectionEstablished(conn);
|
|
676
659
|
},
|
|
677
660
|
(err) => {
|
|
678
|
-
if (this._isConsumed)
|
|
679
|
-
return;
|
|
661
|
+
if (this._isConsumed) return;
|
|
680
662
|
this.listeners.onConnectionFailed(err);
|
|
681
663
|
}
|
|
682
664
|
);
|
|
@@ -737,13 +719,13 @@ function coerceErrorString(err) {
|
|
|
737
719
|
}
|
|
738
720
|
|
|
739
721
|
// package.json
|
|
740
|
-
var version = "0.
|
|
722
|
+
var version = "0.208.0";
|
|
741
723
|
|
|
742
724
|
// tracing/index.ts
|
|
743
725
|
function createSessionTelemetryInfo(tracer, sessionId, to, from, propagationCtx) {
|
|
744
726
|
const parentCtx = propagationCtx ? import_api2.propagation.extract(import_api2.context.active(), propagationCtx) : import_api2.context.active();
|
|
745
727
|
const span = tracer.startSpan(
|
|
746
|
-
`river.session
|
|
728
|
+
`river.session`,
|
|
747
729
|
{
|
|
748
730
|
attributes: {
|
|
749
731
|
component: "river",
|
|
@@ -759,7 +741,7 @@ function createSessionTelemetryInfo(tracer, sessionId, to, from, propagationCtx)
|
|
|
759
741
|
}
|
|
760
742
|
function createConnectionTelemetryInfo(tracer, connection, info) {
|
|
761
743
|
const span = tracer.startSpan(
|
|
762
|
-
`connection
|
|
744
|
+
`river.connection`,
|
|
763
745
|
{
|
|
764
746
|
attributes: {
|
|
765
747
|
component: "river",
|
|
@@ -789,9 +771,9 @@ var SessionWaitingForHandshake = class extends CommonSession {
|
|
|
789
771
|
this.handshakeTimeout = setTimeout(() => {
|
|
790
772
|
this.listeners.onHandshakeTimeout();
|
|
791
773
|
}, this.options.handshakeTimeoutMs);
|
|
792
|
-
this.conn.
|
|
793
|
-
this.conn.
|
|
794
|
-
this.conn.
|
|
774
|
+
this.conn.setDataListener(this.onHandshakeData);
|
|
775
|
+
this.conn.setErrorListener(this.listeners.onConnectionErrored);
|
|
776
|
+
this.conn.setCloseListener(this.listeners.onConnectionClosed);
|
|
795
777
|
}
|
|
796
778
|
get loggingMetadata() {
|
|
797
779
|
return {
|
|
@@ -815,9 +797,9 @@ var SessionWaitingForHandshake = class extends CommonSession {
|
|
|
815
797
|
return sendMessage(this.conn, this.codec, msg);
|
|
816
798
|
}
|
|
817
799
|
_handleStateExit() {
|
|
818
|
-
this.conn.removeDataListener(
|
|
819
|
-
this.conn.removeErrorListener(
|
|
820
|
-
this.conn.removeCloseListener(
|
|
800
|
+
this.conn.removeDataListener();
|
|
801
|
+
this.conn.removeErrorListener();
|
|
802
|
+
this.conn.removeCloseListener();
|
|
821
803
|
clearTimeout(this.handshakeTimeout);
|
|
822
804
|
this.handshakeTimeout = void 0;
|
|
823
805
|
}
|
|
@@ -839,9 +821,9 @@ var SessionHandshaking = class extends IdentifiedSessionWithGracePeriod {
|
|
|
839
821
|
this.handshakeTimeout = setTimeout(() => {
|
|
840
822
|
this.listeners.onHandshakeTimeout();
|
|
841
823
|
}, this.options.handshakeTimeoutMs);
|
|
842
|
-
this.conn.
|
|
843
|
-
this.conn.
|
|
844
|
-
this.conn.
|
|
824
|
+
this.conn.setDataListener(this.onHandshakeData);
|
|
825
|
+
this.conn.setErrorListener(this.listeners.onConnectionErrored);
|
|
826
|
+
this.conn.setCloseListener(this.listeners.onConnectionClosed);
|
|
845
827
|
}
|
|
846
828
|
get loggingMetadata() {
|
|
847
829
|
return {
|
|
@@ -865,9 +847,9 @@ var SessionHandshaking = class extends IdentifiedSessionWithGracePeriod {
|
|
|
865
847
|
}
|
|
866
848
|
_handleStateExit() {
|
|
867
849
|
super._handleStateExit();
|
|
868
|
-
this.conn.removeDataListener(
|
|
869
|
-
this.conn.removeErrorListener(
|
|
870
|
-
this.conn.removeCloseListener(
|
|
850
|
+
this.conn.removeDataListener();
|
|
851
|
+
this.conn.removeErrorListener();
|
|
852
|
+
this.conn.removeCloseListener();
|
|
871
853
|
if (this.handshakeTimeout) {
|
|
872
854
|
clearTimeout(this.handshakeTimeout);
|
|
873
855
|
this.handshakeTimeout = void 0;
|
|
@@ -923,9 +905,9 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
923
905
|
super(props);
|
|
924
906
|
this.conn = props.conn;
|
|
925
907
|
this.listeners = props.listeners;
|
|
926
|
-
this.conn.
|
|
927
|
-
this.conn.
|
|
928
|
-
this.conn.
|
|
908
|
+
this.conn.setDataListener(this.onMessageData);
|
|
909
|
+
this.conn.setCloseListener(this.listeners.onConnectionClosed);
|
|
910
|
+
this.conn.setErrorListener(this.listeners.onConnectionErrored);
|
|
929
911
|
}
|
|
930
912
|
sendBufferedMessages() {
|
|
931
913
|
if (this.sendBuffer.length > 0) {
|
|
@@ -1034,9 +1016,9 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
1034
1016
|
};
|
|
1035
1017
|
_handleStateExit() {
|
|
1036
1018
|
super._handleStateExit();
|
|
1037
|
-
this.conn.removeDataListener(
|
|
1038
|
-
this.conn.removeCloseListener(
|
|
1039
|
-
this.conn.removeErrorListener(
|
|
1019
|
+
this.conn.removeDataListener();
|
|
1020
|
+
this.conn.removeCloseListener();
|
|
1021
|
+
this.conn.removeErrorListener();
|
|
1040
1022
|
if (this.heartbeatHandle) {
|
|
1041
1023
|
clearInterval(this.heartbeatHandle);
|
|
1042
1024
|
this.heartbeatHandle = void 0;
|
|
@@ -1481,8 +1463,7 @@ var Transport = class {
|
|
|
1481
1463
|
* @param message The received message.
|
|
1482
1464
|
*/
|
|
1483
1465
|
handleMsg(message) {
|
|
1484
|
-
if (this.getStatus() !== "open")
|
|
1485
|
-
return;
|
|
1466
|
+
if (this.getStatus() !== "open") return;
|
|
1486
1467
|
this.eventDispatcher.dispatchEvent("message", message);
|
|
1487
1468
|
}
|
|
1488
1469
|
/**
|
|
@@ -1570,8 +1551,7 @@ var Transport = class {
|
|
|
1570
1551
|
});
|
|
1571
1552
|
}
|
|
1572
1553
|
deleteSession(session, options) {
|
|
1573
|
-
if (session._isConsumed)
|
|
1574
|
-
return;
|
|
1554
|
+
if (session._isConsumed) return;
|
|
1575
1555
|
const loggingMetadata = session.loggingMetadata;
|
|
1576
1556
|
if (loggingMetadata.tags && options?.unhealthy) {
|
|
1577
1557
|
loggingMetadata.tags.push("unhealthy-session");
|
|
@@ -1591,7 +1571,7 @@ var Transport = class {
|
|
|
1591
1571
|
}
|
|
1592
1572
|
// common listeners
|
|
1593
1573
|
onSessionGracePeriodElapsed(session) {
|
|
1594
|
-
this.log?.
|
|
1574
|
+
this.log?.info(
|
|
1595
1575
|
`session to ${session.to} grace period elapsed, closing`,
|
|
1596
1576
|
session.loggingMetadata
|
|
1597
1577
|
);
|
|
@@ -1699,8 +1679,7 @@ var ServerTransport = class extends Transport {
|
|
|
1699
1679
|
super.deleteSession(session, options);
|
|
1700
1680
|
}
|
|
1701
1681
|
handleConnection(conn) {
|
|
1702
|
-
if (this.getStatus() !== "open")
|
|
1703
|
-
return;
|
|
1682
|
+
if (this.getStatus() !== "open") return;
|
|
1704
1683
|
this.log?.info(`new incoming connection`, {
|
|
1705
1684
|
...conn.loggingMetadata,
|
|
1706
1685
|
clientId: this.clientId
|
|
@@ -2044,18 +2023,6 @@ var ServerTransport = class extends Transport {
|
|
|
2044
2023
|
);
|
|
2045
2024
|
const bufferSendRes = connectedSession.sendBufferedMessages();
|
|
2046
2025
|
if (!bufferSendRes.ok) {
|
|
2047
|
-
this.log?.error(
|
|
2048
|
-
`failed to send buffered messages: ${bufferSendRes.reason}`,
|
|
2049
|
-
{
|
|
2050
|
-
...connectedSession.loggingMetadata,
|
|
2051
|
-
transportMessage: msg
|
|
2052
|
-
}
|
|
2053
|
-
);
|
|
2054
|
-
this.protocolError({
|
|
2055
|
-
type: ProtocolError.MessageSendFailure,
|
|
2056
|
-
message: bufferSendRes.reason
|
|
2057
|
-
});
|
|
2058
|
-
this.deleteSession(connectedSession, { unhealthy: true });
|
|
2059
2026
|
return;
|
|
2060
2027
|
}
|
|
2061
2028
|
this.sessionHandshakeMetadata.set(connectedSession.to, parsedMetadata);
|