import { Prettify } from "./helper.cjs"; import { StandardSchemaV1 } from "./standard-schema.cjs"; import { APIError, Status, statusCodes } from "./error.cjs"; import { CookieOptions, CookiePrefixOptions } from "./cookies.cjs"; import { InferBody, InferHeaders, InferMethod, InferParam, InferQuery, InferRequest, InferUse, InputContext } from "./context.cjs"; import { Middleware } from "./middleware.cjs"; import { OpenAPIParameter, OpenAPISchemaType } from "./openapi.cjs"; //#region src/endpoint.d.ts interface EndpointBaseOptions { /** * Query Schema */ query?: StandardSchemaV1; /** * Error Schema */ error?: StandardSchemaV1; /** * If true headers will be required to be passed in the context */ requireHeaders?: boolean; /** * If true request object will be required */ requireRequest?: boolean; /** * Clone the request object from the router */ cloneRequest?: boolean; /** * If true the body will be undefined */ disableBody?: boolean; /** * Endpoint metadata */ metadata?: { /** * Open API definition */ openapi?: { summary?: string; description?: string; tags?: string[]; operationId?: string; parameters?: OpenAPIParameter[]; requestBody?: { content: { "application/json": { schema: { type?: OpenAPISchemaType; properties?: Record; required?: string[]; $ref?: string; }; }; }; }; responses?: { [status: string]: { description: string; content?: { "application/json"?: { schema: { type?: OpenAPISchemaType; properties?: Record; required?: string[]; $ref?: string; }; }; "text/plain"?: { schema?: { type?: OpenAPISchemaType; properties?: Record; required?: string[]; $ref?: string; }; }; "text/html"?: { schema?: { type?: OpenAPISchemaType; properties?: Record; required?: string[]; $ref?: string; }; }; }; }; }; }; /** * Infer body and query type from ts interface * * useful for generic and dynamic types * * @example * ```ts * const endpoint = createEndpoint("/path", { * method: "POST", * body: z.record(z.string()), * $Infer: { * body: {} as { * type: InferTypeFromOptions