@visulima/notification 1.0.9 → 1.0.11

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 (125) hide show
  1. package/CHANGELOG.md +16 -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-BuS_QjJv.js +1 -0
  16. package/dist/packem_shared/NotificationError-B1ZZqWxL.js +1 -0
  17. package/dist/packem_shared/{RequiredOptionError-CuL42XRq.js → RequiredOptionError-CH4g-BZM.js} +1 -1
  18. package/dist/packem_shared/apnsProvider-BV5-wOvD.js +1 -0
  19. package/dist/packem_shared/{circuitBreakerMiddleware-BlZN7SVT.js → circuitBreakerMiddleware-o3G_6N3s.js} +1 -1
  20. package/dist/packem_shared/{createDigester-vMNPejGF.js → createDigester-DCwWhmpi.js} +1 -1
  21. package/dist/packem_shared/{createNotificationWorkflow-B70OgeED.js → createNotificationWorkflow-lseG_9fC.js} +1 -1
  22. package/dist/packem_shared/createQueueWorker-BIXWHJLY.js +1 -0
  23. package/dist/packem_shared/{createTranslator-CY91C2eS.js → createTranslator-BL2M8eeD.js} +1 -1
  24. package/dist/packem_shared/{discordProvider-BhfXcCcI.js → discordProvider-D4LpBljj.js} +1 -1
  25. package/dist/packem_shared/{emailChannel-CNDlX96Q.js → emailChannel-BoLLbyrn.js} +1 -1
  26. package/dist/packem_shared/{expoProvider-DsZR4sUk.js → expoProvider-BPJr9c0e.js} +1 -1
  27. package/dist/packem_shared/{failoverProvider-D1dAmW8U.js → failoverProvider-CJsDGjzf.js} +1 -1
  28. package/dist/packem_shared/fcmProvider-qIR12R9m.js +1 -0
  29. package/dist/packem_shared/hmacBase64-CNksyDoB.js +1 -0
  30. package/dist/packem_shared/{messageBirdProvider-BfiTaNLn.js → messageBirdProvider-FK9_UONf.js} +1 -1
  31. package/dist/packem_shared/{mockProvider-BLwTZlkw.js → mockProvider-C2hHPSVa.js} +1 -1
  32. package/dist/packem_shared/{msTeamsProvider-DrmL3RYX.js → msTeamsProvider-DeGPjmCt.js} +1 -1
  33. package/dist/packem_shared/notification.d-D0ado_cy.d.ts +104 -0
  34. package/dist/packem_shared/{plivoProvider-Dr8d5yD3.js → plivoProvider-DaCu7J3X.js} +1 -1
  35. package/dist/packem_shared/{provider.d-BQAGriz6.d.ts → provider.d-Dh32nRm9.d.ts} +10 -10
  36. package/dist/packem_shared/{roundRobinProvider-BetXJUUm.js → roundRobinProvider-HowYifRe.js} +1 -1
  37. package/dist/packem_shared/{slackProvider-DPG1IlA0.js → slackProvider-Caxbs4Pa.js} +1 -1
  38. package/dist/packem_shared/{slackWebhook-Cpmm_0El.js → slackWebhook-IB4mVnBk.js} +1 -1
  39. package/dist/packem_shared/{sms-CU-OZvNU.js → sms-BbxkOLQm.js} +1 -1
  40. package/dist/packem_shared/{snsProvider-C2T2UxDK.js → snsProvider-BS4D6w-i.js} +3 -3
  41. package/dist/packem_shared/{standardWebhook-Bk0UUeDW.js → standardWebhook-C_AQWUi5.js} +1 -1
  42. package/dist/packem_shared/{telegramProvider-wyx3ksVm.js → telegramProvider-BIc_GgpY.js} +1 -1
  43. package/dist/packem_shared/{telnyxProvider-jgpEwgPh.js → telnyxProvider-wjmTXBwh.js} +1 -1
  44. package/dist/packem_shared/{tracer.d-Co1s_NwG.d.ts → tracer.d-BPznIQx9.d.ts} +2 -2
  45. package/dist/packem_shared/{twilioProvider-DMYWqvgZ.js → twilioProvider-Bf_zsF9z.js} +1 -1
  46. package/dist/packem_shared/twilioWebhook-Hhf9aWV1.js +1 -0
  47. package/dist/packem_shared/types.d-BU-37j3S.d.ts +10 -0
  48. package/dist/packem_shared/{types.d-GUzX1jTk.d.ts → types.d-C7l7qdMG.d.ts} +52 -52
  49. package/dist/packem_shared/{types.d-CximoA8M.d.ts → types.d-CRs03TYV.d.ts} +13 -13
  50. package/dist/packem_shared/{types.d-C1GoEAlI.d-Bv3grfyD.d.ts → types.d-CcjfiGpo.d-DuZME7ry.d.ts} +27 -34
  51. package/dist/packem_shared/{types.d-67TogK4k.d.ts → types.d-r8K0ICyx.d.ts} +7 -7
  52. package/dist/packem_shared/{vonageProvider-CT4KoWXu.js → vonageProvider-oRg9dpS1.js} +1 -1
  53. package/dist/packem_shared/{webPushProvider-DwjmWASr.js → webPushProvider-BtZHb_X_.js} +1 -1
  54. package/dist/packem_shared/{webcrypto-bY7wJCB5.js → webcrypto-CFuQmh5-.js} +1 -1
  55. package/dist/packem_shared/webhookProvider-CwkDb1cZ.js +1 -0
  56. package/dist/preferences/index.d.ts +19 -19
  57. package/dist/providers/chat/discord/index.d.ts +5 -5
  58. package/dist/providers/chat/discord/index.js +1 -1
  59. package/dist/providers/chat/msteams/index.d.ts +7 -7
  60. package/dist/providers/chat/msteams/index.js +1 -1
  61. package/dist/providers/chat/slack/index.d.ts +6 -6
  62. package/dist/providers/chat/slack/index.js +1 -1
  63. package/dist/providers/chat/telegram/index.d.ts +5 -5
  64. package/dist/providers/chat/telegram/index.js +1 -1
  65. package/dist/providers/failover/index.d.ts +7 -7
  66. package/dist/providers/failover/index.js +1 -1
  67. package/dist/providers/mock/index.d.ts +5 -5
  68. package/dist/providers/mock/index.js +1 -1
  69. package/dist/providers/opentelemetry/index.d.ts +14 -14
  70. package/dist/providers/push/apns/index.d.ts +9 -9
  71. package/dist/providers/push/apns/index.js +1 -1
  72. package/dist/providers/push/expo/index.d.ts +5 -5
  73. package/dist/providers/push/expo/index.js +1 -1
  74. package/dist/providers/push/fcm/index.d.ts +13 -13
  75. package/dist/providers/push/fcm/index.js +1 -1
  76. package/dist/providers/push/web-push/index.d.ts +11 -11
  77. package/dist/providers/push/web-push/index.js +1 -1
  78. package/dist/providers/roundrobin/index.d.ts +8 -8
  79. package/dist/providers/roundrobin/index.js +1 -1
  80. package/dist/providers/sms/messagebird/index.d.ts +5 -5
  81. package/dist/providers/sms/messagebird/index.js +1 -1
  82. package/dist/providers/sms/plivo/index.d.ts +5 -5
  83. package/dist/providers/sms/plivo/index.js +1 -1
  84. package/dist/providers/sms/sns/index.d.ts +6 -6
  85. package/dist/providers/sms/sns/index.js +1 -1
  86. package/dist/providers/sms/telnyx/index.d.ts +5 -5
  87. package/dist/providers/sms/telnyx/index.js +1 -1
  88. package/dist/providers/sms/twilio/index.d.ts +5 -5
  89. package/dist/providers/sms/twilio/index.js +1 -1
  90. package/dist/providers/sms/vonage/index.d.ts +5 -5
  91. package/dist/providers/sms/vonage/index.js +1 -1
  92. package/dist/providers/webhook/index.d.ts +7 -7
  93. package/dist/providers/webhook/index.js +1 -1
  94. package/dist/queue/bullmq-queue.d.ts +24 -24
  95. package/dist/queue/index.d.ts +17 -15
  96. package/dist/queue/index.js +1 -1
  97. package/dist/queue/pg-boss-queue.d.ts +27 -26
  98. package/dist/queue/pg-boss-queue.js +1 -1
  99. package/dist/queue/sqs-queue.d.ts +27 -27
  100. package/dist/queue/sqs-queue.js +1 -1
  101. package/dist/queue/unstorage-queue.d.ts +21 -14
  102. package/dist/queue/unstorage-queue.js +1 -1
  103. package/dist/routing/index.d.ts +22 -22
  104. package/dist/template-engines/handlebars.d.ts +13 -13
  105. package/dist/template-engines/handlebars.js +1 -1
  106. package/dist/template-engines/liquid.d.ts +13 -13
  107. package/dist/template-engines/liquid.js +1 -1
  108. package/dist/template-engines/string.d.ts +17 -17
  109. package/dist/utils/result.d.ts +32 -32
  110. package/dist/utils/result.js +1 -1
  111. package/dist/webhooks/index.d.ts +84 -84
  112. package/dist/webhooks/index.js +1 -1
  113. package/dist/workflow/index.d.ts +42 -42
  114. package/dist/workflow/index.js +1 -1
  115. package/package.json +3 -3
  116. package/dist/packem_shared/Notification-B22tuJPy.js +0 -1
  117. package/dist/packem_shared/NotificationError-DVfMJQ1u.js +0 -1
  118. package/dist/packem_shared/apnsProvider-C9WSv5sc.js +0 -1
  119. package/dist/packem_shared/createQueueWorker-DjQBxjXc.js +0 -1
  120. package/dist/packem_shared/fcmProvider-DWRx8XBv.js +0 -1
  121. package/dist/packem_shared/hmacBase64-BhhoX0uo.js +0 -1
  122. package/dist/packem_shared/notification.d-DFCVTods.d.ts +0 -104
  123. package/dist/packem_shared/twilioWebhook-C-Iwuv7y.js +0 -1
  124. package/dist/packem_shared/types.d-td-F2Oh0.d.ts +0 -10
  125. package/dist/packem_shared/webhookProvider-CPA1nKXJ.js +0 -1
@@ -1,5 +1,5 @@
1
- import { d as BaseConfig, S as SmsPayload } from "../../../packem_shared/types.d-GUzX1jTk.js";
2
- import { a as ProviderFactory } from "../../../packem_shared/provider.d-BQAGriz6.js";
1
+ import { d as BaseConfig, S as SmsPayload } from "../../../packem_shared/types.d-C7l7qdMG.js";
2
+ import { a as ProviderFactory } from "../../../packem_shared/provider.d-Dh32nRm9.js";
3
3
  interface MessageBirdConfig extends BaseConfig {
4
4
  /** MessageBird (Bird) access key. */
5
5
  accessKey: string;
@@ -9,8 +9,8 @@ interface MessageBirdConfig extends BaseConfig {
9
9
  from?: string;
10
10
  }
11
11
  /**
12
- * MessageBird (Bird) SMS provider. Sends to many recipients in one call.
13
- * @see https://docs.bird.com/api/sms-messaging
14
- */
12
+ * MessageBird (Bird) SMS provider. Sends to many recipients in one call.
13
+ * @see https://docs.bird.com/api/sms-messaging
14
+ */
15
15
  declare const messageBirdProvider: ProviderFactory<MessageBirdConfig, SmsPayload>;
16
16
  export { type MessageBirdConfig, messageBirdProvider };
@@ -1 +1 @@
1
- import{default as a}from"../../../packem_shared/messageBirdProvider-BfiTaNLn.js";export{a as messageBirdProvider};
1
+ import{default as a}from"../../../packem_shared/messageBirdProvider-FK9_UONf.js";export{a as messageBirdProvider};
@@ -1,5 +1,5 @@
1
- import { d as BaseConfig, S as SmsPayload } from "../../../packem_shared/types.d-GUzX1jTk.js";
2
- import { a as ProviderFactory } from "../../../packem_shared/provider.d-BQAGriz6.js";
1
+ import { d as BaseConfig, S as SmsPayload } from "../../../packem_shared/types.d-C7l7qdMG.js";
2
+ import { a as ProviderFactory } from "../../../packem_shared/provider.d-Dh32nRm9.js";
3
3
  interface PlivoConfig extends BaseConfig {
4
4
  /** Plivo Auth ID. */
5
5
  authId: string;
@@ -11,8 +11,8 @@ interface PlivoConfig extends BaseConfig {
11
11
  from?: string;
12
12
  }
13
13
  /**
14
- * Plivo SMS provider. Sends to many recipients in one call (`dst` joined by `&lt;`).
15
- * @see https://www.plivo.com/docs/sms/api/message
16
- */
14
+ * Plivo SMS provider. Sends to many recipients in one call (`dst` joined by `&lt;`).
15
+ * @see https://www.plivo.com/docs/sms/api/message
16
+ */
17
17
  declare const plivoProvider: ProviderFactory<PlivoConfig, SmsPayload>;
18
18
  export { type PlivoConfig, plivoProvider };
@@ -1 +1 @@
1
- import{default as e}from"../../../packem_shared/plivoProvider-Dr8d5yD3.js";export{e as plivoProvider};
1
+ import{default as e}from"../../../packem_shared/plivoProvider-DaCu7J3X.js";export{e as plivoProvider};
@@ -1,5 +1,5 @@
1
- import { d as BaseConfig, S as SmsPayload } from "../../../packem_shared/types.d-GUzX1jTk.js";
2
- import { a as ProviderFactory } from "../../../packem_shared/provider.d-BQAGriz6.js";
1
+ import { d as BaseConfig, S as SmsPayload } from "../../../packem_shared/types.d-C7l7qdMG.js";
2
+ import { a as ProviderFactory } from "../../../packem_shared/provider.d-Dh32nRm9.js";
3
3
  interface SnsConfig extends BaseConfig {
4
4
  /** AWS access key id. */
5
5
  accessKeyId: string;
@@ -13,9 +13,9 @@ interface SnsConfig extends BaseConfig {
13
13
  sessionToken?: string;
14
14
  }
15
15
  /**
16
- * AWS SNS SMS provider. Edge-safe — signs the `Publish` action with Signature V4
17
- * computed entirely via Web Crypto (HMAC-SHA256 + SHA-256), no `node:crypto`.
18
- * @see https://docs.aws.amazon.com/sns/latest/api/API_Publish.html
19
- */
16
+ * AWS SNS SMS provider. Edge-safe — signs the `Publish` action with Signature V4
17
+ * computed entirely via Web Crypto (HMAC-SHA256 + SHA-256), no `node:crypto`.
18
+ * @see https://docs.aws.amazon.com/sns/latest/api/API_Publish.html
19
+ */
20
20
  declare const snsProvider: ProviderFactory<SnsConfig, SmsPayload>;
21
21
  export { type SnsConfig, snsProvider };
@@ -1 +1 @@
1
- import{default as o}from"../../../packem_shared/snsProvider-C2T2UxDK.js";export{o as snsProvider};
1
+ import{default as o}from"../../../packem_shared/snsProvider-BS4D6w-i.js";export{o as snsProvider};
@@ -1,5 +1,5 @@
1
- import { d as BaseConfig, S as SmsPayload } from "../../../packem_shared/types.d-GUzX1jTk.js";
2
- import { a as ProviderFactory } from "../../../packem_shared/provider.d-BQAGriz6.js";
1
+ import { d as BaseConfig, S as SmsPayload } from "../../../packem_shared/types.d-C7l7qdMG.js";
2
+ import { a as ProviderFactory } from "../../../packem_shared/provider.d-Dh32nRm9.js";
3
3
  interface TelnyxConfig extends BaseConfig {
4
4
  /** Telnyx API key (v2). */
5
5
  apiKey: string;
@@ -11,8 +11,8 @@ interface TelnyxConfig extends BaseConfig {
11
11
  messagingProfileId?: string;
12
12
  }
13
13
  /**
14
- * Telnyx SMS/MMS provider (v2 API). Edge-safe — `fetch` + Bearer auth.
15
- * @see https://developers.telnyx.com/api/messaging/send-message
16
- */
14
+ * Telnyx SMS/MMS provider (v2 API). Edge-safe — `fetch` + Bearer auth.
15
+ * @see https://developers.telnyx.com/api/messaging/send-message
16
+ */
17
17
  declare const telnyxProvider: ProviderFactory<TelnyxConfig, SmsPayload>;
18
18
  export { type TelnyxConfig, telnyxProvider };
@@ -1 +1 @@
1
- import{default as o}from"../../../packem_shared/telnyxProvider-jgpEwgPh.js";export{o as telnyxProvider};
1
+ import{default as o}from"../../../packem_shared/telnyxProvider-wjmTXBwh.js";export{o as telnyxProvider};
@@ -1,5 +1,5 @@
1
- import { d as BaseConfig, S as SmsPayload } from "../../../packem_shared/types.d-GUzX1jTk.js";
2
- import { a as ProviderFactory } from "../../../packem_shared/provider.d-BQAGriz6.js";
1
+ import { d as BaseConfig, S as SmsPayload } from "../../../packem_shared/types.d-C7l7qdMG.js";
2
+ import { a as ProviderFactory } from "../../../packem_shared/provider.d-Dh32nRm9.js";
3
3
  interface TwilioConfig extends BaseConfig {
4
4
  /** Twilio Account SID. */
5
5
  accountSid: string;
@@ -13,8 +13,8 @@ interface TwilioConfig extends BaseConfig {
13
13
  messagingServiceSid?: string;
14
14
  }
15
15
  /**
16
- * Twilio SMS/MMS provider. Edge-safe — uses `fetch` + Basic auth, no Node built-ins.
17
- * @see https://www.twilio.com/docs/sms/api/message-resource
18
- */
16
+ * Twilio SMS/MMS provider. Edge-safe — uses `fetch` + Basic auth, no Node built-ins.
17
+ * @see https://www.twilio.com/docs/sms/api/message-resource
18
+ */
19
19
  declare const twilioProvider: ProviderFactory<TwilioConfig, SmsPayload>;
20
20
  export { type TwilioConfig, twilioProvider };
@@ -1 +1 @@
1
- import{default as e}from"../../../packem_shared/twilioProvider-DMYWqvgZ.js";export{e as twilioProvider};
1
+ import{default as e}from"../../../packem_shared/twilioProvider-Bf_zsF9z.js";export{e as twilioProvider};
@@ -1,5 +1,5 @@
1
- import { d as BaseConfig, S as SmsPayload } from "../../../packem_shared/types.d-GUzX1jTk.js";
2
- import { a as ProviderFactory } from "../../../packem_shared/provider.d-BQAGriz6.js";
1
+ import { d as BaseConfig, S as SmsPayload } from "../../../packem_shared/types.d-C7l7qdMG.js";
2
+ import { a as ProviderFactory } from "../../../packem_shared/provider.d-Dh32nRm9.js";
3
3
  interface VonageConfig extends BaseConfig {
4
4
  /** Vonage (Nexmo) API key. */
5
5
  apiKey: string;
@@ -11,8 +11,8 @@ interface VonageConfig extends BaseConfig {
11
11
  from?: string;
12
12
  }
13
13
  /**
14
- * Vonage (Nexmo) SMS provider. Edge-safe — `fetch` + form auth.
15
- * @see https://developer.vonage.com/en/api/sms
16
- */
14
+ * Vonage (Nexmo) SMS provider. Edge-safe — `fetch` + form auth.
15
+ * @see https://developer.vonage.com/en/api/sms
16
+ */
17
17
  declare const vonageProvider: ProviderFactory<VonageConfig, SmsPayload>;
18
18
  export { type VonageConfig, vonageProvider };
@@ -1 +1 @@
1
- import{default as r}from"../../../packem_shared/vonageProvider-CT4KoWXu.js";export{r as vonageProvider};
1
+ import{default as r}from"../../../packem_shared/vonageProvider-oRg9dpS1.js";export{r as vonageProvider};
@@ -1,5 +1,5 @@
1
- import { d as BaseConfig, W as WebhookPayload } from "../../packem_shared/types.d-GUzX1jTk.js";
2
- import { P as Provider } from "../../packem_shared/provider.d-BQAGriz6.js";
1
+ import { d as BaseConfig, W as WebhookPayload } from "../../packem_shared/types.d-C7l7qdMG.js";
2
+ import { P as Provider } from "../../packem_shared/provider.d-Dh32nRm9.js";
3
3
  interface WebhookConfig extends BaseConfig {
4
4
  /** Default headers merged into every request. */
5
5
  headers?: Record<string, string>;
@@ -9,10 +9,10 @@ interface WebhookConfig extends BaseConfig {
9
9
  url?: string;
10
10
  }
11
11
  /**
12
- * Generic outbound webhook provider. Edge-safe — `fetch` only. Useful for custom
13
- * integrations and as a fan-out sink.
14
- * @param config Optional config.
15
- * @returns A webhook-channel provider.
16
- */
12
+ * Generic outbound webhook provider. Edge-safe — `fetch` only. Useful for custom
13
+ * integrations and as a fan-out sink.
14
+ * @param config Optional config.
15
+ * @returns A webhook-channel provider.
16
+ */
17
17
  declare const webhookProvider: (config?: WebhookConfig) => Provider<WebhookConfig, WebhookPayload>;
18
18
  export { type WebhookConfig, webhookProvider };
@@ -1 +1 @@
1
- import{webhookProvider as e}from"../../packem_shared/webhookProvider-CPA1nKXJ.js";export{e as webhookProvider};
1
+ import{webhookProvider as e}from"../../packem_shared/webhookProvider-CwkDb1cZ.js";export{e as webhookProvider};
@@ -1,11 +1,11 @@
1
- import { a as NotificationMessage } from "../packem_shared/notification.d-DFCVTods.js";
2
- import { Q as QueueJob, N as NotificationQueue } from "../packem_shared/types.d-67TogK4k.js";
3
- import "../packem_shared/types.d-CximoA8M.js";
4
- import "../packem_shared/types.d-GUzX1jTk.js";
5
- import "../packem_shared/provider.d-BQAGriz6.js";
1
+ import { a as NotificationMessage } from "../packem_shared/notification.d-D0ado_cy.js";
2
+ import { Q as QueueJob, N as NotificationQueue } from "../packem_shared/types.d-r8K0ICyx.js";
3
+ import "../packem_shared/types.d-CRs03TYV.js";
4
+ import "../packem_shared/types.d-C7l7qdMG.js";
5
+ import "../packem_shared/provider.d-Dh32nRm9.js";
6
6
  /**
7
- * A BullMQ job, narrowed to the members this adapter reads.
8
- */
7
+ * A BullMQ job, narrowed to the members this adapter reads.
8
+ */
9
9
  interface BullmqJobLike {
10
10
  attemptsMade: number;
11
11
  data: unknown;
@@ -14,9 +14,9 @@ interface BullmqJobLike {
14
14
  remove: () => Promise<unknown>;
15
15
  }
16
16
  /**
17
- * The subset of a [BullMQ](https://docs.bullmq.io/) `Queue` this adapter uses. Typed structurally so
18
- * the `bullmq` optional peer is never imported — pass a real `Queue` instance, which satisfies this.
19
- */
17
+ * The subset of a [BullMQ](https://docs.bullmq.io/) `Queue` this adapter uses. Typed structurally so
18
+ * the `bullmq` optional peer is never imported — pass a real `Queue` instance, which satisfies this.
19
+ */
20
20
  interface BullmqQueueLike {
21
21
  add: (name: string, data: unknown, options?: {
22
22
  delay?: number;
@@ -28,15 +28,15 @@ interface BullmqQueueLike {
28
28
  getNextJob: (token: string) => Promise<BullmqJobLike | undefined>;
29
29
  }
30
30
  /**
31
- * A {@link NotificationQueue} backed by [BullMQ](https://docs.bullmq.io/) (Redis).
32
- *
33
- * BullMQ is push-based: jobs are normally consumed by a BullMQ `Worker`. This adapter maps the
34
- * pull-based reserve/ack model onto BullMQ's `getNextJob`-style primitives so it composes with the
35
- * notification `QueueWorker`. Pass an already-configured `Queue` instance — `bullmq` is an optional
36
- * peer dependency and is never instantiated here.
37
- *
38
- * Runtime: NODE ONLY (requires a Redis connection). Not Cloudflare Workers compatible.
39
- */
31
+ * A {@link NotificationQueue} backed by [BullMQ](https://docs.bullmq.io/) (Redis).
32
+ *
33
+ * BullMQ is push-based: jobs are normally consumed by a BullMQ `Worker`. This adapter maps the
34
+ * pull-based reserve/ack model onto BullMQ's `getNextJob`-style primitives so it composes with the
35
+ * notification `QueueWorker`. Pass an already-configured `Queue` instance — `bullmq` is an optional
36
+ * peer dependency and is never instantiated here.
37
+ *
38
+ * Runtime: NODE ONLY (requires a Redis connection). Not Cloudflare Workers compatible.
39
+ */
40
40
  declare class BullMqQueue implements NotificationQueue {
41
41
  #private;
42
42
  constructor(queue: BullmqQueueLike, jobName?: string);
@@ -49,10 +49,10 @@ declare class BullMqQueue implements NotificationQueue {
49
49
  size(): Promise<number>;
50
50
  }
51
51
  /**
52
- * Convenience factory for {@link BullMqQueue}.
53
- * @param queue A configured BullMQ `Queue` instance (optional peer).
54
- * @param jobName The name jobs are enqueued under.
55
- * @returns A new {@link BullMqQueue}.
56
- */
52
+ * Convenience factory for {@link BullMqQueue}.
53
+ * @param queue A configured BullMQ `Queue` instance (optional peer).
54
+ * @param jobName The name jobs are enqueued under.
55
+ * @returns A new {@link BullMqQueue}.
56
+ */
57
57
  declare const createBullMqQueue: (queue: BullmqQueueLike, jobName?: string) => BullMqQueue;
58
58
  export { BullMqQueue, type BullmqJobLike, type BullmqQueueLike, createBullMqQueue };
@@ -1,15 +1,15 @@
1
1
  export { BullMqQueue, createBullMqQueue } from "./bullmq-queue.js";
2
- import { a as NotificationMessage, N as Notification } from "../packem_shared/notification.d-DFCVTods.js";
3
- import { Q as QueueJob, N as NotificationQueue } from "../packem_shared/types.d-67TogK4k.js";
2
+ import { a as NotificationMessage, N as Notification } from "../packem_shared/notification.d-D0ado_cy.js";
3
+ import { Q as QueueJob, N as NotificationQueue } from "../packem_shared/types.d-r8K0ICyx.js";
4
4
  export { PgBossQueue, type PgBossQueueOptions, createPgBossQueue } from "./pg-boss-queue.js";
5
5
  export { SqsQueue, type SqsQueueOptions, createSqsQueue } from "./sqs-queue.js";
6
- import { c as Receipt } from "../packem_shared/types.d-GUzX1jTk.js";
7
- import "../packem_shared/types.d-CximoA8M.js";
8
- import "../packem_shared/provider.d-BQAGriz6.js";
6
+ import { c as Receipt } from "../packem_shared/types.d-C7l7qdMG.js";
7
+ import "../packem_shared/types.d-CRs03TYV.js";
8
+ import "../packem_shared/provider.d-Dh32nRm9.js";
9
9
  /**
10
- * In-process {@link NotificationQueue}. Suitable for single-instance apps, tests and the
11
- * default worker; swap for the unstorage/BullMQ adapters for durability.
12
- */
10
+ * In-process {@link NotificationQueue}. Suitable for single-instance apps, tests and the
11
+ * default worker; swap for the unstorage/BullMQ adapters for durability.
12
+ */
13
13
  declare class MemoryQueue implements NotificationQueue {
14
14
  #private;
15
15
  enqueue(message: NotificationMessage, options?: {
@@ -27,6 +27,8 @@ interface QueueWorkerOptions {
27
27
  maxAttempts?: number;
28
28
  /** Called when a job is dropped after exhausting attempts. */
29
29
  onDrop?: (job: QueueJob, receipts: Receipt[]) => void;
30
+ /** Called when the queue or a delivery throws; the loop keeps polling. */
31
+ onError?: (error: unknown, job?: QueueJob) => void;
30
32
  /** Poll interval in ms when the queue is empty (default 1000). */
31
33
  pollInterval?: number;
32
34
  }
@@ -39,12 +41,12 @@ interface QueueWorker {
39
41
  stop: () => void;
40
42
  }
41
43
  /**
42
- * Creates a worker that reserves jobs from a queue and delivers them via a
43
- * {@link Notification} facade, retrying with backoff and dropping after `maxAttempts`.
44
- * @param queue The queue to drain.
45
- * @param notification The facade used to deliver messages.
46
- * @param options Behaviour tuning (max attempts, backoff curve, poll interval, drop hook).
47
- * @returns A controllable worker.
48
- */
44
+ * Creates a worker that reserves jobs from a queue and delivers them via a
45
+ * {@link Notification} facade, retrying with backoff and dropping after `maxAttempts`.
46
+ * @param queue The queue to drain.
47
+ * @param notification The facade used to deliver messages.
48
+ * @param options Behaviour tuning (max attempts, backoff curve, poll interval, drop hook).
49
+ * @returns A controllable worker.
50
+ */
49
51
  declare const createQueueWorker: (queue: NotificationQueue, notification: Notification, options?: QueueWorkerOptions) => QueueWorker;
50
52
  export { MemoryQueue, type NotificationQueue, type QueueJob, type QueueWorker, type QueueWorkerOptions, createQueueWorker };
@@ -1 +1 @@
1
- import{BullMqQueue as r,createBullMqQueue as o}from"./bullmq-queue.js";import{default as Q}from"../packem_shared/MemoryQueue-CXgWoZoY.js";import{PgBossQueue as a,createPgBossQueue as f}from"./pg-boss-queue.js";import{SqsQueue as l,createSqsQueue as p}from"./sqs-queue.js";import{createQueueWorker as c}from"../packem_shared/createQueueWorker-DjQBxjXc.js";export{r as BullMqQueue,Q as MemoryQueue,a as PgBossQueue,l as SqsQueue,o as createBullMqQueue,f as createPgBossQueue,c as createQueueWorker,p as createSqsQueue};
1
+ import{BullMqQueue as r,createBullMqQueue as o}from"./bullmq-queue.js";import{default as Q}from"../packem_shared/MemoryQueue-CXgWoZoY.js";import{PgBossQueue as a,createPgBossQueue as f}from"./pg-boss-queue.js";import{SqsQueue as l,createSqsQueue as p}from"./sqs-queue.js";import{createQueueWorker as c}from"../packem_shared/createQueueWorker-BIXWHJLY.js";export{r as BullMqQueue,Q as MemoryQueue,a as PgBossQueue,l as SqsQueue,o as createBullMqQueue,f as createPgBossQueue,c as createQueueWorker,p as createSqsQueue};
@@ -1,11 +1,11 @@
1
- import { a as NotificationMessage } from "../packem_shared/notification.d-DFCVTods.js";
2
- import { Q as QueueJob, N as NotificationQueue } from "../packem_shared/types.d-67TogK4k.js";
3
- import "../packem_shared/types.d-CximoA8M.js";
4
- import "../packem_shared/types.d-GUzX1jTk.js";
5
- import "../packem_shared/provider.d-BQAGriz6.js";
1
+ import { a as NotificationMessage } from "../packem_shared/notification.d-D0ado_cy.js";
2
+ import { Q as QueueJob, N as NotificationQueue } from "../packem_shared/types.d-r8K0ICyx.js";
3
+ import "../packem_shared/types.d-CRs03TYV.js";
4
+ import "../packem_shared/types.d-C7l7qdMG.js";
5
+ import "../packem_shared/provider.d-Dh32nRm9.js";
6
6
  /**
7
- * A pg-boss job fetched with `includeMetadata`, narrowed to the members this adapter reads.
8
- */
7
+ * A pg-boss job fetched with `includeMetadata`, narrowed to the members this adapter reads.
8
+ */
9
9
  interface PgBossJobLike {
10
10
  data: unknown;
11
11
  id: string;
@@ -13,9 +13,9 @@ interface PgBossJobLike {
13
13
  retryCount?: number;
14
14
  }
15
15
  /**
16
- * The subset of a [pg-boss](https://github.com/timgit/pg-boss) instance this adapter uses (v10 API).
17
- * Typed structurally so the `pg-boss` optional peer is never imported — pass a started `PgBoss` instance.
18
- */
16
+ * The subset of a [pg-boss](https://github.com/timgit/pg-boss) instance this adapter uses (v10 API).
17
+ * Typed structurally so the `pg-boss` optional peer is never imported — pass a started `PgBoss` instance.
18
+ */
19
19
  interface PgBossLike {
20
20
  complete: (name: string, id: string) => Promise<unknown>;
21
21
  fail: (name: string, id: string) => Promise<unknown>;
@@ -29,22 +29,23 @@ interface PgBossLike {
29
29
  }) => Promise<null | string>;
30
30
  }
31
31
  /**
32
- * Options for {@link createPgBossQueue}.
33
- */
32
+ * Options for {@link createPgBossQueue}.
33
+ */
34
34
  interface PgBossQueueOptions {
35
35
  /** The pg-boss queue name. */
36
36
  queueName: string;
37
37
  }
38
38
  /**
39
- * A {@link NotificationQueue} backed by [pg-boss](https://github.com/timgit/pg-boss) (Postgres, v10 API).
40
- *
41
- * Pass a started pg-boss instance — `pg-boss` is an optional peer dependency and is never started here.
42
- * `reserve` uses `fetch` with `includeMetadata`, so the job's `attempts` reflects pg-boss's own
43
- * `retryCount`. `retry` calls `fail`, so the retry delay is governed by the queue's pg-boss retry policy
44
- * rather than the `delayMs` argument.
45
- *
46
- * Runtime: NODE ONLY (requires a Postgres connection). Not Cloudflare Workers compatible.
47
- */
39
+ * A {@link NotificationQueue} backed by [pg-boss](https://github.com/timgit/pg-boss) (Postgres, v10 API).
40
+ *
41
+ * Pass a started pg-boss instance — `pg-boss` is an optional peer dependency and is never started here.
42
+ * `reserve` uses `fetch` with `includeMetadata`, so the job's `attempts` is pg-boss's own
43
+ * `retryCount` plus the current delivery (1 on first reserve, matching the other adapters).
44
+ * `retry` calls `fail`, so the retry delay is governed by the queue's pg-boss retry policy
45
+ * rather than the `delayMs` argument.
46
+ *
47
+ * Runtime: NODE ONLY (requires a Postgres connection). Not Cloudflare Workers compatible.
48
+ */
48
49
  declare class PgBossQueue implements NotificationQueue {
49
50
  #private;
50
51
  constructor(boss: PgBossLike, options: PgBossQueueOptions);
@@ -57,10 +58,10 @@ declare class PgBossQueue implements NotificationQueue {
57
58
  size(): Promise<number>;
58
59
  }
59
60
  /**
60
- * Convenience factory for {@link PgBossQueue}.
61
- * @param boss A started pg-boss instance (optional peer).
62
- * @param options Queue options. See {@link PgBossQueueOptions}.
63
- * @returns A new {@link PgBossQueue}.
64
- */
61
+ * Convenience factory for {@link PgBossQueue}.
62
+ * @param boss A started pg-boss instance (optional peer).
63
+ * @param options Queue options. See {@link PgBossQueueOptions}.
64
+ * @returns A new {@link PgBossQueue}.
65
+ */
65
66
  declare const createPgBossQueue: (boss: PgBossLike, options: PgBossQueueOptions) => PgBossQueue;
66
67
  export { type PgBossJobLike, type PgBossLike, PgBossQueue, PgBossQueueOptions, createPgBossQueue };
@@ -1 +1 @@
1
- class i{#e;#t;constructor(e,t){this.#e=e,this.#t=t.queueName}async enqueue(e,t){const a=t?.scheduledAt===void 0?void 0:new Date(t.scheduledAt);return await this.#e.send(this.#t,e,a===void 0?{}:{startAfter:a})??""}async reserve(){const e=await this.#e.fetch(this.#t,{batchSize:1,includeMetadata:!0}),t=Array.isArray(e)?e[0]:e;if(t)return{attempts:t.retryCount??0,id:t.id,message:t.data,scheduledAt:0}}async ack(e){await this.#e.complete(this.#t,e)}async retry(e){await this.#e.fail(this.#t,e)}async size(){return await this.#e.getQueueSize(this.#t)}}const r=(s,e)=>new i(s,e);export{i as PgBossQueue,r as createPgBossQueue};
1
+ class i{#e;#t;constructor(e,t){this.#e=e,this.#t=t.queueName}async enqueue(e,t){const a=t?.scheduledAt===void 0?void 0:new Date(t.scheduledAt);return await this.#e.send(this.#t,e,a===void 0?{}:{startAfter:a})??""}async reserve(){const e=await this.#e.fetch(this.#t,{batchSize:1,includeMetadata:!0}),t=Array.isArray(e)?e[0]:e;if(t)return{attempts:(t.retryCount??0)+1,id:t.id,message:t.data,scheduledAt:0}}async ack(e){await this.#e.complete(this.#t,e)}async retry(e){await this.#e.fail(this.#t,e)}async size(){return await this.#e.getQueueSize(this.#t)}}const r=(s,e)=>new i(s,e);export{i as PgBossQueue,r as createPgBossQueue};
@@ -1,21 +1,21 @@
1
- import { a as NotificationMessage } from "../packem_shared/notification.d-DFCVTods.js";
2
- import { Q as QueueJob, N as NotificationQueue } from "../packem_shared/types.d-67TogK4k.js";
3
- import "../packem_shared/types.d-CximoA8M.js";
4
- import "../packem_shared/types.d-GUzX1jTk.js";
5
- import "../packem_shared/provider.d-BQAGriz6.js";
1
+ import { a as NotificationMessage } from "../packem_shared/notification.d-D0ado_cy.js";
2
+ import { Q as QueueJob, N as NotificationQueue } from "../packem_shared/types.d-r8K0ICyx.js";
3
+ import "../packem_shared/types.d-CRs03TYV.js";
4
+ import "../packem_shared/types.d-C7l7qdMG.js";
5
+ import "../packem_shared/provider.d-Dh32nRm9.js";
6
6
  /**
7
- * A single SQS message, narrowed to the members this adapter reads.
8
- */
7
+ * A single SQS message, narrowed to the members this adapter reads.
8
+ */
9
9
  interface SqsMessageLike {
10
10
  Attributes?: Record<string, string>;
11
11
  Body?: string;
12
12
  ReceiptHandle?: string;
13
13
  }
14
14
  /**
15
- * The subset of the high-level `@aws-sdk/client-sqs` `SQS` operations this adapter uses. The `SQS`
16
- * class exposes these operation methods directly (unlike the command-based `SQSClient.send`), keeping
17
- * the adapter mockable with plain method stubs and avoiding an import of the optional peer.
18
- */
15
+ * The subset of the high-level `@aws-sdk/client-sqs` `SQS` operations this adapter uses. The `SQS`
16
+ * class exposes these operation methods directly (unlike the command-based `SQSClient.send`), keeping
17
+ * the adapter mockable with plain method stubs and avoiding an import of the optional peer.
18
+ */
19
19
  interface SqsClientLike {
20
20
  changeMessageVisibility: (input: {
21
21
  QueueUrl: string;
@@ -50,8 +50,8 @@ interface SqsClientLike {
50
50
  }>;
51
51
  }
52
52
  /**
53
- * Options for {@link createSqsQueue}.
54
- */
53
+ * Options for {@link createSqsQueue}.
54
+ */
55
55
  interface SqsQueueOptions {
56
56
  /** The SQS queue URL. */
57
57
  queueUrl: string;
@@ -61,15 +61,15 @@ interface SqsQueueOptions {
61
61
  waitTimeSeconds?: number;
62
62
  }
63
63
  /**
64
- * A {@link NotificationQueue} backed by Amazon SQS, which maps natively onto the reserve/ack/retry
65
- * model (ReceiveMessage / DeleteMessage / ChangeMessageVisibility).
66
- *
67
- * Pass an `@aws-sdk/client-sqs` `SQS` instance — it is an optional peer dependency and is never
68
- * constructed here. The reserved job `id` is the SQS `ReceiptHandle`. `scheduledAt` is honored up to
69
- * the SQS 15-minute delay limit.
70
- *
71
- * Runtime: NODE ONLY (depends on the AWS SDK). Not Cloudflare Workers compatible.
72
- */
64
+ * A {@link NotificationQueue} backed by Amazon SQS, which maps natively onto the reserve/ack/retry
65
+ * model (ReceiveMessage / DeleteMessage / ChangeMessageVisibility).
66
+ *
67
+ * Pass an `@aws-sdk/client-sqs` `SQS` instance — it is an optional peer dependency and is never
68
+ * constructed here. The reserved job `id` is the SQS `ReceiptHandle`. `scheduledAt` is honored up to
69
+ * the SQS 15-minute delay limit.
70
+ *
71
+ * Runtime: NODE ONLY (depends on the AWS SDK). Not Cloudflare Workers compatible.
72
+ */
73
73
  declare class SqsQueue implements NotificationQueue {
74
74
  #private;
75
75
  constructor(client: SqsClientLike, options: SqsQueueOptions);
@@ -82,10 +82,10 @@ declare class SqsQueue implements NotificationQueue {
82
82
  size(): Promise<number>;
83
83
  }
84
84
  /**
85
- * Convenience factory for {@link SqsQueue}.
86
- * @param client An `@aws-sdk/client-sqs` `SQS` instance (optional peer).
87
- * @param options Queue options. See {@link SqsQueueOptions}.
88
- * @returns A new {@link SqsQueue}.
89
- */
85
+ * Convenience factory for {@link SqsQueue}.
86
+ * @param client An `@aws-sdk/client-sqs` `SQS` instance (optional peer).
87
+ * @param options Queue options. See {@link SqsQueueOptions}.
88
+ * @returns A new {@link SqsQueue}.
89
+ */
90
90
  declare const createSqsQueue: (client: SqsClientLike, options: SqsQueueOptions) => SqsQueue;
91
91
  export { type SqsClientLike, type SqsMessageLike, SqsQueue, SqsQueueOptions, createSqsQueue };
@@ -1 +1 @@
1
- const a="ApproximateNumberOfMessages",r="ApproximateNumberOfMessagesNotVisible",u=(s,e)=>{if(s===void 0)return 0;const t=Math.ceil((s-e)/1e3);return Math.max(0,t)};class n{#e;#t;#s;#i;constructor(e,t){this.#e=e,this.#t=t.queueUrl,this.#s=t.visibilityTimeout??30,this.#i=t.waitTimeSeconds??0}async enqueue(e,t){const i=u(t?.scheduledAt,Date.now());if(i>900)throw new RangeError(`SQS supports a maximum scheduling delay of ${String(900)}s (15 minutes); use a scheduler for longer delays`);return(await this.#e.sendMessage({DelaySeconds:i,MessageBody:JSON.stringify(e),QueueUrl:this.#t})).MessageId??""}async reserve(){const e=(await this.#e.receiveMessage({AttributeNames:["ApproximateReceiveCount"],MaxNumberOfMessages:1,QueueUrl:this.#t,VisibilityTimeout:this.#s,WaitTimeSeconds:this.#i})).Messages?.[0];if(!e?.ReceiptHandle)return;const t=Number(e.Attributes?.ApproximateReceiveCount??"1");let i;try{i=JSON.parse(e.Body??"{}")}catch{await this.#e.deleteMessage({QueueUrl:this.#t,ReceiptHandle:e.ReceiptHandle});return}return{attempts:Math.max(0,t-1),id:e.ReceiptHandle,message:i,scheduledAt:0}}async ack(e){await this.#e.deleteMessage({QueueUrl:this.#t,ReceiptHandle:e})}async retry(e,t=0){await this.#e.changeMessageVisibility({QueueUrl:this.#t,ReceiptHandle:e,VisibilityTimeout:Math.min(900,Math.max(0,Math.ceil(t/1e3)))})}async size(){const e=await this.#e.getQueueAttributes({AttributeNames:[a,r],QueueUrl:this.#t});return Number(e.Attributes?.[a]??0)+Number(e.Attributes?.[r]??0)}}const c=(s,e)=>new n(s,e);export{n as SqsQueue,c as createSqsQueue};
1
+ const a="ApproximateNumberOfMessages",r="ApproximateNumberOfMessagesNotVisible",u=(s,e)=>{if(s===void 0)return 0;const t=Math.ceil((s-e)/1e3);return Math.max(0,t)};class n{#e;#t;#s;#i;constructor(e,t){this.#e=e,this.#t=t.queueUrl,this.#s=t.visibilityTimeout??30,this.#i=t.waitTimeSeconds??0}async enqueue(e,t){const i=u(t?.scheduledAt,Date.now());if(i>900)throw new RangeError(`SQS supports a maximum scheduling delay of ${String(900)}s (15 minutes); use a scheduler for longer delays`);return(await this.#e.sendMessage({DelaySeconds:i,MessageBody:JSON.stringify(e),QueueUrl:this.#t})).MessageId??""}async reserve(){const e=(await this.#e.receiveMessage({AttributeNames:["ApproximateReceiveCount"],MaxNumberOfMessages:1,QueueUrl:this.#t,VisibilityTimeout:this.#s,WaitTimeSeconds:this.#i})).Messages?.[0];if(!e?.ReceiptHandle)return;const t=Number(e.Attributes?.ApproximateReceiveCount??"1");let i;try{i=JSON.parse(e.Body??"{}")}catch{await this.#e.deleteMessage({QueueUrl:this.#t,ReceiptHandle:e.ReceiptHandle});return}return{attempts:Math.max(1,t),id:e.ReceiptHandle,message:i,scheduledAt:0}}async ack(e){await this.#e.deleteMessage({QueueUrl:this.#t,ReceiptHandle:e})}async retry(e,t=0){await this.#e.changeMessageVisibility({QueueUrl:this.#t,ReceiptHandle:e,VisibilityTimeout:Math.min(900,Math.max(0,Math.ceil(t/1e3)))})}async size(){const e=await this.#e.getQueueAttributes({AttributeNames:[a,r],QueueUrl:this.#t});return Number(e.Attributes?.[a]??0)+Number(e.Attributes?.[r]??0)}}const c=(s,e)=>new n(s,e);export{n as SqsQueue,c as createSqsQueue};
@@ -1,14 +1,21 @@
1
1
  import { S as Storage } from "../packem_shared/unstorage.DqlWKU2I.d-CogP3Etw.js";
2
- import { a as NotificationMessage } from "../packem_shared/notification.d-DFCVTods.js";
3
- import { Q as QueueJob, N as NotificationQueue } from "../packem_shared/types.d-67TogK4k.js";
4
- import "../packem_shared/types.d-CximoA8M.js";
5
- import "../packem_shared/types.d-GUzX1jTk.js";
6
- import "../packem_shared/provider.d-BQAGriz6.js";
2
+ import { a as NotificationMessage } from "../packem_shared/notification.d-D0ado_cy.js";
3
+ import { Q as QueueJob, N as NotificationQueue } from "../packem_shared/types.d-r8K0ICyx.js";
4
+ import "../packem_shared/types.d-CRs03TYV.js";
5
+ import "../packem_shared/types.d-C7l7qdMG.js";
6
+ import "../packem_shared/provider.d-Dh32nRm9.js";
7
7
  /**
8
- * A {@link NotificationQueue} backed by an [unstorage](https://unstorage.unjs.io) driver,
9
- * giving durable, multi-backend persistence (Redis, filesystem, KV, ...). `unstorage` is
10
- * an optional peer dependency — pass a configured `Storage` instance.
11
- */
8
+ * A {@link NotificationQueue} backed by an [unstorage](https://unstorage.unjs.io) driver,
9
+ * giving durable, multi-backend persistence (Redis, filesystem, KV, ...). `unstorage` is
10
+ * an optional peer dependency — pass a configured `Storage` instance.
11
+ *
12
+ * Each job is a single self-contained document keyed by the configured prefix followed by `:job:` and the job id;
13
+ * there is no shared pending index, so concurrent `enqueue`s cannot lose-update each other.
14
+ * `reserve` scans the job documents under the prefix for the next due, unreserved job and
15
+ * marks it reserved. Individual reads/writes are still not transactional, so two workers
16
+ * racing `reserve` on the *same* job can both take it (double delivery); for that level of
17
+ * contention prefer a store with atomic guarantees, or reserve from one instance.
18
+ */
12
19
  declare class UnstorageQueue implements NotificationQueue {
13
20
  #private;
14
21
  constructor(storage: Storage, prefix?: string);
@@ -21,10 +28,10 @@ declare class UnstorageQueue implements NotificationQueue {
21
28
  size(): Promise<number>;
22
29
  }
23
30
  /**
24
- * Convenience factory for {@link UnstorageQueue}.
25
- * @param storage A configured unstorage `Storage` instance.
26
- * @param prefix Key prefix under which jobs are stored.
27
- * @returns A new {@link UnstorageQueue}.
28
- */
31
+ * Convenience factory for {@link UnstorageQueue}.
32
+ * @param storage A configured unstorage `Storage` instance.
33
+ * @param prefix Key prefix under which jobs are stored.
34
+ * @returns A new {@link UnstorageQueue}.
35
+ */
29
36
  declare const createUnstorageQueue: (storage: Storage, prefix?: string) => UnstorageQueue;
30
37
  export { UnstorageQueue, createUnstorageQueue };
@@ -1 +1 @@
1
- import{n as h}from"../packem_shared/id-C_FRCsUM.js";class c{#t;#e;constructor(t,s="notification:queue"){this.#t=t,this.#e=s}async enqueue(t,s){const e={attempts:0,id:h("job"),message:t,scheduledAt:s?.scheduledAt};return await this.#t.setItem(this.#s(e.id),e),await this.#n(e.id),e.id}async reserve(){const t=Date.now(),s=await this.#i();for(const e of s){const i=await this.#t.getItem(this.#s(e));if(i&&(i.scheduledAt??0)<=t)return i.attempts+=1,await this.#t.setItem(this.#s(e),i),await this.#a(s.filter(n=>n!==e)),i}}async ack(t){await this.#t.removeItem(this.#s(t))}async retry(t,s=0){const e=await this.#t.getItem(this.#s(t));e&&(e.scheduledAt=Date.now()+s,await this.#t.setItem(this.#s(t),e),await this.#n(t))}async size(){return(await this.#i()).length}#s(t){return`${this.#e}:job:${t}`}async#i(){return await this.#t.getItem(`${this.#e}:pending`)??[]}async#a(t){await this.#t.setItem(`${this.#e}:pending`,t)}async#n(t){const s=await this.#i();s.includes(t)||(s.push(t),await this.#a(s))}}const o=(a,t)=>new c(a,t);export{c as UnstorageQueue,o as createUnstorageQueue};
1
+ import{n as r}from"../packem_shared/id-C_FRCsUM.js";class n{#t;#a;constructor(t,e="notification:queue"){this.#t=t,this.#a=e}async enqueue(t,e){const s={attempts:0,id:r("job"),message:t,scheduledAt:e?.scheduledAt};return await this.#t.setItem(this.#e(s.id),s),s.id}async reserve(){const t=Date.now(),e=await this.#t.getKeys(this.#s());for(const s of e){const a=await this.#t.getItem(s);if(a&&!a.reserved&&(a.scheduledAt??0)<=t)return a.attempts+=1,a.reserved=!0,await this.#t.setItem(s,a),{attempts:a.attempts,id:a.id,message:a.message,scheduledAt:a.scheduledAt}}}async ack(t){await this.#t.removeItem(this.#e(t))}async retry(t,e=0){const s=await this.#t.getItem(this.#e(t));s&&(s.scheduledAt=Date.now()+e,s.reserved=!1,await this.#t.setItem(this.#e(t),s))}async size(){const t=await this.#t.getKeys(this.#s());return(await Promise.all(t.map(async e=>this.#t.getItem(e)))).filter(e=>e!==null&&!e.reserved).length}#s(){return`${this.#a}:job:`}#e(t){return`${this.#s()}${t}`}}const c=(i,t)=>new n(i,t);export{n as UnstorageQueue,c as createUnstorageQueue};
@@ -1,35 +1,35 @@
1
- import { C as ChannelPayloadMap, N as Notification, a as NotificationMessage } from "../packem_shared/notification.d-DFCVTods.js";
2
- import { C as ChannelType, M as MaybePromise, c as Receipt } from "../packem_shared/types.d-GUzX1jTk.js";
3
- import "../packem_shared/types.d-CximoA8M.js";
4
- import "../packem_shared/provider.d-BQAGriz6.js";
1
+ import { C as ChannelPayloadMap, N as Notification, a as NotificationMessage } from "../packem_shared/notification.d-D0ado_cy.js";
2
+ import { C as ChannelType, M as MaybePromise, c as Receipt } from "../packem_shared/types.d-C7l7qdMG.js";
3
+ import "../packem_shared/types.d-CRs03TYV.js";
4
+ import "../packem_shared/provider.d-Dh32nRm9.js";
5
5
  /**
6
- * A gate decides whether a channel should be attempted for a given payload. Use it for
7
- * preferences, capability checks, send-windows or arbitrary conditions.
8
- */
6
+ * A gate decides whether a channel should be attempted for a given payload. Use it for
7
+ * preferences, capability checks, send-windows or arbitrary conditions.
8
+ */
9
9
  type ChannelGate = (channel: ChannelType, payload: ChannelPayloadMap[ChannelType]) => MaybePromise<boolean>;
10
10
  interface RouteOptions {
11
11
  /**
12
- * Optional gate run before each channel send. Returning false skips the channel.
13
- */
12
+ * Optional gate run before each channel send. Returning false skips the channel.
13
+ */
14
14
  gate?: ChannelGate;
15
15
  /**
16
- * `"best-of"` (default) sends in `order` and stops at the first success;
17
- * `"all"` broadcasts to every present, gated channel in parallel.
18
- */
16
+ * `"best-of"` (default) sends in `order` and stops at the first success;
17
+ * `"all"` broadcasts to every present, gated channel in parallel.
18
+ */
19
19
  mode?: "all" | "best-of";
20
20
  /**
21
- * Channel priority order. Channels absent from the message are skipped; channels in
22
- * the message but absent from `order` are appended in object order.
23
- */
21
+ * Channel priority order. Channels absent from the message are skipped; channels in
22
+ * the message but absent from `order` are appended in object order.
23
+ */
24
24
  order?: ChannelType[];
25
25
  }
26
26
  /**
27
- * Routes a multi-channel message across channels with a priority order and an optional
28
- * gate. `"best-of"` stops at the first success (channel fallback); `"all"` broadcasts.
29
- * @param notification The facade used to send.
30
- * @param message The multi-channel message.
31
- * @param options Routing options.
32
- * @returns The receipts produced (one per attempted channel).
33
- */
27
+ * Routes a multi-channel message across channels with a priority order and an optional
28
+ * gate. `"best-of"` stops at the first success (channel fallback); `"all"` broadcasts.
29
+ * @param notification The facade used to send.
30
+ * @param message The multi-channel message.
31
+ * @param options Routing options.
32
+ * @returns The receipts produced (one per attempted channel).
33
+ */
34
34
  declare const route: (notification: Notification, message: NotificationMessage, options?: RouteOptions) => Promise<Receipt[]>;
35
35
  export { ChannelGate, RouteOptions, route };