@backstage/plugin-notifications-backend-module-email 0.3.17-next.1 → 0.3.17
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.3.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a5d5b3a: SES config for the notification email processor now supports utilizing an ARN for the SES identity when sending an email after the SES SDK V2 update.
|
|
8
|
+
|
|
9
|
+
The `sesConfig.fromArn` will set the `fromEmailAddressIdentityArn` option for the SES `SendEmailCommand`. The `sesConfig.sourceArn` field is removed since no equivalent option is available in the send email command options. Setting `sesConfig.sourceArn` will have no effect and log a warning. Example changes:
|
|
10
|
+
|
|
11
|
+
```diff
|
|
12
|
+
notifications:
|
|
13
|
+
processors:
|
|
14
|
+
email:
|
|
15
|
+
transportConfig:
|
|
16
|
+
transport: "ses"
|
|
17
|
+
region: "us-west-2"
|
|
18
|
+
sender: "sender@mycompany.com"
|
|
19
|
+
replyTo: "no-reply@mycompany.com"
|
|
20
|
+
sesConfig:
|
|
21
|
+
- sourceArn: "arn:aws:ses:us-west-2:123456789012:identity/example.com"
|
|
22
|
+
fromArn: "arn:aws:ses:us-west-2:123456789012:identity/example.com"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- b267aea: Updated dependency `@types/nodemailer` to `^7.0.0`.
|
|
26
|
+
- Updated dependencies
|
|
27
|
+
- @backstage/backend-plugin-api@1.6.0
|
|
28
|
+
- @backstage/plugin-catalog-node@1.20.1
|
|
29
|
+
- @backstage/plugin-notifications-node@0.2.22
|
|
30
|
+
|
|
3
31
|
## 0.3.17-next.1
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -81,7 +81,6 @@ notifications:
|
|
|
81
81
|
receiver: 'users'
|
|
82
82
|
# Optional SES config
|
|
83
83
|
# sesConfig:
|
|
84
|
-
# sourceArn: 'arn:aws:ses:us-west-2:123456789012:identity/example.com'
|
|
85
84
|
# fromArn: 'arn:aws:ses:us-west-2:123456789012:identity/example.com'
|
|
86
85
|
# configurationSetName: 'custom-config'
|
|
87
86
|
# How many emails to send concurrently, defaults to 2
|
package/config.d.ts
CHANGED
|
@@ -136,10 +136,6 @@ export interface Config {
|
|
|
136
136
|
* Optional SES config for mail options. Allows for delegated sender
|
|
137
137
|
*/
|
|
138
138
|
sesConfig?: {
|
|
139
|
-
/**
|
|
140
|
-
* ARN of the identity to use as the source of the email
|
|
141
|
-
*/
|
|
142
|
-
sourceArn?: string;
|
|
143
139
|
/**
|
|
144
140
|
* ARN of the identity to use for the "From"/sender address of the email
|
|
145
141
|
*/
|
|
@@ -24,6 +24,7 @@ class NotificationsEmailProcessor {
|
|
|
24
24
|
sender;
|
|
25
25
|
replyTo;
|
|
26
26
|
sesConfig;
|
|
27
|
+
sesOptions;
|
|
27
28
|
cacheTtl;
|
|
28
29
|
concurrencyLimit;
|
|
29
30
|
throttleInterval;
|
|
@@ -52,6 +53,7 @@ class NotificationsEmailProcessor {
|
|
|
52
53
|
this.sender = emailProcessorConfig.getString("sender");
|
|
53
54
|
this.replyTo = emailProcessorConfig.getOptionalString("replyTo");
|
|
54
55
|
this.sesConfig = emailProcessorConfig.getOptionalConfig("sesConfig");
|
|
56
|
+
this.sesOptions = this.getSesOptions();
|
|
55
57
|
this.concurrencyLimit = emailProcessorConfig.getOptionalNumber("concurrencyLimit") ?? 2;
|
|
56
58
|
this.throttleInterval = emailProcessorConfig.has("throttleInterval") ? types.durationToMilliseconds(
|
|
57
59
|
config.readDurationFromConfig(emailProcessorConfig, {
|
|
@@ -233,19 +235,22 @@ class NotificationsEmailProcessor {
|
|
|
233
235
|
contentParts.push(this.getNotificationLink(notification));
|
|
234
236
|
return contentParts.join("\n\n");
|
|
235
237
|
}
|
|
236
|
-
|
|
238
|
+
getSesOptions() {
|
|
237
239
|
if (!this.sesConfig) {
|
|
238
240
|
return void 0;
|
|
239
241
|
}
|
|
240
242
|
const ses = {};
|
|
241
|
-
const sourceArn = this.sesConfig.getOptionalString("sourceArn");
|
|
242
243
|
const fromArn = this.sesConfig.getOptionalString("fromArn");
|
|
244
|
+
const sourceArn = this.sesConfig.getOptionalString("sourceArn");
|
|
243
245
|
const configurationSetName = this.sesConfig.getOptionalString(
|
|
244
246
|
"configurationSetName"
|
|
245
247
|
);
|
|
246
|
-
if (
|
|
247
|
-
if (fromArn) ses.FromArn = fromArn;
|
|
248
|
+
if (fromArn) ses.FromEmailAddressIdentityArn = fromArn;
|
|
248
249
|
if (configurationSetName) ses.ConfigurationSetName = configurationSetName;
|
|
250
|
+
if (sourceArn)
|
|
251
|
+
this.logger.warn(
|
|
252
|
+
"sourceArn is not supported in SESv2 and will be ignored"
|
|
253
|
+
);
|
|
249
254
|
return Object.keys(ses).length > 0 ? ses : void 0;
|
|
250
255
|
}
|
|
251
256
|
async sendPlainEmail(notification, emails) {
|
|
@@ -255,7 +260,7 @@ class NotificationsEmailProcessor {
|
|
|
255
260
|
html: this.getHtmlContent(notification),
|
|
256
261
|
text: this.getTextContent(notification),
|
|
257
262
|
replyTo: this.replyTo,
|
|
258
|
-
ses:
|
|
263
|
+
ses: this.sesOptions
|
|
259
264
|
};
|
|
260
265
|
await this.sendMails(mailOptions, emails);
|
|
261
266
|
}
|
|
@@ -266,7 +271,7 @@ class NotificationsEmailProcessor {
|
|
|
266
271
|
html: await this.templateRenderer?.getHtml?.(notification),
|
|
267
272
|
text: await this.templateRenderer?.getText?.(notification),
|
|
268
273
|
replyTo: this.replyTo,
|
|
269
|
-
ses:
|
|
274
|
+
ses: this.sesOptions
|
|
270
275
|
};
|
|
271
276
|
await this.sendMails(mailOptions, emails);
|
|
272
277
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationsEmailProcessor.cjs.js","sources":["../../src/processor/NotificationsEmailProcessor.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 */\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 { CATALOG_FILTER_EXISTS } from '@backstage/catalog-client';\nimport {\n getProcessorFiltersFromConfig,\n Notification,\n NotificationProcessorFilters,\n} from '@backstage/plugin-notifications-common';\nimport {\n createAzureTransport,\n createSendmailTransport,\n createSesTransport,\n createSmtpTransport,\n createStreamTransport,\n} from './transports';\nimport { UserEntity } from '@backstage/catalog-model';\nimport { CatalogService } from '@backstage/plugin-catalog-node';\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 sesConfig?: Config;\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 private readonly allowlistEmailAddresses?: string[];\n private readonly denylistEmailAddresses?: string[];\n\n private readonly logger: LoggerService;\n private readonly config: Config;\n private readonly catalog: CatalogService;\n private readonly auth: AuthService;\n private readonly cache?: CacheService;\n private readonly templateRenderer?: NotificationTemplateRenderer;\n\n constructor(\n logger: LoggerService,\n config: Config,\n catalog: CatalogService,\n auth: AuthService,\n cache?: CacheService,\n templateRenderer?: NotificationTemplateRenderer,\n ) {\n this.logger = logger;\n this.config = config;\n this.catalog = catalog;\n this.auth = auth;\n this.cache = cache;\n this.templateRenderer = templateRenderer;\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.sesConfig = emailProcessorConfig.getOptionalConfig('sesConfig');\n this.concurrencyLimit =\n emailProcessorConfig.getOptionalNumber('concurrencyLimit') ?? 2;\n this.throttleInterval = emailProcessorConfig.has('throttleInterval')\n ? durationToMilliseconds(\n readDurationFromConfig(emailProcessorConfig, {\n key: 'throttleInterval',\n }),\n )\n : 100;\n this.cacheTtl = emailProcessorConfig.has('cache.ttl')\n ? durationToMilliseconds(\n readDurationFromConfig(emailProcessorConfig, { key: 'cache.ttl' }),\n )\n : 3_600_000;\n this.frontendBaseUrl = config.getString('app.baseUrl');\n this.allowlistEmailAddresses = emailProcessorConfig.getOptionalStringArray(\n 'allowlistEmailAddresses',\n );\n this.denylistEmailAddresses = emailProcessorConfig.getOptionalStringArray(\n 'denylistEmailAddresses',\n );\n this.filter = getProcessorFiltersFromConfig(emailProcessorConfig);\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 if (transport === 'stream') {\n this.transporter = createStreamTransport();\n } else if (transport === 'azure') {\n this.transporter = createAzureTransport(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 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 { credentials: await this.auth.getOwnServiceCredentials() },\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 entity = await this.catalog.getEntityByRef(entityRef, {\n credentials: await this.auth.getOwnServiceCredentials(),\n });\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 ): Promise<string[]> {\n let emails: string[];\n if (options.recipients.type === 'broadcast') {\n emails = await this.getBroadcastEmails();\n } else if (options.recipients.type === 'entity' && !!notification.user) {\n emails = await this.getUserEmail(notification.user);\n } else {\n this.logger.info(\n `Unknown notification type ${options.recipients.type} or missing user.`,\n );\n return [];\n }\n\n if (this.allowlistEmailAddresses) {\n emails = emails.filter(email =>\n this.allowlistEmailAddresses?.includes(email),\n );\n }\n\n if (this.denylistEmailAddresses) {\n emails = emails.filter(\n email => !this.denylistEmailAddresses?.includes(email),\n );\n }\n return emails;\n }\n\n private async sendMail(options: Mail.Options) {\n try {\n this.logger.debug(`Sending notification email to ${options.to}`);\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 getSesOptions() {\n if (!this.sesConfig) {\n return undefined;\n }\n const ses: Record<string, string> = {};\n const sourceArn = this.sesConfig.getOptionalString('sourceArn');\n const fromArn = this.sesConfig.getOptionalString('fromArn');\n const configurationSetName = this.sesConfig.getOptionalString(\n 'configurationSetName',\n );\n\n if (sourceArn) ses.SourceArn = sourceArn;\n if (fromArn) ses.FromArn = fromArn;\n if (configurationSetName) ses.ConfigurationSetName = configurationSetName;\n\n return Object.keys(ses).length > 0 ? ses : undefined;\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 ses: await this.getSesOptions(),\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 (await this.templateRenderer?.getSubject?.(notification)) ??\n notification.payload.title,\n html: await this.templateRenderer?.getHtml?.(notification),\n text: await this.templateRenderer?.getText?.(notification),\n replyTo: this.replyTo,\n ses: await this.getSesOptions(),\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 this.logger.debug(`Sending notification emails to: ${emails.join(',')}`);\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"],"names":["config","durationToMilliseconds","readDurationFromConfig","getProcessorFiltersFromConfig","createSmtpTransport","DefaultAwsCredentialsManager","createSesTransport","createSendmailTransport","createStreamTransport","createAzureTransport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AAA,GAAuD;AACrD,IAAA,OAAO,IAAA,CAAK,MAAA;AAAA,EACd;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"NotificationsEmailProcessor.cjs.js","sources":["../../src/processor/NotificationsEmailProcessor.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 */\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 { CATALOG_FILTER_EXISTS } from '@backstage/catalog-client';\nimport {\n getProcessorFiltersFromConfig,\n Notification,\n NotificationProcessorFilters,\n} from '@backstage/plugin-notifications-common';\nimport {\n createAzureTransport,\n createSendmailTransport,\n createSesTransport,\n createSmtpTransport,\n createStreamTransport,\n} from './transports';\nimport { UserEntity } from '@backstage/catalog-model';\nimport { CatalogService } from '@backstage/plugin-catalog-node';\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';\nimport { SendEmailCommandInput } from '@aws-sdk/client-sesv2';\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 sesConfig?: Config;\n private readonly sesOptions?: Partial<SendEmailCommandInput>;\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 private readonly allowlistEmailAddresses?: string[];\n private readonly denylistEmailAddresses?: string[];\n\n private readonly logger: LoggerService;\n private readonly config: Config;\n private readonly catalog: CatalogService;\n private readonly auth: AuthService;\n private readonly cache?: CacheService;\n private readonly templateRenderer?: NotificationTemplateRenderer;\n\n constructor(\n logger: LoggerService,\n config: Config,\n catalog: CatalogService,\n auth: AuthService,\n cache?: CacheService,\n templateRenderer?: NotificationTemplateRenderer,\n ) {\n this.logger = logger;\n this.config = config;\n this.catalog = catalog;\n this.auth = auth;\n this.cache = cache;\n this.templateRenderer = templateRenderer;\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.sesConfig = emailProcessorConfig.getOptionalConfig('sesConfig');\n this.sesOptions = this.getSesOptions();\n this.concurrencyLimit =\n emailProcessorConfig.getOptionalNumber('concurrencyLimit') ?? 2;\n this.throttleInterval = emailProcessorConfig.has('throttleInterval')\n ? durationToMilliseconds(\n readDurationFromConfig(emailProcessorConfig, {\n key: 'throttleInterval',\n }),\n )\n : 100;\n this.cacheTtl = emailProcessorConfig.has('cache.ttl')\n ? durationToMilliseconds(\n readDurationFromConfig(emailProcessorConfig, { key: 'cache.ttl' }),\n )\n : 3_600_000;\n this.frontendBaseUrl = config.getString('app.baseUrl');\n this.allowlistEmailAddresses = emailProcessorConfig.getOptionalStringArray(\n 'allowlistEmailAddresses',\n );\n this.denylistEmailAddresses = emailProcessorConfig.getOptionalStringArray(\n 'denylistEmailAddresses',\n );\n this.filter = getProcessorFiltersFromConfig(emailProcessorConfig);\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 if (transport === 'stream') {\n this.transporter = createStreamTransport();\n } else if (transport === 'azure') {\n this.transporter = createAzureTransport(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 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 { credentials: await this.auth.getOwnServiceCredentials() },\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 entity = await this.catalog.getEntityByRef(entityRef, {\n credentials: await this.auth.getOwnServiceCredentials(),\n });\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 ): Promise<string[]> {\n let emails: string[];\n if (options.recipients.type === 'broadcast') {\n emails = await this.getBroadcastEmails();\n } else if (options.recipients.type === 'entity' && !!notification.user) {\n emails = await this.getUserEmail(notification.user);\n } else {\n this.logger.info(\n `Unknown notification type ${options.recipients.type} or missing user.`,\n );\n return [];\n }\n\n if (this.allowlistEmailAddresses) {\n emails = emails.filter(email =>\n this.allowlistEmailAddresses?.includes(email),\n );\n }\n\n if (this.denylistEmailAddresses) {\n emails = emails.filter(\n email => !this.denylistEmailAddresses?.includes(email),\n );\n }\n return emails;\n }\n\n private async sendMail(options: Mail.Options) {\n try {\n this.logger.debug(`Sending notification email to ${options.to}`);\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 getSesOptions(): Partial<SendEmailCommandInput> | undefined {\n if (!this.sesConfig) {\n return undefined;\n }\n const ses: Partial<SendEmailCommandInput> = {};\n const fromArn = this.sesConfig.getOptionalString('fromArn');\n const sourceArn = this.sesConfig.getOptionalString('sourceArn');\n const configurationSetName = this.sesConfig.getOptionalString(\n 'configurationSetName',\n );\n\n if (fromArn) ses.FromEmailAddressIdentityArn = fromArn;\n if (configurationSetName) ses.ConfigurationSetName = configurationSetName;\n if (sourceArn)\n this.logger.warn(\n 'sourceArn is not supported in SESv2 and will be ignored',\n );\n\n return Object.keys(ses).length > 0 ? ses : undefined;\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 ses: this.sesOptions,\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 (await this.templateRenderer?.getSubject?.(notification)) ??\n notification.payload.title,\n html: await this.templateRenderer?.getHtml?.(notification),\n text: await this.templateRenderer?.getText?.(notification),\n replyTo: this.replyTo,\n ses: this.sesOptions,\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 this.logger.debug(`Sending notification emails to: ${emails.join(',')}`);\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"],"names":["config","durationToMilliseconds","readDurationFromConfig","getProcessorFiltersFromConfig","createSmtpTransport","DefaultAwsCredentialsManager","createSesTransport","createSendmailTransport","createStreamTransport","createAzureTransport","CATALOG_FILTER_EXISTS","compact","pThrottle"],"mappings":";;;;;;;;;;;;;;;;;;;AAiDO,MAAM,2BAAA,CAA6D;AAAA,EAChE,WAAA;AAAA,EACS,eAAA;AAAA,EACA,eAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AAAA,EACA,QAAA;AAAA,EACA,gBAAA;AAAA,EACA,gBAAA;AAAA,EACA,eAAA;AAAA,EACA,MAAA;AAAA,EACA,uBAAA;AAAA,EACA,sBAAA;AAAA,EAEA,MAAA;AAAA,EACA,MAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA;AAAA,EACA,gBAAA;AAAA,EAEjB,YACE,MAAA,EACAA,QAAA,EACA,OAAA,EACA,IAAA,EACA,OACA,gBAAA,EACA;AACA,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AACd,IAAA,IAAA,CAAK,MAAA,GAASA,QAAA;AACd,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AACf,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AACZ,IAAA,IAAA,CAAK,KAAA,GAAQ,KAAA;AACb,IAAA,IAAA,CAAK,gBAAA,GAAmB,gBAAA;AACxB,IAAA,MAAM,uBAAuBA,QAAA,CAAO,SAAA;AAAA,MAClC;AAAA,KACF;AACA,IAAA,IAAA,CAAK,eAAA,GAAkB,oBAAA,CAAqB,SAAA,CAAU,iBAAiB,CAAA;AACvE,IAAA,IAAA,CA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AChE;AACA,MAAA;AAAA,IACF;AAEA,IAAA,IAAA,CAAK,OAAO,KAAA,CAAM,CAAA,gCAAA,EAAmC,OAAO,IAAA,CAAK,GAAG,CAAC,CAAA,CAAE,CAAA;AAEvE,IAAA,IAAI,CAAC,KAAK,gBAAA,EAAkB;AAC1B,MAAA,MAAM,IAAA,CAAK,cAAA,CAAe,YAAA,EAAc,MAAM,CAAA;AAC9C,MAAA;AAAA,IACF;AAEA,IAAA,MAAM,IAAA,CAAK,iBAAA,CAAkB,YAAA,EAAc,MAAM,CAAA;AAAA,EACnD;AAAA,EAEA,sBAAA,GAAuD;AACrD,IAAA,OAAO,IAAA,CAAK,MAAA;AAAA,EACd;AACF;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-notifications-backend-module-email",
|
|
3
|
-
"version": "0.3.17
|
|
3
|
+
"version": "0.3.17",
|
|
4
4
|
"description": "The email backend module for the notifications plugin.",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin-module",
|
|
@@ -40,22 +40,22 @@
|
|
|
40
40
|
"@aws-sdk/client-sesv2": "^3.911.0",
|
|
41
41
|
"@azure/communication-email": "^1.0.0",
|
|
42
42
|
"@azure/identity": "^4.0.0",
|
|
43
|
-
"@backstage/backend-plugin-api": "1.6.0
|
|
44
|
-
"@backstage/catalog-client": "1.12.1",
|
|
45
|
-
"@backstage/catalog-model": "1.7.6",
|
|
46
|
-
"@backstage/config": "1.3.6",
|
|
47
|
-
"@backstage/integration-aws-node": "0.1.19",
|
|
48
|
-
"@backstage/plugin-catalog-node": "1.20.1
|
|
49
|
-
"@backstage/plugin-notifications-common": "0.2.0",
|
|
50
|
-
"@backstage/plugin-notifications-node": "0.2.22
|
|
51
|
-
"@backstage/types": "1.2.2",
|
|
43
|
+
"@backstage/backend-plugin-api": "^1.6.0",
|
|
44
|
+
"@backstage/catalog-client": "^1.12.1",
|
|
45
|
+
"@backstage/catalog-model": "^1.7.6",
|
|
46
|
+
"@backstage/config": "^1.3.6",
|
|
47
|
+
"@backstage/integration-aws-node": "^0.1.19",
|
|
48
|
+
"@backstage/plugin-catalog-node": "^1.20.1",
|
|
49
|
+
"@backstage/plugin-notifications-common": "^0.2.0",
|
|
50
|
+
"@backstage/plugin-notifications-node": "^0.2.22",
|
|
51
|
+
"@backstage/types": "^1.2.2",
|
|
52
52
|
"lodash": "^4.17.21",
|
|
53
53
|
"nodemailer": "^7.0.7",
|
|
54
54
|
"p-throttle": "^4.1.1"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@backstage/backend-test-utils": "1.10.2
|
|
58
|
-
"@backstage/cli": "0.35.0
|
|
57
|
+
"@backstage/backend-test-utils": "^1.10.2",
|
|
58
|
+
"@backstage/cli": "^0.35.0",
|
|
59
59
|
"@types/nodemailer": "^7.0.0"
|
|
60
60
|
},
|
|
61
61
|
"configSchema": "config.d.ts",
|