feat(pipeline): add configuration and hooks for pipeline execution

- Introduce `IPipelineExecutorConfig` to enable customizable pipeline behavior
- Add `IPipelineHooks` interface for tracing and monitoring lifecycle events
- Define callback types for pipeline start, step execution, and completion
- Export new types and interfaces for broader integration within the system
This commit is contained in:
2025-05-10 16:21:16 +02:00
parent 0846dbb758
commit 3f114bb68d
5 changed files with 126 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
import {
OnPipelineEnd,
OnPipelineStart,
OnStepEnd,
OnStepStart,
} from '../Types/mod.ts';
import { IContext } from './IContext.ts';
/**
* A set of optional hook functions that can be triggered during pipeline execution.
* These hooks allow tracing, performance measurement, and logging to be integrated
* without altering middleware or handler logic.
*
* @template TContext - The custom context type used within the application.
*/
export interface IPipelineHooks<TContext extends IContext = IContext> {
/**
* Triggered once before any middleware or handler is executed.
*/
onPipelineStart?: OnPipelineStart<TContext>;
/**
* Triggered immediately before each middleware or handler runs.
*/
onStepStart?: OnStepStart<TContext>;
/**
* Triggered immediately after each middleware or handler has finished executing.
*/
onStepEnd?: OnStepEnd<TContext>;
/**
* Triggered after the entire pipeline completes execution.
*/
onPipelineEnd?: OnPipelineEnd<TContext>;
}