@nocobase/flow-engine
Version:
A standalone flow engine for NocoBase, managing workflows, models, and actions.
33 lines (32 loc) • 855 B
TypeScript
/**
* 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 'ses';
export interface JSRunnerOptions {
timeoutMs?: number;
globals?: Record<string, any>;
version?: string;
}
export declare class JSRunner {
private globals;
private timeoutMs;
constructor(options?: JSRunnerOptions);
/**
* 注册单个变量或函数
*/
register(name: string, value: any): void;
/**
* 异步运行代码,带错误处理和超时机制
*/
run(code: string): Promise<{
success: boolean;
value?: any;
error?: any;
timeout?: boolean;
}>;
}