@cloudbase/cli 2.8.1-beta.0 → 2.8.1-beta.1
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.
|
@@ -54,7 +54,7 @@ let AttachFileLayer = class AttachFileLayer extends common_1.Command {
|
|
|
54
54
|
const fnName = params === null || params === void 0 ? void 0 : params[0];
|
|
55
55
|
const loading = (0, utils_1.loadingFactory)();
|
|
56
56
|
loading.start('数据加载中...');
|
|
57
|
-
const envFunctions = yield (0, function_1.
|
|
57
|
+
const envFunctions = yield (0, function_1.listAllFunctions)({
|
|
58
58
|
envId
|
|
59
59
|
});
|
|
60
60
|
const exist = envFunctions.find((fn) => fn.FunctionName === fnName);
|
package/lib/function/base.js
CHANGED
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.copyFunction = exports.batchInvokeFunctions = exports.invokeFunction = exports.batchUpdateFunctionConfig = exports.updateFunctionConfig = exports.getFunctionLog = exports.batchGetFunctionsDetail = exports.getFunctionDetail = exports.listFunction = exports.getFunctionService = void 0;
|
|
15
|
+
exports.copyFunction = exports.batchInvokeFunctions = exports.invokeFunction = exports.batchUpdateFunctionConfig = exports.updateFunctionConfig = exports.getFunctionLog = exports.batchGetFunctionsDetail = exports.getFunctionDetail = exports.listAllFunctions = exports.listFunction = exports.getFunctionService = void 0;
|
|
16
16
|
const manager_node_1 = __importDefault(require("@cloudbase/manager-node"));
|
|
17
17
|
const utils_1 = require("../utils");
|
|
18
18
|
const logger_1 = require("../logger");
|
|
@@ -61,6 +61,50 @@ function listFunction(options) {
|
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
exports.listFunction = listFunction;
|
|
64
|
+
function listAllFunctions(options) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
const allFunctions = [];
|
|
67
|
+
let currentOffset = 0;
|
|
68
|
+
const pageSize = 20;
|
|
69
|
+
const { envId } = options;
|
|
70
|
+
console.log(`这是listAllFunctions函数,envId: ${envId}`);
|
|
71
|
+
while (true) {
|
|
72
|
+
try {
|
|
73
|
+
const res = yield scfService.request('ListFunctions', {
|
|
74
|
+
Namespace: envId,
|
|
75
|
+
Limit: pageSize,
|
|
76
|
+
Offset: currentOffset
|
|
77
|
+
});
|
|
78
|
+
const { Functions = [], TotalCount } = res;
|
|
79
|
+
if (Functions.length === 0) {
|
|
80
|
+
break;
|
|
81
|
+
}
|
|
82
|
+
allFunctions.push(...Functions);
|
|
83
|
+
if (allFunctions.length >= TotalCount || Functions.length < pageSize) {
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
currentOffset += pageSize;
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
throw new error_1.CloudBaseError(`获取函数列表失败: ${error.message}`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const data = [];
|
|
93
|
+
allFunctions.forEach(func => {
|
|
94
|
+
const { FunctionId, FunctionName, Runtime, AddTime, ModTime, Status } = func;
|
|
95
|
+
data.push({
|
|
96
|
+
FunctionId,
|
|
97
|
+
FunctionName,
|
|
98
|
+
Runtime,
|
|
99
|
+
AddTime,
|
|
100
|
+
ModTime,
|
|
101
|
+
Status
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
return data;
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
exports.listAllFunctions = listAllFunctions;
|
|
64
108
|
function getFunctionDetail(options) {
|
|
65
109
|
return __awaiter(this, void 0, void 0, function* () {
|
|
66
110
|
const { functionName, envId, codeSecret } = options;
|
package/package.json
CHANGED
package/types/function/base.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export interface IDetailOptions extends IBaseOptions {
|
|
|
17
17
|
}
|
|
18
18
|
export declare function getFunctionService(envId: string): Promise<import("@cloudbase/manager-node/types/function").FunctionService>;
|
|
19
19
|
export declare function listFunction(options: IListFunctionOptions): Promise<Record<string, string>[]>;
|
|
20
|
+
export declare function listAllFunctions(options: IListFunctionOptions): Promise<Record<string, string>[]>;
|
|
20
21
|
export declare function getFunctionDetail(options: IDetailOptions): Promise<Record<string, any>>;
|
|
21
22
|
export declare function batchGetFunctionsDetail({ names, envId, codeSecret }: {
|
|
22
23
|
names: any;
|