51Degrees Pipeline for Node.js

PipelineBuilder Class Reference

Detailed Description

A PipelineBuilder generates a Pipeline object Before construction of the Pipeline, FlowElements are added to it There are also options for how JavaScript is output from the Pipeline.

Examples
pipelines.js.

Public Member Functions

 constructor (settings={})
 Constructor for pipeline builder.
 buildFromConfigurationFile (configPath)
 Helper that loads a JSON configuration file from the filesystem and calls pipelineBuilder.buildFromConfiguration.
 buildFromConfiguration (config)
 Create a pipeline from a JSON configuration.
 getSuppressProcessExceptions (config)
 Resolve the suppressProcessExceptions setting for a configuration.
 addRequiredElements (flowElements)
 Add required elements to an existing FlowElement array.
 getSequenceElements ()
 Internal function used to first check if the Sequence element should be added to the pipeline and add it if requested.
 getJavaScriptElements ()
 Internal function used to first check if the JSON Builder and JavaScript Builder elements should be added to the pipeline and add them if requested.
 getHttpElements ()
 Internal function used to first check if the HTTP elements should be added to the pipeline and add them if requested.
 add (flowElement)
 Add a single flowElement to be executed in series.
 addParallel (flowElements)
 Add an array of flowElements to be executed in parallel.
 build ()
 Build the pipeline from the flowElements that have been added.

Member Function Documentation

◆ add()

PipelineBuilder::add ( flowElement)
inline

Add a single flowElement to be executed in series.

Parameters
{FlowElement}flowElement flowElement to add to the Pipeline
Returns
{PipelineBuilder} Pipeline builder for easy chaining
Examples
pipelines.js.

◆ addParallel()

PipelineBuilder::addParallel ( flowElements)
inline

Add an array of flowElements to be executed in parallel.

Parameters
{FlowElement[]}flowElements array of FlowElements to add to the Pipeline (to be exeuted in parallel)
Returns
{PipelineBuilder} Pipeline builder for easy chaining
Examples
pipelines.js.

◆ addRequiredElements()

PipelineBuilder::addRequiredElements ( flowElements)
inline

Add required elements to an existing FlowElement array.

Parameters
{FlowElement[]}flowElements array of elements to add to
Returns
{FlowElement[]} resulting array with required elements

◆ build()

PipelineBuilder::build ( )
inline

Build the pipeline from the flowElements that have been added.

Returns
{Pipeline} The constructed Pipeline

◆ buildFromConfiguration()

PipelineBuilder::buildFromConfiguration ( config)
inline

Create a pipeline from a JSON configuration.

Parameters
{object}config a JSON configuration object
Returns
{Pipeline} the constructed pipeline

◆ buildFromConfigurationFile()

PipelineBuilder::buildFromConfigurationFile ( configPath)
inline

Helper that loads a JSON configuration file from the filesystem and calls pipelineBuilder.buildFromConfiguration.

Parameters
{string}configPath path to a JSON configuration file
Returns
{Pipeline} the constructed pipeline

◆ constructor()

PipelineBuilder::constructor ( settings = {})
inline

Constructor for pipeline builder.

Parameters
{object}settings settings for the pipeline being constructed
{boolean}settings.addJavaScriptBuilder Whether to automatically add the JSONBundler, JavaScriptBuilder and Sequence elements needed to output JavaScript from the system and generate an endpoint for fetching the properties generated by a pipeline from the client side. This is true by default. False leaves out all three, whatever their own settings below say.
{boolean}settings.addSequenceElement Whether to automatically add the Sequence element, as the first element. This is true by default.
{boolean}settings.addJsonBuilderElement Whether to automatically add the JSON Builder (JSONBundler) element. This is true by default.
{boolean}settings.addJavaScriptBuilderElement Whether to automatically add the JavaScript Builder element. This is true by default.
{boolean}settings.useSetHeaderProperties Whether to automatically add the SetHeadersElement needed to request additional HTTP headers from the client side. This is true by default. False leaves out the element, whatever addSetHeadersElement says.
{boolean}settings.addSetHeadersElement Whether to automatically add the Set Headers element. This is true by default.
{typeofimport('./javascriptbuilder').prototype.settings} settings.javascriptBuilderSettings The settings to pass to the JavaScriptBuilder. See JavaScriptBuilder class for details.
{boolean}settings.suppressProcessExceptions Whether errors thrown while processing should be suppressed. When false (the default) the first error is re-thrown from flowData.process(); when true errors are stored on flowData.errors and emitted via the pipeline 'error' event instead, and process() resolves normally. Recommended true for web apps so a processing failure degrades gracefully instead of failing the request.

@type {FlowElement[]}

◆ getHttpElements()

PipelineBuilder::getHttpElements ( )
inline

Internal function used to first check if the HTTP elements should be added to the pipeline and add them if requested.

Returns
{FlowElement[]} list of HTTP related FlowElements

◆ getJavaScriptElements()

PipelineBuilder::getJavaScriptElements ( )
inline

Internal function used to first check if the JSON Builder and JavaScript Builder elements should be added to the pipeline and add them if requested.

Returns
{FlowElement[]} list of JavaScript related FlowElements

◆ getSequenceElements()

PipelineBuilder::getSequenceElements ( )
inline

Internal function used to first check if the Sequence element should be added to the pipeline and add it if requested.

It goes before every other element so that the session id and sequence it writes to the evidence are there for all of them.

Returns
{FlowElement[]} list holding the Sequence element, or nothing

◆ getSuppressProcessExceptions()

PipelineBuilder::getSuppressProcessExceptions ( config)
inline

Resolve the suppressProcessExceptions setting for a configuration.

Looks for it under 'PipelineOptions.BuildParameters' (mirrors the .NET/Java config layout for cross-language consistency), falling back to a 'PipelineOptions.suppressProcessExceptions' key and then to the value supplied to the builder constructor (default false).

Parameters
{object}config a JSON configuration object
Returns
{boolean} whether processing exceptions should be suppressed