@openade/pel
Version:
Punto di Elaborazione (Elaboration Point) - Server library for managing PEMs and communicating with ADE
48 lines • 1.83 kB
TypeScript
import type { ADEClient } from './ade.client';
import type { IStorage } from './storage.interface';
export declare enum AnomalyType {
CONNECTION_ERROR = "ERR_CONN",
PEM_BLOCKED = "ERR_BLOCK",
INTEGRITY_ERROR = "ERR_INTEG",
VALIDATION_ERROR = "ERR_VALID",
MISSING_JOURNAL = "ERR_MISS_J",
MISSING_DOCUMENTS = "ERR_MISS_DC"
}
export interface AnomalyReport {
type: AnomalyType;
taxpayerFiscalCode: string;
pemId: string;
pemLocation?: string;
details: string;
timestamp: string;
startedAt?: string;
resolvedAt?: string;
metadata?: {
operationsWithoutNetwork?: number;
networkRestoredAt?: string;
expectedHash?: string;
actualHash?: string;
missingCount?: number;
};
}
export interface AnomalyManagerConfig {
storage: IStorage;
adeClient?: ADEClient;
autoTransmit?: boolean;
batchSize?: number;
}
export declare class AnomalyManager {
private config;
private pendingAnomalies;
constructor(config: AnomalyManagerConfig);
reportAnomaly(anomaly: AnomalyReport): Promise<void>;
reportConnectionError(taxpayerFiscalCode: string, pemId: string, pemLocation: string, startedAt: string, operationsWithoutNetwork: number, networkRestoredAt?: string): Promise<void>;
reportPEMBlocked(taxpayerFiscalCode: string, pemId: string, pemLocation: string, blockedAt: string, operationsCount: number): Promise<void>;
reportIntegrityError(taxpayerFiscalCode: string, pemId: string, pemLocation: string, expectedHash: string, actualHash: string, details: string): Promise<void>;
transmitPendingAnomalies(): Promise<void>;
getPendingCount(): number;
getPendingAnomalies(): AnomalyReport[];
clearResolved(): void;
private generateAnomalyId;
}
//# sourceMappingURL=anomaly.manager.d.ts.map