import { Request as ExpressRequest, Response as ExpressResponse, NextFunction as ExpressNextFunction } from 'express'; import { IncomingHttpHeaders } from 'http'; import { SchemaObject } from 'openapi3-ts'; import { z } from 'zod'; import { PathVariables } from './parse-path'; export type ZodTypeWithMeta = z.ZodType & { metaOpenApi?: SchemaObject | SchemaObject[]; }; export type ZodHeaderValue = z.ZodString | z.ZodOptional; export type HeadersAnySchema = Record; export type ParsedHeaders = { [K in keyof H]: z.infer; }; export type ExpressoRequest

, Res, Req, H extends HeadersAnySchema> = ExpressRequest & { headers?: IncomingHttpHeaders & ParsedHeaders; }; export type HTTPMethod = 'get' | 'put' | 'post' | 'delete'; export type EndpointProps = { path: Path; input?: I; output?: O; headers?: H; operationId?: string; deprecated?: boolean; }; export type EndpointHandler = (req: ExpressoRequest, z.infer, z.infer, H>, res: ExpressResponse>, next: ExpressNextFunction) => Promise; export type Endpoint = EndpointProps & { method: M; handler: EndpointHandler; }; export type AnyEndpoint = Endpoint;