@replit/river 0.24.3 → 0.25.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/{chunk-XKHLA5MP.js → chunk-4GCILF7L.js} +4 -4
- package/dist/{chunk-DZNP3EI5.js → chunk-6NPQ43ZP.js} +2 -2
- package/dist/{chunk-DZNP3EI5.js.map → chunk-6NPQ43ZP.js.map} +1 -1
- package/dist/{chunk-EHXKU4TW.js → chunk-BMSEVPGM.js} +2 -2
- package/dist/{chunk-FKBXIWWN.js → chunk-FEMGSUEE.js} +3 -3
- package/dist/{chunk-LSHUPI6U.js → chunk-JTZVFCMT.js} +2 -2
- package/dist/{chunk-W3CY6PNC.js → chunk-N2UT2H2D.js} +28 -23
- package/dist/chunk-N2UT2H2D.js.map +1 -0
- package/dist/{chunk-KVLCQ24J.js → chunk-XVGZYVNR.js} +34 -13
- package/dist/chunk-XVGZYVNR.js.map +1 -0
- package/dist/{client-2ba72e89.d.ts → client-1321630c.d.ts} +1 -1
- package/dist/{connection-55cba970.d.ts → connection-bd907ca6.d.ts} +1 -1
- package/dist/{handshake-0b88e8fc.d.ts → handshake-3772d7ca.d.ts} +4 -2
- package/dist/router/index.cjs +1 -1
- package/dist/router/index.cjs.map +1 -1
- package/dist/router/index.d.cts +7 -7
- package/dist/router/index.d.ts +7 -7
- package/dist/router/index.js +2 -2
- package/dist/{server-732e7014.d.ts → server-f0fd2b98.d.ts} +1 -1
- package/dist/{services-adfd0bc3.d.ts → services-8d14ae16.d.ts} +2 -2
- package/dist/transport/impls/ws/client.cjs +33 -12
- package/dist/transport/impls/ws/client.cjs.map +1 -1
- package/dist/transport/impls/ws/client.d.cts +3 -3
- package/dist/transport/impls/ws/client.d.ts +3 -3
- package/dist/transport/impls/ws/client.js +7 -7
- package/dist/transport/impls/ws/server.cjs +57 -31
- package/dist/transport/impls/ws/server.cjs.map +1 -1
- package/dist/transport/impls/ws/server.d.cts +3 -3
- package/dist/transport/impls/ws/server.d.ts +3 -3
- package/dist/transport/impls/ws/server.js +5 -5
- package/dist/transport/index.cjs +57 -31
- package/dist/transport/index.cjs.map +1 -1
- package/dist/transport/index.d.cts +3 -3
- package/dist/transport/index.d.ts +3 -3
- package/dist/transport/index.js +7 -7
- package/dist/util/testHelpers.cjs +33 -27
- package/dist/util/testHelpers.cjs.map +1 -1
- package/dist/util/testHelpers.d.cts +4 -7
- package/dist/util/testHelpers.d.ts +4 -7
- package/dist/util/testHelpers.js +3 -14
- package/dist/util/testHelpers.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-KVLCQ24J.js.map +0 -1
- package/dist/chunk-TDFWZIXR.js +0 -106
- package/dist/chunk-TDFWZIXR.js.map +0 -1
- package/dist/chunk-W3CY6PNC.js.map +0 -1
- package/dist/connection-c6db05d9.d.ts +0 -31
- package/dist/transport/impls/uds/client.cjs +0 -1684
- package/dist/transport/impls/uds/client.cjs.map +0 -1
- package/dist/transport/impls/uds/client.d.cts +0 -18
- package/dist/transport/impls/uds/client.d.ts +0 -18
- package/dist/transport/impls/uds/client.js +0 -38
- package/dist/transport/impls/uds/client.js.map +0 -1
- package/dist/transport/impls/uds/server.cjs +0 -1650
- package/dist/transport/impls/uds/server.cjs.map +0 -1
- package/dist/transport/impls/uds/server.d.cts +0 -19
- package/dist/transport/impls/uds/server.d.ts +0 -19
- package/dist/transport/impls/uds/server.js +0 -33
- package/dist/transport/impls/uds/server.js.map +0 -1
- /package/dist/{chunk-XKHLA5MP.js.map → chunk-4GCILF7L.js.map} +0 -0
- /package/dist/{chunk-EHXKU4TW.js.map → chunk-BMSEVPGM.js.map} +0 -0
- /package/dist/{chunk-FKBXIWWN.js.map → chunk-FEMGSUEE.js.map} +0 -0
- /package/dist/{chunk-LSHUPI6U.js.map → chunk-JTZVFCMT.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { b as ClientTransportOptions, C as Connection, j as EventHandler, E as EventMap, i as EventTypes, k as ProtocolError, l as ProtocolErrorType, c as ServerTransportOptions, S as Session, h as SessionConnected, f as SessionConnecting, g as SessionHandshaking, e as SessionNoConnection, d as SessionState, T as Transport, P as TransportOptions, a as TransportStatus } from '../handshake-
|
|
2
|
-
export { C as ClientTransport } from '../client-
|
|
3
|
-
export { S as ServerTransport, a as SessionWaitingForHandshake } from '../server-
|
|
1
|
+
export { b as ClientTransportOptions, C as Connection, j as EventHandler, E as EventMap, i as EventTypes, k as ProtocolError, l as ProtocolErrorType, c as ServerTransportOptions, S as Session, h as SessionConnected, f as SessionConnecting, g as SessionHandshaking, e as SessionNoConnection, d as SessionState, T as Transport, P as TransportOptions, a as TransportStatus } from '../handshake-3772d7ca.js';
|
|
2
|
+
export { C as ClientTransport } from '../client-1321630c.js';
|
|
3
|
+
export { S as ServerTransport, a as SessionWaitingForHandshake } from '../server-f0fd2b98.js';
|
|
4
4
|
export { b as OpaqueTransportMessage, O as OpaqueTransportMessageSchema, c as TransportClientId, a as TransportMessage, T as TransportMessageSchema, d as isStreamClose, i as isStreamOpen } from '../message-e6c560fd.js';
|
|
5
5
|
import '@sinclair/typebox';
|
|
6
6
|
import '../types-3e5768ec.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { b as ClientTransportOptions, C as Connection, j as EventHandler, E as EventMap, i as EventTypes, k as ProtocolError, l as ProtocolErrorType, c as ServerTransportOptions, S as Session, h as SessionConnected, f as SessionConnecting, g as SessionHandshaking, e as SessionNoConnection, d as SessionState, T as Transport, P as TransportOptions, a as TransportStatus } from '../handshake-
|
|
2
|
-
export { C as ClientTransport } from '../client-
|
|
3
|
-
export { S as ServerTransport, a as SessionWaitingForHandshake } from '../server-
|
|
1
|
+
export { b as ClientTransportOptions, C as Connection, j as EventHandler, E as EventMap, i as EventTypes, k as ProtocolError, l as ProtocolErrorType, c as ServerTransportOptions, S as Session, h as SessionConnected, f as SessionConnecting, g as SessionHandshaking, e as SessionNoConnection, d as SessionState, T as Transport, P as TransportOptions, a as TransportStatus } from '../handshake-3772d7ca.js';
|
|
2
|
+
export { C as ClientTransport } from '../client-1321630c.js';
|
|
3
|
+
export { S as ServerTransport, a as SessionWaitingForHandshake } from '../server-f0fd2b98.js';
|
|
4
4
|
export { b as OpaqueTransportMessage, O as OpaqueTransportMessageSchema, c as TransportClientId, a as TransportMessage, T as TransportMessageSchema, d as isStreamClose, i as isStreamOpen } from '../message-e6c560fd.js';
|
|
5
5
|
import '@sinclair/typebox';
|
|
6
6
|
import '../types-3e5768ec.js';
|
package/dist/transport/index.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ServerTransport
|
|
3
|
-
} from "../chunk-W3CY6PNC.js";
|
|
4
1
|
import {
|
|
5
2
|
ClientTransport
|
|
6
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-4GCILF7L.js";
|
|
4
|
+
import {
|
|
5
|
+
ServerTransport
|
|
6
|
+
} from "../chunk-N2UT2H2D.js";
|
|
7
7
|
import {
|
|
8
8
|
Connection,
|
|
9
9
|
ProtocolError,
|
|
10
10
|
Transport
|
|
11
|
-
} from "../chunk-
|
|
11
|
+
} from "../chunk-FEMGSUEE.js";
|
|
12
12
|
import "../chunk-TAH2GVTJ.js";
|
|
13
13
|
import {
|
|
14
14
|
SessionState
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-XVGZYVNR.js";
|
|
16
16
|
import {
|
|
17
17
|
OpaqueTransportMessageSchema,
|
|
18
18
|
TransportMessageSchema
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-6NPQ43ZP.js";
|
|
20
20
|
import "../chunk-4PVU7J25.js";
|
|
21
21
|
export {
|
|
22
22
|
ClientTransport,
|
|
@@ -40,10 +40,8 @@ __export(testHelpers_exports, {
|
|
|
40
40
|
createWebSocketServer: () => createWebSocketServer,
|
|
41
41
|
dummySession: () => dummySession,
|
|
42
42
|
getTransportConnections: () => getTransportConnections,
|
|
43
|
-
getUnixSocketPath: () => getUnixSocketPath,
|
|
44
43
|
iterNext: () => iterNext,
|
|
45
44
|
numberOfConnections: () => numberOfConnections,
|
|
46
|
-
onUdsServeReady: () => onUdsServeReady,
|
|
47
45
|
onWsServerReady: () => onWsServerReady,
|
|
48
46
|
payloadToTransportMessage: () => payloadToTransportMessage,
|
|
49
47
|
testingSessionOptions: () => testingSessionOptions,
|
|
@@ -452,7 +450,7 @@ function Err(error) {
|
|
|
452
450
|
var import_api = require("@opentelemetry/api");
|
|
453
451
|
|
|
454
452
|
// package.json
|
|
455
|
-
var version = "0.
|
|
453
|
+
var version = "0.25.0";
|
|
456
454
|
|
|
457
455
|
// tracing/index.ts
|
|
458
456
|
function createSessionTelemetryInfo(sessionId, to, from, propagationCtx) {
|
|
@@ -482,9 +480,6 @@ function coerceErrorString(err) {
|
|
|
482
480
|
return `[coerced to error] ${String(err)}`;
|
|
483
481
|
}
|
|
484
482
|
|
|
485
|
-
// util/testHelpers.ts
|
|
486
|
-
var import_nanoid2 = require("nanoid");
|
|
487
|
-
|
|
488
483
|
// codec/json.ts
|
|
489
484
|
var encoder = new TextEncoder();
|
|
490
485
|
var decoder = new TextDecoder();
|
|
@@ -865,15 +860,16 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
865
860
|
state = "Connected" /* Connected */;
|
|
866
861
|
conn;
|
|
867
862
|
listeners;
|
|
868
|
-
|
|
869
|
-
|
|
863
|
+
activeHeartbeatHandle;
|
|
864
|
+
activeHeartbeatMisses = 0;
|
|
865
|
+
passiveHeartbeatHandle;
|
|
870
866
|
get isActivelyHeartbeating() {
|
|
871
|
-
return this.
|
|
867
|
+
return this.activeHeartbeatHandle !== void 0;
|
|
872
868
|
}
|
|
873
869
|
updateBookkeeping(ack, seq) {
|
|
874
870
|
this.sendBuffer = this.sendBuffer.filter((unacked) => unacked.seq >= ack);
|
|
875
871
|
this.ack = seq + 1;
|
|
876
|
-
this.
|
|
872
|
+
this.activeHeartbeatMisses = 0;
|
|
877
873
|
}
|
|
878
874
|
send(msg) {
|
|
879
875
|
const constructedMsg = this.constructMsg(msg);
|
|
@@ -899,8 +895,8 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
899
895
|
}
|
|
900
896
|
}
|
|
901
897
|
startActiveHeartbeat() {
|
|
902
|
-
this.
|
|
903
|
-
const misses = this.
|
|
898
|
+
this.activeHeartbeatHandle = setInterval(() => {
|
|
899
|
+
const misses = this.activeHeartbeatMisses;
|
|
904
900
|
const missDuration = misses * this.options.heartbeatIntervalMs;
|
|
905
901
|
if (misses >= this.options.heartbeatsUntilDead) {
|
|
906
902
|
this.log?.info(
|
|
@@ -909,15 +905,32 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
909
905
|
);
|
|
910
906
|
this.telemetry.span.addEvent("closing connection due to inactivity");
|
|
911
907
|
this.conn.close();
|
|
912
|
-
clearInterval(this.
|
|
913
|
-
this.
|
|
908
|
+
clearInterval(this.activeHeartbeatHandle);
|
|
909
|
+
this.activeHeartbeatHandle = void 0;
|
|
914
910
|
return;
|
|
915
911
|
}
|
|
916
912
|
this.sendHeartbeat();
|
|
917
|
-
this.
|
|
913
|
+
this.activeHeartbeatMisses++;
|
|
918
914
|
}, this.options.heartbeatIntervalMs);
|
|
919
915
|
}
|
|
916
|
+
waitForNextHeartbeat() {
|
|
917
|
+
const duration = this.options.heartbeatsUntilDead * this.options.heartbeatIntervalMs;
|
|
918
|
+
if (this.passiveHeartbeatHandle) {
|
|
919
|
+
clearTimeout(this.passiveHeartbeatHandle);
|
|
920
|
+
this.passiveHeartbeatHandle = void 0;
|
|
921
|
+
}
|
|
922
|
+
this.passiveHeartbeatHandle = setTimeout(() => {
|
|
923
|
+
this.log?.info(
|
|
924
|
+
`closing connection to ${this.to} due to not receiving a heartbeat in the last ${duration}ms`,
|
|
925
|
+
this.loggingMetadata
|
|
926
|
+
);
|
|
927
|
+
this.telemetry.span.addEvent("closing connection due to inactivity");
|
|
928
|
+
this.conn.close();
|
|
929
|
+
this.passiveHeartbeatHandle = void 0;
|
|
930
|
+
}, duration);
|
|
931
|
+
}
|
|
920
932
|
sendHeartbeat() {
|
|
933
|
+
this.log?.debug("sending heartbeat", this.loggingMetadata);
|
|
921
934
|
this.send({
|
|
922
935
|
streamId: "heartbeat",
|
|
923
936
|
controlFlags: 1 /* AckBit */,
|
|
@@ -969,6 +982,7 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
969
982
|
});
|
|
970
983
|
if (!this.isActivelyHeartbeating) {
|
|
971
984
|
this.sendHeartbeat();
|
|
985
|
+
this.waitForNextHeartbeat();
|
|
972
986
|
}
|
|
973
987
|
};
|
|
974
988
|
_handleStateExit() {
|
|
@@ -976,8 +990,10 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
976
990
|
this.conn.removeDataListener(this.onMessageData);
|
|
977
991
|
this.conn.removeCloseListener(this.listeners.onConnectionClosed);
|
|
978
992
|
this.conn.removeErrorListener(this.listeners.onConnectionErrored);
|
|
979
|
-
clearInterval(this.
|
|
980
|
-
this.
|
|
993
|
+
clearInterval(this.activeHeartbeatHandle);
|
|
994
|
+
clearTimeout(this.passiveHeartbeatHandle);
|
|
995
|
+
this.activeHeartbeatHandle = void 0;
|
|
996
|
+
this.passiveHeartbeatHandle = void 0;
|
|
981
997
|
}
|
|
982
998
|
_handleClose() {
|
|
983
999
|
super._handleClose();
|
|
@@ -1185,11 +1201,6 @@ function onWsServerReady(server) {
|
|
|
1185
1201
|
});
|
|
1186
1202
|
});
|
|
1187
1203
|
}
|
|
1188
|
-
function onUdsServeReady(server, path) {
|
|
1189
|
-
return new Promise((resolve) => {
|
|
1190
|
-
server.listen(path, resolve);
|
|
1191
|
-
});
|
|
1192
|
-
}
|
|
1193
1204
|
async function iterNext(iter) {
|
|
1194
1205
|
return await iter.next().then((res) => res.value);
|
|
1195
1206
|
}
|
|
@@ -1294,9 +1305,6 @@ function asClientUpload(state, proc, init, extendedContext, session = dummySessi
|
|
|
1294
1305
|
return [input, result];
|
|
1295
1306
|
}
|
|
1296
1307
|
}
|
|
1297
|
-
var getUnixSocketPath = () => {
|
|
1298
|
-
return `/tmp/${(0, import_nanoid2.nanoid)()}.sock`;
|
|
1299
|
-
};
|
|
1300
1308
|
function getTransportConnections(transport) {
|
|
1301
1309
|
const connections = [];
|
|
1302
1310
|
for (const session of transport.sessions.values()) {
|
|
@@ -1326,10 +1334,8 @@ function closeAllConnections(transport) {
|
|
|
1326
1334
|
createWebSocketServer,
|
|
1327
1335
|
dummySession,
|
|
1328
1336
|
getTransportConnections,
|
|
1329
|
-
getUnixSocketPath,
|
|
1330
1337
|
iterNext,
|
|
1331
1338
|
numberOfConnections,
|
|
1332
|
-
onUdsServeReady,
|
|
1333
1339
|
onWsServerReady,
|
|
1334
1340
|
payloadToTransportMessage,
|
|
1335
1341
|
testingSessionOptions,
|