From 15769753a05f2c27f8ccb95624c3c832908d72f7 Mon Sep 17 00:00:00 2001 From: Heikki Hellgren Date: Tue, 6 Feb 2024 10:52:14 +0200 Subject: [PATCH] fix: move notifications db to internal + clean-up Signed-off-by: Heikki Hellgren --- packages/backend/package.json | 2 - plugins/notifications-backend/api-report.md | 32 ----------- .../database/DatabaseNotificationsStore.ts | 2 +- .../src/database/NotificationsStore.ts | 6 +- plugins/notifications-backend/src/index.ts | 1 - .../src/service/router.ts | 4 +- plugins/notifications/package.json | 4 +- yarn.lock | 57 ++----------------- 8 files changed, 12 insertions(+), 96 deletions(-) diff --git a/packages/backend/package.json b/packages/backend/package.json index bb0b0e0ed7..2386d799a9 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -55,8 +55,6 @@ "@backstage/plugin-lighthouse-backend": "workspace:^", "@backstage/plugin-linguist-backend": "workspace:^", "@backstage/plugin-nomad-backend": "workspace:^", - "@backstage/plugin-notifications-backend": "workspace:^", - "@backstage/plugin-notifications-node": "workspace:^", "@backstage/plugin-permission-backend": "workspace:^", "@backstage/plugin-permission-common": "workspace:^", "@backstage/plugin-permission-node": "workspace:^", diff --git a/plugins/notifications-backend/api-report.md b/plugins/notifications-backend/api-report.md index 4828db197b..6add3000f1 100644 --- a/plugins/notifications-backend/api-report.md +++ b/plugins/notifications-backend/api-report.md @@ -4,42 +4,10 @@ ```ts import { BackendFeature } from '@backstage/backend-plugin-api'; -import { CatalogApi } from '@backstage/catalog-client'; -import { DiscoveryService } from '@backstage/backend-plugin-api'; -import express from 'express'; -import { IdentityApi } from '@backstage/plugin-auth-node'; -import { LoggerService } from '@backstage/backend-plugin-api'; -import { NotificationProcessor } from '@backstage/plugin-notifications-node'; -import { PluginDatabaseManager } from '@backstage/backend-common'; -import { SignalService } from '@backstage/plugin-signals-node'; -import { TokenManager } from '@backstage/backend-common'; - -// @public (undocumented) -export function createRouter(options: RouterOptions): Promise; // @public const notificationsPlugin: () => BackendFeature; export default notificationsPlugin; -// @public (undocumented) -export interface RouterOptions { - // (undocumented) - catalog?: CatalogApi; - // (undocumented) - database: PluginDatabaseManager; - // (undocumented) - discovery: DiscoveryService; - // (undocumented) - identity: IdentityApi; - // (undocumented) - logger: LoggerService; - // (undocumented) - processors?: NotificationProcessor[]; - // (undocumented) - signalService?: SignalService; - // (undocumented) - tokenManager: TokenManager; -} - // (No @packageDocumentation comment for this package) ``` diff --git a/plugins/notifications-backend/src/database/DatabaseNotificationsStore.ts b/plugins/notifications-backend/src/database/DatabaseNotificationsStore.ts index a02c8fcae2..7e5060106b 100644 --- a/plugins/notifications-backend/src/database/DatabaseNotificationsStore.ts +++ b/plugins/notifications-backend/src/database/DatabaseNotificationsStore.ts @@ -30,7 +30,7 @@ const migrationsDir = resolvePackagePath( 'migrations', ); -/** @public */ +/** @internal */ export class DatabaseNotificationsStore implements NotificationsStore { private constructor(private readonly db: Knex) {} diff --git a/plugins/notifications-backend/src/database/NotificationsStore.ts b/plugins/notifications-backend/src/database/NotificationsStore.ts index dfc260e76f..4e3a2fa547 100644 --- a/plugins/notifications-backend/src/database/NotificationsStore.ts +++ b/plugins/notifications-backend/src/database/NotificationsStore.ts @@ -20,7 +20,7 @@ import { NotificationType, } from '@backstage/plugin-notifications-common'; -/** @public */ +/** @internal */ export type NotificationGetOptions = { user: string; ids?: string[]; @@ -32,12 +32,12 @@ export type NotificationGetOptions = { sortOrder?: 'asc' | 'desc'; }; -/** @public */ +/** @internal */ export type NotificationModifyOptions = { ids: string[]; } & NotificationGetOptions; -/** @public */ +/** @internal */ export interface NotificationsStore { getNotifications(options: NotificationGetOptions): Promise; diff --git a/plugins/notifications-backend/src/index.ts b/plugins/notifications-backend/src/index.ts index 6e5d3a7c8c..b47321aa39 100644 --- a/plugins/notifications-backend/src/index.ts +++ b/plugins/notifications-backend/src/index.ts @@ -13,5 +13,4 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export * from './service/router'; export { notificationsPlugin as default } from './plugin'; diff --git a/plugins/notifications-backend/src/service/router.ts b/plugins/notifications-backend/src/service/router.ts index c834ec2839..b293ea4a1f 100644 --- a/plugins/notifications-backend/src/service/router.ts +++ b/plugins/notifications-backend/src/service/router.ts @@ -46,7 +46,7 @@ import { NotificationType, } from '@backstage/plugin-notifications-common'; -/** @public */ +/** @internal */ export interface RouterOptions { logger: LoggerService; identity: IdentityApi; @@ -58,7 +58,7 @@ export interface RouterOptions { processors?: NotificationProcessor[]; } -/** @public */ +/** @internal */ export async function createRouter( options: RouterOptions, ): Promise { diff --git a/plugins/notifications/package.json b/plugins/notifications/package.json index c7b90d5a1f..b6177bda8a 100644 --- a/plugins/notifications/package.json +++ b/plugins/notifications/package.json @@ -46,8 +46,8 @@ "@backstage/core-app-api": "workspace:^", "@backstage/dev-utils": "workspace:^", "@backstage/test-utils": "workspace:^", - "@testing-library/jest-dom": "^5.10.1", - "@testing-library/react": "^12.1.3", + "@testing-library/jest-dom": "^6.0.0", + "@testing-library/react": "^14.0.0", "@testing-library/user-event": "^14.0.0", "msw": "^1.0.0" }, diff --git a/yarn.lock b/yarn.lock index e4224b56d2..0ded362b83 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12,7 +12,7 @@ __metadata: languageName: node linkType: hard -"@adobe/css-tools@npm:^4.0.1, @adobe/css-tools@npm:^4.3.2": +"@adobe/css-tools@npm:^4.3.2": version: 4.3.2 resolution: "@adobe/css-tools@npm:4.3.2" checksum: 9667d61d55dc3b0a315c530ae84e016ce5267c4dd8ac00abb40108dc98e07b98e3090ce8b87acd51a41a68d9e84dcccb08cdf21c902572a9cf9dcaf830da4ae3 @@ -7855,8 +7855,8 @@ __metadata: "@material-ui/core": ^4.9.13 "@material-ui/icons": ^4.9.1 "@material-ui/lab": ^4.0.0-alpha.61 - "@testing-library/jest-dom": ^5.10.1 - "@testing-library/react": ^12.1.3 + "@testing-library/jest-dom": ^6.0.0 + "@testing-library/react": ^14.0.0 "@testing-library/user-event": ^14.0.0 "@types/react": ^16.13.1 || ^17.0.0 msw: ^1.0.0 @@ -17675,22 +17675,6 @@ __metadata: languageName: unknown linkType: soft -"@testing-library/dom@npm:^8.0.0": - version: 8.20.1 - resolution: "@testing-library/dom@npm:8.20.1" - dependencies: - "@babel/code-frame": ^7.10.4 - "@babel/runtime": ^7.12.5 - "@types/aria-query": ^5.0.1 - aria-query: 5.1.3 - chalk: ^4.1.0 - dom-accessibility-api: ^0.5.9 - lz-string: ^1.5.0 - pretty-format: ^27.0.2 - checksum: 06fc8dc67849aadb726cbbad0e7546afdf8923bd39acb64c576d706249bd7d0d05f08e08a31913fb621162e3b9c2bd0dce15964437f030f9fa4476326fdd3007 - languageName: node - linkType: hard - "@testing-library/dom@npm:^9.0.0": version: 9.3.4 resolution: "@testing-library/dom@npm:9.3.4" @@ -17707,23 +17691,6 @@ __metadata: languageName: node linkType: hard -"@testing-library/jest-dom@npm:^5.10.1": - version: 5.17.0 - resolution: "@testing-library/jest-dom@npm:5.17.0" - dependencies: - "@adobe/css-tools": ^4.0.1 - "@babel/runtime": ^7.9.2 - "@types/testing-library__jest-dom": ^5.9.1 - aria-query: ^5.0.0 - chalk: ^3.0.0 - css.escape: ^1.5.1 - dom-accessibility-api: ^0.5.6 - lodash: ^4.17.15 - redent: ^3.0.0 - checksum: 9f28dbca8b50d7c306aae40c3aa8e06f0e115f740360004bd87d57f95acf7ab4b4f4122a7399a76dbf2bdaaafb15c99cc137fdcb0ae457a92e2de0f3fbf9b03b - languageName: node - linkType: hard - "@testing-library/jest-dom@npm:^6.0.0": version: 6.3.0 resolution: "@testing-library/jest-dom@npm:6.3.0" @@ -17779,20 +17746,6 @@ __metadata: languageName: node linkType: hard -"@testing-library/react@npm:^12.1.3": - version: 12.1.5 - resolution: "@testing-library/react@npm:12.1.5" - dependencies: - "@babel/runtime": ^7.12.5 - "@testing-library/dom": ^8.0.0 - "@types/react-dom": <18.0.0 - peerDependencies: - react: <18.0.0 - react-dom: <18.0.0 - checksum: 4abd0490405e709a7df584a0db604e508a4612398bb1326e8fa32dd9393b15badc826dcf6d2f7525437886d507871f719f127b9860ed69ddd204d1fa834f576a - languageName: node - linkType: hard - "@testing-library/react@npm:^14.0.0": version: 14.2.1 resolution: "@testing-library/react@npm:14.2.1" @@ -25327,7 +25280,7 @@ __metadata: languageName: node linkType: hard -"dom-accessibility-api@npm:^0.5.6, dom-accessibility-api@npm:^0.5.9": +"dom-accessibility-api@npm:^0.5.9": version: 0.5.16 resolution: "dom-accessibility-api@npm:0.5.16" checksum: 005eb283caef57fc1adec4d5df4dd49189b628f2f575af45decb210e04d634459e3f1ee64f18b41e2dcf200c844bc1d9279d80807e686a30d69a4756151ad248 @@ -27283,8 +27236,6 @@ __metadata: "@backstage/plugin-lighthouse-backend": "workspace:^" "@backstage/plugin-linguist-backend": "workspace:^" "@backstage/plugin-nomad-backend": "workspace:^" - "@backstage/plugin-notifications-backend": "workspace:^" - "@backstage/plugin-notifications-node": "workspace:^" "@backstage/plugin-permission-backend": "workspace:^" "@backstage/plugin-permission-common": "workspace:^" "@backstage/plugin-permission-node": "workspace:^"