@izara_project/izara-core-generate-service-code 1.0.2 → 1.0.4
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/index.js +0 -2
- package/package.json +3 -3
- package/src/GenerateCode.js +5 -4
- package/src/GenerateResources.js +4 -3
- package/src/GenerateTests.js +6 -7
- package/src/TemplateConfig.js +18 -18
- package/src/TemplateData/EndpointPerService/generateTemplateData.js +1 -1
- package/src/TemplateData/EndpointPerService/mainFunction/create/template.ejs +37 -39
- package/src/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +7 -12
- package/src/TemplateData/EndpointPerService/mainFunction/get/template.ejs +7 -10
- package/src/TemplateData/EndpointPerService/mainFunction/update/template.ejs +24 -31
- package/src/TemplateData/IntTest/generateResources/generateResources.js +4 -3
- package/src/TemplateData/IntTest/generateTests/events/data.js +3 -1
- package/src/TemplateData/IntTest/generateTests/generateTemplate.js +4 -2
- package/src/TemplateData/IntTest/generateTests/pathIntTest/data.js +2 -2
- package/src/TemplateData/IntTest/generateTests/tests/data.js +9 -8
- package/src/TemplateData/IntTest/libs/libs.js +4 -35
- package/src/TemplateData/IntTest/upload/uploadIntTest.js +4 -3
- package/src/TemplateData/externalService/lambdaRole/template.ejs +1 -3
- package/src/TemplateData/externalService/snsTopicSubscriptions/template.ejs +0 -2
- package/src/TemplateData/findData/findDataYaml/data.js +2 -1
- package/src/TemplateData/findData/mainFunction/data.js +1 -1
- package/src/TemplateData/flowSchema/CreateRecordComplete/functionYaml/data.js +9 -5
- package/src/TemplateData/flowSchema/CreateRecordComplete/handler/data.js +3 -3
- package/src/TemplateData/flowSchema/CreateRecordComplete/mainFunction/data.js +3 -3
- package/src/TemplateData/flowSchema/CreateRecordComplete/queue/data.js +3 -3
- package/src/TemplateData/flowSchema/components/upload/confirmReserved/functionYaml/data.js +11 -8
- package/src/TemplateData/flowSchema/components/upload/confirmReserved/handler/data.js +3 -3
- package/src/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/data.js +1 -1
- package/src/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/template.ejs +1 -1
- package/src/TemplateData/flowSchema/components/upload/confirmReserved/queue/data.js +3 -2
- package/src/TemplateData/flowSchema/components/upload/createObject/functionYaml/data.js +11 -7
- package/src/TemplateData/flowSchema/components/upload/createObject/handler/data.js +3 -3
- package/src/TemplateData/flowSchema/components/upload/createObject/mainFunction/data.js +4 -3
- package/src/TemplateData/flowSchema/components/upload/createObject/mainFunction/template.ejs +2 -2
- package/src/TemplateData/flowSchema/components/upload/createObjectComplete/functionYaml/data.js +9 -7
- package/src/TemplateData/flowSchema/components/upload/createObjectComplete/handler/data.js +3 -3
- package/src/TemplateData/flowSchema/components/upload/createObjectComplete/mainFunction/data.js +3 -3
- package/src/TemplateData/flowSchema/components/upload/createObjectComplete/sns-sqs/data.js +3 -3
- package/src/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/functionYaml/data.js +11 -7
- package/src/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/handler/data.js +3 -3
- package/src/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/data.js +3 -3
- package/src/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/template.ejs +2 -2
- package/src/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/queue/data.js +2 -4
- package/src/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/functionYaml/data.js +15 -9
- package/src/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/handler/data.js +3 -3
- package/src/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/data.js +2 -1
- package/src/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/template.ejs +1 -1
- package/src/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/sqs/data.js +3 -5
- package/src/TemplateData/flowSchema/components/upload/processFile/functionYml/HdrS3/data.js +10 -5
- package/src/TemplateData/flowSchema/components/upload/processFile/handler/handlerS3/data.js +2 -1
- package/src/TemplateData/flowSchema/components/upload/processFile/mainFunction/data.js +2 -1
- package/src/TemplateData/flowSchema/components/upload/processFile/mainFunction/template.ejs +0 -2
- package/src/TemplateData/flowSchema/components/upload/processFile/queue/data.js +1 -1
- package/src/TemplateData/flowSchema/components/upload/relate/S3/data.js +1 -1
- package/src/TemplateData/flowSchema/components/upload/relate/libs/data.js +1 -1
- package/src/TemplateData/flowSchema/components/upload/relate/sns-out/data.js +2 -1
- package/src/TemplateData/flowSchema/components/websocket/connect/functionYaml/data.js +9 -4
- package/src/TemplateData/flowSchema/components/websocket/connect/handler/data.js +1 -1
- package/src/TemplateData/flowSchema/components/websocket/dynamoDb/ReservedTableData.js +1 -2
- package/src/TemplateData/flowSchema/components/websocket/dynamoDb/WebSocketTaskData.js +1 -1
- package/src/TemplateData/flowSchema/components/websocket/dynamoDb/userUploadRecords.js +1 -1
- package/src/TemplateData/flowSchema/dynamoDb/data.js +2 -1
- package/src/TemplateData/flowSchema/eventBridge/functionYaml/data.js +9 -4
- package/src/TemplateData/flowSchema/eventBridge/handler/inv/data.js +2 -1
- package/src/TemplateData/flowSchema/eventBridge/mainFunction/data.js +2 -1
- package/src/TemplateData/flowSchema/externalTopic/Complete/functionYaml/data.js +9 -6
- package/src/TemplateData/flowSchema/externalTopic/Complete/handler/data.js +2 -19
- package/src/TemplateData/flowSchema/externalTopic/Complete/mainFunction/data.js +3 -1
- package/src/TemplateData/flowSchema/externalTopic/Process/functionYaml/data.js +12 -5
- package/src/TemplateData/flowSchema/externalTopic/Process/handler/data.js +4 -1
- package/src/TemplateData/flowSchema/externalTopic/sns-in-sqs/data.js +3 -1
- package/src/TemplateData/flowSchema/externalTopic/sns-out/data.js +5 -6
- package/src/TemplateData/flowSchema/flowSchemaMainFunction/data.js +5 -9
- package/src/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/functionYaml/data.js +10 -5
- package/src/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/handler/data.js +3 -3
- package/src/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/mainFunction/data.js +3 -3
- package/src/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/data.js +65 -58
- package/src/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/template.ejs +0 -4
- package/src/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/DsqHandlerTemplate.ejs +91 -0
- package/src/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/data.js +31 -16
- package/src/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/functionYaml/data.js +10 -5
- package/src/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/handler/data.js +4 -3
- package/src/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/handler/template.ejs +5 -6
- package/src/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/data.js +3 -1
- package/src/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/template.ejs +3 -3
- package/src/TemplateData/flowSchema/flowSchemaOwnTopic/sns-in/data.js +3 -3
- package/src/TemplateData/flowSchema/flowSchemaOwnTopic/sns-out/data.js +3 -3
- package/src/TemplateData/flowSchema/flowStep/functionYaml/data.js +13 -8
- package/src/TemplateData/flowSchema/flowStep/handler/data.js +3 -3
- package/src/TemplateData/flowSchema/flowStep/mainFunction/data.js +2 -1
- package/src/TemplateData/flowSchema/flowStep/sns-in/data.js +3 -3
- package/src/TemplateData/flowSchema/generateTemplateData.js +1 -6
- package/src/TemplateData/flowSchema/lambdaSync/Api/functionYaml/data.js +10 -3
- package/src/TemplateData/flowSchema/lambdaSync/Api/handler/data.js +3 -1
- package/src/TemplateData/flowSchema/lambdaSync/Inv/functionYaml/data.js +9 -3
- package/src/TemplateData/flowSchema/lambdaSync/Inv/handler/data.js +2 -1
- package/src/TemplateData/flowSchema/register/complete/functionYaml/data.js +11 -5
- package/src/TemplateData/flowSchema/register/complete/handler/data.js +2 -1
- package/src/TemplateData/flowSchema/register/complete/mainFunction/data.js +2 -1
- package/src/TemplateData/flowSchema/register/dynamoDB/register.js +2 -4
- package/src/TemplateData/flowSchema/register/sns-in/data.js +3 -4
- package/src/TemplateData/flowSchema/register/subscriptionOutAll/data.js +3 -3
- package/src/TemplateData/flowSchema/register/wbs/functionYaml/data.js +10 -5
- package/src/TemplateData/flowSchema/register/wbs/handler/data.js +2 -1
- package/src/TemplateData/flowSchema/register/wbs/mainFunction/data.js +2 -1
- package/src/TemplateData/flowSchema/statusFieldComponent/FunctionYaml/data.js +14 -6
- package/src/TemplateData/flowSchema/statusFieldComponent/Handler/data.js +4 -7
- package/src/TemplateData/flowSchema/statusFieldComponent/MainFunction/data.js +4 -3
- package/src/TemplateData/flowSchema/statusFieldComponent/sns/data.js +3 -3
- package/src/TemplateData/flowSchema/triggerCacheComponent/checkTriggerCacheComplete/functionYaml/data.js +12 -8
- package/src/TemplateData/flowSchema/triggerCacheComponent/checkTriggerCacheComplete/handler/data.js +3 -3
- package/src/TemplateData/flowSchema/triggerCacheComponent/checkTriggerCacheComplete/mainFunction/data.js +3 -3
- package/src/TemplateData/flowSchema/triggerCacheComponent/processTriggerCache/functionYaml/data.js +12 -6
- package/src/TemplateData/flowSchema/triggerCacheComponent/processTriggerCache/handler/data.js +2 -1
- package/src/TemplateData/flowSchema/triggerCacheComponent/processTriggerCache/mainFunction/data.js +2 -1
- package/src/TemplateData/flowSchema/triggerCacheComponent/triggerCacheComplete/functionYaml/data.js +11 -8
- package/src/TemplateData/flowSchema/triggerCacheComponent/triggerCacheComplete/handler/data.js +2 -1
- package/src/TemplateData/flowSchema/triggerCacheComponent/triggerCacheComplete/mainFunction/data.js +3 -3
- package/src/TemplateData/flowSchema/triggerCacheComponent/triggerCacheComplete/mainFunction/template.ejs +10 -4
- package/src/TemplateData/flowSchema/triggerCacheComponent/triggerCacheQueue/data.js +4 -11
- package/src/TemplateData/flowSchema/webSocketComplete/functionYaml/data.js +11 -8
- package/src/TemplateData/flowSchema/webSocketComplete/handler/data.js +2 -1
- package/src/TemplateData/flowSchema/webSocketComplete/mainFunction/data.js +1 -1
- package/src/TemplateData/flowSchema/webSocketComplete/sqs/data.js +3 -3
- package/src/TemplateData/generateRole/data.js +7 -2
- package/src/TemplateData/perActionComplete/create/handler/data.js +3 -3
- package/src/TemplateData/perActionComplete/create/mainFunction/data.js +3 -3
- package/src/TemplateData/perActionComplete/create/mainFunction/template.ejs +2 -2
- package/src/TemplateData/perActionComplete/create/sns-in-sqs/data.js +3 -3
- package/src/TemplateData/perActionComplete/create/sns-out/data.js +3 -3
- package/src/TemplateData/perActionComplete/create/yaml/data.js +11 -7
- package/src/TemplateData/perActionComplete/delete/handler/data.js +3 -3
- package/src/TemplateData/perActionComplete/delete/mainFunction/data.js +4 -3
- package/src/TemplateData/perActionComplete/delete/mainFunction/template.ejs +3 -4
- package/src/TemplateData/perActionComplete/delete/sns-in-sqs/data.js +4 -3
- package/src/TemplateData/perActionComplete/delete/sns-out/data.js +3 -3
- package/src/TemplateData/perActionComplete/delete/yaml/data.js +11 -7
- package/src/TemplateData/perActionComplete/get/handler/data.js +3 -3
- package/src/TemplateData/perActionComplete/get/mainFunction/data.js +3 -4
- package/src/TemplateData/perActionComplete/get/mainFunction/template.ejs +2 -2
- package/src/TemplateData/perActionComplete/get/sns-in-sqs/data.js +3 -3
- package/src/TemplateData/perActionComplete/get/sns-out/data.js +3 -3
- package/src/TemplateData/perActionComplete/get/yaml/data.js +12 -7
- package/src/TemplateData/perActionComplete/update/handler/data.js +3 -3
- package/src/TemplateData/perActionComplete/update/mainFunction/data.js +3 -3
- package/src/TemplateData/perActionComplete/update/mainFunction/template.ejs +2 -2
- package/src/TemplateData/perActionComplete/update/sns-in-sqs/data.js +3 -3
- package/src/TemplateData/perActionComplete/update/sns-out/data.js +4 -6
- package/src/TemplateData/perActionComplete/update/yaml/data.js +11 -7
- package/src/TemplateData/processLogical/handler/data.js +3 -3
- package/src/TemplateData/processLogical/mainFunction/data.js +2 -1
- package/src/TemplateData/processLogical/yaml/data.js +10 -7
- package/src/TemplateData/processLogicalPagination/DsqYaml/data.js +1 -1
- package/src/TemplateData/processLogicalPagination/handler/dsq/data.js +2 -1
- package/src/TemplateData/processLogicalPagination/handler/sqs/data.js +2 -1
- package/src/TemplateData/processLogicalPagination/mainFunction/data.js +2 -1
- package/src/TemplateData/processLogicalPagination/yaml/dsq/data.js +11 -7
- package/src/TemplateData/processLogicalPagination/yaml/sqs/data.js +9 -6
- package/src/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/data.js +12 -7
- package/src/TemplateData/relationshipPerAction/changeRelationship/action/handler/data.js +3 -3
- package/src/TemplateData/relationshipPerAction/changeRelationship/action/mainFunction/data.js +3 -3
- package/src/TemplateData/relationshipPerAction/changeRelationship/action/mainFunction/template.ejs +2 -2
- package/src/TemplateData/relationshipPerAction/changeRelationship/action/sns-in-sqs/data.js +5 -3
- package/src/TemplateData/relationshipPerAction/changeRelationship/complete/functionYaml/data.js +11 -7
- package/src/TemplateData/relationshipPerAction/changeRelationship/complete/handler/sqs/data.js +3 -3
- package/src/TemplateData/relationshipPerAction/changeRelationship/complete/mainFunction/data.js +3 -3
- package/src/TemplateData/relationshipPerAction/changeRelationship/complete/mainFunction/template.ejs +12 -11
- package/src/TemplateData/relationshipPerAction/changeRelationship/complete/sns-in-sqs/data.js +3 -3
- package/src/TemplateData/relationshipPerAction/changeRelationship/complete/sns-out/data.js +2 -1
- package/src/TemplateData/relationshipPerAction/create/action/functionYaml/data.js +20 -15
- package/src/TemplateData/relationshipPerAction/create/action/handler/data.js +4 -3
- package/src/TemplateData/relationshipPerAction/create/action/mainFunction/data.js +4 -3
- package/src/TemplateData/relationshipPerAction/create/action/mainFunction/template.ejs +2 -2
- package/src/TemplateData/relationshipPerAction/create/action/sns-in-sqs/data.js +6 -4
- package/src/TemplateData/relationshipPerAction/create/complete/functionYaml/data.js +14 -10
- package/src/TemplateData/relationshipPerAction/create/complete/handler/sqs/data.js +3 -3
- package/src/TemplateData/relationshipPerAction/create/complete/mainFunction/data.js +3 -3
- package/src/TemplateData/relationshipPerAction/create/complete/mainFunction/template.ejs +3 -2
- package/src/TemplateData/relationshipPerAction/create/complete/sns-in-sqs/data.js +3 -3
- package/src/TemplateData/relationshipPerAction/create/complete/sns-out/data.js +3 -4
- package/src/TemplateData/relationshipPerAction/delete/action/functionYaml/data.js +20 -15
- package/src/TemplateData/relationshipPerAction/delete/action/handler/data.js +4 -4
- package/src/TemplateData/relationshipPerAction/delete/action/mainFunction/data.js +4 -7
- package/src/TemplateData/relationshipPerAction/delete/action/mainFunction/template.ejs +2 -2
- package/src/TemplateData/relationshipPerAction/delete/action/sns-in-sqs/data.js +5 -3
- package/src/TemplateData/relationshipPerAction/delete/complete/functionYaml/data.js +11 -7
- package/src/TemplateData/relationshipPerAction/delete/complete/handler/sqs/data.js +2 -1
- package/src/TemplateData/relationshipPerAction/delete/complete/mainFunction/data.js +3 -3
- package/src/TemplateData/relationshipPerAction/delete/complete/mainFunction/template.ejs +4 -5
- package/src/TemplateData/relationshipPerAction/delete/complete/sns-in-sqs/data.js +3 -3
- package/src/TemplateData/relationshipPerAction/delete/complete/sns-out/data.js +3 -3
- package/src/TemplateData/relationshipPerAction/generateTemplateData.js +1 -1
- package/src/TemplateData/relationshipPerAction/get/action/functionYaml/data.js +19 -16
- package/src/TemplateData/relationshipPerAction/get/action/handler/data.js +4 -4
- package/src/TemplateData/relationshipPerAction/get/action/mainFunction/data.js +3 -4
- package/src/TemplateData/relationshipPerAction/get/action/mainFunction/template.ejs +6 -3
- package/src/TemplateData/relationshipPerAction/get/action/sns-in-sqs/data.js +5 -3
- package/src/TemplateData/relationshipPerAction/get/complete/functionYaml/data.js +13 -9
- package/src/TemplateData/relationshipPerAction/get/complete/handler/sqs/data.js +2 -1
- package/src/TemplateData/relationshipPerAction/get/complete/mainFunction/data.js +3 -3
- package/src/TemplateData/relationshipPerAction/get/complete/mainFunction/template.ejs +3 -2
- package/src/TemplateData/relationshipPerAction/get/complete/sns-in-sqs/data.js +2 -1
- package/src/TemplateData/relationshipPerAction/get/complete/sns-out/data.js +3 -3
- package/src/TemplateData/relationshipPerAction/moveRelationship/action/functionYaml/data.js +17 -13
- package/src/TemplateData/relationshipPerAction/moveRelationship/action/handler/data.js +4 -3
- package/src/TemplateData/relationshipPerAction/moveRelationship/action/mainFunction/data.js +6 -4
- package/src/TemplateData/relationshipPerAction/moveRelationship/action/mainFunction/template.ejs +6 -3
- package/src/TemplateData/relationshipPerAction/moveRelationship/action/sns-in-sqs/data.js +6 -4
- package/src/TemplateData/relationshipPerAction/moveRelationship/complete/functionYaml/data.js +13 -9
- package/src/TemplateData/relationshipPerAction/moveRelationship/complete/handler/sqs/data.js +3 -3
- package/src/TemplateData/relationshipPerAction/moveRelationship/complete/mainFunction/data.js +3 -3
- package/src/TemplateData/relationshipPerAction/moveRelationship/complete/mainFunction/template.ejs +3 -2
- package/src/TemplateData/relationshipPerAction/moveRelationship/complete/sns-in-sqs/data.js +3 -3
- package/src/TemplateData/relationshipPerAction/moveRelationship/complete/sns-out/data.js +3 -3
- package/src/TemplateData/relationshipPerAction/update/action/functionYaml/data.js +20 -15
- package/src/TemplateData/relationshipPerAction/update/action/handler/data.js +4 -4
- package/src/TemplateData/relationshipPerAction/update/action/mainFunction/data.js +4 -4
- package/src/TemplateData/relationshipPerAction/update/action/mainFunction/template.ejs +6 -3
- package/src/TemplateData/relationshipPerAction/update/action/sns-in-sqs/data.js +4 -3
- package/src/TemplateData/relationshipPerAction/update/action/sns-out/data.js +5 -6
- package/src/TemplateData/relationshipPerAction/update/complete/functionYaml/data.js +13 -10
- package/src/TemplateData/relationshipPerAction/update/complete/handler/sqs/data.js +3 -3
- package/src/TemplateData/relationshipPerAction/update/complete/mainFunction/data.js +2 -1
- package/src/TemplateData/relationshipPerAction/update/complete/mainFunction/template.ejs +3 -2
- package/src/TemplateData/relationshipPerAction/update/complete/sns-in-sqs/data.js +3 -3
- package/src/TemplateData/relationshipPerAction/update/complete/sns-out/data.js +3 -3
- package/src/TemplateData/resourceYaml/dynamodb/defaultDynamoDbTable.js +1 -1
- package/src/TemplateData/resourceYaml/dynamodb/generateDynamoPerLink.js +7 -3
- package/src/TemplateData/resourceYaml/dynamodb/mainResourcePerObjectSchemaData.js +2 -1
- package/src/TemplateData/resourceYaml/filterGenerateResource/data.js +5 -3
- package/src/TemplateData/resourceYaml/generateTemplateData.js +5 -2
- package/src/TemplateData/resourceYaml/sns-in-sqs/defaultSnsInSqsForFindDataAndProcessLogical.js +3 -3
- package/src/TemplateData/resourceYaml/sns-in-sqs/snsAndSqsPerActionData.js +4 -3
- package/src/TemplateData/resourceYaml/sns-out/data.js +3 -3
- package/src/TemplateData/resourceYaml/sns-out/defaultSnsOutForFindDataAndProcessLogical.js +2 -1
- package/src/libs/GenerateCodeLibs.js +1 -1
- package/src/libs/Libs.js +22 -0
- package/src/libs/Utils.js +4 -4
- package/src/GenerateSchema.js +0 -164
- package/src/SchemaConfig.js +0 -23
- package/src/TemplateData/EndpointPerService/mainFunction/create/backupTemplate.ejs +0 -358
- package/src/TemplateData/perActionEndpoint/generateTemplateData.js +0 -112
- package/src/TemplateData/perActionEndpoint/handler/api/data.js +0 -109
- package/src/TemplateData/perActionEndpoint/handler/api/request.json +0 -7
- package/src/TemplateData/perActionEndpoint/handler/api/template.ejs +0 -36
- package/src/TemplateData/perActionEndpoint/handler/dsq/data.js +0 -118
- package/src/TemplateData/perActionEndpoint/handler/dsq/request.json +0 -7
- package/src/TemplateData/perActionEndpoint/handler/dsq/template.ejs +0 -55
- package/src/TemplateData/perActionEndpoint/handler/inv/data.js +0 -112
- package/src/TemplateData/perActionEndpoint/handler/inv/request.json +0 -7
- package/src/TemplateData/perActionEndpoint/handler/inv/template.ejs +0 -37
- package/src/TemplateData/perActionEndpoint/handler/sqs/data.js +0 -116
- package/src/TemplateData/perActionEndpoint/handler/sqs/request.json +0 -7
- package/src/TemplateData/perActionEndpoint/handler/sqs/template.ejs +0 -57
- package/src/TemplateData/perActionEndpoint/handler/webSocket/data.js +0 -94
- package/src/TemplateData/perActionEndpoint/handler/webSocket/template.ejs +0 -61
- package/src/TemplateData/perActionEndpoint/handler/webSocketConnect/data.js +0 -54
- package/src/TemplateData/perActionEndpoint/handler/webSocketConnect/template.ejs +0 -55
- package/src/TemplateData/perActionEndpoint/libs/data.js +0 -60
- package/src/TemplateData/perActionEndpoint/libs/template.ejs +0 -46
- package/src/TemplateData/perActionEndpoint/mainFunction/create/data.js +0 -91
- package/src/TemplateData/perActionEndpoint/mainFunction/create/request.json +0 -0
- package/src/TemplateData/perActionEndpoint/mainFunction/create/template.ejs +0 -339
- package/src/TemplateData/perActionEndpoint/mainFunction/delete/data.js +0 -91
- package/src/TemplateData/perActionEndpoint/mainFunction/delete/template.ejs +0 -99
- package/src/TemplateData/perActionEndpoint/mainFunction/get/data.js +0 -92
- package/src/TemplateData/perActionEndpoint/mainFunction/get/request.json +0 -5
- package/src/TemplateData/perActionEndpoint/mainFunction/get/template.ejs +0 -116
- package/src/TemplateData/perActionEndpoint/mainFunction/get/testParam.json +0 -5
- package/src/TemplateData/perActionEndpoint/mainFunction/update/data.js +0 -85
- package/src/TemplateData/perActionEndpoint/mainFunction/update/request.json +0 -0
- package/src/TemplateData/perActionEndpoint/mainFunction/update/template.ejs +0 -166
- package/src/TemplateData/perActionEndpoint/yaml/api/data.js +0 -229
- package/src/TemplateData/perActionEndpoint/yaml/api/request.json +0 -14
- package/src/TemplateData/perActionEndpoint/yaml/api/template.ejs +0 -20
- package/src/TemplateData/perActionEndpoint/yaml/dsq/data.js +0 -234
- package/src/TemplateData/perActionEndpoint/yaml/dsq/request.json +0 -19
- package/src/TemplateData/perActionEndpoint/yaml/dsq/template.ejs +0 -17
- package/src/TemplateData/perActionEndpoint/yaml/inv/data.js +0 -207
- package/src/TemplateData/perActionEndpoint/yaml/inv/example req.js +0 -15
- package/src/TemplateData/perActionEndpoint/yaml/inv/request.json +0 -14
- package/src/TemplateData/perActionEndpoint/yaml/inv/template.ejs +0 -13
- package/src/TemplateData/perActionEndpoint/yaml/sqs/data.js +0 -237
- package/src/TemplateData/perActionEndpoint/yaml/sqs/request.json +0 -19
- package/src/TemplateData/perActionEndpoint/yaml/sqs/template.ejs +0 -17
- package/src/TemplateData/perActionEndpoint/yaml/wbs/data.js +0 -204
- package/src/TemplateData/perActionEndpoint/yaml/wbs/request.json +0 -19
- package/src/TemplateData/perActionEndpoint/yaml/wbs/template.ejs +0 -29
- package/src/TemplateData/perActionEndpoint/yaml/webSocketConnect/data.js +0 -58
- package/src/TemplateData/perActionEndpoint/yaml/webSocketConnect/template.ejs +0 -10
- package/src/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/api/data.js +0 -146
- package/src/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/api/template.ejs +0 -20
- package/src/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/dsq/data.js +0 -146
- package/src/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/dsq/template.ejs +0 -17
- package/src/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/inv/data.js +0 -146
- package/src/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/inv/template.ejs +0 -13
- package/src/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/sqs/data.js +0 -147
- package/src/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/sqs/template.ejs +0 -17
- package/src/TemplateData/relationshipPerAction/changeRelationship/action/handler/api/data.js +0 -62
- package/src/TemplateData/relationshipPerAction/changeRelationship/action/handler/api/template.ejs +0 -59
- package/src/TemplateData/relationshipPerAction/changeRelationship/action/handler/dsq/data.js +0 -63
- package/src/TemplateData/relationshipPerAction/changeRelationship/action/handler/dsq/template.ejs +0 -202
- package/src/TemplateData/relationshipPerAction/changeRelationship/action/handler/inv/data.js +0 -64
- package/src/TemplateData/relationshipPerAction/changeRelationship/action/handler/inv/template.ejs +0 -144
- package/src/TemplateData/relationshipPerAction/changeRelationship/action/handler/sqs/data.js +0 -64
- package/src/TemplateData/relationshipPerAction/changeRelationship/action/handler/sqs/template.ejs +0 -77
- package/src/TemplateData/relationshipPerAction/create/action/functionYaml/api/data.js +0 -175
- package/src/TemplateData/relationshipPerAction/create/action/functionYaml/api/template.ejs +0 -20
- package/src/TemplateData/relationshipPerAction/create/action/functionYaml/dsq/data.js +0 -176
- package/src/TemplateData/relationshipPerAction/create/action/functionYaml/dsq/template.ejs +0 -17
- package/src/TemplateData/relationshipPerAction/create/action/functionYaml/inv/data.js +0 -175
- package/src/TemplateData/relationshipPerAction/create/action/functionYaml/inv/template.ejs +0 -13
- package/src/TemplateData/relationshipPerAction/create/action/functionYaml/sqs/data.js +0 -177
- package/src/TemplateData/relationshipPerAction/create/action/functionYaml/sqs/template.ejs +0 -17
- package/src/TemplateData/relationshipPerAction/create/action/handler/api/data.js +0 -62
- package/src/TemplateData/relationshipPerAction/create/action/handler/api/request.json +0 -0
- package/src/TemplateData/relationshipPerAction/create/action/handler/api/template.ejs +0 -57
- package/src/TemplateData/relationshipPerAction/create/action/handler/dsq/data.js +0 -63
- package/src/TemplateData/relationshipPerAction/create/action/handler/dsq/request.json +0 -0
- package/src/TemplateData/relationshipPerAction/create/action/handler/dsq/template.ejs +0 -184
- package/src/TemplateData/relationshipPerAction/create/action/handler/inv/data.js +0 -64
- package/src/TemplateData/relationshipPerAction/create/action/handler/inv/request.json +0 -0
- package/src/TemplateData/relationshipPerAction/create/action/handler/inv/template.ejs +0 -126
- package/src/TemplateData/relationshipPerAction/create/action/handler/sqs/data.js +0 -64
- package/src/TemplateData/relationshipPerAction/create/action/handler/sqs/request.json +0 -0
- package/src/TemplateData/relationshipPerAction/create/action/handler/sqs/template.ejs +0 -75
- package/src/TemplateData/relationshipPerAction/delete/action/functionYaml/api/data.js +0 -178
- package/src/TemplateData/relationshipPerAction/delete/action/functionYaml/api/template.ejs +0 -20
- package/src/TemplateData/relationshipPerAction/delete/action/functionYaml/dsq/data.js +0 -176
- package/src/TemplateData/relationshipPerAction/delete/action/functionYaml/dsq/template.ejs +0 -17
- package/src/TemplateData/relationshipPerAction/delete/action/functionYaml/inv/data.js +0 -178
- package/src/TemplateData/relationshipPerAction/delete/action/functionYaml/inv/template.ejs +0 -13
- package/src/TemplateData/relationshipPerAction/delete/action/functionYaml/sqs/data.js +0 -176
- package/src/TemplateData/relationshipPerAction/delete/action/functionYaml/sqs/template.ejs +0 -17
- package/src/TemplateData/relationshipPerAction/delete/action/handler/api/data.js +0 -62
- package/src/TemplateData/relationshipPerAction/delete/action/handler/api/request.json +0 -0
- package/src/TemplateData/relationshipPerAction/delete/action/handler/api/template.ejs +0 -139
- package/src/TemplateData/relationshipPerAction/delete/action/handler/dsq/data.js +0 -63
- package/src/TemplateData/relationshipPerAction/delete/action/handler/dsq/request.json +0 -0
- package/src/TemplateData/relationshipPerAction/delete/action/handler/dsq/template.ejs +0 -182
- package/src/TemplateData/relationshipPerAction/delete/action/handler/inv/data.js +0 -64
- package/src/TemplateData/relationshipPerAction/delete/action/handler/inv/request.json +0 -0
- package/src/TemplateData/relationshipPerAction/delete/action/handler/inv/template.ejs +0 -124
- package/src/TemplateData/relationshipPerAction/delete/action/handler/sqs/data.js +0 -64
- package/src/TemplateData/relationshipPerAction/delete/action/handler/sqs/request.json +0 -0
- package/src/TemplateData/relationshipPerAction/delete/action/handler/sqs/template.ejs +0 -162
- package/src/TemplateData/relationshipPerAction/get/action/functionYaml/api/data.js +0 -168
- package/src/TemplateData/relationshipPerAction/get/action/functionYaml/api/template.ejs +0 -20
- package/src/TemplateData/relationshipPerAction/get/action/functionYaml/dsq/data.js +0 -177
- package/src/TemplateData/relationshipPerAction/get/action/functionYaml/dsq/template.ejs +0 -17
- package/src/TemplateData/relationshipPerAction/get/action/functionYaml/inv/data.js +0 -167
- package/src/TemplateData/relationshipPerAction/get/action/functionYaml/inv/template.ejs +0 -13
- package/src/TemplateData/relationshipPerAction/get/action/functionYaml/sqs/data.js +0 -166
- package/src/TemplateData/relationshipPerAction/get/action/functionYaml/sqs/template.ejs +0 -17
- package/src/TemplateData/relationshipPerAction/get/action/handler/api/data.js +0 -62
- package/src/TemplateData/relationshipPerAction/get/action/handler/api/request.json +0 -0
- package/src/TemplateData/relationshipPerAction/get/action/handler/api/template.ejs +0 -138
- package/src/TemplateData/relationshipPerAction/get/action/handler/dsq/data.js +0 -63
- package/src/TemplateData/relationshipPerAction/get/action/handler/dsq/request.json +0 -0
- package/src/TemplateData/relationshipPerAction/get/action/handler/dsq/template.ejs +0 -185
- package/src/TemplateData/relationshipPerAction/get/action/handler/inv/data.js +0 -64
- package/src/TemplateData/relationshipPerAction/get/action/handler/inv/request.json +0 -0
- package/src/TemplateData/relationshipPerAction/get/action/handler/inv/template.ejs +0 -127
- package/src/TemplateData/relationshipPerAction/get/action/handler/sqs/data.js +0 -64
- package/src/TemplateData/relationshipPerAction/get/action/handler/sqs/request.json +0 -0
- package/src/TemplateData/relationshipPerAction/get/action/handler/sqs/template.ejs +0 -165
- package/src/TemplateData/relationshipPerAction/update/action/functionYaml/api/data.js +0 -167
- package/src/TemplateData/relationshipPerAction/update/action/functionYaml/api/request.json +0 -0
- package/src/TemplateData/relationshipPerAction/update/action/functionYaml/api/template.ejs +0 -20
- package/src/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/data.js +0 -196
- package/src/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/request.json +0 -0
- package/src/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/template.ejs +0 -17
- package/src/TemplateData/relationshipPerAction/update/action/functionYaml/inv/data.js +0 -186
- package/src/TemplateData/relationshipPerAction/update/action/functionYaml/inv/request.json +0 -0
- package/src/TemplateData/relationshipPerAction/update/action/functionYaml/inv/template.ejs +0 -13
- package/src/TemplateData/relationshipPerAction/update/action/functionYaml/sqs/data.js +0 -187
- package/src/TemplateData/relationshipPerAction/update/action/functionYaml/sqs/request.json +0 -0
- package/src/TemplateData/relationshipPerAction/update/action/functionYaml/sqs/template.ejs +0 -17
- package/src/TemplateData/relationshipPerAction/update/action/handler/api/data.js +0 -78
- package/src/TemplateData/relationshipPerAction/update/action/handler/api/request.json +0 -7
- package/src/TemplateData/relationshipPerAction/update/action/handler/api/template.ejs +0 -142
- package/src/TemplateData/relationshipPerAction/update/action/handler/dsq/data.js +0 -79
- package/src/TemplateData/relationshipPerAction/update/action/handler/dsq/request.json +0 -7
- package/src/TemplateData/relationshipPerAction/update/action/handler/dsq/template.ejs +0 -188
- package/src/TemplateData/relationshipPerAction/update/action/handler/inv/data.js +0 -80
- package/src/TemplateData/relationshipPerAction/update/action/handler/inv/request.json +0 -5
- package/src/TemplateData/relationshipPerAction/update/action/handler/inv/template.ejs +0 -147
- package/src/TemplateData/relationshipPerAction/update/action/handler/sqs/data.js +0 -79
- package/src/TemplateData/relationshipPerAction/update/action/handler/sqs/request.json +0 -7
- package/src/TemplateData/relationshipPerAction/update/action/handler/sqs/template.ejs +0 -163
- package/src/TemplateData/resourceYaml/CreateSourceData.js +0 -79
- /package/src/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/{template.ejs → SqsHandlerTemplate.ejs} +0 -0
|
@@ -1,339 +0,0 @@
|
|
|
1
|
-
/* Copyright (C) 2021 Sven Mason <http://izara.io> This program is free
|
|
2
|
-
software: you can redistribute it and/or modify it under the terms of the GNU
|
|
3
|
-
Affero General Public License as published by the Free Software Foundation,
|
|
4
|
-
either version 3 of the License, or (at your option) any later version. This
|
|
5
|
-
program is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
6
|
-
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
7
|
-
PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
|
8
|
-
You should have received a copy of the GNU Affero General Public License along
|
|
9
|
-
with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
10
|
-
const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
|
|
11
|
-
const snsSharedLib = require('@izara_project/izara-core-library-sns'); const
|
|
12
|
-
asyncFlowSharedLib =
|
|
13
|
-
require('@izara_project/izara-core-library-asynchronous-flow'); const
|
|
14
|
-
callingFlowSharedLib =
|
|
15
|
-
require('@izara_project/izara-core-library-calling-flow'); const lambdaSharedLib
|
|
16
|
-
= require('@izara_project/izara-core-library-lambda'); const externalRequest =
|
|
17
|
-
require('@izara_project/izara-core-library-external-request'); const sns =
|
|
18
|
-
externalRequest.sns; const lambda = externalRequest.lambda const getObjectSchema
|
|
19
|
-
=
|
|
20
|
-
require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
|
|
21
|
-
const serviceConfigLib =
|
|
22
|
-
require('@izara_project/izara-core-library-service-schemas/src/ServiceConfig')
|
|
23
|
-
const uploadUseCase =
|
|
24
|
-
require('@izara_project/izara-core-library-service-schemas/src/libs/UploadUseCase')
|
|
25
|
-
const hash = require('@izara_project/izara-shared-core').objectHash; const
|
|
26
|
-
NoRetryError =
|
|
27
|
-
require('@izara_project/izara-core-library-core/src/NoRetryError'); const path =
|
|
28
|
-
require('path') const schemasPath = path.join(__dirname, '../schemas'); const
|
|
29
|
-
consts =
|
|
30
|
-
require('@izara_project/izara-core-library-service-schemas/src/Consts'); const
|
|
31
|
-
coreConsts = require("@izara_project/izara-core-library-core/src/Consts"); const
|
|
32
|
-
{ generateDynamoDbIdentifiers, dynamoDbIdentifiersByStorageResource,
|
|
33
|
-
collectGetData } =
|
|
34
|
-
require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs/index.js');
|
|
35
|
-
const { getGraphServiceTagWithCache, getServiceNameWithCache } =
|
|
36
|
-
require('@izara_project/izara-core-library-service-schemas/src/ServiceConfig');
|
|
37
|
-
//-----------------------------------------------------------------------------------------------------------
|
|
38
|
-
const PREFIX = { ONE: "one", MANY: "many", CREATE_OBJECT_ASYNC:
|
|
39
|
-
"createObjectAsync", CREATE_OBJECT_ASYNC_COMPLETE: "createObjectAsyncComplete" }
|
|
40
|
-
//-----------------------------------------------------------------------------------------------------------
|
|
41
|
-
const { TOPIC_NAME_GENERATE_CODE, TOPIC_NAME_GRAPH_HANDLER,
|
|
42
|
-
GRAPH_HANDLER_SERVICE_NAME } =
|
|
43
|
-
require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
44
|
-
const { createDataDetailsLib } =
|
|
45
|
-
require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs/index.js')
|
|
46
|
-
const { createLinkTypeId } =
|
|
47
|
-
require('@izara_project/izara-core-library-service-schemas/src/Utils'); const {
|
|
48
|
-
findLinksByObjTypes } =
|
|
49
|
-
require("@izara_project/izara-core-library-service-schemas/src/libs/RelSchemaLib")
|
|
50
|
-
const lodash = require("lodash") /** - all storageType( DB and Graph) use
|
|
51
|
-
objInstance({identifiers,fields}) - storageType[DB] async - storageType[Graph]
|
|
52
|
-
sync (should be have lambda complete) -- before DB and Graph have boolend check
|
|
53
|
-
(allStorageTagComplete = true) if storageType == graph set allStorageTagComplete
|
|
54
|
-
= false, and save awaitingMultiplastep
|
|
55
|
-
prefix(serviceTag_CreateObject{identifierId}) >>> in lambdaComplete resive
|
|
56
|
-
message from GrapHandler 1.1 check have returnValue.errorsFould.length > 0 --
|
|
57
|
-
Delete all awitingMultiplestep and senf message to callingFlow have errorFound.
|
|
58
|
-
1.2 check awaitingmultipleStepall finish -- Delete awaitingStep in come if have
|
|
59
|
-
other multiplestep(not finish)== not send message. --- if check
|
|
60
|
-
awaitingmultipleStepall finish not have record ===> sendmessage to callingFlow.
|
|
61
|
-
*/
|
|
62
|
-
//=========================================================================================
|
|
63
|
-
/** * * @param {*} _izContext * @param {Object} requestParams =
|
|
64
|
-
{fieldNames,relationships = []} * @param {*} callingFlowConfig */
|
|
65
|
-
module.exports.<%- functionName %>Main = async ( _izContext, requestParams,
|
|
66
|
-
callingFlowConfig ) => { try { _izContext.logger.debug("function <%-
|
|
67
|
-
functionName %>:", { requestParams, callingFlowConfig }); let errorsFound = [];
|
|
68
|
-
const userId = _izContext.correlationIds.get(coreConsts.BASE_USER_ID); const
|
|
69
|
-
targetId = _izContext.correlationIds.get(coreConsts.TARGET_ID) if (!userId) {
|
|
70
|
-
errorsFound.push("Not have userId") } const OBJECT_TYPE = "<%- objectType %>";
|
|
71
|
-
const SERVICE_TAG = process.env.iz_serviceTag; //(<beforeQuery
|
|
72
|
-
>) //(</beforeQuery
|
|
73
|
-
>) const MAIN_OBJTYPE = { objectType: OBJECT_TYPE, serviceTag: SERVICE_TAG } let
|
|
74
|
-
objectSchema = await getObjectSchema.getObjSchemaS3WithCache( _izContext,
|
|
75
|
-
MAIN_OBJTYPE ); _izContext.logger.debug("objectSchema", objectSchema); let
|
|
76
|
-
objectSchemas = uploadUseCase.generateObjectSchemaForCombineFieldNames(
|
|
77
|
-
_izContext, objectSchema ); _izContext.logger.debug("objectSchemas",
|
|
78
|
-
objectSchemas); if (objectSchema.hasOwnProperty("belongTo") && !targetId) {
|
|
79
|
-
errorsFound.push('not have targetId') } let createDataDetails = await
|
|
80
|
-
createDataDetailsLib(_izContext, objectSchemas);
|
|
81
|
-
_izContext.logger.debug("createDataDetails is =", createDataDetails); let
|
|
82
|
-
checkCorrectLinks = []; //validate linkType if
|
|
83
|
-
((requestParams.hasOwnProperty("relationships")) &&
|
|
84
|
-
(requestParams.relationships.length > 0)) { for (let relationshipProperties of
|
|
85
|
-
requestParams.relationships) { _izContext.logger.debug("relationshipProperties",
|
|
86
|
-
relationshipProperties); _izContext.logger.debug("relType",
|
|
87
|
-
relationshipProperties.relType); let getObjectRelationship = await
|
|
88
|
-
getObjectSchema.getRelationshipSchemaWithCache( _izContext,
|
|
89
|
-
relationshipProperties.relType )
|
|
90
|
-
_izContext.logger.debug("getObjectRelationship", getObjectRelationship) for
|
|
91
|
-
(const relationshipLink of Object.values(getObjectRelationship.links)) { if
|
|
92
|
-
(relationshipLink.from.linkType === "many" && relationshipLink.to.linkType ===
|
|
93
|
-
"many") { if (relationshipLink.from.requiredOnCreate === true ||
|
|
94
|
-
relationshipLink.to.requiredOnCreate === true) { errorsFound.push("error many to
|
|
95
|
-
many linkType can't have requireOnCreate === true") } } } const links = await
|
|
96
|
-
findLinksByObjTypes(_izContext, [MAIN_OBJTYPE,
|
|
97
|
-
relationshipProperties.targetObjType], getObjectRelationship.links);
|
|
98
|
-
_izContext.logger.debug("links", links) if (!links.length) {
|
|
99
|
-
errorsFound.push(`not found link between ${JSON.stringify({ mainObjType:
|
|
100
|
-
MAIN_OBJTYPE })} and ${JSON.stringify({ toObjType:
|
|
101
|
-
relationshipProperties.targetObjType })} `) } for (let link of links) { const {
|
|
102
|
-
serviceTag: fromServiceTag, objectType: fromObjectType } = MAIN_OBJTYPE; const {
|
|
103
|
-
serviceTag: toServiceTag, objectType: toObjectType } =
|
|
104
|
-
relationshipProperties.targetObjType const { serviceTag: firstServiceTag,
|
|
105
|
-
objectType: firstObjectType } = link.from.objType; const { serviceTag:
|
|
106
|
-
secondServiceTag, objectType: secondObjectType } = link.to.objType const
|
|
107
|
-
matchesFromTo = fromServiceTag === firstServiceTag && fromObjectType ===
|
|
108
|
-
firstObjectType && toServiceTag === secondServiceTag && toObjectType ===
|
|
109
|
-
secondObjectType; const matchesToFrom = fromServiceTag === secondServiceTag &&
|
|
110
|
-
fromObjectType === secondObjectType && toServiceTag === firstServiceTag &&
|
|
111
|
-
toObjectType === firstObjectType if
|
|
112
|
-
((relationshipProperties.relationshipDirection === "from" && matchesFromTo) ||
|
|
113
|
-
(relationshipProperties.relationshipDirection === "to" && matchesToFrom)) {
|
|
114
|
-
checkCorrectLinks.push(true) } else { checkCorrectLinks.push(false) } } } } for
|
|
115
|
-
(const [index, checkCorrectLink] of checkCorrectLinks.entries()) { if
|
|
116
|
-
(checkCorrectLink === false) { errorsFound.push(`relationship direction
|
|
117
|
-
${JSON.stringify(requestParams.relationships[index])} is invalid`) } }
|
|
118
|
-
_izContext.logger.debug("finish validate Relationships from RequestParams") let
|
|
119
|
-
requiredOnCreateLinks = {}; let createLinkTypeIds = []; // validate
|
|
120
|
-
relationships link let objectRelationshipSchema = await
|
|
121
|
-
getObjectSchema.getRequiredOnCreateLinksWithCache(_izContext, MAIN_OBJTYPE);
|
|
122
|
-
_izContext.logger.debug("objectRelationshipSchema", objectRelationshipSchema);
|
|
123
|
-
// validate requiredOnCreateLinks let filteredRequiredOnCreatedLinks = []; await
|
|
124
|
-
Promise.all( objectRelationshipSchema.map(async (requiredLink) => { const
|
|
125
|
-
serviceTag = await Promise.all( requiredLink.storageResourceTags.map(async
|
|
126
|
-
(storageTag) => { let storageResource =
|
|
127
|
-
requiredLink.storageResources[storageTag]; if (storageResource.storageType ===
|
|
128
|
-
consts.STORAGE_TYPES.graph) { return await
|
|
129
|
-
getGraphServiceTagWithCache(_izContext, storageResource.graphServerTag); } }) );
|
|
130
|
-
if (serviceTag.includes(GRAPH_HANDLER_SERVICE_NAME.graphHandler)) {
|
|
131
|
-
filteredRequiredOnCreatedLinks.push(requiredLink); } }) )
|
|
132
|
-
_izContext.logger.debug("filteredRequiredOnCreatedLinks",
|
|
133
|
-
filteredRequiredOnCreatedLinks); if (filteredRequiredOnCreatedLinks.length) { if
|
|
134
|
-
(!requestParams.relationships || !requestParams.relationships.length) { // in
|
|
135
|
-
case not send relationship to create with for (const requireLink of
|
|
136
|
-
filteredRequiredOnCreatedLinks) { errorsFound.push(`missing required
|
|
137
|
-
relationship of relType ${JSON.stringify(requireLink.relType)} when create`) } }
|
|
138
|
-
for (const requireLink of filteredRequiredOnCreatedLinks) { const
|
|
139
|
-
requiredOnCreateLinkTypeId = createLinkTypeId( _izContext, MAIN_OBJTYPE,
|
|
140
|
-
requireLink.other.objType, requireLink.relType, requireLink.base.direction );
|
|
141
|
-
Object.assign(requiredOnCreateLinks, { [requiredOnCreateLinkTypeId]: requireLink
|
|
142
|
-
}) } if (requestParams.hasOwnProperty("relationships") &&
|
|
143
|
-
requestParams.relationships.length) { for (const createRelationship of
|
|
144
|
-
requestParams.relationships) { const onCreateLinkTypeId = createLinkTypeId(
|
|
145
|
-
_izContext, MAIN_OBJTYPE, createRelationship.targetObjType,
|
|
146
|
-
createRelationship.relType, createRelationship.relationshipDirection ); if
|
|
147
|
-
(!requiredOnCreateLinks.hasOwnProperty(onCreateLinkTypeId)) {
|
|
148
|
-
errorsFound.push(`relType:${JSON.stringify(createRelationship.relType)} not
|
|
149
|
-
allow to create when use create action`) continue; } else {
|
|
150
|
-
createLinkTypeIds.push(onCreateLinkTypeId); } } } } // validate missing relType
|
|
151
|
-
when create that should create const remainRequiredOnCreateLinkTypeIds =
|
|
152
|
-
Object.keys(requiredOnCreateLinks) .filter(requiredInCreateLinkTypeId =>
|
|
153
|
-
!createLinkTypeIds.includes(requiredInCreateLinkTypeId)) if
|
|
154
|
-
(remainRequiredOnCreateLinkTypeIds.length) { for (const
|
|
155
|
-
remainRequiredOnCreateLinkTypeId of remainRequiredOnCreateLinkTypeIds) { const
|
|
156
|
-
missingLink = { relType:
|
|
157
|
-
requiredOnCreateLinks[remainRequiredOnCreateLinkTypeId].relType, base:
|
|
158
|
-
requiredOnCreateLinks[remainRequiredOnCreateLinkTypeId].base.objType, other:
|
|
159
|
-
requiredOnCreateLinks[remainRequiredOnCreateLinkTypeId].other.objType };
|
|
160
|
-
errorsFound.push(`Missing Link:: ${JSON.stringify(missingLink)} when create`) }
|
|
161
|
-
} _izContext.logger.debug("createLinkTypeIds", createLinkTypeIds);
|
|
162
|
-
_izContext.logger.debug("requiredOnCreateLinks", requiredOnCreateLinks); // end
|
|
163
|
-
validate let objInstanceFull = { identifiers: {}, fields: {} }; let
|
|
164
|
-
listOfRequiredOnCreate = []; let listOfOptionalOnCreate = []; let
|
|
165
|
-
allAwaitingStepsId = []; // validate single identifiers if
|
|
166
|
-
(objectSchemas.identifiers.length === 1 &&
|
|
167
|
-
!objectSchemas.identifiers[0].hasOwnProperty("fieldNames")) { const identifier =
|
|
168
|
-
objectSchemas.identifiers[0]; _izContext.logger.debug(":::::case single
|
|
169
|
-
identifer:::::", identifier); if
|
|
170
|
-
(objectSchemas.fieldNames[identifier.fieldName].hasOwnProperty("randomOnCreate"))
|
|
171
|
-
{ if ((objectSchemas.fieldNames[identifier.fieldName].randomOnCreate == true)) {
|
|
172
|
-
Object.assign(requestParams.fieldNames, { [identifier.fieldName]: hash({
|
|
173
|
-
fieldNames: identifier, // uniqueRequestId: _izContext.uniqueRequestId,
|
|
174
|
-
callingFlowConfig: callingFlowConfig }) }); _izContext.logger.debug("Assign
|
|
175
|
-
requestParams", requestParams) } else if
|
|
176
|
-
((objectSchemas.fieldNames[identifier.fieldName].randomOnCreate == false) ||
|
|
177
|
-
(objectSchemas.fieldNames[identifier.fieldName].randomOnCreate == null)) { if
|
|
178
|
-
((objectSchemas.fieldNames[identifier.fieldName].requiredOnCreate == true) &&
|
|
179
|
-
(objectSchemas.fieldNames[identifier.fieldName].canUpdate == false)) { // check
|
|
180
|
-
Fns have resive if
|
|
181
|
-
(requestParams.fieldNames.hasOwnProperty([identifier.fieldName])) {
|
|
182
|
-
_izContext.logger.debug("identifier is exist:", { [identifier.fieldName]:
|
|
183
|
-
requestParams.fieldNames[identifier.fieldName] }); } else {
|
|
184
|
-
errorsFound.push("[invalid]requestParams not have data fieldNames of
|
|
185
|
-
requriedOnCreate"); } } }; } else if
|
|
186
|
-
(objectSchemas.fieldNames[identifier.fieldName].hasOwnProperty("hashOnCreate"))
|
|
187
|
-
{ if (objectSchemas.fieldNames[identifier.fieldName].hashOnCreate.length &&
|
|
188
|
-
objectSchemas.fieldNames[identifier.fieldName].hashOnCreate.length > 0) { for
|
|
189
|
-
(const fieldName of objectSchemas.fieldNames[identifier.fieldName].hashOnCreate)
|
|
190
|
-
{ Object.assign( requestParams.fieldNames, { [identifier.fieldName]: hash({
|
|
191
|
-
[fieldName]: requestParams.fieldNames[fieldName] }) } ) } } else {
|
|
192
|
-
errorsFound.push("[invalid] no data to hash for create") } } else { if
|
|
193
|
-
((objectSchemas.fieldNames[identifier.fieldName].requiredOnCreate === false) &&
|
|
194
|
-
(objectSchemas.fieldNames[identifier.fieldName].optionalOnCreate === false) &&
|
|
195
|
-
(objectSchemas.fieldNames[identifier.fieldName].canUpdate === false) &&
|
|
196
|
-
objectSchemas.fieldNames[identifier.fieldName].hashOnCreate === false) {
|
|
197
|
-
errorsFound.push("[invalid]case single identifier invalid objectSchemass"); };
|
|
198
|
-
}; } _izContext.logger.debug("requestParams is:", requestParams); // check
|
|
199
|
-
settingObjSchemas for (let [keyFieldNames, valueFieldNames] of
|
|
200
|
-
Object.entries(objectSchemas.fieldNames)) { if
|
|
201
|
-
(valueFieldNames.hasOwnProperty("randomOnCreate") &&
|
|
202
|
-
valueFieldNames.randomOnCreate === true) {
|
|
203
|
-
listOfRequiredOnCreate.push(keyFieldNames) }; if
|
|
204
|
-
(valueFieldNames.hasOwnProperty("requiredOnCreate") &&
|
|
205
|
-
valueFieldNames.requiredOnCreate === true) {
|
|
206
|
-
listOfRequiredOnCreate.push(keyFieldNames) }; if
|
|
207
|
-
(valueFieldNames.hasOwnProperty("hashOnCreate") &&
|
|
208
|
-
valueFieldNames.hashOnCreate.length) {
|
|
209
|
-
listOfRequiredOnCreate.push(keyFieldNames) } if
|
|
210
|
-
(valueFieldNames.hasOwnProperty("optionalOnCreate") &&
|
|
211
|
-
valueFieldNames.optionalOnCreate === true) { if
|
|
212
|
-
((valueFieldNames.requiredOnCreate === false) &&
|
|
213
|
-
valueFieldNames.optionalOnCreate === true) {
|
|
214
|
-
listOfOptionalOnCreate.push(keyFieldNames) }; }; }; // end iteration of
|
|
215
|
-
fieldNames _izContext.logger.debug("listOfRequriedOnCreate",
|
|
216
|
-
listOfRequiredOnCreate); _izContext.logger.debug("listOfOptionalOnCreate",
|
|
217
|
-
listOfOptionalOnCreate); for (let fieldName of
|
|
218
|
-
Object.keys(requestParams.fieldNames)) { if
|
|
219
|
-
(!listOfRequiredOnCreate.includes(fieldName)) { if
|
|
220
|
-
(!listOfOptionalOnCreate.includes(fieldName)) { errorsFound.push("[invalid] over
|
|
221
|
-
fieldNames create object"); } }; if (listOfOptionalOnCreate.length > 0 &&
|
|
222
|
-
listOfRequiredOnCreate.includes(fieldName)) { //(<optionalParams
|
|
223
|
-
>) //(</optionalParams
|
|
224
|
-
>) }; if (objectSchemas.identifierFieldNames.includes(fieldName)) {
|
|
225
|
-
_izContext.logger.debug("identifiers is", fieldName);
|
|
226
|
-
Object.assign(objInstanceFull.identifiers, { [fieldName]:
|
|
227
|
-
requestParams.fieldNames[fieldName] }); }; if (errorsFound.length > 0) {
|
|
228
|
-
_izContext.logger.debug("HaveError::", errorsFound); break }; }; // end loop let
|
|
229
|
-
listOfObjectForCreates = []; let objInstanceFullForDynamoDb =
|
|
230
|
-
lodash.cloneDeep(objInstanceFull) let objInstanceFullForGraph =
|
|
231
|
-
lodash.cloneDeep(objInstanceFull) if (errorsFound.length == 0) { for (let
|
|
232
|
-
[storageTag, createDataDetail] of Object.entries(createDataDetails)) { if
|
|
233
|
-
(createDataDetail.storageType == consts.STORAGE_TYPES.dynamoDB) {
|
|
234
|
-
_izContext.logger.debug("::::::DynamoDB::::::", { storageTag, objInstanceFull
|
|
235
|
-
}); Object.assign(objInstanceFullForDynamoDb.fields,
|
|
236
|
-
createObjInstanceFullFieldsByStorageTag(_izContext, storageTag,
|
|
237
|
-
createDataDetail)) _izContext.logger.debug("objInstanceFull before create item
|
|
238
|
-
in dynamoDB", objInstanceFullForDynamoDb) let identifiersForCreateData = await
|
|
239
|
-
dynamoDbIdentifiersByStorageResource( _izContext, objectSchema,
|
|
240
|
-
createDataDetails, objInstanceFullForDynamoDb.identifiers )
|
|
241
|
-
_izContext.logger.debug("identifiersForCreateData", identifiersForCreateData);
|
|
242
|
-
await dynamodbSharedLib.putItem( _izContext, await dynamodbSharedLib.tableName(
|
|
243
|
-
_izContext, createDataDetail.tableName ), { ...identifiersForCreateData,
|
|
244
|
-
...objInstanceFullForDynamoDb.fields } ); } else if
|
|
245
|
-
(createDataDetail.storageType == consts.STORAGE_TYPES.graph) {
|
|
246
|
-
_izContext.logger.debug("::::::Graph::::::", { storageTag, objInstanceFull });
|
|
247
|
-
Object.assign(objInstanceFullForGraph.fields,
|
|
248
|
-
createObjInstanceFullFieldsByStorageTag(_izContext, storageTag,
|
|
249
|
-
createDataDetail)) _izContext.logger.debug("objInstanceFull before send to
|
|
250
|
-
Graph", objInstanceFullForGraph) // allStorageTagComplete = false;
|
|
251
|
-
allAwaitingStepsId.push(await asyncFlowSharedLib.createAwaitingStepId( (hash({
|
|
252
|
-
objType: MAIN_OBJTYPE, graphServerTag: storageTag, identifiers:
|
|
253
|
-
objInstanceFullForGraph.identifiers })), PREFIX.CREATE_OBJECT_ASYNC ));
|
|
254
|
-
listOfObjectForCreates.push({ [storageTag]: { objInstanceFull: { identifiers:
|
|
255
|
-
objInstanceFullForGraph.identifiers, fields: objInstanceFullForGraph.fields },
|
|
256
|
-
allStorageTagComplete: false } }); _izContext.logger.debug("FIRST",
|
|
257
|
-
listOfObjectForCreates) };
|
|
258
|
-
_izContext.logger.debug("[1]listOfObjectForCreates:::", listOfObjectForCreates);
|
|
259
|
-
}; }; function createObjInstanceFullFieldsByStorageTag(_izContext, storageTag,
|
|
260
|
-
createDataDetail) {
|
|
261
|
-
_izContext.logger.debug("createObjInstanceFullFieldsByStorageTag : ", {
|
|
262
|
-
storageTag, createDataDetail }) let fields = {}; for (let fieldName of
|
|
263
|
-
Object.keys(requestParams.fieldNames)) { if
|
|
264
|
-
((createDataDetails[storageTag].fieldNames.includes(fieldName)) &&
|
|
265
|
-
(createDataDetail.fieldNames.includes(fieldName))) { if
|
|
266
|
-
(!objInstanceFull.identifiers.hasOwnProperty(fieldName)) { if
|
|
267
|
-
(!fields.hasOwnProperty(fieldName)) { Object.assign(fields, { [fieldName]:
|
|
268
|
-
requestParams.fieldNames[fieldName] }) } } } } _izContext.logger.debug({ fields
|
|
269
|
-
}) return fields } /// step save awiatingMultipleStep of storageType graph
|
|
270
|
-
........................................................... await
|
|
271
|
-
asyncFlowSharedLib.createAwaitingMultipleSteps( _izContext, allAwaitingStepsId,
|
|
272
|
-
asyncFlowSharedLib.createPendingStepId((hash({ objType: MAIN_OBJTYPE,
|
|
273
|
-
identifiers: objInstanceFull.identifiers })),
|
|
274
|
-
PREFIX.CREATE_OBJECT_ASYNC_COMPLETE) );
|
|
275
|
-
//............................................................................................................
|
|
276
|
-
// process storageType : graph let messageObject = {}; for (let objectCreate of
|
|
277
|
-
listOfObjectForCreates) { for (let [graphServiceName, objecForCreate] of
|
|
278
|
-
Object.entries(objectCreate)) { _izContext.logger.debug("Loop each graph:", {
|
|
279
|
-
[graphServiceName]: objecForCreate }); if (objecForCreate.allStorageTagComplete
|
|
280
|
-
== false) { // needless check because in listOfObjectForCreates push case graph
|
|
281
|
-
only! messageObject = { objType: MAIN_OBJTYPE, objInstanceFull:
|
|
282
|
-
objecForCreate.objInstanceFull, relationships: requestParams.relationships || []
|
|
283
|
-
}; }; if (errorsFound.length > 0) { break; } else {
|
|
284
|
-
_izContext.logger.debug("SENT MESSAGE EACH GRAPH::::", { graphServiceName,
|
|
285
|
-
messageObject, callingFlowConfig }) Object.assign(messageObject, { settings: {
|
|
286
|
-
updatePropertiesOnMatch: false }, originTimestamp: Date.now() }); messageObject
|
|
287
|
-
= callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject( messageObject,
|
|
288
|
-
callingFlowSharedLib.addParentCallingFlowConfig( callingFlowConfig, // resive
|
|
289
|
-
parent callingFlowConfig. callingFlowSharedLib.createCallingFlowConfig( //
|
|
290
|
-
callinfflow own service await lambdaSharedLib.lambdaFunctionName(_izContext,
|
|
291
|
-
TOPIC_NAME_GENERATE_CODE.createNodeComplete), {} ) ) ); let
|
|
292
|
-
messageToCreateObject = { Message: JSON.stringify(messageObject), TopicArn:
|
|
293
|
-
await snsSharedLib.snsTopicArn(_izContext,
|
|
294
|
-
TOPIC_NAME_GRAPH_HANDLER.inCreateNode, graphServiceName) };
|
|
295
|
-
_izContext.logger.debug("RequestParams before send to sqs messageToCreateObject
|
|
296
|
-
::::::: ", messageToCreateObject); await sns.publishAsync(_izContext,
|
|
297
|
-
messageToCreateObject); }; }; // end loop of objectCreate. if
|
|
298
|
-
(errorsFound.length > 0) { break; } }; // end loop listOfObjectForCreates if
|
|
299
|
-
(errorsFound.length > 0) { _izContext.logger.debug("Case have errorFound:::",
|
|
300
|
-
errorsFound); // remove awaitngMultiplestep. [[[[[[[open when not test
|
|
301
|
-
lolcal.]]]]]]] await asyncFlowSharedLib.clearAllAwaitingSteps( _izContext,
|
|
302
|
-
asyncFlowSharedLib.createPendingStepId((hash({ objType: MAIN_OBJTYPE,
|
|
303
|
-
identifiers: objInstanceFull.identifiers })),
|
|
304
|
-
PREFIX.CREATE_OBJECT_ASYNC_COMPLETE)); // pendingStepId // send message to
|
|
305
|
-
OutCreateObjectComplete. //.. messageObject = { objType: MAIN_OBJTYPE,
|
|
306
|
-
identifiers: null, // or {} errorsFound: errorsFound }; // pass back property.
|
|
307
|
-
messageObject =
|
|
308
|
-
callingFlowSharedLib.addPassBackPropertiesToSnsResponseMessageObject(callingFlowConfig,
|
|
309
|
-
messageObject); let messageAttributes =
|
|
310
|
-
callingFlowSharedLib.addCallingFlowToSnsResponseMessageAttributes(callingFlowConfig,
|
|
311
|
-
{}); let sendMessageOutCreateObjectComplete = { Message:
|
|
312
|
-
JSON.stringify(messageObject), MessageAttributes:
|
|
313
|
-
sns.createStringMessageAttributes(_izContext, messageAttributes), TopicArn:
|
|
314
|
-
await snsSharedLib.snsTopicArn(_izContext,
|
|
315
|
-
TOPIC_NAME_GENERATE_CODE.outCreateNodeComplete) }; _izContext.logger.debug("Send
|
|
316
|
-
message to OutCreateObjectComplete :::>", sendMessageOutCreateObjectComplete)
|
|
317
|
-
await sns.publishAsync(_izContext, sendMessageOutCreateObjectComplete); return {
|
|
318
|
-
objType: MAIN_OBJTYPE, fieldNames: requestParams.fieldNames, relationship:
|
|
319
|
-
requestParams.relationships, status: "error", errorsFound: errorsFound } } else
|
|
320
|
-
{ if (allAwaitingStepsId.length == 0 && listOfObjectForCreates.length == 0) {
|
|
321
|
-
let messageObject = { objType: { objectType: OBJECT_TYPE, serviceTag:
|
|
322
|
-
SERVICE_TAG }, objInstanceFull: { identifiers:
|
|
323
|
-
objInstanceFullForDynamoDb.identifiers, fields:
|
|
324
|
-
objInstanceFullForDynamoDb.fields } } if
|
|
325
|
-
(callingFlowConfig[callingFlowSharedLib.consts.CALLINGFLOW_PROPERTYNAME]) { //
|
|
326
|
-
send message to SNS OutCreateNodeComplete _izContext.logger.debug("HAVE
|
|
327
|
-
CallingFlow"); messageObject =
|
|
328
|
-
callingFlowSharedLib.addPassBackPropertiesToSnsResponseMessageObject(callingFlowConfig,
|
|
329
|
-
messageObject); let messageAttributes =
|
|
330
|
-
callingFlowSharedLib.addCallingFlowToSnsResponseMessageAttributes(callingFlowConfig,
|
|
331
|
-
{}); let outCreateNodeCompleteTopic = await snsSharedLib.snsTopicArn(_izContext,
|
|
332
|
-
TOPIC_NAME_GENERATE_CODE.outCreateNodeComplete) let messageParams = { Message:
|
|
333
|
-
JSON.stringify(messageObject), MessageAttributes:
|
|
334
|
-
sns.createStringMessageAttributes(_izContext, messageAttributes), TopicArn:
|
|
335
|
-
outCreateNodeCompleteTopic, }; _izContext.logger.debug("messageParams
|
|
336
|
-
OutCreateNode ::::::: ", messageParams); await sns.publishAsync(_izContext,
|
|
337
|
-
messageParams); } } return { objType: MAIN_OBJTYPE, fieldNames:
|
|
338
|
-
requestParams.fieldNames, relationship: requestParams.relationships, status:
|
|
339
|
-
"complete", errorsFound: errorsFound } } } catch (err) { throw (err) } }
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (C) 2020 Sven Mason <http://izara.io>
|
|
3
|
-
|
|
4
|
-
This program is free software: you can redistribute it and/or modify
|
|
5
|
-
it under the terms of the GNU Affero General Public License as
|
|
6
|
-
published by the Free Software Foundation, either version 3 of the
|
|
7
|
-
License, or (at your option) any later version.
|
|
8
|
-
|
|
9
|
-
This program is distributed in the hope that it will be useful,
|
|
10
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
GNU Affero General Public License for more details.
|
|
13
|
-
|
|
14
|
-
You should have received a copy of the GNU Affero General Public License
|
|
15
|
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
const path = require('path');
|
|
19
|
-
|
|
20
|
-
const {
|
|
21
|
-
ACTIONS,
|
|
22
|
-
HANDLER
|
|
23
|
-
} = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
24
|
-
// const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase, firstLetterUpperCase } = require("../#utils");
|
|
25
|
-
// const { DEFAULT_HANDLER_PER_ACTION, SOURCE_PATH } = require("../#const");
|
|
26
|
-
const {
|
|
27
|
-
firstLetterLowerCase: lowerCase,
|
|
28
|
-
firstLetterUpperCase: upperCase,
|
|
29
|
-
firstLetterUpperCase,
|
|
30
|
-
checkOverWriteGenerateMainFunction
|
|
31
|
-
} = require('../../../../../MainLibs/src/Consts.js').utils;
|
|
32
|
-
const { DEFAULT_HANDLER_PER_ACTION, SOURCE_PATH } =
|
|
33
|
-
require('../../../../../MainLibs/src/Consts.js').consts;
|
|
34
|
-
|
|
35
|
-
const templatePath = path.join(__dirname, 'template.ejs');
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* receive objectSchema
|
|
39
|
-
* create data for hdrInv template
|
|
40
|
-
*
|
|
41
|
-
* @param {Object} objectSchema
|
|
42
|
-
* @return {{ templatePath, templateData, setting } }
|
|
43
|
-
*/
|
|
44
|
-
async function data(_izContext, objectSchema, srcPath) {
|
|
45
|
-
if (
|
|
46
|
-
objectSchema.overwriteGeneratedMainFunction?.length &&
|
|
47
|
-
objectSchema.overwriteGeneratedMainFunction.includes(ACTIONS.delete)
|
|
48
|
-
) {
|
|
49
|
-
return [];
|
|
50
|
-
} else {
|
|
51
|
-
return [
|
|
52
|
-
await createParamForCreateSource(
|
|
53
|
-
_izContext,
|
|
54
|
-
objectSchema,
|
|
55
|
-
ACTIONS.delete,
|
|
56
|
-
srcPath
|
|
57
|
-
)
|
|
58
|
-
];
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
async function createParamForCreateSource(
|
|
63
|
-
_izContext,
|
|
64
|
-
objectSchema,
|
|
65
|
-
action,
|
|
66
|
-
srcPath
|
|
67
|
-
) {
|
|
68
|
-
// let objectType = objectSchema.objectType;
|
|
69
|
-
let objectType = objectSchema.objectType;
|
|
70
|
-
let groupBy = objectSchema?.shortNameObjectType
|
|
71
|
-
? objectSchema.shortNameObjectType
|
|
72
|
-
: objectSchema.objectType;
|
|
73
|
-
let functionName = objectType + upperCase(action);
|
|
74
|
-
return {
|
|
75
|
-
templatePath: templatePath,
|
|
76
|
-
templateData: {
|
|
77
|
-
functionName: functionName,
|
|
78
|
-
objectType: objectType,
|
|
79
|
-
roleName: groupBy,
|
|
80
|
-
action: action
|
|
81
|
-
},
|
|
82
|
-
setting: {
|
|
83
|
-
savePath: path.join(srcPath, SOURCE_PATH.lambdaPerAction),
|
|
84
|
-
saveFileName: `${upperCase(objectSchema.objectType)}${upperCase(action)}_Main`,
|
|
85
|
-
fileExtension: '.js',
|
|
86
|
-
isAppend: false
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
module.exports = data;
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/* Copyright (C) 2021 Sven Mason <http://izara.io> This program is free
|
|
2
|
-
software: you can redistribute it and/or modify it under the terms of the GNU
|
|
3
|
-
Affero General Public License as published by the Free Software Foundation,
|
|
4
|
-
either version 3 of the License, or (at your option) any later version. This
|
|
5
|
-
program is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
6
|
-
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
7
|
-
PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
|
8
|
-
You should have received a copy of the GNU Affero General Public License along
|
|
9
|
-
with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
10
|
-
const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
|
|
11
|
-
const snsSharedLib = require('@izara_project/izara-core-library-sns'); const
|
|
12
|
-
asyncFlowSharedLib =
|
|
13
|
-
require('@izara_project/izara-core-library-asynchronous-flow'); const
|
|
14
|
-
callingFlowSharedLib =
|
|
15
|
-
require('@izara_project/izara-core-library-calling-flow'); const lambdaSharedLib
|
|
16
|
-
= require('@izara_project/izara-core-library-lambda'); const sns =
|
|
17
|
-
require('@izara_project/izara-core-library-external-request/src/resources/Sns');
|
|
18
|
-
const snsSharedLib = require('@izara_project/izara-shared/src/SnsSharedLib');
|
|
19
|
-
const getObjectSchema =
|
|
20
|
-
require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
|
|
21
|
-
const serviceConfigLib =
|
|
22
|
-
require('@izara_project/izara-core-library-service-schemas/src/ServiceConfig')
|
|
23
|
-
const uploadUseCase =
|
|
24
|
-
require('@izara_project/izara-core-library-service-schemas/src/libs/UploadUseCase')
|
|
25
|
-
const hash = require('@izara_project/izara-shared-core').objectHash; const
|
|
26
|
-
NoRetryError =
|
|
27
|
-
require('@izara_project/izara-core-library-core/src/NoRetryError'); const path =
|
|
28
|
-
require('path') const schemasPath = path.join(__dirname, '../schemas'); const
|
|
29
|
-
consts =
|
|
30
|
-
require('@izara_project/izara-core-library-service-schemas/src/Consts'); const
|
|
31
|
-
coreConsts = require("@izara_project/izara-core-library-core/src/Consts"); const
|
|
32
|
-
{ generateDynamoDbIdentifiers, dynamoDbIdentifiersByStorageResource,
|
|
33
|
-
collectGetData } =
|
|
34
|
-
require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs/index.js');
|
|
35
|
-
const { getGraphServiceTagWithCache, getServiceNameWithCache } =
|
|
36
|
-
require('@izara_project/izara-core-library-service-schemas/src/ServiceConfig');
|
|
37
|
-
const { TOPIC_NAME_GENERATE_CODE, TOPIC_NAME_GRAPH_HANDLER } =
|
|
38
|
-
require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
39
|
-
const { createDeleteDataDetail } =
|
|
40
|
-
require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs/index.js')
|
|
41
|
-
/** * * @param {*} _izContext * @param {Object} requestParams = {identifiers} *
|
|
42
|
-
@param {*} callingFlowConfig */ module.exports.<%- functionName %>Main = async (
|
|
43
|
-
_izContext, requestParams, callingFlowConfig ) => { try {
|
|
44
|
-
_izContext.logger.debug("function:<%- functionName %>Main::" , { requestParams:
|
|
45
|
-
requestParams, callingFlowConfig: callingFlowConfig }); let errorsFound = []
|
|
46
|
-
const userId = _izContext.correlationIds.get(coreConsts.BASE_USER_ID); if
|
|
47
|
-
(!userId){ errorsFound.push("not have userId"); } const OBJECT_TYPE = "<%-
|
|
48
|
-
objectType %>"; const SERVICE_TAG = process.env.iz_serviceTag; //(<beforeQuery
|
|
49
|
-
>) //(</beforeQuery
|
|
50
|
-
>) let messageAttributes; _izContext.logger.debug("messageAttributes",
|
|
51
|
-
messageAttributes); let objectSchema = await
|
|
52
|
-
getObjectSchema.getObjSchemaS3WithCache(_izContext, { objectType: OBJECT_TYPE,
|
|
53
|
-
serviceTag: SERVICE_TAG }) _izContext.logger.debug("objectSchema", objectSchema)
|
|
54
|
-
/* create deleteDataDetail that decade what storage that have to access or not
|
|
55
|
-
becuase it only use identifier and dont care fieldName */ let deleteDataDetails
|
|
56
|
-
= await createDeleteDataDetail(_izContext, objectSchema);
|
|
57
|
-
_izContext.logger.debug("deleteDataDetails", deleteDataDetails); // validate
|
|
58
|
-
objectSchema that canDelete or not if (objectSchema.canDelete === false ||
|
|
59
|
-
objectSchema.canDelete == null) { errorsFound.push("this objectSchema can't
|
|
60
|
-
delete") } if (errorsFound.length) { let deleteNodeCompleteMessage = { objType:
|
|
61
|
-
{ objectType: OBJECT_TYPE, serviceTag: SERVICE_TAG }, identifiers:
|
|
62
|
-
requestParams.identifiers, status: "error", errorsFound };
|
|
63
|
-
deleteNodeCompleteMessage =
|
|
64
|
-
callingFlowSharedLib.addPassBackPropertiesToSnsResponseMessageObject(callingFlowConfig,
|
|
65
|
-
deleteNodeCompleteMessage); let messageParams = { Message:
|
|
66
|
-
JSON.stringify(deleteNodeCompleteMessage), MessageAttribute:
|
|
67
|
-
sns.createStringMessageAttributes(_izContext, messageAttributes), TopicArn:
|
|
68
|
-
await snsSharedLib.snsTopicArn(_izContext,
|
|
69
|
-
TOPIC_NAME_GENERATE_CODE.deleteNodeComplete) }
|
|
70
|
-
_izContext.logger.debug("messageParams OutDeleteNodeComplete::", messageParams);
|
|
71
|
-
await sns.publishAsync(_izContext, messageParams); return
|
|
72
|
-
deleteNodeCompleteMessage }; for await (const [storageTag, deleteDataDetail] of
|
|
73
|
-
Object.entries(deleteDataDetails)) { if (deleteDataDetail.storageType ===
|
|
74
|
-
consts.STORAGE_TYPES.dynamoDB) { _izContext.logger.debug("dynamoDb process") let
|
|
75
|
-
identifiersForDeleteData = await dynamoDbIdentifiersByStorageResource(
|
|
76
|
-
_izContext, objectSchema, deleteDataDetail, requestParams.identifiers )
|
|
77
|
-
_izContext.logger.debug("identifiersForDeleteData", identifiersForDeleteData) //
|
|
78
|
-
deleteItem in dynamo await dynamodbSharedLib.deleteItem(_izContext, await
|
|
79
|
-
dynamodbSharedLib.tableName(_izContext, deleteDataDetail.tableName),
|
|
80
|
-
identifiersForDeleteData ); } else if (deleteDataDetail.storageType ===
|
|
81
|
-
consts.STORAGE_TYPES.graph) { _izContext.logger.debug("graph process") let
|
|
82
|
-
deleteNodeParams = { objType: { objectType: OBJECT_TYPE, serviceTag: SERVICE_TAG
|
|
83
|
-
}, identifiers: requestParams.identifiers } deleteNodeParams =
|
|
84
|
-
callingFlowSharedLib.addCallingFlowToSnsResponseMessageAttributes(
|
|
85
|
-
deleteNodeParams, callingFlowSharedLib.addParentCallingFlowConfig(
|
|
86
|
-
callingFlowConfig, callingFlowSharedLib.createCallingFlowConfig( await
|
|
87
|
-
lambdaSharedLib.lambdaFunctionName(_izContext,
|
|
88
|
-
TOPIC_NAME_GENERATE_CODE.deleteNodeComplete), {} ) ) )
|
|
89
|
-
_izContext.logger.debug("messageObject before send message: ",
|
|
90
|
-
deleteNodeParams); let deleteNodeMessageBody = { Message:
|
|
91
|
-
JSON.stringify(deleteNodeParams), MessageAttributes:
|
|
92
|
-
sns.createStringMessageAttributes(_izContext, messageAttributes), TopicArn:
|
|
93
|
-
await snsSharedLib.snsTopicArn(_izContext,
|
|
94
|
-
TOPIC_NAME_GRAPH_HANDLER.inDeleteNode, storageTag) }
|
|
95
|
-
_izContext.logger.debug("request message params before send to IndeleteNode::",
|
|
96
|
-
deleteNodeMessageBody); let resSns = await sns.publishAsync(_izContext,
|
|
97
|
-
deleteNodeMessageBody) _izContext.logger.debug('reSNS send to topic InDeleteNode
|
|
98
|
-
finish', resSns) } } } catch (err) { throw (err) } } <% function
|
|
99
|
-
uppercase(text){ return text.charAt(0).toUpperCase() + text.slice(1) } %>
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (C) 2020 Sven Mason <http://izara.io>
|
|
3
|
-
|
|
4
|
-
This program is free software: you can redistribute it and/or modify
|
|
5
|
-
it under the terms of the GNU Affero General Public License as
|
|
6
|
-
published by the Free Software Foundation, either version 3 of the
|
|
7
|
-
License, or (at your option) any later version.
|
|
8
|
-
|
|
9
|
-
This program is distributed in the hope that it will be useful,
|
|
10
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
GNU Affero General Public License for more details.
|
|
13
|
-
|
|
14
|
-
You should have received a copy of the GNU Affero General Public License
|
|
15
|
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
const path = require('path');
|
|
19
|
-
|
|
20
|
-
const {
|
|
21
|
-
ACTIONS,
|
|
22
|
-
HANDLER
|
|
23
|
-
} = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
24
|
-
|
|
25
|
-
// const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase, firstLetterUpperCase } = require("../#utils");
|
|
26
|
-
// const { DEFAULT_HANDLER_PER_ACTION, SOURCE_PATH } = require("../#const");
|
|
27
|
-
const {
|
|
28
|
-
firstLetterLowerCase: lowerCase,
|
|
29
|
-
firstLetterUpperCase: upperCase,
|
|
30
|
-
firstLetterUpperCase,
|
|
31
|
-
checkOverWriteGenerateMainFunction
|
|
32
|
-
} = require('../../../../../MainLibs/src/Consts.js').utils;
|
|
33
|
-
const { DEFAULT_HANDLER_PER_ACTION, SOURCE_PATH } =
|
|
34
|
-
require('../../../../../MainLibs/src/Consts.js').consts;
|
|
35
|
-
|
|
36
|
-
const templatePath = path.join(__dirname, 'template.ejs');
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* receive objectSchema
|
|
40
|
-
* create data for hdrInv template
|
|
41
|
-
*
|
|
42
|
-
* @param {Object} objectSchema
|
|
43
|
-
* @return {{ templatePath, templateData, setting } }
|
|
44
|
-
*/
|
|
45
|
-
async function data(_izContext, objectSchema, srcPath) {
|
|
46
|
-
if (
|
|
47
|
-
objectSchema.overwriteGeneratedMainFunction?.length &&
|
|
48
|
-
objectSchema.overwriteGeneratedMainFunction.includes(ACTIONS.get)
|
|
49
|
-
) {
|
|
50
|
-
return [];
|
|
51
|
-
} else {
|
|
52
|
-
return [
|
|
53
|
-
await createParamForCreateSource(
|
|
54
|
-
_izContext,
|
|
55
|
-
objectSchema,
|
|
56
|
-
ACTIONS.get,
|
|
57
|
-
srcPath
|
|
58
|
-
)
|
|
59
|
-
];
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
async function createParamForCreateSource(
|
|
64
|
-
_izContext,
|
|
65
|
-
objectSchema,
|
|
66
|
-
action,
|
|
67
|
-
srcPath
|
|
68
|
-
) {
|
|
69
|
-
// let objectType = objectSchema.objectType;
|
|
70
|
-
let objectType = objectSchema.objectType;
|
|
71
|
-
let groupBy = objectSchema?.shortNameObjectType
|
|
72
|
-
? objectSchema.shortNameObjectType
|
|
73
|
-
: objectSchema.objectType;
|
|
74
|
-
let functionName = objectType + upperCase(action);
|
|
75
|
-
return {
|
|
76
|
-
templatePath: templatePath,
|
|
77
|
-
templateData: {
|
|
78
|
-
functionName: functionName,
|
|
79
|
-
objectType: objectType,
|
|
80
|
-
roleName: groupBy,
|
|
81
|
-
action: action
|
|
82
|
-
},
|
|
83
|
-
setting: {
|
|
84
|
-
savePath: path.join(srcPath, SOURCE_PATH.lambdaPerAction),
|
|
85
|
-
saveFileName: `${upperCase(objectSchema.objectType)}${upperCase(action)}_Main`,
|
|
86
|
-
fileExtension: '.js',
|
|
87
|
-
isAppend: false
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
module.exports = data;
|