@izara_project/izara-core-library-service-schemas 1.0.80 → 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
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/SharedUtils.js
CHANGED
|
@@ -475,7 +475,7 @@ async function _processObjectLinksGroup(_izContext, relationshipTag, objectLinks
|
|
|
475
475
|
storageResourceTags,
|
|
476
476
|
objectRelationships,
|
|
477
477
|
relationshipSchema,
|
|
478
|
-
|
|
478
|
+
process.env.iz_serviceSchemaBucketName
|
|
479
479
|
);
|
|
480
480
|
results.push(...firstNodeResults);
|
|
481
481
|
} catch (error) {
|
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
|
@@ -466,7 +466,7 @@ async function generateValidatorSchemaForCreate(_izContext, objType, settings =
|
|
|
466
466
|
// ------- create return validatorSchema -------
|
|
467
467
|
let validatorSchemaForCreate = {
|
|
468
468
|
type: "object",
|
|
469
|
-
required: ["fieldNames"],
|
|
469
|
+
required: ["fieldNames", "objectType"],
|
|
470
470
|
properties: {
|
|
471
471
|
fieldNames: {
|
|
472
472
|
additionalProperties: false,
|
|
@@ -476,6 +476,10 @@ async function generateValidatorSchemaForCreate(_izContext, objType, settings =
|
|
|
476
476
|
...allValidatorSchemaFieldNames
|
|
477
477
|
}
|
|
478
478
|
},
|
|
479
|
+
objectType: {
|
|
480
|
+
type: "string",
|
|
481
|
+
pattern: "^[a-zA-Z0-9_-]+$"
|
|
482
|
+
},
|
|
479
483
|
additionalParams: {
|
|
480
484
|
type: "object"
|
|
481
485
|
}
|
|
@@ -489,6 +493,7 @@ async function generateValidatorSchemaForCreate(_izContext, objType, settings =
|
|
|
489
493
|
// Object.assign(validatorSchemaForCreate.properties, { relationships: relationshipValidatorSchemas })
|
|
490
494
|
// }
|
|
491
495
|
|
|
496
|
+
_izContext.logger.debug("validatorSchema-create::", validatorSchemaForCreate);
|
|
492
497
|
return validatorSchemaForCreate;
|
|
493
498
|
}
|
|
494
499
|
|
|
@@ -517,18 +522,24 @@ async function generateValidatorSchemaForUpdate(_izContext, objType, settings =
|
|
|
517
522
|
let identifiersFieldNames = getUsedFieldNamesOfIdentifiers(_izContext, objectSchemas.identifiers, usedIdentifierTypes);
|
|
518
523
|
|
|
519
524
|
let canUpdateFieldNames = [];
|
|
525
|
+
let canUpdateProperties = {};
|
|
520
526
|
let usedFieldNames = identifiersFieldNames;
|
|
521
527
|
let versionedDataFieldNames = [];
|
|
522
528
|
// collect canUpdate fieldName (all fieldName have CanUpdate setting = true)
|
|
523
529
|
for (let [fieldName, fieldNameSetting] of Object.entries(objectSchemas.fieldNames)) {
|
|
524
530
|
if (fieldNameSetting.canUpdate === true || fieldNameSetting.canUpdate === undefined) {
|
|
525
531
|
canUpdateFieldNames.push(fieldName);
|
|
532
|
+
canUpdateProperties[fieldName] = {
|
|
533
|
+
type: fieldNameSetting.type,
|
|
534
|
+
}
|
|
526
535
|
if (fieldNameSetting.hasOwnProperty("versionedDataLabel")) {
|
|
527
536
|
versionedDataFieldNames.push(fieldName)
|
|
528
537
|
}
|
|
529
538
|
}
|
|
530
539
|
}
|
|
531
540
|
|
|
541
|
+
_izContext.logger.debug("canUpdate::::", { canUpdateFieldNames, canUpdateProperties });
|
|
542
|
+
|
|
532
543
|
// collect usedFieldNames
|
|
533
544
|
if (settings?.specificFieldNames) {
|
|
534
545
|
if (settings.specificFieldNames.length) {
|
|
@@ -555,8 +566,12 @@ async function generateValidatorSchemaForUpdate(_izContext, objType, settings =
|
|
|
555
566
|
|
|
556
567
|
let initialValidatorSchemaForUpdate = {
|
|
557
568
|
type: "object",
|
|
558
|
-
required: ["objInstanceFull"],
|
|
569
|
+
required: ["objInstanceFull", "objectType"],
|
|
559
570
|
properties: {
|
|
571
|
+
objectType: {
|
|
572
|
+
type: "string",
|
|
573
|
+
pattern: "^[a-zA-Z0-9_-]+$"
|
|
574
|
+
},
|
|
560
575
|
objInstanceFull: {
|
|
561
576
|
type: "object",
|
|
562
577
|
required: ["identifiers", "fields"],
|
|
@@ -605,11 +620,30 @@ async function generateValidatorSchemaForUpdate(_izContext, objType, settings =
|
|
|
605
620
|
}
|
|
606
621
|
|
|
607
622
|
|
|
608
|
-
|
|
609
|
-
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
|
+
);
|
|
610
634
|
|
|
611
|
-
|
|
612
|
-
|
|
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
|
+
);
|
|
644
|
+
|
|
645
|
+
_izContext.logger.debug("validatorSchema-update::", initialValidatorSchemaForUpdate);
|
|
646
|
+
return initialValidatorSchemaForUpdate;
|
|
613
647
|
}
|
|
614
648
|
|
|
615
649
|
|
|
@@ -640,8 +674,12 @@ async function generateValidatorSchemaForIdentifier(_izContext, objType, setting
|
|
|
640
674
|
|
|
641
675
|
return {
|
|
642
676
|
type: "object",
|
|
643
|
-
required: ["identifiers"],
|
|
677
|
+
required: ["identifiers", "objectType"],
|
|
644
678
|
properties: {
|
|
679
|
+
objectType: {
|
|
680
|
+
type: "string",
|
|
681
|
+
pattern: "^[a-zA-Z0-9_-]+$"
|
|
682
|
+
},
|
|
645
683
|
identifiers: {
|
|
646
684
|
type: "object",
|
|
647
685
|
required: Object.keys(generatedIdentifiersValidatorSchema),
|
|
@@ -43,11 +43,10 @@ async function generateDeliminatorTreePerFieldName(_izContext, fieldName, fieldN
|
|
|
43
43
|
[fieldName]: {},
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
if (
|
|
46
|
+
if (objType) {
|
|
47
47
|
Object.assign(deliminatorTree[fieldName], objType);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
|
|
51
50
|
// ------- create tree first -------
|
|
52
51
|
|
|
53
52
|
if (fieldNameSetting.fromServiceNameTag && fieldNameSetting.fromObjectType) {
|
|
@@ -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
|
|