@izara_project/izara-market-library-service-schemas 1.0.46 → 1.0.47
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 +5 -5
- package/src/reStructure/GenerateCode.js +6 -2
- package/src/reStructure/TemplateData/EndpointPerService/handler/api/data.js +0 -1
- package/src/reStructure/TemplateData/EndpointPerService/handler/dsq/data.js +0 -1
- package/src/reStructure/TemplateData/EndpointPerService/handler/inv/data.js +0 -1
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/backupTemplate.ejs +9 -9
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +13 -14
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +3 -5
- package/src/reStructure/TemplateData/EndpointPerService/yaml/template.ejs +2 -2
- package/src/reStructure/TemplateData/externalService/lambdaRole/data.js +2 -2
- package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/data.js +4 -4
- package/src/reStructure/TemplateData/findData/findDataYaml/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/functionYaml/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/functionYaml/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/functionYaml/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/functionYaml/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/externalTopic/Complete/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/externalTopic/Complete/functionYaml/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/externalTopic/Process/functionYaml/data.js +5 -5
- package/src/reStructure/TemplateData/flowSchema/externalTopic/Process/functionYaml/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/functionYaml/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/data.js +5 -5
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowStep/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowStep/functionYaml/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowStep/sns-in/data.js +3 -3
- package/src/reStructure/TemplateData/flowSchema/register/complete/functionYaml/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/webSocketComplete/functionYaml/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/webSocketComplete/sqs/data.js +36 -22
- package/src/reStructure/TemplateData/flowSchema/webSocketComplete/sqs/template.ejs +0 -9
- package/src/reStructure/TemplateData/flowSchema/webSocketComplete/sqs/templateSub.ejs +7 -0
- package/src/reStructure/TemplateData/generateRole/data.js +94 -0
- package/src/reStructure/TemplateData/generateRole/template.ejs +33 -0
- package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/template.ejs +19 -17
- package/src/reStructure/TemplateData/perActionComplete/create/yaml/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionComplete/delete/mainFunction/template.ejs +6 -6
- package/src/reStructure/TemplateData/perActionComplete/delete/yaml/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionComplete/get/mainFunction/template.ejs +16 -14
- package/src/reStructure/TemplateData/perActionComplete/get/yaml/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionComplete/update/mainFunction/template.ejs +15 -13
- package/src/reStructure/TemplateData/perActionComplete/update/yaml/template.ejs +1 -1
- package/src/reStructure/TemplateData/processLogicalPagination/yaml/dsq/template.ejs +2 -2
- package/src/reStructure/TemplateData/processLogicalPagination/yaml/sqs/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/api/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/dsq/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/inv/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/sqs/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/mainFunction/template.ejs +2 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/functionYaml/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/template.ejs +19 -18
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/api/data.js +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/api/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/dsq/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/dsq/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/inv/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/inv/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/sqs/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/sqs/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/sqs/template.ejs +0 -3
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/mainFunction/template.ejs +2 -24
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/functionYaml/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/handler/sqs/template.ejs +3 -5
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/mainFunction/template.ejs +20 -19
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/api/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/dsq/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/dsq/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/inv/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/sqs/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/functionYaml/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/mainFunction/template.ejs +19 -18
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/api/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/inv/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/sqs/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/functionYaml/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/mainFunction/template.ejs +18 -17
|
@@ -32,7 +32,7 @@ const STORAGE_TYPES = {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
const templatePath = path.join(__dirname, './template.ejs');
|
|
35
|
-
|
|
35
|
+
const templateSub = path.join(__dirname, "./templateSub.ejs");
|
|
36
36
|
|
|
37
37
|
const { SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, HANDLER } = require('../../../../../MainLibs/src/Consts.js');
|
|
38
38
|
|
|
@@ -48,7 +48,6 @@ const { SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, HANDLER } = require('../../.
|
|
|
48
48
|
|
|
49
49
|
function createDataForDefaultSnsInSqs(_izContext, allFlowSchema, srcPath) {
|
|
50
50
|
let resultsForCreateDefaultSnsInSqs = [];
|
|
51
|
-
let defaultDsqQueueDataList = [];
|
|
52
51
|
for (const flowSchema of allFlowSchema.records) {
|
|
53
52
|
if (flowSchema.hasOwnProperty("flowSteps")) {
|
|
54
53
|
|
|
@@ -62,36 +61,51 @@ function createDataForDefaultSnsInSqs(_izContext, allFlowSchema, srcPath) {
|
|
|
62
61
|
if (flowSteps.includes("Out")) {
|
|
63
62
|
if (flowSchema.outputTopic) {
|
|
64
63
|
let topicOut = `${upperCase(flowSchema.flowTag)}`;
|
|
65
|
-
|
|
66
|
-
queueName: `WebSocketComplete` + upperCase(HANDLER.hdrSqs),
|
|
67
|
-
subscribeTo: topicOut
|
|
68
|
-
}
|
|
64
|
+
resultsForCreateDefaultSnsInSqs.push(createSubscriptionForWebSocketComplete(topicOut, srcPath)
|
|
69
65
|
)
|
|
70
|
-
|
|
71
66
|
}
|
|
72
67
|
}
|
|
73
68
|
}
|
|
74
69
|
}
|
|
75
70
|
}
|
|
76
71
|
}
|
|
72
|
+
resultsForCreateDefaultSnsInSqs.push(createWebSocketCompleteQueue(srcPath))
|
|
77
73
|
|
|
78
|
-
if (defaultDsqQueueDataList.length) {
|
|
79
|
-
for (let defaultDsqQueueData of defaultDsqQueueDataList) {
|
|
80
|
-
resultsForCreateDefaultSnsInSqs.push({
|
|
81
|
-
templatePath: templatePath,
|
|
82
|
-
templateData: defaultDsqQueueData,
|
|
83
|
-
setting: {
|
|
84
|
-
initialData: "Resources:\n",
|
|
85
|
-
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
86
|
-
saveFileName: SAVE_FILE_NAME.snsInSqsYaml,
|
|
87
|
-
fileExtension: ".yml",
|
|
88
|
-
isAppend: true
|
|
89
|
-
}
|
|
90
|
-
})
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
74
|
|
|
94
75
|
return resultsForCreateDefaultSnsInSqs;
|
|
95
76
|
}
|
|
96
77
|
|
|
78
|
+
|
|
79
|
+
function createSubscriptionForWebSocketComplete(subscribeTo, srcPath) {
|
|
80
|
+
return {
|
|
81
|
+
templatePath: templateSub,
|
|
82
|
+
templateData: {
|
|
83
|
+
subscribeTo,
|
|
84
|
+
queueName: `WebSocketComplete` + upperCase(HANDLER.hdrSqs)
|
|
85
|
+
},
|
|
86
|
+
setting: {
|
|
87
|
+
initialData: "Resources:\n",
|
|
88
|
+
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
89
|
+
saveFileName: SAVE_FILE_NAME.snsInSqsYaml,
|
|
90
|
+
fileExtension: ".yml",
|
|
91
|
+
isAppend: true
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function createWebSocketCompleteQueue(srcPath) {
|
|
97
|
+
return {
|
|
98
|
+
templatePath: templatePath,
|
|
99
|
+
templateData: {
|
|
100
|
+
queueName: "WebSocketComplete" + upperCase(HANDLER.hdrSqs),
|
|
101
|
+
},
|
|
102
|
+
setting: {
|
|
103
|
+
initialData: "Resources:\n",
|
|
104
|
+
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
105
|
+
saveFileName: SAVE_FILE_NAME.snsInSqsYaml,
|
|
106
|
+
fileExtension: ".yml",
|
|
107
|
+
isAppend: true
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
97
111
|
module.exports = createDataForDefaultSnsInSqs;
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
<% if (subscribeTo) { %>
|
|
2
|
-
##===== SNS Subscription
|
|
3
|
-
SubscriptionToOut<%- subscribeTo %>:
|
|
4
|
-
Type: AWS::SNS::Subscription
|
|
5
|
-
Properties:
|
|
6
|
-
TopicArn: !Ref Out<%- subscribeTo %>
|
|
7
|
-
Endpoint: "arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- queueName %>"
|
|
8
|
-
Protocol: "sqs"
|
|
9
|
-
<% } %>
|
|
10
1
|
#------- queue ---------
|
|
11
2
|
<%- queueName %>:
|
|
12
3
|
Type: "AWS::SQS::Queue"
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
##===== SNS Subscription
|
|
2
|
+
SubscriptionToOut<%- subscribeTo %>:
|
|
3
|
+
Type: AWS::SNS::Subscription
|
|
4
|
+
Properties:
|
|
5
|
+
TopicArn: !Ref Out<%- subscribeTo %>
|
|
6
|
+
Endpoint: "arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- queueName %>"
|
|
7
|
+
Protocol: "sqs"
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2020 Sven Mason <http://izara.io>
|
|
3
|
+
This program is free software: you can redistribute it and/or modify
|
|
4
|
+
it under the terms of the GNU Affero General Public License as
|
|
5
|
+
published by the Free Software Foundation, either version 3 of the
|
|
6
|
+
License, or (at your option) any later version.
|
|
7
|
+
This program is distributed in the hope that it will be useful,
|
|
8
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
9
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
10
|
+
GNU Affero General Public License for more details.
|
|
11
|
+
You should have received a copy of the GNU Affero General Public License
|
|
12
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
'use strict';
|
|
16
|
+
|
|
17
|
+
const { SOURCE_GENERATE_IAM_ROLE, SOURCE_PATH, SAVE_FILE_NAME } = require('../../../MainLibs/src/Consts');
|
|
18
|
+
const { firstLetterUpperCase: upperCase } = require("../../../MainLibs/index").utils;
|
|
19
|
+
const path = require('path');
|
|
20
|
+
const templatePath = path.join(__dirname, "./template.ejs")
|
|
21
|
+
|
|
22
|
+
function generateRole(_izContext, createSourceParams, srcPath) {
|
|
23
|
+
// console.log("createSourceParams", createSourceParams);
|
|
24
|
+
let reformCreateSourceParams = {};
|
|
25
|
+
let createSourceRole = [];
|
|
26
|
+
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]
|
|
36
|
+
|
|
37
|
+
const seen = new Set();
|
|
38
|
+
const unique = [];
|
|
39
|
+
|
|
40
|
+
for (const permission of mergeResource) {
|
|
41
|
+
const key = JSON.stringify(permission);
|
|
42
|
+
if (!seen.has(key)) {
|
|
43
|
+
seen.add(key);
|
|
44
|
+
unique.push(permission);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
reformCreateSourceParams[roleName].resourcePermissions = unique;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
console.log("reformCreateSourceParams", JSON.stringify(reformCreateSourceParams, null, 2))
|
|
52
|
+
// console.log("reformCreateSourceParams", reformCreateSourceParams)
|
|
53
|
+
for (const [roleName, roleData] of Object.entries(reformCreateSourceParams)) {
|
|
54
|
+
// console.log("roleName in reformCreateSourceParams", roleName)
|
|
55
|
+
// console.log('roleData', JSON.stringify(roleData, null, 2))
|
|
56
|
+
|
|
57
|
+
createSourceRole.push(
|
|
58
|
+
{
|
|
59
|
+
templatePath: templatePath,
|
|
60
|
+
templateData: { roleName, roleData },
|
|
61
|
+
setting: {
|
|
62
|
+
initialData: "Resources:\n",
|
|
63
|
+
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
64
|
+
saveFileName: SAVE_FILE_NAME.sharedResourceYaml,
|
|
65
|
+
fileExtension: '.yml',
|
|
66
|
+
isAppend: true
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return createSourceRole;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
module.exports = {
|
|
77
|
+
generateRole
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/*
|
|
81
|
+
<%_ additionalResourcePermission.forEach(resourcePermission => { _%>
|
|
82
|
+
- Effect: <%- resourcePermission.effect %>
|
|
83
|
+
Action:
|
|
84
|
+
<%_ Object.keys(resourcePermission.action).forEach(resourcePerAction => { _%>
|
|
85
|
+
<%_ resourcePermission.action[resourcePerAction].forEach(permission => { _%>
|
|
86
|
+
- <%- resourcePerAction %>:<%- permission %>
|
|
87
|
+
<%_ }) _%>
|
|
88
|
+
<%_ }) _%>
|
|
89
|
+
Resource:
|
|
90
|
+
<%_ resourcePermission.resource.forEach(resource => { _%>
|
|
91
|
+
- "<%- resource %>"
|
|
92
|
+
<%_ }) _%>
|
|
93
|
+
<%_}) _%>
|
|
94
|
+
*/
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<%- roleName %>Role:
|
|
2
|
+
Type: AWS::IAM::Role
|
|
3
|
+
Properties:
|
|
4
|
+
RoleName: ${self:custom.iz_resourcePrefix}<%- roleName %>Role
|
|
5
|
+
AssumeRolePolicyDocument:
|
|
6
|
+
Version: "2012-10-17"
|
|
7
|
+
Statement:
|
|
8
|
+
- Effect: Allow
|
|
9
|
+
Principal:
|
|
10
|
+
Service: "lambda.amazonaws.com"
|
|
11
|
+
Action: sts:AssumeRole
|
|
12
|
+
ManagedPolicyArns:
|
|
13
|
+
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
|
|
14
|
+
Policies:
|
|
15
|
+
- PolicyName: ${self:custom.iz_resourcePrefix}<%- roleName %>Policy
|
|
16
|
+
PolicyDocument:
|
|
17
|
+
Version: "2012-10-17"
|
|
18
|
+
Statement:
|
|
19
|
+
<%_ roleData.resourcePermissions.forEach(resourcePermission => { _%>
|
|
20
|
+
- Effect: <%- resourcePermission.effect.trim() %>
|
|
21
|
+
Action:
|
|
22
|
+
<%_ Object.keys(resourcePermission.action).forEach(action => { _%>
|
|
23
|
+
<%_ resourcePermission.action[action].forEach(permission => { _%>
|
|
24
|
+
- <%- action.trim() %>:<%- permission.trim() %>
|
|
25
|
+
<%_ }) _%>
|
|
26
|
+
<%_ }) _%>
|
|
27
|
+
Resource:
|
|
28
|
+
<%_ resourcePermission.resource.forEach(resource => { _%>
|
|
29
|
+
- "<%- resource.trim() _%>"
|
|
30
|
+
<%_ }) _%>
|
|
31
|
+
<%_ }) _%>
|
|
32
|
+
#<#additionalResource<%- roleName %>Role#>
|
|
33
|
+
#<#/additionalResource<%- roleName %>Role#>
|
|
@@ -57,7 +57,7 @@ module.exports.createObjectComplete = async (
|
|
|
57
57
|
passBackProperties,
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
-
if (_.isEmpty(returnValue)) {
|
|
60
|
+
if (_.isEmpty(returnValue.requestParams)) {
|
|
61
61
|
_izContext.logger.debug("message callingFlowProperties is empty");
|
|
62
62
|
throw new NoRetryError("message not an object")
|
|
63
63
|
};
|
|
@@ -65,36 +65,36 @@ module.exports.createObjectComplete = async (
|
|
|
65
65
|
if (!returnValue.hasOwnProperty("queryResult")) {
|
|
66
66
|
errorsFound.push("message is not have property queryResult, should be not happen");
|
|
67
67
|
};
|
|
68
|
-
if (!returnValue.hasOwnProperty("objType")) {
|
|
68
|
+
if (!returnValue.requestParams.hasOwnProperty("objType")) {
|
|
69
69
|
errorsFound.push("message is not have property objType, should be not happen");
|
|
70
70
|
};
|
|
71
|
-
if (!returnValue.hasOwnProperty("objInstanceFull")) {
|
|
71
|
+
if (!returnValue.requestParams.hasOwnProperty("objInstanceFull")) {
|
|
72
72
|
errorsFound.push("message is not have property objInstance, should be not objInstance");
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
if (status == "error" && errorsFound.length > 0) {
|
|
76
76
|
errorsFound.push("error before validate");
|
|
77
77
|
} else if (status == "error" && errorsFound.length == 0) {
|
|
78
|
-
errorsFound.push("[invalid]
|
|
78
|
+
errorsFound.push("[invalid]status is error not have errorsFound form graphService");
|
|
79
79
|
|
|
80
80
|
};
|
|
81
81
|
if (status === "complete" && errorsFound.length > 0) {
|
|
82
|
-
errorsFound.push("[Invalid] status is
|
|
82
|
+
errorsFound.push("[Invalid] status is complete should be not have errorsFound");
|
|
83
83
|
};
|
|
84
84
|
if (graphServiceTag == null) {
|
|
85
85
|
errorsFound.push("[Invalid] graphServerTag is not empty string");
|
|
86
86
|
};
|
|
87
87
|
|
|
88
88
|
if (errorsFound.length > 0) {
|
|
89
|
-
_izContext.logger.debug("Have error form
|
|
90
|
-
errorsFound = errorsFound.concat(errorsFound);
|
|
89
|
+
_izContext.logger.debug("Have error form graphServerTag:", errorsFound);
|
|
90
|
+
errorsFound = errorsFound.concat(errorsFound.join(","));
|
|
91
91
|
};
|
|
92
92
|
|
|
93
93
|
let awaitingStepId = await asyncFlowSharedLib.createAwaitingStepId(
|
|
94
94
|
(hash({
|
|
95
|
-
objType: returnValue.objType,
|
|
95
|
+
objType: returnValue.requestParams.objType,
|
|
96
96
|
graphServerTag: graphServiceTag,
|
|
97
|
-
identifiers: returnValue.objInstanceFull.identifiers
|
|
97
|
+
identifiers: returnValue.requestParams.objInstanceFull.identifiers
|
|
98
98
|
})),
|
|
99
99
|
PREFIX.CREATE_OBJECT_ASYNC
|
|
100
100
|
)
|
|
@@ -114,20 +114,21 @@ module.exports.createObjectComplete = async (
|
|
|
114
114
|
if (await asyncFlowSharedLib.checkAllAwaitingStepsFinished(
|
|
115
115
|
_izContext,
|
|
116
116
|
pendingStepId,
|
|
117
|
-
awaitingStepId
|
|
117
|
+
awaitingStepId,
|
|
118
|
+
errorsFound
|
|
118
119
|
)) {
|
|
119
120
|
_izContext.logger.debug("finish all awaitingStep");
|
|
120
121
|
|
|
121
122
|
let messageObject = {
|
|
122
123
|
objType: {
|
|
123
|
-
objectType: returnValue.objType.objectType,
|
|
124
|
-
serviceTag: returnValue.objType.serviceTag
|
|
124
|
+
objectType: returnValue.requestParams.objType.objectType,
|
|
125
|
+
serviceTag: returnValue.requestParams.objType.serviceTag
|
|
125
126
|
},
|
|
126
127
|
objInstanceFull: {
|
|
127
|
-
identifiers: returnValue.objInstanceFull.identifiers,
|
|
128
|
-
fields: returnValue.objInstanceFull.fields
|
|
128
|
+
identifiers: returnValue.requestParams.objInstanceFull.identifiers,
|
|
129
|
+
fields: returnValue.requestParams.objInstanceFull.fields
|
|
129
130
|
},
|
|
130
|
-
relationships: returnValue.relationships,
|
|
131
|
+
relationships: returnValue.requestParams.relationships,
|
|
131
132
|
status: status,
|
|
132
133
|
errorsFound: errorsFound
|
|
133
134
|
}
|
|
@@ -147,11 +148,12 @@ module.exports.createObjectComplete = async (
|
|
|
147
148
|
//(<afterSendMessage>)
|
|
148
149
|
//(</afterSendMessage>)
|
|
149
150
|
}
|
|
150
|
-
|
|
151
|
+
|
|
151
152
|
await asyncFlowSharedLib.removeAwaitingMultipleStep(
|
|
152
153
|
_izContext,
|
|
153
154
|
awaitingStepId,
|
|
154
|
-
pendingStepId
|
|
155
|
+
pendingStepId,
|
|
156
|
+
errorsFound
|
|
155
157
|
);
|
|
156
158
|
|
|
157
159
|
})
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
- sqs:
|
|
7
7
|
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %>
|
|
8
8
|
batchSize: 10
|
|
9
|
-
filterPatterns: #**** need to update serverless
|
|
9
|
+
filterPatterns: #**** need to update serverless framework upper v.2.69.1
|
|
10
10
|
- body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%-firstLetterUpperCase(functionName) %>"]}}} # functionName of callingFlow
|
|
11
11
|
- body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
|
|
12
12
|
role: <%- roleName %>Role
|
|
@@ -53,12 +53,12 @@ module.exports.deleteNodeComplete = async (
|
|
|
53
53
|
|
|
54
54
|
let deleteNodeComplete = {
|
|
55
55
|
objType: {
|
|
56
|
-
objectType: returnValue.objType.objectType,
|
|
57
|
-
serviceTag: returnValue.objType.serviceTag
|
|
56
|
+
objectType: returnValue.requestParams.objType.objectType,
|
|
57
|
+
serviceTag: returnValue.requestParams.objType.serviceTag
|
|
58
58
|
},
|
|
59
59
|
objInstance: {
|
|
60
|
-
identifiers: returnValue.objInstanceFull.identifiers,
|
|
61
|
-
fields: returnValue.objInstanceFull.fields
|
|
60
|
+
identifiers: returnValue.requestParams.objInstanceFull.identifiers,
|
|
61
|
+
fields: returnValue.requestParams.objInstanceFull.fields
|
|
62
62
|
},
|
|
63
63
|
status: status,
|
|
64
64
|
errorsFound: errorsFound
|
|
@@ -82,8 +82,8 @@ module.exports.deleteNodeComplete = async (
|
|
|
82
82
|
//(</beforeReturn>)
|
|
83
83
|
|
|
84
84
|
return {
|
|
85
|
-
objType: returnValue.objType,
|
|
86
|
-
objInstanceFull: returnValue.objInstanceFull,
|
|
85
|
+
objType: returnValue.requestParams.objType,
|
|
86
|
+
objInstanceFull: returnValue.requestParams.objInstanceFull,
|
|
87
87
|
errorsFound: errorsFound
|
|
88
88
|
}
|
|
89
89
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
- sqs:
|
|
7
7
|
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %>
|
|
8
8
|
batchSize: 10
|
|
9
|
-
filterPatterns: #**** need to update serverless
|
|
9
|
+
filterPatterns: #**** need to update serverless framework upper v.2.69.1
|
|
10
10
|
- body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%-firstLetterUpperCase(functionName) %>"]}}} # functionName of callingFlow
|
|
11
11
|
- body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
|
|
12
12
|
role: <%- roleName %>Role
|
|
@@ -43,7 +43,7 @@ module.exports.updateNodeComplete = async (
|
|
|
43
43
|
passBackProperties = {}
|
|
44
44
|
) => {
|
|
45
45
|
try {
|
|
46
|
-
_izContext.logger.debug("Function:
|
|
46
|
+
_izContext.logger.debug("Function:GetComplete", {
|
|
47
47
|
_izContext: _izContext,
|
|
48
48
|
returnValue: returnValue,
|
|
49
49
|
status: status,
|
|
@@ -54,10 +54,10 @@ module.exports.updateNodeComplete = async (
|
|
|
54
54
|
// start create AwaitingStepId
|
|
55
55
|
let awaitingStepId = asyncFlowSharedLib.createAwaitingStepId(
|
|
56
56
|
hash({
|
|
57
|
-
objectType: returnValue.objType.objectType,
|
|
58
|
-
serviceTag: returnValue.objType.serviceTag,
|
|
59
|
-
identifiers: returnValue.objInstanceFull.identifiers,
|
|
60
|
-
fields: returnValue.objInstanceFull.fields
|
|
57
|
+
objectType: returnValue.requestParams.objType.objectType,
|
|
58
|
+
serviceTag: returnValue.requestParams.objType.serviceTag,
|
|
59
|
+
identifiers: returnValue.requestParams.objInstanceFull.identifiers,
|
|
60
|
+
fields: returnValue.requestParams.objInstanceFull.fields
|
|
61
61
|
}),
|
|
62
62
|
PREFIX.updateNode
|
|
63
63
|
)
|
|
@@ -76,18 +76,19 @@ module.exports.updateNodeComplete = async (
|
|
|
76
76
|
if (await asyncFlowSharedLib.checkAllAwaitingStepsFinished(
|
|
77
77
|
_izContext,
|
|
78
78
|
pendingStepId,
|
|
79
|
-
awaitingStepId
|
|
79
|
+
awaitingStepId,
|
|
80
|
+
errorsFound
|
|
80
81
|
)) {
|
|
81
82
|
_izContext.logger.debug("finished all awaitingStep");
|
|
82
83
|
|
|
83
84
|
let updateCompleteMsg = {
|
|
84
85
|
objType: {
|
|
85
|
-
objectType: returnValue.objType.objectType,
|
|
86
|
-
serviceTag: returnValue.objType.serviceTag
|
|
86
|
+
objectType: returnValue.requestParams.objType.objectType,
|
|
87
|
+
serviceTag: returnValue.requestParams.objType.serviceTag
|
|
87
88
|
},
|
|
88
89
|
objInstance: {
|
|
89
|
-
identifiers: returnValue.objInstanceFull.identifiers,
|
|
90
|
-
fields: returnValue.objInstanceFull.fields
|
|
90
|
+
identifiers: returnValue.requestParams.objInstanceFull.identifiers,
|
|
91
|
+
fields: returnValue.requestParams.objInstanceFull.fields
|
|
91
92
|
},
|
|
92
93
|
status: status,
|
|
93
94
|
errorsFound: errorsFound
|
|
@@ -108,11 +109,12 @@ module.exports.updateNodeComplete = async (
|
|
|
108
109
|
await sns.publishAsync(_izContext, sendMessageToOutUpdateNodeComplete)
|
|
109
110
|
|
|
110
111
|
}
|
|
111
|
-
|
|
112
|
+
|
|
112
113
|
await asyncFlowSharedLib.removeAwaitingMultipleStep(
|
|
113
114
|
_izContext,
|
|
114
115
|
awaitingStepId,
|
|
115
|
-
pendingStepId
|
|
116
|
+
pendingStepId,
|
|
117
|
+
errorsFound
|
|
116
118
|
);
|
|
117
119
|
})
|
|
118
120
|
)
|
|
@@ -121,8 +123,8 @@ module.exports.updateNodeComplete = async (
|
|
|
121
123
|
//(</beforeReturn>)
|
|
122
124
|
|
|
123
125
|
return {
|
|
124
|
-
objType: returnValue.objType,
|
|
125
|
-
objInstanceFull: returnValue.objInstanceFull,
|
|
126
|
+
objType: returnValue.requestParams.objType,
|
|
127
|
+
objInstanceFull: returnValue.requestParams.objInstanceFull,
|
|
126
128
|
errorsFound: errorsFound
|
|
127
129
|
}
|
|
128
130
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
- sqs:
|
|
7
7
|
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %>
|
|
8
8
|
batchSize: 10
|
|
9
|
-
filterPatterns: #**** need to update serverless
|
|
9
|
+
filterPatterns: #**** need to update serverless framework upper v.2.69.1
|
|
10
10
|
- body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%-firstLetterUpperCase(functionName) %>"]}}} # functionName of callingFlow
|
|
11
11
|
- body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
|
|
12
12
|
role: <%- roleName %>Role
|
|
@@ -54,10 +54,10 @@ module.exports.updateNodeComplete = async (
|
|
|
54
54
|
// start create AwaitingStepId
|
|
55
55
|
let awaitingStepId = asyncFlowSharedLib.createAwaitingStepId(
|
|
56
56
|
hash({
|
|
57
|
-
objectType: returnValue.objType.objectType,
|
|
58
|
-
serviceTag: returnValue.objType.serviceTag,
|
|
59
|
-
identifiers: returnValue.objInstanceFull.identifiers,
|
|
60
|
-
fields: returnValue.objInstanceFull.fields
|
|
57
|
+
objectType: returnValue.requestParams.objType.objectType,
|
|
58
|
+
serviceTag: returnValue.requestParams.objType.serviceTag,
|
|
59
|
+
identifiers: returnValue.requestParams.objInstanceFull.identifiers,
|
|
60
|
+
fields: returnValue.requestParams.objInstanceFull.fields
|
|
61
61
|
}),
|
|
62
62
|
PREFIX.updateNode
|
|
63
63
|
)
|
|
@@ -76,18 +76,19 @@ module.exports.updateNodeComplete = async (
|
|
|
76
76
|
if (await asyncFlowSharedLib.checkAllAwaitingStepsFinished(
|
|
77
77
|
_izContext,
|
|
78
78
|
pendingStepId,
|
|
79
|
-
awaitingStepId
|
|
79
|
+
awaitingStepId,
|
|
80
|
+
errorsFound
|
|
80
81
|
)) {
|
|
81
82
|
_izContext.logger.debug("finished all awaitingStep");
|
|
82
83
|
|
|
83
84
|
let updateCompleteMsg = {
|
|
84
85
|
objType: {
|
|
85
|
-
objectType: returnValue.objType.objectType,
|
|
86
|
-
serviceTag: returnValue.objType.serviceTag
|
|
86
|
+
objectType: returnValue.requestParams.objType.objectType,
|
|
87
|
+
serviceTag: returnValue.requestParams.objType.serviceTag
|
|
87
88
|
},
|
|
88
89
|
objInstanceFull: {
|
|
89
|
-
identifiers: returnValue.objInstanceFull.identifiers,
|
|
90
|
-
fields: returnValue.objInstanceFull.fields
|
|
90
|
+
identifiers: returnValue.requestParams.objInstanceFull.identifiers,
|
|
91
|
+
fields: returnValue.requestParams.objInstanceFull.fields
|
|
91
92
|
},
|
|
92
93
|
status: status,
|
|
93
94
|
errorsFound: errorsFound
|
|
@@ -108,11 +109,12 @@ module.exports.updateNodeComplete = async (
|
|
|
108
109
|
await sns.publishAsync(_izContext, sendMessageToOutUpdateNodeComplete)
|
|
109
110
|
|
|
110
111
|
}
|
|
111
|
-
|
|
112
|
+
|
|
112
113
|
await asyncFlowSharedLib.removeAwaitingMultipleStep(
|
|
113
114
|
_izContext,
|
|
114
115
|
awaitingStepId,
|
|
115
|
-
pendingStepId
|
|
116
|
+
pendingStepId,
|
|
117
|
+
errorsFound
|
|
116
118
|
);
|
|
117
119
|
})
|
|
118
120
|
)
|
|
@@ -121,8 +123,8 @@ module.exports.updateNodeComplete = async (
|
|
|
121
123
|
//(</beforeReturn>)
|
|
122
124
|
|
|
123
125
|
return {
|
|
124
|
-
objType: returnValue.objType,
|
|
125
|
-
objInstanceFull: returnValue.objInstanceFull,
|
|
126
|
+
objType: returnValue.requestParams.objType,
|
|
127
|
+
objInstanceFull: returnValue.requestParams.objInstanceFull,
|
|
126
128
|
errorsFound: errorsFound
|
|
127
129
|
}
|
|
128
130
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
- sqs:
|
|
7
7
|
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %>
|
|
8
8
|
batchSize: 10
|
|
9
|
-
filterPatterns: #**** need to update serverless
|
|
9
|
+
filterPatterns: #**** need to update serverless framework upper v.2.69.1
|
|
10
10
|
- body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%-firstLetterUpperCase(functionName) %>"]}}} # functionName of callingFlow
|
|
11
11
|
- body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
|
|
12
12
|
role: <%- roleName %>Role
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- functionName %><%- firstLetterUpperCase(handlerType) %>
|
|
8
8
|
batchSize: 10
|
|
9
9
|
role: <%- roleName %>Role
|
|
10
|
-
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
11
|
-
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
10
|
+
#<#<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
11
|
+
#<#/<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
12
12
|
<%_ function firstLetterUpperCase(text){ return text.charAt(0).toUpperCase() + text.slice(1) } _%>
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- functionName %><%- firstLetterUpperCase(handlerType) %>
|
|
8
8
|
batchSize: 10
|
|
9
9
|
role: <%- roleName %>Role
|
|
10
|
-
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
11
|
-
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
10
|
+
#<#<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
11
|
+
#<#/<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
12
12
|
<%_ function firstLetterUpperCase(text){ return text.charAt(0).toUpperCase() + text.slice(1) } _%>
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
#<#Authorizer#>
|
|
11
11
|
#<#/Authorizer#>
|
|
12
12
|
role: <%- roleName %>Role
|
|
13
|
-
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
14
|
-
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
13
|
+
#<#<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
14
|
+
#<#/<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
15
15
|
<%_ function firstLetterUpperCase(text){
|
|
16
16
|
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
17
17
|
} _%>
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
8
8
|
batchSize: 10
|
|
9
9
|
role: <%- roleName %>Role
|
|
10
|
-
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
11
|
-
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
10
|
+
#<#<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
11
|
+
#<#/<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
12
12
|
<%_ function firstLetterUpperCase(text){
|
|
13
13
|
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
14
14
|
} _%>
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`)%>
|
|
4
4
|
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
5
5
|
role: <%- roleName %>Role
|
|
6
|
-
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
7
|
-
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
6
|
+
#<#<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
7
|
+
#<#/<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
8
8
|
<%_ function firstLetterUpperCase(text){
|
|
9
9
|
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
10
10
|
} _%>
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
8
8
|
batchSize: 10
|
|
9
9
|
role: <%- roleName %>Role
|
|
10
|
-
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
11
|
-
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
10
|
+
#<#<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
11
|
+
#<#/<%- functionName %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
12
12
|
<%_ function firstLetterUpperCase(text){
|
|
13
13
|
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
14
14
|
} _%>
|
package/src/reStructure/TemplateData/relationshipPerAction/create/action/mainFunction/template.ejs
CHANGED
|
@@ -355,6 +355,8 @@ module.exports.createRelationship = async (
|
|
|
355
355
|
//(<inUpdateRelMessageBodyCreateRel>)
|
|
356
356
|
//(</inUpdateRelMessageBodyCreateRel>)
|
|
357
357
|
}
|
|
358
|
+
// assign originTimestamp if not exists in relationshipProperties
|
|
359
|
+
}
|
|
358
360
|
_izContext.logger.debug('createRelMessageBody: ', createRelMessageBody);
|
|
359
361
|
|
|
360
362
|
await Promise.all(
|
package/src/reStructure/TemplateData/relationshipPerAction/create/complete/functionYaml/template.ejs
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
- sqs:
|
|
7
7
|
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %>
|
|
8
8
|
batchSize: 10
|
|
9
|
-
filterPatterns: #**** need to update serverless
|
|
9
|
+
filterPatterns: #**** need to update serverless framework upper v.2.69.1
|
|
10
10
|
- body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%-firstLetterUpperCase(functionName) %>"]}}} # functionName of callingFlow
|
|
11
11
|
- body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
|
|
12
12
|
role: <%- roleName %>Role
|