import * as pb from "../proto/orchestrator_service_pb"; import { Logger } from "../types/logger.type"; import { Registry } from "./registry"; /** * Result of orchestration execution containing actions and optional custom status. */ export interface OrchestrationExecutionResult { actions: pb.OrchestratorAction[]; customStatus?: string; } export declare class OrchestrationExecutor { private _generator?; private _registry; private _isSuspended; private _suspendedEvents; private _logger; private _orchestratorName; constructor(registry: Registry, logger?: Logger); execute(instanceId: string, oldEvents: pb.HistoryEvent[], newEvents: pb.HistoryEvent[], executionId?: string): Promise; private processEvent; private handleOrchestratorStarted; private handleExecutionStarted; private handleTimerCreated; private handleTimerFired; private handleTaskScheduled; private handleTaskCompleted; private handleTaskFailed; private handleSubOrchestrationCreated; private handleSubOrchestrationCompleted; private handleSubOrchestrationFailed; private handleEventRaised; /** * Handles an entity operation response that arrived as an EVENTRAISED event on the classic * (Azure Storage / DurableTask.Core) backend. In that code path the Durable Functions gRPC shim * wraps entity responses in a DTFx ResponseMessage JSON keyed by the call's requestId, rather than * emitting an ENTITYOPERATIONCOMPLETED proto event. This decodes the wrapper and completes (or * fails) the pending callEntity task. Mirrors the Java SDK's handleEntityResponseFromEventRaised. */ private handleEntityResponseFromEventRaised; /** * Decodes a DTFx ResponseMessage JSON wrapper (as delivered via EVENTRAISED on the classic * backend) into either a success result or a failure. Mirrors the Java SDK's decoding, with one * deliberate enhancement (see below). * * The wrapper shape is: * - `result` — the serialized operation result (double-encoded string; may be null/absent). * - `exceptionType` — present ⇒ failure. Misleading name: it carries the error message string * (the C# property is ErrorMessage but its [DataMember(Name = "exceptionType")] * overrides the JSON key). Omitted when null. * - `failureDetails` — optional structured `{ ErrorType, ErrorMessage, StackTrace, ... }` (PascalCase). * * NOTE (intentionally beyond the Java SDK): the Java SDK builds `new FailureDetails(errorType, * errorMessage, null, false)`, dropping the stack trace. Over gRPC the classic backend uses * DurableTask.Core native entities, whose ResponseMessage.FailureDetails carries a real StackTrace, * so we propagate it into `EntityOperationFailedException.failureDetails.stackTrace`. Do not "fix" * this back to null for Java parity — the extra fidelity is the point. */ private decodeEntityResponseMessage; private handleEventSent; private handleExecutionSuspended; private handleExecutionResumed; private handleExecutionTerminated; private handleEntityOperationCalled; private handleEntityOperationSignaled; private handleEntityLockRequested; private handleEntityOperationCompleted; private handleEntityOperationFailed; private handleEntityLockGranted; private handleEntityUnlockSent; private validateEntityAction; private handleCompletedTask; private handleFailedTask; /** * Checks if a failed task supports retry and handles the retry if applicable. * Supports both RetryableTask (policy-based with timer delay) and RetryHandlerTask * (handler-based: returns true for immediate reschedule, or a number for delayed retry via timer). * * @param task - The task that failed * @param errorMessage - The failure error message * @param failureDetails - The protobuf failure details * @param taskId - The task's sequence ID in pendingTasks * @param ctx - The orchestration context * @returns true if the task was retried, false otherwise */ private tryHandleRetry; }