{"_id":"@chxru/nestjs-sqs","_rev":"5-4076223b516705ec603cd0f768413bab","name":"@chxru/nestjs-sqs","dist-tags":{"latest":"3.0.4"},"versions":{"3.0.1":{"name":"@chxru/nestjs-sqs","version":"3.0.1","keywords":[],"author":{"name":"Suhun Han","email":"ssut@ssut.me"},"license":"MIT","_id":"@chxru/nestjs-sqs@3.0.1","maintainers":[{"name":"charuka-hs","email":"Charuka12@gmail.com"}],"homepage":"https://github.com/ssut/nestjs-sqs#readme","bugs":{"url":"https://github.com/ssut/nestjs-sqs/issues"},"dist":{"shasum":"897a37013da096a24b2e7ea76178fe66d707d723","tarball":"https://registry.npmjs.org/@chxru/nestjs-sqs/-/nestjs-sqs-3.0.1.tgz","fileCount":32,"integrity":"sha512-s97qLqGMYmilEs3EE8KqaKYMlR9ktpofAbG9bpabL7iuO7PKnLnc6cQaAqIel5F609dRcUQLg4vPyfebMXApew==","signatures":[{"sig":"MEYCIQCLOCr5A3YrcGmghClH5PzcczDYp3Ux+ZZbjgKyMcz3BwIhAP3eq5CgcWQdwga/q8GEnkEjkpFNjSlm4gKEDo/or40U","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":592204},"main":"dist/index.js","_from":"file:chxru-nestjs-sqs-3.0.1.tgz","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"scripts":{"build":"rimraf -rf dist && tsc -p tsconfig.json","test:e2e":"vitest"},"_npmUser":{"name":"charuka-hs","actor":{"name":"charuka-hs","type":"user","email":"Charuka12@gmail.com"},"email":"Charuka12@gmail.com"},"_resolved":"/tmp/083d8618ce68e9d64e27b9b9a0f54036/chxru-nestjs-sqs-3.0.1.tgz","_integrity":"sha512-s97qLqGMYmilEs3EE8KqaKYMlR9ktpofAbG9bpabL7iuO7PKnLnc6cQaAqIel5F609dRcUQLg4vPyfebMXApew==","repository":{"url":"git+https://github.com/ssut/nestjs-sqs.git","type":"git"},"_npmVersion":"10.9.2","description":"[![Test](https://github.com/ssut/nestjs-sqs/workflows/Test/badge.svg)](https://github.com/ssut/nestjs-sqs/actions?query=workflow%3ATest) [![npm version](https://badge.fury.io/js/%40ssut%2Fnestjs-sqs.svg)](https://badge.fury.io/js/%40ssut%2Fnestjs-sqs)","directories":{},"_nodeVersion":"22.14.0","dependencies":{"sqs-consumer":"^11.0.1","sqs-producer":"^5.0.0","@golevelup/nestjs-discovery":"^4.0.3"},"_hasShrinkwrap":false,"devDependencies":{"rxjs":"^7.8.1","rimraf":"^6.0.1","vitest":"^2.0.2","ts-node":"^10.9.2","prettier":"^3.3.2","typescript":"^5.5.3","@nestjs/core":"^11.0.6","@biomejs/biome":"^1.8.3","@nestjs/common":"^11.0.6","tsconfig-paths":"^4.2.0","@nestjs/testing":"^11.0.6","reflect-metadata":"^0.2.2","unplugin-auto-import":"^0.18.0"},"peerDependencies":{"@nestjs/core":"^6.10.11 || ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0","@nestjs/common":"^6.10.11 || ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0","@aws-sdk/client-sqs":"^3.600.0"},"_npmOperationalInternal":{"tmp":"tmp/nestjs-sqs_3.0.1_1751957470333_0.2778302185013435","host":"s3://npm-registry-packages-npm-production"}},"3.0.2":{"name":"@chxru/nestjs-sqs","version":"3.0.2","keywords":[],"author":{"name":"Suhun Han","email":"ssut@ssut.me"},"license":"MIT","_id":"@chxru/nestjs-sqs@3.0.2","maintainers":[{"name":"charuka-hs","email":"Charuka12@gmail.com"}],"homepage":"https://github.com/chxru/nestjs-sqs#readme","bugs":{"url":"https://github.com/chxru/nestjs-sqs/issues"},"dist":{"shasum":"2e430c1aca932a13860c83c2e4fef2faa7ff1a47","tarball":"https://registry.npmjs.org/@chxru/nestjs-sqs/-/nestjs-sqs-3.0.2.tgz","fileCount":18,"integrity":"sha512-1W2bqDnsLcZO1wcFAc9i75dG1xdBCh4DzE+0jhtVpfeAIwwBqDdfGbA9SVlC5YllgM9TIxMJ2u1ttPOhjstLdg==","signatures":[{"sig":"MEQCIHAW8otBsi6EKJj1GRq1dMKcLsvAWpG57hlhqcozMPp8AiBkZVzjtZo1ZVxqq0uJHHLaMkdyuWJl6Z1/vjBUhuI3JA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":29924},"main":"dist/index.js","_from":"file:chxru-nestjs-sqs-3.0.2.tgz","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"scripts":{"build":"rimraf -rf dist && tsc -p tsconfig.json","test:e2e":"vitest"},"_npmUser":{"name":"charuka-hs","actor":{"name":"charuka-hs","type":"user","email":"Charuka12@gmail.com"},"email":"Charuka12@gmail.com"},"_resolved":"/tmp/1769b8ce628640c82cde12bbf25b2981/chxru-nestjs-sqs-3.0.2.tgz","_integrity":"sha512-1W2bqDnsLcZO1wcFAc9i75dG1xdBCh4DzE+0jhtVpfeAIwwBqDdfGbA9SVlC5YllgM9TIxMJ2u1ttPOhjstLdg==","repository":{"url":"git+https://github.com/chxru/nestjs-sqs.git","type":"git"},"_npmVersion":"10.9.2","description":"[![Test](https://github.com/ssut/nestjs-sqs/workflows/Test/badge.svg)](https://github.com/ssut/nestjs-sqs/actions?query=workflow%3ATest) [![npm version](https://badge.fury.io/js/%40ssut%2Fnestjs-sqs.svg)](https://badge.fury.io/js/%40ssut%2Fnestjs-sqs)","directories":{},"_nodeVersion":"22.14.0","dependencies":{"sqs-consumer":"^11.0.1","sqs-producer":"^5.0.0","@golevelup/nestjs-discovery":"^4.0.3"},"_hasShrinkwrap":false,"devDependencies":{"rxjs":"^7.8.1","rimraf":"^6.0.1","vitest":"^2.0.2","ts-node":"^10.9.2","prettier":"^3.3.2","typescript":"^5.5.3","@nestjs/core":"^11.0.6","@biomejs/biome":"^1.8.3","@nestjs/common":"^11.0.6","tsconfig-paths":"^4.2.0","@nestjs/testing":"^11.0.6","reflect-metadata":"^0.2.2","unplugin-auto-import":"^0.18.0"},"peerDependencies":{"@nestjs/core":"^6.10.11 || ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0","@nestjs/common":"^6.10.11 || ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0","@aws-sdk/client-sqs":"^3.600.0"},"_npmOperationalInternal":{"tmp":"tmp/nestjs-sqs_3.0.2_1751957713914_0.7725971312370274","host":"s3://npm-registry-packages-npm-production"}},"3.0.4":{"name":"@chxru/nestjs-sqs","version":"3.0.4","description":"[![Test](https://github.com/ssut/nestjs-sqs/workflows/Test/badge.svg)](https://github.com/ssut/nestjs-sqs/actions?query=workflow%3ATest) [![npm version](https://badge.fury.io/js/%40ssut%2Fnestjs-sqs.svg)](https://badge.fury.io/js/%40ssut%2Fnestjs-sqs)","main":"dist/index.js","types":"dist/index.d.ts","engines":{"node":">=18.0.0"},"bugs":{"url":"https://github.com/chxru/nestjs-sqs/issues"},"repository":{"type":"git","url":"git+https://github.com/chxru/nestjs-sqs.git"},"keywords":[],"author":{"name":"Suhun Han","email":"ssut@ssut.me"},"license":"MIT","dependencies":{"@golevelup/nestjs-discovery":"^4.0.3","sqs-consumer":"^11.0.1","sqs-producer":"^5.0.0"},"devDependencies":{"@biomejs/biome":"^1.8.3","@nestjs/common":"^11.0.6","@nestjs/core":"^11.0.6","@nestjs/testing":"^11.0.6","prettier":"^3.3.2","reflect-metadata":"^0.2.2","rimraf":"^6.0.1","rxjs":"^7.8.1","ts-node":"^10.9.2","tsconfig-paths":"^4.2.0","typescript":"^5.5.3","unplugin-auto-import":"^0.18.0","vitest":"^2.0.2"},"peerDependencies":{"@aws-sdk/client-sqs":"^3.600.0","@nestjs/common":"^6.10.11 || ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0","@nestjs/core":"^6.10.11 || ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0"},"scripts":{"test:e2e":"vitest","build":"rimraf -rf dist && tsc -p tsconfig.json"},"_id":"@chxru/nestjs-sqs@3.0.4","homepage":"https://github.com/chxru/nestjs-sqs#readme","_integrity":"sha512-kv1A2h1WJgK1HvnndmNfjoAbDIejd52497Q9/2kXRoo8jPAi4i0SSzorIQotHl9lBXLqvXL3GA2XEG4a1NPjOg==","_resolved":"/tmp/244c3267fbc369abc29dbdd8c2540e82/chxru-nestjs-sqs-3.0.4.tgz","_from":"file:chxru-nestjs-sqs-3.0.4.tgz","_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-kv1A2h1WJgK1HvnndmNfjoAbDIejd52497Q9/2kXRoo8jPAi4i0SSzorIQotHl9lBXLqvXL3GA2XEG4a1NPjOg==","shasum":"0aeed0712fb2cf63f2c5350eee47418f1b4bbad8","tarball":"https://registry.npmjs.org/@chxru/nestjs-sqs/-/nestjs-sqs-3.0.4.tgz","fileCount":18,"unpackedSize":30860,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQD0BfWUcLV4N4Ij3PDhvVwyx2yn8SxE1vMWYfTqa8nepgIgavdp0m1xJ5xJtzq0e4eB9ReiVMgaF0MJ/a6xvFloTvc="}]},"_npmUser":{"name":"charuka-hs","email":"Charuka12@gmail.com","actor":{"name":"charuka-hs","email":"Charuka12@gmail.com","type":"user"}},"directories":{},"maintainers":[{"name":"charuka-hs","email":"Charuka12@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/nestjs-sqs_3.0.4_1751964648864_0.3192658310086489"},"_hasShrinkwrap":false}},"time":{"created":"2025-07-08T06:51:10.188Z","modified":"2025-07-08T08:50:49.230Z","3.0.1":"2025-07-08T06:51:10.547Z","3.0.2":"2025-07-08T06:55:14.104Z","3.0.3":"2025-07-08T08:48:25.095Z","3.0.4":"2025-07-08T08:50:49.030Z"},"bugs":{"url":"https://github.com/chxru/nestjs-sqs/issues"},"author":{"name":"Suhun Han","email":"ssut@ssut.me"},"license":"MIT","homepage":"https://github.com/chxru/nestjs-sqs#readme","keywords":[],"repository":{"type":"git","url":"git+https://github.com/chxru/nestjs-sqs.git"},"description":"[![Test](https://github.com/ssut/nestjs-sqs/workflows/Test/badge.svg)](https://github.com/ssut/nestjs-sqs/actions?query=workflow%3ATest) [![npm version](https://badge.fury.io/js/%40ssut%2Fnestjs-sqs.svg)](https://badge.fury.io/js/%40ssut%2Fnestjs-sqs)","maintainers":[{"name":"charuka-hs","email":"Charuka12@gmail.com"}],"readme":"# nestjs-sqs\n\n[![Test](https://github.com/ssut/nestjs-sqs/workflows/Test/badge.svg)](https://github.com/ssut/nestjs-sqs/actions?query=workflow%3ATest)\n[![npm version](https://badge.fury.io/js/%40ssut%2Fnestjs-sqs.svg)](https://badge.fury.io/js/%40ssut%2Fnestjs-sqs)\n\nTested with: [AWS SQS](https://aws.amazon.com/en/sqs/) and [ElasticMQ](https://github.com/softwaremill/elasticmq).\n\nNestjs-sqs is a project to make SQS easier to use and control some required flows with NestJS.\nThis module provides decorator-based message handling suited for simple use.\n\nThis library internally uses [bbc/sqs-producer](https://github.com/bbc/sqs-producer) and [bbc/sqs-consumer](https://github.com/bbc/sqs-consumer), and implements some more useful features on top of the basic functionality given by them.\n\n## Installation\n\n```shell script\nnpm i --save @ssut/nestjs-sqs @aws-sdk/client-sqs\n```\n\n## Quick Start\n\n### Register module\n\nJust register this module:\n\n```ts\n@Module({\n  imports: [\n    SqsModule.register({\n      consumers: [\n        {\n          // Name is a unique identifier for this consumer instance\n          name: \"myConsumer1\",\n          // The actual SQS queue URL\n          queueUrl: \"https://sqs.region.amazonaws.com/account/queue-name\",\n          region: \"us-east-1\",\n        },\n      ],\n      producers: [\n        {\n          // Name is a unique identifier for this producer instance\n          name: \"myProducer1\",\n          // The actual SQS queue URL\n          queueUrl: \"https://sqs.region.amazonaws.com/account/queue-name\",\n          region: \"us-east-1\",\n        },\n      ],\n    }),\n  ],\n})\nclass AppModule {}\n```\n\nQuite often you might want to asynchronously pass module options instead of passing them beforehand.\nIn such case, use `registerAsync()` method like many other Nest.js libraries.\n\n- Use factory\n\n```ts\nSqsModule.registerAsync({\n  useFactory: () => {\n    return {\n      consumers: [...],\n      producers: [...],\n    };\n  },\n});\n```\n\n- Use class\n\n```ts\nSqsModule.registerAsync({\n  useClass: SqsConfigService,\n});\n```\n\n- Use existing\n\n```ts\nSqsModule.registerAsync({\n  imports: [ConfigModule],\n  useExisting: ConfigService,\n});\n```\n\n### Decorate methods\n\nYou need to decorate methods in your NestJS providers in order to have them be automatically attached as event handlers for incoming SQS messages:\n\n```ts\nimport { Message } from \"@aws-sdk/client-sqs\";\n\n@Injectable()\nexport class AppMessageHandler {\n  @SqsMessageHandler(/** name: */ \"myConsumer1\", /** batch: */ false)\n  public async handleMessage(message: Message) {}\n\n  @SqsConsumerEventHandler(\n    /** name: */ \"myConsumer1\",\n    /** eventName: */ \"processing_error\",\n  )\n  public onProcessingError(error: Error, message: Message) {\n    // report errors here\n  }\n}\n```\n\n### Produce messages\n\n```ts\nexport class AppService {\n  public constructor(\n    private readonly sqsService: SqsService,\n  ) { }\n\n  public async dispatchSomething() {\n    await this.sqsService.send(/** name: */ 'myProducer1', {\n      id: 'id',\n      body: { ... },\n      groupId: 'groupId',\n      deduplicationId: 'deduplicationId',\n      messageAttributes: { ... },\n      delaySeconds: 0,\n    });\n  }\n}\n```\n\n### Configuration\n\nSee [here](https://github.com/ssut/nestjs-sqs/blob/master/lib/sqs.types.ts), and note that we have same configuration as [bbc/sqs-consumer's](https://github.com/bbc/sqs-consumer).\nIn most time you just need to specify both `name` and `queueUrl` at the minimum requirements.\n\n## License\n\nThis project is licensed under the terms of the MIT license.\n","readmeFilename":"README.md"}