@izara_project/izara-core-generate-service-code 1.0.89 → 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 (56) 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 +153 -28
  6. package/src/emit/crud/templates/CreateEndpoint_Main.ejs +18 -18
  7. package/src/emit/crud/templates/CreateLogicalLib.ejs +83 -54
  8. package/src/emit/crud/templates/CreateNodeCallback_Main.ejs +32 -25
  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 +20 -22
  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 -36
  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 +33 -20
  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 +48 -18
  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 +70 -9
  52. package/test/crudApplicationArtifacts.test.js +98 -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
  56. package/test/resourceArtifacts.test.js +42 -0
@@ -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 getRelationshipComplete(
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 getRelationshipComplete(
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
  });
@@ -63,7 +63,7 @@ export default async function getRelationshipComplete(
63
63
  relType: returnValue.requestParams.relType,
64
64
  relationshipProperties: returnValue.requestParams.relationshipProperties,
65
65
  status: status,
66
- errorsFound: errorsFound
66
+ foundErrors: foundErrors
67
67
  };
68
68
 
69
69
  createCompleteMsg =
@@ -110,13 +110,13 @@ export default async function getRelationshipComplete(
110
110
  _izContext,
111
111
  awaitingStepId,
112
112
  pendingStepId,
113
- errorsFound
113
+ foundErrors
114
114
  );
115
115
 
116
116
  return {
117
117
  returnValue,
118
118
  status,
119
- errorsFound
119
+ foundErrors
120
120
  };
121
121
  } catch (err) {
122
122
  _izContext.logger.error('error GetRelationshipComplete:', err);
@@ -84,7 +84,7 @@ export default async function getRelationship(
84
84
  //(</requestParamGetRel>)
85
85
  } = requestParams;
86
86
 
87
- let errorsFound = [];
87
+ let foundErrors = [];
88
88
 
89
89
  //(<beforeValidateGetRel>)
90
90
  //(</beforeValidateGetRel>)
@@ -103,7 +103,7 @@ export default async function getRelationship(
103
103
  );
104
104
 
105
105
  if (!objectSchema) {
106
- errorsFound.push(
106
+ foundErrors.push(
107
107
  `validateIdentifiers, not found schema of ${objTypeString}`
108
108
  );
109
109
  }
@@ -114,7 +114,7 @@ export default async function getRelationship(
114
114
  ];
115
115
  for (const identifierName of identifierNames) {
116
116
  if (!identifiersObject.hasOwnProperty(identifierName)) {
117
- errorsFound.push(
117
+ foundErrors.push(
118
118
  `validateIdentifiers, ${objTypeString} ` +
119
119
  `property:${identifierName} not exists`
120
120
  );
@@ -123,7 +123,7 @@ export default async function getRelationship(
123
123
  typeof identifiersObject[identifierName] !== 'string' &&
124
124
  typeof identifiersObject[identifierName] !== 'number'
125
125
  ) {
126
- errorsFound.push(
126
+ foundErrors.push(
127
127
  `validateIdentifiers, ${objTypeString} ` +
128
128
  `property:${identifierName} should be string or number`
129
129
  );
@@ -227,7 +227,7 @@ export default async function getRelationship(
227
227
  usedStorageResource.graphServerTag
228
228
  );
229
229
  if (!graphServiceTag) {
230
- errorsFound.push(
230
+ foundErrors.push(
231
231
  `storageResourceTag: ${storageResourceTag} ` +
232
232
  `invalid, not found graph serviceTag from ` +
233
233
  `graphServerTag: ${usedStorageResource.graphServerTag}`
@@ -255,15 +255,15 @@ export default async function getRelationship(
255
255
  );
256
256
 
257
257
  if (!targetStorageResources.length) {
258
- errorsFound.push(`Not found link from relationship schema`);
258
+ foundErrors.push(`Not found link from relationship schema`);
259
259
  }
260
260
  }
261
261
  } else {
262
- errorsFound.push(`relationshipSchema not exists`);
262
+ foundErrors.push(`relationshipSchema not exists`);
263
263
  }
264
264
 
265
265
  // if found errors will stop processing
266
- if (errorsFound.length) {
266
+ if (foundErrors.length) {
267
267
  let getRelCompleteMsg = {
268
268
  firstObject: firstObject,
269
269
  secondObject: secondObject,
@@ -272,7 +272,7 @@ export default async function getRelationship(
272
272
  //(<inGetRelCompleteMsgCrateRel>)
273
273
  //(</inGetRelCompleteMsgCrateRel>)
274
274
  status: 'error',
275
- errorsFound: errorsFound
275
+ foundErrors: foundErrors
276
276
  };
277
277
 
278
278
  // if have callingFlow will send to message complete
@@ -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 <%- functionName %>(
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 <%- functionName %>(
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 <%- functionName %>(
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 <%- functionName %>(
84
84
  _izContext,
85
85
  pending.pendingStepId,
86
86
  awaitingStepId,
87
- errorsFound
87
+ foundErrors
88
88
  );
89
89
  _izContext.logger.debug(
90
90
  '[<%- functionName %>] all awaiting steps result',
@@ -109,7 +109,7 @@ export default async function <%- functionName %>(
109
109
  moveObject: returnValue.requestParams.moveObject,
110
110
  status: status,
111
111
  parentFlowId: parentFlowId || returnValue?.parentFlowId,
112
- errorsFound: errorsFound
112
+ foundErrors: foundErrors
113
113
  };
114
114
 
115
115
  const callingFlowConfig =
@@ -167,7 +167,7 @@ export default async function <%- functionName %>(
167
167
  return {
168
168
  returnValue,
169
169
  status,
170
- errorsFound
170
+ foundErrors
171
171
  };
172
172
  } catch (err) {
173
173
  _izContext.logger.error('error createRelationshipComplete:', err);
@@ -93,7 +93,7 @@ export default async function moveRelationship(
93
93
  } = requestParams;
94
94
 
95
95
  const parentFlowId = identifierUuid();
96
- let errorsFound = [];
96
+ let foundErrors = [];
97
97
 
98
98
  //(<beforeValidateMoveRel>)
99
99
  //(</beforeValidateMoveRel>).
@@ -110,7 +110,7 @@ export default async function moveRelationship(
110
110
  );
111
111
 
112
112
  if (!objectSchema) {
113
- errorsFound.push(
113
+ foundErrors.push(
114
114
  `validateIdentifiers, not found schema of ${objTypeString}`
115
115
  );
116
116
  }
@@ -121,7 +121,7 @@ export default async function moveRelationship(
121
121
  ];
122
122
  for (const identifierName of identifierNames) {
123
123
  if (!identifiersObject.hasOwnProperty(identifierName)) {
124
- errorsFound.push(
124
+ foundErrors.push(
125
125
  `validateIdentifiers, ${objTypeString} property:${identifierName} not exists`
126
126
  );
127
127
  } else {
@@ -129,7 +129,7 @@ export default async function moveRelationship(
129
129
  typeof identifiersObject[identifierName] !== 'string' &&
130
130
  typeof identifiersObject[identifierName] !== 'number'
131
131
  ) {
132
- errorsFound.push(
132
+ foundErrors.push(
133
133
  `validateIdentifiers, ${objTypeString} property:${identifierName} should be string or number`
134
134
  );
135
135
  }
@@ -163,13 +163,13 @@ export default async function moveRelationship(
163
163
  !relationshipSchema.hasOwnProperty('moveBy') ||
164
164
  relationshipSchema.moveBy === 'none'
165
165
  ) {
166
- errorsFound.push(`relationship: ${relType.relationshipTag} can't move`);
166
+ foundErrors.push(`relationship: ${relType.relationshipTag} can't move`);
167
167
  // ? Legacy Code:
168
168
  /*
169
169
  } else if (relationshipSchema.moveBy === "user") {
170
170
  if (callingFlowConfig) {
171
171
  if (callingFlowConfig.callingFlow !== "ImportDataTestExternalUpdateRelationshipHdrSqs") {
172
- errorsFound.push(`moveBy is user but it's not user process with importData`);
172
+ foundErrors.push(`moveBy is user but it's not user process with importData`);
173
173
  }
174
174
  }
175
175
  }
@@ -177,7 +177,7 @@ export default async function moveRelationship(
177
177
  // ? [Fix]: The legacy logic incorrectly blocked "user" from regular execution and allowed non-user values.
178
178
  // ? It has been corrected to require moveBy === "user" for normal execution.
179
179
  } else if (relationshipSchema.moveBy !== 'user') {
180
- errorsFound.push(
180
+ foundErrors.push(
181
181
  `relationship: ${relType.relationshipTag} moveBy is not user`
182
182
  );
183
183
  }
@@ -199,7 +199,7 @@ export default async function moveRelationship(
199
199
  );
200
200
 
201
201
  if (!links.length) {
202
- errorsFound.push(
202
+ foundErrors.push(
203
203
  `not found link between ${JSON.stringify({ firstObject: firstObject.objType })} ${JSON.stringify({ secondObject: secondObject.objType })}`
204
204
  );
205
205
  }
@@ -238,7 +238,7 @@ export default async function moveRelationship(
238
238
  }
239
239
 
240
240
  if (checkCorrectLink == false) {
241
- errorsFound.push(`Wrong Relationship Direction`);
241
+ foundErrors.push(`Wrong Relationship Direction`);
242
242
  }
243
243
 
244
244
  let targetStorageResources = [];
@@ -286,7 +286,7 @@ export default async function moveRelationship(
286
286
  usedStorageResource.graphServerTag
287
287
  );
288
288
  if (!graphServiceTag) {
289
- errorsFound.push(
289
+ foundErrors.push(
290
290
  `storageResourceTag: ${storageResourceTag} invalid, not found graph serviceTag from graphServerTag: ${usedStorageResource.graphServerTag}`
291
291
  );
292
292
  }
@@ -312,23 +312,23 @@ export default async function moveRelationship(
312
312
  );
313
313
 
314
314
  if (!targetStorageResources.length) {
315
- errorsFound.push(`Not found link from relationship schema`);
315
+ foundErrors.push(`Not found link from relationship schema`);
316
316
  }
317
317
 
318
318
  // validate properties exists with schema
319
319
  for (const propKey in relationshipProperties) {
320
320
  if (!relationshipSchema.fieldNames.hasOwnProperty(propKey)) {
321
- errorsFound.push(
321
+ foundErrors.push(
322
322
  `property: ${propKey} not exists in relationshipSchema`
323
323
  );
324
324
  }
325
325
  }
326
326
  } else {
327
- errorsFound.push(`relationshipSchema not exists`);
327
+ foundErrors.push(`relationshipSchema not exists`);
328
328
  }
329
329
 
330
330
  // if found errors will stop processing
331
- if (errorsFound.length) {
331
+ if (foundErrors.length) {
332
332
  let moveRelCompleteMsg = {
333
333
  firstObject,
334
334
  secondObject,
@@ -339,7 +339,7 @@ export default async function moveRelationship(
339
339
  //(<inMoveCompleteMsg>)
340
340
  //(</inMoveCompleteMsg>)
341
341
  status: 'error',
342
- errorsFound: errorsFound,
342
+ foundErrors: foundErrors,
343
343
  parentFlowId: parentFlowId
344
344
  };
345
345
 
@@ -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>)
@@ -45,7 +45,7 @@ export default async function updateRelationshipComplete(
45
45
  returnValue,
46
46
  parentFlowId,
47
47
  status,
48
- errorsFound,
48
+ foundErrors,
49
49
  graphServiceTag
50
50
  } = requestParams;
51
51
 
@@ -53,7 +53,7 @@ export default async function updateRelationshipComplete(
53
53
  returnValue: returnValue,
54
54
  parentFlowId: parentFlowId,
55
55
  status: status,
56
- errorsFound: errorsFound,
56
+ foundErrors: foundErrors,
57
57
  graphServiceTag: graphServiceTag,
58
58
  passBackProperties: passBackProperties
59
59
  // callingFlowConfig: callingFlowConfig
@@ -78,7 +78,7 @@ export default async function updateRelationshipComplete(
78
78
  _izContext.logger.warn(
79
79
  `No pending step found for awaitingStepId: ${awaitingStepId}`
80
80
  );
81
- return { returnValue, status, errorsFound };
81
+ return { returnValue, status, foundErrors };
82
82
  }
83
83
 
84
84
  const result =
@@ -86,7 +86,7 @@ export default async function updateRelationshipComplete(
86
86
  _izContext,
87
87
  pending.pendingStepId,
88
88
  awaitingStepId,
89
- errorsFound
89
+ foundErrors
90
90
  );
91
91
  _izContext.logger.debug(
92
92
  '[UpdateRelationshipComplete] all awaiting steps result',
@@ -104,7 +104,7 @@ export default async function updateRelationshipComplete(
104
104
  relId: returnValue.requestParams.relId,
105
105
  relType: returnValue.requestParams.relType,
106
106
  status: status,
107
- errorsFound: errorsFound
107
+ foundErrors: foundErrors
108
108
  //(<inUpdateCompleteMsg>)
109
109
  //(</inUpdateCompleteMsg>)
110
110
  };
@@ -158,7 +158,7 @@ export default async function updateRelationshipComplete(
158
158
  return {
159
159
  returnValue,
160
160
  status,
161
- errorsFound
161
+ foundErrors
162
162
  };
163
163
  } catch (err) {
164
164
  _izContext.logger.error('error updateRelationshipComplete:', err);
@@ -88,7 +88,7 @@ export default async function updateRelationship(
88
88
  //(</requestParamUpdateRel>)
89
89
  } = requestParams;
90
90
 
91
- let errorsFound = [];
91
+ let foundErrors = [];
92
92
  const parentFlowId = identifierUuid();
93
93
 
94
94
  //(<beforeValidateUpdateRel>)
@@ -106,7 +106,7 @@ export default async function updateRelationship(
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
  }
@@ -116,7 +116,7 @@ export default async function updateRelationship(
116
116
  schemaIdentifier.fieldName || schemaIdentifier.name;
117
117
 
118
118
  if (!identifiersObject.hasOwnProperty(identifierName)) {
119
- errorsFound.push(
119
+ foundErrors.push(
120
120
  `validateIdentifiers, ${objTypeString} property:${identifierName} not exists`
121
121
  );
122
122
  } else {
@@ -124,7 +124,7 @@ export default async function updateRelationship(
124
124
  typeof identifiersObject[identifierName] !== 'string' &&
125
125
  typeof identifiersObject[identifierName] !== 'number'
126
126
  ) {
127
- errorsFound.push(
127
+ foundErrors.push(
128
128
  `validateIdentifiers, ${objTypeString} property:${identifierName} should be string or number`
129
129
  );
130
130
  }
@@ -225,7 +225,7 @@ export default async function updateRelationship(
225
225
  usedStorageResource.graphServerTag
226
226
  );
227
227
  if (!graphServiceTag) {
228
- errorsFound.push(
228
+ foundErrors.push(
229
229
  `storageResourceTag:${storageResourceTag} invalid, not found graph serviceTag from graphServerTag:${usedStorageResource.graphServerTag}`
230
230
  );
231
231
  }
@@ -252,7 +252,7 @@ export default async function updateRelationship(
252
252
  );
253
253
 
254
254
  if (!targetStorageResources.length) {
255
- errorsFound.push(`Not found link from relationship schema`);
255
+ foundErrors.push(`Not found link from relationship schema`);
256
256
  }
257
257
 
258
258
  // validate canUpdate properties relationship
@@ -269,21 +269,21 @@ export default async function updateRelationship(
269
269
  callingFlowConfig.callingFlow !==
270
270
  'ImportDataTestExternalUpdateRelationshipHdrSqs'
271
271
  ) {
272
- errorsFound.push(
272
+ foundErrors.push(
273
273
  `property:${propKey} can update user but it's not user process with importData`
274
274
  );
275
275
  }
276
276
  }
277
277
  }
278
278
  } else {
279
- errorsFound.push(
279
+ foundErrors.push(
280
280
  `property:${propKey} not exists in relationshipSchema`
281
281
  );
282
282
  }
283
283
  }
284
284
 
285
285
  // if found errors will stop processing
286
- if (errorsFound.length) {
286
+ if (foundErrors.length) {
287
287
  let updateCompleteMsg = {
288
288
  firstObject: firstObject,
289
289
  secondObject: secondObject,
@@ -291,7 +291,7 @@ export default async function updateRelationship(
291
291
  relType: relType,
292
292
  relationshipDirection,
293
293
  status: 'error',
294
- errorsFound: errorsFound,
294
+ foundErrors: foundErrors,
295
295
  parentFlowId: parentFlowId
296
296
  //(<inUpdateCompleteMsgUpdateRel>)
297
297
  //(</inUpdateCompleteMsgUpdateRel>)
@@ -524,7 +524,7 @@ export default async function updateRelationship(
524
524
  relId: relId,
525
525
  relType: relType,
526
526
  relationshipDirection,
527
- errorsFound
527
+ foundErrors
528
528
  };
529
529
  }
530
530
  } catch (err) {
@@ -204,7 +204,7 @@ export const resourceArtifactPaths = [
204
204
  function createResourceState({ objects, relationships, flows }) {
205
205
  const crud = objects.some(isCrudObject);
206
206
  const selfRbac = objects.some(hasSelfRbacAddOn);
207
- const rbac = objects.some(hasSelfRbacAddOn);
207
+ const rbac = objects.some((obj) => hasRbacAddOn(obj, objects));
208
208
  const crudActionPlans = createCrudActionPlans(objects, flows);
209
209
 
210
210
  const crudOwnTopics = crud ? [...CRUD_ACTIONS] : [];
@@ -244,9 +244,9 @@ function createResourceState({ objects, relationships, flows }) {
244
244
  rbacSqsQueues.push(`Process${action}HdrSqs`);
245
245
  }
246
246
  }
247
- if (rbac) {
247
+ if (selfRbac) {
248
248
  const flowTags = [
249
- ...new Set(objects.filter(hasRbacAddOn).map(rbacFlowTag))
249
+ ...new Set(objects.filter(hasSelfRbacAddOn).map(rbacFlowTag))
250
250
  ];
251
251
  for (const flowTag of flowTags) {
252
252
  rbacOwnTopics.push(flowTag);
@@ -433,6 +433,7 @@ function createResourceState({ objects, relationships, flows }) {
433
433
  return {
434
434
  crud,
435
435
  rbac,
436
+ selfRbac,
436
437
  crudActionPlans,
437
438
  crudOwnTopics: [...new Set(crudOwnTopics)].filter(Boolean).sort(),
438
439
  crudSqsQueues: [...new Set(crudSqsQueues)].filter(Boolean).sort(),
@@ -638,7 +639,7 @@ async function renderDynamo(state) {
638
639
  const [system, ...tables] = await Promise.all([
639
640
  render('SystemDynamoDB_Yaml.ejs', {
640
641
  hasS3: state.s3FlowTags.length > 0,
641
- hasRbac: state.rbac
642
+ hasRbac: state.selfRbac
642
643
  }),
643
644
  ...state.tables.map((table) => render('DynamoDBTable_Yaml.ejs', table))
644
645
  ]);
@@ -650,7 +651,7 @@ async function renderIam(state) {
650
651
  const roles = ['ProcFindDataRole', 'RegisterRole'];
651
652
  if (state.crud) roles.push('FlowObjectsRole');
652
653
  if (state.relationships) roles.push('FlowRelationshipRole');
653
- if (state.rbac) roles.push('FlowRbacRole');
654
+ if (state.selfRbac) roles.push('FlowRbacRole');
654
655
  if (state.websocket) roles.push('WebSocketMainRole');
655
656
  roles.push(...state.customRoles);
656
657
  const sortedRoles = roles.sort();
@@ -668,8 +669,21 @@ async function renderIam(state) {
668
669
  function getRbacValidatorServiceTags(state) {
669
670
  const tags = new Set();
670
671
  for (const obj of state.objects || []) {
671
- if (obj.belongTo?.serviceTag && obj.belongTo.serviceTag !== 'Rbac') {
672
- tags.add(obj.belongTo.serviceTag);
672
+ const targets = obj?.belongTo
673
+ ? Array.isArray(obj.belongTo)
674
+ ? obj.belongTo
675
+ : [obj.belongTo]
676
+ : [];
677
+ for (const target of targets) {
678
+ if (target?.serviceTag && target.serviceTag !== 'Rbac') {
679
+ tags.add(target.serviceTag);
680
+ }
681
+ }
682
+ if (
683
+ obj.belongToSchema?.serviceTag &&
684
+ obj.belongToSchema.serviceTag !== 'Rbac'
685
+ ) {
686
+ tags.add(obj.belongToSchema.serviceTag);
673
687
  }
674
688
  }
675
689
  return Array.from(tags).sort();
@@ -751,7 +765,7 @@ function addStatement(statements, action, resource) {
751
765
 
752
766
  function roleNeedsSchemaRead(state, roleName) {
753
767
  if (!roleName.endsWith('Role') || !roleName) return false;
754
- return roleName !== 'FlowRbacRole' || state.rbac;
768
+ return roleName !== 'FlowRbacRole' || state.selfRbac;
755
769
  }
756
770
 
757
771
  function roleTableNames(state, roleName) {
@@ -767,7 +781,7 @@ function roleTableNames(state, roleName) {
767
781
  'AwaitingMultipleSteps',
768
782
  'AwaitingMultipleStepByPending',
769
783
  'WebSocketTask',
770
- ...(state.rbac
784
+ ...(state.selfRbac
771
785
  ? [
772
786
  'Roles',
773
787
  'TargetRoles',
@@ -1288,20 +1302,36 @@ function hasSelfRbacAddOn(object) {
1288
1302
  );
1289
1303
  }
1290
1304
 
1291
- function hasRbacAddOn(object) {
1292
- return hasSelfRbacAddOn(object);
1305
+ function hasRbacAddOn(object, objects = []) {
1306
+ const selfHasRbac = hasSelfRbacAddOn(object);
1307
+ const belongToTargets = object?.belongTo
1308
+ ? Array.isArray(object.belongTo)
1309
+ ? object.belongTo
1310
+ : [object.belongTo]
1311
+ : [];
1312
+ const belongToHasRbac =
1313
+ (Array.isArray(object?.belongToSchema?.addOnDataStructure) &&
1314
+ object.belongToSchema.addOnDataStructure.some(
1315
+ (addOn) => addOn?.type === 'rbac'
1316
+ )) ||
1317
+ belongToTargets.some((target) => {
1318
+ if (target?.serviceTag === 'UserAccount') return true;
1319
+ const matched = objects.find(
1320
+ (candidate) =>
1321
+ candidate?.serviceTag === target?.serviceTag &&
1322
+ candidate?.objectType === target?.objectType
1323
+ );
1324
+ return hasSelfRbacAddOn(matched);
1325
+ });
1326
+ return selfHasRbac || belongToHasRbac;
1293
1327
  }
1294
1328
 
1295
1329
  /**
1296
- * Returns the per-object RBAC flow queues (e.g. UserRbacFlowHdrSqs)
1297
- * created for objects with an 'rbac' add-on. These are consumed by the
1298
- * UserRbacFlow SQS functions emitted in emitRbacApplicationArtifacts.
1330
+ * Returns the per-object RBAC flow queues created for objects with an 'rbac'
1331
+ * add-on. ValidatorRbac uses HdrInv and HdrApi (no SQS queue).
1299
1332
  */
1300
1333
  function rbacFlowQueueNames(state) {
1301
- const flowTags = [
1302
- ...new Set((state.objects ?? []).filter(hasRbacAddOn).map(rbacFlowTag))
1303
- ];
1304
- return flowTags.map((flowTag) => `${flowTag}HdrSqs`);
1334
+ return [];
1305
1335
  }
1306
1336
  function includesEvent(flow, event) {
1307
1337
  return Array.isArray(flow?.event) && flow.event.includes(event);