@geek-fun/serverlessinsight 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitattributes +1 -0
- package/README.md +108 -8
- package/README.zh-CN.md +52 -8
- package/dist/package.json +37 -35
- package/dist/src/commands/deploy.js +17 -7
- package/dist/src/commands/destroy.js +27 -4
- package/dist/src/commands/forceUnlock.js +61 -0
- package/dist/src/commands/index.js +86 -14
- package/dist/src/commands/local.js +10 -1
- package/dist/src/commands/plan.js +33 -0
- package/dist/src/commands/template.js +3 -1
- package/dist/src/commands/validate.js +2 -1
- package/dist/src/common/aliyunClient/apigwOperations.js +652 -0
- package/dist/src/common/aliyunClient/dnsOperations.js +90 -0
- package/dist/src/common/aliyunClient/ecsOperations.js +141 -0
- package/dist/src/common/aliyunClient/esOperations.js +219 -0
- package/dist/src/common/aliyunClient/fc3Operations.js +270 -0
- package/dist/src/common/aliyunClient/index.js +141 -0
- package/dist/src/common/aliyunClient/nasOperations.js +233 -0
- package/dist/src/common/aliyunClient/ossOperations.js +237 -0
- package/dist/src/common/aliyunClient/ramOperations.js +205 -0
- package/dist/src/common/aliyunClient/rdsOperations.js +206 -0
- package/dist/src/common/aliyunClient/slsOperations.js +218 -0
- package/dist/src/common/aliyunClient/tablestoreOperations.js +199 -0
- package/dist/src/common/aliyunClient/types.js +2 -0
- package/dist/src/common/constants.js +7 -1
- package/dist/src/common/context.js +32 -14
- package/dist/src/common/credentials.js +39 -0
- package/dist/src/common/dependencyGraph/graph.js +280 -0
- package/dist/src/common/dependencyGraph/index.js +18 -0
- package/dist/src/common/dependencyGraph/types.js +2 -0
- package/dist/src/common/fileUtils.js +16 -0
- package/dist/src/common/hashUtils.js +121 -0
- package/dist/src/common/iacHelper.js +25 -97
- package/dist/src/common/imsClient.js +4 -0
- package/dist/src/common/index.js +7 -2
- package/dist/src/common/lockManager.js +212 -0
- package/dist/src/common/logger.js +89 -6
- package/dist/src/common/providerEnum.js +2 -3
- package/dist/src/common/runtimeMapper.js +160 -0
- package/dist/src/common/scfClient.js +84 -0
- package/dist/src/common/stateManager.js +107 -0
- package/dist/src/common/tencentClient/cosOperations.js +287 -0
- package/dist/src/common/tencentClient/esOperations.js +156 -0
- package/dist/src/common/tencentClient/index.js +116 -0
- package/dist/src/common/tencentClient/scfOperations.js +141 -0
- package/dist/src/common/tencentClient/tdsqlcOperations.js +211 -0
- package/dist/src/common/tencentClient/types.js +17 -0
- package/dist/src/lang/en.js +254 -0
- package/dist/src/lang/index.js +28 -8
- package/dist/src/lang/zh-CN.js +229 -0
- package/dist/src/parser/bucketParser.js +25 -12
- package/dist/src/parser/databaseParser.js +14 -10
- package/dist/src/parser/functionParser.js +19 -6
- package/dist/src/parser/parseUtils.js +74 -0
- package/dist/src/parser/tableParser.js +19 -17
- package/dist/src/stack/aliyunStack/apigwExecutor.js +84 -0
- package/dist/src/stack/aliyunStack/apigwPlanner.js +118 -0
- package/dist/src/stack/aliyunStack/apigwResource.js +339 -0
- package/dist/src/stack/aliyunStack/apigwTypes.js +125 -0
- package/dist/src/stack/aliyunStack/databaseExecutor.js +112 -0
- package/dist/src/stack/aliyunStack/databasePlanner.js +128 -0
- package/dist/src/stack/aliyunStack/databaseResource.js +228 -0
- package/dist/src/stack/aliyunStack/deployer.js +133 -0
- package/dist/src/stack/aliyunStack/destroyer.js +114 -0
- package/dist/src/stack/aliyunStack/esServerlessTypes.js +141 -0
- package/dist/src/stack/aliyunStack/fc3Executor.js +91 -0
- package/dist/src/stack/aliyunStack/fc3Planner.js +77 -0
- package/dist/src/stack/aliyunStack/fc3Resource.js +511 -0
- package/dist/src/stack/aliyunStack/fc3Types.js +76 -0
- package/dist/src/stack/aliyunStack/index.js +40 -0
- package/dist/src/stack/aliyunStack/ossExecutor.js +91 -0
- package/dist/src/stack/aliyunStack/ossPlanner.js +76 -0
- package/dist/src/stack/aliyunStack/ossResource.js +196 -0
- package/dist/src/stack/aliyunStack/ossTypes.js +50 -0
- package/dist/src/stack/aliyunStack/planner.js +37 -0
- package/dist/src/stack/aliyunStack/rdsTypes.js +217 -0
- package/dist/src/stack/aliyunStack/tablestoreExecutor.js +92 -0
- package/dist/src/stack/aliyunStack/tablestorePlanner.js +94 -0
- package/dist/src/stack/aliyunStack/tablestoreResource.js +120 -0
- package/dist/src/stack/aliyunStack/tablestoreTypes.js +77 -0
- package/dist/src/stack/bucketTypes.js +17 -0
- package/dist/src/stack/deploy.js +24 -77
- package/dist/src/stack/localStack/bucket.js +11 -6
- package/dist/src/stack/localStack/event.js +10 -5
- package/dist/src/stack/localStack/function.js +13 -7
- package/dist/src/stack/localStack/functionRunner.js +1 -1
- package/dist/src/stack/localStack/localServer.js +7 -6
- package/dist/src/stack/scfStack/cosExecutor.js +91 -0
- package/dist/src/stack/scfStack/cosPlanner.js +76 -0
- package/dist/src/stack/scfStack/cosResource.js +126 -0
- package/dist/src/stack/scfStack/cosTypes.js +46 -0
- package/dist/src/stack/scfStack/deployer.js +91 -0
- package/dist/src/stack/scfStack/destroyer.js +88 -0
- package/dist/src/stack/scfStack/esServerlessExecutor.js +105 -0
- package/dist/src/stack/scfStack/esServerlessPlanner.js +86 -0
- package/dist/src/stack/scfStack/esServerlessResource.js +94 -0
- package/dist/src/stack/scfStack/esServerlessTypes.js +48 -0
- package/dist/src/stack/scfStack/index.js +35 -0
- package/dist/src/stack/scfStack/planner.js +91 -0
- package/dist/src/stack/scfStack/scfExecutor.js +91 -0
- package/dist/src/stack/scfStack/scfPlanner.js +78 -0
- package/dist/src/stack/scfStack/scfResource.js +216 -0
- package/dist/src/stack/scfStack/scfTypes.js +41 -0
- package/dist/src/stack/scfStack/tdsqlcExecutor.js +105 -0
- package/dist/src/stack/scfStack/tdsqlcPlanner.js +90 -0
- package/dist/src/stack/scfStack/tdsqlcResource.js +146 -0
- package/dist/src/stack/scfStack/tdsqlcTypes.js +59 -0
- package/dist/src/types/domains/lock.js +2 -0
- package/dist/src/types/domains/resolvable.js +2 -0
- package/dist/src/types/domains/state.js +19 -0
- package/dist/src/types/index.js +4 -0
- package/dist/src/validator/bucketSchema.js +4 -10
- package/dist/src/validator/databaseSchema.js +36 -36
- package/dist/src/validator/eventSchema.js +3 -2
- package/dist/src/validator/functionSchema.js +51 -46
- package/dist/src/validator/iacSchema.js +52 -3
- package/dist/src/validator/rootSchema.js +47 -1
- package/dist/src/validator/tableschema.js +9 -8
- package/dist/src/validator/templateRefSchema.js +23 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +37 -35
- package/samples/README_TENCENT_COS.md +486 -0
- package/samples/README_TENCENT_SCF.md +272 -0
- package/samples/aliyun-poc-api.yml +1 -1
- package/samples/aliyun-poc-bucket.yml +0 -1
- package/samples/aliyun-poc-domain.yml +0 -1
- package/samples/aliyun-poc-es.yml +14 -13
- package/samples/aliyun-poc-rds.yml +0 -2
- package/samples/aliyun-poc-table.yml +1 -3
- package/samples/tencent-poc-cos.yml +20 -0
- package/samples/tencent-poc-scf.yml +36 -0
- package/dist/src/commands/index.d.ts +0 -2
- package/dist/src/common/index.d.ts +0 -11
- package/dist/src/common/rosAssets.js +0 -178
- package/dist/src/common/rosClient.js +0 -198
- package/dist/src/index.d.ts +0 -1
- package/dist/src/lang/index.d.ts +0 -3
- package/dist/src/parser/index.d.ts +0 -3
- package/dist/src/stack/index.d.ts +0 -1
- package/dist/src/stack/localStack/index.d.ts +0 -5
- package/dist/src/stack/rfsStack/index.d.ts +0 -9
- package/dist/src/stack/rosStack/bootstrap.js +0 -187
- package/dist/src/stack/rosStack/bucket.js +0 -127
- package/dist/src/stack/rosStack/database.js +0 -313
- package/dist/src/stack/rosStack/event.js +0 -143
- package/dist/src/stack/rosStack/function.js +0 -259
- package/dist/src/stack/rosStack/index.d.ts +0 -7
- package/dist/src/stack/rosStack/index.js +0 -75
- package/dist/src/stack/rosStack/stage.js +0 -46
- package/dist/src/stack/rosStack/table.js +0 -95
- package/dist/src/stack/rosStack/tag.js +0 -11
- package/dist/src/stack/rosStack/vars.js +0 -49
- package/dist/src/types/index.d.ts +0 -55
- package/dist/src/types/localStack/index.d.ts +0 -81
- package/dist/src/validator/index.d.ts +0 -1
- package/layers/si-bootstrap-sdk/Dockerfile-aliyuncli +0 -12
- package/layers/si-bootstrap-sdk/README.md +0 -1
- package/layers/si-bootstrap-sdk/package-lock.json +0 -875
- package/layers/si-bootstrap-sdk/package.json +0 -33
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CURRENT_STATE_VERSION = exports.ResourceTypeEnum = void 0;
|
|
4
|
+
var ResourceTypeEnum;
|
|
5
|
+
(function (ResourceTypeEnum) {
|
|
6
|
+
ResourceTypeEnum["SCF_FUNCTION"] = "SCF_FUNCTION";
|
|
7
|
+
ResourceTypeEnum["COS_BUCKET"] = "COS_BUCKET";
|
|
8
|
+
ResourceTypeEnum["TDSQL_C_SERVERLESS"] = "TDSQL_C_SERVERLESS";
|
|
9
|
+
ResourceTypeEnum["ALIYUN_FC3_FUNCTION"] = "ALIYUN_FC3_FUNCTION";
|
|
10
|
+
ResourceTypeEnum["ALIYUN_APIGW_GROUP"] = "ALIYUN_APIGW_GROUP";
|
|
11
|
+
ResourceTypeEnum["ALIYUN_APIGW_API"] = "ALIYUN_APIGW_API";
|
|
12
|
+
ResourceTypeEnum["ALIYUN_APIGW_DEPLOYMENT"] = "ALIYUN_APIGW_DEPLOYMENT";
|
|
13
|
+
ResourceTypeEnum["ALIYUN_APIGW_DNS_VERIFICATION"] = "ALIYUN_APIGW_DNS_VERIFICATION";
|
|
14
|
+
ResourceTypeEnum["ALIYUN_OSS_BUCKET"] = "ALIYUN_OSS_BUCKET";
|
|
15
|
+
ResourceTypeEnum["ALIYUN_RDS_SERVERLESS"] = "ALIYUN_RDS_SERVERLESS";
|
|
16
|
+
ResourceTypeEnum["ALIYUN_ES_SERVERLESS"] = "ALIYUN_ES_SERVERLESS";
|
|
17
|
+
ResourceTypeEnum["ALIYUN_TABLESTORE_TABLE"] = "ALIYUN_TABLESTORE_TABLE";
|
|
18
|
+
})(ResourceTypeEnum || (exports.ResourceTypeEnum = ResourceTypeEnum = {}));
|
|
19
|
+
exports.CURRENT_STATE_VERSION = '1.0';
|
package/dist/src/types/index.js
CHANGED
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./domains/resolvable"), exports);
|
|
17
18
|
__exportStar(require("./domains/database"), exports);
|
|
18
19
|
__exportStar(require("./domains/event"), exports);
|
|
19
20
|
__exportStar(require("./domains/function"), exports);
|
|
@@ -21,4 +22,7 @@ __exportStar(require("./domains/tag"), exports);
|
|
|
21
22
|
__exportStar(require("./domains/vars"), exports);
|
|
22
23
|
__exportStar(require("./domains/context"), exports);
|
|
23
24
|
__exportStar(require("./domains/bucket"), exports);
|
|
25
|
+
__exportStar(require("./domains/table"), exports);
|
|
26
|
+
__exportStar(require("./domains/state"), exports);
|
|
27
|
+
__exportStar(require("./domains/lock"), exports);
|
|
24
28
|
__exportStar(require("./assets"), exports);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.bucketSchema = void 0;
|
|
4
|
+
const templateRefSchema_1 = require("./templateRefSchema");
|
|
4
5
|
exports.bucketSchema = {
|
|
5
6
|
$id: 'https://serverlessinsight.geekfun.club/schemas/bucketschema.json',
|
|
6
7
|
type: 'object',
|
|
@@ -32,13 +33,8 @@ exports.bucketSchema = {
|
|
|
32
33
|
security: {
|
|
33
34
|
type: 'object',
|
|
34
35
|
properties: {
|
|
35
|
-
access:
|
|
36
|
-
|
|
37
|
-
enum: ['PRIVATE', 'PUBLIC_READ', 'PUBLIC_READ_WRITE'],
|
|
38
|
-
},
|
|
39
|
-
force_delete: {
|
|
40
|
-
type: 'boolean',
|
|
41
|
-
},
|
|
36
|
+
access: (0, templateRefSchema_1.resolvableEnum)(['PRIVATE', 'PUBLIC_READ', 'PUBLIC_READ_WRITE']),
|
|
37
|
+
force_delete: templateRefSchema_1.resolvableBoolean,
|
|
42
38
|
sse_algorithm: {
|
|
43
39
|
type: 'string',
|
|
44
40
|
},
|
|
@@ -62,9 +58,7 @@ exports.bucketSchema = {
|
|
|
62
58
|
error_page: {
|
|
63
59
|
type: 'string',
|
|
64
60
|
},
|
|
65
|
-
error_code:
|
|
66
|
-
type: 'number',
|
|
67
|
-
},
|
|
61
|
+
error_code: templateRefSchema_1.resolvableNumber,
|
|
68
62
|
},
|
|
69
63
|
required: ['code'],
|
|
70
64
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.databaseSchema = void 0;
|
|
4
|
+
const templateRefSchema_1 = require("./templateRefSchema");
|
|
4
5
|
exports.databaseSchema = {
|
|
5
6
|
$id: 'https://serverlessinsight.geekfun.club/schemas/databaseschema.json',
|
|
6
7
|
type: 'object',
|
|
@@ -9,46 +10,43 @@ exports.databaseSchema = {
|
|
|
9
10
|
type: 'object',
|
|
10
11
|
properties: {
|
|
11
12
|
name: { type: 'string' },
|
|
12
|
-
type:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
'MSSQL_HA_2019',
|
|
37
|
-
'ES_SEARCH_7.10',
|
|
38
|
-
'ES_TIME_SERIES_7.10',
|
|
39
|
-
],
|
|
40
|
-
},
|
|
13
|
+
type: (0, templateRefSchema_1.resolvableEnum)([
|
|
14
|
+
'ELASTICSEARCH_SERVERLESS',
|
|
15
|
+
'RDS_MYSQL_SERVERLESS',
|
|
16
|
+
'RDS_PGSQL_SERVERLESS',
|
|
17
|
+
'RDS_MSSQL_SERVERLESS',
|
|
18
|
+
'TDSQL_C_SERVERLESS',
|
|
19
|
+
]),
|
|
20
|
+
version: (0, templateRefSchema_1.resolvableEnum)([
|
|
21
|
+
'MYSQL_5.7',
|
|
22
|
+
'MYSQL_8.0',
|
|
23
|
+
'MYSQL_HA_5.7',
|
|
24
|
+
'MYSQL_HA_8.0',
|
|
25
|
+
'PGSQL_14',
|
|
26
|
+
'PGSQL_15',
|
|
27
|
+
'PGSQL_16',
|
|
28
|
+
'PGSQL_HA_14',
|
|
29
|
+
'PGSQL_HA_15',
|
|
30
|
+
'PGSQL_HA_16',
|
|
31
|
+
'MSSQL_HA_2016',
|
|
32
|
+
'MSSQL_HA_2017',
|
|
33
|
+
'MSSQL_HA_2019',
|
|
34
|
+
'ES_SEARCH_7.10',
|
|
35
|
+
'ES_TIME_SERIES_7.10',
|
|
36
|
+
]),
|
|
41
37
|
cu: {
|
|
42
38
|
type: 'object',
|
|
43
39
|
properties: {
|
|
44
|
-
min:
|
|
45
|
-
max:
|
|
40
|
+
min: templateRefSchema_1.resolvableNumber,
|
|
41
|
+
max: templateRefSchema_1.resolvableNumber,
|
|
46
42
|
},
|
|
47
43
|
},
|
|
48
44
|
storage: {
|
|
49
45
|
type: 'object',
|
|
50
|
-
properties: {
|
|
51
|
-
|
|
46
|
+
properties: {
|
|
47
|
+
min: templateRefSchema_1.resolvableInteger,
|
|
48
|
+
max: templateRefSchema_1.resolvableInteger,
|
|
49
|
+
},
|
|
52
50
|
},
|
|
53
51
|
security: {
|
|
54
52
|
type: 'object',
|
|
@@ -59,7 +57,7 @@ exports.databaseSchema = {
|
|
|
59
57
|
master_user: { type: 'string' },
|
|
60
58
|
password: { type: 'string' },
|
|
61
59
|
},
|
|
62
|
-
required: ['
|
|
60
|
+
required: ['password'],
|
|
63
61
|
},
|
|
64
62
|
},
|
|
65
63
|
required: ['basic_auth'],
|
|
@@ -67,12 +65,14 @@ exports.databaseSchema = {
|
|
|
67
65
|
network: {
|
|
68
66
|
type: 'object',
|
|
69
67
|
properties: {
|
|
70
|
-
type:
|
|
68
|
+
type: (0, templateRefSchema_1.resolvableEnum)(['PUBLIC', 'PRIVATE']),
|
|
71
69
|
ingress_rules: {
|
|
72
70
|
type: 'array',
|
|
73
71
|
items: { type: 'string' },
|
|
74
72
|
},
|
|
75
|
-
|
|
73
|
+
vpc_id: { type: 'string' },
|
|
74
|
+
subnet_id: { type: 'string' },
|
|
75
|
+
public: templateRefSchema_1.resolvableBoolean,
|
|
76
76
|
},
|
|
77
77
|
},
|
|
78
78
|
},
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.eventSchema = void 0;
|
|
4
|
+
const templateRefSchema_1 = require("./templateRefSchema");
|
|
4
5
|
exports.eventSchema = {
|
|
5
6
|
$id: 'https://serverlessinsight.geekfun.club/schemas/eventschema.json',
|
|
6
7
|
type: 'object',
|
|
@@ -9,11 +10,11 @@ exports.eventSchema = {
|
|
|
9
10
|
type: 'object',
|
|
10
11
|
properties: {
|
|
11
12
|
name: { type: 'string' },
|
|
12
|
-
type:
|
|
13
|
+
type: (0, templateRefSchema_1.resolvableEnum)(['API_GATEWAY']),
|
|
13
14
|
triggers: {
|
|
14
15
|
type: 'array',
|
|
15
16
|
items: {
|
|
16
|
-
method:
|
|
17
|
+
method: (0, templateRefSchema_1.resolvableEnum)(['GET', 'POST', 'PUT', 'DELETE', 'ANY']),
|
|
17
18
|
path: { type: 'string' },
|
|
18
19
|
backend: { type: 'string' },
|
|
19
20
|
required: ['method', 'path', 'backend'],
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.functionSchema = void 0;
|
|
4
|
+
const templateRefSchema_1 = require("./templateRefSchema");
|
|
4
5
|
exports.functionSchema = {
|
|
5
6
|
$id: 'https://serverlessinsight.geekfun.club/schemas/functionschema.json',
|
|
6
7
|
type: 'object',
|
|
@@ -15,25 +16,35 @@ exports.functionSchema = {
|
|
|
15
16
|
required: ['runtime', 'handler', 'path'],
|
|
16
17
|
additionalProperties: false,
|
|
17
18
|
properties: {
|
|
18
|
-
runtime:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
19
|
+
runtime: (0, templateRefSchema_1.resolvableEnum)([
|
|
20
|
+
'nodejs24',
|
|
21
|
+
'nodejs22',
|
|
22
|
+
'nodejs20',
|
|
23
|
+
'nodejs18',
|
|
24
|
+
'nodejs16',
|
|
25
|
+
'nodejs14',
|
|
26
|
+
'nodejs12',
|
|
27
|
+
'nodejs10',
|
|
28
|
+
'python3.14',
|
|
29
|
+
'python3.13',
|
|
30
|
+
'python3.12',
|
|
31
|
+
'python3.11',
|
|
32
|
+
'python3.10',
|
|
33
|
+
'python3.9',
|
|
34
|
+
'python3.7',
|
|
35
|
+
'python3.6',
|
|
36
|
+
'java25',
|
|
37
|
+
'java21',
|
|
38
|
+
'java17',
|
|
39
|
+
'java11',
|
|
40
|
+
'java8',
|
|
41
|
+
'php8.0',
|
|
42
|
+
'php7.4',
|
|
43
|
+
'php7.2',
|
|
44
|
+
'php5.6',
|
|
45
|
+
'go1',
|
|
46
|
+
'dotnet_core3.1',
|
|
47
|
+
]),
|
|
37
48
|
handler: { type: 'string' },
|
|
38
49
|
path: { type: 'string' },
|
|
39
50
|
},
|
|
@@ -45,25 +56,22 @@ exports.functionSchema = {
|
|
|
45
56
|
properties: {
|
|
46
57
|
image: { type: 'string' },
|
|
47
58
|
cmd: { type: 'string' },
|
|
48
|
-
port:
|
|
59
|
+
port: templateRefSchema_1.resolvableNumber,
|
|
49
60
|
},
|
|
50
61
|
},
|
|
51
|
-
memory:
|
|
52
|
-
gpu:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
},
|
|
65
|
-
timeout: { type: 'number' },
|
|
66
|
-
log: { type: 'boolean' },
|
|
62
|
+
memory: templateRefSchema_1.resolvableNumber,
|
|
63
|
+
gpu: (0, templateRefSchema_1.resolvableEnum)([
|
|
64
|
+
'TESLA_8',
|
|
65
|
+
'TESLA_12',
|
|
66
|
+
'TESLA_16',
|
|
67
|
+
'AMPERE_8',
|
|
68
|
+
'AMPERE_12',
|
|
69
|
+
'AMPERE_16',
|
|
70
|
+
'AMPERE_24',
|
|
71
|
+
'ADA_48',
|
|
72
|
+
]),
|
|
73
|
+
timeout: templateRefSchema_1.resolvableNumber,
|
|
74
|
+
log: templateRefSchema_1.resolvableBoolean,
|
|
67
75
|
environment: {
|
|
68
76
|
type: 'object',
|
|
69
77
|
additionalProperties: {
|
|
@@ -91,22 +99,19 @@ exports.functionSchema = {
|
|
|
91
99
|
storage: {
|
|
92
100
|
type: 'object',
|
|
93
101
|
properties: {
|
|
94
|
-
disk:
|
|
102
|
+
disk: templateRefSchema_1.resolvableNumber,
|
|
95
103
|
nas: {
|
|
96
104
|
type: 'array',
|
|
97
105
|
items: {
|
|
98
106
|
type: 'object',
|
|
99
107
|
properties: {
|
|
100
108
|
mount_path: { type: 'string' },
|
|
101
|
-
storage_class:
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
'EXTREME_ADVANCE',
|
|
108
|
-
],
|
|
109
|
-
},
|
|
109
|
+
storage_class: (0, templateRefSchema_1.resolvableEnum)([
|
|
110
|
+
'STANDARD_CAPACITY',
|
|
111
|
+
'STANDARD_PERFORMANCE',
|
|
112
|
+
'EXTREME_STANDARD',
|
|
113
|
+
'EXTREME_ADVANCE',
|
|
114
|
+
]),
|
|
110
115
|
additionalProperties: false,
|
|
111
116
|
},
|
|
112
117
|
required: ['mount_path', 'storage_class'],
|
|
@@ -12,16 +12,32 @@ const eventSchema_1 = require("./eventSchema");
|
|
|
12
12
|
const functionSchema_1 = require("./functionSchema");
|
|
13
13
|
const bucketSchema_1 = require("./bucketSchema");
|
|
14
14
|
const tableschema_1 = require("./tableschema");
|
|
15
|
+
const lang_1 = require("../lang");
|
|
15
16
|
class IacSchemaErrors extends Error {
|
|
16
17
|
constructor(errors) {
|
|
17
|
-
|
|
18
|
-
this.schemaErrors = errors.map((error) => ({
|
|
18
|
+
const schemaErrors = errors.map((error) => ({
|
|
19
19
|
instancePath: error.instancePath,
|
|
20
20
|
schemaPath: error.schemaPath,
|
|
21
21
|
message: error.message,
|
|
22
22
|
allowedValues: error.params?.allowedValues,
|
|
23
23
|
type: error.keyword,
|
|
24
24
|
}));
|
|
25
|
+
const formattedMessage = schemaErrors
|
|
26
|
+
.map((error, index) => {
|
|
27
|
+
const parts = [
|
|
28
|
+
`Error ${index + 1}:`,
|
|
29
|
+
` Path: ${error.instancePath || '/'}`,
|
|
30
|
+
` Type: ${error.type}`,
|
|
31
|
+
` Message: ${error.message}`,
|
|
32
|
+
];
|
|
33
|
+
if (error.allowedValues) {
|
|
34
|
+
parts.push(` Allowed values: ${error.allowedValues.join(', ')}`);
|
|
35
|
+
}
|
|
36
|
+
return parts.join('\n');
|
|
37
|
+
})
|
|
38
|
+
.join('\n\n');
|
|
39
|
+
super(`Invalid yaml:\n\n${formattedMessage}`);
|
|
40
|
+
this.schemaErrors = schemaErrors;
|
|
25
41
|
}
|
|
26
42
|
get errors() {
|
|
27
43
|
return this.schemaErrors;
|
|
@@ -35,12 +51,45 @@ const validate = ajv
|
|
|
35
51
|
.addSchema(tableschema_1.tableSchema)
|
|
36
52
|
.addSchema(bucketSchema_1.bucketSchema)
|
|
37
53
|
.compile(rootSchema_1.rootSchema);
|
|
54
|
+
const validateRuntimeCompatibility = (iacJson) => {
|
|
55
|
+
if (!iacJson.functions) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const provider = iacJson.provider?.name;
|
|
59
|
+
if (!provider) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const errors = [];
|
|
63
|
+
Object.entries(iacJson.functions).forEach(([functionKey, functionConfig]) => {
|
|
64
|
+
const runtime = functionConfig.code?.runtime;
|
|
65
|
+
if (!runtime || typeof runtime !== 'string') {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (runtime.startsWith('${')) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (!(0, common_1.isRuntimeSupported)(runtime, provider)) {
|
|
72
|
+
const supportedRuntimes = (0, common_1.getSupportedRuntimes)(provider);
|
|
73
|
+
errors.push({
|
|
74
|
+
instancePath: `/functions/${functionKey}/code/runtime`,
|
|
75
|
+
schemaPath: '#/properties/functions/patternProperties/.*/properties/code/properties/runtime',
|
|
76
|
+
keyword: 'providerCompatibility',
|
|
77
|
+
params: { allowedValues: supportedRuntimes },
|
|
78
|
+
message: `runtime '${runtime}' is not supported by provider '${provider}'`,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
if (errors.length > 0) {
|
|
83
|
+
throw new IacSchemaErrors(errors);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
38
86
|
const validateYaml = (iacJson) => {
|
|
39
87
|
const valid = validate(iacJson);
|
|
40
88
|
if (!valid) {
|
|
41
|
-
common_1.logger.debug(
|
|
89
|
+
common_1.logger.debug(lang_1.lang.__('INVALID_YAML', { errors: JSON.stringify(validate.errors) }));
|
|
42
90
|
throw new IacSchemaErrors(validate.errors);
|
|
43
91
|
}
|
|
92
|
+
validateRuntimeCompatibility(iacJson);
|
|
44
93
|
return true;
|
|
45
94
|
};
|
|
46
95
|
exports.validateYaml = validateYaml;
|
|
@@ -9,9 +9,55 @@ exports.rootSchema = {
|
|
|
9
9
|
provider: {
|
|
10
10
|
type: 'object',
|
|
11
11
|
properties: {
|
|
12
|
-
name: { type: 'string', enum: ['huawei', 'aliyun'] },
|
|
12
|
+
name: { type: 'string', enum: ['huawei', 'aliyun', 'tencent', 'aws'] },
|
|
13
13
|
region: { type: 'string' },
|
|
14
14
|
},
|
|
15
|
+
required: ['name', 'region'],
|
|
16
|
+
allOf: [
|
|
17
|
+
{
|
|
18
|
+
if: {
|
|
19
|
+
properties: {
|
|
20
|
+
name: { const: 'aliyun' },
|
|
21
|
+
},
|
|
22
|
+
required: ['name'],
|
|
23
|
+
},
|
|
24
|
+
then: {
|
|
25
|
+
properties: {
|
|
26
|
+
region: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
enum: [
|
|
29
|
+
'cn-qingdao',
|
|
30
|
+
'cn-beijing',
|
|
31
|
+
'cn-zhangjiakou',
|
|
32
|
+
'cn-huhehaote',
|
|
33
|
+
'cn-wulanchabu',
|
|
34
|
+
'cn-hangzhou',
|
|
35
|
+
'cn-shanghai',
|
|
36
|
+
'cn-shenzhen',
|
|
37
|
+
'cn-heyuan',
|
|
38
|
+
'cn-guangzhou',
|
|
39
|
+
'cn-chengdu',
|
|
40
|
+
'cn-hongkong',
|
|
41
|
+
'ap-southeast-1',
|
|
42
|
+
'ap-southeast-3',
|
|
43
|
+
'ap-southeast-5',
|
|
44
|
+
'ap-southeast-6',
|
|
45
|
+
'ap-southeast-7',
|
|
46
|
+
'ap-northeast-1',
|
|
47
|
+
'ap-northeast-2',
|
|
48
|
+
'eu-central-1',
|
|
49
|
+
'eu-west-1',
|
|
50
|
+
'us-east-1',
|
|
51
|
+
'us-west-1',
|
|
52
|
+
'na-south-1',
|
|
53
|
+
'me-east-1',
|
|
54
|
+
'me-central-1',
|
|
55
|
+
],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
],
|
|
15
61
|
},
|
|
16
62
|
service: { type: 'string' },
|
|
17
63
|
vars: {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.tableSchema = void 0;
|
|
4
|
+
const templateRefSchema_1 = require("./templateRefSchema");
|
|
4
5
|
exports.tableSchema = {
|
|
5
6
|
$id: 'https://serverlessinsight.geekfun.club/schemas/tableschema.json',
|
|
6
7
|
type: 'object',
|
|
@@ -10,12 +11,12 @@ exports.tableSchema = {
|
|
|
10
11
|
properties: {
|
|
11
12
|
collection: { type: 'string' },
|
|
12
13
|
name: { type: 'string' },
|
|
13
|
-
type:
|
|
14
|
+
type: (0, templateRefSchema_1.resolvableEnum)(['TABLE_STORE_C', 'TABLE_STORE_H']),
|
|
14
15
|
desc: { type: 'string', maxLength: 256 },
|
|
15
16
|
network: {
|
|
16
17
|
type: 'object',
|
|
17
18
|
properties: {
|
|
18
|
-
type:
|
|
19
|
+
type: (0, templateRefSchema_1.resolvableEnum)(['PUBLIC', 'PRIVATE']),
|
|
19
20
|
ingress_rules: {
|
|
20
21
|
type: 'array',
|
|
21
22
|
items: { type: 'string' },
|
|
@@ -29,15 +30,15 @@ exports.tableSchema = {
|
|
|
29
30
|
reserved: {
|
|
30
31
|
type: 'object',
|
|
31
32
|
properties: {
|
|
32
|
-
read:
|
|
33
|
-
write:
|
|
33
|
+
read: templateRefSchema_1.resolvableInteger,
|
|
34
|
+
write: templateRefSchema_1.resolvableInteger,
|
|
34
35
|
},
|
|
35
36
|
},
|
|
36
37
|
on_demand: {
|
|
37
38
|
type: 'object',
|
|
38
39
|
properties: {
|
|
39
|
-
read:
|
|
40
|
-
write:
|
|
40
|
+
read: templateRefSchema_1.resolvableInteger,
|
|
41
|
+
write: templateRefSchema_1.resolvableInteger,
|
|
41
42
|
},
|
|
42
43
|
},
|
|
43
44
|
},
|
|
@@ -48,7 +49,7 @@ exports.tableSchema = {
|
|
|
48
49
|
type: 'object',
|
|
49
50
|
properties: {
|
|
50
51
|
name: { type: 'string' },
|
|
51
|
-
type:
|
|
52
|
+
type: (0, templateRefSchema_1.resolvableEnum)(['HASH', 'RANGE']),
|
|
52
53
|
},
|
|
53
54
|
required: ['name', 'type'],
|
|
54
55
|
},
|
|
@@ -59,7 +60,7 @@ exports.tableSchema = {
|
|
|
59
60
|
type: 'object',
|
|
60
61
|
properties: {
|
|
61
62
|
name: { type: 'string' },
|
|
62
|
-
type:
|
|
63
|
+
type: (0, templateRefSchema_1.resolvableEnum)(['STRING', 'INTEGER', 'DOUBLE', 'BOOLEAN', 'BINARY']),
|
|
63
64
|
},
|
|
64
65
|
required: ['name', 'type'],
|
|
65
66
|
},
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolvableEnum = exports.resolvableBoolean = exports.resolvableInteger = exports.resolvableNumber = void 0;
|
|
4
|
+
// Template reference pattern that matches ${vars.xxx}, ${stages.xxx}, ${ctx.xxx}, ${functions.xxx}
|
|
5
|
+
// Note: ${functions.xxx} references are kept as strings and resolved by infrastructure stack (ROS/Terraform)
|
|
6
|
+
// Only ${vars.xxx}, ${stages.xxx}, and ${ctx.xxx} are resolved at parse time
|
|
7
|
+
const templateRefPattern = '^\\$\\{(vars|stages|ctx|functions)\\.[\\w.]+\\}$';
|
|
8
|
+
// Schema definition for a template reference string
|
|
9
|
+
const templateRefSchema = {
|
|
10
|
+
type: 'string',
|
|
11
|
+
pattern: templateRefPattern,
|
|
12
|
+
};
|
|
13
|
+
// Helper function to create a oneOf schema for a type that can also be a template reference
|
|
14
|
+
const withTemplateRef = (schema) => ({
|
|
15
|
+
oneOf: [schema, templateRefSchema],
|
|
16
|
+
});
|
|
17
|
+
// Common resolvable type schemas
|
|
18
|
+
exports.resolvableNumber = withTemplateRef({ type: 'number' });
|
|
19
|
+
exports.resolvableInteger = withTemplateRef({ type: 'integer' });
|
|
20
|
+
exports.resolvableBoolean = withTemplateRef({ type: 'boolean' });
|
|
21
|
+
// Helper for enum types that can also be template refs
|
|
22
|
+
const resolvableEnum = (enumValues) => withTemplateRef({ type: 'string', enum: enumValues });
|
|
23
|
+
exports.resolvableEnum = resolvableEnum;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/index.ts","../src/commands/deploy.ts","../src/commands/destroy.ts","../src/commands/index.ts","../src/commands/local.ts","../src/commands/template.ts","../src/commands/validate.ts","../src/common/base64.ts","../src/common/constants.ts","../src/common/context.ts","../src/common/getVersion.ts","../src/common/iacHelper.ts","../src/common/imsClient.ts","../src/common/index.ts","../src/common/logger.ts","../src/common/providerEnum.ts","../src/common/requestHelper.ts","../src/common/
|
|
1
|
+
{"root":["../src/index.ts","../src/commands/deploy.ts","../src/commands/destroy.ts","../src/commands/forceUnlock.ts","../src/commands/index.ts","../src/commands/local.ts","../src/commands/plan.ts","../src/commands/template.ts","../src/commands/validate.ts","../src/common/base64.ts","../src/common/constants.ts","../src/common/context.ts","../src/common/credentials.ts","../src/common/fileUtils.ts","../src/common/getVersion.ts","../src/common/hashUtils.ts","../src/common/iacHelper.ts","../src/common/imsClient.ts","../src/common/index.ts","../src/common/lockManager.ts","../src/common/logger.ts","../src/common/providerEnum.ts","../src/common/requestHelper.ts","../src/common/runtimeMapper.ts","../src/common/scfClient.ts","../src/common/stateManager.ts","../src/common/aliyunClient/apigwOperations.ts","../src/common/aliyunClient/dnsOperations.ts","../src/common/aliyunClient/ecsOperations.ts","../src/common/aliyunClient/esOperations.ts","../src/common/aliyunClient/fc3Operations.ts","../src/common/aliyunClient/index.ts","../src/common/aliyunClient/nasOperations.ts","../src/common/aliyunClient/ossOperations.ts","../src/common/aliyunClient/ramOperations.ts","../src/common/aliyunClient/rdsOperations.ts","../src/common/aliyunClient/slsOperations.ts","../src/common/aliyunClient/tablestoreOperations.ts","../src/common/aliyunClient/types.ts","../src/common/dependencyGraph/graph.ts","../src/common/dependencyGraph/index.ts","../src/common/dependencyGraph/types.ts","../src/common/tencentClient/cosOperations.ts","../src/common/tencentClient/esOperations.ts","../src/common/tencentClient/index.ts","../src/common/tencentClient/scfOperations.ts","../src/common/tencentClient/tdsqlcOperations.ts","../src/common/tencentClient/types.ts","../src/lang/en.ts","../src/lang/index.ts","../src/lang/zh-CN.ts","../src/parser/bucketParser.ts","../src/parser/databaseParser.ts","../src/parser/eventParser.ts","../src/parser/functionParser.ts","../src/parser/index.ts","../src/parser/parseUtils.ts","../src/parser/tableParser.ts","../src/parser/tagParser.ts","../src/stack/bucketTypes.ts","../src/stack/deploy.ts","../src/stack/index.ts","../src/stack/aliyunStack/apigwExecutor.ts","../src/stack/aliyunStack/apigwPlanner.ts","../src/stack/aliyunStack/apigwResource.ts","../src/stack/aliyunStack/apigwTypes.ts","../src/stack/aliyunStack/databaseExecutor.ts","../src/stack/aliyunStack/databasePlanner.ts","../src/stack/aliyunStack/databaseResource.ts","../src/stack/aliyunStack/deployer.ts","../src/stack/aliyunStack/destroyer.ts","../src/stack/aliyunStack/esServerlessTypes.ts","../src/stack/aliyunStack/fc3Executor.ts","../src/stack/aliyunStack/fc3Planner.ts","../src/stack/aliyunStack/fc3Resource.ts","../src/stack/aliyunStack/fc3Types.ts","../src/stack/aliyunStack/index.ts","../src/stack/aliyunStack/ossExecutor.ts","../src/stack/aliyunStack/ossPlanner.ts","../src/stack/aliyunStack/ossResource.ts","../src/stack/aliyunStack/ossTypes.ts","../src/stack/aliyunStack/planner.ts","../src/stack/aliyunStack/rdsTypes.ts","../src/stack/aliyunStack/tablestoreExecutor.ts","../src/stack/aliyunStack/tablestorePlanner.ts","../src/stack/aliyunStack/tablestoreResource.ts","../src/stack/aliyunStack/tablestoreTypes.ts","../src/stack/localStack/aliyunFc.ts","../src/stack/localStack/bucket.ts","../src/stack/localStack/event.ts","../src/stack/localStack/function.ts","../src/stack/localStack/functionRunner.ts","../src/stack/localStack/index.ts","../src/stack/localStack/localServer.ts","../src/stack/localStack/utils.ts","../src/stack/rfsStack/function.ts","../src/stack/rfsStack/index.ts","../src/stack/scfStack/cosExecutor.ts","../src/stack/scfStack/cosPlanner.ts","../src/stack/scfStack/cosResource.ts","../src/stack/scfStack/cosTypes.ts","../src/stack/scfStack/deployer.ts","../src/stack/scfStack/destroyer.ts","../src/stack/scfStack/esServerlessExecutor.ts","../src/stack/scfStack/esServerlessPlanner.ts","../src/stack/scfStack/esServerlessResource.ts","../src/stack/scfStack/esServerlessTypes.ts","../src/stack/scfStack/index.ts","../src/stack/scfStack/planner.ts","../src/stack/scfStack/scfExecutor.ts","../src/stack/scfStack/scfPlanner.ts","../src/stack/scfStack/scfResource.ts","../src/stack/scfStack/scfTypes.ts","../src/stack/scfStack/tdsqlcExecutor.ts","../src/stack/scfStack/tdsqlcPlanner.ts","../src/stack/scfStack/tdsqlcResource.ts","../src/stack/scfStack/tdsqlcTypes.ts","../src/types/assets.ts","../src/types/index.ts","../src/types/tablestore.d.ts","../src/types/domains/bucket.ts","../src/types/domains/context.ts","../src/types/domains/database.ts","../src/types/domains/event.ts","../src/types/domains/function.ts","../src/types/domains/lock.ts","../src/types/domains/provider.ts","../src/types/domains/resolvable.ts","../src/types/domains/state.ts","../src/types/domains/table.ts","../src/types/domains/tag.ts","../src/types/domains/vars.ts","../src/types/localStack/index.ts","../src/validator/bucketSchema.ts","../src/validator/databaseSchema.ts","../src/validator/eventSchema.ts","../src/validator/functionSchema.ts","../src/validator/iacSchema.ts","../src/validator/index.ts","../src/validator/rootSchema.ts","../src/validator/tableschema.ts","../src/validator/templateRefSchema.ts"],"version":"5.9.3"}
|