@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
|
@@ -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
|
|
@@ -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)
|
|
@@ -33,8 +33,7 @@ const {
|
|
|
33
33
|
SOURCE_GENERATE_IAM_ROLE
|
|
34
34
|
} = require('../../../../../../MainLibs/src/Consts');
|
|
35
35
|
const templatePath = path.join(__dirname, "template.ejs");
|
|
36
|
-
|
|
37
|
-
const storedCacheTemplate = path.join(__dirname, "../../../createRecordByStatusType/storedCacheTemplate.ejs")
|
|
36
|
+
|
|
38
37
|
|
|
39
38
|
/**
|
|
40
39
|
* receive objectSchema
|
|
@@ -50,20 +49,21 @@ function data(_izContext, flowSchema, srcPath) {
|
|
|
50
49
|
}
|
|
51
50
|
|
|
52
51
|
function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
53
|
-
let functionName = upperCase(
|
|
54
|
-
let topicArn = Object.keys(flowSchema.flowSteps)[0];
|
|
55
|
-
let
|
|
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]}`
|
|
56
58
|
return {
|
|
57
59
|
templatePath: templatePath,
|
|
58
60
|
templateData: {
|
|
59
61
|
topicArn,
|
|
60
|
-
statusType,
|
|
61
|
-
statusFieldTemplate,
|
|
62
|
-
storedCacheTemplate,
|
|
63
62
|
flowTag: flowSchema.flowTag,
|
|
63
|
+
functionName
|
|
64
64
|
},
|
|
65
65
|
setting: {
|
|
66
|
-
savePath: path.join(srcPath, SOURCE_PATH.
|
|
66
|
+
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, "source/"),
|
|
67
67
|
saveFileName: `${functionName}_Main`,
|
|
68
68
|
fileExtension: ".js",
|
|
69
69
|
isAppend: false
|
|
@@ -34,9 +34,8 @@ const utils = require('@izara_project/izara-market-library-service-schemas/src/M
|
|
|
34
34
|
const NoRetryError = require('@izara_project/izara-core-library-core').NoRetryError
|
|
35
35
|
const coreConsts = require("@izara_project/izara-core-library-core/src/Consts");
|
|
36
36
|
const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
<% } %>
|
|
37
|
+
const { postToConnection } = require('../../../libs/source/GenerateCodeLibs')
|
|
38
|
+
|
|
40
39
|
/**
|
|
41
40
|
*
|
|
42
41
|
*
|
|
@@ -52,7 +51,7 @@ const { createFieldNamesFromRequestParamsByObjectSchema } = require('@izara_proj
|
|
|
52
51
|
* @returns {object} description of return value
|
|
53
52
|
*/
|
|
54
53
|
|
|
55
|
-
module.exports
|
|
54
|
+
module.exports.<%- functionName %> = async (
|
|
56
55
|
_izContext,
|
|
57
56
|
requestParams,
|
|
58
57
|
callingFlowConfig = {},
|
|
@@ -61,9 +60,9 @@ module.exports.flowSchemaOwnTopic = async (
|
|
|
61
60
|
) => {
|
|
62
61
|
|
|
63
62
|
try {
|
|
64
|
-
_izContext.logger.debug("
|
|
65
|
-
_izContext.logger.debug("
|
|
66
|
-
_izContext.logger.debug("
|
|
63
|
+
_izContext.logger.debug("<%- functionName %> _izContext", _izContext)
|
|
64
|
+
_izContext.logger.debug("<%- functionName %> requestParams", requestParams)
|
|
65
|
+
_izContext.logger.debug("<%- functionName %> callingFlowConfig", callingFlowConfig)
|
|
67
66
|
|
|
68
67
|
let flowSchema = await getObjectSchema.getFlowSchemaS3WithCache(_izContext, {
|
|
69
68
|
flowTag: requestParams.action,
|
|
@@ -72,39 +71,19 @@ module.exports.flowSchemaOwnTopic = async (
|
|
|
72
71
|
|
|
73
72
|
_izContext.logger.debug("flowSchema", flowSchema)
|
|
74
73
|
|
|
74
|
+
let connectionId = _izContext.correlationIds.get(coreConsts.CONNECTION_ID);
|
|
75
75
|
|
|
76
76
|
if (!flowSchema) {
|
|
77
|
-
|
|
77
|
+
await postToConnection({
|
|
78
|
+
message: {
|
|
79
|
+
error: `flowTag not found ${requestParams.action}`
|
|
80
|
+
}
|
|
81
|
+
},connectionId)
|
|
82
|
+
throw new NoRetryError(`flowTag not found ${requestParams.action}`);
|
|
78
83
|
}
|
|
79
84
|
|
|
80
|
-
|
|
81
|
-
<%- include(statusFieldTemplate) %>
|
|
82
|
-
<% } else if (statusType === "storedCache") { %>
|
|
83
|
-
<%- include(storedCacheTemplate) %>
|
|
84
|
-
let messageObject = {
|
|
85
|
-
requestParams:requestParams
|
|
86
|
-
}
|
|
87
|
-
// create callingFlow
|
|
88
|
-
messageObject = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
|
|
89
|
-
messageObject,
|
|
90
|
-
callingFlowSharedLib.addParentCallingFlowConfig(
|
|
91
|
-
callingFlowConfig,
|
|
92
|
-
callingFlowSharedLib.createCallingFlowConfig(
|
|
93
|
-
await lambdaSharedLib.lambdaFunctionName(_izContext, TOPIC_NAME_GENERATE_CODE.flowSchemaOwnTopicComplete), {}
|
|
94
|
-
)
|
|
95
|
-
)
|
|
96
|
-
)
|
|
85
|
+
let messageObject = requestParams
|
|
97
86
|
|
|
98
|
-
let sendMessageToCreateEndpoint = {
|
|
99
|
-
Message: JSON.stringify(messageObject),
|
|
100
|
-
TopicArn: await snsSharedLib.snsTopicArnByFlowSchema(_izContext, "<%- topicArn %>")
|
|
101
|
-
}
|
|
102
|
-
_izContext.logger.debug("sendMessageToCreateEndpoint", sendMessageToCreateEndpoint);
|
|
103
|
-
await sns.publishAsync(_izContext, sendMessageToCreateEndpoint);
|
|
104
|
-
<% } else if (statusType === "none") { %>
|
|
105
|
-
let messageObject = {
|
|
106
|
-
requestParams:requestParams
|
|
107
|
-
}
|
|
108
87
|
// create callingFlow
|
|
109
88
|
messageObject = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
|
|
110
89
|
messageObject,
|
|
@@ -116,13 +95,12 @@ module.exports.flowSchemaOwnTopic = async (
|
|
|
116
95
|
)
|
|
117
96
|
)
|
|
118
97
|
|
|
119
|
-
let
|
|
98
|
+
let sendMessageToEndpoint = {
|
|
120
99
|
Message: JSON.stringify(messageObject),
|
|
121
100
|
TopicArn: await snsSharedLib.snsTopicArnByFlowSchema(_izContext, "<%- topicArn %>")
|
|
122
101
|
}
|
|
123
|
-
_izContext.logger.debug("
|
|
124
|
-
await sns.publishAsync(_izContext,
|
|
125
|
-
<% } %>
|
|
102
|
+
_izContext.logger.debug("sendMessageToEndpoint", sendMessageToEndpoint);
|
|
103
|
+
await sns.publishAsync(_izContext, sendMessageToEndpoint);
|
|
126
104
|
|
|
127
105
|
} catch (err) {
|
|
128
106
|
_izContext.logger.error('error WebSocketInvoke: ', err)
|
|
@@ -58,9 +58,15 @@ function createDataForDefaultSnsInSqs(_izContext, flowSchema, srcPath) {
|
|
|
58
58
|
|
|
59
59
|
// GCTpBasTestInPersonCreate => GCTpBas_Test_PersonCreate_In
|
|
60
60
|
let flowSteps = Object.keys(flowSchema.flowSteps)
|
|
61
|
+
let flowStepsIn = flowSteps[0];
|
|
62
|
+
let flowStepOut = flowSteps[1];
|
|
63
|
+
let splitFlowStepsIn = flowStepsIn.split("_");
|
|
64
|
+
let splitFlowStepsOut = flowStepOut.split("_")
|
|
65
|
+
let topicIn = splitFlowStepsIn[3]
|
|
66
|
+
let topicOut = splitFlowStepsOut[3]
|
|
61
67
|
const generatedSnsTopicInForFlowSchema = [
|
|
62
68
|
{
|
|
63
|
-
queueName: upperCase(
|
|
69
|
+
queueName: upperCase(topicIn),
|
|
64
70
|
},
|
|
65
71
|
];
|
|
66
72
|
|
|
@@ -75,12 +81,9 @@ function createDataForDefaultSnsInSqs(_izContext, flowSchema, srcPath) {
|
|
|
75
81
|
|
|
76
82
|
let defaultDsqQueueDataList = [
|
|
77
83
|
{
|
|
78
|
-
queueName: upperCase(
|
|
79
|
-
subscribeTo:
|
|
80
|
-
}
|
|
81
|
-
// {
|
|
82
|
-
// queueName: upperCase(FUNCTION_NAME.flowSchemaOwnTopicComplete) + upperCase(HANDLER.hdrSqs)
|
|
83
|
-
// }
|
|
84
|
+
queueName: `${upperCase(flowSchema.flowTag)}Complete` + upperCase(HANDLER.hdrSqs),
|
|
85
|
+
subscribeTo: topicOut
|
|
86
|
+
}
|
|
84
87
|
]
|
|
85
88
|
for (let defaultDsqQueueData of defaultDsqQueueDataList) {
|
|
86
89
|
resultsForCreateDefaultSnsInSqs.push({
|
|
@@ -89,7 +92,10 @@ function createDataForDefaultSnsInSqs(_izContext, flowSchema, srcPath) {
|
|
|
89
92
|
setting: setting
|
|
90
93
|
})
|
|
91
94
|
}
|
|
92
|
-
console.log(
|
|
95
|
+
// console.log({
|
|
96
|
+
// resultsForCreateDefaultSnsInSqs: JSON.stringify(resultsForCreateDefaultSnsInSqs, null, 2
|
|
97
|
+
// )
|
|
98
|
+
// })
|
|
93
99
|
return resultsForCreateDefaultSnsInSqs;
|
|
94
100
|
}
|
|
95
101
|
|
|
@@ -49,9 +49,12 @@ function createDataForSnsOut(_izContext, flowSchema, srcPath) {
|
|
|
49
49
|
|
|
50
50
|
// GCTpBasTestInPersonCreate => GCTpBas_Test_PersonCreate_In
|
|
51
51
|
let flowSteps = Object.keys(flowSchema.flowSteps)
|
|
52
|
+
let flowStepsOut = flowSteps[0];
|
|
53
|
+
let splitFlowStepsIn = flowStepsOut.split("_");
|
|
54
|
+
let topicOut = splitFlowStepsIn[3]
|
|
52
55
|
const generatedSnsTopicOutForFlowSchema = [
|
|
53
56
|
{
|
|
54
|
-
queueName: upperCase(
|
|
57
|
+
queueName: upperCase(topicOut)
|
|
55
58
|
}
|
|
56
59
|
];
|
|
57
60
|
|
|
@@ -70,7 +70,7 @@ const createConfirmAfterUploadS3Handler = require('./components/upload/confirmRe
|
|
|
70
70
|
const createConfirmAfterUploadS3MainFunction = require('./components/upload/confirmReserved/mainFunction/data');
|
|
71
71
|
const createConfirmAfterUploadS3Queue = require('./components/upload/confirmReserved/queue/data');
|
|
72
72
|
|
|
73
|
-
//
|
|
73
|
+
// flowSchema ExternalTopic components //
|
|
74
74
|
const createExternalWebsocketFunctionYaml = require('./externalTopic/websocket/functionYaml/data');
|
|
75
75
|
const createExternalWebsocketHandler = require('./externalTopic/websocket/handler/data');
|
|
76
76
|
const createExternalWebsocketMainFunction = require('./externalTopic/websocket/mainFunction/data');
|
|
@@ -102,13 +102,27 @@ const createFlowSchemaOwnTopicEndpointCompleteMainFunction = require('./flowSche
|
|
|
102
102
|
|
|
103
103
|
const createFlowSchemaOwnTopicQueue = require('./flowSchemaOwnTopic/sns-in/data');
|
|
104
104
|
const createFlowSchemaOwnTopicSnsOut = require('./flowSchemaOwnTopic/sns-out/data');
|
|
105
|
-
//
|
|
105
|
+
// flowSchema EventBridge components //
|
|
106
106
|
const createFlowSchemaEventBridgeFunctionYaml = require('./eventBridge/functionYaml/data');
|
|
107
107
|
const createFlowSchemaEventBridgeHandler = require('./eventBridge/handler/inv/data');
|
|
108
108
|
const createFlowSchemaEventBridgeMainFunction = require('./eventBridge/mainFunction/data');
|
|
109
109
|
|
|
110
|
-
const
|
|
111
|
-
|
|
110
|
+
const createAwaitingMultipleStepDynamoDbData = require('./dynamoDb/data');
|
|
111
|
+
// create record status Field Complete
|
|
112
|
+
const createCreateObjectCompleteFuntionYaml = require('./CreateRecordComplete/functionYaml/data');
|
|
113
|
+
const createCreateObjectCompleteHandler = require('./CreateRecordComplete/handler/data');
|
|
114
|
+
const createCreateObjectCompleteMainFunction = require('./CreateRecordComplete/mainFunction/data');
|
|
115
|
+
const createCreateObjectCompleteQueue = require('./CreateRecordComplete/queue/data');// flowSchema Register component //
|
|
116
|
+
|
|
117
|
+
const createFlowSchemaRegisterHandlerComplete = require('./createRecordByStatusType/complete/handler/data');
|
|
118
|
+
const createFlowSchemaRegisterMainCompleteFunc = require('./createRecordByStatusType/complete/mainFunction/data');
|
|
119
|
+
const createFlowSchemaRegisterHandlerWbsFunc = require('./createRecordByStatusType/wbs/handler/data');
|
|
120
|
+
const createFlowSchemaRegisterMainWbsFunc = require('./createRecordByStatusType/wbs/mainFunction/data');
|
|
121
|
+
const createFlowSchemaRegisterMainCompleteFuncYaml = require('./createRecordByStatusType/complete/functionYaml/data');
|
|
122
|
+
const createFlowSchemaRegisterMainWbsFuncYaml = require('./createRecordByStatusType/wbs/functionYaml/data');
|
|
123
|
+
const createFlowSchemaRegisterSubscribeOutAll = require('./createRecordByStatusType/subscriptionOutAll/data');
|
|
124
|
+
const createFlowSchemaRegisterSnsInSqs = require('./createRecordByStatusType/sns-in/data');
|
|
125
|
+
const createFlowSchemaRegisterDynamoDb = require('./createRecordByStatusType/dynamoDB/register');
|
|
112
126
|
|
|
113
127
|
/**
|
|
114
128
|
* Generates code with templates for different actions
|
|
@@ -117,11 +131,13 @@ const createFlowSchemaDynamoDb = require('./dynamoDb/data')
|
|
|
117
131
|
* @returns {Array} Array of generated code parameters
|
|
118
132
|
*/
|
|
119
133
|
async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
120
|
-
console.log("objSchemaPath", objSchemaPath);
|
|
134
|
+
console.log("objSchemaPath in flowSchema generateTemplateAndData", objSchemaPath);
|
|
121
135
|
try {
|
|
122
136
|
const saveFilePath = join(objSchemaPath, '../');
|
|
137
|
+
console.log("saveFilePath in flowSchema generateTemplateAndData", saveFilePath)
|
|
123
138
|
let createSourceParams = [];
|
|
124
139
|
const allLocalFlowSchemas = await getAllLocalFlowSchemas(_izContext, objSchemaPath);
|
|
140
|
+
const allLocalObjectSchemas = await getAllLocalObjectSchemasWithHierarchy(_izContext, objSchemaPath);
|
|
125
141
|
|
|
126
142
|
// default webSocket setting
|
|
127
143
|
const webSocketTaskTable = createWebSocketDynamoDb(_izContext, saveFilePath);
|
|
@@ -130,16 +146,22 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
130
146
|
|
|
131
147
|
const webSocketResource = [...webSocketTaskTable, ...webSocketConnectYaml, ...webSocketConnectHandler]
|
|
132
148
|
if (allLocalFlowSchemas.records.length) {
|
|
133
|
-
const webSocketGenerateCodeLibs = createWebSocketGenerateCodeLibs(_izContext, saveFilePath)
|
|
134
149
|
createSourceParams.push(
|
|
135
150
|
...webSocketResource,
|
|
136
|
-
...webSocketGenerateCodeLibs
|
|
137
|
-
|
|
138
151
|
)
|
|
139
152
|
}
|
|
140
153
|
|
|
154
|
+
// get flowsteps out form all local object schemas
|
|
155
|
+
|
|
156
|
+
|
|
141
157
|
for (const flowSchema of allLocalFlowSchemas.records) {
|
|
142
158
|
console.log("flowSchema in Generate TemplateData", flowSchema);
|
|
159
|
+
const webSocketGenerateCodeLibs = createWebSocketGenerateCodeLibs(_izContext, flowSchema, saveFilePath)
|
|
160
|
+
createSourceParams.push(...webSocketGenerateCodeLibs)
|
|
161
|
+
|
|
162
|
+
if (flowSchema.statusType === "none" || flowSchema.handlerObj === "multi") {
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
143
165
|
for (const event of flowSchema.event) {
|
|
144
166
|
if (event.includes("s3")) {
|
|
145
167
|
const reservedDataTable = createReservedDataMainTable(_izContext, saveFilePath);
|
|
@@ -256,7 +278,6 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
256
278
|
...externalTopicSnsOut
|
|
257
279
|
];
|
|
258
280
|
|
|
259
|
-
console.log("event externalTopic generated")
|
|
260
281
|
createSourceParams.push(...externalTopic)
|
|
261
282
|
|
|
262
283
|
} else if (event.includes("ownTopic")) {
|
|
@@ -264,7 +285,7 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
264
285
|
// flowSchema OwnTopic components
|
|
265
286
|
const flowSchemaOwnTopicFunctionYaml = createFlowSchemaOwnTopicFunctionYaml(_izContext, flowSchema, saveFilePath);
|
|
266
287
|
const flowSchemaOwnTopicHandler = createFlowSchemaOwnTopicHandler(_izContext, flowSchema, saveFilePath);
|
|
267
|
-
const flowSchemaOwnTopicMainFunction = createFlowSchemaOwnTopicMainFunction(_izContext, flowSchema, saveFilePath);
|
|
288
|
+
const flowSchemaOwnTopicMainFunction = await createFlowSchemaOwnTopicMainFunction(_izContext, flowSchema, saveFilePath);
|
|
268
289
|
const flowSchemaOwnTopicComponent = [...flowSchemaOwnTopicFunctionYaml, ...flowSchemaOwnTopicHandler, ...flowSchemaOwnTopicMainFunction]
|
|
269
290
|
// flowSchema OwnTopic Complete component
|
|
270
291
|
const flowSchemaOwnTopicCompleteFunctionYaml = createFlowSchemaOwnTopicCompleteFunctionYaml(_izContext, flowSchema, saveFilePath);
|
|
@@ -272,22 +293,23 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
272
293
|
const flowSchemaOwnTopicCompleteMainFunction = createFlowSchemaOwnTopicCompleteMainFunction(_izContext, flowSchema, saveFilePath);
|
|
273
294
|
const flowSchemaOwnTopicCompleteComponent = [...flowSchemaOwnTopicCompleteFunctionYaml, ...flowSchemaOwnTopicCompleteHandler, ...flowSchemaOwnTopicCompleteMainFunction]
|
|
274
295
|
// flowSchemaOwnTopic Endpoint
|
|
275
|
-
const flowSchemaOwnTopicEndpointFuntionYaml = createFlowSchemaOwnTopicEndpointFuntionYaml(_izContext, flowSchema, saveFilePath);
|
|
296
|
+
const flowSchemaOwnTopicEndpointFuntionYaml = await createFlowSchemaOwnTopicEndpointFuntionYaml(_izContext, flowSchema, saveFilePath);
|
|
276
297
|
const flowSchemaOwnTopicEndpointHandler = createFlowSchemaOwnTopicEndpointHandler(_izContext, flowSchema, saveFilePath);
|
|
277
|
-
const flowSchemaOwnTopicEndpointMainFunction = createFlowSchemaOwnTopicEndpointMainFunction(_izContext, flowSchema, saveFilePath);
|
|
298
|
+
const flowSchemaOwnTopicEndpointMainFunction = await createFlowSchemaOwnTopicEndpointMainFunction(_izContext, flowSchema, saveFilePath);
|
|
278
299
|
const flowSchemaOwnTopicEndpointComponent = [...flowSchemaOwnTopicEndpointFuntionYaml, ...flowSchemaOwnTopicEndpointHandler, ...flowSchemaOwnTopicEndpointMainFunction]
|
|
279
300
|
|
|
280
301
|
// flowSchemaOwnTopic EndpointComplete
|
|
281
|
-
const flowSchemaOwnTopicEndpointCompleteFuntionYaml = createFlowSchemaOwnTopicEndpointCompleteFuntionYaml(_izContext, flowSchema, saveFilePath);
|
|
282
|
-
const flowSchemaOwnTopicEndpointCompleteHandler = createFlowSchemaOwnTopicEndpointCompleteHandler(_izContext, flowSchema, saveFilePath);
|
|
283
|
-
const flowSchemaOwnTopicEndpointCompleteMainFunction = createFlowSchemaOwnTopicEndpointCompleteMainFunction(_izContext, flowSchema, saveFilePath);
|
|
284
|
-
const flowSchemaOwnTopicEndpointCompleteComponent = [...flowSchemaOwnTopicEndpointCompleteFuntionYaml, ...flowSchemaOwnTopicEndpointCompleteHandler, ...flowSchemaOwnTopicEndpointCompleteMainFunction];
|
|
302
|
+
// const flowSchemaOwnTopicEndpointCompleteFuntionYaml = createFlowSchemaOwnTopicEndpointCompleteFuntionYaml(_izContext, flowSchema, saveFilePath);
|
|
303
|
+
// const flowSchemaOwnTopicEndpointCompleteHandler = createFlowSchemaOwnTopicEndpointCompleteHandler(_izContext, flowSchema, saveFilePath);
|
|
304
|
+
// const flowSchemaOwnTopicEndpointCompleteMainFunction = createFlowSchemaOwnTopicEndpointCompleteMainFunction(_izContext, flowSchema, saveFilePath);
|
|
305
|
+
// const flowSchemaOwnTopicEndpointCompleteComponent = [...flowSchemaOwnTopicEndpointCompleteFuntionYaml, ...flowSchemaOwnTopicEndpointCompleteHandler, ...flowSchemaOwnTopicEndpointCompleteMainFunction];
|
|
285
306
|
|
|
286
307
|
const flowSchemaOwnTopicQueue = createFlowSchemaOwnTopicQueue(_izContext, flowSchema, saveFilePath);
|
|
287
308
|
const flowSchemaOwnTopicSnsOut = createFlowSchemaOwnTopicSnsOut(_izContext, flowSchema, saveFilePath);
|
|
288
309
|
// Group the resources
|
|
289
310
|
const ownTopicResources = [
|
|
290
|
-
...flowSchemaOwnTopicComponent, ...flowSchemaOwnTopicCompleteComponent, ...flowSchemaOwnTopicEndpointComponent, ...flowSchemaOwnTopicQueue, ...flowSchemaOwnTopicSnsOut,
|
|
311
|
+
...flowSchemaOwnTopicComponent, ...flowSchemaOwnTopicCompleteComponent, ...flowSchemaOwnTopicEndpointComponent, ...flowSchemaOwnTopicQueue, ...flowSchemaOwnTopicSnsOut,
|
|
312
|
+
// ...flowSchemaOwnTopicEndpointCompleteComponent
|
|
291
313
|
];
|
|
292
314
|
|
|
293
315
|
console.log("event ownTopic generated")
|
|
@@ -309,13 +331,60 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
309
331
|
console.log("event eventBridge generated")
|
|
310
332
|
createSourceParams.push(...eventBridgeResources);
|
|
311
333
|
}
|
|
334
|
+
}
|
|
312
335
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
336
|
+
if (flowSchema.statusType === "storedCache") {
|
|
337
|
+
const flowSchemaDynamoDb = createAwaitingMultipleStepDynamoDbData(_izContext, flowSchema, allLocalObjectSchemas, saveFilePath)
|
|
338
|
+
console.log("generated code storedCache flowSchema")
|
|
339
|
+
createSourceParams.push(...flowSchemaDynamoDb);
|
|
340
|
+
} else if (flowSchema.statusType === "statusField") {
|
|
341
|
+
// wait
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
// if (flowSchema.statusType === "statusField") {
|
|
345
|
+
// const createRecordCompleteFunctionYaml = createCreateObjectCompleteFuntionYaml(_izContext, flowSchema, saveFilePath);
|
|
346
|
+
// const createRecordCompleteHandler = createCreateObjectCompleteHandler(_izContext, flowSchema, saveFilePath);
|
|
347
|
+
// const createRecordCompleteMainFunction = createCreateObjectCompleteMainFunction(_izContext, flowSchema, saveFilePath);
|
|
348
|
+
// const createRecordCompleteQueue = createCreateObjectCompleteQueue(_izContext, flowSchema, saveFilePath);
|
|
349
|
+
|
|
350
|
+
// const recordCompleteResources = [
|
|
351
|
+
// ...createRecordCompleteFunctionYaml,
|
|
352
|
+
// ...createRecordCompleteHandler,
|
|
353
|
+
// ...createRecordCompleteMainFunction,
|
|
354
|
+
// ...createRecordCompleteQueue
|
|
355
|
+
// ];
|
|
356
|
+
// console.log("generated Code createRecordComplete")
|
|
357
|
+
// createSourceParams.push(...recordCompleteResources);
|
|
358
|
+
// }
|
|
317
359
|
}
|
|
318
360
|
}
|
|
361
|
+
if (allLocalFlowSchemas.records.length) {
|
|
362
|
+
console.log("flowSchema Register");
|
|
363
|
+
const flowSchemaRegisterHandlerComplete = createFlowSchemaRegisterHandlerComplete(_izContext, saveFilePath);
|
|
364
|
+
const flowSchemaRegisterMainComplete = createFlowSchemaRegisterMainCompleteFunc(_izContext, saveFilePath);
|
|
365
|
+
const flowSchemaRegisterHandlerWbs = createFlowSchemaRegisterHandlerWbsFunc(_izContext, saveFilePath);
|
|
366
|
+
const flowSchemaRegisterMainWbs = createFlowSchemaRegisterMainWbsFunc(_izContext, saveFilePath);
|
|
367
|
+
const flowSchemaRegisterFunctionYamlComplete = createFlowSchemaRegisterMainCompleteFuncYaml(_izContext, saveFilePath);
|
|
368
|
+
const flowSchemaRegisterFunctionYamlWbs = createFlowSchemaRegisterMainWbsFuncYaml(_izContext, allLocalFlowSchemas, saveFilePath);
|
|
369
|
+
const flowSchemaRegisterSubscribeOutAll = createFlowSchemaRegisterSubscribeOutAll(_izContext, allLocalFlowSchemas, saveFilePath);
|
|
370
|
+
const flowSchemaRegisterSnsInSqs = createFlowSchemaRegisterSnsInSqs(_izContext, saveFilePath);
|
|
371
|
+
|
|
372
|
+
const flowSchemaRegisterDynamoDb = createFlowSchemaRegisterDynamoDb(_izContext, saveFilePath);
|
|
373
|
+
|
|
374
|
+
const flowSchemaRegisters = [
|
|
375
|
+
...flowSchemaRegisterHandlerComplete,
|
|
376
|
+
...flowSchemaRegisterMainComplete,
|
|
377
|
+
...flowSchemaRegisterHandlerWbs,
|
|
378
|
+
...flowSchemaRegisterMainWbs,
|
|
379
|
+
...flowSchemaRegisterFunctionYamlComplete,
|
|
380
|
+
...flowSchemaRegisterFunctionYamlWbs,
|
|
381
|
+
...flowSchemaRegisterSnsInSqs,
|
|
382
|
+
...flowSchemaRegisterSubscribeOutAll,
|
|
383
|
+
...flowSchemaRegisterDynamoDb
|
|
384
|
+
];
|
|
385
|
+
createSourceParams.push(...flowSchemaRegisters);
|
|
386
|
+
}
|
|
387
|
+
|
|
319
388
|
return createSourceParams;
|
|
320
389
|
} catch (error) {
|
|
321
390
|
_izContext.logger.error('Error generating code with template flowSchema:', error);
|
|
@@ -126,6 +126,14 @@ const createSharedResource = (_izContext, createSourceParams, srcPath) => {
|
|
|
126
126
|
handlerType: [],
|
|
127
127
|
resources: {}
|
|
128
128
|
},
|
|
129
|
+
[SOURCE_GENERATE_IAM_ROLE.CreateRecordComplete]: {
|
|
130
|
+
handlerType: [],
|
|
131
|
+
resources: {}
|
|
132
|
+
},
|
|
133
|
+
[SOURCE_GENERATE_IAM_ROLE.RegisterRole]: {
|
|
134
|
+
handlerType: [],
|
|
135
|
+
resources: {}
|
|
136
|
+
},
|
|
129
137
|
Other: []
|
|
130
138
|
};
|
|
131
139
|
const objectTypeList = [];
|
|
@@ -231,12 +239,24 @@ const createSharedResource = (_izContext, createSourceParams, srcPath) => {
|
|
|
231
239
|
templateData.additionalResourcePermission,
|
|
232
240
|
groupedByObjectType["WebsocketConnect"].resources
|
|
233
241
|
)
|
|
234
|
-
} else if (templateData
|
|
242
|
+
} else if (templateData?.roleName?.includes(SOURCE_GENERATE_IAM_ROLE.EventBridge)) {
|
|
235
243
|
groupedByObjectType[SOURCE_GENERATE_IAM_ROLE.EventBridge].handlerType.push(templateData);
|
|
236
244
|
processResourcePermissions(
|
|
237
245
|
templateData.additionalResourcePermission,
|
|
238
246
|
groupedByObjectType[SOURCE_GENERATE_IAM_ROLE.EventBridge].resources
|
|
239
247
|
)
|
|
248
|
+
} else if (templateData?.roleName?.includes(SOURCE_GENERATE_IAM_ROLE.CreateRecordComplete)) {
|
|
249
|
+
groupedByObjectType[SOURCE_GENERATE_IAM_ROLE.CreateRecordComplete].handlerType.push(templateData);
|
|
250
|
+
processResourcePermissions(
|
|
251
|
+
templateData.additionalResourcePermission,
|
|
252
|
+
groupedByObjectType[SOURCE_GENERATE_IAM_ROLE.CreateRecordComplete].resources
|
|
253
|
+
)
|
|
254
|
+
} else if (templateData?.roleName?.includes(SOURCE_GENERATE_IAM_ROLE.RegisterRole)) {
|
|
255
|
+
groupedByObjectType[SOURCE_GENERATE_IAM_ROLE.RegisterRole].handlerType.push(templateData);
|
|
256
|
+
processResourcePermissions(
|
|
257
|
+
templateData.additionalResourcePermission,
|
|
258
|
+
groupedByObjectType[SOURCE_GENERATE_IAM_ROLE.RegisterRole].resources
|
|
259
|
+
)
|
|
240
260
|
}
|
|
241
261
|
else {
|
|
242
262
|
// Handle other items
|
|
@@ -244,6 +264,7 @@ const createSharedResource = (_izContext, createSourceParams, srcPath) => {
|
|
|
244
264
|
}
|
|
245
265
|
return item;
|
|
246
266
|
});
|
|
267
|
+
|
|
247
268
|
// Process "Other" items that might belong to existing object types
|
|
248
269
|
groupedByObjectType.Other = groupedByObjectType.Other.filter(item => {
|
|
249
270
|
const templateData = item.templateData;
|