@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
package/lib/commands/common.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -34,26 +25,24 @@ function ICommand(options = defaultCmdDecoratorOpts) {
|
|
|
34
25
|
};
|
|
35
26
|
}
|
|
36
27
|
exports.ICommand = ICommand;
|
|
37
|
-
function registerCommands() {
|
|
28
|
+
async function registerCommands() {
|
|
38
29
|
var _a, _b;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
command.init();
|
|
48
|
-
}
|
|
30
|
+
const args = (0, yargs_parser_1.default)(process.argv.slice(2));
|
|
31
|
+
const config = await (0, utils_1.getCloudBaseConfig)(args.configFile);
|
|
32
|
+
const isPrivate = (0, utils_1.getPrivateSettings)(config, (_b = (_a = args === null || args === void 0 ? void 0 : args._) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.toString());
|
|
33
|
+
registrableCommands.forEach(({ Command, decoratorOptions }) => {
|
|
34
|
+
if (isPrivate) {
|
|
35
|
+
if (decoratorOptions.supportPrivate) {
|
|
36
|
+
const command = new Command();
|
|
37
|
+
command.init();
|
|
49
38
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
if (decoratorOptions.supportPrivate !== 'only') {
|
|
42
|
+
const command = new Command();
|
|
43
|
+
command.init();
|
|
55
44
|
}
|
|
56
|
-
}
|
|
45
|
+
}
|
|
57
46
|
});
|
|
58
47
|
}
|
|
59
48
|
exports.registerCommands = registerCommands;
|
|
@@ -129,11 +118,11 @@ class Command extends events_1.EventEmitter {
|
|
|
129
118
|
}
|
|
130
119
|
});
|
|
131
120
|
instance.description(desc);
|
|
132
|
-
instance.action((...args) =>
|
|
121
|
+
instance.action(async (...args) => {
|
|
133
122
|
const params = args.slice(0, -1);
|
|
134
123
|
const cmdOptions = instance.opts();
|
|
135
124
|
const parentOptions = commander_1.program.opts();
|
|
136
|
-
const config =
|
|
125
|
+
const config = await (0, utils_1.getCloudBaseConfig)(parentOptions === null || parentOptions === void 0 ? void 0 : parentOptions.configFile);
|
|
137
126
|
const envId = (cmdOptions === null || cmdOptions === void 0 ? void 0 : cmdOptions.envId) || (config === null || config === void 0 ? void 0 : config.envId);
|
|
138
127
|
const privateSettings = (0, utils_1.getPrivateSettings)(config, cmd);
|
|
139
128
|
let loginState;
|
|
@@ -141,12 +130,12 @@ class Command extends events_1.EventEmitter {
|
|
|
141
130
|
loginState = privateSettings.credential;
|
|
142
131
|
}
|
|
143
132
|
else {
|
|
144
|
-
loginState = (
|
|
133
|
+
loginState = (await utils_1.authSupevisor.getLoginState());
|
|
145
134
|
}
|
|
146
135
|
if (!withoutAuth && !loginState) {
|
|
147
136
|
if (autoRunLogin) {
|
|
148
137
|
console.log(chalk_1.default.bold.yellowBright((0, i18n_1.t)('无有效身份信息,将自动为您打开授权页面。')));
|
|
149
|
-
const execResult =
|
|
138
|
+
const execResult = await (0, toolbox_1.execWithLoading)(() => (0, auth_1.login)(), {
|
|
150
139
|
startTip: (0, i18n_1.t)('请在浏览器中打开的授权页面进行授权...'),
|
|
151
140
|
successTip: (0, i18n_1.t)('授权登录成功!')
|
|
152
141
|
});
|
|
@@ -164,7 +153,7 @@ class Command extends events_1.EventEmitter {
|
|
|
164
153
|
envId: envId || (loginState === null || loginState === void 0 ? void 0 : loginState['envId'])
|
|
165
154
|
});
|
|
166
155
|
try {
|
|
167
|
-
|
|
156
|
+
await report_1.beaconAction.report('tcb_cli_exec_command', {
|
|
168
157
|
cmd,
|
|
169
158
|
childCmd,
|
|
170
159
|
desc
|
|
@@ -181,45 +170,41 @@ class Command extends events_1.EventEmitter {
|
|
|
181
170
|
hasPrivateSettings: Boolean(privateSettings)
|
|
182
171
|
};
|
|
183
172
|
this.emit('preHandle', ctx, args.slice(0, -1));
|
|
184
|
-
|
|
173
|
+
await this.preHandle();
|
|
185
174
|
if (deprecate) {
|
|
186
175
|
console.log(chalk_1.default.bold.yellowBright('\n', (0, i18n_1.t)('⚠️ 此命令将被废弃,请使用新的命令 tcb {{cmd}} 代替', { cmd: newCmd })), '\n');
|
|
187
176
|
}
|
|
188
|
-
|
|
177
|
+
await this.execute(ctx);
|
|
189
178
|
this.emit('afterHandle', ctx, args);
|
|
190
179
|
this.afterHandle(ctx);
|
|
191
|
-
}));
|
|
192
|
-
}
|
|
193
|
-
preHandle() {
|
|
194
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
195
|
-
const loading = (0, utils_1.loadingFactory)();
|
|
196
|
-
try {
|
|
197
|
-
loading.start((0, i18n_1.t)('数据加载中...'));
|
|
198
|
-
const res = yield (0, utils_1.getNotification)();
|
|
199
|
-
loading.stop();
|
|
200
|
-
if (!res)
|
|
201
|
-
return;
|
|
202
|
-
const { title, content } = res;
|
|
203
|
-
console.log(chalk_1.default.bold.cyan(title));
|
|
204
|
-
console.log(content, '\n');
|
|
205
|
-
}
|
|
206
|
-
catch (e) {
|
|
207
|
-
loading.stop();
|
|
208
|
-
}
|
|
209
180
|
});
|
|
210
181
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
}
|
|
182
|
+
async preHandle() {
|
|
183
|
+
const loading = (0, utils_1.loadingFactory)();
|
|
184
|
+
try {
|
|
185
|
+
loading.start((0, i18n_1.t)('数据加载中...'));
|
|
186
|
+
const res = await (0, utils_1.getNotification)();
|
|
187
|
+
loading.stop();
|
|
188
|
+
if (!res)
|
|
189
|
+
return;
|
|
190
|
+
const { title, content } = res;
|
|
191
|
+
console.log(chalk_1.default.bold.cyan(title));
|
|
192
|
+
console.log(content, '\n');
|
|
193
|
+
}
|
|
194
|
+
catch (e) {
|
|
195
|
+
loading.stop();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
async afterHandle(ctx) {
|
|
199
|
+
try {
|
|
200
|
+
const { cmd } = ctx;
|
|
201
|
+
const agree = await utils_1.usageStore.get('agreeCollect');
|
|
202
|
+
if (!agree)
|
|
203
|
+
return;
|
|
204
|
+
await (0, utils_1.collectUsage)(cmd);
|
|
205
|
+
}
|
|
206
|
+
catch (e) {
|
|
207
|
+
}
|
|
223
208
|
}
|
|
224
209
|
}
|
|
225
210
|
exports.Command = Command;
|
|
@@ -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.ConfigDeleteCommand = void 0;
|
|
25
16
|
const common_1 = require("../common");
|
|
@@ -38,24 +29,22 @@ let ConfigDeleteCommand = class ConfigDeleteCommand extends common_1.Command {
|
|
|
38
29
|
withoutAuth: true
|
|
39
30
|
};
|
|
40
31
|
}
|
|
41
|
-
execute(params, log) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
});
|
|
32
|
+
async execute(params, log) {
|
|
33
|
+
const [key] = params;
|
|
34
|
+
if (!key) {
|
|
35
|
+
log.warn((0, i18n_1.t)('缺少必要的参数: key'));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const conf = interface_1.CONFIGS[key];
|
|
39
|
+
if (!conf) {
|
|
40
|
+
log.warn((0, i18n_1.t)('未知的配置项: {{key}}', { key }));
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const value = await config_1.configStore.get(key);
|
|
44
|
+
if (value !== undefined) {
|
|
45
|
+
await config_1.configStore.delete(key);
|
|
46
|
+
log.log(key);
|
|
47
|
+
}
|
|
59
48
|
}
|
|
60
49
|
};
|
|
61
50
|
__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.ConfigGetCommand = void 0;
|
|
25
16
|
const common_1 = require("../common");
|
|
@@ -38,21 +29,19 @@ let ConfigGetCommand = class ConfigGetCommand extends common_1.Command {
|
|
|
38
29
|
withoutAuth: true
|
|
39
30
|
};
|
|
40
31
|
}
|
|
41
|
-
execute(params, log) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
log.log(value);
|
|
55
|
-
});
|
|
32
|
+
async execute(params, log) {
|
|
33
|
+
const [key] = params;
|
|
34
|
+
if (!key) {
|
|
35
|
+
log.warn((0, i18n_1.t)('缺少必要的参数: key'));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const conf = interface_1.CONFIGS[key];
|
|
39
|
+
if (!conf) {
|
|
40
|
+
log.warn((0, i18n_1.t)('未知的配置项: {{key}}', { key }));
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
const value = await config_1.configStore.get(key);
|
|
44
|
+
log.log(value);
|
|
56
45
|
}
|
|
57
46
|
};
|
|
58
47
|
__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.ConfigListCommand = void 0;
|
|
25
16
|
const common_1 = require("../common");
|
|
@@ -38,25 +29,23 @@ let ConfigListCommand = class ConfigListCommand extends common_1.Command {
|
|
|
38
29
|
withoutAuth: true
|
|
39
30
|
};
|
|
40
31
|
}
|
|
41
|
-
execute(log) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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}`);
|
|
32
|
+
async execute(log) {
|
|
33
|
+
log.info((0, i18n_1.t)('可用配置:'));
|
|
34
|
+
for (const [key, conf] of Object.entries(interface_1.CONFIGS)) {
|
|
35
|
+
log.log(`${key}: ${conf.description}`);
|
|
36
|
+
}
|
|
37
|
+
log.breakLine();
|
|
38
|
+
const allConfigs = {};
|
|
39
|
+
for (const [key] of Object.entries(interface_1.CONFIGS)) {
|
|
40
|
+
const value = await config_1.configStore.get(key);
|
|
41
|
+
if (value !== undefined) {
|
|
42
|
+
allConfigs[key] = value;
|
|
58
43
|
}
|
|
59
|
-
}
|
|
44
|
+
}
|
|
45
|
+
log.info((0, i18n_1.t)('当前配置:'));
|
|
46
|
+
for (const [key, value] of Object.entries(allConfigs)) {
|
|
47
|
+
log.log(`${key}: ${value}`);
|
|
48
|
+
}
|
|
60
49
|
}
|
|
61
50
|
};
|
|
62
51
|
__decorate([
|
|
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
15
|
exports.ConfigSetCommand = void 0;
|
|
25
16
|
const common_1 = require("../common");
|
|
@@ -38,41 +29,39 @@ let ConfigSetCommand = class ConfigSetCommand extends common_1.Command {
|
|
|
38
29
|
withoutAuth: true
|
|
39
30
|
};
|
|
40
31
|
}
|
|
41
|
-
execute(params, log) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
log.log(parsedValue);
|
|
75
|
-
});
|
|
32
|
+
async execute(params, log) {
|
|
33
|
+
const [key, value] = params;
|
|
34
|
+
if (!key || !value) {
|
|
35
|
+
log.warn((0, i18n_1.t)('缺少必要的参数: key 或 value'));
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const conf = interface_1.CONFIGS[key];
|
|
39
|
+
if (!conf) {
|
|
40
|
+
log.warn((0, i18n_1.t)('未知的配置项: {{key}}', { key }));
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
let parsedValue = value;
|
|
44
|
+
switch (conf.type) {
|
|
45
|
+
case 'number':
|
|
46
|
+
parsedValue = Number(value);
|
|
47
|
+
if (Number.isNaN(parsedValue)) {
|
|
48
|
+
log.warn((0, i18n_1.t)('{{key}} 预期类型为 {{type}}', { key, type: conf.type }));
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
break;
|
|
52
|
+
case 'boolean':
|
|
53
|
+
if (value === 'true')
|
|
54
|
+
parsedValue = true;
|
|
55
|
+
else if (value === 'false')
|
|
56
|
+
parsedValue = false;
|
|
57
|
+
else {
|
|
58
|
+
log.warn((0, i18n_1.t)('{{key}} 预期类型为 {{type}}', { key, type: conf.type }));
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
await config_1.configStore.set(key, parsedValue);
|
|
64
|
+
log.log(parsedValue);
|
|
76
65
|
}
|
|
77
66
|
};
|
|
78
67
|
__decorate([
|