@mbc-cqrs-serverless/core
Version:
CQRS and event base core
49 lines (48 loc) • 2.81 kB
TypeScript
import { OnModuleInit, Type } from '@nestjs/common';
import { ModuleRef } from '@nestjs/core';
import { DynamoDbService } from '../data-store/dynamodb.service';
import { CommandInputModel, CommandModel, CommandModuleOptions, CommandPartialInputModel, DetailKey, ICommandService } from '../interfaces';
import { ICommandOptions } from '../interfaces/command.options.interface';
import { IDataSyncHandler } from '../interfaces/data-sync-handler.interface';
import { SnsService } from '../queue/sns.service';
import { ExplorerService } from '../services';
import { DataService } from './data.service';
import { DataSyncDdsHandler } from './handlers/data-sync-dds.handler';
import { TtlService } from './ttl.service';
declare const TABLE_NAME: unique symbol;
declare const DATA_SYNC_HANDLER: unique symbol;
export type DataSyncHandlerType = Type<IDataSyncHandler>;
export declare class CommandService implements OnModuleInit, ICommandService {
private readonly options;
private readonly dynamoDbService;
private readonly explorerService;
private readonly moduleRef;
private readonly snsService;
private readonly dataSyncDdsHandler;
private readonly dataService;
private readonly ttlService;
private logger;
private [TABLE_NAME];
private [DATA_SYNC_HANDLER];
constructor(options: CommandModuleOptions, dynamoDbService: DynamoDbService, explorerService: ExplorerService, moduleRef: ModuleRef, snsService: SnsService, dataSyncDdsHandler: DataSyncDdsHandler, dataService: DataService, ttlService: TtlService);
publishItem(key: DetailKey): Promise<any | null>;
onModuleInit(): void;
set tableName(name: string);
get tableName(): string;
get dataSyncHandlers(): IDataSyncHandler<any, any>[];
getDataSyncHandler(name: string): IDataSyncHandler;
publishPartialUpdateSync(input: CommandPartialInputModel, options: ICommandOptions): Promise<CommandModel>;
publishPartialUpdateAsync(input: CommandPartialInputModel, options: ICommandOptions): Promise<CommandModel>;
publishSync(input: CommandInputModel, options: ICommandOptions): Promise<CommandModel>;
publishAsync(input: CommandInputModel, options: ICommandOptions): Promise<CommandModel | null>;
duplicate(key: DetailKey, options: ICommandOptions): Promise<CommandModel>;
reSyncData(): Promise<void>;
updateStatus(key: DetailKey, status: string, notifyId?: string): Promise<void>;
getItem(key: DetailKey): Promise<CommandModel>;
getLatestItem(key: DetailKey): Promise<CommandModel>;
isNotCommandDirty(item: CommandModel, input: CommandInputModel): boolean;
updateTtl(key: DetailKey): Promise<Record<string, any>>;
updateTaskToken(key: DetailKey, token: string): Promise<any>;
getNextCommand(currentKey: DetailKey): Promise<CommandModel>;
}
export {};