@geek-fun/serverlessinsight 0.5.7 → 0.5.10
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/AGENTS.md +372 -0
- package/README.md +2 -2
- package/README.zh-CN.md +11 -8
- package/dist/package.json +1 -1
- package/dist/src/commands/index.js +5 -4
- package/dist/src/common/aliyunClient/apigwOperations.js +96 -9
- package/dist/src/common/aliyunClient/ossOperations.js +68 -0
- package/dist/src/common/aliyunClient/ramOperations.js +65 -20
- package/dist/src/common/tencentClient/cosOperations.js +123 -0
- package/dist/src/lang/en.js +137 -0
- package/dist/src/lang/index.js +6 -0
- package/dist/src/lang/zh-CN.js +136 -0
- package/dist/src/stack/aliyunStack/apigwExecutor.js +15 -9
- package/dist/src/stack/aliyunStack/apigwPlanner.js +15 -2
- package/dist/src/stack/aliyunStack/apigwResource.js +3 -3
- package/dist/src/stack/aliyunStack/apigwTypes.js +4 -3
- package/dist/src/stack/aliyunStack/databaseExecutor.js +24 -9
- package/dist/src/stack/aliyunStack/databaseResource.js +5 -1
- package/dist/src/stack/aliyunStack/deployer.js +11 -2
- package/dist/src/stack/aliyunStack/destroyer.js +5 -1
- package/dist/src/stack/aliyunStack/fc3Executor.js +10 -9
- package/dist/src/stack/aliyunStack/fc3Resource.js +36 -27
- package/dist/src/stack/aliyunStack/ossExecutor.js +9 -9
- package/dist/src/stack/aliyunStack/ossResource.js +19 -3
- package/dist/src/stack/aliyunStack/tablestoreExecutor.js +21 -9
- package/dist/src/stack/scfStack/cosExecutor.js +9 -9
- package/dist/src/stack/scfStack/cosResource.js +20 -3
- package/dist/src/stack/scfStack/deployer.js +5 -1
- package/dist/src/stack/scfStack/destroyer.js +5 -1
- package/dist/src/stack/scfStack/esServerlessExecutor.js +21 -9
- package/dist/src/stack/scfStack/esServerlessResource.js +2 -1
- package/dist/src/stack/scfStack/scfExecutor.js +9 -9
- package/dist/src/stack/scfStack/scfResource.js +2 -1
- package/dist/src/stack/scfStack/tdsqlcExecutor.js +9 -9
- package/dist/src/stack/scfStack/tdsqlcResource.js +5 -1
- package/dist/src/validator/bucketSchema.js +4 -0
- package/package.json +1 -1
|
@@ -6,27 +6,27 @@ const common_1 = require("../../common");
|
|
|
6
6
|
const stateManager_1 = require("../../common/stateManager");
|
|
7
7
|
const lang_1 = require("../../lang");
|
|
8
8
|
const executeCreateAction = async (context, fn, currentState) => {
|
|
9
|
-
common_1.logger.info(
|
|
9
|
+
common_1.logger.info(lang_1.lang.__('CREATING_RESOURCE', { resourceType: 'function', name: fn.name }));
|
|
10
10
|
const newState = await (0, scfResource_1.createResource)(context, fn, currentState);
|
|
11
|
-
common_1.logger.info(
|
|
11
|
+
common_1.logger.info(lang_1.lang.__('RESOURCE_CREATED', { resourceType: 'function', name: fn.name }));
|
|
12
12
|
return newState;
|
|
13
13
|
};
|
|
14
14
|
const executeUpdateAction = async (context, fn, currentState) => {
|
|
15
|
-
common_1.logger.info(
|
|
15
|
+
common_1.logger.info(lang_1.lang.__('UPDATING_RESOURCE', { resourceType: 'function', name: fn.name }));
|
|
16
16
|
const newState = await (0, scfResource_1.updateResource)(context, fn, currentState);
|
|
17
|
-
common_1.logger.info(
|
|
17
|
+
common_1.logger.info(lang_1.lang.__('RESOURCE_UPDATED', { resourceType: 'function', name: fn.name }));
|
|
18
18
|
return newState;
|
|
19
19
|
};
|
|
20
20
|
const executeDeleteAction = async (context, functionName, logicalId, currentState) => {
|
|
21
|
-
common_1.logger.info(
|
|
21
|
+
common_1.logger.info(lang_1.lang.__('DELETING_RESOURCE', { resourceType: 'function', name: functionName }));
|
|
22
22
|
const newState = await (0, scfResource_1.deleteResource)(context, functionName, logicalId, currentState);
|
|
23
|
-
common_1.logger.info(
|
|
23
|
+
common_1.logger.info(lang_1.lang.__('RESOURCE_DELETED', { resourceType: 'function', name: functionName }));
|
|
24
24
|
return newState;
|
|
25
25
|
};
|
|
26
26
|
const executeSingleItem = async (context, item, functionsMap, currentState) => {
|
|
27
27
|
switch (item.action) {
|
|
28
28
|
case 'noop':
|
|
29
|
-
common_1.logger.info(
|
|
29
|
+
common_1.logger.info(lang_1.lang.__('NO_CHANGESForResource', { logicalId: item.logicalId }));
|
|
30
30
|
return null;
|
|
31
31
|
case 'create': {
|
|
32
32
|
const fn = functionsMap.get(item.logicalId);
|
|
@@ -45,14 +45,14 @@ const executeSingleItem = async (context, item, functionsMap, currentState) => {
|
|
|
45
45
|
case 'delete': {
|
|
46
46
|
const state = (0, stateManager_1.getResource)(currentState, item.logicalId);
|
|
47
47
|
if (!state) {
|
|
48
|
-
common_1.logger.warn(
|
|
48
|
+
common_1.logger.warn(lang_1.lang.__('STATE_NOT_FOUND_SKIPPING', { logicalId: item.logicalId }));
|
|
49
49
|
return null;
|
|
50
50
|
}
|
|
51
51
|
const functionName = state.definition.functionName;
|
|
52
52
|
return executeDeleteAction(context, functionName, item.logicalId, currentState);
|
|
53
53
|
}
|
|
54
54
|
default:
|
|
55
|
-
common_1.logger.warn(
|
|
55
|
+
common_1.logger.warn(lang_1.lang.__('UNKNOWN_ACTION_FOR_RESOURCE', { action: item.action, logicalId: item.logicalId }));
|
|
56
56
|
return null;
|
|
57
57
|
}
|
|
58
58
|
};
|
|
@@ -8,6 +8,7 @@ const stateManager_1 = require("../../common/stateManager");
|
|
|
8
8
|
const common_1 = require("../../common");
|
|
9
9
|
const hashUtils_1 = require("../../common/hashUtils");
|
|
10
10
|
const logger_1 = require("../../common/logger");
|
|
11
|
+
const lang_1 = require("../../lang");
|
|
11
12
|
const buildScfInstanceFromProvider = (info, sid) => {
|
|
12
13
|
const envMap = info.Environment?.Variables?.reduce((acc, v) => ({ ...acc, [v.Key]: v.Value }), {}) ?? {};
|
|
13
14
|
const triggersArray = info.Triggers?.map((t) => ({
|
|
@@ -218,7 +219,7 @@ const deleteResource = async (context, functionName, logicalId, state) => {
|
|
|
218
219
|
catch (err) {
|
|
219
220
|
const errorCode = err?.code;
|
|
220
221
|
if (errorCode === 'ResourceNotFound.FunctionName') {
|
|
221
|
-
logger_1.logger.warn(
|
|
222
|
+
logger_1.logger.warn(lang_1.lang.__('RESOURCE_NOT_FOUND_PROVIDER', { resourceType: 'Function', name: functionName }));
|
|
222
223
|
}
|
|
223
224
|
else {
|
|
224
225
|
throw err;
|
|
@@ -6,21 +6,21 @@ const common_1 = require("../../common");
|
|
|
6
6
|
const stateManager_1 = require("../../common/stateManager");
|
|
7
7
|
const lang_1 = require("../../lang");
|
|
8
8
|
const executeCreateAction = async (context, database, currentState) => {
|
|
9
|
-
common_1.logger.info(
|
|
9
|
+
common_1.logger.info(lang_1.lang.__('CREATING_RESOURCE', { resourceType: 'TDSQL-C database', name: database.name }));
|
|
10
10
|
const newState = await (0, tdsqlcResource_1.createDatabaseResource)(context, database, currentState);
|
|
11
|
-
common_1.logger.info(
|
|
11
|
+
common_1.logger.info(lang_1.lang.__('RESOURCE_CREATED', { resourceType: 'TDSQL-C database', name: database.name }));
|
|
12
12
|
return newState;
|
|
13
13
|
};
|
|
14
14
|
const executeUpdateAction = async (context, database, clusterId, currentState) => {
|
|
15
|
-
common_1.logger.info(
|
|
15
|
+
common_1.logger.info(lang_1.lang.__('UPDATING_RESOURCE', { resourceType: 'TDSQL-C database', name: database.name }));
|
|
16
16
|
const newState = await (0, tdsqlcResource_1.updateDatabaseResource)(context, database, clusterId, currentState);
|
|
17
|
-
common_1.logger.info(
|
|
17
|
+
common_1.logger.info(lang_1.lang.__('RESOURCE_UPDATED', { resourceType: 'TDSQL-C database', name: database.name }));
|
|
18
18
|
return newState;
|
|
19
19
|
};
|
|
20
20
|
const executeDeleteAction = async (context, clusterId, logicalId, currentState) => {
|
|
21
|
-
common_1.logger.info(
|
|
21
|
+
common_1.logger.info(lang_1.lang.__('DELETING_RESOURCE', { resourceType: 'TDSQL-C database', name: clusterId }));
|
|
22
22
|
const newState = await (0, tdsqlcResource_1.deleteDatabaseResource)(context, clusterId, logicalId, currentState);
|
|
23
|
-
common_1.logger.info(
|
|
23
|
+
common_1.logger.info(lang_1.lang.__('RESOURCE_DELETED', { resourceType: 'TDSQL-C database', name: clusterId }));
|
|
24
24
|
return newState;
|
|
25
25
|
};
|
|
26
26
|
const executeSingleItem = async (context, item, databasesMap, currentState) => {
|
|
@@ -29,7 +29,7 @@ const executeSingleItem = async (context, item, databasesMap, currentState) => {
|
|
|
29
29
|
}
|
|
30
30
|
switch (item.action) {
|
|
31
31
|
case 'noop':
|
|
32
|
-
common_1.logger.info(
|
|
32
|
+
common_1.logger.info(lang_1.lang.__('NO_CHANGESForResource', { logicalId: item.logicalId }));
|
|
33
33
|
return null;
|
|
34
34
|
case 'create': {
|
|
35
35
|
const database = databasesMap.get(item.logicalId);
|
|
@@ -56,7 +56,7 @@ const executeSingleItem = async (context, item, databasesMap, currentState) => {
|
|
|
56
56
|
case 'delete': {
|
|
57
57
|
const state = (0, stateManager_1.getResource)(currentState, item.logicalId);
|
|
58
58
|
if (!state) {
|
|
59
|
-
common_1.logger.warn(
|
|
59
|
+
common_1.logger.warn(lang_1.lang.__('STATE_NOT_FOUND_SKIPPING', { logicalId: item.logicalId }));
|
|
60
60
|
return null;
|
|
61
61
|
}
|
|
62
62
|
const clusterId = state.metadata?.clusterId || state.instances?.[0]?.id;
|
|
@@ -66,7 +66,7 @@ const executeSingleItem = async (context, item, databasesMap, currentState) => {
|
|
|
66
66
|
return executeDeleteAction(context, clusterId, item.logicalId, currentState);
|
|
67
67
|
}
|
|
68
68
|
default:
|
|
69
|
-
common_1.logger.warn(
|
|
69
|
+
common_1.logger.warn(lang_1.lang.__('UNKNOWN_ACTION_FOR_RESOURCE', { action: item.action, logicalId: item.logicalId }));
|
|
70
70
|
return null;
|
|
71
71
|
}
|
|
72
72
|
};
|
|
@@ -6,6 +6,7 @@ const tdsqlcTypes_1 = require("./tdsqlcTypes");
|
|
|
6
6
|
const stateManager_1 = require("../../common/stateManager");
|
|
7
7
|
const common_1 = require("../../common");
|
|
8
8
|
const logger_1 = require("../../common/logger");
|
|
9
|
+
const lang_1 = require("../../lang");
|
|
9
10
|
const buildTdsqlcInstanceFromProvider = (info, sid) => {
|
|
10
11
|
return {
|
|
11
12
|
sid,
|
|
@@ -152,7 +153,10 @@ const deleteDatabaseResource = async (context, clusterId, logicalId, state) => {
|
|
|
152
153
|
errorCode === 'ResourceNotFound' ||
|
|
153
154
|
errorMessage.includes('not found') ||
|
|
154
155
|
errorMessage.includes('NotFound')) {
|
|
155
|
-
logger_1.logger.warn(
|
|
156
|
+
logger_1.logger.warn(lang_1.lang.__('RESOURCE_NOT_FOUND_PROVIDER', {
|
|
157
|
+
resourceType: 'TDSQL-C cluster',
|
|
158
|
+
name: clusterId,
|
|
159
|
+
}));
|
|
156
160
|
}
|
|
157
161
|
else {
|
|
158
162
|
throw err;
|
|
@@ -20,6 +20,7 @@ exports.bucketSchema = {
|
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
22
|
required: ['class'],
|
|
23
|
+
additionalProperties: false,
|
|
23
24
|
},
|
|
24
25
|
versioning: {
|
|
25
26
|
type: 'object',
|
|
@@ -29,6 +30,7 @@ exports.bucketSchema = {
|
|
|
29
30
|
},
|
|
30
31
|
},
|
|
31
32
|
required: ['status'],
|
|
33
|
+
additionalProperties: false,
|
|
32
34
|
},
|
|
33
35
|
security: {
|
|
34
36
|
type: 'object',
|
|
@@ -42,6 +44,7 @@ exports.bucketSchema = {
|
|
|
42
44
|
type: 'string',
|
|
43
45
|
},
|
|
44
46
|
},
|
|
47
|
+
additionalProperties: false,
|
|
45
48
|
},
|
|
46
49
|
website: {
|
|
47
50
|
type: 'object',
|
|
@@ -61,6 +64,7 @@ exports.bucketSchema = {
|
|
|
61
64
|
error_code: templateRefSchema_1.resolvableNumber,
|
|
62
65
|
},
|
|
63
66
|
required: ['code'],
|
|
67
|
+
additionalProperties: false,
|
|
64
68
|
},
|
|
65
69
|
},
|
|
66
70
|
required: ['name'],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geek-fun/serverlessinsight",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.10",
|
|
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",
|