import { ERPObjType } from "../../types/erp-types.js"; import { BatchCacheManager } from "../../services/caching-service/batch-cache-manager.js"; import { IToRESTApiObject, MM207NonLaborTicketResponse, MM207LaborTicketResponse } from "../../services/mm-api-service/index.js"; /** * Handles error processing and record management utilities for MM API operations */ export declare class ErrorProcessor { /** * Creates a set of primary keys for all failed records from batch errors * @param entityType The type of entity being processed * @param batchErrors Array of batch errors containing failed entities * @returns Set of primary keys for failed records */ static createFailedRecordKeySet(entityType: ERPObjType, batchErrors: Array<{ message: string; affectedEntities: IToRESTApiObject[]; }>): Set; /** * Filters out failed records, returning only successful ones * @param entityType The type of entity being processed * @param allRecords All records (typed objects) that were sent to the API * @param failedKeySet Set of primary keys for records that failed * @returns Array of records that succeeded */ static filterSuccessfulRecords(entityType: ERPObjType, allRecords: IToRESTApiObject[], failedKeySet: Set): IToRESTApiObject[]; /** * Orchestrates the caching of successful records on partial failure * @param entityType The type of entity being processed * @param toProcess All records that were sent to the API (all are now guaranteed to be typed objects) * @param batchErrors Array of batch errors containing failed entities * @param batchCacheManager The cache manager instance */ static cacheSuccessfulRecordsOnPartialFailure(entityType: ERPObjType, toProcess: IToRESTApiObject[], batchErrors: Array<{ message: string; affectedEntities: IToRESTApiObject[]; }>, batchCacheManager: BatchCacheManager): Promise; /** * Extracts error count and batch errors from MM API response for partial failures (HTTP 207) * This supports all entities, including the slightly different format for labor tickets. * In case of labor tickets, the updateErrors and insertErrors arrays are combined into affectedEntities. * @param mmApiResponse The full MM API response object * @param entityType The type of entity being processed (determines response structure) * @returns Object containing errorCount and batchErrors * See MM207NonLaborTicketResponse and MM207LaborTicketResponse for response structure details */ static extractErrorDetails(mmApiResponse: MM207NonLaborTicketResponse | MM207LaborTicketResponse, entityType: ERPObjType): { errorCount: number; batchErrors: Array<{ message: string; affectedEntities: IToRESTApiObject[]; }>; }; /** * Extracts error details from a 500 HTTP exception when it contains structured error data * @param exception The caught exception from MM API call * @param entityType The type of entity being processed * @returns Object containing errorCount and batchErrors, or null if not a structured 500 error * See MM500NonLaborTicketException and MM500LaborTicketException for exception structure details */ static extractErrorDetailsFrom500Exception(exception: unknown, entityType: ERPObjType): { errorCount: number; batchErrors: Array<{ message: string; affectedEntities: IToRESTApiObject[]; }>; } | null; } //# sourceMappingURL=error-processor.d.ts.map