@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.CreateService = void 0;
|
|
25
16
|
const enquirer_1 = require("enquirer");
|
|
@@ -54,61 +45,59 @@ let CreateService = class CreateService extends common_1.Command {
|
|
|
54
45
|
desc: (0, i18n_1.t)('创建 HTTP 访问服务')
|
|
55
46
|
};
|
|
56
47
|
}
|
|
57
|
-
execute(envId, options) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
throw new error_1.CloudBaseError((0, i18n_1.t)('当前环境下不存在可用的云函数,请先创建云函数!'));
|
|
68
|
-
}
|
|
69
|
-
let { name } = yield (0, enquirer_1.prompt)({
|
|
70
|
-
type: 'select',
|
|
71
|
-
name: 'name',
|
|
72
|
-
message: (0, i18n_1.t)('请选择创建HTTP 访问服务的云函数'),
|
|
73
|
-
choices: functions.map((item) => item.FunctionName)
|
|
74
|
-
});
|
|
75
|
-
let { path } = yield (0, enquirer_1.prompt)({
|
|
76
|
-
type: 'input',
|
|
77
|
-
name: 'path',
|
|
78
|
-
message: (0, i18n_1.t)('请输入HTTP 访问服务路径')
|
|
79
|
-
});
|
|
80
|
-
functionName = name;
|
|
81
|
-
servicePath = path;
|
|
48
|
+
async execute(envId, options) {
|
|
49
|
+
const functionsService = await (0, function_1.getFunctionService)(envId);
|
|
50
|
+
let { function: functionName, servicePath } = options;
|
|
51
|
+
const loading = (0, utils_1.loadingFactory)();
|
|
52
|
+
if (!servicePath || !functionName) {
|
|
53
|
+
loading.start((0, i18n_1.t)('数据加载中...'));
|
|
54
|
+
const functions = await functionsService.listFunctions(100, 0);
|
|
55
|
+
loading.stop();
|
|
56
|
+
if (!functions.length) {
|
|
57
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('当前环境下不存在可用的云函数,请先创建云函数!'));
|
|
82
58
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
59
|
+
let { name } = await (0, enquirer_1.prompt)({
|
|
60
|
+
type: 'select',
|
|
61
|
+
name: 'name',
|
|
62
|
+
message: (0, i18n_1.t)('请选择创建HTTP 访问服务的云函数'),
|
|
63
|
+
choices: functions.map((item) => item.FunctionName)
|
|
64
|
+
});
|
|
65
|
+
let { path } = await (0, enquirer_1.prompt)({
|
|
66
|
+
type: 'input',
|
|
67
|
+
name: 'path',
|
|
68
|
+
message: (0, i18n_1.t)('请输入HTTP 访问服务路径')
|
|
69
|
+
});
|
|
70
|
+
functionName = name;
|
|
71
|
+
servicePath = path;
|
|
72
|
+
}
|
|
73
|
+
(0, validator_1.assertTruthy)(servicePath, (0, i18n_1.t)('请指定需要创建的HTTP 访问服务路径!'));
|
|
74
|
+
loading.start((0, i18n_1.t)('[{{functionName}}] HTTP 访问服务创建中...', { functionName }));
|
|
75
|
+
servicePath = servicePath[0] === '/' ? servicePath : `/${servicePath}`;
|
|
76
|
+
try {
|
|
77
|
+
const functionList = await (0, function_1.listFunction)({
|
|
78
|
+
envId,
|
|
79
|
+
limit: 100
|
|
80
|
+
});
|
|
81
|
+
const isExisted = functionList.filter((item) => item.FunctionName === functionName);
|
|
82
|
+
if (isExisted.length <= 0) {
|
|
83
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('[{{functionName}}] 云函数不存在!', { functionName }));
|
|
103
84
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
85
|
+
await (0, gateway_1.createGateway)({
|
|
86
|
+
envId,
|
|
87
|
+
path: servicePath,
|
|
88
|
+
name: functionName
|
|
89
|
+
});
|
|
90
|
+
const res = await (0, gateway_1.queryGatewayDomain)({ envId });
|
|
91
|
+
const link = (0, utils_1.genClickableLink)(`https://${res.DefaultDomain}${servicePath}`);
|
|
92
|
+
loading.succeed((0, i18n_1.t)('HTTP 访问服务创建成功!\n点击访问> {{link}}', { link }));
|
|
93
|
+
}
|
|
94
|
+
catch (e) {
|
|
95
|
+
loading.stop();
|
|
96
|
+
if (e.code === 'InvalidParameter.APICreated') {
|
|
97
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('路径已存在!'));
|
|
110
98
|
}
|
|
111
|
-
|
|
99
|
+
throw e;
|
|
100
|
+
}
|
|
112
101
|
}
|
|
113
102
|
};
|
|
114
103
|
__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.DeleteServiceCommand = void 0;
|
|
25
16
|
const enquirer_1 = require("enquirer");
|
|
@@ -55,46 +46,44 @@ let DeleteServiceCommand = class DeleteServiceCommand extends common_1.Command {
|
|
|
55
46
|
desc: (0, i18n_1.t)('删除 HTTP 访问服务')
|
|
56
47
|
};
|
|
57
48
|
}
|
|
58
|
-
execute(envId, options) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
});
|
|
49
|
+
async execute(envId, options) {
|
|
50
|
+
let { servicePath, serviceId, name } = options;
|
|
51
|
+
if (!servicePath && !serviceId && (!name || typeof name !== 'string')) {
|
|
52
|
+
const { APISet: allServices } = await (0, gateway_1.queryGateway)({
|
|
53
|
+
envId
|
|
54
|
+
});
|
|
55
|
+
const { selected } = await (0, enquirer_1.prompt)({
|
|
56
|
+
type: 'select',
|
|
57
|
+
name: 'selected',
|
|
58
|
+
message: (0, i18n_1.t)('请选择需要删除的 Service'),
|
|
59
|
+
choices: allServices.map((item) => ({
|
|
60
|
+
name: (0, i18n_1.t)('函数名:{{name}}/路径:{{path}}', { name: item.Name, path: item.Path }),
|
|
61
|
+
value: item.APIId
|
|
62
|
+
})),
|
|
63
|
+
result(choices) {
|
|
64
|
+
return Object.values(this.map(choices));
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
serviceId = selected === null || selected === void 0 ? void 0 : selected[0];
|
|
68
|
+
}
|
|
69
|
+
if (servicePath) {
|
|
70
|
+
servicePath = servicePath[0] === '/' ? servicePath : `/${servicePath}`;
|
|
71
|
+
}
|
|
72
|
+
const loading = (0, utils_1.loadingFactory)();
|
|
73
|
+
loading.start((0, i18n_1.t)('HTTP 访问服务删除中...'));
|
|
74
|
+
try {
|
|
75
|
+
await (0, gateway_1.deleteGateway)({
|
|
76
|
+
envId,
|
|
77
|
+
name,
|
|
78
|
+
path: servicePath,
|
|
79
|
+
gatewayId: serviceId
|
|
80
|
+
});
|
|
81
|
+
loading.succeed((0, i18n_1.t)('HTTP 访问服务删除成功!'));
|
|
82
|
+
}
|
|
83
|
+
catch (e) {
|
|
84
|
+
loading.stop();
|
|
85
|
+
throw e;
|
|
86
|
+
}
|
|
98
87
|
}
|
|
99
88
|
};
|
|
100
89
|
__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.UnbindCustomDomainCommand = exports.GetCustomDomainsCommand = exports.BindCustomDomainCommand = void 0;
|
|
25
16
|
const common_1 = require("../common");
|
|
@@ -51,27 +42,25 @@ class BindCustomDomainCommand extends common_1.Command {
|
|
|
51
42
|
desc: (0, i18n_1.t)('绑定自定义HTTP 访问服务域名')
|
|
52
43
|
};
|
|
53
44
|
}
|
|
54
|
-
execute(envId, params) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
});
|
|
45
|
+
async execute(envId, params) {
|
|
46
|
+
const domain = params === null || params === void 0 ? void 0 : params[0];
|
|
47
|
+
console.log(domain);
|
|
48
|
+
if (!domain) {
|
|
49
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('请指定需要绑定的HTTP 访问服务域名!'));
|
|
50
|
+
}
|
|
51
|
+
const loading = (0, utils_1.loadingFactory)();
|
|
52
|
+
loading.start((0, i18n_1.t)('HTTP 访问服务域名 [{{domain}}] 绑定中...', { domain }));
|
|
53
|
+
try {
|
|
54
|
+
await (0, gateway_1.bindGatewayDomain)({
|
|
55
|
+
envId,
|
|
56
|
+
domain
|
|
57
|
+
});
|
|
58
|
+
loading.succeed((0, i18n_1.t)('HTTP 访问服务域名[{{domain}}] 绑定成功!', { domain }));
|
|
59
|
+
}
|
|
60
|
+
catch (e) {
|
|
61
|
+
loading.stop();
|
|
62
|
+
throw e;
|
|
63
|
+
}
|
|
75
64
|
}
|
|
76
65
|
}
|
|
77
66
|
__decorate([
|
|
@@ -103,38 +92,36 @@ let GetCustomDomainsCommand = class GetCustomDomainsCommand extends common_1.Com
|
|
|
103
92
|
desc: (0, i18n_1.t)('查询 HTTP 访问服务自定义域名')
|
|
104
93
|
};
|
|
105
94
|
}
|
|
106
|
-
execute(envId, options, log) {
|
|
95
|
+
async execute(envId, options, log) {
|
|
107
96
|
var _a;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
const head = [(0, i18n_1.t)('域名'), (0, i18n_1.t)('状态'), (0, i18n_1.t)('创建时间')];
|
|
126
|
-
const tableData = res.ServiceSet.map((item) => [
|
|
127
|
-
item.Domain,
|
|
128
|
-
SERVICE_STATUS_MAP[item.Status],
|
|
129
|
-
(0, utils_1.formatDate)(item.OpenTime * 1000, 'yyyy-MM-dd hh:mm:ss')
|
|
130
|
-
]);
|
|
131
|
-
(0, utils_1.printHorizontalTable)(head, tableData);
|
|
132
|
-
}
|
|
133
|
-
catch (e) {
|
|
134
|
-
loading.stop();
|
|
135
|
-
throw e;
|
|
97
|
+
const { domain: domainName } = options;
|
|
98
|
+
if (!envId && !domainName) {
|
|
99
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('请指定需要查询的环境 ID 或HTTP 访问服务域名!'));
|
|
100
|
+
}
|
|
101
|
+
const loading = (0, utils_1.loadingFactory)();
|
|
102
|
+
loading.start((0, i18n_1.t)('查询HTTP 访问服务域名中...'));
|
|
103
|
+
try {
|
|
104
|
+
const res = await (0, gateway_1.queryGatewayDomain)({
|
|
105
|
+
envId,
|
|
106
|
+
domain: domainName
|
|
107
|
+
});
|
|
108
|
+
loading.succeed((0, i18n_1.t)('查询HTTP 访问服务域名成功!'));
|
|
109
|
+
if (!((_a = res === null || res === void 0 ? void 0 : res.ServiceSet) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
110
|
+
log.info((0, i18n_1.t)('HTTP 访问服务域名为空!'));
|
|
111
|
+
return;
|
|
136
112
|
}
|
|
137
|
-
|
|
113
|
+
const head = [(0, i18n_1.t)('域名'), (0, i18n_1.t)('状态'), (0, i18n_1.t)('创建时间')];
|
|
114
|
+
const tableData = res.ServiceSet.map((item) => [
|
|
115
|
+
item.Domain,
|
|
116
|
+
SERVICE_STATUS_MAP[item.Status],
|
|
117
|
+
(0, utils_1.formatDate)(item.OpenTime * 1000, 'yyyy-MM-dd hh:mm:ss')
|
|
118
|
+
]);
|
|
119
|
+
(0, utils_1.printHorizontalTable)(head, tableData);
|
|
120
|
+
}
|
|
121
|
+
catch (e) {
|
|
122
|
+
loading.stop();
|
|
123
|
+
throw e;
|
|
124
|
+
}
|
|
138
125
|
}
|
|
139
126
|
};
|
|
140
127
|
__decorate([
|
|
@@ -166,26 +153,24 @@ let UnbindCustomDomainCommand = class UnbindCustomDomainCommand extends common_1
|
|
|
166
153
|
desc: (0, i18n_1.t)('解绑自定义HTTP 访问服务域名')
|
|
167
154
|
};
|
|
168
155
|
}
|
|
169
|
-
execute(envId, params) {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
}
|
|
188
|
-
});
|
|
156
|
+
async execute(envId, params) {
|
|
157
|
+
const domain = params === null || params === void 0 ? void 0 : params[0];
|
|
158
|
+
if (!domain) {
|
|
159
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('请指定需要解绑的HTTP 访问服务域名!'));
|
|
160
|
+
}
|
|
161
|
+
const loading = (0, utils_1.loadingFactory)();
|
|
162
|
+
loading.start((0, i18n_1.t)('HTTP Service域名 [{{domain}}] 解绑中...', { domain }));
|
|
163
|
+
try {
|
|
164
|
+
await (0, gateway_1.unbindGatewayDomain)({
|
|
165
|
+
envId,
|
|
166
|
+
domain
|
|
167
|
+
});
|
|
168
|
+
loading.succeed((0, i18n_1.t)('HTTP Service域名 [{{domain}}] 解绑成功!', { domain }));
|
|
169
|
+
}
|
|
170
|
+
catch (e) {
|
|
171
|
+
loading.stop();
|
|
172
|
+
throw e;
|
|
173
|
+
}
|
|
189
174
|
}
|
|
190
175
|
};
|
|
191
176
|
__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.ListServiceCommand = void 0;
|
|
25
16
|
const common_1 = require("../common");
|
|
@@ -55,41 +46,39 @@ let ListServiceCommand = class ListServiceCommand extends common_1.Command {
|
|
|
55
46
|
desc: (0, i18n_1.t)('获取 HTTP 访问服务列表')
|
|
56
47
|
};
|
|
57
48
|
}
|
|
58
|
-
execute(envId, options, log) {
|
|
49
|
+
async execute(envId, options, log) {
|
|
59
50
|
var _a;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
const head = [(0, i18n_1.t)('触发路径'), (0, i18n_1.t)('关联资源'), (0, i18n_1.t)('触发类型'), (0, i18n_1.t)('创建时间')];
|
|
80
|
-
const tableData = res.APISet.map((item) => [
|
|
81
|
-
item.Path,
|
|
82
|
-
item.Name,
|
|
83
|
-
item.Type === 1 ? (0, i18n_1.t)('云函数') : (0, i18n_1.t)('云托管'),
|
|
84
|
-
(0, utils_1.formatDate)(item.CreateTime * 1000, 'yyyy-MM-dd hh:mm:ss')
|
|
85
|
-
]);
|
|
86
|
-
(0, utils_1.printHorizontalTable)(head, tableData);
|
|
87
|
-
}
|
|
88
|
-
catch (e) {
|
|
89
|
-
loading.stop();
|
|
90
|
-
throw e;
|
|
51
|
+
const { domain: domainName, servicePath, serviceId } = options;
|
|
52
|
+
if (!envId && !domainName) {
|
|
53
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('请指定需要查询的环境 ID 或HTTP 访问服务自定义域名!'));
|
|
54
|
+
}
|
|
55
|
+
const loading = (0, utils_1.loadingFactory)();
|
|
56
|
+
loading.start((0, i18n_1.t)('查询HTTP 访问服务中...'));
|
|
57
|
+
try {
|
|
58
|
+
const res = await (0, gateway_1.queryGateway)({
|
|
59
|
+
envId,
|
|
60
|
+
domain: domainName,
|
|
61
|
+
path: servicePath,
|
|
62
|
+
gatewayId: serviceId
|
|
63
|
+
});
|
|
64
|
+
loading.stop();
|
|
65
|
+
if (((_a = res === null || res === void 0 ? void 0 : res.APISet) === null || _a === void 0 ? void 0 : _a.length) === 0) {
|
|
66
|
+
log.info((0, i18n_1.t)('HTTP 访问服务为空'));
|
|
67
|
+
return;
|
|
91
68
|
}
|
|
92
|
-
|
|
69
|
+
const head = [(0, i18n_1.t)('触发路径'), (0, i18n_1.t)('关联资源'), (0, i18n_1.t)('触发类型'), (0, i18n_1.t)('创建时间')];
|
|
70
|
+
const tableData = res.APISet.map((item) => [
|
|
71
|
+
item.Path,
|
|
72
|
+
item.Name,
|
|
73
|
+
item.Type === 1 ? (0, i18n_1.t)('云函数') : (0, i18n_1.t)('云托管'),
|
|
74
|
+
(0, utils_1.formatDate)(item.CreateTime * 1000, 'yyyy-MM-dd hh:mm:ss')
|
|
75
|
+
]);
|
|
76
|
+
(0, utils_1.printHorizontalTable)(head, tableData);
|
|
77
|
+
}
|
|
78
|
+
catch (e) {
|
|
79
|
+
loading.stop();
|
|
80
|
+
throw e;
|
|
81
|
+
}
|
|
93
82
|
}
|
|
94
83
|
};
|
|
95
84
|
__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.ServiceAuthSwitch = exports.ServiceSwitchCommand = void 0;
|
|
25
16
|
const enquirer_1 = require("enquirer");
|
|
@@ -43,34 +34,32 @@ let ServiceSwitchCommand = class ServiceSwitchCommand extends common_1.Command {
|
|
|
43
34
|
desc: (0, i18n_1.t)('开启/关闭HTTP 访问服务')
|
|
44
35
|
};
|
|
45
36
|
}
|
|
46
|
-
execute(envId) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
choices: [(0, i18n_1.t)('开启'), (0, i18n_1.t)('关闭')]
|
|
58
|
-
});
|
|
59
|
-
try {
|
|
60
|
-
const loadingText = enable ? (0, i18n_1.t)('HTTP 访问服务开启中') : (0, i18n_1.t)('HTTP 访问服务关闭中');
|
|
61
|
-
loading.start(loadingText);
|
|
62
|
-
yield (0, gateway_1.switchHttpService)({
|
|
63
|
-
envId,
|
|
64
|
-
enable: enable === (0, i18n_1.t)('开启')
|
|
65
|
-
});
|
|
66
|
-
const successText = enable ? (0, i18n_1.t)('HTTP 访问服务开启成功!') : (0, i18n_1.t)('HTTP 访问服务关闭成功!');
|
|
67
|
-
loading.succeed(successText);
|
|
68
|
-
}
|
|
69
|
-
catch (e) {
|
|
70
|
-
loading.stop();
|
|
71
|
-
throw e;
|
|
72
|
-
}
|
|
37
|
+
async execute(envId) {
|
|
38
|
+
const loading = (0, utils_1.loadingFactory)();
|
|
39
|
+
loading.start((0, i18n_1.t)('数据加载中...'));
|
|
40
|
+
const { EnableService } = await (0, gateway_1.getHttpServicePrivilege)({ envId });
|
|
41
|
+
const status = EnableService ? (0, i18n_1.t)('已开启') : (0, i18n_1.t)('已关闭');
|
|
42
|
+
loading.stop();
|
|
43
|
+
const { enable } = await (0, enquirer_1.prompt)({
|
|
44
|
+
type: 'select',
|
|
45
|
+
name: 'enable',
|
|
46
|
+
message: (0, i18n_1.t)('开启/关闭HTTP 访问服务(当前状态:{{status}})', { status }),
|
|
47
|
+
choices: [(0, i18n_1.t)('开启'), (0, i18n_1.t)('关闭')]
|
|
73
48
|
});
|
|
49
|
+
try {
|
|
50
|
+
const loadingText = enable ? (0, i18n_1.t)('HTTP 访问服务开启中') : (0, i18n_1.t)('HTTP 访问服务关闭中');
|
|
51
|
+
loading.start(loadingText);
|
|
52
|
+
await (0, gateway_1.switchHttpService)({
|
|
53
|
+
envId,
|
|
54
|
+
enable: enable === (0, i18n_1.t)('开启')
|
|
55
|
+
});
|
|
56
|
+
const successText = enable ? (0, i18n_1.t)('HTTP 访问服务开启成功!') : (0, i18n_1.t)('HTTP 访问服务关闭成功!');
|
|
57
|
+
loading.succeed(successText);
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
loading.stop();
|
|
61
|
+
throw e;
|
|
62
|
+
}
|
|
74
63
|
}
|
|
75
64
|
};
|
|
76
65
|
__decorate([
|
|
@@ -103,32 +92,30 @@ let ServiceAuthSwitch = class ServiceAuthSwitch extends common_1.Command {
|
|
|
103
92
|
desc: (0, i18n_1.t)('开启/关闭HTTP 访问服务访问鉴权')
|
|
104
93
|
};
|
|
105
94
|
}
|
|
106
|
-
execute(envId) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
choices: [(0, i18n_1.t)('开启'), (0, i18n_1.t)('关闭')]
|
|
118
|
-
});
|
|
119
|
-
try {
|
|
120
|
-
loading.start((0, i18n_1.t)('HTTP 访问服务访问鉴权{{enable}}中', { enable }));
|
|
121
|
-
yield (0, gateway_1.switchHttpServiceAuth)({
|
|
122
|
-
envId,
|
|
123
|
-
enable: enable === (0, i18n_1.t)('开启')
|
|
124
|
-
});
|
|
125
|
-
loading.succeed((0, i18n_1.t)('HTTP 访问服务访问鉴权{{enable}}成功!', { enable }));
|
|
126
|
-
}
|
|
127
|
-
catch (e) {
|
|
128
|
-
loading.stop();
|
|
129
|
-
throw e;
|
|
130
|
-
}
|
|
95
|
+
async execute(envId) {
|
|
96
|
+
const loading = (0, utils_1.loadingFactory)();
|
|
97
|
+
loading.start((0, i18n_1.t)('数据加载中...'));
|
|
98
|
+
const { EnableAuth } = await (0, gateway_1.getHttpServicePrivilege)({ envId });
|
|
99
|
+
const status = EnableAuth ? (0, i18n_1.t)('已开启') : (0, i18n_1.t)('已关闭');
|
|
100
|
+
loading.stop();
|
|
101
|
+
const { enable } = await (0, enquirer_1.prompt)({
|
|
102
|
+
type: 'select',
|
|
103
|
+
name: 'enable',
|
|
104
|
+
message: (0, i18n_1.t)('开启/关闭HTTP 访问服务访问鉴权(当前状态:{{status}})', { status }),
|
|
105
|
+
choices: [(0, i18n_1.t)('开启'), (0, i18n_1.t)('关闭')]
|
|
131
106
|
});
|
|
107
|
+
try {
|
|
108
|
+
loading.start((0, i18n_1.t)('HTTP 访问服务访问鉴权{{enable}}中', { enable }));
|
|
109
|
+
await (0, gateway_1.switchHttpServiceAuth)({
|
|
110
|
+
envId,
|
|
111
|
+
enable: enable === (0, i18n_1.t)('开启')
|
|
112
|
+
});
|
|
113
|
+
loading.succeed((0, i18n_1.t)('HTTP 访问服务访问鉴权{{enable}}成功!', { enable }));
|
|
114
|
+
}
|
|
115
|
+
catch (e) {
|
|
116
|
+
loading.stop();
|
|
117
|
+
throw e;
|
|
118
|
+
}
|
|
132
119
|
}
|
|
133
120
|
};
|
|
134
121
|
__decorate([
|