UNPKG

@nocobase/plugin-workflow

Version:

A powerful BPM tool that provides foundational support for business automation, with the capability to extend unlimited triggers and nodes.

32 lines (31 loc) 1.33 kB
/** * 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 Joi from 'joi'; import { Transactionable } from '@nocobase/database'; import type Plugin from '../Plugin'; import type { WorkflowModel } from '../types'; import Processor from '../Processor'; export declare abstract class Trigger { readonly workflow: Plugin; configSchema?: Joi.ObjectSchema; constructor(workflow: Plugin); on(workflow: WorkflowModel): void; off(workflow: WorkflowModel): void; validateEvent(workflow: WorkflowModel, context: any, options: Transactionable): boolean | Promise<boolean>; duplicateConfig?(workflow: WorkflowModel, options: Transactionable & { origin?: WorkflowModel; }): object | Promise<object>; validateConfig(config: Record<string, any>): Record<string, string> | null; validateContext?(values: any, workflow: WorkflowModel): null | void | { [key: string]: string; }; sync?: boolean; execute?(workflow: WorkflowModel, values: any, options: Transactionable): void | Processor | Promise<void | Processor>; } export default Trigger;