{"_id":"@adaloop/tellthem","name":"@adaloop/tellthem","dist-tags":{"latest":"0.0.6"},"versions":{"0.0.6":{"name":"@adaloop/tellthem","description":"Simple driver based asynchronous communication library","version":"0.0.6","engines":{"node":">=20.11.1"},"main":"main/index.js","type":"module","exports":{".":"./build/index.js","./drivers/amqp":"./build/src/drivers/amqp.js","./drivers/memory":"./build/src/drivers/memory.js","./drivers/mqtt":"./build/src/drivers/mqtt.js","./drivers/redis":"./build/src/drivers/redis.js","./encoders/json":"./build/src/encoders/json_encoder.js","./encoders/vine":"./build/src/encoders/vine_json_encoder.js","./encoders/yup":"./build/src/encoders/yup_json_encoder.js","./encoders/zod":"./build/src/encoders/zod_json_encoder.js"},"scripts":{"build":"npm run clean && tsc","clean":"del-cli build","format":"prettier --write .","lint":"eslint . --ext .ts","prepublishOnly":"npm run build","release":"npx release-it","test":"c8 node --loader ts-node/esm --enable-source-maps bin/test.ts","quick:test":"node --loader ts-node/esm --enable-source-maps bin/test.ts","typecheck":"tsc --noEmit"},"devDependencies":{"@japa/assert":"^3.0.0","@japa/expect-type":"^2.0.2","@japa/runner":"^3.1.4","@swc/core":"^1.5.22","@adaloop/eslint-config":"^1.0.7","@adaloop/prettier-config":"^1.0.7","@adaloop/tsconfig":"^1.0.7","@testcontainers/hivemq":"^10.9.0","@testcontainers/kafka":"^10.9.0","@testcontainers/redis":"^10.9.0","@types/amqplib":"^0.10.5","@types/node":"^20.12.13","@vinejs/vine":"^2.0.0","amqplib":"^0.10.4","c8":"^9.1.0","del-cli":"^5.1.0","eslint":"^8.57.0","ioredis":"^5.4.1","kafkajs":"^2.2.4","mqtt":"^5.7.0","prettier":"^3.2.5","release-it":"^17.3.0","testcontainers":"^10.9.0","ts-node":"^10.9.2","typescript":"^5.4.5","yup":"^1.4.0","zod":"^3.23.8"},"dependencies":{"@lukeed/ms":"^2.0.2","@paralleldrive/cuid2":"^2.2.2","@poppinss/utils":"^6.7.3"},"peerDependencies":{"@vinejs/vine":">=2.0.0","amqplib":">=0.10.0","ioredis":">=5.0.0","kafkajs":">=2.0.0","mqtt":">=5.0.0","yup":">=1.4.0","zod":">=3.0.0"},"peerDependenciesMeta":{"amqplib":{"optional":true},"ioredis":{"optional":true},"mqtt":{"optional":true},"kafkajs":{"optional":true},"@vinejs/vine":{"optional":true},"yup":{"optional":true},"zod":{"optional":true}},"author":{"name":"adaloop","email":"hello@adaloop.com"},"license":"MIT","keywords":["tellthem","adaloop","bus","event","pubsub","message","queue"],"eslintConfig":{"extends":"@adaloop/eslint-config/package"},"prettier":"@adaloop/prettier-config","publishConfig":{"access":"public","tag":"latest"},"release-it":{"git":{"commitMessage":"chore(release): ${version}","tagAnnotation":"v${version}","tagName":"v${version}"},"github":{"release":true,"releaseName":"v${version}","web":true}},"_id":"@adaloop/tellthem@0.0.6","gitHead":"293dc44aea2f9383e8adc243a157060f5fe8a41d","_nodeVersion":"21.7.3","_npmVersion":"10.8.3","dist":{"integrity":"sha512-6tFhulAuo3ElH3tA0LmfAhxlUimFSszE3AWIWuJFvoT+TIFJPg9Clod+LbZ/U/QSU9CpZkOFAEJTDrpPW5hxgg==","shasum":"9389465153b1b59f29810416be376a5804d3a877","tarball":"https://registry.npmjs.org/@adaloop/tellthem/-/tellthem-0.0.6.tgz","fileCount":81,"unpackedSize":77017,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDu7CoHU2wlnvgchZCAE/Lw7LZkK++pMI+txigd2EyfJAIgJ1z3Fr2lJCG2VC9k3TnNMx8XpskUEl70KGRhHc7dork="}]},"_npmUser":{"name":"tombrulin","email":"tomm.brulin@gmail.com"},"directories":{},"maintainers":[{"name":"tombrulin","email":"tomm.brulin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/tellthem_0.0.6_1726586090479_0.900104744327167"},"_hasShrinkwrap":false}},"time":{"created":"2024-09-17T15:14:50.364Z","0.0.6":"2024-09-17T15:14:50.667Z","modified":"2024-09-17T15:14:50.988Z"},"maintainers":[{"name":"tombrulin","email":"tomm.brulin@gmail.com"}],"description":"Simple driver based asynchronous communication library","keywords":["tellthem","adaloop","bus","event","pubsub","message","queue"],"author":{"name":"adaloop","email":"hello@adaloop.com"},"license":"MIT","readme":"<p align=\"center\">\n  <br/>\n    <a href=\"https://tellthem.adaloop.com/\">TellThem</a> is an asynchronous communication library for Node.js.\n  <br/>\n</p>\n\n## Features\n- 🗄️ Support PubSub and Point to Point\n- 💡 Simple and easy to use\n- 🚀 Many drivers (Redis, In-memory, AMQP, MQTT)\n- 🔁 Retry queue\n- ✅ Typesafe channels\n- 📖 Well documented\n- 🧩 Easily extendable with your own encoders and drivers\n\nSee documentation at [tellthem.adaloop.com](https://tellthem.adaloop.com)\n\n## Why TellThem ?\n\nI wanted a simple driver based and typesafe library to communicate with my services. Since I'm using [`AdonisJS`](https://adonisjs.com/) for most of my projects, I initially created a library for this framework called [`adonis6-amqp`](https://www.npmjs.com/package/adonis6-amqp/v/latest). But when I wanted to use it in a standalone project, I realized that I needed a more generic library. I found out that there is a perfect library for this purpose called [`@boringnode/bus`](https://www.npmjs.com/package/@boringnode/bus), but it's not typesafe , so I decided to create my own that combine the best of both worlds.\n\n## Installation\n```bash\nnpm install @adaloop/tellthem\n```\n\n## Quick start\n\nThe library use a manager you need to use to register buses.\n```typescript\nimport { TellThem } from '@adaloop/tellthem';\nimport { memory } from '@adaloop/tellthem/drivers/memory';\nimport { redis } from '@adaloop/tellthem/drivers/redis';\n\nconst tellThem = new TellThem({\n  default: 'memory',\n  buses: {\n    memory: {\n      driver: memory()\n    },\n    redis: {\n      driver: redis({\n        host: 'localhost',\n        port: 6379,\n      })\n    }\n  }\n});\n```\n\nOnce you created your manager, you will use it to create a channel.\n\n```typescript\nimport { jsonEncoder } from '@adaloop/tellthem/encoders/json';\n\nconst channel = tellThem.channel({\n  name: 'my-channel',\n  defaultBus: 'memory',\n  encoder: jsonEncoder()\n})\n```\n\nThen you can use the created channel to publish and subscribe to messages.\n\n```typescript\nchannel.publish('hello world');\n\nchannel.subscribe((message) => {\n  console.log(message);\n});\n```\n\n### Typesafe channels\n\nChannels are typed using the encoder you used to create them. For example if you want to validate your messages using Zod, you can use the `zodJsonEncoder` from `@adaloop/tellthem/encoders`.\n\n```typescript\nconst channel = tellThem.channel({\n  name: 'my-channel',\n  defaultBus: 'memory',\n  encoder: zodJsonEncoder({\n    schema: z.object({\n      myData: z.string(),\n    })\n  })\n})\n\nchannel.subscribe((message) => {\n  console.log(message.myData); // ✅ Typed\n  console.log(message.myOtherData); // ❌ Not typed\n});\n\nchannel.publish({\n  myData: 'hello world', // ✅ Typed\n  myOtherData: 'hello world' // ❌ Not typed\n})\n```\n\n## Credits\n\nThis library is inspired by [`@boringnode/bus`](https://www.npmjs.com/package/@boringnode/bus).\n","readmeFilename":"README.md"}