@replit/river 0.23.10 → 0.23.12
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-FRICSBDW.js → chunk-7RUKEUKE.js} +2 -2
- package/dist/{chunk-FRICSBDW.js.map → chunk-7RUKEUKE.js.map} +1 -1
- package/dist/{chunk-UXQMGZKP.js → chunk-H6KTH6W6.js} +2 -2
- package/dist/{chunk-Z4G27Y2I.js → chunk-HDBVL7EF.js} +2 -2
- package/dist/{chunk-KBAZ5TWE.js → chunk-VRU4IKRT.js} +62 -50
- package/dist/chunk-VRU4IKRT.js.map +1 -0
- package/dist/{chunk-B323CECK.js → chunk-XZ6IOBM5.js} +9 -9
- package/dist/chunk-XZ6IOBM5.js.map +1 -0
- package/dist/{connection-efcd4e1a.d.ts → connection-581558f8.d.ts} +1 -1
- package/dist/{connection-700340c4.d.ts → connection-8debd45f.d.ts} +1 -1
- package/dist/router/index.cjs +8 -8
- package/dist/router/index.cjs.map +1 -1
- package/dist/router/index.d.cts +11 -7
- package/dist/router/index.d.ts +11 -7
- package/dist/router/index.js +2 -2
- package/dist/{services-409c5545.d.ts → services-ca72c9f8.d.ts} +1 -1
- package/dist/transport/impls/uds/client.cjs +59 -47
- 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 +20 -38
- 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 +59 -47
- 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 +20 -38
- 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 +61 -49
- 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-cf856c41.d.ts → transport-47af1c81.d.ts} +4 -5
- package/dist/util/testHelpers.cjs +8 -23
- 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/package.json +1 -1
- package/dist/chunk-B323CECK.js.map +0 -1
- package/dist/chunk-KBAZ5TWE.js.map +0 -1
- /package/dist/{chunk-UXQMGZKP.js.map → chunk-H6KTH6W6.js.map} +0 -0
- /package/dist/{chunk-Z4G27Y2I.js.map → chunk-HDBVL7EF.js.map} +0 -0
|
@@ -199,7 +199,7 @@ var import_nanoid2 = require("nanoid");
|
|
|
199
199
|
var import_api = require("@opentelemetry/api");
|
|
200
200
|
|
|
201
201
|
// package.json
|
|
202
|
-
var version = "0.23.
|
|
202
|
+
var version = "0.23.12";
|
|
203
203
|
|
|
204
204
|
// tracing/index.ts
|
|
205
205
|
function createSessionTelemetryInfo(session, propagationCtx) {
|
|
@@ -449,10 +449,12 @@ var Session = class {
|
|
|
449
449
|
this.connection.close();
|
|
450
450
|
this.connection = void 0;
|
|
451
451
|
}
|
|
452
|
-
replaceWithNewConnection(newConn) {
|
|
452
|
+
replaceWithNewConnection(newConn, isTransparentReconnect) {
|
|
453
453
|
this.closeStaleConnection(newConn);
|
|
454
454
|
this.cancelGrace();
|
|
455
|
-
|
|
455
|
+
if (isTransparentReconnect) {
|
|
456
|
+
this.sendBufferedMessages(newConn);
|
|
457
|
+
}
|
|
456
458
|
this.connection = newConn;
|
|
457
459
|
this.handshakingConnection = void 0;
|
|
458
460
|
}
|
|
@@ -464,19 +466,8 @@ var Session = class {
|
|
|
464
466
|
`starting ${this.options.sessionDisconnectGraceMs}ms grace period until session to ${this.to} is closed`,
|
|
465
467
|
this.loggingMetadata
|
|
466
468
|
);
|
|
467
|
-
this.cancelGrace(
|
|
469
|
+
this.cancelGrace();
|
|
468
470
|
this.disconnectionGrace = setTimeout(() => {
|
|
469
|
-
if (this.connection !== void 0) {
|
|
470
|
-
this.log?.warn(
|
|
471
|
-
`grace period for ${this.to} elapsed while connected. not calling callback`,
|
|
472
|
-
{
|
|
473
|
-
...this.loggingMetadata,
|
|
474
|
-
connId: this.connection.id,
|
|
475
|
-
tags: ["invariant-violation"]
|
|
476
|
-
}
|
|
477
|
-
);
|
|
478
|
-
return;
|
|
479
|
-
}
|
|
480
471
|
this.log?.info(
|
|
481
472
|
`grace period for ${this.to} elapsed`,
|
|
482
473
|
this.loggingMetadata
|
|
@@ -485,14 +476,8 @@ var Session = class {
|
|
|
485
476
|
}, this.options.sessionDisconnectGraceMs);
|
|
486
477
|
}
|
|
487
478
|
// called on reconnect of the underlying session
|
|
488
|
-
cancelGrace(
|
|
489
|
-
|
|
490
|
-
}) {
|
|
491
|
-
if (!keepHeartbeatMisses) {
|
|
492
|
-
this.heartbeatMisses = 0;
|
|
493
|
-
}
|
|
494
|
-
if (this.disconnectionGrace === void 0)
|
|
495
|
-
return;
|
|
479
|
+
cancelGrace() {
|
|
480
|
+
this.heartbeatMisses = 0;
|
|
496
481
|
clearTimeout(this.disconnectionGrace);
|
|
497
482
|
this.disconnectionGrace = void 0;
|
|
498
483
|
}
|
|
@@ -682,21 +667,17 @@ var Transport = class {
|
|
|
682
667
|
* and we know the identity of the connected client.
|
|
683
668
|
* @param conn The connection object.
|
|
684
669
|
*/
|
|
685
|
-
onConnect(conn,
|
|
670
|
+
onConnect(conn, session, isTransparentReconnect) {
|
|
686
671
|
this.eventDispatcher.dispatchEvent("connectionStatus", {
|
|
687
672
|
status: "connect",
|
|
688
673
|
conn
|
|
689
674
|
});
|
|
690
675
|
conn.telemetry = createConnectionTelemetryInfo(conn, session.telemetry);
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
clientId: this.clientId,
|
|
697
|
-
connectedTo
|
|
698
|
-
});
|
|
699
|
-
}
|
|
676
|
+
session.replaceWithNewConnection(conn, isTransparentReconnect);
|
|
677
|
+
this.log?.info(`connected to ${session.to}`, {
|
|
678
|
+
...conn.loggingMetadata,
|
|
679
|
+
...session.loggingMetadata
|
|
680
|
+
});
|
|
700
681
|
}
|
|
701
682
|
createSession(to, conn, propagationCtx) {
|
|
702
683
|
const session = new Session(
|
|
@@ -724,7 +705,8 @@ var Transport = class {
|
|
|
724
705
|
propagationCtx
|
|
725
706
|
}) {
|
|
726
707
|
let session = this.sessions.get(to);
|
|
727
|
-
|
|
708
|
+
const isReconnect = session !== void 0;
|
|
709
|
+
let isTransparentReconnect = isReconnect;
|
|
728
710
|
if (session?.advertisedSessionId !== void 0 && sessionId !== void 0 && session.advertisedSessionId !== sessionId) {
|
|
729
711
|
this.log?.info(
|
|
730
712
|
`session for ${to} already exists but has a different session id (expected: ${session.advertisedSessionId}, got: ${sessionId}), creating a new one`,
|
|
@@ -735,7 +717,7 @@ var Transport = class {
|
|
|
735
717
|
closeHandshakingConnection: handshakingConn !== void 0,
|
|
736
718
|
handshakingConn
|
|
737
719
|
});
|
|
738
|
-
|
|
720
|
+
isTransparentReconnect = false;
|
|
739
721
|
session = void 0;
|
|
740
722
|
}
|
|
741
723
|
if (!session) {
|
|
@@ -751,7 +733,7 @@ var Transport = class {
|
|
|
751
733
|
if (handshakingConn !== void 0) {
|
|
752
734
|
session.replaceWithNewHandshakingConnection(handshakingConn);
|
|
753
735
|
}
|
|
754
|
-
return { session, isReconnect };
|
|
736
|
+
return { session, isReconnect, isTransparentReconnect };
|
|
755
737
|
}
|
|
756
738
|
deleteSession({
|
|
757
739
|
session,
|
|
@@ -1182,7 +1164,7 @@ var ServerTransport = class extends Transport {
|
|
|
1182
1164
|
if (parsedMetadata === false) {
|
|
1183
1165
|
return false;
|
|
1184
1166
|
}
|
|
1185
|
-
const { session,
|
|
1167
|
+
const { session, isTransparentReconnect } = this.getOrCreateSession({
|
|
1186
1168
|
to: parsed.from,
|
|
1187
1169
|
conn,
|
|
1188
1170
|
sessionId: parsed.payload.sessionId,
|
|
@@ -1198,7 +1180,7 @@ var ServerTransport = class extends Transport {
|
|
|
1198
1180
|
sessionId: session.id
|
|
1199
1181
|
});
|
|
1200
1182
|
conn.send(this.codec.toBuffer(responseMsg));
|
|
1201
|
-
this.onConnect(conn,
|
|
1183
|
+
this.onConnect(conn, session, isTransparentReconnect);
|
|
1202
1184
|
return session;
|
|
1203
1185
|
}
|
|
1204
1186
|
};
|