Skip to main content

Interface: ParallelConfig<TInput, TOutput>

Defined in: packages/core/src/pipeline/types.ts:180

Configuration for parallel execution step.

Example

// Object mode with named results
const config: ParallelConfig<BlogPost, EnrichedPost> = {
processors: {
sentiment: analyzeSentiment,
category: categorizePost,
tags: generateTags
},
merge: (mergeInput) => ({
...mergeInput.original,
sentiment: mergeInput.results.sentiment,
category: mergeInput.results.category,
tags: mergeInput.results.tags
})
};

// Array mode
const config: ParallelConfig<string, ValidationResult> = {
processors: [checkSpelling, checkGrammar, checkReadability],
merge: (mergeInput) => ({
allPassed: mergeInput.results.every(r => r.passed),
results: mergeInput.results
})
};

Type Parameters

TInput

TInput

Input type for all processors

TOutput

TOutput

Output type from merge function

Properties

input?

optional input?: (data) => any

Defined in: packages/core/src/pipeline/types.ts:190

Optional input transformation before fanning out to processors

Parameters

data

TInput

Returns

any


merge?

optional merge?: (mergeInput) => TOutput

Defined in: packages/core/src/pipeline/types.ts:196

Function to merge parallel results into output. Receives ParallelMergeInput with results, original input, bot names.

Parameters

mergeInput

ParallelMergeInput<any, TInput, any>

Returns

TOutput


processors

processors: Record<string, Processable<any, any> | ((input) => any)> | (Processable<any, any> | ((input) => any))[]

Defined in: packages/core/src/pipeline/types.ts:187

Processors to run in parallel. Can be:

  • Object: Named processors with string keys
  • Array: List of processors Functions are auto-wrapped as processables.