@izara_project/izara-market-library-service-schemas 1.0.5 → 1.0.7
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 +2 -2
- package/src/GenerateCodeLibs/index.js +2 -1
- package/src/GenerateCodeLibs/src/Consts.js +12 -3
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +232 -7
- package/src/GenerateCodeLibs/src/TranslateIdsLibs.js +89 -0
- package/src/MainLibs/src/Utils.js +10 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/functionYaml/HdrApi/data.js +10 -2
- package/src/TemplateManager/src/CreateRelationship/createRelationship/functionYaml/HdrDsq/data.js +5 -4
- package/src/TemplateManager/src/CreateRelationship/createRelationship/functionYaml/HdrInv/data.js +11 -1
- package/src/TemplateManager/src/CreateRelationship/createRelationship/functionYaml/HdrSqs/data.js +4 -3
- package/src/TemplateManager/src/CreateRelationship/createRelationship/mainFunction/template.ejs +24 -22
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrDsq/data.js +0 -1
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrSqs/data.js +1 -1
- package/src/TemplateManager/src/CreateRelationship/createRelationship/sns-in-sqs/data.js +0 -2
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/functionYaml/data.js +2 -2
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/handler/HdrSqs/data.js +0 -1
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/sns-out/data.js +1 -1
- package/src/TemplateManager/src/FindData/FindDataYaml/data.js +188 -0
- package/src/TemplateManager/src/FindData/FindDataYaml/template.ejs +27 -0
- package/src/TemplateManager/src/FindData/GetByStorage/getByDynamo.ejs +53 -0
- package/src/TemplateManager/src/FindData/GetByStorage/getByGraph.ejs +99 -0
- package/src/TemplateManager/src/FindData/Handler/data.js +48 -0
- package/src/TemplateManager/src/FindData/Handler/template.ejs +140 -0
- package/src/TemplateManager/src/FindData/mainFunction/data.js +279 -0
- package/src/TemplateManager/src/FindData/mainFunction/template.ejs +158 -0
- package/src/TemplateManager/src/GenerateCode(Old).js +1 -1
- package/src/TemplateManager/src/GenerateCode.js +163 -42
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/functionYaml/data.js +98 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/functionYaml/template.ejs +33 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/handler/data.js +59 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/handler/template.ejs +129 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/mainFunction/createObjectComplete_main.js +172 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/mainFunction/data.js +53 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/mainFunction/template.ejs +172 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/sns-in-sqs/data.js +58 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/sns-in-sqs/template.ejs +47 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/sns-out/data.js +62 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/sns-out/template.ejs +10 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/functionYaml/data.js +98 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/functionYaml/template.ejs +33 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/handler/data.js +59 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/handler/template.ejs +129 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/mainFunction/data.js +53 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/mainFunction/template.ejs +126 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/sns-out/data.js +62 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/sqs-in-sns/data.js +58 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/sqs-in-sns/template.ejs +47 -0
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrApi/data.js +22 -3
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrApi/template.ejs +2 -2
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrDsq/data.js +24 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrInv/data.js +53 -2
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrSqs/data.js +25 -3
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrApi/data.js +5 -8
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrApi/getTemplate.ejs +76 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrApi/updateTemplate.ejs +67 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrDsq/data.js +47 -23
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrDsq/getTemplate.ejs +105 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrDsq/updateTemplate.ejs +109 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/createTemplate.ejs +75 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/data.js +69 -21
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/getTemplate.ejs +82 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/updateTemplate.ejs +75 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrSqs/data.js +46 -17
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrSqs/getTemplate.ejs +124 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrSqs/updateTemplate.ejs +133 -0
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Create/CreateObject_main.js +760 -0
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Create/data.js +67 -0
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Create/request.json +0 -0
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Create/template.ejs +575 -0
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Get/data.js +0 -6
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Get/template.ejs +17 -12
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Update/data.js +61 -0
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Update/request.json +0 -0
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Update/template.ejs +267 -0
- package/src/TemplateManager/src/ProcessLogical/Handler/data.js +49 -0
- package/src/TemplateManager/src/ProcessLogical/Handler/template.ejs +129 -0
- package/src/TemplateManager/src/ProcessLogical/ProcessLogicalYaml/data.js +175 -0
- package/src/TemplateManager/src/ProcessLogical/ProcessLogicalYaml/template.ejs +25 -0
- package/src/TemplateManager/src/ProcessLogical/mainFunction/data.js +47 -0
- package/src/TemplateManager/src/ProcessLogical/mainFunction/template.ejs +429 -0
- package/src/TemplateManager/src/ProcessLogicalPagination/DsqYaml/data.js +50 -0
- package/src/TemplateManager/src/ProcessLogicalPagination/DsqYaml/template.ejs +32 -0
- package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrDsq/data.js +167 -0
- package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrDsq/template.ejs +25 -0
- package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrSqs/data.js +169 -0
- package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrSqs/template.ejs +25 -0
- package/src/TemplateManager/src/ProcessLogicalPagination/Handler/HdrDsq/data.js +48 -0
- package/src/TemplateManager/src/ProcessLogicalPagination/Handler/HdrDsq/template.ejs +163 -0
- package/src/TemplateManager/src/ProcessLogicalPagination/Handler/HdrSqs/data.js +48 -0
- package/src/TemplateManager/src/ProcessLogicalPagination/Handler/HdrSqs/template.ejs +146 -0
- package/src/TemplateManager/src/ProcessLogicalPagination/mainFunction/data.js +48 -0
- package/src/TemplateManager/src/ProcessLogicalPagination/mainFunction/template.ejs +212 -0
- package/src/TemplateManager/src/ResourceYaml/CreateSourceData.js +2 -2
- package/src/TemplateManager/src/ResourceYaml/dynamodb/processLogicalAndFindData.js +2 -2
- package/src/TemplateManager/src/ResourceYaml/sns-in-sqs/defaultSnsInSqsForFindDataAndProcessLogical.js +27 -12
- package/src/TemplateManager/src/ResourceYaml/sns-out/data.js +1 -1
- package/src/TemplateManager/src/ResourceYaml/sns-out/defaultSnsOutForFindDataAndProcessLogical.js +75 -0
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/functionYaml/data.js +95 -0
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/functionYaml/template.ejs +30 -0
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/handler/dataHdrDsq.js +52 -0
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/handler/template.ejs +194 -0
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/mainFunction/data.js +48 -0
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/mainFunction/template.ejs +330 -0
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/sns-out/data.js +47 -0
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/sqs-sns/data.js +58 -0
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/sqs-sns/template.ejs +43 -0
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrDsq/data.js +116 -0
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrSqs/data.js +116 -0
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrDsq/data.js +60 -0
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrDsq/template.ejs +157 -0
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrSqs/data.js +59 -0
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrSqs/template.ejs +175 -0
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/mainFunction/data.js +61 -0
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/mainFunction/template.ejs +155 -0
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/resourceYaml/dynamoDb/data.js +120 -0
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/resourceYaml/sns-sqs/data.js +75 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/functionYaml/data.js +2 -2
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/sns-out/data.js +1 -1
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrApi/data.js +10 -3
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrDsq/data.js +6 -4
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrInv/data.js +11 -1
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrSqs/data.js +7 -5
- package/src/TemplateManager/src/externalService/LambdaRole/data.js +150 -32
- package/src/TemplateManager/src/externalService/LambdaRole/template.ejs +16 -15
- package/src/TemplateManager/src/externalService/SnsTopicSubscriotions/data.js +35 -6
- package/src/TemplateManager/src/externalService/SnsTopicSubscriotions/template.ejs +3 -4
- package/src/TemplateManager/src/libs/Consts.js +122 -11
- package/src/TemplateManager/src/PerActionEndpoint/Handler/testRequest.json +0 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@izara_project/izara-market-library-service-schemas",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Schemas for Izara Market project",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@izara_project/izara-core-library-core": "^1.0.13",
|
|
24
24
|
"@izara_project/izara-core-library-logger": "^1.0.5",
|
|
25
|
-
"@izara_project/izara-core-library-service-schemas": "^1.0.
|
|
25
|
+
"@izara_project/izara-core-library-service-schemas": "^1.0.13",
|
|
26
26
|
"@izara_project/izara-shared": "^1.0.96",
|
|
27
27
|
"ejs": "^3.1.10",
|
|
28
28
|
"js-beautify": "^1.15.1",
|
|
@@ -20,5 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
20
20
|
// contain functions that use with generated code in each services
|
|
21
21
|
console.log("./src/GenerateCodeLibs")
|
|
22
22
|
module.exports = {
|
|
23
|
-
generateCodeLibs: require("./src/GenerateCodeLibs")
|
|
23
|
+
generateCodeLibs: require("./src/GenerateCodeLibs"),
|
|
24
|
+
translateIdsLibs: require('./src/TranslateIdsLibs'),
|
|
24
25
|
}
|
|
@@ -21,21 +21,30 @@ along with this program.If not, see < http://www.gnu.org/licenses/>.
|
|
|
21
21
|
|
|
22
22
|
const PREFIX = {
|
|
23
23
|
updateRel: "updateRelationshipEndpoint",
|
|
24
|
-
createRel: "createRelationshipEndpoint"
|
|
24
|
+
createRel: "createRelationshipEndpoint",
|
|
25
|
+
updateNode: "updateNodeEndpoint"
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
const TOPIC_NAME_GRAPH_HANDLER = {
|
|
28
29
|
inUpdateRel: "InUpdateRelationship",
|
|
29
30
|
inCreateRel: "InCreateRelationshipV2",
|
|
30
31
|
outUpdateRel: "OutUpdateRelationship",
|
|
31
|
-
outCreateRel: "OutCreateRelationship"
|
|
32
|
+
outCreateRel: "OutCreateRelationship",
|
|
33
|
+
inUpdateNode: "InUpdateNode",
|
|
34
|
+
outUpdateNode: "OutUpdateNode",
|
|
35
|
+
inCreateNode: "InCreateNode",
|
|
36
|
+
outCreateNode: "OutCreateNode"
|
|
32
37
|
}
|
|
33
38
|
|
|
34
39
|
const TOPIC_NAME_GENERATE_CODE = {
|
|
35
40
|
updateRelComplete: "UpdateRelationshipComplete",
|
|
36
41
|
createRelComplete: "CreateRelationshipComplete",
|
|
37
42
|
outUpdateRelComplete: "OutUpdateRelationshipComplete",
|
|
38
|
-
outCreateRelComplete: "OutCreateRelationshipComplete"
|
|
43
|
+
outCreateRelComplete: "OutCreateRelationshipComplete",
|
|
44
|
+
updateNodeComplete: "UpdateNodeComplete",
|
|
45
|
+
outUpdateNodeComplete: "OutUpdateNodeComplete",
|
|
46
|
+
createNodeComplete: "CreateNodeComplete",
|
|
47
|
+
outCreateNodeComplete: "OutCreateNodeComplete"
|
|
39
48
|
}
|
|
40
49
|
|
|
41
50
|
|
|
@@ -59,6 +59,7 @@ const schemaFunctionPerAction = {
|
|
|
59
59
|
const explodeDataPerAction = {
|
|
60
60
|
[consts.ACTIONS.create]: explodedReqParams.explodedDataForCreate,
|
|
61
61
|
[consts.ACTIONS.get]: explodedReqParams.explodedDataForIdentifiers,
|
|
62
|
+
[consts.ACTIONS.update]: explodedReqParams.explodedDataForUpdate
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
|
|
@@ -526,16 +527,34 @@ function collectGetData(_izContext, getDataResult, getDataDetail) {
|
|
|
526
527
|
|
|
527
528
|
let collectedData = {};
|
|
528
529
|
|
|
530
|
+
// if (getDataDetail.storageType === consts.STORAGE_TYPES.graph) {
|
|
531
|
+
// // collect return data form main node only form properties
|
|
532
|
+
// if (getDataResult.properties) {
|
|
533
|
+
// for (let [mainFieldName, mainFieldNameValue] of Object.entries(getDataResult.properties)) {
|
|
534
|
+
// if (getDataDetail.fieldNames.includes(mainFieldName)) {
|
|
535
|
+
// Object.assign(collectedData, { [mainFieldName]: mainFieldNameValue });
|
|
536
|
+
// }
|
|
537
|
+
// }
|
|
538
|
+
// }
|
|
529
539
|
if (getDataDetail.storageType === consts.STORAGE_TYPES.graph) {
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
540
|
+
if (getDataResult.objInstance) {
|
|
541
|
+
for (let [identifiersField, identifiersValues] of Object.entries(getDataResult.objInstance)) {
|
|
542
|
+
for (let [mainFieldName, mainFieldNameValue] of Object.entries(identifiersValues)) {
|
|
543
|
+
Object.assign(collectedData, {
|
|
544
|
+
[getDataDetail.graphServiceTag]: {
|
|
545
|
+
objType: {
|
|
546
|
+
|
|
547
|
+
},
|
|
548
|
+
objInstance: {
|
|
549
|
+
[mainFieldName]: mainFieldNameValue
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
})
|
|
535
553
|
}
|
|
536
554
|
}
|
|
537
555
|
}
|
|
538
556
|
|
|
557
|
+
|
|
539
558
|
// collect data from versionedData
|
|
540
559
|
if (getDataDetail.hasOwnProperty("versionedDatas") && Object.keys(getDataDetail.versionedDatas).length) {
|
|
541
560
|
_izContext.logger.debug("getDataDetail has versionedData")
|
|
@@ -566,9 +585,17 @@ function collectGetData(_izContext, getDataResult, getDataDetail) {
|
|
|
566
585
|
|
|
567
586
|
} else if (getDataDetail.storageType === consts.STORAGE_TYPES.dynamoDB) {
|
|
568
587
|
|
|
588
|
+
// for (let [dynamoDbKey, dynamoDbValue] of Object.entries(getDataResult)) {
|
|
589
|
+
// if (getDataDetail.fieldNames.includes(dynamoDbKey)) {
|
|
590
|
+
// Object.assign(collectedData, { [dynamoDbKey]: dynamoDbValue });
|
|
591
|
+
// }
|
|
592
|
+
// }
|
|
593
|
+
|
|
569
594
|
for (let [dynamoDbKey, dynamoDbValue] of Object.entries(getDataResult)) {
|
|
595
|
+
// _izContext.logger.debug("dynamoDbKey::", dynamoDbKey);
|
|
596
|
+
// _izContext.logger.debug("dynamoDbValue::", dynamoDbValue);
|
|
570
597
|
if (getDataDetail.fieldNames.includes(dynamoDbKey)) {
|
|
571
|
-
Object.assign(collectedData, { [dynamoDbKey]: dynamoDbValue });
|
|
598
|
+
Object.assign(collectedData, { [getDataDetail.tableName]: { [dynamoDbKey]: dynamoDbValue } });
|
|
572
599
|
}
|
|
573
600
|
}
|
|
574
601
|
|
|
@@ -630,6 +657,201 @@ function collectGetData(_izContext, getDataResult, getDataDetail) {
|
|
|
630
657
|
// return collectedData
|
|
631
658
|
// }
|
|
632
659
|
|
|
660
|
+
async function createUpdateDataDetail(_izContext, objectSchema) {
|
|
661
|
+
let getGraphDataDetails = {};
|
|
662
|
+
let getDynamoDbDataDetails = {};
|
|
663
|
+
let allUpdateDataDetail = {};
|
|
664
|
+
for (let [storageTag, storageProperties] of Object.entries(objectSchema.storageResources)) {
|
|
665
|
+
let storageFieldNames = [];
|
|
666
|
+
for (let [fieldName, fieldNameProperties] of Object.entries(objectSchema.fieldNames)) {
|
|
667
|
+
if (fieldNameProperties.storageResourceTags.includes(storageTag)) {
|
|
668
|
+
storageFieldNames.push(fieldName)
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
if (storageProperties.storageType === consts.STORAGE_TYPES.graph) {
|
|
672
|
+
let graphStorageTagPerGraphServiceTag = {}
|
|
673
|
+
let useStorageTag = storageTag;
|
|
674
|
+
let graphServiceName = await serviceConfig.getGraphServiceTagWithCache(_izContext, storageProperties.graphServerTag)
|
|
675
|
+
if (!graphStorageTagPerGraphServiceTag.hasOwnProperty(graphServiceName)) {
|
|
676
|
+
graphStorageTagPerGraphServiceTag[graphServiceName] = storageTag;
|
|
677
|
+
_izContext.logger.debug("graphStorageTagPerGraphServiceTag", graphStorageTagPerGraphServiceTag)
|
|
678
|
+
} else {
|
|
679
|
+
_izContext.logger.debug("current storageTag", storageTag)
|
|
680
|
+
_izContext.logger.debug("used storageTag", useStorageTag)
|
|
681
|
+
useStorageTag = graphStorageTagPerGraphServiceTag[graphServiceName]
|
|
682
|
+
}
|
|
683
|
+
if (!getGraphDataDetails.hasOwnProperty(useStorageTag)) {
|
|
684
|
+
getGraphDataDetails[graphServiceName] =
|
|
685
|
+
{
|
|
686
|
+
storageType: storageProperties.storageType,
|
|
687
|
+
fieldNames: storageFieldNames
|
|
688
|
+
}
|
|
689
|
+
} else {
|
|
690
|
+
getGraphDataDetails[graphServiceName].fieldNames = [...new Set(getGraphDataDetails[useStorageTag].fieldNames.concat(storageFieldNames))]
|
|
691
|
+
}
|
|
692
|
+
} else if (storageProperties.storageType === consts.STORAGE_TYPES.dynamoDB) {
|
|
693
|
+
|
|
694
|
+
Object.assign(getDynamoDbDataDetails, {
|
|
695
|
+
[storageTag]: {
|
|
696
|
+
storageType: storageProperties.storageType,
|
|
697
|
+
tableName: storageProperties.tableName,
|
|
698
|
+
fieldNames: storageFieldNames
|
|
699
|
+
}
|
|
700
|
+
})
|
|
701
|
+
|
|
702
|
+
if (storageTag.groupByPartitionKeyField) {
|
|
703
|
+
Object.assign(
|
|
704
|
+
getDynamoDbDataDetails[storageTag],
|
|
705
|
+
{
|
|
706
|
+
groupByPartitionKeyField: storageProperties.groupByPartitionKeyField
|
|
707
|
+
}
|
|
708
|
+
)
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
_izContext.logger.debug("getGraphDataDetails", getGraphDataDetails);
|
|
714
|
+
_izContext.logger.debug("getDynamoDataDetail", getDynamoDbDataDetails);
|
|
715
|
+
_izContext.logger.debug("allUpdateDataDetail", allUpdateDataDetail)
|
|
716
|
+
|
|
717
|
+
Object.assign(allUpdateDataDetail, getDynamoDbDataDetails, getGraphDataDetails)
|
|
718
|
+
|
|
719
|
+
return allUpdateDataDetail
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
async function createDataDetailsLib(
|
|
723
|
+
_izContext,
|
|
724
|
+
objectSchemas
|
|
725
|
+
) {
|
|
726
|
+
_izContext.logger.debug("Lib: createDataDetailsLib:", { objectSchemas: objectSchemas });
|
|
727
|
+
|
|
728
|
+
let createDataDetails = {};
|
|
729
|
+
|
|
730
|
+
let storageResources = objectSchemas.storageResources;
|
|
731
|
+
_izContext.logger.debug("storageResources:", storageResources);
|
|
732
|
+
|
|
733
|
+
for (let [keyFieldName, settingFieldName] of Object.entries(objectSchemas.fieldNames)) {
|
|
734
|
+
// _izContext.logger.debug("Loop fieldNamesObjectSchemas", { keyFieldName });
|
|
735
|
+
|
|
736
|
+
// check fiend is identifier
|
|
737
|
+
if (objectSchemas.identifierFieldNames.includes(keyFieldName)) {
|
|
738
|
+
continue
|
|
739
|
+
};
|
|
740
|
+
// validate storageResourceTags.
|
|
741
|
+
_izContext.logger.debug("storageResourceTags is", settingFieldName.storageResourceTags);
|
|
742
|
+
|
|
743
|
+
for (let eachStorageResourceTags of settingFieldName.storageResourceTags) {
|
|
744
|
+
_izContext.logger.debug("Loop eachStorageResourceTags", eachStorageResourceTags);
|
|
745
|
+
|
|
746
|
+
if (!storageResources.hasOwnProperty(eachStorageResourceTags)) {
|
|
747
|
+
throw new Error("storageResources is'n exist"); // should be validata in step uplode in s3
|
|
748
|
+
} else {
|
|
749
|
+
|
|
750
|
+
if (storageResources[eachStorageResourceTags].storageType == consts.STORAGE_TYPES.dynamoDB) {
|
|
751
|
+
if (createDataDetails.hasOwnProperty(eachStorageResourceTags)) {
|
|
752
|
+
_izContext.logger.debug("SAME STG DB", eachStorageResourceTags);
|
|
753
|
+
createDataDetails[eachStorageResourceTags].fieldNames.push(keyFieldName);
|
|
754
|
+
|
|
755
|
+
} else {
|
|
756
|
+
_izContext.logger.debug("NEW STG DB", eachStorageResourceTags);
|
|
757
|
+
Object.assign(createDataDetails, {
|
|
758
|
+
[eachStorageResourceTags]: {
|
|
759
|
+
storageType: consts.STORAGE_TYPES.dynamoDB,
|
|
760
|
+
tableName: storageResources[eachStorageResourceTags].tableName,
|
|
761
|
+
fieldNames: [keyFieldName]
|
|
762
|
+
}
|
|
763
|
+
});
|
|
764
|
+
|
|
765
|
+
if (storageResources[eachStorageResourceTags].hasOwnProperty("groupByPartitionKeyField")) {
|
|
766
|
+
Object.assign(createDataDetails[eachStorageResourceTags], {
|
|
767
|
+
groupByPartitionKeyField: storageResources[eachStorageResourceTags].groupByPartitionKeyField
|
|
768
|
+
});
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
} else if (storageResources[eachStorageResourceTags].storageType == consts.STORAGE_TYPES.graph) {
|
|
773
|
+
let checkGraphServerTags = await serviceConfigLib.getGraphServiceTag(
|
|
774
|
+
_izContext,
|
|
775
|
+
storageResources[eachStorageResourceTags].graphServerTag
|
|
776
|
+
);
|
|
777
|
+
if (checkGraphServerTags) {
|
|
778
|
+
if (createDataDetails.hasOwnProperty(checkGraphServerTags)) {
|
|
779
|
+
_izContext.logger.debug("SAME STG", checkGraphServerTags);
|
|
780
|
+
createDataDetails[checkGraphServerTags].fieldNames.push(keyFieldName)
|
|
781
|
+
|
|
782
|
+
} else {
|
|
783
|
+
_izContext.logger.debug("NEW STG", checkGraphServerTags);
|
|
784
|
+
Object.assign(createDataDetails, {
|
|
785
|
+
[checkGraphServerTags]: {
|
|
786
|
+
storageType: consts.STORAGE_TYPES.graph,
|
|
787
|
+
fieldNames: [keyFieldName]
|
|
788
|
+
}
|
|
789
|
+
});
|
|
790
|
+
};
|
|
791
|
+
};
|
|
792
|
+
};
|
|
793
|
+
};
|
|
794
|
+
}; // end loop storageResourceTags
|
|
795
|
+
|
|
796
|
+
}; // end loop
|
|
797
|
+
_izContext.logger.debug("_______All createDataDetails_____", createDataDetails);
|
|
798
|
+
return createDataDetails;
|
|
799
|
+
};
|
|
800
|
+
|
|
801
|
+
async function createCreateDataDetailsV2(_izContext, objectSchema) {
|
|
802
|
+
let allCreateDataDetail = {};
|
|
803
|
+
let graphDataDetail = {};
|
|
804
|
+
let dynamoDbDataDetail = {};
|
|
805
|
+
|
|
806
|
+
for (let [storageTag, storageProperties] of Object.entries(objectSchema.storageResources)) {
|
|
807
|
+
let storageFieldNames = [];
|
|
808
|
+
if (consts.STORAGE_TYPES.hasOwnProperty(storageProperties.storageType)) {
|
|
809
|
+
for (let [fieldName, fieldNameProperties] of Object.entries(objectSchema.fieldNames)) {
|
|
810
|
+
if (fieldNameProperties.storageResourceTags.includes(storageTag)) {
|
|
811
|
+
storageFieldNames.push(fieldName);
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
if (storageProperties.storageType === consts.STORAGE_TYPES.graph) {
|
|
815
|
+
let graphStorageTagPerGraphServiceTag = {};
|
|
816
|
+
let useStorageTag = storageTag;
|
|
817
|
+
let graphServiceName = await serviceConfig.getGraphServiceTagWithCache(_izContext, storageProperties.graphServerTag)
|
|
818
|
+
if (!graphStorageTagPerGraphServiceTag.hasOwnProperty(graphServiceName)) {
|
|
819
|
+
graphStorageTagPerGraphServiceTag[graphServiceName] = storageTag;
|
|
820
|
+
} else {
|
|
821
|
+
useStorageTag = graphStorageTagPerGraphServiceTag[graphServiceName]
|
|
822
|
+
}
|
|
823
|
+
if (!graphDataDetail.hasOwnProperty(useStorageTag)) {
|
|
824
|
+
graphDataDetail[graphServiceName] = {
|
|
825
|
+
storageType: storageProperties.storageType,
|
|
826
|
+
fieldNames: storageFieldNames
|
|
827
|
+
}
|
|
828
|
+
} else {
|
|
829
|
+
graphDataDetail[graphServiceName].fieldNames = [new Set(graphDataDetail[useStorageTag].fieldNames.concat(storageFieldNames))]
|
|
830
|
+
}
|
|
831
|
+
} else if (storageProperties.storageType === consts.STORAGE_TYPES.dynamoDB) {
|
|
832
|
+
Object.assign(dynamoDbDataDetail, {
|
|
833
|
+
[storageTag]: {
|
|
834
|
+
storageType: storageProperties.storageType,
|
|
835
|
+
tableName: storageProperties.tableName,
|
|
836
|
+
fieldNames: storageFieldNames
|
|
837
|
+
}
|
|
838
|
+
})
|
|
839
|
+
|
|
840
|
+
if (storageTag.groupByPartitionKeyField) {
|
|
841
|
+
Object.assign(
|
|
842
|
+
dynamoDbDataDetail[storageTag], {
|
|
843
|
+
groupByPartitionKeyField: storageProperties.groupByPartitionKeyField
|
|
844
|
+
}
|
|
845
|
+
)
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
_izContext.logger.debug("storageFieldNames")
|
|
850
|
+
};
|
|
851
|
+
Object.assign(allCreateDataDetail, graphDataDetail, dynamoDbDataDetail)
|
|
852
|
+
_izContext.logger.debug("allCreateDataDetail before return ::", allCreateDataDetail)
|
|
853
|
+
return allCreateDataDetail
|
|
854
|
+
}
|
|
633
855
|
|
|
634
856
|
|
|
635
857
|
module.exports = {
|
|
@@ -643,7 +865,10 @@ module.exports = {
|
|
|
643
865
|
generateDynamoDbIdentifiers,
|
|
644
866
|
generateDynamoDbIdentifiersWithCache,
|
|
645
867
|
dynamoDbIdentifiersByStorageResource,
|
|
646
|
-
collectGetData
|
|
868
|
+
collectGetData,
|
|
869
|
+
createUpdateDataDetail,
|
|
870
|
+
createDataDetailsLib,
|
|
871
|
+
createCreateDataDetailsV2
|
|
647
872
|
}
|
|
648
873
|
|
|
649
874
|
|
|
@@ -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 getObjectSchema = require("@izara_project/izara-core-library-service-schemas/src/GetObjectSchema")
|
|
20
|
+
const identifiersObject = require("@izara_project/izara-core-library-service-schemas/src/IdentifiersObject")
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param {object} fromType
|
|
24
|
+
* @param {string} fromType.objectType
|
|
25
|
+
* @param {string} fromType.serviceTag
|
|
26
|
+
* @param {object} toType
|
|
27
|
+
* @param {string} toType.objectType
|
|
28
|
+
* @param {string} toType.serviceTag
|
|
29
|
+
* @param {object} relType
|
|
30
|
+
* @param {string} relType.relationshipTag
|
|
31
|
+
* @param {string} relType.serviceTag
|
|
32
|
+
* @returns {boolean}
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
async function validateFromTypeToToTypeWithRelType(_izContext, fromType, toType, relType) {
|
|
36
|
+
let validateStatus;
|
|
37
|
+
let relationshipSchema = await getObjectSchema.getRelationshipSchemaWithCache(_izContext, relType);
|
|
38
|
+
let fromObjType = relationshipSchema.links[0].from.objType
|
|
39
|
+
let toObjType = relationshipSchema.links[0].to.objType
|
|
40
|
+
|
|
41
|
+
if (fromObjType.objectType === fromType.objectType &&
|
|
42
|
+
toObjType.objectType === toType.objectType &&
|
|
43
|
+
toObjType.serviceTag === toType.serviceTag) {
|
|
44
|
+
validateStatus = true
|
|
45
|
+
} else {
|
|
46
|
+
validateStatus = false
|
|
47
|
+
}
|
|
48
|
+
return validateStatus
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async function validateObjtypesAndRelType(
|
|
52
|
+
_izContext,
|
|
53
|
+
objTypes,
|
|
54
|
+
relType,
|
|
55
|
+
) {
|
|
56
|
+
_izContext.logger.debug("findRelationshipLink: ", {
|
|
57
|
+
objTypes,
|
|
58
|
+
relType
|
|
59
|
+
})
|
|
60
|
+
let relationshipSchema = await getObjectSchema.getRelationshipSchemaWithCache(_izContext, relType)
|
|
61
|
+
|
|
62
|
+
const { serviceTag: firstServiceTag, objectType: firstObjectType } = objTypes[0]
|
|
63
|
+
const { serviceTag: secondServiceTag, objectType: secondObjectType } = objTypes[1]
|
|
64
|
+
|
|
65
|
+
for (const link of relationshipSchema.links) {
|
|
66
|
+
const { serviceTag: fromServiceTag, objectType: fromObjectType } = link.from.objType;
|
|
67
|
+
const { serviceTag: toServiceTag, objectType: toObjectType } = link.to.objType;
|
|
68
|
+
|
|
69
|
+
if (firstObjectType && secondObjectType) {
|
|
70
|
+
// create direction incoming or outgoing
|
|
71
|
+
if (
|
|
72
|
+
(firstServiceTag === fromServiceTag && firstObjectType === fromObjectType
|
|
73
|
+
&& secondServiceTag === toServiceTag && secondObjectType === toObjectType)
|
|
74
|
+
||
|
|
75
|
+
(secondServiceTag === fromServiceTag && secondObjectType === fromObjectType
|
|
76
|
+
&& firstServiceTag === toServiceTag && firstObjectType === toObjectType)
|
|
77
|
+
) {
|
|
78
|
+
return link
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
module.exports = {
|
|
87
|
+
validateFromTypeToToTypeWithRelType,
|
|
88
|
+
validateObjtypesAndRelType
|
|
89
|
+
}
|
|
@@ -24,4 +24,14 @@ module.exports.firstLetterUpperCase = (text) => {
|
|
|
24
24
|
|
|
25
25
|
module.exports.firstLetterLowerCase = (str) => {
|
|
26
26
|
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
module.exports.checkOverWriteGenerateMainFunction = (objectSchema, action) => {
|
|
30
|
+
let overWriteStatus;
|
|
31
|
+
if (objectSchema.overwriteGenerateMainFunction?.length && objectSchema.overwriteGenerateMainFunction.includes(action)) {
|
|
32
|
+
overWriteStatus = true
|
|
33
|
+
} else {
|
|
34
|
+
overWriteStatus = false
|
|
35
|
+
}
|
|
36
|
+
return overWriteStatus
|
|
27
37
|
}
|
package/src/TemplateManager/src/CreateRelationship/createRelationship/functionYaml/HdrApi/data.js
CHANGED
|
@@ -22,7 +22,7 @@ const fs = require('fs');
|
|
|
22
22
|
const { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
23
23
|
|
|
24
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, SAVE_FILE_NAME, FUNCTION_NAME } = require("../../../../libs/Consts");
|
|
25
|
+
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, SNS_RESOURCE, DYNAMO_RESOURCE } = require("../../../../libs/Consts");
|
|
26
26
|
|
|
27
27
|
const templatePath = path.join(__dirname, "./template.ejs")
|
|
28
28
|
|
|
@@ -82,13 +82,21 @@ function createParamForCreateSource(srcPath) {
|
|
|
82
82
|
|
|
83
83
|
additionalResourcePermission.push(
|
|
84
84
|
createIamRole(
|
|
85
|
-
{ [RESOURCE_CLASSES.dynamoDbTable]: [
|
|
85
|
+
{ [RESOURCE_CLASSES.dynamoDbTable]: [DYNAMO_RESOURCE.putItem] },
|
|
86
86
|
[
|
|
87
87
|
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "AwaitingMultipleSteps"),
|
|
88
88
|
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "AwaitingMultipleStepByPending")
|
|
89
89
|
]
|
|
90
90
|
))
|
|
91
91
|
|
|
92
|
+
additionalResourcePermission.push(
|
|
93
|
+
createIamRole(
|
|
94
|
+
{
|
|
95
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
96
|
+
},
|
|
97
|
+
resourceNames(RESOURCE_CLASSES.sns, "Out" + upperCase(FUNCTION_NAME.createRelComplete))
|
|
98
|
+
)
|
|
99
|
+
)
|
|
92
100
|
|
|
93
101
|
return {
|
|
94
102
|
templatePath: templatePath,
|
package/src/TemplateManager/src/CreateRelationship/createRelationship/functionYaml/HdrDsq/data.js
CHANGED
|
@@ -22,7 +22,7 @@ const fs = require('fs');
|
|
|
22
22
|
const { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
23
23
|
|
|
24
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, SAVE_FILE_NAME, FUNCTION_NAME } = require("../../../../libs/Consts");
|
|
25
|
+
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, SNS_RESOURCE } = require("../../../../libs/Consts");
|
|
26
26
|
|
|
27
27
|
const templatePath = path.join(__dirname, '../../../../PerActionEndpoint/FunctionYaml/HdrDsq/template.ejs')
|
|
28
28
|
|
|
@@ -93,11 +93,13 @@ function createParamForCreateSource(srcPath) {
|
|
|
93
93
|
SQS_RESOURCE.sendMessage,
|
|
94
94
|
SQS_RESOURCE.deleteMessageBatch,
|
|
95
95
|
SQS_RESOURCE.getQueueUrl
|
|
96
|
-
]
|
|
96
|
+
],
|
|
97
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
97
98
|
},
|
|
98
99
|
[
|
|
99
100
|
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq)),
|
|
100
|
-
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq) + "DLQ")
|
|
101
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq) + "DLQ"),
|
|
102
|
+
resourceNames(RESOURCE_CLASSES.sns, "Out" + upperCase(FUNCTION_NAME.createRelComplete))
|
|
101
103
|
]
|
|
102
104
|
)
|
|
103
105
|
)
|
|
@@ -125,7 +127,6 @@ function createParamForCreateSource(srcPath) {
|
|
|
125
127
|
fileExtension: '.yml',
|
|
126
128
|
isAppend: true
|
|
127
129
|
}
|
|
128
|
-
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
132
|
|
package/src/TemplateManager/src/CreateRelationship/createRelationship/functionYaml/HdrInv/data.js
CHANGED
|
@@ -22,7 +22,7 @@ const fs = require('fs');
|
|
|
22
22
|
const { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
23
23
|
|
|
24
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, SAVE_FILE_NAME, FUNCTION_NAME } = require("../../../../libs/Consts");
|
|
25
|
+
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, SNS_RESOURCE } = require("../../../../libs/Consts");
|
|
26
26
|
|
|
27
27
|
const templatePath = path.join(__dirname, '../../../../PerActionEndpoint/FunctionYaml/HdrInv/template.ejs')
|
|
28
28
|
|
|
@@ -88,6 +88,16 @@ function createParamForCreateSource(srcPath) {
|
|
|
88
88
|
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "AwaitingMultipleStepByPending")
|
|
89
89
|
]
|
|
90
90
|
))
|
|
91
|
+
|
|
92
|
+
additionalResourcePermission.push(
|
|
93
|
+
createIamRole({
|
|
94
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
95
|
+
},
|
|
96
|
+
[
|
|
97
|
+
resourceNames(RESOURCE_CLASSES.sns, "Out" + upperCase(FUNCTION_NAME.createRelComplete))
|
|
98
|
+
]
|
|
99
|
+
)
|
|
100
|
+
)
|
|
91
101
|
return {
|
|
92
102
|
templatePath: templatePath,
|
|
93
103
|
templateData: {
|
package/src/TemplateManager/src/CreateRelationship/createRelationship/functionYaml/HdrSqs/data.js
CHANGED
|
@@ -22,7 +22,7 @@ const fs = require('fs');
|
|
|
22
22
|
const { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
23
23
|
|
|
24
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, SAVE_FILE_NAME, FUNCTION_NAME } = require("../../../../libs/Consts");
|
|
25
|
+
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, SNS_RESOURCE } = require("../../../../libs/Consts");
|
|
26
26
|
|
|
27
27
|
const templatePath = path.join(__dirname, '../../../../PerActionEndpoint/FunctionYaml/HdrSqs/template.ejs')
|
|
28
28
|
|
|
@@ -93,13 +93,14 @@ function createParamForCreateSource(srcPath) {
|
|
|
93
93
|
SQS_RESOURCE.getQueueUrl,
|
|
94
94
|
SQS_RESOURCE.deleteMessageBatch
|
|
95
95
|
], [RESOURCE_CLASSES.sns]:
|
|
96
|
-
[
|
|
96
|
+
[SNS_RESOURCE.publish, SNS_RESOURCE.subscription]
|
|
97
97
|
},
|
|
98
98
|
[
|
|
99
99
|
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
|
|
100
100
|
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs) + "DLQ"),
|
|
101
101
|
resourceNames(RESOURCE_CLASSES.sns, "In" + upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
|
|
102
|
-
resourceNames(RESOURCE_CLASSES.sns, "Out" + upperCase(functionName) + upperCase(HANDLER.hdrSqs))
|
|
102
|
+
resourceNames(RESOURCE_CLASSES.sns, "Out" + upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
|
|
103
|
+
resourceNames(RESOURCE_CLASSES.sns, "Out" + upperCase(FUNCTION_NAME.createRelComplete))
|
|
103
104
|
]
|
|
104
105
|
),
|
|
105
106
|
)
|
package/src/TemplateManager/src/CreateRelationship/createRelationship/mainFunction/template.ejs
CHANGED
|
@@ -47,7 +47,9 @@ const {
|
|
|
47
47
|
|
|
48
48
|
const consts = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
49
49
|
const {
|
|
50
|
-
PREFIX,
|
|
50
|
+
PREFIX,
|
|
51
|
+
TOPIC_NAME_GENERATE_CODE,
|
|
52
|
+
TOPIC_NAME_GRAPH_HANDLER
|
|
51
53
|
} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
52
54
|
|
|
53
55
|
/**
|
|
@@ -99,16 +101,17 @@ module.exports.createRelationship = async (
|
|
|
99
101
|
}
|
|
100
102
|
|
|
101
103
|
for (const schemaIdentifier of objectSchema.identifiers) {
|
|
102
|
-
let
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
104
|
+
let identifierNames = schemaIdentifier.fieldNames || [schemaIdentifier.fieldName];
|
|
105
|
+
for (const identifierName of identifierNames) {
|
|
106
|
+
if (!identifiersObject.hasOwnProperty(identifierName)) {
|
|
107
|
+
errorsFound.push(`validateIdentifiers, ${objTypeString} property:${identifierName} not exists`);
|
|
108
|
+
} else {
|
|
109
|
+
if (
|
|
110
|
+
typeof (identifiersObject[identifierName]) !== "string" &&
|
|
111
|
+
typeof (identifiersObject[identifierName]) !== "number"
|
|
112
|
+
) {
|
|
113
|
+
errorsFound.push(`validateIdentifiers, ${objTypeString} property:${identifierName} should be string or number`);
|
|
114
|
+
}
|
|
112
115
|
}
|
|
113
116
|
}
|
|
114
117
|
}
|
|
@@ -142,13 +145,12 @@ module.exports.createRelationship = async (
|
|
|
142
145
|
// find exists link
|
|
143
146
|
if (
|
|
144
147
|
(
|
|
145
|
-
(firstServiceTag === fromServiceTag && firstObjectType === fromObjectType)
|
|
146
|
-
|
|
147
|
-
)
|
|
148
|
-
||
|
|
148
|
+
(firstServiceTag === fromServiceTag && firstObjectType === fromObjectType) &&
|
|
149
|
+
(secondServiceTag === toServiceTag && secondObjectType === toObjectType)
|
|
150
|
+
) ||
|
|
149
151
|
(
|
|
150
|
-
(firstServiceTag === toServiceTag && firstObjectType === toObjectType)
|
|
151
|
-
|
|
152
|
+
(firstServiceTag === toServiceTag && firstObjectType === toObjectType) &&
|
|
153
|
+
(secondServiceTag === fromServiceTag && secondObjectType === fromObjectType)
|
|
152
154
|
)
|
|
153
155
|
) {
|
|
154
156
|
|
|
@@ -244,13 +246,13 @@ module.exports.createRelationship = async (
|
|
|
244
246
|
// before create awaitingStepId per graph storageResource
|
|
245
247
|
const linkTypeId = createLinkTypeId(_izContext, [objects[0].objType, objects[1].objType], relType);
|
|
246
248
|
|
|
247
|
-
let usedGraphServiceTag = [];
|
|
248
|
-
let targetGraphStorageResources = [];
|
|
249
|
+
let usedGraphServiceTag = []; // collect used graph serviceTag, use to check duplicate graph serviceTag across graph serverTag
|
|
250
|
+
let targetGraphStorageResources = []; // collect used graph storageResources, filtered duplicate graphServiceTag from graphServerTag out
|
|
249
251
|
let awaitingStepIds = [];
|
|
250
252
|
|
|
251
253
|
for (const targetStorageResource of targetStorageResources) {
|
|
252
|
-
if (targetStorageResource.storageType === consts.STORAGE_TYPES.graph
|
|
253
|
-
|
|
254
|
+
if (targetStorageResource.storageType === consts.STORAGE_TYPES.graph &&
|
|
255
|
+
!usedGraphServiceTag.includes(targetStorageResource.graphServiceTag)
|
|
254
256
|
) {
|
|
255
257
|
usedGraphServiceTag.push(targetStorageResource.graphServiceTag);
|
|
256
258
|
targetGraphStorageResources.push(targetStorageResource);
|
|
@@ -299,7 +301,7 @@ module.exports.createRelationship = async (
|
|
|
299
301
|
updateRelMessageBody,
|
|
300
302
|
callingFlowSharedLib.addParentCallingFlowConfig(
|
|
301
303
|
callingFlowConfig, // receive parent callingFlowConfig.
|
|
302
|
-
callingFlowSharedLib.createCallingFlowConfig(
|
|
304
|
+
callingFlowSharedLib.createCallingFlowConfig( // callinfflow own service
|
|
303
305
|
await lambdaSharedLib.lambdaFunctionName(_izContext, TOPIC_NAME_GENERATE_CODE.createRelComplete),
|
|
304
306
|
{
|
|
305
307
|
graphServiceTag: storageResource.graphServiceTag
|
package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrDsq/data.js
CHANGED
|
@@ -27,7 +27,6 @@ const { DEFAULT_HANDLER_PER_ACTION, SOURCE_PATH, FUNCTION_NAME } = require("../.
|
|
|
27
27
|
const templatePath = path.join(__dirname, "./template.ejs")
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* receive objectSchema
|
|
31
30
|
* create data for hdrInv template
|
|
32
31
|
*
|
|
33
32
|
* @return {{ templatePath, templateData, setting } }
|