UNPKG

kist

Version:

Package Pipeline Processor

78 lines (77 loc) 2.87 kB
"use strict"; // ============================================================================ // Import // ============================================================================ Object.defineProperty(exports, "__esModule", { value: true }); exports.Action = void 0; const AbstractProcess_1 = require("../abstract/AbstractProcess"); // ============================================================================ // Class // ============================================================================ /** * 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. */ class Action extends AbstractProcess_1.AbstractProcess { // Parameters // ======================================================================== /** * Gets the unique name of the action. * The name is derived from the class name of the concrete action. */ get name() { return this.constructor.name; } // Constructor // ======================================================================== /** * Constructs a new Action instance. * Inherits the logger from the AbstractProcess base class. */ constructor() { super(); } // Methods // ======================================================================== /** * 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) { // Default validation: always returns true, can be overridden in // derived classes return true; } /** * 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() { return "Base action for executing steps in the pipeline."; } /** * Logs a message indicating the start of the action's execution. * Useful for tracking progress in pipelines with multiple steps. */ logStart() { this.logInfo(`Starting action: ${this.name}`); } /** * Logs a message indicating the successful completion of the action. */ logSuccess() { this.logInfo(`Successfully completed action: ${this.name}`); } } exports.Action = Action;