@izara_project/izara-core-library-service-schemas 1.0.93 → 1.0.94
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 +4 -4
- package/src/ValidatorSchema.js +46 -31
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@izara_project/izara-core-library-service-schemas",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.94",
|
|
4
4
|
"description": "Schemas for the service and objects it controls",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"@aws-sdk/client-lambda": "^3.862.0",
|
|
26
26
|
"@aws-sdk/client-s3": "^3.862.0",
|
|
27
27
|
"@aws-sdk/crc64-nvme-crt": "^3.862.0",
|
|
28
|
-
"@izara_project/izara-core-library-core": "^1.0.
|
|
29
|
-
"@izara_project/izara-core-library-external-request": "^1.0.
|
|
30
|
-
"@izara_project/izara-core-library-lambda": "^1.0.
|
|
28
|
+
"@izara_project/izara-core-library-core": "^1.0.24",
|
|
29
|
+
"@izara_project/izara-core-library-external-request": "^1.0.21",
|
|
30
|
+
"@izara_project/izara-core-library-lambda": "^1.0.5",
|
|
31
31
|
"@izara_project/izara-core-library-logger": "^1.0.7",
|
|
32
32
|
"@izara_project/izara-shared-core": "^1.0.2",
|
|
33
33
|
"@izara_project/izara-shared-service-schemas": "^1.0.30",
|
package/src/ValidatorSchema.js
CHANGED
|
@@ -658,9 +658,17 @@ async function generateValidatorSchemaForUpdate(_izContext, objType, settings =
|
|
|
658
658
|
}
|
|
659
659
|
}
|
|
660
660
|
|
|
661
|
-
console.debug("
|
|
662
|
-
|
|
661
|
+
// console.debug("versionedDataReturnInFieldsObjInstanceFull::::", versionedDataReturnInFieldsObjInstanceFull);
|
|
662
|
+
// console.debug("initialValidatorSchemaForUpdate:::::", initialValidatorSchemaForUpdate);
|
|
663
|
+
Object.assign(
|
|
664
|
+
initialValidatorSchemaForUpdate.properties.objInstanceFull.properties.fields.properties,
|
|
665
|
+
{
|
|
666
|
+
...versionedDataReturnInFieldsObjInstanceFull,
|
|
667
|
+
...canUpdateProperties
|
|
668
|
+
}
|
|
669
|
+
);
|
|
663
670
|
|
|
671
|
+
// _izContext.logger.debug("validatorSchema-update::", initialValidatorSchemaForUpdate);
|
|
664
672
|
return initialValidatorSchemaForUpdate;
|
|
665
673
|
}
|
|
666
674
|
|
|
@@ -975,6 +983,26 @@ async function validateLocalSchema(_izContext, schemasPath, serviceConfigPath) {
|
|
|
975
983
|
console.log("schemasPath", schemasPath);
|
|
976
984
|
console.log("serviceConfigPath", serviceConfigPath)
|
|
977
985
|
|
|
986
|
+
// helper function for getObjectSchema function in s3 or local
|
|
987
|
+
async function getLocalOrS3ObjectSchema(objType) {
|
|
988
|
+
let objSchema
|
|
989
|
+
let errorMessage
|
|
990
|
+
if (objType.serviceTag === iz_serviceTag) {
|
|
991
|
+
objSchema = await getLocalObjectSchemasWithHierarchy(_izContext, objType.objectType, schemasPath)
|
|
992
|
+
.then(res => {
|
|
993
|
+
return res.records[0]
|
|
994
|
+
})
|
|
995
|
+
|
|
996
|
+
if (!objSchema) {
|
|
997
|
+
errorMessage = "local not exists"
|
|
998
|
+
}
|
|
999
|
+
} else {
|
|
1000
|
+
objSchema = await getObjSchemaS3WithHierarchy(_izContext, objType);
|
|
1001
|
+
errorMessage = "s3 not exists"
|
|
1002
|
+
}
|
|
1003
|
+
return [objSchema, errorMessage]
|
|
1004
|
+
}
|
|
1005
|
+
|
|
978
1006
|
let validateStatus = {
|
|
979
1007
|
status: true,
|
|
980
1008
|
validateErrors: [],
|
|
@@ -1166,29 +1194,19 @@ async function validateLocalSchema(_izContext, schemasPath, serviceConfigPath) {
|
|
|
1166
1194
|
// validate objType of each link
|
|
1167
1195
|
await Promise.all(
|
|
1168
1196
|
relData.links.map(async (link, linkIdx) => {
|
|
1197
|
+
const [fromObjectSchema, fromErrorMessage] = await getLocalOrS3ObjectSchema(link.from.objType);
|
|
1169
1198
|
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
validateStatus.status = false;
|
|
1175
|
-
validateStatus.validateErrors.push(`Relationship:${relTagName} /links/${linkIdx} /from/objType > Not found objectSchema of objectType:${link.from.objType.objectType} in local service`);
|
|
1176
|
-
}
|
|
1177
|
-
return res.records[0]
|
|
1178
|
-
})
|
|
1179
|
-
: await getObjSchemaS3WithHierarchy(_izContext, link.from.objType);
|
|
1180
|
-
|
|
1181
|
-
const toObjectSchema = (link.to.objType.serviceTag === iz_serviceTag)
|
|
1182
|
-
? await getLocalObjectSchemasWithHierarchy(_izContext, link.to.objType.objectType, schemasPath)
|
|
1183
|
-
.then(res => {
|
|
1184
|
-
if (!res.records[0]) {
|
|
1185
|
-
validateStatus.status = false;
|
|
1186
|
-
validateStatus.validateErrors.push(`Relationship:${relTagName} /links/${linkIdx} /to/objType > Not found objectSchema of objectType:${link.to.objType.objectType} in local service`);
|
|
1187
|
-
}
|
|
1188
|
-
return res.records[0]
|
|
1189
|
-
})
|
|
1190
|
-
: await getObjSchemaS3WithHierarchy(_izContext, link.to.objType);
|
|
1199
|
+
if (!fromObjectSchema && fromErrorMessage === "local not exists") {
|
|
1200
|
+
validateStatus.status = false;
|
|
1201
|
+
validateStatus.validateErrors.push(`Relationship:${relTagName} /links/${linkIdx} /from/objType > Not found objectSchema of objectType:${link.from.objType.objectType} in local service`);
|
|
1202
|
+
}
|
|
1191
1203
|
|
|
1204
|
+
const [toObjectSchema, toErrorMessage] = await getLocalOrS3ObjectSchema(link.to.objType);
|
|
1205
|
+
|
|
1206
|
+
if (!fromObjectSchema && toErrorMessage === "local not exists") {
|
|
1207
|
+
validateStatus.status = false;
|
|
1208
|
+
validateStatus.validateErrors.push(`Relationship:${relTagName} /links/${linkIdx} /to/objType > Not found objectSchema of objectType:${link.to.objType.objectType} in local service`);
|
|
1209
|
+
}
|
|
1192
1210
|
|
|
1193
1211
|
if (!validateStatus.validateErrors.length) {
|
|
1194
1212
|
if (!fromObjectSchema) {
|
|
@@ -1247,10 +1265,10 @@ async function validateLocalSchema(_izContext, schemasPath, serviceConfigPath) {
|
|
|
1247
1265
|
validateStatus.status = false;
|
|
1248
1266
|
validateStatus.validateErrors.push(`flowSchema ${flowSchema.flowTag} must have objType`)
|
|
1249
1267
|
} else {
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1268
|
+
|
|
1269
|
+
let [objSchema] = await getLocalOrS3ObjectSchema(flowSchema.objType);
|
|
1270
|
+
|
|
1271
|
+
console.log("objSchema: ", objSchema)
|
|
1254
1272
|
|
|
1255
1273
|
if (!objSchema) {
|
|
1256
1274
|
validateStatus.status = false;
|
|
@@ -1292,10 +1310,7 @@ async function validateLocalSchema(_izContext, schemasPath, serviceConfigPath) {
|
|
|
1292
1310
|
validateStatus.status = false;
|
|
1293
1311
|
validateStatus.validateErrors.push(`flowSchema ${flowSchema.flowTag} must have objType`)
|
|
1294
1312
|
} else {
|
|
1295
|
-
let objSchema = await
|
|
1296
|
-
objectType: flowSchema.objType.objectType,
|
|
1297
|
-
serviceTag: flowSchema.objType.serviceTag
|
|
1298
|
-
})
|
|
1313
|
+
let [objSchema] = await getLocalOrS3ObjectSchema(flowSchema.objType);
|
|
1299
1314
|
|
|
1300
1315
|
if (!objSchema) {
|
|
1301
1316
|
validateStatus.status = false;
|