@tachybase/module-workflow
Version:
A powerful BPM tool that provides foundational support for business automation, with the capability to extend unlimited triggers and nodes.
49 lines (48 loc) • 1.76 kB
TypeScript
/**
* 远程代码获取服务(Workflow 模块专用)
* 支持从 CDN 和 Git 仓库获取代码
*/
export declare class WorkflowRemoteCodeFetcher {
private logger;
/**
* 从 CDN 获取代码
* @param url 代码 URL
* @param timeout 超时时间(毫秒)
* @param authType 认证类型: 'none' | 'token' | 'basic'
* @param authToken Bearer Token 或 Basic Auth 的密码
* @param authUsername Basic Auth 的用户名
*/
private fetchFromCDN;
/**
* 检测 URL 是否已经是 Raw 文件 URL(可以直接访问)
*/
private isRawFileUrl;
/**
* 从 URL 中解析分支和文件路径
*/
private parseGitUrl;
/**
* 从 Git 仓库获取代码(通过 Raw 文件 URL)
*/
private fetchFromGit;
/**
* 获取远程代码
* @param codeUrl 代码地址
* @param codeType 代码类型:'cdn' 或 'git'
* @param codeBranch Git 分支名称(仅 Git 类型需要)
* @param codePath Git 文件路径(仅 Git 类型需要)
* @param authType 认证类型: 'none' | 'token' | 'basic'
* @param authToken Bearer Token 或 Basic Auth 的密码
* @param authUsername Basic Auth 的用户名
*/
fetchCode(codeUrl: string, codeType: 'cdn' | 'git', codeBranch?: string, codePath?: string, authType?: string, authToken?: string, authUsername?: string): Promise<string>;
/**
* 检查缓存是否有效(默认缓存 1 小时)
* @param cache 缓存对象,包含 content 和 timestamp
* @param maxAge 最大缓存时间(毫秒),默认 1 小时 (3600000ms)
*/
isCacheValid(cache: {
content: string;
timestamp: number;
} | null, maxAge?: number): boolean;
}