@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
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<% const fieldList = fields.join(', '); -%>
|
|
2
|
+
import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
|
|
3
|
+
import snsSharedLib from '@izara_project/izara-core-library-sns';
|
|
4
|
+
import { sns } from '@izara_project/izara-core-library-external-request';
|
|
5
|
+
|
|
6
|
+
export default async function Process<%- flowTag %>(_izContext, requestParams) {
|
|
7
|
+
try {
|
|
8
|
+
const { <%- fieldList %> } = requestParams;
|
|
9
|
+
await dynamodbSharedLib.<%- method %>(
|
|
10
|
+
_izContext,
|
|
11
|
+
dynamodbSharedLib.tableName(_izContext, '<%- tableName %>'),
|
|
12
|
+
{ <%- fieldList %> }
|
|
13
|
+
);
|
|
14
|
+
await sns.publishMessage(_izContext, {
|
|
15
|
+
message: { returnResult: { <%- fieldList %> } },
|
|
16
|
+
TopicArn: snsSharedLib.snsTopicArnByFlowSchema(_izContext, '<%- flowTag %>_Out')
|
|
17
|
+
});
|
|
18
|
+
} catch (error) {
|
|
19
|
+
_izContext.logger.error('[Rbac:Process<%- flowTag %>] error:', error);
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { middlewareHandler as middleware } from '@izara_project/izara-middleware';
|
|
2
|
+
import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
|
|
3
|
+
import Process<%- flowTag %> from './Process<%- flowTag %>_Main.js';
|
|
4
|
+
|
|
5
|
+
middleware.setValidatorSchema({});
|
|
6
|
+
export const main = middleware.wrap(async event => Process<%- flowTag %>(
|
|
7
|
+
event._izContext,
|
|
8
|
+
event,
|
|
9
|
+
callingFlowSharedLib.addCallingFlowToPassOnProperties(event)
|
|
10
|
+
));
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
|
|
2
|
+
import { coreConsts } from '@izara_project/izara-core-library-core';
|
|
3
|
+
|
|
4
|
+
export default async function Process<%- flowTag %>(_izContext, requestParams) {
|
|
5
|
+
try {
|
|
6
|
+
const userId = _izContext.correlationIds.get(coreConsts.BASE_USER_ID);
|
|
7
|
+
const targetId = _izContext.correlationIds.get(coreConsts.TARGET_ID);
|
|
8
|
+
if (!userId && !targetId) throw new Error('Missing required request parameters: userId or targetId');
|
|
9
|
+
const { flowTypeConcat, inputParameterGroups } = requestParams;
|
|
10
|
+
if (!flowTypeConcat) throw new Error('Missing flowTypeConcat in requestParams');
|
|
11
|
+
const userRoles = (await dynamodbSharedLib.query(
|
|
12
|
+
_izContext,
|
|
13
|
+
dynamodbSharedLib.tableName(_izContext, 'UserRoles'),
|
|
14
|
+
{ userId }
|
|
15
|
+
)).Items || [];
|
|
16
|
+
const targetRoles = userRoles.filter(role => role.roleIdKey?.startsWith(targetId + '_'));
|
|
17
|
+
for (const role of targetRoles) {
|
|
18
|
+
const permission = await dynamodbSharedLib.getItem(
|
|
19
|
+
_izContext,
|
|
20
|
+
dynamodbSharedLib.tableName(_izContext, 'RolePermissions'),
|
|
21
|
+
{ roleIdKey: role.roleIdKey, flowTypeConcat }
|
|
22
|
+
);
|
|
23
|
+
if (permission?.permission === true && matchesParameterGroups(permission.parameterGroups, inputParameterGroups)) {
|
|
24
|
+
return { permission: true, roleIdKey: permission.roleIdKey };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return { permission: false, roleIdKey: '' };
|
|
28
|
+
} catch (error) {
|
|
29
|
+
_izContext.logger.error('error Process<%- flowTag %>:', error);
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function matchesParameterGroups(groups, input) {
|
|
35
|
+
if (!groups || typeof groups !== 'object' || Array.isArray(groups) || Object.keys(groups).length === 0) return true;
|
|
36
|
+
return Object.values(groups).some(group => Array.isArray(group) && group.every(check => {
|
|
37
|
+
let value = input || {};
|
|
38
|
+
for (const name of check.parameterNames || []) {
|
|
39
|
+
if (!value || typeof value !== 'object' || !(name in value)) return false;
|
|
40
|
+
value = value[name];
|
|
41
|
+
}
|
|
42
|
+
return Array.isArray(check.parameterValues) && check.parameterValues.includes(value);
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<%
|
|
2
|
+
const itemType = operation === 'Put' ? 'Item' : 'Key';
|
|
3
|
+
const roleUsersKey = operation === 'Put' ? 'userId, roleIdKey' : 'roleIdKey, userId';
|
|
4
|
+
-%>import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
|
|
5
|
+
import snsSharedLib from '@izara_project/izara-core-library-sns';
|
|
6
|
+
import { sns } from '@izara_project/izara-core-library-external-request';
|
|
7
|
+
|
|
8
|
+
export default async function Process<%- flowTag %>(_izContext, requestParams) {
|
|
9
|
+
try {
|
|
10
|
+
const { roleIdKey, userId } = requestParams;
|
|
11
|
+
await dynamodbSharedLib.transactWriteItems(_izContext, [
|
|
12
|
+
{
|
|
13
|
+
<%- operation %>: {
|
|
14
|
+
TableName: dynamodbSharedLib.tableName(_izContext, 'RoleUsers'),
|
|
15
|
+
<%- itemType %>: { <%- roleUsersKey %> }
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
<%- operation %>: {
|
|
20
|
+
TableName: dynamodbSharedLib.tableName(_izContext, 'UserRoles'),
|
|
21
|
+
<%- itemType %>: { userId, roleIdKey }
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
]);
|
|
25
|
+
await sns.publishMessage(_izContext, {
|
|
26
|
+
message: { returnResult: { userId, roleIdKey } },
|
|
27
|
+
TopicArn: snsSharedLib.snsTopicArnByFlowSchema(_izContext, '<%- flowTag %>_Out')
|
|
28
|
+
});
|
|
29
|
+
} catch (error) {
|
|
30
|
+
_izContext.logger.error('[Rbac:Process<%- flowTag %>] error:', error);
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export function renderDynamicRelationshipFlowSchema(action, flow) {
|
|
2
|
+
return [
|
|
3
|
+
'/**',
|
|
4
|
+
' * GENERATED DYNAMIC RELATIONSHIP FLOW SCHEMA',
|
|
5
|
+
` * Action: ${action}`,
|
|
6
|
+
' * Description: Handles dynamic relationship actions for all allowed RelationshipTypes via SQS/DSQ',
|
|
7
|
+
' */',
|
|
8
|
+
`export default ${JSON.stringify(flow, null, 2)};`,
|
|
9
|
+
''
|
|
10
|
+
].join('\n');
|
|
11
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { renderDynamicRelationshipFlowSchema } from './dynamicRelationshipFlowSchemaTemplate.js';
|
|
2
|
+
|
|
3
|
+
const ACTIONS = [
|
|
4
|
+
'CreateRelationship',
|
|
5
|
+
'UpdateRelationship',
|
|
6
|
+
'DeleteRelationship',
|
|
7
|
+
'GetRelationship',
|
|
8
|
+
'ChangeRelationship',
|
|
9
|
+
'MoveRelationship'
|
|
10
|
+
];
|
|
11
|
+
const MESSAGE_ATTRIBUTES = ['userId', 'correlationId'];
|
|
12
|
+
|
|
13
|
+
export const dynamicRelationshipFlowSchemaPaths = ACTIONS.map(
|
|
14
|
+
action => `app/src/schemas/FlowSchemas/generateCode/${action}.js`
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export function emitDynamicRelationshipFlowSchemas() {
|
|
18
|
+
// Keep legacy compatibility: relationship flow endpoints exist even before a relationship is declared.
|
|
19
|
+
return ACTIONS.map((action, index) => ({
|
|
20
|
+
path: dynamicRelationshipFlowSchemaPaths[index],
|
|
21
|
+
content: renderDynamicRelationshipFlowSchema(action, createDynamicRelationshipFlow(action))
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function createDynamicRelationshipFlow(action) {
|
|
26
|
+
const outputTopic = action !== 'GetRelationship';
|
|
27
|
+
const flowSteps = [
|
|
28
|
+
{
|
|
29
|
+
stepName: 'start',
|
|
30
|
+
properties: [],
|
|
31
|
+
messageAttributes: MESSAGE_ATTRIBUTES,
|
|
32
|
+
...(outputTopic ? {
|
|
33
|
+
returnValues: {
|
|
34
|
+
properties: [],
|
|
35
|
+
messageAttributes: MESSAGE_ATTRIBUTES
|
|
36
|
+
}
|
|
37
|
+
} : {})
|
|
38
|
+
}
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
if (outputTopic) {
|
|
42
|
+
flowSteps.push({
|
|
43
|
+
stepName: 'Complete',
|
|
44
|
+
event: ['extTopic'],
|
|
45
|
+
properties: [],
|
|
46
|
+
messageAttributes: MESSAGE_ATTRIBUTES
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
flowTag: action,
|
|
52
|
+
isDynamicRelationshipType: true,
|
|
53
|
+
initiateBy: 'system',
|
|
54
|
+
handleObj: 'one',
|
|
55
|
+
statusType: 'none',
|
|
56
|
+
event: outputTopic
|
|
57
|
+
? ['ownTopic']
|
|
58
|
+
: ['lambdaSyncInv', 'lambdaSyncApi', 'dsq', 'ownTopic'],
|
|
59
|
+
outputTopic,
|
|
60
|
+
stepMessageAttributes: {
|
|
61
|
+
userId: { propertyName: 'x-correlation-base-user-id', type: 'string' },
|
|
62
|
+
correlationId: { propertyName: 'x-correlation-id', type: 'string' }
|
|
63
|
+
},
|
|
64
|
+
flowSteps
|
|
65
|
+
};
|
|
66
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import ejs from 'ejs';
|
|
2
|
+
import { readFile } from 'node:fs/promises';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
renderApiFunctionYaml,
|
|
6
|
+
renderInvFunctionYaml,
|
|
7
|
+
renderSqsFunctionYaml,
|
|
8
|
+
renderWbsFunctionYaml
|
|
9
|
+
} from '../function/functionYamlArtifact.js';
|
|
10
|
+
|
|
11
|
+
const ACTIONS = [
|
|
12
|
+
'CreateRelationship',
|
|
13
|
+
'UpdateRelationship',
|
|
14
|
+
'DeleteRelationship',
|
|
15
|
+
'GetRelationship',
|
|
16
|
+
'ChangeRelationship',
|
|
17
|
+
'MoveRelationship'
|
|
18
|
+
];
|
|
19
|
+
const YAML_PATH = 'app/sls_yaml/generatedCode/source/flow-relationships.yml';
|
|
20
|
+
const TEMPLATE_URL = new URL('./templates/', import.meta.url);
|
|
21
|
+
|
|
22
|
+
export async function emitRelationshipApplicationArtifacts({ relationships, flows = [], serviceTag }) {
|
|
23
|
+
if (!Array.isArray(relationships) || !Array.isArray(flows)) {
|
|
24
|
+
throw new TypeError('relationships and flows must be arrays');
|
|
25
|
+
}
|
|
26
|
+
if (relationships.length === 0) return [];
|
|
27
|
+
|
|
28
|
+
const handlers = await Promise.all(ACTIONS.map(action => emitAction(action, relationships, flows, serviceTag)));
|
|
29
|
+
return [
|
|
30
|
+
...handlers.flatMap(handler => handler.artifacts),
|
|
31
|
+
{ path: YAML_PATH, content: handlers.flatMap(handler => handler.functions).map(renderFunction).join('\n') }
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function relationshipApplicationManagedPaths() {
|
|
36
|
+
return [
|
|
37
|
+
...ACTIONS.flatMap(action => {
|
|
38
|
+
const source = `app/src/generatedCode/FlowRelationships/${action}/source`;
|
|
39
|
+
return [
|
|
40
|
+
`${source}/${action}_Main.js`,
|
|
41
|
+
`${source}/${action}_HdrSqs.js`,
|
|
42
|
+
`${source}/${action}_HdrDsq.js`,
|
|
43
|
+
`${source}/${action}_HdrApi.js`,
|
|
44
|
+
`${source}/${action}_HdrInv.js`,
|
|
45
|
+
`${source}/${action}_WbsMain.js`,
|
|
46
|
+
`${source}/${action}_HdrWbs.js`,
|
|
47
|
+
`${source}/${action}Complete_Main.js`,
|
|
48
|
+
`${source}/${action}Complete_HdrSqs.js`
|
|
49
|
+
];
|
|
50
|
+
}),
|
|
51
|
+
YAML_PATH
|
|
52
|
+
];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async function emitAction(action, relationships, flows, serviceTag) {
|
|
56
|
+
const source = `app/src/generatedCode/FlowRelationships/${action}/source`;
|
|
57
|
+
const handlerRoot = `src/generatedCode/FlowRelationships/${action}/source`;
|
|
58
|
+
const flow = flows.find(candidate => candidate?.flowTag === action);
|
|
59
|
+
const events = normalizeEvents(flow?.event, action === 'GetRelationship'
|
|
60
|
+
? ['lambdaSyncInv', 'lambdaSyncApi', 'dsq', 'ownTopic']
|
|
61
|
+
: ['ownTopic']);
|
|
62
|
+
const shared = { flowTag: action, flowStepName: '', mainFileName: `${action}_Main`, functionName: action, startConfig: null };
|
|
63
|
+
const artifacts = [{ path: `${source}/${action}_Main.js`, content: await render(`${action}_Main.ejs`, { functionName: action, upperFunctionName: action }) }];
|
|
64
|
+
const functions = [];
|
|
65
|
+
|
|
66
|
+
if (events.includes('ownTopic')) {
|
|
67
|
+
artifacts.push(
|
|
68
|
+
{ path: `${source}/${action}_WbsMain.js`, content: await renderShared('FlowMain_Wbs.ejs', { flowTag: action, upperCaseFlowTag: action, functionName: action }) },
|
|
69
|
+
{ path: `${source}/${action}_HdrWbs.js`, content: await renderShared('FlowEndpoint_HdrWbs.ejs', { flowTag: action, upperCaseFlowTag: action, functionName: action, mainFileName: `${action}_WbsMain`, route: action }) }
|
|
70
|
+
);
|
|
71
|
+
functions.push({ type: 'wbs', functionName: `${action}HdrWbs`, handlerPath: `${handlerRoot}/${action}_HdrWbs.main`, roleName: 'FlowRelationshipRole', routeName: action });
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
for (const event of events) {
|
|
75
|
+
const handler = eventHandler(event, action, handlerRoot, relationships, serviceTag);
|
|
76
|
+
if (!handler) continue;
|
|
77
|
+
artifacts.push({ path: `${source}/${handler.fileName}.js`, content: await render(handler.template, { ...shared, queueName: handler.queueName }) });
|
|
78
|
+
functions.push(handler.descriptor);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const complete = `${action}Complete`;
|
|
82
|
+
artifacts.push(
|
|
83
|
+
{ path: `${source}/${complete}_Main.js`, content: await render(`${action}Complete_Main.ejs`, { functionName: complete, upperFunctionName: complete }) },
|
|
84
|
+
{ path: `${source}/${complete}_HdrSqs.js`, content: await renderShared('FlowHandler_HdrSqs.ejs', { ...shared, flowStepName: 'Complete', mainFileName: `${complete}_Main`, functionName: complete, queueName: `${complete}HdrSqs` }) }
|
|
85
|
+
);
|
|
86
|
+
functions.push({ type: 'sqs', functionName: `${action}CompleteHdrSqs`, handlerPath: `${handlerRoot}/${complete}_HdrSqs.main`, roleName: 'FlowRelationshipRole', queueName: `${complete}HdrSqs` });
|
|
87
|
+
return { artifacts, functions };
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function eventHandler(event, action, handlerRoot, relationships, serviceTag) {
|
|
91
|
+
if (event === 'ownTopic' || event === 'extTopic') {
|
|
92
|
+
return {
|
|
93
|
+
fileName: `${action}_HdrSqs`, template: 'FlowHandler_HdrSqs.ejs', queueName: `${action}HdrSqs`,
|
|
94
|
+
descriptor: { type: 'sqs', functionName: `${action.replace('Relationship', 'Rel')}HdrSqs`, handlerPath: `${handlerRoot}/${action}_HdrSqs.main`, roleName: 'FlowRelationshipRole', queueName: `${action}HdrSqs` }
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
if (event === 'dsq') {
|
|
98
|
+
return {
|
|
99
|
+
fileName: `${action}_HdrDsq`, template: 'FlowHandler_HdrDsq.ejs', queueName: `${action}HdrDsq`,
|
|
100
|
+
descriptor: { type: 'sqs', functionName: `${action.replace('Relationship', 'Rel')}HdrDsq`, handlerPath: `${handlerRoot}/${action}_HdrDsq.main`, roleName: 'FlowRelationshipRole', queueName: `${action}HdrDsq` }
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
if (event === 'lambdaSyncInv') {
|
|
104
|
+
return {
|
|
105
|
+
fileName: `${action}_HdrInv`, template: 'FlowHandler_HdrInv.ejs',
|
|
106
|
+
descriptor: { type: 'inv', functionName: `${action.replace('Relationship', 'Rel')}HdrInv`, handlerPath: `${handlerRoot}/${action}_HdrInv.main`, roleName: 'FlowRelationshipRole' }
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
if (event === 'lambdaSyncApi') {
|
|
110
|
+
return {
|
|
111
|
+
fileName: `${action}_HdrApi`, template: 'FlowHandler_HdrApi.ejs',
|
|
112
|
+
descriptor: {
|
|
113
|
+
type: 'api', functionName: `${action.replace('Relationship', 'Rel')}HdrApi`, handlerPath: `${handlerRoot}/${action}_HdrApi.main`, roleName: 'FlowRelationshipRole',
|
|
114
|
+
routes: relationships.map(relationship => {
|
|
115
|
+
const name = relationship.relationshipTag ?? Object.keys(relationship)[0];
|
|
116
|
+
return { path: `/${serviceTag ?? '${self:custom.iz_serviceName}'}/${name}/${action.toLowerCase().replace('relationship', '')}`, upperName: upperFirst(name) };
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function normalizeEvents(events, fallback) {
|
|
125
|
+
return events === undefined ? fallback : (Array.isArray(events) ? events : [events]);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function upperFirst(value) {
|
|
129
|
+
return value.charAt(0).toUpperCase() + value.slice(1);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
async function render(templateName, data) {
|
|
133
|
+
const template = await readFile(new URL(templateName, TEMPLATE_URL), 'utf8');
|
|
134
|
+
return ejs.render(template, data);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
async function renderShared(templateName, data) {
|
|
138
|
+
const template = await readFile(new URL(`../crud/templates/${templateName}`, import.meta.url), 'utf8');
|
|
139
|
+
return ejs.render(template, data);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function renderFunction(descriptor) {
|
|
143
|
+
if (descriptor.type === 'api') return renderApiFunctionYaml(descriptor);
|
|
144
|
+
if (descriptor.type === 'inv') return renderInvFunctionYaml(descriptor);
|
|
145
|
+
if (descriptor.type === 'wbs') return renderWbsFunctionYaml(descriptor);
|
|
146
|
+
return renderSqsFunctionYaml(descriptor);
|
|
147
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { buildGenerationPlan } from '../../plan/buildGenerationPlan.js';
|
|
2
|
+
import { commitArtifacts } from '../../output/commitArtifacts.js';
|
|
3
|
+
import { compileProject } from '../../compile/compileProject.js';
|
|
4
|
+
import { loadLocalSchemaDirectory } from '../../compile/loadSchemas.js';
|
|
5
|
+
import {
|
|
6
|
+
dynamicRelationshipFlowSchemaPaths,
|
|
7
|
+
emitDynamicRelationshipFlowSchemas
|
|
8
|
+
} from './emitDynamicRelationshipFlowSchemas.js';
|
|
9
|
+
|
|
10
|
+
export async function generateDynamicRelationshipFlowSchemas(rootPath, options = {}) {
|
|
11
|
+
const project = compileProject({ ...options, rootPath });
|
|
12
|
+
// The legacy generator creates these endpoints even with no relationships. Load now to
|
|
13
|
+
// validate the V2 source-module contract before later slices consume relationship data.
|
|
14
|
+
await loadLocalSchemaDirectory(project, 'RelationshipSchemas');
|
|
15
|
+
const plan = buildGenerationPlan(
|
|
16
|
+
project,
|
|
17
|
+
emitDynamicRelationshipFlowSchemas(),
|
|
18
|
+
{ managedPaths: dynamicRelationshipFlowSchemaPaths, managedScope: 'relationship-flow-schemas' }
|
|
19
|
+
);
|
|
20
|
+
const files = await commitArtifacts(plan);
|
|
21
|
+
|
|
22
|
+
return { project, files };
|
|
23
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { buildGenerationPlan } from '../../plan/buildGenerationPlan.js';
|
|
2
|
+
import { commitArtifacts } from '../../output/commitArtifacts.js';
|
|
3
|
+
import { compileProject } from '../../compile/compileProject.js';
|
|
4
|
+
import { loadLocalSchemaDirectory } from '../../compile/loadSchemas.js';
|
|
5
|
+
import {
|
|
6
|
+
emitRelationshipApplicationArtifacts,
|
|
7
|
+
relationshipApplicationManagedPaths
|
|
8
|
+
} from './emitRelationshipApplicationArtifacts.js';
|
|
9
|
+
|
|
10
|
+
export async function generateRelationshipApplicationArtifacts(rootPath, options = {}) {
|
|
11
|
+
const project = compileProject({ ...options, rootPath });
|
|
12
|
+
const [relationships, flows] = await Promise.all([
|
|
13
|
+
loadLocalSchemaDirectory(project, 'RelationshipSchemas'),
|
|
14
|
+
loadLocalSchemaDirectory(project, 'FlowSchemas')
|
|
15
|
+
]);
|
|
16
|
+
const artifacts = await emitRelationshipApplicationArtifacts({ relationships, flows, serviceTag: project.serviceTag });
|
|
17
|
+
const files = await commitArtifacts(buildGenerationPlan(project, artifacts, {
|
|
18
|
+
managedPaths: relationshipApplicationManagedPaths(),
|
|
19
|
+
managedScope: 'relationship-application'
|
|
20
|
+
}));
|
|
21
|
+
return { project, files };
|
|
22
|
+
}
|
|
@@ -126,7 +126,7 @@ export default async function <%- functionName %> (
|
|
|
126
126
|
const oldRelationshipSchema = await getRelationshipSchemaWithCache(_izContext, oldRelTypeAndDirection.relType);
|
|
127
127
|
_izContext.logger.debug("oldRelationshipSchema ", oldRelationshipSchema);
|
|
128
128
|
|
|
129
|
-
const newRelationshipSchema = await getRelationshipSchemaWithCache(_izContext, newRelType);
|
|
129
|
+
const newRelationshipSchema = await getRelationshipSchemaWithCache(_izContext, newRelType.relType);
|
|
130
130
|
_izContext.logger.debug("newRelationshipSchema: ", newRelationshipSchema);
|
|
131
131
|
if (!oldRelationshipSchema.hasOwnProperty('canChangeToRelTypes')) {
|
|
132
132
|
errorsFound.push(`${oldRelTypeAndDirection.relType} not have property to change to another relType`);
|
|
@@ -138,6 +138,8 @@ export default async function <%- functionName %> (
|
|
|
138
138
|
if (canChangeToRelType.relType.serviceTag === newRelType.serviceTag &&
|
|
139
139
|
canChangeToRelType.relType.relationshipTag === newRelType.relationshipTag) {
|
|
140
140
|
// check changeBy
|
|
141
|
+
// ? Legacy Code:
|
|
142
|
+
/*
|
|
141
143
|
if (canChangeToRelType.changeBy === "user") {
|
|
142
144
|
// if changeBy is user will check for importBatch callingFlow
|
|
143
145
|
if (callingFlowConfig) {
|
|
@@ -146,6 +148,12 @@ export default async function <%- functionName %> (
|
|
|
146
148
|
}
|
|
147
149
|
}
|
|
148
150
|
}
|
|
151
|
+
*/
|
|
152
|
+
// ? [Fix]: The legacy logic incorrectly blocked "user" from regular execution and allowed non-user values.
|
|
153
|
+
// ? It has been corrected to require changeBy === "user" for normal execution.
|
|
154
|
+
if (canChangeToRelType.changeBy !== "user") {
|
|
155
|
+
errorsFound.push(`CanChangeToRelType changeBy is not user`);
|
|
156
|
+
}
|
|
149
157
|
}
|
|
150
158
|
});
|
|
151
159
|
};
|
|
@@ -383,4 +391,4 @@ export default async function <%- functionName %> (
|
|
|
383
391
|
_izContext.logger.error('error ChangeRelationship: ', err)
|
|
384
392
|
throw (err)
|
|
385
393
|
}
|
|
386
|
-
}
|
|
394
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { middlewareHandler as middleware, response } from "@izara_project/izara-middleware";
|
|
2
|
+
import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
|
|
3
|
+
|
|
4
|
+
import <%= functionName %> from './<%= mainFileName %>.js';
|
|
5
|
+
|
|
6
|
+
const validatorSchema = {
|
|
7
|
+
//(<validatorSchema>)
|
|
8
|
+
<% if (typeof startConfig !== 'undefined' && startConfig !== null && startConfig.properties && startConfig.properties.length > 0) { -%>
|
|
9
|
+
type: 'object',
|
|
10
|
+
properties: {
|
|
11
|
+
<% startConfig.properties.forEach(prop => { -%>
|
|
12
|
+
<%- prop.propertyName %>: { type: '<%- prop.type || 'string' %>' },
|
|
13
|
+
<% }) -%>
|
|
14
|
+
},
|
|
15
|
+
required: [ <%- startConfig.properties.filter(p => p.required !== false).map(p => `'${p.propertyName}'`).join(', ') %> ]
|
|
16
|
+
<% } -%>
|
|
17
|
+
//(</validatorSchema>)
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
middleware.setValidatorSchema(validatorSchema, { noAuthorizer: true });
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* GENERATED HANDLER: <%= flowStepName %> (Flow: <%= flowTag %>)
|
|
24
|
+
* Triggered by: API Gateway
|
|
25
|
+
*/
|
|
26
|
+
export const main = middleware.wrap(async (event, context) => {
|
|
27
|
+
event._izContext?.logger?.debug(`[${context.awsRequestId}] Received API request in <%= flowStepName %>`);
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
const passOnProperties = [
|
|
31
|
+
event.body,
|
|
32
|
+
//(<additionalParams>)
|
|
33
|
+
//(</additionalParams>)
|
|
34
|
+
callingFlowSharedLib.addCallingFlowToPassOnProperties(event)
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
const lambdaFunctionResponse = await <%= functionName %>(
|
|
38
|
+
event._izContext,
|
|
39
|
+
...passOnProperties
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
if (lambdaFunctionResponse instanceof Error) {
|
|
43
|
+
return response.failure(lambdaFunctionResponse);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return response.success(lambdaFunctionResponse);
|
|
47
|
+
} catch (err) {
|
|
48
|
+
event._izContext?.logger?.error('Unhandled Error in <%= flowStepName %> API:', err);
|
|
49
|
+
return response.failure(err);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
@@ -94,7 +94,7 @@ export const main = middleware.wrap(async (event, context) => {
|
|
|
94
94
|
|
|
95
95
|
// add argument (to invoke lambda) to passOnProperties[]
|
|
96
96
|
passOnProperties.push(record.body.Message);
|
|
97
|
-
<% if (functionName.endsWith('Complete')) { %>
|
|
97
|
+
<% if (typeof usePassBack === 'undefined' ? functionName.endsWith('Complete') : usePassBack) { %>
|
|
98
98
|
passOnProperties.push(
|
|
99
99
|
callingFlowSharedLib.addPassBackPropertiesToPassOnProperties(
|
|
100
100
|
record.body.Message
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { middlewareHandler as middleware } from "@izara_project/izara-middleware";
|
|
2
|
+
import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
|
|
3
|
+
|
|
4
|
+
import <%= functionName %> from './<%= mainFileName %>.js';
|
|
5
|
+
|
|
6
|
+
const validatorSchema = {
|
|
7
|
+
//(<validatorSchema>)
|
|
8
|
+
<% if (typeof startConfig !== 'undefined' && startConfig !== null && startConfig.properties && startConfig.properties.length > 0) { -%>
|
|
9
|
+
type: 'object',
|
|
10
|
+
properties: {
|
|
11
|
+
<% startConfig.properties.forEach(prop => { -%>
|
|
12
|
+
<%- prop.propertyName %>: { type: '<%- prop.type || 'string' %>' },
|
|
13
|
+
<% }) -%>
|
|
14
|
+
},
|
|
15
|
+
required: [ <%- startConfig.properties.filter(p => p.required !== false).map(p => `'${p.propertyName}'`).join(', ') %> ]
|
|
16
|
+
<% } -%>
|
|
17
|
+
//(</validatorSchema>)
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
middleware.setValidatorSchema(validatorSchema);
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* GENERATED HANDLER: <%= flowStepName %> (Flow: <%= flowTag %>)
|
|
24
|
+
* Triggered by: Lambda Invocation
|
|
25
|
+
*/
|
|
26
|
+
export const main = middleware.wrap(async (event, context) => {
|
|
27
|
+
event._izContext?.logger?.debug(`[${context.awsRequestId}] Received Invocation in <%= flowStepName %>`);
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
const passOnProperties = [
|
|
31
|
+
event,
|
|
32
|
+
//(<additionalParams>)
|
|
33
|
+
//(</additionalParams>)
|
|
34
|
+
callingFlowSharedLib.addCallingFlowToPassOnProperties(event)
|
|
35
|
+
];
|
|
36
|
+
|
|
37
|
+
return await <%= functionName %>(
|
|
38
|
+
event._izContext,
|
|
39
|
+
...passOnProperties
|
|
40
|
+
);
|
|
41
|
+
} catch (err) {
|
|
42
|
+
event._izContext?.logger?.error('Unhandled Error in <%= flowStepName %> Invocation:', err);
|
|
43
|
+
throw err;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
@@ -131,6 +131,8 @@ export default async function moveRelationship(
|
|
|
131
131
|
|
|
132
132
|
if (!relationshipSchema.hasOwnProperty("moveBy") || relationshipSchema.moveBy === "none") {
|
|
133
133
|
errorsFound.push(`relationship: ${relType.relationshipTag} can't move`);
|
|
134
|
+
// ? Legacy Code:
|
|
135
|
+
/*
|
|
134
136
|
} else if (relationshipSchema.moveBy === "user") {
|
|
135
137
|
if (callingFlowConfig) {
|
|
136
138
|
if (callingFlowConfig.callingFlow !== "ImportDataTestExternalUpdateRelationshipHdrSqs") {
|
|
@@ -138,6 +140,12 @@ export default async function moveRelationship(
|
|
|
138
140
|
}
|
|
139
141
|
}
|
|
140
142
|
}
|
|
143
|
+
*/
|
|
144
|
+
// ? [Fix]: The legacy logic incorrectly blocked "user" from regular execution and allowed non-user values.
|
|
145
|
+
// ? It has been corrected to require moveBy === "user" for normal execution.
|
|
146
|
+
} else if (relationshipSchema.moveBy !== "user") {
|
|
147
|
+
errorsFound.push(`relationship: ${relType.relationshipTag} moveBy is not user`);
|
|
148
|
+
}
|
|
141
149
|
|
|
142
150
|
const links = await findLinksByObjTypes(_izContext, [firstObject.objType, secondObject.objType], relationshipSchema.links)
|
|
143
151
|
_izContext.logger.debug("links", links)
|
|
@@ -375,4 +383,4 @@ export default async function moveRelationship(
|
|
|
375
383
|
_izContext.logger.error('error ChangeRelationship: ', err)
|
|
376
384
|
throw (err)
|
|
377
385
|
}
|
|
378
|
-
}
|
|
386
|
+
}
|