UNPKG

@meshwatch/backend-core

Version:

Meshwatch backend core services.

65 lines (64 loc) 3.19 kB
import { AlertDTO, CreateAlert } from '@meshwatch/types'; import { CreateTableOutput, DeleteItemOutput, DocumentClient } from 'aws-sdk/clients/dynamodb'; import { AWSError } from 'aws-sdk/lib/error'; import { PromiseResult } from 'aws-sdk/lib/request'; import { DynamoDBClient } from '../../shared/aws/dynamodb'; import DynamoMonitoringDatasource from '../db/datasource'; export interface AlertDatasource { createTable: () => Promise<PromiseResult<CreateTableOutput, AWSError>>; createAlert: (payload: CreateAlert) => Promise<AlertDTO>; updateAlert: (monitor: AlertDTO) => Promise<AlertDTO>; getAlert: (userId: string, monitorId: string, alertId: string) => Promise<AlertDTO>; listAlertsForMonitor: (userId: string, monitorId: string) => Promise<AlertDTO[]>; listAlerts: (userId: string) => Promise<AlertDTO[]>; deleteAlert: (userId: string, monitorId: string, alertId: string) => Promise<PromiseResult<DeleteItemOutput, AWSError>>; } export declare class DynamoAlertDatasource extends DynamoMonitoringDatasource implements AlertDatasource { private readonly userDatasource; constructor(dynamoClient?: DynamoDBClient); createAlert: (payload: CreateAlert) => Promise<import("@meshwatch/types/dist/common").WithCreated<import("@meshwatch/types").CreateAlertDTO & { scheduler: string; } & { id: string; }>>; deleteAlert: (userId: string, monitorId: string, alertId: string) => Promise<PromiseResult<DocumentClient.DeleteItemOutput, AWSError>>; getAlert: (userId: string, monitorId: string, alertId: string) => Promise<import("@meshwatch/types/dist/common").WithCreated<import("@meshwatch/types").CreateAlertDTO & { scheduler: string; } & { id: string; }>>; listAlerts: (userId: string) => Promise<import("@meshwatch/types/dist/common").WithCreated<import("@meshwatch/types").CreateAlertDTO & { scheduler: string; } & { id: string; }>[]>; listAlertsForMonitor: (userId: string, monitorId: string) => Promise<import("@meshwatch/types/dist/common").WithCreated<import("@meshwatch/types").CreateAlertDTO & { scheduler: string; } & { id: string; }>[]>; private searchAlerts; updateAlert: (payload: import("@meshwatch/types/dist/common").WithCreated<import("@meshwatch/types").CreateAlertDTO & { scheduler: string; } & { id: string; }>) => Promise<import("@meshwatch/types/dist/common").WithCreated<import("@meshwatch/types").CreateAlertDTO & { scheduler: string; } & { id: string; }>>; _putAlert: (alert: import("@meshwatch/types/dist/common").WithCreated<import("@meshwatch/types").CreateAlertDTO & { scheduler: string; } & { id: string; }>) => Promise<import("@meshwatch/types/dist/common").WithCreated<import("@meshwatch/types").CreateAlertDTO & { scheduler: string; } & { id: string; }>>; private alertToDynamoItem; private mapDynamoRows; private encodeSortKey; } declare const dynamoAlertDatasource: DynamoAlertDatasource; export default dynamoAlertDatasource;