@izara_project/izara-core-generate-service-code 1.0.83 → 1.0.85

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 (63) hide show
  1. package/package.json +4 -4
  2. package/src/compile/flowValidator.js +13 -2
  3. package/src/compile/loadSchemas.js +116 -7
  4. package/src/emit/attributeTree/emitAttributeTreeSchemas.js +388 -0
  5. package/src/emit/coreFunction/emitCoreFunctionArtifacts.js +34 -1
  6. package/src/emit/coreFunction/templates/InitialSetupConfig.ejs +29 -7
  7. package/src/emit/crud/crudActionPlan.js +41 -6
  8. package/src/emit/crud/emitCrudApplicationArtifacts.js +56 -8
  9. package/src/emit/crud/emitDynamicCrudFlowSchemas.js +153 -27
  10. package/src/emit/crud/generateCrudApplicationArtifacts.js +3 -2
  11. package/src/emit/crud/generateDynamicCrudFlowSchemas.js +3 -2
  12. package/src/emit/crud/loadLocalSchemaArrays.js +3 -3
  13. package/src/emit/crud/templates/CreateComplete_Main.ejs +1 -1
  14. package/src/emit/crud/templates/CreateConfirmComplete_Main.ejs +54 -0
  15. package/src/emit/crud/templates/CreateEndpoint_Main.ejs +252 -154
  16. package/src/emit/crud/templates/CreateLogicalLib.ejs +1163 -236
  17. package/src/emit/crud/templates/CreateNodeCallback_Main.ejs +221 -0
  18. package/src/emit/crud/templates/DeleteComplete_Main.ejs +1 -1
  19. package/src/emit/crud/templates/DeleteEndpoint_Main.ejs +33 -8
  20. package/src/emit/crud/templates/DeleteLogicalLib.ejs +6 -3
  21. package/src/emit/crud/templates/FlowEndpointRbacCallback_Main.ejs +20 -120
  22. package/src/emit/crud/templates/FlowEndpoint_HdrWbs.ejs +79 -10
  23. package/src/emit/crud/templates/FlowMain_Wbs.ejs +31 -35
  24. package/src/emit/crud/templates/GetEndpoint_Main.ejs +13 -0
  25. package/src/emit/crud/templates/UpdateComplete_Main.ejs +1 -1
  26. package/src/emit/crud/templates/UpdateEndpoint_Main.ejs +52 -3
  27. package/src/emit/crud/templates/UpdateLogicalLib.ejs +4 -3
  28. package/src/emit/custom/customFlows.js +47 -0
  29. package/src/emit/custom/emitCustomFlowApplicationArtifacts.js +168 -49
  30. package/src/emit/custom/generateCustomFlowApplicationArtifacts.js +1 -1
  31. package/src/emit/custom/templates/FlowEndpointRbacCallback_Main.ejs +194 -0
  32. package/src/emit/custom/templates/FlowEndpoint_Main.ejs +14 -22
  33. package/src/emit/custom/templates/FlowStep_Main.ejs +1 -1
  34. package/src/emit/function/templates/WbsFunction_Yaml.ejs +0 -2
  35. package/src/emit/rbac/emitDynamicRbacFlowSchemas.js +33 -8
  36. package/src/emit/rbac/emitRbacApplicationArtifacts.js +204 -7
  37. package/src/emit/rbac/templates/CancelUsage_Main.ejs +163 -0
  38. package/src/emit/rbac/templates/ConfirmUsage_Main.ejs +187 -0
  39. package/src/emit/rbac/templates/CreateTargetRole_Main.ejs +68 -6
  40. package/src/emit/rbac/templates/ListRbac_Main.ejs +9 -3
  41. package/src/emit/rbac/templates/RbacMutation_Main.ejs +1 -1
  42. package/src/emit/rbac/templates/ReservedDynamicUsage_Main.ejs +166 -0
  43. package/src/emit/rbac/templates/UserRbacFlow_Main.ejs +84 -23
  44. package/src/emit/rbac/templates/UserRoleMutation_Main.ejs +11 -8
  45. package/src/emit/relationship/emitDynamicRelationshipFlowSchemas.js +1 -1
  46. package/src/emit/relationship/templates/ChangeRelationship_Main.ejs +4 -4
  47. package/src/emit/resource/emitResourceArtifacts.js +351 -108
  48. package/src/emit/resource/templates/GeneratedLambdaRoleServiceConfig.ejs +3 -1
  49. package/src/emit/resource/templates/SystemDynamoDB_Yaml.ejs +55 -2
  50. package/src/emit/shared/templates/FlowHandler_HdrSqs.ejs +1 -1
  51. package/src/emit/system/emitSystemWebSocketArtifacts.js +6 -5
  52. package/src/emit/system/templates/WebSocketConnect.ejs +71 -12
  53. package/src/emit/system/templates/WebSocketConnect_Yaml.ejs +6 -0
  54. package/src/emit/systemText/emitSystemTextSchemas.js +1 -1
  55. package/src/generate.js +41 -10
  56. package/test/attributeTreeSchemas.test.js +219 -0
  57. package/test/createTargetRoleHandler.test.js +59 -4
  58. package/test/crudApplicationArtifacts.test.js +20 -3
  59. package/test/customFlowApplicationArtifacts.test.js +5 -5
  60. package/test/dynamicCrudFlowSchemas.test.js +107 -6
  61. package/test/dynamicRbacFlowSchemas.test.js +15 -2
  62. package/test/publicApi.test.js +6 -6
  63. package/test/resourceArtifacts.test.js +89 -27
@@ -50,6 +50,230 @@ const { createObjType, firstLetterUpperCase } = utils;
50
50
  const { createDataDetailsLib } = dataDetailsLib;
51
51
  const { createIdentifiersByUseCase } = identifiersObject;
52
52
 
53
+ // ── Helper Functions ──────────────────────────────────────────────────────────
54
+
55
+ /**
56
+ * Loads Schema and resolves submittedByUserId and targetIdentifiers
57
+ * @param {Object} _izContext - Izara context object
58
+ * @param {Object} requestParams - Request parameters
59
+ * @param {Array<string>} errorsFound - Error list
60
+ * @returns {Promise<{ objType: Object, objectSchema: Object, targetIdentifiers?: Object }>}
61
+ */
62
+ async function resolveSchemaAndIdentity(_izContext, requestParams, errorsFound) {
63
+ const objType = createObjType(requestParams.objectType);
64
+ const objectSchema = await getObjectSchema.getObjSchemaS3WithHierarchy(
65
+ _izContext,
66
+ objType
67
+ );
68
+ _izContext.logger.debug(`[${process.env.iz_serviceTag}:<%- flowTag %>] objectSchema:`, objectSchema);
69
+
70
+ let submittedByUserId, targetIdentifiers;
71
+ if (
72
+ objectSchema.generatedBy === 'user' ||
73
+ objectSchema.generatedBy === 'systemWithUser'
74
+ ) {
75
+ submittedByUserId =
76
+ requestParams.submittedByUserId ||
77
+ _izContext.correlationIds.get(coreConsts.SUBMITTED_BY_USER_ID);
78
+
79
+ targetIdentifiers = requestParams.targetIdentifiers;
80
+
81
+ if (!targetIdentifiers && submittedByUserId) {
82
+ targetIdentifiers = { submittedByUserId };
83
+ }
84
+
85
+ if (!submittedByUserId) errorsFound.push('Not have submittedByUserId');
86
+ if (objectSchema.hasOwnProperty('belongTo') && !targetIdentifiers)
87
+ errorsFound.push('not have targetIdentifiers');
88
+
89
+ if (targetIdentifiers) {
90
+ if (!targetIdentifiers.submittedByUserId && submittedByUserId) {
91
+ targetIdentifiers.submittedByUserId = submittedByUserId;
92
+ }
93
+
94
+ if (Array.isArray(objectSchema.identifiers)) {
95
+ for (const identifier of objectSchema.identifiers) {
96
+ if (identifier.fieldName) {
97
+ if (targetIdentifiers[identifier.fieldName] === undefined) {
98
+ targetIdentifiers[identifier.fieldName] = null;
99
+ }
100
+ } else if (Array.isArray(identifier.fieldNames)) {
101
+ for (const fn of identifier.fieldNames) {
102
+ if (targetIdentifiers[fn] === undefined) {
103
+ targetIdentifiers[fn] = null;
104
+ }
105
+ }
106
+ } else if (identifier.name) {
107
+ if (targetIdentifiers[identifier.name] === undefined) {
108
+ targetIdentifiers[identifier.name] = null;
109
+ }
110
+ }
111
+ }
112
+ }
113
+
114
+ requestParams.targetIdentifiers = targetIdentifiers;
115
+ }
116
+
117
+ _izContext.logger.debug(`[${process.env.iz_serviceTag}:<%- flowTag %>] Identity & Target Context Resolved:`, {
118
+ submittedByUserId: requestParams.submittedByUserId,
119
+ targetIdentifiers: requestParams.targetIdentifiers,
120
+ belongTo: objectSchema.belongTo,
121
+ generatedBy: objectSchema.generatedBy
122
+ });
123
+ } else if (objectSchema.generatedBy === 'searchResultGenerated') {
124
+ throw new NoRetryError(
125
+ 'error searchResultGenerated should not happen here'
126
+ );
127
+ }
128
+
129
+ return { objType, objectSchema, targetIdentifiers };
130
+ }
131
+
132
+ /**
133
+ * Resolves fromRequiredOnCreate fields and generates identifiers
134
+ * @param {Object} _izContext - Izara context object
135
+ * @param {Object} requestParams - Request parameters
136
+ * @param {Object} objectSchema - Base object schema
137
+ * @param {Object} objType - Object type
138
+ * @param {Object} targetIdentifiers - Target identifiers
139
+ * @param {Array<string>} errorsFound - Error list
140
+ * @returns {Promise<{ objectSchemas: Object, createDataDetails: Object }>}
141
+ */
142
+ async function resolveAndGenerateIdentifiers(
143
+ _izContext,
144
+ requestParams,
145
+ objectSchema,
146
+ objType,
147
+ targetIdentifiers,
148
+ errorsFound
149
+ ) {
150
+ const objectSchemas =
151
+ uploadUseCase.generateObjectSchemaForCombineFieldNames(
152
+ _izContext,
153
+ objectSchema
154
+ );
155
+ _izContext.logger.debug(`[${process.env.iz_serviceTag}:<%- flowTag %>] objectSchemas:`, objectSchemas);
156
+
157
+ const createDataDetails = await createDataDetailsLib(
158
+ _izContext,
159
+ objectSchemas
160
+ );
161
+ _izContext.logger.debug(`[${process.env.iz_serviceTag}:<%- flowTag %>] createDataDetails:`, createDataDetails);
162
+
163
+ if (requestParams.relationships?.length > 0) {
164
+ //(<beforeValidateRelationships>)
165
+ //(</beforeValidateRelationships>)
166
+ }
167
+
168
+ errorsFound.push(
169
+ ...(await createNodeLib.validateRequiredOnCreateLinks(
170
+ _izContext,
171
+ objType,
172
+ requestParams.relationships
173
+ ))
174
+ );
175
+ _izContext.logger.debug(`[${process.env.iz_serviceTag}:<%- flowTag %>] errorsFound:`, errorsFound);
176
+
177
+ // ── Resolve fromRequiredOnCreate fields ──
178
+ if (objectSchemas.fieldNames) {
179
+ if (!requestParams.fieldNames) requestParams.fieldNames = {};
180
+ for (const [fieldName, val] of Object.entries(objectSchemas.fieldNames)) {
181
+ if (val.fromRequiredOnCreate && requestParams.fieldNames[fieldName] === undefined) {
182
+ const fromConfig = val.fromRequiredOnCreate;
183
+ const sourceField = fromConfig.fieldName || fieldName;
184
+ if (fromConfig.belongToObjType === true && targetIdentifiers) {
185
+ const targetValue =
186
+ targetIdentifiers[sourceField] !== undefined
187
+ ? targetIdentifiers[sourceField]
188
+ : Object.values(targetIdentifiers)[0];
189
+ requestParams.fieldNames[fieldName] = targetValue;
190
+ } else if (fromConfig.relType && requestParams.relationships?.length > 0) {
191
+ const matchedRel = requestParams.relationships.find(
192
+ (rel) =>
193
+ rel.relType?.serviceTag === fromConfig.relType.serviceTag &&
194
+ rel.relType?.relationshipTag === fromConfig.relType.relationshipTag
195
+ );
196
+ if (matchedRel?.targetIdentifiers?.[sourceField] !== undefined) {
197
+ requestParams.fieldNames[fieldName] = matchedRel.targetIdentifiers[sourceField];
198
+ }
199
+ }
200
+ }
201
+ }
202
+ }
203
+
204
+ // ── Resolve identifiers ──
205
+ let errors;
206
+ const identifiers = objectSchemas.identifiers;
207
+ let optionalOnCreateIdentifiers;
208
+
209
+ if (
210
+ identifiers.length === 1 &&
211
+ !identifiers[0].hasOwnProperty('fieldNames')
212
+ ) {
213
+ [requestParams, errors] = await createIdentifiersByUseCase(
214
+ _izContext,
215
+ requestParams,
216
+ objectSchemas,
217
+ identifiers[0],
218
+ optionalOnCreateIdentifiers
219
+ );
220
+ errorsFound.push(...errors);
221
+ } else if (identifiers.length > 1) {
222
+ for (const identifier of identifiers) {
223
+ [requestParams, errors] = await createIdentifiersByUseCase(
224
+ _izContext,
225
+ requestParams,
226
+ objectSchemas,
227
+ identifier,
228
+ optionalOnCreateIdentifiers
229
+ );
230
+ errorsFound.push(...errors);
231
+ }
232
+ }
233
+
234
+ return { objectSchemas, createDataDetails };
235
+ }
236
+
237
+ /**
238
+ * Validates request field names against schema
239
+ * @param {Object} requestParams - Request parameters
240
+ * @param {Object} objectSchemas - Combined schema
241
+ * @param {Array<string>} errorsFound - Error list
242
+ */
243
+ function validateFieldNames(requestParams, objectSchemas, errorsFound) {
244
+ const listOfRequiredOnCreate = [];
245
+ const listOfOptionalOnCreate = [];
246
+
247
+ for (const [key, val] of Object.entries(objectSchemas.fieldNames)) {
248
+ if (
249
+ val.randomOnCreate === true ||
250
+ val.requiredOnCreate === true ||
251
+ val.fromRequiredOnCreate ||
252
+ val.hashOnCreate?.length
253
+ ) {
254
+ listOfRequiredOnCreate.push(key);
255
+ }
256
+ if (val.requiredOnCreate === false && val.optionalOnCreate === true) {
257
+ listOfOptionalOnCreate.push(key);
258
+ }
259
+ }
260
+
261
+ for (const fieldName of Object.keys(requestParams.fieldNames)) {
262
+ if (
263
+ !listOfRequiredOnCreate.includes(fieldName) &&
264
+ !listOfOptionalOnCreate.includes(fieldName)
265
+ ) {
266
+ errorsFound.push('[invalid] over fieldNames create object');
267
+ }
268
+ if (errorsFound.length > 0) {
269
+ _izContext.logger.debug(`[${process.env.iz_serviceTag}:<%- flowTag %>] HaveError:`, errorsFound);
270
+ break;
271
+ }
272
+ }
273
+ }
274
+
275
+ // ── Main Entry Function ───────────────────────────────────────────────────────
276
+
53
277
  /**
54
278
  * Creates an object instance and proceeds directly to logical processing
55
279
  * @param {Object} _izContext - Context object with logger
@@ -65,183 +289,49 @@ export default async function <%- flowTag %>(
65
289
  //(</additionalParams>)
66
290
  ) {
67
291
  try {
68
- _izContext.logger.debug('[<%- flowTag %>] createMain:', {
292
+ _izContext.logger.debug(`[${process.env.iz_serviceTag}:<%- flowTag %>] createMain:`, {
69
293
  requestParams,
70
294
  callingFlowConfig
71
295
  });
72
296
 
73
297
  const errorsFound = [];
74
- const objType = createObjType(requestParams.objectType);
75
-
76
- // ── Load schema ───────────────────────────────────────────────────────────
77
- const objectSchema = await getObjectSchema.getObjSchemaS3WithHierarchy(
78
- _izContext,
79
- objType
80
- );
81
- _izContext.logger.debug('objectSchema', objectSchema);
82
298
 
83
- // ── Resolve userId / targetId ─────────────────────────────────────────────
84
- let userId, targetId;
85
- if (
86
- objectSchema.generatedBy === 'user' ||
87
- objectSchema.generatedBy === 'systemWithUser'
88
- ) {
89
- userId = _izContext.correlationIds.get(coreConsts.BASE_USER_ID);
90
- targetId = _izContext.correlationIds.get(coreConsts.TARGET_ID);
91
- if (!userId) errorsFound.push('Not have userId');
92
- if (objectSchema.hasOwnProperty('belongTo') && !targetId)
93
- errorsFound.push('not have targetId');
94
- } else if (objectSchema.generatedBy === 'searchResultGenerated') {
95
- throw new NoRetryError(
96
- 'error searchResultGenerated should not happen here'
97
- );
98
- }
299
+ // Step 1: Resolve Schema & Identity
300
+ const { objType, objectSchema, targetIdentifiers } =
301
+ await resolveSchemaAndIdentity(_izContext, requestParams, errorsFound);
99
302
 
100
303
  //(<beforeQuery>)
101
304
  //(</beforeQuery>)
102
305
 
103
- // ── Build objectSchemas ───────────────────────────────────────────────────
104
- const objectSchemas =
105
- uploadUseCase.generateObjectSchemaForCombineFieldNames(
106
- _izContext,
107
- objectSchema
108
- );
109
- _izContext.logger.debug('objectSchemas', objectSchemas);
110
-
111
- // ── Build createDataDetails ───────────────────────────────────────────────
112
- const createDataDetails = await createDataDetailsLib(
306
+ // Step 2: Resolve fromRequiredOnCreate fields & Generate Identifiers
307
+ const { objectSchemas } = await resolveAndGenerateIdentifiers(
113
308
  _izContext,
114
- objectSchemas
115
- );
116
- _izContext.logger.debug('createDataDetails:', createDataDetails);
117
-
118
- if (requestParams.relationships?.length > 0) {
119
- //(<beforeValidateRelationships>)
120
- //(</beforeValidateRelationships>)
121
- }
122
-
123
- errorsFound.push(
124
- ...(await createNodeLib.validateRequiredOnCreateLinks(
125
- _izContext,
126
- objType,
127
- requestParams.relationships
128
- ))
309
+ requestParams,
310
+ objectSchema,
311
+ objType,
312
+ targetIdentifiers,
313
+ errorsFound
129
314
  );
130
- _izContext.logger.debug('errorsFound', errorsFound);
131
-
132
- // ── Resolve fromRequiredOnCreate fields ──────────────────────────────────
133
- if (objectSchemas.fieldNames) {
134
- if (!requestParams.fieldNames) requestParams.fieldNames = {};
135
- for (const [fieldName, val] of Object.entries(objectSchemas.fieldNames)) {
136
- if (val.fromRequiredOnCreate && requestParams.fieldNames[fieldName] === undefined) {
137
- const fromConfig = val.fromRequiredOnCreate;
138
- const sourceField = fromConfig.fieldName || fieldName;
139
- if (fromConfig.belongToObjType === true && targetId) {
140
- requestParams.fieldNames[fieldName] = targetId;
141
- } else if (fromConfig.relType && requestParams.relationships?.length > 0) {
142
- const matchedRel = requestParams.relationships.find(
143
- (rel) =>
144
- rel.relType?.serviceTag === fromConfig.relType.serviceTag &&
145
- rel.relType?.relationshipTag === fromConfig.relType.relationshipTag
146
- );
147
- if (matchedRel?.targetIdentifiers?.[sourceField] !== undefined) {
148
- requestParams.fieldNames[fieldName] = matchedRel.targetIdentifiers[sourceField];
149
- }
150
- }
151
- }
152
- }
153
- }
154
315
 
155
- for (const [key, val] of Object.entries(objectSchemas.fieldNames)) {
156
- if (
157
- val.randomOnCreate === true ||
158
- val.requiredOnCreate === true ||
159
- val.fromRequiredOnCreate ||
160
- val.hashOnCreate?.length
161
- ) {
162
- listOfRequiredOnCreate.push(key);
163
- }
164
- if (val.requiredOnCreate === false && val.optionalOnCreate === true) {
165
- listOfOptionalOnCreate.push(key);
166
- }
167
- }
168
-
169
- _izContext.logger.debug('listOfRequiredOnCreate', listOfRequiredOnCreate);
170
- _izContext.logger.debug('listOfOptionalOnCreate', listOfOptionalOnCreate);
171
-
172
- // ── Resolve identifiers ───────────────────────────────────────────────────
173
- let errors;
174
- const identifiers = objectSchemas.identifiers;
175
-
176
- //(<createOptionalOnCreateIdentifiers>)
177
- let optionalOnCreateIdentifiers;
178
- //(</createOptionalOnCreateIdentifiers>)
179
-
180
- if (
181
- identifiers.length === 1 &&
182
- !identifiers[0].hasOwnProperty('fieldNames')
183
- ) {
184
- [requestParams, errors] = await createIdentifiersByUseCase(
316
+ if (errorsFound.length > 0) {
317
+ return await <%- flowTag %>LogicalLib(
185
318
  _izContext,
186
319
  requestParams,
187
- objectSchemas,
188
- identifiers[0],
189
- optionalOnCreateIdentifiers
320
+ callingFlowConfig,
321
+ errorsFound
190
322
  );
191
- } else if (identifiers.length > 1) {
192
- for (const identifier of identifiers) {
193
- [requestParams, errors] = await createIdentifiersByUseCase(
194
- _izContext,
195
- requestParams,
196
- objectSchemas,
197
- identifier,
198
- optionalOnCreateIdentifiers
199
- );
200
- }
201
323
  }
202
324
 
203
- _izContext.logger.debug('requestParams:', requestParams);
204
- errorsFound.push(...errors);
205
- _izContext.logger.debug('errorsFound::', errorsFound);
325
+ // Step 3: Validate FieldNames
326
+ validateFieldNames(requestParams, objectSchemas, errorsFound);
206
327
 
207
- if (errorsFound.length > 0)
328
+ if (errorsFound.length > 0) {
208
329
  return await <%- flowTag %>LogicalLib(
209
330
  _izContext,
210
331
  requestParams,
211
332
  callingFlowConfig,
212
333
  errorsFound
213
334
  );
214
-
215
- // ── Validate fieldNames ───────────────────────────────────────────────────
216
- const objInstanceFull = { identifiers: {}, fields: {} };
217
-
218
- //(<optionalObjInstanceFull>)
219
- //(</optionalObjInstanceFull>)
220
-
221
- for (const fieldName of Object.keys(requestParams.fieldNames)) {
222
- if (
223
- !listOfRequiredOnCreate.includes(fieldName) &&
224
- !listOfOptionalOnCreate.includes(fieldName)
225
- ) {
226
- errorsFound.push('[invalid] over fieldNames create object');
227
- }
228
- if (
229
- listOfOptionalOnCreate.length > 0 &&
230
- listOfRequiredOnCreate.includes(fieldName)
231
- ) {
232
- //(<optionalParams>)
233
- //(</optionalParams>)
234
- }
235
- if (objectSchemas.identifierFieldNames.includes(fieldName)) {
236
- _izContext.logger.debug('identifiers is', fieldName);
237
- Object.assign(objInstanceFull.identifiers, {
238
- [fieldName]: requestParams.fieldNames[fieldName]
239
- });
240
- }
241
- if (errorsFound.length > 0) {
242
- _izContext.logger.debug('HaveError::', errorsFound);
243
- break;
244
- }
245
335
  }
246
336
 
247
337
  <%_
@@ -276,6 +366,13 @@ export default async function <%- flowTag %>(
276
366
  const parameterGroups = {};
277
367
  //(</rbacParameterGroups_<%- flowTag %>)
278
368
 
369
+ const isBillable = objectSchema.addOnDataStructure?.some(
370
+ (item) => item.type === 'rbac' && item.billable === true
371
+ );
372
+ if (isBillable) {
373
+ requestParams.billable = true;
374
+ }
375
+
279
376
  const resultPermissionCheck = await checkRbacPermission(
280
377
  _izContext,
281
378
  {
@@ -288,12 +385,12 @@ export default async function <%- flowTag %>(
288
385
  serviceTag: <%- rbacServiceTags.length === 1 ? rbacServiceTags[0] : `{ ${Object.entries(rbacServiceTagMap).map(([k, v]) => `'${k}': ${v}`).join(', ')} }[requestParams.objectType] || process.env.iz_serviceTag` %>
289
386
  },
290
387
  requestParams: requestParams,
291
- nextFlowStepName: '<%- flowTag %>RbacCallback'
388
+ nextFlowStepName: '<%- plan?.hasRbacCallback ? `${flowTag}RbacCallback` : `${flowTag}Complete` %>'
292
389
  }
293
390
  );
294
391
 
295
392
  _izContext.logger.debug(
296
- '[lib:auth:checkRbacPermission] resultPermissionCheck:',
393
+ `[${process.env.iz_serviceTag}:<%- flowTag %>] checkRbacPermission result:`,
297
394
  resultPermissionCheck
298
395
  );
299
396
 
@@ -459,6 +556,7 @@ export default async function <%- flowTag %>(
459
556
  errorsFound
460
557
  );
461
558
  } catch (err) {
559
+ _izContext.logger.error(`[${process.env.iz_serviceTag}:<%- flowTag %>] error:`, err);
462
560
  throw err;
463
561
  }
464
562
  }