@izara_project/izara-core-generate-service-code 1.0.65 → 1.0.67

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 (257) hide show
  1. package/README.md +73 -11
  2. package/docs/TriggeredCache Flow.drawio +193 -0
  3. package/docs/test.mmd +47 -0
  4. package/docs/test.png +0 -0
  5. package/index.js +0 -5
  6. package/package.json +7 -6
  7. package/src/compile/compileProject.js +26 -0
  8. package/src/compile/loadSchemas.js +50 -0
  9. package/src/emit/crud/dynamicCrudFlowSchemaTemplate.js +11 -0
  10. package/src/emit/crud/emitCrudApplicationArtifacts.js +161 -0
  11. package/src/emit/crud/emitDynamicCrudFlowSchemas.js +84 -0
  12. package/src/emit/crud/generateCrudApplicationArtifacts.js +16 -0
  13. package/src/emit/crud/generateDynamicCrudFlowSchemas.js +21 -0
  14. package/src/emit/crud/loadLocalSchemaArrays.js +8 -0
  15. package/src/{codeGenerators/app/src/generatedCode/Flow/FlowObjects/templates/crud → emit/crud/templates}/CreateEndpoint_Main.ejs +6 -6
  16. package/src/{codeGenerators/app/src/generatedCode/Flow/FlowObjects/templates/crud → emit/crud/templates}/DeleteEndpoint_Main.ejs +6 -6
  17. package/src/{codeGenerators/app/src/generatedCode/Flow/FlowObjects/templates/step → emit/crud/templates}/FlowEndpointBeforeLogical_Main.ejs +2 -2
  18. package/src/emit/crud/templates/FlowEndpointComplete_Main.ejs +96 -0
  19. package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/endpoint → emit/crud/templates}/FlowEndpoint_HdrWbs.ejs +1 -1
  20. package/src/emit/crud/templates/FlowHandler_HdrApi.ejs +69 -0
  21. package/src/{codeGenerators/app/src/generatedCode/ProcessLogical/templates/ProcessLogical_HdrSqs.ejs → emit/crud/templates/FlowHandler_HdrSqs.ejs} +52 -56
  22. package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/endpoint → emit/crud/templates}/FlowMain_Wbs.ejs +1 -3
  23. package/src/{codeGenerators/app/src/generatedCode/Flow/FlowObjects/templates/crud → emit/crud/templates}/GetEndpoint_Main.ejs +2 -2
  24. package/src/emit/crud/templates/GetRangeEndpoint_Main.ejs +127 -0
  25. package/src/{codeGenerators/app/src/generatedCode/Flow/FlowObjects/templates/crud → emit/crud/templates}/UpdateEndpoint_Main.ejs +11 -9
  26. package/src/emit/custom/customFlows.js +121 -0
  27. package/src/emit/custom/emitCustomFlowApplicationArtifacts.js +325 -0
  28. package/src/emit/custom/generateCustomFlowApplicationArtifacts.js +22 -0
  29. package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/endpoint → emit/custom/templates}/FlowEndpoint_Main.ejs +5 -5
  30. package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/step → emit/custom/templates}/FlowStep_Main.ejs +1 -1
  31. package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas → emit/custom}/templates/s3/ConfirmReserved_Main.ejs +5 -5
  32. package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas → emit/custom}/templates/s3/CreateObject_HdrWbs.ejs +1 -1
  33. package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas → emit/custom}/templates/s3/CreateObject_Main.ejs +3 -3
  34. package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas → emit/custom}/templates/s3/CreatePreSignUrl_Main.ejs +4 -5
  35. package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas → emit/custom}/templates/s3/FlowHandler_HdrS3.ejs +2 -8
  36. package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas → emit/custom}/templates/s3/ProcessS3File_Main.ejs +1 -1
  37. package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas → emit/custom}/templates/s3/ReservedLimit_Main.ejs +5 -6
  38. package/src/emit/custom/templates/triggerCache/CheckTriggerCache_HdrSqs.ejs +32 -0
  39. package/src/emit/custom/templates/triggerCache/CheckTriggerCache_Main.ejs +63 -0
  40. package/src/emit/custom/templates/triggerCache/TriggerCacheComplete_Main.ejs +35 -0
  41. package/src/emit/custom/templates/triggerCache/TriggerCache_Main.ejs +16 -0
  42. package/src/emit/function/functionYamlArtifact.js +125 -0
  43. package/src/emit/rbac/emitDynamicRbacFlowSchemas.js +117 -0
  44. package/src/emit/rbac/emitRbacApplicationArtifacts.js +270 -0
  45. package/src/emit/rbac/generateCreateTargetRoleHandler.js +19 -0
  46. package/src/emit/rbac/generateDynamicRbacFlowSchemas.js +21 -0
  47. package/src/emit/rbac/rbacFlowTag.js +7 -0
  48. package/src/emit/rbac/templates/CreateTargetRole_HdrSqs.ejs +24 -0
  49. package/src/emit/rbac/templates/CreateTargetRole_Main.ejs +25 -0
  50. package/src/emit/rbac/templates/DynamicRbacFlowSchema.ejs +5 -0
  51. package/src/emit/rbac/templates/ListRbac_HdrApi.ejs +17 -0
  52. package/src/emit/rbac/templates/ListRbac_HdrSqs.ejs +13 -0
  53. package/src/emit/rbac/templates/ListRbac_Main.ejs +29 -0
  54. package/src/emit/rbac/templates/RbacMutation_Main.ejs +22 -0
  55. package/src/emit/rbac/templates/UserRbacFlow_HdrInv.ejs +10 -0
  56. package/src/emit/rbac/templates/UserRbacFlow_Main.ejs +44 -0
  57. package/src/emit/rbac/templates/UserRoleMutation_Main.ejs +33 -0
  58. package/src/emit/relationship/dynamicRelationshipFlowSchemaTemplate.js +11 -0
  59. package/src/emit/relationship/emitDynamicRelationshipFlowSchemas.js +66 -0
  60. package/src/emit/relationship/emitRelationshipApplicationArtifacts.js +148 -0
  61. package/src/emit/relationship/generateDynamicRelationshipFlowSchemas.js +23 -0
  62. package/src/emit/relationship/generateRelationshipApplicationArtifacts.js +22 -0
  63. package/src/{codeGenerators/app/src/generatedCode/Flow/FlowRelationships/templates/relationship/ProcessChangeRelationshipComplete_Main.ejs → emit/relationship/templates/ChangeRelationshipComplete_Main.ejs} +1 -1
  64. package/src/{codeGenerators/app/src/generatedCode/Flow/FlowRelationships/templates/relationship/ProcessChangeRelationship_Main.ejs → emit/relationship/templates/ChangeRelationship_Main.ejs} +12 -4
  65. package/src/{codeGenerators/app/src/generatedCode/Flow/FlowRelationships/templates/relationship/ProcessCreateRelationshipComplete_Main.ejs → emit/relationship/templates/CreateRelationshipComplete_Main.ejs} +1 -1
  66. package/src/{codeGenerators/app/src/generatedCode/Flow/FlowRelationships/templates/relationship/ProcessCreateRelationship_Main.ejs → emit/relationship/templates/CreateRelationship_Main.ejs} +1 -1
  67. package/src/{codeGenerators/app/src/generatedCode/Flow/FlowRelationships/templates/relationship/ProcessDeleteRelationshipComplete_Main.ejs → emit/relationship/templates/DeleteRelationshipComplete_Main.ejs} +1 -1
  68. package/src/{codeGenerators/app/src/generatedCode/Flow/FlowRelationships/templates/relationship/ProcessDeleteRelationship_Main.ejs → emit/relationship/templates/DeleteRelationship_Main.ejs} +1 -1
  69. package/src/{codeGenerators/app/src/generatedCode/Flow/_shared/handlers → emit/relationship/templates}/FlowHandler_HdrDsq.ejs +1 -1
  70. package/src/emit/relationship/templates/FlowHandler_HdrInv.ejs +45 -0
  71. package/src/{codeGenerators/app/src/generatedCode/Flow/FlowRelationships/templates/relationship/ProcessGetRelationshipComplete_Main.ejs → emit/relationship/templates/GetRelationshipComplete_Main.ejs} +1 -1
  72. package/src/{codeGenerators/app/src/generatedCode/Flow/FlowRelationships/templates/relationship/ProcessGetRelationship_Main.ejs → emit/relationship/templates/GetRelationship_Main.ejs} +1 -1
  73. package/src/{codeGenerators/app/src/generatedCode/Flow/FlowRelationships/templates/relationship/ProcessMoveRelationship_Main.ejs → emit/relationship/templates/MoveRelationship_Main.ejs} +9 -1
  74. package/src/{codeGenerators/app/src/generatedCode/Flow/FlowRelationships/templates/relationship/ProcessUpdateRelationshipComplete_Main.ejs → emit/relationship/templates/UpdateRelationshipComplete_Main.ejs} +1 -1
  75. package/src/{codeGenerators/app/src/generatedCode/Flow/FlowRelationships/templates/relationship/ProcessUpdateRelationship_Main.ejs → emit/relationship/templates/UpdateRelationship_Main.ejs} +1 -1
  76. package/src/emit/resource/emitResourceArtifacts.js +595 -0
  77. package/src/emit/resource/generateResourceArtifacts.js +20 -0
  78. package/src/{codeGenerators/resource/sls_yaml/templates/crud → emit/resource/templates}/ResourceBeforeLogicalYaml.ejs +1 -1
  79. package/src/{codeGenerators/resource/sls_yaml/templates/crud → emit/resource/templates}/ResourceSqsYaml.ejs +6 -6
  80. package/src/{codeGenerators/app/sls_yaml → emit/resource}/templates/SharedResource_Yaml.ejs +8 -8
  81. package/src/emit/system/emitSystemWebSocketArtifacts.js +183 -0
  82. package/src/generate.js +60 -126
  83. package/src/output/commitArtifacts.js +213 -0
  84. package/src/output/mergeHooks.js +55 -0
  85. package/src/output/validateArtifacts.js +62 -0
  86. package/src/plan/buildGenerationPlan.js +50 -0
  87. package/test/core.test.js +159 -0
  88. package/test/createTargetRoleHandler.test.js +68 -0
  89. package/test/crudApplicationArtifacts.test.js +107 -0
  90. package/test/customFlowApplicationArtifacts.test.js +297 -0
  91. package/test/dynamicCrudFlowSchemas.test.js +136 -0
  92. package/test/dynamicRbacFlowSchemas.test.js +101 -0
  93. package/test/dynamicRelationshipFlowSchemas.test.js +99 -0
  94. package/test/functionYamlArtifact.test.js +34 -0
  95. package/test/intTestApi.test.js +29 -0
  96. package/test/publicApi.test.js +209 -0
  97. package/test/relationshipApplicationArtifacts.test.js +68 -0
  98. package/test/resourceArtifacts.test.js +121 -0
  99. package/jsconfig.json +0 -9
  100. package/src/__tests__/getIntTestConfig.test.js +0 -51
  101. package/src/__tests__/intTestGeneratorShared.test.cjs +0 -169
  102. package/src/__tests__/pathIntTest.test.js +0 -103
  103. package/src/codeGenerators/app/initial_setup/InitialSetupGenerator.js +0 -199
  104. package/src/codeGenerators/app/initial_setup/templates/InitialSetup_LambdaRole.ejs +0 -50
  105. package/src/codeGenerators/app/initial_setup/templates/InitialSetup_SnsService.ejs +0 -15
  106. package/src/codeGenerators/app/initial_setup/templates/InitialSetup_TableName.ejs +0 -9
  107. package/src/codeGenerators/app/sls_yaml/FindDataYamlGenerator.js +0 -23
  108. package/src/codeGenerators/app/sls_yaml/FunctionYamlGenerator.js +0 -332
  109. package/src/codeGenerators/app/sls_yaml/ProcessLogicalYamlGenerator.js +0 -21
  110. package/src/codeGenerators/app/sls_yaml/RoleNameConfigGenerator.js +0 -48
  111. package/src/codeGenerators/app/sls_yaml/SharedResourceYamlGenerator.js +0 -503
  112. package/src/codeGenerators/app/sls_yaml/__tests__/SharedResourceYamlGenerator.test.js +0 -235
  113. package/src/codeGenerators/app/sls_yaml/_policy/PolicyRegistry.js +0 -56
  114. package/src/codeGenerators/app/sls_yaml/_policy/__tests__/PolicyRegistry.test.js +0 -33
  115. package/src/codeGenerators/app/sls_yaml/renderYamlTemplate.js +0 -13
  116. package/src/codeGenerators/app/sls_yaml/templates/FindData_Yaml.ejs +0 -10
  117. package/src/codeGenerators/app/sls_yaml/templates/FunctionYaml_Api.ejs +0 -21
  118. package/src/codeGenerators/app/sls_yaml/templates/FunctionYaml_EventBridge.ejs +0 -14
  119. package/src/codeGenerators/app/sls_yaml/templates/FunctionYaml_Inv.ejs +0 -6
  120. package/src/codeGenerators/app/sls_yaml/templates/FunctionYaml_Sqs.ejs +0 -11
  121. package/src/codeGenerators/app/sls_yaml/templates/FunctionYaml_Wbs.ejs +0 -11
  122. package/src/codeGenerators/app/sls_yaml/templates/ProcessLogical_Yaml.ejs +0 -32
  123. package/src/codeGenerators/app/sls_yaml/templates/RoleNameConfig_Yaml.ejs +0 -5
  124. package/src/codeGenerators/app/src/generatedCode/FindData/FindDataGenerator.js +0 -238
  125. package/src/codeGenerators/app/src/generatedCode/FindData/templates/FindData_HdrSqs.ejs +0 -87
  126. package/src/codeGenerators/app/src/generatedCode/FindData/templates/FindData_Main.ejs +0 -108
  127. package/src/codeGenerators/app/src/generatedCode/FindData/templates/GetByStorage/getByDynamo.ejs +0 -32
  128. package/src/codeGenerators/app/src/generatedCode/FindData/templates/GetByStorage/getByGraph.ejs +0 -87
  129. package/src/codeGenerators/app/src/generatedCode/Flow/FlowObjects/.gitkeep +0 -0
  130. package/src/codeGenerators/app/src/generatedCode/Flow/FlowObjects/EndpointsGenerator.js +0 -120
  131. package/src/codeGenerators/app/src/generatedCode/Flow/FlowObjects/templates/step/FlowEndpointComplete_Main.ejs +0 -313
  132. package/src/codeGenerators/app/src/generatedCode/Flow/FlowRbac/RbacFlowGenerator.js +0 -116
  133. package/src/codeGenerators/app/src/generatedCode/Flow/FlowRbac/templates/rbac/CreateRolePermissions.ejs +0 -135
  134. package/src/codeGenerators/app/src/generatedCode/Flow/FlowRbac/templates/rbac/CreateTargetRole.ejs +0 -131
  135. package/src/codeGenerators/app/src/generatedCode/Flow/FlowRbac/templates/rbac/CreateUserRole.ejs +0 -150
  136. package/src/codeGenerators/app/src/generatedCode/Flow/FlowRbac/templates/rbac/DeleteRolePermissions.ejs +0 -132
  137. package/src/codeGenerators/app/src/generatedCode/Flow/FlowRbac/templates/rbac/DeleteTargetRole.ejs +0 -132
  138. package/src/codeGenerators/app/src/generatedCode/Flow/FlowRbac/templates/rbac/DeleteUserFromRole.ejs +0 -150
  139. package/src/codeGenerators/app/src/generatedCode/Flow/FlowRbac/templates/rbac/FlowRbac_Main.ejs +0 -252
  140. package/src/codeGenerators/app/src/generatedCode/Flow/FlowRbac/templates/rbac/ListRolePermissions.ejs +0 -120
  141. package/src/codeGenerators/app/src/generatedCode/Flow/FlowRbac/templates/rbac/ListTargetRole.ejs +0 -122
  142. package/src/codeGenerators/app/src/generatedCode/Flow/FlowRbac/templates/rbac/ListUserInRoles.ejs +0 -117
  143. package/src/codeGenerators/app/src/generatedCode/Flow/FlowRelationships/RelationshipFlowGenerator.js +0 -148
  144. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/.gitkeep +0 -0
  145. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/StatusFieldGenerator.js +0 -109
  146. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/WebSocketGenerator.js +0 -122
  147. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/endpoint/FlowEntryPoint_Main.ejs +0 -38
  148. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/statusField/CompleteStatusFieldSns_Yaml.ejs +0 -52
  149. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/statusField/CompleteStatusField_HdrSqs.ejs +0 -84
  150. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/statusField/CompleteStatusField_Main.ejs +0 -78
  151. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/step/plugIns/FlowStep_ByConfig_Awaiting_Main.ejs +0 -123
  152. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/step/plugIns/FlowStep_ByConfig_Paginated_Main.ejs +0 -59
  153. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/step/plugIns/FlowStep_PlugIn_Main.ejs +0 -72
  154. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/step/plugIns/FlowStep_RecievePlugIn_Main.ejs +0 -76
  155. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/step/plugIns/templateAwaitingStep.ejs +0 -41
  156. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/step/plugIns/templateSendPlugin.ejs +0 -18
  157. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/webSocket/ProcessWebSocketFlow_Yaml.ejs +0 -26
  158. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/webSocket/ProcessWebSocketSub_Yaml.ejs +0 -7
  159. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/webSocket/ProcessWebSocket_HdrSqs.ejs +0 -66
  160. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/webSocket/ProcessWebSocket_Main.ejs +0 -115
  161. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/webSocket/ProcessWebSocket_Yaml.ejs +0 -36
  162. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/webSocket/WebSocketConnect_Main.ejs +0 -52
  163. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/webSocket/WebSocketConnect_Yaml.ejs +0 -13
  164. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/webSocket/WebSocketDynamoDb_Yaml.ejs +0 -28
  165. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/BaseDsqHandler.js +0 -63
  166. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/BaseSqsHandler.js +0 -66
  167. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/__tests__/BaseDsqHandler.test.js +0 -94
  168. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/dsq.js +0 -5
  169. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/eventBridge.js +0 -33
  170. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/extTopic.js +0 -6
  171. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/lambdaSyncApi.js +0 -51
  172. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/lambdaSyncInv.js +0 -51
  173. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/ownTopic.js +0 -54
  174. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/registry.js +0 -17
  175. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/s3.js +0 -56
  176. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/s3Components/ConfirmAfterUploadS3Generator.js +0 -46
  177. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/s3Components/CreateObjectGenerator.js +0 -50
  178. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/s3Components/CreatePreSignUrlGenerator.js +0 -48
  179. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/s3Components/ProcessAfterUploadS3Generator.js +0 -49
  180. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/s3Components/ReservedLimitGenerator.js +0 -47
  181. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/eventTypes.js +0 -23
  182. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/flowClassifier.js +0 -50
  183. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/flowEntryPointBase.js +0 -106
  184. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/flowMainFunctionBase.js +0 -172
  185. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/flowNaming.js +0 -37
  186. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/flowSelection.js +0 -19
  187. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/flowStepBase.js +0 -235
  188. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/flowStepNormalizer.js +0 -75
  189. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/flowValidator.js +0 -267
  190. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/propertyNormalizer.js +0 -18
  191. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/registry.js +0 -7
  192. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/roleNameDetection.js +0 -49
  193. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/triggerCacheBase.js +0 -177
  194. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/triggerCache/CheckTriggerCache_HdrSqs.ejs +0 -89
  195. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/triggerCache/CheckTriggerCache_Main.ejs +0 -83
  196. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/triggerCache/ProcessTriggerCache_HdrSqs.ejs +0 -103
  197. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/triggerCache/ProcessTriggerCache_Main.ejs +0 -58
  198. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/triggerCache/TriggerCacheComplete_HdrDsq.ejs +0 -104
  199. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/triggerCache/TriggerCacheComplete_HdrSqs.ejs +0 -88
  200. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/triggerCache/TriggerCacheComplete_Main.ejs +0 -80
  201. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/triggerCache/TriggerCacheQueue_Yaml.ejs +0 -36
  202. package/src/codeGenerators/app/src/generatedCode/Flow/_shared/yaml/SharedFunctionSqs_Yaml.ejs +0 -13
  203. package/src/codeGenerators/app/src/generatedCode/ProcessLogical/ProcessLogicalGenerator.js +0 -29
  204. package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/PaginateProcessLogical_HdrDsq.ejs +0 -177
  205. package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/PaginateProcessLogical_HdrSqs.ejs +0 -155
  206. package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/PaginateProcessLogical_Main.ejs +0 -268
  207. package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/ProcessLogical_Main.ejs +0 -450
  208. package/src/codeGenerators/app/src/generatedCode/SystemFlowSchemas/RegisterGenerator.js +0 -149
  209. package/src/codeGenerators/app/src/generatedCode/SystemFlowSchemas/templates/register/RegisterComplete_HdrSqs.ejs +0 -85
  210. package/src/codeGenerators/app/src/generatedCode/SystemFlowSchemas/templates/register/RegisterComplete_Main.ejs +0 -176
  211. package/src/codeGenerators/app/src/generatedCode/SystemFlowSchemas/templates/register/Register_HdrWbs.ejs +0 -80
  212. package/src/codeGenerators/app/src/generatedCode/SystemFlowSchemas/templates/register/Register_Main.ejs +0 -164
  213. package/src/codeGenerators/app/src/generatedCode/libs/ConstsGenerator.js +0 -28
  214. package/src/codeGenerators/app/src/generatedCode/libs/GenerateCodeLibsGenerator.js +0 -28
  215. package/src/codeGenerators/app/src/generatedCode/libs/templates/Consts.ejs +0 -448
  216. package/src/codeGenerators/app/src/generatedCode/libs/templates/GenerateCodeLibs.ejs +0 -124
  217. package/src/codeGenerators/resource/sls_yaml/DynamoDBGenerator.js +0 -87
  218. package/src/codeGenerators/resource/sls_yaml/FlowOutGenerator.js +0 -70
  219. package/src/codeGenerators/resource/sls_yaml/FlowResourceYamlGenerator.js +0 -182
  220. package/src/core/renderTemplateFile.js +0 -22
  221. package/src/core/validate.js +0 -165
  222. package/src/generateCode.js +0 -357
  223. package/src/generateSchema.js +0 -123
  224. package/src/parsers/flowSchemaParser.js +0 -112
  225. package/src/parsers/objectSchemaParser.js +0 -39
  226. package/src/parsers/relationshipSchemaParser.js +0 -51
  227. package/src/schemaGenerators/app/src/schemas/FlowSchemas/FlowSchemaGenerator.js +0 -107
  228. package/src/schemaGenerators/app/src/schemas/FlowSchemas/RbacFlowSchemaGenerator.js +0 -98
  229. package/src/schemaGenerators/app/src/schemas/FlowSchemas/RelationshipFlowSchemaGenerator.js +0 -89
  230. package/src/schemaGenerators/app/src/schemas/FlowSchemas/templates/DynamicFlowSchemaTemplate.ejs +0 -41
  231. package/src/schemaGenerators/app/src/schemas/FlowSchemas/templates/DynamicRbacFlowSchemaTemplate.ejs +0 -20
  232. package/src/schemaGenerators/app/src/schemas/FlowSchemas/templates/RelationshipFlowSchemaTemplate.ejs +0 -33
  233. package/src/schemaGenerators/app/src/schemas/FlowSchemas/templates/UserRbacFlowSchemaTemplate.ejs +0 -22
  234. package/src/schemaGenerators/app/src/schemas/ObjectSchemas/AttributeTreeSchemaGenerator.js +0 -124
  235. package/src/schemaGenerators/app/src/schemas/ObjectSchemas/PropertyValueSchemaGenerator.js +0 -119
  236. package/src/schemaGenerators/app/src/schemas/ObjectSchemas/templates/DynamicAttributeTreeManagerSchemaTemplate.ejs +0 -14
  237. package/src/schemaGenerators/app/src/schemas/ObjectSchemas/templates/DynamicAttributeTreeStandardSchemaTemplate.ejs +0 -13
  238. package/src/schemaGenerators/app/src/schemas/ObjectSchemas/templates/DynamicPropertyValueSchemaTemplate.ejs +0 -15
  239. package/src/schemaGenerators/app/src/schemas/RelationshipSchemas/AttributeTreeRelationshipSchemaGenerator.js +0 -109
  240. package/src/schemaGenerators/app/src/schemas/RelationshipSchemas/PropertyValueRelationshipSchemaGenerator.js +0 -103
  241. package/src/schemaGenerators/app/src/schemas/RelationshipSchemas/__tests__/relationshipSchemaHelpers.test.js +0 -38
  242. package/src/schemaGenerators/app/src/schemas/RelationshipSchemas/relationshipSchemaHelpers.js +0 -40
  243. package/src/schemaGenerators/app/src/schemas/RelationshipSchemas/templates/DynamicAttributeTreeRelationshipSchemaTemplate.ejs +0 -7
  244. package/src/schemaGenerators/app/src/schemas/RelationshipSchemas/templates/DynamicPropertyValueRelationshipSchemaTemplate.ejs +0 -7
  245. package/src/schemaGenerators/app/src/schemas/SystemTextSchemas/SystemTextGenerator.js +0 -102
  246. package/src/schemaGenerators/app/src/schemas/SystemTextSchemas/templates/SystemText_Template.ejs +0 -10
  247. /package/src/{codeGenerators/app/src/generatedCode/Flow/_shared/handlers → emit/crud/templates}/FlowHandler_HdrInv.ejs +0 -0
  248. /package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas → emit/custom}/templates/s3/ConfirmReserved_HdrSqs.ejs +0 -0
  249. /package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas → emit/custom}/templates/s3/CreatePreSignUrl_HdrSqs.ejs +0 -0
  250. /package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas → emit/custom}/templates/s3/ReservedLimit_HdrSqs.ejs +0 -0
  251. /package/src/{codeGenerators/app/src/generatedCode/Flow/_shared/handlers → emit/relationship/templates}/FlowHandler_HdrApi.ejs +0 -0
  252. /package/src/{codeGenerators/app/src/generatedCode/Flow/_shared/handlers → emit/relationship/templates}/FlowHandler_HdrSqs.ejs +0 -0
  253. /package/src/{codeGenerators/app/src/generatedCode/Flow/FlowRelationships/templates/relationship/ProcessMoveRelationshipComplete_Main.ejs → emit/relationship/templates/MoveRelationshipComplete_Main.ejs} +0 -0
  254. /package/src/{codeGenerators/resource/sls_yaml → emit/resource}/templates/DynamoDBTable_Yaml.ejs +0 -0
  255. /package/src/{codeGenerators/resource/sls_yaml → emit/resource}/templates/FlowOut_Yaml.ejs +0 -0
  256. /package/src/{codeGenerators/resource/sls_yaml/templates/crud → emit/resource/templates}/ResourceYaml.ejs +0 -0
  257. /package/src/{codeGenerators/resource/sls_yaml → emit/resource}/templates/SystemDynamoDB_Yaml.ejs +0 -0
package/README.md CHANGED
@@ -1,15 +1,77 @@
1
- # izara-izara-core-generate-service-code
1
+ # IzaraCore-SupportServices-GenerateServiceCodeV2
2
2
 
3
- # update version
4
- - commit code first
5
- npm version patch || npm version minor || npm version major
3
+ New implementation of the schema-driven service generator. The legacy
4
+ GenerateServiceCode repository remains the behavior oracle during migration.
6
5
 
7
- # can also push to repo ..
8
- git push
9
- # make sure commits look correct
6
+ The first V2 seam is deliberately small:
10
7
 
11
- # push to npm
12
- npm publish
8
+ ```text
9
+ GenerationRequest -> ProjectModel -> GenerationPlan -> Artifact[] -> committed files
10
+ ```
13
11
 
14
- # update project that uses this package
15
- npm update @izara_project/izara-core-generate-service-code
12
+ `test-lib-generateCode` now points its local dependency at this checkout. Its
13
+ V2 acceptance suites use only `generate(rootPath, options)`. Legacy golden
14
+ comparison remains an oracle review: generation and artifact paths pass, while
15
+ content differences are not accepted automatically.
16
+
17
+ ## Current Slice
18
+
19
+ `generate(rootPath, options)` is the only public entrypoint. It loads
20
+ the three schema directories once, emits every currently migrated schema,
21
+ application, and resource slice, then commits all artifacts in one transaction
22
+ and returns one `GenerationResult`. Managed artifacts retain their existing
23
+ slice ownership, so stale files are cleaned without deleting legacy-owned
24
+ output.
25
+
26
+ `generate()` rejects invalid project/schema/artifact input before it commits.
27
+ If staging or replacing an output target fails (including a directory or
28
+ symlink where a generated file belongs), it restores every affected artifact
29
+ and manifest from the same transaction; callers receive the original error.
30
+
31
+ ## Current Cutover Boundary
32
+
33
+ V2 is generator-only for the current migration. `test-lib-generateCode` is
34
+ the approved V2 consumer and calls the supported `generate()` API. Deployed
35
+ services continue to use the legacy 1.x package for runtime imports; V2 does
36
+ not provide legacy runtime exports such as `generateCode`, `utils`, `consts`,
37
+ or `libs`.
38
+
39
+ Do not replace the legacy package in a deployed service with V2 until a
40
+ separate runtime migration removes those generated-code imports and verifies
41
+ the resulting service behavior. The legacy repository is read-only and
42
+ non-runtime now. After the first successful V2 production deployment, 90 days
43
+ and two release cycles must both complete before it is archived as a protected,
44
+ read-only Git repository. Archive retains its tags, history, and fixtures; it
45
+ does not delete the repository.
46
+
47
+ Generated function YAML preserves `FunctionSetting` hook blocks across
48
+ regeneration and rollback. Completion SQS handlers retain the established
49
+ `callingFlow` filter contract.
50
+
51
+ Internally, the custom-flow emitter owns fixture-level application artifacts
52
+ for `eventBridge`, `ownTopic`, `extTopic`, `lambdaSyncInv`, `lambdaSyncApi`,
53
+ and S3's five entry handlers. The Phase 7 contract is artifact-level (paths,
54
+ JavaScript syntax, YAML and resource/IAM wiring), not an end-to-end invocation
55
+ contract.
56
+
57
+ ## Architecture Status
58
+
59
+ The implemented V2 layout makes the pipeline ownership explicit:
60
+
61
+ ```text
62
+ src/compile/ request and local schema loading
63
+ src/plan/ GenerationPlan construction
64
+ src/emit/ schema, application, function, resource, and system emitters
65
+ src/output/ artifact validation, hook merge, and transaction commit
66
+ ```
67
+
68
+ `src/generate.js` remains the high-level orchestration entrypoint. Emitter
69
+ domains and their templates stay together beneath `src/emit/`; no pass-through
70
+ modules were added only to mirror the proposed diagram. Internal modules are
71
+ not part of the package API.
72
+
73
+ ## Development
74
+
75
+ ```bash
76
+ npm test
77
+ ```
@@ -0,0 +1,193 @@
1
+ <mxfile host="app.diagrams.net">
2
+ <diagram name="Page-1" id="pXYk_RwGkFAkQVFTFBd9">
3
+ <mxGraphModel grid="1" page="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
4
+ <root>
5
+ <mxCell id="0" />
6
+ <mxCell id="1" parent="0" />
7
+ <mxCell id="tqax0Luh1uLb62xYIonj-1" parent="1" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;strokeColor=light-dark(#000000,#FF66FF);" value="PrepComparisData_Main" vertex="1">
8
+ <mxGeometry height="120" width="120" x="354" y="120" as="geometry" />
9
+ </mxCell>
10
+ <mxCell id="tqax0Luh1uLb62xYIonj-2" edge="1" parent="1" source="tqax0Luh1uLb62xYIonj-1" style="endArrow=classic;html=1;rounded=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" value="">
11
+ <mxGeometry height="50" relative="1" width="50" as="geometry">
12
+ <mxPoint x="370" y="330" as="sourcePoint" />
13
+ <mxPoint x="414" y="340" as="targetPoint" />
14
+ </mxGeometry>
15
+ </mxCell>
16
+ <mxCell id="tqax0Luh1uLb62xYIonj-3" connectable="0" parent="tqax0Luh1uLb62xYIonj-2" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=#60a917;fontColor=#ffffff;labelBorderColor=#2D7600;" value="checkTriggeredCacheV2&amp;nbsp;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;ว่ามีงานของ triggerFlow อื่นที่ยังค้างอยูไหม&lt;/div&gt;" vertex="1">
17
+ <mxGeometry relative="1" x="-0.1668" y="2" as="geometry">
18
+ <mxPoint x="-2" y="78" as="offset" />
19
+ </mxGeometry>
20
+ </mxCell>
21
+ <mxCell id="tqax0Luh1uLb62xYIonj-15" connectable="0" parent="tqax0Luh1uLb62xYIonj-2" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=#60a917;fontColor=#ffffff;labelBorderColor=#2D7600;" value="checkTriggerFlowCompleteAwaitingStepV2&amp;nbsp;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;ว่ามีงานของ triggerFlow อื่นที่ยังค้างอยูไหม&lt;/div&gt;" vertex="1">
22
+ <mxGeometry relative="1" x="-0.1668" y="2" as="geometry">
23
+ <mxPoint x="4" y="339" as="offset" />
24
+ </mxGeometry>
25
+ </mxCell>
26
+ <mxCell id="tqax0Luh1uLb62xYIonj-23" connectable="0" parent="tqax0Luh1uLb62xYIonj-2" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];labelBackgroundColor=#60a917;fontColor=#ffffff;labelBorderColor=#2D7600;" value="checkTriggerResetedV2&amp;nbsp;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;ว่ามีงานของ triggerFlow อื่นที่ยังค้างอยูไหม&lt;/div&gt;" vertex="1">
27
+ <mxGeometry relative="1" x="-0.1668" y="2" as="geometry">
28
+ <mxPoint x="764" y="218" as="offset" />
29
+ </mxGeometry>
30
+ </mxCell>
31
+ <mxCell id="tqax0Luh1uLb62xYIonj-4" edge="1" parent="1" style="endArrow=classic;html=1;rounded=0;" value="">
32
+ <mxGeometry height="50" relative="1" width="50" as="geometry">
33
+ <mxPoint x="360" y="380" as="sourcePoint" />
34
+ <mxPoint x="360" y="480" as="targetPoint" />
35
+ </mxGeometry>
36
+ </mxCell>
37
+ <mxCell id="tqax0Luh1uLb62xYIonj-5" edge="1" parent="1" style="endArrow=classic;html=1;rounded=0;" value="">
38
+ <mxGeometry height="50" relative="1" width="50" as="geometry">
39
+ <mxPoint x="480" y="380" as="sourcePoint" />
40
+ <mxPoint x="480" y="480" as="targetPoint" />
41
+ </mxGeometry>
42
+ </mxCell>
43
+ <mxCell id="tqax0Luh1uLb62xYIonj-6" parent="1" style="rounded=1;whiteSpace=wrap;html=1;" value="มี" vertex="1">
44
+ <mxGeometry height="30" width="80" x="320" y="480" as="geometry" />
45
+ </mxCell>
46
+ <mxCell id="tqax0Luh1uLb62xYIonj-7" parent="1" style="rounded=1;whiteSpace=wrap;html=1;" value="ไม่มี" vertex="1">
47
+ <mxGeometry height="30" width="80" x="440" y="480" as="geometry" />
48
+ </mxCell>
49
+ <mxCell id="tqax0Luh1uLb62xYIonj-9" edge="1" parent="1" source="tqax0Luh1uLb62xYIonj-6" style="endArrow=classic;html=1;rounded=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" value="">
50
+ <mxGeometry height="50" relative="1" width="50" as="geometry">
51
+ <mxPoint x="320" y="495" as="sourcePoint" />
52
+ <mxPoint x="200" y="495" as="targetPoint" />
53
+ </mxGeometry>
54
+ </mxCell>
55
+ <mxCell id="tqax0Luh1uLb62xYIonj-11" parent="1" style="shape=tape;whiteSpace=wrap;html=1;" value="สร้าง request ไปที่&lt;div&gt;triggerFlow&lt;/div&gt;" vertex="1">
56
+ <mxGeometry height="135" width="120" x="80" y="427.5" as="geometry" />
57
+ </mxCell>
58
+ <mxCell id="tqax0Luh1uLb62xYIonj-12" parent="1" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;strokeColor=light-dark(#000000,#FF66FF);" value="CheckTriggerCache&lt;div&gt;Complete&lt;/div&gt;" vertex="1">
59
+ <mxGeometry height="104" width="104" x="370" y="800" as="geometry" />
60
+ </mxCell>
61
+ <mxCell id="tqax0Luh1uLb62xYIonj-16" edge="1" parent="1" source="tqax0Luh1uLb62xYIonj-12" style="endArrow=classic;html=1;rounded=0;exitX=0.5;exitY=0;exitDx=0;exitDy=0;" value="">
62
+ <mxGeometry height="50" relative="1" width="50" as="geometry">
63
+ <mxPoint x="210" y="680" as="sourcePoint" />
64
+ <mxPoint x="420" y="640" as="targetPoint" />
65
+ </mxGeometry>
66
+ </mxCell>
67
+ <mxCell id="tqax0Luh1uLb62xYIonj-17" edge="1" parent="1" style="endArrow=classic;html=1;rounded=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" target="tqax0Luh1uLb62xYIonj-6" value="">
68
+ <mxGeometry height="50" relative="1" width="50" as="geometry">
69
+ <mxPoint x="360" y="600" as="sourcePoint" />
70
+ <mxPoint x="330" y="530" as="targetPoint" />
71
+ </mxGeometry>
72
+ </mxCell>
73
+ <mxCell id="tqax0Luh1uLb62xYIonj-18" edge="1" parent="1" style="endArrow=classic;html=1;rounded=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" value="">
74
+ <mxGeometry height="50" relative="1" width="50" as="geometry">
75
+ <mxPoint x="479.65999999999997" y="600" as="sourcePoint" />
76
+ <mxPoint x="479.65999999999997" y="510" as="targetPoint" />
77
+ </mxGeometry>
78
+ </mxCell>
79
+ <mxCell id="tqax0Luh1uLb62xYIonj-19" edge="1" parent="1" style="endArrow=classic;html=1;rounded=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" value="">
80
+ <mxGeometry height="50" relative="1" width="50" as="geometry">
81
+ <mxPoint x="520" y="494.65647058823527" as="sourcePoint" />
82
+ <mxPoint x="640" y="494.65647058823527" as="targetPoint" />
83
+ </mxGeometry>
84
+ </mxCell>
85
+ <mxCell id="tqax0Luh1uLb62xYIonj-20" parent="1" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;strokeColor=light-dark(#000000,#FF66FF);" value="ProcessTriggerCache&lt;div&gt;PrepComparisData&lt;/div&gt;" vertex="1">
86
+ <mxGeometry height="104" width="104" x="640" y="443" as="geometry" />
87
+ </mxCell>
88
+ <mxCell id="tqax0Luh1uLb62xYIonj-21" edge="1" parent="1" style="endArrow=classic;html=1;rounded=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" target="tqax0Luh1uLb62xYIonj-22" value="">
89
+ <mxGeometry height="50" relative="1" width="50" as="geometry">
90
+ <mxPoint x="744" y="494.6464705882353" as="sourcePoint" />
91
+ <mxPoint x="864" y="494.6464705882353" as="targetPoint" />
92
+ </mxGeometry>
93
+ </mxCell>
94
+ <mxCell id="tqax0Luh1uLb62xYIonj-22" parent="1" style="ellipse;whiteSpace=wrap;html=1;aspect=fixed;strokeColor=light-dark(#000000,#FF66FF);" value="ProcessTriggerCache&lt;div&gt;PrepComparisData&lt;/div&gt;" vertex="1">
95
+ <mxGeometry height="104" width="104" x="864" y="443" as="geometry" />
96
+ </mxCell>
97
+ <mxCell id="tqax0Luh1uLb62xYIonj-24" edge="1" parent="1" source="tqax0Luh1uLb62xYIonj-22" style="endArrow=classic;html=1;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" value="">
98
+ <mxGeometry height="50" relative="1" width="50" as="geometry">
99
+ <mxPoint x="990" y="520" as="sourcePoint" />
100
+ <mxPoint x="1080" y="495" as="targetPoint" />
101
+ </mxGeometry>
102
+ </mxCell>
103
+ <mxCell id="tqax0Luh1uLb62xYIonj-25" edge="1" parent="1" style="endArrow=classic;html=1;rounded=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" target="tqax0Luh1uLb62xYIonj-26" value="">
104
+ <mxGeometry height="50" relative="1" width="50" as="geometry">
105
+ <mxPoint x="1180" y="480" as="sourcePoint" />
106
+ <mxPoint x="1150" y="410" as="targetPoint" />
107
+ </mxGeometry>
108
+ </mxCell>
109
+ <mxCell id="tqax0Luh1uLb62xYIonj-26" parent="1" style="rounded=1;whiteSpace=wrap;html=1;" value="มี" vertex="1">
110
+ <mxGeometry height="30" width="80" x="1140" y="360" as="geometry" />
111
+ </mxCell>
112
+ <mxCell id="tqax0Luh1uLb62xYIonj-27" edge="1" parent="1" source="tqax0Luh1uLb62xYIonj-26" style="endArrow=classic;html=1;rounded=0;exitX=0.5;exitY=0;exitDx=0;exitDy=0;entryX=0.75;entryY=0;entryDx=0;entryDy=0;entryPerimeter=0;" target="tqax0Luh1uLb62xYIonj-11" value="">
113
+ <mxGeometry height="50" relative="1" width="50" as="geometry">
114
+ <Array as="points">
115
+ <mxPoint x="1180" y="80" />
116
+ <mxPoint x="170" y="80" />
117
+ </Array>
118
+ <mxPoint x="860" y="240" as="sourcePoint" />
119
+ <mxPoint x="910" y="190" as="targetPoint" />
120
+ </mxGeometry>
121
+ </mxCell>
122
+ <mxCell id="tqax0Luh1uLb62xYIonj-28" edge="1" parent="1" style="endArrow=classic;html=1;rounded=0;" value="">
123
+ <mxGeometry height="50" relative="1" width="50" as="geometry">
124
+ <mxPoint x="1180" y="520" as="sourcePoint" />
125
+ <mxPoint x="1180" y="600" as="targetPoint" />
126
+ </mxGeometry>
127
+ </mxCell>
128
+ <mxCell id="tqax0Luh1uLb62xYIonj-29" parent="1" style="rounded=0;whiteSpace=wrap;html=1;fillColor=#60a917;fontColor=#ffffff;strokeColor=#2D7600;" value="&lt;div&gt;&lt;span style=&quot;font-size: 11px; white-space: nowrap; background-color: rgb(74, 137, 12);&quot;&gt;checkTriggerResetedV2&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;check&amp;nbsp;Timestamp Match&lt;span style=&quot;background-color: transparent; color: light-dark(rgb(255, 255, 255), rgb(18, 18, 18));&quot;&gt;&amp;nbsp;&lt;/span&gt;" vertex="1">
129
+ <mxGeometry height="60" width="200" x="1080" y="720" as="geometry" />
130
+ </mxCell>
131
+ <mxCell id="tqax0Luh1uLb62xYIonj-30" parent="1" style="rounded=1;whiteSpace=wrap;html=1;" value="ไม่มี" vertex="1">
132
+ <mxGeometry height="30" width="80" x="1140" y="600" as="geometry" />
133
+ </mxCell>
134
+ <mxCell id="tqax0Luh1uLb62xYIonj-31" edge="1" parent="1" source="tqax0Luh1uLb62xYIonj-30" style="endArrow=classic;html=1;rounded=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" value="">
135
+ <mxGeometry height="50" relative="1" width="50" as="geometry">
136
+ <mxPoint x="1179.41" y="640" as="sourcePoint" />
137
+ <mxPoint x="1179.4099999999999" y="720" as="targetPoint" />
138
+ </mxGeometry>
139
+ </mxCell>
140
+ <mxCell id="tqax0Luh1uLb62xYIonj-33" parent="1" style="rounded=1;whiteSpace=wrap;html=1;" value="match" vertex="1">
141
+ <mxGeometry height="30" width="80" x="1360" y="735" as="geometry" />
142
+ </mxCell>
143
+ <mxCell id="tqax0Luh1uLb62xYIonj-34" parent="1" style="rounded=1;whiteSpace=wrap;html=1;" value="not match" vertex="1">
144
+ <mxGeometry height="30" width="80" x="920" y="735" as="geometry" />
145
+ </mxCell>
146
+ <mxCell id="tqax0Luh1uLb62xYIonj-35" edge="1" parent="1" source="tqax0Luh1uLb62xYIonj-29" style="endArrow=classic;html=1;rounded=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" target="tqax0Luh1uLb62xYIonj-34" value="">
147
+ <mxGeometry height="50" relative="1" width="50" as="geometry">
148
+ <mxPoint x="1120" y="680" as="sourcePoint" />
149
+ <mxPoint x="1170" y="630" as="targetPoint" />
150
+ </mxGeometry>
151
+ </mxCell>
152
+ <mxCell id="tqax0Luh1uLb62xYIonj-36" edge="1" parent="1" source="tqax0Luh1uLb62xYIonj-29" style="endArrow=classic;html=1;rounded=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;" target="tqax0Luh1uLb62xYIonj-33" value="">
153
+ <mxGeometry height="50" relative="1" width="50" as="geometry">
154
+ <mxPoint x="1120" y="680" as="sourcePoint" />
155
+ <mxPoint x="1170" y="630" as="targetPoint" />
156
+ </mxGeometry>
157
+ </mxCell>
158
+ <mxCell id="tqax0Luh1uLb62xYIonj-37" edge="1" parent="1" source="tqax0Luh1uLb62xYIonj-34" style="endArrow=classic;html=1;rounded=0;entryX=0.5;entryY=1;entryDx=0;entryDy=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;" target="tqax0Luh1uLb62xYIonj-20" value="">
159
+ <mxGeometry height="50" relative="1" width="50" as="geometry">
160
+ <Array as="points">
161
+ <mxPoint x="690" y="750" />
162
+ </Array>
163
+ <mxPoint x="930" y="680" as="sourcePoint" />
164
+ <mxPoint x="980" y="630" as="targetPoint" />
165
+ </mxGeometry>
166
+ </mxCell>
167
+ <mxCell id="tqax0Luh1uLb62xYIonj-38" edge="1" parent="1" style="endArrow=classic;html=1;rounded=0;" value="">
168
+ <mxGeometry height="50" relative="1" width="50" as="geometry">
169
+ <mxPoint x="1440" y="750" as="sourcePoint" />
170
+ <mxPoint x="1560" y="750" as="targetPoint" />
171
+ </mxGeometry>
172
+ </mxCell>
173
+ <mxCell id="tqax0Luh1uLb62xYIonj-39" parent="1" style="shape=tape;whiteSpace=wrap;html=1;" value="PrepComparisData_Out" vertex="1">
174
+ <mxGeometry height="100" width="230" x="1560" y="690" as="geometry" />
175
+ </mxCell>
176
+ <mxCell id="tqax0Luh1uLb62xYIonj-40" edge="1" parent="1" source="tqax0Luh1uLb62xYIonj-11" style="endArrow=classic;html=1;rounded=0;exitX=0.25;exitY=1;exitDx=0;exitDy=0;exitPerimeter=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" target="tqax0Luh1uLb62xYIonj-12" value="">
177
+ <mxGeometry height="50" relative="1" width="50" as="geometry">
178
+ <Array as="points">
179
+ <mxPoint x="110" y="852" />
180
+ </Array>
181
+ <mxPoint x="780" y="680" as="sourcePoint" />
182
+ <mxPoint x="830" y="630" as="targetPoint" />
183
+ </mxGeometry>
184
+ </mxCell>
185
+ <mxCell id="tqax0Luh1uLb62xYIonj-41" connectable="0" parent="tqax0Luh1uLb62xYIonj-40" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" value="Sub to Out topic" vertex="1">
186
+ <mxGeometry relative="1" x="-0.6336" y="-2" as="geometry">
187
+ <mxPoint as="offset" />
188
+ </mxGeometry>
189
+ </mxCell>
190
+ </root>
191
+ </mxGraphModel>
192
+ </diagram>
193
+ </mxfile>
package/docs/test.mmd ADDED
@@ -0,0 +1,47 @@
1
+ flowchart TD
2
+ classDef process fill:#d4edda,stroke:#28a745,stroke-width:2px,color:#000;
3
+ classDef check fill:#fff3cd,stroke:#ffc107,stroke-width:2px,color:#000;
4
+ classDef complete fill:#cce5ff,stroke:#007bff,stroke-width:2px,color:#000;
5
+ classDef subflow fill:#e2e3e5,stroke:#6c757d,stroke-width:2px,color:#000;
6
+ classDef decision fill:#f8d7da,stroke:#dc3545,stroke-width:2px,color:#000;
7
+
8
+ Start((จุดเริ่มต้น)) --> ProcessMain
9
+
10
+ subgraph Process [1. Process Step]
11
+ ProcessMain["PrepComparisData_Main<br/>(Process Step)"]:::process
12
+ CheckReset{"checkTriggerResetedV2<br/>(Timestamp Match)"}:::decision
13
+ CheckCache{"checkTriggeredCacheV2<br/>(เช็คว่ามีงานย่อยต้องทำไหม?)"}:::decision
14
+ CreateReq["สร้าง request ไปที่ triggerFlow<br/>(ยิงงานย่อย)"]:::process
15
+
16
+ ProcessMain --> CheckReset
17
+ CheckReset -- "not match" --> ProcessMain
18
+ CheckReset -- "match" --> CheckCache
19
+ CheckCache -- "มีงาน" --> CreateReq
20
+ end
21
+
22
+ SubFlow["triggerFlow<br/>(งานย่อย)"]:::subflow
23
+
24
+ subgraph Check [2. Check Step]
25
+ SubOut["Sub to Out topic<br/>(รับ Message งานย่อยที่เสร็จ)"]:::check
26
+ CheckComplete["CheckTriggerCacheComplete<br/>(Check Step)"]:::check
27
+ CheckFlow{"checkTriggerFlowComplete<br/>AwaitingStepV2<br/>(ตรวจว่าทุกงานเสร็จหรือยัง?)"}:::decision
28
+
29
+ SubOut --> CheckComplete
30
+ CheckComplete --> CheckFlow
31
+ end
32
+
33
+ subgraph Complete [3. Complete Step]
34
+ OutMain["PrepComparisData_Out<br/>(Complete Step)"]:::complete
35
+ end
36
+
37
+ %% เส้นทางเชื่อมต่อระหว่างกลุ่ม
38
+ CreateReq -- "ส่งงาน" --> SubFlow
39
+ SubFlow -- "ทำงานเสร็จ ส่ง passBack" --> SubOut
40
+
41
+ CheckCache -- "ไม่มีงาน (ข้ามไปทำ Complete)" --> OutMain
42
+
43
+ CheckFlow -- "มีงานค้าง (รอตัวถัดไป)" --> Wait((รอ Message ถัดไป))
44
+ CheckFlow -- "ไม่มีงานค้าง (เสร็จหมด 100%)" --> OutMain
45
+
46
+ %% เส้นสีแดงสำหรับ Loop Not Match
47
+ linkStyle 1 stroke:#dc3545,stroke-width:2px
package/docs/test.png ADDED
Binary file
package/index.js CHANGED
@@ -16,17 +16,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
 
18
18
  import { generate } from './src/generate.js';
19
- import { generateCode } from './src/generateCode.js';
20
- import { generateSchema } from './src/generateSchema.js';
21
19
  import { generateIntTest } from './src/generateIntTest.js';
22
20
  import { generateResourceIntTest } from './src/generateResourceIntTest.js';
23
21
 
24
22
  export {
25
23
  // High-level API (recommended for consumers) — wires legacy Logger+validateLocalSchema
26
24
  generate,
27
- // Main generators (low-level)
28
- generateCode,
29
- generateSchema,
30
25
  // IntTest generators (Result-Driven: no createSource/libs dependencies)
31
26
  generateIntTest,
32
27
  generateResourceIntTest
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@izara_project/izara-core-generate-service-code",
3
- "version": "1.0.65",
3
+ "version": "1.0.67",
4
4
  "description": "Code for locally generating per service files",
5
5
  "homepage": "https://bitbucket.org/izara-core-support-services/izara-core-support-services-generate-service-code#readme",
6
6
  "repository": {
@@ -11,6 +11,7 @@
11
11
  "author": "Sven Mason <thebarbariansven@gmail.com>",
12
12
  "type": "module",
13
13
  "main": "index.js",
14
+ "exports": "./index.js",
14
15
  "scripts": {
15
16
  "test": "jest"
16
17
  },
@@ -19,9 +20,9 @@
19
20
  },
20
21
  "dependencies": {
21
22
  "@izara_project/izara-core-library-core": "^1.0.32",
22
- "@izara_project/izara-core-library-logger": "^1.0.9",
23
- "@izara_project/izara-shared-core": "^1.0.12",
24
- "ejs": "^5.0.1",
23
+ "@izara_project/izara-core-library-logger": "^1.0.11",
24
+ "@izara_project/izara-shared-core": "^1.0.13",
25
+ "ejs": "^6.0.1",
25
26
  "js-beautify": "^2.0.3",
26
27
  "yaml": "^2.9.0",
27
28
  "@izara_project/izara-property-nodes": "^1.0.16",
@@ -32,8 +33,8 @@
32
33
  "@izara_project/izara-shared-service-schemas": "^1.0.65"
33
34
  },
34
35
  "devDependencies": {
35
- "@izara_project/izara-core-library-service-schemas": "^1.0.157",
36
- "@izara_project/izara-shared-service-schemas": "^1.0.65",
36
+ "@izara_project/izara-core-library-service-schemas": "1.0.158",
37
+ "@izara_project/izara-shared-service-schemas": "^1.0.66",
37
38
  "jest": "^30.4.2"
38
39
  }
39
40
  }
@@ -0,0 +1,26 @@
1
+ import { join, resolve } from 'node:path';
2
+
3
+ export function compileProject(request = {}) {
4
+ if (!isNonEmptyString(request.rootPath)) {
5
+ throw new TypeError('GenerationRequest.rootPath must be a non-empty string');
6
+ }
7
+
8
+ const rootPath = resolve(request.rootPath);
9
+ const outputPath = resolve(request.outputPath ?? rootPath);
10
+ const configPath = resolve(
11
+ request.configPath ?? join(rootPath, 'config', 'serverless.config.yml')
12
+ );
13
+
14
+ return Object.freeze({
15
+ rootPath,
16
+ outputPath,
17
+ configPath,
18
+ schemaRoot: join(rootPath, 'app', 'src', 'schemas'),
19
+ serviceTag: request.serviceTag,
20
+ schemaTemplateConfig: request.schemaTemplateConfig ?? []
21
+ });
22
+ }
23
+
24
+ function isNonEmptyString(value) {
25
+ return typeof value === 'string' && value.trim() !== '';
26
+ }
@@ -0,0 +1,50 @@
1
+ import { readdir, stat } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ import { pathToFileURL } from 'node:url';
4
+ import { utils } from '@izara_project/izara-core-library-service-schemas';
5
+
6
+ export async function loadLocalSchemaDirectory(project, directoryName) {
7
+ const directoryPath = join(project.schemaRoot, directoryName);
8
+ let entries;
9
+ try {
10
+ entries = await readdir(directoryPath, { withFileTypes: true });
11
+ } catch (error) {
12
+ if (error.code === 'ENOENT') {
13
+ return [];
14
+ }
15
+ throw error;
16
+ }
17
+
18
+ const schemas = [];
19
+ for (const entry of entries.filter(entry => entry.isFile() && entry.name.endsWith('.js')).sort((a, b) => a.name.localeCompare(b.name))) {
20
+ const filePath = join(directoryPath, entry.name);
21
+ const details = await stat(filePath);
22
+ const module = await import(`${pathToFileURL(filePath).href}?schemaVersion=${details.mtimeMs}-${details.size}`);
23
+ if (!module.default || typeof module.default !== 'object') {
24
+ throw new TypeError(`Schema module must default-export an object or array: ${filePath}`);
25
+ }
26
+ const loadedSchemas = Array.isArray(module.default) ? module.default : [module.default];
27
+
28
+ if (process.env.NODE_ENV !== 'test') {
29
+ for (const schema of loadedSchemas) {
30
+ let status = true;
31
+ let errors = [];
32
+
33
+ if (directoryName === 'ObjectSchemas') {
34
+ [status, errors] = utils.validateBasicObjectSchema({}, schema);
35
+ } else if (directoryName === 'RelationshipSchemas') {
36
+ [status, errors] = utils.validateRelationshipSchema({}, schema);
37
+ } else if (directoryName === 'FlowSchemas') {
38
+ [status, errors] = utils.validateBasicFlowSchema({}, schema);
39
+ }
40
+
41
+ if (!status) {
42
+ throw new Error(`Schema validation failed for ${entry.name}:\n${errors.join('\n')}`);
43
+ }
44
+ }
45
+ }
46
+
47
+ schemas.push(...loadedSchemas);
48
+ }
49
+ return schemas;
50
+ }
@@ -0,0 +1,11 @@
1
+ export function renderDynamicCrudFlowSchema(action, flow) {
2
+ return [
3
+ '/**',
4
+ ' * GENERATED DYNAMIC FLOW SCHEMA',
5
+ ` * Action: ${action}`,
6
+ ' * Description: Handles dynamic CRUD for all allowed ObjectTypes via SQS/DSQ',
7
+ ' */',
8
+ `export default ${JSON.stringify(flow, null, 2)};`,
9
+ ''
10
+ ].join('\n');
11
+ }