@izara_project/izara-market-library-service-schemas 1.0.8 → 1.0.10
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/src/GenerateCodeLibs.js +64 -19
- package/src/MainLibs/src/Utils.js +13 -0
- package/src/TemplateManager/src/FindData/FindDataYaml/data.js +3 -2
- package/src/TemplateManager/src/FindData/FindDataYaml/template.ejs +1 -1
- package/src/TemplateManager/src/FindData/Handler/data.js +1 -6
- package/src/TemplateManager/src/FindData/mainFunction/template.ejs +0 -7
- package/src/TemplateManager/src/GenerateCode.js +3 -5
- 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 +1 -3
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/handler/template.ejs +11 -11
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/mainFunction/data.js +1 -1
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/mainFunction/template.ejs +13 -13
- 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 +1 -3
- package/src/TemplateManager/src/OutPerActionComplete/OutDeleteComplete/mainFunction/data.js +1 -1
- package/src/TemplateManager/src/OutPerActionComplete/OutDeleteComplete/mainFunction/template.ejs +8 -5
- 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 +1 -3
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/mainFunction/data.js +1 -1
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/mainFunction/template.ejs +5 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrApi/data.js +13 -7
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrApi/template.ejs +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrDsq/data.js +12 -8
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrDsq/template.ejs +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrInv/data.js +10 -12
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrInv/template.ejs +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrSqs/data.js +13 -8
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrSqs/template.ejs +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrApi/data.js +0 -2
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrDsq/data.js +1 -2
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrDsq/template.ejs +78 -62
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/data.js +0 -2
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/template.ejs +1 -2
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrSqs/data.js +2 -3
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrSqs/template.ejs +62 -53
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Create/template.ejs +47 -8
- package/src/TemplateManager/src/ProcessLogical/Handler/data.js +0 -1
- package/src/TemplateManager/src/ProcessLogical/ProcessLogicalYaml/data.js +3 -2
- package/src/TemplateManager/src/ProcessLogical/ProcessLogicalYaml/template.ejs +1 -1
- package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrDsq/data.js +3 -2
- package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrDsq/template.ejs +1 -1
- package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrSqs/data.js +3 -2
- package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrSqs/template.ejs +1 -1
- package/src/TemplateManager/src/ProcessLogicalPagination/Handler/HdrDsq/data.js +1 -3
- package/src/TemplateManager/src/ProcessLogicalPagination/Handler/HdrSqs/data.js +1 -3
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrApi/data.js +3 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrApi/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrDsq/data.js +3 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrDsq/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrInv/data.js +3 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrInv/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrSqs/data.js +3 -3
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrSqs/template.ejs +1 -1
- 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/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/perAction/HdrApi/template.ejs +45 -28
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/perAction/HdrDsq/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/perAction/HdrDsq/template.ejs +42 -21
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/perAction/HdrInv/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/perAction/HdrInv/template.ejs +41 -22
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/perAction/HdrSqs/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/perAction/HdrSqs/template.ejs +42 -21
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationshipComplete/functionYaml/data.js +3 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationshipComplete/functionYaml/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationshipComplete/handler/HdrSqs/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrApi/data.js +3 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrApi/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrDsq/data.js +3 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrDsq/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrInv/data.js +3 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrInv/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrSqs/data.js +3 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrSqs/template.ejs +1 -1
- 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/DeleteRelationship/perAction/HdrApi/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/perAction/HdrDsq/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/perAction/HdrInv/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/perAction/HdrSqs/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/functionYaml/data.js +3 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/functionYaml/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/handler/HdrSqs/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRalationshipComplete/functionYaml/data.js +3 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRalationshipComplete/functionYaml/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRalationshipComplete/handler/HdrSqs/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrApi/data.js +3 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrApi/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrDsq/data.js +3 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrDsq/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrInv/data.js +4 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrInv/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrSqs/data.js +3 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrSqs/template.ejs +1 -1
- 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/HdrApi/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/perAction/HdrDsq/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/perAction/HdrDsq/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/perAction/HdrInv/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/perAction/HdrSqs/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/perAction/HdrSqs/template.ejs +1 -1
- package/src/TemplateManager/src/ResourceYaml/dynamodb/mainResourcePerObjectSchemaData.js +3 -3
- package/src/TemplateManager/src/ResourceYaml/sns-in-sqs/defaultSnsInSqsForFindDataAndProcessLogical.js +6 -6
- package/src/TemplateManager/src/ResourceYaml/sns-out/defaultSnsOutForFindDataAndProcessLogical.js +2 -2
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/functionYaml/data.js +3 -2
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/functionYaml/template.ejs +1 -1
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/handler/dataHdrDsq.js +0 -2
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrDsq/data.js +4 -3
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrDsq/template.ejs +30 -0
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrSqs/data.js +4 -3
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrSqs/template.ejs +30 -0
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrDsq/data.js +0 -2
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrSqs/data.js +0 -2
- package/src/TemplateManager/src/externalService/FunctionNameConfig/template.ejs +13 -2
- package/src/TemplateManager/src/externalService/LambdaRole/data.js +39 -38
- package/src/TemplateManager/src/externalService/SnsTopicSubscriotions/template.ejs +19 -0
- package/src/TemplateManager/src/libs/Consts.js +28 -5
- package/src/TemplateManager/src/CreateRelationship/createRelationship/functionYaml/HdrApi/data.js +0 -119
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.10",
|
|
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.25",
|
|
26
26
|
"@izara_project/izara-shared": "^1.0.96",
|
|
27
27
|
"ejs": "^3.1.10",
|
|
28
28
|
"js-beautify": "^1.15.1",
|
|
@@ -48,7 +48,6 @@ const {
|
|
|
48
48
|
const nodeLabelRegexPattern = "^[a-zA-Z0-9_-]+(?:\:[a-zA-Z0-9_-]+)?$"
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
|
|
52
51
|
const schemaFunctionPerAction = {
|
|
53
52
|
[consts.ACTIONS.create]: validatorSchema.generateValidatorSchemaForCreate,
|
|
54
53
|
[consts.ACTIONS.update]: validatorSchema.generateValidatorSchemaForUpdate,
|
|
@@ -127,7 +126,7 @@ async function validateSchemaPerRecord(
|
|
|
127
126
|
throw new Error(`Not found function for generateValidatorSchema or function for explodeData of action:${action}`);
|
|
128
127
|
}
|
|
129
128
|
|
|
130
|
-
const objectSchema = await getObjectSchema.
|
|
129
|
+
const objectSchema = await getObjectSchema.getObjSchemaS3WithHierarchy(record._izContext, objType);
|
|
131
130
|
|
|
132
131
|
const generateValidatorFunction = schemaFunctionPerAction[action];
|
|
133
132
|
const explodeDataFunction = explodeDataPerAction[action]
|
|
@@ -734,46 +733,92 @@ async function createDataDetailsLib(
|
|
|
734
733
|
for (let [keyFieldName, settingFieldName] of Object.entries(objectSchemas.fieldNames)) {
|
|
735
734
|
// _izContext.logger.debug("Loop fieldNamesObjectSchemas", { keyFieldName });
|
|
736
735
|
|
|
737
|
-
// check
|
|
736
|
+
// check field is identifier
|
|
738
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
|
+
}
|
|
739
784
|
continue
|
|
740
785
|
};
|
|
786
|
+
_izContext.logger.debug("case multiple fieldName");
|
|
741
787
|
// validate storageResourceTags.
|
|
742
788
|
_izContext.logger.debug("storageResourceTags is", settingFieldName.storageResourceTags);
|
|
743
789
|
|
|
744
|
-
for (let
|
|
745
|
-
_izContext.logger.debug("Loop eachStorageResourceTags",
|
|
790
|
+
for (let eachStorageResourceTag of settingFieldName.storageResourceTags) {
|
|
791
|
+
_izContext.logger.debug("Loop eachStorageResourceTags", eachStorageResourceTag);
|
|
746
792
|
|
|
747
|
-
if (!storageResources.hasOwnProperty(
|
|
793
|
+
if (!storageResources.hasOwnProperty(eachStorageResourceTag)) {
|
|
748
794
|
throw new Error("storageResources is'n exist"); // should be validata in step uplode in s3
|
|
749
795
|
} else {
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
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);
|
|
755
800
|
|
|
756
801
|
} else {
|
|
757
|
-
_izContext.logger.debug("NEW STG DB",
|
|
802
|
+
_izContext.logger.debug("NEW STG DB", eachStorageResourceTag);
|
|
758
803
|
Object.assign(createDataDetails, {
|
|
759
|
-
[
|
|
804
|
+
[eachStorageResourceTag]: {
|
|
760
805
|
storageType: consts.STORAGE_TYPES.dynamoDB,
|
|
761
|
-
tableName: storageResources[
|
|
806
|
+
tableName: storageResources[eachStorageResourceTag].tableName,
|
|
762
807
|
fieldNames: [keyFieldName]
|
|
763
808
|
}
|
|
764
809
|
});
|
|
765
810
|
|
|
766
|
-
if (storageResources[
|
|
767
|
-
Object.assign(createDataDetails[
|
|
768
|
-
groupByPartitionKeyField: storageResources[
|
|
811
|
+
if (storageResources[eachStorageResourceTag].hasOwnProperty("groupByPartitionKeyField")) {
|
|
812
|
+
Object.assign(createDataDetails[eachStorageResourceTag], {
|
|
813
|
+
groupByPartitionKeyField: storageResources[eachStorageResourceTag].groupByPartitionKeyField
|
|
769
814
|
});
|
|
770
815
|
}
|
|
771
816
|
}
|
|
772
817
|
|
|
773
|
-
} else if (storageResources[
|
|
818
|
+
} else if (storageResources[eachStorageResourceTag].storageType == consts.STORAGE_TYPES.graph) {
|
|
774
819
|
let checkGraphServerTags = await serviceConfig.getGraphServiceTag(
|
|
775
820
|
_izContext,
|
|
776
|
-
storageResources[
|
|
821
|
+
storageResources[eachStorageResourceTag].graphServerTag
|
|
777
822
|
);
|
|
778
823
|
if (checkGraphServerTags) {
|
|
779
824
|
if (createDataDetails.hasOwnProperty(checkGraphServerTags)) {
|
|
@@ -17,6 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
17
17
|
|
|
18
18
|
'use strict';
|
|
19
19
|
|
|
20
|
+
const lodash = require("lodash")
|
|
20
21
|
|
|
21
22
|
module.exports.firstLetterUpperCase = (text) => {
|
|
22
23
|
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
@@ -34,4 +35,16 @@ module.exports.checkOverWriteGenerateMainFunction = (objectSchema, action) => {
|
|
|
34
35
|
overWriteStatus = false
|
|
35
36
|
}
|
|
36
37
|
return overWriteStatus
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
module.exports.renameObjectType = (objectSchema, srcPath) => {
|
|
41
|
+
const shortNamePath = path.join(srcPath, "./schemas/ShortNameObjectType.js");
|
|
42
|
+
const shortName = fs.existsSync(shortNamePath) ? require(shortNamePath) : {};
|
|
43
|
+
|
|
44
|
+
let newObjectSchema = lodash.cloneDeep(objectSchema)
|
|
45
|
+
|
|
46
|
+
if (shortName[objectSchema.objectType]) {
|
|
47
|
+
newObjectSchema.shortNameObjectType = shortName[objectSchema.objectType]
|
|
48
|
+
}
|
|
49
|
+
return newObjectSchema
|
|
37
50
|
}
|
|
@@ -23,7 +23,7 @@ const templatePath = path.join(__dirname, "./template.ejs")
|
|
|
23
23
|
|
|
24
24
|
const { HANDLER, STORAGE_TYPES, ACTIONS } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
25
25
|
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../MainLibs/src/Utils")
|
|
26
|
-
const { createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME } = require("../../libs/Consts");
|
|
26
|
+
const { createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, shortNameHandler } = require("../../libs/Consts");
|
|
27
27
|
|
|
28
28
|
const serviceSchemas = require('@izara_project/izara-core-library-service-schemas');
|
|
29
29
|
const serviceConfig = serviceSchemas.serviceConfig;
|
|
@@ -174,7 +174,8 @@ async function data(_izContext, objectSchemas, srcPath) {
|
|
|
174
174
|
functionName: functionName,
|
|
175
175
|
resourceLocation: SOURCE_PATH.resourceLocationFindData,
|
|
176
176
|
handlerType: HANDLER.hdrSqs,
|
|
177
|
-
additionalResourcePermission
|
|
177
|
+
additionalResourcePermission,
|
|
178
|
+
functionNameConfig: upperCase(functionName) + upperCase(shortNameHandler(HANDLER.hdrSqs))
|
|
178
179
|
},
|
|
179
180
|
setting: {
|
|
180
181
|
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<%_ const join = require('path').join; _%>
|
|
2
|
-
<%-
|
|
2
|
+
<%- firstLetterUpperCase(functionNameConfig) %>:
|
|
3
3
|
handler: <%- join(resourceLocation, `${functionName}_${firstLetterUpperCase(handlerType)}.main`)%>
|
|
4
4
|
name: ${self:custom.iz_resourcePrefix}<%- functionName %><%- firstLetterUpperCase(handlerType) %>
|
|
5
5
|
events:
|
|
@@ -31,15 +31,10 @@ const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = req
|
|
|
31
31
|
* @return {{ templatePath, templateData, setting } }
|
|
32
32
|
*/
|
|
33
33
|
function data(_izContext, srcPath) {
|
|
34
|
-
let functionName = FUNCTION_NAME.findData
|
|
35
|
-
let handler = HANDLER.hdrSqs
|
|
36
|
-
let functionNameConfig = upperCase(functionName) + upperCase(handler)
|
|
37
34
|
|
|
38
35
|
return {
|
|
39
36
|
templatePath: templatePath,
|
|
40
|
-
templateData: {
|
|
41
|
-
functionNameConfig
|
|
42
|
-
},
|
|
37
|
+
templateData: {},
|
|
43
38
|
setting: {
|
|
44
39
|
savePath: path.join(srcPath, SOURCE_PATH.findData),
|
|
45
40
|
saveFileName: upperCase(FUNCTION_NAME.findData) + "_" + upperCase(HANDLER.hdrSqs),
|
|
@@ -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 = [
|
|
@@ -120,14 +120,12 @@ const createUpdateRelationshipSchemaCompleteMainFunction = require('./Relationsh
|
|
|
120
120
|
const createRelationshipSchemaMain = require('./RelationshipPerAction/CreateRelationship/createRelationship/mainFunction/data');
|
|
121
121
|
|
|
122
122
|
// createRelationsihp Handler
|
|
123
|
-
// const createCreateRelationshipHdrApi = require('./CreateRelationship/createrelationship/perAction/HdrApi/data');
|
|
124
123
|
const createCreateRelationshipHdrDsq = require('./RelationshipPerAction/CreateRelationship/createRelationship/perAction/HdrDsq/data');
|
|
125
124
|
const createCreateRelationshipHdrInv = require('./RelationshipPerAction/CreateRelationship/createRelationship/perAction/HdrInv/data');
|
|
126
125
|
const createCreateRelationshipHdrSqs = require('./RelationshipPerAction/CreateRelationship/createRelationship/perAction/HdrSqs/data');
|
|
127
126
|
const createCreateRelationshipHdrApi = require('./RelationshipPerAction/CreateRelationship/createRelationship/perAction/HdrApi/data');
|
|
128
127
|
|
|
129
128
|
// createRelationshipFunctionYaml
|
|
130
|
-
// const createCreateRelationshipFunctionYamlHdrApi = require('./CreateRelationship/createrelationship/functionYaml/HdrApi/data');
|
|
131
129
|
const createCreateRelationshipFunctionYamlHdrInv = require('./RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrInv/data');
|
|
132
130
|
const createCreateRelationshipFunctionYamlHdrDsq = require('./RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrDsq/data');
|
|
133
131
|
const createCreateRelationshipFunctionYamlHdrSqs = require('./RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrSqs/data');
|
|
@@ -502,11 +500,11 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
502
500
|
...deleteRelationshipCompleteData
|
|
503
501
|
)
|
|
504
502
|
}
|
|
505
|
-
// console.log("createSourceParams in GenerateCode", createSourceParams)
|
|
503
|
+
// console.log("createSourceParams templatePath in GenerateCode", createSourceParams.templatePath)
|
|
504
|
+
|
|
506
505
|
const createFunctionNameConfig = functionNameConfigFile(_izContext, createSourceParams, saveFilePath);
|
|
507
506
|
createSourceParams = createSourceParams.concat(createFunctionNameConfig);
|
|
508
507
|
|
|
509
|
-
// console.log("createSourceParams", createSourceParams)
|
|
510
508
|
// delete file .yml before start to prevent confilct of data
|
|
511
509
|
for (let folderPathToEmpty of Object.keys(GENERATECODE_SOURCE_PATH)) {
|
|
512
510
|
await deleteFileInDir(GENERATECODE_SOURCE_PATH[folderPathToEmpty]);
|
|
@@ -515,8 +513,8 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
515
513
|
// console.log(""createSourceParams": ", createSourceParams)
|
|
516
514
|
// start create source
|
|
517
515
|
for (let { templatePath, templateData, setting } of createSourceParams) {
|
|
516
|
+
// console.log("setting.saveFileName in GenerateCode", setting.saveFileName);
|
|
518
517
|
// console.log("templatePath in GenerateCode", templatePath);
|
|
519
|
-
// console.log("setting.savePath in GenerateCode", setting.savePath);
|
|
520
518
|
|
|
521
519
|
await createSource(
|
|
522
520
|
readFileSync(templatePath, 'utf8'),
|
|
@@ -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.
|
|
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,10 +46,9 @@ function createParamForCreateSource(srcPath) {
|
|
|
47
46
|
functionName,
|
|
48
47
|
queueName: upperCase(functionName),
|
|
49
48
|
functionName,
|
|
50
|
-
functionNameConfig
|
|
51
49
|
},
|
|
52
50
|
setting: {
|
|
53
|
-
savePath: path.join(srcPath, SOURCE_PATH.
|
|
51
|
+
savePath: path.join(srcPath, SOURCE_PATH.outPerActionComplete),
|
|
54
52
|
saveFileName: `${upperCase(functionName)}_${upperCase(HANDLER.hdrSqs)}`,
|
|
55
53
|
fileExtension: ".js",
|
|
56
54
|
isAppend: false
|
|
@@ -26,7 +26,7 @@ const izaraShared = require('@izara_project/izara-shared');
|
|
|
26
26
|
const recordHandlerSharedLib = izaraShared.recordHandlerSharedLib
|
|
27
27
|
const callingFlowSharedLib = izaraShared.callingFlowSharedLib;
|
|
28
28
|
|
|
29
|
-
const
|
|
29
|
+
const createObjectComplete = require('./CreateObjectComplete_Main');
|
|
30
30
|
const Logger = require('@izara_project/izara-core-library-logger');
|
|
31
31
|
// validate event properties in body.Message of sqs event
|
|
32
32
|
middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
|
|
@@ -36,7 +36,8 @@ let perRecordsValidatorSchema = {
|
|
|
36
36
|
required: [
|
|
37
37
|
'returnValue',
|
|
38
38
|
'status',
|
|
39
|
-
'errorFounds'
|
|
39
|
+
'errorFounds',
|
|
40
|
+
'graphServiceTag'
|
|
40
41
|
],
|
|
41
42
|
properties: {
|
|
42
43
|
returnValue: {
|
|
@@ -48,6 +49,9 @@ let perRecordsValidatorSchema = {
|
|
|
48
49
|
errorFounds: {
|
|
49
50
|
type: 'array',
|
|
50
51
|
default: []
|
|
52
|
+
},
|
|
53
|
+
graphServiceTag: {
|
|
54
|
+
type: 'string',
|
|
51
55
|
}
|
|
52
56
|
}
|
|
53
57
|
};
|
|
@@ -82,7 +86,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
82
86
|
//validate message (and MessageAttributes)
|
|
83
87
|
await recordHandlerSharedLib.validateRecord(
|
|
84
88
|
record, // one record will send to mainFunction
|
|
85
|
-
"
|
|
89
|
+
"CreateObjectComplete", // queue name that need to retry or send to dlq
|
|
86
90
|
perRecordsValidatorSchema, // schema for record.Message
|
|
87
91
|
// messageAttributeValidatorSchema // ----- for msgAttr default is null -> do not send this parameter if not want to validate msgAtt
|
|
88
92
|
);
|
|
@@ -91,7 +95,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
91
95
|
passOnProperties.push(record.body.Message.returnValue)
|
|
92
96
|
passOnProperties.push(record.body.Message.status)
|
|
93
97
|
passOnProperties.push(record.body.Message.errorFounds)
|
|
94
|
-
passOnProperties.push(record.body.Message.
|
|
98
|
+
passOnProperties.push(record.body.Message.graphServiceTag)
|
|
95
99
|
passOnProperties.push(callingFlowSharedLib.addPassBackPropertiesToPassOnProperties(record.body.Message)) // is Ok PassBackProperties
|
|
96
100
|
// passOnProperties.push(callingFlowSharedLib.addCallingFlowToPassOnProperties(record.body.Message)) // is Ok callinfFlow
|
|
97
101
|
record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
|
|
@@ -99,8 +103,8 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
99
103
|
// call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
|
|
100
104
|
let recordPromise = recordHandlerSharedLib.recordHandler(
|
|
101
105
|
record, // one record will send to mainFunction
|
|
102
|
-
|
|
103
|
-
"
|
|
106
|
+
createObjectComplete.createObjectComplete, // mainFunction that need to invoke.
|
|
107
|
+
"CreateObjectComplete", // queue name that need to retry or send to dlq
|
|
104
108
|
passOnProperties, // all parameters that mainFunction needed.
|
|
105
109
|
);
|
|
106
110
|
record._izContext.logger.debug('after recordPromise in handler');
|
|
@@ -123,8 +127,4 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
123
127
|
Logger.error('Unhandled Error, updateNodeCompleteHdrSqs: ', err);
|
|
124
128
|
throw (err);
|
|
125
129
|
}
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
<%_ function firstLetterUpperCase(text){
|
|
129
|
-
return text.charAt(0).toUpperCase()+ text.slice(1)
|
|
130
|
-
} _%>
|
|
130
|
+
});
|
|
@@ -42,7 +42,7 @@ function createMainFunctionCreateComplete(_izContext, srcPath) {
|
|
|
42
42
|
templatePath: templatePath,
|
|
43
43
|
templateData: {},
|
|
44
44
|
setting: {
|
|
45
|
-
savePath: path.join(srcPath, SOURCE_PATH.
|
|
45
|
+
savePath: path.join(srcPath, SOURCE_PATH.outPerActionComplete),
|
|
46
46
|
saveFileName: `${upperCase(FUNCTION_NAME.createObjectComplete)}_Main`,
|
|
47
47
|
fileExtension: ".js",
|
|
48
48
|
isAppend: false
|
package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/mainFunction/template.ejs
CHANGED
|
@@ -35,9 +35,8 @@ const PREFIX = {
|
|
|
35
35
|
* @param {*} returnValue
|
|
36
36
|
* @param {*} status
|
|
37
37
|
* @param {*} errorsFounds
|
|
38
|
-
* @param {*}
|
|
38
|
+
* @param {*} graphServiceTag
|
|
39
39
|
* @param {*} passBackProperties
|
|
40
|
-
* @param {*} callingFlowConfig
|
|
41
40
|
returnValue = {
|
|
42
41
|
queryResult: returnCreateNode,
|
|
43
42
|
objType,
|
|
@@ -51,22 +50,18 @@ module.exports.createObjectComplete = async (
|
|
|
51
50
|
returnValue,
|
|
52
51
|
status,
|
|
53
52
|
errorsFound,
|
|
54
|
-
|
|
53
|
+
graphServiceTag,
|
|
55
54
|
passBackProperties,
|
|
56
|
-
callingFlowConfig
|
|
57
55
|
) => {
|
|
58
56
|
try {
|
|
59
57
|
_izContext.logger.debug("function createObjectComplete:", {
|
|
60
58
|
returnValue,
|
|
61
59
|
status,
|
|
62
60
|
errorsFound,
|
|
63
|
-
|
|
61
|
+
graphServiceTag,
|
|
64
62
|
passBackProperties,
|
|
65
|
-
callingFlowConfig
|
|
66
63
|
});
|
|
67
64
|
|
|
68
|
-
let errorFounds = [];
|
|
69
|
-
|
|
70
65
|
if (_.isEmpty(returnValue)) {
|
|
71
66
|
_izContext.logger.debug("message callingFlowProperties is empty");
|
|
72
67
|
throw new NoRetryError("message not an object")
|
|
@@ -91,7 +86,7 @@ module.exports.createObjectComplete = async (
|
|
|
91
86
|
if (status === "complete" && errorsFound.length > 0) {
|
|
92
87
|
errorFounds.push("[Invalid] status is commplete should be not have errorsFound");
|
|
93
88
|
};
|
|
94
|
-
if (
|
|
89
|
+
if (graphServiceTag == null) {
|
|
95
90
|
errorFounds.push("[Invalid] graphServerTag is not empty string");
|
|
96
91
|
};
|
|
97
92
|
|
|
@@ -100,10 +95,10 @@ module.exports.createObjectComplete = async (
|
|
|
100
95
|
errorFounds = errorFounds.concat(errorsFound);
|
|
101
96
|
};
|
|
102
97
|
|
|
103
|
-
let awaitingStepId = await asyncFlowSharedLib.createAwaitingStepId(
|
|
104
|
-
{
|
|
98
|
+
let awaitingStepId = await asyncFlowSharedLib.createAwaitingStepId(
|
|
99
|
+
(hash({
|
|
105
100
|
objType: returnValue.objType,
|
|
106
|
-
graphServerTag:
|
|
101
|
+
graphServerTag: graphServiceTag,
|
|
107
102
|
identifiers: returnValue.objInstanceFull.identifiers
|
|
108
103
|
})),
|
|
109
104
|
PREFIX.CREATE_OBJECT_ASYNC
|
|
@@ -149,7 +144,7 @@ module.exports.createObjectComplete = async (
|
|
|
149
144
|
let messageObject = {
|
|
150
145
|
objType: returnValue.objType,
|
|
151
146
|
objInstanceFull: returnValue.objInstanceFull,
|
|
152
|
-
|
|
147
|
+
errorsFound: errorsFound
|
|
153
148
|
};
|
|
154
149
|
|
|
155
150
|
messageObject = callingFlowSharedLib.addParentPassBackPropertiesToSnsResponseMessageObject(passBackProperties, messageObject)
|
|
@@ -163,6 +158,11 @@ module.exports.createObjectComplete = async (
|
|
|
163
158
|
_izContext.logger.debug("Send message to OutCreateObjectComplete :::>", sendMessageOutCreateObjectComplete)
|
|
164
159
|
await sns.publishAsync(_izContext, sendMessageOutCreateObjectComplete);
|
|
165
160
|
|
|
161
|
+
return {
|
|
162
|
+
objType: returnValue.objType,
|
|
163
|
+
objInstanceFull: returnValue.objInstanceFull,
|
|
164
|
+
errorsFound: errorsFound
|
|
165
|
+
}
|
|
166
166
|
|
|
167
167
|
} catch (err) {
|
|
168
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.
|
|
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,10 +46,9 @@ function createParamForCreateSource(srcPath) {
|
|
|
47
46
|
functionName,
|
|
48
47
|
queueName: upperCase(functionName),
|
|
49
48
|
functionName,
|
|
50
|
-
functionNameConfig
|
|
51
49
|
},
|
|
52
50
|
setting: {
|
|
53
|
-
savePath: path.join(srcPath, SOURCE_PATH.
|
|
51
|
+
savePath: path.join(srcPath, SOURCE_PATH.outPerActionComplete),
|
|
54
52
|
saveFileName: `${upperCase(functionName)}_${upperCase(HANDLER.hdrSqs)}`,
|
|
55
53
|
fileExtension: ".js",
|
|
56
54
|
isAppend: false
|
|
@@ -42,7 +42,7 @@ function createMainFunctionUpdateComplete(_izContext, srcPath) {
|
|
|
42
42
|
templatePath: templatePath,
|
|
43
43
|
templateData: {},
|
|
44
44
|
setting: {
|
|
45
|
-
savePath: path.join(srcPath, SOURCE_PATH.
|
|
45
|
+
savePath: path.join(srcPath, SOURCE_PATH.outPerActionComplete),
|
|
46
46
|
saveFileName: `${upperCase(FUNCTION_NAME.deleteNodeComplete)}_Main`,
|
|
47
47
|
fileExtension: ".js",
|
|
48
48
|
isAppend: false
|
package/src/TemplateManager/src/OutPerActionComplete/OutDeleteComplete/mainFunction/template.ejs
CHANGED
|
@@ -52,7 +52,7 @@ module.exports.deleteNodeComplete = async (
|
|
|
52
52
|
passBackProperties: passBackProperties
|
|
53
53
|
});
|
|
54
54
|
|
|
55
|
-
let
|
|
55
|
+
let deleteNodeComplete = {
|
|
56
56
|
objType: {
|
|
57
57
|
objectType: returnValue.objType.objectType,
|
|
58
58
|
serviceTag: returnValue.objType.serviceTag
|
|
@@ -65,22 +65,25 @@ module.exports.deleteNodeComplete = async (
|
|
|
65
65
|
errorsFound: errorsFound
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
deleteNodeComplete = callingFlowSharedLib.addParentPassBackPropertiesToSnsResponseMessageObject(passBackProperties, updateCompleteMsg);
|
|
69
69
|
_izContext.logger.debug("after addCallingFlow to SnsResponseMessageObject", updateCompleteMsg);
|
|
70
70
|
|
|
71
71
|
let messageAttributes = callingFlowSharedLib.addParentPassBackCallingFlowToSnsResponseMessageAttributes(passBackProperties, {});
|
|
72
72
|
_izContext.logger.debug("after addCallingFlow to SnsResponseMessageAttributes", updateCompleteMsg);
|
|
73
73
|
|
|
74
74
|
let sendMessageToOutUpdateNodeComplete = {
|
|
75
|
-
Message: JSON.stringify(
|
|
75
|
+
Message: JSON.stringify(deleteNodeComplete),
|
|
76
76
|
MessageAttributes: sns.createStringMessageAttributes(_izContext, messageAttributes),
|
|
77
77
|
TopicArn: await snsSharedLib.snsTopicArn(_izContext, TOPIC_NAME_GENERATE_CODE.outUpdateNodeComplete)
|
|
78
78
|
};
|
|
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.
|
|
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:
|