@izara_project/izara-market-library-service-schemas 1.0.37 → 1.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +35 -5
- package/src/MainLibs/src/Consts.js +5 -2
- package/src/MainLibs/src/GenerateCodeUtils.js +2 -0
- package/src/MainLibs/src/Utils.js +12 -0
- package/src/reStructure/GenerateCode.js +2 -2
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +36 -11
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +24 -1
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +26 -0
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +22 -0
- package/src/reStructure/TemplateData/EndpointPerService/yaml/data.js +37 -7
- package/src/reStructure/TemplateData/findData/handler/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/template.ejs +2 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/template.ejs +5 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/sns-sqs/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/sqs/data.js +3 -3
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/sqs/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/libs/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/externalTopic/functionYaml/data.js +127 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/handler/data.js +121 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/{sqs/handler → handler}/template.ejs +16 -61
- package/src/reStructure/TemplateData/flowSchema/externalTopic/mainFunction/data.js +74 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/mainFunction/template.ejs +131 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/data.js +61 -34
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/data.js +3 -7
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/data.js +2 -5
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/data.js +13 -4
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/template.ejs +15 -23
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/functionYaml/data.js +2 -4
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/data.js +2 -5
- package/src/reStructure/TemplateData/flowSchema/{externalTopic/sqs → flowSchemaOwnTopic/flowStep}/functionYaml/data.js +43 -38
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowStep/functionYaml/template.ejs +20 -0
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowStep/handler/data.js +80 -0
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowStep/handler/template.ejs +85 -0
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowStep/mainFunction/data.js +92 -0
- package/src/reStructure/TemplateData/flowSchema/{externalTopic/websocket → flowSchemaOwnTopic/flowStep}/mainFunction/template.ejs +11 -13
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-in/data.js +46 -37
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-out/data.js +14 -19
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/functionYaml/data.js +5 -21
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/webSocketComplete/functionYaml/template.ejs +20 -0
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/handler/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/mainFunction/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/mainFunction/template.ejs +24 -10
- package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +23 -25
- package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/register/complete/mainFunction/template.ejs +172 -0
- package/src/reStructure/TemplateData/flowSchema/register/wbs/mainFunction/template.ejs +165 -0
- package/src/reStructure/TemplateData/flowSchema/templateBystatusType/storedCacheTemplate.ejs +38 -0
- package/src/reStructure/TemplateData/flowSchema/templateBystatusType/triggerCacheTemplate.ejs +39 -0
- package/src/reStructure/TemplateData/perActionComplete/get/mainFunction/template.ejs +3 -0
- package/src/reStructure/TemplateData/perActionComplete/update/mainFunction/template.ejs +3 -0
- package/src/reStructure/TemplateData/propertyValueSchema/relationshipPropertyValueSchema/data.js +2 -7
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/api/data.js +22 -3
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/dsq/data.js +14 -9
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/inv/data.js +26 -6
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/sqs/data.js +11 -7
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/functionYaml/data.js +17 -7
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/api/data.js +23 -4
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/dsq/data.js +14 -9
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/inv/data.js +26 -6
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/sqs/data.js +10 -7
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/functionYaml/data.js +11 -7
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/api/data.js +23 -4
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/dsq/data.js +14 -9
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/inv/data.js +26 -7
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/sqs/data.js +10 -7
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/functionYaml/data.js +12 -7
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/api/data.js +22 -3
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/data.js +14 -6
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/inv/data.js +20 -3
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/sqs/data.js +9 -3
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/functionYaml/data.js +12 -6
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/mainResourcePerObjectSchemaData.js +6 -2
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/mainFunction/template.ejs +0 -184
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/storedCacheTemplate.ejs +0 -11
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/mainFunction/template.ejs +0 -210
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/data.js +0 -77
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/template.ejs +0 -8
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/functionYaml/template.ejs +0 -17
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/handler/data.js +0 -64
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/mainFunction/data.js +0 -61
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/mainFunction/template.ejs +0 -74
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/data.js +0 -110
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/template.ejs +0 -18
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/data.js +0 -57
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/template.ejs +0 -85
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/data.js +0 -67
- /package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/FlowSchemaCompleteComponent → externalTopic}/functionYaml/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/handler/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/functionYaml/data.js +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/functionYaml/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/handler/data.js +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/mainFunction/data.js +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/dynamoDB/register.js +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/sns-in/data.js +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/sns-in/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/subscriptionOutAll/data.js +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/subscriptionOutAll/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/functionYaml/data.js +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/functionYaml/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/handler/data.js +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/handler/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/mainFunction/data.js +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → templateBystatusType}/statusFieldTemplate.ejs +0 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2020 Sven Mason <http://izara.io>
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU Affero General Public License as
|
|
6
|
+
published by the Free Software Foundation, either version 3 of the
|
|
7
|
+
License, or (at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU Affero General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
'use strict';
|
|
19
|
+
const path = require('path');
|
|
20
|
+
|
|
21
|
+
const { FLOW_SCHEMA_HOOK_STATE, ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
22
|
+
const { firstLetterUpperCase: upperCase } = require('../../../../../MainLibs/src/Utils')
|
|
23
|
+
const {
|
|
24
|
+
SOURCE_PATH,
|
|
25
|
+
defaultIamRolePerAction,
|
|
26
|
+
createIamRole,
|
|
27
|
+
RESOURCE_CLASSES,
|
|
28
|
+
SNS_RESOURCE,
|
|
29
|
+
resourceNames,
|
|
30
|
+
DYNAMO_RESOURCE,
|
|
31
|
+
SAVE_FILE_NAME,
|
|
32
|
+
FUNCTION_NAME,
|
|
33
|
+
shortNameHandler,
|
|
34
|
+
externalResourceYaml,
|
|
35
|
+
SOURCE_GENERATE_IAM_ROLE,
|
|
36
|
+
SQS_RESOURCE,
|
|
37
|
+
LAMBDA_RESOURCE
|
|
38
|
+
} = require('../../../../../MainLibs/src/Consts');
|
|
39
|
+
const { NoRetryError } = require('@izara_project/izara-core-library-core');
|
|
40
|
+
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas').getObjectSchema;
|
|
41
|
+
|
|
42
|
+
const templatePath = path.join(__dirname, "template.ejs");
|
|
43
|
+
/**
|
|
44
|
+
* receive objectSchema
|
|
45
|
+
* create data for WebScoket handler template
|
|
46
|
+
*
|
|
47
|
+
* @param {Object} objectSchema
|
|
48
|
+
* @return {{templatePath, templateData,setting}}
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
async function data(_izContext, flowSchema, srcPath) {
|
|
52
|
+
return [await createSourceParams(_izContext, flowSchema, srcPath)]
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
56
|
+
let functionName = "Process" + upperCase(flowSchema.flowTag)
|
|
57
|
+
let handlerType = upperCase(HANDLER.hdrSqs)
|
|
58
|
+
let additionalResourcePermission = defaultIamRolePerAction();
|
|
59
|
+
let route = upperCase(flowSchema.flowTag);
|
|
60
|
+
let queueName = "Process" + upperCase(flowSchema.flowTag) + handlerType;
|
|
61
|
+
additionalResourcePermission.push(
|
|
62
|
+
createIamRole(
|
|
63
|
+
{
|
|
64
|
+
[RESOURCE_CLASSES.sqs]: Object.values(SQS_RESOURCE)
|
|
65
|
+
},
|
|
66
|
+
[
|
|
67
|
+
resourceNames(RESOURCE_CLASSES.sqs, queueName),
|
|
68
|
+
resourceNames(RESOURCE_CLASSES.sqs, queueName + "DLQ")
|
|
69
|
+
]
|
|
70
|
+
),
|
|
71
|
+
createIamRole(
|
|
72
|
+
{
|
|
73
|
+
[RESOURCE_CLASSES.lambda]: Object.values(LAMBDA_RESOURCE)
|
|
74
|
+
},
|
|
75
|
+
[
|
|
76
|
+
resourceNames(RESOURCE_CLASSES.lambda, 'CreateHdrInv')
|
|
77
|
+
]
|
|
78
|
+
),
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
if (flowSchema.statusType === "storedCache") {
|
|
82
|
+
let tableStroedCaches = [];
|
|
83
|
+
let objectSchema = await getObjectSchema.getLocalObjectSchemas(_izContext, [flowSchema.objType.objectType], path.join(srcPath, "./schemas")).then(res => res.records[0])
|
|
84
|
+
if (!objectSchema) {
|
|
85
|
+
throw new NoRetryError('ObjectSchema not found')
|
|
86
|
+
}
|
|
87
|
+
for (const storageResource of Object.values(objectSchema.storageResources)) {
|
|
88
|
+
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
89
|
+
if (!tableStroedCaches.includes(storageResource.tableName)) {
|
|
90
|
+
tableStroedCaches.push(storageResource.tableName)
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
additionalResourcePermission.push(
|
|
96
|
+
createIamRole(
|
|
97
|
+
{
|
|
98
|
+
[RESOURCE_CLASSES.dynamoDbTable]: Object.values(DYNAMO_RESOURCE)
|
|
99
|
+
},
|
|
100
|
+
tableStroedCaches.map(
|
|
101
|
+
tableName => resourceNames(RESOURCE_CLASSES.dynamoDbTable, tableName))
|
|
102
|
+
)
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
templatePath: templatePath,
|
|
108
|
+
templateData: {
|
|
109
|
+
resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema, flowSchema.flowTag, "source/"),
|
|
110
|
+
functionName,
|
|
111
|
+
handlerType,
|
|
112
|
+
additionalResourcePermission,
|
|
113
|
+
route,
|
|
114
|
+
functionNameConfig: upperCase(functionName) + upperCase(shortNameHandler(handlerType)),
|
|
115
|
+
roleName: SOURCE_GENERATE_IAM_ROLE.FlowSchemaOwnTopic,
|
|
116
|
+
queueName
|
|
117
|
+
},
|
|
118
|
+
setting: {
|
|
119
|
+
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
120
|
+
saveFileName: upperCase(SAVE_FILE_NAME.flowSchema),
|
|
121
|
+
fileExtension: ".yml",
|
|
122
|
+
isAppend: true
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
module.exports = data;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2020 Sven Mason <http://izara.io>
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU Affero General Public License as
|
|
6
|
+
published by the Free Software Foundation, either version 3 of the
|
|
7
|
+
License, or (at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU Affero General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
'use strict';
|
|
19
|
+
const path = require('path');
|
|
20
|
+
|
|
21
|
+
const { FLOW_SCHEMA_HOOK_STATE, ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
22
|
+
const { firstLetterUpperCase: upperCase } = require('../../../../../MainLibs/src/Utils')
|
|
23
|
+
const {
|
|
24
|
+
SOURCE_PATH,
|
|
25
|
+
defaultIamRolePerAction,
|
|
26
|
+
createIamRole,
|
|
27
|
+
RESOURCE_CLASSES,
|
|
28
|
+
SNS_RESOURCE,
|
|
29
|
+
resourceNames,
|
|
30
|
+
DYNAMO_RESOURCE,
|
|
31
|
+
SAVE_FILE_NAME,
|
|
32
|
+
FUNCTION_NAME,
|
|
33
|
+
shortNameHandler,
|
|
34
|
+
externalResourceYaml,
|
|
35
|
+
SOURCE_GENERATE_IAM_ROLE,
|
|
36
|
+
SQS_RESOURCE,
|
|
37
|
+
LAMBDA_RESOURCE
|
|
38
|
+
} = require('../../../../../MainLibs/src/Consts');
|
|
39
|
+
const { NoRetryError } = require('@izara_project/izara-core-library-core');
|
|
40
|
+
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas').getObjectSchema;
|
|
41
|
+
|
|
42
|
+
const templatePath = path.join(__dirname, "template.ejs");
|
|
43
|
+
/**
|
|
44
|
+
* receive objectSchema
|
|
45
|
+
* create data for WebScoket handler template
|
|
46
|
+
*
|
|
47
|
+
* @param {Object} objectSchema
|
|
48
|
+
* @return {{templatePath, templateData,setting}}
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
async function data(_izContext, flowSchema, srcPath) {
|
|
52
|
+
return [await createSourceParams(_izContext, flowSchema, srcPath)]
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
56
|
+
let functionName = "Process" + upperCase(flowSchema.flowTag)
|
|
57
|
+
let handlerType = upperCase(HANDLER.hdrSqs)
|
|
58
|
+
let additionalResourcePermission = defaultIamRolePerAction();
|
|
59
|
+
let queueName = "Process" + upperCase(flowSchema.flowTag) + handlerType;
|
|
60
|
+
additionalResourcePermission.push(
|
|
61
|
+
createIamRole(
|
|
62
|
+
{
|
|
63
|
+
[RESOURCE_CLASSES.sqs]: Object.values(SQS_RESOURCE)
|
|
64
|
+
},
|
|
65
|
+
[
|
|
66
|
+
resourceNames(RESOURCE_CLASSES.sqs, queueName),
|
|
67
|
+
resourceNames(RESOURCE_CLASSES.sqs, queueName + "DLQ")
|
|
68
|
+
]
|
|
69
|
+
),
|
|
70
|
+
createIamRole(
|
|
71
|
+
{
|
|
72
|
+
[RESOURCE_CLASSES.lambda]: Object.values(LAMBDA_RESOURCE)
|
|
73
|
+
},
|
|
74
|
+
[
|
|
75
|
+
resourceNames(RESOURCE_CLASSES.lambda, 'CreateHdrInv')
|
|
76
|
+
]
|
|
77
|
+
),
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
if (flowSchema.statusType === "storedCache") {
|
|
81
|
+
let tableStroedCaches = [];
|
|
82
|
+
let objectSchema = await getObjectSchema.getLocalObjectSchemas(_izContext, [flowSchema.objType.objectType], path.join(srcPath, "./schemas")).then(res => res.records[0])
|
|
83
|
+
if (!objectSchema) {
|
|
84
|
+
throw new NoRetryError('ObjectSchema not found')
|
|
85
|
+
}
|
|
86
|
+
for (const storageResource of Object.values(objectSchema.storageResources)) {
|
|
87
|
+
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
88
|
+
if (!tableStroedCaches.includes(storageResource.tableName)) {
|
|
89
|
+
tableStroedCaches.push(storageResource.tableName)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
additionalResourcePermission.push(
|
|
95
|
+
createIamRole(
|
|
96
|
+
{
|
|
97
|
+
[RESOURCE_CLASSES.dynamoDbTable]: Object.values(DYNAMO_RESOURCE)
|
|
98
|
+
},
|
|
99
|
+
tableStroedCaches.map(
|
|
100
|
+
tableName => resourceNames(RESOURCE_CLASSES.dynamoDbTable, tableName))
|
|
101
|
+
)
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return {
|
|
106
|
+
templatePath: templatePath,
|
|
107
|
+
templateData: {
|
|
108
|
+
functionName,
|
|
109
|
+
handlerType,
|
|
110
|
+
queueName
|
|
111
|
+
},
|
|
112
|
+
setting: {
|
|
113
|
+
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, "source/"),
|
|
114
|
+
saveFileName: `${functionName}_${handlerType}`,
|
|
115
|
+
fileExtension: ".js",
|
|
116
|
+
isAppend: false
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
module.exports = data;
|
package/src/reStructure/TemplateData/flowSchema/externalTopic/{sqs/handler → handler}/template.ejs
RENAMED
|
@@ -20,63 +20,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
20
20
|
// const AWS = require('aws-sdk');
|
|
21
21
|
// const sqs = new AWS.SQS({ apiVersion: '2012-11-05' });
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const izara = require("@izara_project/izara-middleware");
|
|
24
|
+
const middleware = izara.middlewareHandler;
|
|
24
25
|
const recordHandlerSharedLib = require("@izara_project/izara-core-library-record-handler")
|
|
25
26
|
const Logger = require('@izara_project/izara-core-library-logger');
|
|
26
27
|
|
|
27
|
-
const
|
|
28
|
+
const <%- functionName %> = require('./<%- functionName %>_Main')
|
|
28
29
|
|
|
29
30
|
// validate event properties in body.Message of sqs event
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
// required: ['param1', 'param2', 'param3', 'param4',],
|
|
35
|
-
// properties: {
|
|
36
|
-
// param1: {
|
|
37
|
-
// type: 'object',
|
|
38
|
-
// default: {}
|
|
39
|
-
// },
|
|
40
|
-
// param2: {
|
|
41
|
-
// type: 'string',
|
|
42
|
-
// default: true,
|
|
43
|
-
// pattern: "^[a-zA-Z0-9_-]+$",
|
|
44
|
-
// },
|
|
45
|
-
// param3: {
|
|
46
|
-
// type: 'array',
|
|
47
|
-
// items: { // items in array
|
|
48
|
-
// type: "object", // string
|
|
49
|
-
// properties: {
|
|
50
|
-
// "c": {
|
|
51
|
-
// type: "string"
|
|
52
|
-
// },
|
|
53
|
-
// "d": {
|
|
54
|
-
// type: "number"
|
|
55
|
-
// }
|
|
56
|
-
// },
|
|
57
|
-
// }
|
|
58
|
-
// },
|
|
59
|
-
// param4: {
|
|
60
|
-
// type: 'number',
|
|
61
|
-
// }
|
|
62
|
-
// }
|
|
63
|
-
// };
|
|
64
|
-
|
|
65
|
-
// set schema for record.body.MessageAttributes
|
|
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
|
-
|
|
79
|
-
module.exports.main = middlewareHandler.wrap(async (event, context, callback) => {
|
|
31
|
+
let perRecordsValidatorSchema = {}
|
|
32
|
+
middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
|
|
33
|
+
|
|
34
|
+
module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
80
35
|
|
|
81
36
|
try {
|
|
82
37
|
|
|
@@ -90,9 +45,9 @@ module.exports.main = middlewareHandler.wrap(async (event, context, callback) =>
|
|
|
90
45
|
|
|
91
46
|
//validate message (and MessageAttributes)
|
|
92
47
|
await recordHandlerSharedLib.validateRecord(
|
|
93
|
-
record,
|
|
94
|
-
"<%-
|
|
95
|
-
perRecordsValidatorSchema,
|
|
48
|
+
record, // one record will send to mainFunction
|
|
49
|
+
"<%- queueName %>", // queue name that need to retry or send to dlq
|
|
50
|
+
perRecordsValidatorSchema, // schema for record.Message
|
|
96
51
|
// messageAttributeValidatorSchema // ----- for msgAttr default is null -> do not send this parameter if not want to validate msgAtt
|
|
97
52
|
);
|
|
98
53
|
|
|
@@ -102,10 +57,10 @@ module.exports.main = middlewareHandler.wrap(async (event, context, callback) =>
|
|
|
102
57
|
|
|
103
58
|
// call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
|
|
104
59
|
let recordPromise = recordHandlerSharedLib.recordHandler(
|
|
105
|
-
record,
|
|
106
|
-
<%-
|
|
107
|
-
|
|
108
|
-
passOnProperties,
|
|
60
|
+
record, // one record will send to mainFunction
|
|
61
|
+
<%- functionName %>.<%- functionName %>, // mainFunction that need to invoke.
|
|
62
|
+
"<%- queueName %>", // queue name that need to retry or send to dlq
|
|
63
|
+
passOnProperties, // all parameters that mainFunction needed.
|
|
109
64
|
);
|
|
110
65
|
record._izContext.logger.debug('after recordPromise in handler');
|
|
111
66
|
recordPromises.push(recordPromise); // push promise to recordPromises
|
|
@@ -119,12 +74,12 @@ module.exports.main = middlewareHandler.wrap(async (event, context, callback) =>
|
|
|
119
74
|
return event.Records // return all for local testing
|
|
120
75
|
|
|
121
76
|
} catch {
|
|
122
|
-
Logger.debug('Promise.all(recordPromises) in handler threw error (at least one record did no resolve');
|
|
77
|
+
Logger.debug('Promise.all(recordPromises) in handler threw error (at least one record did no resolve)');
|
|
123
78
|
}
|
|
124
79
|
Logger.debug('after Promise.all(recordPromises) in handler');
|
|
125
80
|
|
|
126
81
|
} catch (err) {
|
|
127
|
-
Logger.error('Unhandled Error,
|
|
82
|
+
Logger.error('Unhandled Error, LambdaFunctionHdrSqs: ', err);
|
|
128
83
|
throw (err);
|
|
129
84
|
}
|
|
130
85
|
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2020 Sven Mason <http://izara.io>
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU Affero General Public License as
|
|
6
|
+
published by the Free Software Foundation, either version 3 of the
|
|
7
|
+
License, or (at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU Affero General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
'use strict';
|
|
19
|
+
const path = require('path');
|
|
20
|
+
|
|
21
|
+
const { SOURCE_PATH, FUNCTION_NAME, HANDLER } = require('../../../../../MainLibs/src/Consts');
|
|
22
|
+
|
|
23
|
+
const { firstLetterUpperCase: upperCase } = require('../../../../../MainLibs/src/Utils')
|
|
24
|
+
const templatePath = path.join(__dirname, "template.ejs");
|
|
25
|
+
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
|
|
26
|
+
const { STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
27
|
+
const statusFieldTemplate = path.join(__dirname, "../../createRecordByStatusType/statusFieldTemplate.ejs")
|
|
28
|
+
const storedCacheTemplate = path.join(__dirname, "../../createRecordByStatusType/storedCacheTemplate.ejs")
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* receive objectSchema
|
|
32
|
+
* create data for WebScoket handler template
|
|
33
|
+
*
|
|
34
|
+
* @param {Object} objectSchema
|
|
35
|
+
* @return {{templatePath, templateData,setting}}
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
async function data(_izContext, flowSchema, srcPath) {
|
|
40
|
+
return [await createParamsForCreateSource(_izContext, flowSchema, srcPath)]
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
44
|
+
let functionName = "Process" + upperCase(flowSchema.flowTag);
|
|
45
|
+
let tableName = null;
|
|
46
|
+
if (flowSchema.statusType === "storedCache") {
|
|
47
|
+
let objectSchema = await getObjectSchema.getLocalObjectSchemas(_izContext, [flowSchema.objType.objectType], path.join(srcPath, "./schemas")).then(res => res.records[0]);
|
|
48
|
+
for (const storageResource of Object.values(objectSchema.storageResources)) {
|
|
49
|
+
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
50
|
+
tableName = storageResource.tableName
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
let flowSchemaComplete = upperCase(flowSchema.flowTag) + "Complete"
|
|
55
|
+
return {
|
|
56
|
+
templatePath: templatePath,
|
|
57
|
+
templateData: {
|
|
58
|
+
statusType: flowSchema.statusType,
|
|
59
|
+
statusFieldTemplate,
|
|
60
|
+
storedCacheTemplate,
|
|
61
|
+
flowTag: flowSchema.flowTag,
|
|
62
|
+
functionName,
|
|
63
|
+
tableName,
|
|
64
|
+
flowSchemaComplete
|
|
65
|
+
},
|
|
66
|
+
setting: {
|
|
67
|
+
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, "source/"),
|
|
68
|
+
saveFileName: `${functionName}_Main`,
|
|
69
|
+
fileExtension: ".js",
|
|
70
|
+
isAppend: false
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
module.exports = data
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2020 Sven Mason <http: //izara.io>
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU Affero General Public License as
|
|
6
|
+
published by the Free Software Foundation, either version 3 of the
|
|
7
|
+
License, or (at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU Affero General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
along with this program. If not, see
|
|
16
|
+
<http: //www.gnu.org/licenses />.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
22
|
+
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
|
|
23
|
+
|
|
24
|
+
const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
|
|
25
|
+
const snsSharedLib = require('@izara_project/izara-core-library-sns');
|
|
26
|
+
const sqsSharedLib = require('@izara_project/izara-core-library-sqs');
|
|
27
|
+
const asyncFlowSharedLib = require('@izara_project/izara-core-library-asynchronous-flow');
|
|
28
|
+
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
29
|
+
const lambdaSharedLib = require('@izara_project/izara-core-library-lambda');
|
|
30
|
+
const storedCacheSharedLib = require('@izara_project/izara-core-library-stored-cache')
|
|
31
|
+
|
|
32
|
+
const externalRequest = require('@izara_project/izara-core-library-external-request');
|
|
33
|
+
const sns = externalRequest.sns
|
|
34
|
+
const sqs = externalRequest.sqs
|
|
35
|
+
const lambda = externalRequest.lambda
|
|
36
|
+
const { postToConnection } = require("../../../libs/source/GenerateCodeLibs");
|
|
37
|
+
const utils = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Utils')
|
|
38
|
+
const NoRetryError = require('@izara_project/izara-core-library-core').NoRetryError
|
|
39
|
+
const { v4: uuidv4 } = require('uuid')
|
|
40
|
+
const coreConsts = require("@izara_project/izara-core-library-core/src/Consts");
|
|
41
|
+
const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
42
|
+
const consts = require('@izara_project/izara-middleware/src/MiddlewareCore/Consts')
|
|
43
|
+
const { createFieldNamesFromRequestParamsByObjectSchema } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs.js')
|
|
44
|
+
//(<optionalRequire>)
|
|
45
|
+
//(</optionalRequire>)
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
*
|
|
49
|
+
* description of function.
|
|
50
|
+
* @param {Object} _izContext
|
|
51
|
+
* @param {CorrelationIds} _izContext.correlationIds - property of _izContext
|
|
52
|
+
* @param {Logger} _izContext.logger - property of _izContext
|
|
53
|
+
* @param {Object} requestParams - request params
|
|
54
|
+
* @param {Object} requestParams.identifiers - identifiers for get data
|
|
55
|
+
* @param {Object} requestParams.additionalRequest - additionalRequest
|
|
56
|
+
*
|
|
57
|
+
*
|
|
58
|
+
* @returns {object} description of return value
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
module.exports.<%- functionName %> = async (
|
|
62
|
+
_izContext,
|
|
63
|
+
requestParams,
|
|
64
|
+
callingFlowConfig = {},
|
|
65
|
+
//(<additionalParams>)
|
|
66
|
+
//(</additionalParams>)
|
|
67
|
+
) => {
|
|
68
|
+
|
|
69
|
+
try {
|
|
70
|
+
_izContext.logger.debug("<%- functionName %> _izContext", _izContext)
|
|
71
|
+
_izContext.logger.debug("<%- functionName %> requestParams", requestParams)
|
|
72
|
+
_izContext.logger.debug("<%- functionName %> callingFlowConfig", callingFlowConfig)
|
|
73
|
+
|
|
74
|
+
let correlationId = _izContext.correlationIds.get(consts.X_CORRELATION_ID)
|
|
75
|
+
let connectionId = _izContext.correlationIds.get(consts.CONNECTION_ID);
|
|
76
|
+
|
|
77
|
+
//(<endpointHookMainFunction>)
|
|
78
|
+
//(</endpointHookMainFunction>)
|
|
79
|
+
|
|
80
|
+
const flowSchema = await getObjectSchema.getFlowSchemaS3WithCache(_izContext, {
|
|
81
|
+
flowTag: requestParams.action,
|
|
82
|
+
serviceTag: process.env.iz_serviceTag
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
<% if (statusType === "statusField") { %>
|
|
86
|
+
<%- include(statusFieldTemplate) %>
|
|
87
|
+
<% } else if (statusType === "storedCache") { %>
|
|
88
|
+
<%- include(storedCacheTemplate, {tableName:tableName}) %>
|
|
89
|
+
let messageObject = requestParams
|
|
90
|
+
|
|
91
|
+
//(<beforeSendMessage>)
|
|
92
|
+
//(</beforeSendMessage>)
|
|
93
|
+
// create callingFlow
|
|
94
|
+
messageObject = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
|
|
95
|
+
messageObject,
|
|
96
|
+
callingFlowSharedLib.addParentCallingFlowConfig(
|
|
97
|
+
callingFlowConfig,
|
|
98
|
+
callingFlowSharedLib.createCallingFlowConfig(
|
|
99
|
+
await lambdaSharedLib.lambdaFunctionName(_izContext, "<%- flowSchemaComplete %>"), {}
|
|
100
|
+
)
|
|
101
|
+
)
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
<% } else if (statusType === "none") { %>
|
|
105
|
+
|
|
106
|
+
let messageObject = requestParams
|
|
107
|
+
|
|
108
|
+
// create callingFlow
|
|
109
|
+
messageObject = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
|
|
110
|
+
messageObject,
|
|
111
|
+
callingFlowSharedLib.addParentCallingFlowConfig(
|
|
112
|
+
callingFlowConfig,
|
|
113
|
+
callingFlowSharedLib.createCallingFlowConfig(
|
|
114
|
+
await lambdaSharedLib.lambdaFunctionName(_izContext, TOPIC_NAME_GENERATE_CODE.flowSchemaOwnTopicComplete), {}
|
|
115
|
+
)
|
|
116
|
+
)
|
|
117
|
+
)
|
|
118
|
+
<% } %>
|
|
119
|
+
|
|
120
|
+
//(<endpointHook>)
|
|
121
|
+
//(</endpointHook>)
|
|
122
|
+
|
|
123
|
+
return {
|
|
124
|
+
//(<endpointReturn>)
|
|
125
|
+
//(</endpointReturn>)
|
|
126
|
+
}
|
|
127
|
+
} catch (err) {
|
|
128
|
+
_izContext.logger.error('error WebSocketInvoke: ', err)
|
|
129
|
+
throw (err)
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -19,21 +19,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
19
19
|
|
|
20
20
|
const path = require("path")
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} = require("../../../../../MainLibs/src/Utils");
|
|
29
|
-
const {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
22
|
+
|
|
23
|
+
// const {
|
|
24
|
+
// HANDLER,
|
|
25
|
+
// STORAGE_TYPES
|
|
26
|
+
// } = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
27
|
+
|
|
28
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../MainLibs/src/Utils.js");
|
|
29
|
+
const STORAGE_TYPES = {
|
|
30
|
+
dynamoDB: "dynamoDB",
|
|
31
|
+
graph: "graph"
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const snsTemplatePath = path.join(__dirname, '/template.ejs');
|
|
35
|
+
const subscriptionSqsTemplatePath = path.join(__dirname, './sqsTemplate.ejs');
|
|
36
|
+
|
|
37
|
+
const { SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, HANDLER } = require('../../../../../MainLibs/src/Consts.js');
|
|
37
38
|
|
|
38
39
|
/**
|
|
39
40
|
* create data for dynamoDbYaml tempalte from objectSchema
|
|
@@ -45,25 +46,51 @@ const {
|
|
|
45
46
|
* @returns {Object[]} - data of multiple dynamoDb template
|
|
46
47
|
*/
|
|
47
48
|
|
|
48
|
-
function
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
49
|
+
function createDataForDefaultSnsInSqs(_izContext, flowSchema, srcPath) {
|
|
50
|
+
let resultsForCreateDefaultSnsInSqs = [];
|
|
51
|
+
let flowSteps = Object.keys(flowSchema.flowSteps);
|
|
52
|
+
const setting = {
|
|
53
|
+
initialData: "Resources:\n",
|
|
54
|
+
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
55
|
+
saveFileName: SAVE_FILE_NAME.snsInSqsYaml,
|
|
56
|
+
fileExtension: ".yml",
|
|
57
|
+
isAppend: true
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
let topicIn = `${upperCase(flowSchema.flowTag)}`;
|
|
61
|
+
|
|
62
|
+
const generatedSnsTopicInForFlowSchema = [];
|
|
63
|
+
if (flowSteps.includes("In")) {
|
|
64
|
+
generatedSnsTopicInForFlowSchema.push(
|
|
65
|
+
{
|
|
66
|
+
queueName: "Process" + upperCase(topicIn) + upperCase(HANDLER.hdrSqs)
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
if (flowSchema.outputTopic) {
|
|
75
|
+
if (flowSteps.includes("Out")) {
|
|
76
|
+
let topicOut = `${upperCase(flowSchema.flowTag)}`;
|
|
77
|
+
defaultDsqQueueDataList.push({
|
|
78
|
+
queueName: `WebSocketComplete` + upperCase(HANDLER.hdrSqs),
|
|
79
|
+
subscribeTo: topicOut
|
|
80
|
+
}
|
|
81
|
+
)
|
|
65
82
|
}
|
|
66
|
-
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
for (let defaultSnsInSqsData of generatedSnsTopicInForFlowSchema) {
|
|
86
|
+
resultsForCreateDefaultSnsInSqs.push({
|
|
87
|
+
templatePath: snsTemplatePath,
|
|
88
|
+
templateData: defaultSnsInSqsData,
|
|
89
|
+
setting: setting
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return resultsForCreateDefaultSnsInSqs;
|
|
67
94
|
}
|
|
68
95
|
|
|
69
|
-
module.exports =
|
|
96
|
+
module.exports = createDataForDefaultSnsInSqs;
|