@classytic/notifications 2.7.0 → 2.9.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 +75 -0
- package/README.md +90 -1
- package/dist/channels/index.d.mts +1 -1
- package/dist/channels/index.mjs +1 -1
- package/dist/errors-DCOaQvhV.d.mts +37 -0
- package/dist/index.d.mts +5 -4
- package/dist/index.mjs +3 -3
- package/dist/providers/index.d.mts +13 -0
- package/dist/providers/index.mjs +33 -7
- package/dist/push/index.d.mts +310 -0
- package/dist/push/index.mjs +1004 -0
- package/dist/{status-webhook-D7Hrr71A.mjs → status-webhook-D1lNssTZ.mjs} +20 -2
- package/dist/{status-webhook-BlhPvRnD.d.mts → status-webhook-Pg_jRXwp.d.mts} +8 -38
- package/dist/{telegram.channel-DnVdyq8_.mjs → telegram.channel-0XRkIXmt.mjs} +37 -3
- package/dist/{telegram.channel-CzQH7Wa8.d.mts → telegram.channel-8DKyn1og.d.mts} +1 -1
- package/dist/{types-DyUMfkyr.d.mts → types-BNjSzlcY.d.mts} +58 -18
- package/dist/utils/index.d.mts +4 -3
- package/dist/utils/index.mjs +2 -2
- package/package.json +9 -3
|
@@ -57,6 +57,19 @@ function calculateDelay(attempt, config) {
|
|
|
57
57
|
delay = Math.min(delay + jitter, config.maxDelay);
|
|
58
58
|
return Math.max(0, Math.round(delay));
|
|
59
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* The `retryAfterMs` an error (or one of its causes, up to 4 deep) carries — set by providers
|
|
62
|
+
* from an HTTP `Retry-After` header. Channels wrap provider errors in `ChannelError`, so the hint
|
|
63
|
+
* usually rides on `cause`.
|
|
64
|
+
*/
|
|
65
|
+
function retryAfterHint(error) {
|
|
66
|
+
let cursor = error;
|
|
67
|
+
for (let depth = 0; cursor !== null && typeof cursor === "object" && depth < 5; depth++) {
|
|
68
|
+
const hint = cursor.retryAfterMs;
|
|
69
|
+
if (typeof hint === "number" && Number.isFinite(hint) && hint >= 0) return hint;
|
|
70
|
+
cursor = cursor.cause;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
60
73
|
/** Sleep for a given duration */
|
|
61
74
|
function sleep(ms) {
|
|
62
75
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
@@ -77,7 +90,12 @@ async function withRetry(fn, config, onRetry, shouldRetry) {
|
|
|
77
90
|
} catch (err) {
|
|
78
91
|
lastError = err instanceof Error ? err : new Error(String(err));
|
|
79
92
|
if (attempt === config.maxAttempts || shouldRetry?.(lastError) === false) break;
|
|
80
|
-
|
|
93
|
+
let delay = calculateDelay(attempt, config);
|
|
94
|
+
const hinted = retryAfterHint(lastError);
|
|
95
|
+
if (hinted !== void 0) {
|
|
96
|
+
if (hinted > config.maxDelay) break;
|
|
97
|
+
delay = Math.max(delay, hinted);
|
|
98
|
+
}
|
|
81
99
|
onRetry?.(attempt, lastError);
|
|
82
100
|
await sleep(delay);
|
|
83
101
|
}
|
|
@@ -779,4 +797,4 @@ function createStatusHandler(config = {}) {
|
|
|
779
797
|
}
|
|
780
798
|
|
|
781
799
|
//#endregion
|
|
782
|
-
export {
|
|
800
|
+
export { retryAfterHint as _, MemoryQueue as a, pMap as c, IDEMPOTENCY_DEFAULT_TTL as d, MemoryIdempotencyStore as f, resolveRetryConfig as g, calculateDelay as h, interpolateHtml as i, MemoryRateLimitStore as l, isQuietHours as m, withFallback as n, MemoryDeliveryLog as o, RedisIdempotencyStore as p, createSimpleResolver as r, mergeHooks as s, createStatusHandler as t, IDEMPOTENCY_DEFAULT_LEASE as u, withRetry as v, Emitter as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { E as RetryConfig, N as TemplateResolver, T as ResolvedRetryConfig, d as HookMap, h as NotificationPayload, o as DispatchResult, u as HookHandler } from "./types-BNjSzlcY.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;
|
|
@@ -8,6 +8,12 @@ declare function mergeHooks(...hookConfigs: (HookInput | null | undefined)[]): H
|
|
|
8
8
|
declare function resolveRetryConfig(config?: RetryConfig): ResolvedRetryConfig;
|
|
9
9
|
/** Calculate delay for a given attempt */
|
|
10
10
|
declare function calculateDelay(attempt: number, config: ResolvedRetryConfig): number;
|
|
11
|
+
/**
|
|
12
|
+
* The `retryAfterMs` an error (or one of its causes, up to 4 deep) carries — set by providers
|
|
13
|
+
* from an HTTP `Retry-After` header. Channels wrap provider errors in `ChannelError`, so the hint
|
|
14
|
+
* usually rides on `cause`.
|
|
15
|
+
*/
|
|
16
|
+
declare function retryAfterHint(error: unknown): number | undefined;
|
|
11
17
|
/**
|
|
12
18
|
* Execute a function with retry and backoff
|
|
13
19
|
*
|
|
@@ -42,42 +48,6 @@ declare class Emitter {
|
|
|
42
48
|
removeAll(event?: string): this;
|
|
43
49
|
}
|
|
44
50
|
//#endregion
|
|
45
|
-
//#region src/utils/errors.d.ts
|
|
46
|
-
/**
|
|
47
|
-
* Notification Errors
|
|
48
|
-
* @module @classytic/notifications
|
|
49
|
-
*/
|
|
50
|
-
declare class NotificationError extends Error {
|
|
51
|
-
readonly code: string;
|
|
52
|
-
readonly channel?: string;
|
|
53
|
-
readonly cause?: Error;
|
|
54
|
-
constructor(message: string, options?: {
|
|
55
|
-
code?: string;
|
|
56
|
-
channel?: string;
|
|
57
|
-
cause?: Error;
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
declare class ChannelError extends NotificationError {
|
|
61
|
-
constructor(channel: string, message: string, cause?: Error);
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Thrown by a provider for a failure no retry can fix (unregistered device token, invalid
|
|
65
|
-
* recipient). Channels that honour it (PushChannel) return `failed` with `retryable: false`, so
|
|
66
|
-
* the service does not retry. Detected structurally (`retryable === false`), so a provider may
|
|
67
|
-
* also throw any error carrying that flag.
|
|
68
|
-
*/
|
|
69
|
-
declare class PermanentDeliveryError extends NotificationError {
|
|
70
|
-
readonly retryable: false;
|
|
71
|
-
constructor(message: string, options?: {
|
|
72
|
-
code?: string;
|
|
73
|
-
channel?: string;
|
|
74
|
-
cause?: Error;
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
declare class ProviderNotInstalledError extends NotificationError {
|
|
78
|
-
constructor(provider: string, installCmd: string);
|
|
79
|
-
}
|
|
80
|
-
//#endregion
|
|
81
51
|
//#region src/utils/quiet-hours.d.ts
|
|
82
52
|
/**
|
|
83
53
|
* Quiet hours utility
|
|
@@ -350,4 +320,4 @@ interface StatusHandler {
|
|
|
350
320
|
*/
|
|
351
321
|
declare function createStatusHandler(config?: StatusHandlerConfig): StatusHandler;
|
|
352
322
|
//#endregion
|
|
353
|
-
export {
|
|
323
|
+
export { mergeHooks as C, withRetry as S, isQuietHours as _, createStatusHandler as a, resolveRetryConfig as b, InterpolateOptions as c, TemplateMap as d, createSimpleResolver as f, QuietHoursConfig as g, pMap as h, StatusUpdate as i, SimpleResolverOptions as l, PMapOptions as m, StatusHandler as n, FallbackOptions as o, interpolateHtml as p, StatusHandlerConfig as r, withFallback as s, DeliveryStatus as t, TemplateDefinition as u, Emitter as v, retryAfterHint as x, calculateDelay as y };
|
|
@@ -511,6 +511,24 @@ var SmsChannel = class extends BaseChannel {
|
|
|
511
511
|
* });
|
|
512
512
|
* ```
|
|
513
513
|
*/
|
|
514
|
+
const PLATFORMS = /* @__PURE__ */ new Set([
|
|
515
|
+
"android",
|
|
516
|
+
"ios",
|
|
517
|
+
"web"
|
|
518
|
+
]);
|
|
519
|
+
const LEVELS = /* @__PURE__ */ new Set([
|
|
520
|
+
"passive",
|
|
521
|
+
"active",
|
|
522
|
+
"time-sensitive",
|
|
523
|
+
"critical"
|
|
524
|
+
]);
|
|
525
|
+
/**
|
|
526
|
+
* A data-only (background) push is opted into explicitly — `data.contentAvailable: true` or
|
|
527
|
+
* `data.dataOnly: true` — so a send that merely forgot its title is still skipped as before.
|
|
528
|
+
*/
|
|
529
|
+
function isDataOnly(data) {
|
|
530
|
+
return data.contentAvailable === true || data.dataOnly === true;
|
|
531
|
+
}
|
|
514
532
|
var PushChannel = class extends BaseChannel {
|
|
515
533
|
provider;
|
|
516
534
|
constructor(config) {
|
|
@@ -533,7 +551,7 @@ var PushChannel = class extends BaseChannel {
|
|
|
533
551
|
};
|
|
534
552
|
const title = payload.data.title ?? payload.data.subject ?? "";
|
|
535
553
|
const body = payload.data.body ?? payload.data.text ?? payload.data.message ?? "";
|
|
536
|
-
if (!title && !body) return {
|
|
554
|
+
if (!title && !body && !isDataOnly(payload.data)) return {
|
|
537
555
|
status: "skipped",
|
|
538
556
|
channel: this.name,
|
|
539
557
|
error: "No title or body (data.title, data.body)"
|
|
@@ -549,7 +567,8 @@ var PushChannel = class extends BaseChannel {
|
|
|
549
567
|
};
|
|
550
568
|
const title = data.title ?? data.subject ?? "";
|
|
551
569
|
const body = data.body ?? data.text ?? data.message ?? "";
|
|
552
|
-
|
|
570
|
+
const dataOnly = isDataOnly(data);
|
|
571
|
+
if (!title && !body && !dataOnly) return {
|
|
553
572
|
status: "skipped",
|
|
554
573
|
channel: this.name,
|
|
555
574
|
error: "No title or body (data.title, data.body)"
|
|
@@ -557,6 +576,13 @@ var PushChannel = class extends BaseChannel {
|
|
|
557
576
|
const collapseKey = typeof data.collapseKey === "string" && data.collapseKey ? data.collapseKey : void 0;
|
|
558
577
|
const threadId = typeof data.threadId === "string" && data.threadId ? data.threadId : void 0;
|
|
559
578
|
const badge = typeof data.badge === "number" && Number.isInteger(data.badge) && data.badge >= 0 ? data.badge : void 0;
|
|
579
|
+
const platform = PLATFORMS.has(data.platform) ? data.platform : void 0;
|
|
580
|
+
const priority = data.priority === "high" || data.priority === "normal" ? data.priority : void 0;
|
|
581
|
+
const ttlSeconds = typeof data.ttlSeconds === "number" && Number.isInteger(data.ttlSeconds) && data.ttlSeconds >= 0 ? data.ttlSeconds : void 0;
|
|
582
|
+
const interruptionLevel = LEVELS.has(data.interruptionLevel) ? data.interruptionLevel : void 0;
|
|
583
|
+
const sound = typeof data.sound === "string" || data.sound === null ? data.sound : void 0;
|
|
584
|
+
const channelId = typeof data.channelId === "string" && data.channelId ? data.channelId : void 0;
|
|
585
|
+
const category = typeof data.category === "string" && data.category ? data.category : void 0;
|
|
560
586
|
try {
|
|
561
587
|
const result = await this.provider.send({
|
|
562
588
|
token: recipient.deviceToken,
|
|
@@ -566,7 +592,15 @@ var PushChannel = class extends BaseChannel {
|
|
|
566
592
|
imageUrl: data.imageUrl,
|
|
567
593
|
...collapseKey !== void 0 ? { collapseKey } : {},
|
|
568
594
|
...threadId !== void 0 ? { threadId } : {},
|
|
569
|
-
...badge !== void 0 ? { badge } : {}
|
|
595
|
+
...badge !== void 0 ? { badge } : {},
|
|
596
|
+
...platform !== void 0 ? { platform } : {},
|
|
597
|
+
...priority !== void 0 ? { priority } : {},
|
|
598
|
+
...ttlSeconds !== void 0 ? { ttlSeconds } : {},
|
|
599
|
+
...interruptionLevel !== void 0 ? { interruptionLevel } : {},
|
|
600
|
+
...dataOnly ? { contentAvailable: true } : {},
|
|
601
|
+
...sound !== void 0 ? { sound } : {},
|
|
602
|
+
...channelId !== void 0 ? { channelId } : {},
|
|
603
|
+
...category !== void 0 ? { category } : {}
|
|
570
604
|
});
|
|
571
605
|
return {
|
|
572
606
|
status: "sent",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as RateLimitConfig, D as SendResult, E as RetryConfig, F as WebhookChannelConfig, M as TelegramChannelConfig, a as ChannelConfig, c as EmailChannelConfig, h as NotificationPayload, i as Channel, k as SmsChannelConfig, y as PushChannelConfig } from "./types-BNjSzlcY.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;
|
|
@@ -651,31 +651,71 @@ interface SmsChannelConfig extends ChannelConfig {
|
|
|
651
651
|
/** SMS provider implementation (Twilio, SNS, Vonage, etc.) */
|
|
652
652
|
provider: SmsProvider;
|
|
653
653
|
}
|
|
654
|
+
/** The device platform a push token belongs to. */
|
|
655
|
+
type PushPlatform = 'android' | 'ios' | 'web';
|
|
656
|
+
/**
|
|
657
|
+
* How strongly an iOS notification may interrupt (APNs `aps.interruption-level`). `critical`
|
|
658
|
+
* needs Apple's critical-alerts entitlement; providers downgrade it unless allowed.
|
|
659
|
+
*/
|
|
660
|
+
type PushInterruptionLevel = 'passive' | 'active' | 'time-sensitive' | 'critical';
|
|
661
|
+
/**
|
|
662
|
+
* The message a {@link PushProvider} receives. `title` and `body` are always strings; an empty
|
|
663
|
+
* string means "absent" (a data-only push sets both to `''` and `contentAvailable: true`).
|
|
664
|
+
*
|
|
665
|
+
* Every field after `badge` is an optional delivery hint (2.9): a provider that ignores them still
|
|
666
|
+
* delivers, so existing custom providers keep working unchanged.
|
|
667
|
+
*/
|
|
668
|
+
interface PushProviderMessage {
|
|
669
|
+
token: string;
|
|
670
|
+
title: string;
|
|
671
|
+
body: string;
|
|
672
|
+
data?: Record<string, string>;
|
|
673
|
+
imageUrl?: string;
|
|
674
|
+
/**
|
|
675
|
+
* Replace-in-place key: a newer push with the same key replaces the older one on the device
|
|
676
|
+
* instead of stacking (FCM `android.collapseKey` + `notification.tag`, APNs `apns-collapse-id`,
|
|
677
|
+
* at most 64 bytes). From `data.collapseKey`. Absent = every push shows on its own.
|
|
678
|
+
*/
|
|
679
|
+
collapseKey?: string;
|
|
680
|
+
/** Groups notifications in the tray (APNs `aps.thread-id`, Android group). From `data.threadId`. */
|
|
681
|
+
threadId?: string;
|
|
682
|
+
/** App icon badge count (APNs `aps.badge`, Android `notificationCount`). From `data.badge`. */
|
|
683
|
+
badge?: number;
|
|
684
|
+
/** The token's platform; `pushRouter` dispatches on it. From `data.platform`. */
|
|
685
|
+
platform?: PushPlatform;
|
|
686
|
+
/** Delivery priority. `high` wakes the device (default for visible pushes). From `data.priority`. */
|
|
687
|
+
priority?: 'high' | 'normal';
|
|
688
|
+
/** Drop the push if undelivered after this many seconds (`0` = now or never). From `data.ttlSeconds`. */
|
|
689
|
+
ttlSeconds?: number;
|
|
690
|
+
/** iOS interruption level. From `data.interruptionLevel`. */
|
|
691
|
+
interruptionLevel?: PushInterruptionLevel;
|
|
692
|
+
/**
|
|
693
|
+
* Data-only / background push: no visible alert, the app wakes and fetches what it needs
|
|
694
|
+
* (APNs `content-available: 1` + push type `background`; FCM data message). From
|
|
695
|
+
* `data.contentAvailable` or `data.dataOnly`.
|
|
696
|
+
*/
|
|
697
|
+
contentAvailable?: boolean;
|
|
698
|
+
/** Sound name (`'default'` when omitted on a visible push); `null` = silent. From `data.sound`. */
|
|
699
|
+
sound?: string | null;
|
|
700
|
+
/** Android notification channel id. From `data.channelId`. */
|
|
701
|
+
channelId?: string;
|
|
702
|
+
/** APNs `aps.category` / Android `click_action`. From `data.category`. */
|
|
703
|
+
category?: string;
|
|
704
|
+
}
|
|
654
705
|
/**
|
|
655
706
|
* Push notification provider interface (FCM or custom). Throw to fail the send (retried per
|
|
656
707
|
* the retry config); throw a `PermanentDeliveryError` (or any error with `retryable: false`)
|
|
657
708
|
* for a failure no retry can fix, such as an unregistered device token.
|
|
709
|
+
*
|
|
710
|
+
* Built-in providers (FCM HTTP v1, APNs HTTP/2, a platform router) live in
|
|
711
|
+
* `@classytic/notifications/push`.
|
|
658
712
|
*/
|
|
659
713
|
interface PushProvider {
|
|
660
|
-
send(message: {
|
|
661
|
-
token: string;
|
|
662
|
-
title: string;
|
|
663
|
-
body: string;
|
|
664
|
-
data?: Record<string, string>;
|
|
665
|
-
imageUrl?: string;
|
|
666
|
-
/**
|
|
667
|
-
* Replace-in-place key: a newer push with the same key replaces the older one on the device
|
|
668
|
-
* instead of stacking (FCM `android.collapseKey` + `notification.tag`, APNs `apns-collapse-id`,
|
|
669
|
-
* at most 64 bytes). From `data.collapseKey`. Absent = every push shows on its own.
|
|
670
|
-
*/
|
|
671
|
-
collapseKey?: string;
|
|
672
|
-
/** Groups notifications in the tray (APNs `aps.thread-id`, Android group). From `data.threadId`. */
|
|
673
|
-
threadId?: string;
|
|
674
|
-
/** App icon badge count (APNs `aps.badge`, Android `notificationCount`). From `data.badge`. */
|
|
675
|
-
badge?: number;
|
|
676
|
-
}): Promise<{
|
|
714
|
+
send(message: PushProviderMessage): Promise<{
|
|
677
715
|
messageId: string;
|
|
678
716
|
}>;
|
|
717
|
+
/** Release long-lived resources (HTTP/2 sessions). Optional; call on shutdown. */
|
|
718
|
+
close?(): Promise<void> | void;
|
|
679
719
|
}
|
|
680
720
|
/** PushChannel configuration — bring your own push SDK */
|
|
681
721
|
interface PushChannelConfig extends ChannelConfig {
|
|
@@ -834,4 +874,4 @@ interface BatchResult {
|
|
|
834
874
|
results: DispatchResult[];
|
|
835
875
|
}
|
|
836
876
|
//#endregion
|
|
837
|
-
export {
|
|
877
|
+
export { RateLimitConfig as $, SmsProvider as A, QueueJobStatus as B, PushProviderMessage as C, SendResult as D, RetryConfig as E, WebhookChannelConfig as F, MemoryDeliveryLog as G, DeliveryLog as H, MemoryQueue as I, IdempotencyStore as J, IDEMPOTENCY_DEFAULT_LEASE as K, QueueAdapter as L, TelegramChannelConfig as M, TemplateResolver as N, ServiceEvent as O, TemplateResult as P, MemoryRateLimitStore as Q, QueueEnqueueOptions as R, PushProvider as S, ResolvedRetryConfig as T, DeliveryLogEntry as U, QueueProcessor as V, DeliveryLogQuery as W, RedisIdempotencyClient as X, MemoryIdempotencyStore as Y, RedisIdempotencyStore as Z, NotificationServiceConfig as _, ChannelConfig as a, PushInterruptionLevel as b, EmailChannelConfig as c, HookMap as d, RateLimitStore as et, Logger as f, NotificationPreferences as g, NotificationPayload as h, Channel as i, SmtpTransportOptions as j, SmsChannelConfig as k, EventHandler as l, NotificationHookConfig as m, BatchProgress as n, DispatchResult as o, NodemailerTransporter as p, IDEMPOTENCY_DEFAULT_TTL as q, BatchResult as r, EmailAttachment as s, BatchOptions as t, HookHandler as u, PreferenceResolver as v, Recipient as w, PushPlatform as x, PushChannelConfig as y, QueueJob as z };
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { C as
|
|
3
|
-
|
|
1
|
+
import { $ as RateLimitConfig, B as QueueJobStatus, G as MemoryDeliveryLog, H as DeliveryLog, I as MemoryQueue, J as IdempotencyStore, K as IDEMPOTENCY_DEFAULT_LEASE, L as QueueAdapter, Q as MemoryRateLimitStore, R as QueueEnqueueOptions, U as DeliveryLogEntry, V as QueueProcessor, W as DeliveryLogQuery, X as RedisIdempotencyClient, Y as MemoryIdempotencyStore, Z as RedisIdempotencyStore, et as RateLimitStore, q as IDEMPOTENCY_DEFAULT_TTL, z as QueueJob } from "../types-BNjSzlcY.mjs";
|
|
2
|
+
import { C as mergeHooks, S as withRetry, _ as isQuietHours, a as createStatusHandler, b as resolveRetryConfig, 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 Emitter, x as retryAfterHint, y as calculateDelay } from "../status-webhook-Pg_jRXwp.mjs";
|
|
3
|
+
import { i as ProviderNotInstalledError, n as NotificationError, r as PermanentDeliveryError, t as ChannelError } from "../errors-DCOaQvhV.mjs";
|
|
4
|
+
export { ChannelError, type DeliveryLog, type DeliveryLogEntry, type DeliveryLogQuery, type DeliveryStatus, Emitter, type FallbackOptions, IDEMPOTENCY_DEFAULT_LEASE, IDEMPOTENCY_DEFAULT_TTL, type IdempotencyStore, type InterpolateOptions, MemoryDeliveryLog, MemoryIdempotencyStore, MemoryQueue, MemoryRateLimitStore, NotificationError, type PMapOptions, PermanentDeliveryError, ProviderNotInstalledError, type QueueAdapter, type QueueEnqueueOptions, type QueueJob, type QueueJobStatus, type QueueProcessor, type QuietHoursConfig, type RateLimitConfig, type RateLimitStore, type RedisIdempotencyClient, RedisIdempotencyStore, type StatusHandler, type StatusHandlerConfig, type StatusUpdate, type TemplateDefinition, type TemplateMap, calculateDelay, createSimpleResolver, createStatusHandler, interpolateHtml, isQuietHours, mergeHooks, pMap, resolveRetryConfig, retryAfterHint, withFallback, withRetry };
|
package/dist/utils/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as
|
|
1
|
+
import { _ as retryAfterHint, a as MemoryQueue, c as pMap, d as IDEMPOTENCY_DEFAULT_TTL, f as MemoryIdempotencyStore, g as resolveRetryConfig, h as calculateDelay, i as interpolateHtml, l as MemoryRateLimitStore, m as isQuietHours, n as withFallback, o as MemoryDeliveryLog, p as RedisIdempotencyStore, r as createSimpleResolver, s as mergeHooks, t as createStatusHandler, u as IDEMPOTENCY_DEFAULT_LEASE, v as withRetry, y as Emitter } from "../status-webhook-D1lNssTZ.mjs";
|
|
2
2
|
import { i as ProviderNotInstalledError, n as NotificationError, r as PermanentDeliveryError, t as ChannelError } from "../errors-CsQZKfec.mjs";
|
|
3
3
|
|
|
4
|
-
export { ChannelError, Emitter, IDEMPOTENCY_DEFAULT_LEASE, IDEMPOTENCY_DEFAULT_TTL, MemoryDeliveryLog, MemoryIdempotencyStore, MemoryQueue, MemoryRateLimitStore, NotificationError, PermanentDeliveryError, ProviderNotInstalledError, RedisIdempotencyStore, calculateDelay, createSimpleResolver, createStatusHandler, interpolateHtml, isQuietHours, mergeHooks, pMap, resolveRetryConfig, withFallback, withRetry };
|
|
4
|
+
export { ChannelError, Emitter, IDEMPOTENCY_DEFAULT_LEASE, IDEMPOTENCY_DEFAULT_TTL, MemoryDeliveryLog, MemoryIdempotencyStore, MemoryQueue, MemoryRateLimitStore, NotificationError, PermanentDeliveryError, ProviderNotInstalledError, RedisIdempotencyStore, calculateDelay, createSimpleResolver, createStatusHandler, interpolateHtml, isQuietHours, mergeHooks, pMap, resolveRetryConfig, retryAfterHint, withFallback, withRetry };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@classytic/notifications",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
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
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -23,13 +23,18 @@
|
|
|
23
23
|
"./utils": {
|
|
24
24
|
"types": "./dist/utils/index.d.mts",
|
|
25
25
|
"default": "./dist/utils/index.mjs"
|
|
26
|
+
},
|
|
27
|
+
"./push": {
|
|
28
|
+
"types": "./dist/push/index.d.mts",
|
|
29
|
+
"default": "./dist/push/index.mjs"
|
|
26
30
|
}
|
|
27
31
|
},
|
|
28
32
|
"typesVersions": {
|
|
29
33
|
"*": {
|
|
30
34
|
"channels": ["./dist/channels/index.d.mts"],
|
|
31
35
|
"providers": ["./dist/providers/index.d.mts"],
|
|
32
|
-
"utils": ["./dist/utils/index.d.mts"]
|
|
36
|
+
"utils": ["./dist/utils/index.d.mts"],
|
|
37
|
+
"push": ["./dist/push/index.d.mts"]
|
|
33
38
|
}
|
|
34
39
|
},
|
|
35
40
|
"files": [
|
|
@@ -92,12 +97,13 @@
|
|
|
92
97
|
"build": "tsdown",
|
|
93
98
|
"dev": "tsdown --watch",
|
|
94
99
|
"test": "vitest run",
|
|
100
|
+
"check:skills": "node scripts/check-skills.mjs",
|
|
95
101
|
"test:watch": "vitest",
|
|
96
102
|
"test:coverage": "vitest run --coverage",
|
|
97
103
|
"test:live": "vitest run --config vitest.live.config.ts",
|
|
98
104
|
"typecheck": "tsc --noEmit && npm run typecheck:consumer",
|
|
99
105
|
"typecheck:consumer": "tsdown --logLevel warn && tsc --noEmit -p tsconfig.types.json",
|
|
100
|
-
"prepublishOnly": "npm run build && npm run typecheck && npm test",
|
|
106
|
+
"prepublishOnly": "npm run build && npm run check:skills && npm run typecheck && npm test",
|
|
101
107
|
"push": "classytic-push",
|
|
102
108
|
"publish:dry": "npm publish --dry-run --access public",
|
|
103
109
|
"publish:npm": "npm publish --access public",
|