@izara_project/izara-core-library-service-schemas 1.0.81 → 1.0.82
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 +5 -5
- package/src/UploadObjSchema.js +2 -2
- package/src/ValidatorSchema.js +30 -4
- package/src/libs/ExplodedReqParams.js +18 -12
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.82",
|
|
4
4
|
"description": "Schemas for the service and objects it controls",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -14,22 +14,22 @@
|
|
|
14
14
|
"license": "AGPL-3.0-or-later",
|
|
15
15
|
"homepage": "https://bitbucket.org/izara-core-libraries/izara-core-library-service-schemas/src/master/README.md",
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"jest": "^30.0.
|
|
17
|
+
"jest": "^30.0.5"
|
|
18
18
|
},
|
|
19
19
|
"jest": {
|
|
20
20
|
"testEnvironment": "node"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@aws-sdk/client-api-gateway": "^3.848.0",
|
|
24
|
-
"@aws-sdk/client-lambda": "^3.
|
|
25
|
-
"@aws-sdk/client-s3": "^3.
|
|
24
|
+
"@aws-sdk/client-lambda": "^3.851.0",
|
|
25
|
+
"@aws-sdk/client-s3": "^3.850.0",
|
|
26
26
|
"@aws-sdk/crc64-nvme-crt": "^3.848.0",
|
|
27
27
|
"@izara_project/izara-core-library-core": "^1.0.19",
|
|
28
28
|
"@izara_project/izara-core-library-external-request": "^1.0.20",
|
|
29
29
|
"@izara_project/izara-core-library-lambda": "^1.0.4",
|
|
30
30
|
"@izara_project/izara-core-library-logger": "^1.0.7",
|
|
31
31
|
"@izara_project/izara-shared-core": "^1.0.2",
|
|
32
|
-
"@izara_project/izara-shared-service-schemas": "^1.0.
|
|
32
|
+
"@izara_project/izara-shared-service-schemas": "^1.0.25",
|
|
33
33
|
"glob": "^11.0.3",
|
|
34
34
|
"lodash": "^4.17.21",
|
|
35
35
|
"object-hash": "^3.0.0",
|
package/src/UploadObjSchema.js
CHANGED
|
@@ -422,12 +422,12 @@ async function uploadObjectSchemaByUseCase(_izContext, bucketName) {
|
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
424
|
|
|
425
|
-
let serviceTag = objectSchema.extendObjType ? objectSchema.extendObjType.serviceTag : process.env.iz_serviceTag;
|
|
425
|
+
// let serviceTag = objectSchema.extendObjType ? objectSchema.extendObjType.serviceTag : process.env.iz_serviceTag;
|
|
426
426
|
if (graphServerTags.size) {
|
|
427
427
|
createdBys.push({
|
|
428
428
|
objType: {
|
|
429
429
|
objectType: objectSchema.objectType,
|
|
430
|
-
serviceTag:
|
|
430
|
+
serviceTag: process.env.iz_serviceTag
|
|
431
431
|
},
|
|
432
432
|
graphServerTags: [...graphServerTags]
|
|
433
433
|
})
|
package/src/ValidatorSchema.js
CHANGED
|
@@ -493,6 +493,7 @@ async function generateValidatorSchemaForCreate(_izContext, objType, settings =
|
|
|
493
493
|
// Object.assign(validatorSchemaForCreate.properties, { relationships: relationshipValidatorSchemas })
|
|
494
494
|
// }
|
|
495
495
|
|
|
496
|
+
_izContext.logger.debug("validatorSchema-create::", validatorSchemaForCreate);
|
|
496
497
|
return validatorSchemaForCreate;
|
|
497
498
|
}
|
|
498
499
|
|
|
@@ -521,18 +522,24 @@ async function generateValidatorSchemaForUpdate(_izContext, objType, settings =
|
|
|
521
522
|
let identifiersFieldNames = getUsedFieldNamesOfIdentifiers(_izContext, objectSchemas.identifiers, usedIdentifierTypes);
|
|
522
523
|
|
|
523
524
|
let canUpdateFieldNames = [];
|
|
525
|
+
let canUpdateProperties = {};
|
|
524
526
|
let usedFieldNames = identifiersFieldNames;
|
|
525
527
|
let versionedDataFieldNames = [];
|
|
526
528
|
// collect canUpdate fieldName (all fieldName have CanUpdate setting = true)
|
|
527
529
|
for (let [fieldName, fieldNameSetting] of Object.entries(objectSchemas.fieldNames)) {
|
|
528
530
|
if (fieldNameSetting.canUpdate === true || fieldNameSetting.canUpdate === undefined) {
|
|
529
531
|
canUpdateFieldNames.push(fieldName);
|
|
532
|
+
canUpdateProperties[fieldName] = {
|
|
533
|
+
type: fieldNameSetting.type,
|
|
534
|
+
}
|
|
530
535
|
if (fieldNameSetting.hasOwnProperty("versionedDataLabel")) {
|
|
531
536
|
versionedDataFieldNames.push(fieldName)
|
|
532
537
|
}
|
|
533
538
|
}
|
|
534
539
|
}
|
|
535
540
|
|
|
541
|
+
_izContext.logger.debug("canUpdate::::", { canUpdateFieldNames, canUpdateProperties });
|
|
542
|
+
|
|
536
543
|
// collect usedFieldNames
|
|
537
544
|
if (settings?.specificFieldNames) {
|
|
538
545
|
if (settings.specificFieldNames.length) {
|
|
@@ -613,11 +620,30 @@ async function generateValidatorSchemaForUpdate(_izContext, objType, settings =
|
|
|
613
620
|
}
|
|
614
621
|
|
|
615
622
|
|
|
616
|
-
|
|
617
|
-
Object.assign(
|
|
623
|
+
console.debug("initialValidatorSchemaForUpdate:::3::", initialValidatorSchemaForUpdate);
|
|
624
|
+
Object.assign(
|
|
625
|
+
initialValidatorSchemaForUpdate.properties.objInstanceFull.properties.fields,
|
|
626
|
+
await filteredFieldNamesOfValidatorSchema(
|
|
627
|
+
_izContext,
|
|
628
|
+
objType,
|
|
629
|
+
[],
|
|
630
|
+
defaultFieldNames,
|
|
631
|
+
settings.bucketName
|
|
632
|
+
)
|
|
633
|
+
);
|
|
634
|
+
|
|
635
|
+
console.debug("versionedDataReturnInFieldsObjInstanceFull::::", versionedDataReturnInFieldsObjInstanceFull);
|
|
636
|
+
console.debug("initialValidatorSchemaForUpdate:::4::", initialValidatorSchemaForUpdate);
|
|
637
|
+
Object.assign(
|
|
638
|
+
initialValidatorSchemaForUpdate.properties.objInstanceFull.properties.fields.properties,
|
|
639
|
+
{
|
|
640
|
+
...versionedDataReturnInFieldsObjInstanceFull,
|
|
641
|
+
...canUpdateProperties
|
|
642
|
+
}
|
|
643
|
+
);
|
|
618
644
|
|
|
619
|
-
_izContext.logger.debug("validatorSchema", initialValidatorSchemaForUpdate)
|
|
620
|
-
return initialValidatorSchemaForUpdate
|
|
645
|
+
_izContext.logger.debug("validatorSchema-update::", initialValidatorSchemaForUpdate);
|
|
646
|
+
return initialValidatorSchemaForUpdate;
|
|
621
647
|
}
|
|
622
648
|
|
|
623
649
|
|
|
@@ -122,8 +122,9 @@ function explodeDataField(
|
|
|
122
122
|
* @param {Object} requestParams
|
|
123
123
|
* @param {Object} objType
|
|
124
124
|
*/
|
|
125
|
-
async function explodedDataForCreate(_izContext, requestParams, objectSchema) {
|
|
126
|
-
|
|
125
|
+
async function explodedDataForCreate(_izContext, requestParams, objectSchema, settings) {
|
|
126
|
+
_izContext.logger.debug("explodedDataForCreate::", { requestParams, objectSchema });
|
|
127
|
+
_izContext.logger.debug("settings: ", settings);
|
|
127
128
|
// ------- validate requestParams -------
|
|
128
129
|
let errors = [];
|
|
129
130
|
|
|
@@ -225,10 +226,9 @@ async function explodedDataForCreate(_izContext, requestParams, objectSchema) {
|
|
|
225
226
|
* @param {Object} requestParams
|
|
226
227
|
* @param {Object} objType
|
|
227
228
|
*/
|
|
228
|
-
async function explodedDataForIdentifiers(_izContext, requestParams, objectSchema) {
|
|
229
|
-
_izContext.logger.debug("explodedDataForIdentifiers
|
|
230
|
-
|
|
231
|
-
);
|
|
229
|
+
async function explodedDataForIdentifiers(_izContext, requestParams, objectSchema, settings) {
|
|
230
|
+
_izContext.logger.debug("explodedDataForIdentifiers::", { requestParams, objectSchema });
|
|
231
|
+
_izContext.logger.debug("settings: ", settings);
|
|
232
232
|
|
|
233
233
|
// ------- manual validate requestParams -------
|
|
234
234
|
let errors = [];
|
|
@@ -339,13 +339,10 @@ async function explodedDataForIdentifiers(_izContext, requestParams, objectSchem
|
|
|
339
339
|
return explodedReqParams;
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
-
async function explodedDataForUpdate(_izContext, requestParams, objectSchema) {
|
|
342
|
+
async function explodedDataForUpdate(_izContext, requestParams, objectSchema, settings) {
|
|
343
343
|
//validate requestParams
|
|
344
|
-
_izContext.logger.debug("explodedDataForUpdate::",
|
|
345
|
-
|
|
346
|
-
requestParams, objectSchema, settings
|
|
347
|
-
}
|
|
348
|
-
)
|
|
344
|
+
_izContext.logger.debug("explodedDataForUpdate::", { requestParams, objectSchema });
|
|
345
|
+
_izContext.logger.debug("settings: ", settings);
|
|
349
346
|
let errorsFound = [];
|
|
350
347
|
|
|
351
348
|
const propertiesTypeForUpdate = {
|
|
@@ -465,6 +462,15 @@ async function explodedDataForUpdate(_izContext, requestParams, objectSchema) {
|
|
|
465
462
|
)
|
|
466
463
|
)
|
|
467
464
|
}
|
|
465
|
+
|
|
466
|
+
for (let reqKey in requestParams) {
|
|
467
|
+
if (reqKey === "fieldNames") {
|
|
468
|
+
continue;
|
|
469
|
+
}
|
|
470
|
+
Object.assign(explodedReqParams, { [reqKey]: requestParams[reqKey] });
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
console.debug("explodedReqParams-update", JSON.stringify(explodedReqParams, null, 2));
|
|
468
474
|
return explodedReqParams
|
|
469
475
|
}
|
|
470
476
|
|