import type { Context, Router } from '@orpc/server' import type { AwsLambdaHandlerOptions } from '@orpc/server/aws-lambda' import { AwsLambdaHandler } from '@orpc/server/aws-lambda' import type { StandardHandlerOptions } from '@orpc/server/standard' import { StandardHandler } from '@orpc/server/standard' import type { OpenAPIHandlerCodecOptions } from '../standard/index' import { OpenAPIHandlerCodec } from '../standard/index' export interface OpenAPIHandlerOptions extends AwsLambdaHandlerOptions, StandardHandlerOptions, OpenAPIHandlerCodecOptions {} /** * Serves oRPC procedures over the OpenAPI (RESTful) protocol on AWS Lambda. * * @remarks * **Warning**: Requires the AWS Lambda Node.js runtime with response streaming enabled — handlers should be wrapped with `awslambda.streamifyResponse`. * * @see {@link https://orpc.dev/docs/adapters/aws-lambda | AWS Lambda Adapter} */ export class OpenAPIHandler extends AwsLambdaHandler { constructor(router: Router, options: NoInfer> = {}) { const codec = new OpenAPIHandlerCodec(router, options) const handler = new StandardHandler(codec, options) super(handler, options) } }