@replit/river 0.18.3 → 0.18.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-7OS34AWW.js → chunk-TF7XT3LV.js} +9 -12
- package/dist/{procedures-85e52b9c.d.ts → procedures-bfffcb0b.d.ts} +1 -1
- package/dist/router/index.cjs +9 -12
- package/dist/router/index.d.cts +3 -5
- package/dist/router/index.d.ts +3 -5
- package/dist/router/index.js +1 -1
- package/dist/util/testHelpers.d.cts +1 -1
- package/dist/util/testHelpers.d.ts +1 -1
- package/dist/util/testHelpers.js +1 -1
- package/package.json +3 -2
|
@@ -887,7 +887,6 @@ function handleUpload(transport, serverId, init, serviceName, procedureName) {
|
|
|
887
887
|
import { Value } from "@sinclair/typebox/value";
|
|
888
888
|
var RiverServer = class {
|
|
889
889
|
transport;
|
|
890
|
-
serviceDefs;
|
|
891
890
|
services;
|
|
892
891
|
contextMap;
|
|
893
892
|
// map of streamId to ProcStream
|
|
@@ -896,7 +895,6 @@ var RiverServer = class {
|
|
|
896
895
|
clientStreams;
|
|
897
896
|
disconnectedSessions;
|
|
898
897
|
constructor(transport, services, extendedContext) {
|
|
899
|
-
this.serviceDefs = services;
|
|
900
898
|
const instances = {};
|
|
901
899
|
this.services = instances;
|
|
902
900
|
this.contextMap = /* @__PURE__ */ new Map();
|
|
@@ -918,15 +916,6 @@ var RiverServer = class {
|
|
|
918
916
|
get streams() {
|
|
919
917
|
return this.streamMap;
|
|
920
918
|
}
|
|
921
|
-
serialize() {
|
|
922
|
-
return Object.entries(this.serviceDefs).reduce(
|
|
923
|
-
(acc, [name, value]) => {
|
|
924
|
-
acc[name] = value.serialize();
|
|
925
|
-
return acc;
|
|
926
|
-
},
|
|
927
|
-
{}
|
|
928
|
-
);
|
|
929
|
-
}
|
|
930
919
|
onMessage = async (message) => {
|
|
931
920
|
if (message.to !== this.transport.clientId) {
|
|
932
921
|
log?.info(`got msg with destination that isn't this server, ignoring`, {
|
|
@@ -966,6 +955,14 @@ var RiverServer = class {
|
|
|
966
955
|
this.transport.removeEventListener("message", this.onMessage);
|
|
967
956
|
this.transport.removeEventListener("sessionStatus", this.onSessionStatus);
|
|
968
957
|
await Promise.all([...this.streamMap.keys()].map(this.cleanupStream));
|
|
958
|
+
for (const context of this.contextMap.values()) {
|
|
959
|
+
if (Symbol.dispose in context.state) {
|
|
960
|
+
const dispose = context.state[Symbol.dispose];
|
|
961
|
+
if (typeof dispose === "function") {
|
|
962
|
+
dispose();
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
}
|
|
969
966
|
}
|
|
970
967
|
createNewProcStream(message) {
|
|
971
968
|
if (!isStreamOpen(message.controlFlags)) {
|
|
@@ -1241,7 +1238,7 @@ function createServer(transport, services, extendedContext) {
|
|
|
1241
1238
|
}
|
|
1242
1239
|
|
|
1243
1240
|
// package.json
|
|
1244
|
-
var version = "0.18.
|
|
1241
|
+
var version = "0.18.4";
|
|
1245
1242
|
|
|
1246
1243
|
export {
|
|
1247
1244
|
ServiceSchema,
|
|
@@ -58,7 +58,7 @@ type ServiceContextWithState<State> = ServiceContext & {
|
|
|
58
58
|
state: State;
|
|
59
59
|
};
|
|
60
60
|
type ServiceContextWithTransportInfo<State> = ServiceContext & {
|
|
61
|
-
state: State
|
|
61
|
+
state: Omit<State, typeof Symbol.dispose>;
|
|
62
62
|
to: TransportClientId;
|
|
63
63
|
from: TransportClientId;
|
|
64
64
|
streamId: string;
|
package/dist/router/index.cjs
CHANGED
|
@@ -983,7 +983,6 @@ function coerceErrorString(err) {
|
|
|
983
983
|
// router/server.ts
|
|
984
984
|
var RiverServer = class {
|
|
985
985
|
transport;
|
|
986
|
-
serviceDefs;
|
|
987
986
|
services;
|
|
988
987
|
contextMap;
|
|
989
988
|
// map of streamId to ProcStream
|
|
@@ -992,7 +991,6 @@ var RiverServer = class {
|
|
|
992
991
|
clientStreams;
|
|
993
992
|
disconnectedSessions;
|
|
994
993
|
constructor(transport, services, extendedContext) {
|
|
995
|
-
this.serviceDefs = services;
|
|
996
994
|
const instances = {};
|
|
997
995
|
this.services = instances;
|
|
998
996
|
this.contextMap = /* @__PURE__ */ new Map();
|
|
@@ -1014,15 +1012,6 @@ var RiverServer = class {
|
|
|
1014
1012
|
get streams() {
|
|
1015
1013
|
return this.streamMap;
|
|
1016
1014
|
}
|
|
1017
|
-
serialize() {
|
|
1018
|
-
return Object.entries(this.serviceDefs).reduce(
|
|
1019
|
-
(acc, [name, value]) => {
|
|
1020
|
-
acc[name] = value.serialize();
|
|
1021
|
-
return acc;
|
|
1022
|
-
},
|
|
1023
|
-
{}
|
|
1024
|
-
);
|
|
1025
|
-
}
|
|
1026
1015
|
onMessage = async (message) => {
|
|
1027
1016
|
if (message.to !== this.transport.clientId) {
|
|
1028
1017
|
log?.info(`got msg with destination that isn't this server, ignoring`, {
|
|
@@ -1062,6 +1051,14 @@ var RiverServer = class {
|
|
|
1062
1051
|
this.transport.removeEventListener("message", this.onMessage);
|
|
1063
1052
|
this.transport.removeEventListener("sessionStatus", this.onSessionStatus);
|
|
1064
1053
|
await Promise.all([...this.streamMap.keys()].map(this.cleanupStream));
|
|
1054
|
+
for (const context of this.contextMap.values()) {
|
|
1055
|
+
if (Symbol.dispose in context.state) {
|
|
1056
|
+
const dispose = context.state[Symbol.dispose];
|
|
1057
|
+
if (typeof dispose === "function") {
|
|
1058
|
+
dispose();
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1065
1062
|
}
|
|
1066
1063
|
createNewProcStream(message) {
|
|
1067
1064
|
if (!isStreamOpen(message.controlFlags)) {
|
|
@@ -1337,7 +1334,7 @@ function createServer(transport, services, extendedContext) {
|
|
|
1337
1334
|
}
|
|
1338
1335
|
|
|
1339
1336
|
// package.json
|
|
1340
|
-
var version = "0.18.
|
|
1337
|
+
var version = "0.18.4";
|
|
1341
1338
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1342
1339
|
0 && (module.exports = {
|
|
1343
1340
|
Err,
|
package/dist/router/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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-
|
|
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-bfffcb0b.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-bfffcb0b.js';
|
|
4
4
|
import { b as ClientTransport, C as Connection, c as ServerTransport } from '../index-d412ca83.js';
|
|
5
5
|
import { Pushable } from 'it-pushable';
|
|
6
6
|
import { T as TransportClientId } from '../index-46ed19d8.js';
|
|
@@ -387,7 +387,6 @@ declare const createClient: <ServiceSchemaMap extends AnyServiceSchemaMap>(trans
|
|
|
387
387
|
interface Server<Services extends AnyServiceSchemaMap> {
|
|
388
388
|
services: InstantiatedServiceSchemaMap<Services>;
|
|
389
389
|
streams: Map<string, ProcStream>;
|
|
390
|
-
serialize(): SerializedServerSchema;
|
|
391
390
|
close(): Promise<void>;
|
|
392
391
|
}
|
|
393
392
|
interface ProcStream {
|
|
@@ -401,7 +400,6 @@ interface ProcStream {
|
|
|
401
400
|
inputHandler: Promise<unknown>;
|
|
402
401
|
};
|
|
403
402
|
}
|
|
404
|
-
type SerializedServerSchema = Record<string, SerializedServiceSchema>;
|
|
405
403
|
/**
|
|
406
404
|
* Creates a server instance that listens for incoming messages from a transport and routes them to the appropriate service and procedure.
|
|
407
405
|
* The server tracks the state of each service along with open streams and the extended context object.
|
|
@@ -412,6 +410,6 @@ type SerializedServerSchema = Record<string, SerializedServiceSchema>;
|
|
|
412
410
|
*/
|
|
413
411
|
declare function createServer<Services extends AnyServiceSchemaMap>(transport: ServerTransport<Connection>, services: Services, extendedContext?: Omit<ServiceContext, 'state'>): Server<Services>;
|
|
414
412
|
|
|
415
|
-
var version = "0.18.
|
|
413
|
+
var version = "0.18.4";
|
|
416
414
|
|
|
417
415
|
export { Client, PayloadType, ProcErrors, ProcHandler, ProcInit, ProcInput, ProcOutput, ProcType, ProcedureMap, version as RIVER_VERSION, Result, RiverError, RiverUncaughtSchema, Server, Service, ServiceConfiguration, ServiceContext, ServiceSchema, createClient, createServer };
|
package/dist/router/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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-
|
|
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-bfffcb0b.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-bfffcb0b.js';
|
|
4
4
|
import { b as ClientTransport, C as Connection, c as ServerTransport } from '../index-d412ca83.js';
|
|
5
5
|
import { Pushable } from 'it-pushable';
|
|
6
6
|
import { T as TransportClientId } from '../index-46ed19d8.js';
|
|
@@ -387,7 +387,6 @@ declare const createClient: <ServiceSchemaMap extends AnyServiceSchemaMap>(trans
|
|
|
387
387
|
interface Server<Services extends AnyServiceSchemaMap> {
|
|
388
388
|
services: InstantiatedServiceSchemaMap<Services>;
|
|
389
389
|
streams: Map<string, ProcStream>;
|
|
390
|
-
serialize(): SerializedServerSchema;
|
|
391
390
|
close(): Promise<void>;
|
|
392
391
|
}
|
|
393
392
|
interface ProcStream {
|
|
@@ -401,7 +400,6 @@ interface ProcStream {
|
|
|
401
400
|
inputHandler: Promise<unknown>;
|
|
402
401
|
};
|
|
403
402
|
}
|
|
404
|
-
type SerializedServerSchema = Record<string, SerializedServiceSchema>;
|
|
405
403
|
/**
|
|
406
404
|
* Creates a server instance that listens for incoming messages from a transport and routes them to the appropriate service and procedure.
|
|
407
405
|
* The server tracks the state of each service along with open streams and the extended context object.
|
|
@@ -412,6 +410,6 @@ type SerializedServerSchema = Record<string, SerializedServiceSchema>;
|
|
|
412
410
|
*/
|
|
413
411
|
declare function createServer<Services extends AnyServiceSchemaMap>(transport: ServerTransport<Connection>, services: Services, extendedContext?: Omit<ServiceContext, 'state'>): Server<Services>;
|
|
414
412
|
|
|
415
|
-
var version = "0.18.
|
|
413
|
+
var version = "0.18.4";
|
|
416
414
|
|
|
417
415
|
export { Client, PayloadType, ProcErrors, ProcHandler, ProcInit, ProcInput, ProcOutput, ProcType, ProcedureMap, version as RIVER_VERSION, Result, RiverError, RiverUncaughtSchema, Server, Service, ServiceConfiguration, ServiceContext, ServiceSchema, createClient, createServer };
|
package/dist/router/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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-
|
|
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-bfffcb0b.js';
|
|
3
3
|
import { T as Transport, C as Connection, S as SessionOptions, a as Session } from '../index-d412ca83.js';
|
|
4
4
|
import * as it_pushable from 'it-pushable';
|
|
5
5
|
import { P as PartialTransportMessage, O as OpaqueTransportMessage } from '../index-46ed19d8.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
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-
|
|
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-bfffcb0b.js';
|
|
3
3
|
import { T as Transport, C as Connection, S as SessionOptions, a as Session } from '../index-d412ca83.js';
|
|
4
4
|
import * as it_pushable from 'it-pushable';
|
|
5
5
|
import { P as PartialTransportMessage, O as OpaqueTransportMessage } from '../index-46ed19d8.js';
|
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.18.
|
|
4
|
+
"version": "0.18.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
@@ -68,7 +68,8 @@
|
|
|
68
68
|
"prettier": "^3.0.0",
|
|
69
69
|
"tsup": "^7.2.0",
|
|
70
70
|
"typescript": "^5.2.2",
|
|
71
|
-
"vitest": "^1.3.1"
|
|
71
|
+
"vitest": "^1.3.1",
|
|
72
|
+
"vscode-langservers-extracted": "4.8.0"
|
|
72
73
|
},
|
|
73
74
|
"scripts": {
|
|
74
75
|
"check": "tsc --noEmit && npm run format && npm run lint",
|