feat: add notifications filtering by processors

Signed-off-by: Yaron Dayagi <ydayagi@redhat.com>
This commit is contained in:
Yaron Dayagi
2024-05-12 19:14:29 +03:00
parent 2c3f493ee3
commit 07a789b8c5
8 changed files with 137 additions and 6 deletions
+18 -1
View File
@@ -14,7 +14,10 @@
* limitations under the License.
*/
import { createExtensionPoint } from '@backstage/backend-plugin-api';
import { Notification } from '@backstage/plugin-notifications-common';
import {
Notification,
NotificationSeverity,
} from '@backstage/plugin-notifications-common';
import { NotificationSendOptions } from './service';
/**
@@ -90,6 +93,11 @@ export interface NotificationProcessor {
notification: Notification,
options: NotificationSendOptions,
): Promise<void>;
/**
* notification filters are used to call the processor only in certain conditions
*/
getNotificationFilters?(): NotificationProcessorFilters;
}
/**
@@ -108,3 +116,12 @@ export const notificationsProcessingExtensionPoint =
createExtensionPoint<NotificationsProcessingExtensionPoint>({
id: 'notifications.processing',
});
/**
* @public
*/
export type NotificationProcessorFilters = {
minSeverity?: NotificationSeverity;
maxSeverity?: NotificationSeverity;
excludedTopics?: string[];
};