import ScriptTransformer from 'atvise-scm/src/lib/transformers/ScriptTransformer.js'ScriptTransformer
Extends:
Extracts JavaScript code from atvise (serverside) scripts. A config file is used to describe parameters.
Static Member Summary
| Static Public Members | ||
| public static get |
This transformer is only applied to NodeType.Script and NodeType.QuickDynamic node types. |
|
Constructor Summary
| Public Constructor | ||
| public |
Creates a new script transformer. |
|
Member Summary
| Public Members | ||
| public |
The XMLBuilder to use when writing back to the database. |
|
Method Summary
| Public Methods | ||
| public |
createScriptCode(stream: Stream, script: {}) Creates an XML script file from buffered JavaScript and configuration code. |
|
| public |
flushFromFilesystem(stream: Stream, cb: function(err: Error)) Called after all script files were buffered. |
|
| public |
transformFromDB(stream: NodeStream, node: Node, enc: String, cb: function(err: Error, node: Node)) Parses script XML files and splits them a JavaScript and a configuration file. |
|
| public |
transformFromFilesystem(stream: Stream, file: AtviseFile, enc: String, cb: function(err: Error, file: AtviseFile)) Buffers the contents of the files a script was split into. |
|
Inherited Summary
| From class Transformer | ||
| public static get |
The NodeTypes the transform should be applied to. |
|
| public static |
encapsule(file: AtviseFile, extname: String) Encapsules a file. |
|
| public static |
encapsuledFile(file: AtviseFile, extname: String, contentString: String): AtviseFile Takes a file and returns an encapsuled file apon it. |
|
| public abstract |
flushFromDB(stream: NodeStream, cb: function(err: Error)) A function that is applied after all transformations passed. |
|
| public abstract |
flushFromFilesystem(stream: NodeStream, cb: function(err: Error)) A function that is applied after all transformations passed. |
|
| public |
Returns a string representation of the current Transformer. |
|
| public |
transform(direction: TransformDirection): Stream Applies transformation for a given TransformDirection. |
|
| public abstract |
transformFromDB(stream: NodeStream, node: Node, enc: String, cb: function(err: Error, node: Node)) Transforms a NodeStream. |
|
| public abstract |
transformFromFilesystem(stream: Stream, file: AtviseFile, enc: String, cb: function(err: Error, file: AtviseFile)) Transforms a stream of AtviseFiles. |
|
Static Public Members
public static get applyToTypes: Map<NodeType, Boolean> source
This transformer is only applied to NodeType.Script and NodeType.QuickDynamic node types.
Override:
Transformer#applyToTypesPublic Constructors
public constructor source
Creates a new script transformer. Currently no options are applied.
Override:
Transformer#constructorPublic Members
public outputXMLBuilder: XMLBuilder source
The XMLBuilder to use when writing back to the database. Uses atvise specific defaults.
Public Methods
public createScriptCode(stream: Stream, script: {}) source
Creates an XML script file from buffered JavaScript and configuration code.
Params:
| Name | Type | Attribute | Description |
| stream | Stream | The stream used. |
|
| script | {} | The buffered script content. |
public flushFromFilesystem(stream: Stream, cb: function(err: Error)) source
Called after all script files were buffered. Creates script XMLs and pushes them to the stream.
Override:
Transformer#flushFromFilesystempublic transformFromDB(stream: NodeStream, node: Node, enc: String, cb: function(err: Error, node: Node)) source
Parses script XML files and splits them a JavaScript and a configuration file.
Override:
Transformer#transformFromDBpublic transformFromFilesystem(stream: Stream, file: AtviseFile, enc: String, cb: function(err: Error, file: AtviseFile)) source
Buffers the contents of the files a script was split into.
Override:
Transformer#transformFromFilesystemParams:
| Name | Type | Attribute | Description |
| stream | Stream | The stream used. |
|
| file | AtviseFile | The file to buffer. |
|
| enc | String | The encoding used. |
|
| cb | function(err: Error, file: AtviseFile) | Callback to call after transformation. |