@izara_project/izara-core-library-service-schemas 1.0.108 → 1.0.110
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 +1 -1
- package/src/Consts.js +103 -1
- package/src/Utils.js +12 -1
- package/src/ValidatorSchema.js +14 -0
- package/src/libs/DataDetailsLib.js +16 -15
package/package.json
CHANGED
package/src/Consts.js
CHANGED
|
@@ -353,6 +353,98 @@ function firstLetterLowerCase(str) {
|
|
|
353
353
|
|
|
354
354
|
// --------- End Upload path ---------------
|
|
355
355
|
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
const PREFIX = {
|
|
359
|
+
updateRel: 'updateRelationshipEndpoint',
|
|
360
|
+
createRel: 'createRelationshipEndpoint',
|
|
361
|
+
deleteRel: 'deleteRelationshipEndpoint',
|
|
362
|
+
updateNode: 'updateNodeEndpoint',
|
|
363
|
+
createNode: 'createNodeEndpoint',
|
|
364
|
+
getRel: 'getRelationshipEndpoint',
|
|
365
|
+
changeRel: 'changeRelationshipEndpoint',
|
|
366
|
+
ONE: 'one',
|
|
367
|
+
MANY: 'many',
|
|
368
|
+
CREATE_OBJECT_ASYNC: 'createObjectAsync',
|
|
369
|
+
CREATE_OBJECT_ASYNC_COMPLETE: 'createObjectAsyncComplete',
|
|
370
|
+
CREATE_OBJECT_EXTERNAL_TOPIC: 'createObjectExternalTopic'
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
const TOPIC_NAME_GRAPH_HANDLER = {
|
|
374
|
+
inUpdateRel: 'UpdateRelationship_In',
|
|
375
|
+
inCreateRel: 'CreateRelationship_In',
|
|
376
|
+
outUpdateRel: 'UpdateRelationship_Out',
|
|
377
|
+
outCreateRel: 'CreateRelationship_Out',
|
|
378
|
+
inDeleteRel: 'DeleteRelationship_In',
|
|
379
|
+
outDeleteRel: 'DeleteRelationship_Out',
|
|
380
|
+
inUpdateNode: 'UpdateNode_In',
|
|
381
|
+
outUpdateNode: 'UpdateNode_Out',
|
|
382
|
+
inCreateNode: 'CreateNode_In',
|
|
383
|
+
outCreateNode: 'CreateNode_Out',
|
|
384
|
+
inDeleteNode: 'DeleteNode_In',
|
|
385
|
+
outDeleteNode: 'DeleteNode_Out',
|
|
386
|
+
inChangeRelationship: 'ChangeRelationshipType_In',
|
|
387
|
+
outChangeRelationship: 'ChangeRelationshipType_Out',
|
|
388
|
+
inMoveRelationship: 'MoveRelationship_In',
|
|
389
|
+
outMoveRelationship: 'MoveRelationship_Out'
|
|
390
|
+
};
|
|
391
|
+
|
|
392
|
+
const TOPIC_NAME_GENERATE_CODE = {
|
|
393
|
+
updateRelComplete: 'UpdateRelationshipComplete',
|
|
394
|
+
createRelComplete: 'CreateRelationshipComplete',
|
|
395
|
+
deleteRelComplete: 'DeleteRelationshipComplete',
|
|
396
|
+
getRelComplete: 'GetRelationshipComplete',
|
|
397
|
+
outUpdateRelComplete: 'UpdateRelationshipComplete_Out',
|
|
398
|
+
outCreateRelComplete: 'CreateRelationshipComplete_Out',
|
|
399
|
+
outDeleteRelComplete: 'DeleteRelationshipComplete_Out',
|
|
400
|
+
outGetRelComplete: 'GetRelationshipComplete_Out',
|
|
401
|
+
updateNodeComplete: 'UpdateNodeComplete',
|
|
402
|
+
outUpdateNodeComplete: 'UpdateNodeComplete_Out',
|
|
403
|
+
createNodeComplete: 'CreateObjectComplete',
|
|
404
|
+
outCreateNodeComplete: 'CreateObjectComplete_Out',
|
|
405
|
+
deleteNodeComplete: 'DeleteNodeComplete',
|
|
406
|
+
outDeleteNodeComplete: 'DeleteNodeComplete_Out',
|
|
407
|
+
getNodeComplete: 'GetNodeComplete',
|
|
408
|
+
outGetNodeComplete: 'GetNodeComplete_Out',
|
|
409
|
+
reservedLimitComplete: 'ReservedLimitComplete',
|
|
410
|
+
createPresignUrl: 'CreatePresignUrl',
|
|
411
|
+
flowSchemaOwnTopicComplete: 'FlowSchemaOwnTopicComplete',
|
|
412
|
+
flowSchemaOwnTopicEndpointComplete: 'FlowSchemaOwnTopicEndpointComplete',
|
|
413
|
+
createRecordComplete: 'CreateRecordComplete',
|
|
414
|
+
changeRelationshipComplete: 'ChangeRelationshipComplete',
|
|
415
|
+
outChangeRelationshipComplete: 'ChangeRelationshipComplete_Out',
|
|
416
|
+
moveRelationshipComplete: 'MoveRelationshipComplete',
|
|
417
|
+
outMoveRelationshipComplete: 'MoveRelationshipComplete_Out'
|
|
418
|
+
};
|
|
419
|
+
|
|
420
|
+
const GRAPH_HANDLER_SERVICE_NAME = {
|
|
421
|
+
graphHandler: 'GraphHandler'
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
const ACCOUNTLIMIT_TAG = {
|
|
425
|
+
staticLimit: 'staticLimit',
|
|
426
|
+
reservedDynamic: 'reservedDynamic'
|
|
427
|
+
};
|
|
428
|
+
|
|
429
|
+
const LIMIT_TAG = {
|
|
430
|
+
uploadImage: 'uploadImageS3',
|
|
431
|
+
uploadData: 'uploadDataS3'
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
const RBAC_TYPE = {
|
|
435
|
+
appLevel: 'AppLevel',
|
|
436
|
+
userLevel: 'UserLevel'
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
const TOPIC_NAME_EXTERNAL_SERVICE = {
|
|
440
|
+
staticLimitProcessComplete: 'StaticLimitProcessComplete_Out',
|
|
441
|
+
reservedDynamicUsageComplete: 'ReservedDynamicUsageComplete_Out'
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
const EXTERNAL_SERVICE_NAME = {
|
|
445
|
+
accountLimits: 'AccountLimits'
|
|
446
|
+
};
|
|
447
|
+
|
|
356
448
|
export default {
|
|
357
449
|
LOCAL_OBJECT_SCHEMA_PATH: './src/schemas', // schema folder path in lambda environment
|
|
358
450
|
|
|
@@ -381,5 +473,15 @@ export default {
|
|
|
381
473
|
createValidationFieldNameForEachType,
|
|
382
474
|
|
|
383
475
|
firstLetterUpperCase,
|
|
384
|
-
firstLetterLowerCase
|
|
476
|
+
firstLetterLowerCase,
|
|
477
|
+
|
|
478
|
+
TOPIC_NAME_GENERATE_CODE,
|
|
479
|
+
TOPIC_NAME_GRAPH_HANDLER,
|
|
480
|
+
PREFIX,
|
|
481
|
+
GRAPH_HANDLER_SERVICE_NAME,
|
|
482
|
+
ACCOUNTLIMIT_TAG,
|
|
483
|
+
LIMIT_TAG,
|
|
484
|
+
RBAC_TYPE,
|
|
485
|
+
TOPIC_NAME_EXTERNAL_SERVICE,
|
|
486
|
+
EXTERNAL_SERVICE_NAME
|
|
385
487
|
}
|
package/src/Utils.js
CHANGED
|
@@ -835,6 +835,14 @@ async function messageToDlq(record, messageFailError, queueUrl) {
|
|
|
835
835
|
}
|
|
836
836
|
|
|
837
837
|
|
|
838
|
+
function firstLetterUpperCase(str) {
|
|
839
|
+
return str.charAt(0).toUpperCase() + str.slice(1)
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
function firstLetterLowerCase(str) {
|
|
843
|
+
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
844
|
+
}
|
|
845
|
+
|
|
838
846
|
export default {
|
|
839
847
|
createObjType,
|
|
840
848
|
getIdentifierTypeByPriority,
|
|
@@ -864,5 +872,8 @@ export default {
|
|
|
864
872
|
getApiLinksV2,
|
|
865
873
|
|
|
866
874
|
createFieldForUpdateDynamoDb,
|
|
867
|
-
messageToDlq
|
|
875
|
+
messageToDlq,
|
|
876
|
+
|
|
877
|
+
firstLetterUpperCase,
|
|
878
|
+
firstLetterLowerCase,
|
|
868
879
|
}
|
package/src/ValidatorSchema.js
CHANGED
|
@@ -1212,6 +1212,20 @@ async function validateLocalSchema(_izContext, schemasPath, serviceConfigPath) {
|
|
|
1212
1212
|
validateStatus.referenceErrors.push(`Relationship:${relTagName} /links/${linkIdx} /from/objType > Not found objectSchema ${JSON.stringify(link.to.objType)} `);
|
|
1213
1213
|
}
|
|
1214
1214
|
}
|
|
1215
|
+
|
|
1216
|
+
if (fromObjectSchema.hasOwnProperty("generatedBy") || toObjectSchema.hasOwnProperty("generatedBy")) {
|
|
1217
|
+
if (fromObjectSchema.generatedBy === "searchResultGenerated" || toObjectSchema.generatedBy === "searchResultGenerated") {
|
|
1218
|
+
let storageResourceTagsLink = link.storageResourceTags
|
|
1219
|
+
for (const storageResourceTagLink of storageResourceTagsLink) {
|
|
1220
|
+
for (const storageDataDetail of relData.storageResources[storageResourceTagLink]) {
|
|
1221
|
+
if (storageDataDetail.storageType !== consts.STORAGE_TYPES.lambda) {
|
|
1222
|
+
validateStatus.status = false;
|
|
1223
|
+
validateStatus.validateErrors.push(`Relationship:${relTagName} storageResource with generateBy:searchResultGenerated must be lambda type`);
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
}
|
|
1215
1229
|
})
|
|
1216
1230
|
)
|
|
1217
1231
|
// validate duplicate link
|
|
@@ -18,6 +18,7 @@ along with this program.If not, see < http://www.gnu.org/licenses/>.
|
|
|
18
18
|
import { NoRetryError } from "@izara_project/izara-core-library-core";
|
|
19
19
|
import serviceConfig from "../ServiceConfig.js";
|
|
20
20
|
import utils from "../Utils.js";
|
|
21
|
+
import consts from '../Consts.js'
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* helper function for get endpoint
|
|
@@ -78,7 +79,7 @@ async function createGetDataDetails(
|
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
|
|
81
|
-
if (storageData.storageType ===
|
|
82
|
+
if (storageData.storageType === consts.STORAGE_TYPES.graph) {
|
|
82
83
|
let useStorageTag = storageTag;
|
|
83
84
|
let graphServiceTag = await serviceConfig.getGraphServiceTagWithCache(
|
|
84
85
|
_izContext,
|
|
@@ -132,7 +133,7 @@ async function createGetDataDetails(
|
|
|
132
133
|
});
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
|
-
} else if (storageData.storageType ===
|
|
136
|
+
} else if (storageData.storageType === consts.STORAGE_TYPES.dynamoDB) {
|
|
136
137
|
let serviceTag = storageData.serviceTag || process.env.iz_serviceTag;
|
|
137
138
|
Object.assign(getDynamoDbDataDetails, {
|
|
138
139
|
[storageTag]: {
|
|
@@ -285,7 +286,7 @@ function collectGetData(
|
|
|
285
286
|
}
|
|
286
287
|
|
|
287
288
|
// this process will add result from graph and dynamo to collectedData object by add identifiers and fieldName from getData
|
|
288
|
-
if (getDataDetail.storageType ===
|
|
289
|
+
if (getDataDetail.storageType === consts.STORAGE_TYPES.graph) {
|
|
289
290
|
if (
|
|
290
291
|
getData.returnValue.queryResults.refactoredNodes.objInstanceFull &&
|
|
291
292
|
Object.keys(
|
|
@@ -336,7 +337,7 @@ function collectGetData(
|
|
|
336
337
|
);
|
|
337
338
|
}
|
|
338
339
|
} else if (
|
|
339
|
-
getDataDetail.storageType ===
|
|
340
|
+
getDataDetail.storageType === consts.STORAGE_TYPES.dynamoDB
|
|
340
341
|
) {
|
|
341
342
|
for (const getDetailFieldName of getDataDetail.fieldNames) {
|
|
342
343
|
if (addedFieldNames.has(getDetailFieldName)) {
|
|
@@ -394,7 +395,7 @@ async function createUpdateDataDetail(
|
|
|
394
395
|
}
|
|
395
396
|
}
|
|
396
397
|
}
|
|
397
|
-
if (storageProperties.storageType ===
|
|
398
|
+
if (storageProperties.storageType === consts.STORAGE_TYPES.graph) {
|
|
398
399
|
let graphStorageTagPerGraphServiceTag = {};
|
|
399
400
|
let useStorageTag = storageTag;
|
|
400
401
|
let graphServiceName = await serviceConfig.getGraphServiceTagWithCache(
|
|
@@ -428,7 +429,7 @@ async function createUpdateDataDetail(
|
|
|
428
429
|
];
|
|
429
430
|
}
|
|
430
431
|
} else if (
|
|
431
|
-
storageProperties.storageType ===
|
|
432
|
+
storageProperties.storageType === consts.STORAGE_TYPES.dynamoDB
|
|
432
433
|
) {
|
|
433
434
|
let serviceTag =
|
|
434
435
|
storageProperties.serviceTag || process.env.iz_serviceTag;
|
|
@@ -468,7 +469,7 @@ async function createDataDetailsLib(
|
|
|
468
469
|
_izContext.logger.debug('Lib: createDataDetailsLib:', {
|
|
469
470
|
objectSchemas: objectSchemas
|
|
470
471
|
});
|
|
471
|
-
|
|
472
|
+
|
|
472
473
|
let createDataDetails = {};
|
|
473
474
|
|
|
474
475
|
let storageResources = objectSchemas.storageResources;
|
|
@@ -487,7 +488,7 @@ async function createDataDetailsLib(
|
|
|
487
488
|
} else {
|
|
488
489
|
if (
|
|
489
490
|
storageResources[eachStorageResourceTag].storageType ==
|
|
490
|
-
|
|
491
|
+
consts.STORAGE_TYPES.dynamoDB
|
|
491
492
|
) {
|
|
492
493
|
if (createDataDetails.hasOwnProperty(eachStorageResourceTag)) {
|
|
493
494
|
// _izContext.logger.debug("SAME STG DB", eachStorageResourceTag);
|
|
@@ -497,7 +498,7 @@ async function createDataDetailsLib(
|
|
|
497
498
|
} else {
|
|
498
499
|
Object.assign(createDataDetails, {
|
|
499
500
|
[eachStorageResourceTag]: {
|
|
500
|
-
storageType:
|
|
501
|
+
storageType: consts.STORAGE_TYPES.dynamoDB,
|
|
501
502
|
tableName: storageResources[eachStorageResourceTag].tableName,
|
|
502
503
|
serviceTag:
|
|
503
504
|
storageResources[eachStorageResourceTag].serviceTag ||
|
|
@@ -520,7 +521,7 @@ async function createDataDetailsLib(
|
|
|
520
521
|
}
|
|
521
522
|
} else if (
|
|
522
523
|
storageResources[eachStorageResourceTag].storageType ==
|
|
523
|
-
|
|
524
|
+
consts.STORAGE_TYPES.graph
|
|
524
525
|
) {
|
|
525
526
|
let checkGraphServerTags =
|
|
526
527
|
await serviceConfig.getGraphServiceTagWithCache(
|
|
@@ -538,7 +539,7 @@ async function createDataDetailsLib(
|
|
|
538
539
|
// _izContext.logger.debug("NEW STG", checkGraphServerTags);
|
|
539
540
|
Object.assign(createDataDetails, {
|
|
540
541
|
[checkGraphServerTags]: {
|
|
541
|
-
storageType:
|
|
542
|
+
storageType: consts.STORAGE_TYPES.graph,
|
|
542
543
|
fieldNames: [keyFieldName]
|
|
543
544
|
}
|
|
544
545
|
});
|
|
@@ -546,7 +547,7 @@ async function createDataDetailsLib(
|
|
|
546
547
|
}
|
|
547
548
|
} else if (
|
|
548
549
|
storageResources[eachStorageResourceTag].storageType ===
|
|
549
|
-
|
|
550
|
+
consts.STORAGE_TYPES.externalTopic
|
|
550
551
|
) {
|
|
551
552
|
let topicName =
|
|
552
553
|
storageResources[eachStorageResourceTag].serviceTag +
|
|
@@ -554,7 +555,7 @@ async function createDataDetailsLib(
|
|
|
554
555
|
storageResources[eachStorageResourceTag].topicName;
|
|
555
556
|
Object.assign(createDataDetails, {
|
|
556
557
|
[topicName]: {
|
|
557
|
-
storageType:
|
|
558
|
+
storageType: consts.STORAGE_TYPES.externalTopic,
|
|
558
559
|
fieldNames: [keyFieldName],
|
|
559
560
|
accountId: storageResources[eachStorageResourceTag].accountId,
|
|
560
561
|
region: storageResources[eachStorageResourceTag].region,
|
|
@@ -582,7 +583,7 @@ async function createDeleteDataDetail(
|
|
|
582
583
|
for (let [storageTag, storageProperties] of Object.entries(
|
|
583
584
|
objectSchema.storageResources
|
|
584
585
|
)) {
|
|
585
|
-
if (storageProperties.storageType ===
|
|
586
|
+
if (storageProperties.storageType === consts.STORAGE_TYPES.dynamoDB) {
|
|
586
587
|
let serviceTag =
|
|
587
588
|
storageProperties.serviceTag || process.env.iz_serviceTag;
|
|
588
589
|
Object.assign(deleteDynamoDataDetail, {
|
|
@@ -598,7 +599,7 @@ async function createDeleteDataDetail(
|
|
|
598
599
|
});
|
|
599
600
|
}
|
|
600
601
|
} else if (
|
|
601
|
-
storageProperties.storageType ===
|
|
602
|
+
storageProperties.storageType === consts.STORAGE_TYPES.graph
|
|
602
603
|
) {
|
|
603
604
|
let dataDetailPerGraphStorage = {};
|
|
604
605
|
let useStorageTag = storageTag;
|