{"_id":"@anyq/nats","_rev":"7-60b52be91d4e597b405d7eda3d6e03cc","name":"@anyq/nats","dist-tags":{"latest":"0.5.0"},"versions":{"0.1.0":{"name":"@anyq/nats","version":"0.1.0","keywords":["anyq","queue","nats","jetstream","message-queue","pubsub"],"author":{"name":"Shantanu Sharma"},"license":"MIT","_id":"@anyq/nats@0.1.0","maintainers":[{"name":"sns45","email":"notifyshantanu@gmail.com"}],"homepage":"https://github.com/sns45/anyq#readme","bugs":{"url":"https://github.com/sns45/anyq/issues"},"dist":{"shasum":"8c105d66df8206951e32a5cb7ef162a78cbfcfea","tarball":"https://registry.npmjs.org/@anyq/nats/-/nats-0.1.0.tgz","fileCount":17,"integrity":"sha512-HUuUun5j6dBpdVbnJnMVpDBp/6siHVN1YJp3D8kvowcYYbdis9QP/XIUAXFnvaLWDiEr6xFX4MVrmkTJ/+SRhQ==","signatures":[{"sig":"MEYCIQDeRdWhxhT/hGIlH74HgnMej6FBe5H3Ex3pDxhkNsPv/wIhAO/iNTHlcTTxtch5iax/7tBphIazC8Kxrcrxs+yddnWx","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":59809},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"gitHead":"1210b51fe4a55144ebf5bc798db0732b4c89ddba","scripts":{"dev":"tsc --watch","build":"tsc","clean":"rm -rf dist","typecheck":"tsc --noEmit"},"_npmUser":{"name":"sns45","email":"notifyshantanu@gmail.com"},"repository":{"url":"git+https://github.com/sns45/anyq.git","type":"git","directory":"packages/nats"},"_npmVersion":"10.9.2","description":"NATS JetStream adapter for anyq","directories":{},"_nodeVersion":"22.17.0","dependencies":{"nats":"^2.28.2","@anyq/core":"workspace:*"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.3.3"},"peerDependencies":{"@anyq/core":"workspace:*"},"_npmOperationalInternal":{"tmp":"tmp/nats_0.1.0_1765990974611_0.1680449852156667","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@anyq/nats","version":"0.1.1","keywords":["anyq","queue","nats","jetstream","message-queue","pubsub"],"author":{"name":"Shantanu Sharma"},"license":"MIT","_id":"@anyq/nats@0.1.1","maintainers":[{"name":"sns45","email":"notifyshantanu@gmail.com"}],"homepage":"https://github.com/sns45/anyq#readme","bugs":{"url":"https://github.com/sns45/anyq/issues"},"dist":{"shasum":"3c914b5abb862f132c64eb0103b8ec5e9ee7cd05","tarball":"https://registry.npmjs.org/@anyq/nats/-/nats-0.1.1.tgz","fileCount":18,"integrity":"sha512-/1YjTYoL3dasSelZiCS4IenS2qF0xLEuTiSc34roE0vfSONonpLRcYJoqxf+4kvxuvRApCQvofpj0n3ymkuTjQ==","signatures":[{"sig":"MEUCIQDQqN4CY6xOmAVAsTM2fU2oiSF7l7G4aBL+bQ6R1GJ4oAIgbzpI+oqt6nGLvLRqX/JpEl4SFN5lREet/8NklSWcoS0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":61477},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"gitHead":"30128d564178a5a1d25b736b605bf69644178a0f","scripts":{"dev":"tsc --watch","build":"tsc","clean":"rm -rf dist","typecheck":"tsc --noEmit"},"_npmUser":{"name":"sns45","email":"notifyshantanu@gmail.com"},"repository":{"url":"git+https://github.com/sns45/anyq.git","type":"git","directory":"packages/nats"},"_npmVersion":"10.9.2","description":"NATS JetStream adapter for anyq","directories":{},"_nodeVersion":"22.17.0","dependencies":{"nats":"^2.28.2","@anyq/core":"workspace:*"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.3.3"},"peerDependencies":{"@anyq/core":"workspace:*"},"_npmOperationalInternal":{"tmp":"tmp/nats_0.1.1_1765991386189_0.28918875301392677","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@anyq/nats","version":"0.3.0","keywords":["anyq","queue","nats","jetstream","message-queue","pubsub"],"author":"Shantanu Sharma","license":"MIT","_id":"@anyq/nats@0.3.0","maintainers":[{"name":"sns45","email":"notifyshantanu@gmail.com"}],"homepage":"https://github.com/sns45/anyq#readme","bugs":{"url":"https://github.com/sns45/anyq/issues"},"dist":{"shasum":"b2e13e182441969d08b7adc456bd3081288dc52b","tarball":"https://registry.npmjs.org/@anyq/nats/-/nats-0.3.0.tgz","fileCount":18,"integrity":"sha512-KIOG4VTN61rqTEyCjvMRjQqzViiyyktJ8kr84yyJqGtH219GrFV9oqX9YqOosmQc3I6pJLXw4uOfqMxuXcorUA==","signatures":[{"sig":"MEUCIHnyEUmYy8Rv3blJ5ywE3H1JRsjoxpPe7fpTkvBZ7+nSAiEAraDknKCQqIhUdOhLHIXlNXv6Mqz9M3HQfZ84bgVdvb0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":68179},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","shasum":"b2e13e182441969d08b7adc456bd3081288dc52b","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"dev":"bun build ./src/index.ts --outdir ./dist --target bun --watch","build":"bun build ./src/index.ts --outdir ./dist --target bun && bun run build:types","clean":"rm -rf dist","typecheck":"tsc --noEmit","build:types":"tsc --build --force"},"_npmUser":{"name":"sns45","email":"notifyshantanu@gmail.com"},"_integrity":"sha512-KIOG4VTN61rqTEyCjvMRjQqzViiyyktJ8kr84yyJqGtH219GrFV9oqX9YqOosmQc3I6pJLXw4uOfqMxuXcorUA==","repository":{"url":"https://github.com/sns45/anyq","type":"git","directory":"packages/nats"},"_npmVersion":"10.8.3","description":"NATS JetStream adapter for anyq","directories":{},"_nodeVersion":"24.3.0","dependencies":{"nats":"^2.28.2","@anyq/core":"0.3.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.3.3"},"peerDependencies":{"@anyq/core":"0.3.0"},"_npmOperationalInternal":{"tmp":"tmp/nats_0.3.0_1781961981284_0.36920446895766723","host":"s3://npm-registry-packages-npm-production"}},"0.3.1":{"name":"@anyq/nats","version":"0.3.1","keywords":["anyq","queue","nats","jetstream","message-queue","pubsub"],"author":"Shantanu Sharma","license":"MIT","_id":"@anyq/nats@0.3.1","maintainers":[{"name":"sns45","email":"notifyshantanu@gmail.com"}],"homepage":"https://github.com/sns45/anyq#readme","bugs":{"url":"https://github.com/sns45/anyq/issues"},"dist":{"shasum":"aed964f37202892d334274e97afcaba130c22573","tarball":"https://registry.npmjs.org/@anyq/nats/-/nats-0.3.1.tgz","fileCount":18,"integrity":"sha512-hRwT0qgP4+J/ByoaV50Gkw9fZtweMANmU4kQzx2zTy29hGHuNWvtxZnn6HKDoQTA9Ug/69GCK1ltBiIWnvgZOA==","signatures":[{"sig":"MEUCIAex7aRuwRLEkFURv5dwbn7ESi5aZSZH5uoCrA/drDcCAiEAxu+R+sKuiViaTZ+XwlS86Hn/ue79rPR3uLrKOrYnafU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":68403},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","shasum":"aed964f37202892d334274e97afcaba130c22573","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"dev":"bun build ./src/index.ts --outdir ./dist --target bun --watch","build":"bun build ./src/index.ts --outdir ./dist --target bun && bun run build:types","clean":"rm -rf dist","typecheck":"tsc --noEmit","build:types":"tsc --build --force"},"_npmUser":{"name":"sns45","email":"notifyshantanu@gmail.com"},"_integrity":"sha512-hRwT0qgP4+J/ByoaV50Gkw9fZtweMANmU4kQzx2zTy29hGHuNWvtxZnn6HKDoQTA9Ug/69GCK1ltBiIWnvgZOA==","repository":{"url":"https://github.com/sns45/anyq","type":"git","directory":"packages/nats"},"_npmVersion":"10.8.3","description":"NATS JetStream adapter for anyq","directories":{},"_nodeVersion":"24.3.0","dependencies":{"nats":"^2.28.2","@anyq/core":"0.3.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.3.3"},"peerDependencies":{"@anyq/core":"0.3.0"},"_npmOperationalInternal":{"tmp":"tmp/nats_0.3.1_1782054604521_0.5688139248622606","host":"s3://npm-registry-packages-npm-production"}},"0.3.2":{"name":"@anyq/nats","version":"0.3.2","keywords":["anyq","queue","nats","jetstream","message-queue","pubsub"],"author":"Shantanu Sharma","license":"MIT","_id":"@anyq/nats@0.3.2","maintainers":[{"name":"sns45","email":"notifyshantanu@gmail.com"}],"homepage":"https://github.com/sns45/anyq#readme","bugs":{"url":"https://github.com/sns45/anyq/issues"},"dist":{"shasum":"7ac5ec73be985f8588268990a20240100020d363","tarball":"https://registry.npmjs.org/@anyq/nats/-/nats-0.3.2.tgz","fileCount":18,"integrity":"sha512-/7rv0OyH9MPeW2akqea5/pBRtKiOV4D/9wYdKTw9qxydGjESVskD02XR3JoN2jmb5MFfXDUw6Lq2vQDOkgAKcg==","signatures":[{"sig":"MEQCIFisyaP0DQwgV0lvGC6S6WD0MaeczL9QFjGqby8fQOi7AiBmwKmy+KAsdSlBDLzbML7gLw8Y2+FjEYDdYbdKJHhFiw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":68403},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","shasum":"7ac5ec73be985f8588268990a20240100020d363","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"dev":"bun build ./src/index.ts --outdir ./dist --target bun --watch","build":"bun build ./src/index.ts --outdir ./dist --target bun && bun run build:types","clean":"rm -rf dist","typecheck":"tsc --noEmit","build:types":"tsc --build --force"},"_npmUser":{"name":"sns45","email":"notifyshantanu@gmail.com"},"_integrity":"sha512-/7rv0OyH9MPeW2akqea5/pBRtKiOV4D/9wYdKTw9qxydGjESVskD02XR3JoN2jmb5MFfXDUw6Lq2vQDOkgAKcg==","repository":{"url":"https://github.com/sns45/anyq","type":"git","directory":"packages/nats"},"_npmVersion":"10.8.3","description":"NATS JetStream adapter for anyq","directories":{},"_nodeVersion":"24.3.0","dependencies":{"nats":"^2.28.2","@anyq/core":"0.3.2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.3.3"},"peerDependencies":{"@anyq/core":"0.3.2"},"_npmOperationalInternal":{"tmp":"tmp/nats_0.3.2_1784910273820_0.6197957839946775","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@anyq/nats","version":"0.4.0","keywords":["anyq","queue","nats","jetstream","message-queue","pubsub"],"author":"Shantanu Sharma","license":"Apache-2.0","_id":"@anyq/nats@0.4.0","maintainers":[{"name":"sns45","email":"notifyshantanu@gmail.com"}],"homepage":"https://github.com/sns45/anyq#readme","bugs":{"url":"https://github.com/sns45/anyq/issues"},"dist":{"shasum":"ae6f7f9f6e8d0aa167be9ea8b33a3e54cebc3bee","tarball":"https://registry.npmjs.org/@anyq/nats/-/nats-0.4.0.tgz","fileCount":20,"integrity":"sha512-Cb6bVEEdjUD4hpEnY9TEA3Cst0xD5eFaHKqCSQfMmXtM/OQXkYheGO8qOMqomGj+Moqf0FheVHO1dN+bWSPkKQ==","signatures":[{"sig":"MEQCIGbxOUJRn7zrfPN0cfJe+HKrLsg+wls/loOjefTmoLHOAiB645UlC9Gm33cQwxnmtgtbEnFRTid8EUhzrjTYIrogMw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":80421},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","shasum":"ae6f7f9f6e8d0aa167be9ea8b33a3e54cebc3bee","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"dev":"bun build ./src/index.ts --outdir ./dist --target bun --watch","build":"bun build ./src/index.ts --outdir ./dist --target bun && bun run build:types","clean":"rm -rf dist","typecheck":"tsc --noEmit","build:types":"tsc --build --force"},"_npmUser":{"name":"sns45","email":"notifyshantanu@gmail.com"},"_integrity":"sha512-Cb6bVEEdjUD4hpEnY9TEA3Cst0xD5eFaHKqCSQfMmXtM/OQXkYheGO8qOMqomGj+Moqf0FheVHO1dN+bWSPkKQ==","repository":{"url":"https://github.com/sns45/anyq","type":"git","directory":"packages/nats"},"_npmVersion":"10.8.3","description":"NATS JetStream adapter for anyq","directories":{},"_nodeVersion":"26.3.0","dependencies":{"nats":"^2.28.2","@anyq/core":"0.4.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.3.3"},"peerDependencies":{"@anyq/core":"0.4.0"},"_npmOperationalInternal":{"tmp":"tmp/nats_0.4.0_1787860576355_0.4283965066551383","host":"s3://npm-registry-packages-npm-production"}},"0.5.0":{"name":"@anyq/nats","version":"0.5.0","description":"NATS JetStream adapter for anyq","type":"module","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"build":"bun build ./src/index.ts --outdir ./dist --target bun && bun run build:types","build:types":"tsc --build --force","dev":"bun build ./src/index.ts --outdir ./dist --target bun --watch","typecheck":"tsc --noEmit","clean":"rm -rf dist"},"dependencies":{"@anyq/core":"0.5.0","nats":"^2.28.2"},"devDependencies":{"typescript":"^5.3.3"},"peerDependencies":{"@anyq/core":"0.5.0"},"keywords":["anyq","queue","nats","jetstream","message-queue","pubsub"],"license":"Apache-2.0","author":"Shantanu Sharma","repository":{"type":"git","url":"https://github.com/sns45/anyq","directory":"packages/nats"},"homepage":"https://github.com/sns45/anyq#readme","bugs":{"url":"https://github.com/sns45/anyq/issues"},"publishConfig":{"access":"public"},"_id":"@anyq/nats@0.5.0","_integrity":"sha512-dxvogM79JhHk2tUnN2qm33sL16zFGWEbCxtP8V7SEplXO0mBvWV0Uo6tcASteT7x4nZKqomTeLpUIZHVj4qXOg==","_nodeVersion":"26.3.0","_npmVersion":"10.8.3","shasum":"8dd145393df2b7a2b4bea6ccd5403c0829319fa3","dist":{"integrity":"sha512-dxvogM79JhHk2tUnN2qm33sL16zFGWEbCxtP8V7SEplXO0mBvWV0Uo6tcASteT7x4nZKqomTeLpUIZHVj4qXOg==","shasum":"8dd145393df2b7a2b4bea6ccd5403c0829319fa3","tarball":"https://registry.npmjs.org/@anyq/nats/-/nats-0.5.0.tgz","fileCount":20,"unpackedSize":80421,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDQEu7u5f78Mv0Uj4Uc6oLwQxE+R+EMtfYmXw+nyB7QtwIgJIVCiBo6TMeoInuDbXF9EDoWhDUg6P1M5+aK94Tvrxk="}]},"_npmUser":{"name":"sns45","email":"notifyshantanu@gmail.com"},"directories":{},"maintainers":[{"name":"sns45","email":"notifyshantanu@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/nats_0.5.0_1788809000632_0.032610422045473264"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-17T17:02:54.533Z","modified":"2026-09-07T19:23:20.944Z","0.1.0":"2025-12-17T17:02:54.768Z","0.1.1":"2025-12-17T17:09:46.356Z","0.3.0":"2026-06-20T13:26:21.425Z","0.3.1":"2026-06-21T15:10:04.667Z","0.3.2":"2026-07-24T16:24:33.962Z","0.4.0":"2026-08-27T19:56:16.492Z","0.5.0":"2026-09-07T19:23:20.788Z"},"bugs":{"url":"https://github.com/sns45/anyq/issues"},"author":"Shantanu Sharma","license":"Apache-2.0","homepage":"https://github.com/sns45/anyq#readme","keywords":["anyq","queue","nats","jetstream","message-queue","pubsub"],"repository":{"type":"git","url":"https://github.com/sns45/anyq","directory":"packages/nats"},"description":"NATS JetStream adapter for anyq","maintainers":[{"name":"sns45","email":"notifyshantanu@gmail.com"}],"readme":"# @anyq/nats\n\nNATS JetStream adapter for **anyq** - lightweight persistent messaging.\n\n## Installation\n\n```bash\nnpm install @anyq/nats @anyq/core nats\n```\n\n## Usage\n\n```typescript\nimport { NatsProducer, NatsConsumer } from '@anyq/nats';\n\n// Create producer\nconst producer = new NatsProducer({\n  servers: ['localhost:4222'],\n  stream: 'my-stream',\n  subject: 'orders.>'\n});\n\n// Create consumer\nconst consumer = new NatsConsumer({\n  servers: ['localhost:4222'],\n  stream: 'my-stream',\n  subject: 'orders.>',\n  durable: 'my-consumer'\n});\n\nawait producer.connect();\nawait consumer.connect();\n\n// Subscribe to messages\nawait consumer.subscribe(async (message) => {\n  console.log('Received:', message.data);\n  console.log('Subject:', message.metadata.subject);\n  await message.ack();\n});\n\n// Publish messages\nawait producer.publish({\n  orderId: '12345',\n  status: 'created'\n});\n\n// Cleanup\nawait consumer.disconnect();\nawait producer.disconnect();\n```\n\n## Configuration\n\n```typescript\ninterface NatsConfig {\n  servers: string[];         // NATS server addresses\n  stream: string;            // JetStream stream name\n  subject: string;           // Subject pattern (supports wildcards)\n  durable?: string;          // Durable consumer name\n  // Authentication\n  user?: string;\n  pass?: string;\n  token?: string;\n  // Consumer options\n  ackPolicy?: 'explicit' | 'none' | 'all';\n  deliverPolicy?: 'all' | 'last' | 'new';\n  maxDeliver?: number;       // Max redelivery attempts\n}\n```\n\n## Features\n\n- JetStream persistence\n- Subject wildcards (`*`, `>`)\n- Durable consumers\n- At-least-once / exactly-once delivery\n- Work queues (load balancing)\n- Message replay\n\n## Retry strategies (0.3.0)\n\nThis adapter participates in the opt-in pluggable retry strategies from `@anyq/core`. Pass a strategy via `BaseQueueConfig.strategy` and `NATSConsumer.applyStrategy()` takes over per-message error handling; omit it and the legacy catch behaviour (log; broker redelivers based on `maxDeliver` / `ackWait`) runs unchanged.\n\n| Capability | Support |\n|---|---|\n| `supportsNativeDelay` | **true** |\n| Native `park` | JetStream `nak(delayMs)` — message is re-delivered after `delayMs` without consuming an ack-wait |\n| `deadLetterMessage` | default (`nack(false)`) |\n\n> Behaviour change (0.3.0): `message.nack(false)` now calls `jsMsg.term()` (terminate without redelivery) instead of ignoring the parameter and calling `nak()`. Previously, dead-lettered messages would be redelivered by JetStream regardless. Code that relied on the old (incorrect) behaviour should pass `nack(true)` explicitly.\n\n```typescript\nimport { retryThenDeadLetter } from '@anyq/core';\n\nconst consumer = new NATSConsumer({\n  connection: { servers: 'nats://localhost:4222' },\n  jetstream: { stream: 'ORDERS', subjects: ['orders'] },\n  subject: 'orders',\n  strategy: retryThenDeadLetter({ maxAttempts: 5 }),\n});\n```\n\nSee `@anyq/core` for the full strategy catalogue.\n\n## License\n\nApache License 2.0. See [LICENSE](https://github.com/sns45/anyq/blob/main/LICENSE).\n","readmeFilename":"README.md"}