@cloudbase/manager-node 4.4.9-beta.0 → 4.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/function/index.js
CHANGED
|
@@ -258,96 +258,20 @@ class FunctionService {
|
|
|
258
258
|
});
|
|
259
259
|
return data;
|
|
260
260
|
}
|
|
261
|
-
/**
|
|
262
|
-
* 列出所有函数
|
|
263
|
-
* @param {IListFunctionOptions} options
|
|
264
|
-
* @returns {Promise<Record<string, string>[]>}
|
|
265
|
-
*/
|
|
266
|
-
async listAllFunctions(options) {
|
|
267
|
-
const allFunctions = [];
|
|
268
|
-
let currentOffset = 0;
|
|
269
|
-
const pageSize = 20;
|
|
270
|
-
const { envId } = options;
|
|
271
|
-
while (true) {
|
|
272
|
-
try {
|
|
273
|
-
const res = await this.scfService.request('ListFunctions', {
|
|
274
|
-
Namespace: envId,
|
|
275
|
-
Limit: pageSize,
|
|
276
|
-
Offset: currentOffset
|
|
277
|
-
});
|
|
278
|
-
const { Functions = [], TotalCount } = res;
|
|
279
|
-
if (Functions.length === 0) {
|
|
280
|
-
break;
|
|
281
|
-
}
|
|
282
|
-
allFunctions.push(...Functions);
|
|
283
|
-
// 检查是否已获取所有函数
|
|
284
|
-
if (allFunctions.length >= TotalCount || Functions.length < pageSize) {
|
|
285
|
-
break;
|
|
286
|
-
}
|
|
287
|
-
currentOffset += pageSize;
|
|
288
|
-
}
|
|
289
|
-
catch (error) {
|
|
290
|
-
throw new error_1.CloudBaseError(`获取函数列表失败: ${error.message}`);
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
// 格式化数据
|
|
294
|
-
const data = [];
|
|
295
|
-
allFunctions.forEach(func => {
|
|
296
|
-
const { FunctionId, FunctionName, Runtime, AddTime, ModTime, Status } = func;
|
|
297
|
-
data.push({
|
|
298
|
-
FunctionId,
|
|
299
|
-
FunctionName,
|
|
300
|
-
Runtime,
|
|
301
|
-
AddTime,
|
|
302
|
-
ModTime,
|
|
303
|
-
Status
|
|
304
|
-
});
|
|
305
|
-
});
|
|
306
|
-
return data;
|
|
307
|
-
}
|
|
308
261
|
/**
|
|
309
262
|
* 删除云函数
|
|
310
263
|
* @param {string} name 云函数名称
|
|
311
264
|
* @param {string} qualifier 需要删除的版本号,不填默认删除函数下全部版本。
|
|
312
265
|
* @returns {Promise<IResponseInfo>}
|
|
313
266
|
*/
|
|
314
|
-
async deleteFunction(
|
|
315
|
-
var _a;
|
|
267
|
+
async deleteFunction(name, qualifier) {
|
|
316
268
|
const { namespace } = this.getFunctionConfig();
|
|
317
|
-
|
|
318
|
-
const accessService = this.environment.getAccessService();
|
|
319
|
-
const res = await accessService.getAccessList({
|
|
320
|
-
name
|
|
321
|
-
});
|
|
322
|
-
// 删除绑定的 API 网关
|
|
323
|
-
if (((_a = res === null || res === void 0 ? void 0 : res.APISet) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
324
|
-
await accessService.deleteAccess({
|
|
325
|
-
name
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
await this.scfService.request('DeleteFunction', {
|
|
269
|
+
return this.scfService.request('DeleteFunction', {
|
|
329
270
|
FunctionName: name,
|
|
330
|
-
Namespace: namespace
|
|
271
|
+
Namespace: namespace,
|
|
272
|
+
Qualifier: qualifier
|
|
331
273
|
});
|
|
332
274
|
}
|
|
333
|
-
/**
|
|
334
|
-
* 批量删除云函数
|
|
335
|
-
* @param {Object} options
|
|
336
|
-
* @param {string[]} options.names 云函数名称列表
|
|
337
|
-
* @returns {Promise<void>}
|
|
338
|
-
*/
|
|
339
|
-
async batchDeleteFunctions({ names }) {
|
|
340
|
-
const promises = names.map(name => (async () => {
|
|
341
|
-
try {
|
|
342
|
-
await this.deleteFunction({ name });
|
|
343
|
-
(0, utils_1.successLog)(`[${name}] 函数删除成功!`);
|
|
344
|
-
}
|
|
345
|
-
catch (e) {
|
|
346
|
-
throw new error_1.CloudBaseError(e.message);
|
|
347
|
-
}
|
|
348
|
-
})());
|
|
349
|
-
await Promise.all(promises);
|
|
350
|
-
}
|
|
351
275
|
/**
|
|
352
276
|
* 获取云函数详细信息
|
|
353
277
|
* @param {string} name 云函数名称
|
|
@@ -382,35 +306,13 @@ class FunctionService {
|
|
|
382
306
|
}
|
|
383
307
|
catch (e) {
|
|
384
308
|
data.VpcConfig = {
|
|
385
|
-
vpc: '
|
|
386
|
-
subnet: '
|
|
309
|
+
vpc: '',
|
|
310
|
+
subnet: ''
|
|
387
311
|
};
|
|
388
312
|
}
|
|
389
313
|
}
|
|
390
314
|
return data;
|
|
391
315
|
}
|
|
392
|
-
/**
|
|
393
|
-
* 批量获取云函数详细信息
|
|
394
|
-
* @param {Object} options
|
|
395
|
-
* @param {string[]} options.names 云函数名称列表
|
|
396
|
-
* @param {string} options.envId 环境 ID
|
|
397
|
-
* @param {string} options.codeSecret
|
|
398
|
-
* @returns {Promise<IFunctionInfo[]>}
|
|
399
|
-
*/
|
|
400
|
-
async batchGetFunctionsDetail({ names, envId, codeSecret }) {
|
|
401
|
-
const data = [];
|
|
402
|
-
const promises = names.map(name => (async () => {
|
|
403
|
-
try {
|
|
404
|
-
const info = await this.getFunctionDetail(name, codeSecret);
|
|
405
|
-
data.push(info);
|
|
406
|
-
}
|
|
407
|
-
catch (e) {
|
|
408
|
-
throw new error_1.CloudBaseError(`${name} 获取信息失败:${e.message}`);
|
|
409
|
-
}
|
|
410
|
-
})());
|
|
411
|
-
await Promise.all(promises);
|
|
412
|
-
return data;
|
|
413
|
-
}
|
|
414
316
|
/**
|
|
415
317
|
* 获取函数日志
|
|
416
318
|
* @deprecated 请使用 getFunctionLogsV2 代替
|
|
@@ -507,33 +409,6 @@ class FunctionService {
|
|
|
507
409
|
const res = await this.tcbService.request('GetFunctionLogDetail', params);
|
|
508
410
|
return res;
|
|
509
411
|
}
|
|
510
|
-
/**
|
|
511
|
-
* 获取函数的完整调用日志
|
|
512
|
-
* 该方法会自动完成两步操作:1. 获取日志请求ID列表。 2. 根据ID列表获取每条日志的详细内容。
|
|
513
|
-
* @param {IFunctionLogOptionsV2} options - 查询选项
|
|
514
|
-
* @returns {Promise<IFunctionLogDetailRes[]>} 返回包含完整日志详情的数组
|
|
515
|
-
*/
|
|
516
|
-
async getCompleteFunctionLogs(options) {
|
|
517
|
-
// 调用 getFunctionLogsV2 获取日志请求ID列表
|
|
518
|
-
const { name } = options;
|
|
519
|
-
const logs = await this.getFunctionLogsV2(options);
|
|
520
|
-
// 如果没有日志,直接返回空数组
|
|
521
|
-
if (logs.LogList.length === 0) {
|
|
522
|
-
return [];
|
|
523
|
-
}
|
|
524
|
-
const detailPromises = logs.LogList.map(async (log) => {
|
|
525
|
-
// 对每一个日志ID,调用 getFunctionLogDetail
|
|
526
|
-
const res = await this.getFunctionLogDetail({
|
|
527
|
-
logRequestId: log.RequestId,
|
|
528
|
-
startTime: options.startTime,
|
|
529
|
-
endTime: options.endTime
|
|
530
|
-
});
|
|
531
|
-
return Object.assign(Object.assign({}, res), { RetCode: log.RetCode, FunctionName: name });
|
|
532
|
-
});
|
|
533
|
-
// 并发执行所有详情查询,等待它们全部完成
|
|
534
|
-
const detailedLogs = await Promise.all(detailPromises);
|
|
535
|
-
return detailedLogs;
|
|
536
|
-
}
|
|
537
412
|
/**
|
|
538
413
|
* 更新云函数配置
|
|
539
414
|
* @param {ICloudFunction} func 云函数配置
|
|
@@ -669,28 +544,6 @@ class FunctionService {
|
|
|
669
544
|
throw new error_1.CloudBaseError(`[${name}] 调用失败:\n${e.message}`);
|
|
670
545
|
}
|
|
671
546
|
}
|
|
672
|
-
/**
|
|
673
|
-
* 批量调用云函数
|
|
674
|
-
* @param {IFunctionBatchOptions} options
|
|
675
|
-
* @returns {Promise<IFunctionInvokeRes[]>}
|
|
676
|
-
*/
|
|
677
|
-
async batchInvokeFunctions(options) {
|
|
678
|
-
const { functions, envId, log = false } = options;
|
|
679
|
-
const promises = functions.map(func => (async () => {
|
|
680
|
-
try {
|
|
681
|
-
const result = await this.invokeFunction(func.name, func.params);
|
|
682
|
-
if (log) {
|
|
683
|
-
(0, utils_1.successLog)(`[${func.name}] 调用成功\n响应结果:\n`);
|
|
684
|
-
console.log(result);
|
|
685
|
-
}
|
|
686
|
-
return result;
|
|
687
|
-
}
|
|
688
|
-
catch (e) {
|
|
689
|
-
throw new error_1.CloudBaseError(`${func.name} 函数调用失败:${e.message}`);
|
|
690
|
-
}
|
|
691
|
-
})());
|
|
692
|
-
return Promise.all(promises);
|
|
693
|
-
}
|
|
694
547
|
/**
|
|
695
548
|
* 复制云函数
|
|
696
549
|
* @param {string} name 云函数名称
|
|
@@ -755,24 +608,6 @@ class FunctionService {
|
|
|
755
608
|
Type: 'timer'
|
|
756
609
|
});
|
|
757
610
|
}
|
|
758
|
-
/**
|
|
759
|
-
* 下载云函数代码
|
|
760
|
-
* @param {IFunctionCodeOptions} options
|
|
761
|
-
* @returns {Promise<void>}
|
|
762
|
-
*/
|
|
763
|
-
async downloadFunctionCode(options) {
|
|
764
|
-
const { destPath, envId, functionName, codeSecret } = options;
|
|
765
|
-
// 检验路径是否存在
|
|
766
|
-
(0, utils_1.checkFullAccess)(destPath, true);
|
|
767
|
-
// 获取下载链接
|
|
768
|
-
const { Url } = await this.scfService.request('GetFunctionAddress', {
|
|
769
|
-
FunctionName: functionName,
|
|
770
|
-
Namespace: envId,
|
|
771
|
-
CodeSecret: codeSecret
|
|
772
|
-
});
|
|
773
|
-
// 下载文件
|
|
774
|
-
return (0, utils_1.downloadAndExtractRemoteZip)(Url, destPath);
|
|
775
|
-
}
|
|
776
611
|
/**
|
|
777
612
|
* 获取云函数代码下载 链接
|
|
778
613
|
* @param {string} functionName
|
|
@@ -1198,18 +1033,12 @@ __decorate([
|
|
|
1198
1033
|
__decorate([
|
|
1199
1034
|
(0, utils_1.preLazy)()
|
|
1200
1035
|
], FunctionService.prototype, "listFunctions", null);
|
|
1201
|
-
__decorate([
|
|
1202
|
-
(0, utils_1.preLazy)()
|
|
1203
|
-
], FunctionService.prototype, "listAllFunctions", null);
|
|
1204
1036
|
__decorate([
|
|
1205
1037
|
(0, utils_1.preLazy)()
|
|
1206
1038
|
], FunctionService.prototype, "deleteFunction", null);
|
|
1207
1039
|
__decorate([
|
|
1208
1040
|
(0, utils_1.preLazy)()
|
|
1209
1041
|
], FunctionService.prototype, "getFunctionDetail", null);
|
|
1210
|
-
__decorate([
|
|
1211
|
-
(0, utils_1.preLazy)()
|
|
1212
|
-
], FunctionService.prototype, "batchGetFunctionsDetail", null);
|
|
1213
1042
|
__decorate([
|
|
1214
1043
|
(0, utils_1.preLazy)()
|
|
1215
1044
|
], FunctionService.prototype, "getFunctionLogs", null);
|
|
@@ -1219,9 +1048,6 @@ __decorate([
|
|
|
1219
1048
|
__decorate([
|
|
1220
1049
|
(0, utils_1.preLazy)()
|
|
1221
1050
|
], FunctionService.prototype, "getFunctionLogDetail", null);
|
|
1222
|
-
__decorate([
|
|
1223
|
-
(0, utils_1.preLazy)()
|
|
1224
|
-
], FunctionService.prototype, "getCompleteFunctionLogs", null);
|
|
1225
1051
|
__decorate([
|
|
1226
1052
|
(0, utils_1.preLazy)()
|
|
1227
1053
|
], FunctionService.prototype, "updateFunctionConfig", null);
|
|
@@ -1231,9 +1057,6 @@ __decorate([
|
|
|
1231
1057
|
__decorate([
|
|
1232
1058
|
(0, utils_1.preLazy)()
|
|
1233
1059
|
], FunctionService.prototype, "invokeFunction", null);
|
|
1234
|
-
__decorate([
|
|
1235
|
-
(0, utils_1.preLazy)()
|
|
1236
|
-
], FunctionService.prototype, "batchInvokeFunctions", null);
|
|
1237
1060
|
__decorate([
|
|
1238
1061
|
(0, utils_1.preLazy)()
|
|
1239
1062
|
], FunctionService.prototype, "copyFunction", null);
|
package/lib/utils/index.js
CHANGED
|
@@ -19,6 +19,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
20
|
exports.getCompleteTimeRange = exports.formatTimeByMs = exports.formatTimeValue = exports.guid6 = void 0;
|
|
21
21
|
exports.compressToZip = compressToZip;
|
|
22
|
+
exports.shouldSkipEntry = shouldSkipEntry;
|
|
22
23
|
exports.downloadAndExtractRemoteZip = downloadAndExtractRemoteZip;
|
|
23
24
|
exports.upload = upload;
|
|
24
25
|
exports.getRuntime = getRuntime;
|
|
@@ -28,7 +29,6 @@ exports.sleep = sleep;
|
|
|
28
29
|
exports.upperCaseStringFisrt = upperCaseStringFisrt;
|
|
29
30
|
exports.upperCaseObjKey = upperCaseObjKey;
|
|
30
31
|
exports.fetchTemplates = fetchTemplates;
|
|
31
|
-
exports.successLog = successLog;
|
|
32
32
|
const archiver_1 = __importDefault(require("archiver"));
|
|
33
33
|
const crypto_1 = __importDefault(require("crypto"));
|
|
34
34
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
@@ -37,7 +37,6 @@ const path_1 = __importDefault(require("path"));
|
|
|
37
37
|
const unzipper_1 = __importDefault(require("unzipper"));
|
|
38
38
|
const constant_1 = require("../constant");
|
|
39
39
|
const http_request_1 = require("./http-request");
|
|
40
|
-
const log_symbols_1 = __importDefault(require("log-symbols"));
|
|
41
40
|
__exportStar(require("./auth"), exports);
|
|
42
41
|
__exportStar(require("./cloud-api-request"), exports);
|
|
43
42
|
__exportStar(require("./cloudbase-request"), exports);
|
|
@@ -71,6 +70,40 @@ async function compressToZip(option) {
|
|
|
71
70
|
archive.finalize();
|
|
72
71
|
});
|
|
73
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* 检查是否应该跳过某个文件或文件夹
|
|
75
|
+
* @param {string} entryPath 文件路径
|
|
76
|
+
* @returns {boolean} 如果应该跳过则返回 true
|
|
77
|
+
*/
|
|
78
|
+
function shouldSkipEntry(entryPath) {
|
|
79
|
+
const normalizedPath = entryPath.replace(/\\/g, '/'); // 统一路径分隔符
|
|
80
|
+
// 过滤 macOS 系统文件和文件夹
|
|
81
|
+
const macOSPatterns = [
|
|
82
|
+
'__MACOSX', // macOS 资源文件夹
|
|
83
|
+
'.DS_Store', // macOS 文件夹设置文件
|
|
84
|
+
];
|
|
85
|
+
// 检查是否匹配任何需要跳过的模式
|
|
86
|
+
return macOSPatterns.some(pattern => {
|
|
87
|
+
// 检查路径是否以模式开头(用于文件夹)
|
|
88
|
+
if (normalizedPath.startsWith(pattern + '/') || normalizedPath === pattern) {
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
// 检查路径中是否包含这些模式(用于嵌套情况)
|
|
92
|
+
if (normalizedPath.includes('/' + pattern + '/') || normalizedPath.includes('/' + pattern)) {
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
// 检查文件名是否匹配模式
|
|
96
|
+
const fileName = path_1.default.basename(normalizedPath);
|
|
97
|
+
if (fileName === pattern) {
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
// 检查以 ._ 开头的 macOS 资源文件
|
|
101
|
+
if (fileName.startsWith('._')) {
|
|
102
|
+
return true;
|
|
103
|
+
}
|
|
104
|
+
return false;
|
|
105
|
+
});
|
|
106
|
+
}
|
|
74
107
|
/**
|
|
75
108
|
* 下载并解压压缩包到指定目录
|
|
76
109
|
* @param {string} downloadUrl 压缩包下载地址
|
|
@@ -99,6 +132,13 @@ async function downloadAndExtractRemoteZip(downloadUrl, targetPath) {
|
|
|
99
132
|
.on('error', reject)
|
|
100
133
|
.on('entry', async (entry) => {
|
|
101
134
|
totalEntries++;
|
|
135
|
+
// 检查是否应该跳过这个条目
|
|
136
|
+
if (shouldSkipEntry(entry.path)) {
|
|
137
|
+
entry.autodrain(); // 丢弃数据流
|
|
138
|
+
processedEntries++;
|
|
139
|
+
checkCompletion();
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
102
142
|
const filePath = path_1.default.join(dirPath, entry.path);
|
|
103
143
|
try {
|
|
104
144
|
// 确保父目录存在(处理嵌套目录情况)
|
|
@@ -267,7 +307,3 @@ const getCompleteTimeRange = (timeRange) => {
|
|
|
267
307
|
};
|
|
268
308
|
};
|
|
269
309
|
exports.getCompleteTimeRange = getCompleteTimeRange;
|
|
270
|
-
function successLog(msg) {
|
|
271
|
-
// 空格,兼容中文字符编码长度问题
|
|
272
|
-
console.log(`${log_symbols_1.default.success} ${msg}`);
|
|
273
|
-
}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Environment } from '../environment';
|
|
2
|
-
import { IResponseInfo, ICloudFunction,
|
|
2
|
+
import { IResponseInfo, ICloudFunction, IFunctionLogOptions, ICloudFunctionTrigger, IFunctionInvokeRes, IFunctionLogRes, IFunctionDownloadUrlRes, IFunctionLogDetailOptions, IFunctionLogDetailRes, IFunctionLogOptionsV2, IFunctionLogResV2 } from '../interfaces';
|
|
3
3
|
import { IFunctionInfo } from './types';
|
|
4
4
|
export interface IFunctionCode {
|
|
5
5
|
func: ICloudFunction;
|
|
@@ -173,31 +173,6 @@ export interface IGetFunctionAliasRes extends IResponseInfo {
|
|
|
173
173
|
AddTime: string;
|
|
174
174
|
ModTime: string;
|
|
175
175
|
}
|
|
176
|
-
export interface IListFunctionOptions {
|
|
177
|
-
limit?: number;
|
|
178
|
-
offset?: number;
|
|
179
|
-
envId: string;
|
|
180
|
-
}
|
|
181
|
-
export interface IFunctionBatchOptions {
|
|
182
|
-
functions: ICloudFunctionV2[];
|
|
183
|
-
envId: string;
|
|
184
|
-
log?: boolean;
|
|
185
|
-
}
|
|
186
|
-
export interface IGetAsyncEventStatusRes extends IResponseInfo {
|
|
187
|
-
Result: IAsyncEventStatus;
|
|
188
|
-
RequestId: string;
|
|
189
|
-
}
|
|
190
|
-
export interface IAsyncEventStatus {
|
|
191
|
-
InvokeRequestId: string;
|
|
192
|
-
Status: string;
|
|
193
|
-
StatusCode: number;
|
|
194
|
-
}
|
|
195
|
-
export interface IFunctionCodeOptions {
|
|
196
|
-
envId: string;
|
|
197
|
-
destPath: string;
|
|
198
|
-
functionName: string;
|
|
199
|
-
codeSecret?: string;
|
|
200
|
-
}
|
|
201
176
|
export declare class FunctionService {
|
|
202
177
|
private environment;
|
|
203
178
|
private vpcService;
|
|
@@ -239,49 +214,19 @@ export declare class FunctionService {
|
|
|
239
214
|
* @returns {Promise<Record<string, string>[]>}
|
|
240
215
|
*/
|
|
241
216
|
listFunctions(limit?: number, offset?: number): Promise<Record<string, string>[]>;
|
|
242
|
-
/**
|
|
243
|
-
* 列出所有函数
|
|
244
|
-
* @param {IListFunctionOptions} options
|
|
245
|
-
* @returns {Promise<Record<string, string>[]>}
|
|
246
|
-
*/
|
|
247
|
-
listAllFunctions(options: IListFunctionOptions): Promise<Record<string, string>[]>;
|
|
248
217
|
/**
|
|
249
218
|
* 删除云函数
|
|
250
219
|
* @param {string} name 云函数名称
|
|
251
220
|
* @param {string} qualifier 需要删除的版本号,不填默认删除函数下全部版本。
|
|
252
221
|
* @returns {Promise<IResponseInfo>}
|
|
253
222
|
*/
|
|
254
|
-
deleteFunction(
|
|
255
|
-
name: any;
|
|
256
|
-
}): Promise<void>;
|
|
257
|
-
/**
|
|
258
|
-
* 批量删除云函数
|
|
259
|
-
* @param {Object} options
|
|
260
|
-
* @param {string[]} options.names 云函数名称列表
|
|
261
|
-
* @returns {Promise<void>}
|
|
262
|
-
*/
|
|
263
|
-
batchDeleteFunctions({ names }: {
|
|
264
|
-
names: any;
|
|
265
|
-
}): Promise<void>;
|
|
223
|
+
deleteFunction(name: string, qualifier?: string): Promise<IResponseInfo>;
|
|
266
224
|
/**
|
|
267
225
|
* 获取云函数详细信息
|
|
268
226
|
* @param {string} name 云函数名称
|
|
269
227
|
* @returns {Promise<Record<string, string>>}
|
|
270
228
|
*/
|
|
271
229
|
getFunctionDetail(name: string, codeSecret?: string): Promise<IFunctionInfo>;
|
|
272
|
-
/**
|
|
273
|
-
* 批量获取云函数详细信息
|
|
274
|
-
* @param {Object} options
|
|
275
|
-
* @param {string[]} options.names 云函数名称列表
|
|
276
|
-
* @param {string} options.envId 环境 ID
|
|
277
|
-
* @param {string} options.codeSecret
|
|
278
|
-
* @returns {Promise<IFunctionInfo[]>}
|
|
279
|
-
*/
|
|
280
|
-
batchGetFunctionsDetail({ names, envId, codeSecret }: {
|
|
281
|
-
names: any;
|
|
282
|
-
envId: any;
|
|
283
|
-
codeSecret: any;
|
|
284
|
-
}): Promise<IFunctionInfo[]>;
|
|
285
230
|
/**
|
|
286
231
|
* 获取函数日志
|
|
287
232
|
* @deprecated 请使用 getFunctionLogsV2 代替
|
|
@@ -322,13 +267,6 @@ export declare class FunctionService {
|
|
|
322
267
|
* @returns {Promise<IFunctionLogDetailRes>}
|
|
323
268
|
*/
|
|
324
269
|
getFunctionLogDetail(options: IFunctionLogDetailOptions): Promise<IFunctionLogDetailRes>;
|
|
325
|
-
/**
|
|
326
|
-
* 获取函数的完整调用日志
|
|
327
|
-
* 该方法会自动完成两步操作:1. 获取日志请求ID列表。 2. 根据ID列表获取每条日志的详细内容。
|
|
328
|
-
* @param {IFunctionLogOptionsV2} options - 查询选项
|
|
329
|
-
* @returns {Promise<IFunctionLogDetailRes[]>} 返回包含完整日志详情的数组
|
|
330
|
-
*/
|
|
331
|
-
getCompleteFunctionLogs(options: IFunctionLogOptionsV2): Promise<IFunctionLogDetailRes[]>;
|
|
332
270
|
/**
|
|
333
271
|
* 更新云函数配置
|
|
334
272
|
* @param {ICloudFunction} func 云函数配置
|
|
@@ -349,12 +287,6 @@ export declare class FunctionService {
|
|
|
349
287
|
* @returns {Promise<IFunctionInvokeRes>}
|
|
350
288
|
*/
|
|
351
289
|
invokeFunction(name: string, params?: Record<string, any>): Promise<IFunctionInvokeRes>;
|
|
352
|
-
/**
|
|
353
|
-
* 批量调用云函数
|
|
354
|
-
* @param {IFunctionBatchOptions} options
|
|
355
|
-
* @returns {Promise<IFunctionInvokeRes[]>}
|
|
356
|
-
*/
|
|
357
|
-
batchInvokeFunctions(options: IFunctionBatchOptions): Promise<IFunctionInvokeRes[]>;
|
|
358
290
|
/**
|
|
359
291
|
* 复制云函数
|
|
360
292
|
* @param {string} name 云函数名称
|
|
@@ -378,12 +310,6 @@ export declare class FunctionService {
|
|
|
378
310
|
* @returns {Promise<IResponseInfo>}
|
|
379
311
|
*/
|
|
380
312
|
deleteFunctionTrigger(name: string, triggerName: string): Promise<IResponseInfo>;
|
|
381
|
-
/**
|
|
382
|
-
* 下载云函数代码
|
|
383
|
-
* @param {IFunctionCodeOptions} options
|
|
384
|
-
* @returns {Promise<void>}
|
|
385
|
-
*/
|
|
386
|
-
downloadFunctionCode(options: IFunctionCodeOptions): Promise<void>;
|
|
387
313
|
/**
|
|
388
314
|
* 获取云函数代码下载 链接
|
|
389
315
|
* @param {string} functionName
|
|
@@ -122,61 +122,6 @@ export interface IFunctionInfo {
|
|
|
122
122
|
ErrorMessage: string;
|
|
123
123
|
}[];
|
|
124
124
|
RequestId: string;
|
|
125
|
-
Layers: ILayerVersionInfo[];
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* 层版本信息
|
|
129
|
-
* 被 GetFunction, ListLayerVersions, ListLayers 接口引用
|
|
130
|
-
*/
|
|
131
|
-
export interface ILayerVersionInfo {
|
|
132
|
-
/**
|
|
133
|
-
* 版本适用的运行时
|
|
134
|
-
* @example ["Python3.10","Python3.9"]
|
|
135
|
-
*/
|
|
136
|
-
CompatibleRuntimes?: string[];
|
|
137
|
-
/**
|
|
138
|
-
* 创建时间
|
|
139
|
-
* @example 2024-11-22 16:52:21
|
|
140
|
-
*/
|
|
141
|
-
AddTime?: string;
|
|
142
|
-
/**
|
|
143
|
-
* 版本描述
|
|
144
|
-
* @example "a layer"
|
|
145
|
-
*/
|
|
146
|
-
Description?: string;
|
|
147
|
-
/**
|
|
148
|
-
* 许可证信息
|
|
149
|
-
* @example " "
|
|
150
|
-
*/
|
|
151
|
-
LicenseInfo?: string | null;
|
|
152
|
-
/**
|
|
153
|
-
* 版本号
|
|
154
|
-
* @example 1
|
|
155
|
-
*/
|
|
156
|
-
LayerVersion?: number;
|
|
157
|
-
/**
|
|
158
|
-
* 层名称
|
|
159
|
-
* @example "layer-name1"
|
|
160
|
-
*/
|
|
161
|
-
LayerName?: string;
|
|
162
|
-
/**
|
|
163
|
-
* 层的具体版本当前状态
|
|
164
|
-
* Active:正常状态
|
|
165
|
-
*/
|
|
166
|
-
Status?: string;
|
|
167
|
-
/**
|
|
168
|
-
* Stamp
|
|
169
|
-
* @example "Default"
|
|
170
|
-
*/
|
|
171
|
-
Stamp?: string;
|
|
172
|
-
/**
|
|
173
|
-
* 返回层绑定的标签信息
|
|
174
|
-
*/
|
|
175
|
-
Tags?: ITag1[];
|
|
176
|
-
}
|
|
177
|
-
export interface ITag1 {
|
|
178
|
-
Key: string;
|
|
179
|
-
Value: string[];
|
|
180
125
|
}
|
|
181
126
|
export interface IFunctionCode {
|
|
182
127
|
CosBucketName?: string;
|
|
@@ -33,21 +33,6 @@ export interface ICloudFunction extends ICloudFunctionConfig {
|
|
|
33
33
|
}[];
|
|
34
34
|
triggers?: ICloudFunctionTrigger[];
|
|
35
35
|
}
|
|
36
|
-
export interface ICloudFunctionV2 {
|
|
37
|
-
name: string;
|
|
38
|
-
config?: ICloudFunctionConfig;
|
|
39
|
-
triggers?: ICloudFunctionTrigger[];
|
|
40
|
-
params?: Record<string, string>;
|
|
41
|
-
handler?: string;
|
|
42
|
-
ignore?: string | string[];
|
|
43
|
-
timeout?: number;
|
|
44
|
-
envVariables?: Record<string, string | number | boolean>;
|
|
45
|
-
runtime?: string;
|
|
46
|
-
vpc?: IFunctionVPC;
|
|
47
|
-
l5?: boolean;
|
|
48
|
-
installDependency?: boolean;
|
|
49
|
-
isWaitInstall?: boolean;
|
|
50
|
-
}
|
|
51
36
|
export interface IFunctionLogOptions {
|
|
52
37
|
name: string;
|
|
53
38
|
offset?: number;
|
|
@@ -81,7 +66,6 @@ export interface IFunctionInvokeRes {
|
|
|
81
66
|
Duration: number;
|
|
82
67
|
BillDuration: number;
|
|
83
68
|
FunctionRequestId: string;
|
|
84
|
-
InvokeResult: number;
|
|
85
69
|
}
|
|
86
70
|
export interface IFunctionLogRes {
|
|
87
71
|
RequestId: string;
|
package/types/utils/index.d.ts
CHANGED
|
@@ -13,6 +13,12 @@ interface IZipOption {
|
|
|
13
13
|
pattern?: string;
|
|
14
14
|
}
|
|
15
15
|
export declare function compressToZip(option: IZipOption): Promise<unknown>;
|
|
16
|
+
/**
|
|
17
|
+
* 检查是否应该跳过某个文件或文件夹
|
|
18
|
+
* @param {string} entryPath 文件路径
|
|
19
|
+
* @returns {boolean} 如果应该跳过则返回 true
|
|
20
|
+
*/
|
|
21
|
+
export declare function shouldSkipEntry(entryPath: string): boolean;
|
|
16
22
|
/**
|
|
17
23
|
* 下载并解压压缩包到指定目录
|
|
18
24
|
* @param {string} downloadUrl 压缩包下载地址
|
|
@@ -64,4 +70,3 @@ export declare const getCompleteTimeRange: (timeRange: {
|
|
|
64
70
|
startTime: string;
|
|
65
71
|
endTime: string;
|
|
66
72
|
};
|
|
67
|
-
export declare function successLog(msg: string): void;
|