@meshwatch/backend-core
Version:
Meshwatch backend core services.
34 lines (33 loc) • 2.9 kB
TypeScript
import { CreateMonitorDTO, MonitorDTO } 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 MonitorDatasource {
createTable: () => Promise<PromiseResult<CreateTableOutput, AWSError>>;
createMonitor: (monitor: CreateMonitorDTO) => Promise<MonitorDTO>;
updateMonitor: (monitor: MonitorDTO) => Promise<MonitorDTO>;
deleteMonitor: (userId: string, monitorId: string) => Promise<PromiseResult<DeleteItemOutput, AWSError>>;
getMonitor: (userId: string, monitorId: string) => Promise<MonitorDTO>;
searchMonitors: (userId: string) => Promise<MonitorDTO[]>;
bookmarkMonitor: (userId: string, monitorId: string, bookmarked: boolean) => Promise<MonitorDTO>;
getMonitorsByScheduler: (schedulerName: string) => Promise<MonitorDTO[]>;
}
export declare class DynamoMonitorDatasource extends DynamoMonitoringDatasource implements MonitorDatasource {
private readonly userDatasource;
constructor(dynamoClient?: DynamoDBClient);
bookmarkMonitor: (userId: string, monitorId: string, bookmarked: boolean) => Promise<import("@meshwatch/types/dist/common").WithCreated<import("@meshwatch/types").UpdateMonitorDTO>>;
getMonitor: (userId: string, monitorId: string) => Promise<import("@meshwatch/types/dist/common").WithCreated<import("@meshwatch/types").UpdateMonitorDTO>>;
deleteMonitor: (userId: string, monitorId: string) => Promise<PromiseResult<DocumentClient.DeleteItemOutput, AWSError>>;
searchMonitors: (userId: string) => Promise<import("@meshwatch/types/dist/common").WithCreated<import("@meshwatch/types").UpdateMonitorDTO>[]>;
getMonitorsByScheduler: (scheduler: string) => Promise<import("@meshwatch/types/dist/common").WithCreated<import("@meshwatch/types").UpdateMonitorDTO>[]>;
createMonitor: (payload: CreateMonitorDTO) => Promise<import("@meshwatch/types/dist/common").WithCreated<import("@meshwatch/types").UpdateMonitorDTO>>;
updateMonitor: (updateMonitorPayload: import("@meshwatch/types/dist/common").WithCreated<import("@meshwatch/types").UpdateMonitorDTO>) => Promise<import("@meshwatch/types/dist/common").WithCreated<import("@meshwatch/types").UpdateMonitorDTO>>;
_putMonitor: (monitor: import("@meshwatch/types/dist/common").WithCreated<import("@meshwatch/types").UpdateMonitorDTO>) => Promise<import("@meshwatch/types/dist/common").WithCreated<import("@meshwatch/types").UpdateMonitorDTO>>;
private monitorToDynamoItem;
private mapDynamoRows;
private encodeSortKey;
}
declare const dynamoMonitorDatasource: DynamoMonitorDatasource;
export default dynamoMonitorDatasource;