notifkit 0.1.19 → 0.1.21
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/README.md +12 -0
- package/dist/{bootstrap-CHOj1rDv.mjs → bootstrap-CMvnVD4U.mjs} +1 -1
- package/dist/{bulk-CAsYwF-9.mjs → bulk-BmWBGhJk.mjs} +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +1 -1
- package/dist/{main-CBeKd8wJ.mjs → main-7IdXmQMM.mjs} +3 -3
- package/dist/{main-CYxNbgX5.mjs → main-BCrlCpfe.mjs} +1 -1
- package/dist/{main-CVTZoGzA.mjs → main-BOEynO9b.mjs} +2 -2
- package/dist/{main-BDTDp4Bg.mjs → main-CJDYKyaG.mjs} +2 -2
- package/dist/{main-B88bnGHO.mjs → main-D89J5XfV.mjs} +2 -2
- package/dist/{main-C9ekO6RS.mjs → main-D98LrZGy.mjs} +3 -3
- package/dist/{main-CcGiccDe.mjs → main-DQgurSqs.mjs} +3 -3
- package/dist/{main-DGF3WtFw.mjs → main-DT9xv7mb.mjs} +6 -5
- package/dist/{schedule-or-dispatch-BF85qhMh.mjs → schedule-or-dispatch-Dr5JygAf.mjs} +1 -1
- package/dist/{src-aiRAj2xr.mjs → src-B3Yy7ryU.mjs} +36 -21
- package/package.json +1 -1
- package/src/contracts/sdk.ts +24 -10
- package/src/server.ts +10 -0
- package/src/services/delivery/main.ts +4 -1
- package/src/services/delivery/throttle.ts +2 -1
- package/src/transport/index.ts +2 -0
package/README.md
CHANGED
|
@@ -10,6 +10,10 @@ Self-hosted notification infrastructure for product notifications. One API call
|
|
|
10
10
|
|
|
11
11
|
[Documentation](https://notifkit.dev/docs/) · [Quickstart](https://notifkit.dev/docs/quickstart.html) · [Examples](https://notifkit.dev/docs/examples.html) · [Production support](#production-support) · [notifkit.dev](https://notifkit.dev)
|
|
12
12
|
|
|
13
|
+
https://github.com/user-attachments/assets/ad8955bd-4205-4d47-8dfc-9010abd3ad62
|
|
14
|
+
|
|
15
|
+
(what it does)
|
|
16
|
+
|
|
13
17
|
</div>
|
|
14
18
|
|
|
15
19
|
Like Knock or Courier, except it runs on the PostgreSQL and Redis you already have, your workflows live in your code, and there is no per-message bill.
|
|
@@ -92,6 +96,8 @@ Longer comparisons: [Novu](https://notifkit.dev/docs/vs/novu.html) · [Knock](ht
|
|
|
92
96
|
Bring your own provider accounts. First-party packages:
|
|
93
97
|
|
|
94
98
|
- [`@notifkit/provider-resend`](./packages/provider-resend): transactional email via Resend
|
|
99
|
+
- [`@notifkit/provider-smtp`](./packages/provider-smtp): email through any SMTP server, via nodemailer
|
|
100
|
+
- [`@notifkit/provider-ses`](./packages/provider-ses): email via AWS SES (sending only; bounces not handled yet)
|
|
95
101
|
- [`@notifkit/provider-fcm`](./packages/provider-fcm): push notifications via Firebase Cloud Messaging
|
|
96
102
|
- [`@notifkit/provider-twilio`](./packages/provider-twilio): SMS via Twilio, with signature-verified delivery status callbacks
|
|
97
103
|
- [`@notifkit/provider-slack`](./packages/provider-slack): Slack messages via Incoming Webhooks or the Web API
|
|
@@ -155,6 +161,12 @@ The test suite starts its own PostgreSQL and Redis containers, so Docker is the
|
|
|
155
161
|
|
|
156
162
|
Questions, bugs, or ideas: [contact.devkitshq@gmail.com](mailto:contact.devkitshq@gmail.com), or open an issue. If notifkit saved you from building notification plumbing, a [star](https://github.com/devkitshq/notifkit) helps other developers find it.
|
|
157
163
|
|
|
164
|
+
## Contributors
|
|
165
|
+
|
|
166
|
+
<a href="https://github.com/devkitshq/notifkit/graphs/contributors">
|
|
167
|
+
<img src="https://contrib.rocks/image?repo=devkitshq/notifkit" alt="Contributors" />
|
|
168
|
+
</a>
|
|
169
|
+
|
|
158
170
|
## License
|
|
159
171
|
|
|
160
172
|
MIT. Use it for anything, including commercially. Every feature is in this repository: there is no paid edition and no hosted tier.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $t as STREAMS, G as StreamConsumer, K as StreamProducer, L as RedisClient, Q as createDatabase, W as PendingMessageScanner, Y as createLogger } from "./src-
|
|
1
|
+
import { $t as STREAMS, G as StreamConsumer, K as StreamProducer, L as RedisClient, Q as createDatabase, W as PendingMessageScanner, Y as createLogger } from "./src-B3Yy7ryU.mjs";
|
|
2
2
|
//#region src/workers/bootstrap.ts
|
|
3
3
|
/** Logger, shared Redis connection and Postgres pool for one service. */
|
|
4
4
|
function createWorkerRuntime(config, name, loggerName = name) {
|
package/dist/index.d.mts
CHANGED
|
@@ -4795,6 +4795,8 @@ interface Transport {
|
|
|
4795
4795
|
windowSeconds: number;
|
|
4796
4796
|
};
|
|
4797
4797
|
send(task: NotificationDispatchedPayload): Promise<DeliveryResult>;
|
|
4798
|
+
/** Releases held connections. `NotifkitServer.stop()` calls it after delivery stops. */
|
|
4799
|
+
close?: () => void | Promise<void>;
|
|
4798
4800
|
webhookPath?: string;
|
|
4799
4801
|
/**
|
|
4800
4802
|
* Handles the one-time GET verification handshake some providers require
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as migrateDatabase, $t as STREAMS, A as LUA_COUNT_REQUEST, At as AddUserSchema, B as ApiRateLimiter, Bt as TemplateSchema, C as SegmentRepository, Cn as BatchProcessor, Ct as NotificationScheduledPayloadSchema, D as ContactRepository, Dn as LRUCache, Dt as NotificationRequestedPayloadSchema, E as TemplateRepository, En as normaliseTarget, Et as NotificationCreatedPayloadSchema, F as LUA_USER_THROTTLE, Ft as InlineUserSchema, G as StreamConsumer, Gt as WorkflowNotifyPayloadSchema, H as UserThrottle, Ht as UpdateProjectSchema, I as Redis, It as NotifyRequestSchema, J as metrics, Jt as CONSUMER_GROUPS, K as StreamProducer, Kt as WorkflowStepSchema, L as RedisClient, Lt as PreferencesSchema, M as LUA_RELEASE_LOCK, Mt as ContactChannelSchema, N as LUA_RENEW_LOCK, Nt as CreateWorkflowSchema, O as PreferenceRepository, On as globalEmitter, Ot as NotificationTargetSchema, P as LUA_SCHEDULER_POLL, Pt as IngestEventSchema, Q as createDatabase, Qt as PUBSUB_CHANNELS, R as redactUrl, Rt as QuietHoursSchema, S as AdminUserRepository, Sn as CircuitBreaker, St as RenderedContentSchema, T as ProjectRepository, Tn as getPriorityBucket, Tt as RecipientProfileSchema, U as ProjectSettingsCache, Ut as UpdateUserSchema, V as calculateTokenBatchSize, Vt as TriggerWorkflowSchema, W as PendingMessageScanner, Wt as UserContactInputSchema, X as IdempotencyGuard, Xt as INBOUND_STREAMS, Y as createLogger, Yt as ENRICHED_STREAMS, Z as assertTablesInSchema, Zt as OUTBOUND_STREAMS, _ as TemplateCache, _n as AppError, _t as NotificationSkippedPayloadSchema, a as SuspendExecutionError, an as EventMetadataSchema, b as interpolate, bn as sleep, bt as DeliveryOptionsSchema, c as BaseWorker, cn as NotificationStatusSchema, d as startHealthReporter, dn as getAiConfig, en as EventEnvelopeSchema, et as notifkitTableNames, f as buildUnsubscribeHeaders, fn as loadEnv, g as transportRegistry, gn as setGlobalConfig, gt as NotificationCanceledPayloadSchema, h as registerTransport, hn as setAiConfig, ht as NotificationAiPendingPayloadSchema, i as workflowRegistry, in as registry, j as LUA_LEASE_API_RATE_LIMIT, jt as BatchAddContactsSchema, k as UserRepository, kt as AddContactSchema, l as LockHeldError, ln as AI_DEFAULTS, m as verifyUnsubscribeToken, mn as readBaseConfig, n as NotifkitClient, nn as StreamEventSchema, nt as runMigrations, o as buildStepNotifyPayload, on as NotificationChannelSchema, p as signUnsubscribeToken, pn as parseConfig, q as getMetricsRegistry, qt as buildStreamEvent, r as workflow, rn as EventRegistry, s as resolveStepTarget, sn as NotificationPrioritySchema, t as NotifkitServer, tn as StreamEventMetadataSchema, tt as qualifyMigrationSql, u as NonRetryableError, un as baseConfigSchema, v as escapeHeader, vn as ValidationError, vt as NotificationFailedPayloadSchema, w as WorkflowRepository, wn as AsyncSemaphore, wt as NotificationEnrichedPayloadSchema, x as renderWithTemplate, xn as DataLoader, xt as NotificationDispatchedPayloadSchema, y as escapeHtml, yn as generateId, yt as NotificationDeliveredPayloadSchema, z as registerCustomCommands, zt as SyncTemplatesSchema } from "./src-
|
|
1
|
+
import { $ as migrateDatabase, $t as STREAMS, A as LUA_COUNT_REQUEST, At as AddUserSchema, B as ApiRateLimiter, Bt as TemplateSchema, C as SegmentRepository, Cn as BatchProcessor, Ct as NotificationScheduledPayloadSchema, D as ContactRepository, Dn as LRUCache, Dt as NotificationRequestedPayloadSchema, E as TemplateRepository, En as normaliseTarget, Et as NotificationCreatedPayloadSchema, F as LUA_USER_THROTTLE, Ft as InlineUserSchema, G as StreamConsumer, Gt as WorkflowNotifyPayloadSchema, H as UserThrottle, Ht as UpdateProjectSchema, I as Redis, It as NotifyRequestSchema, J as metrics, Jt as CONSUMER_GROUPS, K as StreamProducer, Kt as WorkflowStepSchema, L as RedisClient, Lt as PreferencesSchema, M as LUA_RELEASE_LOCK, Mt as ContactChannelSchema, N as LUA_RENEW_LOCK, Nt as CreateWorkflowSchema, O as PreferenceRepository, On as globalEmitter, Ot as NotificationTargetSchema, P as LUA_SCHEDULER_POLL, Pt as IngestEventSchema, Q as createDatabase, Qt as PUBSUB_CHANNELS, R as redactUrl, Rt as QuietHoursSchema, S as AdminUserRepository, Sn as CircuitBreaker, St as RenderedContentSchema, T as ProjectRepository, Tn as getPriorityBucket, Tt as RecipientProfileSchema, U as ProjectSettingsCache, Ut as UpdateUserSchema, V as calculateTokenBatchSize, Vt as TriggerWorkflowSchema, W as PendingMessageScanner, Wt as UserContactInputSchema, X as IdempotencyGuard, Xt as INBOUND_STREAMS, Y as createLogger, Yt as ENRICHED_STREAMS, Z as assertTablesInSchema, Zt as OUTBOUND_STREAMS, _ as TemplateCache, _n as AppError, _t as NotificationSkippedPayloadSchema, a as SuspendExecutionError, an as EventMetadataSchema, b as interpolate, bn as sleep, bt as DeliveryOptionsSchema, c as BaseWorker, cn as NotificationStatusSchema, d as startHealthReporter, dn as getAiConfig, en as EventEnvelopeSchema, et as notifkitTableNames, f as buildUnsubscribeHeaders, fn as loadEnv, g as transportRegistry, gn as setGlobalConfig, gt as NotificationCanceledPayloadSchema, h as registerTransport, hn as setAiConfig, ht as NotificationAiPendingPayloadSchema, i as workflowRegistry, in as registry, j as LUA_LEASE_API_RATE_LIMIT, jt as BatchAddContactsSchema, k as UserRepository, kt as AddContactSchema, l as LockHeldError, ln as AI_DEFAULTS, m as verifyUnsubscribeToken, mn as readBaseConfig, n as NotifkitClient, nn as StreamEventSchema, nt as runMigrations, o as buildStepNotifyPayload, on as NotificationChannelSchema, p as signUnsubscribeToken, pn as parseConfig, q as getMetricsRegistry, qt as buildStreamEvent, r as workflow, rn as EventRegistry, s as resolveStepTarget, sn as NotificationPrioritySchema, t as NotifkitServer, tn as StreamEventMetadataSchema, tt as qualifyMigrationSql, u as NonRetryableError, un as baseConfigSchema, v as escapeHeader, vn as ValidationError, vt as NotificationFailedPayloadSchema, w as WorkflowRepository, wn as AsyncSemaphore, wt as NotificationEnrichedPayloadSchema, x as renderWithTemplate, xn as DataLoader, xt as NotificationDispatchedPayloadSchema, y as escapeHtml, yn as generateId, yt as NotificationDeliveredPayloadSchema, z as registerCustomCommands, zt as SyncTemplatesSchema } from "./src-B3Yy7ryU.mjs";
|
|
2
2
|
export { AI_DEFAULTS, AddContactSchema, AddUserSchema, AdminUserRepository, ApiRateLimiter, AppError, AsyncSemaphore, BaseWorker, BatchAddContactsSchema, BatchProcessor, CONSUMER_GROUPS, CircuitBreaker, ContactChannelSchema, ContactRepository, CreateWorkflowSchema, DataLoader, DeliveryOptionsSchema, ENRICHED_STREAMS, EventEnvelopeSchema, EventMetadataSchema, EventRegistry, INBOUND_STREAMS, IdempotencyGuard, IngestEventSchema, InlineUserSchema, LRUCache, LUA_COUNT_REQUEST, LUA_LEASE_API_RATE_LIMIT, LUA_RELEASE_LOCK, LUA_RENEW_LOCK, LUA_SCHEDULER_POLL, LUA_USER_THROTTLE, LockHeldError, NonRetryableError, NotificationAiPendingPayloadSchema, NotificationCanceledPayloadSchema, NotificationChannelSchema, NotificationCreatedPayloadSchema, NotificationDeliveredPayloadSchema, NotificationDispatchedPayloadSchema, NotificationEnrichedPayloadSchema, NotificationFailedPayloadSchema, NotificationPrioritySchema, NotificationRequestedPayloadSchema, NotificationScheduledPayloadSchema, NotificationSkippedPayloadSchema, NotificationStatusSchema, NotificationTargetSchema, NotifkitClient, NotifkitServer, NotifyRequestSchema, OUTBOUND_STREAMS, PUBSUB_CHANNELS, PendingMessageScanner, PreferenceRepository, PreferencesSchema, ProjectRepository, ProjectSettingsCache, QuietHoursSchema, RecipientProfileSchema, Redis, RedisClient, RenderedContentSchema, STREAMS, SegmentRepository, StreamConsumer, StreamEventMetadataSchema, StreamEventSchema, StreamProducer, SuspendExecutionError, SyncTemplatesSchema, TemplateCache, TemplateRepository, TemplateSchema, TriggerWorkflowSchema, UpdateProjectSchema, UpdateUserSchema, UserContactInputSchema, UserRepository, UserThrottle, ValidationError, WorkflowNotifyPayloadSchema, WorkflowRepository, WorkflowStepSchema, assertTablesInSchema, baseConfigSchema, buildStepNotifyPayload, buildStreamEvent, buildUnsubscribeHeaders, calculateTokenBatchSize, createDatabase, createLogger, escapeHeader, escapeHtml, generateId, getAiConfig, getMetricsRegistry, getPriorityBucket, globalEmitter, interpolate, loadEnv, metrics, migrateDatabase, normaliseTarget, notifkitTableNames, parseConfig, qualifyMigrationSql, readBaseConfig, redactUrl, registerCustomCommands, registerTransport, registry, renderWithTemplate, resolveStepTarget, runMigrations, setAiConfig, setGlobalConfig, signUnsubscribeToken, sleep, startHealthReporter, transportRegistry, verifyUnsubscribeToken, workflow, workflowRegistry };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $t as STREAMS, Jt as CONSUMER_GROUPS, K as StreamProducer, c as BaseWorker, d as startHealthReporter, fn as loadEnv, ft as workflowInstances, mn as readBaseConfig, mt as workflowWaiters, pt as workflowSteps, qt as buildStreamEvent } from "./src-
|
|
2
|
-
import { a as uniqueConsumerId, i as shutdownWorker, n as createStreamConsumer, r as createWorkerRuntime } from "./bootstrap-
|
|
3
|
-
import { t as insertMessageLogs } from "./bulk-
|
|
1
|
+
import { $t as STREAMS, Jt as CONSUMER_GROUPS, K as StreamProducer, c as BaseWorker, d as startHealthReporter, fn as loadEnv, ft as workflowInstances, mn as readBaseConfig, mt as workflowWaiters, pt as workflowSteps, qt as buildStreamEvent } from "./src-B3Yy7ryU.mjs";
|
|
2
|
+
import { a as uniqueConsumerId, i as shutdownWorker, n as createStreamConsumer, r as createWorkerRuntime } from "./bootstrap-CMvnVD4U.mjs";
|
|
3
|
+
import { t as insertMessageLogs } from "./bulk-BmWBGhJk.mjs";
|
|
4
4
|
import { and, eq, gt, isNull, or } from "drizzle-orm";
|
|
5
5
|
//#region src/services/events/main.ts
|
|
6
6
|
loadEnv();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $t as STREAMS, At as AddUserSchema, B as ApiRateLimiter, C as SegmentRepository, D as ContactRepository, Dn as LRUCache, E as TemplateRepository, En as normaliseTarget, Ht as UpdateProjectSchema, It as NotifyRequestSchema, J as metrics, Jt as CONSUMER_GROUPS, K as StreamProducer, L as RedisClient, Lt as PreferencesSchema, Mt as ContactChannelSchema, Nt as CreateWorkflowSchema, On as globalEmitter, Pt as IngestEventSchema, Q as createDatabase, Qt as PUBSUB_CHANNELS, S as AdminUserRepository, T as ProjectRepository, Tn as getPriorityBucket, Ut as UpdateUserSchema, Vt as TriggerWorkflowSchema, Y as createLogger, at as projectApiKeys, ct as suppressions, dt as workflowDefinitions, fn as loadEnv, g as transportRegistry, it as messageLogs, jt as BatchAddContactsSchema, k as UserRepository, lt as userTopicPreferences, m as verifyUnsubscribeToken, mn as readBaseConfig, ot as projects, q as getMetricsRegistry, qt as buildStreamEvent, rt as deliveryOutbox, st as scheduledPayloads, ut as users, w as WorkflowRepository, zt as SyncTemplatesSchema } from "./src-
|
|
1
|
+
import { $t as STREAMS, At as AddUserSchema, B as ApiRateLimiter, C as SegmentRepository, D as ContactRepository, Dn as LRUCache, E as TemplateRepository, En as normaliseTarget, Ht as UpdateProjectSchema, It as NotifyRequestSchema, J as metrics, Jt as CONSUMER_GROUPS, K as StreamProducer, L as RedisClient, Lt as PreferencesSchema, Mt as ContactChannelSchema, Nt as CreateWorkflowSchema, On as globalEmitter, Pt as IngestEventSchema, Q as createDatabase, Qt as PUBSUB_CHANNELS, S as AdminUserRepository, T as ProjectRepository, Tn as getPriorityBucket, Ut as UpdateUserSchema, Vt as TriggerWorkflowSchema, Y as createLogger, at as projectApiKeys, ct as suppressions, dt as workflowDefinitions, fn as loadEnv, g as transportRegistry, it as messageLogs, jt as BatchAddContactsSchema, k as UserRepository, lt as userTopicPreferences, m as verifyUnsubscribeToken, mn as readBaseConfig, ot as projects, q as getMetricsRegistry, qt as buildStreamEvent, rt as deliveryOutbox, st as scheduledPayloads, ut as users, w as WorkflowRepository, zt as SyncTemplatesSchema } from "./src-B3Yy7ryU.mjs";
|
|
2
2
|
import { dirname, extname, isAbsolute, join, relative, resolve } from "node:path";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { createHash, randomBytes, randomUUID, scrypt, timingSafeEqual } from "node:crypto";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $t as STREAMS, Jt as CONSUMER_GROUPS, K as StreamProducer, a as SuspendExecutionError, c as BaseWorker, d as startHealthReporter, dt as workflowDefinitions, fn as loadEnv, ft as workflowInstances, i as workflowRegistry, mn as readBaseConfig, mt as workflowWaiters, o as buildStepNotifyPayload, pt as workflowSteps, qt as buildStreamEvent } from "./src-
|
|
2
|
-
import { a as uniqueConsumerId, i as shutdownWorker, n as createStreamConsumer, r as createWorkerRuntime } from "./bootstrap-
|
|
1
|
+
import { $t as STREAMS, Jt as CONSUMER_GROUPS, K as StreamProducer, a as SuspendExecutionError, c as BaseWorker, d as startHealthReporter, dt as workflowDefinitions, fn as loadEnv, ft as workflowInstances, i as workflowRegistry, mn as readBaseConfig, mt as workflowWaiters, o as buildStepNotifyPayload, pt as workflowSteps, qt as buildStreamEvent } from "./src-B3Yy7ryU.mjs";
|
|
2
|
+
import { a as uniqueConsumerId, i as shutdownWorker, n as createStreamConsumer, r as createWorkerRuntime } from "./bootstrap-CMvnVD4U.mjs";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { and, eq } from "drizzle-orm";
|
|
5
5
|
//#region src/services/workflow/timers.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $t as STREAMS, D as ContactRepository, E as TemplateRepository, En as normaliseTarget, Jt as CONSUMER_GROUPS, On as globalEmitter, Tn as getPriorityBucket, c as BaseWorker, ct as suppressions, d as startHealthReporter, fn as loadEnv, in as registry, it as messageLogs, k as UserRepository, mn as readBaseConfig, qt as buildStreamEvent, rt as deliveryOutbox, st as scheduledPayloads } from "./src-
|
|
2
|
-
import { a as uniqueConsumerId, i as shutdownWorker, n as createStreamConsumer, r as createWorkerRuntime, t as createPriorityProducers } from "./bootstrap-
|
|
1
|
+
import { $t as STREAMS, D as ContactRepository, E as TemplateRepository, En as normaliseTarget, Jt as CONSUMER_GROUPS, On as globalEmitter, Tn as getPriorityBucket, c as BaseWorker, ct as suppressions, d as startHealthReporter, fn as loadEnv, in as registry, it as messageLogs, k as UserRepository, mn as readBaseConfig, qt as buildStreamEvent, rt as deliveryOutbox, st as scheduledPayloads } from "./src-B3Yy7ryU.mjs";
|
|
2
|
+
import { a as uniqueConsumerId, i as shutdownWorker, n as createStreamConsumer, r as createWorkerRuntime, t as createPriorityProducers } from "./bootstrap-CMvnVD4U.mjs";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
import { and, asc, eq, gt, inArray, or, sql } from "drizzle-orm";
|
|
5
5
|
//#region src/services/scheduler/send-gate.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as ContactRepository, E as TemplateRepository, Jt as CONSUMER_GROUPS, On as globalEmitter, Tn as getPriorityBucket, X as IdempotencyGuard, Xt as INBOUND_STREAMS, _ as TemplateCache, c as BaseWorker, d as startHealthReporter, fn as loadEnv, in as registry, k as UserRepository, mn as readBaseConfig, qt as buildStreamEvent } from "./src-
|
|
2
|
-
import { a as uniqueConsumerId, i as shutdownWorker, n as createStreamConsumer, r as createWorkerRuntime, t as createPriorityProducers } from "./bootstrap-
|
|
1
|
+
import { D as ContactRepository, E as TemplateRepository, Jt as CONSUMER_GROUPS, On as globalEmitter, Tn as getPriorityBucket, X as IdempotencyGuard, Xt as INBOUND_STREAMS, _ as TemplateCache, c as BaseWorker, d as startHealthReporter, fn as loadEnv, in as registry, k as UserRepository, mn as readBaseConfig, qt as buildStreamEvent } from "./src-B3Yy7ryU.mjs";
|
|
2
|
+
import { a as uniqueConsumerId, i as shutdownWorker, n as createStreamConsumer, r as createWorkerRuntime, t as createPriorityProducers } from "./bootstrap-CMvnVD4U.mjs";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
//#region src/services/enricher/main.ts
|
|
5
5
|
loadEnv();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $t as STREAMS, E as TemplateRepository, Jt as CONSUMER_GROUPS, K as StreamProducer, On as globalEmitter, Qt as PUBSUB_CHANNELS, R as redactUrl, X as IdempotencyGuard, _ as TemplateCache, c as BaseWorker, d as startHealthReporter, dn as getAiConfig, fn as loadEnv, in as registry, ln as AI_DEFAULTS, mn as readBaseConfig, x as renderWithTemplate } from "./src-
|
|
2
|
-
import { t as scheduleOrDispatch } from "./schedule-or-dispatch-
|
|
3
|
-
import { a as uniqueConsumerId, i as shutdownWorker, n as createStreamConsumer, r as createWorkerRuntime, t as createPriorityProducers } from "./bootstrap-
|
|
1
|
+
import { $t as STREAMS, E as TemplateRepository, Jt as CONSUMER_GROUPS, K as StreamProducer, On as globalEmitter, Qt as PUBSUB_CHANNELS, R as redactUrl, X as IdempotencyGuard, _ as TemplateCache, c as BaseWorker, d as startHealthReporter, dn as getAiConfig, fn as loadEnv, in as registry, ln as AI_DEFAULTS, mn as readBaseConfig, x as renderWithTemplate } from "./src-B3Yy7ryU.mjs";
|
|
2
|
+
import { t as scheduleOrDispatch } from "./schedule-or-dispatch-Dr5JygAf.mjs";
|
|
3
|
+
import { a as uniqueConsumerId, i as shutdownWorker, n as createStreamConsumer, r as createWorkerRuntime, t as createPriorityProducers } from "./bootstrap-CMvnVD4U.mjs";
|
|
4
4
|
import { generateText } from "ai";
|
|
5
5
|
//#region src/services/ai/main.ts
|
|
6
6
|
loadEnv();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $t as STREAMS, D as ContactRepository, Dn as LRUCache, E as TemplateRepository, En as normaliseTarget, H as UserThrottle, Jt as CONSUMER_GROUPS, K as StreamProducer, On as globalEmitter, Qt as PUBSUB_CHANNELS, T as ProjectRepository, U as ProjectSettingsCache, X as IdempotencyGuard, Yt as ENRICHED_STREAMS, _ as TemplateCache, c as BaseWorker, ct as suppressions, d as startHealthReporter, f as buildUnsubscribeHeaders, fn as loadEnv, in as registry, mn as readBaseConfig, qt as buildStreamEvent, xn as DataLoader } from "./src-
|
|
2
|
-
import { t as scheduleOrDispatch } from "./schedule-or-dispatch-
|
|
3
|
-
import { a as uniqueConsumerId, i as shutdownWorker, n as createStreamConsumer, r as createWorkerRuntime, t as createPriorityProducers } from "./bootstrap-
|
|
1
|
+
import { $t as STREAMS, D as ContactRepository, Dn as LRUCache, E as TemplateRepository, En as normaliseTarget, H as UserThrottle, Jt as CONSUMER_GROUPS, K as StreamProducer, On as globalEmitter, Qt as PUBSUB_CHANNELS, T as ProjectRepository, U as ProjectSettingsCache, X as IdempotencyGuard, Yt as ENRICHED_STREAMS, _ as TemplateCache, c as BaseWorker, ct as suppressions, d as startHealthReporter, f as buildUnsubscribeHeaders, fn as loadEnv, in as registry, mn as readBaseConfig, qt as buildStreamEvent, xn as DataLoader } from "./src-B3Yy7ryU.mjs";
|
|
2
|
+
import { t as scheduleOrDispatch } from "./schedule-or-dispatch-Dr5JygAf.mjs";
|
|
3
|
+
import { a as uniqueConsumerId, i as shutdownWorker, n as createStreamConsumer, r as createWorkerRuntime, t as createPriorityProducers } from "./bootstrap-CMvnVD4U.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import { and, eq } from "drizzle-orm";
|
|
6
6
|
//#region src/services/engine/quiet-hours.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $t as STREAMS, B as ApiRateLimiter, Cn as BatchProcessor, D as ContactRepository, E as TemplateRepository, J as metrics, Jt as CONSUMER_GROUPS, K as StreamProducer, On as globalEmitter, Qt as PUBSUB_CHANNELS, Sn as CircuitBreaker, Tn as getPriorityBucket, X as IdempotencyGuard, Zt as OUTBOUND_STREAMS, _ as TemplateCache, c as BaseWorker, d as startHealthReporter, fn as loadEnv, g as transportRegistry, in as registry, mn as readBaseConfig, qt as buildStreamEvent, st as scheduledPayloads, u as NonRetryableError, x as renderWithTemplate } from "./src-
|
|
2
|
-
import { a as uniqueConsumerId, i as shutdownWorker, n as createStreamConsumer, r as createWorkerRuntime, t as createPriorityProducers } from "./bootstrap-
|
|
3
|
-
import { n as upsertOutboxProviderIds } from "./bulk-
|
|
1
|
+
import { $t as STREAMS, B as ApiRateLimiter, Cn as BatchProcessor, D as ContactRepository, E as TemplateRepository, J as metrics, Jt as CONSUMER_GROUPS, K as StreamProducer, On as globalEmitter, Qt as PUBSUB_CHANNELS, Sn as CircuitBreaker, Tn as getPriorityBucket, X as IdempotencyGuard, Zt as OUTBOUND_STREAMS, _ as TemplateCache, c as BaseWorker, d as startHealthReporter, fn as loadEnv, g as transportRegistry, in as registry, mn as readBaseConfig, qt as buildStreamEvent, st as scheduledPayloads, u as NonRetryableError, x as renderWithTemplate } from "./src-B3Yy7ryU.mjs";
|
|
2
|
+
import { a as uniqueConsumerId, i as shutdownWorker, n as createStreamConsumer, r as createWorkerRuntime, t as createPriorityProducers } from "./bootstrap-CMvnVD4U.mjs";
|
|
3
|
+
import { n as upsertOutboxProviderIds } from "./bulk-BmWBGhJk.mjs";
|
|
4
4
|
import { sql } from "drizzle-orm";
|
|
5
5
|
//#region src/services/delivery/live-events.ts
|
|
6
6
|
/**
|
|
@@ -87,7 +87,7 @@ var ProviderThrottle = class {
|
|
|
87
87
|
retryAfterMs: 0
|
|
88
88
|
};
|
|
89
89
|
const retryAfterMs = windowMs - Date.now() % windowMs;
|
|
90
|
-
this.logger?.
|
|
90
|
+
this.logger?.debug({
|
|
91
91
|
channel,
|
|
92
92
|
limit: config.limit,
|
|
93
93
|
windowSeconds: config.windowSeconds,
|
|
@@ -135,7 +135,8 @@ function providerFailure(res) {
|
|
|
135
135
|
return err;
|
|
136
136
|
}
|
|
137
137
|
function retryDelayMs(priorFailures) {
|
|
138
|
-
|
|
138
|
+
const step = RETRY_BACKOFF_MS[Math.min(priorFailures, RETRY_BACKOFF_MS.length - 1)];
|
|
139
|
+
return step + Math.floor(Math.random() * (step / 2));
|
|
139
140
|
}
|
|
140
141
|
var DeliveryWorker = class extends BaseWorker {
|
|
141
142
|
transportRegistry;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Tn as getPriorityBucket, qt as buildStreamEvent, st as scheduledPayloads } from "./src-
|
|
1
|
+
import { Tn as getPriorityBucket, qt as buildStreamEvent, st as scheduledPayloads } from "./src-B3Yy7ryU.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
//#region src/services/engine/schedule-or-dispatch.ts
|
|
4
4
|
/**
|
|
@@ -614,6 +614,10 @@ const TimezoneSchema = z.string().refine((tz) => {
|
|
|
614
614
|
const ContactChannelSchema = NotificationChannelSchema;
|
|
615
615
|
/** Accept a single value or an array; always normalise to a non-empty array. */
|
|
616
616
|
const stringOrArray = z.union([z.string().min(1), z.array(z.string().min(1))]).transform((v) => Array.isArray(v) ? v : [v]);
|
|
617
|
+
const PLAIN_ADDRESS = /^[^\s@<>,;:()"]+@[^\s@<>,;:()"]+$/;
|
|
618
|
+
const EMAIL_TARGET_MESSAGE = "expected one plain email address, e.g. alice@example.com";
|
|
619
|
+
const emailTarget = z.string().regex(PLAIN_ADDRESS, EMAIL_TARGET_MESSAGE);
|
|
620
|
+
const emailOrArray = z.union([emailTarget, z.array(emailTarget)]).transform((v) => Array.isArray(v) ? v : [v]);
|
|
617
621
|
const UserContactInputSchema = z.object({
|
|
618
622
|
channel: ContactChannelSchema,
|
|
619
623
|
target: z.string().min(1),
|
|
@@ -621,6 +625,9 @@ const UserContactInputSchema = z.object({
|
|
|
621
625
|
isPrimary: z.boolean().optional(),
|
|
622
626
|
enabled: z.boolean().optional(),
|
|
623
627
|
preferences: PreferencesSchema.optional()
|
|
628
|
+
}).refine((c) => c.channel !== "email" || PLAIN_ADDRESS.test(c.target), {
|
|
629
|
+
message: EMAIL_TARGET_MESSAGE,
|
|
630
|
+
path: ["target"]
|
|
624
631
|
});
|
|
625
632
|
/**
|
|
626
633
|
* addUser({ id, contacts, email, phone, pushToken, segments, preferences })
|
|
@@ -632,7 +639,7 @@ const AddUserSchema = z.object({
|
|
|
632
639
|
language: z.string().optional(),
|
|
633
640
|
timezone: TimezoneSchema.optional(),
|
|
634
641
|
contacts: z.array(UserContactInputSchema).optional(),
|
|
635
|
-
email:
|
|
642
|
+
email: emailOrArray.optional(),
|
|
636
643
|
phone: stringOrArray.optional(),
|
|
637
644
|
pushToken: stringOrArray.optional(),
|
|
638
645
|
segments: z.array(z.string().min(1)).optional(),
|
|
@@ -643,7 +650,7 @@ const UpdateUserSchema = z.object({
|
|
|
643
650
|
language: z.string().optional(),
|
|
644
651
|
timezone: TimezoneSchema.optional(),
|
|
645
652
|
contacts: z.array(UserContactInputSchema).optional(),
|
|
646
|
-
email:
|
|
653
|
+
email: emailOrArray.optional(),
|
|
647
654
|
phone: stringOrArray.optional(),
|
|
648
655
|
pushToken: stringOrArray.optional(),
|
|
649
656
|
segments: z.array(z.string().min(1)).optional(),
|
|
@@ -4121,35 +4128,35 @@ var NotifkitServer = class extends EventEmitter {
|
|
|
4121
4128
|
}
|
|
4122
4129
|
const startupPromises = [];
|
|
4123
4130
|
if (services.includes("api")) {
|
|
4124
|
-
const { startApiServer } = await import("./main-
|
|
4131
|
+
const { startApiServer } = await import("./main-BCrlCpfe.mjs");
|
|
4125
4132
|
startupPromises.push(startApiServer());
|
|
4126
4133
|
}
|
|
4127
4134
|
if (services.includes("delivery")) {
|
|
4128
|
-
const { startDeliveryWorker } = await import("./main-
|
|
4135
|
+
const { startDeliveryWorker } = await import("./main-DT9xv7mb.mjs");
|
|
4129
4136
|
startupPromises.push(startDeliveryWorker());
|
|
4130
4137
|
}
|
|
4131
4138
|
if (services.includes("engine")) {
|
|
4132
|
-
const { startEngineWorker } = await import("./main-
|
|
4139
|
+
const { startEngineWorker } = await import("./main-DQgurSqs.mjs");
|
|
4133
4140
|
startupPromises.push(startEngineWorker());
|
|
4134
4141
|
}
|
|
4135
4142
|
if (services.includes("enricher")) {
|
|
4136
|
-
const { startEnricherWorker } = await import("./main-
|
|
4143
|
+
const { startEnricherWorker } = await import("./main-D89J5XfV.mjs");
|
|
4137
4144
|
startupPromises.push(startEnricherWorker());
|
|
4138
4145
|
}
|
|
4139
4146
|
if (services.includes("scheduler")) {
|
|
4140
|
-
const { startSchedulerWorker } = await import("./main-
|
|
4147
|
+
const { startSchedulerWorker } = await import("./main-CJDYKyaG.mjs");
|
|
4141
4148
|
startupPromises.push(startSchedulerWorker());
|
|
4142
4149
|
}
|
|
4143
4150
|
if (services.includes("ai")) {
|
|
4144
|
-
const { startAiWorker } = await import("./main-
|
|
4151
|
+
const { startAiWorker } = await import("./main-D98LrZGy.mjs");
|
|
4145
4152
|
startupPromises.push(startAiWorker());
|
|
4146
4153
|
}
|
|
4147
4154
|
if (services.includes("workflow")) {
|
|
4148
|
-
const { startWorkflowWorker } = await import("./main-
|
|
4155
|
+
const { startWorkflowWorker } = await import("./main-BOEynO9b.mjs");
|
|
4149
4156
|
startupPromises.push(startWorkflowWorker());
|
|
4150
4157
|
}
|
|
4151
4158
|
if (services.includes("events")) {
|
|
4152
|
-
const { startEventWorker } = await import("./main-
|
|
4159
|
+
const { startEventWorker } = await import("./main-7IdXmQMM.mjs");
|
|
4153
4160
|
startupPromises.push(startEventWorker());
|
|
4154
4161
|
}
|
|
4155
4162
|
const handleSignal = async (signal) => {
|
|
@@ -4171,9 +4178,9 @@ var NotifkitServer = class extends EventEmitter {
|
|
|
4171
4178
|
await Promise.all(startupPromises);
|
|
4172
4179
|
if (readBaseConfig().PIPELINE_FUSED && services.includes("enricher") && services.includes("engine") && services.includes("delivery")) {
|
|
4173
4180
|
const [{ getEnricherWorker }, { getEngineWorker }, { getDeliveryWorker }] = await Promise.all([
|
|
4174
|
-
import("./main-
|
|
4175
|
-
import("./main-
|
|
4176
|
-
import("./main-
|
|
4181
|
+
import("./main-D89J5XfV.mjs"),
|
|
4182
|
+
import("./main-DQgurSqs.mjs"),
|
|
4183
|
+
import("./main-DT9xv7mb.mjs")
|
|
4177
4184
|
]);
|
|
4178
4185
|
const enricher = getEnricherWorker();
|
|
4179
4186
|
const engine = getEngineWorker();
|
|
@@ -4204,16 +4211,24 @@ var NotifkitServer = class extends EventEmitter {
|
|
|
4204
4211
|
"events"
|
|
4205
4212
|
] : this.options.services;
|
|
4206
4213
|
const shutdownOrder = [
|
|
4207
|
-
["api", async () => (await import("./main-
|
|
4208
|
-
["workflow", async () => (await import("./main-
|
|
4209
|
-
["enricher", async () => (await import("./main-
|
|
4210
|
-
["ai", async () => (await import("./main-
|
|
4211
|
-
["engine", async () => (await import("./main-
|
|
4212
|
-
["scheduler", async () => (await import("./main-
|
|
4213
|
-
["delivery", async () => (await import("./main-
|
|
4214
|
-
["events", async () => (await import("./main-
|
|
4214
|
+
["api", async () => (await import("./main-BCrlCpfe.mjs")).stopApiServer()],
|
|
4215
|
+
["workflow", async () => (await import("./main-BOEynO9b.mjs")).stopWorkflowWorker()],
|
|
4216
|
+
["enricher", async () => (await import("./main-D89J5XfV.mjs")).stopEnricherWorker()],
|
|
4217
|
+
["ai", async () => (await import("./main-D98LrZGy.mjs")).stopAiWorker()],
|
|
4218
|
+
["engine", async () => (await import("./main-DQgurSqs.mjs")).stopEngineWorker()],
|
|
4219
|
+
["scheduler", async () => (await import("./main-CJDYKyaG.mjs")).stopSchedulerWorker()],
|
|
4220
|
+
["delivery", async () => (await import("./main-DT9xv7mb.mjs")).stopDeliveryWorker()],
|
|
4221
|
+
["events", async () => (await import("./main-7IdXmQMM.mjs")).stopEventWorker()]
|
|
4215
4222
|
];
|
|
4216
4223
|
for (const [name, stop] of shutdownOrder) if (services.includes(name)) await stop();
|
|
4224
|
+
for (const provider of this.options.providers ?? []) try {
|
|
4225
|
+
await provider.close?.();
|
|
4226
|
+
} catch (err) {
|
|
4227
|
+
this.logger.warn({
|
|
4228
|
+
err,
|
|
4229
|
+
channel: provider.channel
|
|
4230
|
+
}, "provider close failed");
|
|
4231
|
+
}
|
|
4217
4232
|
if (this.pgContainer) {
|
|
4218
4233
|
this.logger.info("Stopping PostgreSQL container...");
|
|
4219
4234
|
await this.pgContainer.stop();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "notifkit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"description": "Self-hosted notification infrastructure. One call delivers to email, SMS, push, and webhook — routed by preference, quiet hours, and consent.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "devkitshq",
|
package/src/contracts/sdk.ts
CHANGED
|
@@ -47,14 +47,28 @@ const stringOrArray = z
|
|
|
47
47
|
.union([z.string().min(1), z.array(z.string().min(1))])
|
|
48
48
|
.transform((v) => (Array.isArray(v) ? v : [v]));
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
// One plain address: suppressions match the stored target, and a display name or
|
|
51
|
+
// list would also be delivered to every address nodemailer parses out of it.
|
|
52
|
+
const PLAIN_ADDRESS = /^[^\s@<>,;:()"]+@[^\s@<>,;:()"]+$/;
|
|
53
|
+
const EMAIL_TARGET_MESSAGE = "expected one plain email address, e.g. alice@example.com";
|
|
54
|
+
const emailTarget = z.string().regex(PLAIN_ADDRESS, EMAIL_TARGET_MESSAGE);
|
|
55
|
+
const emailOrArray = z
|
|
56
|
+
.union([emailTarget, z.array(emailTarget)])
|
|
57
|
+
.transform((v) => (Array.isArray(v) ? v : [v]));
|
|
58
|
+
|
|
59
|
+
export const UserContactInputSchema = z
|
|
60
|
+
.object({
|
|
61
|
+
channel: ContactChannelSchema,
|
|
62
|
+
target: z.string().min(1),
|
|
63
|
+
label: z.string().optional(),
|
|
64
|
+
isPrimary: z.boolean().optional(),
|
|
65
|
+
enabled: z.boolean().optional(),
|
|
66
|
+
preferences: PreferencesSchema.optional(),
|
|
67
|
+
})
|
|
68
|
+
.refine((c) => c.channel !== "email" || PLAIN_ADDRESS.test(c.target), {
|
|
69
|
+
message: EMAIL_TARGET_MESSAGE,
|
|
70
|
+
path: ["target"],
|
|
71
|
+
});
|
|
58
72
|
export type UserContactInput = z.infer<typeof UserContactInputSchema>;
|
|
59
73
|
|
|
60
74
|
// Users
|
|
@@ -69,7 +83,7 @@ export const AddUserSchema = z.object({
|
|
|
69
83
|
language: z.string().optional(),
|
|
70
84
|
timezone: TimezoneSchema.optional(),
|
|
71
85
|
contacts: z.array(UserContactInputSchema).optional(),
|
|
72
|
-
email:
|
|
86
|
+
email: emailOrArray.optional(),
|
|
73
87
|
phone: stringOrArray.optional(),
|
|
74
88
|
pushToken: stringOrArray.optional(),
|
|
75
89
|
segments: z.array(z.string().min(1)).optional(),
|
|
@@ -82,7 +96,7 @@ export const UpdateUserSchema = z.object({
|
|
|
82
96
|
language: z.string().optional(),
|
|
83
97
|
timezone: TimezoneSchema.optional(),
|
|
84
98
|
contacts: z.array(UserContactInputSchema).optional(),
|
|
85
|
-
email:
|
|
99
|
+
email: emailOrArray.optional(),
|
|
86
100
|
phone: stringOrArray.optional(),
|
|
87
101
|
pushToken: stringOrArray.optional(),
|
|
88
102
|
segments: z.array(z.string().min(1)).optional(),
|
package/src/server.ts
CHANGED
|
@@ -295,6 +295,16 @@ export class NotifkitServer extends EventEmitter {
|
|
|
295
295
|
if (services.includes(name)) await stop();
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
+
// After delivery, so no send is still using them. A pooled SMTP connection
|
|
299
|
+
// would otherwise keep the process alive.
|
|
300
|
+
for (const provider of this.options.providers ?? []) {
|
|
301
|
+
try {
|
|
302
|
+
await provider.close?.();
|
|
303
|
+
} catch (err) {
|
|
304
|
+
this.logger.warn({ err, channel: provider.channel }, "provider close failed");
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
298
308
|
if (this.pgContainer) {
|
|
299
309
|
this.logger.info("Stopping PostgreSQL container...");
|
|
300
310
|
await this.pgContainer.stop();
|
|
@@ -82,7 +82,10 @@ function providerFailure(res: { error?: string; retryable?: boolean }): Error {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
export function retryDelayMs(priorFailures: number): number {
|
|
85
|
-
|
|
85
|
+
const step = RETRY_BACKOFF_MS[Math.min(priorFailures, RETRY_BACKOFF_MS.length - 1)]!;
|
|
86
|
+
// Up to half a step later, never earlier, so a burst that failed together
|
|
87
|
+
// (a provider throttling or down) doesn't come back in the same instant.
|
|
88
|
+
return step + Math.floor(Math.random() * (step / 2));
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
export interface DeliveryWorkerOptions extends WorkerOptions {
|
|
@@ -45,7 +45,8 @@ export class ProviderThrottle {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
const retryAfterMs = windowMs - (Date.now() % windowMs);
|
|
48
|
-
|
|
48
|
+
// Debug, not warn: a big send lands here on every deferral of every task.
|
|
49
|
+
this.logger?.debug(
|
|
49
50
|
{ channel, limit: config.limit, windowSeconds: config.windowSeconds, retryAfterMs },
|
|
50
51
|
"Provider rate limit hit — task must be rescheduled",
|
|
51
52
|
);
|
package/src/transport/index.ts
CHANGED
|
@@ -42,6 +42,8 @@ export interface Transport {
|
|
|
42
42
|
readonly channel: NotificationChannel;
|
|
43
43
|
readonly limits?: { limit: number; windowSeconds: number };
|
|
44
44
|
send(task: NotificationDispatchedPayload): Promise<DeliveryResult>;
|
|
45
|
+
/** Releases held connections. `NotifkitServer.stop()` calls it after delivery stops. */
|
|
46
|
+
close?: () => void | Promise<void>;
|
|
45
47
|
|
|
46
48
|
webhookPath?: string;
|
|
47
49
|
/**
|