@replit/river 0.216.1 → 0.217.2
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 +2 -2
- package/dist/{adapter-BXCk-dmy.d.ts → adapter-Dl5Mewp3.d.ts} +1 -1
- package/dist/{chunk-C4EPHIKQ.js → chunk-FWVKRK36.js} +48 -26
- package/dist/chunk-FWVKRK36.js.map +1 -0
- package/dist/chunk-WMPWPIA4.js +72 -0
- package/dist/chunk-WMPWPIA4.js.map +1 -0
- package/dist/{chunk-62BM2WOT.js → chunk-YTV5S3DJ.js} +27 -19
- package/dist/chunk-YTV5S3DJ.js.map +1 -0
- package/dist/{client-BNc5Pj_4.d.ts → client-Tf2PXWoq.d.ts} +2 -2
- package/dist/codec/index.d.ts +3 -3
- package/dist/codec/index.js +2 -2
- package/dist/{connection-ou9w2dSY.d.ts → connection-D9yKScvK.d.ts} +3 -3
- package/dist/customSchemas/index.d.ts +34 -0
- package/dist/customSchemas/index.js +9 -0
- package/dist/customSchemas/index.js.map +1 -0
- package/dist/{index-ZWkoesQD.d.ts → index-DgUMnNOi.d.ts} +1 -1
- package/dist/logging/index.d.ts +3 -3
- package/dist/{message-CpXWqmJw.d.ts → message-DxS8db8A.d.ts} +30 -31
- package/dist/protobuf/index.d.ts +12 -16
- package/dist/protobuf/index.js +9 -7
- package/dist/protobuf/index.js.map +1 -1
- package/dist/router/index.d.ts +11 -11
- package/dist/router/index.js +1 -1
- package/dist/{server-BPu7Td80.d.ts → server-DhHG-q75.d.ts} +5 -5
- package/dist/{services-DpT2yNtt.d.ts → services-BT8Bq8Rs.d.ts} +8 -9
- package/dist/testUtil/index.d.ts +8 -8
- package/dist/testUtil/index.js +2 -2
- package/dist/testUtil/index.js.map +1 -1
- package/dist/transport/impls/ws/client.d.ts +7 -7
- package/dist/transport/impls/ws/client.js +2 -2
- package/dist/transport/impls/ws/server.d.ts +7 -7
- package/dist/transport/impls/ws/server.js +2 -2
- package/dist/transport/impls/ws/server.js.map +1 -1
- package/dist/transport/index.d.ts +8 -8
- package/dist/transport/index.js +2 -2
- package/dist/{transport-B1MUtXL7.d.ts → transport-D6czLXyc.d.ts} +13 -12
- package/package.json +14 -39
- package/dist/adapter-D5X11kmP.d.cts +0 -29
- package/dist/chunk-62BM2WOT.js.map +0 -1
- package/dist/chunk-C4EPHIKQ.js.map +0 -1
- package/dist/client-BZUvFL6B.d.cts +0 -54
- package/dist/codec/index.cjs +0 -268
- package/dist/codec/index.cjs.map +0 -1
- package/dist/codec/index.d.cts +0 -19
- package/dist/connection-xxgJHs2o.d.cts +0 -40
- package/dist/index-BAGGleT3.d.cts +0 -37
- package/dist/logging/index.cjs +0 -55
- package/dist/logging/index.cjs.map +0 -1
- package/dist/logging/index.d.cts +0 -4
- package/dist/message-CpXWqmJw.d.cts +0 -119
- package/dist/protobuf/codec.cjs +0 -107
- package/dist/protobuf/codec.cjs.map +0 -1
- package/dist/protobuf/codec.d.cts +0 -13
- package/dist/protobuf/index.cjs +0 -1877
- package/dist/protobuf/index.cjs.map +0 -1
- package/dist/protobuf/index.d.cts +0 -488
- package/dist/router/index.cjs +0 -2043
- package/dist/router/index.cjs.map +0 -1
- package/dist/router/index.d.cts +0 -80
- package/dist/server-JdnoVO11.d.cts +0 -72
- package/dist/services-CjigASqe.d.cts +0 -1135
- package/dist/testUtil/index.cjs +0 -3051
- package/dist/testUtil/index.cjs.map +0 -1
- package/dist/testUtil/index.d.cts +0 -122
- package/dist/transport/impls/ws/client.cjs +0 -2308
- package/dist/transport/impls/ws/client.cjs.map +0 -1
- package/dist/transport/impls/ws/client.d.cts +0 -33
- package/dist/transport/impls/ws/server.cjs +0 -2179
- package/dist/transport/impls/ws/server.cjs.map +0 -1
- package/dist/transport/impls/ws/server.d.cts +0 -21
- package/dist/transport/index.cjs +0 -2727
- package/dist/transport/index.cjs.map +0 -1
- package/dist/transport/index.d.cts +0 -11
- package/dist/transport-BnU3Zb0Q.d.cts +0 -590
- package/dist/types-BGGvYIJM.d.cts +0 -20
- package/dist/wslike-Dng9H1C7.d.cts +0 -40
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { P as ProvidedClientTransportOptions, e as ProvidedServerTransportOptions, n as ClientHandshakeOptions, C as Connection, q as ServerHandshakeOptions, T as Transport, i as SessionNoConnection, x as SessionBoundSendFn, m as ClientTransportOptions, y as SessionOptions } from '../transport-BnU3Zb0Q.cjs';
|
|
2
|
-
import { C as ClientTransport } from '../client-BZUvFL6B.cjs';
|
|
3
|
-
import { S as ServerTransport } from '../server-JdnoVO11.cjs';
|
|
4
|
-
import { T as TransportClientId, e as PartialTransportMessage, O as OpaqueTransportMessage } from '../message-CpXWqmJw.cjs';
|
|
5
|
-
import { TSchema, Static } from '@sinclair/typebox';
|
|
6
|
-
import { B as BaseErrorSchemaType, s as Readable, a1 as ReadableIterator, u as ReadableResult } from '../services-CjigASqe.cjs';
|
|
7
|
-
import { W as WsLike } from '../wslike-Dng9H1C7.cjs';
|
|
8
|
-
import NodeWs from 'ws';
|
|
9
|
-
import http from 'node:http';
|
|
10
|
-
import { Duplex } from 'node:stream';
|
|
11
|
-
import '../index-BAGGleT3.cjs';
|
|
12
|
-
import '../types-BGGvYIJM.cjs';
|
|
13
|
-
import '../adapter-D5X11kmP.cjs';
|
|
14
|
-
import '@opentelemetry/api';
|
|
15
|
-
|
|
16
|
-
interface TestTransportOptions {
|
|
17
|
-
client?: ProvidedClientTransportOptions;
|
|
18
|
-
server?: ProvidedServerTransportOptions;
|
|
19
|
-
}
|
|
20
|
-
interface TestSetupHelpers {
|
|
21
|
-
getClientTransport: (id: TransportClientId, handshakeOptions?: ClientHandshakeOptions) => ClientTransport<Connection>;
|
|
22
|
-
getServerTransport: <MetadataSchema extends TSchema = TSchema, ParsedMetadata extends object = object>(id?: TransportClientId, handshakeOptions?: ServerHandshakeOptions<MetadataSchema, ParsedMetadata>) => ServerTransport<Connection, MetadataSchema, ParsedMetadata>;
|
|
23
|
-
simulatePhantomDisconnect: () => void;
|
|
24
|
-
restartServer: () => Promise<void>;
|
|
25
|
-
cleanup: () => Promise<void> | void;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
declare class InMemoryConnection extends Connection {
|
|
29
|
-
conn: Duplex;
|
|
30
|
-
constructor(pipe: Duplex);
|
|
31
|
-
send(payload: Uint8Array): boolean;
|
|
32
|
-
close(): void;
|
|
33
|
-
}
|
|
34
|
-
declare function createMockTransportNetwork(opts?: TestTransportOptions): TestSetupHelpers;
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Creates a WebSocket client that connects to a local server at the specified port.
|
|
38
|
-
* This should only be used for testing.
|
|
39
|
-
* @param port - The port number to connect to.
|
|
40
|
-
* @returns A Promise that resolves to a WebSocket instance.
|
|
41
|
-
*/
|
|
42
|
-
declare function createLocalWebSocketClient(port: number): WsLike;
|
|
43
|
-
/**
|
|
44
|
-
* Creates a WebSocket server instance using the provided HTTP server.
|
|
45
|
-
* Only used as helper for testing.
|
|
46
|
-
* @param server - The HTTP server instance to use for the WebSocket server.
|
|
47
|
-
* @returns A Promise that resolves to the created WebSocket server instance.
|
|
48
|
-
*/
|
|
49
|
-
declare function createWebSocketServer(server: http.Server): NodeWs.Server<typeof NodeWs, typeof http.IncomingMessage>;
|
|
50
|
-
/**
|
|
51
|
-
* Starts listening on the given server and returns the automatically allocated port number.
|
|
52
|
-
* This should only be used for testing.
|
|
53
|
-
* @param server - The http server to listen on.
|
|
54
|
-
* @returns A promise that resolves with the allocated port number.
|
|
55
|
-
* @throws An error if a port cannot be allocated.
|
|
56
|
-
*/
|
|
57
|
-
declare function onWsServerReady(server: http.Server): Promise<number>;
|
|
58
|
-
/**
|
|
59
|
-
* A safe way to access {@link Readble}'s iterator multiple times in test helpers.
|
|
60
|
-
*
|
|
61
|
-
* If there are other iteration attempts outside of the test helpers
|
|
62
|
-
* (this function, {@link readNextResult}, and {@link isReadableDone})
|
|
63
|
-
* it will throw an error.
|
|
64
|
-
*/
|
|
65
|
-
declare function getReadableIterator<T, E extends Static<BaseErrorSchemaType>>(readable: Readable<T, E>): ReadableIterator<T, E>;
|
|
66
|
-
/**
|
|
67
|
-
* Retrieves the next value from {@link Readable}, or throws an error if the Readable is done.
|
|
68
|
-
*
|
|
69
|
-
* Calling semantics are similar to {@link getReadableIterator}
|
|
70
|
-
*/
|
|
71
|
-
declare function readNextResult<T, E extends Static<BaseErrorSchemaType>>(readable: Readable<T, E>): Promise<ReadableResult<T, E>>;
|
|
72
|
-
/**
|
|
73
|
-
* Checks if the readable is done iterating, it consumes an iteration in the process.
|
|
74
|
-
*
|
|
75
|
-
* Calling semantics are similar to {@link getReadableIterator}
|
|
76
|
-
*/
|
|
77
|
-
declare function isReadableDone<T, E extends Static<BaseErrorSchemaType>>(readable: Readable<T, E>): Promise<boolean>;
|
|
78
|
-
declare function payloadToTransportMessage<Payload>(payload: Payload): PartialTransportMessage<Payload>;
|
|
79
|
-
declare function createDummyTransportMessage(): PartialTransportMessage<{
|
|
80
|
-
msg: string;
|
|
81
|
-
test: number;
|
|
82
|
-
}>;
|
|
83
|
-
/**
|
|
84
|
-
* Waits for a message on the transport.
|
|
85
|
-
* @param {Transport} t - The transport to listen to.
|
|
86
|
-
* @param filter - An optional filter function to apply to the received messages.
|
|
87
|
-
* @returns A promise that resolves with the payload of the first message that passes the filter.
|
|
88
|
-
*/
|
|
89
|
-
declare function waitForMessage(t: Transport<Connection>, filter?: (msg: OpaqueTransportMessage) => boolean, rejectMismatch?: boolean): Promise<unknown>;
|
|
90
|
-
declare const testingSessionOptions: SessionOptions;
|
|
91
|
-
declare const testingClientSessionOptions: ClientTransportOptions;
|
|
92
|
-
declare function dummySession(): SessionNoConnection;
|
|
93
|
-
declare function getClientSendFn(clientTransport: ClientTransport<Connection>, serverTransport: ServerTransport<Connection>): SessionBoundSendFn;
|
|
94
|
-
declare function getServerSendFn(serverTransport: ServerTransport<Connection>, clientTransport: ClientTransport<Connection>): SessionBoundSendFn;
|
|
95
|
-
declare function getTransportConnections<ConnType extends Connection>(transport: Transport<ConnType>): Array<ConnType>;
|
|
96
|
-
declare function numberOfConnections<ConnType extends Connection>(transport: Transport<ConnType>): number;
|
|
97
|
-
declare function closeAllConnections<ConnType extends Connection>(transport: Transport<ConnType>): void;
|
|
98
|
-
/**
|
|
99
|
-
* Wraps a partial context object in a proxy that throws when accessing
|
|
100
|
-
* properties that weren't provided. This is useful for test contexts where
|
|
101
|
-
* you only want to mock the dependencies a test actually uses.
|
|
102
|
-
*
|
|
103
|
-
* Symbols and `then` are allowed through without throwing — river checks
|
|
104
|
-
* for `Symbol.asyncDispose` / `Symbol.dispose` on context values during
|
|
105
|
-
* `server.close()`, and `then` is checked by the JS runtime when the
|
|
106
|
-
* proxy is returned from an async function.
|
|
107
|
-
*
|
|
108
|
-
* @example
|
|
109
|
-
* ```ts
|
|
110
|
-
* const ctx = createPartialContext<MyContext>({
|
|
111
|
-
* database: mockDb,
|
|
112
|
-
* // accessing ctx.redis will throw
|
|
113
|
-
* });
|
|
114
|
-
*
|
|
115
|
-
* const server = createServer(transport, services, {
|
|
116
|
-
* extendedContext: ctx,
|
|
117
|
-
* });
|
|
118
|
-
* ```
|
|
119
|
-
*/
|
|
120
|
-
declare function createPartialContext<T extends Record<string, unknown>>(partial: Partial<T>): T;
|
|
121
|
-
|
|
122
|
-
export { InMemoryConnection, closeAllConnections, createDummyTransportMessage, createLocalWebSocketClient, createMockTransportNetwork, createPartialContext, createWebSocketServer, dummySession, getClientSendFn, getReadableIterator, getServerSendFn, getTransportConnections, isReadableDone, numberOfConnections, onWsServerReady, payloadToTransportMessage, readNextResult, testingClientSessionOptions, testingSessionOptions, waitForMessage };
|