@backstage/plugin-notifications-backend-module-email 0.0.1 → 0.1.0-next.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/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @backstage/plugin-notifications-backend-module-email
2
2
 
3
+ ## 0.1.0-next.1
4
+
5
+ ### Minor Changes
6
+
7
+ - 07a789b: add notification filters
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @backstage/backend-plugin-api@0.6.19-next.1
13
+ - @backstage/plugin-notifications-node@0.2.0-next.1
14
+ - @backstage/backend-common@0.23.0-next.1
15
+
16
+ ## 0.0.2-next.0
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies
21
+ - @backstage/backend-common@0.22.1-next.0
22
+ - @backstage/backend-plugin-api@0.6.19-next.0
23
+ - @backstage/plugin-notifications-node@0.1.5-next.0
24
+ - @backstage/catalog-client@1.6.5
25
+ - @backstage/catalog-model@1.5.0
26
+ - @backstage/config@1.2.0
27
+ - @backstage/integration-aws-node@0.1.12
28
+ - @backstage/types@1.1.1
29
+ - @backstage/plugin-notifications-common@0.0.3
30
+
3
31
  ## 0.0.1
4
32
 
5
33
  ### Patch Changes
package/config.d.ts CHANGED
@@ -15,6 +15,7 @@
15
15
  */
16
16
 
17
17
  import { HumanDuration } from '@backstage/types';
18
+ import { NotificationSeverity } from '@backstage/plugin-notifications-common';
18
19
 
19
20
  export interface Config {
20
21
  /**
@@ -117,6 +118,20 @@ export interface Config {
117
118
  */
118
119
  ttl?: HumanDuration;
119
120
  };
121
+ filter?: {
122
+ /**
123
+ * Minimum severity. A notification with lower severity will not be emailed
124
+ */
125
+ minSeverity?: NotificationSeverity;
126
+ /**
127
+ * Maximum severity. A notification with higher severity will not be emailed
128
+ */
129
+ maxSeverity?: NotificationSeverity;
130
+ /**
131
+ * A notification who's topic is in this array will not be emailed
132
+ */
133
+ excludedTopics?: string[];
134
+ };
120
135
  };
121
136
  };
122
137
  };
package/dist/index.cjs.js CHANGED
@@ -7,6 +7,7 @@ var catalogClient = require('@backstage/catalog-client');
7
7
  var pluginNotificationsNode = require('@backstage/plugin-notifications-node');
8
8
  var config = require('@backstage/config');
9
9
  var types = require('@backstage/types');
10
+ var pluginNotificationsCommon = require('@backstage/plugin-notifications-common');
10
11
  var nodemailer = require('nodemailer');
11
12
  var clientSes = require('@aws-sdk/client-ses');
12
13
  var lodash = require('lodash');
@@ -18,26 +19,24 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
18
19
  var pThrottle__default = /*#__PURE__*/_interopDefaultCompat(pThrottle);
19
20
 
20
21
  const createSmtpTransport = (config) => {
21
- var _a, _b;
22
22
  const username = config.getOptionalString("username");
23
23
  const password = config.getOptionalString("password");
24
24
  return nodemailer.createTransport({
25
25
  host: config.getString("hostname"),
26
26
  port: config.getNumber("port"),
27
- secure: (_a = config.getOptionalBoolean("secure")) != null ? _a : false,
28
- requireTLS: (_b = config.getOptionalBoolean("requireTls")) != null ? _b : false,
27
+ secure: config.getOptionalBoolean("secure") ?? false,
28
+ requireTLS: config.getOptionalBoolean("requireTls") ?? false,
29
29
  auth: username && password ? { user: username, pass: password } : void 0
30
30
  });
31
31
  };
32
32
 
33
33
  const createSesTransport = async (config, credentialsManager) => {
34
- var _a;
35
34
  const credentials = await credentialsManager.getCredentialProvider({
36
35
  accountId: config.getOptionalString("accountId")
37
36
  });
38
37
  const ses = new clientSes.SES([
39
38
  {
40
- apiVersion: (_a = config.getOptionalString("apiVersion")) != null ? _a : "2010-12-01",
39
+ apiVersion: config.getOptionalString("apiVersion") ?? "2010-12-01",
41
40
  credentials: credentials.sdkCredentialProvider,
42
41
  region: config.getOptionalString("region")
43
42
  }
@@ -48,20 +47,13 @@ const createSesTransport = async (config, credentialsManager) => {
48
47
  };
49
48
 
50
49
  const createSendmailTransport = (config) => {
51
- var _a, _b;
52
50
  return nodemailer.createTransport({
53
51
  sendmail: true,
54
- newline: (_a = config.getOptionalString("newline")) != null ? _a : "unix",
55
- path: (_b = config.getOptionalString("path")) != null ? _b : "/usr/sbin/sendmail"
52
+ newline: config.getOptionalString("newline") ?? "unix",
53
+ path: config.getOptionalString("path") ?? "/usr/sbin/sendmail"
56
54
  });
57
55
  };
58
56
 
59
- var __defProp = Object.defineProperty;
60
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
61
- var __publicField = (obj, key, value) => {
62
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
63
- return value;
64
- };
65
57
  class NotificationsEmailProcessor {
66
58
  constructor(logger, config$1, catalog, auth, cache, templateRenderer) {
67
59
  this.logger = logger;
@@ -70,16 +62,6 @@ class NotificationsEmailProcessor {
70
62
  this.auth = auth;
71
63
  this.cache = cache;
72
64
  this.templateRenderer = templateRenderer;
73
- __publicField(this, "transporter");
74
- __publicField(this, "broadcastConfig");
75
- __publicField(this, "transportConfig");
76
- __publicField(this, "sender");
77
- __publicField(this, "replyTo");
78
- __publicField(this, "cacheTtl");
79
- __publicField(this, "concurrencyLimit");
80
- __publicField(this, "throttleInterval");
81
- __publicField(this, "frontendBaseUrl");
82
- var _a;
83
65
  const emailProcessorConfig = config$1.getConfig(
84
66
  "notifications.processors.email"
85
67
  );
@@ -87,13 +69,47 @@ class NotificationsEmailProcessor {
87
69
  this.broadcastConfig = emailProcessorConfig.getOptionalConfig("broadcastConfig");
88
70
  this.sender = emailProcessorConfig.getString("sender");
89
71
  this.replyTo = emailProcessorConfig.getOptionalString("replyTo");
90
- this.concurrencyLimit = (_a = emailProcessorConfig.getOptionalNumber("concurrencyLimit")) != null ? _a : 2;
72
+ this.concurrencyLimit = emailProcessorConfig.getOptionalNumber("concurrencyLimit") ?? 2;
91
73
  const throttleConfig = emailProcessorConfig.getOptionalConfig("throttleInterval");
92
74
  this.throttleInterval = throttleConfig ? types.durationToMilliseconds(config.readDurationFromConfig(throttleConfig)) : 100;
93
75
  const cacheConfig = emailProcessorConfig.getOptionalConfig("cache.ttl");
94
76
  this.cacheTtl = cacheConfig ? types.durationToMilliseconds(config.readDurationFromConfig(cacheConfig)) : 36e5;
95
77
  this.frontendBaseUrl = config$1.getString("app.baseUrl");
78
+ this.filter = {};
79
+ const minSeverity = emailProcessorConfig.getOptionalString(
80
+ "filter.minSeverity"
81
+ );
82
+ if (minSeverity) {
83
+ if (pluginNotificationsCommon.notificationSeverities.includes(minSeverity)) {
84
+ this.filter.minSeverity = minSeverity;
85
+ } else {
86
+ throw new Error(`Invalid minSeverity: ${minSeverity}`);
87
+ }
88
+ }
89
+ const maxSeverity = emailProcessorConfig.getOptionalString(
90
+ "filter.maxSeverity"
91
+ );
92
+ if (maxSeverity) {
93
+ if (pluginNotificationsCommon.notificationSeverities.includes(maxSeverity)) {
94
+ this.filter.maxSeverity = maxSeverity;
95
+ } else {
96
+ throw new Error(`Invalid maxSeverity: ${maxSeverity}`);
97
+ }
98
+ }
99
+ this.filter.excludedTopics = emailProcessorConfig.getOptionalStringArray(
100
+ "filter.excludedTopics"
101
+ );
96
102
  }
103
+ transporter;
104
+ broadcastConfig;
105
+ transportConfig;
106
+ sender;
107
+ replyTo;
108
+ cacheTtl;
109
+ concurrencyLimit;
110
+ throttleInterval;
111
+ frontendBaseUrl;
112
+ filter;
97
113
  async getTransporter() {
98
114
  if (this.transporter) {
99
115
  return this.transporter;
@@ -120,7 +136,6 @@ class NotificationsEmailProcessor {
120
136
  return "Email";
121
137
  }
122
138
  async getBroadcastEmails() {
123
- var _a, _b, _c;
124
139
  if (!this.broadcastConfig) {
125
140
  return [];
126
141
  }
@@ -129,10 +144,10 @@ class NotificationsEmailProcessor {
129
144
  return [];
130
145
  }
131
146
  if (receiver === "config") {
132
- return (_a = this.broadcastConfig.getOptionalStringArray("receiverEmails")) != null ? _a : [];
147
+ return this.broadcastConfig.getOptionalStringArray("receiverEmails") ?? [];
133
148
  }
134
149
  if (receiver === "users") {
135
- const cached = await ((_b = this.cache) == null ? void 0 : _b.get("user-emails:all"));
150
+ const cached = await this.cache?.get("user-emails:all");
136
151
  if (cached) {
137
152
  return cached;
138
153
  }
@@ -152,21 +167,19 @@ class NotificationsEmailProcessor {
152
167
  const ret = lodash.compact([
153
168
  ...new Set(
154
169
  entities.items.map((entity) => {
155
- var _a2;
156
- return (_a2 = entity == null ? void 0 : entity.spec.profile) == null ? void 0 : _a2.email;
170
+ return entity?.spec.profile?.email;
157
171
  })
158
172
  )
159
173
  ]);
160
- await ((_c = this.cache) == null ? void 0 : _c.set("user-emails:all", ret, {
174
+ await this.cache?.set("user-emails:all", ret, {
161
175
  ttl: this.cacheTtl
162
- }));
176
+ });
163
177
  return ret;
164
178
  }
165
179
  throw new Error(`Unsupported broadcast receiver: ${receiver}`);
166
180
  }
167
181
  async getUserEmail(entityRef) {
168
- var _a, _b, _c;
169
- const cached = await ((_a = this.cache) == null ? void 0 : _a.get(`user-emails:${entityRef}`));
182
+ const cached = await this.cache?.get(`user-emails:${entityRef}`);
170
183
  if (cached) {
171
184
  return cached;
172
185
  }
@@ -178,13 +191,13 @@ class NotificationsEmailProcessor {
178
191
  const ret = [];
179
192
  if (entity) {
180
193
  const userEntity = entity;
181
- if ((_b = userEntity.spec.profile) == null ? void 0 : _b.email) {
194
+ if (userEntity.spec.profile?.email) {
182
195
  ret.push(userEntity.spec.profile.email);
183
196
  }
184
197
  }
185
- await ((_c = this.cache) == null ? void 0 : _c.set(`user-emails:${entityRef}`, ret, {
198
+ await this.cache?.set(`user-emails:${entityRef}`, ret, {
186
199
  ttl: this.cacheTtl
187
- }));
200
+ });
188
201
  return ret;
189
202
  }
190
203
  async getRecipientEmails(notification, options) {
@@ -254,12 +267,11 @@ class NotificationsEmailProcessor {
254
267
  await this.sendMails(mailOptions, emails);
255
268
  }
256
269
  async sendTemplateEmail(notification, emails) {
257
- var _a, _b, _c, _d, _e, _f, _g;
258
270
  const mailOptions = {
259
271
  from: this.sender,
260
- subject: (_c = (_b = (_a = this.templateRenderer) == null ? void 0 : _a.getSubject) == null ? void 0 : _b.call(_a, notification)) != null ? _c : notification.payload.title,
261
- html: (_e = (_d = this.templateRenderer) == null ? void 0 : _d.getHtml) == null ? void 0 : _e.call(_d, notification),
262
- text: (_g = (_f = this.templateRenderer) == null ? void 0 : _f.getText) == null ? void 0 : _g.call(_f, notification),
272
+ subject: this.templateRenderer?.getSubject?.(notification) ?? notification.payload.title,
273
+ html: this.templateRenderer?.getHtml?.(notification),
274
+ text: this.templateRenderer?.getText?.(notification),
263
275
  replyTo: this.replyTo
264
276
  };
265
277
  await this.sendMails(mailOptions, emails);
@@ -285,6 +297,9 @@ class NotificationsEmailProcessor {
285
297
  }
286
298
  await this.sendTemplateEmail(notification, emails);
287
299
  }
300
+ getNotificationFilters() {
301
+ return this.filter;
302
+ }
288
303
  }
289
304
 
290
305
  const notificationsEmailTemplateExtensionPoint = backendPluginApi.createExtensionPoint({
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/processor/transports/smtp.ts","../src/processor/transports/ses.ts","../src/processor/transports/sendmail.ts","../src/processor/NotificationsEmailProcessor.ts","../src/extensions.ts","../src/module.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createTransport } from 'nodemailer';\nimport { Config } from '@backstage/config';\n\nexport const createSmtpTransport = (config: Config) => {\n const username = config.getOptionalString('username');\n const password = config.getOptionalString('password');\n\n return createTransport({\n host: config.getString('hostname'),\n port: config.getNumber('port'),\n secure: config.getOptionalBoolean('secure') ?? false,\n requireTLS: config.getOptionalBoolean('requireTls') ?? false,\n auth: username && password ? { user: username, pass: password } : undefined,\n });\n};\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createTransport } from 'nodemailer';\nimport { SendRawEmailCommand, SES } from '@aws-sdk/client-ses';\nimport { Config } from '@backstage/config';\nimport { AwsCredentialsManager } from '@backstage/integration-aws-node';\n\nexport const createSesTransport = async (\n config: Config,\n credentialsManager: AwsCredentialsManager,\n) => {\n const credentials = await credentialsManager.getCredentialProvider({\n accountId: config.getOptionalString('accountId'),\n });\n const ses = new SES([\n {\n apiVersion: config.getOptionalString('apiVersion') ?? '2010-12-01',\n credentials: credentials.sdkCredentialProvider,\n region: config.getOptionalString('region'),\n },\n ]);\n return createTransport({\n SES: { ses, aws: { SendRawEmailCommand } },\n });\n};\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createTransport } from 'nodemailer';\nimport { Config } from '@backstage/config';\n\nexport const createSendmailTransport = (config: Config) => {\n return createTransport({\n sendmail: true,\n newline: config.getOptionalString('newline') ?? 'unix',\n path: config.getOptionalString('path') ?? '/usr/sbin/sendmail',\n });\n};\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n NotificationProcessor,\n NotificationSendOptions,\n} from '@backstage/plugin-notifications-node';\nimport {\n AuthService,\n CacheService,\n LoggerService,\n} from '@backstage/backend-plugin-api';\nimport { Config, readDurationFromConfig } from '@backstage/config';\nimport { durationToMilliseconds } from '@backstage/types';\nimport {\n CATALOG_FILTER_EXISTS,\n CatalogClient,\n} from '@backstage/catalog-client';\nimport { Notification } from '@backstage/plugin-notifications-common';\nimport {\n createSendmailTransport,\n createSesTransport,\n createSmtpTransport,\n} from './transports';\nimport { UserEntity } from '@backstage/catalog-model';\nimport { compact } from 'lodash';\nimport { DefaultAwsCredentialsManager } from '@backstage/integration-aws-node';\nimport { NotificationTemplateRenderer } from '../extensions';\nimport Mail from 'nodemailer/lib/mailer';\nimport pThrottle from 'p-throttle';\n\nexport class NotificationsEmailProcessor implements NotificationProcessor {\n private transporter: any;\n private readonly broadcastConfig?: Config;\n private readonly transportConfig: Config;\n private readonly sender: string;\n private readonly replyTo?: string;\n private readonly cacheTtl: number;\n private readonly concurrencyLimit: number;\n private readonly throttleInterval: number;\n private readonly frontendBaseUrl: string;\n\n constructor(\n private readonly logger: LoggerService,\n private readonly config: Config,\n private readonly catalog: CatalogClient,\n private readonly auth: AuthService,\n private readonly cache?: CacheService,\n private readonly templateRenderer?: NotificationTemplateRenderer,\n ) {\n const emailProcessorConfig = config.getConfig(\n 'notifications.processors.email',\n );\n this.transportConfig = emailProcessorConfig.getConfig('transportConfig');\n this.broadcastConfig =\n emailProcessorConfig.getOptionalConfig('broadcastConfig');\n this.sender = emailProcessorConfig.getString('sender');\n this.replyTo = emailProcessorConfig.getOptionalString('replyTo');\n this.concurrencyLimit =\n emailProcessorConfig.getOptionalNumber('concurrencyLimit') ?? 2;\n const throttleConfig =\n emailProcessorConfig.getOptionalConfig('throttleInterval');\n this.throttleInterval = throttleConfig\n ? durationToMilliseconds(readDurationFromConfig(throttleConfig))\n : 100;\n const cacheConfig = emailProcessorConfig.getOptionalConfig('cache.ttl');\n this.cacheTtl = cacheConfig\n ? durationToMilliseconds(readDurationFromConfig(cacheConfig))\n : 3_600_000;\n this.frontendBaseUrl = config.getString('app.baseUrl');\n }\n\n private async getTransporter() {\n if (this.transporter) {\n return this.transporter;\n }\n const transport = this.transportConfig.getString('transport');\n if (transport === 'smtp') {\n this.transporter = createSmtpTransport(this.transportConfig);\n } else if (transport === 'ses') {\n const awsCredentialsManager = DefaultAwsCredentialsManager.fromConfig(\n this.config,\n );\n this.transporter = await createSesTransport(\n this.transportConfig,\n awsCredentialsManager,\n );\n } else if (transport === 'sendmail') {\n this.transporter = createSendmailTransport(this.transportConfig);\n } else {\n throw new Error(`Unsupported transport: ${transport}`);\n }\n return this.transporter;\n }\n\n getName(): string {\n return 'Email';\n }\n\n private async getBroadcastEmails(): Promise<string[]> {\n if (!this.broadcastConfig) {\n return [];\n }\n\n const receiver = this.broadcastConfig.getString('receiver');\n if (receiver === 'none') {\n return [];\n }\n\n if (receiver === 'config') {\n return (\n this.broadcastConfig.getOptionalStringArray('receiverEmails') ?? []\n );\n }\n\n if (receiver === 'users') {\n const cached = await this.cache?.get<string[]>('user-emails:all');\n if (cached) {\n return cached;\n }\n\n const { token } = await this.auth.getPluginRequestToken({\n onBehalfOf: await this.auth.getOwnServiceCredentials(),\n targetPluginId: 'catalog',\n });\n const entities = await this.catalog.getEntities(\n {\n filter: [\n { kind: 'user', 'spec.profile.email': CATALOG_FILTER_EXISTS },\n ],\n fields: ['spec.profile.email'],\n },\n { token },\n );\n const ret = compact([\n ...new Set(\n entities.items.map(entity => {\n return (entity as UserEntity)?.spec.profile?.email;\n }),\n ),\n ]);\n\n await this.cache?.set('user-emails:all', ret, {\n ttl: this.cacheTtl,\n });\n return ret;\n }\n\n throw new Error(`Unsupported broadcast receiver: ${receiver}`);\n }\n\n private async getUserEmail(entityRef: string): Promise<string[]> {\n const cached = await this.cache?.get<string[]>(`user-emails:${entityRef}`);\n if (cached) {\n return cached;\n }\n\n const { token } = await this.auth.getPluginRequestToken({\n onBehalfOf: await this.auth.getOwnServiceCredentials(),\n targetPluginId: 'catalog',\n });\n const entity = await this.catalog.getEntityByRef(entityRef, { token });\n const ret: string[] = [];\n if (entity) {\n const userEntity = entity as UserEntity;\n if (userEntity.spec.profile?.email) {\n ret.push(userEntity.spec.profile.email);\n }\n }\n\n await this.cache?.set(`user-emails:${entityRef}`, ret, {\n ttl: this.cacheTtl,\n });\n\n return ret;\n }\n\n private async getRecipientEmails(\n notification: Notification,\n options: NotificationSendOptions,\n ) {\n if (options.recipients.type === 'broadcast' || notification.user === null) {\n return await this.getBroadcastEmails();\n }\n return await this.getUserEmail(notification.user);\n }\n\n private async sendMail(options: Mail.Options) {\n try {\n await this.transporter.sendMail(options);\n } catch (e) {\n this.logger.error(`Failed to send email to ${options.to}: ${e}`);\n }\n }\n\n private async sendMails(options: Mail.Options, emails: string[]) {\n const throttle = pThrottle({\n limit: this.concurrencyLimit,\n interval: this.throttleInterval,\n });\n\n const throttled = throttle((opts: Mail.Options) => this.sendMail(opts));\n await Promise.all(\n emails.map(email => throttled({ ...options, to: email })),\n );\n }\n\n private getNotificationLink(notification: Notification) {\n if (notification.payload.link) {\n const stripLeadingSlash = (s: string) => s.replace(/^\\//, '');\n const ensureTrailingSlash = (s: string) => s.replace(/\\/?$/, '/');\n\n try {\n const url = new URL(\n stripLeadingSlash(notification.payload.link),\n ensureTrailingSlash(this.frontendBaseUrl),\n );\n return url.toString();\n } catch (_e) {\n // noop: fallback to relative URL\n }\n return notification.payload.link;\n }\n return `${this.frontendBaseUrl}/notifications`;\n }\n\n private getHtmlContent(notification: Notification) {\n const contentParts: string[] = [];\n if (notification.payload.description) {\n contentParts.push(`${notification.payload.description}`);\n }\n const link = this.getNotificationLink(notification);\n contentParts.push(`<a href=\"${link}\">${link}</a>`);\n return `<p>${contentParts.join('<br/>')}</p>`;\n }\n\n private getTextContent(notification: Notification) {\n const contentParts: string[] = [];\n if (notification.payload.description) {\n contentParts.push(notification.payload.description);\n }\n contentParts.push(this.getNotificationLink(notification));\n return contentParts.join('\\n\\n');\n }\n\n private async sendPlainEmail(notification: Notification, emails: string[]) {\n const mailOptions = {\n from: this.sender,\n subject: notification.payload.title,\n html: this.getHtmlContent(notification),\n text: this.getTextContent(notification),\n replyTo: this.replyTo,\n };\n\n await this.sendMails(mailOptions, emails);\n }\n\n private async sendTemplateEmail(\n notification: Notification,\n emails: string[],\n ) {\n const mailOptions = {\n from: this.sender,\n subject:\n this.templateRenderer?.getSubject?.(notification) ??\n notification.payload.title,\n html: this.templateRenderer?.getHtml?.(notification),\n text: this.templateRenderer?.getText?.(notification),\n replyTo: this.replyTo,\n };\n\n await this.sendMails(mailOptions, emails);\n }\n\n async postProcess(\n notification: Notification,\n options: NotificationSendOptions,\n ): Promise<void> {\n this.transporter = await this.getTransporter();\n\n let emails: string[] = [];\n try {\n emails = await this.getRecipientEmails(notification, options);\n } catch (e) {\n this.logger.error(`Failed to resolve recipient emails: ${e}`);\n return;\n }\n\n if (emails.length === 0) {\n this.logger.info(\n `No email recipients found for notification: ${notification.id}, skipping`,\n );\n return;\n }\n\n if (!this.templateRenderer) {\n await this.sendPlainEmail(notification, emails);\n return;\n }\n\n await this.sendTemplateEmail(notification, emails);\n }\n}\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createExtensionPoint } from '@backstage/backend-plugin-api';\nimport { Notification } from '@backstage/plugin-notifications-common';\n\n/**\n * @public\n */\nexport interface NotificationTemplateRenderer {\n getSubject?(notification: Notification): string;\n getText?(notification: Notification): string;\n getHtml?(notification: Notification): string;\n}\n\n/**\n * @public\n */\nexport interface NotificationsEmailTemplateExtensionPoint {\n setTemplateRenderer(renderer: NotificationTemplateRenderer): void;\n}\n\n/**\n * @public\n */\nexport const notificationsEmailTemplateExtensionPoint =\n createExtensionPoint<NotificationsEmailTemplateExtensionPoint>({\n id: 'notifications.email.templates',\n });\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport { CatalogClient } from '@backstage/catalog-client';\nimport { notificationsProcessingExtensionPoint } from '@backstage/plugin-notifications-node';\nimport { NotificationsEmailProcessor } from './processor';\nimport {\n notificationsEmailTemplateExtensionPoint,\n NotificationTemplateRenderer,\n} from './extensions';\n\n/**\n * @public\n */\nexport const notificationsModuleEmail = createBackendModule({\n pluginId: 'notifications',\n moduleId: 'email',\n register(reg) {\n let templateRenderer: NotificationTemplateRenderer | undefined;\n reg.registerExtensionPoint(notificationsEmailTemplateExtensionPoint, {\n setTemplateRenderer(renderer) {\n if (templateRenderer) {\n throw new Error(`Email template renderer was already registered`);\n }\n templateRenderer = renderer;\n },\n });\n\n reg.registerInit({\n deps: {\n config: coreServices.rootConfig,\n notifications: notificationsProcessingExtensionPoint,\n discovery: coreServices.discovery,\n logger: coreServices.logger,\n auth: coreServices.auth,\n cache: coreServices.cache,\n },\n async init({ config, notifications, discovery, logger, auth, cache }) {\n const catalogClient = new CatalogClient({\n discoveryApi: discovery,\n });\n\n notifications.addProcessor(\n new NotificationsEmailProcessor(\n logger,\n config,\n catalogClient,\n auth,\n cache,\n templateRenderer,\n ),\n );\n },\n });\n },\n});\n"],"names":["createTransport","SES","SendRawEmailCommand","config","durationToMilliseconds","readDurationFromConfig","DefaultAwsCredentialsManager","CATALOG_FILTER_EXISTS","compact","_a","pThrottle","createExtensionPoint","createBackendModule","coreServices","notificationsProcessingExtensionPoint","catalogClient","CatalogClient"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBa,MAAA,mBAAA,GAAsB,CAAC,MAAmB,KAAA;AAlBvD,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AAmBE,EAAM,MAAA,QAAA,GAAW,MAAO,CAAA,iBAAA,CAAkB,UAAU,CAAA,CAAA;AACpD,EAAM,MAAA,QAAA,GAAW,MAAO,CAAA,iBAAA,CAAkB,UAAU,CAAA,CAAA;AAEpD,EAAA,OAAOA,0BAAgB,CAAA;AAAA,IACrB,IAAA,EAAM,MAAO,CAAA,SAAA,CAAU,UAAU,CAAA;AAAA,IACjC,IAAA,EAAM,MAAO,CAAA,SAAA,CAAU,MAAM,CAAA;AAAA,IAC7B,MAAQ,EAAA,CAAA,EAAA,GAAA,MAAA,CAAO,kBAAmB,CAAA,QAAQ,MAAlC,IAAuC,GAAA,EAAA,GAAA,KAAA;AAAA,IAC/C,UAAY,EAAA,CAAA,EAAA,GAAA,MAAA,CAAO,kBAAmB,CAAA,YAAY,MAAtC,IAA2C,GAAA,EAAA,GAAA,KAAA;AAAA,IACvD,IAAA,EAAM,YAAY,QAAW,GAAA,EAAE,MAAM,QAAU,EAAA,IAAA,EAAM,UAAa,GAAA,KAAA,CAAA;AAAA,GACnE,CAAA,CAAA;AACH,CAAA;;ACTa,MAAA,kBAAA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AAA,gBAAA,CAAA;AACJ,IAAA,GAAA,CAAI,uBAAuB,wCAA0C,EAAA;AAAA,MACnE,oBAAoB,QAAU,EAAA;AAC5B,QAAA,IAAI,gBAAkB,EAAA;AACpB,UAAM,MAAA,IAAI,MAAM,CAAgD,8CAAA,CAAA,CAAA,CAAA;AAAA,SAClE;AACA,QAAmB,gBAAA,GAAA,QAAA,CAAA;AAAA,OACrB;AAAA,KACD,CAAA,CAAA;AAED,IAAA,GAAA,CAAI,YAAa,CAAA;AAAA,MACf,IAAM,EAAA;AAAA,QACJ,QAAQC,6BAAa,CAAA,UAAA;AAAA,QACrB,aAAe,EAAAC,6DAAA;AAAA,QACf,WAAWD,6BAAa,CAAA,SAAA;AAAA,QACxB,QAAQA,6BAAa,CAAA,MAAA;AAAA,QACrB,MAAMA,6BAAa,CAAA,IAAA;AAAA,QACnB,OAAOA,6BAAa,CAAA,KAAA;AAAA,OACtB;AAAA,MACA,MAAM,KAAK,EAAE,MAAA,EAAQ,eAAe,SAAW,EAAA,MAAA,EAAQ,IAAM,EAAA,KAAA,EAAS,EAAA;AACpE,QAAM,MAAAE,eAAA,GAAgB,IAAIC,2BAAc,CAAA;AAAA,UACtC,YAAc,EAAA,SAAA;AAAA,SACf,CAAA,CAAA;AAED,QAAc,aAAA,CAAA,YAAA;AAAA,UACZ,IAAI,2BAAA;AAAA,YACF,MAAA;AAAA,YACA,MAAA;AAAA,YACAD,eAAA;AAAA,YACA,IAAA;AAAA,YACA,KAAA;AAAA,YACA,gBAAA;AAAA,WACF;AAAA,SACF,CAAA;AAAA,OACF;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF,CAAC;;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/processor/transports/smtp.ts","../src/processor/transports/ses.ts","../src/processor/transports/sendmail.ts","../src/processor/NotificationsEmailProcessor.ts","../src/extensions.ts","../src/module.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createTransport } from 'nodemailer';\nimport { Config } from '@backstage/config';\n\nexport const createSmtpTransport = (config: Config) => {\n const username = config.getOptionalString('username');\n const password = config.getOptionalString('password');\n\n return createTransport({\n host: config.getString('hostname'),\n port: config.getNumber('port'),\n secure: config.getOptionalBoolean('secure') ?? false,\n requireTLS: config.getOptionalBoolean('requireTls') ?? false,\n auth: username && password ? { user: username, pass: password } : undefined,\n });\n};\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createTransport } from 'nodemailer';\nimport { SendRawEmailCommand, SES } from '@aws-sdk/client-ses';\nimport { Config } from '@backstage/config';\nimport { AwsCredentialsManager } from '@backstage/integration-aws-node';\n\nexport const createSesTransport = async (\n config: Config,\n credentialsManager: AwsCredentialsManager,\n) => {\n const credentials = await credentialsManager.getCredentialProvider({\n accountId: config.getOptionalString('accountId'),\n });\n const ses = new SES([\n {\n apiVersion: config.getOptionalString('apiVersion') ?? '2010-12-01',\n credentials: credentials.sdkCredentialProvider,\n region: config.getOptionalString('region'),\n },\n ]);\n return createTransport({\n SES: { ses, aws: { SendRawEmailCommand } },\n });\n};\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createTransport } from 'nodemailer';\nimport { Config } from '@backstage/config';\n\nexport const createSendmailTransport = (config: Config) => {\n return createTransport({\n sendmail: true,\n newline: config.getOptionalString('newline') ?? 'unix',\n path: config.getOptionalString('path') ?? '/usr/sbin/sendmail',\n });\n};\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n NotificationProcessor,\n NotificationProcessorFilters,\n NotificationSendOptions,\n} from '@backstage/plugin-notifications-node';\nimport {\n AuthService,\n CacheService,\n LoggerService,\n} from '@backstage/backend-plugin-api';\nimport { Config, readDurationFromConfig } from '@backstage/config';\nimport { durationToMilliseconds } from '@backstage/types';\nimport {\n CATALOG_FILTER_EXISTS,\n CatalogClient,\n} from '@backstage/catalog-client';\nimport {\n Notification,\n notificationSeverities,\n NotificationSeverity,\n} from '@backstage/plugin-notifications-common';\nimport {\n createSendmailTransport,\n createSesTransport,\n createSmtpTransport,\n} from './transports';\nimport { UserEntity } from '@backstage/catalog-model';\nimport { compact } from 'lodash';\nimport { DefaultAwsCredentialsManager } from '@backstage/integration-aws-node';\nimport { NotificationTemplateRenderer } from '../extensions';\nimport Mail from 'nodemailer/lib/mailer';\nimport pThrottle from 'p-throttle';\n\nexport class NotificationsEmailProcessor implements NotificationProcessor {\n private transporter: any;\n private readonly broadcastConfig?: Config;\n private readonly transportConfig: Config;\n private readonly sender: string;\n private readonly replyTo?: string;\n private readonly cacheTtl: number;\n private readonly concurrencyLimit: number;\n private readonly throttleInterval: number;\n private readonly frontendBaseUrl: string;\n private readonly filter: NotificationProcessorFilters;\n\n constructor(\n private readonly logger: LoggerService,\n private readonly config: Config,\n private readonly catalog: CatalogClient,\n private readonly auth: AuthService,\n private readonly cache?: CacheService,\n private readonly templateRenderer?: NotificationTemplateRenderer,\n ) {\n const emailProcessorConfig = config.getConfig(\n 'notifications.processors.email',\n );\n this.transportConfig = emailProcessorConfig.getConfig('transportConfig');\n this.broadcastConfig =\n emailProcessorConfig.getOptionalConfig('broadcastConfig');\n this.sender = emailProcessorConfig.getString('sender');\n this.replyTo = emailProcessorConfig.getOptionalString('replyTo');\n this.concurrencyLimit =\n emailProcessorConfig.getOptionalNumber('concurrencyLimit') ?? 2;\n const throttleConfig =\n emailProcessorConfig.getOptionalConfig('throttleInterval');\n this.throttleInterval = throttleConfig\n ? durationToMilliseconds(readDurationFromConfig(throttleConfig))\n : 100;\n const cacheConfig = emailProcessorConfig.getOptionalConfig('cache.ttl');\n this.cacheTtl = cacheConfig\n ? durationToMilliseconds(readDurationFromConfig(cacheConfig))\n : 3_600_000;\n this.frontendBaseUrl = config.getString('app.baseUrl');\n this.filter = {};\n const minSeverity = emailProcessorConfig.getOptionalString(\n 'filter.minSeverity',\n ) as NotificationSeverity;\n if (minSeverity) {\n if (notificationSeverities.includes(minSeverity)) {\n this.filter.minSeverity = minSeverity;\n } else {\n throw new Error(`Invalid minSeverity: ${minSeverity}`);\n }\n }\n const maxSeverity = emailProcessorConfig.getOptionalString(\n 'filter.maxSeverity',\n ) as NotificationSeverity;\n if (maxSeverity) {\n if (notificationSeverities.includes(maxSeverity)) {\n this.filter.maxSeverity = maxSeverity;\n } else {\n throw new Error(`Invalid maxSeverity: ${maxSeverity}`);\n }\n }\n this.filter.excludedTopics = emailProcessorConfig.getOptionalStringArray(\n 'filter.excludedTopics',\n );\n }\n\n private async getTransporter() {\n if (this.transporter) {\n return this.transporter;\n }\n const transport = this.transportConfig.getString('transport');\n if (transport === 'smtp') {\n this.transporter = createSmtpTransport(this.transportConfig);\n } else if (transport === 'ses') {\n const awsCredentialsManager = DefaultAwsCredentialsManager.fromConfig(\n this.config,\n );\n this.transporter = await createSesTransport(\n this.transportConfig,\n awsCredentialsManager,\n );\n } else if (transport === 'sendmail') {\n this.transporter = createSendmailTransport(this.transportConfig);\n } else {\n throw new Error(`Unsupported transport: ${transport}`);\n }\n return this.transporter;\n }\n\n getName(): string {\n return 'Email';\n }\n\n private async getBroadcastEmails(): Promise<string[]> {\n if (!this.broadcastConfig) {\n return [];\n }\n\n const receiver = this.broadcastConfig.getString('receiver');\n if (receiver === 'none') {\n return [];\n }\n\n if (receiver === 'config') {\n return (\n this.broadcastConfig.getOptionalStringArray('receiverEmails') ?? []\n );\n }\n\n if (receiver === 'users') {\n const cached = await this.cache?.get<string[]>('user-emails:all');\n if (cached) {\n return cached;\n }\n\n const { token } = await this.auth.getPluginRequestToken({\n onBehalfOf: await this.auth.getOwnServiceCredentials(),\n targetPluginId: 'catalog',\n });\n const entities = await this.catalog.getEntities(\n {\n filter: [\n { kind: 'user', 'spec.profile.email': CATALOG_FILTER_EXISTS },\n ],\n fields: ['spec.profile.email'],\n },\n { token },\n );\n const ret = compact([\n ...new Set(\n entities.items.map(entity => {\n return (entity as UserEntity)?.spec.profile?.email;\n }),\n ),\n ]);\n\n await this.cache?.set('user-emails:all', ret, {\n ttl: this.cacheTtl,\n });\n return ret;\n }\n\n throw new Error(`Unsupported broadcast receiver: ${receiver}`);\n }\n\n private async getUserEmail(entityRef: string): Promise<string[]> {\n const cached = await this.cache?.get<string[]>(`user-emails:${entityRef}`);\n if (cached) {\n return cached;\n }\n\n const { token } = await this.auth.getPluginRequestToken({\n onBehalfOf: await this.auth.getOwnServiceCredentials(),\n targetPluginId: 'catalog',\n });\n const entity = await this.catalog.getEntityByRef(entityRef, { token });\n const ret: string[] = [];\n if (entity) {\n const userEntity = entity as UserEntity;\n if (userEntity.spec.profile?.email) {\n ret.push(userEntity.spec.profile.email);\n }\n }\n\n await this.cache?.set(`user-emails:${entityRef}`, ret, {\n ttl: this.cacheTtl,\n });\n\n return ret;\n }\n\n private async getRecipientEmails(\n notification: Notification,\n options: NotificationSendOptions,\n ) {\n if (options.recipients.type === 'broadcast' || notification.user === null) {\n return await this.getBroadcastEmails();\n }\n return await this.getUserEmail(notification.user);\n }\n\n private async sendMail(options: Mail.Options) {\n try {\n await this.transporter.sendMail(options);\n } catch (e) {\n this.logger.error(`Failed to send email to ${options.to}: ${e}`);\n }\n }\n\n private async sendMails(options: Mail.Options, emails: string[]) {\n const throttle = pThrottle({\n limit: this.concurrencyLimit,\n interval: this.throttleInterval,\n });\n\n const throttled = throttle((opts: Mail.Options) => this.sendMail(opts));\n await Promise.all(\n emails.map(email => throttled({ ...options, to: email })),\n );\n }\n\n private getNotificationLink(notification: Notification) {\n if (notification.payload.link) {\n const stripLeadingSlash = (s: string) => s.replace(/^\\//, '');\n const ensureTrailingSlash = (s: string) => s.replace(/\\/?$/, '/');\n\n try {\n const url = new URL(\n stripLeadingSlash(notification.payload.link),\n ensureTrailingSlash(this.frontendBaseUrl),\n );\n return url.toString();\n } catch (_e) {\n // noop: fallback to relative URL\n }\n return notification.payload.link;\n }\n return `${this.frontendBaseUrl}/notifications`;\n }\n\n private getHtmlContent(notification: Notification) {\n const contentParts: string[] = [];\n if (notification.payload.description) {\n contentParts.push(`${notification.payload.description}`);\n }\n const link = this.getNotificationLink(notification);\n contentParts.push(`<a href=\"${link}\">${link}</a>`);\n return `<p>${contentParts.join('<br/>')}</p>`;\n }\n\n private getTextContent(notification: Notification) {\n const contentParts: string[] = [];\n if (notification.payload.description) {\n contentParts.push(notification.payload.description);\n }\n contentParts.push(this.getNotificationLink(notification));\n return contentParts.join('\\n\\n');\n }\n\n private async sendPlainEmail(notification: Notification, emails: string[]) {\n const mailOptions = {\n from: this.sender,\n subject: notification.payload.title,\n html: this.getHtmlContent(notification),\n text: this.getTextContent(notification),\n replyTo: this.replyTo,\n };\n\n await this.sendMails(mailOptions, emails);\n }\n\n private async sendTemplateEmail(\n notification: Notification,\n emails: string[],\n ) {\n const mailOptions = {\n from: this.sender,\n subject:\n this.templateRenderer?.getSubject?.(notification) ??\n notification.payload.title,\n html: this.templateRenderer?.getHtml?.(notification),\n text: this.templateRenderer?.getText?.(notification),\n replyTo: this.replyTo,\n };\n\n await this.sendMails(mailOptions, emails);\n }\n\n async postProcess(\n notification: Notification,\n options: NotificationSendOptions,\n ): Promise<void> {\n this.transporter = await this.getTransporter();\n\n let emails: string[] = [];\n try {\n emails = await this.getRecipientEmails(notification, options);\n } catch (e) {\n this.logger.error(`Failed to resolve recipient emails: ${e}`);\n return;\n }\n\n if (emails.length === 0) {\n this.logger.info(\n `No email recipients found for notification: ${notification.id}, skipping`,\n );\n return;\n }\n\n if (!this.templateRenderer) {\n await this.sendPlainEmail(notification, emails);\n return;\n }\n\n await this.sendTemplateEmail(notification, emails);\n }\n\n getNotificationFilters(): NotificationProcessorFilters {\n return this.filter;\n }\n}\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createExtensionPoint } from '@backstage/backend-plugin-api';\nimport { Notification } from '@backstage/plugin-notifications-common';\n\n/**\n * @public\n */\nexport interface NotificationTemplateRenderer {\n getSubject?(notification: Notification): string;\n getText?(notification: Notification): string;\n getHtml?(notification: Notification): string;\n}\n\n/**\n * @public\n */\nexport interface NotificationsEmailTemplateExtensionPoint {\n setTemplateRenderer(renderer: NotificationTemplateRenderer): void;\n}\n\n/**\n * @public\n */\nexport const notificationsEmailTemplateExtensionPoint =\n createExtensionPoint<NotificationsEmailTemplateExtensionPoint>({\n id: 'notifications.email.templates',\n });\n","/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport { CatalogClient } from '@backstage/catalog-client';\nimport { notificationsProcessingExtensionPoint } from '@backstage/plugin-notifications-node';\nimport { NotificationsEmailProcessor } from './processor';\nimport {\n notificationsEmailTemplateExtensionPoint,\n NotificationTemplateRenderer,\n} from './extensions';\n\n/**\n * @public\n */\nexport const notificationsModuleEmail = createBackendModule({\n pluginId: 'notifications',\n moduleId: 'email',\n register(reg) {\n let templateRenderer: NotificationTemplateRenderer | undefined;\n reg.registerExtensionPoint(notificationsEmailTemplateExtensionPoint, {\n setTemplateRenderer(renderer) {\n if (templateRenderer) {\n throw new Error(`Email template renderer was already registered`);\n }\n templateRenderer = renderer;\n },\n });\n\n reg.registerInit({\n deps: {\n config: coreServices.rootConfig,\n notifications: notificationsProcessingExtensionPoint,\n discovery: coreServices.discovery,\n logger: coreServices.logger,\n auth: coreServices.auth,\n cache: coreServices.cache,\n },\n async init({ config, notifications, discovery, logger, auth, cache }) {\n const catalogClient = new CatalogClient({\n discoveryApi: discovery,\n });\n\n notifications.addProcessor(\n new NotificationsEmailProcessor(\n logger,\n config,\n catalogClient,\n auth,\n cache,\n templateRenderer,\n ),\n );\n },\n });\n },\n});\n"],"names":["createTransport","SES","SendRawEmailCommand","config","durationToMilliseconds","readDurationFromConfig","notificationSeverities","DefaultAwsCredentialsManager","CATALOG_FILTER_EXISTS","compact","pThrottle","createExtensionPoint","createBackendModule","coreServices","notificationsProcessingExtensionPoint","catalogClient","CatalogClient"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkBa,MAAA,mBAAA,GAAsB,CAAC,MAAmB,KAAA;AACrD,EAAM,MAAA,QAAA,GAAW,MAAO,CAAA,iBAAA,CAAkB,UAAU,CAAA,CAAA;AACpD,EAAM,MAAA,QAAA,GAAW,MAAO,CAAA,iBAAA,CAAkB,UAAU,CAAA,CAAA;AAEpD,EAAA,OAAOA,0BAAgB,CAAA;AAAA,IACrB,IAAA,EAAM,MAAO,CAAA,SAAA,CAAU,UAAU,CAAA;AAAA,IACjC,IAAA,EAAM,MAAO,CAAA,SAAA,CAAU,MAAM,CAAA;AAAA,IAC7B,MAAQ,EAAA,MAAA,CAAO,kBAAmB,CAAA,QAAQ,CAAK,IAAA,KAAA;AAAA,IAC/C,UAAY,EAAA,MAAA,CAAO,kBAAmB,CAAA,YAAY,CAAK,IAAA,KAAA;AAAA,IACvD,IAAA,EAAM,YAAY,QAAW,GAAA,EAAE,MAAM,QAAU,EAAA,IAAA,EAAM,UAAa,GAAA,KAAA,CAAA;AAAA,GACnE,CAAA,CAAA;AACH,CAAA;;ACTa,MAAA,kBAAA,GAAqB,OAChC,MAAA,EACA,kBACG,KAAA;AACH,EAAM,MAAA,WAAA,GAAc,MAAM,kBAAA,CAAmB,qBAAsB,CAAA;AAAA,IACjE,SAAA,EAAW,MAAO,CAAA,iBAAA,CAAkB,WAAW,CAAA;AAAA,GAChD,CAAA,CAAA;AACD,EAAM,MAAA,GAAA,GAAM,IAAIC,aAAI,CAAA;AAAA,IAClB;AAAA,MACE,UAAY,EAAA,MAAA,CAAO,iBAAkB,CAAA,YAAY,CAAK,IAAA,YAAA;AAAA,MACtD,aAAa,WAAY,CAAA,qBAAA;AAAA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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-notifications-backend-module-email",
3
- "version": "0.0.1",
3
+ "version": "0.1.0-next.1",
4
4
  "description": "The email backend module for the notifications plugin.",
5
5
  "backstage": {
6
6
  "role": "backend-plugin-module"
@@ -34,22 +34,22 @@
34
34
  "dependencies": {
35
35
  "@aws-sdk/client-ses": "^3.550.0",
36
36
  "@aws-sdk/types": "^3.347.0",
37
- "@backstage/backend-common": "^0.22.0",
38
- "@backstage/backend-plugin-api": "^0.6.18",
37
+ "@backstage/backend-common": "^0.23.0-next.1",
38
+ "@backstage/backend-plugin-api": "^0.6.19-next.1",
39
39
  "@backstage/catalog-client": "^1.6.5",
40
40
  "@backstage/catalog-model": "^1.5.0",
41
41
  "@backstage/config": "^1.2.0",
42
42
  "@backstage/integration-aws-node": "^0.1.12",
43
43
  "@backstage/plugin-notifications-common": "^0.0.3",
44
- "@backstage/plugin-notifications-node": "^0.1.4",
44
+ "@backstage/plugin-notifications-node": "^0.2.0-next.1",
45
45
  "@backstage/types": "^1.1.1",
46
46
  "lodash": "^4.17.21",
47
47
  "nodemailer": "^6.9.13",
48
48
  "p-throttle": "^4.1.1"
49
49
  },
50
50
  "devDependencies": {
51
- "@backstage/backend-test-utils": "^0.3.8",
52
- "@backstage/cli": "^0.26.5",
51
+ "@backstage/backend-test-utils": "^0.4.0-next.1",
52
+ "@backstage/cli": "^0.26.7-next.1",
53
53
  "@types/nodemailer": "^6.4.14"
54
54
  },
55
55
  "configSchema": "config.d.ts"