@replit/river 0.18.2 → 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-D3CC5GL7.js → chunk-TF7XT3LV.js} +13 -12
- package/dist/{procedures-85e52b9c.d.ts → procedures-bfffcb0b.d.ts} +1 -1
- package/dist/router/index.cjs +13 -11
- package/dist/router/index.d.cts +5 -5
- package/dist/router/index.d.ts +5 -5
- package/dist/router/index.js +4 -2
- 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)) {
|
|
@@ -1240,6 +1237,9 @@ function createServer(transport, services, extendedContext) {
|
|
|
1240
1237
|
return new RiverServer(transport, services, extendedContext);
|
|
1241
1238
|
}
|
|
1242
1239
|
|
|
1240
|
+
// package.json
|
|
1241
|
+
var version = "0.18.4";
|
|
1242
|
+
|
|
1243
1243
|
export {
|
|
1244
1244
|
ServiceSchema,
|
|
1245
1245
|
Procedure,
|
|
@@ -1249,5 +1249,6 @@ export {
|
|
|
1249
1249
|
Ok,
|
|
1250
1250
|
Err,
|
|
1251
1251
|
createClient,
|
|
1252
|
-
createServer
|
|
1252
|
+
createServer,
|
|
1253
|
+
version
|
|
1253
1254
|
};
|
|
@@ -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
|
@@ -23,6 +23,7 @@ __export(router_exports, {
|
|
|
23
23
|
Err: () => Err,
|
|
24
24
|
Ok: () => Ok,
|
|
25
25
|
Procedure: () => Procedure,
|
|
26
|
+
RIVER_VERSION: () => version,
|
|
26
27
|
RiverUncaughtSchema: () => RiverUncaughtSchema,
|
|
27
28
|
ServiceSchema: () => ServiceSchema,
|
|
28
29
|
UNCAUGHT_ERROR: () => UNCAUGHT_ERROR,
|
|
@@ -982,7 +983,6 @@ function coerceErrorString(err) {
|
|
|
982
983
|
// router/server.ts
|
|
983
984
|
var RiverServer = class {
|
|
984
985
|
transport;
|
|
985
|
-
serviceDefs;
|
|
986
986
|
services;
|
|
987
987
|
contextMap;
|
|
988
988
|
// map of streamId to ProcStream
|
|
@@ -991,7 +991,6 @@ var RiverServer = class {
|
|
|
991
991
|
clientStreams;
|
|
992
992
|
disconnectedSessions;
|
|
993
993
|
constructor(transport, services, extendedContext) {
|
|
994
|
-
this.serviceDefs = services;
|
|
995
994
|
const instances = {};
|
|
996
995
|
this.services = instances;
|
|
997
996
|
this.contextMap = /* @__PURE__ */ new Map();
|
|
@@ -1013,15 +1012,6 @@ var RiverServer = class {
|
|
|
1013
1012
|
get streams() {
|
|
1014
1013
|
return this.streamMap;
|
|
1015
1014
|
}
|
|
1016
|
-
serialize() {
|
|
1017
|
-
return Object.entries(this.serviceDefs).reduce(
|
|
1018
|
-
(acc, [name, value]) => {
|
|
1019
|
-
acc[name] = value.serialize();
|
|
1020
|
-
return acc;
|
|
1021
|
-
},
|
|
1022
|
-
{}
|
|
1023
|
-
);
|
|
1024
|
-
}
|
|
1025
1015
|
onMessage = async (message) => {
|
|
1026
1016
|
if (message.to !== this.transport.clientId) {
|
|
1027
1017
|
log?.info(`got msg with destination that isn't this server, ignoring`, {
|
|
@@ -1061,6 +1051,14 @@ var RiverServer = class {
|
|
|
1061
1051
|
this.transport.removeEventListener("message", this.onMessage);
|
|
1062
1052
|
this.transport.removeEventListener("sessionStatus", this.onSessionStatus);
|
|
1063
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
|
+
}
|
|
1064
1062
|
}
|
|
1065
1063
|
createNewProcStream(message) {
|
|
1066
1064
|
if (!isStreamOpen(message.controlFlags)) {
|
|
@@ -1334,11 +1332,15 @@ var RiverServer = class {
|
|
|
1334
1332
|
function createServer(transport, services, extendedContext) {
|
|
1335
1333
|
return new RiverServer(transport, services, extendedContext);
|
|
1336
1334
|
}
|
|
1335
|
+
|
|
1336
|
+
// package.json
|
|
1337
|
+
var version = "0.18.4";
|
|
1337
1338
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1338
1339
|
0 && (module.exports = {
|
|
1339
1340
|
Err,
|
|
1340
1341
|
Ok,
|
|
1341
1342
|
Procedure,
|
|
1343
|
+
RIVER_VERSION,
|
|
1342
1344
|
RiverUncaughtSchema,
|
|
1343
1345
|
ServiceSchema,
|
|
1344
1346
|
UNCAUGHT_ERROR,
|
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,4 +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
|
-
|
|
413
|
+
var version = "0.18.4";
|
|
414
|
+
|
|
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,4 +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
|
-
|
|
413
|
+
var version = "0.18.4";
|
|
414
|
+
|
|
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
|
@@ -6,14 +6,16 @@ import {
|
|
|
6
6
|
ServiceSchema,
|
|
7
7
|
UNCAUGHT_ERROR,
|
|
8
8
|
createClient,
|
|
9
|
-
createServer
|
|
10
|
-
|
|
9
|
+
createServer,
|
|
10
|
+
version
|
|
11
|
+
} from "../chunk-TF7XT3LV.js";
|
|
11
12
|
import "../chunk-VH3NGOXQ.js";
|
|
12
13
|
import "../chunk-WER2DWCP.js";
|
|
13
14
|
export {
|
|
14
15
|
Err,
|
|
15
16
|
Ok,
|
|
16
17
|
Procedure,
|
|
18
|
+
version as RIVER_VERSION,
|
|
17
19
|
RiverUncaughtSchema,
|
|
18
20
|
ServiceSchema,
|
|
19
21
|
UNCAUGHT_ERROR,
|
|
@@ -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",
|