@geek-fun/serverlessinsight 0.8.4 → 0.8.5
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-deploy-app-insight-poc-deploy.json.backup +8 -8
- package/.serverlessinsight/state-insight-poc-destroy-app-insight-poc-destroy.json.backup +1 -1
- package/.serverlessinsight/state-insight-volc-app-insight-volc.json.backup +4 -4
- package/CHANGELOG.md +55 -0
- package/README.md +1 -1
- package/dist/package.json +24 -24
- package/dist/src/common/aliyunClient/fc3Operations.js +7 -0
- package/dist/src/common/aliyunClient/slsOperations.js +1 -1
- package/dist/src/common/index.js +2 -0
- package/dist/src/common/nameBuilder.js +80 -0
- package/dist/src/common/providerNames.js +54 -0
- package/dist/src/common/runtimeMapper.js +25 -4
- package/dist/src/lang/en.js +6 -0
- package/dist/src/lang/zh-CN.js +6 -0
- package/dist/src/parser/index.js +2 -1
- package/dist/src/stack/aliyunStack/apigwTypes.js +14 -20
- package/dist/src/stack/volcengineStack/apigwTypes.js +1 -7
- package/dist/src/validator/bucketSchema.js +3 -5
- package/dist/src/validator/eventSchema.js +7 -4
- package/dist/src/validator/functionSchema.js +3 -2
- package/dist/src/validator/iacSchema.js +11 -4
- package/dist/src/validator/rootSchema.js +27 -0
- package/dist/src/validator/semanticValidation.js +122 -0
- package/dist/src/validator/tableschema.js +2 -0
- package/dist/src/validator/templateRefSchema.js +23 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +24 -24
- package/samples/aliyun-poc-fc-gpu.yml +2 -2
- package/samples/aliyun-poc-table.yml +1 -1
- package/samples/volcengine-poc-advanced.yml +4 -8
- package/samples/volcengine-poc-api.yml +1 -1
- package/samples/volcengine-poc-function.yml +1 -1
- package/samples/volcengine-poc-vpc.yml +3 -7
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"id": "iam-test-app-dev-sls"
|
|
23
23
|
}
|
|
24
24
|
],
|
|
25
|
-
"lastUpdated": "2026-08-
|
|
25
|
+
"lastUpdated": "2026-08-28T02:48:38.277Z"
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
"resources": {},
|
|
31
|
-
"lineage": "
|
|
31
|
+
"lineage": "17bbe89a-e7af-441e-9829-f92dbace0ef9",
|
|
32
32
|
"serial": 3
|
|
33
33
|
}
|
|
@@ -91,14 +91,14 @@
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
],
|
|
94
|
-
"lastUpdated": "2026-08-
|
|
94
|
+
"lastUpdated": "2026-08-28T02:49:20.881Z",
|
|
95
95
|
"status": "ready"
|
|
96
96
|
},
|
|
97
97
|
"events.gateway_event": {
|
|
98
98
|
"mode": "managed",
|
|
99
99
|
"region": "cn-hangzhou",
|
|
100
100
|
"definition": {
|
|
101
|
-
"groupName": "insight-poc-deploy-dev-agw-group",
|
|
101
|
+
"groupName": "insight-poc-deploy-dev-gateway-event-agw-group",
|
|
102
102
|
"description": "API Gateway group for insight-poc-deploy",
|
|
103
103
|
"basePath": null,
|
|
104
104
|
"triggers": [
|
|
@@ -166,7 +166,7 @@
|
|
|
166
166
|
"stageName": "RELEASE"
|
|
167
167
|
}
|
|
168
168
|
],
|
|
169
|
-
"lastUpdated": "2026-08-
|
|
169
|
+
"lastUpdated": "2026-08-28T02:49:20.884Z"
|
|
170
170
|
}
|
|
171
171
|
},
|
|
172
172
|
"shared": {
|
|
@@ -185,7 +185,7 @@
|
|
|
185
185
|
"id": "insight-poc-deploy-app-dev-sls"
|
|
186
186
|
}
|
|
187
187
|
],
|
|
188
|
-
"lastUpdated": "2026-08-
|
|
188
|
+
"lastUpdated": "2026-08-28T02:49:15.880Z"
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
}
|
|
@@ -276,14 +276,14 @@
|
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
],
|
|
279
|
-
"lastUpdated": "2026-08-
|
|
279
|
+
"lastUpdated": "2026-08-28T02:49:20.881Z",
|
|
280
280
|
"status": "ready"
|
|
281
281
|
},
|
|
282
282
|
"events.gateway_event": {
|
|
283
283
|
"mode": "managed",
|
|
284
284
|
"region": "cn-hangzhou",
|
|
285
285
|
"definition": {
|
|
286
|
-
"groupName": "insight-poc-deploy-dev-agw-group",
|
|
286
|
+
"groupName": "insight-poc-deploy-dev-gateway-event-agw-group",
|
|
287
287
|
"description": "API Gateway group for insight-poc-deploy",
|
|
288
288
|
"basePath": null,
|
|
289
289
|
"triggers": [
|
|
@@ -351,9 +351,9 @@
|
|
|
351
351
|
"stageName": "RELEASE"
|
|
352
352
|
}
|
|
353
353
|
],
|
|
354
|
-
"lastUpdated": "2026-08-
|
|
354
|
+
"lastUpdated": "2026-08-28T02:49:20.884Z"
|
|
355
355
|
}
|
|
356
356
|
},
|
|
357
|
-
"lineage": "
|
|
357
|
+
"lineage": "5046b4f9-b550-4933-850f-99eb5411cb42",
|
|
358
358
|
"serial": 2
|
|
359
359
|
}
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
}
|
|
64
64
|
],
|
|
65
65
|
"status": "ready",
|
|
66
|
-
"lastUpdated": "2026-08-
|
|
66
|
+
"lastUpdated": "2026-08-28T02:48:53.503Z"
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
69
|
"shared": {
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"projectId": "proj-123"
|
|
84
84
|
}
|
|
85
85
|
],
|
|
86
|
-
"lastUpdated": "2026-08-
|
|
86
|
+
"lastUpdated": "2026-08-28T02:48:50.502Z"
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
}
|
|
@@ -146,9 +146,9 @@
|
|
|
146
146
|
}
|
|
147
147
|
],
|
|
148
148
|
"status": "ready",
|
|
149
|
-
"lastUpdated": "2026-08-
|
|
149
|
+
"lastUpdated": "2026-08-28T02:48:53.503Z"
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
|
-
"lineage": "
|
|
152
|
+
"lineage": "a61f5dda-66ef-405f-b377-da268afe24a4",
|
|
153
153
|
"serial": 1
|
|
154
154
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,61 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### ⚠️ Breaking change
|
|
11
|
+
|
|
12
|
+
- **Generated API Gateway resource names are now collision-safe.** Aliyun apiNames
|
|
13
|
+
(`agw_api` events), Volcengine route names, and Aliyun group names are produced by a
|
|
14
|
+
deterministic constrained-name builder ([#221](https://github.com/geek-fun/serverlessinsight/issues/221),
|
|
15
|
+
[#222](https://github.com/geek-fun/serverlessinsight/issues/222)): when a composed name exceeds the provider
|
|
16
|
+
limit, the leading human-readable segments are truncated while the method/path
|
|
17
|
+
discriminator is preserved, and a deterministic hash suffix guarantees distinctness.
|
|
18
|
+
- Configurations whose previous names already fit their provider limit keep the
|
|
19
|
+
exact same generated names.
|
|
20
|
+
- Deployments affected by the historical truncation will regenerate names. Existing
|
|
21
|
+
cloud APIs/routes created under old truncated names are no longer matched by
|
|
22
|
+
`expectedApiNames` during updates: they become orphaned instead of adopted, so
|
|
23
|
+
plans may show create operations for new names. Manually delete superseded
|
|
24
|
+
gateway resources after upgrading.
|
|
25
|
+
- **Aliyun API Gateway groups are now per-event.** The group name includes the event
|
|
26
|
+
key (`<service>-<stage>-<eventKey>-agw-group`), so multiple `API_GATEWAY` events
|
|
27
|
+
under one service+stage each own their group instead of fighting over one shared
|
|
28
|
+
group's ownership tag. Groups created before this change are orphaned on the next
|
|
29
|
+
plan (same regeneration story as above); delete them manually after upgrading.
|
|
30
|
+
- **Volcengine `python3.8/v1` runtime removed.** Volcengine has retired Python 3.8
|
|
31
|
+
for veFaaS (product notice). The two newer native runtime ids from
|
|
32
|
+
Volcengine-maintained tooling were added: `native-python3.12/v1`,
|
|
33
|
+
`native-node20/v1`.
|
|
34
|
+
|
|
35
|
+
### Added
|
|
36
|
+
|
|
37
|
+
- Huawei Cloud FunctionGraph is now first-class in runtime compatibility checks:
|
|
38
|
+
standard runtime ids map to the officially supported FunctionGraph runtimes
|
|
39
|
+
(Node.js 10–20, Python 3.6/3.9/3.10/3.12, Java 8/11/17/21, Go 1.x, .NET Core 3.1),
|
|
40
|
+
so literal `runtime` values validate for provider `huawei` instead of always
|
|
41
|
+
failing.
|
|
42
|
+
- Pre-deploy semantic validation runs alongside schema validation and reports, in a
|
|
43
|
+
single aggregated error set: duplicate `method+path` triggers per event,
|
|
44
|
+
duplicate generated apiName/routeName within the deploy scope, dangling
|
|
45
|
+
`${functions.x}` trigger backends, plus provider-conditional function-name length
|
|
46
|
+
limits (Aliyun ≤ 64, Tencent ≤ 60) enforced through JSON Schema `if/then`, and
|
|
47
|
+
literal-format rules for trigger paths (`^/…`), bucket names and domain hostnames.
|
|
48
|
+
Template references (`${vars.x}`, …) bypass literal format rules by design.
|
|
49
|
+
- Samples-as-canaries: a unit test validates every `samples/*.yml` through the full
|
|
50
|
+
schema + semantic validation, so sample drift fails CI instead of users.
|
|
51
|
+
- Fixed trigger definitions being silently unvalidated inside `events.*.triggers`
|
|
52
|
+
items (the subschema lacked its object envelope), which also hid HTTP-method enums.
|
|
53
|
+
|
|
54
|
+
### Fixed
|
|
55
|
+
|
|
56
|
+
- Table schema now accepts `network.vpc_id` (the resource layer always passed it
|
|
57
|
+
through) and rejects unknown keys inside `network` via `additionalProperties`.
|
|
58
|
+
- Schema error formatter no longer prints an empty `Allowed values:` line when the
|
|
59
|
+
violating rule has no allowed values.
|
|
60
|
+
- Localized the BUCKET_STORE backend error message to the i18n system
|
|
61
|
+
([#222](https://github.com/geek-fun/serverlessinsight/issues/222)).
|
|
62
|
+
|
|
8
63
|
## [0.7.2] - 2026-06-26
|
|
9
64
|
|
|
10
65
|
### Fixed
|
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
<img src="https://img.shields.io/badge/AWS-232F3E&logo=amazonwebservices&logoColor=white"/>
|
|
24
24
|
</p>
|
|
25
25
|
|
|
26
|
-
[npm
|
|
26
|
+
[npm](https://www.npmjs.com/package/@geek-fun/serverlessinsight) · [Docs](https://serverlessinsight.geekfun.club) · [Website](https://serverlessinsight.geekfun.club) · [GitHub](https://github.com/geek-fun/serverlessinsight)
|
|
27
27
|
|
|
28
28
|
English · [简体中文](README.zh-CN.md)
|
|
29
29
|
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geek-fun/serverlessinsight",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.5",
|
|
4
4
|
"description": "Full life cycle cross providers serverless application management for your fast-growing business.",
|
|
5
5
|
"homepage": "https://serverlessinsight.com",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -53,62 +53,62 @@
|
|
|
53
53
|
"function"
|
|
54
54
|
],
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@alicloud/alidns20150109": "^4.
|
|
57
|
-
"@alicloud/cas20200407": "^3.2.
|
|
56
|
+
"@alicloud/alidns20150109": "^4.6.0",
|
|
57
|
+
"@alicloud/cas20200407": "^3.2.13",
|
|
58
58
|
"@alicloud/cdn20180510": "^9.2.0",
|
|
59
59
|
"@alicloud/cloudapi20160714": "^4.8.0",
|
|
60
|
-
"@alicloud/ecs20140526": "^7.
|
|
60
|
+
"@alicloud/ecs20140526": "^7.10.0",
|
|
61
61
|
"@alicloud/es-serverless20230627": "^2.3.1",
|
|
62
|
-
"@alicloud/fc20230330": "^4.
|
|
62
|
+
"@alicloud/fc20230330": "^4.8.2",
|
|
63
63
|
"@alicloud/ims20190815": "^2.4.1",
|
|
64
|
-
"@alicloud/nas20170626": "^3.
|
|
64
|
+
"@alicloud/nas20170626": "^3.7.0",
|
|
65
65
|
"@alicloud/openapi-client": "^0.4.15",
|
|
66
|
-
"@alicloud/ram20150501": "^1.
|
|
66
|
+
"@alicloud/ram20150501": "^1.3.0",
|
|
67
67
|
"@alicloud/rds20140815": "^15.9.0",
|
|
68
|
-
"@alicloud/sls20201230": "^5.
|
|
68
|
+
"@alicloud/sls20201230": "^5.11.0",
|
|
69
69
|
"@volcengine/openapi": "^1.36.2",
|
|
70
70
|
"@volcengine/tos-sdk": "^2.9.1",
|
|
71
71
|
"ajv": "^8.20.0",
|
|
72
72
|
"ali-oss": "^6.23.0",
|
|
73
73
|
"commander": "^15.0.0",
|
|
74
|
-
"cos-nodejs-sdk-v5": "^
|
|
74
|
+
"cos-nodejs-sdk-v5": "^3.0.0",
|
|
75
75
|
"i18n": "^0.15.3",
|
|
76
76
|
"iconv-lite": "^0.7.3",
|
|
77
77
|
"jszip": "^3.10.1",
|
|
78
78
|
"lodash": "^4.18.1",
|
|
79
|
-
"open": "^
|
|
79
|
+
"open": "^11.0.1",
|
|
80
80
|
"pino": "^10.3.1",
|
|
81
81
|
"pino-pretty": "^13.1.3",
|
|
82
82
|
"tablestore": "^5.6.5",
|
|
83
|
-
"tencentcloud-sdk-nodejs-cam": "^4.1.
|
|
83
|
+
"tencentcloud-sdk-nodejs-cam": "^4.1.291",
|
|
84
84
|
"tencentcloud-sdk-nodejs-cls": "^4.1.302",
|
|
85
|
-
"tencentcloud-sdk-nodejs-cynosdb": "^4.1.
|
|
86
|
-
"tencentcloud-sdk-nodejs-dnspod": "^4.1.
|
|
87
|
-
"tencentcloud-sdk-nodejs-es": "^4.1.
|
|
85
|
+
"tencentcloud-sdk-nodejs-cynosdb": "^4.1.302",
|
|
86
|
+
"tencentcloud-sdk-nodejs-dnspod": "^4.1.266",
|
|
87
|
+
"tencentcloud-sdk-nodejs-es": "^4.1.302",
|
|
88
88
|
"tencentcloud-sdk-nodejs-scf": "^4.1.168",
|
|
89
|
-
"tencentcloud-sdk-nodejs-ssl": "^4.1.
|
|
89
|
+
"tencentcloud-sdk-nodejs-ssl": "^4.1.281",
|
|
90
90
|
"tencentcloud-sdk-nodejs-tag": "^4.1.244",
|
|
91
91
|
"yaml": "^2.9.0"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
|
-
"@eslint/eslintrc": "^3.3.
|
|
94
|
+
"@eslint/eslintrc": "^3.3.6",
|
|
95
95
|
"@eslint/js": "^10.0.1",
|
|
96
96
|
"@types/ali-oss": "^6.23.3",
|
|
97
97
|
"@types/i18n": "^0.13.12",
|
|
98
98
|
"@types/jest": "^30.0.0",
|
|
99
|
-
"@types/lodash": "^4.17.
|
|
100
|
-
"@types/node": "^26.
|
|
101
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
102
|
-
"@typescript-eslint/parser": "^8.
|
|
99
|
+
"@types/lodash": "^4.17.25",
|
|
100
|
+
"@types/node": "^26.4.0",
|
|
101
|
+
"@typescript-eslint/eslint-plugin": "^8.68.0",
|
|
102
|
+
"@typescript-eslint/parser": "^8.68.0",
|
|
103
103
|
"cross-env": "^10.1.0",
|
|
104
|
-
"eslint": "^10.
|
|
104
|
+
"eslint": "^10.9.1",
|
|
105
105
|
"eslint-config-prettier": "^10.1.8",
|
|
106
106
|
"eslint-plugin-prettier": "^5.5.6",
|
|
107
|
-
"globals": "^17.
|
|
107
|
+
"globals": "^17.11.0",
|
|
108
108
|
"husky": "^9.1.7",
|
|
109
109
|
"jest": "^30.4.2",
|
|
110
|
-
"prettier": "^3.9.
|
|
111
|
-
"ts-jest": "^29.4.
|
|
110
|
+
"prettier": "^3.9.6",
|
|
111
|
+
"ts-jest": "^29.4.12",
|
|
112
112
|
"ts-node": "^10.9.2",
|
|
113
113
|
"typescript": "^6.0.3"
|
|
114
114
|
},
|
|
@@ -63,6 +63,13 @@ const buildCodeLocation = (codePath, ossCode) => {
|
|
|
63
63
|
if (info?.state === 'Failed') {
|
|
64
64
|
throw new Error(`FC3 function ${functionName} is in Failed state (reason: ${info.stateReason ?? 'unknown'})`);
|
|
65
65
|
}
|
|
66
|
+
// Built-in runtimes (zip code) never reach Active (issue #219):
|
|
67
|
+
// they hold Pending while a create/update transition is in flight
|
|
68
|
+
// and report null once stable. Only custom-container functions
|
|
69
|
+
// transition Pending → Active.
|
|
70
|
+
if (info && !info.customContainerConfig) {
|
|
71
|
+
return info.state !== 'Pending';
|
|
72
|
+
}
|
|
66
73
|
return info?.state === 'Active';
|
|
67
74
|
},
|
|
68
75
|
intervalMs: constants_1.SCF_STATUS_POLL_INTERVAL_MS,
|
|
@@ -112,7 +112,7 @@ const createSlsOperations = (slsClient) => {
|
|
|
112
112
|
},
|
|
113
113
|
getProject: async (projectName) => {
|
|
114
114
|
try {
|
|
115
|
-
const response = await slsClient.getProject(projectName);
|
|
115
|
+
const response = await slsClient.getProject(projectName, new sls.GetProjectRequest({}));
|
|
116
116
|
if (!response || !response.body) {
|
|
117
117
|
return null;
|
|
118
118
|
}
|
package/dist/src/common/index.js
CHANGED
|
@@ -36,3 +36,5 @@ __exportStar(require("./planFormatter"), exports);
|
|
|
36
36
|
__exportStar(require("./credentialStore"), exports);
|
|
37
37
|
__exportStar(require("./apiClient"), exports);
|
|
38
38
|
__exportStar(require("./triggerMapper"), exports);
|
|
39
|
+
__exportStar(require("./nameBuilder"), exports);
|
|
40
|
+
__exportStar(require("./providerNames"), exports);
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Deterministic constrained-name builder.
|
|
4
|
+
*
|
|
5
|
+
* Contract (see GitHub issue #222):
|
|
6
|
+
* - Identifiers are derived from user config and must respect a provider
|
|
7
|
+
* maximum length. Silent truncation used to discard the distinguishing
|
|
8
|
+
* discriminator (issue #221: RepeatedApiName collisions).
|
|
9
|
+
* - When the composed name fits the maximum length, it is returned verbatim
|
|
10
|
+
* (minus charset sanitisation) so existing well-fitting configurations keep
|
|
11
|
+
* their deployed names and do not churn.
|
|
12
|
+
* - When it does not fit, the human-readable prefix is truncated FIRST while
|
|
13
|
+
* the discriminator (later parts) is preserved whenever possible, and a
|
|
14
|
+
* deterministic hash of the raw parts is always appended so distinct inputs
|
|
15
|
+
* never collapse to the same name. Theoretical digest collisions within a
|
|
16
|
+
* deploy set are additionally rejected up-front by semantic validation.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.CONSTRAINT_NAME_LIMITS = exports.buildConstrainedName = exports.stableHash = exports.DEFAULT_HASH_LENGTH = void 0;
|
|
20
|
+
const FNV_OFFSET_BASIS = 0x811c9dc5;
|
|
21
|
+
const FNV_PRIME = 0x01000193;
|
|
22
|
+
const SANITISERS = {
|
|
23
|
+
// Aliyun identifiers (CreateApi apiName: [A-Za-z0-9_], hyphens forbidden)
|
|
24
|
+
underscore: { invalidChars: /[^A-Za-z0-9_]/g, separator: '_' },
|
|
25
|
+
// Volcengine identifiers (letters/digits/hyphens, underscores folded to hyphens)
|
|
26
|
+
hyphen: { invalidChars: /[^A-Za-z0-9-]/g, separator: '-' },
|
|
27
|
+
};
|
|
28
|
+
exports.DEFAULT_HASH_LENGTH = 7;
|
|
29
|
+
const toUtf8Bytes = (input) => Array.from(Buffer.from(input, 'utf8'));
|
|
30
|
+
/** Deterministic 32-bit FNV-1a rendered as fixed-width base36. */
|
|
31
|
+
const stableHash = (raw, length = exports.DEFAULT_HASH_LENGTH) => toUtf8Bytes(raw)
|
|
32
|
+
.reduce((hash, byte) => ((hash ^ byte) * FNV_PRIME) >>> 0, FNV_OFFSET_BASIS)
|
|
33
|
+
.toString(36)
|
|
34
|
+
.padStart(length, '0')
|
|
35
|
+
.slice(0, length);
|
|
36
|
+
exports.stableHash = stableHash;
|
|
37
|
+
const sanitizePart = (part, mode) => part.replace(SANITISERS[mode].invalidChars, SANITISERS[mode].separator);
|
|
38
|
+
/**
|
|
39
|
+
* Build a provider-constrained identifier from ordered user-derived segments,
|
|
40
|
+
* joined by the charset separator. Over-long compositions truncate the leading
|
|
41
|
+
* (human-readable) segments first and append a hash of the raw segments so
|
|
42
|
+
* distinct inputs never collapse into one name.
|
|
43
|
+
*/
|
|
44
|
+
const buildConstrainedName = ({ parts, maxLength, charset, }) => {
|
|
45
|
+
const { separator } = SANITISERS[charset];
|
|
46
|
+
const joinSegments = (segments) => segments
|
|
47
|
+
.map((part) => sanitizePart(part, charset))
|
|
48
|
+
.filter((part) => part.length > 0)
|
|
49
|
+
.join(separator);
|
|
50
|
+
const readable = joinSegments(parts);
|
|
51
|
+
if (readable.length <= maxLength) {
|
|
52
|
+
return readable;
|
|
53
|
+
}
|
|
54
|
+
const hashLength = Math.max(1, Math.min(exports.DEFAULT_HASH_LENGTH, maxLength - 1));
|
|
55
|
+
// Hash over the RAW segments so inputs sanitising identically stay distinct.
|
|
56
|
+
const hash = (0, exports.stableHash)(parts.join('\u0000'), hashLength);
|
|
57
|
+
const clampPrefix = (cap) => {
|
|
58
|
+
const prefix = joinSegments(parts.slice(0, -1)).slice(0, Math.max(cap, 0));
|
|
59
|
+
return prefix.replace(new RegExp(`\\${separator}+$`), '');
|
|
60
|
+
};
|
|
61
|
+
const separatorAllowance = separator.length * 2;
|
|
62
|
+
const discriminatorRoom = maxLength - hashLength - separatorAllowance;
|
|
63
|
+
const discriminatorSanitized = sanitizePart(parts[parts.length - 1], charset);
|
|
64
|
+
if (parts.length > 1 && discriminatorSanitized.length <= discriminatorRoom) {
|
|
65
|
+
const headSegments = [
|
|
66
|
+
clampPrefix(discriminatorRoom - discriminatorSanitized.length),
|
|
67
|
+
discriminatorSanitized,
|
|
68
|
+
].filter((segment) => segment.length > 0);
|
|
69
|
+
return `${headSegments.join(separator)}${separator}${hash}`;
|
|
70
|
+
}
|
|
71
|
+
const headOnly = clampPrefix(maxLength - hashLength - separator.length);
|
|
72
|
+
return [headOnly, hash].filter((segment) => segment.length > 0).join(separator);
|
|
73
|
+
};
|
|
74
|
+
exports.buildConstrainedName = buildConstrainedName;
|
|
75
|
+
/** Per-provider maximum lengths for names generated through this module. */
|
|
76
|
+
exports.CONSTRAINT_NAME_LIMITS = {
|
|
77
|
+
ALIYUN_CREATE_API_NAME: 50,
|
|
78
|
+
ALIYUN_API_GROUP_NAME: 50,
|
|
79
|
+
VOLCENGINE_ROUTE_NAME: 63,
|
|
80
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildVolcengineRouteName = exports.buildAliyunApigwApiName = exports.generateApiKey = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Leaf module for generated provider resource names.
|
|
6
|
+
*
|
|
7
|
+
* Lives in src/common (not in the stack modules) so that both the deployment
|
|
8
|
+
* stacks and the pre-deploy semantic validator share ONE source of truth for
|
|
9
|
+
* generated names without introducing import cycles. See issue #222.
|
|
10
|
+
*/
|
|
11
|
+
const nameBuilder_1 = require("./nameBuilder");
|
|
12
|
+
/**
|
|
13
|
+
* Generate a unique API key from an HTTP method and path.
|
|
14
|
+
* Uses URL encoding to preserve path structure and avoid collisions.
|
|
15
|
+
*/
|
|
16
|
+
const generateApiKey = (method, path) => {
|
|
17
|
+
// Replace slashes with double underscores to preserve path structure
|
|
18
|
+
// Replace other non-alphanumeric chars with single underscore
|
|
19
|
+
const sanitizedPath = path
|
|
20
|
+
.replace(/\//g, '__')
|
|
21
|
+
.replace(/[^a-zA-Z0-9_]/g, '_')
|
|
22
|
+
.replace(/^__/, '') // Remove leading double underscore
|
|
23
|
+
.replace(/__$/, ''); // Remove trailing double underscore
|
|
24
|
+
return `${method}_${sanitizedPath}`;
|
|
25
|
+
};
|
|
26
|
+
exports.generateApiKey = generateApiKey;
|
|
27
|
+
/**
|
|
28
|
+
* Aliyun API Gateway apiName. Aliyun CreateApi requires 4-50 chars of
|
|
29
|
+
* [A-Za-z0-9_] — no hyphens.
|
|
30
|
+
*
|
|
31
|
+
* Resolves issue #221: long event names no longer truncate the trailing
|
|
32
|
+
* method/path discriminator out of existence.
|
|
33
|
+
*/
|
|
34
|
+
const buildAliyunApigwApiName = (eventName, stage, apiKey) => (0, nameBuilder_1.buildConstrainedName)({
|
|
35
|
+
parts: [eventName, stage, 'agw_api', apiKey],
|
|
36
|
+
maxLength: nameBuilder_1.CONSTRAINT_NAME_LIMITS.ALIYUN_CREATE_API_NAME,
|
|
37
|
+
charset: 'underscore',
|
|
38
|
+
});
|
|
39
|
+
exports.buildAliyunApigwApiName = buildAliyunApigwApiName;
|
|
40
|
+
/**
|
|
41
|
+
* Volcengine API Gateway route name (max 63 chars, letters/digits/hyphens).
|
|
42
|
+
*/
|
|
43
|
+
const buildVolcengineRouteName = (eventName, method, path) => {
|
|
44
|
+
const sanitizedPath = path
|
|
45
|
+
.replace(/\//g, '_')
|
|
46
|
+
.replace(/[^a-zA-Z0-9_]/g, '_')
|
|
47
|
+
.replace(/^_+|_+$/g, '');
|
|
48
|
+
return (0, nameBuilder_1.buildConstrainedName)({
|
|
49
|
+
parts: [eventName, `${method}_${sanitizedPath}`],
|
|
50
|
+
maxLength: nameBuilder_1.CONSTRAINT_NAME_LIMITS.VOLCENGINE_ROUTE_NAME,
|
|
51
|
+
charset: 'hyphen',
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
exports.buildVolcengineRouteName = buildVolcengineRouteName;
|
|
@@ -42,26 +42,32 @@ const runtimeMappings = {
|
|
|
42
42
|
[StandardRuntime.NODEJS20]: {
|
|
43
43
|
[providerEnum_1.ProviderEnum.ALIYUN]: 'nodejs20',
|
|
44
44
|
[providerEnum_1.ProviderEnum.AWS]: 'nodejs20.x',
|
|
45
|
+
[providerEnum_1.ProviderEnum.HUAWEI]: 'nodejs20.15',
|
|
45
46
|
},
|
|
46
47
|
[StandardRuntime.NODEJS18]: {
|
|
47
48
|
[providerEnum_1.ProviderEnum.ALIYUN]: 'nodejs18',
|
|
48
49
|
[providerEnum_1.ProviderEnum.TENCENT]: 'Nodejs18.15',
|
|
50
|
+
[providerEnum_1.ProviderEnum.HUAWEI]: 'nodejs18.15',
|
|
49
51
|
},
|
|
50
52
|
[StandardRuntime.NODEJS16]: {
|
|
51
53
|
[providerEnum_1.ProviderEnum.ALIYUN]: 'nodejs16',
|
|
52
54
|
[providerEnum_1.ProviderEnum.TENCENT]: 'Nodejs16.13',
|
|
55
|
+
[providerEnum_1.ProviderEnum.HUAWEI]: 'nodejs16.17',
|
|
53
56
|
},
|
|
54
57
|
[StandardRuntime.NODEJS14]: {
|
|
55
58
|
[providerEnum_1.ProviderEnum.ALIYUN]: 'nodejs14',
|
|
56
59
|
[providerEnum_1.ProviderEnum.TENCENT]: 'Nodejs14.18',
|
|
60
|
+
[providerEnum_1.ProviderEnum.HUAWEI]: 'nodejs14.18',
|
|
57
61
|
},
|
|
58
62
|
[StandardRuntime.NODEJS12]: {
|
|
59
63
|
[providerEnum_1.ProviderEnum.ALIYUN]: 'nodejs12',
|
|
60
64
|
[providerEnum_1.ProviderEnum.TENCENT]: 'Nodejs12.16',
|
|
65
|
+
[providerEnum_1.ProviderEnum.HUAWEI]: 'nodejs12.13',
|
|
61
66
|
},
|
|
62
67
|
[StandardRuntime.NODEJS10]: {
|
|
63
68
|
[providerEnum_1.ProviderEnum.ALIYUN]: 'nodejs10',
|
|
64
69
|
[providerEnum_1.ProviderEnum.TENCENT]: 'Nodejs10.15',
|
|
70
|
+
[providerEnum_1.ProviderEnum.HUAWEI]: 'nodejs10.16',
|
|
65
71
|
},
|
|
66
72
|
[StandardRuntime.PYTHON3_14]: {
|
|
67
73
|
[providerEnum_1.ProviderEnum.AWS]: 'python3.14',
|
|
@@ -72,6 +78,7 @@ const runtimeMappings = {
|
|
|
72
78
|
[StandardRuntime.PYTHON3_12]: {
|
|
73
79
|
[providerEnum_1.ProviderEnum.ALIYUN]: 'python3.12',
|
|
74
80
|
[providerEnum_1.ProviderEnum.AWS]: 'python3.12',
|
|
81
|
+
[providerEnum_1.ProviderEnum.HUAWEI]: 'python3.12',
|
|
75
82
|
},
|
|
76
83
|
[StandardRuntime.PYTHON3_11]: {
|
|
77
84
|
[providerEnum_1.ProviderEnum.AWS]: 'python3.11',
|
|
@@ -80,10 +87,12 @@ const runtimeMappings = {
|
|
|
80
87
|
[providerEnum_1.ProviderEnum.ALIYUN]: 'python3.10',
|
|
81
88
|
[providerEnum_1.ProviderEnum.TENCENT]: 'Python3.10',
|
|
82
89
|
[providerEnum_1.ProviderEnum.AWS]: 'python3.10',
|
|
90
|
+
[providerEnum_1.ProviderEnum.HUAWEI]: 'python3.10',
|
|
83
91
|
},
|
|
84
92
|
[StandardRuntime.PYTHON3_9]: {
|
|
85
93
|
[providerEnum_1.ProviderEnum.ALIYUN]: 'python3.9',
|
|
86
94
|
[providerEnum_1.ProviderEnum.TENCENT]: 'Python3.9',
|
|
95
|
+
[providerEnum_1.ProviderEnum.HUAWEI]: 'python3.9',
|
|
87
96
|
},
|
|
88
97
|
[StandardRuntime.PYTHON3_7]: {
|
|
89
98
|
[providerEnum_1.ProviderEnum.TENCENT]: 'Python3.7',
|
|
@@ -91,24 +100,30 @@ const runtimeMappings = {
|
|
|
91
100
|
[StandardRuntime.PYTHON3_6]: {
|
|
92
101
|
[providerEnum_1.ProviderEnum.ALIYUN]: 'python3.6',
|
|
93
102
|
[providerEnum_1.ProviderEnum.TENCENT]: 'Python3.6',
|
|
103
|
+
[providerEnum_1.ProviderEnum.HUAWEI]: 'python3.6',
|
|
94
104
|
},
|
|
95
105
|
[StandardRuntime.JAVA25]: {
|
|
96
106
|
[providerEnum_1.ProviderEnum.AWS]: 'java25',
|
|
97
107
|
},
|
|
98
108
|
[StandardRuntime.JAVA21]: {
|
|
99
109
|
[providerEnum_1.ProviderEnum.AWS]: 'java21',
|
|
110
|
+
// Huawei java21 is regional (ME-Riyadh, TR-Istanbul) per FunctionGraph docs.
|
|
111
|
+
[providerEnum_1.ProviderEnum.HUAWEI]: 'java21',
|
|
100
112
|
},
|
|
101
113
|
[StandardRuntime.JAVA17]: {
|
|
102
114
|
[providerEnum_1.ProviderEnum.AWS]: 'java17',
|
|
115
|
+
[providerEnum_1.ProviderEnum.HUAWEI]: 'java17',
|
|
103
116
|
},
|
|
104
117
|
[StandardRuntime.JAVA11]: {
|
|
105
118
|
[providerEnum_1.ProviderEnum.ALIYUN]: 'java11',
|
|
106
119
|
[providerEnum_1.ProviderEnum.AWS]: 'java11',
|
|
120
|
+
[providerEnum_1.ProviderEnum.HUAWEI]: 'java11',
|
|
107
121
|
},
|
|
108
122
|
[StandardRuntime.JAVA8]: {
|
|
109
123
|
[providerEnum_1.ProviderEnum.ALIYUN]: 'java8',
|
|
110
124
|
[providerEnum_1.ProviderEnum.TENCENT]: 'Java8',
|
|
111
125
|
[providerEnum_1.ProviderEnum.AWS]: 'java8.al2',
|
|
126
|
+
[providerEnum_1.ProviderEnum.HUAWEI]: 'java8',
|
|
112
127
|
},
|
|
113
128
|
[StandardRuntime.PHP8_0]: {
|
|
114
129
|
[providerEnum_1.ProviderEnum.TENCENT]: 'Php8.0',
|
|
@@ -126,9 +141,11 @@ const runtimeMappings = {
|
|
|
126
141
|
[StandardRuntime.GO1]: {
|
|
127
142
|
[providerEnum_1.ProviderEnum.ALIYUN]: 'go 1.x',
|
|
128
143
|
[providerEnum_1.ProviderEnum.TENCENT]: 'Go1',
|
|
144
|
+
[providerEnum_1.ProviderEnum.HUAWEI]: 'go1.x',
|
|
129
145
|
},
|
|
130
146
|
[StandardRuntime.DOTNET_CORE3_1]: {
|
|
131
147
|
[providerEnum_1.ProviderEnum.ALIYUN]: '.NET Core 3.1',
|
|
148
|
+
[providerEnum_1.ProviderEnum.HUAWEI]: 'dotnetcore3.1',
|
|
132
149
|
},
|
|
133
150
|
};
|
|
134
151
|
const mapRuntime = (standardRuntime, provider) => {
|
|
@@ -144,9 +161,12 @@ const mapRuntime = (standardRuntime, provider) => {
|
|
|
144
161
|
return providerRuntime;
|
|
145
162
|
};
|
|
146
163
|
exports.mapRuntime = mapRuntime;
|
|
147
|
-
// Valid veFaaS runtimes per the official CreateFunction API reference
|
|
148
|
-
//
|
|
149
|
-
//
|
|
164
|
+
// Valid veFaaS runtimes per the official CreateFunction API reference, adjusted
|
|
165
|
+
// for product notices: python3.8/v1 retired (volcengine notice 2121844) and the
|
|
166
|
+
// native-family ids added from Volcengine-maintained tooling (mcp-server / veadk).
|
|
167
|
+
// Verified 2026-08: golang/v1, native/v1, nativejava8/v1, node14/v1, node20/v1,
|
|
168
|
+
// nodeprime14/v1, python3.12/v1, python3.9/v1, native-python3.12/v1,
|
|
169
|
+
// native-node20/v1
|
|
150
170
|
const VOLCENGINE_NATIVE_RUNTIMES = [
|
|
151
171
|
'golang/v1',
|
|
152
172
|
'native/v1',
|
|
@@ -155,8 +175,9 @@ const VOLCENGINE_NATIVE_RUNTIMES = [
|
|
|
155
175
|
'node20/v1',
|
|
156
176
|
'nodeprime14/v1',
|
|
157
177
|
'python3.12/v1',
|
|
158
|
-
'python3.8/v1',
|
|
159
178
|
'python3.9/v1',
|
|
179
|
+
'native-python3.12/v1',
|
|
180
|
+
'native-node20/v1',
|
|
160
181
|
];
|
|
161
182
|
const isRuntimeSupported = (runtime, provider) => {
|
|
162
183
|
if (provider === providerEnum_1.ProviderEnum.VOLCENGINE) {
|
package/dist/src/lang/en.js
CHANGED
|
@@ -407,6 +407,12 @@ exports.en = {
|
|
|
407
407
|
CANNOT_RESOLVE_FUNCTION_REF: 'Cannot resolve function reference {{backendRef}}: IAC not available in context',
|
|
408
408
|
FUNCTION_REF_NOT_RESOLVED: 'Function reference {{backendRef}} could not be resolved from IAC',
|
|
409
409
|
RESOLVED_FUNCTION_REF: 'Resolved function reference {{backendRef}} to function name: {{functionName}}',
|
|
410
|
+
// Pre-deploy semantic validation (issue #222)
|
|
411
|
+
PARSE_BACKEND_BUCKET_STORE_FIELDS_REQUIRED: 'Backend type BUCKET_STORE requires both "bucket" and "key" fields',
|
|
412
|
+
SEMANTIC_DUPLICATE_TRIGGER: 'Duplicate trigger in event "{{eventKey}}": {{method}} {{path}} is defined more than once',
|
|
413
|
+
SEMANTIC_DUPLICATE_GENERATED_API_NAME: 'Generated API Gateway apiName "{{apiName}}" collides between "{{firstPath}}" and "{{secondPath}}" in this deployment; shorten the event name or differentiate trigger method/path',
|
|
414
|
+
SEMANTIC_DUPLICATE_ROUTE_NAME: 'Generated API Gateway route name "{{routeName}}" collides between "{{firstPath}}" and "{{secondPath}}" in this deployment; shorten the event name or differentiate trigger method/path',
|
|
415
|
+
SEMANTIC_UNRESOLVED_FUNCTION_BACKEND: 'Trigger backend "{{reference}}" in event "{{eventKey}}" does not match any function definition in the configuration',
|
|
410
416
|
// Show command messages
|
|
411
417
|
LOADING_STATE_FOR: 'Loading state for app: {{app}}, service: {{service}}, stage: {{stage}}...',
|
|
412
418
|
NO_RESOURCES_FOUND: 'No resources found in state.',
|
package/dist/src/lang/zh-CN.js
CHANGED
|
@@ -404,6 +404,12 @@ exports.zhCN = {
|
|
|
404
404
|
CANNOT_RESOLVE_FUNCTION_REF: '无法解析函数引用 {{backendRef}}: 上下文中无 IAC',
|
|
405
405
|
FUNCTION_REF_NOT_RESOLVED: '无法从 IAC 解析函数引用 {{backendRef}}',
|
|
406
406
|
RESOLVED_FUNCTION_REF: '已将函数引用 {{backendRef}} 解析为函数名: {{functionName}}',
|
|
407
|
+
// Pre-deploy semantic validation (issue #222)
|
|
408
|
+
PARSE_BACKEND_BUCKET_STORE_FIELDS_REQUIRED: '后端类型 BUCKET_STORE 需要同时提供 "bucket" 和 "key" 字段',
|
|
409
|
+
SEMANTIC_DUPLICATE_TRIGGER: '事件 "{{eventKey}}" 中存在重复触发器: {{method}} {{path}} 定义了不止一次',
|
|
410
|
+
SEMANTIC_DUPLICATE_GENERATED_API_NAME: '生成的 API Gateway apiName "{{apiName}}" 在 "{{firstPath}}" 与 "{{secondPath}}" 之间发生冲突;请缩短事件名称或区分触发器的 method/path',
|
|
411
|
+
SEMANTIC_DUPLICATE_ROUTE_NAME: '生成的 API Gateway route name "{{routeName}}" 在 "{{firstPath}}" 与 "{{secondPath}}" 之间发生冲突;请缩短事件名称或区分触发器的 method/path',
|
|
412
|
+
SEMANTIC_UNRESOLVED_FUNCTION_BACKEND: '事件 "{{eventKey}}" 的触发器后端 "{{reference}}" 未匹配到配置中的任何函数定义',
|
|
407
413
|
// Show command messages
|
|
408
414
|
LOADING_STATE_FOR: '正在加载应用 {{app}}、服务 {{service}}、阶段 {{stage}} 的状态...',
|
|
409
415
|
NO_RESOURCES_FOUND: '状态中未找到资源。',
|
package/dist/src/parser/index.js
CHANGED
|
@@ -12,6 +12,7 @@ const validator_1 = require("../validator");
|
|
|
12
12
|
const bucketParser_1 = require("./bucketParser");
|
|
13
13
|
const tableParser_1 = require("./tableParser");
|
|
14
14
|
const common_1 = require("../common");
|
|
15
|
+
const lang_1 = require("../lang");
|
|
15
16
|
const validateExistence = (path) => {
|
|
16
17
|
if (!(0, node_fs_1.existsSync)(path)) {
|
|
17
18
|
throw new Error(`File does not exist at path: ${path}`);
|
|
@@ -26,7 +27,7 @@ const parseBackend = (raw) => {
|
|
|
26
27
|
const type = stateManager.type?.toUpperCase();
|
|
27
28
|
if (type === types_1.StateBackendType.BUCKET_STORE) {
|
|
28
29
|
if (!stateManager.bucket || !stateManager.key) {
|
|
29
|
-
throw new Error('
|
|
30
|
+
throw new Error(lang_1.lang.__('PARSE_BACKEND_BUCKET_STORE_FIELDS_REQUIRED'));
|
|
30
31
|
}
|
|
31
32
|
return {
|
|
32
33
|
type: types_1.StateBackendType.BUCKET_STORE,
|