Skip to content

Commit

Permalink
Remove notification categories (#276)
Browse files Browse the repository at this point in the history
* Remove notification category endpoints

* remove category example

* Add severity level example
  • Loading branch information
shahnami authored Mar 25, 2024
1 parent 5343aec commit b3bd18c
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 337 deletions.
5 changes: 0 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,6 @@ updates:
schedule:
interval: daily

- package-ecosystem: npm
directory: /examples/update-notification-category
schedule:
interval: daily

- package-ecosystem: npm
directory: /examples/update-relayer
schedule:
Expand Down
2 changes: 2 additions & 0 deletions examples/create-monitor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ async function main() {
// optional
alertTimeoutMs: 0,
notificationChannels: [notification.notificationId],
// optional (LOW, MEDIUM, HIGH)
severityLevel: 'LOW',
// optional
riskCategory: 'TECHNICAL',
};
Expand Down
2 changes: 2 additions & 0 deletions examples/update-monitor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ async function main() {
// optional
alertTimeoutMs: 0,
notificationChannels: [notification.notificationId],
// optional (LOW, MEDIUM, HIGH)
severityLevel: 'MEDIUM',
// optional
riskCategory: 'TECHNICAL',
};
Expand Down
201 changes: 0 additions & 201 deletions examples/update-notification-category/CHANGELOG.md

This file was deleted.

42 changes: 0 additions & 42 deletions examples/update-notification-category/index.js

This file was deleted.

15 changes: 0 additions & 15 deletions examples/update-notification-category/package.json

This file was deleted.

31 changes: 3 additions & 28 deletions packages/monitor/src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ import { BlockWatcher } from '../models/blockwatcher';

import _ from 'lodash';
import getConditionSets, { getMonitorConditions } from '../utils';
import {
NotificationCategory as NotificationCategoryResponse,
UpdateNotificationCategoryRequest,
} from '../models/category';
import { NotificationResponse } from '..';
import { CreateNotificationRequest, NotificationType, UpdateNotificationRequest } from '../models/notification';

Expand Down Expand Up @@ -83,27 +79,6 @@ export class MonitorClient extends BaseApiClient {
});
}

public async listNotificationCategories(): Promise<NotificationCategoryResponse[]> {
return this.apiCall(async (api) => {
return await api.get(`/notifications/categories`);
});
}

public async getNotificationCategory(id: string): Promise<NotificationCategoryResponse> {
return this.apiCall(async (api) => {
return await api.get(`/notifications/categories/${id}`);
});
}

public async updateNotificationCategory(
id: string,
params: UpdateNotificationCategoryRequest,
): Promise<NotificationCategoryResponse> {
return this.apiCall(async (api) => {
return await api.put(`/notifications/categories/${id}`, params);
});
}

// TODO: should this be part of public API?
public async listBlockwatchers(): Promise<BlockWatcher[]> {
return this.apiCall(async (api) => {
Expand Down Expand Up @@ -286,7 +261,7 @@ export class MonitorClient extends BaseApiClient {
alertThreshold: monitor.alertThreshold,
notifyConfig: {
notifications: notificationChannels,
notificationCategoryId: _.isEmpty(notificationChannels) ? monitor.notificationCategoryId : undefined,
severityLevel: monitor.severityLevel,
actionId: monitor.actionTrigger ? monitor.actionTrigger : undefined,
timeoutMs: monitor.alertTimeoutMs ? monitor.alertTimeoutMs : 0,
messageBody: monitor.alertMessageBody ? monitor.alertMessageBody : undefined,
Expand Down Expand Up @@ -328,7 +303,7 @@ export class MonitorClient extends BaseApiClient {
alertMessageSubject: monitor.notifyConfig?.messageSubject,
alertMessageBody: monitor.notifyConfig?.messageBody,
notificationChannels: monitor.notifyConfig?.notifications?.map(({ notificationId }) => notificationId) ?? [],
notificationCategoryId: monitor.notifyConfig?.notificationCategoryId,
severityLevel: monitor.notifyConfig?.severityLevel,
network: monitor.network,
confirmLevel: parseInt(_.last(monitor.blockWatcherId.split('-')) as string), // We're sure there is always a last number if the convention is followd
};
Expand All @@ -346,7 +321,7 @@ export class MonitorClient extends BaseApiClient {
alertMessageSubject: monitor.notifyConfig?.messageSubject,
alertMessageBody: monitor.notifyConfig?.messageBody,
notificationChannels: monitor.notifyConfig?.notifications?.map(({ notificationId }) => notificationId) ?? [],
notificationCategoryId: monitor.notifyConfig?.notificationCategoryId,
severityLevel: monitor.notifyConfig?.severityLevel,
network: monitor.network,
fortaLastProcessedTime: monitor.fortaLastProcessedTime,
addresses: monitor.fortaRule.addresses,
Expand Down
33 changes: 0 additions & 33 deletions packages/monitor/src/models/category.ts

This file was deleted.

Loading

0 comments on commit b3bd18c

Please sign in to comment.