@izara_project/izara-core-generate-service-code 1.0.90 → 1.0.91

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.
Files changed (55) hide show
  1. package/package.json +1 -1
  2. package/src/emit/crud/emitDynamicCrudFlowSchemas.js +2 -2
  3. package/src/emit/crud/templates/CreateAfterHookCallback_Main.ejs +6 -6
  4. package/src/emit/crud/templates/CreateBeforeHookCallback_Main.ejs +3 -3
  5. package/src/emit/crud/templates/CreateComplete_Main.ejs +22 -22
  6. package/src/emit/crud/templates/CreateEndpoint_Main.ejs +18 -18
  7. package/src/emit/crud/templates/CreateLogicalLib.ejs +47 -47
  8. package/src/emit/crud/templates/CreateNodeCallback_Main.ejs +24 -24
  9. package/src/emit/crud/templates/DeleteAfterHookCallback_Main.ejs +5 -5
  10. package/src/emit/crud/templates/DeleteBeforeHookCallback_Main.ejs +3 -3
  11. package/src/emit/crud/templates/DeleteComplete_Main.ejs +23 -23
  12. package/src/emit/crud/templates/DeleteEndpoint_Main.ejs +15 -15
  13. package/src/emit/crud/templates/DeleteLogicalLib.ejs +19 -19
  14. package/src/emit/crud/templates/FlowEndpointRbacCallback_Main.ejs +3 -3
  15. package/src/emit/crud/templates/UpdateAfterHookCallback_Main.ejs +5 -5
  16. package/src/emit/crud/templates/UpdateBeforeHookCallback_Main.ejs +3 -3
  17. package/src/emit/crud/templates/UpdateComplete_Main.ejs +22 -22
  18. package/src/emit/crud/templates/UpdateEndpoint_Main.ejs +15 -15
  19. package/src/emit/crud/templates/UpdateLogicalLib.ejs +33 -33
  20. package/src/emit/custom/templates/FlowEndpointRbacCallback_Main.ejs +7 -7
  21. package/src/emit/custom/templates/s3/ConfirmReserved_HdrSqs.ejs +3 -3
  22. package/src/emit/custom/templates/s3/ConfirmReserved_Main.ejs +3 -3
  23. package/src/emit/custom/templates/s3/CreatePreSignUrl_HdrSqs.ejs +3 -3
  24. package/src/emit/custom/templates/s3/CreatePreSignUrl_Main.ejs +4 -4
  25. package/src/emit/rbac/emitDynamicRbacFlowSchemas.js +26 -6
  26. package/src/emit/rbac/emitRbacApplicationArtifacts.js +40 -13
  27. package/src/emit/rbac/templates/UserRbacFlow_Main.ejs +13 -7
  28. package/src/emit/relationship/emitDynamicRelationshipFlowSchemas.js +1 -1
  29. package/src/emit/relationship/templates/ChangeRelationshipComplete_HdrSqs.ejs +2 -2
  30. package/src/emit/relationship/templates/ChangeRelationshipComplete_Main.ejs +6 -6
  31. package/src/emit/relationship/templates/ChangeRelationship_Main.ejs +17 -17
  32. package/src/emit/relationship/templates/CreateRelationshipComplete_HdrSqs.ejs +2 -2
  33. package/src/emit/relationship/templates/CreateRelationshipComplete_Main.ejs +6 -6
  34. package/src/emit/relationship/templates/CreateRelationship_Main.ejs +14 -14
  35. package/src/emit/relationship/templates/DeleteRelationshipComplete_HdrSqs.ejs +2 -2
  36. package/src/emit/relationship/templates/DeleteRelationshipComplete_Main.ejs +6 -6
  37. package/src/emit/relationship/templates/DeleteRelationship_Main.ejs +10 -10
  38. package/src/emit/relationship/templates/GetRelationshipComplete_HdrSqs.ejs +2 -2
  39. package/src/emit/relationship/templates/GetRelationshipComplete_Main.ejs +5 -5
  40. package/src/emit/relationship/templates/GetRelationship_Main.ejs +9 -9
  41. package/src/emit/relationship/templates/MoveRelationshipComplete_HdrSqs.ejs +2 -2
  42. package/src/emit/relationship/templates/MoveRelationshipComplete_Main.ejs +6 -6
  43. package/src/emit/relationship/templates/MoveRelationship_Main.ejs +15 -15
  44. package/src/emit/relationship/templates/UpdateRelationshipComplete_HdrSqs.ejs +2 -2
  45. package/src/emit/relationship/templates/UpdateRelationshipComplete_Main.ejs +6 -6
  46. package/src/emit/relationship/templates/UpdateRelationship_Main.ejs +11 -11
  47. package/src/emit/resource/emitResourceArtifacts.js +3 -7
  48. package/src/emit/shared/templates/FindData_Main.ejs +19 -19
  49. package/src/emit/shared/templates/PaginateProcessLogical_Main.ejs +3 -3
  50. package/src/emit/shared/templates/ProcessLogical_Main.ejs +15 -15
  51. package/test/createTargetRoleHandler.test.js +62 -4
  52. package/test/crudApplicationArtifacts.test.js +3 -3
  53. package/test/dynamicCrudFlowSchemas.test.js +2 -2
  54. package/test/dynamicRbacFlowSchemas.test.js +32 -4
  55. package/test/relationshipApplicationArtifacts.test.js +1 -1
@@ -13,6 +13,7 @@ const FLOW_RBAC_YAML_PATH = 'app/sls_yaml/generatedCode/source/flow-rbac.yml';
13
13
  const FLOW_LIMITS_YAML_PATH = 'app/sls_yaml/generatedCode/source/flow-limits.yml';
14
14
  const CRUD_TEMPLATE_URL = new URL('../crud/templates/', import.meta.url);
15
15
  const RBAC_TEMPLATE_URL = new URL('./templates/', import.meta.url);
16
+ const SHARED_TEMPLATE_URL = new URL('../shared/templates/', import.meta.url);
16
17
 
17
18
  export async function emitRbacApplicationArtifacts(objects) {
18
19
  if (!Array.isArray(objects)) {
@@ -146,9 +147,8 @@ const STATIC_RBAC_APPLICATION_PATHS = [
146
147
  'app/src/generatedCode/FlowRbac/GetMyPermissions/source/GetMyPermissions_HdrSqs.js',
147
148
  'app/src/generatedCode/FlowRbac/GetMyPermissions/source/GetMyPermissions_HdrApi.js',
148
149
  'app/src/generatedCode/FlowRbac/ValidatorRbac/source/ValidatorRbac_Main.js',
149
- 'app/src/generatedCode/FlowRbac/ValidatorRbac/source/ValidatorRbac_HdrSqs.js',
150
- 'app/src/generatedCode/FlowRbac/ValidatorRbac/source/ValidatorRbac_WbsMain.js',
151
- 'app/src/generatedCode/FlowRbac/ValidatorRbac/source/ValidatorRbac_HdrWbs.js',
150
+ 'app/src/generatedCode/FlowRbac/ValidatorRbac/source/ValidatorRbac_HdrInv.js',
151
+ 'app/src/generatedCode/FlowRbac/ValidatorRbac/source/ValidatorRbac_HdrApi.js',
152
152
  ...LIST_DEFINITIONS.flatMap(({ flowTag }) => [
153
153
  `app/src/generatedCode/FlowRbac/${flowTag}/source/${flowTag}_Main.js`,
154
154
  `app/src/generatedCode/FlowRbac/${flowTag}/source/${flowTag}_HdrSqs.js`,
@@ -189,7 +189,8 @@ export function rbacApplicationManagedPaths(objects = []) {
189
189
  const sourcePath = `app/src/generatedCode/FlowRbac/${flowTag}/source`;
190
190
  return [
191
191
  `${sourcePath}/${flowTag}_Main.js`,
192
- `${sourcePath}/${flowTag}_HdrSqs.js`
192
+ `${sourcePath}/${flowTag}_HdrInv.js`,
193
+ `${sourcePath}/${flowTag}_HdrApi.js`
193
194
  ];
194
195
  });
195
196
  return [
@@ -469,6 +470,19 @@ async function createUserRbacFlowHandler(flowTagOrObject) {
469
470
  : rbacFlowTag(flowTagOrObject);
470
471
  const sourcePath = `app/src/generatedCode/FlowRbac/${flowTag}/source`;
471
472
  const handlerPath = `src/generatedCode/FlowRbac/${flowTag}/source`;
473
+ const shared = {
474
+ flowTag,
475
+ flowStepName: '',
476
+ mainFileName: `${flowTag}_Main`,
477
+ functionName: flowTag,
478
+ startConfig: {
479
+ properties: [
480
+ { propertyName: 'parentFlowId', type: 'string', required: false },
481
+ { propertyName: 'flowTypeConcat', type: 'string', required: true },
482
+ { propertyName: 'parameterGroups', type: 'object', default: {} }
483
+ ]
484
+ }
485
+ };
472
486
  return {
473
487
  artifacts: [
474
488
  {
@@ -476,20 +490,29 @@ async function createUserRbacFlowHandler(flowTagOrObject) {
476
490
  content: await renderRbacTemplate('UserRbacFlow_Main.ejs', { flowTag })
477
491
  },
478
492
  {
479
- path: `${sourcePath}/${flowTag}_HdrSqs.js`,
480
- content: await renderRbacTemplate('UserRbacFlow_HdrSqs.ejs', {
481
- flowTag
482
- })
493
+ path: `${sourcePath}/${flowTag}_HdrInv.js`,
494
+ content: await renderSharedTemplate('FlowHandler_HdrInv.ejs', shared)
495
+ },
496
+ {
497
+ path: `${sourcePath}/${flowTag}_HdrApi.js`,
498
+ content: await renderSharedTemplate('FlowHandler_HdrApi.ejs', shared)
483
499
  }
484
500
  ],
485
501
  functions: [
486
502
  {
487
- type: 'sqs',
488
- functionName: `${flowTag}HdrSqs`,
489
- handlerPath: `${handlerPath}/${flowTag}_HdrSqs.main`,
503
+ type: 'inv',
504
+ functionName: `${flowTag}HdrInv`,
505
+ handlerPath: `${handlerPath}/${flowTag}_HdrInv.main`,
490
506
  roleName: 'FlowRbacRole',
491
- queueName: `${flowTag}HdrSqs`,
492
- flowTag: flowTag,
507
+ flowTag,
508
+ flowStepName: ''
509
+ },
510
+ {
511
+ type: 'api',
512
+ functionName: `${flowTag}HdrApi`,
513
+ handlerPath: `${handlerPath}/${flowTag}_HdrApi.main`,
514
+ roleName: 'FlowRbacRole',
515
+ flowTag,
493
516
  flowStepName: ''
494
517
  }
495
518
  ]
@@ -548,6 +571,10 @@ function renderRbacTemplate(templateName, data = {}) {
548
571
  return renderTemplate(RBAC_TEMPLATE_URL, templateName, data);
549
572
  }
550
573
 
574
+ function renderSharedTemplate(templateName, data = {}) {
575
+ return renderTemplate(SHARED_TEMPLATE_URL, templateName, data);
576
+ }
577
+
551
578
  async function renderTemplate(templateUrl, templateName, data) {
552
579
  return ejsLib.render(
553
580
  await readFile(new URL(templateName, templateUrl), 'utf8'),
@@ -62,7 +62,7 @@ async function _getL2Cache(_izContext, submittedByUserId, cacheSubKey) {
62
62
  roleIdKey: result.roleIdKey || '',
63
63
  rbacType: result.rbacType || 'target'
64
64
  },
65
- errorsFound: [],
65
+ foundErrors: [],
66
66
  status: 'Completed'
67
67
  };
68
68
  }
@@ -92,10 +92,13 @@ async function _setL2Cache(_izContext, submittedByUserId, cacheSubKey, value) {
92
92
  export default async function <%- flowTag %>(_izContext, requestParams = {}) {
93
93
  const submittedByUserId =
94
94
  requestParams.submittedByUserId ||
95
+ requestParams.userId ||
95
96
  requestParams.targetIdentifiers?.submittedByUserId ||
96
- _izContext.correlationIds.get(consts.SUBMITTED_BY_USER_ID);
97
+ _izContext.correlationIds?.get(consts.SUBMITTED_BY_USER_ID) ||
98
+ _izContext.correlationIds?.get(consts.BASE_USER_ID);
97
99
 
98
- const targetIdentifiers = requestParams.targetIdentifiers;
100
+ const targetIdentifiers =
101
+ requestParams.targetIdentifiers || requestParams.identifiers;
99
102
  let targetId = '';
100
103
  if (targetIdentifiers) {
101
104
  if (typeof targetIdentifiers === 'string') {
@@ -131,7 +134,10 @@ export default async function <%- flowTag %>(_izContext, requestParams = {}) {
131
134
  throw new Error('Missing required request parameters: submittedByUserId or targetIdentifiers');
132
135
  }
133
136
 
134
- const { flowTypeConcat, inputParameterGroups, parentFlowId } = requestParams;
137
+ const flowTypeConcat = requestParams.flowTypeConcat;
138
+ const inputParameterGroups =
139
+ requestParams.parameterGroups || requestParams.inputParameterGroups || {};
140
+ const parentFlowId = requestParams.parentFlowId;
135
141
  if (!flowTypeConcat) {
136
142
  throw new Error('Missing flowTypeConcat in requestParams');
137
143
  }
@@ -166,7 +172,7 @@ export default async function <%- flowTag %>(_izContext, requestParams = {}) {
166
172
  roleIdKey: 'self_user',
167
173
  rbacType: 'self_user'
168
174
  },
169
- errorsFound: [],
175
+ foundErrors: [],
170
176
  status: 'Completed'
171
177
  };
172
178
  _setL1Cache(fullCacheKey, result);
@@ -231,7 +237,7 @@ export default async function <%- flowTag %>(_izContext, requestParams = {}) {
231
237
  roleIdKey: '',
232
238
  rbacType: 'target'
233
239
  },
234
- errorsFound: [],
240
+ foundErrors: [],
235
241
  status: 'Completed'
236
242
  };
237
243
  _setL1Cache(fullCacheKey, result);
@@ -277,7 +283,7 @@ export default async function <%- flowTag %>(_izContext, requestParams = {}) {
277
283
  roleIdKey: matched ? matched.roleIdKey : '',
278
284
  rbacType: 'target'
279
285
  },
280
- errorsFound: [],
286
+ foundErrors: [],
281
287
  status: 'Completed'
282
288
  };
283
289
 
@@ -87,7 +87,7 @@ function createDynamicRelationshipFlow(action) {
87
87
  'returnValue',
88
88
  'parentFlowId',
89
89
  'status',
90
- 'errorsFound',
90
+ 'foundErrors',
91
91
  'graphServiceTag'
92
92
  ],
93
93
  messageAttributes: MESSAGE_ATTRIBUTES
@@ -20,7 +20,7 @@ let perRecordsValidatorSchema = {
20
20
  status: {
21
21
  type: 'string'
22
22
  },
23
- errorsFound: {
23
+ foundErrors: {
24
24
  type: 'array'
25
25
  },
26
26
  graphServiceTag: {
@@ -31,7 +31,7 @@ let perRecordsValidatorSchema = {
31
31
  'returnValue',
32
32
  'parentFlowId',
33
33
  'status',
34
- 'errorsFound',
34
+ 'foundErrors',
35
35
  'graphServiceTag'
36
36
  ]
37
37
  //(<validatorSchema>)
@@ -44,7 +44,7 @@ export default async function changeRelationshipComplete(
44
44
  returnValue,
45
45
  parentFlowId,
46
46
  status,
47
- errorsFound,
47
+ foundErrors,
48
48
  graphServiceTag
49
49
  } = requestParams;
50
50
 
@@ -52,7 +52,7 @@ export default async function changeRelationshipComplete(
52
52
  returnValue: returnValue,
53
53
  parentFlowId: parentFlowId,
54
54
  status: status,
55
- errorsFound: errorsFound,
55
+ foundErrors: foundErrors,
56
56
  graphServiceTag: graphServiceTag,
57
57
  passBackProperties: passBackProperties
58
58
  });
@@ -76,7 +76,7 @@ export default async function changeRelationshipComplete(
76
76
  _izContext.logger.warn(
77
77
  `No pending step found for awaitingStepId: ${awaitingStepId}`
78
78
  );
79
- return { returnValue, status, errorsFound };
79
+ return { returnValue, status, foundErrors };
80
80
  }
81
81
 
82
82
  const result =
@@ -84,7 +84,7 @@ export default async function changeRelationshipComplete(
84
84
  _izContext,
85
85
  pending.pendingStepId,
86
86
  awaitingStepId,
87
- errorsFound
87
+ foundErrors
88
88
  );
89
89
  _izContext.logger.debug(
90
90
  '[ChangeRelationshipComplete] all awaiting steps result',
@@ -107,7 +107,7 @@ export default async function changeRelationshipComplete(
107
107
  newRelType: returnValue.requestParams.newRelType,
108
108
  parentFlowId: parentFlowId || returnValue?.parentFlowId,
109
109
  status: status,
110
- errorsFound: errorsFound
110
+ foundErrors: foundErrors
111
111
  };
112
112
 
113
113
  const callingFlowConfig =
@@ -165,7 +165,7 @@ export default async function changeRelationshipComplete(
165
165
  return {
166
166
  returnValue,
167
167
  status,
168
- errorsFound
168
+ foundErrors
169
169
  };
170
170
  } catch (err) {
171
171
  _izContext.logger.error('error createRelationshipComplete:', err);
@@ -89,7 +89,7 @@ export default async function <%- functionName %>(
89
89
  //(</requestParamCreateRel>)
90
90
  } = requestParams;
91
91
 
92
- let errorsFound = [];
92
+ let foundErrors = [];
93
93
  const parentFlowId = identifierUuid();
94
94
  //(<beforeValidateChangeRel>)
95
95
  //(</beforeValidateChangeRel>).
@@ -106,7 +106,7 @@ export default async function <%- functionName %>(
106
106
  );
107
107
 
108
108
  if (!objectSchema) {
109
- errorsFound.push(
109
+ foundErrors.push(
110
110
  `validateIdentifiers, not found schema of ${objTypeString}`
111
111
  );
112
112
  }
@@ -117,7 +117,7 @@ export default async function <%- functionName %>(
117
117
  ];
118
118
  for (const identifierName of identifierNames) {
119
119
  if (!identifiersObject.hasOwnProperty(identifierName)) {
120
- errorsFound.push(
120
+ foundErrors.push(
121
121
  `validateIdentifiers, ${objTypeString} property:${identifierName} not exists`
122
122
  );
123
123
  } else {
@@ -125,7 +125,7 @@ export default async function <%- functionName %>(
125
125
  typeof identifiersObject[identifierName] !== 'string' &&
126
126
  typeof identifiersObject[identifierName] !== 'number'
127
127
  ) {
128
- errorsFound.push(
128
+ foundErrors.push(
129
129
  `validateIdentifiers, ${objTypeString} property:${identifierName} should be string or number`
130
130
  );
131
131
  }
@@ -162,12 +162,12 @@ export default async function <%- functionName %>(
162
162
  );
163
163
  _izContext.logger.debug('newRelationshipSchema: ', newRelationshipSchema);
164
164
  if (!oldRelationshipSchema.hasOwnProperty('canChangeToRelTypes')) {
165
- errorsFound.push(
165
+ foundErrors.push(
166
166
  `${oldRelTypeAndDirection.relType} not have property to change to another relType`
167
167
  );
168
168
  } else {
169
169
  if (!newRelationshipSchema) {
170
- errorsFound.push(
170
+ foundErrors.push(
171
171
  `${newRelationshipSchema} not exists can't changeToRelType`
172
172
  );
173
173
  } else {
@@ -184,7 +184,7 @@ export default async function <%- functionName %>(
184
184
  // if changeBy is user will check for importBatch callingFlow
185
185
  if (callingFlowConfig) {
186
186
  if (callingFlowConfig.callingFlow !== "ImportDataTestExternalUpdateRelationshipHdrSqs") {
187
- errorsFound.push(`CanChangeToRelType changeBy is user but it's not user process with importData`);
187
+ foundErrors.push(`CanChangeToRelType changeBy is user but it's not user process with importData`);
188
188
  }
189
189
  }
190
190
  }
@@ -194,11 +194,11 @@ export default async function <%- functionName %>(
194
194
  const isUserProcess = Boolean(_izContext.correlationIds?.get(consts.SUBMITTED_BY_USER_ID));
195
195
  if (isUserProcess) {
196
196
  if (canChangeToRelType.changeBy !== 'user' && canChangeToRelType.changeBy !== 'systemWithUser') {
197
- errorsFound.push(`CanChangeToRelType changeBy is not user or systemWithUser`);
197
+ foundErrors.push(`CanChangeToRelType changeBy is not user or systemWithUser`);
198
198
  }
199
199
  } else {
200
200
  if (canChangeToRelType.changeBy !== 'systemNoUser') {
201
- errorsFound.push(`CanChangeToRelType changeBy is not systemNoUser`);
201
+ foundErrors.push(`CanChangeToRelType changeBy is not systemNoUser`);
202
202
  }
203
203
  }
204
204
  }
@@ -213,7 +213,7 @@ export default async function <%- functionName %>(
213
213
  );
214
214
  _izContext.logger.debug('links', links);
215
215
  if (!links.length) {
216
- errorsFound.push(
216
+ foundErrors.push(
217
217
  `not found link between ${JSON.stringify({ firstObject: firstObject.objType })} ${JSON.stringify({ secondObject: secondObject.objType })}`
218
218
  );
219
219
  }
@@ -253,7 +253,7 @@ export default async function <%- functionName %>(
253
253
  }
254
254
 
255
255
  if (checkCorrectLink == false) {
256
- errorsFound.push(`Wrong Relationship Direction`);
256
+ foundErrors.push(`Wrong Relationship Direction`);
257
257
  }
258
258
 
259
259
  let targetStorageResources = [];
@@ -301,7 +301,7 @@ export default async function <%- functionName %>(
301
301
  usedStorageResource.graphServerTag
302
302
  );
303
303
  if (!graphServiceTag) {
304
- errorsFound.push(
304
+ foundErrors.push(
305
305
  `storageResourceTag: ${storageResourceTag} invalid, not found graph serviceTag from graphServerTag: ${usedStorageResource.graphServerTag}`
306
306
  );
307
307
  }
@@ -327,23 +327,23 @@ export default async function <%- functionName %>(
327
327
  );
328
328
 
329
329
  if (!targetStorageResources.length) {
330
- errorsFound.push(`Not found link from relationship schema`);
330
+ foundErrors.push(`Not found link from relationship schema`);
331
331
  }
332
332
 
333
333
  // validate properties exists with schema
334
334
  for (const propKey in oldRelTypeAndDirection.fieldNames) {
335
335
  if (!newRelationshipSchema.fieldNames.hasOwnProperty(propKey)) {
336
- errorsFound.push(
336
+ foundErrors.push(
337
337
  `property: ${propKey} not exists in relationshipSchema`
338
338
  );
339
339
  }
340
340
  }
341
341
  } else {
342
- errorsFound.push(`relationshipSchema not exists`);
342
+ foundErrors.push(`relationshipSchema not exists`);
343
343
  }
344
344
 
345
345
  // if found errors will stop processing
346
- if (errorsFound.length) {
346
+ if (foundErrors.length) {
347
347
  let changeRelCompleteMsg = {
348
348
  firstObject,
349
349
  secondObject,
@@ -354,7 +354,7 @@ export default async function <%- functionName %>(
354
354
  //(<inChangeRelCompleteMsg>)
355
355
  //(</inChangeRelCompleteMsg>)
356
356
  status: 'error',
357
- errorsFound: errorsFound,
357
+ foundErrors: foundErrors,
358
358
  parentFlowId
359
359
  };
360
360
 
@@ -20,7 +20,7 @@ let perRecordsValidatorSchema = {
20
20
  status: {
21
21
  type: 'string'
22
22
  },
23
- errorsFound: {
23
+ foundErrors: {
24
24
  type: 'array'
25
25
  },
26
26
  graphServiceTag: {
@@ -31,7 +31,7 @@ let perRecordsValidatorSchema = {
31
31
  'returnValue',
32
32
  'parentFlowId',
33
33
  'status',
34
- 'errorsFound',
34
+ 'foundErrors',
35
35
  'graphServiceTag'
36
36
  ]
37
37
  //(<validatorSchema>)
@@ -44,7 +44,7 @@ export default async function createRelationshipComplete(
44
44
  returnValue,
45
45
  parentFlowId,
46
46
  status,
47
- errorsFound,
47
+ foundErrors,
48
48
  graphServiceTag
49
49
  } = requestParams;
50
50
 
@@ -52,7 +52,7 @@ export default async function createRelationshipComplete(
52
52
  returnValue: returnValue,
53
53
  parentFlowId: parentFlowId,
54
54
  status: status,
55
- errorsFound: errorsFound,
55
+ foundErrors: foundErrors,
56
56
  graphServiceTag: graphServiceTag,
57
57
  passBackProperties: passBackProperties
58
58
  });
@@ -76,7 +76,7 @@ export default async function createRelationshipComplete(
76
76
  _izContext.logger.warn(
77
77
  `No pending step found for awaitingStepId: ${awaitingStepId}`
78
78
  );
79
- return { returnValue, status, errorsFound };
79
+ return { returnValue, status, foundErrors };
80
80
  }
81
81
 
82
82
  const result =
@@ -84,7 +84,7 @@ export default async function createRelationshipComplete(
84
84
  _izContext,
85
85
  pending.pendingStepId,
86
86
  awaitingStepId,
87
- errorsFound
87
+ foundErrors
88
88
  );
89
89
  _izContext.logger.debug(
90
90
  '[CreateRelationshipComplete] all awaiting steps result',
@@ -106,7 +106,7 @@ export default async function createRelationshipComplete(
106
106
  returnValue.requestParams.relationshipProperties,
107
107
  parentFlowId: parentFlowId || returnValue?.parentFlowId,
108
108
  status: status,
109
- errorsFound: errorsFound
109
+ foundErrors: foundErrors
110
110
  };
111
111
 
112
112
  const callingFlowConfig =
@@ -164,7 +164,7 @@ export default async function createRelationshipComplete(
164
164
  return {
165
165
  returnValue,
166
166
  status,
167
- errorsFound
167
+ foundErrors
168
168
  };
169
169
  } catch (err) {
170
170
  _izContext.logger.error('error createRelationshipComplete:', err);
@@ -90,7 +90,7 @@ export default async function createRelationship(
90
90
 
91
91
  const createOnConditionalFail = settings.createOnConditionalFail ?? false;
92
92
 
93
- let errorsFound = [];
93
+ let foundErrors = [];
94
94
  const parentFlowId = identifierUuid();
95
95
  //(<beforeValidateCreateRel>)
96
96
  //(</beforeValidateCreateRel>).
@@ -107,7 +107,7 @@ export default async function createRelationship(
107
107
  );
108
108
 
109
109
  if (!objectSchema) {
110
- errorsFound.push(
110
+ foundErrors.push(
111
111
  `validateIdentifiers, not found schema of ${objTypeString}`
112
112
  );
113
113
  }
@@ -118,7 +118,7 @@ export default async function createRelationship(
118
118
  ];
119
119
  for (const identifierName of identifierNames) {
120
120
  if (!identifiersObject.hasOwnProperty(identifierName)) {
121
- errorsFound.push(
121
+ foundErrors.push(
122
122
  `validateIdentifiers, ${objTypeString} property:${identifierName} not exists`
123
123
  );
124
124
  } else {
@@ -126,7 +126,7 @@ export default async function createRelationship(
126
126
  typeof identifiersObject[identifierName] !== 'string' &&
127
127
  typeof identifiersObject[identifierName] !== 'number'
128
128
  ) {
129
- errorsFound.push(
129
+ foundErrors.push(
130
130
  `validateIdentifiers, ${objTypeString} property:${identifierName} should be string or number`
131
131
  );
132
132
  }
@@ -175,7 +175,7 @@ export default async function createRelationship(
175
175
  );
176
176
  _izContext.logger.debug('links', links);
177
177
  if (!links.length) {
178
- errorsFound.push(
178
+ foundErrors.push(
179
179
  `not found link between ${JSON.stringify({ firstObject: firstObject.objType })} ${JSON.stringify({ secondObject: secondObject.objType })}`
180
180
  );
181
181
  }
@@ -214,7 +214,7 @@ export default async function createRelationship(
214
214
  }
215
215
 
216
216
  if (checkCorrectLink == false) {
217
- errorsFound.push(`Wrong Relationship Direction`);
217
+ foundErrors.push(`Wrong Relationship Direction`);
218
218
  }
219
219
 
220
220
  let targetStorageResources = [];
@@ -262,7 +262,7 @@ export default async function createRelationship(
262
262
  usedStorageResource.graphServerTag
263
263
  );
264
264
  if (!graphServiceTag) {
265
- errorsFound.push(
265
+ foundErrors.push(
266
266
  `storageResourceTag: ${storageResourceTag} invalid, not found graph serviceTag from graphServerTag: ${usedStorageResource.graphServerTag}`
267
267
  );
268
268
  }
@@ -288,13 +288,13 @@ export default async function createRelationship(
288
288
  );
289
289
 
290
290
  if (!targetStorageResources.length) {
291
- errorsFound.push(`Not found link from relationship schema`);
291
+ foundErrors.push(`Not found link from relationship schema`);
292
292
  }
293
293
 
294
294
  // validate properties exists with schema
295
295
  for (const propKey in relationshipProperties) {
296
296
  if (!relationshipSchema.fieldNames.hasOwnProperty(propKey)) {
297
- errorsFound.push(
297
+ foundErrors.push(
298
298
  `property: ${propKey} not exists in relationshipSchema`
299
299
  );
300
300
  }
@@ -306,7 +306,7 @@ export default async function createRelationship(
306
306
  )) {
307
307
  if (propSetting.requiredOnCreate === true) {
308
308
  if (!relationshipProperties.hasOwnProperty(propName)) {
309
- errorsFound.push(`Missing requiredOnCreate property: ${propName}`);
309
+ foundErrors.push(`Missing requiredOnCreate property: ${propName}`);
310
310
  }
311
311
  }
312
312
 
@@ -315,15 +315,15 @@ export default async function createRelationship(
315
315
  !propSetting.requiredOnCreate &&
316
316
  relationshipProperties.hasOwnProperty(propName)
317
317
  ) {
318
- errorsFound.push(`property: ${propName} cannot create`);
318
+ foundErrors.push(`property: ${propName} cannot create`);
319
319
  }
320
320
  }
321
321
  } else {
322
- errorsFound.push(`relationshipSchema not exists`);
322
+ foundErrors.push(`relationshipSchema not exists`);
323
323
  }
324
324
 
325
325
  // if found errors will stop processing
326
- if (errorsFound.length) {
326
+ if (foundErrors.length) {
327
327
  let createRelCompleteMsg = {
328
328
  firstObject: firstObject,
329
329
  secondObject: secondObject,
@@ -333,7 +333,7 @@ export default async function createRelationship(
333
333
  //(<inCreateRelCompleteMsgCrateRel>)
334
334
  //(</inCreateRelCompleteMsgCrateRel>)
335
335
  status: 'error',
336
- errorsFound: errorsFound,
336
+ foundErrors: foundErrors,
337
337
  parentFlowId: parentFlowId
338
338
  };
339
339
 
@@ -20,7 +20,7 @@ let perRecordsValidatorSchema = {
20
20
  status: {
21
21
  type: 'string'
22
22
  },
23
- errorsFound: {
23
+ foundErrors: {
24
24
  type: 'array'
25
25
  },
26
26
  graphServiceTag: {
@@ -31,7 +31,7 @@ let perRecordsValidatorSchema = {
31
31
  'returnValue',
32
32
  'parentFlowId',
33
33
  'status',
34
- 'errorsFound',
34
+ 'foundErrors',
35
35
  'graphServiceTag'
36
36
  ]
37
37
  //(<validatorSchema>)
@@ -44,7 +44,7 @@ export default async function deleteRelationshipComplete(
44
44
  returnValue,
45
45
  parentFlowId,
46
46
  status,
47
- errorsFound,
47
+ foundErrors,
48
48
  graphServiceTag
49
49
  } = requestParams;
50
50
 
@@ -52,7 +52,7 @@ export default async function deleteRelationshipComplete(
52
52
  returnValue: returnValue,
53
53
  parentFlowId: parentFlowId,
54
54
  status: status,
55
- errorsFound: errorsFound,
55
+ foundErrors: foundErrors,
56
56
  graphServiceTag: graphServiceTag,
57
57
  passBackProperties: passBackProperties
58
58
  });
@@ -76,7 +76,7 @@ export default async function deleteRelationshipComplete(
76
76
  _izContext.logger.warn(
77
77
  `No pending step found for awaitingStepId: ${awaitingStepId}`
78
78
  );
79
- return { returnValue, status, errorsFound };
79
+ return { returnValue, status, foundErrors };
80
80
  }
81
81
 
82
82
  const result =
@@ -84,7 +84,7 @@ export default async function deleteRelationshipComplete(
84
84
  _izContext,
85
85
  pending.pendingStepId,
86
86
  awaitingStepId,
87
- errorsFound
87
+ foundErrors
88
88
  );
89
89
  _izContext.logger.debug(
90
90
  '[DeleteRelationshipComplete] all awaiting steps result',
@@ -104,7 +104,7 @@ export default async function deleteRelationshipComplete(
104
104
  relType: returnValue.requestParams.relType,
105
105
  parentFlowId: parentFlowId || returnValue?.parentFlowId,
106
106
  status: status,
107
- errorsFound: errorsFound
107
+ foundErrors: foundErrors
108
108
  };
109
109
 
110
110
  const callingFlowConfig =
@@ -156,7 +156,7 @@ export default async function deleteRelationshipComplete(
156
156
  return {
157
157
  returnValue,
158
158
  status,
159
- errorsFound
159
+ foundErrors
160
160
  };
161
161
  } catch (err) {
162
162
  _izContext.logger.error('error deleteRelationshipComplete:', err);