@replit/river 0.26.2 → 0.26.4
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-NC54BC47.js → chunk-42SXIIHP.js} +45 -17
- package/dist/chunk-42SXIIHP.js.map +1 -0
- package/dist/{chunk-M75K5TJS.js → chunk-65EMTMCV.js} +2 -2
- package/dist/{chunk-M75K5TJS.js.map → chunk-65EMTMCV.js.map} +1 -1
- package/dist/{chunk-AWCUCZY4.js → chunk-CYD6GTCU.js} +2 -2
- package/dist/{chunk-YQABPD3C.js → chunk-DS5LF6PS.js} +51 -56
- package/dist/chunk-DS5LF6PS.js.map +1 -0
- package/dist/{chunk-IV27BICV.js → chunk-HPOR6FST.js} +30 -31
- package/dist/chunk-HPOR6FST.js.map +1 -0
- package/dist/{chunk-MREEJE3X.js → chunk-PXRKBNWN.js} +2 -2
- package/dist/{chunk-M5X4JTU3.js → chunk-RSCUADHY.js} +5 -4
- package/dist/{chunk-M5X4JTU3.js.map → chunk-RSCUADHY.js.map} +1 -1
- package/dist/{client-654098be.d.ts → client-6c67339a.d.ts} +3 -3
- package/dist/{connection-bc2454dc.d.ts → connection-03ffb583.d.ts} +1 -1
- package/dist/{handshake-1a86f06d.d.ts → handshake-154a0bb2.d.ts} +30 -1
- package/dist/logging/index.d.cts +1 -1
- package/dist/logging/index.d.ts +1 -1
- package/dist/{message-57296605.d.ts → message-ff78a233.d.ts} +1 -1
- package/dist/router/index.cjs +1 -1
- package/dist/router/index.cjs.map +1 -1
- package/dist/router/index.d.cts +9 -8
- package/dist/router/index.d.ts +9 -8
- package/dist/router/index.js +2 -2
- package/dist/{server-9a6b5a8e.d.ts → server-1f5eb427.d.ts} +17 -4
- package/dist/{services-7daa60a0.d.ts → services-6140f578.d.ts} +3 -3
- package/dist/transport/impls/ws/client.cjs +75 -46
- package/dist/transport/impls/ws/client.cjs.map +1 -1
- package/dist/transport/impls/ws/client.d.cts +5 -4
- package/dist/transport/impls/ws/client.d.ts +5 -4
- package/dist/transport/impls/ws/client.js +8 -7
- package/dist/transport/impls/ws/client.js.map +1 -1
- package/dist/transport/impls/ws/server.cjs +93 -69
- package/dist/transport/impls/ws/server.cjs.map +1 -1
- package/dist/transport/impls/ws/server.d.cts +5 -4
- package/dist/transport/impls/ws/server.d.ts +5 -4
- package/dist/transport/impls/ws/server.js +5 -5
- package/dist/transport/index.cjs +119 -96
- package/dist/transport/index.cjs.map +1 -1
- package/dist/transport/index.d.cts +5 -4
- package/dist/transport/index.d.ts +5 -4
- package/dist/transport/index.js +5 -5
- package/dist/util/testHelpers.cjs +44 -16
- package/dist/util/testHelpers.cjs.map +1 -1
- package/dist/util/testHelpers.d.cts +5 -4
- package/dist/util/testHelpers.d.ts +5 -4
- package/dist/util/testHelpers.js +3 -3
- package/package.json +1 -1
- package/dist/chunk-IV27BICV.js.map +0 -1
- package/dist/chunk-NC54BC47.js.map +0 -1
- package/dist/chunk-YQABPD3C.js.map +0 -1
- /package/dist/{chunk-AWCUCZY4.js.map → chunk-CYD6GTCU.js.map} +0 -0
- /package/dist/{chunk-MREEJE3X.js.map → chunk-PXRKBNWN.js.map} +0 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { C as ClientTransport } from '../../../client-
|
|
2
|
-
import { c as TransportClientId } from '../../../message-
|
|
3
|
-
import { b as ProvidedClientTransportOptions } from '../../../handshake-
|
|
4
|
-
import { W as WebSocketConnection } from '../../../connection-
|
|
1
|
+
import { C as ClientTransport } from '../../../client-6c67339a.js';
|
|
2
|
+
import { c as TransportClientId } from '../../../message-ff78a233.js';
|
|
3
|
+
import { b as ProvidedClientTransportOptions } from '../../../handshake-154a0bb2.js';
|
|
4
|
+
import { W as WebSocketConnection } from '../../../connection-03ffb583.js';
|
|
5
5
|
import { W as WsLike } from '../../../wslike-e0b32dd5.js';
|
|
6
6
|
import '@sinclair/typebox/value';
|
|
7
7
|
import '@sinclair/typebox';
|
|
8
8
|
import '@opentelemetry/api';
|
|
9
|
+
import '@sinclair/typebox/errors';
|
|
9
10
|
import '../../../types-3e5768ec.js';
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { C as ClientTransport } from '../../../client-
|
|
2
|
-
import { c as TransportClientId } from '../../../message-
|
|
3
|
-
import { b as ProvidedClientTransportOptions } from '../../../handshake-
|
|
4
|
-
import { W as WebSocketConnection } from '../../../connection-
|
|
1
|
+
import { C as ClientTransport } from '../../../client-6c67339a.js';
|
|
2
|
+
import { c as TransportClientId } from '../../../message-ff78a233.js';
|
|
3
|
+
import { b as ProvidedClientTransportOptions } from '../../../handshake-154a0bb2.js';
|
|
4
|
+
import { W as WebSocketConnection } from '../../../connection-03ffb583.js';
|
|
5
5
|
import { W as WsLike } from '../../../wslike-e0b32dd5.js';
|
|
6
6
|
import '@sinclair/typebox/value';
|
|
7
7
|
import '@sinclair/typebox';
|
|
8
8
|
import '@opentelemetry/api';
|
|
9
|
+
import '@sinclair/typebox/errors';
|
|
9
10
|
import '../../../types-3e5768ec.js';
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ClientTransport
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-HPOR6FST.js";
|
|
4
4
|
import {
|
|
5
5
|
WebSocketConnection
|
|
6
|
-
} from "../../../chunk-
|
|
7
|
-
import "../../../chunk-
|
|
6
|
+
} from "../../../chunk-CYD6GTCU.js";
|
|
7
|
+
import "../../../chunk-RSCUADHY.js";
|
|
8
8
|
import "../../../chunk-TAH2GVTJ.js";
|
|
9
|
-
import "../../../chunk-
|
|
10
|
-
import "../../../chunk-
|
|
9
|
+
import "../../../chunk-42SXIIHP.js";
|
|
10
|
+
import "../../../chunk-65EMTMCV.js";
|
|
11
11
|
import "../../../chunk-4PVU7J25.js";
|
|
12
12
|
|
|
13
13
|
// transport/impls/ws/client.ts
|
|
@@ -53,9 +53,10 @@ var WebSocketClientTransport = class extends ClientTransport {
|
|
|
53
53
|
};
|
|
54
54
|
});
|
|
55
55
|
const conn = new WebSocketConnection(ws);
|
|
56
|
-
this.log?.info(`raw websocket to ${to} ok
|
|
56
|
+
this.log?.info(`raw websocket to ${to} ok`, {
|
|
57
57
|
clientId: this.clientId,
|
|
58
|
-
connectedTo: to
|
|
58
|
+
connectedTo: to,
|
|
59
|
+
...conn.loggingMetadata
|
|
59
60
|
});
|
|
60
61
|
return conn;
|
|
61
62
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../transport/impls/ws/client.ts"],"sourcesContent":["import { ClientTransport } from '../../client';\nimport { TransportClientId } from '../../message';\nimport { ProvidedClientTransportOptions } from '../../options';\nimport { WebSocketConnection } from './connection';\nimport { WsLike } from './wslike';\n\n/**\n * A transport implementation that uses a WebSocket connection with automatic reconnection.\n * @class\n * @extends Transport\n */\nexport class WebSocketClientTransport extends ClientTransport<WebSocketConnection> {\n /**\n * A function that returns a Promise that resolves to a websocket URL.\n */\n wsGetter: (to: TransportClientId) => Promise<WsLike> | WsLike;\n\n /**\n * Creates a new WebSocketClientTransport instance.\n * @param wsGetter A function that returns a Promise that resolves to a WebSocket instance.\n * @param clientId The ID of the client using the transport. This should be unique per session.\n * @param serverId The ID of the server this transport is connecting to.\n * @param providedOptions An optional object containing configuration options for the transport.\n */\n constructor(\n wsGetter: (to: TransportClientId) => Promise<WsLike> | WsLike,\n clientId: TransportClientId,\n providedOptions?: ProvidedClientTransportOptions,\n ) {\n super(clientId, providedOptions);\n this.wsGetter = wsGetter;\n }\n\n async createNewOutgoingConnection(to: string) {\n this.log?.info(`establishing a new websocket to ${to}`, {\n clientId: this.clientId,\n connectedTo: to,\n });\n\n const ws = await this.wsGetter(to);\n\n await new Promise<void>((resolve, reject) => {\n if (ws.readyState === ws.OPEN) {\n resolve();\n return;\n }\n\n if (ws.readyState === ws.CLOSING || ws.readyState === ws.CLOSED) {\n reject(new Error('ws is closing or closed'));\n return;\n }\n\n ws.onopen = () => {\n resolve();\n };\n\n ws.onclose = (evt) => {\n reject(new Error(evt.reason));\n };\n\n ws.onerror = (err) => {\n reject(new Error(err.message));\n };\n });\n\n const conn = new WebSocketConnection(ws);\n this.log?.info(`raw websocket to ${to} ok
|
|
1
|
+
{"version":3,"sources":["../../../../transport/impls/ws/client.ts"],"sourcesContent":["import { ClientTransport } from '../../client';\nimport { TransportClientId } from '../../message';\nimport { ProvidedClientTransportOptions } from '../../options';\nimport { WebSocketConnection } from './connection';\nimport { WsLike } from './wslike';\n\n/**\n * A transport implementation that uses a WebSocket connection with automatic reconnection.\n * @class\n * @extends Transport\n */\nexport class WebSocketClientTransport extends ClientTransport<WebSocketConnection> {\n /**\n * A function that returns a Promise that resolves to a websocket URL.\n */\n wsGetter: (to: TransportClientId) => Promise<WsLike> | WsLike;\n\n /**\n * Creates a new WebSocketClientTransport instance.\n * @param wsGetter A function that returns a Promise that resolves to a WebSocket instance.\n * @param clientId The ID of the client using the transport. This should be unique per session.\n * @param serverId The ID of the server this transport is connecting to.\n * @param providedOptions An optional object containing configuration options for the transport.\n */\n constructor(\n wsGetter: (to: TransportClientId) => Promise<WsLike> | WsLike,\n clientId: TransportClientId,\n providedOptions?: ProvidedClientTransportOptions,\n ) {\n super(clientId, providedOptions);\n this.wsGetter = wsGetter;\n }\n\n async createNewOutgoingConnection(to: string) {\n this.log?.info(`establishing a new websocket to ${to}`, {\n clientId: this.clientId,\n connectedTo: to,\n });\n\n const ws = await this.wsGetter(to);\n\n await new Promise<void>((resolve, reject) => {\n if (ws.readyState === ws.OPEN) {\n resolve();\n return;\n }\n\n if (ws.readyState === ws.CLOSING || ws.readyState === ws.CLOSED) {\n reject(new Error('ws is closing or closed'));\n return;\n }\n\n ws.onopen = () => {\n resolve();\n };\n\n ws.onclose = (evt) => {\n reject(new Error(evt.reason));\n };\n\n ws.onerror = (err) => {\n reject(new Error(err.message));\n };\n });\n\n const conn = new WebSocketConnection(ws);\n this.log?.info(`raw websocket to ${to} ok`, {\n clientId: this.clientId,\n connectedTo: to,\n ...conn.loggingMetadata,\n });\n\n return conn;\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAWO,IAAM,2BAAN,cAAuC,gBAAqC;AAAA;AAAA;AAAA;AAAA,EAIjF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,YACE,UACA,UACA,iBACA;AACA,UAAM,UAAU,eAAe;AAC/B,SAAK,WAAW;AAAA,EAClB;AAAA,EAEA,MAAM,4BAA4B,IAAY;AAC5C,SAAK,KAAK,KAAK,mCAAmC,EAAE,IAAI;AAAA,MACtD,UAAU,KAAK;AAAA,MACf,aAAa;AAAA,IACf,CAAC;AAED,UAAM,KAAK,MAAM,KAAK,SAAS,EAAE;AAEjC,UAAM,IAAI,QAAc,CAAC,SAAS,WAAW;AAC3C,UAAI,GAAG,eAAe,GAAG,MAAM;AAC7B,gBAAQ;AACR;AAAA,MACF;AAEA,UAAI,GAAG,eAAe,GAAG,WAAW,GAAG,eAAe,GAAG,QAAQ;AAC/D,eAAO,IAAI,MAAM,yBAAyB,CAAC;AAC3C;AAAA,MACF;AAEA,SAAG,SAAS,MAAM;AAChB,gBAAQ;AAAA,MACV;AAEA,SAAG,UAAU,CAAC,QAAQ;AACpB,eAAO,IAAI,MAAM,IAAI,MAAM,CAAC;AAAA,MAC9B;AAEA,SAAG,UAAU,CAAC,QAAQ;AACpB,eAAO,IAAI,MAAM,IAAI,OAAO,CAAC;AAAA,MAC/B;AAAA,IACF,CAAC;AAED,UAAM,OAAO,IAAI,oBAAoB,EAAE;AACvC,SAAK,KAAK,KAAK,oBAAoB,EAAE,OAAO;AAAA,MAC1C,UAAU,KAAK;AAAA,MACf,aAAa;AAAA,MACb,GAAG,KAAK;AAAA,IACV,CAAC;AAED,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -457,6 +457,7 @@ var StateMachineState = class {
|
|
|
457
457
|
}
|
|
458
458
|
if (prop === "_handleClose") {
|
|
459
459
|
return () => {
|
|
460
|
+
target._isConsumed = true;
|
|
460
461
|
target._handleStateExit();
|
|
461
462
|
target._handleClose();
|
|
462
463
|
};
|
|
@@ -537,15 +538,18 @@ var IdentifiedSession = class extends CommonSession {
|
|
|
537
538
|
}
|
|
538
539
|
get loggingMetadata() {
|
|
539
540
|
const spanContext = this.telemetry.span.spanContext();
|
|
540
|
-
|
|
541
|
+
const metadata = {
|
|
541
542
|
clientId: this.from,
|
|
542
543
|
connectedTo: this.to,
|
|
543
|
-
sessionId: this.id
|
|
544
|
-
|
|
544
|
+
sessionId: this.id
|
|
545
|
+
};
|
|
546
|
+
if (this.telemetry.span.isRecording()) {
|
|
547
|
+
metadata.telemetry = {
|
|
545
548
|
traceId: spanContext.traceId,
|
|
546
549
|
spanId: spanContext.spanId
|
|
547
|
-
}
|
|
548
|
-
}
|
|
550
|
+
};
|
|
551
|
+
}
|
|
552
|
+
return metadata;
|
|
549
553
|
}
|
|
550
554
|
constructMsg(partialMsg) {
|
|
551
555
|
const msg = {
|
|
@@ -608,9 +612,6 @@ var SessionConnecting = class extends IdentifiedSessionWithGracePeriod {
|
|
|
608
612
|
super(props);
|
|
609
613
|
this.connPromise = props.connPromise;
|
|
610
614
|
this.listeners = props.listeners;
|
|
611
|
-
this.connectionTimeout = setTimeout(() => {
|
|
612
|
-
this.listeners.onConnectionTimeout();
|
|
613
|
-
}, this.options.connectionTimeoutMs);
|
|
614
615
|
this.connPromise.then(
|
|
615
616
|
(conn) => {
|
|
616
617
|
if (this._isConsumed)
|
|
@@ -623,11 +624,25 @@ var SessionConnecting = class extends IdentifiedSessionWithGracePeriod {
|
|
|
623
624
|
this.listeners.onConnectionFailed(err);
|
|
624
625
|
}
|
|
625
626
|
);
|
|
627
|
+
this.connectionTimeout = setTimeout(() => {
|
|
628
|
+
this.listeners.onConnectionTimeout();
|
|
629
|
+
}, this.options.connectionTimeoutMs);
|
|
626
630
|
}
|
|
627
631
|
// close a pending connection if it resolves, ignore errors if the promise
|
|
628
632
|
// ends up rejected anyways
|
|
629
633
|
bestEffortClose() {
|
|
630
|
-
|
|
634
|
+
const logger = this.log;
|
|
635
|
+
const metadata = this.loggingMetadata;
|
|
636
|
+
this.connPromise.then((conn) => {
|
|
637
|
+
conn.close();
|
|
638
|
+
logger?.info(
|
|
639
|
+
"connection eventually resolved but session has transitioned, closed connection",
|
|
640
|
+
{
|
|
641
|
+
...metadata,
|
|
642
|
+
...conn.loggingMetadata
|
|
643
|
+
}
|
|
644
|
+
);
|
|
645
|
+
}).catch(() => {
|
|
631
646
|
});
|
|
632
647
|
}
|
|
633
648
|
_handleStateExit() {
|
|
@@ -658,7 +673,7 @@ var SessionNoConnection = class extends IdentifiedSessionWithGracePeriod {
|
|
|
658
673
|
var import_api = require("@opentelemetry/api");
|
|
659
674
|
|
|
660
675
|
// package.json
|
|
661
|
-
var version = "0.26.
|
|
676
|
+
var version = "0.26.4";
|
|
662
677
|
|
|
663
678
|
// tracing/index.ts
|
|
664
679
|
function createSessionTelemetryInfo(sessionId, to, from, propagationCtx) {
|
|
@@ -697,6 +712,13 @@ var SessionWaitingForHandshake = class extends CommonSession {
|
|
|
697
712
|
this.conn.addErrorListener(this.listeners.onConnectionErrored);
|
|
698
713
|
this.conn.addCloseListener(this.listeners.onConnectionClosed);
|
|
699
714
|
}
|
|
715
|
+
get loggingMetadata() {
|
|
716
|
+
return {
|
|
717
|
+
clientId: this.from,
|
|
718
|
+
connId: this.conn.id,
|
|
719
|
+
...this.conn.loggingMetadata
|
|
720
|
+
};
|
|
721
|
+
}
|
|
700
722
|
onHandshakeData = (msg) => {
|
|
701
723
|
const parsedMsg = this.parseMsg(msg);
|
|
702
724
|
if (parsedMsg === null) {
|
|
@@ -708,12 +730,6 @@ var SessionWaitingForHandshake = class extends CommonSession {
|
|
|
708
730
|
}
|
|
709
731
|
this.listeners.onHandshake(parsedMsg);
|
|
710
732
|
};
|
|
711
|
-
get loggingMetadata() {
|
|
712
|
-
return {
|
|
713
|
-
clientId: this.from,
|
|
714
|
-
connId: this.conn.id
|
|
715
|
-
};
|
|
716
|
-
}
|
|
717
733
|
sendHandshake(msg) {
|
|
718
734
|
return this.conn.send(this.options.codec.toBuffer(msg));
|
|
719
735
|
}
|
|
@@ -746,6 +762,12 @@ var SessionHandshaking = class extends IdentifiedSessionWithGracePeriod {
|
|
|
746
762
|
this.conn.addErrorListener(this.listeners.onConnectionErrored);
|
|
747
763
|
this.conn.addCloseListener(this.listeners.onConnectionClosed);
|
|
748
764
|
}
|
|
765
|
+
get loggingMetadata() {
|
|
766
|
+
return {
|
|
767
|
+
...super.loggingMetadata,
|
|
768
|
+
...this.conn.loggingMetadata
|
|
769
|
+
};
|
|
770
|
+
}
|
|
749
771
|
onHandshakeData = (msg) => {
|
|
750
772
|
const parsedMsg = this.parseMsg(msg);
|
|
751
773
|
if (parsedMsg === null) {
|
|
@@ -833,6 +855,12 @@ var SessionConnected = class extends IdentifiedSession {
|
|
|
833
855
|
this.heartbeatMisses++;
|
|
834
856
|
}, this.options.heartbeatIntervalMs);
|
|
835
857
|
}
|
|
858
|
+
get loggingMetadata() {
|
|
859
|
+
return {
|
|
860
|
+
...super.loggingMetadata,
|
|
861
|
+
...this.conn.loggingMetadata
|
|
862
|
+
};
|
|
863
|
+
}
|
|
836
864
|
startActiveHeartbeat() {
|
|
837
865
|
this.isActivelyHeartbeating = true;
|
|
838
866
|
}
|
|
@@ -1334,8 +1362,9 @@ var Transport = class {
|
|
|
1334
1362
|
status: "disconnect",
|
|
1335
1363
|
session
|
|
1336
1364
|
});
|
|
1365
|
+
const to = session.to;
|
|
1337
1366
|
session.close();
|
|
1338
|
-
this.sessions.delete(
|
|
1367
|
+
this.sessions.delete(to);
|
|
1339
1368
|
}
|
|
1340
1369
|
// common listeners
|
|
1341
1370
|
onSessionGracePeriodElapsed(session) {
|
|
@@ -1568,14 +1597,53 @@ var ServerTransport = class extends Transport {
|
|
|
1568
1597
|
return;
|
|
1569
1598
|
}
|
|
1570
1599
|
let oldSession = this.sessions.get(msg.from);
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1600
|
+
let parsedMetadata = {};
|
|
1601
|
+
if (this.handshakeExtensions) {
|
|
1602
|
+
if (!import_value2.Value.Check(this.handshakeExtensions.schema, msg.payload.metadata)) {
|
|
1603
|
+
this.rejectHandshakeRequest(
|
|
1604
|
+
session,
|
|
1605
|
+
msg.from,
|
|
1606
|
+
"received malformed handshake metadata",
|
|
1607
|
+
"MALFORMED_HANDSHAKE_META",
|
|
1608
|
+
{
|
|
1609
|
+
...session.loggingMetadata,
|
|
1610
|
+
connectedTo: msg.from,
|
|
1611
|
+
validationErrors: [
|
|
1612
|
+
...import_value2.Value.Errors(
|
|
1613
|
+
this.handshakeExtensions.schema,
|
|
1614
|
+
msg.payload.metadata
|
|
1615
|
+
)
|
|
1616
|
+
]
|
|
1617
|
+
}
|
|
1618
|
+
);
|
|
1619
|
+
return;
|
|
1620
|
+
}
|
|
1621
|
+
const previousParsedMetadata = oldSession ? this.sessionHandshakeMetadata.get(oldSession.to) : void 0;
|
|
1622
|
+
const parsedMetadataOrFailureCode = await this.handshakeExtensions.validate(
|
|
1623
|
+
msg.payload.metadata,
|
|
1624
|
+
previousParsedMetadata
|
|
1625
|
+
);
|
|
1626
|
+
if (session._isConsumed) {
|
|
1627
|
+
return;
|
|
1628
|
+
}
|
|
1629
|
+
if (import_value2.Value.Check(
|
|
1630
|
+
HandshakeErrorCustomHandlerFatalResponseCodes,
|
|
1631
|
+
parsedMetadataOrFailureCode
|
|
1632
|
+
)) {
|
|
1633
|
+
this.rejectHandshakeRequest(
|
|
1634
|
+
session,
|
|
1635
|
+
msg.from,
|
|
1636
|
+
"rejected by handshake handler",
|
|
1637
|
+
parsedMetadataOrFailureCode,
|
|
1638
|
+
{
|
|
1639
|
+
...session.loggingMetadata,
|
|
1640
|
+
connectedTo: msg.from,
|
|
1641
|
+
clientId: this.clientId
|
|
1642
|
+
}
|
|
1643
|
+
);
|
|
1644
|
+
return;
|
|
1645
|
+
}
|
|
1646
|
+
parsedMetadata = parsedMetadataOrFailureCode;
|
|
1579
1647
|
}
|
|
1580
1648
|
let connectCase = "new session";
|
|
1581
1649
|
const clientNextExpectedSeq = msg.payload.expectedSessionState.nextExpectedSeq;
|
|
@@ -1707,50 +1775,6 @@ var ServerTransport = class extends Transport {
|
|
|
1707
1775
|
this.pendingSessions.delete(session);
|
|
1708
1776
|
connectedSession.startActiveHeartbeat();
|
|
1709
1777
|
}
|
|
1710
|
-
async validateHandshakeMetadata(handshakingSession, existingSession, rawMetadata, from) {
|
|
1711
|
-
if (!this.handshakeExtensions) {
|
|
1712
|
-
return {};
|
|
1713
|
-
}
|
|
1714
|
-
if (!import_value2.Value.Check(this.handshakeExtensions.schema, rawMetadata)) {
|
|
1715
|
-
this.rejectHandshakeRequest(
|
|
1716
|
-
handshakingSession,
|
|
1717
|
-
from,
|
|
1718
|
-
"received malformed handshake metadata",
|
|
1719
|
-
"MALFORMED_HANDSHAKE_META",
|
|
1720
|
-
{
|
|
1721
|
-
...handshakingSession.loggingMetadata,
|
|
1722
|
-
connectedTo: from,
|
|
1723
|
-
validationErrors: [
|
|
1724
|
-
...import_value2.Value.Errors(this.handshakeExtensions.schema, rawMetadata)
|
|
1725
|
-
]
|
|
1726
|
-
}
|
|
1727
|
-
);
|
|
1728
|
-
return false;
|
|
1729
|
-
}
|
|
1730
|
-
const previousParsedMetadata = existingSession ? this.sessionHandshakeMetadata.get(existingSession.to) : void 0;
|
|
1731
|
-
const parsedMetadataOrFailureCode = await this.handshakeExtensions.validate(
|
|
1732
|
-
rawMetadata,
|
|
1733
|
-
previousParsedMetadata
|
|
1734
|
-
);
|
|
1735
|
-
if (import_value2.Value.Check(
|
|
1736
|
-
HandshakeErrorCustomHandlerFatalResponseCodes,
|
|
1737
|
-
parsedMetadataOrFailureCode
|
|
1738
|
-
)) {
|
|
1739
|
-
this.rejectHandshakeRequest(
|
|
1740
|
-
handshakingSession,
|
|
1741
|
-
from,
|
|
1742
|
-
"rejected by handshake handler",
|
|
1743
|
-
parsedMetadataOrFailureCode,
|
|
1744
|
-
{
|
|
1745
|
-
...handshakingSession.loggingMetadata,
|
|
1746
|
-
connectedTo: from,
|
|
1747
|
-
clientId: this.clientId
|
|
1748
|
-
}
|
|
1749
|
-
);
|
|
1750
|
-
return false;
|
|
1751
|
-
}
|
|
1752
|
-
return parsedMetadataOrFailureCode;
|
|
1753
|
-
}
|
|
1754
1778
|
};
|
|
1755
1779
|
|
|
1756
1780
|
// transport/impls/ws/server.ts
|