UCD.js Docs

Pipeline Core

Architecture notes for @ucdjs/pipeline-core

@ucdjs/pipeline-core defines the pipeline DSL used to describe Unicode data processing.

Role

  • Defines pipelines, sources, routes, filters, transforms, outputs, and tracing shapes.
  • Validates route dependency graphs at definition time.
  • Provides the pure data model that executors and visualizers consume.

Mental Model

pipeline-core is definition-time code, not runtime orchestration.

The key concepts are:

  • pipeline: a complete processing plan across versions
  • source: where files come from
  • route: how matching files are parsed and resolved
  • fallback: what happens to unmatched files
  • DAG: route dependency order

The package returns immutable data structures that other packages execute.

Method Flows

definePipeline()

buildDAG()definePipeline()buildDAG()definePipeline()alt[invalid dependencies][valid DAG]AuthordefinePipeline({ id, inputs, routes, ... })build route dependency graphvalidation errorsthrow invalid route dependency errordagapply defaults for strict, concurrency, tagsPipelineDefinitionAuthor

Route execution contract

resolvertransformsparserPipelineRouteDefinitionresolvertransformsparserPipelineRouteDefinitionopt[transforms present]Executorexecute matched fileparser(ParseContext)AsyncIterable<ParsedRow>applyTransforms(rows)transformed row streamresolver(ResolveContext, rows)route outputExecutor

Source and dependency model

createRouteDependency()definePipelineRoute()definePipelineSource()createRouteDependency()definePipelineRoute()definePipelineSource()opt[route depends on prior route data]Pipelinedeclare inputsdeclare routes with filters/parsers/resolversdepends: [createRouteDependency("other-route")]typed dependency tokenroute definitionDAG captures dependency orderPipeline

Design Notes

  • Definition-time validation is deliberate so invalid pipelines fail before execution starts.
  • The package does not know about filesystem layout, caching, or UI.
  • PipelineDefinition is intentionally pure data plus precomputed DAG metadata.
  • The DSL is expressive enough for both tiny sample pipelines and large preset-driven pipelines.

Testing Use

  • invalid DAG detection
  • filter composition and matching behavior
  • route dependency typing and ordering
  • output normalization contracts
  • transform chaining and fallback behavior

On this page