@replit/river 0.23.7 → 0.23.9
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-RLVU5DRX.js → chunk-KIWWKSRI.js} +2 -2
- package/dist/{chunk-M3TGXFWT.js → chunk-U4CSF3SQ.js} +2 -2
- package/dist/chunk-U4CSF3SQ.js.map +1 -0
- package/dist/{chunk-2KC75LS4.js → chunk-XKVIPKMR.js} +2 -3
- package/dist/chunk-XKVIPKMR.js.map +1 -0
- package/dist/{chunk-MFF6IPBA.js → chunk-XUVTMFTJ.js} +2 -2
- package/dist/{chunk-MFF6IPBA.js.map → chunk-XUVTMFTJ.js.map} +1 -1
- package/dist/{chunk-XYFXRL7Q.js → chunk-YGW5PYGV.js} +107 -33
- package/dist/chunk-YGW5PYGV.js.map +1 -0
- package/dist/{connection-6ce35bd5.d.ts → connection-afa08cf1.d.ts} +1 -1
- package/dist/{connection-a3fdfa3a.d.ts → connection-f5fb7805.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 +5 -5
- package/dist/router/index.d.ts +5 -5
- package/dist/router/index.js +2 -2
- package/dist/{services-fd8a9894.d.ts → services-49b1b43d.d.ts} +10 -9
- package/dist/transport/impls/uds/client.cjs +101 -27
- package/dist/transport/impls/uds/client.cjs.map +1 -1
- package/dist/transport/impls/uds/client.d.cts +2 -2
- package/dist/transport/impls/uds/client.d.ts +2 -2
- package/dist/transport/impls/uds/client.js +3 -3
- package/dist/transport/impls/uds/server.cjs +83 -17
- package/dist/transport/impls/uds/server.cjs.map +1 -1
- package/dist/transport/impls/uds/server.d.cts +2 -2
- package/dist/transport/impls/uds/server.d.ts +2 -2
- package/dist/transport/impls/uds/server.js +3 -3
- package/dist/transport/impls/ws/client.cjs +101 -28
- package/dist/transport/impls/ws/client.cjs.map +1 -1
- package/dist/transport/impls/ws/client.d.cts +2 -2
- package/dist/transport/impls/ws/client.d.ts +2 -2
- package/dist/transport/impls/ws/client.js +3 -3
- package/dist/transport/impls/ws/server.cjs +83 -18
- package/dist/transport/impls/ws/server.cjs.map +1 -1
- package/dist/transport/impls/ws/server.d.cts +2 -2
- package/dist/transport/impls/ws/server.d.ts +2 -2
- package/dist/transport/impls/ws/server.js +3 -3
- package/dist/transport/index.cjs +106 -32
- package/dist/transport/index.cjs.map +1 -1
- package/dist/transport/index.d.cts +1 -1
- package/dist/transport/index.d.ts +1 -1
- package/dist/transport/index.js +2 -2
- package/dist/{transport-3d34f714.d.ts → transport-3d0ba1da.d.ts} +33 -7
- package/dist/util/testHelpers.cjs +46 -4
- package/dist/util/testHelpers.cjs.map +1 -1
- package/dist/util/testHelpers.d.cts +2 -2
- package/dist/util/testHelpers.d.ts +2 -2
- package/dist/util/testHelpers.js +3 -3
- package/dist/util/testHelpers.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-2KC75LS4.js.map +0 -1
- package/dist/chunk-M3TGXFWT.js.map +0 -1
- package/dist/chunk-XYFXRL7Q.js.map +0 -1
- /package/dist/{chunk-RLVU5DRX.js.map → chunk-KIWWKSRI.js.map} +0 -0
|
@@ -77,7 +77,7 @@ interface SessionOptions {
|
|
|
77
77
|
declare class Session<ConnType extends Connection> {
|
|
78
78
|
private codec;
|
|
79
79
|
private options;
|
|
80
|
-
telemetry: TelemetryInfo;
|
|
80
|
+
readonly telemetry: TelemetryInfo;
|
|
81
81
|
/**
|
|
82
82
|
* The buffer of messages that have been sent but not yet acknowledged.
|
|
83
83
|
*/
|
|
@@ -86,12 +86,17 @@ declare class Session<ConnType extends Connection> {
|
|
|
86
86
|
* The active connection associated with this session
|
|
87
87
|
*/
|
|
88
88
|
connection?: ConnType;
|
|
89
|
+
/**
|
|
90
|
+
* A connection that is currently undergoing handshaking. Used to distinguish between the active
|
|
91
|
+
* connection, but still be able to close it if needed.
|
|
92
|
+
*/
|
|
93
|
+
private handshakingConnection?;
|
|
89
94
|
readonly from: TransportClientId;
|
|
90
95
|
readonly to: TransportClientId;
|
|
91
96
|
/**
|
|
92
97
|
* The unique ID of this session.
|
|
93
98
|
*/
|
|
94
|
-
id: string;
|
|
99
|
+
readonly id: string;
|
|
95
100
|
/**
|
|
96
101
|
* What the other side advertised as their session ID
|
|
97
102
|
* for this session.
|
|
@@ -135,10 +140,17 @@ declare class Session<ConnType extends Connection> {
|
|
|
135
140
|
resetBufferedMessages(): void;
|
|
136
141
|
sendBufferedMessages(conn: ConnType): void;
|
|
137
142
|
updateBookkeeping(ack: number, seq: number): void;
|
|
138
|
-
closeStaleConnection
|
|
143
|
+
private closeStaleConnection;
|
|
139
144
|
replaceWithNewConnection(newConn: ConnType): void;
|
|
145
|
+
replaceWithNewHandshakingConnection(newConn: ConnType): void;
|
|
140
146
|
beginGrace(cb: () => void): void;
|
|
141
|
-
cancelGrace(
|
|
147
|
+
cancelGrace({ keepHeartbeatMisses }?: {
|
|
148
|
+
keepHeartbeatMisses: boolean;
|
|
149
|
+
}): void;
|
|
150
|
+
/**
|
|
151
|
+
* Used to close the handshaking connection, if set.
|
|
152
|
+
*/
|
|
153
|
+
closeHandshakingConnection(expectedHandshakingConn?: ConnType): void;
|
|
142
154
|
close(): void;
|
|
143
155
|
get connected(): boolean;
|
|
144
156
|
get nextExpectedSeq(): number;
|
|
@@ -419,11 +431,21 @@ declare abstract class Transport<ConnType extends Connection> {
|
|
|
419
431
|
*/
|
|
420
432
|
protected onConnect(conn: ConnType, connectedTo: TransportClientId, session: Session<ConnType>, isReconnect: boolean): void;
|
|
421
433
|
protected createSession(to: TransportClientId, conn?: ConnType, propagationCtx?: PropagationContext): Session<ConnType>;
|
|
422
|
-
protected getOrCreateSession(to
|
|
434
|
+
protected getOrCreateSession({ to, conn, handshakingConn, sessionId, propagationCtx, }: {
|
|
435
|
+
to: TransportClientId;
|
|
436
|
+
conn?: ConnType;
|
|
437
|
+
handshakingConn?: ConnType;
|
|
438
|
+
sessionId?: string;
|
|
439
|
+
propagationCtx?: PropagationContext;
|
|
440
|
+
}): {
|
|
423
441
|
session: Session<ConnType>;
|
|
424
442
|
isReconnect: boolean;
|
|
425
443
|
};
|
|
426
|
-
protected deleteSession(session
|
|
444
|
+
protected deleteSession({ session, closeHandshakingConnection, handshakingConn, }: {
|
|
445
|
+
session: Session<ConnType>;
|
|
446
|
+
closeHandshakingConnection: boolean;
|
|
447
|
+
handshakingConn?: ConnType;
|
|
448
|
+
}): void;
|
|
427
449
|
/**
|
|
428
450
|
* The downstream implementation needs to call this when a connection is closed.
|
|
429
451
|
* @param conn The connection object.
|
|
@@ -515,7 +537,11 @@ declare abstract class ClientTransport<ConnType extends Connection> extends Tran
|
|
|
515
537
|
* @param to The client ID of the node to connect to.
|
|
516
538
|
*/
|
|
517
539
|
connect(to: TransportClientId): Promise<void>;
|
|
518
|
-
protected deleteSession(session
|
|
540
|
+
protected deleteSession({ session, closeHandshakingConnection, handshakingConn, }: {
|
|
541
|
+
session: Session<ConnType>;
|
|
542
|
+
closeHandshakingConnection: boolean;
|
|
543
|
+
handshakingConn?: ConnType;
|
|
544
|
+
}): void;
|
|
519
545
|
protected sendHandshake(to: TransportClientId, conn: ConnType): Promise<boolean>;
|
|
520
546
|
close(): void;
|
|
521
547
|
}
|
|
@@ -353,7 +353,7 @@ function Err(error) {
|
|
|
353
353
|
var import_api = require("@opentelemetry/api");
|
|
354
354
|
|
|
355
355
|
// package.json
|
|
356
|
-
var version = "0.23.
|
|
356
|
+
var version = "0.23.9";
|
|
357
357
|
|
|
358
358
|
// tracing/index.ts
|
|
359
359
|
function createSessionTelemetryInfo(session, propagationCtx) {
|
|
@@ -403,6 +403,11 @@ var Session = class {
|
|
|
403
403
|
* The active connection associated with this session
|
|
404
404
|
*/
|
|
405
405
|
connection;
|
|
406
|
+
/**
|
|
407
|
+
* A connection that is currently undergoing handshaking. Used to distinguish between the active
|
|
408
|
+
* connection, but still be able to close it if needed.
|
|
409
|
+
*/
|
|
410
|
+
handshakingConnection;
|
|
406
411
|
from;
|
|
407
412
|
to;
|
|
408
413
|
/**
|
|
@@ -582,23 +587,60 @@ var Session = class {
|
|
|
582
587
|
this.cancelGrace();
|
|
583
588
|
this.sendBufferedMessages(newConn);
|
|
584
589
|
this.connection = newConn;
|
|
590
|
+
this.handshakingConnection = void 0;
|
|
591
|
+
}
|
|
592
|
+
replaceWithNewHandshakingConnection(newConn) {
|
|
593
|
+
this.handshakingConnection = newConn;
|
|
585
594
|
}
|
|
586
595
|
beginGrace(cb) {
|
|
587
596
|
this.log?.info(
|
|
588
597
|
`starting ${this.options.sessionDisconnectGraceMs}ms grace period until session to ${this.to} is closed`,
|
|
589
598
|
this.loggingMetadata
|
|
590
599
|
);
|
|
600
|
+
this.cancelGrace({ keepHeartbeatMisses: true });
|
|
591
601
|
this.disconnectionGrace = setTimeout(() => {
|
|
592
|
-
this.
|
|
602
|
+
if (this.connection !== void 0) {
|
|
603
|
+
this.log?.warn(
|
|
604
|
+
`grace period for ${this.to} elapsed while connected. not calling callback`,
|
|
605
|
+
{
|
|
606
|
+
...this.loggingMetadata,
|
|
607
|
+
connId: this.connection.id,
|
|
608
|
+
tags: ["invariant-violation"]
|
|
609
|
+
}
|
|
610
|
+
);
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
this.log?.info(
|
|
614
|
+
`grace period for ${this.to} elapsed`,
|
|
615
|
+
this.loggingMetadata
|
|
616
|
+
);
|
|
593
617
|
cb();
|
|
594
618
|
}, this.options.sessionDisconnectGraceMs);
|
|
595
619
|
}
|
|
596
620
|
// called on reconnect of the underlying session
|
|
597
|
-
cancelGrace(
|
|
598
|
-
|
|
621
|
+
cancelGrace({ keepHeartbeatMisses } = {
|
|
622
|
+
keepHeartbeatMisses: false
|
|
623
|
+
}) {
|
|
624
|
+
if (!keepHeartbeatMisses) {
|
|
625
|
+
this.heartbeatMisses = 0;
|
|
626
|
+
}
|
|
627
|
+
if (this.disconnectionGrace === void 0)
|
|
628
|
+
return;
|
|
599
629
|
clearTimeout(this.disconnectionGrace);
|
|
600
630
|
this.disconnectionGrace = void 0;
|
|
601
631
|
}
|
|
632
|
+
/**
|
|
633
|
+
* Used to close the handshaking connection, if set.
|
|
634
|
+
*/
|
|
635
|
+
closeHandshakingConnection(expectedHandshakingConn) {
|
|
636
|
+
if (this.handshakingConnection === void 0)
|
|
637
|
+
return;
|
|
638
|
+
if (expectedHandshakingConn !== void 0 && this.handshakingConnection === expectedHandshakingConn) {
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
this.handshakingConnection.close();
|
|
642
|
+
this.handshakingConnection = void 0;
|
|
643
|
+
}
|
|
602
644
|
// closed when we want to discard the whole session
|
|
603
645
|
// (i.e. shutdown or session disconnect)
|
|
604
646
|
close() {
|