@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,9 +1,9 @@
|
|
|
1
1
|
import { c as TransportClientId } from '../../../message-e6c560fd.js';
|
|
2
2
|
import { WebSocketServer } from 'ws';
|
|
3
|
-
import { W as WebSocketConnection } from '../../../connection-
|
|
3
|
+
import { W as WebSocketConnection } from '../../../connection-bd907ca6.js';
|
|
4
4
|
import { W as WsLike } from '../../../wslike-e0b32dd5.js';
|
|
5
|
-
import { S as ServerTransport } from '../../../server-
|
|
6
|
-
import { c as ProvidedServerTransportOptions } from '../../../handshake-
|
|
5
|
+
import { S as ServerTransport } from '../../../server-f0fd2b98.js';
|
|
6
|
+
import { c as ProvidedServerTransportOptions } from '../../../handshake-3772d7ca.js';
|
|
7
7
|
import '@sinclair/typebox/value';
|
|
8
8
|
import '@sinclair/typebox';
|
|
9
9
|
import '@opentelemetry/api';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ServerTransport
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-PCBPPTXH.js";
|
|
4
4
|
import {
|
|
5
5
|
WebSocketConnection
|
|
6
|
-
} from "../../../chunk-
|
|
7
|
-
import "../../../chunk-
|
|
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/server.ts
|
package/dist/transport/index.cjs
CHANGED
|
@@ -562,7 +562,7 @@ var SessionNoConnection = class extends IdentifiedSession {
|
|
|
562
562
|
var import_api = require("@opentelemetry/api");
|
|
563
563
|
|
|
564
564
|
// package.json
|
|
565
|
-
var version = "0.
|
|
565
|
+
var version = "0.25.1";
|
|
566
566
|
|
|
567
567
|
// tracing/index.ts
|
|
568
568
|
function getPropagationContext(ctx) {
|
|
@@ -686,15 +686,16 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
686
686
|
state = "Connected" /* Connected */;
|
|
687
687
|
conn;
|
|
688
688
|
listeners;
|
|
689
|
-
|
|
690
|
-
|
|
689
|
+
activeHeartbeatHandle;
|
|
690
|
+
activeHeartbeatMisses = 0;
|
|
691
|
+
passiveHeartbeatHandle;
|
|
691
692
|
get isActivelyHeartbeating() {
|
|
692
|
-
return this.
|
|
693
|
+
return this.activeHeartbeatHandle !== void 0;
|
|
693
694
|
}
|
|
694
695
|
updateBookkeeping(ack, seq) {
|
|
695
696
|
this.sendBuffer = this.sendBuffer.filter((unacked) => unacked.seq >= ack);
|
|
696
697
|
this.ack = seq + 1;
|
|
697
|
-
this.
|
|
698
|
+
this.activeHeartbeatMisses = 0;
|
|
698
699
|
}
|
|
699
700
|
send(msg) {
|
|
700
701
|
const constructedMsg = this.constructMsg(msg);
|
|
@@ -720,8 +721,8 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
720
721
|
}
|
|
721
722
|
}
|
|
722
723
|
startActiveHeartbeat() {
|
|
723
|
-
this.
|
|
724
|
-
const misses = this.
|
|
724
|
+
this.activeHeartbeatHandle = setInterval(() => {
|
|
725
|
+
const misses = this.activeHeartbeatMisses;
|
|
725
726
|
const missDuration = misses * this.options.heartbeatIntervalMs;
|
|
726
727
|
if (misses >= this.options.heartbeatsUntilDead) {
|
|
727
728
|
this.log?.info(
|
|
@@ -730,15 +731,32 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
730
731
|
);
|
|
731
732
|
this.telemetry.span.addEvent("closing connection due to inactivity");
|
|
732
733
|
this.conn.close();
|
|
733
|
-
clearInterval(this.
|
|
734
|
-
this.
|
|
734
|
+
clearInterval(this.activeHeartbeatHandle);
|
|
735
|
+
this.activeHeartbeatHandle = void 0;
|
|
735
736
|
return;
|
|
736
737
|
}
|
|
737
738
|
this.sendHeartbeat();
|
|
738
|
-
this.
|
|
739
|
+
this.activeHeartbeatMisses++;
|
|
739
740
|
}, this.options.heartbeatIntervalMs);
|
|
740
741
|
}
|
|
742
|
+
waitForNextHeartbeat() {
|
|
743
|
+
const duration = this.options.heartbeatsUntilDead * this.options.heartbeatIntervalMs;
|
|
744
|
+
if (this.passiveHeartbeatHandle) {
|
|
745
|
+
clearTimeout(this.passiveHeartbeatHandle);
|
|
746
|
+
this.passiveHeartbeatHandle = void 0;
|
|
747
|
+
}
|
|
748
|
+
this.passiveHeartbeatHandle = setTimeout(() => {
|
|
749
|
+
this.log?.info(
|
|
750
|
+
`closing connection to ${this.to} due to not receiving a heartbeat in the last ${duration}ms`,
|
|
751
|
+
this.loggingMetadata
|
|
752
|
+
);
|
|
753
|
+
this.telemetry.span.addEvent("closing connection due to inactivity");
|
|
754
|
+
this.conn.close();
|
|
755
|
+
this.passiveHeartbeatHandle = void 0;
|
|
756
|
+
}, duration);
|
|
757
|
+
}
|
|
741
758
|
sendHeartbeat() {
|
|
759
|
+
this.log?.debug("sending heartbeat", this.loggingMetadata);
|
|
742
760
|
this.send({
|
|
743
761
|
streamId: "heartbeat",
|
|
744
762
|
controlFlags: 1 /* AckBit */,
|
|
@@ -790,6 +808,7 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
790
808
|
});
|
|
791
809
|
if (!this.isActivelyHeartbeating) {
|
|
792
810
|
this.sendHeartbeat();
|
|
811
|
+
this.waitForNextHeartbeat();
|
|
793
812
|
}
|
|
794
813
|
};
|
|
795
814
|
_handleStateExit() {
|
|
@@ -797,8 +816,10 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
797
816
|
this.conn.removeDataListener(this.onMessageData);
|
|
798
817
|
this.conn.removeCloseListener(this.listeners.onConnectionClosed);
|
|
799
818
|
this.conn.removeErrorListener(this.listeners.onConnectionErrored);
|
|
800
|
-
clearInterval(this.
|
|
801
|
-
this.
|
|
819
|
+
clearInterval(this.activeHeartbeatHandle);
|
|
820
|
+
clearTimeout(this.passiveHeartbeatHandle);
|
|
821
|
+
this.activeHeartbeatHandle = void 0;
|
|
822
|
+
this.passiveHeartbeatHandle = void 0;
|
|
802
823
|
}
|
|
803
824
|
_handleClose() {
|
|
804
825
|
super._handleClose();
|
|
@@ -1711,10 +1732,10 @@ var ServerTransport = class extends Transport {
|
|
|
1711
1732
|
return;
|
|
1712
1733
|
}
|
|
1713
1734
|
let connectCase = "new session";
|
|
1735
|
+
const clientNextExpectedSeq = msg.payload.expectedSessionState.nextExpectedSeq;
|
|
1736
|
+
const clientNextSentSeq = msg.payload.expectedSessionState.nextSentSeq ?? 0;
|
|
1714
1737
|
if (oldSession && oldSession.id === msg.payload.sessionId) {
|
|
1715
1738
|
connectCase = "transparent reconnection";
|
|
1716
|
-
const clientNextExpectedSeq = msg.payload.expectedSessionState.nextExpectedSeq;
|
|
1717
|
-
const clientNextSentSeq = msg.payload.expectedSessionState.nextSentSeq ?? 0;
|
|
1718
1739
|
const ourNextSeq = oldSession.nextSeq();
|
|
1719
1740
|
const ourAck = oldSession.ack;
|
|
1720
1741
|
if (clientNextSentSeq > ourAck) {
|
|
@@ -1770,26 +1791,31 @@ var ServerTransport = class extends Transport {
|
|
|
1770
1791
|
this.updateSession(oldSession);
|
|
1771
1792
|
} else if (oldSession) {
|
|
1772
1793
|
connectCase = "hard reconnection";
|
|
1794
|
+
this.log?.info(
|
|
1795
|
+
`client is reconnecting to a new session (${msg.payload.sessionId}) with an old session (${oldSession.id}) already existing, closing old session`,
|
|
1796
|
+
{
|
|
1797
|
+
...session.loggingMetadata,
|
|
1798
|
+
connectedTo: msg.from,
|
|
1799
|
+
sessionId: msg.payload.sessionId
|
|
1800
|
+
}
|
|
1801
|
+
);
|
|
1773
1802
|
this.deleteSession(oldSession);
|
|
1774
1803
|
oldSession = void 0;
|
|
1775
|
-
}
|
|
1804
|
+
}
|
|
1805
|
+
if (!oldSession && (clientNextSentSeq > 0 || clientNextExpectedSeq > 0)) {
|
|
1776
1806
|
connectCase = "unknown session";
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
}
|
|
1790
|
-
);
|
|
1791
|
-
return;
|
|
1792
|
-
}
|
|
1807
|
+
this.rejectHandshakeRequest(
|
|
1808
|
+
session,
|
|
1809
|
+
msg.from,
|
|
1810
|
+
`client is trying to reconnect to a session the server don't know about: ${msg.payload.sessionId}`,
|
|
1811
|
+
"SESSION_STATE_MISMATCH",
|
|
1812
|
+
{
|
|
1813
|
+
...session.loggingMetadata,
|
|
1814
|
+
connectedTo: msg.from,
|
|
1815
|
+
transportMessage: msg
|
|
1816
|
+
}
|
|
1817
|
+
);
|
|
1818
|
+
return;
|
|
1793
1819
|
}
|
|
1794
1820
|
const sessionId = msg.payload.sessionId;
|
|
1795
1821
|
this.log?.info(
|