@orpc/server 2.0.0-beta.33 → 2.0.0-beta.35

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 (52) hide show
  1. package/README.md +15 -14
  2. package/dist/adapters/aws-lambda/index.d.mts +2 -2
  3. package/dist/adapters/aws-lambda/index.d.ts +2 -2
  4. package/dist/adapters/aws-lambda/index.mjs +5 -5
  5. package/dist/adapters/crossws/index.d.mts +2 -2
  6. package/dist/adapters/crossws/index.d.ts +2 -2
  7. package/dist/adapters/crossws/index.mjs +5 -5
  8. package/dist/adapters/fastify/index.d.mts +2 -2
  9. package/dist/adapters/fastify/index.d.ts +2 -2
  10. package/dist/adapters/fastify/index.mjs +5 -5
  11. package/dist/adapters/fetch/index.d.mts +3 -3
  12. package/dist/adapters/fetch/index.d.ts +3 -3
  13. package/dist/adapters/fetch/index.mjs +6 -6
  14. package/dist/adapters/message-port/index.d.mts +2 -2
  15. package/dist/adapters/message-port/index.d.ts +2 -2
  16. package/dist/adapters/message-port/index.mjs +5 -5
  17. package/dist/adapters/node/index.d.mts +3 -3
  18. package/dist/adapters/node/index.d.ts +3 -3
  19. package/dist/adapters/node/index.mjs +7 -7
  20. package/dist/adapters/standard/index.d.mts +5 -5
  21. package/dist/adapters/standard/index.d.ts +5 -5
  22. package/dist/adapters/standard/index.mjs +4 -4
  23. package/dist/adapters/standard-peer/index.d.mts +1 -1
  24. package/dist/adapters/standard-peer/index.d.ts +1 -1
  25. package/dist/adapters/websocket/index.d.mts +2 -2
  26. package/dist/adapters/websocket/index.d.ts +2 -2
  27. package/dist/adapters/websocket/index.mjs +5 -5
  28. package/dist/extensions/callable.d.mts +3 -3
  29. package/dist/extensions/callable.d.ts +3 -3
  30. package/dist/extensions/callable.mjs +2 -2
  31. package/dist/index.d.mts +26 -26
  32. package/dist/index.d.ts +26 -26
  33. package/dist/index.mjs +8 -16
  34. package/dist/plugins/index.d.mts +6 -5
  35. package/dist/plugins/index.d.ts +6 -5
  36. package/dist/plugins/index.mjs +36 -20
  37. package/dist/shared/{server.Cd4Z1hpV.mjs → server.1ExWFMze.mjs} +2 -2
  38. package/dist/shared/{server.Cqk3swxs.mjs → server.24nXyhbl.mjs} +1 -1
  39. package/dist/shared/{server.C2n16pp0.d.ts → server.BGMO5dst.d.ts} +6 -6
  40. package/dist/shared/{server.S8BnCR3a.mjs → server.BYnwk7Xz.mjs} +1 -1
  41. package/dist/shared/{server.DtfwuV6U.d.ts → server.BpmUhems.d.mts} +9 -9
  42. package/dist/shared/{server.CwrYlF72.d.ts → server.BsujoJoF.d.mts} +12 -23
  43. package/dist/shared/{server.CwrYlF72.d.mts → server.BsujoJoF.d.ts} +12 -23
  44. package/dist/shared/{server.D0Ipbmdv.d.mts → server.CAiLRqPf.d.mts} +2 -2
  45. package/dist/shared/{server.Dm0os-OP.d.mts → server.CRwPbhLO.d.ts} +9 -9
  46. package/dist/shared/{server.DrN1Pj1-.d.ts → server.DEeCcNd6.d.ts} +5 -5
  47. package/dist/shared/{server.CkNnZ5F-.d.mts → server.DcHlvZFK.d.mts} +6 -6
  48. package/dist/shared/{server.3Ex_8ISY.mjs → server.Djb_ebJT.mjs} +4 -17
  49. package/dist/shared/{server.JbCIPL4P.d.mts → server.R0uHWfBo.d.mts} +5 -5
  50. package/dist/shared/{server.BhHrioCw.d.ts → server.b2-J4t6T.d.ts} +2 -2
  51. package/dist/shared/{server.7G43pSxo.mjs → server.sNWd6DAG.mjs} +17 -17
  52. package/package.json +10 -10
@@ -1,10 +1,10 @@
1
1
  import { RouterContract, ProcedureContract, ORPCErrorFromErrorMap, ThrowableError, InferSchemaInput, InferSchemaOutput } from '@orpc/contract';
2
- import { C as Context, a as Procedure, L as Lazyable, M as MergedContext } from './server.CwrYlF72.js';
2
+ import { C as Context, a as Procedure, L as Lazyable, M as MergedContext } from './server.BsujoJoF.mjs';
3
3
 
4
- type Router<TInitialContext extends Context> = Procedure<TInitialContext, any, any, any, any, any> | {
4
+ type Router<TInitialContext extends Context> = Procedure<TInitialContext, any, any, any, any> | {
5
5
  [k: string]: Lazyable<Router<TInitialContext>>;
6
6
  };
7
- type ContractedRouter<T extends RouterContract, TInitialContext extends Context> = T extends ProcedureContract<infer $InputSchema, infer $OutputSchema, infer $ErrorMap> ? Procedure<TInitialContext, any, $InputSchema, $OutputSchema, $ErrorMap, never> : {
7
+ type ContractedRouter<T extends RouterContract, TInitialContext extends Context> = T extends ProcedureContract<infer $InputSchema, infer $OutputSchema, infer $ErrorMap> ? Procedure<TInitialContext, any, $InputSchema, $OutputSchema, $ErrorMap> : {
8
8
  [K in keyof T]: T[K] extends RouterContract ? Lazyable<ContractedRouter<T[K], TInitialContext>> : never;
9
9
  };
10
10
  type AnyRouter = Router<any>;
@@ -17,7 +17,7 @@ type InferRouterInitialContext<T extends AnyRouter> = T extends Router<infer $>
17
17
  *
18
18
  * @see {@link https://orpc.dev/docs/router#infer-router-initial-contexts | Router - Infer Router Initial Contexts}
19
19
  */
20
- type InferRouterInitialContexts<T extends AnyRouter> = T extends Procedure<infer UInitialContext, any, any, any, any, any> ? UInitialContext : {
20
+ type InferRouterInitialContexts<T extends AnyRouter> = T extends Procedure<infer UInitialContext, any, any, any, any> ? UInitialContext : {
21
21
  [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterInitialContexts<U> : never;
22
22
  };
23
23
  /**
@@ -28,7 +28,7 @@ type InferRouterInitialContexts<T extends AnyRouter> = T extends Procedure<infer
28
28
  *
29
29
  * @see {@link https://orpc.dev/docs/router#infer-router-final-contexts | Router - Infer Router Final Contexts}
30
30
  */
31
- type InferRouterFinalContexts<T extends AnyRouter> = T extends Procedure<infer UInitialContext, infer UInjectedContext, any, any, any, any> ? MergedContext<UInitialContext, UInjectedContext> : {
31
+ type InferRouterFinalContexts<T extends AnyRouter> = T extends Procedure<infer UInitialContext, infer UInjectedContext, any, any, any> ? MergedContext<UInitialContext, UInjectedContext> : {
32
32
  [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterFinalContexts<U> : never;
33
33
  };
34
34
  /**
@@ -39,7 +39,7 @@ type InferRouterFinalContexts<T extends AnyRouter> = T extends Procedure<infer U
39
39
  *
40
40
  * @see {@link https://orpc.dev/docs/router#infer-router-inputs | Router - Infer Router Inputs}
41
41
  */
42
- type InferRouterInputs<T extends AnyRouter> = T extends Procedure<any, any, infer UInputSchema, any, any, any> ? InferSchemaInput<UInputSchema> : {
42
+ type InferRouterInputs<T extends AnyRouter> = T extends Procedure<any, any, infer UInputSchema, any, any> ? InferSchemaInput<UInputSchema> : {
43
43
  [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterInputs<U> : never;
44
44
  };
45
45
  /**
@@ -50,7 +50,7 @@ type InferRouterInputs<T extends AnyRouter> = T extends Procedure<any, any, infe
50
50
  *
51
51
  * @see {@link https://orpc.dev/docs/router#infer-router-outputs | Router - Infer Router Outputs}
52
52
  */
53
- type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any, infer UOutputSchema, any, any> ? InferSchemaOutput<UOutputSchema> : {
53
+ type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any, infer UOutputSchema, any> ? InferSchemaOutput<UOutputSchema> : {
54
54
  [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterOutputs<U> : never;
55
55
  };
56
56
  /**
@@ -58,7 +58,7 @@ type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any
58
58
  *
59
59
  * @see {@link https://orpc.dev/docs/router#infer-router-error | Router - Infer Router Error}
60
60
  */
61
- type InferRouterError<T extends AnyRouter> = T extends Procedure<any, any, any, any, infer UErrorMap, infer UReturnedError> ? ORPCErrorFromErrorMap<UErrorMap> | UReturnedError | ThrowableError : {
61
+ type InferRouterError<T extends AnyRouter> = T extends Procedure<any, any, any, any, infer UErrorMap> ? ORPCErrorFromErrorMap<UErrorMap> | ThrowableError : {
62
62
  [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterError<U> : never;
63
63
  }[keyof T];
64
64
  /**
@@ -66,7 +66,7 @@ type InferRouterError<T extends AnyRouter> = T extends Procedure<any, any, any,
66
66
  *
67
67
  * @see {@link https://orpc.dev/docs/router#infer-router-errors | Router - Infer Router Errors}
68
68
  */
69
- type InferRouterErrors<T extends AnyRouter> = T extends Procedure<any, any, any, any, infer UErrorMap, infer UReturnedError> ? ORPCErrorFromErrorMap<UErrorMap> | UReturnedError | ThrowableError : {
69
+ type InferRouterErrors<T extends AnyRouter> = T extends Procedure<any, any, any, any, infer UErrorMap> ? ORPCErrorFromErrorMap<UErrorMap> | ThrowableError : {
70
70
  [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterErrors<U> : never;
71
71
  };
72
72
 
@@ -1,4 +1,4 @@
1
- import { AnyORPCError, ClientContext, Client } from '@orpc/client';
1
+ import { ClientContext, Client } from '@orpc/client';
2
2
  import { ErrorMap, AnyMetaPlugin, ORPCErrorConstructorMap, AnySchema, ProcedureContractDefinition, Meta, InferSchemaOutput, ORPCErrorFromErrorMap, InferSchemaInput } from '@orpc/contract';
3
3
  import { MaybeOptionalOptions, Promisable, Interceptor, PromiseWithError, ThrowableError, Value } from '@orpc/shared';
4
4
 
@@ -60,7 +60,7 @@ interface ProcedureHandlerOptions<TCurrentContext extends Context, TInput, TErro
60
60
  context: TCurrentContext;
61
61
  input: TInput;
62
62
  path: string[];
63
- procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap, any>;
63
+ procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap>;
64
64
  signal?: AbortSignal | undefined;
65
65
  lastEventId?: string | undefined;
66
66
  errors: TErrorConstructorMap;
@@ -109,32 +109,21 @@ interface ProcedureConfig {
109
109
  */
110
110
  disableOutputValidation?: boolean | undefined;
111
111
  }
112
- interface ProcedureDefinition<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TReturnedError extends AnyORPCError> extends ProcedureContractDefinition<TInputSchema, TOutputSchema, TErrorMap>, ProcedureConfig {
112
+ interface ProcedureDefinition<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> extends ProcedureContractDefinition<TInputSchema, TOutputSchema, TErrorMap>, ProcedureConfig {
113
113
  __TInitialContext?: (type: TInitialContext) => unknown;
114
114
  __TInjectedContext?: (type: TInjectedContext) => unknown;
115
- __TReturnedError?: () => TReturnedError;
116
- /**
117
- * When enabled, errors returned (not thrown) by the handler are passed through as-is,
118
- * rather than being transformed into inferrable errors.
119
- *
120
- * This is intended for the contract-first approach, where the procedure adheres to an
121
- * external contract and returned errors should not affect the inferred contract types.
122
- *
123
- * @default false
124
- */
125
- opaqueReturnedErrors?: boolean | undefined;
126
115
  orderedMiddlewares: OrderedMiddleware[];
127
116
  handler: ProcedureHandler<any, any, any, any>;
128
117
  }
129
- declare class Procedure<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TReturnedError extends AnyORPCError> {
130
- '~orpc': ProcedureDefinition<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap, TReturnedError>;
131
- constructor(def: ProcedureDefinition<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap, TReturnedError>);
118
+ declare class Procedure<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> {
119
+ '~orpc': ProcedureDefinition<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>;
120
+ constructor(def: ProcedureDefinition<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>);
132
121
  /**
133
122
  * Checks if the given instance satisfies the {@link Procedure} class/interface.
134
123
  */
135
124
  static [Symbol.hasInstance](instance: unknown): boolean;
136
125
  }
137
- type AnyProcedure = Procedure<any, any, any, any, any, any>;
126
+ type AnyProcedure = Procedure<any, any, any, any, any>;
138
127
 
139
128
  interface LazyDefinition<T> {
140
129
  meta: Meta;
@@ -156,19 +145,19 @@ declare function unlazy<T extends Lazyable<any>>(maybeLazy: T): Promise<{
156
145
  default: T extends Lazy<infer U> ? U : T;
157
146
  }>;
158
147
 
159
- type ProcedureClient<TClientContext extends ClientContext, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TReturnedORPCError extends AnyORPCError> = Client<TClientContext, InferSchemaInput<TInputSchema>, InferSchemaOutput<TOutputSchema>, ORPCErrorFromErrorMap<TErrorMap> | TReturnedORPCError | ThrowableError>;
148
+ type ProcedureClient<TClientContext extends ClientContext, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> = Client<TClientContext, InferSchemaInput<TInputSchema>, InferSchemaOutput<TOutputSchema>, ORPCErrorFromErrorMap<TErrorMap> | ThrowableError>;
160
149
  interface ProcedureClientInterceptorOptions<TInitialContext extends Context, TErrorMap extends ErrorMap> extends ProcedureHandlerOptions<TInitialContext, unknown, ORPCErrorConstructorMap<TErrorMap>> {
161
150
  }
162
- type ProcedureClientInterceptor<TInitialContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TReturnedError extends AnyORPCError> = Interceptor<ProcedureClientInterceptorOptions<TInitialContext, TErrorMap>, PromiseWithError<InferSchemaOutput<TOutputSchema>, ORPCErrorFromErrorMap<TErrorMap> | TReturnedError | ThrowableError>>;
163
- type ProcedureClientOptions<TInitialContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TReturnedError extends AnyORPCError, TClientContext extends ClientContext> = {
151
+ type ProcedureClientInterceptor<TInitialContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> = Interceptor<ProcedureClientInterceptorOptions<TInitialContext, TErrorMap>, PromiseWithError<InferSchemaOutput<TOutputSchema>, ORPCErrorFromErrorMap<TErrorMap> | ThrowableError>>;
152
+ type ProcedureClientOptions<TInitialContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TClientContext extends ClientContext> = {
164
153
  path?: string[];
165
- interceptors?: ProcedureClientInterceptor<TInitialContext, TOutputSchema, TErrorMap, TReturnedError>[];
154
+ interceptors?: ProcedureClientInterceptor<TInitialContext, TOutputSchema, TErrorMap>[];
166
155
  } & (object extends TInitialContext ? {
167
156
  context?: Value<Promisable<TInitialContext>, [clientContext: TClientContext]>;
168
157
  } : {
169
158
  context: Value<Promisable<TInitialContext>, [clientContext: TClientContext]>;
170
159
  });
171
- declare function createProcedureClient<TInitialContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TReturnedError extends AnyORPCError, TClientContext extends ClientContext = object>(lazyableProcedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, TErrorMap, TReturnedError>>, ...rest: MaybeOptionalOptions<ProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TReturnedError, TClientContext>>): ProcedureClient<TClientContext, TInputSchema, TOutputSchema, TErrorMap, TReturnedError>;
160
+ declare function createProcedureClient<TInitialContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TClientContext extends ClientContext = object>(lazyableProcedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, TErrorMap>>, ...rest: MaybeOptionalOptions<ProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TClientContext>>): ProcedureClient<TClientContext, TInputSchema, TOutputSchema, TErrorMap>;
172
161
 
173
162
  export { Procedure as a, Lazy as h, createProcedureClient as u, unlazy as v };
174
163
  export type { AnyProcedure as A, Context as C, Lazyable as L, MergedContext as M, OrderedMiddleware as O, ProcedureClientOptions as P, ProcedureClient as b, ProcedureClientInterceptor as c, Middleware as d, MergedInitialContext as e, ProcedureConfig as f, AnyMiddleware as g, ProcedureHandler as i, LazyDefinition as j, MiddlewareDefinition as k, MiddlewareDone as l, MiddlewareDoneOptions as m, MiddlewareNext as n, MiddlewareNextOptions as o, MiddlewareOptions as p, MiddlewareResult as q, ProcedureClientInterceptorOptions as r, ProcedureDefinition as s, ProcedureHandlerOptions as t };
@@ -1,4 +1,4 @@
1
- import { AnyORPCError, ClientContext, Client } from '@orpc/client';
1
+ import { ClientContext, Client } from '@orpc/client';
2
2
  import { ErrorMap, AnyMetaPlugin, ORPCErrorConstructorMap, AnySchema, ProcedureContractDefinition, Meta, InferSchemaOutput, ORPCErrorFromErrorMap, InferSchemaInput } from '@orpc/contract';
3
3
  import { MaybeOptionalOptions, Promisable, Interceptor, PromiseWithError, ThrowableError, Value } from '@orpc/shared';
4
4
 
@@ -60,7 +60,7 @@ interface ProcedureHandlerOptions<TCurrentContext extends Context, TInput, TErro
60
60
  context: TCurrentContext;
61
61
  input: TInput;
62
62
  path: string[];
63
- procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap, any>;
63
+ procedure: Procedure<Context, Context, AnySchema, AnySchema, ErrorMap>;
64
64
  signal?: AbortSignal | undefined;
65
65
  lastEventId?: string | undefined;
66
66
  errors: TErrorConstructorMap;
@@ -109,32 +109,21 @@ interface ProcedureConfig {
109
109
  */
110
110
  disableOutputValidation?: boolean | undefined;
111
111
  }
112
- interface ProcedureDefinition<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TReturnedError extends AnyORPCError> extends ProcedureContractDefinition<TInputSchema, TOutputSchema, TErrorMap>, ProcedureConfig {
112
+ interface ProcedureDefinition<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> extends ProcedureContractDefinition<TInputSchema, TOutputSchema, TErrorMap>, ProcedureConfig {
113
113
  __TInitialContext?: (type: TInitialContext) => unknown;
114
114
  __TInjectedContext?: (type: TInjectedContext) => unknown;
115
- __TReturnedError?: () => TReturnedError;
116
- /**
117
- * When enabled, errors returned (not thrown) by the handler are passed through as-is,
118
- * rather than being transformed into inferrable errors.
119
- *
120
- * This is intended for the contract-first approach, where the procedure adheres to an
121
- * external contract and returned errors should not affect the inferred contract types.
122
- *
123
- * @default false
124
- */
125
- opaqueReturnedErrors?: boolean | undefined;
126
115
  orderedMiddlewares: OrderedMiddleware[];
127
116
  handler: ProcedureHandler<any, any, any, any>;
128
117
  }
129
- declare class Procedure<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TReturnedError extends AnyORPCError> {
130
- '~orpc': ProcedureDefinition<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap, TReturnedError>;
131
- constructor(def: ProcedureDefinition<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap, TReturnedError>);
118
+ declare class Procedure<TInitialContext extends Context, TInjectedContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> {
119
+ '~orpc': ProcedureDefinition<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>;
120
+ constructor(def: ProcedureDefinition<TInitialContext, TInjectedContext, TInputSchema, TOutputSchema, TErrorMap>);
132
121
  /**
133
122
  * Checks if the given instance satisfies the {@link Procedure} class/interface.
134
123
  */
135
124
  static [Symbol.hasInstance](instance: unknown): boolean;
136
125
  }
137
- type AnyProcedure = Procedure<any, any, any, any, any, any>;
126
+ type AnyProcedure = Procedure<any, any, any, any, any>;
138
127
 
139
128
  interface LazyDefinition<T> {
140
129
  meta: Meta;
@@ -156,19 +145,19 @@ declare function unlazy<T extends Lazyable<any>>(maybeLazy: T): Promise<{
156
145
  default: T extends Lazy<infer U> ? U : T;
157
146
  }>;
158
147
 
159
- type ProcedureClient<TClientContext extends ClientContext, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TReturnedORPCError extends AnyORPCError> = Client<TClientContext, InferSchemaInput<TInputSchema>, InferSchemaOutput<TOutputSchema>, ORPCErrorFromErrorMap<TErrorMap> | TReturnedORPCError | ThrowableError>;
148
+ type ProcedureClient<TClientContext extends ClientContext, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> = Client<TClientContext, InferSchemaInput<TInputSchema>, InferSchemaOutput<TOutputSchema>, ORPCErrorFromErrorMap<TErrorMap> | ThrowableError>;
160
149
  interface ProcedureClientInterceptorOptions<TInitialContext extends Context, TErrorMap extends ErrorMap> extends ProcedureHandlerOptions<TInitialContext, unknown, ORPCErrorConstructorMap<TErrorMap>> {
161
150
  }
162
- type ProcedureClientInterceptor<TInitialContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TReturnedError extends AnyORPCError> = Interceptor<ProcedureClientInterceptorOptions<TInitialContext, TErrorMap>, PromiseWithError<InferSchemaOutput<TOutputSchema>, ORPCErrorFromErrorMap<TErrorMap> | TReturnedError | ThrowableError>>;
163
- type ProcedureClientOptions<TInitialContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TReturnedError extends AnyORPCError, TClientContext extends ClientContext> = {
151
+ type ProcedureClientInterceptor<TInitialContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap> = Interceptor<ProcedureClientInterceptorOptions<TInitialContext, TErrorMap>, PromiseWithError<InferSchemaOutput<TOutputSchema>, ORPCErrorFromErrorMap<TErrorMap> | ThrowableError>>;
152
+ type ProcedureClientOptions<TInitialContext extends Context, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TClientContext extends ClientContext> = {
164
153
  path?: string[];
165
- interceptors?: ProcedureClientInterceptor<TInitialContext, TOutputSchema, TErrorMap, TReturnedError>[];
154
+ interceptors?: ProcedureClientInterceptor<TInitialContext, TOutputSchema, TErrorMap>[];
166
155
  } & (object extends TInitialContext ? {
167
156
  context?: Value<Promisable<TInitialContext>, [clientContext: TClientContext]>;
168
157
  } : {
169
158
  context: Value<Promisable<TInitialContext>, [clientContext: TClientContext]>;
170
159
  });
171
- declare function createProcedureClient<TInitialContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TReturnedError extends AnyORPCError, TClientContext extends ClientContext = object>(lazyableProcedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, TErrorMap, TReturnedError>>, ...rest: MaybeOptionalOptions<ProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TReturnedError, TClientContext>>): ProcedureClient<TClientContext, TInputSchema, TOutputSchema, TErrorMap, TReturnedError>;
160
+ declare function createProcedureClient<TInitialContext extends Context, TInputSchema extends AnySchema, TOutputSchema extends AnySchema, TErrorMap extends ErrorMap, TClientContext extends ClientContext = object>(lazyableProcedure: Lazyable<Procedure<TInitialContext, any, TInputSchema, TOutputSchema, TErrorMap>>, ...rest: MaybeOptionalOptions<ProcedureClientOptions<TInitialContext, TOutputSchema, TErrorMap, TClientContext>>): ProcedureClient<TClientContext, TInputSchema, TOutputSchema, TErrorMap>;
172
161
 
173
162
  export { Procedure as a, Lazy as h, createProcedureClient as u, unlazy as v };
174
163
  export type { AnyProcedure as A, Context as C, Lazyable as L, MergedContext as M, OrderedMiddleware as O, ProcedureClientOptions as P, ProcedureClient as b, ProcedureClientInterceptor as c, Middleware as d, MergedInitialContext as e, ProcedureConfig as f, AnyMiddleware as g, ProcedureHandler as i, LazyDefinition as j, MiddlewareDefinition as k, MiddlewareDone as l, MiddlewareDoneOptions as m, MiddlewareNext as n, MiddlewareNextOptions as o, MiddlewareOptions as p, MiddlewareResult as q, ProcedureClientInterceptorOptions as r, ProcedureDefinition as s, ProcedureHandlerOptions as t };
@@ -1,5 +1,5 @@
1
- import { C as Context } from './server.CwrYlF72.mjs';
2
- import { S as StandardHandlerPlugin, a as StandardHandlerOptions } from './server.JbCIPL4P.mjs';
1
+ import { C as Context } from './server.BsujoJoF.mjs';
2
+ import { S as StandardHandlerPlugin, a as StandardHandlerOptions } from './server.R0uHWfBo.mjs';
3
3
 
4
4
  interface RequestLimitHandlerPluginOptions {
5
5
  /**
@@ -1,10 +1,10 @@
1
1
  import { RouterContract, ProcedureContract, ORPCErrorFromErrorMap, ThrowableError, InferSchemaInput, InferSchemaOutput } from '@orpc/contract';
2
- import { C as Context, a as Procedure, L as Lazyable, M as MergedContext } from './server.CwrYlF72.mjs';
2
+ import { C as Context, a as Procedure, L as Lazyable, M as MergedContext } from './server.BsujoJoF.js';
3
3
 
4
- type Router<TInitialContext extends Context> = Procedure<TInitialContext, any, any, any, any, any> | {
4
+ type Router<TInitialContext extends Context> = Procedure<TInitialContext, any, any, any, any> | {
5
5
  [k: string]: Lazyable<Router<TInitialContext>>;
6
6
  };
7
- type ContractedRouter<T extends RouterContract, TInitialContext extends Context> = T extends ProcedureContract<infer $InputSchema, infer $OutputSchema, infer $ErrorMap> ? Procedure<TInitialContext, any, $InputSchema, $OutputSchema, $ErrorMap, never> : {
7
+ type ContractedRouter<T extends RouterContract, TInitialContext extends Context> = T extends ProcedureContract<infer $InputSchema, infer $OutputSchema, infer $ErrorMap> ? Procedure<TInitialContext, any, $InputSchema, $OutputSchema, $ErrorMap> : {
8
8
  [K in keyof T]: T[K] extends RouterContract ? Lazyable<ContractedRouter<T[K], TInitialContext>> : never;
9
9
  };
10
10
  type AnyRouter = Router<any>;
@@ -17,7 +17,7 @@ type InferRouterInitialContext<T extends AnyRouter> = T extends Router<infer $>
17
17
  *
18
18
  * @see {@link https://orpc.dev/docs/router#infer-router-initial-contexts | Router - Infer Router Initial Contexts}
19
19
  */
20
- type InferRouterInitialContexts<T extends AnyRouter> = T extends Procedure<infer UInitialContext, any, any, any, any, any> ? UInitialContext : {
20
+ type InferRouterInitialContexts<T extends AnyRouter> = T extends Procedure<infer UInitialContext, any, any, any, any> ? UInitialContext : {
21
21
  [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterInitialContexts<U> : never;
22
22
  };
23
23
  /**
@@ -28,7 +28,7 @@ type InferRouterInitialContexts<T extends AnyRouter> = T extends Procedure<infer
28
28
  *
29
29
  * @see {@link https://orpc.dev/docs/router#infer-router-final-contexts | Router - Infer Router Final Contexts}
30
30
  */
31
- type InferRouterFinalContexts<T extends AnyRouter> = T extends Procedure<infer UInitialContext, infer UInjectedContext, any, any, any, any> ? MergedContext<UInitialContext, UInjectedContext> : {
31
+ type InferRouterFinalContexts<T extends AnyRouter> = T extends Procedure<infer UInitialContext, infer UInjectedContext, any, any, any> ? MergedContext<UInitialContext, UInjectedContext> : {
32
32
  [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterFinalContexts<U> : never;
33
33
  };
34
34
  /**
@@ -39,7 +39,7 @@ type InferRouterFinalContexts<T extends AnyRouter> = T extends Procedure<infer U
39
39
  *
40
40
  * @see {@link https://orpc.dev/docs/router#infer-router-inputs | Router - Infer Router Inputs}
41
41
  */
42
- type InferRouterInputs<T extends AnyRouter> = T extends Procedure<any, any, infer UInputSchema, any, any, any> ? InferSchemaInput<UInputSchema> : {
42
+ type InferRouterInputs<T extends AnyRouter> = T extends Procedure<any, any, infer UInputSchema, any, any> ? InferSchemaInput<UInputSchema> : {
43
43
  [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterInputs<U> : never;
44
44
  };
45
45
  /**
@@ -50,7 +50,7 @@ type InferRouterInputs<T extends AnyRouter> = T extends Procedure<any, any, infe
50
50
  *
51
51
  * @see {@link https://orpc.dev/docs/router#infer-router-outputs | Router - Infer Router Outputs}
52
52
  */
53
- type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any, infer UOutputSchema, any, any> ? InferSchemaOutput<UOutputSchema> : {
53
+ type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any, infer UOutputSchema, any> ? InferSchemaOutput<UOutputSchema> : {
54
54
  [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterOutputs<U> : never;
55
55
  };
56
56
  /**
@@ -58,7 +58,7 @@ type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any
58
58
  *
59
59
  * @see {@link https://orpc.dev/docs/router#infer-router-error | Router - Infer Router Error}
60
60
  */
61
- type InferRouterError<T extends AnyRouter> = T extends Procedure<any, any, any, any, infer UErrorMap, infer UReturnedError> ? ORPCErrorFromErrorMap<UErrorMap> | UReturnedError | ThrowableError : {
61
+ type InferRouterError<T extends AnyRouter> = T extends Procedure<any, any, any, any, infer UErrorMap> ? ORPCErrorFromErrorMap<UErrorMap> | ThrowableError : {
62
62
  [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterError<U> : never;
63
63
  }[keyof T];
64
64
  /**
@@ -66,7 +66,7 @@ type InferRouterError<T extends AnyRouter> = T extends Procedure<any, any, any,
66
66
  *
67
67
  * @see {@link https://orpc.dev/docs/router#infer-router-errors | Router - Infer Router Errors}
68
68
  */
69
- type InferRouterErrors<T extends AnyRouter> = T extends Procedure<any, any, any, any, infer UErrorMap, infer UReturnedError> ? ORPCErrorFromErrorMap<UErrorMap> | UReturnedError | ThrowableError : {
69
+ type InferRouterErrors<T extends AnyRouter> = T extends Procedure<any, any, any, any, infer UErrorMap> ? ORPCErrorFromErrorMap<UErrorMap> | ThrowableError : {
70
70
  [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterErrors<U> : never;
71
71
  };
72
72
 
@@ -1,7 +1,7 @@
1
1
  import { AnyORPCError } from '@orpc/client';
2
2
  import { OrderablePlugin, Interceptor, Promisable } from '@orpc/shared';
3
- import { StandardLazyRequest, StandardResponse } from '@standardserver/core';
4
- import { C as Context, c as ProcedureClientInterceptor, A as AnyProcedure } from './server.CwrYlF72.js';
3
+ import { StandardLazyRequest, StandardResponse } from '@standard-server/core';
4
+ import { C as Context, c as ProcedureClientInterceptor, A as AnyProcedure } from './server.BsujoJoF.js';
5
5
  import { Schema, ErrorMap } from '@orpc/contract';
6
6
 
7
7
  interface StandardHandlerPlugin<T extends Context> extends OrderablePlugin {
@@ -73,7 +73,7 @@ interface StandardHandlerOptions<TContext extends Context> {
73
73
  * ClientInterceptor equivalent with createRouterClient.interceptors / createProcedure.interceptors
74
74
  * useful for error handling, logging, metrics, etc. (not counting encoding/decoding)
75
75
  */
76
- clientInterceptors?: ProcedureClientInterceptor<TContext, Schema<unknown>, ErrorMap, any>[];
76
+ clientInterceptors?: ProcedureClientInterceptor<TContext, Schema<unknown>, ErrorMap>[];
77
77
  plugins?: StandardHandlerPlugin<TContext>[];
78
78
  }
79
79
  declare class StandardHandler<T extends Context> {
@@ -84,7 +84,7 @@ declare class StandardHandler<T extends Context> {
84
84
  constructor(codec: StandardHandlerCodec<T>, options: StandardHandlerOptions<T>);
85
85
  handle(request: StandardLazyRequest, { context, prefix }: StandardHandlerHandleOptions<T>): Promise<StandardHandlerHandleResult>;
86
86
  }
87
- declare class OtelHandlerPlugin implements StandardHandlerPlugin<any> {
87
+ declare class TracingHandlerPlugin implements StandardHandlerPlugin<any> {
88
88
  name: string;
89
89
  init(options: StandardHandlerOptions<any>): StandardHandlerOptions<any>;
90
90
  }
@@ -100,5 +100,5 @@ interface StandardHandlerCodec<T extends Context> {
100
100
  encodeError(error: AnyORPCError, procedure: AnyProcedure, path: string[], options: StandardHandlerHandleOptions<T>): Promisable<StandardResponse>;
101
101
  }
102
102
 
103
- export { CompositeStandardHandlerPlugin as C, OtelHandlerPlugin as O, StandardHandler as b };
103
+ export { CompositeStandardHandlerPlugin as C, TracingHandlerPlugin as T, StandardHandler as b };
104
104
  export type { StandardHandlerPlugin as S, StandardHandlerOptions as a, StandardHandlerHandleOptions as c, StandardHandlerCodec as d, StandardHandlerCodecResolvedProcedure as e, StandardHandlerRoutingInterceptorOptions as f, StandardHandlerInterceptorOptions as g, StandardHandlerHandleResult as h, StandardHandlerInterceptor as i, StandardHandlerRoutingInterceptor as j };
@@ -1,10 +1,10 @@
1
1
  import { RPCSerializer, AnyORPCError } from '@orpc/client';
2
- import { Value, Promisable } from '@orpc/shared';
3
- import { StandardMethod, StandardLazyRequest, StandardResponse } from '@standardserver/core';
4
- import { A as AnyProcedure, C as Context } from './server.CwrYlF72.mjs';
5
- import { A as AnyRouter } from './server.Dm0os-OP.mjs';
2
+ import { Value, Public, Promisable } from '@orpc/shared';
3
+ import { StandardMethod, StandardLazyRequest, StandardResponse } from '@standard-server/core';
4
+ import { A as AnyProcedure, C as Context } from './server.BsujoJoF.mjs';
5
+ import { A as AnyRouter } from './server.BpmUhems.mjs';
6
6
  import { AnyProcedureContract } from '@orpc/contract';
7
- import { c as StandardHandlerHandleOptions, d as StandardHandlerCodec, e as StandardHandlerCodecResolvedProcedure } from './server.JbCIPL4P.mjs';
7
+ import { c as StandardHandlerHandleOptions, d as StandardHandlerCodec, e as StandardHandlerCodecResolvedProcedure } from './server.R0uHWfBo.mjs';
8
8
 
9
9
  /**
10
10
  * Methods that can invoke procedures by default. Browsers cannot trigger them
@@ -58,7 +58,7 @@ interface RPCHandlerCodecOptions<T extends Context> extends RPCMatcherOptions {
58
58
  /**
59
59
  * Override the default RPC serializer.
60
60
  */
61
- serializer?: Pick<RPCSerializer, keyof RPCSerializer>;
61
+ serializer?: Public<RPCSerializer>;
62
62
  /**
63
63
  * Resolve HTTP status for encoded successful outputs.
64
64
  *
@@ -1,6 +1,6 @@
1
- import { wrapAsyncIteratorPreservingEventMeta, ORPCError, cloneORPCError } from '@orpc/client';
1
+ import { wrapAsyncIteratorPreservingEventMeta, ORPCError } from '@orpc/client';
2
2
  import { createORPCErrorConstructorMap, reconcileORPCError, ValidationError, ProcedureContract } from '@orpc/contract';
3
- import { getConstructor, isTypescriptObject, resolveMaybeOptionalOptions, toArray, value, runWithSpan, intercept, isAsyncIteratorObject, override, traceAsyncIterator, traceReadableStream, isPlainObject, mergeTwoLevels } from '@orpc/shared';
3
+ import { getConstructor, isTypescriptObject, resolveMaybeOptionalOptions, toArray, value, runWithSpan, intercept, isAsyncIteratorObject, override, getTracer, traceAsyncIterator, traceReadableStream, isPlainObject, mergeTwoLevels } from '@orpc/shared';
4
4
 
5
5
  class Lazy {
6
6
  "~orpc";
@@ -59,11 +59,10 @@ function createProcedureClient(lazyableProcedure, ...rest) {
59
59
  });
60
60
  if (isAsyncIteratorObject(output)) {
61
61
  return override(output, wrapAsyncIteratorPreservingEventMeta(
62
- traceAsyncIterator("consume_async_iterator_object_output", output),
62
+ getTracer() ? traceAsyncIterator("consume_async_iterator_object_output", output) : output,
63
63
  { mapError: reconcileError }
64
64
  ));
65
- }
66
- if (output instanceof ReadableStream) {
65
+ } else if (getTracer() && output instanceof ReadableStream) {
67
66
  return override(output, traceReadableStream("consume_octet_stream_output", output));
68
67
  }
69
68
  return output;
@@ -169,18 +168,6 @@ async function executeProcedureInternal(procedure, options) {
169
168
  "handler",
170
169
  () => procedure["~orpc"].handler({ ...options, context, input: currentInput }, currentInput)
171
170
  );
172
- if (currentOutput instanceof ORPCError) {
173
- if (procedure["~orpc"].opaqueReturnedErrors) {
174
- throw currentOutput;
175
- }
176
- if (currentOutput.inferable && !currentOutput.defined) {
177
- throw currentOutput;
178
- }
179
- const error = cloneORPCError(currentOutput);
180
- error.defined = false;
181
- error.inferable = true;
182
- throw error;
183
- }
184
171
  }
185
172
  const startOutputIndex = midIndex === 0 ? 0 : orderedMiddlewares[midIndex - 1].outputSchemasLengthAtUse ?? 0;
186
173
  const endOutputIndex = midIndex === orderedMiddlewares.length ? outputSchemas.length : orderedMiddlewares[midIndex].outputSchemasLengthAtUse ?? 0;
@@ -1,7 +1,7 @@
1
1
  import { AnyORPCError } from '@orpc/client';
2
2
  import { OrderablePlugin, Interceptor, Promisable } from '@orpc/shared';
3
- import { StandardLazyRequest, StandardResponse } from '@standardserver/core';
4
- import { C as Context, c as ProcedureClientInterceptor, A as AnyProcedure } from './server.CwrYlF72.mjs';
3
+ import { StandardLazyRequest, StandardResponse } from '@standard-server/core';
4
+ import { C as Context, c as ProcedureClientInterceptor, A as AnyProcedure } from './server.BsujoJoF.mjs';
5
5
  import { Schema, ErrorMap } from '@orpc/contract';
6
6
 
7
7
  interface StandardHandlerPlugin<T extends Context> extends OrderablePlugin {
@@ -73,7 +73,7 @@ interface StandardHandlerOptions<TContext extends Context> {
73
73
  * ClientInterceptor equivalent with createRouterClient.interceptors / createProcedure.interceptors
74
74
  * useful for error handling, logging, metrics, etc. (not counting encoding/decoding)
75
75
  */
76
- clientInterceptors?: ProcedureClientInterceptor<TContext, Schema<unknown>, ErrorMap, any>[];
76
+ clientInterceptors?: ProcedureClientInterceptor<TContext, Schema<unknown>, ErrorMap>[];
77
77
  plugins?: StandardHandlerPlugin<TContext>[];
78
78
  }
79
79
  declare class StandardHandler<T extends Context> {
@@ -84,7 +84,7 @@ declare class StandardHandler<T extends Context> {
84
84
  constructor(codec: StandardHandlerCodec<T>, options: StandardHandlerOptions<T>);
85
85
  handle(request: StandardLazyRequest, { context, prefix }: StandardHandlerHandleOptions<T>): Promise<StandardHandlerHandleResult>;
86
86
  }
87
- declare class OtelHandlerPlugin implements StandardHandlerPlugin<any> {
87
+ declare class TracingHandlerPlugin implements StandardHandlerPlugin<any> {
88
88
  name: string;
89
89
  init(options: StandardHandlerOptions<any>): StandardHandlerOptions<any>;
90
90
  }
@@ -100,5 +100,5 @@ interface StandardHandlerCodec<T extends Context> {
100
100
  encodeError(error: AnyORPCError, procedure: AnyProcedure, path: string[], options: StandardHandlerHandleOptions<T>): Promisable<StandardResponse>;
101
101
  }
102
102
 
103
- export { CompositeStandardHandlerPlugin as C, OtelHandlerPlugin as O, StandardHandler as b };
103
+ export { CompositeStandardHandlerPlugin as C, TracingHandlerPlugin as T, StandardHandler as b };
104
104
  export type { StandardHandlerPlugin as S, StandardHandlerOptions as a, StandardHandlerHandleOptions as c, StandardHandlerCodec as d, StandardHandlerCodecResolvedProcedure as e, StandardHandlerRoutingInterceptorOptions as f, StandardHandlerInterceptorOptions as g, StandardHandlerHandleResult as h, StandardHandlerInterceptor as i, StandardHandlerRoutingInterceptor as j };
@@ -1,5 +1,5 @@
1
- import { C as Context } from './server.CwrYlF72.js';
2
- import { S as StandardHandlerPlugin, a as StandardHandlerOptions } from './server.DrN1Pj1-.js';
1
+ import { C as Context } from './server.BsujoJoF.js';
2
+ import { S as StandardHandlerPlugin, a as StandardHandlerOptions } from './server.DEeCcNd6.js';
3
3
 
4
4
  interface RequestLimitHandlerPluginOptions {
5
5
  /**
@@ -1,8 +1,8 @@
1
1
  import { ORPCError, toORPCError, RPCSerializer, COMMON_ERROR_STATUS_MAP } from '@orpc/client';
2
- import { sortPlugins, getOpenTelemetryConfig, runWithSpan, toArray, matchesHttpPathPrefix, intercept, ORPC_NAME, isAsyncIteratorObject, override, traceAsyncIterator, recordSpanError, pathToHttpPath, normalizeHttpPath, value, parseEmptyableJSON, getOwn } from '@orpc/shared';
3
- import { flattenStandardHeader, parseStandardUrl } from '@standardserver/core';
4
- import { c as createProcedureClient, u as unlazy, P as Procedure } from './server.3Ex_8ISY.mjs';
5
- import { w as walkProcedureContractsSync, g as getRouter, c as createContractProcedure, D as DEFAULT_SUCCESS_STATUS, a as DEFAULT_ERROR_STATUS } from './server.S8BnCR3a.mjs';
2
+ import { sortPlugins, toArray, matchesHttpPathPrefix, intercept, getTracer, runWithSpan, ORPC_NAME, isAsyncIteratorObject, override, traceAsyncIterator, traceReadableStream, recordSpanError, pathToHttpPath, normalizeHttpPath, value, parseEmptyableJSON, getOwn } from '@orpc/shared';
3
+ import { flattenStandardHeader, parseStandardUrl } from '@standard-server/core';
4
+ import { c as createProcedureClient, u as unlazy, P as Procedure } from './server.Djb_ebJT.mjs';
5
+ import { w as walkProcedureContractsSync, g as getRouter, c as createContractProcedure, D as DEFAULT_SUCCESS_STATUS, a as DEFAULT_ERROR_STATUS } from './server.BYnwk7Xz.mjs';
6
6
 
7
7
  class CompositeStandardHandlerPlugin {
8
8
  name = "~composite";
@@ -24,7 +24,7 @@ class StandardHandler {
24
24
  constructor(codec, options) {
25
25
  this.codec = codec;
26
26
  options = new CompositeStandardHandlerPlugin([
27
- new OtelHandlerPlugin(),
27
+ new TracingHandlerPlugin(),
28
28
  ...toArray(options.plugins)
29
29
  ]).init(options);
30
30
  this.routingInterceptors = options.routingInterceptors;
@@ -42,7 +42,7 @@ class StandardHandler {
42
42
  this.routingInterceptors,
43
43
  { context, prefix, request },
44
44
  async ({ context: context2, prefix: prefix2, request: request2 }) => {
45
- const span = getOpenTelemetryConfig()?.trace.getActiveSpan();
45
+ const span = getTracer()?.getActiveSpan();
46
46
  let step;
47
47
  const matchedOrNot = await runWithSpan("find_procedure", () => this.codec.resolveProcedure(request2, { context: context2, prefix: prefix2 }));
48
48
  if (!matchedOrNot) {
@@ -63,8 +63,10 @@ class StandardHandler {
63
63
  step = "decode_input";
64
64
  let input = await runWithSpan("decode_input", decodeInput2);
65
65
  step = void 0;
66
- if (isAsyncIteratorObject(input)) {
66
+ if (getTracer() && isAsyncIteratorObject(input)) {
67
67
  input = override(input, traceAsyncIterator("consume_async_iterator_object_input", input));
68
+ } else if (getTracer() && input instanceof ReadableStream) {
69
+ input = override(input, traceReadableStream("consume_octet_stream_input", input));
68
70
  }
69
71
  const client = createProcedureClient(procedure2, {
70
72
  context: context3,
@@ -97,21 +99,19 @@ class StandardHandler {
97
99
  );
98
100
  }
99
101
  }
100
- class OtelHandlerPlugin {
101
- name = "~opentelemetry";
102
+ class TracingHandlerPlugin {
103
+ name = "~tracing";
102
104
  init(options) {
103
105
  return {
104
106
  ...options,
105
107
  routingInterceptors: [
106
- // Should be placed before user-provided interceptors to help them access the current active context.
108
+ // Should be placed before user-provided interceptors to help them access the current active span.
107
109
  async ({ next, request }) => {
108
- const otelConfig = getOpenTelemetryConfig();
109
- let propagationContext;
110
- if (otelConfig?.propagation) {
111
- propagationContext = otelConfig.propagation.extract(otelConfig.context.active(), request.headers);
112
- }
110
+ const tracer = getTracer();
111
+ const parent = tracer?.extract?.(request.headers);
112
+ const [pathname] = parseStandardUrl(request.url);
113
113
  return runWithSpan(
114
- { name: `${request.method} ${request.url}`, context: propagationContext },
114
+ { name: `${request.method} ${pathname}`, parent },
115
115
  () => next()
116
116
  );
117
117
  },
@@ -301,4 +301,4 @@ class RPCHandlerCodec {
301
301
  }
302
302
  }
303
303
 
304
- export { CompositeStandardHandlerPlugin as C, OtelHandlerPlugin as O, RPCHandlerCodec as R, StandardHandler as S, RPCMatcher as a, RPC_DEFAULT_ALLOW_METHODS as b };
304
+ export { CompositeStandardHandlerPlugin as C, RPCHandlerCodec as R, StandardHandler as S, TracingHandlerPlugin as T, RPCMatcher as a, RPC_DEFAULT_ALLOW_METHODS as b };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@orpc/server",
3
3
  "type": "module",
4
- "version": "2.0.0-beta.33",
4
+ "version": "2.0.0-beta.35",
5
5
  "description": "Build typesafe APIs with oRPC: RPC and OpenAPI support, middleware, and adapters for Node.js, Bun, Deno, Fetch, Fastify, WebSocket, AWS Lambda, and more",
6
6
  "license": "MIT",
7
7
  "funding": [
@@ -117,15 +117,15 @@
117
117
  }
118
118
  },
119
119
  "dependencies": {
120
- "@orpc/client": "2.0.0-beta.33",
121
- "@orpc/contract": "2.0.0-beta.33",
122
- "@orpc/shared": "2.0.0-beta.33",
123
- "@standardserver/aws-lambda": "^0.8.3",
124
- "@standardserver/core": "^0.8.3",
125
- "@standardserver/fastify": "^0.8.3",
126
- "@standardserver/fetch": "^0.8.3",
127
- "@standardserver/node": "^0.8.3",
128
- "@standardserver/peer": "^0.8.3",
120
+ "@orpc/client": "2.0.0-beta.35",
121
+ "@orpc/contract": "2.0.0-beta.35",
122
+ "@orpc/shared": "2.0.0-beta.35",
123
+ "@standard-server/aws-lambda": "~0.9.0",
124
+ "@standard-server/core": "~0.9.0",
125
+ "@standard-server/fastify": "~0.9.0",
126
+ "@standard-server/fetch": "~0.9.0",
127
+ "@standard-server/node": "~0.9.0",
128
+ "@standard-server/peer": "~0.9.0",
129
129
  "cookie": "^2.0.1"
130
130
  },
131
131
  "devDependencies": {