import { FEnsureException, FExceptionArgument, FExecutionContext } from '@freemework/common'; import { Activity, BreakpointActivity, DataContextActivity, NativeActivity } from './activities/index.js'; import { WorkflowModel } from './models.js'; import { WorkflowDataPersistentFacade } from './WorkflowDataPersistentFacade.js'; import { WorkflowVirtualMachine } from './WorkflowVirtualMachine.js'; export declare class WorkflowApplication { private static _lockInstanceName; private readonly _workflowDataCacheFacade; private readonly _logger; private readonly _workflowUuid; private readonly _wvm; private _status; private _lastTickDate; /** * false after persist */ private _isDirty; private _isUnlocked; private _prevTickId; static syncActiveWorkflowApplicationToRedis(executionContext: FExecutionContext): Promise; static lockNextWorkflowApplication(executionContext: FExecutionContext, workerTags: ReadonlyArray): Promise; static create(executionContext: FExecutionContext, entryPoint: NativeActivity, workflowUuid?: string): WorkflowApplication; static createWithInitializer(executionContext: FExecutionContext, entryPoint: DataContextActivity, initialize: WorkflowApplication.Initialize): WorkflowApplication; static restore(executionContext: FExecutionContext, entryPoint: NativeActivity, restore: WorkflowApplication.Restore): WorkflowApplication; private static get lockInstanceName(); private constructor(); get currentExecutionContext(): WorkflowVirtualMachine.Context; get currentActivity(): Activity; get currentBreakpointActivity(): BreakpointActivity; get state(): WorkflowModel.Status; get workflowUuid(): string; defineVariable(name: string, value: WorkflowVirtualMachine.Value): void; disableBreakpoint(_executionContext: FExecutionContext, breakpointName: string): Promise; getVariableBoolean(name: string): boolean; getVariableInteger(name: string): number; getVariableNumber(name: string): number; getVariableString(name: string): string; enableBreakpoint(_executionContext: FExecutionContext, breakpointName: string): Promise; perform(executionContext: FExecutionContext, nextTickTags: ReadonlyArray, opts?: { readonly dbFacade: WorkflowDataPersistentFacade; /** * Прервать тики, при достижении ближайшего BreakpointActivity * !!! Ни один тик из BreakpointActivity не выполяется !!! * т.е. перываение должно случиться ПЕРЕД выполнением BreakpointActivity */ readonly breakOnFirstBreakpoint: boolean; }): Promise; setVariable(name: string, value: boolean | number | string | null): void; persist(executionContext: FExecutionContext, dbFacade: WorkflowDataPersistentFacade, nextTickTags: ReadonlyArray, prevTickId?: WorkflowModel['tickId'] | null, crashReport?: string | null): Promise; unlock(executionContext: FExecutionContext): Promise; private verifyLocked; } export declare namespace WorkflowApplication { interface Initialize { readonly dataContext: TDataContext; readonly workflowUuid?: string; } interface Restore { readonly vmData: any; readonly workflowUuid: string; readonly prevTickId: WorkflowModel['tickId']; readonly status: WorkflowModel.Status; } class ContractViolationError extends FEnsureException { } class WorkflowNotFoundError extends FExceptionArgument { readonly workflowUuid: WorkflowApplication['workflowUuid']; constructor(workflowUuid: WorkflowApplication['workflowUuid']); } class WorkflowConcurrencyError extends Error { } }