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

engine-dependency

v2.0.0

Published

Dependencia centralizada para envio de datos via API al servicio Data Engine

Readme

engine-dependency

Dependencia centralizada para el envio de resultados de tests y datos via API al servicio Data Engine.

Requisitos

  • Node.js >= 18.0.0

Instalacion

npm install engine-dependency

Configuracion

Crea un archivo .env en la raiz de tu proyecto con las siguientes variables:

DATA_ENGINE_BASE_URL=https://tu-servicio.com
DATA_ENGINE_GENERATE_TOKEN=/api/auth/login
[email protected]
DATA_ENGINE_SERVICE_PASSWORD=password
ENV=qa
CI=true

Consulta .env.example para referencia.

Uso

ESM (import)

import { TestInformationService } from 'engine-dependency';

const service = new TestInformationService();
await service.sendTestResult(testInfo);

CommonJS (require)

const { TestInformationService } = require('engine-dependency');

const service = new TestInformationService();
await service.sendTestResult(testInfo);

Configuracion por parametro

En lugar de depender de variables de entorno, puedes pasar la configuracion directamente al constructor:

const service = new TestInformationService({
    baseUrl: 'https://tu-servicio.com',
    tokenEndpoint: '/api/auth/login',
    testResultsEndpoint: '/api/test-results',
    serviceAccount: '[email protected]',
    servicePassword: 'password'
});

Enviar resultado de test

const testInfo = {
    title: 'Login exitoso con credenciales validas',
    titlePath: ['Auth', 'Login', 'Login exitoso con credenciales validas'],
    status: 'passed',
    duration: 3500,
    file: 'tests/auth/login.spec.js',
    project: { name: 'e2e-chrome' },
    retries: 0,
    retry: 0,
    tags: ['@smoke', '@auth'],
    expectedStatus: 'passed',
    annotations: [],
    timeout: 30000,
    errors: []
};

const result = await service.sendTestResult(testInfo);

sendTestResult solo ejecuta el envio cuando la variable de entorno CI esta definida. Esto evita envios accidentales en entornos locales.

API

BaseService

Clase base que provee metodos HTTP reutilizables.

| Metodo | Parametros | Retorno | Descripcion | |---|---|---|---| | sendPOSTRequest(url, body, headers?) | url: string, body: object, headers: object (opcional) | { data, status } | Envia una peticion POST con JSON |

TestInformationService

Extiende BaseService. Gestiona autenticacion y envio de resultados de tests.

| Metodo | Parametros | Retorno | Descripcion | |---|---|---|---| | generateToken() | - | string \| undefined | Obtiene un token JWT del servicio | | buildTestPayload(testInfo) | testInfo: object | object | Construye el payload para el API | | sendTestResult(testInfo) | testInfo: object | object \| undefined | Autentica y envia el resultado del test |

Payload enviado

sendTestResult construye y envia el siguiente payload al endpoint /api/test-results:

| Campo | Origen | |---|---| | testTitle | titlePath concatenado o title | | testStatus | status del test | | duration | Duracion en ms | | testFile | Ruta del archivo de test | | testProject | Nombre del proyecto | | retries / retry | Intentos configurados y actual | | tags | Tags del test | | environment | Variable de entorno ENV | | testInfo | Objeto con title, expectedStatus, annotations, timeout, errors | | pipelineId | BUILD_BUILDID (Azure DevOps) | | commitSha | BUILD_SOURCEVERSION | | branch | BUILD_SOURCEBRANCH | | runUrl | URL del build en Azure DevOps | | provider | azure-devops si ejecuta en pipeline |

Scripts

npm run build          # Genera dist/ con ESM y CJS
npm run clean          # Elimina dist/
npm run lint           # Ejecuta ESLint sobre src/
npm run lint:fix       # Corrige errores de lint automaticamente
npm test               # Ejecuta tests unitarios
npm run test:watch     # Tests en modo watch
npm run test:coverage  # Tests con reporte de cobertura
npm run validate       # lint + test + build (pipeline completo)

Estructura del proyecto

engine-dependency/
├── src/
│   ├── index.js                          # Entry point
│   └── services/
│       ├── base.service.js               # Servicio HTTP base (fetch nativo)
│       └── test-information.service.js   # Servicio de resultados de tests
├── tests/
│   ├── base.service.test.js
│   └── test-information.service.test.js
├── dist/                                 # Generado por build
│   ├── esm/                              # Modulos ES
│   └── cjs/                              # CommonJS
├── examples/
│   └── send-test-result.js
├── .env.example
├── rollup.config.js
├── eslint.config.js
└── package.json

Extender con nuevos servicios

  1. Crea un nuevo archivo en src/services/ que extienda BaseService.
  2. Exportalo desde src/index.js.
  3. Ejecuta npm run build.
// src/services/mi-servicio.service.js
import BaseService from './base.service.js';

export class MiServicio extends BaseService {
    async enviarDatos(payload) {
        const response = await this.sendPOSTRequest('https://api.com/datos', payload);
        return response.data;
    }
}
// src/index.js
export { default as BaseService } from './services/base.service.js';
export { TestInformationService } from './services/test-information.service.js';
export { MiServicio } from './services/mi-servicio.service.js';