Home Manual Reference Source Test
import MappingTransformer from 'atscm/src/transform/Mapping.js'
public class | source

MappingTransformer

Extends:

Transformer → MappingTransformer

A Transformer that maps ReadStream.ReadResults to AtviseFiles.

Constructor Summary

Public Constructor
public

constructor(options: Object)

Creates a new mapping transformer.

Member Summary

Public Members
public get

true as the mapping transformer should infer references from config files.

Private Members
private

Contents of the reference files read but not used yet.

Method Summary

Public Methods
public

transformFromDB(node: Node, encoding: string, callback: function(err: ?Error, data: ?AtviseFile))

Writes an AtviseFile for each ReadStream.ReadResult read.

public

transformFromFilesystem(node: Node, encoding: string, callback: function(err: ?Error, data: ?AtviseFile)): *

Writes an AtviseFile for each Node read.

Inherited Summary

From class Transformer
public static

combinedTransformer(transformers: Transformer[], direction: TransformDirection): function(node: Node): Promise<any>

Returns a function that combines multiple transformer actions.

public
public

compatTransform(direction: TransformDirection, node: Node, context: Object): *

A transform wrapper that works with both async/await (atscm >= 1) and callback-based (atscm < 1)transformers.

public

Determines if a node's value node should be read, e.G. The Variable.Bool file for a node defined in .Variable.Bool.Json.

public

async transformFromDB(node: BrowsedNode, context: Object)

Must be overridden by all subclasses: Transforms the given node when using TransformDirection.FromDB.

public

async transformFromFilesystem(node: BrowsedNode, context: Object)

Must be overridden by all subclasses: Transforms the given node when using TransformDirection.FromFilesystem.

public

Returns the Transformer with the given direction.

Public Constructors

public constructor(options: Object) source

Creates a new mapping transformer.

Override:

Transformer#constructor

Params:

NameTypeAttributeDescription
options Object
  • optional

The arguments passed to the Transformer constructor.

Test:

Public Members

public get transformsReferenceConfigFiles: boolean source

true as the mapping transformer should infer references from config files.

Private Members

private _readReferenceFiles: Object source

Contents of the reference files read but not used yet.

Public Methods

public transformFromDB(node: Node, encoding: string, callback: function(err: ?Error, data: ?AtviseFile)) source

Writes an AtviseFile for each ReadStream.ReadResult read. If a read file has a non-standard type (definition) an additional rc file is pushed holding this type.

Override:

Transformer#transformFromDB

Params:

NameTypeAttributeDescription
node Node

The read result to create the file for.

encoding string

The encoding used.

callback function(err: ?Error, data: ?AtviseFile)

Called with the error that occurred while transforming the read result or the resulting file.

Test:

public transformFromFilesystem(node: Node, encoding: string, callback: function(err: ?Error, data: ?AtviseFile)): * source

Writes an AtviseFile for each Node read.

Override:

Transformer#transformFromFilesystem

Params:

NameTypeAttributeDescription
node Node

The raw file.

encoding string

The encoding used.

callback function(err: ?Error, data: ?AtviseFile)

Called with the error that occurred while transforming the read result or the resulting file.

Return:

*

Test: