{"_id":"@core-tecnologias-empresariales/core-notifications","name":"@core-tecnologias-empresariales/core-notifications","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@core-tecnologias-empresariales/core-notifications","version":"0.1.0","description":"Notificaciones desacopladas de canal (Email, In-App, futuros Push/SMS) para el ecosistema Core Tecnología Empresarial.","license":"UNLICENSED","publishConfig":{"access":"public"},"type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":"./dist/index.js"},"dependencies":{"@core-tecnologias-empresariales/core-mail":"0.1.0"},"devDependencies":{"typescript":"^5.7.0","@types/node":"^20.14.0"},"scripts":{"build":"tsc -p tsconfig.json","test":"tsc -p tsconfig.json && node --test dist"},"_id":"@core-tecnologias-empresariales/core-notifications@0.1.0","_integrity":"sha512-IwVTcL1ml4OgwDm2D0vd//wosKQRnNkFBb0w0s63J7oBtN9P9TR0NkqxiNbHN8bbuX8wEQ7rMys6jVxJ4Jjk4w==","_resolved":"C:\\Users\\Administrador\\AppData\\Local\\Temp\\0492328893218408d9949171b8b02207\\core-tecnologias-empresariales-core-notifications-0.1.0.tgz","_from":"file:core-tecnologias-empresariales-core-notifications-0.1.0.tgz","_nodeVersion":"20.20.0","_npmVersion":"11.11.0","dist":{"integrity":"sha512-IwVTcL1ml4OgwDm2D0vd//wosKQRnNkFBb0w0s63J7oBtN9P9TR0NkqxiNbHN8bbuX8wEQ7rMys6jVxJ4Jjk4w==","shasum":"4ae4990fd35ef1ec88de3162b8539557451ab576","tarball":"https://registry.npmjs.org/@core-tecnologias-empresariales/core-notifications/-/core-notifications-0.1.0.tgz","fileCount":23,"unpackedSize":16335,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIEOtktgUscWyONpnfnljWwIpVOkmCuyDLgtkG2+8gL42AiEA5yCGLT6RfQUKDIdP9n70GdkKsg5+F38Bt4UsY3IHvR4="}]},"_npmUser":{"name":"balamchac","email":"marcelosazop@gmail.com"},"directories":{},"maintainers":[{"name":"balamchac","email":"marcelosazop@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/core-notifications_0.1.0_1788053564948_0.4132837760238708"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-30T01:32:44.765Z","0.1.0":"2026-08-30T01:32:45.089Z","modified":"2026-08-30T01:32:45.317Z"},"maintainers":[{"name":"balamchac","email":"marcelosazop@gmail.com"}],"description":"Notificaciones desacopladas de canal (Email, In-App, futuros Push/SMS) para el ecosistema Core Tecnología Empresarial.","license":"UNLICENSED","readme":"# @core-tecnologias-empresariales/core-notifications\n\nNotificaciones del ecosistema Core Tecnología Empresarial. Separa `Notification` (el evento) de `Channel` (por dónde se entrega) — CLAUDE.md §15.\n\n## API\n\n```ts\nimport { dispatchNotification, createEmailChannel, createInAppChannel } from \"@core-tecnologias-empresariales/core-notifications\";\nimport { createMailer, createSmtpTransport } from \"@core-tecnologias-empresariales/core-mail\";\n\nconst mailer = createMailer([createSmtpTransport({ name: \"principal\", host: \"smtp.example.com\", port: 587 })]);\n\nconst emailChannel = createEmailChannel({\n  mailer,\n  from: \"noreply@core.dev\",\n  resolveEmail: (userId) => lookupEmail(userId), // tu propia resolución\n});\n\nconst inAppChannel = createInAppChannel({\n  save: (userId, notification) => db.inAppNotifications.insert({ userId, ...notification }),\n});\n\nconst results = await dispatchNotification({\n  notification: { id: \"n1\", userId: \"u1\", type: \"sale_created\", title: \"Venta registrada\", body: \"Venta #83921 creada\" },\n  channels: [emailChannel, inAppChannel],\n  isChannelEnabled: (userId, channel) => getUserPreferences(userId).includes(channel),\n});\n// [{ channel: \"email\", outcome: \"sent\" }, { channel: \"in-app\", outcome: \"sent\" }]\n```\n\nUn canal que falla se reporta como `{ outcome: \"failed\", error }` — nunca bloquea a los demás ni lanza. Sin `isChannelEnabled`, todos los canales se consideran habilitados.\n\n## Canales incluidos\n\n- **Email** (`createEmailChannel`) — sobre `core-mail`. Usa `title`/`body` de la notificación por defecto; acepta `renderSubject`/`renderHtml` para personalizar sin construir un motor de templates completo.\n- **In-App** (`createInAppChannel`) — delega la persistencia al `store` inyectado (regla \"no core-database\": cada producto guarda sus notificaciones in-app donde quiera).\n\n## Para qué NO sirve todavía (`ponytail:` diferido)\n\nPush y SMS quedan preparados por el `NotificationChannel` interface pero sin implementación — se agregan cuando haya un proveedor real elegido. Programación (`scheduled`) e idioma/i18n de la notificación tampoco están en v0.1: se integran con `core-jobs` y `core-i18n` respectivamente cuando exista el caso concreto.\n\n## Instalación\n\n```bash\npnpm add @core-tecnologias-empresariales/core-notifications\n```\n\n## Desarrollo\n\n```bash\npnpm build\npnpm test\n```\n","readmeFilename":"README.md","_rev":"1-4969bfbf89e300d30bd3c7de26cb35dd"}