@replit/river 0.10.11 → 0.10.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-KW5VFJRN.js → chunk-5IC5XMWK.js} +7 -0
- package/dist/transport/impls/ws/client.cjs +7 -0
- package/dist/transport/impls/ws/client.d.cts +1 -0
- package/dist/transport/impls/ws/client.d.ts +1 -0
- package/dist/transport/impls/ws/client.js +1 -1
- package/dist/transport/index.d.cts +4 -0
- package/dist/transport/index.d.ts +4 -0
- package/dist/util/testHelpers.cjs +7 -0
- package/dist/util/testHelpers.js +1 -1
- package/package.json +3 -3
|
@@ -42,6 +42,13 @@ var WebSocketClientTransport = class extends Transport {
|
|
|
42
42
|
this.reconnectPromises = /* @__PURE__ */ new Map();
|
|
43
43
|
this.createNewConnection(this.serverId);
|
|
44
44
|
}
|
|
45
|
+
reopen() {
|
|
46
|
+
if (this.state === "destroyed") {
|
|
47
|
+
throw new Error("cant reopen a destroyed connection");
|
|
48
|
+
}
|
|
49
|
+
this.state = "open";
|
|
50
|
+
this.createNewConnection(this.serverId);
|
|
51
|
+
}
|
|
45
52
|
async createNewConnection(to, attempt = 0) {
|
|
46
53
|
if (this.state === "destroyed") {
|
|
47
54
|
throw new Error("cant reopen a destroyed connection");
|
|
@@ -432,6 +432,13 @@ var WebSocketClientTransport = class extends Transport {
|
|
|
432
432
|
this.reconnectPromises = /* @__PURE__ */ new Map();
|
|
433
433
|
this.createNewConnection(this.serverId);
|
|
434
434
|
}
|
|
435
|
+
reopen() {
|
|
436
|
+
if (this.state === "destroyed") {
|
|
437
|
+
throw new Error("cant reopen a destroyed connection");
|
|
438
|
+
}
|
|
439
|
+
this.state = "open";
|
|
440
|
+
this.createNewConnection(this.serverId);
|
|
441
|
+
}
|
|
435
442
|
async createNewConnection(to, attempt = 0) {
|
|
436
443
|
if (this.state === "destroyed") {
|
|
437
444
|
throw new Error("cant reopen a destroyed connection");
|
|
@@ -36,6 +36,7 @@ declare class WebSocketClientTransport extends Transport<WebSocketConnection> {
|
|
|
36
36
|
* @param providedOptions An optional object containing configuration options for the transport.
|
|
37
37
|
*/
|
|
38
38
|
constructor(wsGetter: () => Promise<WebSocket>, sessionId: TransportClientId, serverId: TransportClientId, providedOptions?: Partial<Options>);
|
|
39
|
+
reopen(): void;
|
|
39
40
|
createNewConnection(to: string, attempt?: number): Promise<void>;
|
|
40
41
|
close(): Promise<void>;
|
|
41
42
|
destroy(): Promise<void>;
|
|
@@ -36,6 +36,7 @@ declare class WebSocketClientTransport extends Transport<WebSocketConnection> {
|
|
|
36
36
|
* @param providedOptions An optional object containing configuration options for the transport.
|
|
37
37
|
*/
|
|
38
38
|
constructor(wsGetter: () => Promise<WebSocket>, sessionId: TransportClientId, serverId: TransportClientId, providedOptions?: Partial<Options>);
|
|
39
|
+
reopen(): void;
|
|
39
40
|
createNewConnection(to: string, attempt?: number): Promise<void>;
|
|
40
41
|
close(): Promise<void>;
|
|
41
42
|
destroy(): Promise<void>;
|
|
@@ -205,6 +205,10 @@ declare abstract class Transport<ConnType extends Connection> {
|
|
|
205
205
|
* The downstream implementation needs to implement this. If the downstream
|
|
206
206
|
* transport cannot make new outgoing connections (e.g. a server transport),
|
|
207
207
|
* it is ok to log an error and return.
|
|
208
|
+
*
|
|
209
|
+
* Consumers of river should never need to call this directly.
|
|
210
|
+
* Instead, look for a `reopen` method on the transport.
|
|
211
|
+
*
|
|
208
212
|
* @param to The client ID of the node to connect to.
|
|
209
213
|
* @returns The new connection object.
|
|
210
214
|
*/
|
|
@@ -205,6 +205,10 @@ declare abstract class Transport<ConnType extends Connection> {
|
|
|
205
205
|
* The downstream implementation needs to implement this. If the downstream
|
|
206
206
|
* transport cannot make new outgoing connections (e.g. a server transport),
|
|
207
207
|
* it is ok to log an error and return.
|
|
208
|
+
*
|
|
209
|
+
* Consumers of river should never need to call this directly.
|
|
210
|
+
* Instead, look for a `reopen` method on the transport.
|
|
211
|
+
*
|
|
208
212
|
* @param to The client ID of the node to connect to.
|
|
209
213
|
* @returns The new connection object.
|
|
210
214
|
*/
|
|
@@ -469,6 +469,13 @@ var WebSocketClientTransport = class extends Transport {
|
|
|
469
469
|
this.reconnectPromises = /* @__PURE__ */ new Map();
|
|
470
470
|
this.createNewConnection(this.serverId);
|
|
471
471
|
}
|
|
472
|
+
reopen() {
|
|
473
|
+
if (this.state === "destroyed") {
|
|
474
|
+
throw new Error("cant reopen a destroyed connection");
|
|
475
|
+
}
|
|
476
|
+
this.state = "open";
|
|
477
|
+
this.createNewConnection(this.serverId);
|
|
478
|
+
}
|
|
472
479
|
async createNewConnection(to, attempt = 0) {
|
|
473
480
|
if (this.state === "destroyed") {
|
|
474
481
|
throw new Error("cant reopen a destroyed connection");
|
package/dist/util/testHelpers.js
CHANGED
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.10.
|
|
4
|
+
"version": "0.10.12",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
@@ -63,11 +63,11 @@
|
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@types/ws": "^8.5.5",
|
|
66
|
-
"@vitest/ui": "^1.1
|
|
66
|
+
"@vitest/ui": "^1.2.1",
|
|
67
67
|
"prettier": "^3.0.0",
|
|
68
68
|
"tsup": "^7.2.0",
|
|
69
69
|
"typescript": "^5.2.2",
|
|
70
|
-
"vitest": "^1.1
|
|
70
|
+
"vitest": "^1.2.1"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
|
73
73
|
"check": "tsc --noEmit && npx prettier . --check",
|