@izara_project/izara-market-library-service-schemas 1.0.34 → 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/Consts.js +2 -1
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +7 -6
- package/src/MainLibs/src/Consts.js +47 -14
- package/src/MainLibs/src/GenerateCodeUtils.js +2 -0
- package/src/TemplateManager/src/attributeTree/relationshipSchema/data.js +1 -1
- package/src/TemplateManager/src/attributeTreeSchema/generateTemplateData.js +103 -0
- package/src/{reStructure/TemplateData/attributeTreeSchema/mainAttributeTreeSchema → TemplateManager/src/attributeTreeSchema/mainAttributeTree}/attributeLinkTemplate.ejs +3 -7
- package/src/TemplateManager/src/attributeTreeSchema/mainAttributeTree/data.js +134 -0
- package/src/TemplateManager/src/attributeTreeSchema/referenceRelationshipSchema/data.js +84 -0
- package/src/TemplateManager/src/attributeTreeSchema/referenceRelationshipSchema/tempReferenceRelationshipSchema.ejs +9 -0
- package/src/TemplateManager/src/attributeTreeSchema/relationshipSchema/data.js +172 -0
- package/src/TemplateManager/src/attributeTreeSchema/relationshipSchema/template.ejs +7 -0
- package/src/reStructure/GenerateCode.js +1 -0
- package/src/reStructure/SchemaConfig.js +1 -3
- package/src/reStructure/TemplateData/EndpointPerService/handler/api/template.ejs +2 -2
- package/src/reStructure/TemplateData/EndpointPerService/handler/inv/template.ejs +2 -2
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/backupTemplate.ejs +701 -0
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +34 -159
- 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/functionYaml/data.js +123 -0
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/functionYaml/template.ejs +20 -0
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/handler/data.js +57 -0
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/handler/template.ejs +85 -0
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/mainFunction/data.js +68 -0
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/mainFunction/template.ejs +131 -0
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/queue/data.js +77 -0
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/queue/template.ejs +49 -0
- 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/components/websocket/connect/handler/template.ejs +4 -4
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/functionYaml/data.js +141 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/functionYaml/template.ejs +20 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/handler/data.js +55 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/handler/template.ejs +83 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/mainFunction/data.js +55 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/mainFunction/template.ejs +131 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/dynamoDB/register.js +82 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/sns-in/data.js +64 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/sns-in/template.ejs +45 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/statusFieldTemplate.ejs +19 -6
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/storedCacheTemplate.ejs +9 -15
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/subscriptionOutAll/data.js +76 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/subscriptionOutAll/template.ejs +13 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/functionYaml/data.js +164 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/functionYaml/template.ejs +18 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/handler/data.js +64 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/handler/template.ejs +88 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/mainFunction/data.js +55 -0
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/mainFunction/template.ejs +222 -0
- package/src/reStructure/TemplateData/flowSchema/dynamoDb/data.js +83 -44
- package/src/reStructure/TemplateData/flowSchema/eventBridge/functionYaml/data.js +26 -59
- package/src/reStructure/TemplateData/flowSchema/eventBridge/functionYaml/template.ejs +3 -3
- package/src/reStructure/TemplateData/flowSchema/eventBridge/handler/inv/data.js +8 -8
- package/src/reStructure/TemplateData/flowSchema/eventBridge/mainFunction/data.js +11 -9
- package/src/reStructure/TemplateData/flowSchema/eventBridge/mainFunction/template.ejs +3 -3
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/data.js +5 -9
- 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 +37 -11
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/functionYaml/template.ejs +4 -4
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/handler/data.js +8 -9
- 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 +7 -44
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/template.ejs +3 -3
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/data.js +3 -10
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/template.ejs +40 -86
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/data.js +11 -4
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/template.ejs +11 -8
- 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 +8 -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 +27 -8
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/template.ejs +50 -20
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/functionYaml/data.js +20 -5
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/functionYaml/template.ejs +1 -1
- 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 +9 -9
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/template.ejs +17 -39
- 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 +90 -21
- package/src/reStructure/TemplateData/generateRole/createSharedResource.js +22 -1
- 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/propertyValueSchema/generateTemplateData.js +66 -0
- package/src/reStructure/TemplateData/propertyValueSchema/objectPropertyValueSchema/data.js +131 -0
- package/src/reStructure/TemplateData/propertyValueSchema/objectPropertyValueSchema/templateObjectPropertyValueSchema.ejs +16 -0
- package/src/reStructure/TemplateData/propertyValueSchema/relationshipPropertyValueSchema/data.js +156 -0
- 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/libs/ValidateAddOnDataStructure.js +62 -0
- package/src/reStructure/TemplateData/attributeTreeSchema/generateTemplateData.js +0 -104
- package/src/reStructure/TemplateData/attributeTreeSchema/mainAttributeTreeSchema/data.js +0 -188
- /package/src/{reStructure/TemplateData/attributeTreeSchema/mainAttributeTreeSchema → TemplateManager/src/attributeTreeSchema/mainAttributeTree}/request.json +0 -0
|
@@ -33,7 +33,8 @@ const {
|
|
|
33
33
|
FUNCTION_NAME,
|
|
34
34
|
shortNameHandler,
|
|
35
35
|
externalResourceYaml,
|
|
36
|
-
SOURCE_GENERATE_IAM_ROLE
|
|
36
|
+
SOURCE_GENERATE_IAM_ROLE,
|
|
37
|
+
SQS_RESOURCE
|
|
37
38
|
} = require("../../../../../../MainLibs/src/Consts");
|
|
38
39
|
|
|
39
40
|
const templatePath = path.join(__dirname, "template.ejs");
|
|
@@ -50,26 +51,51 @@ function data(_izContext, flowSchema, srcPath) {
|
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
53
|
-
let functionName = upperCase(
|
|
54
|
+
let functionName = upperCase(FUNCTION_NAME.flowSchemaExternalTopic);
|
|
54
55
|
let handlerType = upperCase(HANDLER.hdrSqs);
|
|
55
56
|
let externalTopicName = FUNCTION_NAME.flowSchemaExternalTopic + 'Out';
|
|
56
|
-
let
|
|
57
|
-
let functionConfig = upperCase(flowSchema.flowTag) + externalTopicShortName + upperCase(shortNameHandler(handlerType));
|
|
57
|
+
let functionConfig = "ExtTopicOut" + upperCase(shortNameHandler(handlerType));
|
|
58
58
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
59
|
-
|
|
60
|
-
const action = flowSchema.flowTag || 'defaultAction'; // Using flowTag as the action name
|
|
61
|
-
const event = resourceNames(RESOURCE_CLASSES.sqs, upperCase(action) + upperCase(handler));
|
|
62
|
-
|
|
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
|
+
additionalResourcePermission.push(
|
|
63
|
+
createIamRole(
|
|
64
|
+
{
|
|
65
|
+
[RESOURCE_CLASSES.sqs]: [
|
|
66
|
+
SQS_RESOURCE.getQueueAttributes,
|
|
67
|
+
SQS_RESOURCE.receiveMessage,
|
|
68
|
+
SQS_RESOURCE.deleteMessage,
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
[
|
|
72
|
+
resourceNames(RESOURCE_CLASSES.sqs, functionName + handlerType),
|
|
73
|
+
resourceNames(RESOURCE_CLASSES.sqs, functionName + handlerType + "DLQ"),
|
|
74
|
+
// resourceNames(RESOURCE_CLASSES.sqs, functionName + "Out"),
|
|
75
|
+
// resourceNames(RESOURCE_CLASSES.sqs, functionName + "OutDLQ"),
|
|
76
|
+
]
|
|
77
|
+
),
|
|
78
|
+
// createIamRole(
|
|
79
|
+
// {
|
|
80
|
+
// [RESOURCE_CLASSES.sns]: [
|
|
81
|
+
// SNS_RESOURCE.publish,
|
|
82
|
+
// ]
|
|
83
|
+
// },
|
|
84
|
+
// [
|
|
85
|
+
// resourceNames(RESOURCE_CLASSES.sns, flowStepInSplitKey[2] + flowStepInSplitKey[3]),
|
|
86
|
+
// ]
|
|
87
|
+
// )
|
|
88
|
+
);
|
|
63
89
|
return {
|
|
64
90
|
templatePath: templatePath,
|
|
65
91
|
templateData: {
|
|
66
|
-
resourceLocation: SOURCE_PATH.
|
|
67
|
-
event,
|
|
92
|
+
resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema, flowSchema.flowTag, "source/"),
|
|
68
93
|
functionName,
|
|
69
94
|
handlerType,
|
|
70
95
|
functionNameConfig: functionConfig,
|
|
71
96
|
roleName: SOURCE_GENERATE_IAM_ROLE.ExternalTopicRole,
|
|
72
|
-
externalTopicName
|
|
97
|
+
externalTopicName,
|
|
98
|
+
additionalResourcePermission,
|
|
73
99
|
},
|
|
74
100
|
setting: {
|
|
75
101
|
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<%_ const join = require('path').join _%>
|
|
2
2
|
<%- firstLetterUpperCase(functionNameConfig) %>:
|
|
3
|
-
handler: <%- join(resourceLocation,
|
|
3
|
+
handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}Out_${firstLetterUpperCase(handlerType)}.main`) %>
|
|
4
4
|
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionNameConfig) %>
|
|
5
5
|
events:
|
|
6
6
|
- sqs:
|
|
7
|
-
arn: <%-
|
|
7
|
+
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) + firstLetterUpperCase(handlerType) %>
|
|
8
8
|
batchSize: 10
|
|
9
9
|
role: <%- firstLetterUpperCase(roleName) _%>Role
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
11
|
+
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
12
12
|
<%_ function firstLetterUpperCase(text){
|
|
13
13
|
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
14
14
|
} _%>
|
|
@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
20
20
|
const path = require('path');
|
|
21
21
|
const { FLOW_SCHEMA_HOOK_STATE, HANDLER } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
22
22
|
|
|
23
|
-
const { SOURCE_PATH, FUNCTION_NAME } = require("../../../../../../MainLibs/src/Consts");
|
|
23
|
+
const { SOURCE_PATH, FUNCTION_NAME, SOURCE_GENERATE_IAM_ROLE } = require("../../../../../../MainLibs/src/Consts");
|
|
24
24
|
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils");
|
|
25
25
|
const templatePath = path.join(__dirname, "template.ejs")
|
|
26
26
|
|
|
@@ -41,22 +41,21 @@ function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
|
41
41
|
_izContext.logger.error(`flowStepInSplitKey.length < 4: ${flowStepInSplitKey.length} ${flowSchema.flowTag}`);
|
|
42
42
|
return null;
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
let queueName = (flowStepInSplitKey[2]) + (flowStepInSplitKey[3]) + 'Out';
|
|
46
|
-
let functionName = upperCase(FUNCTION_NAME.flowSchemaExternalTopic)
|
|
44
|
+
let functionName = upperCase(flowSchema.flowTag) + "ExternalTopicOut"
|
|
47
45
|
let handlerType = upperCase(HANDLER.hdrSqs);
|
|
48
46
|
return {
|
|
49
47
|
templatePath: templatePath,
|
|
50
48
|
templateData: {
|
|
51
|
-
queueName,
|
|
52
|
-
fileName:
|
|
53
|
-
functionMain:
|
|
49
|
+
queueName: functionName + handlerType,
|
|
50
|
+
fileName: functionName + '_Main',
|
|
51
|
+
functionMain: functionName + 'Main',
|
|
54
52
|
handler: HANDLER.hdrSqs,
|
|
55
53
|
firstLetterUpperCase: upperCase,
|
|
54
|
+
functionName
|
|
56
55
|
},
|
|
57
56
|
setting: {
|
|
58
|
-
savePath: path.join(srcPath, SOURCE_PATH.
|
|
59
|
-
saveFileName: `${functionName}
|
|
57
|
+
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, 'source/'),
|
|
58
|
+
saveFileName: `${functionName}_${handlerType}`,
|
|
60
59
|
fileExtension: ".js",
|
|
61
60
|
isAppend: false
|
|
62
61
|
}
|
|
@@ -29,7 +29,7 @@ const { <%- functionMain %> } =require('./<%- firstLetterUpperCase(fileName) %>.
|
|
|
29
29
|
// validate event properties in body.Message of sqs event
|
|
30
30
|
middlewareHandler.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
|
|
31
31
|
// set schema for record.body.Message
|
|
32
|
-
|
|
32
|
+
const perRecordsValidatorSchema = {}
|
|
33
33
|
// type: "object",
|
|
34
34
|
// required: ['param1', 'param2', 'param3', 'param4',],
|
|
35
35
|
// properties: {
|
|
@@ -63,18 +63,18 @@ middlewareHandler.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema(
|
|
|
63
63
|
// };
|
|
64
64
|
|
|
65
65
|
// set schema for record.body.MessageAttributes
|
|
66
|
-
const messageAttributeValidatorSchema = {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
};
|
|
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
78
|
|
|
79
79
|
module.exports.main = middlewareHandler.wrap(async (event, context, callback) => {
|
|
80
80
|
|
|
@@ -38,7 +38,7 @@ function data(_izContext, flowSchema, srcPath) {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
41
|
-
let functionName = upperCase(
|
|
41
|
+
let functionName = upperCase(flowSchema.flowTag) + "ExternalTopicOut";
|
|
42
42
|
let snsTopicIn = Object.keys(flowSchema.flowSteps)
|
|
43
43
|
let snsTopicInWithoutUnderscore = snsTopicIn[0].replace(/_/g, '')
|
|
44
44
|
let handlerType = upperCase(HANDLER.hdrSqs);
|
|
@@ -48,11 +48,11 @@ function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
|
48
48
|
templatePath: templatePath,
|
|
49
49
|
templateData: {
|
|
50
50
|
snsTopicIn: snsTopicInWithoutUnderscore,
|
|
51
|
-
externalTopicOutMain:
|
|
51
|
+
externalTopicOutMain: functionName,
|
|
52
52
|
},
|
|
53
53
|
setting: {
|
|
54
|
-
savePath: path.join(srcPath, SOURCE_PATH.
|
|
55
|
-
saveFileName: `${functionName}
|
|
54
|
+
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, 'source/'),
|
|
55
|
+
saveFileName: `${functionName}_Main`,
|
|
56
56
|
fileExtension: ".js",
|
|
57
57
|
isAppend: false
|
|
58
58
|
}
|
|
@@ -1,70 +1,45 @@
|
|
|
1
|
-
/*
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
|
16
|
-
<http: //www.gnu.org/licenses />.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
'use strict';
|
|
20
|
-
|
|
21
|
-
const hash = require("object-hash");
|
|
22
|
-
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
|
|
23
|
-
|
|
1
|
+
/* Copyright (C) 2020 Sven Mason <http: //izara.io> This program is free
|
|
2
|
+
software: you can redistribute it and/or modify it under the terms of the GNU
|
|
3
|
+
Affero General Public License as published by the Free Software Foundation,
|
|
4
|
+
either version 3 of the License, or (at your option) any later version. This
|
|
5
|
+
program is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
6
|
+
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
7
|
+
PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
|
8
|
+
You should have received a copy of the GNU Affero General Public License along
|
|
9
|
+
with this program. If not, see <http: //www.gnu.org/licenses />. */ 'use
|
|
10
|
+
strict'; const hash = require("object-hash"); const getObjectSchema =
|
|
11
|
+
require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
|
|
24
12
|
const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
|
|
25
|
-
const snsSharedLib = require('@izara_project/izara-core-library-sns');
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const NoRetryError =
|
|
35
|
-
const { v4: uuidv4 } =
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
|
|
42
|
-
* @param {Object}
|
|
43
|
-
* @param {
|
|
44
|
-
* @
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
//(</additionalParams>)
|
|
59
|
-
) => {
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
|
|
63
|
-
//(<additionalParams>)
|
|
64
|
-
//(</additionalParams>)
|
|
65
|
-
|
|
66
|
-
} catch (err) {
|
|
67
|
-
_izContext.logger.error('error WebSocketInvoke: ', err)
|
|
68
|
-
throw (err)
|
|
69
|
-
}
|
|
70
|
-
}
|
|
13
|
+
const snsSharedLib = require('@izara_project/izara-core-library-sns'); const
|
|
14
|
+
asyncFlowSharedLib =
|
|
15
|
+
require('@izara_project/izara-core-library-asynchronous-flow'); const
|
|
16
|
+
callingFlowSharedLib =
|
|
17
|
+
require('@izara_project/izara-core-library-calling-flow'); const lambdaSharedLib
|
|
18
|
+
= require('@izara_project/izara-core-library-lambda'); const externalRequestSns
|
|
19
|
+
= require('@izara_project/izara-core-library-external-request').sns; const utils
|
|
20
|
+
=
|
|
21
|
+
require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Utils')
|
|
22
|
+
const { NoRetryError, consts } =
|
|
23
|
+
require('@izara_project/izara-core-library-core') const { v4: uuidv4 } =
|
|
24
|
+
require('uuid') const { TOPIC_NAME_GENERATE_CODE } =
|
|
25
|
+
require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
26
|
+
const { postToConnection } = require("../../../libs/source/GenerateCodeLibs");
|
|
27
|
+
/** * * * description of function. * @param {Object} _izContext * @param
|
|
28
|
+
{CorrelationIds} _izContext.correlationIds - property of _izContext * @param
|
|
29
|
+
{Logger} _izContext.logger - property of _izContext * @param {Object}
|
|
30
|
+
requestParams - request params * @param {Object} requestParams.identifiers -
|
|
31
|
+
identifiers for get data * @param {Object} requestParams.additionalRequest -
|
|
32
|
+
additionalRequest * * * @returns {object} description of return value */
|
|
33
|
+
module.exports.<%- externalTopicOutMain %>Main = async ( _izContext,
|
|
34
|
+
requestParams, callingFlowConfig = {}, //(<additionalParams
|
|
35
|
+
>) //(</additionalParams
|
|
36
|
+
>) ) => { try { let connectionId =
|
|
37
|
+
_izContext.correlationIds.get(coreConsts.CONNECTION_ID); let correlationId =
|
|
38
|
+
_izContext.correlationIds.get(coreConsts.X_CORRELATION_ID); await
|
|
39
|
+
postToConnection( { message: requestParams }, connectionId ) await
|
|
40
|
+
dynamodbSharedLib.deleteItem(_izContext, await
|
|
41
|
+
dynamodbSharedLib.tableName(_izContext, "WebSocketTask"), { taskKey:
|
|
42
|
+
correlationId, connectionId: connectionId } ) //(<additionalParams
|
|
43
|
+
>) //(</additionalParams
|
|
44
|
+
>) } catch (err) { _izContext.logger.error('error WebSocketInvoke: ', err) throw
|
|
45
|
+
(err) } }
|
package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/data.js
CHANGED
|
@@ -53,23 +53,11 @@ function data(_izContext, flowSchema, srcPath) {
|
|
|
53
53
|
function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
54
54
|
let functionName = upperCase(flowSchema.flowTag);
|
|
55
55
|
let handlerType = upperCase("hdrWbs");
|
|
56
|
-
let
|
|
57
|
-
let externalTopicShortName = 'ExtTopic';
|
|
58
|
-
let functionConfig = upperCase(flowSchema.flowTag) + externalTopicShortName + upperCase(shortNameHandler(handlerType));
|
|
56
|
+
let functionConfig = functionName + "ExternalTopicIn" + upperCase(shortNameHandler(handlerType));
|
|
59
57
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
60
|
-
let route =
|
|
58
|
+
let route = flowSchema.flowTag;
|
|
61
59
|
|
|
62
60
|
additionalResourcePermission.push(
|
|
63
|
-
createIamRole(
|
|
64
|
-
{
|
|
65
|
-
[RESOURCE_CLASSES.sns]: [
|
|
66
|
-
SNS_RESOURCE.publish
|
|
67
|
-
]
|
|
68
|
-
},
|
|
69
|
-
[
|
|
70
|
-
resourceNames(RESOURCE_CLASSES.sns, "InImportBatchMainCreate")
|
|
71
|
-
]
|
|
72
|
-
),
|
|
73
61
|
createIamRole(
|
|
74
62
|
{
|
|
75
63
|
[RESOURCE_CLASSES.dynamoDbTable]: [
|
|
@@ -93,47 +81,22 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
|
93
81
|
[
|
|
94
82
|
resourceNames(RESOURCE_CLASSES.webSocket)
|
|
95
83
|
]
|
|
96
|
-
)
|
|
84
|
+
),
|
|
97
85
|
)
|
|
98
86
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
if (hookName === FLOW_SCHEMA_HOOK_STATE.beforeCreate) {
|
|
102
|
-
for (const hookFunction of hookProperties.functionList) {
|
|
103
|
-
if ((hookFunction.event.hasOwnProperty("initialEvent") && (hookFunction.event.initialEvent === true))) {
|
|
104
|
-
if (hookFunction?.permission) {
|
|
105
|
-
for (const permission of hookFunction.permission) {
|
|
106
|
-
additionalResourcePermission.push(
|
|
107
|
-
createIamRole(
|
|
108
|
-
permission.action,
|
|
109
|
-
permission.resource.map(resource =>
|
|
110
|
-
externalResourceYaml(
|
|
111
|
-
resource.resource,
|
|
112
|
-
resource.resourceName,
|
|
113
|
-
resource.serviceTag),
|
|
114
|
-
permission.effect
|
|
115
|
-
)
|
|
116
|
-
)
|
|
117
|
-
)
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
// console.log("additionalResourcePermission in createObjectS3", JSON.stringify(additionalResourcePermission))
|
|
87
|
+
|
|
88
|
+
|
|
126
89
|
return {
|
|
127
90
|
templatePath: templatePath,
|
|
128
91
|
templateData: {
|
|
129
|
-
resourceLocation: SOURCE_PATH.
|
|
92
|
+
resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchemaExternalTopic, flowSchema.flowTag, "source/"),
|
|
130
93
|
functionName,
|
|
131
94
|
handlerType,
|
|
132
95
|
functionNameConfig: functionConfig,
|
|
133
96
|
additionalResourcePermission,
|
|
134
97
|
route,
|
|
135
98
|
roleName: SOURCE_GENERATE_IAM_ROLE.ExternalTopicRole,
|
|
136
|
-
externalTopicName
|
|
99
|
+
// externalTopicName
|
|
137
100
|
},
|
|
138
101
|
setting: {
|
|
139
102
|
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/template.ejs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<%_ const join = require('path').join; _%>
|
|
2
2
|
<%- firstLetterUpperCase(functionNameConfig) %>:
|
|
3
|
-
handler: <%- join(resourceLocation,
|
|
3
|
+
handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`)%>
|
|
4
4
|
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionNameConfig) %>
|
|
5
5
|
events:
|
|
6
6
|
- websocket:
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
# authorizer: ${self:custom.iz_authorizerAppLevel}
|
|
9
9
|
# identifierResource: 'route.request.header.Auth'
|
|
10
10
|
role: <%- roleName %>Role
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
12
|
+
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
13
13
|
<%_ function firstLetterUpperCase(text){
|
|
14
14
|
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
15
15
|
} _%>
|
|
@@ -36,25 +36,18 @@ function data(_izContext, flowSchema, srcPath) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
39
|
-
|
|
40
|
-
let functionName = FUNCTION_NAME.flowSchemaExternalTopic
|
|
39
|
+
let functionName = upperCase(flowSchema.flowTag) + "ExternalTopicIn"
|
|
41
40
|
let handlerType = "HdrWbs"
|
|
42
|
-
let hook = false;
|
|
43
|
-
let hookFunctionName;
|
|
44
|
-
let isAsync = false;
|
|
45
41
|
const flowTag = flowSchema.flowTag
|
|
46
42
|
return {
|
|
47
43
|
templatePath: templatePath,
|
|
48
44
|
templateData: {
|
|
49
|
-
hook: hook,
|
|
50
|
-
hookFunctionName: hookFunctionName,
|
|
51
|
-
isAsync,
|
|
52
45
|
functionName: functionName,
|
|
53
46
|
fileName: upperCase(functionName),
|
|
54
|
-
flowTag
|
|
47
|
+
flowTag,
|
|
55
48
|
},
|
|
56
49
|
setting: {
|
|
57
|
-
savePath: path.join(srcPath, SOURCE_PATH.
|
|
50
|
+
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, 'source/'),
|
|
58
51
|
saveFileName: `${upperCase(functionName)}_${handlerType}`,
|
|
59
52
|
fileExtension: ".js",
|
|
60
53
|
isAppend: false
|
package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/template.ejs
CHANGED
|
@@ -1,86 +1,40 @@
|
|
|
1
|
-
/*
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
switch (route) {
|
|
43
|
-
case '<%- flowTag%>':
|
|
44
|
-
console.log("event in route <%- flowTag%>", event);
|
|
45
|
-
let eventParams = JSON.parse(event.body)
|
|
46
|
-
|
|
47
|
-
await dynamodbSharedLib.putItem(
|
|
48
|
-
event._izContext,
|
|
49
|
-
await dynamodbSharedLib.tableName(event._izContext, "WebSocketTask"),
|
|
50
|
-
{
|
|
51
|
-
taskKey: correlationId,
|
|
52
|
-
connectionId: connectionId,
|
|
53
|
-
}
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
let callingFlow = eventParams?.callingFlow ? eventParams.callingFlow : {};
|
|
57
|
-
|
|
58
|
-
await <%- functionName%>Main(
|
|
59
|
-
event._izContext,
|
|
60
|
-
eventParams,
|
|
61
|
-
callingFlowSharedLib.addCallingFlowToPassOnProperties(callingFlow)
|
|
62
|
-
//(<additionalParams>)
|
|
63
|
-
//(</additionalParams>)
|
|
64
|
-
)
|
|
65
|
-
break
|
|
66
|
-
}
|
|
67
|
-
} else {
|
|
68
|
-
const connId = event.connId;
|
|
69
|
-
// await postMessage({ message: event.message }, connId);
|
|
70
|
-
await postToConnection({ message: event.message }, connId);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return (izara.response.webSocketSuccess());
|
|
74
|
-
|
|
75
|
-
} catch (err) {
|
|
76
|
-
const connId = event.requestContext.connectionId
|
|
77
|
-
event._izContext.logger.error('Error, WebSocket: ', err);
|
|
78
|
-
// await sendErrorMessage({ message: err.message }, connId);
|
|
79
|
-
await postToConnection({ message: err.message }, connId);
|
|
80
|
-
return (izara.response.failure(err));
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
<%_ const join = require('path').join _%>
|
|
84
|
-
<%_ function upperCase (text) {
|
|
85
|
-
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
86
|
-
} _%>
|
|
1
|
+
/* Copyright (C) 2021 Sven Mason <http://izara.io> This program is free
|
|
2
|
+
software: you can redistribute it and/or modify it under the terms of the GNU
|
|
3
|
+
Affero General Public License as published by the Free Software Foundation,
|
|
4
|
+
either version 3 of the License, or (at your option) any later version. This
|
|
5
|
+
program is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
6
|
+
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
7
|
+
PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
|
8
|
+
You should have received a copy of the GNU Affero General Public License along
|
|
9
|
+
with this program. If not, see <http://www.gnu.org/licenses/>. */ 'use strict';
|
|
10
|
+
const { middlewareHandler, consts } =
|
|
11
|
+
require("@izara_project/izara-middleware"); // const AWS = require('aws-sdk');
|
|
12
|
+
// const api = new AWS.ApiGatewayManagementApi({ endpoint:
|
|
13
|
+
process.env.iz_webSocketEndpoint }); const dynamodbSharedLib =
|
|
14
|
+
require('@izara_project/izara-core-library-dynamodb'); const
|
|
15
|
+
callingFlowSharedLib =
|
|
16
|
+
require('@izara_project/izara-core-library-calling-flow'); const hash =
|
|
17
|
+
require('object-hash'); // const coreConsts =
|
|
18
|
+
require("@izara_project/izara-core-library-core/src/Consts"); const {
|
|
19
|
+
postToConnection } = require("../../../libs/source/GenerateCodeLibs"); const {
|
|
20
|
+
<%- functionName%>Main } = require("./<%- fileName%>_Main"); module.exports.main
|
|
21
|
+
= middlewareHandler.wrap(async (event, context, callback) => {
|
|
22
|
+
event._izContext.logger.debug('Event:', event); try { if (event.requestContext)
|
|
23
|
+
{ const route = event.requestContext.routeKey; const connectionId =
|
|
24
|
+
event.requestContext.connectionId; let correlationId =
|
|
25
|
+
event._izContext.correlationIds.get(consts.X_CORRELATION_ID) switch (route) {
|
|
26
|
+
case '<%- flowTag%>': console.log("event in route <%- flowTag%>", event); let
|
|
27
|
+
eventParams = JSON.parse(event.body) await dynamodbSharedLib.putItem(
|
|
28
|
+
event._izContext, await dynamodbSharedLib.tableName(event._izContext,
|
|
29
|
+
"WebSocketTask"), { taskKey: correlationId, connectionId: connectionId,
|
|
30
|
+
originTimestamp: Date.now() } ) let callingFlow = eventParams?.callingFlow ?
|
|
31
|
+
eventParams.callingFlow : {}; await <%- functionName%>Main( event._izContext,
|
|
32
|
+
eventParams, callingFlowSharedLib.addCallingFlowToPassOnProperties(callingFlow)
|
|
33
|
+
//(<additionalParams>) //(</additionalParams>) ) break } } else { const connId =
|
|
34
|
+
event.connId; // await postMessage({ message: event.message }, connId); await
|
|
35
|
+
postToConnection({ message: event.message }, connId); } } catch (err) { const
|
|
36
|
+
connId = event.requestContext.connectionId event._izContext.logger.error('Error,
|
|
37
|
+
WebSocket: ', err); // await sendErrorMessage({ message: err.message }, connId);
|
|
38
|
+
await postToConnection({ message: err.message }, connId); } }); <%_ const join =
|
|
39
|
+
require('path').join _%> <%_ function upperCase (text) { return
|
|
40
|
+
text.charAt(0).toUpperCase() + text.slice(1) } _%>
|
package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/data.js
CHANGED
|
@@ -23,6 +23,8 @@ const { SOURCE_PATH, FUNCTION_NAME } = require("../../../../../../MainLibs/src/C
|
|
|
23
23
|
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils");
|
|
24
24
|
const templatePath = path.join(__dirname, "template.ejs");
|
|
25
25
|
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema')
|
|
26
|
+
const statusFieldTemplate = path.join(__dirname, "../../../createRecordByStatusType/statusFieldTemplate.ejs")
|
|
27
|
+
const storedCacheTemplate = path.join(__dirname, "../../../createRecordByStatusType/storedCacheTemplate.ejs")
|
|
26
28
|
|
|
27
29
|
/**
|
|
28
30
|
* receive objectSchema
|
|
@@ -38,19 +40,24 @@ function data(_izContext, flowSchema, srcPath) {
|
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
41
|
-
|
|
43
|
+
let functionName = upperCase(flowSchema.flowTag) + "ExternalTopicIn"
|
|
42
44
|
const splitKey = Object.keys(flowSchema.flowSteps)[0].split('_')
|
|
45
|
+
// stockLocation_Test_flowStep_TopicName_In
|
|
43
46
|
// let objectSchema = await getObjectSchema.getObjectSchemaCombineFieldNamesWithCache(_izContext, flowSchema.objType)
|
|
44
47
|
// let fieldNames = Object.keys(objectSchema.fieldNames)
|
|
45
48
|
return {
|
|
46
49
|
templatePath: templatePath,
|
|
47
50
|
templateData: {
|
|
48
51
|
serviceTag: splitKey[0],
|
|
49
|
-
topicName: splitKey[
|
|
50
|
-
externalTopicMain:
|
|
52
|
+
topicName: splitKey[2] + '_' + splitKey[3],
|
|
53
|
+
externalTopicMain: functionName + 'Main',
|
|
54
|
+
storedCacheTemplate,
|
|
55
|
+
statusFieldTemplate,
|
|
56
|
+
statusType: flowSchema.statusType,
|
|
57
|
+
flowTag: flowSchema.flowTag,
|
|
51
58
|
},
|
|
52
59
|
setting: {
|
|
53
|
-
savePath: path.join(srcPath, SOURCE_PATH.
|
|
60
|
+
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, 'source/'),
|
|
54
61
|
saveFileName: `${functionName}_Main`,
|
|
55
62
|
fileExtension: ".js",
|
|
56
63
|
isAppend: false
|