@izara_project/izara-market-library-service-schemas 1.0.39 → 1.0.41
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/MainLibs/src/Consts.js +2 -2
- package/src/TemplateManager/src/libs/Consts.js +2 -1
- package/src/reStructure/TemplateData/externalService/lambdaRole/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/functionYaml/template.ejs +0 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/functionYaml/template.ejs +0 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/functionYaml/template.ejs +0 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/functionYaml/template.ejs +0 -1
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/functionYaml/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/externalTopic/functionYaml/template.ejs +0 -1
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/data.js +1 -14
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/data.js +82 -0
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/functionYaml/data.js +9 -8
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/functionYaml/template.ejs +1 -2
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/handler/data.js +9 -4
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/mainFunction/data.js +11 -10
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/mainFunction/template.ejs +90 -49
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/template.ejs +0 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowStep/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowStep/functionYaml/template.ejs +0 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowStep/handler/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowStep/mainFunction/data.js +5 -4
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-in/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-out/data.js +2 -1
- package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +21 -16
- package/src/reStructure/TemplateData/flowSchema/register/complete/functionYaml/data.js +2 -1
- package/src/reStructure/TemplateData/flowSchema/register/complete/functionYaml/template.ejs +0 -1
- package/src/reStructure/TemplateData/flowSchema/register/complete/mainFunction/template.ejs +28 -23
- package/src/reStructure/TemplateData/flowSchema/register/dynamoDB/register.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/register/subscriptionOutAll/data.js +2 -1
- package/src/reStructure/TemplateData/flowSchema/register/wbs/handler/template.ejs +4 -1
- package/src/reStructure/TemplateData/flowSchema/register/wbs/mainFunction/template.ejs +23 -21
- package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/webSocketComplete → webSocketComplete}/functionYaml/data.js +13 -7
- package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/webSocketComplete → webSocketComplete}/functionYaml/template.ejs +1 -2
- package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/webSocketComplete → webSocketComplete}/handler/data.js +6 -6
- package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/webSocketComplete → webSocketComplete}/mainFunction/data.js +5 -5
- package/src/reStructure/TemplateData/generateRole/createSharedResource.js +4 -4
- package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/template.ejs +1 -0
- package/src/reStructure/TemplateData/perActionComplete/create/yaml/template.ejs +0 -1
- package/src/reStructure/TemplateData/perActionComplete/delete/yaml/template.ejs +0 -1
- package/src/reStructure/TemplateData/perActionComplete/get/yaml/template.ejs +0 -1
- package/src/reStructure/TemplateData/perActionComplete/update/yaml/template.ejs +0 -1
- package/src/reStructure/TemplateData/propertyValueSchema/generateTemplateData.js +1 -0
- package/src/reStructure/TemplateData/propertyValueSchema/objectPropertyValueSchema/data.js +14 -14
- package/src/reStructure/TemplateData/propertyValueSchema/relationshipPropertyValueSchema/data.js +27 -17
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/api/data.js +2 -1
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/dsq/data.js +3 -1
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/inv/data.js +2 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/sqs/data.js +4 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/functionYaml/template.ejs +0 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/api/data.js +5 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/dsq/data.js +5 -2
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/inv/data.js +5 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/sqs/data.js +5 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/functionYaml/template.ejs +0 -1
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/dsq/data.js +5 -2
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/functionYaml/template.ejs +0 -1
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/data.js +5 -1
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/functionYaml/template.ejs +0 -1
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/generateDynamoPerLink.js +1 -2
- package/src/reStructure/TemplateData/resourceYaml/filterGenerateResource/data.js +4 -3
- package/src/reStructure/libs/ValidateAddOnDataStructure.js +0 -1
- /package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/webSocketComplete → webSocketComplete}/handler/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/webSocketComplete → webSocketComplete}/mainFunction/template.ejs +0 -0
package/package.json
CHANGED
|
@@ -520,8 +520,8 @@ function createDynamoDbComponentByLinks(link, relationshipTag) {
|
|
|
520
520
|
let identifiersConcatFrom = `${link.from.objType.serviceTag}_${link.from.objType.objectType}__identifiersConcat`
|
|
521
521
|
let identifiersConcatTo = `${link.to.objType.serviceTag}_${link.to.objType.objectType}__identifiersConcat`
|
|
522
522
|
|
|
523
|
-
let resourceNameFrom = `${upperCase(link.from.objType.objectType) + upperCase(link.to.objType.objectType)}
|
|
524
|
-
let resourceNameTo = `${upperCase(link.to.objType.objectType) + upperCase(link.from.objType.objectType)}
|
|
523
|
+
let resourceNameFrom = `${upperCase(link.from.objType.objectType) + upperCase(link.to.objType.objectType)}${upperCase(relationshipTag)}`
|
|
524
|
+
let resourceNameTo = `${upperCase(link.to.objType.objectType) + upperCase(link.from.objType.objectType)}${upperCase(relationshipTag)}`
|
|
525
525
|
return {
|
|
526
526
|
tableNameFrom,
|
|
527
527
|
tableNameTo,
|
|
@@ -370,7 +370,8 @@ const SOURCE_GENERATE_IAM_ROLE = {
|
|
|
370
370
|
|
|
371
371
|
const ADD_ON_DATA_STRUCTURE_TYPE = {
|
|
372
372
|
versionedData: "versionedData",
|
|
373
|
-
attributeTree: "attributeTree"
|
|
373
|
+
attributeTree: "attributeTree",
|
|
374
|
+
propertyValue: "propertyValue"
|
|
374
375
|
};
|
|
375
376
|
|
|
376
377
|
const ATTRIBUTE_TAG = {
|
|
@@ -76,8 +76,8 @@ const createExternalLambdaRole = async (_izContext, allObjSchemas, allRelSchemas
|
|
|
76
76
|
const externalLambdaIamRoleGetPresignUrl = await externalLambdaIamRoleUploadS3(_izContext);
|
|
77
77
|
externalLambdaIamRoleGetPresignUrl && externalLambdaIamRoleArray.push(externalLambdaIamRoleGetPresignUrl);
|
|
78
78
|
} else if (event.includes("extTopic")) {
|
|
79
|
-
const externalSnsPublish = await externalRoleSnsPublish(_izContext, localFlowSchema);
|
|
80
|
-
externalSnsPublish && externalLambdaIamRoleArray.push(externalSnsPublish);
|
|
79
|
+
// const externalSnsPublish = await externalRoleSnsPublish(_izContext, localFlowSchema);
|
|
80
|
+
// externalSnsPublish && externalLambdaIamRoleArray.push(externalSnsPublish);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
}
|
package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/functionYaml/template.ejs
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
batchSize: 10
|
|
9
9
|
filterPatterns: #**** need to update serverless framwork upper v.2.69.1
|
|
10
10
|
- body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%- functionName %>"]}}} # functionName of callingFlow
|
|
11
|
-
- body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
|
|
12
11
|
role: <%- roleName %>Role
|
|
13
12
|
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
14
13
|
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
@@ -8,7 +8,6 @@
|
|
|
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}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>"]}}} # functionName of callingFlow
|
|
11
|
-
- body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
|
|
12
11
|
role: <%- roleName %>Role
|
|
13
12
|
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
14
13
|
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
batchSize: 10
|
|
9
9
|
filterPatterns: #**** need to update serverless framwork upper v.2.69.1
|
|
10
10
|
- body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%- functionName %>"]}}} # functionName of callingFlow
|
|
11
|
-
- body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
|
|
12
11
|
role: <%- roleName %>Role
|
|
13
12
|
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
14
13
|
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
@@ -8,7 +8,6 @@
|
|
|
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}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>"]}}} # functionName of callingFlow
|
|
11
|
-
- body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
|
|
12
11
|
role: <%- roleName %>Role
|
|
13
12
|
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
14
13
|
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
batchSize: 10
|
|
9
9
|
filterPatterns: #**** need to update serverless framwork upper v.2.69.1
|
|
10
10
|
- body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%- functionName %>"]}}} # functionName of callingFlow
|
|
11
|
-
- body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
|
|
12
11
|
role: <%- roleName %>Role
|
|
13
12
|
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
14
13
|
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
@@ -63,25 +63,12 @@ function createDataForDefaultSnsInSqs(_izContext, flowSchema, srcPath) {
|
|
|
63
63
|
if (flowSteps.includes("In")) {
|
|
64
64
|
generatedSnsTopicInForFlowSchema.push(
|
|
65
65
|
{
|
|
66
|
-
queueName:
|
|
66
|
+
queueName: upperCase(topicIn) + "Complete" + upperCase(HANDLER.hdrSqs)
|
|
67
67
|
|
|
68
68
|
}
|
|
69
69
|
)
|
|
70
70
|
}
|
|
71
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
|
-
)
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
72
|
for (let defaultSnsInSqsData of generatedSnsTopicInForFlowSchema) {
|
|
86
73
|
resultsForCreateDefaultSnsInSqs.push({
|
|
87
74
|
templatePath: snsTemplatePath,
|
|
@@ -0,0 +1,82 @@
|
|
|
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
|
+
|
|
20
|
+
const path = require("path")
|
|
21
|
+
|
|
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 templatePath = path.join(__dirname, '../../../resourceYaml/sns-out/template.ejs');
|
|
35
|
+
|
|
36
|
+
const { SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, HANDLER } = require('../../../../../MainLibs/src/Consts.js');
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* create data for dynamoDbYaml tempalte from objectSchema
|
|
40
|
+
* return array of dynamoDb data
|
|
41
|
+
* because one objectSchema can create multiple dynamoDb table
|
|
42
|
+
*
|
|
43
|
+
* @param {Object} _izContext
|
|
44
|
+
* @param {String} saveFilePath
|
|
45
|
+
* @returns {Object[]} - data of multiple dynamoDb template
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
function createDataForDefaultSnsInSqs(_izContext, flowSchema, srcPath) {
|
|
49
|
+
let resultsForCreateDefaultSnsInSqs = [];
|
|
50
|
+
let flowSteps = Object.keys(flowSchema.flowSteps);
|
|
51
|
+
const setting = {
|
|
52
|
+
initialData: "Resources:\n",
|
|
53
|
+
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
54
|
+
saveFileName: SAVE_FILE_NAME.snsOutYaml,
|
|
55
|
+
fileExtension: ".yml",
|
|
56
|
+
isAppend: true
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
let topicOut = `${upperCase(flowSchema.flowTag)}`;
|
|
60
|
+
|
|
61
|
+
const generatedSnsTopicInForFlowSchema = [];
|
|
62
|
+
if (flowSteps.includes("Out")) {
|
|
63
|
+
generatedSnsTopicInForFlowSchema.push(
|
|
64
|
+
{
|
|
65
|
+
queueName: upperCase(topicOut) + "Complete"
|
|
66
|
+
|
|
67
|
+
}
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
for (let defaultSnsInSqsData of generatedSnsTopicInForFlowSchema) {
|
|
72
|
+
resultsForCreateDefaultSnsInSqs.push({
|
|
73
|
+
templatePath: templatePath,
|
|
74
|
+
templateData: defaultSnsInSqsData,
|
|
75
|
+
setting: setting
|
|
76
|
+
})
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return resultsForCreateDefaultSnsInSqs;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
module.exports = createDataForDefaultSnsInSqs;
|
|
@@ -38,7 +38,6 @@ const {
|
|
|
38
38
|
const { TOPIC_NAME_GENERATE_CODE } = require('../../../../../../GenerateCodeLibs/src/Consts');
|
|
39
39
|
|
|
40
40
|
const templatePath = path.join(__dirname, "template.ejs");
|
|
41
|
-
const hookTemplate = path.join(__dirname, "./hookTemplate.ejs");
|
|
42
41
|
/**
|
|
43
42
|
* receive objectSchema
|
|
44
43
|
* create data for WebScoket handler template
|
|
@@ -48,17 +47,19 @@ const hookTemplate = path.join(__dirname, "./hookTemplate.ejs");
|
|
|
48
47
|
*/
|
|
49
48
|
|
|
50
49
|
function data(_izContext, flowSchema, srcPath) {
|
|
51
|
-
|
|
50
|
+
let flowSteps = Object.keys(flowSchema.flowSteps)
|
|
51
|
+
if (flowSteps.includes("Out") && flowSchema.outputTopic === false) {
|
|
52
|
+
return []
|
|
53
|
+
} else {
|
|
54
|
+
return [createSourceParams(_izContext, flowSchema, srcPath)]
|
|
55
|
+
}
|
|
52
56
|
}
|
|
53
57
|
|
|
54
58
|
function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
55
|
-
let functionName = upperCase(
|
|
59
|
+
let functionName = upperCase(flowSchema.flowTag) + "Complete"
|
|
56
60
|
let handlerType = upperCase(HANDLER.hdrSqs)
|
|
57
61
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
58
|
-
let
|
|
59
|
-
let flowStepsOut = flowSteps[1];
|
|
60
|
-
let splitFlowStepsOut = flowStepsOut.split("_");
|
|
61
|
-
let topicOut = `${splitFlowStepsOut[3]}_${splitFlowStepsOut[4]}`
|
|
62
|
+
let topicOut = flowSchema.flowTag + "Complete_Out"
|
|
62
63
|
let queueName = functionName + handlerType
|
|
63
64
|
additionalResourcePermission.push(
|
|
64
65
|
createIamRole(
|
|
@@ -83,7 +84,7 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
|
83
84
|
return {
|
|
84
85
|
templatePath: templatePath,
|
|
85
86
|
templateData: {
|
|
86
|
-
resourceLocation: path.join(SOURCE_PATH.
|
|
87
|
+
resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema, flowSchema.flowTag, "source/"),
|
|
87
88
|
functionName,
|
|
88
89
|
handlerType,
|
|
89
90
|
additionalResourcePermission,
|
|
@@ -3,12 +3,11 @@
|
|
|
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
|
-
- sqs:
|
|
6
|
+
- sqs:
|
|
7
7
|
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- queueName %>
|
|
8
8
|
batchSize: 10
|
|
9
9
|
filterPatterns: #**** need to update serverless framwork upper v.2.69.1
|
|
10
10
|
- body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%- functionName %>"]}}} # functionName of callingFlow
|
|
11
|
-
- body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
|
|
12
11
|
role: <%- roleName %>Role
|
|
13
12
|
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
14
13
|
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/handler/data.js
CHANGED
|
@@ -32,11 +32,16 @@ const templatePath = path.join(__dirname, "template.ejs")
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
function data(_izContext, flowSchema, srcPath) {
|
|
35
|
-
|
|
35
|
+
let flowSteps = Object.keys(flowSchema.flowSteps)
|
|
36
|
+
if (flowSteps.includes("Out") && flowSchema.outputTopic === false) {
|
|
37
|
+
return []
|
|
38
|
+
} else {
|
|
39
|
+
return [createSourceParams(_izContext, flowSchema, srcPath)]
|
|
40
|
+
}
|
|
36
41
|
}
|
|
37
42
|
|
|
38
|
-
function
|
|
39
|
-
let functionName = upperCase(
|
|
43
|
+
function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
44
|
+
let functionName = upperCase(flowSchema.flowTag) + "Complete"
|
|
40
45
|
let handlerType = upperCase(HANDLER.hdrSqs)
|
|
41
46
|
let queueName = upperCase(functionName) + upperCase(handlerType)
|
|
42
47
|
return {
|
|
@@ -47,7 +52,7 @@ function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
|
47
52
|
queueName
|
|
48
53
|
},
|
|
49
54
|
setting: {
|
|
50
|
-
savePath: path.join(srcPath, SOURCE_PATH.
|
|
55
|
+
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, "source/"),
|
|
51
56
|
saveFileName: `${functionName}_${handlerType}`,
|
|
52
57
|
fileExtension: ".js",
|
|
53
58
|
isAppend: false
|
|
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
18
18
|
'use strict';
|
|
19
19
|
const path = require('path');
|
|
20
20
|
|
|
21
|
-
const { SOURCE_PATH, FUNCTION_NAME } = require('../../../../../../MainLibs/src/Consts');
|
|
21
|
+
const { SOURCE_PATH, FUNCTION_NAME, HANDLER } = require('../../../../../../MainLibs/src/Consts');
|
|
22
22
|
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils")
|
|
23
23
|
const templatePath = path.join(__dirname, "template.ejs");
|
|
24
24
|
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema')
|
|
@@ -34,24 +34,25 @@ const getObjectSchema = require('@izara_project/izara-core-library-service-schem
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
function data(_izContext, flowSchema, srcPath) {
|
|
37
|
-
|
|
37
|
+
let flowSteps = Object.keys(flowSchema.flowSteps)
|
|
38
|
+
if (flowSteps.includes("Out") && flowSchema.outputTopic === false) {
|
|
39
|
+
return []
|
|
40
|
+
} else {
|
|
41
|
+
return [createParamsForCreateSource(_izContext, flowSchema, srcPath)]
|
|
42
|
+
}
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
41
|
-
let functionName = upperCase(
|
|
42
|
-
|
|
43
|
-
let flowSteps = Object.keys(flowSchema.flowSteps)
|
|
44
|
-
let flowStepsOut = flowSteps[1];
|
|
45
|
-
let splitFlowStepsOut = flowStepsOut.split("_");
|
|
46
|
-
let topicOut = `${splitFlowStepsOut[3]}+_${splitFlowStepsOut[4]}`
|
|
46
|
+
let functionName = upperCase(flowSchema.flowTag) + "Complete" + upperCase(HANDLER.hdrSqs)
|
|
47
|
+
let topicOut = flowSchema.flowTag + "Complete_Out"
|
|
47
48
|
return {
|
|
48
49
|
templatePath: templatePath,
|
|
49
50
|
templateData: {
|
|
51
|
+
functionName,
|
|
50
52
|
topicOut,
|
|
51
|
-
|
|
52
53
|
},
|
|
53
54
|
setting: {
|
|
54
|
-
savePath: path.join(srcPath, SOURCE_PATH.
|
|
55
|
+
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, "source/"),
|
|
55
56
|
saveFileName: `${functionName}_Main`,
|
|
56
57
|
fileExtension: ".js",
|
|
57
58
|
isAppend: false
|
|
@@ -1,50 +1,91 @@
|
|
|
1
|
-
/*
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
+
|
|
12
24
|
const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
|
|
13
|
-
const snsSharedLib = require('@izara_project/izara-core-library-sns');
|
|
14
|
-
|
|
15
|
-
require('@izara_project/izara-core-library-asynchronous-flow');
|
|
16
|
-
callingFlowSharedLib =
|
|
17
|
-
require('@izara_project/izara-core-library-
|
|
18
|
-
= require('@izara_project/izara-core-library-
|
|
19
|
-
require('@izara_project/izara-core-library-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
require(
|
|
25
|
-
|
|
26
|
-
require(
|
|
27
|
-
|
|
28
|
-
require(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
{
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
_izContext
|
|
40
|
-
_izContext.logger
|
|
41
|
-
requestParams
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
+
const triggeredCacheSharedLib = require('@izara_project/izara-core-library-trigger-cache')
|
|
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
|
+
_izContext.correlationIds.get(consts.X_CORRELATION_ID)
|
|
75
|
+
_izContext.correlationIds.get(consts.CONNECTION_ID);
|
|
76
|
+
|
|
77
|
+
const flowSchema = await getObjectSchema.getFlowSchemaS3WithCache(_izContext, {
|
|
78
|
+
flowTag: requestParams.action,
|
|
79
|
+
serviceTag: process.env.iz_serviceTag
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
return {
|
|
84
|
+
//(<endpointReturn>)
|
|
85
|
+
//(</endpointReturn>)
|
|
86
|
+
}
|
|
87
|
+
} catch (err) {
|
|
88
|
+
_izContext.logger.error('error WebSocketInvoke: ', err)
|
|
89
|
+
throw (err)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
batchSize: 10
|
|
9
9
|
filterPatterns: #**** need to update serverless framwork upper v.2.69.1
|
|
10
10
|
- body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%- functionName %>"]}}} # functionName of callingFlow
|
|
11
|
-
- body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
|
|
12
11
|
role: <%- roleName %>Role
|
|
13
12
|
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
14
13
|
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
@@ -91,7 +91,7 @@ module.exports.<%- functionName %> = async (
|
|
|
91
91
|
callingFlowSharedLib.addParentCallingFlowConfig(
|
|
92
92
|
callingFlowConfig,
|
|
93
93
|
callingFlowSharedLib.createCallingFlowConfig(
|
|
94
|
-
await lambdaSharedLib.lambdaFunctionName(_izContext,
|
|
94
|
+
await lambdaSharedLib.lambdaFunctionName(_izContext, "WebSocketCompleteHdrSqs"), {}
|
|
95
95
|
)
|
|
96
96
|
)
|
|
97
97
|
)
|
package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowStep/functionYaml/data.js
CHANGED
|
@@ -94,7 +94,7 @@ function createSourceParams(_izContext, flowTag, flowStep, srcPath) {
|
|
|
94
94
|
return {
|
|
95
95
|
templatePath: templatePath,
|
|
96
96
|
templateData: {
|
|
97
|
-
resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema, upperCase(
|
|
97
|
+
resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema, upperCase(flowStep), "source/"),
|
|
98
98
|
functionName,
|
|
99
99
|
handlerType,
|
|
100
100
|
additionalResourcePermission,
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
batchSize: 10
|
|
9
9
|
filterPatterns: #**** need to update serverless framwork upper v.2.69.1
|
|
10
10
|
- body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%- functionName %>"]}}} # functionName of callingFlow
|
|
11
|
-
- body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
|
|
12
11
|
role: <%- roleName %>Role
|
|
13
12
|
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
14
13
|
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
@@ -70,8 +70,8 @@ function createParamsForCreateSource(_izContext, flowTag, flowStep, srcPath) {
|
|
|
70
70
|
queueName
|
|
71
71
|
},
|
|
72
72
|
setting: {
|
|
73
|
-
savePath: path.join(srcPath, SOURCE_PATH.flowSchema,
|
|
74
|
-
saveFileName: `${flowStep}_${handlerType}`,
|
|
73
|
+
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, upperCase(flowStep), "source/"),
|
|
74
|
+
saveFileName: `${upperCase(flowStep)}_${handlerType}`,
|
|
75
75
|
fileExtension: ".js",
|
|
76
76
|
isAppend: false
|
|
77
77
|
}
|
package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowStep/mainFunction/data.js
CHANGED
|
@@ -30,7 +30,8 @@ const {
|
|
|
30
30
|
FUNCTION_NAME,
|
|
31
31
|
shortNameHandler,
|
|
32
32
|
externalResourceYaml,
|
|
33
|
-
SOURCE_GENERATE_IAM_ROLE
|
|
33
|
+
SOURCE_GENERATE_IAM_ROLE,
|
|
34
|
+
HANDLER
|
|
34
35
|
} = require('../../../../../../MainLibs/src/Consts');
|
|
35
36
|
const templatePath = path.join(__dirname, "template.ejs");
|
|
36
37
|
|
|
@@ -73,7 +74,7 @@ function data(_izContext, flowSchema, srcPath) {
|
|
|
73
74
|
function createParamsForCreateSource(_izContext, flowTag, flowStep, srcPath) {
|
|
74
75
|
let functionName = upperCase(flowTag)
|
|
75
76
|
let topicArn = `${upperCase(flowStep)}_In`
|
|
76
|
-
|
|
77
|
+
let handlerType = upperCase(HANDLER.hdrSqs)
|
|
77
78
|
return {
|
|
78
79
|
templatePath: templatePath,
|
|
79
80
|
templateData: {
|
|
@@ -81,8 +82,8 @@ function createParamsForCreateSource(_izContext, flowTag, flowStep, srcPath) {
|
|
|
81
82
|
functionName
|
|
82
83
|
},
|
|
83
84
|
setting: {
|
|
84
|
-
savePath: path.join(srcPath, SOURCE_PATH.flowSchema,
|
|
85
|
-
saveFileName: `${upperCase(flowStep)}
|
|
85
|
+
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, upperCase(flowStep), "source/"),
|
|
86
|
+
saveFileName: `${upperCase(flowStep)}_${handlerType}`,
|
|
86
87
|
fileExtension: ".js",
|
|
87
88
|
isAppend: false
|
|
88
89
|
}
|
|
@@ -75,7 +75,7 @@ function createDataForDefaultSnsInSqs(_izContext, flowSchema, srcPath) {
|
|
|
75
75
|
if (flowSchema.outputTopic) {
|
|
76
76
|
if (flowSteps.includes("Out")) {
|
|
77
77
|
if (flowSchema.outputTopic) {
|
|
78
|
-
let topicOut = `${upperCase(flowSchema.flowTag)}`;
|
|
78
|
+
let topicOut = `${upperCase(flowSchema.flowTag)}Complete`;
|
|
79
79
|
defaultDsqQueueDataList.push({
|
|
80
80
|
queueName: `WebSocketComplete` + upperCase(HANDLER.hdrSqs),
|
|
81
81
|
subscribeTo: topicOut
|
|
@@ -50,11 +50,12 @@ function createDataForSnsOut(_izContext, flowSchema, srcPath) {
|
|
|
50
50
|
let generatedSnsTopicOutForFlowSchema = []
|
|
51
51
|
let flowSteps = Object.keys(flowSchema.flowSteps);
|
|
52
52
|
let topicOut = `${upperCase(flowSchema.flowTag)}`
|
|
53
|
+
|
|
53
54
|
if (flowSteps.includes("Out")) {
|
|
54
55
|
if (flowSchema.outputTopic) {
|
|
55
56
|
generatedSnsTopicOutForFlowSchema.push(
|
|
56
57
|
{
|
|
57
|
-
queueName: upperCase(topicOut)
|
|
58
|
+
queueName: upperCase(topicOut) + "Complete"
|
|
58
59
|
}
|
|
59
60
|
)
|
|
60
61
|
}
|