import { type ExpressiveJSONSchema } from 'ya-json-schema-types'; import { type OpenAPIExtension, type OpenAPIOperation, PATH_ITEM_METHODS } from 'ya-open-api-types'; import { type WhookRequestBody, type WhookResponse } from './http.js'; import { type Dependencies, type ServiceInitializer, type ProviderInitializer } from 'knifecycle'; import { type WhookHandlerWrapper } from './wrappers.js'; import { type WhookEnvironmentsConfig } from '../libs/environments.js'; import { type WhookAPICallbackDefinition, type WhookAPIHeaderDefinition, type WhookAPIParameterDefinition, type WhookAPIRequestBodyDefinition, type WhookAPIResponseDefinition, type WhookSchemasDeclarationModule } from '../index.js'; export declare const DEFAULT_ROUTE_CONFIG: WhookRouteConfig; export interface WhookBaseRouteConfig { environments?: WhookEnvironmentsConfig; private?: boolean; global?: boolean; targetHandler?: string; wrappers?: string[]; } export interface WhookRouteConfig extends WhookBaseRouteConfig { } export interface WhookRouteDefinition { path: `/${string}`; method: (typeof PATH_ITEM_METHODS)[number]; operation: OpenAPIOperation & { operationId: string; }; config?: WhookRouteConfig; } export interface WhookRouteHandlerExtraParameters { } export type WhookRouteHandlerParameters = (object | { body: WhookRequestBody; }) & { path: Record; query: Record; cookies: Record; headers: Record; } & WhookRouteHandlerExtraParameters; export type WhookRouteHandler

= (parameters: P, definition?: D) => Promise; export type WhookRouteHandlerInitializer, S extends WhookRouteHandler = WhookRouteHandler> = ServiceInitializer | ProviderInitializer; export declare const ROUTE_ASIDE_COMPONENTS_MAP: { readonly schemas: "Schema"; readonly parameters: "Parameter"; readonly headers: "Header"; readonly requestBodies: "RequestBody"; readonly responses: "Response"; readonly callbacks: "Callback"; }; export interface WhookAPIComponentsDeclarationModule extends WhookSchemasDeclarationModule { [name: `${string}Parameter`]: WhookAPIParameterDefinition; [name: `${string}Header`]: WhookAPIHeaderDefinition; [name: `${string}Response`]: WhookAPIResponseDefinition; [name: `${string}RequestBody`]: WhookAPIRequestBodyDefinition; [name: `${string}Callback`]: WhookAPICallbackDefinition; } export interface WhookRouteModule extends WhookSchemasDeclarationModule, WhookAPIComponentsDeclarationModule { default: WhookRouteHandlerInitializer; definition: WhookRouteDefinition; } export type WhookRouteHandlerWrapper = WhookHandlerWrapper; export interface WhookRouteTypeDefinition { requestBody?: unknown; responses?: { default?: { headers?: unknown; body?: unknown; }; [key: number]: { headers?: unknown; body?: unknown; }; }; parameters?: { path?: object; query?: object; headers?: object; cookies?: object; }; } export type WhookRouteTypedHandler = (parameters: (Partial['path']> extends NonNullable['path'] ? { path?: NonNullable['path']; } : { path: NonNullable['path']; }) & (Partial['query']> extends NonNullable['query'] ? { query?: NonNullable['query']; } : { query: NonNullable['query']; }) & (Partial['headers']> extends NonNullable['headers'] ? { headers?: NonNullable['headers']; } : { headers: NonNullable['headers']; }) & (Partial['cookies']> extends NonNullable['cookies'] ? { cookies?: NonNullable['cookies']; } : { cookies: NonNullable['cookies']; }) & WhookRouteHandlerExtraParameters & (T['requestBody'] extends object | string | number | boolean ? { body: T['requestBody']; options?: O; } : { options?: O; }), definition?: D) => Promise<{ [Status in keyof T['responses']]: { status: Status; } & T['responses'][Status]; }[keyof T['responses']]>;