Skip to content

Home > @idealeap/pipeline > Pipeline > fromJSON

Pipeline.fromJSON() method

Constructs a new Pipeline instance from a serializable configuration and a mapping of functions.

Signature:

typescript
static fromJSON(json: SerializablePipelineOptions, fnMap: Record<string, (input: any, context: PipelineContext) => MaybePromise<any>>, predefinedUses?: PipeRegistryType): Pipeline;
static fromJSON(json: SerializablePipelineOptions, fnMap: Record<string, (input: any, context: PipelineContext) => MaybePromise<any>>, predefinedUses?: PipeRegistryType): Pipeline;

Parameters

ParameterTypeDescription
jsonSerializablePipelineOptionsThe serializable pipeline configuration.
fnMapRecord<string, (input: any, context: PipelineContext) => MaybePromise<any>>A mapping of pipe IDs to their corresponding functions.
predefinedUsesPipeRegistryType(Optional) Optional predefined pipe functions.

Returns:

Pipeline

A new Pipeline instance.

Exceptions

Will throw an error if the configuration is invalid or if a function is not found for a given ID.

Released under the MIT License.