@replit/river 0.25.2 → 0.26.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-GDHQCPWW.js → chunk-4W5LENT2.js} +2 -2
- package/dist/{chunk-GDHQCPWW.js.map → chunk-4W5LENT2.js.map} +1 -1
- package/dist/{chunk-PF74DCPQ.js → chunk-6UVTCZ6K.js} +5 -5
- package/dist/chunk-6UVTCZ6K.js.map +1 -0
- package/dist/{chunk-ZWMWRM23.js → chunk-AYIMQWS7.js} +2 -2
- package/dist/{chunk-QXMZJ7LF.js → chunk-IVNX5H6C.js} +56 -44
- package/dist/chunk-IVNX5H6C.js.map +1 -0
- package/dist/{chunk-Q3PZBJXR.js → chunk-M43R4RPL.js} +10 -4
- package/dist/chunk-M43R4RPL.js.map +1 -0
- package/dist/{chunk-EHD2JJBW.js → chunk-UQOD22AN.js} +14 -4
- package/dist/chunk-UQOD22AN.js.map +1 -0
- package/dist/{chunk-ONIPHO7J.js → chunk-XRI2BXMM.js} +23 -9
- package/dist/chunk-XRI2BXMM.js.map +1 -0
- package/dist/{client-edc8e2de.d.ts → client-0f636b3a.d.ts} +2 -2
- package/dist/{connection-ef50ac3a.d.ts → connection-07e97a79.d.ts} +1 -1
- package/dist/{handshake-12d57161.d.ts → handshake-8752f79e.d.ts} +10 -6
- package/dist/logging/index.d.cts +1 -1
- package/dist/logging/index.d.ts +1 -1
- package/dist/{message-e6c560fd.d.ts → message-57296605.d.ts} +3 -1
- package/dist/router/index.cjs +12 -3
- 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-f8228636.d.ts → server-e304daec.d.ts} +2 -2
- package/dist/{services-4b9e5232.d.ts → services-fc99aae1.d.ts} +3 -3
- package/dist/transport/impls/ws/client.cjs +41 -12
- 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 +5 -5
- package/dist/transport/impls/ws/server.cjs +73 -47
- 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 +5 -5
- package/dist/transport/index.cjs +92 -52
- 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 +5 -5
- package/dist/util/testHelpers.cjs +20 -5
- 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-EHD2JJBW.js.map +0 -1
- package/dist/chunk-ONIPHO7J.js.map +0 -1
- package/dist/chunk-PF74DCPQ.js.map +0 -1
- package/dist/chunk-Q3PZBJXR.js.map +0 -1
- package/dist/chunk-QXMZJ7LF.js.map +0 -1
- /package/dist/{chunk-ZWMWRM23.js.map → chunk-AYIMQWS7.js.map} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { c as TransportClientId } from '../../../message-
|
|
1
|
+
import { c as TransportClientId } from '../../../message-57296605.js';
|
|
2
2
|
import { WebSocketServer } from 'ws';
|
|
3
|
-
import { W as WebSocketConnection } from '../../../connection-
|
|
3
|
+
import { W as WebSocketConnection } from '../../../connection-07e97a79.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-e304daec.js';
|
|
6
|
+
import { c as ProvidedServerTransportOptions } from '../../../handshake-8752f79e.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-57296605.js';
|
|
2
2
|
import { WebSocketServer } from 'ws';
|
|
3
|
-
import { W as WebSocketConnection } from '../../../connection-
|
|
3
|
+
import { W as WebSocketConnection } from '../../../connection-07e97a79.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-e304daec.js';
|
|
6
|
+
import { c as ProvidedServerTransportOptions } from '../../../handshake-8752f79e.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-IVNX5H6C.js";
|
|
4
4
|
import {
|
|
5
5
|
WebSocketConnection
|
|
6
|
-
} from "../../../chunk-
|
|
7
|
-
import "../../../chunk-
|
|
6
|
+
} from "../../../chunk-AYIMQWS7.js";
|
|
7
|
+
import "../../../chunk-6UVTCZ6K.js";
|
|
8
8
|
import "../../../chunk-TAH2GVTJ.js";
|
|
9
|
-
import "../../../chunk-
|
|
10
|
-
import "../../../chunk-
|
|
9
|
+
import "../../../chunk-M43R4RPL.js";
|
|
10
|
+
import "../../../chunk-UQOD22AN.js";
|
|
11
11
|
import "../../../chunk-4PVU7J25.js";
|
|
12
12
|
|
|
13
13
|
// transport/impls/ws/server.ts
|
package/dist/transport/index.cjs
CHANGED
|
@@ -255,11 +255,20 @@ var ControlMessageHandshakeRequestSchema = import_typebox.Type.Object({
|
|
|
255
255
|
var HandshakeErrorRetriableResponseCodes = import_typebox.Type.Union([
|
|
256
256
|
import_typebox.Type.Literal("SESSION_STATE_MISMATCH")
|
|
257
257
|
]);
|
|
258
|
+
var HandshakeErrorCustomHandlerFatalResponseCodes = import_typebox.Type.Union([
|
|
259
|
+
// The custom validation handler rejected the handler because the client is unsupported.
|
|
260
|
+
import_typebox.Type.Literal("REJECTED_UNSUPPORTED_CLIENT"),
|
|
261
|
+
// The custom validation handler rejected the handshake.
|
|
262
|
+
import_typebox.Type.Literal("REJECTED_BY_CUSTOM_HANDLER")
|
|
263
|
+
]);
|
|
258
264
|
var HandshakeErrorFatalResponseCodes = import_typebox.Type.Union([
|
|
265
|
+
HandshakeErrorCustomHandlerFatalResponseCodes,
|
|
266
|
+
// The ciient sent a handshake that doesn't comply with the extended handshake metadata.
|
|
259
267
|
import_typebox.Type.Literal("MALFORMED_HANDSHAKE_META"),
|
|
268
|
+
// The ciient sent a handshake that doesn't comply with ControlMessageHandshakeRequestSchema.
|
|
260
269
|
import_typebox.Type.Literal("MALFORMED_HANDSHAKE"),
|
|
261
|
-
|
|
262
|
-
import_typebox.Type.Literal("
|
|
270
|
+
// The client's protocol version does not match the server's.
|
|
271
|
+
import_typebox.Type.Literal("PROTOCOL_VERSION_MISMATCH")
|
|
263
272
|
]);
|
|
264
273
|
var HandshakeErrorResponseCodes = import_typebox.Type.Union([
|
|
265
274
|
HandshakeErrorRetriableResponseCodes,
|
|
@@ -564,7 +573,7 @@ var SessionNoConnection = class extends IdentifiedSession {
|
|
|
564
573
|
var import_api = require("@opentelemetry/api");
|
|
565
574
|
|
|
566
575
|
// package.json
|
|
567
|
-
var version = "0.
|
|
576
|
+
var version = "0.26.1";
|
|
568
577
|
|
|
569
578
|
// tracing/index.ts
|
|
570
579
|
function getPropagationContext(ctx) {
|
|
@@ -615,7 +624,10 @@ var SessionWaitingForHandshake = class extends CommonSession {
|
|
|
615
624
|
onHandshakeData = (msg) => {
|
|
616
625
|
const parsedMsg = this.parseMsg(msg);
|
|
617
626
|
if (parsedMsg === null) {
|
|
618
|
-
this.listeners.onInvalidHandshake(
|
|
627
|
+
this.listeners.onInvalidHandshake(
|
|
628
|
+
"could not parse message",
|
|
629
|
+
"MALFORMED_HANDSHAKE"
|
|
630
|
+
);
|
|
619
631
|
return;
|
|
620
632
|
}
|
|
621
633
|
this.listeners.onHandshake(parsedMsg);
|
|
@@ -661,7 +673,10 @@ var SessionHandshaking = class extends IdentifiedSession {
|
|
|
661
673
|
onHandshakeData = (msg) => {
|
|
662
674
|
const parsedMsg = this.parseMsg(msg);
|
|
663
675
|
if (parsedMsg === null) {
|
|
664
|
-
this.listeners.onInvalidHandshake(
|
|
676
|
+
this.listeners.onInvalidHandshake(
|
|
677
|
+
"could not parse message",
|
|
678
|
+
"MALFORMED_HANDSHAKE"
|
|
679
|
+
);
|
|
665
680
|
return;
|
|
666
681
|
}
|
|
667
682
|
this.listeners.onHandshake(parsedMsg);
|
|
@@ -1151,8 +1166,8 @@ var Transport = class {
|
|
|
1151
1166
|
removeEventListener(type, handler) {
|
|
1152
1167
|
this.eventDispatcher.removeEventListener(type, handler);
|
|
1153
1168
|
}
|
|
1154
|
-
protocolError(
|
|
1155
|
-
this.eventDispatcher.dispatchEvent("protocolError",
|
|
1169
|
+
protocolError(message) {
|
|
1170
|
+
this.eventDispatcher.dispatchEvent("protocolError", message);
|
|
1156
1171
|
}
|
|
1157
1172
|
/**
|
|
1158
1173
|
* Default close implementation for transports. You should override this in the downstream
|
|
@@ -1416,13 +1431,17 @@ var ClientTransport = class extends Transport {
|
|
|
1416
1431
|
onHandshake: (msg) => {
|
|
1417
1432
|
this.onHandshakeResponse(handshakingSession, msg);
|
|
1418
1433
|
},
|
|
1419
|
-
onInvalidHandshake: (reason) => {
|
|
1434
|
+
onInvalidHandshake: (reason, code) => {
|
|
1420
1435
|
this.log?.error(
|
|
1421
1436
|
`invalid handshake: ${reason}`,
|
|
1422
1437
|
handshakingSession.loggingMetadata
|
|
1423
1438
|
);
|
|
1424
1439
|
this.deleteSession(session);
|
|
1425
|
-
this.protocolError(
|
|
1440
|
+
this.protocolError({
|
|
1441
|
+
type: ProtocolError.HandshakeFailed,
|
|
1442
|
+
code,
|
|
1443
|
+
message: reason
|
|
1444
|
+
});
|
|
1426
1445
|
},
|
|
1427
1446
|
onHandshakeTimeout: () => {
|
|
1428
1447
|
this.log?.error(
|
|
@@ -1471,7 +1490,11 @@ var ClientTransport = class extends Transport {
|
|
|
1471
1490
|
this.tryReconnecting(session.to);
|
|
1472
1491
|
} else {
|
|
1473
1492
|
this.deleteSession(session);
|
|
1474
|
-
this.protocolError(
|
|
1493
|
+
this.protocolError({
|
|
1494
|
+
type: ProtocolError.HandshakeFailed,
|
|
1495
|
+
code: msg.payload.status.code,
|
|
1496
|
+
message: reason
|
|
1497
|
+
});
|
|
1475
1498
|
}
|
|
1476
1499
|
return;
|
|
1477
1500
|
}
|
|
@@ -1505,7 +1528,10 @@ var ClientTransport = class extends Transport {
|
|
|
1505
1528
|
onMessage: (msg2) => this.handleMsg(msg2),
|
|
1506
1529
|
onInvalidMessage: (reason) => {
|
|
1507
1530
|
this.deleteSession(connectedSession);
|
|
1508
|
-
this.protocolError(
|
|
1531
|
+
this.protocolError({
|
|
1532
|
+
type: ProtocolError.MessageOrderingViolated,
|
|
1533
|
+
message: reason
|
|
1534
|
+
});
|
|
1509
1535
|
}
|
|
1510
1536
|
});
|
|
1511
1537
|
this.updateSession(connectedSession);
|
|
@@ -1536,7 +1562,10 @@ var ClientTransport = class extends Transport {
|
|
|
1536
1562
|
const budgetConsumed = this.retryBudget.getBudgetConsumed();
|
|
1537
1563
|
const errMsg = `tried to connect to ${to} but retry budget exceeded (more than ${budgetConsumed} attempts in the last ${this.retryBudget.totalBudgetRestoreTime}ms)`;
|
|
1538
1564
|
this.log?.error(errMsg, session.loggingMetadata);
|
|
1539
|
-
this.protocolError(
|
|
1565
|
+
this.protocolError({
|
|
1566
|
+
type: ProtocolError.RetriesExceeded,
|
|
1567
|
+
message: errMsg
|
|
1568
|
+
});
|
|
1540
1569
|
return;
|
|
1541
1570
|
}
|
|
1542
1571
|
const backoffMs = this.retryBudget.getBackoffMs();
|
|
@@ -1743,13 +1772,17 @@ var ServerTransport = class extends Transport {
|
|
|
1743
1772
|
receivedHandshake = true;
|
|
1744
1773
|
void this.onHandshakeRequest(pendingSession, msg);
|
|
1745
1774
|
},
|
|
1746
|
-
onInvalidHandshake: (reason) => {
|
|
1775
|
+
onInvalidHandshake: (reason, code) => {
|
|
1747
1776
|
this.log?.error(
|
|
1748
1777
|
`invalid handshake: ${reason}`,
|
|
1749
1778
|
pendingSession.loggingMetadata
|
|
1750
1779
|
);
|
|
1751
1780
|
this.deletePendingSession(pendingSession);
|
|
1752
|
-
this.protocolError(
|
|
1781
|
+
this.protocolError({
|
|
1782
|
+
type: ProtocolError.HandshakeFailed,
|
|
1783
|
+
code,
|
|
1784
|
+
message: reason
|
|
1785
|
+
});
|
|
1753
1786
|
}
|
|
1754
1787
|
},
|
|
1755
1788
|
this.options,
|
|
@@ -1774,7 +1807,11 @@ var ServerTransport = class extends Transport {
|
|
|
1774
1807
|
}
|
|
1775
1808
|
})
|
|
1776
1809
|
);
|
|
1777
|
-
this.protocolError(
|
|
1810
|
+
this.protocolError({
|
|
1811
|
+
type: ProtocolError.HandshakeFailed,
|
|
1812
|
+
code,
|
|
1813
|
+
message: reason
|
|
1814
|
+
});
|
|
1778
1815
|
this.deletePendingSession(session);
|
|
1779
1816
|
}
|
|
1780
1817
|
async onHandshakeRequest(session, msg) {
|
|
@@ -1936,7 +1973,10 @@ var ServerTransport = class extends Transport {
|
|
|
1936
1973
|
},
|
|
1937
1974
|
onMessage: (msg2) => this.handleMsg(msg2),
|
|
1938
1975
|
onInvalidMessage: (reason) => {
|
|
1939
|
-
this.protocolError(
|
|
1976
|
+
this.protocolError({
|
|
1977
|
+
type: ProtocolError.MessageOrderingViolated,
|
|
1978
|
+
message: reason
|
|
1979
|
+
});
|
|
1940
1980
|
this.deleteSession(connectedSession);
|
|
1941
1981
|
}
|
|
1942
1982
|
}
|
|
@@ -1947,43 +1987,43 @@ var ServerTransport = class extends Transport {
|
|
|
1947
1987
|
connectedSession.startActiveHeartbeat();
|
|
1948
1988
|
}
|
|
1949
1989
|
async validateHandshakeMetadata(handshakingSession, existingSession, rawMetadata, from) {
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
return false;
|
|
1967
|
-
}
|
|
1968
|
-
const previousParsedMetadata = existingSession ? this.sessionHandshakeMetadata.get(existingSession.to) : void 0;
|
|
1969
|
-
parsedMetadata = await this.handshakeExtensions.validate(
|
|
1970
|
-
rawMetadata,
|
|
1971
|
-
previousParsedMetadata
|
|
1990
|
+
if (!this.handshakeExtensions) {
|
|
1991
|
+
return {};
|
|
1992
|
+
}
|
|
1993
|
+
if (!import_value3.Value.Check(this.handshakeExtensions.schema, rawMetadata)) {
|
|
1994
|
+
this.rejectHandshakeRequest(
|
|
1995
|
+
handshakingSession,
|
|
1996
|
+
from,
|
|
1997
|
+
"received malformed handshake metadata",
|
|
1998
|
+
"MALFORMED_HANDSHAKE_META",
|
|
1999
|
+
{
|
|
2000
|
+
...handshakingSession.loggingMetadata,
|
|
2001
|
+
connectedTo: from,
|
|
2002
|
+
validationErrors: [
|
|
2003
|
+
...import_value3.Value.Errors(this.handshakeExtensions.schema, rawMetadata)
|
|
2004
|
+
]
|
|
2005
|
+
}
|
|
1972
2006
|
);
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
2007
|
+
return false;
|
|
2008
|
+
}
|
|
2009
|
+
const previousParsedMetadata = existingSession ? this.sessionHandshakeMetadata.get(existingSession.to) : void 0;
|
|
2010
|
+
const parsedMetadata = await this.handshakeExtensions.validate(
|
|
2011
|
+
rawMetadata,
|
|
2012
|
+
previousParsedMetadata
|
|
2013
|
+
);
|
|
2014
|
+
if (import_value3.Value.Check(HandshakeErrorCustomHandlerFatalResponseCodes, parsedMetadata)) {
|
|
2015
|
+
this.rejectHandshakeRequest(
|
|
2016
|
+
handshakingSession,
|
|
2017
|
+
from,
|
|
2018
|
+
"rejected by handshake handler",
|
|
2019
|
+
parsedMetadata,
|
|
2020
|
+
{
|
|
2021
|
+
...handshakingSession.loggingMetadata,
|
|
2022
|
+
connectedTo: from,
|
|
2023
|
+
clientId: this.clientId
|
|
2024
|
+
}
|
|
2025
|
+
);
|
|
2026
|
+
return false;
|
|
1987
2027
|
}
|
|
1988
2028
|
return parsedMetadata;
|
|
1989
2029
|
}
|