@geek-fun/serverlessinsight 0.9.1 → 0.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.serverlessinsight/state-cdn-flow-app-cdn-flow-service.json.backup +1 -1
- package/.serverlessinsight/state-iam-test-app-iam-test-service.json.backup +2 -2
- package/.serverlessinsight/state-insight-poc-app-insight-poc-tencent.json.backup +4 -8
- package/.serverlessinsight/state-insight-poc-app-log-insight-poc-tencent-log.json.backup +3 -8
- package/.serverlessinsight/state-insight-poc-deploy-app-insight-poc-deploy.json.backup +4 -4
- package/.serverlessinsight/state-insight-poc-destroy-app-insight-poc-destroy.json.backup +1 -1
- package/.serverlessinsight/state-insight-poc-timer-app-insight-poc-timer.json.backup +132 -0
- package/.serverlessinsight/state-insight-volc-app-insight-volc.json.backup +2 -2
- package/.serverlessinsight/state-insight-volc-nested-app-insight-volc-nested.json.backup +3 -3
- package/.serverlessinsight/state-nested-drift-app-nested-drift-service.json.backup +20 -5
- package/.serverlessinsight/state-role-reconcile-test-app-role-reconcile-test-service.json.backup +3 -3
- package/AGENTS.md +10 -0
- package/CHANGELOG.md +51 -0
- package/README.md +103 -13
- package/README.zh-CN.md +73 -13
- package/codecov +0 -0
- package/codecov.SHA256SUM +1 -0
- package/codecov.SHA256SUM.sig +16 -0
- package/dist/package.json +1 -1
- package/dist/src/commands/index.js +92 -24
- package/dist/src/commands/local.js +16 -3
- package/dist/src/commands/plan.js +31 -4
- package/dist/src/commands/schema.js +24 -0
- package/dist/src/commands/show.js +64 -10
- package/dist/src/commands/validate.js +34 -2
- package/dist/src/common/aliyunClient/apigwOperations.js +17 -1
- package/dist/src/common/aliyunClient/fc3Operations.js +39 -2
- package/dist/src/common/aliyunClient/ossOperations.js +214 -221
- package/dist/src/common/bucketPolicy.js +63 -0
- package/dist/src/common/constants.js +7 -1
- package/dist/src/common/domainUtils.js +4 -1
- package/dist/src/common/functionDefinition.js +25 -0
- package/dist/src/common/index.js +4 -0
- package/dist/src/common/jsonOutput.js +82 -0
- package/dist/src/common/logger.js +6 -3
- package/dist/src/common/nameBuilder.js +3 -1
- package/dist/src/common/noColor.js +9 -0
- package/dist/src/common/planCapabilities.js +119 -0
- package/dist/src/common/planCompare.js +119 -66
- package/dist/src/common/planFormatter.js +34 -20
- package/dist/src/common/planRedaction.js +26 -0
- package/dist/src/common/refreshPlanner.js +66 -21
- package/dist/src/common/siCron.js +415 -0
- package/dist/src/common/stateBackend/saasStateBackend.js +5 -4
- package/dist/src/common/tencentClient/cosOperations.js +326 -322
- package/dist/src/common/tencentClient/scfOperations.js +11 -2
- package/dist/src/common/tencentClient/tdsqlcOperations.js +6 -11
- package/dist/src/common/triggerMapper.js +16 -1
- package/dist/src/common/volcengineClient/apigwOperations.js +82 -0
- package/dist/src/common/volcengineClient/iamOperations.js +27 -3
- package/dist/src/common/volcengineClient/tosOperations.js +62 -56
- package/dist/src/common/volcengineClient/vefaasOperations.js +45 -0
- package/dist/src/lang/en.js +70 -3
- package/dist/src/lang/index.js +36 -1
- package/dist/src/lang/zh-CN.js +70 -3
- package/dist/src/parser/eventParser.js +1 -0
- package/dist/src/parser/functionParser.js +48 -2
- package/dist/src/stack/aliyunStack/apigwExecutor.js +1 -1
- package/dist/src/stack/aliyunStack/apigwPlanner.js +103 -23
- package/dist/src/stack/aliyunStack/apigwResource.js +4 -3
- package/dist/src/stack/aliyunStack/apigwTypes.js +3 -7
- package/dist/src/stack/aliyunStack/deployer.js +2 -0
- package/dist/src/stack/aliyunStack/esServerlessTypes.js +8 -4
- package/dist/src/stack/aliyunStack/fc3Executor.js +7 -3
- package/dist/src/stack/aliyunStack/fc3Planner.js +148 -153
- package/dist/src/stack/aliyunStack/fc3Resource.js +206 -53
- package/dist/src/stack/aliyunStack/fc3Types.js +30 -16
- package/dist/src/stack/aliyunStack/ossPlanner.js +15 -1
- package/dist/src/stack/aliyunStack/ossResource.js +113 -102
- package/dist/src/stack/aliyunStack/ossTypes.js +20 -20
- package/dist/src/stack/localStack/aliyunFc.js +1 -6
- package/dist/src/stack/localStack/event.js +31 -71
- package/dist/src/stack/localStack/function.js +25 -77
- package/dist/src/stack/localStack/functionRunner.js +10 -2
- package/dist/src/stack/localStack/httpAdapter.js +54 -0
- package/dist/src/stack/localStack/httpError.js +5 -0
- package/dist/src/stack/localStack/index.js +8 -1
- package/dist/src/stack/localStack/legacyLambda.js +26 -0
- package/dist/src/stack/localStack/localContext.js +29 -0
- package/dist/src/stack/localStack/localRoute.js +12 -0
- package/dist/src/stack/localStack/localRuntimes.js +22 -0
- package/dist/src/stack/localStack/localServer.js +8 -3
- package/dist/src/stack/localStack/requestBody.js +24 -0
- package/dist/src/stack/localStack/requestId.js +18 -0
- package/dist/src/stack/localStack/tencent.js +147 -0
- package/dist/src/stack/localStack/timer.js +183 -0
- package/dist/src/stack/localStack/utils.js +19 -1
- package/dist/src/stack/localStack/volcengine.js +68 -0
- package/dist/src/stack/scfStack/cosPlanner.js +9 -14
- package/dist/src/stack/scfStack/cosResource.js +42 -50
- package/dist/src/stack/scfStack/cosTypes.js +19 -14
- package/dist/src/stack/scfStack/deployer.js +2 -0
- package/dist/src/stack/scfStack/scfExecutor.js +7 -3
- package/dist/src/stack/scfStack/scfHttpTrigger.js +106 -0
- package/dist/src/stack/scfStack/scfPlanner.js +114 -29
- package/dist/src/stack/scfStack/scfResource.js +329 -311
- package/dist/src/stack/scfStack/scfTypes.js +4 -3
- package/dist/src/stack/scfStack/tdsqlcPlanner.js +10 -13
- package/dist/src/stack/volcengineStack/apigwDomains.js +64 -0
- package/dist/src/stack/volcengineStack/apigwPlanner.js +71 -15
- package/dist/src/stack/volcengineStack/apigwResource.js +60 -24
- package/dist/src/stack/volcengineStack/apigwTypes.js +5 -1
- package/dist/src/stack/volcengineStack/deployer.js +6 -0
- package/dist/src/stack/volcengineStack/tosPlanner.js +8 -13
- package/dist/src/stack/volcengineStack/tosResource.js +22 -35
- package/dist/src/stack/volcengineStack/tosTypes.js +5 -8
- package/dist/src/stack/volcengineStack/vefaasPlanner.js +186 -44
- package/dist/src/stack/volcengineStack/vefaasResource.js +232 -14
- package/dist/src/stack/volcengineStack/vefaasTypes.js +6 -3
- package/dist/src/validator/functionSchema.js +25 -2
- package/dist/src/validator/iacSchema.js +2 -1
- package/dist/src/validator/index.js +4 -1
- package/dist/src/validator/rootSchema.js +49 -18
- package/dist/src/validator/schemaExport.js +60 -0
- package/dist/src/validator/semanticValidation.js +79 -0
- package/dist/src/validator/templateRefSchema.js +9 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/release-notes.md +79 -0
- package/samples/aliyun-poc-timer.yml +39 -0
- package/samples/tencent-local/index.js +13 -0
- package/samples/tencent-local/serverlessinsight.yml +23 -0
- package/samples/volcengine-local/index.js +13 -0
- package/samples/volcengine-local/serverlessinsight.yml +28 -0
package/README.zh-CN.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
|
|
3
|
+
<img src="docs/brand/brand.jpg" alt="ServerlessInsight" width="420" />
|
|
4
|
+
|
|
3
5
|
# ServerlessInsight
|
|
4
6
|
|
|
5
7
|
**全生命周期跨云服务商的 Serverless 管理 —— 描述你的应用,其余交给我们。**
|
|
@@ -95,11 +97,48 @@ si deploy -f serverless.yml -s prod
|
|
|
95
97
|
si destroy -f serverless.yml
|
|
96
98
|
```
|
|
97
99
|
|
|
100
|
+
### 在 AI agent 与脚本中使用 si
|
|
101
|
+
|
|
102
|
+
CLI 专为 agent 与脚本驱动而设计:日志始终输出到 **stderr**,结果数据输出到
|
|
103
|
+
**stdout**,因此将 stdout 管道给 `jq` 总能得到单个可解析的 JSON 文档。
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
si plan --json -f serverless.yml | jq '.summary'
|
|
107
|
+
si validate --json -f serverless.yml | jq '.valid'
|
|
108
|
+
si show --json -f serverless.yml | jq '.resourceCount'
|
|
109
|
+
si schema | jq '.$id' # IaC 格式的自包含 draft-07 JSON Schema
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**稳定的输出 envelope**(每个都带版本号字段,结构只会在新版本号下变化):
|
|
113
|
+
|
|
114
|
+
- `si plan --json` → `{ planVersion: 1, provider, app, service, stage,
|
|
115
|
+
changes: [{ logicalId, type, action: "create|update|destroy|recreate",
|
|
116
|
+
attributes, drifted?, driftReasons? }], summary: { create, update, destroy,
|
|
117
|
+
recreate, unchanged } }`
|
|
118
|
+
- `si validate --json` → `{ validateVersion: 1, valid, errors: [{ path,
|
|
119
|
+
keyword, message, allowedValues? }] }`
|
|
120
|
+
- `si show --json` → `{ showVersion: 1, provider, app, service, stage,
|
|
121
|
+
stateLocation, backend: "saas|bucket_store|local", locked, lock, resources,
|
|
122
|
+
resourceCount, ... }`
|
|
123
|
+
- 失败时(`--json` 模式)→ stdout 输出 `{ error: { code, message } }`
|
|
124
|
+
|
|
125
|
+
**退出码**:`si plan` 无变更时退出 `0`,有变更时退出 `2`(terraform
|
|
126
|
+
惯例),出错时退出 `1`。`si validate` 校验通过退出 `0`,校验失败退出 `1`。
|
|
127
|
+
|
|
128
|
+
**稳定错误码**:错误 `code` 是翻译消息背后的 i18n key(例如
|
|
129
|
+
`RAM_ROLE_NOT_FOUND_IN_CLOUD`)——在所有语言环境下保持一致,agent
|
|
130
|
+
可以据此映射自愈动作,不受 `LANG` 影响。
|
|
131
|
+
|
|
132
|
+
**颜色**:设置 `NO_COLOR` 环境变量([no-color.org](https://no-color.org))或传入
|
|
133
|
+
`--no-color` 时禁用 ANSI 颜色,保证非 TTY 环境下管道输出干净。
|
|
134
|
+
|
|
98
135
|
### 本地开发
|
|
99
136
|
|
|
100
137
|
无需部署到云端,即可本地运行和调试你的 Serverless 函数。
|
|
101
138
|
|
|
102
139
|
- **LocalStack 服务** —— 在本地测试函数、存储桶和 API 端点
|
|
140
|
+
- **定时触发器本地触发** —— 阿里云、腾讯云与火山引擎 `functions.*.triggers.timer` 调度按 UTC 墙钟执行(`@every` 自服务启动起算),以对应云平台的 timer 事件形状调用你的处理函数
|
|
141
|
+
- **火山引擎 HTTP 调用** —— 为[文档化的本地子集](docs/local-development.md)提供 veFaaS Node.js 事件、context 与响应转换,附带[可运行示例](samples/volcengine-local/serverlessinsight.yml)
|
|
103
142
|
- **存储桶文件服务** —— 通过 HTTP 访问本地存储文件,加速迭代
|
|
104
143
|
- **同一配置,不同目标** —— `si local -f serverless.yml -s local` 复用你现有的配置
|
|
105
144
|
|
|
@@ -112,6 +151,37 @@ si destroy -f serverless.yml
|
|
|
112
151
|
- **CDN 加速** —— 为静态站点提供边缘缓存与全球内容分发
|
|
113
152
|
- **OSS 传输加速** —— 通过阿里云骨干网进行跨区域数据传输
|
|
114
153
|
|
|
154
|
+
### 定时触发器
|
|
155
|
+
|
|
156
|
+
在 `functions.*.triggers.timer` 下使用 provider 无关的 `si-cron` 表达式调度函数:
|
|
157
|
+
|
|
158
|
+
```yaml
|
|
159
|
+
functions:
|
|
160
|
+
my_fn:
|
|
161
|
+
triggers:
|
|
162
|
+
timer:
|
|
163
|
+
- name: billing-run # 必填 —— 漂移检测按 name 定位
|
|
164
|
+
cron: '0 23 3 * * *' # 必填 —— si-cron,按 UTC 解释
|
|
165
|
+
payload: '{"job":"billing-run"}' # 可选,原样透传
|
|
166
|
+
enable: true # 可选,默认 true
|
|
167
|
+
description: 每日出账 # 可选
|
|
168
|
+
- name: report-hourly
|
|
169
|
+
cron: '@every 1h'
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
`cron` 支持标准 5 段表达式(`分 时 日 月 周`)、带秒前缀的 6 段,或
|
|
173
|
+
`@every <时长>`(`30s`、`5m`、`1h`、`1d` 等)。si-cron 一律按 **UTC** 解释——
|
|
174
|
+
合成层负责翻译成各家方言(阿里云 FC3 六段、腾讯云 SCF 含年的七段、火山引擎
|
|
175
|
+
veFaaS 五段 crontab),并完成 UTC+8 字段平移,因此同一份 YAML 在所有云平台
|
|
176
|
+
触发时刻一致。非法表达式与平台能力上限(腾讯云 SCF 单函数最多 10 个定时触发器)
|
|
177
|
+
在 `si validate` 阶段即报错,不会进入部署。
|
|
178
|
+
|
|
179
|
+
**`functions.*.triggers` 与顶层 `events` 的区分**:`triggers`(http、timer)
|
|
180
|
+
是「调用本函数的东西」——函数级归属、随函数级联删除、没有独立配置面。顶层
|
|
181
|
+
`events`(如 `API_GATEWAY`)是拥有独立配置面的基础设施资源——自定义域名、
|
|
182
|
+
证书、路由表——删除后端函数后它们依然存在。经验法则:有独立配置面 →
|
|
183
|
+
`events`;纯调度/事件绑定 → `triggers`。
|
|
184
|
+
|
|
115
185
|
### 资源管理
|
|
116
186
|
|
|
117
187
|
不止于函数——管理包含存储、数据库等在内的完整 Serverless 技术栈。
|
|
@@ -209,12 +279,10 @@ events:
|
|
|
209
279
|
## 社区
|
|
210
280
|
|
|
211
281
|
<p align="center">
|
|
212
|
-
<img src="
|
|
282
|
+
<img src="docs/images/wechat_official.png" width="300" alt="微信公众号">
|
|
213
283
|
</p>
|
|
214
284
|
|
|
215
285
|
<p align="center">
|
|
216
|
-
<a href="https://discord.gg/5NSUyPK2E"><img src="https://img.shields.io/badge/Discord-加入-5865F2?logo=discord&logoColor=white" alt="Discord" /></a>
|
|
217
|
-
|
|
218
286
|
<a href="https://x.com/geekfun_club"><img src="https://img.shields.io/badge/X-关注-000000?logo=x&logoColor=white" alt="X / Twitter" /></a>
|
|
219
287
|
|
|
220
288
|
<a href="https://www.youtube.com/@geekfun-club"><img src="https://img.shields.io/badge/YouTube-订阅-FF0000?logo=youtube&logoColor=white" alt="YouTube" /></a>
|
|
@@ -229,19 +297,11 @@ events:
|
|
|
229
297
|
## 赞助
|
|
230
298
|
|
|
231
299
|
<p align="center">
|
|
300
|
+
<img src="docs/images/wechat_ponsor.jpg" width="140" alt="微信赞赏码">
|
|
301
|
+
|
|
232
302
|
<a href="https://github.com/sponsors/geek-fun"><img src="https://img.shields.io/badge/GitHub_Sponsors-%E2%9D%A4_支持-EA4AAA?logo=githubsponsors&logoColor=white" alt="GitHub Sponsors" /></a>
|
|
233
303
|
</p>
|
|
234
304
|
|
|
235
|
-
## Star 历史
|
|
236
|
-
|
|
237
|
-
<a href="https://www.star-history.com/?repos=geek-fun/serverlessinsight&type=date">
|
|
238
|
-
<picture>
|
|
239
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=geek-fun/serverlessinsight&type=date&theme=dark" />
|
|
240
|
-
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=geek-fun/serverlessinsight&type=date" />
|
|
241
|
-
<img alt="Star History Chart" src="https://api.star-history.com/chart?repos=geek-fun/serverlessinsight&type=date" />
|
|
242
|
-
</picture>
|
|
243
|
-
</a>
|
|
244
|
-
|
|
245
305
|
## 许可证
|
|
246
306
|
|
|
247
307
|
[Apache 2.0](LICENSE) © GEEKFUN
|
package/codecov
ADDED
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ca1d64196d2d34771084afe76ea657d581bf628e31d993ff8e52ea09cc88a56d codecov
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
-----BEGIN PGP SIGNATURE-----
|
|
2
|
+
|
|
3
|
+
iQIzBAABCgAdFiEEJwNOf9uFDgu8LGL/gGuyiu13mGkFAmpO+3UACgkQgGuyiu13
|
|
4
|
+
mGm0UxAAne5/lA7YQHQlWt455twIGwZgcSX13LTQw45+goIfZC7IGDQ7J6/kLyJG
|
|
5
|
+
sGvkfSmYEODgsgo6474CWcm16VPMZa3QWa4z6EdfyNHhDo5nNe358ZPA1dOemMKZ
|
|
6
|
+
eV2/9WpDcIEIAhsCj8HKjNjsLBcGrAQRbOw2tABg2dbE8Yg94SMdEqjMCswOQn3i
|
|
7
|
+
OPsybWDjbAdqUVIWylUXbned5/hVnzNAMeo6WvC5+LNw1iS+8rzSIUu5iSxCz9jV
|
|
8
|
+
XBe0ZNZ/z1jLZ0NHQXWoOWVT6aHI3Aml/V+ttduuSPwVqWUtqT+XWnnxXJlkt3fQ
|
|
9
|
+
uB8Fy9NBkj5qkls81pUyt0Z9QuMvnI/OxWiUZ6jOEItiZMkK87ryPiheBoaU4kuf
|
|
10
|
+
fcpoRz/EVNsAgcrHBFQCiam7I32h5R5O9orDiU4pKzahSdgelnvOPIZQzSKT5m/M
|
|
11
|
+
50tuts7npVQib2op7XCv+6d3t8ZnUHzXnqiej6n/vWxE3nWJiw39a5ww7RDO1RQB
|
|
12
|
+
8oNPX3qvPGpNmspXSf57oLyJqiSs4t7B9yIacCMPnlVDZt3MseXP/UHH7cXMmRuX
|
|
13
|
+
bU2mkdieBgkGtkNkB76sp/ob5FWQmynW1+Q3ZcDGrGeysnRgDGWD2Yy92lcABZDc
|
|
14
|
+
DXolC9kpvP+UrUXG5XSTIKksMbH4YacgNIKHzwyhOgViMLWBA4g=
|
|
15
|
+
=fH2Y
|
|
16
|
+
-----END PGP SIGNATURE-----
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geek-fun/serverlessinsight",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"description": "Full-lifecycle serverless IaC — one open-source platform to develop, deploy and operate serverless across clouds.",
|
|
5
5
|
"homepage": "https://serverlessinsight.com",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -10,11 +10,13 @@ const local_1 = require("./local");
|
|
|
10
10
|
const plan_1 = require("./plan");
|
|
11
11
|
const forceUnlock_1 = require("./forceUnlock");
|
|
12
12
|
const show_1 = require("./show");
|
|
13
|
+
const schema_1 = require("./schema");
|
|
13
14
|
const login_1 = require("./login");
|
|
14
15
|
const logout_1 = require("./logout");
|
|
15
16
|
const whoami_1 = require("./whoami");
|
|
16
17
|
const migrate_1 = require("./migrate");
|
|
17
18
|
const lang_1 = require("../lang");
|
|
19
|
+
const jsonOutput_1 = require("../common/jsonOutput");
|
|
18
20
|
const parser_1 = require("../parser");
|
|
19
21
|
const MAX_ERROR_MESSAGE_LENGTH = 2000;
|
|
20
22
|
const truncateErrorMessage = (message) => {
|
|
@@ -24,6 +26,27 @@ const truncateErrorMessage = (message) => {
|
|
|
24
26
|
? `${message.slice(0, MAX_ERROR_MESSAGE_LENGTH)}… (truncated ${message.length} chars)`
|
|
25
27
|
: message;
|
|
26
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* Issue #250: a thrown error's stable machine code is the i18n key behind its
|
|
31
|
+
* message. Errors may already carry a `code` (an i18n key); otherwise the
|
|
32
|
+
* message is mapped back through the catalogs — locale-independent, so the
|
|
33
|
+
* code is identical under LANG=zh_CN and LANG=en_US.
|
|
34
|
+
*/
|
|
35
|
+
const resolveErrorCode = (error) => {
|
|
36
|
+
if (typeof error?.code === 'string' && (0, lang_1.hasLangKey)(error.code)) {
|
|
37
|
+
return error.code;
|
|
38
|
+
}
|
|
39
|
+
const fromMessage = (0, lang_1.lookupErrorCode)(error?.message);
|
|
40
|
+
if (fromMessage) {
|
|
41
|
+
return fromMessage;
|
|
42
|
+
}
|
|
43
|
+
return typeof error?.code === 'string' ? error.code : undefined;
|
|
44
|
+
};
|
|
45
|
+
// Let queued stdout writes flush (async on macOS pipes) before the process
|
|
46
|
+
// ends, so a piped `si ... --json | jq` never sees a truncated document.
|
|
47
|
+
const flushStdoutAndExit = (exitCode) => {
|
|
48
|
+
process.stdout.write('', () => process.exit(exitCode));
|
|
49
|
+
};
|
|
27
50
|
// Global error handler
|
|
28
51
|
const handleCommandError = (error, commandName) => {
|
|
29
52
|
// Skip logging if already logged by handlePartialFailure
|
|
@@ -34,30 +57,28 @@ const handleCommandError = (error, commandName) => {
|
|
|
34
57
|
error: truncateErrorMessage(error?.message) || 'Unknown error occurred',
|
|
35
58
|
}));
|
|
36
59
|
}
|
|
60
|
+
const errorCode = resolveErrorCode(error);
|
|
61
|
+
if (errorCode) {
|
|
62
|
+
common_1.logger.error(lang_1.lang.__('ERROR_CODE', { code: errorCode }));
|
|
63
|
+
}
|
|
37
64
|
if (error?.stack && process.env.DEBUG) {
|
|
38
65
|
common_1.logger.debug(lang_1.lang.__('STACK_TRACE', { stack: error.stack }));
|
|
39
66
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
ENOENT: 2,
|
|
48
|
-
EACCES: 3,
|
|
49
|
-
VALIDATION: 4,
|
|
50
|
-
NETWORK: 5,
|
|
51
|
-
};
|
|
52
|
-
exitCode = errorCodeMap[error.code] || 1;
|
|
53
|
-
}
|
|
67
|
+
if ((0, jsonOutput_1.isJsonMode)()) {
|
|
68
|
+
(0, jsonOutput_1.writeJson)({
|
|
69
|
+
error: {
|
|
70
|
+
code: errorCode ?? 'UNKNOWN',
|
|
71
|
+
message: truncateErrorMessage(error?.message) || 'Unknown error occurred',
|
|
72
|
+
},
|
|
73
|
+
});
|
|
54
74
|
}
|
|
55
|
-
|
|
75
|
+
flushStdoutAndExit(1);
|
|
56
76
|
};
|
|
57
77
|
const actionWrapper = (commandName, handler) => {
|
|
58
78
|
// Reset context before each command execution
|
|
59
79
|
(0, common_1.clearContext)();
|
|
60
80
|
return async (...args) => {
|
|
81
|
+
(0, jsonOutput_1.setJsonMode)(false);
|
|
61
82
|
try {
|
|
62
83
|
await handler(...args);
|
|
63
84
|
}
|
|
@@ -87,12 +108,21 @@ program
|
|
|
87
108
|
.action(actionWrapper('whoami', async () => {
|
|
88
109
|
await (0, whoami_1.whoami)();
|
|
89
110
|
}));
|
|
111
|
+
program
|
|
112
|
+
.command('schema')
|
|
113
|
+
.description(lang_1.lang.__('CMD_SCHEMA_DESC'))
|
|
114
|
+
.option('-o, --output <path>', lang_1.lang.__('OPT_SCHEMA_OUTPUT'))
|
|
115
|
+
.action(actionWrapper('schema', async ({ output }) => {
|
|
116
|
+
await (0, schema_1.schema)({ output });
|
|
117
|
+
}));
|
|
90
118
|
program
|
|
91
119
|
.command('show')
|
|
92
120
|
.description(lang_1.lang.__('CMD_SHOW_DESC'))
|
|
93
121
|
.option('-f, --file <path>', lang_1.lang.__('OPT_FILE'))
|
|
94
122
|
.option('-s, --stage <stage>', lang_1.lang.__('OPT_STAGE'))
|
|
95
|
-
.
|
|
123
|
+
.option('--json', lang_1.lang.__('OPT_JSON'))
|
|
124
|
+
.action(actionWrapper('show', async ({ file, stage, json }) => {
|
|
125
|
+
(0, jsonOutput_1.setJsonMode)(!!json);
|
|
96
126
|
const iacLocation = (0, common_1.getIacLocation)(file);
|
|
97
127
|
const rawIac = (0, parser_1.parseYaml)(iacLocation);
|
|
98
128
|
await (0, common_1.setContext)({
|
|
@@ -106,16 +136,22 @@ program
|
|
|
106
136
|
const context = (0, common_1.getContext)();
|
|
107
137
|
const iac = (0, parser_1.revalYaml)(iacLocation, context);
|
|
108
138
|
(0, common_1.setIac)(iac);
|
|
109
|
-
await (0, show_1.show)({ stage, location: file, iac });
|
|
139
|
+
await (0, show_1.show)({ stage, location: file, iac, json: !!json });
|
|
110
140
|
}));
|
|
111
141
|
program
|
|
112
142
|
.command('validate')
|
|
113
143
|
.description(lang_1.lang.__('CMD_VALIDATE_DESC'))
|
|
114
144
|
.option('-f, --file <path>', lang_1.lang.__('OPT_FILE'))
|
|
115
145
|
.option('-s, --stage <stage>', lang_1.lang.__('OPT_STAGE'))
|
|
116
|
-
.
|
|
146
|
+
.option('--json', lang_1.lang.__('OPT_JSON'))
|
|
147
|
+
.action(actionWrapper('validate', async ({ file, stage, json }) => {
|
|
148
|
+
(0, jsonOutput_1.setJsonMode)(!!json);
|
|
117
149
|
common_1.logger.debug(lang_1.lang.__('LOG_COMMAND_INFO'));
|
|
118
|
-
await (0, validate_1.validate)({ stage, location: file });
|
|
150
|
+
const result = await (0, validate_1.validate)({ stage, location: file, json: !!json });
|
|
151
|
+
// Issue #250 exit-code convention: 0 = valid, 1 = validation failed.
|
|
152
|
+
if (!result.valid) {
|
|
153
|
+
process.exitCode = 1;
|
|
154
|
+
}
|
|
119
155
|
}));
|
|
120
156
|
program
|
|
121
157
|
.command('plan')
|
|
@@ -128,9 +164,17 @@ program
|
|
|
128
164
|
.option('-x, --accessKeySecret <accessKeySecret>', lang_1.lang.__('OPT_ACCESS_KEY_SECRET'))
|
|
129
165
|
.option('-n, --securityToken <securityToken>', lang_1.lang.__('OPT_SECURITY_TOKEN'))
|
|
130
166
|
.option('--no-refresh', lang_1.lang.__('OPT_NO_REFRESH'))
|
|
131
|
-
.
|
|
132
|
-
|
|
167
|
+
.option('--json', lang_1.lang.__('OPT_JSON'))
|
|
168
|
+
.option('--no-color', lang_1.lang.__('OPT_NO_COLOR'))
|
|
169
|
+
.option('-p, --parameter <key=value>', lang_1.lang.__('OPT_PARAMETER'), (value, previous) => {
|
|
170
|
+
const [key, val] = value.split('=');
|
|
171
|
+
return { ...previous, [key]: val };
|
|
172
|
+
}, {})
|
|
173
|
+
.action(actionWrapper('plan', async ({ stage, parameter, file, region, provider, accessKeyId, accessKeySecret, securityToken, refresh, json, color, }) => {
|
|
174
|
+
(0, jsonOutput_1.setJsonMode)(!!json);
|
|
175
|
+
const result = await (0, plan_1.plan)({
|
|
133
176
|
stage,
|
|
177
|
+
parameters: parameter,
|
|
134
178
|
location: file,
|
|
135
179
|
region,
|
|
136
180
|
provider,
|
|
@@ -138,7 +182,14 @@ program
|
|
|
138
182
|
accessKeySecret,
|
|
139
183
|
securityToken,
|
|
140
184
|
refresh,
|
|
185
|
+
json: !!json,
|
|
186
|
+
noColor: color === false,
|
|
141
187
|
});
|
|
188
|
+
// Issue #250 exit-code convention (terraform-compatible):
|
|
189
|
+
// 0 = no changes, 2 = changes present, 1 = execution error (handler).
|
|
190
|
+
if (result.hasChanges) {
|
|
191
|
+
process.exitCode = 2;
|
|
192
|
+
}
|
|
142
193
|
}));
|
|
143
194
|
// Issue #246: `diff` is the primary verb users say — it runs the same plan
|
|
144
195
|
// flow; `plan` stays for compatibility.
|
|
@@ -153,9 +204,17 @@ program
|
|
|
153
204
|
.option('-x, --accessKeySecret <accessKeySecret>', lang_1.lang.__('OPT_ACCESS_KEY_SECRET'))
|
|
154
205
|
.option('-n, --securityToken <securityToken>', lang_1.lang.__('OPT_SECURITY_TOKEN'))
|
|
155
206
|
.option('--no-refresh', lang_1.lang.__('OPT_NO_REFRESH'))
|
|
156
|
-
.
|
|
157
|
-
|
|
207
|
+
.option('--json', lang_1.lang.__('OPT_JSON'))
|
|
208
|
+
.option('--no-color', lang_1.lang.__('OPT_NO_COLOR'))
|
|
209
|
+
.option('-p, --parameter <key=value>', lang_1.lang.__('OPT_PARAMETER'), (value, previous) => {
|
|
210
|
+
const [key, val] = value.split('=');
|
|
211
|
+
return { ...previous, [key]: val };
|
|
212
|
+
}, {})
|
|
213
|
+
.action(actionWrapper('diff', async ({ stage, parameter, file, region, provider, accessKeyId, accessKeySecret, securityToken, refresh, json, color, }) => {
|
|
214
|
+
(0, jsonOutput_1.setJsonMode)(!!json);
|
|
215
|
+
const result = await (0, plan_1.plan)({
|
|
158
216
|
stage,
|
|
217
|
+
parameters: parameter,
|
|
159
218
|
location: file,
|
|
160
219
|
region,
|
|
161
220
|
provider,
|
|
@@ -163,7 +222,12 @@ program
|
|
|
163
222
|
accessKeySecret,
|
|
164
223
|
securityToken,
|
|
165
224
|
refresh,
|
|
225
|
+
json: !!json,
|
|
226
|
+
noColor: color === false,
|
|
166
227
|
});
|
|
228
|
+
if (result.hasChanges) {
|
|
229
|
+
process.exitCode = 2;
|
|
230
|
+
}
|
|
167
231
|
}));
|
|
168
232
|
program
|
|
169
233
|
.command('deploy')
|
|
@@ -259,14 +323,18 @@ program
|
|
|
259
323
|
.description(lang_1.lang.__('CMD_LOCAL_DESC'))
|
|
260
324
|
.option('-f, --file <path>', lang_1.lang.__('OPT_FILE'))
|
|
261
325
|
.option('-s, --stage <stage>', lang_1.lang.__('OPT_STAGE'), 'default')
|
|
326
|
+
.option('-r, --region <region>', lang_1.lang.__('OPT_REGION'))
|
|
327
|
+
.option('-v, --provider <provider>', lang_1.lang.__('OPT_PROVIDER'))
|
|
262
328
|
.option('-d, --debug', lang_1.lang.__('OPT_DEBUG'))
|
|
263
329
|
.option('-w, --watch', lang_1.lang.__('OPT_WATCH'), true)
|
|
264
|
-
.action(actionWrapper('local', async ({ stage, debug, watch, file }) => {
|
|
330
|
+
.action(actionWrapper('local', async ({ stage, debug, watch, file, provider, region }) => {
|
|
265
331
|
await (0, local_1.runLocal)({
|
|
266
332
|
stage,
|
|
267
333
|
debug: !!debug,
|
|
268
334
|
watch: typeof watch === 'boolean' ? watch : true,
|
|
269
335
|
location: file,
|
|
336
|
+
provider,
|
|
337
|
+
region,
|
|
270
338
|
});
|
|
271
339
|
}));
|
|
272
340
|
program
|
|
@@ -6,12 +6,25 @@ const localStack_1 = require("../stack/localStack");
|
|
|
6
6
|
const parser_1 = require("../parser");
|
|
7
7
|
const lang_1 = require("../lang");
|
|
8
8
|
const runLocal = async (opts) => {
|
|
9
|
-
const { stage, debug, watch, location } = opts;
|
|
9
|
+
const { stage, debug, watch, location, provider, region } = opts;
|
|
10
10
|
const iacLocation = (0, common_1.getIacLocation)(location);
|
|
11
11
|
const rawIac = (0, parser_1.parseYaml)(iacLocation);
|
|
12
|
-
await (0, common_1.setContext)({
|
|
12
|
+
await (0, common_1.setContext)({
|
|
13
|
+
stage,
|
|
14
|
+
app: rawIac.app,
|
|
15
|
+
service: rawIac.service,
|
|
16
|
+
location,
|
|
17
|
+
provider,
|
|
18
|
+
region,
|
|
19
|
+
iacProvider: rawIac.provider,
|
|
20
|
+
stages: rawIac.stages,
|
|
21
|
+
});
|
|
13
22
|
const ctx = (0, common_1.getContext)();
|
|
14
|
-
const
|
|
23
|
+
const evaluatedIac = (0, parser_1.revalYaml)(iacLocation, ctx);
|
|
24
|
+
const iac = {
|
|
25
|
+
...evaluatedIac,
|
|
26
|
+
provider: { ...evaluatedIac.provider, name: ctx.provider, region: ctx.region },
|
|
27
|
+
};
|
|
15
28
|
// Store IAC in context for access by all functions
|
|
16
29
|
(0, common_1.setIac)(iac);
|
|
17
30
|
common_1.logger.info(lang_1.lang.__('RUN_LOCAL_STARTING', {
|
|
@@ -3,9 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.plan = void 0;
|
|
4
4
|
const common_1 = require("../common");
|
|
5
5
|
const stateBackend_1 = require("../common/stateBackend");
|
|
6
|
+
const jsonOutput_1 = require("../common/jsonOutput");
|
|
7
|
+
const noColor_1 = require("../common/noColor");
|
|
6
8
|
const parser_1 = require("../parser");
|
|
7
9
|
const scfStack_1 = require("../stack/scfStack");
|
|
8
10
|
const aliyunStack_1 = require("../stack/aliyunStack");
|
|
11
|
+
const volcengineStack_1 = require("../stack/volcengineStack");
|
|
9
12
|
const lang_1 = require("../lang");
|
|
10
13
|
const plan = async (options) => {
|
|
11
14
|
common_1.logger.info(lang_1.lang.__('VALIDATING_YAML'));
|
|
@@ -24,9 +27,12 @@ const plan = async (options) => {
|
|
|
24
27
|
const iac = (0, parser_1.revalYaml)(iacLocation, context);
|
|
25
28
|
// Store IAC in context for access by all functions
|
|
26
29
|
(0, common_1.setIac)(iac);
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
: lang_1.lang.__('PROVIDER_TENCENT')
|
|
30
|
+
const providerDisplayNames = {
|
|
31
|
+
[common_1.ProviderEnum.ALIYUN]: lang_1.lang.__('PROVIDER_ALIYUN'),
|
|
32
|
+
[common_1.ProviderEnum.TENCENT]: lang_1.lang.__('PROVIDER_TENCENT'),
|
|
33
|
+
[common_1.ProviderEnum.VOLCENGINE]: lang_1.lang.__('PROVIDER_VOLCENGINE'),
|
|
34
|
+
};
|
|
35
|
+
const providerDisplayName = providerDisplayNames[iac.provider.name] ?? iac.provider.name;
|
|
30
36
|
common_1.logger.info(lang_1.lang.__('GENERATING_PLAN_FOR_PROVIDER', { provider: providerDisplayName }));
|
|
31
37
|
// Read-only command: a migrated state only warns here (window-period
|
|
32
38
|
// reconciliation still needs plan against the legacy copy).
|
|
@@ -42,10 +48,31 @@ const plan = async (options) => {
|
|
|
42
48
|
else if (iac.provider.name === common_1.ProviderEnum.ALIYUN) {
|
|
43
49
|
planResult = await (0, aliyunStack_1.generateAliyunPlan)(iac, backend);
|
|
44
50
|
}
|
|
51
|
+
else if (iac.provider.name === common_1.ProviderEnum.VOLCENGINE) {
|
|
52
|
+
planResult = await (0, volcengineStack_1.generateVolcenginePlan)(iac, backend);
|
|
53
|
+
}
|
|
45
54
|
else {
|
|
46
55
|
common_1.logger.error(lang_1.lang.__('PLAN_COMMAND_NOT_SUPPORTED'));
|
|
47
56
|
throw new Error(lang_1.lang.__('PLAN_COMMAND_NOT_SUPPORTED'));
|
|
48
57
|
}
|
|
49
|
-
(
|
|
58
|
+
if (options.json) {
|
|
59
|
+
(0, jsonOutput_1.writeJson)((0, jsonOutput_1.buildPlanJson)(planResult, {
|
|
60
|
+
provider: iac.provider.name,
|
|
61
|
+
app: iac.app,
|
|
62
|
+
service: iac.service,
|
|
63
|
+
stage: context.stage,
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
const displayConfig = {
|
|
68
|
+
colorize: !(options.noColor ?? false) && !(0, noColor_1.isNoColorEnabled)(),
|
|
69
|
+
indentSize: 4,
|
|
70
|
+
keyAlignWidth: 12,
|
|
71
|
+
};
|
|
72
|
+
(0, scfStack_1.displayPlan)(planResult, displayConfig);
|
|
73
|
+
}
|
|
74
|
+
const summary = (0, jsonOutput_1.buildPlanSummary)(planResult.items ?? []);
|
|
75
|
+
const changeCount = summary.create + summary.update + summary.destroy + summary.recreate;
|
|
76
|
+
return { hasChanges: changeCount > 0 };
|
|
50
77
|
};
|
|
51
78
|
exports.plan = plan;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.schema = void 0;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const validator_1 = require("../validator");
|
|
6
|
+
const logger_1 = require("../common/logger");
|
|
7
|
+
const lang_1 = require("../lang");
|
|
8
|
+
/**
|
|
9
|
+
* Issue #250: export the JSON Schema the validator compiles against as a
|
|
10
|
+
* self-contained, standard draft-07 document — the anchor agents use for
|
|
11
|
+
* structured YAML generation, editors use for completion, and `si validate`
|
|
12
|
+
* loops use for pre-flight checks.
|
|
13
|
+
*/
|
|
14
|
+
const schema = async (options) => {
|
|
15
|
+
const exported = (0, validator_1.exportIacJsonSchema)();
|
|
16
|
+
const payload = `${JSON.stringify(exported, null, 2)}\n`;
|
|
17
|
+
if (options.output) {
|
|
18
|
+
(0, node_fs_1.writeFileSync)(options.output, payload, 'utf8');
|
|
19
|
+
logger_1.logger.info(lang_1.lang.__('SCHEMA_WRITTEN_TO', { path: options.output }));
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
process.stdout.write(payload);
|
|
23
|
+
};
|
|
24
|
+
exports.schema = schema;
|
|
@@ -1,14 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.show = void 0;
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
4
9
|
const types_1 = require("../types");
|
|
5
10
|
const backend_1 = require("../types/domains/backend");
|
|
6
11
|
const common_1 = require("../common");
|
|
7
12
|
const lockManager_1 = require("../common/lockManager");
|
|
8
13
|
const stateBackend_1 = require("../common/stateBackend");
|
|
9
14
|
const migrationMarker_1 = require("../common/migrationMarker");
|
|
15
|
+
const jsonOutput_1 = require("../common/jsonOutput");
|
|
10
16
|
const logger_1 = require("../common/logger");
|
|
11
17
|
const lang_1 = require("../lang");
|
|
18
|
+
/**
|
|
19
|
+
* The CLI passes the yaml file path as `location`; the state directory lives
|
|
20
|
+
* next to that file, not underneath it. A directory (or cwd) stays as-is.
|
|
21
|
+
*/
|
|
22
|
+
const resolveBaseDir = (location) => {
|
|
23
|
+
if (!location) {
|
|
24
|
+
return process.cwd();
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
if (node_fs_1.default.statSync(location).isFile()) {
|
|
28
|
+
return node_path_1.default.dirname(location);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// not an existing file — treat as a directory
|
|
33
|
+
}
|
|
34
|
+
return location;
|
|
35
|
+
};
|
|
12
36
|
const formatTimeAgo = (dateStr) => {
|
|
13
37
|
const date = new Date(dateStr);
|
|
14
38
|
const now = new Date();
|
|
@@ -171,14 +195,16 @@ const getBackendLocationString = (backendConfig) => {
|
|
|
171
195
|
const config = backendConfig;
|
|
172
196
|
return `bucket://${config.bucket}/${config.key}`;
|
|
173
197
|
};
|
|
198
|
+
const SAAS_STATE_LOCATION = 'saas';
|
|
174
199
|
const show = async (options) => {
|
|
175
200
|
const context = (0, common_1.getContext)();
|
|
176
201
|
const stage = options.stage ?? context.stage;
|
|
177
|
-
const baseDir = options.location
|
|
202
|
+
const baseDir = resolveBaseDir(options.location);
|
|
178
203
|
logger_1.logger.info(lang_1.lang.__('SHOW_LOADING_STATE', { app: context.app, service: context.service, stage }));
|
|
179
204
|
let state;
|
|
180
205
|
let lockInfo;
|
|
181
206
|
let stateLocation;
|
|
207
|
+
let stateLocationDisplay;
|
|
182
208
|
let usingRemoteBackend = false;
|
|
183
209
|
const backendType = options.iac?.backend?.type;
|
|
184
210
|
const shouldUseRemoteBackend = backendType === backend_1.StateBackendType.BUCKET_STORE ||
|
|
@@ -197,7 +223,7 @@ const show = async (options) => {
|
|
|
197
223
|
usingRemoteBackend = true;
|
|
198
224
|
stateLocation =
|
|
199
225
|
backendType === backend_1.StateBackendType.SAAS || !backendType
|
|
200
|
-
?
|
|
226
|
+
? SAAS_STATE_LOCATION
|
|
201
227
|
: getBackendLocationString(options.iac.backend);
|
|
202
228
|
}
|
|
203
229
|
catch (error) {
|
|
@@ -216,18 +242,46 @@ const show = async (options) => {
|
|
|
216
242
|
lockInfo = readLocalLock(context.app, context.service, baseDir);
|
|
217
243
|
stateLocation = (0, common_1.getStatePath)(context.app, context.service, baseDir);
|
|
218
244
|
}
|
|
245
|
+
stateLocationDisplay =
|
|
246
|
+
stateLocation === SAAS_STATE_LOCATION ? lang_1.lang.__('SHOW_BACKEND_SAAS') : stateLocation;
|
|
219
247
|
}
|
|
220
248
|
else {
|
|
221
249
|
state = loadLocalState(context.provider, context.app, context.service, stage, baseDir);
|
|
222
250
|
lockInfo = readLocalLock(context.app, context.service, baseDir);
|
|
223
251
|
stateLocation = (0, common_1.getStatePath)(context.app, context.service, baseDir);
|
|
252
|
+
stateLocationDisplay = stateLocation;
|
|
224
253
|
}
|
|
225
254
|
const resources = state.resources;
|
|
226
255
|
const resourceCount = Object.keys(resources).length;
|
|
256
|
+
if (options.json) {
|
|
257
|
+
const backendKind = !usingRemoteBackend
|
|
258
|
+
? 'local'
|
|
259
|
+
: backendType === backend_1.StateBackendType.BUCKET_STORE
|
|
260
|
+
? 'bucket_store'
|
|
261
|
+
: 'saas';
|
|
262
|
+
const payload = {
|
|
263
|
+
showVersion: jsonOutput_1.SHOW_JSON_VERSION,
|
|
264
|
+
provider: state.provider,
|
|
265
|
+
app: state.app,
|
|
266
|
+
service: state.service,
|
|
267
|
+
stage,
|
|
268
|
+
...(state.serial !== undefined ? { serial: state.serial } : {}),
|
|
269
|
+
...(state.lineage !== undefined ? { lineage: state.lineage } : {}),
|
|
270
|
+
...(state.managedBy !== undefined ? { managedBy: state.managedBy } : {}),
|
|
271
|
+
stateLocation,
|
|
272
|
+
backend: backendKind,
|
|
273
|
+
locked: !!lockInfo,
|
|
274
|
+
lock: lockInfo ? { ...lockInfo } : null,
|
|
275
|
+
resources: resources,
|
|
276
|
+
resourceCount,
|
|
277
|
+
};
|
|
278
|
+
(0, jsonOutput_1.writeJson)(payload);
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
227
281
|
if (resourceCount === 0) {
|
|
228
282
|
logger_1.logger.info(lang_1.lang.__('SHOW_NO_RESOURCES'));
|
|
229
283
|
logger_1.logger.info('');
|
|
230
|
-
logger_1.logger.info(lang_1.lang.__('SHOW_STATE_LOCATION', { stateLocation }));
|
|
284
|
+
logger_1.logger.info(lang_1.lang.__('SHOW_STATE_LOCATION', { stateLocation: stateLocationDisplay }));
|
|
231
285
|
if (usingRemoteBackend) {
|
|
232
286
|
logger_1.logger.info(lang_1.lang.__('SHOW_BACKEND_REMOTE'));
|
|
233
287
|
}
|
|
@@ -264,12 +318,12 @@ const show = async (options) => {
|
|
|
264
318
|
}
|
|
265
319
|
const categoryOrder = ['functions', 'apiGateway', 'storage', 'databases', 'dns', 'other'];
|
|
266
320
|
const categoryLabels = {
|
|
267
|
-
functions: '
|
|
268
|
-
apiGateway: '
|
|
269
|
-
storage: '
|
|
270
|
-
databases: '
|
|
271
|
-
dns: '
|
|
272
|
-
other: '
|
|
321
|
+
functions: lang_1.lang.__('SHOW_CAT_FUNCTIONS'),
|
|
322
|
+
apiGateway: lang_1.lang.__('SHOW_CAT_API_GATEWAY'),
|
|
323
|
+
storage: lang_1.lang.__('SHOW_CAT_STORAGE'),
|
|
324
|
+
databases: lang_1.lang.__('SHOW_CAT_DATABASES'),
|
|
325
|
+
dns: lang_1.lang.__('SHOW_CAT_DNS'),
|
|
326
|
+
other: lang_1.lang.__('SHOW_CAT_OTHER'),
|
|
273
327
|
};
|
|
274
328
|
for (const category of categoryOrder) {
|
|
275
329
|
const resourcesInCategory = groupedResources[category];
|
|
@@ -308,7 +362,7 @@ const show = async (options) => {
|
|
|
308
362
|
}
|
|
309
363
|
}
|
|
310
364
|
logger_1.logger.info('');
|
|
311
|
-
logger_1.logger.info(lang_1.lang.__('SHOW_STATE_LOCATION', { stateLocation }));
|
|
365
|
+
logger_1.logger.info(lang_1.lang.__('SHOW_STATE_LOCATION', { stateLocation: stateLocationDisplay }));
|
|
312
366
|
if (usingRemoteBackend) {
|
|
313
367
|
logger_1.logger.info(lang_1.lang.__('SHOW_BACKEND_REMOTE'));
|
|
314
368
|
}
|