@izara_project/izara-core-generate-service-code 1.0.93 → 1.0.95

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 (27) hide show
  1. package/package.json +1 -1
  2. package/src/compile/compileProject.js +3 -1
  3. package/src/compile/flowValidator.js +182 -18
  4. package/src/compile/loadSchemas.js +144 -9
  5. package/src/emit/coreFunction/emitCoreFunctionArtifacts.js +1 -26
  6. package/src/emit/coreFunction/templates/InitialSetupConfig.ejs +1 -31
  7. package/src/emit/custom/customFlowPaths.js +3 -16
  8. package/src/emit/custom/customFlowS3.js +9 -4
  9. package/src/emit/custom/customFlowSteps.js +14 -47
  10. package/src/emit/custom/customFlows.js +27 -6
  11. package/src/emit/custom/emitCustomFlowApplicationArtifacts.js +1 -47
  12. package/src/emit/custom/templates/FlowEndpoint_Main.ejs +75 -2
  13. package/src/emit/relationship/templates/ChangeRelationship_Main.ejs +7 -7
  14. package/src/emit/relationship/templates/CreateRelationship_Main.ejs +5 -5
  15. package/src/emit/relationship/templates/DeleteRelationship_Main.ejs +3 -3
  16. package/src/emit/relationship/templates/GetRelationship_Main.ejs +1 -1
  17. package/src/emit/relationship/templates/MoveRelationship_Main.ejs +5 -5
  18. package/src/emit/relationship/templates/UpdateRelationship_Main.ejs +5 -5
  19. package/src/emit/resource/iamResourceArtifacts.js +6 -6
  20. package/src/emit/resource/resourceState.js +3 -9
  21. package/src/emit/system/emitSystemFindDataArtifacts.js +15 -14
  22. package/test/core.test.js +13 -0
  23. package/test/customFlowApplicationArtifacts.test.js +285 -17
  24. package/test/graphDrivenFlowSchema.test.js +325 -0
  25. package/test/relationshipApplicationArtifacts.test.js +29 -0
  26. package/test/resourceArtifacts.test.js +46 -1
  27. package/test/systemFindDataArtifacts.test.js +73 -0
@@ -13,10 +13,7 @@ import {
13
13
  export async function emitExtTopicStep({ flow, step, flowTag, stepName }) {
14
14
  const source = `app/src/generatedCode/FlowSchemas/${flowTag}/source`;
15
15
  const handlerRoot = `src/generatedCode/FlowSchemas/${flowTag}/source`;
16
- let functionName = `${flowTag}${stepName}`;
17
- if (stepName.startsWith(flowTag)) {
18
- functionName = stepName;
19
- }
16
+ const functionName = `${flowTag}${stepName}`;
20
17
  const mainFileName = `${functionName}_Main`;
21
18
  const startConfig = stepConfig(flow, step);
22
19
 
@@ -160,7 +157,6 @@ export async function emitOwnTopicRoot(flow, objects) {
160
157
  upperCaseFlowTag: tag,
161
158
  startConfig: _startConfig(flow)
162
159
  };
163
- const isRbac = flowHasRbac(flow, objects);
164
160
  const ownArtifacts = [
165
161
  {
166
162
  path: `${source}/${mainFileName}.js`,
@@ -212,46 +208,6 @@ export async function emitOwnTopicRoot(flow, objects) {
212
208
  })
213
209
  ];
214
210
 
215
- if (isRbac) {
216
- const rbacStep = (flow.flowSteps || []).find(
217
- (s) =>
218
- typeof s?.stepName === 'string' &&
219
- s.stepName.toLowerCase() === 'rbaccallback'
220
- );
221
- const rbacConfig = rbacStep ? stepConfig(flow, rbacStep) : null;
222
- ownArtifacts.push(
223
- {
224
- path: `${source}/${tag}RbacCallback_Main.js`,
225
- content: await renderCustom('FlowEndpointRbacCallback_Main.ejs', {
226
- flowTag: flow.flowTag,
227
- upperCaseFlowTag: tag,
228
- functionName: `${tag}RbacCallbackMain`
229
- })
230
- },
231
- {
232
- path: `${source}/${tag}RbacCallback_HdrSqs.js`,
233
- content: await renderShared('FlowHandler_HdrSqs.ejs', {
234
- flowTag: flow.flowTag,
235
- flowStepName: 'RbacCallback',
236
- mainFileName: `${tag}RbacCallback_Main`,
237
- functionName: `${tag}RbacCallbackMain`,
238
- queueName: `${tag}RbacCallbackHdrSqs`,
239
- startConfig: rbacConfig
240
- })
241
- }
242
- );
243
- ownFunctions.push(
244
- renderSqsFunctionYaml({
245
- functionName: `${tag}RbacCallbackHdrSqs`,
246
- handlerPath: `${handlerRoot}/${tag}RbacCallback_HdrSqs.main`,
247
- roleName: customFlowRoleName(flow.flowTag),
248
- queueName: `${tag}RbacCallbackHdrSqs`,
249
- flowTag: flow.flowTag,
250
- flowStepName: 'RbacCallback'
251
- })
252
- );
253
- }
254
-
255
211
  return {
256
212
  artifacts: ownArtifacts,
257
213
  functions: ownFunctions
@@ -352,8 +308,12 @@ export function storedCacheTableName(flow, objects) {
352
308
  if (flow.statusType !== 'storedCache') {
353
309
  return null;
354
310
  }
311
+ const targetObjectType =
312
+ typeof flow.objType === 'string'
313
+ ? flow.objType
314
+ : flow.objType?.objectType;
355
315
  const candidates = objects.filter(
356
- (object) => object.objectType === flow.objType?.objectType
316
+ (object) => object.objectType === targetObjectType
357
317
  );
358
318
  let object;
359
319
  if (flow.objType?.serviceTag) {
@@ -373,7 +333,14 @@ export function storedCacheTableName(flow, objects) {
373
333
  if (targetResource?.tableName) {
374
334
  return targetResource.tableName;
375
335
  }
376
- return null;
336
+ const flowTag = flow.flowTag || 'unknown';
337
+ const targetObj = JSON.stringify(flow.objType);
338
+ console.error(
339
+ `[ERROR] [FlowSchema Validation] Flow '${flowTag}' has statusType 'storedCache' but cannot resolve DynamoDB tableName from objType ${targetObj}`
340
+ );
341
+ throw new Error(
342
+ `FlowSchema validation error: Flow '${flowTag}' has statusType 'storedCache' but cannot resolve DynamoDB tableName from objType ${targetObj}. Ensure the ObjectSchema exists and defines a DynamoDB storage resource with tableName.`
343
+ );
377
344
  }
378
345
 
379
346
  export async function renderStepMain(functionName, startConfig = null) {
@@ -14,11 +14,20 @@ export function supportedCustomFlows(flows) {
14
14
  throw new TypeError('flows must be an array');
15
15
  }
16
16
  return flows.filter((flow) => {
17
- if (typeof flow?.flowTag !== 'string' || flow.flowTag === '') {
18
- return false;
17
+ if (typeof flow?.flowTag !== 'string' || flow.flowTag.trim() === '') {
18
+ throw new Error(
19
+ 'FlowSchema validation error: flowTag is required and must be a non-empty string'
20
+ );
19
21
  }
20
- if (!Array.isArray(flow.event)) {
21
- return false;
22
+ if (!Array.isArray(flow.event) || flow.event.length === 0) {
23
+ throw new Error(
24
+ `FlowSchema validation error: Flow '${flow.flowTag}' requires a non-empty 'event' array`
25
+ );
26
+ }
27
+ if (flow.event.includes('generateCode') && flow.event.length > 1) {
28
+ throw new Error(
29
+ `FlowSchema validation error: Flow '${flow.flowTag}' with event 'generateCode' must be a standalone event and cannot co-exist with other events`
30
+ );
22
31
  }
23
32
  const hasSupportedEvent = flow.event.some((e) => SUPPORTED_EVENTS.has(e));
24
33
  if (!hasSupportedEvent) {
@@ -28,9 +37,14 @@ export function supportedCustomFlows(flows) {
28
37
  if (flowHasOwnTopic(flow)) {
29
38
  return false;
30
39
  }
31
- if (!flow.generatedCodeConfig.codeHookTag) {
40
+ if (flow.event.includes('dsq')) {
32
41
  return false;
33
42
  }
43
+ if (!flow.generatedCodeConfig.codeHookTag) {
44
+ throw new Error(
45
+ `FlowSchema validation error: Flow '${flow.flowTag}' has generatedCodeConfig without ownTopic, which requires 'codeHookTag' ('before' | 'after')`
46
+ );
47
+ }
34
48
  }
35
49
  return true;
36
50
  });
@@ -67,6 +81,11 @@ export function flowExtTopicSteps(flows) {
67
81
  }
68
82
  const hasTriggerFlowTypes =
69
83
  Array.isArray(flow.triggerFlowTypes) && flow.triggerFlowTypes.length > 0;
84
+ if (flow.statusType === 'triggerCache' && !hasTriggerFlowTypes) {
85
+ throw new Error(
86
+ `FlowSchema validation error: Flow '${flow.flowTag}' has statusType 'triggerCache' but requires a non-empty 'triggerFlowTypes' array`
87
+ );
88
+ }
70
89
  const steps = flow.flowSteps ?? [];
71
90
  const hasCheckStep = steps.some(
72
91
  (step) =>
@@ -87,7 +106,9 @@ export function flowExtTopicSteps(flows) {
87
106
  }
88
107
  const isCheckStep = step.stepName.toLowerCase().includes('checktrigger');
89
108
  if (isCheckStep && !hasTriggerFlowTypes) {
90
- return [];
109
+ throw new Error(
110
+ `FlowSchema validation error: Flow '${flow.flowTag}' defines step '${step.stepName}' but requires a non-empty 'triggerFlowTypes' array`
111
+ );
91
112
  }
92
113
  return [
93
114
  {
@@ -5,8 +5,7 @@ import {
5
5
  generatedDsqFlows,
6
6
  generatedOwnTopicFlows,
7
7
  supportedCustomFlows,
8
- upperFirst,
9
- flowHasRbac
8
+ upperFirst
10
9
  } from './customFlows.js';
11
10
  import {
12
11
  customFlowApplicationManagedPaths,
@@ -19,11 +18,9 @@ import {
19
18
  emitDsqStep,
20
19
  emitOwnTopicRoot,
21
20
  renderEndpointMain,
22
- stepConfig,
23
21
  _startConfig
24
22
  } from './customFlowSteps.js';
25
23
  import {
26
- renderCustom,
27
24
  renderShared,
28
25
  renderDsq
29
26
  } from './customFlowTemplates.js';
@@ -101,49 +98,6 @@ async function emitFlow(flow, objects) {
101
98
  }
102
99
  const functions = [];
103
100
 
104
- const isRbac = flowHasRbac(flow, objects);
105
- if (isRbac && !flow.event.includes('ownTopic')) {
106
- const rbacStep = (flow.flowSteps || []).find(
107
- (s) =>
108
- typeof s?.stepName === 'string' &&
109
- s.stepName.toLowerCase() === 'rbaccallback'
110
- );
111
- let rbacConfig = null;
112
- if (rbacStep) {
113
- rbacConfig = stepConfig(flow, rbacStep);
114
- }
115
- artifacts.push(
116
- {
117
- path: `${source}/${tag}RbacCallback_Main.js`,
118
- content: await renderCustom('FlowEndpointRbacCallback_Main.ejs', {
119
- flowTag: flow.flowTag,
120
- upperCaseFlowTag: tag,
121
- functionName: `${tag}RbacCallbackMain`
122
- })
123
- },
124
- {
125
- path: `${source}/${tag}RbacCallback_HdrSqs.js`,
126
- content: await renderShared('FlowHandler_HdrSqs.ejs', {
127
- flowTag: flow.flowTag,
128
- flowStepName: 'RbacCallback',
129
- mainFileName: `${tag}RbacCallback_Main`,
130
- functionName: `${tag}RbacCallbackMain`,
131
- queueName: `${tag}RbacCallbackHdrSqs`,
132
- startConfig: rbacConfig
133
- })
134
- }
135
- );
136
- functions.push(
137
- renderSqsFunctionYaml({
138
- functionName: `${tag}RbacCallbackHdrSqs`,
139
- handlerPath: `${handlerRoot}/${tag}RbacCallback_HdrSqs.main`,
140
- roleName: customFlowRoleName(flow.flowTag),
141
- queueName: `${tag}RbacCallbackHdrSqs`,
142
- flowTag: flow.flowTag,
143
- flowStepName: 'RbacCallback'
144
- })
145
- );
146
- }
147
101
 
148
102
  if (flow.event.includes('extTopic') && !flow.event.includes('ownTopic')) {
149
103
  artifacts.push({
@@ -26,6 +26,9 @@ import lambdaSharedLib from '@izara_project/izara-core-library-lambda';
26
26
  <% if (typeof flow !== 'undefined' && flow.statusType === 'storedCache') { %>
27
27
  import storedCacheSharedLib from '@izara_project/izara-core-library-stored-cache';
28
28
  <% } %>
29
+ <% if (typeof flow !== 'undefined' && flow.statusType === 'triggerCache') { %>
30
+ import { triggeredCacheSharedLibV2 } from '@izara_project/izara-core-library-trigger-cache';
31
+ <% } %>
29
32
 
30
33
  //(<optionalImport>)
31
34
  import { getObjectSchema } from '@izara_project/izara-core-library-service-schemas';
@@ -73,6 +76,70 @@ export default async function <%- typeof functionName !== 'undefined' ? function
73
76
  callingFlowConfig
74
77
  );
75
78
 
79
+ <% if (typeof flow !== 'undefined' && flow.statusType === 'triggerCache') { -%>
80
+
81
+ //(<beforeCheckTriggeredCache>)
82
+ //(</beforeCheckTriggeredCache>)
83
+
84
+ const checkTriggerReseted =
85
+ await triggeredCacheSharedLibV2.checkTriggerResetedV2(
86
+ _izContext,
87
+ {
88
+ serviceTag: process.env.iz_serviceTag,
89
+ flowTag: '<%= flowTag %>'
90
+ },
91
+ //(<triggerCacheIdentifiers>)
92
+ {}
93
+ //(</triggerCacheIdentifiers>)
94
+ //(<triggerCacheUniqueRequestId>)
95
+ //(</triggerCacheUniqueRequestId>)
96
+ //(<triggerCacheSettings>)
97
+ //(</triggerCacheSettings>)
98
+ );
99
+
100
+ _izContext.logger.debug(
101
+ `[${process.env.iz_serviceTag}:<%-
102
+ typeof functionName !== 'undefined'
103
+ ? functionName
104
+ : upperCaseFlowTag
105
+ %>] checkTriggerReseted:`,
106
+ checkTriggerReseted
107
+ );
108
+
109
+ //(<afterCheckTriggerReseted>)
110
+ //(</afterCheckTriggerReseted>)
111
+
112
+ const triggeredCacheResult =
113
+ await triggeredCacheSharedLibV2.checkTriggeredCacheV2(
114
+ _izContext,
115
+ {
116
+ serviceTag: process.env.iz_serviceTag,
117
+ flowTag: '<%= flowTag %>'
118
+ },
119
+ //(<triggerCacheCheckIdentifiers>)
120
+ {}
121
+ //(</triggerCacheCheckIdentifiers>)
122
+ );
123
+
124
+ _izContext.logger.debug(
125
+ `[${process.env.iz_serviceTag}:<%-
126
+ typeof functionName !== 'undefined'
127
+ ? functionName
128
+ : upperCaseFlowTag
129
+ %>] triggeredCacheResult:`,
130
+ triggeredCacheResult
131
+ );
132
+
133
+ //(<afterCheckTriggeredCache>)
134
+ //(</afterCheckTriggeredCache>)
135
+
136
+ if (triggeredCacheResult?.hasPendingTasks) {
137
+ //(<dispatchTriggerFlowHook>)
138
+ //(</dispatchTriggerFlowHook>)
139
+ return triggeredCacheResult;
140
+ }
141
+
142
+ <% } -%>
76
143
  <% if (typeof flow !== 'undefined' && flow.statusType === 'storedCache') { -%>
77
144
 
78
145
  //(<beforeCheckCache>)
@@ -107,9 +174,15 @@ export default async function <%- typeof functionName !== 'undefined' ? function
107
174
 
108
175
  //(<checkStoredCacheHook>)
109
176
  //(</checkStoredCacheHook>)
177
+
178
+ if (cacheMainStatus === 'complete') {
179
+ //(<returnStoredCacheHit>)
180
+ return cacheMain;
181
+ //(</returnStoredCacheHit>)
182
+ }
110
183
  }
111
184
  <% } -%>
112
- <% if (typeof flow !== 'undefined' && flow.isRbac && !flow.generatedCodeConfig) { -%>
185
+ <% if (typeof flow !== 'undefined' && flow.isRbac && !flow.generatedCodeConfig && flow.initiateBy !== 'systemNoUser') { -%>
113
186
 
114
187
  const { checkRbacPermission } =
115
188
  await import('@izara_project/izara-authorization');
@@ -127,7 +200,7 @@ export default async function <%- typeof functionName !== 'undefined' ? function
127
200
  serviceTag: '<%- (typeof rbacServiceTag !== "undefined" && rbacServiceTag) ? rbacServiceTag : ((flow.objType?.belongTo ? (Array.isArray(flow.objType.belongTo) ? flow.objType.belongTo[0]?.serviceTag : flow.objType.belongTo?.serviceTag) : null) || flow.serviceTag || (flow.objType ? flow.objType.serviceTag : "")) %>'
128
201
  },
129
202
  requestParams: typeof requestParams !== 'undefined' ? requestParams : {},
130
- nextFlowStepName: '<%- upperCaseFlowTag %>RbacCallback'
203
+ sync: true
131
204
  }
132
205
  );
133
206
 
@@ -84,15 +84,15 @@ export default async function <%- functionName %>(
84
84
  firstObject,
85
85
  secondObject,
86
86
  oldRelTypeAndDirection,
87
- newRelType
88
- //(<requestParamCreateRel>)
89
- //(</requestParamCreateRel>)
87
+ newRelType,
88
+ //(<requestParamChangeRel>)
89
+ //(</requestParamChangeRel>)
90
90
  } = requestParams;
91
91
 
92
92
  let foundErrors = [];
93
93
  const parentFlowId = identifierUuid();
94
94
  //(<beforeValidateChangeRel>)
95
- //(</beforeValidateChangeRel>).
95
+ //(</beforeValidateChangeRel>)
96
96
  // validate object and identifiers
97
97
  async function validateIdentifiersExists(
98
98
  _izContext,
@@ -443,7 +443,7 @@ export default async function <%- functionName %>(
443
443
  newRelType,
444
444
  originTimestamp,
445
445
  changedByUserId,
446
- parentFlowId
446
+ parentFlowId,
447
447
  //(<messageBodyChangeRel>)
448
448
  //(</messageBodyChangeRel>)
449
449
 
@@ -461,15 +461,15 @@ export default async function <%- functionName %>(
461
461
  callingFlowConfig, // receive parent callingFlowConfig.
462
462
  callingFlowSharedLib.createCallingFlowConfig(
463
463
  // calling flow own service
464
- //(<callingFlowProperties>)
465
464
  await lambdaSharedLib.lambdaFunctionName(
466
465
  _izContext,
467
466
  TOPIC_NAME_GENERATE_CODE.changeRelationshipComplete
468
467
  ),
469
- //(</callingFlowProperties>)
468
+ //(<callingFlowProperties>)
470
469
  {
471
470
  graphServiceTag: storageResource.graphServiceTag
472
471
  }
472
+ //(</callingFlowProperties>)
473
473
  )
474
474
  )
475
475
  );
@@ -83,7 +83,7 @@ export default async function createRelationship(
83
83
  relationshipDirection,
84
84
  relationshipProperties,
85
85
  deepPathConditional,
86
- settings = {}
86
+ settings = {},
87
87
  //(<requestParamCreateRel>)
88
88
  //(</requestParamCreateRel>)
89
89
  } = requestParams;
@@ -93,7 +93,7 @@ export default async function createRelationship(
93
93
  let foundErrors = [];
94
94
  const parentFlowId = identifierUuid();
95
95
  //(<beforeValidateCreateRel>)
96
- //(</beforeValidateCreateRel>).
96
+ //(</beforeValidateCreateRel>)
97
97
  // validate object and identifiers
98
98
  async function validateIdentifiersExists(
99
99
  _izContext,
@@ -465,7 +465,7 @@ export default async function createRelationship(
465
465
  relationshipProperties,
466
466
  deepPathConditional: deepPathConditional || [],
467
467
  parentFlowId,
468
- settings: { createOnConditionalFail: createOnConditionalFail }
468
+ settings: { createOnConditionalFail: createOnConditionalFail },
469
469
  //(<inCreateRelMessageBodyCreateRel>)
470
470
  //(</inCreateRelMessageBodyCreateRel>)
471
471
 
@@ -483,15 +483,15 @@ export default async function createRelationship(
483
483
  callingFlowConfig, // receive parent callingFlowConfig.
484
484
  callingFlowSharedLib.createCallingFlowConfig(
485
485
  // calling flow own service
486
- //(<callingFlowProperties>)
487
486
  await lambdaSharedLib.lambdaFunctionName(
488
487
  _izContext,
489
488
  TOPIC_NAME_GENERATE_CODE.createRelComplete
490
489
  ),
491
- //(</callingFlowProperties>)
490
+ //(<callingFlowProperties>)
492
491
  {
493
492
  graphServiceTag: storageResource.graphServiceTag
494
493
  }
494
+ //(</callingFlowProperties>)
495
495
  )
496
496
  )
497
497
  );
@@ -81,7 +81,7 @@ export default async function deleteRelationship(
81
81
  secondObject,
82
82
  relType,
83
83
  relId,
84
- relationshipDirection
84
+ relationshipDirection,
85
85
  //(<requestParamDeleteRel>)
86
86
  //(</requestParamDeleteRel>)
87
87
  } = requestParams;
@@ -346,7 +346,7 @@ export default async function deleteRelationship(
346
346
  relType: relType,
347
347
  relId: relId,
348
348
  relationshipDirection: relationshipDirection,
349
- parentFlowId: parentFlowId
349
+ parentFlowId: parentFlowId,
350
350
  //(<inDeleteRelMessageBody>)
351
351
  //(</inDeleteRelMessageBody>)
352
352
  };
@@ -362,11 +362,11 @@ export default async function deleteRelationship(
362
362
  callingFlowConfig, // receive parent callingFlowConfig.
363
363
  callingFlowSharedLib.createCallingFlowConfig(
364
364
  // calling flow own service
365
- //(<callingFlowProperties>)
366
365
  await lambdaSharedLib.lambdaFunctionName(
367
366
  _izContext,
368
367
  TOPIC_NAME_GENERATE_CODE.deleteRelComplete
369
368
  ),
369
+ //(<callingFlowProperties>)
370
370
  {}
371
371
  //(</callingFlowProperties>)
372
372
  )
@@ -79,7 +79,7 @@ export default async function getRelationship(
79
79
  secondObject,
80
80
  relType,
81
81
  relId,
82
- relationshipDirection
82
+ relationshipDirection,
83
83
  //(<requestParamGetRel>)
84
84
  //(</requestParamGetRel>)
85
85
  } = requestParams;
@@ -87,7 +87,7 @@ export default async function moveRelationship(
87
87
  relType,
88
88
  relationshipDirection,
89
89
  relationshipProperties,
90
- moveObject
90
+ moveObject,
91
91
  //(<requestParamMoveRel>)
92
92
  //(</requestParamMoveRel>)
93
93
  } = requestParams;
@@ -96,7 +96,7 @@ export default async function moveRelationship(
96
96
  let foundErrors = [];
97
97
 
98
98
  //(<beforeValidateMoveRel>)
99
- //(</beforeValidateMoveRel>).
99
+ //(</beforeValidateMoveRel>)
100
100
  // validate object and identifiers
101
101
  async function validateIdentifiersExists(
102
102
  _izContext,
@@ -428,7 +428,7 @@ export default async function moveRelationship(
428
428
  relationshipDirection,
429
429
  relationshipProperties,
430
430
  moveObject,
431
- parentFlowId: parentFlowId
431
+ parentFlowId: parentFlowId,
432
432
  //(<messageBodyMoveRel>)
433
433
  //(</messageBodyMoveRel>)
434
434
 
@@ -446,15 +446,15 @@ export default async function moveRelationship(
446
446
  callingFlowConfig, // receive parent callingFlowConfig.
447
447
  callingFlowSharedLib.createCallingFlowConfig(
448
448
  // calling flow own service
449
- //(<callingFlowProperties>)
450
449
  await lambdaSharedLib.lambdaFunctionName(
451
450
  _izContext,
452
451
  TOPIC_NAME_GENERATE_CODE.moveRelationshipComplete
453
452
  ),
454
- //(</callingFlowProperties>)
453
+ //(<callingFlowProperties>)
455
454
  {
456
455
  graphServiceTag: storageResource.graphServiceTag
457
456
  }
457
+ //(</callingFlowProperties>)
458
458
  )
459
459
  )
460
460
  );
@@ -83,7 +83,7 @@ export default async function updateRelationship(
83
83
  relType,
84
84
  relId,
85
85
  relationshipProperties,
86
- relationshipDirection
86
+ relationshipDirection,
87
87
  //(<requestParamUpdateRel>)
88
88
  //(</requestParamUpdateRel>)
89
89
  } = requestParams;
@@ -292,7 +292,7 @@ export default async function updateRelationship(
292
292
  relationshipDirection,
293
293
  status: 'error',
294
294
  foundErrors: foundErrors,
295
- parentFlowId: parentFlowId
295
+ parentFlowId: parentFlowId,
296
296
  //(<inUpdateCompleteMsgUpdateRel>)
297
297
  //(</inUpdateCompleteMsgUpdateRel>)
298
298
  };
@@ -422,7 +422,7 @@ export default async function updateRelationship(
422
422
  relType: relType,
423
423
  relationshipProperties,
424
424
  relationshipDirection,
425
- parentFlowId
425
+ parentFlowId,
426
426
  //(<inUpdateRelMessageBodyUpdateRel>)
427
427
  //(</inUpdateRelMessageBodyUpdateRel>)
428
428
  };
@@ -438,15 +438,15 @@ export default async function updateRelationship(
438
438
  callingFlowConfig, // receive parent callingFlowConfig.
439
439
  callingFlowSharedLib.createCallingFlowConfig(
440
440
  // callingFlow own service
441
- //(<callingFlowProperties>)
442
441
  await lambdaSharedLib.lambdaFunctionName(
443
442
  _izContext,
444
443
  TOPIC_NAME_GENERATE_CODE.updateRelComplete
445
444
  ),
446
- //(</callingFlowProperties>)
445
+ //(<callingFlowProperties>)
447
446
  {
448
447
  graphServiceTag: storageResource.graphServiceTag
449
448
  }
449
+ //(</callingFlowProperties>)
450
450
  )
451
451
  )
452
452
  );
@@ -3,8 +3,7 @@ import { CRUD_ACTIONS } from '../crud/crudActionPlan.js';
3
3
  import {
4
4
  customFlowRoleName,
5
5
  flowDsqSteps,
6
- flowExtTopicSteps,
7
- flowHasRbac
6
+ flowExtTopicSteps
8
7
  } from '../custom/customFlows.js';
9
8
  import {
10
9
  RELATIONSHIP_ACTIONS,
@@ -242,7 +241,11 @@ export function roleTableNames(state, roleName) {
242
241
  tables.push('UserUploadRecords', 'ReservedDataMain');
243
242
  }
244
243
  if (flow.statusType === 'storedCache') {
245
- const object = state.objectTablesByType.get(flow.objType?.objectType);
244
+ const targetObjectType =
245
+ typeof flow.objType === 'string'
246
+ ? flow.objType
247
+ : flow.objType?.objectType;
248
+ const object = state.objectTablesByType.get(targetObjectType);
246
249
  if (object) {
247
250
  tables.push(object);
248
251
  }
@@ -334,9 +337,6 @@ export function roleQueueNames(state, roleName) {
334
337
  if (includesEvent(flow, 'dsq')) {
335
338
  queueList.push(`${tag}HdrDsq`);
336
339
  }
337
- if (flowHasRbac(flow, state.objects)) {
338
- queueList.push(`${tag}RbacCallbackHdrSqs`);
339
- }
340
340
  queueList.push(
341
341
  ...flowExtTopicSteps([flow]).map(
342
342
  ({ flowTag, stepName }) => `${flowTag}${stepName}HdrSqs`
@@ -4,8 +4,7 @@ import {
4
4
  flowExtTopicSteps,
5
5
  generatedDsqFlows,
6
6
  generatedOwnTopicFlows,
7
- supportedCustomFlows,
8
- flowHasRbac
7
+ supportedCustomFlows
9
8
  } from '../custom/customFlows.js';
10
9
  import { hasSystemWebSocket } from '../system/emitSystemWebSocketArtifacts.js';
11
10
  import { rbacFlowTag } from '../rbac/rbacFlowTag.js';
@@ -146,7 +145,7 @@ export function createResourceState({ objects, relationships, flows }) {
146
145
  const customSqsQueues = [
147
146
  ...flows
148
147
  .filter((flow) => includesEvent(flow, 'extTopic'))
149
- .map((flow) => `Process${upperFirst(flow.flowTag)}HdrSqs`),
148
+ .map((flow) => `${upperFirst(flow.flowTag)}HdrSqs`),
150
149
  ...flows
151
150
  .filter(
152
151
  (flow) =>
@@ -159,12 +158,7 @@ export function createResourceState({ objects, relationships, flows }) {
159
158
  for (const { flowTag, stepName } of flowExtTopicSteps(flows)) {
160
159
  customSqsQueues.push(`${flowTag}${stepName}HdrSqs`);
161
160
  }
162
- for (const flow of flows) {
163
- if (flowHasRbac(flow, objects)) {
164
- const tag = upperFirst(flow.flowTag);
165
- customSqsQueues.push(`${tag}RbacCallbackHdrSqs`);
166
- }
167
- }
161
+
168
162
  for (const flow of flows.filter((flow) => includesEvent(flow, 's3'))) {
169
163
  const tag = upperFirst(flow.flowTag);
170
164
  customSqsQueues.push(`${tag}CreatePreSignUrlHdrSqs`);
@@ -43,13 +43,14 @@ async function _emitSystemArtifacts(objects) {
43
43
  return { artifacts: [], functions: [] };
44
44
  }
45
45
 
46
- const hasFindDataEntries = buildFindDataEntries(objects).length > 0;
46
+ const findDataEntries = buildFindDataEntries(objects);
47
+ const hasFindDataEntries = findDataEntries.length > 0;
47
48
 
48
49
  const artifacts = [];
49
50
 
50
51
  if (hasFindDataEntries) {
51
52
  const findDataMain = await render('FindData_Main.ejs', {
52
- datas: buildFindDataEntries(objects)
53
+ datas: findDataEntries
53
54
  });
54
55
  artifacts.push(
55
56
  { path: `${FIND_DATA_SOURCE}/FindData_Main.js`, content: findDataMain },
@@ -85,21 +86,21 @@ async function _emitSystemArtifacts(objects) {
85
86
 
86
87
  return {
87
88
  artifacts,
88
- functions: renderSystemYamlFunctions()
89
+ functions: renderSystemYamlFunctions(hasFindDataEntries)
89
90
  };
90
91
  }
91
92
 
92
- function renderSystemYamlFunctions() {
93
- const findDataYaml = renderFindDataYaml();
94
- const processLogicalYaml = renderProcessLogicalYaml();
95
- const processLogicalPaginateDsqYaml = renderProcessLogicalPaginateDsqYaml();
96
- const processLogicalPaginateSqsYaml = renderProcessLogicalPaginateSqsYaml();
97
- return [
98
- findDataYaml,
99
- processLogicalYaml,
100
- processLogicalPaginateDsqYaml,
101
- processLogicalPaginateSqsYaml
102
- ];
93
+ function renderSystemYamlFunctions(hasFindDataEntries = true) {
94
+ const functions = [];
95
+ if (hasFindDataEntries) {
96
+ functions.push(renderFindDataYaml());
97
+ }
98
+ functions.push(
99
+ renderProcessLogicalYaml(),
100
+ renderProcessLogicalPaginateDsqYaml(),
101
+ renderProcessLogicalPaginateSqsYaml()
102
+ );
103
+ return functions;
103
104
  }
104
105
 
105
106
  function renderFindDataYaml() {