@replit/river 0.26.4 → 0.26.6
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-RSCUADHY.js → chunk-3NZ73HXL.js} +12 -7
- package/dist/chunk-3NZ73HXL.js.map +1 -0
- package/dist/{chunk-CYD6GTCU.js → chunk-5INVLQT5.js} +2 -2
- package/dist/{chunk-CYD6GTCU.js.map → chunk-5INVLQT5.js.map} +1 -1
- package/dist/{chunk-PXRKBNWN.js → chunk-APGOIQC4.js} +2 -2
- package/dist/{chunk-HPOR6FST.js → chunk-CER7XNCN.js} +13 -10
- package/dist/chunk-CER7XNCN.js.map +1 -0
- package/dist/{chunk-65EMTMCV.js → chunk-H2RVJ32Z.js} +4 -9
- package/dist/chunk-H2RVJ32Z.js.map +1 -0
- package/dist/{chunk-42SXIIHP.js → chunk-H677UET6.js} +20 -12
- package/dist/chunk-H677UET6.js.map +1 -0
- package/dist/{chunk-DS5LF6PS.js → chunk-J7AQMYUQ.js} +9 -9
- package/dist/chunk-J7AQMYUQ.js.map +1 -0
- package/dist/{chunk-TAH2GVTJ.js → chunk-MZM234IB.js} +1 -1
- package/dist/chunk-MZM234IB.js.map +1 -0
- package/dist/{client-6c67339a.d.ts → client-96810511.d.ts} +2 -2
- package/dist/{connection-03ffb583.d.ts → connection-48133ec3.d.ts} +1 -1
- package/dist/{handshake-154a0bb2.d.ts → handshake-65e0e848.d.ts} +8 -3
- package/dist/logging/index.cjs.map +1 -1
- package/dist/logging/index.d.cts +1 -1
- package/dist/logging/index.d.ts +1 -1
- package/dist/logging/index.js +1 -1
- package/dist/{message-ff78a233.d.ts → message-e917ee98.d.ts} +1 -1
- package/dist/router/index.cjs +3 -8
- package/dist/router/index.cjs.map +1 -1
- package/dist/router/index.d.cts +8 -8
- package/dist/router/index.d.ts +8 -8
- package/dist/router/index.js +2 -2
- package/dist/{server-1f5eb427.d.ts → server-b8aaf116.d.ts} +3 -3
- package/dist/{services-6140f578.d.ts → services-40e7c5cf.d.ts} +3 -3
- package/dist/transport/impls/ws/client.cjs +38 -27
- package/dist/transport/impls/ws/client.cjs.map +1 -1
- package/dist/transport/impls/ws/client.d.cts +4 -4
- package/dist/transport/impls/ws/client.d.ts +4 -4
- package/dist/transport/impls/ws/client.js +6 -6
- package/dist/transport/impls/ws/server.cjs +34 -26
- package/dist/transport/impls/ws/server.cjs.map +1 -1
- package/dist/transport/impls/ws/server.d.cts +4 -4
- package/dist/transport/impls/ws/server.d.ts +4 -4
- package/dist/transport/impls/ws/server.js +6 -6
- package/dist/transport/index.cjs +43 -32
- package/dist/transport/index.cjs.map +1 -1
- package/dist/transport/index.d.cts +4 -4
- package/dist/transport/index.d.ts +4 -4
- package/dist/transport/index.js +6 -6
- package/dist/util/testHelpers.cjs +21 -18
- package/dist/util/testHelpers.cjs.map +1 -1
- package/dist/util/testHelpers.d.cts +4 -4
- package/dist/util/testHelpers.d.ts +4 -4
- package/dist/util/testHelpers.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-42SXIIHP.js.map +0 -1
- package/dist/chunk-65EMTMCV.js.map +0 -1
- package/dist/chunk-DS5LF6PS.js.map +0 -1
- package/dist/chunk-HPOR6FST.js.map +0 -1
- package/dist/chunk-RSCUADHY.js.map +0 -1
- package/dist/chunk-TAH2GVTJ.js.map +0 -1
- /package/dist/{chunk-PXRKBNWN.js.map → chunk-APGOIQC4.js.map} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { c as TransportClientId } from '../../../message-
|
|
1
|
+
import { c as TransportClientId } from '../../../message-e917ee98.js';
|
|
2
2
|
import { WebSocketServer } from 'ws';
|
|
3
|
-
import { W as WebSocketConnection } from '../../../connection-
|
|
3
|
+
import { W as WebSocketConnection } from '../../../connection-48133ec3.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-b8aaf116.js';
|
|
6
|
+
import { c as ProvidedServerTransportOptions } from '../../../handshake-65e0e848.js';
|
|
7
7
|
import '@sinclair/typebox/value';
|
|
8
8
|
import '@sinclair/typebox';
|
|
9
9
|
import '@opentelemetry/api';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { c as TransportClientId } from '../../../message-
|
|
1
|
+
import { c as TransportClientId } from '../../../message-e917ee98.js';
|
|
2
2
|
import { WebSocketServer } from 'ws';
|
|
3
|
-
import { W as WebSocketConnection } from '../../../connection-
|
|
3
|
+
import { W as WebSocketConnection } from '../../../connection-48133ec3.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-b8aaf116.js';
|
|
6
|
+
import { c as ProvidedServerTransportOptions } from '../../../handshake-65e0e848.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-J7AQMYUQ.js";
|
|
4
4
|
import {
|
|
5
5
|
WebSocketConnection
|
|
6
|
-
} from "../../../chunk-
|
|
7
|
-
import "../../../chunk-
|
|
8
|
-
import "../../../chunk-
|
|
9
|
-
import "../../../chunk-
|
|
10
|
-
import "../../../chunk-
|
|
6
|
+
} from "../../../chunk-5INVLQT5.js";
|
|
7
|
+
import "../../../chunk-3NZ73HXL.js";
|
|
8
|
+
import "../../../chunk-MZM234IB.js";
|
|
9
|
+
import "../../../chunk-H677UET6.js";
|
|
10
|
+
import "../../../chunk-H2RVJ32Z.js";
|
|
11
11
|
import "../../../chunk-4PVU7J25.js";
|
|
12
12
|
|
|
13
13
|
// transport/impls/ws/server.ts
|
package/dist/transport/index.cjs
CHANGED
|
@@ -88,7 +88,8 @@ var createLogProxy = (log) => ({
|
|
|
88
88
|
var ProtocolError = {
|
|
89
89
|
RetriesExceeded: "conn_retry_exceeded",
|
|
90
90
|
HandshakeFailed: "handshake_failed",
|
|
91
|
-
MessageOrderingViolated: "message_ordering_violated"
|
|
91
|
+
MessageOrderingViolated: "message_ordering_violated",
|
|
92
|
+
InvalidMessage: "invalid_message"
|
|
92
93
|
};
|
|
93
94
|
var EventDispatcher = class {
|
|
94
95
|
eventListeners = {};
|
|
@@ -246,10 +247,7 @@ var ControlMessageHandshakeRequestSchema = import_typebox.Type.Object({
|
|
|
246
247
|
expectedSessionState: import_typebox.Type.Object({
|
|
247
248
|
// what the client expects the server to send next
|
|
248
249
|
nextExpectedSeq: import_typebox.Type.Integer(),
|
|
249
|
-
|
|
250
|
-
// are nextSentSeq here
|
|
251
|
-
// what the server expects the client to send next
|
|
252
|
-
nextSentSeq: import_typebox.Type.Optional(import_typebox.Type.Integer())
|
|
250
|
+
nextSentSeq: import_typebox.Type.Integer()
|
|
253
251
|
}),
|
|
254
252
|
metadata: import_typebox.Type.Optional(import_typebox.Type.Unknown())
|
|
255
253
|
});
|
|
@@ -285,9 +283,7 @@ var ControlMessageHandshakeResponseSchema = import_typebox.Type.Object({
|
|
|
285
283
|
import_typebox.Type.Object({
|
|
286
284
|
ok: import_typebox.Type.Literal(false),
|
|
287
285
|
reason: import_typebox.Type.String(),
|
|
288
|
-
|
|
289
|
-
// are sending code here
|
|
290
|
-
code: import_typebox.Type.Optional(HandshakeErrorResponseCodes)
|
|
286
|
+
code: HandshakeErrorResponseCodes
|
|
291
287
|
})
|
|
292
288
|
])
|
|
293
289
|
});
|
|
@@ -601,7 +597,7 @@ var SessionNoConnection = class extends IdentifiedSessionWithGracePeriod {
|
|
|
601
597
|
var import_api = require("@opentelemetry/api");
|
|
602
598
|
|
|
603
599
|
// package.json
|
|
604
|
-
var version = "0.26.
|
|
600
|
+
var version = "0.26.6";
|
|
605
601
|
|
|
606
602
|
// tracing/index.ts
|
|
607
603
|
function getPropagationContext(ctx) {
|
|
@@ -763,13 +759,13 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
763
759
|
this.conn.addCloseListener(this.listeners.onConnectionClosed);
|
|
764
760
|
this.conn.addErrorListener(this.listeners.onConnectionErrored);
|
|
765
761
|
if (this.sendBuffer.length > 0) {
|
|
766
|
-
this.log?.
|
|
767
|
-
`sending ${this.sendBuffer.length} buffered messages`,
|
|
762
|
+
this.log?.info(
|
|
763
|
+
`sending ${this.sendBuffer.length} buffered messages, starting at seq ${this.nextSeq()}`,
|
|
768
764
|
this.loggingMetadata
|
|
769
765
|
);
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
766
|
+
for (const msg of this.sendBuffer) {
|
|
767
|
+
this.conn.send(this.options.codec.toBuffer(msg));
|
|
768
|
+
}
|
|
773
769
|
}
|
|
774
770
|
this.isActivelyHeartbeating = false;
|
|
775
771
|
this.heartbeatHandle = setInterval(() => {
|
|
@@ -811,6 +807,12 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
811
807
|
}
|
|
812
808
|
});
|
|
813
809
|
}
|
|
810
|
+
closeConnection() {
|
|
811
|
+
this.conn.removeDataListener(this.onMessageData);
|
|
812
|
+
this.conn.removeCloseListener(this.listeners.onConnectionClosed);
|
|
813
|
+
this.conn.removeErrorListener(this.listeners.onConnectionErrored);
|
|
814
|
+
this.conn.close();
|
|
815
|
+
}
|
|
814
816
|
onMessageData = (msg) => {
|
|
815
817
|
const parsedMsg = this.parseMsg(msg);
|
|
816
818
|
if (parsedMsg === null) {
|
|
@@ -827,8 +829,8 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
827
829
|
}
|
|
828
830
|
);
|
|
829
831
|
} else {
|
|
830
|
-
const reason = `received out-of-order msg (got seq: ${parsedMsg.seq}, wanted seq: ${this.ack})`;
|
|
831
|
-
this.log?.
|
|
832
|
+
const reason = `received out-of-order msg, closing connection (got seq: ${parsedMsg.seq}, wanted seq: ${this.ack})`;
|
|
833
|
+
this.log?.warn(reason, {
|
|
832
834
|
...this.loggingMetadata,
|
|
833
835
|
transportMessage: parsedMsg,
|
|
834
836
|
tags: ["invariant-violation"]
|
|
@@ -837,7 +839,7 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
837
839
|
code: import_api2.SpanStatusCode.ERROR,
|
|
838
840
|
message: reason
|
|
839
841
|
});
|
|
840
|
-
this.
|
|
842
|
+
this.closeConnection();
|
|
841
843
|
}
|
|
842
844
|
return;
|
|
843
845
|
}
|
|
@@ -863,8 +865,10 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
863
865
|
this.conn.removeDataListener(this.onMessageData);
|
|
864
866
|
this.conn.removeCloseListener(this.listeners.onConnectionClosed);
|
|
865
867
|
this.conn.removeErrorListener(this.listeners.onConnectionErrored);
|
|
866
|
-
|
|
867
|
-
|
|
868
|
+
if (this.heartbeatHandle) {
|
|
869
|
+
clearInterval(this.heartbeatHandle);
|
|
870
|
+
this.heartbeatHandle = void 0;
|
|
871
|
+
}
|
|
868
872
|
}
|
|
869
873
|
_handleClose() {
|
|
870
874
|
super._handleClose();
|
|
@@ -1293,8 +1297,12 @@ var Transport = class {
|
|
|
1293
1297
|
return session;
|
|
1294
1298
|
}
|
|
1295
1299
|
// state transitions
|
|
1296
|
-
deleteSession(session) {
|
|
1297
|
-
|
|
1300
|
+
deleteSession(session, options) {
|
|
1301
|
+
const loggingMetadata = session.loggingMetadata;
|
|
1302
|
+
if (loggingMetadata.tags && options?.unhealthy) {
|
|
1303
|
+
loggingMetadata.tags.push("unhealthy-session");
|
|
1304
|
+
}
|
|
1305
|
+
session.log?.info(`closing session ${session.id}`, loggingMetadata);
|
|
1298
1306
|
this.eventDispatcher.dispatchEvent("sessionStatus", {
|
|
1299
1307
|
status: "disconnect",
|
|
1300
1308
|
session
|
|
@@ -1526,7 +1534,7 @@ var ClientTransport = class extends Transport {
|
|
|
1526
1534
|
`invalid handshake: ${reason}`,
|
|
1527
1535
|
handshakingSession.loggingMetadata
|
|
1528
1536
|
);
|
|
1529
|
-
this.deleteSession(session);
|
|
1537
|
+
this.deleteSession(session, { unhealthy: true });
|
|
1530
1538
|
this.protocolError({
|
|
1531
1539
|
type: ProtocolError.HandshakeFailed,
|
|
1532
1540
|
code,
|
|
@@ -1555,7 +1563,7 @@ var ClientTransport = class extends Transport {
|
|
|
1555
1563
|
message: reason
|
|
1556
1564
|
});
|
|
1557
1565
|
this.log?.warn(reason, metadata);
|
|
1558
|
-
this.deleteSession(session);
|
|
1566
|
+
this.deleteSession(session, { unhealthy: true });
|
|
1559
1567
|
}
|
|
1560
1568
|
onHandshakeResponse(session, msg) {
|
|
1561
1569
|
if (!import_value2.Value.Check(ControlMessageHandshakeResponseSchema, msg.payload)) {
|
|
@@ -1570,10 +1578,10 @@ var ClientTransport = class extends Transport {
|
|
|
1570
1578
|
return;
|
|
1571
1579
|
}
|
|
1572
1580
|
if (!msg.payload.status.ok) {
|
|
1573
|
-
const retriable =
|
|
1581
|
+
const retriable = import_value2.Value.Check(
|
|
1574
1582
|
HandshakeErrorRetriableResponseCodes,
|
|
1575
1583
|
msg.payload.status.code
|
|
1576
|
-
)
|
|
1584
|
+
);
|
|
1577
1585
|
const reason = `handshake failed: ${msg.payload.status.reason}`;
|
|
1578
1586
|
const to = session.to;
|
|
1579
1587
|
this.rejectHandshakeResponse(session, reason, {
|
|
@@ -1620,9 +1628,9 @@ var ClientTransport = class extends Transport {
|
|
|
1620
1628
|
},
|
|
1621
1629
|
onMessage: (msg2) => this.handleMsg(msg2),
|
|
1622
1630
|
onInvalidMessage: (reason) => {
|
|
1623
|
-
this.deleteSession(connectedSession);
|
|
1631
|
+
this.deleteSession(connectedSession, { unhealthy: true });
|
|
1624
1632
|
this.protocolError({
|
|
1625
|
-
type: ProtocolError.
|
|
1633
|
+
type: ProtocolError.InvalidMessage,
|
|
1626
1634
|
message: reason
|
|
1627
1635
|
});
|
|
1628
1636
|
}
|
|
@@ -1734,6 +1742,9 @@ var ClientTransport = class extends Transport {
|
|
|
1734
1742
|
if (this.handshakeExtensions) {
|
|
1735
1743
|
metadata = await this.handshakeExtensions.construct();
|
|
1736
1744
|
}
|
|
1745
|
+
if (session._isConsumed) {
|
|
1746
|
+
return;
|
|
1747
|
+
}
|
|
1737
1748
|
const requestMsg = handshakeRequestMessage({
|
|
1738
1749
|
from: this.clientId,
|
|
1739
1750
|
to: session.to,
|
|
@@ -1816,9 +1827,9 @@ var ServerTransport = class extends Transport {
|
|
|
1816
1827
|
pendingSession.close();
|
|
1817
1828
|
this.pendingSessions.delete(pendingSession);
|
|
1818
1829
|
}
|
|
1819
|
-
deleteSession(session) {
|
|
1830
|
+
deleteSession(session, options) {
|
|
1820
1831
|
this.sessionHandshakeMetadata.delete(session.to);
|
|
1821
|
-
super.deleteSession(session);
|
|
1832
|
+
super.deleteSession(session, options);
|
|
1822
1833
|
}
|
|
1823
1834
|
handleConnection(conn) {
|
|
1824
1835
|
if (this.getStatus() !== "open")
|
|
@@ -1996,7 +2007,7 @@ var ServerTransport = class extends Transport {
|
|
|
1996
2007
|
}
|
|
1997
2008
|
let connectCase = "new session";
|
|
1998
2009
|
const clientNextExpectedSeq = msg.payload.expectedSessionState.nextExpectedSeq;
|
|
1999
|
-
const clientNextSentSeq = msg.payload.expectedSessionState.nextSentSeq
|
|
2010
|
+
const clientNextSentSeq = msg.payload.expectedSessionState.nextSentSeq;
|
|
2000
2011
|
if (this.options.enableTransparentSessionReconnects && oldSession && oldSession.id === msg.payload.sessionId) {
|
|
2001
2012
|
connectCase = "transparent reconnection";
|
|
2002
2013
|
const ourNextSeq = oldSession.nextSeq();
|
|
@@ -2112,10 +2123,10 @@ var ServerTransport = class extends Transport {
|
|
|
2112
2123
|
onMessage: (msg2) => this.handleMsg(msg2),
|
|
2113
2124
|
onInvalidMessage: (reason) => {
|
|
2114
2125
|
this.protocolError({
|
|
2115
|
-
type: ProtocolError.
|
|
2126
|
+
type: ProtocolError.InvalidMessage,
|
|
2116
2127
|
message: reason
|
|
2117
2128
|
});
|
|
2118
|
-
this.deleteSession(connectedSession);
|
|
2129
|
+
this.deleteSession(connectedSession, { unhealthy: true });
|
|
2119
2130
|
}
|
|
2120
2131
|
}
|
|
2121
2132
|
);
|