import { OnApplicationBootstrap, DynamicModule } from '@nestjs/common'; import { ModuleRef } from '@nestjs/core'; interface OrmAdapter { list: (req: any, cfg: any) => Promise<{ items: any[]; pagination?: any; filters?: any[]; sorting?: any[]; }>; details: (req: any, cfg: any) => Promise; create: (req: any, cfg: any) => Promise; update: (req: any, cfg: any) => Promise; save?: (req: any, cfg: any) => Promise; delete: (req: any, cfg: any) => Promise; exists: (where: any, cfg: any) => Promise; findOne: (where: any, options: any, cfg: any) => Promise; normalizeInput: (input: any, model: any) => any; buildUniquenessWhere: (id: any, fields: string[], values: any, type: 'or' | 'and') => any; } interface ValidatorAdapter { generateSchemaFromModel: (model: any, isUpdate: boolean, exclude?: string[]) => any; validate: (input: any, schema: any) => { valid: boolean; errors: any[]; }; } interface PaginationInfo { page: number; perPage: number; totalPagesCount: number; totalItemsCount: number; isHavingNextPage: boolean; isHavingPreviousPage: boolean; } interface ListResponseEnvelope { data: T[]; errors: any[]; success: boolean; pagination: PaginationInfo; filters: Array<{ field: string; op: string; value: any; }>; sorting: Array<{ field: string; order: 'ASC' | 'DESC'; }>; meta?: Record; } interface DetailResponseEnvelope { data: T | null; errors: any[]; success: boolean; meta?: Record; } type ResponseFormatter = (ctx: { action: 'list' | 'details' | 'create' | 'update' | 'delete' | 'save'; payload: any; errors: any[]; success: boolean; meta?: { pagination?: PaginationInfo; filters?: Array<{ field: string; op: string; value: any; }>; sorting?: Array<{ field: string; order: 'ASC' | 'DESC'; }>; extra?: Record; meta?: Record; }; req: any; res: any; }) => any; interface Identity { id?: number | string; role?: string; merchant_id?: number; } type IdentityAccessor = (req: any) => Identity; type RoleChecker = (identity: Identity, requiredRoles?: string[]) => boolean; interface CrudModuleOptions { defaultOrm?: OrmAdapter; defaultValidator?: ValidatorAdapter; defaultResponseFormatter?: ResponseFormatter; identityAccessor?: IdentityAccessor; roleChecker?: RoleChecker; throwOnError?: boolean; swagger?: { enabled?: boolean; requestBodySchemaMode?: 'inline' | 'ref'; requestBodyContentTypes?: Array<'json' | 'form' | 'multipart'>; includeRelationsInWriteBody?: boolean; }; swaggerMeta?: { title?: string; version?: string; description?: string; }; exportContentTypes?: Array<'json' | 'csv' | 'excel'>; cache?: { enabled?: boolean; stdTTL?: number; checkperiod?: number; maxKeys?: number; invalidateListsOnWrite?: boolean; }; dataSource?: any; updateMethod?: 'put' | 'patch'; defaultFileStorage?: string; fileStorages?: Record; uploadLimits?: { maxSizeMB?: number; allowedMimeTypes?: string[]; }; uploadResponse?: { fileFieldMode?: 'filename_in_field' | 'key_url_fields'; includeBaseUrlsOn?: Array<'list' | 'details' | 'create' | 'update' | 'save'>; allowRequestOverride?: boolean; }; } declare class CrudmanModule implements OnApplicationBootstrap { private readonly moduleRef; constructor(moduleRef: ModuleRef); onApplicationBootstrap(): Promise; static forRoot(options?: CrudModuleOptions): DynamicModule; } declare class CrudmanService { private readonly moduleRef?; private config; private options; constructor(moduleRef?: ModuleRef | undefined); private getSection; private getResponseFormatter; private getValidator; private getOrm; getDataSource(): any; private buildHookContext; private applyHooks; private getCacheCfg; private cacheKey; private getActionCfg; private expandUploadableShorthand; private getValidatorsForTypeHint; private getEffectiveUploadCfg; private getStorageAdapter; private readFileBufferIfPath; private processUploads; private computeAdditionalResponse; private validateIfNeeded; private send; private sendNegotiated; list(section: string, req: any, res: any): Promise; details(section: string, req: any, res: any): Promise; create(section: string, req: any, res: any): Promise; update(section: string, req: any, res: any): Promise; save(section: string, req: any, res: any): Promise; delete(section: string, req: any, res: any): Promise; private invalidateSection; callAction(section: string, action: 'list' | 'details' | 'create' | 'update' | 'save' | 'delete', req: any, res: any, isResponseToBeSent?: boolean): Promise<{ statusCode: number; data: any; headers?: Record; }>; } declare const UseCrud: (config: any, options?: any) => ClassDecorator; declare const CrudList: (section: string, opts?: any) => (target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor) => void; declare const CrudDetails: (section: string, opts?: any) => (target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor) => void; declare const CrudCreate: (section: string, opts?: any) => (target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor) => void; declare const CrudUpdate: (section: string, opts?: any) => (target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor) => void; declare const CrudDelete: (section: string, opts?: any) => (target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor) => void; declare const CrudSave: (section: string, opts?: any) => (target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor) => void; declare const getCrudMeta: (target: any) => any; declare const CrudBulkImport: (section: string, opts?: any) => (target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor) => void; declare const CrudBulkDelete: (section: string, opts?: any) => (target: TFunction | object, propertyKey?: string | symbol, descriptor?: TypedPropertyDescriptor) => void; declare function CrudControllerBase(section: string | string[]): any; declare const defaultResponseFormatter: ResponseFormatter; declare function setCrudmanDataSource(dataSource: any): void; declare function getCrudmanDataSource(): any; declare function setCrudmanModuleRef(moduleRef: any): void; declare function getCrudmanModuleRef(): any; type UploadSource = 'multipart' | 'base64' | 'stream' | 'presigned'; type UploadStorageMode = 'filename' | 'base64' | 'blob'; interface UploadTargetFieldSingleFilename { key?: string; url?: string; } interface UploadTargetFieldArrayFilename { keys?: string; urls?: string; } interface UploadTargetFieldBlob { blob: string; mime: string; } type UploadTargetField = string | UploadTargetFieldSingleFilename | UploadTargetFieldArrayFilename | UploadTargetFieldBlob; interface UploadValidatorOptions { maxSizeMB?: number; allowedMimeTypes?: string[]; allowedExtensions?: string[]; } interface UploadMapEntry { sourceField: string; targetField: UploadTargetField; isArray?: boolean; storageMode: UploadStorageMode; storage?: string; sources?: UploadSource[]; deleteOnReplace?: boolean; mode?: 'replace' | 'append'; validators?: UploadValidatorOptions | any; keyPattern?: (ctx: { section: string; field: string; originalName?: string; ext?: string; uuid: string; }) => string; typeHint?: 'image' | 'video' | 'pdf' | 'doc' | 'any'; } interface UploadConfig { sources?: UploadSource[]; map: UploadMapEntry[]; } interface FileStorageSaveInput { buffer?: Buffer; stream?: NodeJS.ReadableStream; base64?: string; mime?: string; filename?: string; keyHint?: string; } interface FileStorageSaveResult { key: string; url?: string; mime?: string; size?: number; } interface FileStorageAdapter { save(input: FileStorageSaveInput): Promise; delete?(key: string): Promise; getUrl?(key: string): string | Promise; } type HookAction = 'list' | 'details' | 'create' | 'update' | 'save' | 'delete'; interface HookContext = Record, TRepos extends Record = Record> { service: any; repository?: any; moduleRef?: ModuleRef; section: string; action: HookAction; model: any; dataSource?: any; services?: TServices; repositories?: TRepos; [key: string]: unknown; } type ServicesMap = Record; type RepositoriesMap = Record; type ServicesInput = ServicesMap | ((req: any, res: any, cfg: any, moduleRef: ModuleRef) => ServicesMap | Promise); type RepositoriesInput = RepositoriesMap | ((req: any, res: any, cfg: any, moduleRef: ModuleRef) => RepositoriesMap | Promise); type ReservedKeys = 'service' | 'repository' | 'moduleRef' | 'section' | 'action' | 'model' | 'dataSource'; type AdditionalContext = Omit, ReservedKeys> & { services?: ServicesInput; repositories?: RepositoriesInput; }; type HookContextBuilder = (req: any, res: any, cfg: any, moduleRef: ModuleRef) => AdditionalContext | Promise; type HookContextObject = AdditionalContext; type CrudActionContext = HookContextBuilder | HookContextObject; type SortOrder = 'ASC' | 'DESC'; interface CrudActionConfig { onBeforeAction?: (req: any, res: any, ctx: HookContext) => Promise | boolean | void; onAfterAction?: (result: any, req: any, ctx: HookContext) => Promise | any | void; onBeforeQuery?: (builderOrOpts: any, model: any, ctx: HookContext, req: any, res: any) => Promise | any; onAfterFetch?: (data: any, req: any, ctx: HookContext, res: any) => Promise | any; onBeforeValidate?: (req: any, res: any, ctx: HookContext, rules: any, validator: any) => Promise | boolean | void; onAfterValidate?: (req: any, res: any, ctx: HookContext, errors: any[], validator: any) => Promise | boolean | void; getFinalValidationRules?: (generatedRules: any, ctx: HookContext, req: any, res: any, validator: any) => Promise | any; recordSelectionField?: string; additionalSettings?: any; additionalResponse?: Record | ((req: any, res: any, currentResponse: any) => any | Promise); getAdditionalResponse?: (req: any, res: any, currentResponse: any) => any | Promise; relations?: '*' | string[] | { include?: string[]; exclude?: string[]; }; getRelations?: (req: any, res: any, cfg: any) => Promise | (string[] | { include?: string[]; exclude?: string[]; } | '*' | undefined); attributes?: '*' | string[] | { include?: string[]; exclude?: string[]; }; conditions?: any; orderBy?: Array<[string, SortOrder]>; filtersWhitelist?: string[]; sortingWhitelist?: string[]; keywordParamName?: string; keyword?: { isEnabled?: boolean; isCaseSensitive?: boolean; minLength?: number; searchableFields?: string[]; maxRelationDepth?: 1 | 2 | 3; }; queryParamNames?: { page?: string; perPage?: string; paginate?: string; sortPrefix?: string; betweenOp?: string; minOp?: string; maxOp?: string; gtOp?: string; ltOp?: string; likeOp?: string; keyword?: string; }; pagination?: { isPaginationEnabled?: boolean; isDisableAllowed?: boolean; isDefaultEnabled?: boolean; maxPerPage?: number; }; responseHandler?: (result: any, req: any, res: any) => any; customImplementation?: (tag: 'list' | 'details' | 'create' | 'update' | 'delete' | 'save', params: any, req: any, res: any) => Promise | any; enableCache?: boolean | { ttl?: number; key?: (ctx: { section: string; action: string; req: any; relations?: string[]; }) => string; }; upload?: UploadConfig; uploadable?: Record; uploadDefaults?: { storage?: string; dir?: string; keyPrefix?: string; deleteOnReplace?: boolean; imageMaxSizeMB?: number; fileMaxSizeMB?: number; }; fieldsForUniquenessValidation?: string[]; conditionTypeForUniquenessValidation?: 'or' | 'and'; context?: CrudActionContext | { services?: ServicesInput; repositories?: RepositoriesInput; getHookContext?: HookContextBuilder; }; } interface CrudSectionConfig { model: any; title?: string; description?: string; ormType?: 'typeorm' | 'sequelize'; list?: CrudActionConfig; details?: CrudActionConfig; create?: CrudActionConfig; update?: CrudActionConfig; delete?: CrudActionConfig; save?: CrudActionConfig; fieldsForUniquenessValidation?: string[]; conditionTypeForUniquenessValidation?: 'or' | 'and'; requiredRoles?: string[]; ownership?: { field: string; relation?: string; }; validator?: any; orm?: any; swagger?: { enabled?: boolean; }; } interface CrudConfig { sections: Record; } interface SortItem { field: string; order: 'ASC' | 'DESC'; } interface FilterItem { field: string; op: string; value: any; param?: string; } interface LocalDiskOptions { dest: string; publicBaseUrl?: string; } declare class LocalDiskAdapter implements FileStorageAdapter { private opts; constructor(opts: LocalDiskOptions); save(input: FileStorageSaveInput): Promise; delete(key: string): Promise; getUrl(key: string): string; } declare const TypeormAdapter: OrmAdapter; declare function generateOpenApiSchemaFromEntity(entity: any): any | null; declare function registerSchemas(swagger: any, app: any, entities: any[]): void; declare function enhanceCrudSwaggerDocument(document: any): void; type AnyDecorator = (...args: any[]) => any; declare const ApiHeader: AnyDecorator; export { type AdditionalContext, ApiHeader, type CrudActionConfig, type CrudActionContext, CrudBulkDelete, CrudBulkImport, type CrudConfig, CrudControllerBase, CrudCreate, CrudDelete, CrudDetails, CrudList, type CrudModuleOptions, CrudSave, type CrudSectionConfig, CrudUpdate, CrudmanModule, CrudmanService, type DetailResponseEnvelope, type FileStorageAdapter, type FileStorageSaveInput, type FileStorageSaveResult, type FilterItem, type HookAction, type HookContext, type HookContextBuilder, type HookContextObject, type Identity, type IdentityAccessor, type ListResponseEnvelope, LocalDiskAdapter, type LocalDiskOptions, type OrmAdapter, type PaginationInfo, type RepositoriesInput, type RepositoriesMap, type ResponseFormatter, type RoleChecker, type ServicesInput, type ServicesMap, type SortItem, type SortOrder, TypeormAdapter, type UploadConfig, type UploadMapEntry, type UploadSource, type UploadStorageMode, type UploadTargetField, type UploadTargetFieldArrayFilename, type UploadTargetFieldBlob, type UploadTargetFieldSingleFilename, type UploadValidatorOptions, UseCrud, type ValidatorAdapter, defaultResponseFormatter, enhanceCrudSwaggerDocument, generateOpenApiSchemaFromEntity, getCrudMeta, getCrudmanDataSource, getCrudmanModuleRef, registerSchemas, setCrudmanDataSource, setCrudmanModuleRef };