notifkit 0.1.18 → 0.1.19
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 +0 -4
- package/dist/{bootstrap-Cs1XIp6b.mjs → bootstrap-CHOj1rDv.mjs} +1 -1
- package/dist/{bulk-4pRIiG2o.mjs → bulk-CAsYwF-9.mjs} +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{main-yL5VinQ5.mjs → main-B88bnGHO.mjs} +2 -2
- package/dist/{main-Ppr7Pq1g.mjs → main-BDTDp4Bg.mjs} +2 -2
- package/dist/{main-Bl0S4GDd.mjs → main-C9ekO6RS.mjs} +3 -3
- package/dist/{main-C5DiM7_r.mjs → main-CBeKd8wJ.mjs} +3 -3
- package/dist/{main-O9iZ6iz2.mjs → main-CVTZoGzA.mjs} +2 -2
- package/dist/{main-zgxAlH3l.mjs → main-CYxNbgX5.mjs} +1 -1
- package/dist/{main-BN7ZfvxN.mjs → main-CcGiccDe.mjs} +3 -3
- package/dist/{main-DVzp0DLn.mjs → main-DGF3WtFw.mjs} +3 -3
- package/dist/{schedule-or-dispatch-BwCZWS_P.mjs → schedule-or-dispatch-BF85qhMh.mjs} +1 -1
- package/dist/{src-C38w4jR4.mjs → src-aiRAj2xr.mjs} +30 -21
- package/package.json +1 -1
- package/src/contracts/sdk.ts +17 -2
package/README.md
CHANGED
|
@@ -10,10 +10,6 @@ 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
|
-
(note: this video is generated using claude)
|
|
16
|
-
|
|
17
13
|
</div>
|
|
18
14
|
|
|
19
15
|
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.
|
|
@@ -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-aiRAj2xr.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.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-aiRAj2xr.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,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-aiRAj2xr.mjs";
|
|
2
|
+
import { a as uniqueConsumerId, i as shutdownWorker, n as createStreamConsumer, r as createWorkerRuntime, t as createPriorityProducers } from "./bootstrap-CHOj1rDv.mjs";
|
|
3
3
|
import { randomUUID } from "node:crypto";
|
|
4
4
|
//#region src/services/enricher/main.ts
|
|
5
5
|
loadEnv();
|
|
@@ -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-aiRAj2xr.mjs";
|
|
2
|
+
import { a as uniqueConsumerId, i as shutdownWorker, n as createStreamConsumer, r as createWorkerRuntime, t as createPriorityProducers } from "./bootstrap-CHOj1rDv.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,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-aiRAj2xr.mjs";
|
|
2
|
+
import { t as scheduleOrDispatch } from "./schedule-or-dispatch-BF85qhMh.mjs";
|
|
3
|
+
import { a as uniqueConsumerId, i as shutdownWorker, n as createStreamConsumer, r as createWorkerRuntime, t as createPriorityProducers } from "./bootstrap-CHOj1rDv.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, 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-aiRAj2xr.mjs";
|
|
2
|
+
import { a as uniqueConsumerId, i as shutdownWorker, n as createStreamConsumer, r as createWorkerRuntime } from "./bootstrap-CHOj1rDv.mjs";
|
|
3
|
+
import { t as insertMessageLogs } from "./bulk-CAsYwF-9.mjs";
|
|
4
4
|
import { and, eq, gt, isNull, or } from "drizzle-orm";
|
|
5
5
|
//#region src/services/events/main.ts
|
|
6
6
|
loadEnv();
|
|
@@ -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-aiRAj2xr.mjs";
|
|
2
|
+
import { a as uniqueConsumerId, i as shutdownWorker, n as createStreamConsumer, r as createWorkerRuntime } from "./bootstrap-CHOj1rDv.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,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-aiRAj2xr.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,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-aiRAj2xr.mjs";
|
|
2
|
+
import { t as scheduleOrDispatch } from "./schedule-or-dispatch-BF85qhMh.mjs";
|
|
3
|
+
import { a as uniqueConsumerId, i as shutdownWorker, n as createStreamConsumer, r as createWorkerRuntime, t as createPriorityProducers } from "./bootstrap-CHOj1rDv.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-aiRAj2xr.mjs";
|
|
2
|
+
import { a as uniqueConsumerId, i as shutdownWorker, n as createStreamConsumer, r as createWorkerRuntime, t as createPriorityProducers } from "./bootstrap-CHOj1rDv.mjs";
|
|
3
|
+
import { n as upsertOutboxProviderIds } from "./bulk-CAsYwF-9.mjs";
|
|
4
4
|
import { sql } from "drizzle-orm";
|
|
5
5
|
//#region src/services/delivery/live-events.ts
|
|
6
6
|
/**
|
|
@@ -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-aiRAj2xr.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
//#region src/services/engine/schedule-or-dispatch.ts
|
|
4
4
|
/**
|
|
@@ -601,6 +601,15 @@ const PreferencesSchema = z.object({
|
|
|
601
601
|
topics: z.record(z.string(), z.boolean()).optional(),
|
|
602
602
|
quietHours: z.array(QuietHoursSchema).optional()
|
|
603
603
|
});
|
|
604
|
+
const TimezoneSchema = z.string().refine((tz) => {
|
|
605
|
+
if (tz !== "UTC" && !tz.includes("/")) return false;
|
|
606
|
+
try {
|
|
607
|
+
new Intl.DateTimeFormat("en-US", { timeZone: tz });
|
|
608
|
+
return true;
|
|
609
|
+
} catch {
|
|
610
|
+
return false;
|
|
611
|
+
}
|
|
612
|
+
}, { message: "expected an IANA timezone, e.g. America/New_York" });
|
|
604
613
|
/** Channels that carry an addressable target (email address, phone, push token, url, chat id). */
|
|
605
614
|
const ContactChannelSchema = NotificationChannelSchema;
|
|
606
615
|
/** Accept a single value or an array; always normalise to a non-empty array. */
|
|
@@ -621,7 +630,7 @@ const UserContactInputSchema = z.object({
|
|
|
621
630
|
const AddUserSchema = z.object({
|
|
622
631
|
id: z.string().min(1),
|
|
623
632
|
language: z.string().optional(),
|
|
624
|
-
timezone:
|
|
633
|
+
timezone: TimezoneSchema.optional(),
|
|
625
634
|
contacts: z.array(UserContactInputSchema).optional(),
|
|
626
635
|
email: stringOrArray.optional(),
|
|
627
636
|
phone: stringOrArray.optional(),
|
|
@@ -632,7 +641,7 @@ const AddUserSchema = z.object({
|
|
|
632
641
|
/** updateUser(id, patch) — every field optional; id comes from the path. */
|
|
633
642
|
const UpdateUserSchema = z.object({
|
|
634
643
|
language: z.string().optional(),
|
|
635
|
-
timezone:
|
|
644
|
+
timezone: TimezoneSchema.optional(),
|
|
636
645
|
contacts: z.array(UserContactInputSchema).optional(),
|
|
637
646
|
email: stringOrArray.optional(),
|
|
638
647
|
phone: stringOrArray.optional(),
|
|
@@ -4112,35 +4121,35 @@ var NotifkitServer = class extends EventEmitter {
|
|
|
4112
4121
|
}
|
|
4113
4122
|
const startupPromises = [];
|
|
4114
4123
|
if (services.includes("api")) {
|
|
4115
|
-
const { startApiServer } = await import("./main-
|
|
4124
|
+
const { startApiServer } = await import("./main-CYxNbgX5.mjs");
|
|
4116
4125
|
startupPromises.push(startApiServer());
|
|
4117
4126
|
}
|
|
4118
4127
|
if (services.includes("delivery")) {
|
|
4119
|
-
const { startDeliveryWorker } = await import("./main-
|
|
4128
|
+
const { startDeliveryWorker } = await import("./main-DGF3WtFw.mjs");
|
|
4120
4129
|
startupPromises.push(startDeliveryWorker());
|
|
4121
4130
|
}
|
|
4122
4131
|
if (services.includes("engine")) {
|
|
4123
|
-
const { startEngineWorker } = await import("./main-
|
|
4132
|
+
const { startEngineWorker } = await import("./main-CcGiccDe.mjs");
|
|
4124
4133
|
startupPromises.push(startEngineWorker());
|
|
4125
4134
|
}
|
|
4126
4135
|
if (services.includes("enricher")) {
|
|
4127
|
-
const { startEnricherWorker } = await import("./main-
|
|
4136
|
+
const { startEnricherWorker } = await import("./main-B88bnGHO.mjs");
|
|
4128
4137
|
startupPromises.push(startEnricherWorker());
|
|
4129
4138
|
}
|
|
4130
4139
|
if (services.includes("scheduler")) {
|
|
4131
|
-
const { startSchedulerWorker } = await import("./main-
|
|
4140
|
+
const { startSchedulerWorker } = await import("./main-BDTDp4Bg.mjs");
|
|
4132
4141
|
startupPromises.push(startSchedulerWorker());
|
|
4133
4142
|
}
|
|
4134
4143
|
if (services.includes("ai")) {
|
|
4135
|
-
const { startAiWorker } = await import("./main-
|
|
4144
|
+
const { startAiWorker } = await import("./main-C9ekO6RS.mjs");
|
|
4136
4145
|
startupPromises.push(startAiWorker());
|
|
4137
4146
|
}
|
|
4138
4147
|
if (services.includes("workflow")) {
|
|
4139
|
-
const { startWorkflowWorker } = await import("./main-
|
|
4148
|
+
const { startWorkflowWorker } = await import("./main-CVTZoGzA.mjs");
|
|
4140
4149
|
startupPromises.push(startWorkflowWorker());
|
|
4141
4150
|
}
|
|
4142
4151
|
if (services.includes("events")) {
|
|
4143
|
-
const { startEventWorker } = await import("./main-
|
|
4152
|
+
const { startEventWorker } = await import("./main-CBeKd8wJ.mjs");
|
|
4144
4153
|
startupPromises.push(startEventWorker());
|
|
4145
4154
|
}
|
|
4146
4155
|
const handleSignal = async (signal) => {
|
|
@@ -4162,9 +4171,9 @@ var NotifkitServer = class extends EventEmitter {
|
|
|
4162
4171
|
await Promise.all(startupPromises);
|
|
4163
4172
|
if (readBaseConfig().PIPELINE_FUSED && services.includes("enricher") && services.includes("engine") && services.includes("delivery")) {
|
|
4164
4173
|
const [{ getEnricherWorker }, { getEngineWorker }, { getDeliveryWorker }] = await Promise.all([
|
|
4165
|
-
import("./main-
|
|
4166
|
-
import("./main-
|
|
4167
|
-
import("./main-
|
|
4174
|
+
import("./main-B88bnGHO.mjs"),
|
|
4175
|
+
import("./main-CcGiccDe.mjs"),
|
|
4176
|
+
import("./main-DGF3WtFw.mjs")
|
|
4168
4177
|
]);
|
|
4169
4178
|
const enricher = getEnricherWorker();
|
|
4170
4179
|
const engine = getEngineWorker();
|
|
@@ -4195,14 +4204,14 @@ var NotifkitServer = class extends EventEmitter {
|
|
|
4195
4204
|
"events"
|
|
4196
4205
|
] : this.options.services;
|
|
4197
4206
|
const shutdownOrder = [
|
|
4198
|
-
["api", async () => (await import("./main-
|
|
4199
|
-
["workflow", async () => (await import("./main-
|
|
4200
|
-
["enricher", async () => (await import("./main-
|
|
4201
|
-
["ai", async () => (await import("./main-
|
|
4202
|
-
["engine", async () => (await import("./main-
|
|
4203
|
-
["scheduler", async () => (await import("./main-
|
|
4204
|
-
["delivery", async () => (await import("./main-
|
|
4205
|
-
["events", async () => (await import("./main-
|
|
4207
|
+
["api", async () => (await import("./main-CYxNbgX5.mjs")).stopApiServer()],
|
|
4208
|
+
["workflow", async () => (await import("./main-CVTZoGzA.mjs")).stopWorkflowWorker()],
|
|
4209
|
+
["enricher", async () => (await import("./main-B88bnGHO.mjs")).stopEnricherWorker()],
|
|
4210
|
+
["ai", async () => (await import("./main-C9ekO6RS.mjs")).stopAiWorker()],
|
|
4211
|
+
["engine", async () => (await import("./main-CcGiccDe.mjs")).stopEngineWorker()],
|
|
4212
|
+
["scheduler", async () => (await import("./main-BDTDp4Bg.mjs")).stopSchedulerWorker()],
|
|
4213
|
+
["delivery", async () => (await import("./main-DGF3WtFw.mjs")).stopDeliveryWorker()],
|
|
4214
|
+
["events", async () => (await import("./main-CBeKd8wJ.mjs")).stopEventWorker()]
|
|
4206
4215
|
];
|
|
4207
4216
|
for (const [name, stop] of shutdownOrder) if (services.includes(name)) await stop();
|
|
4208
4217
|
if (this.pgContainer) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "notifkit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.19",
|
|
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
|
@@ -21,6 +21,21 @@ export const PreferencesSchema = z.object({
|
|
|
21
21
|
});
|
|
22
22
|
export type Preferences = z.infer<typeof PreferencesSchema>;
|
|
23
23
|
|
|
24
|
+
// The quiet-hours engine formats with this zone, so an unknown one would silently skip quiet hours.
|
|
25
|
+
// ICU also accepts ambiguous abbreviations like "IST", so require Area/Location (or UTC).
|
|
26
|
+
const TimezoneSchema = z.string().refine(
|
|
27
|
+
(tz) => {
|
|
28
|
+
if (tz !== "UTC" && !tz.includes("/")) return false;
|
|
29
|
+
try {
|
|
30
|
+
new Intl.DateTimeFormat("en-US", { timeZone: tz });
|
|
31
|
+
return true;
|
|
32
|
+
} catch {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{ message: "expected an IANA timezone, e.g. America/New_York" },
|
|
37
|
+
);
|
|
38
|
+
|
|
24
39
|
// Contacts
|
|
25
40
|
|
|
26
41
|
/** Channels that carry an addressable target (email address, phone, push token, url, chat id). */
|
|
@@ -52,7 +67,7 @@ export type UserContactInput = z.infer<typeof UserContactInputSchema>;
|
|
|
52
67
|
export const AddUserSchema = z.object({
|
|
53
68
|
id: z.string().min(1),
|
|
54
69
|
language: z.string().optional(),
|
|
55
|
-
timezone:
|
|
70
|
+
timezone: TimezoneSchema.optional(),
|
|
56
71
|
contacts: z.array(UserContactInputSchema).optional(),
|
|
57
72
|
email: stringOrArray.optional(),
|
|
58
73
|
phone: stringOrArray.optional(),
|
|
@@ -65,7 +80,7 @@ export type AddUserInput = z.input<typeof AddUserSchema>;
|
|
|
65
80
|
/** updateUser(id, patch) — every field optional; id comes from the path. */
|
|
66
81
|
export const UpdateUserSchema = z.object({
|
|
67
82
|
language: z.string().optional(),
|
|
68
|
-
timezone:
|
|
83
|
+
timezone: TimezoneSchema.optional(),
|
|
69
84
|
contacts: z.array(UserContactInputSchema).optional(),
|
|
70
85
|
email: stringOrArray.optional(),
|
|
71
86
|
phone: stringOrArray.optional(),
|