@izara_project/izara-core-generate-service-code 1.0.53 → 1.0.54

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 (141) hide show
  1. package/package.json +1 -2
  2. package/src/codeGenerators/app/initial_setup/InitialSetupGenerator.js +1 -1
  3. package/src/codeGenerators/app/sls_yaml/FindDataYamlGenerator.js +23 -0
  4. package/src/codeGenerators/app/sls_yaml/FunctionYamlGenerator.js +1 -1
  5. package/src/codeGenerators/app/sls_yaml/ProcessLogicalYamlGenerator.js +11 -25
  6. package/src/codeGenerators/app/sls_yaml/RoleNameConfigGenerator.js +1 -1
  7. package/src/codeGenerators/app/sls_yaml/SharedResourceYamlGenerator.js +3 -3
  8. package/src/codeGenerators/app/sls_yaml/renderYamlTemplate.js +13 -0
  9. package/src/codeGenerators/app/sls_yaml/templates/SharedResource_Yaml.ejs +6 -2
  10. package/src/codeGenerators/app/src/generatedCode/FindData/FindDataGenerator.js +10 -44
  11. package/src/codeGenerators/app/src/generatedCode/Flow/FlowEndpoints/EndpointsGenerator.js +119 -0
  12. package/src/codeGenerators/app/src/generatedCode/Flow/FlowRbac/RbacFlowGenerator.js +91 -52
  13. package/src/codeGenerators/app/src/generatedCode/Flow/FlowRelationshipEndpoints/RelationshipFlowGenerator.js +20 -16
  14. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/StatusFieldGenerator.js +1 -1
  15. package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/s3Components/ConfirmAfterUploadS3Generator.js +2 -4
  16. package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/s3Components/CreateObjectGenerator.js +2 -4
  17. package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/s3Components/CreatePreSignUrlGenerator.js +2 -4
  18. package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/s3Components/ProcessAfterUploadS3Generator.js +5 -5
  19. package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/s3Components/ReservedLimitGenerator.js +2 -4
  20. package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowEntryPointBase.js +6 -6
  21. package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowMainFunctionBase.js +3 -3
  22. package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowStepBase.js +11 -11
  23. package/src/codeGenerators/app/src/generatedCode/ProcessLogical/ProcessLogicalGenerator.js +18 -15
  24. package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/{PaginateProcessLogical_HdrDsq.js → PaginateProcessLogical_HdrDsq.ejs} +1 -1
  25. package/src/codeGenerators/app/src/generatedCode/SystemFlowSchemas/RegisterGenerator.js +133 -149
  26. package/src/codeGenerators/app/src/generatedCode/libs/ConstsGenerator.js +16 -8
  27. package/src/codeGenerators/app/src/generatedCode/libs/GenerateCodeLibsGenerator.js +17 -9
  28. package/src/codeGenerators/resource/sls_yaml/FlowOutGenerator.js +11 -2
  29. package/src/codeGenerators/resource/sls_yaml/FlowResourceYamlGenerator.js +31 -4
  30. package/src/core/renderTemplateFile.js +22 -0
  31. package/src/generateCode.js +143 -110
  32. package/src/generateIntTest.js +45 -69
  33. package/src/generateResourceIntTest.js +22 -47
  34. package/src/intTestGeneratorShared.js +36 -0
  35. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/flowSchemaMainFunction/data.js +0 -119
  36. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/flowSchemaMainFunction/template.ejs +0 -89
  37. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/flowSchemaMainFunction/templateByStatusType/statusFieldTemplate.ejs +0 -30
  38. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/flowSchemaMainFunction/templateByStatusType/storedCacheTemplate.ejs +0 -26
  39. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/flowSchemaMainFunction/templateByStatusType/triggerCacheTemplate.ejs +0 -44
  40. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/index.js +0 -80
  41. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/functionYaml/data.js +0 -129
  42. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/functionYaml/template.ejs +0 -17
  43. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/handler/data.js +0 -63
  44. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/mainFunction/data.js +0 -54
  45. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/mainFunction/template.ejs +0 -129
  46. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/queue/data.js +0 -63
  47. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/queue/template.ejs +0 -45
  48. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObject/functionYaml/data.js +0 -117
  49. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObject/functionYaml/template.ejs +0 -20
  50. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObject/handler/data.js +0 -64
  51. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObject/mainFunction/data.js +0 -64
  52. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObject/mainFunction/template.ejs +0 -131
  53. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/functionYaml/data.js +0 -122
  54. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/functionYaml/template.ejs +0 -17
  55. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/handler/data.js +0 -66
  56. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/handler/template.ejs +0 -99
  57. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/mainFunction/data.js +0 -64
  58. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/mainFunction/template.ejs +0 -82
  59. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/sns-sqs/data.js +0 -70
  60. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/sns-sqs/template.ejs +0 -49
  61. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/functionYaml/data.js +0 -139
  62. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/functionYaml/template.ejs +0 -18
  63. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/handler/data.js +0 -63
  64. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/mainFunction/data.js +0 -63
  65. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/mainFunction/template.ejs +0 -262
  66. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/queue/data.js +0 -63
  67. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/queue/template.ejs +0 -45
  68. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/functionYaml/data.js +0 -146
  69. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/functionYaml/template.ejs +0 -14
  70. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/handler/data.js +0 -64
  71. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/mainFunction/data.js +0 -59
  72. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/mainFunction/template.ejs +0 -173
  73. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/sqs/data.js +0 -67
  74. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/sqs/template.ejs +0 -53
  75. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/functionYml/HdrS3/data.js +0 -140
  76. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/functionYml/HdrS3/template.ejs +0 -25
  77. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/handler/handlerS3/data.js +0 -49
  78. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/handler/handlerS3/template.ejs +0 -50
  79. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/mainFunction/ProcessCsvtemplate.ejs +0 -182
  80. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/mainFunction/data.js +0 -49
  81. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/mainFunction/template.ejs +0 -66
  82. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/queue/data.js +0 -77
  83. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/queue/dsqTemplatePath.ejs +0 -32
  84. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/queue/s3Template.ejs +0 -59
  85. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/relate/S3/data.js +0 -61
  86. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/relate/S3/template.ejs +0 -13
  87. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/relate/sns-out/data.js +0 -70
  88. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/websocket/dynamoDb/ReservedTableData.js +0 -69
  89. package/src/codeGenerators/app/src/generatedCode/Flow/SystemFlowDescriptorBuilder.js +0 -151
  90. /package/src/codeGenerators/app/{src/generatedCode/FindData → sls_yaml}/templates/FindData_Yaml.ejs +0 -0
  91. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared/endpoint → FlowEndpoints/templates}/FlowEndpointBeforeLogical_Main.ejs +0 -0
  92. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/endpoint/FlowEndpoint_HdrWbs.ejs +0 -0
  93. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/endpoint/FlowEndpoint_Main.ejs +0 -0
  94. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/endpoint/FlowEntryPoint_Main.ejs +0 -0
  95. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/endpoint/FlowMain_Wbs.ejs +0 -0
  96. /package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/{s3Legacy/upload/confirmReserved/handler/template.ejs → s3/ConfirmReserved_HdrSqs.ejs} +0 -0
  97. /package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/{s3Legacy/upload/createObject/handler/template.ejs → s3/CreateObject_HdrWbs.ejs} +0 -0
  98. /package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/{s3Legacy/upload/preSignUrl/createPreSignUrl/handler/template.ejs → s3/CreatePreSignUrl_HdrSqs.ejs} +0 -0
  99. /package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/{s3Legacy/upload/preSignUrl/reservedLimit/handler/template.ejs → s3/ReservedLimit_HdrSqs.ejs} +0 -0
  100. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/FlowEndpointComplete_Main.ejs +0 -0
  101. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/FlowStep_Main.ejs +0 -0
  102. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/plugIns/FlowStep_ByConfig_Awaiting_Main.ejs +0 -0
  103. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/plugIns/FlowStep_ByConfig_Paginated_Main.ejs +0 -0
  104. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/plugIns/FlowStep_PlugIn_Main.ejs +0 -0
  105. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/plugIns/FlowStep_RecievePlugIn_Main.ejs +0 -0
  106. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/plugIns/templateAwaitingStep.ejs +0 -0
  107. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/plugIns/templateSendPlugin.ejs +0 -0
  108. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/BaseSqsHandler.js +0 -0
  109. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/eventBridge.js +0 -0
  110. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/extTopic.js +0 -0
  111. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/lambdaSyncApi.js +0 -0
  112. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/lambdaSyncInv.js +0 -0
  113. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/ownTopic.js +0 -0
  114. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/registry.js +0 -0
  115. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/s3.js +0 -0
  116. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/handlers/FlowHandler_HdrApi.ejs +0 -0
  117. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/handlers/FlowHandler_HdrInv.ejs +0 -0
  118. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/handlers/FlowHandler_HdrSqs.ejs +0 -0
  119. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/eventTypes.js +0 -0
  120. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowClassifier.js +0 -0
  121. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowNaming.js +0 -0
  122. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowSelection.js +0 -0
  123. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowStepNormalizer.js +0 -0
  124. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowValidator.js +0 -0
  125. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/registry.js +0 -0
  126. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/triggerCacheBase.js +0 -0
  127. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/CheckTriggerCache_HdrSqs.ejs +0 -0
  128. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/CheckTriggerCache_Main.ejs +0 -0
  129. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/ProcessTriggerCache_HdrSqs.ejs +0 -0
  130. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/ProcessTriggerCache_Main.ejs +0 -0
  131. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/TriggerCacheComplete_HdrDsq.ejs +0 -0
  132. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/TriggerCacheComplete_HdrSqs.ejs +0 -0
  133. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/TriggerCacheComplete_Main.ejs +0 -0
  134. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/TriggerCacheQueue_Yaml.ejs +0 -0
  135. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/yaml/SharedFunctionSqs_Yaml.ejs +0 -0
  136. /package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/{PaginateProcessLogical_HdrSqs.js → PaginateProcessLogical_HdrSqs.ejs} +0 -0
  137. /package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/{PaginateProcessLogical_Main.js → PaginateProcessLogical_Main.ejs} +0 -0
  138. /package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/{ProcessLogical_HdrSqs.js → ProcessLogical_HdrSqs.ejs} +0 -0
  139. /package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/{ProcessLogical_Main.js → ProcessLogical_Main.ejs} +0 -0
  140. /package/src/codeGenerators/app/src/generatedCode/libs/templates/{Consts.js → Consts.ejs} +0 -0
  141. /package/src/codeGenerators/app/src/generatedCode/libs/templates/{GenerateCodeLibs.js → GenerateCodeLibs.ejs} +0 -0
@@ -16,12 +16,10 @@ export default async function generateCreateObject(flow, flowOutputDir) {
16
16
  const handlerFileName = `${functionName}_${handlerType}`;
17
17
 
18
18
  const mainTemplatePath = path.join(
19
- __dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3Legacy',
20
- 'upload', 'createObject', 'mainFunction', 'template.ejs'
19
+ __dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3', 'CreateObject_Main.ejs'
21
20
  );
22
21
  const handlerTemplatePath = path.join(
23
- __dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3Legacy',
24
- 'upload', 'createObject', 'handler', 'template.ejs'
22
+ __dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3', 'CreateObject_HdrWbs.ejs'
25
23
  );
26
24
 
27
25
  let mainTemplateStr, handlerTemplateStr;
@@ -15,12 +15,10 @@ export default async function generateCreatePreSignUrl(flow, flowOutputDir) {
15
15
  const handlerFileName = `${functionName}_${handlerType}`;
16
16
 
17
17
  const mainTemplatePath = path.join(
18
- __dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3Legacy',
19
- 'upload', 'preSignUrl', 'createPreSignUrl', 'mainFunction', 'template.ejs'
18
+ __dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3', 'CreatePreSignUrl_Main.ejs'
20
19
  );
21
20
  const handlerTemplatePath = path.join(
22
- __dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3Legacy',
23
- 'upload', 'preSignUrl', 'createPreSignUrl', 'handler', 'template.ejs'
21
+ __dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3', 'CreatePreSignUrl_HdrSqs.ejs'
24
22
  );
25
23
 
26
24
  let mainTemplateStr, handlerTemplateStr;
@@ -15,12 +15,10 @@ export default async function generateProcessAfterUploadS3(flow, flowOutputDir)
15
15
  const handlerFileName = `${functionName}_${handlerType}`;
16
16
 
17
17
  const mainTemplatePath = path.join(
18
- __dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3Legacy',
19
- 'upload', 'processFile', 'mainFunction', 'template.ejs'
18
+ __dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3', 'ProcessS3File_Main.ejs'
20
19
  );
21
20
  const handlerTemplatePath = path.join(
22
- __dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3Legacy',
23
- 'upload', 'processFile', 'handler', 'handlerS3', 'template.ejs'
21
+ __dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3', 'FlowHandler_HdrS3.ejs'
24
22
  );
25
23
 
26
24
  let mainTemplateStr, handlerTemplateStr;
@@ -37,8 +35,10 @@ export default async function generateProcessAfterUploadS3(flow, flowOutputDir)
37
35
  });
38
36
 
39
37
  const handlerContent = ejs.render(handlerTemplateStr, {
38
+ flowTag: flow.flowTag,
40
39
  functionName: functionName,
41
- handlerType: handlerType
40
+ mainFileName,
41
+ s3Bucket: flow.bucketName || ''
42
42
  });
43
43
 
44
44
  const targetMainPath = path.join(flowOutputDir, `${mainFileName}.js`);
@@ -15,12 +15,10 @@ export default async function generateReservedLimit(flow, flowOutputDir) {
15
15
  const handlerFileName = `${functionName}_${handlerType}`;
16
16
 
17
17
  const mainTemplatePath = path.join(
18
- __dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3Legacy',
19
- 'upload', 'preSignUrl', 'reservedLimit', 'mainFunction', 'template.ejs'
18
+ __dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3', 'ReservedLimit_Main.ejs'
20
19
  );
21
20
  const handlerTemplatePath = path.join(
22
- __dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3Legacy',
23
- 'upload', 'preSignUrl', 'reservedLimit', 'handler', 'template.ejs'
21
+ __dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3', 'ReservedLimit_HdrSqs.ejs'
24
22
  );
25
23
 
26
24
  let mainTemplateStr, handlerTemplateStr;
@@ -17,12 +17,12 @@ export async function generateFlowEntryPoint(allSchemas, options) {
17
17
  const baseOutputDir = path.join(options.outputPath, 'app', 'src', 'generatedCode');
18
18
 
19
19
  const templates = {
20
- sqs: await fs.readFile(path.join(__dirname, '..', '_shared', 'handlers', 'FlowHandler_HdrSqs.ejs'), 'utf-8'),
21
- api: await fs.readFile(path.join(__dirname, '..', '_shared', 'handlers', 'FlowHandler_HdrApi.ejs'), 'utf-8'),
22
- inv: await fs.readFile(path.join(__dirname, '..', '_shared', 'handlers', 'FlowHandler_HdrInv.ejs'), 'utf-8'),
23
- endpointMain: await fs.readFile(path.join(__dirname, '..', '_shared', 'endpoint', 'FlowEndpoint_Main.ejs'), 'utf-8'),
24
- wbsMain: await fs.readFile(path.join(__dirname, '..', '_shared', 'endpoint', 'FlowMain_Wbs.ejs'), 'utf-8'),
25
- endpointHdrWbs: await fs.readFile(path.join(__dirname, '..', '_shared', 'endpoint', 'FlowEndpoint_HdrWbs.ejs'), 'utf-8')
20
+ sqs: await fs.readFile(path.join(__dirname, '..', 'handlers', 'FlowHandler_HdrSqs.ejs'), 'utf-8'),
21
+ api: await fs.readFile(path.join(__dirname, '..', 'handlers', 'FlowHandler_HdrApi.ejs'), 'utf-8'),
22
+ inv: await fs.readFile(path.join(__dirname, '..', 'handlers', 'FlowHandler_HdrInv.ejs'), 'utf-8'),
23
+ endpointMain: await fs.readFile(path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'endpoint', 'FlowEndpoint_Main.ejs'), 'utf-8'),
24
+ wbsMain: await fs.readFile(path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'endpoint', 'FlowMain_Wbs.ejs'), 'utf-8'),
25
+ endpointHdrWbs: await fs.readFile(path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'endpoint', 'FlowEndpoint_HdrWbs.ejs'), 'utf-8')
26
26
  };
27
27
 
28
28
  let generatedCount = 0;
@@ -62,7 +62,7 @@ export async function generateFlowMainFunction(allSchemas, options) {
62
62
  // shared endpoint templates (FlowEndpoint_Main, FlowMain_Wbs) live under _internal/_shared/endpoint
63
63
  const templateBaseDir = templateName.startsWith('crud/') || ['CreateEndpoint_Main.ejs', 'UpdateEndpoint_Main.ejs', 'DeleteEndpoint_Main.ejs', 'GetEndpoint_Main.ejs'].includes(templateName)
64
64
  ? path.join(__dirname, '..', '..', 'FlowEndpoints', 'templates', 'crud')
65
- : path.join(__dirname, '..', '_shared', 'endpoint');
65
+ : path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'endpoint');
66
66
  const mainTemplateStr = await fs.readFile(
67
67
  path.join(templateBaseDir, templateName),
68
68
  'utf-8'
@@ -109,7 +109,7 @@ export async function generateFlowMainFunction(allSchemas, options) {
109
109
  // For ownTopic flows: also generate Process${FlowTag}_Main.js (simple endpoint, triggered from SQS)
110
110
  if (isOwnTopic) {
111
111
  const processMainTemplateStr = await fs.readFile(
112
- path.join(__dirname, '..', '_shared', 'endpoint', 'FlowEndpoint_Main.ejs'),
112
+ path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'endpoint', 'FlowEndpoint_Main.ejs'),
113
113
  'utf-8'
114
114
  );
115
115
  const processMainContent = ejs.render(processMainTemplateStr, {
@@ -130,7 +130,7 @@ export async function generateFlowMainFunction(allSchemas, options) {
130
130
  const beforeLogicalConfigs = generateCode.filter(c => c.codeHookTag === 'beforeLogical');
131
131
  if (isCrud && beforeLogicalConfigs.length > 0) {
132
132
  const beforeLogicalTemplateStr = await fs.readFile(
133
- path.join(__dirname, '..', '_shared', 'endpoint', 'FlowEndpointBeforeLogical_Main.ejs'),
133
+ path.join(__dirname, '..', '..', 'FlowEndpoints', 'templates', 'FlowEndpointBeforeLogical_Main.ejs'),
134
134
  'utf-8'
135
135
  );
136
136
 
@@ -17,19 +17,19 @@ export async function generateFlowSteps(allSchemas, options) {
17
17
 
18
18
  // Read templates
19
19
  const templates = {
20
- main: await fs.readFile(path.join(__dirname, '..', '_shared', 'step', 'FlowStep_Main.ejs'), 'utf-8'),
21
- complete: await fs.readFile(path.join(__dirname, '..', '_shared', 'step', 'FlowEndpointComplete_Main.ejs'), 'utf-8'),
22
- sqs: await fs.readFile(path.join(__dirname, '..', '_shared', 'handlers', 'FlowHandler_HdrSqs.ejs'), 'utf-8'),
23
- api: await fs.readFile(path.join(__dirname, '..', '_shared', 'handlers', 'FlowHandler_HdrApi.ejs'), 'utf-8'),
24
- inv: await fs.readFile(path.join(__dirname, '..', '_shared', 'handlers', 'FlowHandler_HdrInv.ejs'), 'utf-8'),
20
+ main: await fs.readFile(path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'step', 'FlowStep_Main.ejs'), 'utf-8'),
21
+ complete: await fs.readFile(path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'step', 'FlowEndpointComplete_Main.ejs'), 'utf-8'),
22
+ sqs: await fs.readFile(path.join(__dirname, '..', 'handlers', 'FlowHandler_HdrSqs.ejs'), 'utf-8'),
23
+ api: await fs.readFile(path.join(__dirname, '..', 'handlers', 'FlowHandler_HdrApi.ejs'), 'utf-8'),
24
+ inv: await fs.readFile(path.join(__dirname, '..', 'handlers', 'FlowHandler_HdrInv.ejs'), 'utf-8'),
25
25
 
26
26
  // Advanced Custom Flow Logic Templates
27
- pluginMain: await fs.readFile(path.join(__dirname, '..', '_shared', 'step', 'plugIns', 'FlowStep_PlugIn_Main.ejs'), 'utf-8').catch(() => ''),
28
- recievePluginMain: await fs.readFile(path.join(__dirname, '..', '_shared', 'step', 'plugIns', 'FlowStep_RecievePlugIn_Main.ejs'), 'utf-8').catch(() => ''),
29
- byConfigAwaitingMain: await fs.readFile(path.join(__dirname, '..', '_shared', 'step', 'plugIns', 'FlowStep_ByConfig_Awaiting_Main.ejs'), 'utf-8').catch(() => ''),
30
- byConfigPaginatedMain: await fs.readFile(path.join(__dirname, '..', '_shared', 'step', 'plugIns', 'FlowStep_ByConfig_Paginated_Main.ejs'), 'utf-8').catch(() => ''),
31
- templateAwaitingStep: path.join(__dirname, '..', '_shared', 'step', 'plugIns', 'templateAwaitingStep.ejs'),
32
- templateSendPlugin: path.join(__dirname, '..', '_shared', 'step', 'plugIns', 'templateSendPlugin.ejs')
27
+ pluginMain: await fs.readFile(path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'step', 'plugIns', 'FlowStep_PlugIn_Main.ejs'), 'utf-8').catch(() => ''),
28
+ recievePluginMain: await fs.readFile(path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'step', 'plugIns', 'FlowStep_RecievePlugIn_Main.ejs'), 'utf-8').catch(() => ''),
29
+ byConfigAwaitingMain: await fs.readFile(path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'step', 'plugIns', 'FlowStep_ByConfig_Awaiting_Main.ejs'), 'utf-8').catch(() => ''),
30
+ byConfigPaginatedMain: await fs.readFile(path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'step', 'plugIns', 'FlowStep_ByConfig_Paginated_Main.ejs'), 'utf-8').catch(() => ''),
31
+ templateAwaitingStep: path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'step', 'plugIns', 'templateAwaitingStep.ejs'),
32
+ templateSendPlugin: path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'step', 'plugIns', 'templateSendPlugin.ejs')
33
33
  };
34
34
 
35
35
  let generatedCount = 0;
@@ -1,26 +1,29 @@
1
1
  import fs from 'fs/promises';
2
2
  import path from 'path';
3
3
  import { fileURLToPath } from 'url';
4
+ import { writeRenderedTemplate } from '../../../../../core/renderTemplateFile.js';
4
5
 
5
6
  const __filename = fileURLToPath(import.meta.url);
6
7
  const __dirname = path.dirname(__filename);
7
8
 
8
9
  export async function generateProcessLogical(options) {
9
- console.log(' [ProcessLogicalGenerator] Generating ProcessLogical flows...');
10
-
11
- const outputDir = path.join(options.outputPath, 'app', 'src', 'generatedCode', 'ProcessLogical', 'source');
12
- await fs.mkdir(outputDir, { recursive: true });
10
+ console.log(' [ProcessLogicalGenerator] Generating ProcessLogical flows...');
13
11
 
14
- const templatesDir = path.join(__dirname, 'templates');
15
- const files = await fs.readdir(templatesDir);
12
+ const outputDir = path.join(options.outputPath, 'app', 'src', 'generatedCode', 'ProcessLogical', 'source');
13
+ const templatesDir = path.join(__dirname, 'templates');
14
+ const files = await fs.readdir(templatesDir);
16
15
 
17
- for (const file of files) {
18
- if (file.endsWith('.js')) {
19
- const sourceFile = path.join(templatesDir, file);
20
- const destFile = path.join(outputDir, file);
21
- await fs.copyFile(sourceFile, destFile);
22
- }
23
- }
24
-
25
- console.log(` [ProcessLogicalGenerator] Wrote ${files.length} ProcessLogical files.`);
16
+ let count = 0;
17
+ for (const file of files) {
18
+ if (!file.endsWith('.ejs')) continue;
19
+
20
+ await writeRenderedTemplate(
21
+ path.join(templatesDir, file),
22
+ path.join(outputDir, file.replace(/\.ejs$/, '.js')),
23
+ {}
24
+ );
25
+ count++;
26
+ }
27
+
28
+ console.log(` [ProcessLogicalGenerator] Wrote ${count} ProcessLogical files.`);
26
29
  }
@@ -174,4 +174,4 @@ export const main = middleware.wrap(async (event, context, callback) => {
174
174
  Logger.error('Unhandled Error, PaginateProcessLogicalHdrDsq: ', err);
175
175
  throw err;
176
176
  }
177
- });
177
+ });
@@ -1,166 +1,150 @@
1
1
  import path from 'path';
2
- import fs from 'fs/promises';
3
2
  import { fileURLToPath } from 'url';
4
- import ejs from 'ejs';
3
+ import {
4
+ appendRenderedTemplate,
5
+ writeRenderedTemplate
6
+ } from '../../../../../core/renderTemplateFile.js';
5
7
 
6
8
  const __filename = fileURLToPath(import.meta.url);
7
9
  const __dirname = path.dirname(__filename);
8
10
 
9
11
  function upperCase(str) {
10
- if (!str) return str;
11
- return str.charAt(0).toUpperCase() + str.slice(1);
12
+ if (!str) return str;
13
+ return str.charAt(0).toUpperCase() + str.slice(1);
12
14
  }
13
15
 
14
16
  function shortNameHandler(handlerType) {
15
- const map = {
16
- 'HdrSqs': 'Sqs',
17
- 'HdrApi': 'Api',
18
- 'HdrWbs': 'Wbs',
19
- 'HdrDsq': 'Dsq'
20
- };
21
- return map[handlerType] || handlerType;
17
+ const map = {
18
+ HdrSqs: 'Sqs',
19
+ HdrApi: 'Api',
20
+ HdrWbs: 'Wbs',
21
+ HdrDsq: 'Dsq'
22
+ };
23
+ return map[handlerType] || handlerType;
22
24
  }
23
25
 
24
- export async function generateRegisterFlow(allLocalFlowSchemas, appPath, outputBaseDir) {
25
- const hasRegisterFlow = allLocalFlowSchemas.some(flow => flow.flowTag === 'Register');
26
- if (!hasRegisterFlow) {
27
- console.log(' [RegisterGenerator] No Register flow descriptor found. Skipping.');
28
- return;
26
+ export async function generateRegisterFlow(allLocalFlowSchemas, _appPath, outputBaseDir) {
27
+ if (!allLocalFlowSchemas.some((flow) => flow.flowTag === 'Register')) {
28
+ console.log(' [RegisterGenerator] No Register flow descriptor found. Skipping.');
29
+ return;
30
+ }
31
+
32
+ console.log(' [RegisterGenerator] Generating Register flow files...');
33
+
34
+ const templatesDir = path.join(__dirname, 'templates', 'register');
35
+ const wsTemplatesDir = path.join(__dirname, '..', 'Flow', 'FlowSchemas', 'templates', 'webSocket');
36
+ const registerDir = path.join(
37
+ outputBaseDir,
38
+ 'app',
39
+ 'src',
40
+ 'generatedCode',
41
+ 'SystemFlowSchemas',
42
+ 'Register',
43
+ 'source'
44
+ );
45
+ const flowSchemaPath = path.join(
46
+ outputBaseDir,
47
+ 'app',
48
+ 'sls_yaml',
49
+ 'generatedCode',
50
+ 'source',
51
+ 'flow-schema.yml'
52
+ );
53
+ const resourceYamlPath = path.join(
54
+ outputBaseDir,
55
+ 'resource',
56
+ 'sls_yaml',
57
+ 'generatedCode',
58
+ 'source',
59
+ 'generated-sns-in-sqs.yml'
60
+ );
61
+
62
+ const wbsFunctionName = 'Register';
63
+ await writeRenderedTemplate(
64
+ path.join(templatesDir, 'Register_Main.ejs'),
65
+ path.join(registerDir, `${wbsFunctionName}_Main.js`),
66
+ { functionMain: `${wbsFunctionName}_Main` }
67
+ );
68
+ await writeRenderedTemplate(
69
+ path.join(templatesDir, 'Register_HdrWbs.ejs'),
70
+ path.join(registerDir, `${wbsFunctionName}_HdrWbs.js`),
71
+ { routeName: 'register' }
72
+ );
73
+ await appendRenderedTemplate(
74
+ path.join(__dirname, '..', '..', '..', 'sls_yaml', 'templates', 'FunctionYaml_Wbs.ejs'),
75
+ flowSchemaPath,
76
+ {
77
+ functionNameConfig: `${wbsFunctionName}Wbs`,
78
+ handlerPath: `src/generatedCode/SystemFlowSchemas/Register/source/${wbsFunctionName}_HdrWbs.main`,
79
+ roleName: 'RegisterRole',
80
+ routeName: 'register'
29
81
  }
30
-
31
- console.log(' [RegisterGenerator] Generating Register flow files...');
32
- const templatesDir = path.join(__dirname, 'templates', 'register');
33
- const wsTemplatesDir = path.join(__dirname, '..', 'Flow', 'FlowSchemas', 'templates', 'webSocket');
34
-
35
- // Output paths
36
- const registerDir = path.join(outputBaseDir, 'app', 'src', 'generatedCode', 'SystemFlowSchemas', 'Register', 'source');
37
- await fs.mkdir(registerDir, { recursive: true });
38
-
39
- const slsYamlDir = path.join(outputBaseDir, 'app', 'sls_yaml', 'generatedCode', 'source');
40
- await fs.mkdir(slsYamlDir, { recursive: true });
41
-
42
- const resourceYamlDir = path.join(outputBaseDir, 'resource', 'sls_yaml', 'generatedCode', 'source');
43
- await fs.mkdir(resourceYamlDir, { recursive: true });
44
-
45
- // Helper to render and write
46
- async function renderAndWrite(tplPath, outPath, data) {
47
- const tpl = await fs.readFile(tplPath, 'utf-8');
48
- const content = ejs.render(tpl, data);
49
- await fs.writeFile(outPath, content, 'utf-8');
82
+ );
83
+
84
+ const completeFunctionName = 'RegisterComplete';
85
+ const completeData = {
86
+ functionName: completeFunctionName,
87
+ handlerType: 'HdrSqs',
88
+ queueName: completeFunctionName,
89
+ handlerFilePath: `src/generatedCode/SystemFlowSchemas/Register/source/${completeFunctionName}_HdrSqs`,
90
+ roleName: 'RegisterComplete',
91
+ upperFunctionName: upperCase(completeFunctionName),
92
+ upperHandlerType: 'HDRSQS',
93
+ upperQueueName: upperCase(completeFunctionName),
94
+ functionNameConfig: `${upperCase(completeFunctionName)}${upperCase(shortNameHandler('HdrSqs'))}`
95
+ };
96
+
97
+ await writeRenderedTemplate(
98
+ path.join(templatesDir, 'RegisterComplete_Main.ejs'),
99
+ path.join(registerDir, `${completeFunctionName}_Main.js`),
100
+ completeData
101
+ );
102
+ await writeRenderedTemplate(
103
+ path.join(templatesDir, 'RegisterComplete_HdrSqs.ejs'),
104
+ path.join(registerDir, `${completeFunctionName}_HdrSqs.js`),
105
+ completeData
106
+ );
107
+ await writeRenderedTemplate(
108
+ path.join(templatesDir, 'RegisterComplete_HdrSqs.ejs'),
109
+ path.join(registerDir, `${completeFunctionName}_HdrDsq.js`),
110
+ { ...completeData, handlerType: 'HdrDsq' }
111
+ );
112
+ await appendRenderedTemplate(
113
+ path.join(wsTemplatesDir, 'ProcessWebSocketFlow_Yaml.ejs'),
114
+ flowSchemaPath,
115
+ completeData
116
+ );
117
+ await appendRenderedTemplate(
118
+ path.join(wsTemplatesDir, 'ProcessWebSocketFlow_Yaml.ejs'),
119
+ flowSchemaPath,
120
+ {
121
+ ...completeData,
122
+ handlerType: 'HdrDsq',
123
+ upperHandlerType: 'HDRDSQ',
124
+ functionNameConfig: `${upperCase(completeFunctionName)}Dsq`,
125
+ handlerFilePath: `src/generatedCode/SystemFlowSchemas/Register/source/${completeFunctionName}_HdrDsq`
50
126
  }
51
-
52
- async function renderAndAppend(tplPath, outPath, data) {
53
- const tpl = await fs.readFile(tplPath, 'utf-8');
54
- const content = ejs.render(tpl, data);
55
- await fs.appendFile(outPath, '\n' + content, 'utf-8');
56
- }
57
-
58
- // 1. WBS Handler and Main
59
- const wbsFunctionName = 'Register';
60
- await renderAndWrite(
61
- path.join(templatesDir, 'Register_Main.ejs'),
62
- path.join(registerDir, `${wbsFunctionName}_Main.js`),
63
- { functionMain: `${wbsFunctionName}_Main` }
127
+ );
128
+
129
+ await appendRenderedTemplate(
130
+ path.join(wsTemplatesDir, 'ProcessWebSocket_Yaml.ejs'),
131
+ resourceYamlPath,
132
+ completeData
133
+ );
134
+
135
+ for (const flowSchema of allLocalFlowSchemas) {
136
+ if (!flowSchema.outputTopic) continue;
137
+
138
+ await appendRenderedTemplate(
139
+ path.join(wsTemplatesDir, 'ProcessWebSocketSub_Yaml.ejs'),
140
+ resourceYamlPath,
141
+ {
142
+ subscribeTo: upperCase(flowSchema.flowTag),
143
+ queueName: completeFunctionName,
144
+ upperQueueName: upperCase(completeFunctionName)
145
+ }
64
146
  );
65
-
66
- await renderAndWrite(
67
- path.join(templatesDir, 'Register_HdrWbs.ejs'),
68
- path.join(registerDir, `${wbsFunctionName}_HdrWbs.js`),
69
- { routeName: 'register' }
70
- );
71
-
72
- const wbsYamlTemplatePath = path.join(__dirname, '..', '..', '..', 'sls_yaml', 'templates', 'FunctionYaml_Wbs.ejs');
73
- await renderAndAppend(
74
- wbsYamlTemplatePath,
75
- path.join(slsYamlDir, 'flow-schema.yml'),
76
- {
77
- functionNameConfig: wbsFunctionName + 'Wbs',
78
- handlerPath: `src/generatedCode/SystemFlowSchemas/Register/source/${wbsFunctionName}_HdrWbs.main`,
79
- roleName: 'RegisterRole',
80
- routeName: 'register'
81
- }
82
- );
83
-
84
- // 2. Complete Handler and Main
85
- const completeFunctionName = 'RegisterComplete';
86
- const processHandlerType = 'HdrSqs';
87
- const queueName = completeFunctionName;
88
-
89
- const completeData = {
90
- functionName: completeFunctionName,
91
- handlerType: processHandlerType,
92
- queueName: queueName,
93
- handlerFilePath: `src/generatedCode/SystemFlowSchemas/Register/source/${completeFunctionName}_${processHandlerType}`,
94
- roleName: 'RegisterComplete',
95
- upperFunctionName: upperCase(completeFunctionName),
96
- upperHandlerType: upperCase(processHandlerType),
97
- upperQueueName: upperCase(queueName),
98
- functionNameConfig: upperCase(completeFunctionName) + upperCase(shortNameHandler(processHandlerType))
99
- };
100
-
101
- await renderAndWrite(
102
- path.join(templatesDir, 'RegisterComplete_Main.ejs'),
103
- path.join(registerDir, `${completeFunctionName}_Main.js`),
104
- completeData
105
- );
106
-
107
- await renderAndWrite(
108
- path.join(templatesDir, 'RegisterComplete_HdrSqs.ejs'),
109
- path.join(registerDir, `${completeFunctionName}_${processHandlerType}.js`),
110
- completeData
111
- );
112
-
113
- // Also generate Dsq if needed, or legacy only had Sqs?
114
- // Legacy RegisterComplete_HdrSqs template does both Sqs and Dsq based on yaml, but here we just write HdrSqs and HdrDsq.
115
- await renderAndWrite(
116
- path.join(templatesDir, 'RegisterComplete_HdrSqs.ejs'),
117
- path.join(registerDir, `${completeFunctionName}_HdrDsq.js`),
118
- { ...completeData, handlerType: 'HdrDsq' }
119
- );
120
-
121
- // Append to flow-schema.yml
122
- await renderAndAppend(
123
- path.join(wsTemplatesDir, 'ProcessWebSocketFlow_Yaml.ejs'),
124
- path.join(slsYamlDir, 'flow-schema.yml'),
125
- completeData
126
- );
127
-
128
- // Append Dsq to flow-schema
129
- await renderAndAppend(
130
- path.join(wsTemplatesDir, 'ProcessWebSocketFlow_Yaml.ejs'),
131
- path.join(slsYamlDir, 'flow-schema.yml'),
132
- {
133
- ...completeData,
134
- handlerType: 'HdrDsq',
135
- upperHandlerType: 'HDRDSQ',
136
- functionNameConfig: upperCase(completeFunctionName) + 'Dsq',
137
- handlerFilePath: `src/generatedCode/SystemFlowSchemas/Register/source/${completeFunctionName}_HdrDsq`,
138
- }
139
- );
140
-
141
- // 3. SQS and SNS Subscriptions
142
- // We reuse ProcessWebSocket_Yaml.ejs which creates SQS queue
143
- await renderAndAppend(
144
- path.join(wsTemplatesDir, 'ProcessWebSocket_Yaml.ejs'),
145
- path.join(resourceYamlDir, 'generated-sns-in-sqs.yml'),
146
- completeData
147
- );
148
-
149
- // RegisterComplete subscribes to ALL output topics
150
- for (const flowSchema of allLocalFlowSchemas) {
151
- if (flowSchema.outputTopic) {
152
- const topicOut = upperCase(flowSchema.flowTag);
153
- await renderAndAppend(
154
- path.join(wsTemplatesDir, 'ProcessWebSocketSub_Yaml.ejs'),
155
- path.join(resourceYamlDir, 'generated-sns-in-sqs.yml'),
156
- {
157
- subscribeTo: topicOut,
158
- queueName: queueName,
159
- upperQueueName: upperCase(queueName)
160
- }
161
- );
162
- }
163
- }
147
+ }
164
148
 
165
- console.log(` [RegisterGenerator] Finished generating Register flow files.`);
149
+ console.log(' [RegisterGenerator] Finished generating Register flow files.');
166
150
  }
@@ -1,20 +1,28 @@
1
1
  import fs from 'fs/promises';
2
2
  import path from 'path';
3
3
  import { fileURLToPath } from 'url';
4
+ import ejs from 'ejs';
4
5
 
5
6
  const __filename = fileURLToPath(import.meta.url);
6
7
  const __dirname = path.dirname(__filename);
7
8
 
8
9
  export async function generateConsts(options) {
9
- console.log(' [ConstsGenerator] Generating Consts...');
10
+ console.log(' [ConstsGenerator] Generating Consts...');
10
11
 
11
- const outputDir = path.join(options.outputPath, 'app', 'src', 'generatedCode', 'libs', 'source');
12
- await fs.mkdir(outputDir, { recursive: true });
12
+ const outputDir = path.join(
13
+ options.outputPath,
14
+ 'app',
15
+ 'src',
16
+ 'generatedCode',
17
+ 'libs',
18
+ 'source'
19
+ );
20
+ await fs.mkdir(outputDir, { recursive: true });
13
21
 
14
- const sourceFile = path.join(__dirname, 'templates', 'Consts.js');
15
- const destFile = path.join(outputDir, 'Consts.js');
22
+ const sourceFile = path.join(__dirname, 'templates', 'Consts.ejs');
23
+ const destFile = path.join(outputDir, 'Consts.js');
24
+ const template = await fs.readFile(sourceFile, 'utf8');
16
25
 
17
- await fs.copyFile(sourceFile, destFile);
18
-
19
- console.log(` [ConstsGenerator] Wrote Consts.js`);
26
+ await fs.writeFile(destFile, ejs.render(template, {}));
27
+ console.log(' [ConstsGenerator] Wrote Consts.js');
20
28
  }
@@ -1,20 +1,28 @@
1
1
  import fs from 'fs/promises';
2
2
  import path from 'path';
3
3
  import { fileURLToPath } from 'url';
4
+ import ejs from 'ejs';
4
5
 
5
6
  const __filename = fileURLToPath(import.meta.url);
6
7
  const __dirname = path.dirname(__filename);
7
8
 
8
9
  export async function generateCodeLibs(options) {
9
- console.log(' [GenerateCodeLibsGenerator] Generating Code Libs...');
10
-
11
- const outputDir = path.join(options.outputPath, 'app', 'src', 'generatedCode', 'libs', 'source');
12
- await fs.mkdir(outputDir, { recursive: true });
10
+ console.log(' [GenerateCodeLibsGenerator] Generating Code Libs...');
13
11
 
14
- const sourceFile = path.join(__dirname, 'templates', 'GenerateCodeLibs.js');
15
- const destFile = path.join(outputDir, 'GenerateCodeLibs.js');
12
+ const outputDir = path.join(
13
+ options.outputPath,
14
+ 'app',
15
+ 'src',
16
+ 'generatedCode',
17
+ 'libs',
18
+ 'source'
19
+ );
20
+ await fs.mkdir(outputDir, { recursive: true });
16
21
 
17
- await fs.copyFile(sourceFile, destFile);
18
-
19
- console.log(` [GenerateCodeLibsGenerator] Wrote GenerateCodeLibs.js`);
22
+ const sourceFile = path.join(__dirname, 'templates', 'GenerateCodeLibs.ejs');
23
+ const destFile = path.join(outputDir, 'GenerateCodeLibs.js');
24
+ const template = await fs.readFile(sourceFile, 'utf8');
25
+
26
+ await fs.writeFile(destFile, ejs.render(template, {}));
27
+ console.log(' [GenerateCodeLibsGenerator] Wrote GenerateCodeLibs.js');
20
28
  }
@@ -2,7 +2,7 @@ import path from 'path';
2
2
  import fs from 'fs/promises';
3
3
  import { fileURLToPath } from 'url';
4
4
  import ejs from 'ejs';
5
- import { getFlowsForGeneration } from '../../app/src/generatedCode/Flow/_internal/shared/flowSelection.js';
5
+ import { getFlowsForGeneration } from '../../app/src/generatedCode/Flow/_shared/shared/flowSelection.js';
6
6
 
7
7
  const __filename = fileURLToPath(import.meta.url);
8
8
  const __dirname = path.dirname(__filename);
@@ -49,7 +49,16 @@ export async function generateFlowOut(allSchemas, options) {
49
49
  'UpdateNodeComplete',
50
50
  'GetNodeComplete',
51
51
  'ProcessLogicalComplete',
52
- 'FindDataComplete'
52
+ 'FindDataComplete',
53
+ // CRUD Async Topics
54
+ 'Create', 'Update', 'Delete',
55
+ // Relationship Topics
56
+ 'CreateRelationship', 'UpdateRelationship', 'DeleteRelationship',
57
+ 'GetRelationship', 'ChangeRelationship', 'MoveRelationship',
58
+ // RBAC Topics
59
+ 'CreateTargetRole', 'ListTargetRole', 'DeleteTargetRole',
60
+ 'CreateRolePermissions', 'ListRolePermissions', 'DeleteRolePermissions',
61
+ 'CreateUserRole', 'ListUserInRoles', 'DeleteUserFromRole'
53
62
  ];
54
63
 
55
64
  for (const topic of systemTopics) {