@cloudbase/cli 2.10.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
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
24
15
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
25
16
|
};
|
|
@@ -51,24 +42,22 @@ let ListAuthDoaminCommand = class ListAuthDoaminCommand extends common_1.Command
|
|
|
51
42
|
desc: (0, i18n_1.t)('列出环境的安全域名列表')
|
|
52
43
|
};
|
|
53
44
|
}
|
|
54
|
-
execute(envId) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
envId: envId
|
|
58
|
-
});
|
|
59
|
-
if (domains.length === 0) {
|
|
60
|
-
console.log((0, i18n_1.t)('安全域名为空!'));
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
const head = [(0, i18n_1.t)('域名 Id'), (0, i18n_1.t)('域名'), (0, i18n_1.t)('创建时间'), (0, i18n_1.t)('状态')];
|
|
64
|
-
const tableData = domains.map((item) => [
|
|
65
|
-
item.Id,
|
|
66
|
-
item.Domain,
|
|
67
|
-
item.CreateTime,
|
|
68
|
-
item.Status === 'ENABLE' ? (0, i18n_1.t)('启用中') : (0, i18n_1.t)('禁用中')
|
|
69
|
-
]);
|
|
70
|
-
(0, utils_1.printHorizontalTable)(head, tableData);
|
|
45
|
+
async execute(envId) {
|
|
46
|
+
const domains = await (0, env_1.getEnvAuthDomains)({
|
|
47
|
+
envId: envId
|
|
71
48
|
});
|
|
49
|
+
if (domains.length === 0) {
|
|
50
|
+
console.log((0, i18n_1.t)('安全域名为空!'));
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const head = [(0, i18n_1.t)('域名 Id'), (0, i18n_1.t)('域名'), (0, i18n_1.t)('创建时间'), (0, i18n_1.t)('状态')];
|
|
54
|
+
const tableData = domains.map((item) => [
|
|
55
|
+
item.Id,
|
|
56
|
+
item.Domain,
|
|
57
|
+
item.CreateTime,
|
|
58
|
+
item.Status === 'ENABLE' ? (0, i18n_1.t)('启用中') : (0, i18n_1.t)('禁用中')
|
|
59
|
+
]);
|
|
60
|
+
(0, utils_1.printHorizontalTable)(head, tableData);
|
|
72
61
|
}
|
|
73
62
|
};
|
|
74
63
|
__decorate([
|
|
@@ -101,39 +90,37 @@ let CreateAuthDomainCommand = class CreateAuthDomainCommand extends common_1.Com
|
|
|
101
90
|
desc: (0, i18n_1.t)('添加环境安全域名,多个以斜杠 / 分隔')
|
|
102
91
|
};
|
|
103
92
|
}
|
|
104
|
-
execute(params, envId, log) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
exitDomains.push(item);
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
if (exitDomains.length) {
|
|
129
|
-
throw new error_1.CloudBaseError((0, i18n_1.t)('域名 [{{domains}}] 已存在!', { domains: exitDomains.join(', ') }));
|
|
93
|
+
async execute(params, envId, log) {
|
|
94
|
+
log.verbose(params);
|
|
95
|
+
const domain = params === null || params === void 0 ? void 0 : params[0];
|
|
96
|
+
const domains = domain.split('/');
|
|
97
|
+
const { confirm } = await inquirer_1.default.prompt({
|
|
98
|
+
type: 'confirm',
|
|
99
|
+
name: 'confirm',
|
|
100
|
+
message: (0, i18n_1.t)('确认添加以下安全域名: {{domains}} ?', { domains }),
|
|
101
|
+
default: true
|
|
102
|
+
});
|
|
103
|
+
if (!confirm) {
|
|
104
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('操作终止!'));
|
|
105
|
+
}
|
|
106
|
+
let envDomains = await (0, env_1.getEnvAuthDomains)({
|
|
107
|
+
envId
|
|
108
|
+
});
|
|
109
|
+
envDomains = envDomains.map((item) => item.Domain);
|
|
110
|
+
const exitDomains = [];
|
|
111
|
+
domains.forEach((item) => {
|
|
112
|
+
if (envDomains.includes(item)) {
|
|
113
|
+
exitDomains.push(item);
|
|
130
114
|
}
|
|
131
|
-
yield (0, env_1.createEnvDomain)({
|
|
132
|
-
envId,
|
|
133
|
-
domains: domains
|
|
134
|
-
});
|
|
135
|
-
log.success((0, i18n_1.t)('添加安全域名成功!'));
|
|
136
115
|
});
|
|
116
|
+
if (exitDomains.length) {
|
|
117
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('域名 [{{domains}}] 已存在!', { domains: exitDomains.join(', ') }));
|
|
118
|
+
}
|
|
119
|
+
await (0, env_1.createEnvDomain)({
|
|
120
|
+
envId,
|
|
121
|
+
domains: domains
|
|
122
|
+
});
|
|
123
|
+
log.success((0, i18n_1.t)('添加安全域名成功!'));
|
|
137
124
|
}
|
|
138
125
|
};
|
|
139
126
|
__decorate([
|
|
@@ -168,44 +155,42 @@ let DeleteAuthDomainCommand = class DeleteAuthDomainCommand extends common_1.Com
|
|
|
168
155
|
desc: (0, i18n_1.t)('删除环境的安全域名')
|
|
169
156
|
};
|
|
170
157
|
}
|
|
171
|
-
execute(envId, log) {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
envId
|
|
206
|
-
});
|
|
207
|
-
log.success((0, i18n_1.t)('成功删除了 {{count}} 个域名!', { count: deleted }));
|
|
158
|
+
async execute(envId, log) {
|
|
159
|
+
const loading = (0, utils_1.loadingFactory)();
|
|
160
|
+
loading.start((0, i18n_1.t)('拉取环境安全域名中'));
|
|
161
|
+
const domains = await (0, env_1.getEnvAuthDomains)({
|
|
162
|
+
envId
|
|
163
|
+
});
|
|
164
|
+
if (domains.length === 0) {
|
|
165
|
+
loading.fail((0, i18n_1.t)('域名安全为空,不能执行删除操作!'));
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
loading.succeed((0, i18n_1.t)('拉取环境安全域名成功!'));
|
|
169
|
+
const domainList = domains.map((item) => item.Domain);
|
|
170
|
+
const { selectDomains } = await inquirer_1.default.prompt({
|
|
171
|
+
type: 'checkbox',
|
|
172
|
+
name: 'selectDomains',
|
|
173
|
+
message: (0, i18n_1.t)('请选择需要删除的域名(可多选)>'),
|
|
174
|
+
choices: domainList,
|
|
175
|
+
default: true
|
|
176
|
+
});
|
|
177
|
+
const { confirm } = await inquirer_1.default.prompt({
|
|
178
|
+
type: 'confirm',
|
|
179
|
+
name: 'confirm',
|
|
180
|
+
message: (0, i18n_1.t)('确认删除以下安全域名: {{domains}} ?', { domains: selectDomains }),
|
|
181
|
+
default: true
|
|
182
|
+
});
|
|
183
|
+
if (!confirm) {
|
|
184
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('操作终止!'));
|
|
185
|
+
}
|
|
186
|
+
const domainIds = domains
|
|
187
|
+
.filter((item) => selectDomains.includes(item.Domain))
|
|
188
|
+
.map((item) => item.Id);
|
|
189
|
+
const deleted = await (0, env_1.deleteEnvDomain)({
|
|
190
|
+
domainIds,
|
|
191
|
+
envId
|
|
208
192
|
});
|
|
193
|
+
log.success((0, i18n_1.t)('成功删除了 {{count}} 个域名!', { count: deleted }));
|
|
209
194
|
}
|
|
210
195
|
};
|
|
211
196
|
__decorate([
|
|
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
14
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
24
15
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
25
16
|
};
|
|
@@ -56,20 +47,18 @@ let ListLoginCommand = class ListLoginCommand extends common_1.Command {
|
|
|
56
47
|
desc: (0, i18n_1.t)('列出环境登录配置')
|
|
57
48
|
};
|
|
58
49
|
}
|
|
59
|
-
execute(envId) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
envId
|
|
63
|
-
});
|
|
64
|
-
const head = [(0, i18n_1.t)('平台'), (0, i18n_1.t)('平台 Id'), (0, i18n_1.t)('创建时间'), (0, i18n_1.t)('状态')];
|
|
65
|
-
const tableData = configList.map((item) => [
|
|
66
|
-
platformMap[item.Platform] ? platformMap[item.Platform] : item.Platform,
|
|
67
|
-
item.PlatformId,
|
|
68
|
-
item.CreateTime,
|
|
69
|
-
item.Status === 'ENABLE' ? (0, i18n_1.t)('启用') : (0, i18n_1.t)('禁用')
|
|
70
|
-
]);
|
|
71
|
-
(0, utils_1.printHorizontalTable)(head, tableData);
|
|
50
|
+
async execute(envId) {
|
|
51
|
+
const configList = await (0, env_1.getLoginConfigList)({
|
|
52
|
+
envId
|
|
72
53
|
});
|
|
54
|
+
const head = [(0, i18n_1.t)('平台'), (0, i18n_1.t)('平台 Id'), (0, i18n_1.t)('创建时间'), (0, i18n_1.t)('状态')];
|
|
55
|
+
const tableData = configList.map((item) => [
|
|
56
|
+
platformMap[item.Platform] ? platformMap[item.Platform] : item.Platform,
|
|
57
|
+
item.PlatformId,
|
|
58
|
+
item.CreateTime,
|
|
59
|
+
item.Status === 'ENABLE' ? (0, i18n_1.t)('启用') : (0, i18n_1.t)('禁用')
|
|
60
|
+
]);
|
|
61
|
+
(0, utils_1.printHorizontalTable)(head, tableData);
|
|
73
62
|
}
|
|
74
63
|
};
|
|
75
64
|
__decorate([
|
|
@@ -99,70 +88,68 @@ let CreateLoginCommand = class CreateLoginCommand extends common_1.Command {
|
|
|
99
88
|
desc: (0, i18n_1.t)('添加环境登录方式配置')
|
|
100
89
|
};
|
|
101
90
|
}
|
|
102
|
-
execute(envId, log) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
name: (0, i18n_1.t)('微信开放平台'),
|
|
115
|
-
value: 'WECHAT-OPEN'
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
name: (0, i18n_1.t)('匿名登录'),
|
|
119
|
-
value: 'ANONYMOUS'
|
|
120
|
-
}
|
|
121
|
-
],
|
|
122
|
-
message: (0, i18n_1.t)('请选择登录方式:'),
|
|
123
|
-
default: 'WECHAT-PUBLIC'
|
|
124
|
-
}
|
|
125
|
-
]);
|
|
126
|
-
let appId;
|
|
127
|
-
let appSecret;
|
|
128
|
-
if (platform === 'WECHAT-OPEN' || platform === 'WECHAT-PUBLIC') {
|
|
129
|
-
const input = yield inquirer_1.default.prompt([
|
|
91
|
+
async execute(envId, log) {
|
|
92
|
+
const { platform } = await inquirer_1.default.prompt([
|
|
93
|
+
{
|
|
94
|
+
type: 'list',
|
|
95
|
+
name: 'platform',
|
|
96
|
+
choices: [
|
|
97
|
+
{
|
|
98
|
+
name: (0, i18n_1.t)('微信公众平台'),
|
|
99
|
+
value: 'WECHAT-PUBLIC'
|
|
100
|
+
},
|
|
130
101
|
{
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
message: (0, i18n_1.t)('请输入 AppId:')
|
|
102
|
+
name: (0, i18n_1.t)('微信开放平台'),
|
|
103
|
+
value: 'WECHAT-OPEN'
|
|
134
104
|
},
|
|
135
105
|
{
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
message: (0, i18n_1.t)('请输入 AppSecret:')
|
|
106
|
+
name: (0, i18n_1.t)('匿名登录'),
|
|
107
|
+
value: 'ANONYMOUS'
|
|
139
108
|
}
|
|
140
|
-
]
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
if (!appId || !appSecret) {
|
|
144
|
-
throw new error_1.CloudBaseError((0, i18n_1.t)('appId 和 appSecret 不能为空!'));
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
if (platform === 'ANONYMOUS') {
|
|
148
|
-
appId = 'anonymous';
|
|
149
|
-
appSecret = 'anonymous';
|
|
109
|
+
],
|
|
110
|
+
message: (0, i18n_1.t)('请选择登录方式:'),
|
|
111
|
+
default: 'WECHAT-PUBLIC'
|
|
150
112
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
113
|
+
]);
|
|
114
|
+
let appId;
|
|
115
|
+
let appSecret;
|
|
116
|
+
if (platform === 'WECHAT-OPEN' || platform === 'WECHAT-PUBLIC') {
|
|
117
|
+
const input = await inquirer_1.default.prompt([
|
|
118
|
+
{
|
|
119
|
+
type: 'input',
|
|
120
|
+
name: 'appId',
|
|
121
|
+
message: (0, i18n_1.t)('请输入 AppId:')
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
type: 'input',
|
|
125
|
+
name: 'appSecret',
|
|
126
|
+
message: (0, i18n_1.t)('请输入 AppSecret:')
|
|
163
127
|
}
|
|
128
|
+
]);
|
|
129
|
+
appId = input === null || input === void 0 ? void 0 : input.appId;
|
|
130
|
+
appSecret = input === null || input === void 0 ? void 0 : input.appSecret;
|
|
131
|
+
if (!appId || !appSecret) {
|
|
132
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('appId 和 appSecret 不能为空!'));
|
|
164
133
|
}
|
|
165
|
-
}
|
|
134
|
+
}
|
|
135
|
+
if (platform === 'ANONYMOUS') {
|
|
136
|
+
appId = 'anonymous';
|
|
137
|
+
appSecret = 'anonymous';
|
|
138
|
+
}
|
|
139
|
+
try {
|
|
140
|
+
await (0, env_1.createLoginConfig)({
|
|
141
|
+
envId,
|
|
142
|
+
appId,
|
|
143
|
+
appSecret,
|
|
144
|
+
platform
|
|
145
|
+
});
|
|
146
|
+
log.success((0, i18n_1.t)('创建登录方式成功!'));
|
|
147
|
+
}
|
|
148
|
+
catch (e) {
|
|
149
|
+
if (e.code === 'ResourceInUse') {
|
|
150
|
+
log.error((0, i18n_1.t)('登录方式已开启'));
|
|
151
|
+
}
|
|
152
|
+
}
|
|
166
153
|
}
|
|
167
154
|
};
|
|
168
155
|
__decorate([
|
|
@@ -193,68 +180,66 @@ let UpdateLogin = class UpdateLogin extends common_1.Command {
|
|
|
193
180
|
desc: (0, i18n_1.t)('更新环境登录方式配置')
|
|
194
181
|
};
|
|
195
182
|
}
|
|
196
|
-
execute(envId, log) {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
choices: [
|
|
217
|
-
{
|
|
218
|
-
name: (0, i18n_1.t)('启用'),
|
|
219
|
-
value: 'ENABLE'
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
name: (0, i18n_1.t)('禁用'),
|
|
223
|
-
value: 'DISABLE'
|
|
224
|
-
}
|
|
225
|
-
],
|
|
226
|
-
message: (0, i18n_1.t)('请选择登录方式状态:'),
|
|
227
|
-
default: 'ENABLE'
|
|
228
|
-
}
|
|
229
|
-
]);
|
|
230
|
-
const platform = config.Platform;
|
|
231
|
-
let appId;
|
|
232
|
-
let appSecret;
|
|
233
|
-
if (platform === 'WECHAT-OPEN' || platform === 'WECHAT-PUBLIC') {
|
|
234
|
-
const input = yield inquirer_1.default.prompt([
|
|
183
|
+
async execute(envId, log) {
|
|
184
|
+
const configList = await (0, env_1.getLoginConfigList)({
|
|
185
|
+
envId
|
|
186
|
+
});
|
|
187
|
+
const configChoices = configList.map((item) => ({
|
|
188
|
+
name: `${platformMap[item.Platform]}:${item.PlatformId} [${item.Status === 'ENABLE' ? (0, i18n_1.t)('启用') : (0, i18n_1.t)('禁用')}]`,
|
|
189
|
+
value: item,
|
|
190
|
+
short: `${platformMap[item.Platform]}:${item.PlatformId}`
|
|
191
|
+
}));
|
|
192
|
+
const { config, status } = await inquirer_1.default.prompt([
|
|
193
|
+
{
|
|
194
|
+
type: 'list',
|
|
195
|
+
name: 'config',
|
|
196
|
+
choices: configChoices,
|
|
197
|
+
message: (0, i18n_1.t)('请选择需要配置的条目:')
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
type: 'list',
|
|
201
|
+
name: 'status',
|
|
202
|
+
choices: [
|
|
235
203
|
{
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
message: (0, i18n_1.t)('请输入 AppId(配置状态时可不填):')
|
|
204
|
+
name: (0, i18n_1.t)('启用'),
|
|
205
|
+
value: 'ENABLE'
|
|
239
206
|
},
|
|
240
207
|
{
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
message: (0, i18n_1.t)('请输入 AppSecret(配置状态时可不填):')
|
|
208
|
+
name: (0, i18n_1.t)('禁用'),
|
|
209
|
+
value: 'DISABLE'
|
|
244
210
|
}
|
|
245
|
-
]
|
|
246
|
-
|
|
247
|
-
|
|
211
|
+
],
|
|
212
|
+
message: (0, i18n_1.t)('请选择登录方式状态:'),
|
|
213
|
+
default: 'ENABLE'
|
|
248
214
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
215
|
+
]);
|
|
216
|
+
const platform = config.Platform;
|
|
217
|
+
let appId;
|
|
218
|
+
let appSecret;
|
|
219
|
+
if (platform === 'WECHAT-OPEN' || platform === 'WECHAT-PUBLIC') {
|
|
220
|
+
const input = await inquirer_1.default.prompt([
|
|
221
|
+
{
|
|
222
|
+
type: 'input',
|
|
223
|
+
name: 'appId',
|
|
224
|
+
message: (0, i18n_1.t)('请输入 AppId(配置状态时可不填):')
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
type: 'input',
|
|
228
|
+
name: 'appSecret',
|
|
229
|
+
message: (0, i18n_1.t)('请输入 AppSecret(配置状态时可不填):')
|
|
230
|
+
}
|
|
231
|
+
]);
|
|
232
|
+
appId = input === null || input === void 0 ? void 0 : input.appId;
|
|
233
|
+
appSecret = input === null || input === void 0 ? void 0 : input.appSecret;
|
|
234
|
+
}
|
|
235
|
+
await (0, env_1.updateLoginConfig)({
|
|
236
|
+
envId,
|
|
237
|
+
configId: config.Id,
|
|
238
|
+
appId,
|
|
239
|
+
appSecret,
|
|
240
|
+
status
|
|
257
241
|
});
|
|
242
|
+
log.success((0, i18n_1.t)('更新登录方式成功!'));
|
|
258
243
|
}
|
|
259
244
|
};
|
|
260
245
|
__decorate([
|
|
@@ -34,15 +34,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
34
34
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
35
35
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
36
36
|
};
|
|
37
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
38
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
39
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
40
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
41
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
42
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
43
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
38
|
exports.FrameworkRun = exports.FrameworkCompile = exports.FrameworkDeploy = void 0;
|
|
48
39
|
const framework_core_1 = require("@cloudbase/framework-core");
|
|
@@ -51,30 +42,28 @@ const decorators_1 = require("../../decorators");
|
|
|
51
42
|
const Hosting = __importStar(require("../../hosting"));
|
|
52
43
|
const Function = __importStar(require("../../function"));
|
|
53
44
|
const utils_1 = require("../../utils");
|
|
54
|
-
function callFramework(ctx, command, module, params) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}, command, module, params);
|
|
77
|
-
});
|
|
45
|
+
async function callFramework(ctx, command, module, params) {
|
|
46
|
+
const { envId, config } = ctx;
|
|
47
|
+
const { bumpVersion, versionRemark } = ctx.options;
|
|
48
|
+
const loginState = await utils_1.authSupevisor.getLoginState();
|
|
49
|
+
const { token, secretId, secretKey } = loginState;
|
|
50
|
+
await (0, framework_core_1.run)({
|
|
51
|
+
projectPath: process.cwd(),
|
|
52
|
+
cloudbaseConfig: {
|
|
53
|
+
secretId,
|
|
54
|
+
secretKey,
|
|
55
|
+
token,
|
|
56
|
+
envId
|
|
57
|
+
},
|
|
58
|
+
config,
|
|
59
|
+
logLevel: process.argv.includes('--verbose') ? 'debug' : 'info',
|
|
60
|
+
resourceProviders: {
|
|
61
|
+
hosting: Hosting,
|
|
62
|
+
function: Function
|
|
63
|
+
},
|
|
64
|
+
bumpVersion: Boolean(bumpVersion),
|
|
65
|
+
versionRemark
|
|
66
|
+
}, command, module, params);
|
|
78
67
|
}
|
|
79
68
|
let FrameworkDeploy = class FrameworkDeploy extends common_1.Command {
|
|
80
69
|
get options() {
|
|
@@ -92,11 +81,9 @@ let FrameworkDeploy = class FrameworkDeploy extends common_1.Command {
|
|
|
92
81
|
desc: '云开发 Serverless 应用框架:部署全栈应用'
|
|
93
82
|
};
|
|
94
83
|
}
|
|
95
|
-
execute(ctx, logger, params) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
yield callFramework(ctx, 'deploy', module);
|
|
99
|
-
});
|
|
84
|
+
async execute(ctx, logger, params) {
|
|
85
|
+
const [module] = params || [];
|
|
86
|
+
await callFramework(ctx, 'deploy', module);
|
|
100
87
|
}
|
|
101
88
|
};
|
|
102
89
|
__decorate([
|
|
@@ -133,11 +120,9 @@ let FrameworkCompile = class FrameworkCompile extends common_1.Command {
|
|
|
133
120
|
desc: '云开发 Serverless 应用框架:编译应用描述文件'
|
|
134
121
|
};
|
|
135
122
|
}
|
|
136
|
-
execute(ctx, logger, params) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
yield callFramework(ctx, 'compile', module);
|
|
140
|
-
});
|
|
123
|
+
async execute(ctx, logger, params) {
|
|
124
|
+
const [module] = params || [];
|
|
125
|
+
await callFramework(ctx, 'compile', module);
|
|
141
126
|
}
|
|
142
127
|
};
|
|
143
128
|
__decorate([
|
|
@@ -172,12 +157,10 @@ let FrameworkRun = class FrameworkRun extends common_1.Command {
|
|
|
172
157
|
desc: '云开发 Serverless 应用框架:执行自定义命令'
|
|
173
158
|
};
|
|
174
159
|
}
|
|
175
|
-
execute(ctx, logger, params, options) {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
yield callFramework(ctx, 'run', plugin, { runCommandKey: command });
|
|
180
|
-
});
|
|
160
|
+
async execute(ctx, logger, params, options) {
|
|
161
|
+
const [command] = params || [];
|
|
162
|
+
const { plugin } = options;
|
|
163
|
+
await callFramework(ctx, 'run', plugin, { runCommandKey: command });
|
|
181
164
|
}
|
|
182
165
|
};
|
|
183
166
|
__decorate([
|