import { type FastifyMultipartBaseOptions } from "@fastify/multipart"; import { type HTTPMethods } from "fastify"; import { type z } from "zod"; import { type CacheControlConfig } from "../cache-control/types"; import { type CompressConfig } from "../compress/types"; import { type TransactionalOptions } from "../database/puri-wrapper"; import { type DriverKey } from "../storage/drivers"; import { type KeyGenerator } from "../storage/types"; import { type ApiParam, type ApiParamType } from "../types/types"; export interface GuardKeys { query: true; admin: true; user: true; } export type GuardKey = keyof GuardKeys; export type ServiceClient = "axios" | "axios-multipart" | "tanstack-query" | "tanstack-mutation" | "tanstack-mutation-multipart" | "window-fetch"; export type ApiDecoratorOptions = { httpMethod?: HTTPMethods; contentType?: "text/plain" | "text/html" | "text/xml" | "application/json" | "application/octet-stream"; clients?: ServiceClient[]; path?: string; resourceName?: string; guards?: GuardKey[]; description?: string; timeout?: number; /** API 응답의 Cache-Control 헤더 설정. 설정하지 않으면 cacheControlHandler 또는 기본값이 적용됩니다. */ cacheControl?: CacheControlConfig; /** API 응답의 압축 설정. false로 설정하면 압축을 비활성화합니다. */ compress?: CompressConfig; }; export type StreamDecoratorOptions = { type: "sse"; events: z.ZodObject; path?: string; resourceName?: string; guards?: GuardKey[]; description?: string; }; export type WebSocketDecoratorOptions = { outEvents: z.ZodObject; inEvents: z.ZodObject; path?: string; resourceName?: string; guards?: GuardKey[]; description?: string; heartbeat?: number; maxPayload?: number; namespace?: string; }; export type ResolvedWebSocketDecoratorOptions = WebSocketDecoratorOptions & { outEventsTypeRef?: ApiParamType.Ref; inEventsTypeRef?: ApiParamType.Ref; }; type BufferUploadOptions = { consume?: "buffer"; }; type StreamUploadOptions = { consume: "stream"; destination: DriverKey; keyGenerator?: KeyGenerator; }; export type UploadDecoratorOptions = { guards?: GuardKey[]; description?: string; limits?: FastifyMultipartBaseOptions["limits"]; } & (BufferUploadOptions | StreamUploadOptions); export declare const registeredApis: { /** * modelName은 모델 클래스 이름입니다. (ex. "UserModel") */ modelName: string; methodName: string; path: string; options: ApiDecoratorOptions; streamOptions?: StreamDecoratorOptions; websocketOptions?: ResolvedWebSocketDecoratorOptions; uploadOptions?: UploadDecoratorOptions; }[]; export type ExtendedApi = { modelName: string; methodName: string; path: string; options: ApiDecoratorOptions; streamOptions?: StreamDecoratorOptions; websocketOptions?: ResolvedWebSocketDecoratorOptions; uploadOptions?: UploadDecoratorOptions; typeParameters: ApiParamType.TypeParam[]; parameters: ApiParam[]; returnType: ApiParamType; }; type DecoratorTarget = { constructor: { name: string; }; }; export declare function api(options?: ApiDecoratorOptions): (target: DecoratorTarget, propertyKey: string, descriptor: PropertyDescriptor) => void; export declare function stream(options: StreamDecoratorOptions): (target: DecoratorTarget, propertyKey: string, descriptor: PropertyDescriptor) => void; export declare function websocket(options: WebSocketDecoratorOptions): (target: DecoratorTarget, propertyKey: string, descriptor: PropertyDescriptor) => void; export declare function transactional(options?: TransactionalOptions): (target: DecoratorTarget, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor; /** * 파일 업로드 API를 생성해줍니다. (@api 데코레이터 없이 독립적으로 사용) * @param options * @returns */ export declare function upload(options?: UploadDecoratorOptions): (target: DecoratorTarget, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor; export {}; //# sourceMappingURL=decorators.d.ts.map