@izara_project/izara-market-library-service-schemas 1.0.9 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/GenerateCodeLibs/src/Consts.js +12 -12
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +63 -17
- package/src/TemplateManager/src/FindData/mainFunction/template.ejs +0 -7
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/functionYaml/data.js +4 -3
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/functionYaml/template.ejs +1 -1
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/handler/data.js +0 -2
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/mainFunction/template.ejs +17 -14
- package/src/TemplateManager/src/OutPerActionComplete/OutDeleteComplete/functionYaml/data.js +4 -3
- package/src/TemplateManager/src/OutPerActionComplete/OutDeleteComplete/functionYaml/template.ejs +1 -1
- package/src/TemplateManager/src/OutPerActionComplete/OutDeleteComplete/handler/data.js +0 -2
- package/src/TemplateManager/src/OutPerActionComplete/OutDeleteComplete/mainFunction/template.ejs +5 -2
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/functionYaml/data.js +4 -2
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/functionYaml/template.ejs +1 -1
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/handler/data.js +0 -2
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/mainFunction/template.ejs +5 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrApi/data.js +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrDsq/data.js +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrInv/data.js +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrSqs/data.js +3 -3
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrApi/template.ejs +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrDsq/template.ejs +6 -2
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/template.ejs +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrSqs/template.ejs +2 -2
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Create/template.ejs +52 -11
- package/src/TemplateManager/src/ProcessLogical/ProcessLogicalYaml/data.js +2 -2
- package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrDsq/data.js +2 -2
- package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrSqs/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrApi/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrDsq/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrInv/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrSqs/data.js +2 -3
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/mainFunction/data.js +2 -0
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/mainFunction/template.ejs +63 -23
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/perAction/HdrApi/template.ejs +45 -28
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/perAction/HdrDsq/template.ejs +42 -21
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/perAction/HdrInv/template.ejs +41 -22
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/perAction/HdrSqs/template.ejs +42 -21
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationshipComplete/functionYaml/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrApi/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrDsq/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrInv/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrSqs/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/mainFunction/data.js +2 -0
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/mainFunction/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/functionYaml/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRalationshipComplete/functionYaml/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrApi/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrDsq/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrInv/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrSqs/data.js +2 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/mainFunction/data.js +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/mainFunction/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/perAction/HdrDsq/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/perAction/HdrSqs/template.ejs +1 -1
- package/src/TemplateManager/src/ResourceYaml/sns-out/defaultSnsOutForFindDataAndProcessLogical.js +2 -2
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/functionYaml/data.js +2 -2
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/mainFunction/template.ejs +2 -36
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrDsq/data.js +2 -2
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrSqs/data.js +2 -2
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/mainFunction/template.ejs +7 -17
- package/src/TemplateManager/src/externalService/LambdaRole/data.js +7 -6
- package/src/TemplateManager/src/libs/Consts.js +21 -1
- package/src/TemplateManager/src/CreateRelationship/createRelationship/functionYaml/HdrApi/data.js +0 -119
package/package.json
CHANGED
|
@@ -43,18 +43,18 @@ const TOPIC_NAME_GRAPH_HANDLER = {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
const TOPIC_NAME_GENERATE_CODE = {
|
|
46
|
-
updateRelComplete: "
|
|
47
|
-
createRelComplete: "
|
|
48
|
-
deleteRelComplete: "
|
|
49
|
-
outUpdateRelComplete: "
|
|
50
|
-
outCreateRelComplete: "
|
|
51
|
-
outDeleteRelComplete: "
|
|
52
|
-
updateNodeComplete: "
|
|
53
|
-
outUpdateNodeComplete: "
|
|
54
|
-
createNodeComplete: "
|
|
55
|
-
outCreateNodeComplete: "
|
|
56
|
-
deleteNodeComplete: "
|
|
57
|
-
outDeleteNodeComplete: "
|
|
46
|
+
updateRelComplete: "UpdateRelationshipComplete",
|
|
47
|
+
createRelComplete: "CreateRelationshipComplete",
|
|
48
|
+
deleteRelComplete: "DeleteRelationshipComplete",
|
|
49
|
+
outUpdateRelComplete: "OutUpdateRelationshipComplete",
|
|
50
|
+
outCreateRelComplete: "OutCreateRelationshipComplete",
|
|
51
|
+
outDeleteRelComplete: "OutDeleteRelationshipComplete",
|
|
52
|
+
updateNodeComplete: "UpdateNodeComplete",
|
|
53
|
+
outUpdateNodeComplete: "OutUpdateNodeComplete",
|
|
54
|
+
createNodeComplete: "CreateObjectComplete",
|
|
55
|
+
outCreateNodeComplete: "OutCreateObjectComplete",
|
|
56
|
+
deleteNodeComplete: "DeleteNodeComplete",
|
|
57
|
+
outDeleteNodeComplete: "OutDeleteNodeComplete"
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
const GRAPH_HANDLER_SERVICE_NAME = {
|
|
@@ -733,46 +733,92 @@ async function createDataDetailsLib(
|
|
|
733
733
|
for (let [keyFieldName, settingFieldName] of Object.entries(objectSchemas.fieldNames)) {
|
|
734
734
|
// _izContext.logger.debug("Loop fieldNamesObjectSchemas", { keyFieldName });
|
|
735
735
|
|
|
736
|
-
// check
|
|
736
|
+
// check field is identifier
|
|
737
737
|
if (objectSchemas.identifierFieldNames.includes(keyFieldName)) {
|
|
738
|
+
|
|
739
|
+
if (Object.keys(objectSchemas.fieldNames).length == 1) {
|
|
740
|
+
|
|
741
|
+
for (const storageIdentifiers of settingFieldName.storageResourceTags) {
|
|
742
|
+
_izContext.logger.debug("case only 1 fieldNames identifiers in ObjectSchema")
|
|
743
|
+
if (storageResources[storageIdentifiers].storageType === consts.STORAGE_TYPES.dynamoDB) {
|
|
744
|
+
if (createDataDetails.hasOwnProperty(storageIdentifiers)) {
|
|
745
|
+
_izContext.logger.debug("same table")
|
|
746
|
+
createDataDetails[storageIdentifiers].fieldNames.push(keyFieldName);
|
|
747
|
+
} else {
|
|
748
|
+
_izContext.logger.debug("new table")
|
|
749
|
+
Object.assign(createDataDetails, {
|
|
750
|
+
[storageResources[storageIdentifiers]]: {
|
|
751
|
+
storageType: consts.STORAGE_TYPES.dynamoDB,
|
|
752
|
+
tableName: storageResources[storageIdentifiers].tableName,
|
|
753
|
+
fieldNames: [keyFieldName]
|
|
754
|
+
}
|
|
755
|
+
})
|
|
756
|
+
if (storageResources[storageIdentifiers].hasOwnProperty("groupByPartitionKeyField")) {
|
|
757
|
+
Object.assign(createDataDetails[storageIdentifiers], {
|
|
758
|
+
groupByPartitionKeyField: storageResources[storageIdentifiers].groupByPartitionKeyField
|
|
759
|
+
})
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
} else if (storageResources[storageIdentifiers].storageType === consts.STORAGE_TYPES.graph) {
|
|
763
|
+
let getGraphServerTag = await serviceConfig.getGraphServiceTag(
|
|
764
|
+
_izContext,
|
|
765
|
+
storageResources[storageIdentifiers].graphServerTag
|
|
766
|
+
);
|
|
767
|
+
if (getGraphServerTag) {
|
|
768
|
+
if (createDataDetails.hasOwnProperty(getGraphServerTag)) {
|
|
769
|
+
createDataDetails[getGraphServerTag].fieldNames.push(keyFieldName)
|
|
770
|
+
} else {
|
|
771
|
+
Object.assign(createDataDetails, {
|
|
772
|
+
[getGraphServerTag]: {
|
|
773
|
+
storageType: consts.STORAGE_TYPES.graph,
|
|
774
|
+
fieldNames: [keyFieldName]
|
|
775
|
+
}
|
|
776
|
+
})
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
} else {
|
|
782
|
+
continue
|
|
783
|
+
}
|
|
738
784
|
continue
|
|
739
785
|
};
|
|
786
|
+
_izContext.logger.debug("case multiple fieldName");
|
|
740
787
|
// validate storageResourceTags.
|
|
741
788
|
_izContext.logger.debug("storageResourceTags is", settingFieldName.storageResourceTags);
|
|
742
789
|
|
|
743
|
-
for (let
|
|
744
|
-
_izContext.logger.debug("Loop eachStorageResourceTags",
|
|
790
|
+
for (let eachStorageResourceTag of settingFieldName.storageResourceTags) {
|
|
791
|
+
_izContext.logger.debug("Loop eachStorageResourceTags", eachStorageResourceTag);
|
|
745
792
|
|
|
746
|
-
if (!storageResources.hasOwnProperty(
|
|
793
|
+
if (!storageResources.hasOwnProperty(eachStorageResourceTag)) {
|
|
747
794
|
throw new Error("storageResources is'n exist"); // should be validata in step uplode in s3
|
|
748
795
|
} else {
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
createDataDetails[eachStorageResourceTags].fieldNames.push(keyFieldName);
|
|
796
|
+
if (storageResources[eachStorageResourceTag].storageType == consts.STORAGE_TYPES.dynamoDB) {
|
|
797
|
+
if (createDataDetails.hasOwnProperty(eachStorageResourceTag)) {
|
|
798
|
+
_izContext.logger.debug("SAME STG DB", eachStorageResourceTag);
|
|
799
|
+
createDataDetails[eachStorageResourceTag].fieldNames.push(keyFieldName);
|
|
754
800
|
|
|
755
801
|
} else {
|
|
756
|
-
_izContext.logger.debug("NEW STG DB",
|
|
802
|
+
_izContext.logger.debug("NEW STG DB", eachStorageResourceTag);
|
|
757
803
|
Object.assign(createDataDetails, {
|
|
758
|
-
[
|
|
804
|
+
[eachStorageResourceTag]: {
|
|
759
805
|
storageType: consts.STORAGE_TYPES.dynamoDB,
|
|
760
|
-
tableName: storageResources[
|
|
806
|
+
tableName: storageResources[eachStorageResourceTag].tableName,
|
|
761
807
|
fieldNames: [keyFieldName]
|
|
762
808
|
}
|
|
763
809
|
});
|
|
764
810
|
|
|
765
|
-
if (storageResources[
|
|
766
|
-
Object.assign(createDataDetails[
|
|
767
|
-
groupByPartitionKeyField: storageResources[
|
|
811
|
+
if (storageResources[eachStorageResourceTag].hasOwnProperty("groupByPartitionKeyField")) {
|
|
812
|
+
Object.assign(createDataDetails[eachStorageResourceTag], {
|
|
813
|
+
groupByPartitionKeyField: storageResources[eachStorageResourceTag].groupByPartitionKeyField
|
|
768
814
|
});
|
|
769
815
|
}
|
|
770
816
|
}
|
|
771
817
|
|
|
772
|
-
} else if (storageResources[
|
|
818
|
+
} else if (storageResources[eachStorageResourceTag].storageType == consts.STORAGE_TYPES.graph) {
|
|
773
819
|
let checkGraphServerTags = await serviceConfig.getGraphServiceTag(
|
|
774
820
|
_izContext,
|
|
775
|
-
storageResources[
|
|
821
|
+
storageResources[eachStorageResourceTag].graphServerTag
|
|
776
822
|
);
|
|
777
823
|
if (checkGraphServerTags) {
|
|
778
824
|
if (createDataDetails.hasOwnProperty(checkGraphServerTags)) {
|
|
@@ -87,13 +87,6 @@ exports.findData = async (
|
|
|
87
87
|
return; // stop process
|
|
88
88
|
};
|
|
89
89
|
|
|
90
|
-
let identifiersObject = await identifierObj.concatIdentifiersObjectFromIdentifiersObject(
|
|
91
|
-
_izContext,
|
|
92
|
-
objType,
|
|
93
|
-
identifiers
|
|
94
|
-
);
|
|
95
|
-
_izContext.logger.debug("create identifiersObject from identifiers: ", identifiersObject) // object
|
|
96
|
-
|
|
97
90
|
let errorsFound = [];
|
|
98
91
|
|
|
99
92
|
let standardErrorParams = [
|
|
@@ -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
|
const { getGraphServiceNameFromGraphServerTagWithCache, getServiceNameWithCache } = require('@izara_project/izara-core-library-service-schemas/src/ServiceConfig')
|
|
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, SOURCE_PATH, externalResourceName, getGraphServiceNameFromAllRelSchema, FUNCTION_NAME, SAVE_FILE_NAME, getGraphServiceNameFromObjectSchema, defaultIamRolePerAction, SQS_RESOURCE, SNS_RESOURCE, DYNAMO_RESOURCE, awaitingMultipleStepsRole } = require("../../../libs/Consts");
|
|
25
|
+
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SOURCE_PATH, externalResourceName, getGraphServiceNameFromAllRelSchema, FUNCTION_NAME, SAVE_FILE_NAME, getGraphServiceNameFromObjectSchema, defaultIamRolePerAction, SQS_RESOURCE, SNS_RESOURCE, DYNAMO_RESOURCE, awaitingMultipleStepsRole, SHORT_FUNCTION_NAME } = require("../../../libs/Consts");
|
|
26
26
|
|
|
27
27
|
const templatePath = path.join(__dirname, './template.ejs');
|
|
28
28
|
|
|
@@ -33,8 +33,8 @@ function data(_izContext, srcPath) {
|
|
|
33
33
|
function createFunctionYamlOutUpdateComplete(_izContext, srcPath) {
|
|
34
34
|
let functionName = upperCase(FUNCTION_NAME.createObjectComplete)
|
|
35
35
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
36
|
-
let awaitingTables = ["AwaitingMultipleSteps", "AwaitingMultipleStepByPending"]
|
|
37
36
|
let handlerType = upperCase(HANDLER.hdrSqs)
|
|
37
|
+
let functionNameConfig = upperCase(SHORT_FUNCTION_NAME.createObjectComplete)
|
|
38
38
|
|
|
39
39
|
additionalResourcePermission.push(
|
|
40
40
|
createIamRole(
|
|
@@ -70,7 +70,8 @@ function createFunctionYamlOutUpdateComplete(_izContext, srcPath) {
|
|
|
70
70
|
functionName,
|
|
71
71
|
handlerType,
|
|
72
72
|
additionalResourcePermission,
|
|
73
|
-
resourceLocation: SOURCE_PATH.resourceLocationOutPerActionComplete
|
|
73
|
+
resourceLocation: SOURCE_PATH.resourceLocationOutPerActionComplete,
|
|
74
|
+
functionNameConfig
|
|
74
75
|
},
|
|
75
76
|
setting: {
|
|
76
77
|
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/functionYaml/template.ejs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<%_ const join = require('path').join; _%>
|
|
2
|
-
<%- firstLetterUpperCase(
|
|
2
|
+
<%- firstLetterUpperCase(functionNameConfig) %>:
|
|
3
3
|
handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`)%>
|
|
4
4
|
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %>
|
|
5
5
|
events:
|
|
@@ -39,7 +39,6 @@ function data(_izContext, srcPath) {
|
|
|
39
39
|
|
|
40
40
|
function createParamForCreateSource(srcPath) {
|
|
41
41
|
const functionName = FUNCTION_NAME.createObjectComplete;
|
|
42
|
-
let functionNameConfig = upperCase(functionName)
|
|
43
42
|
|
|
44
43
|
return {
|
|
45
44
|
templatePath: templatePath,
|
|
@@ -47,7 +46,6 @@ function createParamForCreateSource(srcPath) {
|
|
|
47
46
|
functionName,
|
|
48
47
|
queueName: upperCase(functionName),
|
|
49
48
|
functionName,
|
|
50
|
-
functionNameConfig
|
|
51
49
|
},
|
|
52
50
|
setting: {
|
|
53
51
|
savePath: path.join(srcPath, SOURCE_PATH.outPerActionComplete),
|
package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/mainFunction/template.ejs
CHANGED
|
@@ -62,45 +62,43 @@ module.exports.createObjectComplete = async (
|
|
|
62
62
|
passBackProperties,
|
|
63
63
|
});
|
|
64
64
|
|
|
65
|
-
let errorFounds = [];
|
|
66
|
-
|
|
67
65
|
if (_.isEmpty(returnValue)) {
|
|
68
66
|
_izContext.logger.debug("message callingFlowProperties is empty");
|
|
69
67
|
throw new NoRetryError("message not an object")
|
|
70
68
|
};
|
|
71
69
|
// validate.
|
|
72
70
|
if (!returnValue.hasOwnProperty("queryResult")) {
|
|
73
|
-
|
|
71
|
+
errorsFound.push("message is not have property queryResult, should be not happen");
|
|
74
72
|
};
|
|
75
73
|
if (!returnValue.hasOwnProperty("objType")) {
|
|
76
|
-
|
|
74
|
+
errorsFound.push("message is not have property objType, should be not happen");
|
|
77
75
|
};
|
|
78
76
|
if (!returnValue.hasOwnProperty("objInstanceFull")) {
|
|
79
|
-
|
|
77
|
+
errorsFound.push("message is not have property objInstance, should be not objInstance");
|
|
80
78
|
};
|
|
81
79
|
|
|
82
80
|
if (status == "error" && errorsFound.length > 0) {
|
|
83
|
-
|
|
81
|
+
errorsFound.push(errorsFound);
|
|
84
82
|
} else if (status == "error" && errorsFound.length == 0) {
|
|
85
|
-
|
|
83
|
+
errorsFound.push("[invalid]statur is error not have errorfound form graphService");
|
|
86
84
|
|
|
87
85
|
};
|
|
88
86
|
if (status === "complete" && errorsFound.length > 0) {
|
|
89
|
-
|
|
87
|
+
errorsFound.push("[Invalid] status is commplete should be not have errorsFound");
|
|
90
88
|
};
|
|
91
89
|
if (graphServiceTag == null) {
|
|
92
|
-
|
|
90
|
+
errorsFound.push("[Invalid] graphServerTag is not empty string");
|
|
93
91
|
};
|
|
94
92
|
|
|
95
93
|
if (errorsFound.length > 0) {
|
|
96
94
|
_izContext.logger.debug("Have error form grapService:", errorsFound);
|
|
97
|
-
|
|
95
|
+
errorsFound = errorsFound.concat(errorsFound);
|
|
98
96
|
};
|
|
99
97
|
|
|
100
|
-
let awaitingStepId = await asyncFlowSharedLib.createAwaitingStepId(
|
|
101
|
-
{
|
|
98
|
+
let awaitingStepId = await asyncFlowSharedLib.createAwaitingStepId(
|
|
99
|
+
(hash({
|
|
102
100
|
objType: returnValue.objType,
|
|
103
|
-
|
|
101
|
+
graphServerTag: graphServiceTag,
|
|
104
102
|
identifiers: returnValue.objInstanceFull.identifiers
|
|
105
103
|
})),
|
|
106
104
|
PREFIX.CREATE_OBJECT_ASYNC
|
|
@@ -146,7 +144,7 @@ module.exports.createObjectComplete = async (
|
|
|
146
144
|
let messageObject = {
|
|
147
145
|
objType: returnValue.objType,
|
|
148
146
|
objInstanceFull: returnValue.objInstanceFull,
|
|
149
|
-
|
|
147
|
+
errorsFound: errorsFound
|
|
150
148
|
};
|
|
151
149
|
|
|
152
150
|
messageObject = callingFlowSharedLib.addParentPassBackPropertiesToSnsResponseMessageObject(passBackProperties, messageObject)
|
|
@@ -160,6 +158,11 @@ module.exports.createObjectComplete = async (
|
|
|
160
158
|
_izContext.logger.debug("Send message to OutCreateObjectComplete :::>", sendMessageOutCreateObjectComplete)
|
|
161
159
|
await sns.publishAsync(_izContext, sendMessageOutCreateObjectComplete);
|
|
162
160
|
|
|
161
|
+
return {
|
|
162
|
+
returnValue: returnValue,
|
|
163
|
+
status: status,
|
|
164
|
+
errorsFound: errorsFound
|
|
165
|
+
}
|
|
163
166
|
|
|
164
167
|
} catch (err) {
|
|
165
168
|
throw (err)
|
|
@@ -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
|
const { getGraphServiceNameFromGraphServerTagWithCache, getServiceNameWithCache } = require('@izara_project/izara-core-library-service-schemas/src/ServiceConfig')
|
|
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, SOURCE_PATH, externalResourceName, getGraphServiceNameFromAllRelSchema, FUNCTION_NAME, SAVE_FILE_NAME, getGraphServiceNameFromObjectSchema, defaultIamRolePerAction, SQS_RESOURCE, SNS_RESOURCE, DYNAMO_RESOURCE } = require("../../../libs/Consts");
|
|
25
|
+
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SOURCE_PATH, externalResourceName, getGraphServiceNameFromAllRelSchema, FUNCTION_NAME, SAVE_FILE_NAME, getGraphServiceNameFromObjectSchema, defaultIamRolePerAction, SQS_RESOURCE, SNS_RESOURCE, DYNAMO_RESOURCE, SHORT_FUNCTION_NAME } = require("../../../libs/Consts");
|
|
26
26
|
|
|
27
27
|
const templatePath = path.join(__dirname, './template.ejs');
|
|
28
28
|
|
|
@@ -32,8 +32,8 @@ function data(_izContext, srcPath) {
|
|
|
32
32
|
|
|
33
33
|
function createFunctionYamlOutUpdateComplete(_izContext, srcPath) {
|
|
34
34
|
let functionName = upperCase(FUNCTION_NAME.deleteNodeComplete)
|
|
35
|
+
let functionNameConfig = upperCase(SHORT_FUNCTION_NAME.deleteNodeComplete)
|
|
35
36
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
36
|
-
let awaitingTables = ["AwaitingMultipleSteps", "AwaitingMultipleStepByPending"]
|
|
37
37
|
let handlerType = upperCase(HANDLER.hdrSqs)
|
|
38
38
|
|
|
39
39
|
additionalResourcePermission.push(
|
|
@@ -67,7 +67,8 @@ function createFunctionYamlOutUpdateComplete(_izContext, srcPath) {
|
|
|
67
67
|
functionName,
|
|
68
68
|
handlerType,
|
|
69
69
|
additionalResourcePermission,
|
|
70
|
-
resourceLocation: SOURCE_PATH.resourceLocationOutPerActionComplete
|
|
70
|
+
resourceLocation: SOURCE_PATH.resourceLocationOutPerActionComplete,
|
|
71
|
+
functionNameConfig
|
|
71
72
|
},
|
|
72
73
|
setting: {
|
|
73
74
|
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
package/src/TemplateManager/src/OutPerActionComplete/OutDeleteComplete/functionYaml/template.ejs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<%_ const join = require('path').join; _%>
|
|
2
|
-
<%- firstLetterUpperCase(
|
|
2
|
+
<%- firstLetterUpperCase(functionNameConfig) %>:
|
|
3
3
|
handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`)%>
|
|
4
4
|
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %>
|
|
5
5
|
events:
|
|
@@ -39,7 +39,6 @@ function data(_izContext, srcPath) {
|
|
|
39
39
|
|
|
40
40
|
function createParamForCreateSource(srcPath) {
|
|
41
41
|
const functionName = FUNCTION_NAME.deleteNodeComplete;
|
|
42
|
-
let functionNameConfig = upperCase(functionName)
|
|
43
42
|
|
|
44
43
|
return {
|
|
45
44
|
templatePath: templatePath,
|
|
@@ -47,7 +46,6 @@ function createParamForCreateSource(srcPath) {
|
|
|
47
46
|
functionName,
|
|
48
47
|
queueName: upperCase(functionName),
|
|
49
48
|
functionName,
|
|
50
|
-
functionNameConfig
|
|
51
49
|
},
|
|
52
50
|
setting: {
|
|
53
51
|
savePath: path.join(srcPath, SOURCE_PATH.outPerActionComplete),
|
package/src/TemplateManager/src/OutPerActionComplete/OutDeleteComplete/mainFunction/template.ejs
CHANGED
|
@@ -79,8 +79,11 @@ module.exports.deleteNodeComplete = async (
|
|
|
79
79
|
_izContext.logger.debug("Send Message to DeleteNodeComplete::", sendMessageToOutUpdateNodeComplete);
|
|
80
80
|
await sns.publishAsync(_izContext, sendMessageToOutUpdateNodeComplete)
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
return {
|
|
83
|
+
objType: returnValue.objType,
|
|
84
|
+
objInstanceFull: returnValue.objInstanceFull,
|
|
85
|
+
errorsFound: errorsFound
|
|
86
|
+
}
|
|
84
87
|
|
|
85
88
|
}
|
|
86
89
|
catch (err) {
|
|
@@ -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
|
const { getGraphServiceNameFromGraphServerTagWithCache, getServiceNameWithCache } = require('@izara_project/izara-core-library-service-schemas/src/ServiceConfig')
|
|
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, SOURCE_PATH, externalResourceName, getGraphServiceNameFromAllRelSchema, FUNCTION_NAME, SAVE_FILE_NAME, getGraphServiceNameFromObjectSchema, defaultIamRolePerAction, SQS_RESOURCE, SNS_RESOURCE, DYNAMO_RESOURCE, awaitingMultipleStepsRole } = require("../../../libs/Consts");
|
|
25
|
+
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SOURCE_PATH, externalResourceName, getGraphServiceNameFromAllRelSchema, FUNCTION_NAME, SAVE_FILE_NAME, getGraphServiceNameFromObjectSchema, defaultIamRolePerAction, SQS_RESOURCE, SNS_RESOURCE, DYNAMO_RESOURCE, awaitingMultipleStepsRole, SHORT_FUNCTION_NAME } = require("../../../libs/Consts");
|
|
26
26
|
|
|
27
27
|
const templatePath = path.join(__dirname, './template.ejs');
|
|
28
28
|
|
|
@@ -32,6 +32,7 @@ function data(_izContext, srcPath) {
|
|
|
32
32
|
|
|
33
33
|
function createFunctionYamlOutUpdateComplete(_izContext, srcPath) {
|
|
34
34
|
let functionName = upperCase(FUNCTION_NAME.updateNodeComplete)
|
|
35
|
+
let functionNameConfig = upperCase(SHORT_FUNCTION_NAME.updateNodeComplete)
|
|
35
36
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
36
37
|
let handlerType = upperCase(HANDLER.hdrSqs)
|
|
37
38
|
|
|
@@ -69,7 +70,8 @@ function createFunctionYamlOutUpdateComplete(_izContext, srcPath) {
|
|
|
69
70
|
functionName,
|
|
70
71
|
handlerType,
|
|
71
72
|
additionalResourcePermission,
|
|
72
|
-
resourceLocation: SOURCE_PATH.resourceLocationOutPerActionComplete
|
|
73
|
+
resourceLocation: SOURCE_PATH.resourceLocationOutPerActionComplete,
|
|
74
|
+
functionNameConfig
|
|
73
75
|
},
|
|
74
76
|
setting: {
|
|
75
77
|
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/functionYaml/template.ejs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<%_ const join = require('path').join; _%>
|
|
2
|
-
<%- firstLetterUpperCase(
|
|
2
|
+
<%- firstLetterUpperCase(functionNameConfig) %>:
|
|
3
3
|
handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`)%>
|
|
4
4
|
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %>
|
|
5
5
|
events:
|
|
@@ -39,7 +39,6 @@ function data(_izContext, srcPath) {
|
|
|
39
39
|
|
|
40
40
|
function createParamForCreateSource(srcPath) {
|
|
41
41
|
const functionName = FUNCTION_NAME.updateNodeComplete;
|
|
42
|
-
let functionNameConfig = upperCase(functionName)
|
|
43
42
|
|
|
44
43
|
return {
|
|
45
44
|
templatePath: templatePath,
|
|
@@ -47,7 +46,6 @@ function createParamForCreateSource(srcPath) {
|
|
|
47
46
|
functionName,
|
|
48
47
|
queueName: upperCase(functionName),
|
|
49
48
|
functionName,
|
|
50
|
-
functionNameConfig
|
|
51
49
|
},
|
|
52
50
|
setting: {
|
|
53
51
|
savePath: path.join(srcPath, SOURCE_PATH.outPerActionComplete),
|
package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/mainFunction/template.ejs
CHANGED
|
@@ -117,7 +117,11 @@ module.exports.updateNodeComplete = async (
|
|
|
117
117
|
})
|
|
118
118
|
)
|
|
119
119
|
|
|
120
|
-
return {
|
|
120
|
+
return {
|
|
121
|
+
objType: returnValue.objType,
|
|
122
|
+
objInstanceFull: returnValue.objInstanceFull,
|
|
123
|
+
errorsFound: errorsFound
|
|
124
|
+
}
|
|
121
125
|
|
|
122
126
|
} catch (err) {
|
|
123
127
|
_izContext.logger.error("error UpdateNodeComplete : ", err)
|
|
@@ -61,7 +61,7 @@ function data(_izContext, objectSchema, srcPath) {
|
|
|
61
61
|
|
|
62
62
|
function createParamForCreateSource(objectSchema, action, srcPath) {
|
|
63
63
|
let objectType = objectSchema.objectType
|
|
64
|
-
let functionName = objectType + upperCase(action);
|
|
64
|
+
let functionName = upperCase(objectType) + upperCase(action);
|
|
65
65
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
66
66
|
let tableForGetItem = [];
|
|
67
67
|
let hasGraphStorage = false;
|
|
@@ -62,7 +62,7 @@ function data(_izContext, objectSchema, srcPath) {
|
|
|
62
62
|
|
|
63
63
|
function createParamForCreateSource(objectSchema, action, srcPath) {
|
|
64
64
|
let objectType = objectSchema.objectType;
|
|
65
|
-
let functionName = objectType + upperCase(action);
|
|
65
|
+
let functionName = upperCase(objectType) + upperCase(action);
|
|
66
66
|
let functionNameObjectType = objectSchema?.shortNameObjectType ? objectSchema.shortNameObjectType : objectSchema.objectType;
|
|
67
67
|
let functionNameConfig = upperCase(functionNameObjectType) + upperCase(action) + upperCase(shortNameHandler(HANDLER.hdrDsq))
|
|
68
68
|
console.log("functionNameConfigInFunctionYamlHdrDsq", functionNameConfig)
|
|
@@ -64,7 +64,7 @@ function createParamForCreateSource(objectSchema, action, srcPath) {
|
|
|
64
64
|
let functionNameObjectType = objectSchema?.shortNameObjectType ? objectSchema.shortNameObjectType : objectSchema.objectType;
|
|
65
65
|
let objectType = objectSchema.objectType;
|
|
66
66
|
let actionHandler = action;
|
|
67
|
-
let functionName = objectType + upperCase(actionHandler);
|
|
67
|
+
let functionName = upperCase(objectType) + upperCase(actionHandler);
|
|
68
68
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
69
69
|
let tableForGetItem = [];
|
|
70
70
|
|
|
@@ -62,7 +62,7 @@ function data(_izContext, objectSchema, srcPath) {
|
|
|
62
62
|
function createParamForCreateSource(objectSchema, action, srcPath) {
|
|
63
63
|
let objectType = objectSchema.objectType;
|
|
64
64
|
let actionHandler = action;
|
|
65
|
-
let functionName = objectType + upperCase(actionHandler);
|
|
65
|
+
let functionName = upperCase(objectType) + upperCase(actionHandler);
|
|
66
66
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
67
67
|
let tableForGetItem = [];
|
|
68
68
|
let hasGraphStorage = false;
|
|
@@ -108,8 +108,8 @@ function createParamForCreateSource(objectSchema, action, srcPath) {
|
|
|
108
108
|
SQS_RESOURCE.getQueueUrl
|
|
109
109
|
], [RESOURCE_CLASSES.sns]: ["Publish", "Subscribe"]
|
|
110
110
|
}, [
|
|
111
|
-
resourceNames(RESOURCE_CLASSES.sqs, functionName),
|
|
112
|
-
resourceNames(RESOURCE_CLASSES.sqs, functionName + "DLQ"),
|
|
111
|
+
resourceNames(RESOURCE_CLASSES.sqs, functionName + upperCase(HANDLER.hdrSqs)),
|
|
112
|
+
resourceNames(RESOURCE_CLASSES.sqs, functionName + upperCase(HANDLER.hdrSqs) + "DLQ"),
|
|
113
113
|
resourceNames(RESOURCE_CLASSES.sns, "In" + functionName),
|
|
114
114
|
resourceNames(RESOURCE_CLASSES.sns, "Out" + functionName)
|
|
115
115
|
]
|
|
@@ -35,7 +35,7 @@ const {
|
|
|
35
35
|
//validate event params in middleware before into main function
|
|
36
36
|
validateSchemaMiddleware(
|
|
37
37
|
middleware,
|
|
38
|
-
"<%-
|
|
38
|
+
"<%- (objectType) %>",
|
|
39
39
|
"<%- action %>"
|
|
40
40
|
//(<validateSchemaSetting>
|
|
41
41
|
//</validateSchemaSetting>)
|
|
@@ -67,7 +67,7 @@ module.exports.main = middleware.wrap(async (event,context, callback) => {
|
|
|
67
67
|
|
|
68
68
|
await validateSchemaPerRecord(
|
|
69
69
|
record,
|
|
70
|
-
<%- functionName
|
|
70
|
+
"<%- functionName %><%- firstLetterUpperCase(handler) %>",
|
|
71
71
|
"OBJTYPE,
|
|
72
72
|
<%- action %>"
|
|
73
73
|
//(<validateSchemaSetting>)
|
|
@@ -79,7 +79,7 @@ module.exports.main = middleware.wrap(async (event,context, callback) => {
|
|
|
79
79
|
/*
|
|
80
80
|
await recordHandlerSharedLib.validateRecord(
|
|
81
81
|
record,
|
|
82
|
-
<%- functionName
|
|
82
|
+
"<%- functionName %><%- firstLetterUpperCase(handler) %>",
|
|
83
83
|
perRecordsValidatorSchema
|
|
84
84
|
);
|
|
85
85
|
*/
|
|
@@ -118,3 +118,7 @@ module.exports.main = middleware.wrap(async (event,context, callback) => {
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
)
|
|
121
|
+
|
|
122
|
+
<%_ function firstLetterUpperCase(text){
|
|
123
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
124
|
+
} _%>
|
|
@@ -40,7 +40,7 @@ const {
|
|
|
40
40
|
//validate event params in middleware before into function
|
|
41
41
|
validateSchemaMiddleware(
|
|
42
42
|
middleware,
|
|
43
|
-
"<%-
|
|
43
|
+
"<%- (objectType) %>", // objectType
|
|
44
44
|
"<%- action %>", // action
|
|
45
45
|
//(<validateSchemaSetting>)
|
|
46
46
|
//(</validateSchemaSetting>)
|
|
@@ -67,7 +67,7 @@ module.exports.main = middleware.wrap(async (event,context, callback) => {
|
|
|
67
67
|
|
|
68
68
|
await validateSchemaPerRecord(
|
|
69
69
|
record,
|
|
70
|
-
<%- functionName
|
|
70
|
+
"<%- functionName %><%- firstLetterUpperCase(handler) %>",
|
|
71
71
|
OBJTYPE,
|
|
72
72
|
"<%- action %>"
|
|
73
73
|
//(<validateSchemaSetting>)
|
|
@@ -79,7 +79,7 @@ module.exports.main = middleware.wrap(async (event,context, callback) => {
|
|
|
79
79
|
/*
|
|
80
80
|
await recordHandlerSharedLib.validateRecord(
|
|
81
81
|
record,
|
|
82
|
-
<%- functionName
|
|
82
|
+
"<%- functionName %><%- firstLetterUpperCase(handler) %>",
|
|
83
83
|
perRecordsValidatorSchema
|
|
84
84
|
);
|
|
85
85
|
*/
|