@replit/river 0.201.0 → 0.202.0
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-UBUD2LMZ.js → chunk-2T22KY5X.js} +3 -3
- package/dist/{chunk-52DVJUVZ.js → chunk-BDUOHZMF.js} +2 -2
- package/dist/{chunk-OZ3ITXW5.js → chunk-NSH4D6OB.js} +3 -3
- package/dist/{chunk-7IUEEQP7.js → chunk-QMXUCLGE.js} +2 -2
- package/dist/{chunk-7IUEEQP7.js.map → chunk-QMXUCLGE.js.map} +1 -1
- package/dist/{chunk-PJ4GJ5CU.js → chunk-W4AGHFXK.js} +2 -2
- package/dist/router/index.cjs +20 -3
- package/dist/router/index.cjs.map +1 -1
- package/dist/router/index.d.cts +5 -4
- package/dist/router/index.d.ts +5 -4
- package/dist/router/index.js +20 -3
- package/dist/router/index.js.map +1 -1
- package/dist/{services-e71ea921.d.ts → services-a05f5174.d.ts} +7 -2
- package/dist/testUtil/index.cjs +1 -1
- package/dist/testUtil/index.cjs.map +1 -1
- package/dist/testUtil/index.d.cts +1 -1
- package/dist/testUtil/index.d.ts +1 -1
- package/dist/testUtil/index.js +4 -4
- package/dist/transport/impls/ws/client.cjs +1 -1
- package/dist/transport/impls/ws/client.cjs.map +1 -1
- package/dist/transport/impls/ws/client.js +4 -4
- package/dist/transport/impls/ws/server.cjs +1 -1
- package/dist/transport/impls/ws/server.cjs.map +1 -1
- package/dist/transport/impls/ws/server.js +4 -4
- package/dist/transport/index.cjs +1 -1
- package/dist/transport/index.cjs.map +1 -1
- package/dist/transport/index.js +4 -4
- package/package.json +1 -1
- /package/dist/{chunk-UBUD2LMZ.js.map → chunk-2T22KY5X.js.map} +0 -0
- /package/dist/{chunk-52DVJUVZ.js.map → chunk-BDUOHZMF.js.map} +0 -0
- /package/dist/{chunk-OZ3ITXW5.js.map → chunk-NSH4D6OB.js.map} +0 -0
- /package/dist/{chunk-PJ4GJ5CU.js.map → chunk-W4AGHFXK.js.map} +0 -0
package/dist/router/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, a as AnyProcedure } from '../services-
|
|
2
|
-
export { E as BaseErrorSchemaType, C as CANCEL_CODE, G as Client, H as Err, L as ErrResult, B as INVALID_REQUEST_CODE, O as Ok, M as OkResult, p as PayloadType, f as ProcErrors, P as ProcHandler, c as ProcInit, d as ProcRequest, e as ProcResponse, g as ProcType, v as Procedure, w as ProcedureErrorSchemaType, q as ProcedureMap, R as RPCProcedure, u as Readable, D as ReaderErrorSchema, T as ResponseData, K as Result, Q as ResultUnwrapErr, N as ResultUnwrapOk, k as SerializedProcedureSchema, o as SerializedProcedureSchemaProtocolv1, i as SerializedServerSchema, m as SerializedServerSchemaProtocolv1, j as SerializedServiceSchema, n as SerializedServiceSchemaProtocolv1, S as Service, b as ServiceConfiguration, h as ServiceSchema, t as StreamProcedure, r as SubscriptionProcedure, y as UNCAUGHT_ERROR_CODE, z as UNEXPECTED_DISCONNECT_CODE, U as UploadProcedure, V as ValidProcType, W as Writable, F as createClient, x as flattenErrorType, s as serializeSchema, l as serializeSchemaV1Compat, J as unwrapOrThrow } from '../services-
|
|
1
|
+
import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, a as AnyProcedure } from '../services-a05f5174.js';
|
|
2
|
+
export { E as BaseErrorSchemaType, C as CANCEL_CODE, G as Client, H as Err, L as ErrResult, B as INVALID_REQUEST_CODE, O as Ok, M as OkResult, p as PayloadType, f as ProcErrors, P as ProcHandler, c as ProcInit, d as ProcRequest, e as ProcResponse, g as ProcType, v as Procedure, w as ProcedureErrorSchemaType, q as ProcedureMap, R as RPCProcedure, u as Readable, D as ReaderErrorSchema, T as ResponseData, K as Result, Q as ResultUnwrapErr, N as ResultUnwrapOk, k as SerializedProcedureSchema, o as SerializedProcedureSchemaProtocolv1, i as SerializedServerSchema, m as SerializedServerSchemaProtocolv1, j as SerializedServiceSchema, n as SerializedServiceSchemaProtocolv1, S as Service, b as ServiceConfiguration, h as ServiceSchema, t as StreamProcedure, r as SubscriptionProcedure, y as UNCAUGHT_ERROR_CODE, z as UNEXPECTED_DISCONNECT_CODE, U as UploadProcedure, V as ValidProcType, W as Writable, F as createClient, x as flattenErrorType, s as serializeSchema, l as serializeSchemaV1Compat, J as unwrapOrThrow } from '../services-a05f5174.js';
|
|
3
3
|
import { c as TransportClientId, b as OpaqueTransportMessage } from '../message-3def9ded.js';
|
|
4
4
|
import { q as ParsedMetadata, C as Connection, r as ServerHandshakeOptions, s as ServiceContext } from '../context-8d263a7f.js';
|
|
5
5
|
export { t as ProcedureHandlerContext, u as createClientHandshakeOptions, v as createServerHandshakeOptions } from '../context-8d263a7f.js';
|
|
@@ -25,6 +25,7 @@ interface Server<Services extends AnyServiceSchemaMap> {
|
|
|
25
25
|
* A set of stream ids that are currently open.
|
|
26
26
|
*/
|
|
27
27
|
streams: Map<StreamId, ProcStream>;
|
|
28
|
+
close: () => Promise<void>;
|
|
28
29
|
}
|
|
29
30
|
interface ProcStream {
|
|
30
31
|
streamId: StreamId;
|
|
@@ -47,7 +48,7 @@ interface ProcStream {
|
|
|
47
48
|
*/
|
|
48
49
|
declare function createServer<Services extends AnyServiceSchemaMap>(transport: ServerTransport<Connection>, services: Services, providedServerOptions?: Partial<{
|
|
49
50
|
handshakeOptions?: ServerHandshakeOptions;
|
|
50
|
-
extendedContext?:
|
|
51
|
+
extendedContext?: ServiceContext;
|
|
51
52
|
/**
|
|
52
53
|
* Maximum number of cancelled streams to keep track of to avoid
|
|
53
54
|
* cascading stream errors.
|
|
@@ -55,6 +56,6 @@ declare function createServer<Services extends AnyServiceSchemaMap>(transport: S
|
|
|
55
56
|
maxCancelledStreamTombstonesPerSession?: number;
|
|
56
57
|
}>): Server<Services>;
|
|
57
58
|
|
|
58
|
-
var version = "0.
|
|
59
|
+
var version = "0.202.0";
|
|
59
60
|
|
|
60
61
|
export { ParsedMetadata, version as RIVER_VERSION, Server, ServiceContext, createServer };
|
package/dist/router/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, a as AnyProcedure } from '../services-
|
|
2
|
-
export { E as BaseErrorSchemaType, C as CANCEL_CODE, G as Client, H as Err, L as ErrResult, B as INVALID_REQUEST_CODE, O as Ok, M as OkResult, p as PayloadType, f as ProcErrors, P as ProcHandler, c as ProcInit, d as ProcRequest, e as ProcResponse, g as ProcType, v as Procedure, w as ProcedureErrorSchemaType, q as ProcedureMap, R as RPCProcedure, u as Readable, D as ReaderErrorSchema, T as ResponseData, K as Result, Q as ResultUnwrapErr, N as ResultUnwrapOk, k as SerializedProcedureSchema, o as SerializedProcedureSchemaProtocolv1, i as SerializedServerSchema, m as SerializedServerSchemaProtocolv1, j as SerializedServiceSchema, n as SerializedServiceSchemaProtocolv1, S as Service, b as ServiceConfiguration, h as ServiceSchema, t as StreamProcedure, r as SubscriptionProcedure, y as UNCAUGHT_ERROR_CODE, z as UNEXPECTED_DISCONNECT_CODE, U as UploadProcedure, V as ValidProcType, W as Writable, F as createClient, x as flattenErrorType, s as serializeSchema, l as serializeSchemaV1Compat, J as unwrapOrThrow } from '../services-
|
|
1
|
+
import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, a as AnyProcedure } from '../services-a05f5174.js';
|
|
2
|
+
export { E as BaseErrorSchemaType, C as CANCEL_CODE, G as Client, H as Err, L as ErrResult, B as INVALID_REQUEST_CODE, O as Ok, M as OkResult, p as PayloadType, f as ProcErrors, P as ProcHandler, c as ProcInit, d as ProcRequest, e as ProcResponse, g as ProcType, v as Procedure, w as ProcedureErrorSchemaType, q as ProcedureMap, R as RPCProcedure, u as Readable, D as ReaderErrorSchema, T as ResponseData, K as Result, Q as ResultUnwrapErr, N as ResultUnwrapOk, k as SerializedProcedureSchema, o as SerializedProcedureSchemaProtocolv1, i as SerializedServerSchema, m as SerializedServerSchemaProtocolv1, j as SerializedServiceSchema, n as SerializedServiceSchemaProtocolv1, S as Service, b as ServiceConfiguration, h as ServiceSchema, t as StreamProcedure, r as SubscriptionProcedure, y as UNCAUGHT_ERROR_CODE, z as UNEXPECTED_DISCONNECT_CODE, U as UploadProcedure, V as ValidProcType, W as Writable, F as createClient, x as flattenErrorType, s as serializeSchema, l as serializeSchemaV1Compat, J as unwrapOrThrow } from '../services-a05f5174.js';
|
|
3
3
|
import { c as TransportClientId, b as OpaqueTransportMessage } from '../message-3def9ded.js';
|
|
4
4
|
import { q as ParsedMetadata, C as Connection, r as ServerHandshakeOptions, s as ServiceContext } from '../context-8d263a7f.js';
|
|
5
5
|
export { t as ProcedureHandlerContext, u as createClientHandshakeOptions, v as createServerHandshakeOptions } from '../context-8d263a7f.js';
|
|
@@ -25,6 +25,7 @@ interface Server<Services extends AnyServiceSchemaMap> {
|
|
|
25
25
|
* A set of stream ids that are currently open.
|
|
26
26
|
*/
|
|
27
27
|
streams: Map<StreamId, ProcStream>;
|
|
28
|
+
close: () => Promise<void>;
|
|
28
29
|
}
|
|
29
30
|
interface ProcStream {
|
|
30
31
|
streamId: StreamId;
|
|
@@ -47,7 +48,7 @@ interface ProcStream {
|
|
|
47
48
|
*/
|
|
48
49
|
declare function createServer<Services extends AnyServiceSchemaMap>(transport: ServerTransport<Connection>, services: Services, providedServerOptions?: Partial<{
|
|
49
50
|
handshakeOptions?: ServerHandshakeOptions;
|
|
50
|
-
extendedContext?:
|
|
51
|
+
extendedContext?: ServiceContext;
|
|
51
52
|
/**
|
|
52
53
|
* Maximum number of cancelled streams to keep track of to avoid
|
|
53
54
|
* cascading stream errors.
|
|
@@ -55,6 +56,6 @@ declare function createServer<Services extends AnyServiceSchemaMap>(transport: S
|
|
|
55
56
|
maxCancelledStreamTombstonesPerSession?: number;
|
|
56
57
|
}>): Server<Services>;
|
|
57
58
|
|
|
58
|
-
var version = "0.
|
|
59
|
+
var version = "0.202.0";
|
|
59
60
|
|
|
60
61
|
export { ParsedMetadata, version as RIVER_VERSION, Server, ServiceContext, createServer };
|
package/dist/router/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
isStreamClose,
|
|
13
13
|
isStreamOpen,
|
|
14
14
|
version
|
|
15
|
-
} from "../chunk-
|
|
15
|
+
} from "../chunk-QMXUCLGE.js";
|
|
16
16
|
|
|
17
17
|
// router/services.ts
|
|
18
18
|
import { Type as Type2, Kind as Kind2 } from "@sinclair/typebox";
|
|
@@ -260,9 +260,15 @@ var ServiceSchema = class _ServiceSchema {
|
|
|
260
260
|
* for you.
|
|
261
261
|
*/
|
|
262
262
|
instantiate(extendedContext) {
|
|
263
|
+
const state = this.initializeState(extendedContext);
|
|
264
|
+
const dispose = async () => {
|
|
265
|
+
await state[Symbol.asyncDispose]?.();
|
|
266
|
+
state[Symbol.dispose]?.();
|
|
267
|
+
};
|
|
263
268
|
return Object.freeze({
|
|
264
|
-
state
|
|
265
|
-
procedures: this.procedures
|
|
269
|
+
state,
|
|
270
|
+
procedures: this.procedures,
|
|
271
|
+
[Symbol.asyncDispose]: dispose
|
|
266
272
|
});
|
|
267
273
|
}
|
|
268
274
|
};
|
|
@@ -949,6 +955,7 @@ var RiverServer = class {
|
|
|
949
955
|
maxCancelledStreamTombstonesPerSession;
|
|
950
956
|
streams;
|
|
951
957
|
services;
|
|
958
|
+
unregisterTransportListeners;
|
|
952
959
|
constructor(transport, services, handshakeOptions, extendedContext, maxCancelledStreamTombstonesPerSession = 200) {
|
|
953
960
|
const instances = {};
|
|
954
961
|
this.services = instances;
|
|
@@ -1016,6 +1023,9 @@ var RiverServer = class {
|
|
|
1016
1023
|
const handleTransportStatus = (evt) => {
|
|
1017
1024
|
if (evt.status !== "closed")
|
|
1018
1025
|
return;
|
|
1026
|
+
this.unregisterTransportListeners();
|
|
1027
|
+
};
|
|
1028
|
+
this.unregisterTransportListeners = () => {
|
|
1019
1029
|
this.transport.removeEventListener("message", handleCreatingNewStreams);
|
|
1020
1030
|
this.transport.removeEventListener("sessionStatus", handleSessionStatus);
|
|
1021
1031
|
this.transport.removeEventListener(
|
|
@@ -1553,6 +1563,13 @@ var RiverServer = class {
|
|
|
1553
1563
|
const msg = cancelMessage(streamId, payload);
|
|
1554
1564
|
sessionScopedSend(msg);
|
|
1555
1565
|
}
|
|
1566
|
+
async close() {
|
|
1567
|
+
this.unregisterTransportListeners();
|
|
1568
|
+
for (const serviceName of Object.keys(this.services)) {
|
|
1569
|
+
const service = this.services[serviceName];
|
|
1570
|
+
await service[Symbol.asyncDispose]();
|
|
1571
|
+
}
|
|
1572
|
+
}
|
|
1556
1573
|
};
|
|
1557
1574
|
var LRUSet = class {
|
|
1558
1575
|
items;
|