@replit/river 0.13.2 → 0.13.3
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/{builder-eef3b061.d.ts → builder-d649690f.d.ts} +1 -1
- package/dist/{chunk-3Y2K543F.js → chunk-5V6B7TM3.js} +1 -1
- package/dist/{chunk-23MWJLVJ.js → chunk-FIX2F6VT.js} +1 -1
- package/dist/{chunk-NLWRMDT6.js → chunk-MCTB3NYK.js} +13 -10
- package/dist/{connection-d052d027.d.ts → connection-2b55cc7f.d.ts} +1 -1
- package/dist/{connection-03e650c8.d.ts → connection-6222fd0b.d.ts} +1 -1
- package/dist/{index-9aa0aabb.d.ts → index-1c1493df.d.ts} +2 -2
- package/dist/router/index.d.cts +3 -3
- package/dist/router/index.d.ts +3 -3
- package/dist/transport/impls/uds/client.cjs +12 -9
- 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 +2 -2
- package/dist/transport/impls/uds/server.cjs +5 -5
- 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 +2 -2
- package/dist/transport/impls/ws/client.cjs +12 -9
- 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 +2 -2
- package/dist/transport/impls/ws/server.cjs +5 -5
- 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 +2 -2
- package/dist/transport/index.cjs +13 -10
- package/dist/transport/index.d.cts +1 -1
- package/dist/transport/index.d.ts +1 -1
- package/dist/transport/index.js +1 -1
- package/dist/util/testHelpers.cjs +3 -0
- package/dist/util/testHelpers.d.cts +2 -2
- package/dist/util/testHelpers.d.ts +2 -2
- package/dist/util/testHelpers.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TObject, TUnion, TString, TSchema, TNever, TLiteral, Static } from '@sinclair/typebox';
|
|
2
2
|
import { Pushable } from 'it-pushable';
|
|
3
|
-
import { b as TransportClientId, d as Session, C as Connection } from './index-
|
|
3
|
+
import { b as TransportClientId, d as Session, C as Connection } from './index-1c1493df.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* The context for services/procedures. This is used only on
|
|
@@ -213,6 +213,9 @@ var Session = class {
|
|
|
213
213
|
this.connection = newConn;
|
|
214
214
|
}
|
|
215
215
|
beginGrace(cb) {
|
|
216
|
+
log?.info(
|
|
217
|
+
`${this.from} -- starting ${this.options.sessionDisconnectGraceMs}ms grace period until session (id: ${this.debugId}) to ${this.to} is closed`
|
|
218
|
+
);
|
|
216
219
|
this.disconnectionGrace = setTimeout(() => {
|
|
217
220
|
this.close();
|
|
218
221
|
cb();
|
|
@@ -384,14 +387,11 @@ var Transport = class {
|
|
|
384
387
|
* @param conn The connection object.
|
|
385
388
|
* @param connectedTo The peer we are connected to.
|
|
386
389
|
*/
|
|
387
|
-
onDisconnect(conn,
|
|
390
|
+
onDisconnect(conn, session) {
|
|
388
391
|
this.eventDispatcher.dispatchEvent("connectionStatus", {
|
|
389
392
|
status: "disconnect",
|
|
390
393
|
conn
|
|
391
394
|
});
|
|
392
|
-
const session = this.sessions.get(connectedTo);
|
|
393
|
-
if (!session)
|
|
394
|
-
return;
|
|
395
395
|
session.connection = void 0;
|
|
396
396
|
session.beginGrace(() => this.deleteSession(session));
|
|
397
397
|
}
|
|
@@ -549,13 +549,14 @@ var ClientTransport = class extends Transport {
|
|
|
549
549
|
this.inflightConnectionPromises = /* @__PURE__ */ new Map();
|
|
550
550
|
}
|
|
551
551
|
handleConnection(conn, to) {
|
|
552
|
+
let session = void 0;
|
|
552
553
|
const handshakeHandler = (data) => {
|
|
553
554
|
const handshake = this.receiveHandshakeResponseMessage(data);
|
|
554
555
|
if (!handshake) {
|
|
555
556
|
conn.close();
|
|
556
557
|
return;
|
|
557
558
|
}
|
|
558
|
-
this.onConnect(conn, handshake.from, handshake.instanceId);
|
|
559
|
+
session = this.onConnect(conn, handshake.from, handshake.instanceId);
|
|
559
560
|
conn.removeDataListener(handshakeHandler);
|
|
560
561
|
conn.addDataListener((data2) => {
|
|
561
562
|
const parsed = this.parseMsg(data2);
|
|
@@ -568,7 +569,9 @@ var ClientTransport = class extends Transport {
|
|
|
568
569
|
};
|
|
569
570
|
conn.addDataListener(handshakeHandler);
|
|
570
571
|
conn.addCloseListener(() => {
|
|
571
|
-
|
|
572
|
+
if (session) {
|
|
573
|
+
this.onDisconnect(conn, session);
|
|
574
|
+
}
|
|
572
575
|
void this.connect(to);
|
|
573
576
|
});
|
|
574
577
|
conn.addErrorListener((err) => {
|
|
@@ -651,9 +654,9 @@ var ClientTransport = class extends Transport {
|
|
|
651
654
|
log?.debug(`${this.clientId} -- sending handshake request to ${to}`);
|
|
652
655
|
conn.send(this.codec.toBuffer(requestMsg));
|
|
653
656
|
}
|
|
654
|
-
onDisconnect(conn,
|
|
655
|
-
this.inflightConnectionPromises.delete(
|
|
656
|
-
super.onDisconnect(conn,
|
|
657
|
+
onDisconnect(conn, session) {
|
|
658
|
+
this.inflightConnectionPromises.delete(session.to);
|
|
659
|
+
super.onDisconnect(conn, session);
|
|
657
660
|
}
|
|
658
661
|
};
|
|
659
662
|
var ServerTransport = class extends Transport {
|
|
@@ -690,7 +693,7 @@ var ServerTransport = class extends Transport {
|
|
|
690
693
|
log?.info(
|
|
691
694
|
`${this.clientId} -- connection (id: ${conn.debugId}) to ${client()} disconnected`
|
|
692
695
|
);
|
|
693
|
-
this.onDisconnect(conn, session
|
|
696
|
+
this.onDisconnect(conn, session);
|
|
694
697
|
});
|
|
695
698
|
conn.addErrorListener((err) => {
|
|
696
699
|
if (!session)
|
|
@@ -336,7 +336,7 @@ declare abstract class Transport<ConnType extends Connection> {
|
|
|
336
336
|
* @param conn The connection object.
|
|
337
337
|
* @param connectedTo The peer we are connected to.
|
|
338
338
|
*/
|
|
339
|
-
protected onDisconnect(conn: ConnType,
|
|
339
|
+
protected onDisconnect(conn: ConnType, session: Session<ConnType>): void;
|
|
340
340
|
/**
|
|
341
341
|
* Parses a message from a Uint8Array into a {@link OpaqueTransportMessage}.
|
|
342
342
|
* @param msg The message to parse.
|
|
@@ -410,7 +410,7 @@ declare abstract class ClientTransport<ConnType extends Connection> extends Tran
|
|
|
410
410
|
*/
|
|
411
411
|
connect(to: TransportClientId, attempt?: number): Promise<void>;
|
|
412
412
|
protected sendHandshake(to: TransportClientId, conn: ConnType): void;
|
|
413
|
-
protected onDisconnect(conn: ConnType,
|
|
413
|
+
protected onDisconnect(conn: ConnType, session: Session<ConnType>): void;
|
|
414
414
|
}
|
|
415
415
|
declare abstract class ServerTransport<ConnType extends Connection> extends Transport<ConnType> {
|
|
416
416
|
constructor(clientId: TransportClientId, providedOptions?: Partial<TransportOptions>);
|
package/dist/router/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as AnyService, P as PayloadType, b as Result, R as RiverError, S as ServiceContext, d as ProcType, e as ProcInput, f as ProcOutput, g as ProcErrors, h as ProcHasInit, i as ProcInit } from '../builder-
|
|
2
|
-
export { E as Err, O as Ok, m as ProcHandler, k as ProcListing, a as Procedure, p as RiverErrorSchema, c as RiverUncaughtSchema, l as Service, j as ServiceBuilder, n as ServiceContextWithState, o as ServiceContextWithTransportInfo, U as UNCAUGHT_ERROR, V as ValidProcType, s as serializeService } from '../builder-
|
|
3
|
-
import { S as ServerTransport, C as Connection, a as ClientTransport } from '../index-
|
|
1
|
+
import { A as AnyService, P as PayloadType, b as Result, R as RiverError, S as ServiceContext, d as ProcType, e as ProcInput, f as ProcOutput, g as ProcErrors, h as ProcHasInit, i as ProcInit } from '../builder-d649690f.js';
|
|
2
|
+
export { E as Err, O as Ok, m as ProcHandler, k as ProcListing, a as Procedure, p as RiverErrorSchema, c as RiverUncaughtSchema, l as Service, j as ServiceBuilder, n as ServiceContextWithState, o as ServiceContextWithTransportInfo, U as UNCAUGHT_ERROR, V as ValidProcType, s as serializeService } from '../builder-d649690f.js';
|
|
3
|
+
import { S as ServerTransport, C as Connection, a as ClientTransport } from '../index-1c1493df.js';
|
|
4
4
|
import { Pushable } from 'it-pushable';
|
|
5
5
|
import { Static } from '@sinclair/typebox';
|
|
6
6
|
import '../types-3e5768ec.js';
|
package/dist/router/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { A as AnyService, P as PayloadType, b as Result, R as RiverError, S as ServiceContext, d as ProcType, e as ProcInput, f as ProcOutput, g as ProcErrors, h as ProcHasInit, i as ProcInit } from '../builder-
|
|
2
|
-
export { E as Err, O as Ok, m as ProcHandler, k as ProcListing, a as Procedure, p as RiverErrorSchema, c as RiverUncaughtSchema, l as Service, j as ServiceBuilder, n as ServiceContextWithState, o as ServiceContextWithTransportInfo, U as UNCAUGHT_ERROR, V as ValidProcType, s as serializeService } from '../builder-
|
|
3
|
-
import { S as ServerTransport, C as Connection, a as ClientTransport } from '../index-
|
|
1
|
+
import { A as AnyService, P as PayloadType, b as Result, R as RiverError, S as ServiceContext, d as ProcType, e as ProcInput, f as ProcOutput, g as ProcErrors, h as ProcHasInit, i as ProcInit } from '../builder-d649690f.js';
|
|
2
|
+
export { E as Err, O as Ok, m as ProcHandler, k as ProcListing, a as Procedure, p as RiverErrorSchema, c as RiverUncaughtSchema, l as Service, j as ServiceBuilder, n as ServiceContextWithState, o as ServiceContextWithTransportInfo, U as UNCAUGHT_ERROR, V as ValidProcType, s as serializeService } from '../builder-d649690f.js';
|
|
3
|
+
import { S as ServerTransport, C as Connection, a as ClientTransport } from '../index-1c1493df.js';
|
|
4
4
|
import { Pushable } from 'it-pushable';
|
|
5
5
|
import { Static } from '@sinclair/typebox';
|
|
6
6
|
import '../types-3e5768ec.js';
|
|
@@ -321,6 +321,9 @@ var Session = class {
|
|
|
321
321
|
this.connection = newConn;
|
|
322
322
|
}
|
|
323
323
|
beginGrace(cb) {
|
|
324
|
+
log?.info(
|
|
325
|
+
`${this.from} -- starting ${this.options.sessionDisconnectGraceMs}ms grace period until session (id: ${this.debugId}) to ${this.to} is closed`
|
|
326
|
+
);
|
|
324
327
|
this.disconnectionGrace = setTimeout(() => {
|
|
325
328
|
this.close();
|
|
326
329
|
cb();
|
|
@@ -625,14 +628,11 @@ var Transport = class {
|
|
|
625
628
|
* @param conn The connection object.
|
|
626
629
|
* @param connectedTo The peer we are connected to.
|
|
627
630
|
*/
|
|
628
|
-
onDisconnect(conn,
|
|
631
|
+
onDisconnect(conn, session) {
|
|
629
632
|
this.eventDispatcher.dispatchEvent("connectionStatus", {
|
|
630
633
|
status: "disconnect",
|
|
631
634
|
conn
|
|
632
635
|
});
|
|
633
|
-
const session = this.sessions.get(connectedTo);
|
|
634
|
-
if (!session)
|
|
635
|
-
return;
|
|
636
636
|
session.connection = void 0;
|
|
637
637
|
session.beginGrace(() => this.deleteSession(session));
|
|
638
638
|
}
|
|
@@ -790,13 +790,14 @@ var ClientTransport = class extends Transport {
|
|
|
790
790
|
this.inflightConnectionPromises = /* @__PURE__ */ new Map();
|
|
791
791
|
}
|
|
792
792
|
handleConnection(conn, to) {
|
|
793
|
+
let session = void 0;
|
|
793
794
|
const handshakeHandler = (data) => {
|
|
794
795
|
const handshake = this.receiveHandshakeResponseMessage(data);
|
|
795
796
|
if (!handshake) {
|
|
796
797
|
conn.close();
|
|
797
798
|
return;
|
|
798
799
|
}
|
|
799
|
-
this.onConnect(conn, handshake.from, handshake.instanceId);
|
|
800
|
+
session = this.onConnect(conn, handshake.from, handshake.instanceId);
|
|
800
801
|
conn.removeDataListener(handshakeHandler);
|
|
801
802
|
conn.addDataListener((data2) => {
|
|
802
803
|
const parsed = this.parseMsg(data2);
|
|
@@ -809,7 +810,9 @@ var ClientTransport = class extends Transport {
|
|
|
809
810
|
};
|
|
810
811
|
conn.addDataListener(handshakeHandler);
|
|
811
812
|
conn.addCloseListener(() => {
|
|
812
|
-
|
|
813
|
+
if (session) {
|
|
814
|
+
this.onDisconnect(conn, session);
|
|
815
|
+
}
|
|
813
816
|
void this.connect(to);
|
|
814
817
|
});
|
|
815
818
|
conn.addErrorListener((err) => {
|
|
@@ -892,9 +895,9 @@ var ClientTransport = class extends Transport {
|
|
|
892
895
|
log?.debug(`${this.clientId} -- sending handshake request to ${to}`);
|
|
893
896
|
conn.send(this.codec.toBuffer(requestMsg));
|
|
894
897
|
}
|
|
895
|
-
onDisconnect(conn,
|
|
896
|
-
this.inflightConnectionPromises.delete(
|
|
897
|
-
super.onDisconnect(conn,
|
|
898
|
+
onDisconnect(conn, session) {
|
|
899
|
+
this.inflightConnectionPromises.delete(session.to);
|
|
900
|
+
super.onDisconnect(conn, session);
|
|
898
901
|
}
|
|
899
902
|
};
|
|
900
903
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as ClientTransport, b as TransportClientId, c as TransportOptions } from '../../../index-
|
|
2
|
-
import { U as UdsConnection } from '../../../connection-
|
|
1
|
+
import { a as ClientTransport, b as TransportClientId, c as TransportOptions } from '../../../index-1c1493df.js';
|
|
2
|
+
import { U as UdsConnection } from '../../../connection-6222fd0b.js';
|
|
3
3
|
import '../../../types-3e5768ec.js';
|
|
4
4
|
import '@sinclair/typebox';
|
|
5
5
|
import 'node:net';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as ClientTransport, b as TransportClientId, c as TransportOptions } from '../../../index-
|
|
2
|
-
import { U as UdsConnection } from '../../../connection-
|
|
1
|
+
import { a as ClientTransport, b as TransportClientId, c as TransportOptions } from '../../../index-1c1493df.js';
|
|
2
|
+
import { U as UdsConnection } from '../../../connection-6222fd0b.js';
|
|
3
3
|
import '../../../types-3e5768ec.js';
|
|
4
4
|
import '@sinclair/typebox';
|
|
5
5
|
import 'node:net';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
UdsConnection
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-FIX2F6VT.js";
|
|
4
4
|
import {
|
|
5
5
|
ClientTransport
|
|
6
|
-
} from "../../../chunk-
|
|
6
|
+
} from "../../../chunk-MCTB3NYK.js";
|
|
7
7
|
import "../../../chunk-GFRAOY75.js";
|
|
8
8
|
import {
|
|
9
9
|
log
|
|
@@ -359,6 +359,9 @@ var Session = class {
|
|
|
359
359
|
this.connection = newConn;
|
|
360
360
|
}
|
|
361
361
|
beginGrace(cb) {
|
|
362
|
+
log?.info(
|
|
363
|
+
`${this.from} -- starting ${this.options.sessionDisconnectGraceMs}ms grace period until session (id: ${this.debugId}) to ${this.to} is closed`
|
|
364
|
+
);
|
|
362
365
|
this.disconnectionGrace = setTimeout(() => {
|
|
363
366
|
this.close();
|
|
364
367
|
cb();
|
|
@@ -539,14 +542,11 @@ var Transport = class {
|
|
|
539
542
|
* @param conn The connection object.
|
|
540
543
|
* @param connectedTo The peer we are connected to.
|
|
541
544
|
*/
|
|
542
|
-
onDisconnect(conn,
|
|
545
|
+
onDisconnect(conn, session) {
|
|
543
546
|
this.eventDispatcher.dispatchEvent("connectionStatus", {
|
|
544
547
|
status: "disconnect",
|
|
545
548
|
conn
|
|
546
549
|
});
|
|
547
|
-
const session = this.sessions.get(connectedTo);
|
|
548
|
-
if (!session)
|
|
549
|
-
return;
|
|
550
550
|
session.connection = void 0;
|
|
551
551
|
session.beginGrace(() => this.deleteSession(session));
|
|
552
552
|
}
|
|
@@ -725,7 +725,7 @@ var ServerTransport = class extends Transport {
|
|
|
725
725
|
log?.info(
|
|
726
726
|
`${this.clientId} -- connection (id: ${conn.debugId}) to ${client()} disconnected`
|
|
727
727
|
);
|
|
728
|
-
this.onDisconnect(conn, session
|
|
728
|
+
this.onDisconnect(conn, session);
|
|
729
729
|
});
|
|
730
730
|
conn.addErrorListener((err) => {
|
|
731
731
|
if (!session)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Server, Socket } from 'node:net';
|
|
2
|
-
import { S as ServerTransport, b as TransportClientId, c as TransportOptions } from '../../../index-
|
|
3
|
-
import { U as UdsConnection } from '../../../connection-
|
|
2
|
+
import { S as ServerTransport, b as TransportClientId, c as TransportOptions } from '../../../index-1c1493df.js';
|
|
3
|
+
import { U as UdsConnection } from '../../../connection-6222fd0b.js';
|
|
4
4
|
import '../../../types-3e5768ec.js';
|
|
5
5
|
import '@sinclair/typebox';
|
|
6
6
|
import 'node:stream';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Server, Socket } from 'node:net';
|
|
2
|
-
import { S as ServerTransport, b as TransportClientId, c as TransportOptions } from '../../../index-
|
|
3
|
-
import { U as UdsConnection } from '../../../connection-
|
|
2
|
+
import { S as ServerTransport, b as TransportClientId, c as TransportOptions } from '../../../index-1c1493df.js';
|
|
3
|
+
import { U as UdsConnection } from '../../../connection-6222fd0b.js';
|
|
4
4
|
import '../../../types-3e5768ec.js';
|
|
5
5
|
import '@sinclair/typebox';
|
|
6
6
|
import 'node:stream';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
UdsConnection
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-FIX2F6VT.js";
|
|
4
4
|
import {
|
|
5
5
|
ServerTransport
|
|
6
|
-
} from "../../../chunk-
|
|
6
|
+
} from "../../../chunk-MCTB3NYK.js";
|
|
7
7
|
import "../../../chunk-GFRAOY75.js";
|
|
8
8
|
import {
|
|
9
9
|
log
|
|
@@ -351,6 +351,9 @@ var Session = class {
|
|
|
351
351
|
this.connection = newConn;
|
|
352
352
|
}
|
|
353
353
|
beginGrace(cb) {
|
|
354
|
+
log?.info(
|
|
355
|
+
`${this.from} -- starting ${this.options.sessionDisconnectGraceMs}ms grace period until session (id: ${this.debugId}) to ${this.to} is closed`
|
|
356
|
+
);
|
|
354
357
|
this.disconnectionGrace = setTimeout(() => {
|
|
355
358
|
this.close();
|
|
356
359
|
cb();
|
|
@@ -531,14 +534,11 @@ var Transport = class {
|
|
|
531
534
|
* @param conn The connection object.
|
|
532
535
|
* @param connectedTo The peer we are connected to.
|
|
533
536
|
*/
|
|
534
|
-
onDisconnect(conn,
|
|
537
|
+
onDisconnect(conn, session) {
|
|
535
538
|
this.eventDispatcher.dispatchEvent("connectionStatus", {
|
|
536
539
|
status: "disconnect",
|
|
537
540
|
conn
|
|
538
541
|
});
|
|
539
|
-
const session = this.sessions.get(connectedTo);
|
|
540
|
-
if (!session)
|
|
541
|
-
return;
|
|
542
542
|
session.connection = void 0;
|
|
543
543
|
session.beginGrace(() => this.deleteSession(session));
|
|
544
544
|
}
|
|
@@ -696,13 +696,14 @@ var ClientTransport = class extends Transport {
|
|
|
696
696
|
this.inflightConnectionPromises = /* @__PURE__ */ new Map();
|
|
697
697
|
}
|
|
698
698
|
handleConnection(conn, to) {
|
|
699
|
+
let session = void 0;
|
|
699
700
|
const handshakeHandler = (data) => {
|
|
700
701
|
const handshake = this.receiveHandshakeResponseMessage(data);
|
|
701
702
|
if (!handshake) {
|
|
702
703
|
conn.close();
|
|
703
704
|
return;
|
|
704
705
|
}
|
|
705
|
-
this.onConnect(conn, handshake.from, handshake.instanceId);
|
|
706
|
+
session = this.onConnect(conn, handshake.from, handshake.instanceId);
|
|
706
707
|
conn.removeDataListener(handshakeHandler);
|
|
707
708
|
conn.addDataListener((data2) => {
|
|
708
709
|
const parsed = this.parseMsg(data2);
|
|
@@ -715,7 +716,9 @@ var ClientTransport = class extends Transport {
|
|
|
715
716
|
};
|
|
716
717
|
conn.addDataListener(handshakeHandler);
|
|
717
718
|
conn.addCloseListener(() => {
|
|
718
|
-
|
|
719
|
+
if (session) {
|
|
720
|
+
this.onDisconnect(conn, session);
|
|
721
|
+
}
|
|
719
722
|
void this.connect(to);
|
|
720
723
|
});
|
|
721
724
|
conn.addErrorListener((err) => {
|
|
@@ -798,9 +801,9 @@ var ClientTransport = class extends Transport {
|
|
|
798
801
|
log?.debug(`${this.clientId} -- sending handshake request to ${to}`);
|
|
799
802
|
conn.send(this.codec.toBuffer(requestMsg));
|
|
800
803
|
}
|
|
801
|
-
onDisconnect(conn,
|
|
802
|
-
this.inflightConnectionPromises.delete(
|
|
803
|
-
super.onDisconnect(conn,
|
|
804
|
+
onDisconnect(conn, session) {
|
|
805
|
+
this.inflightConnectionPromises.delete(session.to);
|
|
806
|
+
super.onDisconnect(conn, session);
|
|
804
807
|
}
|
|
805
808
|
};
|
|
806
809
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import WebSocket from 'isomorphic-ws';
|
|
2
|
-
import { a as ClientTransport, b as TransportClientId, c as TransportOptions } from '../../../index-
|
|
3
|
-
import { W as WebSocketConnection } from '../../../connection-
|
|
2
|
+
import { a as ClientTransport, b as TransportClientId, c as TransportOptions } from '../../../index-1c1493df.js';
|
|
3
|
+
import { W as WebSocketConnection } from '../../../connection-2b55cc7f.js';
|
|
4
4
|
import '../../../types-3e5768ec.js';
|
|
5
5
|
import '@sinclair/typebox';
|
|
6
6
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import WebSocket from 'isomorphic-ws';
|
|
2
|
-
import { a as ClientTransport, b as TransportClientId, c as TransportOptions } from '../../../index-
|
|
3
|
-
import { W as WebSocketConnection } from '../../../connection-
|
|
2
|
+
import { a as ClientTransport, b as TransportClientId, c as TransportOptions } from '../../../index-1c1493df.js';
|
|
3
|
+
import { W as WebSocketConnection } from '../../../connection-2b55cc7f.js';
|
|
4
4
|
import '../../../types-3e5768ec.js';
|
|
5
5
|
import '@sinclair/typebox';
|
|
6
6
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WebSocketConnection
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-5V6B7TM3.js";
|
|
4
4
|
import {
|
|
5
5
|
ClientTransport
|
|
6
|
-
} from "../../../chunk-
|
|
6
|
+
} from "../../../chunk-MCTB3NYK.js";
|
|
7
7
|
import "../../../chunk-GFRAOY75.js";
|
|
8
8
|
import {
|
|
9
9
|
log
|
|
@@ -359,6 +359,9 @@ var Session = class {
|
|
|
359
359
|
this.connection = newConn;
|
|
360
360
|
}
|
|
361
361
|
beginGrace(cb) {
|
|
362
|
+
log?.info(
|
|
363
|
+
`${this.from} -- starting ${this.options.sessionDisconnectGraceMs}ms grace period until session (id: ${this.debugId}) to ${this.to} is closed`
|
|
364
|
+
);
|
|
362
365
|
this.disconnectionGrace = setTimeout(() => {
|
|
363
366
|
this.close();
|
|
364
367
|
cb();
|
|
@@ -539,14 +542,11 @@ var Transport = class {
|
|
|
539
542
|
* @param conn The connection object.
|
|
540
543
|
* @param connectedTo The peer we are connected to.
|
|
541
544
|
*/
|
|
542
|
-
onDisconnect(conn,
|
|
545
|
+
onDisconnect(conn, session) {
|
|
543
546
|
this.eventDispatcher.dispatchEvent("connectionStatus", {
|
|
544
547
|
status: "disconnect",
|
|
545
548
|
conn
|
|
546
549
|
});
|
|
547
|
-
const session = this.sessions.get(connectedTo);
|
|
548
|
-
if (!session)
|
|
549
|
-
return;
|
|
550
550
|
session.connection = void 0;
|
|
551
551
|
session.beginGrace(() => this.deleteSession(session));
|
|
552
552
|
}
|
|
@@ -725,7 +725,7 @@ var ServerTransport = class extends Transport {
|
|
|
725
725
|
log?.info(
|
|
726
726
|
`${this.clientId} -- connection (id: ${conn.debugId}) to ${client()} disconnected`
|
|
727
727
|
);
|
|
728
|
-
this.onDisconnect(conn, session
|
|
728
|
+
this.onDisconnect(conn, session);
|
|
729
729
|
});
|
|
730
730
|
conn.addErrorListener((err) => {
|
|
731
731
|
if (!session)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { S as ServerTransport, b as TransportClientId, c as TransportOptions } from '../../../index-
|
|
1
|
+
import { S as ServerTransport, b as TransportClientId, c as TransportOptions } from '../../../index-1c1493df.js';
|
|
2
2
|
import { WebSocketServer } from 'ws';
|
|
3
3
|
import { WebSocket } from 'isomorphic-ws';
|
|
4
|
-
import { W as WebSocketConnection } from '../../../connection-
|
|
4
|
+
import { W as WebSocketConnection } from '../../../connection-2b55cc7f.js';
|
|
5
5
|
import '../../../types-3e5768ec.js';
|
|
6
6
|
import '@sinclair/typebox';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { S as ServerTransport, b as TransportClientId, c as TransportOptions } from '../../../index-
|
|
1
|
+
import { S as ServerTransport, b as TransportClientId, c as TransportOptions } from '../../../index-1c1493df.js';
|
|
2
2
|
import { WebSocketServer } from 'ws';
|
|
3
3
|
import { WebSocket } from 'isomorphic-ws';
|
|
4
|
-
import { W as WebSocketConnection } from '../../../connection-
|
|
4
|
+
import { W as WebSocketConnection } from '../../../connection-2b55cc7f.js';
|
|
5
5
|
import '../../../types-3e5768ec.js';
|
|
6
6
|
import '@sinclair/typebox';
|
|
7
7
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WebSocketConnection
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-5V6B7TM3.js";
|
|
4
4
|
import {
|
|
5
5
|
ServerTransport
|
|
6
|
-
} from "../../../chunk-
|
|
6
|
+
} from "../../../chunk-MCTB3NYK.js";
|
|
7
7
|
import "../../../chunk-GFRAOY75.js";
|
|
8
8
|
import {
|
|
9
9
|
log
|
package/dist/transport/index.cjs
CHANGED
|
@@ -381,6 +381,9 @@ var Session = class {
|
|
|
381
381
|
this.connection = newConn;
|
|
382
382
|
}
|
|
383
383
|
beginGrace(cb) {
|
|
384
|
+
log?.info(
|
|
385
|
+
`${this.from} -- starting ${this.options.sessionDisconnectGraceMs}ms grace period until session (id: ${this.debugId}) to ${this.to} is closed`
|
|
386
|
+
);
|
|
384
387
|
this.disconnectionGrace = setTimeout(() => {
|
|
385
388
|
this.close();
|
|
386
389
|
cb();
|
|
@@ -561,14 +564,11 @@ var Transport = class {
|
|
|
561
564
|
* @param conn The connection object.
|
|
562
565
|
* @param connectedTo The peer we are connected to.
|
|
563
566
|
*/
|
|
564
|
-
onDisconnect(conn,
|
|
567
|
+
onDisconnect(conn, session) {
|
|
565
568
|
this.eventDispatcher.dispatchEvent("connectionStatus", {
|
|
566
569
|
status: "disconnect",
|
|
567
570
|
conn
|
|
568
571
|
});
|
|
569
|
-
const session = this.sessions.get(connectedTo);
|
|
570
|
-
if (!session)
|
|
571
|
-
return;
|
|
572
572
|
session.connection = void 0;
|
|
573
573
|
session.beginGrace(() => this.deleteSession(session));
|
|
574
574
|
}
|
|
@@ -726,13 +726,14 @@ var ClientTransport = class extends Transport {
|
|
|
726
726
|
this.inflightConnectionPromises = /* @__PURE__ */ new Map();
|
|
727
727
|
}
|
|
728
728
|
handleConnection(conn, to) {
|
|
729
|
+
let session = void 0;
|
|
729
730
|
const handshakeHandler = (data) => {
|
|
730
731
|
const handshake = this.receiveHandshakeResponseMessage(data);
|
|
731
732
|
if (!handshake) {
|
|
732
733
|
conn.close();
|
|
733
734
|
return;
|
|
734
735
|
}
|
|
735
|
-
this.onConnect(conn, handshake.from, handshake.instanceId);
|
|
736
|
+
session = this.onConnect(conn, handshake.from, handshake.instanceId);
|
|
736
737
|
conn.removeDataListener(handshakeHandler);
|
|
737
738
|
conn.addDataListener((data2) => {
|
|
738
739
|
const parsed = this.parseMsg(data2);
|
|
@@ -745,7 +746,9 @@ var ClientTransport = class extends Transport {
|
|
|
745
746
|
};
|
|
746
747
|
conn.addDataListener(handshakeHandler);
|
|
747
748
|
conn.addCloseListener(() => {
|
|
748
|
-
|
|
749
|
+
if (session) {
|
|
750
|
+
this.onDisconnect(conn, session);
|
|
751
|
+
}
|
|
749
752
|
void this.connect(to);
|
|
750
753
|
});
|
|
751
754
|
conn.addErrorListener((err) => {
|
|
@@ -828,9 +831,9 @@ var ClientTransport = class extends Transport {
|
|
|
828
831
|
log?.debug(`${this.clientId} -- sending handshake request to ${to}`);
|
|
829
832
|
conn.send(this.codec.toBuffer(requestMsg));
|
|
830
833
|
}
|
|
831
|
-
onDisconnect(conn,
|
|
832
|
-
this.inflightConnectionPromises.delete(
|
|
833
|
-
super.onDisconnect(conn,
|
|
834
|
+
onDisconnect(conn, session) {
|
|
835
|
+
this.inflightConnectionPromises.delete(session.to);
|
|
836
|
+
super.onDisconnect(conn, session);
|
|
834
837
|
}
|
|
835
838
|
};
|
|
836
839
|
var ServerTransport = class extends Transport {
|
|
@@ -867,7 +870,7 @@ var ServerTransport = class extends Transport {
|
|
|
867
870
|
log?.info(
|
|
868
871
|
`${this.clientId} -- connection (id: ${conn.debugId}) to ${client()} disconnected`
|
|
869
872
|
);
|
|
870
|
-
this.onDisconnect(conn, session
|
|
873
|
+
this.onDisconnect(conn, session);
|
|
871
874
|
});
|
|
872
875
|
conn.addErrorListener((err) => {
|
|
873
876
|
if (!session)
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { a as ClientTransport, C as Connection, k as EventHandler, E as EventMap, j as EventTypes, O as OpaqueTransportMessage, f as OpaqueTransportMessageSchema, S as ServerTransport, d as Session, T as Transport, b as TransportClientId, g as TransportMessage, e as TransportMessageSchema, h as isStreamClose, i as isStreamOpen } from '../index-
|
|
1
|
+
export { a as ClientTransport, C as Connection, k as EventHandler, E as EventMap, j as EventTypes, O as OpaqueTransportMessage, f as OpaqueTransportMessageSchema, S as ServerTransport, d as Session, T as Transport, b as TransportClientId, g as TransportMessage, e as TransportMessageSchema, h as isStreamClose, i as isStreamOpen } from '../index-1c1493df.js';
|
|
2
2
|
import '../types-3e5768ec.js';
|
|
3
3
|
import '@sinclair/typebox';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { a as ClientTransport, C as Connection, k as EventHandler, E as EventMap, j as EventTypes, O as OpaqueTransportMessage, f as OpaqueTransportMessageSchema, S as ServerTransport, d as Session, T as Transport, b as TransportClientId, g as TransportMessage, e as TransportMessageSchema, h as isStreamClose, i as isStreamOpen } from '../index-
|
|
1
|
+
export { a as ClientTransport, C as Connection, k as EventHandler, E as EventMap, j as EventTypes, O as OpaqueTransportMessage, f as OpaqueTransportMessageSchema, S as ServerTransport, d as Session, T as Transport, b as TransportClientId, g as TransportMessage, e as TransportMessageSchema, h as isStreamClose, i as isStreamOpen } from '../index-1c1493df.js';
|
|
2
2
|
import '../types-3e5768ec.js';
|
|
3
3
|
import '@sinclair/typebox';
|
package/dist/transport/index.js
CHANGED
|
@@ -269,6 +269,9 @@ var Session = class {
|
|
|
269
269
|
this.connection = newConn;
|
|
270
270
|
}
|
|
271
271
|
beginGrace(cb) {
|
|
272
|
+
log?.info(
|
|
273
|
+
`${this.from} -- starting ${this.options.sessionDisconnectGraceMs}ms grace period until session (id: ${this.debugId}) to ${this.to} is closed`
|
|
274
|
+
);
|
|
272
275
|
this.disconnectionGrace = setTimeout(() => {
|
|
273
276
|
this.close();
|
|
274
277
|
cb();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as it_pushable from 'it-pushable';
|
|
2
2
|
import WebSocket from 'isomorphic-ws';
|
|
3
3
|
import http from 'node:http';
|
|
4
|
-
import { P as PartialTransportMessage, T as Transport, C as Connection, O as OpaqueTransportMessage } from '../index-
|
|
5
|
-
import { P as PayloadType, R as RiverError, a as Procedure, S as ServiceContext, b as Result, c as RiverUncaughtSchema } from '../builder-
|
|
4
|
+
import { P as PartialTransportMessage, T as Transport, C as Connection, O as OpaqueTransportMessage } from '../index-1c1493df.js';
|
|
5
|
+
import { P as PayloadType, R as RiverError, a as Procedure, S as ServiceContext, b as Result, c as RiverUncaughtSchema } from '../builder-d649690f.js';
|
|
6
6
|
import { Static } from '@sinclair/typebox';
|
|
7
7
|
import net from 'node:net';
|
|
8
8
|
import '../types-3e5768ec.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as it_pushable from 'it-pushable';
|
|
2
2
|
import WebSocket from 'isomorphic-ws';
|
|
3
3
|
import http from 'node:http';
|
|
4
|
-
import { P as PartialTransportMessage, T as Transport, C as Connection, O as OpaqueTransportMessage } from '../index-
|
|
5
|
-
import { P as PayloadType, R as RiverError, a as Procedure, S as ServiceContext, b as Result, c as RiverUncaughtSchema } from '../builder-
|
|
4
|
+
import { P as PartialTransportMessage, T as Transport, C as Connection, O as OpaqueTransportMessage } from '../index-1c1493df.js';
|
|
5
|
+
import { P as PayloadType, R as RiverError, a as Procedure, S as ServiceContext, b as Result, c as RiverUncaughtSchema } from '../builder-d649690f.js';
|
|
6
6
|
import { Static } from '@sinclair/typebox';
|
|
7
7
|
import net from 'node:net';
|
|
8
8
|
import '../types-3e5768ec.js';
|
package/dist/util/testHelpers.js
CHANGED
package/package.json
CHANGED