@replit/river 0.23.18 → 0.24.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.
Files changed (84) hide show
  1. package/README.md +17 -16
  2. package/dist/{chunk-AVL32IMG.js → chunk-AASMR3CQ.js} +20 -16
  3. package/dist/chunk-AASMR3CQ.js.map +1 -0
  4. package/dist/chunk-JA57I7MG.js +653 -0
  5. package/dist/chunk-JA57I7MG.js.map +1 -0
  6. package/dist/chunk-KX5PQRVN.js +382 -0
  7. package/dist/chunk-KX5PQRVN.js.map +1 -0
  8. package/dist/{chunk-EV5HW4IC.js → chunk-KYYB4DUR.js} +65 -53
  9. package/dist/chunk-KYYB4DUR.js.map +1 -0
  10. package/dist/chunk-NLQPPDOT.js +399 -0
  11. package/dist/chunk-NLQPPDOT.js.map +1 -0
  12. package/dist/{chunk-R2HAS3GM.js → chunk-PJGGC3LV.js} +55 -41
  13. package/dist/chunk-PJGGC3LV.js.map +1 -0
  14. package/dist/{chunk-7MJYOL32.js → chunk-RXJLI2OP.js} +15 -23
  15. package/dist/chunk-RXJLI2OP.js.map +1 -0
  16. package/dist/{chunk-6LCL2ZZF.js → chunk-TAH2GVTJ.js} +1 -1
  17. package/dist/chunk-TAH2GVTJ.js.map +1 -0
  18. package/dist/chunk-ZAT3R4CU.js +277 -0
  19. package/dist/chunk-ZAT3R4CU.js.map +1 -0
  20. package/dist/{client-5776a6bb.d.ts → client-ba0d3315.d.ts} +12 -15
  21. package/dist/{connection-bd35d442.d.ts → connection-c3a96d09.d.ts} +1 -5
  22. package/dist/connection-d33e3246.d.ts +11 -0
  23. package/dist/{handshake-a947c234.d.ts → handshake-cdead82a.d.ts} +148 -183
  24. package/dist/logging/index.cjs.map +1 -1
  25. package/dist/logging/index.d.cts +1 -1
  26. package/dist/logging/index.d.ts +1 -1
  27. package/dist/logging/index.js +1 -1
  28. package/dist/{index-ea74cdbb.d.ts → message-e6c560fd.d.ts} +2 -2
  29. package/dist/router/index.cjs +104 -63
  30. package/dist/router/index.cjs.map +1 -1
  31. package/dist/router/index.d.cts +11 -10
  32. package/dist/router/index.d.ts +11 -10
  33. package/dist/router/index.js +2 -2
  34. package/dist/server-2ef5e6ec.d.ts +42 -0
  35. package/dist/{services-38b3f758.d.ts → services-e1417b33.d.ts} +3 -3
  36. package/dist/transport/impls/uds/client.cjs +1246 -1230
  37. package/dist/transport/impls/uds/client.cjs.map +1 -1
  38. package/dist/transport/impls/uds/client.d.cts +4 -4
  39. package/dist/transport/impls/uds/client.d.ts +4 -4
  40. package/dist/transport/impls/uds/client.js +7 -13
  41. package/dist/transport/impls/uds/client.js.map +1 -1
  42. package/dist/transport/impls/uds/server.cjs +1298 -1151
  43. package/dist/transport/impls/uds/server.cjs.map +1 -1
  44. package/dist/transport/impls/uds/server.d.cts +4 -4
  45. package/dist/transport/impls/uds/server.d.ts +4 -4
  46. package/dist/transport/impls/uds/server.js +6 -6
  47. package/dist/transport/impls/ws/client.cjs +976 -965
  48. package/dist/transport/impls/ws/client.cjs.map +1 -1
  49. package/dist/transport/impls/ws/client.d.cts +4 -4
  50. package/dist/transport/impls/ws/client.d.ts +4 -4
  51. package/dist/transport/impls/ws/client.js +6 -7
  52. package/dist/transport/impls/ws/client.js.map +1 -1
  53. package/dist/transport/impls/ws/server.cjs +1182 -1047
  54. package/dist/transport/impls/ws/server.cjs.map +1 -1
  55. package/dist/transport/impls/ws/server.d.cts +4 -4
  56. package/dist/transport/impls/ws/server.d.ts +4 -4
  57. package/dist/transport/impls/ws/server.js +6 -6
  58. package/dist/transport/index.cjs +1433 -1360
  59. package/dist/transport/index.cjs.map +1 -1
  60. package/dist/transport/index.d.cts +4 -4
  61. package/dist/transport/index.d.ts +4 -4
  62. package/dist/transport/index.js +9 -9
  63. package/dist/util/testHelpers.cjs +743 -310
  64. package/dist/util/testHelpers.cjs.map +1 -1
  65. package/dist/util/testHelpers.d.cts +9 -6
  66. package/dist/util/testHelpers.d.ts +9 -6
  67. package/dist/util/testHelpers.js +33 -10
  68. package/dist/util/testHelpers.js.map +1 -1
  69. package/package.json +1 -1
  70. package/dist/chunk-6LCL2ZZF.js.map +0 -1
  71. package/dist/chunk-7MJYOL32.js.map +0 -1
  72. package/dist/chunk-AVL32IMG.js.map +0 -1
  73. package/dist/chunk-DPKOJQWF.js +0 -476
  74. package/dist/chunk-DPKOJQWF.js.map +0 -1
  75. package/dist/chunk-EV5HW4IC.js.map +0 -1
  76. package/dist/chunk-J6N6H2WU.js +0 -476
  77. package/dist/chunk-J6N6H2WU.js.map +0 -1
  78. package/dist/chunk-MW5JXLHY.js +0 -348
  79. package/dist/chunk-MW5JXLHY.js.map +0 -1
  80. package/dist/chunk-R2HAS3GM.js.map +0 -1
  81. package/dist/chunk-RJOWZIWB.js +0 -335
  82. package/dist/chunk-RJOWZIWB.js.map +0 -1
  83. package/dist/connection-df85db7e.d.ts +0 -17
  84. package/dist/server-53cd5b7e.d.ts +0 -24
@@ -1,14 +1,14 @@
1
- import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError } from '../services-38b3f758.js';
2
- export { C as Client, E as Err, O as Ok, z as Output, j as ProcErrors, f as ProcHandler, g as ProcInit, h as ProcInput, i as ProcOutput, k as ProcType, a as Procedure, p as ProcedureMap, d as ProcedureResult, q as RPCProcedure, y as ResultUnwrapErr, x as ResultUnwrapOk, w as RiverErrorSchema, c as RiverUncaughtSchema, o as SerializedProcedureSchema, m as SerializedServerSchema, n as SerializedServiceSchema, S as Service, e as ServiceConfiguration, l as ServiceSchema, t as StreamProcedure, r as SubscriptionProcedure, v as UNCAUGHT_ERROR, U as UploadProcedure, V as ValidProcType, u as createClient, s as serializeSchema } from '../services-38b3f758.js';
1
+ import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError } from '../services-e1417b33.js';
2
+ export { C as Client, E as Err, O as Ok, z as Output, j as ProcErrors, f as ProcHandler, g as ProcInit, h as ProcInput, i as ProcOutput, k as ProcType, a as Procedure, p as ProcedureMap, d as ProcedureResult, q as RPCProcedure, y as ResultUnwrapErr, x as ResultUnwrapOk, w as RiverErrorSchema, c as RiverUncaughtSchema, o as SerializedProcedureSchema, m as SerializedServerSchema, n as SerializedServiceSchema, S as Service, e as ServiceConfiguration, l as ServiceSchema, t as StreamProcedure, r as SubscriptionProcedure, v as UNCAUGHT_ERROR, U as UploadProcedure, V as ValidProcType, u as createClient, s as serializeSchema } from '../services-e1417b33.js';
3
3
  import { Static } from '@sinclair/typebox';
4
4
  import { Pushable } from 'it-pushable';
5
- import { C as Connection, m as ServerHandshakeOptions, i as ServiceContext } from '../handshake-a947c234.js';
6
- export { n as ParsedMetadata, o as ServiceContextWithState, p as ServiceContextWithTransportInfo, q as createClientHandshakeOptions, r as createServerHandshakeOptions } from '../handshake-a947c234.js';
7
- import { S as ServerTransport } from '../server-53cd5b7e.js';
8
- import '../index-ea74cdbb.js';
5
+ import { C as Connection, q as ServerHandshakeOptions, n as ServiceContext } from '../handshake-cdead82a.js';
6
+ export { r as ParsedMetadata, s as ServiceContextWithState, t as ServiceContextWithTransportInfo, u as createClientHandshakeOptions, v as createServerHandshakeOptions } from '../handshake-cdead82a.js';
7
+ import { S as ServerTransport } from '../server-2ef5e6ec.js';
8
+ import '../message-e6c560fd.js';
9
9
  import '@sinclair/typebox/value';
10
10
  import '@opentelemetry/api';
11
- import '../client-5776a6bb.js';
11
+ import '../client-ba0d3315.js';
12
12
  import '../types-3e5768ec.js';
13
13
 
14
14
  /**
@@ -17,10 +17,11 @@ import '../types-3e5768ec.js';
17
17
  */
18
18
  interface Server<Services extends AnyServiceSchemaMap> {
19
19
  services: InstantiatedServiceSchemaMap<Services>;
20
- streams: Map<string, ProcStream>;
20
+ streams: Map<StreamId, ProcStream>;
21
21
  }
22
+ type StreamId = string;
22
23
  interface ProcStream {
23
- id: string;
24
+ id: StreamId;
24
25
  serviceName: string;
25
26
  procedureName: string;
26
27
  incoming: Pushable<PayloadType>;
@@ -44,6 +45,6 @@ declare function createServer<Services extends AnyServiceSchemaMap>(transport: S
44
45
  extendedContext?: Omit<ServiceContext, 'state'>;
45
46
  }>): Server<Services>;
46
47
 
47
- var version = "0.23.18";
48
+ var version = "0.24.0";
48
49
 
49
50
  export { PayloadType, version as RIVER_VERSION, Result, RiverError, Server, ServiceContext, createServer };
@@ -1,14 +1,14 @@
1
- import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError } from '../services-38b3f758.js';
2
- export { C as Client, E as Err, O as Ok, z as Output, j as ProcErrors, f as ProcHandler, g as ProcInit, h as ProcInput, i as ProcOutput, k as ProcType, a as Procedure, p as ProcedureMap, d as ProcedureResult, q as RPCProcedure, y as ResultUnwrapErr, x as ResultUnwrapOk, w as RiverErrorSchema, c as RiverUncaughtSchema, o as SerializedProcedureSchema, m as SerializedServerSchema, n as SerializedServiceSchema, S as Service, e as ServiceConfiguration, l as ServiceSchema, t as StreamProcedure, r as SubscriptionProcedure, v as UNCAUGHT_ERROR, U as UploadProcedure, V as ValidProcType, u as createClient, s as serializeSchema } from '../services-38b3f758.js';
1
+ import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, P as PayloadType, b as Result, R as RiverError } from '../services-e1417b33.js';
2
+ export { C as Client, E as Err, O as Ok, z as Output, j as ProcErrors, f as ProcHandler, g as ProcInit, h as ProcInput, i as ProcOutput, k as ProcType, a as Procedure, p as ProcedureMap, d as ProcedureResult, q as RPCProcedure, y as ResultUnwrapErr, x as ResultUnwrapOk, w as RiverErrorSchema, c as RiverUncaughtSchema, o as SerializedProcedureSchema, m as SerializedServerSchema, n as SerializedServiceSchema, S as Service, e as ServiceConfiguration, l as ServiceSchema, t as StreamProcedure, r as SubscriptionProcedure, v as UNCAUGHT_ERROR, U as UploadProcedure, V as ValidProcType, u as createClient, s as serializeSchema } from '../services-e1417b33.js';
3
3
  import { Static } from '@sinclair/typebox';
4
4
  import { Pushable } from 'it-pushable';
5
- import { C as Connection, m as ServerHandshakeOptions, i as ServiceContext } from '../handshake-a947c234.js';
6
- export { n as ParsedMetadata, o as ServiceContextWithState, p as ServiceContextWithTransportInfo, q as createClientHandshakeOptions, r as createServerHandshakeOptions } from '../handshake-a947c234.js';
7
- import { S as ServerTransport } from '../server-53cd5b7e.js';
8
- import '../index-ea74cdbb.js';
5
+ import { C as Connection, q as ServerHandshakeOptions, n as ServiceContext } from '../handshake-cdead82a.js';
6
+ export { r as ParsedMetadata, s as ServiceContextWithState, t as ServiceContextWithTransportInfo, u as createClientHandshakeOptions, v as createServerHandshakeOptions } from '../handshake-cdead82a.js';
7
+ import { S as ServerTransport } from '../server-2ef5e6ec.js';
8
+ import '../message-e6c560fd.js';
9
9
  import '@sinclair/typebox/value';
10
10
  import '@opentelemetry/api';
11
- import '../client-5776a6bb.js';
11
+ import '../client-ba0d3315.js';
12
12
  import '../types-3e5768ec.js';
13
13
 
14
14
  /**
@@ -17,10 +17,11 @@ import '../types-3e5768ec.js';
17
17
  */
18
18
  interface Server<Services extends AnyServiceSchemaMap> {
19
19
  services: InstantiatedServiceSchemaMap<Services>;
20
- streams: Map<string, ProcStream>;
20
+ streams: Map<StreamId, ProcStream>;
21
21
  }
22
+ type StreamId = string;
22
23
  interface ProcStream {
23
- id: string;
24
+ id: StreamId;
24
25
  serviceName: string;
25
26
  procedureName: string;
26
27
  incoming: Pushable<PayloadType>;
@@ -44,6 +45,6 @@ declare function createServer<Services extends AnyServiceSchemaMap>(transport: S
44
45
  extendedContext?: Omit<ServiceContext, 'state'>;
45
46
  }>): Server<Services>;
46
47
 
47
- var version = "0.23.18";
48
+ var version = "0.24.0";
48
49
 
49
50
  export { PayloadType, version as RIVER_VERSION, Result, RiverError, Server, ServiceContext, createServer };
@@ -10,10 +10,10 @@ import {
10
10
  createServer,
11
11
  createServerHandshakeOptions,
12
12
  serializeSchema
13
- } from "../chunk-EV5HW4IC.js";
13
+ } from "../chunk-KYYB4DUR.js";
14
14
  import {
15
15
  version
16
- } from "../chunk-R2HAS3GM.js";
16
+ } from "../chunk-PJGGC3LV.js";
17
17
  export {
18
18
  Err,
19
19
  Ok,
@@ -0,0 +1,42 @@
1
+ import { C as Connection, w as CommonSession, d as SessionState, x as SessionHandshakingListeners, T as Transport, y as ServerTransportOptions, q as ServerHandshakeOptions, r as ParsedMetadata, c as ProvidedServerTransportOptions, S as Session } from './handshake-cdead82a.js';
2
+ import { M as MessageMetadata, a as TransportMessage, c as TransportClientId, P as PartialTransportMessage, b as OpaqueTransportMessage } from './message-e6c560fd.js';
3
+
4
+ declare class SessionWaitingForHandshake<ConnType extends Connection> extends CommonSession {
5
+ readonly state: SessionState.WaitingForHandshake;
6
+ conn: ConnType;
7
+ listeners: SessionHandshakingListeners;
8
+ handshakeTimeout?: ReturnType<typeof setTimeout>;
9
+ constructor(conn: ConnType, listeners: SessionHandshakingListeners, ...args: ConstructorParameters<typeof CommonSession>);
10
+ onHandshakeData: (msg: Uint8Array) => void;
11
+ get loggingMetadata(): MessageMetadata;
12
+ sendHandshake(msg: TransportMessage): boolean;
13
+ _handleStateExit(): void;
14
+ _handleClose(): void;
15
+ }
16
+
17
+ declare abstract class ServerTransport<ConnType extends Connection> extends Transport<ConnType> {
18
+ /**
19
+ * The options for this transport.
20
+ */
21
+ protected options: ServerTransportOptions;
22
+ /**
23
+ * Optional handshake options for the server.
24
+ */
25
+ handshakeExtensions?: ServerHandshakeOptions;
26
+ /**
27
+ * A map of session handshake data for each session.
28
+ */
29
+ sessionHandshakeMetadata: Map<string, ParsedMetadata>;
30
+ pendingSessions: Set<SessionWaitingForHandshake<ConnType>>;
31
+ constructor(clientId: TransportClientId, providedOptions?: ProvidedServerTransportOptions);
32
+ extendHandshake(options: ServerHandshakeOptions): void;
33
+ send(to: string, msg: PartialTransportMessage): string;
34
+ protected deletePendingSession(pendingSession: SessionWaitingForHandshake<ConnType>): void;
35
+ protected deleteSession(session: Session<ConnType>): void;
36
+ protected handleConnection(conn: ConnType): void;
37
+ private rejectHandshakeRequest;
38
+ protected onHandshakeRequest(session: SessionWaitingForHandshake<ConnType>, msg: OpaqueTransportMessage): Promise<void>;
39
+ private validateHandshakeMetadata;
40
+ }
41
+
42
+ export { ServerTransport as S, SessionWaitingForHandshake as a };
@@ -1,8 +1,8 @@
1
1
  import { Static, TObject, TUnion, TString, TSchema, TNever, TLiteral } from '@sinclair/typebox';
2
2
  import { Pushable } from 'it-pushable';
3
- import { C as Connection, k as ClientHandshakeOptions, p as ServiceContextWithTransportInfo, i as ServiceContext } from './handshake-a947c234.js';
4
- import { c as TransportClientId } from './index-ea74cdbb.js';
5
- import { C as ClientTransport } from './client-5776a6bb.js';
3
+ import { C as Connection, p as ClientHandshakeOptions, t as ServiceContextWithTransportInfo, n as ServiceContext } from './handshake-cdead82a.js';
4
+ import { c as TransportClientId } from './message-e6c560fd.js';
5
+ import { C as ClientTransport } from './client-ba0d3315.js';
6
6
 
7
7
  type AsyncIter<T> = AsyncGenerator<T, T>;
8
8
  /**