@voyantjs/notifications 0.5.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -97,10 +97,12 @@ For finance-aware collection sends, the routes also support:
97
97
  Those routes resolve recipients from the payment session, invoice, and linked booking participants, then render the selected notification template with finance context such as payment links, invoice balances, and booking references.
98
98
 
99
99
  Booking document sends bundle the latest customer-facing contract attachment and
100
- ready invoice/proforma rendition for a booking. By default they use `metadata.url`
101
- or `metadata.downloadUrl` on the legal/finance artifact as the attachment path.
102
- Apps can override that behavior with `documentAttachmentResolver` when mounting
103
- `createNotificationsRoutes()` or `createNotificationsHonoModule()`.
100
+ ready invoice/proforma rendition for a booking. By default they use the stored
101
+ artifact URL when one is durable and publicly readable. Private document flows
102
+ should override that behavior with `documentAttachmentResolver` or
103
+ `resolveDocumentAttachmentResolver` when mounting `createNotificationsRoutes()`
104
+ or `createNotificationsHonoModule()`, so attachment URLs are resolved at send
105
+ time from the current storage/runtime context.
104
106
 
105
107
  ## Exports
106
108
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { HonoModule } from "@voyantjs/hono/module";
2
- import { createNotificationsRoutes } from "./routes.js";
2
+ import { type NotificationsRoutesOptions } from "./routes.js";
3
3
  export type { DefaultNotificationProviderOptions } from "./provider-resolution.js";
4
4
  export { createDefaultNotificationProviders, createResendProviderFromEnv, createTwilioProviderFromEnv, } from "./provider-resolution.js";
5
5
  export type { LocalProviderOptions } from "./providers/local.js";
@@ -8,15 +8,18 @@ export type { ResendFetch, ResendProviderOptions, ResendRenderedEmail, } from ".
8
8
  export { createResendProvider } from "./providers/resend.js";
9
9
  export type { TwilioFetch, TwilioProviderOptions, TwilioRenderedSms } from "./providers/twilio.js";
10
10
  export { createTwilioProvider } from "./providers/twilio.js";
11
- export { createNotificationsRoutes } from "./routes.js";
11
+ export type { NotificationsRouteRuntime, NotificationsRoutesOptions } from "./routes.js";
12
+ export { buildNotificationsRouteRuntime, createNotificationsRoutes, NOTIFICATIONS_ROUTE_RUNTIME_CONTAINER_KEY, } from "./routes.js";
12
13
  export type { NewNotificationDelivery, NewNotificationReminderRule, NewNotificationReminderRun, NewNotificationTemplate, NotificationDelivery, NotificationReminderRule, NotificationReminderRun, NotificationsHonoModule, NotificationTemplate, } from "./schema.js";
13
14
  export { notificationChannelEnum, notificationDeliveries, notificationDeliveryStatusEnum, notificationReminderRules, notificationReminderRunStatusEnum, notificationReminderRuns, notificationReminderStatusEnum, notificationReminderTargetTypeEnum, notificationsModule, notificationTargetTypeEnum, notificationTemplateStatusEnum, notificationTemplates, } from "./schema.js";
14
15
  export type { NotificationService } from "./service.js";
15
16
  export { createDefaultBookingDocumentAttachment, createNotificationService, NotificationError, notificationsService, renderNotificationTemplate, } from "./service.js";
16
17
  export type { BookingDocumentAttachmentResolver, BookingDocumentsSentEvent, SendBookingDocumentsRuntimeOptions, } from "./service-booking-documents.js";
17
18
  export { bookingDocumentNotificationsService } from "./service-booking-documents.js";
19
+ export type { NotificationTaskEnv, NotificationTaskRuntime, NotificationTaskRuntimeOptions, } from "./task-runtime.js";
20
+ export { buildNotificationTaskRuntime } from "./task-runtime.js";
18
21
  export { sendDueNotificationReminders } from "./tasks/index.js";
19
22
  export type { NotificationAttachment, NotificationChannel, NotificationPayload, NotificationProvider, NotificationResult, } from "./types.js";
20
23
  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
- export declare function createNotificationsHonoModule(options?: Parameters<typeof createNotificationsRoutes>[0]): HonoModule;
24
+ export declare function createNotificationsHonoModule(options?: NotificationsRoutesOptions): HonoModule;
22
25
  //# 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,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package/dist/index.js CHANGED
@@ -1,18 +1,25 @@
1
- import { createNotificationsRoutes } from "./routes.js";
1
+ import { buildNotificationsRouteRuntime, createNotificationsRoutes, NOTIFICATIONS_ROUTE_RUNTIME_CONTAINER_KEY, } from "./routes.js";
2
2
  import { notificationsModule } from "./schema.js";
3
3
  export { createDefaultNotificationProviders, createResendProviderFromEnv, createTwilioProviderFromEnv, } from "./provider-resolution.js";
4
4
  export { createLocalProvider } from "./providers/local.js";
5
5
  export { createResendProvider } from "./providers/resend.js";
6
6
  export { createTwilioProvider } from "./providers/twilio.js";
7
- export { createNotificationsRoutes } from "./routes.js";
7
+ export { buildNotificationsRouteRuntime, createNotificationsRoutes, NOTIFICATIONS_ROUTE_RUNTIME_CONTAINER_KEY, } from "./routes.js";
8
8
  export { notificationChannelEnum, notificationDeliveries, notificationDeliveryStatusEnum, notificationReminderRules, notificationReminderRunStatusEnum, notificationReminderRuns, notificationReminderStatusEnum, notificationReminderTargetTypeEnum, notificationsModule, notificationTargetTypeEnum, notificationTemplateStatusEnum, notificationTemplates, } from "./schema.js";
9
9
  export { createDefaultBookingDocumentAttachment, createNotificationService, NotificationError, notificationsService, renderNotificationTemplate, } from "./service.js";
10
10
  export { bookingDocumentNotificationsService } from "./service-booking-documents.js";
11
+ export { buildNotificationTaskRuntime } from "./task-runtime.js";
11
12
  export { sendDueNotificationReminders } from "./tasks/index.js";
12
13
  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
14
  export function createNotificationsHonoModule(options) {
15
+ const module = {
16
+ ...notificationsModule,
17
+ bootstrap: ({ bindings, container }) => {
18
+ container.register(NOTIFICATIONS_ROUTE_RUNTIME_CONTAINER_KEY, buildNotificationsRouteRuntime(bindings, options));
19
+ },
20
+ };
14
21
  return {
15
- module: notificationsModule,
22
+ module,
16
23
  routes: createNotificationsRoutes(options),
17
24
  };
18
25
  }
package/dist/routes.d.ts CHANGED
@@ -1,22 +1,31 @@
1
- import type { EventBus } from "@voyantjs/core";
1
+ import type { EventBus, ModuleContainer } from "@voyantjs/core";
2
2
  import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
3
3
  import type { BookingDocumentAttachmentResolver } from "./service-booking-documents.js";
4
4
  import type { NotificationProvider } from "./types.js";
5
5
  type Env = {
6
6
  Bindings: Record<string, unknown>;
7
7
  Variables: {
8
+ container: ModuleContainer;
8
9
  db: PostgresJsDatabase;
9
10
  userId?: string;
10
11
  };
11
12
  };
12
- export declare function createNotificationsRoutes(options?: {
13
+ export type NotificationsRoutesOptions = {
13
14
  providers?: ReadonlyArray<NotificationProvider>;
14
15
  resolveProviders?: (bindings: Record<string, unknown>) => ReadonlyArray<NotificationProvider>;
15
16
  documentAttachmentResolver?: BookingDocumentAttachmentResolver;
16
17
  resolveDocumentAttachmentResolver?: (bindings: Record<string, unknown>) => BookingDocumentAttachmentResolver | undefined;
17
18
  eventBus?: EventBus;
18
19
  resolveEventBus?: (bindings: Record<string, unknown>) => EventBus | undefined;
19
- }): import("hono/hono-base").HonoBase<Env, {
20
+ };
21
+ export type NotificationsRouteRuntime = {
22
+ providers: ReadonlyArray<NotificationProvider>;
23
+ documentAttachmentResolver?: BookingDocumentAttachmentResolver;
24
+ eventBus?: EventBus;
25
+ };
26
+ export declare const NOTIFICATIONS_ROUTE_RUNTIME_CONTAINER_KEY = "providers.notifications.runtime";
27
+ export declare function buildNotificationsRouteRuntime(bindings: Record<string, unknown>, options?: NotificationsRoutesOptions): NotificationsRouteRuntime;
28
+ export declare function createNotificationsRoutes(options?: NotificationsRoutesOptions): import("hono/hono-base").HonoBase<Env, {
20
29
  "/templates": {
21
30
  $get: {
22
31
  input: {};
@@ -53,17 +62,17 @@ export declare function createNotificationsRoutes(options?: {
53
62
  input: {};
54
63
  output: {
55
64
  data: {
65
+ metadata: {
66
+ [x: string]: import("hono/utils/types").JSONValue;
67
+ } | null;
56
68
  id: string;
57
69
  name: string;
58
- status: "draft" | "active" | "archived";
59
70
  createdAt: string;
60
71
  updatedAt: string;
61
- metadata: {
62
- [x: string]: import("hono/utils/types").JSONValue;
63
- } | null;
72
+ slug: string;
73
+ status: "draft" | "active" | "archived";
64
74
  channel: "email" | "sms";
65
75
  provider: string | null;
66
- slug: string;
67
76
  subjectTemplate: string | null;
68
77
  htmlTemplate: string | null;
69
78
  textTemplate: string | null;
@@ -170,7 +179,7 @@ export declare function createNotificationsRoutes(options?: {
170
179
  id: string;
171
180
  templateId: string | null;
172
181
  templateSlug: string | null;
173
- targetType: "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "organization" | "person" | "payment_session";
182
+ targetType: "organization" | "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "person" | "payment_session";
174
183
  targetId: string | null;
175
184
  personId: string | null;
176
185
  organizationId: string | null;
@@ -180,7 +189,7 @@ export declare function createNotificationsRoutes(options?: {
180
189
  channel: "email" | "sms";
181
190
  provider: string;
182
191
  providerMessageId: string | null;
183
- status: "cancelled" | "pending" | "failed" | "sent";
192
+ status: "pending" | "cancelled" | "failed" | "sent";
184
193
  toAddress: string;
185
194
  fromAddress: string | null;
186
195
  subject: string | null;
@@ -231,7 +240,7 @@ export declare function createNotificationsRoutes(options?: {
231
240
  id: string;
232
241
  templateId: string | null;
233
242
  templateSlug: string | null;
234
- targetType: "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "organization" | "person" | "payment_session";
243
+ targetType: "organization" | "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "person" | "payment_session";
235
244
  targetId: string | null;
236
245
  personId: string | null;
237
246
  organizationId: string | null;
@@ -241,7 +250,7 @@ export declare function createNotificationsRoutes(options?: {
241
250
  channel: "email" | "sms";
242
251
  provider: string;
243
252
  providerMessageId: string | null;
244
- status: "cancelled" | "pending" | "failed" | "sent";
253
+ status: "pending" | "cancelled" | "failed" | "sent";
245
254
  toAddress: string;
246
255
  fromAddress: string | null;
247
256
  subject: string | null;
@@ -302,19 +311,19 @@ export declare function createNotificationsRoutes(options?: {
302
311
  input: {};
303
312
  output: {
304
313
  data: {
314
+ metadata: {
315
+ [x: string]: import("hono/utils/types").JSONValue;
316
+ } | null;
305
317
  id: string;
306
318
  name: string;
307
- status: "draft" | "active" | "archived";
308
319
  createdAt: string;
309
320
  updatedAt: string;
310
- metadata: {
311
- [x: string]: import("hono/utils/types").JSONValue;
312
- } | null;
321
+ slug: string;
322
+ status: "draft" | "active" | "archived";
313
323
  channel: "email" | "sms";
314
324
  provider: string | null;
315
325
  targetType: "invoice" | "booking_payment_schedule";
316
326
  templateId: string | null;
317
- slug: string;
318
327
  isSystem: boolean;
319
328
  templateSlug: string | null;
320
329
  relativeDaysFromDueDate: number;
@@ -454,7 +463,7 @@ export declare function createNotificationsRoutes(options?: {
454
463
  };
455
464
  delivery: {
456
465
  id: string;
457
- status: "cancelled" | "pending" | "failed" | "sent";
466
+ status: "pending" | "cancelled" | "failed" | "sent";
458
467
  channel: "email" | "sms";
459
468
  provider: string;
460
469
  toAddress: string;
@@ -531,7 +540,7 @@ export declare function createNotificationsRoutes(options?: {
531
540
  };
532
541
  delivery: {
533
542
  id: string;
534
- status: "cancelled" | "pending" | "failed" | "sent";
543
+ status: "pending" | "cancelled" | "failed" | "sent";
535
544
  channel: "email" | "sms";
536
545
  provider: string;
537
546
  toAddress: string;
@@ -593,7 +602,7 @@ export declare function createNotificationsRoutes(options?: {
593
602
  id: string;
594
603
  templateId: string | null;
595
604
  templateSlug: string | null;
596
- targetType: "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "organization" | "person" | "payment_session";
605
+ targetType: "organization" | "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "person" | "payment_session";
597
606
  targetId: string | null;
598
607
  personId: string | null;
599
608
  organizationId: string | null;
@@ -603,7 +612,7 @@ export declare function createNotificationsRoutes(options?: {
603
612
  channel: "email" | "sms";
604
613
  provider: string;
605
614
  providerMessageId: string | null;
606
- status: "cancelled" | "pending" | "failed" | "sent";
615
+ status: "pending" | "cancelled" | "failed" | "sent";
607
616
  toAddress: string;
608
617
  fromAddress: string | null;
609
618
  subject: string | null;
@@ -662,7 +671,7 @@ export declare function createNotificationsRoutes(options?: {
662
671
  id: string;
663
672
  templateId: string | null;
664
673
  templateSlug: string | null;
665
- targetType: "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "organization" | "person" | "payment_session";
674
+ targetType: "organization" | "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "person" | "payment_session";
666
675
  targetId: string | null;
667
676
  personId: string | null;
668
677
  organizationId: string | null;
@@ -672,7 +681,7 @@ export declare function createNotificationsRoutes(options?: {
672
681
  channel: "email" | "sms";
673
682
  provider: string;
674
683
  providerMessageId: string | null;
675
- status: "cancelled" | "pending" | "failed" | "sent";
684
+ status: "pending" | "cancelled" | "failed" | "sent";
676
685
  toAddress: string;
677
686
  fromAddress: string | null;
678
687
  subject: string | null;
@@ -814,7 +823,7 @@ export declare function createNotificationsRoutes(options?: {
814
823
  } | null | undefined;
815
824
  }[];
816
825
  deliveryId: string;
817
- status: "cancelled" | "pending" | "failed" | "sent";
826
+ status: "pending" | "cancelled" | "failed" | "sent";
818
827
  provider?: string | null | undefined;
819
828
  };
820
829
  };
@@ -831,7 +840,7 @@ export declare function createNotificationsRoutes(options?: {
831
840
  id: string;
832
841
  templateId: string | null;
833
842
  templateSlug: string | null;
834
- targetType: "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "organization" | "person" | "payment_session";
843
+ targetType: "organization" | "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "person" | "payment_session";
835
844
  targetId: string | null;
836
845
  personId: string | null;
837
846
  organizationId: string | null;
@@ -841,7 +850,7 @@ export declare function createNotificationsRoutes(options?: {
841
850
  channel: "email" | "sms";
842
851
  provider: string;
843
852
  providerMessageId: string | null;
844
- status: "cancelled" | "pending" | "failed" | "sent";
853
+ status: "pending" | "cancelled" | "failed" | "sent";
845
854
  toAddress: string;
846
855
  fromAddress: string | null;
847
856
  subject: string | null;
@@ -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,yBAAyB,CAAC,OAAO,CAAC,EAAE;IAClD,SAAS,CAAC,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAA;IAC/C,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0L7E"}
package/dist/routes.js CHANGED
@@ -1,14 +1,31 @@
1
+ import { parseJsonBody, parseOptionalJsonBody, parseQuery } from "@voyantjs/hono";
1
2
  import { Hono } from "hono";
2
3
  import { createNotificationService, notificationsService } from "./service.js";
3
4
  import { bookingDocumentBundleSchema, insertNotificationReminderRuleSchema, insertNotificationTemplateSchema, notificationDeliveryListQuerySchema, notificationReminderRuleListQuerySchema, notificationReminderRunListQuerySchema, notificationTemplateListQuerySchema, runDueRemindersSchema, sendBookingDocumentsNotificationResultSchema, sendBookingDocumentsNotificationSchema, sendInvoiceNotificationSchema, sendNotificationSchema, sendPaymentSessionNotificationSchema, updateNotificationReminderRuleSchema, updateNotificationTemplateSchema, } from "./validation.js";
5
+ export const NOTIFICATIONS_ROUTE_RUNTIME_CONTAINER_KEY = "providers.notifications.runtime";
6
+ export function buildNotificationsRouteRuntime(bindings, options) {
7
+ return {
8
+ providers: options?.resolveProviders?.(bindings) ?? options?.providers ?? [],
9
+ documentAttachmentResolver: options?.resolveDocumentAttachmentResolver?.(bindings) ?? options?.documentAttachmentResolver,
10
+ eventBus: options?.resolveEventBus?.(bindings) ?? options?.eventBus,
11
+ };
12
+ }
13
+ function getRuntime(bindings, options, resolveFromContainer) {
14
+ try {
15
+ return resolveFromContainer(NOTIFICATIONS_ROUTE_RUNTIME_CONTAINER_KEY);
16
+ }
17
+ catch {
18
+ return buildNotificationsRouteRuntime(bindings, options);
19
+ }
20
+ }
4
21
  export function createNotificationsRoutes(options) {
5
22
  return new Hono()
6
23
  .get("/templates", async (c) => {
7
- const query = notificationTemplateListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
24
+ const query = parseQuery(c, notificationTemplateListQuerySchema);
8
25
  return c.json(await notificationsService.listTemplates(c.get("db"), query));
9
26
  })
10
27
  .post("/templates", async (c) => {
11
- const row = await notificationsService.createTemplate(c.get("db"), insertNotificationTemplateSchema.parse(await c.req.json()));
28
+ const row = await notificationsService.createTemplate(c.get("db"), await parseJsonBody(c, insertNotificationTemplateSchema));
12
29
  return c.json({ data: row }, 201);
13
30
  })
14
31
  .get("/templates/:id", async (c) => {
@@ -18,13 +35,13 @@ export function createNotificationsRoutes(options) {
18
35
  return c.json({ data: row });
19
36
  })
20
37
  .patch("/templates/:id", async (c) => {
21
- const row = await notificationsService.updateTemplate(c.get("db"), c.req.param("id"), updateNotificationTemplateSchema.parse(await c.req.json()));
38
+ const row = await notificationsService.updateTemplate(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateNotificationTemplateSchema));
22
39
  if (!row)
23
40
  return c.json({ error: "Notification template not found" }, 404);
24
41
  return c.json({ data: row });
25
42
  })
26
43
  .get("/deliveries", async (c) => {
27
- const query = notificationDeliveryListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
44
+ const query = parseQuery(c, notificationDeliveryListQuerySchema);
28
45
  return c.json(await notificationsService.listDeliveries(c.get("db"), query));
29
46
  })
30
47
  .get("/deliveries/:id", async (c) => {
@@ -34,11 +51,11 @@ export function createNotificationsRoutes(options) {
34
51
  return c.json({ data: row });
35
52
  })
36
53
  .get("/reminder-rules", async (c) => {
37
- const query = notificationReminderRuleListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
54
+ const query = parseQuery(c, notificationReminderRuleListQuerySchema);
38
55
  return c.json(await notificationsService.listReminderRules(c.get("db"), query));
39
56
  })
40
57
  .post("/reminder-rules", async (c) => {
41
- const row = await notificationsService.createReminderRule(c.get("db"), insertNotificationReminderRuleSchema.parse(await c.req.json()));
58
+ const row = await notificationsService.createReminderRule(c.get("db"), await parseJsonBody(c, insertNotificationReminderRuleSchema));
42
59
  return c.json({ data: row }, 201);
43
60
  })
44
61
  .get("/reminder-rules/:id", async (c) => {
@@ -48,13 +65,13 @@ export function createNotificationsRoutes(options) {
48
65
  return c.json({ data: row });
49
66
  })
50
67
  .patch("/reminder-rules/:id", async (c) => {
51
- const row = await notificationsService.updateReminderRule(c.get("db"), c.req.param("id"), updateNotificationReminderRuleSchema.parse(await c.req.json()));
68
+ const row = await notificationsService.updateReminderRule(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateNotificationReminderRuleSchema));
52
69
  if (!row)
53
70
  return c.json({ error: "Notification reminder rule not found" }, 404);
54
71
  return c.json({ data: row });
55
72
  })
56
73
  .get("/reminder-runs", async (c) => {
57
- const query = notificationReminderRunListQuerySchema.parse(Object.fromEntries(new URL(c.req.url).searchParams));
74
+ const query = parseQuery(c, notificationReminderRunListQuerySchema);
58
75
  return c.json(await notificationsService.listReminderRuns(c.get("db"), query));
59
76
  })
60
77
  .get("/reminder-runs/:id", async (c) => {
@@ -65,8 +82,9 @@ export function createNotificationsRoutes(options) {
65
82
  })
66
83
  .post("/reminders/run-due", async (c) => {
67
84
  try {
68
- const dispatcher = createNotificationService(options?.resolveProviders?.(c.env) ?? options?.providers ?? []);
69
- const result = await notificationsService.runDueReminders(c.get("db"), dispatcher, runDueRemindersSchema.parse(await c.req.json().catch(() => ({}))));
85
+ const runtime = getRuntime(c.env, options, (key) => c.var.container.resolve(key));
86
+ const dispatcher = createNotificationService(runtime.providers);
87
+ const result = await notificationsService.runDueReminders(c.get("db"), dispatcher, await parseOptionalJsonBody(c, runDueRemindersSchema));
70
88
  return c.json({ data: result });
71
89
  }
72
90
  catch (error) {
@@ -76,8 +94,9 @@ export function createNotificationsRoutes(options) {
76
94
  })
77
95
  .post("/payment-sessions/:id/send", async (c) => {
78
96
  try {
79
- const dispatcher = createNotificationService(options?.resolveProviders?.(c.env) ?? options?.providers ?? []);
80
- const row = await notificationsService.sendPaymentSessionNotification(c.get("db"), dispatcher, c.req.param("id"), sendPaymentSessionNotificationSchema.parse(await c.req.json()));
97
+ const runtime = getRuntime(c.env, options, (key) => c.var.container.resolve(key));
98
+ const dispatcher = createNotificationService(runtime.providers);
99
+ const row = await notificationsService.sendPaymentSessionNotification(c.get("db"), dispatcher, c.req.param("id"), await parseJsonBody(c, sendPaymentSessionNotificationSchema));
81
100
  if (!row)
82
101
  return c.json({ error: "Payment session not found" }, 404);
83
102
  return c.json({ data: row }, 201);
@@ -89,8 +108,9 @@ export function createNotificationsRoutes(options) {
89
108
  })
90
109
  .post("/invoices/:id/send", async (c) => {
91
110
  try {
92
- const dispatcher = createNotificationService(options?.resolveProviders?.(c.env) ?? options?.providers ?? []);
93
- const row = await notificationsService.sendInvoiceNotification(c.get("db"), dispatcher, c.req.param("id"), sendInvoiceNotificationSchema.parse(await c.req.json()));
111
+ const runtime = getRuntime(c.env, options, (key) => c.var.container.resolve(key));
112
+ const dispatcher = createNotificationService(runtime.providers);
113
+ const row = await notificationsService.sendInvoiceNotification(c.get("db"), dispatcher, c.req.param("id"), await parseJsonBody(c, sendInvoiceNotificationSchema));
94
114
  if (!row)
95
115
  return c.json({ error: "Invoice not found" }, 404);
96
116
  return c.json({ data: row }, 201);
@@ -108,11 +128,11 @@ export function createNotificationsRoutes(options) {
108
128
  })
109
129
  .post("/bookings/:id/send-documents", async (c) => {
110
130
  try {
111
- const dispatcher = createNotificationService(options?.resolveProviders?.(c.env) ?? options?.providers ?? []);
112
- const result = await notificationsService.sendBookingDocumentsNotification(c.get("db"), dispatcher, c.req.param("id"), sendBookingDocumentsNotificationSchema.parse(await c.req.json().catch(() => ({}))), {
113
- attachmentResolver: options?.resolveDocumentAttachmentResolver?.(c.env) ??
114
- options?.documentAttachmentResolver,
115
- eventBus: options?.resolveEventBus?.(c.env) ?? options?.eventBus,
131
+ const runtime = getRuntime(c.env, options, (key) => c.var.container.resolve(key));
132
+ const dispatcher = createNotificationService(runtime.providers);
133
+ const result = await notificationsService.sendBookingDocumentsNotification(c.get("db"), dispatcher, c.req.param("id"), await parseOptionalJsonBody(c, sendBookingDocumentsNotificationSchema), {
134
+ attachmentResolver: runtime.documentAttachmentResolver,
135
+ eventBus: runtime.eventBus,
116
136
  });
117
137
  if (result.status === "not_found")
118
138
  return c.json({ error: "Booking not found" }, 404);
@@ -144,8 +164,9 @@ export function createNotificationsRoutes(options) {
144
164
  })
145
165
  .post("/send", async (c) => {
146
166
  try {
147
- const dispatcher = createNotificationService(options?.resolveProviders?.(c.env) ?? options?.providers ?? []);
148
- const row = await notificationsService.sendNotification(c.get("db"), dispatcher, sendNotificationSchema.parse(await c.req.json()));
167
+ const runtime = getRuntime(c.env, options, (key) => c.var.container.resolve(key));
168
+ const dispatcher = createNotificationService(runtime.providers);
169
+ const row = await notificationsService.sendNotification(c.get("db"), dispatcher, await parseJsonBody(c, sendNotificationSchema));
149
170
  return c.json({ data: row }, 201);
150
171
  }
151
172
  catch (error) {
package/dist/schema.d.ts CHANGED
@@ -316,7 +316,7 @@ export declare const notificationDeliveries: import("drizzle-orm/pg-core").PgTab
316
316
  tableName: "notification_deliveries";
317
317
  dataType: "string";
318
318
  columnType: "PgEnumColumn";
319
- data: "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "organization" | "person" | "payment_session";
319
+ data: "organization" | "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "person" | "payment_session";
320
320
  driverParam: string;
321
321
  notNull: true;
322
322
  hasDefault: true;
@@ -486,7 +486,7 @@ export declare const notificationDeliveries: import("drizzle-orm/pg-core").PgTab
486
486
  tableName: "notification_deliveries";
487
487
  dataType: "string";
488
488
  columnType: "PgEnumColumn";
489
- data: "cancelled" | "pending" | "failed" | "sent";
489
+ data: "pending" | "cancelled" | "failed" | "sent";
490
490
  driverParam: string;
491
491
  notNull: true;
492
492
  hasDefault: true;
@@ -97,7 +97,7 @@ export declare const bookingDocumentNotificationsService: {
97
97
  id: string;
98
98
  templateId: string | null;
99
99
  templateSlug: string | null;
100
- targetType: "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "organization" | "person" | "payment_session";
100
+ targetType: "organization" | "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "person" | "payment_session";
101
101
  targetId: string | null;
102
102
  personId: string | null;
103
103
  organizationId: string | null;
@@ -107,7 +107,7 @@ export declare const bookingDocumentNotificationsService: {
107
107
  channel: "email" | "sms";
108
108
  provider: string;
109
109
  providerMessageId: string | null;
110
- status: "cancelled" | "pending" | "failed" | "sent";
110
+ status: "pending" | "cancelled" | "failed" | "sent";
111
111
  toAddress: string;
112
112
  fromAddress: string | null;
113
113
  subject: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"service-booking-documents.d.ts","sourceRoot":"","sources":["../src/service-booking-documents.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAI9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAGjE,OAAO,KAAK,EACV,yBAAyB,EACzB,mBAAmB,EACnB,qCAAqC,EACtC,MAAM,qBAAqB,CAAA;AAE5B,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAExD,MAAM,MAAM,iCAAiC,GAAG,CAC9C,QAAQ,EAAE,yBAAyB,KAChC,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAAA;AAE3C,MAAM,WAAW,kCAAkC;IACjD,kBAAkB,CAAC,EAAE,iCAAiC,CAAA;IACtD,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACpB;AAED,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,YAAY,EAAE,MAAM,EAAE,CAAA;CACvB;AA2BD,iBAAS,mCAAmC,CAC1C,QA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,eAAO,MAAM,mCAAmC;kCACV,kBAAkB,aAAa,MAAM;;;;;;;;;;;;;;;;;;;;;;;yCAkBnE,kBAAkB,cACV,mBAAmB,aACpB,MAAM,SACV,qCAAqC,YACnC,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4G9C,CAAA;AAED,OAAO,EAAE,mCAAmC,IAAI,sCAAsC,EAAE,CAAA"}
@@ -84,7 +84,7 @@ async function listLegalBookingDocuments(db, bookingId) {
84
84
  format: attachment.mimeType === "application/pdf" ? "pdf" : null,
85
85
  mimeType: attachment.mimeType ?? null,
86
86
  storageKey: attachment.storageKey ?? null,
87
- downloadUrl: getMetadataString(metadata, ["url", "downloadUrl"]),
87
+ downloadUrl: getMetadataString(metadata, ["url"]),
88
88
  language: contract.language ?? null,
89
89
  metadata,
90
90
  createdAt: attachment.createdAt.toISOString(),
@@ -157,7 +157,7 @@ async function listFinanceBookingDocuments(db, bookingId) {
157
157
  ? "application/json"
158
158
  : "application/xml",
159
159
  storageKey: rendition.storageKey ?? null,
160
- downloadUrl: getMetadataString(metadata, ["url", "downloadUrl"]),
160
+ downloadUrl: getMetadataString(metadata, ["url"]),
161
161
  language: rendition.language ?? invoice.language ?? null,
162
162
  metadata,
163
163
  createdAt: rendition.createdAt.toISOString(),
@@ -255,6 +255,9 @@ export const bookingDocumentNotificationsService = {
255
255
  deliveryId: delivery.id,
256
256
  provider: delivery.provider ?? null,
257
257
  documentKeys: documents.map((document) => document.key),
258
+ }, {
259
+ category: "domain",
260
+ source: "service",
258
261
  });
259
262
  return {
260
263
  status: "sent",
@@ -5,7 +5,7 @@ export declare function listDeliveries(db: PostgresJsDatabase, query: Notificati
5
5
  id: string;
6
6
  templateId: string | null;
7
7
  templateSlug: string | null;
8
- targetType: "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "organization" | "person" | "payment_session";
8
+ targetType: "organization" | "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "person" | "payment_session";
9
9
  targetId: string | null;
10
10
  personId: string | null;
11
11
  organizationId: string | null;
@@ -15,7 +15,7 @@ export declare function listDeliveries(db: PostgresJsDatabase, query: Notificati
15
15
  channel: "email" | "sms";
16
16
  provider: string;
17
17
  providerMessageId: string | null;
18
- status: "cancelled" | "pending" | "failed" | "sent";
18
+ status: "pending" | "cancelled" | "failed" | "sent";
19
19
  toAddress: string;
20
20
  fromAddress: string | null;
21
21
  subject: string | null;
@@ -38,7 +38,7 @@ export declare function getDeliveryById(db: PostgresJsDatabase, id: string): Pro
38
38
  id: string;
39
39
  templateId: string | null;
40
40
  templateSlug: string | null;
41
- targetType: "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "organization" | "person" | "payment_session";
41
+ targetType: "organization" | "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "person" | "payment_session";
42
42
  targetId: string | null;
43
43
  personId: string | null;
44
44
  organizationId: string | null;
@@ -48,7 +48,7 @@ export declare function getDeliveryById(db: PostgresJsDatabase, id: string): Pro
48
48
  channel: "email" | "sms";
49
49
  provider: string;
50
50
  providerMessageId: string | null;
51
- status: "cancelled" | "pending" | "failed" | "sent";
51
+ status: "pending" | "cancelled" | "failed" | "sent";
52
52
  toAddress: string;
53
53
  fromAddress: string | null;
54
54
  subject: string | null;
@@ -67,7 +67,7 @@ export declare function sendNotification(db: PostgresJsDatabase, dispatcher: Not
67
67
  id: string;
68
68
  templateId: string | null;
69
69
  templateSlug: string | null;
70
- targetType: "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "organization" | "person" | "payment_session";
70
+ targetType: "organization" | "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "person" | "payment_session";
71
71
  targetId: string | null;
72
72
  personId: string | null;
73
73
  organizationId: string | null;
@@ -77,7 +77,7 @@ export declare function sendNotification(db: PostgresJsDatabase, dispatcher: Not
77
77
  channel: "email" | "sms";
78
78
  provider: string;
79
79
  providerMessageId: string | null;
80
- status: "cancelled" | "pending" | "failed" | "sent";
80
+ status: "pending" | "cancelled" | "failed" | "sent";
81
81
  toAddress: string;
82
82
  fromAddress: string | null;
83
83
  subject: string | null;
@@ -96,7 +96,7 @@ export declare function sendPaymentSessionNotification(db: PostgresJsDatabase, d
96
96
  id: string;
97
97
  templateId: string | null;
98
98
  templateSlug: string | null;
99
- targetType: "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "organization" | "person" | "payment_session";
99
+ targetType: "organization" | "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "person" | "payment_session";
100
100
  targetId: string | null;
101
101
  personId: string | null;
102
102
  organizationId: string | null;
@@ -106,7 +106,7 @@ export declare function sendPaymentSessionNotification(db: PostgresJsDatabase, d
106
106
  channel: "email" | "sms";
107
107
  provider: string;
108
108
  providerMessageId: string | null;
109
- status: "cancelled" | "pending" | "failed" | "sent";
109
+ status: "pending" | "cancelled" | "failed" | "sent";
110
110
  toAddress: string;
111
111
  fromAddress: string | null;
112
112
  subject: string | null;
@@ -125,7 +125,7 @@ export declare function sendInvoiceNotification(db: PostgresJsDatabase, dispatch
125
125
  id: string;
126
126
  templateId: string | null;
127
127
  templateSlug: string | null;
128
- targetType: "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "organization" | "person" | "payment_session";
128
+ targetType: "organization" | "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "person" | "payment_session";
129
129
  targetId: string | null;
130
130
  personId: string | null;
131
131
  organizationId: string | null;
@@ -135,7 +135,7 @@ export declare function sendInvoiceNotification(db: PostgresJsDatabase, dispatch
135
135
  channel: "email" | "sms";
136
136
  provider: string;
137
137
  providerMessageId: string | null;
138
- status: "cancelled" | "pending" | "failed" | "sent";
138
+ status: "pending" | "cancelled" | "failed" | "sent";
139
139
  toAddress: string;
140
140
  fromAddress: string | null;
141
141
  subject: string | null;
@@ -54,15 +54,15 @@ export declare function getTemplateBySlug(db: PostgresJsDatabase, slug: string):
54
54
  updatedAt: Date;
55
55
  } | null>;
56
56
  export declare function createTemplate(db: PostgresJsDatabase, data: CreateNotificationTemplateInput): Promise<{
57
+ metadata: Record<string, unknown> | null;
57
58
  id: string;
58
59
  name: string;
59
- status: "draft" | "active" | "archived";
60
60
  createdAt: Date;
61
61
  updatedAt: Date;
62
- metadata: Record<string, unknown> | null;
62
+ slug: string;
63
+ status: "draft" | "active" | "archived";
63
64
  channel: "email" | "sms";
64
65
  provider: string | null;
65
- slug: string;
66
66
  subjectTemplate: string | null;
67
67
  htmlTemplate: string | null;
68
68
  textTemplate: string | null;
@@ -123,17 +123,17 @@ export declare function getReminderRuleById(db: PostgresJsDatabase, id: string):
123
123
  updatedAt: Date;
124
124
  } | null>;
125
125
  export declare function createReminderRule(db: PostgresJsDatabase, data: CreateNotificationReminderRuleInput): Promise<{
126
+ metadata: Record<string, unknown> | null;
126
127
  id: string;
127
128
  name: string;
128
- status: "draft" | "active" | "archived";
129
129
  createdAt: Date;
130
130
  updatedAt: Date;
131
- metadata: Record<string, unknown> | null;
131
+ slug: string;
132
+ status: "draft" | "active" | "archived";
132
133
  channel: "email" | "sms";
133
134
  provider: string | null;
134
135
  targetType: "invoice" | "booking_payment_schedule";
135
136
  templateId: string | null;
136
- slug: string;
137
137
  isSystem: boolean;
138
138
  templateSlug: string | null;
139
139
  relativeDaysFromDueDate: number;
@@ -192,7 +192,7 @@ export declare function listReminderRuns(db: PostgresJsDatabase, query: Notifica
192
192
  };
193
193
  delivery: {
194
194
  id: string;
195
- status: "cancelled" | "pending" | "failed" | "sent";
195
+ status: "pending" | "cancelled" | "failed" | "sent";
196
196
  channel: "email" | "sms";
197
197
  provider: string;
198
198
  toAddress: string;
@@ -243,7 +243,7 @@ export declare function getReminderRunById(db: PostgresJsDatabase, id: string):
243
243
  };
244
244
  delivery: {
245
245
  id: string;
246
- status: "cancelled" | "pending" | "failed" | "sent";
246
+ status: "pending" | "cancelled" | "failed" | "sent";
247
247
  channel: "email" | "sms";
248
248
  provider: string;
249
249
  toAddress: string;
package/dist/service.d.ts CHANGED
@@ -104,7 +104,7 @@ export declare const notificationsService: {
104
104
  id: string;
105
105
  templateId: string | null;
106
106
  templateSlug: string | null;
107
- targetType: "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "organization" | "person" | "payment_session";
107
+ targetType: "organization" | "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "person" | "payment_session";
108
108
  targetId: string | null;
109
109
  personId: string | null;
110
110
  organizationId: string | null;
@@ -114,7 +114,7 @@ export declare const notificationsService: {
114
114
  channel: "email" | "sms";
115
115
  provider: string;
116
116
  providerMessageId: string | null;
117
- status: "cancelled" | "pending" | "failed" | "sent";
117
+ status: "pending" | "cancelled" | "failed" | "sent";
118
118
  toAddress: string;
119
119
  fromAddress: string | null;
120
120
  subject: string | null;
@@ -0,0 +1,14 @@
1
+ import type { NotificationProvider } from "./types.js";
2
+ export type NotificationTaskEnv = {
3
+ RESEND_API_KEY?: unknown;
4
+ EMAIL_FROM?: unknown;
5
+ };
6
+ export type NotificationTaskRuntime = {
7
+ providers: ReadonlyArray<NotificationProvider>;
8
+ };
9
+ export type NotificationTaskRuntimeOptions = {
10
+ providers?: ReadonlyArray<NotificationProvider>;
11
+ resolveProviders?: (env: NotificationTaskEnv) => ReadonlyArray<NotificationProvider>;
12
+ };
13
+ export declare function buildNotificationTaskRuntime(env: NotificationTaskEnv, options?: NotificationTaskRuntimeOptions): NotificationTaskRuntime;
14
+ //# sourceMappingURL=task-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-runtime.d.ts","sourceRoot":"","sources":["../src/task-runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAEtD,MAAM,MAAM,mBAAmB,GAAG;IAChC,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,SAAS,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAA;CAC/C,CAAA;AAED,MAAM,MAAM,8BAA8B,GAAG;IAC3C,SAAS,CAAC,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAA;IAC/C,gBAAgB,CAAC,EAAE,CAAC,GAAG,EAAE,mBAAmB,KAAK,aAAa,CAAC,oBAAoB,CAAC,CAAA;CACrF,CAAA;AAED,wBAAgB,4BAA4B,CAC1C,GAAG,EAAE,mBAAmB,EACxB,OAAO,GAAE,8BAAmC,GAC3C,uBAAuB,CAOzB"}
@@ -0,0 +1,8 @@
1
+ import { createDefaultNotificationProviders } from "./provider-resolution.js";
2
+ export function buildNotificationTaskRuntime(env, options = {}) {
3
+ return {
4
+ providers: options.resolveProviders?.(env) ??
5
+ options.providers ??
6
+ createDefaultNotificationProviders(env),
7
+ };
8
+ }
@@ -1,13 +1,6 @@
1
1
  import type { PostgresJsDatabase } from "drizzle-orm/postgres-js";
2
- import type { NotificationProvider } from "../types.js";
3
- type NotificationTaskEnv = {
4
- RESEND_API_KEY?: unknown;
5
- EMAIL_FROM?: unknown;
6
- };
2
+ import { type NotificationTaskEnv, type NotificationTaskRuntimeOptions } from "../task-runtime.js";
7
3
  export declare function sendDueNotificationReminders(db: PostgresJsDatabase, env: NotificationTaskEnv, input?: {
8
4
  now?: string | null;
9
- }, options?: {
10
- resolveProviders?: (env: NotificationTaskEnv) => ReadonlyArray<NotificationProvider>;
11
- }): Promise<import("../service-shared.js").ReminderSweepResult>;
12
- export {};
5
+ }, options?: NotificationTaskRuntimeOptions): Promise<import("../service-shared.js").ReminderSweepResult>;
13
6
  //# sourceMappingURL=send-due-reminders.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"send-due-reminders.d.ts","sourceRoot":"","sources":["../../src/tasks/send-due-reminders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAGjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AAEvD,KAAK,mBAAmB,GAAG;IACzB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,CAAA;AAED,wBAAsB,4BAA4B,CAChD,EAAE,EAAE,kBAAkB,EACtB,GAAG,EAAE,mBAAmB,EACxB,KAAK,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAO,EACnC,OAAO,GAAE;IACP,gBAAgB,CAAC,EAAE,CAAC,GAAG,EAAE,mBAAmB,KAAK,aAAa,CAAC,oBAAoB,CAAC,CAAA;CAChF,+DAMP"}
1
+ {"version":3,"file":"send-due-reminders.d.ts","sourceRoot":"","sources":["../../src/tasks/send-due-reminders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAEjE,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,8BAA8B,EACpC,MAAM,oBAAoB,CAAA;AAE3B,wBAAsB,4BAA4B,CAChD,EAAE,EAAE,kBAAkB,EACtB,GAAG,EAAE,mBAAmB,EACxB,KAAK,GAAE;IAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAO,EACnC,OAAO,GAAE,8BAAmC,+DAK7C"}
@@ -1,6 +1,7 @@
1
- import { createDefaultNotificationProviders } from "../provider-resolution.js";
2
1
  import { createNotificationService, notificationsService } from "../service.js";
2
+ import { buildNotificationTaskRuntime, } from "../task-runtime.js";
3
3
  export async function sendDueNotificationReminders(db, env, input = {}, options = {}) {
4
- const dispatcher = createNotificationService(options.resolveProviders?.(env) ?? createDefaultNotificationProviders(env));
4
+ const runtime = buildNotificationTaskRuntime(env, options);
5
+ const dispatcher = createNotificationService(runtime.providers);
5
6
  return notificationsService.runDueReminders(db, dispatcher, input);
6
7
  }
@@ -9,18 +9,18 @@ export declare const notificationTemplateStatusSchema: z.ZodEnum<{
9
9
  archived: "archived";
10
10
  }>;
11
11
  export declare const notificationDeliveryStatusSchema: z.ZodEnum<{
12
- cancelled: "cancelled";
13
12
  pending: "pending";
13
+ cancelled: "cancelled";
14
14
  failed: "failed";
15
15
  sent: "sent";
16
16
  }>;
17
17
  export declare const notificationTargetTypeSchema: z.ZodEnum<{
18
+ organization: "organization";
18
19
  other: "other";
19
20
  booking: "booking";
20
21
  invoice: "invoice";
21
22
  booking_payment_schedule: "booking_payment_schedule";
22
23
  booking_guarantee: "booking_guarantee";
23
- organization: "organization";
24
24
  person: "person";
25
25
  payment_session: "payment_session";
26
26
  }>;
@@ -123,19 +123,19 @@ export declare const notificationDeliveryListQuerySchema: z.ZodObject<{
123
123
  }>>;
124
124
  provider: z.ZodOptional<z.ZodString>;
125
125
  status: z.ZodOptional<z.ZodEnum<{
126
- cancelled: "cancelled";
127
126
  pending: "pending";
127
+ cancelled: "cancelled";
128
128
  failed: "failed";
129
129
  sent: "sent";
130
130
  }>>;
131
131
  templateSlug: z.ZodOptional<z.ZodString>;
132
132
  targetType: z.ZodOptional<z.ZodEnum<{
133
+ organization: "organization";
133
134
  other: "other";
134
135
  booking: "booking";
135
136
  invoice: "invoice";
136
137
  booking_payment_schedule: "booking_payment_schedule";
137
138
  booking_guarantee: "booking_guarantee";
138
- organization: "organization";
139
139
  person: "person";
140
140
  payment_session: "payment_session";
141
141
  }>>;
@@ -259,8 +259,8 @@ export declare const notificationReminderRunRuleSummarySchema: z.ZodObject<{
259
259
  export declare const notificationReminderRunDeliverySummarySchema: z.ZodObject<{
260
260
  id: z.ZodString;
261
261
  status: z.ZodEnum<{
262
- cancelled: "cancelled";
263
262
  pending: "pending";
263
+ cancelled: "cancelled";
264
264
  failed: "failed";
265
265
  sent: "sent";
266
266
  }>;
@@ -340,8 +340,8 @@ export declare const notificationReminderRunRecordSchema: z.ZodObject<{
340
340
  delivery: z.ZodNullable<z.ZodObject<{
341
341
  id: z.ZodString;
342
342
  status: z.ZodEnum<{
343
- cancelled: "cancelled";
344
343
  pending: "pending";
344
+ cancelled: "cancelled";
345
345
  failed: "failed";
346
346
  sent: "sent";
347
347
  }>;
@@ -414,8 +414,8 @@ export declare const notificationReminderRunListResponseSchema: z.ZodObject<{
414
414
  delivery: z.ZodNullable<z.ZodObject<{
415
415
  id: z.ZodString;
416
416
  status: z.ZodEnum<{
417
- cancelled: "cancelled";
418
417
  pending: "pending";
418
+ cancelled: "cancelled";
419
419
  failed: "failed";
420
420
  sent: "sent";
421
421
  }>;
@@ -520,12 +520,12 @@ export declare const sendNotificationSchema: z.ZodObject<{
520
520
  }, z.core.$strip>>>>;
521
521
  data: z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
522
522
  targetType: z.ZodDefault<z.ZodEnum<{
523
+ organization: "organization";
523
524
  other: "other";
524
525
  booking: "booking";
525
526
  invoice: "invoice";
526
527
  booking_payment_schedule: "booking_payment_schedule";
527
528
  booking_guarantee: "booking_guarantee";
528
- organization: "organization";
529
529
  person: "person";
530
530
  payment_session: "payment_session";
531
531
  }>>;
@@ -646,8 +646,8 @@ export declare const sendBookingDocumentsNotificationResultSchema: z.ZodObject<{
646
646
  deliveryId: z.ZodString;
647
647
  provider: z.ZodNullable<z.ZodOptional<z.ZodString>>;
648
648
  status: z.ZodEnum<{
649
- cancelled: "cancelled";
650
649
  pending: "pending";
650
+ cancelled: "cancelled";
651
651
  failed: "failed";
652
652
  sent: "sent";
653
653
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voyantjs/notifications",
3
- "version": "0.5.0",
3
+ "version": "0.6.2",
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/core": "0.5.0",
53
- "@voyantjs/db": "0.5.0",
54
- "@voyantjs/bookings": "0.5.0",
55
- "@voyantjs/finance": "0.5.0",
56
- "@voyantjs/hono": "0.5.0",
57
- "@voyantjs/legal": "0.5.0"
52
+ "@voyantjs/bookings": "0.6.2",
53
+ "@voyantjs/core": "0.6.2",
54
+ "@voyantjs/db": "0.6.2",
55
+ "@voyantjs/finance": "0.6.2",
56
+ "@voyantjs/hono": "0.6.2",
57
+ "@voyantjs/legal": "0.6.2"
58
58
  },
59
59
  "devDependencies": {
60
60
  "typescript": "^6.0.2",