@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,57 +0,0 @@
|
|
|
1
|
-
/* Copyright (C) 2020 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 izara = require("@izara_project/izara-middleware"); const middleware =
|
|
11
|
-
izara.middlewareHandler; const callingFlowSharedLib =
|
|
12
|
-
require('@izara_project/izara-core-library-calling-flow'); const Logger =
|
|
13
|
-
require('@izara_project/izara-core-library-logger'); const
|
|
14
|
-
{validateSchemaPerRecord} =
|
|
15
|
-
require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs/index.js')
|
|
16
|
-
const recordHandlerSharedLib =
|
|
17
|
-
require('@izara_project/izara-core-library-record-handler'); <%_ if
|
|
18
|
-
(isCreateMainFunction == true) { _%> // user generate main function <%_ } else {
|
|
19
|
-
%> const <%- functionName %> =require('./<%- firstLetterUpperCase(objectType)
|
|
20
|
-
%><%- firstLetterUpperCase(action) %>_Main') <%_ } _%> //(<globalVariable>
|
|
21
|
-
//</globalVariable
|
|
22
|
-
>) //validate event params in middleware before into main function
|
|
23
|
-
middleware.setValidatorSchema( recordHandlerSharedLib.baseValidatorSchema(),
|
|
24
|
-
//(<middlewareSettings>) //(</middlewareSettings>) ) /* const
|
|
25
|
-
perRecordsValidatorSchema = { type: "object", required: [], properties: {}, } */
|
|
26
|
-
//(<globalValidatorSchema>) //(</globalValidatorSchema>) // if need to validate
|
|
27
|
-
authorizer or additional params , add code to hook tag below module.exports.main
|
|
28
|
-
= middleware.wrap(async (event,context, callback) => { try { let recordPromises
|
|
29
|
-
= []; await Promise.all(event.Records.map(async record => {
|
|
30
|
-
record._izContext.logger.debug('record RecieveMsgOutHdrSqs', record); let
|
|
31
|
-
passOnProperties = []; const OBJTYPE = { objectType: "<%- objectType %>",
|
|
32
|
-
serviceTag: process.env.iz_serviceTag } await validateSchemaPerRecord( record,
|
|
33
|
-
"<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handler) %>",
|
|
34
|
-
OBJTYPE, "<%- action %>" //(<validateSchemaSetting>) //(</validateSchemaSetting
|
|
35
|
-
>) ) //for validate additional params /* await
|
|
36
|
-
recordHandlerSharedLib.validateRecord( record, "<%-
|
|
37
|
-
firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handler) %>",
|
|
38
|
-
perRecordsValidatorSchema ); */ //(<afterGenerateValidatorSchema
|
|
39
|
-
>) //(</afterGenerateValidatorSchema
|
|
40
|
-
>) //(<additionalParams>) //(</additionalParams>)
|
|
41
|
-
passOnProperties.push(record.body.Message);
|
|
42
|
-
passOnProperties.push(callingFlowSharedLib.addCallingFlowToPassOnProperties(record.body.Message));
|
|
43
|
-
record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
|
|
44
|
-
let recordPromise = recordHandlerSharedLib.recordHandler( record, <%-
|
|
45
|
-
functionName %>.<%- functionName %>Main, // mainFunction '<%-
|
|
46
|
-
firstLetterUpperCase(queueName) %>', // queueName passOnProperties );
|
|
47
|
-
record._izContext.logger.debug('after record Promise in handler');
|
|
48
|
-
recordPromises.push(recordPromise); })) Logger.debug('before
|
|
49
|
-
Promise.all(recordPromise) in handler'); try { await
|
|
50
|
-
Promise.all(recordPromises); return event.Records } catch {
|
|
51
|
-
Logger.debug('Promise.all(recordPromises) in handler threw error (at least one
|
|
52
|
-
record did no resolve)'); } Logger.debug('after Promise.all(recordPromises) in
|
|
53
|
-
handler'); } catch (err) { Logger.debug('unhandled error <%- functionName %><%-
|
|
54
|
-
handler %>') throw err } } ) <%_ function firstLetterUpperCase(text){ return
|
|
55
|
-
text.charAt(0).toUpperCase() + text.slice(1) } _%> <%_ function
|
|
56
|
-
firstLetterLowerCase(str) { return str.charAt(0).toLowerCase() + str.slice(1) }
|
|
57
|
-
_%>
|
|
@@ -1,94 +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 {
|
|
26
|
-
firstLetterLowerCase: lowerCase,
|
|
27
|
-
firstLetterUpperCase: upperCase,
|
|
28
|
-
firstLetterUpperCase,
|
|
29
|
-
checkOverWriteGenerateMainFunction
|
|
30
|
-
} = require('../#utils');
|
|
31
|
-
const { DEFAULT_HANDLER_PER_ACTION, SOURCE_PATH } = require('../#const');
|
|
32
|
-
|
|
33
|
-
const templatePath = path.join(__dirname, 'template.ejs');
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* receive objectSchema
|
|
37
|
-
* create data for WebScoket handler template
|
|
38
|
-
*
|
|
39
|
-
* @param {Object} objectSchema
|
|
40
|
-
* @return {{templatePath, templateData,setting}}
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
function data(_izContext, objectSchema, srcPath) {
|
|
44
|
-
let createSourceArray = [];
|
|
45
|
-
for (const action of Object.values(ACTIONS)) {
|
|
46
|
-
if (objectSchema.overWriteHandlers?.[action]) {
|
|
47
|
-
if (objectSchema.overWriteHandlers[action].includes(HANDLER.hdrWbs)) {
|
|
48
|
-
const createSourceParams = createParamsForCreateSource(
|
|
49
|
-
objectSchema,
|
|
50
|
-
action,
|
|
51
|
-
HANDLER.hdrWbs,
|
|
52
|
-
srcPath
|
|
53
|
-
);
|
|
54
|
-
createSourceParams && createSourceArray.push(createSourceParams);
|
|
55
|
-
}
|
|
56
|
-
} else {
|
|
57
|
-
if (DEFAULT_HANDLER_PER_ACTION[action].includes(HANDLER.hdrWbs)) {
|
|
58
|
-
const createSourceParams = createParamsForCreateSource(
|
|
59
|
-
objectSchema,
|
|
60
|
-
action,
|
|
61
|
-
HANDLER.hdrWbs,
|
|
62
|
-
srcPath
|
|
63
|
-
);
|
|
64
|
-
createSourceParams && createSourceArray.push(createSourceParams);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return createSourceArray;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function createParamsForCreateSource(objectSchema, action, handler, srcPath) {
|
|
72
|
-
let objectType = objectSchema.objectType;
|
|
73
|
-
let functionName = objectType + upperCase(action);
|
|
74
|
-
|
|
75
|
-
return {
|
|
76
|
-
templatePath: templatePath,
|
|
77
|
-
templateData: {
|
|
78
|
-
functionName,
|
|
79
|
-
objectType,
|
|
80
|
-
action,
|
|
81
|
-
isCreateMainFunction: checkOverWriteGenerateMainFunction(
|
|
82
|
-
objectSchema,
|
|
83
|
-
action
|
|
84
|
-
)
|
|
85
|
-
},
|
|
86
|
-
setting: {
|
|
87
|
-
savePath: path.join(srcPath, SOURCE_PATH.lambdaPerAction),
|
|
88
|
-
saveFileName: `${upperCase(objectType)}${upperCase(action)}_${upperCase(handler)}`,
|
|
89
|
-
fileExtension: '.js',
|
|
90
|
-
isAppend: false
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
module.exports = data;
|
|
@@ -1,61 +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 izara = require("@izara_project/izara-middleware"); const middleware =
|
|
11
|
-
izara.middlewareHandler; const AWS = require('aws-sdk'); const api = new
|
|
12
|
-
AWS.ApiGatewayManagementApi({ endpoint: process.env.iz_webSocketEndpoint });
|
|
13
|
-
const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
|
|
14
|
-
const callingFlowSharedLib =
|
|
15
|
-
require('@izara_project/izara-core-library-calling-flow'); const {
|
|
16
|
-
validateSchemaPerWebSocket } =
|
|
17
|
-
require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs/index.js')
|
|
18
|
-
<%_ if (isCreateMainFunction == true) { _%> // user generate main function <%_ }
|
|
19
|
-
else { %> const <%- functionName %> =require('./<%-
|
|
20
|
-
firstLetterUpperCase(objectType) %><%- firstLetterUpperCase(action) %>_Main')
|
|
21
|
-
<%_ } _%> module.exports.main = middleware.wrap(async (event, context, callback)
|
|
22
|
-
=> { event._izContext.logger.debug('Event:', event); try { let requestParams =
|
|
23
|
-
JSON.parse(event.body); await validateSchemaPerWebSocket( event._izContext,
|
|
24
|
-
requestParams, "<%- objectType -%>", "<%- action -%>", ) if
|
|
25
|
-
(event.requestContext) { const route = event.requestContext.routeKey; const
|
|
26
|
-
connectionId = event.requestContext.connectionId; const attribute = event.body;
|
|
27
|
-
event._izContext.logger.debug('body:', attribute);
|
|
28
|
-
event._izContext.logger.debug('route:', route); event.body =
|
|
29
|
-
JSON.parse(attribute) switch (route) { case '$default': console.log('Received
|
|
30
|
-
unknown route:', route) break case '<%- objectType -%><%-
|
|
31
|
-
firstLetterUpperCase(action) %>': // create Web socket task for respond await
|
|
32
|
-
dynamodbSharedLib.putItem( event._izContext, await
|
|
33
|
-
dynamodbSharedLib.tableName(event._izContext, "WebSocketTask"), { taskKey: "<%-
|
|
34
|
-
objectType -%>" + "<%- firstLetterUpperCase(action) %>", // objType + action
|
|
35
|
-
connectionid: connectionId, // connectionid: event.body.connectionid,
|
|
36
|
-
//(<additionalParams>) //(</additionalParams>) } ); let
|
|
37
|
-
payloadBeforeInvokeFunction = requestParams // delete action before send to main
|
|
38
|
-
function delete payloadBeforeInvokeFunction.action
|
|
39
|
-
console.log("payloadBeforeInvokeFunction", payloadBeforeInvokeFunction)
|
|
40
|
-
event._izContext.logger.debug("event before send to <%- functionName %>Main",
|
|
41
|
-
requestParams) //(<beforeInvokeMain>) //(</beforeInvokeMain>) // invoke main let
|
|
42
|
-
invokeUpdateMainFunction = await <%- functionName %>.<%- functionName %>Main(
|
|
43
|
-
event._izContext, payloadBeforeInvokeFunction,
|
|
44
|
-
callingFlowSharedLib.addCallingFlowToPassOnProperties(attribute) );
|
|
45
|
-
//(<afterInvokeMain>) //(</afterInvokeMain>) await
|
|
46
|
-
postMessage(invokeUpdateMainFunction, connectionId); break } } else {
|
|
47
|
-
console.log("not have event.requestContext") const connId = event.connId; await
|
|
48
|
-
postMessage({ message: event.message }, connId); } } catch (err) {
|
|
49
|
-
console.log("event", event) const connId = event.requestContext.connectionId
|
|
50
|
-
event._izContext.logger.error('Error, WebSocket: ', err); await
|
|
51
|
-
sendErrorMessage({ message: err.message }, connId); return
|
|
52
|
-
(izara.response.failure(err)); } }); async function postMessage(data,
|
|
53
|
-
connectionId) { const params = { ConnectionId: connectionId, Data:
|
|
54
|
-
JSON.stringify(data), // Data: Buffer.from(JSON.stringify(data)), } return
|
|
55
|
-
api.postToConnection(params).promise(); }; async function
|
|
56
|
-
sendErrorMessage(errorMessage, connectionId) { const params = { ConnectionId:
|
|
57
|
-
connectionId, Data: JSON.stringify(errorMessage) } return
|
|
58
|
-
api.postToConnection(params).promise(); } <%_ function
|
|
59
|
-
firstLetterUpperCase(text){ return text.charAt(0).toUpperCase() + text.slice(1)
|
|
60
|
-
} _%> <%_ function firstLetterLowerCase(str) { return
|
|
61
|
-
str.charAt(0).toLowerCase() + str.slice(1) } _%>
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (C) 2021 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 { SOURCE_PATH, SAVE_FILE_NAME, ACTIONS, HANDLER } = require('../#const');
|
|
21
|
-
|
|
22
|
-
const templatePath = path.join(__dirname, 'template.ejs');
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* receive objectSchema
|
|
26
|
-
* create data for websocket connect function yaml template
|
|
27
|
-
*
|
|
28
|
-
* @param {Object} objectSchema
|
|
29
|
-
* @return {{ templatePath, templateData, setting } }
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
function data(_izContext, webSocketStatus, srcPath) {
|
|
33
|
-
let createSourceParam;
|
|
34
|
-
if (webSocketStatus) {
|
|
35
|
-
createSourceParam = [createWebSocketConnectYaml(_izContext, srcPath)];
|
|
36
|
-
} else {
|
|
37
|
-
createSourceParam = [];
|
|
38
|
-
}
|
|
39
|
-
return createSourceParam;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function createWebSocketConnectYaml(_izContext, srcPath) {
|
|
43
|
-
return {
|
|
44
|
-
templatePath: templatePath,
|
|
45
|
-
templateData: {},
|
|
46
|
-
setting: {
|
|
47
|
-
savePath: path.join(srcPath, SOURCE_PATH.lambdaPerAction),
|
|
48
|
-
saveFileName: 'WebSocketConnect',
|
|
49
|
-
fileExtension: '.js',
|
|
50
|
-
isAppend: true
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
module.exports = data;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (C) 2021 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
|
-
|
|
19
|
-
|
|
20
|
-
const izara = require("@izara_project/izara-middleware");
|
|
21
|
-
const middleware = izara.middlewareHandler;
|
|
22
|
-
const AWS = require('aws-sdk');
|
|
23
|
-
const api = new AWS.ApiGatewayManagementApi({ endpoint: process.env.iz_webSocketEndpoint });
|
|
24
|
-
|
|
25
|
-
module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
26
|
-
|
|
27
|
-
event._izContext.logger.debug('Event:', event);
|
|
28
|
-
|
|
29
|
-
try {
|
|
30
|
-
|
|
31
|
-
if (event.requestContext) {
|
|
32
|
-
const route = event.requestContext.routeKey;
|
|
33
|
-
const connectionId = event.requestContext.connectionId;
|
|
34
|
-
|
|
35
|
-
switch (route) {
|
|
36
|
-
case '$connect':
|
|
37
|
-
console.log('Connect websocket')
|
|
38
|
-
break
|
|
39
|
-
case '$disconnect':
|
|
40
|
-
console.log('Websocket are Disconnection')
|
|
41
|
-
break
|
|
42
|
-
case '$default':
|
|
43
|
-
console.log('Received unknown route:', route)
|
|
44
|
-
break
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return (izara.response.webSocketSuccess());
|
|
50
|
-
|
|
51
|
-
} catch (err) {
|
|
52
|
-
event._izContext.logger.error('Error, WebSocketConnect: ', err);
|
|
53
|
-
return (izara.response.failure(err));
|
|
54
|
-
}
|
|
55
|
-
});
|
|
@@ -1,60 +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 {
|
|
26
|
-
DEFAULT_HANDLER_PER_ACTION,
|
|
27
|
-
createIamRole,
|
|
28
|
-
resourceNames,
|
|
29
|
-
RESOURCE_CLASSES,
|
|
30
|
-
DEFAULT_LAMBDA_ROLE_PER_ACTION,
|
|
31
|
-
SOURCE_PATH,
|
|
32
|
-
SAVE_FILE_NAME,
|
|
33
|
-
DYNAMO_RESOURCE,
|
|
34
|
-
SNS_RESOURCE,
|
|
35
|
-
FUNCTION_NAME,
|
|
36
|
-
defaultIamRolePerAction,
|
|
37
|
-
awaitingMultipleStepsRole,
|
|
38
|
-
shortNameHandler
|
|
39
|
-
} = require('../../../../MainLibs/src/Consts.js').consts;
|
|
40
|
-
|
|
41
|
-
const templatePath = path.join(__dirname, 'template.ejs');
|
|
42
|
-
|
|
43
|
-
function data(_izContext, srcPath) {
|
|
44
|
-
return [createSourceParams(_izContext, srcPath)];
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function createSourceParams(_izContext, srcPath) {
|
|
48
|
-
return {
|
|
49
|
-
templatePath: templatePath,
|
|
50
|
-
templateData: {},
|
|
51
|
-
setting: {
|
|
52
|
-
saveFileName: 'GenerateCodeLibs',
|
|
53
|
-
savePath: path.join(srcPath, SOURCE_PATH.generateCodeLib),
|
|
54
|
-
fileExtension: '.js',
|
|
55
|
-
isAppend: false
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
module.exports = data;
|
|
@@ -1,46 +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
|
-
|
|
19
|
-
|
|
20
|
-
const externalRequest = require('@izara_project/izara-core-library-external-request');
|
|
21
|
-
const lambda = externalRequest.lambda;
|
|
22
|
-
|
|
23
|
-
const inMemoryCacheLib = require('@izara_project/izara-shared/src/InMemoryCacheLib');
|
|
24
|
-
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
25
|
-
|
|
26
|
-
async function checkPermission(_izContext, functionName, payload) {
|
|
27
|
-
return await lambda.invokeSync(_izContext, functionName, payload)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const checkPermissionWithCache = inMemoryCacheLib.inMemoryCacheLib(
|
|
31
|
-
checkPermission, // fn
|
|
32
|
-
{ // setting
|
|
33
|
-
max: 100,
|
|
34
|
-
maxAge: 86400000,
|
|
35
|
-
promise: true,
|
|
36
|
-
profileName: 'checkPermission',
|
|
37
|
-
normalizer: function (args) {
|
|
38
|
-
return hash([args[1], args[2]])
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
module.exports = {
|
|
44
|
-
checkPermission,
|
|
45
|
-
checkPermissionWithCache
|
|
46
|
-
}
|
|
@@ -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.create)
|
|
48
|
-
) {
|
|
49
|
-
return [];
|
|
50
|
-
} else {
|
|
51
|
-
return [
|
|
52
|
-
await createParamForCreateSource(
|
|
53
|
-
_izContext,
|
|
54
|
-
objectSchema,
|
|
55
|
-
ACTIONS.create,
|
|
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
|
-
actionHandler: 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;
|
|
File without changes
|