@replit/river 0.215.1 → 0.216.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 (70) hide show
  1. package/README.md +47 -0
  2. package/dist/{adapter-Dtt4bYL-.d.ts → adapter-BXCk-dmy.d.ts} +3 -21
  3. package/dist/{adapter-CjgmjtUJ.d.cts → adapter-D5X11kmP.d.cts} +3 -21
  4. package/dist/{chunk-3DDZCLJM.js → chunk-75ZMPCKC.js} +22 -6
  5. package/dist/{chunk-3DDZCLJM.js.map → chunk-75ZMPCKC.js.map} +1 -1
  6. package/dist/chunk-SHND2JG6.js +86 -0
  7. package/dist/chunk-SHND2JG6.js.map +1 -0
  8. package/dist/{chunk-NUGV5QWU.js → chunk-ZLMQQI43.js} +12 -2
  9. package/dist/chunk-ZLMQQI43.js.map +1 -0
  10. package/dist/{client-BOc8blGj.d.ts → client-BNc5Pj_4.d.ts} +2 -2
  11. package/dist/{client-B9aKi9Li.d.cts → client-BZUvFL6B.d.cts} +2 -2
  12. package/dist/codec/index.cjs.map +1 -1
  13. package/dist/codec/index.d.cts +3 -3
  14. package/dist/codec/index.d.ts +3 -3
  15. package/dist/codec/index.js +2 -2
  16. package/dist/{connection-DnMYvolf.d.ts → connection-ou9w2dSY.d.ts} +3 -3
  17. package/dist/{connection-1hFoyxuX.d.cts → connection-xxgJHs2o.d.cts} +3 -3
  18. package/dist/{index-Bf9PGbS4.d.cts → index-BAGGleT3.d.cts} +1 -1
  19. package/dist/{index-DiAq34gk.d.ts → index-ZWkoesQD.d.ts} +1 -1
  20. package/dist/logging/index.d.cts +2 -2
  21. package/dist/logging/index.d.ts +2 -2
  22. package/dist/{message-DL74OqsX.d.cts → message-CpXWqmJw.d.cts} +1 -1
  23. package/dist/{message-DL74OqsX.d.ts → message-CpXWqmJw.d.ts} +1 -1
  24. package/dist/protobuf/codec.cjs +107 -0
  25. package/dist/protobuf/codec.cjs.map +1 -0
  26. package/dist/protobuf/codec.d.cts +13 -0
  27. package/dist/protobuf/codec.d.ts +13 -0
  28. package/dist/protobuf/codec.js +7 -0
  29. package/dist/protobuf/codec.js.map +1 -0
  30. package/dist/protobuf/index.cjs +1877 -0
  31. package/dist/protobuf/index.cjs.map +1 -0
  32. package/dist/protobuf/index.d.cts +488 -0
  33. package/dist/protobuf/index.d.ts +488 -0
  34. package/dist/protobuf/index.js +1260 -0
  35. package/dist/protobuf/index.js.map +1 -0
  36. package/dist/router/index.cjs +1 -1
  37. package/dist/router/index.cjs.map +1 -1
  38. package/dist/router/index.d.cts +11 -10
  39. package/dist/router/index.d.ts +11 -10
  40. package/dist/router/index.js +1 -1
  41. package/dist/{server-_bfE7LYc.d.ts → server-BPu7Td80.d.ts} +4 -4
  42. package/dist/{server-BkEzDYIv.d.cts → server-JdnoVO11.d.cts} +4 -4
  43. package/dist/{services-KdKBWdJr.d.ts → services-BrTFTO5Q.d.ts} +104 -93
  44. package/dist/{services-zaansuuR.d.cts → services-cwGAC2rB.d.cts} +104 -93
  45. package/dist/testUtil/index.cjs +21 -5
  46. package/dist/testUtil/index.cjs.map +1 -1
  47. package/dist/testUtil/index.d.cts +8 -7
  48. package/dist/testUtil/index.d.ts +8 -7
  49. package/dist/testUtil/index.js +2 -2
  50. package/dist/transport/impls/ws/client.cjs +1 -1
  51. package/dist/transport/impls/ws/client.cjs.map +1 -1
  52. package/dist/transport/impls/ws/client.d.cts +7 -6
  53. package/dist/transport/impls/ws/client.d.ts +7 -6
  54. package/dist/transport/impls/ws/client.js +2 -2
  55. package/dist/transport/impls/ws/server.cjs +21 -5
  56. package/dist/transport/impls/ws/server.cjs.map +1 -1
  57. package/dist/transport/impls/ws/server.d.cts +7 -6
  58. package/dist/transport/impls/ws/server.d.ts +7 -6
  59. package/dist/transport/impls/ws/server.js +2 -2
  60. package/dist/transport/index.cjs +21 -5
  61. package/dist/transport/index.cjs.map +1 -1
  62. package/dist/transport/index.d.cts +8 -7
  63. package/dist/transport/index.d.ts +8 -7
  64. package/dist/transport/index.js +2 -2
  65. package/dist/{transport-CCBNESLA.d.cts → transport-B1MUtXL7.d.ts} +5 -4
  66. package/dist/{transport-kW92H6x-.d.ts → transport-BnU3Zb0Q.d.cts} +5 -4
  67. package/dist/types-BGGvYIJM.d.cts +20 -0
  68. package/dist/types-BGGvYIJM.d.ts +20 -0
  69. package/package.json +12 -1
  70. package/dist/chunk-NUGV5QWU.js.map +0 -1
@@ -1,14 +1,15 @@
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';
1
+ import { P as ProcedureHandlerContext, a as PayloadType, M as MaybeDisposable, A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, b as AnyProcedure } from '../services-cwGAC2rB.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-cwGAC2rB.cjs';
3
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';
4
+ import { T as TransportClientId, O as OpaqueTransportMessage } from '../message-CpXWqmJw.cjs';
5
+ import { C as Connection, q as ServerHandshakeOptions } from '../transport-BnU3Zb0Q.cjs';
6
+ export { r as createClientHandshakeOptions, s as createServerHandshakeOptions } from '../transport-BnU3Zb0Q.cjs';
7
+ import { S as ServerTransport } from '../server-JdnoVO11.cjs';
8
8
  import '@opentelemetry/api';
9
- import '../client-B9aKi9Li.cjs';
10
- import '../index-Bf9PGbS4.cjs';
11
- import '../adapter-CjgmjtUJ.cjs';
9
+ import '../client-BZUvFL6B.cjs';
10
+ import '../index-BAGGleT3.cjs';
11
+ import '../types-BGGvYIJM.cjs';
12
+ import '../adapter-D5X11kmP.cjs';
12
13
 
13
14
  type StreamId = string;
14
15
  /**
@@ -74,6 +75,6 @@ declare function createServer<MetadataSchema extends TSchema, ParsedMetadata ext
74
75
  middlewares?: Array<Middleware>;
75
76
  }>): Server<Context, ParsedMetadata, Services>;
76
77
 
77
- var version = "0.215.1";
78
+ var version = "0.216.0";
78
79
 
79
80
  export { MaybeDisposable, type Middleware, type MiddlewareContext, type MiddlewareParam, PayloadType, ProcedureHandlerContext, version as RIVER_VERSION, type Server, createServer };
@@ -1,14 +1,15 @@
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';
1
+ import { P as ProcedureHandlerContext, a as PayloadType, M as MaybeDisposable, A as AnyServiceSchemaMap, I as InstantiatedServiceSchemaMap, b as AnyProcedure } from '../services-BrTFTO5Q.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-BrTFTO5Q.js';
3
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';
4
+ import { T as TransportClientId, O as OpaqueTransportMessage } from '../message-CpXWqmJw.js';
5
+ import { C as Connection, q as ServerHandshakeOptions } from '../transport-B1MUtXL7.js';
6
+ export { r as createClientHandshakeOptions, s as createServerHandshakeOptions } from '../transport-B1MUtXL7.js';
7
+ import { S as ServerTransport } from '../server-BPu7Td80.js';
8
8
  import '@opentelemetry/api';
9
- import '../client-BOc8blGj.js';
10
- import '../index-DiAq34gk.js';
11
- import '../adapter-Dtt4bYL-.js';
9
+ import '../client-BNc5Pj_4.js';
10
+ import '../index-ZWkoesQD.js';
11
+ import '../types-BGGvYIJM.js';
12
+ import '../adapter-BXCk-dmy.js';
12
13
 
13
14
  type StreamId = string;
14
15
  /**
@@ -74,6 +75,6 @@ declare function createServer<MetadataSchema extends TSchema, ParsedMetadata ext
74
75
  middlewares?: Array<Middleware>;
75
76
  }>): Server<Context, ParsedMetadata, Services>;
76
77
 
77
- var version = "0.215.1";
78
+ var version = "0.216.0";
78
79
 
79
80
  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-NUGV5QWU.js";
21
+ } from "../chunk-ZLMQQI43.js";
22
22
  export {
23
23
  CANCEL_CODE,
24
24
  Err,
@@ -1,8 +1,8 @@
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';
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-B1MUtXL7.js';
2
+ import { O as OpaqueTransportMessage, H as HandshakeErrorResponseCodes, P as ProtocolVersion, b as TransportMessage, T as TransportClientId } from './message-CpXWqmJw.js';
3
3
  import { Static, TSchema } from '@sinclair/typebox';
4
- import { T as Tags } from './index-DiAq34gk.js';
5
- import { S as SendResult } from './adapter-Dtt4bYL-.js';
4
+ import { T as Tags } from './index-ZWkoesQD.js';
5
+ import { S as SendResult } from './adapter-BXCk-dmy.js';
6
6
 
7
7
  interface SessionWaitingForHandshakeListeners {
8
8
  onConnectionErrored: (err: unknown) => void;
@@ -1,8 +1,8 @@
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';
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-BnU3Zb0Q.cjs';
2
+ import { O as OpaqueTransportMessage, H as HandshakeErrorResponseCodes, P as ProtocolVersion, b as TransportMessage, T as TransportClientId } from './message-CpXWqmJw.cjs';
3
3
  import { Static, TSchema } from '@sinclair/typebox';
4
- import { T as Tags } from './index-Bf9PGbS4.cjs';
5
- import { S as SendResult } from './adapter-CjgmjtUJ.cjs';
4
+ import { T as Tags } from './index-BAGGleT3.cjs';
5
+ import { S as SendResult } from './adapter-D5X11kmP.cjs';
6
6
 
7
7
  interface SessionWaitingForHandshakeListeners {
8
8
  onConnectionErrored: (err: unknown) => void;
@@ -1,91 +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 { 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
-
8
- /**
9
- * {@link UNCAUGHT_ERROR_CODE} is the code that is used when an error is thrown
10
- * inside a procedure handler that's not required.
11
- */
12
- declare const UNCAUGHT_ERROR_CODE = "UNCAUGHT_ERROR";
13
- /**
14
- * {@link UNEXPECTED_DISCONNECT_CODE} is the code used the stream's session
15
- * disconnect unexpetedly.
16
- */
17
- declare const UNEXPECTED_DISCONNECT_CODE = "UNEXPECTED_DISCONNECT";
18
- /**
19
- * {@link INVALID_REQUEST_CODE} is the code used when a client's request is invalid.
20
- */
21
- declare const INVALID_REQUEST_CODE = "INVALID_REQUEST";
22
- /**
23
- * {@link CANCEL_CODE} is the code used when either server or client cancels the stream.
24
- */
25
- declare const CANCEL_CODE = "CANCEL";
26
- type TLiteralString = TLiteral<string>;
27
- type TEnumString = TEnum<Record<string, string>>;
28
- type BaseErrorSchemaType = TObject<{
29
- code: TLiteralString | TEnumString;
30
- message: TLiteralString | TString;
31
- }> | TObject<{
32
- code: TLiteralString | TEnumString;
33
- message: TLiteralString | TString;
34
- extras: TSchema;
35
- }>;
36
- /**
37
- * A schema for cancel payloads sent from the client
38
- */
39
- declare const CancelErrorSchema: TObject<{
40
- code: TLiteral<"CANCEL">;
41
- message: TString;
42
- }>;
43
- /**
44
- * {@link ReaderErrorSchema} is the schema for all the built-in river errors that
45
- * can be emitted to a reader (request reader on the server, and response reader
46
- * on the client).
47
- */
48
- declare const ReaderErrorSchema: TUnion<[TObject<{
49
- code: TLiteral<"UNCAUGHT_ERROR">;
50
- message: TString;
51
- }>, TObject<{
52
- code: TLiteral<"UNEXPECTED_DISCONNECT">;
53
- message: TString;
54
- }>, TObject<{
55
- code: TLiteral<"INVALID_REQUEST">;
56
- message: TString;
57
- extras: _sinclair_typebox.TOptional<TObject<{
58
- firstValidationErrors: _sinclair_typebox.TArray<TObject<{
59
- path: TString;
60
- message: TString;
61
- }>>;
62
- totalErrors: _sinclair_typebox.TNumber;
63
- }>>;
64
- }>, TObject<{
65
- code: TLiteral<"CANCEL">;
66
- message: TString;
67
- }>]>;
68
- /**
69
- * Represents an acceptable schema to pass to a procedure.
70
- * Just a type of a schema, not an actual schema.
71
- *
72
- */
73
- type ProcedureErrorSchemaType = TNever | BaseErrorSchemaType | TUnion<Array<BaseErrorSchemaType>>;
74
- type NestableProcedureErrorSchemaType = BaseErrorSchemaType | TUnion<NestableProcedureErrorSchemaTypeArray>;
75
- interface NestableProcedureErrorSchemaTypeArray extends Array<NestableProcedureErrorSchemaType> {
76
- }
77
- type Flatten<T> = T extends BaseErrorSchemaType ? T : T extends TUnion<Array<infer U extends TSchema>> ? Flatten<U> : unknown;
78
- /**
79
- * In the case where API consumers for some god-forsaken reason want to use
80
- * arbitrarily nested unions, this helper flattens them to a single level.
81
- *
82
- * Note that loses some metadata information on the nested unions like
83
- * nested description fields, etc.
84
- *
85
- * @param errType - An arbitrarily union-nested error schema.
86
- * @returns The flattened error schema.
87
- */
88
- declare function flattenErrorType<T extends NestableProcedureErrorSchemaType>(errType: T): Flatten<T>;
4
+ import { T as TransportClientId } from './message-CpXWqmJw.js';
5
+ import { C as Connection, n as ClientHandshakeOptions, z as SessionId } from './transport-B1MUtXL7.js';
6
+ import { C as ClientTransport } from './client-BNc5Pj_4.js';
89
7
 
90
8
  declare const ReadableBrokenError: {
91
9
  readonly code: "READABLE_BROKEN";
@@ -94,13 +12,13 @@ declare const ReadableBrokenError: {
94
12
  /**
95
13
  * Similar to {@link Result} but with an extra error to handle cases where {@link Readable.break} is called
96
14
  */
97
- type ReadableResult<T, E extends Static<BaseErrorSchemaType> = Static<BaseErrorSchemaType>> = Result<T, E | typeof ReadableBrokenError>;
15
+ type ReadableResult<T, E extends ErrorPayload = ErrorPayload> = Result<T, E | typeof ReadableBrokenError>;
98
16
  /**
99
17
  * A simple {@link AsyncIterator} used in {@link Readable}
100
18
  * that doesn't have a the extra "return" and "throw" methods, and
101
19
  * the doesn't have a "done value" (TReturn).
102
20
  */
103
- interface ReadableIterator<T, E extends Static<BaseErrorSchemaType>> extends AsyncIterator<ReadableResult<T, E>> {
21
+ interface ReadableIterator<T, E extends ErrorPayload> extends AsyncIterator<ReadableResult<T, E>> {
104
22
  next(): Promise<{
105
23
  done: false;
106
24
  value: ReadableResult<T, E>;
@@ -120,7 +38,7 @@ interface ReadableIterator<T, E extends Static<BaseErrorSchemaType>> extends Asy
120
38
  * A {@link Readable} can only have one consumer (iterator or {@link collect}) for the {@link Readable}'s
121
39
  * lifetime, in essense, reading from a {@link Readable} locks it forever.
122
40
  */
123
- interface Readable<T, E extends Static<BaseErrorSchemaType>> {
41
+ interface Readable<T, E extends ErrorPayload> {
124
42
  /**
125
43
  * {@link Readable} implements AsyncIterator API and can be consumed via
126
44
  * for-await-of loops. Iteration locks the Readable. Exiting the loop
@@ -189,7 +107,7 @@ interface Writable<T> {
189
107
  * to 'tee' a {@link Readable} to create a copy of the stream but
190
108
  * this is not the common case.
191
109
  */
192
- declare class ReadableImpl<T, E extends Static<BaseErrorSchemaType>> implements Readable<T, E> {
110
+ declare class ReadableImpl<T, E extends ErrorPayload> implements Readable<T, E> {
193
111
  /**
194
112
  * Whether the {@link Readable} is closed.
195
113
  *
@@ -327,19 +245,112 @@ declare function createClient<ServiceSchemaMap extends AnyServiceSchemaMap<any>>
327
245
  handshakeOptions: ClientHandshakeOptions;
328
246
  }>): Client<ServiceSchemaMap>;
329
247
 
248
+ /**
249
+ * {@link UNCAUGHT_ERROR_CODE} is the code that is used when an error is thrown
250
+ * inside a procedure handler that's not required.
251
+ */
252
+ declare const UNCAUGHT_ERROR_CODE = "UNCAUGHT_ERROR";
253
+ /**
254
+ * {@link UNEXPECTED_DISCONNECT_CODE} is the code used the stream's session
255
+ * disconnect unexpetedly.
256
+ */
257
+ declare const UNEXPECTED_DISCONNECT_CODE = "UNEXPECTED_DISCONNECT";
258
+ /**
259
+ * {@link INVALID_REQUEST_CODE} is the code used when a client's request is invalid.
260
+ */
261
+ declare const INVALID_REQUEST_CODE = "INVALID_REQUEST";
262
+ /**
263
+ * {@link CANCEL_CODE} is the code used when either server or client cancels the stream.
264
+ */
265
+ declare const CANCEL_CODE = "CANCEL";
266
+ type TLiteralString = TLiteral<string>;
267
+ type TEnumString = TEnum<Record<string, string>>;
268
+ type BaseErrorSchemaType = TObject<{
269
+ code: TLiteralString | TEnumString;
270
+ message: TLiteralString | TString;
271
+ }> | TObject<{
272
+ code: TLiteralString | TEnumString;
273
+ message: TLiteralString | TString;
274
+ extras: TSchema;
275
+ }>;
276
+ /**
277
+ * A schema for cancel payloads sent from the client
278
+ */
279
+ declare const CancelErrorSchema: TObject<{
280
+ code: TLiteral<"CANCEL">;
281
+ message: TString;
282
+ }>;
283
+ /**
284
+ * {@link ReaderErrorSchema} is the schema for all the built-in river errors that
285
+ * can be emitted to a reader (request reader on the server, and response reader
286
+ * on the client).
287
+ */
288
+ declare const ReaderErrorSchema: TUnion<[TObject<{
289
+ code: TLiteral<"UNCAUGHT_ERROR">;
290
+ message: TString;
291
+ }>, TObject<{
292
+ code: TLiteral<"UNEXPECTED_DISCONNECT">;
293
+ message: TString;
294
+ }>, TObject<{
295
+ code: TLiteral<"INVALID_REQUEST">;
296
+ message: TString;
297
+ extras: _sinclair_typebox.TOptional<TObject<{
298
+ firstValidationErrors: _sinclair_typebox.TArray<TObject<{
299
+ path: TString;
300
+ message: TString;
301
+ }>>;
302
+ totalErrors: _sinclair_typebox.TNumber;
303
+ }>>;
304
+ }>, TObject<{
305
+ code: TLiteral<"CANCEL">;
306
+ message: TString;
307
+ }>]>;
308
+ /**
309
+ * Represents an acceptable schema to pass to a procedure.
310
+ * Just a type of a schema, not an actual schema.
311
+ *
312
+ */
313
+ type ProcedureErrorSchemaType = TNever | BaseErrorSchemaType | TUnion<Array<BaseErrorSchemaType>>;
314
+ type NestableProcedureErrorSchemaType = BaseErrorSchemaType | TUnion<NestableProcedureErrorSchemaTypeArray>;
315
+ interface NestableProcedureErrorSchemaTypeArray extends Array<NestableProcedureErrorSchemaType> {
316
+ }
317
+ type Flatten<T> = T extends BaseErrorSchemaType ? T : T extends TUnion<Array<infer U extends TSchema>> ? Flatten<U> : unknown;
318
+ /**
319
+ * In the case where API consumers for some god-forsaken reason want to use
320
+ * arbitrarily nested unions, this helper flattens them to a single level.
321
+ *
322
+ * Note that loses some metadata information on the nested unions like
323
+ * nested description fields, etc.
324
+ *
325
+ * @param errType - An arbitrarily union-nested error schema.
326
+ * @returns The flattened error schema.
327
+ */
328
+ declare function flattenErrorType<T extends NestableProcedureErrorSchemaType>(errType: T): Flatten<T>;
329
+
330
+ /**
331
+ * The minimum error shape supported by river's `Result` and stream primitives.
332
+ *
333
+ * The existing TypeBox router uses schema-derived object types for this, while
334
+ * the protobuf router can use a richer structural error type.
335
+ */
336
+ interface ErrorPayload {
337
+ code: string;
338
+ message: string;
339
+ extras?: unknown;
340
+ }
330
341
  interface OkResult<T> {
331
342
  ok: true;
332
343
  payload: T;
333
344
  }
334
- interface ErrResult<Err extends Static<BaseErrorSchemaType>> {
345
+ interface ErrResult<Err extends ErrorPayload> {
335
346
  ok: false;
336
347
  payload: Err;
337
348
  }
338
- type Result<T, Err extends Static<BaseErrorSchemaType>> = OkResult<T> | ErrResult<Err>;
349
+ type Result<T, Err extends ErrorPayload> = OkResult<T> | ErrResult<Err>;
339
350
  declare function Ok<const T extends Array<unknown>>(p: T): OkResult<T>;
340
351
  declare function Ok<const T extends ReadonlyArray<unknown>>(p: T): OkResult<T>;
341
352
  declare function Ok<const T>(payload: T): OkResult<T>;
342
- declare function Err<const Err extends Static<BaseErrorSchemaType>>(error: Err): ErrResult<Err>;
353
+ declare function Err<const Err extends ErrorPayload>(error: Err): ErrResult<Err>;
343
354
  /**
344
355
  * Refine a {@link Result} type to its returned payload.
345
356
  */
@@ -1111,4 +1122,4 @@ declare class ServiceScaffold<Context extends MaybeDisposable, State extends obj
1111
1122
  };
1112
1123
  }
1113
1124
 
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 };
1125
+ 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 ErrorPayload as a0, 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,91 +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 { 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
-
8
- /**
9
- * {@link UNCAUGHT_ERROR_CODE} is the code that is used when an error is thrown
10
- * inside a procedure handler that's not required.
11
- */
12
- declare const UNCAUGHT_ERROR_CODE = "UNCAUGHT_ERROR";
13
- /**
14
- * {@link UNEXPECTED_DISCONNECT_CODE} is the code used the stream's session
15
- * disconnect unexpetedly.
16
- */
17
- declare const UNEXPECTED_DISCONNECT_CODE = "UNEXPECTED_DISCONNECT";
18
- /**
19
- * {@link INVALID_REQUEST_CODE} is the code used when a client's request is invalid.
20
- */
21
- declare const INVALID_REQUEST_CODE = "INVALID_REQUEST";
22
- /**
23
- * {@link CANCEL_CODE} is the code used when either server or client cancels the stream.
24
- */
25
- declare const CANCEL_CODE = "CANCEL";
26
- type TLiteralString = TLiteral<string>;
27
- type TEnumString = TEnum<Record<string, string>>;
28
- type BaseErrorSchemaType = TObject<{
29
- code: TLiteralString | TEnumString;
30
- message: TLiteralString | TString;
31
- }> | TObject<{
32
- code: TLiteralString | TEnumString;
33
- message: TLiteralString | TString;
34
- extras: TSchema;
35
- }>;
36
- /**
37
- * A schema for cancel payloads sent from the client
38
- */
39
- declare const CancelErrorSchema: TObject<{
40
- code: TLiteral<"CANCEL">;
41
- message: TString;
42
- }>;
43
- /**
44
- * {@link ReaderErrorSchema} is the schema for all the built-in river errors that
45
- * can be emitted to a reader (request reader on the server, and response reader
46
- * on the client).
47
- */
48
- declare const ReaderErrorSchema: TUnion<[TObject<{
49
- code: TLiteral<"UNCAUGHT_ERROR">;
50
- message: TString;
51
- }>, TObject<{
52
- code: TLiteral<"UNEXPECTED_DISCONNECT">;
53
- message: TString;
54
- }>, TObject<{
55
- code: TLiteral<"INVALID_REQUEST">;
56
- message: TString;
57
- extras: _sinclair_typebox.TOptional<TObject<{
58
- firstValidationErrors: _sinclair_typebox.TArray<TObject<{
59
- path: TString;
60
- message: TString;
61
- }>>;
62
- totalErrors: _sinclair_typebox.TNumber;
63
- }>>;
64
- }>, TObject<{
65
- code: TLiteral<"CANCEL">;
66
- message: TString;
67
- }>]>;
68
- /**
69
- * Represents an acceptable schema to pass to a procedure.
70
- * Just a type of a schema, not an actual schema.
71
- *
72
- */
73
- type ProcedureErrorSchemaType = TNever | BaseErrorSchemaType | TUnion<Array<BaseErrorSchemaType>>;
74
- type NestableProcedureErrorSchemaType = BaseErrorSchemaType | TUnion<NestableProcedureErrorSchemaTypeArray>;
75
- interface NestableProcedureErrorSchemaTypeArray extends Array<NestableProcedureErrorSchemaType> {
76
- }
77
- type Flatten<T> = T extends BaseErrorSchemaType ? T : T extends TUnion<Array<infer U extends TSchema>> ? Flatten<U> : unknown;
78
- /**
79
- * In the case where API consumers for some god-forsaken reason want to use
80
- * arbitrarily nested unions, this helper flattens them to a single level.
81
- *
82
- * Note that loses some metadata information on the nested unions like
83
- * nested description fields, etc.
84
- *
85
- * @param errType - An arbitrarily union-nested error schema.
86
- * @returns The flattened error schema.
87
- */
88
- declare function flattenErrorType<T extends NestableProcedureErrorSchemaType>(errType: T): Flatten<T>;
4
+ import { T as TransportClientId } from './message-CpXWqmJw.cjs';
5
+ import { C as Connection, n as ClientHandshakeOptions, z as SessionId } from './transport-BnU3Zb0Q.cjs';
6
+ import { C as ClientTransport } from './client-BZUvFL6B.cjs';
89
7
 
90
8
  declare const ReadableBrokenError: {
91
9
  readonly code: "READABLE_BROKEN";
@@ -94,13 +12,13 @@ declare const ReadableBrokenError: {
94
12
  /**
95
13
  * Similar to {@link Result} but with an extra error to handle cases where {@link Readable.break} is called
96
14
  */
97
- type ReadableResult<T, E extends Static<BaseErrorSchemaType> = Static<BaseErrorSchemaType>> = Result<T, E | typeof ReadableBrokenError>;
15
+ type ReadableResult<T, E extends ErrorPayload = ErrorPayload> = Result<T, E | typeof ReadableBrokenError>;
98
16
  /**
99
17
  * A simple {@link AsyncIterator} used in {@link Readable}
100
18
  * that doesn't have a the extra "return" and "throw" methods, and
101
19
  * the doesn't have a "done value" (TReturn).
102
20
  */
103
- interface ReadableIterator<T, E extends Static<BaseErrorSchemaType>> extends AsyncIterator<ReadableResult<T, E>> {
21
+ interface ReadableIterator<T, E extends ErrorPayload> extends AsyncIterator<ReadableResult<T, E>> {
104
22
  next(): Promise<{
105
23
  done: false;
106
24
  value: ReadableResult<T, E>;
@@ -120,7 +38,7 @@ interface ReadableIterator<T, E extends Static<BaseErrorSchemaType>> extends Asy
120
38
  * A {@link Readable} can only have one consumer (iterator or {@link collect}) for the {@link Readable}'s
121
39
  * lifetime, in essense, reading from a {@link Readable} locks it forever.
122
40
  */
123
- interface Readable<T, E extends Static<BaseErrorSchemaType>> {
41
+ interface Readable<T, E extends ErrorPayload> {
124
42
  /**
125
43
  * {@link Readable} implements AsyncIterator API and can be consumed via
126
44
  * for-await-of loops. Iteration locks the Readable. Exiting the loop
@@ -189,7 +107,7 @@ interface Writable<T> {
189
107
  * to 'tee' a {@link Readable} to create a copy of the stream but
190
108
  * this is not the common case.
191
109
  */
192
- declare class ReadableImpl<T, E extends Static<BaseErrorSchemaType>> implements Readable<T, E> {
110
+ declare class ReadableImpl<T, E extends ErrorPayload> implements Readable<T, E> {
193
111
  /**
194
112
  * Whether the {@link Readable} is closed.
195
113
  *
@@ -327,19 +245,112 @@ declare function createClient<ServiceSchemaMap extends AnyServiceSchemaMap<any>>
327
245
  handshakeOptions: ClientHandshakeOptions;
328
246
  }>): Client<ServiceSchemaMap>;
329
247
 
248
+ /**
249
+ * {@link UNCAUGHT_ERROR_CODE} is the code that is used when an error is thrown
250
+ * inside a procedure handler that's not required.
251
+ */
252
+ declare const UNCAUGHT_ERROR_CODE = "UNCAUGHT_ERROR";
253
+ /**
254
+ * {@link UNEXPECTED_DISCONNECT_CODE} is the code used the stream's session
255
+ * disconnect unexpetedly.
256
+ */
257
+ declare const UNEXPECTED_DISCONNECT_CODE = "UNEXPECTED_DISCONNECT";
258
+ /**
259
+ * {@link INVALID_REQUEST_CODE} is the code used when a client's request is invalid.
260
+ */
261
+ declare const INVALID_REQUEST_CODE = "INVALID_REQUEST";
262
+ /**
263
+ * {@link CANCEL_CODE} is the code used when either server or client cancels the stream.
264
+ */
265
+ declare const CANCEL_CODE = "CANCEL";
266
+ type TLiteralString = TLiteral<string>;
267
+ type TEnumString = TEnum<Record<string, string>>;
268
+ type BaseErrorSchemaType = TObject<{
269
+ code: TLiteralString | TEnumString;
270
+ message: TLiteralString | TString;
271
+ }> | TObject<{
272
+ code: TLiteralString | TEnumString;
273
+ message: TLiteralString | TString;
274
+ extras: TSchema;
275
+ }>;
276
+ /**
277
+ * A schema for cancel payloads sent from the client
278
+ */
279
+ declare const CancelErrorSchema: TObject<{
280
+ code: TLiteral<"CANCEL">;
281
+ message: TString;
282
+ }>;
283
+ /**
284
+ * {@link ReaderErrorSchema} is the schema for all the built-in river errors that
285
+ * can be emitted to a reader (request reader on the server, and response reader
286
+ * on the client).
287
+ */
288
+ declare const ReaderErrorSchema: TUnion<[TObject<{
289
+ code: TLiteral<"UNCAUGHT_ERROR">;
290
+ message: TString;
291
+ }>, TObject<{
292
+ code: TLiteral<"UNEXPECTED_DISCONNECT">;
293
+ message: TString;
294
+ }>, TObject<{
295
+ code: TLiteral<"INVALID_REQUEST">;
296
+ message: TString;
297
+ extras: _sinclair_typebox.TOptional<TObject<{
298
+ firstValidationErrors: _sinclair_typebox.TArray<TObject<{
299
+ path: TString;
300
+ message: TString;
301
+ }>>;
302
+ totalErrors: _sinclair_typebox.TNumber;
303
+ }>>;
304
+ }>, TObject<{
305
+ code: TLiteral<"CANCEL">;
306
+ message: TString;
307
+ }>]>;
308
+ /**
309
+ * Represents an acceptable schema to pass to a procedure.
310
+ * Just a type of a schema, not an actual schema.
311
+ *
312
+ */
313
+ type ProcedureErrorSchemaType = TNever | BaseErrorSchemaType | TUnion<Array<BaseErrorSchemaType>>;
314
+ type NestableProcedureErrorSchemaType = BaseErrorSchemaType | TUnion<NestableProcedureErrorSchemaTypeArray>;
315
+ interface NestableProcedureErrorSchemaTypeArray extends Array<NestableProcedureErrorSchemaType> {
316
+ }
317
+ type Flatten<T> = T extends BaseErrorSchemaType ? T : T extends TUnion<Array<infer U extends TSchema>> ? Flatten<U> : unknown;
318
+ /**
319
+ * In the case where API consumers for some god-forsaken reason want to use
320
+ * arbitrarily nested unions, this helper flattens them to a single level.
321
+ *
322
+ * Note that loses some metadata information on the nested unions like
323
+ * nested description fields, etc.
324
+ *
325
+ * @param errType - An arbitrarily union-nested error schema.
326
+ * @returns The flattened error schema.
327
+ */
328
+ declare function flattenErrorType<T extends NestableProcedureErrorSchemaType>(errType: T): Flatten<T>;
329
+
330
+ /**
331
+ * The minimum error shape supported by river's `Result` and stream primitives.
332
+ *
333
+ * The existing TypeBox router uses schema-derived object types for this, while
334
+ * the protobuf router can use a richer structural error type.
335
+ */
336
+ interface ErrorPayload {
337
+ code: string;
338
+ message: string;
339
+ extras?: unknown;
340
+ }
330
341
  interface OkResult<T> {
331
342
  ok: true;
332
343
  payload: T;
333
344
  }
334
- interface ErrResult<Err extends Static<BaseErrorSchemaType>> {
345
+ interface ErrResult<Err extends ErrorPayload> {
335
346
  ok: false;
336
347
  payload: Err;
337
348
  }
338
- type Result<T, Err extends Static<BaseErrorSchemaType>> = OkResult<T> | ErrResult<Err>;
349
+ type Result<T, Err extends ErrorPayload> = OkResult<T> | ErrResult<Err>;
339
350
  declare function Ok<const T extends Array<unknown>>(p: T): OkResult<T>;
340
351
  declare function Ok<const T extends ReadonlyArray<unknown>>(p: T): OkResult<T>;
341
352
  declare function Ok<const T>(payload: T): OkResult<T>;
342
- declare function Err<const Err extends Static<BaseErrorSchemaType>>(error: Err): ErrResult<Err>;
353
+ declare function Err<const Err extends ErrorPayload>(error: Err): ErrResult<Err>;
343
354
  /**
344
355
  * Refine a {@link Result} type to its returned payload.
345
356
  */
@@ -1111,4 +1122,4 @@ declare class ServiceScaffold<Context extends MaybeDisposable, State extends obj
1111
1122
  };
1112
1123
  }
1113
1124
 
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 };
1125
+ 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 ErrorPayload as a0, 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 };
@@ -564,7 +564,7 @@ function coerceErrorString(err) {
564
564
  }
565
565
 
566
566
  // package.json
567
- var version = "0.215.1";
567
+ var version = "0.216.0";
568
568
 
569
569
  // tracing/index.ts
570
570
  function getPropagationContext(ctx) {
@@ -2022,10 +2022,26 @@ var ServerTransport = class extends Transport {
2022
2022
  const previousParsedMetadata = this.sessionHandshakeMetadata.get(
2023
2023
  msg.from
2024
2024
  );
2025
- const parsedMetadataOrFailureCode = await this.handshakeExtensions.validate(
2026
- msg.payload.metadata,
2027
- previousParsedMetadata
2028
- );
2025
+ let parsedMetadataOrFailureCode;
2026
+ try {
2027
+ parsedMetadataOrFailureCode = await this.handshakeExtensions.validate(
2028
+ msg.payload.metadata,
2029
+ previousParsedMetadata
2030
+ );
2031
+ } catch (err) {
2032
+ this.rejectHandshakeRequest(
2033
+ session,
2034
+ msg.from,
2035
+ `handshake validation threw: ${coerceErrorString(err)}`,
2036
+ "REJECTED_BY_CUSTOM_HANDLER",
2037
+ {
2038
+ ...session.loggingMetadata,
2039
+ connectedTo: msg.from,
2040
+ clientId: this.clientId
2041
+ }
2042
+ );
2043
+ return;
2044
+ }
2029
2045
  if (session._isConsumed) {
2030
2046
  return;
2031
2047
  }