@replit/river 0.17.2 → 0.17.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-F6KWMEPR.js → chunk-7WY3Z5ZN.js} +5 -3
- package/dist/{chunk-MSAS5CVJ.js → chunk-F3LFO3GU.js} +1 -1
- package/dist/{chunk-4A7FDC2C.js → chunk-Q7OSVPZ5.js} +1 -1
- package/dist/{connection-0767dc6b.d.ts → connection-bdbd20da.d.ts} +1 -1
- package/dist/{connection-f31edbcd.d.ts → connection-c4a17403.d.ts} +1 -1
- package/dist/{index-8df0bdfb.d.ts → index-9e300e8a.d.ts} +2 -1
- package/dist/{procedures-1a298406.d.ts → procedures-1c0d2eee.d.ts} +1 -1
- package/dist/router/index.d.cts +3 -3
- package/dist/router/index.d.ts +3 -3
- package/dist/transport/impls/uds/client.cjs +5 -3
- 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 +4 -9
- 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 -8
- package/dist/transport/impls/ws/client.cjs +5 -3
- 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 +1 -3
- 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 +5 -3
- 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 +17 -15
- package/dist/util/testHelpers.d.cts +6 -6
- package/dist/util/testHelpers.d.ts +6 -6
- package/dist/util/testHelpers.js +18 -16
- package/package.json +2 -2
|
@@ -407,7 +407,6 @@ var Transport = class {
|
|
|
407
407
|
log?.warn(
|
|
408
408
|
`${this.clientId} -- connection from ${connectedTo} is a different session (id: ${advertisedSessionId}, last connected to: ${oldSession.advertisedSessionId}), starting a new session`
|
|
409
409
|
);
|
|
410
|
-
oldSession.close();
|
|
411
410
|
this.deleteSession(oldSession);
|
|
412
411
|
oldSession = void 0;
|
|
413
412
|
}
|
|
@@ -452,6 +451,7 @@ var Transport = class {
|
|
|
452
451
|
return session;
|
|
453
452
|
}
|
|
454
453
|
deleteSession(session) {
|
|
454
|
+
session.close();
|
|
455
455
|
this.sessions.delete(session.to);
|
|
456
456
|
log?.info(
|
|
457
457
|
`${this.clientId} -- session ${session.id} disconnect from ${session.to}`
|
|
@@ -599,7 +599,6 @@ var Transport = class {
|
|
|
599
599
|
close() {
|
|
600
600
|
this.state = "closed";
|
|
601
601
|
for (const session of this.sessions.values()) {
|
|
602
|
-
session.close();
|
|
603
602
|
this.deleteSession(session);
|
|
604
603
|
}
|
|
605
604
|
log?.info(`${this.clientId} -- manually closed transport`);
|
|
@@ -612,7 +611,6 @@ var Transport = class {
|
|
|
612
611
|
destroy() {
|
|
613
612
|
this.state = "destroyed";
|
|
614
613
|
for (const session of this.sessions.values()) {
|
|
615
|
-
session.close();
|
|
616
614
|
this.deleteSession(session);
|
|
617
615
|
}
|
|
618
616
|
log?.info(`${this.clientId} -- manually destroyed transport`);
|
|
@@ -793,6 +791,10 @@ var ClientTransport = class extends Transport {
|
|
|
793
791
|
}
|
|
794
792
|
}
|
|
795
793
|
}
|
|
794
|
+
deleteSession(session) {
|
|
795
|
+
this.inflightConnectionPromises.delete(session.to);
|
|
796
|
+
super.deleteSession(session);
|
|
797
|
+
}
|
|
796
798
|
sendHandshake(to, conn) {
|
|
797
799
|
const session = this.getOrCreateSession(to, conn);
|
|
798
800
|
const requestMsg = handshakeRequestMessage(this.clientId, to, session.id);
|
|
@@ -489,6 +489,7 @@ declare abstract class ClientTransport<ConnType extends Connection> extends Tran
|
|
|
489
489
|
* @param to The client ID of the node to connect to.
|
|
490
490
|
*/
|
|
491
491
|
connect(to: TransportClientId): Promise<void>;
|
|
492
|
+
protected deleteSession(session: Session<ConnType>): void;
|
|
492
493
|
protected sendHandshake(to: TransportClientId, conn: ConnType): void;
|
|
493
494
|
close(): void;
|
|
494
495
|
}
|
|
@@ -498,4 +499,4 @@ declare abstract class ServerTransport<ConnType extends Connection> extends Tran
|
|
|
498
499
|
receiveHandshakeRequestMessage(data: Uint8Array, conn: ConnType): Session<ConnType> | false;
|
|
499
500
|
}
|
|
500
501
|
|
|
501
|
-
export { Connection as C, EventMap as E, OpaqueTransportMessage as O, PartialTransportMessage as P, SessionOptions as S, Transport as T,
|
|
502
|
+
export { Connection as C, EventMap as E, OpaqueTransportMessage as O, PartialTransportMessage as P, SessionOptions as S, Transport as T, Session as a, ClientTransport as b, TransportClientId as c, ProvidedClientTransportOptions as d, ServerTransport as e, ProvidedTransportOptions as f, TransportStatus as g, TransportMessageSchema as h, OpaqueTransportMessageSchema as i, TransportMessage as j, isStreamOpen as k, isStreamClose as l, EventTypes as m, EventHandler as n, ProtocolError as o, ProtocolErrorType as p };
|
|
@@ -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 {
|
|
3
|
+
import { c as TransportClientId, a as Session, C as Connection } from './index-9e300e8a.js';
|
|
4
4
|
|
|
5
5
|
type TLiteralString = TLiteral<string>;
|
|
6
6
|
type RiverErrorSchema = TObject<{
|
package/dist/router/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TUnion, Static } from '@sinclair/typebox';
|
|
2
|
-
import { e as ProcedureMap, P as PayloadType, c as RiverUncaughtSchema, U as Unbranded, B as Branded, A as AnyProcedure, R as RiverError, b as Result, S as ServiceContext } from '../procedures-
|
|
3
|
-
export { E as Err, O as Ok, a as Procedure, d as ProcedureResult, f as RPCProcedure, m as RiverErrorSchema, j as ServiceContextWithState, k as ServiceContextWithTransportInfo, i as StreamProcedure, h as SubscriptionProcedure, l as UNCAUGHT_ERROR, g as UploadProcedure, V as ValidProcType } from '../procedures-
|
|
4
|
-
import {
|
|
2
|
+
import { e as ProcedureMap, P as PayloadType, c as RiverUncaughtSchema, U as Unbranded, B as Branded, A as AnyProcedure, R as RiverError, b as Result, S as ServiceContext } from '../procedures-1c0d2eee.js';
|
|
3
|
+
export { E as Err, O as Ok, a as Procedure, d as ProcedureResult, f as RPCProcedure, m as RiverErrorSchema, j as ServiceContextWithState, k as ServiceContextWithTransportInfo, i as StreamProcedure, h as SubscriptionProcedure, l as UNCAUGHT_ERROR, g as UploadProcedure, V as ValidProcType } from '../procedures-1c0d2eee.js';
|
|
4
|
+
import { e as ServerTransport, C as Connection, b as ClientTransport, c as TransportClientId } from '../index-9e300e8a.js';
|
|
5
5
|
import { Pushable } from 'it-pushable';
|
|
6
6
|
import '../types-3e5768ec.js';
|
|
7
7
|
|
package/dist/router/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TUnion, Static } from '@sinclair/typebox';
|
|
2
|
-
import { e as ProcedureMap, P as PayloadType, c as RiverUncaughtSchema, U as Unbranded, B as Branded, A as AnyProcedure, R as RiverError, b as Result, S as ServiceContext } from '../procedures-
|
|
3
|
-
export { E as Err, O as Ok, a as Procedure, d as ProcedureResult, f as RPCProcedure, m as RiverErrorSchema, j as ServiceContextWithState, k as ServiceContextWithTransportInfo, i as StreamProcedure, h as SubscriptionProcedure, l as UNCAUGHT_ERROR, g as UploadProcedure, V as ValidProcType } from '../procedures-
|
|
4
|
-
import {
|
|
2
|
+
import { e as ProcedureMap, P as PayloadType, c as RiverUncaughtSchema, U as Unbranded, B as Branded, A as AnyProcedure, R as RiverError, b as Result, S as ServiceContext } from '../procedures-1c0d2eee.js';
|
|
3
|
+
export { E as Err, O as Ok, a as Procedure, d as ProcedureResult, f as RPCProcedure, m as RiverErrorSchema, j as ServiceContextWithState, k as ServiceContextWithTransportInfo, i as StreamProcedure, h as SubscriptionProcedure, l as UNCAUGHT_ERROR, g as UploadProcedure, V as ValidProcType } from '../procedures-1c0d2eee.js';
|
|
4
|
+
import { e as ServerTransport, C as Connection, b as ClientTransport, c as TransportClientId } from '../index-9e300e8a.js';
|
|
5
5
|
import { Pushable } from 'it-pushable';
|
|
6
6
|
import '../types-3e5768ec.js';
|
|
7
7
|
|
|
@@ -644,7 +644,6 @@ var Transport = class {
|
|
|
644
644
|
log?.warn(
|
|
645
645
|
`${this.clientId} -- connection from ${connectedTo} is a different session (id: ${advertisedSessionId}, last connected to: ${oldSession.advertisedSessionId}), starting a new session`
|
|
646
646
|
);
|
|
647
|
-
oldSession.close();
|
|
648
647
|
this.deleteSession(oldSession);
|
|
649
648
|
oldSession = void 0;
|
|
650
649
|
}
|
|
@@ -689,6 +688,7 @@ var Transport = class {
|
|
|
689
688
|
return session;
|
|
690
689
|
}
|
|
691
690
|
deleteSession(session) {
|
|
691
|
+
session.close();
|
|
692
692
|
this.sessions.delete(session.to);
|
|
693
693
|
log?.info(
|
|
694
694
|
`${this.clientId} -- session ${session.id} disconnect from ${session.to}`
|
|
@@ -836,7 +836,6 @@ var Transport = class {
|
|
|
836
836
|
close() {
|
|
837
837
|
this.state = "closed";
|
|
838
838
|
for (const session of this.sessions.values()) {
|
|
839
|
-
session.close();
|
|
840
839
|
this.deleteSession(session);
|
|
841
840
|
}
|
|
842
841
|
log?.info(`${this.clientId} -- manually closed transport`);
|
|
@@ -849,7 +848,6 @@ var Transport = class {
|
|
|
849
848
|
destroy() {
|
|
850
849
|
this.state = "destroyed";
|
|
851
850
|
for (const session of this.sessions.values()) {
|
|
852
|
-
session.close();
|
|
853
851
|
this.deleteSession(session);
|
|
854
852
|
}
|
|
855
853
|
log?.info(`${this.clientId} -- manually destroyed transport`);
|
|
@@ -1030,6 +1028,10 @@ var ClientTransport = class extends Transport {
|
|
|
1030
1028
|
}
|
|
1031
1029
|
}
|
|
1032
1030
|
}
|
|
1031
|
+
deleteSession(session) {
|
|
1032
|
+
this.inflightConnectionPromises.delete(session.to);
|
|
1033
|
+
super.deleteSession(session);
|
|
1034
|
+
}
|
|
1033
1035
|
sendHandshake(to, conn) {
|
|
1034
1036
|
const session = this.getOrCreateSession(to, conn);
|
|
1035
1037
|
const requestMsg = handshakeRequestMessage(this.clientId, to, session.id);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { U as UdsConnection } from '../../../connection-
|
|
1
|
+
import { b as ClientTransport, d as ProvidedClientTransportOptions, c as TransportClientId } from '../../../index-9e300e8a.js';
|
|
2
|
+
import { U as UdsConnection } from '../../../connection-bdbd20da.js';
|
|
3
3
|
import '../../../types-3e5768ec.js';
|
|
4
4
|
import '@sinclair/typebox';
|
|
5
5
|
import 'node:net';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { U as UdsConnection } from '../../../connection-
|
|
1
|
+
import { b as ClientTransport, d as ProvidedClientTransportOptions, c as TransportClientId } from '../../../index-9e300e8a.js';
|
|
2
|
+
import { U as UdsConnection } from '../../../connection-bdbd20da.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-Q7OSVPZ5.js";
|
|
4
4
|
import {
|
|
5
5
|
ClientTransport
|
|
6
|
-
} from "../../../chunk-
|
|
6
|
+
} from "../../../chunk-7WY3Z5ZN.js";
|
|
7
7
|
import "../../../chunk-VH3NGOXQ.js";
|
|
8
8
|
import {
|
|
9
9
|
log
|
|
@@ -24,9 +24,6 @@ __export(server_exports, {
|
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(server_exports);
|
|
26
26
|
|
|
27
|
-
// logging/index.ts
|
|
28
|
-
var log;
|
|
29
|
-
|
|
30
27
|
// transport/transport.ts
|
|
31
28
|
var import_value = require("@sinclair/typebox/value");
|
|
32
29
|
|
|
@@ -98,6 +95,9 @@ function isAck(controlFlag) {
|
|
|
98
95
|
return (controlFlag & 1 /* AckBit */) === 1 /* AckBit */;
|
|
99
96
|
}
|
|
100
97
|
|
|
98
|
+
// logging/index.ts
|
|
99
|
+
var log;
|
|
100
|
+
|
|
101
101
|
// transport/events.ts
|
|
102
102
|
var ProtocolError = {
|
|
103
103
|
RetriesExceeded: "conn_retry_exceeded",
|
|
@@ -476,7 +476,6 @@ var Transport = class {
|
|
|
476
476
|
log?.warn(
|
|
477
477
|
`${this.clientId} -- connection from ${connectedTo} is a different session (id: ${advertisedSessionId}, last connected to: ${oldSession.advertisedSessionId}), starting a new session`
|
|
478
478
|
);
|
|
479
|
-
oldSession.close();
|
|
480
479
|
this.deleteSession(oldSession);
|
|
481
480
|
oldSession = void 0;
|
|
482
481
|
}
|
|
@@ -521,6 +520,7 @@ var Transport = class {
|
|
|
521
520
|
return session;
|
|
522
521
|
}
|
|
523
522
|
deleteSession(session) {
|
|
523
|
+
session.close();
|
|
524
524
|
this.sessions.delete(session.to);
|
|
525
525
|
log?.info(
|
|
526
526
|
`${this.clientId} -- session ${session.id} disconnect from ${session.to}`
|
|
@@ -668,7 +668,6 @@ var Transport = class {
|
|
|
668
668
|
close() {
|
|
669
669
|
this.state = "closed";
|
|
670
670
|
for (const session of this.sessions.values()) {
|
|
671
|
-
session.close();
|
|
672
671
|
this.deleteSession(session);
|
|
673
672
|
}
|
|
674
673
|
log?.info(`${this.clientId} -- manually closed transport`);
|
|
@@ -681,7 +680,6 @@ var Transport = class {
|
|
|
681
680
|
destroy() {
|
|
682
681
|
this.state = "destroyed";
|
|
683
682
|
for (const session of this.sessions.values()) {
|
|
684
|
-
session.close();
|
|
685
683
|
this.deleteSession(session);
|
|
686
684
|
}
|
|
687
685
|
log?.info(`${this.clientId} -- manually destroyed transport`);
|
|
@@ -887,9 +885,6 @@ var UnixDomainSocketServerTransport = class extends ServerTransport {
|
|
|
887
885
|
super(clientId, providedOptions);
|
|
888
886
|
this.server = server;
|
|
889
887
|
server.addListener("connection", this.connectionHandler);
|
|
890
|
-
server.on("listening", () => {
|
|
891
|
-
log?.info(`${this.clientId} -- server is listening`);
|
|
892
|
-
});
|
|
893
888
|
}
|
|
894
889
|
connectionHandler = (sock) => {
|
|
895
890
|
const conn = new UdsConnection(sock);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Server, Socket } from 'node:net';
|
|
2
|
-
import {
|
|
3
|
-
import { U as UdsConnection } from '../../../connection-
|
|
2
|
+
import { e as ServerTransport, c as TransportClientId, f as ProvidedTransportOptions } from '../../../index-9e300e8a.js';
|
|
3
|
+
import { U as UdsConnection } from '../../../connection-bdbd20da.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 {
|
|
3
|
-
import { U as UdsConnection } from '../../../connection-
|
|
2
|
+
import { e as ServerTransport, c as TransportClientId, f as ProvidedTransportOptions } from '../../../index-9e300e8a.js';
|
|
3
|
+
import { U as UdsConnection } from '../../../connection-bdbd20da.js';
|
|
4
4
|
import '../../../types-3e5768ec.js';
|
|
5
5
|
import '@sinclair/typebox';
|
|
6
6
|
import 'node:stream';
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
UdsConnection
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-Q7OSVPZ5.js";
|
|
4
4
|
import {
|
|
5
5
|
ServerTransport
|
|
6
|
-
} from "../../../chunk-
|
|
6
|
+
} from "../../../chunk-7WY3Z5ZN.js";
|
|
7
7
|
import "../../../chunk-VH3NGOXQ.js";
|
|
8
|
-
import
|
|
9
|
-
log
|
|
10
|
-
} from "../../../chunk-H4BYJELI.js";
|
|
8
|
+
import "../../../chunk-H4BYJELI.js";
|
|
11
9
|
import "../../../chunk-GZ7HCLLM.js";
|
|
12
10
|
|
|
13
11
|
// transport/impls/uds/server.ts
|
|
@@ -17,9 +15,6 @@ var UnixDomainSocketServerTransport = class extends ServerTransport {
|
|
|
17
15
|
super(clientId, providedOptions);
|
|
18
16
|
this.server = server;
|
|
19
17
|
server.addListener("connection", this.connectionHandler);
|
|
20
|
-
server.on("listening", () => {
|
|
21
|
-
log?.info(`${this.clientId} -- server is listening`);
|
|
22
|
-
});
|
|
23
18
|
}
|
|
24
19
|
connectionHandler = (sock) => {
|
|
25
20
|
const conn = new UdsConnection(sock);
|
|
@@ -548,7 +548,6 @@ var Transport = class {
|
|
|
548
548
|
log?.warn(
|
|
549
549
|
`${this.clientId} -- connection from ${connectedTo} is a different session (id: ${advertisedSessionId}, last connected to: ${oldSession.advertisedSessionId}), starting a new session`
|
|
550
550
|
);
|
|
551
|
-
oldSession.close();
|
|
552
551
|
this.deleteSession(oldSession);
|
|
553
552
|
oldSession = void 0;
|
|
554
553
|
}
|
|
@@ -593,6 +592,7 @@ var Transport = class {
|
|
|
593
592
|
return session;
|
|
594
593
|
}
|
|
595
594
|
deleteSession(session) {
|
|
595
|
+
session.close();
|
|
596
596
|
this.sessions.delete(session.to);
|
|
597
597
|
log?.info(
|
|
598
598
|
`${this.clientId} -- session ${session.id} disconnect from ${session.to}`
|
|
@@ -740,7 +740,6 @@ var Transport = class {
|
|
|
740
740
|
close() {
|
|
741
741
|
this.state = "closed";
|
|
742
742
|
for (const session of this.sessions.values()) {
|
|
743
|
-
session.close();
|
|
744
743
|
this.deleteSession(session);
|
|
745
744
|
}
|
|
746
745
|
log?.info(`${this.clientId} -- manually closed transport`);
|
|
@@ -753,7 +752,6 @@ var Transport = class {
|
|
|
753
752
|
destroy() {
|
|
754
753
|
this.state = "destroyed";
|
|
755
754
|
for (const session of this.sessions.values()) {
|
|
756
|
-
session.close();
|
|
757
755
|
this.deleteSession(session);
|
|
758
756
|
}
|
|
759
757
|
log?.info(`${this.clientId} -- manually destroyed transport`);
|
|
@@ -934,6 +932,10 @@ var ClientTransport = class extends Transport {
|
|
|
934
932
|
}
|
|
935
933
|
}
|
|
936
934
|
}
|
|
935
|
+
deleteSession(session) {
|
|
936
|
+
this.inflightConnectionPromises.delete(session.to);
|
|
937
|
+
super.deleteSession(session);
|
|
938
|
+
}
|
|
937
939
|
sendHandshake(to, conn) {
|
|
938
940
|
const session = this.getOrCreateSession(to, conn);
|
|
939
941
|
const requestMsg = handshakeRequestMessage(this.clientId, to, session.id);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import WebSocket from 'isomorphic-ws';
|
|
2
|
-
import {
|
|
3
|
-
import { W as WebSocketConnection } from '../../../connection-
|
|
2
|
+
import { b as ClientTransport, c as TransportClientId, d as ProvidedClientTransportOptions } from '../../../index-9e300e8a.js';
|
|
3
|
+
import { W as WebSocketConnection } from '../../../connection-c4a17403.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 {
|
|
3
|
-
import { W as WebSocketConnection } from '../../../connection-
|
|
2
|
+
import { b as ClientTransport, c as TransportClientId, d as ProvidedClientTransportOptions } from '../../../index-9e300e8a.js';
|
|
3
|
+
import { W as WebSocketConnection } from '../../../connection-c4a17403.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-F3LFO3GU.js";
|
|
4
4
|
import {
|
|
5
5
|
ClientTransport
|
|
6
|
-
} from "../../../chunk-
|
|
6
|
+
} from "../../../chunk-7WY3Z5ZN.js";
|
|
7
7
|
import "../../../chunk-VH3NGOXQ.js";
|
|
8
8
|
import {
|
|
9
9
|
log
|
|
@@ -476,7 +476,6 @@ var Transport = class {
|
|
|
476
476
|
log?.warn(
|
|
477
477
|
`${this.clientId} -- connection from ${connectedTo} is a different session (id: ${advertisedSessionId}, last connected to: ${oldSession.advertisedSessionId}), starting a new session`
|
|
478
478
|
);
|
|
479
|
-
oldSession.close();
|
|
480
479
|
this.deleteSession(oldSession);
|
|
481
480
|
oldSession = void 0;
|
|
482
481
|
}
|
|
@@ -521,6 +520,7 @@ var Transport = class {
|
|
|
521
520
|
return session;
|
|
522
521
|
}
|
|
523
522
|
deleteSession(session) {
|
|
523
|
+
session.close();
|
|
524
524
|
this.sessions.delete(session.to);
|
|
525
525
|
log?.info(
|
|
526
526
|
`${this.clientId} -- session ${session.id} disconnect from ${session.to}`
|
|
@@ -668,7 +668,6 @@ var Transport = class {
|
|
|
668
668
|
close() {
|
|
669
669
|
this.state = "closed";
|
|
670
670
|
for (const session of this.sessions.values()) {
|
|
671
|
-
session.close();
|
|
672
671
|
this.deleteSession(session);
|
|
673
672
|
}
|
|
674
673
|
log?.info(`${this.clientId} -- manually closed transport`);
|
|
@@ -681,7 +680,6 @@ var Transport = class {
|
|
|
681
680
|
destroy() {
|
|
682
681
|
this.state = "destroyed";
|
|
683
682
|
for (const session of this.sessions.values()) {
|
|
684
|
-
session.close();
|
|
685
683
|
this.deleteSession(session);
|
|
686
684
|
}
|
|
687
685
|
log?.info(`${this.clientId} -- manually destroyed transport`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { e as ServerTransport, c as TransportClientId, f as ProvidedTransportOptions } from '../../../index-9e300e8a.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-c4a17403.js';
|
|
5
5
|
import '../../../types-3e5768ec.js';
|
|
6
6
|
import '@sinclair/typebox';
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { e as ServerTransport, c as TransportClientId, f as ProvidedTransportOptions } from '../../../index-9e300e8a.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-c4a17403.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-F3LFO3GU.js";
|
|
4
4
|
import {
|
|
5
5
|
ServerTransport
|
|
6
|
-
} from "../../../chunk-
|
|
6
|
+
} from "../../../chunk-7WY3Z5ZN.js";
|
|
7
7
|
import "../../../chunk-VH3NGOXQ.js";
|
|
8
8
|
import "../../../chunk-H4BYJELI.js";
|
|
9
9
|
import "../../../chunk-GZ7HCLLM.js";
|
package/dist/transport/index.cjs
CHANGED
|
@@ -570,7 +570,6 @@ var Transport = class {
|
|
|
570
570
|
log?.warn(
|
|
571
571
|
`${this.clientId} -- connection from ${connectedTo} is a different session (id: ${advertisedSessionId}, last connected to: ${oldSession.advertisedSessionId}), starting a new session`
|
|
572
572
|
);
|
|
573
|
-
oldSession.close();
|
|
574
573
|
this.deleteSession(oldSession);
|
|
575
574
|
oldSession = void 0;
|
|
576
575
|
}
|
|
@@ -615,6 +614,7 @@ var Transport = class {
|
|
|
615
614
|
return session;
|
|
616
615
|
}
|
|
617
616
|
deleteSession(session) {
|
|
617
|
+
session.close();
|
|
618
618
|
this.sessions.delete(session.to);
|
|
619
619
|
log?.info(
|
|
620
620
|
`${this.clientId} -- session ${session.id} disconnect from ${session.to}`
|
|
@@ -762,7 +762,6 @@ var Transport = class {
|
|
|
762
762
|
close() {
|
|
763
763
|
this.state = "closed";
|
|
764
764
|
for (const session of this.sessions.values()) {
|
|
765
|
-
session.close();
|
|
766
765
|
this.deleteSession(session);
|
|
767
766
|
}
|
|
768
767
|
log?.info(`${this.clientId} -- manually closed transport`);
|
|
@@ -775,7 +774,6 @@ var Transport = class {
|
|
|
775
774
|
destroy() {
|
|
776
775
|
this.state = "destroyed";
|
|
777
776
|
for (const session of this.sessions.values()) {
|
|
778
|
-
session.close();
|
|
779
777
|
this.deleteSession(session);
|
|
780
778
|
}
|
|
781
779
|
log?.info(`${this.clientId} -- manually destroyed transport`);
|
|
@@ -956,6 +954,10 @@ var ClientTransport = class extends Transport {
|
|
|
956
954
|
}
|
|
957
955
|
}
|
|
958
956
|
}
|
|
957
|
+
deleteSession(session) {
|
|
958
|
+
this.inflightConnectionPromises.delete(session.to);
|
|
959
|
+
super.deleteSession(session);
|
|
960
|
+
}
|
|
959
961
|
sendHandshake(to, conn) {
|
|
960
962
|
const session = this.getOrCreateSession(to, conn);
|
|
961
963
|
const requestMsg = handshakeRequestMessage(this.clientId, to, session.id);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { b as ClientTransport, d as ClientTransportOptions, C as Connection, n as EventHandler, E as EventMap, m as EventTypes, O as OpaqueTransportMessage, i as OpaqueTransportMessageSchema, o as ProtocolError, p as ProtocolErrorType, e as ServerTransport, a as Session, T as Transport, c as TransportClientId, j as TransportMessage, h as TransportMessageSchema, f as TransportOptions, g as TransportStatus, l as isStreamClose, k as isStreamOpen } from '../index-9e300e8a.js';
|
|
2
2
|
import '../types-3e5768ec.js';
|
|
3
3
|
import '@sinclair/typebox';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { b as ClientTransport, d as ClientTransportOptions, C as Connection, n as EventHandler, E as EventMap, m as EventTypes, O as OpaqueTransportMessage, i as OpaqueTransportMessageSchema, o as ProtocolError, p as ProtocolErrorType, e as ServerTransport, a as Session, T as Transport, c as TransportClientId, j as TransportMessage, h as TransportMessageSchema, f as TransportOptions, g as TransportStatus, l as isStreamClose, k as isStreamOpen } from '../index-9e300e8a.js';
|
|
2
2
|
import '../types-3e5768ec.js';
|
|
3
3
|
import '@sinclair/typebox';
|
package/dist/transport/index.js
CHANGED
|
@@ -696,28 +696,30 @@ function catchProcError(err) {
|
|
|
696
696
|
};
|
|
697
697
|
}
|
|
698
698
|
var testingSessionOptions = defaultTransportOptions;
|
|
699
|
-
function
|
|
700
|
-
|
|
699
|
+
function dummySession() {
|
|
700
|
+
return new Session(
|
|
701
701
|
void 0,
|
|
702
702
|
"client",
|
|
703
|
-
"
|
|
703
|
+
"server",
|
|
704
704
|
testingSessionOptions
|
|
705
705
|
);
|
|
706
|
+
}
|
|
707
|
+
function dummyCtx(state, session, extendedContext) {
|
|
706
708
|
return {
|
|
707
709
|
...extendedContext,
|
|
708
710
|
state,
|
|
709
|
-
to:
|
|
710
|
-
from:
|
|
711
|
+
to: session.to,
|
|
712
|
+
from: session.from,
|
|
711
713
|
streamId: (0, import_nanoid2.nanoid)(),
|
|
712
714
|
session
|
|
713
715
|
};
|
|
714
716
|
}
|
|
715
|
-
function asClientRpc(state, proc, extendedContext) {
|
|
717
|
+
function asClientRpc(state, proc, extendedContext, session = dummySession()) {
|
|
716
718
|
return async (msg) => {
|
|
717
|
-
return await proc.handler(dummyCtx(state, extendedContext), msg).catch(catchProcError);
|
|
719
|
+
return await proc.handler(dummyCtx(state, session, extendedContext), msg).catch(catchProcError);
|
|
718
720
|
};
|
|
719
721
|
}
|
|
720
|
-
function asClientStream(state, proc, init, extendedContext) {
|
|
722
|
+
function asClientStream(state, proc, init, extendedContext, session = dummySession()) {
|
|
721
723
|
const input = pushable({ objectMode: true });
|
|
722
724
|
const output = pushable({
|
|
723
725
|
objectMode: true
|
|
@@ -725,34 +727,34 @@ function asClientStream(state, proc, init, extendedContext) {
|
|
|
725
727
|
void (async () => {
|
|
726
728
|
if (init) {
|
|
727
729
|
const _proc = proc;
|
|
728
|
-
await _proc.handler(dummyCtx(state, extendedContext), init, input, output).catch((err) => output.push(catchProcError(err)));
|
|
730
|
+
await _proc.handler(dummyCtx(state, session, extendedContext), init, input, output).catch((err) => output.push(catchProcError(err)));
|
|
729
731
|
} else {
|
|
730
732
|
const _proc = proc;
|
|
731
|
-
await _proc.handler(dummyCtx(state, extendedContext), input, output).catch((err) => output.push(catchProcError(err)));
|
|
733
|
+
await _proc.handler(dummyCtx(state, session, extendedContext), input, output).catch((err) => output.push(catchProcError(err)));
|
|
732
734
|
}
|
|
733
735
|
})();
|
|
734
736
|
return [input, output];
|
|
735
737
|
}
|
|
736
|
-
function asClientSubscription(state, proc, extendedContext) {
|
|
738
|
+
function asClientSubscription(state, proc, extendedContext, session = dummySession()) {
|
|
737
739
|
const output = pushable({
|
|
738
740
|
objectMode: true
|
|
739
741
|
});
|
|
740
742
|
return (msg) => {
|
|
741
743
|
void (async () => {
|
|
742
|
-
return await proc.handler(dummyCtx(state, extendedContext), msg, output).catch((err) => output.push(catchProcError(err)));
|
|
744
|
+
return await proc.handler(dummyCtx(state, session, extendedContext), msg, output).catch((err) => output.push(catchProcError(err)));
|
|
743
745
|
})();
|
|
744
746
|
return output;
|
|
745
747
|
};
|
|
746
748
|
}
|
|
747
|
-
function asClientUpload(state, proc, init, extendedContext) {
|
|
749
|
+
function asClientUpload(state, proc, init, extendedContext, session = dummySession()) {
|
|
748
750
|
const input = pushable({ objectMode: true });
|
|
749
751
|
if (init) {
|
|
750
752
|
const _proc = proc;
|
|
751
|
-
const result = _proc.handler(dummyCtx(state, extendedContext), init, input).catch(catchProcError);
|
|
753
|
+
const result = _proc.handler(dummyCtx(state, session, extendedContext), init, input).catch(catchProcError);
|
|
752
754
|
return [input, result];
|
|
753
755
|
} else {
|
|
754
756
|
const _proc = proc;
|
|
755
|
-
const result = _proc.handler(dummyCtx(state, extendedContext), input).catch(catchProcError);
|
|
757
|
+
const result = _proc.handler(dummyCtx(state, session, extendedContext), input).catch(catchProcError);
|
|
756
758
|
return [input, result];
|
|
757
759
|
}
|
|
758
760
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Static } from '@sinclair/typebox';
|
|
2
|
-
import { P as PayloadType, R as RiverError, a as Procedure, S as ServiceContext, b as Result, c as RiverUncaughtSchema, d as ProcedureResult } from '../procedures-
|
|
3
|
-
import { P as PartialTransportMessage, T as Transport, C as Connection, O as OpaqueTransportMessage, S as SessionOptions } from '../index-
|
|
2
|
+
import { P as PayloadType, R as RiverError, a as Procedure, S as ServiceContext, b as Result, c as RiverUncaughtSchema, d as ProcedureResult } from '../procedures-1c0d2eee.js';
|
|
3
|
+
import { P as PartialTransportMessage, T as Transport, C as Connection, O as OpaqueTransportMessage, S as SessionOptions, a as Session } from '../index-9e300e8a.js';
|
|
4
4
|
import * as it_pushable from 'it-pushable';
|
|
5
5
|
import WebSocket from 'isomorphic-ws';
|
|
6
6
|
import http from 'node:http';
|
|
@@ -49,10 +49,10 @@ declare function createDummyTransportMessage(): PartialTransportMessage<{
|
|
|
49
49
|
*/
|
|
50
50
|
declare function waitForMessage(t: Transport<Connection>, filter?: (msg: OpaqueTransportMessage) => boolean, rejectMismatch?: boolean): Promise<unknown>;
|
|
51
51
|
declare const testingSessionOptions: SessionOptions;
|
|
52
|
-
declare function asClientRpc<State extends object, I extends PayloadType, O extends PayloadType, E extends RiverError, Init extends PayloadType | null = null>(state: State, proc: Procedure<State, 'rpc', I, O, E, Init>, extendedContext?: Omit<ServiceContext, 'state'>): (msg: Static<I>) => Promise<Result<Static<O>, Static<E> | Static<typeof RiverUncaughtSchema>>>;
|
|
53
|
-
declare function asClientStream<State extends object, I extends PayloadType, O extends PayloadType, E extends RiverError, Init extends PayloadType | null = null>(state: State, proc: Procedure<State, 'stream', I, O, E, Init>, init?: Init extends PayloadType ? Static<Init> : null, extendedContext?: Omit<ServiceContext, 'state'>): readonly [it_pushable.Pushable<Static<I>, void, unknown>, it_pushable.Pushable<Result<Static<O>, Static<E>>, void, unknown>];
|
|
54
|
-
declare function asClientSubscription<State extends object, I extends PayloadType, O extends PayloadType, E extends RiverError>(state: State, proc: Procedure<State, 'subscription', I, O, E>, extendedContext?: Omit<ServiceContext, 'state'>): (msg: Static<I>) => it_pushable.Pushable<Result<Static<O>, Static<E>>, void, unknown>;
|
|
55
|
-
declare function asClientUpload<State extends object, I extends PayloadType, O extends PayloadType, E extends RiverError, Init extends PayloadType | null = null>(state: State, proc: Procedure<State, 'upload', I, O, E, Init>, init?: Init extends PayloadType ? Static<Init> : null, extendedContext?: Omit<ServiceContext, 'state'>): readonly [it_pushable.Pushable<Static<I>, void, unknown>, Promise<{
|
|
52
|
+
declare function asClientRpc<State extends object, I extends PayloadType, O extends PayloadType, E extends RiverError, Init extends PayloadType | null = null>(state: State, proc: Procedure<State, 'rpc', I, O, E, Init>, extendedContext?: Omit<ServiceContext, 'state'>, session?: Session<Connection>): (msg: Static<I>) => Promise<Result<Static<O>, Static<E> | Static<typeof RiverUncaughtSchema>>>;
|
|
53
|
+
declare function asClientStream<State extends object, I extends PayloadType, O extends PayloadType, E extends RiverError, Init extends PayloadType | null = null>(state: State, proc: Procedure<State, 'stream', I, O, E, Init>, init?: Init extends PayloadType ? Static<Init> : null, extendedContext?: Omit<ServiceContext, 'state'>, session?: Session<Connection>): readonly [it_pushable.Pushable<Static<I>, void, unknown>, it_pushable.Pushable<Result<Static<O>, Static<E>>, void, unknown>];
|
|
54
|
+
declare function asClientSubscription<State extends object, I extends PayloadType, O extends PayloadType, E extends RiverError>(state: State, proc: Procedure<State, 'subscription', I, O, E>, extendedContext?: Omit<ServiceContext, 'state'>, session?: Session<Connection>): (msg: Static<I>) => it_pushable.Pushable<Result<Static<O>, Static<E>>, void, unknown>;
|
|
55
|
+
declare function asClientUpload<State extends object, I extends PayloadType, O extends PayloadType, E extends RiverError, Init extends PayloadType | null = null>(state: State, proc: Procedure<State, 'upload', I, O, E, Init>, init?: Init extends PayloadType ? Static<Init> : null, extendedContext?: Omit<ServiceContext, 'state'>, session?: Session<Connection>): readonly [it_pushable.Pushable<Static<I>, void, unknown>, Promise<{
|
|
56
56
|
ok: boolean;
|
|
57
57
|
payload: {
|
|
58
58
|
code: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Static } from '@sinclair/typebox';
|
|
2
|
-
import { P as PayloadType, R as RiverError, a as Procedure, S as ServiceContext, b as Result, c as RiverUncaughtSchema, d as ProcedureResult } from '../procedures-
|
|
3
|
-
import { P as PartialTransportMessage, T as Transport, C as Connection, O as OpaqueTransportMessage, S as SessionOptions } from '../index-
|
|
2
|
+
import { P as PayloadType, R as RiverError, a as Procedure, S as ServiceContext, b as Result, c as RiverUncaughtSchema, d as ProcedureResult } from '../procedures-1c0d2eee.js';
|
|
3
|
+
import { P as PartialTransportMessage, T as Transport, C as Connection, O as OpaqueTransportMessage, S as SessionOptions, a as Session } from '../index-9e300e8a.js';
|
|
4
4
|
import * as it_pushable from 'it-pushable';
|
|
5
5
|
import WebSocket from 'isomorphic-ws';
|
|
6
6
|
import http from 'node:http';
|
|
@@ -49,10 +49,10 @@ declare function createDummyTransportMessage(): PartialTransportMessage<{
|
|
|
49
49
|
*/
|
|
50
50
|
declare function waitForMessage(t: Transport<Connection>, filter?: (msg: OpaqueTransportMessage) => boolean, rejectMismatch?: boolean): Promise<unknown>;
|
|
51
51
|
declare const testingSessionOptions: SessionOptions;
|
|
52
|
-
declare function asClientRpc<State extends object, I extends PayloadType, O extends PayloadType, E extends RiverError, Init extends PayloadType | null = null>(state: State, proc: Procedure<State, 'rpc', I, O, E, Init>, extendedContext?: Omit<ServiceContext, 'state'>): (msg: Static<I>) => Promise<Result<Static<O>, Static<E> | Static<typeof RiverUncaughtSchema>>>;
|
|
53
|
-
declare function asClientStream<State extends object, I extends PayloadType, O extends PayloadType, E extends RiverError, Init extends PayloadType | null = null>(state: State, proc: Procedure<State, 'stream', I, O, E, Init>, init?: Init extends PayloadType ? Static<Init> : null, extendedContext?: Omit<ServiceContext, 'state'>): readonly [it_pushable.Pushable<Static<I>, void, unknown>, it_pushable.Pushable<Result<Static<O>, Static<E>>, void, unknown>];
|
|
54
|
-
declare function asClientSubscription<State extends object, I extends PayloadType, O extends PayloadType, E extends RiverError>(state: State, proc: Procedure<State, 'subscription', I, O, E>, extendedContext?: Omit<ServiceContext, 'state'>): (msg: Static<I>) => it_pushable.Pushable<Result<Static<O>, Static<E>>, void, unknown>;
|
|
55
|
-
declare function asClientUpload<State extends object, I extends PayloadType, O extends PayloadType, E extends RiverError, Init extends PayloadType | null = null>(state: State, proc: Procedure<State, 'upload', I, O, E, Init>, init?: Init extends PayloadType ? Static<Init> : null, extendedContext?: Omit<ServiceContext, 'state'>): readonly [it_pushable.Pushable<Static<I>, void, unknown>, Promise<{
|
|
52
|
+
declare function asClientRpc<State extends object, I extends PayloadType, O extends PayloadType, E extends RiverError, Init extends PayloadType | null = null>(state: State, proc: Procedure<State, 'rpc', I, O, E, Init>, extendedContext?: Omit<ServiceContext, 'state'>, session?: Session<Connection>): (msg: Static<I>) => Promise<Result<Static<O>, Static<E> | Static<typeof RiverUncaughtSchema>>>;
|
|
53
|
+
declare function asClientStream<State extends object, I extends PayloadType, O extends PayloadType, E extends RiverError, Init extends PayloadType | null = null>(state: State, proc: Procedure<State, 'stream', I, O, E, Init>, init?: Init extends PayloadType ? Static<Init> : null, extendedContext?: Omit<ServiceContext, 'state'>, session?: Session<Connection>): readonly [it_pushable.Pushable<Static<I>, void, unknown>, it_pushable.Pushable<Result<Static<O>, Static<E>>, void, unknown>];
|
|
54
|
+
declare function asClientSubscription<State extends object, I extends PayloadType, O extends PayloadType, E extends RiverError>(state: State, proc: Procedure<State, 'subscription', I, O, E>, extendedContext?: Omit<ServiceContext, 'state'>, session?: Session<Connection>): (msg: Static<I>) => it_pushable.Pushable<Result<Static<O>, Static<E>>, void, unknown>;
|
|
55
|
+
declare function asClientUpload<State extends object, I extends PayloadType, O extends PayloadType, E extends RiverError, Init extends PayloadType | null = null>(state: State, proc: Procedure<State, 'upload', I, O, E, Init>, init?: Init extends PayloadType ? Static<Init> : null, extendedContext?: Omit<ServiceContext, 'state'>, session?: Session<Connection>): readonly [it_pushable.Pushable<Static<I>, void, unknown>, Promise<{
|
|
56
56
|
ok: boolean;
|
|
57
57
|
payload: {
|
|
58
58
|
code: string;
|
package/dist/util/testHelpers.js
CHANGED
|
@@ -6,7 +6,7 @@ import "../chunk-RPIDSIQG.js";
|
|
|
6
6
|
import {
|
|
7
7
|
Session,
|
|
8
8
|
defaultTransportOptions
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-7WY3Z5ZN.js";
|
|
10
10
|
import {
|
|
11
11
|
coerceErrorString
|
|
12
12
|
} from "../chunk-VH3NGOXQ.js";
|
|
@@ -86,28 +86,30 @@ function catchProcError(err) {
|
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
88
|
var testingSessionOptions = defaultTransportOptions;
|
|
89
|
-
function
|
|
90
|
-
|
|
89
|
+
function dummySession() {
|
|
90
|
+
return new Session(
|
|
91
91
|
void 0,
|
|
92
92
|
"client",
|
|
93
|
-
"
|
|
93
|
+
"server",
|
|
94
94
|
testingSessionOptions
|
|
95
95
|
);
|
|
96
|
+
}
|
|
97
|
+
function dummyCtx(state, session, extendedContext) {
|
|
96
98
|
return {
|
|
97
99
|
...extendedContext,
|
|
98
100
|
state,
|
|
99
|
-
to:
|
|
100
|
-
from:
|
|
101
|
+
to: session.to,
|
|
102
|
+
from: session.from,
|
|
101
103
|
streamId: nanoid(),
|
|
102
104
|
session
|
|
103
105
|
};
|
|
104
106
|
}
|
|
105
|
-
function asClientRpc(state, proc, extendedContext) {
|
|
107
|
+
function asClientRpc(state, proc, extendedContext, session = dummySession()) {
|
|
106
108
|
return async (msg) => {
|
|
107
|
-
return await proc.handler(dummyCtx(state, extendedContext), msg).catch(catchProcError);
|
|
109
|
+
return await proc.handler(dummyCtx(state, session, extendedContext), msg).catch(catchProcError);
|
|
108
110
|
};
|
|
109
111
|
}
|
|
110
|
-
function asClientStream(state, proc, init, extendedContext) {
|
|
112
|
+
function asClientStream(state, proc, init, extendedContext, session = dummySession()) {
|
|
111
113
|
const input = pushable({ objectMode: true });
|
|
112
114
|
const output = pushable({
|
|
113
115
|
objectMode: true
|
|
@@ -115,34 +117,34 @@ function asClientStream(state, proc, init, extendedContext) {
|
|
|
115
117
|
void (async () => {
|
|
116
118
|
if (init) {
|
|
117
119
|
const _proc = proc;
|
|
118
|
-
await _proc.handler(dummyCtx(state, extendedContext), init, input, output).catch((err) => output.push(catchProcError(err)));
|
|
120
|
+
await _proc.handler(dummyCtx(state, session, extendedContext), init, input, output).catch((err) => output.push(catchProcError(err)));
|
|
119
121
|
} else {
|
|
120
122
|
const _proc = proc;
|
|
121
|
-
await _proc.handler(dummyCtx(state, extendedContext), input, output).catch((err) => output.push(catchProcError(err)));
|
|
123
|
+
await _proc.handler(dummyCtx(state, session, extendedContext), input, output).catch((err) => output.push(catchProcError(err)));
|
|
122
124
|
}
|
|
123
125
|
})();
|
|
124
126
|
return [input, output];
|
|
125
127
|
}
|
|
126
|
-
function asClientSubscription(state, proc, extendedContext) {
|
|
128
|
+
function asClientSubscription(state, proc, extendedContext, session = dummySession()) {
|
|
127
129
|
const output = pushable({
|
|
128
130
|
objectMode: true
|
|
129
131
|
});
|
|
130
132
|
return (msg) => {
|
|
131
133
|
void (async () => {
|
|
132
|
-
return await proc.handler(dummyCtx(state, extendedContext), msg, output).catch((err) => output.push(catchProcError(err)));
|
|
134
|
+
return await proc.handler(dummyCtx(state, session, extendedContext), msg, output).catch((err) => output.push(catchProcError(err)));
|
|
133
135
|
})();
|
|
134
136
|
return output;
|
|
135
137
|
};
|
|
136
138
|
}
|
|
137
|
-
function asClientUpload(state, proc, init, extendedContext) {
|
|
139
|
+
function asClientUpload(state, proc, init, extendedContext, session = dummySession()) {
|
|
138
140
|
const input = pushable({ objectMode: true });
|
|
139
141
|
if (init) {
|
|
140
142
|
const _proc = proc;
|
|
141
|
-
const result = _proc.handler(dummyCtx(state, extendedContext), init, input).catch(catchProcError);
|
|
143
|
+
const result = _proc.handler(dummyCtx(state, session, extendedContext), init, input).catch(catchProcError);
|
|
142
144
|
return [input, result];
|
|
143
145
|
} else {
|
|
144
146
|
const _proc = proc;
|
|
145
|
-
const result = _proc.handler(dummyCtx(state, extendedContext), input).catch(catchProcError);
|
|
147
|
+
const result = _proc.handler(dummyCtx(state, session, extendedContext), input).catch(catchProcError);
|
|
146
148
|
return [input, result];
|
|
147
149
|
}
|
|
148
150
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@replit/river",
|
|
3
3
|
"description": "It's like tRPC but... with JSON Schema Support, duplex streaming and support for service multiplexing. Transport agnostic!",
|
|
4
|
-
"version": "0.17.
|
|
4
|
+
"version": "0.17.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"release": "npm publish --access public",
|
|
83
83
|
"test:ui": "echo \"remember to go to /__vitest__ in the webview\" && vitest --ui --api.host 0.0.0.0 --api.port 3000",
|
|
84
84
|
"test": "vitest --test-timeout=500",
|
|
85
|
-
"test:single": "vitest run --test-timeout=500",
|
|
85
|
+
"test:single": "vitest run --test-timeout=500 --reporter=dot",
|
|
86
86
|
"test:flake": "./flake.sh",
|
|
87
87
|
"bench": "vitest bench"
|
|
88
88
|
},
|