UNPKG

custom-automapper

Version:

A powerful, type-safe object mapping library for TypeScript and NestJS

36 lines 2.29 kB
import type { Mapper } from './mapper'; import type { ClassType, MappingConfig, MappingEntryOptions } from './types'; export declare class MappingBuilder<S extends object, D extends object> { private mapper; private source; private destination; private config; private options; constructor(mapper: Mapper, source: ClassType<S>, destination: ClassType<D>); forMember<K extends keyof D>(destinationKey: K, mapperFn: (source: S) => D[K]): this; forPath<K extends keyof D>(destinationKey: K, sourcePath: string): this; ignore<K extends keyof D>(destinationKey: K): this; forMemberIf<K extends keyof D>(destinationKey: K, condition: (source: S) => boolean, trueMapper: (source: S) => D[K], falseMapper?: (source: S) => D[K]): this; forNestedObject<K extends keyof D>(destinationKey: K, sourceProperty: (source: S) => any, nestedDestClass: ClassType<any>): this; forNestedArray<K extends keyof D>(destinationKey: K, sourceProperty: (source: S) => any[], itemDestClass: ClassType<any>): this; transform<K extends keyof D>(destinationKey: K, sourceProperty: (source: S) => any, transformer: (value: any) => D[K]): this; withDefault<K extends keyof D>(destinationKey: K, sourceProperty: (source: S) => any, defaultValue: D[K]): this; concat<K extends keyof D>(destinationKey: K, ...sourceProperties: Array<(source: S) => string>): this; withOptions(options: MappingEntryOptions): this; skipNulls(skip?: boolean): this; skipUndefined(skip?: boolean): this; deepClone(enable?: boolean): this; strict(enable?: boolean): this; beforeMap(hook: (source: S) => S | Promise<S>): this; afterMap(hook: (destination: D, source: S) => D | Promise<D>): this; register(): Mapper; reverseMap(): Mapper; } export declare abstract class MappingProfile { protected mapper: Mapper; constructor(mapper: Mapper); protected abstract configure(): void; protected createMap<S extends object, D extends object>(source: ClassType<S>, destination: ClassType<D>): MappingBuilder<S, D>; protected registerMap<S extends object, D extends object>(source: ClassType<S>, destination: ClassType<D>, config?: MappingConfig<S, D>, options?: MappingEntryOptions): void; } //# sourceMappingURL=mapping-profile.d.ts.map