import { StringValue } from "google-protobuf/google/protobuf/wrappers_pb"; import * as pb from "../proto/orchestrator_service_pb"; import { Timestamp } from "google-protobuf/google/protobuf/timestamp_pb"; export declare function newOrchestratorStartedEvent(timestamp?: Date | null): pb.HistoryEvent; export declare function newExecutionStartedEvent(name: string, instanceId: string, encodedInput?: string, parentInstance?: { name: string; instanceId: string; taskScheduledId: number; }, executionId?: string): pb.HistoryEvent; export declare function newTimerCreatedEvent(timerId: number, fireAt: Date): pb.HistoryEvent; export declare function newTimerFiredEvent(timerId: number, fireAt: Date): pb.HistoryEvent; export declare function newTaskScheduledEvent(eventId: number, name: string, encodedInput?: string): pb.HistoryEvent; export declare function newTaskCompletedEvent(eventId: number, encodedOutput?: string): pb.HistoryEvent; export declare function newTaskFailedEvent(eventId: number, ex: Error, failureDetails?: pb.TaskFailureDetails): pb.HistoryEvent; export declare function newSubOrchestrationCreatedEvent(eventId: number, name: string, instanceId: string, encodedInput?: string): pb.HistoryEvent; export declare function newSubOrchestrationCompletedEvent(eventId: number, encodedOutput?: string): pb.HistoryEvent; export declare function newSubOrchestrationFailedEvent(eventId: number, ex: Error): pb.HistoryEvent; export declare function newFailureDetails(e: unknown): pb.TaskFailureDetails; /** * Creates a TaskFailureDetails for version mismatch errors. * These errors are non-retriable as the version mismatch is deterministic. * * @param errorType The type of version error (e.g., "VersionMismatch", "VersionError") * @param errorMessage The error message describing the version mismatch * @returns A TaskFailureDetails with IsNonRetriable set to true */ export declare function newVersionMismatchFailureDetails(errorType: string, errorMessage: string): pb.TaskFailureDetails; export declare function newEventRaisedEvent(name: string, encodedInput?: string): pb.HistoryEvent; export declare function newEventSentEvent(eventId: number, instanceId: string, name: string, encodedInput?: string): pb.HistoryEvent; export declare function newSuspendEvent(): pb.HistoryEvent; export declare function newResumeEvent(): pb.HistoryEvent; export declare function newTerminatedEvent(encodedOutput?: string): pb.HistoryEvent; export declare function newExecutionCompletedEvent(status: pb.OrchestrationStatus, encodedResult?: string, failureDetails?: pb.TaskFailureDetails): pb.HistoryEvent; export declare function newExecutionRewoundEvent(reason?: string): pb.HistoryEvent; export declare function getStringValue(val?: string): StringValue | undefined; /** * Populates a tag map with the provided tags. * * Copies all key-value pairs from the optional {@link tags} object into the given * {@link tagsMap} by invoking its `set` method for each entry. If no tags are * provided, this function is a no-op. * * @param tagsMap - A map-like object that exposes a `set(key, value)` method used * to store tag key-value pairs. * @param tags - An optional record of tag key-value pairs to add to the map. */ export declare function populateTagsMap(tagsMap: { set: (key: string, value: string) => void; }, tags?: Record): void; export declare function newCompleteOrchestrationAction(id: number, status: pb.OrchestrationStatus, result?: string, failureDetails?: pb.TaskFailureDetails, carryoverEvents?: pb.HistoryEvent[] | null): pb.OrchestratorAction; export declare function newCreateTimerAction(id: number, fireAt: Date): pb.OrchestratorAction; export declare function newScheduleTaskAction(id: number, name: string, encodedInput?: string, tags?: Record, version?: string): pb.OrchestratorAction; export declare function newTimestamp(dt: Date): Timestamp; export declare function newCreateSubOrchestrationAction(id: number, name: string, instanceId?: string | null, encodedInput?: string, tags?: Record, version?: string): pb.OrchestratorAction; export declare function newSendEventAction(id: number, instanceId: string, eventName: string, encodedData?: string): pb.OrchestratorAction; export declare function isEmpty(v?: StringValue | null): boolean; /** * Parses the value of a StringValue protobuf field as JSON. * Returns undefined if the value is null/undefined or empty. * * @param v The StringValue field to parse. * @returns The parsed JSON value, or undefined. */ export declare function parseJsonField(v?: StringValue | null): any; /** * Get the orchestration status string by the enum value of the status * * @param status * @returns */ export declare function getOrchestrationStatusStr(status: number): string; /** * Creates a SendEntityMessageAction for signaling an entity (one-way, fire-and-forget). * * @param id - The action ID (sequence number). * @param instanceId - The target entity instance ID string (format: @name@key). * @param operationName - The name of the operation to invoke. * @param requestId - A unique request ID for this signal. * @param encodedInput - Optional JSON-encoded input for the operation. * @param scheduledTime - Optional scheduled time for delayed delivery. * @returns The OrchestratorAction containing the SendEntityMessageAction. * * @remarks * This creates an EntityOperationSignaledEvent which is a one-way message. * The orchestration does not wait for a response. */ export declare function newSendEntityMessageSignalAction(id: number, instanceId: string, operationName: string, requestId: string, encodedInput?: string, scheduledTime?: Date): pb.OrchestratorAction; /** * Creates a SendEntityMessageAction for calling an entity (request/response). * * @param id - The action ID (sequence number). * @param instanceId - The target entity instance ID string (format: @name@key). * @param operationName - The name of the operation to invoke. * @param requestId - A unique request ID for this call (used to correlate the response). * @param parentInstanceId - The orchestration instance ID making the call. * @param encodedInput - Optional JSON-encoded input for the operation. * @param scheduledTime - Optional scheduled time for delayed delivery. * @returns The OrchestratorAction containing the SendEntityMessageAction. * * @remarks * This creates an EntityOperationCalledEvent which expects a response. * The orchestration waits for EntityOperationCompletedEvent or EntityOperationFailedEvent * with a matching requestId. */ export declare function newSendEntityMessageCallAction(id: number, instanceId: string, operationName: string, requestId: string, parentInstanceId: string, parentExecutionId?: string, encodedInput?: string, scheduledTime?: Date): pb.OrchestratorAction; /** * Creates a SendEntityMessageAction for requesting entity locks. * * @param id - The action ID (sequence number). * @param criticalSectionId - A unique ID for this critical section (used to correlate lock grant). * @param lockSet - Array of entity instance ID strings (format: @name@key) to lock, in sorted order. * @param parentInstanceId - The orchestration instance ID requesting the locks. * @returns The OrchestratorAction containing the SendEntityMessageAction. * * @remarks * This creates an EntityLockRequestedEvent which is sent to the first entity in the lock set. * The entity framework will forward the lock request to subsequent entities. * The orchestration waits for EntityLockGrantedEvent with a matching criticalSectionId. */ export declare function newSendEntityMessageLockAction(id: number, criticalSectionId: string, lockSet: string[], parentInstanceId: string): pb.OrchestratorAction; /** * Creates a SendEntityMessageAction for releasing entity locks. * * @param id - The action ID (sequence number). * @param criticalSectionId - The ID of the critical section to release. * @param targetInstanceId - The entity instance ID string to send the unlock to. * @param parentInstanceId - The orchestration instance ID releasing the lock. * @returns The OrchestratorAction containing the SendEntityMessageAction. * * @remarks * This creates an EntityUnlockSentEvent to release a lock held by the orchestration. * One unlock event should be sent to each entity in the lock set. */ export declare function newSendEntityMessageUnlockAction(id: number, criticalSectionId: string, targetInstanceId: string, parentInstanceId: string): pb.OrchestratorAction;