UNPKG

kist

Version:

Package Pipeline Processor

81 lines (80 loc) 2.82 kB
import { ActionInterface } from "../../interface/ActionInterface"; import { AbstractProcess } from "../abstract/AbstractProcess"; /** * ActionRegistry is a singleton registry for step actions, mapping action * names to their corresponding classes. This registry allows dynamic * resolution of step actions within the pipeline and supports custom * developer integrations. */ export declare class ActionRegistry extends AbstractProcess { /** * Singleton instance */ private static instance; /** * Map to store registered actions */ private registry; /** * Constructs an ActionRegistry instance and automatically registers core * actions. The constructor is private to enforce the singleton pattern. */ constructor(); /** * Initializes the singleton instance of ActionRegistry. * Should only be called once during application startup. * * @throws Error if the registry has already been initialized. */ static initialize(): void; /** * Retrieves the singleton instance of ActionRegistry, initializing it if * necessary. * * @returns The ActionRegistry instance. */ static getInstance(): ActionRegistry; /** * Resets the singleton instance of ActionRegistry. * This is useful for testing or resetting the registry state during * runtime. */ static resetInstance(): void; /** * Registers a new action in the registry. * * @param actionClass - The class implementing `ActionInterface`. * @throws Error if the action name is already registered or missing. */ registerAction(actionClass: new () => ActionInterface): void; /** * Retrieves a step action class from the registry. * This method looks up an action by name and returns the corresponding * class that implements the ActionInterface. * * @param name - The name of the action to retrieve. * @returns The action class constructor if found, or undefined if no such * action is registered. */ getAction(name: string): (new () => ActionInterface) | undefined; /** * Lists all registered step actions. * Provides a utility to view currently registered actions, useful for * debugging and validation. * * @returns An array of registered action names. */ listRegisteredActions(): string[]; /** * Pre-registers core actions that are included with the pipeline by * default. Developers can extend this by registering additional custom * actions as needed. */ private registerCoreActions; private discoverPlugins; /** * Clears all registered actions in the registry. * Useful for testing or resetting the pipeline. */ clearRegistry(): void; }