@feathers-baas/plugin-notifications 0.1.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/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # @feathers-baas/plugin-notifications
2
+
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - a22281b: Initial release — BullMQ-backed notification system with SMTP, Resend, SendGrid, and Brevo email drivers. Supports both queue mode (Redis) and direct synchronous delivery.
package/dist/index.cjs ADDED
@@ -0,0 +1,381 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ BrevoDriver: () => BrevoDriver,
34
+ DriverRegistry: () => DriverRegistry,
35
+ NOTIFICATION_QUEUE_NAME: () => NOTIFICATION_QUEUE_NAME,
36
+ ResendDriver: () => ResendDriver,
37
+ SMTPDriver: () => SMTPDriver,
38
+ SendGridDriver: () => SendGridDriver,
39
+ createBullMQNotifier: () => createBullMQNotifier,
40
+ createDirectNotifier: () => createDirectNotifier,
41
+ createNotificationQueue: () => createNotificationQueue,
42
+ createNotificationWorker: () => createNotificationWorker,
43
+ enqueueNotification: () => enqueueNotification
44
+ });
45
+ module.exports = __toCommonJS(index_exports);
46
+
47
+ // src/registry.ts
48
+ var DriverRegistry = class {
49
+ drivers = /* @__PURE__ */ new Map();
50
+ eventMap = /* @__PURE__ */ new Map();
51
+ /** Register a driver under its name. Overwrites any existing driver with the same name. */
52
+ registerDriver(driver) {
53
+ this.drivers.set(driver.name, driver);
54
+ }
55
+ /** Map a notification event to a driver name. Multiple calls for the same event add drivers. */
56
+ mapEvent(event, driverName) {
57
+ const existing = this.eventMap.get(event) ?? [];
58
+ if (!existing.includes(driverName)) {
59
+ existing.push(driverName);
60
+ }
61
+ this.eventMap.set(event, existing);
62
+ }
63
+ /** Look up a driver by name. Returns undefined if not registered. */
64
+ getDriver(name) {
65
+ return this.drivers.get(name);
66
+ }
67
+ /** Get all driver names mapped to the given event. */
68
+ getDriversForEvent(event) {
69
+ return this.eventMap.get(event) ?? [];
70
+ }
71
+ /** All registered driver names. */
72
+ listDriverNames() {
73
+ return [...this.drivers.keys()];
74
+ }
75
+ };
76
+
77
+ // src/queue/producer.ts
78
+ var import_bullmq = require("bullmq");
79
+ var NOTIFICATION_QUEUE_NAME = "feathers-baas:notifications";
80
+ function createNotificationQueue(redis) {
81
+ return new import_bullmq.Queue(NOTIFICATION_QUEUE_NAME, {
82
+ connection: redis,
83
+ defaultJobOptions: {
84
+ attempts: 5,
85
+ backoff: {
86
+ type: "exponential",
87
+ delay: 1e3
88
+ // initial delay: 1s → 2s → 4s → 8s → 16s
89
+ },
90
+ removeOnComplete: { count: 100 },
91
+ removeOnFail: { count: 500 }
92
+ }
93
+ });
94
+ }
95
+ async function enqueueNotification(queue, job) {
96
+ await queue.add("send", job);
97
+ }
98
+
99
+ // src/notifier.ts
100
+ var AUTH_MANAGEMENT_EVENT_MAP = {
101
+ resendVerifySignup: "auth.resend-verify-signup",
102
+ verifySignup: "auth.verify-signup",
103
+ verifySignupSetPassword: "auth.verify-signup-set-password",
104
+ sendResetPwd: "auth.send-reset-pwd",
105
+ resetPwd: "auth.reset-pwd",
106
+ passwordChange: "auth.password-change",
107
+ identityChange: "auth.identity-change"
108
+ };
109
+ function buildAuthNotification(type, user, appUrl) {
110
+ const email = user["email"];
111
+ if (!email) return null;
112
+ switch (type) {
113
+ case "auth.verify-signup":
114
+ case "auth.resend-verify-signup": {
115
+ const token = user["verifyToken"];
116
+ const verifyUrl = `${appUrl}/verify?token=${token ?? ""}`;
117
+ return {
118
+ to: email,
119
+ channel: "email",
120
+ subject: "Verify your email address",
121
+ bodyTemplate: `
122
+ <h2>Welcome!</h2>
123
+ <p>Click the link below to verify your email address:</p>
124
+ <p><a href="<%= verifyUrl %>">Verify email</a></p>
125
+ <p>This link expires in 24 hours.</p>
126
+ `,
127
+ textTemplate: `Verify your email: <%= verifyUrl %>`,
128
+ data: { verifyUrl, user }
129
+ };
130
+ }
131
+ case "auth.send-reset-pwd": {
132
+ const token = user["resetToken"];
133
+ const resetUrl = `${appUrl}/reset-password?token=${token ?? ""}`;
134
+ return {
135
+ to: email,
136
+ channel: "email",
137
+ subject: "Reset your password",
138
+ bodyTemplate: `
139
+ <h2>Password reset requested</h2>
140
+ <p>Click the link below to reset your password:</p>
141
+ <p><a href="<%= resetUrl %>">Reset password</a></p>
142
+ <p>This link expires in 2 hours. If you did not request this, ignore this email.</p>
143
+ `,
144
+ textTemplate: `Reset your password: <%= resetUrl %>`,
145
+ data: { resetUrl, user }
146
+ };
147
+ }
148
+ case "auth.reset-pwd": {
149
+ return {
150
+ to: email,
151
+ channel: "email",
152
+ subject: "Your password has been reset",
153
+ bodyTemplate: `<p>Your password has been successfully reset. If you did not do this, please contact support immediately.</p>`,
154
+ textTemplate: `Your password has been reset. If you did not do this, please contact support.`,
155
+ data: { user }
156
+ };
157
+ }
158
+ case "auth.password-change": {
159
+ return {
160
+ to: email,
161
+ channel: "email",
162
+ subject: "Your password has been changed",
163
+ bodyTemplate: `<p>Your account password was just changed. If this was not you, please contact support immediately.</p>`,
164
+ textTemplate: `Your password was changed. Contact support if this wasn't you.`,
165
+ data: { user }
166
+ };
167
+ }
168
+ case "auth.identity-change": {
169
+ return {
170
+ to: email,
171
+ channel: "email",
172
+ subject: "Your email address is being changed",
173
+ bodyTemplate: `<p>A request was made to change your email address. Click the link to confirm.</p>`,
174
+ textTemplate: `Confirm your email change by clicking the link in the HTML email.`,
175
+ data: { user }
176
+ };
177
+ }
178
+ case "auth.verify-signup-set-password": {
179
+ const token = user["verifyToken"];
180
+ const verifyUrl = `${appUrl}/verify-set-password?token=${token ?? ""}`;
181
+ return {
182
+ to: email,
183
+ channel: "email",
184
+ subject: "Set your password",
185
+ bodyTemplate: `
186
+ <h2>Set your password</h2>
187
+ <p><a href="<%= verifyUrl %>">Set password</a></p>
188
+ `,
189
+ textTemplate: `Set your password: <%= verifyUrl %>`,
190
+ data: { verifyUrl, user }
191
+ };
192
+ }
193
+ }
194
+ }
195
+ function createDirectNotifier(opts) {
196
+ return async (type, user, _notifierOptions) => {
197
+ const eventKey = AUTH_MANAGEMENT_EVENT_MAP[type];
198
+ if (!eventKey) return;
199
+ const notification = buildAuthNotification(eventKey, user, opts.appUrl);
200
+ if (!notification) return;
201
+ const driverNames = opts.registry.getDriversForEvent(eventKey);
202
+ if (driverNames.length === 0) return;
203
+ await Promise.all(
204
+ driverNames.map(async (driverName) => {
205
+ const driver = opts.registry.getDriver(driverName);
206
+ if (!driver) return;
207
+ await driver.send(notification);
208
+ })
209
+ );
210
+ };
211
+ }
212
+ function createBullMQNotifier(opts) {
213
+ return async (type, user, _notifierOptions) => {
214
+ const eventKey = AUTH_MANAGEMENT_EVENT_MAP[type];
215
+ if (!eventKey) return;
216
+ const notification = buildAuthNotification(eventKey, user, opts.appUrl);
217
+ if (!notification) return;
218
+ const driverNames = opts.registry.getDriversForEvent(eventKey);
219
+ if (driverNames.length === 0) return;
220
+ await Promise.all(
221
+ driverNames.map(
222
+ (driverName) => enqueueNotification(opts.queue, { driverName, notification })
223
+ )
224
+ );
225
+ };
226
+ }
227
+
228
+ // src/queue/worker.ts
229
+ var import_bullmq2 = require("bullmq");
230
+ function createNotificationWorker(registry, redis, opts = {}) {
231
+ const concurrency = opts.concurrency ?? 5;
232
+ const worker = new import_bullmq2.Worker(
233
+ NOTIFICATION_QUEUE_NAME,
234
+ async (job) => {
235
+ const { driverName, notification } = job.data;
236
+ const driver = registry.getDriver(driverName);
237
+ if (!driver) {
238
+ throw new Error(`Notification driver "${driverName}" is not registered`);
239
+ }
240
+ await driver.send(notification);
241
+ },
242
+ {
243
+ connection: redis,
244
+ concurrency,
245
+ // Don't create a new redis connection per job — reuse the pool
246
+ autorun: true
247
+ }
248
+ );
249
+ worker.on("failed", (job, err) => {
250
+ const jobId = job?.id ?? "unknown";
251
+ const message = err instanceof Error ? err.message : String(err);
252
+ console.error(`[notifications] Job ${jobId} failed: ${message}`);
253
+ });
254
+ return worker;
255
+ }
256
+
257
+ // src/drivers/smtp.driver.ts
258
+ var import_nodemailer = __toESM(require("nodemailer"), 1);
259
+ var ejs = __toESM(require("ejs"), 1);
260
+ var ejsRender = ejs.render ?? ejs.render;
261
+ var SMTPDriver = class {
262
+ constructor(opts) {
263
+ this.opts = opts;
264
+ this.transporter = import_nodemailer.default.createTransport(opts.url);
265
+ }
266
+ opts;
267
+ name = "smtp";
268
+ transporter;
269
+ async send(notification) {
270
+ const html = ejsRender(notification.bodyTemplate, notification.data, { async: false });
271
+ const text = notification.textTemplate ? ejsRender(notification.textTemplate, notification.data, { async: false }) : void 0;
272
+ await this.transporter.sendMail({
273
+ from: `"${this.opts.fromName}" <${this.opts.fromAddress}>`,
274
+ to: notification.to,
275
+ subject: notification.subject ?? "(no subject)",
276
+ html,
277
+ text
278
+ });
279
+ }
280
+ /** Verify SMTP connectivity. Throws if the server is unreachable. */
281
+ async verify() {
282
+ await this.transporter.verify();
283
+ }
284
+ /** Close the underlying connection pool. */
285
+ close() {
286
+ this.transporter.close();
287
+ }
288
+ };
289
+
290
+ // src/drivers/resend.driver.ts
291
+ var import_resend = require("resend");
292
+ var ejs2 = __toESM(require("ejs"), 1);
293
+ var ejsRender2 = ejs2.render ?? ejs2.render;
294
+ var ResendDriver = class {
295
+ constructor(opts) {
296
+ this.opts = opts;
297
+ this.client = new import_resend.Resend(opts.apiKey);
298
+ }
299
+ opts;
300
+ name = "resend";
301
+ client;
302
+ async send(notification) {
303
+ const html = ejsRender2(notification.bodyTemplate, notification.data, { async: false });
304
+ const text = notification.textTemplate ? ejsRender2(notification.textTemplate, notification.data, { async: false }) : void 0;
305
+ const result = await this.client.emails.send({
306
+ from: `${this.opts.fromName} <${this.opts.fromAddress}>`,
307
+ to: [notification.to],
308
+ subject: notification.subject ?? "(no subject)",
309
+ html,
310
+ text
311
+ });
312
+ if ("error" in result && result.error) {
313
+ throw new Error(`Resend error: ${result.error.message}`);
314
+ }
315
+ }
316
+ };
317
+
318
+ // src/drivers/sendgrid.driver.ts
319
+ var import_mail = __toESM(require("@sendgrid/mail"), 1);
320
+ var ejs3 = __toESM(require("ejs"), 1);
321
+ var ejsRender3 = ejs3.render ?? ejs3.render;
322
+ var SendGridDriver = class {
323
+ constructor(opts) {
324
+ this.opts = opts;
325
+ import_mail.default.setApiKey(opts.apiKey);
326
+ }
327
+ opts;
328
+ name = "sendgrid";
329
+ async send(notification) {
330
+ const html = ejsRender3(notification.bodyTemplate, notification.data, { async: false });
331
+ const text = notification.textTemplate ? ejsRender3(notification.textTemplate, notification.data, { async: false }) : void 0;
332
+ await import_mail.default.send({
333
+ from: { name: this.opts.fromName, email: this.opts.fromAddress },
334
+ to: notification.to,
335
+ subject: notification.subject ?? "(no subject)",
336
+ html,
337
+ ...text ? { text } : {}
338
+ });
339
+ }
340
+ };
341
+
342
+ // src/drivers/brevo.driver.ts
343
+ var import_brevo = require("@getbrevo/brevo");
344
+ var ejs4 = __toESM(require("ejs"), 1);
345
+ var ejsRender4 = ejs4.render ?? ejs4.render;
346
+ var BrevoDriver = class {
347
+ constructor(opts) {
348
+ this.opts = opts;
349
+ this.apiInstance = new import_brevo.TransactionalEmailsApi();
350
+ this.apiInstance.setApiKey(import_brevo.TransactionalEmailsApiApiKeys.apiKey, opts.apiKey);
351
+ }
352
+ opts;
353
+ name = "brevo";
354
+ apiInstance;
355
+ async send(notification) {
356
+ const html = ejsRender4(notification.bodyTemplate, notification.data, { async: false });
357
+ const text = notification.textTemplate ? ejsRender4(notification.textTemplate, notification.data, { async: false }) : void 0;
358
+ const email = new import_brevo.SendSmtpEmail();
359
+ email.sender = { name: this.opts.fromName, email: this.opts.fromAddress };
360
+ email.to = [{ email: notification.to }];
361
+ email.subject = notification.subject ?? "(no subject)";
362
+ email.htmlContent = html;
363
+ if (text) email.textContent = text;
364
+ await this.apiInstance.sendTransacEmail(email);
365
+ }
366
+ };
367
+ // Annotate the CommonJS export names for ESM import in node:
368
+ 0 && (module.exports = {
369
+ BrevoDriver,
370
+ DriverRegistry,
371
+ NOTIFICATION_QUEUE_NAME,
372
+ ResendDriver,
373
+ SMTPDriver,
374
+ SendGridDriver,
375
+ createBullMQNotifier,
376
+ createDirectNotifier,
377
+ createNotificationQueue,
378
+ createNotificationWorker,
379
+ enqueueNotification
380
+ });
381
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/registry.ts","../src/queue/producer.ts","../src/notifier.ts","../src/queue/worker.ts","../src/drivers/smtp.driver.ts","../src/drivers/resend.driver.ts","../src/drivers/sendgrid.driver.ts","../src/drivers/brevo.driver.ts"],"sourcesContent":["// Generated by feathers-baas. Safe to edit.\nexport { DriverRegistry } from './registry.js'\nexport { createBullMQNotifier, createDirectNotifier } from './notifier.js'\nexport type { NotifierFn, BullMQNotifierOptions, DirectNotifierOptions } from './notifier.js'\n\n// Queue\nexport { createNotificationQueue, enqueueNotification, NOTIFICATION_QUEUE_NAME } from './queue/producer.js'\nexport { createNotificationWorker } from './queue/worker.js'\nexport type { WorkerOptions } from './queue/worker.js'\n\n// Drivers\nexport { SMTPDriver } from './drivers/smtp.driver.js'\nexport type { SMTPDriverOptions } from './drivers/smtp.driver.js'\nexport { ResendDriver } from './drivers/resend.driver.js'\nexport type { ResendDriverOptions } from './drivers/resend.driver.js'\nexport { SendGridDriver } from './drivers/sendgrid.driver.js'\nexport type { SendGridDriverOptions } from './drivers/sendgrid.driver.js'\nexport { BrevoDriver } from './drivers/brevo.driver.js'\nexport type { BrevoDriverOptions } from './drivers/brevo.driver.js'\n\n// Types\nexport type {\n Notification,\n NotifierDriver,\n NotificationJob,\n NotificationEvent,\n AuthNotificationEvent,\n} from './types.js'\n","// Generated by feathers-baas. Safe to edit.\nimport type { NotifierDriver, NotificationEvent } from './types.js'\n\n/**\n * DriverRegistry maps event keys to the list of drivers that should handle\n * that event.\n *\n * A single driver instance can handle multiple events (e.g. the SMTP driver\n * handles all auth.* email events).\n *\n * @example\n * ```ts\n * const registry = new DriverRegistry()\n * registry.registerDriver(smtpDriver)\n * registry.mapEvent('auth.verify-signup', 'smtp')\n * registry.mapEvent('auth.send-reset-pwd', 'smtp')\n * ```\n */\nexport class DriverRegistry {\n private readonly drivers = new Map<string, NotifierDriver>()\n private readonly eventMap = new Map<NotificationEvent, string[]>()\n\n /** Register a driver under its name. Overwrites any existing driver with the same name. */\n registerDriver(driver: NotifierDriver): void {\n this.drivers.set(driver.name, driver)\n }\n\n /** Map a notification event to a driver name. Multiple calls for the same event add drivers. */\n mapEvent(event: NotificationEvent, driverName: string): void {\n const existing = this.eventMap.get(event) ?? []\n if (!existing.includes(driverName)) {\n existing.push(driverName)\n }\n this.eventMap.set(event, existing)\n }\n\n /** Look up a driver by name. Returns undefined if not registered. */\n getDriver(name: string): NotifierDriver | undefined {\n return this.drivers.get(name)\n }\n\n /** Get all driver names mapped to the given event. */\n getDriversForEvent(event: NotificationEvent): string[] {\n return this.eventMap.get(event) ?? []\n }\n\n /** All registered driver names. */\n listDriverNames(): string[] {\n return [...this.drivers.keys()]\n }\n}\n","// Generated by feathers-baas. Safe to edit.\nimport { Queue } from 'bullmq'\nimport type { Redis } from 'ioredis'\nimport type { NotificationJob } from '../types.js'\n\nexport const NOTIFICATION_QUEUE_NAME = 'feathers-baas:notifications'\n\n/**\n * Create a BullMQ Queue instance for notification jobs.\n *\n * @example\n * ```ts\n * const redis = new Redis(process.env.REDIS_URL)\n * const queue = createNotificationQueue(redis)\n * await enqueueNotification(queue, { driverName: 'smtp', notification: { ... } })\n * ```\n */\nexport function createNotificationQueue(redis: Redis): Queue<NotificationJob> {\n return new Queue<NotificationJob>(NOTIFICATION_QUEUE_NAME, {\n connection: redis,\n defaultJobOptions: {\n attempts: 5,\n backoff: {\n type: 'exponential',\n delay: 1_000, // initial delay: 1s → 2s → 4s → 8s → 16s\n },\n removeOnComplete: { count: 100 },\n removeOnFail: { count: 500 },\n },\n })\n}\n\n/**\n * Enqueue a notification job.\n *\n * @param queue BullMQ Queue instance from createNotificationQueue()\n * @param job Job payload { driverName, notification }\n */\nexport async function enqueueNotification(\n queue: Queue<NotificationJob>,\n job: NotificationJob,\n): Promise<void> {\n await queue.add('send', job)\n}\n","// Generated by feathers-baas. Safe to edit.\nimport type { Queue } from 'bullmq'\nimport type { NotificationJob, Notification, AuthNotificationEvent } from './types.js'\nimport { enqueueNotification } from './queue/producer.js'\nimport type { DriverRegistry } from './registry.js'\n\n/**\n * Auth-management notification types mapped to feathers-baas event keys.\n * feathers-authentication-management passes these type strings to the notifier.\n */\nconst AUTH_MANAGEMENT_EVENT_MAP: Record<string, AuthNotificationEvent> = {\n resendVerifySignup: 'auth.resend-verify-signup',\n verifySignup: 'auth.verify-signup',\n verifySignupSetPassword: 'auth.verify-signup-set-password',\n sendResetPwd: 'auth.send-reset-pwd',\n resetPwd: 'auth.reset-pwd',\n passwordChange: 'auth.password-change',\n identityChange: 'auth.identity-change',\n}\n\n/**\n * Build a default Notification payload for each auth event type.\n * Templates use EJS — `<%= variable %>` for output, `<% code %>` for logic.\n */\nfunction buildAuthNotification(\n type: AuthNotificationEvent,\n user: Record<string, unknown>,\n appUrl: string,\n): Notification | null {\n const email = user['email'] as string\n if (!email) return null\n\n switch (type) {\n case 'auth.verify-signup':\n case 'auth.resend-verify-signup': {\n const token = user['verifyToken'] as string | undefined\n const verifyUrl = `${appUrl}/verify?token=${token ?? ''}`\n return {\n to: email,\n channel: 'email',\n subject: 'Verify your email address',\n bodyTemplate: `\n <h2>Welcome!</h2>\n <p>Click the link below to verify your email address:</p>\n <p><a href=\"<%= verifyUrl %>\">Verify email</a></p>\n <p>This link expires in 24 hours.</p>\n `,\n textTemplate: `Verify your email: <%= verifyUrl %>`,\n data: { verifyUrl, user },\n }\n }\n\n case 'auth.send-reset-pwd': {\n const token = user['resetToken'] as string | undefined\n const resetUrl = `${appUrl}/reset-password?token=${token ?? ''}`\n return {\n to: email,\n channel: 'email',\n subject: 'Reset your password',\n bodyTemplate: `\n <h2>Password reset requested</h2>\n <p>Click the link below to reset your password:</p>\n <p><a href=\"<%= resetUrl %>\">Reset password</a></p>\n <p>This link expires in 2 hours. If you did not request this, ignore this email.</p>\n `,\n textTemplate: `Reset your password: <%= resetUrl %>`,\n data: { resetUrl, user },\n }\n }\n\n case 'auth.reset-pwd': {\n return {\n to: email,\n channel: 'email',\n subject: 'Your password has been reset',\n bodyTemplate: `<p>Your password has been successfully reset. If you did not do this, please contact support immediately.</p>`,\n textTemplate: `Your password has been reset. If you did not do this, please contact support.`,\n data: { user },\n }\n }\n\n case 'auth.password-change': {\n return {\n to: email,\n channel: 'email',\n subject: 'Your password has been changed',\n bodyTemplate: `<p>Your account password was just changed. If this was not you, please contact support immediately.</p>`,\n textTemplate: `Your password was changed. Contact support if this wasn't you.`,\n data: { user },\n }\n }\n\n case 'auth.identity-change': {\n return {\n to: email,\n channel: 'email',\n subject: 'Your email address is being changed',\n bodyTemplate: `<p>A request was made to change your email address. Click the link to confirm.</p>`,\n textTemplate: `Confirm your email change by clicking the link in the HTML email.`,\n data: { user },\n }\n }\n\n case 'auth.verify-signup-set-password': {\n const token = user['verifyToken'] as string | undefined\n const verifyUrl = `${appUrl}/verify-set-password?token=${token ?? ''}`\n return {\n to: email,\n channel: 'email',\n subject: 'Set your password',\n bodyTemplate: `\n <h2>Set your password</h2>\n <p><a href=\"<%= verifyUrl %>\">Set password</a></p>\n `,\n textTemplate: `Set your password: <%= verifyUrl %>`,\n data: { verifyUrl, user },\n }\n }\n }\n}\n\nexport type NotifierFn = (\n type: string,\n user: Record<string, unknown>,\n notifierOptions: Record<string, unknown>,\n) => Promise<void>\n\nexport interface BullMQNotifierOptions {\n /** BullMQ Queue instance — from createNotificationQueue(). */\n queue: Queue<NotificationJob>\n /** Driver registry — used to determine which drivers handle each event. */\n registry: DriverRegistry\n /**\n * Public base URL of the app, e.g. https://api.example.com\n * Used to construct verification / reset URLs in email templates.\n */\n appUrl: string\n}\n\n/**\n * Create a notifier function compatible with feathers-authentication-management.\n *\n * When an auth event fires (verifySignup, sendResetPwd, etc.), this notifier:\n * 1. Maps the event type to a feathers-baas notification event key\n * 2. Looks up all registered drivers for that event\n * 3. Enqueues one BullMQ job per driver\n * 4. Returns immediately — delivery is asynchronous\n *\n * Wire into the app:\n * ```ts\n * app.set('notifier', createBullMQNotifier({ queue, registry, appUrl }))\n * ```\n */\nexport interface DirectNotifierOptions {\n /** Driver registry — used to determine which drivers handle each event. */\n registry: DriverRegistry\n /** Public base URL of the app. */\n appUrl: string\n}\n\n/**\n * Create a notifier that sends notifications directly via the driver (no queue).\n * Use this when Redis/BullMQ is not available — suitable for API-based drivers\n * (Brevo, Resend, SendGrid) in development or low-traffic environments.\n */\nexport function createDirectNotifier(opts: DirectNotifierOptions): NotifierFn {\n return async (type, user, _notifierOptions) => {\n const eventKey = AUTH_MANAGEMENT_EVENT_MAP[type]\n if (!eventKey) return\n\n const notification = buildAuthNotification(eventKey, user, opts.appUrl)\n if (!notification) return\n\n const driverNames = opts.registry.getDriversForEvent(eventKey)\n if (driverNames.length === 0) return\n\n await Promise.all(\n driverNames.map(async (driverName) => {\n const driver = opts.registry.getDriver(driverName)\n if (!driver) return\n await driver.send(notification)\n }),\n )\n }\n}\n\nexport function createBullMQNotifier(opts: BullMQNotifierOptions): NotifierFn {\n return async (type, user, _notifierOptions) => {\n const eventKey = AUTH_MANAGEMENT_EVENT_MAP[type]\n if (!eventKey) return // Unknown event type — no-op\n\n const notification = buildAuthNotification(eventKey, user, opts.appUrl)\n if (!notification) return // Missing required user fields — no-op\n\n const driverNames = opts.registry.getDriversForEvent(eventKey)\n if (driverNames.length === 0) return // No drivers configured for this event\n\n await Promise.all(\n driverNames.map((driverName) =>\n enqueueNotification(opts.queue, { driverName, notification }),\n ),\n )\n }\n}\n","// Generated by feathers-baas. Safe to edit.\nimport { Worker } from 'bullmq'\nimport type { Redis } from 'ioredis'\nimport type { DriverRegistry } from '../registry.js'\nimport type { NotificationJob } from '../types.js'\nimport { NOTIFICATION_QUEUE_NAME } from './producer.js'\n\nexport interface WorkerOptions {\n /** BullMQ concurrency — number of jobs processed in parallel. */\n concurrency?: number\n}\n\n/**\n * Create and start the BullMQ worker that processes notification jobs.\n *\n * The worker looks up the driver from the registry by name, renders the\n * EJS template, and calls driver.send(). BullMQ handles retries with\n * exponential back-off automatically.\n *\n * Call worker.close() during graceful shutdown to drain in-flight jobs.\n *\n * @example\n * ```ts\n * const worker = createNotificationWorker(registry, redis, { concurrency: 5 })\n *\n * process.on('SIGTERM', async () => {\n * await worker.close()\n * })\n * ```\n */\nexport function createNotificationWorker(\n registry: DriverRegistry,\n redis: Redis,\n opts: WorkerOptions = {},\n): Worker<NotificationJob> {\n const concurrency = opts.concurrency ?? 5\n\n const worker = new Worker<NotificationJob>(\n NOTIFICATION_QUEUE_NAME,\n async (job) => {\n const { driverName, notification } = job.data\n\n const driver = registry.getDriver(driverName)\n if (!driver) {\n throw new Error(`Notification driver \"${driverName}\" is not registered`)\n }\n\n await driver.send(notification)\n },\n {\n connection: redis,\n concurrency,\n // Don't create a new redis connection per job — reuse the pool\n autorun: true,\n },\n )\n\n worker.on('failed', (job, err) => {\n // BullMQ handles retries; this is just for observability\n const jobId = job?.id ?? 'unknown'\n const message = err instanceof Error ? err.message : String(err)\n console.error(`[notifications] Job ${jobId} failed: ${message}`)\n })\n\n return worker\n}\n","// Generated by feathers-baas. Safe to edit.\nimport nodemailer from 'nodemailer'\nimport * as ejs from 'ejs'\nimport type { NotifierDriver, Notification } from '../types.js'\n\n// ejs is a CommonJS module — alias the render function defensively\nconst ejsRender = (ejs as unknown as { render?: typeof ejs.render }).render ?? ejs.render\n\nexport interface SMTPDriverOptions {\n /** SMTP connection URL, e.g. smtp://user:pass@mail.example.com:587 */\n url: string\n /** Display name shown in the From field. */\n fromName: string\n /** Email address shown in the From field. */\n fromAddress: string\n}\n\n/**\n * Email driver backed by nodemailer over SMTP.\n * Templates are rendered with EJS at send time.\n *\n * Use this driver for self-hosted SMTP servers (Postfix, Mailtrap, etc.).\n * For transactional email services, prefer ResendDriver.\n */\nexport class SMTPDriver implements NotifierDriver {\n readonly name = 'smtp'\n\n private readonly transporter: nodemailer.Transporter\n\n constructor(private readonly opts: SMTPDriverOptions) {\n this.transporter = nodemailer.createTransport(opts.url)\n }\n\n async send(notification: Notification): Promise<void> {\n const html = ejsRender(notification.bodyTemplate, notification.data, { async: false })\n const text = notification.textTemplate\n ? ejsRender(notification.textTemplate, notification.data, { async: false })\n : undefined\n\n await this.transporter.sendMail({\n from: `\"${this.opts.fromName}\" <${this.opts.fromAddress}>`,\n to: notification.to,\n subject: notification.subject ?? '(no subject)',\n html,\n text,\n })\n }\n\n /** Verify SMTP connectivity. Throws if the server is unreachable. */\n async verify(): Promise<void> {\n await this.transporter.verify()\n }\n\n /** Close the underlying connection pool. */\n close(): void {\n this.transporter.close()\n }\n}\n","// Generated by feathers-baas. Safe to edit.\nimport { Resend } from 'resend'\nimport * as ejs from 'ejs'\nimport type { NotifierDriver, Notification } from '../types.js'\n\nconst ejsRender = (ejs as unknown as { render?: typeof ejs.render }).render ?? ejs.render\n\nexport interface ResendDriverOptions {\n /** Resend API key (from https://resend.com/api-keys). */\n apiKey: string\n /** Display name shown in the From field. */\n fromName: string\n /** Verified sender address. Must be a verified domain in your Resend account. */\n fromAddress: string\n}\n\n/**\n * Email driver backed by the Resend transactional email API.\n * Templates are rendered with EJS at send time.\n *\n * Resend offers generous free tier and excellent deliverability,\n * making it the recommended choice for new projects.\n */\nexport class ResendDriver implements NotifierDriver {\n readonly name = 'resend'\n\n private readonly client: Resend\n\n constructor(private readonly opts: ResendDriverOptions) {\n this.client = new Resend(opts.apiKey)\n }\n\n async send(notification: Notification): Promise<void> {\n const html = ejsRender(notification.bodyTemplate, notification.data, { async: false })\n const text = notification.textTemplate\n ? ejsRender(notification.textTemplate, notification.data, { async: false })\n : undefined\n\n const result = await this.client.emails.send({\n from: `${this.opts.fromName} <${this.opts.fromAddress}>`,\n to: [notification.to],\n subject: notification.subject ?? '(no subject)',\n html,\n text,\n })\n\n if ('error' in result && result.error) {\n throw new Error(`Resend error: ${result.error.message}`)\n }\n }\n}\n","// Generated by feathers-baas. Safe to edit.\nimport sgMail from '@sendgrid/mail'\nimport * as ejs from 'ejs'\nimport type { NotifierDriver, Notification } from '../types.js'\n\n// ejs is a CommonJS module — alias the render function defensively\nconst ejsRender = (ejs as unknown as { render?: typeof ejs.render }).render ?? ejs.render\n\nexport interface SendGridDriverOptions {\n /** SendGrid API key (from https://app.sendgrid.com/settings/api_keys). */\n apiKey: string\n /** Display name shown in the From field. */\n fromName: string\n /** Verified sender address. Must be verified in your SendGrid account. */\n fromAddress: string\n}\n\n/**\n * Email driver backed by the SendGrid API.\n * Templates are rendered with EJS at send time.\n */\nexport class SendGridDriver implements NotifierDriver {\n readonly name = 'sendgrid'\n\n constructor(private readonly opts: SendGridDriverOptions) {\n sgMail.setApiKey(opts.apiKey)\n }\n\n async send(notification: Notification): Promise<void> {\n const html = ejsRender(notification.bodyTemplate, notification.data, { async: false })\n const text = notification.textTemplate\n ? ejsRender(notification.textTemplate, notification.data, { async: false })\n : undefined\n\n await sgMail.send({\n from: { name: this.opts.fromName, email: this.opts.fromAddress },\n to: notification.to,\n subject: notification.subject ?? '(no subject)',\n html,\n ...(text ? { text } : {}),\n })\n }\n}\n","// Generated by feathers-baas. Safe to edit.\nimport { TransactionalEmailsApi, TransactionalEmailsApiApiKeys, SendSmtpEmail } from '@getbrevo/brevo'\nimport * as ejs from 'ejs'\nimport type { NotifierDriver, Notification } from '../types.js'\n\n// ejs is a CommonJS module — alias the render function defensively\nconst ejsRender = (ejs as unknown as { render?: typeof ejs.render }).render ?? ejs.render\n\nexport interface BrevoDriverOptions {\n /** Brevo API key (from https://app.brevo.com/settings/keys/api). */\n apiKey: string\n /** Display name shown in the From field. */\n fromName: string\n /** Verified sender address. Must be verified in your Brevo account. */\n fromAddress: string\n}\n\n/**\n * Email driver backed by the Brevo (formerly Sendinblue) Transactional Email API.\n * Templates are rendered with EJS at send time.\n */\nexport class BrevoDriver implements NotifierDriver {\n readonly name = 'brevo'\n\n private readonly apiInstance: TransactionalEmailsApi\n\n constructor(private readonly opts: BrevoDriverOptions) {\n this.apiInstance = new TransactionalEmailsApi()\n this.apiInstance.setApiKey(TransactionalEmailsApiApiKeys.apiKey, opts.apiKey)\n }\n\n async send(notification: Notification): Promise<void> {\n const html = ejsRender(notification.bodyTemplate, notification.data, { async: false })\n const text = notification.textTemplate\n ? ejsRender(notification.textTemplate, notification.data, { async: false })\n : undefined\n\n const email = new SendSmtpEmail()\n email.sender = { name: this.opts.fromName, email: this.opts.fromAddress }\n email.to = [{ email: notification.to }]\n email.subject = notification.subject ?? '(no subject)'\n email.htmlContent = html\n if (text) email.textContent = text\n\n await this.apiInstance.sendTransacEmail(email)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACkBO,IAAM,iBAAN,MAAqB;AAAA,EACT,UAAU,oBAAI,IAA4B;AAAA,EAC1C,WAAW,oBAAI,IAAiC;AAAA;AAAA,EAGjE,eAAe,QAA8B;AAC3C,SAAK,QAAQ,IAAI,OAAO,MAAM,MAAM;AAAA,EACtC;AAAA;AAAA,EAGA,SAAS,OAA0B,YAA0B;AAC3D,UAAM,WAAW,KAAK,SAAS,IAAI,KAAK,KAAK,CAAC;AAC9C,QAAI,CAAC,SAAS,SAAS,UAAU,GAAG;AAClC,eAAS,KAAK,UAAU;AAAA,IAC1B;AACA,SAAK,SAAS,IAAI,OAAO,QAAQ;AAAA,EACnC;AAAA;AAAA,EAGA,UAAU,MAA0C;AAClD,WAAO,KAAK,QAAQ,IAAI,IAAI;AAAA,EAC9B;AAAA;AAAA,EAGA,mBAAmB,OAAoC;AACrD,WAAO,KAAK,SAAS,IAAI,KAAK,KAAK,CAAC;AAAA,EACtC;AAAA;AAAA,EAGA,kBAA4B;AAC1B,WAAO,CAAC,GAAG,KAAK,QAAQ,KAAK,CAAC;AAAA,EAChC;AACF;;;ACjDA,oBAAsB;AAIf,IAAM,0BAA0B;AAYhC,SAAS,wBAAwB,OAAsC;AAC5E,SAAO,IAAI,oBAAuB,yBAAyB;AAAA,IACzD,YAAY;AAAA,IACZ,mBAAmB;AAAA,MACjB,UAAU;AAAA,MACV,SAAS;AAAA,QACP,MAAM;AAAA,QACN,OAAO;AAAA;AAAA,MACT;AAAA,MACA,kBAAkB,EAAE,OAAO,IAAI;AAAA,MAC/B,cAAc,EAAE,OAAO,IAAI;AAAA,I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