@replit/river 0.207.3 → 0.208.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/{chunk-BO7MFCO6.js → chunk-2WFRHXDZ.js} +47 -84
- package/dist/chunk-2WFRHXDZ.js.map +1 -0
- package/dist/{chunk-B7REV3ZV.js → chunk-BXKBENJE.js} +2 -2
- package/dist/{chunk-QGPYCXV4.js → chunk-EVAQ2QMB.js} +61 -38
- package/dist/chunk-EVAQ2QMB.js.map +1 -0
- package/dist/codec/index.cjs +1 -1
- package/dist/codec/index.cjs.map +1 -1
- package/dist/codec/index.js +2 -2
- package/dist/{connection-06d72f2e.d.ts → connection-098d4aad.d.ts} +1 -1
- package/dist/router/index.cjs +58 -35
- package/dist/router/index.cjs.map +1 -1
- package/dist/router/index.d.cts +24 -5
- package/dist/router/index.d.ts +24 -5
- package/dist/router/index.js +1 -1
- package/dist/{services-87887bc5.d.ts → services-44be1b6b.d.ts} +22 -25
- package/dist/testUtil/index.cjs +51 -94
- package/dist/testUtil/index.cjs.map +1 -1
- package/dist/testUtil/index.d.cts +1 -1
- package/dist/testUtil/index.d.ts +1 -1
- package/dist/testUtil/index.js +5 -11
- package/dist/testUtil/index.js.map +1 -1
- package/dist/transport/impls/ws/client.cjs +48 -73
- package/dist/transport/impls/ws/client.cjs.map +1 -1
- 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 +3 -3
- package/dist/transport/impls/ws/server.cjs +48 -76
- package/dist/transport/impls/ws/server.cjs.map +1 -1
- 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 +3 -3
- package/dist/transport/index.cjs +48 -85
- package/dist/transport/index.cjs.map +1 -1
- package/dist/transport/index.d.cts +2 -2
- package/dist/transport/index.d.ts +2 -2
- package/dist/transport/index.js +2 -2
- 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-BXKBENJE.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as ClientTransport, P as ProvidedClientTransportOptions } from '../../../services-
|
|
1
|
+
import { C as ClientTransport, P as ProvidedClientTransportOptions } from '../../../services-44be1b6b.js';
|
|
2
2
|
import { T as TransportClientId } from '../../../message-01c3e85a.js';
|
|
3
|
-
import { W as WebSocketConnection } from '../../../connection-
|
|
3
|
+
import { W as WebSocketConnection } from '../../../connection-098d4aad.js';
|
|
4
4
|
import { W as WsLike } from '../../../wslike-e0b32dd5.js';
|
|
5
5
|
import '@sinclair/typebox';
|
|
6
6
|
import '@opentelemetry/api';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as ClientTransport, P as ProvidedClientTransportOptions } from '../../../services-
|
|
1
|
+
import { C as ClientTransport, P as ProvidedClientTransportOptions } from '../../../services-44be1b6b.js';
|
|
2
2
|
import { T as TransportClientId } from '../../../message-01c3e85a.js';
|
|
3
|
-
import { W as WebSocketConnection } from '../../../connection-
|
|
3
|
+
import { W as WebSocketConnection } from '../../../connection-098d4aad.js';
|
|
4
4
|
import { W as WsLike } from '../../../wslike-e0b32dd5.js';
|
|
5
5
|
import '@sinclair/typebox';
|
|
6
6
|
import '@opentelemetry/api';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WebSocketConnection
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-BXKBENJE.js";
|
|
4
4
|
import {
|
|
5
5
|
ClientTransport
|
|
6
|
-
} from "../../../chunk-
|
|
7
|
-
import "../../../chunk-
|
|
6
|
+
} from "../../../chunk-2WFRHXDZ.js";
|
|
7
|
+
import "../../../chunk-EVAQ2QMB.js";
|
|
8
8
|
import "../../../chunk-CC7RN7GI.js";
|
|
9
9
|
|
|
10
10
|
// transport/impls/ws/client.ts
|
|
@@ -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
|
|
|
@@ -318,7 +302,7 @@ var NaiveJsonCodec = {
|
|
|
318
302
|
const parsed = JSON.parse(
|
|
319
303
|
decoder.decode(buff),
|
|
320
304
|
function reviver(_key, val) {
|
|
321
|
-
if (val?.$t) {
|
|
305
|
+
if (val?.$t !== void 0) {
|
|
322
306
|
return base64ToUint8Array(val.$t);
|
|
323
307
|
} else {
|
|
324
308
|
return val;
|
|
@@ -737,13 +721,13 @@ function coerceErrorString(err) {
|
|
|
737
721
|
}
|
|
738
722
|
|
|
739
723
|
// package.json
|
|
740
|
-
var version = "0.
|
|
724
|
+
var version = "0.208.1";
|
|
741
725
|
|
|
742
726
|
// tracing/index.ts
|
|
743
727
|
function createSessionTelemetryInfo(tracer, sessionId, to, from, propagationCtx) {
|
|
744
728
|
const parentCtx = propagationCtx ? import_api2.propagation.extract(import_api2.context.active(), propagationCtx) : import_api2.context.active();
|
|
745
729
|
const span = tracer.startSpan(
|
|
746
|
-
`river.session
|
|
730
|
+
`river.session`,
|
|
747
731
|
{
|
|
748
732
|
attributes: {
|
|
749
733
|
component: "river",
|
|
@@ -759,7 +743,7 @@ function createSessionTelemetryInfo(tracer, sessionId, to, from, propagationCtx)
|
|
|
759
743
|
}
|
|
760
744
|
function createConnectionTelemetryInfo(tracer, connection, info) {
|
|
761
745
|
const span = tracer.startSpan(
|
|
762
|
-
`connection
|
|
746
|
+
`river.connection`,
|
|
763
747
|
{
|
|
764
748
|
attributes: {
|
|
765
749
|
component: "river",
|
|
@@ -789,9 +773,9 @@ var SessionWaitingForHandshake = class extends CommonSession {
|
|
|
789
773
|
this.handshakeTimeout = setTimeout(() => {
|
|
790
774
|
this.listeners.onHandshakeTimeout();
|
|
791
775
|
}, this.options.handshakeTimeoutMs);
|
|
792
|
-
this.conn.
|
|
793
|
-
this.conn.
|
|
794
|
-
this.conn.
|
|
776
|
+
this.conn.setDataListener(this.onHandshakeData);
|
|
777
|
+
this.conn.setErrorListener(this.listeners.onConnectionErrored);
|
|
778
|
+
this.conn.setCloseListener(this.listeners.onConnectionClosed);
|
|
795
779
|
}
|
|
796
780
|
get loggingMetadata() {
|
|
797
781
|
return {
|
|
@@ -815,9 +799,9 @@ var SessionWaitingForHandshake = class extends CommonSession {
|
|
|
815
799
|
return sendMessage(this.conn, this.codec, msg);
|
|
816
800
|
}
|
|
817
801
|
_handleStateExit() {
|
|
818
|
-
this.conn.removeDataListener(
|
|
819
|
-
this.conn.removeErrorListener(
|
|
820
|
-
this.conn.removeCloseListener(
|
|
802
|
+
this.conn.removeDataListener();
|
|
803
|
+
this.conn.removeErrorListener();
|
|
804
|
+
this.conn.removeCloseListener();
|
|
821
805
|
clearTimeout(this.handshakeTimeout);
|
|
822
806
|
this.handshakeTimeout = void 0;
|
|
823
807
|
}
|
|
@@ -839,9 +823,9 @@ var SessionHandshaking = class extends IdentifiedSessionWithGracePeriod {
|
|
|
839
823
|
this.handshakeTimeout = setTimeout(() => {
|
|
840
824
|
this.listeners.onHandshakeTimeout();
|
|
841
825
|
}, this.options.handshakeTimeoutMs);
|
|
842
|
-
this.conn.
|
|
843
|
-
this.conn.
|
|
844
|
-
this.conn.
|
|
826
|
+
this.conn.setDataListener(this.onHandshakeData);
|
|
827
|
+
this.conn.setErrorListener(this.listeners.onConnectionErrored);
|
|
828
|
+
this.conn.setCloseListener(this.listeners.onConnectionClosed);
|
|
845
829
|
}
|
|
846
830
|
get loggingMetadata() {
|
|
847
831
|
return {
|
|
@@ -865,9 +849,9 @@ var SessionHandshaking = class extends IdentifiedSessionWithGracePeriod {
|
|
|
865
849
|
}
|
|
866
850
|
_handleStateExit() {
|
|
867
851
|
super._handleStateExit();
|
|
868
|
-
this.conn.removeDataListener(
|
|
869
|
-
this.conn.removeErrorListener(
|
|
870
|
-
this.conn.removeCloseListener(
|
|
852
|
+
this.conn.removeDataListener();
|
|
853
|
+
this.conn.removeErrorListener();
|
|
854
|
+
this.conn.removeCloseListener();
|
|
871
855
|
if (this.handshakeTimeout) {
|
|
872
856
|
clearTimeout(this.handshakeTimeout);
|
|
873
857
|
this.handshakeTimeout = void 0;
|
|
@@ -923,9 +907,9 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
923
907
|
super(props);
|
|
924
908
|
this.conn = props.conn;
|
|
925
909
|
this.listeners = props.listeners;
|
|
926
|
-
this.conn.
|
|
927
|
-
this.conn.
|
|
928
|
-
this.conn.
|
|
910
|
+
this.conn.setDataListener(this.onMessageData);
|
|
911
|
+
this.conn.setCloseListener(this.listeners.onConnectionClosed);
|
|
912
|
+
this.conn.setErrorListener(this.listeners.onConnectionErrored);
|
|
929
913
|
}
|
|
930
914
|
sendBufferedMessages() {
|
|
931
915
|
if (this.sendBuffer.length > 0) {
|
|
@@ -1034,9 +1018,9 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
1034
1018
|
};
|
|
1035
1019
|
_handleStateExit() {
|
|
1036
1020
|
super._handleStateExit();
|
|
1037
|
-
this.conn.removeDataListener(
|
|
1038
|
-
this.conn.removeCloseListener(
|
|
1039
|
-
this.conn.removeErrorListener(
|
|
1021
|
+
this.conn.removeDataListener();
|
|
1022
|
+
this.conn.removeCloseListener();
|
|
1023
|
+
this.conn.removeErrorListener();
|
|
1040
1024
|
if (this.heartbeatHandle) {
|
|
1041
1025
|
clearInterval(this.heartbeatHandle);
|
|
1042
1026
|
this.heartbeatHandle = void 0;
|
|
@@ -1591,7 +1575,7 @@ var Transport = class {
|
|
|
1591
1575
|
}
|
|
1592
1576
|
// common listeners
|
|
1593
1577
|
onSessionGracePeriodElapsed(session) {
|
|
1594
|
-
this.log?.
|
|
1578
|
+
this.log?.info(
|
|
1595
1579
|
`session to ${session.to} grace period elapsed, closing`,
|
|
1596
1580
|
session.loggingMetadata
|
|
1597
1581
|
);
|
|
@@ -2044,18 +2028,6 @@ var ServerTransport = class extends Transport {
|
|
|
2044
2028
|
);
|
|
2045
2029
|
const bufferSendRes = connectedSession.sendBufferedMessages();
|
|
2046
2030
|
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
2031
|
return;
|
|
2060
2032
|
}
|
|
2061
2033
|
this.sessionHandshakeMetadata.set(connectedSession.to, parsedMetadata);
|