Skip to main content

@boost/pipeline

build status npm version

Pipe an input through a series of routines and tasks to produce an output, or simply, run logic in a series of stages.

import { Context, WaterfallPipeline } from '@boost/pipeline';

const ast = new WaterfallPipeline(new Context(), filePath)
.pipe('Parsing AST', parseAst)
.pipe('Linting rules', runLintsOnAst)
.pipe('Transforming nodes', transformNodesOnAst)
.pipe('Writing contents', writeAstToFile)
.run();

Features

  • Parallel and serial based processing pipelines.
  • Supports 2 types of work units: tasks and routines.
  • Pooling and aggregated implementations for computation heavy or complex logic.
  • Contextually aware executions.

Installation

yarn add @boost/pipeline

Documentation

Index

Type Aliases

Action

Action<Ctx, Input, Output>: (context: Ctx, value: Input, workUnit: AnyWorkUnit) => Output | Promise<Output>

Type parameters

  • Ctx: Context
  • Input = unknown
  • Output = Input

AnyPipeline

AnyPipeline: Pipeline<{}, Context, any, any>

AnyWorkUnit

AnyWorkUnit: WorkUnit<{}, any, any>

PipelineErrorCode

PipelineErrorCode: keyof typeof errors

Status

Status: failed | passed | pending | running | skipped

Variables

constPipelineError

PipelineError: new (code: ACTION_REQUIRED | ROUTINE_INVALID_KEY | WORK_REQUIRED_TITLE | WORK_TIME_OUT | WORK_UNKNOWN, params?: unknown[]) => Error & ScopedError<ACTION_REQUIRED | ROUTINE_INVALID_KEY | WORK_REQUIRED_TITLE | WORK_TIME_OUT | WORK_UNKNOWN> = ...

constSTATUS_FAILED

STATUS_FAILED: Status = 'failed'

constSTATUS_PASSED

STATUS_PASSED: Status = 'passed'

constSTATUS_PENDING

STATUS_PENDING: Status = 'pending'

constSTATUS_RUNNING

STATUS_RUNNING: Status = 'running'

constSTATUS_SKIPPED

STATUS_SKIPPED: Status = 'skipped'