@cloudbase/cli 2.10.0-beta.0 → 2.11.0-beta.0
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/auth/login.js +51 -65
- package/lib/auth/logout.js +3 -14
- package/lib/commands/account/login.js +136 -149
- package/lib/commands/account/logout.js +3 -14
- package/lib/commands/ag/base.js +203 -0
- package/lib/commands/ag/create.js +301 -0
- package/lib/commands/ag/debug/index.html +699 -0
- package/lib/commands/ag/delete.js +200 -0
- package/lib/commands/ag/deploy.js +185 -0
- package/lib/commands/ag/detail.js +113 -0
- package/lib/commands/ag/index.js +22 -0
- package/lib/commands/ag/list.js +155 -0
- package/lib/commands/ag/run.js +644 -0
- package/lib/commands/ai/index.js +76 -95
- package/lib/commands/cloudfunction/base.js +182 -203
- package/lib/commands/cloudrun/base.js +578 -603
- package/lib/commands/common.js +48 -63
- package/lib/commands/config/delete.js +16 -27
- package/lib/commands/config/get.js +13 -24
- package/lib/commands/config/list.js +16 -27
- package/lib/commands/config/set.js +33 -44
- package/lib/commands/db/base.js +221 -240
- package/lib/commands/env/base.js +36 -49
- package/lib/commands/env/domain.js +79 -94
- package/lib/commands/env/login.js +120 -135
- package/lib/commands/framework/index.js +32 -49
- package/lib/commands/fun/base.js +223 -244
- package/lib/commands/functions/alias/getRoute.js +33 -44
- package/lib/commands/functions/alias/setRoute.js +36 -47
- package/lib/commands/functions/code-download.js +43 -54
- package/lib/commands/functions/code-update.js +23 -34
- package/lib/commands/functions/concurrency/delete.js +11 -22
- package/lib/commands/functions/concurrency/list.js +20 -31
- package/lib/commands/functions/concurrency/set.js +13 -24
- package/lib/commands/functions/config-update.js +30 -41
- package/lib/commands/functions/copy.js +12 -23
- package/lib/commands/functions/delete.js +30 -41
- package/lib/commands/functions/deploy.js +184 -202
- package/lib/commands/functions/detail.js +23 -34
- package/lib/commands/functions/invoke.js +69 -75
- package/lib/commands/functions/layer/bind.js +102 -105
- package/lib/commands/functions/layer/create.js +29 -35
- package/lib/commands/functions/layer/delete.js +42 -48
- package/lib/commands/functions/layer/download.js +52 -58
- package/lib/commands/functions/layer/list.js +44 -50
- package/lib/commands/functions/layer/sort.js +39 -45
- package/lib/commands/functions/list.js +25 -36
- package/lib/commands/functions/log.js +65 -73
- package/lib/commands/functions/run.js +118 -116
- package/lib/commands/functions/trigger-create.js +32 -43
- package/lib/commands/functions/trigger-delete.js +50 -61
- package/lib/commands/functions/version/list.js +29 -40
- package/lib/commands/functions/version/publish.js +11 -22
- package/lib/commands/gateway/create.js +50 -61
- package/lib/commands/gateway/delete.js +38 -49
- package/lib/commands/gateway/domain.js +65 -80
- package/lib/commands/gateway/list.js +31 -42
- package/lib/commands/gateway/switch.js +48 -61
- package/lib/commands/helpers/init.js +226 -249
- package/lib/commands/helpers/new.js +35 -46
- package/lib/commands/helpers/open.js +22 -33
- package/lib/commands/hosting/hosting.js +157 -178
- package/lib/commands/index.js +1 -0
- package/lib/commands/lowcode/app.js +114 -144
- package/lib/commands/lowcode/comps.js +136 -127
- package/lib/commands/lowcode/utils.js +11 -22
- package/lib/commands/pull/pull.js +33 -46
- package/lib/commands/run/delete.js +35 -46
- package/lib/commands/run/image/delete.js +32 -39
- package/lib/commands/run/image/download.js +26 -33
- package/lib/commands/run/image/list.js +41 -48
- package/lib/commands/run/image/upload.js +26 -33
- package/lib/commands/run/list.js +32 -43
- package/lib/commands/run/service/config.js +17 -28
- package/lib/commands/run/service/deploy.js +15 -26
- package/lib/commands/run/service/list.js +48 -59
- package/lib/commands/run/service/update.js +7 -18
- package/lib/commands/run/standalonegateway/create.js +35 -42
- package/lib/commands/run/standalonegateway/destroy.js +23 -30
- package/lib/commands/run/standalonegateway/list.js +19 -26
- package/lib/commands/run/standalonegateway/package.js +31 -38
- package/lib/commands/run/standalonegateway/turn.js +27 -34
- package/lib/commands/run/version/create.js +198 -205
- package/lib/commands/run/version/delete.js +31 -38
- package/lib/commands/run/version/list.js +42 -49
- package/lib/commands/run/version/modify.js +27 -34
- package/lib/commands/run/version/update.js +201 -208
- package/lib/commands/runf/base.js +216 -237
- package/lib/commands/self-update.js +59 -72
- package/lib/commands/smart.js +66 -79
- package/lib/commands/storage/storage.js +192 -219
- package/lib/commands/third/thirdAttach.js +16 -27
- package/lib/commands/utils.js +119 -149
- package/lib/db/index.js +48 -67
- package/lib/decorators/captureError.js +10 -21
- package/lib/decorators/guard.js +11 -22
- package/lib/decorators/injectParams.js +29 -40
- package/lib/decorators/params/common.js +5 -2
- package/lib/decorators/params/index.js +3 -12
- package/lib/env/domain.js +13 -28
- package/lib/env/index.js +25 -44
- package/lib/env/login.js +30 -45
- package/lib/function/alias.js +31 -44
- package/lib/function/base.js +187 -215
- package/lib/function/code.js +8 -19
- package/lib/function/concurrency.js +43 -58
- package/lib/function/create.js +43 -53
- package/lib/function/delete.js +22 -35
- package/lib/function/layer/attach.js +33 -46
- package/lib/function/layer/create.js +34 -45
- package/lib/function/layer/delete.js +5 -16
- package/lib/function/layer/download.js +11 -22
- package/lib/function/layer/list.js +12 -25
- package/lib/function/layer/sort.js +6 -17
- package/lib/function/trigger.js +65 -82
- package/lib/function/update.js +24 -32
- package/lib/function/version.js +29 -42
- package/lib/function/vpc.js +12 -25
- package/lib/gateway/index.js +77 -104
- package/lib/hosting.js +157 -188
- package/lib/run/delete.js +3 -12
- package/lib/run/image/build.js +6 -15
- package/lib/run/image/delete.js +3 -12
- package/lib/run/image/info.js +3 -12
- package/lib/run/image/list.js +6 -15
- package/lib/run/list.js +19 -30
- package/lib/run/repo.js +6 -15
- package/lib/run/service/common.js +160 -173
- package/lib/run/service/config.js +44 -57
- package/lib/run/service/deployPackage.js +33 -44
- package/lib/run/service/list.js +8 -14
- package/lib/run/service/showLogs.js +69 -90
- package/lib/run/service/update.js +50 -63
- package/lib/run/standalonegateway/create.js +3 -12
- package/lib/run/standalonegateway/destroy.js +3 -12
- package/lib/run/standalonegateway/list.js +3 -12
- package/lib/run/standalonegateway/package/list.js +3 -12
- package/lib/run/standalonegateway/turn/off.js +3 -12
- package/lib/run/standalonegateway/turn/on.js +3 -12
- package/lib/run/version/create.js +41 -31
- package/lib/run/version/delete.js +3 -12
- package/lib/run/version/list.js +3 -12
- package/lib/run/version/modify.js +3 -12
- package/lib/run/version/repo.js +6 -15
- package/lib/run/version/update.js +37 -26
- package/lib/storage.js +62 -93
- package/lib/third/index.js +6 -17
- package/lib/utils/ai/banner.js +49 -60
- package/lib/utils/ai/claudeWindows.js +2 -2
- package/lib/utils/ai/config.js +169 -206
- package/lib/utils/ai/ensureFiles.js +6 -17
- package/lib/utils/ai/env.js +16 -27
- package/lib/utils/ai/envLocalManager.js +35 -52
- package/lib/utils/ai/router.js +927 -1005
- package/lib/utils/ai/setup.js +527 -563
- package/lib/utils/auth.js +3 -14
- package/lib/utils/checkTcbrEnv.js +20 -31
- package/lib/utils/cli-table.js +6 -1
- package/lib/utils/config.js +4 -13
- package/lib/utils/dts.js +98 -113
- package/lib/utils/env.js +154 -175
- package/lib/utils/function-packer.js +29 -42
- package/lib/utils/log.js +10 -21
- package/lib/utils/mcp-config-modifier.js +105 -120
- package/lib/utils/net/cloud-api-request.js +15 -23
- package/lib/utils/net/credential.js +26 -39
- package/lib/utils/net/http-request.js +63 -80
- package/lib/utils/net/manager-service.js +22 -35
- package/lib/utils/notice.js +16 -27
- package/lib/utils/output/loading.js +3 -12
- package/lib/utils/parallel.js +32 -43
- package/lib/utils/platform/mac.js +4 -15
- package/lib/utils/platform/port.js +4 -15
- package/lib/utils/prompt/select.js +6 -15
- package/lib/utils/report.js +28 -33
- package/lib/utils/reporter/agree.js +11 -22
- package/lib/utils/reporter/download.js +17 -28
- package/lib/utils/reporter/usage.js +12 -23
- package/lib/utils/store/auth.js +17 -30
- package/lib/utils/store/config.js +11 -25
- package/lib/utils/store/db.js +17 -36
- package/lib/utils/tcbrApi/callTcbrApi.js +19 -28
- package/lib/utils/template-manager.js +215 -242
- package/lib/utils/template.js +81 -96
- package/lib/utils/tools/common.js +45 -56
- package/lib/utils/tools/time.js +5 -16
- package/lib/utils/url.js +10 -4
- package/package.json +2 -2
- package/specs/ag-command/design.md +421 -0
- package/specs/ag-command/doc.md +204 -0
- package/specs/ag-command/requirements.md +173 -0
- package/specs/ag-command/summary.md +174 -0
- package/specs/ag-command/tasks.md +197 -0
- package/specs/ag-command/usage-guide.md +420 -0
- package/tsconfig.json +1 -1
- package/types/commands/ag/base.d.ts +44 -0
- package/types/commands/ag/create.d.ts +25 -0
- package/types/commands/ag/delete.d.ts +32 -0
- package/types/commands/ag/deploy.d.ts +31 -0
- package/types/commands/ag/detail.d.ts +28 -0
- package/types/commands/ag/index.d.ts +6 -0
- package/types/commands/ag/list.d.ts +35 -0
- package/types/commands/ag/run.d.ts +52 -0
- package/types/commands/cloudrun/base.d.ts +10 -0
- package/types/commands/index.d.ts +1 -0
|
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
15
|
exports.setFunctionRoutingConfig = void 0;
|
|
25
16
|
const common_1 = require("../../common");
|
|
@@ -42,49 +33,47 @@ let setFunctionRoutingConfig = class setFunctionRoutingConfig extends common_1.C
|
|
|
42
33
|
desc: (0, i18n_1.t)('设置函数版本流量配置')
|
|
43
34
|
};
|
|
44
35
|
}
|
|
45
|
-
execute(ctx, params) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (traffic1
|
|
56
|
-
|
|
57
|
-
throw new error_1.CloudBaseError((0, i18n_1.t)('traffic1 和 traffic2 同时设置时,需保证总和 100'));
|
|
58
|
-
}
|
|
36
|
+
async execute(ctx, params) {
|
|
37
|
+
const name = params === null || params === void 0 ? void 0 : params[0];
|
|
38
|
+
const version1 = params === null || params === void 0 ? void 0 : params[1];
|
|
39
|
+
const traffic1 = Number(params === null || params === void 0 ? void 0 : params[2]);
|
|
40
|
+
const version2 = params === null || params === void 0 ? void 0 : params[3];
|
|
41
|
+
const traffic2 = Number(params === null || params === void 0 ? void 0 : params[4]);
|
|
42
|
+
if ((version2 === undefined && traffic2 !== undefined) || (version2 !== undefined && traffic2 === undefined)) {
|
|
43
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('version2 和 traffic2 必须同时设置'));
|
|
44
|
+
}
|
|
45
|
+
if (traffic1 !== undefined && traffic2 !== undefined) {
|
|
46
|
+
if (traffic1 + traffic2 !== 100) {
|
|
47
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('traffic1 和 traffic2 同时设置时,需保证总和 100'));
|
|
59
48
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
Method: "range",
|
|
68
|
-
Version: version1
|
|
69
|
-
}]
|
|
70
|
-
};
|
|
71
|
-
if (version2 !== undefined) {
|
|
72
|
-
routingConfigParams.AddtionVersionMatchs.push({
|
|
73
|
-
Expression: `[${traffic1},${100})`,
|
|
49
|
+
}
|
|
50
|
+
const { envId } = ctx;
|
|
51
|
+
const loading = (0, utils_1.loadingFactory)();
|
|
52
|
+
loading.start((0, i18n_1.t)('设置函数 [{{name}}] 版本流量配置中...', { name }));
|
|
53
|
+
let routingConfigParams = {
|
|
54
|
+
AddtionVersionMatchs: [{
|
|
55
|
+
Expression: `[0,${traffic1})`,
|
|
74
56
|
Key: "invoke.headers.X-Tcb-Route-Key",
|
|
75
57
|
Method: "range",
|
|
76
|
-
Version:
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
58
|
+
Version: version1
|
|
59
|
+
}]
|
|
60
|
+
};
|
|
61
|
+
if (version2 !== undefined) {
|
|
62
|
+
routingConfigParams.AddtionVersionMatchs.push({
|
|
63
|
+
Expression: `[${traffic1},${100})`,
|
|
64
|
+
Key: "invoke.headers.X-Tcb-Route-Key",
|
|
65
|
+
Method: "range",
|
|
66
|
+
Version: version2
|
|
85
67
|
});
|
|
86
|
-
|
|
68
|
+
}
|
|
69
|
+
await (0, function_1.setFunctionAliasConfig)({
|
|
70
|
+
envId,
|
|
71
|
+
functionName: name,
|
|
72
|
+
name: '$DEFAULT',
|
|
73
|
+
functionVersion: '$LATEST',
|
|
74
|
+
routingConfig: routingConfigParams
|
|
87
75
|
});
|
|
76
|
+
loading.succeed((0, i18n_1.t)('设置函数 [{{name}}] 版本流量配置成功!', { name }));
|
|
88
77
|
}
|
|
89
78
|
};
|
|
90
79
|
__decorate([
|
|
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
14
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
24
15
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
25
16
|
};
|
|
@@ -58,55 +49,53 @@ let CodeDownload = class CodeDownload extends common_1.Command {
|
|
|
58
49
|
desc: (0, i18n_1.t)('下载云函数代码')
|
|
59
50
|
};
|
|
60
51
|
}
|
|
61
|
-
execute(ctx, params) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}));
|
|
80
|
-
}
|
|
81
|
-
return;
|
|
52
|
+
async execute(ctx, params) {
|
|
53
|
+
const { envId, config, options } = ctx;
|
|
54
|
+
const { codeSecret } = options;
|
|
55
|
+
const name = params === null || params === void 0 ? void 0 : params[0];
|
|
56
|
+
const dest = params === null || params === void 0 ? void 0 : params[1];
|
|
57
|
+
if (!name) {
|
|
58
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('请指定云函数名称!'));
|
|
59
|
+
}
|
|
60
|
+
const functionService = await (0, function_1.getFunctionService)(envId);
|
|
61
|
+
try {
|
|
62
|
+
await functionService.getFunctionDetail(name, codeSecret);
|
|
63
|
+
}
|
|
64
|
+
catch (e) {
|
|
65
|
+
if (e.code === 'ResourceNotFound.FunctionName') {
|
|
66
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('云函数 [{{name}}] 不存在!\n\n使用 {{command}} 命令查看已部署云函数', {
|
|
67
|
+
name,
|
|
68
|
+
command: (0, utils_1.highlightCommand)('cloudbase functions:list')
|
|
69
|
+
}));
|
|
82
70
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
(0,
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
let destPath = dest;
|
|
74
|
+
if (!destPath) {
|
|
75
|
+
destPath = path_1.default.resolve(config.functionRoot, name);
|
|
76
|
+
if ((0, utils_1.checkFullAccess)(destPath)) {
|
|
77
|
+
const { override } = await inquirer_1.default.prompt({
|
|
78
|
+
type: 'confirm',
|
|
79
|
+
name: 'override',
|
|
80
|
+
message: (0, i18n_1.t)('函数已经存在,是否覆盖原文件?'),
|
|
81
|
+
default: false
|
|
82
|
+
});
|
|
83
|
+
if (!override) {
|
|
84
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('下载终止!'));
|
|
97
85
|
}
|
|
98
|
-
|
|
86
|
+
(0, utils_1.delSync)([destPath]);
|
|
99
87
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
88
|
+
await fs_extra_1.default.ensureDir(destPath);
|
|
89
|
+
}
|
|
90
|
+
const loading = (0, utils_1.loadingFactory)();
|
|
91
|
+
loading.start((0, i18n_1.t)('文件下载中...'));
|
|
92
|
+
await functionService.downloadFunctionCode({
|
|
93
|
+
envId,
|
|
94
|
+
functionName: name,
|
|
95
|
+
destPath: destPath,
|
|
96
|
+
codeSecret: codeSecret
|
|
109
97
|
});
|
|
98
|
+
loading.succeed((0, i18n_1.t)('[{{name}}] 云函数代码下载成功!', { name }));
|
|
110
99
|
}
|
|
111
100
|
};
|
|
112
101
|
__decorate([
|
|
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
14
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
24
15
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
25
16
|
};
|
|
@@ -55,31 +46,29 @@ let CodeUpdate = class CodeUpdate extends common_1.Command {
|
|
|
55
46
|
desc: (0, i18n_1.t)('更新云函数代码')
|
|
56
47
|
};
|
|
57
48
|
}
|
|
58
|
-
execute(ctx, params) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
});
|
|
49
|
+
async execute(ctx, params) {
|
|
50
|
+
const { envId, config, options } = ctx;
|
|
51
|
+
const { codeSecret } = options;
|
|
52
|
+
const name = params === null || params === void 0 ? void 0 : params[0];
|
|
53
|
+
if (!name) {
|
|
54
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('请指定云函数名称!'));
|
|
55
|
+
}
|
|
56
|
+
const func = config.functions.find((item) => item.name === name) || { name };
|
|
57
|
+
const loading = (0, utils_1.loadingFactory)();
|
|
58
|
+
loading.start((0, i18n_1.t)('[{{name}}] 函数代码更新中...', { name: func.name }));
|
|
59
|
+
try {
|
|
60
|
+
await (0, function_1.updateFunctionCode)({
|
|
61
|
+
func,
|
|
62
|
+
envId,
|
|
63
|
+
codeSecret,
|
|
64
|
+
functionRootPath: path_1.default.join(process.cwd(), config.functionRoot)
|
|
65
|
+
});
|
|
66
|
+
loading.succeed((0, i18n_1.t)('[{{name}}] 函数代码更新成功!', { name: func.name }));
|
|
67
|
+
}
|
|
68
|
+
catch (e) {
|
|
69
|
+
loading.stop();
|
|
70
|
+
throw e;
|
|
71
|
+
}
|
|
83
72
|
}
|
|
84
73
|
};
|
|
85
74
|
__decorate([
|
|
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
15
|
exports.deleteProvisionedConcurrency = void 0;
|
|
25
16
|
const common_1 = require("../../common");
|
|
@@ -41,20 +32,18 @@ let deleteProvisionedConcurrency = class deleteProvisionedConcurrency extends co
|
|
|
41
32
|
desc: (0, i18n_1.t)('删除函数版本预置并发配置')
|
|
42
33
|
};
|
|
43
34
|
}
|
|
44
|
-
execute(ctx, params) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
qualifier: version
|
|
55
|
-
});
|
|
56
|
-
loading.succeed((0, i18n_1.t)('删除函数 [{{name}}] 预置并发配置成功!', { name }));
|
|
35
|
+
async execute(ctx, params) {
|
|
36
|
+
const name = params === null || params === void 0 ? void 0 : params[0];
|
|
37
|
+
const version = params === null || params === void 0 ? void 0 : params[1];
|
|
38
|
+
const { envId } = ctx;
|
|
39
|
+
const loading = (0, utils_1.loadingFactory)();
|
|
40
|
+
loading.start((0, i18n_1.t)('删除函数 [{{name}}] 预置并发配置中...', { name }));
|
|
41
|
+
await (0, function_1.deleteProvisionedConcurrencyConfig)({
|
|
42
|
+
envId,
|
|
43
|
+
functionName: name,
|
|
44
|
+
qualifier: version
|
|
57
45
|
});
|
|
46
|
+
loading.succeed((0, i18n_1.t)('删除函数 [{{name}}] 预置并发配置成功!', { name }));
|
|
58
47
|
}
|
|
59
48
|
};
|
|
60
49
|
__decorate([
|
|
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
15
|
exports.getProvisionedConcurrency = void 0;
|
|
25
16
|
const common_1 = require("../../common");
|
|
@@ -42,29 +33,27 @@ let getProvisionedConcurrency = class getProvisionedConcurrency extends common_1
|
|
|
42
33
|
desc: (0, i18n_1.t)('获取函数版本预置并发配置')
|
|
43
34
|
};
|
|
44
35
|
}
|
|
45
|
-
execute(ctx, params, options) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
qualifier: version
|
|
56
|
-
});
|
|
57
|
-
loading.stop();
|
|
58
|
-
const head = [(0, i18n_1.t)('设置并发数'), (0, i18n_1.t)('已完成并发数'), (0, i18n_1.t)('预置任务状态'), (0, i18n_1.t)('状态说明'), (0, i18n_1.t)('版本号')];
|
|
59
|
-
const tableData = res.Allocated.map((item) => [
|
|
60
|
-
item.AllocatedProvisionedConcurrencyNum,
|
|
61
|
-
item.AvailableProvisionedConcurrencyNum,
|
|
62
|
-
constant_1.ConcurrencyTaskStatus[item.Status] || (0, i18n_1.t)('无'),
|
|
63
|
-
item.StatusReason,
|
|
64
|
-
item.Qualifier
|
|
65
|
-
]);
|
|
66
|
-
(0, utils_1.printHorizontalTable)(head, tableData);
|
|
36
|
+
async execute(ctx, params, options) {
|
|
37
|
+
const name = params === null || params === void 0 ? void 0 : params[0];
|
|
38
|
+
const version = params === null || params === void 0 ? void 0 : params[1];
|
|
39
|
+
const { envId } = ctx;
|
|
40
|
+
const loading = (0, utils_1.loadingFactory)();
|
|
41
|
+
loading.start((0, i18n_1.t)('拉取函数 [{{name}}] 预置并发配置中...', { name }));
|
|
42
|
+
const res = await (0, function_1.getProvisionedConcurrencyConfig)({
|
|
43
|
+
envId,
|
|
44
|
+
functionName: name,
|
|
45
|
+
qualifier: version
|
|
67
46
|
});
|
|
47
|
+
loading.stop();
|
|
48
|
+
const head = [(0, i18n_1.t)('设置并发数'), (0, i18n_1.t)('已完成并发数'), (0, i18n_1.t)('预置任务状态'), (0, i18n_1.t)('状态说明'), (0, i18n_1.t)('版本号')];
|
|
49
|
+
const tableData = res.Allocated.map((item) => [
|
|
50
|
+
item.AllocatedProvisionedConcurrencyNum,
|
|
51
|
+
item.AvailableProvisionedConcurrencyNum,
|
|
52
|
+
constant_1.ConcurrencyTaskStatus[item.Status] || (0, i18n_1.t)('无'),
|
|
53
|
+
item.StatusReason,
|
|
54
|
+
item.Qualifier
|
|
55
|
+
]);
|
|
56
|
+
(0, utils_1.printHorizontalTable)(head, tableData);
|
|
68
57
|
}
|
|
69
58
|
};
|
|
70
59
|
__decorate([
|
|
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
15
|
exports.setProvisionedConcurrency = void 0;
|
|
25
16
|
const common_1 = require("../../common");
|
|
@@ -41,22 +32,20 @@ let setProvisionedConcurrency = class setProvisionedConcurrency extends common_1
|
|
|
41
32
|
desc: (0, i18n_1.t)('设置函数版本预置并发')
|
|
42
33
|
};
|
|
43
34
|
}
|
|
44
|
-
execute(ctx, params) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
versionProvisionedConcurrencyNum: concurrency
|
|
57
|
-
});
|
|
58
|
-
loading.succeed((0, i18n_1.t)('配置函数 [{{name}}] 预置并发成功!', { name }));
|
|
35
|
+
async execute(ctx, params) {
|
|
36
|
+
const name = params === null || params === void 0 ? void 0 : params[0];
|
|
37
|
+
const version = params === null || params === void 0 ? void 0 : params[1];
|
|
38
|
+
const concurrency = Number((params === null || params === void 0 ? void 0 : params[2]) || 0);
|
|
39
|
+
const { envId } = ctx;
|
|
40
|
+
const loading = (0, utils_1.loadingFactory)();
|
|
41
|
+
loading.start((0, i18n_1.t)('配置函数 [{{name}}] 预置并发中...', { name }));
|
|
42
|
+
await (0, function_1.setProvisionedConcurrencyConfig)({
|
|
43
|
+
envId,
|
|
44
|
+
functionName: name,
|
|
45
|
+
qualifier: version,
|
|
46
|
+
versionProvisionedConcurrencyNum: concurrency
|
|
59
47
|
});
|
|
48
|
+
loading.succeed((0, i18n_1.t)('配置函数 [{{name}}] 预置并发成功!', { name }));
|
|
60
49
|
}
|
|
61
50
|
};
|
|
62
51
|
__decorate([
|
|
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
14
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
24
15
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
25
16
|
};
|
|
@@ -50,42 +41,40 @@ let ConfigUpdate = class ConfigUpdate extends common_1.Command {
|
|
|
50
41
|
desc: (0, i18n_1.t)('更新云函数配置')
|
|
51
42
|
};
|
|
52
43
|
}
|
|
53
|
-
execute(ctx, params, log) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
throw new error_1.CloudBaseError((0, i18n_1.t)('请指定云函数名称!'));
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
if (isBathUpdate) {
|
|
71
|
-
yield (0, function_1.batchUpdateFunctionConfig)({
|
|
72
|
-
envId,
|
|
73
|
-
functions,
|
|
74
|
-
log: true
|
|
75
|
-
});
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
const functionItem = functions.find((item) => item.name === name);
|
|
79
|
-
if (!functionItem) {
|
|
80
|
-
throw new error_1.CloudBaseError((0, i18n_1.t)('未找到相关函数配置,请检查函数名是否正确'));
|
|
44
|
+
async execute(ctx, params, log) {
|
|
45
|
+
const { envId, config: { functions } } = ctx;
|
|
46
|
+
const name = params === null || params === void 0 ? void 0 : params[0];
|
|
47
|
+
let isBathUpdate = false;
|
|
48
|
+
if (!name) {
|
|
49
|
+
const { isBatch } = await inquirer_1.default.prompt({
|
|
50
|
+
type: 'confirm',
|
|
51
|
+
name: 'isBatch',
|
|
52
|
+
message: (0, i18n_1.t)('无云函数名称,是否需要更新配置文件中的【全部云函数】的配置?'),
|
|
53
|
+
default: false
|
|
54
|
+
});
|
|
55
|
+
isBathUpdate = isBatch;
|
|
56
|
+
if (!isBathUpdate) {
|
|
57
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('请指定云函数名称!'));
|
|
81
58
|
}
|
|
82
|
-
|
|
59
|
+
}
|
|
60
|
+
if (isBathUpdate) {
|
|
61
|
+
await (0, function_1.batchUpdateFunctionConfig)({
|
|
83
62
|
envId,
|
|
84
|
-
|
|
85
|
-
|
|
63
|
+
functions,
|
|
64
|
+
log: true
|
|
86
65
|
});
|
|
87
|
-
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const functionItem = functions.find((item) => item.name === name);
|
|
69
|
+
if (!functionItem) {
|
|
70
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('未找到相关函数配置,请检查函数名是否正确'));
|
|
71
|
+
}
|
|
72
|
+
await (0, function_1.updateFunctionConfig)({
|
|
73
|
+
envId,
|
|
74
|
+
functionName: name,
|
|
75
|
+
config: functionItem
|
|
88
76
|
});
|
|
77
|
+
log.success((0, i18n_1.t)('[{{name}}] 更新云函数配置成功!', { name }));
|
|
89
78
|
}
|
|
90
79
|
};
|
|
91
80
|
__decorate([
|
|
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
15
|
exports.FunctionCopy = void 0;
|
|
25
16
|
const common_1 = require("../common");
|
|
@@ -50,20 +41,18 @@ let FunctionCopy = class FunctionCopy extends common_1.Command {
|
|
|
50
41
|
desc: (0, i18n_1.t)('拷贝云函数')
|
|
51
42
|
};
|
|
52
43
|
}
|
|
53
|
-
execute(envId, options, params, log) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
log.success((0, i18n_1.t)('拷贝函数成功'));
|
|
66
|
-
});
|
|
44
|
+
async execute(envId, options, params, log) {
|
|
45
|
+
const name = params === null || params === void 0 ? void 0 : params[0];
|
|
46
|
+
let newFunctionName = params === null || params === void 0 ? void 0 : params[1];
|
|
47
|
+
let { force, codeSecret, targetEnvId } = options;
|
|
48
|
+
if (!name) {
|
|
49
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('请指定函数名称!'));
|
|
50
|
+
}
|
|
51
|
+
const functionService = await (0, function_1.getFunctionService)(envId);
|
|
52
|
+
newFunctionName = newFunctionName || name;
|
|
53
|
+
targetEnvId = targetEnvId || envId;
|
|
54
|
+
await functionService.copyFunction(name, newFunctionName, targetEnvId, force);
|
|
55
|
+
log.success((0, i18n_1.t)('拷贝函数成功'));
|
|
67
56
|
}
|
|
68
57
|
};
|
|
69
58
|
__decorate([
|