@replit/river 0.207.2 → 0.207.3

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 (56) hide show
  1. package/dist/adapter-f2b6e211.d.ts +46 -0
  2. package/dist/{chunk-4HE7UYRL.js → chunk-B7REV3ZV.js} +6 -5
  3. package/dist/{chunk-4HE7UYRL.js.map → chunk-B7REV3ZV.js.map} +1 -1
  4. package/dist/{chunk-24EWYOGK.js → chunk-BO7MFCO6.js} +1136 -143
  5. package/dist/chunk-BO7MFCO6.js.map +1 -0
  6. package/dist/{chunk-46IVOKJU.js → chunk-QGPYCXV4.js} +2 -2
  7. package/dist/{chunk-46IVOKJU.js.map → chunk-QGPYCXV4.js.map} +1 -1
  8. package/dist/codec/index.cjs +157 -23
  9. package/dist/codec/index.cjs.map +1 -1
  10. package/dist/codec/index.d.cts +5 -1
  11. package/dist/codec/index.d.ts +5 -1
  12. package/dist/codec/index.js +6 -20
  13. package/dist/codec/index.js.map +1 -1
  14. package/dist/{connection-a18e31d5.d.ts → connection-06d72f2e.d.ts} +3 -2
  15. package/dist/index-02554794.d.ts +37 -0
  16. package/dist/logging/index.d.cts +2 -1
  17. package/dist/logging/index.d.ts +2 -1
  18. package/dist/{message-ffacb98a.d.ts → message-01c3e85a.d.ts} +1 -35
  19. package/dist/router/index.cjs +1 -1
  20. package/dist/router/index.cjs.map +1 -1
  21. package/dist/router/index.d.cts +6 -5
  22. package/dist/router/index.d.ts +6 -5
  23. package/dist/router/index.js +1 -1
  24. package/dist/{services-43528f4b.d.ts → services-87887bc5.d.ts} +16 -12
  25. package/dist/testUtil/index.cjs +809 -657
  26. package/dist/testUtil/index.cjs.map +1 -1
  27. package/dist/testUtil/index.d.cts +4 -3
  28. package/dist/testUtil/index.d.ts +4 -3
  29. package/dist/testUtil/index.js +18 -13
  30. package/dist/testUtil/index.js.map +1 -1
  31. package/dist/transport/impls/ws/client.cjs +293 -204
  32. package/dist/transport/impls/ws/client.cjs.map +1 -1
  33. package/dist/transport/impls/ws/client.d.cts +5 -4
  34. package/dist/transport/impls/ws/client.d.ts +5 -4
  35. package/dist/transport/impls/ws/client.js +5 -7
  36. package/dist/transport/impls/ws/client.js.map +1 -1
  37. package/dist/transport/impls/ws/server.cjs +230 -128
  38. package/dist/transport/impls/ws/server.cjs.map +1 -1
  39. package/dist/transport/impls/ws/server.d.cts +5 -4
  40. package/dist/transport/impls/ws/server.d.ts +5 -4
  41. package/dist/transport/impls/ws/server.js +5 -7
  42. package/dist/transport/impls/ws/server.js.map +1 -1
  43. package/dist/transport/index.cjs +408 -270
  44. package/dist/transport/index.cjs.map +1 -1
  45. package/dist/transport/index.d.cts +7 -6
  46. package/dist/transport/index.d.ts +7 -6
  47. package/dist/transport/index.js +4 -9
  48. package/package.json +1 -1
  49. package/dist/chunk-24EWYOGK.js.map +0 -1
  50. package/dist/chunk-A7RGOVRV.js +0 -438
  51. package/dist/chunk-A7RGOVRV.js.map +0 -1
  52. package/dist/chunk-AJGIY2UB.js +0 -56
  53. package/dist/chunk-AJGIY2UB.js.map +0 -1
  54. package/dist/chunk-XV4RQ62N.js +0 -377
  55. package/dist/chunk-XV4RQ62N.js.map +0 -1
  56. package/dist/types-3e5768ec.d.ts +0 -20
@@ -1,10 +1,11 @@
1
- import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, c as ParsedMetadata, d as AnyProcedure, b as Connection, S as ServerHandshakeOptions, e as ServiceContext } from '../services-43528f4b.js';
2
- export { M as BaseErrorSchemaType, K as CANCEL_CODE, O as Client, X as Err, Z as ErrResult, J as INVALID_REQUEST_CODE, T as Ok, _ as OkResult, w as PayloadType, l as ProcErrors, h as ProcHandler, i as ProcInit, j as ProcRequest, k as ProcResponse, m as ProcType, D as Procedure, E as ProcedureErrorSchemaType, Q as ProcedureHandlerContext, x as ProcedureMap, R as RPCProcedure, B as Readable, L as ReaderErrorSchema, a1 as ResponseData, Y as Result, a0 as ResultUnwrapErr, $ as ResultUnwrapOk, q as SerializedProcedureSchema, v as SerializedProcedureSchemaProtocolv1, o as SerializedServerSchema, t as SerializedServerSchemaProtocolv1, p as SerializedServiceSchema, u as SerializedServiceSchemaProtocolv1, f as Service, g as ServiceConfiguration, n as ServiceSchema, z as StreamProcedure, y as SubscriptionProcedure, G as UNCAUGHT_ERROR_CODE, H as UNEXPECTED_DISCONNECT_CODE, U as UploadProcedure, V as ValidProcType, W as Writable, N as createClient, a2 as createClientHandshakeOptions, a3 as createServerHandshakeOptions, F as flattenErrorType, s as serializeSchema, r as serializeSchemaV1Compat } from '../services-43528f4b.js';
3
- import { T as TransportClientId, O as OpaqueTransportMessage } from '../message-ffacb98a.js';
1
+ import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, c as ParsedMetadata, d as AnyProcedure, b as Connection, S as ServerHandshakeOptions, e as ServiceContext } from '../services-87887bc5.js';
2
+ export { M as BaseErrorSchemaType, K as CANCEL_CODE, O as Client, X as Err, Z as ErrResult, J as INVALID_REQUEST_CODE, T as Ok, _ as OkResult, w as PayloadType, l as ProcErrors, h as ProcHandler, i as ProcInit, j as ProcRequest, k as ProcResponse, m as ProcType, D as Procedure, E as ProcedureErrorSchemaType, Q as ProcedureHandlerContext, x as ProcedureMap, R as RPCProcedure, B as Readable, L as ReaderErrorSchema, a1 as ResponseData, Y as Result, a0 as ResultUnwrapErr, $ as ResultUnwrapOk, q as SerializedProcedureSchema, v as SerializedProcedureSchemaProtocolv1, o as SerializedServerSchema, t as SerializedServerSchemaProtocolv1, p as SerializedServiceSchema, u as SerializedServiceSchemaProtocolv1, f as Service, g as ServiceConfiguration, n as ServiceSchema, z as StreamProcedure, y as SubscriptionProcedure, G as UNCAUGHT_ERROR_CODE, H as UNEXPECTED_DISCONNECT_CODE, U as UploadProcedure, V as ValidProcType, W as Writable, N as createClient, a2 as createClientHandshakeOptions, a3 as createServerHandshakeOptions, F as flattenErrorType, s as serializeSchema, r as serializeSchemaV1Compat } from '../services-87887bc5.js';
3
+ import { T as TransportClientId, O as OpaqueTransportMessage } from '../message-01c3e85a.js';
4
4
  import { ServerTransport } from '../transport/index.cjs';
5
5
  import '@sinclair/typebox';
6
6
  import '@opentelemetry/api';
7
- import '../types-3e5768ec.js';
7
+ import '../index-02554794.js';
8
+ import '../adapter-f2b6e211.js';
8
9
 
9
10
  type StreamId = string;
10
11
  /**
@@ -51,6 +52,6 @@ declare function createServer<Services extends AnyServiceSchemaMap>(transport: S
51
52
  maxCancelledStreamTombstonesPerSession?: number;
52
53
  }>): Server<Services>;
53
54
 
54
- var version = "0.207.2";
55
+ var version = "0.207.3";
55
56
 
56
57
  export { ParsedMetadata, version as RIVER_VERSION, Server, ServiceContext, createServer };
@@ -1,10 +1,11 @@
1
- import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, c as ParsedMetadata, d as AnyProcedure, b as Connection, S as ServerHandshakeOptions, e as ServiceContext } from '../services-43528f4b.js';
2
- export { M as BaseErrorSchemaType, K as CANCEL_CODE, O as Client, X as Err, Z as ErrResult, J as INVALID_REQUEST_CODE, T as Ok, _ as OkResult, w as PayloadType, l as ProcErrors, h as ProcHandler, i as ProcInit, j as ProcRequest, k as ProcResponse, m as ProcType, D as Procedure, E as ProcedureErrorSchemaType, Q as ProcedureHandlerContext, x as ProcedureMap, R as RPCProcedure, B as Readable, L as ReaderErrorSchema, a1 as ResponseData, Y as Result, a0 as ResultUnwrapErr, $ as ResultUnwrapOk, q as SerializedProcedureSchema, v as SerializedProcedureSchemaProtocolv1, o as SerializedServerSchema, t as SerializedServerSchemaProtocolv1, p as SerializedServiceSchema, u as SerializedServiceSchemaProtocolv1, f as Service, g as ServiceConfiguration, n as ServiceSchema, z as StreamProcedure, y as SubscriptionProcedure, G as UNCAUGHT_ERROR_CODE, H as UNEXPECTED_DISCONNECT_CODE, U as UploadProcedure, V as ValidProcType, W as Writable, N as createClient, a2 as createClientHandshakeOptions, a3 as createServerHandshakeOptions, F as flattenErrorType, s as serializeSchema, r as serializeSchemaV1Compat } from '../services-43528f4b.js';
3
- import { T as TransportClientId, O as OpaqueTransportMessage } from '../message-ffacb98a.js';
1
+ import { A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, c as ParsedMetadata, d as AnyProcedure, b as Connection, S as ServerHandshakeOptions, e as ServiceContext } from '../services-87887bc5.js';
2
+ export { M as BaseErrorSchemaType, K as CANCEL_CODE, O as Client, X as Err, Z as ErrResult, J as INVALID_REQUEST_CODE, T as Ok, _ as OkResult, w as PayloadType, l as ProcErrors, h as ProcHandler, i as ProcInit, j as ProcRequest, k as ProcResponse, m as ProcType, D as Procedure, E as ProcedureErrorSchemaType, Q as ProcedureHandlerContext, x as ProcedureMap, R as RPCProcedure, B as Readable, L as ReaderErrorSchema, a1 as ResponseData, Y as Result, a0 as ResultUnwrapErr, $ as ResultUnwrapOk, q as SerializedProcedureSchema, v as SerializedProcedureSchemaProtocolv1, o as SerializedServerSchema, t as SerializedServerSchemaProtocolv1, p as SerializedServiceSchema, u as SerializedServiceSchemaProtocolv1, f as Service, g as ServiceConfiguration, n as ServiceSchema, z as StreamProcedure, y as SubscriptionProcedure, G as UNCAUGHT_ERROR_CODE, H as UNEXPECTED_DISCONNECT_CODE, U as UploadProcedure, V as ValidProcType, W as Writable, N as createClient, a2 as createClientHandshakeOptions, a3 as createServerHandshakeOptions, F as flattenErrorType, s as serializeSchema, r as serializeSchemaV1Compat } from '../services-87887bc5.js';
3
+ import { T as TransportClientId, O as OpaqueTransportMessage } from '../message-01c3e85a.js';
4
4
  import { ServerTransport } from '../transport/index.js';
5
5
  import '@sinclair/typebox';
6
6
  import '@opentelemetry/api';
7
- import '../types-3e5768ec.js';
7
+ import '../index-02554794.js';
8
+ import '../adapter-f2b6e211.js';
8
9
 
9
10
  type StreamId = string;
10
11
  /**
@@ -51,6 +52,6 @@ declare function createServer<Services extends AnyServiceSchemaMap>(transport: S
51
52
  maxCancelledStreamTombstonesPerSession?: number;
52
53
  }>): Server<Services>;
53
54
 
54
- var version = "0.207.2";
55
+ var version = "0.207.3";
55
56
 
56
57
  export { ParsedMetadata, version as RIVER_VERSION, Server, ServiceContext, createServer };
@@ -16,7 +16,7 @@ import {
16
16
  serializeSchema,
17
17
  serializeSchemaV1Compat,
18
18
  version
19
- } from "../chunk-46IVOKJU.js";
19
+ } from "../chunk-QGPYCXV4.js";
20
20
  export {
21
21
  CANCEL_CODE,
22
22
  Err,
@@ -1,8 +1,9 @@
1
1
  import * as _sinclair_typebox from '@sinclair/typebox';
2
2
  import { Static, TSchema, TObject, TString, TUnion, TLiteral, TNever } from '@sinclair/typebox';
3
3
  import { Tracer, Span } from '@opentelemetry/api';
4
- import { c as TelemetryInfo, M as MessageMetadata, T as TransportClientId, L as Logger, O as OpaqueTransportMessage, P as ProtocolVersion, b as PartialTransportMessage, d as TransportMessage, a as Tags, H as HandshakeErrorResponseCodes, e as LogFn, f as LoggingLevel, g as HandshakeErrorCustomHandlerFatalResponseCodes } from './message-ffacb98a.js';
5
- import { C as Codec } from './types-3e5768ec.js';
4
+ import { b as TelemetryInfo, T as TransportClientId, P as ProtocolVersion, O as OpaqueTransportMessage, a as PartialTransportMessage, c as TransportMessage, H as HandshakeErrorResponseCodes, d as HandshakeErrorCustomHandlerFatalResponseCodes } from './message-01c3e85a.js';
5
+ import { M as MessageMetadata, L as Logger, T as Tags, a as LogFn, b as LoggingLevel } from './index-02554794.js';
6
+ import { C as Codec, a as CodecMessageAdapter, S as SendResult, b as SendBufferResult } from './adapter-f2b6e211.js';
6
7
 
7
8
  /**
8
9
  * A connection is the actual raw underlying transport connection.
@@ -124,17 +125,18 @@ interface SessionOptions {
124
125
  interface CommonSessionProps {
125
126
  from: TransportClientId;
126
127
  options: SessionOptions;
128
+ codec: CodecMessageAdapter;
127
129
  tracer: Tracer;
128
130
  log: Logger | undefined;
129
131
  }
130
132
  declare abstract class CommonSession extends StateMachineState {
131
133
  readonly from: TransportClientId;
132
134
  readonly options: SessionOptions;
135
+ readonly codec: CodecMessageAdapter;
133
136
  tracer: Tracer;
134
137
  log?: Logger;
135
138
  abstract get loggingMetadata(): MessageMetadata;
136
- constructor({ from, options, log, tracer }: CommonSessionProps);
137
- parseMsg(msg: Uint8Array): OpaqueTransportMessage | null;
139
+ constructor({ from, options, log, tracer, codec }: CommonSessionProps);
138
140
  }
139
141
  type SessionId = string;
140
142
  interface IdentifiedSessionProps extends CommonSessionProps {
@@ -169,7 +171,7 @@ declare abstract class IdentifiedSession extends CommonSession {
169
171
  get loggingMetadata(): MessageMetadata;
170
172
  constructMsg<Payload>(partialMsg: PartialTransportMessage<Payload>): TransportMessage<Payload>;
171
173
  nextSeq(): number;
172
- send(msg: PartialTransportMessage): string;
174
+ send(msg: PartialTransportMessage): SendResult;
173
175
  _handleStateExit(): void;
174
176
  _handleClose(): void;
175
177
  }
@@ -251,7 +253,7 @@ declare class SessionHandshaking<ConnType extends Connection> extends Identified
251
253
  extras?: Record<string, unknown> | undefined;
252
254
  };
253
255
  onHandshakeData: (msg: Uint8Array) => void;
254
- sendHandshake(msg: TransportMessage): boolean;
256
+ sendHandshake(msg: TransportMessage): SendResult;
255
257
  _handleStateExit(): void;
256
258
  _handleClose(): void;
257
259
  }
@@ -260,6 +262,7 @@ interface SessionConnectedListeners {
260
262
  onConnectionErrored: (err: unknown) => void;
261
263
  onConnectionClosed: () => void;
262
264
  onMessage: (msg: OpaqueTransportMessage) => void;
265
+ onMessageSendFailure: (msg: PartialTransportMessage, reason: string) => void;
263
266
  onInvalidMessage: (reason: string) => void;
264
267
  }
265
268
  interface SessionConnectedProps<ConnType extends Connection> extends IdentifiedSessionProps {
@@ -271,14 +274,13 @@ declare class SessionConnected<ConnType extends Connection> extends IdentifiedSe
271
274
  conn: ConnType;
272
275
  listeners: SessionConnectedListeners;
273
276
  private heartbeatHandle?;
274
- private heartbeatMisses;
275
- isActivelyHeartbeating: boolean;
276
- private lastConstructedMsgs;
277
- private pushLastConstructedMsgs;
277
+ private heartbeatMissTimeout?;
278
+ private isActivelyHeartbeating;
278
279
  updateBookkeeping(ack: number, seq: number): void;
279
280
  private assertSendOrdering;
280
- send(msg: PartialTransportMessage): string;
281
+ send(msg: PartialTransportMessage): SendResult;
281
282
  constructor(props: SessionConnectedProps<ConnType>);
283
+ sendBufferedMessages(): SendBufferResult;
282
284
  get loggingMetadata(): {
283
285
  protocolVersion?: ProtocolVersion | undefined;
284
286
  clientId?: string | undefined;
@@ -297,6 +299,7 @@ declare class SessionConnected<ConnType extends Connection> extends IdentifiedSe
297
299
  } | undefined;
298
300
  extras?: Record<string, unknown> | undefined;
299
301
  };
302
+ startMissingHeartbeatTimeout(): void;
300
303
  startActiveHeartbeat(): void;
301
304
  private sendHeartbeat;
302
305
  onMessageData: (msg: Uint8Array) => void;
@@ -329,6 +332,7 @@ declare const ProtocolError: {
329
332
  readonly HandshakeFailed: "handshake_failed";
330
333
  readonly MessageOrderingViolated: "message_ordering_violated";
331
334
  readonly InvalidMessage: "invalid_message";
335
+ readonly MessageSendFailure: "message_send_failure";
332
336
  };
333
337
  type ProtocolErrorType = (typeof ProtocolError)[keyof typeof ProtocolError];
334
338
  interface EventMap {
@@ -447,7 +451,7 @@ type TransportStatus = 'open' | 'closed';
447
451
  interface DeleteSessionOptions {
448
452
  unhealthy: boolean;
449
453
  }
450
- type SessionBoundSendFn = (msg: PartialTransportMessage) => string | undefined;
454
+ type SessionBoundSendFn = (msg: PartialTransportMessage) => string;
451
455
  /**
452
456
  * Transports manage the lifecycle (creation/deletion) of sessions
453
457
  *