@izara_project/izara-core-library-service-schemas 1.0.61 → 1.0.63
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 -4
- package/src/GetObjectSchema.js +1 -1
- package/src/ServiceConfig.js +1 -1
- package/src/SharedUtils.js +12 -4
- package/src/UploadObjSchema.js +9 -11
- package/src/Utils.js +18 -4
- package/src/ValidatorSchema.js +1 -1
- package/src/libs/CreateNodeLib.js +108 -55
- package/src/libs/RelSchemaLib.js +1 -1
- package/src/libs/UploadUseCase.js +8 -1
- package/src/libs/s3Utils.js +1 -1
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.63",
|
|
4
4
|
"description": "Schemas for the service and objects it controls",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -24,11 +24,12 @@
|
|
|
24
24
|
"@aws-sdk/client-s3": "^3.787.0",
|
|
25
25
|
"@aws-sdk/crc64-nvme-crt": "^3.787.0",
|
|
26
26
|
"@izara_project/izara-core-library-core": "^1.0.19",
|
|
27
|
-
"@izara_project/izara-core-library-external-request": "^1.0.
|
|
27
|
+
"@izara_project/izara-core-library-external-request": "^1.0.20",
|
|
28
28
|
"@izara_project/izara-core-library-lambda": "^1.0.4",
|
|
29
29
|
"@izara_project/izara-core-library-logger": "^1.0.7",
|
|
30
|
-
"@izara_project/izara-shared-
|
|
31
|
-
"
|
|
30
|
+
"@izara_project/izara-shared-core": "^1.0.2",
|
|
31
|
+
"@izara_project/izara-shared-service-schemas": "^1.0.13",
|
|
32
|
+
"glob": "^11.0.2",
|
|
32
33
|
"lodash": "^4.17.21",
|
|
33
34
|
"object-hash": "^3.0.0",
|
|
34
35
|
"read-yaml-file": "^2.1.0"
|
package/src/GetObjectSchema.js
CHANGED
|
@@ -20,9 +20,9 @@ along with this program.If not, see < http://www.gnu.org/licenses/>.
|
|
|
20
20
|
|
|
21
21
|
const glob = require('glob')
|
|
22
22
|
const path = require('path')
|
|
23
|
-
const hash = require('object-hash');
|
|
24
23
|
const lodash = require('lodash');
|
|
25
24
|
|
|
25
|
+
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
26
26
|
|
|
27
27
|
const sharedServiceSchema = require("@izara_project/izara-shared-service-schemas");
|
|
28
28
|
const {
|
package/src/ServiceConfig.js
CHANGED
|
@@ -17,7 +17,7 @@ along with this program.If not, see < http://www.gnu.org/licenses/>.
|
|
|
17
17
|
|
|
18
18
|
'use strict';
|
|
19
19
|
|
|
20
|
-
const hash = require(
|
|
20
|
+
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
21
21
|
|
|
22
22
|
const { inMemoryCacheLib } = require('@izara_project/izara-core-library-core');
|
|
23
23
|
|
package/src/SharedUtils.js
CHANGED
|
@@ -17,7 +17,7 @@ along with this program.If not, see < http://www.gnu.org/licenses/>.
|
|
|
17
17
|
|
|
18
18
|
'use strict';
|
|
19
19
|
|
|
20
|
-
const hash = require('
|
|
20
|
+
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
21
21
|
|
|
22
22
|
const {
|
|
23
23
|
validateGraphServerTags,
|
|
@@ -435,13 +435,21 @@ async function _processObjectLinksGroup(_izContext, relationshipTag, objectLinks
|
|
|
435
435
|
direction
|
|
436
436
|
);
|
|
437
437
|
|
|
438
|
+
let linkStorageResources = newLinkRelSchema.storageResourceTags.reduce((acc, tag) => {
|
|
439
|
+
const storageResource = relationshipSchema.storageResources[tag];
|
|
440
|
+
if (storageResource) {
|
|
441
|
+
acc[tag] = storageResource;
|
|
442
|
+
}
|
|
443
|
+
return acc;
|
|
444
|
+
}, {});
|
|
445
|
+
|
|
438
446
|
// Build link object structure
|
|
439
447
|
const link = {
|
|
440
448
|
relType: {
|
|
441
449
|
relationshipTag: relType.relationshipTag,
|
|
442
450
|
serviceTag: relType.serviceTag
|
|
443
451
|
},
|
|
444
|
-
|
|
452
|
+
storageResources: linkStorageResources,
|
|
445
453
|
from: newLinkRelSchema.from,
|
|
446
454
|
to: newLinkRelSchema.to,
|
|
447
455
|
canDelete: newLinkRelSchema.canDelete,
|
|
@@ -503,8 +511,8 @@ async function _processObjectLinksGroup(_izContext, relationshipTag, objectLinks
|
|
|
503
511
|
relationshipSchema.links.push(newLinkRelSchema);
|
|
504
512
|
linkByLinkTypeIds.push({ linkTypeId, link });
|
|
505
513
|
|
|
506
|
-
_izContext.logger.debug('relationshipSchema:', relationshipSchema);
|
|
507
|
-
_izContext.logger.debug('linkByLinkTypeIds:', linkByLinkTypeIds);
|
|
514
|
+
// _izContext.logger.debug('relationshipSchema:', relationshipSchema);
|
|
515
|
+
// _izContext.logger.debug('linkByLinkTypeIds:', linkByLinkTypeIds);
|
|
508
516
|
|
|
509
517
|
} catch (error) {
|
|
510
518
|
_izContext.logger.error('Error in addLinks:', error);
|
package/src/UploadObjSchema.js
CHANGED
|
@@ -460,6 +460,7 @@ async function uploadObjectSchemaByUseCase(_izContext) {
|
|
|
460
460
|
}
|
|
461
461
|
|
|
462
462
|
// ------------ Upload Relationship ------------------
|
|
463
|
+
let setRelationships = new Set();
|
|
463
464
|
if (allObjectRelationships) {
|
|
464
465
|
|
|
465
466
|
// upload relationshipTag
|
|
@@ -499,7 +500,6 @@ async function uploadObjectSchemaByUseCase(_izContext) {
|
|
|
499
500
|
}
|
|
500
501
|
|
|
501
502
|
// send params to translateIds to create permission fpr query dynamoDB
|
|
502
|
-
let setRelationships = new Set();
|
|
503
503
|
for (const [storageResourceTag, storageResource] of Object.entries(relTagDetail[relationshipTag].storageResources)) {
|
|
504
504
|
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
505
505
|
for (const link of relTagDetail[relationshipTag].links) {
|
|
@@ -514,17 +514,15 @@ async function uploadObjectSchemaByUseCase(_izContext) {
|
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
516
|
}
|
|
517
|
-
let arrayRelationships = [...setRelationships]
|
|
518
|
-
await lambda.invokeSync(_izContext,
|
|
519
|
-
await lambdaSharedLib.lambdaFunctionName(_izContext, "CreatePermissionHdrInv", "TranslateIds"),
|
|
520
|
-
{
|
|
521
|
-
relationships: arrayRelationships
|
|
522
|
-
}
|
|
523
|
-
)
|
|
524
|
-
|
|
525
517
|
}// per relationshipTag
|
|
526
|
-
|
|
527
|
-
|
|
518
|
+
|
|
519
|
+
let arrayRelationships = [...setRelationships]
|
|
520
|
+
await lambda.invokeSync(_izContext,
|
|
521
|
+
await lambdaSharedLib.lambdaFunctionName(_izContext, "CreatePermissionHdrInv", "TranslateIds"),
|
|
522
|
+
{
|
|
523
|
+
relationships: arrayRelationships
|
|
524
|
+
}
|
|
525
|
+
)
|
|
528
526
|
|
|
529
527
|
const linksPerObjectTyjpe = groupLinksPerObjectType(_izContext, allObjectRelationships, foundedObjectTypes)
|
|
530
528
|
|
package/src/Utils.js
CHANGED
|
@@ -17,7 +17,7 @@ along with this program.If not, see < http://www.gnu.org/licenses/>.
|
|
|
17
17
|
|
|
18
18
|
'use strict';
|
|
19
19
|
|
|
20
|
-
const hash = require('
|
|
20
|
+
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
21
21
|
const {
|
|
22
22
|
NoRetryError,
|
|
23
23
|
validator: { validateObject }
|
|
@@ -264,10 +264,11 @@ function validateAddOnDataStructure(_izContext, objectSchema) {
|
|
|
264
264
|
const storageResources = objectSchema.storageResources;
|
|
265
265
|
const storageTags = storageResources ? new Set(Object.keys(storageResources)) : new Set();
|
|
266
266
|
|
|
267
|
-
const allowedAddOnDataStructures = new Set(["versionedData", "attributeTree", "propertyNode", "translation"]);
|
|
267
|
+
const allowedAddOnDataStructures = new Set(["versionedData", "attributeTree", "propertyNode", "translation", "propertyValue"]);
|
|
268
268
|
|
|
269
269
|
let errors = [];
|
|
270
270
|
let fieldNameCollection = Object.keys(objectSchema.fieldNames || {});
|
|
271
|
+
let attriutebuteTreeTags = [];
|
|
271
272
|
|
|
272
273
|
if (objectSchema.addOnDataStructure?.length) {
|
|
273
274
|
for (const [idx, addOn] of objectSchema.addOnDataStructure.entries()) {
|
|
@@ -378,10 +379,17 @@ function validateRelationshipSchema(_izContext, relationshipSchema) {
|
|
|
378
379
|
if (link.from?.requiredOnCreate === true && link.to?.requiredOnCreate === true) {
|
|
379
380
|
errors.push(`Relationship:${relationshipTag}/links/${linkIdx}, requiredOnCreate should exists in one of 'from' or 'to'`);
|
|
380
381
|
}
|
|
382
|
+
|
|
383
|
+
for (const direction of Object.keys(link)) {
|
|
384
|
+
if (direction === "from" || direction === "to") {
|
|
385
|
+
if (link[direction]?.requiredOnCreate === true && link[switchDirection(direction)].linkType === "many") {
|
|
386
|
+
errors.push(`Relationship:${relationshipTag}/link/${linkIdx}/${switchDirection(direction)}.linkType must be one if ${direction}.requiredOnCreate = ${link[direction].requiredOnCreate}`)
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
381
390
|
}
|
|
382
391
|
}
|
|
383
392
|
|
|
384
|
-
|
|
385
393
|
if (errors.length) {
|
|
386
394
|
return [false, errors];
|
|
387
395
|
} else {
|
|
@@ -395,7 +403,6 @@ function validateRelationshipSchema(_izContext, relationshipSchema) {
|
|
|
395
403
|
}
|
|
396
404
|
}
|
|
397
405
|
|
|
398
|
-
|
|
399
406
|
function validateRefRelationshipSchema(_izContext, refRelationshipSchema, serviceTag) {
|
|
400
407
|
let validateStatus = validateObject(refRelationshipBasicSchema, refRelationshipSchema, null, { strict: false });
|
|
401
408
|
if (validateStatus.pass) {
|
|
@@ -606,6 +613,13 @@ function validateBasicFlowSchema(_izContext, flowSchema) {
|
|
|
606
613
|
}
|
|
607
614
|
}
|
|
608
615
|
|
|
616
|
+
function switchDirection(direction) {
|
|
617
|
+
if (direction === "from") {
|
|
618
|
+
return "to"
|
|
619
|
+
} else if (direction === "to") {
|
|
620
|
+
return "from"
|
|
621
|
+
}
|
|
622
|
+
}
|
|
609
623
|
|
|
610
624
|
module.exports = {
|
|
611
625
|
createObjType,
|
package/src/ValidatorSchema.js
CHANGED
|
@@ -18,7 +18,6 @@ along with this program.If not, see < http://www.gnu.org/licenses/>.
|
|
|
18
18
|
'use strict';
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
const hash = require('object-hash');
|
|
22
21
|
const readYamlFile = require('read-yaml-file');
|
|
23
22
|
const lodash = require('lodash')
|
|
24
23
|
const { inMemoryCacheLib, NoRetryError } = require('@izara_project/izara-core-library-core');
|
|
@@ -27,6 +26,7 @@ const uploadUseCase = require('./libs/UploadUseCase')
|
|
|
27
26
|
|
|
28
27
|
const { getGraphServiceTag, getServiceName } = require('./ServiceConfig')
|
|
29
28
|
|
|
29
|
+
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
30
30
|
const {
|
|
31
31
|
validateObjectSchema,
|
|
32
32
|
validateRelationshipSchema,
|
|
@@ -16,90 +16,135 @@ along with this program.If not, see < http://www.gnu.org/licenses/>.
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
'use strict';
|
|
19
|
-
const { createRelTypeConcat, createLinkTypeId } = require('../Utils')
|
|
20
|
-
const { findLinksByObjTypes } = require('./RelSchemaLib')
|
|
19
|
+
const { createRelTypeConcat, createLinkTypeId } = require('../Utils');
|
|
21
20
|
const getObjectSchema = require('../GetObjectSchema');
|
|
21
|
+
const serviceConfig = require('../ServiceConfig');
|
|
22
|
+
const { STORAGE_TYPES } = require('../Consts')
|
|
22
23
|
|
|
23
|
-
async function
|
|
24
|
-
_izContext.logger.debug("
|
|
24
|
+
async function validateRequiredOnCreateLinks(_izContext, objType, relationships, settings = {}) {
|
|
25
|
+
_izContext.logger.debug("validateRequiredOnCreateLinks:::", { objType, relationships, settings })
|
|
26
|
+
let errorFound = [];
|
|
25
27
|
|
|
26
|
-
let
|
|
27
|
-
|
|
28
|
-
relationshipProperties.relType
|
|
29
|
-
)
|
|
30
|
-
_izContext.logger.debug("getObjectRelationship", getObjectRelationship);
|
|
28
|
+
let requiredOnCreateLinks = await getObjectSchema.getRequiredOnCreateLinksWithCache(_izContext, objType)
|
|
29
|
+
_izContext.logger.debug("requiredOnCreateLinks::", requiredOnCreateLinks)
|
|
31
30
|
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
if (!requiredOnCreateLinks.length && relationships.length > 0) {
|
|
32
|
+
errorFound.push(`not have requireOnCreate will not create relationship: ${JSON.stringify(relationships)}`)
|
|
33
|
+
}
|
|
34
34
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
let filteredRequiredOnCreateLinks = [];
|
|
36
|
+
if (settings.groupLinksByGraphServiceTag) {
|
|
37
|
+
await Promise.all(requiredOnCreateLinks.map(async requiredOnCreateLink => {
|
|
38
|
+
|
|
39
|
+
const serviceTags = await Promise.all(
|
|
40
|
+
requiredOnCreateLink.storageResourceTags.map(async (storageTag) => {
|
|
41
|
+
let storageResource = requiredOnCreateLink.storageResources[storageTag];
|
|
42
|
+
if (storageResource.storageType === STORAGE_TYPES.graph) {
|
|
43
|
+
return await serviceConfig.getGraphServiceTagWithCache(_izContext, storageResource.graphServerTag)
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
if (serviceTags.includes(settings.groupLinksByGraphServiceTag)) {
|
|
49
|
+
filteredRequiredOnCreateLinks.push(requiredOnCreateLink);
|
|
39
50
|
}
|
|
40
|
-
}
|
|
51
|
+
}))
|
|
52
|
+
} else {
|
|
53
|
+
filteredRequiredOnCreateLinks = requiredOnCreateLinks;
|
|
41
54
|
}
|
|
42
|
-
const links = await findLinksByObjTypes(_izContext, [objType, relationshipProperties.targetObjType], getObjectRelationship.links);
|
|
43
|
-
_izContext.logger.debug("links", links)
|
|
44
55
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
56
|
+
let requiredOnCreateLinkGroups = groupRequiredOnCreateLink(_izContext, filteredRequiredOnCreateLinks);
|
|
57
|
+
_izContext.logger.debug("requiredOnCreateLinkGroups::", requiredOnCreateLinkGroups);
|
|
48
58
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
59
|
+
let requiredOnCreateRelTypeConcats = createRelTypeConcatWithDirection(_izContext, requiredOnCreateLinkGroups)
|
|
60
|
+
let validateOnCreateRelationships = new Set();
|
|
61
|
+
_izContext.logger.debug("start validate relationship from requestParams")
|
|
62
|
+
for (const relationship of relationships) {
|
|
63
|
+
// validate all relationship in requestParams
|
|
64
|
+
let relTypeConcat = createRelTypeConcat(_izContext, relationship.relType)
|
|
52
65
|
|
|
53
|
-
|
|
54
|
-
|
|
66
|
+
if (!requiredOnCreateLinkGroups[relTypeConcat]) {
|
|
67
|
+
errorFound.push(`cannot create relationship ${relTypeConcat}`)
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
55
70
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
toServiceTag === secondServiceTag && toObjectType === secondObjectType;
|
|
71
|
+
// match requiredOnCreateLinks with relationshipDirection from requestParams
|
|
72
|
+
const usedLinkGroup = requiredOnCreateLinkGroups[relTypeConcat][relationship.relationshipDirection];
|
|
59
73
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
74
|
+
if (!usedLinkGroup.length) {
|
|
75
|
+
errorFound.push(`cannot create relationship ${relTypeConcat}`)
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
63
78
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
79
|
+
for (let link of usedLinkGroup) {
|
|
80
|
+
// check other with targetObjType, check linkType of other should be 'one',
|
|
81
|
+
if (link.other.objType.objectType === relationship.targetObjType.objectType) {
|
|
82
|
+
if (link.other.linkType === "one") {
|
|
83
|
+
if (!validateOnCreateRelationships.has(`${relTypeConcat}_${relationship.relationshipDirection}`)) {
|
|
84
|
+
validateOnCreateRelationships.add(`${relTypeConcat}_${relationship.relationshipDirection}`)
|
|
85
|
+
} else {
|
|
86
|
+
errorFound.push(`unexpected dulicate relationship link ${JSON.stringify(relationship)}`)
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
} else {
|
|
90
|
+
errorFound.push(`invalid linkType should not be many when base: ${link} is requiredOnCreated`)
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
69
94
|
}
|
|
70
95
|
}
|
|
71
96
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
97
|
+
_izContext.logger.debug("requiredOnCreateRelTypeConcat", requiredOnCreateRelTypeConcats)
|
|
98
|
+
_izContext.logger.debug("validatedRelationships", validateOnCreateRelationships)
|
|
99
|
+
|
|
100
|
+
for (const requiredOnCreateRelTypeConcat of requiredOnCreateRelTypeConcats) {
|
|
101
|
+
if (!validateOnCreateRelationships.has(requiredOnCreateRelTypeConcat)) {
|
|
102
|
+
errorFound.push(`missing requiredOnCreate relationship ${requiredOnCreateRelTypeConcat}`)
|
|
75
103
|
}
|
|
76
104
|
}
|
|
77
|
-
|
|
105
|
+
|
|
106
|
+
return errorFound;
|
|
78
107
|
}
|
|
79
108
|
|
|
80
|
-
function
|
|
109
|
+
function groupRequiredOnCreateLink(_izContext, relationshipSchemas) {
|
|
81
110
|
let groupLink = {};
|
|
82
|
-
for (let
|
|
83
|
-
let relTypeConcat = createRelTypeConcat(_izContext,
|
|
111
|
+
for (let relationshipSchema of relationshipSchemas) {
|
|
112
|
+
let relTypeConcat = createRelTypeConcat(_izContext, relationshipSchema.relType);
|
|
84
113
|
if (!groupLink.hasOwnProperty(relTypeConcat)) {
|
|
85
114
|
Object.assign(groupLink, {
|
|
86
115
|
[relTypeConcat]: {
|
|
87
116
|
from: [],
|
|
88
117
|
to: []
|
|
89
118
|
}
|
|
90
|
-
}
|
|
91
|
-
)
|
|
119
|
+
})
|
|
92
120
|
}
|
|
93
121
|
|
|
94
|
-
if (
|
|
95
|
-
groupLink[relTypeConcat].from.push(
|
|
96
|
-
} else {
|
|
97
|
-
groupLink[relTypeConcat].to.push(
|
|
122
|
+
if (relationshipSchema.base.direction === "from") {
|
|
123
|
+
groupLink[relTypeConcat].from.push(relationshipSchema)
|
|
124
|
+
} else if (relationshipSchema.base.direction === "to") {
|
|
125
|
+
groupLink[relTypeConcat].to.push(relationshipSchema)
|
|
98
126
|
}
|
|
99
127
|
}
|
|
100
128
|
return groupLink
|
|
101
129
|
}
|
|
102
130
|
|
|
131
|
+
function createRelTypeConcatWithDirection(_izContext, link) {
|
|
132
|
+
// console.log("createRelTypeConcat", { link })
|
|
133
|
+
let relTypeConcatSet = new Set();
|
|
134
|
+
for (const [relTypeConcat, direction] of Object.entries(link)) {
|
|
135
|
+
if (direction.from.length) {
|
|
136
|
+
relTypeConcatSet.add(`${relTypeConcat}_from`)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (direction.to.length) {
|
|
140
|
+
relTypeConcatSet.add(`${relTypeConcat}_to`)
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
}
|
|
145
|
+
return relTypeConcatSet
|
|
146
|
+
}
|
|
147
|
+
|
|
103
148
|
function createLinkTypeIdFromLinkGroup(_izContext, linkGroup) {
|
|
104
149
|
let linkTypeIds = new Set();
|
|
105
150
|
for (const objectRelationshipGroup of Object.values(linkGroup)) {
|
|
@@ -121,11 +166,19 @@ function createLinkTypeIdFromLinkGroup(_izContext, linkGroup) {
|
|
|
121
166
|
return [...linkTypeIds]
|
|
122
167
|
}
|
|
123
168
|
|
|
124
|
-
|
|
125
|
-
|
|
169
|
+
|
|
170
|
+
function switchDirection(direction) {
|
|
171
|
+
if (direction === "from") {
|
|
172
|
+
return "to"
|
|
173
|
+
} else if (direction === "to") {
|
|
174
|
+
return "from"
|
|
175
|
+
}
|
|
126
176
|
}
|
|
177
|
+
|
|
127
178
|
module.exports = {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
createLinkTypeIdFromLinkGroup
|
|
179
|
+
validateRequiredOnCreateLinks,
|
|
180
|
+
groupRequiredOnCreateLink,
|
|
181
|
+
createLinkTypeIdFromLinkGroup,
|
|
182
|
+
switchDirection,
|
|
183
|
+
createRelTypeConcatWithDirection
|
|
131
184
|
}
|
package/src/libs/RelSchemaLib.js
CHANGED
|
@@ -17,9 +17,9 @@ along with this program.If not, see < http://www.gnu.org/licenses/>.
|
|
|
17
17
|
|
|
18
18
|
'use strict';
|
|
19
19
|
|
|
20
|
-
const hash = require("object-hash");
|
|
21
20
|
const lodash = require("lodash");
|
|
22
21
|
|
|
22
|
+
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
23
23
|
const { NoRetryError } = require('@izara_project/izara-core-library-core');
|
|
24
24
|
const getObjectSchema = require("../GetObjectSchema");
|
|
25
25
|
const { validateObjType: { validateObjType } } = require("@izara_project/izara-shared-service-schemas");
|
|
@@ -380,13 +380,20 @@ function generateLinksDataPerLinkTypeId(_izContext, relationshipTag, relationshi
|
|
|
380
380
|
"from"
|
|
381
381
|
);
|
|
382
382
|
|
|
383
|
+
let linkStorageResources = link.storageResourceTags.reduce((acc, storageResourceTag) => {
|
|
384
|
+
if (storageResources.hasOwnProperty(storageResourceTag)) {
|
|
385
|
+
acc[storageResourceTag] = storageResources[storageResourceTag];
|
|
386
|
+
}
|
|
387
|
+
return acc;
|
|
388
|
+
}, {});
|
|
383
389
|
|
|
384
390
|
linksData[linkTypeId] = {
|
|
385
391
|
relType: {
|
|
386
392
|
relationshipTag,
|
|
387
393
|
serviceTag: process.env.iz_serviceTag
|
|
388
394
|
},
|
|
389
|
-
|
|
395
|
+
canDelete: link.canDelete || false,
|
|
396
|
+
storageResources: linkStorageResources,
|
|
390
397
|
from: link.from,
|
|
391
398
|
to: link.to
|
|
392
399
|
};
|
package/src/libs/s3Utils.js
CHANGED
|
@@ -28,7 +28,7 @@ const {
|
|
|
28
28
|
PutObjectCommand,
|
|
29
29
|
} = require("@aws-sdk/client-s3");
|
|
30
30
|
|
|
31
|
-
const hash = require('
|
|
31
|
+
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
32
32
|
|
|
33
33
|
const { NoRetryError, inMemoryCacheLib } = require('@izara_project/izara-core-library-core');
|
|
34
34
|
const { SCHEMA_NAME_PER_S3_PATH } = require('@izara_project/izara-shared-service-schemas').consts;
|