UNPKG

t-comm

Version:

专业、稳定、纯粹的工具库

1,947 lines (1,797 loc) 247 kB
/// <reference types="jest" /> /// <reference types="node" /> export declare function ab2str(buffer: ArrayBuffer, encoding?: string): string; export declare const ACT_ID_MAP: { GP: string; }; /** * 为 Vue 组件添加 emits 属性 * @param {string} filePath 组件地址 * @param {string} [fileContent] 组件内容 * @returns {string} 新的组件内容 * * @example * ```ts * addNameForComponent('xxx.vue'); * ``` */ export declare function addEmitsForComponent(filePath: string, fileContent?: string): string | undefined; export declare function addMsdkNativeCallbackListener(callback: Function): void; /** * 为 Vue 组件添加、修正 name 属性 * @param {string} filePath 组件地址 * @param {string} componentName 组件名称 * @returns {string} 新的组件内容 * * @example * ```ts * addNameForComponent('xxx.vue', 'PressUploader'); * ``` */ export declare function addNameForComponent(filePath: string, componentName: string): any; /** * add num and avoid float number * @param {number} num1 第1个数字 * @param {number} num2 第2个数字 * @returns {number} 结果 * @example * ```ts * addNumber(0.1, 0.2); // 0.3 * ``` */ export declare function addNumber(num1: number, num2: number): number; /** * 添加或更新配置 * * @param {object} config 配置信息 * @param {object} config.keyValue 配置对象 * @param {string} config.keyValue.key 配置的key * @param {string} config.keyValue.value 配置的value * @param {number} config.valueType 配置类型,1: NUMBER, 2: STRING, 3: TEXT, 4: JSON, 5: XML, 18: 日期, 20: yaml * @param {object} config.secretInfo 密钥信息 * @param {string} config.secretInfo.appId 项目Id * @param {string} config.secretInfo.userId 用户Id * @param {string} config.secretInfo.secretKey 密钥 * @param {string} config.secretInfo.envName 配置环境 * @param {string} config.secretInfo.groupName 配置组 * @returns {Promise<object>} 请求Promise * * @example * addOrUpdateRainbowKV({ * keyValue: { * key: 'theKey', * value: 'theValue', * }, * valueType: 2, * secretInfo: { * appId: 'xxx', * userId: 'xxx', * secretKey: 'xxx', * envName: 'prod', * groupName: 'xxx', * } * }).then(() => { * * }) */ export declare function addOrUpdateRainbowKV({ keyValue, valueType, secretInfo, }: ModifyConfigParam): Promise<object>; /** * 增加配置 * * @param {object} config 配置信息 * @param {object} config.keyValue 配置对象 * @param {string} config.keyValue.key 配置的key * @param {string} config.keyValue.value 配置的value * @param {number} config.valueType 配置类型,1: NUMBER, 2: STRING, 3: TEXT, 4: JSON, 5: XML, 18: 日期, 20: yaml * @param {object} config.secretInfo 密钥信息 * @param {string} config.secretInfo.appId 项目Id * @param {string} config.secretInfo.userId 用户Id * @param {string} config.secretInfo.secretKey 密钥 * @param {string} config.secretInfo.envName 配置环境 * @param {string} config.secretInfo.groupName 配置组 * @returns {Promise<object>} 请求Promise * * @example * addRainbowKV({ * keyValue: { * key: 'theKey', * value: 'theValue', * }, * valueType: 2, * secretInfo: { * appId: 'xxx', * userId: 'xxx', * secretKey: 'xxx', * envName: 'prod', * groupName: 'xxx', * } * }).then(() => { * * }) */ export declare function addRainbowKV({ keyValue, valueType, secretInfo, }: ModifyConfigParam): Promise<object>; /** * 为图片增加文字 * * @param {Object} config 配置 * @param {number} config.width 宽度 * @param {number} config.height 高度 * @param {Array<string>} config.textList 文字列表,支持多行 * @param {string} config.imgPath 图片路径 * @returns {string} canvas.toDataURL生成的base64图片 * * @example * * ```ts * const imgUrl = addTextForImg({ * width: 300, * height: 300, * textList: ['第一行', '第二行'], * imgPath: './test.png', * }) * ``` */ export declare function addTextForImg({ width, height, textList, imgPath, }: { width: number; height: number; textList: Array<string>; imgPath: string; }): Promise<string>; export declare function aegisReportErrorV2(mAegisV2: any, options: ReportOptions): void; export declare function aegisReportEventV2(mAegisV2: any, options: EventOptions): void; export declare function aegisReportInfoV2(mAegisV2: any, options: ReportOptions, method?: string): void; export declare class AegisReportInPixui { static options: InitAegisOptions; static aegis: any; static init(options: InitAegisOptions): Promise<any>; static report(info: Record<string, any>): Promise<void>; static info(info: Record<string, any>): Promise<void>; } export declare function aegisReportV2(mAegisV2: any, options: ReportOptions): void; /** * 分析首页Bundle信息 * * @export * @param config 配置 * @param {string} config.domain 域名 * @param {string} config.buildPath 打包路径 * @returns {*} * * @example * ```ts * analyzeIndexBundle({ * domain: '', * buildPath: '', * }) * ``` */ export declare function analyzeIndexBundle({ domain, buildPath }: { domain: string; buildPath: string; }): ({ file: string; size: number; time: number; } | undefined)[]; declare interface AnalyzeItem { root: string; simpleRoot: string; project: string; git: string; analyzeDir?: string; needAnalyzeSubDir?: string[]; } export declare type AppOptionsType = { Vue: any; App: any; VueRouter?: any; Vuex?: any; VueLazyLoad?: any; routerMap?: Array<any>; vxModule?: Object; vxModuleGetter?: Object; beforeStart?: Function; i18n?: any; routerMode?: 'hash' | 'history'; projectMixins?: any; noDependMixins?: boolean; loginType: string; loginFunction?: Function; uinHandler?: Function; SimpleVueRouter?: boolean; prerender?: boolean; notfound?: string; vue3Router?: { createRouter: Function; createWebHashHistory: Function; }; vue3Vuex?: { createStore: Function; }; }; export declare function ApprovalRainbowReleaseTask({ secretInfo, taskId, versionName, status, rejectReason, }: { secretInfo: ISecretInfo_3; taskId: string | number; versionName: string; status?: number; rejectReason?: string; }): Promise<object>; declare const AREA_MAP: { readonly MAINLAND: "mainland"; readonly OVERSEAS: "overseas"; }; declare const AREA_MAP_WITH_GLOBAL: { readonly MAINLAND: "mainland"; readonly OVERSEAS: "overseas"; readonly GLOBAL: "global"; }; export declare function asyncExportTencentDoc({ accessToken, clientId, openId, fileId, exportType, }: ISecretInfo_2 & { fileId: string; exportType: number; }): Promise<any>; /** * 基本请求 * @private * @param {object} config - 配置信息 * @returns {Promise} 请求Promise */ export declare function baseRequestRainbow({ url, data: reqData, secretInfo, }: ReqParam): Promise<object>; /** * 批量发送企业微信机器人base64图片 * @param {object} config 配置信息 * @param {string} config.img base64图片 * @param {string} config.chatId 会话Id * @param {string} config.webhookUrl webhook地址 * @returns {Promise<object>} 请求Promise * @example * * batchSendWxRobotBase64Img({ * img: 'xxx', * chatId: 'xxx', // or ['xxx], or ['ALL'], or 'ALL' * webhookUrl: 'xxx', * }).then(() => { * * }) * */ export declare function batchSendWxRobotBase64Img({ img, chatId, webhookUrl, }: { img: string; } & ISendReq): Promise<any>; export declare function batchSendWxRobotMarkdown({ content, attachments, chatId, webhookUrl, isV2, }: { content: string; attachments?: Array<object>; isV2?: boolean; } & ISendReq): Promise<any>; export declare function batchSendWxRobotMsg({ content, alias, chatId, webhookUrl, }: { content: string; alias: string | Array<string>; } & ISendReq): Promise<any>; export declare function batchUpdateTencentSheetV3({ accessToken, clientId, openId, bookId, requests, }: ISecretInfo_2 & { bookId: string; requests: Record<string, any>; }): Promise<any>; /** * 打包并上传到服务器 * @param {object} options 配置 * @param {string} options.hostName 服务器名称 * @param {string} options.hostPwd 服务器密码 * @param {string} [options.root] 项目根目录 * @param {string} [options.bundleName] 打包文件名称 * @example * * await buildAndUpload({ * hostName: '9.9.9.9', * hostPwd: 'xxxx', * bundleName: 'cron-job-svr', * }); * */ export declare function buildAndUpload({ root, bundleName, hostName, hostPwd, hostTargetDir, }: { root?: string; bundleName?: string; hostName: string; hostPwd: string; hostTargetDir: string; }): Promise<any>; /** * 记忆函数:缓存函数的运算结果 * @param {Function} fn 输入函数 * @returns {any} 函数计算结果 * * @example * function test(a) { * return a + 2 * } * * const cachedTest = cached(test) * * cachedTest(1) * * // => 3 * * cachedTest(1) * * // => 3 */ export declare function cached<T extends any, R>(fn: (arg: T) => R): (arg: T) => R; /** * 添加游戏内浏览器jssdk * @example * ```ts * callJsBrowserAdapter(); * ``` */ export declare function callJsBrowserAdapter(): Promise<unknown>; /** * 设置 MSDK 浏览器退出全屏,需提前加载 sdk * @example * ```ts * callJsReSetFullScreen(); * ``` */ export declare const callJsReSetFullScreen: () => void; /** * 设置 MSDK 浏览器全屏,需提前加载 sdk * @param isFullScreen 是否全屏 * @example * ```ts * callJsSetFullScreen(); * callJsSetFullScreen(false); * ``` */ export declare const callJsSetFullScreen: (isFullScreen?: boolean) => void; /** * 横线转驼峰命名,如果第一个字符是字母,则不处理。 * @param {string} str 输入字符串 * @param {boolean} handleSnake 是否处理下划线,默认不处理 * @returns {string} 处理后的字符串 * @example * * camelize('ab-cd-ef') * * // => abCdEf * */ export declare function camelize(str?: string, handleSnake?: boolean): string; /** * 字符串首位大写 * @param {string} str 输入字符串 * @returns {string} 处理后的字符串 * * @example * * capitalize('abc') * * // => Abc */ export declare function capitalize(str: string): string; /** * 检查 localStorage 设置,并展示vConsole * @example * ```ts * checkAndShowVConsole() * ``` */ export declare function checkAndShowVConsole(): void; export declare function checkExportTencentDocProgress({ accessToken, clientId, openId, fileId, operationId, }: ISecretInfo_2 & { fileId: string; operationId: string; }): Promise<any>; export declare function checkFileBaseMinimatch({ file, include, exclude, minimatch, }: { file: string; include: string | string[]; exclude: string | string[]; minimatch: Function; }): boolean; export declare function checkGitClean(dir: string): void; export declare function checkJSFiles(options?: { whiteDir: string[]; excludeReg: RegExp; log: boolean; }): void; export declare function checkLint({ privateToken, gitApiPrefix, workspace, mrUrl, mrId, buildUrl, repo, repoUrl, sourceBranch, targetBranch, docLink, webhookUrl, chatId, checkAll, mentionList, lintFiles, throwError, ignoreSubmodules, }: { privateToken: string; gitApiPrefix: string; workspace: string; mrUrl?: string; mrId?: string; buildUrl: string; repo: string; repoUrl?: string; sourceBranch?: string; targetBranch?: string; docLink: string; webhookUrl: string; chatId?: string[]; checkAll?: boolean; mentionList?: string[]; lintFiles?: string[]; throwError?: boolean; ignoreSubmodules?: boolean; }): Promise<FileMap>; /** * 检查是否是node环境 * @returns {boolean} 是否node环境 * @example const res = checkNodeEnv(); // false */ export declare const checkNodeEnv: () => boolean; /** * 检查字符串长度 * * @export * @param {string} str 字符串 * @param {number} [num = 30] 长度 * @returns {boolean} * * @example * * checkStringLength('123', 2) // true * checkStringLength('123', 3) // true * checkStringLength('123', 4) // false * * */ export declare function checkStringLength(str?: string, num?: number): boolean; export declare function checkTSErrorInMrOrAll({ privateToken, gitApiPrefix, workspace, repo, repoUrl, mrId, mrUrl, sourceBranch, targetBranch, checkAll, buildUrl, docLink, mentionList, postFixList, chatId, webhookUrl, command, }: { privateToken: string; gitApiPrefix: string; workspace: string; repo: string; repoUrl: string; mrId: string; mrUrl: string; sourceBranch: string; targetBranch: string; checkAll: boolean; buildUrl: string; docLink: string; mentionList: string[]; postFixList?: string[]; chatId?: string[]; webhookUrl: string; command?: string; }): Promise<TsErrorFile[]>; /** * 检查是否是ios环境 * @returns {boolean} 是否是ios环境 * * @example * * checkUAIsIOS() * * // => true * */ export declare function checkUAIsIOS(): boolean; /** * 将数组分割成指定长度的chunk * * @param array 数组 * @param chunkSize 要分的组数 * @returns 结果数组 * @example * ```js * chunkArray([1, 2, 3, 4, 5, 6, 7, 8], 3) */ export declare function chunkArray<T>(array: T[], chunkSize: number): T[][]; /** * 清除全部cookie * * @param {string} domain 域名 * * @example * * clearAll() */ export declare function clearAll(domain?: String): void; /** * 清除cookie * @param {string} key cookie键 * * @example * * clearCookie('name'); * */ export declare function clearCookie(name: string): void; /** * 持久化存储。清理。传 key 就删除。不传清理所有过期的。 * @param {string} [key] * @returns {boolean} 是否清楚成功 */ export declare function clearPersist(key?: string): boolean; /** * 清除(隐藏)上一个toast * @example * ```ts * Toast.clear(); * * clearToast(); * ``` */ export declare const clearToast: () => void; declare interface ClickOutsideElement extends HTMLElement { __vueClickOutside__?: (event: MouseEvent) => void; } /** * 小程序粘贴 * * @param {string} text 待复制的文本 * @returns {Promise<void>} * @example * * ```ts * clipboardMp('stupid').then(() => {}); * ``` */ export declare function clipboardMp(text: string): Promise<any>; /** * 复制到剪切板 * * @param {string} text 待复制的文本 * @returns {Promise<void>} * @example * * ```ts * clipboardMp('stupid').then(() => {}); * ``` */ export declare function clipboardWeb(text: string): Promise<void>; /** * MSDK 浏览器中,关闭 webView * @example * ```ts * closeMsdkWebview() * ``` */ export declare function closeMsdkWebview(env?: any): void; /** * 关闭任务 * * @param {object} config 配置信息 * @param {string} config.taskId 任务Id * @param {object} config.secretInfo 密钥信息 * @param {string} config.secretInfo.appId 项目Id * @param {string} config.secretInfo.userId 用户Id * @param {string} config.secretInfo.secretKey 密钥 * @param {string} config.secretInfo.envName 配置环境 * @param {string} config.secretInfo.groupName 配置组 * @returns {Promise<object>} 请求Promise * * @example * closeRainbowTask({ * taskId: 'taskId', * secretInfo: { * appId: 'xxx', * userId: 'xxx', * secretKey: 'xxx', * envName: 'prod', * groupName: 'xxx', * } * }).then(() => { * * }) */ export declare function closeRainbowTask({ taskId, secretInfo, }: { taskId: string; secretInfo: ISecretInfo_3; }): Promise<object>; /** * 关闭 vConsole * @example * ```ts * closeVConsole() * ``` */ export declare function closeVConsole(): void; /** * 关闭 webView,包含 msdk 浏览器和其他浏览器 * @example * ```ts * closeWebView() * ``` */ export declare function closeWebView(): void; /** * 多参数空值合并函数 * @param {...any} args - 任意数量的参数 * @returns {any} 第一个非null/undefined的参数值 */ export declare function coalesce(...args: unknown[]): unknown; export declare function collectFilesSync(dirPath?: string, fileList?: string[]): string[]; declare interface CommitInfo { hash: string; shortHash: string; author: string; email: string; date: string; subject: string; body: string; } /** * 对比两个对象列表 * @param {Array<object>} list 现在数据 * @param {Array<object>} preList 参照数据 * @param {string} key 唯一key名称 * @returns {Array<object>} 对比结果,增加为list的每一项增加previousValue和ratio属性 * @example * const list = [ * { * ProjectName: { name: 'ProjectName', value: '脚手架' }, * PagePv: { name: 'PagePv', value: 544343 }, * PageUv: { name: 'PageUv', value: 225275 }, * } * ] * * const preList = [ * { * ProjectName: { name: 'ProjectName', value: '脚手架' }, * PagePv: { name: 'PagePv', value: 123123 }, * PageUv: { name: 'PageUv', value: 33333 }, * } * ] * * compareTwoList(list, preList, 'ProjectName') * * console.log(list) * * [ * { * ProjectName: { name: 'ProjectName', value: '脚手架' }, * PagePv: { * name: 'PagePv', * value: 544343, * ratio: '+342.1%', * previousValue: 123123 * }, * PageUv: { * name: 'PageUv', * value: 225275, * ratio: '+575.8%', * previousValue: 33333 * } * } * ] */ export declare function compareTwoList(list: Array<IPreData>, preList: Array<IPreData>, key: string): IPreData[]; export declare function compareTwoObj(originObj?: Record<string, any>, newObj?: Record<string, any>): { ADDED: Array<string>; UPDATED: Array<string>; DELETED: Array<string>; originObj: object; newObj: object; }; /** * 版本比较 * @param {string} v1 第一个版本 * @param {string} v2 第二个版本 * @returns 比较结果,1 前者大,-1 后者大,0 二者相同 * @example * ```ts * compareVersion('1.1.1', '1.2.1') * // -1 * ``` */ export declare function compareVersion(v1?: string, v2?: string): 0 | 1 | -1; /** * Compile a string to a template function for the path. * @ignore * @param {string} str * @param {Object=} options * @returns {!function(Object=, Object=)} */ declare function compile(str: string, options?: any): (data: any, options: any) => string; declare type Complete = (success: boolean, msg?: any) => void; declare const COMPLEXITY_DEFAULT_CSV_HEADER: readonly ["NLOC", "CNN", "TOKEN_COUNT", "PARAMETER_COUNT", "LOC", "FUNCTION_NAME_AND_FILE_NAME", "FILE_NAME", "FUNCTION_NAME", "FUNCTION_METHOD", "START_LINE", "END_LINE"]; declare type ComplexityCsvHeader = typeof COMPLEXITY_DEFAULT_CSV_HEADER; declare type ComplexityKey = ComplexityCsvHeader[number]; export declare type ComponentMapList = Record<string, string[]>; /** * 组装`url`参数,将search参数添加在后面 * @param {string} url 输入URL * @param {Object} queryObj search对象 * @returns {string} 组装后的url * * @example * composeUrlQuery('https://baidu.com', { * name: 'mike', * feel: 'cold', * age: '18', * from: 'test', * }); * // https://baidu.com?name=mike&feel=cold&age=18&from=test * * composeUrlQuery('https://baidu.com?gender=male', { * name: 'mike', * feel: 'cold', * age: '18', * from: 'test', * }); * // https://baidu.com?gender=male&name=mike&feel=cold&age=18&from=test * */ export declare function composeUrlQuery(url: string, queryObj: object): string; declare type ConfigType = unknown; export declare function configWx({ apiList, openTagList, getWxSignaturePromise, }: { apiList?: Array<string>; openTagList?: Array<string>; getWxSignaturePromise: IGetWxSignaturePromise; }): Promise<unknown>; export declare const consoleImage: (url: string) => void; export declare function consoleInfo(shouldLog: boolean, ...args: any[]): void; export declare function consoleLog(shouldLog: boolean, ...args: any[]): void; /** * Dom转化为图片 * @param {string} trigger Dom的id * @param {string} imageElId 需要展示的图片的id * * @example * Dom2Image.convertDomToImage("app", "appImage"); */ export declare function convertDomToImage(trigger: string, imageElId: string, callback: Function): void; /** * image url转canvas * @param image {Image} 图片src * @returns canvas */ export declare function convertImageToCanvas(image: HTMLImageElement): ICanvas; export declare function convertTencentFileId({ accessToken, clientId, openId, type, value, }: ISecretInfo_2 & { type: number; value: string; }): Promise<any>; /** * 拷贝目录以及子文件 * @param {Object} src * @param {Object} dist * @param {Object} callback */ export declare function copyDir(src: string, dist: string, callback?: Function): void; /** * 拷贝文件 * @param {Object} from 文件来自那里 * @param {Object} to 拷贝到那里 */ export declare function copyFile(from: string, to: string): void; export declare function createAutoProtectedRuleForStoryBranch({ projectName, baseUrl, privateToken, defaultRuleName, shouldUpdateExistingBranches, }: { projectName: string; baseUrl: string; privateToken: string; defaultRuleName: string; shouldUpdateExistingBranches?: boolean; }): Promise<void>; /** * 创建canvas的table * @param {object} config 输入配置 * @param {Array<object>} config.data 输入数据 * @param {Array<string>} config.headers 表头列表 * @param {Array<number>} config.cellWidthList 每一格的宽度列表 * @param {string} config.title 标题 * @returns {string} 图片url * @example * * const tableData = [ * { * ProjectName: { name: 'ProjectName', value: 'ProjectA' }, * ALL_SUMMARY: { * name: 'ALL_SUMMARY', * value: 4987, * ratio: '+26.2%', * previousValue: 3953, * idx: 0, * lastIdx: 0, * isMax: true, * isMin: false, * isSecondMax: false, * isSecondMin: false, * }, * ALL_FAIL: { * // ... * }, * }, * { * ProjectName: { name: 'ProjectName', value: 'ProjectB' }, * // ... * }, * ]; * * createCanvasTable({ * data: tableData, * headers: getHeaders(tableData), * title: `007日报 ${date}`, * cellWidthList: [ * 95, * 65, * 65, * 65, * ], * }); */ export declare function createCanvasTable({ data, headers, cellWidthList, title, }: { data: Array<{ [k: string]: { value?: number; isMax?: boolean; isMin?: boolean; isSecondMax?: boolean; isSecondMin?: boolean; ratio?: string | number; }; }>; headers: Array<string>; cellWidthList: Array<number>; title: string; }): string; export declare function createDevopsTemplateInstances({ projectId, templateId, host, pipelineName, pipelineParam, secretInfo, useTemplateSettings, }: ITemplateReq & { pipelineName: string; pipelineParam: Object; useTemplateSettings?: boolean; }): Promise<any>; /** * 创建MR * @param {object} options 输入配置 * @param {string} options.projectName 项目名称 * @param {string} options.privateToken 密钥 * @param {string} options.sourceBranch 源分支 * @param {string} options.targetBranch 目标分支 * @returns {Promise<object>} 请求Promise * @example * * createMR({ * projectName: 't-comm', * privateToken: 'xxxxx', * sourceBranch: 'master', * targetBranch: 'release', * }).then((resp) => { * * }) */ export declare function createMR({ projectName, privateToken, sourceBranch, targetBranch, }: { projectName: string; privateToken: string; sourceBranch: string; targetBranch: string; }): Promise<unknown>; export declare function createPrefetchTask({ secretId, secretKey, targets, zoneId, }: { secretId: string; secretKey: string; targets: string[]; zoneId: string; }): Promise<any>; export declare function createProtectedBranchRule({ projectName, privateToken, baseUrl, form, }: { projectName: string; privateToken: string; baseUrl: string; form: ProtectedRuleForm; }): Promise<Array<object>>; export declare function createPurgeTask({ secretId, secretKey, targets, zoneId, method, type, }: { secretId: string; secretKey: string; targets: string[]; zoneId: string; method?: IPurgeMethod; type?: IPurgeType; }): Promise<any>; /** * 创建发布任务 * * @param {object} config 配置信息 * @param {string} config.versionName 版本信息 * @param {object} config.secretInfo 密钥信息 * @param {string} config.secretInfo.appId 项目Id * @param {string} config.secretInfo.userId 用户Id * @param {string} config.secretInfo.secretKey 密钥 * @param {string} config.secretInfo.envName 配置环境 * @param {string} config.secretInfo.groupName 配置组 * @returns {Promise<object>} 请求Promise * * @example * createRainbowPublishJob({ * versionName: 'version', * secretInfo: { * appId: 'xxx', * userId: 'xxx', * secretKey: 'xxx', * envName: 'prod', * groupName: 'xxx', * } * }).then(() => { * * }) */ export declare function createRainbowPublishJob({ versionName, secretInfo, creator, approvers, type, }: { versionName: string; secretInfo: ISecretInfo_3; creator: string; approvers: string; type?: number; }): Promise<object>; export declare function createTencentDoc({ accessToken, clientId, openId, type, title, folderId, }: ISecretInfo_2 & { type: number; title: string; folderId?: string; }): Promise<any>; /** * canvas 实现 watermark * @param {object} params 参数 * @param {HTMLElement} params.container 容器 * @param {number} params.width 图片宽 * @param {number} params.height 图片高 * @param {string} params.textAlign 同 ctx.textAlign * @param {string} params.textBaseline 同 ctx.textBaseline * @param {string} params.font 同 ctx.font * @param {string} params.fillStyle 同 ctx.fillStyle * @param {string} params.content 内容 * @param {number} params.rotate 旋转角度 * @param {number} params.zIndex 层级 * * @example * * ```ts * const rtx = 'pony'; * * createWatcherMark({ * content: rtx, * width: '300', * height: '300', * textAlign: 'center', * textBaseline: 'middle', * font: '25px Microsoft Yahei', * fillStyle: 'rgba(184, 184, 184, 0.3)', * rotate: '-50', * zIndex: 1000, * }); * ``` */ export declare function createWatcherMark({ container, width, height, textAlign, textBaseline, font, fillStyle, content, rotate, zIndex, }?: { container?: HTMLElement | undefined; width?: number | undefined; height?: number | undefined; textAlign?: string | undefined; textBaseline?: string | undefined; font?: string | undefined; fillStyle?: string | undefined; content?: string | undefined; rotate?: number | undefined; zIndex?: number | undefined; }): void; /** * 每日合并 * 1. 获取昨天有活跃的分支 * 2. 对于每个分支,进行合并并推送 * - 清理 Git 环境 * - 切到主分支,并拉最新代码 * - 切到当前分支,拉最新代码 * - 尝试执行 git merge * - 对比 merge 前后的 commit 信息是否相同,作为判断 merge 是否成功的依据 * 3. 发送机器人消息 * * * @export * @async * @param {object} param0 参数 * @param {string} param0.webhookUrl 机器人地址 * @param {string} param0.appName 项目名称 * @param {string} param0.devRoot 项目根路径 * @param {string} param0.baseUrl 基础请求 url * @param {string} param0.repoName 仓库名称 * @param {string} param0.privateToken 密钥 * @param {boolean} [param0.isDryRun=false] 是否演练 * @param {string} [param0.mainBranch='develop'] 主分支 * @param {Regexp} [param0.whiteBranchReg=/^release\|develop\|hotfix\\/.+$/] 不处理的分支正则 * @returns {*} * @example * * ```ts * dailyMerge({ * webhookUrl: 'xx', * appName: 'xx', * devRoot: 'xx', * * baseUrl: 'xx', * repoName: 'xx', * privateToken: 'xx', * * isDryRun: false, * }) * ``` */ export declare function dailyMerge({ webhookUrl, appName, devRoot, baseUrl, repoName, privateToken, isDryRun, mainBranch, whiteBranchReg, }: { webhookUrl: string; appName: string; devRoot: string; baseUrl: string; repoName: string; privateToken: string; isDryRun?: boolean; mainBranch?: string; whiteBranchReg?: RegExp; }): Promise<void>; /** * 将日期格式化 * @param {Date} date * @param {string} format * @returns {string} 格式化后的日期字符串 * @example * * const date = new Date('2020-11-27 8:23:24'); * * const res = dateFormat(date, 'yyyy-MM-dd hh:mm:ss') * * // 2020-11-27 08:23:24 */ export declare function dateFormat(date: string | number | Date, fmt: string): string; /** * 防抖,场景:搜索 * * 触发事件后在 n 秒内函数只能执行一次,如果 * 在 n 秒内又触发了事件,则会重新计算函数执行时间 * * @param {Function} fn 主函数 * @param {number} time 间隔时间,单位 `ms` * @param {boolean} immediate 是否立即执行,默认 `false` * @returns 闭包函数 * * @example * * ```ts * function count() { * console.log('xxxxx') * } * window.onscroll = debounce(count, 500) * * window.onscroll = debounce(count, 500, true) * ``` */ export declare function debounce(fn: Function, time: number, immediate?: boolean): (...args: Array<any>) => any; /** * 不用生成中间函数的防抖 * * @example * ```ts * debounceRun(func, args, { * funcKey: 'funcKey', * wait: 500, // 默认 500 * throttle: false, // 是否是节流,默认 false * immediate: true, // 是否立即执行,默认 true * }) * `` */ export declare const debounceRun: (func: Function, args?: any[], options?: { funcKey?: any; wait?: number | undefined; throttle?: boolean | undefined; immediate?: boolean | undefined; debug?: boolean | undefined; }) => void; export declare const decode: (str: string) => string; /** * 将字符串解码,与`encodeUrlParam`相对 * @param {string} obj 输入字符串 * @returns {object} 对象 * @example * * decodeUrlParam('%7B%22a%22%3A1%7D') * * // { a: 1 } * */ export declare function decodeUrlParam(str: string): object; /** * 深度赋值 * @param keyStr 以点拼接的 key,比如 foo.bar * @param target 目标对象 * @param value 目标值 * @example * ```ts * const obj = { a: { b: 1 } }; * deepSet('a.c', obj, 2); * * console.log(obj); * // { a: { b: 1, c: 2 } } * ``` */ export declare function deepSet(keyStr: string, target: Record<string, any>, value: unknown): void; export declare function deleteCOSEmptyFolder({ secretId, secretKey, bucket, region, prefix, }: { secretId: string; secretKey: string; bucket: string; region: string; prefix: string; }): Promise<unknown>; export declare function deleteCOSLongAgoObject({ secretId, secretKey, bucket, region, prefix, keepNumber, }: { secretId: string; secretKey: string; bucket: string; region: string; prefix: string; keepNumber?: number; }): Promise<unknown>; export declare function deleteCOSMultipleObject({ secretId, secretKey, keys, bucket, region, }: { secretId: string; secretKey: string; bucket: string; region: string; keys: Array<string>; }): Promise<unknown>; /** * 删除目录 * @param {Object} path */ export declare function deleteFolder(tPath: string): void; export declare function deleteFolderRecursive(path: string, options?: { deleteFile: boolean; log: boolean; }): void; /** * 删除一个项目 * @param {object} options 输入配置 * @param {string} options.id 项目id * @param {string} options.privateToken 密钥 * @returns {Promise<Array<object>>} 请求Promise * @example * * deleteTGitProject({ * id: '123' * privateToken: 'xxxxx', * }).then((resp) => { * * }) */ export declare function deleteTGitProject({ id, privateToken, }: { id: number | string; privateToken: string; }): Promise<Array<object>>; declare enum DEVICE_TYPE { PC = "PC", MOBILE_HOR = "MOBILE_HORPC", MOBILE_VERT = "MOBILE_VERT" } /** * 隐藏loading toast * @example * ```ts * Toast.dismissLoading(); * ``` */ export declare const dismissLoading: () => void; export declare function downloadFileFromBlob({ blob, fileName, }: { blob: BlobPart; fileName: string; }): void; export declare function downloadFilesToZip({ fileList, zipName, saveAs, JSZip, }: { fileList: Array<{ content: string; name: string; }>; zipName: string; saveAs: (...args: any[]) => any; JSZip: any; }): Promise<boolean>; declare namespace drag { export { dragElement, DRAG_TYPE } } declare enum DRAG_TYPE { DOT_TO_DOT = "DOT_TO_DOT", STEPS = "STEPS" } declare function dragElement({ page, source, target, mode, reverse, stepUnit, }: { page: any; source: any; target: any; mode?: DRAG_TYPE; reverse?: boolean; stepUnit?: number; }): Promise<void>; export declare const e2e: { autoScroll(element: HTMLAnchorElement, page: any, bottomTimes?: number): Promise<void>; dragElement({ page, source, target, mode, reverse, stepUnit, }: { page: any; source: any; target: any; mode?: drag.DRAG_TYPE | undefined; reverse?: boolean | undefined; stepUnit?: number | undefined; }): Promise<void>; DRAG_TYPE: typeof drag.DRAG_TYPE; waitEle(element: HTMLSelectElement, page: any, timeout?: number): Promise<any>; clickBtn(btn: any): Promise<boolean>; findAndClick(element: HTMLSelectElement, page: any, timeout?: number): Promise<any>; justWait(time: number): Promise<unknown>; closeBlankPage(browser: any): Promise<void>; getRect(element: HTMLSelectElement, page: any): Promise<any>; getInnerText(element: HTMLSelectElement, page: any): Promise<any>; findListItemAndClick({ page, element, innerText, }: { page: any; element: HTMLSelectElement; innerText: string; }): Promise<void>; getHref(page: any): Promise<any>; initBrowser({ puppeteer, args, headless, devtools, }: { puppeteer: any; args?: string[] | undefined; headless?: boolean | undefined; devtools?: boolean | undefined; }): Promise<any>; getNewPage(browser: any, device: page.DEVICE_TYPE): Promise<any>; openOrFindPage(browser: any, href: string, device: page.DEVICE_TYPE): Promise<any>; setUserAgent(useragent: string, page: any): Promise<void>; setSessionStorage(key: string, value: string, page: any): Promise<void>; setRoute(page: any, route?: string): Promise<void>; DEVICE_TYPE: typeof page.DEVICE_TYPE; }; /** * 使用鼠标滚轮控制元素的scrollLeft实现左右移动 * @param {HTMLElement} element - 需要控制移动的DOM元素 * @param {Object} [options] - 配置选项 * @param {number} [options.speed=50] - 移动速度(像素/滚动单位) * @param {boolean} [options.preventDefault=true] - 是否阻止默认滚动行为 * @param {boolean} [options.invertDirection=false] - 是否反转滚动方向 */ export declare function enableHorizontalScroll(element: HTMLElement, options?: {}): (() => void) | undefined; export declare const encode: (str: string) => string; /** * 将对象字符串化 * @param {object} obj 输入对象 * @returns {string} 字符串 * @example * * encodeUrlParam({a: 1}) * * // '%7B%22a%22%3A1%7D' * */ export declare function encodeUrlParam(obj: object): string; declare const ERROR_MAP: { BRANCH_EXIST: string; SAME_CONFIG: string; }; export declare class EventBus { private events; constructor(); emit(eventName: string, ...args: Array<any>): void; on(eventName: string, fn: any): void; off(eventName: string, fn: any): void; } declare type EventOptions = string | { name: string; [k: string]: string; }; /** * excel 转 json * @param {object} params 参数 * @returns jsonData * @example * * const options = { * header: ['id', 'name', 'age'], // 可选:自定义表头 * range: 1, // 可选:跳过第一行(标题行) * defval: null, // 可选:空单元格的默认值 * raw: false, // 可选:是否保留原始数据格式 * }; * * excelToJson({ * filePath: CONFIG.xlsxPath, * sheetIndex: 1, * options, * }); * * // [ * // { id: 1, name: '2', age: '3' }, * // { id: 1, name: '2', age: '3' } * // ]; * */ export declare function excelToJson({ filePath, sheetIndex, options, }: { filePath: string; sheetIndex?: number; options?: Record<string, any>; }): any; /** * nodejs 中调用 child_process.execSync 执行命令, * 这个方法会对输出结果截断,只返回第一行内容 * @param {string} command 命令 * @param {string} root 执行命令的目录 * @param {string | object} stdio 结果输出,默认为 pipe * @returns {string} 命令执行结果 */ export declare function execCommand(command: string, root?: string, options?: string | { stdio?: string; line?: number; }): string; export declare function execCommandInTarget(command: string, targetProject: string): void; export declare function exportTencentDoc({ accessToken, clientId, openId, fileId, exportType, waitTime, }: ISecretInfo_2 & { fileId: string; exportType: number; waitTime?: number; }): Promise<string | undefined>; /** * 将属性混合到目标对象中 * @param {object} to 目标对象 * @param {object} from 原始对象 * @returns 处理后的对象 * * @example * const a = { name: 'lee' } * const b = { age: 3 } * extend(a, b) * * console.log(a) * * // => { name: 'lee', age: 3 } */ export declare function extend(to: Record<string, any>, from: Record<string, any>): object; /** * 拼接额外参数 * @param {string} url 地址 * @param {string} removeKeyArr 待添加的参数对象 * @returns 重新拼接的地址 * @example * const url1 = extendUrlParams('http://www.test.com?a=1&b=2&c=3#/detail?d=4', { e: 5 }); // 'http://www.test.com/#/detail?a=1&b=2&c=3&d=4&e=5' */ export declare function extendUrlParams(url?: string, extParamsObj?: {}, forceHistoryMode?: boolean): string; /** * 提取 Vue 组件的 class * @param {obj} params 参数 * @param {string} params.filePath 源文件地址 * @param {string} [params.targetFilePath] 输出文件地址 * @param {Regexp} [params.extractRegexp] 提取正则 * * ```ts * extractClass({ * filePath: 'xxx.vue', * }) * ``` */ export declare function extractClass({ filePath, targetFilePath, extractRegexp, }: { filePath: string; targetFilePath?: string; extractRegexp?: RegExp; }): void; /** * 提取 Vue 组件的 event * @param {obj} params 参数 * @param {string} params.filePath 源文件地址 * @param {string} [params.targetFilePath] 输出文件地址 * @param {Regexp} [params.extractRegexp] 提取正则 * * ```ts * extractEvent({ * filePath: 'xxx.vue', * }) * ``` */ export declare function extractEvent({ filePath, targetFilePath, extractRegexp, }: { filePath: string; targetFilePath?: string; extractRegexp?: RegExp; }): void; /** * 提取 Vue 组件的 props * @param {obj} params 参数 * @param {string} params.filePath 源文件地址 * @param {string} [params.targetFilePath] 输出文件地址 * @param {Regexp} [params.extractRegexp] 提取正则 * * ```ts * extractProps({ * filePath: 'xxx.vue', * }) * ``` */ export declare function extractProps({ filePath, targetFilePath, extractRegexp, }: { filePath: string; targetFilePath?: string; extractRegexp?: RegExp; }): void; declare type Fail = (err?: any) => void; export declare function fetchAllProjectsInGroup({ groupName, privateToken, baseUrl, includeSubgroups, }: { groupName: string; privateToken: string; baseUrl?: string; includeSubgroups?: boolean; }): Promise<unknown>; export declare function fetchLatestOneRainbowData({ secretInfo, appName, key, valueType, fetchRainbowConfigOptions, }: { secretInfo: ISecretInfo_3; appName: string; key: string; valueType?: RainbowKeyValueType; fetchRainbowConfigOptions?: FetchRainbowConfigOptions; }): Promise<{ config: Array<IRemoteConfig>; originConfig: ILocalConfig; equal: boolean; }>; export declare function fetchLatestRainbowData({ secretInfo, appName, }: { secretInfo: ISecretInfo_3; appName: string; }): Promise<{ config: Array<IRemoteConfig>; originConfig: ILocalConfig; equal: boolean; }>; /** * 拉取七彩石配置 * @param {String} key 七彩石的key * @param {object} secretInfo 密钥信息 * @param {string} secretInfo.appId 项目Id * @param {string} secretInfo.envName 环境 * @param {string} secretInfo.groupName 组名称 * @returns {Promise<object>} 请求Promise * * @example * * fetchRainbowConfig('test', { * appId: 'xx', * envName: 'prod', * groupName: 'robot', * }).then((resp) => { * console.log(resp) * }); * */ export declare function fetchRainbowConfig(key: string, secretInfo: Partial<ISecretInfo_3>, options?: FetchRainbowConfigOptions): Promise<any>; export declare function fetchRainbowConfigFromSdk({ secretInfo, sdk, initOptions, key, isFetchGroup, tryJsonParse, rainbow, }: { secretInfo: ISecretInfo_3; sdk: any; key: string; initOptions?: Record<string, any>; isFetchGroup?: boolean; tryJsonParse?: boolean; rainbow?: any; }): Promise<unknown>; declare interface FetchRainbowConfigOptions { sdk: any; initOptions?: Record<string, any>; isFetchGroup?: boolean; tryJsonParse?: boolean; } /** * 发起 SSE 请求的核心函数,根据环境自动选择 H5 或 MP 实现 * @param {RequestParams} params - 请求参数 * @param {string} params.url - 请求地址 * @param {Object} params.data - 请求数据 * @param {Function} params.success - 成功回调 * @param {Function} params.fail - 失败回调 * @param {Function} params.complete - 完成回调 * @returns {Promise} 返回一个 Promise,包含请求任务或响应对象 * @example * ```ts * import { safeJsonParse } from 't-comm/es/json'; * * import { fetchSSECore, type RequestParams } from 't-comm/es/sse'; * * // 检查是否结束,业务自定义 * function checkFinish(str) { * const data: any = safeJsonParse(str); * return data?.status === 3; * } * * // 业务二次封装,把自己的请求数据、自定义的处理数据的逻辑放进去 * export function sendChatMessage({ * input, * sessionId, * extraInfo, * expectedOp, * * success, * fail, * complete, * }: { * input: string; * sessionId?: string; * extraInfo?: string; * expectedOp?: Record<string, any>; * * success?: (data: any) => void; * fail?: RequestParams['fail']; * complete?: RequestParams['complete']; * }) { * const origin = isTestEnv() ? 'https://xx.com' : 'https://xx.com'; * const url = `${origin}/xx.xx.xx.xx/xx?g_app_tk=${cookie.get('tip_token')}&tstamp=${Date.now()}`; * const reqData = { * input, * session_id: sessionId, * extra_info: extraInfo, * expected_op: expectedOp, * }; * * const parsedSuccess = (str, fullStr) => { * const data: any = safeJsonParse(str); * const fullData: any = safeJsonParse(fullStr); * * if (checkFinish(str)) { * complete?.(str); * return; * } * * // 检查是否失败,业务自定义 * if (fullData?.err_msg) { * fail?.(data); * return; * } * * success?.(data); * }; * * return fetchSSECore({ * url, * data: reqData, * success: parsedSuccess, * fail, * complete, * isTestEnv, * }); * } * * ``` */ export declare function fetchSSECore({ url, data, success, fail, complete, isTestEnv, }: RequestParams): Promise<unknown>; /** * 在 H5 环境下发起 SSE 请求的核心函数 * @param {Object} params - 参数对象 * @param {string} params.url - 请求 URL * @param {any} params.data - 请求数据 * @param {Function} params.success - 成功回调函数 * @param {Function} params.fail - 失败回调函数 * @param {Function} params.complete - 完成回调函数 * @returns {Promise} 返回一个 Promise,包含响应对象 */ export declare function fetchSSECoreInH5({ url, data, success, fail, complete, }: Pick<RequestParams, 'url' | 'data' | 'success' | 'fail' | 'complete'>): Promise<unknown>; /** * 在 MP 环境下发起 SSE 请求的核心函数 * @param {RequestParams} params - 请求参数 * @returns {Promise} 返回一个 Promise,包含请求任务对象 */ export declare function fetchSSECoreInMP({ url, data, success, fail, complete, isTestEnv, }: RequestParams): Promise<unknown>; /** * 获取天气信息 * @returns {Promise<Array>} 天气数据 * @example * * fetchWeatherData().then(content => { * console.log(content) * }) */ export declare function fetchWeatherData<T extends Array<object>>(): Promise<T>; export declare type FileMap = { [k: string]: { reg: RegExp; lintKeyword: string; outputFileName: string; outputFile?: string; isStyle?: boolean; isVue?: boolean; total?: number; errorFiles?: JSErrorFile[]; }; }; export declare interface FilterParams { url: string; limit: number; keepKey: string[]; forceHistoryMode?: boolean | undefined; } /** * 根据地址长度,进行过滤地址参数,允许指定保留特定参数 * @param {object} [params={ limit: 1024 }] 参数 * @param {number} params.url 待过滤地址,默认当前页面地址 * @param {number} params.limit 参数长度限制 * @param {array} params.keepKey 指定保留的参数,比如业务参数、框架参数(登录态、统计上报等) */ export declare function filterUrlParams(params?: FilterParams): string; export declare function findCurrentStage<T extends { start_time: number; end_time: number; }>(list: Array<T>, now: number): T | Partial<T>; /** * 根据路由表,找到 path 对应的 路由名称 * @param {string} path 路由路径 * @param {array} routes 路由表 * @returns {object} 匹配到的路由信息 * * @example * ```ts * const { name, params, meta, path } = findRouteName(rawPath, ALL_ROUTES) || {}; * * console.log('name', name); * ``` */ export declare function findRouteName(path: string, routes: Array<IRoute>): { name: string | undefined; params: { [x: string]: any; }; path: string | undefined; meta: IMeta; } | undefined; /** * 递归拉平数组 * @param list 数组 * @returns 数组 * * @example * * flat([[[1, 2, 3], 4], 5]) * * // [1, 2, 3, 4, 5] */ export declare function flat<T>(list: readonly T[]): T[]; /** * 拉平数组,不会递归处理 * @param {Array<Object>} list - 对象数组 * @param {string} key - 对象的key * @returns {object} 拉平后的对象 * * @example * * const list = [{id: 1, name: 'a'}, {id: 2, name: 'b'}] * * flatten(list, 'id') * * // {1: {id: 1, name: 'a'}, 2: {id: 2, name: 'b'}} * */ export declare function flatten<T extends Record<string, unknown>, K extends keyof T>(list: T[], key: K): Record<string | number | symbol, T>; /** * 拉平之前数据 * @param {Array<Object>} preDataList 之前的数据,作为对照 * @param {string} key 主键 * @returns {Object} preDataMap * * @example * const data = [{ * ProjectName: { name: 'ProjectName', value: '研发平台' }, * PagePv: { name: 'PagePv', value: 152 }, * PageUv: { name: 'PageUv', value: 7 }, * Score: { name: 'Score', value: 93.92 }, * PageDuration: { name: 'PageDuration', value: 1281.58 }, * PageError: { name: 'PageError', value: 2 }, * }]; * * flattenPreData(data, 'ProjectName'); * * // 输出 * { * 研发平台: { * ProjectName: '研发平台', * PagePv: 152, * PageUv: 7, * Score: 93.92, * PageDuration: 1281.58, * PageError: 2, * }, * }; */ export declare function flattenPreData(preDataList: Array<IPreData>, key: string): { [valueOfPrimaryKey: string]: { [key: string]: ValueType; }; }; export declare function flattenSubPackages(result: IUploadResult): Record<string, any>; export declare function flattenUsingComponentMap(rawMap: Record<string, any>): ComponentMapList; /** * 格式化 bite 单位,最多保留2位小数,最大单位为BB * @param number size bite 单位 * @returns 格式化的字符 * @example * * formatBite(1) * // 1B * * formatBite(100) * // 100B * * formatBite(1000) * // 1000B * * formatBite(10000) * // 9.77KB * * formatBite(100000) * // 97.66KB * * formatBite(1000000) * // 976.56KB * * formatBite(10000000) * // 9.54MB */ export declare function formatBite(size: number): string; /** * 根据传入的参数,移除原来的所有参数,根据传入的 keepParamsObj 进行重新拼接地址,以 hash 模式返回 * @param {string} url 地址 * @param {object} keepParamsObj 参数对象 * @returns 只有传入参数的地址 * @example * const url1 = formatUrlParams('http://www.test.com?a=1&b=2&c=3', { e: 5 }); // http://www.test.com/#/?e=5 * const url2 = formatUrlParams('http://www.test.com?a=1&b=2&c=3#/detail?d=4', { f: 5 }); // http://www.test.com/#/detail?f=5 */ export declare function formatUrlParams(url?: string, keepParamsObj?: Record<string, string | number>, forceHistoryMode?: boolean): string; /** * 获取自定义事件图片并发送 * @param {object} options 配置信息 * @returns {string} 图片url * @example * * const requestMultiImgDate = Date.now() - 1 * 24 * 60 * 60 * 1000; * * const tamGroupIdList = [1, 2, 3]; * * const eventProjectMap = { * 62659: { * name: 'aaaaa', * }, * 57706: { * name: 'bbbbb', * extraProjectId: 66379, * }, * }; * * const eventMap = { * WX_SUC: { * // 总和 * type: 'SUMMARY', * target: ['ENTER_GAME_WX_SUC', 'LAUNCH_GAME_SUC_WX'], * }, * WX_FAIL: { * // 总和 * type: 'SUMMARY', * target: ['ENTER_GAME_WX_FAIL', 'LAUNCH_GAME_FAIL_WX'], * }, * }; * * const eventTableHeaderMap = { * ProjectName: { * name: '项目名称', * tableWidth: 95, * }, * ALL_SUMMARY: { * name: '拉起总数', * tableWidth: 65, * }, * }; * * genCustomEventImgAndSendRobot({ * date: requestLaunchGameDate, * secretInfo: { * getPwdCode, * encrypt, * apiKey: process.env.AEGIS_APP_KEY, * loginName: 'lee', * }, * projectIdMap: eventProjectMap, * eventMap, * tableHeaderMap: eventTableHeaderMap, * webhookUrl: tamRobotWebhook, * chatId: tamRobotChatId, * }); * */ export declare function genCustomEventImgAndSendRobot({ date, projectIdMap, env, secretInfo, eventMap, tableHeaderMap, webhookUrl, chatId, }: { date: number; projectIdMap: Array<string>; env: string; secretInfo: SecretInfoType; eventMap: {}; tableHeaderMap: {}; webhookUrl: string; chatId: string; }): Promise<void>; /** * 生成 CSV 文件内容,可以用于 fs.writeFileSync 输出 * * 第一行为表头 * @param {Array<Array<string>>} dataList 二维数据列表 * @returns 生成的字符串 * @example * * ```ts * generateCSV([['a','b'], ['1', '2']]); * ``` */ export declare function genera