@replit/river 0.15.0 → 0.15.2

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 (35) hide show
  1. package/README.md +41 -22
  2. package/dist/{builder-ca6c4259.d.ts → builder-ebd945c0.d.ts} +1 -1
  3. package/dist/{chunk-IVNV5HBI.js → chunk-B7VTDQR7.js} +160 -51
  4. package/dist/{chunk-BSAIT634.js → chunk-UJHTHOTT.js} +1 -1
  5. package/dist/{chunk-FFT7PSUV.js → chunk-ZRB6IKPV.js} +1 -1
  6. package/dist/{connection-0c5eeb14.d.ts → connection-10a24478.d.ts} +1 -1
  7. package/dist/{connection-14675d77.d.ts → connection-f4492948.d.ts} +1 -1
  8. package/dist/{index-f922ec84.d.ts → index-bbccacef.d.ts} +90 -16
  9. package/dist/router/index.d.cts +3 -3
  10. package/dist/router/index.d.ts +3 -3
  11. package/dist/transport/impls/uds/client.cjs +206 -92
  12. package/dist/transport/impls/uds/client.d.cts +3 -3
  13. package/dist/transport/impls/uds/client.d.ts +3 -3
  14. package/dist/transport/impls/uds/client.js +2 -2
  15. package/dist/transport/impls/uds/server.cjs +75 -73
  16. package/dist/transport/impls/uds/server.d.cts +3 -3
  17. package/dist/transport/impls/uds/server.d.ts +3 -3
  18. package/dist/transport/impls/uds/server.js +2 -2
  19. package/dist/transport/impls/ws/client.cjs +206 -94
  20. package/dist/transport/impls/ws/client.d.cts +3 -3
  21. package/dist/transport/impls/ws/client.d.ts +3 -3
  22. package/dist/transport/impls/ws/client.js +2 -2
  23. package/dist/transport/impls/ws/server.cjs +75 -73
  24. package/dist/transport/impls/ws/server.d.cts +3 -3
  25. package/dist/transport/impls/ws/server.d.ts +3 -3
  26. package/dist/transport/impls/ws/server.js +2 -2
  27. package/dist/transport/index.cjs +211 -105
  28. package/dist/transport/index.d.cts +1 -1
  29. package/dist/transport/index.d.ts +1 -1
  30. package/dist/transport/index.js +3 -3
  31. package/dist/util/testHelpers.cjs +61 -64
  32. package/dist/util/testHelpers.d.cts +10 -4
  33. package/dist/util/testHelpers.d.ts +10 -4
  34. package/dist/util/testHelpers.js +13 -5
  35. package/package.json +1 -1
@@ -1,11 +1,11 @@
1
1
  import * as it_pushable from 'it-pushable';
2
+ import { C as Codec } from '../types-3e5768ec.js';
2
3
  import WebSocket from 'isomorphic-ws';
3
4
  import http from 'node:http';
4
- import { P as PartialTransportMessage, T as Transport, C as Connection, O as OpaqueTransportMessage } from '../index-f922ec84.js';
5
- import { P as PayloadType, R as RiverError, a as Procedure, S as ServiceContext, b as Result, c as RiverUncaughtSchema } from '../builder-ca6c4259.js';
5
+ import { P as PartialTransportMessage, T as Transport, C as Connection, O as OpaqueTransportMessage } from '../index-bbccacef.js';
6
+ import { P as PayloadType, R as RiverError, a as Procedure, S as ServiceContext, b as Result, c as RiverUncaughtSchema } from '../builder-ebd945c0.js';
6
7
  import { Static } from '@sinclair/typebox';
7
8
  import net from 'node:net';
8
- import '../types-3e5768ec.js';
9
9
 
10
10
  /**
11
11
  * Creates a WebSocket server instance using the provided HTTP server.
@@ -48,6 +48,12 @@ declare function createDummyTransportMessage(): PartialTransportMessage<{
48
48
  * @returns A promise that resolves with the payload of the first message that passes the filter.
49
49
  */
50
50
  declare function waitForMessage(t: Transport<Connection>, filter?: (msg: OpaqueTransportMessage) => boolean, rejectMismatch?: boolean): Promise<unknown>;
51
+ declare const testingSessionOptions: {
52
+ heartbeatIntervalMs: number;
53
+ heartbeatsUntilDead: number;
54
+ sessionDisconnectGraceMs: number;
55
+ codec: Codec;
56
+ };
51
57
  declare function asClientRpc<State extends object, I extends PayloadType, O extends PayloadType, E extends RiverError, Init extends PayloadType | null = null>(state: State, proc: Procedure<State, 'rpc', I, O, E, Init>, extendedContext?: Omit<ServiceContext, 'state'>): (msg: Static<I>) => Promise<Result<Static<O>, Static<E> | Static<typeof RiverUncaughtSchema>>>;
52
58
  declare function asClientStream<State extends object, I extends PayloadType, O extends PayloadType, E extends RiverError, Init extends PayloadType | null = null>(state: State, proc: Procedure<State, 'stream', I, O, E, Init>, init?: Init extends PayloadType ? Static<Init> : null, extendedContext?: Omit<ServiceContext, 'state'>): readonly [it_pushable.Pushable<Static<I>, void, unknown>, it_pushable.Pushable<Result<Static<O>, Static<E>>, void, unknown>];
53
59
  declare function asClientSubscription<State extends object, I extends PayloadType, O extends PayloadType, E extends RiverError>(state: State, proc: Procedure<State, 'subscription', I, O, E>, extendedContext?: Omit<ServiceContext, 'state'>): (msg: Static<I>) => it_pushable.Pushable<Result<Static<O>, Static<E>>, void, unknown>;
@@ -60,4 +66,4 @@ declare function asClientUpload<State extends object, I extends PayloadType, O e
60
66
  } | Result<Static<O>, Static<E>>>];
61
67
  declare const getUnixSocketPath: () => string;
62
68
 
63
- export { asClientRpc, asClientStream, asClientSubscription, asClientUpload, createDummyTransportMessage, createLocalWebSocketClient, createWebSocketServer, getUnixSocketPath, iterNext, onUdsServeReady, onWsServerReady, payloadToTransportMessage, waitForMessage };
69
+ export { asClientRpc, asClientStream, asClientSubscription, asClientUpload, createDummyTransportMessage, createLocalWebSocketClient, createWebSocketServer, getUnixSocketPath, iterNext, onUdsServeReady, onWsServerReady, payloadToTransportMessage, testingSessionOptions, waitForMessage };
@@ -4,14 +4,15 @@ import {
4
4
  } from "../chunk-KWXQLQAF.js";
5
5
  import "../chunk-RPIDSIQG.js";
6
6
  import {
7
- Session,
8
- defaultSessionOptions
9
- } from "../chunk-IVNV5HBI.js";
7
+ Session
8
+ } from "../chunk-B7VTDQR7.js";
10
9
  import {
11
10
  coerceErrorString
12
11
  } from "../chunk-GFRAOY75.js";
13
12
  import "../chunk-H4BYJELI.js";
14
- import "../chunk-GZ7HCLLM.js";
13
+ import {
14
+ NaiveJsonCodec
15
+ } from "../chunk-GZ7HCLLM.js";
15
16
 
16
17
  // util/testHelpers.ts
17
18
  import WebSocket from "isomorphic-ws";
@@ -85,12 +86,18 @@ function catchProcError(err) {
85
86
  }
86
87
  };
87
88
  }
89
+ var testingSessionOptions = {
90
+ heartbeatIntervalMs: 1e3,
91
+ heartbeatsUntilDead: 2,
92
+ sessionDisconnectGraceMs: 5e3,
93
+ codec: NaiveJsonCodec
94
+ };
88
95
  function dummyCtx(state, extendedContext) {
89
96
  const session = new Session(
90
97
  "client",
91
98
  "SERVER",
92
99
  void 0,
93
- defaultSessionOptions
100
+ testingSessionOptions
94
101
  );
95
102
  return {
96
103
  ...extendedContext,
@@ -161,5 +168,6 @@ export {
161
168
  onUdsServeReady,
162
169
  onWsServerReady,
163
170
  payloadToTransportMessage,
171
+ testingSessionOptions,
164
172
  waitForMessage
165
173
  };
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.15.0",
4
+ "version": "0.15.2",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {