@replit/river 0.200.0-rc.2 → 0.200.0-rc.20
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/README.md +30 -29
- package/dist/chunk-3HI3IJTL.js +285 -0
- package/dist/chunk-3HI3IJTL.js.map +1 -0
- package/dist/chunk-5L5RNZXH.js +391 -0
- package/dist/chunk-5L5RNZXH.js.map +1 -0
- package/dist/{chunk-QMM35C3H.js → chunk-BAGOAJ3K.js} +1 -1
- package/dist/chunk-BAGOAJ3K.js.map +1 -0
- package/dist/{chunk-S5RL45KH.js → chunk-BYCR4VEM.js} +78 -54
- package/dist/chunk-BYCR4VEM.js.map +1 -0
- package/dist/chunk-DM5QR4HQ.js +60 -0
- package/dist/chunk-DM5QR4HQ.js.map +1 -0
- package/dist/chunk-OLWVR5AB.js +860 -0
- package/dist/chunk-OLWVR5AB.js.map +1 -0
- package/dist/chunk-WKBWCRGN.js +437 -0
- package/dist/chunk-WKBWCRGN.js.map +1 -0
- package/dist/chunk-YBCQVIPR.js +351 -0
- package/dist/chunk-YBCQVIPR.js.map +1 -0
- package/dist/client-75090f07.d.ts +49 -0
- package/dist/connection-c9f96b64.d.ts +32 -0
- package/dist/context-9c907028.d.ts +622 -0
- package/dist/logging/index.cjs.map +1 -1
- package/dist/logging/index.d.cts +1 -1
- package/dist/logging/index.d.ts +1 -1
- package/dist/logging/index.js +1 -1
- package/dist/{index-10ebd26a.d.ts → message-59fe53e1.d.ts} +34 -31
- package/dist/router/index.cjs +771 -1159
- package/dist/router/index.cjs.map +1 -1
- package/dist/router/index.d.cts +14 -48
- package/dist/router/index.d.ts +14 -48
- package/dist/router/index.js +1238 -15
- package/dist/router/index.js.map +1 -1
- package/dist/server-109a29e2.d.ts +69 -0
- package/dist/services-aa49a9fb.d.ts +811 -0
- package/dist/transport/impls/ws/client.cjs +1293 -1034
- package/dist/transport/impls/ws/client.cjs.map +1 -1
- package/dist/transport/impls/ws/client.d.cts +7 -5
- package/dist/transport/impls/ws/client.d.ts +7 -5
- package/dist/transport/impls/ws/client.js +11 -11
- package/dist/transport/impls/ws/client.js.map +1 -1
- package/dist/transport/impls/ws/server.cjs +1437 -1072
- package/dist/transport/impls/ws/server.cjs.map +1 -1
- package/dist/transport/impls/ws/server.d.cts +7 -5
- package/dist/transport/impls/ws/server.d.ts +7 -5
- package/dist/transport/impls/ws/server.js +20 -8
- package/dist/transport/impls/ws/server.js.map +1 -1
- package/dist/transport/index.cjs +1720 -1400
- package/dist/transport/index.cjs.map +1 -1
- package/dist/transport/index.d.cts +5 -26
- package/dist/transport/index.d.ts +5 -26
- package/dist/transport/index.js +11 -11
- package/dist/util/testHelpers.cjs +1164 -591
- package/dist/util/testHelpers.cjs.map +1 -1
- package/dist/util/testHelpers.d.cts +41 -38
- package/dist/util/testHelpers.d.ts +41 -38
- package/dist/util/testHelpers.js +124 -89
- package/dist/util/testHelpers.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-47TFNAY2.js +0 -476
- package/dist/chunk-47TFNAY2.js.map +0 -1
- package/dist/chunk-4VNY34QG.js +0 -106
- package/dist/chunk-4VNY34QG.js.map +0 -1
- package/dist/chunk-7CKIN3JT.js +0 -2004
- package/dist/chunk-7CKIN3JT.js.map +0 -1
- package/dist/chunk-CZP4LK3F.js +0 -335
- package/dist/chunk-CZP4LK3F.js.map +0 -1
- package/dist/chunk-DJCW3SKT.js +0 -59
- package/dist/chunk-DJCW3SKT.js.map +0 -1
- package/dist/chunk-NQWDT6GS.js +0 -347
- package/dist/chunk-NQWDT6GS.js.map +0 -1
- package/dist/chunk-ONUXWVRC.js +0 -492
- package/dist/chunk-ONUXWVRC.js.map +0 -1
- package/dist/chunk-QMM35C3H.js.map +0 -1
- package/dist/chunk-S5RL45KH.js.map +0 -1
- package/dist/connection-3f117047.d.ts +0 -17
- package/dist/connection-f900e390.d.ts +0 -35
- package/dist/services-970f97bb.d.ts +0 -1372
- package/dist/transport/impls/uds/client.cjs +0 -1687
- package/dist/transport/impls/uds/client.cjs.map +0 -1
- package/dist/transport/impls/uds/client.d.cts +0 -17
- package/dist/transport/impls/uds/client.d.ts +0 -17
- package/dist/transport/impls/uds/client.js +0 -44
- package/dist/transport/impls/uds/client.js.map +0 -1
- package/dist/transport/impls/uds/server.cjs +0 -1522
- package/dist/transport/impls/uds/server.cjs.map +0 -1
- package/dist/transport/impls/uds/server.d.cts +0 -19
- package/dist/transport/impls/uds/server.d.ts +0 -19
- package/dist/transport/impls/uds/server.js +0 -33
- package/dist/transport/impls/uds/server.js.map +0 -1
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import { T as Transport, C as Connection, m as SessionOptions, n as ClientTransportOptions, e as SessionNoConnection, o as ServiceContext, S as Session } from '../context-9c907028.js';
|
|
1
2
|
import { Static } from '@sinclair/typebox';
|
|
2
|
-
import {
|
|
3
|
-
import { P as PartialTransportMessage, O as OpaqueTransportMessage } from '../index-10ebd26a.js';
|
|
3
|
+
import { P as PartialTransportMessage, b as OpaqueTransportMessage } from '../message-59fe53e1.js';
|
|
4
4
|
import NodeWs from 'ws';
|
|
5
5
|
import http from 'node:http';
|
|
6
|
-
import
|
|
6
|
+
import { B as BaseErrorSchemaType, R as Readable, a as ReadableIterator, b as ReadableResult, P as PayloadType, c as ProcedureErrorSchemaType, d as Procedure, e as Result, f as ReaderErrorSchema, W as Writable } from '../services-aa49a9fb.js';
|
|
7
7
|
import { W as WsLike } from '../wslike-e0b32dd5.js';
|
|
8
|
+
import '@sinclair/typebox/errors';
|
|
8
9
|
import '../types-3e5768ec.js';
|
|
9
10
|
import '@sinclair/typebox/value';
|
|
10
11
|
import '@opentelemetry/api';
|
|
12
|
+
import '../client-75090f07.js';
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* Creates a WebSocket client that connects to a local server at the specified port.
|
|
@@ -31,33 +33,26 @@ declare function createWebSocketServer(server: http.Server): NodeWs.Server<typeo
|
|
|
31
33
|
* @throws An error if a port cannot be allocated.
|
|
32
34
|
*/
|
|
33
35
|
declare function onWsServerReady(server: http.Server): Promise<number>;
|
|
34
|
-
declare function onUdsServeReady(server: net.Server, path: string): Promise<void>;
|
|
35
|
-
declare function getIteratorFromStream<T, E extends Static<BaseErrorSchemaType>>(readStream: ReadStream<T, E>): {
|
|
36
|
-
next(): Promise<{
|
|
37
|
-
done: true;
|
|
38
|
-
value: undefined;
|
|
39
|
-
} | {
|
|
40
|
-
done: false;
|
|
41
|
-
value: OkResult<T> | ErrResult<E | {
|
|
42
|
-
readonly code: "STREAM_DRAINED";
|
|
43
|
-
readonly message: "Stream was drained";
|
|
44
|
-
}>;
|
|
45
|
-
}>;
|
|
46
|
-
};
|
|
47
36
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
37
|
+
* A safe way to access {@link Readble}'s iterator multiple times in test helpers.
|
|
38
|
+
*
|
|
39
|
+
* If there are other iteration attempts outside of the test helpers
|
|
40
|
+
* (this function, {@link readNextResult}, and {@link isReadableDone})
|
|
41
|
+
* it will throw an error.
|
|
42
|
+
*/
|
|
43
|
+
declare function getReadableIterator<T, E extends Static<BaseErrorSchemaType>>(readable: Readable<T, E>): ReadableIterator<T, E>;
|
|
44
|
+
/**
|
|
45
|
+
* Retrieves the next value from {@link Readable}, or throws an error if the Readable is done.
|
|
46
|
+
*
|
|
47
|
+
* Calling semantics are similar to {@link getReadableIterator}
|
|
48
|
+
*/
|
|
49
|
+
declare function readNextResult<T, E extends Static<BaseErrorSchemaType>>(readable: Readable<T, E>): Promise<ReadableResult<T, E>>;
|
|
50
|
+
/**
|
|
51
|
+
* Checks if the readable is done iterating, it consumes an iteration in the process.
|
|
52
|
+
*
|
|
53
|
+
* Calling semantics are similar to {@link getReadableIterator}
|
|
51
54
|
*/
|
|
52
|
-
declare function
|
|
53
|
-
next(): Promise<{
|
|
54
|
-
done: false;
|
|
55
|
-
value: T;
|
|
56
|
-
} | {
|
|
57
|
-
done: true;
|
|
58
|
-
value: undefined;
|
|
59
|
-
}>;
|
|
60
|
-
}): Promise<T>;
|
|
55
|
+
declare function isReadableDone<T, E extends Static<BaseErrorSchemaType>>(readable: Readable<T, E>): Promise<boolean>;
|
|
61
56
|
declare function payloadToTransportMessage<Payload>(payload: Payload): PartialTransportMessage<Payload>;
|
|
62
57
|
declare function createDummyTransportMessage(): PartialTransportMessage<{
|
|
63
58
|
msg: string;
|
|
@@ -71,14 +66,22 @@ declare function createDummyTransportMessage(): PartialTransportMessage<{
|
|
|
71
66
|
*/
|
|
72
67
|
declare function waitForMessage(t: Transport<Connection>, filter?: (msg: OpaqueTransportMessage) => boolean, rejectMismatch?: boolean): Promise<unknown>;
|
|
73
68
|
declare const testingSessionOptions: SessionOptions;
|
|
74
|
-
declare
|
|
75
|
-
declare function
|
|
76
|
-
declare function
|
|
77
|
-
declare function
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
69
|
+
declare const testingClientSessionOptions: ClientTransportOptions;
|
|
70
|
+
declare function dummySession(): SessionNoConnection;
|
|
71
|
+
declare function asClientRpc<State extends object, Init extends PayloadType, Res extends PayloadType, Err extends ProcedureErrorSchemaType>(state: State, proc: Procedure<State, 'rpc', Init, null, Res, Err>, extendedContext?: Omit<ServiceContext, 'state'>, session?: Session<Connection>): (msg: Static<Init>) => Promise<Result<Static<Res>, Static<Err> | Static<typeof ReaderErrorSchema>>>;
|
|
72
|
+
declare function asClientStream<State extends object, Init extends PayloadType, Req extends PayloadType, Res extends PayloadType, Err extends ProcedureErrorSchemaType>(state: State, proc: Procedure<State, 'stream', Init, Req, Res, Err>, reqInit?: Static<Init>, extendedContext?: Omit<ServiceContext, 'state'>, session?: Session<Connection>): {
|
|
73
|
+
reqWritable: Writable<Static<Req>>;
|
|
74
|
+
resReadable: Readable<Static<Res>, Static<Err>>;
|
|
75
|
+
};
|
|
76
|
+
declare function asClientSubscription<State extends object, Init extends PayloadType, Res extends PayloadType, Err extends ProcedureErrorSchemaType>(state: State, proc: Procedure<State, 'subscription', Init, null, Res, Err>, extendedContext?: Omit<ServiceContext, 'state'>, session?: Session<Connection>): (msg: Static<Init>) => {
|
|
77
|
+
resReadable: Readable<Static<Res>, Static<Err>>;
|
|
78
|
+
};
|
|
79
|
+
declare function asClientUpload<State extends object, Init extends PayloadType, Req extends PayloadType, Res extends PayloadType, Err extends ProcedureErrorSchemaType>(state: State, proc: Procedure<State, 'upload', Init, Req, Res, Err>, reqInit?: Static<Init>, extendedContext?: Omit<ServiceContext, 'state'>, session?: Session<Connection>): {
|
|
80
|
+
reqWritable: Writable<Static<Req>>;
|
|
81
|
+
finalize: () => Promise<Result<Static<Res>, Static<Err>>>;
|
|
82
|
+
};
|
|
83
|
+
declare function getTransportConnections<ConnType extends Connection>(transport: Transport<ConnType>): Array<ConnType>;
|
|
84
|
+
declare function numberOfConnections<ConnType extends Connection>(transport: Transport<ConnType>): number;
|
|
85
|
+
declare function closeAllConnections<ConnType extends Connection>(transport: Transport<ConnType>): void;
|
|
83
86
|
|
|
84
|
-
export { asClientRpc, asClientStream, asClientSubscription, asClientUpload, createDummyTransportMessage, createLocalWebSocketClient, createWebSocketServer, dummySession,
|
|
87
|
+
export { asClientRpc, asClientStream, asClientSubscription, asClientUpload, closeAllConnections, createDummyTransportMessage, createLocalWebSocketClient, createWebSocketServer, dummySession, getReadableIterator, getTransportConnections, isReadableDone, numberOfConnections, onWsServerReady, payloadToTransportMessage, readNextResult, testingClientSessionOptions, testingSessionOptions, waitForMessage };
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import { T as Transport, C as Connection, m as SessionOptions, n as ClientTransportOptions, e as SessionNoConnection, o as ServiceContext, S as Session } from '../context-9c907028.js';
|
|
1
2
|
import { Static } from '@sinclair/typebox';
|
|
2
|
-
import {
|
|
3
|
-
import { P as PartialTransportMessage, O as OpaqueTransportMessage } from '../index-10ebd26a.js';
|
|
3
|
+
import { P as PartialTransportMessage, b as OpaqueTransportMessage } from '../message-59fe53e1.js';
|
|
4
4
|
import NodeWs from 'ws';
|
|
5
5
|
import http from 'node:http';
|
|
6
|
-
import
|
|
6
|
+
import { B as BaseErrorSchemaType, R as Readable, a as ReadableIterator, b as ReadableResult, P as PayloadType, c as ProcedureErrorSchemaType, d as Procedure, e as Result, f as ReaderErrorSchema, W as Writable } from '../services-aa49a9fb.js';
|
|
7
7
|
import { W as WsLike } from '../wslike-e0b32dd5.js';
|
|
8
|
+
import '@sinclair/typebox/errors';
|
|
8
9
|
import '../types-3e5768ec.js';
|
|
9
10
|
import '@sinclair/typebox/value';
|
|
10
11
|
import '@opentelemetry/api';
|
|
12
|
+
import '../client-75090f07.js';
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* Creates a WebSocket client that connects to a local server at the specified port.
|
|
@@ -31,33 +33,26 @@ declare function createWebSocketServer(server: http.Server): NodeWs.Server<typeo
|
|
|
31
33
|
* @throws An error if a port cannot be allocated.
|
|
32
34
|
*/
|
|
33
35
|
declare function onWsServerReady(server: http.Server): Promise<number>;
|
|
34
|
-
declare function onUdsServeReady(server: net.Server, path: string): Promise<void>;
|
|
35
|
-
declare function getIteratorFromStream<T, E extends Static<BaseErrorSchemaType>>(readStream: ReadStream<T, E>): {
|
|
36
|
-
next(): Promise<{
|
|
37
|
-
done: true;
|
|
38
|
-
value: undefined;
|
|
39
|
-
} | {
|
|
40
|
-
done: false;
|
|
41
|
-
value: OkResult<T> | ErrResult<E | {
|
|
42
|
-
readonly code: "STREAM_DRAINED";
|
|
43
|
-
readonly message: "Stream was drained";
|
|
44
|
-
}>;
|
|
45
|
-
}>;
|
|
46
|
-
};
|
|
47
36
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
37
|
+
* A safe way to access {@link Readble}'s iterator multiple times in test helpers.
|
|
38
|
+
*
|
|
39
|
+
* If there are other iteration attempts outside of the test helpers
|
|
40
|
+
* (this function, {@link readNextResult}, and {@link isReadableDone})
|
|
41
|
+
* it will throw an error.
|
|
42
|
+
*/
|
|
43
|
+
declare function getReadableIterator<T, E extends Static<BaseErrorSchemaType>>(readable: Readable<T, E>): ReadableIterator<T, E>;
|
|
44
|
+
/**
|
|
45
|
+
* Retrieves the next value from {@link Readable}, or throws an error if the Readable is done.
|
|
46
|
+
*
|
|
47
|
+
* Calling semantics are similar to {@link getReadableIterator}
|
|
48
|
+
*/
|
|
49
|
+
declare function readNextResult<T, E extends Static<BaseErrorSchemaType>>(readable: Readable<T, E>): Promise<ReadableResult<T, E>>;
|
|
50
|
+
/**
|
|
51
|
+
* Checks if the readable is done iterating, it consumes an iteration in the process.
|
|
52
|
+
*
|
|
53
|
+
* Calling semantics are similar to {@link getReadableIterator}
|
|
51
54
|
*/
|
|
52
|
-
declare function
|
|
53
|
-
next(): Promise<{
|
|
54
|
-
done: false;
|
|
55
|
-
value: T;
|
|
56
|
-
} | {
|
|
57
|
-
done: true;
|
|
58
|
-
value: undefined;
|
|
59
|
-
}>;
|
|
60
|
-
}): Promise<T>;
|
|
55
|
+
declare function isReadableDone<T, E extends Static<BaseErrorSchemaType>>(readable: Readable<T, E>): Promise<boolean>;
|
|
61
56
|
declare function payloadToTransportMessage<Payload>(payload: Payload): PartialTransportMessage<Payload>;
|
|
62
57
|
declare function createDummyTransportMessage(): PartialTransportMessage<{
|
|
63
58
|
msg: string;
|
|
@@ -71,14 +66,22 @@ declare function createDummyTransportMessage(): PartialTransportMessage<{
|
|
|
71
66
|
*/
|
|
72
67
|
declare function waitForMessage(t: Transport<Connection>, filter?: (msg: OpaqueTransportMessage) => boolean, rejectMismatch?: boolean): Promise<unknown>;
|
|
73
68
|
declare const testingSessionOptions: SessionOptions;
|
|
74
|
-
declare
|
|
75
|
-
declare function
|
|
76
|
-
declare function
|
|
77
|
-
declare function
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
69
|
+
declare const testingClientSessionOptions: ClientTransportOptions;
|
|
70
|
+
declare function dummySession(): SessionNoConnection;
|
|
71
|
+
declare function asClientRpc<State extends object, Init extends PayloadType, Res extends PayloadType, Err extends ProcedureErrorSchemaType>(state: State, proc: Procedure<State, 'rpc', Init, null, Res, Err>, extendedContext?: Omit<ServiceContext, 'state'>, session?: Session<Connection>): (msg: Static<Init>) => Promise<Result<Static<Res>, Static<Err> | Static<typeof ReaderErrorSchema>>>;
|
|
72
|
+
declare function asClientStream<State extends object, Init extends PayloadType, Req extends PayloadType, Res extends PayloadType, Err extends ProcedureErrorSchemaType>(state: State, proc: Procedure<State, 'stream', Init, Req, Res, Err>, reqInit?: Static<Init>, extendedContext?: Omit<ServiceContext, 'state'>, session?: Session<Connection>): {
|
|
73
|
+
reqWritable: Writable<Static<Req>>;
|
|
74
|
+
resReadable: Readable<Static<Res>, Static<Err>>;
|
|
75
|
+
};
|
|
76
|
+
declare function asClientSubscription<State extends object, Init extends PayloadType, Res extends PayloadType, Err extends ProcedureErrorSchemaType>(state: State, proc: Procedure<State, 'subscription', Init, null, Res, Err>, extendedContext?: Omit<ServiceContext, 'state'>, session?: Session<Connection>): (msg: Static<Init>) => {
|
|
77
|
+
resReadable: Readable<Static<Res>, Static<Err>>;
|
|
78
|
+
};
|
|
79
|
+
declare function asClientUpload<State extends object, Init extends PayloadType, Req extends PayloadType, Res extends PayloadType, Err extends ProcedureErrorSchemaType>(state: State, proc: Procedure<State, 'upload', Init, Req, Res, Err>, reqInit?: Static<Init>, extendedContext?: Omit<ServiceContext, 'state'>, session?: Session<Connection>): {
|
|
80
|
+
reqWritable: Writable<Static<Req>>;
|
|
81
|
+
finalize: () => Promise<Result<Static<Res>, Static<Err>>>;
|
|
82
|
+
};
|
|
83
|
+
declare function getTransportConnections<ConnType extends Connection>(transport: Transport<ConnType>): Array<ConnType>;
|
|
84
|
+
declare function numberOfConnections<ConnType extends Connection>(transport: Transport<ConnType>): number;
|
|
85
|
+
declare function closeAllConnections<ConnType extends Connection>(transport: Transport<ConnType>): void;
|
|
83
86
|
|
|
84
|
-
export { asClientRpc, asClientStream, asClientSubscription, asClientUpload, createDummyTransportMessage, createLocalWebSocketClient, createWebSocketServer, dummySession,
|
|
87
|
+
export { asClientRpc, asClientStream, asClientSubscription, asClientUpload, closeAllConnections, createDummyTransportMessage, createLocalWebSocketClient, createWebSocketServer, dummySession, getReadableIterator, getTransportConnections, isReadableDone, numberOfConnections, onWsServerReady, payloadToTransportMessage, readNextResult, testingClientSessionOptions, testingSessionOptions, waitForMessage };
|
package/dist/util/testHelpers.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Err,
|
|
3
3
|
Ok,
|
|
4
|
-
|
|
4
|
+
ReadableImpl,
|
|
5
5
|
UNCAUGHT_ERROR_CODE,
|
|
6
|
-
|
|
7
|
-
} from "../chunk-
|
|
6
|
+
WritableImpl
|
|
7
|
+
} from "../chunk-YBCQVIPR.js";
|
|
8
8
|
import {
|
|
9
|
-
|
|
9
|
+
SessionStateGraph,
|
|
10
|
+
defaultClientTransportOptions,
|
|
10
11
|
defaultTransportOptions
|
|
11
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-OLWVR5AB.js";
|
|
12
13
|
import {
|
|
13
|
-
coerceErrorString
|
|
14
|
-
|
|
14
|
+
coerceErrorString,
|
|
15
|
+
currentProtocolVersion
|
|
16
|
+
} from "../chunk-BYCR4VEM.js";
|
|
15
17
|
import "../chunk-4PVU7J25.js";
|
|
16
18
|
|
|
17
19
|
// util/testHelpers.ts
|
|
18
20
|
import NodeWs, { WebSocketServer } from "ws";
|
|
19
|
-
import { nanoid } from "nanoid";
|
|
20
21
|
function createLocalWebSocketClient(port) {
|
|
21
22
|
const sock = new NodeWs(`ws://localhost:${port}`);
|
|
22
23
|
sock.binaryType = "arraybuffer";
|
|
@@ -37,16 +38,25 @@ function onWsServerReady(server) {
|
|
|
37
38
|
});
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
41
|
+
var readableIterators = /* @__PURE__ */ new WeakMap();
|
|
42
|
+
function getReadableIterator(readable) {
|
|
43
|
+
let iter = readableIterators.get(readable);
|
|
44
|
+
if (!iter) {
|
|
45
|
+
iter = readable[Symbol.asyncIterator]();
|
|
46
|
+
readableIterators.set(readable, iter);
|
|
47
|
+
}
|
|
48
|
+
return iter;
|
|
49
|
+
}
|
|
50
|
+
async function readNextResult(readable) {
|
|
51
|
+
const res = await getReadableIterator(readable).next();
|
|
52
|
+
if (res.done) {
|
|
53
|
+
throw new Error("readNext from a done Readable");
|
|
54
|
+
}
|
|
55
|
+
return res.value;
|
|
56
|
+
}
|
|
57
|
+
async function isReadableDone(readable) {
|
|
58
|
+
const res = await getReadableIterator(readable).next();
|
|
59
|
+
return res.done;
|
|
50
60
|
}
|
|
51
61
|
function payloadToTransportMessage(payload) {
|
|
52
62
|
return {
|
|
@@ -83,113 +93,138 @@ function catchProcError(err) {
|
|
|
83
93
|
return Err({ code: UNCAUGHT_ERROR_CODE, message: errorMsg });
|
|
84
94
|
}
|
|
85
95
|
var testingSessionOptions = defaultTransportOptions;
|
|
96
|
+
var testingClientSessionOptions = defaultClientTransportOptions;
|
|
86
97
|
function dummySession() {
|
|
87
|
-
return
|
|
88
|
-
void 0,
|
|
98
|
+
return SessionStateGraph.entrypoints.NoConnection(
|
|
89
99
|
"client",
|
|
90
100
|
"server",
|
|
91
|
-
|
|
101
|
+
{
|
|
102
|
+
onSessionGracePeriodElapsed: () => {
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
testingSessionOptions,
|
|
106
|
+
currentProtocolVersion
|
|
92
107
|
);
|
|
93
108
|
}
|
|
94
109
|
function dummyCtx(state, session, extendedContext) {
|
|
95
110
|
return {
|
|
96
111
|
...extendedContext,
|
|
97
|
-
from: session.from,
|
|
98
112
|
state,
|
|
113
|
+
sessionId: session.id,
|
|
114
|
+
from: session.from,
|
|
99
115
|
metadata: {},
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
116
|
+
// TODO might wanna hook these up!
|
|
117
|
+
cancel: () => void 0,
|
|
118
|
+
signal: new AbortController().signal
|
|
103
119
|
};
|
|
104
120
|
}
|
|
105
121
|
function asClientRpc(state, proc, extendedContext, session = dummySession()) {
|
|
106
122
|
return async (msg) => {
|
|
107
|
-
return proc.handler(
|
|
123
|
+
return proc.handler({
|
|
124
|
+
ctx: dummyCtx(state, session, extendedContext),
|
|
125
|
+
reqInit: msg
|
|
126
|
+
}).catch(catchProcError);
|
|
108
127
|
};
|
|
109
128
|
}
|
|
110
|
-
function
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
writer.triggerCloseRequest();
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
const writer = new WriteStreamImpl(
|
|
129
|
+
function createResponsePipe() {
|
|
130
|
+
const readable = new ReadableImpl();
|
|
131
|
+
const writable = new WritableImpl(
|
|
117
132
|
(v) => {
|
|
118
|
-
|
|
133
|
+
readable._pushValue(v);
|
|
134
|
+
},
|
|
135
|
+
() => {
|
|
136
|
+
void Promise.resolve().then(() => {
|
|
137
|
+
readable._triggerClose();
|
|
138
|
+
});
|
|
119
139
|
}
|
|
120
140
|
);
|
|
121
|
-
|
|
122
|
-
void Promise.resolve().then(() => {
|
|
123
|
-
reader.triggerClose();
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
return { reader, writer };
|
|
141
|
+
return { readable, writable };
|
|
127
142
|
}
|
|
128
|
-
function
|
|
129
|
-
const
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
143
|
+
function createRequestPipe() {
|
|
144
|
+
const readable = new ReadableImpl();
|
|
145
|
+
const writable = new WritableImpl(
|
|
146
|
+
(v) => {
|
|
147
|
+
readable._pushValue(Ok(v));
|
|
148
|
+
},
|
|
149
|
+
() => {
|
|
150
|
+
void Promise.resolve().then(() => {
|
|
151
|
+
readable._triggerClose();
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
);
|
|
155
|
+
return { readable, writable };
|
|
156
|
+
}
|
|
157
|
+
function asClientStream(state, proc, reqInit, extendedContext, session = dummySession()) {
|
|
158
|
+
const requestPipe = createRequestPipe();
|
|
159
|
+
const responsePipe = createResponsePipe();
|
|
160
|
+
void proc.handler({
|
|
161
|
+
ctx: dummyCtx(state, session, extendedContext),
|
|
162
|
+
reqInit: reqInit ?? {},
|
|
163
|
+
reqReadable: requestPipe.readable,
|
|
164
|
+
resWritable: responsePipe.writable
|
|
165
|
+
}).catch((err) => responsePipe.writable.write(catchProcError(err)));
|
|
166
|
+
return {
|
|
167
|
+
reqWritable: requestPipe.writable,
|
|
168
|
+
resReadable: responsePipe.readable
|
|
169
|
+
};
|
|
154
170
|
}
|
|
155
171
|
function asClientSubscription(state, proc, extendedContext, session = dummySession()) {
|
|
156
|
-
const
|
|
172
|
+
const responsePipe = createResponsePipe();
|
|
157
173
|
return (msg) => {
|
|
158
|
-
void proc.handler(
|
|
159
|
-
dummyCtx(state, session, extendedContext),
|
|
160
|
-
msg,
|
|
161
|
-
|
|
162
|
-
).catch(
|
|
163
|
-
|
|
174
|
+
void proc.handler({
|
|
175
|
+
ctx: dummyCtx(state, session, extendedContext),
|
|
176
|
+
reqInit: msg,
|
|
177
|
+
resWritable: responsePipe.writable
|
|
178
|
+
}).catch(
|
|
179
|
+
(err) => responsePipe.writable.write(catchProcError(err))
|
|
180
|
+
);
|
|
181
|
+
return { resReadable: responsePipe.readable };
|
|
164
182
|
};
|
|
165
183
|
}
|
|
166
|
-
function asClientUpload(state, proc,
|
|
167
|
-
const
|
|
168
|
-
const result = proc.handler(
|
|
169
|
-
dummyCtx(state, session, extendedContext),
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
).catch(catchProcError);
|
|
173
|
-
return
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
184
|
+
function asClientUpload(state, proc, reqInit, extendedContext, session = dummySession()) {
|
|
185
|
+
const requestPipe = createRequestPipe();
|
|
186
|
+
const result = proc.handler({
|
|
187
|
+
ctx: dummyCtx(state, session, extendedContext),
|
|
188
|
+
reqInit: reqInit ?? {},
|
|
189
|
+
reqReadable: requestPipe.readable
|
|
190
|
+
}).catch(catchProcError);
|
|
191
|
+
return { reqWritable: requestPipe.writable, finalize: () => result };
|
|
192
|
+
}
|
|
193
|
+
function getTransportConnections(transport) {
|
|
194
|
+
const connections = [];
|
|
195
|
+
for (const session of transport.sessions.values()) {
|
|
196
|
+
if (session.state === "Connected" /* Connected */) {
|
|
197
|
+
connections.push(session.conn);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return connections;
|
|
201
|
+
}
|
|
202
|
+
function numberOfConnections(transport) {
|
|
203
|
+
return getTransportConnections(transport).length;
|
|
204
|
+
}
|
|
205
|
+
function closeAllConnections(transport) {
|
|
206
|
+
for (const conn of getTransportConnections(transport)) {
|
|
207
|
+
conn.close();
|
|
208
|
+
}
|
|
209
|
+
}
|
|
178
210
|
export {
|
|
179
211
|
asClientRpc,
|
|
180
212
|
asClientStream,
|
|
181
213
|
asClientSubscription,
|
|
182
214
|
asClientUpload,
|
|
215
|
+
closeAllConnections,
|
|
183
216
|
createDummyTransportMessage,
|
|
184
217
|
createLocalWebSocketClient,
|
|
185
218
|
createWebSocketServer,
|
|
186
219
|
dummySession,
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
220
|
+
getReadableIterator,
|
|
221
|
+
getTransportConnections,
|
|
222
|
+
isReadableDone,
|
|
223
|
+
numberOfConnections,
|
|
191
224
|
onWsServerReady,
|
|
192
225
|
payloadToTransportMessage,
|
|
226
|
+
readNextResult,
|
|
227
|
+
testingClientSessionOptions,
|
|
193
228
|
testingSessionOptions,
|
|
194
229
|
waitForMessage
|
|
195
230
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../util/testHelpers.ts"],"sourcesContent":["import NodeWs, { WebSocketServer } from 'ws';\nimport http from 'node:http';\nimport {\n Err,\n Ok,\n PayloadType,\n Procedure,\n Result,\n ProcedureErrorSchemaType,\n InputReaderErrorSchema,\n OutputReaderErrorSchema,\n ServiceContext,\n ProcedureHandlerContext,\n UNCAUGHT_ERROR_CODE,\n} from '../router';\nimport { Static } from '@sinclair/typebox';\nimport { nanoid } from 'nanoid';\nimport net from 'node:net';\nimport {\n OpaqueTransportMessage,\n PartialTransportMessage,\n} from '../transport/message';\nimport { coerceErrorString } from './stringify';\nimport { Connection, Session, SessionOptions } from '../transport/session';\nimport { Transport } from '../transport/transport';\nimport {\n ReadStream,\n ReadStreamImpl,\n WriteStream,\n WriteStreamImpl,\n} from '../router/streams';\nimport { WsLike } from '../transport/impls/ws/wslike';\nimport { defaultTransportOptions } from '../transport/options';\nimport { BaseErrorSchemaType } from '../router/result';\n\n/**\n * Creates a WebSocket client that connects to a local server at the specified port.\n * This should only be used for testing.\n * @param port - The port number to connect to.\n * @returns A Promise that resolves to a WebSocket instance.\n */\nexport function createLocalWebSocketClient(port: number): WsLike {\n const sock = new NodeWs(`ws://localhost:${port}`);\n sock.binaryType = 'arraybuffer';\n\n return sock;\n}\n\n/**\n * Creates a WebSocket server instance using the provided HTTP server.\n * Only used as helper for testing.\n * @param server - The HTTP server instance to use for the WebSocket server.\n * @returns A Promise that resolves to the created WebSocket server instance.\n */\nexport function createWebSocketServer(server: http.Server) {\n return new WebSocketServer({ server });\n}\n\n/**\n * Starts listening on the given server and returns the automatically allocated port number.\n * This should only be used for testing.\n * @param server - The http server to listen on.\n * @returns A promise that resolves with the allocated port number.\n * @throws An error if a port cannot be allocated.\n */\nexport function onWsServerReady(server: http.Server): Promise<number> {\n return new Promise((resolve, reject) => {\n server.listen(() => {\n const addr = server.address();\n if (typeof addr === 'object' && addr) {\n resolve(addr.port);\n } else {\n reject(new Error(\"couldn't find a port to allocate\"));\n }\n });\n });\n}\n\nexport function onUdsServeReady(\n server: net.Server,\n path: string,\n): Promise<void> {\n return new Promise<void>((resolve) => {\n server.listen(path, resolve);\n });\n}\n\nexport function getIteratorFromStream<T, E extends Static<BaseErrorSchemaType>>(\n readStream: ReadStream<T, E>,\n) {\n return readStream[Symbol.asyncIterator]();\n}\n\n/**\n * Retrieves the next value from an async iterable iterator.\n * @param iter The async iterable iterator.\n * @returns A promise that resolves to the next value from the iterator.\n */\nexport async function iterNext<T>(iter: {\n next(): Promise<\n | {\n done: false;\n value: T;\n }\n | {\n done: true;\n value: undefined;\n }\n >;\n}) {\n return await iter.next().then((res) => res.value as T);\n}\n\nexport function payloadToTransportMessage<Payload>(\n payload: Payload,\n): PartialTransportMessage<Payload> {\n return {\n streamId: 'stream',\n controlFlags: 0,\n payload,\n };\n}\n\nexport function createDummyTransportMessage() {\n return payloadToTransportMessage({\n msg: 'cool',\n test: Math.random(),\n });\n}\n\n/**\n * Waits for a message on the transport.\n * @param {Transport} t - The transport to listen to.\n * @param filter - An optional filter function to apply to the received messages.\n * @returns A promise that resolves with the payload of the first message that passes the filter.\n */\nexport async function waitForMessage(\n t: Transport<Connection>,\n filter?: (msg: OpaqueTransportMessage) => boolean,\n rejectMismatch?: boolean,\n) {\n return new Promise((resolve, reject) => {\n function cleanup() {\n t.removeEventListener('message', onMessage);\n }\n\n function onMessage(msg: OpaqueTransportMessage) {\n if (!filter || filter(msg)) {\n cleanup();\n resolve(msg.payload);\n } else if (rejectMismatch) {\n cleanup();\n reject(new Error('message didnt match the filter'));\n }\n }\n\n t.addEventListener('message', onMessage);\n });\n}\n\nfunction catchProcError(err: unknown) {\n const errorMsg = coerceErrorString(err);\n return Err({ code: UNCAUGHT_ERROR_CODE, message: errorMsg });\n}\n\nexport const testingSessionOptions: SessionOptions = defaultTransportOptions;\n\nexport function dummySession() {\n return new Session<Connection>(\n undefined,\n 'client',\n 'server',\n testingSessionOptions,\n );\n}\n\nfunction dummyCtx<State>(\n state: State,\n session: Session<Connection>,\n extendedContext?: Omit<ServiceContext, 'state'>,\n): ProcedureHandlerContext<State> {\n return {\n ...extendedContext,\n from: session.from,\n state,\n metadata: {},\n abortController: new AbortController(),\n clientAbortSignal: new AbortController().signal,\n onRequestFinished: () => undefined,\n };\n}\n\nexport function asClientRpc<\n State extends object,\n Init extends PayloadType,\n Output extends PayloadType,\n Err extends ProcedureErrorSchemaType,\n>(\n state: State,\n proc: Procedure<State, 'rpc', Init, null, Output, Err>,\n extendedContext?: Omit<ServiceContext, 'state'>,\n session: Session<Connection> = dummySession(),\n) {\n return async (\n msg: Static<Init>,\n ): Promise<\n Result<Static<Output>, Static<Err> | Static<typeof OutputReaderErrorSchema>>\n > => {\n return proc\n .handler(dummyCtx(state, session, extendedContext), msg)\n .catch(catchProcError);\n };\n}\n\nfunction createOutputPipe<\n Output extends PayloadType,\n Err extends ProcedureErrorSchemaType,\n>(): {\n reader: ReadStream<\n Static<Output>,\n Static<Err> | Static<typeof OutputReaderErrorSchema>\n >;\n writer: WriteStream<Result<Static<Output>, Static<Err>>>;\n} {\n const reader = new ReadStreamImpl<\n Static<Output>,\n Static<Err> | Static<typeof OutputReaderErrorSchema>\n >(() => {\n // Make it async to simulate request going over the wire\n // using promises so that we don't get affected by fake timers.\n void Promise.resolve().then(() => {\n writer.triggerCloseRequest();\n });\n });\n const writer = new WriteStreamImpl<Result<Static<Output>, Static<Err>>>(\n (v) => {\n reader.pushValue(v);\n },\n );\n writer.onClose(() => {\n // Make it async to simulate request going over the wire\n // using promises so that we don't get affected by fake timers.\n void Promise.resolve().then(() => {\n reader.triggerClose();\n });\n });\n\n return { reader, writer };\n}\n\nfunction createInputPipe<Input extends PayloadType>(): {\n reader: ReadStream<Static<Input>, Static<typeof InputReaderErrorSchema>>;\n writer: WriteStream<Static<Input>>;\n} {\n const reader = new ReadStreamImpl<\n Static<Input>,\n Static<typeof InputReaderErrorSchema>\n >(() => {\n // Make it async to simulate request going over the wire\n // using promises so that we don't get affected by fake timers.\n void Promise.resolve().then(() => {\n writer.triggerCloseRequest();\n });\n });\n const writer = new WriteStreamImpl<Static<Input>>((v) => {\n reader.pushValue(Ok(v));\n });\n writer.onClose(() => {\n // Make it async to simulate request going over the wire\n // using promises so that we don't get affected by fake timers.\n void Promise.resolve().then(() => {\n reader.triggerClose();\n });\n });\n\n return { reader, writer };\n}\n\nexport function asClientStream<\n State extends object,\n Init extends PayloadType,\n Input extends PayloadType,\n Output extends PayloadType,\n Err extends ProcedureErrorSchemaType,\n>(\n state: State,\n proc: Procedure<State, 'stream', Init, Input, Output, Err>,\n init?: Static<Init>,\n extendedContext?: Omit<ServiceContext, 'state'>,\n session: Session<Connection> = dummySession(),\n): [WriteStream<Static<Input>>, ReadStream<Static<Output>, Static<Err>>] {\n const inputPipe = createInputPipe<Input>();\n const outputPipe = createOutputPipe<Output, Err>();\n\n void proc\n .handler(\n dummyCtx(state, session, extendedContext),\n init ?? {},\n inputPipe.reader,\n outputPipe.writer,\n )\n .catch((err: unknown) => outputPipe.writer.write(catchProcError(err)));\n\n return [inputPipe.writer, outputPipe.reader];\n}\n\nexport function asClientSubscription<\n State extends object,\n Init extends PayloadType,\n Output extends PayloadType,\n Err extends ProcedureErrorSchemaType,\n>(\n state: State,\n proc: Procedure<State, 'subscription', Init, null, Output, Err>,\n extendedContext?: Omit<ServiceContext, 'state'>,\n session: Session<Connection> = dummySession(),\n): (msg: Static<Init>) => ReadStream<Static<Output>, Static<Err>> {\n const outputPipe = createOutputPipe<Output, Err>();\n\n return (msg: Static<Init>) => {\n void proc\n .handler(\n dummyCtx(state, session, extendedContext),\n msg,\n outputPipe.writer,\n )\n .catch((err: unknown) => outputPipe.writer.write(catchProcError(err)));\n\n return outputPipe.reader;\n };\n}\n\nexport function asClientUpload<\n State extends object,\n Init extends PayloadType,\n Input extends PayloadType,\n Output extends PayloadType,\n Err extends ProcedureErrorSchemaType,\n>(\n state: State,\n proc: Procedure<State, 'upload', Init, Input, Output, Err>,\n init?: Static<Init>,\n extendedContext?: Omit<ServiceContext, 'state'>,\n session: Session<Connection> = dummySession(),\n): [\n WriteStream<Static<Input>>,\n () => Promise<Result<Static<Output>, Static<Err>>>,\n] {\n const inputPipe = createInputPipe<Input>();\n const result = proc\n .handler(\n dummyCtx(state, session, extendedContext),\n init ?? {},\n inputPipe.reader,\n )\n .catch(catchProcError);\n\n return [inputPipe.writer, () => result];\n}\n\nexport const getUnixSocketPath = () => {\n // https://nodejs.org/api/net.html#identifying-paths-for-ipc-connections\n return process.platform === 'win32'\n ? `\\\\\\\\?\\\\pipe\\\\${nanoid()}`\n : `/tmp/${nanoid()}.sock`;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,OAAO,UAAU,uBAAuB;AAgBxC,SAAS,cAAc;AAyBhB,SAAS,2BAA2B,MAAsB;AAC/D,QAAM,OAAO,IAAI,OAAO,kBAAkB,IAAI,EAAE;AAChD,OAAK,aAAa;AAElB,SAAO;AACT;AAQO,SAAS,sBAAsB,QAAqB;AACzD,SAAO,IAAI,gBAAgB,EAAE,OAAO,CAAC;AACvC;AASO,SAAS,gBAAgB,QAAsC;AACpE,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,WAAO,OAAO,MAAM;AAClB,YAAM,OAAO,OAAO,QAAQ;AAC5B,UAAI,OAAO,SAAS,YAAY,MAAM;AACpC,gBAAQ,KAAK,IAAI;AAAA,MACnB,OAAO;AACL,eAAO,IAAI,MAAM,kCAAkC,CAAC;AAAA,MACtD;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;AAEO,SAAS,gBACd,QACA,MACe;AACf,SAAO,IAAI,QAAc,CAAC,YAAY;AACpC,WAAO,OAAO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QAAQ,CAAC;AAAA,IACT,UAAU;AAAA,IACV,WAAW;AAAA,EACb,EACC,MAAM,CAAC,QAAiB,WAAW,OAAO,MAAM,eAAe,GAAG,CAAC,CAAC;AAEvE,SAAO,CAAC,UAAU,QAAQ,WAAW,MAAM;AAC7C;AAEO,SAAS,qBAMd,OACA,MACA,iBACA,UAA+B,aAAa,GACoB;AAChE,QAAM,aAAa,iBAA8B;AAEjD,SAAO,CAAC,QAAsB;AAC5B,SAAK,KACF;AAAA,MACC,SAAS,OAAO,SAAS,eAAe;AAAA,MACxC;AAAA,MACA,WAAW;AAAA,IACb,EACC,MAAM,CAAC,QAAiB,WAAW,OAAO,MAAM,eAAe,GAAG,CAAC,CAAC;AAEvE,WAAO,WAAW;AAAA,EACpB;AACF;AAEO,SAAS,eAOd,OACA,MACA,MACA,iBACA,UAA+B,aAAa,GAI5C;AACA,QAAM,YAAY,gBAAuB;AACzC,QAAM,SAAS,KACZ;AAAA,IACC,SAAS,OAAO,SAAS,eAAe;AAAA,IACxC,QAAQ,CAAC;AAAA,IACT,UAAU;AAAA,EACZ,EACC,MAAM,cAAc;AAEvB,SAAO,CAAC,UAAU,QAAQ,MAAM,MAAM;AACxC;AAEO,IAAM,oBAAoB,MAAM;AAErC,SAAO,QAAQ,aAAa,UACxB,gBAAgB,OAAO,CAAC,KACxB,QAAQ,OAAO,CAAC;AACtB;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../util/testHelpers.ts"],"sourcesContent":["import NodeWs, { WebSocketServer } from 'ws';\nimport http from 'node:http';\nimport { Err, Ok, Result, BaseErrorSchemaType } from '../router/result';\nimport {\n ProcedureErrorSchemaType,\n ReaderErrorSchema,\n UNCAUGHT_ERROR_CODE,\n PayloadType,\n Procedure,\n} from '../router/procedures';\nimport { Static } from '@sinclair/typebox';\nimport {\n OpaqueTransportMessage,\n PartialTransportMessage,\n currentProtocolVersion,\n} from '../transport/message';\nimport { coerceErrorString } from './stringify';\nimport { Transport } from '../transport/transport';\nimport {\n Readable,\n ReadableImpl,\n ReadableResult,\n ReadableIterator,\n Writable,\n WritableImpl,\n} from '../router/streams';\nimport { ServiceContext, ProcedureHandlerContext } from '../router/context';\nimport { WsLike } from '../transport/impls/ws/wslike';\nimport {\n defaultClientTransportOptions,\n defaultTransportOptions,\n} from '../transport/options';\nimport { Connection } from '../transport/connection';\nimport { SessionState } from '../transport/sessionStateMachine/common';\nimport {\n Session,\n SessionStateGraph,\n} from '../transport/sessionStateMachine/transitions';\n\n/**\n * Creates a WebSocket client that connects to a local server at the specified port.\n * This should only be used for testing.\n * @param port - The port number to connect to.\n * @returns A Promise that resolves to a WebSocket instance.\n */\nexport function createLocalWebSocketClient(port: number): WsLike {\n const sock = new NodeWs(`ws://localhost:${port}`);\n sock.binaryType = 'arraybuffer';\n\n return sock;\n}\n\n/**\n * Creates a WebSocket server instance using the provided HTTP server.\n * Only used as helper for testing.\n * @param server - The HTTP server instance to use for the WebSocket server.\n * @returns A Promise that resolves to the created WebSocket server instance.\n */\nexport function createWebSocketServer(server: http.Server) {\n return new WebSocketServer({ server });\n}\n\n/**\n * Starts listening on the given server and returns the automatically allocated port number.\n * This should only be used for testing.\n * @param server - The http server to listen on.\n * @returns A promise that resolves with the allocated port number.\n * @throws An error if a port cannot be allocated.\n */\nexport function onWsServerReady(server: http.Server): Promise<number> {\n return new Promise((resolve, reject) => {\n server.listen(() => {\n const addr = server.address();\n if (typeof addr === 'object' && addr) {\n resolve(addr.port);\n } else {\n reject(new Error(\"couldn't find a port to allocate\"));\n }\n });\n });\n}\n\nconst readableIterators = new WeakMap<\n Readable<unknown, Static<BaseErrorSchemaType>>,\n ReadableIterator<unknown, Static<BaseErrorSchemaType>>\n>();\n\n/**\n * A safe way to access {@link Readble}'s iterator multiple times in test helpers.\n *\n * If there are other iteration attempts outside of the test helpers\n * (this function, {@link readNextResult}, and {@link isReadableDone})\n * it will throw an error.\n */\nexport function getReadableIterator<T, E extends Static<BaseErrorSchemaType>>(\n readable: Readable<T, E>,\n): ReadableIterator<T, E> {\n let iter = readableIterators.get(readable) as\n | ReadableIterator<T, E>\n | undefined;\n\n if (!iter) {\n iter = readable[Symbol.asyncIterator]();\n readableIterators.set(readable, iter);\n }\n\n return iter;\n}\n\n/**\n * Retrieves the next value from {@link Readable}, or throws an error if the Readable is done.\n *\n * Calling semantics are similar to {@link getReadableIterator}\n */\nexport async function readNextResult<T, E extends Static<BaseErrorSchemaType>>(\n readable: Readable<T, E>,\n): Promise<ReadableResult<T, E>> {\n const res = await getReadableIterator(readable).next();\n\n if (res.done) {\n throw new Error('readNext from a done Readable');\n }\n\n return res.value;\n}\n\n/**\n * Checks if the readable is done iterating, it consumes an iteration in the process.\n *\n * Calling semantics are similar to {@link getReadableIterator}\n */\nexport async function isReadableDone<T, E extends Static<BaseErrorSchemaType>>(\n readable: Readable<T, E>,\n) {\n const res = await getReadableIterator(readable).next();\n\n return res.done;\n}\n\nexport function payloadToTransportMessage<Payload>(\n payload: Payload,\n): PartialTransportMessage<Payload> {\n return {\n streamId: 'stream',\n controlFlags: 0,\n payload,\n };\n}\n\nexport function createDummyTransportMessage() {\n return payloadToTransportMessage({\n msg: 'cool',\n test: Math.random(),\n });\n}\n\n/**\n * Waits for a message on the transport.\n * @param {Transport} t - The transport to listen to.\n * @param filter - An optional filter function to apply to the received messages.\n * @returns A promise that resolves with the payload of the first message that passes the filter.\n */\nexport async function waitForMessage(\n t: Transport<Connection>,\n filter?: (msg: OpaqueTransportMessage) => boolean,\n rejectMismatch?: boolean,\n) {\n return new Promise((resolve, reject) => {\n function cleanup() {\n t.removeEventListener('message', onMessage);\n }\n\n function onMessage(msg: OpaqueTransportMessage) {\n if (!filter || filter(msg)) {\n cleanup();\n resolve(msg.payload);\n } else if (rejectMismatch) {\n cleanup();\n reject(new Error('message didnt match the filter'));\n }\n }\n\n t.addEventListener('message', onMessage);\n });\n}\n\nfunction catchProcError(err: unknown) {\n const errorMsg = coerceErrorString(err);\n return Err({ code: UNCAUGHT_ERROR_CODE, message: errorMsg });\n}\n\nexport const testingSessionOptions = defaultTransportOptions;\nexport const testingClientSessionOptions = defaultClientTransportOptions;\n\nexport function dummySession() {\n return SessionStateGraph.entrypoints.NoConnection(\n 'client',\n 'server',\n {\n onSessionGracePeriodElapsed: () => {\n /* noop */\n },\n },\n testingSessionOptions,\n currentProtocolVersion,\n );\n}\n\nfunction dummyCtx<State>(\n state: State,\n session: Session<Connection>,\n extendedContext?: Omit<ServiceContext, 'state'>,\n): ProcedureHandlerContext<State> {\n return {\n ...extendedContext,\n state,\n sessionId: session.id,\n from: session.from,\n metadata: {},\n // TODO might wanna hook these up!\n cancel: () => undefined,\n signal: new AbortController().signal,\n };\n}\n\nexport function asClientRpc<\n State extends object,\n Init extends PayloadType,\n Res extends PayloadType,\n Err extends ProcedureErrorSchemaType,\n>(\n state: State,\n proc: Procedure<State, 'rpc', Init, null, Res, Err>,\n extendedContext?: Omit<ServiceContext, 'state'>,\n session: Session<Connection> = dummySession(),\n) {\n return async (\n msg: Static<Init>,\n ): Promise<\n Result<Static<Res>, Static<Err> | Static<typeof ReaderErrorSchema>>\n > => {\n return proc\n .handler({\n ctx: dummyCtx(state, session, extendedContext),\n reqInit: msg,\n })\n .catch(catchProcError);\n };\n}\n\nfunction createResponsePipe<\n Res extends PayloadType,\n Err extends ProcedureErrorSchemaType,\n>(): {\n readable: Readable<\n Static<Res>,\n Static<Err> | Static<typeof ReaderErrorSchema>\n >;\n writable: Writable<Result<Static<Res>, Static<Err>>>;\n} {\n const readable = new ReadableImpl<\n Static<Res>,\n Static<Err> | Static<typeof ReaderErrorSchema>\n >();\n const writable = new WritableImpl<Result<Static<Res>, Static<Err>>>(\n (v) => {\n readable._pushValue(v);\n },\n () => {\n // Make it async to simulate request going over the wire\n // using promises so that we don't get affected by fake timers.\n void Promise.resolve().then(() => {\n readable._triggerClose();\n });\n },\n );\n\n return { readable, writable };\n}\n\nfunction createRequestPipe<Req extends PayloadType>(): {\n readable: Readable<Static<Req>, Static<typeof ReaderErrorSchema>>;\n writable: Writable<Static<Req>>;\n} {\n const readable = new ReadableImpl<\n Static<Req>,\n Static<typeof ReaderErrorSchema>\n >();\n const writable = new WritableImpl<Static<Req>>(\n (v) => {\n readable._pushValue(Ok(v));\n },\n () => {\n // Make it async to simulate request going over the wire\n // using promises so that we don't get affected by fake timers.\n void Promise.resolve().then(() => {\n readable._triggerClose();\n });\n },\n );\n\n return { readable, writable };\n}\n\nexport function asClientStream<\n State extends object,\n Init extends PayloadType,\n Req extends PayloadType,\n Res extends PayloadType,\n Err extends ProcedureErrorSchemaType,\n>(\n state: State,\n proc: Procedure<State, 'stream', Init, Req, Res, Err>,\n reqInit?: Static<Init>,\n extendedContext?: Omit<ServiceContext, 'state'>,\n session: Session<Connection> = dummySession(),\n): {\n reqWritable: Writable<Static<Req>>;\n resReadable: Readable<Static<Res>, Static<Err>>;\n} {\n const requestPipe = createRequestPipe<Req>();\n const responsePipe = createResponsePipe<Res, Err>();\n\n void proc\n .handler({\n ctx: dummyCtx(state, session, extendedContext),\n reqInit: reqInit ?? {},\n reqReadable: requestPipe.readable,\n resWritable: responsePipe.writable,\n })\n .catch((err: unknown) => responsePipe.writable.write(catchProcError(err)));\n\n return {\n reqWritable: requestPipe.writable,\n resReadable: responsePipe.readable,\n };\n}\n\nexport function asClientSubscription<\n State extends object,\n Init extends PayloadType,\n Res extends PayloadType,\n Err extends ProcedureErrorSchemaType,\n>(\n state: State,\n proc: Procedure<State, 'subscription', Init, null, Res, Err>,\n extendedContext?: Omit<ServiceContext, 'state'>,\n session: Session<Connection> = dummySession(),\n): (msg: Static<Init>) => {\n resReadable: Readable<Static<Res>, Static<Err>>;\n} {\n const responsePipe = createResponsePipe<Res, Err>();\n\n return (msg: Static<Init>) => {\n void proc\n .handler({\n ctx: dummyCtx(state, session, extendedContext),\n reqInit: msg,\n resWritable: responsePipe.writable,\n })\n .catch((err: unknown) =>\n responsePipe.writable.write(catchProcError(err)),\n );\n\n return { resReadable: responsePipe.readable };\n };\n}\n\nexport function asClientUpload<\n State extends object,\n Init extends PayloadType,\n Req extends PayloadType,\n Res extends PayloadType,\n Err extends ProcedureErrorSchemaType,\n>(\n state: State,\n proc: Procedure<State, 'upload', Init, Req, Res, Err>,\n reqInit?: Static<Init>,\n extendedContext?: Omit<ServiceContext, 'state'>,\n session: Session<Connection> = dummySession(),\n): {\n reqWritable: Writable<Static<Req>>;\n finalize: () => Promise<Result<Static<Res>, Static<Err>>>;\n} {\n const requestPipe = createRequestPipe<Req>();\n const result = proc\n .handler({\n ctx: dummyCtx(state, session, extendedContext),\n reqInit: reqInit ?? {},\n reqReadable: requestPipe.readable,\n })\n .catch(catchProcError);\n\n return { reqWritable: requestPipe.writable, finalize: () => result };\n}\n\nexport function getTransportConnections<ConnType extends Connection>(\n transport: Transport<ConnType>,\n): Array<ConnType> {\n const connections = [];\n for (const session of transport.sessions.values()) {\n if (session.state === SessionState.Connected) {\n connections.push(session.conn);\n }\n }\n\n return connections;\n}\n\nexport function numberOfConnections<ConnType extends Connection>(\n transport: Transport<ConnType>,\n): number {\n return getTransportConnections(transport).length;\n}\n\nexport function closeAllConnections<ConnType extends Connection>(\n transport: Transport<ConnType>,\n) {\n for (const conn of getTransportConnections(transport)) {\n conn.close();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,OAAO,UAAU,uBAAuB;AA6CjC,SAAS,2BAA2B,MAAsB;AAC/D,QAAM,OAAO,IAAI,OAAO,kBAAkB,IAAI,EAAE;AAChD,OAAK,aAAa;AAElB,SAAO;AACT;AAQO,SAAS,sBAAsB,QAAqB;AACzD,SAAO,IAAI,gBAAgB,EAAE,OAAO,CAAC;AACvC;AASO,SAAS,gBAAgB,QAAsC;AACpE,SAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;AACtC,WAAO,OAAO,MAAM;AAClB,YAAM,OAAO,OAAO,QAAQ;AAC5B,UAAI,OAAO,SAAS,YAAY,MAAM;AACpC,gBAAQ,KAAK,IAAI;AAAA,MACnB,OAAO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C;AACrB,aAAW,WAAW,UAAU,SAAS,OAAO,GAAG;AACjD,QAAI,QAAQ,uCAAkC;AAC5C,kBAAY,KAAK,QAAQ,IAAI;AAAA,IAC/B;AAAA,EACF;AAEA,SAAO;AACT;AAEO,SAAS,oBACd,WACQ;AACR,SAAO,wBAAwB,SAAS,EAAE;AAC5C;AAEO,SAAS,oBACd,WACA;AACA,aAAW,QAAQ,wBAAwB,SAAS,GAAG;AACrD,SAAK,MAAM;AAAA,EACb;AACF;","names":[]}
|
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.200.0-rc.
|
|
4
|
+
"version": "0.200.0-rc.20",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
@@ -63,14 +63,14 @@
|
|
|
63
63
|
"@types/ws": "^8.5.5",
|
|
64
64
|
"@typescript-eslint/eslint-plugin": "^7.8.0",
|
|
65
65
|
"@typescript-eslint/parser": "^7.8.0",
|
|
66
|
-
"@vitest/ui": "^
|
|
66
|
+
"@vitest/ui": "^2.0.5",
|
|
67
67
|
"eslint": "^8.57.0",
|
|
68
68
|
"eslint-config-prettier": "^9.1.0",
|
|
69
69
|
"eslint-plugin-prettier": "^5.1.3",
|
|
70
70
|
"prettier": "^3.0.0",
|
|
71
71
|
"tsup": "^7.2.0",
|
|
72
72
|
"typescript": "^5.4.5",
|
|
73
|
-
"vitest": "^
|
|
73
|
+
"vitest": "^2.0.5"
|
|
74
74
|
},
|
|
75
75
|
"scripts": {
|
|
76
76
|
"check": "tsc --noEmit && npm run format && npm run lint",
|