fix: move notifications db to internal + clean-up

Signed-off-by: Heikki Hellgren <heikki.hellgren@op.fi>
This commit is contained in:
Heikki Hellgren
2024-02-06 10:52:14 +02:00
parent e6079349d9
commit 15769753a0
8 changed files with 12 additions and 96 deletions
@@ -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<express.Router>;
// @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)
```
@@ -30,7 +30,7 @@ const migrationsDir = resolvePackagePath(
'migrations',
);
/** @public */
/** @internal */
export class DatabaseNotificationsStore implements NotificationsStore {
private constructor(private readonly db: Knex) {}
@@ -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<Notification[]>;
@@ -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';
@@ -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<express.Router> {