@backstage/plugin-notifications-backend 0.0.1-next.0 → 0.0.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 +38 -0
- package/dist/index.cjs.js +28 -33
- package/dist/index.cjs.js.map +1 -1
- package/package.json +17 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# @backstage/plugin-notifications-backend
|
|
2
2
|
|
|
3
|
+
## 0.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9873c44: Add support for signal type in notifications
|
|
8
|
+
- 8472188: Added or fixed the `repository` field in `package.json`.
|
|
9
|
+
- fb8fc24: Initial notifications system for backstage
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
- @backstage/backend-common@0.21.0
|
|
12
|
+
- @backstage/plugin-auth-node@0.4.4
|
|
13
|
+
- @backstage/plugin-signals-node@0.0.1
|
|
14
|
+
- @backstage/plugin-notifications-common@0.0.1
|
|
15
|
+
- @backstage/backend-plugin-api@0.6.10
|
|
16
|
+
- @backstage/catalog-model@1.4.4
|
|
17
|
+
- @backstage/catalog-client@1.6.0
|
|
18
|
+
- @backstage/plugin-notifications-node@0.0.1
|
|
19
|
+
- @backstage/config@1.1.1
|
|
20
|
+
- @backstage/errors@1.2.3
|
|
21
|
+
- @backstage/plugin-events-node@0.2.19
|
|
22
|
+
|
|
23
|
+
## 0.0.1-next.1
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- 8472188: Added or fixed the `repository` field in `package.json`.
|
|
28
|
+
- Updated dependencies
|
|
29
|
+
- @backstage/backend-common@0.21.0-next.3
|
|
30
|
+
- @backstage/plugin-notifications-common@0.0.1-next.1
|
|
31
|
+
- @backstage/plugin-notifications-node@0.0.1-next.1
|
|
32
|
+
- @backstage/plugin-signals-node@0.0.1-next.3
|
|
33
|
+
- @backstage/plugin-auth-node@0.4.4-next.3
|
|
34
|
+
- @backstage/backend-plugin-api@0.6.10-next.3
|
|
35
|
+
- @backstage/catalog-client@1.6.0-next.1
|
|
36
|
+
- @backstage/catalog-model@1.4.4-next.0
|
|
37
|
+
- @backstage/config@1.1.1
|
|
38
|
+
- @backstage/errors@1.2.3
|
|
39
|
+
- @backstage/plugin-events-node@0.2.19-next.3
|
|
40
|
+
|
|
3
41
|
## 0.0.1-next.0
|
|
4
42
|
|
|
5
43
|
### Patch Changes
|
package/dist/index.cjs.js
CHANGED
|
@@ -301,6 +301,20 @@ async function createRouter(options) {
|
|
|
301
301
|
const notifications = await store.getNotifications(opts);
|
|
302
302
|
res.send(notifications);
|
|
303
303
|
});
|
|
304
|
+
router.get("/:id", async (req, res) => {
|
|
305
|
+
const user = await getUser(req);
|
|
306
|
+
const opts = {
|
|
307
|
+
user,
|
|
308
|
+
limit: 1,
|
|
309
|
+
ids: [req.params.id]
|
|
310
|
+
};
|
|
311
|
+
const notifications = await store.getNotifications(opts);
|
|
312
|
+
if (notifications.length !== 1) {
|
|
313
|
+
res.status(404).send({ error: "Not found" });
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
res.send(notifications[0]);
|
|
317
|
+
});
|
|
304
318
|
router.get("/status", async (req, res) => {
|
|
305
319
|
const user = await getUser(req);
|
|
306
320
|
const status = await store.getStatus({ user, type: "undone" });
|
|
@@ -308,35 +322,16 @@ async function createRouter(options) {
|
|
|
308
322
|
});
|
|
309
323
|
router.post("/update", async (req, res) => {
|
|
310
324
|
const user = await getUser(req);
|
|
311
|
-
const { ids,
|
|
325
|
+
const { ids, read, saved } = req.body;
|
|
312
326
|
if (!ids || !Array.isArray(ids)) {
|
|
313
327
|
throw new errors.InputError();
|
|
314
328
|
}
|
|
315
|
-
if (done === true) {
|
|
316
|
-
await store.markDone({ user, ids });
|
|
317
|
-
if (signalService) {
|
|
318
|
-
await signalService.publish({
|
|
319
|
-
recipients: [user],
|
|
320
|
-
message: { action: "done", notification_ids: ids },
|
|
321
|
-
channel: "notifications"
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
} else if (done === false) {
|
|
325
|
-
await store.markUndone({ user, ids });
|
|
326
|
-
if (signalService) {
|
|
327
|
-
await signalService.publish({
|
|
328
|
-
recipients: [user],
|
|
329
|
-
message: { action: "undone", notification_ids: ids },
|
|
330
|
-
channel: "notifications"
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
329
|
if (read === true) {
|
|
335
330
|
await store.markRead({ user, ids });
|
|
336
331
|
if (signalService) {
|
|
337
332
|
await signalService.publish({
|
|
338
333
|
recipients: [user],
|
|
339
|
-
message: { action: "
|
|
334
|
+
message: { action: "notification_read", notification_ids: ids },
|
|
340
335
|
channel: "notifications"
|
|
341
336
|
});
|
|
342
337
|
}
|
|
@@ -345,7 +340,7 @@ async function createRouter(options) {
|
|
|
345
340
|
if (signalService) {
|
|
346
341
|
await signalService.publish({
|
|
347
342
|
recipients: [user],
|
|
348
|
-
message: { action: "
|
|
343
|
+
message: { action: "notification_unread", notification_ids: ids },
|
|
349
344
|
channel: "notifications"
|
|
350
345
|
});
|
|
351
346
|
}
|
|
@@ -368,7 +363,7 @@ async function createRouter(options) {
|
|
|
368
363
|
} catch (e) {
|
|
369
364
|
throw new errors.AuthenticationError();
|
|
370
365
|
}
|
|
371
|
-
const { title, link,
|
|
366
|
+
const { title, link, scope } = payload;
|
|
372
367
|
if (!recipients || !title || !origin || !link) {
|
|
373
368
|
logger.error(`Invalid notification request received`);
|
|
374
369
|
throw new errors.InputError();
|
|
@@ -418,16 +413,16 @@ async function createRouter(options) {
|
|
|
418
413
|
}
|
|
419
414
|
processorSendNotification(ret);
|
|
420
415
|
notifications.push(ret);
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
}
|
|
416
|
+
if (signalService) {
|
|
417
|
+
await signalService.publish({
|
|
418
|
+
recipients: user,
|
|
419
|
+
message: {
|
|
420
|
+
action: "new_notification",
|
|
421
|
+
notification_id: ret.id
|
|
422
|
+
},
|
|
423
|
+
channel: "notifications"
|
|
424
|
+
});
|
|
425
|
+
}
|
|
431
426
|
}
|
|
432
427
|
res.json(notifications);
|
|
433
428
|
});
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/database/DatabaseNotificationsStore.ts","../src/service/router.ts","../src/plugin.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 */\nimport {\n PluginDatabaseManager,\n resolvePackagePath,\n} from '@backstage/backend-common';\nimport {\n NotificationGetOptions,\n NotificationModifyOptions,\n NotificationsStore,\n} from './NotificationsStore';\nimport { Notification } from '@backstage/plugin-notifications-common';\nimport { Knex } from 'knex';\n\nconst migrationsDir = resolvePackagePath(\n '@backstage/plugin-notifications-backend',\n 'migrations',\n);\n\n/** @internal */\nexport class DatabaseNotificationsStore implements NotificationsStore {\n private constructor(private readonly db: Knex) {}\n\n static async create({\n database,\n skipMigrations,\n }: {\n database: PluginDatabaseManager;\n skipMigrations?: boolean;\n }): Promise<DatabaseNotificationsStore> {\n const client = await database.getClient();\n\n if (!database.migrations?.skip && !skipMigrations) {\n await client.migrate.latest({\n directory: migrationsDir,\n });\n }\n\n return new DatabaseNotificationsStore(client);\n }\n\n private mapToInteger = (val: string | number | undefined): number => {\n return typeof val === 'string' ? Number.parseInt(val, 10) : val ?? 0;\n };\n\n private mapToNotifications = (rows: any[]): Notification[] => {\n return rows.map(row => ({\n id: row.id,\n user: row.user,\n created: row.created,\n done: row.done,\n saved: row.saved,\n read: row.read,\n updated: row.updated,\n origin: row.origin,\n payload: {\n title: row.title,\n description: row.description,\n link: row.link,\n topic: row.topic,\n severity: row.severity,\n scope: row.scope,\n icon: row.icon,\n },\n }));\n };\n\n private getNotificationsBaseQuery = (\n options: NotificationGetOptions | NotificationModifyOptions,\n ) => {\n const { user, type } = options;\n const query = this.db('notification').where('user', user);\n\n if (options.sort !== undefined && options.sort !== null) {\n query.orderBy(options.sort, options.sortOrder ?? 'desc');\n } else if (options.sort !== null) {\n query.orderBy('created', options.sortOrder ?? 'desc');\n }\n\n if (type === 'undone') {\n query.whereNull('done');\n } else if (type === 'done') {\n query.whereNotNull('done');\n } else if (type === 'saved') {\n query.whereNotNull('saved');\n }\n\n if (options.limit) {\n query.limit(options.limit);\n }\n\n if (options.offset) {\n query.offset(options.offset);\n }\n\n if (options.search) {\n query.whereRaw(\n `(LOWER(notification.title) LIKE LOWER(?) OR LOWER(notification.description) LIKE LOWER(?))`,\n [`%${options.search}%`, `%${options.search}%`],\n );\n }\n\n if (options.ids) {\n query.whereIn('notification.id', options.ids);\n }\n\n return query;\n };\n\n async getNotifications(options: NotificationGetOptions) {\n const notificationQuery = this.getNotificationsBaseQuery(options);\n const notifications = await notificationQuery.select();\n return this.mapToNotifications(notifications);\n }\n\n async saveNotification(notification: Notification) {\n await this.db.insert(notification).into('notification');\n }\n\n async getStatus(options: NotificationGetOptions) {\n const notificationQuery = this.getNotificationsBaseQuery({\n ...options,\n sort: null,\n });\n const readSubQuery = notificationQuery\n .clone()\n .count('id')\n .whereNotNull('read')\n .as('READ');\n const unreadSubQuery = notificationQuery\n .clone()\n .count('id')\n .whereNull('read')\n .as('UNREAD');\n\n const query = await notificationQuery\n .select(readSubQuery, unreadSubQuery)\n .first();\n\n return {\n unread: this.mapToInteger((query as any)?.UNREAD),\n read: this.mapToInteger((query as any)?.READ),\n };\n }\n\n async getExistingScopeNotification(options: {\n user: string;\n scope: string;\n origin: string;\n }) {\n const query = this.db('notification')\n .where('user', options.user)\n .where('scope', options.scope)\n .where('origin', options.origin)\n .select()\n .limit(1);\n\n const rows = await query;\n if (!rows || rows.length === 0) {\n return null;\n }\n return rows[0] as Notification;\n }\n\n async restoreExistingNotification(options: {\n id: string;\n notification: Notification;\n }) {\n const query = this.db('notification')\n .where('id', options.id)\n .where('user', options.notification.user);\n\n await query.update({\n title: options.notification.payload.title,\n description: options.notification.payload.description,\n link: options.notification.payload.link,\n topic: options.notification.payload.topic,\n updated: options.notification.created,\n severity: options.notification.payload.severity,\n read: null,\n done: null,\n });\n\n return await this.getNotification(options);\n }\n\n async getNotification(options: { id: string }): Promise<Notification | null> {\n const rows = await this.db('notification')\n .where('id', options.id)\n .select()\n .limit(1);\n if (!rows || rows.length === 0) {\n return null;\n }\n return this.mapToNotifications(rows)[0];\n }\n\n async markRead(options: NotificationModifyOptions): Promise<void> {\n const notificationQuery = this.getNotificationsBaseQuery(options);\n await notificationQuery.update({ read: new Date() });\n }\n\n async markUnread(options: NotificationModifyOptions): Promise<void> {\n const notificationQuery = this.getNotificationsBaseQuery(options);\n await notificationQuery.update({ read: null });\n }\n\n async markDone(options: NotificationModifyOptions): Promise<void> {\n const notificationQuery = this.getNotificationsBaseQuery(options);\n await notificationQuery.update({ done: new Date(), read: new Date() });\n }\n\n async markUndone(options: NotificationModifyOptions): Promise<void> {\n const notificationQuery = this.getNotificationsBaseQuery(options);\n await notificationQuery.update({ done: null, read: null });\n }\n\n async markSaved(options: NotificationModifyOptions): Promise<void> {\n const notificationQuery = this.getNotificationsBaseQuery(options);\n await notificationQuery.update({ saved: new Date() });\n }\n\n async markUnsaved(options: NotificationModifyOptions): Promise<void> {\n const notificationQuery = this.getNotificationsBaseQuery(options);\n await notificationQuery.update({ saved: null });\n }\n}\n","/*\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 */\nimport {\n errorHandler,\n PluginDatabaseManager,\n TokenManager,\n} from '@backstage/backend-common';\nimport express, { Request } from 'express';\nimport Router from 'express-promise-router';\nimport {\n getBearerTokenFromAuthorizationHeader,\n IdentityApi,\n} from '@backstage/plugin-auth-node';\nimport {\n DatabaseNotificationsStore,\n NotificationGetOptions,\n} from '../database';\nimport { v4 as uuid } from 'uuid';\nimport { CatalogApi, CatalogClient } from '@backstage/catalog-client';\nimport {\n Entity,\n isGroupEntity,\n isUserEntity,\n RELATION_HAS_MEMBER,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { NotificationProcessor } from '@backstage/plugin-notifications-node';\nimport { AuthenticationError, InputError } from '@backstage/errors';\nimport { DiscoveryService, LoggerService } from '@backstage/backend-plugin-api';\nimport { SignalService } from '@backstage/plugin-signals-node';\nimport {\n Notification,\n NotificationType,\n} from '@backstage/plugin-notifications-common';\n\n/** @internal */\nexport interface RouterOptions {\n logger: LoggerService;\n identity: IdentityApi;\n database: PluginDatabaseManager;\n tokenManager: TokenManager;\n discovery: DiscoveryService;\n signalService?: SignalService;\n catalog?: CatalogApi;\n processors?: NotificationProcessor[];\n}\n\n/** @internal */\nexport async function createRouter(\n options: RouterOptions,\n): Promise<express.Router> {\n const {\n logger,\n database,\n identity,\n discovery,\n catalog,\n tokenManager,\n processors,\n signalService,\n } = options;\n\n const catalogClient =\n catalog ?? new CatalogClient({ discoveryApi: discovery });\n const store = await DatabaseNotificationsStore.create({ database });\n\n const getUser = async (req: Request<unknown>) => {\n const user = await identity.getIdentity({ request: req });\n if (!user) {\n throw new AuthenticationError();\n }\n return user.identity.userEntityRef;\n };\n\n const authenticateService = async (req: Request<unknown>) => {\n const token = getBearerTokenFromAuthorizationHeader(\n req.header('authorization'),\n );\n if (!token) {\n throw new AuthenticationError();\n }\n await tokenManager.authenticate(token);\n };\n\n const getUsersForEntityRef = async (\n entityRef: string | string[] | null,\n ): Promise<string[]> => {\n const { token } = await tokenManager.getToken();\n\n // TODO: Support for broadcast\n if (entityRef === null) {\n return [];\n }\n\n const refs = Array.isArray(entityRef) ? entityRef : [entityRef];\n const entities = await catalogClient.getEntitiesByRefs(\n {\n entityRefs: refs,\n fields: ['kind', 'metadata.name', 'metadata.namespace'],\n },\n { token },\n );\n const mapEntity = async (entity: Entity | undefined): Promise<string[]> => {\n if (!entity) {\n return [];\n }\n\n if (isUserEntity(entity)) {\n return [stringifyEntityRef(entity)];\n } else if (isGroupEntity(entity) && entity.relations) {\n const users = entity.relations\n .filter(\n relation =>\n relation.type === RELATION_HAS_MEMBER && relation.targetRef,\n )\n .map(r => r.targetRef);\n const childGroups = await catalogClient.getEntitiesByRefs(\n {\n entityRefs: entity.spec.children,\n fields: ['kind', 'metadata.name', 'metadata.namespace'],\n },\n { token },\n );\n const childGroupUsers = await Promise.all(\n childGroups.items.map(mapEntity),\n );\n return [...users, ...childGroupUsers.flat(2)];\n } else if (!isGroupEntity(entity) && entity.spec?.owner) {\n const owner = await catalogClient.getEntityByRef(\n entity.spec.owner as string,\n { token },\n );\n if (owner) {\n return mapEntity(owner);\n }\n }\n\n return [];\n };\n\n const users: string[] = [];\n for (const entity of entities.items) {\n const u = await mapEntity(entity);\n users.push(...u);\n }\n return users;\n };\n\n const decorateNotification = async (notification: Notification) => {\n let ret: Notification = notification;\n for (const processor of processors ?? []) {\n ret = processor.decorate ? await processor.decorate(ret) : ret;\n }\n return ret;\n };\n\n const processorSendNotification = async (notification: Notification) => {\n for (const processor of processors ?? []) {\n if (processor.send) {\n processor.send(notification);\n }\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.type) {\n opts.type = req.query.type.toString() as NotificationType;\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.search) {\n opts.search = req.query.search.toString();\n }\n\n const notifications = await store.getNotifications(opts);\n res.send(notifications);\n });\n\n router.get('/status', async (req, res) => {\n const user = await getUser(req);\n const status = await store.getStatus({ user, type: 'undone' });\n res.send(status);\n });\n\n router.post('/update', async (req, res) => {\n const user = await getUser(req);\n const { ids, done, read, saved } = req.body;\n if (!ids || !Array.isArray(ids)) {\n throw new InputError();\n }\n\n if (done === true) {\n await store.markDone({ user, ids });\n if (signalService) {\n await signalService.publish({\n recipients: [user],\n message: { action: 'done', notification_ids: ids },\n channel: 'notifications',\n });\n }\n } else if (done === false) {\n await store.markUndone({ user, ids });\n if (signalService) {\n await signalService.publish({\n recipients: [user],\n message: { action: 'undone', notification_ids: ids },\n channel: 'notifications',\n });\n }\n }\n\n if (read === true) {\n await store.markRead({ user, ids });\n\n if (signalService) {\n await signalService.publish({\n recipients: [user],\n message: { action: 'mark_read', notification_ids: ids },\n channel: 'notifications',\n });\n }\n } else if (read === false) {\n await store.markUnread({ user: user, ids });\n\n if (signalService) {\n await signalService.publish({\n recipients: [user],\n message: { action: 'mark_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.status(200).send(notifications);\n });\n\n // Add new notification\n // Allowed only for service-to-service authentication, uses `getUsersForEntityRef` to retrieve recipients for\n // specific entity reference\n router.post('/', async (req, res) => {\n const { recipients, origin, payload } = req.body;\n const notifications = [];\n let users = [];\n\n try {\n await authenticateService(req);\n } catch (e) {\n throw new AuthenticationError();\n }\n\n const { title, link, description, scope } = payload;\n\n if (!recipients || !title || !origin || !link) {\n logger.error(`Invalid notification request received`);\n throw new InputError();\n }\n\n let entityRef = null;\n // TODO: Support for broadcast notifications\n if (recipients.entityRef && recipients.type === 'entity') {\n entityRef = recipients.entityRef;\n }\n\n try {\n users = await getUsersForEntityRef(entityRef);\n } catch (e) {\n throw new InputError();\n }\n\n const baseNotification: Omit<Notification, 'id' | 'user'> = {\n payload: {\n ...payload,\n severity: payload.severity ?? 'normal',\n },\n origin,\n created: new Date(),\n };\n\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 decorateNotification(userNotification);\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 processorSendNotification(ret);\n notifications.push(ret);\n }\n\n if (signalService) {\n await signalService.publish({\n recipients: entityRef === null ? null : uniqueUsers,\n message: {\n action: 'new_notification',\n notification: { title, description, link },\n },\n channel: 'notifications',\n });\n }\n\n res.json(notifications);\n });\n\n router.use(errorHandler());\n return router;\n}\n","/*\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 */\nimport {\n coreServices,\n createBackendPlugin,\n} from '@backstage/backend-plugin-api';\nimport { createRouter } from './service/router';\nimport { signalService } from '@backstage/plugin-signals-node';\nimport {\n NotificationProcessor,\n notificationsProcessingExtensionPoint,\n NotificationsProcessingExtensionPoint,\n} from '@backstage/plugin-notifications-node';\n\nclass NotificationsProcessingExtensionPointImpl\n implements NotificationsProcessingExtensionPoint\n{\n #processors = new Array<NotificationProcessor>();\n\n addProcessor(\n ...processors: Array<NotificationProcessor | Array<NotificationProcessor>>\n ): void {\n this.#processors.push(...processors.flat());\n }\n\n get processors() {\n return this.#processors;\n }\n}\n\n/**\n * Notifications backend plugin\n *\n * @public\n */\nexport const notificationsPlugin = createBackendPlugin({\n pluginId: 'notifications',\n register(env) {\n const processingExtensions =\n new NotificationsProcessingExtensionPointImpl();\n env.registerExtensionPoint(\n notificationsProcessingExtensionPoint,\n processingExtensions,\n );\n\n env.registerInit({\n deps: {\n httpRouter: coreServices.httpRouter,\n logger: coreServices.logger,\n identity: coreServices.identity,\n database: coreServices.database,\n tokenManager: coreServices.tokenManager,\n discovery: coreServices.discovery,\n signals: signalService,\n },\n async init({\n httpRouter,\n logger,\n identity,\n database,\n tokenManager,\n discovery,\n signals,\n }) {\n httpRouter.use(\n await createRouter({\n logger,\n identity,\n database,\n tokenManager,\n discovery,\n signalService: signals,\n processors: processingExtensions.processors,\n }),\n );\n },\n });\n },\n});\n"],"names":["resolvePackagePath","catalogClient","CatalogClient","AuthenticationError","getBearerTokenFromAuthorizationHeader","isUserEntity","stringifyEntityRef","isGroupEntity","users","RELATION_HAS_MEMBER","Router","express","InputError","uuid","errorHandler","createBackendPlugin","notificationsProcessingExtensionPoint","coreServices","signalService"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAM,aAAgB,GAAAA,gCAAA;AAAA,EACpB,yCAAA;AAAA,EACA,YAAA;AACF,CAAA,CAAA;AAGO,MAAM,0BAAyD,CAAA;AAAA,EAC5D,YAA6B,EAAU,EAAA;AAAV,IAAA,IAAA,CAAA,EAAA,GAAA,EAAA,CAAA;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../src/service/router.ts","../src/plugin.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 */\nimport {\n PluginDatabaseManager,\n resolvePackagePath,\n} from '@backstage/backend-common';\nimport {\n NotificationGetOptions,\n NotificationModifyOptions,\n NotificationsStore,\n} from './NotificationsStore';\nimport { Notification } from '@backstage/plugin-notifications-common';\nimport { Knex } from 'knex';\n\nconst migrationsDir = resolvePackagePath(\n '@backstage/plugin-notifications-backend',\n 'migrations',\n);\n\n/** @internal */\nexport class DatabaseNotificationsStore implements NotificationsStore {\n private constructor(private readonly db: Knex) {}\n\n static async create({\n database,\n skipMigrations,\n }: {\n database: PluginDatabaseManager;\n skipMigrations?: boolean;\n }): Promise<DatabaseNotificationsStore> {\n const client = await database.getClient();\n\n if (!database.migrations?.skip && !skipMigrations) {\n await client.migrate.latest({\n directory: migrationsDir,\n });\n }\n\n return new DatabaseNotificationsStore(client);\n }\n\n private mapToInteger = (val: string | number | undefined): number => {\n return typeof val === 'string' ? Number.parseInt(val, 10) : val ?? 0;\n };\n\n private mapToNotifications = (rows: any[]): Notification[] => {\n return rows.map(row => ({\n id: row.id,\n user: row.user,\n created: row.created,\n done: row.done,\n saved: row.saved,\n read: row.read,\n updated: row.updated,\n origin: row.origin,\n payload: {\n title: row.title,\n description: row.description,\n link: row.link,\n topic: row.topic,\n severity: row.severity,\n scope: row.scope,\n icon: row.icon,\n },\n }));\n };\n\n private getNotificationsBaseQuery = (\n options: NotificationGetOptions | NotificationModifyOptions,\n ) => {\n const { user, type } = options;\n const query = this.db('notification').where('user', user);\n\n if (options.sort !== undefined && options.sort !== null) {\n query.orderBy(options.sort, options.sortOrder ?? 'desc');\n } else if (options.sort !== null) {\n query.orderBy('created', options.sortOrder ?? 'desc');\n }\n\n if (type === 'undone') {\n query.whereNull('done');\n } else if (type === 'done') {\n query.whereNotNull('done');\n } else if (type === 'saved') {\n query.whereNotNull('saved');\n }\n\n if (options.limit) {\n query.limit(options.limit);\n }\n\n if (options.offset) {\n query.offset(options.offset);\n }\n\n if (options.search) {\n query.whereRaw(\n `(LOWER(notification.title) LIKE LOWER(?) OR LOWER(notification.description) LIKE LOWER(?))`,\n [`%${options.search}%`, `%${options.search}%`],\n );\n }\n\n if (options.ids) {\n query.whereIn('notification.id', options.ids);\n }\n\n return query;\n };\n\n async getNotifications(options: NotificationGetOptions) {\n const notificationQuery = this.getNotificationsBaseQuery(options);\n const notifications = await notificationQuery.select();\n return this.mapToNotifications(notifications);\n }\n\n async saveNotification(notification: Notification) {\n await this.db.insert(notification).into('notification');\n }\n\n async getStatus(options: NotificationGetOptions) {\n const notificationQuery = this.getNotificationsBaseQuery({\n ...options,\n sort: null,\n });\n const readSubQuery = notificationQuery\n .clone()\n .count('id')\n .whereNotNull('read')\n .as('READ');\n const unreadSubQuery = notificationQuery\n .clone()\n .count('id')\n .whereNull('read')\n .as('UNREAD');\n\n const query = await notificationQuery\n .select(readSubQuery, unreadSubQuery)\n .first();\n\n return {\n unread: this.mapToInteger((query as any)?.UNREAD),\n read: this.mapToInteger((query as any)?.READ),\n };\n }\n\n async getExistingScopeNotification(options: {\n user: string;\n scope: string;\n origin: string;\n }) {\n const query = this.db('notification')\n .where('user', options.user)\n .where('scope', options.scope)\n .where('origin', options.origin)\n .select()\n .limit(1);\n\n const rows = await query;\n if (!rows || rows.length === 0) {\n return null;\n }\n return rows[0] as Notification;\n }\n\n async restoreExistingNotification(options: {\n id: string;\n notification: Notification;\n }) {\n const query = this.db('notification')\n .where('id', options.id)\n .where('user', options.notification.user);\n\n await query.update({\n title: options.notification.payload.title,\n description: options.notification.payload.description,\n link: options.notification.payload.link,\n topic: options.notification.payload.topic,\n updated: options.notification.created,\n severity: options.notification.payload.severity,\n read: null,\n done: null,\n });\n\n return await this.getNotification(options);\n }\n\n async getNotification(options: { id: string }): Promise<Notification | null> {\n const rows = await this.db('notification')\n .where('id', options.id)\n .select()\n .limit(1);\n if (!rows || rows.length === 0) {\n return null;\n }\n return this.mapToNotifications(rows)[0];\n }\n\n async markRead(options: NotificationModifyOptions): Promise<void> {\n const notificationQuery = this.getNotificationsBaseQuery(options);\n await notificationQuery.update({ read: new Date() });\n }\n\n async markUnread(options: NotificationModifyOptions): Promise<void> {\n const notificationQuery = this.getNotificationsBaseQuery(options);\n await notificationQuery.update({ read: null });\n }\n\n async markDone(options: NotificationModifyOptions): Promise<void> {\n const notificationQuery = this.getNotificationsBaseQuery(options);\n await notificationQuery.update({ done: new Date(), read: new Date() });\n }\n\n async markUndone(options: NotificationModifyOptions): Promise<void> {\n const notificationQuery = this.getNotificationsBaseQuery(options);\n await notificationQuery.update({ done: null, read: null });\n }\n\n async markSaved(options: NotificationModifyOptions): Promise<void> {\n const notificationQuery = this.getNotificationsBaseQuery(options);\n await notificationQuery.update({ saved: new Date() });\n }\n\n async markUnsaved(options: NotificationModifyOptions): Promise<void> {\n const notificationQuery = this.getNotificationsBaseQuery(options);\n await notificationQuery.update({ saved: null });\n }\n}\n","/*\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 */\nimport {\n errorHandler,\n PluginDatabaseManager,\n TokenManager,\n} from '@backstage/backend-common';\nimport express, { Request } from 'express';\nimport Router from 'express-promise-router';\nimport {\n getBearerTokenFromAuthorizationHeader,\n IdentityApi,\n} from '@backstage/plugin-auth-node';\nimport {\n DatabaseNotificationsStore,\n NotificationGetOptions,\n} from '../database';\nimport { v4 as uuid } from 'uuid';\nimport { CatalogApi, CatalogClient } from '@backstage/catalog-client';\nimport {\n Entity,\n isGroupEntity,\n isUserEntity,\n RELATION_HAS_MEMBER,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { NotificationProcessor } from '@backstage/plugin-notifications-node';\nimport { AuthenticationError, InputError } from '@backstage/errors';\nimport { DiscoveryService, LoggerService } from '@backstage/backend-plugin-api';\nimport { SignalService } from '@backstage/plugin-signals-node';\nimport {\n NewNotificationSignal,\n Notification,\n NotificationReadSignal,\n NotificationType,\n} from '@backstage/plugin-notifications-common';\n\n/** @internal */\nexport interface RouterOptions {\n logger: LoggerService;\n identity: IdentityApi;\n database: PluginDatabaseManager;\n tokenManager: TokenManager;\n discovery: DiscoveryService;\n signalService?: SignalService;\n catalog?: CatalogApi;\n processors?: NotificationProcessor[];\n}\n\n/** @internal */\nexport async function createRouter(\n options: RouterOptions,\n): Promise<express.Router> {\n const {\n logger,\n database,\n identity,\n discovery,\n catalog,\n tokenManager,\n processors,\n signalService,\n } = options;\n\n const catalogClient =\n catalog ?? new CatalogClient({ discoveryApi: discovery });\n const store = await DatabaseNotificationsStore.create({ database });\n\n const getUser = async (req: Request<unknown>) => {\n const user = await identity.getIdentity({ request: req });\n if (!user) {\n throw new AuthenticationError();\n }\n return user.identity.userEntityRef;\n };\n\n const authenticateService = async (req: Request<unknown>) => {\n const token = getBearerTokenFromAuthorizationHeader(\n req.header('authorization'),\n );\n if (!token) {\n throw new AuthenticationError();\n }\n await tokenManager.authenticate(token);\n };\n\n const getUsersForEntityRef = async (\n entityRef: string | string[] | null,\n ): Promise<string[]> => {\n const { token } = await tokenManager.getToken();\n\n // TODO: Support for broadcast\n if (entityRef === null) {\n return [];\n }\n\n const refs = Array.isArray(entityRef) ? entityRef : [entityRef];\n const entities = await catalogClient.getEntitiesByRefs(\n {\n entityRefs: refs,\n fields: ['kind', 'metadata.name', 'metadata.namespace'],\n },\n { token },\n );\n const mapEntity = async (entity: Entity | undefined): Promise<string[]> => {\n if (!entity) {\n return [];\n }\n\n if (isUserEntity(entity)) {\n return [stringifyEntityRef(entity)];\n } else if (isGroupEntity(entity) && entity.relations) {\n const users = entity.relations\n .filter(\n relation =>\n relation.type === RELATION_HAS_MEMBER && relation.targetRef,\n )\n .map(r => r.targetRef);\n const childGroups = await catalogClient.getEntitiesByRefs(\n {\n entityRefs: entity.spec.children,\n fields: ['kind', 'metadata.name', 'metadata.namespace'],\n },\n { token },\n );\n const childGroupUsers = await Promise.all(\n childGroups.items.map(mapEntity),\n );\n return [...users, ...childGroupUsers.flat(2)];\n } else if (!isGroupEntity(entity) && entity.spec?.owner) {\n const owner = await catalogClient.getEntityByRef(\n entity.spec.owner as string,\n { token },\n );\n if (owner) {\n return mapEntity(owner);\n }\n }\n\n return [];\n };\n\n const users: string[] = [];\n for (const entity of entities.items) {\n const u = await mapEntity(entity);\n users.push(...u);\n }\n return users;\n };\n\n const decorateNotification = async (notification: Notification) => {\n let ret: Notification = notification;\n for (const processor of processors ?? []) {\n ret = processor.decorate ? await processor.decorate(ret) : ret;\n }\n return ret;\n };\n\n const processorSendNotification = async (notification: Notification) => {\n for (const processor of processors ?? []) {\n if (processor.send) {\n processor.send(notification);\n }\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.type) {\n opts.type = req.query.type.toString() as NotificationType;\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.search) {\n opts.search = req.query.search.toString();\n }\n\n const notifications = await store.getNotifications(opts);\n res.send(notifications);\n });\n\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 res.status(404).send({ error: 'Not found' });\n return;\n }\n res.send(notifications[0]);\n });\n\n router.get('/status', async (req, res) => {\n const user = await getUser(req);\n const status = await store.getStatus({ user, type: 'undone' });\n res.send(status);\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 (signalService) {\n await signalService.publish<NotificationReadSignal>({\n recipients: [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 (signalService) {\n await signalService.publish<NotificationReadSignal>({\n recipients: [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.status(200).send(notifications);\n });\n\n // Add new notification\n // Allowed only for service-to-service authentication, uses `getUsersForEntityRef` to retrieve recipients for\n // specific entity reference\n router.post('/', async (req, res) => {\n const { recipients, origin, payload } = req.body;\n const notifications = [];\n let users = [];\n\n try {\n await authenticateService(req);\n } catch (e) {\n throw new AuthenticationError();\n }\n\n const { title, link, scope } = payload;\n\n if (!recipients || !title || !origin || !link) {\n logger.error(`Invalid notification request received`);\n throw new InputError();\n }\n\n let entityRef = null;\n // TODO: Support for broadcast notifications\n if (recipients.entityRef && recipients.type === 'entity') {\n entityRef = recipients.entityRef;\n }\n\n try {\n users = await getUsersForEntityRef(entityRef);\n } catch (e) {\n throw new InputError();\n }\n\n const baseNotification: Omit<Notification, 'id' | 'user'> = {\n payload: {\n ...payload,\n severity: payload.severity ?? 'normal',\n },\n origin,\n created: new Date(),\n };\n\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 decorateNotification(userNotification);\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 processorSendNotification(ret);\n notifications.push(ret);\n\n if (signalService) {\n await signalService.publish<NewNotificationSignal>({\n recipients: user,\n message: {\n action: 'new_notification',\n notification_id: ret.id,\n },\n channel: 'notifications',\n });\n }\n }\n\n res.json(notifications);\n });\n\n router.use(errorHandler());\n return router;\n}\n","/*\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 */\nimport {\n coreServices,\n createBackendPlugin,\n} from '@backstage/backend-plugin-api';\nimport { createRouter } from './service/router';\nimport { signalService } from '@backstage/plugin-signals-node';\nimport {\n NotificationProcessor,\n notificationsProcessingExtensionPoint,\n NotificationsProcessingExtensionPoint,\n} from '@backstage/plugin-notifications-node';\n\nclass NotificationsProcessingExtensionPointImpl\n implements NotificationsProcessingExtensionPoint\n{\n #processors = new Array<NotificationProcessor>();\n\n addProcessor(\n ...processors: Array<NotificationProcessor | Array<NotificationProcessor>>\n ): void {\n this.#processors.push(...processors.flat());\n }\n\n get processors() {\n return this.#processors;\n }\n}\n\n/**\n * Notifications backend plugin\n *\n * @public\n */\nexport const notificationsPlugin = createBackendPlugin({\n pluginId: 'notifications',\n register(env) {\n const processingExtensions =\n new NotificationsProcessingExtensionPointImpl();\n env.registerExtensionPoint(\n notificationsProcessingExtensionPoint,\n processingExtensions,\n );\n\n env.registerInit({\n deps: {\n httpRouter: coreServices.httpRouter,\n logger: coreServices.logger,\n identity: coreServices.identity,\n database: coreServices.database,\n tokenManager: coreServices.tokenManager,\n discovery: coreServices.discovery,\n signals: signalService,\n },\n async init({\n httpRouter,\n logger,\n identity,\n database,\n tokenManager,\n discovery,\n signals,\n }) {\n httpRouter.use(\n await createRouter({\n logger,\n identity,\n database,\n tokenManager,\n discovery,\n signalService: signals,\n processors: processingExtensions.processors,\n }),\n );\n },\n });\n },\n});\n"],"names":["resolvePackagePath","catalogClient","CatalogClient","AuthenticationError","getBearerTokenFromAuthorizationHeader","isUserEntity","stringifyEntityRef","isGroupEntity","users","RELATION_HAS_MEMBER","Router","express","InputError","uuid","errorHandler","createBackendPlugin","notificationsProcessingExtensionPoint","coreServices","signalService"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAM,aAAgB,GAAAA,gCAAA;AAAA,EACpB,yCAAA;AAAA,EACA,YAAA;AACF,CAAA,CAAA;AAGO,MAAM,0BAAyD,CAAA;AAAA,EAC5D,YAA6B,EAAU,EAAA;AAAV,IAAA,IAAA,CAAA,EAAA,GAAA,EAAA,CAAA;AAoBrC,IAAQ,aAAA,CAAA,IAAA,EAAA,cAAA,EAAe,CAAC,GAA6C,KAAA;AACnE,MAAO,OAAA,OAAO,QAAQ,QAAW,GAAA,MAAA,CAAO,SAAS,GAAK,EAAA,EAAE,IAAI,GAAO,IAAA,IAAA,GAAA,GAAA,GAAA,CAAA,CAAA;AAAA,KACrE,CAAA,CAAA;AAEA,IAAQ,aAAA,CAAA,IAAA,EAAA,oBAAA,EAAqB,CAAC,IAAgC,KAAA;AAC5D,MAAO,OAAA,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AA,MAAA;AAAA,QACrB,UAAUA,6BAAa,CAAA,QAAA;AAAA,QACvB,UAAUA,6BAAa,CAAA,QAAA;AAAA,QACvB,cAAcA,6BAAa,CAAA,YAAA;AAAA,QAC3B,WAAWA,6BAAa,CAAA,SAAA;AAAA,QACxB,OAAS,EAAAC,+BAAA;AAAA,OACX;AAAA,MACA,MAAM,IAAK,CAAA;AAAA,QACT,UAAA;AAAA,QACA,MAAA;AAAA,QACA,QAAA;AAAA,QACA,QAAA;AAAA,QACA,YAAA;AAAA,QACA,SAAA;AAAA,QACA,OAAA;AAAA,OACC,EAAA;AACD,QAAW,UAAA,CAAA,GAAA;AAAA,UACT,MAAM,YAAa,CAAA;AAAA,YACjB,MAAA;AAAA,YACA,QAAA;AAAA,YACA,QAAA;AAAA,YACA,YAAA;AAAA,YACA,SAAA;AAAA,YACA,aAAe,EAAA,OAAA;AAAA,YACf,YAAY,oBAAqB,CAAA,UAAA;AAAA,WAClC,CAAA;AAAA,SACH,CAAA;AAAA,OACF;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-notifications-backend",
|
|
3
|
-
"version": "0.0.1
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"main": "dist/index.cjs.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
"main": "dist/index.cjs.js",
|
|
10
10
|
"types": "dist/index.d.ts"
|
|
11
11
|
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/backstage/backstage",
|
|
15
|
+
"directory": "plugins/notifications-backend"
|
|
16
|
+
},
|
|
12
17
|
"backstage": {
|
|
13
18
|
"role": "backend-plugin"
|
|
14
19
|
},
|
|
@@ -22,17 +27,17 @@
|
|
|
22
27
|
"postpack": "backstage-cli package postpack"
|
|
23
28
|
},
|
|
24
29
|
"dependencies": {
|
|
25
|
-
"@backstage/backend-common": "^0.21.0
|
|
26
|
-
"@backstage/backend-plugin-api": "^0.6.10
|
|
27
|
-
"@backstage/catalog-client": "^1.6.0
|
|
28
|
-
"@backstage/catalog-model": "^1.4.4
|
|
30
|
+
"@backstage/backend-common": "^0.21.0",
|
|
31
|
+
"@backstage/backend-plugin-api": "^0.6.10",
|
|
32
|
+
"@backstage/catalog-client": "^1.6.0",
|
|
33
|
+
"@backstage/catalog-model": "^1.4.4",
|
|
29
34
|
"@backstage/config": "^1.1.1",
|
|
30
35
|
"@backstage/errors": "^1.2.3",
|
|
31
|
-
"@backstage/plugin-auth-node": "^0.4.4
|
|
32
|
-
"@backstage/plugin-events-node": "^0.2.19
|
|
33
|
-
"@backstage/plugin-notifications-common": "^0.0.1
|
|
34
|
-
"@backstage/plugin-notifications-node": "^0.0.1
|
|
35
|
-
"@backstage/plugin-signals-node": "^0.0.1
|
|
36
|
+
"@backstage/plugin-auth-node": "^0.4.4",
|
|
37
|
+
"@backstage/plugin-events-node": "^0.2.19",
|
|
38
|
+
"@backstage/plugin-notifications-common": "^0.0.1",
|
|
39
|
+
"@backstage/plugin-notifications-node": "^0.0.1",
|
|
40
|
+
"@backstage/plugin-signals-node": "^0.0.1",
|
|
36
41
|
"express": "^4.17.1",
|
|
37
42
|
"express-promise-router": "^4.1.0",
|
|
38
43
|
"knex": "^3.0.0",
|
|
@@ -42,8 +47,8 @@
|
|
|
42
47
|
"yn": "^4.0.0"
|
|
43
48
|
},
|
|
44
49
|
"devDependencies": {
|
|
45
|
-
"@backstage/backend-test-utils": "^0.3.0
|
|
46
|
-
"@backstage/cli": "^0.25.2
|
|
50
|
+
"@backstage/backend-test-utils": "^0.3.0",
|
|
51
|
+
"@backstage/cli": "^0.25.2",
|
|
47
52
|
"@types/express": "^4.17.6",
|
|
48
53
|
"@types/supertest": "^2.0.8",
|
|
49
54
|
"msw": "^1.0.0",
|