@geek-fun/serverlessinsight 0.4.1 → 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.
Files changed (164) hide show
  1. package/.gitattributes +1 -0
  2. package/README.md +108 -8
  3. package/README.zh-CN.md +52 -8
  4. package/dist/package.json +37 -35
  5. package/dist/src/commands/deploy.js +17 -7
  6. package/dist/src/commands/destroy.js +27 -4
  7. package/dist/src/commands/forceUnlock.js +61 -0
  8. package/dist/src/commands/index.js +41 -5
  9. package/dist/src/commands/local.js +10 -1
  10. package/dist/src/commands/plan.js +33 -0
  11. package/dist/src/commands/template.js +1 -1
  12. package/dist/src/commands/validate.js +2 -1
  13. package/dist/src/common/aliyunClient/apigwOperations.js +652 -0
  14. package/dist/src/common/aliyunClient/dnsOperations.js +90 -0
  15. package/dist/src/common/aliyunClient/ecsOperations.js +141 -0
  16. package/dist/src/common/aliyunClient/esOperations.js +219 -0
  17. package/dist/src/common/aliyunClient/fc3Operations.js +270 -0
  18. package/dist/src/common/aliyunClient/index.js +141 -0
  19. package/dist/src/common/aliyunClient/nasOperations.js +233 -0
  20. package/dist/src/common/aliyunClient/ossOperations.js +237 -0
  21. package/dist/src/common/aliyunClient/ramOperations.js +205 -0
  22. package/dist/src/common/aliyunClient/rdsOperations.js +206 -0
  23. package/dist/src/common/aliyunClient/slsOperations.js +218 -0
  24. package/dist/src/common/aliyunClient/tablestoreOperations.js +199 -0
  25. package/dist/src/common/aliyunClient/types.js +2 -0
  26. package/dist/src/common/constants.js +6 -1
  27. package/dist/src/common/context.js +13 -3
  28. package/dist/src/common/credentials.js +30 -6
  29. package/dist/src/common/dependencyGraph/graph.js +280 -0
  30. package/dist/src/common/dependencyGraph/index.js +18 -0
  31. package/dist/src/common/dependencyGraph/types.js +2 -0
  32. package/dist/src/common/fileUtils.js +16 -0
  33. package/dist/src/common/hashUtils.js +121 -0
  34. package/dist/src/common/iacHelper.js +25 -97
  35. package/dist/src/common/imsClient.js +4 -0
  36. package/dist/src/common/index.js +6 -2
  37. package/dist/src/common/lockManager.js +212 -0
  38. package/dist/src/common/logger.js +87 -10
  39. package/dist/src/common/providerEnum.js +2 -3
  40. package/dist/src/common/runtimeMapper.js +160 -0
  41. package/dist/src/common/scfClient.js +84 -0
  42. package/dist/src/common/stateManager.js +107 -0
  43. package/dist/src/common/tencentClient/cosOperations.js +287 -0
  44. package/dist/src/common/tencentClient/esOperations.js +156 -0
  45. package/dist/src/common/tencentClient/index.js +116 -0
  46. package/dist/src/common/tencentClient/scfOperations.js +141 -0
  47. package/dist/src/common/tencentClient/tdsqlcOperations.js +211 -0
  48. package/dist/src/common/tencentClient/types.js +17 -0
  49. package/dist/src/lang/en.js +254 -0
  50. package/dist/src/lang/index.js +28 -8
  51. package/dist/src/lang/zh-CN.js +229 -0
  52. package/dist/src/parser/bucketParser.js +25 -12
  53. package/dist/src/parser/databaseParser.js +14 -10
  54. package/dist/src/parser/functionParser.js +19 -6
  55. package/dist/src/parser/parseUtils.js +74 -0
  56. package/dist/src/parser/tableParser.js +19 -17
  57. package/dist/src/stack/aliyunStack/apigwExecutor.js +84 -0
  58. package/dist/src/stack/aliyunStack/apigwPlanner.js +118 -0
  59. package/dist/src/stack/aliyunStack/apigwResource.js +339 -0
  60. package/dist/src/stack/aliyunStack/apigwTypes.js +125 -0
  61. package/dist/src/stack/aliyunStack/databaseExecutor.js +112 -0
  62. package/dist/src/stack/aliyunStack/databasePlanner.js +128 -0
  63. package/dist/src/stack/aliyunStack/databaseResource.js +228 -0
  64. package/dist/src/stack/aliyunStack/deployer.js +133 -0
  65. package/dist/src/stack/aliyunStack/destroyer.js +114 -0
  66. package/dist/src/stack/aliyunStack/esServerlessTypes.js +141 -0
  67. package/dist/src/stack/aliyunStack/fc3Executor.js +91 -0
  68. package/dist/src/stack/aliyunStack/fc3Planner.js +77 -0
  69. package/dist/src/stack/aliyunStack/fc3Resource.js +511 -0
  70. package/dist/src/stack/aliyunStack/fc3Types.js +76 -0
  71. package/dist/src/stack/aliyunStack/index.js +40 -0
  72. package/dist/src/stack/aliyunStack/ossExecutor.js +91 -0
  73. package/dist/src/stack/aliyunStack/ossPlanner.js +76 -0
  74. package/dist/src/stack/aliyunStack/ossResource.js +196 -0
  75. package/dist/src/stack/aliyunStack/ossTypes.js +50 -0
  76. package/dist/src/stack/aliyunStack/planner.js +37 -0
  77. package/dist/src/stack/aliyunStack/rdsTypes.js +217 -0
  78. package/dist/src/stack/aliyunStack/tablestoreExecutor.js +92 -0
  79. package/dist/src/stack/aliyunStack/tablestorePlanner.js +94 -0
  80. package/dist/src/stack/aliyunStack/tablestoreResource.js +120 -0
  81. package/dist/src/stack/aliyunStack/tablestoreTypes.js +77 -0
  82. package/dist/src/stack/bucketTypes.js +17 -0
  83. package/dist/src/stack/deploy.js +24 -77
  84. package/dist/src/stack/localStack/bucket.js +11 -6
  85. package/dist/src/stack/localStack/event.js +10 -5
  86. package/dist/src/stack/localStack/function.js +13 -7
  87. package/dist/src/stack/localStack/functionRunner.js +1 -1
  88. package/dist/src/stack/localStack/localServer.js +7 -6
  89. package/dist/src/stack/scfStack/cosExecutor.js +91 -0
  90. package/dist/src/stack/scfStack/cosPlanner.js +76 -0
  91. package/dist/src/stack/scfStack/cosResource.js +126 -0
  92. package/dist/src/stack/scfStack/cosTypes.js +46 -0
  93. package/dist/src/stack/scfStack/deployer.js +91 -0
  94. package/dist/src/stack/scfStack/destroyer.js +88 -0
  95. package/dist/src/stack/scfStack/esServerlessExecutor.js +105 -0
  96. package/dist/src/stack/scfStack/esServerlessPlanner.js +86 -0
  97. package/dist/src/stack/scfStack/esServerlessResource.js +94 -0
  98. package/dist/src/stack/scfStack/esServerlessTypes.js +48 -0
  99. package/dist/src/stack/scfStack/index.js +35 -0
  100. package/dist/src/stack/scfStack/planner.js +91 -0
  101. package/dist/src/stack/scfStack/scfExecutor.js +91 -0
  102. package/dist/src/stack/scfStack/scfPlanner.js +78 -0
  103. package/dist/src/stack/scfStack/scfResource.js +216 -0
  104. package/dist/src/stack/scfStack/scfTypes.js +41 -0
  105. package/dist/src/stack/scfStack/tdsqlcExecutor.js +105 -0
  106. package/dist/src/stack/scfStack/tdsqlcPlanner.js +90 -0
  107. package/dist/src/stack/scfStack/tdsqlcResource.js +146 -0
  108. package/dist/src/stack/scfStack/tdsqlcTypes.js +59 -0
  109. package/dist/src/types/domains/lock.js +2 -0
  110. package/dist/src/types/domains/resolvable.js +2 -0
  111. package/dist/src/types/domains/state.js +19 -0
  112. package/dist/src/types/index.js +4 -0
  113. package/dist/src/validator/bucketSchema.js +4 -10
  114. package/dist/src/validator/databaseSchema.js +36 -36
  115. package/dist/src/validator/eventSchema.js +3 -2
  116. package/dist/src/validator/functionSchema.js +51 -46
  117. package/dist/src/validator/iacSchema.js +35 -1
  118. package/dist/src/validator/rootSchema.js +1 -1
  119. package/dist/src/validator/tableschema.js +9 -8
  120. package/dist/src/validator/templateRefSchema.js +23 -0
  121. package/dist/tsconfig.tsbuildinfo +1 -1
  122. package/package.json +37 -35
  123. package/samples/README_TENCENT_COS.md +486 -0
  124. package/samples/README_TENCENT_SCF.md +272 -0
  125. package/samples/aliyun-poc-api.yml +1 -1
  126. package/samples/aliyun-poc-bucket.yml +0 -1
  127. package/samples/aliyun-poc-domain.yml +0 -1
  128. package/samples/aliyun-poc-es.yml +4 -7
  129. package/samples/aliyun-poc-rds.yml +0 -2
  130. package/samples/aliyun-poc-table.yml +1 -3
  131. package/samples/tencent-poc-cos.yml +20 -0
  132. package/samples/tencent-poc-scf.yml +36 -0
  133. package/dist/src/commands/index.d.ts +0 -2
  134. package/dist/src/common/index.d.ts +0 -12
  135. package/dist/src/common/rosAssets.js +0 -178
  136. package/dist/src/common/rosClient.js +0 -201
  137. package/dist/src/index.d.ts +0 -1
  138. package/dist/src/lang/index.d.ts +0 -3
  139. package/dist/src/parser/index.d.ts +0 -3
  140. package/dist/src/stack/index.d.ts +0 -1
  141. package/dist/src/stack/localStack/index.d.ts +0 -5
  142. package/dist/src/stack/rfsStack/index.d.ts +0 -9
  143. package/dist/src/stack/rosStack/bootstrap.js +0 -187
  144. package/dist/src/stack/rosStack/bucket.js +0 -127
  145. package/dist/src/stack/rosStack/database.js +0 -313
  146. package/dist/src/stack/rosStack/event.js +0 -143
  147. package/dist/src/stack/rosStack/function.js +0 -259
  148. package/dist/src/stack/rosStack/index.d.ts +0 -7
  149. package/dist/src/stack/rosStack/index.js +0 -75
  150. package/dist/src/stack/rosStack/stage.js +0 -46
  151. package/dist/src/stack/rosStack/table.js +0 -95
  152. package/dist/src/stack/rosStack/tag.js +0 -11
  153. package/dist/src/stack/rosStack/vars.js +0 -49
  154. package/dist/src/types/index.d.ts +0 -55
  155. package/dist/src/types/localStack/index.d.ts +0 -81
  156. package/dist/src/validator/index.d.ts +0 -1
  157. package/layers/si-bootstrap-sdk/Dockerfile-aliyuncli +0 -12
  158. package/layers/si-bootstrap-sdk/README.md +0 -64
  159. package/layers/si-bootstrap-sdk/package-lock.json +0 -881
  160. package/layers/si-bootstrap-sdk/package.json +0 -33
  161. package/layers/si-bootstrap-sdk/support/operation-collection/README.md +0 -47
  162. package/layers/si-bootstrap-sdk/support/operation-collection/package-lock.json +0 -298
  163. package/layers/si-bootstrap-sdk/support/operation-collection/package.json +0 -18
  164. package/layers/si-bootstrap-sdk/support/operation-collection/publish.js +0 -257
@@ -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';
@@ -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
- type: 'string',
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
- type: 'string',
14
- enum: [
15
- 'ELASTICSEARCH_SERVERLESS',
16
- 'RDS_MYSQL_SERVERLESS',
17
- 'RDS_PGSQL_SERVERLESS',
18
- 'RDS_MSSQL_SERVERLESS',
19
- ],
20
- },
21
- version: {
22
- type: 'string',
23
- enum: [
24
- 'MYSQL_5.7',
25
- 'MYSQL_8.0',
26
- 'MYSQL_HA_5.7',
27
- 'MYSQL_HA_8.0',
28
- 'PGSQL_14',
29
- 'PGSQL_15',
30
- 'PGSQL_16',
31
- 'PGSQL_HA_14',
32
- 'PGSQL_HA_15',
33
- 'PGSQL_HA_16',
34
- 'MSSQL_HA_2016',
35
- 'MSSQL_HA_2017',
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: { type: 'integer', minimum: 0, maximum: 32 },
45
- max: { type: 'integer', minimum: 1, maximum: 32 },
40
+ min: templateRefSchema_1.resolvableNumber,
41
+ max: templateRefSchema_1.resolvableNumber,
46
42
  },
47
43
  },
48
44
  storage: {
49
45
  type: 'object',
50
- properties: { min: { type: 'integer', minimum: 20 } },
51
- required: ['min'],
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: ['master_user', 'password'],
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: { type: 'string', enum: ['PUBLIC', 'PRIVATE'] },
68
+ type: (0, templateRefSchema_1.resolvableEnum)(['PUBLIC', 'PRIVATE']),
71
69
  ingress_rules: {
72
70
  type: 'array',
73
71
  items: { type: 'string' },
74
72
  },
75
- public: { type: 'boolean' },
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: { type: 'string', enum: ['API_GATEWAY'] },
13
+ type: (0, templateRefSchema_1.resolvableEnum)(['API_GATEWAY']),
13
14
  triggers: {
14
15
  type: 'array',
15
16
  items: {
16
- method: { type: 'string', enum: ['GET', 'POST', 'PUT', 'DELETE', 'ANY'] },
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
- type: 'string',
20
- enum: [
21
- 'nodejs20',
22
- 'nodejs18',
23
- 'nodejs16',
24
- 'nodejs14',
25
- 'nodejs12',
26
- 'nodejs10',
27
- 'nodejs8',
28
- 'python3.10',
29
- 'python3.9',
30
- 'python3',
31
- 'PHP 7.2',
32
- 'Java 11',
33
- '.NET Core 3.1',
34
- 'Go 1.x',
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: { type: 'number' },
59
+ port: templateRefSchema_1.resolvableNumber,
49
60
  },
50
61
  },
51
- memory: { type: 'number' },
52
- gpu: {
53
- type: 'string',
54
- enum: [
55
- 'TESLA_8',
56
- 'TESLA_12',
57
- 'TESLA_16',
58
- 'AMPERE_8',
59
- 'AMPERE_12',
60
- 'AMPERE_16',
61
- 'AMPERE_24',
62
- 'ADA_48',
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: { type: 'number' },
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
- type: 'string',
103
- enum: [
104
- 'STANDARD_CAPACITY',
105
- 'STANDARD_PERFORMANCE',
106
- 'EXTREME_STANDARD',
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,6 +12,7 @@ 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
  const schemaErrors = errors.map((error) => ({
@@ -50,12 +51,45 @@ const validate = ajv
50
51
  .addSchema(tableschema_1.tableSchema)
51
52
  .addSchema(bucketSchema_1.bucketSchema)
52
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
+ };
53
86
  const validateYaml = (iacJson) => {
54
87
  const valid = validate(iacJson);
55
88
  if (!valid) {
56
- common_1.logger.debug(`Invalid yaml: ${JSON.stringify(validate.errors)}`);
89
+ common_1.logger.debug(lang_1.lang.__('INVALID_YAML', { errors: JSON.stringify(validate.errors) }));
57
90
  throw new IacSchemaErrors(validate.errors);
58
91
  }
92
+ validateRuntimeCompatibility(iacJson);
59
93
  return true;
60
94
  };
61
95
  exports.validateYaml = validateYaml;
@@ -9,7 +9,7 @@ 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
15
  required: ['name', 'region'],
@@ -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: { type: 'string', enum: ['TABLE_STORE_C', 'TABLE_STORE_H'] },
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: { type: 'string', enum: ['PUBLIC', 'PRIVATE'] },
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: { type: 'integer' },
33
- write: { type: 'integer' },
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: { type: 'integer' },
40
- write: { type: 'integer' },
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: { type: 'string', enum: ['HASH', 'RANGE'] },
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: { type: 'string', enum: ['STRING', 'INTEGER', 'DOUBLE', 'BOOLEAN', 'BINARY'] },
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/credentials.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/rosAssets.ts","../src/common/rosClient.ts","../src/lang/index.ts","../src/parser/bucketParser.ts","../src/parser/databaseParser.ts","../src/parser/eventParser.ts","../src/parser/functionParser.ts","../src/parser/index.ts","../src/parser/tableParser.ts","../src/parser/tagParser.ts","../src/stack/deploy.ts","../src/stack/index.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/rosStack/bootstrap.ts","../src/stack/rosStack/bucket.ts","../src/stack/rosStack/database.ts","../src/stack/rosStack/event.ts","../src/stack/rosStack/function.ts","../src/stack/rosStack/index.ts","../src/stack/rosStack/stage.ts","../src/stack/rosStack/table.ts","../src/stack/rosStack/tag.ts","../src/stack/rosStack/vars.ts","../src/types/assets.ts","../src/types/index.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/provider.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"],"version":"5.9.3"}
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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geek-fun/serverlessinsight",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Full life cycle cross providers serverless application management for your fast-growing business.",
5
5
  "homepage": "https://serverlessinsight.geekfun.club",
6
6
  "main": "dist/src/index.js",
@@ -9,7 +9,7 @@
9
9
  "si": "dist/src/commands/index.js"
10
10
  },
11
11
  "scripts": {
12
- "test": "DEBUG=ServerlessInsight jest --runInBand --detectOpenHandles --coverage --coverageReporters json-summary text html lcov",
12
+ "test": "cross-env DEBUG=ServerlessInsight jest --runInBand --detectOpenHandles --coverage --coverageReporters json-summary text html lcov",
13
13
  "test:ci": "jest --runInBand --ci --coverage --coverageReporters json-summary text html lcov",
14
14
  "build": "tsc --build",
15
15
  "lint:fix": "eslint --fix ./",
@@ -49,54 +49,56 @@
49
49
  "function"
50
50
  ],
51
51
  "dependencies": {
52
- "@alicloud/ims20190815": "^2.3.2",
52
+ "@alicloud/alidns20150109": "^4.3.1",
53
+ "@alicloud/cloudapi20160714": "^4.7.9",
54
+ "@alicloud/ecs20140526": "^7.6.0",
55
+ "@alicloud/es-serverless20230627": "^2.3.0",
56
+ "@alicloud/fc20230330": "^4.6.8",
57
+ "@alicloud/ims20190815": "^2.3.3",
58
+ "@alicloud/nas20170626": "^3.3.1",
53
59
  "@alicloud/openapi-client": "^0.4.15",
54
- "@alicloud/ros-cdk-apigateway": "^1.11.0",
55
- "@alicloud/ros-cdk-core": "^1.11.0",
56
- "@alicloud/ros-cdk-dns": "^1.11.0",
57
- "@alicloud/ros-cdk-ecs": "^1.11.0",
58
- "@alicloud/ros-cdk-elasticsearchserverless": "^1.11.0",
59
- "@alicloud/ros-cdk-fc3": "^1.11.0",
60
- "@alicloud/ros-cdk-nas": "^1.11.0",
61
- "@alicloud/ros-cdk-oss": "^1.11.0",
62
- "@alicloud/ros-cdk-ossdeployment": "^1.11.0",
63
- "@alicloud/ros-cdk-ots": "^1.11.0",
64
- "@alicloud/ros-cdk-ram": "^1.11.0",
65
- "@alicloud/ros-cdk-rds": "^1.11.0",
66
- "@alicloud/ros-cdk-ros": "^1.11.0",
67
- "@alicloud/ros-cdk-sls": "^1.11.0",
68
- "@alicloud/ros-cdk-vpc": "^1.11.0",
69
- "@alicloud/ros20190910": "^3.6.0",
70
- "ajv": "^8.17.1",
60
+ "@alicloud/ram20150501": "^1.2.0",
61
+ "@alicloud/rds20140815": "^15.5.1",
62
+ "@alicloud/sls20201230": "^5.9.0",
63
+ "ajv": "^8.18.0",
71
64
  "ali-oss": "^6.23.0",
72
- "chalk": "^5.6.2",
73
- "commander": "^14.0.2",
74
- "i": "^0.3.7",
65
+ "commander": "^14.0.3",
66
+ "cos-nodejs-sdk-v5": "^2.16.0-beta.8",
75
67
  "i18n": "^0.15.3",
68
+ "iconv-lite": "^0.7.2",
76
69
  "jszip": "^3.10.1",
77
- "lodash": "^4.17.21",
78
- "npm": "^11.7.0",
79
- "pino": "^10.1.0",
70
+ "lodash": "^4.17.23",
71
+ "pino": "^10.3.1",
80
72
  "pino-pretty": "^13.1.3",
73
+ "tablestore": "^5.6.3",
74
+ "tencentcloud-sdk-nodejs-cynosdb": "^4.1.188",
75
+ "tencentcloud-sdk-nodejs-es": "^4.1.183",
76
+ "tencentcloud-sdk-nodejs-scf": "^4.1.168",
81
77
  "yaml": "^2.8.2"
82
78
  },
83
79
  "devDependencies": {
84
- "@types/ali-oss": "^6.16.13",
80
+ "@eslint/eslintrc": "^3.3.4",
81
+ "@eslint/js": "^10.0.1",
82
+ "@types/ali-oss": "^6.23.3",
85
83
  "@types/i18n": "^0.13.12",
86
84
  "@types/jest": "^30.0.0",
87
- "@types/lodash": "^4.17.21",
88
- "@types/node": "^25.0.3",
89
- "@typescript-eslint/eslint-plugin": "^8.50.0",
90
- "@typescript-eslint/parser": "^8.50.0",
91
- "eslint": "^9.39.2",
85
+ "@types/lodash": "^4.17.24",
86
+ "@types/node": "^25.3.2",
87
+ "@typescript-eslint/eslint-plugin": "^8.56.1",
88
+ "@typescript-eslint/parser": "^8.56.1",
89
+ "cross-env": "^10.1.0",
90
+ "eslint": "^10.0.2",
92
91
  "eslint-config-prettier": "^10.1.8",
93
- "eslint-plugin-prettier": "^5.5.4",
94
- "globals": "^16.5.0",
92
+ "eslint-plugin-prettier": "^5.5.5",
93
+ "globals": "^17.3.0",
95
94
  "husky": "^9.1.7",
96
95
  "jest": "^30.2.0",
97
- "prettier": "^3.7.4",
96
+ "prettier": "^3.8.1",
98
97
  "ts-jest": "^29.4.6",
99
98
  "ts-node": "^10.9.2",
100
99
  "typescript": "^5.9.3"
100
+ },
101
+ "overrides": {
102
+ "fast-xml-parser": ">=5.3.8"
101
103
  }
102
104
  }