@izara_project/izara-core-generate-service-code 1.0.65 → 1.0.66
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.
- package/README.md +73 -11
- package/index.js +0 -5
- package/package.json +7 -6
- package/src/compile/compileProject.js +26 -0
- package/src/compile/loadSchemas.js +28 -0
- package/src/emit/crud/dynamicCrudFlowSchemaTemplate.js +11 -0
- package/src/emit/crud/emitCrudApplicationArtifacts.js +157 -0
- package/src/emit/crud/emitDynamicCrudFlowSchemas.js +84 -0
- package/src/emit/crud/generateCrudApplicationArtifacts.js +16 -0
- package/src/emit/crud/generateDynamicCrudFlowSchemas.js +21 -0
- package/src/emit/crud/loadLocalSchemaArrays.js +8 -0
- package/src/{codeGenerators/app/src/generatedCode/Flow/FlowObjects/templates/crud → emit/crud/templates}/CreateEndpoint_Main.ejs +1 -1
- package/src/{codeGenerators/app/src/generatedCode/Flow/FlowObjects/templates/crud → emit/crud/templates}/DeleteEndpoint_Main.ejs +1 -1
- package/src/{codeGenerators/app/src/generatedCode/Flow/FlowObjects/templates/step → emit/crud/templates}/FlowEndpointBeforeLogical_Main.ejs +2 -2
- package/src/emit/crud/templates/FlowEndpointComplete_Main.ejs +75 -0
- package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/endpoint → emit/crud/templates}/FlowEndpoint_HdrWbs.ejs +1 -1
- package/src/{codeGenerators/app/src/generatedCode/ProcessLogical/templates/ProcessLogical_HdrSqs.ejs → emit/crud/templates/FlowHandler_HdrSqs.ejs} +52 -56
- package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/endpoint → emit/crud/templates}/FlowMain_Wbs.ejs +1 -3
- package/src/emit/crud/templates/GetRangeEndpoint_Main.ejs +127 -0
- package/src/{codeGenerators/app/src/generatedCode/Flow/FlowObjects/templates/crud → emit/crud/templates}/UpdateEndpoint_Main.ejs +1 -1
- package/src/emit/custom/customFlows.js +70 -0
- package/src/emit/custom/emitCustomFlowApplicationArtifacts.js +308 -0
- package/src/emit/custom/generateCustomFlowApplicationArtifacts.js +22 -0
- package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/endpoint → emit/custom/templates}/FlowEndpoint_Main.ejs +1 -1
- package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/step → emit/custom/templates}/FlowStep_Main.ejs +1 -1
- package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas → emit/custom}/templates/s3/ConfirmReserved_Main.ejs +5 -5
- package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas → emit/custom}/templates/s3/CreateObject_HdrWbs.ejs +1 -1
- package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas → emit/custom}/templates/s3/CreateObject_Main.ejs +3 -3
- package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas → emit/custom}/templates/s3/CreatePreSignUrl_Main.ejs +4 -5
- package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas → emit/custom}/templates/s3/FlowHandler_HdrS3.ejs +2 -8
- package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas → emit/custom}/templates/s3/ProcessS3File_Main.ejs +1 -1
- package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas → emit/custom}/templates/s3/ReservedLimit_Main.ejs +5 -6
- package/src/emit/custom/templates/triggerCache/CheckTriggerCache_HdrSqs.ejs +32 -0
- package/src/emit/custom/templates/triggerCache/CheckTriggerCache_Main.ejs +63 -0
- package/src/emit/custom/templates/triggerCache/TriggerCacheComplete_Main.ejs +35 -0
- package/src/emit/custom/templates/triggerCache/TriggerCache_Main.ejs +16 -0
- package/src/emit/function/functionYamlArtifact.js +111 -0
- package/src/emit/rbac/emitDynamicRbacFlowSchemas.js +117 -0
- package/src/emit/rbac/emitRbacApplicationArtifacts.js +256 -0
- package/src/emit/rbac/generateCreateTargetRoleHandler.js +19 -0
- package/src/emit/rbac/generateDynamicRbacFlowSchemas.js +21 -0
- package/src/emit/rbac/rbacFlowTag.js +7 -0
- package/src/emit/rbac/templates/CreateTargetRole_HdrSqs.ejs +24 -0
- package/src/emit/rbac/templates/CreateTargetRole_Main.ejs +25 -0
- package/src/emit/rbac/templates/DynamicRbacFlowSchema.ejs +5 -0
- package/src/emit/rbac/templates/ListRbac_HdrApi.ejs +17 -0
- package/src/emit/rbac/templates/ListRbac_HdrSqs.ejs +13 -0
- package/src/emit/rbac/templates/ListRbac_Main.ejs +29 -0
- package/src/emit/rbac/templates/RbacMutation_Main.ejs +22 -0
- package/src/emit/rbac/templates/UserRbacFlow_HdrInv.ejs +10 -0
- package/src/emit/rbac/templates/UserRbacFlow_Main.ejs +44 -0
- package/src/emit/rbac/templates/UserRoleMutation_Main.ejs +33 -0
- package/src/emit/relationship/dynamicRelationshipFlowSchemaTemplate.js +11 -0
- package/src/emit/relationship/emitDynamicRelationshipFlowSchemas.js +66 -0
- package/src/emit/relationship/emitRelationshipApplicationArtifacts.js +147 -0
- package/src/emit/relationship/generateDynamicRelationshipFlowSchemas.js +23 -0
- package/src/emit/relationship/generateRelationshipApplicationArtifacts.js +22 -0
- package/src/{codeGenerators/app/src/generatedCode/Flow/FlowRelationships/templates/relationship/ProcessChangeRelationshipComplete_Main.ejs → emit/relationship/templates/ChangeRelationshipComplete_Main.ejs} +1 -1
- package/src/{codeGenerators/app/src/generatedCode/Flow/FlowRelationships/templates/relationship/ProcessChangeRelationship_Main.ejs → emit/relationship/templates/ChangeRelationship_Main.ejs} +10 -2
- package/src/{codeGenerators/app/src/generatedCode/Flow/FlowRelationships/templates/relationship/ProcessCreateRelationshipComplete_Main.ejs → emit/relationship/templates/CreateRelationshipComplete_Main.ejs} +1 -1
- package/src/{codeGenerators/app/src/generatedCode/Flow/FlowRelationships/templates/relationship/ProcessCreateRelationship_Main.ejs → emit/relationship/templates/CreateRelationship_Main.ejs} +1 -1
- package/src/{codeGenerators/app/src/generatedCode/Flow/FlowRelationships/templates/relationship/ProcessDeleteRelationshipComplete_Main.ejs → emit/relationship/templates/DeleteRelationshipComplete_Main.ejs} +1 -1
- package/src/{codeGenerators/app/src/generatedCode/Flow/FlowRelationships/templates/relationship/ProcessDeleteRelationship_Main.ejs → emit/relationship/templates/DeleteRelationship_Main.ejs} +1 -1
- package/src/emit/relationship/templates/FlowHandler_HdrApi.ejs +51 -0
- package/src/{codeGenerators/app/src/generatedCode/Flow/_shared/handlers → emit/relationship/templates}/FlowHandler_HdrDsq.ejs +1 -1
- package/src/emit/relationship/templates/FlowHandler_HdrInv.ejs +45 -0
- package/src/{codeGenerators/app/src/generatedCode/Flow/FlowRelationships/templates/relationship/ProcessGetRelationshipComplete_Main.ejs → emit/relationship/templates/GetRelationshipComplete_Main.ejs} +1 -1
- package/src/{codeGenerators/app/src/generatedCode/Flow/FlowRelationships/templates/relationship/ProcessGetRelationship_Main.ejs → emit/relationship/templates/GetRelationship_Main.ejs} +1 -1
- package/src/{codeGenerators/app/src/generatedCode/Flow/FlowRelationships/templates/relationship/ProcessMoveRelationship_Main.ejs → emit/relationship/templates/MoveRelationship_Main.ejs} +9 -1
- package/src/{codeGenerators/app/src/generatedCode/Flow/FlowRelationships/templates/relationship/ProcessUpdateRelationshipComplete_Main.ejs → emit/relationship/templates/UpdateRelationshipComplete_Main.ejs} +1 -1
- package/src/{codeGenerators/app/src/generatedCode/Flow/FlowRelationships/templates/relationship/ProcessUpdateRelationship_Main.ejs → emit/relationship/templates/UpdateRelationship_Main.ejs} +1 -1
- package/src/emit/resource/emitResourceArtifacts.js +300 -0
- package/src/emit/resource/generateResourceArtifacts.js +20 -0
- package/src/{codeGenerators/resource/sls_yaml/templates/crud → emit/resource/templates}/ResourceBeforeLogicalYaml.ejs +1 -1
- package/src/{codeGenerators/resource/sls_yaml/templates/crud → emit/resource/templates}/ResourceSqsYaml.ejs +6 -6
- package/src/{codeGenerators/app/sls_yaml → emit/resource}/templates/SharedResource_Yaml.ejs +8 -8
- package/src/emit/system/emitSystemWebSocketArtifacts.js +182 -0
- package/src/generate.js +60 -126
- package/src/output/commitArtifacts.js +213 -0
- package/src/output/mergeHooks.js +55 -0
- package/src/output/validateArtifacts.js +62 -0
- package/src/plan/buildGenerationPlan.js +50 -0
- package/test/core.test.js +159 -0
- package/test/createTargetRoleHandler.test.js +68 -0
- package/test/crudApplicationArtifacts.test.js +107 -0
- package/test/customFlowApplicationArtifacts.test.js +294 -0
- package/test/dynamicCrudFlowSchemas.test.js +136 -0
- package/test/dynamicRbacFlowSchemas.test.js +101 -0
- package/test/dynamicRelationshipFlowSchemas.test.js +99 -0
- package/test/functionYamlArtifact.test.js +34 -0
- package/test/intTestApi.test.js +29 -0
- package/test/publicApi.test.js +209 -0
- package/test/relationshipApplicationArtifacts.test.js +68 -0
- package/test/resourceArtifacts.test.js +121 -0
- package/jsconfig.json +0 -9
- package/src/__tests__/getIntTestConfig.test.js +0 -51
- package/src/__tests__/intTestGeneratorShared.test.cjs +0 -169
- package/src/__tests__/pathIntTest.test.js +0 -103
- package/src/codeGenerators/app/initial_setup/InitialSetupGenerator.js +0 -199
- package/src/codeGenerators/app/initial_setup/templates/InitialSetup_LambdaRole.ejs +0 -50
- package/src/codeGenerators/app/initial_setup/templates/InitialSetup_SnsService.ejs +0 -15
- package/src/codeGenerators/app/initial_setup/templates/InitialSetup_TableName.ejs +0 -9
- package/src/codeGenerators/app/sls_yaml/FindDataYamlGenerator.js +0 -23
- package/src/codeGenerators/app/sls_yaml/FunctionYamlGenerator.js +0 -332
- package/src/codeGenerators/app/sls_yaml/ProcessLogicalYamlGenerator.js +0 -21
- package/src/codeGenerators/app/sls_yaml/RoleNameConfigGenerator.js +0 -48
- package/src/codeGenerators/app/sls_yaml/SharedResourceYamlGenerator.js +0 -503
- package/src/codeGenerators/app/sls_yaml/__tests__/SharedResourceYamlGenerator.test.js +0 -235
- package/src/codeGenerators/app/sls_yaml/_policy/PolicyRegistry.js +0 -56
- package/src/codeGenerators/app/sls_yaml/_policy/__tests__/PolicyRegistry.test.js +0 -33
- package/src/codeGenerators/app/sls_yaml/renderYamlTemplate.js +0 -13
- package/src/codeGenerators/app/sls_yaml/templates/FindData_Yaml.ejs +0 -10
- package/src/codeGenerators/app/sls_yaml/templates/FunctionYaml_Api.ejs +0 -21
- package/src/codeGenerators/app/sls_yaml/templates/FunctionYaml_EventBridge.ejs +0 -14
- package/src/codeGenerators/app/sls_yaml/templates/FunctionYaml_Inv.ejs +0 -6
- package/src/codeGenerators/app/sls_yaml/templates/FunctionYaml_Sqs.ejs +0 -11
- package/src/codeGenerators/app/sls_yaml/templates/FunctionYaml_Wbs.ejs +0 -11
- package/src/codeGenerators/app/sls_yaml/templates/ProcessLogical_Yaml.ejs +0 -32
- package/src/codeGenerators/app/sls_yaml/templates/RoleNameConfig_Yaml.ejs +0 -5
- package/src/codeGenerators/app/src/generatedCode/FindData/FindDataGenerator.js +0 -238
- package/src/codeGenerators/app/src/generatedCode/FindData/templates/FindData_HdrSqs.ejs +0 -87
- package/src/codeGenerators/app/src/generatedCode/FindData/templates/FindData_Main.ejs +0 -108
- package/src/codeGenerators/app/src/generatedCode/FindData/templates/GetByStorage/getByDynamo.ejs +0 -32
- package/src/codeGenerators/app/src/generatedCode/FindData/templates/GetByStorage/getByGraph.ejs +0 -87
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowObjects/.gitkeep +0 -0
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowObjects/EndpointsGenerator.js +0 -120
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowObjects/templates/step/FlowEndpointComplete_Main.ejs +0 -313
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowRbac/RbacFlowGenerator.js +0 -116
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowRbac/templates/rbac/CreateRolePermissions.ejs +0 -135
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowRbac/templates/rbac/CreateTargetRole.ejs +0 -131
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowRbac/templates/rbac/CreateUserRole.ejs +0 -150
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowRbac/templates/rbac/DeleteRolePermissions.ejs +0 -132
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowRbac/templates/rbac/DeleteTargetRole.ejs +0 -132
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowRbac/templates/rbac/DeleteUserFromRole.ejs +0 -150
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowRbac/templates/rbac/FlowRbac_Main.ejs +0 -252
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowRbac/templates/rbac/ListRolePermissions.ejs +0 -120
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowRbac/templates/rbac/ListTargetRole.ejs +0 -122
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowRbac/templates/rbac/ListUserInRoles.ejs +0 -117
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowRelationships/RelationshipFlowGenerator.js +0 -148
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/.gitkeep +0 -0
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/StatusFieldGenerator.js +0 -109
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/WebSocketGenerator.js +0 -122
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/endpoint/FlowEntryPoint_Main.ejs +0 -38
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/statusField/CompleteStatusFieldSns_Yaml.ejs +0 -52
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/statusField/CompleteStatusField_HdrSqs.ejs +0 -84
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/statusField/CompleteStatusField_Main.ejs +0 -78
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/step/plugIns/FlowStep_ByConfig_Awaiting_Main.ejs +0 -123
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/step/plugIns/FlowStep_ByConfig_Paginated_Main.ejs +0 -59
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/step/plugIns/FlowStep_PlugIn_Main.ejs +0 -72
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/step/plugIns/FlowStep_RecievePlugIn_Main.ejs +0 -76
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/step/plugIns/templateAwaitingStep.ejs +0 -41
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/step/plugIns/templateSendPlugin.ejs +0 -18
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/webSocket/ProcessWebSocketFlow_Yaml.ejs +0 -26
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/webSocket/ProcessWebSocketSub_Yaml.ejs +0 -7
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/webSocket/ProcessWebSocket_HdrSqs.ejs +0 -66
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/webSocket/ProcessWebSocket_Main.ejs +0 -115
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/webSocket/ProcessWebSocket_Yaml.ejs +0 -36
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/webSocket/WebSocketConnect_Main.ejs +0 -52
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/webSocket/WebSocketConnect_Yaml.ejs +0 -13
- package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/webSocket/WebSocketDynamoDb_Yaml.ejs +0 -28
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/BaseDsqHandler.js +0 -63
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/BaseSqsHandler.js +0 -66
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/__tests__/BaseDsqHandler.test.js +0 -94
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/dsq.js +0 -5
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/eventBridge.js +0 -33
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/extTopic.js +0 -6
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/lambdaSyncApi.js +0 -51
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/lambdaSyncInv.js +0 -51
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/ownTopic.js +0 -54
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/registry.js +0 -17
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/s3.js +0 -56
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/s3Components/ConfirmAfterUploadS3Generator.js +0 -46
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/s3Components/CreateObjectGenerator.js +0 -50
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/s3Components/CreatePreSignUrlGenerator.js +0 -48
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/s3Components/ProcessAfterUploadS3Generator.js +0 -49
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/events/s3Components/ReservedLimitGenerator.js +0 -47
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/eventTypes.js +0 -23
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/flowClassifier.js +0 -50
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/flowEntryPointBase.js +0 -106
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/flowMainFunctionBase.js +0 -172
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/flowNaming.js +0 -37
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/flowSelection.js +0 -19
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/flowStepBase.js +0 -235
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/flowStepNormalizer.js +0 -75
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/flowValidator.js +0 -267
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/propertyNormalizer.js +0 -18
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/registry.js +0 -7
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/roleNameDetection.js +0 -49
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/triggerCacheBase.js +0 -177
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/triggerCache/CheckTriggerCache_HdrSqs.ejs +0 -89
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/triggerCache/CheckTriggerCache_Main.ejs +0 -83
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/triggerCache/ProcessTriggerCache_HdrSqs.ejs +0 -103
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/triggerCache/ProcessTriggerCache_Main.ejs +0 -58
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/triggerCache/TriggerCacheComplete_HdrDsq.ejs +0 -104
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/triggerCache/TriggerCacheComplete_HdrSqs.ejs +0 -88
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/triggerCache/TriggerCacheComplete_Main.ejs +0 -80
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/triggerCache/TriggerCacheQueue_Yaml.ejs +0 -36
- package/src/codeGenerators/app/src/generatedCode/Flow/_shared/yaml/SharedFunctionSqs_Yaml.ejs +0 -13
- package/src/codeGenerators/app/src/generatedCode/ProcessLogical/ProcessLogicalGenerator.js +0 -29
- package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/PaginateProcessLogical_HdrDsq.ejs +0 -177
- package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/PaginateProcessLogical_HdrSqs.ejs +0 -155
- package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/PaginateProcessLogical_Main.ejs +0 -268
- package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/ProcessLogical_Main.ejs +0 -450
- package/src/codeGenerators/app/src/generatedCode/SystemFlowSchemas/RegisterGenerator.js +0 -149
- package/src/codeGenerators/app/src/generatedCode/SystemFlowSchemas/templates/register/RegisterComplete_HdrSqs.ejs +0 -85
- package/src/codeGenerators/app/src/generatedCode/SystemFlowSchemas/templates/register/RegisterComplete_Main.ejs +0 -176
- package/src/codeGenerators/app/src/generatedCode/SystemFlowSchemas/templates/register/Register_HdrWbs.ejs +0 -80
- package/src/codeGenerators/app/src/generatedCode/SystemFlowSchemas/templates/register/Register_Main.ejs +0 -164
- package/src/codeGenerators/app/src/generatedCode/libs/ConstsGenerator.js +0 -28
- package/src/codeGenerators/app/src/generatedCode/libs/GenerateCodeLibsGenerator.js +0 -28
- package/src/codeGenerators/app/src/generatedCode/libs/templates/Consts.ejs +0 -448
- package/src/codeGenerators/app/src/generatedCode/libs/templates/GenerateCodeLibs.ejs +0 -124
- package/src/codeGenerators/resource/sls_yaml/DynamoDBGenerator.js +0 -87
- package/src/codeGenerators/resource/sls_yaml/FlowOutGenerator.js +0 -70
- package/src/codeGenerators/resource/sls_yaml/FlowResourceYamlGenerator.js +0 -182
- package/src/core/renderTemplateFile.js +0 -22
- package/src/core/validate.js +0 -165
- package/src/generateCode.js +0 -357
- package/src/generateSchema.js +0 -123
- package/src/parsers/flowSchemaParser.js +0 -112
- package/src/parsers/objectSchemaParser.js +0 -39
- package/src/parsers/relationshipSchemaParser.js +0 -51
- package/src/schemaGenerators/app/src/schemas/FlowSchemas/FlowSchemaGenerator.js +0 -107
- package/src/schemaGenerators/app/src/schemas/FlowSchemas/RbacFlowSchemaGenerator.js +0 -98
- package/src/schemaGenerators/app/src/schemas/FlowSchemas/RelationshipFlowSchemaGenerator.js +0 -89
- package/src/schemaGenerators/app/src/schemas/FlowSchemas/templates/DynamicFlowSchemaTemplate.ejs +0 -41
- package/src/schemaGenerators/app/src/schemas/FlowSchemas/templates/DynamicRbacFlowSchemaTemplate.ejs +0 -20
- package/src/schemaGenerators/app/src/schemas/FlowSchemas/templates/RelationshipFlowSchemaTemplate.ejs +0 -33
- package/src/schemaGenerators/app/src/schemas/FlowSchemas/templates/UserRbacFlowSchemaTemplate.ejs +0 -22
- package/src/schemaGenerators/app/src/schemas/ObjectSchemas/AttributeTreeSchemaGenerator.js +0 -124
- package/src/schemaGenerators/app/src/schemas/ObjectSchemas/PropertyValueSchemaGenerator.js +0 -119
- package/src/schemaGenerators/app/src/schemas/ObjectSchemas/templates/DynamicAttributeTreeManagerSchemaTemplate.ejs +0 -14
- package/src/schemaGenerators/app/src/schemas/ObjectSchemas/templates/DynamicAttributeTreeStandardSchemaTemplate.ejs +0 -13
- package/src/schemaGenerators/app/src/schemas/ObjectSchemas/templates/DynamicPropertyValueSchemaTemplate.ejs +0 -15
- package/src/schemaGenerators/app/src/schemas/RelationshipSchemas/AttributeTreeRelationshipSchemaGenerator.js +0 -109
- package/src/schemaGenerators/app/src/schemas/RelationshipSchemas/PropertyValueRelationshipSchemaGenerator.js +0 -103
- package/src/schemaGenerators/app/src/schemas/RelationshipSchemas/__tests__/relationshipSchemaHelpers.test.js +0 -38
- package/src/schemaGenerators/app/src/schemas/RelationshipSchemas/relationshipSchemaHelpers.js +0 -40
- package/src/schemaGenerators/app/src/schemas/RelationshipSchemas/templates/DynamicAttributeTreeRelationshipSchemaTemplate.ejs +0 -7
- package/src/schemaGenerators/app/src/schemas/RelationshipSchemas/templates/DynamicPropertyValueRelationshipSchemaTemplate.ejs +0 -7
- package/src/schemaGenerators/app/src/schemas/SystemTextSchemas/SystemTextGenerator.js +0 -102
- package/src/schemaGenerators/app/src/schemas/SystemTextSchemas/templates/SystemText_Template.ejs +0 -10
- /package/src/{codeGenerators/app/src/generatedCode/Flow/_shared/handlers → emit/crud/templates}/FlowHandler_HdrApi.ejs +0 -0
- /package/src/{codeGenerators/app/src/generatedCode/Flow/_shared/handlers → emit/crud/templates}/FlowHandler_HdrInv.ejs +0 -0
- /package/src/{codeGenerators/app/src/generatedCode/Flow/FlowObjects/templates/crud → emit/crud/templates}/GetEndpoint_Main.ejs +0 -0
- /package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas → emit/custom}/templates/s3/ConfirmReserved_HdrSqs.ejs +0 -0
- /package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas → emit/custom}/templates/s3/CreatePreSignUrl_HdrSqs.ejs +0 -0
- /package/src/{codeGenerators/app/src/generatedCode/Flow/FlowSchemas → emit/custom}/templates/s3/ReservedLimit_HdrSqs.ejs +0 -0
- /package/src/{codeGenerators/app/src/generatedCode/Flow/_shared/handlers → emit/relationship/templates}/FlowHandler_HdrSqs.ejs +0 -0
- /package/src/{codeGenerators/app/src/generatedCode/Flow/FlowRelationships/templates/relationship/ProcessMoveRelationshipComplete_Main.ejs → emit/relationship/templates/MoveRelationshipComplete_Main.ejs} +0 -0
- /package/src/{codeGenerators/resource/sls_yaml → emit/resource}/templates/DynamoDBTable_Yaml.ejs +0 -0
- /package/src/{codeGenerators/resource/sls_yaml → emit/resource}/templates/FlowOut_Yaml.ejs +0 -0
- /package/src/{codeGenerators/resource/sls_yaml/templates/crud → emit/resource/templates}/ResourceYaml.ejs +0 -0
- /package/src/{codeGenerators/resource/sls_yaml → emit/resource}/templates/SystemDynamoDB_Yaml.ejs +0 -0
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import ejs from 'ejs';
|
|
2
|
-
import fs from 'fs/promises';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { fileURLToPath } from 'url';
|
|
5
|
-
|
|
6
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
-
const __dirname = path.dirname(__filename);
|
|
8
|
-
const upperCase = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
9
|
-
|
|
10
|
-
export default async function generateCreateObject(flow, flowOutputDir) {
|
|
11
|
-
const upperCaseFlowTag = upperCase(flow.flowTag);
|
|
12
|
-
const functionName = `${flow.flowTag}CreateObject`;
|
|
13
|
-
const handlerType = `HdrWbs`;
|
|
14
|
-
|
|
15
|
-
const mainFileName = `${functionName}_Main`;
|
|
16
|
-
const handlerFileName = `${functionName}_${handlerType}`;
|
|
17
|
-
|
|
18
|
-
const mainTemplatePath = path.join(
|
|
19
|
-
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3', 'CreateObject_Main.ejs'
|
|
20
|
-
);
|
|
21
|
-
const handlerTemplatePath = path.join(
|
|
22
|
-
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3', 'CreateObject_HdrWbs.ejs'
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
let mainTemplateStr, handlerTemplateStr;
|
|
26
|
-
try {
|
|
27
|
-
mainTemplateStr = await fs.readFile(mainTemplatePath, 'utf-8');
|
|
28
|
-
handlerTemplateStr = await fs.readFile(handlerTemplatePath, 'utf-8');
|
|
29
|
-
} catch (err) {
|
|
30
|
-
throw new Error(`[CreateObjectGenerator] Failed to load template: ${err.message}`);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const mainContent = ejs.render(mainTemplateStr, {
|
|
34
|
-
flowTag: flow.flowTag,
|
|
35
|
-
objectType: flow.objType.objectType,
|
|
36
|
-
functionName: functionName
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
const handlerContent = ejs.render(handlerTemplateStr, {
|
|
40
|
-
functionName,
|
|
41
|
-
handlerType,
|
|
42
|
-
route: flow.flowTag
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
const targetMainPath = path.join(flowOutputDir, `${mainFileName}.js`);
|
|
46
|
-
await fs.writeFile(targetMainPath, mainContent, 'utf-8');
|
|
47
|
-
|
|
48
|
-
const targetHandlerPath = path.join(flowOutputDir, `${handlerFileName}.js`);
|
|
49
|
-
await fs.writeFile(targetHandlerPath, handlerContent, 'utf-8');
|
|
50
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import ejs from 'ejs';
|
|
2
|
-
import fs from 'fs/promises';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { fileURLToPath } from 'url';
|
|
5
|
-
|
|
6
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
-
const __dirname = path.dirname(__filename);
|
|
8
|
-
const upperCase = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
9
|
-
|
|
10
|
-
export default async function generateCreatePreSignUrl(flow, flowOutputDir) {
|
|
11
|
-
const functionName = `${flow.flowTag}CreatePreSignUrl`;
|
|
12
|
-
const handlerType = `HdrSqs`;
|
|
13
|
-
|
|
14
|
-
const mainFileName = `${functionName}_Main`;
|
|
15
|
-
const handlerFileName = `${functionName}_${handlerType}`;
|
|
16
|
-
|
|
17
|
-
const mainTemplatePath = path.join(
|
|
18
|
-
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3', 'CreatePreSignUrl_Main.ejs'
|
|
19
|
-
);
|
|
20
|
-
const handlerTemplatePath = path.join(
|
|
21
|
-
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3', 'CreatePreSignUrl_HdrSqs.ejs'
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
let mainTemplateStr, handlerTemplateStr;
|
|
25
|
-
try {
|
|
26
|
-
mainTemplateStr = await fs.readFile(mainTemplatePath, 'utf-8');
|
|
27
|
-
handlerTemplateStr = await fs.readFile(handlerTemplatePath, 'utf-8');
|
|
28
|
-
} catch (err) {
|
|
29
|
-
throw new Error(`[CreatePreSignUrlGenerator] Failed to load template: ${err.message}`);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const mainContent = ejs.render(mainTemplateStr, {
|
|
33
|
-
bucketName: flow.bucketName,
|
|
34
|
-
flowTag: flow.flowTag,
|
|
35
|
-
functionName: functionName
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const handlerContent = ejs.render(handlerTemplateStr, {
|
|
39
|
-
functionName,
|
|
40
|
-
handlerType
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
const targetMainPath = path.join(flowOutputDir, `${mainFileName}.js`);
|
|
44
|
-
await fs.writeFile(targetMainPath, mainContent, 'utf-8');
|
|
45
|
-
|
|
46
|
-
const targetHandlerPath = path.join(flowOutputDir, `${handlerFileName}.js`);
|
|
47
|
-
await fs.writeFile(targetHandlerPath, handlerContent, 'utf-8');
|
|
48
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import ejs from 'ejs';
|
|
2
|
-
import fs from 'fs/promises';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { fileURLToPath } from 'url';
|
|
5
|
-
|
|
6
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
-
const __dirname = path.dirname(__filename);
|
|
8
|
-
const upperCase = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
9
|
-
|
|
10
|
-
export default async function generateProcessAfterUploadS3(flow, flowOutputDir) {
|
|
11
|
-
const functionName = `${flow.flowTag}ProcessAfterUpload`;
|
|
12
|
-
const handlerType = `HdrS3`;
|
|
13
|
-
|
|
14
|
-
const mainFileName = `${functionName}_Main`;
|
|
15
|
-
const handlerFileName = `${functionName}_${handlerType}`;
|
|
16
|
-
|
|
17
|
-
const mainTemplatePath = path.join(
|
|
18
|
-
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3', 'ProcessS3File_Main.ejs'
|
|
19
|
-
);
|
|
20
|
-
const handlerTemplatePath = path.join(
|
|
21
|
-
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3', 'FlowHandler_HdrS3.ejs'
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
let mainTemplateStr, handlerTemplateStr;
|
|
25
|
-
try {
|
|
26
|
-
mainTemplateStr = await fs.readFile(mainTemplatePath, 'utf-8');
|
|
27
|
-
handlerTemplateStr = await fs.readFile(handlerTemplatePath, 'utf-8');
|
|
28
|
-
} catch (err) {
|
|
29
|
-
throw new Error(`[ProcessAfterUploadS3Generator] Failed to load template: ${err.message}`);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const mainContent = ejs.render(mainTemplateStr, {
|
|
33
|
-
flowTag: flow.flowTag,
|
|
34
|
-
functionName: functionName
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const handlerContent = ejs.render(handlerTemplateStr, {
|
|
38
|
-
flowTag: flow.flowTag,
|
|
39
|
-
functionName: functionName,
|
|
40
|
-
mainFileName,
|
|
41
|
-
s3Bucket: flow.bucketName || ''
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
const targetMainPath = path.join(flowOutputDir, `${mainFileName}.js`);
|
|
45
|
-
await fs.writeFile(targetMainPath, mainContent, 'utf-8');
|
|
46
|
-
|
|
47
|
-
const targetHandlerPath = path.join(flowOutputDir, `${handlerFileName}.js`);
|
|
48
|
-
await fs.writeFile(targetHandlerPath, handlerContent, 'utf-8');
|
|
49
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import ejs from 'ejs';
|
|
2
|
-
import fs from 'fs/promises';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
import { fileURLToPath } from 'url';
|
|
5
|
-
|
|
6
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
-
const __dirname = path.dirname(__filename);
|
|
8
|
-
const upperCase = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
9
|
-
|
|
10
|
-
export default async function generateReservedLimit(flow, flowOutputDir) {
|
|
11
|
-
const functionName = `${flow.flowTag}ReservedLimit`;
|
|
12
|
-
const handlerType = `HdrSqs`;
|
|
13
|
-
|
|
14
|
-
const mainFileName = `${functionName}_Main`;
|
|
15
|
-
const handlerFileName = `${functionName}_${handlerType}`;
|
|
16
|
-
|
|
17
|
-
const mainTemplatePath = path.join(
|
|
18
|
-
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3', 'ReservedLimit_Main.ejs'
|
|
19
|
-
);
|
|
20
|
-
const handlerTemplatePath = path.join(
|
|
21
|
-
__dirname, '..', '..', '..', 'FlowSchemas', 'templates', 's3', 'ReservedLimit_HdrSqs.ejs'
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
let mainTemplateStr, handlerTemplateStr;
|
|
25
|
-
try {
|
|
26
|
-
mainTemplateStr = await fs.readFile(mainTemplatePath, 'utf-8');
|
|
27
|
-
handlerTemplateStr = await fs.readFile(handlerTemplatePath, 'utf-8');
|
|
28
|
-
} catch (err) {
|
|
29
|
-
throw new Error(`[ReservedLimitGenerator] Failed to load template: ${err.message}`);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const mainContent = ejs.render(mainTemplateStr, {
|
|
33
|
-
flowTag: flow.flowTag,
|
|
34
|
-
functionName: functionName
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
const handlerContent = ejs.render(handlerTemplateStr, {
|
|
38
|
-
functionName,
|
|
39
|
-
handlerType
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
const targetMainPath = path.join(flowOutputDir, `${mainFileName}.js`);
|
|
43
|
-
await fs.writeFile(targetMainPath, mainContent, 'utf-8');
|
|
44
|
-
|
|
45
|
-
const targetHandlerPath = path.join(flowOutputDir, `${handlerFileName}.js`);
|
|
46
|
-
await fs.writeFile(targetHandlerPath, handlerContent, 'utf-8');
|
|
47
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export const STEP_EVENT_HANDLER_CONFIG = {
|
|
2
|
-
sqs: { suffix: 'HdrSqs', template: 'sqs' },
|
|
3
|
-
ownTopic: { suffix: 'HdrSqs', template: 'sqs' },
|
|
4
|
-
extTopic: { suffix: 'HdrSqs', template: 'sqs' },
|
|
5
|
-
dsq: { suffix: 'HdrDsq', template: 'dsq' },
|
|
6
|
-
lambdaSyncInv: { suffix: 'HdrInv', template: 'inv' },
|
|
7
|
-
lambdaSyncApi: { suffix: 'HdrApi', template: 'api' }
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export function getStepEventHandlerConfig(eventType) {
|
|
11
|
-
const config = STEP_EVENT_HANDLER_CONFIG[eventType];
|
|
12
|
-
if (config) return config;
|
|
13
|
-
|
|
14
|
-
return {
|
|
15
|
-
suffix: `Hdr${eventType.charAt(0).toUpperCase() + eventType.slice(1)}`,
|
|
16
|
-
template: 'sqs'
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export function normalizeEvents(events, fallback = ['extTopic']) {
|
|
21
|
-
if (!events) return [...fallback];
|
|
22
|
-
return Array.isArray(events) ? [...events] : [events];
|
|
23
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
export const CRUD_FLOW_TAGS = ['Create', 'Update', 'Delete', 'Get'];
|
|
2
|
-
|
|
3
|
-
export const RBAC_FLOW_TAGS = [
|
|
4
|
-
'CreateRolePermissions',
|
|
5
|
-
'CreateTargetRole',
|
|
6
|
-
'CreateUserRole',
|
|
7
|
-
'DeleteRolePermissions',
|
|
8
|
-
'DeleteTargetRole',
|
|
9
|
-
'DeleteUserFromRole',
|
|
10
|
-
'ListRolePermissions',
|
|
11
|
-
'ListTargetRole',
|
|
12
|
-
'ListUserInRoles'
|
|
13
|
-
];
|
|
14
|
-
|
|
15
|
-
export const REL_FLOW_TAGS = [
|
|
16
|
-
'CreateRelationship',
|
|
17
|
-
'UpdateRelationship',
|
|
18
|
-
'DeleteRelationship',
|
|
19
|
-
'GetRelationship',
|
|
20
|
-
'ChangeRelationship',
|
|
21
|
-
'MoveRelationship'
|
|
22
|
-
];
|
|
23
|
-
|
|
24
|
-
function equalsIgnoreCase(a, b) {
|
|
25
|
-
return String(a || '').toLowerCase() === String(b || '').toLowerCase();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function includesFlowTag(tags, flowTag) {
|
|
29
|
-
return tags.some(tag => equalsIgnoreCase(tag, flowTag));
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function isCrudFlow(flowTag) {
|
|
33
|
-
return includesFlowTag(CRUD_FLOW_TAGS, flowTag);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function isRbacFlow(flowTag) {
|
|
37
|
-
return includesFlowTag(RBAC_FLOW_TAGS, flowTag);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function isRelationshipFlow(flowTag) {
|
|
41
|
-
return includesFlowTag(REL_FLOW_TAGS, flowTag);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function getFlowOutputSubDir(flowTag) {
|
|
45
|
-
if (isCrudFlow(flowTag)) return 'FlowObjects';
|
|
46
|
-
if (isRbacFlow(flowTag)) return 'FlowRbac';
|
|
47
|
-
if (isRelationshipFlow(flowTag)) return 'FlowRelationships';
|
|
48
|
-
if (String(flowTag || '').toLowerCase().endsWith('rbacflow')) return 'FlowRbac';
|
|
49
|
-
return 'FlowSchemas';
|
|
50
|
-
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import fs from 'fs/promises';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
4
|
-
import ejs from 'ejs';
|
|
5
|
-
import { EVENT_HANDLERS } from '../events/registry.js';
|
|
6
|
-
import { STATUS_HANDLERS } from './registry.js';
|
|
7
|
-
import { getFlowOutputSubDir, isCrudFlow, isRbacFlow, isRelationshipFlow } from './flowClassifier.js';
|
|
8
|
-
import { normalizeEvents } from './eventTypes.js';
|
|
9
|
-
import { processMainFileName, ownTopicMainFileName, upperFirst } from './flowNaming.js';
|
|
10
|
-
import { getFlowsForGeneration, getGeneratedCodeConfigs } from './flowSelection.js';
|
|
11
|
-
|
|
12
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
13
|
-
const __dirname = path.dirname(__filename);
|
|
14
|
-
|
|
15
|
-
export async function generateFlowEntryPoint(allSchemas, options) {
|
|
16
|
-
console.log(' [FlowEntryPointGenerator] Generating Flow Entry Points...');
|
|
17
|
-
const baseOutputDir = path.join(options.outputPath, 'app', 'src', 'generatedCode');
|
|
18
|
-
|
|
19
|
-
const templates = {
|
|
20
|
-
sqs: await fs.readFile(path.join(__dirname, '..', 'handlers', 'FlowHandler_HdrSqs.ejs'), 'utf-8'),
|
|
21
|
-
dsq: await fs.readFile(path.join(__dirname, '..', 'handlers', 'FlowHandler_HdrDsq.ejs'), 'utf-8'),
|
|
22
|
-
api: await fs.readFile(path.join(__dirname, '..', 'handlers', 'FlowHandler_HdrApi.ejs'), 'utf-8'),
|
|
23
|
-
inv: await fs.readFile(path.join(__dirname, '..', 'handlers', 'FlowHandler_HdrInv.ejs'), 'utf-8'),
|
|
24
|
-
endpointMain: await fs.readFile(path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'endpoint', 'FlowEndpoint_Main.ejs'), 'utf-8'),
|
|
25
|
-
wbsMain: await fs.readFile(path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'endpoint', 'FlowMain_Wbs.ejs'), 'utf-8'),
|
|
26
|
-
endpointHdrWbs: await fs.readFile(path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'endpoint', 'FlowEndpoint_HdrWbs.ejs'), 'utf-8')
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
let generatedCount = 0;
|
|
30
|
-
|
|
31
|
-
const flows = getFlowsForGeneration(allSchemas);
|
|
32
|
-
for (const flow of flows) {
|
|
33
|
-
const flowTag = flow.flowTag;
|
|
34
|
-
|
|
35
|
-
// Skip relationship flows (they are handled by RelationshipFlowGenerator)
|
|
36
|
-
if (isRelationshipFlow(flowTag)) continue;
|
|
37
|
-
|
|
38
|
-
const subDir = getFlowOutputSubDir(flowTag);
|
|
39
|
-
|
|
40
|
-
const upperCaseFlowTag = upperFirst(flowTag);
|
|
41
|
-
const flowOutputDir = path.join(baseOutputDir, subDir, upperCaseFlowTag, 'source');
|
|
42
|
-
await fs.mkdir(flowOutputDir, { recursive: true });
|
|
43
|
-
|
|
44
|
-
// 2. Generate Handlers based on event array using Registry
|
|
45
|
-
const events = normalizeEvents(flow.event, ['ownTopic']);
|
|
46
|
-
|
|
47
|
-
const isOwnTopic = !isCrudFlow(flowTag) && !isRbacFlow(flowTag) && !isRelationshipFlow(flowTag) && events.includes('ownTopic');
|
|
48
|
-
const mainFileName = isOwnTopic
|
|
49
|
-
? ownTopicMainFileName(flowTag)
|
|
50
|
-
: processMainFileName(flowTag);
|
|
51
|
-
|
|
52
|
-
// Use invocationType from generatedCodeConfig if available
|
|
53
|
-
if (flow.generatedCodeConfig && flow.generatedCodeConfig.invocationType) {
|
|
54
|
-
if (!events.includes(flow.generatedCodeConfig.invocationType)) {
|
|
55
|
-
events.push(flow.generatedCodeConfig.invocationType);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
for (const ev of events) {
|
|
60
|
-
const generateCode = getGeneratedCodeConfigs(flows, flowTag);
|
|
61
|
-
|
|
62
|
-
const handlerGenerator = EVENT_HANDLERS[ev];
|
|
63
|
-
if (handlerGenerator) {
|
|
64
|
-
// Pass generateCode as 6th param
|
|
65
|
-
await handlerGenerator(flow, '', flowOutputDir, mainFileName, templates, generateCode);
|
|
66
|
-
generatedCount++;
|
|
67
|
-
|
|
68
|
-
// Generate BeforeLogical HdrSqs if there are any beforeLogical configs
|
|
69
|
-
const beforeLogicalConfigs = generateCode.filter(c => c.codeHookTag === 'beforeLogical');
|
|
70
|
-
if (beforeLogicalConfigs.length > 0) {
|
|
71
|
-
const beforeLogicalVars = {
|
|
72
|
-
flowTag: flowTag,
|
|
73
|
-
flowStepName: '',
|
|
74
|
-
mainFileName: `${upperCaseFlowTag}BeforeLogical_Main`,
|
|
75
|
-
functionName: `${flowTag}BeforeLogicalMain`,
|
|
76
|
-
queueName: `${flowTag}BeforeLogicalHdrSqs`
|
|
77
|
-
};
|
|
78
|
-
const sqsContent = ejs.render(templates.sqs, beforeLogicalVars);
|
|
79
|
-
await fs.writeFile(path.join(flowOutputDir, `${upperCaseFlowTag}BeforeLogical_HdrSqs.js`), sqsContent, 'utf-8');
|
|
80
|
-
generatedCount++;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
} else {
|
|
84
|
-
console.warn(` [FlowEntryPointGenerator] Unsupported event: ${ev} in flow: ${flowTag}`);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// 3. Process statusType
|
|
89
|
-
const statusType = flow.statusType;
|
|
90
|
-
if (statusType === 'statusField' && !isRbacFlow(flowTag) && events.includes('ownTopic') && events.includes('extTopic')) {
|
|
91
|
-
const statusHandler = STATUS_HANDLERS[statusType];
|
|
92
|
-
if (statusHandler) {
|
|
93
|
-
await statusHandler(flow, '', options.outputPath);
|
|
94
|
-
generatedCount++;
|
|
95
|
-
}
|
|
96
|
-
} else if (statusType && statusType !== 'none' && statusType !== 'storedCache' && statusType !== 'statusField') {
|
|
97
|
-
const statusHandler = STATUS_HANDLERS[statusType];
|
|
98
|
-
if (statusHandler) {
|
|
99
|
-
await statusHandler(flow, '', options.outputPath);
|
|
100
|
-
generatedCount++;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
console.log(` [FlowEntryPointGenerator] Generated ${generatedCount} files for Flow Entry Points.`);
|
|
106
|
-
}
|
package/src/codeGenerators/app/src/generatedCode/Flow/_shared/shared/flowMainFunctionBase.js
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import fs from 'fs/promises';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
4
|
-
import ejs from 'ejs';
|
|
5
|
-
import { getFlowOutputSubDir, isCrudFlow, isRbacFlow, isRelationshipFlow } from './flowClassifier.js';
|
|
6
|
-
import { processMainFileName, processFunctionName, ownTopicMainFileName, ownTopicFunctionName, ownTopicWebSocketMainFileName, ownTopicWebSocketFunctionName, upperFirst } from './flowNaming.js';
|
|
7
|
-
import { getFlowsForGeneration, getGeneratedCodeConfigs } from './flowSelection.js';
|
|
8
|
-
import { normalizePropertyType } from './propertyNormalizer.js';
|
|
9
|
-
|
|
10
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
11
|
-
const __dirname = path.dirname(__filename);
|
|
12
|
-
|
|
13
|
-
export async function generateFlowMainFunction(allSchemas, options) {
|
|
14
|
-
console.log(
|
|
15
|
-
' [FlowMainFunctionGenerator] Generating Flow Main Functions...'
|
|
16
|
-
);
|
|
17
|
-
const baseOutputDir = path.join(
|
|
18
|
-
options.outputPath,
|
|
19
|
-
'app',
|
|
20
|
-
'src',
|
|
21
|
-
'generatedCode'
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
let generatedCount = 0;
|
|
25
|
-
|
|
26
|
-
const flows = getFlowsForGeneration(allSchemas);
|
|
27
|
-
for (const flow of flows) {
|
|
28
|
-
const flowTag = flow.flowTag;
|
|
29
|
-
|
|
30
|
-
// Skip custom flows, they are handled completely by their own Generators
|
|
31
|
-
if (isRbacFlow(flowTag) || isRelationshipFlow(flowTag))
|
|
32
|
-
continue;
|
|
33
|
-
|
|
34
|
-
// Skip S3 flows to match legacy behavior where S3 flows bypass the Main function
|
|
35
|
-
if (flow.event && flow.event.includes('s3'))
|
|
36
|
-
continue;
|
|
37
|
-
|
|
38
|
-
const isCrud = isCrudFlow(flowTag);
|
|
39
|
-
const subDir = getFlowOutputSubDir(flowTag);
|
|
40
|
-
|
|
41
|
-
const upperCaseFlowTag = upperFirst(flowTag);
|
|
42
|
-
const flowOutputDir = path.join(baseOutputDir, subDir, upperCaseFlowTag, 'source');
|
|
43
|
-
await fs.mkdir(flowOutputDir, { recursive: true });
|
|
44
|
-
|
|
45
|
-
const isOwnTopic = !isCrud && flow.event && flow.event.includes('ownTopic');
|
|
46
|
-
const mainFileName = isOwnTopic
|
|
47
|
-
? ownTopicMainFileName(flowTag)
|
|
48
|
-
: processMainFileName(flowTag);
|
|
49
|
-
const functionName = isOwnTopic
|
|
50
|
-
? ownTopicFunctionName(flowTag)
|
|
51
|
-
: processFunctionName(flowTag);
|
|
52
|
-
const topicArn = `${upperCaseFlowTag}_In`;
|
|
53
|
-
|
|
54
|
-
const generateCode = getGeneratedCodeConfigs(flows, flowTag, { includeFlowTag: true });
|
|
55
|
-
|
|
56
|
-
let templateName = 'FlowEndpoint_Main.ejs';
|
|
57
|
-
if (['Create', 'Update', 'Delete', 'Get'].includes(flowTag)) {
|
|
58
|
-
templateName = `${flowTag}Endpoint_Main.ejs`;
|
|
59
|
-
} else if (String(flowTag || '').toLowerCase().endsWith('rbacflow')) {
|
|
60
|
-
templateName = 'FlowRbac_Main.ejs';
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// crud templates live under FlowObjects (the only output child that uses them);
|
|
64
|
-
// shared endpoint templates (FlowEndpoint_Main, FlowMain_Wbs) live under _internal/_shared/endpoint
|
|
65
|
-
let templateBaseDir;
|
|
66
|
-
if (templateName === 'FlowRbac_Main.ejs') {
|
|
67
|
-
templateBaseDir = path.join(__dirname, '..', '..', 'FlowRbac', 'templates', 'rbac');
|
|
68
|
-
} else if (templateName.startsWith('crud/') || ['CreateEndpoint_Main.ejs', 'UpdateEndpoint_Main.ejs', 'DeleteEndpoint_Main.ejs', 'GetEndpoint_Main.ejs'].includes(templateName)) {
|
|
69
|
-
templateBaseDir = path.join(__dirname, '..', '..', 'FlowObjects', 'templates', 'crud');
|
|
70
|
-
} else {
|
|
71
|
-
templateBaseDir = path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'endpoint');
|
|
72
|
-
}
|
|
73
|
-
const mainTemplateStr = await fs.readFile(
|
|
74
|
-
path.join(templateBaseDir, templateName),
|
|
75
|
-
'utf-8'
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
const startStep = flow.flowSteps && flow.flowSteps.length > 0 ? flow.flowSteps[0] : null;
|
|
79
|
-
let startConfig = startStep ? { ...startStep } : null;
|
|
80
|
-
|
|
81
|
-
if (startConfig) {
|
|
82
|
-
if (startConfig.properties && Array.isArray(startConfig.properties)) {
|
|
83
|
-
startConfig.properties = startConfig.properties.map(p => normalizePropertyType(p, flow.stepProperties));
|
|
84
|
-
}
|
|
85
|
-
if (startConfig.messageAttributes && Array.isArray(startConfig.messageAttributes)) {
|
|
86
|
-
startConfig.messageAttributes = startConfig.messageAttributes.map(p => normalizePropertyType(p, flow.stepMessageAttributes));
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
let tableName = null;
|
|
91
|
-
if (flow.statusType === 'storedCache' && flow.objType && flow.objType.objectType) {
|
|
92
|
-
const objectSchema = allSchemas.objects.find(obj => obj.objectType === flow.objType.objectType);
|
|
93
|
-
if (objectSchema && objectSchema.storageResources) {
|
|
94
|
-
for (const storageResource of Object.values(objectSchema.storageResources)) {
|
|
95
|
-
if (storageResource.storageType === 'dynamoDB') {
|
|
96
|
-
tableName = storageResource.tableName;
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const mainContent = ejs.render(mainTemplateStr, {
|
|
104
|
-
flowTag: flowTag,
|
|
105
|
-
upperCaseFlowTag: upperCaseFlowTag,
|
|
106
|
-
topicArn: topicArn,
|
|
107
|
-
generateCode: generateCode,
|
|
108
|
-
flow: flow,
|
|
109
|
-
startConfig: startConfig,
|
|
110
|
-
tableName: tableName,
|
|
111
|
-
functionName: functionName
|
|
112
|
-
});
|
|
113
|
-
await fs.writeFile(
|
|
114
|
-
path.join(flowOutputDir, `${mainFileName}.js`),
|
|
115
|
-
mainContent,
|
|
116
|
-
'utf-8'
|
|
117
|
-
);
|
|
118
|
-
|
|
119
|
-
// For ownTopic flows: generate WebSocket main that publishes to SNS In topic
|
|
120
|
-
if (isOwnTopic) {
|
|
121
|
-
const wbsMainTemplateStr = await fs.readFile(
|
|
122
|
-
path.join(__dirname, '..', '..', 'FlowSchemas', 'templates', 'endpoint', 'FlowMain_Wbs.ejs'),
|
|
123
|
-
'utf-8'
|
|
124
|
-
);
|
|
125
|
-
const wbsMainContent = ejs.render(wbsMainTemplateStr, {
|
|
126
|
-
flowTag: flowTag,
|
|
127
|
-
upperCaseFlowTag: upperCaseFlowTag,
|
|
128
|
-
topicArn: topicArn,
|
|
129
|
-
generateCode: generateCode,
|
|
130
|
-
flow: flow,
|
|
131
|
-
startConfig: startConfig,
|
|
132
|
-
tableName: tableName,
|
|
133
|
-
functionName: ownTopicWebSocketFunctionName(flowTag)
|
|
134
|
-
});
|
|
135
|
-
await fs.writeFile(
|
|
136
|
-
path.join(flowOutputDir, `${ownTopicWebSocketMainFileName(flowTag)}.js`),
|
|
137
|
-
wbsMainContent,
|
|
138
|
-
'utf-8'
|
|
139
|
-
);
|
|
140
|
-
generatedCount++;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// 2. Generate BeforeLogical Main Logic File if needed (CRUD flows only)
|
|
144
|
-
const beforeLogicalConfigs = generateCode.filter(c => c.codeHookTag === 'beforeLogical');
|
|
145
|
-
if (isCrud && beforeLogicalConfigs.length > 0) {
|
|
146
|
-
const beforeLogicalTemplatePath = path.join(__dirname, '..', '..', 'FlowObjects', 'templates', 'step', 'FlowEndpointBeforeLogical_Main.ejs');
|
|
147
|
-
const beforeLogicalTemplateStr = await fs.readFile(beforeLogicalTemplatePath, 'utf-8');
|
|
148
|
-
|
|
149
|
-
const beforeLogicalFileName = `${upperCaseFlowTag}BeforeLogical_Main`;
|
|
150
|
-
const beforeLogicalContent = ejs.render(beforeLogicalTemplateStr, {
|
|
151
|
-
flowTag: flowTag,
|
|
152
|
-
upperCaseFlowTag: upperCaseFlowTag,
|
|
153
|
-
generateCode: generateCode,
|
|
154
|
-
flow: flow,
|
|
155
|
-
startConfig: startConfig
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
await fs.writeFile(
|
|
159
|
-
path.join(flowOutputDir, `${beforeLogicalFileName}.js`),
|
|
160
|
-
beforeLogicalContent,
|
|
161
|
-
'utf-8'
|
|
162
|
-
);
|
|
163
|
-
generatedCount++;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
generatedCount++;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
console.log(
|
|
170
|
-
` [FlowMainFunctionGenerator] Generated ${generatedCount} files for Flow Main Functions.`
|
|
171
|
-
);
|
|
172
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export function upperFirst(str) {
|
|
2
|
-
if (!str) return str;
|
|
3
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export function lowerFirst(str) {
|
|
7
|
-
if (!str) return str;
|
|
8
|
-
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function processMainFileName(flowTag) {
|
|
12
|
-
return `Process${upperFirst(flowTag)}_Main`;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function processFunctionName(flowTag) {
|
|
16
|
-
return `Process${upperFirst(flowTag)}`;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function ownTopicMainFileName(flowTag) {
|
|
20
|
-
return `${upperFirst(flowTag)}_Main`;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function ownTopicFunctionName(flowTag) {
|
|
24
|
-
return `${upperFirst(flowTag)}_Main`;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function ownTopicWebSocketMainFileName(flowTag) {
|
|
28
|
-
return `${upperFirst(flowTag)}_WbsMain`;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function ownTopicWebSocketFunctionName(flowTag) {
|
|
32
|
-
return `${upperFirst(flowTag)}_WbsMain`;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function flowSourceLocation(subDir, flowTag) {
|
|
36
|
-
return `src/generatedCode/${subDir}/${upperFirst(flowTag)}/source/`;
|
|
37
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export function getFlowsForGeneration(allSchemas) {
|
|
2
|
-
return allSchemas.flowsForGeneration || allSchemas.flows || [];
|
|
3
|
-
}
|
|
4
|
-
export function getGeneratedCodeConfigs(flows, flowTag, options = {}) {
|
|
5
|
-
return flows
|
|
6
|
-
.filter(flow => {
|
|
7
|
-
const config = flow.generatedCodeConfig;
|
|
8
|
-
return config?.generatedCodeTag &&
|
|
9
|
-
config.generatedCodeTag.toLowerCase() === flowTag.toLowerCase();
|
|
10
|
-
})
|
|
11
|
-
.map(flow => {
|
|
12
|
-
if (!options.includeFlowTag) return flow.generatedCodeConfig;
|
|
13
|
-
|
|
14
|
-
return {
|
|
15
|
-
...flow.generatedCodeConfig,
|
|
16
|
-
flowTag: flow.flowTag
|
|
17
|
-
};
|
|
18
|
-
});
|
|
19
|
-
}
|