@voyantjs/notifications 0.28.1 → 0.29.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 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/routes.d.ts +428 -8
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +63 -1
- package/dist/schema.d.ts +729 -16
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +114 -1
- package/dist/service-reminders.d.ts +4 -2
- package/dist/service-reminders.d.ts.map +1 -1
- package/dist/service-reminders.js +392 -545
- package/dist/service-sequence.d.ts +113 -0
- package/dist/service-sequence.d.ts.map +1 -0
- package/dist/service-sequence.js +432 -0
- package/dist/service-stages.d.ts +23 -0
- package/dist/service-stages.d.ts.map +1 -0
- package/dist/service-stages.js +203 -0
- package/dist/service-templates.d.ts +10 -8
- package/dist/service-templates.d.ts.map +1 -1
- package/dist/service-templates.js +0 -3
- package/dist/service.d.ts +15 -0
- package/dist/service.d.ts.map +1 -1
- package/dist/service.js +15 -0
- package/dist/tasks/deliver-reminder.d.ts +1 -1
- package/dist/validation.d.ts +143 -13
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +110 -7
- package/package.json +7 -7
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,8BAA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C,CAAA;AAED,eAAO,MAAM,+BAA+B,EAAE,kBAK7C,CAAA;AAED,eAAO,MAAM,qCAAqC,EAAE,kBAKnD,CAAA;AAED,eAAO,MAAM,wCAAwC,EAAE,kBAKtD,CAAA;AAED,eAAO,MAAM,4BAA4B,EAAE,kBAK1C,CAAA;AAED,eAAO,MAAM,qBAAqB;;;;;;;;CAQjC,CAAA;AAED,eAAO,MAAM,mBAAmB,EAAE,MAGjC,CAAA;AAGD,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAAA"}
|
package/dist/schema.js
CHANGED
|
@@ -42,6 +42,19 @@ export const notificationReminderRunStatusEnum = pgEnum("notification_reminder_r
|
|
|
42
42
|
"skipped",
|
|
43
43
|
"failed",
|
|
44
44
|
]);
|
|
45
|
+
export const notificationReminderStageAnchorEnum = pgEnum("notification_reminder_stage_anchor", [
|
|
46
|
+
"due_date",
|
|
47
|
+
"booking_created_at",
|
|
48
|
+
"departure_date",
|
|
49
|
+
"invoice_issued_at",
|
|
50
|
+
"last_send_at",
|
|
51
|
+
]);
|
|
52
|
+
export const notificationReminderStageCadenceKindEnum = pgEnum("notification_reminder_stage_cadence_kind", ["once", "every_n_days", "escalating"]);
|
|
53
|
+
export const notificationStageRecipientKindEnum = pgEnum("notification_stage_recipient_kind", [
|
|
54
|
+
"primary",
|
|
55
|
+
"cc",
|
|
56
|
+
"bcc",
|
|
57
|
+
]);
|
|
45
58
|
export const notificationTemplates = pgTable("notification_templates", {
|
|
46
59
|
id: typeId("notification_templates"),
|
|
47
60
|
slug: text("slug").notNull().unique(),
|
|
@@ -120,7 +133,8 @@ export const notificationReminderRules = pgTable("notification_reminder_rules",
|
|
|
120
133
|
onDelete: "set null",
|
|
121
134
|
}),
|
|
122
135
|
templateSlug: text("template_slug"),
|
|
123
|
-
|
|
136
|
+
priority: integer("priority").notNull().default(0),
|
|
137
|
+
suppressionGroup: text("suppression_group"),
|
|
124
138
|
isSystem: boolean("is_system").notNull().default(false),
|
|
125
139
|
metadata: jsonb("metadata").$type(),
|
|
126
140
|
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
@@ -130,6 +144,8 @@ export const notificationReminderRules = pgTable("notification_reminder_rules",
|
|
|
130
144
|
index("idx_notification_reminder_rules_status_updated").on(table.status, table.updatedAt),
|
|
131
145
|
index("idx_notification_reminder_rules_target_updated").on(table.targetType, table.updatedAt),
|
|
132
146
|
index("idx_notification_reminder_rules_channel_updated").on(table.channel, table.updatedAt),
|
|
147
|
+
index("idx_notification_reminder_rules_priority").on(table.priority),
|
|
148
|
+
index("idx_notification_reminder_rules_suppression_group").on(table.suppressionGroup),
|
|
133
149
|
uniqueIndex("uidx_notification_reminder_rules_slug").on(table.slug),
|
|
134
150
|
]);
|
|
135
151
|
export const notificationReminderRuns = pgTable("notification_reminder_runs", {
|
|
@@ -166,6 +182,64 @@ export const notificationReminderRuns = pgTable("notification_reminder_runs", {
|
|
|
166
182
|
index("idx_notification_reminder_runs_status_created").on(table.status, table.createdAt),
|
|
167
183
|
uniqueIndex("uidx_notification_reminder_runs_dedupe").on(table.dedupeKey),
|
|
168
184
|
]);
|
|
185
|
+
export const notificationReminderRuleStages = pgTable("notification_reminder_rule_stages", {
|
|
186
|
+
id: typeId("notification_reminder_rule_stages"),
|
|
187
|
+
reminderRuleId: typeIdRef("reminder_rule_id")
|
|
188
|
+
.notNull()
|
|
189
|
+
.references(() => notificationReminderRules.id, { onDelete: "cascade" }),
|
|
190
|
+
orderIndex: integer("order_index").notNull(),
|
|
191
|
+
name: text("name"),
|
|
192
|
+
anchor: notificationReminderStageAnchorEnum("anchor").notNull(),
|
|
193
|
+
windowStartDays: integer("window_start_days").notNull(),
|
|
194
|
+
windowEndDays: integer("window_end_days").notNull(),
|
|
195
|
+
cadenceKind: notificationReminderStageCadenceKindEnum("cadence_kind").notNull(),
|
|
196
|
+
cadenceEveryDays: integer("cadence_every_days"),
|
|
197
|
+
cadenceIntervals: jsonb("cadence_intervals").$type(),
|
|
198
|
+
maxSendsInStage: integer("max_sends_in_stage"),
|
|
199
|
+
respectQuietHours: boolean("respect_quiet_hours").notNull().default(true),
|
|
200
|
+
metadata: jsonb("metadata").$type(),
|
|
201
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
202
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
203
|
+
}, (table) => [
|
|
204
|
+
uniqueIndex("uidx_notification_reminder_rule_stages_rule_order").on(table.reminderRuleId, table.orderIndex),
|
|
205
|
+
index("idx_notification_reminder_rule_stages_rule").on(table.reminderRuleId),
|
|
206
|
+
index("idx_notification_reminder_rule_stages_anchor").on(table.anchor),
|
|
207
|
+
]);
|
|
208
|
+
export const notificationReminderStageChannels = pgTable("notification_reminder_stage_channels", {
|
|
209
|
+
id: typeId("notification_reminder_stage_channels"),
|
|
210
|
+
stageId: typeIdRef("stage_id")
|
|
211
|
+
.notNull()
|
|
212
|
+
.references(() => notificationReminderRuleStages.id, { onDelete: "cascade" }),
|
|
213
|
+
orderIndex: integer("order_index").notNull().default(0),
|
|
214
|
+
channel: notificationChannelEnum("channel").notNull(),
|
|
215
|
+
provider: text("provider"),
|
|
216
|
+
templateId: typeIdRef("template_id").references(() => notificationTemplates.id, {
|
|
217
|
+
onDelete: "set null",
|
|
218
|
+
}),
|
|
219
|
+
templateSlug: text("template_slug"),
|
|
220
|
+
recipientKind: notificationStageRecipientKindEnum("recipient_kind")
|
|
221
|
+
.notNull()
|
|
222
|
+
.default("primary"),
|
|
223
|
+
recipientRole: text("recipient_role"),
|
|
224
|
+
metadata: jsonb("metadata").$type(),
|
|
225
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
226
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
227
|
+
}, (table) => [
|
|
228
|
+
index("idx_notification_reminder_stage_channels_stage").on(table.stageId),
|
|
229
|
+
index("idx_notification_reminder_stage_channels_template").on(table.templateId),
|
|
230
|
+
]);
|
|
231
|
+
export const notificationSettings = pgTable("notification_settings", {
|
|
232
|
+
id: typeId("notification_settings"),
|
|
233
|
+
scope: text("scope").notNull().default("default"),
|
|
234
|
+
quietHoursLocal: jsonb("quiet_hours_local").$type(),
|
|
235
|
+
blackoutDates: jsonb("blackout_dates").$type(),
|
|
236
|
+
skipWeekends: boolean("skip_weekends").notNull().default(false),
|
|
237
|
+
recipientRateLimitPerDay: integer("recipient_rate_limit_per_day"),
|
|
238
|
+
suppressionWindowHours: integer("suppression_window_hours").notNull().default(24),
|
|
239
|
+
metadata: jsonb("metadata").$type(),
|
|
240
|
+
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
|
|
241
|
+
updatedAt: timestamp("updated_at", { withTimezone: true }).notNull().defaultNow(),
|
|
242
|
+
}, (table) => [uniqueIndex("uidx_notification_settings_scope").on(table.scope)]);
|
|
169
243
|
export const notificationTemplatesRelations = relations(notificationTemplates, ({ many }) => ({
|
|
170
244
|
deliveries: many(notificationDeliveries),
|
|
171
245
|
reminderRules: many(notificationReminderRules),
|
|
@@ -182,6 +256,7 @@ export const notificationReminderRulesRelations = relations(notificationReminder
|
|
|
182
256
|
references: [notificationTemplates.id],
|
|
183
257
|
}),
|
|
184
258
|
runs: many(notificationReminderRuns),
|
|
259
|
+
stages: many(notificationReminderRuleStages),
|
|
185
260
|
}));
|
|
186
261
|
export const notificationReminderRunsRelations = relations(notificationReminderRuns, ({ one }) => ({
|
|
187
262
|
reminderRule: one(notificationReminderRules, {
|
|
@@ -193,6 +268,23 @@ export const notificationReminderRunsRelations = relations(notificationReminderR
|
|
|
193
268
|
references: [notificationDeliveries.id],
|
|
194
269
|
}),
|
|
195
270
|
}));
|
|
271
|
+
export const notificationReminderRuleStagesRelations = relations(notificationReminderRuleStages, ({ many, one }) => ({
|
|
272
|
+
rule: one(notificationReminderRules, {
|
|
273
|
+
fields: [notificationReminderRuleStages.reminderRuleId],
|
|
274
|
+
references: [notificationReminderRules.id],
|
|
275
|
+
}),
|
|
276
|
+
channels: many(notificationReminderStageChannels),
|
|
277
|
+
}));
|
|
278
|
+
export const notificationReminderStageChannelsRelations = relations(notificationReminderStageChannels, ({ one }) => ({
|
|
279
|
+
stage: one(notificationReminderRuleStages, {
|
|
280
|
+
fields: [notificationReminderStageChannels.stageId],
|
|
281
|
+
references: [notificationReminderRuleStages.id],
|
|
282
|
+
}),
|
|
283
|
+
template: one(notificationTemplates, {
|
|
284
|
+
fields: [notificationReminderStageChannels.templateId],
|
|
285
|
+
references: [notificationTemplates.id],
|
|
286
|
+
}),
|
|
287
|
+
}));
|
|
196
288
|
export const notificationTemplateLinkable = {
|
|
197
289
|
module: "notifications",
|
|
198
290
|
entity: "notificationTemplate",
|
|
@@ -217,11 +309,32 @@ export const notificationReminderRunLinkable = {
|
|
|
217
309
|
table: "notification_reminder_runs",
|
|
218
310
|
idPrefix: "ntrn",
|
|
219
311
|
};
|
|
312
|
+
export const notificationReminderRuleStageLinkable = {
|
|
313
|
+
module: "notifications",
|
|
314
|
+
entity: "notificationReminderRuleStage",
|
|
315
|
+
table: "notification_reminder_rule_stages",
|
|
316
|
+
idPrefix: "ntrs",
|
|
317
|
+
};
|
|
318
|
+
export const notificationReminderStageChannelLinkable = {
|
|
319
|
+
module: "notifications",
|
|
320
|
+
entity: "notificationReminderStageChannel",
|
|
321
|
+
table: "notification_reminder_stage_channels",
|
|
322
|
+
idPrefix: "ntsc",
|
|
323
|
+
};
|
|
324
|
+
export const notificationSettingsLinkable = {
|
|
325
|
+
module: "notifications",
|
|
326
|
+
entity: "notificationSettings",
|
|
327
|
+
table: "notification_settings",
|
|
328
|
+
idPrefix: "nset",
|
|
329
|
+
};
|
|
220
330
|
export const notificationsLinkable = {
|
|
221
331
|
notificationTemplate: notificationTemplateLinkable,
|
|
222
332
|
notificationDelivery: notificationDeliveryLinkable,
|
|
223
333
|
notificationReminderRule: notificationReminderRuleLinkable,
|
|
224
334
|
notificationReminderRun: notificationReminderRunLinkable,
|
|
335
|
+
notificationReminderRuleStage: notificationReminderRuleStageLinkable,
|
|
336
|
+
notificationReminderStageChannel: notificationReminderStageChannelLinkable,
|
|
337
|
+
notificationSettings: notificationSettingsLinkable,
|
|
225
338
|
};
|
|
226
339
|
export const notificationsModule = {
|
|
227
340
|
name: "notifications",
|
|
@@ -20,7 +20,7 @@ export declare function dispatchReminderEventRules(db: PostgresJsDatabase, dispa
|
|
|
20
20
|
createdAt: Date;
|
|
21
21
|
updatedAt: Date;
|
|
22
22
|
organizationId: string | null;
|
|
23
|
-
status: "failed" | "
|
|
23
|
+
status: "failed" | "queued" | "skipped" | "sent" | "processing";
|
|
24
24
|
scheduledFor: Date;
|
|
25
25
|
errorMessage: string | null;
|
|
26
26
|
bookingId: string | null;
|
|
@@ -49,7 +49,7 @@ export declare function deliverReminderRun(db: PostgresJsDatabase, dispatcher: N
|
|
|
49
49
|
organizationId: string | null;
|
|
50
50
|
paymentSessionId: string | null;
|
|
51
51
|
notificationDeliveryId: string | null;
|
|
52
|
-
status: "failed" | "
|
|
52
|
+
status: "failed" | "queued" | "skipped" | "sent" | "processing";
|
|
53
53
|
recipient: string | null;
|
|
54
54
|
scheduledFor: Date;
|
|
55
55
|
processedAt: Date;
|
|
@@ -59,5 +59,7 @@ export declare function deliverReminderRun(db: PostgresJsDatabase, dispatcher: N
|
|
|
59
59
|
updatedAt: Date;
|
|
60
60
|
} | null>;
|
|
61
61
|
export declare function runDueReminders(db: PostgresJsDatabase, dispatcher: NotificationService, input?: RunDueRemindersInput): Promise<ReminderSweepResult>;
|
|
62
|
+
export declare function runStageBasedDueReminders(db: PostgresJsDatabase, dispatcher: NotificationService, input?: RunDueRemindersInput): Promise<ReminderSweepResult>;
|
|
63
|
+
export declare function queueStageBasedDueReminders(db: PostgresJsDatabase, enqueueDelivery: ReminderDeliveryEnqueuer, input?: RunDueRemindersInput): Promise<ReminderQueueResult>;
|
|
62
64
|
export {};
|
|
63
65
|
//# sourceMappingURL=service-reminders.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-reminders.d.ts","sourceRoot":"","sources":["../src/service-reminders.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"service-reminders.d.ts","sourceRoot":"","sources":["../src/service-reminders.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAUjE,OAAO,EACL,KAAK,iCAAiC,EAGvC,MAAM,gCAAgC,CAAA;AAevC,OAAO,KAAK,EAGV,2BAA2B,EAC3B,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,qBAAqB,CAAA;AAW5B,KAAK,wBAAwB,GAAG,CAAC,KAAK,EAAE;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAGnF,KAAK,kBAAkB,GAAG,2BAA2B,CAAC,YAAY,CAAC,CAAA;AACnE,KAAK,8BAA8B,GAAG,OAAO,CAC3C,kBAAkB,EAClB,mBAAmB,GAAG,kBAAkB,GAAG,+BAA+B,CAC3E,CAAA;AAED,MAAM,WAAW,kCAAkC;IACjD,0BAA0B,CAAC,EAAE,iCAAiC,CAAA;CAC/D;AA6pBD,wBAAsB,0BAA0B,CAC9C,EAAE,EAAE,kBAAkB,EACtB,UAAU,EAAE,mBAAmB,EAC/B,KAAK,EAAE;IACL,UAAU,EAAE,8BAA8B,CAAA;IAC1C,SAAS,EAAE,MAAM,CAAA;IACjB,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACpC,EACD,OAAO,GAAE,kCAAuC;;;;;;;;;;;;;;;;;;;aAmBjD;AAED,wBAAsB,kCAAkC,CACtD,EAAE,EAAE,kBAAkB,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