/** * code-converters는 API 타입 정의들을 Zod 객체나 TypeScript 코드로 변환하는 함수들을 제공합니다. * * 1. API 시리즈들: * - ExtendedApi, ApiParam, ApiParamType * - API 메타데이터를 표현하는 타입 정의들 * * 2. ZodObject 변환 * - API 타입 정의 → Zod 타입 인스턴스 (런타임 밸리데이션용) * - getZodTypeFromApiParamType → getZodObjectFromApiParams → getZodObjectFromApi * * 3. TsTypeDef 변환 * - API 타입 정의 → TypeScript 타입 코드 문자열 (코드 생성용) * - apiParamTypeToTsType → apiParamToTsCode, apiParamToTsCodeAsObject * * 참고: * - ZodTypeDef 생성 (Zod 코드 문자열): zod-converter.ts의 zodTypeToZodCode 사용 * - EntityProp 변환: zod-converter.ts 참조 */ import { z } from "zod"; import { ApiParamType } from "../types/types"; import { type ApiParam } from "../types/types"; import { type ExtendedApi } from "./decorators"; /** * Promise 타입을 한 번 언래핑하여 내부 타입을 반환합니다. * Promise가 아닌 경우 원본 타입을 그대로 반환합니다. */ export declare function unwrapPromiseOnce(paramType: ApiParamType): ApiParamType | undefined; /** * ApiParamType을 Zod 타입 인스턴스로 변환합니다. * string, number, array, union 등 모든 ApiParamType을 처리하며, * 순환참조가 발생하는 경우 z.unknown()으로 fallback합니다. */ export declare function getZodTypeFromApiParamType(paramType: ApiParamType, references: { [id: string]: z.ZodType; }): z.ZodType; /** * ApiParam 배열을 ZodObject로 변환합니다. * 각 파라미터의 optional 여부를 반영하여 Zod 스키마를 생성합니다. */ export declare function getZodObjectFromApiParams(apiParams: ApiParam[], references?: { [id: string]: z.ZodType; }): z.ZodObject; /** * ExtendedApi를 ZodObject로 변환합니다. * TypeParameter와 일반 파라미터를 처리하며, * Context, RefKnex, _로 시작하는 optional 파라미터는 제외합니다. */ export declare function getZodObjectFromApi(api: ExtendedApi, references?: { [id: string]: z.ZodType; }): z.ZodObject; /** * ApiParamType을 TypeScript 타입 문자열로 변환합니다. * union, intersection, array, ref 등 모든 타입을 TS 문법으로 표현하며, * import가 필요한 타입 ID는 injectImportKeys에 수집합니다. */ export declare function apiParamTypeToTsType(paramType: ApiParamType, injectImportKeys: string[]): string; /** * ApiParam 배열을 TypeScript 함수 파라미터 코드로 변환합니다. * 예: "name: string, age?: number, active: boolean = true" */ export declare function apiParamToTsCode(params: ApiParam[], injectImportKeys: string[]): string; /** * ApiParam 배열을 TypeScript 객체 타입 코드로 변환합니다. * 예: "{ name: string, age?: number, active: boolean = true }" */ export declare function apiParamToTsCodeAsObject(params: ApiParam[], injectImportKeys: string[]): string; //# sourceMappingURL=code-converters.d.ts.map