@izara_project/izara-market-library-service-schemas 1.0.35 → 1.0.36
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 +2 -1
- package/src/MainLibs/src/Consts.js +8 -8
- package/src/MainLibs/src/GenerateCodeUtils.js +2 -0
- package/src/{reStructure/TemplateData → TemplateManager/src}/attributeTreeSchema/generateTemplateData.js +35 -20
- package/src/TemplateManager/src/attributeTreeSchema/referenceRelationshipSchema/data.js +84 -0
- package/src/TemplateManager/src/attributeTreeSchema/referenceRelationshipSchema/tempReferenceRelationshipSchema.ejs +9 -0
- package/src/{reStructure/TemplateData → TemplateManager/src}/attributeTreeSchema/relationshipSchema/data.js +1 -1
- package/src/reStructure/SchemaConfig.js +1 -4
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/backupTemplate.ejs +701 -0
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +34 -162
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +2 -0
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +3 -4
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +2 -0
- package/src/reStructure/TemplateData/externalService/lambdaRole/data.js +38 -12
- package/src/reStructure/TemplateData/externalService/lambdaRole/template.ejs +5 -2
- package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/data.js +22 -14
- package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/template.ejs +4 -1
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/mainFunction/template.ejs +68 -33
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/libs/data.js +12 -4
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/libs/template.ejs +13 -8
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/functionYaml/data.js +16 -13
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/functionYaml/template.ejs +9 -9
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/handler/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/mainFunction/template.ejs +7 -9
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/dynamoDB/register.js +82 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/sns-in/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/sns-in/template.ejs +34 -1
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/storedCacheTemplate.ejs +10 -33
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/subscriptionOutAll/data.js +5 -5
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/subscriptionOutAll/template.ejs +6 -6
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/functionYaml/data.js +26 -4
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/functionYaml/template.ejs +5 -5
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/handler/template.ejs +7 -8
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/mainFunction/template.ejs +118 -16
- package/src/reStructure/TemplateData/flowSchema/dynamoDb/data.js +83 -44
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/data.js +4 -5
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/template.ejs +1 -7
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/data.js +2 -3
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/template.ejs +2 -4
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/functionYaml/data.js +31 -3
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/functionYaml/template.ejs +4 -4
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/handler/data.js +7 -8
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/handler/template.ejs +13 -13
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/mainFunction/data.js +4 -4
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/mainFunction/template.ejs +44 -69
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/data.js +4 -6
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/data.js +2 -9
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/template.ejs +40 -87
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/data.js +5 -4
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/template.ejs +2 -10
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/functionYaml/data.js +17 -3
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/functionYaml/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/mainFunction/data.js +6 -2
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/mainFunction/template.ejs +49 -84
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/data.js +55 -10
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/data.js +20 -7
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/template.ejs +24 -33
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/functionYaml/data.js +20 -5
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/functionYaml/template.ejs +1 -3
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/handler/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/handler/template.ejs +5 -5
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/mainFunction/data.js +5 -3
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/mainFunction/template.ejs +7 -5
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/functionYaml/data.js +6 -3
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/functionYaml/template.ejs +0 -2
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/handler/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/handler/template.ejs +3 -3
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/data.js +8 -3
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/template.ejs +17 -11
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-in/data.js +14 -8
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-out/data.js +4 -1
- package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +50 -42
- package/src/reStructure/TemplateData/generateRole/createSharedResource.js +3 -2
- package/src/reStructure/TemplateData/generateRole/sharedResourceTemplate.ejs +3 -0
- package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/template.ejs +9 -8
- package/src/reStructure/TemplateData/perActionComplete/delete/mainFunction/template.ejs +5 -1
- package/src/reStructure/TemplateData/perActionComplete/get/mainFunction/template.ejs +2 -1
- package/src/reStructure/TemplateData/processLogical/mainFunction/template.ejs +1 -0
- package/src/reStructure/TemplateData/{propertyNodeSchema → propertyValueSchema}/generateTemplateData.js +4 -4
- package/src/reStructure/TemplateData/propertyValueSchema/objectPropertyValueSchema/data.js +131 -0
- package/src/reStructure/TemplateData/{propertyNodeSchema/relationshipPropertyNodeSchema → propertyValueSchema/relationshipPropertyValueSchema}/data.js +32 -55
- package/src/reStructure/TemplateData/propertyValueSchema/relationshipPropertyValueSchema/tempRelationship.ejs +13 -0
- package/src/reStructure/TemplateData/propertyValueSchema/relationshipPropertyValueSchema/templateRelationshipPropertyValueSchema.ejs +7 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/mainFunction/template.ejs +2 -1
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/template.ejs +2 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/mainFunction/template.ejs +2 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/handler/sqs/template.ejs +5 -5
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/mainFunction/template.ejs +5 -4
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/mainFunction/template.ejs +2 -1
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/handler/sqs/template.ejs +4 -4
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/mainFunction/template.ejs +4 -3
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/mainFunction/template.ejs +2 -1
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/mainFunction/template.ejs +2 -1
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/template.ejs +1 -3
- package/src/reStructure/TemplateData/resourceYaml/filterGenerateResource/data.js +61 -0
- package/src/reStructure/TemplateData/resourceYaml/generateTemplateData.js +13 -4
- package/src/reStructure/TemplateData/propertyNodeSchema/objectPropertyNodeSchema/data.js +0 -151
- package/src/reStructure/TemplateData/propertyNodeSchema/relationshipPropertyNodeSchema/templateRelationshipPropertyNodeSchema.ejs +0 -7
- /package/src/{reStructure/TemplateData → TemplateManager/src}/attributeTreeSchema/mainAttributeTree/attributeLinkTemplate.ejs +0 -0
- /package/src/{reStructure/TemplateData → TemplateManager/src}/attributeTreeSchema/mainAttributeTree/data.js +0 -0
- /package/src/{reStructure/TemplateData → TemplateManager/src}/attributeTreeSchema/mainAttributeTree/request.json +0 -0
- /package/src/{reStructure/TemplateData → TemplateManager/src}/attributeTreeSchema/relationshipSchema/template.ejs +0 -0
- /package/src/reStructure/TemplateData/{propertyNodeSchema/objectPropertyNodeSchema/templateObjectPropertyNodeSchema.ejs → propertyValueSchema/objectPropertyValueSchema/templateObjectPropertyValueSchema.ejs} +0 -0
|
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
18
18
|
'use strict';
|
|
19
19
|
const path = require('path');
|
|
20
20
|
|
|
21
|
-
const { FLOW_SCHEMA_HOOK_STATE, ACTIONS, HANDLER } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
21
|
+
const { FLOW_SCHEMA_HOOK_STATE, ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
22
22
|
const { firstLetterUpperCase: upperCase } = require('../../../../../../MainLibs/src/Utils')
|
|
23
23
|
const {
|
|
24
24
|
SOURCE_PATH,
|
|
@@ -32,12 +32,14 @@ const {
|
|
|
32
32
|
FUNCTION_NAME,
|
|
33
33
|
shortNameHandler,
|
|
34
34
|
externalResourceYaml,
|
|
35
|
-
SOURCE_GENERATE_IAM_ROLE
|
|
35
|
+
SOURCE_GENERATE_IAM_ROLE,
|
|
36
|
+
SQS_RESOURCE,
|
|
37
|
+
LAMBDA_RESOURCE
|
|
36
38
|
} = require('../../../../../../MainLibs/src/Consts');
|
|
37
39
|
const { TOPIC_NAME_GENERATE_CODE } = require('../../../../../../GenerateCodeLibs/src/Consts');
|
|
40
|
+
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas').getObjectSchema;
|
|
38
41
|
|
|
39
42
|
const templatePath = path.join(__dirname, "template.ejs");
|
|
40
|
-
const hookTemplate = path.join(__dirname, "./hookTemplate.ejs");
|
|
41
43
|
/**
|
|
42
44
|
* receive objectSchema
|
|
43
45
|
* create data for WebScoket handler template
|
|
@@ -46,29 +48,72 @@ const hookTemplate = path.join(__dirname, "./hookTemplate.ejs");
|
|
|
46
48
|
* @return {{templatePath, templateData,setting}}
|
|
47
49
|
*/
|
|
48
50
|
|
|
49
|
-
function data(_izContext, flowSchema, srcPath) {
|
|
50
|
-
return [createSourceParams(_izContext, flowSchema, srcPath)]
|
|
51
|
+
async function data(_izContext, flowSchema, srcPath) {
|
|
52
|
+
return [await createSourceParams(_izContext, flowSchema, srcPath)]
|
|
51
53
|
}
|
|
52
54
|
|
|
53
|
-
function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
54
|
-
let functionName = upperCase(
|
|
55
|
+
async function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
56
|
+
let functionName = "Process" + upperCase(flowSchema.flowTag)
|
|
55
57
|
let handlerType = upperCase(HANDLER.hdrSqs)
|
|
56
58
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
57
59
|
let route = flowSchema.flowTag;
|
|
60
|
+
let flowSteps = Object.keys(flowSchema.flowSteps)
|
|
61
|
+
let flowStepsIn = flowSteps[0];
|
|
62
|
+
let splitFlowStepsOut = flowStepsIn.split("_");
|
|
63
|
+
let queueName = splitFlowStepsOut[3] + handlerType
|
|
64
|
+
additionalResourcePermission.push(
|
|
65
|
+
createIamRole(
|
|
66
|
+
{
|
|
67
|
+
[RESOURCE_CLASSES.sqs]: Object.values(SQS_RESOURCE)
|
|
68
|
+
},
|
|
69
|
+
[
|
|
70
|
+
resourceNames(RESOURCE_CLASSES.sqs, queueName)
|
|
71
|
+
]
|
|
72
|
+
),
|
|
73
|
+
createIamRole(
|
|
74
|
+
{
|
|
75
|
+
[RESOURCE_CLASSES.lambda]: Object.values(LAMBDA_RESOURCE)
|
|
76
|
+
},
|
|
77
|
+
[
|
|
78
|
+
resourceNames(RESOURCE_CLASSES.lambda, 'CreateHdrInv')
|
|
79
|
+
]
|
|
80
|
+
),
|
|
81
|
+
)
|
|
58
82
|
|
|
59
|
-
|
|
83
|
+
if (flowSchema.statusType === "storedCache") {
|
|
84
|
+
let tableStroedCaches = [];
|
|
85
|
+
const objectSchemaPath = path.join(srcPath, "./schemas")
|
|
86
|
+
let objectSchema = await getObjectSchema.getLocalObjectSchemas(_izContext, [flowSchema.objType.objectType], objectSchemaPath).then(res => res.records[0])
|
|
87
|
+
for (const storageResource of Object.values(objectSchema.storageResources)) {
|
|
88
|
+
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
89
|
+
if (!tableStroedCaches.includes(storageResource.tableName)) {
|
|
90
|
+
tableStroedCaches.push(storageResource.tableName)
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
60
94
|
|
|
95
|
+
additionalResourcePermission.push(
|
|
96
|
+
createIamRole(
|
|
97
|
+
{
|
|
98
|
+
[RESOURCE_CLASSES.dynamoDbTable]: Object.values(DYNAMO_RESOURCE)
|
|
99
|
+
},
|
|
100
|
+
tableStroedCaches.map(
|
|
101
|
+
tableName => resourceNames(RESOURCE_CLASSES.dynamoDbTable, tableName))
|
|
102
|
+
)
|
|
103
|
+
)
|
|
104
|
+
}
|
|
61
105
|
|
|
62
106
|
return {
|
|
63
107
|
templatePath: templatePath,
|
|
64
108
|
templateData: {
|
|
65
|
-
resourceLocation: path.join(SOURCE_PATH.
|
|
109
|
+
resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema, flowSchema.flowTag, "source/"),
|
|
66
110
|
functionName,
|
|
67
111
|
handlerType,
|
|
68
112
|
additionalResourcePermission,
|
|
69
113
|
route,
|
|
70
114
|
functionNameConfig: upperCase(functionName) + upperCase(shortNameHandler(handlerType)),
|
|
71
|
-
roleName: SOURCE_GENERATE_IAM_ROLE.FlowSchemaOwnTopic
|
|
115
|
+
roleName: SOURCE_GENERATE_IAM_ROLE.FlowSchemaOwnTopic,
|
|
116
|
+
queueName
|
|
72
117
|
},
|
|
73
118
|
setting: {
|
|
74
119
|
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
5
5
|
events:
|
|
6
6
|
- sqs:
|
|
7
|
-
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%-
|
|
7
|
+
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- queueName %>
|
|
8
8
|
batchSize: 10
|
|
9
9
|
filterPatterns: #**** need to update serverless framwork upper v.2.69.1
|
|
10
10
|
- body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%- functionName %>"]}}} # functionName of callingFlow
|
package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/data.js
CHANGED
|
@@ -36,7 +36,7 @@ function data(_izContext, flowSchema, srcPath) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
39
|
-
let functionName = upperCase(
|
|
39
|
+
let functionName = "Process" + upperCase(flowSchema.flowTag)
|
|
40
40
|
let handlerType = upperCase(HANDLER.hdrSqs)
|
|
41
41
|
let route = flowSchema.flowTag;
|
|
42
42
|
let queueName = functionName
|
|
@@ -49,7 +49,7 @@ function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
|
49
49
|
queueName
|
|
50
50
|
},
|
|
51
51
|
setting: {
|
|
52
|
-
savePath: path.join(srcPath, SOURCE_PATH.
|
|
52
|
+
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, "source/"),
|
|
53
53
|
saveFileName: `${functionName}_${handlerType}`,
|
|
54
54
|
fileExtension: ".js",
|
|
55
55
|
isAppend: false
|
|
@@ -25,7 +25,7 @@ const middleware = izara.middlewareHandler;
|
|
|
25
25
|
const recordHandlerSharedLib = require("@izara_project/izara-core-library-record-handler")
|
|
26
26
|
const Logger = require('@izara_project/izara-core-library-logger');
|
|
27
27
|
|
|
28
|
-
const
|
|
28
|
+
const <%- functionName %> = require('./<%- functionName %>_Main')
|
|
29
29
|
|
|
30
30
|
// validate event properties in body.Message of sqs event
|
|
31
31
|
let perRecordsValidatorSchema = {}
|
|
@@ -18,10 +18,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
18
18
|
'use strict';
|
|
19
19
|
const path = require('path');
|
|
20
20
|
|
|
21
|
-
const { SOURCE_PATH, FUNCTION_NAME } = require('../../../../../../MainLibs/src/Consts');
|
|
21
|
+
const { SOURCE_PATH, FUNCTION_NAME, HANDLER } = require('../../../../../../MainLibs/src/Consts');
|
|
22
22
|
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils")
|
|
23
23
|
const templatePath = path.join(__dirname, "template.ejs");
|
|
24
|
-
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema')
|
|
24
|
+
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
|
|
25
|
+
const { STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
25
26
|
const statusFieldTemplate = path.join(__dirname, "../../../createRecordByStatusType/statusFieldTemplate.ejs")
|
|
26
27
|
const storedCacheTemplate = path.join(__dirname, "../../../createRecordByStatusType/storedCacheTemplate.ejs")
|
|
27
28
|
|
|
@@ -34,21 +35,33 @@ const storedCacheTemplate = path.join(__dirname, "../../../createRecordByStatusT
|
|
|
34
35
|
*/
|
|
35
36
|
|
|
36
37
|
|
|
37
|
-
function data(_izContext, flowSchema, srcPath) {
|
|
38
|
-
return [createParamsForCreateSource(_izContext, flowSchema, srcPath)]
|
|
38
|
+
async function data(_izContext, flowSchema, srcPath) {
|
|
39
|
+
return [await createParamsForCreateSource(_izContext, flowSchema, srcPath)]
|
|
39
40
|
}
|
|
40
41
|
|
|
41
|
-
function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
42
|
-
let functionName = upperCase(
|
|
42
|
+
async function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
43
|
+
let functionName = "Process" + upperCase(flowSchema.flowTag);
|
|
44
|
+
let tableName;
|
|
45
|
+
let objectSchema = await getObjectSchema.getLocalObjectSchemas(_izContext, [flowSchema.objType.objectType], path.join(srcPath, "./schemas")).then(res => res.records[0]);
|
|
46
|
+
for (const storageResource of Object.values(objectSchema.storageResources)) {
|
|
47
|
+
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
48
|
+
tableName = storageResource.tableName
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
let flowSchemaComplete = upperCase(flowSchema.flowTag) + "Complete"
|
|
43
52
|
return {
|
|
44
53
|
templatePath: templatePath,
|
|
45
54
|
templateData: {
|
|
46
55
|
statusType: flowSchema.statusType,
|
|
47
56
|
statusFieldTemplate,
|
|
48
57
|
storedCacheTemplate,
|
|
58
|
+
flowTag: flowSchema.flowTag,
|
|
59
|
+
functionName,
|
|
60
|
+
tableName,
|
|
61
|
+
flowSchemaComplete
|
|
49
62
|
},
|
|
50
63
|
setting: {
|
|
51
|
-
savePath: path.join(srcPath, SOURCE_PATH.
|
|
64
|
+
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, "source/"),
|
|
52
65
|
saveFileName: `${functionName}_Main`,
|
|
53
66
|
fileExtension: ".js",
|
|
54
67
|
isAppend: false
|
|
@@ -31,12 +31,16 @@ const lambdaSharedLib = require('@izara_project/izara-core-library-lambda');
|
|
|
31
31
|
const externalRequest = require('@izara_project/izara-core-library-external-request');
|
|
32
32
|
const sns = externalRequest.sns
|
|
33
33
|
const sqs = externalRequest.sqs
|
|
34
|
+
const lambda = externalRequest.lambda
|
|
34
35
|
const { postToConnection } = require("../../../../libs/source/GenerateCodeLibs");
|
|
35
36
|
const utils = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Utils')
|
|
36
37
|
const NoRetryError = require('@izara_project/izara-core-library-core').NoRetryError
|
|
37
38
|
const { v4: uuidv4 } = require('uuid')
|
|
38
39
|
const coreConsts = require("@izara_project/izara-core-library-core/src/Consts");
|
|
39
40
|
const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
41
|
+
const consts = require('@izara_project/izara-middleware/src/MiddlewareCore/Consts')
|
|
42
|
+
const { createFieldNamesFromRequestParamsByObjectSchema } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs.js')
|
|
43
|
+
|
|
40
44
|
/**
|
|
41
45
|
*
|
|
42
46
|
*
|
|
@@ -52,7 +56,7 @@ const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-librar
|
|
|
52
56
|
* @returns {object} description of return value
|
|
53
57
|
*/
|
|
54
58
|
|
|
55
|
-
module.exports
|
|
59
|
+
module.exports.<%- functionName %> = async (
|
|
56
60
|
_izContext,
|
|
57
61
|
requestParams,
|
|
58
62
|
callingFlowConfig = {},
|
|
@@ -61,20 +65,26 @@ module.exports.FlowSchemaOwnTopicEndpoint = async (
|
|
|
61
65
|
) => {
|
|
62
66
|
|
|
63
67
|
try {
|
|
64
|
-
_izContext.logger.debug("
|
|
65
|
-
_izContext.logger.debug("
|
|
66
|
-
_izContext.logger.debug("
|
|
68
|
+
_izContext.logger.debug("<%- functionName %> _izContext", _izContext)
|
|
69
|
+
_izContext.logger.debug("<%- functionName %> requestParams", requestParams)
|
|
70
|
+
_izContext.logger.debug("<%- functionName %> callingFlowConfig", callingFlowConfig)
|
|
71
|
+
|
|
72
|
+
let correlationId = _izContext.correlationIds.get(consts.X_CORRELATION_ID)
|
|
73
|
+
let connectionId = _izContext.correlationIds.get(consts.CONNECTION_ID);
|
|
67
74
|
|
|
68
75
|
//(<endpointHookMainFunction>)
|
|
69
76
|
//(</endpointHookMainFunction>)
|
|
70
77
|
|
|
78
|
+
const flowSchema = await getObjectSchema.getFlowSchemaS3WithCache(_izContext, {
|
|
79
|
+
flowTag: requestParams.action,
|
|
80
|
+
serviceTag: process.env.iz_serviceTag
|
|
81
|
+
})
|
|
82
|
+
|
|
71
83
|
<% if (statusType === "statusField") { %>
|
|
72
84
|
<%- include(statusFieldTemplate) %>
|
|
73
85
|
<% } else if (statusType === "storedCache") { %>
|
|
74
|
-
<%- include(storedCacheTemplate) %>
|
|
75
|
-
let messageObject =
|
|
76
|
-
requestParams:requestParams
|
|
77
|
-
}
|
|
86
|
+
<%- include(storedCacheTemplate, {tableName:tableName}) %>
|
|
87
|
+
let messageObject = requestParams
|
|
78
88
|
|
|
79
89
|
//(<beforeSendMessage>)
|
|
80
90
|
//(</beforeSendMessage>)
|
|
@@ -84,22 +94,15 @@ module.exports.FlowSchemaOwnTopicEndpoint = async (
|
|
|
84
94
|
callingFlowSharedLib.addParentCallingFlowConfig(
|
|
85
95
|
callingFlowConfig,
|
|
86
96
|
callingFlowSharedLib.createCallingFlowConfig(
|
|
87
|
-
await lambdaSharedLib.lambdaFunctionName(_izContext,
|
|
97
|
+
await lambdaSharedLib.lambdaFunctionName(_izContext, "<%- flowSchemaComplete %>"), {}
|
|
88
98
|
)
|
|
89
99
|
)
|
|
90
100
|
)
|
|
91
101
|
|
|
92
|
-
let sendMessageToEndpointComplete = {
|
|
93
|
-
Message:JSON.stringify(messageObject),
|
|
94
|
-
QueueUrl: await sqsSharedLib.sqsQueueUrl(_izContext, "FlowSchemaOwnTopicEndpointCompleteHdrSqs")
|
|
95
|
-
}
|
|
96
|
-
_izContext.logger.debug("sendMessageToEndpointComplete", sendMessageToEndpointComplete)
|
|
97
|
-
await sqs.sendMessage(_izContext, sendMessageToEndpointComplete)
|
|
98
|
-
|
|
99
102
|
<% } else if (statusType === "none") { %>
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
+
|
|
104
|
+
let messageObject = requestParams
|
|
105
|
+
|
|
103
106
|
// create callingFlow
|
|
104
107
|
messageObject = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
|
|
105
108
|
messageObject,
|
|
@@ -110,22 +113,10 @@ module.exports.FlowSchemaOwnTopicEndpoint = async (
|
|
|
110
113
|
)
|
|
111
114
|
)
|
|
112
115
|
)
|
|
113
|
-
|
|
114
|
-
let sendMessageToEndpointComplete = {
|
|
115
|
-
Message:JSON.stringify(messageObject),
|
|
116
|
-
QueueUrl: await sqsSharedLib.sqsQueueUrl(_izContext, "FlowSchemaOwnTopicEndpointCompleteHdrSqs")
|
|
117
|
-
}
|
|
118
|
-
_izContext.logger.debug("sendMessageToEndpointComplete", sendMessageToEndpointComplete)
|
|
119
|
-
await sqs.sendMessage(_izContext, sendMessageToEndpointComplete)
|
|
120
|
-
|
|
121
116
|
<% } %>
|
|
122
117
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
QueueUrl: await sqsSharedLib.sqsQueueUrl(_izContext, "FlowSchemaOwnTopicEndpointCompleteHdrSqs")
|
|
126
|
-
}
|
|
127
|
-
_izContext.logger.debug("sendMessageToEndpointComplete", sendMessageToEndpointComplete)
|
|
128
|
-
await sqs.sendMessage(_izContext, sendMessageToEndpointComplete)
|
|
118
|
+
//(<endpointHook>)
|
|
119
|
+
//(</endpointHook>)
|
|
129
120
|
|
|
130
121
|
return {
|
|
131
122
|
//(<endpointReturn>)
|
|
@@ -32,7 +32,8 @@ const {
|
|
|
32
32
|
FUNCTION_NAME,
|
|
33
33
|
shortNameHandler,
|
|
34
34
|
externalResourceYaml,
|
|
35
|
-
SOURCE_GENERATE_IAM_ROLE
|
|
35
|
+
SOURCE_GENERATE_IAM_ROLE,
|
|
36
|
+
SQS_RESOURCE
|
|
36
37
|
} = require('../../../../../../MainLibs/src/Consts');
|
|
37
38
|
const { TOPIC_NAME_GENERATE_CODE } = require('../../../../../../GenerateCodeLibs/src/Consts');
|
|
38
39
|
|
|
@@ -51,11 +52,16 @@ function data(_izContext, flowSchema, srcPath) {
|
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
54
|
-
let functionName = upperCase(
|
|
55
|
+
let functionName = upperCase(flowSchema.flowTag) + "Complete"
|
|
55
56
|
let handlerType = upperCase(HANDLER.hdrSqs)
|
|
56
57
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
57
58
|
let route = flowSchema.flowTag;
|
|
58
59
|
let flowStep = Object.keys(flowSchema.flowSteps)
|
|
60
|
+
let flowStepsIn = flowStep[0];
|
|
61
|
+
let splitFlowStepsIn = flowStepsIn.split("_");
|
|
62
|
+
let topicIn = `${splitFlowStepsIn[3]}_${splitFlowStepsIn[4]}`
|
|
63
|
+
let queueName = functionName + handlerType
|
|
64
|
+
|
|
59
65
|
additionalResourcePermission.push(
|
|
60
66
|
createIamRole(
|
|
61
67
|
{
|
|
@@ -64,7 +70,7 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
|
64
70
|
]
|
|
65
71
|
},
|
|
66
72
|
[
|
|
67
|
-
resourceNames(RESOURCE_CLASSES.sns,
|
|
73
|
+
resourceNames(RESOURCE_CLASSES.sns, topicIn)
|
|
68
74
|
]
|
|
69
75
|
),
|
|
70
76
|
createIamRole(
|
|
@@ -90,6 +96,14 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
|
90
96
|
[
|
|
91
97
|
resourceNames(RESOURCE_CLASSES.webSocket)
|
|
92
98
|
]
|
|
99
|
+
),
|
|
100
|
+
createIamRole(
|
|
101
|
+
{
|
|
102
|
+
[RESOURCE_CLASSES.sqs]: [SQS_RESOURCE.sendMessage, SQS_RESOURCE.receiveMessage, SQS_RESOURCE.deleteMessage, SQS_RESOURCE.getQueueAttributes]
|
|
103
|
+
},
|
|
104
|
+
[
|
|
105
|
+
resourceNames(RESOURCE_CLASSES.sqs, queueName)
|
|
106
|
+
]
|
|
93
107
|
)
|
|
94
108
|
)
|
|
95
109
|
|
|
@@ -97,13 +111,14 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
|
97
111
|
return {
|
|
98
112
|
templatePath: templatePath,
|
|
99
113
|
templateData: {
|
|
100
|
-
resourceLocation: path.join(SOURCE_PATH.
|
|
114
|
+
resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema, flowSchema.flowTag, "source/"),
|
|
101
115
|
functionName,
|
|
102
116
|
handlerType,
|
|
103
117
|
additionalResourcePermission,
|
|
104
118
|
route,
|
|
105
119
|
functionNameConfig: upperCase(functionName) + upperCase(shortNameHandler(handlerType)),
|
|
106
|
-
roleName: SOURCE_GENERATE_IAM_ROLE.FlowSchemaOwnTopic
|
|
120
|
+
roleName: SOURCE_GENERATE_IAM_ROLE.FlowSchemaOwnTopic,
|
|
121
|
+
queueName: queueName
|
|
107
122
|
},
|
|
108
123
|
setting: {
|
|
109
124
|
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
@@ -4,13 +4,11 @@
|
|
|
4
4
|
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
5
5
|
events:
|
|
6
6
|
- sqs:
|
|
7
|
-
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%-
|
|
7
|
+
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- queueName %>
|
|
8
8
|
batchSize: 10
|
|
9
9
|
filterPatterns: #**** need to update serverless framwork upper v.2.69.1
|
|
10
10
|
- body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%- functionName %>"]}}} # functionName of callingFlow
|
|
11
11
|
- body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
|
|
12
|
-
- body: {"MessageAttributes":{"_izContext":{"Value":["x-correlation-connectionId"]}}} # functionName of callingFlow
|
|
13
|
-
- body: {"MessageAttributes":{"_izContext":{"Value":[{"exists":true}]}}}
|
|
14
12
|
role: <%- roleName %>Role
|
|
15
13
|
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
16
14
|
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
@@ -36,7 +36,7 @@ function data(_izContext, flowSchema, srcPath) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
39
|
-
let functionName = upperCase(
|
|
39
|
+
let functionName = upperCase(flowSchema.flowTag) + "Complete"
|
|
40
40
|
let handlerType = upperCase(HANDLER.hdrSqs)
|
|
41
41
|
let queueName = upperCase(functionName) + upperCase(handlerType);
|
|
42
42
|
return {
|
|
@@ -47,7 +47,7 @@ function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
|
47
47
|
queueName
|
|
48
48
|
},
|
|
49
49
|
setting: {
|
|
50
|
-
savePath: path.join(srcPath, SOURCE_PATH.
|
|
50
|
+
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, "source/"),
|
|
51
51
|
saveFileName: `${functionName}_${handlerType}`,
|
|
52
52
|
fileExtension: ".js",
|
|
53
53
|
isAppend: false
|
|
@@ -25,11 +25,11 @@ const middleware = izara.middlewareHandler;
|
|
|
25
25
|
const recordHandlerSharedLib = require("@izara_project/izara-core-library-record-handler")
|
|
26
26
|
const Logger = require('@izara_project/izara-core-library-logger');
|
|
27
27
|
|
|
28
|
-
const
|
|
28
|
+
const <%- functionName %> = require('./<%- functionName %>_Main')
|
|
29
29
|
|
|
30
30
|
// validate event properties in body.Message of sqs event
|
|
31
31
|
middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
|
|
32
|
-
|
|
32
|
+
let perRecordsValidatorSchema = {}
|
|
33
33
|
module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
34
34
|
|
|
35
35
|
try {
|
|
@@ -45,7 +45,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
45
45
|
//validate message (and MessageAttributes)
|
|
46
46
|
await recordHandlerSharedLib.validateRecord(
|
|
47
47
|
record, // one record will send to mainFunction
|
|
48
|
-
"
|
|
48
|
+
"<%- functionName %>", // queue name that need to retry or send to dlq
|
|
49
49
|
perRecordsValidatorSchema, // schema for record.Message
|
|
50
50
|
// messageAttributeValidatorSchema // ----- for msgAttr default is null -> do not send this parameter if not want to validate msgAtt
|
|
51
51
|
);
|
|
@@ -57,8 +57,8 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
57
57
|
// call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
|
|
58
58
|
let recordPromise = recordHandlerSharedLib.recordHandler(
|
|
59
59
|
record, // one record will send to mainFunction
|
|
60
|
-
|
|
61
|
-
"
|
|
60
|
+
<%- functionName %>.<%- functionName %>, // mainFunction that need to invoke.
|
|
61
|
+
"<%- functionName %>", // queue name that need to retry or send to dlq
|
|
62
62
|
passOnProperties, // all parameters that mainFunction needed.
|
|
63
63
|
);
|
|
64
64
|
record._izContext.logger.debug('after recordPromise in handler');
|
|
@@ -37,12 +37,14 @@ function data(_izContext, flowSchema, srcPath) {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
40
|
-
let functionName = upperCase(
|
|
40
|
+
let functionName = `${upperCase(flowSchema.flowTag)}Complete`
|
|
41
41
|
return {
|
|
42
42
|
templatePath: templatePath,
|
|
43
|
-
templateData: {
|
|
43
|
+
templateData: {
|
|
44
|
+
functionName
|
|
45
|
+
},
|
|
44
46
|
setting: {
|
|
45
|
-
savePath: path.join(srcPath, SOURCE_PATH.
|
|
47
|
+
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, "source/"),
|
|
46
48
|
saveFileName: `${functionName}_Main`,
|
|
47
49
|
fileExtension: ".js",
|
|
48
50
|
isAppend: false
|
|
@@ -29,11 +29,13 @@ const lambdaSharedLib = require('@izara_project/izara-core-library-lambda');
|
|
|
29
29
|
|
|
30
30
|
const externalRequest = require('@izara_project/izara-core-library-external-request');
|
|
31
31
|
const sns = externalRequest.sns
|
|
32
|
-
const { postToConnection } = require("
|
|
32
|
+
const { postToConnection } = require("../../../libs/source/GenerateCodeLibs");
|
|
33
|
+
|
|
33
34
|
const utils = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Utils')
|
|
34
35
|
const NoRetryError = require('@izara_project/izara-core-library-core').NoRetryError
|
|
35
36
|
const { v4: uuidv4 } = require('uuid')
|
|
36
37
|
const coreConsts = require("@izara_project/izara-core-library-core/src/Consts");
|
|
38
|
+
const consts = require("@izara_project/izara-middleware").consts
|
|
37
39
|
const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
38
40
|
/**
|
|
39
41
|
*
|
|
@@ -50,7 +52,7 @@ const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-librar
|
|
|
50
52
|
* @returns {object} description of return value
|
|
51
53
|
*/
|
|
52
54
|
|
|
53
|
-
module.exports
|
|
55
|
+
module.exports.<%- functionName %> = async (
|
|
54
56
|
_izContext,
|
|
55
57
|
requestParams,
|
|
56
58
|
callingFlowConfig = {},
|
|
@@ -59,9 +61,9 @@ module.exports.FlowSchemaOwnTopicComplete = async (
|
|
|
59
61
|
) => {
|
|
60
62
|
|
|
61
63
|
try {
|
|
62
|
-
_izContext.logger.debug("
|
|
63
|
-
_izContext.logger.debug("
|
|
64
|
-
_izContext.logger.debug("
|
|
64
|
+
_izContext.logger.debug("<%- functionName %> _izContext", _izContext)
|
|
65
|
+
_izContext.logger.debug("<%- functionName %> requestParams", requestParams)
|
|
66
|
+
_izContext.logger.debug("<%- functionName %> callingFlowConfig", callingFlowConfig)
|
|
65
67
|
|
|
66
68
|
let connectionId = _izContext.correlationIds.get(coreConsts.CONNECTION_ID);
|
|
67
69
|
let correlationId = _izContext.correlationIds.get(coreConsts.X_CORRELATION_ID);
|
|
@@ -51,11 +51,14 @@ function data(_izContext, flowSchema, srcPath) {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
54
|
-
let functionName = upperCase(
|
|
54
|
+
let functionName = upperCase(flowSchema.flowTag)
|
|
55
55
|
let handlerType = upperCase("hdrWbs")
|
|
56
56
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
57
57
|
let route = flowSchema.flowTag;
|
|
58
58
|
let flowStep = Object.keys(flowSchema.flowSteps)
|
|
59
|
+
let flowStepsOut = flowStep[0];
|
|
60
|
+
let splitFlowStepsIn = flowStepsOut.split("_");
|
|
61
|
+
let topicIn = `${splitFlowStepsIn[3]}_${splitFlowStepsIn[4]}`
|
|
59
62
|
additionalResourcePermission.push(
|
|
60
63
|
createIamRole(
|
|
61
64
|
{
|
|
@@ -64,7 +67,7 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
|
64
67
|
]
|
|
65
68
|
},
|
|
66
69
|
[
|
|
67
|
-
resourceNames(RESOURCE_CLASSES.sns,
|
|
70
|
+
resourceNames(RESOURCE_CLASSES.sns, topicIn)
|
|
68
71
|
]
|
|
69
72
|
),
|
|
70
73
|
createIamRole(
|
|
@@ -97,7 +100,7 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
|
97
100
|
return {
|
|
98
101
|
templatePath: templatePath,
|
|
99
102
|
templateData: {
|
|
100
|
-
resourceLocation: path.join(SOURCE_PATH.
|
|
103
|
+
resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema, flowSchema.flowTag, "source/"),
|
|
101
104
|
functionName,
|
|
102
105
|
handlerType,
|
|
103
106
|
additionalResourcePermission,
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`)%>
|
|
4
4
|
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
5
5
|
events:
|
|
6
|
-
- websocket:
|
|
7
|
-
route: $default
|
|
8
6
|
- websocket:
|
|
9
7
|
route: <%- route %>
|
|
10
8
|
# authorizer: ${self:custom.iz_authorizerAppLevel}
|
|
@@ -36,7 +36,7 @@ function data(_izContext, flowSchema, srcPath) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
39
|
-
let functionName = upperCase(
|
|
39
|
+
let functionName = upperCase(flowSchema.flowTag)
|
|
40
40
|
let handlerType = "HdrWbs"
|
|
41
41
|
let route = flowSchema.flowTag;
|
|
42
42
|
return {
|
|
@@ -47,7 +47,7 @@ function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
|
47
47
|
route
|
|
48
48
|
},
|
|
49
49
|
setting: {
|
|
50
|
-
savePath: path.join(srcPath, SOURCE_PATH.
|
|
50
|
+
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, "source/"),
|
|
51
51
|
saveFileName: `${functionName}_${handlerType}`,
|
|
52
52
|
fileExtension: ".js",
|
|
53
53
|
isAppend: false
|
|
@@ -26,8 +26,8 @@ const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-
|
|
|
26
26
|
const hash = require('object-hash')
|
|
27
27
|
// const coreConsts = require("@izara_project/izara-core-library-core/src/Consts");
|
|
28
28
|
const consts = require('@izara_project/izara-middleware/src/MiddlewareCore/Consts')
|
|
29
|
-
const { postToConnection } = require(
|
|
30
|
-
const
|
|
29
|
+
const { postToConnection } = require('../../../libs/source/GenerateCodeLibs')
|
|
30
|
+
const <%- functionName %> = require('./<%- functionName %>_Main');
|
|
31
31
|
module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
32
32
|
|
|
33
33
|
event._izContext.logger.debug('Event:', event);
|
|
@@ -58,7 +58,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
58
58
|
)
|
|
59
59
|
|
|
60
60
|
let callingFlow = eventParams?.callingFlow ? eventParams.callingFlow : {};
|
|
61
|
-
await
|
|
61
|
+
await <%- functionName %>.<%- functionName %>(
|
|
62
62
|
event._izContext,
|
|
63
63
|
eventParams,
|
|
64
64
|
callingFlowSharedLib.addCallingFlowToPassOnProperties(callingFlow)
|
|
@@ -49,16 +49,21 @@ function data(_izContext, flowSchema, srcPath) {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
52
|
-
let functionName = upperCase(
|
|
53
|
-
let topicArn = Object.keys(flowSchema.flowSteps)[0];
|
|
52
|
+
let functionName = upperCase(flowSchema.flowTag)
|
|
53
|
+
// let topicArn = Object.keys(flowSchema.flowSteps)[0];
|
|
54
|
+
let flowStep = Object.keys(flowSchema.flowSteps)
|
|
55
|
+
let flowStepsIn = flowStep[0];
|
|
56
|
+
let splitFlowStepsIn = flowStepsIn.split("_");
|
|
57
|
+
let topicArn = `${splitFlowStepsIn[3]}_${splitFlowStepsIn[4]}`
|
|
54
58
|
return {
|
|
55
59
|
templatePath: templatePath,
|
|
56
60
|
templateData: {
|
|
57
61
|
topicArn,
|
|
58
62
|
flowTag: flowSchema.flowTag,
|
|
63
|
+
functionName
|
|
59
64
|
},
|
|
60
65
|
setting: {
|
|
61
|
-
savePath: path.join(srcPath, SOURCE_PATH.
|
|
66
|
+
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, "source/"),
|
|
62
67
|
saveFileName: `${functionName}_Main`,
|
|
63
68
|
fileExtension: ".js",
|
|
64
69
|
isAppend: false
|