kist
Version:
Package Pipeline Processor
61 lines (60 loc) • 2.44 kB
TypeScript
import { ActionInterface } from "../../interface/ActionInterface";
import { ActionOptionsType } from "../../types/ActionOptionsType";
import { AbstractProcess } from "../abstract/AbstractProcess";
/**
* Action is an abstract base class that serves as a foundation for all step
* actions in the pipeline. It provides a consistent structure and utility
* methods for derived action classes, making it easier to implement and
* integrate custom behaviors like `BuildAction`, `LintAction`, and more.
*/
export declare abstract class Action extends AbstractProcess implements ActionInterface {
/**
* Gets the unique name of the action.
* The name is derived from the class name of the concrete action.
*/
get name(): string;
/**
* Constructs a new Action instance.
* Inherits the logger from the AbstractProcess base class.
*/
constructor();
/**
* Provides a basic validation mechanism for action options.
* Derived classes can override this method to implement specific
* validation logic.
*
* @param options - The options to validate, ensuring they meet the
* action"s specific requirements.
* @returns A boolean indicating whether the options are valid. Default
* implementation always returns true.
*/
validateOptions(options: ActionOptionsType): boolean;
/**
* Abstract method that must be implemented by derived classes to perform
* the action"s main logic.
* This method is invoked during the step execution process.
*
* @param options - A structured set of options specific to the action's
* configuration.
* @returns A Promise that resolves when the action completes successfully,
* or rejects with an error if the action fails.
*/
abstract execute(options: ActionOptionsType): Promise<void>;
/**
* Provides a summary or description of the action.
* This method can be overridden by derived classes to provide more
* specific details about the action.
*
* @returns A string description of the action.
*/
describe(): string;
/**
* Logs a message indicating the start of the action's execution.
* Useful for tracking progress in pipelines with multiple steps.
*/
protected logStart(): void;
/**
* Logs a message indicating the successful completion of the action.
*/
protected logSuccess(): void;
}