@izara_project/izara-market-library-service-schemas 1.0.37 → 1.0.39
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 +1 -1
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +35 -5
- package/src/MainLibs/src/Consts.js +5 -2
- package/src/MainLibs/src/GenerateCodeUtils.js +2 -0
- package/src/MainLibs/src/Utils.js +12 -0
- package/src/reStructure/GenerateCode.js +2 -2
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +36 -11
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +24 -1
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +26 -0
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +22 -0
- package/src/reStructure/TemplateData/EndpointPerService/yaml/data.js +37 -7
- package/src/reStructure/TemplateData/findData/handler/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/template.ejs +2 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/template.ejs +5 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/sns-sqs/data.js +1 -1
- 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/relate/libs/template.ejs +1 -1
- 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/externalTopic/functionYaml/data.js +127 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/handler/data.js +121 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/{sqs/handler → handler}/template.ejs +16 -61
- 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 +3 -7
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/data.js +2 -5
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/data.js +13 -4
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/template.ejs +16 -37
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/functionYaml/data.js +2 -4
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/data.js +2 -5
- 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/flowSchemaOwnTopic/flowStep/handler/template.ejs +85 -0
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowStep/mainFunction/data.js +92 -0
- package/src/reStructure/TemplateData/flowSchema/{externalTopic/websocket → flowSchemaOwnTopic/flowStep}/mainFunction/template.ejs +11 -13
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-in/data.js +47 -37
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-out/data.js +23 -26
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/functionYaml/data.js +5 -21
- 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/{FlowSchemaCompleteComponent → webSocketComplete}/mainFunction/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/mainFunction/template.ejs +24 -10
- package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +32 -34
- package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/register/complete/mainFunction/template.ejs +172 -0
- package/src/reStructure/TemplateData/flowSchema/register/wbs/mainFunction/template.ejs +165 -0
- package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → templateBystatusType}/statusFieldTemplate.ejs +0 -5
- package/src/reStructure/TemplateData/flowSchema/templateBystatusType/storedCacheTemplate.ejs +24 -0
- package/src/reStructure/TemplateData/flowSchema/templateBystatusType/triggerCacheTemplate.ejs +20 -0
- package/src/reStructure/TemplateData/perActionComplete/get/mainFunction/template.ejs +3 -0
- package/src/reStructure/TemplateData/perActionComplete/update/mainFunction/template.ejs +3 -0
- 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/complete/functionYaml/data.js +17 -7
- 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/complete/functionYaml/data.js +11 -7
- 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/complete/functionYaml/data.js +12 -7
- 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/complete/functionYaml/data.js +12 -6
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/mainResourcePerObjectSchemaData.js +6 -2
- package/src/reStructure/TemplateData/resourceYaml/filterGenerateResource/data.js +20 -11
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/mainFunction/template.ejs +0 -184
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/storedCacheTemplate.ejs +0 -11
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/mainFunction/template.ejs +0 -210
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/data.js +0 -77
- 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 -74
- 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 -85
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/data.js +0 -67
- /package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/FlowSchemaCompleteComponent → externalTopic}/functionYaml/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/handler/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/functionYaml/data.js +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}/complete/mainFunction/data.js +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/dynamoDB/register.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/data.js +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/subscriptionOutAll/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/functionYaml/data.js +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/handler/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/mainFunction/data.js +0 -0
|
@@ -57,11 +57,8 @@ async function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
|
57
57
|
let functionName = "Process" + upperCase(flowSchema.flowTag)
|
|
58
58
|
let handlerType = upperCase(HANDLER.hdrSqs)
|
|
59
59
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
60
|
-
let route = flowSchema.flowTag;
|
|
61
|
-
let
|
|
62
|
-
let flowStepsIn = flowSteps[0];
|
|
63
|
-
let splitFlowStepsIn = flowStepsIn.split("_");
|
|
64
|
-
let queueName = splitFlowStepsIn[2] + handlerType;
|
|
60
|
+
let route = upperCase(flowSchema.flowTag);
|
|
61
|
+
let queueName = "Process" + upperCase(flowSchema.flowTag) + handlerType;
|
|
65
62
|
additionalResourcePermission.push(
|
|
66
63
|
createIamRole(
|
|
67
64
|
{
|
|
@@ -84,8 +81,7 @@ async function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
|
84
81
|
|
|
85
82
|
if (flowSchema.statusType === "storedCache") {
|
|
86
83
|
let tableStroedCaches = [];
|
|
87
|
-
|
|
88
|
-
let objectSchema = await getObjectSchema.getLocalObjectSchemas(_izContext, [flowSchema.objType.objectType], objectSchemaPath).then(res => res.records[0])
|
|
84
|
+
let objectSchema = await getObjectSchema.getLocalObjectSchemas(_izContext, [flowSchema.objType.objectType], path.join(srcPath, "./schemas")).then(res => res.records[0])
|
|
89
85
|
if (!objectSchema) {
|
|
90
86
|
throw new NoRetryError('ObjectSchema not found')
|
|
91
87
|
}
|
package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/data.js
CHANGED
|
@@ -38,11 +38,8 @@ function data(_izContext, flowSchema, srcPath) {
|
|
|
38
38
|
function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
39
39
|
let functionName = "Process" + upperCase(flowSchema.flowTag)
|
|
40
40
|
let handlerType = upperCase(HANDLER.hdrSqs)
|
|
41
|
-
let route = flowSchema.flowTag;
|
|
42
|
-
let
|
|
43
|
-
let flowStepsIn = flowSteps[0];
|
|
44
|
-
let splitFlowStepsIn = flowStepsIn.split("_");
|
|
45
|
-
let queueName = splitFlowStepsIn[2] + handlerType
|
|
41
|
+
let route = upperCase(flowSchema.flowTag);
|
|
42
|
+
let queueName = `Process${upperCase(flowSchema.flowTag)}${upperCase(handlerType)}`
|
|
46
43
|
|
|
47
44
|
return {
|
|
48
45
|
templatePath: templatePath,
|
|
@@ -23,8 +23,9 @@ const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = req
|
|
|
23
23
|
const templatePath = path.join(__dirname, "template.ejs");
|
|
24
24
|
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
|
|
25
25
|
const { STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
26
|
-
const statusFieldTemplate = path.join(__dirname, "../../../
|
|
27
|
-
const storedCacheTemplate = path.join(__dirname, "../../../
|
|
26
|
+
const statusFieldTemplate = path.join(__dirname, "../../../templateBystatusType/statusFieldTemplate.ejs")
|
|
27
|
+
const storedCacheTemplate = path.join(__dirname, "../../../templateBystatusType/storedCacheTemplate.ejs")
|
|
28
|
+
const triggerCacheTemplate = path.join(__dirname, "../../../templateBystatusType/triggerCacheTemplate.ejs")
|
|
28
29
|
|
|
29
30
|
/**
|
|
30
31
|
* receive objectSchema
|
|
@@ -42,7 +43,7 @@ async function data(_izContext, flowSchema, srcPath) {
|
|
|
42
43
|
async function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
43
44
|
let functionName = "Process" + upperCase(flowSchema.flowTag);
|
|
44
45
|
let tableName = null;
|
|
45
|
-
if (flowSchema.statusType === "storedCache") {
|
|
46
|
+
if (flowSchema.statusType === "storedCache" || flowSchema.statusType === "triggerCache") {
|
|
46
47
|
let objectSchema = await getObjectSchema.getLocalObjectSchemas(_izContext, [flowSchema.objType.objectType], path.join(srcPath, "./schemas")).then(res => res.records[0]);
|
|
47
48
|
for (const storageResource of Object.values(objectSchema.storageResources)) {
|
|
48
49
|
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
@@ -50,17 +51,25 @@ async function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
|
50
51
|
}
|
|
51
52
|
}
|
|
52
53
|
}
|
|
54
|
+
|
|
55
|
+
let triggerType;
|
|
56
|
+
if (flowSchema.statusType === "triggerCache" && flowSchema.hasOwnProperty("triggerType")) {
|
|
57
|
+
triggerType = flowSchema.triggerType;
|
|
58
|
+
}
|
|
53
59
|
let flowSchemaComplete = upperCase(flowSchema.flowTag) + "Complete"
|
|
60
|
+
|
|
54
61
|
return {
|
|
55
62
|
templatePath: templatePath,
|
|
56
63
|
templateData: {
|
|
57
64
|
statusType: flowSchema.statusType,
|
|
58
65
|
statusFieldTemplate,
|
|
59
66
|
storedCacheTemplate,
|
|
67
|
+
triggerCacheTemplate,
|
|
60
68
|
flowTag: flowSchema.flowTag,
|
|
61
69
|
functionName,
|
|
62
70
|
tableName,
|
|
63
|
-
flowSchemaComplete
|
|
71
|
+
flowSchemaComplete,
|
|
72
|
+
triggerType
|
|
64
73
|
},
|
|
65
74
|
setting: {
|
|
66
75
|
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, "source/"),
|
|
@@ -28,12 +28,12 @@ const asyncFlowSharedLib = require('@izara_project/izara-core-library-asynchrono
|
|
|
28
28
|
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
29
29
|
const lambdaSharedLib = require('@izara_project/izara-core-library-lambda');
|
|
30
30
|
const storedCacheSharedLib = require('@izara_project/izara-core-library-stored-cache')
|
|
31
|
-
|
|
31
|
+
const triggeredCacheSharedLib = require('@izara_project/izara-core-library-trigger-cache')
|
|
32
32
|
const externalRequest = require('@izara_project/izara-core-library-external-request');
|
|
33
33
|
const sns = externalRequest.sns
|
|
34
34
|
const sqs = externalRequest.sqs
|
|
35
35
|
const lambda = externalRequest.lambda
|
|
36
|
-
const { postToConnection } = require("
|
|
36
|
+
const { postToConnection } = require("../../../libs/source/GenerateCodeLibs");
|
|
37
37
|
const utils = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Utils')
|
|
38
38
|
const NoRetryError = require('@izara_project/izara-core-library-core').NoRetryError
|
|
39
39
|
const { v4: uuidv4 } = require('uuid')
|
|
@@ -71,52 +71,31 @@ module.exports.<%- functionName %> = async (
|
|
|
71
71
|
_izContext.logger.debug("<%- functionName %> requestParams", requestParams)
|
|
72
72
|
_izContext.logger.debug("<%- functionName %> callingFlowConfig", callingFlowConfig)
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
//(<endpointHookMainFunction>)
|
|
78
|
-
//(</endpointHookMainFunction>)
|
|
74
|
+
_izContext.correlationIds.get(consts.X_CORRELATION_ID)
|
|
75
|
+
_izContext.correlationIds.get(consts.CONNECTION_ID);
|
|
79
76
|
|
|
80
77
|
const flowSchema = await getObjectSchema.getFlowSchemaS3WithCache(_izContext, {
|
|
81
78
|
flowTag: requestParams.action,
|
|
82
79
|
serviceTag: process.env.iz_serviceTag
|
|
83
80
|
})
|
|
84
81
|
|
|
82
|
+
//(<endpointHookMainFunction>)
|
|
83
|
+
//(</endpointHookMainFunction>)
|
|
84
|
+
|
|
85
85
|
<% if (statusType === "statusField") { %>
|
|
86
86
|
<%- include(statusFieldTemplate) %>
|
|
87
87
|
<% } else if (statusType === "storedCache") { %>
|
|
88
|
-
<%- include(storedCacheTemplate, {tableName:tableName}) %>
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
callingFlowSharedLib.addParentCallingFlowConfig(
|
|
97
|
-
callingFlowConfig,
|
|
98
|
-
callingFlowSharedLib.createCallingFlowConfig(
|
|
99
|
-
await lambdaSharedLib.lambdaFunctionName(_izContext, "<%- flowSchemaComplete %>"), {}
|
|
100
|
-
)
|
|
101
|
-
)
|
|
102
|
-
)
|
|
103
|
-
|
|
104
|
-
<% } else if (statusType === "none") { %>
|
|
105
|
-
|
|
106
|
-
let messageObject = requestParams
|
|
107
|
-
|
|
108
|
-
// create callingFlow
|
|
109
|
-
messageObject = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
|
|
110
|
-
messageObject,
|
|
111
|
-
callingFlowSharedLib.addParentCallingFlowConfig(
|
|
112
|
-
callingFlowConfig,
|
|
113
|
-
callingFlowSharedLib.createCallingFlowConfig(
|
|
114
|
-
await lambdaSharedLib.lambdaFunctionName(_izContext, TOPIC_NAME_GENERATE_CODE.flowSchemaOwnTopicComplete), {}
|
|
115
|
-
)
|
|
116
|
-
)
|
|
117
|
-
)
|
|
88
|
+
<%- include(storedCacheTemplate, {tableName:tableName,flowSchemaComplete:flowSchemaComplete}) %>
|
|
89
|
+
|
|
90
|
+
<% } else if (statusType === "triggerCache") { %>
|
|
91
|
+
<%- include(triggerCacheTemplate, {
|
|
92
|
+
tableName: tableName,
|
|
93
|
+
flowSchemaComplete: flowSchemaComplete,
|
|
94
|
+
triggerType: triggerType
|
|
95
|
+
}) %>
|
|
118
96
|
<% } %>
|
|
119
97
|
|
|
98
|
+
|
|
120
99
|
//(<endpointHook>)
|
|
121
100
|
//(</endpointHook>)
|
|
122
101
|
|
|
@@ -55,10 +55,8 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
|
55
55
|
let handlerType = upperCase("hdrWbs")
|
|
56
56
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
57
57
|
let route = flowSchema.flowTag;
|
|
58
|
-
let
|
|
59
|
-
|
|
60
|
-
let splitFlowStepsIn = flowStepsOut.split("_");
|
|
61
|
-
let topicIn = `${splitFlowStepsIn[2]}_${splitFlowStepsIn[3]}`
|
|
58
|
+
let topicIn = `Process${upperCase(flowSchema.flowTag)}_In`
|
|
59
|
+
|
|
62
60
|
additionalResourcePermission.push(
|
|
63
61
|
createIamRole(
|
|
64
62
|
{
|
|
@@ -50,11 +50,8 @@ function data(_izContext, flowSchema, srcPath) {
|
|
|
50
50
|
|
|
51
51
|
function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
52
52
|
let functionName = upperCase(flowSchema.flowTag)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
let flowStepsIn = flowStep[0];
|
|
56
|
-
let splitFlowStepsIn = flowStepsIn.split("_");
|
|
57
|
-
let topicArn = `${splitFlowStepsIn[2]}_${splitFlowStepsIn[3]}`
|
|
53
|
+
let topicArn = `Process${upperCase(flowSchema.flowTag)}_In`
|
|
54
|
+
|
|
58
55
|
return {
|
|
59
56
|
templatePath: templatePath,
|
|
60
57
|
templateData: {
|
|
@@ -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
|
package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowStep/handler/template.ejs
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
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
|
+
|
|
20
|
+
// const AWS = require('aws-sdk');
|
|
21
|
+
// const sqs = new AWS.SQS({ apiVersion: '2012-11-05' });
|
|
22
|
+
|
|
23
|
+
const izara = require("@izara_project/izara-middleware");
|
|
24
|
+
const middleware = izara.middlewareHandler;
|
|
25
|
+
const recordHandlerSharedLib = require("@izara_project/izara-core-library-record-handler")
|
|
26
|
+
const Logger = require('@izara_project/izara-core-library-logger');
|
|
27
|
+
|
|
28
|
+
const <%- functionName %> = require('./<%- functionName %>_Main')
|
|
29
|
+
|
|
30
|
+
// validate event properties in body.Message of sqs event
|
|
31
|
+
let perRecordsValidatorSchema = {}
|
|
32
|
+
middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
|
|
33
|
+
|
|
34
|
+
module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
|
|
38
|
+
let recordPromises = [];
|
|
39
|
+
|
|
40
|
+
// loop each record and send to mainFunction
|
|
41
|
+
await Promise.all(event.Records.map(async record => { // promise.all for map() function
|
|
42
|
+
|
|
43
|
+
let passOnProperties = []
|
|
44
|
+
record._izContext.logger.debug('record ReceiveMsgOutHdrSqs', record);
|
|
45
|
+
|
|
46
|
+
//validate message (and MessageAttributes)
|
|
47
|
+
await recordHandlerSharedLib.validateRecord(
|
|
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
|
|
51
|
+
// messageAttributeValidatorSchema // ----- for msgAttr default is null -> do not send this parameter if not want to validate msgAtt
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
// add argument (to invoke lambda) to passOnProperties[]
|
|
55
|
+
passOnProperties.push(record.body.Message)
|
|
56
|
+
record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
|
|
57
|
+
|
|
58
|
+
// call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
|
|
59
|
+
let recordPromise = recordHandlerSharedLib.recordHandler(
|
|
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.
|
|
64
|
+
);
|
|
65
|
+
record._izContext.logger.debug('after recordPromise in handler');
|
|
66
|
+
recordPromises.push(recordPromise); // push promise to recordPromises
|
|
67
|
+
}))
|
|
68
|
+
|
|
69
|
+
Logger.debug('before Promise.all(recordPromises) in handler');
|
|
70
|
+
try {
|
|
71
|
+
// --- main await all promises
|
|
72
|
+
await Promise.all(recordPromises); // await all promises
|
|
73
|
+
|
|
74
|
+
return event.Records // return all for local testing
|
|
75
|
+
|
|
76
|
+
} catch {
|
|
77
|
+
Logger.debug('Promise.all(recordPromises) in handler threw error (at least one record did no resolve)');
|
|
78
|
+
}
|
|
79
|
+
Logger.debug('after Promise.all(recordPromises) in handler');
|
|
80
|
+
|
|
81
|
+
} catch (err) {
|
|
82
|
+
Logger.error('Unhandled Error, LambdaFunctionHdrSqs: ', err);
|
|
83
|
+
throw (err);
|
|
84
|
+
}
|
|
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
|