@cloudbase/cli 2.9.8 → 2.9.10-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/bin/cloudbase.js +2 -1
- package/bin/tcb.js +35 -28
- package/cloudbase-cli-2.7.8.tgz +0 -0
- package/lib/auth/login.js +21 -13
- package/lib/commands/account/login.js +43 -42
- package/lib/commands/account/logout.js +3 -2
- package/lib/commands/ai/index.js +13 -12
- package/lib/commands/cloudfunction/base.js +24 -26
- package/lib/commands/cloudrun/base.js +87 -96
- package/lib/commands/common.js +11 -10
- package/lib/commands/config/delete.js +72 -0
- package/lib/commands/config/get.js +69 -0
- package/lib/commands/config/index.js +21 -0
- package/lib/commands/config/interface.js +24 -0
- package/lib/commands/config/list.js +72 -0
- package/lib/commands/config/set.js +89 -0
- package/lib/commands/db/base.js +33 -32
- package/lib/commands/env/base.js +12 -11
- package/lib/commands/env/domain.js +24 -23
- package/lib/commands/env/login.js +31 -30
- package/lib/commands/fun/base.js +37 -36
- package/lib/commands/functions/alias/getRoute.js +5 -4
- package/lib/commands/functions/alias/setRoute.js +7 -6
- package/lib/commands/functions/code-download.js +15 -11
- package/lib/commands/functions/code-update.js +8 -7
- package/lib/commands/functions/concurrency/delete.js +5 -4
- package/lib/commands/functions/concurrency/list.js +6 -5
- package/lib/commands/functions/concurrency/set.js +5 -4
- package/lib/commands/functions/config-update.js +8 -7
- package/lib/commands/functions/copy.js +7 -6
- package/lib/commands/functions/delete.js +8 -7
- package/lib/commands/functions/deploy.js +35 -34
- package/lib/commands/functions/detail.js +32 -31
- package/lib/commands/functions/invoke.js +16 -15
- package/lib/commands/functions/layer/bind.js +26 -25
- package/lib/commands/functions/layer/common.js +2 -1
- package/lib/commands/functions/layer/create.js +7 -6
- package/lib/commands/functions/layer/delete.js +9 -8
- package/lib/commands/functions/layer/download.js +10 -9
- package/lib/commands/functions/layer/list.js +10 -9
- package/lib/commands/functions/layer/sort.js +9 -8
- package/lib/commands/functions/list.js +9 -8
- package/lib/commands/functions/log.js +28 -27
- package/lib/commands/functions/run.js +21 -20
- package/lib/commands/functions/trigger-create.js +9 -8
- package/lib/commands/functions/trigger-delete.js +10 -9
- package/lib/commands/functions/version/list.js +9 -8
- package/lib/commands/functions/version/publish.js +5 -4
- package/lib/commands/gateway/create.js +14 -13
- package/lib/commands/gateway/delete.js +10 -9
- package/lib/commands/gateway/domain.js +25 -24
- package/lib/commands/gateway/list.js +11 -10
- package/lib/commands/gateway/switch.js +22 -19
- package/lib/commands/helpers/init.js +38 -37
- package/lib/commands/helpers/new.js +7 -6
- package/lib/commands/helpers/open.js +7 -6
- package/lib/commands/hosting/hosting.js +45 -44
- package/lib/commands/index.js +1 -0
- package/lib/commands/pull/pull.js +12 -11
- package/lib/commands/run/delete.js +16 -15
- package/lib/commands/run/image/common.js +2 -1
- package/lib/commands/run/image/delete.js +10 -9
- package/lib/commands/run/image/download.js +8 -7
- package/lib/commands/run/image/list.js +11 -10
- package/lib/commands/run/image/upload.js +9 -8
- package/lib/commands/run/list.js +10 -9
- package/lib/commands/run/service/config.js +13 -12
- package/lib/commands/run/service/deploy.js +24 -23
- package/lib/commands/run/service/list.js +10 -9
- package/lib/commands/run/service/update.js +22 -21
- package/lib/commands/run/standalonegateway/common.js +2 -1
- package/lib/commands/run/standalonegateway/create.js +14 -13
- package/lib/commands/run/standalonegateway/destroy.js +9 -8
- package/lib/commands/run/standalonegateway/list.js +7 -6
- package/lib/commands/run/standalonegateway/package.js +7 -6
- package/lib/commands/run/standalonegateway/turn.js +10 -9
- package/lib/commands/run/version/common.js +2 -1
- package/lib/commands/run/version/create.js +41 -40
- package/lib/commands/run/version/delete.js +10 -9
- package/lib/commands/run/version/list.js +13 -12
- package/lib/commands/run/version/modify.js +13 -12
- package/lib/commands/run/version/update.js +57 -54
- package/lib/commands/runf/base.js +42 -40
- package/lib/commands/self-update.js +11 -10
- package/lib/commands/smart.js +5 -4
- package/lib/commands/storage/storage.js +61 -56
- package/lib/commands/third/thirdAttach.js +6 -5
- package/lib/commands/utils.js +8 -5
- package/lib/constant.js +18 -17
- package/lib/decorators/deprecate.js +2 -1
- package/lib/function/alias.js +3 -2
- package/lib/function/base.js +9 -8
- package/lib/function/concurrency.js +4 -3
- package/lib/function/create.js +5 -4
- package/lib/function/delete.js +2 -1
- package/lib/function/layer/attach.js +2 -1
- package/lib/function/layer/create.js +2 -1
- package/lib/function/layer/download.js +2 -1
- package/lib/function/trigger.js +6 -5
- package/lib/function/update.js +3 -2
- package/lib/function/version.js +3 -2
- package/lib/help.js +22 -20
- package/lib/hosting.js +18 -17
- package/lib/i18n/index.js +81 -0
- package/lib/run/service/common.js +14 -13
- package/lib/run/service/config.js +4 -3
- package/lib/run/service/deployPackage.js +6 -5
- package/lib/run/service/showLogs.js +3 -2
- package/lib/run/service/update.js +7 -6
- package/lib/run/standalonegateway/list.js +5 -1
- package/lib/storage.js +2 -1
- package/lib/utils/ai/banner.js +12 -11
- package/lib/utils/ai/claudeWindows.js +5 -3
- package/lib/utils/ai/config.js +3 -2
- package/lib/utils/ai/const.js +4 -3
- package/lib/utils/ai/env.js +3 -2
- package/lib/utils/ai/envLocalManager.js +6 -5
- package/lib/utils/ai/nodeVersion.js +5 -1
- package/lib/utils/ai/router.js +129 -106
- package/lib/utils/ai/setup.js +95 -91
- package/lib/utils/checkTcbrEnv.js +22 -21
- package/lib/utils/cli-table.js +2 -1
- package/lib/utils/commonParamsCheck.js +4 -3
- package/lib/utils/debug-logger.js +2 -1
- package/lib/utils/dts.js +4 -3
- package/lib/utils/env.js +23 -21
- package/lib/utils/fs/index.js +5 -4
- package/lib/utils/function-packer.js +3 -2
- package/lib/utils/index.js +1 -0
- package/lib/utils/mcp-config-modifier.js +18 -17
- package/lib/utils/net/cloud-api-request.js +2 -1
- package/lib/utils/net/credential.js +2 -1
- package/lib/utils/net/http-request.js +2 -1
- package/lib/utils/progress-bar.js +2 -1
- package/lib/utils/prompt/select.js +8 -6
- package/lib/utils/store/auth.js +3 -2
- package/lib/utils/store/config.js +49 -0
- package/lib/utils/store/db.js +5 -0
- package/lib/utils/store/index.js +1 -1
- package/lib/utils/tcbrApi/callTcbrApi.js +2 -1
- package/lib/utils/template-manager.js +37 -36
- package/lib/utils/template.js +10 -9
- package/lib/utils/tools/common.js +3 -2
- package/lib/utils/url.js +19 -0
- package/lib/utils/validator.js +12 -4
- package/locales/README.md +160 -0
- package/locales/i18next-scanner.config.js +206 -0
- package/locales/langs/en.json +1235 -0
- package/locales/langs/zh.json +1235 -0
- package/locales/mapping.json +1235 -0
- package/package.json +10 -3
- package/types/commands/config/delete.d.ts +13 -0
- package/types/commands/config/get.d.ts +13 -0
- package/types/commands/config/index.d.ts +5 -0
- package/types/commands/config/interface.d.ts +17 -0
- package/types/commands/config/list.d.ts +13 -0
- package/types/commands/config/set.d.ts +13 -0
- package/types/commands/index.d.ts +1 -0
- package/types/i18n/index.d.ts +3 -0
- package/types/utils/ai/const.d.ts +1 -1
- package/types/utils/index.d.ts +1 -0
- package/types/utils/store/config.d.ts +8 -0
- package/types/utils/store/db.d.ts +2 -0
- package/types/utils/store/index.d.ts +1 -1
- package/types/utils/url.d.ts +18 -0
- package/dist/standalone/ccr.js +0 -78668
- package/dist/standalone/cli.js +0 -626422
package/lib/commands/env/base.js
CHANGED
|
@@ -28,6 +28,7 @@ const env_1 = require("../../env");
|
|
|
28
28
|
const decorators_1 = require("../../decorators");
|
|
29
29
|
const utils_1 = require("../../utils");
|
|
30
30
|
const constants_1 = require("../constants");
|
|
31
|
+
const i18n_1 = require("../../i18n");
|
|
31
32
|
let EnvListCommand = class EnvListCommand extends common_1.Command {
|
|
32
33
|
get options() {
|
|
33
34
|
return {
|
|
@@ -35,17 +36,17 @@ let EnvListCommand = class EnvListCommand extends common_1.Command {
|
|
|
35
36
|
childCmd: 'list',
|
|
36
37
|
deprecateCmd: 'env:list',
|
|
37
38
|
options: [],
|
|
38
|
-
desc: '展示云开发环境信息',
|
|
39
|
+
desc: (0, i18n_1.t)('展示云开发环境信息'),
|
|
39
40
|
requiredEnvId: false
|
|
40
41
|
};
|
|
41
42
|
}
|
|
42
43
|
execute(log) {
|
|
43
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
45
|
const loading = (0, utils_1.loadingFactory)();
|
|
45
|
-
loading.start('数据加载中...');
|
|
46
|
+
loading.start((0, i18n_1.t)('数据加载中...'));
|
|
46
47
|
const data = yield (0, env_1.listEnvs)();
|
|
47
48
|
loading.stop();
|
|
48
|
-
const head = ['名称', '环境 Id', '套餐版本', '来源', '创建时间', '环境状态'];
|
|
49
|
+
const head = [(0, i18n_1.t)('名称'), (0, i18n_1.t)('环境 Id'), (0, i18n_1.t)('套餐版本'), (0, i18n_1.t)('来源'), (0, i18n_1.t)('创建时间'), (0, i18n_1.t)('环境状态')];
|
|
49
50
|
const sortData = data.sort((prev, next) => {
|
|
50
51
|
if (prev.Alias > next.Alias) {
|
|
51
52
|
return 1;
|
|
@@ -58,15 +59,15 @@ let EnvListCommand = class EnvListCommand extends common_1.Command {
|
|
|
58
59
|
const tableData = sortData.map((item) => [
|
|
59
60
|
item.Alias,
|
|
60
61
|
item.EnvId,
|
|
61
|
-
item.PackageName || '按量计费',
|
|
62
|
-
item.Source === constants_1.EnvSource.MINIAPP ? '小程序' : '云开发',
|
|
62
|
+
item.PackageName || (0, i18n_1.t)('按量计费'),
|
|
63
|
+
item.Source === constants_1.EnvSource.MINIAPP ? (0, i18n_1.t)('小程序') : (0, i18n_1.t)('云开发'),
|
|
63
64
|
item.CreateTime,
|
|
64
|
-
item.Status === 'NORMAL' ? '正常' : '不可用'
|
|
65
|
+
item.Status === 'NORMAL' ? (0, i18n_1.t)('正常') : (0, i18n_1.t)('不可用')
|
|
65
66
|
]);
|
|
66
67
|
(0, utils_1.printHorizontalTable)(head, tableData);
|
|
67
68
|
const unavailableEnv = data.find((item) => item.Status === 'UNAVAILABLE');
|
|
68
69
|
if (unavailableEnv) {
|
|
69
|
-
log.warn(
|
|
70
|
+
log.warn((0, i18n_1.t)('您的环境中存在不可用的环境:[{{envId}}],请留意!', { envId: unavailableEnv.EnvId }));
|
|
70
71
|
}
|
|
71
72
|
});
|
|
72
73
|
}
|
|
@@ -91,10 +92,10 @@ let EnvRenameCommand = class EnvRenameCommand extends common_1.Command {
|
|
|
91
92
|
options: [
|
|
92
93
|
{
|
|
93
94
|
flags: '-e, --envId <envId>',
|
|
94
|
-
desc: '环境 Id'
|
|
95
|
+
desc: (0, i18n_1.t)('环境 Id')
|
|
95
96
|
}
|
|
96
97
|
],
|
|
97
|
-
desc: '修改云开发环境别名',
|
|
98
|
+
desc: (0, i18n_1.t)('修改云开发环境别名'),
|
|
98
99
|
requiredEnvId: false
|
|
99
100
|
};
|
|
100
101
|
}
|
|
@@ -103,13 +104,13 @@ let EnvRenameCommand = class EnvRenameCommand extends common_1.Command {
|
|
|
103
104
|
log.verbose(params);
|
|
104
105
|
const name = params === null || params === void 0 ? void 0 : params[0];
|
|
105
106
|
if (!name) {
|
|
106
|
-
throw new error_1.CloudBaseError('环境别名不能为空!');
|
|
107
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('环境别名不能为空!'));
|
|
107
108
|
}
|
|
108
109
|
yield (0, env_1.updateEnvInfo)({
|
|
109
110
|
envId: envId,
|
|
110
111
|
alias: name
|
|
111
112
|
});
|
|
112
|
-
log.success(
|
|
113
|
+
log.success((0, i18n_1.t)('更新环境别名成功!'));
|
|
113
114
|
});
|
|
114
115
|
}
|
|
115
116
|
};
|
|
@@ -31,23 +31,24 @@ const common_1 = require("../common");
|
|
|
31
31
|
const utils_1 = require("../../utils");
|
|
32
32
|
const decorators_1 = require("../../decorators");
|
|
33
33
|
const env_1 = require("../../env");
|
|
34
|
+
const i18n_1 = require("../../i18n");
|
|
34
35
|
let ListAuthDoaminCommand = class ListAuthDoaminCommand extends common_1.Command {
|
|
35
36
|
get options() {
|
|
36
37
|
return {
|
|
37
38
|
cmd: 'env',
|
|
38
39
|
childCmd: {
|
|
39
40
|
cmd: 'domain',
|
|
40
|
-
desc: '域名管理'
|
|
41
|
+
desc: (0, i18n_1.t)('域名管理')
|
|
41
42
|
},
|
|
42
43
|
childSubCmd: 'list',
|
|
43
44
|
deprecateCmd: 'env:domain:list',
|
|
44
45
|
options: [
|
|
45
46
|
{
|
|
46
47
|
flags: '-e, --envId <envId>',
|
|
47
|
-
desc: '环境 Id'
|
|
48
|
+
desc: (0, i18n_1.t)('环境 Id')
|
|
48
49
|
}
|
|
49
50
|
],
|
|
50
|
-
desc: '列出环境的安全域名列表'
|
|
51
|
+
desc: (0, i18n_1.t)('列出环境的安全域名列表')
|
|
51
52
|
};
|
|
52
53
|
}
|
|
53
54
|
execute(envId) {
|
|
@@ -56,15 +57,15 @@ let ListAuthDoaminCommand = class ListAuthDoaminCommand extends common_1.Command
|
|
|
56
57
|
envId: envId
|
|
57
58
|
});
|
|
58
59
|
if (domains.length === 0) {
|
|
59
|
-
console.log('安全域名为空!');
|
|
60
|
+
console.log((0, i18n_1.t)('安全域名为空!'));
|
|
60
61
|
return;
|
|
61
62
|
}
|
|
62
|
-
const head = ['域名 Id', '域名', '创建时间', '状态'];
|
|
63
|
+
const head = [(0, i18n_1.t)('域名 Id'), (0, i18n_1.t)('域名'), (0, i18n_1.t)('创建时间'), (0, i18n_1.t)('状态')];
|
|
63
64
|
const tableData = domains.map((item) => [
|
|
64
65
|
item.Id,
|
|
65
66
|
item.Domain,
|
|
66
67
|
item.CreateTime,
|
|
67
|
-
item.Status === 'ENABLE' ? '启用中' : '禁用中'
|
|
68
|
+
item.Status === 'ENABLE' ? (0, i18n_1.t)('启用中') : (0, i18n_1.t)('禁用中')
|
|
68
69
|
]);
|
|
69
70
|
(0, utils_1.printHorizontalTable)(head, tableData);
|
|
70
71
|
});
|
|
@@ -87,17 +88,17 @@ let CreateAuthDomainCommand = class CreateAuthDomainCommand extends common_1.Com
|
|
|
87
88
|
cmd: 'env',
|
|
88
89
|
childCmd: {
|
|
89
90
|
cmd: 'domain',
|
|
90
|
-
desc: '域名管理'
|
|
91
|
+
desc: (0, i18n_1.t)('域名管理')
|
|
91
92
|
},
|
|
92
93
|
childSubCmd: 'create <domain>',
|
|
93
94
|
deprecateCmd: 'env:domain:create <domain>',
|
|
94
95
|
options: [
|
|
95
96
|
{
|
|
96
97
|
flags: '-e, --envId <envId>',
|
|
97
|
-
desc: '环境 Id'
|
|
98
|
+
desc: (0, i18n_1.t)('环境 Id')
|
|
98
99
|
}
|
|
99
100
|
],
|
|
100
|
-
desc: '添加环境安全域名,多个以斜杠 / 分隔'
|
|
101
|
+
desc: (0, i18n_1.t)('添加环境安全域名,多个以斜杠 / 分隔')
|
|
101
102
|
};
|
|
102
103
|
}
|
|
103
104
|
execute(params, envId, log) {
|
|
@@ -108,11 +109,11 @@ let CreateAuthDomainCommand = class CreateAuthDomainCommand extends common_1.Com
|
|
|
108
109
|
const { confirm } = yield inquirer_1.default.prompt({
|
|
109
110
|
type: 'confirm',
|
|
110
111
|
name: 'confirm',
|
|
111
|
-
message:
|
|
112
|
+
message: (0, i18n_1.t)('确认添加以下安全域名: {{domains}} ?', { domains }),
|
|
112
113
|
default: true
|
|
113
114
|
});
|
|
114
115
|
if (!confirm) {
|
|
115
|
-
throw new error_1.CloudBaseError('操作终止!');
|
|
116
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('操作终止!'));
|
|
116
117
|
}
|
|
117
118
|
let envDomains = yield (0, env_1.getEnvAuthDomains)({
|
|
118
119
|
envId
|
|
@@ -125,13 +126,13 @@ let CreateAuthDomainCommand = class CreateAuthDomainCommand extends common_1.Com
|
|
|
125
126
|
}
|
|
126
127
|
});
|
|
127
128
|
if (exitDomains.length) {
|
|
128
|
-
throw new error_1.CloudBaseError(
|
|
129
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('域名 [{{domains}}] 已存在!', { domains: exitDomains.join(', ') }));
|
|
129
130
|
}
|
|
130
131
|
yield (0, env_1.createEnvDomain)({
|
|
131
132
|
envId,
|
|
132
133
|
domains: domains
|
|
133
134
|
});
|
|
134
|
-
log.success('添加安全域名成功!');
|
|
135
|
+
log.success((0, i18n_1.t)('添加安全域名成功!'));
|
|
135
136
|
});
|
|
136
137
|
}
|
|
137
138
|
};
|
|
@@ -154,47 +155,47 @@ let DeleteAuthDomainCommand = class DeleteAuthDomainCommand extends common_1.Com
|
|
|
154
155
|
cmd: 'env',
|
|
155
156
|
childCmd: {
|
|
156
157
|
cmd: 'domain',
|
|
157
|
-
desc: '域名管理'
|
|
158
|
+
desc: (0, i18n_1.t)('域名管理')
|
|
158
159
|
},
|
|
159
160
|
childSubCmd: 'delete',
|
|
160
161
|
deprecateCmd: 'env:domain:delete',
|
|
161
162
|
options: [
|
|
162
163
|
{
|
|
163
164
|
flags: '-e, --envId <envId>',
|
|
164
|
-
desc: '环境 Id'
|
|
165
|
+
desc: (0, i18n_1.t)('环境 Id')
|
|
165
166
|
}
|
|
166
167
|
],
|
|
167
|
-
desc: '删除环境的安全域名'
|
|
168
|
+
desc: (0, i18n_1.t)('删除环境的安全域名')
|
|
168
169
|
};
|
|
169
170
|
}
|
|
170
171
|
execute(envId, log) {
|
|
171
172
|
return __awaiter(this, void 0, void 0, function* () {
|
|
172
173
|
const loading = (0, utils_1.loadingFactory)();
|
|
173
|
-
loading.start('拉取环境安全域名中');
|
|
174
|
+
loading.start((0, i18n_1.t)('拉取环境安全域名中'));
|
|
174
175
|
const domains = yield (0, env_1.getEnvAuthDomains)({
|
|
175
176
|
envId
|
|
176
177
|
});
|
|
177
178
|
if (domains.length === 0) {
|
|
178
|
-
loading.fail('域名安全为空,不能执行删除操作!');
|
|
179
|
+
loading.fail((0, i18n_1.t)('域名安全为空,不能执行删除操作!'));
|
|
179
180
|
return;
|
|
180
181
|
}
|
|
181
|
-
loading.succeed('拉取环境安全域名成功!');
|
|
182
|
+
loading.succeed((0, i18n_1.t)('拉取环境安全域名成功!'));
|
|
182
183
|
const domainList = domains.map((item) => item.Domain);
|
|
183
184
|
const { selectDomains } = yield inquirer_1.default.prompt({
|
|
184
185
|
type: 'checkbox',
|
|
185
186
|
name: 'selectDomains',
|
|
186
|
-
message: '请选择需要删除的域名(可多选)>',
|
|
187
|
+
message: (0, i18n_1.t)('请选择需要删除的域名(可多选)>'),
|
|
187
188
|
choices: domainList,
|
|
188
189
|
default: true
|
|
189
190
|
});
|
|
190
191
|
const { confirm } = yield inquirer_1.default.prompt({
|
|
191
192
|
type: 'confirm',
|
|
192
193
|
name: 'confirm',
|
|
193
|
-
message:
|
|
194
|
+
message: (0, i18n_1.t)('确认删除以下安全域名: {{domains}} ?', { domains: selectDomains }),
|
|
194
195
|
default: true
|
|
195
196
|
});
|
|
196
197
|
if (!confirm) {
|
|
197
|
-
throw new error_1.CloudBaseError('操作终止!');
|
|
198
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('操作终止!'));
|
|
198
199
|
}
|
|
199
200
|
const domainIds = domains
|
|
200
201
|
.filter((item) => selectDomains.includes(item.Domain))
|
|
@@ -203,7 +204,7 @@ let DeleteAuthDomainCommand = class DeleteAuthDomainCommand extends common_1.Com
|
|
|
203
204
|
domainIds,
|
|
204
205
|
envId
|
|
205
206
|
});
|
|
206
|
-
log.success(
|
|
207
|
+
log.success((0, i18n_1.t)('成功删除了 {{count}} 个域名!', { count: deleted }));
|
|
207
208
|
});
|
|
208
209
|
}
|
|
209
210
|
};
|
|
@@ -31,10 +31,11 @@ const error_1 = require("../../error");
|
|
|
31
31
|
const utils_1 = require("../../utils");
|
|
32
32
|
const decorators_1 = require("../../decorators");
|
|
33
33
|
const env_1 = require("../../env");
|
|
34
|
+
const i18n_1 = require("../../i18n");
|
|
34
35
|
const platformMap = {
|
|
35
|
-
'WECHAT-OPEN': '微信开放平台',
|
|
36
|
-
'WECHAT-PUBLIC': '微信公众平台',
|
|
37
|
-
ANONYMOUS: '匿名登录'
|
|
36
|
+
'WECHAT-OPEN': (0, i18n_1.t)('微信开放平台'),
|
|
37
|
+
'WECHAT-PUBLIC': (0, i18n_1.t)('微信公众平台'),
|
|
38
|
+
ANONYMOUS: (0, i18n_1.t)('匿名登录')
|
|
38
39
|
};
|
|
39
40
|
let ListLoginCommand = class ListLoginCommand extends common_1.Command {
|
|
40
41
|
get options() {
|
|
@@ -42,17 +43,17 @@ let ListLoginCommand = class ListLoginCommand extends common_1.Command {
|
|
|
42
43
|
cmd: 'env',
|
|
43
44
|
childCmd: {
|
|
44
45
|
cmd: 'login',
|
|
45
|
-
desc: '登录授权管理'
|
|
46
|
+
desc: (0, i18n_1.t)('登录授权管理')
|
|
46
47
|
},
|
|
47
48
|
childSubCmd: 'list',
|
|
48
49
|
deprecateCmd: 'env:login:list',
|
|
49
50
|
options: [
|
|
50
51
|
{
|
|
51
52
|
flags: '-e, --envId <envId>',
|
|
52
|
-
desc: '环境 Id'
|
|
53
|
+
desc: (0, i18n_1.t)('环境 Id')
|
|
53
54
|
}
|
|
54
55
|
],
|
|
55
|
-
desc: '列出环境登录配置'
|
|
56
|
+
desc: (0, i18n_1.t)('列出环境登录配置')
|
|
56
57
|
};
|
|
57
58
|
}
|
|
58
59
|
execute(envId) {
|
|
@@ -60,12 +61,12 @@ let ListLoginCommand = class ListLoginCommand extends common_1.Command {
|
|
|
60
61
|
const configList = yield (0, env_1.getLoginConfigList)({
|
|
61
62
|
envId
|
|
62
63
|
});
|
|
63
|
-
const head = ['平台', '平台 Id', '创建时间', '状态'];
|
|
64
|
+
const head = [(0, i18n_1.t)('平台'), (0, i18n_1.t)('平台 Id'), (0, i18n_1.t)('创建时间'), (0, i18n_1.t)('状态')];
|
|
64
65
|
const tableData = configList.map((item) => [
|
|
65
66
|
platformMap[item.Platform] ? platformMap[item.Platform] : item.Platform,
|
|
66
67
|
item.PlatformId,
|
|
67
68
|
item.CreateTime,
|
|
68
|
-
item.Status === 'ENABLE' ? '启用' : '禁用'
|
|
69
|
+
item.Status === 'ENABLE' ? (0, i18n_1.t)('启用') : (0, i18n_1.t)('禁用')
|
|
69
70
|
]);
|
|
70
71
|
(0, utils_1.printHorizontalTable)(head, tableData);
|
|
71
72
|
});
|
|
@@ -92,10 +93,10 @@ let CreateLoginCommand = class CreateLoginCommand extends common_1.Command {
|
|
|
92
93
|
options: [
|
|
93
94
|
{
|
|
94
95
|
flags: '-e, --envId <envId>',
|
|
95
|
-
desc: '环境 Id'
|
|
96
|
+
desc: (0, i18n_1.t)('环境 Id')
|
|
96
97
|
}
|
|
97
98
|
],
|
|
98
|
-
desc: '添加环境登录方式配置'
|
|
99
|
+
desc: (0, i18n_1.t)('添加环境登录方式配置')
|
|
99
100
|
};
|
|
100
101
|
}
|
|
101
102
|
execute(envId, log) {
|
|
@@ -106,19 +107,19 @@ let CreateLoginCommand = class CreateLoginCommand extends common_1.Command {
|
|
|
106
107
|
name: 'platform',
|
|
107
108
|
choices: [
|
|
108
109
|
{
|
|
109
|
-
name: '微信公众平台',
|
|
110
|
+
name: (0, i18n_1.t)('微信公众平台'),
|
|
110
111
|
value: 'WECHAT-PUBLIC'
|
|
111
112
|
},
|
|
112
113
|
{
|
|
113
|
-
name: '微信开放平台',
|
|
114
|
+
name: (0, i18n_1.t)('微信开放平台'),
|
|
114
115
|
value: 'WECHAT-OPEN'
|
|
115
116
|
},
|
|
116
117
|
{
|
|
117
|
-
name: '匿名登录',
|
|
118
|
+
name: (0, i18n_1.t)('匿名登录'),
|
|
118
119
|
value: 'ANONYMOUS'
|
|
119
120
|
}
|
|
120
121
|
],
|
|
121
|
-
message: '请选择登录方式:',
|
|
122
|
+
message: (0, i18n_1.t)('请选择登录方式:'),
|
|
122
123
|
default: 'WECHAT-PUBLIC'
|
|
123
124
|
}
|
|
124
125
|
]);
|
|
@@ -129,18 +130,18 @@ let CreateLoginCommand = class CreateLoginCommand extends common_1.Command {
|
|
|
129
130
|
{
|
|
130
131
|
type: 'input',
|
|
131
132
|
name: 'appId',
|
|
132
|
-
message: '请输入 AppId:'
|
|
133
|
+
message: (0, i18n_1.t)('请输入 AppId:')
|
|
133
134
|
},
|
|
134
135
|
{
|
|
135
136
|
type: 'input',
|
|
136
137
|
name: 'appSecret',
|
|
137
|
-
message: '请输入 AppSecret:'
|
|
138
|
+
message: (0, i18n_1.t)('请输入 AppSecret:')
|
|
138
139
|
}
|
|
139
140
|
]);
|
|
140
141
|
appId = input === null || input === void 0 ? void 0 : input.appId;
|
|
141
142
|
appSecret = input === null || input === void 0 ? void 0 : input.appSecret;
|
|
142
143
|
if (!appId || !appSecret) {
|
|
143
|
-
throw new error_1.CloudBaseError('appId 和 appSecret 不能为空!');
|
|
144
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('appId 和 appSecret 不能为空!'));
|
|
144
145
|
}
|
|
145
146
|
}
|
|
146
147
|
if (platform === 'ANONYMOUS') {
|
|
@@ -154,11 +155,11 @@ let CreateLoginCommand = class CreateLoginCommand extends common_1.Command {
|
|
|
154
155
|
appSecret,
|
|
155
156
|
platform
|
|
156
157
|
});
|
|
157
|
-
log.success('创建登录方式成功!');
|
|
158
|
+
log.success((0, i18n_1.t)('创建登录方式成功!'));
|
|
158
159
|
}
|
|
159
160
|
catch (e) {
|
|
160
161
|
if (e.code === 'ResourceInUse') {
|
|
161
|
-
log.error('登录方式已开启');
|
|
162
|
+
log.error((0, i18n_1.t)('登录方式已开启'));
|
|
162
163
|
}
|
|
163
164
|
}
|
|
164
165
|
});
|
|
@@ -186,10 +187,10 @@ let UpdateLogin = class UpdateLogin extends common_1.Command {
|
|
|
186
187
|
options: [
|
|
187
188
|
{
|
|
188
189
|
flags: '-e, --envId <envId>',
|
|
189
|
-
desc: '环境 Id'
|
|
190
|
+
desc: (0, i18n_1.t)('环境 Id')
|
|
190
191
|
}
|
|
191
192
|
],
|
|
192
|
-
desc: '更新环境登录方式配置'
|
|
193
|
+
desc: (0, i18n_1.t)('更新环境登录方式配置')
|
|
193
194
|
};
|
|
194
195
|
}
|
|
195
196
|
execute(envId, log) {
|
|
@@ -198,7 +199,7 @@ let UpdateLogin = class UpdateLogin extends common_1.Command {
|
|
|
198
199
|
envId
|
|
199
200
|
});
|
|
200
201
|
const configChoices = configList.map((item) => ({
|
|
201
|
-
name: `${platformMap[item.Platform]}:${item.PlatformId} [${item.Status === 'ENABLE' ? '启用' : '禁用'}]`,
|
|
202
|
+
name: `${platformMap[item.Platform]}:${item.PlatformId} [${item.Status === 'ENABLE' ? (0, i18n_1.t)('启用') : (0, i18n_1.t)('禁用')}]`,
|
|
202
203
|
value: item,
|
|
203
204
|
short: `${platformMap[item.Platform]}:${item.PlatformId}`
|
|
204
205
|
}));
|
|
@@ -207,23 +208,23 @@ let UpdateLogin = class UpdateLogin extends common_1.Command {
|
|
|
207
208
|
type: 'list',
|
|
208
209
|
name: 'config',
|
|
209
210
|
choices: configChoices,
|
|
210
|
-
message: '请选择需要配置的条目:'
|
|
211
|
+
message: (0, i18n_1.t)('请选择需要配置的条目:')
|
|
211
212
|
},
|
|
212
213
|
{
|
|
213
214
|
type: 'list',
|
|
214
215
|
name: 'status',
|
|
215
216
|
choices: [
|
|
216
217
|
{
|
|
217
|
-
name: '启用',
|
|
218
|
+
name: (0, i18n_1.t)('启用'),
|
|
218
219
|
value: 'ENABLE'
|
|
219
220
|
},
|
|
220
221
|
{
|
|
221
|
-
name: '禁用',
|
|
222
|
+
name: (0, i18n_1.t)('禁用'),
|
|
222
223
|
value: 'DISABLE'
|
|
223
224
|
}
|
|
224
225
|
],
|
|
225
|
-
message: '请选择登录方式状态:',
|
|
226
|
-
default: '
|
|
226
|
+
message: (0, i18n_1.t)('请选择登录方式状态:'),
|
|
227
|
+
default: 'ENABLE'
|
|
227
228
|
}
|
|
228
229
|
]);
|
|
229
230
|
const platform = config.Platform;
|
|
@@ -234,12 +235,12 @@ let UpdateLogin = class UpdateLogin extends common_1.Command {
|
|
|
234
235
|
{
|
|
235
236
|
type: 'input',
|
|
236
237
|
name: 'appId',
|
|
237
|
-
message: '请输入 AppId(配置状态时可不填):'
|
|
238
|
+
message: (0, i18n_1.t)('请输入 AppId(配置状态时可不填):')
|
|
238
239
|
},
|
|
239
240
|
{
|
|
240
241
|
type: 'input',
|
|
241
242
|
name: 'appSecret',
|
|
242
|
-
message: '请输入 AppSecret(配置状态时可不填):'
|
|
243
|
+
message: (0, i18n_1.t)('请输入 AppSecret(配置状态时可不填):')
|
|
243
244
|
}
|
|
244
245
|
]);
|
|
245
246
|
appId = input === null || input === void 0 ? void 0 : input.appId;
|
|
@@ -252,7 +253,7 @@ let UpdateLogin = class UpdateLogin extends common_1.Command {
|
|
|
252
253
|
appSecret,
|
|
253
254
|
status
|
|
254
255
|
});
|
|
255
|
-
log.success('更新登录方式成功!');
|
|
256
|
+
log.success((0, i18n_1.t)('更新登录方式成功!'));
|
|
256
257
|
});
|
|
257
258
|
}
|
|
258
259
|
};
|