notifkit 0.1.14 → 0.1.16

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 (89) hide show
  1. package/dashboard/dist/assets/index-C-DJYu0_.css +1 -0
  2. package/dashboard/dist/assets/index-CzFZcEon.js +318 -0
  3. package/dashboard/dist/index.html +2 -2
  4. package/dist/{bootstrap-m107TukN.mjs → bootstrap-BMDRPjgp.mjs} +1 -1
  5. package/dist/{bulk-xAd_biYV.mjs → bulk-CJ5QXiPa.mjs} +1 -1
  6. package/dist/index.d.mts +71 -27
  7. package/dist/index.mjs +2 -2
  8. package/dist/{main-CWIBUEc7.mjs → main-6_bXQBDH.mjs} +21 -41
  9. package/dist/{main-WkxXwP5q.mjs → main-8nP3qmCT.mjs} +29 -49
  10. package/dist/{main-HT5c6jyf.mjs → main-B82bsFoy.mjs} +183 -334
  11. package/dist/{main-C87TSAqM.mjs → main-CpaHF1Zw.mjs} +13 -15
  12. package/dist/{main-DRHL2bst.mjs → main-DULD8-th.mjs} +8 -6
  13. package/dist/{main-D_62f9fH.mjs → main-ZW5RaiOK.mjs} +77 -64
  14. package/dist/{main-5kVwbbnW.mjs → main-g1KEcXXp.mjs} +676 -582
  15. package/dist/{main-C0MjK1Au.mjs → main-mGIT8jv4.mjs} +4 -4
  16. package/dist/schedule-or-dispatch-Cd7GLfc3.mjs +52 -0
  17. package/dist/{src-DYqdD694.mjs → src-BE_EUpZ6.mjs} +93 -93
  18. package/package.json +1 -1
  19. package/scripts/create-admin.mjs +0 -0
  20. package/scripts/create-project.mjs +6 -2
  21. package/scripts/migrate.mjs +0 -0
  22. package/scripts/notifkit.mjs +0 -0
  23. package/src/client.ts +3 -3
  24. package/src/config/index.ts +1 -0
  25. package/src/contracts/common.ts +2 -0
  26. package/src/contracts/envelope.ts +1 -1
  27. package/src/contracts/events/notification-created.ts +2 -0
  28. package/src/contracts/events/notification-delivered.ts +1 -1
  29. package/src/contracts/events/notification-failed.ts +1 -1
  30. package/src/contracts/events/notification-requested.ts +3 -2
  31. package/src/contracts/helpers.ts +1 -2
  32. package/src/contracts/index.ts +1 -0
  33. package/src/contracts/registry.ts +1 -0
  34. package/src/contracts/sdk.ts +8 -37
  35. package/src/db/schema.ts +8 -13
  36. package/src/idempotency/index.ts +6 -8
  37. package/src/metrics/index.ts +2 -0
  38. package/src/rate-limiter/api-rate-limiter.ts +208 -0
  39. package/src/rate-limiter/index.ts +3 -411
  40. package/src/rate-limiter/project-settings-cache.ts +99 -0
  41. package/src/rate-limiter/user-throttle.ts +100 -0
  42. package/src/redis/index.ts +10 -3
  43. package/src/repositories/admin-user.ts +83 -0
  44. package/src/repositories/contact.ts +359 -0
  45. package/src/repositories/index.ts +9 -1416
  46. package/src/repositories/preference.ts +35 -0
  47. package/src/repositories/project.ts +110 -0
  48. package/src/repositories/segment.ts +16 -0
  49. package/src/repositories/template.ts +72 -0
  50. package/src/repositories/types.ts +49 -0
  51. package/src/repositories/user.ts +644 -0
  52. package/src/repositories/workflow.ts +64 -0
  53. package/src/services/ai/main.ts +29 -71
  54. package/src/services/api/admin-static.ts +4 -1
  55. package/src/services/api/handlers/auth.ts +109 -0
  56. package/src/services/api/handlers/campaigns.ts +191 -0
  57. package/src/services/api/handlers/events.ts +99 -0
  58. package/src/services/api/handlers/notifications.ts +356 -0
  59. package/src/services/api/handlers/projects.ts +116 -0
  60. package/src/services/api/handlers/shared.ts +262 -0
  61. package/src/services/api/handlers/suppressions.ts +95 -0
  62. package/src/services/api/handlers/system.ts +314 -0
  63. package/src/services/api/handlers/templates.ts +97 -0
  64. package/src/services/api/handlers/unsubscribe.ts +215 -0
  65. package/src/services/api/handlers/users.ts +262 -0
  66. package/src/services/api/handlers/workflows.ts +150 -0
  67. package/src/services/api/handlers.ts +25 -2190
  68. package/src/services/api/health.ts +133 -0
  69. package/src/services/api/http.ts +12 -0
  70. package/src/services/api/main.ts +32 -322
  71. package/src/services/api/router.ts +1 -1
  72. package/src/services/api/webhooks.ts +172 -0
  73. package/src/services/delivery/main.ts +256 -498
  74. package/src/services/engine/main.ts +31 -235
  75. package/src/services/engine/quiet-hours.ts +151 -0
  76. package/src/services/engine/schedule-or-dispatch.ts +104 -0
  77. package/src/services/enricher/main.ts +9 -21
  78. package/src/services/events/main.ts +2 -2
  79. package/src/services/scheduler/main.ts +16 -25
  80. package/src/services/workflow/duration.ts +24 -0
  81. package/src/services/workflow/main.ts +6 -164
  82. package/src/services/workflow/timers.ts +157 -0
  83. package/src/shared/events.ts +3 -2
  84. package/src/templates/render.ts +1 -0
  85. package/src/workers/index.ts +7 -4
  86. package/src/workflows/sdk.ts +1 -0
  87. package/dashboard/README.md +0 -29
  88. package/dashboard/dist/assets/index-ggpJKZqZ.js +0 -315
  89. package/dashboard/dist/assets/index-s-SXGIwv.css +0 -1
@@ -1,6 +1,6 @@
1
- import { Jt as buildStreamEvent, Yt as CONSUMER_GROUPS, c as BaseWorker, d as startHealthReporter, en as STREAMS, hn as readBaseConfig, ht as workflowWaiters, mt as workflowSteps, pn as loadEnv, pt as workflowInstances, q as StreamProducer } from "./src-DYqdD694.mjs";
2
- import { a as uniqueConsumerId, i as shutdownWorker, n as createStreamConsumer, r as createWorkerRuntime } from "./bootstrap-m107TukN.mjs";
3
- import { t as insertMessageLogs } from "./bulk-xAd_biYV.mjs";
1
+ import { J as StreamProducer, Xt as CONSUMER_GROUPS, Yt as buildStreamEvent, c as BaseWorker, d as startHealthReporter, gn as readBaseConfig, gt as workflowWaiters, ht as workflowSteps, mn as loadEnv, mt as workflowInstances, tn as STREAMS } from "./src-BE_EUpZ6.mjs";
2
+ import { a as uniqueConsumerId, i as shutdownWorker, n as createStreamConsumer, r as createWorkerRuntime } from "./bootstrap-BMDRPjgp.mjs";
3
+ import { t as insertMessageLogs } from "./bulk-CJ5QXiPa.mjs";
4
4
  import { and, eq, gt, isNull, or } from "drizzle-orm";
5
5
  //#region src/services/events/main.ts
6
6
  loadEnv();
@@ -74,7 +74,7 @@ var EventWorker = class EventWorker extends BaseWorker {
74
74
  } catch (error) {
75
75
  this.logger.error({
76
76
  batchSize: batch.length,
77
- error: error.message
77
+ err: error
78
78
  }, "failed to flush delivery logs — dropping batch");
79
79
  for (const b of batch) b.reject(error);
80
80
  for (const e of events) e.reject(error);
@@ -0,0 +1,52 @@
1
+ import { Dn as getPriorityBucket, Yt as buildStreamEvent, lt as scheduledPayloads } from "./src-BE_EUpZ6.mjs";
2
+ import { randomUUID } from "node:crypto";
3
+ //#region src/services/engine/schedule-or-dispatch.ts
4
+ /**
5
+ * Caches the payload and publishes `notification.scheduled` when the task is due
6
+ * later, otherwise publishes `notification.dispatched` to the outbound stream
7
+ * for its priority (or hands it to the fused delivery worker).
8
+ */
9
+ async function scheduleOrDispatch(deps, taskPayload, opts) {
10
+ const { taskId } = taskPayload;
11
+ const envelope = buildStreamEvent("notification.dispatched", taskPayload, opts.source, opts.traceId);
12
+ const now = Date.now();
13
+ if ((opts.scheduledAt ? new Date(opts.scheduledAt).getTime() : now) > now) {
14
+ await deps.db.insert(scheduledPayloads).values({
15
+ taskId,
16
+ payload: {
17
+ ...taskPayload,
18
+ scheduledAt: opts.scheduledAt
19
+ }
20
+ }).onConflictDoNothing();
21
+ const scheduledEnvelope = buildStreamEvent("notification.scheduled", {
22
+ projectId: taskPayload.projectId,
23
+ enrichedEventId: taskPayload.enrichedEventId,
24
+ taskId,
25
+ scheduledAt: opts.scheduledAt
26
+ }, opts.source, opts.traceId);
27
+ await deps.scheduledProducer.publish(scheduledEnvelope);
28
+ deps.logger[opts.logLevel]({
29
+ messageId: opts.messageId,
30
+ taskId,
31
+ scheduledAt: opts.scheduledAt,
32
+ traceId: opts.traceId
33
+ }, opts.scheduledMessage);
34
+ } else {
35
+ const p = getPriorityBucket(taskPayload.priority);
36
+ const outboundProducer = deps.outboundProducers[p] ?? deps.outboundProducers["normal"];
37
+ if (deps.inlineNext) await deps.inlineNext({
38
+ ...envelope,
39
+ id: randomUUID(),
40
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
41
+ });
42
+ else await outboundProducer.publish(envelope);
43
+ deps.logger[opts.logLevel]({
44
+ messageId: opts.messageId,
45
+ taskId,
46
+ recipientId: taskPayload.recipientId,
47
+ traceId: opts.traceId
48
+ }, opts.dispatchedMessage);
49
+ }
50
+ }
51
+ //#endregion
52
+ export { scheduleOrDispatch as t };
@@ -448,6 +448,7 @@ const NotificationPrioritySchema = z.enum([
448
448
  "high",
449
449
  "critical"
450
450
  ]);
451
+ /** @deprecated Unused; removed in the next minor version. */
451
452
  const NotificationStatusSchema = z.enum([
452
453
  "pending",
453
454
  "queued",
@@ -601,8 +602,8 @@ function buildStreamEvent(type, payload, source, traceId) {
601
602
  //#endregion
602
603
  //#region src/contracts/sdk.ts
603
604
  const QuietHoursSchema = z.object({
604
- start: z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, "expected HH:MM (24h, UTC)"),
605
- end: z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, "expected HH:MM (24h, UTC)")
605
+ start: z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, "expected HH:MM (24h, user's timezone)"),
606
+ end: z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, "expected HH:MM (24h, user's timezone)")
606
607
  });
607
608
  const PreferencesSchema = z.object({
608
609
  channels: z.record(z.string(), z.boolean()).optional(),
@@ -610,17 +611,7 @@ const PreferencesSchema = z.object({
610
611
  quietHours: z.array(QuietHoursSchema).optional()
611
612
  });
612
613
  /** Channels that carry an addressable target (email address, phone, push token, url, chat id). */
613
- const ContactChannelSchema = z.enum([
614
- "email",
615
- "sms",
616
- "push",
617
- "webhook",
618
- "in-app",
619
- "telegram",
620
- "discord",
621
- "whatsapp",
622
- "slack"
623
- ]);
614
+ const ContactChannelSchema = NotificationChannelSchema;
624
615
  /** Accept a single value or an array; always normalise to a non-empty array. */
625
616
  const stringOrArray = z.union([z.string().min(1), z.array(z.string().min(1))]).transform((v) => Array.isArray(v) ? v : [v]);
626
617
  const UserContactInputSchema = z.object({
@@ -659,35 +650,18 @@ const UpdateUserSchema = z.object({
659
650
  preferences: PreferencesSchema.optional()
660
651
  });
661
652
  /** addUserContact(userId, channel, { target, preferences, label, isPrimary, enabled }) */
662
- const AddContactSchema = z.object({
663
- channel: ContactChannelSchema,
664
- target: z.string().min(1),
665
- label: z.string().optional(),
666
- isPrimary: z.boolean().optional(),
667
- enabled: z.boolean().optional(),
668
- preferences: PreferencesSchema.optional()
669
- });
653
+ const AddContactSchema = UserContactInputSchema;
670
654
  const BatchAddContactsSchema = z.union([AddContactSchema, z.array(AddContactSchema).min(1)]);
671
655
  const TemplateSchema = z.object({
672
656
  id: z.string().min(1),
673
657
  channel: NotificationChannelSchema,
674
- topic: z.union([z.string().min(1), z.array(z.string().min(1))]).transform((v) => Array.isArray(v) ? v : [v]).optional(),
658
+ topic: stringOrArray.optional(),
675
659
  content: z.record(z.string(), z.unknown()),
676
660
  aiPrompts: z.record(z.string(), z.string()).optional()
677
661
  });
678
662
  const SyncTemplatesSchema = z.object({ templates: z.array(TemplateSchema).min(1) });
679
663
  /** Inline user object accepted by notify({ user: {...} }). */
680
- const InlineUserSchema = z.object({
681
- id: z.string().min(1),
682
- language: z.string().optional(),
683
- timezone: z.string().optional(),
684
- contacts: z.array(UserContactInputSchema).optional(),
685
- email: stringOrArray.optional(),
686
- phone: stringOrArray.optional(),
687
- pushToken: stringOrArray.optional(),
688
- segments: z.array(z.string().min(1)).optional(),
689
- preferences: PreferencesSchema.optional()
690
- });
664
+ const InlineUserSchema = AddUserSchema;
691
665
  /**
692
666
  * notify(...) request body.
693
667
  *
@@ -801,10 +775,11 @@ const UpdateProjectSchema = z.object({
801
775
  /**
802
776
  * A high-level notification request as issued by the SDK's `notify()` call.
803
777
  *
804
- * Unlike `notification.created` (which targets a single resolved recipient),
778
+ * Unlike `notification.enriched` (which targets a single resolved address),
805
779
  * this event carries the *unresolved* target — a user id, a segment, or a
806
780
  * topic. A downstream resolver stage fans it out into one
807
- * `notification.created` per matching recipient, applying preference filters.
781
+ * `notification.enriched` per matching address and channel, applying
782
+ * preference filters.
808
783
  */
809
784
  const NotificationTargetSchema = z.discriminatedUnion("type", [
810
785
  z.object({
@@ -841,6 +816,7 @@ const NotificationRequestedPayloadSchema = z.object({
841
816
  });
842
817
  //#endregion
843
818
  //#region src/contracts/events/notification-created.ts
819
+ /** @deprecated Nothing publishes `notification.created`; removed in the next minor version. */
844
820
  const NotificationCreatedPayloadSchema = z.object({
845
821
  projectId: z.string().uuid(),
846
822
  recipientId: z.string().min(1),
@@ -970,7 +946,7 @@ const NotificationDeliveredPayloadSchema = z.object({
970
946
  deliveredAt: z.string().datetime(),
971
947
  providerMessageId: z.string().optional(),
972
948
  providerResponse: z.record(z.string(), z.unknown()).optional(),
973
- templateId: z.string().uuid().optional(),
949
+ templateId: z.string().min(1).optional(),
974
950
  workflowInstanceId: z.string().uuid().optional(),
975
951
  /** Campaign this message belongs to, carried from the originating request. */
976
952
  campaignId: z.string().min(1).max(128).optional(),
@@ -994,7 +970,7 @@ const NotificationFailedPayloadSchema = z.object({
994
970
  retryable: z.boolean(),
995
971
  attempt: z.number().int().positive(),
996
972
  providerResponse: z.record(z.string(), z.unknown()).optional(),
997
- templateId: z.string().uuid().optional(),
973
+ templateId: z.string().min(1).optional(),
998
974
  workflowInstanceId: z.string().uuid().optional(),
999
975
  /** Campaign this message belongs to, carried from the originating request. */
1000
976
  campaignId: z.string().min(1).max(128).optional(),
@@ -1080,17 +1056,7 @@ var schema_exports = /* @__PURE__ */ __exportAll({
1080
1056
  workflowSteps: () => workflowSteps,
1081
1057
  workflowWaiters: () => workflowWaiters
1082
1058
  });
1083
- const channelEnum = pgEnum("channel", [
1084
- "email",
1085
- "sms",
1086
- "push",
1087
- "webhook",
1088
- "in-app",
1089
- "telegram",
1090
- "discord",
1091
- "whatsapp",
1092
- "slack"
1093
- ]);
1059
+ const channelEnum = pgEnum("channel", NotificationChannelSchema.options);
1094
1060
  const projects = pgTable("projects", {
1095
1061
  id: uuid("id").primaryKey().defaultRandom(),
1096
1062
  name: varchar("name").notNull(),
@@ -1456,10 +1422,8 @@ async function migrateDatabase({ url, schema: dbSchema }) {
1456
1422
  //#endregion
1457
1423
  //#region src/idempotency/index.ts
1458
1424
  /**
1459
- * Two-phase SETNX-based idempotency guard.
1460
- * Supports:
1461
- * - Phase 1 (:lock): Short lease acquired at the start of message processing.
1462
- * - Phase 2 (:sent): Long-lived completion marker recorded when processing succeeds.
1425
+ * SET NX-based idempotency guard.
1426
+ * One key per id: `L` while leased, `1` once processed.
1463
1427
  */
1464
1428
  var IdempotencyGuard = class {
1465
1429
  redis;
@@ -1473,17 +1437,17 @@ var IdempotencyGuard = class {
1473
1437
  key(id) {
1474
1438
  return `${this.keyPrefix}:${id}`;
1475
1439
  }
1440
+ /** @deprecated Nothing writes `:lock` keys any more; read only for markers from older versions. Remove in the next minor. */
1476
1441
  lockKey(id) {
1477
1442
  return `${this.keyPrefix}:${id}:lock`;
1478
1443
  }
1444
+ /** @deprecated Nothing writes `:sent` keys any more; read only for markers from older versions. Remove in the next minor. */
1479
1445
  completedKey(id) {
1480
1446
  return `${this.keyPrefix}:${id}:sent`;
1481
1447
  }
1482
1448
  /**
1483
- * Two-phase lease acquisition.
1484
- * Atomically checks existing state and acquires lock if available.
1485
- * - Happy path (new message): single native SET NX command storing "L" (lock lease).
1486
- * - If already present: checks if "S" (sent/completed) or "L" (locked by another worker).
1449
+ * Leases the id with SET NX. One key per id: `L` while leased, `1` once processed.
1450
+ * Returns "completed" if already processed, "locked" if another worker holds the lease.
1487
1451
  */
1488
1452
  async acquireLease(id, lockTtlSeconds = 30) {
1489
1453
  const mainKey = this.key(id);
@@ -1584,6 +1548,7 @@ const metrics = {
1584
1548
  labelNames: ["channel", "reason"],
1585
1549
  registers: [register]
1586
1550
  }),
1551
+ /** @deprecated Never set, so it always reads 0. Removed in the next minor version. */
1587
1552
  workerActiveTasks: new promClient.Gauge({
1588
1553
  name: "notifkit_worker_active_tasks",
1589
1554
  help: "Number of currently active tasks per worker",
@@ -1596,6 +1561,7 @@ const metrics = {
1596
1561
  labelNames: ["stream"],
1597
1562
  registers: [register]
1598
1563
  }),
1564
+ /** @deprecated Never set, so it always reads 0. Removed in the next minor version. */
1599
1565
  pendingAcks: new promClient.Gauge({
1600
1566
  name: "notifkit_pending_acks",
1601
1567
  help: "Number of pending un-acked messages per group",
@@ -2036,7 +2002,7 @@ var PendingMessageScanner = class {
2036
2002
  }
2037
2003
  };
2038
2004
  //#endregion
2039
- //#region src/rate-limiter/index.ts
2005
+ //#region src/rate-limiter/project-settings-cache.ts
2040
2006
  const NO_OVERRIDES = {
2041
2007
  throttleLimit: null,
2042
2008
  throttleWindowHours: null
@@ -2096,6 +2062,8 @@ var ProjectSettingsCache = class {
2096
2062
  this.inFlight.clear();
2097
2063
  }
2098
2064
  };
2065
+ //#endregion
2066
+ //#region src/rate-limiter/user-throttle.ts
2099
2067
  /** Reject stored values that would make the window meaningless. */
2100
2068
  function positiveOrNull(value) {
2101
2069
  return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : null;
@@ -2143,6 +2111,8 @@ var UserThrottle = class {
2143
2111
  };
2144
2112
  }
2145
2113
  };
2114
+ //#endregion
2115
+ //#region src/rate-limiter/api-rate-limiter.ts
2146
2116
  /**
2147
2117
  * Computes dynamic token lease batch size based on RPM.
2148
2118
  * Targets ~5s of limit capacity so Redis is contacted at most ~12 times/min
@@ -2381,7 +2351,10 @@ const LUA_COUNT_REQUEST = `
2381
2351
  end
2382
2352
  return count
2383
2353
  `;
2384
- /** Two-phase idempotency lease acquisition. Checks sent/legacy, then attempts SET NX lock. */
2354
+ /**
2355
+ * Two-phase idempotency lease acquisition. Checks sent/legacy, then attempts SET NX lock.
2356
+ * @deprecated Nothing calls the `acquireLease` command; removed in the next minor version.
2357
+ */
2385
2358
  const LUA_ACQUIRE_LEASE = `
2386
2359
  if redis.call('EXISTS', KEYS[1]) == 1 or redis.call('EXISTS', KEYS[3]) == 1 then
2387
2360
  return 'completed'
@@ -2395,7 +2368,10 @@ const LUA_ACQUIRE_LEASE = `
2395
2368
  end
2396
2369
  return 'locked'
2397
2370
  `;
2398
- /** Two-phase idempotency completion marker. Atomically sets completed + legacy and deletes lock. */
2371
+ /**
2372
+ * Two-phase idempotency completion marker. Atomically sets completed + legacy and deletes lock.
2373
+ * @deprecated Nothing calls the `markProcessed` command; removed in the next minor version.
2374
+ */
2399
2375
  const LUA_MARK_PROCESSED = `
2400
2376
  redis.call('SET', KEYS[1], '1', 'EX', ARGV[1])
2401
2377
  redis.call('SET', KEYS[2], '1', 'EX', ARGV[1])
@@ -2544,7 +2520,7 @@ function redactUrl(url) {
2544
2520
  }
2545
2521
  }
2546
2522
  //#endregion
2547
- //#region src/repositories/index.ts
2523
+ //#region src/repositories/user.ts
2548
2524
  const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
2549
2525
  /**
2550
2526
  * Applied when a profile is read, not when it is written: an upsert that
@@ -2552,12 +2528,16 @@ const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/
2552
2528
  */
2553
2529
  const DEFAULT_LANGUAGE = "en";
2554
2530
  const DEFAULT_TIMEZONE = "UTC";
2555
- var UserRepository = class {
2531
+ var UserRepository = class UserRepository {
2556
2532
  db;
2557
2533
  recordCache = new LRUCache(5e3, 3e4);
2558
2534
  constructor(db) {
2559
2535
  this.db = db;
2560
2536
  }
2537
+ /** A repository that runs its queries inside `tx`. */
2538
+ withTx(tx) {
2539
+ return new UserRepository(tx);
2540
+ }
2561
2541
  async findById(projectId, userId) {
2562
2542
  const rows = await this.db.select().from(users).where(and(eq(users.externalId, userId), eq(users.projectId, projectId))).limit(1);
2563
2543
  if (!rows[0]) return null;
@@ -2882,6 +2862,9 @@ var UserRepository = class {
2882
2862
  return (await this.db.select({ externalId: users.externalId }).from(users).innerJoin(userTopicPreferences, eq(users.id, userTopicPreferences.userId)).where(and(eq(userTopicPreferences.topic, topicName), eq(userTopicPreferences.enabled, true), eq(users.projectId, projectId)))).map((r) => r.externalId);
2883
2863
  }
2884
2864
  };
2865
+ //#endregion
2866
+ //#region src/repositories/preference.ts
2867
+ /** @deprecated Unused; removed in the next minor version. */
2885
2868
  var PreferenceRepository = class {
2886
2869
  db;
2887
2870
  constructor(db) {
@@ -2901,12 +2884,18 @@ var PreferenceRepository = class {
2901
2884
  }));
2902
2885
  }
2903
2886
  };
2904
- var ContactRepository = class {
2887
+ //#endregion
2888
+ //#region src/repositories/contact.ts
2889
+ var ContactRepository = class ContactRepository {
2905
2890
  db;
2906
2891
  activeContactsCache = new LRUCache(5e3, 3e4);
2907
2892
  constructor(db) {
2908
2893
  this.db = db;
2909
2894
  }
2895
+ /** A repository that runs its queries inside `tx`. */
2896
+ withTx(tx) {
2897
+ return new ContactRepository(tx);
2898
+ }
2910
2899
  async findByUserId(projectId, userId) {
2911
2900
  const internalId = (await this.db.select({ id: users.id }).from(users).where(and(eq(users.externalId, userId), eq(users.projectId, projectId))))[0]?.id;
2912
2901
  if (!internalId) return [];
@@ -3086,6 +3075,8 @@ var ContactRepository = class {
3086
3075
  return (await this.db.delete(userContacts).where(and(eq(userContacts.userId, internalId), eq(userContacts.channel, channel), eq(userContacts.target, target))).returning()).length > 0;
3087
3076
  }
3088
3077
  };
3078
+ //#endregion
3079
+ //#region src/repositories/template.ts
3089
3080
  var TemplateRepository = class {
3090
3081
  db;
3091
3082
  constructor(db) {
@@ -3137,6 +3128,8 @@ var TemplateRepository = class {
3137
3128
  return (await this.db.delete(templates).where(and(eq(templates.id, id), eq(templates.projectId, projectId))).returning()).length > 0;
3138
3129
  }
3139
3130
  };
3131
+ //#endregion
3132
+ //#region src/repositories/project.ts
3140
3133
  var ProjectRepository = class {
3141
3134
  db;
3142
3135
  constructor(db) {
@@ -3154,15 +3147,7 @@ var ProjectRepository = class {
3154
3147
  }
3155
3148
  async delete(id) {
3156
3149
  return await this.db.transaction(async (tx) => {
3157
- const userIds = (await tx.select({ id: users.id }).from(users).where(eq(users.projectId, id))).map((u) => u.id);
3158
- if (userIds.length > 0) {
3159
- await tx.delete(userContacts).where(inArray(userContacts.userId, userIds));
3160
- await tx.delete(userSegments).where(inArray(userSegments.userId, userIds));
3161
- await tx.delete(userTopicPreferences).where(inArray(userTopicPreferences.userId, userIds));
3162
- await tx.delete(userChannelPreferences).where(inArray(userChannelPreferences.userId, userIds));
3163
- await tx.delete(quietHours).where(inArray(quietHours.userId, userIds));
3164
- await tx.delete(users).where(eq(users.projectId, id));
3165
- }
3150
+ await tx.delete(users).where(eq(users.projectId, id));
3166
3151
  await tx.delete(suppressions).where(eq(suppressions.projectId, id));
3167
3152
  await tx.delete(messageLogs).where(eq(messageLogs.projectId, id));
3168
3153
  await tx.delete(workflowInstances).where(eq(workflowInstances.projectId, id));
@@ -3201,6 +3186,8 @@ var ProjectRepository = class {
3201
3186
  return (await this.db.delete(projectApiKeys).where(and(eq(projectApiKeys.id, keyId), eq(projectApiKeys.projectId, projectId))).returning()).length > 0;
3202
3187
  }
3203
3188
  };
3189
+ //#endregion
3190
+ //#region src/repositories/workflow.ts
3204
3191
  var WorkflowRepository = class {
3205
3192
  db;
3206
3193
  constructor(db) {
@@ -3228,6 +3215,8 @@ var WorkflowRepository = class {
3228
3215
  });
3229
3216
  }
3230
3217
  };
3218
+ //#endregion
3219
+ //#region src/repositories/segment.ts
3231
3220
  var SegmentRepository = class {
3232
3221
  db;
3233
3222
  constructor(db) {
@@ -3242,6 +3231,8 @@ var SegmentRepository = class {
3242
3231
  `)).map((r) => r.segment);
3243
3232
  }
3244
3233
  };
3234
+ //#endregion
3235
+ //#region src/repositories/admin-user.ts
3245
3236
  var AdminUserRepository = class {
3246
3237
  db;
3247
3238
  constructor(db) {
@@ -3262,12 +3253,14 @@ var AdminUserRepository = class {
3262
3253
  role: data.role || "admin"
3263
3254
  }).returning())[0];
3264
3255
  }
3256
+ /** @deprecated Unused; removed in the next minor version. */
3265
3257
  async updatePassword(id, passwordHash) {
3266
3258
  return (await this.db.update(adminUsers).set({
3267
3259
  passwordHash,
3268
3260
  updatedAt: /* @__PURE__ */ new Date()
3269
3261
  }).where(eq(adminUsers.id, id)).returning()).length > 0;
3270
3262
  }
3263
+ /** @deprecated Unused; removed in the next minor version. */
3271
3264
  async list() {
3272
3265
  return await this.db.select({
3273
3266
  id: adminUsers.id,
@@ -3291,6 +3284,7 @@ function escapeHtml(unsafe) {
3291
3284
  function escapeHeader(unsafe) {
3292
3285
  return String(unsafe).replace(/[\r\n]+/g, " ").trim();
3293
3286
  }
3287
+ /** @deprecated Unused; templates render through renderWithTemplate. Removed in the next minor version. */
3294
3288
  function interpolate(tmpl, variables, sanitize = true) {
3295
3289
  return tmpl.replace(/\{\{\{(\w+)\}\}\}/g, (_, k) => {
3296
3290
  return String(variables[k] ?? "");
@@ -3584,7 +3578,12 @@ var BaseWorker = class {
3584
3578
  this.state = "stopping";
3585
3579
  await this.consumer.stop();
3586
3580
  this.stopRecoveryLoop();
3587
- if (this.runLoop) await Promise.race([this.runLoop, new Promise((_, reject) => setTimeout(() => reject(/* @__PURE__ */ new Error("Worker stop timeout")), 3e4))]).catch((err) => this.logger.warn({ err }, "Worker shutdown timeout or error"));
3581
+ if (this.runLoop) {
3582
+ let timer;
3583
+ await Promise.race([this.runLoop, new Promise((_, reject) => {
3584
+ timer = setTimeout(() => reject(/* @__PURE__ */ new Error("Worker stop timeout")), 3e4);
3585
+ })]).catch((err) => this.logger.warn({ err }, "Worker shutdown timeout or error")).finally(() => clearTimeout(timer));
3586
+ }
3588
3587
  this.logger.info("worker shutdown complete");
3589
3588
  }
3590
3589
  async recover() {
@@ -3817,6 +3816,7 @@ function buildStepNotifyPayload(args, instanceInput, projectId, idempotencyKey,
3817
3816
  fallback: args.fallback ?? false,
3818
3817
  scheduledAt: args.sendAt,
3819
3818
  idempotencyKey,
3819
+ campaignId: args.campaign,
3820
3820
  ...workflowInstanceId ? { workflowInstanceId } : {}
3821
3821
  };
3822
3822
  }
@@ -3886,7 +3886,7 @@ var NotifkitClient = class {
3886
3886
  return this.request("/v1/users", "POST", idOrInput);
3887
3887
  }
3888
3888
  async identify(idOrInput, contacts, options) {
3889
- return this.addUser(idOrInput, contacts, options);
3889
+ return typeof idOrInput === "string" ? this.addUser(idOrInput, contacts, options) : this.addUser(idOrInput);
3890
3890
  }
3891
3891
  /** Update user profile. */
3892
3892
  async updateUser(id, input) {
@@ -4194,35 +4194,35 @@ var NotifkitServer = class extends EventEmitter {
4194
4194
  }
4195
4195
  const startupPromises = [];
4196
4196
  if (services.includes("api")) {
4197
- const { startApiServer } = await import("./main-5kVwbbnW.mjs");
4197
+ const { startApiServer } = await import("./main-g1KEcXXp.mjs");
4198
4198
  startupPromises.push(startApiServer());
4199
4199
  }
4200
4200
  if (services.includes("delivery")) {
4201
- const { startDeliveryWorker } = await import("./main-HT5c6jyf.mjs");
4201
+ const { startDeliveryWorker } = await import("./main-B82bsFoy.mjs");
4202
4202
  startupPromises.push(startDeliveryWorker());
4203
4203
  }
4204
4204
  if (services.includes("engine")) {
4205
- const { startEngineWorker } = await import("./main-WkxXwP5q.mjs");
4205
+ const { startEngineWorker } = await import("./main-8nP3qmCT.mjs");
4206
4206
  startupPromises.push(startEngineWorker());
4207
4207
  }
4208
4208
  if (services.includes("enricher")) {
4209
- const { startEnricherWorker } = await import("./main-DRHL2bst.mjs");
4209
+ const { startEnricherWorker } = await import("./main-DULD8-th.mjs");
4210
4210
  startupPromises.push(startEnricherWorker());
4211
4211
  }
4212
4212
  if (services.includes("scheduler")) {
4213
- const { startSchedulerWorker } = await import("./main-C87TSAqM.mjs");
4213
+ const { startSchedulerWorker } = await import("./main-CpaHF1Zw.mjs");
4214
4214
  startupPromises.push(startSchedulerWorker());
4215
4215
  }
4216
4216
  if (services.includes("ai")) {
4217
- const { startAiWorker } = await import("./main-CWIBUEc7.mjs");
4217
+ const { startAiWorker } = await import("./main-6_bXQBDH.mjs");
4218
4218
  startupPromises.push(startAiWorker());
4219
4219
  }
4220
4220
  if (services.includes("workflow")) {
4221
- const { startWorkflowWorker } = await import("./main-D_62f9fH.mjs");
4221
+ const { startWorkflowWorker } = await import("./main-ZW5RaiOK.mjs");
4222
4222
  startupPromises.push(startWorkflowWorker());
4223
4223
  }
4224
4224
  if (services.includes("events")) {
4225
- const { startEventWorker } = await import("./main-C0MjK1Au.mjs");
4225
+ const { startEventWorker } = await import("./main-mGIT8jv4.mjs");
4226
4226
  startupPromises.push(startEventWorker());
4227
4227
  }
4228
4228
  const handleSignal = async (signal) => {
@@ -4244,9 +4244,9 @@ var NotifkitServer = class extends EventEmitter {
4244
4244
  await Promise.all(startupPromises);
4245
4245
  if (readBaseConfig().PIPELINE_FUSED && services.includes("enricher") && services.includes("engine") && services.includes("delivery")) {
4246
4246
  const [{ getEnricherWorker }, { getEngineWorker }, { getDeliveryWorker }] = await Promise.all([
4247
- import("./main-DRHL2bst.mjs"),
4248
- import("./main-WkxXwP5q.mjs"),
4249
- import("./main-HT5c6jyf.mjs")
4247
+ import("./main-DULD8-th.mjs"),
4248
+ import("./main-8nP3qmCT.mjs"),
4249
+ import("./main-B82bsFoy.mjs")
4250
4250
  ]);
4251
4251
  const enricher = getEnricherWorker();
4252
4252
  const engine = getEngineWorker();
@@ -4277,14 +4277,14 @@ var NotifkitServer = class extends EventEmitter {
4277
4277
  "events"
4278
4278
  ] : this.options.services;
4279
4279
  const shutdownOrder = [
4280
- ["api", async () => (await import("./main-5kVwbbnW.mjs")).stopApiServer()],
4281
- ["workflow", async () => (await import("./main-D_62f9fH.mjs")).stopWorkflowWorker()],
4282
- ["enricher", async () => (await import("./main-DRHL2bst.mjs")).stopEnricherWorker()],
4283
- ["ai", async () => (await import("./main-CWIBUEc7.mjs")).stopAiWorker()],
4284
- ["engine", async () => (await import("./main-WkxXwP5q.mjs")).stopEngineWorker()],
4285
- ["scheduler", async () => (await import("./main-C87TSAqM.mjs")).stopSchedulerWorker()],
4286
- ["delivery", async () => (await import("./main-HT5c6jyf.mjs")).stopDeliveryWorker()],
4287
- ["events", async () => (await import("./main-C0MjK1Au.mjs")).stopEventWorker()]
4280
+ ["api", async () => (await import("./main-g1KEcXXp.mjs")).stopApiServer()],
4281
+ ["workflow", async () => (await import("./main-ZW5RaiOK.mjs")).stopWorkflowWorker()],
4282
+ ["enricher", async () => (await import("./main-DULD8-th.mjs")).stopEnricherWorker()],
4283
+ ["ai", async () => (await import("./main-6_bXQBDH.mjs")).stopAiWorker()],
4284
+ ["engine", async () => (await import("./main-8nP3qmCT.mjs")).stopEngineWorker()],
4285
+ ["scheduler", async () => (await import("./main-CpaHF1Zw.mjs")).stopSchedulerWorker()],
4286
+ ["delivery", async () => (await import("./main-B82bsFoy.mjs")).stopDeliveryWorker()],
4287
+ ["events", async () => (await import("./main-mGIT8jv4.mjs")).stopEventWorker()]
4288
4288
  ];
4289
4289
  for (const [name, stop] of shutdownOrder) if (services.includes(name)) await stop();
4290
4290
  if (this.pgContainer) {
@@ -4298,4 +4298,4 @@ var NotifkitServer = class extends EventEmitter {
4298
4298
  }
4299
4299
  };
4300
4300
  //#endregion
4301
- export { createDatabase as $, PUBSUB_CHANNELS as $t, LUA_ACQUIRE_LEASE as A, AddContactSchema as At, registerCustomCommands as B, SyncTemplatesSchema as Bt, ContactRepository as C, CircuitBreaker as Cn, RenderedContentSchema as Ct, TemplateRepository as D, normaliseTarget as Dn, NotificationCreatedPayloadSchema as Dt, SegmentRepository as E, getPriorityBucket as En, RecipientProfileSchema as Et, LUA_RENEW_LOCK as F, IngestEventSchema as Ft, PendingMessageScanner as G, UserContactInputSchema as Gt, ProjectSettingsCache as H, TriggerWorkflowSchema as Ht, LUA_SCHEDULER_POLL as I, InlineUserSchema as It, getMetricsRegistry as J, buildStreamEvent as Jt, StreamConsumer as K, WorkflowNotifyPayloadSchema as Kt, LUA_USER_THROTTLE as L, NotifyRequestSchema as Lt, LUA_LEASE_API_RATE_LIMIT as M, BatchAddContactsSchema as Mt, LUA_MARK_PROCESSED as N, ContactChannelSchema as Nt, UserRepository as O, LRUCache as On, NotificationRequestedPayloadSchema as Ot, LUA_RELEASE_LOCK as P, CreateWorkflowSchema as Pt, assertTablesInSchema as Q, OUTBOUND_STREAMS as Qt, Redis as R, PreferencesSchema as Rt, AdminUserRepository as S, DataLoader as Sn, NotificationDispatchedPayloadSchema as St, ProjectRepository as T, AsyncSemaphore as Tn, NotificationEnrichedPayloadSchema as Tt, UserThrottle as U, UpdateProjectSchema as Ut, ApiRateLimiter as V, TemplateSchema as Vt, calculateTokenBatchSize as W, UpdateUserSchema as Wt, createLogger as X, ENRICHED_STREAMS as Xt, metrics as Y, CONSUMER_GROUPS as Yt, IdempotencyGuard as Z, INBOUND_STREAMS as Zt, TemplateCache as _, setGlobalConfig as _n, NotificationCanceledPayloadSchema as _t, SuspendExecutionError as a, registry as an, messageLogs as at, interpolate as b, generateId as bn, NotificationDeliveredPayloadSchema as bt, BaseWorker as c, NotificationPrioritySchema as cn, scheduledPayloads as ct, startHealthReporter as d, baseConfigSchema as dn, users as dt, STREAMS as en, migrateDatabase as et, buildUnsubscribeHeaders as f, getAiConfig as fn, workflowDefinitions as ft, transportRegistry as g, setAiConfig as gn, NotificationAiPendingPayloadSchema as gt, registerTransport as h, readBaseConfig as hn, workflowWaiters as ht, workflowRegistry as i, EventRegistry as in, deliveryOutbox as it, LUA_COUNT_REQUEST as j, AddUserSchema as jt, WorkflowRepository as k, globalEmitter as kn, NotificationTargetSchema as kt, LockHeldError as l, NotificationStatusSchema as ln, suppressions as lt, verifyUnsubscribeToken as m, parseConfig as mn, workflowSteps as mt, NotifkitClient as n, StreamEventMetadataSchema as nn, qualifyMigrationSql as nt, buildStepNotifyPayload as o, EventMetadataSchema as on, projectApiKeys as ot, signUnsubscribeToken as p, loadEnv as pn, workflowInstances as pt, StreamProducer as q, WorkflowStepSchema as qt, workflow as r, StreamEventSchema as rn, runMigrations as rt, resolveStepTarget as s, NotificationChannelSchema as sn, projects as st, NotifkitServer as t, EventEnvelopeSchema as tn, notifkitTableNames as tt, NonRetryableError as u, AI_DEFAULTS as un, userTopicPreferences as ut, escapeHeader as v, AppError as vn, NotificationSkippedPayloadSchema as vt, PreferenceRepository as w, BatchProcessor as wn, NotificationScheduledPayloadSchema as wt, renderWithTemplate as x, sleep as xn, DeliveryOptionsSchema as xt, escapeHtml as y, ValidationError as yn, NotificationFailedPayloadSchema as yt, RedisClient as z, QuietHoursSchema as zt };
4301
+ export { assertTablesInSchema as $, OUTBOUND_STREAMS as $t, LUA_ACQUIRE_LEASE as A, globalEmitter as An, NotificationTargetSchema as At, redactUrl as B, QuietHoursSchema as Bt, SegmentRepository as C, DataLoader as Cn, NotificationDispatchedPayloadSchema as Ct, ContactRepository as D, getPriorityBucket as Dn, RecipientProfileSchema as Dt, TemplateRepository as E, AsyncSemaphore as En, NotificationEnrichedPayloadSchema as Et, LUA_RENEW_LOCK as F, CreateWorkflowSchema as Ft, ProjectSettingsCache as G, UpdateUserSchema as Gt, ApiRateLimiter as H, TemplateSchema as Ht, LUA_SCHEDULER_POLL as I, IngestEventSchema as It, StreamProducer as J, WorkflowStepSchema as Jt, PendingMessageScanner as K, UserContactInputSchema as Kt, LUA_USER_THROTTLE as L, InlineUserSchema as Lt, LUA_LEASE_API_RATE_LIMIT as M, AddUserSchema as Mt, LUA_MARK_PROCESSED as N, BatchAddContactsSchema as Nt, PreferenceRepository as O, normaliseTarget as On, NotificationCreatedPayloadSchema as Ot, LUA_RELEASE_LOCK as P, ContactChannelSchema as Pt, IdempotencyGuard as Q, INBOUND_STREAMS as Qt, Redis as R, NotifyRequestSchema as Rt, AdminUserRepository as S, sleep as Sn, DeliveryOptionsSchema as St, ProjectRepository as T, BatchProcessor as Tn, NotificationScheduledPayloadSchema as Tt, calculateTokenBatchSize as U, TriggerWorkflowSchema as Ut, registerCustomCommands as V, SyncTemplatesSchema as Vt, UserThrottle as W, UpdateProjectSchema as Wt, metrics as X, CONSUMER_GROUPS as Xt, getMetricsRegistry as Y, buildStreamEvent as Yt, createLogger as Z, ENRICHED_STREAMS as Zt, TemplateCache as _, setAiConfig as _n, NotificationAiPendingPayloadSchema as _t, SuspendExecutionError as a, EventRegistry as an, deliveryOutbox as at, interpolate as b, ValidationError as bn, NotificationFailedPayloadSchema as bt, BaseWorker as c, NotificationChannelSchema as cn, projects as ct, startHealthReporter as d, AI_DEFAULTS as dn, userTopicPreferences as dt, PUBSUB_CHANNELS as en, createDatabase as et, buildUnsubscribeHeaders as f, baseConfigSchema as fn, users as ft, transportRegistry as g, readBaseConfig as gn, workflowWaiters as gt, registerTransport as h, parseConfig as hn, workflowSteps as ht, workflowRegistry as i, StreamEventSchema as in, runMigrations as it, LUA_COUNT_REQUEST as j, AddContactSchema as jt, UserRepository as k, LRUCache as kn, NotificationRequestedPayloadSchema as kt, LockHeldError as l, NotificationPrioritySchema as ln, scheduledPayloads as lt, verifyUnsubscribeToken as m, loadEnv as mn, workflowInstances as mt, NotifkitClient as n, EventEnvelopeSchema as nn, notifkitTableNames as nt, buildStepNotifyPayload as o, registry as on, messageLogs as ot, signUnsubscribeToken as p, getAiConfig as pn, workflowDefinitions as pt, StreamConsumer as q, WorkflowNotifyPayloadSchema as qt, workflow as r, StreamEventMetadataSchema as rn, qualifyMigrationSql as rt, resolveStepTarget as s, EventMetadataSchema as sn, projectApiKeys as st, NotifkitServer as t, STREAMS as tn, migrateDatabase as tt, NonRetryableError as u, NotificationStatusSchema as un, suppressions as ut, escapeHeader as v, setGlobalConfig as vn, NotificationCanceledPayloadSchema as vt, WorkflowRepository as w, CircuitBreaker as wn, RenderedContentSchema as wt, renderWithTemplate as x, generateId as xn, NotificationDeliveredPayloadSchema as xt, escapeHtml as y, AppError as yn, NotificationSkippedPayloadSchema as yt, RedisClient as z, PreferencesSchema as zt };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "notifkit",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
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",
File without changes
@@ -41,11 +41,15 @@ try {
41
41
  }
42
42
 
43
43
  if (res.status === 401) {
44
- fail("admin credential rejected. It must match the server's ADMIN_API_KEY exactly.");
44
+ fail(
45
+ "admin credential rejected. It must match the server's ADMIN_API_KEY exactly, " +
46
+ "and the server must have been started with ADMIN_API_KEY set.",
47
+ );
45
48
  }
46
49
 
50
+ // The server answers 403 only to a dashboard session whose user is read-only.
47
51
  if (res.status === 403) {
48
- fail("project management is disabled. Start the server with ADMIN_API_KEY set.");
52
+ fail("that credential is a read-only dashboard session. Use the server's ADMIN_API_KEY.");
49
53
  }
50
54
 
51
55
  if (!res.ok) {
File without changes
File without changes
package/src/client.ts CHANGED
@@ -123,7 +123,9 @@ export class NotifkitClient {
123
123
  contacts?: UserContactInput[],
124
124
  options?: Omit<AddUserInput, "id" | "contacts">,
125
125
  ): Promise<{ id: string }> {
126
- return (this.addUser as any)(idOrInput, contacts, options);
126
+ return typeof idOrInput === "string"
127
+ ? this.addUser(idOrInput, contacts, options)
128
+ : this.addUser(idOrInput);
127
129
  }
128
130
 
129
131
  /** Update user profile. */
@@ -192,8 +194,6 @@ export class NotifkitClient {
192
194
  return this.syncTemplates({ templates: this.options.templates });
193
195
  }
194
196
 
195
- // ─── Missing Endpoints additions ─────────────────────────────────────────────
196
-
197
197
  /** List registered workflow definitions. */
198
198
  async listWorkflows(options?: {
199
199
  limit?: number;
@@ -128,6 +128,7 @@ export function readBaseConfig(data: NodeJS.ProcessEnv = process.env): BaseConfi
128
128
  return parseConfig(baseConfigSchema, data);
129
129
  }
130
130
 
131
+ /** @deprecated Unused; removed in the next minor version. */
131
132
  export interface RateLimitConfig {
132
133
  limit: number;
133
134
  windowSeconds: number;
@@ -16,6 +16,7 @@ export type NotificationChannel = z.infer<typeof NotificationChannelSchema>;
16
16
  export const NotificationPrioritySchema = z.enum(["low", "normal", "high", "critical"]);
17
17
  export type NotificationPriority = z.infer<typeof NotificationPrioritySchema>;
18
18
 
19
+ /** @deprecated Unused; removed in the next minor version. */
19
20
  export const NotificationStatusSchema = z.enum([
20
21
  "pending",
21
22
  "queued",
@@ -25,4 +26,5 @@ export const NotificationStatusSchema = z.enum([
25
26
  "bounced",
26
27
  "suppressed",
27
28
  ]);
29
+ /** @deprecated Unused; removed in the next minor version. */
28
30
  export type NotificationStatus = z.infer<typeof NotificationStatusSchema>;