Communicationv0.1.5
@tekir/notification
Multi-channel notifications: mail, database, and push.
Installation
$
bun add @tekir/notificationFeatures
- BaseNotification with via() channel selection
- Mail, database, push, and log channels
- toMail(), toDatabase(), toPush() methods
- Notification manager for dispatching
- FCM push notification support
Quick Example
TypeScript
import { BaseNotification, Notification } from '@tekir/notification'
class Welcome extends BaseNotification {
via() { return ['mail', 'database'] }
toMail() { return { subject: 'Welcome!', html: '<h1>Hi</h1>' } }
toDatabase() { return { type: 'welcome' } }
}
await Notification.send(userId, new Welcome())Changelog
v0.1.5LatestSeptember 16, 2026
- Published output now uses the shared Node-targeted ESM bundle pipeline with external dependencies and generated TypeScript declarations, while Bun consumers keep the native source export.
v0.1.4July 23, 2026
- Package metadata now follows the shared compatible
0.1.xdependency range used by this coordinated Tekir release.
v0.1.3July 16, 2026
- Notification delivery isolates channel/user failures, applies configured default channels, supports both database adapter shapes, injects mail correctly, and deeply redacts persisted sensitive data.
v0.1.2June 13, 2026
- The database channel now redacts sensitive keys (
password,token,secret,apiKey,otp,pin,ssn,cvv, and similar, including nested objects) before storing a notification payload. - FCM push now sends a matching auth and endpoint pair: an OAuth access token uses the v1 endpoint with
Authorization: Bearer, otherwise the legacykey=endpoint is used, and both paths checkresponse.okand honor a configured endpoint. User ids are normalized to FCM's allowed topic character set. sendandsendManynow usePromise.allSettled, so one channel or recipient failing no longer drops the others; failures are logged.- The mail channel sanitizes its payload through
@tekir/mail's header-injection sanitizer as defense in depth. - Found and fixed with Fable.
v0.1.1May 8, 2026
assertSentand the related sent-history matchers now accept any concreteBaseNotificationsubclass without a cast. Notification classes commonly take constructor arguments (new WelcomeNotification(userName)); the previous signature required(...args: unknown[])which is contravariantly incompatible with that pattern, so aWelcomeNotificationconstructor reference would not type-check.
v0.1.0April 1, 2026
- Initial release