@voyantjs/notifications 0.20.0 → 0.21.0
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 +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +74 -0
- package/dist/providers/voyant-cloud-email.d.ts.map +1 -1
- package/dist/providers/voyant-cloud-email.js +46 -3
- package/dist/routes.d.ts +86 -17
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +14 -0
- package/dist/schema.d.ts +6 -6
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +3 -0
- package/dist/service-booking-documents.d.ts +2 -2
- package/dist/service-deliveries.d.ts +34 -5
- package/dist/service-deliveries.d.ts.map +1 -1
- package/dist/service-deliveries.js +119 -0
- package/dist/service-reminders.d.ts +34 -2
- package/dist/service-reminders.d.ts.map +1 -1
- package/dist/service-reminders.js +283 -23
- package/dist/service-shared.d.ts +1 -13
- package/dist/service-shared.d.ts.map +1 -1
- package/dist/service-shared.js +45 -5
- package/dist/service-templates.d.ts +10 -10
- package/dist/service.d.ts +4 -3
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +2 -1
- package/dist/validation.d.ts +37 -7
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +7 -1
- package/package.json +7 -7
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export type { NotificationService } from "./service.js";
|
|
|
16
16
|
export { createDefaultBookingDocumentAttachment, createNotificationService, NotificationError, notificationsService, previewNotificationTemplate, renderNotificationTemplate, } from "./service.js";
|
|
17
17
|
export type { BookingDocumentAttachmentResolver, BookingDocumentsSentEvent, SendBookingDocumentsRuntimeOptions, } from "./service-booking-documents.js";
|
|
18
18
|
export { bookingDocumentNotificationsService } from "./service-booking-documents.js";
|
|
19
|
+
export { bookingIsPaidInFullForNotification, dispatchReminderEventRules, } from "./service-reminders.js";
|
|
19
20
|
export type { NotificationTaskEnv, NotificationTaskRuntime, NotificationTaskRuntimeOptions, ReminderDeliveryJob, } from "./task-runtime.js";
|
|
20
21
|
export { buildNotificationTaskRuntime } from "./task-runtime.js";
|
|
21
22
|
export { deliverQueuedNotificationReminder, sendDueNotificationReminders } from "./tasks/index.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAGvD,OAAO,EAIL,KAAK,0BAA0B,EAChC,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAGvD,OAAO,EAIL,KAAK,0BAA0B,EAChC,MAAM,aAAa,CAAA;AASpB,OAAO,EACL,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,aAAa,CAAA;AACpB,YAAY,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,YAAY,EACV,+BAA+B,EAC/B,wBAAwB,GACzB,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAA;AAClF,YAAY,EACV,6BAA6B,EAC7B,sBAAsB,GACvB,MAAM,iCAAiC,CAAA;AACxC,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAA;AAC9E,YAAY,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAA;AACxF,OAAO,EACL,8BAA8B,EAC9B,yBAAyB,EACzB,yCAAyC,GAC1C,MAAM,aAAa,CAAA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,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,uCAAuC,EACvC,iCAAiC,EACjC,qBAAqB,EACrB,4CAA4C,EAC5C,sCAAsC,EACtC,6BAA6B,EAC7B,sBAAsB,EACtB,oCAAoC,EACpC,oCAAoC,EACpC,gCAAgC,GACjC,MAAM,iBAAiB,CAAA;AAExB;;;GAGG;AACH,MAAM,WAAW,0CAA0C;IACzD,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,8DAA8D;IAC9D,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,uEAAuE;IACvE,aAAa,CAAC,EAAE,KAAK,CAAC,UAAU,GAAG,SAAS,GAAG,UAAU,CAAC,CAAA;CAC3D;AAED,MAAM,WAAW,oCAAqC,SAAQ,0BAA0B;IACtF;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,YAAY,CAAA;IAC/D,sBAAsB,CAAC,EAAE,0CAA0C,CAAA;CACpE;AAED,wBAAgB,6BAA6B,CAC3C,OAAO,CAAC,EAAE,oCAAoC,GAC7C,UAAU,CAkNZ"}
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { buildNotificationsRouteRuntime, createNotificationsRoutes, NOTIFICATION
|
|
|
2
2
|
import { notificationsModule } from "./schema.js";
|
|
3
3
|
import { createNotificationService } from "./service.js";
|
|
4
4
|
import { bookingDocumentNotificationsService } from "./service-booking-documents.js";
|
|
5
|
+
import { bookingIsPaidInFullForNotification, dispatchReminderEventRules, } from "./service-reminders.js";
|
|
5
6
|
export { notificationLiquidEngine, renderLiquidTemplate, } from "./liquid.js";
|
|
6
7
|
export { createLocalProvider } from "./providers/local.js";
|
|
7
8
|
export { createVoyantCloudEmailProvider } from "./providers/voyant-cloud-email.js";
|
|
@@ -10,6 +11,7 @@ export { buildNotificationsRouteRuntime, createNotificationsRoutes, NOTIFICATION
|
|
|
10
11
|
export { notificationChannelEnum, notificationDeliveries, notificationDeliveryStatusEnum, notificationReminderRules, notificationReminderRunStatusEnum, notificationReminderRuns, notificationReminderStatusEnum, notificationReminderTargetTypeEnum, notificationsModule, notificationTargetTypeEnum, notificationTemplateStatusEnum, notificationTemplates, } from "./schema.js";
|
|
11
12
|
export { createDefaultBookingDocumentAttachment, createNotificationService, NotificationError, notificationsService, previewNotificationTemplate, renderNotificationTemplate, } from "./service.js";
|
|
12
13
|
export { bookingDocumentNotificationsService } from "./service-booking-documents.js";
|
|
14
|
+
export { bookingIsPaidInFullForNotification, dispatchReminderEventRules, } from "./service-reminders.js";
|
|
13
15
|
export { buildNotificationTaskRuntime } from "./task-runtime.js";
|
|
14
16
|
export { deliverQueuedNotificationReminder, sendDueNotificationReminders } from "./tasks/index.js";
|
|
15
17
|
export { notificationLiquidSnippets, notificationTemplateVariableCatalog, } from "./template-authoring.js";
|
|
@@ -53,6 +55,78 @@ export function createNotificationsHonoModule(options) {
|
|
|
53
55
|
}
|
|
54
56
|
});
|
|
55
57
|
}
|
|
58
|
+
if (options?.resolveDb) {
|
|
59
|
+
const resolveDb = options.resolveDb;
|
|
60
|
+
const runtime = buildNotificationsRouteRuntime(bindings, options);
|
|
61
|
+
const dispatcher = createNotificationService(runtime.providers);
|
|
62
|
+
eventBus.subscribe("booking.confirmed", async (event) => {
|
|
63
|
+
try {
|
|
64
|
+
const db = resolveDb(bindings);
|
|
65
|
+
await dispatchReminderEventRules(db, dispatcher, {
|
|
66
|
+
targetType: "booking_confirmed",
|
|
67
|
+
bookingId: event.data.bookingId,
|
|
68
|
+
eventData: event.data,
|
|
69
|
+
}, { documentAttachmentResolver: runtime.documentAttachmentResolver });
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
73
|
+
console.error(`[notifications] booking_confirmed reminder rules failed for booking ${event.data.bookingId}: ${message}`);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
eventBus.subscribe("payment.completed", async (event) => {
|
|
77
|
+
if (!event.data.bookingId) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
const db = resolveDb(bindings);
|
|
82
|
+
const isPaidInFull = await bookingIsPaidInFullForNotification(db, event.data.bookingId);
|
|
83
|
+
if (!isPaidInFull) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
await dispatchReminderEventRules(db, dispatcher, {
|
|
87
|
+
targetType: "payment_complete",
|
|
88
|
+
bookingId: event.data.bookingId,
|
|
89
|
+
paymentSessionId: event.data.paymentSessionId,
|
|
90
|
+
eventData: event.data,
|
|
91
|
+
}, { documentAttachmentResolver: runtime.documentAttachmentResolver });
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
95
|
+
console.error(`[notifications] payment_complete reminder rules failed for booking ${event.data.bookingId}: ${message}`);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
eventBus.subscribe("booking.cancelled", async (event) => {
|
|
99
|
+
if (event.data.previousStatus !== "on_hold") {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
const db = resolveDb(bindings);
|
|
104
|
+
await dispatchReminderEventRules(db, dispatcher, {
|
|
105
|
+
targetType: "booking_cancelled_non_payment",
|
|
106
|
+
bookingId: event.data.bookingId,
|
|
107
|
+
eventData: event.data,
|
|
108
|
+
}, { documentAttachmentResolver: runtime.documentAttachmentResolver });
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
112
|
+
console.error(`[notifications] booking_cancelled_non_payment reminder rules failed for booking ${event.data.bookingId}: ${message}`);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
eventBus.subscribe("booking.expired", async (event) => {
|
|
116
|
+
try {
|
|
117
|
+
const db = resolveDb(bindings);
|
|
118
|
+
await dispatchReminderEventRules(db, dispatcher, {
|
|
119
|
+
targetType: "booking_cancelled_non_payment",
|
|
120
|
+
bookingId: event.data.bookingId,
|
|
121
|
+
eventData: event.data,
|
|
122
|
+
}, { documentAttachmentResolver: runtime.documentAttachmentResolver });
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
126
|
+
console.error(`[notifications] booking_cancelled_non_payment reminder rules failed for expired booking ${event.data.bookingId}: ${message}`);
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
56
130
|
},
|
|
57
131
|
};
|
|
58
132
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"voyant-cloud-email.d.ts","sourceRoot":"","sources":["../../src/providers/voyant-cloud-email.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAE5D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"voyant-cloud-email.d.ts","sourceRoot":"","sources":["../../src/providers/voyant-cloud-email.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAE5D,OAAO,KAAK,EAA0B,oBAAoB,EAAsB,MAAM,aAAa,CAAA;AAEnG,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,+BAA+B;IAC9C,mEAAmE;IACnE,MAAM,EAAE,iBAAiB,CAAA;IACzB,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAA;IACZ,0EAA0E;IAC1E,OAAO,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IAC/B;;;;OAIG;IACH,cAAc,CAAC,EAAE,CACf,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,OAAO,KACV,OAAO,CAAC,wBAAwB,CAAC,GAAG,wBAAwB,CAAA;CAClE;AAsBD;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,+BAA+B,GACvC,oBAAoB,CAqDtB"}
|
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
function mapAttachments(attachments) {
|
|
2
|
+
if (!attachments || attachments.length === 0)
|
|
3
|
+
return undefined;
|
|
4
|
+
return attachments.map((attachment) => ({
|
|
5
|
+
filename: attachment.filename,
|
|
6
|
+
...(attachment.contentBase64 ? { content: attachment.contentBase64 } : {}),
|
|
7
|
+
...(attachment.path ? { path: attachment.path } : {}),
|
|
8
|
+
...(attachment.contentType ? { contentType: attachment.contentType } : {}),
|
|
9
|
+
...(attachment.contentId ? { contentId: attachment.contentId } : {}),
|
|
10
|
+
}));
|
|
11
|
+
}
|
|
12
|
+
function attachEmailRequestContext(error, request) {
|
|
13
|
+
if (!error || typeof error !== "object")
|
|
14
|
+
return;
|
|
15
|
+
Object.defineProperty(error, "notificationRequest", {
|
|
16
|
+
configurable: true,
|
|
17
|
+
enumerable: true,
|
|
18
|
+
value: request,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
1
21
|
/**
|
|
2
22
|
* Notification provider that delivers email through the Voyant Cloud
|
|
3
23
|
* `/email/v1/messages` endpoint.
|
|
@@ -16,14 +36,37 @@ export function createVoyantCloudEmailProvider(options) {
|
|
|
16
36
|
subject: payload.subject ?? payload.template,
|
|
17
37
|
text: JSON.stringify(payload.data ?? {}),
|
|
18
38
|
};
|
|
19
|
-
const
|
|
39
|
+
const attachments = mapAttachments(payload.attachments);
|
|
40
|
+
const request = {
|
|
20
41
|
from: payload.from ?? options.from,
|
|
21
42
|
to: [payload.to],
|
|
22
43
|
subject: payload.subject ?? rendered.subject,
|
|
23
44
|
html: payload.html ?? rendered.html ?? null,
|
|
24
45
|
text: payload.text ?? rendered.text ?? null,
|
|
25
|
-
|
|
26
|
-
|
|
46
|
+
...(attachments ? { attachments } : {}),
|
|
47
|
+
...(options.replyTo ? { replyTo: [...options.replyTo] } : {}),
|
|
48
|
+
};
|
|
49
|
+
let message;
|
|
50
|
+
try {
|
|
51
|
+
message = await options.client.email.sendMessage(request);
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
attachEmailRequestContext(error, {
|
|
55
|
+
from: request.from,
|
|
56
|
+
to: request.to,
|
|
57
|
+
replyTo: "replyTo" in request ? request.replyTo : null,
|
|
58
|
+
subject: request.subject,
|
|
59
|
+
attachmentCount: attachments?.length ?? 0,
|
|
60
|
+
attachments: attachments?.map((attachment) => ({
|
|
61
|
+
filename: attachment.filename,
|
|
62
|
+
path: attachment.path ?? null,
|
|
63
|
+
contentType: attachment.contentType ?? null,
|
|
64
|
+
contentId: attachment.contentId ?? null,
|
|
65
|
+
hasContent: Boolean(attachment.content),
|
|
66
|
+
})) ?? [],
|
|
67
|
+
});
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
27
70
|
return { id: message.id, provider: "voyant-cloud-email" };
|
|
28
71
|
},
|
|
29
72
|
};
|
package/dist/routes.d.ts
CHANGED
|
@@ -207,7 +207,7 @@ export declare function createNotificationsRoutes(options?: NotificationsRoutesO
|
|
|
207
207
|
channel: "email" | "sms";
|
|
208
208
|
provider: string;
|
|
209
209
|
providerMessageId: string | null;
|
|
210
|
-
status: "pending" | "
|
|
210
|
+
status: "pending" | "failed" | "cancelled" | "sent";
|
|
211
211
|
toAddress: string;
|
|
212
212
|
fromAddress: string | null;
|
|
213
213
|
subject: string | null;
|
|
@@ -268,7 +268,7 @@ export declare function createNotificationsRoutes(options?: NotificationsRoutesO
|
|
|
268
268
|
channel: "email" | "sms";
|
|
269
269
|
provider: string;
|
|
270
270
|
providerMessageId: string | null;
|
|
271
|
-
status: "pending" | "
|
|
271
|
+
status: "pending" | "failed" | "cancelled" | "sent";
|
|
272
272
|
toAddress: string;
|
|
273
273
|
fromAddress: string | null;
|
|
274
274
|
subject: string | null;
|
|
@@ -292,6 +292,75 @@ export declare function createNotificationsRoutes(options?: NotificationsRoutesO
|
|
|
292
292
|
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
293
293
|
};
|
|
294
294
|
};
|
|
295
|
+
} & {
|
|
296
|
+
"/deliveries/:id/resend": {
|
|
297
|
+
$post: {
|
|
298
|
+
input: {
|
|
299
|
+
param: {
|
|
300
|
+
id: string;
|
|
301
|
+
};
|
|
302
|
+
};
|
|
303
|
+
output: {
|
|
304
|
+
error: string;
|
|
305
|
+
};
|
|
306
|
+
outputFormat: "json";
|
|
307
|
+
status: 404;
|
|
308
|
+
} | {
|
|
309
|
+
input: {
|
|
310
|
+
param: {
|
|
311
|
+
id: string;
|
|
312
|
+
};
|
|
313
|
+
};
|
|
314
|
+
output: {
|
|
315
|
+
data: {
|
|
316
|
+
id: string;
|
|
317
|
+
templateId: string | null;
|
|
318
|
+
templateSlug: string | null;
|
|
319
|
+
targetType: "organization" | "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "person" | "payment_session";
|
|
320
|
+
targetId: string | null;
|
|
321
|
+
personId: string | null;
|
|
322
|
+
organizationId: string | null;
|
|
323
|
+
bookingId: string | null;
|
|
324
|
+
invoiceId: string | null;
|
|
325
|
+
paymentSessionId: string | null;
|
|
326
|
+
channel: "email" | "sms";
|
|
327
|
+
provider: string;
|
|
328
|
+
providerMessageId: string | null;
|
|
329
|
+
status: "pending" | "failed" | "cancelled" | "sent";
|
|
330
|
+
toAddress: string;
|
|
331
|
+
fromAddress: string | null;
|
|
332
|
+
subject: string | null;
|
|
333
|
+
htmlBody: string | null;
|
|
334
|
+
textBody: string | null;
|
|
335
|
+
payloadData: {
|
|
336
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
337
|
+
} | null;
|
|
338
|
+
metadata: {
|
|
339
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
340
|
+
} | null;
|
|
341
|
+
errorMessage: string | null;
|
|
342
|
+
scheduledFor: string | null;
|
|
343
|
+
sentAt: string | null;
|
|
344
|
+
failedAt: string | null;
|
|
345
|
+
createdAt: string;
|
|
346
|
+
updatedAt: string;
|
|
347
|
+
};
|
|
348
|
+
};
|
|
349
|
+
outputFormat: "json";
|
|
350
|
+
status: 201;
|
|
351
|
+
} | {
|
|
352
|
+
input: {
|
|
353
|
+
param: {
|
|
354
|
+
id: string;
|
|
355
|
+
};
|
|
356
|
+
};
|
|
357
|
+
output: {
|
|
358
|
+
error: string;
|
|
359
|
+
};
|
|
360
|
+
outputFormat: "json";
|
|
361
|
+
status: 400;
|
|
362
|
+
};
|
|
363
|
+
};
|
|
295
364
|
} & {
|
|
296
365
|
"/reminder-rules": {
|
|
297
366
|
$get: {
|
|
@@ -302,7 +371,7 @@ export declare function createNotificationsRoutes(options?: NotificationsRoutesO
|
|
|
302
371
|
slug: string;
|
|
303
372
|
name: string;
|
|
304
373
|
status: "active" | "draft" | "archived";
|
|
305
|
-
targetType: "invoice" | "booking_payment_schedule";
|
|
374
|
+
targetType: "booking_confirmed" | "invoice" | "booking_payment_schedule" | "payment_complete" | "booking_cancelled_non_payment";
|
|
306
375
|
channel: "email" | "sms";
|
|
307
376
|
provider: string | null;
|
|
308
377
|
templateId: string | null;
|
|
@@ -340,7 +409,7 @@ export declare function createNotificationsRoutes(options?: NotificationsRoutesO
|
|
|
340
409
|
status: "active" | "draft" | "archived";
|
|
341
410
|
provider: string | null;
|
|
342
411
|
channel: "email" | "sms";
|
|
343
|
-
targetType: "invoice" | "booking_payment_schedule";
|
|
412
|
+
targetType: "booking_confirmed" | "invoice" | "booking_payment_schedule" | "payment_complete" | "booking_cancelled_non_payment";
|
|
344
413
|
templateId: string | null;
|
|
345
414
|
isSystem: boolean;
|
|
346
415
|
templateSlug: string | null;
|
|
@@ -376,7 +445,7 @@ export declare function createNotificationsRoutes(options?: NotificationsRoutesO
|
|
|
376
445
|
slug: string;
|
|
377
446
|
name: string;
|
|
378
447
|
status: "active" | "draft" | "archived";
|
|
379
|
-
targetType: "invoice" | "booking_payment_schedule";
|
|
448
|
+
targetType: "booking_confirmed" | "invoice" | "booking_payment_schedule" | "payment_complete" | "booking_cancelled_non_payment";
|
|
380
449
|
channel: "email" | "sms";
|
|
381
450
|
provider: string | null;
|
|
382
451
|
templateId: string | null;
|
|
@@ -419,7 +488,7 @@ export declare function createNotificationsRoutes(options?: NotificationsRoutesO
|
|
|
419
488
|
slug: string;
|
|
420
489
|
name: string;
|
|
421
490
|
status: "active" | "draft" | "archived";
|
|
422
|
-
targetType: "invoice" | "booking_payment_schedule";
|
|
491
|
+
targetType: "booking_confirmed" | "invoice" | "booking_payment_schedule" | "payment_complete" | "booking_cancelled_non_payment";
|
|
423
492
|
channel: "email" | "sms";
|
|
424
493
|
provider: string | null;
|
|
425
494
|
templateId: string | null;
|
|
@@ -445,7 +514,7 @@ export declare function createNotificationsRoutes(options?: NotificationsRoutesO
|
|
|
445
514
|
data: {
|
|
446
515
|
id: string;
|
|
447
516
|
reminderRuleId: string;
|
|
448
|
-
targetType: "invoice" | "booking_payment_schedule";
|
|
517
|
+
targetType: "booking_confirmed" | "invoice" | "booking_payment_schedule" | "payment_complete" | "booking_cancelled_non_payment";
|
|
449
518
|
targetId: string;
|
|
450
519
|
dedupeKey: string;
|
|
451
520
|
status: "failed" | "sent" | "processing" | "skipped" | "queued";
|
|
@@ -472,7 +541,7 @@ export declare function createNotificationsRoutes(options?: NotificationsRoutesO
|
|
|
472
541
|
slug: string;
|
|
473
542
|
name: string;
|
|
474
543
|
status: "active" | "draft" | "archived";
|
|
475
|
-
targetType: "invoice" | "booking_payment_schedule";
|
|
544
|
+
targetType: "booking_confirmed" | "invoice" | "booking_payment_schedule" | "payment_complete" | "booking_cancelled_non_payment";
|
|
476
545
|
channel: "email" | "sms";
|
|
477
546
|
provider: string | null;
|
|
478
547
|
templateId: string | null;
|
|
@@ -481,7 +550,7 @@ export declare function createNotificationsRoutes(options?: NotificationsRoutesO
|
|
|
481
550
|
};
|
|
482
551
|
delivery: {
|
|
483
552
|
id: string;
|
|
484
|
-
status: "pending" | "
|
|
553
|
+
status: "pending" | "failed" | "cancelled" | "sent";
|
|
485
554
|
channel: "email" | "sms";
|
|
486
555
|
provider: string;
|
|
487
556
|
toAddress: string;
|
|
@@ -522,7 +591,7 @@ export declare function createNotificationsRoutes(options?: NotificationsRoutesO
|
|
|
522
591
|
data: {
|
|
523
592
|
id: string;
|
|
524
593
|
reminderRuleId: string;
|
|
525
|
-
targetType: "invoice" | "booking_payment_schedule";
|
|
594
|
+
targetType: "booking_confirmed" | "invoice" | "booking_payment_schedule" | "payment_complete" | "booking_cancelled_non_payment";
|
|
526
595
|
targetId: string;
|
|
527
596
|
dedupeKey: string;
|
|
528
597
|
status: "failed" | "sent" | "processing" | "skipped" | "queued";
|
|
@@ -549,7 +618,7 @@ export declare function createNotificationsRoutes(options?: NotificationsRoutesO
|
|
|
549
618
|
slug: string;
|
|
550
619
|
name: string;
|
|
551
620
|
status: "active" | "draft" | "archived";
|
|
552
|
-
targetType: "invoice" | "booking_payment_schedule";
|
|
621
|
+
targetType: "booking_confirmed" | "invoice" | "booking_payment_schedule" | "payment_complete" | "booking_cancelled_non_payment";
|
|
553
622
|
channel: "email" | "sms";
|
|
554
623
|
provider: string | null;
|
|
555
624
|
templateId: string | null;
|
|
@@ -558,7 +627,7 @@ export declare function createNotificationsRoutes(options?: NotificationsRoutesO
|
|
|
558
627
|
};
|
|
559
628
|
delivery: {
|
|
560
629
|
id: string;
|
|
561
|
-
status: "pending" | "
|
|
630
|
+
status: "pending" | "failed" | "cancelled" | "sent";
|
|
562
631
|
channel: "email" | "sms";
|
|
563
632
|
provider: string;
|
|
564
633
|
toAddress: string;
|
|
@@ -630,7 +699,7 @@ export declare function createNotificationsRoutes(options?: NotificationsRoutesO
|
|
|
630
699
|
channel: "email" | "sms";
|
|
631
700
|
provider: string;
|
|
632
701
|
providerMessageId: string | null;
|
|
633
|
-
status: "pending" | "
|
|
702
|
+
status: "pending" | "failed" | "cancelled" | "sent";
|
|
634
703
|
toAddress: string;
|
|
635
704
|
fromAddress: string | null;
|
|
636
705
|
subject: string | null;
|
|
@@ -699,7 +768,7 @@ export declare function createNotificationsRoutes(options?: NotificationsRoutesO
|
|
|
699
768
|
channel: "email" | "sms";
|
|
700
769
|
provider: string;
|
|
701
770
|
providerMessageId: string | null;
|
|
702
|
-
status: "pending" | "
|
|
771
|
+
status: "pending" | "failed" | "cancelled" | "sent";
|
|
703
772
|
toAddress: string;
|
|
704
773
|
fromAddress: string | null;
|
|
705
774
|
subject: string | null;
|
|
@@ -831,7 +900,7 @@ export declare function createNotificationsRoutes(options?: NotificationsRoutesO
|
|
|
831
900
|
notification: {
|
|
832
901
|
recipient: string;
|
|
833
902
|
deliveryId: string;
|
|
834
|
-
status: "pending" | "
|
|
903
|
+
status: "pending" | "failed" | "cancelled" | "sent";
|
|
835
904
|
provider?: string | null | undefined;
|
|
836
905
|
} | null;
|
|
837
906
|
skipReason: "preview_only" | "no_documents" | "no_recipient" | "no_attachments" | "send_failed" | null;
|
|
@@ -909,7 +978,7 @@ export declare function createNotificationsRoutes(options?: NotificationsRoutesO
|
|
|
909
978
|
} | null | undefined;
|
|
910
979
|
}[];
|
|
911
980
|
deliveryId: string;
|
|
912
|
-
status: "pending" | "
|
|
981
|
+
status: "pending" | "failed" | "cancelled" | "sent";
|
|
913
982
|
provider?: string | null | undefined;
|
|
914
983
|
};
|
|
915
984
|
};
|
|
@@ -936,7 +1005,7 @@ export declare function createNotificationsRoutes(options?: NotificationsRoutesO
|
|
|
936
1005
|
channel: "email" | "sms";
|
|
937
1006
|
provider: string;
|
|
938
1007
|
providerMessageId: string | null;
|
|
939
|
-
status: "pending" | "
|
|
1008
|
+
status: "pending" | "failed" | "cancelled" | "sent";
|
|
940
1009
|
toAddress: string;
|
|
941
1010
|
fromAddress: string | null;
|
|
942
1011
|
subject: string | null;
|
package/dist/routes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAE/D,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;AAuBtD,KAAK,GAAG,GAAG;IACT,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,SAAS,EAAE;QACT,SAAS,EAAE,eAAe,CAAA;QAC1B,EAAE,EAAE,kBAAkB,CAAA;QACtB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,SAAS,CAAC,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAA;IAC/C,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,aAAa,CAAC,oBAAoB,CAAC,CAAA;IAC7F,0BAA0B,CAAC,EAAE,iCAAiC,CAAA;IAC9D,iCAAiC,CAAC,EAAE,CAClC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAC9B,iCAAiC,GAAG,SAAS,CAAA;IAClD,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,eAAe,CAAC,EAAE,CAAC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwQ7E"}
|
package/dist/routes.js
CHANGED
|
@@ -53,6 +53,20 @@ export function createNotificationsRoutes(options) {
|
|
|
53
53
|
if (!row)
|
|
54
54
|
return c.json({ error: "Notification delivery not found" }, 404);
|
|
55
55
|
return c.json({ data: row });
|
|
56
|
+
})
|
|
57
|
+
.post("/deliveries/:id/resend", async (c) => {
|
|
58
|
+
try {
|
|
59
|
+
const runtime = getRuntime(c.env, options, (key) => c.var.container.resolve(key));
|
|
60
|
+
const dispatcher = createNotificationService(runtime.providers);
|
|
61
|
+
const row = await notificationsService.resendDelivery(c.get("db"), dispatcher, c.req.param("id"));
|
|
62
|
+
if (!row)
|
|
63
|
+
return c.json({ error: "Notification delivery not found" }, 404);
|
|
64
|
+
return c.json({ data: row }, 201);
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
const message = error instanceof Error ? error.message : "Notification resend failed";
|
|
68
|
+
return c.json({ error: message }, 400);
|
|
69
|
+
}
|
|
56
70
|
})
|
|
57
71
|
.get("/reminder-rules", async (c) => {
|
|
58
72
|
const query = parseQuery(c, notificationReminderRuleListQuerySchema);
|
package/dist/schema.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const notificationTemplateStatusEnum: import("drizzle-orm/pg-core
|
|
|
5
5
|
export declare const notificationDeliveryStatusEnum: import("drizzle-orm/pg-core").PgEnum<["pending", "sent", "failed", "cancelled"]>;
|
|
6
6
|
export declare const notificationTargetTypeEnum: import("drizzle-orm/pg-core").PgEnum<["booking", "booking_payment_schedule", "booking_guarantee", "invoice", "payment_session", "person", "organization", "other"]>;
|
|
7
7
|
export declare const notificationReminderStatusEnum: import("drizzle-orm/pg-core").PgEnum<["draft", "active", "archived"]>;
|
|
8
|
-
export declare const notificationReminderTargetTypeEnum: import("drizzle-orm/pg-core").PgEnum<["booking_payment_schedule", "invoice"]>;
|
|
8
|
+
export declare const notificationReminderTargetTypeEnum: import("drizzle-orm/pg-core").PgEnum<["booking_confirmed", "booking_payment_schedule", "payment_complete", "booking_cancelled_non_payment", "invoice"]>;
|
|
9
9
|
export declare const notificationReminderRunStatusEnum: import("drizzle-orm/pg-core").PgEnum<["queued", "processing", "sent", "skipped", "failed"]>;
|
|
10
10
|
export declare const notificationTemplates: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
11
11
|
name: "notification_templates";
|
|
@@ -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: "pending" | "
|
|
489
|
+
data: "pending" | "failed" | "cancelled" | "sent";
|
|
490
490
|
driverParam: string;
|
|
491
491
|
notNull: true;
|
|
492
492
|
hasDefault: true;
|
|
@@ -805,14 +805,14 @@ export declare const notificationReminderRules: import("drizzle-orm/pg-core").Pg
|
|
|
805
805
|
tableName: "notification_reminder_rules";
|
|
806
806
|
dataType: "string";
|
|
807
807
|
columnType: "PgEnumColumn";
|
|
808
|
-
data: "invoice" | "booking_payment_schedule";
|
|
808
|
+
data: "booking_confirmed" | "invoice" | "booking_payment_schedule" | "payment_complete" | "booking_cancelled_non_payment";
|
|
809
809
|
driverParam: string;
|
|
810
810
|
notNull: true;
|
|
811
811
|
hasDefault: false;
|
|
812
812
|
isPrimaryKey: false;
|
|
813
813
|
isAutoincrement: false;
|
|
814
814
|
hasRuntimeDefault: false;
|
|
815
|
-
enumValues: ["booking_payment_schedule", "invoice"];
|
|
815
|
+
enumValues: ["booking_confirmed", "booking_payment_schedule", "payment_complete", "booking_cancelled_non_payment", "invoice"];
|
|
816
816
|
baseColumn: never;
|
|
817
817
|
identity: undefined;
|
|
818
818
|
generated: undefined;
|
|
@@ -1020,14 +1020,14 @@ export declare const notificationReminderRuns: import("drizzle-orm/pg-core").PgT
|
|
|
1020
1020
|
tableName: "notification_reminder_runs";
|
|
1021
1021
|
dataType: "string";
|
|
1022
1022
|
columnType: "PgEnumColumn";
|
|
1023
|
-
data: "invoice" | "booking_payment_schedule";
|
|
1023
|
+
data: "booking_confirmed" | "invoice" | "booking_payment_schedule" | "payment_complete" | "booking_cancelled_non_payment";
|
|
1024
1024
|
driverParam: string;
|
|
1025
1025
|
notNull: true;
|
|
1026
1026
|
hasDefault: false;
|
|
1027
1027
|
isPrimaryKey: false;
|
|
1028
1028
|
isAutoincrement: false;
|
|
1029
1029
|
hasRuntimeDefault: false;
|
|
1030
|
-
enumValues: ["booking_payment_schedule", "invoice"];
|
|
1030
|
+
enumValues: ["booking_confirmed", "booking_payment_schedule", "payment_complete", "booking_cancelled_non_payment", "invoice"];
|
|
1031
1031
|
baseColumn: never;
|
|
1032
1032
|
identity: undefined;
|
|
1033
1033
|
generated: undefined;
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAEhE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAcvD,eAAO,MAAM,uBAAuB,wDAAmD,CAAA;AAEvF,eAAO,MAAM,8BAA8B,uEAIzC,CAAA;AAEF,eAAO,MAAM,8BAA8B,kFAKzC,CAAA;AAEF,eAAO,MAAM,0BAA0B,qKASrC,CAAA;AAEF,eAAO,MAAM,8BAA8B,uEAIzC,CAAA;AAEF,eAAO,MAAM,kCAAkC
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAEhE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAcvD,eAAO,MAAM,uBAAuB,wDAAmD,CAAA;AAEvF,eAAO,MAAM,8BAA8B,uEAIzC,CAAA;AAEF,eAAO,MAAM,8BAA8B,kFAKzC,CAAA;AAEF,eAAO,MAAM,0BAA0B,qKASrC,CAAA;AAEF,eAAO,MAAM,8BAA8B,uEAIzC,CAAA;AAEF,eAAO,MAAM,kCAAkC,yJAM7C,CAAA;AAEF,eAAO,MAAM,iCAAiC,6FAM5C,CAAA;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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StatusEnum = pgEnum("notification_reminder_stat
|
|
|
29
29
|
"archived",
|
|
30
30
|
]);
|
|
31
31
|
export const notificationReminderTargetTypeEnum = pgEnum("notification_reminder_target_type", [
|
|
32
|
+
"booking_confirmed",
|
|
32
33
|
"booking_payment_schedule",
|
|
34
|
+
"payment_complete",
|
|
35
|
+
"booking_cancelled_non_payment",
|
|
33
36
|
"invoice",
|
|
34
37
|
]);
|
|
35
38
|
export const notificationReminderRunStatusEnum = pgEnum("notification_reminder_run_status", [
|
|
@@ -107,7 +107,7 @@ export declare const bookingDocumentNotificationsService: {
|
|
|
107
107
|
channel: "email" | "sms";
|
|
108
108
|
provider: string;
|
|
109
109
|
providerMessageId: string | null;
|
|
110
|
-
status: "pending" | "
|
|
110
|
+
status: "pending" | "failed" | "cancelled" | "sent";
|
|
111
111
|
toAddress: string;
|
|
112
112
|
fromAddress: string | null;
|
|
113
113
|
subject: string | null;
|
|
@@ -234,7 +234,7 @@ export declare const bookingDocumentNotificationsService: {
|
|
|
234
234
|
channel: "email" | "sms";
|
|
235
235
|
provider: string;
|
|
236
236
|
providerMessageId: string | null;
|
|
237
|
-
status: "pending" | "
|
|
237
|
+
status: "pending" | "failed" | "cancelled" | "sent";
|
|
238
238
|
toAddress: string;
|
|
239
239
|
fromAddress: string | null;
|
|
240
240
|
subject: 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: "pending" | "
|
|
18
|
+
status: "pending" | "failed" | "cancelled" | "sent";
|
|
19
19
|
toAddress: string;
|
|
20
20
|
fromAddress: string | null;
|
|
21
21
|
subject: string | null;
|
|
@@ -48,7 +48,36 @@ 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: "pending" | "
|
|
51
|
+
status: "pending" | "failed" | "cancelled" | "sent";
|
|
52
|
+
toAddress: string;
|
|
53
|
+
fromAddress: string | null;
|
|
54
|
+
subject: string | null;
|
|
55
|
+
htmlBody: string | null;
|
|
56
|
+
textBody: string | null;
|
|
57
|
+
payloadData: Record<string, unknown> | null;
|
|
58
|
+
metadata: Record<string, unknown> | null;
|
|
59
|
+
errorMessage: string | null;
|
|
60
|
+
scheduledFor: Date | null;
|
|
61
|
+
sentAt: Date | null;
|
|
62
|
+
failedAt: Date | null;
|
|
63
|
+
createdAt: Date;
|
|
64
|
+
updatedAt: Date;
|
|
65
|
+
} | null>;
|
|
66
|
+
export declare function resendDelivery(db: PostgresJsDatabase, dispatcher: NotificationService, id: string): Promise<{
|
|
67
|
+
id: string;
|
|
68
|
+
templateId: string | null;
|
|
69
|
+
templateSlug: string | null;
|
|
70
|
+
targetType: "organization" | "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "person" | "payment_session";
|
|
71
|
+
targetId: string | null;
|
|
72
|
+
personId: string | null;
|
|
73
|
+
organizationId: string | null;
|
|
74
|
+
bookingId: string | null;
|
|
75
|
+
invoiceId: string | null;
|
|
76
|
+
paymentSessionId: string | null;
|
|
77
|
+
channel: "email" | "sms";
|
|
78
|
+
provider: string;
|
|
79
|
+
providerMessageId: string | null;
|
|
80
|
+
status: "pending" | "failed" | "cancelled" | "sent";
|
|
52
81
|
toAddress: string;
|
|
53
82
|
fromAddress: string | null;
|
|
54
83
|
subject: string | null;
|
|
@@ -77,7 +106,7 @@ export declare function sendNotification(db: PostgresJsDatabase, dispatcher: Not
|
|
|
77
106
|
channel: "email" | "sms";
|
|
78
107
|
provider: string;
|
|
79
108
|
providerMessageId: string | null;
|
|
80
|
-
status: "pending" | "
|
|
109
|
+
status: "pending" | "failed" | "cancelled" | "sent";
|
|
81
110
|
toAddress: string;
|
|
82
111
|
fromAddress: string | null;
|
|
83
112
|
subject: string | null;
|
|
@@ -106,7 +135,7 @@ export declare function sendPaymentSessionNotification(db: PostgresJsDatabase, d
|
|
|
106
135
|
channel: "email" | "sms";
|
|
107
136
|
provider: string;
|
|
108
137
|
providerMessageId: string | null;
|
|
109
|
-
status: "pending" | "
|
|
138
|
+
status: "pending" | "failed" | "cancelled" | "sent";
|
|
110
139
|
toAddress: string;
|
|
111
140
|
fromAddress: string | null;
|
|
112
141
|
subject: string | null;
|
|
@@ -135,7 +164,7 @@ export declare function sendInvoiceNotification(db: PostgresJsDatabase, dispatch
|
|
|
135
164
|
channel: "email" | "sms";
|
|
136
165
|
provider: string;
|
|
137
166
|
providerMessageId: string | null;
|
|
138
|
-
status: "pending" | "
|
|
167
|
+
status: "pending" | "failed" | "cancelled" | "sent";
|
|
139
168
|
toAddress: string;
|
|
140
169
|
fromAddress: string | null;
|
|
141
170
|
subject: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-deliveries.d.ts","sourceRoot":"","sources":["../src/service-deliveries.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAGjE,OAAO,KAAK,EACV,6BAA6B,EAC7B,mBAAmB,EACnB,4BAA4B,EAC5B,qBAAqB,EACrB,mCAAmC,EACpC,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"service-deliveries.d.ts","sourceRoot":"","sources":["../src/service-deliveries.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAGjE,OAAO,KAAK,EACV,6BAA6B,EAC7B,mBAAmB,EACnB,4BAA4B,EAC5B,qBAAqB,EACrB,mCAAmC,EACpC,MAAM,qBAAqB,CAAA;AA8H5B,wBAAsB,cAAc,CAAC,EAAE,EAAE,kBAAkB,EAAE,KAAK,EAAE,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgChG;AAED,wBAAsB,eAAe,CAAC,EAAE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