@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,199 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import fs from 'fs/promises';
|
|
3
|
-
import ejs from 'ejs';
|
|
4
|
-
import { fileURLToPath } from 'url';
|
|
5
|
-
import {
|
|
6
|
-
detectRoleNames,
|
|
7
|
-
FLOW_OBJECTS_ROLE,
|
|
8
|
-
PROC_FIND_DATA_ROLE,
|
|
9
|
-
FLOW_RELATIONSHIP_ROLE
|
|
10
|
-
} from '../src/generatedCode/Flow/_shared/shared/roleNameDetection.js';
|
|
11
|
-
|
|
12
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
13
|
-
const __dirname = path.dirname(__filename);
|
|
14
|
-
|
|
15
|
-
const HARDCODED_SUBSCRIPTIONS = [
|
|
16
|
-
{ serviceTag: 'GraphHandler', topicName: 'UpdateRelationship_Out', sqsEndpoint: 'UpdateRelationshipCompleteHdrSqs' },
|
|
17
|
-
{ serviceTag: 'GraphHandler', topicName: 'CreateRelationship_Out', sqsEndpoint: 'CreateRelationshipCompleteHdrSqs' },
|
|
18
|
-
{ serviceTag: 'GraphHandler', topicName: 'DeleteRelationship_Out', sqsEndpoint: 'DeleteRelationshipCompleteHdrSqs' },
|
|
19
|
-
{ serviceTag: 'GraphHandler', topicName: 'UpdateNode_Out', sqsEndpoint: 'UpdateCompleteHdrSqs' },
|
|
20
|
-
{ serviceTag: 'GraphHandler', topicName: 'CreateNode_Out', sqsEndpoint: 'CreateCompleteHdrSqs' },
|
|
21
|
-
{ serviceTag: 'GraphHandler', topicName: 'ChangeRelationshipType_Out', sqsEndpoint: 'ChangeRelationshipCompleteHdrSqs' },
|
|
22
|
-
{ serviceTag: 'GraphHandler', topicName: 'MoveRelationship_Out', sqsEndpoint: 'MoveRelationshipCompleteHdrSqs' }
|
|
23
|
-
];
|
|
24
|
-
|
|
25
|
-
function buildLambdaRoles(flows, roleNames) {
|
|
26
|
-
const lambdaRoles = [
|
|
27
|
-
{
|
|
28
|
-
objectType: FLOW_OBJECTS_ROLE,
|
|
29
|
-
additionalResourcePermission: [
|
|
30
|
-
{
|
|
31
|
-
effect: 'Allow',
|
|
32
|
-
action: { lambda: ['InvokeFunction'] },
|
|
33
|
-
resource: [
|
|
34
|
-
'arn:aws:lambda:${process.env.iz_region}:${process.env.iz_accountId}:function:${lambdaSharedLib.lambdaFunctionName(_izContext, "GetNodeHdrInv" ,"GraphHandler")}'
|
|
35
|
-
]
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
effect: 'Allow',
|
|
39
|
-
action: { sns: ['Publish'] },
|
|
40
|
-
resource: [
|
|
41
|
-
'arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, "UpdateNode_In", "GraphHandler")}'
|
|
42
|
-
]
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
effect: 'Allow',
|
|
46
|
-
action: { sns: ['Publish'] },
|
|
47
|
-
resource: [
|
|
48
|
-
'arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, "CreateNode_In", "GraphHandler")}'
|
|
49
|
-
]
|
|
50
|
-
}
|
|
51
|
-
]
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
objectType: PROC_FIND_DATA_ROLE,
|
|
55
|
-
additionalResourcePermission: [
|
|
56
|
-
{
|
|
57
|
-
effect: 'Allow',
|
|
58
|
-
action: { lambda: ['InvokeFunction'] },
|
|
59
|
-
resource: [
|
|
60
|
-
'arn:aws:lambda:${process.env.iz_region}:${process.env.iz_accountId}:function:${lambdaSharedLib.lambdaFunctionName(_izContext, "GetNodeHdrInv" ,"GraphHandler")}'
|
|
61
|
-
]
|
|
62
|
-
}
|
|
63
|
-
]
|
|
64
|
-
}
|
|
65
|
-
];
|
|
66
|
-
|
|
67
|
-
for (const flow of flows) {
|
|
68
|
-
if (!flow.event || !flow.event.includes('s3')) continue;
|
|
69
|
-
|
|
70
|
-
lambdaRoles.push({
|
|
71
|
-
objectType: 'FlowSchemaUploadS3Role',
|
|
72
|
-
additionalResourcePermission: [
|
|
73
|
-
{
|
|
74
|
-
effect: 'Allow',
|
|
75
|
-
action: { sns: ['Publish'] },
|
|
76
|
-
resource: [
|
|
77
|
-
'arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, "ReservedDynamicUsage_In", "AccountLimits")}'
|
|
78
|
-
]
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
effect: 'Allow',
|
|
82
|
-
action: { lambda: ['InvokeFunction'] },
|
|
83
|
-
resource: [
|
|
84
|
-
'arn:aws:lambda:${process.env.iz_region}:${process.env.iz_accountId}:function:${lambdaSharedLib.lambdaFunctionName(_izContext, "StaticLimitProcessHdrInv" ,"AccountLimits")}'
|
|
85
|
-
]
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
effect: 'Allow',
|
|
89
|
-
action: { sns: ['Publish'] },
|
|
90
|
-
resource: [
|
|
91
|
-
'arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, "CancelUsage_In", "AccountLimits")}'
|
|
92
|
-
]
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
effect: 'Allow',
|
|
96
|
-
action: { sns: ['Publish'] },
|
|
97
|
-
resource: [
|
|
98
|
-
'arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, "ReservedDynamicUsageComplet_Out", "AccountLimits")}',
|
|
99
|
-
'arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, "ConfirmUsage_In", "AccountLimits")}'
|
|
100
|
-
]
|
|
101
|
-
}
|
|
102
|
-
]
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
if (roleNames && roleNames.has(FLOW_RELATIONSHIP_ROLE)) {
|
|
107
|
-
lambdaRoles.push({
|
|
108
|
-
objectType: FLOW_RELATIONSHIP_ROLE,
|
|
109
|
-
additionalResourcePermission: [
|
|
110
|
-
{
|
|
111
|
-
effect: 'Allow',
|
|
112
|
-
action: { lambda: ['InvokeFunction'] },
|
|
113
|
-
resource: [
|
|
114
|
-
'arn:aws:lambda:${process.env.iz_region}:${process.env.iz_accountId}:function:${lambdaSharedLib.lambdaFunctionName(_izContext, "GetRelationshipHdrInv" ,"GraphHandler")}'
|
|
115
|
-
]
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
effect: 'Allow',
|
|
119
|
-
action: { sns: ['Publish'] },
|
|
120
|
-
resource: [
|
|
121
|
-
'arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, "CreateRelationship_In", "GraphHandler")}',
|
|
122
|
-
'arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, "UpdateRelationship_In", "GraphHandler")}',
|
|
123
|
-
'arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, "DeleteRelationship_In", "GraphHandler")}',
|
|
124
|
-
'arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, "ChangeRelationship_In", "GraphHandler")}',
|
|
125
|
-
'arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, "MoveRelationship_In", "GraphHandler")}'
|
|
126
|
-
]
|
|
127
|
-
}
|
|
128
|
-
]
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return lambdaRoles;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function buildRoleNameConfigContent(roleNames) {
|
|
136
|
-
return `export function generatedIntTestRoleNameConfig() {
|
|
137
|
-
let roleNameConfigIntTest = [
|
|
138
|
-
${Array.from(roleNames)
|
|
139
|
-
.sort()
|
|
140
|
-
.map(roleName => ` "${roleName}",`)
|
|
141
|
-
.join('\n')}
|
|
142
|
-
];
|
|
143
|
-
return roleNameConfigIntTest;
|
|
144
|
-
}
|
|
145
|
-
`;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export async function generateInitialSetup(allSchemas, options) {
|
|
149
|
-
console.log(' [InitialSetupGenerator] Generating Initial Setup Scripts...');
|
|
150
|
-
|
|
151
|
-
const { flows, roleNames } = detectRoleNames(allSchemas);
|
|
152
|
-
const setupDir = path.join(options.outputPath, 'app', 'initial_setup');
|
|
153
|
-
const sourceDir = path.join(setupDir, 'generatedCode', 'source');
|
|
154
|
-
const hookDir = path.join(setupDir, 'generatedCode', 'hook');
|
|
155
|
-
|
|
156
|
-
await fs.mkdir(sourceDir, { recursive: true });
|
|
157
|
-
await fs.mkdir(hookDir, { recursive: true });
|
|
158
|
-
|
|
159
|
-
const tableNameTpl = await fs.readFile(
|
|
160
|
-
path.join(__dirname, 'templates', 'InitialSetup_TableName.ejs'),
|
|
161
|
-
'utf-8'
|
|
162
|
-
);
|
|
163
|
-
const tableNameContent = ejs.render(tableNameTpl, { tableNames: [] });
|
|
164
|
-
await fs.writeFile(
|
|
165
|
-
path.join(sourceDir, 'generatedTableNameConfig.js'),
|
|
166
|
-
tableNameContent,
|
|
167
|
-
'utf-8'
|
|
168
|
-
);
|
|
169
|
-
|
|
170
|
-
const snsTpl = await fs.readFile(
|
|
171
|
-
path.join(__dirname, 'templates', 'InitialSetup_SnsService.ejs'),
|
|
172
|
-
'utf-8'
|
|
173
|
-
);
|
|
174
|
-
const snsContent = ejs.render(snsTpl, { subscriptions: HARDCODED_SUBSCRIPTIONS });
|
|
175
|
-
await fs.writeFile(
|
|
176
|
-
path.join(sourceDir, 'generatedSnsServiceConfig.js'),
|
|
177
|
-
snsContent,
|
|
178
|
-
'utf-8'
|
|
179
|
-
);
|
|
180
|
-
|
|
181
|
-
const lambdaTpl = await fs.readFile(
|
|
182
|
-
path.join(__dirname, 'templates', 'InitialSetup_LambdaRole.ejs'),
|
|
183
|
-
'utf-8'
|
|
184
|
-
);
|
|
185
|
-
const lambdaContent = ejs.render(lambdaTpl, { datas: buildLambdaRoles(flows, roleNames) });
|
|
186
|
-
await fs.writeFile(
|
|
187
|
-
path.join(sourceDir, 'generatedLambdaRoleServiceConfig.js'),
|
|
188
|
-
lambdaContent,
|
|
189
|
-
'utf-8'
|
|
190
|
-
);
|
|
191
|
-
|
|
192
|
-
await fs.writeFile(
|
|
193
|
-
path.join(sourceDir, 'RoleNameConfig.js'),
|
|
194
|
-
buildRoleNameConfigContent(roleNames),
|
|
195
|
-
'utf-8'
|
|
196
|
-
);
|
|
197
|
-
|
|
198
|
-
console.log(` [InitialSetupGenerator] Wrote initial_setup scripts to ${sourceDir}`);
|
|
199
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import Logger from '@izara_project/izara-core-library-logger';
|
|
2
|
-
import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
|
|
3
|
-
import lambdaSharedLib from '@izara_project/izara-core-library-lambda';
|
|
4
|
-
import snsSharedLib from '@izara_project/izara-core-library-sns';
|
|
5
|
-
import initialSetupConfig from '../../config/Config.js';
|
|
6
|
-
|
|
7
|
-
const _izContext = { logger: Logger };
|
|
8
|
-
|
|
9
|
-
export function generatedLambdaRole() {
|
|
10
|
-
const externalLambdaRole = [
|
|
11
|
-
<% datas.forEach((data, dataIdx) => { -%>
|
|
12
|
-
{
|
|
13
|
-
roleName: '<%- data.objectType.replace(/Role$/, '') %>',
|
|
14
|
-
statement: [
|
|
15
|
-
<% data.additionalResourcePermission.forEach((resourcePermission, resourceIdx) => { -%>
|
|
16
|
-
{
|
|
17
|
-
Sid: '<%- data.objectType %>Test<%- resourceIdx %>',
|
|
18
|
-
Effect: '<%- resourcePermission.effect %>',
|
|
19
|
-
Action: [<%
|
|
20
|
-
const actions = [];
|
|
21
|
-
Object.keys(resourcePermission.action).forEach((service) => {
|
|
22
|
-
resourcePermission.action[service].forEach((act) => {
|
|
23
|
-
actions.push(`'${service}:${act}'`);
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
%><%- actions.join(', ') %>],
|
|
27
|
-
Resource: [
|
|
28
|
-
<%
|
|
29
|
-
const resources = [];
|
|
30
|
-
resourcePermission.resource.forEach((res) => {
|
|
31
|
-
const formattedRes = res.replace(/"/g, "'");
|
|
32
|
-
resources.push(` \`${formattedRes}\``);
|
|
33
|
-
});
|
|
34
|
-
%><%- resources.join(',\n') %>
|
|
35
|
-
]
|
|
36
|
-
}<%= (resourceIdx === data.additionalResourcePermission.length - 1) ? '' : ',\n\n' -%>
|
|
37
|
-
<% }) -%>
|
|
38
|
-
|
|
39
|
-
//(<create<%- data.objectType.replace(/Role$/, '') %>Role>)
|
|
40
|
-
//(</create<%- data.objectType.replace(/Role$/, '') %>Role>)
|
|
41
|
-
]
|
|
42
|
-
}<%= (dataIdx === datas.length - 1) ? '' : ',\n\n' -%>
|
|
43
|
-
<% }) -%>
|
|
44
|
-
|
|
45
|
-
//(<additionalRole>)
|
|
46
|
-
//(</additionalRole>)
|
|
47
|
-
];
|
|
48
|
-
|
|
49
|
-
return externalLambdaRole;
|
|
50
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const generatedSnsTopicSubscription = [
|
|
2
|
-
<% subscriptions.forEach(sub => { %>
|
|
3
|
-
{
|
|
4
|
-
serviceTag: "<%- sub.serviceTag %>",
|
|
5
|
-
topicName: "<%- sub.topicName %>",
|
|
6
|
-
sqsEndpoint: "<%- sub.sqsEndpoint %>"
|
|
7
|
-
},
|
|
8
|
-
<% }) %>
|
|
9
|
-
//(<additionalSubscription>)
|
|
10
|
-
//(</additionalSubscription>)
|
|
11
|
-
];
|
|
12
|
-
|
|
13
|
-
export {
|
|
14
|
-
generatedSnsTopicSubscription
|
|
15
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import { fileURLToPath } from 'url';
|
|
3
|
-
import { renderYamlTemplate } from './renderYamlTemplate.js';
|
|
4
|
-
|
|
5
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = path.dirname(__filename);
|
|
7
|
-
|
|
8
|
-
export async function generateFindDataYaml(options) {
|
|
9
|
-
console.log(' [FindDataYamlGenerator] Generating FindData YAML...');
|
|
10
|
-
|
|
11
|
-
await renderYamlTemplate(
|
|
12
|
-
path.join(__dirname, 'templates', 'FindData_Yaml.ejs'),
|
|
13
|
-
path.join(options.outputPath, 'app', 'sls_yaml', 'generatedCode', 'source', 'find-data.yml'),
|
|
14
|
-
{
|
|
15
|
-
functionName: 'FindDataHdrSqs',
|
|
16
|
-
handlerPath: 'src/generatedCode/FindData/source/FindData_HdrSqs.main',
|
|
17
|
-
roleName: 'ProcFindData',
|
|
18
|
-
upperFunctionName: 'FINDDATA',
|
|
19
|
-
upperHandlerType: 'HDRSQS'
|
|
20
|
-
},
|
|
21
|
-
'FindDataYamlGenerator'
|
|
22
|
-
);
|
|
23
|
-
}
|
|
@@ -1,332 +0,0 @@
|
|
|
1
|
-
import fs from 'fs/promises';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import ejs from 'ejs';
|
|
4
|
-
import { fileURLToPath } from 'url';
|
|
5
|
-
import { getFlowsForGeneration } from '../src/generatedCode/Flow/_shared/shared/flowSelection.js';
|
|
6
|
-
import { isCrudFlow, isRbacFlow, isRelationshipFlow } from '../src/generatedCode/Flow/_shared/shared/flowClassifier.js';
|
|
7
|
-
|
|
8
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
-
const __dirname = path.dirname(__filename);
|
|
10
|
-
|
|
11
|
-
export async function generateFunctionYaml(allSchemas, options) {
|
|
12
|
-
console.log(' [FunctionYamlGenerator] Generating Function YAMLs...');
|
|
13
|
-
const serviceName = options.serviceName;
|
|
14
|
-
if (!serviceName) {
|
|
15
|
-
throw new Error('[Developer Error] serviceName is missing in FunctionYamlGenerator. Ensure serverless.config.yml has main_config.iz_serviceName.');
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const slsYamlDir = path.join(
|
|
19
|
-
options.outputPath,
|
|
20
|
-
'app',
|
|
21
|
-
'sls_yaml',
|
|
22
|
-
'generatedCode',
|
|
23
|
-
'source'
|
|
24
|
-
);
|
|
25
|
-
await fs.mkdir(slsYamlDir, { recursive: true });
|
|
26
|
-
|
|
27
|
-
const templates = {
|
|
28
|
-
sqs: await fs.readFile(
|
|
29
|
-
path.join(__dirname, 'templates', 'FunctionYaml_Sqs.ejs'),
|
|
30
|
-
'utf-8'
|
|
31
|
-
),
|
|
32
|
-
inv: await fs.readFile(
|
|
33
|
-
path.join(__dirname, 'templates', 'FunctionYaml_Inv.ejs'),
|
|
34
|
-
'utf-8'
|
|
35
|
-
),
|
|
36
|
-
api: await fs.readFile(
|
|
37
|
-
path.join(__dirname, 'templates', 'FunctionYaml_Api.ejs'),
|
|
38
|
-
'utf-8'
|
|
39
|
-
),
|
|
40
|
-
wbs: await fs.readFile(
|
|
41
|
-
path.join(__dirname, 'templates', 'FunctionYaml_Wbs.ejs'),
|
|
42
|
-
'utf-8'
|
|
43
|
-
),
|
|
44
|
-
eventBridge: await fs.readFile(
|
|
45
|
-
path.join(__dirname, 'templates', 'FunctionYaml_EventBridge.ejs'),
|
|
46
|
-
'utf-8'
|
|
47
|
-
)
|
|
48
|
-
};
|
|
49
|
-
const flows = getFlowsForGeneration(allSchemas);
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
let perActionYaml = '';
|
|
53
|
-
let relActionYaml = '';
|
|
54
|
-
let rbacYaml = '';
|
|
55
|
-
let flowSchemaYaml = '';
|
|
56
|
-
const customYmls = {};
|
|
57
|
-
|
|
58
|
-
const upperCase = str => str.charAt(0).toUpperCase() + str.slice(1);
|
|
59
|
-
|
|
60
|
-
// 1. Find all generated Handlers
|
|
61
|
-
const generatedCodeDir = path.join(
|
|
62
|
-
options.outputPath,
|
|
63
|
-
'app',
|
|
64
|
-
'src',
|
|
65
|
-
'generatedCode'
|
|
66
|
-
);
|
|
67
|
-
const handlerFiles = [];
|
|
68
|
-
async function getHandlerFiles(dir) {
|
|
69
|
-
try {
|
|
70
|
-
const dirents = await fs.readdir(dir, { withFileTypes: true });
|
|
71
|
-
for (const dirent of dirents) {
|
|
72
|
-
const res = path.resolve(dir, dirent.name);
|
|
73
|
-
if (dirent.isDirectory()) {
|
|
74
|
-
await getHandlerFiles(res);
|
|
75
|
-
} else if (
|
|
76
|
-
dirent.name.includes('_Hdr') &&
|
|
77
|
-
dirent.name.endsWith('.js')
|
|
78
|
-
) {
|
|
79
|
-
// Extract relative path from generatedCodeDir
|
|
80
|
-
const relativePath = path.relative(generatedCodeDir, res);
|
|
81
|
-
// normalize to forward slashes
|
|
82
|
-
handlerFiles.push(relativePath.replace(/\\/g, '/'));
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
} catch (e) {
|
|
86
|
-
// directory might not exist if no flows generated
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
await getHandlerFiles(generatedCodeDir);
|
|
90
|
-
|
|
91
|
-
// Prepare API routes
|
|
92
|
-
const crudApiRoutes = allSchemas.objects.map(obj => ({
|
|
93
|
-
objectName: obj.objectType,
|
|
94
|
-
upperName: upperCase(obj.objectType)
|
|
95
|
-
}));
|
|
96
|
-
const relApiRoutes = allSchemas.relationships.map(rel => {
|
|
97
|
-
const relName = Object.keys(rel)[0];
|
|
98
|
-
return {
|
|
99
|
-
objectName: relName,
|
|
100
|
-
upperName: upperCase(relName)
|
|
101
|
-
};
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
for (const handlerFile of handlerFiles) {
|
|
105
|
-
// e.g. "Endpoints/Create/source/ProcessCreate_HdrSqs.js"
|
|
106
|
-
const parts = handlerFile.split('/');
|
|
107
|
-
if (parts.length < 4) continue;
|
|
108
|
-
|
|
109
|
-
const subDir = parts[0]; // e.g. FlowObjects, FlowSchemas, SystemFlowSchemas
|
|
110
|
-
if (subDir === 'SystemFlowSchemas') continue;
|
|
111
|
-
|
|
112
|
-
const flowTag = parts[1];
|
|
113
|
-
const fileName = parts[3]; // e.g. ProcessCreate_HdrSqs.js
|
|
114
|
-
|
|
115
|
-
const fileNameWithoutExt = fileName.replace('.js', '');
|
|
116
|
-
// e.g. ProcessCreate_HdrSqs
|
|
117
|
-
const splitFileName = fileNameWithoutExt.split('_');
|
|
118
|
-
const handlerBaseName = splitFileName[0]; // e.g. ProcessCreate or CreateComplete
|
|
119
|
-
const handlerSuffix = splitFileName[1]; // e.g. HdrSqs, HdrApi, HdrInv
|
|
120
|
-
|
|
121
|
-
// Skip custom handlers that self-register their own YAML to prevent duplicates
|
|
122
|
-
if (
|
|
123
|
-
handlerBaseName.startsWith('ProcessTriggerCache') ||
|
|
124
|
-
handlerBaseName.startsWith('CheckTriggerCache') ||
|
|
125
|
-
handlerBaseName.startsWith('TriggerCache') ||
|
|
126
|
-
handlerBaseName.startsWith('CompleteStatusField')
|
|
127
|
-
) {
|
|
128
|
-
continue;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const isCrud = isCrudFlow(flowTag);
|
|
132
|
-
const isRel = isRelationshipFlow(flowTag);
|
|
133
|
-
const isRbac =
|
|
134
|
-
isRbacFlow(flowTag) ||
|
|
135
|
-
String(flowTag || '')
|
|
136
|
-
.toLowerCase()
|
|
137
|
-
.endsWith('rbacflow');
|
|
138
|
-
const isCustom = !isCrud && !isRel && !isRbac;
|
|
139
|
-
|
|
140
|
-
// Role mapping
|
|
141
|
-
let roleName = '';
|
|
142
|
-
if (isCrud) {
|
|
143
|
-
roleName = 'FlowObjectsRole';
|
|
144
|
-
} else if (isRbac) {
|
|
145
|
-
roleName = 'FlowRbacRole';
|
|
146
|
-
} else if (isRel) {
|
|
147
|
-
roleName = 'FlowRelationshipRole';
|
|
148
|
-
} else {
|
|
149
|
-
roleName = `${upperCase(flowTag)}Role`;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// Function Name Config
|
|
153
|
-
// e.g. ProcessCreateSqs or CreateCompleteSqs or GetApi
|
|
154
|
-
let suffixType = handlerSuffix.startsWith('Hdr')
|
|
155
|
-
? handlerSuffix
|
|
156
|
-
: handlerSuffix.replace('Hdr', '');
|
|
157
|
-
let functionNameConfig = `${handlerBaseName}${suffixType}`;
|
|
158
|
-
if (isCrud && handlerBaseName === `Process${upperCase(flowTag)}`) {
|
|
159
|
-
// Legacy matches: CreateSqs, GetApi instead of ProcessCreateSqs
|
|
160
|
-
functionNameConfig = `${upperCase(flowTag)}${suffixType}`;
|
|
161
|
-
}
|
|
162
|
-
if (isRel && handlerBaseName === `Process${upperCase(flowTag)}`) {
|
|
163
|
-
// Legacy matches: CreateRelSqs
|
|
164
|
-
functionNameConfig = `${upperCase(flowTag).replace('Relationship', 'Rel')}${suffixType}`;
|
|
165
|
-
}
|
|
166
|
-
if (handlerBaseName.endsWith('Complete')) {
|
|
167
|
-
// e.g. CreateCompleteHdrSqs or CreateCompleteSqs
|
|
168
|
-
if (isCrud) {
|
|
169
|
-
// Legacy: DeleteCompleteHdrSqs, UpdateCompleteHdrSqs, CreateCompleteHdrSqs
|
|
170
|
-
const crudType = upperCase(flowTag);
|
|
171
|
-
functionNameConfig = `${crudType}CompleteHdrSqs`;
|
|
172
|
-
} else if (isRel) {
|
|
173
|
-
// Legacy: UpdateRelComp
|
|
174
|
-
functionNameConfig = `${upperCase(flowTag)}CompleteHdrSqs`;
|
|
175
|
-
} else {
|
|
176
|
-
functionNameConfig = `${handlerBaseName}${suffixType}`;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
let queueName = '';
|
|
181
|
-
const flowDefForQueue = flows.find(f => f.flowTag === flowTag);
|
|
182
|
-
|
|
183
|
-
if (isCrud || isRel) {
|
|
184
|
-
queueName = handlerBaseName.replace('Process', '');
|
|
185
|
-
if (handlerSuffix === 'HdrSqs' || handlerSuffix === 'HdrDsq') {
|
|
186
|
-
queueName += handlerSuffix;
|
|
187
|
-
}
|
|
188
|
-
} else {
|
|
189
|
-
// For Custom Flows (e.g. OwnTopicFlowProcess, ProcessExtTopicFlow)
|
|
190
|
-
// The queue name exactly matches the handler name without the underscore.
|
|
191
|
-
if (handlerSuffix === 'HdrSqs' || handlerSuffix === 'HdrDsq') {
|
|
192
|
-
if (
|
|
193
|
-
handlerBaseName === `Process${upperCase(flowTag)}` &&
|
|
194
|
-
flowDefForQueue &&
|
|
195
|
-
flowDefForQueue.event &&
|
|
196
|
-
flowDefForQueue.event.includes('ownTopic')
|
|
197
|
-
) {
|
|
198
|
-
// ownTopic flows in FlowResourceYamlGenerator omit 'Process' for the queue
|
|
199
|
-
queueName = flowTag + handlerSuffix;
|
|
200
|
-
} else {
|
|
201
|
-
queueName = handlerBaseName + handlerSuffix;
|
|
202
|
-
}
|
|
203
|
-
} else {
|
|
204
|
-
queueName = handlerBaseName;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// Api routes
|
|
209
|
-
let apiRoutes = [];
|
|
210
|
-
if (suffixType === 'HdrApi' || suffixType === 'Api') {
|
|
211
|
-
const routesList = isCrud ? crudApiRoutes : isRel ? relApiRoutes : [];
|
|
212
|
-
const actionPath = flowTag.toLowerCase().replace('relationship', '');
|
|
213
|
-
apiRoutes = routesList.map(r => ({
|
|
214
|
-
path: `/${serviceName}/${r.objectName}/${actionPath}`,
|
|
215
|
-
upperName: r.upperName
|
|
216
|
-
}));
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
// Handler Path
|
|
220
|
-
const handlerPath = `src/generatedCode/${subDir}/${flowTag}/source/${fileNameWithoutExt}.main`;
|
|
221
|
-
|
|
222
|
-
let filterPatterns = '';
|
|
223
|
-
if (
|
|
224
|
-
handlerBaseName.endsWith('Complete') &&
|
|
225
|
-
(suffixType === 'HdrSqs' ||
|
|
226
|
-
suffixType === 'HdrDsq' ||
|
|
227
|
-
suffixType === 'Sqs' ||
|
|
228
|
-
suffixType === 'Dsq')
|
|
229
|
-
) {
|
|
230
|
-
filterPatterns = ` filterPatterns: #**** need to update serverless framework upper v.2.69.1
|
|
231
|
-
- body: {"MessageAttributes":{"callingFlow":{"Value":["\${self:custom.iz_resourcePrefix}${functionNameConfig}"]}}} # functionName of callingFlow
|
|
232
|
-
- body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}`;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
const flowDef = flows.find(f => f.flowTag === flowTag);
|
|
236
|
-
let schedules = [];
|
|
237
|
-
if (flowDef && flowDef.schedules) {
|
|
238
|
-
schedules = flowDef.schedules;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
const renderVars = {
|
|
242
|
-
functionNameConfig,
|
|
243
|
-
handlerPath,
|
|
244
|
-
roleName,
|
|
245
|
-
queueName,
|
|
246
|
-
apiRoutes,
|
|
247
|
-
filterPatterns,
|
|
248
|
-
schedules,
|
|
249
|
-
flowTag
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
let yamlBlock = '';
|
|
253
|
-
if (
|
|
254
|
-
schedules.length > 0 &&
|
|
255
|
-
(suffixType === 'HdrInv' || suffixType === 'Inv')
|
|
256
|
-
) {
|
|
257
|
-
yamlBlock = ejs.render(templates.eventBridge, renderVars);
|
|
258
|
-
} else if (
|
|
259
|
-
suffixType === 'HdrSqs' ||
|
|
260
|
-
suffixType === 'HdrDsq' ||
|
|
261
|
-
suffixType === 'Sqs' ||
|
|
262
|
-
suffixType === 'Dsq'
|
|
263
|
-
) {
|
|
264
|
-
yamlBlock = ejs.render(templates.sqs, renderVars);
|
|
265
|
-
} else if (suffixType === 'HdrInv' || suffixType === 'Inv') {
|
|
266
|
-
yamlBlock = ejs.render(templates.inv, renderVars);
|
|
267
|
-
} else if (suffixType === 'HdrApi' || suffixType === 'Api') {
|
|
268
|
-
yamlBlock = ejs.render(templates.api, renderVars);
|
|
269
|
-
} else if (suffixType === 'HdrWbs' || suffixType === 'Wbs') {
|
|
270
|
-
renderVars.routeName = flowTag;
|
|
271
|
-
yamlBlock = ejs.render(templates.wbs, renderVars);
|
|
272
|
-
} else {
|
|
273
|
-
// Fallback for others
|
|
274
|
-
yamlBlock = ejs.render(templates.inv, renderVars); // Simple no-events template
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
const customYamlFile =
|
|
278
|
-
flowDef && flowDef.fileName ? flowDef.fileName : null;
|
|
279
|
-
|
|
280
|
-
if (customYamlFile) {
|
|
281
|
-
if (!customYmls[customYamlFile]) customYmls[customYamlFile] = '';
|
|
282
|
-
customYmls[customYamlFile] += yamlBlock + '\n\n';
|
|
283
|
-
} else if (isCrud) {
|
|
284
|
-
perActionYaml += yamlBlock + '\n\n';
|
|
285
|
-
} else if (isRel) {
|
|
286
|
-
relActionYaml += yamlBlock + '\n\n';
|
|
287
|
-
} else if (isRbac) {
|
|
288
|
-
rbacYaml += yamlBlock + '\n\n';
|
|
289
|
-
} else {
|
|
290
|
-
flowSchemaYaml += yamlBlock + '\n\n';
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
if (perActionYaml) {
|
|
295
|
-
await fs.writeFile(
|
|
296
|
-
path.join(slsYamlDir, 'flow-objects.yml'),
|
|
297
|
-
perActionYaml,
|
|
298
|
-
'utf-8'
|
|
299
|
-
);
|
|
300
|
-
}
|
|
301
|
-
if (relActionYaml) {
|
|
302
|
-
await fs.writeFile(
|
|
303
|
-
path.join(slsYamlDir, 'flow-relationships.yml'),
|
|
304
|
-
relActionYaml,
|
|
305
|
-
'utf-8'
|
|
306
|
-
);
|
|
307
|
-
}
|
|
308
|
-
if (rbacYaml) {
|
|
309
|
-
await fs.writeFile(
|
|
310
|
-
path.join(slsYamlDir, 'flow-rbac.yml'),
|
|
311
|
-
rbacYaml,
|
|
312
|
-
'utf-8'
|
|
313
|
-
);
|
|
314
|
-
}
|
|
315
|
-
if (flowSchemaYaml) {
|
|
316
|
-
// Append to flow-schema.yml just in case WebSocket/TriggerCache already created it, or create new.
|
|
317
|
-
await fs.appendFile(
|
|
318
|
-
path.join(slsYamlDir, 'flow-schema.yml'),
|
|
319
|
-
flowSchemaYaml,
|
|
320
|
-
'utf-8'
|
|
321
|
-
);
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
for (const [fName, content] of Object.entries(customYmls)) {
|
|
325
|
-
const fullFileName = fName.endsWith('.yml') ? fName : `${fName}.yml`;
|
|
326
|
-
await fs.writeFile(path.join(slsYamlDir, fullFileName), content, 'utf-8');
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
console.log(
|
|
330
|
-
` [FunctionYamlGenerator] Wrote YAML functions for CRUD, Relationships, and Custom Flows.`
|
|
331
|
-
);
|
|
332
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import { fileURLToPath } from 'url';
|
|
3
|
-
import { renderYamlTemplate } from './renderYamlTemplate.js';
|
|
4
|
-
|
|
5
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = path.dirname(__filename);
|
|
7
|
-
|
|
8
|
-
export async function generateProcessLogicalYaml(allSchemas, options) {
|
|
9
|
-
console.log(' [ProcessLogicalYamlGenerator] Generating ProcessLogical YAML...');
|
|
10
|
-
|
|
11
|
-
if (!allSchemas.objects || allSchemas.objects.length === 0) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
await renderYamlTemplate(
|
|
16
|
-
path.join(__dirname, 'templates', 'ProcessLogical_Yaml.ejs'),
|
|
17
|
-
path.join(options.outputPath, 'app', 'sls_yaml', 'generatedCode', 'source', 'process-logical.yml'),
|
|
18
|
-
{},
|
|
19
|
-
'ProcessLogicalYamlGenerator'
|
|
20
|
-
);
|
|
21
|
-
}
|