@visulima/notification 1.0.8 → 1.0.10

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.
Files changed (108) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/channels/email/index.d.ts +23 -23
  3. package/dist/channels/email/index.js +1 -1
  4. package/dist/channels/inapp/index.d.ts +31 -31
  5. package/dist/digest/index.d.ts +55 -55
  6. package/dist/digest/index.js +1 -1
  7. package/dist/events/index.d.ts +16 -16
  8. package/dist/i18n/index.d.ts +21 -21
  9. package/dist/i18n/index.js +1 -1
  10. package/dist/index.d.ts +97 -108
  11. package/dist/index.js +1 -1
  12. package/dist/layouts/index.d.ts +28 -28
  13. package/dist/middleware/index.d.ts +49 -49
  14. package/dist/middleware/index.js +1 -1
  15. package/dist/packem_shared/{Notification-B22tuJPy.js → Notification-DH2mcFWI.js} +1 -1
  16. package/dist/packem_shared/NotificationError-B8CyoEaX.js +1 -0
  17. package/dist/packem_shared/{RequiredOptionError-CuL42XRq.js → RequiredOptionError-Bs282gKK.js} +1 -1
  18. package/dist/packem_shared/apnsProvider-BPH0pHvd.js +1 -0
  19. package/dist/packem_shared/{circuitBreakerMiddleware-BlZN7SVT.js → circuitBreakerMiddleware-CRBi0H7e.js} +1 -1
  20. package/dist/packem_shared/{createDigester-vMNPejGF.js → createDigester-DenmT8_X.js} +1 -1
  21. package/dist/packem_shared/{createNotificationWorkflow-B70OgeED.js → createNotificationWorkflow-5AY-ays0.js} +1 -1
  22. package/dist/packem_shared/{createTranslator-CY91C2eS.js → createTranslator-ByyvYNfG.js} +1 -1
  23. package/dist/packem_shared/{discordProvider-BhfXcCcI.js → discordProvider-BvKwrC8K.js} +1 -1
  24. package/dist/packem_shared/{emailChannel-CNDlX96Q.js → emailChannel-Cf8wZPZL.js} +1 -1
  25. package/dist/packem_shared/{expoProvider-DsZR4sUk.js → expoProvider-13gY7Ne8.js} +1 -1
  26. package/dist/packem_shared/{failoverProvider-D1dAmW8U.js → failoverProvider-DXcwmYev.js} +1 -1
  27. package/dist/packem_shared/{fcmProvider-DWRx8XBv.js → fcmProvider-DsGjzBzz.js} +1 -1
  28. package/dist/packem_shared/{messageBirdProvider-BfiTaNLn.js → messageBirdProvider-D1c3jUqj.js} +1 -1
  29. package/dist/packem_shared/{mockProvider-BLwTZlkw.js → mockProvider-DZ3immtm.js} +1 -1
  30. package/dist/packem_shared/{msTeamsProvider-DrmL3RYX.js → msTeamsProvider-Cd-BUhH1.js} +1 -1
  31. package/dist/packem_shared/notification.d-D0ado_cy.d.ts +104 -0
  32. package/dist/packem_shared/{plivoProvider-Dr8d5yD3.js → plivoProvider-C_koQ8X-.js} +1 -1
  33. package/dist/packem_shared/{provider.d-BQAGriz6.d.ts → provider.d-Dh32nRm9.d.ts} +10 -10
  34. package/dist/packem_shared/{roundRobinProvider-BetXJUUm.js → roundRobinProvider-CK3Vyc_u.js} +1 -1
  35. package/dist/packem_shared/{slackProvider-DPG1IlA0.js → slackProvider-B92QDf3e.js} +1 -1
  36. package/dist/packem_shared/{sms-CU-OZvNU.js → sms-64HGUCLu.js} +1 -1
  37. package/dist/packem_shared/{snsProvider-C2T2UxDK.js → snsProvider-CPGjOUP_.js} +1 -1
  38. package/dist/packem_shared/{telegramProvider-wyx3ksVm.js → telegramProvider-BmmroM5A.js} +1 -1
  39. package/dist/packem_shared/{telnyxProvider-jgpEwgPh.js → telnyxProvider-C41tE4VF.js} +1 -1
  40. package/dist/packem_shared/{tracer.d-Co1s_NwG.d.ts → tracer.d-BPznIQx9.d.ts} +2 -2
  41. package/dist/packem_shared/{twilioProvider-DMYWqvgZ.js → twilioProvider-DanDTzi3.js} +1 -1
  42. package/dist/packem_shared/{types.d-67TogK4k.d.ts → types.d--kw9ifOI.d.ts} +6 -6
  43. package/dist/packem_shared/types.d-BU-37j3S.d.ts +10 -0
  44. package/dist/packem_shared/{types.d-GUzX1jTk.d.ts → types.d-C7l7qdMG.d.ts} +52 -52
  45. package/dist/packem_shared/{types.d-CximoA8M.d.ts → types.d-CRs03TYV.d.ts} +13 -13
  46. package/dist/packem_shared/{types.d-C1GoEAlI.d-Bv3grfyD.d.ts → types.d-CcjfiGpo.d-DuZME7ry.d.ts} +27 -34
  47. package/dist/packem_shared/{vonageProvider-CT4KoWXu.js → vonageProvider-epeGBWW8.js} +1 -1
  48. package/dist/packem_shared/{webPushProvider-DwjmWASr.js → webPushProvider-K6-Drhaf.js} +1 -1
  49. package/dist/packem_shared/{webhookProvider-CPA1nKXJ.js → webhookProvider-DlwFyaGc.js} +1 -1
  50. package/dist/preferences/index.d.ts +19 -19
  51. package/dist/providers/chat/discord/index.d.ts +5 -5
  52. package/dist/providers/chat/discord/index.js +1 -1
  53. package/dist/providers/chat/msteams/index.d.ts +7 -7
  54. package/dist/providers/chat/msteams/index.js +1 -1
  55. package/dist/providers/chat/slack/index.d.ts +6 -6
  56. package/dist/providers/chat/slack/index.js +1 -1
  57. package/dist/providers/chat/telegram/index.d.ts +5 -5
  58. package/dist/providers/chat/telegram/index.js +1 -1
  59. package/dist/providers/failover/index.d.ts +7 -7
  60. package/dist/providers/failover/index.js +1 -1
  61. package/dist/providers/mock/index.d.ts +5 -5
  62. package/dist/providers/mock/index.js +1 -1
  63. package/dist/providers/opentelemetry/index.d.ts +14 -14
  64. package/dist/providers/push/apns/index.d.ts +9 -9
  65. package/dist/providers/push/apns/index.js +1 -1
  66. package/dist/providers/push/expo/index.d.ts +5 -5
  67. package/dist/providers/push/expo/index.js +1 -1
  68. package/dist/providers/push/fcm/index.d.ts +13 -13
  69. package/dist/providers/push/fcm/index.js +1 -1
  70. package/dist/providers/push/web-push/index.d.ts +11 -11
  71. package/dist/providers/push/web-push/index.js +1 -1
  72. package/dist/providers/roundrobin/index.d.ts +8 -8
  73. package/dist/providers/roundrobin/index.js +1 -1
  74. package/dist/providers/sms/messagebird/index.d.ts +5 -5
  75. package/dist/providers/sms/messagebird/index.js +1 -1
  76. package/dist/providers/sms/plivo/index.d.ts +5 -5
  77. package/dist/providers/sms/plivo/index.js +1 -1
  78. package/dist/providers/sms/sns/index.d.ts +6 -6
  79. package/dist/providers/sms/sns/index.js +1 -1
  80. package/dist/providers/sms/telnyx/index.d.ts +5 -5
  81. package/dist/providers/sms/telnyx/index.js +1 -1
  82. package/dist/providers/sms/twilio/index.d.ts +5 -5
  83. package/dist/providers/sms/twilio/index.js +1 -1
  84. package/dist/providers/sms/vonage/index.d.ts +5 -5
  85. package/dist/providers/sms/vonage/index.js +1 -1
  86. package/dist/providers/webhook/index.d.ts +7 -7
  87. package/dist/providers/webhook/index.js +1 -1
  88. package/dist/queue/bullmq-queue.d.ts +24 -24
  89. package/dist/queue/index.d.ts +15 -15
  90. package/dist/queue/pg-boss-queue.d.ts +26 -26
  91. package/dist/queue/sqs-queue.d.ts +27 -27
  92. package/dist/queue/unstorage-queue.d.ts +14 -14
  93. package/dist/routing/index.d.ts +22 -22
  94. package/dist/template-engines/handlebars.d.ts +13 -13
  95. package/dist/template-engines/handlebars.js +1 -1
  96. package/dist/template-engines/liquid.d.ts +13 -13
  97. package/dist/template-engines/liquid.js +1 -1
  98. package/dist/template-engines/string.d.ts +17 -17
  99. package/dist/utils/result.d.ts +32 -32
  100. package/dist/utils/result.js +1 -1
  101. package/dist/webhooks/index.d.ts +84 -84
  102. package/dist/workflow/index.d.ts +42 -42
  103. package/dist/workflow/index.js +1 -1
  104. package/package.json +2 -2
  105. package/dist/packem_shared/NotificationError-DVfMJQ1u.js +0 -1
  106. package/dist/packem_shared/apnsProvider-C9WSv5sc.js +0 -1
  107. package/dist/packem_shared/notification.d-DFCVTods.d.ts +0 -104
  108. package/dist/packem_shared/types.d-td-F2Oh0.d.ts +0 -10
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## @visulima/notification [1.0.10](https://github.com/visulima/visulima/compare/%40visulima%2Fnotification%401.0.9...%40visulima%2Fnotification%401.0.10) (2026-07-27)
2
+
3
+
4
+ ### Dependencies
5
+
6
+ * **@visulima/email:** upgraded to 2.1.7
7
+
8
+ ## @visulima/notification [1.0.9](https://github.com/visulima/visulima/compare/%40visulima%2Fnotification%401.0.8...%40visulima%2Fnotification%401.0.9) (2026-07-27)
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * **@visulima/email:** upgraded to 2.1.6
14
+
1
15
  ## @visulima/notification [1.0.8](https://github.com/visulima/visulima/compare/%40visulima%2Fnotification%401.0.7...%40visulima%2Fnotification%401.0.8) (2026-07-27)
2
16
 
3
17
 
@@ -1,8 +1,8 @@
1
- import { P as Provider } from "../../packem_shared/provider.d-BQAGriz6.js";
2
- import { E as EmailChannelPayload } from "../../packem_shared/types.d-GUzX1jTk.js";
1
+ import { P as Provider } from "../../packem_shared/provider.d-Dh32nRm9.js";
2
+ import { E as EmailChannelPayload } from "../../packem_shared/types.d-C7l7qdMG.js";
3
3
  /**
4
- * The result shape returned by `@visulima/email`'s `Mail.send`.
5
- */
4
+ * The result shape returned by `@visulima/email`'s `Mail.send`.
5
+ */
6
6
  interface EmailSendResult {
7
7
  data?: {
8
8
  messageId: string;
@@ -15,9 +15,9 @@ interface EmailSendResult {
15
15
  success: boolean;
16
16
  }
17
17
  /**
18
- * Structural type for a `@visulima/email` `Mail` instance. Kept structural so the email
19
- * peer stays optional — pass a configured `createMail(...)` result.
20
- */
18
+ * Structural type for a `@visulima/email` `Mail` instance. Kept structural so the email
19
+ * peer stays optional — pass a configured `createMail(...)` result.
20
+ */
21
21
  interface EmailLike {
22
22
  send: (message: unknown) => Promise<EmailSendResult>;
23
23
  }
@@ -26,21 +26,21 @@ interface EmailChannelConfig {
26
26
  id?: string;
27
27
  }
28
28
  /**
29
- * Adapts a configured `@visulima/email` `Mail` instance into a notification channel
30
- * provider, so email can participate in multi-channel sends and routing.
31
- * @param mail A `Mail` instance from `createMail(...)`.
32
- * @param config Optional config.
33
- * @returns An email-channel provider.
34
- * @example
35
- * ```ts
36
- * import { createMail } from "@visulima/email";
37
- * import { resendProvider } from "@visulima/email/providers/resend";
38
- * import { createNotification } from "@visulima/notification";
39
- * import { emailChannel } from "@visulima/notification/channels/email";
40
- *
41
- * const mail = createMail(resendProvider({ apiKey }));
42
- * const notify = createNotification({ email: emailChannel(mail) });
43
- * ```
44
- */
29
+ * Adapts a configured `@visulima/email` `Mail` instance into a notification channel
30
+ * provider, so email can participate in multi-channel sends and routing.
31
+ * @param mail A `Mail` instance from `createMail(...)`.
32
+ * @param config Optional config.
33
+ * @returns An email-channel provider.
34
+ * @example
35
+ * ```ts
36
+ * import { createMail } from "@visulima/email";
37
+ * import { resendProvider } from "@visulima/email/providers/resend";
38
+ * import { createNotification } from "@visulima/notification";
39
+ * import { emailChannel } from "@visulima/notification/channels/email";
40
+ *
41
+ * const mail = createMail(resendProvider({ apiKey }));
42
+ * const notify = createNotification({ email: emailChannel(mail) });
43
+ * ```
44
+ */
45
45
  declare const emailChannel: (mail: EmailLike, config?: EmailChannelConfig) => Provider<unknown, EmailChannelPayload>;
46
46
  export { type EmailChannelConfig, type EmailLike, emailChannel };
@@ -1 +1 @@
1
- import{emailChannel as l}from"../../packem_shared/emailChannel-CNDlX96Q.js";export{l as emailChannel};
1
+ import{emailChannel as l}from"../../packem_shared/emailChannel-Cf8wZPZL.js";export{l as emailChannel};
@@ -1,9 +1,9 @@
1
- import { P as Provider } from "../../packem_shared/provider.d-BQAGriz6.js";
2
- import { I as InAppPayload } from "../../packem_shared/types.d-GUzX1jTk.js";
1
+ import { P as Provider } from "../../packem_shared/provider.d-Dh32nRm9.js";
2
+ import { I as InAppPayload } from "../../packem_shared/types.d-C7l7qdMG.js";
3
3
  import { S as Storage } from "../../packem_shared/unstorage.DqlWKU2I.d-CogP3Etw.js";
4
4
  /**
5
- * A persisted in-app notification.
6
- */
5
+ * A persisted in-app notification.
6
+ */
7
7
  interface StoredNotification {
8
8
  actions?: {
9
9
  label: string;
@@ -24,9 +24,9 @@ interface ListOptions {
24
24
  unreadOnly?: boolean;
25
25
  }
26
26
  /**
27
- * Backing store for the in-app channel. The default {@link MemoryInAppStore} is
28
- * in-process; back it with a persistent store for production feeds.
29
- */
27
+ * Backing store for the in-app channel. The default {@link MemoryInAppStore} is
28
+ * in-process; back it with a persistent store for production feeds.
29
+ */
30
30
  interface InAppStore {
31
31
  add: (notification: Omit<StoredNotification, "createdAt" | "id" | "read"> & {
32
32
  id?: string;
@@ -38,8 +38,8 @@ interface InAppStore {
38
38
  unreadCount: (subscriberId: string) => Promise<number>;
39
39
  }
40
40
  /**
41
- * In-memory {@link InAppStore}.
42
- */
41
+ * In-memory {@link InAppStore}.
42
+ */
43
43
  declare class MemoryInAppStore implements InAppStore {
44
44
  #private;
45
45
  add(notification: Omit<StoredNotification, "createdAt" | "id" | "read"> & {
@@ -58,25 +58,25 @@ interface InAppProviderConfig {
58
58
  store?: InAppStore;
59
59
  }
60
60
  /**
61
- * In-app channel provider. Persists notifications to an {@link InAppStore} for a feed/inbox
62
- * UI to query. Expose the store via `getInstance()` to read/markRead.
63
- * @param config Provider `id` and the backing {@link InAppStore} (defaults to in-memory).
64
- * @returns A provider that writes notifications into the configured store.
65
- */
61
+ * In-app channel provider. Persists notifications to an {@link InAppStore} for a feed/inbox
62
+ * UI to query. Expose the store via `getInstance()` to read/markRead.
63
+ * @param config Provider `id` and the backing {@link InAppStore} (defaults to in-memory).
64
+ * @returns A provider that writes notifications into the configured store.
65
+ */
66
66
  declare const inAppProvider: (config?: InAppProviderConfig) => Provider<InAppProviderConfig, InAppPayload, InAppStore>;
67
67
  /**
68
- * An {@link InAppStore} backed by an [unstorage](https://unstorage.unjs.io) driver, giving durable,
69
- * multi-backend persistence (Redis, filesystem, Cloudflare KV, ...). `unstorage` is an optional peer
70
- * dependency — pass a configured `Storage` instance.
71
- *
72
- * Each notification is stored under `prefix:item:id`, and a per-subscriber index list is kept under
73
- * `prefix:index:subscriberId` so `list`/`unreadCount`/`markAllRead` avoid scanning every key.
74
- *
75
- * The per-subscriber index is eventually-consistent: the item and index keys are written
76
- * non-atomically, so a concurrent reader may briefly observe one without the other.
77
- *
78
- * Edge-safe: works on Cloudflare KV (and other edge runtimes) via the matching unstorage driver.
79
- */
68
+ * An {@link InAppStore} backed by an [unstorage](https://unstorage.unjs.io) driver, giving durable,
69
+ * multi-backend persistence (Redis, filesystem, Cloudflare KV, ...). `unstorage` is an optional peer
70
+ * dependency — pass a configured `Storage` instance.
71
+ *
72
+ * Each notification is stored under `prefix:item:id`, and a per-subscriber index list is kept under
73
+ * `prefix:index:subscriberId` so `list`/`unreadCount`/`markAllRead` avoid scanning every key.
74
+ *
75
+ * The per-subscriber index is eventually-consistent: the item and index keys are written
76
+ * non-atomically, so a concurrent reader may briefly observe one without the other.
77
+ *
78
+ * Edge-safe: works on Cloudflare KV (and other edge runtimes) via the matching unstorage driver.
79
+ */
80
80
  declare class UnstorageInAppStore implements InAppStore {
81
81
  #private;
82
82
  constructor(storage: Storage, prefix?: string);
@@ -90,10 +90,10 @@ declare class UnstorageInAppStore implements InAppStore {
90
90
  remove(id: string): Promise<void>;
91
91
  }
92
92
  /**
93
- * Convenience factory for {@link UnstorageInAppStore}.
94
- * @param storage A configured unstorage `Storage` instance (optional peer).
95
- * @param prefix Key prefix under which notifications are stored.
96
- * @returns A new {@link UnstorageInAppStore}.
97
- */
93
+ * Convenience factory for {@link UnstorageInAppStore}.
94
+ * @param storage A configured unstorage `Storage` instance (optional peer).
95
+ * @param prefix Key prefix under which notifications are stored.
96
+ * @returns A new {@link UnstorageInAppStore}.
97
+ */
98
98
  declare const createUnstorageInAppStore: (storage: Storage, prefix?: string) => UnstorageInAppStore;
99
99
  export { type InAppProviderConfig, type InAppStore, type ListOptions, MemoryInAppStore, type StoredNotification, UnstorageInAppStore, createUnstorageInAppStore, inAppProvider };
@@ -1,4 +1,4 @@
1
- import { M as MaybePromise, D as Duration } from "../packem_shared/types.d-C1GoEAlI.d-Bv3grfyD.js";
1
+ import { M as MaybePromise, D as Duration } from "../packem_shared/types.d-CcjfiGpo.d-DuZME7ry.js";
2
2
  import '@standard-schema/spec';
3
3
  /** A single event buffered inside a digest window. */
4
4
  interface DigestEvent<PayloadT> {
@@ -17,19 +17,19 @@ interface DigestWindow<PayloadT> {
17
17
  wakeAt: number;
18
18
  }
19
19
  /**
20
- * Durability contract for `createDigester`. Implementations own the buffered
21
- * windows and the "what is due" query; the digester stays storage-agnostic.
22
- *
23
- * `read` and `remove` are separate (rather than a single destructive `drain`) so
24
- * the digester can flush a window's events *before* removing it — a failed flush
25
- * leaves the window in place to be retried (at-least-once).
26
- */
20
+ * Durability contract for `createDigester`. Implementations own the buffered
21
+ * windows and the "what is due" query; the digester stays storage-agnostic.
22
+ *
23
+ * `read` and `remove` are separate (rather than a single destructive `drain`) so
24
+ * the digester can flush a window's events *before* removing it — a failed flush
25
+ * leaves the window in place to be retried (at-least-once).
26
+ */
27
27
  interface DigestStore<PayloadT> {
28
28
  /**
29
- * Append an event to the window for `key`, opening it (with `wakeAt`) if absent.
30
- * The window's `wakeAt` is fixed when it opens — later events do not extend it.
31
- * @returns `true` if this call opened a new window.
32
- */
29
+ * Append an event to the window for `key`, opening it (with `wakeAt`) if absent.
30
+ * The window's `wakeAt` is fixed when it opens — later events do not extend it.
31
+ * @returns `true` if this call opened a new window.
32
+ */
33
33
  append: (key: string, event: DigestEvent<PayloadT>, wakeAt: number) => Promise<boolean>;
34
34
  /** Keys whose window `wakeAt` is at or before `now`, up to `limit`. */
35
35
  due: (now: number, limit: number) => Promise<string[]>;
@@ -43,11 +43,11 @@ interface DigesterOptions<PayloadT> {
43
43
  /** Group events into windows by this key (e.g. `subscriberId` or `subscriberId:postId`). */
44
44
  key: (event: PayloadT) => string;
45
45
  /**
46
- * Called once per window when it closes, with every event collected. Delivery is
47
- * **at-least-once**: the window is removed only after `onFlush` resolves, so a
48
- * throwing `onFlush` is retried on the next sweep (and may run again if removal
49
- * later fails). Make it idempotent.
50
- */
46
+ * Called once per window when it closes, with every event collected. Delivery is
47
+ * **at-least-once**: the window is removed only after `onFlush` resolves, so a
48
+ * throwing `onFlush` is retried on the next sweep (and may run again if removal
49
+ * later fails). Make it idempotent.
50
+ */
51
51
  onFlush: (events: DigestEvent<PayloadT>[], key: string) => MaybePromise<void>;
52
52
  /** The durable store; defaults to an in-memory store. */
53
53
  store?: DigestStore<PayloadT>;
@@ -62,32 +62,32 @@ interface Digester<PayloadT> {
62
62
  sweep: (now?: number, limit?: number) => Promise<number>;
63
63
  }
64
64
  /**
65
- * Create a {@link Digester} that batches events into time/cron windows keyed by
66
- * `options.key`, flushing each closed window once via `options.onFlush` — turning
67
- * a burst of N events into a single notification.
68
- *
69
- * Windows close on a poll: call {@link Digester.sweep} from a cron job, a
70
- * Cloudflare alarm, or any timer (alongside a workflow runtime's `sweep`).
71
- * @param options Key function, window duration, flush handler and optional store.
72
- * @returns A {@link Digester}.
73
- * @example
74
- * ```ts
75
- * const digester = createDigester<{ subscriberId: string; postId: string }>({
76
- * key: (event) => `${event.subscriberId}:${event.postId}`,
77
- * window: { amount: 10, unit: "minutes" },
78
- * onFlush: (events) => runtime.trigger(summaryWorkflow, { count: events.length, events }),
79
- * });
80
- *
81
- * await digester.add({ subscriberId: "u1", postId: "p1" }); // opens a 10-minute window
82
- * // …later, on a timer:
83
- * await digester.sweep();
84
- * ```
85
- */
65
+ * Create a {@link Digester} that batches events into time/cron windows keyed by
66
+ * `options.key`, flushing each closed window once via `options.onFlush` — turning
67
+ * a burst of N events into a single notification.
68
+ *
69
+ * Windows close on a poll: call {@link Digester.sweep} from a cron job, a
70
+ * Cloudflare alarm, or any timer (alongside a workflow runtime's `sweep`).
71
+ * @param options Key function, window duration, flush handler and optional store.
72
+ * @returns A {@link Digester}.
73
+ * @example
74
+ * ```ts
75
+ * const digester = createDigester<{ subscriberId: string; postId: string }>({
76
+ * key: (event) => `${event.subscriberId}:${event.postId}`,
77
+ * window: { amount: 10, unit: "minutes" },
78
+ * onFlush: (events) => runtime.trigger(summaryWorkflow, { count: events.length, events }),
79
+ * });
80
+ *
81
+ * await digester.add({ subscriberId: "u1", postId: "p1" }); // opens a 10-minute window
82
+ * // …later, on a timer:
83
+ * await digester.sweep();
84
+ * ```
85
+ */
86
86
  declare const createDigester: <PayloadT>(options: DigesterOptions<PayloadT>) => Digester<PayloadT>;
87
87
  /**
88
- * In-process {@link DigestStore}. Ideal for tests and single-instance apps; swap
89
- * for the unstorage adapter for durability across restarts and instances.
90
- */
88
+ * In-process {@link DigestStore}. Ideal for tests and single-instance apps; swap
89
+ * for the unstorage adapter for durability across restarts and instances.
90
+ */
91
91
  declare class MemoryDigestStore<PayloadT> implements DigestStore<PayloadT> {
92
92
  #private;
93
93
  append(key: string, event: DigestEvent<PayloadT>, wakeAt: number): Promise<boolean>;
@@ -96,9 +96,9 @@ declare class MemoryDigestStore<PayloadT> implements DigestStore<PayloadT> {
96
96
  due(now: number, limit: number): Promise<string[]>;
97
97
  }
98
98
  /**
99
- * Minimal structural view of an [unstorage](https://unstorage.unjs.io) instance,
100
- * declared locally so the package needs no hard `unstorage` dependency.
101
- */
99
+ * Minimal structural view of an [unstorage](https://unstorage.unjs.io) instance,
100
+ * declared locally so the package needs no hard `unstorage` dependency.
101
+ */
102
102
  interface UnstorageLike {
103
103
  getItem: <T = unknown>(key: string) => Promise<T | null>;
104
104
  getKeys: (base?: string) => Promise<string[]>;
@@ -106,17 +106,17 @@ interface UnstorageLike {
106
106
  setItem: (key: string, value: unknown) => Promise<void>;
107
107
  }
108
108
  /**
109
- * {@link DigestStore} backed by [unstorage](https://unstorage.unjs.io), for durable,
110
- * edge-friendly digest windows over any unstorage driver.
111
- *
112
- * Each window is a single self-contained document keyed by `digest:w:` plus the
113
- * digest key; there is no shared index, so concurrent `add`s for different keys cannot
114
- * lose-update each other. `due` scans the window documents under the prefix — fine for the
115
- * transient, bounded set of open windows. Individual reads/writes are still not
116
- * transactional, so concurrent writers on the *same* key (or a sweep racing an
117
- * `add` for that key) can drop an event or double-flush; for that level of
118
- * contention prefer a store with atomic guarantees, or sweep from one instance.
119
- */
109
+ * {@link DigestStore} backed by [unstorage](https://unstorage.unjs.io), for durable,
110
+ * edge-friendly digest windows over any unstorage driver.
111
+ *
112
+ * Each window is a single self-contained document keyed by `digest:w:` plus the
113
+ * digest key; there is no shared index, so concurrent `add`s for different keys cannot
114
+ * lose-update each other. `due` scans the window documents under the prefix — fine for the
115
+ * transient, bounded set of open windows. Individual reads/writes are still not
116
+ * transactional, so concurrent writers on the *same* key (or a sweep racing an
117
+ * `add` for that key) can drop an event or double-flush; for that level of
118
+ * contention prefer a store with atomic guarantees, or sweep from one instance.
119
+ */
120
120
  declare class UnstorageDigestStore<PayloadT> implements DigestStore<PayloadT> {
121
121
  #private;
122
122
  constructor(storage: UnstorageLike);
@@ -1 +1 @@
1
- import{default as r}from"../packem_shared/createDigester-vMNPejGF.js";import{default as a}from"../packem_shared/MemoryDigestStore-Bw-sE5MI.js";import{default as f}from"../packem_shared/UnstorageDigestStore-QAcO3Vb_.js";export{a as MemoryDigestStore,f as UnstorageDigestStore,r as createDigester};
1
+ import{default as r}from"../packem_shared/createDigester-DenmT8_X.js";import{default as a}from"../packem_shared/MemoryDigestStore-Bw-sE5MI.js";import{default as f}from"../packem_shared/UnstorageDigestStore-QAcO3Vb_.js";export{a as MemoryDigestStore,f as UnstorageDigestStore,r as createDigester};
@@ -1,14 +1,14 @@
1
- import { N as NotificationEvent, e as NotificationEventType } from "../packem_shared/types.d-GUzX1jTk.js";
1
+ import { N as NotificationEvent, e as NotificationEventType } from "../packem_shared/types.d-C7l7qdMG.js";
2
2
  /**
3
- * An append-only timeline store for notification events.
4
- */
3
+ * An append-only timeline store for notification events.
4
+ */
5
5
  interface EventStore {
6
6
  append: (event: NotificationEvent) => void | Promise<void>;
7
7
  timeline: (messageId: string) => NotificationEvent[] | Promise<NotificationEvent[]>;
8
8
  }
9
9
  /**
10
- * In-memory {@link EventStore} keyed by message id.
11
- */
10
+ * In-memory {@link EventStore} keyed by message id.
11
+ */
12
12
  declare class MemoryEventStore implements EventStore {
13
13
  #private;
14
14
  append(event: NotificationEvent): void;
@@ -16,22 +16,22 @@ declare class MemoryEventStore implements EventStore {
16
16
  }
17
17
  type NotificationEventListener = (event: NotificationEvent) => void;
18
18
  /**
19
- * A tiny synchronous event bus for notification lifecycle events. Listeners can subscribe
20
- * to a specific {@link NotificationEventType} or to all events with `"*"`.
21
- */
19
+ * A tiny synchronous event bus for notification lifecycle events. Listeners can subscribe
20
+ * to a specific {@link NotificationEventType} or to all events with `"*"`.
21
+ */
22
22
  declare class NotificationEventBus {
23
23
  #private;
24
24
  /**
25
- * Subscribes to an event type (or `"*"` for all).
26
- * @param type A specific {@link NotificationEventType} to listen for, or `"*"` for every event.
27
- * @param listener The callback invoked with each matching event.
28
- * @returns An unsubscribe function.
29
- */
25
+ * Subscribes to an event type (or `"*"` for all).
26
+ * @param type A specific {@link NotificationEventType} to listen for, or `"*"` for every event.
27
+ * @param listener The callback invoked with each matching event.
28
+ * @returns An unsubscribe function.
29
+ */
30
30
  on(type: "*" | NotificationEventType, listener: NotificationEventListener): () => void;
31
31
  /**
32
- * Emits an event to matching listeners.
33
- * @param event The event to emit.
34
- */
32
+ * Emits an event to matching listeners.
33
+ * @param event The event to emit.
34
+ */
35
35
  emit(event: NotificationEvent): void;
36
36
  }
37
37
  export { type EventStore, MemoryEventStore, NotificationEventBus, NotificationEventListener };
@@ -17,26 +17,26 @@ interface Translator {
17
17
  translate: (locale: string, key: string, values?: Record<string, unknown>) => string;
18
18
  }
19
19
  /**
20
- * Create a {@link Translator} over a set of locale message tables, using
21
- * [ICU MessageFormat](https://formatjs.io/docs/core-concepts/icu-syntax/) (plurals,
22
- * select, number/date) via `intl-messageformat`, with region → language → fallback
23
- * resolution driven by the subscriber's locale. Edge-safe and dependency-light
24
- * (requires the `intl-messageformat` peer).
25
- * @param options Message tables, fallback locale, and an optional missing-key handler.
26
- * @returns A {@link Translator}.
27
- * @example
28
- * ```ts
29
- * const t = createTranslator({
30
- * fallbackLocale: "en",
31
- * messages: {
32
- * en: { likes: "{count, plural, one {# like} other {# likes}}" },
33
- * de_DE: { likes: "{count, plural, one {# Like} other {# Likes}}" },
34
- * },
35
- * });
36
- *
37
- * t.translate("de_DE", "likes", { count: 3 }); // "3 Likes"
38
- * t.translate("fr", "likes", { count: 1 }); // falls back to en → "1 like"
39
- * ```
40
- */
20
+ * Create a {@link Translator} over a set of locale message tables, using
21
+ * [ICU MessageFormat](https://formatjs.io/docs/core-concepts/icu-syntax/) (plurals,
22
+ * select, number/date) via `intl-messageformat`, with region → language → fallback
23
+ * resolution driven by the subscriber's locale. Edge-safe and dependency-light
24
+ * (requires the `intl-messageformat` peer).
25
+ * @param options Message tables, fallback locale, and an optional missing-key handler.
26
+ * @returns A {@link Translator}.
27
+ * @example
28
+ * ```ts
29
+ * const t = createTranslator({
30
+ * fallbackLocale: "en",
31
+ * messages: {
32
+ * en: { likes: "{count, plural, one {# like} other {# likes}}" },
33
+ * de_DE: { likes: "{count, plural, one {# Like} other {# Likes}}" },
34
+ * },
35
+ * });
36
+ *
37
+ * t.translate("de_DE", "likes", { count: 3 }); // "3 Likes"
38
+ * t.translate("fr", "likes", { count: 1 }); // falls back to en → "1 like"
39
+ * ```
40
+ */
41
41
  declare const createTranslator: (options: TranslatorOptions) => Translator;
42
42
  export { type Translator, type TranslatorOptions, createTranslator };
@@ -1 +1 @@
1
- import{default as e}from"../packem_shared/createTranslator-CY91C2eS.js";export{e as createTranslator};
1
+ import{default as e}from"../packem_shared/createTranslator-ByyvYNfG.js";export{e as createTranslator};