@backstage/plugin-notifications-backend 0.6.9-next.1 → 0.6.10-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # @backstage/plugin-notifications-backend
2
2
 
3
+ ## 0.6.10-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/config@1.3.10-next.0
9
+ - @backstage/errors@1.3.2-next.0
10
+ - @backstage/backend-plugin-api@1.10.2-next.0
11
+ - @backstage/plugin-notifications-common@0.2.5-next.0
12
+ - @backstage/backend-openapi-utils@0.7.3-next.0
13
+ - @backstage/catalog-model@1.10.2-next.0
14
+ - @backstage/plugin-catalog-node@2.2.6-next.0
15
+ - @backstage/plugin-notifications-node@0.2.31-next.0
16
+ - @backstage/plugin-signals-node@0.2.6-next.0
17
+
18
+ ## 0.6.9
19
+
20
+ ### Patch Changes
21
+
22
+ - 736d84e: Use locale-insensitive Unicode casing for consistent string handling across environments.
23
+ - Updated dependencies
24
+ - @backstage/backend-openapi-utils@0.7.2
25
+ - @backstage/catalog-model@1.10.1
26
+ - @backstage/config@1.3.9
27
+ - @backstage/plugin-notifications-node@0.2.30
28
+ - @backstage/backend-plugin-api@1.10.1
29
+ - @backstage/plugin-catalog-node@2.2.5
30
+ - @backstage/plugin-notifications-common@0.2.4
31
+ - @backstage/plugin-signals-node@0.2.5
32
+
3
33
  ## 0.6.9-next.1
4
34
 
5
35
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"createGetNotificationsAction.cjs.js","sources":["../../src/actions/createGetNotificationsAction.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { ActionsRegistryService } from '@backstage/backend-plugin-api/alpha';\nimport { AuthService } from '@backstage/backend-plugin-api';\nimport { NotAllowedError } from '@backstage/errors';\nimport { NotificationsStore } from '../database';\n\nexport const createGetNotificationsAction = ({\n store,\n auth,\n actionsRegistry,\n}: {\n store: NotificationsStore;\n auth: AuthService;\n actionsRegistry: ActionsRegistryService;\n}) => {\n actionsRegistry.register({\n name: 'get-notifications',\n title: 'Get Notifications',\n description: `\nFetches notifications for the currently authenticated user from the Backstage notifications system.\n\nEach notification has an \\`id\\`, \\`origin\\` (the plugin or service that sent it), a \\`payload\\` with\n\\`title\\`, optional \\`description\\`, optional \\`link\\`, \\`severity\\` (one of \"critical\", \"high\", \"normal\", \"low\"),\nand optional \\`topic\\`. Notifications also carry \\`created\\` and optionally \\`read\\`, \\`saved\\`, and \\`updated\\` timestamps.\n\n## Filters\n\nUse the \\`view\\` field to control which notifications are returned:\n- \\`\"unread\"\\` (default) — only notifications the user has not yet read. Use this to surface new, actionable items.\n- \\`\"read\"\\` — only notifications the user has already read.\n- \\`\"saved\"\\` — only notifications the user has explicitly saved/bookmarked.\n- \\`\"all\"\\` — all notifications regardless of read or saved status.\n\nAdditional filters can be combined with \\`view\\`:\n- \\`search\\` — free-text search across notification titles and descriptions.\n- \\`topic\\` — filter to a specific topic string, e.g. \"ci/cd\" or \"deployment\".\n- \\`minimumSeverity\\` — minimum severity level; returns this severity and anything more severe (\"critical\" > \"high\" > \"normal\" > \"low\").\n- \\`createdAfter\\` — ISO 8601 datetime string; only return notifications created after this time.\n\n## Pagination\n\nUse \\`offset\\` and \\`limit\\` to paginate. The response includes \\`totalCount\\` so you can calculate further pages.\n\n## Examples\n\n- Get my unread notifications: use default values (no input required).\n- Get all notifications from the past week: set \\`view: \"all\"\\` and \\`createdAfter\\` to 7 days ago.\n- Get high-priority unread alerts: set \\`minimumSeverity: \"high\"\\` (view defaults to \"unread\").\n `,\n attributes: {\n destructive: false,\n readOnly: true,\n idempotent: true,\n },\n schema: {\n input: z =>\n z.object({\n view: z\n .enum(['unread', 'read', 'saved', 'all'])\n .optional()\n .describe(\n 'Which notifications to return. Defaults to \"unread\". \"unread\" returns only unread notifications, \"read\" returns only read notifications, \"saved\" returns bookmarked notifications, \"all\" returns everything.',\n ),\n search: z\n .string()\n .optional()\n .describe(\n 'Free-text search string to filter notifications by title or description.',\n ),\n topic: z\n .string()\n .optional()\n .describe(\n 'Filter to notifications with this specific topic, e.g. \"ci/cd\".',\n ),\n minimumSeverity: z\n .enum(['critical', 'high', 'normal', 'low'])\n .optional()\n .describe(\n 'Minimum severity to include. \"critical\" is most severe, \"low\" is least. For example, \"high\" returns \"critical\" and \"high\" notifications only.',\n ),\n createdAfter: z\n .string()\n .optional()\n .describe(\n 'ISO 8601 datetime string. Only return notifications created after this time, e.g. \"2025-01-01T00:00:00Z\".',\n ),\n offset: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe(\n 'Number of notifications to skip for pagination. Defaults to 0.',\n ),\n limit: z\n .number()\n .int()\n .min(1)\n .max(100)\n .optional()\n .describe(\n 'Maximum number of notifications to return (1–100). Defaults to 10.',\n ),\n }),\n output: z =>\n z.object({\n notifications: z\n .array(z.object({}).passthrough())\n .describe('List of notifications matching the filters.'),\n totalCount: z\n .number()\n .describe(\n 'Total number of notifications matching the filters, useful for pagination.',\n ),\n }),\n },\n examples: [\n {\n title: 'Get my unread notifications',\n description: 'Returns up to 10 unread notifications (the default).',\n input: {},\n output: {\n notifications: [\n {\n id: 'abc123',\n origin: 'catalog',\n created: '2025-04-01T10:00:00.000Z',\n payload: {\n title: 'Component entity missing owner',\n severity: 'high',\n link: '/catalog/default/component/my-service',\n },\n },\n ],\n totalCount: 1,\n },\n },\n {\n title: 'Get all notifications from the past week',\n input: {\n view: 'all',\n createdAfter: '2025-04-03T00:00:00Z',\n limit: 25,\n },\n },\n {\n title: 'Get high-priority unread alerts',\n input: { minimumSeverity: 'high' },\n },\n ],\n action: async ({ input, credentials, logger }) => {\n if (!auth.isPrincipal(credentials, 'user')) {\n throw new NotAllowedError('This action requires user credentials');\n }\n\n const { userEntityRef } = credentials.principal;\n\n logger.info(\n `Fetching notifications for user \"${userEntityRef}\" (view=${\n input.view ?? 'unread'\n })`,\n );\n\n let read: boolean | undefined;\n if (input.view === 'unread' || input.view === undefined) {\n read = false;\n } else if (input.view === 'read') {\n read = true;\n }\n\n const opts = {\n user: userEntityRef,\n offset: input.offset ?? 0,\n limit: input.limit ?? 10,\n search: input.search,\n topic: input.topic,\n minimumSeverity: input.minimumSeverity,\n createdAfter: input.createdAfter\n ? new Date(input.createdAfter)\n : undefined,\n read,\n saved: input.view === 'saved' ? true : undefined,\n };\n\n const [notifications, totalCount] = await Promise.all([\n store.getNotifications(opts),\n store.getNotificationsCount(opts),\n ]);\n\n return {\n output: {\n notifications,\n totalCount,\n },\n };\n },\n });\n};\n"],"names":["NotAllowedError"],"mappings":";;;;AAoBO,MAAM,+BAA+B,CAAC;AAAA,EAC3C,KAAA;AAAA,EACA,IAAA;AAAA,EACA;AACF,CAAA,KAIM;AACJ,EAAA,eAAA,CAAgB,QAAA,CAAS;AAAA,IACvB,IAAA,EAAM,mBAAA;AAAA,IACN,KAAA,EAAO,mBAAA;AAAA,IACP,WAAA,EAAa;AAAA;;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA,IAAA,CAAA;AAAA,IA+Bb,UAAA,EAAY;AAAA,MACV,WAAA,EAAa,KAAA;AAAA,MACb,QAAA,EAAU,IAAA;AAAA,MACV,UAAA,EAAY;AAAA,KACd;AAAA,IACA,MAAA,EAAQ;AAAA,MACN,KAAA,EAAO,CAAA,CAAA,KACL,CAAA,CAAE,MAAA,CAAO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AAW,KAAA,CAAM,IAAA,KAAS,MAAA,EAAQ;AAChC,QAAA,IAAA,GAAO,IAAA;AAAA,MACT;AAEA,MAAA,MAAM,IAAA,GAAO;AAAA,QACX,IAAA,EAAM,aAAA;AAAA,QACN,MAAA,EAAQ,MAAM,MAAA,IAAU,CAAA;AAAA,QACxB,KAAA,EAAO,MAAM,KAAA,IAAS,EAAA;AAAA,QACtB,QAAQ,KAAA,CAAM,MAAA;AAAA,QACd,OAAO,KAAA,CAAM,KAAA;AAAA,QACb,iBAAiB,KAAA,CAAM,eAAA;AAAA,QACvB,cAAc,KAAA,CAAM,YAAA,GAChB,IAAI,IAAA,CAAK,KAAA,CAAM,YAAY,CAAA,GAC3B,MAAA;AAAA,QACJ,IAAA;AAAA,QACA,KAAA,EAAO,KAAA,CAAM,IAAA,KAAS,OAAA,GAAU,IAAA,GAAO;AAAA,OACzC;AAEA,MAAA,MAAM,CAAC,aAAA,EAAe,UAAU,CAAA,GAAI,MAAM,QAAQ,GAAA,CAAI;AAAA,QACpD,KAAA,CAAM,iBAAiB,IAAI,CAAA;AAAA,QAC3B,KAAA,CAAM,sBAAsB,IAAI;AAAA,OACjC,CAAA;AAED,MAAA,OAAO;AAAA,QACL,MAAA,EAAQ;AAAA,UACN,aAAA;AAAA,UACA;AAAA;AACF,OACF;AAAA,IACF;AAAA,GACD,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"createGetNotificationsAction.cjs.js","sources":["../../src/actions/createGetNotificationsAction.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { ActionsRegistryService } from '@backstage/backend-plugin-api/alpha';\nimport { AuthService } from '@backstage/backend-plugin-api';\nimport { NotAllowedError } from '@backstage/errors';\nimport { NotificationsStore } from '../database';\n\nexport const createGetNotificationsAction = ({\n store,\n auth,\n actionsRegistry,\n}: {\n store: NotificationsStore;\n auth: AuthService;\n actionsRegistry: ActionsRegistryService;\n}) => {\n actionsRegistry.register({\n name: 'get-notifications',\n title: 'Get Notifications',\n description: `\nFetches notifications for the currently authenticated user from the Backstage notifications system.\n\nEach notification has an \\`id\\`, \\`origin\\` (the plugin or service that sent it), a \\`payload\\` with\n\\`title\\`, optional \\`description\\`, optional \\`link\\`, \\`severity\\` (one of \"critical\", \"high\", \"normal\", \"low\"),\nand optional \\`topic\\`. Notifications also carry \\`created\\` and optionally \\`read\\`, \\`saved\\`, and \\`updated\\` timestamps.\n\n## Filters\n\nUse the \\`view\\` field to control which notifications are returned:\n- \\`\"unread\"\\` (default) — only notifications the user has not yet read. Use this to surface new, actionable items.\n- \\`\"read\"\\` — only notifications the user has already read.\n- \\`\"saved\"\\` — only notifications the user has explicitly saved/bookmarked.\n- \\`\"all\"\\` — all notifications regardless of read or saved status.\n\nAdditional filters can be combined with \\`view\\`:\n- \\`search\\` — free-text search across notification titles and descriptions.\n- \\`topic\\` — filter to a specific topic string, e.g. \"ci/cd\" or \"deployment\".\n- \\`minimumSeverity\\` — minimum severity level; returns this severity and anything more severe (\"critical\" > \"high\" > \"normal\" > \"low\").\n- \\`createdAfter\\` — ISO 8601 datetime string; only return notifications created after this time.\n\n## Pagination\n\nUse \\`offset\\` and \\`limit\\` to paginate. The response includes \\`totalCount\\` so you can calculate further pages.\n\n## Examples\n\n- Get my unread notifications: use default values (no input required).\n- Get all notifications from the past week: set \\`view: \"all\"\\` and \\`createdAfter\\` to 7 days ago.\n- Get high-priority unread alerts: set \\`minimumSeverity: \"high\"\\` (view defaults to \"unread\").\n `,\n attributes: {\n destructive: false,\n readOnly: true,\n idempotent: true,\n },\n schema: {\n input: z =>\n z.object({\n view: z\n .enum(['unread', 'read', 'saved', 'all'])\n .optional()\n .describe(\n 'Which notifications to return. Defaults to \"unread\". \"unread\" returns only unread notifications, \"read\" returns only read notifications, \"saved\" returns bookmarked notifications, \"all\" returns everything.',\n ),\n search: z\n .string()\n .optional()\n .describe(\n 'Free-text search string to filter notifications by title or description.',\n ),\n topic: z\n .string()\n .optional()\n .describe(\n 'Filter to notifications with this specific topic, e.g. \"ci/cd\".',\n ),\n minimumSeverity: z\n .enum(['critical', 'high', 'normal', 'low'])\n .optional()\n .describe(\n 'Minimum severity to include. \"critical\" is most severe, \"low\" is least. For example, \"high\" returns \"critical\" and \"high\" notifications only.',\n ),\n createdAfter: z\n .string()\n .optional()\n .describe(\n 'ISO 8601 datetime string. Only return notifications created after this time, e.g. \"2025-01-01T00:00:00Z\".',\n ),\n offset: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe(\n 'Number of notifications to skip for pagination. Defaults to 0.',\n ),\n limit: z\n .number()\n .int()\n .min(1)\n .max(100)\n .optional()\n .describe(\n 'Maximum number of notifications to return (1–100). Defaults to 10.',\n ),\n }),\n output: z =>\n z.object({\n notifications: z\n .array(z.object({}).passthrough())\n .describe('List of notifications matching the filters.'),\n totalCount: z\n .number()\n .describe(\n 'Total number of notifications matching the filters, useful for pagination.',\n ),\n }),\n },\n examples: [\n {\n title: 'Get my unread notifications',\n description: 'Returns up to 10 unread notifications (the default).',\n input: {},\n output: {\n notifications: [\n {\n id: 'abc123',\n origin: 'catalog',\n created: '2025-04-01T10:00:00.000Z',\n payload: {\n title: 'Component entity missing owner',\n severity: 'high',\n link: '/catalog/default/component/my-service',\n },\n },\n ],\n totalCount: 1,\n },\n },\n {\n title: 'Get all notifications from the past week',\n input: {\n view: 'all',\n createdAfter: '2025-04-03T00:00:00Z',\n limit: 25,\n },\n },\n {\n title: 'Get high-priority unread alerts',\n input: { minimumSeverity: 'high' },\n },\n ],\n action: async ({ input, credentials, logger }) => {\n if (!auth.isPrincipal(credentials, 'user')) {\n throw new NotAllowedError('This action requires user credentials');\n }\n\n const { userEntityRef } = credentials.principal;\n\n logger.info(\n `Fetching notifications for user \"${userEntityRef}\" (view=${\n input.view ?? 'unread'\n })`,\n );\n\n let read: boolean | undefined;\n if (input.view === 'unread' || input.view === undefined) {\n read = false;\n } else if (input.view === 'read') {\n read = true;\n }\n\n const opts = {\n user: userEntityRef,\n offset: input.offset ?? 0,\n limit: input.limit ?? 10,\n search: input.search,\n topic: input.topic,\n minimumSeverity: input.minimumSeverity,\n createdAfter: input.createdAfter\n ? new Date(input.createdAfter)\n : undefined,\n read,\n saved: input.view === 'saved' ? true : undefined,\n };\n\n const [notifications, totalCount] = await Promise.all([\n store.getNotifications(opts),\n store.getNotificationsCount(opts),\n ]);\n\n return {\n output: {\n notifications,\n totalCount,\n },\n };\n },\n });\n};\n"],"names":["NotAllowedError"],"mappings":";;;;AAoBO,MAAM,+BAA+B,CAAC;AAAA,EAC3C,KAAA;AAAA,EACA,IAAA;AAAA,EACA;AACF,CAAA,KAIM;AACJ,EAAA,eAAA,CAAgB,QAAA,CAAS;AAAA,IACvB,IAAA,EAAM,mBAAA;AAAA,IACN,KAAA,EAAO,mBAAA;AAAA,IACP,WAAA,EAAa;AAAA;;AAAA;AAAA;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;AAAA;AAAA;AAAA,IAAA,CAAA;AAAA,IA+Bb,UAAA,EAAY;AAAA,MACV,WAAA,EAAa,KAAA;AAAA,MACb,QAAA,EAAU,IAAA;AAAA,MACV,UAAA,EAAY;AAAA,KACd;AAAA,IACA,MAAA,EAAQ;AAAA,MACN,KAAA,EAAO,CAAA,CAAA,KACL,CAAA,CAAE,MAAA,CAAO;AAAA,QACP,IAAA,EAAM,CAAA,CACH,IAAA,CAAK,CAAC,QAAA,EAAU,MAAA,EAAQ,OAAA,EAAS,KAAK,CAAC,CAAA,CACvC,Q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AA,QACX,IAAA,EAAM,aAAA;AAAA,QACN,MAAA,EAAQ,MAAM,MAAA,IAAU,CAAA;AAAA,QACxB,KAAA,EAAO,MAAM,KAAA,IAAS,EAAA;AAAA,QACtB,QAAQ,KAAA,CAAM,MAAA;AAAA,QACd,OAAO,KAAA,CAAM,KAAA;AAAA,QACb,iBAAiB,KAAA,CAAM,eAAA;AAAA,QACvB,cAAc,KAAA,CAAM,YAAA,GAChB,IAAI,IAAA,CAAK,KAAA,CAAM,YAAY,CAAA,GAC3B,MAAA;AAAA,QACJ,IAAA;AAAA,QACA,KAAA,EAAO,KAAA,CAAM,IAAA,KAAS,OAAA,GAAU,IAAA,GAAO;AAAA,OACzC;AAEA,MAAA,MAAM,CAAC,aAAA,EAAe,UAAU,CAAA,GAAI,MAAM,QAAQ,GAAA,CAAI;AAAA,QACpD,KAAA,CAAM,iBAAiB,IAAI,CAAA;AAAA,QAC3B,KAAA,CAAM,sBAAsB,IAAI;AAAA,OACjC,CAAA;AAED,MAAA,OAAO;AAAA,QACL,MAAA,EAAQ;AAAA,UACN,aAAA;AAAA,UACA;AAAA;AACF,OACF;AAAA,IACF;AAAA,GACD,CAAA;AACH;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../../src/actions/index.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { ActionsRegistryService } from '@backstage/backend-plugin-api/alpha';\nimport { AuthService } from '@backstage/backend-plugin-api';\nimport { NotificationsStore } from '../database';\nimport { createGetNotificationsAction } from './createGetNotificationsAction';\n\nexport const createNotificationsActions = (options: {\n actionsRegistry: ActionsRegistryService;\n auth: AuthService;\n store: NotificationsStore;\n}) => {\n createGetNotificationsAction(options);\n};\n"],"names":["createGetNotificationsAction"],"mappings":";;;;AAoBO,MAAM,0BAAA,GAA6B,CAAC,OAAA,KAIrC;AACJ,EAAAA,yDAAA,CAA6B,OAAO,CAAA;AACtC;;;;"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../../src/actions/index.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { ActionsRegistryService } from '@backstage/backend-plugin-api/alpha';\nimport { AuthService } from '@backstage/backend-plugin-api';\nimport { NotificationsStore } from '../database';\nimport { createGetNotificationsAction } from './createGetNotificationsAction';\n\nexport const createNotificationsActions = (options: {\n actionsRegistry: ActionsRegistryService;\n auth: AuthService;\n store: NotificationsStore;\n}) => {\n createGetNotificationsAction(options);\n};\n"],"names":["createGetNotificationsAction"],"mappings":";;;;AAoBO,MAAM,0BAAA,GAA6B,CAAC,OAAA,KAIrC;AACJ,EAAAA,yDAAA,CAA6B,OAAO,CAAA;AACtC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DatabaseNotificationsStore.cjs.js","sources":["../../src/database/DatabaseNotificationsStore.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 DatabaseService,\n resolvePackagePath,\n} from '@backstage/backend-plugin-api';\nimport {\n NotificationGetOptions,\n NotificationModifyOptions,\n NotificationsStore,\n TopicGetOptions,\n} from './NotificationsStore';\nimport {\n Notification,\n NotificationSettings,\n notificationSeverities,\n NotificationSeverity,\n} from '@backstage/plugin-notifications-common';\nimport { Knex } from 'knex';\nimport crypto from 'node:crypto';\nimport { durationToMilliseconds, HumanDuration } from '@backstage/types';\n\nconst migrationsDir = resolvePackagePath(\n '@backstage/plugin-notifications-backend',\n 'migrations',\n);\n\nconst NOTIFICATION_COLUMNS = [\n 'id',\n 'title',\n 'description',\n 'severity',\n 'link',\n 'origin',\n 'scope',\n 'topic',\n 'icon',\n 'created',\n 'updated',\n 'user',\n 'read',\n 'saved',\n];\n\ntype NotificationRowType = {\n id: string;\n user: string;\n title: string;\n description?: string | null;\n severity: string;\n link: string | null;\n origin: string;\n scope: string | null;\n topic: string | null;\n created: Date;\n updated: Date | null;\n read: Date | null;\n saved: Date | null;\n icon: string | null;\n};\n\ntype BroadcastRowType = {\n id: string;\n title: string;\n description: string | null;\n link: string | null;\n origin: string;\n scope: string | null;\n topic: string | null;\n created: Date;\n updated: Date | null;\n icon: string | null;\n};\n\ntype BroadcastUserStatusRowType = {\n broadcast_id: string;\n user: string;\n read: Date | null;\n saved: Date | null;\n};\n\ntype UserSettingsRowType = {\n user: string;\n channel: string;\n origin: string;\n enabled: boolean;\n};\n\nexport const normalizeSeverity = (input?: string): NotificationSeverity => {\n let lower = (input ?? 'normal').toLowerCase() as NotificationSeverity;\n if (notificationSeverities.indexOf(lower) < 0) {\n lower = 'normal';\n }\n return lower;\n};\n\nexport const generateSettingsHash = (\n user: string,\n channel: string,\n origin: string,\n topic: string | null,\n): string => {\n const rawKey = `${user}|${channel}|${origin}|${topic ?? ''}`;\n return crypto.createHash('sha256').update(rawKey).digest('hex');\n};\n\n/** @internal */\nexport class DatabaseNotificationsStore implements NotificationsStore {\n private readonly isSQLite = false;\n\n private readonly db: Knex;\n\n private constructor(db: Knex) {\n this.db = db;\n this.isSQLite = this.db.client.config.client.includes('sqlite3');\n }\n\n static async create({\n database,\n skipMigrations,\n }: {\n database: DatabaseService;\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.type === 'broadcast' ? null : row.user,\n created: new Date(row.created),\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 mapToNotificationSettings = (rows: any[]): NotificationSettings => {\n return rows.reduce(\n (acc, row) => {\n let chan = acc.channels.find(\n (channel: { id: string }) => channel.id === row.channel,\n );\n if (!chan) {\n acc.channels.push({\n id: row.channel,\n origins: [],\n });\n chan = acc.channels[acc.channels.length - 1];\n }\n let origin = chan.origins.find(\n (ori: { id: string }) => ori.id === row.origin,\n );\n if (!origin) {\n origin = {\n id: row.origin,\n enabled: true,\n topics: [],\n };\n chan.origins.push(origin);\n }\n if (row.topic === null) {\n origin.enabled = Boolean(row.enabled);\n } else {\n let topic = origin.topics.find(\n (top: { id: string }) => top.id === row.topic,\n );\n if (!topic) {\n topic = {\n id: row.topic,\n enabled: Boolean(row.enabled),\n };\n origin.topics.push(topic);\n }\n }\n return acc;\n },\n { channels: [] },\n );\n };\n\n private mapNotificationToDbRow = (notification: Notification) => {\n return {\n id: notification.id,\n user: notification.user,\n origin: notification.origin,\n created: notification.created,\n topic: notification.payload?.topic,\n link: notification.payload?.link,\n title: notification.payload?.title,\n description: notification.payload?.description,\n severity: normalizeSeverity(notification.payload?.severity),\n scope: notification.payload?.scope,\n icon: notification.payload.icon,\n saved: notification.saved,\n read: notification.read,\n };\n };\n\n private mapBroadcastToDbRow = (notification: Notification) => {\n return {\n id: notification.id,\n origin: notification.origin,\n created: notification.created,\n topic: notification.payload?.topic,\n link: notification.payload?.link,\n title: notification.payload?.title,\n description: notification.payload?.description,\n severity: normalizeSeverity(notification.payload?.severity),\n icon: notification.payload.icon,\n scope: notification.payload?.scope,\n };\n };\n\n private getBroadcastUnion = (user?: string | null) => {\n return this.db<BroadcastRowType>('broadcast')\n .leftJoin('broadcast_user_status', function clause() {\n const join = this.on('id', '=', 'broadcast_user_status.broadcast_id');\n if (user !== null && user !== undefined) {\n join.andOnVal('user', '=', user);\n }\n })\n .select([...NOTIFICATION_COLUMNS, this.db.raw(\"'broadcast' as type\")]);\n };\n\n private getNotificationsBaseQuery = (\n options: NotificationGetOptions | NotificationModifyOptions,\n ) => {\n const { user, orderField } = options;\n\n const subQuery = this.db<NotificationRowType>('notification')\n .select([...NOTIFICATION_COLUMNS, this.db.raw(\"'entity' as type\")])\n .unionAll([this.getBroadcastUnion(user)])\n .as('notifications');\n\n const query = this.db.from(subQuery).where(q => {\n q.where('user', user).orWhereNull('user');\n });\n\n if (orderField && orderField.length > 0) {\n orderField.forEach(orderBy => {\n query.orderBy(orderBy.field, orderBy.order);\n });\n } else if (!orderField) {\n query.orderBy('created', 'desc');\n }\n\n if (options.createdAfter) {\n if (this.isSQLite) {\n query.where('created', '>=', options.createdAfter.valueOf());\n } else {\n query.where('created', '>=', options.createdAfter.toISOString());\n }\n }\n\n if (options.limit !== undefined) {\n query.limit(options.limit);\n }\n\n if (options.offset !== undefined) {\n query.offset(options.offset);\n }\n\n if (options.search) {\n query.whereRaw(\n `(LOWER(title) LIKE LOWER(?) OR LOWER(description) LIKE LOWER(?))`,\n [`%${options.search}%`, `%${options.search}%`],\n );\n }\n\n if (options.ids) {\n query.whereIn('id', options.ids);\n }\n\n if (options.read) {\n query.whereNotNull('read');\n } else if (options.read === false) {\n query.whereNull('read');\n } // or match both if undefined\n\n if (options.topic) {\n query.where('topic', '=', options.topic);\n }\n\n if (options.saved) {\n query.whereNotNull('saved');\n } else if (options.saved === false) {\n query.whereNull('saved');\n } // or match both if undefined\n\n if (options.minimumSeverity !== undefined) {\n const idx = notificationSeverities.indexOf(options.minimumSeverity);\n const equalOrHigher = notificationSeverities.slice(0, idx + 1);\n query.whereIn('severity', equalOrHigher);\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 ...NOTIFICATION_COLUMNS,\n 'type',\n ]);\n return this.mapToNotifications(notifications);\n }\n\n async getNotificationsCount(options: NotificationGetOptions) {\n const countOptions: NotificationGetOptions = { ...options };\n countOptions.limit = undefined;\n countOptions.offset = undefined;\n countOptions.orderField = [];\n const notificationQuery = this.getNotificationsBaseQuery(countOptions);\n const response = await notificationQuery.count('id as CNT');\n return Number(response[0].CNT);\n }\n\n async saveNotification(notification: Notification) {\n await this.db\n .insert(this.mapNotificationToDbRow(notification))\n .into('notification');\n }\n\n async saveBroadcast(notification: Notification) {\n await this.db\n .insert(this.mapBroadcastToDbRow(notification))\n .into('broadcast');\n if (notification.saved || notification.read) {\n await this.db\n .insert({\n user: notification.user,\n broadcast_id: notification.id,\n saved: notification.saved,\n read: notification.read,\n })\n .into('broadcast_user_status');\n }\n }\n\n async getStatus(options: NotificationGetOptions) {\n const notificationQuery = this.getNotificationsBaseQuery({\n ...options,\n orderField: [],\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<NotificationRowType>('notification')\n .where('user', options.user)\n .where('scope', options.scope)\n .where('origin', options.origin)\n .limit(1);\n\n const rows = await query;\n if (!rows || rows.length === 0) {\n return null;\n }\n return this.mapToNotifications(rows)[0];\n }\n\n async getExistingScopeBroadcast(options: { scope: string; origin: string }) {\n const query = this.db<BroadcastRowType>('broadcast')\n .where('scope', options.scope)\n .where('origin', options.origin)\n .limit(1);\n\n const rows = await query;\n if (!rows || rows.length === 0) {\n return null;\n }\n return this.mapToNotifications(rows)[0];\n }\n\n async restoreExistingNotification({\n id,\n notification,\n }: {\n id: string;\n notification: Notification;\n }) {\n const updateColumns = {\n title: notification.payload.title,\n description: notification.payload.description,\n link: notification.payload.link,\n topic: notification.payload.topic,\n updated: new Date(),\n severity: normalizeSeverity(notification.payload?.severity),\n read: null,\n };\n\n const notificationQuery = this.db('notification')\n .where('id', id)\n .where('user', notification.user);\n const broadcastQuery = this.db('broadcast').where('id', id);\n\n await Promise.all([\n notificationQuery.update(updateColumns),\n broadcastQuery.update({ ...updateColumns, read: undefined }),\n ]);\n\n return await this.getNotification({ id, user: notification.user });\n }\n\n async getNotification(options: {\n id: string;\n user?: string | null;\n }): Promise<Notification | null> {\n const rows = await this.db\n .select('*')\n .from(\n this.db<NotificationRowType>('notification')\n .select([...NOTIFICATION_COLUMNS, this.db.raw(\"'entity' as type\")])\n .unionAll([this.getBroadcastUnion(options.user)])\n .as('notifications'),\n )\n .where('id', options.id)\n .limit(1);\n if (!rows || rows.length === 0) {\n return null;\n }\n return this.mapToNotifications(rows)[0];\n }\n\n private markReadSaved = async (\n ids: string[],\n user: string,\n read?: Date | null,\n saved?: Date | null,\n ) => {\n await this.db<NotificationRowType>('notification')\n .whereIn('id', ids)\n .where('user', user)\n .update({ read, saved });\n\n const broadcasts = this.mapToNotifications(\n await this.db('broadcast').whereIn('id', ids).select(),\n );\n\n if (broadcasts.length > 0)\n if (!this.isSQLite) {\n await this.db<BroadcastUserStatusRowType>('broadcast_user_status')\n .insert(\n broadcasts.map(b => ({\n broadcast_id: b.id,\n user,\n read,\n saved,\n })),\n )\n .onConflict(['broadcast_id', 'user'])\n .merge(['read', 'saved']);\n } else {\n // SQLite does not support upsert so fall back to this (mostly for tests and local dev)\n for (const b of broadcasts) {\n const baseQuery = this.db<BroadcastUserStatusRowType>(\n 'broadcast_user_status',\n )\n .where('broadcast_id', b.id)\n .where('user', user);\n const exists = await baseQuery.clone().limit(1).select().first();\n if (exists) {\n await baseQuery.clone().update({ read, saved });\n } else {\n await baseQuery\n .clone()\n .insert({ broadcast_id: b.id, user, read, saved });\n }\n }\n }\n };\n\n async markRead(options: NotificationModifyOptions): Promise<void> {\n await this.markReadSaved(options.ids, options.user, new Date(), undefined);\n }\n\n async markUnread(options: NotificationModifyOptions): Promise<void> {\n await this.markReadSaved(options.ids, options.user, null, undefined);\n }\n\n async markSaved(options: NotificationModifyOptions): Promise<void> {\n await this.markReadSaved(options.ids, options.user, undefined, new Date());\n }\n\n async markUnsaved(options: NotificationModifyOptions): Promise<void> {\n await this.markReadSaved(options.ids, options.user, undefined, null);\n }\n\n async getUserNotificationOrigins(options: {\n user: string;\n }): Promise<{ origins: string[] }> {\n const rows: { origin: string }[] = await this.db<NotificationRowType>(\n 'notification',\n )\n .where('user', options.user)\n .select('origin')\n .distinct();\n return { origins: rows.map(row => row.origin) };\n }\n\n async getUserNotificationTopics(options: {\n user: string;\n }): Promise<{ topics: { origin: string; topic: string }[] }> {\n const rows: { topic: string; origin: string }[] =\n await this.db<NotificationRowType>('notification')\n .where('user', options.user)\n .select('topic', 'origin')\n .whereNotNull('topic')\n .distinct();\n\n return {\n topics: rows.map(row => ({ origin: row.origin, topic: row.topic })),\n };\n }\n\n async getNotificationSettings(options: {\n user: string;\n origin?: string;\n channel?: string;\n topic?: string;\n }): Promise<NotificationSettings> {\n const settingsQuery = this.db<UserSettingsRowType>('user_settings').where(\n 'user',\n options.user,\n );\n if (options.origin) {\n settingsQuery.where('origin', options.origin);\n }\n\n if (options.channel) {\n settingsQuery.where('channel', options.channel);\n }\n\n if (options.topic) {\n settingsQuery.where('topic', options.topic);\n }\n const settings = await settingsQuery.select();\n return this.mapToNotificationSettings(settings);\n }\n\n async saveNotificationSettings(options: {\n user: string;\n settings: NotificationSettings;\n }): Promise<void> {\n const rows: {\n settings_key_hash: string;\n user: string;\n channel: string;\n origin: string;\n topic: string | null;\n enabled: boolean;\n }[] = [];\n\n options.settings.channels.forEach(channel => {\n channel.origins.forEach(origin => {\n rows.push({\n settings_key_hash: generateSettingsHash(\n options.user,\n channel.id,\n origin.id,\n null,\n ),\n user: options.user,\n channel: channel.id,\n origin: origin.id,\n topic: null,\n enabled: origin.enabled,\n });\n\n origin.topics?.forEach(topic => {\n rows.push({\n settings_key_hash: generateSettingsHash(\n options.user,\n channel.id,\n origin.id,\n topic.id,\n ),\n user: options.user,\n channel: channel.id,\n origin: origin.id,\n topic: topic.id,\n enabled: origin.enabled && topic.enabled,\n });\n });\n });\n });\n\n await this.db<UserSettingsRowType>('user_settings')\n .where('user', options.user)\n .delete();\n await this.db<UserSettingsRowType>('user_settings').insert(rows);\n }\n\n async getTopics(options: TopicGetOptions): Promise<{ topics: string[] }> {\n const notificationQuery = this.getNotificationsBaseQuery({\n ...options,\n orderField: [{ field: 'topic', order: 'asc' }],\n });\n const topics = await notificationQuery\n .whereNotNull('topic')\n .distinct(['topic']);\n return { topics: topics.map(row => row.topic) };\n }\n\n async clearNotifications(options: {\n maxAge: HumanDuration;\n }): Promise<{ deletedCount: number }> {\n const ms = durationToMilliseconds(options.maxAge);\n const now = new Date(new Date().getTime() - ms);\n const notificationsCount = await this.db('notification')\n .where(builder => {\n builder.where('created', '<=', now).whereNull('updated');\n })\n .orWhere('updated', '<=', now)\n .delete();\n const broadcastsCount = await this.db('broadcast')\n .where(builder => {\n builder.where('created', '<=', now).whereNull('updated');\n })\n .orWhere('updated', '<=', now)\n .delete();\n return { deletedCount: notificationsCount + broadcastsCount };\n }\n}\n"],"names":["resolvePackagePath","notificationSeverities","crypto","durationToMilliseconds"],"mappings":";;;;;;;;;;;AAmCA,MAAM,aAAA,GAAgBA,mCAAA;AAAA,EACpB,yCAAA;AAAA,EACA;AACF,CAAA;AAEA,MAAM,oBAAA,GAAuB;AAAA,EAC3B,IAAA;AAAA,EACA,OAAA;AAAA,EACA,aAAA;AAAA,EACA,UAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,MAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA;AA8CO,MAAM,iBAAA,GAAoB,CAAC,KAAA,KAAyC;AACzE,EAAA,IAAI,KAAA,GAAA,CAAS,KAAA,IAAS,QAAA,EAAU,WAAA,EAAY;AAC5C,EAAA,IAAIC,gDAAA,CAAuB,OAAA,CAAQ,KAAK,CAAA,GAAI,CAAA,EAAG;AAC7C,IAAA,KAAA,GAAQ,QAAA;AAAA,EACV;AACA,EAAA,OAAO,KAAA;AACT;AAEO,MAAM,oBAAA,GAAuB,CAClC,IAAA,EACA,OAAA,EACA,QACA,KAAA,KACW;AACX,EAAA,MAAM,MAAA,GAAS,GAAG,IAAI,CAAA,CAAA,EAAI,OAAO,CAAA,CAAA,EAAI,MAAM,CAAA,CAAA,EAAI,KAAA,IAAS,EAAE,CAAA,CAAA;AAC1D,EAAA,OAAOC,uBAAA,CAAO,WAAW,QAAQ,CAAA,CAAE,OAAO,MAAM,CAAA,CAAE,OAAO,KAAK,CAAA;AAChE;AAGO,MAAM,0BAAA,CAAyD;AAAA,EACnD,QAAA,GAAW,KAAA;AAAA,EAEX,EAAA;AAAA,EAET,YAAY,EAAA,EAAU;AAC5B,I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CAAa,OAAO,CAAA,CACpB,QAAA,CAAS,CAAC,OAAO,CAAC,CAAA;AACrB,IAAA,OAAO,EAAE,MAAA,EAAQ,MAAA,CAAO,IAAI,CAAA,GAAA,KAAO,GAAA,CAAI,KAAK,CAAA,EAAE;AAAA,EAChD;AAAA,EAEA,MAAM,mBAAmB,OAAA,EAEa;AACpC,IAAA,MAAM,EAAA,GAAKE,4BAAA,CAAuB,OAAA,CAAQ,MAAM,CAAA;AAChD,IAAA,MAAM,GAAA,GAAM,IAAI,IAAA,CAAA,iBAAK,IAAI,MAAK,EAAE,OAAA,KAAY,EAAE,CAAA;AAC9C,IAAA,MAAM,qBAAqB,MAAM,IAAA,CAAK,GAAG,cAAc,CAAA,CACpD,MAAM,CAAA,OAAA,KAAW;AAChB,MAAA,OAAA,CAAQ,MAAM,SAAA,EAAW,IAAA,EAAM,GAAG,CAAA,CAAE,UAAU,SAAS,CAAA;AAAA,IACzD,CAAC,CAAA,CACA,OAAA,CAAQ,WAAW,IAAA,EAAM,GAAG,EAC5B,MAAA,EAAO;AACV,IAAA,MAAM,kBAAkB,MAAM,IAAA,CAAK,GAAG,WAAW,CAAA,CAC9C,MAAM,CAAA,OAAA,KAAW;AAChB,MAAA,OAAA,CAAQ,MAAM,SAAA,EAAW,IAAA,EAAM,GAAG,CAAA,CAAE,UAAU,SAAS,CAAA;AAAA,IACzD,CAAC,CAAA,CACA,OAAA,CAAQ,WAAW,IAAA,EAAM,GAAG,EAC5B,MAAA,EAAO;AACV,IAAA,OAAO,EAAE,YAAA,EAAc,kBAAA,GAAqB,eAAA,EAAgB;AAAA,EAC9D;AACF;;;;;;"}
1
+ {"version":3,"file":"DatabaseNotificationsStore.cjs.js","sources":["../../src/database/DatabaseNotificationsStore.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 DatabaseService,\n resolvePackagePath,\n} from '@backstage/backend-plugin-api';\nimport {\n NotificationGetOptions,\n NotificationModifyOptions,\n NotificationsStore,\n TopicGetOptions,\n} from './NotificationsStore';\nimport {\n Notification,\n NotificationSettings,\n notificationSeverities,\n NotificationSeverity,\n} from '@backstage/plugin-notifications-common';\nimport { Knex } from 'knex';\nimport crypto from 'node:crypto';\nimport { durationToMilliseconds, HumanDuration } from '@backstage/types';\n\nconst migrationsDir = resolvePackagePath(\n '@backstage/plugin-notifications-backend',\n 'migrations',\n);\n\nconst NOTIFICATION_COLUMNS = [\n 'id',\n 'title',\n 'description',\n 'severity',\n 'link',\n 'origin',\n 'scope',\n 'topic',\n 'icon',\n 'created',\n 'updated',\n 'user',\n 'read',\n 'saved',\n];\n\ntype NotificationRowType = {\n id: string;\n user: string;\n title: string;\n description?: string | null;\n severity: string;\n link: string | null;\n origin: string;\n scope: string | null;\n topic: string | null;\n created: Date;\n updated: Date | null;\n read: Date | null;\n saved: Date | null;\n icon: string | null;\n};\n\ntype BroadcastRowType = {\n id: string;\n title: string;\n description: string | null;\n link: string | null;\n origin: string;\n scope: string | null;\n topic: string | null;\n created: Date;\n updated: Date | null;\n icon: string | null;\n};\n\ntype BroadcastUserStatusRowType = {\n broadcast_id: string;\n user: string;\n read: Date | null;\n saved: Date | null;\n};\n\ntype UserSettingsRowType = {\n user: string;\n channel: string;\n origin: string;\n enabled: boolean;\n};\n\nexport const normalizeSeverity = (input?: string): NotificationSeverity => {\n let lower = (input ?? 'normal').toLowerCase() as NotificationSeverity;\n if (notificationSeverities.indexOf(lower) < 0) {\n lower = 'normal';\n }\n return lower;\n};\n\nexport const generateSettingsHash = (\n user: string,\n channel: string,\n origin: string,\n topic: string | null,\n): string => {\n const rawKey = `${user}|${channel}|${origin}|${topic ?? ''}`;\n return crypto.createHash('sha256').update(rawKey).digest('hex');\n};\n\n/** @internal */\nexport class DatabaseNotificationsStore implements NotificationsStore {\n private readonly isSQLite = false;\n\n private readonly db: Knex;\n\n private constructor(db: Knex) {\n this.db = db;\n this.isSQLite = this.db.client.config.client.includes('sqlite3');\n }\n\n static async create({\n database,\n skipMigrations,\n }: {\n database: DatabaseService;\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.type === 'broadcast' ? null : row.user,\n created: new Date(row.created),\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 mapToNotificationSettings = (rows: any[]): NotificationSettings => {\n return rows.reduce(\n (acc, row) => {\n let chan = acc.channels.find(\n (channel: { id: string }) => channel.id === row.channel,\n );\n if (!chan) {\n acc.channels.push({\n id: row.channel,\n origins: [],\n });\n chan = acc.channels[acc.channels.length - 1];\n }\n let origin = chan.origins.find(\n (ori: { id: string }) => ori.id === row.origin,\n );\n if (!origin) {\n origin = {\n id: row.origin,\n enabled: true,\n topics: [],\n };\n chan.origins.push(origin);\n }\n if (row.topic === null) {\n origin.enabled = Boolean(row.enabled);\n } else {\n let topic = origin.topics.find(\n (top: { id: string }) => top.id === row.topic,\n );\n if (!topic) {\n topic = {\n id: row.topic,\n enabled: Boolean(row.enabled),\n };\n origin.topics.push(topic);\n }\n }\n return acc;\n },\n { channels: [] },\n );\n };\n\n private mapNotificationToDbRow = (notification: Notification) => {\n return {\n id: notification.id,\n user: notification.user,\n origin: notification.origin,\n created: notification.created,\n topic: notification.payload?.topic,\n link: notification.payload?.link,\n title: notification.payload?.title,\n description: notification.payload?.description,\n severity: normalizeSeverity(notification.payload?.severity),\n scope: notification.payload?.scope,\n icon: notification.payload.icon,\n saved: notification.saved,\n read: notification.read,\n };\n };\n\n private mapBroadcastToDbRow = (notification: Notification) => {\n return {\n id: notification.id,\n origin: notification.origin,\n created: notification.created,\n topic: notification.payload?.topic,\n link: notification.payload?.link,\n title: notification.payload?.title,\n description: notification.payload?.description,\n severity: normalizeSeverity(notification.payload?.severity),\n icon: notification.payload.icon,\n scope: notification.payload?.scope,\n };\n };\n\n private getBroadcastUnion = (user?: string | null) => {\n return this.db<BroadcastRowType>('broadcast')\n .leftJoin('broadcast_user_status', function clause() {\n const join = this.on('id', '=', 'broadcast_user_status.broadcast_id');\n if (user !== null && user !== undefined) {\n join.andOnVal('user', '=', user);\n }\n })\n .select([...NOTIFICATION_COLUMNS, this.db.raw(\"'broadcast' as type\")]);\n };\n\n private getNotificationsBaseQuery = (\n options: NotificationGetOptions | NotificationModifyOptions,\n ) => {\n const { user, orderField } = options;\n\n const subQuery = this.db<NotificationRowType>('notification')\n .select([...NOTIFICATION_COLUMNS, this.db.raw(\"'entity' as type\")])\n .unionAll([this.getBroadcastUnion(user)])\n .as('notifications');\n\n const query = this.db.from(subQuery).where(q => {\n q.where('user', user).orWhereNull('user');\n });\n\n if (orderField && orderField.length > 0) {\n orderField.forEach(orderBy => {\n query.orderBy(orderBy.field, orderBy.order);\n });\n } else if (!orderField) {\n query.orderBy('created', 'desc');\n }\n\n if (options.createdAfter) {\n if (this.isSQLite) {\n query.where('created', '>=', options.createdAfter.valueOf());\n } else {\n query.where('created', '>=', options.createdAfter.toISOString());\n }\n }\n\n if (options.limit !== undefined) {\n query.limit(options.limit);\n }\n\n if (options.offset !== undefined) {\n query.offset(options.offset);\n }\n\n if (options.search) {\n query.whereRaw(\n `(LOWER(title) LIKE LOWER(?) OR LOWER(description) LIKE LOWER(?))`,\n [`%${options.search}%`, `%${options.search}%`],\n );\n }\n\n if (options.ids) {\n query.whereIn('id', options.ids);\n }\n\n if (options.read) {\n query.whereNotNull('read');\n } else if (options.read === false) {\n query.whereNull('read');\n } // or match both if undefined\n\n if (options.topic) {\n query.where('topic', '=', options.topic);\n }\n\n if (options.saved) {\n query.whereNotNull('saved');\n } else if (options.saved === false) {\n query.whereNull('saved');\n } // or match both if undefined\n\n if (options.minimumSeverity !== undefined) {\n const idx = notificationSeverities.indexOf(options.minimumSeverity);\n const equalOrHigher = notificationSeverities.slice(0, idx + 1);\n query.whereIn('severity', equalOrHigher);\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 ...NOTIFICATION_COLUMNS,\n 'type',\n ]);\n return this.mapToNotifications(notifications);\n }\n\n async getNotificationsCount(options: NotificationGetOptions) {\n const countOptions: NotificationGetOptions = { ...options };\n countOptions.limit = undefined;\n countOptions.offset = undefined;\n countOptions.orderField = [];\n const notificationQuery = this.getNotificationsBaseQuery(countOptions);\n const response = await notificationQuery.count('id as CNT');\n return Number(response[0].CNT);\n }\n\n async saveNotification(notification: Notification) {\n await this.db\n .insert(this.mapNotificationToDbRow(notification))\n .into('notification');\n }\n\n async saveBroadcast(notification: Notification) {\n await this.db\n .insert(this.mapBroadcastToDbRow(notification))\n .into('broadcast');\n if (notification.saved || notification.read) {\n await this.db\n .insert({\n user: notification.user,\n broadcast_id: notification.id,\n saved: notification.saved,\n read: notification.read,\n })\n .into('broadcast_user_status');\n }\n }\n\n async getStatus(options: NotificationGetOptions) {\n const notificationQuery = this.getNotificationsBaseQuery({\n ...options,\n orderField: [],\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<NotificationRowType>('notification')\n .where('user', options.user)\n .where('scope', options.scope)\n .where('origin', options.origin)\n .limit(1);\n\n const rows = await query;\n if (!rows || rows.length === 0) {\n return null;\n }\n return this.mapToNotifications(rows)[0];\n }\n\n async getExistingScopeBroadcast(options: { scope: string; origin: string }) {\n const query = this.db<BroadcastRowType>('broadcast')\n .where('scope', options.scope)\n .where('origin', options.origin)\n .limit(1);\n\n const rows = await query;\n if (!rows || rows.length === 0) {\n return null;\n }\n return this.mapToNotifications(rows)[0];\n }\n\n async restoreExistingNotification({\n id,\n notification,\n }: {\n id: string;\n notification: Notification;\n }) {\n const updateColumns = {\n title: notification.payload.title,\n description: notification.payload.description,\n link: notification.payload.link,\n topic: notification.payload.topic,\n updated: new Date(),\n severity: normalizeSeverity(notification.payload?.severity),\n read: null,\n };\n\n const notificationQuery = this.db('notification')\n .where('id', id)\n .where('user', notification.user);\n const broadcastQuery = this.db('broadcast').where('id', id);\n\n await Promise.all([\n notificationQuery.update(updateColumns),\n broadcastQuery.update({ ...updateColumns, read: undefined }),\n ]);\n\n return await this.getNotification({ id, user: notification.user });\n }\n\n async getNotification(options: {\n id: string;\n user?: string | null;\n }): Promise<Notification | null> {\n const rows = await this.db\n .select('*')\n .from(\n this.db<NotificationRowType>('notification')\n .select([...NOTIFICATION_COLUMNS, this.db.raw(\"'entity' as type\")])\n .unionAll([this.getBroadcastUnion(options.user)])\n .as('notifications'),\n )\n .where('id', options.id)\n .limit(1);\n if (!rows || rows.length === 0) {\n return null;\n }\n return this.mapToNotifications(rows)[0];\n }\n\n private markReadSaved = async (\n ids: string[],\n user: string,\n read?: Date | null,\n saved?: Date | null,\n ) => {\n await this.db<NotificationRowType>('notification')\n .whereIn('id', ids)\n .where('user', user)\n .update({ read, saved });\n\n const broadcasts = this.mapToNotifications(\n await this.db('broadcast').whereIn('id', ids).select(),\n );\n\n if (broadcasts.length > 0)\n if (!this.isSQLite) {\n await this.db<BroadcastUserStatusRowType>('broadcast_user_status')\n .insert(\n broadcasts.map(b => ({\n broadcast_id: b.id,\n user,\n read,\n saved,\n })),\n )\n .onConflict(['broadcast_id', 'user'])\n .merge(['read', 'saved']);\n } else {\n // SQLite does not support upsert so fall back to this (mostly for tests and local dev)\n for (const b of broadcasts) {\n const baseQuery = this.db<BroadcastUserStatusRowType>(\n 'broadcast_user_status',\n )\n .where('broadcast_id', b.id)\n .where('user', user);\n const exists = await baseQuery.clone().limit(1).select().first();\n if (exists) {\n await baseQuery.clone().update({ read, saved });\n } else {\n await baseQuery\n .clone()\n .insert({ broadcast_id: b.id, user, read, saved });\n }\n }\n }\n };\n\n async markRead(options: NotificationModifyOptions): Promise<void> {\n await this.markReadSaved(options.ids, options.user, new Date(), undefined);\n }\n\n async markUnread(options: NotificationModifyOptions): Promise<void> {\n await this.markReadSaved(options.ids, options.user, null, undefined);\n }\n\n async markSaved(options: NotificationModifyOptions): Promise<void> {\n await this.markReadSaved(options.ids, options.user, undefined, new Date());\n }\n\n async markUnsaved(options: NotificationModifyOptions): Promise<void> {\n await this.markReadSaved(options.ids, options.user, undefined, null);\n }\n\n async getUserNotificationOrigins(options: {\n user: string;\n }): Promise<{ origins: string[] }> {\n const rows: { origin: string }[] = await this.db<NotificationRowType>(\n 'notification',\n )\n .where('user', options.user)\n .select('origin')\n .distinct();\n return { origins: rows.map(row => row.origin) };\n }\n\n async getUserNotificationTopics(options: {\n user: string;\n }): Promise<{ topics: { origin: string; topic: string }[] }> {\n const rows: { topic: string; origin: string }[] =\n await this.db<NotificationRowType>('notification')\n .where('user', options.user)\n .select('topic', 'origin')\n .whereNotNull('topic')\n .distinct();\n\n return {\n topics: rows.map(row => ({ origin: row.origin, topic: row.topic })),\n };\n }\n\n async getNotificationSettings(options: {\n user: string;\n origin?: string;\n channel?: string;\n topic?: string;\n }): Promise<NotificationSettings> {\n const settingsQuery = this.db<UserSettingsRowType>('user_settings').where(\n 'user',\n options.user,\n );\n if (options.origin) {\n settingsQuery.where('origin', options.origin);\n }\n\n if (options.channel) {\n settingsQuery.where('channel', options.channel);\n }\n\n if (options.topic) {\n settingsQuery.where('topic', options.topic);\n }\n const settings = await settingsQuery.select();\n return this.mapToNotificationSettings(settings);\n }\n\n async saveNotificationSettings(options: {\n user: string;\n settings: NotificationSettings;\n }): Promise<void> {\n const rows: {\n settings_key_hash: string;\n user: string;\n channel: string;\n origin: string;\n topic: string | null;\n enabled: boolean;\n }[] = [];\n\n options.settings.channels.forEach(channel => {\n channel.origins.forEach(origin => {\n rows.push({\n settings_key_hash: generateSettingsHash(\n options.user,\n channel.id,\n origin.id,\n null,\n ),\n user: options.user,\n channel: channel.id,\n origin: origin.id,\n topic: null,\n enabled: origin.enabled,\n });\n\n origin.topics?.forEach(topic => {\n rows.push({\n settings_key_hash: generateSettingsHash(\n options.user,\n channel.id,\n origin.id,\n topic.id,\n ),\n user: options.user,\n channel: channel.id,\n origin: origin.id,\n topic: topic.id,\n enabled: origin.enabled && topic.enabled,\n });\n });\n });\n });\n\n await this.db<UserSettingsRowType>('user_settings')\n .where('user', options.user)\n .delete();\n await this.db<UserSettingsRowType>('user_settings').insert(rows);\n }\n\n async getTopics(options: TopicGetOptions): Promise<{ topics: string[] }> {\n const notificationQuery = this.getNotificationsBaseQuery({\n ...options,\n orderField: [{ field: 'topic', order: 'asc' }],\n });\n const topics = await notificationQuery\n .whereNotNull('topic')\n .distinct(['topic']);\n return { topics: topics.map(row => row.topic) };\n }\n\n async clearNotifications(options: {\n maxAge: HumanDuration;\n }): Promise<{ deletedCount: number }> {\n const ms = durationToMilliseconds(options.maxAge);\n const now = new Date(new Date().getTime() - ms);\n const notificationsCount = await this.db('notification')\n .where(builder => {\n builder.where('created', '<=', now).whereNull('updated');\n })\n .orWhere('updated', '<=', now)\n .delete();\n const broadcastsCount = await this.db('broadcast')\n .where(builder => {\n builder.where('created', '<=', now).whereNull('updated');\n })\n .orWhere('updated', '<=', now)\n .delete();\n return { deletedCount: notificationsCount + broadcastsCount };\n }\n}\n"],"names":["resolvePackagePath","notificationSeverities","crypto","durationToMilliseconds"],"mappings":";;;;;;;;;;;AAmCA,MAAM,aAAA,GAAgBA,mCAAA;AAAA,EACpB,yCAAA;AAAA,EACA;AACF,CAAA;AAEA,MAAM,oBAAA,GAAuB;AAAA,EAC3B,IAAA;AAAA,EACA,OAAA;AAAA,EACA,aAAA;AAAA,EACA,UAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,MAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA;AA8CO,MAAM,iBAAA,GAAoB,CAAC,KAAA,KAAyC;AACzE,EAAA,IAAI,KAAA,GAAA,CAAS,KAAA,IAAS,QAAA,EAAU,WAAA,EAAY;AAC5C,EAAA,IAAIC,gDAAA,CAAuB,OAAA,CAAQ,KAAK,CAAA,GAAI,CAAA,EAAG;AAC7C,IAAA,KAAA,GAAQ,QAAA;AAAA,EACV;AACA,EAAA,OAAO,KAAA;AACT;AAEO,MAAM,oBAAA,GAAuB,CAClC,IAAA,EACA,OAAA,EACA,QACA,KAAA,KACW;AACX,EAAA,MAAM,MAAA,GAAS,GAAG,IAAI,CAAA,CAAA,EAAI,OAAO,CAAA,CAAA,EAAI,MAAM,CAAA,CAAA,EAAI,KAAA,IAAS,EAAE,CAAA,CAAA;AAC1D,EAAA,OAAOC,uBAAA,CAAO,WAAW,QAAQ,CAAA,CAAE,OAAO,MAAM,CAAA,CAAE,OAAO,KAAK,CAAA;AAChE;AAGO,MAAM,0BAAA,CAAyD;AAAA,EACnD,QAAA,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KAC9C,CAAA;AACD,IAAA,MAAM,MAAA,GAAS,MAAM,iBAAA,CAClB,YAAA,CAAa,OAAO,CAAA,CACpB,QAAA,CAAS,CAAC,OAAO,CAAC,CAAA;AACrB,IAAA,OAAO,EAAE,MAAA,EAAQ,MAAA,CAAO,IAAI,CAAA,GAAA,KAAO,GAAA,CAAI,KAAK,CAAA,EAAE;AAAA,EAChD;AAAA,EAEA,MAAM,mBAAmB,OAAA,EAEa;AACpC,IAAA,MAAM,EAAA,GAAKE,4BAAA,CAAuB,OAAA,CAAQ,MAAM,CAAA;AAChD,IAAA,MAAM,GAAA,GAAM,IAAI,IAAA,CAAA,iBAAK,IAAI,MAAK,EAAE,OAAA,KAAY,EAAE,CAAA;AAC9C,IAAA,MAAM,qBAAqB,MAAM,IAAA,CAAK,GAAG,cAAc,CAAA,CACpD,MAAM,CAAA,OAAA,KAAW;AAChB,MAAA,OAAA,CAAQ,MAAM,SAAA,EAAW,IAAA,EAAM,GAAG,CAAA,CAAE,UAAU,SAAS,CAAA;AAAA,IACzD,CAAC,CAAA,CACA,OAAA,CAAQ,WAAW,IAAA,EAAM,GAAG,EAC5B,MAAA,EAAO;AACV,IAAA,MAAM,kBAAkB,MAAM,IAAA,CAAK,GAAG,WAAW,CAAA,CAC9C,MAAM,CAAA,OAAA,KAAW;AAChB,MAAA,OAAA,CAAQ,MAAM,SAAA,EAAW,IAAA,EAAM,GAAG,CAAA,CAAE,UAAU,SAAS,CAAA;AAAA,IACzD,CAAC,CAAA,CACA,OAAA,CAAQ,WAAW,IAAA,EAAM,GAAG,EAC5B,MAAA,EAAO;AACV,IAAA,OAAO,EAAE,YAAA,EAAc,kBAAA,GAAqB,eAAA,EAAgB;AAAA,EAC9D;AACF;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["../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 */\n\nimport {\n coreServices,\n createBackendPlugin,\n} from '@backstage/backend-plugin-api';\nimport { actionsRegistryServiceRef } from '@backstage/backend-plugin-api/alpha';\nimport { createRouter } from './service/router';\nimport { createNotificationsActions } from './actions';\nimport { signalsServiceRef } from '@backstage/plugin-signals-node';\nimport {\n NotificationProcessor,\n NotificationRecipientResolver,\n notificationsProcessingExtensionPoint,\n NotificationsProcessingExtensionPoint,\n} from '@backstage/plugin-notifications-node';\nimport { catalogServiceRef } from '@backstage/plugin-catalog-node';\nimport { DatabaseNotificationsStore } from './database';\nimport { NotificationCleaner } from './service/NotificationCleaner.ts';\n\nclass NotificationsProcessingExtensionPointImpl\n implements NotificationsProcessingExtensionPoint\n{\n #processors = new Array<NotificationProcessor>();\n #recipientResolver: NotificationRecipientResolver | undefined = undefined;\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 setNotificationRecipientResolver(\n resolver: NotificationRecipientResolver,\n ): void {\n if (this.#recipientResolver) {\n throw new Error(\n 'Notification recipient resolver is already set. You can only set it once.',\n );\n }\n this.#recipientResolver = resolver;\n }\n\n get recipientResolver() {\n return this.#recipientResolver;\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 auth: coreServices.auth,\n httpAuth: coreServices.httpAuth,\n userInfo: coreServices.userInfo,\n httpRouter: coreServices.httpRouter,\n logger: coreServices.logger,\n database: coreServices.database,\n signals: signalsServiceRef,\n config: coreServices.rootConfig,\n catalog: catalogServiceRef,\n scheduler: coreServices.scheduler,\n actionsRegistry: actionsRegistryServiceRef,\n },\n async init({\n auth,\n httpAuth,\n userInfo,\n httpRouter,\n logger,\n database,\n signals,\n config,\n catalog,\n scheduler,\n actionsRegistry,\n }) {\n const store = await DatabaseNotificationsStore.create({ database });\n\n httpRouter.use(\n await createRouter({\n auth,\n httpAuth,\n userInfo,\n logger,\n config,\n store,\n catalog,\n signals,\n processors: processingExtensions.processors,\n recipientResolver: processingExtensions.recipientResolver,\n }),\n );\n httpRouter.addAuthPolicy({\n path: '/health',\n allow: 'unauthenticated',\n });\n\n const cleaner = new NotificationCleaner(\n config,\n scheduler,\n logger,\n store,\n );\n await cleaner.initTaskRunner();\n\n createNotificationsActions({ actionsRegistry, auth, store });\n },\n });\n },\n});\n"],"names":["createBackendPlugin","notificationsProcessingExtensionPoint","coreServices","signalsServiceRef","catalogServiceRef","actionsRegistryServiceRef","DatabaseNotificationsStore","createRouter","NotificationCleaner","createNotificationsActions"],"mappings":";;;;;;;;;;;;AAkCA,MAAM,yCAAA,CAEN;AAAA,EACE,WAAA,GAAc,IAAI,KAAA,EAA6B;AAAA,EAC/C,kBAAA,GAAgE,MAAA;AAAA,EAEhE,gBACK,UAAA,EACG;AACN,IAAA,IAAA,CAAK,WAAA,CAAY,IAAA,CAAK,GAAG,UAAA,CAAW,MAAM,CAAA;AAAA,EAC5C;AAAA,EAEA,IAAI,UAAA,GAAa;AACf,IAAA,OAAO,IAAA,CAAK,WAAA;AAAA,EACd;AAAA,EAEA,iCACE,QAAA,EACM;AACN,IAAA,IAAI,KAAK,kBAAA,EAAoB;AAC3B,MAAA,MAAM,IAAI,KAAA;AAAA,QACR;AAAA,OACF;AAAA,IACF;AACA,IAAA,IAAA,CAAK,kBAAA,GAAqB,QAAA;AAAA,EAC5B;AAAA,EAEA,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,OAAA;AAAA,YACA,OAAA;AAAA,YACA,YAAY,oBAAA,CAAqB,UAAA;AAAA,YACjC,mBAAmB,oBAAA,CAAqB;AAAA,WACzC;AAAA,SACH;AACA,QAAA,UAAA,CAAW,aAAA,CAAc;AAAA,UACvB,IAAA,EAAM,SAAA;AAAA,UACN,KAAA,EAAO;AAAA,SACR,CAAA;AAED,QAAA,MAAM,UAAU,IAAIC,uCAAA;AAAA,UAClB,MAAA;AAAA,UACA,SAAA;AAAA,UACA,MAAA;AAAA,UACA;AAAA,SACF;AACA,QAAA,MAAM,QAAQ,cAAA,EAAe;AAE7B,QAAAC,gCAAA,CAA2B,EAAE,eAAA,EAAiB,IAAA,EAAM,KAAA,EAAO,CAAA;AAAA,MAC7D;AAAA,KACD,CAAA;AAAA,EACH;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["../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 */\n\nimport {\n coreServices,\n createBackendPlugin,\n} from '@backstage/backend-plugin-api';\nimport { actionsRegistryServiceRef } from '@backstage/backend-plugin-api/alpha';\nimport { createRouter } from './service/router';\nimport { createNotificationsActions } from './actions';\nimport { signalsServiceRef } from '@backstage/plugin-signals-node';\nimport {\n NotificationProcessor,\n NotificationRecipientResolver,\n notificationsProcessingExtensionPoint,\n NotificationsProcessingExtensionPoint,\n} from '@backstage/plugin-notifications-node';\nimport { catalogServiceRef } from '@backstage/plugin-catalog-node';\nimport { DatabaseNotificationsStore } from './database';\nimport { NotificationCleaner } from './service/NotificationCleaner.ts';\n\nclass NotificationsProcessingExtensionPointImpl\n implements NotificationsProcessingExtensionPoint\n{\n #processors = new Array<NotificationProcessor>();\n #recipientResolver: NotificationRecipientResolver | undefined = undefined;\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 setNotificationRecipientResolver(\n resolver: NotificationRecipientResolver,\n ): void {\n if (this.#recipientResolver) {\n throw new Error(\n 'Notification recipient resolver is already set. You can only set it once.',\n );\n }\n this.#recipientResolver = resolver;\n }\n\n get recipientResolver() {\n return this.#recipientResolver;\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 auth: coreServices.auth,\n httpAuth: coreServices.httpAuth,\n userInfo: coreServices.userInfo,\n httpRouter: coreServices.httpRouter,\n logger: coreServices.logger,\n database: coreServices.database,\n signals: signalsServiceRef,\n config: coreServices.rootConfig,\n catalog: catalogServiceRef,\n scheduler: coreServices.scheduler,\n actionsRegistry: actionsRegistryServiceRef,\n },\n async init({\n auth,\n httpAuth,\n userInfo,\n httpRouter,\n logger,\n database,\n signals,\n config,\n catalog,\n scheduler,\n actionsRegistry,\n }) {\n const store = await DatabaseNotificationsStore.create({ database });\n\n httpRouter.use(\n await createRouter({\n auth,\n httpAuth,\n userInfo,\n logger,\n config,\n store,\n catalog,\n signals,\n processors: processingExtensions.processors,\n recipientResolver: processingExtensions.recipientResolver,\n }),\n );\n httpRouter.addAuthPolicy({\n path: '/health',\n allow: 'unauthenticated',\n });\n\n const cleaner = new NotificationCleaner(\n config,\n scheduler,\n logger,\n store,\n );\n await cleaner.initTaskRunner();\n\n createNotificationsActions({ actionsRegistry, auth, store });\n },\n });\n },\n});\n"],"names":["createBackendPlugin","notificationsProcessingExtensionPoint","coreServices","signalsServiceRef","catalogServiceRef","actionsRegistryServiceRef","DatabaseNotificationsStore","createRouter","NotificationCleaner","createNotificationsActions"],"mappings":";;;;;;;;;;;;AAkCA,MAAM,yCAAA,CAEN;AAAA,EACE,WAAA,GAAc,IAAI,KAAA,EAA6B;AAAA,EAC/C,kBAAA,GAAgE,MAAA;AAAA,EAEhE,gBACK,UAAA,EACG;AACN,IAAA,IAAA,CAAK,WAAA,CAAY,IAAA,CAAK,GAAG,UAAA,CAAW,MAAM,CAAA;AAAA,EAC5C;AAAA,EAEA,IAAI,UAAA,GAAa;AACf,IAAA,OAAO,IAAA,CAAK,WAAA;AAAA,EACd;AAAA,EAEA,iCACE,QAAA,EACM;AACN,IAAA,IAAI,KAAK,kBAAA,EAAoB;AAC3B,MAAA,MAAM,IAAI,KAAA;AAAA,QACR;AAAA,OACF;AAAA,IACF;AACA,IAAA,IAAA,CAAK,kBAAA,GAAqB,QAAA;AAAA,EAC5B;AAAA,EAEA,IAAI,iBAAA,GAAoB;AACtB,IAAA,OAAO,IAAA,CAAK,kBAAA;AAAA,EACd;AACF;AAOO,MAAM,sBAAsBA,oCAAA,CAAoB;AAAA,EACrD,QAAA,EAAU,eAAA;AAAA,EACV,SAAS,GAAA,EAAK;AACZ,IAAA,MAAM,oBAAA,GACJ,IAAI,yCAAA,EAA0C;AAChD,IAAA,GAAA,CAAI,sBAAA;AAAA,MACFC,6DAAA;AAAA,MACA;AAAA,KACF;AAEA,IAAA,GAAA,CAAI,YAAA,CAAa;AAAA,MACf,IAAA,EAAM;AAAA,QACJ,MAAMC,6BAAA,CAAa,IAAA;AAAA,QACnB,UAAUA,6BAAA,CAAa,QAAA;AAAA,QACvB,UAAUA,6BAAA,CAAa,QAAA;AAAA,QACvB,YAAYA,6BAAA,CAAa,UAAA;AAAA,QACzB,QAAQA,6BAAA,CAAa,MAAA;AAAA,QACrB,UAAUA,6BAAA,CAAa,QAAA;AAAA,QACvB,OAAA,EAASC,mCAAA;AAAA,QACT,QAAQD,6BAAA,CAAa,UAAA;AAAA,QACrB,OAAA,EAASE,mCAAA;AAAA,QACT,WAAWF,6BAAA,CAAa,SAAA;AAAA,QACxB,eAAA,EAAiBG;AAAA,OACnB;AAAA,MACA,MAAM,IAAA,CAAK;AAAA,QACT,IAAA;AAAA,QACA,QAAA;AAAA,QACA,QAAA;AAAA,QACA,UAAA;AAAA,QACA,MAAA;AAAA,QACA,QAAA;AAAA,QACA,OAAA;AAAA,QACA,MAAA;AAAA,QACA,OAAA;AAAA,QACA,SAAA;AAAA,QACA;AAAA,OACF,EAAG;AACD,QAAA,MAAM,QAAQ,MAAMC,qDAAA,CAA2B,MAAA,CAAO,EAAE,UAAU,CAAA;AAElE,QAAA,UAAA,CAAW,GAAA;AAAA,UACT,MAAMC,mBAAA,CAAa;AAAA,YACjB,IAAA;AAAA,YACA,QAAA;AAAA,YACA,QAAA;AAAA,YACA,MAAA;AAAA,YACA,MAAA;AAAA,YACA,KAAA;AAAA,YACA,OAAA;AAAA,YACA,OAAA;AAAA,YACA,YAAY,oBAAA,CAAqB,UAAA;AAAA,YACjC,mBAAmB,oBAAA,CAAqB;AAAA,WACzC;AAAA,SACH;AACA,QAAA,UAAA,CAAW,aAAA,CAAc;AAAA,UACvB,IAAA,EAAM,SAAA;AAAA,UACN,KAAA,EAAO;AAAA,SACR,CAAA;AAED,QAAA,MAAM,UAAU,IAAIC,uCAAA;AAAA,UAClB,MAAA;AAAA,UACA,SAAA;AAAA,UACA,MAAA;AAAA,UACA;AAAA,SACF;AACA,QAAA,MAAM,QAAQ,cAAA,EAAe;AAE7B,QAAAC,gCAAA,CAA2B,EAAE,eAAA,EAAiB,IAAA,EAAM,KAAA,EAAO,CAAA;AAAA,MAC7D;AAAA,KACD,CAAA;AAAA,EACH;AACF,CAAC;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"router.cjs.js","sources":["../../../../src/schema/openapi/generated/router.ts"],"sourcesContent":["/*\n * Copyright 2026 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\n// ******************************************************************\n// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. *\n// ******************************************************************\nimport { createValidatedOpenApiRouterFromGeneratedEndpointMap } from '@backstage/backend-openapi-utils';\nimport { EndpointMap } from './apis';\n\nexport const spec = {\n openapi: '3.1.0',\n info: {\n title: 'notifications',\n version: '1',\n description: 'The Backstage backend plugin that powers user notifications.',\n license: {\n name: 'Apache-2.0',\n url: 'http://www.apache.org/licenses/LICENSE-2.0.html',\n },\n contact: {},\n },\n servers: [\n {\n url: '/',\n },\n ],\n components: {\n examples: {},\n headers: {},\n parameters: {\n notificationId: {\n name: 'id',\n in: 'path',\n required: true,\n schema: {\n type: 'string',\n },\n },\n offset: {\n name: 'offset',\n in: 'query',\n required: false,\n allowReserved: true,\n schema: {\n type: 'integer',\n minimum: 0,\n },\n },\n limit: {\n name: 'limit',\n in: 'query',\n required: false,\n allowReserved: true,\n schema: {\n type: 'integer',\n minimum: 0,\n },\n },\n orderField: {\n name: 'orderField',\n in: 'query',\n required: false,\n allowReserved: true,\n description:\n 'One or more \"field,direction\" pairs. Direction is \"asc\" or \"desc\". Pass multiple to express compound sorts.',\n schema: {\n $ref: '#/components/schemas/OrderField',\n },\n },\n topic: {\n name: 'topic',\n in: 'query',\n required: false,\n allowReserved: true,\n schema: {\n type: 'string',\n },\n },\n search: {\n name: 'search',\n in: 'query',\n required: false,\n allowReserved: true,\n schema: {\n type: 'string',\n },\n },\n read: {\n name: 'read',\n in: 'query',\n required: false,\n allowReserved: true,\n schema: {\n type: 'string',\n enum: ['true', 'false'],\n },\n },\n saved: {\n name: 'saved',\n in: 'query',\n required: false,\n allowReserved: true,\n schema: {\n type: 'string',\n enum: ['true', 'false'],\n },\n },\n createdAfter: {\n name: 'createdAfter',\n in: 'query',\n required: false,\n allowReserved: true,\n description: 'ISO 8601 date-time string. Validated by the handler.',\n schema: {\n type: 'string',\n },\n },\n minimumSeverity: {\n name: 'minimumSeverity',\n in: 'query',\n required: false,\n allowReserved: true,\n schema: {\n $ref: '#/components/schemas/NotificationSeverity',\n },\n },\n },\n requestBodies: {},\n responses: {\n ErrorResponse: {\n description: 'An error response from the backend.',\n content: {\n 'application/json; charset=utf-8': {\n schema: {\n $ref: '#/components/schemas/Error',\n },\n },\n },\n },\n },\n schemas: {\n NotificationSeverity: {\n type: 'string',\n enum: ['critical', 'high', 'normal', 'low'],\n },\n NotificationPayload: {\n type: 'object',\n required: ['title'],\n properties: {\n title: {\n type: 'string',\n description: 'Notification title',\n },\n description: {\n type: 'string',\n description: 'Optional longer description for the notification',\n },\n link: {\n type: 'string',\n description: 'Optional link where the notification is pointing to',\n },\n severity: {\n $ref: '#/components/schemas/NotificationSeverity',\n },\n topic: {\n type: 'string',\n description: 'Optional notification topic',\n },\n scope: {\n type: 'string',\n description:\n 'Notification scope, can be used to re-send same notifications in case the scope and origin matches.',\n },\n icon: {\n type: 'string',\n description: 'Optional notification icon',\n },\n metadata: {\n type: 'object',\n description: 'Optional additional customizable metadata.',\n additionalProperties: true,\n },\n },\n },\n NotificationResponsePayload: {\n description:\n 'Response variant of NotificationPayload. Optional string fields may be returned as null when unset.',\n type: 'object',\n required: ['title'],\n properties: {\n title: {\n type: 'string',\n },\n description: {\n type: ['string', 'null'],\n },\n link: {\n type: ['string', 'null'],\n },\n severity: {\n $ref: '#/components/schemas/NotificationSeverity',\n },\n topic: {\n type: ['string', 'null'],\n },\n scope: {\n type: ['string', 'null'],\n },\n icon: {\n type: ['string', 'null'],\n },\n metadata: {\n type: 'object',\n additionalProperties: true,\n },\n },\n },\n Notification: {\n type: 'object',\n required: ['id', 'user', 'created', 'origin', 'payload'],\n properties: {\n id: {\n type: 'string',\n description: 'Unique identifier for the notification.',\n },\n user: {\n type: ['string', 'null'],\n description:\n 'User entity reference, or null for broadcast notifications.',\n },\n created: {\n type: 'string',\n format: 'date-time',\n },\n saved: {\n type: ['string', 'null'],\n format: 'date-time',\n },\n read: {\n type: ['string', 'null'],\n format: 'date-time',\n },\n updated: {\n type: ['string', 'null'],\n format: 'date-time',\n },\n origin: {\n type: 'string',\n description: \"Origin of the notification (the sender's reference).\",\n },\n payload: {\n $ref: '#/components/schemas/NotificationResponsePayload',\n },\n },\n },\n NotificationStatus: {\n type: 'object',\n required: ['unread', 'read'],\n properties: {\n unread: {\n type: 'integer',\n },\n read: {\n type: 'integer',\n },\n },\n },\n TopicSetting: {\n type: 'object',\n required: ['id', 'enabled'],\n properties: {\n id: {\n type: 'string',\n },\n enabled: {\n type: 'boolean',\n },\n },\n },\n OriginSetting: {\n type: 'object',\n required: ['id', 'enabled'],\n properties: {\n id: {\n type: 'string',\n },\n enabled: {\n type: 'boolean',\n },\n topics: {\n type: 'array',\n items: {\n $ref: '#/components/schemas/TopicSetting',\n },\n },\n },\n },\n ChannelSetting: {\n type: 'object',\n required: ['id', 'origins'],\n properties: {\n id: {\n type: 'string',\n },\n enabled: {\n type: 'boolean',\n },\n origins: {\n type: 'array',\n items: {\n $ref: '#/components/schemas/OriginSetting',\n },\n },\n },\n },\n NotificationSettings: {\n type: 'object',\n required: ['channels'],\n properties: {\n channels: {\n type: 'array',\n items: {\n $ref: '#/components/schemas/ChannelSetting',\n },\n },\n },\n },\n EntityRef: {\n description: 'A single entity ref, or a list of entity refs.',\n oneOf: [\n {\n type: 'string',\n },\n {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n ],\n },\n OrderField: {\n description:\n 'One or more \"field,direction\" pairs, given as a single string or an array of strings.',\n oneOf: [\n {\n type: 'string',\n },\n {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n ],\n },\n NotificationRecipients: {\n oneOf: [\n {\n type: 'object',\n required: ['type', 'entityRef'],\n properties: {\n type: {\n type: 'string',\n enum: ['entity'],\n },\n entityRef: {\n $ref: '#/components/schemas/EntityRef',\n },\n excludeEntityRef: {\n $ref: '#/components/schemas/EntityRef',\n },\n },\n },\n {\n type: 'object',\n required: ['type'],\n properties: {\n type: {\n type: 'string',\n enum: ['broadcast'],\n },\n },\n },\n ],\n },\n NotificationSendOptions: {\n type: 'object',\n required: ['recipients', 'payload'],\n properties: {\n recipients: {\n $ref: '#/components/schemas/NotificationRecipients',\n },\n payload: {\n $ref: '#/components/schemas/NotificationPayload',\n },\n },\n },\n UpdateNotificationsRequest: {\n type: 'object',\n required: ['ids'],\n properties: {\n ids: {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n read: {\n type: 'boolean',\n },\n saved: {\n type: 'boolean',\n },\n },\n },\n ListNotificationsResponse: {\n type: 'object',\n required: ['totalCount', 'notifications'],\n properties: {\n totalCount: {\n type: 'integer',\n },\n notifications: {\n type: 'array',\n items: {\n $ref: '#/components/schemas/Notification',\n },\n },\n },\n },\n GetTopicsResponse: {\n type: 'object',\n required: ['topics'],\n properties: {\n topics: {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n },\n },\n Error: {\n type: 'object',\n properties: {\n error: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n message: {\n type: 'string',\n },\n },\n required: ['name', 'message'],\n },\n request: {\n type: 'object',\n properties: {\n method: {\n type: 'string',\n },\n url: {\n type: 'string',\n },\n },\n required: ['method', 'url'],\n },\n response: {\n type: 'object',\n properties: {\n statusCode: {\n type: 'number',\n },\n },\n required: ['statusCode'],\n },\n },\n required: ['error', 'request', 'response'],\n },\n },\n securitySchemes: {\n JWT: {\n type: 'http',\n scheme: 'bearer',\n bearerFormat: 'JWT',\n },\n },\n },\n paths: {\n '/': {\n get: {\n operationId: 'ListNotificationsLegacy',\n deprecated: true,\n description: 'Deprecated alias for `GET /notifications`.',\n parameters: [\n {\n $ref: '#/components/parameters/offset',\n },\n {\n $ref: '#/components/parameters/limit',\n },\n {\n $ref: '#/components/parameters/orderField',\n },\n {\n $ref: '#/components/parameters/topic',\n },\n {\n $ref: '#/components/parameters/search',\n },\n {\n $ref: '#/components/parameters/read',\n },\n {\n $ref: '#/components/parameters/saved',\n },\n {\n $ref: '#/components/parameters/createdAfter',\n },\n {\n $ref: '#/components/parameters/minimumSeverity',\n },\n ],\n responses: {\n '200': {\n description: 'A page of notifications for the current user.',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/ListNotificationsResponse',\n },\n },\n },\n },\n default: {\n $ref: '#/components/responses/ErrorResponse',\n },\n },\n security: [\n {},\n {\n JWT: [],\n },\n ],\n },\n post: {\n operationId: 'CreateNotificationsLegacy',\n deprecated: true,\n description: 'Deprecated alias for `POST /notifications`.',\n requestBody: {\n required: true,\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/NotificationSendOptions',\n },\n },\n },\n },\n responses: {\n '200': {\n description: 'The notifications that were created.',\n content: {\n 'application/json': {\n schema: {\n type: 'array',\n items: {\n $ref: '#/components/schemas/Notification',\n },\n },\n },\n },\n },\n default: {\n $ref: '#/components/responses/ErrorResponse',\n },\n },\n security: [\n {},\n {\n JWT: [],\n },\n ],\n },\n },\n '/notifications': {\n get: {\n operationId: 'ListNotifications',\n description: 'List notifications for the current user.',\n parameters: [\n {\n $ref: '#/components/parameters/offset',\n },\n {\n $ref: '#/components/parameters/limit',\n },\n {\n $ref: '#/components/parameters/orderField',\n },\n {\n $ref: '#/components/parameters/topic',\n },\n {\n $ref: '#/components/parameters/search',\n },\n {\n $ref: '#/components/parameters/read',\n },\n {\n $ref: '#/components/parameters/saved',\n },\n {\n $ref: '#/components/parameters/createdAfter',\n },\n {\n $ref: '#/components/parameters/minimumSeverity',\n },\n ],\n responses: {\n '200': {\n description: 'A page of notifications for the current user.',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/ListNotificationsResponse',\n },\n },\n },\n },\n default: {\n $ref: '#/components/responses/ErrorResponse',\n },\n },\n security: [\n {},\n {\n JWT: [],\n },\n ],\n },\n post: {\n operationId: 'CreateNotifications',\n description:\n 'Send a notification to one or more recipients (service credentials required).',\n requestBody: {\n required: true,\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/NotificationSendOptions',\n },\n },\n },\n },\n responses: {\n '200': {\n description: 'The notifications that were created.',\n content: {\n 'application/json': {\n schema: {\n type: 'array',\n items: {\n $ref: '#/components/schemas/Notification',\n },\n },\n },\n },\n },\n default: {\n $ref: '#/components/responses/ErrorResponse',\n },\n },\n security: [\n {},\n {\n JWT: [],\n },\n ],\n },\n },\n '/update': {\n post: {\n operationId: 'UpdateNotificationsLegacy',\n deprecated: true,\n description: 'Deprecated alias for `POST /notifications/update`.',\n requestBody: {\n required: true,\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/UpdateNotificationsRequest',\n },\n },\n },\n },\n responses: {\n '200': {\n description: 'The notifications that were updated.',\n content: {\n 'application/json': {\n schema: {\n type: 'array',\n items: {\n $ref: '#/components/schemas/Notification',\n },\n },\n },\n },\n },\n default: {\n $ref: '#/components/responses/ErrorResponse',\n },\n },\n security: [\n {},\n {\n JWT: [],\n },\n ],\n },\n },\n '/notifications/update': {\n post: {\n operationId: 'UpdateNotifications',\n description: 'Mark notifications as read/unread or saved/unsaved.',\n requestBody: {\n required: true,\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/UpdateNotificationsRequest',\n },\n },\n },\n },\n responses: {\n '200': {\n description: 'The notifications that were updated.',\n content: {\n 'application/json': {\n schema: {\n type: 'array',\n items: {\n $ref: '#/components/schemas/Notification',\n },\n },\n },\n },\n },\n default: {\n $ref: '#/components/responses/ErrorResponse',\n },\n },\n security: [\n {},\n {\n JWT: [],\n },\n ],\n },\n },\n '/status': {\n get: {\n operationId: 'GetStatus',\n description: 'Get the unread/read counts for the current user.',\n responses: {\n '200': {\n description: \"The current user's notification status.\",\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/NotificationStatus',\n },\n },\n },\n },\n default: {\n $ref: '#/components/responses/ErrorResponse',\n },\n },\n security: [\n {},\n {\n JWT: [],\n },\n ],\n },\n },\n '/settings': {\n get: {\n operationId: 'GetSettings',\n description:\n \"Get the current user's notification settings, merged with defaults.\",\n responses: {\n '200': {\n description: 'Effective notification settings for the user.',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/NotificationSettings',\n },\n },\n },\n },\n default: {\n $ref: '#/components/responses/ErrorResponse',\n },\n },\n security: [\n {},\n {\n JWT: [],\n },\n ],\n },\n post: {\n operationId: 'UpdateSettings',\n description: \"Update the current user's notification settings.\",\n requestBody: {\n required: true,\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/NotificationSettings',\n },\n },\n },\n },\n responses: {\n '200': {\n description: 'Effective notification settings for the user.',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/NotificationSettings',\n },\n },\n },\n },\n default: {\n $ref: '#/components/responses/ErrorResponse',\n },\n },\n security: [\n {},\n {\n JWT: [],\n },\n ],\n },\n },\n '/topics': {\n get: {\n operationId: 'GetTopics',\n description:\n 'List notification topics that the user has received notifications on.',\n parameters: [\n {\n $ref: '#/components/parameters/search',\n },\n {\n $ref: '#/components/parameters/read',\n },\n {\n $ref: '#/components/parameters/saved',\n },\n {\n $ref: '#/components/parameters/createdAfter',\n },\n {\n $ref: '#/components/parameters/minimumSeverity',\n },\n ],\n responses: {\n '200': {\n description: 'The list of topics.',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/GetTopicsResponse',\n },\n },\n },\n },\n default: {\n $ref: '#/components/responses/ErrorResponse',\n },\n },\n security: [\n {},\n {\n JWT: [],\n },\n ],\n },\n },\n '/{id}': {\n get: {\n operationId: 'GetNotificationLegacy',\n deprecated: true,\n description: 'Deprecated alias for `GET /notifications/{id}`.',\n parameters: [\n {\n $ref: '#/components/parameters/notificationId',\n },\n ],\n responses: {\n '200': {\n description: 'The requested notification.',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/Notification',\n },\n },\n },\n },\n default: {\n $ref: '#/components/responses/ErrorResponse',\n },\n },\n security: [\n {},\n {\n JWT: [],\n },\n ],\n },\n },\n '/notifications/{id}': {\n get: {\n operationId: 'GetNotification',\n description: 'Get a single notification by id for the current user.',\n parameters: [\n {\n $ref: '#/components/parameters/notificationId',\n },\n ],\n responses: {\n '200': {\n description: 'The requested notification.',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/Notification',\n },\n },\n },\n },\n default: {\n $ref: '#/components/responses/ErrorResponse',\n },\n },\n security: [\n {},\n {\n JWT: [],\n },\n ],\n },\n },\n },\n} as const;\nexport const createOpenApiRouter = async (\n options?: Parameters<\n typeof createValidatedOpenApiRouterFromGeneratedEndpointMap\n >['1'],\n) =>\n createValidatedOpenApiRouterFromGeneratedEndpointMap<EndpointMap>(\n spec,\n options,\n );\n"],"names":["createValidatedOpenApiRouterFromGeneratedEndpointMap"],"mappings":";;;;AAsBO,MAAM,IAAA,GAAO;AAAA,EAClB,OAAA,EAAS,OAAA;AAAA,EACT,IAAA,EAAM;AAAA,IACJ,KAAA,EAAO,eAAA;AAAA,IACP,OAAA,EAAS,GAAA;AAAA,IACT,WAAA,EAAa,8DAAA;AAAA,IACb,OAAA,EAAS;AAAA,MACP,IAAA,EAAM,YAAA;AAAA,MACN,GAAA,EAAK;AAAA,KACP;AAAA,IACA,SAAS;AAAC,GACZ;AAAA,EACA,OAAA,EAAS;AAAA,IACP;AAAA,MACE,GAAA,EAAK;AAAA;AACP,GACF;AAAA,EACA,UAAA,EAAY;AAAA,IACV,UAAU,EAAC;AAAA,IACX,SAAS,EAAC;AAAA,IACV,UAAA,EAAY;AAAA,MACV,cAAA,EAAgB;AAAA,QACd,IAAA,EAAM,IAAA;AAAA,QACN,EAAA,EAAI,MAAA;A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,MACrB,GAAA,EAAK;AAAA,QACH,WAAA,EAAa,iBAAA;AAAA,QACb,WAAA,EAAa,uDAAA;AAAA,QACb,UAAA,EAAY;AAAA,UACV;AAAA,YACE,IAAA,EAAM;AAAA;AACR,SACF;AAAA,QACA,SAAA,EAAW;AAAA,UACT,KAAA,EAAO;AAAA,YACL,WAAA,EAAa,6BAAA;AAAA,YACb,OAAA,EAAS;AAAA,cACP,kBAAA,EAAoB;AAAA,gBAClB,MAAA,EAAQ;AAAA,kBACN,IAAA,EAAM;AAAA;AACR;AACF;AACF,WACF;AAAA,UACA,OAAA,EAAS;AAAA,YACP,IAAA,EAAM;AAAA;AACR,SACF;AAAA,QACA,QAAA,EAAU;AAAA,UACR,EAAC;AAAA,UACD;AAAA,YACE,KAAK;AAAC;AACR;AACF;AACF;AACF;AAEJ;AACO,MAAM,mBAAA,GAAsB,OACjC,OAAA,KAIAA,wEAAA;AAAA,EACE,IAAA;AAAA,EACA;AACF;;;;;"}
1
+ {"version":3,"file":"router.cjs.js","sources":["../../../../src/schema/openapi/generated/router.ts"],"sourcesContent":["/*\n * Copyright 2026 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\n// ******************************************************************\n// * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. *\n// ******************************************************************\nimport { createValidatedOpenApiRouterFromGeneratedEndpointMap } from '@backstage/backend-openapi-utils';\nimport { EndpointMap } from './apis';\n\nexport const spec = {\n openapi: '3.1.0',\n info: {\n title: 'notifications',\n version: '1',\n description: 'The Backstage backend plugin that powers user notifications.',\n license: {\n name: 'Apache-2.0',\n url: 'http://www.apache.org/licenses/LICENSE-2.0.html',\n },\n contact: {},\n },\n servers: [\n {\n url: '/',\n },\n ],\n components: {\n examples: {},\n headers: {},\n parameters: {\n notificationId: {\n name: 'id',\n in: 'path',\n required: true,\n schema: {\n type: 'string',\n },\n },\n offset: {\n name: 'offset',\n in: 'query',\n required: false,\n allowReserved: true,\n schema: {\n type: 'integer',\n minimum: 0,\n },\n },\n limit: {\n name: 'limit',\n in: 'query',\n required: false,\n allowReserved: true,\n schema: {\n type: 'integer',\n minimum: 0,\n },\n },\n orderField: {\n name: 'orderField',\n in: 'query',\n required: false,\n allowReserved: true,\n description:\n 'One or more \"field,direction\" pairs. Direction is \"asc\" or \"desc\". Pass multiple to express compound sorts.',\n schema: {\n $ref: '#/components/schemas/OrderField',\n },\n },\n topic: {\n name: 'topic',\n in: 'query',\n required: false,\n allowReserved: true,\n schema: {\n type: 'string',\n },\n },\n search: {\n name: 'search',\n in: 'query',\n required: false,\n allowReserved: true,\n schema: {\n type: 'string',\n },\n },\n read: {\n name: 'read',\n in: 'query',\n required: false,\n allowReserved: true,\n schema: {\n type: 'string',\n enum: ['true', 'false'],\n },\n },\n saved: {\n name: 'saved',\n in: 'query',\n required: false,\n allowReserved: true,\n schema: {\n type: 'string',\n enum: ['true', 'false'],\n },\n },\n createdAfter: {\n name: 'createdAfter',\n in: 'query',\n required: false,\n allowReserved: true,\n description: 'ISO 8601 date-time string. Validated by the handler.',\n schema: {\n type: 'string',\n },\n },\n minimumSeverity: {\n name: 'minimumSeverity',\n in: 'query',\n required: false,\n allowReserved: true,\n schema: {\n $ref: '#/components/schemas/NotificationSeverity',\n },\n },\n },\n requestBodies: {},\n responses: {\n ErrorResponse: {\n description: 'An error response from the backend.',\n content: {\n 'application/json; charset=utf-8': {\n schema: {\n $ref: '#/components/schemas/Error',\n },\n },\n },\n },\n },\n schemas: {\n NotificationSeverity: {\n type: 'string',\n enum: ['critical', 'high', 'normal', 'low'],\n },\n NotificationPayload: {\n type: 'object',\n required: ['title'],\n properties: {\n title: {\n type: 'string',\n description: 'Notification title',\n },\n description: {\n type: 'string',\n description: 'Optional longer description for the notification',\n },\n link: {\n type: 'string',\n description: 'Optional link where the notification is pointing to',\n },\n severity: {\n $ref: '#/components/schemas/NotificationSeverity',\n },\n topic: {\n type: 'string',\n description: 'Optional notification topic',\n },\n scope: {\n type: 'string',\n description:\n 'Notification scope, can be used to re-send same notifications in case the scope and origin matches.',\n },\n icon: {\n type: 'string',\n description: 'Optional notification icon',\n },\n metadata: {\n type: 'object',\n description: 'Optional additional customizable metadata.',\n additionalProperties: true,\n },\n },\n },\n NotificationResponsePayload: {\n description:\n 'Response variant of NotificationPayload. Optional string fields may be returned as null when unset.',\n type: 'object',\n required: ['title'],\n properties: {\n title: {\n type: 'string',\n },\n description: {\n type: ['string', 'null'],\n },\n link: {\n type: ['string', 'null'],\n },\n severity: {\n $ref: '#/components/schemas/NotificationSeverity',\n },\n topic: {\n type: ['string', 'null'],\n },\n scope: {\n type: ['string', 'null'],\n },\n icon: {\n type: ['string', 'null'],\n },\n metadata: {\n type: 'object',\n additionalProperties: true,\n },\n },\n },\n Notification: {\n type: 'object',\n required: ['id', 'user', 'created', 'origin', 'payload'],\n properties: {\n id: {\n type: 'string',\n description: 'Unique identifier for the notification.',\n },\n user: {\n type: ['string', 'null'],\n description:\n 'User entity reference, or null for broadcast notifications.',\n },\n created: {\n type: 'string',\n format: 'date-time',\n },\n saved: {\n type: ['string', 'null'],\n format: 'date-time',\n },\n read: {\n type: ['string', 'null'],\n format: 'date-time',\n },\n updated: {\n type: ['string', 'null'],\n format: 'date-time',\n },\n origin: {\n type: 'string',\n description: \"Origin of the notification (the sender's reference).\",\n },\n payload: {\n $ref: '#/components/schemas/NotificationResponsePayload',\n },\n },\n },\n NotificationStatus: {\n type: 'object',\n required: ['unread', 'read'],\n properties: {\n unread: {\n type: 'integer',\n },\n read: {\n type: 'integer',\n },\n },\n },\n TopicSetting: {\n type: 'object',\n required: ['id', 'enabled'],\n properties: {\n id: {\n type: 'string',\n },\n enabled: {\n type: 'boolean',\n },\n },\n },\n OriginSetting: {\n type: 'object',\n required: ['id', 'enabled'],\n properties: {\n id: {\n type: 'string',\n },\n enabled: {\n type: 'boolean',\n },\n topics: {\n type: 'array',\n items: {\n $ref: '#/components/schemas/TopicSetting',\n },\n },\n },\n },\n ChannelSetting: {\n type: 'object',\n required: ['id', 'origins'],\n properties: {\n id: {\n type: 'string',\n },\n enabled: {\n type: 'boolean',\n },\n origins: {\n type: 'array',\n items: {\n $ref: '#/components/schemas/OriginSetting',\n },\n },\n },\n },\n NotificationSettings: {\n type: 'object',\n required: ['channels'],\n properties: {\n channels: {\n type: 'array',\n items: {\n $ref: '#/components/schemas/ChannelSetting',\n },\n },\n },\n },\n EntityRef: {\n description: 'A single entity ref, or a list of entity refs.',\n oneOf: [\n {\n type: 'string',\n },\n {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n ],\n },\n OrderField: {\n description:\n 'One or more \"field,direction\" pairs, given as a single string or an array of strings.',\n oneOf: [\n {\n type: 'string',\n },\n {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n ],\n },\n NotificationRecipients: {\n oneOf: [\n {\n type: 'object',\n required: ['type', 'entityRef'],\n properties: {\n type: {\n type: 'string',\n enum: ['entity'],\n },\n entityRef: {\n $ref: '#/components/schemas/EntityRef',\n },\n excludeEntityRef: {\n $ref: '#/components/schemas/EntityRef',\n },\n },\n },\n {\n type: 'object',\n required: ['type'],\n properties: {\n type: {\n type: 'string',\n enum: ['broadcast'],\n },\n },\n },\n ],\n },\n NotificationSendOptions: {\n type: 'object',\n required: ['recipients', 'payload'],\n properties: {\n recipients: {\n $ref: '#/components/schemas/NotificationRecipients',\n },\n payload: {\n $ref: '#/components/schemas/NotificationPayload',\n },\n },\n },\n UpdateNotificationsRequest: {\n type: 'object',\n required: ['ids'],\n properties: {\n ids: {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n read: {\n type: 'boolean',\n },\n saved: {\n type: 'boolean',\n },\n },\n },\n ListNotificationsResponse: {\n type: 'object',\n required: ['totalCount', 'notifications'],\n properties: {\n totalCount: {\n type: 'integer',\n },\n notifications: {\n type: 'array',\n items: {\n $ref: '#/components/schemas/Notification',\n },\n },\n },\n },\n GetTopicsResponse: {\n type: 'object',\n required: ['topics'],\n properties: {\n topics: {\n type: 'array',\n items: {\n type: 'string',\n },\n },\n },\n },\n Error: {\n type: 'object',\n properties: {\n error: {\n type: 'object',\n properties: {\n name: {\n type: 'string',\n },\n message: {\n type: 'string',\n },\n },\n required: ['name', 'message'],\n },\n request: {\n type: 'object',\n properties: {\n method: {\n type: 'string',\n },\n url: {\n type: 'string',\n },\n },\n required: ['method', 'url'],\n },\n response: {\n type: 'object',\n properties: {\n statusCode: {\n type: 'number',\n },\n },\n required: ['statusCode'],\n },\n },\n required: ['error', 'request', 'response'],\n },\n },\n securitySchemes: {\n JWT: {\n type: 'http',\n scheme: 'bearer',\n bearerFormat: 'JWT',\n },\n },\n },\n paths: {\n '/': {\n get: {\n operationId: 'ListNotificationsLegacy',\n deprecated: true,\n description: 'Deprecated alias for `GET /notifications`.',\n parameters: [\n {\n $ref: '#/components/parameters/offset',\n },\n {\n $ref: '#/components/parameters/limit',\n },\n {\n $ref: '#/components/parameters/orderField',\n },\n {\n $ref: '#/components/parameters/topic',\n },\n {\n $ref: '#/components/parameters/search',\n },\n {\n $ref: '#/components/parameters/read',\n },\n {\n $ref: '#/components/parameters/saved',\n },\n {\n $ref: '#/components/parameters/createdAfter',\n },\n {\n $ref: '#/components/parameters/minimumSeverity',\n },\n ],\n responses: {\n '200': {\n description: 'A page of notifications for the current user.',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/ListNotificationsResponse',\n },\n },\n },\n },\n default: {\n $ref: '#/components/responses/ErrorResponse',\n },\n },\n security: [\n {},\n {\n JWT: [],\n },\n ],\n },\n post: {\n operationId: 'CreateNotificationsLegacy',\n deprecated: true,\n description: 'Deprecated alias for `POST /notifications`.',\n requestBody: {\n required: true,\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/NotificationSendOptions',\n },\n },\n },\n },\n responses: {\n '200': {\n description: 'The notifications that were created.',\n content: {\n 'application/json': {\n schema: {\n type: 'array',\n items: {\n $ref: '#/components/schemas/Notification',\n },\n },\n },\n },\n },\n default: {\n $ref: '#/components/responses/ErrorResponse',\n },\n },\n security: [\n {},\n {\n JWT: [],\n },\n ],\n },\n },\n '/notifications': {\n get: {\n operationId: 'ListNotifications',\n description: 'List notifications for the current user.',\n parameters: [\n {\n $ref: '#/components/parameters/offset',\n },\n {\n $ref: '#/components/parameters/limit',\n },\n {\n $ref: '#/components/parameters/orderField',\n },\n {\n $ref: '#/components/parameters/topic',\n },\n {\n $ref: '#/components/parameters/search',\n },\n {\n $ref: '#/components/parameters/read',\n },\n {\n $ref: '#/components/parameters/saved',\n },\n {\n $ref: '#/components/parameters/createdAfter',\n },\n {\n $ref: '#/components/parameters/minimumSeverity',\n },\n ],\n responses: {\n '200': {\n description: 'A page of notifications for the current user.',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/ListNotificationsResponse',\n },\n },\n },\n },\n default: {\n $ref: '#/components/responses/ErrorResponse',\n },\n },\n security: [\n {},\n {\n JWT: [],\n },\n ],\n },\n post: {\n operationId: 'CreateNotifications',\n description:\n 'Send a notification to one or more recipients (service credentials required).',\n requestBody: {\n required: true,\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/NotificationSendOptions',\n },\n },\n },\n },\n responses: {\n '200': {\n description: 'The notifications that were created.',\n content: {\n 'application/json': {\n schema: {\n type: 'array',\n items: {\n $ref: '#/components/schemas/Notification',\n },\n },\n },\n },\n },\n default: {\n $ref: '#/components/responses/ErrorResponse',\n },\n },\n security: [\n {},\n {\n JWT: [],\n },\n ],\n },\n },\n '/update': {\n post: {\n operationId: 'UpdateNotificationsLegacy',\n deprecated: true,\n description: 'Deprecated alias for `POST /notifications/update`.',\n requestBody: {\n required: true,\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/UpdateNotificationsRequest',\n },\n },\n },\n },\n responses: {\n '200': {\n description: 'The notifications that were updated.',\n content: {\n 'application/json': {\n schema: {\n type: 'array',\n items: {\n $ref: '#/components/schemas/Notification',\n },\n },\n },\n },\n },\n default: {\n $ref: '#/components/responses/ErrorResponse',\n },\n },\n security: [\n {},\n {\n JWT: [],\n },\n ],\n },\n },\n '/notifications/update': {\n post: {\n operationId: 'UpdateNotifications',\n description: 'Mark notifications as read/unread or saved/unsaved.',\n requestBody: {\n required: true,\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/UpdateNotificationsRequest',\n },\n },\n },\n },\n responses: {\n '200': {\n description: 'The notifications that were updated.',\n content: {\n 'application/json': {\n schema: {\n type: 'array',\n items: {\n $ref: '#/components/schemas/Notification',\n },\n },\n },\n },\n },\n default: {\n $ref: '#/components/responses/ErrorResponse',\n },\n },\n security: [\n {},\n {\n JWT: [],\n },\n ],\n },\n },\n '/status': {\n get: {\n operationId: 'GetStatus',\n description: 'Get the unread/read counts for the current user.',\n responses: {\n '200': {\n description: \"The current user's notification status.\",\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/NotificationStatus',\n },\n },\n },\n },\n default: {\n $ref: '#/components/responses/ErrorResponse',\n },\n },\n security: [\n {},\n {\n JWT: [],\n },\n ],\n },\n },\n '/settings': {\n get: {\n operationId: 'GetSettings',\n description:\n \"Get the current user's notification settings, merged with defaults.\",\n responses: {\n '200': {\n description: 'Effective notification settings for the user.',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/NotificationSettings',\n },\n },\n },\n },\n default: {\n $ref: '#/components/responses/ErrorResponse',\n },\n },\n security: [\n {},\n {\n JWT: [],\n },\n ],\n },\n post: {\n operationId: 'UpdateSettings',\n description: \"Update the current user's notification settings.\",\n requestBody: {\n required: true,\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/NotificationSettings',\n },\n },\n },\n },\n responses: {\n '200': {\n description: 'Effective notification settings for the user.',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/NotificationSettings',\n },\n },\n },\n },\n default: {\n $ref: '#/components/responses/ErrorResponse',\n },\n },\n security: [\n {},\n {\n JWT: [],\n },\n ],\n },\n },\n '/topics': {\n get: {\n operationId: 'GetTopics',\n description:\n 'List notification topics that the user has received notifications on.',\n parameters: [\n {\n $ref: '#/components/parameters/search',\n },\n {\n $ref: '#/components/parameters/read',\n },\n {\n $ref: '#/components/parameters/saved',\n },\n {\n $ref: '#/components/parameters/createdAfter',\n },\n {\n $ref: '#/components/parameters/minimumSeverity',\n },\n ],\n responses: {\n '200': {\n description: 'The list of topics.',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/GetTopicsResponse',\n },\n },\n },\n },\n default: {\n $ref: '#/components/responses/ErrorResponse',\n },\n },\n security: [\n {},\n {\n JWT: [],\n },\n ],\n },\n },\n '/{id}': {\n get: {\n operationId: 'GetNotificationLegacy',\n deprecated: true,\n description: 'Deprecated alias for `GET /notifications/{id}`.',\n parameters: [\n {\n $ref: '#/components/parameters/notificationId',\n },\n ],\n responses: {\n '200': {\n description: 'The requested notification.',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/Notification',\n },\n },\n },\n },\n default: {\n $ref: '#/components/responses/ErrorResponse',\n },\n },\n security: [\n {},\n {\n JWT: [],\n },\n ],\n },\n },\n '/notifications/{id}': {\n get: {\n operationId: 'GetNotification',\n description: 'Get a single notification by id for the current user.',\n parameters: [\n {\n $ref: '#/components/parameters/notificationId',\n },\n ],\n responses: {\n '200': {\n description: 'The requested notification.',\n content: {\n 'application/json': {\n schema: {\n $ref: '#/components/schemas/Notification',\n },\n },\n },\n },\n default: {\n $ref: '#/components/responses/ErrorResponse',\n },\n },\n security: [\n {},\n {\n JWT: [],\n },\n ],\n },\n },\n },\n} as const;\nexport const createOpenApiRouter = async (\n options?: Parameters<\n typeof createValidatedOpenApiRouterFromGeneratedEndpointMap\n >['1'],\n) =>\n createValidatedOpenApiRouterFromGeneratedEndpointMap<EndpointMap>(\n spec,\n options,\n );\n"],"names":["createValidatedOpenApiRouterFromGeneratedEndpointMap"],"mappings":";;;;AAsBO,MAAM,IAAA,GAAO;AAAA,EAClB,OAAA,EAAS,OAAA;AAAA,EACT,IAAA,EAAM;AAAA,IACJ,KAAA,EAAO,eAAA;AAAA,IACP,OAAA,EAAS,GAAA;AAAA,IACT,WAAA,EAAa,8DAAA;AAAA,IACb,OAAA,EAAS;AAAA,MACP,IAAA,EAAM,YAAA;AAAA,MACN,GAAA,EAAK;AAAA,KACP;AAAA,IACA,SAAS;AAAC,GACZ;AAAA,EACA,OAAA,EAAS;AAAA,IACP;AAAA,MACE,GAAA,EAAK;AAAA;AACP,GACF;AAAA,EACA,UAAA,EAAY;AAAA,IACV,UAAU,EAAC;AAAA,IACX,SAAS,EAAC;AAAA,IACV,UAAA,EAAY;AAAA,MACV,cAAA,EAAgB;AAAA,QACd,IAAA,EAAM,IAAA;AAAA,QACN,EAAA,EAAI,MAAA;AAAA,QACJ,QAAA,EAAU,IAAA;AAAA,QACV,MAAA,EAAQ;AAAA,UACN,IAAA,EAAM;AAAA;AACR,OACF;AAAA,MACA,MAAA,EAAQ;AAAA,QACN,IAAA,EAAM,QAAA;AAAA,QACN,EAAA,EAAI,OAAA;AAAA,QACJ,QAAA,EAAU,KAAA;AAAA,QACV,aAAA,EAAe,IAAA;AAAA,QACf,MAAA,EAAQ;AAAA,UACN,IAAA,EAAM,SAAA;AAAA,UACN,OAAA,EAAS;AAAA;AACX,OACF;AAAA,MACA,KAAA,EAAO;AAAA,QACL,IAAA,EAAM,OAAA;AAAA,QACN,EAAA,EAAI,OAAA;AAAA,QACJ,QAAA,EAAU,KAAA;AAAA,QACV,aAAA,EAAe,IAAA;AAAA,QACf,MAAA,EAAQ;AAAA,UACN,IAAA,EAAM,SAAA;AAAA,UACN,OAAA,EAAS;AAAA;AACX,OACF;AAAA,M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A;AAAA,EACE,IAAA;AAAA,EACA;AACF;;;"}
@@ -2,7 +2,7 @@
2
2
 
3
3
  var catalogModel = require('@backstage/catalog-model');
4
4
 
5
- const isUserEntityRef = (ref) => catalogModel.parseEntityRef(ref).kind.toLocaleLowerCase() === "user";
5
+ const isUserEntityRef = (ref) => catalogModel.parseEntityRef(ref).kind.toLowerCase() === "user";
6
6
  const partitionEntityRefs = (refs) => {
7
7
  const ret = [[], []];
8
8
  for (const ref of refs) {
@@ -1 +1 @@
1
- {"version":3,"file":"DefaultNotificationRecipientResolver.cjs.js","sources":["../../src/service/DefaultNotificationRecipientResolver.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 Entity,\n isGroupEntity,\n isUserEntity,\n parseEntityRef,\n RELATION_HAS_MEMBER,\n RELATION_OWNED_BY,\n RELATION_PARENT_OF,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { AuthService } from '@backstage/backend-plugin-api';\nimport { CatalogService } from '@backstage/plugin-catalog-node';\nimport { NotificationRecipientResolver } from '@backstage/plugin-notifications-node';\n\nconst isUserEntityRef = (ref: string) =>\n parseEntityRef(ref).kind.toLocaleLowerCase() === 'user';\n\n// Partitions array of entity references to two arrays; user entity refs and other entity refs\nconst partitionEntityRefs = (refs: string[]): string[][] => {\n const ret = [[], []] as string[][];\n for (const ref of refs) {\n if (isUserEntityRef(ref)) {\n ret[0].push(ref);\n } else {\n ret[1].push(ref);\n }\n }\n return ret;\n};\n\nexport class DefaultNotificationRecipientResolver\n implements NotificationRecipientResolver\n{\n private readonly auth: AuthService;\n private readonly catalog: CatalogService;\n\n constructor(auth: AuthService, catalog: CatalogService) {\n this.auth = auth;\n this.catalog = catalog;\n }\n\n async resolveNotificationRecipients(options: {\n entityRefs: string[];\n excludedEntityRefs?: string[];\n }): Promise<{ userEntityRefs: string[] }> {\n const { entityRefs, excludedEntityRefs = [] } = options;\n\n const users = new Set<string>();\n const seen = new Set<string>();\n\n const todo = [...new Set(entityRefs)];\n todo.forEach(ref => seen.add(ref));\n\n const fields = ['kind', 'metadata.name', 'metadata.namespace', 'relations'];\n\n while (todo.length) {\n const [userEntityRefs, otherEntityRefs] = partitionEntityRefs(todo);\n todo.length = 0;\n\n userEntityRefs.forEach(user => users.add(user));\n\n // Filter excluded refs to avoid unnecessary catalog lookups\n const filtered = otherEntityRefs.filter(\n ref => !excludedEntityRefs.includes(ref),\n );\n let entities: Array<Entity> = [];\n if (filtered.length > 0) {\n const fetchedEntities = await this.catalog.getEntitiesByRefs(\n {\n entityRefs: filtered,\n fields,\n },\n { credentials: await this.auth.getOwnServiceCredentials() },\n );\n entities = fetchedEntities.items.filter(\n (entity): entity is Entity => entity !== undefined,\n );\n }\n\n entities.forEach(entity => {\n const currentEntityRef = stringifyEntityRef(entity);\n if (excludedEntityRefs.includes(currentEntityRef)) {\n return;\n }\n\n if (isUserEntity(entity)) {\n users.add(currentEntityRef);\n return;\n }\n\n if (isGroupEntity(entity)) {\n for (const relation of entity.relations ?? []) {\n if (\n relation.type === RELATION_HAS_MEMBER &&\n isUserEntityRef(relation.targetRef)\n ) {\n users.add(relation.targetRef);\n } else if (\n relation.type === RELATION_PARENT_OF &&\n !seen.has(relation.targetRef)\n ) {\n seen.add(relation.targetRef);\n todo.push(relation.targetRef);\n }\n }\n return;\n }\n\n // Any other kind (component, template, ...): route to its owner and\n // let the next pass classify and expand it.\n const ownerRef = entity.relations?.find(\n relation => relation.type === RELATION_OWNED_BY,\n )?.targetRef;\n\n if (ownerRef && !seen.has(ownerRef)) {\n seen.add(ownerRef);\n todo.push(ownerRef);\n }\n });\n }\n return {\n userEntityRefs: [...new Set(users)]\n .filter(Boolean)\n // Need to filter again after resolving users\n .filter(ref => !excludedEntityRefs.includes(ref)),\n };\n }\n}\n"],"names":["parseEntityRef","stringifyEntityRef","isUserEntity","isGroupEntity","RELATION_HAS_MEMBER","RELATION_PARENT_OF","RELATION_OWNED_BY"],"mappings":";;;;AA8BA,MAAM,eAAA,GAAkB,CAAC,GAAA,KACvBA,2BAAA,CAAe,GAAG,CAAA,CAAE,IAAA,CAAK,mBAAkB,KAAM,MAAA;AAGnD,MAAM,mBAAA,GAAsB,CAAC,IAAA,KAA+B;AAC1D,EAAA,MAAM,GAAA,GAAM,CAAC,EAAC,EAAG,EAAE,CAAA;AACnB,EAAA,KAAA,MAAW,OAAO,IAAA,EAAM;AACtB,IAAA,IAAI,eAAA,CAAgB,GAAG,CAAA,EAAG;AACxB,MAAA,GAAA,CAAI,CAAC,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AAAA,IACjB,CAAA,MAAO;AACL,MAAA,GAAA,CAAI,CAAC,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AAAA,IACjB;AAAA,EACF;AACA,EAAA,OAAO,GAAA;AACT,CAAA;AAEO,MAAM,oCAAA,CAEb;AAAA,EACmB,IAAA;AAAA,EACA,OAAA;AAAA,EAEjB,WAAA,CAAY,MAAmB,OAAA,EAAyB;AACtD,IAAA,IAAA,CAAK,IAAA,GAAO,IAAA;AACZ,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AAAA,EACjB;AAAA,EAEA,MAAM,8BAA8B,OAAA,EAGM;AACxC,IAAA,MAAM,EAAE,UAAA,EAAY,kBAAA,GAAqB,IAAG,GAAI,OAAA;AAEhD,IAAA,MAAM,KAAA,uBAAY,GAAA,EAAY;AAC9B,IAAA,MAAM,IAAA,uBAAW,GAAA,EAAY;AAE7B,IAAA,MAAM,OAAO,CAAC,GAAG,IAAI,GAAA,CAAI,UAAU,CAAC,CAAA;AACp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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 Entity,\n isGroupEntity,\n isUserEntity,\n parseEntityRef,\n RELATION_HAS_MEMBER,\n RELATION_OWNED_BY,\n RELATION_PARENT_OF,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { AuthService } from '@backstage/backend-plugin-api';\nimport { CatalogService } from '@backstage/plugin-catalog-node';\nimport { NotificationRecipientResolver } from '@backstage/plugin-notifications-node';\n\nconst isUserEntityRef = (ref: string) =>\n parseEntityRef(ref).kind.toLowerCase() === 'user';\n\n// Partitions array of entity references to two arrays; user entity refs and other entity refs\nconst partitionEntityRefs = (refs: string[]): string[][] => {\n const ret = [[], []] as string[][];\n for (const ref of refs) {\n if (isUserEntityRef(ref)) {\n ret[0].push(ref);\n } else {\n ret[1].push(ref);\n }\n }\n return ret;\n};\n\nexport class DefaultNotificationRecipientResolver\n implements NotificationRecipientResolver\n{\n private readonly auth: AuthService;\n private readonly catalog: CatalogService;\n\n constructor(auth: AuthService, catalog: CatalogService) {\n this.auth = auth;\n this.catalog = catalog;\n }\n\n async resolveNotificationRecipients(options: {\n entityRefs: string[];\n excludedEntityRefs?: string[];\n }): Promise<{ userEntityRefs: string[] }> {\n const { entityRefs, excludedEntityRefs = [] } = options;\n\n const users = new Set<string>();\n const seen = new Set<string>();\n\n const todo = [...new Set(entityRefs)];\n todo.forEach(ref => seen.add(ref));\n\n const fields = ['kind', 'metadata.name', 'metadata.namespace', 'relations'];\n\n while (todo.length) {\n const [userEntityRefs, otherEntityRefs] = partitionEntityRefs(todo);\n todo.length = 0;\n\n userEntityRefs.forEach(user => users.add(user));\n\n // Filter excluded refs to avoid unnecessary catalog lookups\n const filtered = otherEntityRefs.filter(\n ref => !excludedEntityRefs.includes(ref),\n );\n let entities: Array<Entity> = [];\n if (filtered.length > 0) {\n const fetchedEntities = await this.catalog.getEntitiesByRefs(\n {\n entityRefs: filtered,\n fields,\n },\n { credentials: await this.auth.getOwnServiceCredentials() },\n );\n entities = fetchedEntities.items.filter(\n (entity): entity is Entity => entity !== undefined,\n );\n }\n\n entities.forEach(entity => {\n const currentEntityRef = stringifyEntityRef(entity);\n if (excludedEntityRefs.includes(currentEntityRef)) {\n return;\n }\n\n if (isUserEntity(entity)) {\n users.add(currentEntityRef);\n return;\n }\n\n if (isGroupEntity(entity)) {\n for (const relation of entity.relations ?? []) {\n if (\n relation.type === RELATION_HAS_MEMBER &&\n isUserEntityRef(relation.targetRef)\n ) {\n users.add(relation.targetRef);\n } else if (\n relation.type === RELATION_PARENT_OF &&\n !seen.has(relation.targetRef)\n ) {\n seen.add(relation.targetRef);\n todo.push(relation.targetRef);\n }\n }\n return;\n }\n\n // Any other kind (component, template, ...): route to its owner and\n // let the next pass classify and expand it.\n const ownerRef = entity.relations?.find(\n relation => relation.type === RELATION_OWNED_BY,\n )?.targetRef;\n\n if (ownerRef && !seen.has(ownerRef)) {\n seen.add(ownerRef);\n todo.push(ownerRef);\n }\n });\n }\n return {\n userEntityRefs: [...new Set(users)]\n .filter(Boolean)\n // Need to filter again after resolving users\n .filter(ref => !excludedEntityRefs.includes(ref)),\n };\n }\n}\n"],"names":["parseEntityRef","stringifyEntityRef","isUserEntity","isGroupEntity","RELATION_HAS_MEMBER","RELATION_PARENT_OF","RELATION_OWNED_BY"],"mappings":";;;;AA8BA,MAAM,eAAA,GAAkB,CAAC,GAAA,KACvBA,2BAAA,CAAe,GAAG,CAAA,CAAE,IAAA,CAAK,aAAY,KAAM,MAAA;AAG7C,MAAM,mBAAA,GAAsB,CAAC,IAAA,KAA+B;AAC1D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AAI,QAAA,CAAS,SAAS,CAAA,EAC5B;AACA,cAAA,IAAA,CAAK,GAAA,CAAI,SAAS,SAAS,CAAA;AAC3B,cAAA,IAAA,CAAK,IAAA,CAAK,SAAS,SAAS,CAAA;AAAA,YAC9B;AAAA,UACF;AACA,UAAA;AAAA,QACF;AAIA,QAAA,MAAM,QAAA,GAAW,OAAO,SAAA,EAAW,IAAA;AAAA,UACjC,CAAA,QAAA,KAAY,SAAS,IAAA,KAASC;AAAA,SAChC,EAAG,SAAA;AAEH,QAAA,IAAI,QAAA,IAAY,CAAC,IAAA,CAAK,GAAA,CAAI,QAAQ,CAAA,EAAG;AACnC,UAAA,IAAA,CAAK,IAAI,QAAQ,CAAA;AACjB,UAAA,IAAA,CAAK,KAAK,QAAQ,CAAA;AAAA,QACpB;AAAA,MACF,CAAC,CAAA;AAAA,IACH;AACA,IAAA,OAAO;AAAA,MACL,gBAAgB,CAAC,GAAG,IAAI,GAAA,CAAI,KAAK,CAAC,CAAA,CAC/B,MAAA,CAAO,OAAO,EAEd,MAAA,CAAO,CAAA,GAAA,KAAO,CAAC,kBAAA,CAAmB,QAAA,CAAS,GAAG,CAAC;AAAA,KACpD;AAAA,EACF;AACF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationCleaner.cjs.js","sources":["../../src/service/NotificationCleaner.ts"],"sourcesContent":["/*\n * Copyright 2025 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 LoggerService,\n SchedulerService,\n SchedulerServiceTaskScheduleDefinition,\n} from '@backstage/backend-plugin-api';\nimport { Config, readDurationFromConfig } from '@backstage/config';\nimport { NotificationsStore } from '../database';\nimport { HumanDuration } from '@backstage/types';\nimport { ForwardedError } from '@backstage/errors';\n\nexport class NotificationCleaner {\n private readonly retention: HumanDuration = { years: 1 };\n private readonly enabled: boolean = true;\n private readonly scheduler: SchedulerService;\n private readonly logger: LoggerService;\n private readonly database: NotificationsStore;\n\n constructor(\n config: Config,\n scheduler: SchedulerService,\n logger: LoggerService,\n database: NotificationsStore,\n ) {\n this.scheduler = scheduler;\n this.logger = logger;\n this.database = database;\n if (config.has('notifications.retention')) {\n const retentionConfig = config.get('notifications.retention');\n if (typeof retentionConfig === 'boolean' && !retentionConfig) {\n logger.info(\n 'Notification retention is disabled, skipping notification cleaner task',\n );\n this.enabled = false;\n return;\n }\n this.retention = readDurationFromConfig(config, {\n key: 'notifications.retention',\n });\n }\n }\n\n async initTaskRunner() {\n if (!this.enabled) {\n return;\n }\n\n const schedule: SchedulerServiceTaskScheduleDefinition = {\n frequency: { cron: '0 0 * * *' },\n timeout: { hours: 1 },\n initialDelay: { hours: 1 },\n scope: 'global',\n };\n\n const taskRunner = this.scheduler.createScheduledTaskRunner(schedule);\n await taskRunner.run({\n id: 'notification-cleaner',\n fn: async () => {\n await this.clearNotifications(\n this.logger,\n this.database,\n this.retention,\n );\n },\n });\n }\n\n private async clearNotifications(\n logger: LoggerService,\n database: NotificationsStore,\n retention: HumanDuration,\n ) {\n logger.info('Starting notification cleaner task');\n try {\n const result = await database.clearNotifications({ maxAge: retention });\n logger.info(\n `Notification cleaner task completed successfully, deleted ${result.deletedCount} notifications`,\n );\n } catch (error) {\n throw new ForwardedError('Notification cleaner task failed', error);\n }\n }\n}\n"],"names":["config","readDurationFromConfig","ForwardedError"],"mappings":";;;;;AAyBO,MAAM,mBAAA,CAAoB;AAAA,EACd,SAAA,GAA2B,EAAE,KAAA,EAAO,CAAA,EAAE;AAAA,EACtC,OAAA,GAAmB,IAAA;AAAA,EACnB,SAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AAAA,EAEjB,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CAAK;AAAA,SACP;AAAA,MACF;AAAA,KACD,CAAA;AAAA,EACH;AAAA,EAEA,MAAc,kBAAA,CACZ,MAAA,EACA,QAAA,EACA,SAAA,EACA;AACA,IAAA,MAAA,CAAO,KAAK,oCAAoC,CAAA;AAChD,IAAA,IAAI;AACF,MAAA,MAAM,SAAS,MAAM,QAAA,CAAS,mBAAmB,EAAE,MAAA,EAAQ,WAAW,CAAA;AACtE,MAAA,MAAA,CAAO,IAAA;AAAA,QACL,CAAA,0DAAA,EAA6D,OAAO,YAAY,CAAA,cAAA;AAAA,OAClF;AAAA,IACF,SAAS,KAAA,EAAO;AACd,MAAA,MAAM,IAAIE,qBAAA,CAAe,kCAAA,EAAoC,KAAK,CAAA;AAAA,IACpE;AAAA,EACF;AACF;;;;"}
1
+ {"version":3,"file":"NotificationCleaner.cjs.js","sources":["../../src/service/NotificationCleaner.ts"],"sourcesContent":["/*\n * Copyright 2025 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 LoggerService,\n SchedulerService,\n SchedulerServiceTaskScheduleDefinition,\n} from '@backstage/backend-plugin-api';\nimport { Config, readDurationFromConfig } from '@backstage/config';\nimport { NotificationsStore } from '../database';\nimport { HumanDuration } from '@backstage/types';\nimport { ForwardedError } from '@backstage/errors';\n\nexport class NotificationCleaner {\n private readonly retention: HumanDuration = { years: 1 };\n private readonly enabled: boolean = true;\n private readonly scheduler: SchedulerService;\n private readonly logger: LoggerService;\n private readonly database: NotificationsStore;\n\n constructor(\n config: Config,\n scheduler: SchedulerService,\n logger: LoggerService,\n database: NotificationsStore,\n ) {\n this.scheduler = scheduler;\n this.logger = logger;\n this.database = database;\n if (config.has('notifications.retention')) {\n const retentionConfig = config.get('notifications.retention');\n if (typeof retentionConfig === 'boolean' && !retentionConfig) {\n logger.info(\n 'Notification retention is disabled, skipping notification cleaner task',\n );\n this.enabled = false;\n return;\n }\n this.retention = readDurationFromConfig(config, {\n key: 'notifications.retention',\n });\n }\n }\n\n async initTaskRunner() {\n if (!this.enabled) {\n return;\n }\n\n const schedule: SchedulerServiceTaskScheduleDefinition = {\n frequency: { cron: '0 0 * * *' },\n timeout: { hours: 1 },\n initialDelay: { hours: 1 },\n scope: 'global',\n };\n\n const taskRunner = this.scheduler.createScheduledTaskRunner(schedule);\n await taskRunner.run({\n id: 'notification-cleaner',\n fn: async () => {\n await this.clearNotifications(\n this.logger,\n this.database,\n this.retention,\n );\n },\n });\n }\n\n private async clearNotifications(\n logger: LoggerService,\n database: NotificationsStore,\n retention: HumanDuration,\n ) {\n logger.info('Starting notification cleaner task');\n try {\n const result = await database.clearNotifications({ maxAge: retention });\n logger.info(\n `Notification cleaner task completed successfully, deleted ${result.deletedCount} notifications`,\n );\n } catch (error) {\n throw new ForwardedError('Notification cleaner task failed', error);\n }\n }\n}\n"],"names":["config","readDurationFromConfig","ForwardedError"],"mappings":";;;;;AAyBO,MAAM,mBAAA,CAAoB;AAAA,EACd,SAAA,GAA2B,EAAE,KAAA,EAAO,CAAA,EAAE;AAAA,EACtC,OAAA,GAAmB,IAAA;AAAA,EACnB,SAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AAAA,EAEjB,WAAA,CACEA,QAAA,EACA,SAAA,EACA,MAAA,EACA,QAAA,EACA;AACA,IAAA,IAAA,CAAK,SAAA,GAAY,SAAA;AACjB,IAAA,IAAA,CAAK,MAAA,GAAS,MAAA;AACd,IAAA,IAAA,CAAK,QAAA,GAAW,QAAA;AAChB,IAAA,IAAIA,QAAA,CAAO,GAAA,CAAI,yBAAyB,CAAA,EAAG;AACzC,MAAA,MAAM,eAAA,GAAkBA,QA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,CAAO,IAAA;AAAA,QACL,CAAA,0DAAA,EAA6D,OAAO,YAAY,CAAA,cAAA;AAAA,OAClF;AAAA,IACF,SAAS,KAAA,EAAO;AACd,MAAA,MAAM,IAAIE,qBAAA,CAAe,kCAAA,EAAoC,KAAK,CAAA;AAAA,IACpE;AAAA,EACF;AACF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"parseEntityOrderFieldParams.cjs.js","sources":["../../src/service/parseEntityOrderFieldParams.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\n// This file is based on the plugins/catalog-backend\n\nimport { InputError } from '@backstage/errors';\nimport { EntityOrder } from '../database';\n\n/**\n * Takes a single unknown parameter and makes sure that it's a single string or\n * an array of strings, and returns as an array.\n */\nfunction parseStringsParam(param: unknown, ctx: string): string[] | undefined {\n if (param === undefined) {\n return undefined;\n }\n\n const array = [param].flat();\n if (array.some(p => typeof p !== 'string')) {\n throw new InputError(`Invalid ${ctx}, not a string`);\n }\n\n return array as string[];\n}\n\nexport function parseEntityOrderFieldParams(\n params: Record<string, unknown>,\n): EntityOrder[] | undefined {\n const orderFieldStrings = parseStringsParam(params.orderField, 'orderField');\n if (!orderFieldStrings) {\n return undefined;\n }\n\n return orderFieldStrings.map(orderFieldString => {\n const [field, order] = orderFieldString.split(',');\n\n if (order !== undefined && !isOrder(order)) {\n throw new InputError('Invalid order field order, must be asc or desc');\n }\n return { field, order };\n });\n}\n\nfunction isOrder(order: string): order is 'asc' | 'desc' {\n return ['asc', 'desc'].includes(order);\n}\n"],"names":["InputError"],"mappings":";;;;AAyBA,SAAS,iBAAA,CAAkB,OAAgB,GAAA,EAAmC;AAC5E,EAAA,IAAI,UAAU,MAAA,EAAW;AACvB,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,MAAM,KAAA,GAAQ,CAAC,KAAK,CAAA,CAAE,IAAA,EAAK;AAC3B,EAAA,IAAI,MAAM,IAAA,CAAK,CAAA,CAAA,KAAK,OAAO,CAAA,KAAM,QAAQ,CAAA,EAAG;AAC1C,IAAA,MAAM,IAAIA,iBAAA,CAAW,CAAA,QAAA,EAAW,GAAG,CAAA,cAAA,CAAgB,CAAA;AAAA,EACrD;AAEA,EAAA,OAAO,KAAA;AACT;AAEO,SAAS,4BACd,MAAA,EAC2B;AAC3B,EAAA,MAAM,iBAAA,GAAoB,iBAAA,CAAkB,MAAA,CAAO,UAAA,EAAY,YAAY,CAAA;AAC3E,EAAA,IAAI,CAAC,iBAAA,EAAmB;AACtB,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,OAAO,iBAAA,CAAkB,IAAI,CAAA,gBAAA,KAAoB;AAC/C,IAAA,MAAM,CAAC,KAAA,EAAO,KAAK,CAAA,GAAI,gBAAA,CAAiB,MAAM,GAAG,CAAA;AAEjD,IAAA,IAAI,KAAA,KAAU,MAAA,IAAa,CAAC,OAAA,CAAQ,KAAK,CAAA,EAAG;AAC1C,MAAA,MAAM,IAAIA,kBAAW,gDAAgD,CAAA;AAAA,IACvE;AACA,IAAA,OAAO,EAAE,OAAO,KAAA,EAAM;AAAA,EACxB,CAAC,CAAA;AACH;AAEA,SAAS,QAAQ,KAAA,EAAwC;AACvD,EAAA,OAAO,CAAC,KAAA,EAAO,MAAM,CAAA,CAAE,SAAS,KAAK,CAAA;AACvC;;;;"}
1
+ {"version":3,"file":"parseEntityOrderFieldParams.cjs.js","sources":["../../src/service/parseEntityOrderFieldParams.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\n// This file is based on the plugins/catalog-backend\n\nimport { InputError } from '@backstage/errors';\nimport { EntityOrder } from '../database';\n\n/**\n * Takes a single unknown parameter and makes sure that it's a single string or\n * an array of strings, and returns as an array.\n */\nfunction parseStringsParam(param: unknown, ctx: string): string[] | undefined {\n if (param === undefined) {\n return undefined;\n }\n\n const array = [param].flat();\n if (array.some(p => typeof p !== 'string')) {\n throw new InputError(`Invalid ${ctx}, not a string`);\n }\n\n return array as string[];\n}\n\nexport function parseEntityOrderFieldParams(\n params: Record<string, unknown>,\n): EntityOrder[] | undefined {\n const orderFieldStrings = parseStringsParam(params.orderField, 'orderField');\n if (!orderFieldStrings) {\n return undefined;\n }\n\n return orderFieldStrings.map(orderFieldString => {\n const [field, order] = orderFieldString.split(',');\n\n if (order !== undefined && !isOrder(order)) {\n throw new InputError('Invalid order field order, must be asc or desc');\n }\n return { field, order };\n });\n}\n\nfunction isOrder(order: string): order is 'asc' | 'desc' {\n return ['asc', 'desc'].includes(order);\n}\n"],"names":["InputError"],"mappings":";;;;AAyBA,SAAS,iBAAA,CAAkB,OAAgB,GAAA,EAAmC;AAC5E,EAAA,IAAI,UAAU,MAAA,EAAW;AACvB,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,MAAM,KAAA,GAAQ,CAAC,KAAK,CAAA,CAAE,IAAA,EAAK;AAC3B,EAAA,IAAI,MAAM,IAAA,CAAK,CAAA,CAAA,KAAK,OAAO,CAAA,KAAM,QAAQ,CAAA,EAAG;AAC1C,IAAA,MAAM,IAAIA,iBAAA,CAAW,CAAA,QAAA,EAAW,GAAG,CAAA,cAAA,CAAgB,CAAA;AAAA,EACrD;AAEA,EAAA,OAAO,KAAA;AACT;AAEO,SAAS,4BACd,MAAA,EAC2B;AAC3B,EAAA,MAAM,iBAAA,GAAoB,iBAAA,CAAkB,MAAA,CAAO,UAAA,EAAY,YAAY,CAAA;AAC3E,EAAA,IAAI,CAAC,iBAAA,EAAmB;AACtB,IAAA,OAAO,MAAA;AAAA,EACT;AAEA,EAAA,OAAO,iBAAA,CAAkB,IAAI,CAAA,gBAAA,KAAoB;AAC/C,IAAA,MAAM,CAAC,KAAA,EAAO,KAAK,CAAA,GAAI,gBAAA,CAAiB,MAAM,GAAG,CAAA;AAEjD,IAAA,IAAI,KAAA,KAAU,MAAA,IAAa,CAAC,OAAA,CAAQ,KAAK,CAAA,EAAG;AAC1C,MAAA,MAAM,IAAIA,kBAAW,gDAAgD,CAAA;AAAA,IACvE;AACA,IAAA,OAAO,EAAE,OAAO,KAAA,EAAM;AAAA,EACxB,CAAC,CAAA;AACH;AAEA,SAAS,QAAQ,KAAA,EAAwC;AACvD,EAAA,OAAO,CAAC,KAAA,EAAO,MAAM,CAAA,CAAE,SAAS,KAAK,CAAA;AACvC;;"}
@@ -1 +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 express, { Request } from 'express';\nimport { createOpenApiRouter, EndpointMap } from '../schema/openapi';\nimport { internal as openapi } from '@backstage/backend-openapi-utils';\nimport {\n normalizeSeverity,\n NotificationGetOptions,\n NotificationsStore,\n TopicGetOptions,\n} from '../database';\nimport { randomUUID as uuid } from 'node:crypto';\nimport { CatalogService } from '@backstage/plugin-catalog-node';\nimport {\n NotificationProcessor,\n NotificationRecipientResolver,\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 ChannelSetting,\n isNotificationsEnabledFor,\n NewNotificationSignal,\n Notification,\n NotificationReadSignal,\n NotificationSettings,\n notificationSeverities,\n OriginSetting,\n} from '@backstage/plugin-notifications-common';\nimport { parseEntityOrderFieldParams } from './parseEntityOrderFieldParams';\nimport { Config, readDurationFromConfig } from '@backstage/config';\nimport { durationToMilliseconds } from '@backstage/types';\nimport pThrottle from 'p-throttle';\nimport { parseEntityRef } from '@backstage/catalog-model';\nimport { DefaultNotificationRecipientResolver } from './DefaultNotificationRecipientResolver.ts';\n\n/** @internal */\nexport interface RouterOptions {\n logger: LoggerService;\n config: Config;\n store: NotificationsStore;\n auth: AuthService;\n httpAuth: HttpAuthService;\n userInfo: UserInfoService;\n signals?: SignalsService;\n catalog: CatalogService;\n processors?: NotificationProcessor[];\n recipientResolver?: NotificationRecipientResolver;\n}\n\n/** @internal */\nexport async function createRouter(\n options: RouterOptions,\n): Promise<express.Router> {\n const {\n config,\n logger,\n store,\n auth,\n httpAuth,\n userInfo,\n catalog,\n processors = [],\n signals,\n recipientResolver,\n } = options;\n\n const WEB_NOTIFICATION_CHANNEL = 'Web';\n const frontendBaseUrl = config.getString('app.baseUrl');\n const concurrencyLimit =\n config.getOptionalNumber('notifications.concurrencyLimit') ?? 10;\n const throttleInterval = config.has('notifications.throttleInterval')\n ? durationToMilliseconds(\n readDurationFromConfig(config, {\n key: 'notifications.throttleInterval',\n }),\n )\n : 50;\n const throttle = pThrottle({\n limit: concurrencyLimit,\n interval: throttleInterval,\n });\n const defaultNotificationSettings: NotificationSettings | undefined =\n config.getOptional<NotificationSettings>('notifications.defaultSettings');\n\n const usedRecipientResolver =\n recipientResolver ??\n new DefaultNotificationRecipientResolver(auth, catalog);\n\n const getUser = async (req: Request<any, any, any, any, any>) => {\n const credentials = await httpAuth.credentials(req, { allow: ['user'] });\n const info = await userInfo.getUserInfo(credentials);\n return info.userEntityRef;\n };\n\n const getNotificationChannels = () => {\n return [WEB_NOTIFICATION_CHANNEL, ...processors.map(p => p.getName())];\n };\n\n const getTopicSettings = (\n topic: any,\n existingOrigin: OriginSetting | undefined,\n defaultOriginSettings: OriginSetting | undefined,\n channelDefaultEnabled: boolean,\n ) => {\n const existingTopic = existingOrigin?.topics?.find(\n t => t.id.toLowerCase() === topic.topic.toLowerCase(),\n );\n const defaultTopicSettings = defaultOriginSettings?.topics?.find(\n t => t.id.toLowerCase() === topic.topic.toLowerCase(),\n );\n\n // If topic has explicit setting, use it\n // Otherwise check default topic settings from config\n // Otherwise use channel default (not origin enabled state)\n return {\n id: topic.topic,\n enabled: existingTopic\n ? existingTopic.enabled\n : defaultTopicSettings?.enabled ?? channelDefaultEnabled,\n };\n };\n\n const getOriginSettings = (\n originId: string,\n existingChannel: ChannelSetting | undefined,\n defaultChannelSettings: ChannelSetting | undefined,\n topics: { origin: string; topic: string }[],\n channelDefaultEnabled: boolean,\n channelHasExplicitEnabled: boolean,\n ) => {\n const existingOrigin = existingChannel?.origins?.find(\n o => o.id.toLowerCase() === originId.toLowerCase(),\n );\n\n const defaultOriginSettings = defaultChannelSettings?.origins?.find(\n c => c.id.toLowerCase() === originId.toLowerCase(),\n );\n\n const defaultEnabled = existingOrigin\n ? existingOrigin.enabled\n : defaultOriginSettings?.enabled ?? channelDefaultEnabled;\n\n return {\n id: originId,\n enabled: defaultEnabled,\n topics: topics\n .filter(t => t.origin === originId)\n .map(t =>\n getTopicSettings(\n t,\n existingOrigin,\n defaultOriginSettings,\n channelHasExplicitEnabled ? channelDefaultEnabled : defaultEnabled,\n ),\n ),\n };\n };\n\n const getChannelSettings = (\n channelId: string,\n settings: NotificationSettings,\n origins: string[],\n topics: { origin: string; topic: string }[],\n ) => {\n const existingChannel = settings.channels.find(\n c => c.id.toLowerCase() === channelId.toLowerCase(),\n );\n const defaultChannelSettings = defaultNotificationSettings?.channels?.find(\n c => c.id.toLowerCase() === channelId.toLowerCase(),\n );\n\n // Determine channel enabled state\n const channelEnabled =\n existingChannel?.enabled ?? defaultChannelSettings?.enabled;\n\n // Use channel's enabled flag as the default for origins if not explicitly set\n const defaultEnabledForOrigins = channelEnabled ?? true;\n\n // Check if channel has explicit enabled flag (either from user settings or config)\n const channelHasExplicitEnabled =\n existingChannel?.enabled !== undefined ||\n defaultChannelSettings?.enabled !== undefined;\n\n return {\n id: channelId,\n enabled: channelEnabled,\n origins: origins.map(originId =>\n getOriginSettings(\n originId,\n existingChannel,\n defaultChannelSettings,\n topics,\n defaultEnabledForOrigins,\n channelHasExplicitEnabled,\n ),\n ),\n };\n };\n\n const getNotificationSettings = async (\n user: string,\n ): Promise<NotificationSettings> => {\n const { origins } = await store.getUserNotificationOrigins({ user });\n const { topics } = await store.getUserNotificationTopics({ user });\n const settings = await store.getNotificationSettings({ user });\n const channels = getNotificationChannels();\n\n // Merge existing channels/origins/topics with configured settings\n for (const channel of defaultNotificationSettings?.channels ?? []) {\n if (!channels.includes(channel.id)) {\n channels.push(channel.id);\n }\n\n for (const origin of channel.origins ?? []) {\n if (!origins.includes(origin.id)) {\n origins.push(origin.id);\n }\n\n for (const topic of origin.topics ?? []) {\n if (\n !topics.some(t => t.origin === origin.id && t.topic === topic.id)\n ) {\n topics.push({ origin: origin.id, topic: topic.id });\n }\n }\n }\n }\n\n return {\n channels: channels.map(channelId =>\n getChannelSettings(channelId, settings, origins, topics),\n ),\n };\n };\n\n const isNotificationsEnabled = async (opts: {\n user: string;\n channel: string;\n origin: string;\n topic: string | null;\n }) => {\n // Get user's explicit settings from database\n const userSettings = await store.getNotificationSettings({\n user: opts.user,\n });\n\n // Build a minimal settings object with user settings and config defaults\n const settings: NotificationSettings = {\n channels: [\n {\n id: opts.channel,\n enabled: defaultNotificationSettings?.channels?.find(\n c => c.id.toLowerCase() === opts.channel.toLowerCase(),\n )?.enabled,\n origins: [],\n },\n ],\n };\n\n // Add user's channel if it exists\n const userChannel = userSettings.channels.find(\n c => c.id.toLowerCase() === opts.channel.toLowerCase(),\n );\n if (userChannel) {\n settings.channels[0] = {\n ...settings.channels[0],\n enabled: userChannel.enabled ?? settings.channels[0].enabled,\n origins: userChannel.origins ?? [],\n };\n }\n\n // Add config default origins if not in user settings\n // Only add origins if the channel is enabled (not explicitly disabled)\n const defaultChannelSettings = defaultNotificationSettings?.channels?.find(\n c => c.id.toLowerCase() === opts.channel.toLowerCase(),\n );\n if (\n defaultChannelSettings?.origins &&\n settings.channels[0].enabled !== false\n ) {\n for (const defaultOrigin of defaultChannelSettings.origins) {\n if (\n !settings.channels[0].origins.some(\n o => o.id.toLowerCase() === defaultOrigin.id.toLowerCase(),\n )\n ) {\n settings.channels[0].origins.push(defaultOrigin);\n }\n }\n }\n\n return isNotificationsEnabledFor(\n settings,\n opts.channel,\n opts.origin,\n opts.topic,\n );\n };\n\n const filterProcessors = async (\n notification:\n | Notification\n | ({ origin: string; user: null } & NotificationSendOptions),\n ) => {\n const result: NotificationProcessor[] = [];\n const { payload, user, origin } = notification;\n\n for (const processor of processors) {\n if (user) {\n const enabled = await isNotificationsEnabled({\n user,\n origin,\n channel: processor.getName(),\n topic: payload.topic ?? null,\n });\n if (!enabled) {\n continue;\n }\n }\n\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 if (filters.includedTopics) {\n if (\n !payload.topic ||\n !filters.includedTopics.includes(payload.topic)\n ) {\n continue;\n }\n }\n }\n result.push(processor);\n }\n\n return result;\n };\n\n const processOptions = async (\n opts: NotificationSendOptions,\n origin: string,\n ): Promise<NotificationSendOptions> => {\n const filtered = await filterProcessors({ ...opts, origin, user: null });\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 = await filterProcessors(notification);\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 = await filterProcessors(notification);\n for (const processor of filtered) {\n if (!processor.postProcess) {\n continue;\n }\n\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 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 const appendCommonOptions = (\n req: {\n query: openapi.StaticQueryParamsSchema<EndpointMap, '/topics', 'get'>;\n },\n opts: NotificationGetOptions | TopicGetOptions,\n ) => {\n if (req.query.search) {\n opts.search = req.query.search;\n }\n if (req.query.read === 'true') {\n opts.read = true;\n } else if (req.query.read === 'false') {\n opts.read = false;\n }\n\n if (req.query.saved === 'true') {\n opts.saved = true;\n } else if (req.query.saved === 'false') {\n opts.saved = false;\n }\n if (req.query.createdAfter) {\n const sinceEpoch = Date.parse(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(req.query.minimumSeverity);\n }\n };\n\n const router = await createOpenApiRouter();\n\n const listNotificationsHandler: openapi.EndpointMapRequestHandler<\n EndpointMap,\n '/notifications',\n 'get'\n > = async (req, res) => {\n const user = await getUser(req);\n const opts: NotificationGetOptions = { user };\n if (req.query.offset !== undefined) {\n opts.offset = req.query.offset;\n }\n if (req.query.limit !== undefined) {\n opts.limit = req.query.limit;\n }\n if (req.query.orderField !== undefined) {\n opts.orderField = parseEntityOrderFieldParams({\n orderField: req.query.orderField,\n });\n }\n if (req.query.topic) {\n opts.topic = req.query.topic;\n }\n appendCommonOptions(req, opts);\n\n const [notifications, totalCount] = await Promise.all([\n store.getNotifications(opts),\n store.getNotificationsCount(opts),\n ]);\n res.json({ totalCount, notifications });\n };\n\n router.get('/', listNotificationsHandler); // Deprecated alias of /notifications\n router.get('/notifications', listNotificationsHandler);\n\n router.get('/status', async (req, res) => {\n const user = await getUser(req);\n const status = await store.getStatus({ user });\n res.json(status);\n });\n\n router.get('/settings', async (req, res) => {\n const user = await getUser(req);\n const response = await getNotificationSettings(user);\n res.json(response);\n });\n\n router.post('/settings', async (req, res) => {\n const user = await getUser(req);\n const channels = getNotificationChannels();\n const settings: NotificationSettings = req.body;\n if (settings.channels.some(c => !channels.includes(c.id))) {\n throw new InputError('Invalid channel');\n }\n await store.saveNotificationSettings({ user, settings });\n const response = await getNotificationSettings(user);\n res.json(response);\n });\n\n router.get('/topics', async (req, res) => {\n const user = await getUser(req);\n const opts: TopicGetOptions = { user };\n appendCommonOptions(req, opts);\n const topics = await store.getTopics(opts);\n res.json(topics);\n });\n\n const getNotificationHandler: openapi.EndpointMapRequestHandler<\n EndpointMap,\n '/notifications/{id}',\n 'get'\n > = async (req, res) => {\n const user = await getUser(req);\n const opts: NotificationGetOptions = {\n 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 // Make sure this is the last \"GET\" handler.\n router.get('/:id', getNotificationHandler); // Deprecated alias of /notifications/:id\n router.get('/notifications/:id', getNotificationHandler);\n\n const updateNotificationsHandler: openapi.EndpointMapRequestHandler<\n EndpointMap,\n '/notifications/update',\n 'post'\n > = async (req, res) => {\n const user = await getUser(req);\n const { ids, read, saved } = req.body;\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, 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, ids });\n } else if (saved === false) {\n await store.markUnsaved({ user, ids });\n }\n\n const notifications = await store.getNotifications({ ids, user });\n res.json(notifications);\n };\n\n router.post('/update', updateNotificationsHandler); // Deprecated alias of /notifications/update\n router.post('/notifications/update', updateNotificationsHandler);\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 }\n postProcessNotification(ret, opts);\n return notification;\n };\n\n const sendUserNotification = async (\n baseNotification: Omit<Notification, 'user' | 'id'>,\n user: string,\n opts: NotificationSendOptions,\n origin: string,\n scope?: string,\n ): Promise<Notification | undefined> => {\n const userNotification = {\n ...baseNotification,\n id: uuid(),\n user,\n };\n const notification = await preProcessNotification(userNotification, opts);\n\n const enabled = await isNotificationsEnabled({\n user,\n channel: WEB_NOTIFICATION_CHANNEL,\n origin: userNotification.origin,\n topic: userNotification.payload.topic ?? null,\n });\n\n let ret = notification;\n\n if (!enabled) {\n postProcessNotification(ret, opts);\n return undefined;\n }\n\n let existingNotification;\n if (scope) {\n existingNotification = await store.getExistingScopeNotification({\n user,\n scope,\n origin,\n });\n }\n\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 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 return ret;\n };\n\n const filterNonUserEntityRefs = (refs: string[]): string[] => {\n return refs.filter(ref => {\n try {\n const parsed = parseEntityRef(ref);\n return parsed.kind.toLowerCase() === 'user';\n } catch {\n return false;\n }\n });\n };\n\n const sendUserNotifications = async (\n baseNotification: Omit<Notification, 'user' | 'id'>,\n users: string[],\n opts: NotificationSendOptions,\n origin: string,\n ): Promise<Notification[]> => {\n const { scope } = opts.payload;\n const uniqueUsers = [...new Set(filterNonUserEntityRefs(users))];\n const throttled = throttle((user: string) =>\n sendUserNotification(baseNotification, user, opts, origin, scope),\n );\n const sent = await Promise.all(uniqueUsers.map(user => throttled(user)));\n return sent.filter(n => n !== undefined);\n };\n\n const createNotificationsHandler: openapi.EndpointMapRequestHandler<\n EndpointMap,\n '/notifications',\n 'post'\n > = async (req, res) => {\n const credentials = await httpAuth.credentials(req, {\n allow: ['service'],\n });\n\n const origin = credentials.principal.subject;\n const opts = await processOptions(req.body, origin);\n const { recipients, payload } = opts;\n const { title, link } = payload;\n const notifications: Notification[] = [];\n\n if (!recipients || !title) {\n const missing = [\n !title ? 'title' : null,\n !recipients ? 'recipients' : null,\n ].filter(Boolean);\n const err = `Invalid notification request received: missing ${missing.join(\n ', ',\n )}`;\n throw new InputError(err);\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 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 if (recipients.type === 'entity') {\n const entityRefs = [recipients.entityRef].flat();\n const excludedEntityRefs = recipients.excludeEntityRef\n ? [recipients.excludeEntityRef].flat()\n : undefined;\n try {\n const { userEntityRefs } =\n await usedRecipientResolver.resolveNotificationRecipients({\n entityRefs,\n excludedEntityRefs,\n });\n const userNotifications = await sendUserNotifications(\n baseNotification,\n userEntityRefs,\n opts,\n origin,\n );\n notifications.push(...userNotifications);\n } catch (e) {\n throw new InputError('Failed to send user notifications', e);\n }\n } else {\n throw new InputError(\n `Invalid recipients type, please use either 'broadcast' or 'entity'`,\n );\n }\n\n res.json(notifications);\n };\n\n // Add new notification\n router.post('/', createNotificationsHandler); // Deprecated alias of /notifications\n router.post('/notifications', createNotificationsHandler);\n\n return router;\n}\n"],"names":["config","durationToMilliseconds","readDurationFromConfig","pThrottle","DefaultNotificationRecipientResolver","isNotificationsEnabledFor","notificationSeverities","InputError","normalizeSeverity","router","createOpenApiRouter","parseEntityOrderFieldParams","NotFoundError","uuid","parseEntityRef"],"mappings":";;;;;;;;;;;;;;;;;;AAwEA,eAAsB,aACpB,OAAA,EACyB;AACzB,EAAA,MAAM;AAAA,YACJA,QAAA;AAAA,IACA,MAAA;AAAA,IACA,KAAA;AAAA,IACA,IAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA,OAAA;AAAA,IACA,aAAa,EAAC;AAAA,IACd,OAAA;AAAA,IACA;AAAA,GACF,GAAI,OAAA;AAEJ,EAAA,MAAM,wBAAA,GAA2B,KAAA;AACjC,EAAA,MAAM,eAAA,GAAkBA,QAAA,CAAO,SAAA,CAAU,aAAa,CAAA;AACtD,EAAA,MAAM,gBAAA,GACJA,QAAA,CAAO,iBAAA,CAAkB,gCAAgC,CAAA,IAAK,EAAA;AAChE,EAAA,MAAM,gBAAA,GAAmBA,QAAA,CAAO,GAAA,CAAI,gCAAgC,CAAA,GAChEC,4BAAA;AAAA,IACEC,8BAAuBF,QAAA,EAAQ;AAAA,MAC7B,GAAA,EAAK;AAAA,KACN;AAAA,GACH,GACA,EAAA;AACJ,EAAA,MAAM,WAAWG,0BAAA,CAAU;AAAA,IACzB,KAAA,EAAO,gBAAA;AAAA,IACP,QAAA,EAAU;AAAA,GACX,CAAA;AACD,EAAA,MAAM,2BAAA,GACJH,QAAA,CAAO,WAAA,CAAkC,+BAA+B,CAAA;AAE1E,EAAA,MAAM,qBAAA,GACJ,iBAAA,IACA,IAAII,yEAAA,CAAqC,MAAM,OAAO,CAAA;AAExD,EAAA,MAAM,OAAA,GAAU,OAAO,GAAA,KAA0C;AAC/D,IAAA,MAAM,WAAA,GAAc,MAAM,QAAA,CAAS,WAAA,CAAY,GAAA,EAAK,EAAE,KAAA,EAAO,CAAC,MAAM,CAAA,EAAG,CAAA;AACvE,IAAA,MAAM,IAAA,GAAO,MAAM,QAAA,CAAS,WAA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AAI,KAAK,aAAa,CAAA;AAAA,EACxB,CAAA;AAGA,EAAAE,QAAA,CAAO,IAAA,CAAK,KAAK,0BAA0B,CAAA;AAC3C,EAAAA,QAAA,CAAO,IAAA,CAAK,kBAAkB,0BAA0B,CAAA;AAExD,EAAA,OAAOA,QAAA;AACT;;;;"}
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 express, { Request } from 'express';\nimport { createOpenApiRouter, EndpointMap } from '../schema/openapi';\nimport { internal as openapi } from '@backstage/backend-openapi-utils';\nimport {\n normalizeSeverity,\n NotificationGetOptions,\n NotificationsStore,\n TopicGetOptions,\n} from '../database';\nimport { randomUUID as uuid } from 'node:crypto';\nimport { CatalogService } from '@backstage/plugin-catalog-node';\nimport {\n NotificationProcessor,\n NotificationRecipientResolver,\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 ChannelSetting,\n isNotificationsEnabledFor,\n NewNotificationSignal,\n Notification,\n NotificationReadSignal,\n NotificationSettings,\n notificationSeverities,\n OriginSetting,\n} from '@backstage/plugin-notifications-common';\nimport { parseEntityOrderFieldParams } from './parseEntityOrderFieldParams';\nimport { Config, readDurationFromConfig } from '@backstage/config';\nimport { durationToMilliseconds } from '@backstage/types';\nimport pThrottle from 'p-throttle';\nimport { parseEntityRef } from '@backstage/catalog-model';\nimport { DefaultNotificationRecipientResolver } from './DefaultNotificationRecipientResolver.ts';\n\n/** @internal */\nexport interface RouterOptions {\n logger: LoggerService;\n config: Config;\n store: NotificationsStore;\n auth: AuthService;\n httpAuth: HttpAuthService;\n userInfo: UserInfoService;\n signals?: SignalsService;\n catalog: CatalogService;\n processors?: NotificationProcessor[];\n recipientResolver?: NotificationRecipientResolver;\n}\n\n/** @internal */\nexport async function createRouter(\n options: RouterOptions,\n): Promise<express.Router> {\n const {\n config,\n logger,\n store,\n auth,\n httpAuth,\n userInfo,\n catalog,\n processors = [],\n signals,\n recipientResolver,\n } = options;\n\n const WEB_NOTIFICATION_CHANNEL = 'Web';\n const frontendBaseUrl = config.getString('app.baseUrl');\n const concurrencyLimit =\n config.getOptionalNumber('notifications.concurrencyLimit') ?? 10;\n const throttleInterval = config.has('notifications.throttleInterval')\n ? durationToMilliseconds(\n readDurationFromConfig(config, {\n key: 'notifications.throttleInterval',\n }),\n )\n : 50;\n const throttle = pThrottle({\n limit: concurrencyLimit,\n interval: throttleInterval,\n });\n const defaultNotificationSettings: NotificationSettings | undefined =\n config.getOptional<NotificationSettings>('notifications.defaultSettings');\n\n const usedRecipientResolver =\n recipientResolver ??\n new DefaultNotificationRecipientResolver(auth, catalog);\n\n const getUser = async (req: Request<any, any, any, any, any>) => {\n const credentials = await httpAuth.credentials(req, { allow: ['user'] });\n const info = await userInfo.getUserInfo(credentials);\n return info.userEntityRef;\n };\n\n const getNotificationChannels = () => {\n return [WEB_NOTIFICATION_CHANNEL, ...processors.map(p => p.getName())];\n };\n\n const getTopicSettings = (\n topic: any,\n existingOrigin: OriginSetting | undefined,\n defaultOriginSettings: OriginSetting | undefined,\n channelDefaultEnabled: boolean,\n ) => {\n const existingTopic = existingOrigin?.topics?.find(\n t => t.id.toLowerCase() === topic.topic.toLowerCase(),\n );\n const defaultTopicSettings = defaultOriginSettings?.topics?.find(\n t => t.id.toLowerCase() === topic.topic.toLowerCase(),\n );\n\n // If topic has explicit setting, use it\n // Otherwise check default topic settings from config\n // Otherwise use channel default (not origin enabled state)\n return {\n id: topic.topic,\n enabled: existingTopic\n ? existingTopic.enabled\n : defaultTopicSettings?.enabled ?? channelDefaultEnabled,\n };\n };\n\n const getOriginSettings = (\n originId: string,\n existingChannel: ChannelSetting | undefined,\n defaultChannelSettings: ChannelSetting | undefined,\n topics: { origin: string; topic: string }[],\n channelDefaultEnabled: boolean,\n channelHasExplicitEnabled: boolean,\n ) => {\n const existingOrigin = existingChannel?.origins?.find(\n o => o.id.toLowerCase() === originId.toLowerCase(),\n );\n\n const defaultOriginSettings = defaultChannelSettings?.origins?.find(\n c => c.id.toLowerCase() === originId.toLowerCase(),\n );\n\n const defaultEnabled = existingOrigin\n ? existingOrigin.enabled\n : defaultOriginSettings?.enabled ?? channelDefaultEnabled;\n\n return {\n id: originId,\n enabled: defaultEnabled,\n topics: topics\n .filter(t => t.origin === originId)\n .map(t =>\n getTopicSettings(\n t,\n existingOrigin,\n defaultOriginSettings,\n channelHasExplicitEnabled ? channelDefaultEnabled : defaultEnabled,\n ),\n ),\n };\n };\n\n const getChannelSettings = (\n channelId: string,\n settings: NotificationSettings,\n origins: string[],\n topics: { origin: string; topic: string }[],\n ) => {\n const existingChannel = settings.channels.find(\n c => c.id.toLowerCase() === channelId.toLowerCase(),\n );\n const defaultChannelSettings = defaultNotificationSettings?.channels?.find(\n c => c.id.toLowerCase() === channelId.toLowerCase(),\n );\n\n // Determine channel enabled state\n const channelEnabled =\n existingChannel?.enabled ?? defaultChannelSettings?.enabled;\n\n // Use channel's enabled flag as the default for origins if not explicitly set\n const defaultEnabledForOrigins = channelEnabled ?? true;\n\n // Check if channel has explicit enabled flag (either from user settings or config)\n const channelHasExplicitEnabled =\n existingChannel?.enabled !== undefined ||\n defaultChannelSettings?.enabled !== undefined;\n\n return {\n id: channelId,\n enabled: channelEnabled,\n origins: origins.map(originId =>\n getOriginSettings(\n originId,\n existingChannel,\n defaultChannelSettings,\n topics,\n defaultEnabledForOrigins,\n channelHasExplicitEnabled,\n ),\n ),\n };\n };\n\n const getNotificationSettings = async (\n user: string,\n ): Promise<NotificationSettings> => {\n const { origins } = await store.getUserNotificationOrigins({ user });\n const { topics } = await store.getUserNotificationTopics({ user });\n const settings = await store.getNotificationSettings({ user });\n const channels = getNotificationChannels();\n\n // Merge existing channels/origins/topics with configured settings\n for (const channel of defaultNotificationSettings?.channels ?? []) {\n if (!channels.includes(channel.id)) {\n channels.push(channel.id);\n }\n\n for (const origin of channel.origins ?? []) {\n if (!origins.includes(origin.id)) {\n origins.push(origin.id);\n }\n\n for (const topic of origin.topics ?? []) {\n if (\n !topics.some(t => t.origin === origin.id && t.topic === topic.id)\n ) {\n topics.push({ origin: origin.id, topic: topic.id });\n }\n }\n }\n }\n\n return {\n channels: channels.map(channelId =>\n getChannelSettings(channelId, settings, origins, topics),\n ),\n };\n };\n\n const isNotificationsEnabled = async (opts: {\n user: string;\n channel: string;\n origin: string;\n topic: string | null;\n }) => {\n // Get user's explicit settings from database\n const userSettings = await store.getNotificationSettings({\n user: opts.user,\n });\n\n // Build a minimal settings object with user settings and config defaults\n const settings: NotificationSettings = {\n channels: [\n {\n id: opts.channel,\n enabled: defaultNotificationSettings?.channels?.find(\n c => c.id.toLowerCase() === opts.channel.toLowerCase(),\n )?.enabled,\n origins: [],\n },\n ],\n };\n\n // Add user's channel if it exists\n const userChannel = userSettings.channels.find(\n c => c.id.toLowerCase() === opts.channel.toLowerCase(),\n );\n if (userChannel) {\n settings.channels[0] = {\n ...settings.channels[0],\n enabled: userChannel.enabled ?? settings.channels[0].enabled,\n origins: userChannel.origins ?? [],\n };\n }\n\n // Add config default origins if not in user settings\n // Only add origins if the channel is enabled (not explicitly disabled)\n const defaultChannelSettings = defaultNotificationSettings?.channels?.find(\n c => c.id.toLowerCase() === opts.channel.toLowerCase(),\n );\n if (\n defaultChannelSettings?.origins &&\n settings.channels[0].enabled !== false\n ) {\n for (const defaultOrigin of defaultChannelSettings.origins) {\n if (\n !settings.channels[0].origins.some(\n o => o.id.toLowerCase() === defaultOrigin.id.toLowerCase(),\n )\n ) {\n settings.channels[0].origins.push(defaultOrigin);\n }\n }\n }\n\n return isNotificationsEnabledFor(\n settings,\n opts.channel,\n opts.origin,\n opts.topic,\n );\n };\n\n const filterProcessors = async (\n notification:\n | Notification\n | ({ origin: string; user: null } & NotificationSendOptions),\n ) => {\n const result: NotificationProcessor[] = [];\n const { payload, user, origin } = notification;\n\n for (const processor of processors) {\n if (user) {\n const enabled = await isNotificationsEnabled({\n user,\n origin,\n channel: processor.getName(),\n topic: payload.topic ?? null,\n });\n if (!enabled) {\n continue;\n }\n }\n\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 if (filters.includedTopics) {\n if (\n !payload.topic ||\n !filters.includedTopics.includes(payload.topic)\n ) {\n continue;\n }\n }\n }\n result.push(processor);\n }\n\n return result;\n };\n\n const processOptions = async (\n opts: NotificationSendOptions,\n origin: string,\n ): Promise<NotificationSendOptions> => {\n const filtered = await filterProcessors({ ...opts, origin, user: null });\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 = await filterProcessors(notification);\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 = await filterProcessors(notification);\n for (const processor of filtered) {\n if (!processor.postProcess) {\n continue;\n }\n\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 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 const appendCommonOptions = (\n req: {\n query: openapi.StaticQueryParamsSchema<EndpointMap, '/topics', 'get'>;\n },\n opts: NotificationGetOptions | TopicGetOptions,\n ) => {\n if (req.query.search) {\n opts.search = req.query.search;\n }\n if (req.query.read === 'true') {\n opts.read = true;\n } else if (req.query.read === 'false') {\n opts.read = false;\n }\n\n if (req.query.saved === 'true') {\n opts.saved = true;\n } else if (req.query.saved === 'false') {\n opts.saved = false;\n }\n if (req.query.createdAfter) {\n const sinceEpoch = Date.parse(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(req.query.minimumSeverity);\n }\n };\n\n const router = await createOpenApiRouter();\n\n const listNotificationsHandler: openapi.EndpointMapRequestHandler<\n EndpointMap,\n '/notifications',\n 'get'\n > = async (req, res) => {\n const user = await getUser(req);\n const opts: NotificationGetOptions = { user };\n if (req.query.offset !== undefined) {\n opts.offset = req.query.offset;\n }\n if (req.query.limit !== undefined) {\n opts.limit = req.query.limit;\n }\n if (req.query.orderField !== undefined) {\n opts.orderField = parseEntityOrderFieldParams({\n orderField: req.query.orderField,\n });\n }\n if (req.query.topic) {\n opts.topic = req.query.topic;\n }\n appendCommonOptions(req, opts);\n\n const [notifications, totalCount] = await Promise.all([\n store.getNotifications(opts),\n store.getNotificationsCount(opts),\n ]);\n res.json({ totalCount, notifications });\n };\n\n router.get('/', listNotificationsHandler); // Deprecated alias of /notifications\n router.get('/notifications', listNotificationsHandler);\n\n router.get('/status', async (req, res) => {\n const user = await getUser(req);\n const status = await store.getStatus({ user });\n res.json(status);\n });\n\n router.get('/settings', async (req, res) => {\n const user = await getUser(req);\n const response = await getNotificationSettings(user);\n res.json(response);\n });\n\n router.post('/settings', async (req, res) => {\n const user = await getUser(req);\n const channels = getNotificationChannels();\n const settings: NotificationSettings = req.body;\n if (settings.channels.some(c => !channels.includes(c.id))) {\n throw new InputError('Invalid channel');\n }\n await store.saveNotificationSettings({ user, settings });\n const response = await getNotificationSettings(user);\n res.json(response);\n });\n\n router.get('/topics', async (req, res) => {\n const user = await getUser(req);\n const opts: TopicGetOptions = { user };\n appendCommonOptions(req, opts);\n const topics = await store.getTopics(opts);\n res.json(topics);\n });\n\n const getNotificationHandler: openapi.EndpointMapRequestHandler<\n EndpointMap,\n '/notifications/{id}',\n 'get'\n > = async (req, res) => {\n const user = await getUser(req);\n const opts: NotificationGetOptions = {\n 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 // Make sure this is the last \"GET\" handler.\n router.get('/:id', getNotificationHandler); // Deprecated alias of /notifications/:id\n router.get('/notifications/:id', getNotificationHandler);\n\n const updateNotificationsHandler: openapi.EndpointMapRequestHandler<\n EndpointMap,\n '/notifications/update',\n 'post'\n > = async (req, res) => {\n const user = await getUser(req);\n const { ids, read, saved } = req.body;\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, 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, ids });\n } else if (saved === false) {\n await store.markUnsaved({ user, ids });\n }\n\n const notifications = await store.getNotifications({ ids, user });\n res.json(notifications);\n };\n\n router.post('/update', updateNotificationsHandler); // Deprecated alias of /notifications/update\n router.post('/notifications/update', updateNotificationsHandler);\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 }\n postProcessNotification(ret, opts);\n return notification;\n };\n\n const sendUserNotification = async (\n baseNotification: Omit<Notification, 'user' | 'id'>,\n user: string,\n opts: NotificationSendOptions,\n origin: string,\n scope?: string,\n ): Promise<Notification | undefined> => {\n const userNotification = {\n ...baseNotification,\n id: uuid(),\n user,\n };\n const notification = await preProcessNotification(userNotification, opts);\n\n const enabled = await isNotificationsEnabled({\n user,\n channel: WEB_NOTIFICATION_CHANNEL,\n origin: userNotification.origin,\n topic: userNotification.payload.topic ?? null,\n });\n\n let ret = notification;\n\n if (!enabled) {\n postProcessNotification(ret, opts);\n return undefined;\n }\n\n let existingNotification;\n if (scope) {\n existingNotification = await store.getExistingScopeNotification({\n user,\n scope,\n origin,\n });\n }\n\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 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 return ret;\n };\n\n const filterNonUserEntityRefs = (refs: string[]): string[] => {\n return refs.filter(ref => {\n try {\n const parsed = parseEntityRef(ref);\n return parsed.kind.toLowerCase() === 'user';\n } catch {\n return false;\n }\n });\n };\n\n const sendUserNotifications = async (\n baseNotification: Omit<Notification, 'user' | 'id'>,\n users: string[],\n opts: NotificationSendOptions,\n origin: string,\n ): Promise<Notification[]> => {\n const { scope } = opts.payload;\n const uniqueUsers = [...new Set(filterNonUserEntityRefs(users))];\n const throttled = throttle((user: string) =>\n sendUserNotification(baseNotification, user, opts, origin, scope),\n );\n const sent = await Promise.all(uniqueUsers.map(user => throttled(user)));\n return sent.filter(n => n !== undefined);\n };\n\n const createNotificationsHandler: openapi.EndpointMapRequestHandler<\n EndpointMap,\n '/notifications',\n 'post'\n > = async (req, res) => {\n const credentials = await httpAuth.credentials(req, {\n allow: ['service'],\n });\n\n const origin = credentials.principal.subject;\n const opts = await processOptions(req.body, origin);\n const { recipients, payload } = opts;\n const { title, link } = payload;\n const notifications: Notification[] = [];\n\n if (!recipients || !title) {\n const missing = [\n !title ? 'title' : null,\n !recipients ? 'recipients' : null,\n ].filter(Boolean);\n const err = `Invalid notification request received: missing ${missing.join(\n ', ',\n )}`;\n throw new InputError(err);\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 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 if (recipients.type === 'entity') {\n const entityRefs = [recipients.entityRef].flat();\n const excludedEntityRefs = recipients.excludeEntityRef\n ? [recipients.excludeEntityRef].flat()\n : undefined;\n try {\n const { userEntityRefs } =\n await usedRecipientResolver.resolveNotificationRecipients({\n entityRefs,\n excludedEntityRefs,\n });\n const userNotifications = await sendUserNotifications(\n baseNotification,\n userEntityRefs,\n opts,\n origin,\n );\n notifications.push(...userNotifications);\n } catch (e) {\n throw new InputError('Failed to send user notifications', e);\n }\n } else {\n throw new InputError(\n `Invalid recipients type, please use either 'broadcast' or 'entity'`,\n );\n }\n\n res.json(notifications);\n };\n\n // Add new notification\n router.post('/', createNotificationsHandler); // Deprecated alias of /notifications\n router.post('/notifications', createNotificationsHandler);\n\n return router;\n}\n"],"names":["config","durationToMilliseconds","readDurationFromConfig","pThrottle","DefaultNotificationRecipientResolver","isNotificationsEnabledFor","notificationSeverities","InputError","normalizeSeverity","router","createOpenApiRouter","parseEntityOrderFieldParams","NotFoundError","uuid","parseEntityRef"],"mappings":";;;;;;;;;;;;;;;;;;AAwEA,eAAsB,aACpB,OAAA,EACyB;AACzB,EAAA,MAAM;AAAA,YACJA,QAAA;AAAA,IACA,MAAA;AAAA,IACA,KAAA;AAAA,IACA,IAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA,OAAA;AAAA,IACA,aAAa,EAAC;AAAA,IACd,OAAA;AAAA,IACA;AAAA,GACF,GAAI,OAAA;AAEJ,EAAA,MAAM,wBAAA,GAA2B,KAAA;AACjC,EAAA,MAAM,eAAA,GAAkBA,QAAA,CAAO,SAAA,CAAU,aAAa,CAAA;AACtD,EAAA,MAAM,gBAA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A,KAAS,QAAA,EAAU;AACvC,MAAA,MAAM,UAAA,GAAa,CAAC,UAAA,CAAW,SAAS,EAAE,IAAA,EAAK;AAC/C,MAAA,MAAM,kBAAA,GAAqB,WAAW,gBAAA,GAClC,CAAC,WAAW,gBAAgB,CAAA,CAAE,MAAK,GACnC,MAAA;AACJ,MAAA,IAAI;AACF,QAAA,MAAM,EAAE,cAAA,EAAe,GACrB,MAAM,sBAAsB,6BAAA,CAA8B;AAAA,UACxD,UAAA;AAAA,UACA;AAAA,SACD,CAAA;AACH,QAAA,MAAM,oBAAoB,MAAM,qBAAA;AAAA,UAC9B,gBAAA;AAAA,UACA,cAAA;AAAA,UACA,IAAA;AAAA,UACA;AAAA,SACF;AACA,QAAA,aAAA,CAAc,IAAA,CAAK,GAAG,iBAAiB,CAAA;AAAA,MACzC,SAAS,CAAA,EAAG;AACV,QAAA,MAAM,IAAIA,iBAAA,CAAW,mCAAA,EAAqC,CAAC,CAAA;AAAA,MAC7D;AAAA,IACF,CAAA,MAAO;AACL,MAAA,MAAM,IAAIA,iBAAA;AAAA,QACR,CAAA,kEAAA;AAAA,OACF;AAAA,IACF;AAEA,IAAA,GAAA,CAAI,KAAK,aAAa,CAAA;AAAA,EACxB,CAAA;AAGA,EAAAE,QAAA,CAAO,IAAA,CAAK,KAAK,0BAA0B,CAAA;AAC3C,EAAAA,QAAA,CAAO,IAAA,CAAK,kBAAkB,0BAA0B,CAAA;AAExD,EAAA,OAAOA,QAAA;AACT;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-notifications-backend",
3
- "version": "0.6.9-next.1",
3
+ "version": "0.6.10-next.0",
4
4
  "backstage": {
5
5
  "role": "backend-plugin",
6
6
  "pluginId": "notifications",
@@ -46,15 +46,15 @@
46
46
  "test": "backstage-cli package test"
47
47
  },
48
48
  "dependencies": {
49
- "@backstage/backend-openapi-utils": "0.7.2-next.0",
50
- "@backstage/backend-plugin-api": "1.10.1-next.1",
51
- "@backstage/catalog-model": "1.10.0",
52
- "@backstage/config": "1.3.9-next.0",
53
- "@backstage/errors": "1.3.1",
54
- "@backstage/plugin-catalog-node": "2.2.5-next.1",
55
- "@backstage/plugin-notifications-common": "0.2.4-next.0",
56
- "@backstage/plugin-notifications-node": "0.2.30-next.1",
57
- "@backstage/plugin-signals-node": "0.2.5-next.0",
49
+ "@backstage/backend-openapi-utils": "0.7.3-next.0",
50
+ "@backstage/backend-plugin-api": "1.10.2-next.0",
51
+ "@backstage/catalog-model": "1.10.2-next.0",
52
+ "@backstage/config": "1.3.10-next.0",
53
+ "@backstage/errors": "1.3.2-next.0",
54
+ "@backstage/plugin-catalog-node": "2.2.6-next.0",
55
+ "@backstage/plugin-notifications-common": "0.2.5-next.0",
56
+ "@backstage/plugin-notifications-node": "0.2.31-next.0",
57
+ "@backstage/plugin-signals-node": "0.2.6-next.0",
58
58
  "@backstage/types": "1.2.2",
59
59
  "express": "^4.22.0",
60
60
  "express-promise-router": "^4.1.0",
@@ -62,14 +62,14 @@
62
62
  "p-throttle": "^4.1.1"
63
63
  },
64
64
  "devDependencies": {
65
- "@backstage/backend-defaults": "0.17.9-next.1",
66
- "@backstage/backend-test-utils": "1.11.7-next.1",
67
- "@backstage/cli": "0.36.6-next.1",
68
- "@backstage/plugin-auth-backend": "0.30.1-next.2",
69
- "@backstage/plugin-auth-backend-module-guest-provider": "0.2.23-next.0",
70
- "@backstage/plugin-events-backend": "0.6.6-next.1",
71
- "@backstage/plugin-signals-backend": "0.3.19-next.1",
72
- "@backstage/repo-tools": "0.19.1-next.1",
65
+ "@backstage/backend-defaults": "0.18.1-next.0",
66
+ "@backstage/backend-test-utils": "1.11.8-next.0",
67
+ "@backstage/cli": "0.36.7-next.0",
68
+ "@backstage/plugin-auth-backend": "0.30.2-next.0",
69
+ "@backstage/plugin-auth-backend-module-guest-provider": "0.2.24-next.0",
70
+ "@backstage/plugin-events-backend": "0.6.7-next.0",
71
+ "@backstage/plugin-signals-backend": "0.3.20-next.0",
72
+ "@backstage/repo-tools": "0.19.2-next.0",
73
73
  "@types/express": "^4.17.6",
74
74
  "@types/supertest": "^2.0.8",
75
75
  "supertest": "^7.0.0"