import { z } from 'zod'; /** * Base type for Zod object schemas used in API definitions. */ export type ZodBase = z.ZodObject; /** * Defines a standard API with both an input (DTO) and an output (VO) schema. */ export interface StdAPI { path: string; dtoSchema: DTO; voSchema: VO; } /** * Defines an argument-only API that accepts input (DTO) but does not return data. */ export interface ArgAPI { path: string; dtoSchema: DTO; voSchema?: never; } /** * Defines a return-only API that does not accept input but returns data (VO). */ export interface RetAPI { path: string; dtoSchema?: never; voSchema: VO; } /** * Defines a plain API that does not accept input or return data. */ export interface PlainAPI { path: string; dtoSchema?: never; voSchema?: never; } /** * Represents any of the possible API definitions (StdAPI, ArgAPI, RetAPI, PlainAPI). * The specific type is inferred based on the presence of `dtoSchema` and `voSchema`. */ export type API = (DTO extends ZodBase ? VO extends ZodBase ? StdAPI : ArgAPI : VO extends ZodBase ? RetAPI : PlainAPI) & { path: string; dtoSchema?: DTO; voSchema?: VO; }; /** * Defines a type-safe API endpoint. * @param def The API definition, including path and optional DTO/VO schemas. * @returns A strongly-typed API definition object that can be used with `implApi` and `clientOfAPI`. */ export declare function defineAPI(def: { path: string; dtoSchema?: DTO; voSchema?: VO; } & (DTO extends ZodBase ? VO extends ZodBase ? { dtoSchema: DTO; voSchema: VO; } : { dtoSchema: DTO; voSchema?: never; } : VO extends ZodBase ? { dtoSchema?: never; voSchema: VO; } : { dtoSchema?: never; voSchema?: never; })): API; //# sourceMappingURL=def.d.ts.map