@backstage/plugin-notifications-backend 0.4.1-next.0 → 0.4.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.
@@ -0,0 +1,374 @@
1
+ 'use strict';
2
+
3
+ var backendCommon = require('@backstage/backend-common');
4
+ var express = require('express');
5
+ var Router = require('express-promise-router');
6
+ var DatabaseNotificationsStore = require('../database/DatabaseNotificationsStore.cjs.js');
7
+ var uuid = require('uuid');
8
+ var errors = require('@backstage/errors');
9
+ var pluginNotificationsCommon = require('@backstage/plugin-notifications-common');
10
+ var parseEntityOrderFieldParams = require('./parseEntityOrderFieldParams.cjs.js');
11
+ var getUsersForEntityRef = require('./getUsersForEntityRef.cjs.js');
12
+
13
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
14
+
15
+ var express__default = /*#__PURE__*/_interopDefaultCompat(express);
16
+ var Router__default = /*#__PURE__*/_interopDefaultCompat(Router);
17
+
18
+ async function createRouter(options) {
19
+ const {
20
+ config,
21
+ logger,
22
+ database,
23
+ auth,
24
+ httpAuth,
25
+ userInfo,
26
+ catalog,
27
+ processors = [],
28
+ signals
29
+ } = options;
30
+ const store = await DatabaseNotificationsStore.DatabaseNotificationsStore.create({ database });
31
+ const frontendBaseUrl = config.getString("app.baseUrl");
32
+ const getUser = async (req) => {
33
+ const credentials = await httpAuth.credentials(req, { allow: ["user"] });
34
+ const info = await userInfo.getUserInfo(credentials);
35
+ return info.userEntityRef;
36
+ };
37
+ const filterProcessors = (payload) => {
38
+ const result = [];
39
+ for (const processor of processors) {
40
+ if (processor.getNotificationFilters) {
41
+ const filters = processor.getNotificationFilters();
42
+ if (filters.minSeverity) {
43
+ if (pluginNotificationsCommon.notificationSeverities.indexOf(payload.severity ?? "normal") > pluginNotificationsCommon.notificationSeverities.indexOf(filters.minSeverity)) {
44
+ continue;
45
+ }
46
+ }
47
+ if (filters.maxSeverity) {
48
+ if (pluginNotificationsCommon.notificationSeverities.indexOf(payload.severity ?? "normal") < pluginNotificationsCommon.notificationSeverities.indexOf(filters.maxSeverity)) {
49
+ continue;
50
+ }
51
+ }
52
+ if (filters.excludedTopics && payload.topic) {
53
+ if (filters.excludedTopics.includes(payload.topic)) {
54
+ continue;
55
+ }
56
+ }
57
+ }
58
+ result.push(processor);
59
+ }
60
+ return result;
61
+ };
62
+ const processOptions = async (opts) => {
63
+ const filtered = filterProcessors(opts.payload);
64
+ let ret = opts;
65
+ for (const processor of filtered) {
66
+ try {
67
+ ret = processor.processOptions ? await processor.processOptions(ret) : ret;
68
+ } catch (e) {
69
+ logger.error(
70
+ `Error while processing notification options with ${processor.getName()}: ${e}`
71
+ );
72
+ }
73
+ }
74
+ return ret;
75
+ };
76
+ const preProcessNotification = async (notification, opts) => {
77
+ const filtered = filterProcessors(notification.payload);
78
+ let ret = notification;
79
+ for (const processor of filtered) {
80
+ try {
81
+ ret = processor.preProcess ? await processor.preProcess(ret, opts) : ret;
82
+ } catch (e) {
83
+ logger.error(
84
+ `Error while pre processing notification with ${processor.getName()}: ${e}`
85
+ );
86
+ }
87
+ }
88
+ return ret;
89
+ };
90
+ const postProcessNotification = async (notification, opts) => {
91
+ const filtered = filterProcessors(notification.payload);
92
+ for (const processor of filtered) {
93
+ if (processor.postProcess) {
94
+ try {
95
+ await processor.postProcess(notification, opts);
96
+ } catch (e) {
97
+ logger.error(
98
+ `Error while post processing notification with ${processor.getName()}: ${e}`
99
+ );
100
+ }
101
+ }
102
+ }
103
+ };
104
+ const validateLink = (link) => {
105
+ const stripLeadingSlash = (s) => s.replace(/^\//, "");
106
+ const ensureTrailingSlash = (s) => s.replace(/\/?$/, "/");
107
+ const url = new URL(
108
+ stripLeadingSlash(link),
109
+ ensureTrailingSlash(frontendBaseUrl)
110
+ );
111
+ if (url.protocol !== "https:" && url.protocol !== "http:") {
112
+ throw new Error("Only HTTP/HTTPS links are allowed");
113
+ }
114
+ };
115
+ const router = Router__default.default();
116
+ router.use(express__default.default.json());
117
+ router.get("/health", (_, response) => {
118
+ logger.info("PONG!");
119
+ response.json({ status: "ok" });
120
+ });
121
+ router.get("/", async (req, res) => {
122
+ const user = await getUser(req);
123
+ const opts = {
124
+ user
125
+ };
126
+ if (req.query.offset) {
127
+ opts.offset = Number.parseInt(req.query.offset.toString(), 10);
128
+ }
129
+ if (req.query.limit) {
130
+ opts.limit = Number.parseInt(req.query.limit.toString(), 10);
131
+ }
132
+ if (req.query.orderField) {
133
+ opts.orderField = parseEntityOrderFieldParams.parseEntityOrderFieldParams(req.query);
134
+ }
135
+ if (req.query.search) {
136
+ opts.search = req.query.search.toString();
137
+ }
138
+ if (req.query.read === "true") {
139
+ opts.read = true;
140
+ } else if (req.query.read === "false") {
141
+ opts.read = false;
142
+ }
143
+ if (req.query.topic) {
144
+ opts.topic = req.query.topic.toString();
145
+ }
146
+ if (req.query.saved === "true") {
147
+ opts.saved = true;
148
+ } else if (req.query.saved === "false") {
149
+ opts.saved = false;
150
+ }
151
+ if (req.query.createdAfter) {
152
+ const sinceEpoch = Date.parse(String(req.query.createdAfter));
153
+ if (isNaN(sinceEpoch)) {
154
+ throw new errors.InputError("Unexpected date format");
155
+ }
156
+ opts.createdAfter = new Date(sinceEpoch);
157
+ }
158
+ if (req.query.minimumSeverity) {
159
+ opts.minimumSeverity = DatabaseNotificationsStore.normalizeSeverity(
160
+ req.query.minimumSeverity.toString()
161
+ );
162
+ }
163
+ const [notifications, totalCount] = await Promise.all([
164
+ store.getNotifications(opts),
165
+ store.getNotificationsCount(opts)
166
+ ]);
167
+ res.json({
168
+ totalCount,
169
+ notifications
170
+ });
171
+ });
172
+ router.get("/status", async (req, res) => {
173
+ const user = await getUser(req);
174
+ const status = await store.getStatus({ user });
175
+ res.json(status);
176
+ });
177
+ router.get("/:id", async (req, res) => {
178
+ const user = await getUser(req);
179
+ const opts = {
180
+ user,
181
+ limit: 1,
182
+ ids: [req.params.id]
183
+ };
184
+ const notifications = await store.getNotifications(opts);
185
+ if (notifications.length !== 1) {
186
+ throw new errors.NotFoundError("Not found");
187
+ }
188
+ res.json(notifications[0]);
189
+ });
190
+ router.post("/update", async (req, res) => {
191
+ const user = await getUser(req);
192
+ const { ids, read, saved } = req.body;
193
+ if (!ids || !Array.isArray(ids)) {
194
+ throw new errors.InputError();
195
+ }
196
+ if (read === true) {
197
+ await store.markRead({ user, ids });
198
+ if (signals) {
199
+ await signals.publish({
200
+ recipients: { type: "user", entityRef: [user] },
201
+ message: { action: "notification_read", notification_ids: ids },
202
+ channel: "notifications"
203
+ });
204
+ }
205
+ } else if (read === false) {
206
+ await store.markUnread({ user, ids });
207
+ if (signals) {
208
+ await signals.publish({
209
+ recipients: { type: "user", entityRef: [user] },
210
+ message: { action: "notification_unread", notification_ids: ids },
211
+ channel: "notifications"
212
+ });
213
+ }
214
+ }
215
+ if (saved === true) {
216
+ await store.markSaved({ user, ids });
217
+ } else if (saved === false) {
218
+ await store.markUnsaved({ user, ids });
219
+ }
220
+ const notifications = await store.getNotifications({ ids, user });
221
+ res.json(notifications);
222
+ });
223
+ const sendBroadcastNotification = async (baseNotification, opts, origin) => {
224
+ const { scope } = opts.payload;
225
+ const broadcastNotification = {
226
+ ...baseNotification,
227
+ user: null,
228
+ id: uuid.v4()
229
+ };
230
+ const notification = await preProcessNotification(
231
+ broadcastNotification,
232
+ opts
233
+ );
234
+ let existingNotification;
235
+ if (scope) {
236
+ existingNotification = await store.getExistingScopeBroadcast({
237
+ scope,
238
+ origin
239
+ });
240
+ }
241
+ let ret = notification;
242
+ if (existingNotification) {
243
+ const restored = await store.restoreExistingNotification({
244
+ id: existingNotification.id,
245
+ notification: { ...notification, user: "" }
246
+ });
247
+ ret = restored ?? notification;
248
+ } else {
249
+ await store.saveBroadcast(notification);
250
+ }
251
+ if (signals) {
252
+ await signals.publish({
253
+ recipients: { type: "broadcast" },
254
+ message: {
255
+ action: "new_notification",
256
+ notification_id: ret.id
257
+ },
258
+ channel: "notifications"
259
+ });
260
+ postProcessNotification(ret, opts);
261
+ }
262
+ return notification;
263
+ };
264
+ const sendUserNotifications = async (baseNotification, users, opts, origin) => {
265
+ const notifications = [];
266
+ const { scope } = opts.payload;
267
+ const uniqueUsers = [...new Set(users)];
268
+ for (const user of uniqueUsers) {
269
+ const userNotification = {
270
+ ...baseNotification,
271
+ id: uuid.v4(),
272
+ user
273
+ };
274
+ const notification = await preProcessNotification(userNotification, opts);
275
+ let existingNotification;
276
+ if (scope) {
277
+ existingNotification = await store.getExistingScopeNotification({
278
+ user,
279
+ scope,
280
+ origin
281
+ });
282
+ }
283
+ let ret = notification;
284
+ if (existingNotification) {
285
+ const restored = await store.restoreExistingNotification({
286
+ id: existingNotification.id,
287
+ notification
288
+ });
289
+ ret = restored ?? notification;
290
+ } else {
291
+ await store.saveNotification(notification);
292
+ }
293
+ notifications.push(ret);
294
+ if (signals) {
295
+ await signals.publish({
296
+ recipients: { type: "user", entityRef: [user] },
297
+ message: {
298
+ action: "new_notification",
299
+ notification_id: ret.id
300
+ },
301
+ channel: "notifications"
302
+ });
303
+ }
304
+ postProcessNotification(ret, opts);
305
+ }
306
+ return notifications;
307
+ };
308
+ router.post(
309
+ "/",
310
+ async (req, res) => {
311
+ const opts = await processOptions(req.body);
312
+ const { recipients, payload } = opts;
313
+ const notifications = [];
314
+ let users = [];
315
+ const credentials = await httpAuth.credentials(req, {
316
+ allow: ["service"]
317
+ });
318
+ const { title, link } = payload;
319
+ if (!recipients || !title) {
320
+ logger.error(`Invalid notification request received`);
321
+ throw new errors.InputError(`Invalid notification request received`);
322
+ }
323
+ if (link) {
324
+ try {
325
+ validateLink(link);
326
+ } catch (e) {
327
+ throw new errors.InputError("Invalid link provided", e);
328
+ }
329
+ }
330
+ const origin = credentials.principal.subject;
331
+ const baseNotification = {
332
+ payload: {
333
+ ...payload,
334
+ severity: payload.severity ?? "normal"
335
+ },
336
+ origin,
337
+ created: /* @__PURE__ */ new Date()
338
+ };
339
+ if (recipients.type === "broadcast") {
340
+ const broadcast = await sendBroadcastNotification(
341
+ baseNotification,
342
+ opts,
343
+ origin
344
+ );
345
+ notifications.push(broadcast);
346
+ } else {
347
+ const entityRef = recipients.entityRef;
348
+ try {
349
+ users = await getUsersForEntityRef.getUsersForEntityRef(
350
+ entityRef,
351
+ recipients.excludeEntityRef ?? [],
352
+ { auth, catalogClient: catalog }
353
+ );
354
+ } catch (e) {
355
+ logger.error(`Failed to resolve notification receivers: ${e}`);
356
+ throw new errors.InputError("Failed to resolve notification receivers", e);
357
+ }
358
+ const userNotifications = await sendUserNotifications(
359
+ baseNotification,
360
+ users,
361
+ opts,
362
+ origin
363
+ );
364
+ notifications.push(...userNotifications);
365
+ }
366
+ res.json(notifications);
367
+ }
368
+ );
369
+ router.use(backendCommon.errorHandler());
370
+ return router;
371
+ }
372
+
373
+ exports.createRouter = createRouter;
374
+ //# sourceMappingURL=router.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.cjs.js","sources":["../../src/service/router.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { errorHandler, PluginDatabaseManager } from '@backstage/backend-common';\nimport express, { Request } from 'express';\nimport Router from 'express-promise-router';\nimport {\n DatabaseNotificationsStore,\n normalizeSeverity,\n NotificationGetOptions,\n} from '../database';\nimport { v4 as uuid } from 'uuid';\nimport { CatalogApi } from '@backstage/catalog-client';\nimport {\n NotificationProcessor,\n NotificationSendOptions,\n} from '@backstage/plugin-notifications-node';\nimport { InputError, NotFoundError } from '@backstage/errors';\nimport {\n AuthService,\n HttpAuthService,\n LoggerService,\n UserInfoService,\n} from '@backstage/backend-plugin-api';\nimport { SignalsService } from '@backstage/plugin-signals-node';\nimport {\n NewNotificationSignal,\n Notification,\n NotificationPayload,\n NotificationReadSignal,\n notificationSeverities,\n NotificationStatus,\n} from '@backstage/plugin-notifications-common';\nimport { parseEntityOrderFieldParams } from './parseEntityOrderFieldParams';\nimport { getUsersForEntityRef } from './getUsersForEntityRef';\nimport { Config } from '@backstage/config';\n\n/** @internal */\nexport interface RouterOptions {\n logger: LoggerService;\n config: Config;\n database: PluginDatabaseManager;\n auth: AuthService;\n httpAuth: HttpAuthService;\n userInfo: UserInfoService;\n signals?: SignalsService;\n catalog: CatalogApi;\n processors?: NotificationProcessor[];\n}\n\n/** @internal */\nexport async function createRouter(\n options: RouterOptions,\n): Promise<express.Router> {\n const {\n config,\n logger,\n database,\n auth,\n httpAuth,\n userInfo,\n catalog,\n processors = [],\n signals,\n } = options;\n\n const store = await DatabaseNotificationsStore.create({ database });\n const frontendBaseUrl = config.getString('app.baseUrl');\n\n const getUser = async (req: Request<unknown>) => {\n const credentials = await httpAuth.credentials(req, { allow: ['user'] });\n const info = await userInfo.getUserInfo(credentials);\n return info.userEntityRef;\n };\n\n const filterProcessors = (payload: NotificationPayload) => {\n const result: NotificationProcessor[] = [];\n\n for (const processor of processors) {\n if (processor.getNotificationFilters) {\n const filters = processor.getNotificationFilters();\n if (filters.minSeverity) {\n if (\n notificationSeverities.indexOf(payload.severity ?? 'normal') >\n notificationSeverities.indexOf(filters.minSeverity)\n ) {\n continue;\n }\n }\n\n if (filters.maxSeverity) {\n if (\n notificationSeverities.indexOf(payload.severity ?? 'normal') <\n notificationSeverities.indexOf(filters.maxSeverity)\n ) {\n continue;\n }\n }\n\n if (filters.excludedTopics && payload.topic) {\n if (filters.excludedTopics.includes(payload.topic)) {\n continue;\n }\n }\n }\n result.push(processor);\n }\n\n return result;\n };\n\n const processOptions = async (opts: NotificationSendOptions) => {\n const filtered = filterProcessors(opts.payload);\n let ret = opts;\n for (const processor of filtered) {\n try {\n ret = processor.processOptions\n ? await processor.processOptions(ret)\n : ret;\n } catch (e) {\n logger.error(\n `Error while processing notification options with ${processor.getName()}: ${e}`,\n );\n }\n }\n return ret;\n };\n\n const preProcessNotification = async (\n notification: Notification,\n opts: NotificationSendOptions,\n ) => {\n const filtered = filterProcessors(notification.payload);\n let ret = notification;\n for (const processor of filtered) {\n try {\n ret = processor.preProcess\n ? await processor.preProcess(ret, opts)\n : ret;\n } catch (e) {\n logger.error(\n `Error while pre processing notification with ${processor.getName()}: ${e}`,\n );\n }\n }\n return ret;\n };\n\n const postProcessNotification = async (\n notification: Notification,\n opts: NotificationSendOptions,\n ) => {\n const filtered = filterProcessors(notification.payload);\n for (const processor of filtered) {\n if (processor.postProcess) {\n try {\n await processor.postProcess(notification, opts);\n } catch (e) {\n logger.error(\n `Error while post processing notification with ${processor.getName()}: ${e}`,\n );\n }\n }\n }\n };\n\n const validateLink = (link: string) => {\n const stripLeadingSlash = (s: string) => s.replace(/^\\//, '');\n const ensureTrailingSlash = (s: string) => s.replace(/\\/?$/, '/');\n const url = new URL(\n stripLeadingSlash(link),\n ensureTrailingSlash(frontendBaseUrl),\n );\n if (url.protocol !== 'https:' && url.protocol !== 'http:') {\n throw new Error('Only HTTP/HTTPS links are allowed');\n }\n };\n\n // TODO: Move to use OpenAPI router instead\n const router = Router();\n router.use(express.json());\n\n router.get('/health', (_, response) => {\n logger.info('PONG!');\n response.json({ status: 'ok' });\n });\n\n router.get('/', async (req, res) => {\n const user = await getUser(req);\n const opts: NotificationGetOptions = {\n user: user,\n };\n if (req.query.offset) {\n opts.offset = Number.parseInt(req.query.offset.toString(), 10);\n }\n if (req.query.limit) {\n opts.limit = Number.parseInt(req.query.limit.toString(), 10);\n }\n if (req.query.orderField) {\n opts.orderField = parseEntityOrderFieldParams(req.query);\n }\n if (req.query.search) {\n opts.search = req.query.search.toString();\n }\n if (req.query.read === 'true') {\n opts.read = true;\n } else if (req.query.read === 'false') {\n opts.read = false;\n // or keep undefined\n }\n\n if (req.query.topic) {\n opts.topic = req.query.topic.toString();\n }\n\n if (req.query.saved === 'true') {\n opts.saved = true;\n } else if (req.query.saved === 'false') {\n opts.saved = false;\n // or keep undefined\n }\n if (req.query.createdAfter) {\n const sinceEpoch = Date.parse(String(req.query.createdAfter));\n if (isNaN(sinceEpoch)) {\n throw new InputError('Unexpected date format');\n }\n opts.createdAfter = new Date(sinceEpoch);\n }\n if (req.query.minimumSeverity) {\n opts.minimumSeverity = normalizeSeverity(\n req.query.minimumSeverity.toString(),\n );\n }\n\n const [notifications, totalCount] = await Promise.all([\n store.getNotifications(opts),\n store.getNotificationsCount(opts),\n ]);\n res.json({\n totalCount,\n notifications,\n });\n });\n\n router.get('/status', async (req: Request<any, NotificationStatus>, res) => {\n const user = await getUser(req);\n const status = await store.getStatus({ user });\n res.json(status);\n });\n\n // Make sure this is the last \"GET\" handler\n router.get('/:id', async (req, res) => {\n const user = await getUser(req);\n const opts: NotificationGetOptions = {\n user: user,\n limit: 1,\n ids: [req.params.id],\n };\n const notifications = await store.getNotifications(opts);\n if (notifications.length !== 1) {\n throw new NotFoundError('Not found');\n }\n res.json(notifications[0]);\n });\n\n router.post('/update', async (req, res) => {\n const user = await getUser(req);\n const { ids, read, saved } = req.body;\n if (!ids || !Array.isArray(ids)) {\n throw new InputError();\n }\n\n if (read === true) {\n await store.markRead({ user, ids });\n\n if (signals) {\n await signals.publish<NotificationReadSignal>({\n recipients: { type: 'user', entityRef: [user] },\n message: { action: 'notification_read', notification_ids: ids },\n channel: 'notifications',\n });\n }\n } else if (read === false) {\n await store.markUnread({ user: user, ids });\n\n if (signals) {\n await signals.publish<NotificationReadSignal>({\n recipients: { type: 'user', entityRef: [user] },\n message: { action: 'notification_unread', notification_ids: ids },\n channel: 'notifications',\n });\n }\n }\n\n if (saved === true) {\n await store.markSaved({ user: user, ids });\n } else if (saved === false) {\n await store.markUnsaved({ user: user, ids });\n }\n\n const notifications = await store.getNotifications({ ids, user: user });\n res.json(notifications);\n });\n\n const sendBroadcastNotification = async (\n baseNotification: Omit<Notification, 'user' | 'id'>,\n opts: NotificationSendOptions,\n origin: string,\n ) => {\n const { scope } = opts.payload;\n const broadcastNotification = {\n ...baseNotification,\n user: null,\n id: uuid(),\n };\n const notification = await preProcessNotification(\n broadcastNotification,\n opts,\n );\n let existingNotification;\n if (scope) {\n existingNotification = await store.getExistingScopeBroadcast({\n scope,\n origin,\n });\n }\n\n let ret = notification;\n if (existingNotification) {\n const restored = await store.restoreExistingNotification({\n id: existingNotification.id,\n notification: { ...notification, user: '' },\n });\n ret = restored ?? notification;\n } else {\n await store.saveBroadcast(notification);\n }\n\n if (signals) {\n await signals.publish<NewNotificationSignal>({\n recipients: { type: 'broadcast' },\n message: {\n action: 'new_notification',\n notification_id: ret.id,\n },\n channel: 'notifications',\n });\n postProcessNotification(ret, opts);\n }\n return notification;\n };\n\n const sendUserNotifications = async (\n baseNotification: Omit<Notification, 'user' | 'id'>,\n users: string[],\n opts: NotificationSendOptions,\n origin: string,\n ) => {\n const notifications = [];\n const { scope } = opts.payload;\n const uniqueUsers = [...new Set(users)];\n for (const user of uniqueUsers) {\n const userNotification = {\n ...baseNotification,\n id: uuid(),\n user,\n };\n const notification = await preProcessNotification(userNotification, opts);\n\n let existingNotification;\n if (scope) {\n existingNotification = await store.getExistingScopeNotification({\n user,\n scope,\n origin,\n });\n }\n\n let ret = notification;\n if (existingNotification) {\n const restored = await store.restoreExistingNotification({\n id: existingNotification.id,\n notification,\n });\n ret = restored ?? notification;\n } else {\n await store.saveNotification(notification);\n }\n\n notifications.push(ret);\n\n if (signals) {\n await signals.publish<NewNotificationSignal>({\n recipients: { type: 'user', entityRef: [user] },\n message: {\n action: 'new_notification',\n notification_id: ret.id,\n },\n channel: 'notifications',\n });\n }\n postProcessNotification(ret, opts);\n }\n return notifications;\n };\n\n // Add new notification\n router.post(\n '/',\n async (req: Request<any, Notification[], NotificationSendOptions>, res) => {\n const opts = await processOptions(req.body);\n const { recipients, payload } = opts;\n const notifications: Notification[] = [];\n let users = [];\n\n const credentials = await httpAuth.credentials(req, {\n allow: ['service'],\n });\n\n const { title, link } = payload;\n\n if (!recipients || !title) {\n logger.error(`Invalid notification request received`);\n throw new InputError(`Invalid notification request received`);\n }\n\n if (link) {\n try {\n validateLink(link);\n } catch (e) {\n throw new InputError('Invalid link provided', e);\n }\n }\n\n const origin = credentials.principal.subject;\n const baseNotification = {\n payload: {\n ...payload,\n severity: payload.severity ?? 'normal',\n },\n origin,\n created: new Date(),\n };\n\n if (recipients.type === 'broadcast') {\n const broadcast = await sendBroadcastNotification(\n baseNotification,\n opts,\n origin,\n );\n notifications.push(broadcast);\n } else {\n const entityRef = recipients.entityRef;\n\n try {\n users = await getUsersForEntityRef(\n entityRef,\n recipients.excludeEntityRef ?? [],\n { auth, catalogClient: catalog },\n );\n } catch (e) {\n logger.error(`Failed to resolve notification receivers: ${e}`);\n throw new InputError('Failed to resolve notification receivers', e);\n }\n\n const userNotifications = await sendUserNotifications(\n baseNotification,\n users,\n opts,\n origin,\n );\n notifications.push(...userNotifications);\n }\n\n res.json(notifications);\n },\n );\n\n router.use(errorHandler());\n return router;\n}\n"],"names":["DatabaseNotificationsStore","notificationSeverities","Router","express","parseEntityOrderFieldParams","InputError","normalizeSeverity","NotFoundError","uuid","getUsersForEntityRef","errorHandler"],"mappings":";;;;;;;;;;;;;;;;;AAgEA,eAAsB,aACpB,OACyB,EAAA;AACzB,EAAM,MAAA;AAAA,IACJ,MAAA;AAAA,IACA,MAAA;AAAA,IACA,QAAA;AAAA,IACA,IAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA,OAAA;AAAA,IACA,aAAa,EAAC;AAAA,IACd,OAAA;AAAA,GACE,GAAA,OAAA,CAAA;AAEJ,EAAA,MAAM,QAAQ,MAAMA,qDAAA,CAA2B,MAAO,CAAA,EAAE,UAAU,CAAA,CAAA;AAClE,EAAM,MAAA,eAAA,GAAkB,MAAO,CAAA,SAAA,CAAU,aAAa,CAAA,C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AAI,KAAK,aAAa,CAAA,CAAA;AAAA,KACxB;AAAA,GACF,CAAA;AAEA,EAAO,MAAA,CAAA,GAAA,CAAIK,4BAAc,CAAA,CAAA;AACzB,EAAO,OAAA,MAAA,CAAA;AACT;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-notifications-backend",
3
- "version": "0.4.1-next.0",
3
+ "version": "0.4.1",
4
4
  "backstage": {
5
5
  "role": "backend-plugin",
6
6
  "pluginId": "notifications",
@@ -39,17 +39,17 @@
39
39
  },
40
40
  "dependencies": {
41
41
  "@backstage/backend-common": "^0.25.0",
42
- "@backstage/backend-plugin-api": "^1.0.1-next.0",
43
- "@backstage/catalog-client": "^1.7.0",
42
+ "@backstage/backend-plugin-api": "^1.0.1",
43
+ "@backstage/catalog-client": "^1.7.1",
44
44
  "@backstage/catalog-model": "^1.7.0",
45
45
  "@backstage/config": "^1.2.0",
46
46
  "@backstage/errors": "^1.2.4",
47
- "@backstage/plugin-auth-node": "^0.5.3-next.0",
48
- "@backstage/plugin-catalog-node": "^1.13.1-next.0",
49
- "@backstage/plugin-events-node": "^0.4.1-next.0",
47
+ "@backstage/plugin-auth-node": "^0.5.3",
48
+ "@backstage/plugin-catalog-node": "^1.13.1",
49
+ "@backstage/plugin-events-node": "^0.4.1",
50
50
  "@backstage/plugin-notifications-common": "^0.0.5",
51
- "@backstage/plugin-notifications-node": "^0.2.7-next.0",
52
- "@backstage/plugin-signals-node": "^0.1.12-next.0",
51
+ "@backstage/plugin-notifications-node": "^0.2.7",
52
+ "@backstage/plugin-signals-node": "^0.1.12",
53
53
  "express": "^4.17.1",
54
54
  "express-promise-router": "^4.1.0",
55
55
  "knex": "^3.0.0",
@@ -59,13 +59,13 @@
59
59
  "yn": "^4.0.0"
60
60
  },
61
61
  "devDependencies": {
62
- "@backstage/backend-defaults": "^0.5.1-next.0",
63
- "@backstage/backend-test-utils": "^1.0.1-next.0",
64
- "@backstage/cli": "^0.28.0-next.0",
65
- "@backstage/plugin-auth-backend": "^0.23.1-next.0",
66
- "@backstage/plugin-auth-backend-module-guest-provider": "^0.2.1-next.0",
67
- "@backstage/plugin-events-backend": "^0.3.13-next.0",
68
- "@backstage/plugin-signals-backend": "^0.2.1-next.0",
62
+ "@backstage/backend-defaults": "^0.5.1",
63
+ "@backstage/backend-test-utils": "^1.0.1",
64
+ "@backstage/cli": "^0.28.0",
65
+ "@backstage/plugin-auth-backend": "^0.23.1",
66
+ "@backstage/plugin-auth-backend-module-guest-provider": "^0.2.1",
67
+ "@backstage/plugin-events-backend": "^0.3.13",
68
+ "@backstage/plugin-signals-backend": "^0.2.1",
69
69
  "@types/express": "^4.17.6",
70
70
  "@types/supertest": "^2.0.8",
71
71
  "msw": "^1.0.0",