@geek-fun/serverlessinsight 0.9.6 → 0.9.8

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 (90) hide show
  1. package/AGENTS.md +1 -0
  2. package/CHANGELOG.md +68 -0
  3. package/README.md +52 -11
  4. package/README.zh-CN.md +44 -10
  5. package/dist/package.json +2 -1
  6. package/dist/src/commands/deploy.js +3 -1
  7. package/dist/src/commands/destroy.js +3 -1
  8. package/dist/src/commands/forceUnlock.js +2 -2
  9. package/dist/src/commands/index.js +28 -8
  10. package/dist/src/commands/local.js +3 -2
  11. package/dist/src/commands/login.js +120 -37
  12. package/dist/src/commands/logout.js +3 -5
  13. package/dist/src/commands/migrate.js +17 -10
  14. package/dist/src/commands/plan.js +5 -1
  15. package/dist/src/commands/show.js +3 -1
  16. package/dist/src/commands/whoami.js +24 -6
  17. package/dist/src/common/aliyunClient/cdnOperations.js +64 -29
  18. package/dist/src/common/aliyunClient/dnsOperations.js +10 -0
  19. package/dist/src/common/aliyunClient/fc3Operations.js +36 -7
  20. package/dist/src/common/apiClient.js +1 -0
  21. package/dist/src/common/bindingReconcile.js +182 -0
  22. package/dist/src/common/cdnCapabilities.js +80 -0
  23. package/dist/src/common/certUtils.js +44 -5
  24. package/dist/src/common/consoleLines.js +126 -0
  25. package/dist/src/common/constants.js +4 -2
  26. package/dist/src/common/credentialStore.js +136 -39
  27. package/dist/src/common/domainUtils.js +23 -4
  28. package/dist/src/common/functionDefinition.js +4 -1
  29. package/dist/src/common/functionDomainCapabilities.js +28 -0
  30. package/dist/src/common/functionDomainReconcile.js +197 -0
  31. package/dist/src/common/lineContext.js +164 -0
  32. package/dist/src/common/planCapabilities.js +14 -27
  33. package/dist/src/common/planCompare.js +8 -7
  34. package/dist/src/common/planFormatter.js +71 -37
  35. package/dist/src/common/stateBackend/cosStateBackend.js +0 -46
  36. package/dist/src/common/stateBackend/index.js +24 -16
  37. package/dist/src/common/stateBackend/ossStateBackend.js +0 -25
  38. package/dist/src/common/stateBackend/remoteStateBackend.js +5 -22
  39. package/dist/src/common/stateBackend/saasStateBackend.js +46 -53
  40. package/dist/src/common/stateBackend/tosStateBackend.js +100 -0
  41. package/dist/src/common/stateBackend/types.js +0 -9
  42. package/dist/src/common/tencentClient/cdnOperations.js +165 -0
  43. package/dist/src/common/tencentClient/cosOperations.js +18 -2
  44. package/dist/src/common/tencentClient/dnspodOperations.js +12 -0
  45. package/dist/src/common/tencentClient/index.js +16 -0
  46. package/dist/src/common/tencentClient/scfOperations.js +23 -1
  47. package/dist/src/common/tencentClient/sslOperations.js +147 -77
  48. package/dist/src/common/volcengineClient/cdnOperations.js +221 -0
  49. package/dist/src/common/volcengineClient/dnsOperations.js +132 -0
  50. package/dist/src/common/volcengineClient/index.js +28 -0
  51. package/dist/src/common/volcengineClient/tosOperations.js +131 -1
  52. package/dist/src/lang/en.js +89 -12
  53. package/dist/src/lang/zh-CN.js +90 -11
  54. package/dist/src/parser/bucketParser.js +22 -79
  55. package/dist/src/parser/functionParser.js +13 -9
  56. package/dist/src/stack/aliyunStack/apigwResource.js +2 -1
  57. package/dist/src/stack/aliyunStack/fc3Planner.js +32 -12
  58. package/dist/src/stack/aliyunStack/fc3Resource.js +169 -121
  59. package/dist/src/stack/aliyunStack/ossPlanner.js +12 -4
  60. package/dist/src/stack/aliyunStack/ossResource.js +484 -501
  61. package/dist/src/stack/aliyunStack/ossTypes.js +21 -67
  62. package/dist/src/stack/localStack/aliyunFc.js +59 -9
  63. package/dist/src/stack/localStack/bucket.js +75 -28
  64. package/dist/src/stack/localStack/event.js +33 -24
  65. package/dist/src/stack/localStack/httpAdapter.js +1 -13
  66. package/dist/src/stack/localStack/index.js +2 -2
  67. package/dist/src/stack/localStack/localServer.js +85 -7
  68. package/dist/src/stack/scfStack/cosPlanner.js +11 -3
  69. package/dist/src/stack/scfStack/cosResource.js +339 -161
  70. package/dist/src/stack/scfStack/cosTypes.js +25 -34
  71. package/dist/src/stack/scfStack/scfPlanner.js +26 -8
  72. package/dist/src/stack/scfStack/scfResource.js +191 -124
  73. package/dist/src/stack/volcengineStack/tosPlanner.js +13 -1
  74. package/dist/src/stack/volcengineStack/tosResource.js +398 -7
  75. package/dist/src/stack/volcengineStack/tosTypes.js +27 -0
  76. package/dist/src/stack/volcengineStack/vefaasTypes.js +1 -1
  77. package/dist/src/types/domains/state.js +6 -0
  78. package/dist/src/validator/bucketSchema.js +35 -113
  79. package/dist/src/validator/cdnSchema.js +30 -0
  80. package/dist/src/validator/eventSchema.js +2 -20
  81. package/dist/src/validator/functionSchema.js +55 -8
  82. package/dist/src/validator/rootSchema.js +3 -3
  83. package/dist/src/validator/semanticValidation.js +504 -1
  84. package/dist/tsconfig.tsbuildinfo +1 -1
  85. package/package.json +2 -1
  86. package/release-notes.md +82 -6
  87. package/samples/aliyun-poc-api-cdn.yml +1 -1
  88. package/samples/aliyun-poc-bucket-cdn.yml +28 -26
  89. package/samples/aliyun-poc-domain.yml +2 -1
  90. package/samples/volcengine-poc-tos-state.yml +36 -0
package/AGENTS.md CHANGED
@@ -765,6 +765,7 @@ export const createRamOperations = (ramClient: RamSdkClient) => ({
765
765
  - Deploy, destroy and source-to-SaaS migrate automatically prepare V3 under the existing whole-file/key lock; read-only commands never persist upgrades.
766
766
  - Partitions use `stages[stage].providers[provider].regions[region]` and share the whole-file lock.
767
767
  - Executors/SaaS consume one V4 deployment view; SaaS uses scope protocol 3. App/Service stay literal; provider/region may be selected through CLI flags.
768
+ - **Storage-backend parity (mandatory)**: every integrated workload provider must have a native `BUCKET_STORE` adapter (currently OSS/COS/TOS) routed through `src/common/stateBackend/index.ts`, reusing the common remote backend and aggregate store. Providers without one must be rejected explicitly and documented. See the [provider integration checklist](.github/ISSUE_TEMPLATE/CONTRIBUTION.md#adding-a-workload-provider).
768
769
  - Use `setResource`, `getResource`, `removeResource` from `src/common/stateManager`
769
770
  - Resources have a `status`: `'ready'` | `'tainted'`
770
771
 
package/CHANGELOG.md CHANGED
@@ -7,6 +7,74 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.9.8] - 2026-11-16
11
+
12
+ ### ⚠️ Breaking change
13
+
14
+ - Buckets now declare custom domains through a `domains` list with per-binding
15
+ certificate and CDN configuration, and transfer acceleration moves to the
16
+ bucket-level `accelerate` field
17
+ ([#279](https://github.com/geek-fun/serverlessinsight/issues/279)). The legacy
18
+ `domain`, `website.domain`, `www_bind_apex` and per-domain `accelerate` forms
19
+ are rejected with localized migration guidance, and existing single-domain
20
+ state migrates in place so removed bindings cannot reappear. See the issue for
21
+ the old-vs-new configuration mapping.
22
+
23
+ ### Added
24
+
25
+ - Native TOS Bucket Store state backend for Volcengine
26
+ ([#290](https://github.com/geek-fun/serverlessinsight/issues/290)). `BUCKET_STORE`
27
+ now selects OSS, COS or TOS from the original YAML provider or explicit
28
+ `storageProvider` / `storageRegion`, resolves credentials for the storage cloud
29
+ (permanent or STS), and reuses the common remote backend for reads, writes,
30
+ backups, automatic V3 upgrades, migration ownership and best-effort locking.
31
+ Unsupported storage providers are still rejected explicitly. See the
32
+ [backend matrix, permissions and concurrency limits](docs/regional-deployment-state.md#bucket-store-backend-matrix).
33
+ - Bucket domain bindings can now be fronted by CDN acceleration on Tencent COS
34
+ ([#295](https://github.com/geek-fun/serverlessinsight/pull/295)).
35
+ - Volcengine TOS buckets now support custom domain bindings with CDN delivery
36
+ ([#296](https://github.com/geek-fun/serverlessinsight/pull/296)).
37
+ - Functions can bind a list of custom domains, with paths merged into shared
38
+ routes across functions
39
+ ([#286](https://github.com/geek-fun/serverlessinsight/issues/286)).
40
+ - `si local` routes production-shaped gateway URLs without the `/SI_EVENTS/`
41
+ prefix when exactly one trigger matches, serves buckets with an explicit
42
+ `website` block (index document with SPA fallback), and mirrors the deployed
43
+ aliyun gateway event contract (rebuilt Host, gateway-injected `X-Forwarded-*` /
44
+ `X-Ca-*` metadata, path parameters); `--strict-prefix` restores prefix-only
45
+ routing ([#298](https://github.com/geek-fun/serverlessinsight/issues/298)).
46
+ - SaaS logins pick the region interactively and derive the Console URL
47
+ automatically (ADR-008): international and China credentials coexist as
48
+ separate profiles, `whoami` lists all profiles and logout targets the active
49
+ one.
50
+ - `si plan` renders array-valued attribute changes as per-entry structural
51
+ diffs: unchanged entries are omitted, the parent line carries a `(+N / -M)`
52
+ tally, and each added/removed entry gets its own line
53
+ ([#300](https://github.com/geek-fun/serverlessinsight/pull/300)).
54
+
55
+ ### Fixed
56
+
57
+ - SaaS state operations verify CLI credentials before routing, failing with a
58
+ clear error instead of sending operations down the wrong line.
59
+ - Volcengine CDN configuration options now match the `UpdateCdnConfig` API.
60
+ - CDN delivery reconciles DNS records by value-matched ownership, and omitted
61
+ CDN options no longer produce phantom deployment changes
62
+ ([#296](https://github.com/geek-fun/serverlessinsight/pull/296)).
63
+ - Corrected the state scope protocol referenced in SaaS regional error messages.
64
+
65
+ ## [0.9.7] - 2026-11-06
66
+
67
+ ### Fixed
68
+
69
+ - Restore Bucket Store lock compatibility with OSS and COS buckets that have
70
+ versioning enabled or suspended. Locks use ordinary writes followed by
71
+ ownership verification, without requiring bucket-versioning read permission
72
+ or conditional creation. Bucket locking remains best-effort: serialize all
73
+ mutating commands sharing a bucket/key, including different stages, providers
74
+ and regions. See the [known concurrency limitation](docs/state-locking.md#known-issues-bucket-store-concurrency).
75
+
76
+ ## [0.9.6] - 2026-11-05
77
+
10
78
  ### Changed
11
79
 
12
80
  - Whole template references in string-capable scalar maps (`environment`,
package/README.md CHANGED
@@ -164,6 +164,45 @@ than another identity dimension.
164
164
  See [deployment state and migration](docs/regional-deployment-state.md) for storage
165
165
  credentials, automatic V3 upgrades, ownership handoff, lock behavior and recovery.
166
166
 
167
+ ### State backends
168
+
169
+ `backend.state_manager.type: BUCKET_STORE` keeps the exact configured `key` in your own
170
+ bucket. Every integrated workload provider has a native state backend; `-v` and `-r`
171
+ workload overrides never redirect state storage.
172
+
173
+ | Workload provider | State storage | Explicit selection | Credentials |
174
+ | ----------------- | ------------- | ----------------------------- | ---------------------------------------------------- |
175
+ | `aliyun` | OSS | `storageProvider: aliyun` | `ALIYUN_ACCESS_KEY_ID` / `ALIYUN_ACCESS_KEY_SECRET` |
176
+ | `tencent` | COS | `storageProvider: tencent` | `TENCENTCLOUD_SECRET_ID` / `TENCENTCLOUD_SECRET_KEY` |
177
+ | `volcengine` | TOS | `storageProvider: volcengine` | `VOLCENGINE_ACCESS_KEY_ID` / `VOLCENGINE_SECRET_KEY` |
178
+
179
+ ```yaml
180
+ version: 0.0.1
181
+ app: example
182
+ service: api
183
+ provider:
184
+ name: volcengine
185
+ region: cn-beijing
186
+ backend:
187
+ state_manager:
188
+ type: BUCKET_STORE
189
+ bucket: example-state
190
+ key: infra/state.json
191
+ ```
192
+
193
+ Permanent and temporary (STS) credentials work for all three backends; storage
194
+ credentials are resolved for the storage cloud and never reused from another cloud.
195
+ Unsupported storage providers are rejected explicitly. TOS uses HTTPS with the
196
+ configured `storageRegion` and bounded timeouts. Grant read/write/delete on the state
197
+ key and its `.backup`, `.si-lock` and upgrade siblings; bucket versioning permissions
198
+ are not required. See the
199
+ [backend matrix, TOS setup and required permissions](docs/regional-deployment-state.md#bucket-store-backend-matrix).
200
+
201
+ Bucket Store locks are best-effort, not atomic: serialize all writers sharing one
202
+ bucket/key, including different stages, providers and regions. See the
203
+ [known concurrency limitation](docs/state-locking.md#known-issues-bucket-store-concurrency).
204
+ Local and SaaS locking are unchanged.
205
+
167
206
  ### Infrastructure as code
168
207
 
169
208
  Declarative YAML with validation, planning and state management, following proven IaC patterns.
@@ -172,7 +211,7 @@ Declarative YAML with validation, planning and state management, following prove
172
211
  - **Drift detection** — resources changed outside `si` are flagged before the next deploy
173
212
  - **Validation** — type-safe template validation catches config errors before they reach the cloud
174
213
  - **Partial failure recovery** — successfully deployed resources are saved even when others fail; retry to continue
175
- - **State locking** — concurrent deploys are blocked, with `si force-unlock` as the escape hatch
214
+ - **State locking** — automatic locking with `si force-unlock` for recovery; Bucket Store uses [best-effort coordination](docs/state-locking.md#known-issues-bucket-store-concurrency) and requires serialized writers
176
215
 
177
216
  ### Built for agents and scripts
178
217
 
@@ -219,9 +258,10 @@ Configure HTTP endpoints and bind custom domains with automatic DNS verification
219
258
 
220
259
  - **HTTP triggers** — define triggers with HTTP methods and paths, backed by a function
221
260
  - **Custom domains** — automatic CNAME + DNS TXT ownership verification for OSS and API Gateway on Alibaba Cloud, and DNSPod-backed domains on Tencent Cloud
222
- - **CDN acceleration** — edge caching and global content delivery for static sites
261
+ - **CDN acceleration** — edge caching and global content delivery for bucket domains on Alibaba Cloud and Tencent COS (see the [capability matrix](docs/oss-custom-domain-binding.md#cdn-delivery-capability-matrix))
223
262
  - **OSS transfer acceleration** — cross-region data transfers through the Alibaba backbone
224
263
  - **Tencent function URLs** — HTTP entry points without a standalone gateway resource
264
+ - **Function custom domains** — per-function `domains` binding list with cross-function path-merged routes, certificates (`certificate_id` or inline PEM) and a public function-URL precondition on Alibaba Cloud and Tencent Cloud (see the [binding guide](docs/function-custom-domain-binding.md))
225
265
 
226
266
  ### Timer triggers
227
267
 
@@ -261,21 +301,22 @@ Beyond functions — manage the full serverless stack, including storage, databa
261
301
 
262
302
  ## Supported providers
263
303
 
264
- | Provider | Functions | HTTP entry | Object storage | Databases & tables | Status |
265
- | ----------------- | ---------------------------- | ------------------------- | -------------- | ----------------------------------------------------------- | ------- |
266
- | **Alibaba Cloud** | ✅ FC3 | ✅ API Gateway | ✅ OSS | ✅ RDS MySQL Serverless, TableStore, Elasticsearch Serverless | Stable |
267
- | **Tencent Cloud** | ✅ SCF | ✅ Function URL triggers | ✅ COS | ✅ TDSQL-C, Elasticsearch Serverless | Stable |
268
- | **Volcengine** | ✅ veFaaS | ✅ API Gateway | ✅ TOS | — | Stable |
269
- | **Huawei Cloud** | ⚠️ Terraform template only | — | — | — | Preview |
270
- | **AWS** | — | — | — | — | Planned |
271
- | **Azure** | — | — | — | — | Planned |
272
- | **Google Cloud** | — | — | — | — | Planned |
304
+ | Provider | Functions | HTTP entry | Object storage | Databases & tables | State backend | Status |
305
+ | ----------------- | ---------------------------- | ------------------------- | -------------- | ----------------------------------------------------------- | ------------- | ------- |
306
+ | **Alibaba Cloud** | ✅ FC3 | ✅ API Gateway | ✅ OSS | ✅ RDS MySQL Serverless, TableStore, Elasticsearch Serverless | ✅ OSS | Stable |
307
+ | **Tencent Cloud** | ✅ SCF | ✅ Function URL triggers | ✅ COS | ✅ TDSQL-C, Elasticsearch Serverless | ✅ COS | Stable |
308
+ | **Volcengine** | ✅ veFaaS | ✅ API Gateway | ✅ TOS | — | ✅ TOS | Stable |
309
+ | **Huawei Cloud** | ⚠️ Terraform template only | — | — | — | — | Preview |
310
+ | **AWS** | — | — | — | — | — | Planned |
311
+ | **Azure** | — | — | — | — | — | Planned |
312
+ | **Google Cloud** | — | — | — | — | — | Planned |
273
313
 
274
314
  Notes:
275
315
 
276
316
  - Huawei Cloud configuration is parsed and can generate Terraform HCL templates, but deployment is not implemented yet.
277
317
  - Tencent Cloud has no standalone API Gateway resource; HTTP entry points use function URL triggers.
278
318
  - Volcengine does not yet support serverless databases or tables.
319
+ - Bucket Store state is native on OSS/COS/TOS. Other providers have no state backend and are rejected explicitly.
279
320
  - See the [full provider matrix](https://serverlessinsight.com/reference.html) for resource-level details.
280
321
 
281
322
  ## Documentation
package/README.zh-CN.md CHANGED
@@ -164,6 +164,39 @@ than another identity dimension.
164
164
  See [deployment state and migration](docs/regional-deployment-state.md) for storage
165
165
  credentials, automatic V3 upgrades, ownership handoff, lock behavior and recovery.
166
166
 
167
+ ### 状态后端
168
+
169
+ `backend.state_manager.type: BUCKET_STORE` 会把 V4 聚合状态保存在配置的精确 `key` 上。
170
+ 每个已集成的业务云厂商都有原生状态后端;`-v` / `-r` 业务覆盖参数不会改变状态存储位置。
171
+
172
+ | 业务云厂商 | 状态存储 | 显式指定 | 凭证变量 |
173
+ | ----------------- | -------- | ----------------------------- | ---------------------------------------------------- |
174
+ | `aliyun` | OSS | `storageProvider: aliyun` | `ALIYUN_ACCESS_KEY_ID` / `ALIYUN_ACCESS_KEY_SECRET` |
175
+ | `tencent` | COS | `storageProvider: tencent` | `TENCENTCLOUD_SECRET_ID` / `TENCENTCLOUD_SECRET_KEY` |
176
+ | `volcengine` | TOS | `storageProvider: volcengine` | `VOLCENGINE_ACCESS_KEY_ID` / `VOLCENGINE_SECRET_KEY` |
177
+
178
+ ```yaml
179
+ version: 0.0.1
180
+ app: example
181
+ service: api
182
+ provider:
183
+ name: volcengine
184
+ region: cn-beijing
185
+ backend:
186
+ state_manager:
187
+ type: BUCKET_STORE
188
+ bucket: example-state
189
+ key: infra/state.json
190
+ ```
191
+
192
+ 三种后端都支持永久凭证与临时 STS 凭证;状态凭证始终按存储云厂商解析,绝不复用其他云的业务凭证。
193
+ 不支持的存储厂商会被明确拒绝。TOS 使用 HTTPS、配置的 `storageRegion` 以及有上限的连接/请求超时。
194
+ 需要对状态 key 及其 `.backup`、`.si-lock`、升级产物等兄弟对象授予读/写/删除权限,无需 bucket 版本控制权限。
195
+ 详见[后端矩阵、TOS 配置与所需权限](docs/regional-deployment-state.md#bucket-store-backend-matrix)。
196
+
197
+ Bucket Store 锁是尽力而为、并非原子操作:共享同一 bucket/key 的所有写入方(包括不同 stage、厂商和区域)必须串行执行。
198
+ 参见[已知并发限制](docs/state-locking.md#known-issues-bucket-store-concurrency)。Local 与 SaaS 的锁行为不变。
199
+
167
200
  ### 基础设施即代码
168
201
 
169
202
  声明式 YAML 配置,内置校验、计划与状态管理,遵循成熟的 IaC 实践。
@@ -219,7 +252,7 @@ si schema | jq '."$id"' # IaC 格式的自包含 draft-07 JSON Schema
219
252
 
220
253
  - **HTTP 触发器** —— 使用 HTTP 方法与路径定义触发器,并指定后端函数
221
254
  - **自定义域名** —— 阿里云 OSS 与 API 网关自动完成 CNAME + DNS TXT 所有权验证;腾讯云通过 DNSPod 托管域名
222
- - **CDN 加速** —— 为静态站点提供边缘缓存与全球内容分发
255
+ - **CDN 加速** —— 为阿里云与腾讯 COS 的存储桶域名提供边缘缓存与全球内容分发(见[能力矩阵](docs/oss-custom-domain-binding.md#cdn-delivery-capability-matrix))
223
256
  - **OSS 传输加速** —— 通过阿里云骨干网进行跨区域数据传输
224
257
  - **腾讯云函数 URL** —— 无需独立网关资源即可提供 HTTP 入口
225
258
 
@@ -261,21 +294,22 @@ functions:
261
294
 
262
295
  ## 支持的云服务商
263
296
 
264
- | 云服务商 | 函数 | HTTP 入口 | 对象存储 | 数据库与数据表 | 状态 |
265
- | ---------------- | -------------------------- | ---------------------- | -------- | ------------------------------------------------------------- | ------ |
266
- | **阿里云** | ✅ FC3 | ✅ API 网关 | ✅ OSS | ✅ RDS MySQL Serverless、TableStore、Elasticsearch Serverless | 稳定 |
267
- | **腾讯云** | ✅ SCF | ✅ 函数 URL 触发器 | ✅ COS | ✅ TDSQL-C、Elasticsearch Serverless | 稳定 |
268
- | **火山引擎** | ✅ veFaaS | ✅ API 网关 | ✅ TOS | — | 稳定 |
269
- | **华为云** | ⚠️ 仅生成 Terraform 模板 | — | — | — | 预览 |
270
- | **AWS** | — | — | — | — | 计划中 |
271
- | **Azure** | — | — | — | — | 计划中 |
272
- | **Google Cloud** | — | — | — | — | 计划中 |
297
+ | 云服务商 | 函数 | HTTP 入口 | 对象存储 | 数据库与数据表 | 状态后端 | 状态 |
298
+ | ---------------- | -------------------------- | ---------------------- | -------- | ------------------------------------------------------------- | -------- | ------ |
299
+ | **阿里云** | ✅ FC3 | ✅ API 网关 | ✅ OSS | ✅ RDS MySQL Serverless、TableStore、Elasticsearch Serverless | ✅ OSS | 稳定 |
300
+ | **腾讯云** | ✅ SCF | ✅ 函数 URL 触发器 | ✅ COS | ✅ TDSQL-C、Elasticsearch Serverless | ✅ COS | 稳定 |
301
+ | **火山引擎** | ✅ veFaaS | ✅ API 网关 | ✅ TOS | — | ✅ TOS | 稳定 |
302
+ | **华为云** | ⚠️ 仅生成 Terraform 模板 | — | — | — | — | 预览 |
303
+ | **AWS** | — | — | — | — | — | 计划中 |
304
+ | **Azure** | — | — | — | — | — | 计划中 |
305
+ | **Google Cloud** | — | — | — | — | — | 计划中 |
273
306
 
274
307
  说明:
275
308
 
276
309
  - 华为云配置可被解析并生成 Terraform HCL 模板,但部署能力尚未实现。
277
310
  - 腾讯云没有独立的 API 网关资源,HTTP 入口由函数 URL 触发器提供。
278
311
  - 火山引擎暂不支持 Serverless 数据库与数据表。
312
+ - Bucket Store 状态后端原生支持 OSS / COS / TOS;其他厂商暂不支持并被明确拒绝。
279
313
  - 资源级细节见[完整支持矩阵](https://serverlessinsight.com/reference.html)。
280
314
 
281
315
  ## 文档
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geek-fun/serverlessinsight",
3
- "version": "0.9.6",
3
+ "version": "0.9.8",
4
4
  "description": "Full-lifecycle serverless IaC for Alibaba Cloud, Tencent Cloud and Volcengine — one YAML to define, deploy and operate functions, API gateways, storage and databases.",
5
5
  "homepage": "https://serverlessinsight.com",
6
6
  "main": "dist/src/index.js",
@@ -84,6 +84,7 @@
84
84
  "pino-pretty": "^13.1.3",
85
85
  "tablestore": "^5.6.5",
86
86
  "tencentcloud-sdk-nodejs-cam": "^4.1.291",
87
+ "tencentcloud-sdk-nodejs-cdn": "^4.1.307",
87
88
  "tencentcloud-sdk-nodejs-cls": "^4.1.302",
88
89
  "tencentcloud-sdk-nodejs-cynosdb": "^4.1.302",
89
90
  "tencentcloud-sdk-nodejs-dnspod": "^4.1.266",
@@ -80,10 +80,12 @@ const deploy = async (options) => {
80
80
  (0, common_1.setIac)(iac);
81
81
  // D-4: deploy mutates state — a migrated (managedBy=saas) legacy state must
82
82
  // fail closed here and route the user to the Console backend.
83
- const backend = (0, stateBackend_1.createStateBackend)(iac.backend, {
83
+ const backend = await (0, stateBackend_1.createStateBackend)(iac.backend, {
84
84
  ...context,
85
85
  declaredOrg: iac.org,
86
86
  siApiKey: options.siApiKey,
87
+ org: options.org,
88
+ line: options.line,
87
89
  migrationMarker: 'refuse',
88
90
  });
89
91
  await backend.upgradeLegacyState?.({ bindUnknownRegion: options.bindUnknownRegion });
@@ -28,9 +28,11 @@ const destroyStack = async (options) => {
28
28
  }));
29
29
  // D-4: destroy mutates state — a migrated (managedBy=saas) legacy state must
30
30
  // fail closed here and route the user to the Console backend.
31
- const backend = (0, stateBackend_1.createStateBackend)(iac.backend, {
31
+ const backend = await (0, stateBackend_1.createStateBackend)(iac.backend, {
32
32
  ...context,
33
33
  declaredOrg: iac.org,
34
+ org: options.org,
35
+ line: options.line,
34
36
  migrationMarker: 'refuse',
35
37
  });
36
38
  await backend.upgradeLegacyState?.({ bindUnknownRegion: options.bindUnknownRegion });
@@ -43,11 +43,11 @@ const forceUnlockCommand = async (lockId, options = {}) => {
43
43
  const iac = (0, parser_1.revalYaml)(iacLocation, context);
44
44
  if (!iac.backend || iac.backend.type === types_1.StateBackendType.SAAS) {
45
45
  common_1.logger.info(lang_1.lang.__('SAAS_FORCE_UNLOCK_NOT_SUPPORTED', {
46
- consoleUrl: (0, credentialStore_1.getConsoleUrl)(),
46
+ consoleUrl: (0, credentialStore_1.bestEffortConsoleOrigin)(),
47
47
  }));
48
48
  return;
49
49
  }
50
- backend = (0, stateBackend_1.createStateBackend)(iac.backend, context);
50
+ backend = await (0, stateBackend_1.createStateBackend)(iac.backend, context);
51
51
  }
52
52
  else {
53
53
  const stateDir = node_path_1.default.join(process.cwd(), '.serverlessinsight');
@@ -93,8 +93,10 @@ program
93
93
  .command('login')
94
94
  .description(lang_1.lang.__('CMD_LOGIN_DESC'))
95
95
  .option('--si-api-key <key>', lang_1.lang.__('OPT_SI_API_KEY_EXISTING'))
96
- .action(actionWrapper('login', async ({ siApiKey }) => {
97
- await (0, login_1.login)({ siApiKey });
96
+ .option('--line <line>', lang_1.lang.__('OPT_LINE'))
97
+ .option('--org <slug>', lang_1.lang.__('OPT_ORG'))
98
+ .action(actionWrapper('login', async ({ siApiKey, line, org }) => {
99
+ await (0, login_1.login)({ siApiKey, line, org });
98
100
  }));
99
101
  program
100
102
  .command('logout')
@@ -122,8 +124,10 @@ program
122
124
  .option('-s, --stage <stage>', lang_1.lang.__('OPT_STAGE'))
123
125
  .option('-r, --region <region>', lang_1.lang.__('OPT_REGION'))
124
126
  .option('-v, --provider <provider>', lang_1.lang.__('OPT_PROVIDER'))
127
+ .option('--org <slug>', lang_1.lang.__('OPT_ORG'))
128
+ .option('--line <line>', lang_1.lang.__('OPT_LINE'))
125
129
  .option('--json', lang_1.lang.__('OPT_JSON'))
126
- .action(actionWrapper('show', async ({ file, stage, region, provider, json }) => {
130
+ .action(actionWrapper('show', async ({ file, stage, region, provider, org, line, json }) => {
127
131
  (0, jsonOutput_1.setJsonMode)(!!json);
128
132
  const iacLocation = (0, common_1.getIacLocation)(file);
129
133
  const rawIac = (0, parser_1.parseYaml)(iacLocation);
@@ -140,7 +144,7 @@ program
140
144
  const context = (0, common_1.getContext)();
141
145
  const iac = (0, parser_1.revalYaml)(iacLocation, context);
142
146
  (0, common_1.setIac)(iac);
143
- await (0, show_1.show)({ stage, location: file, iac, json: !!json });
147
+ await (0, show_1.show)({ stage, location: file, iac, json: !!json, org, line });
144
148
  }));
145
149
  program
146
150
  .command('validate')
@@ -173,6 +177,8 @@ program
173
177
  .option('--no-refresh', lang_1.lang.__('OPT_NO_REFRESH'))
174
178
  .option('--json', lang_1.lang.__('OPT_JSON'))
175
179
  .option('--no-color', lang_1.lang.__('OPT_NO_COLOR'))
180
+ .option('--org <slug>', lang_1.lang.__('OPT_ORG'))
181
+ .option('--line <line>', lang_1.lang.__('OPT_LINE'))
176
182
  .option('-p, --parameter <key=value>', lang_1.lang.__('OPT_PARAMETER'), (value, previous) => {
177
183
  const [key, val] = value.split('=');
178
184
  return { ...previous, [key]: val };
@@ -190,6 +196,8 @@ program
190
196
  .option('-x, --accessKeySecret <accessKeySecret>', lang_1.lang.__('OPT_ACCESS_KEY_SECRET'))
191
197
  .option('-n, --securityToken <securityToken>', lang_1.lang.__('OPT_SECURITY_TOKEN'))
192
198
  .option('--si-api-key <key>', lang_1.lang.__('OPT_SI_API_KEY'))
199
+ .option('--org <slug>', lang_1.lang.__('OPT_ORG'))
200
+ .option('--line <line>', lang_1.lang.__('OPT_LINE'))
193
201
  .option('-y, --auto-approve', lang_1.lang.__('OPT_AUTO_APPROVE'))
194
202
  .option('--no-refresh', lang_1.lang.__('OPT_NO_REFRESH'))
195
203
  .option('-p, --parameter <key=value>', lang_1.lang.__('OPT_PARAMETER'), (value, previous) => {
@@ -197,7 +205,7 @@ program
197
205
  previous[key] = val;
198
206
  return previous;
199
207
  }, {})
200
- .action(actionWrapper('deploy', async ({ stage, parameter, file, region, bindUnknownRegion, provider, accessKeyId, accessKeySecret, securityToken, siApiKey, autoApprove, refresh, }) => {
208
+ .action(actionWrapper('deploy', async ({ stage, parameter, file, region, bindUnknownRegion, provider, accessKeyId, accessKeySecret, securityToken, siApiKey, org, line, autoApprove, refresh, }) => {
201
209
  await (0, deploy_1.deploy)({
202
210
  stage,
203
211
  parameters: parameter,
@@ -209,6 +217,8 @@ program
209
217
  accessKeySecret,
210
218
  securityToken,
211
219
  siApiKey,
220
+ org,
221
+ line,
212
222
  autoApprove,
213
223
  refresh,
214
224
  });
@@ -224,13 +234,15 @@ program
224
234
  .option('-x, --accessKeySecret <accessKeySecret>', lang_1.lang.__('OPT_ACCESS_KEY_SECRET'))
225
235
  .option('-n, --securityToken <securityToken>', lang_1.lang.__('OPT_SECURITY_TOKEN'))
226
236
  .option('--si-api-key <key>', lang_1.lang.__('OPT_SI_API_KEY'))
237
+ .option('--org <slug>', lang_1.lang.__('OPT_ORG'))
238
+ .option('--line <line>', lang_1.lang.__('OPT_LINE'))
227
239
  .option('-y, --auto-approve', lang_1.lang.__('OPT_AUTO_APPROVE'))
228
240
  .option('--force', lang_1.lang.__('OPT_FORCE'))
229
241
  .option('--no-marker', lang_1.lang.__('OPT_NO_MARKER'))
230
242
  .option('--dry-run', lang_1.lang.__('OPT_DRY_RUN'))
231
243
  .option('--rollback', lang_1.lang.__('OPT_ROLLBACK'))
232
244
  .option('--bind-unknown-region <region>', lang_1.lang.__('OPT_BIND_UNKNOWN_REGION'))
233
- .action(actionWrapper('migrate', async ({ stage, file, region, provider, accessKeyId, accessKeySecret, securityToken, siApiKey, autoApprove, force, marker, dryRun, rollback, bindUnknownRegion, }) => {
245
+ .action(actionWrapper('migrate', async ({ stage, file, region, provider, accessKeyId, accessKeySecret, securityToken, siApiKey, org, line, autoApprove, force, marker, dryRun, rollback, bindUnknownRegion, }) => {
234
246
  await (0, migrate_1.migrate)({
235
247
  stage,
236
248
  location: file,
@@ -240,6 +252,8 @@ program
240
252
  accessKeySecret,
241
253
  securityToken,
242
254
  siApiKey,
255
+ org,
256
+ line,
243
257
  autoApprove,
244
258
  force,
245
259
  // Commander models `--no-marker` as the negation of an implicit
@@ -260,8 +274,10 @@ program
260
274
  .option('-k, --accessKeyId <accessKeyId>', lang_1.lang.__('OPT_ACCESS_KEY_ID'))
261
275
  .option('-x, --accessKeySecret <accessKeySecret>', lang_1.lang.__('OPT_ACCESS_KEY_SECRET'))
262
276
  .option('-n, --securityToken <securityToken>', lang_1.lang.__('OPT_SECURITY_TOKEN'))
277
+ .option('--org <slug>', lang_1.lang.__('OPT_ORG'))
278
+ .option('--line <line>', lang_1.lang.__('OPT_LINE'))
263
279
  .description(lang_1.lang.__('CMD_DESTROY_DESC'))
264
- .action(actionWrapper('destroy', async ({ file, stage, region, bindUnknownRegion, provider, accessKeyId, accessKeySecret, securityToken, }) => {
280
+ .action(actionWrapper('destroy', async ({ file, stage, region, bindUnknownRegion, provider, accessKeyId, accessKeySecret, securityToken, org, line, }) => {
265
281
  await (0, destroy_1.destroyStack)({
266
282
  location: file,
267
283
  stage,
@@ -271,6 +287,8 @@ program
271
287
  accessKeyId,
272
288
  accessKeySecret,
273
289
  securityToken,
290
+ org,
291
+ line,
274
292
  });
275
293
  }));
276
294
  program
@@ -282,7 +300,8 @@ program
282
300
  .option('-v, --provider <provider>', lang_1.lang.__('OPT_PROVIDER'))
283
301
  .option('-d, --debug', lang_1.lang.__('OPT_DEBUG'))
284
302
  .option('-w, --watch', lang_1.lang.__('OPT_WATCH'), true)
285
- .action(actionWrapper('local', async ({ stage, debug, watch, file, provider, region }) => {
303
+ .option('--strict-prefix', lang_1.lang.__('OPT_STRICT_PREFIX'))
304
+ .action(actionWrapper('local', async ({ stage, debug, watch, file, provider, region, strictPrefix }) => {
286
305
  await (0, local_1.runLocal)({
287
306
  stage,
288
307
  debug: !!debug,
@@ -290,6 +309,7 @@ program
290
309
  location: file,
291
310
  provider,
292
311
  region,
312
+ strictPrefix: !!strictPrefix,
293
313
  });
294
314
  }));
295
315
  program
@@ -6,7 +6,7 @@ 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, provider, region } = opts;
9
+ const { stage, debug, watch, location, provider, region, strictPrefix } = opts;
10
10
  const iacLocation = (0, common_1.getIacLocation)(location);
11
11
  const rawIac = (0, parser_1.parseYaml)(iacLocation);
12
12
  await (0, common_1.setContext)({
@@ -31,7 +31,8 @@ const runLocal = async (opts) => {
31
31
  stage,
32
32
  debug: String(debug),
33
33
  watch: String(watch),
34
+ strictPrefix: String(!!strictPrefix),
34
35
  }));
35
- await (0, localStack_1.startLocalStack)(iac);
36
+ await (0, localStack_1.startLocalStack)(iac, { strictPrefix: !!strictPrefix, stage });
36
37
  };
37
38
  exports.runLocal = runLocal;