@geek-fun/serverlessinsight 0.8.6 → 0.8.7
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 +19 -19
- package/.serverlessinsight/state-insight-poc-destroy-app-insight-poc-destroy.json.backup +1 -1
- package/.serverlessinsight/state-insight-volc-app-insight-volc.json.backup +11 -11
- package/AGENTS.md +29 -0
- package/dist/package.json +1 -1
- package/dist/src/common/aliyunClient/ramOperations.js +104 -15
- package/dist/src/common/iacHelper.js +3 -1
- package/dist/src/common/iamStatements.js +21 -1
- package/dist/src/common/nameBuilder.js +12 -1
- package/dist/src/common/tencentClient/camOperations.js +24 -12
- package/dist/src/common/volcengineClient/iamOperations.js +15 -11
- package/dist/src/lang/en.js +7 -0
- package/dist/src/lang/zh-CN.js +6 -0
- package/dist/src/stack/aliyunStack/apigwExecutor.js +5 -5
- package/dist/src/stack/aliyunStack/apigwResource.js +10 -8
- package/dist/src/stack/aliyunStack/apigwTypes.js +20 -5
- package/dist/src/stack/aliyunStack/deployer.js +33 -3
- package/dist/src/stack/aliyunStack/fc3Resource.js +172 -18
- package/dist/src/stack/aliyunStack/sharedLogProject.js +22 -5
- package/dist/src/stack/scfStack/scfPlanner.js +1 -1
- package/dist/src/stack/scfStack/scfResource.js +72 -10
- package/dist/src/stack/scfStack/sharedLogset.js +9 -1
- package/dist/src/stack/volcengineStack/apigwPlanner.js +5 -1
- package/dist/src/stack/volcengineStack/apigwResource.js +52 -30
- package/dist/src/stack/volcengineStack/apigwTypes.js +18 -7
- package/dist/src/stack/volcengineStack/sharedLogProject.js +9 -3
- package/dist/src/stack/volcengineStack/vefaasPlanner.js +5 -4
- package/dist/src/stack/volcengineStack/vefaasResource.js +74 -10
- package/dist/src/stack/volcengineStack/vefaasTypes.js +61 -7
- package/dist/src/validator/semanticValidation.js +41 -0
- package/package.json +1 -1
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateSemantics = void 0;
|
|
4
4
|
const lang_1 = require("../lang");
|
|
5
|
+
const logger_1 = require("../common/logger");
|
|
5
6
|
// Direct leaf import on purpose: routing through the src/common barrel would
|
|
6
7
|
// drag stateManager/lockManager/fs surfaces into the validator graph and
|
|
7
8
|
// recreate an import cycle with src/parser. These helpers are pure.
|
|
8
9
|
const providerNames_1 = require("../common/providerNames");
|
|
9
10
|
const FUNCTION_BACKEND_PATTERN = /^\$\{functions\.([\w.]+)\}$/;
|
|
11
|
+
const TEMPLATE_REF_PATTERN = /^\$\{[^}]+\}$/;
|
|
10
12
|
/**
|
|
11
13
|
* Stage is intentionally empty here: it is identical for every generated name
|
|
12
14
|
* inside one validation run, so collision detection is unaffected while avoiding
|
|
@@ -22,6 +24,11 @@ const validateSemantics = (iacJson) => {
|
|
|
22
24
|
const events = (iacJson.events ?? {});
|
|
23
25
|
const functionDefinitions = (iacJson.functions ?? {});
|
|
24
26
|
const definedFunctionKeys = new Set(Object.keys(functionDefinitions));
|
|
27
|
+
const definedFunctionNames = new Set(Object.values(functionDefinitions)
|
|
28
|
+
.map((fn) => fn && typeof fn === 'object' && typeof fn.name === 'string'
|
|
29
|
+
? fn.name
|
|
30
|
+
: undefined)
|
|
31
|
+
.filter((name) => name !== undefined));
|
|
25
32
|
Object.entries(events).forEach(([eventKey, rawEvent]) => {
|
|
26
33
|
const triggers = Array.isArray(rawEvent.triggers)
|
|
27
34
|
? rawEvent.triggers
|
|
@@ -69,6 +76,40 @@ const validateSemantics = (iacJson) => {
|
|
|
69
76
|
}),
|
|
70
77
|
});
|
|
71
78
|
}
|
|
79
|
+
// Bare backend semantics (issue #227): a bare value must be a function's
|
|
80
|
+
// deployed name. A value equal to a template function's KEY is the exact
|
|
81
|
+
// misconfiguration that broke the API Gateway trust policy — reject it;
|
|
82
|
+
// a value matching a template function's name passes with a preference
|
|
83
|
+
// warning; anything else is an external function (statically unverifiable).
|
|
84
|
+
const bareBackend = typeof trigger.backend === 'string' &&
|
|
85
|
+
!backendRef &&
|
|
86
|
+
!TEMPLATE_REF_PATTERN.test(trigger.backend)
|
|
87
|
+
? trigger.backend
|
|
88
|
+
: undefined;
|
|
89
|
+
if (bareBackend) {
|
|
90
|
+
if (definedFunctionNames.has(bareBackend)) {
|
|
91
|
+
const matchedKey = Object.keys(functionDefinitions).find((key) => typeof functionDefinitions[key]?.name === 'string' &&
|
|
92
|
+
functionDefinitions[key].name === bareBackend);
|
|
93
|
+
logger_1.logger.warn(lang_1.lang.__('SEMANTIC_BACKEND_BARE_NAME', {
|
|
94
|
+
backend: bareBackend,
|
|
95
|
+
key: matchedKey ?? bareBackend,
|
|
96
|
+
eventKey,
|
|
97
|
+
}));
|
|
98
|
+
}
|
|
99
|
+
else if (definedFunctionKeys.has(bareBackend)) {
|
|
100
|
+
errors.push({
|
|
101
|
+
instancePath,
|
|
102
|
+
schemaPath: '#/semantic/bareBackendKey',
|
|
103
|
+
keyword: 'bareBackendKey',
|
|
104
|
+
params: {},
|
|
105
|
+
message: lang_1.lang.__('SEMANTIC_BACKEND_BARE_KEY', {
|
|
106
|
+
backend: bareBackend,
|
|
107
|
+
key: bareBackend,
|
|
108
|
+
eventKey,
|
|
109
|
+
}),
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
72
113
|
// Generated names derive from method+path, so a duplicate trigger would
|
|
73
114
|
// only re-report the duplicateTrigger error — skip name collision checks.
|
|
74
115
|
if (isDuplicateTrigger || method.length === 0 || path.length === 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geek-fun/serverlessinsight",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.7",
|
|
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",
|