import {SubTransformFieldMapper} from 'tilla/src/fieldMapper/subtransform.field.mapper.js'
SubTransformFieldMapper
Extends:
A FieldMapper that uses a Transformer to map the field
Constructor Summary
Public Constructor | ||
public |
constructor(transformKey: string | Transformer | function(): Promise<Transformer>, permission: PermissionLvl) |
Member Summary
Public Members | ||
public |
permission: * |
|
public |
transformKey: * |
|
public |
transformer: * |
Method Summary
Public Methods | ||
public |
Transform the field on the instance, using another Transformer. |
Private Methods | ||
private |
_setTransformer(): * |
Public Constructors
public constructor(transformKey: string | Transformer | function(): Promise<Transformer>, permission: PermissionLvl) source
Params:
Name | Type | Attribute | Description |
transformKey | string | Transformer | function(): Promise<Transformer> | If a string, it should be a key to locate the Transformer in the TransformerRegistry
|
|
permission | PermissionLvl | the permission to bind to the transformer function on the dto. |
Public Members
public permission: * source
public transformKey: * source
public transformer: * source
Public Methods
public builder(instance: Object, key: string, isList: boolean): Promise source
Transform the field on the instance, using another Transformer. This can be used when transforming eargerly loaded relations on an instance ie. Family -> Person or obviously values we would like to transform using a prebuilt Transformer.
If the value being transformed is an Instance (Sequelize), we call its get() method to invoke all getters on fields and strip other Sequelize stuff off of the data before transforming it. @see http://docs.sequelizejs.com/class/lib/model.js~Model.html#instance-method-get