@orpc/server 0.0.0-next.ed05c40 → 0.0.0-next.ed87680

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 (58) hide show
  1. package/README.md +4 -2
  2. package/dist/adapters/aws-lambda/index.d.mts +5 -5
  3. package/dist/adapters/aws-lambda/index.d.ts +5 -5
  4. package/dist/adapters/aws-lambda/index.mjs +2 -2
  5. package/dist/adapters/bun-ws/index.d.mts +5 -5
  6. package/dist/adapters/bun-ws/index.d.ts +5 -5
  7. package/dist/adapters/bun-ws/index.mjs +10 -10
  8. package/dist/adapters/crossws/index.d.mts +5 -5
  9. package/dist/adapters/crossws/index.d.ts +5 -5
  10. package/dist/adapters/crossws/index.mjs +5 -7
  11. package/dist/adapters/fetch/index.d.mts +54 -9
  12. package/dist/adapters/fetch/index.d.ts +54 -9
  13. package/dist/adapters/fetch/index.mjs +73 -3
  14. package/dist/adapters/message-port/index.d.mts +5 -5
  15. package/dist/adapters/message-port/index.d.ts +5 -5
  16. package/dist/adapters/message-port/index.mjs +5 -7
  17. package/dist/adapters/node/index.d.mts +30 -9
  18. package/dist/adapters/node/index.d.ts +30 -9
  19. package/dist/adapters/node/index.mjs +68 -12
  20. package/dist/adapters/standard/index.d.mts +6 -6
  21. package/dist/adapters/standard/index.d.ts +6 -6
  22. package/dist/adapters/standard/index.mjs +2 -2
  23. package/dist/adapters/standard-peer/index.d.mts +9 -5
  24. package/dist/adapters/standard-peer/index.d.ts +9 -5
  25. package/dist/adapters/standard-peer/index.mjs +1 -1
  26. package/dist/adapters/websocket/index.d.mts +5 -5
  27. package/dist/adapters/websocket/index.d.ts +5 -5
  28. package/dist/adapters/websocket/index.mjs +5 -7
  29. package/dist/adapters/ws/index.d.mts +5 -5
  30. package/dist/adapters/ws/index.d.ts +5 -5
  31. package/dist/adapters/ws/index.mjs +5 -7
  32. package/dist/helpers/index.d.mts +5 -1
  33. package/dist/helpers/index.d.ts +5 -1
  34. package/dist/helpers/index.mjs +7 -1
  35. package/dist/hibernation/index.d.mts +11 -11
  36. package/dist/hibernation/index.d.ts +11 -11
  37. package/dist/hibernation/index.mjs +8 -8
  38. package/dist/index.d.mts +6 -6
  39. package/dist/index.d.ts +6 -6
  40. package/dist/index.mjs +5 -5
  41. package/dist/plugins/index.d.mts +2 -2
  42. package/dist/plugins/index.d.ts +2 -2
  43. package/dist/plugins/index.mjs +65 -56
  44. package/dist/shared/{server.CYNGeoCm.d.mts → server.B4BGqy3Y.d.mts} +2 -3
  45. package/dist/shared/{server.CYNGeoCm.d.ts → server.B4BGqy3Y.d.ts} +2 -3
  46. package/dist/shared/{server.D0H-iaY3.d.ts → server.COL12UTb.d.ts} +3 -3
  47. package/dist/shared/{server.BEFBl-Cb.d.mts → server.CVKCo60T.d.mts} +2 -2
  48. package/dist/shared/{server.NeumLVdS.mjs → server.CaqDCZX1.mjs} +105 -66
  49. package/dist/shared/{server.jMTkVNIb.d.ts → server.Cb6yD7DZ.d.ts} +1 -1
  50. package/dist/shared/{server.BU4WI18A.d.mts → server.Ck-gOLzq.d.mts} +3 -3
  51. package/dist/shared/{server.gqRxT-yN.d.mts → server.DBCUJijK.d.mts} +1 -1
  52. package/dist/shared/{server.B7b2w3_i.d.ts → server.DNtJ-p60.d.ts} +2 -2
  53. package/dist/shared/{server.Bmh5xd4n.d.ts → server.DPIFWpxG.d.ts} +1 -1
  54. package/dist/shared/{server.DhJj-1X9.d.mts → server.DzV1hr3z.d.mts} +1 -1
  55. package/dist/shared/server.UVMTOWrk.mjs +26 -0
  56. package/dist/shared/{server.CIL9uKTN.mjs → server.vzZSq5UM.mjs} +64 -39
  57. package/package.json +12 -11
  58. package/dist/shared/server.C6Q5sqYw.mjs +0 -20
@@ -1,13 +1,13 @@
1
1
  import { StandardRPCJsonSerializerOptions } from '@orpc/client/standard';
2
- import { g as StandardHandlerPlugin, e as StandardHandlerOptions } from '../shared/server.Bmh5xd4n.js';
3
- import { experimental_HibernationEventIterator } from '@orpc/standard-server';
4
- export { experimental_HibernationEventIterator, experimental_HibernationEventIteratorCallback } from '@orpc/standard-server';
5
- import { C as Context, R as Router } from '../shared/server.CYNGeoCm.js';
2
+ import { g as StandardHandlerPlugin, e as StandardHandlerOptions } from '../shared/server.DPIFWpxG.js';
3
+ import { HibernationEventIterator } from '@orpc/standard-server';
4
+ export { HibernationEventIterator, HibernationEventIteratorCallback } from '@orpc/standard-server';
5
+ import { C as Context, R as Router } from '../shared/server.B4BGqy3Y.js';
6
6
  import '@orpc/client';
7
7
  import '@orpc/contract';
8
8
  import '@orpc/shared';
9
9
 
10
- interface experimental_EncodeHibernationRPCEventOptions extends StandardRPCJsonSerializerOptions {
10
+ interface EncodeHibernationRPCEventOptions extends StandardRPCJsonSerializerOptions {
11
11
  /**
12
12
  * The type of event, each type corresponds a different operation
13
13
  *
@@ -24,21 +24,21 @@ interface experimental_EncodeHibernationRPCEventOptions extends StandardRPCJsonS
24
24
  *
25
25
  * @see {@link https://orpc.unnoq.com/docs/plugins/hibernation Hibernation Plugin}
26
26
  */
27
- declare function experimental_encodeHibernationRPCEvent(id: string, payload: unknown, options?: experimental_EncodeHibernationRPCEventOptions): string;
27
+ declare function encodeHibernationRPCEvent(id: string, payload: unknown, options?: EncodeHibernationRPCEventOptions): string;
28
28
 
29
- interface experimental_HibernationPluginContext {
30
- iterator?: experimental_HibernationEventIterator<any>;
29
+ interface HibernationPluginContext {
30
+ iterator?: HibernationEventIterator<any>;
31
31
  }
32
32
  /**
33
33
  * Enable Hibernation APIs
34
34
  *
35
35
  * @see {@link https://orpc.unnoq.com/docs/plugins/hibernation Hibernation Plugin}
36
36
  */
37
- declare class experimental_HibernationPlugin<T extends Context> implements StandardHandlerPlugin<T> {
37
+ declare class HibernationPlugin<T extends Context> implements StandardHandlerPlugin<T> {
38
38
  readonly CONTEXT_SYMBOL: symbol;
39
39
  order: number;
40
40
  init(options: StandardHandlerOptions<T>, _router: Router<any, T>): void;
41
41
  }
42
42
 
43
- export { experimental_HibernationPlugin, experimental_encodeHibernationRPCEvent };
44
- export type { experimental_EncodeHibernationRPCEventOptions, experimental_HibernationPluginContext };
43
+ export { HibernationPlugin, encodeHibernationRPCEvent };
44
+ export type { EncodeHibernationRPCEventOptions, HibernationPluginContext };
@@ -1,11 +1,11 @@
1
1
  import { toORPCError } from '@orpc/client';
2
2
  import { StandardRPCJsonSerializer } from '@orpc/client/standard';
3
3
  import { stringifyJSON } from '@orpc/shared';
4
- import { getEventMeta, experimental_HibernationEventIterator } from '@orpc/standard-server';
5
- export { experimental_HibernationEventIterator } from '@orpc/standard-server';
4
+ import { getEventMeta, HibernationEventIterator } from '@orpc/standard-server';
5
+ export { HibernationEventIterator } from '@orpc/standard-server';
6
6
  import { MessageType } from '@orpc/standard-server-peer';
7
7
 
8
- function experimental_encodeHibernationRPCEvent(id, payload, options = {}) {
8
+ function encodeHibernationRPCEvent(id, payload, options = {}) {
9
9
  const { event = "message", ...rest } = options;
10
10
  const serializer = new StandardRPCJsonSerializer(rest);
11
11
  const data = event === "error" ? toORPCError(payload).toJSON() : payload;
@@ -21,7 +21,7 @@ function experimental_encodeHibernationRPCEvent(id, payload, options = {}) {
21
21
  });
22
22
  }
23
23
 
24
- class experimental_HibernationPlugin {
24
+ class HibernationPlugin {
25
25
  CONTEXT_SYMBOL = Symbol("ORPC_HIBERNATION_CONTEXT");
26
26
  order = 2e6;
27
27
  // make sure execute after the batch plugin
@@ -33,8 +33,8 @@ class experimental_HibernationPlugin {
33
33
  const result = await options2.next({
34
34
  ...options2,
35
35
  context: {
36
- [this.CONTEXT_SYMBOL]: hibernationContext,
37
- ...options2.context
36
+ ...options2.context,
37
+ [this.CONTEXT_SYMBOL]: hibernationContext
38
38
  }
39
39
  });
40
40
  if (!result.matched || !hibernationContext.iterator) {
@@ -54,7 +54,7 @@ class experimental_HibernationPlugin {
54
54
  throw new TypeError("[HibernationPlugin] Hibernation context has been corrupted or modified by another plugin or interceptor");
55
55
  }
56
56
  const output = await options2.next();
57
- if (output instanceof experimental_HibernationEventIterator) {
57
+ if (output instanceof HibernationEventIterator) {
58
58
  hibernationContext.iterator = output;
59
59
  }
60
60
  return output;
@@ -62,4 +62,4 @@ class experimental_HibernationPlugin {
62
62
  }
63
63
  }
64
64
 
65
- export { experimental_HibernationPlugin, experimental_encodeHibernationRPCEvent };
65
+ export { HibernationPlugin, encodeHibernationRPCEvent };
package/dist/index.d.mts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { ORPCErrorJSON, ORPCError, Client, ClientContext, HTTPPath, HTTPMethod, ClientOptions, ClientPromiseResult } from '@orpc/client';
2
2
  export { ClientContext, HTTPMethod, HTTPPath, ORPCError, isDefinedError, safe } from '@orpc/client';
3
3
  import { AnySchema, ErrorMap, InferSchemaInput, InferSchemaOutput, ErrorFromErrorMap, Meta, MergedErrorMap, Route, Schema, ContractRouter, ContractProcedureDef, AnyContractRouter, ContractProcedure, InferContractRouterErrorMap, InferContractRouterMeta, AnyContractProcedure } from '@orpc/contract';
4
- export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, InputStructure, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, type } from '@orpc/contract';
4
+ export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, InputStructure, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, type, validateORPCError } from '@orpc/contract';
5
5
  import { ThrowableError, IntersectPick, MaybeOptionalOptions } from '@orpc/shared';
6
- export { EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, IntersectPick, Registry, ThrowableError, asyncIteratorToStream as eventIteratorToStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
7
- import { C as Context, P as Procedure, e as Middleware, O as ORPCErrorConstructorMap, M as MergedInitialContext, f as MergedCurrentContext, g as MapInputMiddleware, h as CreateProcedureClientOptions, i as ProcedureClient, j as ProcedureHandler, R as Router, c as Lazy, a as AnyMiddleware, b as AnyRouter, A as AnyProcedure, L as Lazyable, I as InferRouterInitialContext } from './shared/server.CYNGeoCm.mjs';
8
- export { J as InferRouterCurrentContexts, H as InferRouterInitialContexts, K as InferRouterInputs, N as InferRouterOutputs, o as LAZY_SYMBOL, p as LazyMeta, x as MiddlewareNextFn, w as MiddlewareNextFnOptions, z as MiddlewareOptions, y as MiddlewareOutputFn, t as MiddlewareResult, l as ORPCErrorConstructorMapItem, k as ORPCErrorConstructorMapItemOptions, d as ProcedureClientInterceptorOptions, E as ProcedureDef, D as ProcedureHandlerOptions, n as createORPCErrorConstructorMap, G as createProcedureClient, s as getLazyMeta, r as isLazy, F as isProcedure, q as lazy, m as mergeCurrentContext, B as middlewareOutputFn, u as unlazy, v as validateORPCError } from './shared/server.CYNGeoCm.mjs';
9
- import { E as EnhanceRouterOptions, a as EnhancedRouter } from './shared/server.DhJj-1X9.mjs';
10
- export { A as AccessibleLazyRouter, C as ContractProcedureCallbackOptions, L as LazyTraverseContractProceduresOptions, T as TraverseContractProcedureCallbackOptions, b as TraverseContractProceduresOptions, U as UnlaziedRouter, c as createAccessibleLazyRouter, e as enhanceRouter, g as getRouter, r as resolveContractProcedures, t as traverseContractProcedures, u as unlazyRouter } from './shared/server.DhJj-1X9.mjs';
6
+ export { AsyncIteratorClass, EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, IntersectPick, Registry, ThrowableError, asyncIteratorToStream as eventIteratorToStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
7
+ import { C as Context, P as Procedure, e as Middleware, O as ORPCErrorConstructorMap, M as MergedInitialContext, f as MergedCurrentContext, g as MapInputMiddleware, h as CreateProcedureClientOptions, i as ProcedureClient, j as ProcedureHandler, R as Router, c as Lazy, a as AnyMiddleware, b as AnyRouter, A as AnyProcedure, L as Lazyable, I as InferRouterInitialContext } from './shared/server.B4BGqy3Y.mjs';
8
+ export { H as InferRouterCurrentContexts, G as InferRouterInitialContexts, J as InferRouterInputs, K as InferRouterOutputs, o as LAZY_SYMBOL, p as LazyMeta, w as MiddlewareNextFn, v as MiddlewareNextFnOptions, y as MiddlewareOptions, x as MiddlewareOutputFn, t as MiddlewareResult, l as ORPCErrorConstructorMapItem, k as ORPCErrorConstructorMapItemOptions, d as ProcedureClientInterceptorOptions, D as ProcedureDef, B as ProcedureHandlerOptions, n as createORPCErrorConstructorMap, F as createProcedureClient, s as getLazyMeta, r as isLazy, E as isProcedure, q as lazy, m as mergeCurrentContext, z as middlewareOutputFn, u as unlazy } from './shared/server.B4BGqy3Y.mjs';
9
+ import { E as EnhanceRouterOptions, a as EnhancedRouter } from './shared/server.DzV1hr3z.mjs';
10
+ export { A as AccessibleLazyRouter, C as ContractProcedureCallbackOptions, L as LazyTraverseContractProceduresOptions, T as TraverseContractProcedureCallbackOptions, b as TraverseContractProceduresOptions, U as UnlaziedRouter, c as createAccessibleLazyRouter, e as enhanceRouter, g as getRouter, r as resolveContractProcedures, t as traverseContractProcedures, u as unlazyRouter } from './shared/server.DzV1hr3z.mjs';
11
11
  export { getEventMeta, withEventMeta } from '@orpc/standard-server';
12
12
 
13
13
  type ActionableError<T> = T extends ORPCError<infer U, infer V> ? ORPCErrorJSON<U, V> & {
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import { ORPCErrorJSON, ORPCError, Client, ClientContext, HTTPPath, HTTPMethod, ClientOptions, ClientPromiseResult } from '@orpc/client';
2
2
  export { ClientContext, HTTPMethod, HTTPPath, ORPCError, isDefinedError, safe } from '@orpc/client';
3
3
  import { AnySchema, ErrorMap, InferSchemaInput, InferSchemaOutput, ErrorFromErrorMap, Meta, MergedErrorMap, Route, Schema, ContractRouter, ContractProcedureDef, AnyContractRouter, ContractProcedure, InferContractRouterErrorMap, InferContractRouterMeta, AnyContractProcedure } from '@orpc/contract';
4
- export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, InputStructure, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, type } from '@orpc/contract';
4
+ export { ContractProcedure, ContractProcedureDef, ContractRouter, ErrorMap, ErrorMapItem, InferSchemaInput, InferSchemaOutput, InputStructure, MergedErrorMap, Meta, OutputStructure, Route, Schema, ValidationError, eventIterator, type, validateORPCError } from '@orpc/contract';
5
5
  import { ThrowableError, IntersectPick, MaybeOptionalOptions } from '@orpc/shared';
6
- export { EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, IntersectPick, Registry, ThrowableError, asyncIteratorToStream as eventIteratorToStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
7
- import { C as Context, P as Procedure, e as Middleware, O as ORPCErrorConstructorMap, M as MergedInitialContext, f as MergedCurrentContext, g as MapInputMiddleware, h as CreateProcedureClientOptions, i as ProcedureClient, j as ProcedureHandler, R as Router, c as Lazy, a as AnyMiddleware, b as AnyRouter, A as AnyProcedure, L as Lazyable, I as InferRouterInitialContext } from './shared/server.CYNGeoCm.js';
8
- export { J as InferRouterCurrentContexts, H as InferRouterInitialContexts, K as InferRouterInputs, N as InferRouterOutputs, o as LAZY_SYMBOL, p as LazyMeta, x as MiddlewareNextFn, w as MiddlewareNextFnOptions, z as MiddlewareOptions, y as MiddlewareOutputFn, t as MiddlewareResult, l as ORPCErrorConstructorMapItem, k as ORPCErrorConstructorMapItemOptions, d as ProcedureClientInterceptorOptions, E as ProcedureDef, D as ProcedureHandlerOptions, n as createORPCErrorConstructorMap, G as createProcedureClient, s as getLazyMeta, r as isLazy, F as isProcedure, q as lazy, m as mergeCurrentContext, B as middlewareOutputFn, u as unlazy, v as validateORPCError } from './shared/server.CYNGeoCm.js';
9
- import { E as EnhanceRouterOptions, a as EnhancedRouter } from './shared/server.jMTkVNIb.js';
10
- export { A as AccessibleLazyRouter, C as ContractProcedureCallbackOptions, L as LazyTraverseContractProceduresOptions, T as TraverseContractProcedureCallbackOptions, b as TraverseContractProceduresOptions, U as UnlaziedRouter, c as createAccessibleLazyRouter, e as enhanceRouter, g as getRouter, r as resolveContractProcedures, t as traverseContractProcedures, u as unlazyRouter } from './shared/server.jMTkVNIb.js';
6
+ export { AsyncIteratorClass, EventPublisher, EventPublisherOptions, EventPublisherSubscribeIteratorOptions, IntersectPick, Registry, ThrowableError, asyncIteratorToStream as eventIteratorToStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
7
+ import { C as Context, P as Procedure, e as Middleware, O as ORPCErrorConstructorMap, M as MergedInitialContext, f as MergedCurrentContext, g as MapInputMiddleware, h as CreateProcedureClientOptions, i as ProcedureClient, j as ProcedureHandler, R as Router, c as Lazy, a as AnyMiddleware, b as AnyRouter, A as AnyProcedure, L as Lazyable, I as InferRouterInitialContext } from './shared/server.B4BGqy3Y.js';
8
+ export { H as InferRouterCurrentContexts, G as InferRouterInitialContexts, J as InferRouterInputs, K as InferRouterOutputs, o as LAZY_SYMBOL, p as LazyMeta, w as MiddlewareNextFn, v as MiddlewareNextFnOptions, y as MiddlewareOptions, x as MiddlewareOutputFn, t as MiddlewareResult, l as ORPCErrorConstructorMapItem, k as ORPCErrorConstructorMapItemOptions, d as ProcedureClientInterceptorOptions, D as ProcedureDef, B as ProcedureHandlerOptions, n as createORPCErrorConstructorMap, F as createProcedureClient, s as getLazyMeta, r as isLazy, E as isProcedure, q as lazy, m as mergeCurrentContext, z as middlewareOutputFn, u as unlazy } from './shared/server.B4BGqy3Y.js';
9
+ import { E as EnhanceRouterOptions, a as EnhancedRouter } from './shared/server.Cb6yD7DZ.js';
10
+ export { A as AccessibleLazyRouter, C as ContractProcedureCallbackOptions, L as LazyTraverseContractProceduresOptions, T as TraverseContractProcedureCallbackOptions, b as TraverseContractProceduresOptions, U as UnlaziedRouter, c as createAccessibleLazyRouter, e as enhanceRouter, g as getRouter, r as resolveContractProcedures, t as traverseContractProcedures, u as unlazyRouter } from './shared/server.Cb6yD7DZ.js';
11
11
  export { getEventMeta, withEventMeta } from '@orpc/standard-server';
12
12
 
13
13
  type ActionableError<T> = T extends ORPCError<infer U, infer V> ? ORPCErrorJSON<U, V> & {
package/dist/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
1
  import { mergeErrorMap, mergeMeta, mergeRoute, mergePrefix, mergeTags, isContractProcedure, getContractRouter, fallbackContractConfig } from '@orpc/contract';
2
- export { ValidationError, eventIterator, type } from '@orpc/contract';
3
- import { P as Procedure, b as addMiddleware, c as createProcedureClient, e as enhanceRouter, l as lazy, s as setHiddenRouterContract, u as unlazy, g as getRouter, i as isProcedure, d as isLazy, f as createAssertedLazyProcedure } from './shared/server.NeumLVdS.mjs';
4
- export { L as LAZY_SYMBOL, p as call, r as createAccessibleLazyRouter, a as createContractedProcedure, h as createORPCErrorConstructorMap, q as getHiddenRouterContract, j as getLazyMeta, n as isStartWithMiddlewares, m as mergeCurrentContext, o as mergeMiddlewares, k as middlewareOutputFn, w as resolveContractProcedures, t as traverseContractProcedures, x as unlazyRouter, v as validateORPCError } from './shared/server.NeumLVdS.mjs';
2
+ export { ValidationError, eventIterator, type, validateORPCError } from '@orpc/contract';
3
+ import { P as Procedure, b as addMiddleware, c as createProcedureClient, e as enhanceRouter, l as lazy, s as setHiddenRouterContract, u as unlazy, g as getRouter, i as isProcedure, d as isLazy, f as createAssertedLazyProcedure } from './shared/server.CaqDCZX1.mjs';
4
+ export { L as LAZY_SYMBOL, p as call, r as createAccessibleLazyRouter, a as createContractedProcedure, h as createORPCErrorConstructorMap, q as getHiddenRouterContract, j as getLazyMeta, n as isStartWithMiddlewares, m as mergeCurrentContext, o as mergeMiddlewares, k as middlewareOutputFn, v as resolveContractProcedures, t as traverseContractProcedures, w as unlazyRouter } from './shared/server.CaqDCZX1.mjs';
5
5
  import { toORPCError } from '@orpc/client';
6
6
  export { ORPCError, isDefinedError, safe } from '@orpc/client';
7
7
  import { resolveMaybeOptionalOptions } from '@orpc/shared';
8
- export { EventPublisher, asyncIteratorToStream as eventIteratorToStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
8
+ export { AsyncIteratorClass, EventPublisher, asyncIteratorToStream as eventIteratorToStream, onError, onFinish, onStart, onSuccess, streamToAsyncIteratorClass as streamToEventIterator } from '@orpc/shared';
9
9
  export { getEventMeta, withEventMeta } from '@orpc/standard-server';
10
10
 
11
11
  const DEFAULT_CONFIG = {
@@ -21,7 +21,7 @@ function fallbackConfig(key, value) {
21
21
  }
22
22
 
23
23
  function decorateMiddleware(middleware) {
24
- const decorated = (...args) => middleware(...args);
24
+ const decorated = ((...args) => middleware(...args));
25
25
  decorated.mapInput = (mapInput) => {
26
26
  const mapped = decorateMiddleware(
27
27
  (options, input, ...rest) => middleware(options, mapInput(input), ...rest)
@@ -1,8 +1,8 @@
1
1
  import { Value, Promisable } from '@orpc/shared';
2
2
  import { StandardRequest, StandardHeaders } from '@orpc/standard-server';
3
3
  import { BatchResponseBodyItem } from '@orpc/standard-server/batch';
4
- import { d as StandardHandlerInterceptorOptions, g as StandardHandlerPlugin, e as StandardHandlerOptions } from '../shared/server.gqRxT-yN.mjs';
5
- import { C as Context, d as ProcedureClientInterceptorOptions } from '../shared/server.CYNGeoCm.mjs';
4
+ import { d as StandardHandlerInterceptorOptions, g as StandardHandlerPlugin, e as StandardHandlerOptions } from '../shared/server.DBCUJijK.mjs';
5
+ import { C as Context, d as ProcedureClientInterceptorOptions } from '../shared/server.B4BGqy3Y.mjs';
6
6
  import { Meta, ORPCError as ORPCError$1 } from '@orpc/contract';
7
7
  import { ORPCError } from '@orpc/client';
8
8
 
@@ -1,8 +1,8 @@
1
1
  import { Value, Promisable } from '@orpc/shared';
2
2
  import { StandardRequest, StandardHeaders } from '@orpc/standard-server';
3
3
  import { BatchResponseBodyItem } from '@orpc/standard-server/batch';
4
- import { d as StandardHandlerInterceptorOptions, g as StandardHandlerPlugin, e as StandardHandlerOptions } from '../shared/server.Bmh5xd4n.js';
5
- import { C as Context, d as ProcedureClientInterceptorOptions } from '../shared/server.CYNGeoCm.js';
4
+ import { d as StandardHandlerInterceptorOptions, g as StandardHandlerPlugin, e as StandardHandlerOptions } from '../shared/server.DPIFWpxG.js';
5
+ import { C as Context, d as ProcedureClientInterceptorOptions } from '../shared/server.B4BGqy3Y.js';
6
6
  import { Meta, ORPCError as ORPCError$1 } from '@orpc/contract';
7
7
  import { ORPCError } from '@orpc/client';
8
8
 
@@ -1,4 +1,4 @@
1
- import { value, isAsyncIteratorObject, clone } from '@orpc/shared';
1
+ import { runWithSpan, value, setSpanError, isAsyncIteratorObject, clone } from '@orpc/shared';
2
2
  import { flattenHeader } from '@orpc/standard-server';
3
3
  import { parseBatchRequest, toBatchResponse } from '@orpc/standard-server/batch';
4
4
  import { toFetchHeaders } from '@orpc/standard-server-fetch';
@@ -33,65 +33,74 @@ class BatchHandlerPlugin {
33
33
  }
34
34
  let isParsing = false;
35
35
  try {
36
- isParsing = true;
37
- const parsed = parseBatchRequest({ ...options2.request, body: await options2.request.body() });
38
- isParsing = false;
39
- const maxSize = await value(this.maxSize, options2);
40
- if (parsed.length > maxSize) {
41
- return {
42
- matched: true,
43
- response: {
44
- status: 413,
45
- headers: {},
46
- body: "Batch request size exceeds the maximum allowed size"
47
- }
48
- };
49
- }
50
- const responses = parsed.map(
51
- (request, index) => {
52
- const mapped = this.mapRequestItem(request, options2);
53
- return options2.next({ ...options2, request: { ...mapped, body: () => Promise.resolve(mapped.body) } }).then(({ response: response2, matched }) => {
54
- if (matched) {
55
- if (response2.body instanceof Blob || response2.body instanceof FormData || isAsyncIteratorObject(response2.body)) {
56
- return {
57
- index,
58
- status: 500,
59
- headers: {},
60
- body: "Batch responses do not support file/blob, or event-iterator. Please call this procedure separately outside of the batch request."
61
- };
62
- }
63
- return { ...response2, index };
36
+ return await runWithSpan({ name: "handle_batch_request" }, async (span) => {
37
+ const mode = xHeader === "buffered" ? "buffered" : "streaming";
38
+ isParsing = true;
39
+ const parsed = parseBatchRequest({ ...options2.request, body: await options2.request.body() });
40
+ isParsing = false;
41
+ span?.setAttribute("batch.mode", mode);
42
+ span?.setAttribute("batch.size", parsed.length);
43
+ const maxSize = await value(this.maxSize, options2);
44
+ if (parsed.length > maxSize) {
45
+ const message = "Batch request size exceeds the maximum allowed size";
46
+ setSpanError(span, message);
47
+ return {
48
+ matched: true,
49
+ response: {
50
+ status: 413,
51
+ headers: {},
52
+ body: message
64
53
  }
65
- return { index, status: 404, headers: {}, body: "No procedure matched" };
66
- }).catch(() => {
67
- return { index, status: 500, headers: {}, body: "Internal server error" };
68
- });
54
+ };
69
55
  }
70
- );
71
- await Promise.race(responses);
72
- const status = await value(this.successStatus, responses, options2);
73
- const headers = await value(this.headers, responses, options2);
74
- const response = await toBatchResponse({
75
- status,
76
- headers,
77
- mode: xHeader === "buffered" ? "buffered" : "streaming",
78
- body: async function* () {
79
- const promises = [...responses];
80
- while (true) {
81
- const handling = promises.filter((p) => p !== void 0);
82
- if (handling.length === 0) {
83
- return;
84
- }
85
- const result = await Promise.race(handling);
86
- promises[result.index] = void 0;
87
- yield result;
56
+ const responses = parsed.map(
57
+ (request, index) => {
58
+ const mapped = this.mapRequestItem(request, options2);
59
+ return options2.next({ ...options2, request: { ...mapped, body: () => Promise.resolve(mapped.body) } }).then(({ response: response2, matched }) => {
60
+ span?.addEvent(`response.${index}.${matched ? "success" : "not_matched"}`);
61
+ if (matched) {
62
+ if (response2.body instanceof Blob || response2.body instanceof FormData || isAsyncIteratorObject(response2.body)) {
63
+ return {
64
+ index,
65
+ status: 500,
66
+ headers: {},
67
+ body: "Batch responses do not support file/blob, or event-iterator. Please call this procedure separately outside of the batch request."
68
+ };
69
+ }
70
+ return { ...response2, index };
71
+ }
72
+ return { index, status: 404, headers: {}, body: "No procedure matched" };
73
+ }).catch((err) => {
74
+ Promise.reject(err);
75
+ return { index, status: 500, headers: {}, body: "Internal server error" };
76
+ });
88
77
  }
89
- }()
78
+ );
79
+ await Promise.race(responses);
80
+ const status = await value(this.successStatus, responses, options2);
81
+ const headers = await value(this.headers, responses, options2);
82
+ const response = await toBatchResponse({
83
+ status,
84
+ headers,
85
+ mode,
86
+ body: (async function* () {
87
+ const promises = [...responses];
88
+ while (true) {
89
+ const handling = promises.filter((p) => p !== void 0);
90
+ if (handling.length === 0) {
91
+ return;
92
+ }
93
+ const result = await Promise.race(handling);
94
+ promises[result.index] = void 0;
95
+ yield result;
96
+ }
97
+ })()
98
+ });
99
+ return {
100
+ matched: true,
101
+ response
102
+ };
90
103
  });
91
- return {
92
- matched: true,
93
- response
94
- };
95
104
  } catch (cause) {
96
105
  if (isParsing) {
97
106
  return {
@@ -13,7 +13,6 @@ type ORPCErrorConstructorMap<T extends ErrorMap> = {
13
13
  [K in keyof T]: K extends ORPCErrorCode ? T[K] extends ErrorMapItem<infer UInputSchema> ? ORPCErrorConstructorMapItem<K, InferSchemaInput<UInputSchema>> : never : never;
14
14
  };
15
15
  declare function createORPCErrorConstructorMap<T extends ErrorMap>(errors: T): ORPCErrorConstructorMap<T>;
16
- declare function validateORPCError(map: ErrorMap, error: ORPCError<any, any>): Promise<ORPCError<string, unknown>>;
17
16
 
18
17
  declare const LAZY_SYMBOL: unique symbol;
19
18
  interface LazyMeta {
@@ -190,5 +189,5 @@ type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any
190
189
  [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterOutputs<U> : never;
191
190
  };
192
191
 
193
- export { middlewareOutputFn as B, isProcedure as F, createProcedureClient as G, Procedure as P, mergeCurrentContext as m, createORPCErrorConstructorMap as n, LAZY_SYMBOL as o, lazy as q, isLazy as r, getLazyMeta as s, unlazy as u, validateORPCError as v };
194
- export type { AnyProcedure as A, Context as C, ProcedureHandlerOptions as D, ProcedureDef as E, InferRouterInitialContexts as H, InferRouterInitialContext as I, InferRouterCurrentContexts as J, InferRouterInputs as K, Lazyable as L, MergedInitialContext as M, InferRouterOutputs as N, ORPCErrorConstructorMap as O, Router as R, AnyMiddleware as a, AnyRouter as b, Lazy as c, ProcedureClientInterceptorOptions as d, Middleware as e, MergedCurrentContext as f, MapInputMiddleware as g, CreateProcedureClientOptions as h, ProcedureClient as i, ProcedureHandler as j, ORPCErrorConstructorMapItemOptions as k, ORPCErrorConstructorMapItem as l, LazyMeta as p, MiddlewareResult as t, MiddlewareNextFnOptions as w, MiddlewareNextFn as x, MiddlewareOutputFn as y, MiddlewareOptions as z };
192
+ export { isProcedure as E, createProcedureClient as F, Procedure as P, mergeCurrentContext as m, createORPCErrorConstructorMap as n, LAZY_SYMBOL as o, lazy as q, isLazy as r, getLazyMeta as s, unlazy as u, middlewareOutputFn as z };
193
+ export type { AnyProcedure as A, ProcedureHandlerOptions as B, Context as C, ProcedureDef as D, InferRouterInitialContexts as G, InferRouterCurrentContexts as H, InferRouterInitialContext as I, InferRouterInputs as J, InferRouterOutputs as K, Lazyable as L, MergedInitialContext as M, ORPCErrorConstructorMap as O, Router as R, AnyMiddleware as a, AnyRouter as b, Lazy as c, ProcedureClientInterceptorOptions as d, Middleware as e, MergedCurrentContext as f, MapInputMiddleware as g, CreateProcedureClientOptions as h, ProcedureClient as i, ProcedureHandler as j, ORPCErrorConstructorMapItemOptions as k, ORPCErrorConstructorMapItem as l, LazyMeta as p, MiddlewareResult as t, MiddlewareNextFnOptions as v, MiddlewareNextFn as w, MiddlewareOutputFn as x, MiddlewareOptions as y };
@@ -13,7 +13,6 @@ type ORPCErrorConstructorMap<T extends ErrorMap> = {
13
13
  [K in keyof T]: K extends ORPCErrorCode ? T[K] extends ErrorMapItem<infer UInputSchema> ? ORPCErrorConstructorMapItem<K, InferSchemaInput<UInputSchema>> : never : never;
14
14
  };
15
15
  declare function createORPCErrorConstructorMap<T extends ErrorMap>(errors: T): ORPCErrorConstructorMap<T>;
16
- declare function validateORPCError(map: ErrorMap, error: ORPCError<any, any>): Promise<ORPCError<string, unknown>>;
17
16
 
18
17
  declare const LAZY_SYMBOL: unique symbol;
19
18
  interface LazyMeta {
@@ -190,5 +189,5 @@ type InferRouterOutputs<T extends AnyRouter> = T extends Procedure<any, any, any
190
189
  [K in keyof T]: T[K] extends Lazyable<infer U extends AnyRouter> ? InferRouterOutputs<U> : never;
191
190
  };
192
191
 
193
- export { middlewareOutputFn as B, isProcedure as F, createProcedureClient as G, Procedure as P, mergeCurrentContext as m, createORPCErrorConstructorMap as n, LAZY_SYMBOL as o, lazy as q, isLazy as r, getLazyMeta as s, unlazy as u, validateORPCError as v };
194
- export type { AnyProcedure as A, Context as C, ProcedureHandlerOptions as D, ProcedureDef as E, InferRouterInitialContexts as H, InferRouterInitialContext as I, InferRouterCurrentContexts as J, InferRouterInputs as K, Lazyable as L, MergedInitialContext as M, InferRouterOutputs as N, ORPCErrorConstructorMap as O, Router as R, AnyMiddleware as a, AnyRouter as b, Lazy as c, ProcedureClientInterceptorOptions as d, Middleware as e, MergedCurrentContext as f, MapInputMiddleware as g, CreateProcedureClientOptions as h, ProcedureClient as i, ProcedureHandler as j, ORPCErrorConstructorMapItemOptions as k, ORPCErrorConstructorMapItem as l, LazyMeta as p, MiddlewareResult as t, MiddlewareNextFnOptions as w, MiddlewareNextFn as x, MiddlewareOutputFn as y, MiddlewareOptions as z };
192
+ export { isProcedure as E, createProcedureClient as F, Procedure as P, mergeCurrentContext as m, createORPCErrorConstructorMap as n, LAZY_SYMBOL as o, lazy as q, isLazy as r, getLazyMeta as s, unlazy as u, middlewareOutputFn as z };
193
+ export type { AnyProcedure as A, ProcedureHandlerOptions as B, Context as C, ProcedureDef as D, InferRouterInitialContexts as G, InferRouterCurrentContexts as H, InferRouterInitialContext as I, InferRouterInputs as J, InferRouterOutputs as K, Lazyable as L, MergedInitialContext as M, ORPCErrorConstructorMap as O, Router as R, AnyMiddleware as a, AnyRouter as b, Lazy as c, ProcedureClientInterceptorOptions as d, Middleware as e, MergedCurrentContext as f, MapInputMiddleware as g, CreateProcedureClientOptions as h, ProcedureClient as i, ProcedureHandler as j, ORPCErrorConstructorMapItemOptions as k, ORPCErrorConstructorMapItem as l, LazyMeta as p, MiddlewareResult as t, MiddlewareNextFnOptions as v, MiddlewareNextFn as w, MiddlewareOutputFn as x, MiddlewareOptions as y };
@@ -1,9 +1,9 @@
1
1
  import { StandardRPCJsonSerializerOptions } from '@orpc/client/standard';
2
- import { b as AnyRouter, C as Context, R as Router } from './server.CYNGeoCm.js';
3
- import { i as StandardMatcher, h as StandardMatchResult, e as StandardHandlerOptions, f as StandardHandler } from './server.Bmh5xd4n.js';
2
+ import { b as AnyRouter, C as Context, R as Router } from './server.B4BGqy3Y.js';
3
+ import { i as StandardMatcher, h as StandardMatchResult, e as StandardHandlerOptions, f as StandardHandler } from './server.DPIFWpxG.js';
4
4
  import { HTTPPath } from '@orpc/client';
5
5
  import { Value } from '@orpc/shared';
6
- import { T as TraverseContractProcedureCallbackOptions } from './server.jMTkVNIb.js';
6
+ import { T as TraverseContractProcedureCallbackOptions } from './server.Cb6yD7DZ.js';
7
7
 
8
8
  interface StandardRPCMatcherOptions {
9
9
  /**
@@ -1,5 +1,5 @@
1
- import { C as Context } from './server.CYNGeoCm.mjs';
2
- import { b as StandardHandleOptions } from './server.gqRxT-yN.mjs';
1
+ import { C as Context } from './server.B4BGqy3Y.mjs';
2
+ import { b as StandardHandleOptions } from './server.DBCUJijK.mjs';
3
3
 
4
4
  type FriendlyStandardHandleOptions<T extends Context> = Omit<StandardHandleOptions<T>, 'context'> & (Record<never, never> extends T ? {
5
5
  context?: T;
@@ -1,6 +1,7 @@
1
- import { isContractProcedure, ValidationError, mergePrefix, mergeErrorMap, enhanceRoute } from '@orpc/contract';
2
- import { resolveMaybeOptionalOptions, toArray, value, intercept } from '@orpc/shared';
3
- import { fallbackORPCErrorStatus, ORPCError } from '@orpc/client';
1
+ import { isContractProcedure, validateORPCError, ValidationError, mergePrefix, mergeErrorMap, enhanceRoute } from '@orpc/contract';
2
+ import { resolveMaybeOptionalOptions, toArray, value, runWithSpan, intercept, isAsyncIteratorObject, asyncIteratorWithSpan } from '@orpc/shared';
3
+ import { ORPCError, mapEventIterator } from '@orpc/client';
4
+ import { HibernationEventIterator } from '@orpc/standard-server';
4
5
 
5
6
  const LAZY_SYMBOL = Symbol("ORPC_LAZY_SYMBOL");
6
7
  function lazy(loader, meta = {}) {
@@ -87,21 +88,6 @@ function createORPCErrorConstructorMap(errors) {
87
88
  });
88
89
  return proxy;
89
90
  }
90
- async function validateORPCError(map, error) {
91
- const { code, status, message, data, cause, defined } = error;
92
- const config = map?.[error.code];
93
- if (!config || fallbackORPCErrorStatus(error.code, config.status) !== error.status) {
94
- return defined ? new ORPCError(code, { defined: false, status, message, data, cause }) : error;
95
- }
96
- if (!config.data) {
97
- return defined ? error : new ORPCError(code, { defined: true, status, message, data, cause });
98
- }
99
- const validated = await config.data["~standard"].validate(error.data);
100
- if (validated.issues) {
101
- return defined ? new ORPCError(code, { defined: false, status, message, data, cause }) : error;
102
- }
103
- return new ORPCError(code, { defined: true, status, message, data: validated.value, cause });
104
- }
105
91
 
106
92
  function middlewareOutputFn(output) {
107
93
  return { output, context: {} };
@@ -115,27 +101,51 @@ function createProcedureClient(lazyableProcedure, ...rest) {
115
101
  const clientContext = callerOptions?.context ?? {};
116
102
  const context = await value(options.context ?? {}, clientContext);
117
103
  const errors = createORPCErrorConstructorMap(procedure["~orpc"].errorMap);
104
+ const validateError = async (e) => {
105
+ if (e instanceof ORPCError) {
106
+ return await validateORPCError(procedure["~orpc"].errorMap, e);
107
+ }
108
+ return e;
109
+ };
118
110
  try {
119
- return await intercept(
120
- toArray(options.interceptors),
121
- {
122
- context,
123
- input,
124
- // input only optional when it undefinable so we can safely cast it
125
- errors,
126
- path,
127
- procedure,
128
- signal: callerOptions?.signal,
129
- lastEventId: callerOptions?.lastEventId
130
- },
131
- (interceptorOptions) => executeProcedureInternal(interceptorOptions.procedure, interceptorOptions)
111
+ const output = await runWithSpan(
112
+ { name: "call_procedure", signal: callerOptions?.signal },
113
+ (span) => {
114
+ span?.setAttribute("procedure.path", [...path]);
115
+ return intercept(
116
+ toArray(options.interceptors),
117
+ {
118
+ context,
119
+ input,
120
+ // input only optional when it undefinable so we can safely cast it
121
+ errors,
122
+ path,
123
+ procedure,
124
+ signal: callerOptions?.signal,
125
+ lastEventId: callerOptions?.lastEventId
126
+ },
127
+ (interceptorOptions) => executeProcedureInternal(interceptorOptions.procedure, interceptorOptions)
128
+ );
129
+ }
132
130
  );
133
- } catch (e) {
134
- if (!(e instanceof ORPCError)) {
135
- throw e;
131
+ if (isAsyncIteratorObject(output)) {
132
+ if (output instanceof HibernationEventIterator) {
133
+ return output;
134
+ }
135
+ return mapEventIterator(
136
+ asyncIteratorWithSpan(
137
+ { name: "consume_event_iterator_output", signal: callerOptions?.signal },
138
+ output
139
+ ),
140
+ {
141
+ value: (v) => v,
142
+ error: (e) => validateError(e)
143
+ }
144
+ );
136
145
  }
137
- const validated = await validateORPCError(procedure["~orpc"].errorMap, e);
138
- throw validated;
146
+ return output;
147
+ } catch (e) {
148
+ throw await validateError(e);
139
149
  }
140
150
  };
141
151
  }
@@ -144,31 +154,49 @@ async function validateInput(procedure, input) {
144
154
  if (!schema) {
145
155
  return input;
146
156
  }
147
- const result = await schema["~standard"].validate(input);
148
- if (result.issues) {
149
- throw new ORPCError("BAD_REQUEST", {
150
- message: "Input validation failed",
151
- data: {
152
- issues: result.issues
153
- },
154
- cause: new ValidationError({ message: "Input validation failed", issues: result.issues })
155
- });
156
- }
157
- return result.value;
157
+ return runWithSpan(
158
+ { name: "validate_input" },
159
+ async () => {
160
+ const result = await schema["~standard"].validate(input);
161
+ if (result.issues) {
162
+ throw new ORPCError("BAD_REQUEST", {
163
+ message: "Input validation failed",
164
+ data: {
165
+ issues: result.issues
166
+ },
167
+ cause: new ValidationError({
168
+ message: "Input validation failed",
169
+ issues: result.issues,
170
+ data: input
171
+ })
172
+ });
173
+ }
174
+ return result.value;
175
+ }
176
+ );
158
177
  }
159
178
  async function validateOutput(procedure, output) {
160
179
  const schema = procedure["~orpc"].outputSchema;
161
180
  if (!schema) {
162
181
  return output;
163
182
  }
164
- const result = await schema["~standard"].validate(output);
165
- if (result.issues) {
166
- throw new ORPCError("INTERNAL_SERVER_ERROR", {
167
- message: "Output validation failed",
168
- cause: new ValidationError({ message: "Output validation failed", issues: result.issues })
169
- });
170
- }
171
- return result.value;
183
+ return runWithSpan(
184
+ { name: "validate_output" },
185
+ async () => {
186
+ const result = await schema["~standard"].validate(output);
187
+ if (result.issues) {
188
+ throw new ORPCError("INTERNAL_SERVER_ERROR", {
189
+ message: "Output validation failed",
190
+ cause: new ValidationError({
191
+ message: "Output validation failed",
192
+ issues: result.issues,
193
+ data: output
194
+ })
195
+ });
196
+ }
197
+ return result.value;
198
+ }
199
+ );
172
200
  }
173
201
  async function executeProcedureInternal(procedure, options) {
174
202
  const middlewares = procedure["~orpc"].middlewares;
@@ -180,17 +208,28 @@ async function executeProcedureInternal(procedure, options) {
180
208
  currentInput = await validateInput(procedure, currentInput);
181
209
  }
182
210
  const mid = middlewares[index];
183
- const output = mid ? (await mid({
184
- ...options,
185
- context,
186
- next: async (...[nextOptions]) => {
187
- const nextContext = nextOptions?.context ?? {};
188
- return {
189
- output: await next(index + 1, mergeCurrentContext(context, nextContext), currentInput),
190
- context: nextContext
191
- };
211
+ const output = mid ? await runWithSpan(
212
+ { name: `middleware.${mid.name}`, signal: options.signal },
213
+ async (span) => {
214
+ span?.setAttribute("middleware.index", index);
215
+ span?.setAttribute("middleware.name", mid.name);
216
+ const result = await mid({
217
+ ...options,
218
+ context,
219
+ next: async (...[nextOptions]) => {
220
+ const nextContext = nextOptions?.context ?? {};
221
+ return {
222
+ output: await next(index + 1, mergeCurrentContext(context, nextContext), currentInput),
223
+ context: nextContext
224
+ };
225
+ }
226
+ }, currentInput, middlewareOutputFn);
227
+ return result.output;
192
228
  }
193
- }, currentInput, middlewareOutputFn)).output : await procedure["~orpc"].handler({ ...options, context, input: currentInput });
229
+ ) : await runWithSpan(
230
+ { name: "handler", signal: options.signal },
231
+ () => procedure["~orpc"].handler({ ...options, context, input: currentInput })
232
+ );
194
233
  if (index === outputValidationIndex) {
195
234
  return await validateOutput(procedure, output);
196
235
  }
@@ -367,4 +406,4 @@ function call(procedure, input, ...rest) {
367
406
  return createProcedureClient(procedure, options)(input, options);
368
407
  }
369
408
 
370
- export { LAZY_SYMBOL as L, Procedure as P, createContractedProcedure as a, addMiddleware as b, createProcedureClient as c, isLazy as d, enhanceRouter as e, createAssertedLazyProcedure as f, getRouter as g, createORPCErrorConstructorMap as h, isProcedure as i, getLazyMeta as j, middlewareOutputFn as k, lazy as l, mergeCurrentContext as m, isStartWithMiddlewares as n, mergeMiddlewares as o, call as p, getHiddenRouterContract as q, createAccessibleLazyRouter as r, setHiddenRouterContract as s, traverseContractProcedures as t, unlazy as u, validateORPCError as v, resolveContractProcedures as w, unlazyRouter as x };
409
+ export { LAZY_SYMBOL as L, Procedure as P, createContractedProcedure as a, addMiddleware as b, createProcedureClient as c, isLazy as d, enhanceRouter as e, createAssertedLazyProcedure as f, getRouter as g, createORPCErrorConstructorMap as h, isProcedure as i, getLazyMeta as j, middlewareOutputFn as k, lazy as l, mergeCurrentContext as m, isStartWithMiddlewares as n, mergeMiddlewares as o, call as p, getHiddenRouterContract as q, createAccessibleLazyRouter as r, setHiddenRouterContract as s, traverseContractProcedures as t, unlazy as u, resolveContractProcedures as v, unlazyRouter as w };