@izara_project/izara-market-library-service-schemas 1.0.65 → 1.0.67
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/package.json +3 -3
- package/src/GenerateCodeLibs/src/Consts.js +7 -2
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +11 -1
- package/src/MainLibs/src/Consts.js +64 -25
- package/src/MainLibs/src/GenerateCodeUtils.js +6 -6
- package/src/reStructure/GenerateCode.js +2 -1
- package/src/reStructure/TemplateData/EndpointPerService/generateTemplateData.js +1 -1
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +20 -4
- package/src/reStructure/TemplateData/EndpointPerService/yaml/data.js +49 -5
- package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/data.js +3 -0
- package/src/reStructure/TemplateData/findData/findDataYaml/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/data.js +3 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/template.ejs +14 -0
- package/src/reStructure/TemplateData/flowSchema/dynamoDb/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/flowStep/functionYaml/data.js +3 -3
- package/src/reStructure/TemplateData/flowSchema/flowStep/handler/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowStep/sns-in/data.js +4 -2
- package/src/reStructure/TemplateData/flowSchema/flowStep/sns-in/template.ejs +9 -9
- package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +24 -24
- package/src/reStructure/TemplateData/generateRole/data.js +38 -24
- package/src/reStructure/TemplateData/generateRole/template.ejs +5 -7
- package/src/reStructure/TemplateData/perActionComplete/create/yaml/data.js +1 -1
- package/src/reStructure/TemplateData/perActionComplete/delete/yaml/data.js +1 -1
- package/src/reStructure/TemplateData/perActionComplete/get/yaml/data.js +1 -1
- package/src/reStructure/TemplateData/perActionComplete/update/yaml/data.js +1 -1
- package/src/reStructure/TemplateData/processLogical/yaml/data.js +4 -4
- package/src/reStructure/TemplateData/processLogicalPagination/yaml/dsq/data.js +2 -2
- package/src/reStructure/TemplateData/processLogicalPagination/yaml/sqs/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/api/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/data.js +136 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/dsq/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/inv/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/sqs/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/template.ejs +9 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/templateByHandler/apiTemplate.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/templateByHandler/dsqTemplate.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/templateByHandler/invTemplate.ejs +13 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/templateByHandler/sqsTemplate.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/handler/data.js +73 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/handler/template.ejs +9 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/handler/templateByHandler/apiTemplate.ejs +155 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/handler/templateByHandler/dsqTemplate.ejs +202 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/handler/templateByHandler/invTemplate.ejs +144 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/handler/templateByHandler/sqsTemplate.ejs +181 -0
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/mainFunction/template.ejs +11 -11
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/complete/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/api/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/data.js +159 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/dsq/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/inv/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/sqs/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/template.ejs +9 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/templateByHandler/apiTemplate.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/templateByHandler/dsqTemplate.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/templateByHandler/invTemplate.ejs +13 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/templateByHandler/sqsTemplate.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/data.js +73 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/template.ejs +9 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/templateByHandler/apiTemplate.ejs +155 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/templateByHandler/dsqTemplate.ejs +202 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/templateByHandler/invTemplate.ejs +144 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/templateByHandler/sqsTemplate.ejs +181 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/api/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/data.js +158 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/dsq/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/inv/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/sqs/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/template.ejs +9 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/templateByHandler/apiTemplate.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/templateByHandler/dsqTemplate.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/templateByHandler/invTemplate.ejs +13 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/templateByHandler/sqsTemplate.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/data.js +73 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/template.ejs +9 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/templateByHandler/apiTemplate.ejs +155 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/templateByHandler/dsqTemplate.ejs +202 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/templateByHandler/invTemplate.ejs +144 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/templateByHandler/sqsTemplate.ejs +181 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/generateTemplateData.js +131 -88
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/api/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/data.js +158 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/dsq/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/inv/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/sqs/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/template.ejs +9 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/templateByHandler/apiTemplate.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/templateByHandler/dsqTemplate.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/templateByHandler/invTemplate.ejs +13 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/templateByHandler/sqsTemplate.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/data.js +73 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/template.ejs +9 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/templateByHandler/apiTemplate.ejs +155 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/templateByHandler/dsqTemplate.ejs +202 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/templateByHandler/invTemplate.ejs +144 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/templateByHandler/sqsTemplate.ejs +181 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/functionYaml/data.js +160 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/functionYaml/template.ejs +9 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/functionYaml/templateByHandler/apiTemplate.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/functionYaml/templateByHandler/dsqTemplate.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/functionYaml/templateByHandler/invTemplate.ejs +13 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/functionYaml/templateByHandler/sqsTemplate.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/handler/data.js +73 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/handler/template.ejs +9 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/handler/templateByHandler/apiTemplate.ejs +172 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/handler/templateByHandler/dsqTemplate.ejs +218 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/handler/templateByHandler/invTemplate.ejs +161 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/handler/templateByHandler/sqsTemplate.ejs +197 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/mainFunction/data.js +59 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/mainFunction/template.ejs +386 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/sns-in-sqs/data.js +77 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/sns-in-sqs/snsTemplate.ejs +59 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/sns-in-sqs/sqsTemplate.ejs +43 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/complete/functionYaml/data.js +121 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/complete/functionYaml/template.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/complete/handler/sqs/data.js +60 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/complete/handler/sqs/template.ejs +129 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/complete/mainFunction/data.js +56 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/complete/mainFunction/template.ejs +159 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/complete/sns-in-sqs/data.js +71 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/complete/sns-in-sqs/template.ejs +46 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/complete/sns-out/data.js +71 -0
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/complete/sns-out/template.ejs +10 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/api/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/data.js +164 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/inv/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/sqs/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/template.ejs +9 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/templateByHandler/apiTemplate.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/templateByHandler/dsqTemplate.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/templateByHandler/invTemplate.ejs +13 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/templateByHandler/sqsTemplate.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/data.js +73 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/template.ejs +9 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/templateByHandler/apiTemplate.ejs +155 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/templateByHandler/dsqTemplate.ejs +202 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/templateByHandler/invTemplate.ejs +144 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/templateByHandler/sqsTemplate.ejs +181 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/mainResourcePerObjectSchemaData.js +8 -7
- package/src/reStructure/TemplateData/resourceYaml/filterGenerateResource/data.js +36 -30
- package/src/reStructure/TemplateData/resourceYaml/generateTemplateData.js +3 -3
|
@@ -21,36 +21,50 @@ const templatePath = path.join(__dirname, "./template.ejs")
|
|
|
21
21
|
|
|
22
22
|
function generateRole(_izContext, createSourceParams, srcPath) {
|
|
23
23
|
// console.log("createSourceParams", createSourceParams);
|
|
24
|
-
let
|
|
25
|
-
|
|
24
|
+
let createSourceRole = new Set();
|
|
25
|
+
const reformCreateSourceParams = {};
|
|
26
|
+
|
|
26
27
|
for (const createSource of createSourceParams) {
|
|
27
|
-
const { roleName, additionalResourcePermission } = createSource.templateData
|
|
28
|
-
if (additionalResourcePermission && roleName) {
|
|
29
|
-
if (!reformCreateSourceParams[roleName]) {
|
|
30
|
-
reformCreateSourceParams[roleName] = {
|
|
31
|
-
resourcePermissions: [...additionalResourcePermission]
|
|
32
|
-
};
|
|
33
|
-
} else {
|
|
34
|
-
let resourcePermission = reformCreateSourceParams[roleName].resourcePermissions
|
|
35
|
-
let mergeResource = [...resourcePermission, ...additionalResourcePermission]
|
|
28
|
+
const { roleName, additionalResourcePermission } = createSource.templateData;
|
|
36
29
|
|
|
37
|
-
|
|
38
|
-
const unique = [];
|
|
30
|
+
if (!roleName || !additionalResourcePermission) continue;
|
|
39
31
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
32
|
+
if (!reformCreateSourceParams[roleName]) {
|
|
33
|
+
reformCreateSourceParams[roleName] = { resourcePermissions: [] };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const rolePermissions = reformCreateSourceParams[roleName].resourcePermissions;
|
|
37
|
+
|
|
38
|
+
for (const newPerm of additionalResourcePermission) {
|
|
39
|
+
const normalizedActions = Object.entries(newPerm.action)
|
|
40
|
+
.flatMap(([service, actions]) => actions.map(action => `${service}:${action}`))
|
|
41
|
+
.sort();
|
|
42
|
+
|
|
43
|
+
const effect = newPerm.effect;
|
|
44
|
+
const resources = [...new Set(newPerm.resource)];
|
|
45
|
+
|
|
46
|
+
const existing = rolePermissions.find(
|
|
47
|
+
permission =>
|
|
48
|
+
permission.effect === effect &&
|
|
49
|
+
JSON.stringify([...permission.action].sort()) === JSON.stringify(normalizedActions)
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
if (existing) {
|
|
53
|
+
// Merge resources (deduplicate with Set)
|
|
54
|
+
existing.resource = Array.from(new Set([...existing.resource, ...resources]));
|
|
55
|
+
} else {
|
|
56
|
+
// Push new permission
|
|
57
|
+
rolePermissions.push({
|
|
58
|
+
effect: effect,
|
|
59
|
+
action: normalizedActions,
|
|
60
|
+
resource: resources
|
|
61
|
+
});
|
|
48
62
|
}
|
|
49
63
|
}
|
|
50
64
|
}
|
|
65
|
+
// console.log({ reformCreateSourceParams: JSON.stringify(reformCreateSourceParams, null, 2) })
|
|
51
66
|
for (const [roleName, roleData] of Object.entries(reformCreateSourceParams)) {
|
|
52
|
-
|
|
53
|
-
createSourceRole.push(
|
|
67
|
+
createSourceRole.add(
|
|
54
68
|
{
|
|
55
69
|
templatePath: templatePath,
|
|
56
70
|
templateData: { roleName, roleData },
|
|
@@ -71,4 +85,4 @@ function generateRole(_izContext, createSourceParams, srcPath) {
|
|
|
71
85
|
|
|
72
86
|
module.exports = {
|
|
73
87
|
generateRole
|
|
74
|
-
}
|
|
88
|
+
}
|
|
@@ -18,17 +18,15 @@
|
|
|
18
18
|
PolicyDocument:
|
|
19
19
|
Version: "2012-10-17"
|
|
20
20
|
Statement:
|
|
21
|
-
|
|
22
|
-
- Effect: <%- resourcePermission.effect
|
|
21
|
+
<%_ roleData.resourcePermissions.forEach(resourcePermission => { _%>
|
|
22
|
+
- Effect: <%- resourcePermission.effect %>
|
|
23
23
|
Action:
|
|
24
|
-
<%_
|
|
25
|
-
|
|
26
|
-
- <%- action.trim() %>:<%- permission.trim() %>
|
|
27
|
-
<%_ }) _%>
|
|
24
|
+
<%_ resourcePermission.action.forEach(action => { _%>
|
|
25
|
+
- <%- action %>
|
|
28
26
|
<%_ }) _%>
|
|
29
27
|
Resource:
|
|
30
28
|
<%_ resourcePermission.resource.forEach(resource => { _%>
|
|
31
|
-
|
|
29
|
+
- "<%- resource %>"
|
|
32
30
|
<%_ }) _%>
|
|
33
31
|
<%_ }) _%>
|
|
34
32
|
#<#<%- roleName %>Role#>
|
|
@@ -77,7 +77,7 @@ function createFunctionYamlOutUpdateComplete(_izContext, srcPath) {
|
|
|
77
77
|
let functionName = upperCase(FUNCTION_NAME.createObjectComplete)
|
|
78
78
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
79
79
|
let handlerType = upperCase(HANDLER.hdrSqs)
|
|
80
|
-
let functionNameConfig = upperCase(SHORT_FUNCTION_NAME.createObjectComplete)
|
|
80
|
+
let functionNameConfig = upperCase(SHORT_FUNCTION_NAME(FUNCTION_NAME.createObjectComplete))
|
|
81
81
|
|
|
82
82
|
additionalResourcePermission.push(
|
|
83
83
|
createIamRole(
|
|
@@ -73,7 +73,7 @@ function data(_izContext, srcPath) {
|
|
|
73
73
|
|
|
74
74
|
function createFunctionYamlOutUpdateComplete(_izContext, srcPath) {
|
|
75
75
|
let functionName = upperCase(FUNCTION_NAME.deleteNodeComplete)
|
|
76
|
-
let functionNameConfig = upperCase(SHORT_FUNCTION_NAME.deleteNodeComplete)
|
|
76
|
+
let functionNameConfig = upperCase(SHORT_FUNCTION_NAME(FUNCTION_NAME.deleteNodeComplete))
|
|
77
77
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
78
78
|
let handlerType = upperCase(HANDLER.hdrSqs)
|
|
79
79
|
|
|
@@ -53,7 +53,7 @@ function data(_izContext, srcPath) {
|
|
|
53
53
|
|
|
54
54
|
function createFunctionYamlOutUpdateComplete(_izContext, srcPath) {
|
|
55
55
|
let functionName = upperCase(FUNCTION_NAME.getNodeComplete)
|
|
56
|
-
let functionNameConfig = upperCase(SHORT_FUNCTION_NAME.getNodeComplete)
|
|
56
|
+
let functionNameConfig = upperCase(SHORT_FUNCTION_NAME(FUNCTION_NAME.getNodeComplete))
|
|
57
57
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
58
58
|
let handlerType = upperCase(HANDLER.hdrSqs)
|
|
59
59
|
|
|
@@ -77,7 +77,7 @@ function data(_izContext, srcPath) {
|
|
|
77
77
|
|
|
78
78
|
function createFunctionYamlOutUpdateComplete(_izContext, srcPath) {
|
|
79
79
|
let functionName = upperCase(FUNCTION_NAME.updateNodeComplete)
|
|
80
|
-
let functionNameConfig = upperCase(SHORT_FUNCTION_NAME.updateNodeComplete)
|
|
80
|
+
let functionNameConfig = upperCase(SHORT_FUNCTION_NAME(FUNCTION_NAME.updateNodeComplete))
|
|
81
81
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
82
82
|
let handlerType = upperCase(HANDLER.hdrSqs)
|
|
83
83
|
|
|
@@ -25,7 +25,7 @@ const serviceSchemas = require('@izara_project/izara-core-library-service-schema
|
|
|
25
25
|
const serviceConfig = serviceSchemas.serviceConfig;
|
|
26
26
|
|
|
27
27
|
const { HANDLER, STORAGE_TYPES, ACTIONS } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
28
|
-
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../MainLibs/
|
|
28
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../MainLibs/src/Utils.js");
|
|
29
29
|
const {
|
|
30
30
|
createIamRole,
|
|
31
31
|
resourceNames,
|
|
@@ -41,7 +41,7 @@ const {
|
|
|
41
41
|
defaultIamRolePerAction,
|
|
42
42
|
shortNameHandler,
|
|
43
43
|
SHORT_FUNCTION_NAME,
|
|
44
|
-
SOURCE_GENERATE_IAM_ROLE } = require("../../../../MainLibs/
|
|
44
|
+
SOURCE_GENERATE_IAM_ROLE } = require("../../../../MainLibs/src/Consts.js");
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* receive objectSchema
|
|
@@ -71,7 +71,7 @@ async function data(_izContext, objectSchemas, srcPath) {
|
|
|
71
71
|
additionalResourcePermission.push(
|
|
72
72
|
createIamRole(
|
|
73
73
|
{ [RESOURCE_CLASSES.dynamoDbTable]: DYNAMO_RESOURCE.query },
|
|
74
|
-
tableForQuery
|
|
74
|
+
upperCase(tableForQuery)
|
|
75
75
|
)
|
|
76
76
|
);
|
|
77
77
|
}
|
|
@@ -145,7 +145,7 @@ async function data(_izContext, objectSchemas, srcPath) {
|
|
|
145
145
|
resourceLocation: SOURCE_PATH.resourceLocationProcessLogical,
|
|
146
146
|
handlerType: HANDLER.hdrSqs,
|
|
147
147
|
additionalResourcePermission,
|
|
148
|
-
functionNameConfig: upperCase(SHORT_FUNCTION_NAME.processLogical) + upperCase(shortNameHandler(HANDLER.hdrSqs)),
|
|
148
|
+
functionNameConfig: upperCase(SHORT_FUNCTION_NAME(FUNCTION_NAME.processLogical)) + upperCase(shortNameHandler(HANDLER.hdrSqs)),
|
|
149
149
|
roleName: SOURCE_GENERATE_IAM_ROLE.ProcessFindDataRole
|
|
150
150
|
},
|
|
151
151
|
setting: {
|
|
@@ -69,7 +69,7 @@ async function data(_izContext, objectSchemas, srcPath) {
|
|
|
69
69
|
additionalResourcePermission.push(
|
|
70
70
|
createIamRole(
|
|
71
71
|
{ [RESOURCE_CLASSES.dynamoDbTable]: "Query" },
|
|
72
|
-
tableForQuery
|
|
72
|
+
upperCase(tableForQuery)
|
|
73
73
|
)
|
|
74
74
|
);
|
|
75
75
|
}
|
|
@@ -139,7 +139,7 @@ async function data(_izContext, objectSchemas, srcPath) {
|
|
|
139
139
|
resourceLocation: SOURCE_PATH.resourceLocationProcessLogical,
|
|
140
140
|
handlerType: HANDLER.hdrDsq,
|
|
141
141
|
additionalResourcePermission,
|
|
142
|
-
functionNameConfig: upperCase(SHORT_FUNCTION_NAME.paginateProcessLogical) + upperCase(shortNameHandler(HANDLER.hdrDsq)),
|
|
142
|
+
functionNameConfig: upperCase(SHORT_FUNCTION_NAME(FUNCTION_NAME.paginateProcessLogical)) + upperCase(shortNameHandler(HANDLER.hdrDsq)),
|
|
143
143
|
roleName: SOURCE_GENERATE_IAM_ROLE.ProcessFindDataRole
|
|
144
144
|
},
|
|
145
145
|
setting: {
|
|
@@ -70,7 +70,7 @@ async function data(_izContext, objectSchemas, srcPath) {
|
|
|
70
70
|
additionalResourcePermission.push(
|
|
71
71
|
createIamRole(
|
|
72
72
|
{ [RESOURCE_CLASSES.dynamoDbTable]: DYNAMO_RESOURCE.query },
|
|
73
|
-
tableForQuery
|
|
73
|
+
upperCase(tableForQuery)
|
|
74
74
|
)
|
|
75
75
|
);
|
|
76
76
|
}
|
|
@@ -142,7 +142,7 @@ async function data(_izContext, objectSchemas, srcPath) {
|
|
|
142
142
|
resourceLocation: SOURCE_PATH.resourceLocationProcessLogical,
|
|
143
143
|
handlerType: HANDLER.hdrSqs,
|
|
144
144
|
additionalResourcePermission,
|
|
145
|
-
functionNameConfig: upperCase(SHORT_FUNCTION_NAME.paginateProcessLogical) + upperCase(shortNameHandler(HANDLER.hdrSqs)),
|
|
145
|
+
functionNameConfig: upperCase(SHORT_FUNCTION_NAME(FUNCTION_NAME.paginateProcessLogical)) + upperCase(shortNameHandler(HANDLER.hdrSqs)),
|
|
146
146
|
roleName: SOURCE_GENERATE_IAM_ROLE.ProcessFindDataRole
|
|
147
147
|
},
|
|
148
148
|
setting: {
|
|
@@ -107,7 +107,7 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
|
|
|
107
107
|
handlerType,
|
|
108
108
|
additionalResourcePermission,
|
|
109
109
|
resourceLocation: SOURCE_PATH.resourceLocationRelationshipPerAction,
|
|
110
|
-
functionNameConfig: upperCase(SHORT_FUNCTION_NAME.changeRel) + upperCase(shortNameHandler(handlerType)),
|
|
110
|
+
functionNameConfig: upperCase(SHORT_FUNCTION_NAME(FUNCTION_NAME.changeRel)) + upperCase(shortNameHandler(handlerType)),
|
|
111
111
|
roleName: SOURCE_GENERATE_IAM_ROLE.RelationshipRole
|
|
112
112
|
},
|
|
113
113
|
setting: {
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2020 Sven Mason <http://izara.io>
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU Affero General Public License as
|
|
6
|
+
published by the Free Software Foundation, either version 3 of the
|
|
7
|
+
License, or (at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU Affero General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
'use strict';
|
|
19
|
+
const path = require('path');
|
|
20
|
+
|
|
21
|
+
const { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
22
|
+
|
|
23
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase, getLocalConfig } = require("../../../../../../MainLibs/src/Utils.js");
|
|
24
|
+
const {
|
|
25
|
+
createIamRole,
|
|
26
|
+
resourceNames,
|
|
27
|
+
RESOURCE_CLASSES,
|
|
28
|
+
SOURCE_PATH,
|
|
29
|
+
SAVE_FILE_NAME,
|
|
30
|
+
FUNCTION_NAME,
|
|
31
|
+
SNS_RESOURCE,
|
|
32
|
+
defaultIamRolePerAction,
|
|
33
|
+
awaitingMultipleStepsRole,
|
|
34
|
+
shortNameHandler,
|
|
35
|
+
SHORT_FUNCTION_NAME,
|
|
36
|
+
SOURCE_GENERATE_IAM_ROLE,
|
|
37
|
+
checkDynamoTypeRelationship,
|
|
38
|
+
createDynamoDbComponentByLinks,
|
|
39
|
+
DYNAMO_RESOURCE,
|
|
40
|
+
SQS_RESOURCE
|
|
41
|
+
} = require("../../../../../../MainLibs/src/Consts.js");
|
|
42
|
+
const templatePath = path.join(__dirname, "./template.ejs")
|
|
43
|
+
|
|
44
|
+
const apiTemplate = path.join(__dirname, "././templateByHandler/apiTemplate.ejs")
|
|
45
|
+
const dsqTemplate = path.join(__dirname, "././templateByHandler/dsqTemplate.ejs")
|
|
46
|
+
const invTemplate = path.join(__dirname, "././templateByHandler/invTemplate.ejs")
|
|
47
|
+
const sqsTemplate = path.join(__dirname, "././templateByHandler/sqsTemplate.ejs")
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* receive objectSchema
|
|
51
|
+
* create data for updateRelationshipSchema
|
|
52
|
+
*
|
|
53
|
+
* @param {Object} objectSchema
|
|
54
|
+
* @return {{ templatePath, templateData, setting } }
|
|
55
|
+
*/
|
|
56
|
+
|
|
57
|
+
function data(_izContext, srcPath) {
|
|
58
|
+
let createSourceArray = [];
|
|
59
|
+
for (const handlerType of Object.values(HANDLER)) {
|
|
60
|
+
const createSourceParam = createParamForCreateSource(handlerType, srcPath);
|
|
61
|
+
createSourceArray.push(createSourceParam);
|
|
62
|
+
}
|
|
63
|
+
// console.log("createSourceArrayInUpdaterelationShipSchemahdrSqs", createSourceArray)
|
|
64
|
+
return createSourceArray
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
function createParamForCreateSource(handlerType, srcPath) {
|
|
69
|
+
let functionName = upperCase(FUNCTION_NAME.changeRel)
|
|
70
|
+
let additionalResourcePermission = defaultIamRolePerAction();
|
|
71
|
+
|
|
72
|
+
additionalResourcePermission.push(awaitingMultipleStepsRole())
|
|
73
|
+
|
|
74
|
+
if (handlerType === HANDLER.hdrDsq) {
|
|
75
|
+
additionalResourcePermission.push(
|
|
76
|
+
createIamRole(
|
|
77
|
+
{
|
|
78
|
+
[RESOURCE_CLASSES.sqs]: [
|
|
79
|
+
SQS_RESOURCE.deleteMessage,
|
|
80
|
+
SQS_RESOURCE.getQueueAttributes,
|
|
81
|
+
SQS_RESOURCE.receiveMessage,
|
|
82
|
+
SQS_RESOURCE.sendMessage,
|
|
83
|
+
SQS_RESOURCE.getQueueUrl,
|
|
84
|
+
SQS_RESOURCE.deleteMessageBatch
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
[
|
|
88
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType)),
|
|
89
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType) + "DLQ"),
|
|
90
|
+
]
|
|
91
|
+
)
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (handlerType === HANDLER.hdrSqs) {
|
|
96
|
+
createIamRole(
|
|
97
|
+
{
|
|
98
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe],
|
|
99
|
+
[RESOURCE_CLASSES.sqs]: [SQS_RESOURCE.receiveMessage, SQS_RESOURCE.sendMessage]
|
|
100
|
+
},
|
|
101
|
+
[
|
|
102
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.changeRelComplete) + "_Out"),
|
|
103
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType)),
|
|
104
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType) + "DLQ"),
|
|
105
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
|
106
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
|
|
107
|
+
]
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
templatePath: templatePath,
|
|
113
|
+
templateData: {
|
|
114
|
+
functionName,
|
|
115
|
+
handlerType,
|
|
116
|
+
additionalResourcePermission,
|
|
117
|
+
resourceLocation: SOURCE_PATH.resourceLocationRelationshipPerAction,
|
|
118
|
+
functionNameConfig: upperCase(SHORT_FUNCTION_NAME(FUNCTION_NAME.changeRel)) + upperCase(shortNameHandler(handlerType)),
|
|
119
|
+
roleName: SOURCE_GENERATE_IAM_ROLE.RelationshipRole,
|
|
120
|
+
serviceTag: getLocalConfig(path.join(srcPath, "../"), "iz_serviceTag"),
|
|
121
|
+
apiTemplate,
|
|
122
|
+
dsqTemplate,
|
|
123
|
+
invTemplate,
|
|
124
|
+
sqsTemplate
|
|
125
|
+
},
|
|
126
|
+
setting: {
|
|
127
|
+
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
128
|
+
saveFileName: SAVE_FILE_NAME.functionRelationshipYaml,
|
|
129
|
+
fileExtension: '.yml',
|
|
130
|
+
isAppend: true
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
module.exports = data;
|
|
@@ -107,7 +107,7 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
|
|
|
107
107
|
handlerType,
|
|
108
108
|
additionalResourcePermission,
|
|
109
109
|
resourceLocation: SOURCE_PATH.resourceLocationRelationshipPerAction,
|
|
110
|
-
functionNameConfig: upperCase(SHORT_FUNCTION_NAME.changeRel) + upperCase(shortNameHandler(handlerType)),
|
|
110
|
+
functionNameConfig: upperCase(SHORT_FUNCTION_NAME(FUNCTION_NAME.changeRel)) + upperCase(shortNameHandler(handlerType)),
|
|
111
111
|
roleName: SOURCE_GENERATE_IAM_ROLE.RelationshipRole
|
|
112
112
|
},
|
|
113
113
|
setting: {
|
|
@@ -106,7 +106,7 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
|
|
|
106
106
|
handlerType,
|
|
107
107
|
additionalResourcePermission,
|
|
108
108
|
resourceLocation: SOURCE_PATH.resourceLocationRelationshipPerAction,
|
|
109
|
-
functionNameConfig: upperCase(SHORT_FUNCTION_NAME.changeRel) + upperCase(shortNameHandler(handlerType)),
|
|
109
|
+
functionNameConfig: upperCase(SHORT_FUNCTION_NAME(FUNCTION_NAME.changeRel)) + upperCase(shortNameHandler(handlerType)),
|
|
110
110
|
roleName: SOURCE_GENERATE_IAM_ROLE.RelationshipRole
|
|
111
111
|
},
|
|
112
112
|
setting: {
|
|
@@ -108,7 +108,7 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
|
|
|
108
108
|
handlerType,
|
|
109
109
|
additionalResourcePermission,
|
|
110
110
|
resourceLocation: SOURCE_PATH.resourceLocationRelationshipPerAction,
|
|
111
|
-
functionNameConfig: upperCase(SHORT_FUNCTION_NAME.changeRel) + upperCase(shortNameHandler(handlerType)),
|
|
111
|
+
functionNameConfig: upperCase(SHORT_FUNCTION_NAME(FUNCTION_NAME.changeRel)) + upperCase(shortNameHandler(handlerType)),
|
|
112
112
|
roleName: SOURCE_GENERATE_IAM_ROLE.RelationshipRole
|
|
113
113
|
},
|
|
114
114
|
setting: {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<% if (handlerType === "hdrApi") { %>
|
|
2
|
+
<%- include(apiTemplate),{ functionName, handlerType, additionalResourcePermission, resourceLocation, functionNameConfig, roleName, serviceTag } %>
|
|
3
|
+
<% } else if (handlerType === "hdrDsq") { %>
|
|
4
|
+
<%- include(dsqTemplate), { functionName, handlerType, additionalResourcePermission, resourceLocation, functionNameConfig, roleName } %>
|
|
5
|
+
<% } else if (handlerType === "hdrInv") { %>
|
|
6
|
+
<%- include(invTemplate), { functionName, handlerType, additionalResourcePermission, resourceLocation, functionNameConfig, roleName } %>
|
|
7
|
+
<% } else if (handlerType === "hdrSqs") { %>
|
|
8
|
+
<%- include(sqsTemplate),{ functionName, handlerType, additionalResourcePermission, resourceLocation, functionNameConfig, roleName } %>
|
|
9
|
+
<% } %>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<%_ const join = require('path').join; _%>
|
|
2
|
+
<%- firstLetterUpperCase(functionNameConfig) %>:
|
|
3
|
+
handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`)%>
|
|
4
|
+
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
5
|
+
events:
|
|
6
|
+
- http:
|
|
7
|
+
path: /<%- serviceTag %>/<%- firstLetterLowerCase(functionName) %>/<%- functionName %>/
|
|
8
|
+
method: put
|
|
9
|
+
cors: true
|
|
10
|
+
#<#Authorizer#>
|
|
11
|
+
#<#/Authorizer#>
|
|
12
|
+
role: <%- roleName %>Role
|
|
13
|
+
#<#<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
14
|
+
#<#/<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
15
|
+
<%_ function firstLetterUpperCase(text){
|
|
16
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
17
|
+
} _%>
|
|
18
|
+
<%_ function firstLetterLowerCase(str) {
|
|
19
|
+
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
20
|
+
} _%>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<%_ const join = require('path').join; _%>
|
|
2
|
+
<%- firstLetterUpperCase(functionNameConfig) %>:
|
|
3
|
+
handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`)%>
|
|
4
|
+
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
5
|
+
events:
|
|
6
|
+
- sqs:
|
|
7
|
+
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
8
|
+
batchSize: 10
|
|
9
|
+
role: <%- roleName %>Role
|
|
10
|
+
#<#<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
11
|
+
#<#/<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
12
|
+
<%_ function firstLetterUpperCase(text){
|
|
13
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
14
|
+
} _%>
|
|
15
|
+
<%_ function firstLetterLowerCase(str) {
|
|
16
|
+
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
17
|
+
} _%>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<%_ const join = require('path').join; _%>
|
|
2
|
+
<%- firstLetterUpperCase(functionNameConfig) %>:
|
|
3
|
+
handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`)%>
|
|
4
|
+
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
5
|
+
role: <%- roleName %>Role
|
|
6
|
+
#<#<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
7
|
+
#<#/<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
8
|
+
<%_ function firstLetterUpperCase(text){
|
|
9
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
10
|
+
} _%>
|
|
11
|
+
<%_ function firstLetterLowerCase(str) {
|
|
12
|
+
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
13
|
+
} _%>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<%_ const join = require('path').join; _%>
|
|
2
|
+
<%- firstLetterUpperCase(functionNameConfig) %>:
|
|
3
|
+
handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`)%>
|
|
4
|
+
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
5
|
+
events:
|
|
6
|
+
- sqs:
|
|
7
|
+
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
8
|
+
batchSize: 10
|
|
9
|
+
role: <%- roleName %>Role
|
|
10
|
+
#<#<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
11
|
+
#<#/<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
12
|
+
<%_ function firstLetterUpperCase(text){
|
|
13
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
14
|
+
} _%>
|
|
15
|
+
<%_ function firstLetterLowerCase(str) {
|
|
16
|
+
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
17
|
+
} _%>
|
package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/handler/data.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2020 Sven Mason <http://izara.io>
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU Affero General Public License as
|
|
6
|
+
published by the Free Software Foundation, either version 3 of the
|
|
7
|
+
License, or (at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU Affero General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
'use strict';
|
|
19
|
+
const path = require('path');
|
|
20
|
+
|
|
21
|
+
const { ACTIONS, HANDLER } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
22
|
+
|
|
23
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/index.js").utils;
|
|
24
|
+
const { SOURCE_PATH, FUNCTION_NAME } = require("../../../../../../MainLibs/index.js").consts;
|
|
25
|
+
|
|
26
|
+
const templatePath = path.join(__dirname, "./template.ejs")
|
|
27
|
+
const apiTemplate = path.join(__dirname, "./templateByHandler/apiTemplate.ejs")
|
|
28
|
+
const dsqTemplate = path.join(__dirname, "./templateByHandler/dsqTemplate.ejs")
|
|
29
|
+
const invTemplate = path.join(__dirname, "./templateByHandler/invTemplate.ejs")
|
|
30
|
+
const sqsTemplate = path.join(__dirname, "./templateByHandler/sqsTemplate.ejs")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* receive objectSchema
|
|
35
|
+
* create data for hdrInv template
|
|
36
|
+
*
|
|
37
|
+
* @return {{ templatePath, templateData, setting } }
|
|
38
|
+
*/
|
|
39
|
+
function data(_izContext, srcPath) {
|
|
40
|
+
const createSourceParams = [];
|
|
41
|
+
for (const handler of Object.values(HANDLER)) {
|
|
42
|
+
const createSourceParam = createParamForCreateSource(handler, srcPath)
|
|
43
|
+
createSourceParams.push(createSourceParam)
|
|
44
|
+
}
|
|
45
|
+
return createSourceParams
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
function createParamForCreateSource(handler, srcPath) {
|
|
50
|
+
let functionName = FUNCTION_NAME.changeRel;
|
|
51
|
+
let queueName = functionName + upperCase(handler)
|
|
52
|
+
return {
|
|
53
|
+
templatePath: templatePath,
|
|
54
|
+
templateData: {
|
|
55
|
+
functionName,
|
|
56
|
+
queueName,
|
|
57
|
+
apiTemplate,
|
|
58
|
+
dsqTemplate,
|
|
59
|
+
invTemplate,
|
|
60
|
+
sqsTemplate,
|
|
61
|
+
handler
|
|
62
|
+
},
|
|
63
|
+
setting: {
|
|
64
|
+
savePath: path.join(srcPath, SOURCE_PATH.relationshipPerAction),
|
|
65
|
+
saveFileName: upperCase(functionName) + "_" + upperCase(handler),
|
|
66
|
+
fileExtension: '.js',
|
|
67
|
+
isAppend: false
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
module.exports = data;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<% if (handler === "hdrApi") { %>
|
|
2
|
+
<%- include(apiTemplate),{ functionName } %>
|
|
3
|
+
<% } else if (handler === "hdrDsq") { %>
|
|
4
|
+
<%- include(dsqTemplate), { functionName, queueName } %>
|
|
5
|
+
<% } else if (handler === "hdrInv") { %>
|
|
6
|
+
<%- include(invTemplate), { functionName} %>
|
|
7
|
+
<% } else if (handler === "hdrSqs") { %>
|
|
8
|
+
<%- include(sqsTemplate),{ functionName, queueName } %>
|
|
9
|
+
<% } %>
|