@voyantjs/notifications 0.2.0 → 0.3.1
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 +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/provider-resolution.d.ts +5 -0
- package/dist/provider-resolution.d.ts.map +1 -1
- package/dist/provider-resolution.js +22 -0
- package/dist/providers/twilio.d.ts +24 -0
- package/dist/providers/twilio.d.ts.map +1 -0
- package/dist/providers/twilio.js +48 -0
- package/dist/service-deliveries.d.ts +153 -0
- package/dist/service-deliveries.d.ts.map +1 -0
- package/dist/service-deliveries.js +334 -0
- package/dist/service-reminders.d.ts +4 -0
- package/dist/service-reminders.d.ts.map +1 -0
- package/dist/service-reminders.js +215 -0
- package/dist/service-shared.d.ts +73 -0
- package/dist/service-shared.d.ts.map +1 -0
- package/dist/service-shared.js +124 -0
- package/dist/service-templates.d.ts +182 -0
- package/dist/service-templates.d.ts.map +1 -0
- package/dist/service-templates.js +115 -0
- package/dist/service.d.ts +21 -367
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +20 -773
- package/dist/tasks/send-due-reminders.d.ts +1 -6
- package/dist/tasks/send-due-reminders.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { desc, eq, ilike, or, sql } from "drizzle-orm";
|
|
2
|
+
import { notificationReminderRules, notificationReminderRuns, notificationTemplates, } from "./schema.js";
|
|
3
|
+
import { buildWhereClause, paginate } from "./service-shared.js";
|
|
4
|
+
export async function listTemplates(db, query) {
|
|
5
|
+
const conditions = [];
|
|
6
|
+
if (query.channel)
|
|
7
|
+
conditions.push(eq(notificationTemplates.channel, query.channel));
|
|
8
|
+
if (query.provider)
|
|
9
|
+
conditions.push(eq(notificationTemplates.provider, query.provider));
|
|
10
|
+
if (query.status)
|
|
11
|
+
conditions.push(eq(notificationTemplates.status, query.status));
|
|
12
|
+
if (query.search) {
|
|
13
|
+
const term = `%${query.search}%`;
|
|
14
|
+
conditions.push(or(ilike(notificationTemplates.slug, term), ilike(notificationTemplates.name, term)));
|
|
15
|
+
}
|
|
16
|
+
const where = buildWhereClause(conditions);
|
|
17
|
+
return paginate(db
|
|
18
|
+
.select()
|
|
19
|
+
.from(notificationTemplates)
|
|
20
|
+
.where(where)
|
|
21
|
+
.limit(query.limit)
|
|
22
|
+
.offset(query.offset)
|
|
23
|
+
.orderBy(desc(notificationTemplates.updatedAt)), db.select({ total: sql `count(*)::int` }).from(notificationTemplates).where(where), query.limit, query.offset);
|
|
24
|
+
}
|
|
25
|
+
export async function getTemplateById(db, id) {
|
|
26
|
+
const [row] = await db
|
|
27
|
+
.select()
|
|
28
|
+
.from(notificationTemplates)
|
|
29
|
+
.where(eq(notificationTemplates.id, id))
|
|
30
|
+
.limit(1);
|
|
31
|
+
return row ?? null;
|
|
32
|
+
}
|
|
33
|
+
export async function getTemplateBySlug(db, slug) {
|
|
34
|
+
const [row] = await db
|
|
35
|
+
.select()
|
|
36
|
+
.from(notificationTemplates)
|
|
37
|
+
.where(eq(notificationTemplates.slug, slug))
|
|
38
|
+
.limit(1);
|
|
39
|
+
return row ?? null;
|
|
40
|
+
}
|
|
41
|
+
export async function createTemplate(db, data) {
|
|
42
|
+
const [row] = await db.insert(notificationTemplates).values(data).returning();
|
|
43
|
+
return row ?? null;
|
|
44
|
+
}
|
|
45
|
+
export async function updateTemplate(db, id, data) {
|
|
46
|
+
const [row] = await db
|
|
47
|
+
.update(notificationTemplates)
|
|
48
|
+
.set({ ...data, updatedAt: new Date() })
|
|
49
|
+
.where(eq(notificationTemplates.id, id))
|
|
50
|
+
.returning();
|
|
51
|
+
return row ?? null;
|
|
52
|
+
}
|
|
53
|
+
export async function listReminderRules(db, query) {
|
|
54
|
+
const conditions = [];
|
|
55
|
+
if (query.status)
|
|
56
|
+
conditions.push(eq(notificationReminderRules.status, query.status));
|
|
57
|
+
if (query.targetType)
|
|
58
|
+
conditions.push(eq(notificationReminderRules.targetType, query.targetType));
|
|
59
|
+
if (query.channel)
|
|
60
|
+
conditions.push(eq(notificationReminderRules.channel, query.channel));
|
|
61
|
+
if (query.search) {
|
|
62
|
+
const term = `%${query.search}%`;
|
|
63
|
+
conditions.push(or(ilike(notificationReminderRules.slug, term), ilike(notificationReminderRules.name, term)));
|
|
64
|
+
}
|
|
65
|
+
const where = buildWhereClause(conditions);
|
|
66
|
+
return paginate(db
|
|
67
|
+
.select()
|
|
68
|
+
.from(notificationReminderRules)
|
|
69
|
+
.where(where)
|
|
70
|
+
.limit(query.limit)
|
|
71
|
+
.offset(query.offset)
|
|
72
|
+
.orderBy(desc(notificationReminderRules.updatedAt)), db.select({ total: sql `count(*)::int` }).from(notificationReminderRules).where(where), query.limit, query.offset);
|
|
73
|
+
}
|
|
74
|
+
export async function getReminderRuleById(db, id) {
|
|
75
|
+
const [row] = await db
|
|
76
|
+
.select()
|
|
77
|
+
.from(notificationReminderRules)
|
|
78
|
+
.where(eq(notificationReminderRules.id, id))
|
|
79
|
+
.limit(1);
|
|
80
|
+
return row ?? null;
|
|
81
|
+
}
|
|
82
|
+
export async function createReminderRule(db, data) {
|
|
83
|
+
const [row] = await db.insert(notificationReminderRules).values(data).returning();
|
|
84
|
+
return row ?? null;
|
|
85
|
+
}
|
|
86
|
+
export async function updateReminderRule(db, id, data) {
|
|
87
|
+
const [row] = await db
|
|
88
|
+
.update(notificationReminderRules)
|
|
89
|
+
.set({ ...data, updatedAt: new Date() })
|
|
90
|
+
.where(eq(notificationReminderRules.id, id))
|
|
91
|
+
.returning();
|
|
92
|
+
return row ?? null;
|
|
93
|
+
}
|
|
94
|
+
export async function listReminderRuns(db, query) {
|
|
95
|
+
const conditions = [];
|
|
96
|
+
if (query.reminderRuleId) {
|
|
97
|
+
conditions.push(eq(notificationReminderRuns.reminderRuleId, query.reminderRuleId));
|
|
98
|
+
}
|
|
99
|
+
if (query.targetType)
|
|
100
|
+
conditions.push(eq(notificationReminderRuns.targetType, query.targetType));
|
|
101
|
+
if (query.targetId)
|
|
102
|
+
conditions.push(eq(notificationReminderRuns.targetId, query.targetId));
|
|
103
|
+
if (query.bookingId)
|
|
104
|
+
conditions.push(eq(notificationReminderRuns.bookingId, query.bookingId));
|
|
105
|
+
if (query.status)
|
|
106
|
+
conditions.push(eq(notificationReminderRuns.status, query.status));
|
|
107
|
+
const where = buildWhereClause(conditions);
|
|
108
|
+
return paginate(db
|
|
109
|
+
.select()
|
|
110
|
+
.from(notificationReminderRuns)
|
|
111
|
+
.where(where)
|
|
112
|
+
.limit(query.limit)
|
|
113
|
+
.offset(query.offset)
|
|
114
|
+
.orderBy(desc(notificationReminderRuns.createdAt)), db.select({ total: sql `count(*)::int` }).from(notificationReminderRuns).where(where), query.limit, query.offset);
|
|
115
|
+
}
|
package/dist/service.d.ts
CHANGED
|
@@ -1,370 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
type NotificationDeliveryListQuery = z.infer<typeof notificationDeliveryListQuerySchema>;
|
|
7
|
-
type CreateNotificationTemplateInput = z.infer<typeof insertNotificationTemplateSchema>;
|
|
8
|
-
type UpdateNotificationTemplateInput = z.infer<typeof updateNotificationTemplateSchema>;
|
|
9
|
-
type SendNotificationInput = z.infer<typeof sendNotificationSchema>;
|
|
10
|
-
type NotificationReminderRuleListQuery = z.infer<typeof notificationReminderRuleListQuerySchema>;
|
|
11
|
-
type NotificationReminderRunListQuery = z.infer<typeof notificationReminderRunListQuerySchema>;
|
|
12
|
-
type CreateNotificationReminderRuleInput = z.infer<typeof insertNotificationReminderRuleSchema>;
|
|
13
|
-
type UpdateNotificationReminderRuleInput = z.infer<typeof updateNotificationReminderRuleSchema>;
|
|
14
|
-
type RunDueRemindersInput = z.infer<typeof runDueRemindersSchema>;
|
|
15
|
-
type SendPaymentSessionNotificationInput = z.infer<typeof sendPaymentSessionNotificationSchema>;
|
|
16
|
-
type SendInvoiceNotificationInput = z.infer<typeof sendInvoiceNotificationSchema>;
|
|
17
|
-
type ReminderSweepResult = {
|
|
18
|
-
processed: number;
|
|
19
|
-
sent: number;
|
|
20
|
-
skipped: number;
|
|
21
|
-
failed: number;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Thrown when `send()` is called with a channel that has no registered
|
|
25
|
-
* provider, or with a provider name that does not exist.
|
|
26
|
-
*/
|
|
27
|
-
export declare class NotificationError extends Error {
|
|
28
|
-
constructor(message: string);
|
|
29
|
-
}
|
|
30
|
-
export interface NotificationService {
|
|
31
|
-
send(payload: NotificationPayload): Promise<NotificationResult>;
|
|
32
|
-
sendWith(providerName: string, payload: NotificationPayload): Promise<NotificationResult>;
|
|
33
|
-
getProvider(channel: NotificationChannel): NotificationProvider | undefined;
|
|
34
|
-
}
|
|
35
|
-
export declare function createNotificationService(providers: ReadonlyArray<NotificationProvider>): NotificationService;
|
|
36
|
-
export declare function renderNotificationTemplate(template: string | null | undefined, data: Record<string, unknown>): string | null;
|
|
1
|
+
export type { NotificationService } from "./service-shared.js";
|
|
2
|
+
export { createNotificationService, NotificationError, renderNotificationTemplate, } from "./service-shared.js";
|
|
3
|
+
import { getDeliveryById, listDeliveries, sendInvoiceNotification, sendNotification, sendPaymentSessionNotification } from "./service-deliveries.js";
|
|
4
|
+
import { runDueReminders } from "./service-reminders.js";
|
|
5
|
+
import { createReminderRule, createTemplate, getReminderRuleById, getTemplateById, getTemplateBySlug, listReminderRules, listReminderRuns, listTemplates, updateReminderRule, updateTemplate } from "./service-templates.js";
|
|
37
6
|
export declare const notificationsService: {
|
|
38
|
-
listTemplates
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}[];
|
|
55
|
-
total: number;
|
|
56
|
-
limit: number;
|
|
57
|
-
offset: number;
|
|
58
|
-
}>;
|
|
59
|
-
getTemplateById(db: PostgresJsDatabase, id: string): Promise<{
|
|
60
|
-
id: string;
|
|
61
|
-
slug: string;
|
|
62
|
-
name: string;
|
|
63
|
-
channel: "email" | "sms";
|
|
64
|
-
provider: string | null;
|
|
65
|
-
status: "draft" | "active" | "archived";
|
|
66
|
-
subjectTemplate: string | null;
|
|
67
|
-
htmlTemplate: string | null;
|
|
68
|
-
textTemplate: string | null;
|
|
69
|
-
fromAddress: string | null;
|
|
70
|
-
isSystem: boolean;
|
|
71
|
-
metadata: Record<string, unknown> | null;
|
|
72
|
-
createdAt: Date;
|
|
73
|
-
updatedAt: Date;
|
|
74
|
-
} | null>;
|
|
75
|
-
getTemplateBySlug(db: PostgresJsDatabase, slug: string): Promise<{
|
|
76
|
-
id: string;
|
|
77
|
-
slug: string;
|
|
78
|
-
name: string;
|
|
79
|
-
channel: "email" | "sms";
|
|
80
|
-
provider: string | null;
|
|
81
|
-
status: "draft" | "active" | "archived";
|
|
82
|
-
subjectTemplate: string | null;
|
|
83
|
-
htmlTemplate: string | null;
|
|
84
|
-
textTemplate: string | null;
|
|
85
|
-
fromAddress: string | null;
|
|
86
|
-
isSystem: boolean;
|
|
87
|
-
metadata: Record<string, unknown> | null;
|
|
88
|
-
createdAt: Date;
|
|
89
|
-
updatedAt: Date;
|
|
90
|
-
} | null>;
|
|
91
|
-
createTemplate(db: PostgresJsDatabase, data: CreateNotificationTemplateInput): Promise<{
|
|
92
|
-
id: string;
|
|
93
|
-
name: string;
|
|
94
|
-
status: "draft" | "active" | "archived";
|
|
95
|
-
createdAt: Date;
|
|
96
|
-
updatedAt: Date;
|
|
97
|
-
metadata: Record<string, unknown> | null;
|
|
98
|
-
channel: "email" | "sms";
|
|
99
|
-
provider: string | null;
|
|
100
|
-
slug: string;
|
|
101
|
-
subjectTemplate: string | null;
|
|
102
|
-
htmlTemplate: string | null;
|
|
103
|
-
textTemplate: string | null;
|
|
104
|
-
fromAddress: string | null;
|
|
105
|
-
isSystem: boolean;
|
|
106
|
-
} | null>;
|
|
107
|
-
updateTemplate(db: PostgresJsDatabase, id: string, data: UpdateNotificationTemplateInput): Promise<{
|
|
108
|
-
id: string;
|
|
109
|
-
slug: string;
|
|
110
|
-
name: string;
|
|
111
|
-
channel: "email" | "sms";
|
|
112
|
-
provider: string | null;
|
|
113
|
-
status: "draft" | "active" | "archived";
|
|
114
|
-
subjectTemplate: string | null;
|
|
115
|
-
htmlTemplate: string | null;
|
|
116
|
-
textTemplate: string | null;
|
|
117
|
-
fromAddress: string | null;
|
|
118
|
-
isSystem: boolean;
|
|
119
|
-
metadata: Record<string, unknown> | null;
|
|
120
|
-
createdAt: Date;
|
|
121
|
-
updatedAt: Date;
|
|
122
|
-
} | null>;
|
|
123
|
-
listDeliveries(db: PostgresJsDatabase, query: NotificationDeliveryListQuery): Promise<{
|
|
124
|
-
data: {
|
|
125
|
-
id: string;
|
|
126
|
-
templateId: string | null;
|
|
127
|
-
templateSlug: string | null;
|
|
128
|
-
targetType: "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "payment_session" | "person" | "organization";
|
|
129
|
-
targetId: string | null;
|
|
130
|
-
personId: string | null;
|
|
131
|
-
organizationId: string | null;
|
|
132
|
-
bookingId: string | null;
|
|
133
|
-
invoiceId: string | null;
|
|
134
|
-
paymentSessionId: string | null;
|
|
135
|
-
channel: "email" | "sms";
|
|
136
|
-
provider: string;
|
|
137
|
-
providerMessageId: string | null;
|
|
138
|
-
status: "cancelled" | "pending" | "failed" | "sent";
|
|
139
|
-
toAddress: string;
|
|
140
|
-
fromAddress: string | null;
|
|
141
|
-
subject: string | null;
|
|
142
|
-
htmlBody: string | null;
|
|
143
|
-
textBody: string | null;
|
|
144
|
-
payloadData: Record<string, unknown> | null;
|
|
145
|
-
metadata: Record<string, unknown> | null;
|
|
146
|
-
errorMessage: string | null;
|
|
147
|
-
scheduledFor: Date | null;
|
|
148
|
-
sentAt: Date | null;
|
|
149
|
-
failedAt: Date | null;
|
|
150
|
-
createdAt: Date;
|
|
151
|
-
updatedAt: Date;
|
|
152
|
-
}[];
|
|
153
|
-
total: number;
|
|
154
|
-
limit: number;
|
|
155
|
-
offset: number;
|
|
156
|
-
}>;
|
|
157
|
-
getDeliveryById(db: PostgresJsDatabase, id: string): Promise<{
|
|
158
|
-
id: string;
|
|
159
|
-
templateId: string | null;
|
|
160
|
-
templateSlug: string | null;
|
|
161
|
-
targetType: "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "payment_session" | "person" | "organization";
|
|
162
|
-
targetId: string | null;
|
|
163
|
-
personId: string | null;
|
|
164
|
-
organizationId: string | null;
|
|
165
|
-
bookingId: string | null;
|
|
166
|
-
invoiceId: string | null;
|
|
167
|
-
paymentSessionId: string | null;
|
|
168
|
-
channel: "email" | "sms";
|
|
169
|
-
provider: string;
|
|
170
|
-
providerMessageId: string | null;
|
|
171
|
-
status: "cancelled" | "pending" | "failed" | "sent";
|
|
172
|
-
toAddress: string;
|
|
173
|
-
fromAddress: string | null;
|
|
174
|
-
subject: string | null;
|
|
175
|
-
htmlBody: string | null;
|
|
176
|
-
textBody: string | null;
|
|
177
|
-
payloadData: Record<string, unknown> | null;
|
|
178
|
-
metadata: Record<string, unknown> | null;
|
|
179
|
-
errorMessage: string | null;
|
|
180
|
-
scheduledFor: Date | null;
|
|
181
|
-
sentAt: Date | null;
|
|
182
|
-
failedAt: Date | null;
|
|
183
|
-
createdAt: Date;
|
|
184
|
-
updatedAt: Date;
|
|
185
|
-
} | null>;
|
|
186
|
-
sendNotification(db: PostgresJsDatabase, dispatcher: NotificationService, input: SendNotificationInput): Promise<{
|
|
187
|
-
id: string;
|
|
188
|
-
templateId: string | null;
|
|
189
|
-
templateSlug: string | null;
|
|
190
|
-
targetType: "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "payment_session" | "person" | "organization";
|
|
191
|
-
targetId: string | null;
|
|
192
|
-
personId: string | null;
|
|
193
|
-
organizationId: string | null;
|
|
194
|
-
bookingId: string | null;
|
|
195
|
-
invoiceId: string | null;
|
|
196
|
-
paymentSessionId: string | null;
|
|
197
|
-
channel: "email" | "sms";
|
|
198
|
-
provider: string;
|
|
199
|
-
providerMessageId: string | null;
|
|
200
|
-
status: "cancelled" | "pending" | "failed" | "sent";
|
|
201
|
-
toAddress: string;
|
|
202
|
-
fromAddress: string | null;
|
|
203
|
-
subject: string | null;
|
|
204
|
-
htmlBody: string | null;
|
|
205
|
-
textBody: string | null;
|
|
206
|
-
payloadData: Record<string, unknown> | null;
|
|
207
|
-
metadata: Record<string, unknown> | null;
|
|
208
|
-
errorMessage: string | null;
|
|
209
|
-
scheduledFor: Date | null;
|
|
210
|
-
sentAt: Date | null;
|
|
211
|
-
failedAt: Date | null;
|
|
212
|
-
createdAt: Date;
|
|
213
|
-
updatedAt: Date;
|
|
214
|
-
} | null>;
|
|
215
|
-
listReminderRules(db: PostgresJsDatabase, query: NotificationReminderRuleListQuery): Promise<{
|
|
216
|
-
data: {
|
|
217
|
-
id: string;
|
|
218
|
-
slug: string;
|
|
219
|
-
name: string;
|
|
220
|
-
status: "draft" | "active" | "archived";
|
|
221
|
-
targetType: "booking_payment_schedule";
|
|
222
|
-
channel: "email" | "sms";
|
|
223
|
-
provider: string | null;
|
|
224
|
-
templateId: string | null;
|
|
225
|
-
templateSlug: string | null;
|
|
226
|
-
relativeDaysFromDueDate: number;
|
|
227
|
-
isSystem: boolean;
|
|
228
|
-
metadata: Record<string, unknown> | null;
|
|
229
|
-
createdAt: Date;
|
|
230
|
-
updatedAt: Date;
|
|
231
|
-
}[];
|
|
232
|
-
total: number;
|
|
233
|
-
limit: number;
|
|
234
|
-
offset: number;
|
|
235
|
-
}>;
|
|
236
|
-
getReminderRuleById(db: PostgresJsDatabase, id: string): Promise<{
|
|
237
|
-
id: string;
|
|
238
|
-
slug: string;
|
|
239
|
-
name: string;
|
|
240
|
-
status: "draft" | "active" | "archived";
|
|
241
|
-
targetType: "booking_payment_schedule";
|
|
242
|
-
channel: "email" | "sms";
|
|
243
|
-
provider: string | null;
|
|
244
|
-
templateId: string | null;
|
|
245
|
-
templateSlug: string | null;
|
|
246
|
-
relativeDaysFromDueDate: number;
|
|
247
|
-
isSystem: boolean;
|
|
248
|
-
metadata: Record<string, unknown> | null;
|
|
249
|
-
createdAt: Date;
|
|
250
|
-
updatedAt: Date;
|
|
251
|
-
} | null>;
|
|
252
|
-
createReminderRule(db: PostgresJsDatabase, data: CreateNotificationReminderRuleInput): Promise<{
|
|
253
|
-
id: string;
|
|
254
|
-
name: string;
|
|
255
|
-
status: "draft" | "active" | "archived";
|
|
256
|
-
createdAt: Date;
|
|
257
|
-
updatedAt: Date;
|
|
258
|
-
metadata: Record<string, unknown> | null;
|
|
259
|
-
channel: "email" | "sms";
|
|
260
|
-
provider: string | null;
|
|
261
|
-
targetType: "booking_payment_schedule";
|
|
262
|
-
templateId: string | null;
|
|
263
|
-
slug: string;
|
|
264
|
-
isSystem: boolean;
|
|
265
|
-
templateSlug: string | null;
|
|
266
|
-
relativeDaysFromDueDate: number;
|
|
267
|
-
} | null>;
|
|
268
|
-
updateReminderRule(db: PostgresJsDatabase, id: string, data: UpdateNotificationReminderRuleInput): Promise<{
|
|
269
|
-
id: string;
|
|
270
|
-
slug: string;
|
|
271
|
-
name: string;
|
|
272
|
-
status: "draft" | "active" | "archived";
|
|
273
|
-
targetType: "booking_payment_schedule";
|
|
274
|
-
channel: "email" | "sms";
|
|
275
|
-
provider: string | null;
|
|
276
|
-
templateId: string | null;
|
|
277
|
-
templateSlug: string | null;
|
|
278
|
-
relativeDaysFromDueDate: number;
|
|
279
|
-
isSystem: boolean;
|
|
280
|
-
metadata: Record<string, unknown> | null;
|
|
281
|
-
createdAt: Date;
|
|
282
|
-
updatedAt: Date;
|
|
283
|
-
} | null>;
|
|
284
|
-
listReminderRuns(db: PostgresJsDatabase, query: NotificationReminderRunListQuery): Promise<{
|
|
285
|
-
data: {
|
|
286
|
-
id: string;
|
|
287
|
-
reminderRuleId: string;
|
|
288
|
-
targetType: "booking_payment_schedule";
|
|
289
|
-
targetId: string;
|
|
290
|
-
dedupeKey: string;
|
|
291
|
-
bookingId: string | null;
|
|
292
|
-
personId: string | null;
|
|
293
|
-
organizationId: string | null;
|
|
294
|
-
paymentSessionId: string | null;
|
|
295
|
-
notificationDeliveryId: string | null;
|
|
296
|
-
status: "failed" | "sent" | "processing" | "skipped";
|
|
297
|
-
recipient: string | null;
|
|
298
|
-
scheduledFor: Date;
|
|
299
|
-
processedAt: Date;
|
|
300
|
-
errorMessage: string | null;
|
|
301
|
-
metadata: Record<string, unknown> | null;
|
|
302
|
-
createdAt: Date;
|
|
303
|
-
updatedAt: Date;
|
|
304
|
-
}[];
|
|
305
|
-
total: number;
|
|
306
|
-
limit: number;
|
|
307
|
-
offset: number;
|
|
308
|
-
}>;
|
|
309
|
-
runDueReminders(db: PostgresJsDatabase, dispatcher: NotificationService, input?: RunDueRemindersInput): Promise<ReminderSweepResult>;
|
|
310
|
-
sendPaymentSessionNotification(db: PostgresJsDatabase, dispatcher: NotificationService, sessionId: string, input: SendPaymentSessionNotificationInput): Promise<{
|
|
311
|
-
id: string;
|
|
312
|
-
templateId: string | null;
|
|
313
|
-
templateSlug: string | null;
|
|
314
|
-
targetType: "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "payment_session" | "person" | "organization";
|
|
315
|
-
targetId: string | null;
|
|
316
|
-
personId: string | null;
|
|
317
|
-
organizationId: string | null;
|
|
318
|
-
bookingId: string | null;
|
|
319
|
-
invoiceId: string | null;
|
|
320
|
-
paymentSessionId: string | null;
|
|
321
|
-
channel: "email" | "sms";
|
|
322
|
-
provider: string;
|
|
323
|
-
providerMessageId: string | null;
|
|
324
|
-
status: "cancelled" | "pending" | "failed" | "sent";
|
|
325
|
-
toAddress: string;
|
|
326
|
-
fromAddress: string | null;
|
|
327
|
-
subject: string | null;
|
|
328
|
-
htmlBody: string | null;
|
|
329
|
-
textBody: string | null;
|
|
330
|
-
payloadData: Record<string, unknown> | null;
|
|
331
|
-
metadata: Record<string, unknown> | null;
|
|
332
|
-
errorMessage: string | null;
|
|
333
|
-
scheduledFor: Date | null;
|
|
334
|
-
sentAt: Date | null;
|
|
335
|
-
failedAt: Date | null;
|
|
336
|
-
createdAt: Date;
|
|
337
|
-
updatedAt: Date;
|
|
338
|
-
} | null>;
|
|
339
|
-
sendInvoiceNotification(db: PostgresJsDatabase, dispatcher: NotificationService, invoiceId: string, input: SendInvoiceNotificationInput): Promise<{
|
|
340
|
-
id: string;
|
|
341
|
-
templateId: string | null;
|
|
342
|
-
templateSlug: string | null;
|
|
343
|
-
targetType: "other" | "booking" | "invoice" | "booking_payment_schedule" | "booking_guarantee" | "payment_session" | "person" | "organization";
|
|
344
|
-
targetId: string | null;
|
|
345
|
-
personId: string | null;
|
|
346
|
-
organizationId: string | null;
|
|
347
|
-
bookingId: string | null;
|
|
348
|
-
invoiceId: string | null;
|
|
349
|
-
paymentSessionId: string | null;
|
|
350
|
-
channel: "email" | "sms";
|
|
351
|
-
provider: string;
|
|
352
|
-
providerMessageId: string | null;
|
|
353
|
-
status: "cancelled" | "pending" | "failed" | "sent";
|
|
354
|
-
toAddress: string;
|
|
355
|
-
fromAddress: string | null;
|
|
356
|
-
subject: string | null;
|
|
357
|
-
htmlBody: string | null;
|
|
358
|
-
textBody: string | null;
|
|
359
|
-
payloadData: Record<string, unknown> | null;
|
|
360
|
-
metadata: Record<string, unknown> | null;
|
|
361
|
-
errorMessage: string | null;
|
|
362
|
-
scheduledFor: Date | null;
|
|
363
|
-
sentAt: Date | null;
|
|
364
|
-
failedAt: Date | null;
|
|
365
|
-
createdAt: Date;
|
|
366
|
-
updatedAt: Date;
|
|
367
|
-
} | null>;
|
|
7
|
+
listTemplates: typeof listTemplates;
|
|
8
|
+
getTemplateById: typeof getTemplateById;
|
|
9
|
+
getTemplateBySlug: typeof getTemplateBySlug;
|
|
10
|
+
createTemplate: typeof createTemplate;
|
|
11
|
+
updateTemplate: typeof updateTemplate;
|
|
12
|
+
listDeliveries: typeof listDeliveries;
|
|
13
|
+
getDeliveryById: typeof getDeliveryById;
|
|
14
|
+
sendNotification: typeof sendNotification;
|
|
15
|
+
listReminderRules: typeof listReminderRules;
|
|
16
|
+
getReminderRuleById: typeof getReminderRuleById;
|
|
17
|
+
createReminderRule: typeof createReminderRule;
|
|
18
|
+
updateReminderRule: typeof updateReminderRule;
|
|
19
|
+
listReminderRuns: typeof listReminderRuns;
|
|
20
|
+
runDueReminders: typeof runDueReminders;
|
|
21
|
+
sendPaymentSessionNotification: typeof sendPaymentSessionNotification;
|
|
22
|
+
sendInvoiceNotification: typeof sendInvoiceNotification;
|
|
368
23
|
};
|
|
369
|
-
export {};
|
|
370
24
|
//# sourceMappingURL=service.d.ts.map
|
package/dist/service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EACL,yBAAyB,EACzB,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,qBAAqB,CAAA;AAE5B,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;;;;;;;;;;;;;;;;;CAiBhC,CAAA"}
|