npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

step-executor-lib

v1.0.1

Published

A library for abstract step execution with support for sequential and parallel execution strategies.

Readme

Step Executor Library

Una librería TypeScript potente y flexible para ejecutar flujos de trabajo complejos con soporte para estrategias secuenciales, paralelas y mixtas.

🚀 Instalación

npm install step-executor-lib
# o
yarn add step-executor-lib

📋 Uso Básico

1. Usando Decoradores (Recomendado)

import 'reflect-metadata';
import { Step, Parallel } from 'step-executor-lib';
import { Executor } from 'step-executor-lib';

class MiClase {
    @Step('paso-1')
    async primerPaso() {
        console.log('Ejecutando primer paso...');
        return { resultado: 'completado' };
    }

    @Step('paso-2')
    @Parallel() // Este paso se ejecutará en paralelo
    async segundoPaso() {
        console.log('Ejecutando segundo paso...');
        return { resultado: 'completado' };
    }
}

// Ejecutar
const executor = new Executor();
const miInstancia = new MiClase();
await executor.execute(miInstancia);

2. Usando Pipeline Directo

import { Pipeline, Step } from 'step-executor-lib';

const pasos = [
    new Step('configurar', async () => {
        console.log('Configurando sistema...');
        return { config: 'listo' };
    }),
    new Step('procesar', async () => {
        console.log('Procesando datos...');
        return { datos: 'procesados' };
    })
];

const pipeline = new Pipeline(pasos);
await pipeline.execute();

🎯 Estrategias de Ejecución

Secuencial

Los pasos se ejecutan uno después del otro.

import { SequentialStrategy } from 'step-executor-lib';

const estrategia = new SequentialStrategy(pasos);
await estrategia.execute();

Paralelo

Todos los pasos se ejecutan simultáneamente.

import { ParallelStrategy } from 'step-executor-lib';

const estrategia = new ParallelStrategy(pasos);
await estrategia.execute();

Mixto

Combina ejecución secuencial y paralela.

import { MixedStrategy } from 'step-executor-lib';

const pasosSecuenciales = [/* pasos que deben ir en orden */];
const pasosParalelos = [/* pasos que pueden ejecutarse simultáneamente */];

const estrategia = new MixedStrategy(pasosSecuenciales, pasosParalelos);
await estrategia.execute();

💡 Ejemplos Prácticos

CI/CD Pipeline

class CIPipeline {
    @Step('build')
    async build() {
        console.log('🔨 Building application...');
        return { artifacts: 'dist/' };
    }

    @Step('test')
    @Parallel()
    async runTests() {
        console.log('🧪 Running tests...');
        return { coverage: '95%' };
    }

    @Step('deploy')
    async deploy() {
        console.log('🚀 Deploying to production...');
        return { url: 'https://mi-app.com' };
    }
}

Microservicios

class MicroservicesDeployment {
    @Step('setup-infrastructure')
    async setupInfra() {
        console.log('🏗️ Setting up infrastructure...');
        return { vpc: 'vpc-123', db: 'ready' };
    }

    @Step('deploy-auth-service')
    @Parallel()
    async deployAuth() {
        console.log('🔐 Deploying auth service...');
        return { service: 'auth', port: 3001 };
    }

    @Step('deploy-api-service')
    @Parallel()
    async deployAPI() {
        console.log('🌐 Deploying API service...');
        return { service: 'api', port: 3000 };
    }
}

🔧 Configuración Avanzada

TypeScript

Asegúrate de tener estas configuraciones en tu tsconfig.json:

{
  "compilerOptions": {
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true
  }
}

Dependencias

// Importar reflect-metadata al inicio de tu aplicación
import 'reflect-metadata';

📊 Beneficios

  • Paralelización automática: Mejora el rendimiento ejecutando tareas independientes simultáneamente
  • Gestión de dependencias: Controla el orden de ejecución de manera inteligente
  • Manejo de errores: Captura y gestiona errores de manera robusta
  • TypeScript nativo: Soporte completo con tipos seguros
  • Decoradores elegantes: Sintaxis limpia y declarativa
  • Flexible: Múltiples estrategias de ejecución según tus necesidades

🎯 Casos de Uso

  • Pipelines CI/CD: Build, test, deploy
  • Procesamiento de datos: ETL, transformaciones
  • Microservicios: Deployment y orquestación
  • Automatización: Scripts complejos con dependencias
  • APIs: Procesamiento de solicitudes multi-paso

¡Listo para comenzar! 🚀

🤝 Contribuir

¡Las contribuciones son bienvenidas! Nos encantaría que formes parte de la comunidad.

Formas de Contribuir

Guías de Contribución

Desarrollo Local

# Clonar el repositorio
git clone https://github.com/TU_USUARIO/step-executor-lib.git
cd step-executor-lib

# Instalar dependencias
npm install

# Ejecutar pruebas
npm test

# Ejecutar ejemplos
npm run examples all

Prerequisites

This project requires Node.js version 18 or higher. We recommend using nvm to manage Node.js versions.

Using nvm

If you have nvm installed, you can use the included .nvmrc file to automatically switch to the correct Node.js version:

nvm use

If you don't have the required version installed, nvm will prompt you to install it:

nvm install

Features

  • Sequential Execution: Execute steps one after another using the Sequential Strategy.
  • Parallel Execution: Execute multiple steps simultaneously with the Parallel Strategy.
  • Mixed Execution: Combine both sequential and parallel execution strategies for flexible workflows.
  • Dependency Resolution: Automatically resolve dependencies between steps to determine the correct execution order.
  • Error Handling: Built-in error handling to capture and log errors during execution.
  • Logging: Comprehensive logging capabilities to track execution progress and issues.

Installation

To install the Step Executor Library, use npm:

npm install step-executor-lib

Usage

Basic Example

import { Executor } from 'step-executor-lib/src/core/executor';
import { Step } from 'step-executor-lib/src/core/step';

const executor = new Executor();

const step1 = new Step('Step 1', async () => {
    // Logic for Step 1
});

const step2 = new Step('Step 2', async () => {
    // Logic for Step 2
});

executor.registerStep(step1);
executor.registerStep(step2);

executor.execute(); // Executes steps sequentially by default

Parallel Execution

To execute steps in parallel, use the Parallel Strategy:

import { ParallelStrategy } from 'step-executor-lib/src/strategies/parallel.strategy';

executor.setStrategy(new ParallelStrategy());
executor.execute(); // Executes registered steps in parallel

🧪 Testing

La librería incluye pruebas unitarias e integración para asegurar funcionalidad:

# Ejecutar todas las pruebas
npm test

# Ejecutar con cobertura
npm run test:coverage

# Ejecutar ejemplos
npm run examples all

📄 License

Este proyecto está licenciado bajo la Licencia MIT. Ver el archivo LICENSE para detalles.

🙏 Agradecimientos

Gracias a todos los contribuidores que han hecho posible este proyecto.


¿Tienes preguntas? Abre un issue o consulta nuestras discusiones.