@replit/river 0.24.3 → 0.25.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-XKHLA5MP.js → chunk-5CNNIOAO.js} +4 -4
- package/dist/{chunk-FKBXIWWN.js → chunk-D5O3ERJU.js} +3 -3
- package/dist/{chunk-EHXKU4TW.js → chunk-MBMEJIPU.js} +2 -2
- package/dist/{chunk-W3CY6PNC.js → chunk-PCBPPTXH.js} +28 -23
- package/dist/chunk-PCBPPTXH.js.map +1 -0
- package/dist/{chunk-LSHUPI6U.js → chunk-SGSRNAWJ.js} +41 -18
- package/dist/{chunk-LSHUPI6U.js.map → chunk-SGSRNAWJ.js.map} +1 -1
- package/dist/{chunk-DZNP3EI5.js → chunk-SZ5NBBX7.js} +2 -2
- package/dist/{chunk-DZNP3EI5.js.map → chunk-SZ5NBBX7.js.map} +1 -1
- package/dist/{chunk-KVLCQ24J.js → chunk-YM5Y4NAT.js} +34 -13
- package/dist/chunk-YM5Y4NAT.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 +40 -17
- 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 +13 -14
- 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-5CNNIOAO.js.map} +0 -0
- /package/dist/{chunk-FKBXIWWN.js.map → chunk-D5O3ERJU.js.map} +0 -0
- /package/dist/{chunk-EHXKU4TW.js.map → chunk-MBMEJIPU.js.map} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { C as ClientTransport } from '../../../client-
|
|
1
|
+
import { C as ClientTransport } from '../../../client-1321630c.js';
|
|
2
2
|
import { c as TransportClientId } from '../../../message-e6c560fd.js';
|
|
3
|
-
import { b as ProvidedClientTransportOptions } from '../../../handshake-
|
|
4
|
-
import { W as WebSocketConnection } from '../../../connection-
|
|
3
|
+
import { b as ProvidedClientTransportOptions } from '../../../handshake-3772d7ca.js';
|
|
4
|
+
import { W as WebSocketConnection } from '../../../connection-bd907ca6.js';
|
|
5
5
|
import { W as WsLike } from '../../../wslike-e0b32dd5.js';
|
|
6
6
|
import '@sinclair/typebox/value';
|
|
7
7
|
import '@sinclair/typebox';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { C as ClientTransport } from '../../../client-
|
|
1
|
+
import { C as ClientTransport } from '../../../client-1321630c.js';
|
|
2
2
|
import { c as TransportClientId } from '../../../message-e6c560fd.js';
|
|
3
|
-
import { b as ProvidedClientTransportOptions } from '../../../handshake-
|
|
4
|
-
import { W as WebSocketConnection } from '../../../connection-
|
|
3
|
+
import { b as ProvidedClientTransportOptions } from '../../../handshake-3772d7ca.js';
|
|
4
|
+
import { W as WebSocketConnection } from '../../../connection-bd907ca6.js';
|
|
5
5
|
import { W as WsLike } from '../../../wslike-e0b32dd5.js';
|
|
6
6
|
import '@sinclair/typebox/value';
|
|
7
7
|
import '@sinclair/typebox';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
WebSocketConnection
|
|
3
|
-
} from "../../../chunk-EHXKU4TW.js";
|
|
4
1
|
import {
|
|
5
2
|
ClientTransport
|
|
6
|
-
} from "../../../chunk-
|
|
7
|
-
import
|
|
3
|
+
} from "../../../chunk-5CNNIOAO.js";
|
|
4
|
+
import {
|
|
5
|
+
WebSocketConnection
|
|
6
|
+
} from "../../../chunk-MBMEJIPU.js";
|
|
7
|
+
import "../../../chunk-D5O3ERJU.js";
|
|
8
8
|
import "../../../chunk-TAH2GVTJ.js";
|
|
9
|
-
import "../../../chunk-
|
|
10
|
-
import "../../../chunk-
|
|
9
|
+
import "../../../chunk-YM5Y4NAT.js";
|
|
10
|
+
import "../../../chunk-SZ5NBBX7.js";
|
|
11
11
|
import "../../../chunk-4PVU7J25.js";
|
|
12
12
|
|
|
13
13
|
// transport/impls/ws/client.ts
|
|
@@ -635,7 +635,7 @@ var SessionNoConnection = class extends IdentifiedSession {
|
|
|
635
635
|
var import_api = require("@opentelemetry/api");
|
|
636
636
|
|
|
637
637
|
// package.json
|
|
638
|
-
var version = "0.
|
|
638
|
+
var version = "0.25.1";
|
|
639
639
|
|
|
640
640
|
// tracing/index.ts
|
|
641
641
|
function createSessionTelemetryInfo(sessionId, to, from, propagationCtx) {
|
|
@@ -750,15 +750,16 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
750
750
|
state = "Connected" /* Connected */;
|
|
751
751
|
conn;
|
|
752
752
|
listeners;
|
|
753
|
-
|
|
754
|
-
|
|
753
|
+
activeHeartbeatHandle;
|
|
754
|
+
activeHeartbeatMisses = 0;
|
|
755
|
+
passiveHeartbeatHandle;
|
|
755
756
|
get isActivelyHeartbeating() {
|
|
756
|
-
return this.
|
|
757
|
+
return this.activeHeartbeatHandle !== void 0;
|
|
757
758
|
}
|
|
758
759
|
updateBookkeeping(ack, seq) {
|
|
759
760
|
this.sendBuffer = this.sendBuffer.filter((unacked) => unacked.seq >= ack);
|
|
760
761
|
this.ack = seq + 1;
|
|
761
|
-
this.
|
|
762
|
+
this.activeHeartbeatMisses = 0;
|
|
762
763
|
}
|
|
763
764
|
send(msg) {
|
|
764
765
|
const constructedMsg = this.constructMsg(msg);
|
|
@@ -784,8 +785,8 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
784
785
|
}
|
|
785
786
|
}
|
|
786
787
|
startActiveHeartbeat() {
|
|
787
|
-
this.
|
|
788
|
-
const misses = this.
|
|
788
|
+
this.activeHeartbeatHandle = setInterval(() => {
|
|
789
|
+
const misses = this.activeHeartbeatMisses;
|
|
789
790
|
const missDuration = misses * this.options.heartbeatIntervalMs;
|
|
790
791
|
if (misses >= this.options.heartbeatsUntilDead) {
|
|
791
792
|
this.log?.info(
|
|
@@ -794,15 +795,32 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
794
795
|
);
|
|
795
796
|
this.telemetry.span.addEvent("closing connection due to inactivity");
|
|
796
797
|
this.conn.close();
|
|
797
|
-
clearInterval(this.
|
|
798
|
-
this.
|
|
798
|
+
clearInterval(this.activeHeartbeatHandle);
|
|
799
|
+
this.activeHeartbeatHandle = void 0;
|
|
799
800
|
return;
|
|
800
801
|
}
|
|
801
802
|
this.sendHeartbeat();
|
|
802
|
-
this.
|
|
803
|
+
this.activeHeartbeatMisses++;
|
|
803
804
|
}, this.options.heartbeatIntervalMs);
|
|
804
805
|
}
|
|
806
|
+
waitForNextHeartbeat() {
|
|
807
|
+
const duration = this.options.heartbeatsUntilDead * this.options.heartbeatIntervalMs;
|
|
808
|
+
if (this.passiveHeartbeatHandle) {
|
|
809
|
+
clearTimeout(this.passiveHeartbeatHandle);
|
|
810
|
+
this.passiveHeartbeatHandle = void 0;
|
|
811
|
+
}
|
|
812
|
+
this.passiveHeartbeatHandle = setTimeout(() => {
|
|
813
|
+
this.log?.info(
|
|
814
|
+
`closing connection to ${this.to} due to not receiving a heartbeat in the last ${duration}ms`,
|
|
815
|
+
this.loggingMetadata
|
|
816
|
+
);
|
|
817
|
+
this.telemetry.span.addEvent("closing connection due to inactivity");
|
|
818
|
+
this.conn.close();
|
|
819
|
+
this.passiveHeartbeatHandle = void 0;
|
|
820
|
+
}, duration);
|
|
821
|
+
}
|
|
805
822
|
sendHeartbeat() {
|
|
823
|
+
this.log?.debug("sending heartbeat", this.loggingMetadata);
|
|
806
824
|
this.send({
|
|
807
825
|
streamId: "heartbeat",
|
|
808
826
|
controlFlags: 1 /* AckBit */,
|
|
@@ -854,6 +872,7 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
854
872
|
});
|
|
855
873
|
if (!this.isActivelyHeartbeating) {
|
|
856
874
|
this.sendHeartbeat();
|
|
875
|
+
this.waitForNextHeartbeat();
|
|
857
876
|
}
|
|
858
877
|
};
|
|
859
878
|
_handleStateExit() {
|
|
@@ -861,8 +880,10 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
861
880
|
this.conn.removeDataListener(this.onMessageData);
|
|
862
881
|
this.conn.removeCloseListener(this.listeners.onConnectionClosed);
|
|
863
882
|
this.conn.removeErrorListener(this.listeners.onConnectionErrored);
|
|
864
|
-
clearInterval(this.
|
|
865
|
-
this.
|
|
883
|
+
clearInterval(this.activeHeartbeatHandle);
|
|
884
|
+
clearTimeout(this.passiveHeartbeatHandle);
|
|
885
|
+
this.activeHeartbeatHandle = void 0;
|
|
886
|
+
this.passiveHeartbeatHandle = void 0;
|
|
866
887
|
}
|
|
867
888
|
_handleClose() {
|
|
868
889
|
super._handleClose();
|
|
@@ -1396,10 +1417,10 @@ var ServerTransport = class extends Transport {
|
|
|
1396
1417
|
return;
|
|
1397
1418
|
}
|
|
1398
1419
|
let connectCase = "new session";
|
|
1420
|
+
const clientNextExpectedSeq = msg.payload.expectedSessionState.nextExpectedSeq;
|
|
1421
|
+
const clientNextSentSeq = msg.payload.expectedSessionState.nextSentSeq ?? 0;
|
|
1399
1422
|
if (oldSession && oldSession.id === msg.payload.sessionId) {
|
|
1400
1423
|
connectCase = "transparent reconnection";
|
|
1401
|
-
const clientNextExpectedSeq = msg.payload.expectedSessionState.nextExpectedSeq;
|
|
1402
|
-
const clientNextSentSeq = msg.payload.expectedSessionState.nextSentSeq ?? 0;
|
|
1403
1424
|
const ourNextSeq = oldSession.nextSeq();
|
|
1404
1425
|
const ourAck = oldSession.ack;
|
|
1405
1426
|
if (clientNextSentSeq > ourAck) {
|
|
@@ -1455,26 +1476,31 @@ var ServerTransport = class extends Transport {
|
|
|
1455
1476
|
this.updateSession(oldSession);
|
|
1456
1477
|
} else if (oldSession) {
|
|
1457
1478
|
connectCase = "hard reconnection";
|
|
1479
|
+
this.log?.info(
|
|
1480
|
+
`client is reconnecting to a new session (${msg.payload.sessionId}) with an old session (${oldSession.id}) already existing, closing old session`,
|
|
1481
|
+
{
|
|
1482
|
+
...session.loggingMetadata,
|
|
1483
|
+
connectedTo: msg.from,
|
|
1484
|
+
sessionId: msg.payload.sessionId
|
|
1485
|
+
}
|
|
1486
|
+
);
|
|
1458
1487
|
this.deleteSession(oldSession);
|
|
1459
1488
|
oldSession = void 0;
|
|
1460
|
-
}
|
|
1489
|
+
}
|
|
1490
|
+
if (!oldSession && (clientNextSentSeq > 0 || clientNextExpectedSeq > 0)) {
|
|
1461
1491
|
connectCase = "unknown session";
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
}
|
|
1475
|
-
);
|
|
1476
|
-
return;
|
|
1477
|
-
}
|
|
1492
|
+
this.rejectHandshakeRequest(
|
|
1493
|
+
session,
|
|
1494
|
+
msg.from,
|
|
1495
|
+
`client is trying to reconnect to a session the server don't know about: ${msg.payload.sessionId}`,
|
|
1496
|
+
"SESSION_STATE_MISMATCH",
|
|
1497
|
+
{
|
|
1498
|
+
...session.loggingMetadata,
|
|
1499
|
+
connectedTo: msg.from,
|
|
1500
|
+
transportMessage: msg
|
|
1501
|
+
}
|
|
1502
|
+
);
|
|
1503
|
+
return;
|
|
1478
1504
|
}
|
|
1479
1505
|
const sessionId = msg.payload.sessionId;
|
|
1480
1506
|
this.log?.info(
|