@mbc-cqrs-serverless/import
Version:
32 lines (31 loc) • 1.44 kB
TypeScript
import { IEventHandler, NotificationEvent } from '@mbc-cqrs-serverless/core';
import { ImportService } from '../import.service';
export declare class CommandFinishedHandler implements IEventHandler<NotificationEvent> {
private readonly importService;
private readonly logger;
constructor(importService: ImportService);
/**
* Executes the handler logic when a NotificationEvent is received.
* This method orchestrates the validation, parsing, and processing of command status updates.
* @param {NotificationEvent} event The incoming event.
*/
execute(event: NotificationEvent): Promise<any>;
/**
* Parses the JSON event body and validates its basic structure.
* @param {string} body The raw event body string.
* @returns {CommandStatusNotification | null} The parsed payload or null if invalid.
*/
private parseAndValidatePayload;
/**
* Checks if the event source is an import job.
* @param {string} source The source identifier from the event.
* @returns {boolean} True if the source is for an import job.
*/
private isImportSource;
/**
* Maps a raw command status string to the corresponding ImportStatusEnum.
* @param {string} commandStatus The status string from the command.
* @returns {ImportStatusEnum | null} The mapped status or null if it's not a final status.
*/
private mapCommandStatusToImportStatus;
}