@izara_project/izara-market-library-service-schemas 1.0.36 → 1.0.38
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 +8 -7
- package/src/GenerateCodeLibs/src/Consts.js +2 -2
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +36 -6
- package/src/MainLibs/src/Consts.js +5 -2
- package/src/MainLibs/src/GenerateCodeUtils.js +3 -1
- package/src/MainLibs/src/Utils.js +12 -0
- package/src/TemplateManager/src/flowSchema/DefaultWebSocketResource/webSocketConnect/handler/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/InProcessFlowSchema/handler/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createObject/handler/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createObject/mainFunction/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/getsignUrlsAcc/mainFunction/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/reservedLimitComplete/mainFunction/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/mainFunction/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/UploadS3Case/relate/libs/template.ejs +1 -1
- package/src/reStructure/GenerateCode.js +2 -2
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/backupTemplate.ejs +1 -1
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +37 -12
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +25 -2
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +26 -0
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +23 -1
- package/src/reStructure/TemplateData/EndpointPerService/yaml/data.js +37 -7
- package/src/reStructure/TemplateData/externalService/lambdaRole/data.js +7 -7
- package/src/reStructure/TemplateData/externalService/lambdaRole/template.ejs +1 -1
- package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/data.js +4 -2
- package/src/reStructure/TemplateData/findData/GetByStorage/getByGraph.ejs +4 -3
- package/src/reStructure/TemplateData/findData/handler/template.ejs +2 -1
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/mainFunction/data.js +4 -10
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/template.ejs +3 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/data.js +3 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/template.ejs +3 -12
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/template.ejs +6 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/mainFunction/template.ejs +18 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/sns-sqs/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/template.ejs +9 -6
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/sqs/data.js +3 -3
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/sqs/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/mainFunction/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/libs/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/externalTopic/functionYaml/data.js +127 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/handler/data.js +121 -0
- package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/FlowSchemaCompleteComponent → externalTopic}/handler/template.ejs +4 -3
- package/src/reStructure/TemplateData/flowSchema/externalTopic/mainFunction/data.js +74 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/mainFunction/template.ejs +131 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/data.js +61 -34
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/data.js +9 -8
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/data.js +3 -2
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/data.js +19 -8
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/template.ejs +19 -25
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/functionYaml/data.js +2 -4
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/data.js +2 -5
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/template.ejs +4 -3
- package/src/reStructure/TemplateData/flowSchema/{externalTopic/sqs → flowSchemaOwnTopic/flowStep}/functionYaml/data.js +43 -38
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowStep/functionYaml/template.ejs +20 -0
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowStep/handler/data.js +80 -0
- package/src/reStructure/TemplateData/flowSchema/{externalTopic/sqs → flowSchemaOwnTopic/flowStep}/handler/template.ejs +16 -61
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowStep/mainFunction/data.js +92 -0
- package/src/reStructure/TemplateData/flowSchema/{externalTopic/websocket → flowSchemaOwnTopic/flowStep}/mainFunction/template.ejs +12 -14
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-in/data.js +48 -30
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-out/data.js +21 -24
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/functionYaml/data.js +7 -22
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/webSocketComplete/functionYaml/template.ejs +20 -0
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/handler/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/webSocketComplete/handler/template.ejs +84 -0
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/mainFunction/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/mainFunction/template.ejs +27 -11
- package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +25 -30
- package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/functionYaml/data.js +0 -27
- package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/mainFunction/data.js +3 -3
- package/src/reStructure/TemplateData/flowSchema/register/complete/mainFunction/template.ejs +172 -0
- package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/dynamoDB/register.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/subscriptionOutAll/data.js +29 -19
- package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/functionYaml/data.js +28 -50
- package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/register/wbs/mainFunction/template.ejs +165 -0
- package/src/reStructure/TemplateData/flowSchema/templateBystatusType/storedCacheTemplate.ejs +38 -0
- package/src/reStructure/TemplateData/flowSchema/templateBystatusType/triggerCacheTemplate.ejs +39 -0
- package/src/reStructure/TemplateData/generateRole/sharedResourceTemplate.ejs +0 -29
- package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/createObjectComplete_main.js +1 -1
- package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionComplete/delete/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionComplete/get/mainFunction/template.ejs +4 -1
- package/src/reStructure/TemplateData/perActionComplete/update/mainFunction/template.ejs +6 -2
- package/src/reStructure/TemplateData/perActionEndpoint/libs/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/create/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/delete/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/update/template.ejs +1 -1
- package/src/reStructure/TemplateData/propertyValueSchema/relationshipPropertyValueSchema/data.js +2 -7
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/api/data.js +22 -3
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/dsq/data.js +14 -9
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/inv/data.js +26 -6
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/sqs/data.js +11 -7
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/functionYaml/data.js +17 -7
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/api/data.js +23 -4
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/dsq/data.js +14 -9
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/inv/data.js +26 -6
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/sqs/data.js +10 -7
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/functionYaml/data.js +11 -7
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/api/data.js +23 -4
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/dsq/data.js +14 -9
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/inv/data.js +26 -7
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/sqs/data.js +10 -7
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/mainFunction/template.ejs +1 -2
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/functionYaml/data.js +12 -7
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/api/data.js +22 -3
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/data.js +14 -6
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/inv/data.js +20 -3
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/sqs/data.js +9 -3
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/functionYaml/data.js +12 -6
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/mainResourcePerObjectSchemaData.js +6 -2
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/mainFunction/template.ejs +0 -131
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/storedCacheTemplate.ejs +0 -11
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/mainFunction/template.ejs +0 -222
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/data.js +0 -74
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/template.ejs +0 -8
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/functionYaml/template.ejs +0 -17
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/handler/data.js +0 -64
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/mainFunction/data.js +0 -61
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/mainFunction/template.ejs +0 -45
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/data.js +0 -110
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/template.ejs +0 -18
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/data.js +0 -57
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/template.ejs +0 -40
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/data.js +0 -67
- package/src/reStructure/TemplateData/testTemplate/data.js +0 -27
- package/src/reStructure/TemplateData/testTemplate/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/FlowSchemaCompleteComponent → externalTopic}/functionYaml/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/functionYaml/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/handler/data.js +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/sns-in/data.js +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/sns-in/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/subscriptionOutAll/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/functionYaml/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/handler/data.js +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/mainFunction/data.js +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → templateBystatusType}/statusFieldTemplate.ejs +0 -0
|
@@ -16,11 +16,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
'use strict';
|
|
19
|
-
|
|
20
19
|
const path = require('path');
|
|
21
20
|
|
|
22
|
-
const { FLOW_SCHEMA_HOOK_STATE, HANDLER } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
23
|
-
const { firstLetterUpperCase: upperCase } = require(
|
|
21
|
+
const { FLOW_SCHEMA_HOOK_STATE, ACTIONS, HANDLER } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
22
|
+
const { firstLetterUpperCase: upperCase } = require('../../../../../../MainLibs/src/Utils')
|
|
24
23
|
const {
|
|
25
24
|
SOURCE_PATH,
|
|
26
25
|
defaultIamRolePerAction,
|
|
@@ -33,9 +32,9 @@ const {
|
|
|
33
32
|
FUNCTION_NAME,
|
|
34
33
|
shortNameHandler,
|
|
35
34
|
externalResourceYaml,
|
|
36
|
-
SOURCE_GENERATE_IAM_ROLE
|
|
37
|
-
|
|
38
|
-
} = require(
|
|
35
|
+
SOURCE_GENERATE_IAM_ROLE
|
|
36
|
+
} = require('../../../../../../MainLibs/src/Consts');
|
|
37
|
+
const { TOPIC_NAME_GENERATE_CODE } = require('../../../../../../GenerateCodeLibs/src/Consts');
|
|
39
38
|
|
|
40
39
|
const templatePath = path.join(__dirname, "template.ejs");
|
|
41
40
|
const hookTemplate = path.join(__dirname, "./hookTemplate.ejs");
|
|
@@ -46,56 +45,62 @@ const hookTemplate = path.join(__dirname, "./hookTemplate.ejs");
|
|
|
46
45
|
* @param {Object} objectSchema
|
|
47
46
|
* @return {{templatePath, templateData,setting}}
|
|
48
47
|
*/
|
|
48
|
+
|
|
49
49
|
function data(_izContext, flowSchema, srcPath) {
|
|
50
|
-
|
|
50
|
+
let resultCreateSource = [];
|
|
51
|
+
let flowSteps = Object.keys(flowSchema.flowSteps)
|
|
52
|
+
let events = flowSchema.event
|
|
53
|
+
for (const event of events) {
|
|
54
|
+
if (event === "ownTopic") {
|
|
55
|
+
if (flowSteps.includes("In") && flowSteps.includes("Out")) {
|
|
56
|
+
if (flowSteps.length > 2) {
|
|
57
|
+
for (let i = 2; i < flowSteps.length; i++) {
|
|
58
|
+
let createSource = createSourceParams(_izContext, flowSchema.flowTag, flowSteps[i], srcPath)
|
|
59
|
+
createSource && resultCreateSource.push(createSource);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
} else if (flowSteps.includes("In") && !flowSchema.outputTopic) {
|
|
63
|
+
if (flowSteps.length > 1) {
|
|
64
|
+
for (let i = 1; i < flowSteps.length; i++) {
|
|
65
|
+
let createSource = createSourceParams(_izContext, flowSchema.flowTag, flowSteps[i], srcPath)
|
|
66
|
+
createSource && resultCreateSource.push(createSource);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return resultCreateSource
|
|
51
73
|
}
|
|
52
74
|
|
|
53
|
-
function createSourceParams(_izContext,
|
|
54
|
-
let functionName = upperCase(
|
|
75
|
+
function createSourceParams(_izContext, flowTag, flowStep, srcPath) {
|
|
76
|
+
let functionName = upperCase(flowTag);
|
|
55
77
|
let handlerType = upperCase(HANDLER.hdrSqs);
|
|
56
|
-
let
|
|
57
|
-
let functionConfig = "ExtTopicOut" + upperCase(shortNameHandler(handlerType));
|
|
78
|
+
let topicIn = upperCase(flowStep);
|
|
58
79
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
59
|
-
let flowStepInSplitKey = Object.keys(flowSchema.flowSteps)[0].split("_");
|
|
60
|
-
// const action = flowSchema.flowTag || 'defaultAction'; // Using flowTag as the action name
|
|
61
|
-
// const event = resourceNames(RESOURCE_CLASSES.sqs, upperCase(action) + upperCase(handler));
|
|
62
80
|
additionalResourcePermission.push(
|
|
63
81
|
createIamRole(
|
|
64
82
|
{
|
|
65
|
-
[RESOURCE_CLASSES.
|
|
66
|
-
|
|
67
|
-
SQS_RESOURCE.receiveMessage,
|
|
68
|
-
SQS_RESOURCE.deleteMessage,
|
|
83
|
+
[RESOURCE_CLASSES.sns]: [
|
|
84
|
+
SNS_RESOURCE.publish
|
|
69
85
|
]
|
|
70
86
|
},
|
|
71
87
|
[
|
|
72
|
-
resourceNames(RESOURCE_CLASSES.
|
|
73
|
-
resourceNames(RESOURCE_CLASSES.sqs, functionName + handlerType + "DLQ"),
|
|
74
|
-
// resourceNames(RESOURCE_CLASSES.sqs, functionName + "Out"),
|
|
75
|
-
// resourceNames(RESOURCE_CLASSES.sqs, functionName + "OutDLQ"),
|
|
88
|
+
resourceNames(RESOURCE_CLASSES.sns, topicIn + "_In")
|
|
76
89
|
]
|
|
77
|
-
)
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
// SNS_RESOURCE.publish,
|
|
82
|
-
// ]
|
|
83
|
-
// },
|
|
84
|
-
// [
|
|
85
|
-
// resourceNames(RESOURCE_CLASSES.sns, flowStepInSplitKey[2] + flowStepInSplitKey[3]),
|
|
86
|
-
// ]
|
|
87
|
-
// )
|
|
88
|
-
);
|
|
90
|
+
)
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
|
|
89
94
|
return {
|
|
90
95
|
templatePath: templatePath,
|
|
91
96
|
templateData: {
|
|
92
|
-
resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema,
|
|
97
|
+
resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema, upperCase(flowTag) + upperCase(flowStep), "source/"),
|
|
93
98
|
functionName,
|
|
94
99
|
handlerType,
|
|
95
|
-
functionNameConfig: functionConfig,
|
|
96
|
-
roleName: SOURCE_GENERATE_IAM_ROLE.ExternalTopicRole,
|
|
97
|
-
externalTopicName,
|
|
98
100
|
additionalResourcePermission,
|
|
101
|
+
functionNameConfig: upperCase(flowStep) + upperCase(shortNameHandler(handlerType)),
|
|
102
|
+
roleName: SOURCE_GENERATE_IAM_ROLE.FlowSchemaOwnTopic,
|
|
103
|
+
queueName: topicIn + handlerType
|
|
99
104
|
},
|
|
100
105
|
setting: {
|
|
101
106
|
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
@@ -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
|
+
- sqs:
|
|
7
|
+
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- queueName %>
|
|
8
|
+
batchSize: 10
|
|
9
|
+
filterPatterns: #**** need to update serverless framwork upper v.2.69.1
|
|
10
|
+
- body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%- functionName %>"]}}} # functionName of callingFlow
|
|
11
|
+
- body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
|
|
12
|
+
role: <%- roleName %>Role
|
|
13
|
+
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
14
|
+
#<#/<%- functionName %><%- 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,80 @@
|
|
|
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
|
+
const { FLOW_SCHEMA_HOOK_STATE, HANDLER } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
21
|
+
const { SOURCE_PATH, FUNCTION_NAME } = require('../../../../../../MainLibs/src/Consts');
|
|
22
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils")
|
|
23
|
+
const templatePath = path.join(__dirname, "template.ejs")
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* receive objectSchema
|
|
27
|
+
* create data for WebScoket handler template
|
|
28
|
+
*
|
|
29
|
+
* @param {Object} objectSchema
|
|
30
|
+
* @return {{templatePath, templateData,setting}}
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
function data(_izContext, flowSchema, srcPath) {
|
|
35
|
+
let resultCreateParam = [];
|
|
36
|
+
let flowSteps = Object.keys(flowSchema.flowSteps);
|
|
37
|
+
let events = flowSchema.event;
|
|
38
|
+
for (const event of events) {
|
|
39
|
+
if (event === "ownTopic") {
|
|
40
|
+
if (flowSteps.includes("In") && flowSteps.includes("Out")) {
|
|
41
|
+
if (flowSteps.length > 2) {
|
|
42
|
+
for (let i = 2; i < flowSteps.length; i++) {
|
|
43
|
+
let createSource = createParamsForCreateSource(_izContext, upperCase(flowSchema.flowTag), upperCase(flowSteps[i]), srcPath);
|
|
44
|
+
createSource && resultCreateParam.push(createSource)
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
} else if (flowSteps.includes("In") && !flowSchema.outputTopic) {
|
|
48
|
+
if (flowSteps.length > 1) {
|
|
49
|
+
for (let i = 1; i < flowSteps.length; i++) {
|
|
50
|
+
let createSource = createParamsForCreateSource(_izContext, upperCase(flowSchema.flowTag), upperCase(flowSteps[i]), srcPath);
|
|
51
|
+
createSource && resultCreateParam.push(createSource)
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return resultCreateParam
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function createParamsForCreateSource(_izContext, flowTag, flowStep, srcPath) {
|
|
62
|
+
let functionName = upperCase(flowStep)
|
|
63
|
+
let handlerType = upperCase(HANDLER.hdrSqs)
|
|
64
|
+
let queueName = upperCase(flowStep) + handlerType
|
|
65
|
+
return {
|
|
66
|
+
templatePath: templatePath,
|
|
67
|
+
templateData: {
|
|
68
|
+
functionName,
|
|
69
|
+
handlerType,
|
|
70
|
+
queueName
|
|
71
|
+
},
|
|
72
|
+
setting: {
|
|
73
|
+
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowTag, "source/"),
|
|
74
|
+
saveFileName: `${flowStep}_${handlerType}`,
|
|
75
|
+
fileExtension: ".js",
|
|
76
|
+
isAppend: false
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
module.exports = data
|
|
@@ -20,63 +20,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
20
20
|
// const AWS = require('aws-sdk');
|
|
21
21
|
// const sqs = new AWS.SQS({ apiVersion: '2012-11-05' });
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const izara = require("@izara_project/izara-middleware");
|
|
24
|
+
const middleware = izara.middlewareHandler;
|
|
24
25
|
const recordHandlerSharedLib = require("@izara_project/izara-core-library-record-handler")
|
|
25
26
|
const Logger = require('@izara_project/izara-core-library-logger');
|
|
26
27
|
|
|
27
|
-
const
|
|
28
|
+
const <%- functionName %> = require('./<%- functionName %>_Main')
|
|
28
29
|
|
|
29
30
|
// validate event properties in body.Message of sqs event
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// required: ['param1', 'param2', 'param3', 'param4',],
|
|
35
|
-
// properties: {
|
|
36
|
-
// param1: {
|
|
37
|
-
// type: 'object',
|
|
38
|
-
// default: {}
|
|
39
|
-
// },
|
|
40
|
-
// param2: {
|
|
41
|
-
// type: 'string',
|
|
42
|
-
// default: true,
|
|
43
|
-
// pattern: "^[a-zA-Z0-9_-]+$",
|
|
44
|
-
// },
|
|
45
|
-
// param3: {
|
|
46
|
-
// type: 'array',
|
|
47
|
-
// items: { // items in array
|
|
48
|
-
// type: "object", // string
|
|
49
|
-
// properties: {
|
|
50
|
-
// "c": {
|
|
51
|
-
// type: "string"
|
|
52
|
-
// },
|
|
53
|
-
// "d": {
|
|
54
|
-
// type: "number"
|
|
55
|
-
// }
|
|
56
|
-
// },
|
|
57
|
-
// }
|
|
58
|
-
// },
|
|
59
|
-
// param4: {
|
|
60
|
-
// type: 'number',
|
|
61
|
-
// }
|
|
62
|
-
// }
|
|
63
|
-
// };
|
|
64
|
-
|
|
65
|
-
// set schema for record.body.MessageAttributes
|
|
66
|
-
// const messageAttributeValidatorSchema = {
|
|
67
|
-
// type: "object",
|
|
68
|
-
// required: ['msgAtrrParam1', 'msgAtrrParam2'],
|
|
69
|
-
// properties: {
|
|
70
|
-
// msgAtrrParam1: {
|
|
71
|
-
// type: "string"
|
|
72
|
-
// },
|
|
73
|
-
// msgAtrrParam2: {
|
|
74
|
-
// type: "object"
|
|
75
|
-
// }
|
|
76
|
-
// }
|
|
77
|
-
// };
|
|
78
|
-
|
|
79
|
-
module.exports.main = middlewareHandler.wrap(async (event, context, callback) => {
|
|
31
|
+
let perRecordsValidatorSchema = {}
|
|
32
|
+
middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
|
|
33
|
+
|
|
34
|
+
module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
80
35
|
|
|
81
36
|
try {
|
|
82
37
|
|
|
@@ -90,9 +45,9 @@ module.exports.main = middlewareHandler.wrap(async (event, context, callback) =>
|
|
|
90
45
|
|
|
91
46
|
//validate message (and MessageAttributes)
|
|
92
47
|
await recordHandlerSharedLib.validateRecord(
|
|
93
|
-
record,
|
|
94
|
-
"<%-
|
|
95
|
-
perRecordsValidatorSchema,
|
|
48
|
+
record, // one record will send to mainFunction
|
|
49
|
+
"<%- queueName %>", // queue name that need to retry or send to dlq
|
|
50
|
+
perRecordsValidatorSchema, // schema for record.Message
|
|
96
51
|
// messageAttributeValidatorSchema // ----- for msgAttr default is null -> do not send this parameter if not want to validate msgAtt
|
|
97
52
|
);
|
|
98
53
|
|
|
@@ -102,10 +57,10 @@ module.exports.main = middlewareHandler.wrap(async (event, context, callback) =>
|
|
|
102
57
|
|
|
103
58
|
// call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
|
|
104
59
|
let recordPromise = recordHandlerSharedLib.recordHandler(
|
|
105
|
-
record,
|
|
106
|
-
<%-
|
|
107
|
-
|
|
108
|
-
passOnProperties,
|
|
60
|
+
record, // one record will send to mainFunction
|
|
61
|
+
<%- functionName %>.<%- functionName %>, // mainFunction that need to invoke.
|
|
62
|
+
"<%- queueName %>", // queue name that need to retry or send to dlq
|
|
63
|
+
passOnProperties, // all parameters that mainFunction needed.
|
|
109
64
|
);
|
|
110
65
|
record._izContext.logger.debug('after recordPromise in handler');
|
|
111
66
|
recordPromises.push(recordPromise); // push promise to recordPromises
|
|
@@ -119,12 +74,12 @@ module.exports.main = middlewareHandler.wrap(async (event, context, callback) =>
|
|
|
119
74
|
return event.Records // return all for local testing
|
|
120
75
|
|
|
121
76
|
} catch {
|
|
122
|
-
Logger.debug('Promise.all(recordPromises) in handler threw error (at least one record did no resolve');
|
|
77
|
+
Logger.debug('Promise.all(recordPromises) in handler threw error (at least one record did no resolve)');
|
|
123
78
|
}
|
|
124
79
|
Logger.debug('after Promise.all(recordPromises) in handler');
|
|
125
80
|
|
|
126
81
|
} catch (err) {
|
|
127
|
-
Logger.error('Unhandled Error,
|
|
82
|
+
Logger.error('Unhandled Error, LambdaFunctionHdrSqs: ', err);
|
|
128
83
|
throw (err);
|
|
129
84
|
}
|
|
130
85
|
});
|
package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowStep/mainFunction/data.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
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
|
+
const { firstLetterUpperCase: upperCase } = require('../../../../../../MainLibs/src/Utils')
|
|
21
|
+
const {
|
|
22
|
+
SOURCE_PATH,
|
|
23
|
+
defaultIamRolePerAction,
|
|
24
|
+
createIamRole,
|
|
25
|
+
RESOURCE_CLASSES,
|
|
26
|
+
SNS_RESOURCE,
|
|
27
|
+
resourceNames,
|
|
28
|
+
DYNAMO_RESOURCE,
|
|
29
|
+
SAVE_FILE_NAME,
|
|
30
|
+
FUNCTION_NAME,
|
|
31
|
+
shortNameHandler,
|
|
32
|
+
externalResourceYaml,
|
|
33
|
+
SOURCE_GENERATE_IAM_ROLE
|
|
34
|
+
} = require('../../../../../../MainLibs/src/Consts');
|
|
35
|
+
const templatePath = path.join(__dirname, "template.ejs");
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* receive objectSchema
|
|
40
|
+
* create data for WebScoket handler template
|
|
41
|
+
*
|
|
42
|
+
* @param {Object} objectSchema
|
|
43
|
+
* @return {{templatePath, templateData,setting}}
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
function data(_izContext, flowSchema, srcPath) {
|
|
48
|
+
let resultCreateSource = [];
|
|
49
|
+
let flowSteps = Object.keys(flowSchema.flowSteps)
|
|
50
|
+
let events = flowSchema.event
|
|
51
|
+
for (const event of events) {
|
|
52
|
+
if (event === "ownTopic") {
|
|
53
|
+
if (flowSteps.includes("In") && flowSteps.includes("Out")) {
|
|
54
|
+
if (flowSteps.length > 2) {
|
|
55
|
+
for (let i = 2; i < flowSteps.length; i++) {
|
|
56
|
+
let createSource = createParamsForCreateSource(_izContext, flowSchema.flowTag, flowSteps[i], srcPath)
|
|
57
|
+
createSource && resultCreateSource.push(createSource);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
} else if (flowSteps.includes("In") && !flowSchema.outputTopic) {
|
|
61
|
+
if (flowSteps.length > 1) {
|
|
62
|
+
for (let i = 1; i < flowSteps.length; i++) {
|
|
63
|
+
let createSource = createParamsForCreateSource(_izContext, flowSchema.flowTag, flowSteps[i], srcPath)
|
|
64
|
+
createSource && resultCreateSource.push(createSource);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return resultCreateSource
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function createParamsForCreateSource(_izContext, flowTag, flowStep, srcPath) {
|
|
74
|
+
let functionName = upperCase(flowTag)
|
|
75
|
+
let topicArn = `${upperCase(flowStep)}_In`
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
templatePath: templatePath,
|
|
79
|
+
templateData: {
|
|
80
|
+
topicArn,
|
|
81
|
+
functionName
|
|
82
|
+
},
|
|
83
|
+
setting: {
|
|
84
|
+
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowTag, "source/"),
|
|
85
|
+
saveFileName: `${upperCase(flowStep)}_Main`,
|
|
86
|
+
fileExtension: ".js",
|
|
87
|
+
isAppend: false
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
module.exports = data
|
|
@@ -18,26 +18,25 @@ along with this program. If not, see
|
|
|
18
18
|
|
|
19
19
|
'use strict';
|
|
20
20
|
|
|
21
|
-
const hash = require(
|
|
22
|
-
const
|
|
21
|
+
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
22
|
+
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
|
|
23
23
|
|
|
24
24
|
const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
|
|
25
25
|
const snsSharedLib = require('@izara_project/izara-core-library-sns');
|
|
26
26
|
const asyncFlowSharedLib = require('@izara_project/izara-core-library-asynchronous-flow');
|
|
27
27
|
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
28
28
|
const lambdaSharedLib = require('@izara_project/izara-core-library-lambda');
|
|
29
|
-
|
|
29
|
+
const storedCacheSharedLib = require('@izara_project/izara-core-library-stored-cache')
|
|
30
30
|
const externalRequest = require('@izara_project/izara-core-library-external-request');
|
|
31
31
|
const sns = externalRequest.sns
|
|
32
32
|
|
|
33
33
|
const utils = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Utils')
|
|
34
34
|
const NoRetryError = require('@izara_project/izara-core-library-core').NoRetryError
|
|
35
|
-
const { v4: uuidv4 } = require('uuid')
|
|
36
35
|
const coreConsts = require("@izara_project/izara-core-library-core/src/Consts");
|
|
37
36
|
const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
const { postToConnection } = require('../../../libs/source/GenerateCodeLibs')
|
|
38
|
+
//(<optionalRequire>)
|
|
39
|
+
//(</optionalRequire>)
|
|
41
40
|
/**
|
|
42
41
|
*
|
|
43
42
|
*
|
|
@@ -53,7 +52,7 @@ const { createFieldNamesFromRequestParamsByObjectSchema } = require('@izara_proj
|
|
|
53
52
|
* @returns {object} description of return value
|
|
54
53
|
*/
|
|
55
54
|
|
|
56
|
-
module.exports.<%-
|
|
55
|
+
module.exports.<%- functionName %> = async (
|
|
57
56
|
_izContext,
|
|
58
57
|
requestParams,
|
|
59
58
|
callingFlowConfig = {},
|
|
@@ -62,13 +61,12 @@ module.exports.<%- externalTopicMain %> = async (
|
|
|
62
61
|
) => {
|
|
63
62
|
|
|
64
63
|
try {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
_izContext.logger.debug("sendMessageToCreateEndpoint", sendMessageToCreateEndpoint);
|
|
70
|
-
await sns.publishAsync(_izContext, sendMessageToCreateEndpoint);
|
|
64
|
+
_izContext.logger.debug("<%- functionName %> _izContext", _izContext)
|
|
65
|
+
_izContext.logger.debug("<%- functionName %> requestParams", requestParams)
|
|
66
|
+
_izContext.logger.debug("<%- functionName %> callingFlowConfig", callingFlowConfig)
|
|
71
67
|
|
|
68
|
+
//(<hookCode>)
|
|
69
|
+
//(</hookCode>)
|
|
72
70
|
|
|
73
71
|
} catch (err) {
|
|
74
72
|
_izContext.logger.error('error WebSocketInvoke: ', err)
|
|
@@ -32,7 +32,8 @@ const STORAGE_TYPES = {
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
const snsTemplatePath = path.join(__dirname, '../../../resourceYaml/sns-in-sqs/snsTemplate.ejs');
|
|
35
|
-
const
|
|
35
|
+
const subscriptionSqsTemplatePath = path.join(__dirname, './sqsTemplate.ejs');
|
|
36
|
+
|
|
36
37
|
const { SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, HANDLER } = require('../../../../../MainLibs/src/Consts.js');
|
|
37
38
|
|
|
38
39
|
/**
|
|
@@ -47,7 +48,8 @@ const { SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, HANDLER } = require('../../.
|
|
|
47
48
|
|
|
48
49
|
function createDataForDefaultSnsInSqs(_izContext, flowSchema, srcPath) {
|
|
49
50
|
let resultsForCreateDefaultSnsInSqs = [];
|
|
50
|
-
|
|
51
|
+
let flowSteps = Object.keys(flowSchema.flowSteps);
|
|
52
|
+
// console.log("create topic by flowSteps", flowSteps)
|
|
51
53
|
const setting = {
|
|
52
54
|
initialData: "Resources:\n",
|
|
53
55
|
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
@@ -56,20 +58,43 @@ function createDataForDefaultSnsInSqs(_izContext, flowSchema, srcPath) {
|
|
|
56
58
|
isAppend: true
|
|
57
59
|
}
|
|
58
60
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
];
|
|
61
|
+
let topicIn = `${upperCase(flowSchema.flowTag)}`;
|
|
62
|
+
|
|
63
|
+
const generatedSnsTopicInForFlowSchema = [];
|
|
64
|
+
if (flowSteps.includes("In")) {
|
|
65
|
+
generatedSnsTopicInForFlowSchema.push(
|
|
66
|
+
{
|
|
67
|
+
queueName: "Process" + upperCase(topicIn)
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
let defaultDsqQueueDataList = [];
|
|
74
|
+
|
|
75
|
+
if (flowSchema.outputTopic) {
|
|
76
|
+
if (flowSteps.includes("Out")) {
|
|
77
|
+
let topicOut = `${upperCase(flowSchema.flowTag)}`;
|
|
78
|
+
defaultDsqQueueDataList.push({
|
|
79
|
+
queueName: `WebSocketComplete` + upperCase(HANDLER.hdrSqs),
|
|
80
|
+
subscribeTo: topicOut
|
|
81
|
+
}
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
}
|
|
85
|
+
}
|
|
72
86
|
|
|
87
|
+
if (flowSteps.includes("In") && flowSteps.includes("Out")) {
|
|
88
|
+
if (flowSteps.length > 2) {
|
|
89
|
+
for (let i = 2; i < flowSteps.length; i++) {
|
|
90
|
+
generatedSnsTopicInForFlowSchema.push(
|
|
91
|
+
{
|
|
92
|
+
queueName: upperCase(flowSteps[i])
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
73
98
|
|
|
74
99
|
for (let defaultSnsInSqsData of generatedSnsTopicInForFlowSchema) {
|
|
75
100
|
resultsForCreateDefaultSnsInSqs.push({
|
|
@@ -79,23 +104,16 @@ function createDataForDefaultSnsInSqs(_izContext, flowSchema, srcPath) {
|
|
|
79
104
|
})
|
|
80
105
|
}
|
|
81
106
|
|
|
82
|
-
|
|
83
|
-
{
|
|
84
|
-
|
|
85
|
-
|
|
107
|
+
if (defaultDsqQueueDataList.length) {
|
|
108
|
+
for (let defaultDsqQueueData of defaultDsqQueueDataList) {
|
|
109
|
+
resultsForCreateDefaultSnsInSqs.push({
|
|
110
|
+
templatePath: subscriptionSqsTemplatePath,
|
|
111
|
+
templateData: defaultDsqQueueData,
|
|
112
|
+
setting: setting
|
|
113
|
+
})
|
|
86
114
|
}
|
|
87
|
-
]
|
|
88
|
-
for (let defaultDsqQueueData of defaultDsqQueueDataList) {
|
|
89
|
-
resultsForCreateDefaultSnsInSqs.push({
|
|
90
|
-
templatePath: sqsTemplatePath,
|
|
91
|
-
templateData: defaultDsqQueueData,
|
|
92
|
-
setting: setting
|
|
93
|
-
})
|
|
94
115
|
}
|
|
95
|
-
|
|
96
|
-
// resultsForCreateDefaultSnsInSqs: JSON.stringify(resultsForCreateDefaultSnsInSqs, null, 2
|
|
97
|
-
// )
|
|
98
|
-
// })
|
|
116
|
+
|
|
99
117
|
return resultsForCreateDefaultSnsInSqs;
|
|
100
118
|
}
|
|
101
119
|
|
|
@@ -47,31 +47,28 @@ const { SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, HANDLER } = require('../../.
|
|
|
47
47
|
function createDataForSnsOut(_izContext, flowSchema, srcPath) {
|
|
48
48
|
let resultsForCreateDefaultSnsInSqs = [];
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
let
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
{
|
|
57
|
-
queueName: upperCase(topicOut)
|
|
58
|
-
}
|
|
59
|
-
];
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
for (let defaultSnsOutData of generatedSnsTopicOutForFlowSchema) {
|
|
63
|
-
resultsForCreateDefaultSnsInSqs.push({
|
|
64
|
-
templatePath: templatePath,
|
|
65
|
-
templateData: defaultSnsOutData,
|
|
66
|
-
setting: {
|
|
67
|
-
initialData: "Resources:\n",
|
|
68
|
-
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
69
|
-
saveFileName: SAVE_FILE_NAME.snsOutYaml,
|
|
70
|
-
fileExtension: ".yml",
|
|
71
|
-
isAppend: true
|
|
50
|
+
let generatedSnsTopicOutForFlowSchema = []
|
|
51
|
+
let topicOut = `${upperCase(flowSchema.flowTag)}`
|
|
52
|
+
if (flowSchema.outputTopic) {
|
|
53
|
+
generatedSnsTopicOutForFlowSchema.push(
|
|
54
|
+
{
|
|
55
|
+
queueName: upperCase(topicOut)
|
|
72
56
|
}
|
|
73
|
-
|
|
74
|
-
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
for (let defaultSnsOutData of generatedSnsTopicOutForFlowSchema) {
|
|
60
|
+
resultsForCreateDefaultSnsInSqs.push({
|
|
61
|
+
templatePath: templatePath,
|
|
62
|
+
templateData: defaultSnsOutData,
|
|
63
|
+
setting: {
|
|
64
|
+
initialData: "Resources:\n",
|
|
65
|
+
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
66
|
+
saveFileName: SAVE_FILE_NAME.snsOutYaml,
|
|
67
|
+
fileExtension: ".yml",
|
|
68
|
+
isAppend: true
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
}
|
|
75
72
|
}
|
|
76
73
|
|
|
77
74
|
return resultsForCreateDefaultSnsInSqs;
|