UNPKG

@mbc-cqrs-serverless/core

Version:
59 lines (58 loc) 3.38 kB
import { OnModuleInit, Type } from '@nestjs/common'; import { ModuleRef } from '@nestjs/core'; import { DynamoDbService } from '../data-store/dynamodb.service'; import { SessionService } from '../data-store/session.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 { HistoryService } from './history.service'; 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 readonly historyService; private readonly sessionService; 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, historyService: HistoryService, sessionService: SessionService); 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 | null>; publishPartialUpdateAsync(input: CommandPartialInputModel, options: ICommandOptions): Promise<CommandModel | null>; publishSync(input: CommandInputModel, options: ICommandOptions): Promise<CommandModel | null>; publishAsync(input: CommandInputModel, options: ICommandOptions): Promise<CommandModel | null>; /** * Records a short-lived session row so Repository can merge pending async * commands before the data table catches up. Only used after publishAsync — * publishSync writes data in the same request, so no session is needed. */ private writeRywSessionIfApplicable; 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 {};