import { AnyProcedure, Context as Context$1, ORPCErrorConstructorMap, ProcedureHandlerOptions, ProcedureHandler, AnyORPCError } from '@orpc/server'; import { Context, Effect } from 'effect'; interface WithEffectContext { /** * A pre-built Effect context providing the services available within this oRPC context. * Automatically provided to any effect that runs under this context. * * @example * ```ts * import { Context } from 'effect' * * interface ServerContext extends WithEffectContext {} * * const context: ServerContext = { * 'effect/context': Context.empty().pipe( * Context.add(Random, { next: Effect.sync(() => Math.random()) }), * ), * } * ``` */ ['effect/context']: Context.Context; /** * An optional hook to wrap any effect before it is executed within this oRPC context. * Useful for adding observability, tracing, or error handling. * * @example * ```ts * import { Resource, Tracer } from '@effect/opentelemetry' * import { Context, Effect, Layer } from 'effect' * * interface ServerContext extends WithEffectContext {} * * const TracingLive = Tracer.layerGlobal.pipe( * Layer.provide(Resource.layerFromEnv()), * ) * * const context: ServerContext = { * 'effect/context': Context.empty(), * 'effect/wrap': (effect) => effect.pipe(Effect.provide(TracingLive)), * } * ``` */ ['effect/wrap']?: (effect: Effect.Effect, opts: { path: string[]; procedure: AnyProcedure; signal?: undefined | AbortSignal; }) => Effect.Effect; } type InferYieldError = [Eff] extends [never] ? never : [Eff] extends [Effect.Effect] ? E : never; interface HandlerGen ? S : never>, TReturn, TErrorConstructorMap extends ORPCErrorConstructorMap> { (opts: ProcedureHandlerOptions, input: TInput): Generator; } declare function handlerGen, TYield extends Effect.Effect ? S : never>, TReturn>(handler: HandlerGen): ProcedureHandler, AnyORPCError>, TErrorConstructorMap>; export { handlerGen as h }; export type { HandlerGen as H, InferYieldError as I, WithEffectContext as W };