@izara_project/izara-shared-service-schemas 1.0.21 → 1.0.22
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
CHANGED
package/src/GetObjectSchema.js
CHANGED
|
@@ -34,6 +34,7 @@ const {
|
|
|
34
34
|
generateObjectSchemaForUpdate,
|
|
35
35
|
generateObjectSchemaForCombineFieldNames
|
|
36
36
|
} = require('./libs/ReformatObjectSchema');
|
|
37
|
+
|
|
37
38
|
/**
|
|
38
39
|
* Retrieves a specific object schema from S3.
|
|
39
40
|
*
|
|
@@ -905,24 +906,29 @@ async function getLinkConfigByLinkTypeId(getSchemaFn, firstObjType, secondObjTyp
|
|
|
905
906
|
let linkConfig = await getLinkTypeId(getSchemaFn, firstObjType, secondObjType, relType, direction)
|
|
906
907
|
linkConfig && linkConfigs.push(linkConfig)
|
|
907
908
|
} else {
|
|
908
|
-
let firstObjectTypeHie = await getObjTypeHierarchy(getSchemaFn, firstObjType)
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
909
|
+
let firstObjectTypeHie = await getObjTypeHierarchy(getSchemaFn, firstObjType).then(res => {
|
|
910
|
+
if (res.errorsFound.length && res.errorsFound.length > 0) {
|
|
911
|
+
errorsFound.push(...res.errorsFound)
|
|
912
|
+
return {
|
|
913
|
+
errorsFound: res.errorsFound,
|
|
914
|
+
result: null
|
|
915
|
+
}
|
|
916
|
+
} else {
|
|
917
|
+
return res.result
|
|
916
918
|
}
|
|
917
|
-
}
|
|
919
|
+
});
|
|
918
920
|
|
|
919
|
-
|
|
920
|
-
errorsFound.
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
921
|
+
let secondObjectTypeHie = await getObjTypeHierarchy(getSchemaFn, secondObjType).then(res => {
|
|
922
|
+
if (res.errorsFound.length && res.errorsFound.length > 0) {
|
|
923
|
+
errorsFound.push(...res.errorsFound)
|
|
924
|
+
return {
|
|
925
|
+
errorsFound: res.errorsFound,
|
|
926
|
+
result: null
|
|
927
|
+
}
|
|
928
|
+
} else {
|
|
929
|
+
return res.result
|
|
924
930
|
}
|
|
925
|
-
}
|
|
931
|
+
});
|
|
926
932
|
|
|
927
933
|
for (const firstObject of firstObjectTypeHie) {
|
|
928
934
|
for (const secondObject of secondObjectTypeHie) {
|
|
@@ -1008,7 +1014,16 @@ async function getObjTypeHierarchy(getSchemaFn, objType, passObjTypeHierarchy, i
|
|
|
1008
1014
|
objTypeHierarchy = passObjTypeHierarchy;
|
|
1009
1015
|
}
|
|
1010
1016
|
|
|
1011
|
-
const objectSchema = await getObjSchemaWithoutHierarchy(getSchemaFn, objType)
|
|
1017
|
+
const objectSchema = await getObjSchemaWithoutHierarchy(getSchemaFn, objType).then(objSchema => {
|
|
1018
|
+
if (objSchema.errorsFound.length) {
|
|
1019
|
+
return {
|
|
1020
|
+
errorsFound: objSchema.errorsFound,
|
|
1021
|
+
result: null
|
|
1022
|
+
}
|
|
1023
|
+
} else {
|
|
1024
|
+
return objSchema.result
|
|
1025
|
+
}
|
|
1026
|
+
});
|
|
1012
1027
|
|
|
1013
1028
|
if (objectSchema.extendObjType) {
|
|
1014
1029
|
iter++;
|
|
@@ -1030,7 +1045,7 @@ async function getObjTypeHierarchy(getSchemaFn, objType, passObjTypeHierarchy, i
|
|
|
1030
1045
|
}
|
|
1031
1046
|
}
|
|
1032
1047
|
|
|
1033
|
-
async function getObjectSchemaForCreate(
|
|
1048
|
+
async function getObjectSchemaForCreate(objType) {
|
|
1034
1049
|
let objectSchema = await getObjSchemaWithHierarchy(getSchemaFn, objType).then(objSchema => {
|
|
1035
1050
|
if (objSchema.errorsFound.length) {
|
|
1036
1051
|
return {
|
|
@@ -1058,7 +1073,7 @@ async function getObjectSchemaForUpdate(getSchemaFn, objType) {
|
|
|
1058
1073
|
return generateObjectSchemaForUpdate(objectSchema)
|
|
1059
1074
|
}
|
|
1060
1075
|
|
|
1061
|
-
async function getObjectSchemaCombineFieldNames(objType) {
|
|
1076
|
+
async function getObjectSchemaCombineFieldNames(getSchemaFn, objType) {
|
|
1062
1077
|
let objectSchema = await getObjSchemaWithHierarchy(getSchemaFn, objType).then(objSchema => {
|
|
1063
1078
|
if (objSchema.errorsFound.length) {
|
|
1064
1079
|
return {
|
|
@@ -1071,6 +1086,7 @@ async function getObjectSchemaCombineFieldNames(objType) {
|
|
|
1071
1086
|
})
|
|
1072
1087
|
return generateObjectSchemaForCombineFieldNames(objectSchema)
|
|
1073
1088
|
}
|
|
1089
|
+
|
|
1074
1090
|
module.exports = {
|
|
1075
1091
|
// objectSchema
|
|
1076
1092
|
getObjSchemaS3,
|
|
@@ -689,7 +689,7 @@ const basicExtendObjectSchema = {
|
|
|
689
689
|
}
|
|
690
690
|
}
|
|
691
691
|
|
|
692
|
-
// validator schema for basic
|
|
692
|
+
// validator schema for basic relationship schema
|
|
693
693
|
const relationshipBasicSchema = {
|
|
694
694
|
type: "object",
|
|
695
695
|
maxProperties: 1,
|
|
@@ -873,7 +873,7 @@ const relationshipBasicSchema = {
|
|
|
873
873
|
}
|
|
874
874
|
|
|
875
875
|
|
|
876
|
-
// validator schema for basic reference
|
|
876
|
+
// validator schema for basic reference relationship schema
|
|
877
877
|
const refRelationshipBasicSchema = {
|
|
878
878
|
type: "object",
|
|
879
879
|
required: ["objectType", "relationshipTag", "relationshipServiceTag"],
|
|
@@ -178,6 +178,7 @@ function generateObjectSchemaForUpdate(objSchema) {
|
|
|
178
178
|
* @returns {Object} - objectSchema that has property for case update
|
|
179
179
|
*/
|
|
180
180
|
function generateObjectSchemaForCombineFieldNames(objSchema) {
|
|
181
|
+
console.log("generateObjectSchemaForCombineFieldNames", objSchema)
|
|
181
182
|
// generate data for case update
|
|
182
183
|
let initReturnObj = {
|
|
183
184
|
objectType: objSchema.objectType,
|