@cloudbase/cli 2.5.1-alpha.5 → 2.6.0-alpha.1

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.
Files changed (154) hide show
  1. package/.yarn/cache/@apidevtools-json-schema-ref-parser-npm-11.7.0-fca2d09a71-ee1c9e7c1b.zip +0 -0
  2. package/.yarn/cache/@babel-code-frame-npm-7.24.7-315a600a58-830e62cd38.zip +0 -0
  3. package/.yarn/cache/@babel-generator-npm-7.25.0-4bba208756-bf25649dde.zip +0 -0
  4. package/.yarn/cache/@babel-helper-annotate-as-pure-npm-7.24.7-537c5e8bf3-6178566099.zip +0 -0
  5. package/.yarn/cache/@babel-helper-create-class-features-plugin-npm-7.25.0-8c1a9bf7ca-e986c1187e.zip +0 -0
  6. package/.yarn/cache/@babel-helper-member-expression-to-functions-npm-7.24.8-6042e98e38-bf923d05d8.zip +0 -0
  7. package/.yarn/cache/@babel-helper-optimise-call-expression-npm-7.24.7-59b5fb050d-280654eaf9.zip +0 -0
  8. package/.yarn/cache/@babel-helper-plugin-utils-npm-7.24.8-a288f101a7-73b1a83ba8.zip +0 -0
  9. package/.yarn/cache/@babel-helper-replace-supers-npm-7.25.0-7aaa2ff595-f669fc2487.zip +0 -0
  10. package/.yarn/cache/@babel-helper-skip-transparent-expression-wrappers-npm-7.24.7-f573fe40ee-11b28fe534.zip +0 -0
  11. package/.yarn/cache/@babel-helper-string-parser-npm-7.24.8-133b2e71e1-39b03c5119.zip +0 -0
  12. package/.yarn/cache/@babel-highlight-npm-7.24.7-d792bd8d9f-5cd3a89f14.zip +0 -0
  13. package/.yarn/cache/@babel-parser-npm-7.25.3-e33bb4a0e6-b55aba6421.zip +0 -0
  14. package/.yarn/cache/@babel-plugin-transform-class-properties-npm-7.24.7-42a5aafd3c-1348d7ce74.zip +0 -0
  15. package/.yarn/cache/@babel-plugin-transform-export-namespace-from-npm-7.24.7-2e43f5c58e-3bd3a10038.zip +0 -0
  16. package/.yarn/cache/@babel-template-npm-7.25.0-2c6ddcb43a-3f2db56871.zip +0 -0
  17. package/.yarn/cache/@babel-traverse-npm-7.25.3-69c3455e97-5661308b13.zip +0 -0
  18. package/.yarn/cache/{@babel-types-npm-7.24.7-43a9e43e29-3e4437fced.zip → @babel-types-npm-7.25.2-7d3fc0ed1e-f73f66ba90.zip} +0 -0
  19. package/.yarn/cache/@cloudbase-cals-npm-1.1.13-7ac986f94e-878dac9caf.zip +0 -0
  20. package/.yarn/cache/@cloudbase-functions-framework-npm-0.0.12-a0ad7a7857-95be5c50de.zip +0 -0
  21. package/.yarn/cache/@cloudbase-lowcode-builder-npm-1.9.4-cbf179580e-217bb60668.zip +0 -0
  22. package/.yarn/cache/{@cloudbase-lowcode-cli-npm-0.21.8-0694328ddb-c2f89792a9.zip → @cloudbase-lowcode-cli-npm-0.21.12-1f6007e627-dc888de456.zip} +0 -0
  23. package/.yarn/cache/{@cloudbase-lowcode-deployer-npm-1.3.11-6ffd90b292-074dda7639.zip → @cloudbase-lowcode-deployer-npm-1.3.12-4345acdaaa-bdc2233f7d.zip} +0 -0
  24. package/.yarn/cache/@cloudbase-lowcode-generator-npm-1.8.36-d8307e46fc-ebd2de45ed.zip +0 -0
  25. package/.yarn/cache/@cloudbase-weda-client-npm-1.1.7-647320a1ad-ca6053b31a.zip +0 -0
  26. package/.yarn/cache/@colors-colors-npm-1.6.0-47f686c4e2-aa209963e0.zip +0 -0
  27. package/.yarn/cache/@hapi-bourne-npm-3.0.0-9b2a238f08-7174cab6c3.zip +0 -0
  28. package/.yarn/cache/@jridgewell-sourcemap-codec-npm-1.5.0-dfd9126d71-05df4f2538.zip +0 -0
  29. package/.yarn/cache/@koa-router-npm-12.0.1-6a9764e4df-4b8d3940cb.zip +0 -0
  30. package/.yarn/cache/@types-co-body-npm-6.1.3-187348a50c-e93fdc177f.zip +0 -0
  31. package/.yarn/cache/@types-formidable-npm-2.0.6-94d53f71b6-d6be0ac12b.zip +0 -0
  32. package/.yarn/cache/@types-fs-extra-npm-11.0.4-e30a7fec50-242cb84157.zip +0 -0
  33. package/.yarn/cache/@types-jsonfile-npm-6.1.4-33f021b8d9-309fda20eb.zip +0 -0
  34. package/.yarn/cache/@types-koa-npm-2.15.0-fe318dc6d8-f429b92f36.zip +0 -0
  35. package/.yarn/cache/@types-lodash-npm-4.17.7-2077805efb-09e58a119c.zip +0 -0
  36. package/.yarn/cache/@types-triple-beam-npm-1.3.5-0f1b823630-519b6a1b30.zip +0 -0
  37. package/.yarn/cache/@vue-compiler-core-npm-3.4.37-00839e39dd-2b7ad0f3a1.zip +0 -0
  38. package/.yarn/cache/@vue-compiler-dom-npm-3.4.37-b838f4a154-097f656089.zip +0 -0
  39. package/.yarn/cache/@vue-compiler-sfc-npm-3.4.37-5907ce9be3-ac69d7d7b8.zip +0 -0
  40. package/.yarn/cache/@vue-compiler-ssr-npm-3.4.37-ab37d05460-f4537ecd2c.zip +0 -0
  41. package/.yarn/cache/@vue-reactivity-npm-3.4.37-1052484bc8-aa757a9f77.zip +0 -0
  42. package/.yarn/cache/@vue-runtime-core-npm-3.4.37-3c3cd20cd9-ddbcee0d71.zip +0 -0
  43. package/.yarn/cache/@vue-runtime-dom-npm-3.4.37-d24d23d003-bf3a4a666f.zip +0 -0
  44. package/.yarn/cache/@vue-server-renderer-npm-3.4.37-94ec4fa415-184820d140.zip +0 -0
  45. package/.yarn/cache/@vue-shared-npm-3.4.37-eefa0ee3ed-8ea0000b72.zip +0 -0
  46. package/.yarn/cache/acorn-npm-8.12.1-610871d57c-677880034a.zip +0 -0
  47. package/.yarn/cache/{cacache-npm-18.0.3-7936f526c3-b717fd9b36.zip → cacache-npm-18.0.4-3dc4edc849-b7422c113b.zip} +0 -0
  48. package/.yarn/cache/chokidar-npm-3.6.0-3c413a828f-d2f29f4997.zip +0 -0
  49. package/.yarn/cache/co-body-npm-6.2.0-84e35e7662-c89336086b.zip +0 -0
  50. package/.yarn/cache/cookies-npm-0.9.1-80a82ae099-213e4d1484.zip +0 -0
  51. package/.yarn/cache/cos-nodejs-sdk-v5-npm-2.14.5-7e53b9f2c9-b6eaa804d3.zip +0 -0
  52. package/.yarn/cache/debug-npm-4.3.6-ecb233d831-1630b748de.zip +0 -0
  53. package/.yarn/cache/entities-npm-5.0.0-3f8b6067c0-d641555e64.zip +0 -0
  54. package/.yarn/cache/estree-walker-npm-2.0.2-dfab42f65c-6151e6f982.zip +0 -0
  55. package/.yarn/cache/fast-xml-parser-npm-4.4.1-b48f31eba7-f440c01cd1.zip +0 -0
  56. package/.yarn/cache/file-stream-rotator-npm-0.6.1-eab45fb13d-ebdf6a9e7c.zip +0 -0
  57. package/.yarn/cache/foreground-child-npm-3.3.0-b8be745271-1989698488.zip +0 -0
  58. package/.yarn/cache/formidable-npm-2.1.2-40ba18d67f-81c8e5d89f.zip +0 -0
  59. package/.yarn/cache/{glob-npm-10.4.1-a0d030e0a9-5d33c686c8.zip → glob-npm-10.4.5-8c63175f05-0bc725de5e.zip} +0 -0
  60. package/.yarn/cache/hash-sum-npm-2.0.0-2216318cf2-efeeacf09e.zip +0 -0
  61. package/.yarn/cache/hexoid-npm-1.0.0-2274609209-27a148ca76.zip +0 -0
  62. package/.yarn/cache/https-proxy-agent-npm-7.0.5-94c14d4619-2e1a28960f.zip +0 -0
  63. package/.yarn/cache/ignore-by-default-npm-1.0.1-78ea10bc54-441509147b.zip +0 -0
  64. package/.yarn/cache/jackspeak-npm-3.4.3-546bfad080-be31027fc7.zip +0 -0
  65. package/.yarn/cache/json-schema-to-typescript-npm-14.1.0-f6a2ffa92f-334142e6b1.zip +0 -0
  66. package/.yarn/cache/koa-body-npm-6.0.1-e672d44ab2-515bcac297.zip +0 -0
  67. package/.yarn/cache/koa-npm-2.15.3-7a802d72e9-7c3537443b.zip +0 -0
  68. package/.yarn/cache/logform-npm-2.6.1-3d7ec22905-0c6b95fa83.zip +0 -0
  69. package/.yarn/cache/lru-cache-npm-10.4.3-30c10b861a-6476138d21.zip +0 -0
  70. package/.yarn/cache/magic-string-npm-0.30.11-4e76dc2f30-e041649453.zip +0 -0
  71. package/.yarn/cache/{minimatch-npm-9.0.4-7be5a33efc-cf717f597e.zip → minimatch-npm-9.0.5-9aa93d97fa-2c035575ed.zip} +0 -0
  72. package/.yarn/cache/mobx-npm-5.15.7-31a8d2e340-46aa00c330.zip +0 -0
  73. package/.yarn/cache/{node-gyp-npm-10.1.0-bdea7d2ece-72e2ab4b23.zip → node-gyp-npm-10.2.0-cad1109948-0233759d8c.zip} +0 -0
  74. package/.yarn/cache/nodemon-npm-3.1.4-33f4db03df-3f003fc2c7.zip +0 -0
  75. package/.yarn/cache/object-hash-npm-2.2.0-d97a921cc1-55ba841e3a.zip +0 -0
  76. package/.yarn/cache/package-json-from-dist-npm-1.0.0-961f0fcb3b-ac706ec856.zip +0 -0
  77. package/.yarn/cache/path-to-regexp-npm-6.2.2-0bf7f6805c-b7b0005c36.zip +0 -0
  78. package/.yarn/cache/postcss-npm-8.4.41-1607021b28-f865894929.zip +0 -0
  79. package/.yarn/cache/prettier-npm-3.3.3-e811f023f3-bc86043548.zip +0 -0
  80. package/.yarn/cache/pstree.remy-npm-1.1.8-2dd5d55de2-5cb53698d6.zip +0 -0
  81. package/.yarn/cache/qs-npm-6.13.0-53676ddc84-e9404dc0fc.zip +0 -0
  82. package/.yarn/cache/raw-body-npm-3.0.0-cd8403b401-25b7cf7964.zip +0 -0
  83. package/.yarn/cache/read-pkg-up-npm-7.0.1-11895bed9a-e4e93ce70e.zip +0 -0
  84. package/.yarn/cache/readable-stream-npm-3.6.2-d2a6069158-bdcbe6c22e.zip +0 -0
  85. package/.yarn/cache/semver-npm-7.6.3-57e82c14d5-4110ec5d01.zip +0 -0
  86. package/.yarn/cache/simple-update-notifier-npm-2.0.0-4d6e5dba61-9ba00d38ce.zip +0 -0
  87. package/.yarn/cache/socks-proxy-agent-npm-8.0.4-991722041a-b2ec5051d8.zip +0 -0
  88. package/.yarn/cache/touch-npm-3.1.1-30ecbeb0ee-fb8c542075.zip +0 -0
  89. package/.yarn/cache/undefsafe-npm-2.0.5-8c3bbf9354-f42ab3b577.zip +0 -0
  90. package/.yarn/cache/uuid-npm-10.0.0-4872b46ff8-4b81611ade.zip +0 -0
  91. package/.yarn/cache/veaury-npm-2.4.3-7e5c80f344-8f3d021df0.zip +0 -0
  92. package/.yarn/cache/vue-loader-npm-15.11.1-829412283a-509a816d45.zip +0 -0
  93. package/.yarn/cache/vue-loader-npm-17.4.2-00674d01e5-2b5a15858e.zip +0 -0
  94. package/.yarn/cache/vue-npm-3.4.37-df3a8a3302-8404c7b54b.zip +0 -0
  95. package/.yarn/cache/watchpack-npm-2.4.2-3e587d5d5b-92d9d52ce3.zip +0 -0
  96. package/.yarn/cache/whatwg-mimetype-npm-4.0.0-ebb293a688-f97edd4b4e.zip +0 -0
  97. package/.yarn/cache/winston-daily-rotate-file-npm-4.7.1-8acf5cd720-227daea41f.zip +0 -0
  98. package/.yarn/cache/winston-npm-3.14.2-d92fb20061-9021637d3a.zip +0 -0
  99. package/.yarn/cache/winston-transport-npm-4.7.1-670dc6d411-e1dc070df1.zip +0 -0
  100. package/.yarn/cache/zod-npm-3.23.8-11c49c85b5-15949ff821.zip +0 -0
  101. package/.yarn/install-state.gz +0 -0
  102. package/.yarnrc.yml +1 -0
  103. package/bin/tcb.js +62 -33
  104. package/lib/commands/constants.js +11 -0
  105. package/lib/commands/db/base.js +395 -0
  106. package/lib/commands/db/index.js +17 -0
  107. package/lib/commands/env/base.js +2 -1
  108. package/lib/commands/fun/base.js +452 -0
  109. package/lib/commands/fun/index.js +17 -0
  110. package/lib/commands/index.js +2 -0
  111. package/lib/commands/lowcode/app.js +2 -262
  112. package/lib/commands/lowcode/comps.js +1 -1
  113. package/lib/commands/utils.js +47 -0
  114. package/lib/db/index.js +84 -0
  115. package/lib/utils/net/cloud-api-request.js +1 -1
  116. package/package.json +5 -3
  117. package/types/commands/constants.d.ts +8 -0
  118. package/types/commands/db/base.d.ts +44 -0
  119. package/types/commands/db/index.d.ts +1 -0
  120. package/types/commands/fun/base.d.ts +43 -0
  121. package/types/commands/fun/index.d.ts +1 -0
  122. package/types/commands/index.d.ts +2 -0
  123. package/types/commands/lowcode/app.d.ts +0 -14
  124. package/types/commands/utils.d.ts +3 -0
  125. package/types/db/index.d.ts +24 -0
  126. package/.yarn/cache/@apidevtools-json-schema-ref-parser-npm-11.6.4-9fc29728c0-ac01bb318d.zip +0 -0
  127. package/.yarn/cache/@babel-helper-string-parser-npm-7.24.7-560b175e3f-0956819304.zip +0 -0
  128. package/.yarn/cache/@cloudbase-cals-npm-1.1.4-2c5dbf184c-647e16569e.zip +0 -0
  129. package/.yarn/cache/@cloudbase-lowcode-builder-npm-1.8.105-680fb06fa6-99729786d4.zip +0 -0
  130. package/.yarn/cache/@cloudbase-lowcode-generator-npm-1.8.33-9cd1484411-ee9e0fb10a.zip +0 -0
  131. package/.yarn/cache/@cloudbase-weda-client-npm-1.0.34-5251cb044d-c97a16552f.zip +0 -0
  132. package/.yarn/cache/acorn-npm-8.11.3-0d7ab48b38-76d8e7d559.zip +0 -0
  133. package/.yarn/cache/any-promise-npm-1.3.0-f34eeaa7e7-0ee8a9bdbe.zip +0 -0
  134. package/.yarn/cache/browserfs-npm-1.4.3-9d2901bc71-cb7fc38b60.zip +0 -0
  135. package/.yarn/cache/de-indent-npm-1.0.2-66cccde30f-8deacc0f4a.zip +0 -0
  136. package/.yarn/cache/foreground-child-npm-3.1.1-77e78ed774-139d270bc8.zip +0 -0
  137. package/.yarn/cache/https-proxy-agent-npm-7.0.4-a51e13f5dc-daaab857a9.zip +0 -0
  138. package/.yarn/cache/jackspeak-npm-3.2.3-fac6542a37-a99542ac72.zip +0 -0
  139. package/.yarn/cache/json-schema-to-typescript-npm-14.0.5-d9a8933741-3bdc506378.zip +0 -0
  140. package/.yarn/cache/lru-cache-npm-10.2.2-c54b721fc3-98e8fc9369.zip +0 -0
  141. package/.yarn/cache/mz-npm-2.7.0-ec3cef4ec2-8427de0ece.zip +0 -0
  142. package/.yarn/cache/prettier-npm-3.3.0-2a7d3c0efa-0d3a7fca9c.zip +0 -0
  143. package/.yarn/cache/proc-log-npm-3.0.0-a8c21c2f0f-02b64e1b39.zip +0 -0
  144. package/.yarn/cache/prop-types-npm-15.8.1-17c71ee7ee-c056d3f1c0.zip +0 -0
  145. package/.yarn/cache/react-dom-npm-16.14.0-516a97ad33-5a5c49da0f.zip +0 -0
  146. package/.yarn/cache/react-eva-npm-1.1.14-1790f3792e-1aa908292e.zip +0 -0
  147. package/.yarn/cache/react-npm-16.14.0-932446ec69-8484f3ecb1.zip +0 -0
  148. package/.yarn/cache/rxjs-compat-npm-6.6.7-637635fe45-a47339680d.zip +0 -0
  149. package/.yarn/cache/scheduler-npm-0.19.1-a4dd0ffd3a-73e185a59e.zip +0 -0
  150. package/.yarn/cache/socks-proxy-agent-npm-8.0.3-30471cff1b-8fab38821c.zip +0 -0
  151. package/.yarn/cache/thenify-all-npm-1.6.0-96309bbc8b-dba7cc8a23.zip +0 -0
  152. package/.yarn/cache/thenify-npm-3.3.1-030bedb22c-84e1b804bf.zip +0 -0
  153. package/.yarn/cache/vue-loader-npm-15.9.8-438f4d0ff0-ca4c99b261.zip +0 -0
  154. package/.yarn/cache/vue-template-compiler-npm-2.6.14-37e260577c-0d03f804ac.zip +0 -0
@@ -58,7 +58,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
58
58
  return (mod && mod.__esModule) ? mod : { "default": mod };
59
59
  };
60
60
  Object.defineProperty(exports, "__esModule", { value: true });
61
- exports.TemplateSync = exports.ModelTypeSync = exports.LowCodeDeployApp = exports.LowCodeBuildAppConfig = exports.LowCodePreviewApp = exports.LowCodeBuildApp = exports.LowCodeWatch = void 0;
61
+ exports.ModelTypeSync = exports.LowCodeDeployApp = exports.LowCodeBuildAppConfig = exports.LowCodePreviewApp = exports.LowCodeBuildApp = exports.LowCodeWatch = void 0;
62
62
  const lodash_1 = require("lodash");
63
63
  const common_1 = require("../common");
64
64
  const decorators_1 = require("../../decorators");
@@ -67,10 +67,7 @@ const utils_2 = require("../../utils");
67
67
  const cloud_api_1 = require("@cloudbase/cloud-api");
68
68
  const toolbox_1 = require("@cloudbase/toolbox");
69
69
  const fs_extra_1 = __importDefault(require("fs-extra"));
70
- const os_1 = __importDefault(require("os"));
71
- const path_1 = __importDefault(require("path"));
72
70
  const dts_1 = require("../../utils/dts");
73
- const cals_1 = require("@cloudbase/cals");
74
71
  let lowcodeCli;
75
72
  if (process.argv.includes('lowcode')) {
76
73
  (0, utils_1.getLowcodeCli)().then((_) => (lowcodeCli = _));
@@ -327,8 +324,7 @@ exports.LowCodeDeployApp = LowCodeDeployApp;
327
324
  let ModelTypeSync = class ModelTypeSync extends common_1.Command {
328
325
  get options() {
329
326
  return {
330
- cmd: 'model',
331
- childCmd: 'sync-dts',
327
+ cmd: 'sync-model-dts',
332
328
  options: [
333
329
  {
334
330
  flags: '--envId <envId>',
@@ -395,262 +391,6 @@ ModelTypeSync = __decorate([
395
391
  (0, common_1.ICommand)({ supportPrivate: true })
396
392
  ], ModelTypeSync);
397
393
  exports.ModelTypeSync = ModelTypeSync;
398
- let TemplateSync = class TemplateSync extends common_1.Command {
399
- get options() {
400
- return {
401
- cmd: 'template',
402
- childCmd: 'sync',
403
- options: [
404
- {
405
- flags: '--source <source>',
406
- desc: '来源: 1-野鹤 2-自建模板'
407
- }
408
- ],
409
- desc: '同步官方模板应用内容',
410
- requiredEnvId: false
411
- };
412
- }
413
- execute(ctx, log, options) {
414
- var _a;
415
- return __awaiter(this, void 0, void 0, function* () {
416
- log.info('同步中...');
417
- const SourceType = {
418
- YEHE: '1',
419
- CUSTOM_MODULE: '2'
420
- };
421
- const source = Object.values(SourceType).includes(options.source)
422
- ? options.source
423
- : SourceType.YEHE;
424
- const envId = 'lowcode-5g5llxbq5bc9299e';
425
- const cloudService = yield getCloudServiceInstance(ctx);
426
- const files = [];
427
- const limit = 50;
428
- let count = 1;
429
- const fileDir = path_1.default.resolve(os_1.default.tmpdir(), 'templates');
430
- yield fs_extra_1.default.ensureDir(fileDir);
431
- yield fs_extra_1.default.rmdir(fileDir, { recursive: true });
432
- yield fs_extra_1.default.ensureDir(fileDir);
433
- if (source === SourceType.YEHE) {
434
- const templates = yield fs_extra_1.default.readJSON('data.json', 'utf8');
435
- console.log('模板总数:', templates.length);
436
- while (templates.length > 0) {
437
- const handledSolutionList = yield Promise.all(templates.splice(0, limit).map((item) => __awaiter(this, void 0, void 0, function* () {
438
- if (item.appIds.length > 0) {
439
- const apps = yield getAppsContent(item.appIds);
440
- return {
441
- name: item.templateName,
442
- templateId: item.templateId,
443
- status: item.status,
444
- apps
445
- };
446
- }
447
- else {
448
- return null;
449
- }
450
- })));
451
- const filePath = path_1.default.resolve(fileDir, `templates_${count}.json`);
452
- yield fs_extra_1.default.writeFile(filePath, JSON.stringify(handledSolutionList, null, 2), 'utf8');
453
- files.push(filePath);
454
- count += 1;
455
- }
456
- }
457
- else if (source === SourceType.CUSTOM_MODULE) {
458
- let total = Infinity;
459
- let currentTotal = 0;
460
- while (currentTotal < total) {
461
- const solutionListResult = yield cloudService.lowcode.request('DescribeSolutionList', {
462
- Limit: limit,
463
- Offset: currentTotal,
464
- KeyWords: '',
465
- EnvId: envId,
466
- TypeList: ['SELFBUILD', 'TPLEXPORT']
467
- });
468
- const solutionList = solutionListResult.SolutionInfoList;
469
- const handledSolutionList = yield Promise.all(solutionList.map((item) => __awaiter(this, void 0, void 0, function* () {
470
- const solution = yield cloudService.lowcode.request('DescribeSolution', {
471
- EnvId: envId,
472
- SolutionId: item.SolutionId
473
- });
474
- if (solution.SolutionAppInfos.length > 0) {
475
- const appIds = solution.SolutionAppInfos.map((item) => item.AppId);
476
- const apps = yield getAppsContent(appIds);
477
- return {
478
- name: item.Name,
479
- solutionId: item.SolutionId,
480
- version: item.Version,
481
- apps
482
- };
483
- }
484
- else {
485
- return null;
486
- }
487
- })));
488
- const filePath = path_1.default.resolve(fileDir, `templates_${count}.json`);
489
- yield fs_extra_1.default.writeFile(filePath, JSON.stringify(handledSolutionList, null, 2), 'utf8');
490
- files.push(filePath);
491
- total = solutionListResult.TotalCount;
492
- currentTotal += limit;
493
- count += 1;
494
- }
495
- }
496
- log.success(`同步官方模板应用内容已完成. 文件路径:`);
497
- log.success(files.join('\n'));
498
- const appIdNameMap = {};
499
- const appsPath = path_1.default.resolve(process.cwd(), 'apps');
500
- try {
501
- const items = yield fs_extra_1.default.readdir(appsPath);
502
- const directories = [];
503
- for (const item of items) {
504
- const itemPath = path_1.default.join(appsPath, item);
505
- const stats = yield fs_extra_1.default.stat(itemPath);
506
- if (stats.isDirectory()) {
507
- directories.push(item);
508
- const appConfig = yield fs_extra_1.default.readJSON(path_1.default.resolve(itemPath, 'src', 'app-config.json'));
509
- const appId = appConfig.id;
510
- appIdNameMap[appId] = item;
511
- }
512
- }
513
- }
514
- catch (error) {
515
- console.error('Error reading directory:', error);
516
- }
517
- for (let fileUrl of files) {
518
- const items = yield fs_extra_1.default.readJSON(fileUrl);
519
- for (let item of items) {
520
- if (!item)
521
- continue;
522
- let done = false;
523
- if (((_a = item === null || item === void 0 ? void 0 : item.apps) === null || _a === void 0 ? void 0 : _a.length) > 0) {
524
- try {
525
- yield Promise.all(item === null || item === void 0 ? void 0 : item.apps.map((app) => __awaiter(this, void 0, void 0, function* () {
526
- var _b, _c;
527
- if (app === null || app === void 0 ? void 0 : app.error) {
528
- return null;
529
- }
530
- else {
531
- if (appIdNameMap[app.appId]) {
532
- app.name = appIdNameMap[app.appId];
533
- }
534
- else {
535
- const result = yield (0, toolbox_1.fetch)('http://localhost:1234/v1/chat/completions', {
536
- method: 'POST',
537
- headers: {
538
- 'Content-Type': 'application/json'
539
- },
540
- body: JSON.stringify({
541
- model: 'TheBloke/Mistral-7B-Instruct-v0.2-GGUF',
542
- messages: [
543
- {
544
- role: 'system',
545
- content: '你是一个目录命名专家。目录名只包括小写字母,数字和下划线, 不能包含其它符号。\n正确的示例: community_deals_platform\n错误的示例: restaurant_company_website'
546
- },
547
- {
548
- role: 'user',
549
- content: `请为“${(_b = app === null || app === void 0 ? void 0 : app.content) === null || _b === void 0 ? void 0 : _b.label}”起一个目录名。请始终只返回一个目录名,其它不用返回`
550
- }
551
- ],
552
- temperature: 1,
553
- stream: false
554
- }),
555
- timeout: 30 * 60 * 1000
556
- });
557
- app.name = result.choices[0].message.content
558
- .replace(/[\s\\]+/g, '')
559
- .replace(/-/g, '_');
560
- }
561
- if (app.content) {
562
- const calsAppData = app.content;
563
- calsAppData.id = app.appId;
564
- const { clientId, originHistoryId, mpAppId, uin } = app.extra;
565
- calsAppData.extra.clientId = clientId;
566
- calsAppData.extra.originHistoryId = `${originHistoryId}`;
567
- calsAppData.extra.mpAppId = mpAppId;
568
- calsAppData.extra.envId = envId;
569
- calsAppData.extra.uin = uin;
570
- calsAppData.extra.domain =
571
- 'lowcode-5g5llxbq5bc9299e-1300677802.tcloudbaseapp.com';
572
- calsAppData.extra.resourceAppId = '';
573
- calsAppData.extra.endpointType = '';
574
- const codeItems = (0, cals_1.calsToCode)(app.content, 'v0');
575
- yield Promise.all(codeItems.map((codeItem) => __awaiter(this, void 0, void 0, function* () {
576
- const codePath = path_1.default.resolve(appsPath, app.name, codeItem.path);
577
- yield fs_extra_1.default.ensureFile(codePath);
578
- yield fs_extra_1.default.writeFile(codePath, codeItem.code || '', 'utf8');
579
- })));
580
- console.log('写入成功:', app.appId, (_c = app === null || app === void 0 ? void 0 : app.content) === null || _c === void 0 ? void 0 : _c.label, app.name);
581
- }
582
- else {
583
- console.error('写入异常:', app.appId, app.error);
584
- }
585
- }
586
- })));
587
- }
588
- catch (e) {
589
- console.error('异常:', item.templateId, e.message);
590
- }
591
- done = true;
592
- }
593
- else {
594
- done = true;
595
- }
596
- if (done) {
597
- if (source === SourceType.YEHE) {
598
- let templates = yield fs_extra_1.default.readJSON('data.json', 'utf8');
599
- templates = templates.filter((tItem) => tItem.templateId !== item.templateId);
600
- yield fs_extra_1.default.writeFile('data.json', JSON.stringify(templates, null, 2), 'utf8');
601
- }
602
- }
603
- }
604
- yield fs_extra_1.default.writeFile(fileUrl, JSON.stringify(items, null, 2), 'utf8');
605
- }
606
- function getAppsContent(appIds) {
607
- return __awaiter(this, void 0, void 0, function* () {
608
- return yield Promise.all(appIds.map((appId) => __awaiter(this, void 0, void 0, function* () {
609
- var _a, _b, _c;
610
- try {
611
- let result = yield cloudService.lowcode.request('DescribeAppDetail', {
612
- WeAppId: appId
613
- });
614
- const { Title, LatestHistory, OwnerInfo, MpAppId, ClientId } = result.Data;
615
- const label = Title;
616
- const historyId = (_a = JSON.parse(LatestHistory)) === null || _a === void 0 ? void 0 : _a.id;
617
- const extra = {
618
- originHistoryId: historyId,
619
- uin: OwnerInfo.Uin,
620
- mpAppId: MpAppId,
621
- clientId: ClientId
622
- };
623
- result = yield cloudService.lowcode.request('DescribeAppHistoryPreSignUrl', {
624
- HisIds: [historyId],
625
- HttpMethod: 'get',
626
- WeAppsId: appId
627
- });
628
- result = yield (0, toolbox_1.fetch)((_c = (_b = result === null || result === void 0 ? void 0 : result.Data) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.UploadUrl);
629
- result.label = label;
630
- return { appId, content: result, extra };
631
- }
632
- catch (e) {
633
- return { appId, error: e.message };
634
- }
635
- })));
636
- });
637
- }
638
- });
639
- }
640
- };
641
- __decorate([
642
- (0, decorators_1.InjectParams)(),
643
- __param(0, (0, decorators_1.CmdContext)()),
644
- __param(1, (0, decorators_1.Log)()),
645
- __param(2, (0, decorators_1.ArgsOptions)()),
646
- __metadata("design:type", Function),
647
- __metadata("design:paramtypes", [Object, decorators_1.Logger, Object]),
648
- __metadata("design:returntype", Promise)
649
- ], TemplateSync.prototype, "execute", null);
650
- TemplateSync = __decorate([
651
- (0, common_1.ICommand)({ supportPrivate: true })
652
- ], TemplateSync);
653
- exports.TemplateSync = TemplateSync;
654
394
  function getCloudServiceInstance(ctx) {
655
395
  return __awaiter(this, void 0, void 0, function* () {
656
396
  let credential;
@@ -123,7 +123,7 @@ let LowCodeCreateComps = class LowCodeCreateComps extends common_1.Command {
123
123
  else {
124
124
  const comp = comps.rows.find((row) => row.groupName === compsName);
125
125
  if (!comp) {
126
- throw new error_1.CloudBaseError(`云端不存在组件库 ${compsName},请到低码控制台新建该组件库!`);
126
+ throw new error_1.CloudBaseError(`云端不存在组件库 ${compsName},请在微搭控制台-应用菜单中,打开任意一个应用的编辑器,点击素材-组件库管理模块,并创建组件库`);
127
127
  }
128
128
  }
129
129
  yield lowcodeCli.bootstrap(compsName, log);
@@ -0,0 +1,47 @@
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.selectEnv = void 0;
16
+ const lodash_1 = require("lodash");
17
+ const env_1 = require("../env");
18
+ const constants_1 = require("./constants");
19
+ const inquirer_1 = __importDefault(require("inquirer"));
20
+ const utils_1 = require("../utils");
21
+ function selectEnv(options = {}) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ const loading = (0, utils_1.loadingFactory)();
24
+ const { source = [] } = options;
25
+ loading.start('获取环境列表中...');
26
+ let data = yield (0, env_1.listEnvs)({ source }).finally(() => {
27
+ loading.stop();
28
+ });
29
+ const choices = (0, lodash_1.sortBy)(data, ['Alias']).map((item) => {
30
+ return {
31
+ name: `${item.Alias || item.EnvId} (${item.EnvId}) ${item.Status === constants_1.EnvStatus.NORMAL ? '正常' : '不可用'}`,
32
+ value: item.EnvId
33
+ };
34
+ });
35
+ const questions = [
36
+ {
37
+ type: 'list',
38
+ name: 'env',
39
+ message: '请选择环境',
40
+ choices: choices
41
+ }
42
+ ];
43
+ const answers = yield inquirer_1.default.prompt(questions);
44
+ return answers['env'];
45
+ });
46
+ }
47
+ exports.selectEnv = selectEnv;
@@ -0,0 +1,84 @@
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
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.publishModel = exports.getModel = exports.updateModel = exports.createModel = exports.listModels = void 0;
13
+ const net_1 = require("../utils/net");
14
+ const lowCodeService = new net_1.CloudApiService('lowcode', {}, '2021-01-08');
15
+ function listModels(options = {}) {
16
+ return __awaiter(this, void 0, void 0, function* () {
17
+ const { envId } = options;
18
+ const datasourceList = yield lowCodeService.request('DescribeDataSourceList', {
19
+ EnvId: envId,
20
+ PageIndex: 1,
21
+ PageSize: 1000,
22
+ DataSourceNames: options.name,
23
+ QuerySystemModel: true,
24
+ QueryConnector: 0
25
+ });
26
+ const rows = datasourceList.Data.Rows;
27
+ return rows;
28
+ });
29
+ }
30
+ exports.listModels = listModels;
31
+ function createModel({ envId, name, title, schema }) {
32
+ return __awaiter(this, void 0, void 0, function* () {
33
+ return ((yield lowCodeService.request('CreateDataSourceDetail', {
34
+ EnvId: envId,
35
+ Title: title,
36
+ Name: name,
37
+ Type: 'database',
38
+ TableNameRule: "only_name",
39
+ Schema: JSON.stringify(schema)
40
+ })).Data);
41
+ });
42
+ }
43
+ exports.createModel = createModel;
44
+ function updateModel({ envId, id, title, schema }) {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ return ((yield lowCodeService.request('ModifyDataSource', {
47
+ Id: id,
48
+ EnvId: envId,
49
+ Title: title,
50
+ Schema: JSON.stringify(schema)
51
+ })).Data);
52
+ });
53
+ }
54
+ exports.updateModel = updateModel;
55
+ function getModel(options) {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ const { envId, name } = options;
58
+ try {
59
+ return (yield lowCodeService.request('DescribeDataSource', {
60
+ EnvId: envId,
61
+ Name: name
62
+ })).Data;
63
+ }
64
+ catch (e) {
65
+ if (e.original.Code === 'ResourceNotFound') {
66
+ return null;
67
+ }
68
+ else {
69
+ throw e;
70
+ }
71
+ }
72
+ });
73
+ }
74
+ exports.getModel = getModel;
75
+ function publishModel(options) {
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ const { envId, ids } = options;
78
+ return (yield lowCodeService.request('BatchPublishDataSources', {
79
+ EnvId: envId,
80
+ DataSourceIds: ids
81
+ })).Data;
82
+ });
83
+ }
84
+ exports.publishModel = publishModel;
@@ -21,7 +21,7 @@ class CloudApiService {
21
21
  constructor(service, baseParams, version = '') {
22
22
  this.apiService = new cloud_api_1.CloudApiService({
23
23
  service,
24
- version: service === 'tcr' ? version : '2019-09-24',
24
+ version: version || '2019-09-24',
25
25
  baseParams,
26
26
  proxy: (0, toolbox_1.getProxy)(),
27
27
  timeout: constant_1.REQUEST_TIMEOUT,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/cli",
3
- "version": "2.5.1-alpha.5",
3
+ "version": "2.6.0-alpha.1",
4
4
  "description": "cli tool for cloudbase",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -20,8 +20,8 @@
20
20
  "url": "https://github.com/TencentCloudBase/cloud-base-cli.git"
21
21
  },
22
22
  "bin": {
23
- "tcb": "bin/tcb.js",
24
- "cloudbase": "bin/cloudbase.js"
23
+ "cloudbase": "bin/cloudbase.js",
24
+ "tcb": "bin/tcb.js"
25
25
  },
26
26
  "husky": {
27
27
  "hooks": {
@@ -33,6 +33,7 @@
33
33
  "dependencies": {
34
34
  "@cloudbase/cloud-api": "^0.5.5",
35
35
  "@cloudbase/framework-core": "^1.9.7",
36
+ "@cloudbase/functions-framework": "^0.0.12",
36
37
  "@cloudbase/lowcode-cli": "^0.21.1",
37
38
  "@cloudbase/manager-node": "4.2.8",
38
39
  "@cloudbase/toolbox": "^0.7.5",
@@ -54,6 +55,7 @@
54
55
  "lowdb": "^1.0.0",
55
56
  "make-dir": "^3.0.0",
56
57
  "node-fetch": "^2.6.0",
58
+ "nodemon": "^3.1.4",
57
59
  "open": "^7.0.0",
58
60
  "ora": "^4.0.2",
59
61
  "portfinder": "^1.0.28",
@@ -0,0 +1,8 @@
1
+ export declare const EnvSource: {
2
+ MINIAPP: string;
3
+ QCLOUD: string;
4
+ };
5
+ export declare const EnvStatus: {
6
+ NORMAL: string;
7
+ UNAVAILABLE: string;
8
+ };
@@ -0,0 +1,44 @@
1
+ import { Command } from '../common';
2
+ import { Logger } from '../../decorators';
3
+ export declare class DbListCommand extends Command {
4
+ get options(): {
5
+ cmd: string;
6
+ childCmd: string;
7
+ options: {
8
+ flags: string;
9
+ desc: string;
10
+ }[];
11
+ requiredEnvId: boolean;
12
+ autoRunLogin: boolean;
13
+ desc: string;
14
+ };
15
+ execute(envId: any, log: Logger): Promise<void>;
16
+ }
17
+ export declare class DbPullCommand extends Command {
18
+ get options(): {
19
+ cmd: string;
20
+ childCmd: string;
21
+ options: {
22
+ flags: string;
23
+ desc: string;
24
+ }[];
25
+ requiredEnvId: boolean;
26
+ autoRunLogin: boolean;
27
+ desc: string;
28
+ };
29
+ execute(envId: any, params: any, log: Logger): Promise<void>;
30
+ }
31
+ export declare class DbPushCommand extends Command {
32
+ get options(): {
33
+ cmd: string;
34
+ childCmd: string;
35
+ options: {
36
+ flags: string;
37
+ desc: string;
38
+ }[];
39
+ requiredEnvId: boolean;
40
+ autoRunLogin: boolean;
41
+ desc: string;
42
+ };
43
+ execute(envId: any, params: any, log: Logger): Promise<void>;
44
+ }
@@ -0,0 +1 @@
1
+ export * from './base';
@@ -0,0 +1,43 @@
1
+ import { Logger } from '../../decorators';
2
+ import { Command } from '../common';
3
+ export declare class FunListCommand extends Command {
4
+ get options(): {
5
+ cmd: string;
6
+ childCmd: string;
7
+ options: {
8
+ flags: string;
9
+ desc: string;
10
+ }[];
11
+ requiredEnvId: boolean;
12
+ autoRunLogin: boolean;
13
+ desc: string;
14
+ };
15
+ execute(envId: any, log: Logger): Promise<void>;
16
+ }
17
+ export declare class FunDeployCommand extends Command {
18
+ get options(): {
19
+ cmd: string;
20
+ childCmd: string;
21
+ options: {
22
+ flags: string;
23
+ desc: string;
24
+ }[];
25
+ requiredEnvId: boolean;
26
+ autoRunLogin: boolean;
27
+ desc: string;
28
+ };
29
+ execute(envId: any, log: Logger, options: any): Promise<void>;
30
+ }
31
+ export declare class FunRunCommand extends Command {
32
+ get options(): {
33
+ cmd: string;
34
+ childCmd: string;
35
+ options: {
36
+ flags: string;
37
+ desc: string;
38
+ }[];
39
+ requiredEnvId: boolean;
40
+ desc: string;
41
+ };
42
+ execute(logger: Logger): Promise<void>;
43
+ }
@@ -0,0 +1 @@
1
+ export * from './base';
@@ -11,3 +11,5 @@ export * from './framework';
11
11
  export * from './smart';
12
12
  export * from './lowcode';
13
13
  export * from './run';
14
+ export * from './db';
15
+ export * from './fun';
@@ -69,7 +69,6 @@ export declare class LowCodeDeployApp extends Command {
69
69
  export declare class ModelTypeSync extends Command {
70
70
  get options(): {
71
71
  cmd: string;
72
- childCmd: string;
73
72
  options: {
74
73
  flags: string;
75
74
  desc: string;
@@ -80,16 +79,3 @@ export declare class ModelTypeSync extends Command {
80
79
  };
81
80
  execute(ctx: ICommandContext, log: Logger, options: any): Promise<void>;
82
81
  }
83
- export declare class TemplateSync extends Command {
84
- get options(): {
85
- cmd: string;
86
- childCmd: string;
87
- options: {
88
- flags: string;
89
- desc: string;
90
- }[];
91
- desc: string;
92
- requiredEnvId: boolean;
93
- };
94
- execute(ctx: ICommandContext, log: Logger, options: any): Promise<void>;
95
- }
@@ -0,0 +1,3 @@
1
+ export declare function selectEnv(options?: {
2
+ source?: string[];
3
+ }): Promise<string>;
@@ -0,0 +1,24 @@
1
+ export declare function listModels(options?: {
2
+ envId?: string;
3
+ name?: string[];
4
+ }): Promise<any[]>;
5
+ export declare function createModel({ envId, name, title, schema }: {
6
+ envId: string;
7
+ name: string;
8
+ title: string;
9
+ schema: any;
10
+ }): Promise<any>;
11
+ export declare function updateModel({ envId, id, title, schema }: {
12
+ envId: string;
13
+ id: string;
14
+ title: string;
15
+ schema: any;
16
+ }): Promise<any>;
17
+ export declare function getModel(options: {
18
+ envId: string;
19
+ name: string;
20
+ }): Promise<any>;
21
+ export declare function publishModel(options: {
22
+ envId: string;
23
+ ids: string[];
24
+ }): Promise<any>;