@pebula/metap
Version:
meta-programming tools
44 lines (43 loc) • 2.12 kB
TypeScript
import { Constructor } from '@pebula/utils';
import { DualKeyMap, PropMetadata, SerializationFactory, BaseDeserializer, BaseSerializer, SerializerContext, PlainObjectMapper } from '@pebula/metap/internal';
/**
* A mapper that has no mapping effect.
* Maps every property on the source to the same property on the target.
* This mapper does not support non primitive id's
*/
export declare class DirectDeserializeMapper<T = any, Z extends Constructor<T> = Constructor<any>> extends BaseDeserializer<T, Z> {
setRef(value: any): void;
readonly isCollection: boolean;
protected existing: DualKeyMap<any, string, any>;
protected readonly ref: any | undefined;
protected current: any;
protected identity: string;
private idx;
constructor(source: any, sourceType: Z & Constructor<T>, plainMapper?: PlainObjectMapper);
getIdentity(): string;
next(): boolean;
getKeys(): string[];
getValue(key: string, prop?: PropMetadata): any;
protected deserialize(value: any, prop: PropMetadata): any;
/**
* Returns a relationship object with the identity property set.
* This object can then be used by the cache to identify if a value is cached or not (using the type & identity comb)
*/
protected getRelationQuery(prop: PropMetadata, value: any): any;
protected getCache(type: any, value: any): any | undefined;
}
export declare class DirectChildDeserializeMapper extends DirectDeserializeMapper {
protected existing: DualKeyMap<any, string, any>;
constructor(source: any, sourceType: any, existing: DualKeyMap<any, string, any>, plainMapper: PlainObjectMapper);
}
export declare class DirectSerializeMapper extends BaseSerializer {
protected cache: Map<any, any>;
serialize(container: SerializerContext): any;
private serializeObject;
private serializeCollection;
}
export declare class DirectChildSerializeMapper extends DirectSerializeMapper {
protected cache: Map<any, any>;
constructor(source: any, cache: Map<any, any>, plainMapper: PlainObjectMapper);
}
export declare const directMapper: SerializationFactory;