import { N as NextRestFrameworkConfig, B as BaseQuery, a as BaseContentType, F as FormDataContentType, T as TypedFormData, A as AnyContentTypeWithAutocompleteForMostCommonOnes, b as BaseParams, O as OutputObject, c as BaseOptions, d as BaseStatus, C as ContentTypesThatSupportInputValidation, Z as ZodFormSchema, e as OpenApiOperation, M as Modify, f as AnyCase, g as OpenApiPathItem } from './types-wqKDLBM8.mjs'; import { OpenAPIV3_1 } from 'openapi-types'; import { NextApiRequest, NextApiResponse } from 'next/types'; import { ValidMethod } from './constants.mjs'; import { z, ZodType } from 'zod'; import { R as RpcOperationDefinition, a as RpcClient } from './index-DyLm2-he.mjs'; export { r as rpcOperation } from './index-DyLm2-he.mjs'; import { NextRequest, NextResponse } from 'next/server'; import { I18NConfig } from 'next/dist/server/config-shared'; import { NextURL } from 'next/dist/server/web/next-url'; import { ResponseCookies } from 'next/dist/compiled/@edge-runtime/cookies'; declare const docsRoute: (_config?: NextRestFrameworkConfig) => { GET: { (_req: NextRequest, _context: { params: Promise; }): Promise>; _nextRestFrameworkConfig: Required & NextRestFrameworkConfig; }; }; interface TypedSearchParams extends URLSearchParams { get: (key: K) => string | null; getAll: (key: K) => string[]; } interface TypedNextURL extends NextURL { searchParams: TypedSearchParams; } interface TypedNextRequest extends NextRequest { method: Method; /*! Prevent parsing JSON body for GET requests. Form requests return parsed form data as JSON when the form schema is defined. */ json: Method extends 'GET' ? never : () => Promise; /*! Prevent parsing form data for GET and non-form requests. */ formData: Method extends 'GET' ? never : ContentType extends FormDataContentType ? () => Promise> : never; nextUrl: TypedNextURL; } type TypedHeaders = Modify, { [K in AnyCase<'Content-Type'>]?: ContentType; }>; interface TypedResponseInit extends globalThis.ResponseInit { nextConfig?: { basePath?: string; i18n?: I18NConfig; trailingSlash?: boolean; }; url?: string; status?: Status; headers?: TypedHeaders; } interface ModifiedRequest { headers?: Headers; } interface TypedMiddlewareResponseInit extends globalThis.ResponseInit { request?: ModifiedRequest; status?: Status; } declare const INTERNALS: unique symbol; declare class TypedNextResponseType extends Response { [INTERNALS]: { cookies: ResponseCookies; url?: NextURL; body?: Body; status?: Status; contentType?: ContentType; }; constructor(body?: BodyInit | null, init?: TypedResponseInit); get cookies(): ResponseCookies; static json(body: Body, init?: TypedResponseInit): TypedNextResponseType; static redirect(url: string | NextURL | URL, init?: number | TypedResponseInit): TypedNextResponseType; static rewrite(destination: string | NextURL | URL, init?: TypedMiddlewareResponseInit): TypedNextResponseType; static next(init?: TypedMiddlewareResponseInit): TypedNextResponseType; } declare const TypedNextResponse: typeof TypedNextResponseType; type RouteMiddleware> = ReadonlyArray>, TypedResponse = TypedNextResponseType, Outputs[number]['status'], Outputs[number]['contentType']> | NextResponse> | void> = (req: NextRequest, context: { params: BaseParams; }, options: InputOptions) => Promise | TypedResponse | OutputOptions; type TypedRouteHandler> = ReadonlyArray>, TypedResponse = TypedNextResponseType, Outputs[number]['status'], Outputs[number]['contentType']> | NextResponse> | void> = (req: TypedNextRequest, context: { params: Params; }, options: Options) => Promise | TypedResponse; interface InputObject$1 { contentType?: ContentType; /*! Body schema is supported only for certain content types that support input validation. */ body?: ContentType extends ContentTypesThatSupportInputValidation ? ContentType extends FormDataContentType ? ZodFormSchema : ZodType : never; /*! If defined, this will override the body schema for the OpenAPI spec. */ bodySchema?: OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject; query?: ZodType; /*! If defined, this will override the query schema for the OpenAPI spec. */ querySchema?: OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject; params?: ZodType; /*! If defined, this will override the params schema for the OpenAPI spec. */ paramsSchema?: OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject; } interface RouteOperationDefinition { openApiOperation?: OpenApiOperation; method: Method; input?: InputObject$1; outputs?: readonly OutputObject[]; middleware1?: RouteMiddleware; middleware2?: RouteMiddleware; middleware3?: RouteMiddleware; handler?: TypedRouteHandler; } declare const routeOperation: ({ openApiOperation, method }: { openApiOperation?: Partial, "description" | "externalDocs" | "deprecated" | "summary" | "servers" | "security" | "tags" | "parameters" | "callbacks">> | undefined; method: Method; }) => { input: (input: InputObject$1) => { outputs: []>(outputs: Outputs) => { middleware: (middleware1: RouteMiddleware, Outputs[number]["status"], Outputs[number]["contentType"]> | NextResponse>>) => { middleware: (middleware2: RouteMiddleware, Outputs[number]["status"], Outputs[number]["contentType"]> | NextResponse>>) => { middleware: (middleware3: RouteMiddleware, Outputs[number]["status"], Outputs[number]["contentType"]> | NextResponse>>) => { handler: (handler: TypedRouteHandler, Outputs[number]["status"], Outputs[number]["contentType"]> | NextResponse>>) => RouteOperationDefinition; }; handler: (handler: TypedRouteHandler, Outputs[number]["status"], Outputs[number]["contentType"]> | NextResponse>>) => RouteOperationDefinition; }; handler: (handler: TypedRouteHandler, Outputs[number]["status"], Outputs[number]["contentType"]> | NextResponse>>) => RouteOperationDefinition; }; handler: (handler: TypedRouteHandler, Outputs[number]["status"], Outputs[number]["contentType"]> | NextResponse>>) => RouteOperationDefinition; }; middleware: (middleware1: RouteMiddleware[], void | NextResponse | TypedNextResponseType>) => { middleware: (middleware2: RouteMiddleware[], void | NextResponse | TypedNextResponseType>) => { middleware: (middleware3: RouteMiddleware[], void | NextResponse | TypedNextResponseType>) => { outputs: []>(outputs: Outputs_1) => { handler: (handler: TypedRouteHandler, Outputs_1[number]["status"], Outputs_1[number]["contentType"]> | NextResponse>>) => RouteOperationDefinition; }; handler: (handler: TypedRouteHandler[], void | NextResponse | TypedNextResponseType>) => RouteOperationDefinition; }; outputs: []>(outputs: Outputs_2) => { handler: (handler: TypedRouteHandler, Outputs_2[number]["status"], Outputs_2[number]["contentType"]> | NextResponse>>) => RouteOperationDefinition; }; handler: (handler: TypedRouteHandler[], void | NextResponse | TypedNextResponseType>) => RouteOperationDefinition; }; outputs: []>(outputs: Outputs_3) => { handler: (handler: TypedRouteHandler, Outputs_3[number]["status"], Outputs_3[number]["contentType"]> | NextResponse>>) => RouteOperationDefinition; }; handler: (handler: TypedRouteHandler[], void | NextResponse | TypedNextResponseType>) => RouteOperationDefinition; }; handler: (handler: TypedRouteHandler[], void | NextResponse | TypedNextResponseType>) => RouteOperationDefinition; }; outputs: []>(outputs: Outputs_4) => { middleware: (middleware1: RouteMiddleware, Outputs_4[number]["status"], Outputs_4[number]["contentType"]> | NextResponse>>) => { middleware: (middleware2: RouteMiddleware, Outputs_4[number]["status"], Outputs_4[number]["contentType"]> | NextResponse>>) => { middleware: (middleware3: RouteMiddleware, Outputs_4[number]["status"], Outputs_4[number]["contentType"]> | NextResponse>>) => { handler: (handler: TypedRouteHandler, Outputs_4[number]["status"], Outputs_4[number]["contentType"]> | NextResponse>>) => RouteOperationDefinition; }; handler: (handler: TypedRouteHandler, Outputs_4[number]["status"], Outputs_4[number]["contentType"]> | NextResponse>>) => RouteOperationDefinition; }; handler: (handler: TypedRouteHandler, Outputs_4[number]["status"], Outputs_4[number]["contentType"]> | NextResponse>>) => RouteOperationDefinition; }; handler: (handler: TypedRouteHandler, Outputs_4[number]["status"], Outputs_4[number]["contentType"]> | NextResponse>>) => RouteOperationDefinition; }; middleware: (middleware1: RouteMiddleware[], void | NextResponse | TypedNextResponseType>) => { middleware: (middleware2: RouteMiddleware[], void | NextResponse | TypedNextResponseType>) => { middleware: (middleware3: RouteMiddleware[], void | NextResponse | TypedNextResponseType>) => { handler: (handler: TypedRouteHandler[], void | NextResponse | TypedNextResponseType>) => RouteOperationDefinition; }; handler: (handler: TypedRouteHandler[], void | NextResponse | TypedNextResponseType>) => RouteOperationDefinition; }; handler: (handler: TypedRouteHandler[], void | NextResponse | TypedNextResponseType>) => RouteOperationDefinition; }; handler: (handler: TypedRouteHandler) => RouteOperationDefinition; }; declare const route: >>(operations: T, options?: { openApiPath?: OpenApiPathItem; }) => { [key in T[keyof T]["method"]]: { (_req: NextRequest, context: { params: Promise; }): Promise | TypedNextResponseType>; _getPathsForRoute(route: string): Promise; }; }; declare const rpcRoute: >>(operations: T, options?: { openApiPath?: OpenApiPathItem; }) => { POST: { (req: NextRequest, { params }: { params: Promise; }): Promise>; _getPathsForRoute(route: string): Promise; client: RpcClient; }; }; interface NrfOasData { paths?: OpenAPIV3_1.PathsObject; schemas?: Record; } type TypedNextApiRequest = Modify : Body; query: QueryAndParams; method: ValidMethod; }>; type TypedNextApiResponse = Modify, { status: (status: Status) => TypedNextApiResponse; redirect: (status: Status, url: string) => TypedNextApiResponse; setDraftMode: (options: { enable: boolean; }) => TypedNextApiResponse; setPreviewData: (data: object | string, options?: { maxAge?: number; path?: string; }) => TypedNextApiResponse; clearPreviewData: (options?: { path?: string; }) => TypedNextApiResponse; setHeader: | string, V extends number | string | readonly string[]>(name: K, value: K extends AnyCase<'Content-Type'> ? ContentType : V) => void; }>; type TypedApiRouteHandler> = ReadonlyArray>> = (req: TypedNextApiRequest, res: TypedNextApiResponse, Outputs[number]['status'], Outputs[number]['contentType']>, options: Options) => Promise | void; type ApiRouteMiddleware> = ReadonlyArray>> = (req: NextApiRequest, res: TypedNextApiResponse, Outputs[number]['status'], Outputs[number]['contentType']>, options: InputOptions) => Promise | void | Promise | OutputOptions; interface InputObject { contentType?: ContentType; /*! * Body schema is supported only for certain content types that support input validation. * multipart/form-data validation is also supported with app router. */ body?: ContentType extends ContentTypesThatSupportInputValidation ? ContentType extends FormDataContentType ? ZodFormSchema : ZodType : never; /*! If defined, this will override the body schema for the OpenAPI spec. */ bodySchema?: OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject; query?: ZodType; /*! If defined, this will override the query schema for the OpenAPI spec. */ querySchema?: OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject; params?: ZodType; /*! If defined, this will override the params schema for the OpenAPI spec. */ paramsSchema?: OpenAPIV3_1.SchemaObject | OpenAPIV3_1.ReferenceObject; } interface ApiRouteOperationDefinition { openApiOperation?: OpenApiOperation; method: Method; input?: InputObject; outputs?: readonly OutputObject[]; middleware1?: ApiRouteMiddleware; middleware2?: ApiRouteMiddleware; middleware3?: ApiRouteMiddleware; handler?: TypedApiRouteHandler; } declare const apiRouteOperation: ({ openApiOperation, method }: { openApiOperation?: Partial, "description" | "externalDocs" | "deprecated" | "summary" | "servers" | "security" | "tags" | "parameters" | "callbacks">> | undefined; method: Method; }) => { input: (input: InputObject) => { outputs: []>(outputs: Outputs) => { middleware: (middleware1: ApiRouteMiddleware) => { middleware: (middleware2: ApiRouteMiddleware) => { middleware: (middleware3: ApiRouteMiddleware) => { handler: (handler: TypedApiRouteHandler) => ApiRouteOperationDefinition; }; handler: (handler: TypedApiRouteHandler) => ApiRouteOperationDefinition; }; handler: (handler: TypedApiRouteHandler) => ApiRouteOperationDefinition; }; handler: (handler: TypedApiRouteHandler) => ApiRouteOperationDefinition; }; middleware: (middleware1: ApiRouteMiddleware[]>) => { middleware: (middleware2: ApiRouteMiddleware[]>) => { middleware: (middleware3: ApiRouteMiddleware[]>) => { outputs: []>(outputs: Outputs_1) => { handler: (handler: TypedApiRouteHandler) => ApiRouteOperationDefinition; }; handler: (handler: TypedApiRouteHandler[]>) => ApiRouteOperationDefinition; }; outputs: []>(outputs: Outputs_2) => { handler: (handler: TypedApiRouteHandler) => ApiRouteOperationDefinition; }; handler: (handler: TypedApiRouteHandler[]>) => ApiRouteOperationDefinition; }; outputs: []>(outputs: Outputs_3) => { handler: (handler: TypedApiRouteHandler) => ApiRouteOperationDefinition; }; handler: (handler: TypedApiRouteHandler[]>) => ApiRouteOperationDefinition; }; handler: (handler: TypedApiRouteHandler[]>) => ApiRouteOperationDefinition; }; outputs: []>(outputs: Outputs_4) => { middleware: (middleware1: ApiRouteMiddleware[]>) => { middleware: (middleware2: ApiRouteMiddleware[]>) => { middleware: (middleware3: ApiRouteMiddleware[]>) => { handler: (handler: TypedApiRouteHandler) => ApiRouteOperationDefinition; }; handler: (handler: TypedApiRouteHandler) => ApiRouteOperationDefinition; }; handler: (handler: TypedApiRouteHandler) => ApiRouteOperationDefinition; }; handler: (handler: TypedApiRouteHandler) => ApiRouteOperationDefinition; }; middleware: (middleware1: ApiRouteMiddleware[]>) => { middleware: (middleware2: ApiRouteMiddleware[]>) => { middleware: (middleware3: ApiRouteMiddleware[]>) => { handler: (handler: TypedApiRouteHandler[]>) => ApiRouteOperationDefinition; }; handler: (handler: TypedApiRouteHandler[]>) => ApiRouteOperationDefinition; }; handler: (handler: TypedApiRouteHandler[]>) => ApiRouteOperationDefinition; }; handler: (handler: TypedApiRouteHandler) => ApiRouteOperationDefinition; }; declare const apiRoute: >>(operations: T, options?: { openApiPath?: OpenApiPathItem; }) => { (req: NextApiRequest, res: NextApiResponse): Promise; _getPathsForRoute(route: string): Promise; }; declare const docsApiRoute: (_config?: NextRestFrameworkConfig) => { (req: NextApiRequest, res: NextApiResponse): Promise; _nextRestFrameworkConfig: Required & NextRestFrameworkConfig; }; declare const rpcApiRoute: >>(operations: T, options?: { openApiPath?: OpenApiPathItem; }) => { (req: NextApiRequest, res: NextApiResponse): Promise; _getPathsForRoute(route: string): Promise; client: RpcClient; }; export { type TypedNextApiRequest, type TypedNextApiResponse, type TypedNextRequest, TypedNextResponse, apiRoute, apiRouteOperation, docsApiRoute, docsRoute, route, routeOperation, rpcApiRoute, rpcRoute };