/** * 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 { FlowDefinitionOptions } from '../types'; import { FlowDefinition } from '../FlowDefinition'; import type { FlowModel } from '../models'; type FlowKey = string; export interface IFlowRepository { readonly model?: FlowModel; addFlows(flowDefs: Record>): void; addFlow(flowKey: string, flowOptions: Omit): FlowDefinition | void; removeFlow(flowKey: string): void; getFlows(): Map; mapFlows(callback: (flow: FlowDefinition) => T): T[]; hasFlow(flowKey: string): boolean; getFlow(flowKey: string): FlowDefinition | undefined; saveFlow(flow: FlowDefinition): Promise | void; destroyFlow(flowKey: string): Promise | void; moveStep(flowKey: string, sourceStepKey: string, targetStepKey: string): Promise | void; } /** * 抽象基类,封装通用的 Flow Registry 逻辑 * 子类只需实现持久化相关的方法 */ export declare abstract class BaseFlowRegistry implements IFlowRepository { protected flows: Map; constructor(); addFlows(flows: Record & { key?: string; }>): void; addFlow(flowKey: FlowKey, flowOptions: Omit & { key?: string; }): FlowDefinition; hasFlow(flowKey: FlowKey): boolean; getFlow(flowKey: FlowKey): FlowDefinition | undefined; getFlows(): Map; removeFlow(flowKey: FlowKey): void; mapFlows(callback: (flow: FlowDefinition) => T): T[]; moveStep(flowKey: FlowKey, sourceStepKey: string, targetStepKey: string): void; abstract saveFlow(flow: FlowDefinition): Promise | void; abstract destroyFlow(flowKey: string): Promise | void; } export {};