@classytic/notifications 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  All notable changes to `@classytic/notifications` will be documented in this file.
4
4
 
5
+ ## [2.6.0] — 2026-10-09
6
+
7
+ ### Added — `TelegramChannel`
8
+
9
+ A Bot API channel over native `fetch`, no dependency. Sends to `recipient.telegramChatId`
10
+ (new optional field on `Recipient`), else the channel's default `chatId`. Text comes from
11
+ `data.text` / `data.message` / `data.subject`, like `SmsChannel`, with the same `canSend`
12
+ pre-check, so a payload with no destination or no text is skipped before it spends a
13
+ rate-limit token.
14
+
15
+ Failures are classified: a Bot API refusal (bad token, unknown chat, bot removed) returns
16
+ `failed` with `retryable: false`; 429, 5xx and network errors throw a `ChannelError`, which
17
+ the service retries. The token is part of the request URL, so no error message includes the
18
+ URL. `providerMessageId` is Telegram's `message_id`.
19
+
5
20
  ## [2.5.0] — 2026-08-26
6
21
 
7
22
  ### Fixed — send-failure log now walks the `cause` chain
package/README.md CHANGED
@@ -236,6 +236,26 @@ const snsSms = new SmsChannel({
236
236
  });
237
237
  ```
238
238
 
239
+ ### TelegramChannel
240
+
241
+ Bot API over `fetch`, no SDK. Messages go to `recipient.telegramChatId`, else the channel's
242
+ default `chatId` (usually a team group), so it suits a team's own alerts.
243
+
244
+ ```typescript
245
+ import { TelegramChannel } from '@classytic/notifications/channels';
246
+
247
+ new TelegramChannel({
248
+ botToken: process.env.TELEGRAM_BOT_TOKEN!, // from @BotFather
249
+ chatId: process.env.TELEGRAM_CHAT_ID!, // e.g. -1001234567890 for a group
250
+ events: ['order.placed'],
251
+ parseMode: 'HTML', // optional
252
+ });
253
+ ```
254
+
255
+ Text comes from `data.text`, `data.message` or `data.subject`. A refusal (bad token,
256
+ unknown chat, bot removed from the group) fails without retry; a rate limit, a server
257
+ error or a network failure is retried. The token never appears in an error.
258
+
239
259
  ### PushChannel (BYOP)
240
260
 
241
261
  Zero dependencies — bring your own push SDK.
@@ -1,2 +1,2 @@
1
- import { a as EmailChannel, i as WebhookChannel, n as SmsChannel, o as BaseChannel, r as ConsoleChannel, t as PushChannel } from "../push.channel-1tNMyaXl.mjs";
2
- export { BaseChannel, ConsoleChannel, EmailChannel, PushChannel, SmsChannel, WebhookChannel };
1
+ import { a as WebhookChannel, i as ConsoleChannel, n as PushChannel, o as EmailChannel, r as SmsChannel, s as BaseChannel, t as TelegramChannel } from "../telegram.channel-CqFwP-3Y.mjs";
2
+ export { BaseChannel, ConsoleChannel, EmailChannel, PushChannel, SmsChannel, TelegramChannel, WebhookChannel };
@@ -1,3 +1,3 @@
1
- import { a as EmailChannel, i as WebhookChannel, n as SmsChannel, o as BaseChannel, r as ConsoleChannel, t as PushChannel } from "../push.channel-BkgxUc82.mjs";
1
+ import { a as WebhookChannel, i as ConsoleChannel, n as PushChannel, o as EmailChannel, r as SmsChannel, s as BaseChannel, t as TelegramChannel } from "../telegram.channel-B2qKQEkV.mjs";
2
2
 
3
- export { BaseChannel, ConsoleChannel, EmailChannel, PushChannel, SmsChannel, WebhookChannel };
3
+ export { BaseChannel, ConsoleChannel, EmailChannel, PushChannel, SmsChannel, TelegramChannel, WebhookChannel };
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { A as TemplateResult, B as DeliveryLogQuery, C as RetryConfig, D as SmsProvider, E as SmsChannelConfig, F as QueueJob, G as MemoryRateLimitStore, H as IDEMPOTENCY_DEFAULT_TTL, I as QueueJobStatus, K as RateLimitConfig, L as QueueProcessor, M as MemoryQueue, N as QueueAdapter, O as SmtpTransportOptions, P as QueueEnqueueOptions, R as DeliveryLog, S as ResolvedRetryConfig, T as ServiceEvent, U as IdempotencyStore, V as MemoryDeliveryLog, W as MemoryIdempotencyStore, _ as NotificationServiceConfig, a as ChannelConfig, b as PushProvider, c as EmailChannelConfig, d as HookMap, f as Logger, g as NotificationPreferences, h as NotificationPayload, i as Channel, j as WebhookChannelConfig, k as TemplateResolver, l as EventHandler, m as NotificationHookConfig, n as BatchProgress, o as DispatchResult, p as NodemailerTransporter, q as RateLimitStore, r as BatchResult, s as EmailAttachment, t as BatchOptions, u as HookHandler, v as PreferenceResolver, w as SendResult, x as Recipient, y as PushChannelConfig, z as DeliveryLogEntry } from "./types-DkFudalo.mjs";
2
- import { a as EmailChannel, i as WebhookChannel, n as SmsChannel, o as BaseChannel, r as ConsoleChannel, t as PushChannel } from "./push.channel-1tNMyaXl.mjs";
3
- import { C as resolveRetryConfig, S as calculateDelay, T as mergeHooks, _ as isQuietHours, a as createStatusHandler, b as ProviderNotInstalledError, c as InterpolateOptions, d as TemplateMap, f as createSimpleResolver, g as QuietHoursConfig, h as pMap, i as StatusUpdate, l as SimpleResolverOptions, m as PMapOptions, n as StatusHandler, o as FallbackOptions, p as interpolateHtml, r as StatusHandlerConfig, s as withFallback, t as DeliveryStatus, u as TemplateDefinition, v as ChannelError, w as withRetry, x as Emitter, y as NotificationError } from "./status-webhook-CuCdFeVN.mjs";
1
+ import { A as TemplateResolver, B as DeliveryLogEntry, C as RetryConfig, D as SmsProvider, E as SmsChannelConfig, F as QueueEnqueueOptions, G as MemoryIdempotencyStore, H as MemoryDeliveryLog, I as QueueJob, J as RateLimitStore, K as MemoryRateLimitStore, L as QueueJobStatus, M as WebhookChannelConfig, N as MemoryQueue, O as SmtpTransportOptions, P as QueueAdapter, R as QueueProcessor, S as ResolvedRetryConfig, T as ServiceEvent, U as IDEMPOTENCY_DEFAULT_TTL, V as DeliveryLogQuery, W as IdempotencyStore, _ as NotificationServiceConfig, a as ChannelConfig, b as PushProvider, c as EmailChannelConfig, d as HookMap, f as Logger, g as NotificationPreferences, h as NotificationPayload, i as Channel, j as TemplateResult, k as TelegramChannelConfig, l as EventHandler, m as NotificationHookConfig, n as BatchProgress, o as DispatchResult, p as NodemailerTransporter, q as RateLimitConfig, r as BatchResult, s as EmailAttachment, t as BatchOptions, u as HookHandler, v as PreferenceResolver, w as SendResult, x as Recipient, y as PushChannelConfig, z as DeliveryLog } from "./types-DsRpYKr-.mjs";
2
+ import { a as WebhookChannel, i as ConsoleChannel, n as PushChannel, o as EmailChannel, r as SmsChannel, s as BaseChannel, t as TelegramChannel } from "./telegram.channel-CqFwP-3Y.mjs";
3
+ import { C as resolveRetryConfig, S as calculateDelay, T as mergeHooks, _ as isQuietHours, a as createStatusHandler, b as ProviderNotInstalledError, c as InterpolateOptions, d as TemplateMap, f as createSimpleResolver, g as QuietHoursConfig, h as pMap, i as StatusUpdate, l as SimpleResolverOptions, m as PMapOptions, n as StatusHandler, o as FallbackOptions, p as interpolateHtml, r as StatusHandlerConfig, s as withFallback, t as DeliveryStatus, u as TemplateDefinition, v as ChannelError, w as withRetry, x as Emitter, y as NotificationError } from "./status-webhook-C8WnLIMv.mjs";
4
4
  //#region src/NotificationService.d.ts
5
5
  declare class NotificationService {
6
6
  private channels;
@@ -133,4 +133,4 @@ declare class NotificationService {
133
133
  off(event: ServiceEvent, handler: EventHandler): this;
134
134
  }
135
135
  //#endregion
136
- export { BaseChannel, type BatchOptions, type BatchProgress, type BatchResult, type Channel, type ChannelConfig, ChannelError, ConsoleChannel, type DeliveryLog, type DeliveryLogEntry, type DeliveryLogQuery, type DeliveryStatus, type DispatchResult, type EmailAttachment, EmailChannel, type EmailChannelConfig, Emitter, type EventHandler, type FallbackOptions, type HookHandler, type HookMap, IDEMPOTENCY_DEFAULT_TTL, type IdempotencyStore, type InterpolateOptions, type Logger, MemoryDeliveryLog, MemoryIdempotencyStore, MemoryQueue, MemoryRateLimitStore, type NodemailerTransporter, NotificationError, type NotificationHookConfig, type NotificationPayload, type NotificationPreferences, NotificationService, type NotificationServiceConfig, type PMapOptions, type PreferenceResolver, ProviderNotInstalledError, PushChannel, type PushChannelConfig, type PushProvider, type QueueAdapter, type QueueEnqueueOptions, type QueueJob, type QueueJobStatus, type QueueProcessor, type QuietHoursConfig, type RateLimitConfig, type RateLimitStore, type Recipient, type ResolvedRetryConfig, type RetryConfig, type SendResult, type ServiceEvent, type SimpleResolverOptions, SmsChannel, type SmsChannelConfig, type SmsProvider, type SmtpTransportOptions, type StatusHandler, type StatusHandlerConfig, type StatusUpdate, type TemplateDefinition, type TemplateMap, type TemplateResolver, type TemplateResult, WebhookChannel, type WebhookChannelConfig, calculateDelay, createSimpleResolver, createStatusHandler, interpolateHtml, isQuietHours, mergeHooks, pMap, resolveRetryConfig, withFallback, withRetry };
136
+ export { BaseChannel, type BatchOptions, type BatchProgress, type BatchResult, type Channel, type ChannelConfig, ChannelError, ConsoleChannel, type DeliveryLog, type DeliveryLogEntry, type DeliveryLogQuery, type DeliveryStatus, type DispatchResult, type EmailAttachment, EmailChannel, type EmailChannelConfig, Emitter, type EventHandler, type FallbackOptions, type HookHandler, type HookMap, IDEMPOTENCY_DEFAULT_TTL, type IdempotencyStore, type InterpolateOptions, type Logger, MemoryDeliveryLog, MemoryIdempotencyStore, MemoryQueue, MemoryRateLimitStore, type NodemailerTransporter, NotificationError, type NotificationHookConfig, type NotificationPayload, type NotificationPreferences, NotificationService, type NotificationServiceConfig, type PMapOptions, type PreferenceResolver, ProviderNotInstalledError, PushChannel, type PushChannelConfig, type PushProvider, type QueueAdapter, type QueueEnqueueOptions, type QueueJob, type QueueJobStatus, type QueueProcessor, type QuietHoursConfig, type RateLimitConfig, type RateLimitStore, type Recipient, type ResolvedRetryConfig, type RetryConfig, type SendResult, type ServiceEvent, type SimpleResolverOptions, SmsChannel, type SmsChannelConfig, type SmsProvider, type SmtpTransportOptions, type StatusHandler, type StatusHandlerConfig, type StatusUpdate, TelegramChannel, type TelegramChannelConfig, type TemplateDefinition, type TemplateMap, type TemplateResolver, type TemplateResult, WebhookChannel, type WebhookChannelConfig, calculateDelay, createSimpleResolver, createStatusHandler, interpolateHtml, isQuietHours, mergeHooks, pMap, resolveRetryConfig, withFallback, withRetry };
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { a as MemoryQueue, c as pMap, d as MemoryIdempotencyStore, f as isQuietHours, g as Emitter, h as withRetry, i as interpolateHtml, l as MemoryRateLimitStore, m as resolveRetryConfig, n as withFallback, o as MemoryDeliveryLog, p as calculateDelay, r as createSimpleResolver, s as mergeHooks, t as createStatusHandler, u as IDEMPOTENCY_DEFAULT_TTL } from "./status-webhook-B4Sv8X_G.mjs";
2
2
  import { n as NotificationError, r as ProviderNotInstalledError, t as ChannelError } from "./errors-BxRjct-E.mjs";
3
- import { a as EmailChannel, i as WebhookChannel, n as SmsChannel, o as BaseChannel, r as ConsoleChannel, t as PushChannel } from "./push.channel-BkgxUc82.mjs";
3
+ import { a as WebhookChannel, i as ConsoleChannel, n as PushChannel, o as EmailChannel, r as SmsChannel, s as BaseChannel, t as TelegramChannel } from "./telegram.channel-B2qKQEkV.mjs";
4
4
 
5
5
  //#region src/NotificationService.ts
6
6
  /**
@@ -508,7 +508,7 @@ var NotificationService = class {
508
508
  * Zero required dependencies - bring your own providers.
509
509
  *
510
510
  * v2: Rate limiting, delivery tracking, queue adapter,
511
- * BCC batching, template engines, SMS & push channels.
511
+ * BCC batching, template engines, SMS, push and Telegram channels.
512
512
  *
513
513
  * @module @classytic/notifications
514
514
  * @author Classytic (https://github.com/classytic)
@@ -552,4 +552,4 @@ var NotificationService = class {
552
552
  */
553
553
 
554
554
  //#endregion
555
- export { BaseChannel, ChannelError, ConsoleChannel, EmailChannel, Emitter, IDEMPOTENCY_DEFAULT_TTL, MemoryDeliveryLog, MemoryIdempotencyStore, MemoryQueue, MemoryRateLimitStore, NotificationError, NotificationService, ProviderNotInstalledError, PushChannel, SmsChannel, WebhookChannel, calculateDelay, createSimpleResolver, createStatusHandler, interpolateHtml, isQuietHours, mergeHooks, pMap, resolveRetryConfig, withFallback, withRetry };
555
+ export { BaseChannel, ChannelError, ConsoleChannel, EmailChannel, Emitter, IDEMPOTENCY_DEFAULT_TTL, MemoryDeliveryLog, MemoryIdempotencyStore, MemoryQueue, MemoryRateLimitStore, NotificationError, NotificationService, ProviderNotInstalledError, PushChannel, SmsChannel, TelegramChannel, WebhookChannel, calculateDelay, createSimpleResolver, createStatusHandler, interpolateHtml, isQuietHours, mergeHooks, pMap, resolveRetryConfig, withFallback, withRetry };
@@ -1,4 +1,4 @@
1
- import { C as RetryConfig, S as ResolvedRetryConfig, d as HookMap, h as NotificationPayload, k as TemplateResolver, o as DispatchResult, u as HookHandler } from "./types-DkFudalo.mjs";
1
+ import { A as TemplateResolver, C as RetryConfig, S as ResolvedRetryConfig, d as HookMap, h as NotificationPayload, o as DispatchResult, u as HookHandler } from "./types-DsRpYKr-.mjs";
2
2
  //#region src/utils/merge-hooks.d.ts
3
3
  type HookInput = Record<string, HookHandler | HookHandler[]>;
4
4
  declare function mergeHooks(...hookConfigs: (HookInput | null | undefined)[]): HookMap;
@@ -591,4 +591,111 @@ var PushChannel = class extends BaseChannel {
591
591
  };
592
592
 
593
593
  //#endregion
594
- export { EmailChannel as a, WebhookChannel as i, SmsChannel as n, BaseChannel as o, ConsoleChannel as r, PushChannel as t };
594
+ //#region src/channels/telegram.channel.ts
595
+ /**
596
+ * Telegram Channel
597
+ * @module @classytic/notifications
598
+ *
599
+ * Sends a text message through the Telegram Bot API. Zero dependencies: one
600
+ * `fetch` to `sendMessage`.
601
+ *
602
+ * Telegram is the simple messaging case: no template approval, no service
603
+ * window, no business verification. A bot may message any chat it has been
604
+ * added to, immediately, which makes it the natural channel for a team's own
605
+ * alerts ("a new order is waiting for confirmation").
606
+ *
607
+ * ## Where a message goes
608
+ *
609
+ * `recipient.telegramChatId` when the recipient has one, else the channel's
610
+ * default `chatId` (typically the team's group). Telegram addresses chats by
611
+ * numeric id or `@channelname`; there is no phone-to-chat lookup, so a phone
612
+ * number is never used as a destination.
613
+ *
614
+ * @example
615
+ * ```typescript
616
+ * import { TelegramChannel } from '@classytic/notifications/channels';
617
+ *
618
+ * const ops = new TelegramChannel({
619
+ * botToken: process.env.TELEGRAM_BOT_TOKEN!,
620
+ * chatId: process.env.TELEGRAM_CHAT_ID!, // the team group
621
+ * events: ['order.placed'],
622
+ * });
623
+ * ```
624
+ */
625
+ const DEFAULT_API = "https://api.telegram.org";
626
+ var TelegramChannel = class extends BaseChannel {
627
+ constructor(config) {
628
+ if (!config.botToken) throw new ChannelError(config.name ?? "telegram", "TelegramChannel requires a botToken.");
629
+ super({
630
+ name: "telegram",
631
+ ...config
632
+ });
633
+ }
634
+ destinationOf(payload) {
635
+ return payload.recipient.telegramChatId || this.config.chatId || void 0;
636
+ }
637
+ textOf(payload) {
638
+ const { data } = payload;
639
+ return data.text ?? data.message ?? data.subject ?? "";
640
+ }
641
+ /**
642
+ * Deterministic skips, checked before the service spends a rate-limit token:
643
+ * nowhere to send, or nothing to say.
644
+ */
645
+ canSend(payload) {
646
+ if (!this.destinationOf(payload)) return {
647
+ status: "skipped",
648
+ channel: this.name,
649
+ error: "No Telegram chat id (recipient.telegramChatId or the channel chatId)"
650
+ };
651
+ if (!this.textOf(payload)) return {
652
+ status: "skipped",
653
+ channel: this.name,
654
+ error: "No message body (data.text, data.message, or data.subject)"
655
+ };
656
+ return null;
657
+ }
658
+ async send(payload) {
659
+ const skip = this.canSend(payload);
660
+ if (skip) return skip;
661
+ const body = {
662
+ chat_id: this.destinationOf(payload),
663
+ text: this.textOf(payload),
664
+ ...this.config.parseMode ? { parse_mode: this.config.parseMode } : {},
665
+ ...this.config.silent ? { disable_notification: true } : {},
666
+ link_preview_options: { is_disabled: true }
667
+ };
668
+ let response;
669
+ try {
670
+ response = await fetch(`${this.config.apiBaseUrl ?? DEFAULT_API}/bot${this.config.botToken}/sendMessage`, {
671
+ method: "POST",
672
+ headers: { "Content-Type": "application/json" },
673
+ body: JSON.stringify(body),
674
+ signal: AbortSignal.timeout(this.config.timeout ?? 1e4)
675
+ });
676
+ } catch (err) {
677
+ const message = err instanceof Error ? err.message : String(err);
678
+ throw new ChannelError(this.name, `Telegram unreachable: ${message}`, err instanceof Error ? err : void 0);
679
+ }
680
+ const json = await response.json().catch(() => ({}));
681
+ if (response.ok && json.ok) {
682
+ const id = json.result?.message_id;
683
+ return {
684
+ status: "sent",
685
+ channel: this.name,
686
+ ...id !== void 0 ? { providerMessageId: String(id) } : {}
687
+ };
688
+ }
689
+ const reason = `Telegram ${response.status}: ${json.description ?? response.statusText}`;
690
+ if (response.status === 429 || response.status >= 500) throw new ChannelError(this.name, reason);
691
+ return {
692
+ status: "failed",
693
+ channel: this.name,
694
+ error: reason,
695
+ retryable: false
696
+ };
697
+ }
698
+ };
699
+
700
+ //#endregion
701
+ export { WebhookChannel as a, ConsoleChannel as i, PushChannel as n, EmailChannel as o, SmsChannel as r, BaseChannel as s, TelegramChannel as t };
@@ -1,4 +1,4 @@
1
- import { C as RetryConfig, E as SmsChannelConfig, K as RateLimitConfig, a as ChannelConfig, c as EmailChannelConfig, h as NotificationPayload, i as Channel, j as WebhookChannelConfig, w as SendResult, y as PushChannelConfig } from "./types-DkFudalo.mjs";
1
+ import { C as RetryConfig, E as SmsChannelConfig, M as WebhookChannelConfig, a as ChannelConfig, c as EmailChannelConfig, h as NotificationPayload, i as Channel, k as TelegramChannelConfig, q as RateLimitConfig, w as SendResult, y as PushChannelConfig } from "./types-DsRpYKr-.mjs";
2
2
  //#region src/channels/BaseChannel.d.ts
3
3
  declare abstract class BaseChannel<TConfig extends ChannelConfig = ChannelConfig> implements Channel {
4
4
  readonly name: string;
@@ -73,4 +73,17 @@ declare class PushChannel extends BaseChannel<PushChannelConfig> {
73
73
  send(payload: NotificationPayload): Promise<SendResult>;
74
74
  }
75
75
  //#endregion
76
- export { EmailChannel as a, WebhookChannel as i, SmsChannel as n, BaseChannel as o, ConsoleChannel as r, PushChannel as t };
76
+ //#region src/channels/telegram.channel.d.ts
77
+ declare class TelegramChannel extends BaseChannel<TelegramChannelConfig> {
78
+ constructor(config: TelegramChannelConfig);
79
+ private destinationOf;
80
+ private textOf;
81
+ /**
82
+ * Deterministic skips, checked before the service spends a rate-limit token:
83
+ * nowhere to send, or nothing to say.
84
+ */
85
+ canSend(payload: NotificationPayload): SendResult | null;
86
+ send(payload: NotificationPayload): Promise<SendResult>;
87
+ }
88
+ //#endregion
89
+ export { WebhookChannel as a, ConsoleChannel as i, PushChannel as n, EmailChannel as o, SmsChannel as r, BaseChannel as s, TelegramChannel as t };
@@ -336,6 +336,8 @@ interface Recipient {
336
336
  phone?: string;
337
337
  name?: string;
338
338
  deviceToken?: string;
339
+ /** Telegram chat id (numeric, or `@channelname`) — `TelegramChannel`'s destination. */
340
+ telegramChatId?: string;
339
341
  metadata?: Record<string, unknown>;
340
342
  }
341
343
  /** Notification payload sent through the service */
@@ -574,6 +576,21 @@ interface WebhookChannelConfig extends ChannelConfig {
574
576
  /** Request timeout in ms (default: 10000) */
575
577
  timeout?: number;
576
578
  }
579
+ /** TelegramChannel configuration — Bot API, no SDK. */
580
+ interface TelegramChannelConfig extends ChannelConfig {
581
+ /** The bot's token from @BotFather. Secret: it never appears in an error. */
582
+ botToken: string;
583
+ /** Default chat (a group id like `-1001234567890`, or `@channel`) when the recipient has none. */
584
+ chatId?: string;
585
+ /** Telegram formatting for `text`. Omit for plain text. */
586
+ parseMode?: 'HTML' | 'MarkdownV2';
587
+ /** Deliver without a notification sound. */
588
+ silent?: boolean;
589
+ /** Request timeout in ms (default: 10000) */
590
+ timeout?: number;
591
+ /** Bot API origin (default `https://api.telegram.org`); for a local Bot API server or tests. */
592
+ apiBaseUrl?: string;
593
+ }
577
594
  /** SMS provider interface (Twilio or custom) */
578
595
  interface SmsProvider {
579
596
  send(message: {
@@ -758,4 +775,4 @@ interface BatchResult {
758
775
  results: DispatchResult[];
759
776
  }
760
777
  //#endregion
761
- export { TemplateResult as A, DeliveryLogQuery as B, RetryConfig as C, SmsProvider as D, SmsChannelConfig as E, QueueJob as F, MemoryRateLimitStore as G, IDEMPOTENCY_DEFAULT_TTL as H, QueueJobStatus as I, RateLimitConfig as K, QueueProcessor as L, MemoryQueue as M, QueueAdapter as N, SmtpTransportOptions as O, QueueEnqueueOptions as P, DeliveryLog as R, ResolvedRetryConfig as S, ServiceEvent as T, IdempotencyStore as U, MemoryDeliveryLog as V, MemoryIdempotencyStore as W, NotificationServiceConfig as _, ChannelConfig as a, PushProvider as b, EmailChannelConfig as c, HookMap as d, Logger as f, NotificationPreferences as g, NotificationPayload as h, Channel as i, WebhookChannelConfig as j, TemplateResolver as k, EventHandler as l, NotificationHookConfig as m, BatchProgress as n, DispatchResult as o, NodemailerTransporter as p, RateLimitStore as q, BatchResult as r, EmailAttachment as s, BatchOptions as t, HookHandler as u, PreferenceResolver as v, SendResult as w, Recipient as x, PushChannelConfig as y, DeliveryLogEntry as z };
778
+ export { TemplateResolver as A, DeliveryLogEntry as B, RetryConfig as C, SmsProvider as D, SmsChannelConfig as E, QueueEnqueueOptions as F, MemoryIdempotencyStore as G, MemoryDeliveryLog as H, QueueJob as I, RateLimitStore as J, MemoryRateLimitStore as K, QueueJobStatus as L, WebhookChannelConfig as M, MemoryQueue as N, SmtpTransportOptions as O, QueueAdapter as P, QueueProcessor as R, ResolvedRetryConfig as S, ServiceEvent as T, IDEMPOTENCY_DEFAULT_TTL as U, DeliveryLogQuery as V, IdempotencyStore as W, NotificationServiceConfig as _, ChannelConfig as a, PushProvider as b, EmailChannelConfig as c, HookMap as d, Logger as f, NotificationPreferences as g, NotificationPayload as h, Channel as i, TemplateResult as j, TelegramChannelConfig as k, EventHandler as l, NotificationHookConfig as m, BatchProgress as n, DispatchResult as o, NodemailerTransporter as p, RateLimitConfig as q, BatchResult as r, EmailAttachment as s, BatchOptions as t, HookHandler as u, PreferenceResolver as v, SendResult as w, Recipient as x, PushChannelConfig as y, DeliveryLog as z };
@@ -1,3 +1,3 @@
1
- import { B as DeliveryLogQuery, F as QueueJob, G as MemoryRateLimitStore, H as IDEMPOTENCY_DEFAULT_TTL, I as QueueJobStatus, K as RateLimitConfig, L as QueueProcessor, M as MemoryQueue, N as QueueAdapter, P as QueueEnqueueOptions, R as DeliveryLog, U as IdempotencyStore, V as MemoryDeliveryLog, W as MemoryIdempotencyStore, q as RateLimitStore, z as DeliveryLogEntry } from "../types-DkFudalo.mjs";
2
- import { C as resolveRetryConfig, S as calculateDelay, T as mergeHooks, _ as isQuietHours, a as createStatusHandler, b as ProviderNotInstalledError, c as InterpolateOptions, d as TemplateMap, f as createSimpleResolver, g as QuietHoursConfig, h as pMap, i as StatusUpdate, m as PMapOptions, n as StatusHandler, o as FallbackOptions, p as interpolateHtml, r as StatusHandlerConfig, s as withFallback, t as DeliveryStatus, u as TemplateDefinition, v as ChannelError, w as withRetry, x as Emitter, y as NotificationError } from "../status-webhook-CuCdFeVN.mjs";
1
+ import { B as DeliveryLogEntry, F as QueueEnqueueOptions, G as MemoryIdempotencyStore, H as MemoryDeliveryLog, I as QueueJob, J as RateLimitStore, K as MemoryRateLimitStore, L as QueueJobStatus, N as MemoryQueue, P as QueueAdapter, R as QueueProcessor, U as IDEMPOTENCY_DEFAULT_TTL, V as DeliveryLogQuery, W as IdempotencyStore, q as RateLimitConfig, z as DeliveryLog } from "../types-DsRpYKr-.mjs";
2
+ import { C as resolveRetryConfig, S as calculateDelay, T as mergeHooks, _ as isQuietHours, a as createStatusHandler, b as ProviderNotInstalledError, c as InterpolateOptions, d as TemplateMap, f as createSimpleResolver, g as QuietHoursConfig, h as pMap, i as StatusUpdate, m as PMapOptions, n as StatusHandler, o as FallbackOptions, p as interpolateHtml, r as StatusHandlerConfig, s as withFallback, t as DeliveryStatus, u as TemplateDefinition, v as ChannelError, w as withRetry, x as Emitter, y as NotificationError } from "../status-webhook-C8WnLIMv.mjs";
3
3
  export { ChannelError, type DeliveryLog, type DeliveryLogEntry, type DeliveryLogQuery, type DeliveryStatus, Emitter, type FallbackOptions, IDEMPOTENCY_DEFAULT_TTL, type IdempotencyStore, type InterpolateOptions, MemoryDeliveryLog, MemoryIdempotencyStore, MemoryQueue, MemoryRateLimitStore, NotificationError, type PMapOptions, ProviderNotInstalledError, type QueueAdapter, type QueueEnqueueOptions, type QueueJob, type QueueJobStatus, type QueueProcessor, type QuietHoursConfig, type RateLimitConfig, type RateLimitStore, type StatusHandler, type StatusHandlerConfig, type StatusUpdate, type TemplateDefinition, type TemplateMap, calculateDelay, createSimpleResolver, createStatusHandler, interpolateHtml, isQuietHours, mergeHooks, pMap, resolveRetryConfig, withFallback, withRetry };
package/package.json CHANGED
@@ -1,117 +1,118 @@
1
- {
2
- "name": "@classytic/notifications",
3
- "version": "2.5.0",
4
- "description": "Multi-channel notifications (Email, SMS, Push, Webhook) with rate limiting, delivery tracking, queue adapters, channel fallback, templates, retry — zero required dependencies",
5
- "type": "module",
6
- "sideEffects": false,
7
- "main": "./dist/index.mjs",
8
- "module": "./dist/index.mjs",
9
- "types": "./dist/index.d.mts",
10
- "exports": {
11
- ".": {
12
- "types": "./dist/index.d.mts",
13
- "default": "./dist/index.mjs"
14
- },
15
- "./channels": {
16
- "types": "./dist/channels/index.d.mts",
17
- "default": "./dist/channels/index.mjs"
18
- },
19
- "./providers": {
20
- "types": "./dist/providers/index.d.mts",
21
- "default": "./dist/providers/index.mjs"
22
- },
23
- "./utils": {
24
- "types": "./dist/utils/index.d.mts",
25
- "default": "./dist/utils/index.mjs"
26
- }
27
- },
28
- "typesVersions": {
29
- "*": {
30
- "channels": ["./dist/channels/index.d.mts"],
31
- "providers": ["./dist/providers/index.d.mts"],
32
- "utils": ["./dist/utils/index.d.mts"]
33
- }
34
- },
35
- "files": [
36
- "dist",
37
- "README.md",
38
- "CHANGELOG.md",
39
- "LICENSE"
40
- ],
41
- "keywords": [
42
- "notifications",
43
- "multi-channel",
44
- "email",
45
- "sms",
46
- "push-notifications",
47
- "webhook",
48
- "nodemailer",
49
- "smtp",
50
- "ses",
51
- "rate-limiting",
52
- "delivery-tracking",
53
- "queue",
54
- "channel-fallback",
55
- "templates",
56
- "retry",
57
- "idempotency",
58
- "pluggable",
59
- "framework-agnostic",
60
- "typescript",
61
- "zero-dependencies"
62
- ],
63
- "author": "Classytic <classytic.dev@gmail.com> (https://github.com/classytic)",
64
- "contributors": [
65
- "Sadman Chowdhury (https://github.com/siam923)"
66
- ],
67
- "license": "MIT",
68
- "publishConfig": {
69
- "access": "public"
70
- },
71
- "repository": {
72
- "type": "git",
73
- "url": "git+https://github.com/classytic/notifications.git"
74
- },
75
- "bugs": {
76
- "url": "https://github.com/classytic/notifications/issues"
77
- },
78
- "homepage": "https://github.com/classytic/notifications#readme",
79
- "peerDependencies": {
80
- "nodemailer": ">=6"
81
- },
82
- "peerDependenciesMeta": {
83
- "nodemailer": {
84
- "optional": true
85
- }
86
- },
87
- "engines": {
88
- "node": ">=18"
89
- },
90
- "scripts": {
91
- "build": "tsdown",
92
- "dev": "tsdown --watch",
93
- "test": "vitest run",
94
- "test:watch": "vitest",
95
- "test:coverage": "vitest run --coverage",
96
- "test:live": "vitest run --config vitest.live.config.ts",
97
- "typecheck": "tsc --noEmit",
98
- "prepublishOnly": "npm run build && npm run typecheck && npm test",
99
- "push": "classytic-push",
100
- "publish:dry": "npm publish --dry-run --access public",
101
- "publish:npm": "npm publish --access public",
102
- "release": "npm run build && npm run typecheck && npm test && npm publish --access public",
103
- "release:patch": "npm version patch && npm run release",
104
- "release:minor": "npm version minor && npm run release",
105
- "release:major": "npm version major && npm run release"
106
- },
107
- "devDependencies": {
108
- "@classytic/dev-tools": "^0.2.0",
109
- "@types/node": "^22.0.0",
110
- "@types/nodemailer": "^8.0.0",
111
- "@vitest/coverage-v8": "4.1.8",
112
- "nodemailer": "^8.0.10",
113
- "tsdown": "^0.22.14",
114
- "typescript": "^6.0.3",
115
- "vitest": "^4.1.8"
116
- }
117
- }
1
+ {
2
+ "name": "@classytic/notifications",
3
+ "version": "2.6.0",
4
+ "description": "Multi-channel notifications (Email, SMS, Push, Webhook, Telegram) with rate limiting, delivery tracking, queue adapters, channel fallback, templates, retry — zero required dependencies",
5
+ "type": "module",
6
+ "sideEffects": false,
7
+ "main": "./dist/index.mjs",
8
+ "module": "./dist/index.mjs",
9
+ "types": "./dist/index.d.mts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.mts",
13
+ "default": "./dist/index.mjs"
14
+ },
15
+ "./channels": {
16
+ "types": "./dist/channels/index.d.mts",
17
+ "default": "./dist/channels/index.mjs"
18
+ },
19
+ "./providers": {
20
+ "types": "./dist/providers/index.d.mts",
21
+ "default": "./dist/providers/index.mjs"
22
+ },
23
+ "./utils": {
24
+ "types": "./dist/utils/index.d.mts",
25
+ "default": "./dist/utils/index.mjs"
26
+ }
27
+ },
28
+ "typesVersions": {
29
+ "*": {
30
+ "channels": ["./dist/channels/index.d.mts"],
31
+ "providers": ["./dist/providers/index.d.mts"],
32
+ "utils": ["./dist/utils/index.d.mts"]
33
+ }
34
+ },
35
+ "files": [
36
+ "dist",
37
+ "README.md",
38
+ "CHANGELOG.md",
39
+ "LICENSE"
40
+ ],
41
+ "keywords": [
42
+ "notifications",
43
+ "multi-channel",
44
+ "email",
45
+ "sms",
46
+ "push-notifications",
47
+ "webhook",
48
+ "telegram",
49
+ "nodemailer",
50
+ "smtp",
51
+ "ses",
52
+ "rate-limiting",
53
+ "delivery-tracking",
54
+ "queue",
55
+ "channel-fallback",
56
+ "templates",
57
+ "retry",
58
+ "idempotency",
59
+ "pluggable",
60
+ "framework-agnostic",
61
+ "typescript",
62
+ "zero-dependencies"
63
+ ],
64
+ "author": "Classytic <classytic.dev@gmail.com> (https://github.com/classytic)",
65
+ "contributors": [
66
+ "Sadman Chowdhury (https://github.com/siam923)"
67
+ ],
68
+ "license": "MIT",
69
+ "publishConfig": {
70
+ "access": "public"
71
+ },
72
+ "repository": {
73
+ "type": "git",
74
+ "url": "git+https://github.com/classytic/notifications.git"
75
+ },
76
+ "bugs": {
77
+ "url": "https://github.com/classytic/notifications/issues"
78
+ },
79
+ "homepage": "https://github.com/classytic/notifications#readme",
80
+ "peerDependencies": {
81
+ "nodemailer": ">=6"
82
+ },
83
+ "peerDependenciesMeta": {
84
+ "nodemailer": {
85
+ "optional": true
86
+ }
87
+ },
88
+ "engines": {
89
+ "node": ">=18"
90
+ },
91
+ "scripts": {
92
+ "build": "tsdown",
93
+ "dev": "tsdown --watch",
94
+ "test": "vitest run",
95
+ "test:watch": "vitest",
96
+ "test:coverage": "vitest run --coverage",
97
+ "test:live": "vitest run --config vitest.live.config.ts",
98
+ "typecheck": "tsc --noEmit",
99
+ "prepublishOnly": "npm run build && npm run typecheck && npm test",
100
+ "push": "classytic-push",
101
+ "publish:dry": "npm publish --dry-run --access public",
102
+ "publish:npm": "npm publish --access public",
103
+ "release": "npm run build && npm run typecheck && npm test && npm publish --access public",
104
+ "release:patch": "npm version patch && npm run release",
105
+ "release:minor": "npm version minor && npm run release",
106
+ "release:major": "npm version major && npm run release"
107
+ },
108
+ "devDependencies": {
109
+ "@classytic/dev-tools": "^0.2.0",
110
+ "@types/node": "^22.0.0",
111
+ "@types/nodemailer": "^8.0.0",
112
+ "@vitest/coverage-v8": "4.1.8",
113
+ "nodemailer": "^8.0.10",
114
+ "tsdown": "^0.22.14",
115
+ "typescript": "^6.0.3",
116
+ "vitest": "^4.1.8"
117
+ }
118
+ }