@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/common.js
CHANGED
|
@@ -22,6 +22,7 @@ const toolbox_1 = require("@cloudbase/toolbox");
|
|
|
22
22
|
const utils_1 = require("../utils");
|
|
23
23
|
const auth_1 = require("../auth");
|
|
24
24
|
const report_1 = require("../utils/report");
|
|
25
|
+
const i18n_1 = require("../i18n");
|
|
25
26
|
const registrableCommands = [];
|
|
26
27
|
const cmdMap = new Map();
|
|
27
28
|
const defaultCmdDecoratorOpts = {
|
|
@@ -69,8 +70,8 @@ class Command extends events_1.EventEmitter {
|
|
|
69
70
|
}
|
|
70
71
|
else {
|
|
71
72
|
instance = commander_1.program.command(cmd);
|
|
72
|
-
instance._helpDescription = '输出帮助信息';
|
|
73
|
-
instance.addHelpCommand('help [command]', '查看命令帮助信息');
|
|
73
|
+
instance._helpDescription = (0, i18n_1.t)('输出帮助信息');
|
|
74
|
+
instance.addHelpCommand('help [command]', (0, i18n_1.t)('查看命令帮助信息'));
|
|
74
75
|
cmdMap.set(cmd, instance);
|
|
75
76
|
}
|
|
76
77
|
if (childCmd) {
|
|
@@ -91,7 +92,7 @@ class Command extends events_1.EventEmitter {
|
|
|
91
92
|
}
|
|
92
93
|
else {
|
|
93
94
|
instance = instance.command(cmdName);
|
|
94
|
-
instance._helpDescription = '查看命令帮助信息';
|
|
95
|
+
instance._helpDescription = (0, i18n_1.t)('查看命令帮助信息');
|
|
95
96
|
desc && instance.description(desc);
|
|
96
97
|
cmdMap.set(cmdKey, instance);
|
|
97
98
|
}
|
|
@@ -144,19 +145,19 @@ class Command extends events_1.EventEmitter {
|
|
|
144
145
|
}
|
|
145
146
|
if (!withoutAuth && !loginState) {
|
|
146
147
|
if (autoRunLogin) {
|
|
147
|
-
console.log(chalk_1.default.bold.yellowBright('无有效身份信息,将自动为您打开授权页面。'));
|
|
148
|
+
console.log(chalk_1.default.bold.yellowBright((0, i18n_1.t)('无有效身份信息,将自动为您打开授权页面。')));
|
|
148
149
|
const execResult = yield (0, toolbox_1.execWithLoading)(() => (0, auth_1.login)(), {
|
|
149
|
-
startTip: '请在浏览器中打开的授权页面进行授权...',
|
|
150
|
-
successTip: '授权登录成功!'
|
|
150
|
+
startTip: (0, i18n_1.t)('请在浏览器中打开的授权页面进行授权...'),
|
|
151
|
+
successTip: (0, i18n_1.t)('授权登录成功!')
|
|
151
152
|
});
|
|
152
153
|
loginState = execResult.credential;
|
|
153
154
|
}
|
|
154
155
|
else {
|
|
155
|
-
throw new error_1.CloudBaseError('无有效身份信息,请使用 cloudbase login 登录');
|
|
156
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('无有效身份信息,请使用 cloudbase login 登录'));
|
|
156
157
|
}
|
|
157
158
|
}
|
|
158
159
|
if (!envId && requiredEnvId) {
|
|
159
|
-
throw new error_1.CloudBaseError('未识别到有效的环境 Id,请使用 cloudbaserc 配置文件进行操作或通过 -e 参数指定环境 Id');
|
|
160
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('未识别到有效的环境 Id,请使用 cloudbaserc 配置文件进行操作或通过 -e 参数指定环境 Id'));
|
|
160
161
|
}
|
|
161
162
|
report_1.beaconAction.addAdditionalParams({
|
|
162
163
|
login_uin: loginState === null || loginState === void 0 ? void 0 : loginState['uin'],
|
|
@@ -182,7 +183,7 @@ class Command extends events_1.EventEmitter {
|
|
|
182
183
|
this.emit('preHandle', ctx, args.slice(0, -1));
|
|
183
184
|
yield this.preHandle();
|
|
184
185
|
if (deprecate) {
|
|
185
|
-
console.log(chalk_1.default.bold.yellowBright('\n',
|
|
186
|
+
console.log(chalk_1.default.bold.yellowBright('\n', (0, i18n_1.t)('⚠️ 此命令将被废弃,请使用新的命令 tcb {{cmd}} 代替', { cmd: newCmd })), '\n');
|
|
186
187
|
}
|
|
187
188
|
yield this.execute(ctx);
|
|
188
189
|
this.emit('afterHandle', ctx, args);
|
|
@@ -193,7 +194,7 @@ class Command extends events_1.EventEmitter {
|
|
|
193
194
|
return __awaiter(this, void 0, void 0, function* () {
|
|
194
195
|
const loading = (0, utils_1.loadingFactory)();
|
|
195
196
|
try {
|
|
196
|
-
loading.start('数据加载中...');
|
|
197
|
+
loading.start((0, i18n_1.t)('数据加载中...'));
|
|
197
198
|
const res = yield (0, utils_1.getNotification)();
|
|
198
199
|
loading.stop();
|
|
199
200
|
if (!res)
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.ConfigDeleteCommand = void 0;
|
|
25
|
+
const common_1 = require("../common");
|
|
26
|
+
const decorators_1 = require("../../decorators");
|
|
27
|
+
const config_1 = require("../../utils/store/config");
|
|
28
|
+
const interface_1 = require("./interface");
|
|
29
|
+
const i18n_1 = require("../../i18n");
|
|
30
|
+
let ConfigDeleteCommand = class ConfigDeleteCommand extends common_1.Command {
|
|
31
|
+
get options() {
|
|
32
|
+
return {
|
|
33
|
+
cmd: 'config',
|
|
34
|
+
childCmd: 'delete [key]',
|
|
35
|
+
options: [],
|
|
36
|
+
desc: (0, i18n_1.t)('删除配置'),
|
|
37
|
+
requiredEnvId: false,
|
|
38
|
+
withoutAuth: true
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
execute(params, log) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const [key] = params;
|
|
44
|
+
if (!key) {
|
|
45
|
+
log.warn((0, i18n_1.t)('缺少必要的参数: key'));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const conf = interface_1.CONFIGS[key];
|
|
49
|
+
if (!conf) {
|
|
50
|
+
log.warn((0, i18n_1.t)('未知的配置项: {{key}}', { key }));
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const value = yield config_1.configStore.get(key);
|
|
54
|
+
if (value !== undefined) {
|
|
55
|
+
yield config_1.configStore.delete(key);
|
|
56
|
+
log.log(key);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, decorators_1.InjectParams)(),
|
|
63
|
+
__param(0, (0, decorators_1.ArgsParams)()),
|
|
64
|
+
__param(1, (0, decorators_1.Log)()),
|
|
65
|
+
__metadata("design:type", Function),
|
|
66
|
+
__metadata("design:paramtypes", [Array, decorators_1.Logger]),
|
|
67
|
+
__metadata("design:returntype", Promise)
|
|
68
|
+
], ConfigDeleteCommand.prototype, "execute", null);
|
|
69
|
+
ConfigDeleteCommand = __decorate([
|
|
70
|
+
(0, common_1.ICommand)()
|
|
71
|
+
], ConfigDeleteCommand);
|
|
72
|
+
exports.ConfigDeleteCommand = ConfigDeleteCommand;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.ConfigGetCommand = void 0;
|
|
25
|
+
const common_1 = require("../common");
|
|
26
|
+
const decorators_1 = require("../../decorators");
|
|
27
|
+
const config_1 = require("../../utils/store/config");
|
|
28
|
+
const interface_1 = require("./interface");
|
|
29
|
+
const i18n_1 = require("../../i18n");
|
|
30
|
+
let ConfigGetCommand = class ConfigGetCommand extends common_1.Command {
|
|
31
|
+
get options() {
|
|
32
|
+
return {
|
|
33
|
+
cmd: 'config',
|
|
34
|
+
childCmd: 'get [key]',
|
|
35
|
+
options: [],
|
|
36
|
+
desc: (0, i18n_1.t)('获取配置值'),
|
|
37
|
+
requiredEnvId: false,
|
|
38
|
+
withoutAuth: true
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
execute(params, log) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const [key] = params;
|
|
44
|
+
if (!key) {
|
|
45
|
+
log.warn((0, i18n_1.t)('缺少必要的参数: key'));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const conf = interface_1.CONFIGS[key];
|
|
49
|
+
if (!conf) {
|
|
50
|
+
log.warn((0, i18n_1.t)('未知的配置项: {{key}}', { key }));
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const value = yield config_1.configStore.get(key);
|
|
54
|
+
log.log(value);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, decorators_1.InjectParams)(),
|
|
60
|
+
__param(0, (0, decorators_1.ArgsParams)()),
|
|
61
|
+
__param(1, (0, decorators_1.Log)()),
|
|
62
|
+
__metadata("design:type", Function),
|
|
63
|
+
__metadata("design:paramtypes", [Array, decorators_1.Logger]),
|
|
64
|
+
__metadata("design:returntype", Promise)
|
|
65
|
+
], ConfigGetCommand.prototype, "execute", null);
|
|
66
|
+
ConfigGetCommand = __decorate([
|
|
67
|
+
(0, common_1.ICommand)()
|
|
68
|
+
], ConfigGetCommand);
|
|
69
|
+
exports.ConfigGetCommand = ConfigGetCommand;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./set"), exports);
|
|
18
|
+
__exportStar(require("./get"), exports);
|
|
19
|
+
__exportStar(require("./delete"), exports);
|
|
20
|
+
__exportStar(require("./list"), exports);
|
|
21
|
+
__exportStar(require("./interface"), exports);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_CONFIGS = exports.CONFIGS = void 0;
|
|
4
|
+
const i18n_1 = require("../../i18n");
|
|
5
|
+
exports.CONFIGS = {
|
|
6
|
+
isIntl: {
|
|
7
|
+
key: 'isIntl',
|
|
8
|
+
type: 'boolean',
|
|
9
|
+
value: false,
|
|
10
|
+
description: (0, i18n_1.t)('是否使用国际站'),
|
|
11
|
+
envKey: 'TCB_IS_INTL'
|
|
12
|
+
},
|
|
13
|
+
lang: {
|
|
14
|
+
key: 'lang',
|
|
15
|
+
type: 'string',
|
|
16
|
+
value: 'zh',
|
|
17
|
+
description: (0, i18n_1.t)('语言,可用值:zh(中文), en(English)'),
|
|
18
|
+
envKey: 'TCB_LANG'
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.DEFAULT_CONFIGS = Object.entries(exports.CONFIGS).reduce((acc, [key, config]) => {
|
|
22
|
+
acc[key] = config.value;
|
|
23
|
+
return acc;
|
|
24
|
+
}, {});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.ConfigListCommand = void 0;
|
|
25
|
+
const common_1 = require("../common");
|
|
26
|
+
const decorators_1 = require("../../decorators");
|
|
27
|
+
const config_1 = require("../../utils/store/config");
|
|
28
|
+
const interface_1 = require("./interface");
|
|
29
|
+
const i18n_1 = require("../../i18n");
|
|
30
|
+
let ConfigListCommand = class ConfigListCommand extends common_1.Command {
|
|
31
|
+
get options() {
|
|
32
|
+
return {
|
|
33
|
+
cmd: 'config',
|
|
34
|
+
childCmd: 'list',
|
|
35
|
+
options: [],
|
|
36
|
+
desc: (0, i18n_1.t)('列出所有配置'),
|
|
37
|
+
requiredEnvId: false,
|
|
38
|
+
withoutAuth: true
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
execute(log) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
log.info((0, i18n_1.t)('可用配置:'));
|
|
44
|
+
for (const [key, conf] of Object.entries(interface_1.CONFIGS)) {
|
|
45
|
+
log.log(`${key}: ${conf.description}`);
|
|
46
|
+
}
|
|
47
|
+
log.breakLine();
|
|
48
|
+
const allConfigs = {};
|
|
49
|
+
for (const [key] of Object.entries(interface_1.CONFIGS)) {
|
|
50
|
+
const value = yield config_1.configStore.get(key);
|
|
51
|
+
if (value !== undefined) {
|
|
52
|
+
allConfigs[key] = value;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
log.info((0, i18n_1.t)('当前配置:'));
|
|
56
|
+
for (const [key, value] of Object.entries(allConfigs)) {
|
|
57
|
+
log.log(`${key}: ${value}`);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, decorators_1.InjectParams)(),
|
|
64
|
+
__param(0, (0, decorators_1.Log)()),
|
|
65
|
+
__metadata("design:type", Function),
|
|
66
|
+
__metadata("design:paramtypes", [decorators_1.Logger]),
|
|
67
|
+
__metadata("design:returntype", Promise)
|
|
68
|
+
], ConfigListCommand.prototype, "execute", null);
|
|
69
|
+
ConfigListCommand = __decorate([
|
|
70
|
+
(0, common_1.ICommand)()
|
|
71
|
+
], ConfigListCommand);
|
|
72
|
+
exports.ConfigListCommand = ConfigListCommand;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.ConfigSetCommand = void 0;
|
|
25
|
+
const common_1 = require("../common");
|
|
26
|
+
const decorators_1 = require("../../decorators");
|
|
27
|
+
const config_1 = require("../../utils/store/config");
|
|
28
|
+
const interface_1 = require("./interface");
|
|
29
|
+
const i18n_1 = require("../../i18n");
|
|
30
|
+
let ConfigSetCommand = class ConfigSetCommand extends common_1.Command {
|
|
31
|
+
get options() {
|
|
32
|
+
return {
|
|
33
|
+
cmd: 'config',
|
|
34
|
+
childCmd: 'set [key] [value]',
|
|
35
|
+
options: [],
|
|
36
|
+
desc: (0, i18n_1.t)('设置配置'),
|
|
37
|
+
requiredEnvId: false,
|
|
38
|
+
withoutAuth: true
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
execute(params, log) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const [key, value] = params;
|
|
44
|
+
if (!key || !value) {
|
|
45
|
+
log.warn((0, i18n_1.t)('缺少必要的参数: key 或 value'));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const conf = interface_1.CONFIGS[key];
|
|
49
|
+
if (!conf) {
|
|
50
|
+
log.warn((0, i18n_1.t)('未知的配置项: {{key}}', { key }));
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
let parsedValue = value;
|
|
54
|
+
switch (conf.type) {
|
|
55
|
+
case 'number':
|
|
56
|
+
parsedValue = Number(value);
|
|
57
|
+
if (Number.isNaN(parsedValue)) {
|
|
58
|
+
log.warn((0, i18n_1.t)('{{key}} 预期类型为 {{type}}', { key, type: conf.type }));
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
break;
|
|
62
|
+
case 'boolean':
|
|
63
|
+
if (value === 'true')
|
|
64
|
+
parsedValue = true;
|
|
65
|
+
else if (value === 'false')
|
|
66
|
+
parsedValue = false;
|
|
67
|
+
else {
|
|
68
|
+
log.warn((0, i18n_1.t)('{{key}} 预期类型为 {{type}}', { key, type: conf.type }));
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
yield config_1.configStore.set(key, parsedValue);
|
|
74
|
+
log.log(parsedValue);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, decorators_1.InjectParams)(),
|
|
80
|
+
__param(0, (0, decorators_1.ArgsParams)()),
|
|
81
|
+
__param(1, (0, decorators_1.Log)()),
|
|
82
|
+
__metadata("design:type", Function),
|
|
83
|
+
__metadata("design:paramtypes", [Array, decorators_1.Logger]),
|
|
84
|
+
__metadata("design:returntype", Promise)
|
|
85
|
+
], ConfigSetCommand.prototype, "execute", null);
|
|
86
|
+
ConfigSetCommand = __decorate([
|
|
87
|
+
(0, common_1.ICommand)()
|
|
88
|
+
], ConfigSetCommand);
|
|
89
|
+
exports.ConfigSetCommand = ConfigSetCommand;
|
package/lib/commands/db/base.js
CHANGED
|
@@ -36,6 +36,7 @@ const utils_1 = require("../../utils");
|
|
|
36
36
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
37
37
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
38
38
|
const dts_1 = require("../../utils/dts");
|
|
39
|
+
const i18n_1 = require("../../i18n");
|
|
39
40
|
let DbListCommand = class DbListCommand extends common_1.Command {
|
|
40
41
|
get options() {
|
|
41
42
|
return {
|
|
@@ -44,12 +45,12 @@ let DbListCommand = class DbListCommand extends common_1.Command {
|
|
|
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
51
|
requiredEnvId: false,
|
|
51
52
|
autoRunLogin: true,
|
|
52
|
-
desc: '列出云端所有数据模型',
|
|
53
|
+
desc: (0, i18n_1.t)('列出云端所有数据模型'),
|
|
53
54
|
};
|
|
54
55
|
}
|
|
55
56
|
execute(envId, log) {
|
|
@@ -59,7 +60,7 @@ let DbListCommand = class DbListCommand extends common_1.Command {
|
|
|
59
60
|
envId = yield selectEnv();
|
|
60
61
|
}
|
|
61
62
|
else {
|
|
62
|
-
log.info(
|
|
63
|
+
log.info((0, i18n_1.t)('当前环境 Id:{{envId}}', { envId }));
|
|
63
64
|
}
|
|
64
65
|
if (!(yield fs_extra_1.default.pathExists('cloudbaserc.json'))) {
|
|
65
66
|
yield fs_extra_1.default.writeFile('cloudbaserc.json', JSON.stringify({
|
|
@@ -67,10 +68,10 @@ let DbListCommand = class DbListCommand extends common_1.Command {
|
|
|
67
68
|
envId
|
|
68
69
|
}, null, 2), 'utf8');
|
|
69
70
|
}
|
|
70
|
-
loading.start('数据加载中...');
|
|
71
|
+
loading.start((0, i18n_1.t)('数据加载中...'));
|
|
71
72
|
const data = yield (0, db_1.listModels)({ envId });
|
|
72
73
|
loading.stop();
|
|
73
|
-
const head = ['名称', '标识', '创建时间'];
|
|
74
|
+
const head = [(0, i18n_1.t)('名称'), (0, i18n_1.t)('标识'), (0, i18n_1.t)('创建时间')];
|
|
74
75
|
const sortData = data.sort((prev, next) => {
|
|
75
76
|
if (prev.Alias > next.Alias) {
|
|
76
77
|
return 1;
|
|
@@ -109,20 +110,20 @@ let DbPullCommand = class DbPullCommand extends common_1.Command {
|
|
|
109
110
|
options: [
|
|
110
111
|
{
|
|
111
112
|
flags: '-e, --envId <envId>',
|
|
112
|
-
desc: '环境 Id'
|
|
113
|
+
desc: (0, i18n_1.t)('环境 Id')
|
|
113
114
|
},
|
|
114
115
|
{
|
|
115
116
|
flags: '-d, --dir <dir>',
|
|
116
|
-
desc: '本地存储数据库模型定义的目录,默认为 database-schemas'
|
|
117
|
+
desc: (0, i18n_1.t)('本地存储数据库模型定义的目录,默认为 database-schemas')
|
|
117
118
|
},
|
|
118
119
|
{
|
|
119
120
|
flags: '-n, --name <name>',
|
|
120
|
-
desc: '要拉取的模型英文标识列表,可指定多个,使用逗号分隔.不指定的情况下默认会拉取所有模型'
|
|
121
|
+
desc: (0, i18n_1.t)('要拉取的模型英文标识列表,可指定多个,使用逗号分隔.不指定的情况下默认会拉取所有模型')
|
|
121
122
|
}
|
|
122
123
|
],
|
|
123
124
|
requiredEnvId: false,
|
|
124
125
|
autoRunLogin: true,
|
|
125
|
-
desc: '从云端拉取多个数据模型到本地',
|
|
126
|
+
desc: (0, i18n_1.t)('从云端拉取多个数据模型到本地'),
|
|
126
127
|
};
|
|
127
128
|
}
|
|
128
129
|
execute(envId, params, log) {
|
|
@@ -143,7 +144,7 @@ let DbPullCommand = class DbPullCommand extends common_1.Command {
|
|
|
143
144
|
envId = yield selectEnv();
|
|
144
145
|
}
|
|
145
146
|
else {
|
|
146
|
-
log.info(
|
|
147
|
+
log.info((0, i18n_1.t)('当前环境 Id:{{envId}}', { envId }));
|
|
147
148
|
}
|
|
148
149
|
if (!(yield fs_extra_1.default.pathExists('cloudbaserc.json'))) {
|
|
149
150
|
yield fs_extra_1.default.writeFile('cloudbaserc.json', JSON.stringify({
|
|
@@ -177,13 +178,13 @@ let DbPullCommand = class DbPullCommand extends common_1.Command {
|
|
|
177
178
|
dataModelList.forEach((item) => {
|
|
178
179
|
const fileName = `${dir}/${item.name}.json`;
|
|
179
180
|
fs_extra_1.default.writeFileSync(fileName, JSON.stringify(item.schema, null, 4));
|
|
180
|
-
log.success(
|
|
181
|
+
log.success((0, i18n_1.t)('同步数据模型成功。文件名称:{{fileName}}', { fileName }));
|
|
181
182
|
});
|
|
182
183
|
}
|
|
183
184
|
const dts = yield (0, dts_1.generateDataModelDTS)(dataModelList);
|
|
184
185
|
const dtsFileName = 'cloud-models.d.ts';
|
|
185
186
|
yield fs_extra_1.default.writeFile(dtsFileName, dts);
|
|
186
|
-
log.success('同步数据模型类型定义文件成功,调用 SDK 时可支持智能字段提示。文件名称:'
|
|
187
|
+
log.success((0, i18n_1.t)('同步数据模型类型定义文件成功,调用 SDK 时可支持智能字段提示。文件名称:{{dtsFileName}}', { dtsFileName }));
|
|
187
188
|
});
|
|
188
189
|
}
|
|
189
190
|
};
|
|
@@ -208,20 +209,20 @@ let DbPushCommand = class DbPushCommand extends common_1.Command {
|
|
|
208
209
|
options: [
|
|
209
210
|
{
|
|
210
211
|
flags: '-e, --envId <envId>',
|
|
211
|
-
desc: '环境 Id'
|
|
212
|
+
desc: (0, i18n_1.t)('环境 Id')
|
|
212
213
|
},
|
|
213
214
|
{
|
|
214
215
|
flags: '-d, --dir <dir>',
|
|
215
|
-
desc: '本地存储数据库模型定义的目录,默认为 database-schemas'
|
|
216
|
+
desc: (0, i18n_1.t)('本地存储数据库模型定义的目录,默认为 database-schemas')
|
|
216
217
|
},
|
|
217
218
|
{
|
|
218
219
|
flags: '-n, --name <name>',
|
|
219
|
-
desc: '要推送的模型名称列表,可指定多个,使用逗号分隔.不指定的情况下默认会推送本地目录下的所有数据模型'
|
|
220
|
+
desc: (0, i18n_1.t)('要推送的模型名称列表,可指定多个,使用逗号分隔.不指定的情况下默认会推送本地目录下的所有数据模型')
|
|
220
221
|
}
|
|
221
222
|
],
|
|
222
223
|
requiredEnvId: false,
|
|
223
224
|
autoRunLogin: true,
|
|
224
|
-
desc: '将本地数据模型推送到云端',
|
|
225
|
+
desc: (0, i18n_1.t)('将本地数据模型推送到云端'),
|
|
225
226
|
};
|
|
226
227
|
}
|
|
227
228
|
execute(envId, params, log) {
|
|
@@ -230,25 +231,25 @@ let DbPushCommand = class DbPushCommand extends common_1.Command {
|
|
|
230
231
|
envId = yield selectEnv();
|
|
231
232
|
}
|
|
232
233
|
else {
|
|
233
|
-
log.info(
|
|
234
|
+
log.info((0, i18n_1.t)('使用环境 Id:{{envId}}', { envId }));
|
|
234
235
|
}
|
|
235
236
|
let { name = '', dir } = params;
|
|
236
237
|
name = name.split(',').map(item => item.trim()).filter(item => item);
|
|
237
238
|
if (!dir) {
|
|
238
239
|
dir = 'database-schemas';
|
|
239
240
|
if (!fs_extra_1.default.existsSync(dir)) {
|
|
240
|
-
throw new error_1.CloudBaseError(
|
|
241
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('目录 {{dir}} 不存在,请指定正确的目录', { dir }));
|
|
241
242
|
}
|
|
242
243
|
}
|
|
243
244
|
if (!name.length) {
|
|
244
245
|
name = fs_extra_1.default.readdirSync(dir).map(item => item.replace('.json', ''));
|
|
245
246
|
}
|
|
246
247
|
if (!name.length) {
|
|
247
|
-
throw new error_1.CloudBaseError(
|
|
248
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('目录 {{dir}} 中没有找到任何数据模型', { dir }));
|
|
248
249
|
}
|
|
249
250
|
const ids = [];
|
|
250
251
|
for (const modelName of name) {
|
|
251
|
-
log.info(
|
|
252
|
+
log.info((0, i18n_1.t)('开始检查数据模型 {{modelName}}', { modelName }));
|
|
252
253
|
const modelPath = path_1.default.join(process.cwd(), dir, `${modelName}.json`);
|
|
253
254
|
const model = require(modelPath);
|
|
254
255
|
const existModel = yield (0, db_1.getModel)({
|
|
@@ -260,11 +261,11 @@ let DbPushCommand = class DbPushCommand extends common_1.Command {
|
|
|
260
261
|
{
|
|
261
262
|
type: 'confirm',
|
|
262
263
|
name: 'confirm',
|
|
263
|
-
message:
|
|
264
|
+
message: (0, i18n_1.t)('数据模型 {{modelName}} 已存在,是否更新?', { modelName })
|
|
264
265
|
}
|
|
265
266
|
]);
|
|
266
267
|
if (!confirm.confirm) {
|
|
267
|
-
log.info(
|
|
268
|
+
log.info((0, i18n_1.t)('跳过更新数据模型 {{modelName}}', { modelName }));
|
|
268
269
|
continue;
|
|
269
270
|
}
|
|
270
271
|
yield (0, db_1.updateModel)({
|
|
@@ -274,19 +275,19 @@ let DbPushCommand = class DbPushCommand extends common_1.Command {
|
|
|
274
275
|
schema: model
|
|
275
276
|
});
|
|
276
277
|
ids.push(existModel.Id);
|
|
277
|
-
const link = (0, utils_1.genClickableLink)(
|
|
278
|
-
log.success(
|
|
278
|
+
const link = (0, utils_1.genClickableLink)(`${utils_1.EUrl.CloudAdmin}/#/management/data-model/${existModel.Id}`);
|
|
279
|
+
log.success((0, i18n_1.t)('更新数据模型 {{modelName}} 成功,点击查看 {{link}}', { modelName, link }));
|
|
279
280
|
}
|
|
280
281
|
else {
|
|
281
282
|
const confirm = yield inquirer_1.default.prompt([
|
|
282
283
|
{
|
|
283
284
|
type: 'confirm',
|
|
284
285
|
name: 'confirm',
|
|
285
|
-
message:
|
|
286
|
+
message: (0, i18n_1.t)('数据模型 {{modelName}} 不存在,是否创建?', { modelName })
|
|
286
287
|
}
|
|
287
288
|
]);
|
|
288
289
|
if (!confirm.confirm) {
|
|
289
|
-
log.info(
|
|
290
|
+
log.info((0, i18n_1.t)('跳过创建数据模型 {{modelName}}', { modelName }));
|
|
290
291
|
continue;
|
|
291
292
|
}
|
|
292
293
|
const createModelRes = yield (0, db_1.createModel)({
|
|
@@ -296,15 +297,15 @@ let DbPushCommand = class DbPushCommand extends common_1.Command {
|
|
|
296
297
|
schema: model
|
|
297
298
|
});
|
|
298
299
|
ids.push(createModelRes.Id);
|
|
299
|
-
const link = (0, utils_1.genClickableLink)(
|
|
300
|
-
log.success(
|
|
300
|
+
const link = (0, utils_1.genClickableLink)(`${utils_1.EUrl.CloudAdmin}/#/management/data-model/${createModelRes.Id}}`);
|
|
301
|
+
log.success((0, i18n_1.t)('创建数据模型 {{modelName}} 成功, 点击查看 {{link}}', { modelName, link }));
|
|
301
302
|
}
|
|
302
303
|
}
|
|
303
304
|
const confirmPublish = yield inquirer_1.default.prompt([
|
|
304
305
|
{
|
|
305
306
|
type: 'confirm',
|
|
306
307
|
name: 'confirm',
|
|
307
|
-
message:
|
|
308
|
+
message: (0, i18n_1.t)('数据模型已经导入成功,是否发布?')
|
|
308
309
|
}
|
|
309
310
|
]);
|
|
310
311
|
if (confirmPublish.confirm) {
|
|
@@ -343,7 +344,7 @@ function selectEnv() {
|
|
|
343
344
|
});
|
|
344
345
|
const choices = sortData.map((item) => {
|
|
345
346
|
return {
|
|
346
|
-
name: `${item.Alias || item.EnvId} (${item.EnvId}) ${item.Status === 'NORMAL' ? '正常' : '不可用'}`,
|
|
347
|
+
name: `${item.Alias || item.EnvId} (${item.EnvId}) ${item.Status === 'NORMAL' ? (0, i18n_1.t)('正常') : (0, i18n_1.t)('不可用')}`,
|
|
347
348
|
value: item.EnvId,
|
|
348
349
|
short: item.envId
|
|
349
350
|
};
|
|
@@ -352,7 +353,7 @@ function selectEnv() {
|
|
|
352
353
|
{
|
|
353
354
|
type: 'list',
|
|
354
355
|
name: 'env',
|
|
355
|
-
message: '请先选择一个云开发环境',
|
|
356
|
+
message: (0, i18n_1.t)('请先选择一个云开发环境'),
|
|
356
357
|
choices: choices
|
|
357
358
|
}
|
|
358
359
|
];
|
|
@@ -385,7 +386,7 @@ function selectModel(envId) {
|
|
|
385
386
|
{
|
|
386
387
|
type: 'checkbox',
|
|
387
388
|
name: 'model',
|
|
388
|
-
message: '请选择数据模型',
|
|
389
|
+
message: (0, i18n_1.t)('请选择数据模型'),
|
|
389
390
|
choices: choices
|
|
390
391
|
}
|
|
391
392
|
];
|