@voyantjs/notifications 0.4.2 → 0.4.4

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/dist/index.d.ts CHANGED
@@ -17,6 +17,6 @@ export type { BookingDocumentAttachmentResolver, BookingDocumentsSentEvent, Send
17
17
  export { bookingDocumentNotificationsService } from "./service-booking-documents.js";
18
18
  export { sendDueNotificationReminders } from "./tasks/index.js";
19
19
  export type { NotificationAttachment, NotificationChannel, NotificationPayload, NotificationProvider, NotificationResult, } from "./types.js";
20
- export { bookingDocumentBundleItemSchema, bookingDocumentBundleSchema, insertNotificationReminderRuleSchema, insertNotificationTemplateSchema, notificationAttachmentSchema, notificationChannelSchema, notificationDeliveryListQuerySchema, notificationDeliveryStatusSchema, notificationDocumentSourceSchema, notificationDocumentTypeSchema, notificationReminderRuleListQuerySchema, notificationReminderRunListQuerySchema, notificationReminderRunStatusSchema, notificationReminderStatusSchema, notificationReminderTargetTypeSchema, notificationTargetTypeSchema, notificationTemplateListQuerySchema, notificationTemplateStatusSchema, runDueRemindersSchema, sendBookingDocumentsNotificationResultSchema, sendBookingDocumentsNotificationSchema, sendInvoiceNotificationSchema, sendNotificationSchema, sendPaymentSessionNotificationSchema, updateNotificationReminderRuleSchema, updateNotificationTemplateSchema, } from "./validation.js";
20
+ export { bookingDocumentBundleItemSchema, bookingDocumentBundleSchema, insertNotificationReminderRuleSchema, insertNotificationTemplateSchema, notificationAttachmentSchema, notificationChannelSchema, notificationDeliveryListQuerySchema, notificationDeliveryStatusSchema, notificationDocumentSourceSchema, notificationDocumentTypeSchema, notificationReminderRuleListQuerySchema, notificationReminderRunDeliverySummarySchema, notificationReminderRunLinksSchema, notificationReminderRunListQuerySchema, notificationReminderRunListResponseSchema, notificationReminderRunRecordSchema, notificationReminderRunRuleSummarySchema, notificationReminderRunStatusSchema, notificationReminderStatusSchema, notificationReminderTargetTypeSchema, notificationTargetTypeSchema, notificationTemplateListQuerySchema, notificationTemplateStatusSchema, runDueRemindersSchema, sendBookingDocumentsNotificationResultSchema, sendBookingDocumentsNotificationSchema, sendInvoiceNotificationSchema, sendNotificationSchema, sendPaymentSessionNotificationSchema, updateNotificationReminderRuleSchema, updateNotificationTemplateSchema, } from "./validation.js";
21
21
  export declare function createNotificationsHonoModule(options?: Parameters<typeof createNotificationsRoutes>[0]): HonoModule;
22
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAEvD,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAGvD,YAAY,EAAE,kCAAkC,EAAE,MAAM,0BAA0B,CAAA;AAClF,OAAO,EACL,kCAAkC,EAClC,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,0BAA0B,CAAA;AACjC,YAAY,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,YAAY,EACV,WAAW,EACX,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAC5D,YAAY,EAAE,WAAW,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAClG,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AACvD,YAAY,EACV,uBAAuB,EACvB,2BAA2B,EAC3B,0BAA0B,EAC1B,uBAAuB,EACvB,oBAAoB,EACpB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,aAAa,CAAA;AAEpB,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,8BAA8B,E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B,EACzB,kCAAkC,GACnC,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAE,mCAAmC,EAAE,MAAM,gCAAgC,CAAA;AACpF,OAAO,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAA;AAC/D,YAAY,EACV,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,+BAA+B,EAC/B,2BAA2B,EAC3B,oCAAoC,EACpC,gCAAgC,EAChC,4BAA4B,EAC5B,yBAAyB,EACzB,mCAAmC,EACnC,gCAAgC,EAChC,gCAAgC,EAChC,8BAA8B,EAC9B,uCAAuC,EACvC,4CAA4C,EAC5C,kCAAkC,EAClC,sCAAsC,EACtC,yCAAyC,EACzC,mCAAmC,EACnC,wCAAwC,EACxC,mCAAmC,EACnC,gCAAgC,EAChC,oCAAoC,EACpC,4BAA4B,EAC5B,mCAAmC,EACnC,gCAAgC,EAChC,qBAAqB,EACrB,4CAA4C,EAC5C,sCAAsC,EACtC,6BAA6B,EAC7B,sBAAsB,EACtB,oCAAoC,EACpC,oCAAoC,EACpC,gCAAgC,GACjC,MAAM,iBAAiB,CAAA;AAExB,wBAAgB,6BAA6B,CAC3C,OAAO,CAAC,EAAE,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC,CAAC,CAAC,GACxD,UAAU,CAKZ"}
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ export { notificationChannelEnum, notificationDeliveries, notificationDeliverySt
9
9
  export { createDefaultBookingDocumentAttachment, createNotificationService, NotificationError, notificationsService, renderNotificationTemplate, } from "./service.js";
10
10
  export { bookingDocumentNotificationsService } from "./service-booking-documents.js";
11
11
  export { sendDueNotificationReminders } from "./tasks/index.js";
12
- export { bookingDocumentBundleItemSchema, bookingDocumentBundleSchema, insertNotificationReminderRuleSchema, insertNotificationTemplateSchema, notificationAttachmentSchema, notificationChannelSchema, notificationDeliveryListQuerySchema, notificationDeliveryStatusSchema, notificationDocumentSourceSchema, notificationDocumentTypeSchema, notificationReminderRuleListQuerySchema, notificationReminderRunListQuerySchema, notificationReminderRunStatusSchema, notificationReminderStatusSchema, notificationReminderTargetTypeSchema, notificationTargetTypeSchema, notificationTemplateListQuerySchema, notificationTemplateStatusSchema, runDueRemindersSchema, sendBookingDocumentsNotificationResultSchema, sendBookingDocumentsNotificationSchema, sendInvoiceNotificationSchema, sendNotificationSchema, sendPaymentSessionNotificationSchema, updateNotificationReminderRuleSchema, updateNotificationTemplateSchema, } from "./validation.js";
12
+ export { bookingDocumentBundleItemSchema, bookingDocumentBundleSchema, insertNotificationReminderRuleSchema, insertNotificationTemplateSchema, notificationAttachmentSchema, notificationChannelSchema, notificationDeliveryListQuerySchema, notificationDeliveryStatusSchema, notificationDocumentSourceSchema, notificationDocumentTypeSchema, notificationReminderRuleListQuerySchema, notificationReminderRunDeliverySummarySchema, notificationReminderRunLinksSchema, notificationReminderRunListQuerySchema, notificationReminderRunListResponseSchema, notificationReminderRunRecordSchema, notificationReminderRunRuleSummarySchema, notificationReminderRunStatusSchema, notificationReminderStatusSchema, notificationReminderTargetTypeSchema, notificationTargetTypeSchema, notificationTemplateListQuerySchema, notificationTemplateStatusSchema, runDueRemindersSchema, sendBookingDocumentsNotificationResultSchema, sendBookingDocumentsNotificationSchema, sendInvoiceNotificationSchema, sendNotificationSchema, sendPaymentSessionNotificationSchema, updateNotificationReminderRuleSchema, updateNotificationTemplateSchema, } from "./validation.js";
13
13
  export function createNotificationsHonoModule(options) {
14
14
  return {
15
15
  module: notificationsModule,
package/dist/routes.d.ts CHANGED
@@ -421,11 +421,6 @@ export declare function createNotificationsRoutes(options?: {
421
421
  targetType: "invoice" | "booking_payment_schedule";
422
422
  targetId: string;
423
423
  dedupeKey: string;
424
- bookingId: string | null;
425
- personId: string | null;
426
- organizationId: string | null;
427
- paymentSessionId: string | null;
428
- notificationDeliveryId: string | null;
429
424
  status: "failed" | "sent" | "processing" | "skipped";
430
425
  recipient: string | null;
431
426
  scheduledFor: string;
@@ -436,6 +431,38 @@ export declare function createNotificationsRoutes(options?: {
436
431
  } | null;
437
432
  createdAt: string;
438
433
  updatedAt: string;
434
+ links: {
435
+ bookingId: string | null;
436
+ bookingPaymentScheduleId: string | null;
437
+ invoiceId: string | null;
438
+ paymentSessionId: string | null;
439
+ personId: string | null;
440
+ organizationId: string | null;
441
+ notificationDeliveryId: string | null;
442
+ };
443
+ reminderRule: {
444
+ id: string;
445
+ slug: string;
446
+ name: string;
447
+ status: "draft" | "active" | "archived";
448
+ targetType: "invoice" | "booking_payment_schedule";
449
+ channel: "email" | "sms";
450
+ provider: string | null;
451
+ templateId: string | null;
452
+ templateSlug: string | null;
453
+ relativeDaysFromDueDate: number;
454
+ };
455
+ delivery: {
456
+ id: string;
457
+ status: "cancelled" | "pending" | "failed" | "sent";
458
+ channel: "email" | "sms";
459
+ provider: string;
460
+ toAddress: string;
461
+ subject: string | null;
462
+ sentAt: string | null;
463
+ failedAt: string | null;
464
+ errorMessage: string | null;
465
+ } | null;
439
466
  }[];
440
467
  total: number;
441
468
  limit: number;
@@ -445,6 +472,80 @@ export declare function createNotificationsRoutes(options?: {
445
472
  status: import("hono/utils/http-status").ContentfulStatusCode;
446
473
  };
447
474
  };
475
+ } & {
476
+ "/reminder-runs/:id": {
477
+ $get: {
478
+ input: {
479
+ param: {
480
+ id: string;
481
+ };
482
+ };
483
+ output: {
484
+ error: string;
485
+ };
486
+ outputFormat: "json";
487
+ status: 404;
488
+ } | {
489
+ input: {
490
+ param: {
491
+ id: string;
492
+ };
493
+ };
494
+ output: {
495
+ data: {
496
+ id: string;
497
+ reminderRuleId: string;
498
+ targetType: "invoice" | "booking_payment_schedule";
499
+ targetId: string;
500
+ dedupeKey: string;
501
+ status: "failed" | "sent" | "processing" | "skipped";
502
+ recipient: string | null;
503
+ scheduledFor: string;
504
+ processedAt: string;
505
+ errorMessage: string | null;
506
+ metadata: {
507
+ [x: string]: import("hono/utils/types").JSONValue;
508
+ } | null;
509
+ createdAt: string;
510
+ updatedAt: string;
511
+ links: {
512
+ bookingId: string | null;
513
+ bookingPaymentScheduleId: string | null;
514
+ invoiceId: string | null;
515
+ paymentSessionId: string | null;
516
+ personId: string | null;
517
+ organizationId: string | null;
518
+ notificationDeliveryId: string | null;
519
+ };
520
+ reminderRule: {
521
+ id: string;
522
+ slug: string;
523
+ name: string;
524
+ status: "draft" | "active" | "archived";
525
+ targetType: "invoice" | "booking_payment_schedule";
526
+ channel: "email" | "sms";
527
+ provider: string | null;
528
+ templateId: string | null;
529
+ templateSlug: string | null;
530
+ relativeDaysFromDueDate: number;
531
+ };
532
+ delivery: {
533
+ id: string;
534
+ status: "cancelled" | "pending" | "failed" | "sent";
535
+ channel: "email" | "sms";
536
+ provider: string;
537
+ toAddress: string;
538
+ subject: string | null;
539
+ sentAt: string | null;
540
+ failedAt: string | null;
541
+ errorMessage: string | null;
542
+ } | null;
543
+ };
544
+ };
545
+ outputFormat: "json";
546
+ status: import("hono/utils/http-status").ContentfulStatusCode;
547
+ };
548
+ };
448
549
  } & {
449
550
  "/reminders/run-due": {
450
551
  $post: {
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAIjE,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,gCAAgC,CAAA;AACvF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAmBtD,KAAK,GAAG,GAAG;IACT,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,SAAS,EAAE;QACT,EAAE,EAAE,kBAAkB,CAAA;QACtB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF,CAAA;AAED,wBAAgB,yBAAy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A;CAC9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAyMA"}
package/dist/routes.js CHANGED
@@ -56,6 +56,12 @@ export function createNotificationsRoutes(options) {
56
56
  .get("/reminder-runs", async (c) => {
57
57
  const query = notificationReminderRunListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
58
58
  return c.json(await notificationsService.listReminderRuns(c.get("db"), query));
59
+ })
60
+ .get("/reminder-runs/:id", async (c) => {
61
+ const row = await notificationsService.getReminderRunById(c.get("db"), c.req.param("id"));
62
+ if (!row)
63
+ return c.json({ error: "Notification reminder run not found" }, 404);
64
+ return c.json({ data: row });
59
65
  })
60
66
  .post("/reminders/run-due", async (c) => {
61
67
  try {
@@ -4,7 +4,7 @@ import type { SQLWrapper } from "drizzle-orm/sql";
4
4
  import type { z } from "zod";
5
5
  import type { notificationReminderRules } from "./schema.js";
6
6
  import type { NotificationAttachment, NotificationChannel, NotificationPayload, NotificationProvider, NotificationResult } from "./types.js";
7
- import type { bookingDocumentBundleItemSchema, insertNotificationReminderRuleSchema, insertNotificationTemplateSchema, notificationDeliveryListQuerySchema, notificationReminderRuleListQuerySchema, notificationReminderRunListQuerySchema, notificationTemplateListQuerySchema, runDueRemindersSchema, sendBookingDocumentsNotificationSchema, sendInvoiceNotificationSchema, sendNotificationSchema, sendPaymentSessionNotificationSchema, updateNotificationReminderRuleSchema, updateNotificationTemplateSchema } from "./validation.js";
7
+ import type { bookingDocumentBundleItemSchema, insertNotificationReminderRuleSchema, insertNotificationTemplateSchema, notificationDeliveryListQuerySchema, notificationReminderRuleListQuerySchema, notificationReminderRunListQuerySchema, notificationReminderRunRecordSchema, notificationTemplateListQuerySchema, runDueRemindersSchema, sendBookingDocumentsNotificationSchema, sendInvoiceNotificationSchema, sendNotificationSchema, sendPaymentSessionNotificationSchema, updateNotificationReminderRuleSchema, updateNotificationTemplateSchema } from "./validation.js";
8
8
  export type NotificationTemplateListQuery = z.infer<typeof notificationTemplateListQuerySchema>;
9
9
  export type NotificationDeliveryListQuery = z.infer<typeof notificationDeliveryListQuerySchema>;
10
10
  export type CreateNotificationTemplateInput = z.infer<typeof insertNotificationTemplateSchema>;
@@ -12,6 +12,7 @@ export type UpdateNotificationTemplateInput = z.infer<typeof updateNotificationT
12
12
  export type SendNotificationInput = z.infer<typeof sendNotificationSchema>;
13
13
  export type NotificationReminderRuleListQuery = z.infer<typeof notificationReminderRuleListQuerySchema>;
14
14
  export type NotificationReminderRunListQuery = z.infer<typeof notificationReminderRunListQuerySchema>;
15
+ export type NotificationReminderRunRecord = z.infer<typeof notificationReminderRunRecordSchema>;
15
16
  export type CreateNotificationReminderRuleInput = z.infer<typeof insertNotificationReminderRuleSchema>;
16
17
  export type UpdateNotificationReminderRuleInput = z.infer<typeof updateNotificationReminderRuleSchema>;
17
18
  export type RunDueRemindersInput = z.infer<typeof runDueRemindersSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"service-shared.d.ts","sourceRoot":"","sources":["../src/service-shared.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAEhE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAE5B,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,KAAK,EACV,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EACV,+BAA+B,EAC/B,oCAAoC,EACpC,gCAAgC,EAChC,mCAAmC,EACnC,uCAAuC,EACvC,sCAAsC,EACtC,mCAAmC,EACnC,qBAAqB,EACrB,sCAAsC,EACtC,6BAA6B,EAC7B,sBAAsB,EACtB,oCAAoC,EACpC,oCAAoC,EACpC,gCAAgC,EACjC,MAAM,iBAAiB,CAAA;AAExB,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAA;AAC/F,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAA;AAC/F,MAAM,MAAM,+BAA+B,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,EAAE,MAAM,QAEnD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,IAAI,UAEvC;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,UAEvF;AAED,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,KAAK,CAAC;IAClB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,SAAS,EAAE,OAAO,CAAA;IAClB,eAAe,EAAE,MAAM,CAAA;IACvB,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAC;WALO,MAAM,GAAG,IAAI;eACT,OAAO;qBACD,MAAM;eACZ,MAAM;cACP,MAAM;SAsBnB;AAED,wBAAsB,mCAAmC,CACvD,EAAE,EAAE,kBAAkB,EACtB,SAAS,EAAE,MAAM;;;;;;;KAclB;AAED,wBAAsB,QAAQ,CAAC,CAAC,EAC9B,WAAW,EAAE,OAAO,CAAC,CAAC,EAAE,CAAC,EACzB,YAAY,EAAE,OAAO,CAAC,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,EAC/C,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM;;;;;GASf;AAED,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,UAAU,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,GAAG,SAAS,CAAC,kDAGtF"}
@@ -161,22 +161,96 @@ export declare function listReminderRuns(db: PostgresJsDatabase, query: Notifica
161
161
  targetType: "invoice" | "booking_payment_schedule";
162
162
  targetId: string;
163
163
  dedupeKey: string;
164
- bookingId: string | null;
165
- personId: string | null;
166
- organizationId: string | null;
167
- paymentSessionId: string | null;
168
- notificationDeliveryId: string | null;
169
164
  status: "failed" | "sent" | "processing" | "skipped";
170
165
  recipient: string | null;
171
- scheduledFor: Date;
172
- processedAt: Date;
166
+ scheduledFor: string;
167
+ processedAt: string;
173
168
  errorMessage: string | null;
174
169
  metadata: Record<string, unknown> | null;
175
- createdAt: Date;
176
- updatedAt: Date;
170
+ createdAt: string;
171
+ updatedAt: string;
172
+ links: {
173
+ bookingId: string | null;
174
+ bookingPaymentScheduleId: string | null;
175
+ invoiceId: string | null;
176
+ paymentSessionId: string | null;
177
+ personId: string | null;
178
+ organizationId: string | null;
179
+ notificationDeliveryId: string | null;
180
+ };
181
+ reminderRule: {
182
+ id: string;
183
+ slug: string;
184
+ name: string;
185
+ status: "draft" | "active" | "archived";
186
+ targetType: "invoice" | "booking_payment_schedule";
187
+ channel: "email" | "sms";
188
+ provider: string | null;
189
+ templateId: string | null;
190
+ templateSlug: string | null;
191
+ relativeDaysFromDueDate: number;
192
+ };
193
+ delivery: {
194
+ id: string;
195
+ status: "cancelled" | "pending" | "failed" | "sent";
196
+ channel: "email" | "sms";
197
+ provider: string;
198
+ toAddress: string;
199
+ subject: string | null;
200
+ sentAt: string | null;
201
+ failedAt: string | null;
202
+ errorMessage: string | null;
203
+ } | null;
177
204
  }[];
178
205
  total: number;
179
206
  limit: number;
180
207
  offset: number;
181
208
  }>;
209
+ export declare function getReminderRunById(db: PostgresJsDatabase, id: string): Promise<{
210
+ id: string;
211
+ reminderRuleId: string;
212
+ targetType: "invoice" | "booking_payment_schedule";
213
+ targetId: string;
214
+ dedupeKey: string;
215
+ status: "failed" | "sent" | "processing" | "skipped";
216
+ recipient: string | null;
217
+ scheduledFor: string;
218
+ processedAt: string;
219
+ errorMessage: string | null;
220
+ metadata: Record<string, unknown> | null;
221
+ createdAt: string;
222
+ updatedAt: string;
223
+ links: {
224
+ bookingId: string | null;
225
+ bookingPaymentScheduleId: string | null;
226
+ invoiceId: string | null;
227
+ paymentSessionId: string | null;
228
+ personId: string | null;
229
+ organizationId: string | null;
230
+ notificationDeliveryId: string | null;
231
+ };
232
+ reminderRule: {
233
+ id: string;
234
+ slug: string;
235
+ name: string;
236
+ status: "draft" | "active" | "archived";
237
+ targetType: "invoice" | "booking_payment_schedule";
238
+ channel: "email" | "sms";
239
+ provider: string | null;
240
+ templateId: string | null;
241
+ templateSlug: string | null;
242
+ relativeDaysFromDueDate: number;
243
+ };
244
+ delivery: {
245
+ id: string;
246
+ status: "cancelled" | "pending" | "failed" | "sent";
247
+ channel: "email" | "sms";
248
+ provider: string;
249
+ toAddress: string;
250
+ subject: string | null;
251
+ sentAt: string | null;
252
+ failedAt: string | null;
253
+ errorMessage: string | null;
254
+ } | null;
255
+ } | null>;
182
256
  //# sourceMappingURL=service-templates.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"service-templates.d.ts","sourceRoot":"","sources":["../src/service-templates.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAOjE,OAAO,KAAK,EACV,mCAAmC,EACnC,+BAA+B,EAC/B,iCAAiC,EACjC,gCAAgC,EAChC,6BAA6B,EAC7B,mCAAmC,EACnC,+BAA+B,EAChC,MAAM,qBAAqB,CAAA;AAG5B,wBAAsB,aAAa,CAAC,EAAE,EAAE,kBAAkB,EAAE,KAAK,EAAE,6BAA6B;;;;;;;;;;;;;;;;;;;;GAyB/F;AAED,wBAAsB,eAAe,CAAC,EAAE,EAAE,kBAAkB,EAAE,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;UAOvE;AAED,wBAAsB,iBAAiB,CAAC,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,MAAM;;;;;;;;;;;;;;;UAO3E;AAED,wBAAsB,cAAc,CAClC,EAAE,EAAE,kBAAkB,EACtB,IAAI,EAAE,+BAA+B;;;;;;;;;;;;;;;UAItC;AAED,wBAAsB,cAAc,CAClC,EAAE,EAAE,kBAAkB,EACtB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,+BAA+B;;;;;;;;;;;;;;;UAQtC;AAED,wBAAsB,iBAAiB,CACrC,EAAE,EAAE,kBAAkB,EACtB,KAAK,EAAE,iCAAiC;;;;;;;;;;;;;;;;;;;;GA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wBAAsB,iBAAiB,CACrC,EAAE,EAAE,kBAAkB,EACtB,KAAK,EAAE,iCAAiC;;;;;;;;;;;;;;;;;;;;GA0BzC;AAED,wBAAsB,mBAAmB,CAAC,EAAE,EAAE,kBAAkB,EAAE,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;UAO3E;AAED,wBAAsB,kBAAkB,CACtC,EAAE,EAAE,kBAAkB,EACtB,IAAI,EAAE,mCAAmC;;;;;;;;;;;;;;;UAI1C;AAED,wBAAsB,kBAAkB,CACtC,EAAE,EAAE,kBAAkB,EACtB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,mCAAmC;;;;;;;;;;;;;;;UAQ1C;AAED,wBAAsB,gBAAgB,CACpC,EAAE,EAAE,kBAAkB,EACtB,KAAK,EAAE,gCAAgC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqGxC;AAED,wBAAsB,kBAAkB,CAAC,EAAE,EAAE,kBAAkB,EAAE,EAAE,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAqD1E"}
@@ -1,6 +1,66 @@
1
- import { desc, eq, ilike, or, sql } from "drizzle-orm";
2
- import { notificationReminderRules, notificationReminderRuns, notificationTemplates, } from "./schema.js";
1
+ import { and, desc, eq, ilike, or, sql } from "drizzle-orm";
2
+ import { notificationDeliveries, notificationReminderRules, notificationReminderRuns, notificationTemplates, } from "./schema.js";
3
3
  import { buildWhereClause, paginate } from "./service-shared.js";
4
+ function normalizeDateTime(value) {
5
+ if (!value)
6
+ return null;
7
+ return value instanceof Date ? value.toISOString() : value;
8
+ }
9
+ function normalizeReminderRun(row) {
10
+ return {
11
+ id: row.id,
12
+ reminderRuleId: row.reminderRuleId,
13
+ targetType: row.targetType,
14
+ targetId: row.targetId,
15
+ dedupeKey: row.dedupeKey,
16
+ status: row.status,
17
+ recipient: row.recipient ?? null,
18
+ scheduledFor: normalizeDateTime(row.scheduledFor),
19
+ processedAt: normalizeDateTime(row.processedAt),
20
+ errorMessage: row.errorMessage ?? null,
21
+ metadata: row.metadata ?? null,
22
+ createdAt: normalizeDateTime(row.createdAt),
23
+ updatedAt: normalizeDateTime(row.updatedAt),
24
+ links: {
25
+ bookingId: row.bookingId ?? null,
26
+ bookingPaymentScheduleId: row.targetType === "booking_payment_schedule" ? row.targetId : null,
27
+ invoiceId: row.targetType === "invoice" ? row.targetId : null,
28
+ paymentSessionId: row.paymentSessionId ?? null,
29
+ personId: row.personId ?? null,
30
+ organizationId: row.organizationId ?? null,
31
+ notificationDeliveryId: row.notificationDeliveryId ?? null,
32
+ },
33
+ reminderRule: {
34
+ id: row.reminderRuleId,
35
+ slug: row.ruleSlug,
36
+ name: row.ruleName,
37
+ status: row.ruleStatus,
38
+ targetType: row.ruleTargetType,
39
+ channel: row.ruleChannel,
40
+ provider: row.ruleProvider ?? null,
41
+ templateId: row.ruleTemplateId ?? null,
42
+ templateSlug: row.ruleTemplateSlug ?? null,
43
+ relativeDaysFromDueDate: row.relativeDaysFromDueDate,
44
+ },
45
+ delivery: row.deliveryId &&
46
+ row.deliveryStatus &&
47
+ row.deliveryChannel &&
48
+ row.deliveryProvider &&
49
+ row.toAddress
50
+ ? {
51
+ id: row.deliveryId,
52
+ status: row.deliveryStatus,
53
+ channel: row.deliveryChannel,
54
+ provider: row.deliveryProvider,
55
+ toAddress: row.toAddress,
56
+ subject: row.deliverySubject ?? null,
57
+ sentAt: normalizeDateTime(row.sentAt),
58
+ failedAt: normalizeDateTime(row.failedAt),
59
+ errorMessage: row.deliveryErrorMessage ?? null,
60
+ }
61
+ : null,
62
+ };
63
+ }
4
64
  export async function listTemplates(db, query) {
5
65
  const conditions = [];
6
66
  if (query.channel)
@@ -100,16 +160,123 @@ export async function listReminderRuns(db, query) {
100
160
  conditions.push(eq(notificationReminderRuns.targetType, query.targetType));
101
161
  if (query.targetId)
102
162
  conditions.push(eq(notificationReminderRuns.targetId, query.targetId));
163
+ if (query.scheduleId) {
164
+ conditions.push(and(eq(notificationReminderRuns.targetType, "booking_payment_schedule"), eq(notificationReminderRuns.targetId, query.scheduleId)));
165
+ }
166
+ if (query.invoiceId) {
167
+ conditions.push(and(eq(notificationReminderRuns.targetType, "invoice"), eq(notificationReminderRuns.targetId, query.invoiceId)));
168
+ }
103
169
  if (query.bookingId)
104
170
  conditions.push(eq(notificationReminderRuns.bookingId, query.bookingId));
171
+ if (query.paymentSessionId) {
172
+ conditions.push(eq(notificationReminderRuns.paymentSessionId, query.paymentSessionId));
173
+ }
174
+ if (query.notificationDeliveryId) {
175
+ conditions.push(eq(notificationReminderRuns.notificationDeliveryId, query.notificationDeliveryId));
176
+ }
177
+ if (query.personId)
178
+ conditions.push(eq(notificationReminderRuns.personId, query.personId));
179
+ if (query.organizationId) {
180
+ conditions.push(eq(notificationReminderRuns.organizationId, query.organizationId));
181
+ }
182
+ if (query.recipient) {
183
+ conditions.push(eq(notificationReminderRuns.recipient, query.recipient));
184
+ }
105
185
  if (query.status)
106
186
  conditions.push(eq(notificationReminderRuns.status, query.status));
107
187
  const where = buildWhereClause(conditions);
108
188
  return paginate(db
109
- .select()
189
+ .select({
190
+ id: notificationReminderRuns.id,
191
+ reminderRuleId: notificationReminderRuns.reminderRuleId,
192
+ targetType: notificationReminderRuns.targetType,
193
+ targetId: notificationReminderRuns.targetId,
194
+ dedupeKey: notificationReminderRuns.dedupeKey,
195
+ bookingId: notificationReminderRuns.bookingId,
196
+ personId: notificationReminderRuns.personId,
197
+ organizationId: notificationReminderRuns.organizationId,
198
+ paymentSessionId: notificationReminderRuns.paymentSessionId,
199
+ notificationDeliveryId: notificationReminderRuns.notificationDeliveryId,
200
+ status: notificationReminderRuns.status,
201
+ recipient: notificationReminderRuns.recipient,
202
+ scheduledFor: notificationReminderRuns.scheduledFor,
203
+ processedAt: notificationReminderRuns.processedAt,
204
+ errorMessage: notificationReminderRuns.errorMessage,
205
+ metadata: notificationReminderRuns.metadata,
206
+ createdAt: notificationReminderRuns.createdAt,
207
+ updatedAt: notificationReminderRuns.updatedAt,
208
+ ruleSlug: notificationReminderRules.slug,
209
+ ruleName: notificationReminderRules.name,
210
+ ruleStatus: notificationReminderRules.status,
211
+ ruleTargetType: notificationReminderRules.targetType,
212
+ ruleChannel: notificationReminderRules.channel,
213
+ ruleProvider: notificationReminderRules.provider,
214
+ ruleTemplateId: notificationReminderRules.templateId,
215
+ ruleTemplateSlug: notificationReminderRules.templateSlug,
216
+ relativeDaysFromDueDate: notificationReminderRules.relativeDaysFromDueDate,
217
+ deliveryId: notificationDeliveries.id,
218
+ deliveryStatus: notificationDeliveries.status,
219
+ deliveryChannel: notificationDeliveries.channel,
220
+ deliveryProvider: notificationDeliveries.provider,
221
+ toAddress: notificationDeliveries.toAddress,
222
+ deliverySubject: notificationDeliveries.subject,
223
+ sentAt: notificationDeliveries.sentAt,
224
+ failedAt: notificationDeliveries.failedAt,
225
+ deliveryErrorMessage: notificationDeliveries.errorMessage,
226
+ })
110
227
  .from(notificationReminderRuns)
228
+ .innerJoin(notificationReminderRules, eq(notificationReminderRules.id, notificationReminderRuns.reminderRuleId))
229
+ .leftJoin(notificationDeliveries, eq(notificationDeliveries.id, notificationReminderRuns.notificationDeliveryId))
111
230
  .where(where)
112
231
  .limit(query.limit)
113
232
  .offset(query.offset)
114
- .orderBy(desc(notificationReminderRuns.createdAt)), db.select({ total: sql `count(*)::int` }).from(notificationReminderRuns).where(where), query.limit, query.offset);
233
+ .orderBy(desc(notificationReminderRuns.createdAt))
234
+ .then((rows) => rows.map(normalizeReminderRun)), db.select({ total: sql `count(*)::int` }).from(notificationReminderRuns).where(where), query.limit, query.offset);
235
+ }
236
+ export async function getReminderRunById(db, id) {
237
+ const [row] = await db
238
+ .select({
239
+ id: notificationReminderRuns.id,
240
+ reminderRuleId: notificationReminderRuns.reminderRuleId,
241
+ targetType: notificationReminderRuns.targetType,
242
+ targetId: notificationReminderRuns.targetId,
243
+ dedupeKey: notificationReminderRuns.dedupeKey,
244
+ bookingId: notificationReminderRuns.bookingId,
245
+ personId: notificationReminderRuns.personId,
246
+ organizationId: notificationReminderRuns.organizationId,
247
+ paymentSessionId: notificationReminderRuns.paymentSessionId,
248
+ notificationDeliveryId: notificationReminderRuns.notificationDeliveryId,
249
+ status: notificationReminderRuns.status,
250
+ recipient: notificationReminderRuns.recipient,
251
+ scheduledFor: notificationReminderRuns.scheduledFor,
252
+ processedAt: notificationReminderRuns.processedAt,
253
+ errorMessage: notificationReminderRuns.errorMessage,
254
+ metadata: notificationReminderRuns.metadata,
255
+ createdAt: notificationReminderRuns.createdAt,
256
+ updatedAt: notificationReminderRuns.updatedAt,
257
+ ruleSlug: notificationReminderRules.slug,
258
+ ruleName: notificationReminderRules.name,
259
+ ruleStatus: notificationReminderRules.status,
260
+ ruleTargetType: notificationReminderRules.targetType,
261
+ ruleChannel: notificationReminderRules.channel,
262
+ ruleProvider: notificationReminderRules.provider,
263
+ ruleTemplateId: notificationReminderRules.templateId,
264
+ ruleTemplateSlug: notificationReminderRules.templateSlug,
265
+ relativeDaysFromDueDate: notificationReminderRules.relativeDaysFromDueDate,
266
+ deliveryId: notificationDeliveries.id,
267
+ deliveryStatus: notificationDeliveries.status,
268
+ deliveryChannel: notificationDeliveries.channel,
269
+ deliveryProvider: notificationDeliveries.provider,
270
+ toAddress: notificationDeliveries.toAddress,
271
+ deliverySubject: notificationDeliveries.subject,
272
+ sentAt: notificationDeliveries.sentAt,
273
+ failedAt: notificationDeliveries.failedAt,
274
+ deliveryErrorMessage: notificationDeliveries.errorMessage,
275
+ })
276
+ .from(notificationReminderRuns)
277
+ .innerJoin(notificationReminderRules, eq(notificationReminderRules.id, notificationReminderRuns.reminderRuleId))
278
+ .leftJoin(notificationDeliveries, eq(notificationDeliveries.id, notificationReminderRuns.notificationDeliveryId))
279
+ .where(eq(notificationReminderRuns.id, id))
280
+ .limit(1);
281
+ return row ? normalizeReminderRun(row) : null;
115
282
  }
package/dist/service.d.ts CHANGED
@@ -4,7 +4,7 @@ export { createNotificationService, NotificationError, renderNotificationTemplat
4
4
  import { createDefaultBookingDocumentAttachment } from "./service-booking-documents.js";
5
5
  import { getDeliveryById, listDeliveries, sendInvoiceNotification, sendNotification, sendPaymentSessionNotification } from "./service-deliveries.js";
6
6
  import { runDueReminders } from "./service-reminders.js";
7
- import { createReminderRule, createTemplate, getReminderRuleById, getTemplateById, getTemplateBySlug, listReminderRules, listReminderRuns, listTemplates, updateReminderRule, updateTemplate } from "./service-templates.js";
7
+ import { createReminderRule, createTemplate, getReminderRuleById, getReminderRunById, getTemplateById, getTemplateBySlug, listReminderRules, listReminderRuns, listTemplates, updateReminderRule, updateTemplate } from "./service-templates.js";
8
8
  export declare const notificationsService: {
9
9
  listTemplates: typeof listTemplates;
10
10
  getTemplateById: typeof getTemplateById;
@@ -16,6 +16,7 @@ export declare const notificationsService: {
16
16
  sendNotification: typeof sendNotification;
17
17
  listReminderRules: typeof listReminderRules;
18
18
  getReminderRuleById: typeof getReminderRuleById;
19
+ getReminderRunById: typeof getReminderRunById;
19
20
  createReminderRule: typeof createReminderRule;
20
21
  updateReminderRule: typeof updateReminderRule;
21
22
  listReminderRuns: typeof listReminderRuns;
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sCAAsC,EAAE,MAAM,gCAAgC,CAAA;AACvF,YAAY,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,0BAA0B,EAC1B,gCAAgC,GACjC,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAEL,sCAAsC,EACvC,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACL,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,gBAAgB,EAChB,8BAA8B,EAC/B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,cAAc,EACf,MAAM,wBAAwB,CAAA;AAE/B,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqBhC,CAAA"}
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sCAAsC,EAAE,MAAM,gCAAgC,CAAA;AACvF,YAAY,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,0BAA0B,EAC1B,gCAAgC,GACjC,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EAEL,sCAAsC,EACvC,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACL,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,gBAAgB,EAChB,8BAA8B,EAC/B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,cAAc,EACf,MAAM,wBAAwB,CAAA;AAE/B,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsBhC,CAAA"}
package/dist/service.js CHANGED
@@ -3,7 +3,7 @@ export { createNotificationService, NotificationError, renderNotificationTemplat
3
3
  import { bookingDocumentNotificationsService, createDefaultBookingDocumentAttachment, } from "./service-booking-documents.js";
4
4
  import { getDeliveryById, listDeliveries, sendInvoiceNotification, sendNotification, sendPaymentSessionNotification, } from "./service-deliveries.js";
5
5
  import { runDueReminders } from "./service-reminders.js";
6
- import { createReminderRule, createTemplate, getReminderRuleById, getTemplateById, getTemplateBySlug, listReminderRules, listReminderRuns, listTemplates, updateReminderRule, updateTemplate, } from "./service-templates.js";
6
+ import { createReminderRule, createTemplate, getReminderRuleById, getReminderRunById, getTemplateById, getTemplateBySlug, listReminderRules, listReminderRuns, listTemplates, updateReminderRule, updateTemplate, } from "./service-templates.js";
7
7
  export const notificationsService = {
8
8
  listTemplates,
9
9
  getTemplateById,
@@ -15,6 +15,7 @@ export const notificationsService = {
15
15
  sendNotification,
16
16
  listReminderRules,
17
17
  getReminderRuleById,
18
+ getReminderRunById,
18
19
  createReminderRule,
19
20
  updateReminderRule,
20
21
  listReminderRuns,
@@ -219,7 +219,14 @@ export declare const notificationReminderRunListQuerySchema: z.ZodObject<{
219
219
  booking_payment_schedule: "booking_payment_schedule";
220
220
  }>>;
221
221
  targetId: z.ZodOptional<z.ZodString>;
222
+ scheduleId: z.ZodOptional<z.ZodString>;
223
+ invoiceId: z.ZodOptional<z.ZodString>;
222
224
  bookingId: z.ZodOptional<z.ZodString>;
225
+ paymentSessionId: z.ZodOptional<z.ZodString>;
226
+ notificationDeliveryId: z.ZodOptional<z.ZodString>;
227
+ personId: z.ZodOptional<z.ZodString>;
228
+ organizationId: z.ZodOptional<z.ZodString>;
229
+ recipient: z.ZodOptional<z.ZodString>;
223
230
  status: z.ZodOptional<z.ZodEnum<{
224
231
  failed: "failed";
225
232
  sent: "sent";
@@ -227,6 +234,207 @@ export declare const notificationReminderRunListQuerySchema: z.ZodObject<{
227
234
  skipped: "skipped";
228
235
  }>>;
229
236
  }, z.core.$strip>;
237
+ export declare const notificationReminderRunRuleSummarySchema: z.ZodObject<{
238
+ id: z.ZodString;
239
+ slug: z.ZodString;
240
+ name: z.ZodString;
241
+ status: z.ZodEnum<{
242
+ draft: "draft";
243
+ active: "active";
244
+ archived: "archived";
245
+ }>;
246
+ targetType: z.ZodEnum<{
247
+ invoice: "invoice";
248
+ booking_payment_schedule: "booking_payment_schedule";
249
+ }>;
250
+ channel: z.ZodEnum<{
251
+ email: "email";
252
+ sms: "sms";
253
+ }>;
254
+ provider: z.ZodNullable<z.ZodString>;
255
+ templateId: z.ZodNullable<z.ZodString>;
256
+ templateSlug: z.ZodNullable<z.ZodString>;
257
+ relativeDaysFromDueDate: z.ZodNumber;
258
+ }, z.core.$strip>;
259
+ export declare const notificationReminderRunDeliverySummarySchema: z.ZodObject<{
260
+ id: z.ZodString;
261
+ status: z.ZodEnum<{
262
+ cancelled: "cancelled";
263
+ pending: "pending";
264
+ failed: "failed";
265
+ sent: "sent";
266
+ }>;
267
+ channel: z.ZodEnum<{
268
+ email: "email";
269
+ sms: "sms";
270
+ }>;
271
+ provider: z.ZodString;
272
+ toAddress: z.ZodString;
273
+ subject: z.ZodNullable<z.ZodString>;
274
+ sentAt: z.ZodNullable<z.ZodString>;
275
+ failedAt: z.ZodNullable<z.ZodString>;
276
+ errorMessage: z.ZodNullable<z.ZodString>;
277
+ }, z.core.$strip>;
278
+ export declare const notificationReminderRunLinksSchema: z.ZodObject<{
279
+ bookingId: z.ZodNullable<z.ZodString>;
280
+ bookingPaymentScheduleId: z.ZodNullable<z.ZodString>;
281
+ invoiceId: z.ZodNullable<z.ZodString>;
282
+ paymentSessionId: z.ZodNullable<z.ZodString>;
283
+ personId: z.ZodNullable<z.ZodString>;
284
+ organizationId: z.ZodNullable<z.ZodString>;
285
+ notificationDeliveryId: z.ZodNullable<z.ZodString>;
286
+ }, z.core.$strip>;
287
+ export declare const notificationReminderRunRecordSchema: z.ZodObject<{
288
+ id: z.ZodString;
289
+ reminderRuleId: z.ZodString;
290
+ targetType: z.ZodEnum<{
291
+ invoice: "invoice";
292
+ booking_payment_schedule: "booking_payment_schedule";
293
+ }>;
294
+ targetId: z.ZodString;
295
+ dedupeKey: z.ZodString;
296
+ status: z.ZodEnum<{
297
+ failed: "failed";
298
+ sent: "sent";
299
+ processing: "processing";
300
+ skipped: "skipped";
301
+ }>;
302
+ recipient: z.ZodNullable<z.ZodString>;
303
+ scheduledFor: z.ZodString;
304
+ processedAt: z.ZodString;
305
+ errorMessage: z.ZodNullable<z.ZodString>;
306
+ metadata: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
307
+ createdAt: z.ZodString;
308
+ updatedAt: z.ZodString;
309
+ links: z.ZodObject<{
310
+ bookingId: z.ZodNullable<z.ZodString>;
311
+ bookingPaymentScheduleId: z.ZodNullable<z.ZodString>;
312
+ invoiceId: z.ZodNullable<z.ZodString>;
313
+ paymentSessionId: z.ZodNullable<z.ZodString>;
314
+ personId: z.ZodNullable<z.ZodString>;
315
+ organizationId: z.ZodNullable<z.ZodString>;
316
+ notificationDeliveryId: z.ZodNullable<z.ZodString>;
317
+ }, z.core.$strip>;
318
+ reminderRule: z.ZodObject<{
319
+ id: z.ZodString;
320
+ slug: z.ZodString;
321
+ name: z.ZodString;
322
+ status: z.ZodEnum<{
323
+ draft: "draft";
324
+ active: "active";
325
+ archived: "archived";
326
+ }>;
327
+ targetType: z.ZodEnum<{
328
+ invoice: "invoice";
329
+ booking_payment_schedule: "booking_payment_schedule";
330
+ }>;
331
+ channel: z.ZodEnum<{
332
+ email: "email";
333
+ sms: "sms";
334
+ }>;
335
+ provider: z.ZodNullable<z.ZodString>;
336
+ templateId: z.ZodNullable<z.ZodString>;
337
+ templateSlug: z.ZodNullable<z.ZodString>;
338
+ relativeDaysFromDueDate: z.ZodNumber;
339
+ }, z.core.$strip>;
340
+ delivery: z.ZodNullable<z.ZodObject<{
341
+ id: z.ZodString;
342
+ status: z.ZodEnum<{
343
+ cancelled: "cancelled";
344
+ pending: "pending";
345
+ failed: "failed";
346
+ sent: "sent";
347
+ }>;
348
+ channel: z.ZodEnum<{
349
+ email: "email";
350
+ sms: "sms";
351
+ }>;
352
+ provider: z.ZodString;
353
+ toAddress: z.ZodString;
354
+ subject: z.ZodNullable<z.ZodString>;
355
+ sentAt: z.ZodNullable<z.ZodString>;
356
+ failedAt: z.ZodNullable<z.ZodString>;
357
+ errorMessage: z.ZodNullable<z.ZodString>;
358
+ }, z.core.$strip>>;
359
+ }, z.core.$strip>;
360
+ export declare const notificationReminderRunListResponseSchema: z.ZodObject<{
361
+ data: z.ZodArray<z.ZodObject<{
362
+ id: z.ZodString;
363
+ reminderRuleId: z.ZodString;
364
+ targetType: z.ZodEnum<{
365
+ invoice: "invoice";
366
+ booking_payment_schedule: "booking_payment_schedule";
367
+ }>;
368
+ targetId: z.ZodString;
369
+ dedupeKey: z.ZodString;
370
+ status: z.ZodEnum<{
371
+ failed: "failed";
372
+ sent: "sent";
373
+ processing: "processing";
374
+ skipped: "skipped";
375
+ }>;
376
+ recipient: z.ZodNullable<z.ZodString>;
377
+ scheduledFor: z.ZodString;
378
+ processedAt: z.ZodString;
379
+ errorMessage: z.ZodNullable<z.ZodString>;
380
+ metadata: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
381
+ createdAt: z.ZodString;
382
+ updatedAt: z.ZodString;
383
+ links: z.ZodObject<{
384
+ bookingId: z.ZodNullable<z.ZodString>;
385
+ bookingPaymentScheduleId: z.ZodNullable<z.ZodString>;
386
+ invoiceId: z.ZodNullable<z.ZodString>;
387
+ paymentSessionId: z.ZodNullable<z.ZodString>;
388
+ personId: z.ZodNullable<z.ZodString>;
389
+ organizationId: z.ZodNullable<z.ZodString>;
390
+ notificationDeliveryId: z.ZodNullable<z.ZodString>;
391
+ }, z.core.$strip>;
392
+ reminderRule: z.ZodObject<{
393
+ id: z.ZodString;
394
+ slug: z.ZodString;
395
+ name: z.ZodString;
396
+ status: z.ZodEnum<{
397
+ draft: "draft";
398
+ active: "active";
399
+ archived: "archived";
400
+ }>;
401
+ targetType: z.ZodEnum<{
402
+ invoice: "invoice";
403
+ booking_payment_schedule: "booking_payment_schedule";
404
+ }>;
405
+ channel: z.ZodEnum<{
406
+ email: "email";
407
+ sms: "sms";
408
+ }>;
409
+ provider: z.ZodNullable<z.ZodString>;
410
+ templateId: z.ZodNullable<z.ZodString>;
411
+ templateSlug: z.ZodNullable<z.ZodString>;
412
+ relativeDaysFromDueDate: z.ZodNumber;
413
+ }, z.core.$strip>;
414
+ delivery: z.ZodNullable<z.ZodObject<{
415
+ id: z.ZodString;
416
+ status: z.ZodEnum<{
417
+ cancelled: "cancelled";
418
+ pending: "pending";
419
+ failed: "failed";
420
+ sent: "sent";
421
+ }>;
422
+ channel: z.ZodEnum<{
423
+ email: "email";
424
+ sms: "sms";
425
+ }>;
426
+ provider: z.ZodString;
427
+ toAddress: z.ZodString;
428
+ subject: z.ZodNullable<z.ZodString>;
429
+ sentAt: z.ZodNullable<z.ZodString>;
430
+ failedAt: z.ZodNullable<z.ZodString>;
431
+ errorMessage: z.ZodNullable<z.ZodString>;
432
+ }, z.core.$strip>>;
433
+ }, z.core.$strip>>;
434
+ total: z.ZodNumber;
435
+ limit: z.ZodNumber;
436
+ offset: z.ZodNumber;
437
+ }, z.core.$strip>;
230
438
  export declare const runDueRemindersSchema: z.ZodObject<{
231
439
  now: z.ZodNullable<z.ZodOptional<z.ZodString>>;
232
440
  }, z.core.$strip>;
@@ -1 +1 @@
1
- {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,yBAAyB;;;EAA2B,CAAA;AACjE,eAAO,MAAM,gCAAgC;;;;EAA0C,CAAA;AACvF,eAAO,MAAM,gCAAgC;;;;;EAAqD,CAAA;AAClG,eAAO,MAAM,4BAA4B;;;;;;;;;EASvC,CAAA;AACF,eAAO,MAAM,gCAAgC;;;;EAA0C,CA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EF,eAAO,MAAM,4CAA4C;;;;;;;;;;;;;;;;;;iBAUvD,CAAA;AAEF,eAAO,MAAM,kCAAkC;;;;;;;;iBAQ7C,CAAA;AAEF,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiB9C,CAAA;AAEF,eAAO,MAAM,yCAAyC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKpD,CAAA;AAEF,eAAO,MAAM,qBAAqB;;iBAEhC,CAAA;AAkBF,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAMhD,CAAA;AAED,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAMzC,CAAA;AAED,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA6BhC,CAAA;AAEH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmB1C,CAAA;AAEF,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAGtC,CAAA;AAEF,eAAO,MAAM,sCAAsC;;;;;;;;;;;;;;;;;iBAajD,CAAA;AAEF,eAAO,MAAM,4CAA4C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAOvD,CAAA"}
@@ -105,9 +105,72 @@ export const notificationReminderRunListQuerySchema = paginationSchema.extend({
105
105
  reminderRuleId: z.string().optional(),
106
106
  targetType: notificationReminderTargetTypeSchema.optional(),
107
107
  targetId: z.string().optional(),
108
+ scheduleId: z.string().optional(),
109
+ invoiceId: z.string().optional(),
108
110
  bookingId: z.string().optional(),
111
+ paymentSessionId: z.string().optional(),
112
+ notificationDeliveryId: z.string().optional(),
113
+ personId: z.string().optional(),
114
+ organizationId: z.string().optional(),
115
+ recipient: z.string().optional(),
109
116
  status: notificationReminderRunStatusSchema.optional(),
110
117
  });
118
+ export const notificationReminderRunRuleSummarySchema = z.object({
119
+ id: z.string(),
120
+ slug: z.string(),
121
+ name: z.string(),
122
+ status: notificationReminderStatusSchema,
123
+ targetType: notificationReminderTargetTypeSchema,
124
+ channel: notificationChannelSchema,
125
+ provider: z.string().nullable(),
126
+ templateId: z.string().nullable(),
127
+ templateSlug: z.string().nullable(),
128
+ relativeDaysFromDueDate: z.number().int(),
129
+ });
130
+ export const notificationReminderRunDeliverySummarySchema = z.object({
131
+ id: z.string(),
132
+ status: notificationDeliveryStatusSchema,
133
+ channel: notificationChannelSchema,
134
+ provider: z.string(),
135
+ toAddress: z.string(),
136
+ subject: z.string().nullable(),
137
+ sentAt: z.string().nullable(),
138
+ failedAt: z.string().nullable(),
139
+ errorMessage: z.string().nullable(),
140
+ });
141
+ export const notificationReminderRunLinksSchema = z.object({
142
+ bookingId: z.string().nullable(),
143
+ bookingPaymentScheduleId: z.string().nullable(),
144
+ invoiceId: z.string().nullable(),
145
+ paymentSessionId: z.string().nullable(),
146
+ personId: z.string().nullable(),
147
+ organizationId: z.string().nullable(),
148
+ notificationDeliveryId: z.string().nullable(),
149
+ });
150
+ export const notificationReminderRunRecordSchema = z.object({
151
+ id: z.string(),
152
+ reminderRuleId: z.string(),
153
+ targetType: notificationReminderTargetTypeSchema,
154
+ targetId: z.string(),
155
+ dedupeKey: z.string(),
156
+ status: notificationReminderRunStatusSchema,
157
+ recipient: z.string().nullable(),
158
+ scheduledFor: z.string(),
159
+ processedAt: z.string(),
160
+ errorMessage: z.string().nullable(),
161
+ metadata: z.record(z.string(), z.unknown()).nullable(),
162
+ createdAt: z.string(),
163
+ updatedAt: z.string(),
164
+ links: notificationReminderRunLinksSchema,
165
+ reminderRule: notificationReminderRunRuleSummarySchema,
166
+ delivery: notificationReminderRunDeliverySummarySchema.nullable(),
167
+ });
168
+ export const notificationReminderRunListResponseSchema = z.object({
169
+ data: z.array(notificationReminderRunRecordSchema),
170
+ total: z.number().int(),
171
+ limit: z.number().int(),
172
+ offset: z.number().int(),
173
+ });
111
174
  export const runDueRemindersSchema = z.object({
112
175
  now: z.string().datetime().optional().nullable(),
113
176
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyantjs/notifications",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "license": "FSL-1.1-Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -49,12 +49,12 @@
49
49
  "drizzle-orm": "^0.45.2",
50
50
  "hono": "^4.12.10",
51
51
  "zod": "^4.3.6",
52
- "@voyantjs/bookings": "0.4.2",
53
- "@voyantjs/core": "0.4.2",
54
- "@voyantjs/db": "0.4.2",
55
- "@voyantjs/finance": "0.4.2",
56
- "@voyantjs/hono": "0.4.2",
57
- "@voyantjs/legal": "0.4.2"
52
+ "@voyantjs/bookings": "0.4.4",
53
+ "@voyantjs/core": "0.4.4",
54
+ "@voyantjs/db": "0.4.4",
55
+ "@voyantjs/finance": "0.4.4",
56
+ "@voyantjs/hono": "0.4.4",
57
+ "@voyantjs/legal": "0.4.4"
58
58
  },
59
59
  "devDependencies": {
60
60
  "typescript": "^6.0.2",