@izara_project/izara-market-library-service-schemas 1.0.27 → 1.0.29
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 +9 -5
- package/src/GenerateCodeLibs/src/Consts.js +5 -2
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +5 -5
- package/src/MainLibs/src/Consts.js +46 -2
- package/src/reStructure/GenerateCode.js +0 -4
- package/src/reStructure/GenerateSchema.js +17 -5
- package/src/reStructure/SchemaConfig.js +3 -2
- package/src/reStructure/TemplateData/attributeTreeSchema/generateTemplateData.js +58 -6
- package/src/reStructure/TemplateData/attributeTreeSchema/mainAttributeTreeSchema/data.js +161 -101
- package/src/reStructure/TemplateData/externalService/lambdaRole/template.ejs +3 -4
- package/src/reStructure/TemplateData/findData/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/findData/mainFunction/template.ejs +3 -3
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/handler/template.ejs +2 -3
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/template.ejs +2 -3
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/template.ejs +2 -3
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/template.ejs +5 -6
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/handler/template.ejs +1 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/mainFunction/template.ejs +3 -4
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/getSignUrls/handler/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/getSignUrls/mainFunction/template.ejs +3 -4
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/handler/template.ejs +2 -3
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/template.ejs +5 -6
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/handler/handlerS3/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/mainFunction/template.ejs +4 -5
- package/src/reStructure/TemplateData/flowSchema/components/websocket/dynamoDb/ReservedTableData.js +1 -0
- package/src/reStructure/TemplateData/flowSchema/components/websocket/dynamoDb/WebSocketTaskData.js +1 -0
- package/src/reStructure/TemplateData/perActionComplete/create/handler/template.ejs +2 -3
- package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/template.ejs +4 -5
- package/src/reStructure/TemplateData/perActionComplete/delete/handler/template.ejs +2 -2
- package/src/reStructure/TemplateData/perActionComplete/delete/mainFunction/template.ejs +4 -6
- package/src/reStructure/TemplateData/perActionComplete/generateTemplateData.js +1 -1
- package/src/reStructure/TemplateData/perActionComplete/get/handler/template.ejs +2 -3
- package/src/reStructure/TemplateData/perActionComplete/get/mainFunction/template.ejs +4 -6
- package/src/reStructure/TemplateData/perActionComplete/update/handler/template.ejs +2 -3
- package/src/reStructure/TemplateData/perActionComplete/update/mainFunction/template.ejs +4 -6
- package/src/reStructure/TemplateData/perActionEndpoint/handler/api/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionEndpoint/handler/dsq/template.ejs +2 -2
- package/src/reStructure/TemplateData/perActionEndpoint/handler/inv/template.ejs +1 -3
- package/src/reStructure/TemplateData/perActionEndpoint/handler/sqs/template.ejs +2 -2
- package/src/reStructure/TemplateData/perActionEndpoint/handler/webSocket/template.ejs +3 -3
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/create/template.ejs +6 -7
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/delete/template.ejs +5 -4
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/get/template.ejs +5 -6
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/update/template.ejs +5 -6
- package/src/reStructure/TemplateData/processLogical/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/processLogical/mainFunction/template.ejs +5 -6
- package/src/reStructure/TemplateData/processLogicalPagination/handler/dsq/template.ejs +1 -1
- package/src/reStructure/TemplateData/processLogicalPagination/handler/sqs/template.ejs +1 -1
- package/src/reStructure/TemplateData/processLogicalPagination/mainFunction/template.ejs +6 -5
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/api/data.js +29 -6
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/dsq/data.js +27 -4
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/inv/data.js +27 -4
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/sqs/data.js +28 -4
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/api/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/dsq/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/inv/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/sqs/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/mainFunction/template.ejs +66 -18
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/handler/sqs/template.ejs +2 -3
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/template.ejs +5 -6
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/api/data.js +27 -4
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/dsq/data.js +26 -4
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/inv/data.js +28 -4
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/sqs/data.js +28 -4
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/api/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/dsq/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/inv/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/sqs/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/mainFunction/template.ejs +55 -5
- package/src/reStructure/TemplateData/relationshipPerAction/generateTemplateData.js +62 -6
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/api/data.js +121 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/api/template.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/dsq/data.js +134 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/dsq/template.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/inv/data.js +121 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/inv/template.ejs +13 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/sqs/data.js +134 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/sqs/template.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/api/data.js +57 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/api/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/api/template.ejs +138 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/dsq/data.js +58 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/dsq/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/dsq/template.ejs +183 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/inv/data.js +59 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/inv/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/inv/template.ejs +125 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/sqs/data.js +59 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/sqs/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/sqs/template.ejs +163 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/mainFunction/data.js +59 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/mainFunction/template.ejs +322 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/sns-in-sqs/data.js +77 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/sns-in-sqs/snsTemplate.ejs +59 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/sns-in-sqs/sqsTemplate.ejs +43 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/functionYaml/data.js +110 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/functionYaml/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/functionYaml/template.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/handler/sqs/data.js +60 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/handler/sqs/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/handler/sqs/template.ejs +125 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/mainFunction/data.js +55 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/mainFunction/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/mainFunction/template.ejs +141 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/sns-in-sqs/data.js +71 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/sns-in-sqs/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/sns-in-sqs/template.ejs +47 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/sns-out/data.js +71 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/sns-out/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/sns-out/template.ejs +10 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/api/data.js +27 -22
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/data.js +27 -5
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/inv/data.js +28 -5
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/sqs/data.js +26 -4
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/api/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/dsq/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/inv/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/sqs/template.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/mainFunction/template.ejs +55 -7
- package/src/reStructure/TemplateData/relationshipPerAction.zip +0 -0
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/defaultDynamoDbTable.js +50 -42
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/generateDynamoPerLink.js +100 -0
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/mainResourcePerObjectSchemaData.js +4 -5
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/template.ejs +1 -1
- package/src/reStructure/TemplateData/resourceYaml/generateTemplateData.js +11 -2
- package/src/reStructure/TemplateData/testTemplate/data.js +27 -0
- package/src/reStructure/TemplateData/testTemplate/template.ejs +5 -0
- /package/src/reStructure/TemplateData/attributeTreeSchema/mainAttributeTreeSchema/{attributeLink.ejs → attributeLinkTemplate.ejs} +0 -0
package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/api/data.js
CHANGED
|
@@ -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 { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
21
|
+
const { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
22
22
|
|
|
23
23
|
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../../MainLibs/index.js").utils;
|
|
24
24
|
const {
|
|
@@ -33,8 +33,11 @@ const {
|
|
|
33
33
|
awaitingMultipleStepsRole,
|
|
34
34
|
shortNameHandler,
|
|
35
35
|
SHORT_FUNCTION_NAME,
|
|
36
|
-
SOURCE_GENERATE_IAM_ROLE
|
|
37
|
-
|
|
36
|
+
SOURCE_GENERATE_IAM_ROLE,
|
|
37
|
+
checkDynamoTypeRelationship,
|
|
38
|
+
createDynamoDbComponentByLinks,
|
|
39
|
+
DYNAMO_RESOURCE
|
|
40
|
+
} = require("../../../../../../../MainLibs").consts;
|
|
38
41
|
|
|
39
42
|
const templatePath = path.join(__dirname, "./template.ejs")
|
|
40
43
|
|
|
@@ -46,17 +49,17 @@ const templatePath = path.join(__dirname, "./template.ejs")
|
|
|
46
49
|
* @return {{ templatePath, templateData, setting } }
|
|
47
50
|
*/
|
|
48
51
|
|
|
49
|
-
function data(_izContext, srcPath) {
|
|
52
|
+
function data(_izContext, allObjectRelationships, srcPath) {
|
|
50
53
|
let createSourceArray = [];
|
|
51
54
|
|
|
52
|
-
const createSourceParam = createParamForCreateSource(srcPath);
|
|
55
|
+
const createSourceParam = createParamForCreateSource(allObjectRelationships, srcPath);
|
|
53
56
|
createSourceArray.push(createSourceParam);
|
|
54
57
|
// console.log("createSourceArrayInUpdaterelationShipSchemahdrSqs", createSourceArray)
|
|
55
58
|
return createSourceArray
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
|
|
59
|
-
function createParamForCreateSource(srcPath) {
|
|
62
|
+
function createParamForCreateSource(allObjectRelationships, srcPath) {
|
|
60
63
|
|
|
61
64
|
let handlerType = HANDLER.hdrApi
|
|
62
65
|
let functionName = FUNCTION_NAME.createRel
|
|
@@ -75,6 +78,26 @@ function createParamForCreateSource(srcPath) {
|
|
|
75
78
|
)
|
|
76
79
|
)
|
|
77
80
|
|
|
81
|
+
for (const relationship of allObjectRelationships) {
|
|
82
|
+
let [storageType, relationshipTag, links] = checkDynamoTypeRelationship(relationship)
|
|
83
|
+
if (storageType === STORAGE_TYPES.dynamoDB) {
|
|
84
|
+
for (const link of links) {
|
|
85
|
+
let dynamoComponent = createDynamoDbComponentByLinks(link, relationshipTag)
|
|
86
|
+
additionalResourcePermission.push(
|
|
87
|
+
createIamRole(
|
|
88
|
+
{
|
|
89
|
+
[RESOURCE_CLASSES.dynamoDbTable]: [DYNAMO_RESOURCE.updateItem]
|
|
90
|
+
},
|
|
91
|
+
[
|
|
92
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, upperCase(dynamoComponent.tableNameFrom)),
|
|
93
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, upperCase(dynamoComponent.tableNameTo))
|
|
94
|
+
]
|
|
95
|
+
)
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
78
101
|
return {
|
|
79
102
|
templatePath: templatePath,
|
|
80
103
|
templateData: {
|
package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/dsq/data.js
CHANGED
|
@@ -34,7 +34,10 @@ const {
|
|
|
34
34
|
awaitingMultipleStepsRole,
|
|
35
35
|
shortNameHandler,
|
|
36
36
|
SHORT_FUNCTION_NAME,
|
|
37
|
-
SOURCE_GENERATE_IAM_ROLE
|
|
37
|
+
SOURCE_GENERATE_IAM_ROLE,
|
|
38
|
+
checkDynamoTypeRelationship,
|
|
39
|
+
createDynamoDbComponentByLinks,
|
|
40
|
+
DYNAMO_RESOURCE
|
|
38
41
|
} = require("../../../../../../../MainLibs/index.js").consts;
|
|
39
42
|
|
|
40
43
|
const templatePath = path.join(__dirname, './template.ejs')
|
|
@@ -47,17 +50,17 @@ const templatePath = path.join(__dirname, './template.ejs')
|
|
|
47
50
|
* @return {{ templatePath, templateData, setting } }
|
|
48
51
|
*/
|
|
49
52
|
|
|
50
|
-
function data(_izContext, srcPath) {
|
|
53
|
+
function data(_izContext, allObjectRelationships, srcPath) {
|
|
51
54
|
let createSourceArray = [];
|
|
52
55
|
|
|
53
|
-
const createSourceParam = createParamForCreateSource(srcPath);
|
|
56
|
+
const createSourceParam = createParamForCreateSource(allObjectRelationships, srcPath);
|
|
54
57
|
createSourceArray.push(createSourceParam);
|
|
55
58
|
// console.log("createSourceArrayInUpdaterelationShipSchemahdrSqs", createSourceArray)
|
|
56
59
|
return createSourceArray
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
|
|
60
|
-
function createParamForCreateSource(srcPath) {
|
|
63
|
+
function createParamForCreateSource(allObjectRelationships, srcPath) {
|
|
61
64
|
|
|
62
65
|
let handlerType = HANDLER.hdrDsq
|
|
63
66
|
let functionName = FUNCTION_NAME.createRel
|
|
@@ -89,6 +92,26 @@ function createParamForCreateSource(srcPath) {
|
|
|
89
92
|
|
|
90
93
|
additionalResourcePermission.push(awaitingMultipleStepsRole())
|
|
91
94
|
|
|
95
|
+
for (const relationship of allObjectRelationships) {
|
|
96
|
+
let [storageType, relationshipTag, links] = checkDynamoTypeRelationship(relationship)
|
|
97
|
+
if (storageType === STORAGE_TYPES.dynamoDB) {
|
|
98
|
+
for (const link of links) {
|
|
99
|
+
let dynamoComponent = createDynamoDbComponentByLinks(link, relationshipTag)
|
|
100
|
+
additionalResourcePermission.push(
|
|
101
|
+
createIamRole(
|
|
102
|
+
{
|
|
103
|
+
[RESOURCE_CLASSES.dynamoDbTable]: [DYNAMO_RESOURCE.updateItem]
|
|
104
|
+
},
|
|
105
|
+
[
|
|
106
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, upperCase(dynamoComponent.tableNameFrom)),
|
|
107
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, upperCase(dynamoComponent.tableNameTo))
|
|
108
|
+
]
|
|
109
|
+
)
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
92
115
|
return {
|
|
93
116
|
templatePath: templatePath,
|
|
94
117
|
templateData: {
|
package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/inv/data.js
CHANGED
|
@@ -33,7 +33,10 @@ const {
|
|
|
33
33
|
awaitingMultipleStepsRole,
|
|
34
34
|
shortNameHandler,
|
|
35
35
|
SHORT_FUNCTION_NAME,
|
|
36
|
-
SOURCE_GENERATE_IAM_ROLE
|
|
36
|
+
SOURCE_GENERATE_IAM_ROLE,
|
|
37
|
+
checkDynamoTypeRelationship,
|
|
38
|
+
createDynamoDbComponentByLinks,
|
|
39
|
+
DYNAMO_RESOURCE
|
|
37
40
|
} = require("../../../../../../../MainLibs/index.js").consts;
|
|
38
41
|
|
|
39
42
|
const templatePath = path.join(__dirname, './template.ejs')
|
|
@@ -46,17 +49,17 @@ const templatePath = path.join(__dirname, './template.ejs')
|
|
|
46
49
|
* @return {{ templatePath, templateData, setting } }
|
|
47
50
|
*/
|
|
48
51
|
|
|
49
|
-
function data(_izContext, srcPath) {
|
|
52
|
+
function data(_izContext, allObjectRelationships, srcPath) {
|
|
50
53
|
let createSourceArray = [];
|
|
51
54
|
|
|
52
|
-
const createSourceParam = createParamForCreateSource(srcPath);
|
|
55
|
+
const createSourceParam = createParamForCreateSource(allObjectRelationships, srcPath);
|
|
53
56
|
createSourceArray.push(createSourceParam);
|
|
54
57
|
// console.log("createSourceArrayInUpdaterelationShipSchemahdrSqs", createSourceArray)
|
|
55
58
|
return createSourceArray
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
|
|
59
|
-
function createParamForCreateSource(srcPath) {
|
|
62
|
+
function createParamForCreateSource(allObjectRelationships, srcPath) {
|
|
60
63
|
|
|
61
64
|
let handlerType = HANDLER.hdrInv
|
|
62
65
|
let functionName = FUNCTION_NAME.createRel
|
|
@@ -73,6 +76,26 @@ function createParamForCreateSource(srcPath) {
|
|
|
73
76
|
]
|
|
74
77
|
)
|
|
75
78
|
)
|
|
79
|
+
|
|
80
|
+
for (const relationship of allObjectRelationships) {
|
|
81
|
+
let [storageType, relationshipTag, links] = checkDynamoTypeRelationship(relationship)
|
|
82
|
+
if (storageType === STORAGE_TYPES.dynamoDB) {
|
|
83
|
+
for (const link of links) {
|
|
84
|
+
let dynamoComponent = createDynamoDbComponentByLinks(link, relationshipTag)
|
|
85
|
+
additionalResourcePermission.push(
|
|
86
|
+
createIamRole(
|
|
87
|
+
{
|
|
88
|
+
[RESOURCE_CLASSES.dynamoDbTable]: [DYNAMO_RESOURCE.updateItem]
|
|
89
|
+
},
|
|
90
|
+
[
|
|
91
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, upperCase(dynamoComponent.tableNameFrom)),
|
|
92
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, upperCase(dynamoComponent.tableNameTo))
|
|
93
|
+
]
|
|
94
|
+
)
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
76
99
|
return {
|
|
77
100
|
templatePath: templatePath,
|
|
78
101
|
templateData: {
|
package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/sqs/data.js
CHANGED
|
@@ -34,7 +34,10 @@ const {
|
|
|
34
34
|
awaitingMultipleStepsRole,
|
|
35
35
|
shortNameHandler,
|
|
36
36
|
SHORT_FUNCTION_NAME,
|
|
37
|
-
SOURCE_GENERATE_IAM_ROLE
|
|
37
|
+
SOURCE_GENERATE_IAM_ROLE,
|
|
38
|
+
checkDynamoTypeRelationship,
|
|
39
|
+
createDynamoDbComponentByLinks,
|
|
40
|
+
DYNAMO_RESOURCE
|
|
38
41
|
} = require("../../../../../../../MainLibs/index.js").consts;
|
|
39
42
|
|
|
40
43
|
const templatePath = path.join(__dirname, './template.ejs')
|
|
@@ -47,16 +50,16 @@ const templatePath = path.join(__dirname, './template.ejs')
|
|
|
47
50
|
* @return {{ templatePath, templateData, setting } }
|
|
48
51
|
*/
|
|
49
52
|
|
|
50
|
-
function data(_izContext, srcPath) {
|
|
53
|
+
function data(_izContext, allObjectRelationships, srcPath) {
|
|
51
54
|
let createSourceArray = [];
|
|
52
|
-
const createSourceParam = createParamForCreateSource(srcPath);
|
|
55
|
+
const createSourceParam = createParamForCreateSource(allObjectRelationships, srcPath);
|
|
53
56
|
createSourceArray.push(createSourceParam);
|
|
54
57
|
// console.log("createSourceArrayInUpdaterelationShipSchemahdrSqs", createSourceArray)
|
|
55
58
|
return createSourceArray
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
|
|
59
|
-
function createParamForCreateSource(srcPath) {
|
|
62
|
+
function createParamForCreateSource(allObjectRelationships, srcPath) {
|
|
60
63
|
|
|
61
64
|
let handlerType = HANDLER.hdrSqs
|
|
62
65
|
let functionName = FUNCTION_NAME.createRel
|
|
@@ -88,6 +91,27 @@ function createParamForCreateSource(srcPath) {
|
|
|
88
91
|
),
|
|
89
92
|
)
|
|
90
93
|
additionalResourcePermission.push(awaitingMultipleStepsRole())
|
|
94
|
+
|
|
95
|
+
for (const relationship of allObjectRelationships) {
|
|
96
|
+
let [storageType, relationshipTag, links] = checkDynamoTypeRelationship(relationship)
|
|
97
|
+
if (storageType === STORAGE_TYPES.dynamoDB) {
|
|
98
|
+
for (const link of links) {
|
|
99
|
+
let dynamoComponent = createDynamoDbComponentByLinks(link, relationshipTag)
|
|
100
|
+
additionalResourcePermission.push(
|
|
101
|
+
createIamRole(
|
|
102
|
+
{
|
|
103
|
+
[RESOURCE_CLASSES.dynamoDbTable]: [DYNAMO_RESOURCE.updateItem]
|
|
104
|
+
},
|
|
105
|
+
[
|
|
106
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, upperCase(dynamoComponent.tableNameFrom)),
|
|
107
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, upperCase(dynamoComponent.tableNameTo))
|
|
108
|
+
]
|
|
109
|
+
)
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
91
115
|
return {
|
|
92
116
|
templatePath: templatePath,
|
|
93
117
|
templateData: {
|
package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/api/template.ejs
CHANGED
|
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
18
18
|
'use strict';
|
|
19
19
|
const izara = require("@izara_project/izara-middleware");
|
|
20
20
|
const middleware = izara.middlewareHandler;
|
|
21
|
-
const callingFlowSharedLib = require('@izara_project/izara-
|
|
21
|
+
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
22
22
|
const {
|
|
23
23
|
validateSchemaMiddleware
|
|
24
24
|
} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs');
|
package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/dsq/template.ejs
CHANGED
|
@@ -20,12 +20,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
20
20
|
const izara = require("@izara_project/izara-middleware");
|
|
21
21
|
const middleware = izara.middlewareHandler;
|
|
22
22
|
|
|
23
|
-
const callingFlowSharedLib = require('@izara_project/izara-
|
|
23
|
+
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
24
24
|
|
|
25
25
|
// const CorrelationIds = require('@izara_project/izara-core-library-correlation-ids')
|
|
26
26
|
// const IntegrationTestDetail = require('@izara_project/izara-core-library-integration-tests')
|
|
27
27
|
const Logger = require('@izara_project/izara-core-library-logger');
|
|
28
|
-
const recordHandlerSharedLib = require('@izara_project/izara-
|
|
28
|
+
const recordHandlerSharedLib = require('@izara_project/izara-core-library-record-handler');
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
const <%- functionName %> = require('./<%- firstLetterUpperCase(functionName) %>_Main');
|
package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/inv/template.ejs
CHANGED
|
@@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
20
20
|
const izara = require("@izara_project/izara-middleware");
|
|
21
21
|
const middleware = izara.middlewareHandler;
|
|
22
22
|
|
|
23
|
-
const callingFlowSharedLib = require('@izara_project/izara-
|
|
23
|
+
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
24
24
|
|
|
25
25
|
// const CorrelationIds = require('@izara_project/izara-core-library-correlation-ids')
|
|
26
26
|
// const Logger = require('@izara_project/izara-core-library-logger');
|
package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/sqs/template.ejs
CHANGED
|
@@ -18,12 +18,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
18
18
|
'use strict';
|
|
19
19
|
const izara = require("@izara_project/izara-middleware");
|
|
20
20
|
const middleware = izara.middlewareHandler;
|
|
21
|
-
const callingFlowSharedLib = require('@izara_project/izara-
|
|
21
|
+
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
22
22
|
const {
|
|
23
23
|
validateSchemaMiddleware
|
|
24
24
|
} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs');
|
|
25
25
|
const Logger = require('@izara_project/izara-core-library-logger');
|
|
26
|
-
const recordHandlerSharedLib = require('@izara_project/izara-
|
|
26
|
+
const recordHandlerSharedLib = require('@izara_project/izara-core-library-record-handler');
|
|
27
27
|
|
|
28
28
|
const <%- functionName %> = require('./<%- firstLetterUpperCase(functionName) %>_Main');
|
|
29
29
|
|
package/src/reStructure/TemplateData/relationshipPerAction/create/action/mainFunction/template.ejs
CHANGED
|
@@ -19,13 +19,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
19
19
|
|
|
20
20
|
const hash = require("object-hash");
|
|
21
21
|
|
|
22
|
-
const callingFlowSharedLib = require('@izara_project/izara-
|
|
23
|
-
const lambdaSharedLib = require(
|
|
22
|
+
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
23
|
+
const lambdaSharedLib = require("@izara_project/izara-core-library-lambda");
|
|
24
|
+
const snsSharedLib = require("@izara_project/izara-core-library-sns");
|
|
25
|
+
const dynamodbSharedLib = require("@izara_project/izara-core-library-dynamodb");
|
|
26
|
+
const asyncFlowSharedLib = require("@izara_project/izara-core-library-asynchronous-flow");
|
|
24
27
|
|
|
25
|
-
const snsSharedLib = require('@izara_project/izara-shared/src/SnsSharedLib');
|
|
26
28
|
const sns = require("@izara_project/izara-core-library-external-request/src/resources/Sns");
|
|
27
29
|
|
|
28
|
-
const
|
|
30
|
+
const identifiersObject = require('@izara_project/izara-core-library-service-schemas/src/IdentifiersObject');
|
|
29
31
|
|
|
30
32
|
// const NoRetryError = require('@izara_project/izara-core-library-core/src/NoRetryError');
|
|
31
33
|
|
|
@@ -51,7 +53,7 @@ const {
|
|
|
51
53
|
PREFIX,
|
|
52
54
|
TOPIC_NAME_GENERATE_CODE,
|
|
53
55
|
TOPIC_NAME_GRAPH_HANDLER
|
|
54
|
-
} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
56
|
+
} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts');
|
|
55
57
|
|
|
56
58
|
/**
|
|
57
59
|
* update relationship endpoint
|
|
@@ -64,7 +66,7 @@ const {
|
|
|
64
66
|
*
|
|
65
67
|
* @returns {object} description of return value
|
|
66
68
|
*/
|
|
67
|
-
module.exports
|
|
69
|
+
module.exports.createRelationship = async (
|
|
68
70
|
_izContext,
|
|
69
71
|
requestParams,
|
|
70
72
|
callingFlowConfig = {},
|
|
@@ -92,7 +94,7 @@ module.exports.<%- functionName %> = async (
|
|
|
92
94
|
let errorsFound = [];
|
|
93
95
|
|
|
94
96
|
//(<beforeValidateCreateRel>)
|
|
95
|
-
//(</beforeValidateCreateRel>)
|
|
97
|
+
//(</beforeValidateCreateRel>).
|
|
96
98
|
// validate object and identifiers
|
|
97
99
|
async function validateIdentifiersExists(_izContext, objType, identifiersObject) {
|
|
98
100
|
|
|
@@ -153,8 +155,8 @@ module.exports.<%- functionName %> = async (
|
|
|
153
155
|
const matchToFrom = fromServiceTag === secondServiceTag && fromObjectType === secondObjectType &&
|
|
154
156
|
toServiceTag === firstServiceTag && toObjType === firstObjectType;
|
|
155
157
|
|
|
156
|
-
if ((relationshipDirection === "from" && matchFromTo)
|
|
157
|
-
|
|
158
|
+
if ((relationshipDirection === "from" && matchFromTo) ||
|
|
159
|
+
(relationshipDirection === "to" && matchToFrom)) {
|
|
158
160
|
checkCorrectLink = true
|
|
159
161
|
break;
|
|
160
162
|
}
|
|
@@ -229,7 +231,7 @@ module.exports.<%- functionName %> = async (
|
|
|
229
231
|
for (const [propName, propSetting] of Object.entries(relationshipSchema.fieldNames)) {
|
|
230
232
|
if (propSetting.requiredOnCreate === true) {
|
|
231
233
|
if (!relationshipProperties.hasOwnProperty(propName)) {
|
|
232
|
-
errorsFound.push(`Missing requiredOnCreate property: ${
|
|
234
|
+
errorsFound.push(`Missing requiredOnCreate property: ${propName}`);
|
|
233
235
|
}
|
|
234
236
|
}
|
|
235
237
|
|
|
@@ -301,12 +303,35 @@ module.exports.<%- functionName %> = async (
|
|
|
301
303
|
)
|
|
302
304
|
);
|
|
303
305
|
}
|
|
304
|
-
}
|
|
305
306
|
|
|
306
|
-
|
|
307
|
-
if
|
|
308
|
-
|
|
307
|
+
// if have storageResource.storageType === "dynamoDB" will create relationship here
|
|
308
|
+
else if (targetStorageResource.storageType === consts.STORAGE_TYPES.dynamoDB) {
|
|
309
|
+
let tableNameFrom = `${firstObject.objType.serviceTag}_${firstObject.objType.objectType}__${relType.relationshipTag}__${secondObject.objType.serviceTag}_${secondObject.objType.objectType}`;
|
|
310
|
+
let tableNameTo = `${secondObject.objType.serviceTag}_${secondObject.objType.objectType}__${relType.relationshipTag}__${firstObject.objType.serviceTag}_${firstObject.objType.objectType}`;
|
|
311
|
+
|
|
312
|
+
let identifiersConcatFirstObject = await identifiersObject.identifiersConcatFromIdentifiers(_izContext, firstObject.objType, firstObject.identifiers);
|
|
313
|
+
let identifiersConcatSecondObject = await identifiersObject.identifiersConcatFromIdentifiers(_izContext, secondObject.objType, secondObject.identifiers);
|
|
314
|
+
const firstObjectIdentifiersConcat = `${firstObject.objType.serviceTag}_${firstObject.objType.objectType}__identifiersConcat`;
|
|
315
|
+
const secondObjectIdentifiersConcat = `${secondObject.objType.serviceTag}_${secondObject.objType.objectType}__identifiersConcat`;
|
|
316
|
+
// putItem first Object DynamoDb
|
|
317
|
+
await dynamodbSharedLib.putItem(_izContext,
|
|
318
|
+
await dynamodbSharedLib.tableName(_izContext, tableNameFrom),
|
|
319
|
+
{
|
|
320
|
+
[firstObjectIdentifiersConcat]: identifiersConcatFirstObject,
|
|
321
|
+
[secondObjectIdentifiersConcat]: identifiersConcatSecondObject
|
|
322
|
+
}
|
|
323
|
+
)
|
|
309
324
|
|
|
325
|
+
// putitem second Object DynamoDb
|
|
326
|
+
await dynamodbSharedLib.putItem(_izContext,
|
|
327
|
+
await dynamodbSharedLib.tableName(_izContext, tableNameTo),
|
|
328
|
+
{
|
|
329
|
+
[secondObjectIdentifiersConcat]: identifiersConcatSecondObject,
|
|
330
|
+
[firstObjectIdentifiersConcat]: identifiersConcatFirstObject
|
|
331
|
+
}
|
|
332
|
+
)
|
|
333
|
+
}
|
|
334
|
+
}
|
|
310
335
|
|
|
311
336
|
if (awaitingStepIds.length) {
|
|
312
337
|
// save awaiting
|
|
@@ -349,18 +374,41 @@ module.exports.<%- functionName %> = async (
|
|
|
349
374
|
);
|
|
350
375
|
_izContext.logger.debug("messageObject before send message:", createRelMessageBody)
|
|
351
376
|
|
|
352
|
-
let
|
|
377
|
+
let messageToInCreateRelationship = {
|
|
353
378
|
Message: JSON.stringify(createRelMessageBody),
|
|
354
379
|
TopicArn: await snsSharedLib.snsTopicArn(_izContext, TOPIC_NAME_GRAPH_HANDLER.inCreateRel, storageResource.graphServiceTag),
|
|
355
380
|
};
|
|
356
|
-
_izContext.logger.debug("RequestParams before send to sqs messageToInUpdateRelationship ::::::: ",
|
|
357
|
-
await sns.publishAsync(_izContext,
|
|
381
|
+
_izContext.logger.debug("RequestParams before send to sqs messageToInUpdateRelationship ::::::: ", messageToInCreateRelationship);
|
|
382
|
+
await sns.publishAsync(_izContext, messageToInCreateRelationship);
|
|
358
383
|
}
|
|
359
384
|
})
|
|
360
385
|
)
|
|
361
386
|
|
|
362
|
-
} else {
|
|
387
|
+
} else if (!awaitingStepIds.length) {
|
|
388
|
+
_izContext.logger.debug("dynamoDb storageResourceTag")
|
|
363
389
|
// if relationshipSchema stored in dynamoDB only will send message to outComplete
|
|
390
|
+
let messageObject = {
|
|
391
|
+
firstObject: firstObject,
|
|
392
|
+
secondObject: secondObject,
|
|
393
|
+
relType: relType,
|
|
394
|
+
relationshipDirection,
|
|
395
|
+
relationshipProperties
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
if (callingFlowConfig[callingFlowSharedLib.consts.CALLINGFLOW_PROPERTYNAME]) {
|
|
399
|
+
_izContext.logger.debug("have callingFlow");
|
|
400
|
+
messageObject = callingFlowSharedLib.addPassBackPropertiesToSnsResponseMessageObject(callingFlowConfig, messageObject);
|
|
401
|
+
|
|
402
|
+
let messageAttributes = callingFlowSharedLib.addCallingFlowToSnsResponseMessageAttributes(callingFlowConfig, {});
|
|
403
|
+
let sendMessageToOutCreateRelComplete = {
|
|
404
|
+
Message: JSON.stringify(messageObject),
|
|
405
|
+
MessageAttributes: sns.createStringMessageAttributes(_izContext, messageAttributes),
|
|
406
|
+
TopicArn: await snsSharedLib.snsTopicArn(_izContext, TOPIC_NAME_GENERATE_CODE.outCreateRelComplete)
|
|
407
|
+
}
|
|
408
|
+
_izContext.logger.debug("send Message to outCreateRelationshipComplete :::", sendMessageToOutCreateRelComplete);
|
|
409
|
+
await sns.publishAsync(_izContext, sendMessageToOutCreateRelComplete);
|
|
410
|
+
}
|
|
411
|
+
|
|
364
412
|
}
|
|
365
413
|
|
|
366
414
|
return {
|
package/src/reStructure/TemplateData/relationshipPerAction/create/complete/handler/sqs/template.ejs
CHANGED
|
@@ -22,9 +22,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
22
22
|
|
|
23
23
|
const izara = require("@izara_project/izara-middleware");
|
|
24
24
|
const middleware = izara.middlewareHandler;
|
|
25
|
-
const
|
|
26
|
-
const recordHandlerSharedLib =
|
|
27
|
-
const callingFlowSharedLib = izaraShared.callingFlowSharedLib;
|
|
25
|
+
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
26
|
+
const recordHandlerSharedLib = require('@izara_project/izara-core-library-record-handler');
|
|
28
27
|
|
|
29
28
|
const createRelationshipComplete = require('./CreateRelationshipComplete_Main');
|
|
30
29
|
const Logger = require('@izara_project/izara-core-library-logger');
|
package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/template.ejs
CHANGED
|
@@ -18,12 +18,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
18
18
|
'use strict';
|
|
19
19
|
const hash = require("object-hash");
|
|
20
20
|
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const asyncFlowSharedLib =
|
|
26
|
-
const dynamodbSharedLib = izaraShared.dynamodbSharedLib;
|
|
21
|
+
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
22
|
+
const lambdaSharedLib = require("@izara_project/izara-core-library-lambda");
|
|
23
|
+
const snsSharedLib = require("@izara_project/izara-core-library-sns");
|
|
24
|
+
const dynamodbSharedLib = require("@izara_project/izara-core-library-dynamodb");
|
|
25
|
+
const asyncFlowSharedLib = require("@izara_project/izara-core-library-asynchronous-flow");
|
|
27
26
|
|
|
28
27
|
const sns = require("@izara_project/izara-core-library-external-request").sns;
|
|
29
28
|
const NoRetryError = require("@izara_project/izara-core-library-core/src/NoRetryError");
|
package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/api/data.js
CHANGED
|
@@ -33,7 +33,10 @@ const {
|
|
|
33
33
|
awaitingMultipleStepsRole,
|
|
34
34
|
shortNameHandler,
|
|
35
35
|
SHORT_FUNCTION_NAME,
|
|
36
|
-
SOURCE_GENERATE_IAM_ROLE
|
|
36
|
+
SOURCE_GENERATE_IAM_ROLE,
|
|
37
|
+
checkDynamoTypeRelationship,
|
|
38
|
+
createDynamoDbComponentByLinks,
|
|
39
|
+
DYNAMO_RESOURCE
|
|
37
40
|
} = require("../../../../../../../MainLibs/index.js").consts;
|
|
38
41
|
|
|
39
42
|
const templatePath = path.join(__dirname, "./template.ejs")
|
|
@@ -46,17 +49,17 @@ const templatePath = path.join(__dirname, "./template.ejs")
|
|
|
46
49
|
* @return {{ templatePath, templateData, setting } }
|
|
47
50
|
*/
|
|
48
51
|
|
|
49
|
-
function data(_izContext, srcPath) {
|
|
52
|
+
function data(_izContext, allObjectRelationships, srcPath) {
|
|
50
53
|
let createSourceArray = [];
|
|
51
54
|
|
|
52
|
-
const createSourceParam = createParamForCreateSource(srcPath);
|
|
55
|
+
const createSourceParam = createParamForCreateSource(allObjectRelationships, srcPath);
|
|
53
56
|
createSourceArray.push(createSourceParam);
|
|
54
57
|
// console.log("createSourceArrayInUpdaterelationShipSchemahdrSqs", createSourceArray)
|
|
55
58
|
return createSourceArray
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
|
|
59
|
-
function createParamForCreateSource(srcPath) {
|
|
62
|
+
function createParamForCreateSource(allObjectRelationships, srcPath) {
|
|
60
63
|
|
|
61
64
|
let handlerType = HANDLER.hdrApi
|
|
62
65
|
let functionName = FUNCTION_NAME.deleteRel
|
|
@@ -75,6 +78,26 @@ function createParamForCreateSource(srcPath) {
|
|
|
75
78
|
)
|
|
76
79
|
)
|
|
77
80
|
|
|
81
|
+
for (const relationship of allObjectRelationships) {
|
|
82
|
+
let [storageType, relationshipTag, links] = checkDynamoTypeRelationship(relationship)
|
|
83
|
+
if (storageType === STORAGE_TYPES.dynamoDB) {
|
|
84
|
+
for (const link of links) {
|
|
85
|
+
let dynamoComponent = createDynamoDbComponentByLinks(link, relationshipTag)
|
|
86
|
+
additionalResourcePermission.push(
|
|
87
|
+
createIamRole(
|
|
88
|
+
{
|
|
89
|
+
[RESOURCE_CLASSES.dynamoDbTable]: [DYNAMO_RESOURCE.updateItem]
|
|
90
|
+
},
|
|
91
|
+
[
|
|
92
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, upperCase(dynamoComponent.tableNameFrom)),
|
|
93
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, upperCase(dynamoComponent.tableNameTo))
|
|
94
|
+
]
|
|
95
|
+
)
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
78
101
|
return {
|
|
79
102
|
templatePath: templatePath,
|
|
80
103
|
templateData: {
|
package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/dsq/data.js
CHANGED
|
@@ -34,7 +34,10 @@ const {
|
|
|
34
34
|
awaitingMultipleStepsRole,
|
|
35
35
|
shortNameHandler,
|
|
36
36
|
SHORT_FUNCTION_NAME,
|
|
37
|
-
SOURCE_GENERATE_IAM_ROLE
|
|
37
|
+
SOURCE_GENERATE_IAM_ROLE,
|
|
38
|
+
checkDynamoTypeRelationship,
|
|
39
|
+
createDynamoDbComponentByLinks,
|
|
40
|
+
DYNAMO_RESOURCE
|
|
38
41
|
} = require("../../../../../../../MainLibs/index.js").consts;
|
|
39
42
|
|
|
40
43
|
const templatePath = path.join(__dirname, './template.ejs')
|
|
@@ -47,17 +50,17 @@ const templatePath = path.join(__dirname, './template.ejs')
|
|
|
47
50
|
* @return {{ templatePath, templateData, setting } }
|
|
48
51
|
*/
|
|
49
52
|
|
|
50
|
-
function data(_izContext, srcPath) {
|
|
53
|
+
function data(_izContext, allObjectRelationships, srcPath) {
|
|
51
54
|
let createSourceArray = [];
|
|
52
55
|
|
|
53
|
-
const createSourceParam = createParamForCreateSource(srcPath);
|
|
56
|
+
const createSourceParam = createParamForCreateSource(allObjectRelationships, srcPath);
|
|
54
57
|
createSourceArray.push(createSourceParam);
|
|
55
58
|
// console.log("createSourceArrayInUpdaterelationShipSchemahdrSqs", createSourceArray)
|
|
56
59
|
return createSourceArray
|
|
57
60
|
}
|
|
58
61
|
|
|
59
62
|
|
|
60
|
-
function createParamForCreateSource(srcPath) {
|
|
63
|
+
function createParamForCreateSource(allObjectRelationships, srcPath) {
|
|
61
64
|
|
|
62
65
|
let handlerType = HANDLER.hdrDsq
|
|
63
66
|
let functionName = FUNCTION_NAME.deleteRel
|
|
@@ -89,6 +92,25 @@ function createParamForCreateSource(srcPath) {
|
|
|
89
92
|
|
|
90
93
|
additionalResourcePermission.push(awaitingMultipleStepsRole())
|
|
91
94
|
|
|
95
|
+
for (const relationship of allObjectRelationships) {
|
|
96
|
+
let [storageType, relationshipTag, links] = checkDynamoTypeRelationship(relationship)
|
|
97
|
+
if (storageType === STORAGE_TYPES.dynamoDB) {
|
|
98
|
+
for (const link of links) {
|
|
99
|
+
let dynamoComponent = createDynamoDbComponentByLinks(link, relationshipTag)
|
|
100
|
+
additionalResourcePermission.push(
|
|
101
|
+
createIamRole(
|
|
102
|
+
{
|
|
103
|
+
[RESOURCE_CLASSES.dynamoDbTable]: [DYNAMO_RESOURCE.updateItem]
|
|
104
|
+
},
|
|
105
|
+
[
|
|
106
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, upperCase(dynamoComponent.tableNameFrom)),
|
|
107
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, upperCase(dynamoComponent.tableNameTo))
|
|
108
|
+
]
|
|
109
|
+
)
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
92
114
|
return {
|
|
93
115
|
templatePath: templatePath,
|
|
94
116
|
templateData: {
|
package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/inv/data.js
CHANGED
|
@@ -33,7 +33,10 @@ const {
|
|
|
33
33
|
awaitingMultipleStepsRole,
|
|
34
34
|
SHORT_FUNCTION_NAME,
|
|
35
35
|
shortNameHandler,
|
|
36
|
-
SOURCE_GENERATE_IAM_ROLE
|
|
36
|
+
SOURCE_GENERATE_IAM_ROLE,
|
|
37
|
+
checkDynamoTypeRelationship,
|
|
38
|
+
createDynamoDbComponentByLinks,
|
|
39
|
+
DYNAMO_RESOURCE
|
|
37
40
|
} = require("../../../../../../../MainLibs/index.js").consts;
|
|
38
41
|
|
|
39
42
|
const templatePath = path.join(__dirname, './template.ejs')
|
|
@@ -46,17 +49,17 @@ const templatePath = path.join(__dirname, './template.ejs')
|
|
|
46
49
|
* @return {{ templatePath, templateData, setting } }
|
|
47
50
|
*/
|
|
48
51
|
|
|
49
|
-
function data(_izContext, srcPath) {
|
|
52
|
+
function data(_izContext, allObjectRelationships, srcPath) {
|
|
50
53
|
let createSourceArray = [];
|
|
51
54
|
|
|
52
|
-
const createSourceParam = createParamForCreateSource(srcPath);
|
|
55
|
+
const createSourceParam = createParamForCreateSource(allObjectRelationships, srcPath);
|
|
53
56
|
createSourceArray.push(createSourceParam);
|
|
54
57
|
// console.log("createSourceArrayInUpdaterelationShipSchemahdrSqs", createSourceArray)
|
|
55
58
|
return createSourceArray
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
|
|
59
|
-
function createParamForCreateSource(srcPath) {
|
|
62
|
+
function createParamForCreateSource(allObjectRelationships, srcPath) {
|
|
60
63
|
|
|
61
64
|
let handlerType = HANDLER.hdrInv
|
|
62
65
|
let functionName = FUNCTION_NAME.deleteRel
|
|
@@ -73,6 +76,27 @@ function createParamForCreateSource(srcPath) {
|
|
|
73
76
|
]
|
|
74
77
|
)
|
|
75
78
|
)
|
|
79
|
+
|
|
80
|
+
for (const relationship of allObjectRelationships) {
|
|
81
|
+
let [storageType, relationshipTag, links] = checkDynamoTypeRelationship(relationship)
|
|
82
|
+
if (storageType === STORAGE_TYPES.dynamoDB) {
|
|
83
|
+
for (const link of links) {
|
|
84
|
+
let dynamoComponent = createDynamoDbComponentByLinks(link, relationshipTag)
|
|
85
|
+
additionalResourcePermission.push(
|
|
86
|
+
createIamRole(
|
|
87
|
+
{
|
|
88
|
+
[RESOURCE_CLASSES.dynamoDbTable]: [DYNAMO_RESOURCE.updateItem]
|
|
89
|
+
},
|
|
90
|
+
[
|
|
91
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, upperCase(dynamoComponent.tableNameFrom)),
|
|
92
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, upperCase(dynamoComponent.tableNameTo))
|
|
93
|
+
]
|
|
94
|
+
)
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
76
100
|
return {
|
|
77
101
|
templatePath: templatePath,
|
|
78
102
|
templateData: {
|