import { Activator } from "../Activator"; import { Task } from "../Task"; import { ProgramInspector } from "../definition/ProgramInspector"; import type { ExternalEvent, ExternalEventCallback } from "./ExternalEvent"; import type { IActivityContext, IActivityHandler } from "../IActivityHandler"; import type { Program } from "../definition/Program"; import type { Step } from "../definition/Step"; import type { LogLevel } from "../diagnostics/logging"; import type { FormElementRegistration } from "../index"; /** * Describes run options for a run operation. * @product This is intended for internal use only within VertiGIS Studio products. */ export interface RunOptions { /** Indicates a completion promise that is raced with the underlying promise (cancellation). */ cancellationToken?: PromiseLike; /** Indicates a debugger callback. */ debug?: (activityContext: IActivityContext | undefined, isExit?: boolean) => void; /** Indicates any environment that may be relevant to the program being run. */ environment?: object; /** Indicates any inputs that may be relevant to the program being run. */ inputs?: object; /** Indicates the locale for the program being run. */ locale?: string; /** Indicates the logging level for the program being run. */ logLevel?: LogLevel; /** The printing engine URL used for sending print requests. */ printingServiceUrl?: string; /** Indicates the start step to start at. */ start?: Step | number | string; /** Allow a master workflow to pass state to a target workflow. */ state?: Record; /** Indicates any language strings that the workflow has access to from the context it is being run in. */ strings?: Record; /** Indicates any trivia that may be relevant to the program being run. */ trivia?: Record; } /** Represents an activity handler class. */ interface ActivityHandlerClass { new (): IActivityHandler; } /** * Describes an activity handler class. * @product This is intended for internal use only within VertiGIS Studio products. */ export type IActivityHandlerImplementation = PromiseLike | ActivityHandlerClass; /** * Describes an activity handler factory. * @product This is intended for internal use only within VertiGIS Studio products. */ export interface IActivityHandlerFactory { /** Creates an activity handler. */ create(action: string, registerFormElement: (registration: FormElementRegistration) => void, inspector?: ProgramInspector): PromiseLike | IActivityHandler | undefined; } /** * Exposes functionality capable of running workflows. * @product This is intended for internal use only within VertiGIS Studio products. */ export declare class Engine { /** Indicates the activator to use for any workflow. */ activator: Activator; /** Indicates the SKU code of the app being run. */ appSkuCode: string | undefined; /** Indicates the default environment for any workflow. */ environment: {}; /** Indicates the factories to use to create activity handlers. */ factories: IActivityHandlerFactory[]; formElements: Record>; /** Indicates the implementations to use to create activity handlers. */ implementations: Record; /** Indicates the default trivia for any workflow. */ trivia: Record; /** Callback function to send a new External Event to a Display Form activity. */ private externalEventCallback; constructor(appSkuCode?: string); /** Builds the run options, augmenting the environment. */ static buildOptions(inspector: ProgramInspector, options: RunOptions | undefined): RunOptions; /** Creates a handler for the given action. */ createHandler(action: string, inspector?: ProgramInspector): PromiseLike | IActivityHandler | undefined; /** * Adds an event from an external source (the host application) to the current workflow. * This will be ignored unless there is currently a callback function registered to process it. * @param event The event to be sent to the workflow. */ enqueueExternalEvent(event: ExternalEvent): void; /** * Removes the supplied callback function as the event handler for external events, received from the host application. * @param callback The function to be unregistered. */ removeExternalEventHandler(callback: ExternalEventCallback): void; /** Runs a program and returns a promise for the outputs. */ run(document: Program, options?: RunOptions): Task; run(inspector: ProgramInspector, options?: RunOptions): Task; /** * Registers the supplied callback function as the event handler for external events, received from the host application. * @param callback The function to be called whenever an external event is received. */ setExternalEventHandler(callback: ExternalEventCallback): void; private _getFormElementRegistration; private _registerFormElement; } export {};