import {IIdentity} from '@essential-projects/iam_contracts'; import { APIs, DataModels, } from '@process-engine/consumer_api_contracts'; export class ExternalTaskApiClientService implements APIs.IExternalTaskConsumerApi { private readonly externalApiAccessor: APIs.IExternalTaskConsumerApi = undefined; constructor(externalApiAccessor: APIs.IExternalTaskConsumerApi) { this.externalApiAccessor = externalApiAccessor; } public async fetchAndLockExternalTasks( identity: IIdentity, workerId: string, topicName: string, maxTasks: number, longPollingTimeout: number, lockDuration: number, ): Promise>> { return this .externalApiAccessor .fetchAndLockExternalTasks(identity, workerId, topicName, maxTasks, longPollingTimeout, lockDuration); } public async extendLock(identity: IIdentity, workerId: string, externalTaskId: string, additionalDuration: number): Promise { return this.externalApiAccessor.extendLock(identity, workerId, externalTaskId, additionalDuration); } public async handleBpmnError( identity: IIdentity, workerId: string, externalTaskId: string, errorCode: string, errorMessage?: string, ): Promise { return this.externalApiAccessor.handleBpmnError(identity, workerId, externalTaskId, errorCode, errorMessage); } public async handleServiceError( identity: IIdentity, workerId: string, externalTaskId: string, errorMessage: string, errorDetails: string, errorCode?: string, ): Promise { return this.externalApiAccessor.handleServiceError(identity, workerId, externalTaskId, errorMessage, errorDetails, errorCode); } public async finishExternalTask(identity: IIdentity, workerId: string, externalTaskId: string, payload: TResultType): Promise { return this.externalApiAccessor.finishExternalTask(identity, workerId, externalTaskId, payload); } }