@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.
Files changed (205) hide show
  1. package/lib/auth/login.js +51 -65
  2. package/lib/auth/logout.js +3 -14
  3. package/lib/commands/account/login.js +136 -149
  4. package/lib/commands/account/logout.js +3 -14
  5. package/lib/commands/ag/base.js +203 -0
  6. package/lib/commands/ag/create.js +301 -0
  7. package/lib/commands/ag/debug/index.html +699 -0
  8. package/lib/commands/ag/delete.js +200 -0
  9. package/lib/commands/ag/deploy.js +185 -0
  10. package/lib/commands/ag/detail.js +113 -0
  11. package/lib/commands/ag/index.js +22 -0
  12. package/lib/commands/ag/list.js +155 -0
  13. package/lib/commands/ag/run.js +644 -0
  14. package/lib/commands/ai/index.js +76 -95
  15. package/lib/commands/cloudfunction/base.js +182 -203
  16. package/lib/commands/cloudrun/base.js +578 -603
  17. package/lib/commands/common.js +48 -63
  18. package/lib/commands/config/delete.js +16 -27
  19. package/lib/commands/config/get.js +13 -24
  20. package/lib/commands/config/list.js +16 -27
  21. package/lib/commands/config/set.js +33 -44
  22. package/lib/commands/db/base.js +221 -240
  23. package/lib/commands/env/base.js +36 -49
  24. package/lib/commands/env/domain.js +79 -94
  25. package/lib/commands/env/login.js +120 -135
  26. package/lib/commands/framework/index.js +32 -49
  27. package/lib/commands/fun/base.js +223 -244
  28. package/lib/commands/functions/alias/getRoute.js +33 -44
  29. package/lib/commands/functions/alias/setRoute.js +36 -47
  30. package/lib/commands/functions/code-download.js +43 -54
  31. package/lib/commands/functions/code-update.js +23 -34
  32. package/lib/commands/functions/concurrency/delete.js +11 -22
  33. package/lib/commands/functions/concurrency/list.js +20 -31
  34. package/lib/commands/functions/concurrency/set.js +13 -24
  35. package/lib/commands/functions/config-update.js +30 -41
  36. package/lib/commands/functions/copy.js +12 -23
  37. package/lib/commands/functions/delete.js +30 -41
  38. package/lib/commands/functions/deploy.js +184 -202
  39. package/lib/commands/functions/detail.js +23 -34
  40. package/lib/commands/functions/invoke.js +69 -75
  41. package/lib/commands/functions/layer/bind.js +102 -105
  42. package/lib/commands/functions/layer/create.js +29 -35
  43. package/lib/commands/functions/layer/delete.js +42 -48
  44. package/lib/commands/functions/layer/download.js +52 -58
  45. package/lib/commands/functions/layer/list.js +44 -50
  46. package/lib/commands/functions/layer/sort.js +39 -45
  47. package/lib/commands/functions/list.js +25 -36
  48. package/lib/commands/functions/log.js +65 -73
  49. package/lib/commands/functions/run.js +118 -116
  50. package/lib/commands/functions/trigger-create.js +32 -43
  51. package/lib/commands/functions/trigger-delete.js +50 -61
  52. package/lib/commands/functions/version/list.js +29 -40
  53. package/lib/commands/functions/version/publish.js +11 -22
  54. package/lib/commands/gateway/create.js +50 -61
  55. package/lib/commands/gateway/delete.js +38 -49
  56. package/lib/commands/gateway/domain.js +65 -80
  57. package/lib/commands/gateway/list.js +31 -42
  58. package/lib/commands/gateway/switch.js +48 -61
  59. package/lib/commands/helpers/init.js +226 -249
  60. package/lib/commands/helpers/new.js +35 -46
  61. package/lib/commands/helpers/open.js +22 -33
  62. package/lib/commands/hosting/hosting.js +157 -178
  63. package/lib/commands/index.js +1 -0
  64. package/lib/commands/lowcode/app.js +114 -144
  65. package/lib/commands/lowcode/comps.js +136 -127
  66. package/lib/commands/lowcode/utils.js +11 -22
  67. package/lib/commands/pull/pull.js +33 -46
  68. package/lib/commands/run/delete.js +35 -46
  69. package/lib/commands/run/image/delete.js +32 -39
  70. package/lib/commands/run/image/download.js +26 -33
  71. package/lib/commands/run/image/list.js +41 -48
  72. package/lib/commands/run/image/upload.js +26 -33
  73. package/lib/commands/run/list.js +32 -43
  74. package/lib/commands/run/service/config.js +17 -28
  75. package/lib/commands/run/service/deploy.js +15 -26
  76. package/lib/commands/run/service/list.js +48 -59
  77. package/lib/commands/run/service/update.js +7 -18
  78. package/lib/commands/run/standalonegateway/create.js +35 -42
  79. package/lib/commands/run/standalonegateway/destroy.js +23 -30
  80. package/lib/commands/run/standalonegateway/list.js +19 -26
  81. package/lib/commands/run/standalonegateway/package.js +31 -38
  82. package/lib/commands/run/standalonegateway/turn.js +27 -34
  83. package/lib/commands/run/version/create.js +198 -205
  84. package/lib/commands/run/version/delete.js +31 -38
  85. package/lib/commands/run/version/list.js +42 -49
  86. package/lib/commands/run/version/modify.js +27 -34
  87. package/lib/commands/run/version/update.js +201 -208
  88. package/lib/commands/runf/base.js +216 -237
  89. package/lib/commands/self-update.js +59 -72
  90. package/lib/commands/smart.js +66 -79
  91. package/lib/commands/storage/storage.js +192 -219
  92. package/lib/commands/third/thirdAttach.js +16 -27
  93. package/lib/commands/utils.js +119 -149
  94. package/lib/db/index.js +48 -67
  95. package/lib/decorators/captureError.js +10 -21
  96. package/lib/decorators/guard.js +11 -22
  97. package/lib/decorators/injectParams.js +29 -40
  98. package/lib/decorators/params/common.js +5 -2
  99. package/lib/decorators/params/index.js +3 -12
  100. package/lib/env/domain.js +13 -28
  101. package/lib/env/index.js +25 -44
  102. package/lib/env/login.js +30 -45
  103. package/lib/function/alias.js +31 -44
  104. package/lib/function/base.js +187 -215
  105. package/lib/function/code.js +8 -19
  106. package/lib/function/concurrency.js +43 -58
  107. package/lib/function/create.js +43 -53
  108. package/lib/function/delete.js +22 -35
  109. package/lib/function/layer/attach.js +33 -46
  110. package/lib/function/layer/create.js +34 -45
  111. package/lib/function/layer/delete.js +5 -16
  112. package/lib/function/layer/download.js +11 -22
  113. package/lib/function/layer/list.js +12 -25
  114. package/lib/function/layer/sort.js +6 -17
  115. package/lib/function/trigger.js +65 -82
  116. package/lib/function/update.js +24 -32
  117. package/lib/function/version.js +29 -42
  118. package/lib/function/vpc.js +12 -25
  119. package/lib/gateway/index.js +77 -104
  120. package/lib/hosting.js +157 -188
  121. package/lib/run/delete.js +3 -12
  122. package/lib/run/image/build.js +6 -15
  123. package/lib/run/image/delete.js +3 -12
  124. package/lib/run/image/info.js +3 -12
  125. package/lib/run/image/list.js +6 -15
  126. package/lib/run/list.js +19 -30
  127. package/lib/run/repo.js +6 -15
  128. package/lib/run/service/common.js +160 -173
  129. package/lib/run/service/config.js +44 -57
  130. package/lib/run/service/deployPackage.js +33 -44
  131. package/lib/run/service/list.js +8 -14
  132. package/lib/run/service/showLogs.js +69 -90
  133. package/lib/run/service/update.js +50 -63
  134. package/lib/run/standalonegateway/create.js +3 -12
  135. package/lib/run/standalonegateway/destroy.js +3 -12
  136. package/lib/run/standalonegateway/list.js +3 -12
  137. package/lib/run/standalonegateway/package/list.js +3 -12
  138. package/lib/run/standalonegateway/turn/off.js +3 -12
  139. package/lib/run/standalonegateway/turn/on.js +3 -12
  140. package/lib/run/version/create.js +41 -31
  141. package/lib/run/version/delete.js +3 -12
  142. package/lib/run/version/list.js +3 -12
  143. package/lib/run/version/modify.js +3 -12
  144. package/lib/run/version/repo.js +6 -15
  145. package/lib/run/version/update.js +37 -26
  146. package/lib/storage.js +62 -93
  147. package/lib/third/index.js +6 -17
  148. package/lib/utils/ai/banner.js +49 -60
  149. package/lib/utils/ai/claudeWindows.js +2 -2
  150. package/lib/utils/ai/config.js +169 -206
  151. package/lib/utils/ai/ensureFiles.js +6 -17
  152. package/lib/utils/ai/env.js +16 -27
  153. package/lib/utils/ai/envLocalManager.js +35 -52
  154. package/lib/utils/ai/router.js +927 -1005
  155. package/lib/utils/ai/setup.js +527 -563
  156. package/lib/utils/auth.js +3 -14
  157. package/lib/utils/checkTcbrEnv.js +20 -31
  158. package/lib/utils/cli-table.js +6 -1
  159. package/lib/utils/config.js +4 -13
  160. package/lib/utils/dts.js +98 -113
  161. package/lib/utils/env.js +154 -175
  162. package/lib/utils/function-packer.js +29 -42
  163. package/lib/utils/log.js +10 -21
  164. package/lib/utils/mcp-config-modifier.js +105 -120
  165. package/lib/utils/net/cloud-api-request.js +15 -23
  166. package/lib/utils/net/credential.js +26 -39
  167. package/lib/utils/net/http-request.js +63 -80
  168. package/lib/utils/net/manager-service.js +22 -35
  169. package/lib/utils/notice.js +16 -27
  170. package/lib/utils/output/loading.js +3 -12
  171. package/lib/utils/parallel.js +32 -43
  172. package/lib/utils/platform/mac.js +4 -15
  173. package/lib/utils/platform/port.js +4 -15
  174. package/lib/utils/prompt/select.js +6 -15
  175. package/lib/utils/report.js +28 -33
  176. package/lib/utils/reporter/agree.js +11 -22
  177. package/lib/utils/reporter/download.js +17 -28
  178. package/lib/utils/reporter/usage.js +12 -23
  179. package/lib/utils/store/auth.js +17 -30
  180. package/lib/utils/store/config.js +11 -25
  181. package/lib/utils/store/db.js +17 -36
  182. package/lib/utils/tcbrApi/callTcbrApi.js +19 -28
  183. package/lib/utils/template-manager.js +215 -242
  184. package/lib/utils/template.js +81 -96
  185. package/lib/utils/tools/common.js +45 -56
  186. package/lib/utils/tools/time.js +5 -16
  187. package/lib/utils/url.js +10 -4
  188. package/package.json +2 -2
  189. package/specs/ag-command/design.md +421 -0
  190. package/specs/ag-command/doc.md +204 -0
  191. package/specs/ag-command/requirements.md +173 -0
  192. package/specs/ag-command/summary.md +174 -0
  193. package/specs/ag-command/tasks.md +197 -0
  194. package/specs/ag-command/usage-guide.md +420 -0
  195. package/tsconfig.json +1 -1
  196. package/types/commands/ag/base.d.ts +44 -0
  197. package/types/commands/ag/create.d.ts +25 -0
  198. package/types/commands/ag/delete.d.ts +32 -0
  199. package/types/commands/ag/deploy.d.ts +31 -0
  200. package/types/commands/ag/detail.d.ts +28 -0
  201. package/types/commands/ag/index.d.ts +6 -0
  202. package/types/commands/ag/list.d.ts +35 -0
  203. package/types/commands/ag/run.d.ts +52 -0
  204. package/types/commands/cloudrun/base.d.ts +10 -0
  205. package/types/commands/index.d.ts +1 -0
@@ -1,22 +1,13 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.listService = void 0;
13
4
  const utils_1 = require("../../utils");
14
5
  const tcbService = utils_1.CloudApiService.getInstance('tcb');
15
- const listService = (options) => __awaiter(void 0, void 0, void 0, function* () {
16
- const { data: { ServerList: serverList } } = yield (0, utils_1.callTcbrApi)('DescribeCloudRunServers', {
6
+ const listService = async (options) => {
7
+ const { data: { ServerList: serverList } } = await (0, utils_1.callTcbrApi)('DescribeCloudRunServers', {
17
8
  EnvId: options.envId,
18
9
  });
19
- const { CloudBaseRunServerSet: serverSet } = yield tcbService.request('DescribeCloudBaseRunServers', {
10
+ const { CloudBaseRunServerSet: serverSet } = await tcbService.request('DescribeCloudBaseRunServers', {
20
11
  EnvId: options.envId,
21
12
  Offset: 0,
22
13
  Limit: options.limit || 100
@@ -24,8 +15,11 @@ const listService = (options) => __awaiter(void 0, void 0, void 0, function* ()
24
15
  if (!serverList.length)
25
16
  return [];
26
17
  const serverInfo = serverList.map(serverItem => {
27
- return Object.assign(Object.assign({}, serverItem), { CreatedTime: serverSet.find((item) => item.ServerName === serverItem.ServerName).CreatedTime });
18
+ return {
19
+ ...serverItem,
20
+ CreatedTime: serverSet.find((item) => item.ServerName === serverItem.ServerName).CreatedTime
21
+ };
28
22
  });
29
23
  return serverInfo;
30
- });
24
+ };
31
25
  exports.listService = listService;
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
@@ -16,102 +7,90 @@ exports.getLogs = exports.getBuildStatus = void 0;
16
7
  const utils_1 = require("../../utils");
17
8
  const chalk_1 = __importDefault(require("chalk"));
18
9
  const i18n_1 = require("../../i18n");
19
- function getBuildStatus(envId, serviceName) {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- const { data: deployRes } = yield (0, utils_1.callTcbrApi)('DescribeCloudRunDeployRecord', {
22
- EnvId: envId,
23
- ServerName: serviceName,
24
- });
25
- if (deployRes === null || deployRes === void 0 ? void 0 : deployRes.DeployRecords) {
26
- if ((deployRes === null || deployRes === void 0 ? void 0 : deployRes.DeployRecords[0].Status) === "deploying") {
27
- return Promise.resolve('pending');
28
- }
29
- else {
30
- return Promise.resolve('completed');
31
- }
10
+ async function getBuildStatus(envId, serviceName) {
11
+ const { data: deployRes } = await (0, utils_1.callTcbrApi)('DescribeCloudRunDeployRecord', {
12
+ EnvId: envId,
13
+ ServerName: serviceName,
14
+ });
15
+ if (deployRes === null || deployRes === void 0 ? void 0 : deployRes.DeployRecords) {
16
+ if ((deployRes === null || deployRes === void 0 ? void 0 : deployRes.DeployRecords[0].Status) === "deploying") {
17
+ return Promise.resolve('pending');
32
18
  }
33
19
  else {
34
- return Promise.resolve('pending');
20
+ return Promise.resolve('completed');
35
21
  }
36
- });
22
+ }
23
+ else {
24
+ return Promise.resolve('pending');
25
+ }
37
26
  }
38
27
  exports.getBuildStatus = getBuildStatus;
39
- function getBuildId(envId, serviceName) {
40
- return __awaiter(this, void 0, void 0, function* () {
41
- const { data: deployRes } = yield (0, utils_1.callTcbrApi)('DescribeCloudRunDeployRecord', {
42
- EnvId: envId,
43
- ServerName: serviceName,
44
- });
45
- if (deployRes === null || deployRes === void 0 ? void 0 : deployRes.DeployRecords) {
46
- if (deployRes.DeployRecords[0].Status !== 'deploying') {
47
- return Promise.resolve(deployRes.DeployRecords[0].BuildId);
48
- }
28
+ async function getBuildId(envId, serviceName) {
29
+ const { data: deployRes } = await (0, utils_1.callTcbrApi)('DescribeCloudRunDeployRecord', {
30
+ EnvId: envId,
31
+ ServerName: serviceName,
32
+ });
33
+ if (deployRes === null || deployRes === void 0 ? void 0 : deployRes.DeployRecords) {
34
+ if (deployRes.DeployRecords[0].Status !== 'deploying') {
35
+ return Promise.resolve(deployRes.DeployRecords[0].BuildId);
49
36
  }
37
+ }
38
+ }
39
+ async function getRunId(envId, serviceName) {
40
+ return new Promise((resolve) => {
41
+ const timer = setInterval(async () => {
42
+ const { data: deployRes } = await (0, utils_1.callTcbrApi)('DescribeCloudRunDeployRecord', {
43
+ EnvId: envId,
44
+ ServerName: serviceName,
45
+ });
46
+ if (deployRes === null || deployRes === void 0 ? void 0 : deployRes.DeployRecords) {
47
+ clearInterval(timer);
48
+ resolve(deployRes.DeployRecords[0].RunId);
49
+ }
50
+ }, 3000);
50
51
  });
51
52
  }
52
- function getRunId(envId, serviceName) {
53
- return __awaiter(this, void 0, void 0, function* () {
54
- return new Promise((resolve) => {
55
- const timer = setInterval(() => __awaiter(this, void 0, void 0, function* () {
56
- const { data: deployRes } = yield (0, utils_1.callTcbrApi)('DescribeCloudRunDeployRecord', {
53
+ async function showProcessLogs(envId, runId, serviceName) {
54
+ return new Promise(resolve => {
55
+ const timer = setInterval(async () => {
56
+ if (await getBuildStatus(envId, serviceName) === 'completed') {
57
+ clearInterval(timer);
58
+ resolve();
59
+ }
60
+ else {
61
+ const { data: processLogs } = await (0, utils_1.callTcbrApi)('DescribeCloudRunProcessLog', {
57
62
  EnvId: envId,
58
- ServerName: serviceName,
63
+ RunId: runId,
59
64
  });
60
- if (deployRes === null || deployRes === void 0 ? void 0 : deployRes.DeployRecords) {
61
- clearInterval(timer);
62
- resolve(deployRes.DeployRecords[0].RunId);
63
- }
64
- }), 3000);
65
- });
66
- });
67
- }
68
- function showProcessLogs(envId, runId, serviceName) {
69
- return __awaiter(this, void 0, void 0, function* () {
70
- return new Promise(resolve => {
71
- const timer = setInterval(() => __awaiter(this, void 0, void 0, function* () {
72
- if ((yield getBuildStatus(envId, serviceName)) === 'completed') {
73
- clearInterval(timer);
74
- resolve();
65
+ if (processLogs === null || processLogs === void 0 ? void 0 : processLogs.Logs) {
66
+ console.log(processLogs === null || processLogs === void 0 ? void 0 : processLogs.Logs.join('\n'));
75
67
  }
76
- else {
77
- const { data: processLogs } = yield (0, utils_1.callTcbrApi)('DescribeCloudRunProcessLog', {
78
- EnvId: envId,
79
- RunId: runId,
80
- });
81
- if (processLogs === null || processLogs === void 0 ? void 0 : processLogs.Logs) {
82
- console.log(processLogs === null || processLogs === void 0 ? void 0 : processLogs.Logs.join('\n'));
83
- }
84
- }
85
- }), 5000);
86
- });
68
+ }
69
+ }, 5000);
87
70
  });
88
71
  }
89
- function showBuildLogs(envId, serviceName, serverVersion = '', offset = 0) {
72
+ async function showBuildLogs(envId, serviceName, serverVersion = '', offset = 0) {
90
73
  var _a, _b;
91
- return __awaiter(this, void 0, void 0, function* () {
92
- const buildId = yield getBuildId(envId, serviceName);
93
- const { data } = yield (0, utils_1.callTcbrApi)('DescribeCloudRunBuildLog', {
94
- EnvId: envId,
95
- BuildId: buildId,
96
- ServerName: serviceName,
97
- ServerVersion: serverVersion || '',
98
- Offset: offset || 0,
99
- });
100
- if ((_a = data === null || data === void 0 ? void 0 : data.Log) === null || _a === void 0 ? void 0 : _a.Text) {
101
- console.log((_b = data === null || data === void 0 ? void 0 : data.Log) === null || _b === void 0 ? void 0 : _b.Text);
102
- }
103
- return Promise.resolve();
74
+ const buildId = await getBuildId(envId, serviceName);
75
+ const { data } = await (0, utils_1.callTcbrApi)('DescribeCloudRunBuildLog', {
76
+ EnvId: envId,
77
+ BuildId: buildId,
78
+ ServerName: serviceName,
79
+ ServerVersion: serverVersion || '',
80
+ Offset: offset || 0,
104
81
  });
82
+ if ((_a = data === null || data === void 0 ? void 0 : data.Log) === null || _a === void 0 ? void 0 : _a.Text) {
83
+ console.log((_b = data === null || data === void 0 ? void 0 : data.Log) === null || _b === void 0 ? void 0 : _b.Text);
84
+ }
85
+ return Promise.resolve();
105
86
  }
106
- function getLogs(options) {
107
- return __awaiter(this, void 0, void 0, function* () {
108
- const runId = yield getRunId(options.envId, options.serviceName);
109
- console.log(chalk_1.default.blue(`============ ${(0, i18n_1.t)('日志开始')} ===============`));
110
- yield showProcessLogs(options.envId, runId, options.serviceName);
111
- if ((yield getBuildStatus(options.envId, options.serviceName)) === 'completed') {
112
- yield showBuildLogs(options.envId, options.serviceName);
113
- }
114
- console.log(chalk_1.default.blue(`============ ${(0, i18n_1.t)('日志结束')} ===============`));
115
- });
87
+ async function getLogs(options) {
88
+ const runId = await getRunId(options.envId, options.serviceName);
89
+ console.log(chalk_1.default.blue(`============ ${(0, i18n_1.t)('日志开始')} ===============`));
90
+ await showProcessLogs(options.envId, runId, options.serviceName);
91
+ if (await getBuildStatus(options.envId, options.serviceName) === 'completed') {
92
+ await showBuildLogs(options.envId, options.serviceName);
93
+ }
94
+ console.log(chalk_1.default.blue(`============ ${(0, i18n_1.t)('日志结束')} ===============`));
116
95
  }
117
96
  exports.getLogs = getLogs;
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
12
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
4
  };
@@ -20,65 +11,61 @@ const utils_1 = require("../../utils");
20
11
  const common_1 = require("./common");
21
12
  const showLogs_1 = require("./showLogs");
22
13
  const i18n_1 = require("../../i18n");
23
- function updateCloudRunServer(serviceConfigOptions) {
24
- return __awaiter(this, void 0, void 0, function* () {
25
- try {
26
- const res = yield (0, utils_1.callTcbrApi)('UpdateCloudRunServer', serviceConfigOptions);
27
- return res;
28
- }
29
- catch (error) {
30
- console.log(error);
31
- }
32
- });
14
+ async function updateCloudRunServer(serviceConfigOptions) {
15
+ try {
16
+ const res = await (0, utils_1.callTcbrApi)('UpdateCloudRunServer', serviceConfigOptions);
17
+ return res;
18
+ }
19
+ catch (error) {
20
+ console.log(error);
21
+ }
33
22
  }
34
23
  exports.updateCloudRunServer = updateCloudRunServer;
35
- function updateTcbrService(options) {
24
+ async function updateTcbrService(options) {
36
25
  var _a;
37
- return __awaiter(this, void 0, void 0, function* () {
38
- const { data: serviceDetail } = yield (0, __1.describeCloudRunServerDetail)({
26
+ const { data: serviceDetail } = await (0, __1.describeCloudRunServerDetail)({
27
+ envId: options.envId,
28
+ serviceName: options.serviceName
29
+ });
30
+ if (serviceDetail === undefined) {
31
+ throw new toolbox_1.CloudBaseError((0, i18n_1.t)('当前服务不存在,请前往控制台 {{link}} 创建服务', { link: (0, utils_1.genClickableLink)(`${utils_1.EUrl.Console}/tcbr`) }));
32
+ }
33
+ const status = await (0, showLogs_1.getBuildStatus)(options.envId, options.serviceName);
34
+ if (status === 'pending') {
35
+ throw new toolbox_1.CloudBaseError((0, i18n_1.t)('服务正在更新部署,请稍后再试,或查看实时部署日志'));
36
+ }
37
+ const previousServerConfig = serviceDetail === null || serviceDetail === void 0 ? void 0 : serviceDetail.ServerConfig;
38
+ const newServiceOptions = await (0, common_1.tcbrServiceOptions)(options, true, true, previousServerConfig);
39
+ if (!options.noConfirm) {
40
+ const { confirm } = await inquirer_1.default.prompt([
41
+ {
42
+ type: 'confirm',
43
+ name: 'confirm',
44
+ message: (0, i18n_1.t)('确定要更新服务吗?'),
45
+ }
46
+ ]);
47
+ if (!confirm) {
48
+ return;
49
+ }
50
+ }
51
+ const updateRes = await updateCloudRunServer(newServiceOptions);
52
+ if (updateRes instanceof Error) {
53
+ throw new toolbox_1.CloudBaseError((0, i18n_1.t)('当前已有部署发布任务运行中,请稍后再试,或查看实时部署日志'));
54
+ }
55
+ const taskId = (_a = updateRes.data) === null || _a === void 0 ? void 0 : _a.TaskId;
56
+ if (options.json) {
57
+ console.log(JSON.stringify(updateRes, null, 2));
58
+ }
59
+ if (process.argv.includes('--verbose')) {
60
+ await (0, showLogs_1.getLogs)({
39
61
  envId: options.envId,
62
+ taskId,
40
63
  serviceName: options.serviceName
41
64
  });
42
- if (serviceDetail === undefined) {
43
- throw new toolbox_1.CloudBaseError((0, i18n_1.t)('当前服务不存在,请前往控制台 {{link}} 创建服务', { link: (0, utils_1.genClickableLink)(`${utils_1.EUrl.Console}/tcbr`) }));
44
- }
45
- const status = yield (0, showLogs_1.getBuildStatus)(options.envId, options.serviceName);
46
- if (status === 'pending') {
47
- throw new toolbox_1.CloudBaseError((0, i18n_1.t)('服务正在更新部署,请稍后再试,或查看实时部署日志'));
48
- }
49
- const previousServerConfig = serviceDetail === null || serviceDetail === void 0 ? void 0 : serviceDetail.ServerConfig;
50
- const newServiceOptions = yield (0, common_1.tcbrServiceOptions)(options, true, true, previousServerConfig);
51
- if (!options.noConfirm) {
52
- const { confirm } = yield inquirer_1.default.prompt([
53
- {
54
- type: 'confirm',
55
- name: 'confirm',
56
- message: (0, i18n_1.t)('确定要更新服务吗?'),
57
- }
58
- ]);
59
- if (!confirm) {
60
- return;
61
- }
62
- }
63
- const updateRes = yield updateCloudRunServer(newServiceOptions);
64
- if (updateRes instanceof Error) {
65
- throw new toolbox_1.CloudBaseError((0, i18n_1.t)('当前已有部署发布任务运行中,请稍后再试,或查看实时部署日志'));
66
- }
67
- const taskId = (_a = updateRes.data) === null || _a === void 0 ? void 0 : _a.TaskId;
68
- if (options.json) {
69
- console.log(JSON.stringify(updateRes, null, 2));
70
- }
71
- if (process.argv.includes('--verbose')) {
72
- yield (0, showLogs_1.getLogs)({
73
- envId: options.envId,
74
- taskId,
75
- serviceName: options.serviceName
76
- });
77
- console.log((0, i18n_1.t)('本次任务的 TaskID: {{taskId}}', { taskId }));
78
- }
79
- else {
80
- toolbox_1.logger.success((0, i18n_1.t)('更新服务成功, 本次任务的 TaskID: {{taskId}}', { taskId }));
81
- }
82
- });
65
+ console.log((0, i18n_1.t)('本次任务的 TaskID: {{taskId}}', { taskId }));
66
+ }
67
+ else {
68
+ toolbox_1.logger.success((0, i18n_1.t)('更新服务成功, 本次任务的 TaskID: {{taskId}}', { taskId }));
69
+ }
83
70
  }
84
71
  exports.updateTcbrService = updateTcbrService;
@@ -1,20 +1,11 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.createStandaloneGateway = void 0;
13
4
  const error_1 = require("../../error");
14
5
  const utils_1 = require("../../utils");
15
6
  const tcbService = utils_1.CloudApiService.getInstance('tcb');
16
- const createStandaloneGateway = (options) => __awaiter(void 0, void 0, void 0, function* () {
17
- const res = yield tcbService.request('CreateStandaloneGateway', {
7
+ const createStandaloneGateway = async (options) => {
8
+ const res = await tcbService.request('CreateStandaloneGateway', {
18
9
  EnvId: options.envId,
19
10
  GatewayAlias: options.gatewayAlias,
20
11
  GatewayDesc: options.gatewayDesc,
@@ -28,5 +19,5 @@ const createStandaloneGateway = (options) => __awaiter(void 0, void 0, void 0, f
28
19
  throw new error_1.CloudBaseError(Message);
29
20
  }
30
21
  return GatewayName;
31
- });
22
+ };
32
23
  exports.createStandaloneGateway = createStandaloneGateway;
@@ -1,20 +1,11 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.destroyStandalonegateway = void 0;
13
4
  const error_1 = require("../../error");
14
5
  const utils_1 = require("../../utils");
15
6
  const tcbService = utils_1.CloudApiService.getInstance('tcb');
16
- const destroyStandalonegateway = (options) => __awaiter(void 0, void 0, void 0, function* () {
17
- const res = yield tcbService.request('DestroyStandaloneGateway', {
7
+ const destroyStandalonegateway = async (options) => {
8
+ const res = await tcbService.request('DestroyStandaloneGateway', {
18
9
  EnvId: options.envId,
19
10
  IsForce: true,
20
11
  GatewayName: options.gatewayName
@@ -24,5 +15,5 @@ const destroyStandalonegateway = (options) => __awaiter(void 0, void 0, void 0,
24
15
  throw new error_1.CloudBaseError(JSON.stringify(Message));
25
16
  }
26
17
  return res;
27
- });
18
+ };
28
19
  exports.destroyStandalonegateway = destroyStandalonegateway;
@@ -1,21 +1,12 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.listStandalonegateway = void 0;
13
4
  const error_1 = require("../../error");
14
5
  const utils_1 = require("../../utils");
15
6
  const i18n_1 = require("../../i18n");
16
7
  const tcbService = utils_1.CloudApiService.getInstance('tcb');
17
- const listStandalonegateway = (options) => __awaiter(void 0, void 0, void 0, function* () {
18
- const res = yield tcbService.request('DescribeStandaloneGateway', {
8
+ const listStandalonegateway = async (options) => {
9
+ const res = await tcbService.request('DescribeStandaloneGateway', {
19
10
  EnvId: options.envId,
20
11
  GatewayName: options.gatewayName,
21
12
  GatewayAlias: options.gatewayAlias
@@ -37,7 +28,7 @@ const listStandalonegateway = (options) => __awaiter(void 0, void 0, void 0, fun
37
28
  const { Error: { Message } } = res;
38
29
  throw new error_1.CloudBaseError(Message);
39
30
  }
40
- });
31
+ };
41
32
  exports.listStandalonegateway = listStandalonegateway;
42
33
  const beautifySubnetList = (list) => list.join('\n');
43
34
  const beautifyServiceList = (list) => list
@@ -1,20 +1,11 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.listPackageStandalonegateway = void 0;
13
4
  const error_1 = require("../../../error");
14
5
  const utils_1 = require("../../../utils");
15
6
  const tcbService = utils_1.CloudApiService.getInstance('tcb');
16
- const listPackageStandalonegateway = (options) => __awaiter(void 0, void 0, void 0, function* () {
17
- const res = yield tcbService.request('DescribeStandaloneGatewayPackage', {
7
+ const listPackageStandalonegateway = async (options) => {
8
+ const res = await tcbService.request('DescribeStandaloneGatewayPackage', {
18
9
  EnvId: options.envId,
19
10
  PackageVersion: options.packageVersion
20
11
  });
@@ -28,5 +19,5 @@ const listPackageStandalonegateway = (options) => __awaiter(void 0, void 0, void
28
19
  item['Mem'],
29
20
  item['PackageVersion']
30
21
  ]);
31
- });
22
+ };
32
23
  exports.listPackageStandalonegateway = listPackageStandalonegateway;
@@ -1,20 +1,11 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.turnOffStandalonegateway = void 0;
13
4
  const error_1 = require("../../../error");
14
5
  const utils_1 = require("../../../utils");
15
6
  const tcbService = utils_1.CloudApiService.getInstance('tcb');
16
- const turnOffStandalonegateway = (options) => __awaiter(void 0, void 0, void 0, function* () {
17
- const res = yield tcbService.request('TurnOffStandaloneGateway', {
7
+ const turnOffStandalonegateway = async (options) => {
8
+ const res = await tcbService.request('TurnOffStandaloneGateway', {
18
9
  EnvId: options.envId,
19
10
  GatewayName: options.gatewayName,
20
11
  ServiceNameList: options.serviceList
@@ -24,5 +15,5 @@ const turnOffStandalonegateway = (options) => __awaiter(void 0, void 0, void 0,
24
15
  throw new error_1.CloudBaseError(JSON.stringify(Message));
25
16
  }
26
17
  return res;
27
- });
18
+ };
28
19
  exports.turnOffStandalonegateway = turnOffStandalonegateway;
@@ -1,20 +1,11 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.turnOnStandalonegateway = void 0;
13
4
  const error_1 = require("../../../error");
14
5
  const utils_1 = require("../../../utils");
15
6
  const tcbService = utils_1.CloudApiService.getInstance('tcb');
16
- const turnOnStandalonegateway = (options) => __awaiter(void 0, void 0, void 0, function* () {
17
- const res = yield tcbService.request('TurnOnStandaloneGateway', {
7
+ const turnOnStandalonegateway = async (options) => {
8
+ const res = await tcbService.request('TurnOnStandaloneGateway', {
18
9
  EnvId: options.envId,
19
10
  GatewayName: options.gatewayName,
20
11
  ServiceNameList: options.serviceList
@@ -24,5 +15,5 @@ const turnOnStandalonegateway = (options) => __awaiter(void 0, void 0, void 0, f
24
15
  throw new error_1.CloudBaseError(JSON.stringify(Message));
25
16
  }
26
17
  return res;
27
- });
18
+ };
28
19
  exports.turnOnStandalonegateway = turnOnStandalonegateway;
@@ -1,50 +1,60 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.basicOperate = exports.logCreate = exports.createVersion = void 0;
13
4
  const utils_1 = require("../../utils");
14
5
  const tcbService = utils_1.CloudApiService.getInstance('tcb');
15
- const createVersion = (options) => __awaiter(void 0, void 0, void 0, function* () {
16
- const { Result, RunId } = yield tcbService.request('CreateCloudBaseRunServerVersion', Object.assign(Object.assign(Object.assign({ EnvId: options.envId, ServerName: options.serverName, ContainerPort: options.containerPort, UploadType: options.uploadType, FlowRatio: options.flowRatio, VersionRemark: options.versionRemark, EnableUnion: options.enableUnion, Cpu: options.cpu, Mem: options.mem, MinNum: options.minNum, MaxNum: options.maxNum, PolicyType: options.policyType, PolicyThreshold: options.policyThreshold }, (options.uploadType !== 'image' ? { DockerfilePath: options.dockerfilePath } : {})), { CustomLogs: options.customLogs, EnvParams: options.envParams, InitialDelaySeconds: options.initialDelaySeconds }), (options.uploadType === 'package'
17
- ? {
18
- PackageName: options.packageName,
19
- PackageVersion: options.packageVersion,
20
- DockerfilePath: options.dockerfilePath
21
- }
22
- : options.uploadType === 'image'
6
+ const createVersion = async (options) => {
7
+ const { Result, RunId } = await tcbService.request('CreateCloudBaseRunServerVersion', {
8
+ EnvId: options.envId,
9
+ ServerName: options.serverName,
10
+ ContainerPort: options.containerPort,
11
+ UploadType: options.uploadType,
12
+ FlowRatio: options.flowRatio,
13
+ VersionRemark: options.versionRemark,
14
+ EnableUnion: options.enableUnion,
15
+ Cpu: options.cpu,
16
+ Mem: options.mem,
17
+ MinNum: options.minNum,
18
+ MaxNum: options.maxNum,
19
+ PolicyType: options.policyType,
20
+ PolicyThreshold: options.policyThreshold,
21
+ ...(options.uploadType !== 'image' ? { DockerfilePath: options.dockerfilePath } : {}),
22
+ CustomLogs: options.customLogs,
23
+ EnvParams: options.envParams,
24
+ InitialDelaySeconds: options.initialDelaySeconds,
25
+ ...(options.uploadType === 'package'
23
26
  ? {
24
- ImageInfo: options.imageInfo
25
- }
26
- : {
27
- RepositoryType: options.repositoryType,
28
- Branch: options.branch,
29
- CodeDetail: options.codeDetail,
27
+ PackageName: options.packageName,
28
+ PackageVersion: options.packageVersion,
30
29
  DockerfilePath: options.dockerfilePath
31
- })));
30
+ }
31
+ : options.uploadType === 'image'
32
+ ? {
33
+ ImageInfo: options.imageInfo
34
+ }
35
+ : {
36
+ RepositoryType: options.repositoryType,
37
+ Branch: options.branch,
38
+ CodeDetail: options.codeDetail,
39
+ DockerfilePath: options.dockerfilePath
40
+ })
41
+ });
32
42
  return { Result, RunId };
33
- });
43
+ };
34
44
  exports.createVersion = createVersion;
35
- const logCreate = (options) => __awaiter(void 0, void 0, void 0, function* () {
36
- let { Logs } = yield tcbService.request('DescribeCloudBaseRunProcessLog', {
45
+ const logCreate = async (options) => {
46
+ let { Logs } = await tcbService.request('DescribeCloudBaseRunProcessLog', {
37
47
  EnvId: options.envId,
38
48
  RunId: options.runId
39
49
  });
40
50
  return Logs;
41
- });
51
+ };
42
52
  exports.logCreate = logCreate;
43
- const basicOperate = (options) => __awaiter(void 0, void 0, void 0, function* () {
44
- let { Percent, ActionDetail: { Status } } = yield tcbService.request('DescribeCloudBaseRunOperateBasic', {
53
+ const basicOperate = async (options) => {
54
+ let { Percent, ActionDetail: { Status } } = await tcbService.request('DescribeCloudBaseRunOperateBasic', {
45
55
  EnvId: options.envId,
46
56
  RunId: options.runId
47
57
  });
48
58
  return { Percent, Status };
49
- });
59
+ };
50
60
  exports.basicOperate = basicOperate;