@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
|
@@ -34,26 +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
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
47
|
-
var t = {};
|
|
48
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
49
|
-
t[p] = s[p];
|
|
50
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
51
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
52
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
53
|
-
t[p[i]] = s[p[i]];
|
|
54
|
-
}
|
|
55
|
-
return t;
|
|
56
|
-
};
|
|
57
37
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
58
38
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
59
39
|
};
|
|
@@ -99,18 +79,16 @@ let LowCodeWatch = class LowCodeWatch extends common_1.Command {
|
|
|
99
79
|
requiredEnvId: false
|
|
100
80
|
};
|
|
101
81
|
}
|
|
102
|
-
execute(ctx, options) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
});
|
|
113
|
-
}));
|
|
82
|
+
async execute(ctx, options) {
|
|
83
|
+
const config = (0, utils_1.getCmdConfig)(ctx.config, this.options);
|
|
84
|
+
const mergesOptions = (0, utils_1.getMergedOptions)(config, options);
|
|
85
|
+
Promise.resolve().then(() => __importStar(require('@cloudbase/lowcode-cli'))).then(async (res) => {
|
|
86
|
+
await res.watchApp({
|
|
87
|
+
watchPort: 8288,
|
|
88
|
+
wxDevtoolPath: options === null || options === void 0 ? void 0 : options.wxDevtoolPath,
|
|
89
|
+
forceInstall: options === null || options === void 0 ? void 0 : options.forceInstall,
|
|
90
|
+
projectPath: options === null || options === void 0 ? void 0 : options.path
|
|
91
|
+
});
|
|
114
92
|
});
|
|
115
93
|
}
|
|
116
94
|
};
|
|
@@ -147,17 +125,15 @@ let LowCodeBuildApp = class LowCodeBuildApp extends common_1.Command {
|
|
|
147
125
|
requiredEnvId: false
|
|
148
126
|
};
|
|
149
127
|
}
|
|
150
|
-
execute(ctx, log, options) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}, mergesOptions);
|
|
160
|
-
});
|
|
128
|
+
async execute(ctx, log, options) {
|
|
129
|
+
const config = (0, utils_1.getCmdConfig)(ctx.config, this.options);
|
|
130
|
+
const mergesOptions = (0, utils_1.getMergedOptions)(config, options);
|
|
131
|
+
await lowcodeCli.buildApp({
|
|
132
|
+
envId: ctx.envId || ctx.config.envId,
|
|
133
|
+
projectPath: process.cwd(),
|
|
134
|
+
logger: log,
|
|
135
|
+
privateSettings: (0, utils_2.getPrivateSettings)(ctx.config, this.options.cmd)
|
|
136
|
+
}, mergesOptions);
|
|
161
137
|
}
|
|
162
138
|
};
|
|
163
139
|
__decorate([
|
|
@@ -192,17 +168,15 @@ let LowCodePreviewApp = class LowCodePreviewApp extends common_1.Command {
|
|
|
192
168
|
requiredEnvId: false
|
|
193
169
|
};
|
|
194
170
|
}
|
|
195
|
-
execute(ctx, log, options) {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}, mergesOptions);
|
|
205
|
-
});
|
|
171
|
+
async execute(ctx, log, options) {
|
|
172
|
+
const config = (0, utils_1.getCmdConfig)(ctx.config, this.options);
|
|
173
|
+
const mergesOptions = (0, utils_1.getMergedOptions)(config, options);
|
|
174
|
+
await lowcodeCli.previewApp({
|
|
175
|
+
envId: ctx.envId || ctx.config.envId,
|
|
176
|
+
projectPath: process.cwd(),
|
|
177
|
+
logger: log,
|
|
178
|
+
privateSettings: (0, utils_2.getPrivateSettings)(ctx.config, this.options.cmd)
|
|
179
|
+
}, mergesOptions);
|
|
206
180
|
}
|
|
207
181
|
};
|
|
208
182
|
__decorate([
|
|
@@ -241,17 +215,15 @@ let LowCodeBuildAppConfig = class LowCodeBuildAppConfig extends common_1.Command
|
|
|
241
215
|
requiredEnvId: false
|
|
242
216
|
};
|
|
243
217
|
}
|
|
244
|
-
execute(ctx, log, options) {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
}, mergesOptions);
|
|
254
|
-
});
|
|
218
|
+
async execute(ctx, log, options) {
|
|
219
|
+
const config = (0, utils_1.getCmdConfig)(ctx.config, this.options);
|
|
220
|
+
const mergesOptions = (0, utils_1.getMergedOptions)(config, options);
|
|
221
|
+
await lowcodeCli.buildAppConfig({
|
|
222
|
+
envId: ctx.envId || ctx.config.envId,
|
|
223
|
+
projectPath: process.cwd(),
|
|
224
|
+
logger: log,
|
|
225
|
+
privateSettings: (0, utils_2.getPrivateSettings)(ctx.config, this.options.cmd)
|
|
226
|
+
}, mergesOptions);
|
|
255
227
|
}
|
|
256
228
|
};
|
|
257
229
|
__decorate([
|
|
@@ -286,25 +258,27 @@ let LowCodeDeployApp = class LowCodeDeployApp extends common_1.Command {
|
|
|
286
258
|
requiredEnvId: false
|
|
287
259
|
};
|
|
288
260
|
}
|
|
289
|
-
execute(ctx, log, options) {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
261
|
+
async execute(ctx, log, options) {
|
|
262
|
+
let credential;
|
|
263
|
+
const privateSettings = (0, utils_2.getPrivateSettings)(ctx.config, this.options.cmd);
|
|
264
|
+
const config = (0, utils_1.getCmdConfig)(ctx.config, this.options);
|
|
265
|
+
const { src, ...restMergedOptions } = (0, utils_1.getMergedOptions)(config, options);
|
|
266
|
+
if (ctx.hasPrivateSettings) {
|
|
267
|
+
process.env.IS_PRIVATE = 'true';
|
|
268
|
+
credential = privateSettings.credential;
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
credential = await utils_2.authSupevisor.getLoginState();
|
|
272
|
+
}
|
|
273
|
+
await lowcodeCli.deployApp({
|
|
274
|
+
envId: ctx.envId || ctx.config.envId,
|
|
275
|
+
projectPath: process.cwd(),
|
|
276
|
+
logger: log,
|
|
277
|
+
privateSettings
|
|
278
|
+
}, {
|
|
279
|
+
credential,
|
|
280
|
+
...restMergedOptions,
|
|
281
|
+
projectPath: src || restMergedOptions.projectPath
|
|
308
282
|
});
|
|
309
283
|
}
|
|
310
284
|
};
|
|
@@ -336,46 +310,44 @@ let ModelTypeSync = class ModelTypeSync extends common_1.Command {
|
|
|
336
310
|
autoRunLogin: true
|
|
337
311
|
};
|
|
338
312
|
}
|
|
339
|
-
execute(ctx, log, options) {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
QueryConnector: 0
|
|
367
|
-
});
|
|
368
|
-
const rows = datasourceList.Data.Rows;
|
|
369
|
-
const dataModelList = rows.map((item) => ({
|
|
370
|
-
name: item.Name,
|
|
371
|
-
schema: JSON.parse(item.Schema),
|
|
372
|
-
title: item.Title
|
|
373
|
-
}));
|
|
374
|
-
const dts = yield (0, dts_1.generateDataModelDTS)(dataModelList);
|
|
375
|
-
const dtsFileName = 'cloud-models.d.ts';
|
|
376
|
-
yield fs_extra_1.default.writeFile(dtsFileName, dts);
|
|
377
|
-
log.success('同步数据模型类型定义文件成功。文件名称:' + dtsFileName);
|
|
313
|
+
async execute(ctx, log, options) {
|
|
314
|
+
log.info('同步中...');
|
|
315
|
+
if (!(await fs_extra_1.default.pathExists('cloudbaserc.json'))) {
|
|
316
|
+
await fs_extra_1.default.writeFile('cloudbaserc.json', JSON.stringify({
|
|
317
|
+
version: '2.0',
|
|
318
|
+
envId: ctx.envId
|
|
319
|
+
}, null, 2), 'utf8');
|
|
320
|
+
}
|
|
321
|
+
if (!(await fs_extra_1.default.pathExists('tsconfig.json'))) {
|
|
322
|
+
await fs_extra_1.default.writeFile('tsconfig.json', JSON.stringify({
|
|
323
|
+
compilerOptions: {
|
|
324
|
+
allowJs: true
|
|
325
|
+
}
|
|
326
|
+
}, null, 2), 'utf8');
|
|
327
|
+
}
|
|
328
|
+
else {
|
|
329
|
+
const config = await fs_extra_1.default.readJson('tsconfig.json', 'utf8');
|
|
330
|
+
(0, lodash_1.set)(config, 'compilerOptions.allowJs', true);
|
|
331
|
+
await fs_extra_1.default.writeFile('tsconfig.json', JSON.stringify(config, null, 2), 'utf8');
|
|
332
|
+
}
|
|
333
|
+
const cloudService = await getCloudServiceInstance(ctx);
|
|
334
|
+
const datasourceList = await cloudService.lowcode.request('DescribeDataSourceList', {
|
|
335
|
+
EnvId: ctx.envId,
|
|
336
|
+
PageIndex: 1,
|
|
337
|
+
PageSize: 1000,
|
|
338
|
+
QuerySystemModel: true,
|
|
339
|
+
QueryConnector: 0
|
|
378
340
|
});
|
|
341
|
+
const rows = datasourceList.Data.Rows;
|
|
342
|
+
const dataModelList = rows.map((item) => ({
|
|
343
|
+
name: item.Name,
|
|
344
|
+
schema: JSON.parse(item.Schema),
|
|
345
|
+
title: item.Title
|
|
346
|
+
}));
|
|
347
|
+
const dts = await (0, dts_1.generateDataModelDTS)(dataModelList);
|
|
348
|
+
const dtsFileName = 'cloud-models.d.ts';
|
|
349
|
+
await fs_extra_1.default.writeFile(dtsFileName, dts);
|
|
350
|
+
log.success('同步数据模型类型定义文件成功。文件名称:' + dtsFileName);
|
|
379
351
|
}
|
|
380
352
|
};
|
|
381
353
|
__decorate([
|
|
@@ -391,25 +363,23 @@ ModelTypeSync = __decorate([
|
|
|
391
363
|
(0, common_1.ICommand)({ supportPrivate: true })
|
|
392
364
|
], ModelTypeSync);
|
|
393
365
|
exports.ModelTypeSync = ModelTypeSync;
|
|
394
|
-
function getCloudServiceInstance(ctx) {
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
};
|
|
414
|
-
});
|
|
366
|
+
async function getCloudServiceInstance(ctx) {
|
|
367
|
+
let credential;
|
|
368
|
+
if (ctx.hasPrivateSettings) {
|
|
369
|
+
process.env.IS_PRIVATE = 'true';
|
|
370
|
+
const privateSettings = (0, utils_2.getPrivateSettings)(ctx.config, this.options.cmd);
|
|
371
|
+
credential = privateSettings.credential;
|
|
372
|
+
}
|
|
373
|
+
else {
|
|
374
|
+
credential = await utils_2.authSupevisor.getLoginState();
|
|
375
|
+
}
|
|
376
|
+
return {
|
|
377
|
+
lowcode: cloud_api_1.CloudApiService.getInstance({
|
|
378
|
+
service: 'lowcode',
|
|
379
|
+
proxy: (0, toolbox_1.getProxy)(),
|
|
380
|
+
credential,
|
|
381
|
+
version: '2021-01-08'
|
|
382
|
+
}),
|
|
383
|
+
tcb: cloud_api_1.CloudApiService.getInstance({ service: 'tcb', proxy: (0, toolbox_1.getProxy)(), credential })
|
|
384
|
+
};
|
|
415
385
|
}
|
|
@@ -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.LowCodePublishVersionComps = exports.LowCodePublishComps = exports.LowCodeDebugComps = exports.LowCodeBuildComps = exports.LowCodeCreateComps = void 0;
|
|
48
39
|
const common_1 = require("../common");
|
|
@@ -76,58 +67,56 @@ let LowCodeCreateComps = class LowCodeCreateComps extends common_1.Command {
|
|
|
76
67
|
requiredEnvId: false
|
|
77
68
|
};
|
|
78
69
|
}
|
|
79
|
-
execute(opts, params, isPrivateEnv, config, log) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if (
|
|
83
|
-
|
|
84
|
-
throw new error_1.CloudBaseError('skip validate 需要指定组件库名 eg: `tcb lowcode create mydemo`');
|
|
85
|
-
}
|
|
86
|
-
yield lowcodeCli.bootstrap(params === null || params === void 0 ? void 0 : params[0], log);
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
const privateSettings = (0, utils_1.getPrivateSettings)(config, this.options.cmd);
|
|
90
|
-
if (process.env.CLOUDBASE_LOWCODE_CLOUDAPI_URL === undefined) {
|
|
91
|
-
process.env.CLOUDBASE_LOWCODE_CLOUDAPI_URL =
|
|
92
|
-
'https://lcap.cloud.tencent.com/api/v1/cliapi';
|
|
70
|
+
async execute(opts, params, isPrivateEnv, config, log) {
|
|
71
|
+
const mergesOptions = (0, utils_2.getMergedOptions)((0, utils_2.getCmdConfig)(config, this.options), opts);
|
|
72
|
+
if (mergesOptions.skipValidate) {
|
|
73
|
+
if (!(params === null || params === void 0 ? void 0 : params[0])) {
|
|
74
|
+
throw new error_1.CloudBaseError('skip validate 需要指定组件库名 eg: `tcb lowcode create mydemo`');
|
|
93
75
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
76
|
+
await lowcodeCli.bootstrap(params === null || params === void 0 ? void 0 : params[0], log);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const privateSettings = (0, utils_1.getPrivateSettings)(config, this.options.cmd);
|
|
80
|
+
if (process.env.CLOUDBASE_LOWCODE_CLOUDAPI_URL === undefined) {
|
|
81
|
+
process.env.CLOUDBASE_LOWCODE_CLOUDAPI_URL =
|
|
82
|
+
'https://lcap.cloud.tencent.com/api/v1/cliapi';
|
|
83
|
+
}
|
|
84
|
+
let cloudService;
|
|
85
|
+
if (isPrivateEnv) {
|
|
86
|
+
cloudService = cloud_api_1.CloudApiService.getInstance({
|
|
87
|
+
service: 'lowcode',
|
|
88
|
+
credential: privateSettings.credential
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
cloudService = utils_1.CloudApiService.getInstance('lowcode');
|
|
93
|
+
}
|
|
94
|
+
const res = await cloudService.request('ListUserCompositeGroups', isPrivateEnv
|
|
95
|
+
? {
|
|
96
|
+
privateUin: privateSettings.privateUin
|
|
100
97
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
98
|
+
: undefined);
|
|
99
|
+
const comps = res === null || res === void 0 ? void 0 : res.data;
|
|
100
|
+
if (!(comps === null || comps === void 0 ? void 0 : comps.count)) {
|
|
101
|
+
throw new error_1.CloudBaseError('没有可关联的云端组件库,请到低码控制台新建组件库!');
|
|
102
|
+
}
|
|
103
|
+
let compsName = params === null || params === void 0 ? void 0 : params[0];
|
|
104
|
+
if (!compsName) {
|
|
105
|
+
const { selectCompsName } = await (0, enquirer_1.prompt)({
|
|
106
|
+
type: 'select',
|
|
107
|
+
name: 'selectCompsName',
|
|
108
|
+
message: '关联云端组件库:',
|
|
109
|
+
choices: comps.rows.map((row) => row.groupName)
|
|
110
|
+
});
|
|
111
|
+
compsName = selectCompsName;
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
const comp = comps.rows.find((row) => row.groupName === compsName);
|
|
115
|
+
if (!comp) {
|
|
116
|
+
throw new error_1.CloudBaseError(`云端不存在组件库 ${compsName},请在微搭控制台-应用菜单中,打开任意一个应用的编辑器,点击素材-组件库管理模块,并创建组件库`);
|
|
112
117
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const { selectCompsName } = yield (0, enquirer_1.prompt)({
|
|
116
|
-
type: 'select',
|
|
117
|
-
name: 'selectCompsName',
|
|
118
|
-
message: '关联云端组件库:',
|
|
119
|
-
choices: comps.rows.map((row) => row.groupName)
|
|
120
|
-
});
|
|
121
|
-
compsName = selectCompsName;
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
const comp = comps.rows.find((row) => row.groupName === compsName);
|
|
125
|
-
if (!comp) {
|
|
126
|
-
throw new error_1.CloudBaseError(`云端不存在组件库 ${compsName},请在微搭控制台-应用菜单中,打开任意一个应用的编辑器,点击素材-组件库管理模块,并创建组件库`);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
yield lowcodeCli.bootstrap(compsName, log);
|
|
130
|
-
});
|
|
118
|
+
}
|
|
119
|
+
await lowcodeCli.bootstrap(compsName, log);
|
|
131
120
|
}
|
|
132
121
|
};
|
|
133
122
|
__decorate([
|
|
@@ -162,15 +151,19 @@ let LowCodeBuildComps = class LowCodeBuildComps extends common_1.Command {
|
|
|
162
151
|
requiredEnvId: false
|
|
163
152
|
};
|
|
164
153
|
}
|
|
165
|
-
execute(ctx, log) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
154
|
+
async execute(ctx, log) {
|
|
155
|
+
const config = ctx.config.lowcodeCustomComponents;
|
|
156
|
+
if (config) {
|
|
157
|
+
await lowcodeCli.graceBuildComps({
|
|
158
|
+
...config,
|
|
159
|
+
context: config.context || process.cwd(),
|
|
160
|
+
logger: log,
|
|
161
|
+
privateSettings: (0, utils_1.getPrivateSettings)(ctx.config, this.options.cmd),
|
|
162
|
+
envId: ctx.envId || ctx.config.envId,
|
|
163
|
+
});
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
throw new error_1.CloudBaseError('请参考文档填写 cloudbaserc 配置: https://docs.cloudbase.net/lowcode/custom-components/config/config-comps');
|
|
174
167
|
}
|
|
175
168
|
};
|
|
176
169
|
__decorate([
|
|
@@ -210,19 +203,25 @@ let LowCodeDebugComps = class LowCodeDebugComps extends common_1.Command {
|
|
|
210
203
|
requiredEnvId: false
|
|
211
204
|
};
|
|
212
205
|
}
|
|
213
|
-
execute(ctx, options, log) {
|
|
206
|
+
async execute(ctx, options, log) {
|
|
214
207
|
var _a;
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
208
|
+
const config = ctx.config.lowcodeCustomComponents;
|
|
209
|
+
const privateSettings = (0, utils_1.getPrivateSettings)(ctx.config, this.options.cmd);
|
|
210
|
+
if (config) {
|
|
211
|
+
const cmdConfig = (0, utils_2.getCmdConfig)(ctx.config, this.options);
|
|
212
|
+
const mergesOptions = (0, utils_2.getMergedOptions)(cmdConfig, options);
|
|
213
|
+
await lowcodeCli.graceDebugComps({
|
|
214
|
+
...config,
|
|
215
|
+
context: config.context || process.cwd(),
|
|
216
|
+
debugPort: (mergesOptions === null || mergesOptions === void 0 ? void 0 : mergesOptions.debugPort) || 8388,
|
|
217
|
+
logger: log,
|
|
218
|
+
wxDevtoolPath: mergesOptions === null || mergesOptions === void 0 ? void 0 : mergesOptions.wxDevtoolPath,
|
|
219
|
+
debugBaseUrl: (_a = privateSettings === null || privateSettings === void 0 ? void 0 : privateSettings.endpoints) === null || _a === void 0 ? void 0 : _a.editor,
|
|
220
|
+
envId: ctx.envId || ctx.config.envId,
|
|
221
|
+
});
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
throw new error_1.CloudBaseError('请参考文档填写 cloudbaserc 配置: https://docs.cloudbase.net/lowcode/custom-components/config/config-comps');
|
|
226
225
|
}
|
|
227
226
|
};
|
|
228
227
|
__decorate([
|
|
@@ -260,17 +259,22 @@ let LowCodePublishComps = class LowCodePublishComps extends common_1.Command {
|
|
|
260
259
|
requiredEnvId: false
|
|
261
260
|
};
|
|
262
261
|
}
|
|
263
|
-
execute(ctx, log, options) {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
262
|
+
async execute(ctx, log, options) {
|
|
263
|
+
const config = ctx.config.lowcodeCustomComponents;
|
|
264
|
+
if (config) {
|
|
265
|
+
const mergesOptions = (0, utils_2.getMergedOptions)((0, utils_2.getCmdConfig)(ctx.config, this.options), options);
|
|
266
|
+
await lowcodeCli.gracePublishComps({
|
|
267
|
+
...config,
|
|
268
|
+
context: config.context || process.cwd(),
|
|
269
|
+
logger: log,
|
|
270
|
+
privateSettings: (0, utils_1.getPrivateSettings)(ctx.config, this.options.cmd),
|
|
271
|
+
isAdmin: Boolean(mergesOptions.admin),
|
|
272
|
+
envId: ctx.envId || ctx.config.envId,
|
|
273
|
+
});
|
|
274
|
+
log.success('组件库 - 已同步到云端,请到低码控制台发布该组件库!');
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
throw new error_1.CloudBaseError('请参考文档填写 cloudbaserc 配置: https://docs.cloudbase.net/lowcode/custom-components/config/config-comps');
|
|
274
278
|
}
|
|
275
279
|
};
|
|
276
280
|
__decorate([
|
|
@@ -314,46 +318,51 @@ let LowCodePublishVersionComps = class LowCodePublishVersionComps extends common
|
|
|
314
318
|
requiredEnvId: false
|
|
315
319
|
};
|
|
316
320
|
}
|
|
317
|
-
execute(ctx, options, log) {
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
321
|
+
async execute(ctx, options, log) {
|
|
322
|
+
const { tag, comment, admin } = (0, utils_2.getMergedOptions)((0, utils_2.getCmdConfig)(ctx.config, this.options), options) || {};
|
|
323
|
+
if (!comment) {
|
|
324
|
+
throw new error_1.CloudBaseError('请使用 --comment 填写版本注释');
|
|
325
|
+
}
|
|
326
|
+
if (!tag) {
|
|
327
|
+
throw new error_1.CloudBaseError('请使用 --tag 填写符合semver的版本号');
|
|
328
|
+
}
|
|
329
|
+
if (!semver.valid(tag)) {
|
|
330
|
+
log.error('组件库版本不符合semver标准');
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
const config = ctx.config.lowcodeCustomComponents;
|
|
334
|
+
if (!config) {
|
|
335
|
+
throw new error_1.CloudBaseError('组件库 - 请添加组件库配置到cloudbaserc.json 以使用该命令');
|
|
336
|
+
}
|
|
337
|
+
const res = await lowcodeCli.publishVersion({
|
|
338
|
+
...config,
|
|
339
|
+
context: config.context || process.cwd(),
|
|
340
|
+
logger: log,
|
|
341
|
+
isAdmin: options.admin,
|
|
342
|
+
privateSettings: (0, utils_1.getPrivateSettings)(ctx.config, this.options.cmd),
|
|
343
|
+
envId: ctx.envId || ctx.config.envId,
|
|
344
|
+
}, comment, tag);
|
|
345
|
+
if (res.data.code === 200) {
|
|
346
|
+
log.success('组件库 - 已发布新版本!');
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
if (res.data.code === 100) {
|
|
350
|
+
log.error('组件库 - 无待发布版本');
|
|
351
|
+
return;
|
|
352
|
+
}
|
|
353
|
+
if (res.data.code === 201) {
|
|
354
|
+
log.error('组件库 - comment 重复, 请使用有意义的comment');
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
else {
|
|
358
|
+
if (res.data.msg) {
|
|
359
|
+
log.error(`组件库 - ${res.data.msg} RequestId: ${res.requestId}`);
|
|
346
360
|
}
|
|
347
361
|
else {
|
|
348
|
-
|
|
349
|
-
log.error(`组件库 - ${res.data.msg} RequestId: ${res.requestId}`);
|
|
350
|
-
}
|
|
351
|
-
else {
|
|
352
|
-
log.error('组件库 - 未知错误');
|
|
353
|
-
}
|
|
354
|
-
return;
|
|
362
|
+
log.error('组件库 - 未知错误');
|
|
355
363
|
}
|
|
356
|
-
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
357
366
|
}
|
|
358
367
|
};
|
|
359
368
|
__decorate([
|