@izara_project/izara-market-library-service-schemas 1.0.35 → 1.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +8 -7
- package/src/GenerateCodeLibs/src/Consts.js +2 -2
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +3 -2
- package/src/MainLibs/src/Consts.js +8 -8
- package/src/MainLibs/src/GenerateCodeUtils.js +3 -1
- 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/TemplateManager/src/flowSchema/DefaultWebSocketResource/webSocketConnect/handler/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/InProcessFlowSchema/handler/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createObject/handler/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createObject/mainFunction/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/getsignUrlsAcc/mainFunction/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/reservedLimitComplete/mainFunction/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/mainFunction/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/UploadS3Case/relate/libs/template.ejs +1 -1
- package/src/reStructure/SchemaConfig.js +1 -4
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/backupTemplate.ejs +701 -0
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +35 -163
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +3 -1
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +3 -4
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +3 -1
- package/src/reStructure/TemplateData/externalService/lambdaRole/data.js +45 -19
- package/src/reStructure/TemplateData/externalService/lambdaRole/template.ejs +5 -2
- package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/data.js +24 -14
- package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/template.ejs +4 -1
- package/src/reStructure/TemplateData/findData/GetByStorage/getByGraph.ejs +4 -3
- package/src/reStructure/TemplateData/findData/handler/template.ejs +2 -1
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/mainFunction/data.js +4 -10
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/mainFunction/template.ejs +69 -34
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/data.js +3 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/template.ejs +3 -12
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/mainFunction/template.ejs +18 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/template.ejs +10 -7
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/sqs/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/mainFunction/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/libs/data.js +12 -4
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/libs/template.ejs +14 -9
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/functionYaml/data.js +16 -40
- 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/data.js +3 -3
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/mainFunction/template.ejs +78 -27
- 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 +9 -32
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/subscriptionOutAll/data.js +30 -20
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/subscriptionOutAll/template.ejs +6 -6
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/functionYaml/data.js +32 -32
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/functionYaml/template.ejs +5 -5
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/handler/template.ejs +8 -9
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/mainFunction/template.ejs +116 -26
- 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 +6 -4
- 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 +43 -39
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/data.js +5 -7
- 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 +46 -48
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/data.js +5 -4
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/template.ejs +3 -11
- 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 +60 -10
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/data.js +7 -3
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/data.js +22 -7
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/template.ejs +27 -34
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/functionYaml/data.js +21 -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 +10 -6
- 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 +4 -4
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/data.js +8 -3
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/template.ejs +21 -14
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-in/data.js +23 -8
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-out/data.js +11 -6
- package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +50 -45
- package/src/reStructure/TemplateData/generateRole/createSharedResource.js +3 -2
- package/src/reStructure/TemplateData/generateRole/sharedResourceTemplate.ejs +2 -28
- package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/createObjectComplete_main.js +1 -1
- package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/template.ejs +10 -9
- package/src/reStructure/TemplateData/perActionComplete/delete/mainFunction/template.ejs +6 -2
- package/src/reStructure/TemplateData/perActionComplete/get/mainFunction/template.ejs +3 -2
- package/src/reStructure/TemplateData/perActionComplete/update/mainFunction/template.ejs +3 -2
- package/src/reStructure/TemplateData/perActionEndpoint/libs/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/create/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/delete/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/update/template.ejs +1 -1
- package/src/reStructure/TemplateData/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 +3 -2
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/template.ejs +3 -2
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/mainFunction/template.ejs +3 -2
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/handler/sqs/template.ejs +5 -5
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/mainFunction/template.ejs +6 -5
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/mainFunction/template.ejs +3 -3
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/handler/sqs/template.ejs +4 -4
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/mainFunction/template.ejs +5 -4
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/mainFunction/template.ejs +3 -2
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/mainFunction/template.ejs +3 -2
- 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/testTemplate/data.js +0 -27
- package/src/reStructure/TemplateData/testTemplate/template.ejs +0 -0
- /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
|
|
|
18
18
|
|
|
19
19
|
'use strict';
|
|
20
20
|
|
|
21
|
-
const hash = require(
|
|
21
|
+
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
22
22
|
const { getObjectSchema } = require('@izara_project/izara-core-library-service-schemas');
|
|
23
23
|
|
|
24
24
|
const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
|
|
@@ -33,8 +33,9 @@ const sns = externalRequest.sns
|
|
|
33
33
|
const utils = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Utils')
|
|
34
34
|
const NoRetryError = require('@izara_project/izara-core-library-core').NoRetryError
|
|
35
35
|
const { v4: uuidv4 } = require('uuid')
|
|
36
|
-
const
|
|
36
|
+
const consts = require('@izara_project/izara-middleware/src/MiddlewareCore/Consts')
|
|
37
37
|
const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
38
|
+
const generatedCodeLibs = require('../../../libs/source/GenerateCodeLibs')
|
|
38
39
|
/**
|
|
39
40
|
*
|
|
40
41
|
*
|
|
@@ -50,7 +51,7 @@ const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-librar
|
|
|
50
51
|
* @returns {object} description of return value
|
|
51
52
|
*/
|
|
52
53
|
|
|
53
|
-
module.exports
|
|
54
|
+
module.exports.registerMain = async (
|
|
54
55
|
_izContext,
|
|
55
56
|
requestParams,
|
|
56
57
|
callingFlowConfig = {},
|
|
@@ -58,17 +59,11 @@ module.exports.<%- functionMain%> = async (
|
|
|
58
59
|
//(</additionalParams>)
|
|
59
60
|
) => {
|
|
60
61
|
try {
|
|
61
|
-
|
|
62
|
-
// "action":register
|
|
63
|
-
// flowTag:"xxx"
|
|
64
|
-
// identifierTask:"xxxx",
|
|
65
|
-
// ...something
|
|
66
|
-
//}
|
|
67
|
-
|
|
62
|
+
let connecttionId = _izContext.correlationIds.get(consts.CONNECTION_ID)
|
|
68
63
|
// receive flowTag and identifiers
|
|
69
64
|
let flowSchema = await getObjectSchema.getFlowSchemaS3WithCache(_izContext, {
|
|
70
65
|
flowTag: requestParams.flowTag,
|
|
71
|
-
serviceTag:
|
|
66
|
+
serviceTag: process.env.iz_serviceTag,
|
|
72
67
|
})
|
|
73
68
|
|
|
74
69
|
_izContext.logger.debug("flowSchema", flowSchema)
|
|
@@ -76,13 +71,80 @@ module.exports.<%- functionMain%> = async (
|
|
|
76
71
|
throw new NoRetryError(`flowTag not found ${requestParams.flowTag}`)
|
|
77
72
|
}
|
|
78
73
|
|
|
74
|
+
// get data from dynamoDB of objectType of flowSchema
|
|
75
|
+
const getStoredCache = async (objectType) => {
|
|
76
|
+
const objectSchema = await getObjectSchema.getObjSchemaS3WithCache(
|
|
77
|
+
_izContext,
|
|
78
|
+
{
|
|
79
|
+
objectType: objectType,
|
|
80
|
+
serviceTag: process.env.iz_serviceTag,
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
_izContext.logger.debug("==> objectSchema", objectSchema)
|
|
84
|
+
|
|
85
|
+
// this returns the table name of the first storage resource with storageType "dynamoDB"
|
|
86
|
+
const tableName = Object.values(objectSchema.storageResources).find(
|
|
87
|
+
(storageResource) => storageResource.storageType === "dynamoDB"
|
|
88
|
+
)?.tableName
|
|
89
|
+
_izContext.logger.debug("==> tableName", tableName)
|
|
90
|
+
|
|
91
|
+
// const identifierPK = objectSchema[identifierPK].find(
|
|
92
|
+
// (identifier) => identifier.type === "partitionKey"
|
|
93
|
+
// )?.fieldName
|
|
94
|
+
|
|
95
|
+
// const identifierSK = objectSchema[identifierSK].find(
|
|
96
|
+
// (identifier) => identifier.type === "sortKey"
|
|
97
|
+
// )?.fieldName
|
|
98
|
+
|
|
99
|
+
let identifierPK = null
|
|
100
|
+
let identifierSK = null
|
|
101
|
+
objectSchema.identifiers.map((identifier) => {
|
|
102
|
+
if (identifier.type === "partitionKey") {
|
|
103
|
+
identifierPK = identifier.fieldName
|
|
104
|
+
} else if (identifier.type === "sortKey") {
|
|
105
|
+
identifierSK = identifier.fieldName
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
_izContext.logger.debug("==> identifierPK", identifierPK)
|
|
110
|
+
_izContext.logger.debug("==> identifierSK", identifierSK)
|
|
111
|
+
|
|
112
|
+
const payloadGetStoredCache = {
|
|
113
|
+
[identifierPK]: requestParams.identifiers[identifierPK],
|
|
114
|
+
}
|
|
115
|
+
if (identifierSK) {
|
|
116
|
+
payloadGetStoredCache[identifierSK] = requestParams.identifiers[identifierSK]
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
_izContext.logger.debug("==> payloadGetStoredCache", payloadGetStoredCache)
|
|
120
|
+
|
|
121
|
+
// const getStoredCache = await dynamodbSharedLib.getItem(
|
|
122
|
+
// _izContext,
|
|
123
|
+
// await dynamodbSharedLib.tableName(_izContext, tableName),
|
|
124
|
+
// payloadGetStoredCache
|
|
125
|
+
// )
|
|
126
|
+
|
|
127
|
+
const getStoredCache = await dynamodbSharedLib.query(
|
|
128
|
+
_izContext,
|
|
129
|
+
await dynamodbSharedLib.tableName(_izContext, tableName),
|
|
130
|
+
payloadGetStoredCache
|
|
131
|
+
)
|
|
132
|
+
_izContext.logger.debug("==> getStoredCache:::", getStoredCache)
|
|
133
|
+
return ({
|
|
134
|
+
data: getStoredCache.Items[0],
|
|
135
|
+
identifierPK: identifierPK,
|
|
136
|
+
})
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Initialize storedCacheData variable that will be used in multiple switch cases
|
|
140
|
+
let storedCacheData = null;
|
|
79
141
|
switch (flowSchema.statusType) {
|
|
80
142
|
case "statusField":
|
|
81
|
-
|
|
143
|
+
const payload = {
|
|
82
144
|
identifiers: requestParams.identifiers,
|
|
83
145
|
objectType: flowSchema.objType.objectType
|
|
84
146
|
}
|
|
85
|
-
|
|
147
|
+
const result = await externalRequest.lambda.invokeSync(
|
|
86
148
|
_izContext,
|
|
87
149
|
await lambdaSharedLib.lambdaFunctionName(_izContext, "GetHdrInv", flowSchema.objType.serviceTag),
|
|
88
150
|
payload
|
|
@@ -90,24 +152,52 @@ module.exports.<%- functionMain%> = async (
|
|
|
90
152
|
if (!result) {
|
|
91
153
|
throw new NoRetryError(`statusField not found ${requestParams.identifiers}`)
|
|
92
154
|
}
|
|
155
|
+
await generatedCodeLibs.postToConnection({ message: result }, connecttionId)
|
|
93
156
|
return result
|
|
94
|
-
|
|
157
|
+
|
|
158
|
+
break;
|
|
159
|
+
case "storedCache":
|
|
95
160
|
// if statusType=storedCache then query storedCache > post message to client -> remove connectionId if status = error || complete
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
161
|
+
|
|
162
|
+
storedCacheData = await getStoredCache(flowSchema.objType.objectType)
|
|
163
|
+
_izContext.logger.debug("==> storedCacheData", storedCacheData)
|
|
164
|
+
|
|
165
|
+
if (!storedCacheData) {
|
|
166
|
+
throw new NoRetryError(`storedCache not found ${requestParams.identifiers} ${requestParams.sortKey}`)
|
|
167
|
+
}
|
|
168
|
+
let payloadPostMessage = {
|
|
169
|
+
identifierTask: requestParams.identifiers[storedCacheData.identifierPK],
|
|
170
|
+
connectionId: _izContext.correlationIds.get(consts.CONNECTION_ID),
|
|
171
|
+
flowType: {
|
|
172
|
+
flowTag: flowSchema.flowTag,
|
|
173
|
+
serviceTag: process.env.iz_serviceTag,
|
|
102
174
|
}
|
|
103
|
-
)
|
|
104
|
-
if (!getStoredCache) {
|
|
105
|
-
throw new NoRetryError(`storedCache not found ${requestParams.identifiers}`)
|
|
106
175
|
}
|
|
107
|
-
|
|
176
|
+
|
|
177
|
+
_izContext.logger.debug('==> payloadPostMessage', payloadPostMessage)
|
|
178
|
+
if (storedCacheData.data.cacheStatus !== "error" && storedCacheData.data.cacheStatus != "complete") {
|
|
179
|
+
await dynamodbSharedLib.putItem(
|
|
180
|
+
_izContext,
|
|
181
|
+
await dynamodbSharedLib.tableName(_izContext, "RegisterRecords"),
|
|
182
|
+
payloadPostMessage
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
return payloadPostMessage;
|
|
186
|
+
} else {
|
|
187
|
+
await dynamodbSharedLib.deleteItem(
|
|
188
|
+
_izContext,
|
|
189
|
+
await dynamodbSharedLib.tableName(_izContext, "RegisterRecords"),
|
|
190
|
+
{
|
|
191
|
+
identifierTask: requestParams.identifiers[storedCacheData.identifierPK],
|
|
192
|
+
connectionId: _izContext.correlationIds.get(consts.CONNECTION_ID)
|
|
193
|
+
}
|
|
194
|
+
)
|
|
195
|
+
}
|
|
196
|
+
await generatedCodeLibs.postToConnection({ message: result }, connecttionId)
|
|
197
|
+
return storedCacheData;
|
|
198
|
+
|
|
108
199
|
case "none":
|
|
109
|
-
|
|
110
|
-
break
|
|
200
|
+
break;
|
|
111
201
|
default:
|
|
112
202
|
throw new NoRetryError(`statusType not found ${flowSchema.statusType}`)
|
|
113
203
|
}
|
|
@@ -19,18 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
19
19
|
|
|
20
20
|
const path = require("path")
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
// const {
|
|
24
|
-
// HANDLER,
|
|
25
|
-
// STORAGE_TYPES
|
|
26
|
-
// } = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
27
|
-
|
|
28
|
-
const STORAGE_TYPES = {
|
|
29
|
-
dynamoDB: "dynamoDB",
|
|
30
|
-
graph: "graph"
|
|
31
|
-
}
|
|
32
22
|
const templatePath = path.join(__dirname, '../../resourceYaml/dynamodb/template.ejs')
|
|
33
|
-
const { SOURCE_PATH, SAVE_FILE_NAME } = require('../../../../MainLibs/src/Consts.js')
|
|
23
|
+
const { SOURCE_PATH, SAVE_FILE_NAME, defaultIamRolePerAction, createIamRole, DYNAMO_RESOURCE, resourceNames, RESOURCE_CLASSES, FUNCTION_NAME, SOURCE_GENERATE_IAM_ROLE } = require('../../../../MainLibs/src/Consts.js')
|
|
34
24
|
|
|
35
25
|
/**
|
|
36
26
|
* create param of crateSouce for FindData And processLogical
|
|
@@ -39,43 +29,92 @@ const { SOURCE_PATH, SAVE_FILE_NAME } = require('../../../../MainLibs/src/Consts
|
|
|
39
29
|
* @param {String} srcPath
|
|
40
30
|
* @returns {Object[]}
|
|
41
31
|
*/
|
|
42
|
-
const createAwaitingMultipleStepDynamoDbData = (_izContext, flowSchema, srcPath) => {
|
|
32
|
+
const createAwaitingMultipleStepDynamoDbData = (_izContext, flowSchema, allLocalObjectSchemas, srcPath) => {
|
|
33
|
+
if (!flowSchema.event.includes("ownTopic")) {
|
|
34
|
+
return [];
|
|
35
|
+
}
|
|
43
36
|
|
|
44
|
-
|
|
45
|
-
|
|
37
|
+
const objectSchema = allLocalObjectSchemas.records.find(schema =>
|
|
38
|
+
schema.objectType === flowSchema.objType.objectType);
|
|
46
39
|
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
40
|
+
if (!objectSchema) {
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (!objectSchema.storageResources) {
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// ex.
|
|
49
|
+
// storageResources: {
|
|
50
|
+
// cacheTable: {
|
|
51
|
+
// storageType: "dynamoDB",
|
|
52
|
+
// tableName: "TranslateIdsCacheMain"
|
|
53
|
+
// }
|
|
54
|
+
// }
|
|
55
|
+
|
|
56
|
+
// Check if there's exactly one DynamoDB storage resource
|
|
57
|
+
const dynamoDbEntries = Object.entries(objectSchema.storageResources)
|
|
58
|
+
.filter(([_, value]) => value.storageType === "dynamoDB");
|
|
59
|
+
|
|
60
|
+
console.debug(`DynamoDB entries: ${JSON.stringify(dynamoDbEntries)}`);
|
|
61
|
+
|
|
62
|
+
if (dynamoDbEntries.length !== 1) {
|
|
63
|
+
console.warn(`Object schema ${objectSchema.objectType} for ${flowSchema.flowTag} needs to have exactly one DynamoDB storage resource.`);
|
|
64
|
+
return []; // Either no DynamoDB storage or more than one found
|
|
61
65
|
}
|
|
62
66
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
setting: {
|
|
68
|
-
initialData: 'Resources:\n',
|
|
69
|
-
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
70
|
-
saveFileName: SAVE_FILE_NAME.dynamoDbYaml,
|
|
71
|
-
fileExtension: '.yml',
|
|
72
|
-
isAppend: true
|
|
73
|
-
}
|
|
74
|
-
});
|
|
67
|
+
const storageResourceEntry = dynamoDbEntries[0];
|
|
68
|
+
|
|
69
|
+
if (!storageResourceEntry) {
|
|
70
|
+
return [];
|
|
75
71
|
}
|
|
76
|
-
// console.log("resultsForCreateSource default dynamo", resultsForCreateSource)
|
|
77
72
|
|
|
78
|
-
|
|
79
|
-
|
|
73
|
+
const [_, storageResource] = storageResourceEntry;
|
|
74
|
+
const tableName = storageResource.tableName;
|
|
75
|
+
|
|
76
|
+
const attributes = objectSchema.identifiers
|
|
77
|
+
.map(identifier => ({
|
|
78
|
+
keyType: identifier.type,
|
|
79
|
+
AttributeName: identifier.fieldName,
|
|
80
|
+
AttributeType: "S"
|
|
81
|
+
}));
|
|
82
|
+
|
|
83
|
+
let additionalResourcePermission = defaultIamRolePerAction();
|
|
84
|
+
additionalResourcePermission.push(
|
|
85
|
+
createIamRole(
|
|
86
|
+
{
|
|
87
|
+
[RESOURCE_CLASSES.dynamoDbTable]: [
|
|
88
|
+
DYNAMO_RESOURCE.putItem,
|
|
89
|
+
DYNAMO_RESOURCE.getItem,
|
|
90
|
+
DYNAMO_RESOURCE.query,
|
|
91
|
+
DYNAMO_RESOURCE.deleteItem,
|
|
92
|
+
DYNAMO_RESOURCE.updateItem
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
[
|
|
96
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, tableName)
|
|
97
|
+
]
|
|
98
|
+
)
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
return [{
|
|
102
|
+
templatePath,
|
|
103
|
+
templateData: {
|
|
104
|
+
tableName,
|
|
105
|
+
resourceName: tableName,
|
|
106
|
+
attributes,
|
|
107
|
+
additionalResourcePermission,
|
|
108
|
+
roleName: SOURCE_GENERATE_IAM_ROLE.RegisterRole,
|
|
109
|
+
},
|
|
110
|
+
setting: {
|
|
111
|
+
initialData: 'Resources:\n',
|
|
112
|
+
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
113
|
+
saveFileName: SAVE_FILE_NAME.dynamoDbYaml,
|
|
114
|
+
fileExtension: '.yml',
|
|
115
|
+
isAppend: true
|
|
116
|
+
}
|
|
117
|
+
}];
|
|
118
|
+
};
|
|
80
119
|
|
|
81
|
-
module.exports = createAwaitingMultipleStepDynamoDbData
|
|
120
|
+
module.exports = createAwaitingMultipleStepDynamoDbData;
|
|
@@ -32,6 +32,7 @@ const {
|
|
|
32
32
|
FUNCTION_NAME,
|
|
33
33
|
SAVE_FILE_NAME,
|
|
34
34
|
SOURCE_GENERATE_IAM_ROLE,
|
|
35
|
+
HANDLER,
|
|
35
36
|
} = require("../../../../../MainLibs/src/Consts");
|
|
36
37
|
|
|
37
38
|
/**
|
|
@@ -45,17 +46,15 @@ const {
|
|
|
45
46
|
*/
|
|
46
47
|
|
|
47
48
|
function data(_izContext, flowSchema, srcPath) {
|
|
48
|
-
const
|
|
49
|
+
const flowStepSplitKeyOut = Object.keys(flowSchema.flowSteps)[1].split("_");
|
|
49
50
|
// console.log({ flowStepSplitKey })
|
|
50
|
-
let queueName =
|
|
51
|
-
let queueNameSubscription = flowStepSplitKey[3];
|
|
52
|
-
|
|
51
|
+
let queueName = upperCase(flowSchema.flowTag) + "ExternalTopicOut" + upperCase(HANDLER.hdrSqs)
|
|
53
52
|
return [{
|
|
54
53
|
templatePath,
|
|
55
54
|
templateData: {
|
|
56
55
|
queueName: upperCase(queueName),
|
|
57
|
-
queueNameSubscription: upperCase(queueNameSubscription),
|
|
58
56
|
roleName: SOURCE_GENERATE_IAM_ROLE.ExternalTopicRole,
|
|
57
|
+
firstLetterUpperCase: upperCase
|
|
59
58
|
},
|
|
60
59
|
setting: {
|
|
61
60
|
initialData: "Resource\n",
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
##=====
|
|
2
|
-
SubscriptionOut<%- queueNameSubscription %>:
|
|
3
|
-
Type: AWS::SNS::Subscription
|
|
4
|
-
Properties:
|
|
5
|
-
TopicArn: !Ref Out<%- queueNameSubscription %>
|
|
6
|
-
Endpoint: "arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- queueNameSubscription %>Out"
|
|
7
|
-
Protocol: "sqs"
|
|
1
|
+
##===== ExternalTopic
|
|
8
2
|
##===== [Queue]
|
|
9
3
|
<%- queueName %>:
|
|
10
4
|
Type: "AWS::SQS::Queue"
|
|
@@ -33,7 +33,7 @@ const {
|
|
|
33
33
|
SOURCE_GENERATE_IAM_ROLE
|
|
34
34
|
} = require("../../../../../MainLibs/src/Consts");
|
|
35
35
|
|
|
36
|
-
const templatePath = path.join(__dirname, "
|
|
36
|
+
const templatePath = path.join(__dirname, "./template.ejs");
|
|
37
37
|
// /ResourceYaml/sns-out/template.ejs
|
|
38
38
|
// /OutPerActionComplete/OutUpdateComplete/sns-out/data.js
|
|
39
39
|
|
|
@@ -52,14 +52,16 @@ function data(_izContext, flowSchema, srcPath) {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
//TranslateIds_Test_TranslateIdsComplete_Out
|
|
56
|
+
let flowSteps = Object.keys(flowSchema.flowSteps)
|
|
57
|
+
let flowStepTopicOut = flowSteps[1];
|
|
58
|
+
let topicComponent = flowStepTopicOut.split("_");
|
|
59
|
+
const queueName = `${upperCase(topicComponent[2])}_${upperCase(topicComponent[3])}`
|
|
57
60
|
return [
|
|
58
61
|
{
|
|
59
62
|
templatePath: templatePath,
|
|
60
63
|
templateData: {
|
|
61
64
|
queueName: upperCase(queueName),
|
|
62
|
-
roleName: SOURCE_GENERATE_IAM_ROLE.ExternalTopicRole,
|
|
63
65
|
},
|
|
64
66
|
setting: {
|
|
65
67
|
initialData: 'Resources:\n',
|
|
@@ -3,8 +3,6 @@
|
|
|
3
3
|
Type: AWS::SNS::Topic
|
|
4
4
|
Properties:
|
|
5
5
|
DisplayName: "SNS Message out"
|
|
6
|
-
TopicName: ${self:custom.iz_serviceTag}_${self:custom.iz_stage}_<%- firstLetterUpperCase(queueName) %>
|
|
6
|
+
TopicName: ${self:custom.iz_serviceTag}_${self:custom.iz_stage}_<%- firstLetterUpperCase(queueName) %>
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
10
|
-
} _%>
|
|
8
|
+
<%_ function firstLetterUpperCase(text) { return text.charAt(0).toUpperCase() + text.slice(1) } _%>
|
|
@@ -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");
|
|
@@ -55,13 +56,40 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
|
55
56
|
let externalTopicName = FUNCTION_NAME.flowSchemaExternalTopic + 'Out';
|
|
56
57
|
let functionConfig = "ExtTopicOut" + upperCase(shortNameHandler(handlerType));
|
|
57
58
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
59
|
+
let flowStepInSplitKey = Object.keys(flowSchema.flowSteps)[0].split("_");
|
|
58
60
|
// const action = flowSchema.flowTag || 'defaultAction'; // Using flowTag as the action name
|
|
59
61
|
// const event = resourceNames(RESOURCE_CLASSES.sqs, upperCase(action) + upperCase(handler));
|
|
60
|
-
|
|
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
|
+
);
|
|
61
89
|
return {
|
|
62
90
|
templatePath: templatePath,
|
|
63
91
|
templateData: {
|
|
64
|
-
resourceLocation: path.join(SOURCE_PATH.
|
|
92
|
+
resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema, flowSchema.flowTag, "source/"),
|
|
65
93
|
functionName,
|
|
66
94
|
handlerType,
|
|
67
95
|
functionNameConfig: functionConfig,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<%_ const join = require('path').join _%>
|
|
2
2
|
<%- firstLetterUpperCase(functionNameConfig) %>:
|
|
3
|
-
handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}
|
|
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: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %>
|
|
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
|
} _%>
|
|
@@ -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
|
}
|