@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
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
- return new (P || (P = Promise))(function (resolve, reject) {
17
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
- step((generator = generator.apply(thisArg, _arguments || [])).next());
21
- });
22
- };
23
14
  Object.defineProperty(exports, "__esModule", { value: true });
24
15
  exports.ListRun = void 0;
25
16
  const common_1 = require("../common");
@@ -53,41 +44,39 @@ let ListRun = class ListRun extends common_1.Command {
53
44
  desc: (0, i18n_1.t)('展示云托管服务列表')
54
45
  };
55
46
  }
56
- execute(envId, options) {
57
- return __awaiter(this, void 0, void 0, function* () {
58
- let envCheckType = yield (0, utils_1.checkTcbrEnv)(options.envId, false);
59
- if (envCheckType !== 0) {
60
- (0, utils_1.logEnvCheck)(envId, envCheckType);
61
- return;
62
- }
63
- let { limit = 20, offset = 0 } = options;
64
- limit = Number(limit);
65
- offset = Number(offset);
66
- if (!Number.isInteger(limit) || !Number.isInteger(offset)) {
67
- throw new error_1.CloudBaseError((0, i18n_1.t)('limit 和 offset 必须为整数'));
68
- }
69
- if (limit < 0 || offset < 0) {
70
- throw new error_1.CloudBaseError((0, i18n_1.t)('limit 和 offset 必须为大于 0 的整数'));
71
- }
72
- const loading = (0, utils_1.loadingFactory)();
73
- loading.start((0, i18n_1.t)('数据加载中...'));
74
- const data = yield (0, run_1.listRun)({
75
- envId,
76
- limit: Number(limit),
77
- offset: Number(offset)
78
- });
79
- loading.stop();
80
- const head = [(0, i18n_1.t)('服务名称'), (0, i18n_1.t)('服务备注'), (0, i18n_1.t)('创建时间'), (0, i18n_1.t)('修改时间'), (0, i18n_1.t)('状态'), (0, i18n_1.t)('所在私有网络')];
81
- const tableData = data.map((item) => [
82
- item.ServerName,
83
- item.ServiceRemark ? item.ServiceRemark : '-',
84
- item.CreatedTime,
85
- item.UpdatedTime,
86
- StatusMap[item.Status],
87
- item.VpcId,
88
- ]);
89
- (0, utils_1.printHorizontalTable)(head, tableData);
47
+ async execute(envId, options) {
48
+ let envCheckType = await (0, utils_1.checkTcbrEnv)(options.envId, false);
49
+ if (envCheckType !== 0) {
50
+ (0, utils_1.logEnvCheck)(envId, envCheckType);
51
+ return;
52
+ }
53
+ let { limit = 20, offset = 0 } = options;
54
+ limit = Number(limit);
55
+ offset = Number(offset);
56
+ if (!Number.isInteger(limit) || !Number.isInteger(offset)) {
57
+ throw new error_1.CloudBaseError((0, i18n_1.t)('limit offset 必须为整数'));
58
+ }
59
+ if (limit < 0 || offset < 0) {
60
+ throw new error_1.CloudBaseError((0, i18n_1.t)('limit offset 必须为大于 0 的整数'));
61
+ }
62
+ const loading = (0, utils_1.loadingFactory)();
63
+ loading.start((0, i18n_1.t)('数据加载中...'));
64
+ const data = await (0, run_1.listRun)({
65
+ envId,
66
+ limit: Number(limit),
67
+ offset: Number(offset)
90
68
  });
69
+ loading.stop();
70
+ const head = [(0, i18n_1.t)('服务名称'), (0, i18n_1.t)('服务备注'), (0, i18n_1.t)('创建时间'), (0, i18n_1.t)('修改时间'), (0, i18n_1.t)('状态'), (0, i18n_1.t)('所在私有网络')];
71
+ const tableData = data.map((item) => [
72
+ item.ServerName,
73
+ item.ServiceRemark ? item.ServiceRemark : '-',
74
+ item.CreatedTime,
75
+ item.UpdatedTime,
76
+ StatusMap[item.Status],
77
+ item.VpcId,
78
+ ]);
79
+ (0, utils_1.printHorizontalTable)(head, tableData);
91
80
  }
92
81
  };
93
82
  __decorate([
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
- return new (P || (P = Promise))(function (resolve, reject) {
17
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
- step((generator = generator.apply(thisArg, _arguments || [])).next());
21
- });
22
- };
23
14
  Object.defineProperty(exports, "__esModule", { value: true });
24
15
  exports.ConfigServiceTcbr = void 0;
25
16
  const common_1 = require("../../common");
@@ -77,26 +68,24 @@ let ConfigServiceTcbr = class ConfigServiceTcbr extends common_1.Command {
77
68
  desc: (0, i18n_1.t)('指定环境和服务,更新服务的基础配置')
78
69
  };
79
70
  }
80
- execute(options, log) {
81
- return __awaiter(this, void 0, void 0, function* () {
82
- let envCheckType = yield (0, utils_1.checkTcbrEnv)(options.envId, true);
83
- if (envCheckType !== 0) {
84
- (0, utils_1.logEnvCheck)(options.envId, envCheckType);
85
- return;
86
- }
87
- const newServiceConfig = yield (0, run_1.tcbrServiceConfigOptions)(options);
88
- const configRes = yield (0, run_1.updateCloudRunServerConfig)({
89
- envId: options.envId,
90
- serviceName: options.serviceName,
91
- ServerBaseConfig: newServiceConfig
92
- });
93
- if (options.json) {
94
- console.log(JSON.stringify(configRes, null, 2));
95
- }
96
- else {
97
- log.success((0, i18n_1.t)('更新配置信息成功'));
98
- }
71
+ async execute(options, log) {
72
+ let envCheckType = await (0, utils_1.checkTcbrEnv)(options.envId, true);
73
+ if (envCheckType !== 0) {
74
+ (0, utils_1.logEnvCheck)(options.envId, envCheckType);
75
+ return;
76
+ }
77
+ const newServiceConfig = await (0, run_1.tcbrServiceConfigOptions)(options);
78
+ const configRes = await (0, run_1.updateCloudRunServerConfig)({
79
+ envId: options.envId,
80
+ serviceName: options.serviceName,
81
+ ServerBaseConfig: newServiceConfig
99
82
  });
83
+ if (options.json) {
84
+ console.log(JSON.stringify(configRes, null, 2));
85
+ }
86
+ else {
87
+ log.success((0, i18n_1.t)('更新配置信息成功'));
88
+ }
100
89
  }
101
90
  };
102
91
  __decorate([
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
- return new (P || (P = Promise))(function (resolve, reject) {
17
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
- step((generator = generator.apply(thisArg, _arguments || [])).next());
21
- });
22
- };
23
14
  Object.defineProperty(exports, "__esModule", { value: true });
24
15
  exports.DeployServiceTcbr = void 0;
25
16
  const common_1 = require("../../common");
@@ -122,24 +113,22 @@ let DeployServiceTcbr = class DeployServiceTcbr extends common_1.Command {
122
113
  desc: (0, i18n_1.t)('在指定的环境部署服务')
123
114
  };
124
115
  }
125
- execute(options) {
126
- return __awaiter(this, void 0, void 0, function* () {
127
- let envCheckType = yield (0, utils_1.checkTcbrEnv)(options.envId, true);
128
- if (envCheckType !== 0) {
129
- (0, utils_1.logEnvCheck)(options.envId, envCheckType);
130
- return;
131
- }
132
- const { data: serviceDetail } = yield (0, run_1.describeCloudRunServerDetail)({
133
- envId: options.envId,
134
- serviceName: options.serviceName
135
- });
136
- if (serviceDetail === undefined) {
137
- throw new toolbox_1.CloudBaseError((0, i18n_1.t)('当前服务不存在,请前往控制台 {{link}} 创建服务', { link: (0, utils_1.genClickableLink)(`${utils_1.EUrl.TcbConsole}/tcbr`) }));
138
- }
139
- else {
140
- yield (0, run_1.updateTcbrService)(options);
141
- }
116
+ async execute(options) {
117
+ let envCheckType = await (0, utils_1.checkTcbrEnv)(options.envId, true);
118
+ if (envCheckType !== 0) {
119
+ (0, utils_1.logEnvCheck)(options.envId, envCheckType);
120
+ return;
121
+ }
122
+ const { data: serviceDetail } = await (0, run_1.describeCloudRunServerDetail)({
123
+ envId: options.envId,
124
+ serviceName: options.serviceName
142
125
  });
126
+ if (serviceDetail === undefined) {
127
+ throw new toolbox_1.CloudBaseError((0, i18n_1.t)('当前服务不存在,请前往控制台 {{link}} 创建服务', { link: (0, utils_1.genClickableLink)(`${utils_1.EUrl.TcbConsole}/tcbr`) }));
128
+ }
129
+ else {
130
+ await (0, run_1.updateTcbrService)(options);
131
+ }
143
132
  }
144
133
  };
145
134
  __decorate([
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
- return new (P || (P = Promise))(function (resolve, reject) {
17
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
- step((generator = generator.apply(thisArg, _arguments || [])).next());
21
- });
22
- };
23
14
  Object.defineProperty(exports, "__esModule", { value: true });
24
15
  exports.ListServiceTcbr = void 0;
25
16
  const common_1 = require("../../common");
@@ -50,57 +41,55 @@ let ListServiceTcbr = class ListServiceTcbr extends common_1.Command {
50
41
  desc: (0, i18n_1.t)('展示环境下服务信息')
51
42
  };
52
43
  }
53
- execute(options) {
54
- return __awaiter(this, void 0, void 0, function* () {
55
- let { envId, serviceName = '' } = options;
56
- let envCheckType = yield (0, checkTcbrEnv_1.checkTcbrEnv)(envId, true);
57
- if (envCheckType !== 0) {
58
- (0, checkTcbrEnv_1.logEnvCheck)(envId, envCheckType);
59
- return;
60
- }
61
- const loading = (0, utils_1.loadingFactory)();
62
- const head = [(0, i18n_1.t)('服务名称'), (0, i18n_1.t)('状态'), (0, i18n_1.t)('公网访问'), (0, i18n_1.t)('创建时间'), (0, i18n_1.t)('更新时间')];
63
- loading.start((0, i18n_1.t)('正在获取服务列表'));
64
- const serverList = yield (0, run_1.listService)({
65
- envId: envId
66
- });
67
- loading.stop();
68
- const specificServer = serverList.filter(serverItem => serverItem.ServerName === serviceName);
69
- if (options.json) {
70
- console.log(JSON.stringify({
71
- code: 0,
72
- errmsg: 'success',
73
- data: specificServer.length ?
74
- specificServer
75
- : serverList
76
- }, null, 2));
77
- return;
78
- }
79
- if (!serverList.length) {
80
- console.log((0, i18n_1.t)('当前环境下没有服务'));
81
- return;
82
- }
83
- let tableData;
84
- if (specificServer.length) {
85
- tableData = [[
86
- specificServer[0].ServerName,
87
- specificServer[0].Status,
88
- `${(0, i18n_1.t)('是')} ${(0, utils_1.genClickableLink)(specificServer[0].DefaultDomainName)}`,
89
- specificServer[0].CreatedTime,
90
- specificServer[0].UpdateTime
91
- ]];
92
- }
93
- else {
94
- tableData = serverList.map(serverItem => [
95
- serverItem.ServerName,
96
- serverItem.Status,
97
- `${(0, i18n_1.t)('是')} ${(0, utils_1.genClickableLink)(serverItem.DefaultDomainName)}`,
98
- serverItem.CreatedTime,
99
- serverItem.UpdateTime
100
- ]);
101
- }
102
- (0, utils_1.printHorizontalTable)(head, tableData);
44
+ async execute(options) {
45
+ let { envId, serviceName = '' } = options;
46
+ let envCheckType = await (0, checkTcbrEnv_1.checkTcbrEnv)(envId, true);
47
+ if (envCheckType !== 0) {
48
+ (0, checkTcbrEnv_1.logEnvCheck)(envId, envCheckType);
49
+ return;
50
+ }
51
+ const loading = (0, utils_1.loadingFactory)();
52
+ const head = [(0, i18n_1.t)('服务名称'), (0, i18n_1.t)('状态'), (0, i18n_1.t)('公网访问'), (0, i18n_1.t)('创建时间'), (0, i18n_1.t)('更新时间')];
53
+ loading.start((0, i18n_1.t)('正在获取服务列表'));
54
+ const serverList = await (0, run_1.listService)({
55
+ envId: envId
103
56
  });
57
+ loading.stop();
58
+ const specificServer = serverList.filter(serverItem => serverItem.ServerName === serviceName);
59
+ if (options.json) {
60
+ console.log(JSON.stringify({
61
+ code: 0,
62
+ errmsg: 'success',
63
+ data: specificServer.length ?
64
+ specificServer
65
+ : serverList
66
+ }, null, 2));
67
+ return;
68
+ }
69
+ if (!serverList.length) {
70
+ console.log((0, i18n_1.t)('当前环境下没有服务'));
71
+ return;
72
+ }
73
+ let tableData;
74
+ if (specificServer.length) {
75
+ tableData = [[
76
+ specificServer[0].ServerName,
77
+ specificServer[0].Status,
78
+ `${(0, i18n_1.t)('是')} ${(0, utils_1.genClickableLink)(specificServer[0].DefaultDomainName)}`,
79
+ specificServer[0].CreatedTime,
80
+ specificServer[0].UpdateTime
81
+ ]];
82
+ }
83
+ else {
84
+ tableData = serverList.map(serverItem => [
85
+ serverItem.ServerName,
86
+ serverItem.Status,
87
+ `${(0, i18n_1.t)('是')} ${(0, utils_1.genClickableLink)(serverItem.DefaultDomainName)}`,
88
+ serverItem.CreatedTime,
89
+ serverItem.UpdateTime
90
+ ]);
91
+ }
92
+ (0, utils_1.printHorizontalTable)(head, tableData);
104
93
  }
105
94
  };
106
95
  __decorate([
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
- return new (P || (P = Promise))(function (resolve, reject) {
17
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
- step((generator = generator.apply(thisArg, _arguments || [])).next());
21
- });
22
- };
23
14
  Object.defineProperty(exports, "__esModule", { value: true });
24
15
  exports.UpdateServiceTcbr = void 0;
25
16
  const common_1 = require("../../common");
@@ -117,15 +108,13 @@ let UpdateServiceTcbr = class UpdateServiceTcbr extends common_1.Command {
117
108
  desc: (0, i18n_1.t)('指定环境和已存在的服务,发布新的应用')
118
109
  };
119
110
  }
120
- execute(options) {
121
- return __awaiter(this, void 0, void 0, function* () {
122
- let envCheckType = yield (0, utils_1.checkTcbrEnv)(options.envId, true);
123
- if (envCheckType !== 0) {
124
- (0, utils_1.logEnvCheck)(options.envId, envCheckType);
125
- return;
126
- }
127
- yield (0, run_1.updateTcbrService)(options);
128
- });
111
+ async execute(options) {
112
+ let envCheckType = await (0, utils_1.checkTcbrEnv)(options.envId, true);
113
+ if (envCheckType !== 0) {
114
+ (0, utils_1.logEnvCheck)(options.envId, envCheckType);
115
+ return;
116
+ }
117
+ await (0, run_1.updateTcbrService)(options);
129
118
  }
130
119
  };
131
120
  __decorate([
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
- return new (P || (P = Promise))(function (resolve, reject) {
17
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
- step((generator = generator.apply(thisArg, _arguments || [])).next());
21
- });
22
- };
23
14
  Object.defineProperty(exports, "__esModule", { value: true });
24
15
  exports.CreateStandalonegateway = void 0;
25
16
  const common_1 = require("../../common");
@@ -31,7 +22,9 @@ const error_1 = require("../../../error");
31
22
  const i18n_1 = require("../../../i18n");
32
23
  let CreateStandalonegateway = class CreateStandalonegateway extends common_1.Command {
33
24
  get options() {
34
- return Object.assign(Object.assign({}, (0, common_2.standalonegatewayCommonOptions)('create')), { options: [
25
+ return {
26
+ ...(0, common_2.standalonegatewayCommonOptions)('create'),
27
+ options: [
35
28
  {
36
29
  flags: '-e, --envId <envId>',
37
30
  desc: (0, i18n_1.t)('环境 Id')
@@ -56,40 +49,40 @@ let CreateStandalonegateway = class CreateStandalonegateway extends common_1.Com
56
49
  flags: '-p, --packageVersion <packageVersion>',
57
50
  desc: (0, i18n_1.t)('套餐版本')
58
51
  }
59
- ], desc: (0, i18n_1.t)('创建小租户网关') });
52
+ ],
53
+ desc: (0, i18n_1.t)('创建小租户网关')
54
+ };
60
55
  }
61
- execute(envId, options) {
62
- return __awaiter(this, void 0, void 0, function* () {
63
- let { gatewayAlias = '', gatewayDesc = '', vpcId = '', subnetIds = [], packageVersion = '' } = options;
64
- gatewayAlias = String(gatewayAlias);
65
- gatewayDesc = String(gatewayDesc);
66
- vpcId = String(vpcId);
67
- packageVersion = String(packageVersion);
68
- if (vpcId === '') {
69
- throw new error_1.CloudBaseError((0, i18n_1.t)('请输入 VPC'));
70
- }
71
- if (subnetIds.length === 0) {
72
- throw new error_1.CloudBaseError((0, i18n_1.t)('请输入子网列表'));
73
- }
74
- if (gatewayDesc === '') {
75
- throw new error_1.CloudBaseError((0, i18n_1.t)('请输入网关描述'));
76
- }
77
- if (packageVersion === '') {
78
- throw new error_1.CloudBaseError((0, i18n_1.t)('请输入套餐版本'));
79
- }
80
- const loading = (0, toolbox_1.loadingFactory)();
81
- loading.start((0, i18n_1.t)('数据加载中...'));
82
- const data = yield (0, run_1.createStandaloneGateway)({
83
- envId,
84
- gatewayAlias,
85
- gatewayDesc,
86
- vpcId,
87
- subnetIds,
88
- packageVersion
89
- });
90
- loading.stop();
91
- console.log((0, i18n_1.t)('操作执行成功,网关名称:{{name}}', { name: data }));
56
+ async execute(envId, options) {
57
+ let { gatewayAlias = '', gatewayDesc = '', vpcId = '', subnetIds = [], packageVersion = '' } = options;
58
+ gatewayAlias = String(gatewayAlias);
59
+ gatewayDesc = String(gatewayDesc);
60
+ vpcId = String(vpcId);
61
+ packageVersion = String(packageVersion);
62
+ if (vpcId === '') {
63
+ throw new error_1.CloudBaseError((0, i18n_1.t)('请输入 VPC'));
64
+ }
65
+ if (subnetIds.length === 0) {
66
+ throw new error_1.CloudBaseError((0, i18n_1.t)('请输入子网列表'));
67
+ }
68
+ if (gatewayDesc === '') {
69
+ throw new error_1.CloudBaseError((0, i18n_1.t)('请输入网关描述'));
70
+ }
71
+ if (packageVersion === '') {
72
+ throw new error_1.CloudBaseError((0, i18n_1.t)('请输入套餐版本'));
73
+ }
74
+ const loading = (0, toolbox_1.loadingFactory)();
75
+ loading.start((0, i18n_1.t)('数据加载中...'));
76
+ const data = await (0, run_1.createStandaloneGateway)({
77
+ envId,
78
+ gatewayAlias,
79
+ gatewayDesc,
80
+ vpcId,
81
+ subnetIds,
82
+ packageVersion
92
83
  });
84
+ loading.stop();
85
+ console.log((0, i18n_1.t)('操作执行成功,网关名称:{{name}}', { name: data }));
93
86
  }
94
87
  };
95
88
  __decorate([
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
- return new (P || (P = Promise))(function (resolve, reject) {
17
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
- step((generator = generator.apply(thisArg, _arguments || [])).next());
21
- });
22
- };
23
14
  Object.defineProperty(exports, "__esModule", { value: true });
24
15
  exports.DestroyStandalonegateway = void 0;
25
16
  const common_1 = require("../../common");
@@ -31,7 +22,9 @@ const error_1 = require("../../../error");
31
22
  const i18n_1 = require("../../../i18n");
32
23
  let DestroyStandalonegateway = class DestroyStandalonegateway extends common_1.Command {
33
24
  get options() {
34
- return Object.assign(Object.assign({}, (0, common_2.standalonegatewayCommonOptions)('destroy')), { options: [
25
+ return {
26
+ ...(0, common_2.standalonegatewayCommonOptions)('destroy'),
27
+ options: [
35
28
  {
36
29
  flags: '-e, --envId <envId>',
37
30
  desc: (0, i18n_1.t)('环境 Id')
@@ -44,28 +37,28 @@ let DestroyStandalonegateway = class DestroyStandalonegateway extends common_1.C
44
37
  flags: '--isForce',
45
38
  desc: (0, i18n_1.t)('强制确认删除资源')
46
39
  }
47
- ], desc: (0, i18n_1.t)('销毁小租户网关') });
40
+ ],
41
+ desc: (0, i18n_1.t)('销毁小租户网关')
42
+ };
48
43
  }
49
- execute(envId, options) {
50
- return __awaiter(this, void 0, void 0, function* () {
51
- let { isForce = false, gatewayName = '' } = options;
52
- isForce = Boolean(isForce);
53
- gatewayName = String(gatewayName);
54
- if (gatewayName === '') {
55
- throw new error_1.CloudBaseError((0, i18n_1.t)('请输入网关名称'));
56
- }
57
- if (!isForce) {
58
- throw new error_1.CloudBaseError((0, i18n_1.t)('请使用 --isForce 选项确认销毁资源!'));
59
- }
60
- const loading = (0, toolbox_1.loadingFactory)();
61
- loading.start((0, i18n_1.t)('数据加载中...'));
62
- yield (0, run_1.destroyStandalonegateway)({
63
- envId,
64
- gatewayName
65
- });
66
- loading.stop();
67
- console.log((0, i18n_1.t)('网关已销毁'));
44
+ async execute(envId, options) {
45
+ let { isForce = false, gatewayName = '' } = options;
46
+ isForce = Boolean(isForce);
47
+ gatewayName = String(gatewayName);
48
+ if (gatewayName === '') {
49
+ throw new error_1.CloudBaseError((0, i18n_1.t)('请输入网关名称'));
50
+ }
51
+ if (!isForce) {
52
+ throw new error_1.CloudBaseError((0, i18n_1.t)('请使用 --isForce 选项确认销毁资源!'));
53
+ }
54
+ const loading = (0, toolbox_1.loadingFactory)();
55
+ loading.start((0, i18n_1.t)('数据加载中...'));
56
+ await (0, run_1.destroyStandalonegateway)({
57
+ envId,
58
+ gatewayName
68
59
  });
60
+ loading.stop();
61
+ console.log((0, i18n_1.t)('网关已销毁'));
69
62
  }
70
63
  };
71
64
  __decorate([
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
11
11
  var __param = (this && this.__param) || function (paramIndex, decorator) {
12
12
  return function (target, key) { decorator(target, key, paramIndex); }
13
13
  };
14
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
- return new (P || (P = Promise))(function (resolve, reject) {
17
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
- step((generator = generator.apply(thisArg, _arguments || [])).next());
21
- });
22
- };
23
14
  Object.defineProperty(exports, "__esModule", { value: true });
24
15
  exports.ListStandalonegateway = void 0;
25
16
  const common_1 = require("../../common");
@@ -31,7 +22,9 @@ const utils_1 = require("../../../utils");
31
22
  const i18n_1 = require("../../../i18n");
32
23
  let ListStandalonegateway = class ListStandalonegateway extends common_1.Command {
33
24
  get options() {
34
- return Object.assign(Object.assign({}, (0, common_2.standalonegatewayCommonOptions)('list')), { options: [
25
+ return {
26
+ ...(0, common_2.standalonegatewayCommonOptions)('list'),
27
+ options: [
35
28
  {
36
29
  flags: '-e, --envId <envId>',
37
30
  desc: (0, i18n_1.t)('环境 Id')
@@ -44,24 +37,24 @@ let ListStandalonegateway = class ListStandalonegateway extends common_1.Command
44
37
  flags: '-gA, --gatewayAlias <gatewayAlias>',
45
38
  desc: (0, i18n_1.t)('网关 alias')
46
39
  }
47
- ], desc: (0, i18n_1.t)('查询小租户网关') });
40
+ ],
41
+ desc: (0, i18n_1.t)('查询小租户网关')
42
+ };
48
43
  }
49
- execute(envId, options) {
50
- return __awaiter(this, void 0, void 0, function* () {
51
- let { gatewayName = '', gatewayAlias = '' } = options;
52
- gatewayName = String(gatewayName);
53
- gatewayAlias = String(gatewayAlias);
54
- const loading = (0, toolbox_1.loadingFactory)();
55
- loading.start((0, i18n_1.t)('数据加载中...'));
56
- const data = yield (0, standalonegateway_1.listStandalonegateway)({
57
- envId,
58
- gatewayName,
59
- gatewayAlias
60
- });
61
- loading.stop();
62
- const head = [(0, i18n_1.t)('名称'), (0, i18n_1.t)('状态'), (0, i18n_1.t)('别名'), (0, i18n_1.t)('套餐版本'), (0, i18n_1.t)('子网'), (0, i18n_1.t)('外网IP'), (0, i18n_1.t)('内网IP'), (0, i18n_1.t)('服务信息')];
63
- (0, utils_1.printHorizontalTable)(head, data);
44
+ async execute(envId, options) {
45
+ let { gatewayName = '', gatewayAlias = '' } = options;
46
+ gatewayName = String(gatewayName);
47
+ gatewayAlias = String(gatewayAlias);
48
+ const loading = (0, toolbox_1.loadingFactory)();
49
+ loading.start((0, i18n_1.t)('数据加载中...'));
50
+ const data = await (0, standalonegateway_1.listStandalonegateway)({
51
+ envId,
52
+ gatewayName,
53
+ gatewayAlias
64
54
  });
55
+ loading.stop();
56
+ const head = [(0, i18n_1.t)('名称'), (0, i18n_1.t)('状态'), (0, i18n_1.t)('别名'), (0, i18n_1.t)('套餐版本'), (0, i18n_1.t)('子网'), (0, i18n_1.t)('外网IP'), (0, i18n_1.t)('内网IP'), (0, i18n_1.t)('服务信息')];
57
+ (0, utils_1.printHorizontalTable)(head, data);
65
58
  }
66
59
  };
67
60
  __decorate([