/** * This file is part of the NocoBase (R) project. * Copyright (c) 2020-2024 NocoBase Co., Ltd. * Authors: NocoBase Team. * * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License. * For more information, please refer to: https://www.nocobase.com/agreement. */ import { Snowflake } from 'nodejs-snowflake'; import { Transactionable } from 'sequelize'; import { Plugin } from '@nocobase/server'; import { Registry } from '@nocobase/utils'; import { Logger } from '@nocobase/logger'; import Dispatcher, { EventOptions } from './Dispatcher'; import Processor from './Processor'; import { CustomFunction } from './functions'; import Trigger from './triggers'; import { InstructionInterface } from './instructions'; import type { ExecutionModel, WorkflowModel } from './types'; type ID = number | string; export declare const WORKER_JOB_WORKFLOW_PROCESS = "workflow:process"; export default class PluginWorkflowServer extends Plugin { instructions: Registry; triggers: Registry; functions: Registry; enabledCache: Map; snowflake: Snowflake; private dispatcher; get channelPendingExecution(): string; private loggerCache; private meter; private checker; private onBeforeSave; private onAfterCreate; private onAfterUpdate; private onAfterDestroy; private onAfterStart; private onBeforeStop; handleSyncMessage(message: any): Promise; serving(): boolean; /** * @experimental */ getLogger(workflowId?: ID): Logger; /** * @experimental * @param {WorkflowModel} workflow * @returns {boolean} */ isWorkflowSync(workflow: WorkflowModel): boolean; registerTrigger(type: string, trigger: T | { new (p: Plugin): T; }): void; registerInstruction(type: string, instruction: InstructionInterface | { new (p: Plugin): InstructionInterface; }): void; private initTriggers; private initInstructions; beforeLoad(): Promise; /** * @internal */ load(): Promise; private toggle; trigger(workflow: WorkflowModel, context: object, options?: EventOptions): void | Promise; run(pending: Parameters[0]): Promise; resume(job: any): Promise; /** * Start a deferred execution * @experimental */ start(execution: ExecutionModel): Promise; createProcessor(execution: ExecutionModel, options?: {}): Processor; execute(workflow: WorkflowModel, values: any, options?: EventOptions): Promise; /** * @experimental * @param {string} dataSourceName * @param {Transaction} transaction * @param {boolean} create * @returns {Trasaction} */ useDataSourceTransaction(dataSourceName: string, transaction: any, create?: boolean): any; /** * @experimental */ updateTasksStats(userId: number, type: string, stats: { pending: number; all: number; }, { transaction }: Transactionable): Promise; } export {};