{"_id":"@domusjs/jobs","_rev":"5-1cd0404711899377437edd732ee80db9","name":"@domusjs/jobs","dist-tags":{"latest":"0.2.1"},"versions":{"0.1.0":{"name":"@domusjs/jobs","version":"0.1.0","author":{"name":"Sergio Salcedo"},"license":"MIT","_id":"@domusjs/jobs@0.1.0","maintainers":[{"name":"vssalcedo","email":"sergiosalcedo96@gmail.com"}],"dist":{"shasum":"7ad568406121910bd9e81e8e74b7d60e5de2ed74","tarball":"https://registry.npmjs.org/@domusjs/jobs/-/jobs-0.1.0.tgz","fileCount":38,"integrity":"sha512-2D15aYqAYxgoQc56xlLPHpZhoFYfYGM2rrsEMjRuymdbW4gAK0UHc3MmfH1xSo1kRnJWXRMTXM/MTiYQTi2Nng==","signatures":[{"sig":"MEYCIQCjUcXeGMB34JGswHZUbA1FjMGWPabCwJkhAxFjdkHl1wIhALMX29bDUjBj2k8+6WXcFw6owP4lK3gwpSwE4g8dkmvF","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":17120},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"f075a0f01f455839bc35b1371be45d545aca82f9","scripts":{"build":"tsc -b","clean":"rm -rf dist && rm -rf tsconfig.tsbuildinfo && rm -rf node_modules"},"_npmUser":{"name":"vssalcedo","actor":{"name":"vssalcedo","type":"user","email":"sergiosalcedo96@gmail.com"},"email":"sergiosalcedo96@gmail.com"},"_npmVersion":"10.5.2","description":"The `@domusjs/jobs` package offers a structured and scalable solution for managing **background jobs** and **recurring tasks** in distributed applications. It operates with [BullMQ](https://github.com/taskforcesh/bullmq) under the hood.","directories":{},"_nodeVersion":"20.13.1","dependencies":{"bullmq":"^5.49.0","reflect-metadata":"^0.2.2"},"_hasShrinkwrap":false,"peerDependencies":{"tsyringe":"^4.9.1"},"_npmOperationalInternal":{"tmp":"tmp/jobs_0.1.0_1750165881110_0.09647694552887986","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@domusjs/jobs","version":"0.1.1","author":{"name":"Sergio Salcedo"},"license":"MIT","_id":"@domusjs/jobs@0.1.1","maintainers":[{"name":"vssalcedo","email":"sergiosalcedo96@gmail.com"}],"dist":{"shasum":"ab3e90ffa33295cd0801555e3d4c40af4358b2db","tarball":"https://registry.npmjs.org/@domusjs/jobs/-/jobs-0.1.1.tgz","fileCount":38,"integrity":"sha512-gyslQ9YANmxVi0mREUnakpDtuP0j8IJzYmyAmM35+3f5SFf+cBTVHdDYGSDX70r/nBYJfgJeYjWmE7fiVle82Q==","signatures":[{"sig":"MEUCICFasffp6b0skNnNDEwI4tBvagZEkqGrHJI0cgNn/FBRAiEAsXoowbhTXyrJxFAVuDfaBjQhOV1OwFxB6TiPjrL2/M4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":17120},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"f075a0f01f455839bc35b1371be45d545aca82f9","scripts":{"build":"tsc -b","clean":"rm -rf dist && rm -rf tsconfig.tsbuildinfo && rm -rf node_modules"},"_npmUser":{"name":"vssalcedo","actor":{"name":"vssalcedo","type":"user","email":"sergiosalcedo96@gmail.com"},"email":"sergiosalcedo96@gmail.com"},"_npmVersion":"10.5.2","description":"The `@domusjs/jobs` package offers a structured and scalable solution for managing **background jobs** and **recurring tasks** in distributed applications. It operates with [BullMQ](https://github.com/taskforcesh/bullmq) under the hood.","directories":{},"_nodeVersion":"20.13.1","dependencies":{"bullmq":"^5.49.0","reflect-metadata":"^0.2.2"},"_hasShrinkwrap":false,"peerDependencies":{"tsyringe":"^4.9.1"},"_npmOperationalInternal":{"tmp":"tmp/jobs_0.1.1_1750165967892_0.7675461668507395","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@domusjs/jobs","version":"0.1.2","author":{"name":"Sergio Salcedo"},"license":"MIT","_id":"@domusjs/jobs@0.1.2","maintainers":[{"name":"vssalcedo","email":"sergiosalcedo96@gmail.com"}],"dist":{"shasum":"98889a82f1a08a05f8b1b973bdb812fb01b6f57b","tarball":"https://registry.npmjs.org/@domusjs/jobs/-/jobs-0.1.2.tgz","fileCount":38,"integrity":"sha512-/d8cPZfEiLsZH18o77iIJO5Tn7R3QEqNm89rskrUDBC9nObqrjIJTGddNzFzDkHH2X4Doqr1F01dCNpL4Xl2JQ==","signatures":[{"sig":"MEQCIGZ8VMCZRuoMtwuKPzItCcc7HnfQL4+/J9RI7QRyW8VgAiBsHo7UwoKE61fRRTWl5ef4gWiM+BeTucTqR3161+BBXw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":17079},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"f075a0f01f455839bc35b1371be45d545aca82f9","scripts":{"build":"tsc -b","clean":"rm -rf dist && rm -rf tsconfig.tsbuildinfo && rm -rf node_modules"},"_npmUser":{"name":"vssalcedo","actor":{"name":"vssalcedo","type":"user","email":"sergiosalcedo96@gmail.com"},"email":"sergiosalcedo96@gmail.com"},"_npmVersion":"10.5.2","description":"The `@domusjs/jobs` package offers a structured and scalable solution for managing **background jobs** and **recurring tasks** in distributed applications. It operates with BullMQ under the hood.","directories":{},"_nodeVersion":"20.13.1","dependencies":{"bullmq":"^5.49.0","reflect-metadata":"^0.2.2"},"_hasShrinkwrap":false,"peerDependencies":{"tsyringe":"^4.9.1"},"_npmOperationalInternal":{"tmp":"tmp/jobs_0.1.2_1750166144753_0.3523350488228367","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@domusjs/jobs","version":"0.1.3","author":{"name":"Sergio Salcedo"},"license":"MIT","_id":"@domusjs/jobs@0.1.3","maintainers":[{"name":"vssalcedo","email":"sergiosalcedo96@gmail.com"}],"dist":{"shasum":"a5f2d9f745f55a76757f27aba3ece30a3226424f","tarball":"https://registry.npmjs.org/@domusjs/jobs/-/jobs-0.1.3.tgz","fileCount":38,"integrity":"sha512-XltdAjzx+qaCCoke2ctRGCv27OHwCJb2o+EoJukr9s8GFHwaKcylBplPsLCtwm9EJLysmS+M6CpvYWA24ln5NA==","signatures":[{"sig":"MEUCIQDK2vQDlcP5bXrvG0ojefDNi5IwlUPtd8RSuYV6wcQolAIgKfF40TAABsYONjC6f9RHcQ1tCLF8+8Lvh05pu96/EGE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":17271},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"1779b2182c260a0346260c8333c778145f820351","scripts":{"test":"vitest run","build":"tsc -b","clean":"rm -rf dist && rm -rf tsconfig.tsbuildinfo && rm -rf node_modules","test:watch":"vitest --watch","test:coverage":"vitest --coverage"},"_npmUser":{"name":"vssalcedo","email":"sergiosalcedo96@gmail.com"},"_npmVersion":"10.8.2","description":"The `@domusjs/jobs` package offers a structured and scalable solution for managing **background jobs** and **recurring tasks** in distributed applications. It operates with BullMQ under the hood.","directories":{},"_nodeVersion":"22.7.0","dependencies":{"bullmq":"^5.49.0","reflect-metadata":"^0.2.2"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^1.0.0","@vitest/coverage-v8":"^1.0.0"},"peerDependencies":{"tsyringe":"^4.9.1"},"_npmOperationalInternal":{"tmp":"tmp/jobs_0.1.3_1752831033976_0.7159317732348214","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@domusjs/jobs","version":"0.2.1","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc -b","clean":"rm -rf dist && rm -rf tsconfig.tsbuildinfo && rm -rf node_modules","test":"vitest run","test:watch":"vitest --watch","test:coverage":"vitest --coverage"},"license":"MIT","author":{"name":"Sergio Salcedo"},"dependencies":{"bullmq":"^5.49.0","reflect-metadata":"^0.2.2"},"peerDependencies":{"tsyringe":"^4.9.1"},"devDependencies":{"vitest":"^1.0.0","@vitest/coverage-v8":"^1.0.0"},"gitHead":"e390da2c6c09351be16d88ad2a742be7ead6a23a","_id":"@domusjs/jobs@0.2.1","description":"The `@domusjs/jobs` package offers a structured and scalable solution for managing **background jobs** and **recurring tasks** in distributed applications. It operates with BullMQ under the hood.","_nodeVersion":"22.19.0","_npmVersion":"11.6.1","dist":{"integrity":"sha512-zY+CT4wdYaYiE5sfR7pWBK01yqhLDGLHnWyk5+dawcAjBAZTUguaxZfnA71+fPNsOg4eOghbLA3zYsYRTqZD1g==","shasum":"93fa168b95408f502f13a3446ea6dd295ca71221","tarball":"https://registry.npmjs.org/@domusjs/jobs/-/jobs-0.2.1.tgz","fileCount":38,"unpackedSize":17271,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHsuwVOe7aexfMClQe1UvlsSLfh4iJiy2ej6DjjVY/cnAiB6WtjqGzap9tN8DW39FAdYcZw4OKX5jmHnf6HsOwlaDg=="}]},"_npmUser":{"name":"vssalcedo","email":"sergiosalcedo96@gmail.com"},"directories":{},"maintainers":[{"name":"vssalcedo","email":"sergiosalcedo96@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/jobs_0.2.1_1761930644206_0.06396126109005729"},"_hasShrinkwrap":false}},"time":{"created":"2025-06-17T13:11:20.928Z","modified":"2025-10-31T17:10:44.632Z","0.1.0":"2025-06-17T13:11:21.276Z","0.1.1":"2025-06-17T13:12:48.086Z","0.1.2":"2025-06-17T13:15:44.923Z","0.1.3":"2025-07-18T09:30:34.157Z","0.2.1":"2025-10-31T17:10:44.417Z"},"author":{"name":"Sergio Salcedo"},"license":"MIT","description":"The `@domusjs/jobs` package offers a structured and scalable solution for managing **background jobs** and **recurring tasks** in distributed applications. It operates with BullMQ under the hood.","maintainers":[{"name":"vssalcedo","email":"sergiosalcedo96@gmail.com"}],"readme":"# @domusjs/jobs\n\nThe `@domusjs/jobs` package offers a structured and scalable solution for managing **background jobs** and **recurring tasks** in distributed applications. It operates with BullMQ under the hood.\n\n## ✨ Features\n\n- 🎯 Job execution abstraction\n- 📦 Uses [BullMQ](https://github.com/taskforcesh/bullmq) under the hood\n- 🧪 Decoupled from infrastructure, perfect for testing\n- 🧩 Modular design: define jobs, workers, and queues separately\n\n## 🚦 When to Use\n\nUse this module when:\n\n- You need to run asynchronous or long-running tasks off the main HTTP request cycle\n- You need job retries, failure handling, or queueing logic\n\n## Install\n\n```bash\nnpm install @domusjs/jobs\n```\n\n## Usage\n\n### 1. Define a Job\n\n```ts\n// hello-world.job.ts\nimport { JobTask } from '@domusjs/jobs';\n\ntype HelloWorldJobData = {\n  name: string;\n};\n\nexport class HelloWorldJob extends JobTask {\n  static readonly jobName = 'hello_world';\n\n  constructor(public readonly data: HelloWorldJobData) {\n    super(data);\n  }\n\n  async execute(): Promise<string> {\n    const ret = `[HelloWorldJob] Hello ${this.data.name}!`;\n    return ret;\n  }\n}\n```\n\n✅ This defines a reusable job by extending `JobTask`, with a clear `jobName` identifier and its own `execute()` logic.\n\n---\n\n### 2. Set Up Client, Queue, Worker, and Events\n\n```ts\nimport 'reflect-metadata';\n\nimport { DomusJobClient } from '@domusjs/jobs';\nimport { HelloWorldJob } from './hello-world.job';\n\n// Create a client with Redis connection settings\nconst client = new DomusJobClient({\n  host: 'localhost',\n  port: 6379,\n  password: 'your_password',\n});\n\n// Create a queue\nconst queue = client.createQueue('basic_queue');\n\n// Add a worker for the queue\nconst worker = client.createWorker(queue, [HelloWorldJob]);\n\n// Enqueue a job\nawait queue.add(new HelloWorldJob({ name: 'DomusJS' }));\n\n// Handle worker events\nworker.onFailed((job, error) => {\n  console.error('Job failed:', {\n    jobId: job?.id,\n    error: error.message,\n  });\n});\n\nworker.onCompleted((job, result) => {\n  console.info('Job completed:', {\n    jobId: job?.id,\n    result,\n  });\n});\n```\n\n---\n\n## 🔗 Learn More\n\nFor advanced aspects, check out the full documentation:\n\n👉 [https://docs.domusjs.com](https://docs.domusjs.com)\n","readmeFilename":"README.md"}