@replit/river 0.214.0 → 0.215.1

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 (55) hide show
  1. package/dist/{adapter-DjiEwOYi.d.cts → adapter-CjgmjtUJ.d.cts} +3 -2
  2. package/dist/{adapter-Cp7_gIVA.d.ts → adapter-Dtt4bYL-.d.ts} +3 -2
  3. package/dist/{chunk-DRYCLL6N.js → chunk-3DDZCLJM.js} +182 -54
  4. package/dist/chunk-3DDZCLJM.js.map +1 -0
  5. package/dist/{chunk-LECVFB2G.js → chunk-NUGV5QWU.js} +15 -10
  6. package/dist/chunk-NUGV5QWU.js.map +1 -0
  7. package/dist/{client-DXJRow2s.d.cts → client-B9aKi9Li.d.cts} +2 -2
  8. package/dist/{client-Dw0JBBs3.d.ts → client-BOc8blGj.d.ts} +2 -2
  9. package/dist/codec/index.cjs.map +1 -1
  10. package/dist/codec/index.d.cts +3 -3
  11. package/dist/codec/index.d.ts +3 -3
  12. package/dist/codec/index.js +2 -2
  13. package/dist/{connection-Dzkqj18h.d.cts → connection-1hFoyxuX.d.cts} +3 -3
  14. package/dist/{connection-C2lYgRh0.d.ts → connection-DnMYvolf.d.ts} +3 -3
  15. package/dist/{index-D9R6UTMl.d.cts → index-Bf9PGbS4.d.cts} +1 -1
  16. package/dist/{index-CSM8soK7.d.ts → index-DiAq34gk.d.ts} +1 -1
  17. package/dist/logging/index.d.cts +2 -2
  18. package/dist/logging/index.d.ts +2 -2
  19. package/dist/{message-Dlsh5WDF.d.cts → message-DL74OqsX.d.cts} +12 -1
  20. package/dist/{message-Dlsh5WDF.d.ts → message-DL74OqsX.d.ts} +12 -1
  21. package/dist/router/index.cjs +14 -9
  22. package/dist/router/index.cjs.map +1 -1
  23. package/dist/router/index.d.cts +11 -11
  24. package/dist/router/index.d.ts +11 -11
  25. package/dist/router/index.js +1 -1
  26. package/dist/{server-BDSYa-CO.d.cts → server-BkEzDYIv.d.cts} +4 -4
  27. package/dist/{server-DFOzjvLh.d.ts → server-_bfE7LYc.d.ts} +4 -4
  28. package/dist/{services-D47_GPCH.d.ts → services-KdKBWdJr.d.ts} +4 -4
  29. package/dist/{services-DqYQvm_L.d.cts → services-zaansuuR.d.cts} +4 -4
  30. package/dist/testUtil/index.cjs +183 -53
  31. package/dist/testUtil/index.cjs.map +1 -1
  32. package/dist/testUtil/index.d.cts +7 -7
  33. package/dist/testUtil/index.d.ts +7 -7
  34. package/dist/testUtil/index.js +4 -2
  35. package/dist/testUtil/index.js.map +1 -1
  36. package/dist/transport/impls/ws/client.cjs +170 -53
  37. package/dist/transport/impls/ws/client.cjs.map +1 -1
  38. package/dist/transport/impls/ws/client.d.cts +6 -6
  39. package/dist/transport/impls/ws/client.d.ts +6 -6
  40. package/dist/transport/impls/ws/client.js +2 -2
  41. package/dist/transport/impls/ws/server.cjs +133 -53
  42. package/dist/transport/impls/ws/server.cjs.map +1 -1
  43. package/dist/transport/impls/ws/server.d.cts +6 -6
  44. package/dist/transport/impls/ws/server.d.ts +6 -6
  45. package/dist/transport/impls/ws/server.js +2 -2
  46. package/dist/transport/index.cjs +181 -53
  47. package/dist/transport/index.cjs.map +1 -1
  48. package/dist/transport/index.d.cts +7 -7
  49. package/dist/transport/index.d.ts +7 -7
  50. package/dist/transport/index.js +2 -2
  51. package/dist/{transport-pdbkDzmJ.d.ts → transport-CCBNESLA.d.cts} +72 -65
  52. package/dist/{transport-CxT7y8Qk.d.cts → transport-kW92H6x-.d.ts} +72 -65
  53. package/package.json +1 -1
  54. package/dist/chunk-DRYCLL6N.js.map +0 -1
  55. package/dist/chunk-LECVFB2G.js.map +0 -1
@@ -1,14 +1,14 @@
1
- import { A as AnyServiceSchemaMap, M as MaybeDisposable, P as ProcedureHandlerContext, a as PayloadType, I as InstantiatedServiceSchemaMap, b as AnyProcedure } from '../services-DqYQvm_L.cjs';
2
- export { J as BaseErrorSchemaType, G as CANCEL_CODE, L as Client, N as Err, T as ErrResult, F as INVALID_REQUEST_CODE, O as Ok, X as OkResult, h as ProcErrors, d as ProcHandler, e as ProcInit, f as ProcRequest, g as ProcResponse, i as ProcType, z as Procedure, B as ProcedureErrorSchemaType, r as ProcedureMap, R as RPCProcedure, y as RawReadable, v as Readable, x as ReadableBrokenError, w as ReadableResult, H as ReaderErrorSchema, _ as ResponseData, Q as Result, Z as ResultUnwrapErr, Y as ResultUnwrapOk, m as SerializedProcedureSchema, q as SerializedProcedureSchemaProtocolv1, k as SerializedServerSchema, o as SerializedServerSchemaProtocolv1, l as SerializedServiceSchema, p as SerializedServiceSchemaProtocolv1, S as Service, c as ServiceConfiguration, u as StreamProcedure, t as SubscriptionProcedure, D as UNCAUGHT_ERROR_CODE, E as UNEXPECTED_DISCONNECT_CODE, U as UploadProcedure, V as ValidProcType, W as Writable, K as createClient, j as createServiceSchema, C as flattenErrorType, s as serializeSchema, n as serializeSchemaV1Compat } from '../services-DqYQvm_L.cjs';
3
- import { TSchema, Static } from '@sinclair/typebox';
4
- import { c as TransportClientId, b as OpaqueTransportMessage } from '../message-Dlsh5WDF.cjs';
5
- import { C as Connection, q as ServerHandshakeOptions } from '../transport-CxT7y8Qk.cjs';
6
- export { r as createClientHandshakeOptions, s as createServerHandshakeOptions } from '../transport-CxT7y8Qk.cjs';
7
- import { S as ServerTransport } from '../server-BDSYa-CO.cjs';
1
+ import { P as ProcedureHandlerContext, a as PayloadType, M as MaybeDisposable, A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, b as AnyProcedure } from '../services-zaansuuR.cjs';
2
+ export { B as BaseErrorSchemaType, C as CANCEL_CODE, c as Client, E as Err, d as ErrResult, e as INVALID_REQUEST_CODE, O as Ok, f as OkResult, g as ProcErrors, h as ProcHandler, i as ProcInit, j as ProcRequest, k as ProcResponse, l as ProcType, m as Procedure, n as ProcedureErrorSchemaType, o as ProcedureMap, R as RPCProcedure, p as RawReadable, q as Readable, r as ReadableBrokenError, s as ReadableResult, t as ReaderErrorSchema, u as ResponseData, v as Result, w as ResultUnwrapErr, x as ResultUnwrapOk, S as SerializedProcedureSchema, y as SerializedProcedureSchemaProtocolv1, z as SerializedServerSchema, D as SerializedServerSchemaProtocolv1, F as SerializedServiceSchema, G as SerializedServiceSchemaProtocolv1, H as Service, J as ServiceConfiguration, K as StreamProcedure, L as SubscriptionProcedure, U as UNCAUGHT_ERROR_CODE, N as UNEXPECTED_DISCONNECT_CODE, Q as UploadProcedure, V as ValidProcType, W as Writable, T as createClient, X as createServiceSchema, Y as flattenErrorType, Z as serializeSchema, _ as serializeSchemaV1Compat } from '../services-zaansuuR.cjs';
3
+ import { Static, TSchema } from '@sinclair/typebox';
4
+ import { T as TransportClientId, O as OpaqueTransportMessage } from '../message-DL74OqsX.cjs';
5
+ import { C as Connection, q as ServerHandshakeOptions } from '../transport-CCBNESLA.cjs';
6
+ export { r as createClientHandshakeOptions, s as createServerHandshakeOptions } from '../transport-CCBNESLA.cjs';
7
+ import { S as ServerTransport } from '../server-BkEzDYIv.cjs';
8
8
  import '@opentelemetry/api';
9
- import '../client-DXJRow2s.cjs';
10
- import '../index-D9R6UTMl.cjs';
11
- import '../adapter-DjiEwOYi.cjs';
9
+ import '../client-B9aKi9Li.cjs';
10
+ import '../index-Bf9PGbS4.cjs';
11
+ import '../adapter-CjgmjtUJ.cjs';
12
12
 
13
13
  type StreamId = string;
14
14
  /**
@@ -74,6 +74,6 @@ declare function createServer<MetadataSchema extends TSchema, ParsedMetadata ext
74
74
  middlewares?: Array<Middleware>;
75
75
  }>): Server<Context, ParsedMetadata, Services>;
76
76
 
77
- var version = "0.214.0";
77
+ var version = "0.215.1";
78
78
 
79
79
  export { MaybeDisposable, type Middleware, type MiddlewareContext, type MiddlewareParam, PayloadType, ProcedureHandlerContext, version as RIVER_VERSION, type Server, createServer };
@@ -1,14 +1,14 @@
1
- import { A as AnyServiceSchemaMap, M as MaybeDisposable, P as ProcedureHandlerContext, a as PayloadType, I as InstantiatedServiceSchemaMap, b as AnyProcedure } from '../services-D47_GPCH.js';
2
- export { J as BaseErrorSchemaType, G as CANCEL_CODE, L as Client, N as Err, T as ErrResult, F as INVALID_REQUEST_CODE, O as Ok, X as OkResult, h as ProcErrors, d as ProcHandler, e as ProcInit, f as ProcRequest, g as ProcResponse, i as ProcType, z as Procedure, B as ProcedureErrorSchemaType, r as ProcedureMap, R as RPCProcedure, y as RawReadable, v as Readable, x as ReadableBrokenError, w as ReadableResult, H as ReaderErrorSchema, _ as ResponseData, Q as Result, Z as ResultUnwrapErr, Y as ResultUnwrapOk, m as SerializedProcedureSchema, q as SerializedProcedureSchemaProtocolv1, k as SerializedServerSchema, o as SerializedServerSchemaProtocolv1, l as SerializedServiceSchema, p as SerializedServiceSchemaProtocolv1, S as Service, c as ServiceConfiguration, u as StreamProcedure, t as SubscriptionProcedure, D as UNCAUGHT_ERROR_CODE, E as UNEXPECTED_DISCONNECT_CODE, U as UploadProcedure, V as ValidProcType, W as Writable, K as createClient, j as createServiceSchema, C as flattenErrorType, s as serializeSchema, n as serializeSchemaV1Compat } from '../services-D47_GPCH.js';
3
- import { TSchema, Static } from '@sinclair/typebox';
4
- import { c as TransportClientId, b as OpaqueTransportMessage } from '../message-Dlsh5WDF.js';
5
- import { C as Connection, q as ServerHandshakeOptions } from '../transport-pdbkDzmJ.js';
6
- export { r as createClientHandshakeOptions, s as createServerHandshakeOptions } from '../transport-pdbkDzmJ.js';
7
- import { S as ServerTransport } from '../server-DFOzjvLh.js';
1
+ import { P as ProcedureHandlerContext, a as PayloadType, M as MaybeDisposable, A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, b as AnyProcedure } from '../services-KdKBWdJr.js';
2
+ export { B as BaseErrorSchemaType, C as CANCEL_CODE, c as Client, E as Err, d as ErrResult, e as INVALID_REQUEST_CODE, O as Ok, f as OkResult, g as ProcErrors, h as ProcHandler, i as ProcInit, j as ProcRequest, k as ProcResponse, l as ProcType, m as Procedure, n as ProcedureErrorSchemaType, o as ProcedureMap, R as RPCProcedure, p as RawReadable, q as Readable, r as ReadableBrokenError, s as ReadableResult, t as ReaderErrorSchema, u as ResponseData, v as Result, w as ResultUnwrapErr, x as ResultUnwrapOk, S as SerializedProcedureSchema, y as SerializedProcedureSchemaProtocolv1, z as SerializedServerSchema, D as SerializedServerSchemaProtocolv1, F as SerializedServiceSchema, G as SerializedServiceSchemaProtocolv1, H as Service, J as ServiceConfiguration, K as StreamProcedure, L as SubscriptionProcedure, U as UNCAUGHT_ERROR_CODE, N as UNEXPECTED_DISCONNECT_CODE, Q as UploadProcedure, V as ValidProcType, W as Writable, T as createClient, X as createServiceSchema, Y as flattenErrorType, Z as serializeSchema, _ as serializeSchemaV1Compat } from '../services-KdKBWdJr.js';
3
+ import { Static, TSchema } from '@sinclair/typebox';
4
+ import { T as TransportClientId, O as OpaqueTransportMessage } from '../message-DL74OqsX.js';
5
+ import { C as Connection, q as ServerHandshakeOptions } from '../transport-kW92H6x-.js';
6
+ export { r as createClientHandshakeOptions, s as createServerHandshakeOptions } from '../transport-kW92H6x-.js';
7
+ import { S as ServerTransport } from '../server-_bfE7LYc.js';
8
8
  import '@opentelemetry/api';
9
- import '../client-Dw0JBBs3.js';
10
- import '../index-CSM8soK7.js';
11
- import '../adapter-Cp7_gIVA.js';
9
+ import '../client-BOc8blGj.js';
10
+ import '../index-DiAq34gk.js';
11
+ import '../adapter-Dtt4bYL-.js';
12
12
 
13
13
  type StreamId = string;
14
14
  /**
@@ -74,6 +74,6 @@ declare function createServer<MetadataSchema extends TSchema, ParsedMetadata ext
74
74
  middlewares?: Array<Middleware>;
75
75
  }>): Server<Context, ParsedMetadata, Services>;
76
76
 
77
- var version = "0.214.0";
77
+ var version = "0.215.1";
78
78
 
79
79
  export { MaybeDisposable, type Middleware, type MiddlewareContext, type MiddlewareParam, PayloadType, ProcedureHandlerContext, version as RIVER_VERSION, type Server, createServer };
@@ -18,7 +18,7 @@ import {
18
18
  serializeSchema,
19
19
  serializeSchemaV1Compat,
20
20
  version
21
- } from "../chunk-LECVFB2G.js";
21
+ } from "../chunk-NUGV5QWU.js";
22
22
  export {
23
23
  CANCEL_CODE,
24
24
  Err,
@@ -1,8 +1,8 @@
1
- import { C as Connection, t as CommonSession, d as SessionState, u as CommonSessionProps, T as Transport, v as ServerTransportOptions, q as ServerHandshakeOptions, w as ServerSession, c as ProvidedServerTransportOptions, D as DeleteSessionOptions } from './transport-CxT7y8Qk.cjs';
2
- import { b as OpaqueTransportMessage, H as HandshakeErrorResponseCodes, P as ProtocolVersion, a as TransportMessage, c as TransportClientId } from './message-Dlsh5WDF.cjs';
1
+ import { C as Connection, t as CommonSession, j as SessionState, u as CommonSessionProps, T as Transport, v as ServerTransportOptions, q as ServerHandshakeOptions, w as ServerSession, e as ProvidedServerTransportOptions, D as DeleteSessionOptions } from './transport-CCBNESLA.cjs';
2
+ import { O as OpaqueTransportMessage, H as HandshakeErrorResponseCodes, P as ProtocolVersion, b as TransportMessage, T as TransportClientId } from './message-DL74OqsX.cjs';
3
3
  import { Static, TSchema } from '@sinclair/typebox';
4
- import { T as Tags } from './index-D9R6UTMl.cjs';
5
- import { S as SendResult } from './adapter-DjiEwOYi.cjs';
4
+ import { T as Tags } from './index-Bf9PGbS4.cjs';
5
+ import { S as SendResult } from './adapter-CjgmjtUJ.cjs';
6
6
 
7
7
  interface SessionWaitingForHandshakeListeners {
8
8
  onConnectionErrored: (err: unknown) => void;
@@ -1,8 +1,8 @@
1
- import { C as Connection, t as CommonSession, d as SessionState, u as CommonSessionProps, T as Transport, v as ServerTransportOptions, q as ServerHandshakeOptions, w as ServerSession, c as ProvidedServerTransportOptions, D as DeleteSessionOptions } from './transport-pdbkDzmJ.js';
2
- import { b as OpaqueTransportMessage, H as HandshakeErrorResponseCodes, P as ProtocolVersion, a as TransportMessage, c as TransportClientId } from './message-Dlsh5WDF.js';
1
+ import { C as Connection, t as CommonSession, j as SessionState, u as CommonSessionProps, T as Transport, v as ServerTransportOptions, q as ServerHandshakeOptions, w as ServerSession, e as ProvidedServerTransportOptions, D as DeleteSessionOptions } from './transport-kW92H6x-.js';
2
+ import { O as OpaqueTransportMessage, H as HandshakeErrorResponseCodes, P as ProtocolVersion, b as TransportMessage, T as TransportClientId } from './message-DL74OqsX.js';
3
3
  import { Static, TSchema } from '@sinclair/typebox';
4
- import { T as Tags } from './index-CSM8soK7.js';
5
- import { S as SendResult } from './adapter-Cp7_gIVA.js';
4
+ import { T as Tags } from './index-DiAq34gk.js';
5
+ import { S as SendResult } from './adapter-Dtt4bYL-.js';
6
6
 
7
7
  interface SessionWaitingForHandshakeListeners {
8
8
  onConnectionErrored: (err: unknown) => void;
@@ -1,9 +1,9 @@
1
1
  import * as _sinclair_typebox from '@sinclair/typebox';
2
2
  import { TObject, TLiteral, TEnum, TString, TSchema, TNever, TUnion, Static } from '@sinclair/typebox';
3
3
  import { Span } from '@opentelemetry/api';
4
- import { c as TransportClientId } from './message-Dlsh5WDF.js';
5
- import { C as Connection, n as ClientHandshakeOptions, z as SessionId } from './transport-pdbkDzmJ.js';
6
- import { C as ClientTransport } from './client-Dw0JBBs3.js';
4
+ import { T as TransportClientId } from './message-DL74OqsX.js';
5
+ import { C as Connection, n as ClientHandshakeOptions, z as SessionId } from './transport-kW92H6x-.js';
6
+ import { C as ClientTransport } from './client-BOc8blGj.js';
7
7
 
8
8
  /**
9
9
  * {@link UNCAUGHT_ERROR_CODE} is the code that is used when an error is thrown
@@ -1111,4 +1111,4 @@ declare class ServiceScaffold<Context extends MaybeDisposable, State extends obj
1111
1111
  };
1112
1112
  }
1113
1113
 
1114
- export { type ReadableIterator as $, type AnyServiceSchemaMap as A, type ProcedureErrorSchemaType as B, flattenErrorType as C, UNCAUGHT_ERROR_CODE as D, UNEXPECTED_DISCONNECT_CODE as E, INVALID_REQUEST_CODE as F, CANCEL_CODE as G, ReaderErrorSchema as H, type InstantiatedServiceSchemaMap as I, type BaseErrorSchemaType as J, createClient as K, type Client as L, type MaybeDisposable as M, Err as N, Ok as O, type ProcedureHandlerContext as P, type Result as Q, type RpcProcedure as R, type Service as S, type ErrResult as T, type UploadProcedure as U, type ValidProcType as V, type Writable as W, type OkResult as X, type ResultUnwrapOk as Y, type ResultUnwrapErr as Z, type ResponseData as _, type PayloadType as a, type AnyProcedure as b, type ServiceConfiguration as c, type ProcHandler as d, type ProcInit as e, type ProcRequest as f, type ProcResponse as g, type ProcErrors as h, type ProcType as i, createServiceSchema as j, type SerializedServerSchema as k, type SerializedServiceSchema as l, type SerializedProcedureSchema as m, serializeSchemaV1Compat as n, type SerializedServerSchemaProtocolv1 as o, type SerializedServiceSchemaProtocolv1 as p, type SerializedProcedureSchemaProtocolv1 as q, type ProcedureMap as r, serializeSchema as s, type SubscriptionProcedure as t, type StreamProcedure as u, type Readable as v, type ReadableResult as w, ReadableBrokenError as x, ReadableImpl as y, Procedure as z };
1114
+ export { type ReadableIterator as $, type AnyServiceSchemaMap as A, type BaseErrorSchemaType as B, CANCEL_CODE as C, type SerializedServerSchemaProtocolv1 as D, Err as E, type SerializedServiceSchema as F, type SerializedServiceSchemaProtocolv1 as G, type Service as H, type InstantiatedServiceSchemaMap as I, type ServiceConfiguration as J, type StreamProcedure as K, type SubscriptionProcedure as L, type MaybeDisposable as M, UNEXPECTED_DISCONNECT_CODE as N, Ok as O, type ProcedureHandlerContext as P, type UploadProcedure as Q, type RpcProcedure as R, type SerializedProcedureSchema as S, createClient as T, UNCAUGHT_ERROR_CODE as U, type ValidProcType as V, type Writable as W, createServiceSchema as X, flattenErrorType as Y, serializeSchema as Z, serializeSchemaV1Compat as _, type PayloadType as a, type AnyProcedure as b, type Client as c, type ErrResult as d, INVALID_REQUEST_CODE as e, type OkResult as f, type ProcErrors as g, type ProcHandler as h, type ProcInit as i, type ProcRequest as j, type ProcResponse as k, type ProcType as l, Procedure as m, type ProcedureErrorSchemaType as n, type ProcedureMap as o, ReadableImpl as p, type Readable as q, ReadableBrokenError as r, type ReadableResult as s, ReaderErrorSchema as t, type ResponseData as u, type Result as v, type ResultUnwrapErr as w, type ResultUnwrapOk as x, type SerializedProcedureSchemaProtocolv1 as y, type SerializedServerSchema as z };
@@ -1,9 +1,9 @@
1
1
  import * as _sinclair_typebox from '@sinclair/typebox';
2
2
  import { TObject, TLiteral, TEnum, TString, TSchema, TNever, TUnion, Static } from '@sinclair/typebox';
3
3
  import { Span } from '@opentelemetry/api';
4
- import { c as TransportClientId } from './message-Dlsh5WDF.cjs';
5
- import { C as Connection, n as ClientHandshakeOptions, z as SessionId } from './transport-CxT7y8Qk.cjs';
6
- import { C as ClientTransport } from './client-DXJRow2s.cjs';
4
+ import { T as TransportClientId } from './message-DL74OqsX.cjs';
5
+ import { C as Connection, n as ClientHandshakeOptions, z as SessionId } from './transport-CCBNESLA.cjs';
6
+ import { C as ClientTransport } from './client-B9aKi9Li.cjs';
7
7
 
8
8
  /**
9
9
  * {@link UNCAUGHT_ERROR_CODE} is the code that is used when an error is thrown
@@ -1111,4 +1111,4 @@ declare class ServiceScaffold<Context extends MaybeDisposable, State extends obj
1111
1111
  };
1112
1112
  }
1113
1113
 
1114
- export { type ReadableIterator as $, type AnyServiceSchemaMap as A, type ProcedureErrorSchemaType as B, flattenErrorType as C, UNCAUGHT_ERROR_CODE as D, UNEXPECTED_DISCONNECT_CODE as E, INVALID_REQUEST_CODE as F, CANCEL_CODE as G, ReaderErrorSchema as H, type InstantiatedServiceSchemaMap as I, type BaseErrorSchemaType as J, createClient as K, type Client as L, type MaybeDisposable as M, Err as N, Ok as O, type ProcedureHandlerContext as P, type Result as Q, type RpcProcedure as R, type Service as S, type ErrResult as T, type UploadProcedure as U, type ValidProcType as V, type Writable as W, type OkResult as X, type ResultUnwrapOk as Y, type ResultUnwrapErr as Z, type ResponseData as _, type PayloadType as a, type AnyProcedure as b, type ServiceConfiguration as c, type ProcHandler as d, type ProcInit as e, type ProcRequest as f, type ProcResponse as g, type ProcErrors as h, type ProcType as i, createServiceSchema as j, type SerializedServerSchema as k, type SerializedServiceSchema as l, type SerializedProcedureSchema as m, serializeSchemaV1Compat as n, type SerializedServerSchemaProtocolv1 as o, type SerializedServiceSchemaProtocolv1 as p, type SerializedProcedureSchemaProtocolv1 as q, type ProcedureMap as r, serializeSchema as s, type SubscriptionProcedure as t, type StreamProcedure as u, type Readable as v, type ReadableResult as w, ReadableBrokenError as x, ReadableImpl as y, Procedure as z };
1114
+ export { type ReadableIterator as $, type AnyServiceSchemaMap as A, type BaseErrorSchemaType as B, CANCEL_CODE as C, type SerializedServerSchemaProtocolv1 as D, Err as E, type SerializedServiceSchema as F, type SerializedServiceSchemaProtocolv1 as G, type Service as H, type InstantiatedServiceSchemaMap as I, type ServiceConfiguration as J, type StreamProcedure as K, type SubscriptionProcedure as L, type MaybeDisposable as M, UNEXPECTED_DISCONNECT_CODE as N, Ok as O, type ProcedureHandlerContext as P, type UploadProcedure as Q, type RpcProcedure as R, type SerializedProcedureSchema as S, createClient as T, UNCAUGHT_ERROR_CODE as U, type ValidProcType as V, type Writable as W, createServiceSchema as X, flattenErrorType as Y, serializeSchema as Z, serializeSchemaV1Compat as _, type PayloadType as a, type AnyProcedure as b, type Client as c, type ErrResult as d, INVALID_REQUEST_CODE as e, type OkResult as f, type ProcErrors as g, type ProcHandler as h, type ProcInit as i, type ProcRequest as j, type ProcResponse as k, type ProcType as l, Procedure as m, type ProcedureErrorSchemaType as n, type ProcedureMap as o, ReadableImpl as p, type Readable as q, ReadableBrokenError as r, type ReadableResult as s, ReaderErrorSchema as t, type ResponseData as u, type Result as v, type ResultUnwrapErr as w, type ResultUnwrapOk as x, type SerializedProcedureSchemaProtocolv1 as y, type SerializedServerSchema as z };
@@ -360,6 +360,7 @@ var IdentifiedSession = class extends CommonSession {
360
360
  telemetry;
361
361
  to;
362
362
  protocolVersion;
363
+ listeners;
363
364
  /**
364
365
  * Index of the message we will send next (excluding handshake)
365
366
  */
@@ -383,7 +384,8 @@ var IdentifiedSession = class extends CommonSession {
383
384
  telemetry,
384
385
  log,
385
386
  protocolVersion,
386
- seqSent: messagesSent
387
+ seqSent: messagesSent,
388
+ listeners
387
389
  } = props;
388
390
  super(props);
389
391
  this.id = id;
@@ -395,6 +397,7 @@ var IdentifiedSession = class extends CommonSession {
395
397
  this.log = log;
396
398
  this.protocolVersion = protocolVersion;
397
399
  this.seqSent = messagesSent;
400
+ this.listeners = listeners;
398
401
  }
399
402
  get loggingMetadata() {
400
403
  const metadata = {
@@ -411,7 +414,7 @@ var IdentifiedSession = class extends CommonSession {
411
414
  }
412
415
  return metadata;
413
416
  }
414
- constructMsg(partialMsg) {
417
+ encodeMsg(partialMsg) {
415
418
  const msg = {
416
419
  ...partialMsg,
417
420
  id: generateId(),
@@ -420,18 +423,37 @@ var IdentifiedSession = class extends CommonSession {
420
423
  seq: this.seq,
421
424
  ack: this.ack
422
425
  };
426
+ const encoded = this.codec.toBuffer(msg);
427
+ if (!encoded.ok) {
428
+ this.listeners.onMessageSendFailure(
429
+ { ...partialMsg, seq: this.seq },
430
+ encoded.reason
431
+ );
432
+ return encoded;
433
+ }
423
434
  this.seq++;
424
- return msg;
435
+ return {
436
+ ok: true,
437
+ value: {
438
+ id: msg.id,
439
+ seq: msg.seq,
440
+ msg: partialMsg,
441
+ data: encoded.value
442
+ }
443
+ };
425
444
  }
426
445
  nextSeq() {
427
446
  return this.sendBuffer.length > 0 ? this.sendBuffer[0].seq : this.seq;
428
447
  }
429
448
  send(msg) {
430
- const constructedMsg = this.constructMsg(msg);
431
- this.sendBuffer.push(constructedMsg);
449
+ const encodeResult = this.encodeMsg(msg);
450
+ if (!encodeResult.ok) {
451
+ return encodeResult;
452
+ }
453
+ this.sendBuffer.push(encodeResult.value);
432
454
  return {
433
455
  ok: true,
434
- value: constructedMsg.id
456
+ value: encodeResult.value.id
435
457
  };
436
458
  }
437
459
  _handleStateExit() {
@@ -464,23 +486,6 @@ var IdentifiedSessionWithGracePeriod = class extends IdentifiedSession {
464
486
  super._handleClose();
465
487
  }
466
488
  };
467
- function sendMessage(conn, codec, msg) {
468
- const buff = codec.toBuffer(msg);
469
- if (!buff.ok) {
470
- return buff;
471
- }
472
- const sent = conn.send(buff.value);
473
- if (!sent) {
474
- return {
475
- ok: false,
476
- reason: "failed to send message"
477
- };
478
- }
479
- return {
480
- ok: true,
481
- value: msg.id
482
- };
483
- }
484
489
 
485
490
  // transport/sessionStateMachine/SessionConnecting.ts
486
491
  var SessionConnecting = class extends IdentifiedSessionWithGracePeriod {
@@ -559,7 +564,7 @@ function coerceErrorString(err) {
559
564
  }
560
565
 
561
566
  // package.json
562
- var version = "0.214.0";
567
+ var version = "0.215.1";
563
568
 
564
569
  // tracing/index.ts
565
570
  function getPropagationContext(ctx) {
@@ -642,7 +647,21 @@ var SessionWaitingForHandshake = class extends CommonSession {
642
647
  this.listeners.onHandshake(parsedMsgRes.value);
643
648
  };
644
649
  sendHandshake(msg) {
645
- return sendMessage(this.conn, this.codec, msg);
650
+ const buff = this.codec.toBuffer(msg);
651
+ if (!buff.ok) {
652
+ return buff;
653
+ }
654
+ const sent = this.conn.send(buff.value);
655
+ if (!sent) {
656
+ return {
657
+ ok: false,
658
+ reason: "failed to send handshake"
659
+ };
660
+ }
661
+ return {
662
+ ok: true,
663
+ value: msg.id
664
+ };
646
665
  }
647
666
  _handleStateExit() {
648
667
  this.conn.removeDataListener();
@@ -691,7 +710,21 @@ var SessionHandshaking = class extends IdentifiedSessionWithGracePeriod {
691
710
  this.listeners.onHandshake(parsedMsgRes.value);
692
711
  };
693
712
  sendHandshake(msg) {
694
- return sendMessage(this.conn, this.codec, msg);
713
+ const buff = this.codec.toBuffer(msg);
714
+ if (!buff.ok) {
715
+ return buff;
716
+ }
717
+ const sent = this.conn.send(buff.value);
718
+ if (!sent) {
719
+ return {
720
+ ok: false,
721
+ reason: "failed to send handshake"
722
+ };
723
+ }
724
+ return {
725
+ ok: true,
726
+ value: msg.id
727
+ };
695
728
  }
696
729
  _handleStateExit() {
697
730
  super._handleStateExit();
@@ -726,28 +759,35 @@ var SessionConnected = class extends IdentifiedSession {
726
759
  }
727
760
  this.startMissingHeartbeatTimeout();
728
761
  }
729
- assertSendOrdering(constructedMsg) {
730
- if (constructedMsg.seq > this.seqSent + 1) {
731
- const msg = `invariant violation: would have sent out of order msg (seq: ${constructedMsg.seq}, expected: ${this.seqSent} + 1)`;
762
+ assertSendOrdering(encodedMsg) {
763
+ if (encodedMsg.seq > this.seqSent + 1) {
764
+ const msg = `invariant violation: would have sent out of order msg (seq: ${encodedMsg.seq}, expected: ${this.seqSent} + 1)`;
732
765
  this.log?.error(msg, {
733
766
  ...this.loggingMetadata,
734
- transportMessage: constructedMsg,
735
767
  tags: ["invariant-violation"]
736
768
  });
737
769
  throw new Error(msg);
738
770
  }
739
771
  }
740
772
  send(msg) {
741
- const constructedMsg = this.constructMsg(msg);
742
- this.assertSendOrdering(constructedMsg);
743
- this.sendBuffer.push(constructedMsg);
744
- const res = sendMessage(this.conn, this.codec, constructedMsg);
745
- if (!res.ok) {
746
- this.listeners.onMessageSendFailure(constructedMsg, res.reason);
747
- return res;
773
+ const encodeResult = this.encodeMsg(msg);
774
+ if (!encodeResult.ok) {
775
+ return encodeResult;
776
+ }
777
+ const encodedMsg = encodeResult.value;
778
+ this.assertSendOrdering(encodedMsg);
779
+ this.sendBuffer.push(encodedMsg);
780
+ const sent = this.conn.send(encodedMsg.data);
781
+ if (!sent) {
782
+ const reason = "failed to send message";
783
+ this.listeners.onMessageSendFailure(
784
+ { ...encodedMsg.msg, seq: encodedMsg.seq },
785
+ reason
786
+ );
787
+ return { ok: false, reason };
748
788
  }
749
- this.seqSent = constructedMsg.seq;
750
- return res;
789
+ this.seqSent = encodedMsg.seq;
790
+ return { ok: true, value: encodedMsg.id };
751
791
  }
752
792
  constructor(props) {
753
793
  super(props);
@@ -765,10 +805,14 @@ var SessionConnected = class extends IdentifiedSession {
765
805
  );
766
806
  for (const msg of this.sendBuffer) {
767
807
  this.assertSendOrdering(msg);
768
- const res = sendMessage(this.conn, this.codec, msg);
769
- if (!res.ok) {
770
- this.listeners.onMessageSendFailure(msg, res.reason);
771
- return res;
808
+ const sent = this.conn.send(msg.data);
809
+ if (!sent) {
810
+ const reason = "failed to send buffered message";
811
+ this.listeners.onMessageSendFailure(
812
+ { ...msg.msg, seq: msg.seq },
813
+ reason
814
+ );
815
+ return { ok: false, reason };
772
816
  }
773
817
  this.seqSent = msg.seq;
774
818
  }
@@ -1176,6 +1220,17 @@ var Transport = class {
1176
1220
  const noConnectionSession = SessionStateGraph.transition.ConnectingToNoConnection(session, {
1177
1221
  onSessionGracePeriodElapsed: () => {
1178
1222
  this.onSessionGracePeriodElapsed(noConnectionSession);
1223
+ },
1224
+ onMessageSendFailure: (msg, reason) => {
1225
+ this.log?.error(`failed to send message: ${reason}`, {
1226
+ ...noConnectionSession.loggingMetadata,
1227
+ transportMessage: msg
1228
+ });
1229
+ this.protocolError({
1230
+ type: ProtocolError.MessageSendFailure,
1231
+ message: reason
1232
+ });
1233
+ this.deleteSession(noConnectionSession, { unhealthy: true });
1179
1234
  }
1180
1235
  });
1181
1236
  this.updateSession(noConnectionSession);
@@ -1183,18 +1238,32 @@ var Transport = class {
1183
1238
  }
1184
1239
  onConnClosed(session) {
1185
1240
  let noConnectionSession;
1241
+ const listeners = {
1242
+ onSessionGracePeriodElapsed: () => {
1243
+ this.onSessionGracePeriodElapsed(noConnectionSession);
1244
+ },
1245
+ onMessageSendFailure: (msg, reason) => {
1246
+ this.log?.error(`failed to send message: ${reason}`, {
1247
+ ...noConnectionSession.loggingMetadata,
1248
+ transportMessage: msg
1249
+ });
1250
+ this.protocolError({
1251
+ type: ProtocolError.MessageSendFailure,
1252
+ message: reason
1253
+ });
1254
+ this.deleteSession(noConnectionSession, { unhealthy: true });
1255
+ }
1256
+ };
1186
1257
  if (session.state === "Handshaking" /* Handshaking */) {
1187
- noConnectionSession = SessionStateGraph.transition.HandshakingToNoConnection(session, {
1188
- onSessionGracePeriodElapsed: () => {
1189
- this.onSessionGracePeriodElapsed(noConnectionSession);
1190
- }
1191
- });
1258
+ noConnectionSession = SessionStateGraph.transition.HandshakingToNoConnection(
1259
+ session,
1260
+ listeners
1261
+ );
1192
1262
  } else {
1193
- noConnectionSession = SessionStateGraph.transition.ConnectedToNoConnection(session, {
1194
- onSessionGracePeriodElapsed: () => {
1195
- this.onSessionGracePeriodElapsed(noConnectionSession);
1196
- }
1197
- });
1263
+ noConnectionSession = SessionStateGraph.transition.ConnectedToNoConnection(
1264
+ session,
1265
+ listeners
1266
+ );
1198
1267
  }
1199
1268
  this.updateSession(noConnectionSession);
1200
1269
  return noConnectionSession;
@@ -1298,6 +1367,10 @@ var LeakyBucketRateLimit = class {
1298
1367
  clearInterval(this.intervalHandle);
1299
1368
  this.intervalHandle = void 0;
1300
1369
  }
1370
+ resetBudget() {
1371
+ this.stopLeak();
1372
+ this.budgetConsumed = 0;
1373
+ }
1301
1374
  close() {
1302
1375
  this.stopLeak();
1303
1376
  }
@@ -1355,6 +1428,17 @@ var ClientTransport = class extends Transport {
1355
1428
  {
1356
1429
  onSessionGracePeriodElapsed: () => {
1357
1430
  this.onSessionGracePeriodElapsed(session);
1431
+ },
1432
+ onMessageSendFailure: (msg, reason) => {
1433
+ this.log?.error(`failed to send message: ${reason}`, {
1434
+ ...session.loggingMetadata,
1435
+ transportMessage: msg
1436
+ });
1437
+ this.protocolError({
1438
+ type: ProtocolError.MessageSendFailure,
1439
+ message: reason
1440
+ });
1441
+ this.deleteSession(session, { unhealthy: true });
1358
1442
  }
1359
1443
  },
1360
1444
  this.options,
@@ -1419,6 +1503,17 @@ var ClientTransport = class extends Transport {
1419
1503
  },
1420
1504
  onSessionGracePeriodElapsed: () => {
1421
1505
  this.onSessionGracePeriodElapsed(handshakingSession);
1506
+ },
1507
+ onMessageSendFailure: (msg, reason) => {
1508
+ this.log?.error(`failed to send message: ${reason}`, {
1509
+ ...handshakingSession.loggingMetadata,
1510
+ transportMessage: msg
1511
+ });
1512
+ this.protocolError({
1513
+ type: ProtocolError.MessageSendFailure,
1514
+ message: reason
1515
+ });
1516
+ this.deleteSession(handshakingSession, { unhealthy: true });
1422
1517
  }
1423
1518
  }
1424
1519
  );
@@ -1580,6 +1675,17 @@ var ClientTransport = class extends Transport {
1580
1675
  },
1581
1676
  onSessionGracePeriodElapsed: () => {
1582
1677
  this.onSessionGracePeriodElapsed(backingOffSession);
1678
+ },
1679
+ onMessageSendFailure: (msg, reason) => {
1680
+ this.log?.error(`failed to send message: ${reason}`, {
1681
+ ...backingOffSession.loggingMetadata,
1682
+ transportMessage: msg
1683
+ });
1684
+ this.protocolError({
1685
+ type: ProtocolError.MessageSendFailure,
1686
+ message: reason
1687
+ });
1688
+ this.deleteSession(backingOffSession, { unhealthy: true });
1583
1689
  }
1584
1690
  }
1585
1691
  );
@@ -1643,6 +1749,17 @@ var ClientTransport = class extends Transport {
1643
1749
  },
1644
1750
  onSessionGracePeriodElapsed: () => {
1645
1751
  this.onSessionGracePeriodElapsed(connectingSession);
1752
+ },
1753
+ onMessageSendFailure: (msg, reason) => {
1754
+ this.log?.error(`failed to send message: ${reason}`, {
1755
+ ...connectingSession.loggingMetadata,
1756
+ transportMessage: msg
1757
+ });
1758
+ this.protocolError({
1759
+ type: ProtocolError.MessageSendFailure,
1760
+ message: reason
1761
+ });
1762
+ this.deleteSession(connectingSession, { unhealthy: true });
1646
1763
  }
1647
1764
  }
1648
1765
  );
@@ -1973,6 +2090,17 @@ var ServerTransport = class extends Transport {
1973
2090
  {
1974
2091
  onSessionGracePeriodElapsed: () => {
1975
2092
  this.onSessionGracePeriodElapsed(noConnectionSession);
2093
+ },
2094
+ onMessageSendFailure: (msg2, reason) => {
2095
+ this.log?.error(`failed to send message: ${reason}`, {
2096
+ ...noConnectionSession.loggingMetadata,
2097
+ transportMessage: msg2
2098
+ });
2099
+ this.protocolError({
2100
+ type: ProtocolError.MessageSendFailure,
2101
+ message: reason
2102
+ });
2103
+ this.deleteSession(noConnectionSession, { unhealthy: true });
1976
2104
  }
1977
2105
  }
1978
2106
  );
@@ -2823,6 +2951,8 @@ function dummySession() {
2823
2951
  "server",
2824
2952
  {
2825
2953
  onSessionGracePeriodElapsed: () => {
2954
+ },
2955
+ onMessageSendFailure: () => {
2826
2956
  }
2827
2957
  },
2828
2958
  testingSessionOptions,