@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
@@ -23,29 +23,29 @@ function empty(value) {
23
23
  );
24
24
  }
25
25
 
26
- function validateInput(returnValue, status, graphServiceTag, errorsFound) {
26
+ function validateInput(returnValue, status, graphServiceTag, foundErrors) {
27
27
  if (!returnValue?.queryResult)
28
- errorsFound.push(
28
+ foundErrors.push(
29
29
  'message is not have property queryResult, should be not happen'
30
30
  );
31
31
  if (!returnValue?.requestParams?.objType)
32
- errorsFound.push(
32
+ foundErrors.push(
33
33
  'message is not have property objType, should be not happen'
34
34
  );
35
35
  if (!returnValue?.requestParams?.objInstanceFull)
36
- errorsFound.push(
36
+ foundErrors.push(
37
37
  'message is not have property objInstance, should be not objInstance'
38
38
  );
39
- if (status === 'error' && errorsFound.length === 0)
40
- errorsFound.push(
41
- '[invalid]status is error not have errorsFound form graphService'
39
+ if (status === 'error' && foundErrors.length === 0)
40
+ foundErrors.push(
41
+ '[invalid]status is error not have foundErrors form graphService'
42
42
  );
43
- if (status === 'complete' && errorsFound.length > 0)
44
- errorsFound.push(
45
- '[Invalid] status is complete should be not have errorsFound'
43
+ if (status === 'complete' && foundErrors.length > 0)
44
+ foundErrors.push(
45
+ '[Invalid] status is complete should be not have foundErrors'
46
46
  );
47
47
  if (graphServiceTag == null)
48
- errorsFound.push('[Invalid] graphServerTag is not empty string');
48
+ foundErrors.push('[Invalid] graphServerTag is not empty string');
49
49
  }
50
50
 
51
51
  export default async function DeleteComplete(
@@ -62,14 +62,14 @@ export default async function DeleteComplete(
62
62
  const {
63
63
  returnValue,
64
64
  status,
65
- errorsFound = [],
65
+ foundErrors = [],
66
66
  graphServiceTag,
67
67
  parentFlowId
68
68
  } = requestParams;
69
69
  if (empty(returnValue?.requestParams))
70
70
  throw new NoRetryError('message not an object');
71
- validateInput(returnValue, status, graphServiceTag, errorsFound);
72
- if (errorsFound.length > 0) errorsFound.push(errorsFound.join(','));
71
+ validateInput(returnValue, status, graphServiceTag, foundErrors);
72
+ if (foundErrors.length > 0) foundErrors.push(foundErrors.join(','));
73
73
 
74
74
  const awaitingStepId = await asyncFlowSharedLib.createAwaitingStepId(
75
75
  parentFlowId,
@@ -88,14 +88,14 @@ export default async function DeleteComplete(
88
88
  _izContext.logger.warn(
89
89
  `No pending step found for awaitingStepId: ${awaitingStepId}`
90
90
  );
91
- return { returnValue, status, errorsFound };
91
+ return { returnValue, status, foundErrors };
92
92
  }
93
93
  const result =
94
94
  await asyncFlowSharedLib.checkAllAwaitingStepsFinishedWithReturnParams(
95
95
  _izContext,
96
96
  pending.pendingStepId,
97
97
  awaitingStepId,
98
- errorsFound
98
+ foundErrors
99
99
  );
100
100
  _izContext.logger.debug(
101
101
  '[DeleteComplete] all awaiting steps result',
@@ -157,7 +157,7 @@ export default async function DeleteComplete(
157
157
  parentFlowId: parentFlowId || returnValue?.parentFlowId,
158
158
  existsNode,
159
159
  status,
160
- errorsFound
160
+ foundErrors
161
161
  };
162
162
 
163
163
  <%_ if (plan?.hasAfterHookSync) { _%>
@@ -193,11 +193,11 @@ export default async function DeleteComplete(
193
193
  }
194
194
  );
195
195
  if (
196
- hookResult?.errorsFound?.length > 0 ||
196
+ hookResult?.foundErrors?.length > 0 ||
197
197
  hookResult?.status === 'error'
198
198
  ) {
199
- errorsFound.push(
200
- ...(hookResult.errorsFound || ['Hook <%= hook.flowTag %> failed'])
199
+ foundErrors.push(
200
+ ...(hookResult.foundErrors || ['Hook <%= hook.flowTag %> failed'])
201
201
  );
202
202
  }
203
203
  } catch (hookErr) {
@@ -205,7 +205,7 @@ export default async function DeleteComplete(
205
205
  '[DeleteComplete] Sync hook <%= hook.flowTag %> error:',
206
206
  hookErr
207
207
  );
208
- errorsFound.push(hookErr.message || 'Hook <%= hook.flowTag %> failed');
208
+ foundErrors.push(hookErr.message || 'Hook <%= hook.flowTag %> failed');
209
209
  }
210
210
  <%_ if (hook.targetObjectTypes && hook.targetObjectTypes.length > 0) { _%>
211
211
  }
@@ -297,9 +297,9 @@ export default async function DeleteComplete(
297
297
  _izContext,
298
298
  awaitingStepId,
299
299
  pending.pendingStepId,
300
- errorsFound
300
+ foundErrors
301
301
  );
302
- return { returnValue, status, errorsFound };
302
+ return { returnValue, status, foundErrors };
303
303
  } catch (error) {
304
304
  _izContext.logger.error('[DeleteComplete] error:', error);
305
305
  throw error;
@@ -62,14 +62,14 @@ export default async function <%- flowTag %>(
62
62
  callingFlowConfig
63
63
  });
64
64
 
65
- const errorsFound = [];
65
+ const foundErrors = [];
66
66
 
67
67
  //(<beforeDelete>)
68
68
  //(</beforeDelete>)
69
69
 
70
70
  // ── Resolve Schema & Identity ─────────────────────────────────────────────
71
71
  const { objType, objectSchema, targetIdentifiers } =
72
- await resolveSchemaAndIdentity(_izContext, requestParams, errorsFound);
72
+ await resolveSchemaAndIdentity(_izContext, requestParams, foundErrors);
73
73
 
74
74
  //(<beforeQuery>)
75
75
  //(</beforeQuery>)
@@ -101,19 +101,19 @@ export default async function <%- flowTag %>(
101
101
  // value !== undefined &&
102
102
  // targetIdentifiers[key] !== value
103
103
  // ) {
104
- // errorsFound.push(
104
+ // foundErrors.push(
105
105
  // `targetIdentifiers.${key} must match identifiers.${key}`
106
106
  // );
107
107
  // }
108
108
  // }
109
109
  // }
110
110
 
111
- if (errorsFound.length > 0)
111
+ if (foundErrors.length > 0)
112
112
  return await <%- flowTag %>LogicalLib(
113
113
  _izContext,
114
114
  requestParams,
115
115
  callingFlowConfig,
116
- errorsFound
116
+ foundErrors
117
117
  );
118
118
 
119
119
  <%_
@@ -172,12 +172,12 @@ export default async function <%- flowTag %>(
172
172
  );
173
173
 
174
174
  if (resultPermissionCheck && resultPermissionCheck.permission !== true) {
175
- errorsFound.push('Permission denied');
175
+ foundErrors.push('Permission denied');
176
176
  return await <%- flowTag %>LogicalLib(
177
177
  _izContext,
178
178
  requestParams,
179
179
  callingFlowConfig,
180
- errorsFound
180
+ foundErrors
181
181
  );
182
182
  }
183
183
 
@@ -233,10 +233,10 @@ export default async function <%- flowTag %>(
233
233
  flowTag: '<%= config.flowTag %>',
234
234
  returnValue
235
235
  });
236
- if (returnValue?.errorsFound?.length > 0) {
237
- errorsFound.push(...returnValue.errorsFound);
236
+ if (returnValue?.foundErrors?.length > 0) {
237
+ foundErrors.push(...returnValue.foundErrors);
238
238
  } else if (returnValue?.status === 'error') {
239
- errorsFound.push('Error from <%= config.flowTag %>');
239
+ foundErrors.push('Error from <%= config.flowTag %>');
240
240
  } else {
241
241
  if (returnValue?.identifiers && requestParams?.identifiers) {
242
242
  Object.assign(requestParams.identifiers, returnValue.identifiers);
@@ -247,16 +247,16 @@ export default async function <%- flowTag %>(
247
247
  '[<%- flowTag %>] Sync hook <%= config.flowTag %> error:',
248
248
  hookErr
249
249
  );
250
- errorsFound.push(hookErr.message || 'Hook <%= config.flowTag %> failed');
250
+ foundErrors.push(hookErr.message || 'Hook <%= config.flowTag %> failed');
251
251
  }
252
252
  <%_ } _%>
253
253
 
254
- if (errorsFound.length > 0) {
254
+ if (foundErrors.length > 0) {
255
255
  return await <%- flowTag %>LogicalLib(
256
256
  _izContext,
257
257
  requestParams,
258
258
  callingFlowConfig,
259
- errorsFound
259
+ foundErrors
260
260
  );
261
261
  }
262
262
  <%_ } _%>
@@ -335,7 +335,7 @@ export default async function <%- flowTag %>(
335
335
  _izContext,
336
336
  requestParams,
337
337
  callingFlowConfig,
338
- errorsFound
338
+ foundErrors
339
339
  );
340
340
  <%_ } _%>
341
341
  }
@@ -349,7 +349,7 @@ export default async function <%- flowTag %>(
349
349
  _izContext,
350
350
  requestParams,
351
351
  callingFlowConfig,
352
- errorsFound
352
+ foundErrors
353
353
  );
354
354
  } catch (err) {
355
355
  _izContext.logger.error(`[${process.env.iz_serviceTag}:<%- flowTag %>] error:`, err);
@@ -52,13 +52,13 @@ const { TOPIC_NAME_GENERATE_CODE } = consts;
52
52
  * Loads ObjectSchema and resolves submittedByUserId and targetIdentifiers
53
53
  * @param {Object} _izContext - Izara context object
54
54
  * @param {Object} requestParams - Incoming request parameters
55
- * @param {Array<string>} errorsFound - Array to collect validation errors
55
+ * @param {Array<string>} foundErrors - Array to collect validation errors
56
56
  * @returns {Promise<{ objType: string, objectSchema: Object, targetIdentifiers?: Object }>}
57
57
  */
58
58
  export async function resolveSchemaAndIdentity(
59
59
  _izContext,
60
60
  requestParams,
61
- errorsFound
61
+ foundErrors
62
62
  ) {
63
63
  const objType = createObjType(requestParams.objectType);
64
64
  const objectSchema = await getObjectSchema.getObjSchemaS3WithHierarchy(
@@ -92,17 +92,15 @@ export async function resolveSchemaAndIdentity(
92
92
  }
93
93
 
94
94
  if (!submittedByUserId) {
95
- errorsFound.push('Not have submittedByUserId');
95
+ foundErrors.push('Not have submittedByUserId');
96
96
  }
97
97
  if (objectSchema.hasOwnProperty('belongTo') && !targetIdentifiers) {
98
- errorsFound.push('not have targetIdentifiers');
98
+ foundErrors.push('not have targetIdentifiers');
99
99
  }
100
100
 
101
101
  requestParams.submittedByUserId = submittedByUserId;
102
102
  if (targetIdentifiers) {
103
- if (!targetIdentifiers.submittedByUserId && submittedByUserId) {
104
- targetIdentifiers.submittedByUserId = submittedByUserId;
105
- }
103
+ requestParams.targetIdentifiers = targetIdentifiers;
106
104
  }
107
105
 
108
106
  _izContext.logger.debug(
@@ -132,7 +130,7 @@ export async function handleDeleteError(
132
130
  identifiers,
133
131
  targetIdentifiers,
134
132
  callingFlowConfig,
135
- errorsFound
133
+ foundErrors
136
134
  }
137
135
  ) {
138
136
  const deleteNodeCompleteMessage =
@@ -143,7 +141,7 @@ export async function handleDeleteError(
143
141
  identifiers,
144
142
  targetIdentifiers,
145
143
  status: 'error',
146
- errorsFound
144
+ foundErrors
147
145
  }
148
146
  );
149
147
 
@@ -171,7 +169,7 @@ export async function handleDeleteError(
171
169
  identifiers,
172
170
  targetIdentifiers,
173
171
  status: 'error',
174
- errorsFound
172
+ foundErrors
175
173
  };
176
174
  }
177
175
 
@@ -187,7 +185,7 @@ export async function <%- flowTag %>LogicalLib(
187
185
  _izContext,
188
186
  requestParams,
189
187
  callingFlowConfig = {},
190
- errorsFound = [],
188
+ foundErrors = [],
191
189
  phaseResults = {}
192
190
  ) {
193
191
  try {
@@ -217,17 +215,17 @@ export async function <%- flowTag %>LogicalLib(
217
215
  _izContext.logger.debug(`[${process.env.iz_serviceTag}:<%- flowTag %>LogicalLib] deleteDataDetails:`, deleteDataDetails);
218
216
 
219
217
  if (objectSchema.canDelete === false || objectSchema.canDelete == null) {
220
- errorsFound.push("this objectSchema can't delete");
218
+ foundErrors.push("this objectSchema can't delete");
221
219
  }
222
220
 
223
221
  // ── Early exit on errors ──────────────────────────────────────────────────
224
- if (errorsFound.length) {
222
+ if (foundErrors.length) {
225
223
  return await handleDeleteError(_izContext, {
226
224
  objType,
227
225
  identifiers: requestParams.identifiers,
228
226
  targetIdentifiers: requestParams.targetIdentifiers,
229
227
  callingFlowConfig,
230
- errorsFound
228
+ foundErrors
231
229
  });
232
230
  }
233
231
 
@@ -304,11 +302,11 @@ export async function <%- flowTag %>LogicalLib(
304
302
  }
305
303
  );
306
304
  if (
307
- hookResult?.errorsFound?.length > 0 ||
305
+ hookResult?.foundErrors?.length > 0 ||
308
306
  hookResult?.status === 'error'
309
307
  ) {
310
- errorsFound.push(
311
- ...(hookResult.errorsFound || ['Hook <%= hook.flowTag %> failed'])
308
+ foundErrors.push(
309
+ ...(hookResult.foundErrors || ['Hook <%= hook.flowTag %> failed'])
312
310
  );
313
311
  }
314
312
  } catch (hookErr) {
@@ -316,7 +314,7 @@ export async function <%- flowTag %>LogicalLib(
316
314
  '[<%- flowTag %>LogicalLib] Sync hook <%= hook.flowTag %> error:',
317
315
  hookErr
318
316
  );
319
- errorsFound.push(hookErr.message || 'Hook <%= hook.flowTag %> failed');
317
+ foundErrors.push(hookErr.message || 'Hook <%= hook.flowTag %> failed');
320
318
  }
321
319
  <%_ if (hook.targetObjectTypes && hook.targetObjectTypes.length > 0) { _%>
322
320
  }
@@ -359,7 +357,7 @@ export async function <%- flowTag %>LogicalLib(
359
357
  targetIdentifiers: requestParams.targetIdentifiers,
360
358
  parentFlowId: requestParams.parentFlowId,
361
359
  status: 'complete',
362
- errorsFound
360
+ foundErrors
363
361
  }
364
362
  }
365
363
  )
@@ -386,7 +384,7 @@ export async function <%- flowTag %>LogicalLib(
386
384
  objType,
387
385
  identifiers: requestParams.identifiers,
388
386
  status: 'complete',
389
- errorsFound
387
+ foundErrors
390
388
  }
391
389
  );
392
390
 
@@ -412,7 +410,7 @@ export async function <%- flowTag %>LogicalLib(
412
410
  <%_ } _%>
413
411
 
414
412
  let resultStatus = 'complete';
415
- if (errorsFound.length > 0) {
413
+ if (foundErrors.length > 0) {
416
414
  resultStatus = 'error';
417
415
  }
418
416
 
@@ -421,7 +419,7 @@ export async function <%- flowTag %>LogicalLib(
421
419
  identifiers: requestParams.identifiers,
422
420
  targetIdentifiers: requestParams.targetIdentifiers,
423
421
  status: resultStatus,
424
- errorsFound
422
+ foundErrors
425
423
  };
426
424
  } catch (err) {
427
425
  _izContext.logger.error(`[${process.env.iz_serviceTag}:<%- flowTag %>LogicalLib] error:`, err);
@@ -72,7 +72,7 @@ export default async function <%- flowTag %>RbacCallbackMain(
72
72
  return 'all task not completed';
73
73
  }
74
74
 
75
- const errorsFound = [...collectedErrors];
75
+ const foundErrors = [...collectedErrors];
76
76
 
77
77
  // 2. Validate RBAC permission results
78
78
  const { hasError, errorResult, rbacCallbackResults } = await assertRbacPermission(
@@ -80,7 +80,7 @@ export default async function <%- flowTag %>RbacCallbackMain(
80
80
  {
81
81
  rbacResults,
82
82
  originalRequestParams,
83
- errorsFound
83
+ foundErrors
84
84
  }
85
85
  );
86
86
 
@@ -96,7 +96,7 @@ export default async function <%- flowTag %>RbacCallbackMain(
96
96
  _izContext,
97
97
  originalRequestParams,
98
98
  callingFlowConfig,
99
- errorsFound,
99
+ foundErrors,
100
100
  rbacCallbackResults
101
101
  );
102
102
 
@@ -48,12 +48,12 @@ export default async function UpdateAfterHookCallbackMain(
48
48
 
49
49
  const {
50
50
  status,
51
- errorsFound = [],
51
+ foundErrors = [],
52
52
  returnValue,
53
53
  parentFlowId
54
54
  } = requestParams;
55
55
 
56
- const mergedErrors = Array.isArray(errorsFound) ? [...errorsFound] : [];
56
+ const mergedErrors = Array.isArray(foundErrors) ? [...foundErrors] : [];
57
57
  if (status === 'error' && mergedErrors.length === 0) {
58
58
  mergedErrors.push('AfterHook execution reported error');
59
59
  }
@@ -75,7 +75,7 @@ export default async function UpdateAfterHookCallbackMain(
75
75
  targetIdentifiers: requestParams?.targetIdentifiers,
76
76
  parentFlowId: parentFlowId || returnValue?.parentFlowId,
77
77
  status: mergedErrors.length > 0 ? 'error' : 'complete',
78
- errorsFound: mergedErrors
78
+ foundErrors: mergedErrors
79
79
  };
80
80
 
81
81
  const topicArn = snsSharedLib.snsTopicArnByFlowSchema(
@@ -89,7 +89,7 @@ export default async function UpdateAfterHookCallbackMain(
89
89
  {
90
90
  ...actionData,
91
91
  status: mergedErrors.length > 0 ? 'error' : 'complete',
92
- errorsFound: mergedErrors
92
+ foundErrors: mergedErrors
93
93
  }
94
94
  );
95
95
 
@@ -111,7 +111,7 @@ export default async function UpdateAfterHookCallbackMain(
111
111
  return {
112
112
  returnValue,
113
113
  status: mergedErrors.length > 0 ? 'error' : 'complete',
114
- errorsFound: mergedErrors
114
+ foundErrors: mergedErrors
115
115
  };
116
116
  } catch (error) {
117
117
  _izContext.logger.error('[UpdateAfterHookCallback] error:', error);
@@ -45,12 +45,12 @@ export default async function <%- upperCaseFlowTag %>BeforeHookCallbackMain(
45
45
 
46
46
  const {
47
47
  status,
48
- errorsFound = [],
48
+ foundErrors = [],
49
49
  returnValue,
50
50
  parentFlowId
51
51
  } = requestParams;
52
52
 
53
- const mergedErrors = Array.isArray(errorsFound) ? [...errorsFound] : [];
53
+ const mergedErrors = Array.isArray(foundErrors) ? [...foundErrors] : [];
54
54
  if (status === 'error' && mergedErrors.length === 0) {
55
55
  mergedErrors.push('BeforeHook execution reported error');
56
56
  }
@@ -82,7 +82,7 @@ export default async function <%- upperCaseFlowTag %>BeforeHookCallbackMain(
82
82
  {},
83
83
  versionedDataIds: originalRequestParams?.versionedDataIds,
84
84
  callingFlowConfig,
85
- errorsFound: mergedErrors
85
+ foundErrors: mergedErrors
86
86
  });
87
87
  }
88
88
 
@@ -23,29 +23,29 @@ function empty(value) {
23
23
  );
24
24
  }
25
25
 
26
- function validateInput(returnValue, status, graphServiceTag, errorsFound) {
26
+ function validateInput(returnValue, status, graphServiceTag, foundErrors) {
27
27
  if (!returnValue?.queryResult)
28
- errorsFound.push(
28
+ foundErrors.push(
29
29
  'message is not have property queryResult, should be not happen'
30
30
  );
31
31
  if (!returnValue?.requestParams?.objType)
32
- errorsFound.push(
32
+ foundErrors.push(
33
33
  'message is not have property objType, should be not happen'
34
34
  );
35
35
  if (!returnValue?.requestParams?.objInstanceFull)
36
- errorsFound.push(
36
+ foundErrors.push(
37
37
  'message is not have property objInstance, should be not objInstance'
38
38
  );
39
- if (status === 'error' && errorsFound.length === 0)
40
- errorsFound.push(
41
- '[invalid]status is error not have errorsFound form graphService'
39
+ if (status === 'error' && foundErrors.length === 0)
40
+ foundErrors.push(
41
+ '[invalid]status is error not have foundErrors form graphService'
42
42
  );
43
- if (status === 'complete' && errorsFound.length > 0)
44
- errorsFound.push(
45
- '[Invalid] status is complete should be not have errorsFound'
43
+ if (status === 'complete' && foundErrors.length > 0)
44
+ foundErrors.push(
45
+ '[Invalid] status is complete should be not have foundErrors'
46
46
  );
47
47
  if (graphServiceTag == null)
48
- errorsFound.push('[Invalid] graphServerTag is not empty string');
48
+ foundErrors.push('[Invalid] graphServerTag is not empty string');
49
49
  }
50
50
 
51
51
  export default async function UpdateComplete(
@@ -62,14 +62,14 @@ export default async function UpdateComplete(
62
62
  const {
63
63
  returnValue,
64
64
  status,
65
- errorsFound = [],
65
+ foundErrors = [],
66
66
  graphServiceTag,
67
67
  parentFlowId
68
68
  } = requestParams;
69
69
  if (empty(returnValue?.requestParams))
70
70
  throw new NoRetryError('message not an object');
71
- validateInput(returnValue, status, graphServiceTag, errorsFound);
72
- if (errorsFound.length > 0) errorsFound.push(errorsFound.join(','));
71
+ validateInput(returnValue, status, graphServiceTag, foundErrors);
72
+ if (foundErrors.length > 0) foundErrors.push(foundErrors.join(','));
73
73
 
74
74
  const awaitingStepId = await asyncFlowSharedLib.createAwaitingStepId(
75
75
  parentFlowId,
@@ -88,14 +88,14 @@ export default async function UpdateComplete(
88
88
  _izContext.logger.warn(
89
89
  `No pending step found for awaitingStepId: ${awaitingStepId}`
90
90
  );
91
- return { returnValue, status, errorsFound };
91
+ return { returnValue, status, foundErrors };
92
92
  }
93
93
  const result =
94
94
  await asyncFlowSharedLib.checkAllAwaitingStepsFinishedWithReturnParams(
95
95
  _izContext,
96
96
  pending.pendingStepId,
97
97
  awaitingStepId,
98
- errorsFound
98
+ foundErrors
99
99
  );
100
100
  _izContext.logger.debug(
101
101
  '[UpdateComplete] all awaiting steps result',
@@ -154,7 +154,7 @@ export default async function UpdateComplete(
154
154
  parentFlowId: parentFlowId || returnValue?.parentFlowId,
155
155
  existsNode,
156
156
  status,
157
- errorsFound
157
+ foundErrors
158
158
  };
159
159
 
160
160
  <%_ if (plan?.hasAfterHookSync) { _%>
@@ -185,12 +185,12 @@ export default async function UpdateComplete(
185
185
  callingFlowConfig
186
186
  }
187
187
  );
188
- if (hookResult?.errorsFound?.length > 0 || hookResult?.status === 'error') {
189
- errorsFound.push(...(hookResult.errorsFound || ['Hook <%= hook.flowTag %> failed']));
188
+ if (hookResult?.foundErrors?.length > 0 || hookResult?.status === 'error') {
189
+ foundErrors.push(...(hookResult.foundErrors || ['Hook <%= hook.flowTag %> failed']));
190
190
  }
191
191
  } catch (hookErr) {
192
192
  _izContext.logger.error('[UpdateComplete] Sync hook <%= hook.flowTag %> error:', hookErr);
193
- errorsFound.push(hookErr.message || 'Hook <%= hook.flowTag %> failed');
193
+ foundErrors.push(hookErr.message || 'Hook <%= hook.flowTag %> failed');
194
194
  }
195
195
  <%_ if (hook.targetObjectTypes && hook.targetObjectTypes.length > 0) { _%>
196
196
  }
@@ -277,9 +277,9 @@ export default async function UpdateComplete(
277
277
  _izContext,
278
278
  awaitingStepId,
279
279
  pending.pendingStepId,
280
- errorsFound
280
+ foundErrors
281
281
  );
282
- return { returnValue, status, errorsFound };
282
+ return { returnValue, status, foundErrors };
283
283
  } catch (error) {
284
284
  _izContext.logger.error('[UpdateComplete] error:', error);
285
285
  throw error;