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
| Parameter | Type | Description |
|---|---|---|
| json | SerializablePipelineOptions | The serializable pipeline configuration. |
| fnMap | Record<string, (input: any, context: PipelineContext) => MaybePromise<any>> | A mapping of pipe IDs to their corresponding functions. |
| predefinedUses | PipeRegistryType | (Optional) Optional predefined pipe functions. |
Returns:
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.