@izara_project/izara-market-library-service-schemas 1.0.2 → 1.0.4
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 +5 -5
- package/src/GenerateCodeLibs/src/Consts.js +40 -0
- package/src/SourceManager/src/CreateSource.js +0 -1
- package/src/SourceManager/src/Utils.js +15 -1
- package/src/TemplateManager/src/FunctionYaml/HdrApi/data.js +170 -0
- package/src/TemplateManager/src/FunctionYaml/HdrApi/request.json +14 -0
- package/src/TemplateManager/src/FunctionYaml/HdrApi/template.ejs +33 -0
- package/src/TemplateManager/src/FunctionYaml/HdrDsq/data.js +180 -0
- package/src/TemplateManager/src/FunctionYaml/HdrDsq/request.json +19 -0
- package/src/TemplateManager/src/FunctionYaml/HdrDsq/template.ejs +30 -0
- package/src/TemplateManager/src/FunctionYaml/HdrInv/data.js +169 -0
- package/src/TemplateManager/src/{PerActionEndpoint/TemplateAndData/ResourceYaml/Lambda/Template/HdrInv.exampleData.js → FunctionYaml/HdrInv/example req.js } +3 -3
- package/src/TemplateManager/src/FunctionYaml/HdrInv/request.json +14 -0
- package/src/TemplateManager/src/{PerActionEndpoint/TemplateAndData/ResourceYaml/Lambda/Template/HdrInv.ejs → FunctionYaml/HdrInv/template.ejs} +5 -5
- package/src/TemplateManager/src/FunctionYaml/HdrSqs/data.js +182 -0
- package/src/TemplateManager/src/FunctionYaml/HdrSqs/request.json +19 -0
- package/src/TemplateManager/src/FunctionYaml/HdrSqs/template.ejs +30 -0
- package/src/TemplateManager/src/GenerateCode(Old).js +135 -0
- package/src/TemplateManager/src/GenerateCode.js +175 -15
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrApi/data.js +100 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrApi/request.json +7 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrApi/template.ejs +76 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrDsq/data.js +109 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrDsq/request.json +7 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrDsq/template.ejs +105 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/data.js +102 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/request.json +7 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/template.ejs +82 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrSqs/data.js +102 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrSqs/request.json +7 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrSqs/template.ejs +124 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/testRequest.json +5 -0
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Get/data.js +88 -0
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Get/request.json +5 -0
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Get/template.ejs +219 -0
- package/src/TemplateManager/src/ResourceYaml/dynamodb/awaitingMultipleStepData.js +98 -0
- package/src/TemplateManager/src/{MainResourcesYaml/TemplateAndData/DynamoDbMain/Data/MainDynamoDbYamlData.js → ResourceYaml/dynamodb/mainResourcePerObjectSchemaData.js} +66 -46
- package/src/TemplateManager/src/ResourceYaml/dynamodb/processLogicalAndFindData.js +103 -0
- package/src/TemplateManager/src/ResourceYaml/dynamodb/request.json +7 -0
- package/src/TemplateManager/src/ResourceYaml/dynamodb/template.ejs +31 -0
- package/src/TemplateManager/src/ResourceYaml/sns-in-sqs/defaultSnsInSqsForFindDataAndProcessLogical.js +81 -0
- package/src/TemplateManager/src/ResourceYaml/sns-in-sqs/request.json +4 -0
- package/src/TemplateManager/src/ResourceYaml/sns-in-sqs/snsAndSqsPerActiondata.js +108 -0
- package/src/TemplateManager/src/ResourceYaml/sns-in-sqs/snsTemplate.ejs +59 -0
- package/src/TemplateManager/src/ResourceYaml/sns-in-sqs/sqsTemplate.ejs +43 -0
- package/src/TemplateManager/src/ResourceYaml/sns-out/data.js +89 -0
- package/src/TemplateManager/src/ResourceYaml/sns-out/request.json +3 -0
- package/src/TemplateManager/src/ResourceYaml/sns-out/template.ejs +10 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/functionYaml/data.js +151 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/functionYaml/request.json +3 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/functionYaml/template.ejs +33 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/handler/HdrSqs/data.js +76 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/handler/HdrSqs/template.ejs +127 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/mainFunction/data.js +55 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/mainFunction/request.json +1 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/mainFunction/template.ejs +140 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/sns-in-sqs/data.js +75 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/sns-in-sqs/request.json +3 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/sns-in-sqs/template.ejs +45 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/sns-out/data.js +70 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/sns-out/request.json +3 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrApi/data.js +127 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrApi/template.ejs +33 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrDsq/data.js +148 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrInv/data.js +125 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrSqs/data.js +148 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/mainFunction/data.js +80 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/mainFunction/request.json +1 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/mainFunction/template.ejs +324 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrApi/data.js +72 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrApi/request.json +7 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrApi/template.ejs +120 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrDsq/data.js +73 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrDsq/request.json +7 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrDsq/template.ejs +167 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrInv/data.js +73 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrInv/request.json +5 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrInv/template.ejs +126 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrSqs/data.js +73 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrSqs/request.json +7 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrSqs/template.ejs +146 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/request.json +31 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/sns-in-sqs/data.js +91 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/sns-in-sqs/request.json +3 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/sns-out/data.js +70 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/sns-out/request.json +3 -0
- package/src/TemplateManager/src/externalService/LambdaRole/data.js +193 -0
- package/src/TemplateManager/src/externalService/LambdaRole/request.json +18 -0
- package/src/TemplateManager/src/externalService/LambdaRole/template.ejs +56 -0
- package/src/TemplateManager/src/externalService/SnsTopicSubscriotions/data.js +96 -0
- package/src/TemplateManager/src/externalService/SnsTopicSubscriotions/request.json +12 -0
- package/src/TemplateManager/src/externalService/SnsTopicSubscriotions/template.ejs +10 -0
- package/src/TemplateManager/src/libs/Consts.js +32 -3
- package/src/TemplateManager/src/MainResourcesYaml/TemplateAndData/DynamoDbMain/Template/DynamoDb.ejs +0 -31
- package/src/TemplateManager/src/MainResourcesYaml/TemplateAndData/DynamoDbMain/Template/DynamoDb.exampleData.js +0 -12
- package/src/TemplateManager/src/PerActionEndpoint/CreateSourceData.js +0 -131
- package/src/TemplateManager/src/PerActionEndpoint/TemplateAndData/MainFunction/MainFunctionTemplate/Create.js +0 -18
- package/src/TemplateManager/src/PerActionEndpoint/TemplateAndData/MainFunction/MainFunctionTemplate/Delete.js +0 -18
- package/src/TemplateManager/src/PerActionEndpoint/TemplateAndData/MainFunction/MainFunctionTemplate/Get.js +0 -18
- package/src/TemplateManager/src/PerActionEndpoint/TemplateAndData/MainFunction/MainFunctionTemplate/Update.js +0 -18
- package/src/TemplateManager/src/PerActionEndpoint/TemplateAndData/ResourceYaml/Lambda/Data/LambdaYamlData.js +0 -166
- package/src/TemplateManager/src/PerActionEndpoint/TemplateAndData/ResourceYaml/Lambda/Template/HdrSqs.ejs +0 -0
- /package/src/TemplateManager/src/{MainResourcesYaml → ResourceYaml}/CreateSourceData.js +0 -0
- /package/src/TemplateManager/src/{PerActionEndpoint/DataPerActionEndpoint.js → UpdateRelationshipSchema/updateRalationshipComplete/handler/HdrSqs/request.json} +0 -0
- /package/src/TemplateManager/src/{PerActionEndpoint/TemplateAndData/Handler/Handler.js → UpdateRelationshipSchema/updateRelationship/functionYaml/HdrApi/request.json} +0 -0
- /package/src/TemplateManager/src/{PerActionEndpoint/TemplateAndData/MainFunction/MainFunctionTemplateData.js → UpdateRelationshipSchema/updateRelationship/functionYaml/HdrDsq/request.json} +0 -0
- /package/src/TemplateManager/src/{PerActionEndpoint/TemplateAndData/ResourceYaml/Lambda/Template/HdrApi.ejs → UpdateRelationshipSchema/updateRelationship/functionYaml/HdrInv/request.json} +0 -0
- /package/src/TemplateManager/src/{PerActionEndpoint/TemplateAndData/ResourceYaml/Lambda/Template/HdrDsq.ejs → UpdateRelationshipSchema/updateRelationship/functionYaml/HdrSqs/request.json} +0 -0
|
@@ -0,0 +1,81 @@
|
|
|
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
|
+
|
|
29
|
+
const STORAGE_TYPES = {
|
|
30
|
+
dynamoDB: "dynamoDB",
|
|
31
|
+
graph: "graph"
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const templatePath = path.join(__dirname, './snsTemplate.ejs');
|
|
35
|
+
const { SOURCE_PATH } = require('../../libs/Consts')
|
|
36
|
+
|
|
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, srcPath) {
|
|
49
|
+
let resultsForCreateDefaultSnsInSqs = [];
|
|
50
|
+
const defaultSnsInSqsDataList = [
|
|
51
|
+
{
|
|
52
|
+
"queueName": "FindData"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"queueName": "LogicalResultsMain"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"queueName": "LogicalResultsData"
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
|
|
62
|
+
// console.log("defaultSnsInSqsDataList", defaultSnsInSqsDataList);
|
|
63
|
+
|
|
64
|
+
for (let defaultSnsInSqsData of defaultSnsInSqsDataList) {
|
|
65
|
+
resultsForCreateDefaultSnsInSqs.push({
|
|
66
|
+
templatePath,
|
|
67
|
+
templateData: defaultSnsInSqsData,
|
|
68
|
+
setting: {
|
|
69
|
+
initialData: "Resources:\n",
|
|
70
|
+
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
71
|
+
saveFileName: "generated-sns-in-sqs",
|
|
72
|
+
fileExtension: ".yml",
|
|
73
|
+
isAppend: true
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
}
|
|
77
|
+
// console.log("resultsForCreateDefaultSnsInSqs", resultsForCreateDefaultSnsInSqs);
|
|
78
|
+
return resultsForCreateDefaultSnsInSqs;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
module.exports = createDataForDefaultSnsInSqs;
|
|
@@ -0,0 +1,108 @@
|
|
|
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
|
+
|
|
29
|
+
const { ACTIONS, HANDLER, SOURCE_PATH, DEFAULT_HANDLER_PER_ACTION } = require('../../libs/Consts');
|
|
30
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require('../../../../MainLibs/src/Utils')
|
|
31
|
+
const snsTemplatePath = path.join(__dirname, './snsTemplate.ejs')
|
|
32
|
+
const sqsTemplatePath = path.join(__dirname, './sqsTemplate.ejs')
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* create data for dynamoDbYaml tempalte from objectSchema
|
|
36
|
+
* return array of dynamoDb data
|
|
37
|
+
* because one objectSchema can create multiple dynamoDb table
|
|
38
|
+
*
|
|
39
|
+
* @param {Object} _izContext
|
|
40
|
+
* @param {Object} objectSchema
|
|
41
|
+
* @returns {Object[]} - data of multiple dynamoDb template
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
function dataForCreateSnsAndSqsQueueFromObjectSchema(_izContext, objectSchema, srcPath) {
|
|
45
|
+
const snsAndSqsDataArray = [];
|
|
46
|
+
for (const action of Object.values(ACTIONS)) {
|
|
47
|
+
if (objectSchema.overWriteHandlers[action]) {
|
|
48
|
+
for (const handler of objectSchema.overWriteHandlers[action]) {
|
|
49
|
+
const snsAndSqsData = {
|
|
50
|
+
queueName: createQueueNameForSnsAndSqsQueue(_izContext, objectSchema, action, handler, srcPath)
|
|
51
|
+
}
|
|
52
|
+
snsAndSqsData.queueName && snsAndSqsDataArray.push(snsAndSqsData);
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
for (const handler of DEFAULT_HANDLER_PER_ACTION[action]) {
|
|
56
|
+
const snsAndSqsData = {
|
|
57
|
+
queueName: createQueueNameForSnsAndSqsQueue(_izContext, objectSchema, action, handler, srcPath)
|
|
58
|
+
}
|
|
59
|
+
snsAndSqsData.queueName && snsAndSqsDataArray.push(snsAndSqsData);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// console.log("snsAndSqsQueueArray", (snsAndSqsDataArray))
|
|
64
|
+
return snsAndSqsDataArray
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function createQueueNameForSnsAndSqsQueue(_izContext, objectSchema, action, handler) {
|
|
68
|
+
let objectType = objectSchema.objectType
|
|
69
|
+
let queueName = upperCase(objectType) + upperCase(action) + upperCase(handler)
|
|
70
|
+
if (queueName.includes('HdrSqs')) {
|
|
71
|
+
queueName = upperCase(objectType) + upperCase(action)
|
|
72
|
+
} else if (queueName.includes('HdrDsq')) {
|
|
73
|
+
queueName = upperCase(objectType) + upperCase(action) + upperCase(handler)
|
|
74
|
+
} else {
|
|
75
|
+
return
|
|
76
|
+
}
|
|
77
|
+
return queueName
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
module.exports.createSourceSnsAndSqs = (_izContext, objectSchema, srcPath) => {
|
|
82
|
+
let resultsForCreateSnsAndSqsSource = [];
|
|
83
|
+
let setting = {
|
|
84
|
+
initialData: 'Resources:\n',
|
|
85
|
+
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
86
|
+
saveFileName: 'generated-sns-in-sqs',
|
|
87
|
+
fileExtension: '.yml',
|
|
88
|
+
isAppend: true
|
|
89
|
+
}
|
|
90
|
+
const snsAndSqsDataList = dataForCreateSnsAndSqsQueueFromObjectSchema(_izContext, objectSchema, srcPath);
|
|
91
|
+
for (let snsAndSqsData of snsAndSqsDataList) {
|
|
92
|
+
if (snsAndSqsData.queueName.includes('HdrDsq')) {
|
|
93
|
+
resultsForCreateSnsAndSqsSource.push({
|
|
94
|
+
templatePath: sqsTemplatePath,
|
|
95
|
+
templateData: snsAndSqsData,
|
|
96
|
+
setting: setting
|
|
97
|
+
})
|
|
98
|
+
} else {
|
|
99
|
+
resultsForCreateSnsAndSqsSource.push({
|
|
100
|
+
templatePath: snsTemplatePath,
|
|
101
|
+
templateData: snsAndSqsData,
|
|
102
|
+
setting: setting
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// console.log("resultsForCreateSnsAndSqsSource", resultsForCreateSnsAndSqsSource);
|
|
107
|
+
return resultsForCreateSnsAndSqsSource
|
|
108
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
##===== [Create topic in]
|
|
2
|
+
In<%- queueName %>:
|
|
3
|
+
Type: AWS::SNS::Topic
|
|
4
|
+
Properties:
|
|
5
|
+
DisplayName: "SNS Message in"
|
|
6
|
+
TopicName: ${self:custom.iz_resourcePrefix}In<%- queueName %>
|
|
7
|
+
##===== SNS Subscription
|
|
8
|
+
##===== [Topic In]
|
|
9
|
+
SubscriptionIn<%- queueName %>:
|
|
10
|
+
Type: AWS::SNS::Subscription
|
|
11
|
+
Properties:
|
|
12
|
+
TopicArn: !Ref In<%- queueName %>
|
|
13
|
+
Endpoint: "arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- queueName %>HdrSqs"
|
|
14
|
+
Protocol: "sqs"
|
|
15
|
+
##===== [Queue]
|
|
16
|
+
<%- queueName %>HdrSqs:
|
|
17
|
+
Type: "AWS::SQS::Queue"
|
|
18
|
+
Properties:
|
|
19
|
+
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>HdrSqs
|
|
20
|
+
RedrivePolicy:
|
|
21
|
+
deadLetterTargetArn:
|
|
22
|
+
# !GetAtt
|
|
23
|
+
Fn::GetAtt:
|
|
24
|
+
- <%- queueName %>HdrSqsDLQ
|
|
25
|
+
- Arn
|
|
26
|
+
maxReceiveCount: 3
|
|
27
|
+
VisibilityTimeout: 120
|
|
28
|
+
##==== [QueueDLQ]
|
|
29
|
+
<%- queueName %>HdrSqsDLQ:
|
|
30
|
+
Type: AWS::SQS::Queue
|
|
31
|
+
Properties:
|
|
32
|
+
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>HdrSqsDLQ
|
|
33
|
+
##==== [QueuePolicy]
|
|
34
|
+
<%- queueName %>HdrSqsPolicy:
|
|
35
|
+
Type: AWS::SQS::QueuePolicy
|
|
36
|
+
Properties:
|
|
37
|
+
PolicyDocument:
|
|
38
|
+
Version: "2012-10-17"
|
|
39
|
+
Statement:
|
|
40
|
+
- Sid: "allow-sns-messages"
|
|
41
|
+
Effect: Allow
|
|
42
|
+
Principal: "*"
|
|
43
|
+
Resource:
|
|
44
|
+
# !GetAtt
|
|
45
|
+
Fn::GetAtt:
|
|
46
|
+
- <%- queueName %>HdrSqs
|
|
47
|
+
- Arn
|
|
48
|
+
Action: "SQS:SendMessage"
|
|
49
|
+
Queues:
|
|
50
|
+
- Ref: <%- queueName %>HdrSqs
|
|
51
|
+
#<#<%- firstLetterUpperCase(queueName) %>QueueSetting#>
|
|
52
|
+
#<#/<%- firstLetterUpperCase(queueName) %>QueueSetting#>
|
|
53
|
+
|
|
54
|
+
<%_ function firstLetterUpperCase(text){
|
|
55
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
56
|
+
} _%>
|
|
57
|
+
<%_ function firstLetterLowerCase(str) {
|
|
58
|
+
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
59
|
+
} _%>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#------- queue ---------
|
|
2
|
+
<%- queueName %>:
|
|
3
|
+
Type: "AWS::SQS::Queue"
|
|
4
|
+
Properties:
|
|
5
|
+
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>
|
|
6
|
+
RedrivePolicy:
|
|
7
|
+
deadLetterTargetArn: #!GetAtt
|
|
8
|
+
Fn::GetAtt:
|
|
9
|
+
- <%- queueName %>DLQ
|
|
10
|
+
- Arn
|
|
11
|
+
maxReceiveCount: 3
|
|
12
|
+
VisibilityTimeout: 120
|
|
13
|
+
|
|
14
|
+
<%- queueName %>DLQ:
|
|
15
|
+
Type: AWS::SQS::Queue
|
|
16
|
+
Properties:
|
|
17
|
+
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>DLQ
|
|
18
|
+
|
|
19
|
+
<%- queueName %>Policy:
|
|
20
|
+
Type: AWS::SQS::QueuePolicy
|
|
21
|
+
Properties:
|
|
22
|
+
PolicyDocument:
|
|
23
|
+
Version: "2012-10-17"
|
|
24
|
+
Statement:
|
|
25
|
+
- Sid: "allow-sns-messages"
|
|
26
|
+
Effect: Allow
|
|
27
|
+
Principal: "*"
|
|
28
|
+
Resource: #!GetAtt
|
|
29
|
+
Fn::GetAtt:
|
|
30
|
+
- <%- queueName %>
|
|
31
|
+
- Arn
|
|
32
|
+
Action: "SQS:SendMessage"
|
|
33
|
+
Queues:
|
|
34
|
+
- Ref: <%- queueName %>
|
|
35
|
+
#<#<%- firstLetterUpperCase(queueName) %>QueueSetting#>
|
|
36
|
+
#<#/<%- firstLetterUpperCase(queueName) %>QueueSetting#>
|
|
37
|
+
|
|
38
|
+
<%_ function firstLetterUpperCase(text){
|
|
39
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
40
|
+
} _%>
|
|
41
|
+
<%_ function firstLetterLowerCase(str) {
|
|
42
|
+
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
43
|
+
} _%>
|
|
@@ -0,0 +1,89 @@
|
|
|
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
|
+
const fs = require('fs');
|
|
21
|
+
|
|
22
|
+
const { ACTIONS, HANDLER } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
23
|
+
|
|
24
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase, firstLetterUpperCase } = require("../../../../MainLibs/src/Utils")
|
|
25
|
+
const { DEFAULT_HANDLER_PER_ACTION, SOURCE_PATH } = require("../../libs/Consts");
|
|
26
|
+
|
|
27
|
+
const templatePath = path.join(__dirname, "./template.ejs")
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* receive objectSchema
|
|
31
|
+
* create data for hdrInv template
|
|
32
|
+
*
|
|
33
|
+
* @return {{ templatePath, templateData, setting } }
|
|
34
|
+
*/
|
|
35
|
+
function createDataForCreateSourceSnsOut(_izContext, objectSchema, srcPath) {
|
|
36
|
+
const createSourceArray = [];
|
|
37
|
+
for (const action of Object.values(ACTIONS)) {
|
|
38
|
+
if (objectSchema.overWriteHandlers[action]) {
|
|
39
|
+
for (const handler of objectSchema.overWriteHandlers[action]) {
|
|
40
|
+
const snsOut = {
|
|
41
|
+
queueName: createQueueName(_izContext, objectSchema, action, handler, srcPath)
|
|
42
|
+
}
|
|
43
|
+
snsOut.queueName && createSourceArray.push(snsOut)
|
|
44
|
+
}
|
|
45
|
+
} else {
|
|
46
|
+
for (const handler of DEFAULT_HANDLER_PER_ACTION[action]) {
|
|
47
|
+
const snsOut = {
|
|
48
|
+
queueName: createQueueName(_izContext, objectSchema, action, handler, srcPath)
|
|
49
|
+
}
|
|
50
|
+
snsOut.queueName && createSourceArray.push(snsOut)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
console.log("createSourceArrayInCreateSourceSnsOut", createSourceArray)
|
|
55
|
+
return createSourceArray;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function createQueueName(_izContext, objectSchema, action, handler) {
|
|
59
|
+
let objectType = objectSchema.objectType
|
|
60
|
+
let queueName = upperCase(objectType) + upperCase(action) + upperCase(handler)
|
|
61
|
+
if (queueName.includes("HdrSqs")) {
|
|
62
|
+
queueName = upperCase(objectType) + upperCase(action)
|
|
63
|
+
} else
|
|
64
|
+
return
|
|
65
|
+
return queueName
|
|
66
|
+
}
|
|
67
|
+
function createSourceSnsOut(_izContext, objectSchema, srcPath) {
|
|
68
|
+
let resultsForCreateSnsOut = [];
|
|
69
|
+
const snsOutDataList = createDataForCreateSourceSnsOut(_izContext, objectSchema, srcPath);
|
|
70
|
+
for (let snsOutData of snsOutDataList) {
|
|
71
|
+
resultsForCreateSnsOut.push(
|
|
72
|
+
{
|
|
73
|
+
templatePath: templatePath,
|
|
74
|
+
templateData: snsOutData,
|
|
75
|
+
setting: {
|
|
76
|
+
initialData: 'Resources:\n',
|
|
77
|
+
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
78
|
+
saveFileName: 'generated-sns-out',
|
|
79
|
+
fileExtension: '.yml',
|
|
80
|
+
isAppend: true
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
return resultsForCreateSnsOut
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
module.exports = createSourceSnsOut
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
##--------- [Create Topic Out]
|
|
2
|
+
Out<%- firstLetterUpperCase(queueName) %>:
|
|
3
|
+
Type: AWS::SNS::Topic
|
|
4
|
+
Properties:
|
|
5
|
+
DisplayName: "SNS Message out"
|
|
6
|
+
TopicName: ${self:custom.iz_resourcePrefix}Out<%- firstLetterUpperCase(queueName) %>
|
|
7
|
+
|
|
8
|
+
<%_ function firstLetterUpperCase(text) {
|
|
9
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
10
|
+
} _%>
|
|
@@ -0,0 +1,151 @@
|
|
|
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
|
+
const fs = require('fs');
|
|
21
|
+
|
|
22
|
+
const { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
23
|
+
|
|
24
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../MainLibs/src/Utils")
|
|
25
|
+
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH } = require("../../../libs/Consts");
|
|
26
|
+
|
|
27
|
+
const templatePath = path.join(__dirname, "./template.ejs")
|
|
28
|
+
|
|
29
|
+
function defaultIamRolePerAction() {
|
|
30
|
+
|
|
31
|
+
let defaultIamRole = [];
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
defaultIamRole.push(
|
|
35
|
+
createIamRole(
|
|
36
|
+
{
|
|
37
|
+
[RESOURCE_CLASSES.s3]: ["GetObject", "GetObjectVersion"],
|
|
38
|
+
},
|
|
39
|
+
[
|
|
40
|
+
resourceNames(RESOURCE_CLASSES.s3, "object-schema/perServiceSchemas/*"),
|
|
41
|
+
resourceNames(RESOURCE_CLASSES.s3, "object-schema/serviceConfig/ServiceNameConfig.json"),
|
|
42
|
+
resourceNames(RESOURCE_CLASSES.s3, "object-schema/serviceConfig/GraphServerTags.json"),
|
|
43
|
+
]
|
|
44
|
+
)
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
defaultIamRole.push(
|
|
48
|
+
createIamRole(
|
|
49
|
+
{ [RESOURCE_CLASSES.s3]: ["ListBucket"] },
|
|
50
|
+
[
|
|
51
|
+
resourceNames(RESOURCE_CLASSES.s3, "object-schema"),
|
|
52
|
+
]
|
|
53
|
+
)
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
return defaultIamRole
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* receive objectSchema
|
|
61
|
+
* create data for updateRelationshipSchema
|
|
62
|
+
*
|
|
63
|
+
* @param {Object} objectSchema
|
|
64
|
+
* @return {{ templatePath, templateData, setting } }
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
function data(_izContext, srcPath) {
|
|
68
|
+
let createSourceArray = [];
|
|
69
|
+
const createSourceParam = createParamForCreateSource(srcPath);
|
|
70
|
+
createSourceArray.push(createSourceParam);
|
|
71
|
+
// console.log("createSourceArrayInUpdaterelationShipSchemahdrSqs", createSourceArray)
|
|
72
|
+
return createSourceArray
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
function createParamForCreateSource(srcPath) {
|
|
77
|
+
let awaitingTable = ["AwaitingMultipleSteps", "AwaitingMultipleStepByPending"]
|
|
78
|
+
let handlerType = 'HdrSqs';
|
|
79
|
+
let functionName = 'updateRelationshipComplete'
|
|
80
|
+
let additionalResourcePermission = defaultIamRolePerAction();
|
|
81
|
+
|
|
82
|
+
additionalResourcePermission.push(
|
|
83
|
+
// createIamRole(
|
|
84
|
+
// { [RESOURCE_CLASSES.lambda]: ["InvokeFunction"] },
|
|
85
|
+
// [resourceNames(RESOURCE_CLASSES.lambda, "*GetNodeHdrInv")]),
|
|
86
|
+
createIamRole(
|
|
87
|
+
{
|
|
88
|
+
[RESOURCE_CLASSES.sqs]: [
|
|
89
|
+
SQS_RESOURCE.deleteMessage,
|
|
90
|
+
SQS_RESOURCE.getQueueAttributes,
|
|
91
|
+
SQS_RESOURCE.receiveMessage,
|
|
92
|
+
SQS_RESOURCE.sendMessage,
|
|
93
|
+
SQS_RESOURCE.deleteMessageBatch,
|
|
94
|
+
SQS_RESOURCE.getQueueUrl,
|
|
95
|
+
],
|
|
96
|
+
[RESOURCE_CLASSES.sns]: [
|
|
97
|
+
"Publish", "Subscribe"
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
[
|
|
101
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
|
|
102
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs) + "DLQ"),
|
|
103
|
+
resourceNames(RESOURCE_CLASSES.sns, "In" + upperCase(functionName)),
|
|
104
|
+
resourceNames(RESOURCE_CLASSES.sns, "Out" + upperCase(functionName))
|
|
105
|
+
],
|
|
106
|
+
))
|
|
107
|
+
additionalResourcePermission.push(
|
|
108
|
+
createIamRole(
|
|
109
|
+
{
|
|
110
|
+
[RESOURCE_CLASSES.dynamoDbTable]: ["UpdateItem", "Query", "DeleteItem"]
|
|
111
|
+
},
|
|
112
|
+
awaitingTable.map(tableName =>
|
|
113
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, tableName)
|
|
114
|
+
)
|
|
115
|
+
)
|
|
116
|
+
)
|
|
117
|
+
return {
|
|
118
|
+
templatePath: templatePath,
|
|
119
|
+
templateData: {
|
|
120
|
+
functionName,
|
|
121
|
+
handlerType,
|
|
122
|
+
additionalResourcePermission,
|
|
123
|
+
resourceLocation: SOURCE_PATH.resourceLocationUpdateRelationshipSchema
|
|
124
|
+
},
|
|
125
|
+
setting: {
|
|
126
|
+
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
127
|
+
saveFileName: 'updateRelationshipSchema',
|
|
128
|
+
fileExtension: '.yml',
|
|
129
|
+
isAppend: true
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
// [
|
|
138
|
+
// {
|
|
139
|
+
// templatePath: '/home/toughnut/BasProgram/empty-service-template/app/node_modules/@izara_project/izara-market-library-service-schemas/src/TemplateManager/src/MainResourcesYaml/TemplateAndData/DynamoDbMain/Template/DynamoDb.ejs',
|
|
140
|
+
// templateData: { tableName: 'ObjectTypeSingle', attributes: [Array] },
|
|
141
|
+
// setting: {
|
|
142
|
+
// savePath: '/generatedCode/source/',
|
|
143
|
+
// saveFileName: 'ObjectTypeGet',
|
|
144
|
+
// fileExtension: '.js',
|
|
145
|
+
// isAppend: false
|
|
146
|
+
// }
|
|
147
|
+
// }
|
|
148
|
+
// ]
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
module.exports = data;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<%_ const join = require('path').join; _%>
|
|
2
|
+
<%- firstLetterUpperCase(functionName) %>:
|
|
3
|
+
handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`)%>
|
|
4
|
+
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %>
|
|
5
|
+
events:
|
|
6
|
+
- sqs:
|
|
7
|
+
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %>
|
|
8
|
+
batchSize: 10
|
|
9
|
+
filterPatterns: #**** need to update serverless framwork upper v.2.69.1
|
|
10
|
+
- body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%-firstLetterUpperCase(functionName) %>"]}}} # functionName of callingFlow
|
|
11
|
+
- body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
|
|
12
|
+
iamRoleStatements:
|
|
13
|
+
<%_ additionalResourcePermission.forEach(resourcePermission => { _%>
|
|
14
|
+
- Effect: <%- resourcePermission.effect %>
|
|
15
|
+
Action:
|
|
16
|
+
<%_ Object.keys(resourcePermission.action).forEach(resourcePerAction => { _%>
|
|
17
|
+
<%_ resourcePermission.action[resourcePerAction].forEach(permission => { _%>
|
|
18
|
+
- <%- resourcePerAction %>:<%- permission %>
|
|
19
|
+
<%_}) _%>
|
|
20
|
+
<%_ }) _%>
|
|
21
|
+
Resource:
|
|
22
|
+
<%_ resourcePermission.resource.forEach(resource => { _%>
|
|
23
|
+
- <%- resource %>
|
|
24
|
+
<%_ }) _%>
|
|
25
|
+
<%_}) _%>
|
|
26
|
+
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
27
|
+
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
28
|
+
<%_ function firstLetterUpperCase(text){
|
|
29
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
30
|
+
} _%>
|
|
31
|
+
<%_ function firstLetterLowerCase(str) {
|
|
32
|
+
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
33
|
+
} _%>
|
|
@@ -0,0 +1,76 @@
|
|
|
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
|
+
const fs = require('fs');
|
|
21
|
+
|
|
22
|
+
const { ACTIONS, HANDLER } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
23
|
+
|
|
24
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase, firstLetterUpperCase } = require("../../../../../../MainLibs/src/Utils")
|
|
25
|
+
const { DEFAULT_HANDLER_PER_ACTION, SOURCE_PATH } = require("../../../../libs/Consts");
|
|
26
|
+
|
|
27
|
+
const templatePath = path.join(__dirname, "./template.ejs")
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* receive objectSchema
|
|
31
|
+
* create data for hdrInv template
|
|
32
|
+
*
|
|
33
|
+
* @return {{ templatePath, templateData, setting } }
|
|
34
|
+
*/
|
|
35
|
+
function data(_izContext, srcPath) {
|
|
36
|
+
const createSourceParams = createParamForCreateSource(srcPath)
|
|
37
|
+
return [createSourceParams];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
function createParamForCreateSource(srcPath) {
|
|
42
|
+
const functionName = "updateRelationshipComplete";
|
|
43
|
+
const mainFunction = "updateRelationshipSchemaComplete"
|
|
44
|
+
return {
|
|
45
|
+
templatePath: templatePath,
|
|
46
|
+
templateData: {
|
|
47
|
+
functionName: upperCase(functionName),
|
|
48
|
+
mainFunction: upperCase(mainFunction),
|
|
49
|
+
queueName: upperCase(functionName) + "HdrSqs",
|
|
50
|
+
isCreateMainFunction: false
|
|
51
|
+
},
|
|
52
|
+
setting: {
|
|
53
|
+
savePath: path.join(srcPath, SOURCE_PATH.updateRelationshipSchema),
|
|
54
|
+
saveFileName: `${upperCase(functionName)}_HdrSqs`,
|
|
55
|
+
fileExtension: '.js',
|
|
56
|
+
isAppend: false
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
// [
|
|
63
|
+
// {
|
|
64
|
+
// templatePath: '/home/toughnut/BasProgram/empty-service-template/app/node_modules/@izara_project/izara-market-library-service-schemas/src/TemplateManager/src/MainResourcesYaml/TemplateAndData/DynamoDbMain/Template/DynamoDb.ejs',
|
|
65
|
+
// templateData: { tableName: 'ObjectTypeSingle', attributes: [Array] },
|
|
66
|
+
// setting: {
|
|
67
|
+
// savePath: '/generatedCode/source/',
|
|
68
|
+
// saveFileName: 'ObjectTypeGet',
|
|
69
|
+
// fileExtension: '.js',
|
|
70
|
+
// isAppend: false
|
|
71
|
+
// }
|
|
72
|
+
// }
|
|
73
|
+
// ]
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
module.exports = data;
|