notifkit 0.1.7 → 0.1.9

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 (40) hide show
  1. package/dashboard/README.md +29 -0
  2. package/dashboard/dist/assets/index-7mvXb4bS.js +310 -0
  3. package/dashboard/dist/assets/index-o7L-f3-c.css +1 -0
  4. package/dashboard/dist/favicon.svg +4 -0
  5. package/dashboard/dist/index.html +14 -0
  6. package/dist/index.d.mts +447 -9
  7. package/dist/index.d.mts.map +1 -1
  8. package/dist/index.mjs +2 -2
  9. package/dist/{main-CRPxM-O3.mjs → main-4Wyge9ms.mjs} +2 -2
  10. package/dist/{main-CRPxM-O3.mjs.map → main-4Wyge9ms.mjs.map} +1 -1
  11. package/dist/{main-Bgi2wWck.mjs → main-AO0JaY5z.mjs} +2 -2
  12. package/dist/{main-Bgi2wWck.mjs.map → main-AO0JaY5z.mjs.map} +1 -1
  13. package/dist/{main-DFMHcN_d.mjs → main-BMYSYcv2.mjs} +2 -2
  14. package/dist/{main-DFMHcN_d.mjs.map → main-BMYSYcv2.mjs.map} +1 -1
  15. package/dist/{main-Yorxzw0Z.mjs → main-BPbPnBIG.mjs} +2 -2
  16. package/dist/{main-Yorxzw0Z.mjs.map → main-BPbPnBIG.mjs.map} +1 -1
  17. package/dist/{main-pFAfCkVX.mjs → main-CyeQ_yDt.mjs} +2 -2
  18. package/dist/{main-pFAfCkVX.mjs.map → main-CyeQ_yDt.mjs.map} +1 -1
  19. package/dist/{main-CjbVdUqa.mjs → main-D19Wxs0x.mjs} +2 -2
  20. package/dist/{main-CjbVdUqa.mjs.map → main-D19Wxs0x.mjs.map} +1 -1
  21. package/dist/{main-D6SG3Isk.mjs → main-DSmh1e-V.mjs} +2 -2
  22. package/dist/{main-D6SG3Isk.mjs.map → main-DSmh1e-V.mjs.map} +1 -1
  23. package/dist/{main-CFSukWm8.mjs → main-JdOvJ70b.mjs} +495 -41
  24. package/dist/main-JdOvJ70b.mjs.map +1 -0
  25. package/dist/{src-CPMwsUCJ.mjs → src-CGmXRfsM.mjs} +86 -20
  26. package/dist/src-CGmXRfsM.mjs.map +1 -0
  27. package/drizzle/0005_admin_users.sql +11 -0
  28. package/drizzle/meta/_journal.json +7 -0
  29. package/package.json +8 -3
  30. package/scripts/create-admin.mjs +67 -0
  31. package/src/config/index.ts +12 -0
  32. package/src/db/schema.ts +13 -0
  33. package/src/repositories/index.ts +82 -1
  34. package/src/services/api/admin-static.ts +225 -0
  35. package/src/services/api/handlers.ts +224 -33
  36. package/src/services/api/main.ts +183 -29
  37. package/src/services/api/router.ts +7 -1
  38. package/src/services/auth/index.ts +111 -0
  39. package/dist/main-CFSukWm8.mjs.map +0 -1
  40. package/dist/src-CPMwsUCJ.mjs.map +0 -1
package/dist/index.d.mts CHANGED
@@ -17,6 +17,9 @@ declare const baseConfigSchema: z.ZodObject<{
17
17
  REDIS_URL: z.ZodDefault<z.ZodString>;
18
18
  DATABASE_URL: z.ZodDefault<z.ZodString>;
19
19
  ADMIN_API_KEY: z.ZodOptional<z.ZodString>;
20
+ ADMIN_EMAIL: z.ZodOptional<z.ZodString>;
21
+ ADMIN_PASSWORD: z.ZodOptional<z.ZodString>;
22
+ ADMIN_USERNAME: z.ZodOptional<z.ZodString>;
20
23
  WORKER_CONCURRENCY: z.ZodDefault<z.ZodNumber>;
21
24
  QUEUE_MAX_LEN: z.ZodDefault<z.ZodNumber>;
22
25
  DB_MAX_CONNECTIONS: z.ZodDefault<z.ZodNumber>;
@@ -36,6 +39,15 @@ declare const baseConfigSchema: z.ZodObject<{
36
39
  * instead, which costs far more than the key ever protected.
37
40
  */
38
41
  UNSUBSCRIBE_SECRET: z.ZodOptional<z.ZodString>;
42
+ /**
43
+ * When true, trusts X-Forwarded-For headers from reverse proxies for client IP resolution.
44
+ * Defaults to false to prevent client-spoofed headers from bypassing rate limits.
45
+ */
46
+ TRUST_PROXY: z.ZodDefault<z.ZodBoolean>;
47
+ /**
48
+ * Comma-separated list of allowed origins for CORS on session-authenticated admin routes.
49
+ */
50
+ CORS_ORIGIN: z.ZodOptional<z.ZodString>;
39
51
  }, "strip", z.ZodTypeAny, {
40
52
  NODE_ENV: "development" | "test" | "production";
41
53
  LOG_LEVEL: "fatal" | "error" | "warn" | "info" | "debug" | "trace" | "silent";
@@ -49,9 +61,14 @@ declare const baseConfigSchema: z.ZodObject<{
49
61
  LOG_FLUSH_INTERVAL_MS: number;
50
62
  LOG_BUFFER_MAX_SIZE: number;
51
63
  SEGMENT_MAX_USERS: number;
64
+ TRUST_PROXY: boolean;
52
65
  ADMIN_API_KEY?: string | undefined;
66
+ ADMIN_EMAIL?: string | undefined;
67
+ ADMIN_PASSWORD?: string | undefined;
68
+ ADMIN_USERNAME?: string | undefined;
53
69
  PUBLIC_URL?: string | undefined;
54
70
  UNSUBSCRIBE_SECRET?: string | undefined;
71
+ CORS_ORIGIN?: string | undefined;
55
72
  }, {
56
73
  NODE_ENV?: "development" | "test" | "production" | undefined;
57
74
  LOG_LEVEL?: "fatal" | "error" | "warn" | "info" | "debug" | "trace" | "silent" | undefined;
@@ -60,6 +77,9 @@ declare const baseConfigSchema: z.ZodObject<{
60
77
  REDIS_URL?: string | undefined;
61
78
  DATABASE_URL?: string | undefined;
62
79
  ADMIN_API_KEY?: string | undefined;
80
+ ADMIN_EMAIL?: string | undefined;
81
+ ADMIN_PASSWORD?: string | undefined;
82
+ ADMIN_USERNAME?: string | undefined;
63
83
  WORKER_CONCURRENCY?: number | undefined;
64
84
  QUEUE_MAX_LEN?: number | undefined;
65
85
  DB_MAX_CONNECTIONS?: number | undefined;
@@ -68,6 +88,8 @@ declare const baseConfigSchema: z.ZodObject<{
68
88
  SEGMENT_MAX_USERS?: number | undefined;
69
89
  PUBLIC_URL?: string | undefined;
70
90
  UNSUBSCRIBE_SECRET?: string | undefined;
91
+ TRUST_PROXY?: boolean | undefined;
92
+ CORS_ORIGIN?: string | undefined;
71
93
  }>;
72
94
  type BaseConfig = z.infer<typeof baseConfigSchema>;
73
95
  declare function setGlobalConfig(config: BaseConfig): void;
@@ -462,6 +484,7 @@ declare const NotificationEnrichedPayloadSchema: z.ZodObject<{
462
484
  priority: "low" | "normal" | "high" | "critical";
463
485
  projectId: string;
464
486
  recipientId: string;
487
+ rawEventId: string;
465
488
  templateVariables: Record<string, unknown>;
466
489
  recipient: {
467
490
  preferences: {
@@ -484,7 +507,6 @@ declare const NotificationEnrichedPayloadSchema: z.ZodObject<{
484
507
  pushToken?: string | undefined;
485
508
  pushTokens?: string[] | undefined;
486
509
  };
487
- rawEventId: string;
488
510
  aiPrompts?: Record<string, string> | undefined;
489
511
  templateId?: string | undefined;
490
512
  campaignId?: string | undefined;
@@ -495,6 +517,7 @@ declare const NotificationEnrichedPayloadSchema: z.ZodObject<{
495
517
  priority: "low" | "normal" | "high" | "critical";
496
518
  projectId: string;
497
519
  recipientId: string;
520
+ rawEventId: string;
498
521
  templateVariables: Record<string, unknown>;
499
522
  recipient: {
500
523
  preferences: {
@@ -517,7 +540,6 @@ declare const NotificationEnrichedPayloadSchema: z.ZodObject<{
517
540
  pushTokens?: string[] | undefined;
518
541
  locale?: string | undefined;
519
542
  };
520
- rawEventId: string;
521
543
  aiPrompts?: Record<string, string> | undefined;
522
544
  templateId?: string | undefined;
523
545
  campaignId?: string | undefined;
@@ -735,8 +757,8 @@ declare const NotificationDispatchedPayloadSchema: z.ZodObject<{
735
757
  priority: "low" | "normal" | "high" | "critical";
736
758
  projectId: string;
737
759
  taskId: string;
738
- enrichedEventId: string;
739
760
  recipientId: string;
761
+ enrichedEventId: string;
740
762
  templateVariables: Record<string, unknown>;
741
763
  renderedContent: {
742
764
  content: Record<string, unknown>;
@@ -783,8 +805,8 @@ declare const NotificationDispatchedPayloadSchema: z.ZodObject<{
783
805
  priority: "low" | "normal" | "high" | "critical";
784
806
  projectId: string;
785
807
  taskId: string;
786
- enrichedEventId: string;
787
808
  recipientId: string;
809
+ enrichedEventId: string;
788
810
  renderedContent: {
789
811
  content: Record<string, unknown>;
790
812
  attachments?: {
@@ -1041,8 +1063,8 @@ declare const NotificationAiPendingPayloadSchema: z.ZodObject<{
1041
1063
  priority: "low" | "normal" | "high" | "critical";
1042
1064
  aiPrompts: Record<string, string>;
1043
1065
  projectId: string;
1044
- enrichedEventId: string;
1045
1066
  recipientId: string;
1067
+ enrichedEventId: string;
1046
1068
  templateVariables: Record<string, unknown>;
1047
1069
  recipient: {
1048
1070
  preferences: {
@@ -1073,8 +1095,8 @@ declare const NotificationAiPendingPayloadSchema: z.ZodObject<{
1073
1095
  priority: "low" | "normal" | "high" | "critical";
1074
1096
  aiPrompts: Record<string, string>;
1075
1097
  projectId: string;
1076
- enrichedEventId: string;
1077
1098
  recipientId: string;
1099
+ enrichedEventId: string;
1078
1100
  templateVariables: Record<string, unknown>;
1079
1101
  recipient: {
1080
1102
  preferences: {
@@ -6346,7 +6368,7 @@ interface DLQMessageRecord {
6346
6368
  timestamp: string;
6347
6369
  }
6348
6370
  declare namespace schema_d_exports {
6349
- export { apiKeyRoleEnum, channelEnum, contactTopicPreferences, deliveryOutbox, insertDeliveryOutboxSchema, insertMessageLogSchema, insertProjectApiKeySchema, insertProjectSchema, insertScheduledPayloadSchema, insertSuppressionSchema, insertUserChannelPreferenceSchema, insertUserContactSchema, insertUserSchema, insertUserSegmentSchema, insertUserTopicPreferenceSchema, insertWorkflowInstanceSchema, insertWorkflowStepSchema, insertWorkflowWaiterSchema, messageLogs, projectApiKeys, projects, quietHours, scheduledPayloads, selectDeliveryOutboxSchema, selectMessageLogSchema, selectProjectApiKeySchema, selectProjectSchema, selectScheduledPayloadSchema, selectSuppressionSchema, selectUserChannelPreferenceSchema, selectUserContactSchema, selectUserSchema, selectUserSegmentSchema, selectUserTopicPreferenceSchema, selectWorkflowInstanceSchema, selectWorkflowStepSchema, selectWorkflowWaiterSchema, suppressions, templates, userChannelPreferences, userContacts, userSegments, userTopicPreferences, users, workflowDefinitions, workflowInstances, workflowStatusEnum, workflowSteps, workflowWaiters };
6371
+ export { adminUsers, apiKeyRoleEnum, channelEnum, contactTopicPreferences, deliveryOutbox, insertAdminUserSchema, insertDeliveryOutboxSchema, insertMessageLogSchema, insertProjectApiKeySchema, insertProjectSchema, insertScheduledPayloadSchema, insertSuppressionSchema, insertUserChannelPreferenceSchema, insertUserContactSchema, insertUserSchema, insertUserSegmentSchema, insertUserTopicPreferenceSchema, insertWorkflowInstanceSchema, insertWorkflowStepSchema, insertWorkflowWaiterSchema, messageLogs, projectApiKeys, projects, quietHours, scheduledPayloads, selectAdminUserSchema, selectDeliveryOutboxSchema, selectMessageLogSchema, selectProjectApiKeySchema, selectProjectSchema, selectScheduledPayloadSchema, selectSuppressionSchema, selectUserChannelPreferenceSchema, selectUserContactSchema, selectUserSchema, selectUserSegmentSchema, selectUserTopicPreferenceSchema, selectWorkflowInstanceSchema, selectWorkflowStepSchema, selectWorkflowWaiterSchema, suppressions, templates, userChannelPreferences, userContacts, userSegments, userTopicPreferences, users, workflowDefinitions, workflowInstances, workflowStatusEnum, workflowSteps, workflowWaiters };
6350
6372
  }
6351
6373
  declare const channelEnum: import("drizzle-orm/pg-core").PgEnum<["email", "sms", "push", "webhook", "in-app", "telegram", "discord", "whatsapp", "slack"]>;
6352
6374
  declare const projects: import("drizzle-orm/pg-core").PgTableWithColumns<{
@@ -8379,6 +8401,398 @@ declare const scheduledPayloads: import("drizzle-orm/pg-core").PgTableWithColumn
8379
8401
  };
8380
8402
  dialect: "pg";
8381
8403
  }>;
8404
+ declare const adminUsers: import("drizzle-orm/pg-core").PgTableWithColumns<{
8405
+ name: "admin_users";
8406
+ schema: undefined;
8407
+ columns: {
8408
+ id: import("drizzle-orm/pg-core").PgColumn<{
8409
+ name: "id";
8410
+ tableName: "admin_users";
8411
+ dataType: "string";
8412
+ columnType: "PgUUID";
8413
+ data: string;
8414
+ driverParam: string;
8415
+ notNull: true;
8416
+ hasDefault: true;
8417
+ isPrimaryKey: true;
8418
+ isAutoincrement: false;
8419
+ hasRuntimeDefault: false;
8420
+ enumValues: undefined;
8421
+ baseColumn: never;
8422
+ identity: undefined;
8423
+ generated: undefined;
8424
+ }, {}, {}>;
8425
+ email: import("drizzle-orm/pg-core").PgColumn<{
8426
+ name: "email";
8427
+ tableName: "admin_users";
8428
+ dataType: "string";
8429
+ columnType: "PgVarchar";
8430
+ data: string;
8431
+ driverParam: string;
8432
+ notNull: true;
8433
+ hasDefault: false;
8434
+ isPrimaryKey: false;
8435
+ isAutoincrement: false;
8436
+ hasRuntimeDefault: false;
8437
+ enumValues: [string, ...string[]];
8438
+ baseColumn: never;
8439
+ identity: undefined;
8440
+ generated: undefined;
8441
+ }, {}, {
8442
+ length: number | undefined;
8443
+ }>;
8444
+ username: import("drizzle-orm/pg-core").PgColumn<{
8445
+ name: "username";
8446
+ tableName: "admin_users";
8447
+ dataType: "string";
8448
+ columnType: "PgVarchar";
8449
+ data: string;
8450
+ driverParam: string;
8451
+ notNull: false;
8452
+ hasDefault: false;
8453
+ isPrimaryKey: false;
8454
+ isAutoincrement: false;
8455
+ hasRuntimeDefault: false;
8456
+ enumValues: [string, ...string[]];
8457
+ baseColumn: never;
8458
+ identity: undefined;
8459
+ generated: undefined;
8460
+ }, {}, {
8461
+ length: number | undefined;
8462
+ }>;
8463
+ passwordHash: import("drizzle-orm/pg-core").PgColumn<{
8464
+ name: "password_hash";
8465
+ tableName: "admin_users";
8466
+ dataType: "string";
8467
+ columnType: "PgVarchar";
8468
+ data: string;
8469
+ driverParam: string;
8470
+ notNull: true;
8471
+ hasDefault: false;
8472
+ isPrimaryKey: false;
8473
+ isAutoincrement: false;
8474
+ hasRuntimeDefault: false;
8475
+ enumValues: [string, ...string[]];
8476
+ baseColumn: never;
8477
+ identity: undefined;
8478
+ generated: undefined;
8479
+ }, {}, {
8480
+ length: number | undefined;
8481
+ }>;
8482
+ role: import("drizzle-orm/pg-core").PgColumn<{
8483
+ name: "role";
8484
+ tableName: "admin_users";
8485
+ dataType: "string";
8486
+ columnType: "PgVarchar";
8487
+ data: string;
8488
+ driverParam: string;
8489
+ notNull: true;
8490
+ hasDefault: true;
8491
+ isPrimaryKey: false;
8492
+ isAutoincrement: false;
8493
+ hasRuntimeDefault: false;
8494
+ enumValues: [string, ...string[]];
8495
+ baseColumn: never;
8496
+ identity: undefined;
8497
+ generated: undefined;
8498
+ }, {}, {
8499
+ length: number | undefined;
8500
+ }>;
8501
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
8502
+ name: "created_at";
8503
+ tableName: "admin_users";
8504
+ dataType: "date";
8505
+ columnType: "PgTimestamp";
8506
+ data: Date;
8507
+ driverParam: string;
8508
+ notNull: true;
8509
+ hasDefault: true;
8510
+ isPrimaryKey: false;
8511
+ isAutoincrement: false;
8512
+ hasRuntimeDefault: false;
8513
+ enumValues: undefined;
8514
+ baseColumn: never;
8515
+ identity: undefined;
8516
+ generated: undefined;
8517
+ }, {}, {}>;
8518
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
8519
+ name: "updated_at";
8520
+ tableName: "admin_users";
8521
+ dataType: "date";
8522
+ columnType: "PgTimestamp";
8523
+ data: Date;
8524
+ driverParam: string;
8525
+ notNull: true;
8526
+ hasDefault: true;
8527
+ isPrimaryKey: false;
8528
+ isAutoincrement: false;
8529
+ hasRuntimeDefault: false;
8530
+ enumValues: undefined;
8531
+ baseColumn: never;
8532
+ identity: undefined;
8533
+ generated: undefined;
8534
+ }, {}, {}>;
8535
+ };
8536
+ dialect: "pg";
8537
+ }>;
8538
+ declare const insertAdminUserSchema: import("drizzle-zod").BuildSchema<"insert", {
8539
+ id: import("drizzle-orm/pg-core").PgColumn<{
8540
+ name: "id";
8541
+ tableName: "admin_users";
8542
+ dataType: "string";
8543
+ columnType: "PgUUID";
8544
+ data: string;
8545
+ driverParam: string;
8546
+ notNull: true;
8547
+ hasDefault: true;
8548
+ isPrimaryKey: true;
8549
+ isAutoincrement: false;
8550
+ hasRuntimeDefault: false;
8551
+ enumValues: undefined;
8552
+ baseColumn: never;
8553
+ identity: undefined;
8554
+ generated: undefined;
8555
+ }, {}, {}>;
8556
+ email: import("drizzle-orm/pg-core").PgColumn<{
8557
+ name: "email";
8558
+ tableName: "admin_users";
8559
+ dataType: "string";
8560
+ columnType: "PgVarchar";
8561
+ data: string;
8562
+ driverParam: string;
8563
+ notNull: true;
8564
+ hasDefault: false;
8565
+ isPrimaryKey: false;
8566
+ isAutoincrement: false;
8567
+ hasRuntimeDefault: false;
8568
+ enumValues: [string, ...string[]];
8569
+ baseColumn: never;
8570
+ identity: undefined;
8571
+ generated: undefined;
8572
+ }, {}, {
8573
+ length: number | undefined;
8574
+ }>;
8575
+ username: import("drizzle-orm/pg-core").PgColumn<{
8576
+ name: "username";
8577
+ tableName: "admin_users";
8578
+ dataType: "string";
8579
+ columnType: "PgVarchar";
8580
+ data: string;
8581
+ driverParam: string;
8582
+ notNull: false;
8583
+ hasDefault: false;
8584
+ isPrimaryKey: false;
8585
+ isAutoincrement: false;
8586
+ hasRuntimeDefault: false;
8587
+ enumValues: [string, ...string[]];
8588
+ baseColumn: never;
8589
+ identity: undefined;
8590
+ generated: undefined;
8591
+ }, {}, {
8592
+ length: number | undefined;
8593
+ }>;
8594
+ passwordHash: import("drizzle-orm/pg-core").PgColumn<{
8595
+ name: "password_hash";
8596
+ tableName: "admin_users";
8597
+ dataType: "string";
8598
+ columnType: "PgVarchar";
8599
+ data: string;
8600
+ driverParam: string;
8601
+ notNull: true;
8602
+ hasDefault: false;
8603
+ isPrimaryKey: false;
8604
+ isAutoincrement: false;
8605
+ hasRuntimeDefault: false;
8606
+ enumValues: [string, ...string[]];
8607
+ baseColumn: never;
8608
+ identity: undefined;
8609
+ generated: undefined;
8610
+ }, {}, {
8611
+ length: number | undefined;
8612
+ }>;
8613
+ role: import("drizzle-orm/pg-core").PgColumn<{
8614
+ name: "role";
8615
+ tableName: "admin_users";
8616
+ dataType: "string";
8617
+ columnType: "PgVarchar";
8618
+ data: string;
8619
+ driverParam: string;
8620
+ notNull: true;
8621
+ hasDefault: true;
8622
+ isPrimaryKey: false;
8623
+ isAutoincrement: false;
8624
+ hasRuntimeDefault: false;
8625
+ enumValues: [string, ...string[]];
8626
+ baseColumn: never;
8627
+ identity: undefined;
8628
+ generated: undefined;
8629
+ }, {}, {
8630
+ length: number | undefined;
8631
+ }>;
8632
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
8633
+ name: "created_at";
8634
+ tableName: "admin_users";
8635
+ dataType: "date";
8636
+ columnType: "PgTimestamp";
8637
+ data: Date;
8638
+ driverParam: string;
8639
+ notNull: true;
8640
+ hasDefault: true;
8641
+ isPrimaryKey: false;
8642
+ isAutoincrement: false;
8643
+ hasRuntimeDefault: false;
8644
+ enumValues: undefined;
8645
+ baseColumn: never;
8646
+ identity: undefined;
8647
+ generated: undefined;
8648
+ }, {}, {}>;
8649
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
8650
+ name: "updated_at";
8651
+ tableName: "admin_users";
8652
+ dataType: "date";
8653
+ columnType: "PgTimestamp";
8654
+ data: Date;
8655
+ driverParam: string;
8656
+ notNull: true;
8657
+ hasDefault: true;
8658
+ isPrimaryKey: false;
8659
+ isAutoincrement: false;
8660
+ hasRuntimeDefault: false;
8661
+ enumValues: undefined;
8662
+ baseColumn: never;
8663
+ identity: undefined;
8664
+ generated: undefined;
8665
+ }, {}, {}>;
8666
+ }, undefined, undefined>;
8667
+ declare const selectAdminUserSchema: import("drizzle-zod").BuildSchema<"select", {
8668
+ id: import("drizzle-orm/pg-core").PgColumn<{
8669
+ name: "id";
8670
+ tableName: "admin_users";
8671
+ dataType: "string";
8672
+ columnType: "PgUUID";
8673
+ data: string;
8674
+ driverParam: string;
8675
+ notNull: true;
8676
+ hasDefault: true;
8677
+ isPrimaryKey: true;
8678
+ isAutoincrement: false;
8679
+ hasRuntimeDefault: false;
8680
+ enumValues: undefined;
8681
+ baseColumn: never;
8682
+ identity: undefined;
8683
+ generated: undefined;
8684
+ }, {}, {}>;
8685
+ email: import("drizzle-orm/pg-core").PgColumn<{
8686
+ name: "email";
8687
+ tableName: "admin_users";
8688
+ dataType: "string";
8689
+ columnType: "PgVarchar";
8690
+ data: string;
8691
+ driverParam: string;
8692
+ notNull: true;
8693
+ hasDefault: false;
8694
+ isPrimaryKey: false;
8695
+ isAutoincrement: false;
8696
+ hasRuntimeDefault: false;
8697
+ enumValues: [string, ...string[]];
8698
+ baseColumn: never;
8699
+ identity: undefined;
8700
+ generated: undefined;
8701
+ }, {}, {
8702
+ length: number | undefined;
8703
+ }>;
8704
+ username: import("drizzle-orm/pg-core").PgColumn<{
8705
+ name: "username";
8706
+ tableName: "admin_users";
8707
+ dataType: "string";
8708
+ columnType: "PgVarchar";
8709
+ data: string;
8710
+ driverParam: string;
8711
+ notNull: false;
8712
+ hasDefault: false;
8713
+ isPrimaryKey: false;
8714
+ isAutoincrement: false;
8715
+ hasRuntimeDefault: false;
8716
+ enumValues: [string, ...string[]];
8717
+ baseColumn: never;
8718
+ identity: undefined;
8719
+ generated: undefined;
8720
+ }, {}, {
8721
+ length: number | undefined;
8722
+ }>;
8723
+ passwordHash: import("drizzle-orm/pg-core").PgColumn<{
8724
+ name: "password_hash";
8725
+ tableName: "admin_users";
8726
+ dataType: "string";
8727
+ columnType: "PgVarchar";
8728
+ data: string;
8729
+ driverParam: string;
8730
+ notNull: true;
8731
+ hasDefault: false;
8732
+ isPrimaryKey: false;
8733
+ isAutoincrement: false;
8734
+ hasRuntimeDefault: false;
8735
+ enumValues: [string, ...string[]];
8736
+ baseColumn: never;
8737
+ identity: undefined;
8738
+ generated: undefined;
8739
+ }, {}, {
8740
+ length: number | undefined;
8741
+ }>;
8742
+ role: import("drizzle-orm/pg-core").PgColumn<{
8743
+ name: "role";
8744
+ tableName: "admin_users";
8745
+ dataType: "string";
8746
+ columnType: "PgVarchar";
8747
+ data: string;
8748
+ driverParam: string;
8749
+ notNull: true;
8750
+ hasDefault: true;
8751
+ isPrimaryKey: false;
8752
+ isAutoincrement: false;
8753
+ hasRuntimeDefault: false;
8754
+ enumValues: [string, ...string[]];
8755
+ baseColumn: never;
8756
+ identity: undefined;
8757
+ generated: undefined;
8758
+ }, {}, {
8759
+ length: number | undefined;
8760
+ }>;
8761
+ createdAt: import("drizzle-orm/pg-core").PgColumn<{
8762
+ name: "created_at";
8763
+ tableName: "admin_users";
8764
+ dataType: "date";
8765
+ columnType: "PgTimestamp";
8766
+ data: Date;
8767
+ driverParam: string;
8768
+ notNull: true;
8769
+ hasDefault: true;
8770
+ isPrimaryKey: false;
8771
+ isAutoincrement: false;
8772
+ hasRuntimeDefault: false;
8773
+ enumValues: undefined;
8774
+ baseColumn: never;
8775
+ identity: undefined;
8776
+ generated: undefined;
8777
+ }, {}, {}>;
8778
+ updatedAt: import("drizzle-orm/pg-core").PgColumn<{
8779
+ name: "updated_at";
8780
+ tableName: "admin_users";
8781
+ dataType: "date";
8782
+ columnType: "PgTimestamp";
8783
+ data: Date;
8784
+ driverParam: string;
8785
+ notNull: true;
8786
+ hasDefault: true;
8787
+ isPrimaryKey: false;
8788
+ isAutoincrement: false;
8789
+ hasRuntimeDefault: false;
8790
+ enumValues: undefined;
8791
+ baseColumn: never;
8792
+ identity: undefined;
8793
+ generated: undefined;
8794
+ }, {}, {}>;
8795
+ }, undefined, undefined>;
8382
8796
  declare const insertProjectSchema: import("drizzle-zod").BuildSchema<"insert", {
8383
8797
  id: import("drizzle-orm/pg-core").PgColumn<{
8384
8798
  name: "id";
@@ -11509,7 +11923,7 @@ declare function childLogger(logger: Logger, bindings: Record<string, unknown>):
11509
11923
  //#region src/metrics/index.d.ts
11510
11924
  declare const metrics: {
11511
11925
  messagesPublished: promClient.Counter<"channel" | "priority">;
11512
- messagesProcessed: promClient.Counter<"status" | "worker">;
11926
+ messagesProcessed: promClient.Counter<"worker" | "status">;
11513
11927
  deliverySuccess: promClient.Counter<"channel">;
11514
11928
  deliveryFailed: promClient.Counter<"channel" | "reason">;
11515
11929
  workerActiveTasks: promClient.Gauge<"worker">;
@@ -11847,6 +12261,30 @@ declare class SegmentRepository {
11847
12261
  constructor(db: Db);
11848
12262
  listSegments(projectId: string): Promise<string[]>;
11849
12263
  }
12264
+ interface AdminUserRecord {
12265
+ id: string;
12266
+ email: string;
12267
+ username: string | null;
12268
+ passwordHash: string;
12269
+ role: string;
12270
+ createdAt: Date;
12271
+ updatedAt: Date;
12272
+ }
12273
+ declare class AdminUserRepository {
12274
+ private readonly db;
12275
+ constructor(db: Db);
12276
+ findByEmailOrUsername(identifier: string): Promise<AdminUserRecord | null>;
12277
+ findById(id: string): Promise<AdminUserRecord | null>;
12278
+ create(data: {
12279
+ email: string;
12280
+ username?: string | null;
12281
+ passwordHash: string;
12282
+ role?: string;
12283
+ }): Promise<AdminUserRecord>;
12284
+ updatePassword(id: string, passwordHash: string): Promise<boolean>;
12285
+ list(): Promise<Omit<AdminUserRecord, "passwordHash">[]>;
12286
+ count(): Promise<number>;
12287
+ }
11850
12288
  //#endregion
11851
12289
  //#region src/shared/events.d.ts
11852
12290
  declare const globalEmitter: EventEmitter<[never]>;
@@ -12518,5 +12956,5 @@ declare class NotifkitServer extends EventEmitter {
12518
12956
  stop(): Promise<void>;
12519
12957
  }
12520
12958
  //#endregion
12521
- export { AI_DEFAULTS, AddContactInput, AddContactSchema, AddUserInput, AddUserSchema, AiConfig, AppError, AsyncSemaphore, BaseConfig, BaseWorker, BatchAddContactsInput, BatchAddContactsSchema, BatchItem, BatchProcessor, CONSUMER_GROUPS, CircuitBreaker, CircuitBreakerOptions, ConsumerGroup, ContactChannel, ContactChannelSchema, ContactRepository, CreateWorkflowInput, CreateWorkflowSchema, DLQMessageRecord, DataLoader, DatabaseClients, DatabaseOptions, Db, DeliveryOptions, DeliveryOptionsSchema, DeliveryResult, DevicePlatform, DeviceToken, ENRICHED_STREAMS, EscapeMode, EventEnvelope, EventEnvelopeSchema, EventMetadata, EventMetadataSchema, EventPayloadMap, EventRegistry, INBOUND_STREAMS, IdempotencyGuard, IdempotencyOptions, IngestEventInput, IngestEventSchema, InlineUser, InlineUserSchema, KnownEventType, LRUCache, LUA_RELEASE_LOCK, LUA_RENEW_LOCK, LUA_SCHEDULER_CLAIM, LUA_SCHEDULER_POLL, LogLevel, Logger, LoggerOptions, NonRetryableError, NotificationAiPendingPayload, NotificationAiPendingPayloadSchema, NotificationCanceledPayload, NotificationCanceledPayloadSchema, NotificationChannel, NotificationChannelSchema, NotificationCreatedPayload, NotificationCreatedPayloadSchema, NotificationDeliveredPayload, NotificationDeliveredPayloadSchema, NotificationDispatchedPayload, NotificationDispatchedPayloadSchema, NotificationEnrichedPayload, NotificationEnrichedPayloadSchema, NotificationFailedPayload, NotificationFailedPayloadSchema, NotificationLogRecord, NotificationPreference, NotificationPriority, NotificationPrioritySchema, NotificationRequestedPayload, NotificationRequestedPayloadSchema, NotificationScheduledPayload, NotificationScheduledPayloadSchema, NotificationSkippedPayload, NotificationSkippedPayloadSchema, NotificationStatus, NotificationStatusSchema, NotificationTarget, NotificationTargetSchema, NotifkitClient, NotifkitClientOptions, NotifkitOptions, NotifkitServer, NotifyRequestInput, NotifyRequestSchema, OUTBOUND_STREAMS, PUBSUB_CHANNELS, ParseResult, PendingEntry, PendingMessageScanner, PendingMessageScannerOptions, PreferenceRepository, Preferences, PreferencesSchema, ProjectKeyRecord, ProjectRecord, ProjectRepository, ProjectSettingsCache, ProjectSettingsCacheOptions, ProjectThrottleSettings, PubSubChannel, QuietHours, QuietHoursSchema, RateLimitConfig, RecipientProfile, RecipientProfileSchema, Redis, RedisClient, RedisClientOptions, type RedisOptions, RenderedContent, RenderedContentSchema, STREAMS, SegmentRepository, Sql, StreamConsumer, StreamConsumerOptions, StreamEvent, StreamEventMetadata, StreamEventMetadataSchema, StreamEventSchema, StreamMessage, StreamName, StreamProducer, StreamProducerOptions, SuppressionRecord, SuspendExecutionError, SyncTemplatesInput, SyncTemplatesSchema, SystemHealthRecord, SystemMetricsRecord, TemplateCache, TemplateContext, TemplateInput, TemplateRecord, TemplateRecordResponse, TemplateRenderer, TemplateRepository, TemplateSchema, ThrottleCheckOptions, ThrottleResult, Transport, TriggerWorkflowInput, TriggerWorkflowSchema, TypedEventEnvelope, UnsubscribeClaim, UnsubscribeHeaderOptions, UpdateProjectInput, UpdateProjectSchema, UpdateUserInput, UpdateUserSchema, UserContact, UserContactInput, UserContactInputSchema, UserContactResponse, UserDetailResponse, UserProfile, UserProfileResponse, UserRecord, UserRepository, UserResponse, UserThrottle, UserThrottleOptions, ValidationError, WebhookEvent, WorkerHealth, WorkerOptions, WorkerState, WorkflowContext, WorkflowDefinitionRecord, WorkflowEvent, WorkflowInstanceRecord, WorkflowNotifyInput, WorkflowNotifyPayloadSchema, WorkflowNotifyResult, WorkflowRepository, WorkflowStepContext, WorkflowStepDef, WorkflowStepSchema, baseConfigSchema, buildStepNotifyPayload, buildStreamEvent, buildUnsubscribeHeaders, childLogger, createDatabase, createLogger, escapeHeader, escapeHtml, generateId, getAiConfig, getMetricsRegistry, getPriorityBucket, globalEmitter, interpolate, loadEnv, metrics, normaliseTarget, parseConfig, readBaseConfig, registerTransport, registry, renderTemplate, renderWithTemplate, resolveStepTarget, runMigrations, setAiConfig, setGlobalConfig, signUnsubscribeToken, sleep, startHealthReporter, templateRegistry, transportRegistry, verifyUnsubscribeToken, withContext, withRequestId, workflow, workflowRegistry };
12959
+ export { AI_DEFAULTS, AddContactInput, AddContactSchema, AddUserInput, AddUserSchema, AdminUserRecord, AdminUserRepository, AiConfig, AppError, AsyncSemaphore, BaseConfig, BaseWorker, BatchAddContactsInput, BatchAddContactsSchema, BatchItem, BatchProcessor, CONSUMER_GROUPS, CircuitBreaker, CircuitBreakerOptions, ConsumerGroup, ContactChannel, ContactChannelSchema, ContactRepository, CreateWorkflowInput, CreateWorkflowSchema, DLQMessageRecord, DataLoader, DatabaseClients, DatabaseOptions, Db, DeliveryOptions, DeliveryOptionsSchema, DeliveryResult, DevicePlatform, DeviceToken, ENRICHED_STREAMS, EscapeMode, EventEnvelope, EventEnvelopeSchema, EventMetadata, EventMetadataSchema, EventPayloadMap, EventRegistry, INBOUND_STREAMS, IdempotencyGuard, IdempotencyOptions, IngestEventInput, IngestEventSchema, InlineUser, InlineUserSchema, KnownEventType, LRUCache, LUA_RELEASE_LOCK, LUA_RENEW_LOCK, LUA_SCHEDULER_CLAIM, LUA_SCHEDULER_POLL, LogLevel, Logger, LoggerOptions, NonRetryableError, NotificationAiPendingPayload, NotificationAiPendingPayloadSchema, NotificationCanceledPayload, NotificationCanceledPayloadSchema, NotificationChannel, NotificationChannelSchema, NotificationCreatedPayload, NotificationCreatedPayloadSchema, NotificationDeliveredPayload, NotificationDeliveredPayloadSchema, NotificationDispatchedPayload, NotificationDispatchedPayloadSchema, NotificationEnrichedPayload, NotificationEnrichedPayloadSchema, NotificationFailedPayload, NotificationFailedPayloadSchema, NotificationLogRecord, NotificationPreference, NotificationPriority, NotificationPrioritySchema, NotificationRequestedPayload, NotificationRequestedPayloadSchema, NotificationScheduledPayload, NotificationScheduledPayloadSchema, NotificationSkippedPayload, NotificationSkippedPayloadSchema, NotificationStatus, NotificationStatusSchema, NotificationTarget, NotificationTargetSchema, NotifkitClient, NotifkitClientOptions, NotifkitOptions, NotifkitServer, NotifyRequestInput, NotifyRequestSchema, OUTBOUND_STREAMS, PUBSUB_CHANNELS, ParseResult, PendingEntry, PendingMessageScanner, PendingMessageScannerOptions, PreferenceRepository, Preferences, PreferencesSchema, ProjectKeyRecord, ProjectRecord, ProjectRepository, ProjectSettingsCache, ProjectSettingsCacheOptions, ProjectThrottleSettings, PubSubChannel, QuietHours, QuietHoursSchema, RateLimitConfig, RecipientProfile, RecipientProfileSchema, Redis, RedisClient, RedisClientOptions, type RedisOptions, RenderedContent, RenderedContentSchema, STREAMS, SegmentRepository, Sql, StreamConsumer, StreamConsumerOptions, StreamEvent, StreamEventMetadata, StreamEventMetadataSchema, StreamEventSchema, StreamMessage, StreamName, StreamProducer, StreamProducerOptions, SuppressionRecord, SuspendExecutionError, SyncTemplatesInput, SyncTemplatesSchema, SystemHealthRecord, SystemMetricsRecord, TemplateCache, TemplateContext, TemplateInput, TemplateRecord, TemplateRecordResponse, TemplateRenderer, TemplateRepository, TemplateSchema, ThrottleCheckOptions, ThrottleResult, Transport, TriggerWorkflowInput, TriggerWorkflowSchema, TypedEventEnvelope, UnsubscribeClaim, UnsubscribeHeaderOptions, UpdateProjectInput, UpdateProjectSchema, UpdateUserInput, UpdateUserSchema, UserContact, UserContactInput, UserContactInputSchema, UserContactResponse, UserDetailResponse, UserProfile, UserProfileResponse, UserRecord, UserRepository, UserResponse, UserThrottle, UserThrottleOptions, ValidationError, WebhookEvent, WorkerHealth, WorkerOptions, WorkerState, WorkflowContext, WorkflowDefinitionRecord, WorkflowEvent, WorkflowInstanceRecord, WorkflowNotifyInput, WorkflowNotifyPayloadSchema, WorkflowNotifyResult, WorkflowRepository, WorkflowStepContext, WorkflowStepDef, WorkflowStepSchema, baseConfigSchema, buildStepNotifyPayload, buildStreamEvent, buildUnsubscribeHeaders, childLogger, createDatabase, createLogger, escapeHeader, escapeHtml, generateId, getAiConfig, getMetricsRegistry, getPriorityBucket, globalEmitter, interpolate, loadEnv, metrics, normaliseTarget, parseConfig, readBaseConfig, registerTransport, registry, renderTemplate, renderWithTemplate, resolveStepTarget, runMigrations, setAiConfig, setGlobalConfig, signUnsubscribeToken, sleep, startHealthReporter, templateRegistry, transportRegistry, verifyUnsubscribeToken, withContext, withRequestId, workflow, workflowRegistry };
12522
12960
  //# sourceMappingURL=index.d.mts.map