@izara_project/izara-market-library-service-schemas 1.0.23 → 1.0.25
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 +4 -2
- package/package.json +2 -2
- package/src/GenerateCodeLibs/index.js +1 -0
- package/src/MainLibs/index.js +2 -1
- package/src/MainLibs/src/Consts.js +485 -0
- package/src/MainLibs/src/GenerateCodeUtils.js +59 -0
- package/src/TemplateManager/src/ProcessLogical/Handler/data.js +2 -2
- package/src/TemplateManager/src/ProcessLogical/ProcessLogicalYaml/data.js +2 -2
- package/src/TemplateManager/src/ProcessLogical/mainFunction/data.js +1 -1
- package/src/TemplateManager/src/externalService/FunctionNameConfig/data.js +1 -2
- package/src/reStructure/GenerateCode.js +151 -0
- package/src/reStructure/TemplateConfig.js +31 -0
- package/src/reStructure/TemplateData/externalService/functionNameConfig/data.js +162 -0
- package/src/reStructure/TemplateData/externalService/functionNameConfig/template.ejs +14 -0
- package/src/reStructure/TemplateData/externalService/functionNameConfig/templateIntTesting.ejs +31 -0
- package/src/reStructure/TemplateData/externalService/functionNameConfig/templateYaml.ejs +10 -0
- package/src/reStructure/TemplateData/externalService/generateTemplateData.js +59 -0
- package/src/reStructure/TemplateData/externalService/lambdaRole/data.js +435 -0
- package/src/reStructure/TemplateData/externalService/lambdaRole/request.json +18 -0
- package/src/reStructure/TemplateData/externalService/lambdaRole/template.ejs +57 -0
- package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/data.js +177 -0
- package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/request.json +12 -0
- package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/template.ejs +28 -0
- package/src/reStructure/TemplateData/findData/GetByStorage/getByDynamo.ejs +53 -0
- package/src/reStructure/TemplateData/findData/GetByStorage/getByGraph.ejs +100 -0
- package/src/reStructure/TemplateData/findData/findDataYaml/data.js +195 -0
- package/src/reStructure/TemplateData/findData/findDataYaml/template.ejs +14 -0
- package/src/reStructure/TemplateData/findData/generateTemplateData.js +65 -0
- package/src/reStructure/TemplateData/findData/handler/data.js +63 -0
- package/src/reStructure/TemplateData/findData/handler/template.ejs +140 -0
- package/src/reStructure/TemplateData/findData/mainFunction/data.js +297 -0
- package/src/reStructure/TemplateData/findData/mainFunction/template.ejs +151 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/inProcess/functionYaml/data.js +76 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/inProcess/functionYaml/template.ejs +37 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/inProcess/handler/data.js +46 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/inProcess/handler/template.ejs +103 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/inProcess/mainFunction/data.js +45 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/inProcess/sns-sqs/data.js +35 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/functionYaml/data.js +34 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/functionYaml/template.ejs +0 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/handler/data.js +34 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/handler/template.ejs +0 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/mainFunction/data.js +34 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/mainFunction/template.ejs +0 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/sns-sqs/data.js +34 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/sns-sqs/template.ejs +0 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/functionYaml/data.js +118 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/functionYaml/template.ejs +30 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/handler/data.js +56 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/handler/template.ejs +126 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/data.js +51 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/template.ejs +121 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/queue/data.js +64 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/queue/template.ejs +45 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/functionYaml/data.js +140 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/functionYaml/template.ejs +37 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/data.js +74 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/template.ejs +120 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/data.js +54 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/template.ejs +133 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/functionYaml/data.js +115 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/functionYaml/template.ejs +30 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/handler/data.js +70 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/handler/template.ejs +103 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/mainFunction/data.js +55 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/mainFunction/template.ejs +86 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/sns-sqs/data.js +72 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/sns-sqs/template.ejs +49 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/hook/handler/data.js +93 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/hook/handler/templateAsyncHandler.ejs +110 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/hook/handler/templateSyncHandler.ejs +49 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/hook/hookLogic/data.js +43 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/hook/mainFunction/data.js +65 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/hook/mainFunction/template.ejs +7 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/hook/queue/data.js +72 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/hook/queue/snsTemplate.ejs +59 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/getSignUrls/functionYaml/data.js +102 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/getSignUrls/functionYaml/template.ejs +27 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/getSignUrls/handler/data.js +57 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/getSignUrls/handler/template.ejs +120 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/getSignUrls/mainFunction/data.js +51 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/getSignUrls/mainFunction/template.ejs +164 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/getSignUrls/sqs/data.js +65 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/getSignUrls/sqs/template.ejs +53 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/functionYaml/data.js +131 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/functionYaml/template.ejs +30 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/handler/data.js +57 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/handler/template.ejs +126 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/data.js +54 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/template.ejs +254 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/queue/data.js +64 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/queue/template.ejs +45 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/functionYml/HdrDsq/data.js +87 -0
- package/src/{TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml → reStructure/TemplateData/flowSchema/components/upload/processFile/functionYml}/HdrDsq/template.ejs +4 -4
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/functionYml/HdrS3/data.js +127 -0
- package/src/{TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/functionYaml → reStructure/TemplateData/flowSchema/components/upload/processFile/functionYml/HdrS3}/template.ejs +11 -3
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/handler/handlerDsq/data.js +45 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/handler/handlerDsq/template.ejs +151 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/handler/handlerS3/data.js +58 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/handler/handlerS3/template.ejs +68 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/mainFunction/data.js +58 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/mainFunction/template.ejs +392 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/queue/data.js +77 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/queue/dsqTemplatePath.ejs +32 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/queue/s3Template.ejs +59 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/S3/data.js +51 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/S3/template.ejs +13 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/libs/data.js +42 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/libs/template.ejs +137 -0
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/functionYaml/data.js +73 -0
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/functionYaml/template.ejs +29 -0
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/data.js +54 -0
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/template.ejs +68 -0
- package/src/reStructure/TemplateData/flowSchema/components/websocket/dynamoDb/ReservedTableData.js +62 -0
- package/src/reStructure/TemplateData/flowSchema/components/websocket/dynamoDb/WebSocketTaskData.js +62 -0
- package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +210 -0
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/functionYaml/data.js +101 -0
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/functionYaml/template.ejs +43 -0
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/handler/data.js +93 -0
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/handler/templateAsyncHandler.ejs +110 -0
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/handler/templateSyncHandler.ejs +49 -0
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/hookLogic/data.js +64 -0
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/mainFunction/data.js +66 -0
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/mainFunction/template.ejs +30 -0
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/queue/data.js +124 -0
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/queue/snsTemplate.ejs +59 -0
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/queue/sqsTemplate.ejs +43 -0
- package/src/reStructure/TemplateData/generateRole/createSharedResource.js +276 -0
- package/src/reStructure/TemplateData/generateRole/sharedResourceTemplate.ejs +58 -0
- package/src/reStructure/TemplateData/perActionComplete/create/handler/data.js +69 -0
- package/src/reStructure/TemplateData/perActionComplete/create/handler/template.ejs +130 -0
- package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/createObjectComplete_main.js +172 -0
- package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/data.js +65 -0
- package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/template.ejs +170 -0
- package/src/reStructure/TemplateData/perActionComplete/create/sns-in-sqs/data.js +69 -0
- package/src/reStructure/TemplateData/perActionComplete/create/sns-in-sqs/template.ejs +47 -0
- package/src/reStructure/TemplateData/perActionComplete/create/sns-out/data.js +73 -0
- package/src/reStructure/TemplateData/perActionComplete/create/sns-out/template.ejs +10 -0
- package/src/reStructure/TemplateData/perActionComplete/create/yaml/data.js +130 -0
- package/src/reStructure/TemplateData/perActionComplete/create/yaml/template.ejs +20 -0
- package/src/reStructure/TemplateData/perActionComplete/delete/handler/data.js +66 -0
- package/src/reStructure/TemplateData/perActionComplete/delete/handler/template.ejs +129 -0
- package/src/reStructure/TemplateData/perActionComplete/delete/mainFunction/data.js +59 -0
- package/src/reStructure/TemplateData/perActionComplete/delete/mainFunction/template.ejs +93 -0
- package/src/reStructure/TemplateData/perActionComplete/delete/sns-in-sqs/data.js +62 -0
- package/src/reStructure/TemplateData/perActionComplete/delete/sns-in-sqs/template.ejs +47 -0
- package/src/reStructure/TemplateData/perActionComplete/delete/sns-out/data.js +69 -0
- package/src/reStructure/TemplateData/perActionComplete/delete/yaml/data.js +124 -0
- package/src/reStructure/TemplateData/perActionComplete/delete/yaml/template.ejs +20 -0
- package/src/reStructure/TemplateData/perActionComplete/generateTemplateData.js +126 -0
- package/src/{TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/handler/dataHdrDsq.js → reStructure/TemplateData/perActionComplete/get/handler/data.js} +20 -14
- package/src/reStructure/TemplateData/perActionComplete/get/handler/template.ejs +129 -0
- package/src/reStructure/TemplateData/perActionComplete/get/mainFunction/data.js +52 -0
- package/src/reStructure/TemplateData/perActionComplete/get/mainFunction/template.ejs +130 -0
- package/src/{TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/sqs-sns → reStructure/TemplateData/perActionComplete/get/sns-in-sqs}/data.js +12 -12
- package/src/reStructure/TemplateData/perActionComplete/get/sns-in-sqs/template.ejs +47 -0
- package/src/reStructure/TemplateData/perActionComplete/get/sns-out/data.js +71 -0
- package/src/reStructure/TemplateData/perActionComplete/get/yaml/data.js +105 -0
- package/src/reStructure/TemplateData/perActionComplete/get/yaml/template.ejs +20 -0
- package/src/reStructure/TemplateData/perActionComplete/update/handler/data.js +65 -0
- package/src/reStructure/TemplateData/perActionComplete/update/handler/template.ejs +129 -0
- package/src/reStructure/TemplateData/perActionComplete/update/mainFunction/data.js +58 -0
- package/src/reStructure/TemplateData/perActionComplete/update/mainFunction/template.ejs +130 -0
- package/src/reStructure/TemplateData/perActionComplete/update/sns-in-sqs/data.js +66 -0
- package/src/reStructure/TemplateData/perActionComplete/update/sns-in-sqs/template.ejs +47 -0
- package/src/reStructure/TemplateData/perActionComplete/update/sns-out/data.js +73 -0
- package/src/reStructure/TemplateData/perActionComplete/update/yaml/data.js +132 -0
- package/src/reStructure/TemplateData/perActionComplete/update/yaml/template.ejs +20 -0
- package/src/reStructure/TemplateData/perActionEndpoint/generateTemplateData.js +101 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/api/data.js +93 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/api/request.json +7 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/api/template.ejs +76 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/dsq/data.js +95 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/dsq/request.json +7 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/dsq/template.ejs +127 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/inv/data.js +88 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/inv/request.json +7 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/inv/template.ejs +81 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/sqs/data.js +94 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/sqs/request.json +7 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/sqs/template.ejs +130 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/webSocket/data.js +75 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/webSocket/template.ejs +141 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/webSocketConnect/data.js +55 -0
- package/src/reStructure/TemplateData/perActionEndpoint/handler/webSocketConnect/template.ejs +55 -0
- package/src/{TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/mainFunction → reStructure/TemplateData/perActionEndpoint/libs}/data.js +25 -13
- package/src/reStructure/TemplateData/perActionEndpoint/libs/template.ejs +46 -0
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/create/data.js +74 -0
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/create/request.json +0 -0
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/create/template.ejs +629 -0
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/delete/data.js +74 -0
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/delete/template.ejs +192 -0
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/get/data.js +76 -0
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/get/request.json +5 -0
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/get/template.ejs +265 -0
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/get/testParam.json +5 -0
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/update/data.js +70 -0
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/update/request.json +0 -0
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/update/template.ejs +351 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/api/data.js +198 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/api/request.json +14 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/api/template.ejs +20 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/dsq/data.js +207 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/dsq/request.json +19 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/dsq/template.ejs +17 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/inv/data.js +189 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/inv/example req.js +15 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/inv/request.json +14 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/inv/template.ejs +13 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/sqs/data.js +208 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/sqs/request.json +19 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/sqs/template.ejs +17 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/wbs/data.js +170 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/wbs/request.json +19 -0
- package/src/{TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrSqs → reStructure/TemplateData/perActionEndpoint/yaml/wbs}/template.ejs +2 -3
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/webSocketConnect/data.js +59 -0
- package/src/reStructure/TemplateData/perActionEndpoint/yaml/webSocketConnect/template.ejs +10 -0
- package/src/reStructure/TemplateData/processLogical/generateTemplateData.js +57 -0
- package/src/reStructure/TemplateData/processLogical/handler/data.js +50 -0
- package/src/reStructure/TemplateData/processLogical/handler/template.ejs +129 -0
- package/src/reStructure/TemplateData/processLogical/mainFunction/data.js +47 -0
- package/src/reStructure/TemplateData/processLogical/mainFunction/template.ejs +429 -0
- package/src/reStructure/TemplateData/processLogical/yaml/data.js +160 -0
- package/src/reStructure/TemplateData/processLogical/yaml/template.ejs +12 -0
- package/src/{TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/sns-out → reStructure/TemplateData/processLogicalPagination/DsqYaml}/data.js +16 -13
- package/src/reStructure/TemplateData/processLogicalPagination/DsqYaml/template.ejs +32 -0
- package/src/reStructure/TemplateData/processLogicalPagination/generateTemplateData.js +64 -0
- package/src/reStructure/TemplateData/processLogicalPagination/handler/dsq/data.js +48 -0
- package/src/reStructure/TemplateData/processLogicalPagination/handler/dsq/template.ejs +163 -0
- package/src/reStructure/TemplateData/processLogicalPagination/handler/sqs/data.js +48 -0
- package/src/reStructure/TemplateData/processLogicalPagination/handler/sqs/template.ejs +146 -0
- package/src/reStructure/TemplateData/processLogicalPagination/mainFunction/data.js +48 -0
- package/src/reStructure/TemplateData/processLogicalPagination/mainFunction/template.ejs +212 -0
- package/src/reStructure/TemplateData/processLogicalPagination/yaml/dsq/data.js +154 -0
- package/src/reStructure/TemplateData/processLogicalPagination/yaml/dsq/template.ejs +12 -0
- package/src/reStructure/TemplateData/processLogicalPagination/yaml/sqs/data.js +157 -0
- package/src/reStructure/TemplateData/processLogicalPagination/yaml/sqs/template.ejs +12 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/api/data.js +98 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/api/template.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/dsq/data.js +111 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/dsq/template.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/inv/data.js +97 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/inv/template.ejs +13 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/sqs/data.js +110 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/sqs/template.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/api/data.js +57 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/api/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/api/template.ejs +138 -0
- package/src/{TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrDsq → reStructure/TemplateData/relationshipPerAction/create/action/handler/dsq}/data.js +18 -20
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/dsq/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/dsq/template.ejs +184 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/inv/data.js +59 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/inv/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/inv/template.ejs +126 -0
- package/src/{TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrSqs → reStructure/TemplateData/relationshipPerAction/create/action/handler/sqs}/data.js +16 -16
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/sqs/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/sqs/template.ejs +163 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/mainFunction/data.js +59 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/mainFunction/template.ejs +380 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/sns-in-sqs/data.js +77 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/sns-in-sqs/snsTemplate.ejs +59 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/sns-in-sqs/sqsTemplate.ejs +43 -0
- package/src/{TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrSqs → reStructure/TemplateData/relationshipPerAction/create/complete/functionYaml}/data.js +48 -29
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/functionYaml/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/functionYaml/template.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/handler/sqs/data.js +60 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/handler/sqs/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/handler/sqs/template.ejs +125 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/data.js +55 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/template.ejs +141 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/sns-in-sqs/data.js +71 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/sns-in-sqs/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/sns-in-sqs/template.ejs +47 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/sns-out/data.js +71 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/sns-out/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/sns-out/template.ejs +10 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/api/data.js +98 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/api/template.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/dsq/data.js +111 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/dsq/template.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/inv/data.js +97 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/inv/template.ejs +13 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/sqs/data.js +111 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/sqs/template.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/api/data.js +57 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/api/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/api/template.ejs +138 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/dsq/data.js +58 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/dsq/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/dsq/template.ejs +184 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/inv/data.js +59 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/inv/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/inv/template.ejs +126 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/sqs/data.js +59 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/sqs/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/sqs/template.ejs +162 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/mainFunction/data.js +59 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/mainFunction/template.ejs +337 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/sns-in-sqs/data.js +77 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/sns-in-sqs/snsTemplate.ejs +59 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/sns-in-sqs/sqsTemplate.ejs +43 -0
- package/src/{TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrDsq → reStructure/TemplateData/relationshipPerAction/delete/complete/functionYaml}/data.js +49 -30
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/functionYaml/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/functionYaml/template.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/handler/sqs/data.js +60 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/handler/sqs/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/handler/sqs/template.ejs +125 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/mainFunction/data.js +55 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/mainFunction/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/mainFunction/template.ejs +140 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/sns-in-sqs/data.js +70 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/sns-in-sqs/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/sns-in-sqs/template.ejs +47 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/sns-out/data.js +72 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/sns-out/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/sns-out/template.ejs +10 -0
- package/src/reStructure/TemplateData/relationshipPerAction/generateTemplateData.js +238 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/api/data.js +120 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/api/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/api/template.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/data.js +131 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/template.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/inv/data.js +124 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/inv/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/inv/template.ejs +13 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/sqs/data.js +135 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/sqs/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/sqs/template.ejs +17 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/api/data.js +77 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/api/request.json +7 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/api/template.ejs +140 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/dsq/data.js +75 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/dsq/request.json +7 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/dsq/template.ejs +184 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/inv/data.js +77 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/inv/request.json +5 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/inv/template.ejs +145 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/sqs/data.js +74 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/sqs/request.json +7 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/sqs/template.ejs +163 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/mainFunction/data.js +72 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/mainFunction/request.json +1 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/mainFunction/template.ejs +340 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/sns-in-sqs/data.js +92 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/sns-in-sqs/request.json +3 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/sns-in-sqs/snsTemplate.ejs +59 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/sns-in-sqs/sqsTemplate.ejs +43 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/sns-out/data.js +70 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/sns-out/request.json +3 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/functionYaml/data.js +110 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/functionYaml/request.json +3 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/functionYaml/template.ejs +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/handler/sqs/data.js +61 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/handler/sqs/request.json +0 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/handler/sqs/template.ejs +127 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/mainFunction/data.js +63 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/mainFunction/request.json +1 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/mainFunction/template.ejs +143 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/sns-in-sqs/data.js +71 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/sns-in-sqs/request.json +3 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/sns-in-sqs/template.ejs +46 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/sns-out/data.js +70 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/sns-out/request.json +3 -0
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/sns-out/template.ejs +10 -0
- package/src/reStructure/TemplateData/resourceYaml/CreateSourceData.js +73 -0
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/defaultDynamoDbTable.js +146 -0
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/mainResourcePerObjectSchemaData.js +178 -0
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/request.json +7 -0
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/template.ejs +31 -0
- package/src/reStructure/TemplateData/resourceYaml/generateTemplateData.js +99 -0
- package/src/reStructure/TemplateData/resourceYaml/sns-in-sqs/defaultSnsInSqsForFindDataAndProcessLogical.js +96 -0
- package/src/reStructure/TemplateData/resourceYaml/sns-in-sqs/request.json +4 -0
- package/src/reStructure/TemplateData/resourceYaml/sns-in-sqs/snsAndSqsPerActionData.js +108 -0
- package/src/reStructure/TemplateData/resourceYaml/sns-in-sqs/snsTemplate.ejs +59 -0
- package/src/reStructure/TemplateData/resourceYaml/sns-in-sqs/sqsTemplate.ejs +43 -0
- package/src/reStructure/TemplateData/resourceYaml/sns-out/data.js +88 -0
- package/src/reStructure/TemplateData/resourceYaml/sns-out/defaultSnsOutForFindDataAndProcessLogical.js +75 -0
- package/src/reStructure/TemplateData/resourceYaml/sns-out/request.json +3 -0
- package/src/reStructure/TemplateData/resourceYaml/sns-out/template.ejs +10 -0
- package/src/reStructure/test.bash +192 -0
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/functionYaml/data.js +0 -94
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/handler/template.ejs +0 -192
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/mainFunction/template.ejs +0 -299
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrDsq/template.ejs +0 -155
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrSqs/template.ejs +0 -163
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/mainFunction/data.js +0 -61
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/mainFunction/template.ejs +0 -145
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/resourceYaml/dynamoDb/data.js +0 -120
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/resourceYaml/sns-sqs/data.js +0 -75
- package/src/TemplateManager/src/reStructureExample/GenerateCodeTest.js +0 -31
- package/src/TemplateManager/src/reStructureExample/TemplateConfig.js +0 -15
- package/src/TemplateManager/src/reStructureExample/TemplateData/perAction/generateCodeShared.js +0 -1
- package/src/TemplateManager/src/reStructureExample/TemplateData/perAction/generatePerAction.js +0 -12
- /package/src/{TemplateManager/src/reStructureExample/TemplateData/perAction → reStructure/TemplateData/flowSchema/components/schema/inProcess/mainFunction}/template.ejs +0 -0
- /package/src/{TemplateManager/src/reStructureExample/TemplateData/perAction/data.js → reStructure/TemplateData/flowSchema/components/schema/inProcess/sns-sqs/template.ejs} +0 -0
- /package/src/{TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/sqs-sns/template.ejs → reStructure/TemplateData/flowSchema/components/upload/hook/queue/sqsTemplate.ejs} +0 -0
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
'use strict';
|
|
18
|
+
|
|
19
|
+
// const RBAC_TARGET_ID = process.env.iz_rbacTargetIdUser; // iz_rbacTargetIdUser | iz_rbacDeliveryMethodId
|
|
20
|
+
|
|
21
|
+
const izara = require("@izara_project/izara-middleware");
|
|
22
|
+
const middleware = izara.middlewareHandler;
|
|
23
|
+
const Logger = require('@izara_project/izara-core-library-logger/src/Logger');
|
|
24
|
+
const izaraShared = require("@izara_project/izara-shared");
|
|
25
|
+
const recordHandlerS3SharedLib = izaraShared.recordHandlerS3SharedLib;
|
|
26
|
+
|
|
27
|
+
const processAfterUpload = require('./ProcessAfterUploadS3_Main')
|
|
28
|
+
//--------------------------------------------------------------------------
|
|
29
|
+
middleware.setValidatorSchema(recordHandlerS3SharedLib.baseValidatorSchemaS3());
|
|
30
|
+
|
|
31
|
+
module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
32
|
+
try {
|
|
33
|
+
Logger.debug("event is:", event)
|
|
34
|
+
Logger.debug("event.Records[0] is:", event.Records[0])
|
|
35
|
+
|
|
36
|
+
let processImageResponse = await processAfterUpload.processAfterUpload(
|
|
37
|
+
event._izContext, // correlationId/logger/integrationTestDetail/uniqueRequestId/userId
|
|
38
|
+
event.Records[0].s3.bucket,
|
|
39
|
+
event.Records[0].s3.object,
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
if (processImageResponse instanceof Error) {
|
|
43
|
+
return (izara.response.failure(processImageResponse));
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return (izara.response.success(processImageResponse));
|
|
47
|
+
|
|
48
|
+
} catch (err) {
|
|
49
|
+
event._izContext.logger.error('Error, processAfterUploadHdrS3: ', err);
|
|
50
|
+
return (izara.response.failure(err));
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
//
|
|
55
|
+
// s3: {
|
|
56
|
+
// s3SchemaVersion: '1.0',
|
|
57
|
+
// configurationId: 'ImageStandardTestProcessImageFileHdrS3-68a737133cefb25bff959852b8f04754',
|
|
58
|
+
// bucket: {
|
|
59
|
+
// name: 'image-test-importdata',
|
|
60
|
+
// ownerIdentity: { principalId: 'A3CDE97VJKTOJ0' },
|
|
61
|
+
// arn: 'arn:aws:s3:::image-test-importdata'
|
|
62
|
+
// },
|
|
63
|
+
// object: {
|
|
64
|
+
// key: 'image_8733685.png',
|
|
65
|
+
// size: 2974746,
|
|
66
|
+
// eTag: '93e940d895c26ef90b7542da54d61898',
|
|
67
|
+
// sequencer: '00650D4EEAD0F63EB5'
|
|
68
|
+
// }
|
package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/mainFunction/data.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
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
|
+
'use strict';
|
|
19
|
+
|
|
20
|
+
const path = require("path")
|
|
21
|
+
|
|
22
|
+
const { firstLetterUpperCase: upperCase } = require('../../../../../../../MainLibs/src/Utils');
|
|
23
|
+
const {
|
|
24
|
+
SOURCE_PATH,
|
|
25
|
+
SAVE_FILE_NAME,
|
|
26
|
+
defaultIamRolePerAction,
|
|
27
|
+
createIamRole,
|
|
28
|
+
RESOURCE_CLASSES,
|
|
29
|
+
S3_RESOURCE,
|
|
30
|
+
resourceNames,
|
|
31
|
+
DYNAMO_RESOURCE,
|
|
32
|
+
SQS_RESOURCE,
|
|
33
|
+
SNS_RESOURCE,
|
|
34
|
+
shortNameHandler,
|
|
35
|
+
HANDLER,
|
|
36
|
+
FUNCTION_NAME
|
|
37
|
+
} = require('../../../../../../../MainLibs/src/Consts');
|
|
38
|
+
|
|
39
|
+
const templatePath = path.join(__dirname, "./template.ejs")
|
|
40
|
+
|
|
41
|
+
function data(_izContext, srcPath) {
|
|
42
|
+
return [createSourceParams(_izContext, srcPath)]
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function createSourceParams(_izContext, srcPath) {
|
|
46
|
+
let functionName = upperCase(FUNCTION_NAME.processAfterUploadS3)
|
|
47
|
+
return {
|
|
48
|
+
templatePath: templatePath,
|
|
49
|
+
templateData: {},
|
|
50
|
+
setting: {
|
|
51
|
+
saveFileName: `${functionName}_Main`,
|
|
52
|
+
savePath: path.join(srcPath, SOURCE_PATH.webSocket),
|
|
53
|
+
fileExtension: ".js",
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
module.exports = data;
|
|
@@ -0,0 +1,392 @@
|
|
|
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
|
+
'use strict';
|
|
19
|
+
|
|
20
|
+
const izaraShared = require('@izara_project/izara-shared');
|
|
21
|
+
const callingFlowSharedLib = izaraShared.callingFlowSharedLib;
|
|
22
|
+
const snsSharedLib = izaraShared.snsSharedLib;
|
|
23
|
+
const dynamodbSharedLib = izaraShared.dynamodbSharedLib;
|
|
24
|
+
const lambdaSharedLib = izaraShared.lambdaSharedLib;
|
|
25
|
+
|
|
26
|
+
const externalRequest = require('@izara_project/izara-core-library-external-request')
|
|
27
|
+
const lambda = externalRequest.lambda;
|
|
28
|
+
const sns = externalRequest.sns;
|
|
29
|
+
const NoRetryError = require('@izara_project/izara-core-library-core').NoRetryError;
|
|
30
|
+
const utils = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Utils');
|
|
31
|
+
|
|
32
|
+
const { S3Client, GetObjectCommand, DeleteObjectCommand, PutObjectCommand, CopyObjectCommand } = require('@aws-sdk/client-s3');
|
|
33
|
+
const s3 = new S3Client({ region: 'us-east-2' });
|
|
34
|
+
|
|
35
|
+
const hash = require('object-hash');
|
|
36
|
+
const Readable = require('stream');
|
|
37
|
+
const { isValidCsv, getNestObject } = require('../../libs/source/ImportDataLib')
|
|
38
|
+
const consts = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
39
|
+
const coreConsts = require('@izara_project/izara-core-library-core/src/Consts');
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* description of function.
|
|
44
|
+
* @param {Object} _izContext
|
|
45
|
+
* @param {CorrelationIds} _izContext.correlationIds - property of _izContext
|
|
46
|
+
* @param {Logger} _izContext.logger - property of _izContext
|
|
47
|
+
* @param {Logger} _izContext.logger.debug - property of _izContext
|
|
48
|
+
* @param {Object} bucket - bucket's data
|
|
49
|
+
* @param {Array} field - image's data
|
|
50
|
+
* @param {Array} importBy - 'webSocket' || 'importData'
|
|
51
|
+
* @param {Array} imageImportId - from importData
|
|
52
|
+
* @param {Array} realImageSize - from importData
|
|
53
|
+
* @param {Array} passBackProperties - from importData
|
|
54
|
+
*
|
|
55
|
+
* @returns {object} returnResponse
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
module.exports.processAfterUpload = async (
|
|
59
|
+
_izContext,
|
|
60
|
+
bucket,
|
|
61
|
+
field,
|
|
62
|
+
importBy = '',
|
|
63
|
+
importBatchId = '',
|
|
64
|
+
realImageSize = 0,
|
|
65
|
+
passBackProperties = {}
|
|
66
|
+
) => {
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
|
|
70
|
+
_izContext.logger.debug('----- processImageFile event params ----- ', {
|
|
71
|
+
bucket: bucket,
|
|
72
|
+
field: field,
|
|
73
|
+
importBy: importBy,
|
|
74
|
+
importBatchId: importBatchId,
|
|
75
|
+
realImageSize: realImageSize,
|
|
76
|
+
passBackProperties: passBackProperties
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
let errorsFound = [];
|
|
80
|
+
|
|
81
|
+
const objectS3Param = {
|
|
82
|
+
Bucket: bucket.name,
|
|
83
|
+
Key: field.key
|
|
84
|
+
}
|
|
85
|
+
_izContext.logger.debug("params before getObjectParam::", objectS3Param)
|
|
86
|
+
|
|
87
|
+
const fileObjectS3 = await s3.send(new GetObjectCommand(objectS3Param));
|
|
88
|
+
_izContext.logger.debug("get fileObjectS3", fileObjectS3);
|
|
89
|
+
|
|
90
|
+
importBatchId = fileObjectS3.Metadata.importbatchid
|
|
91
|
+
|
|
92
|
+
let getImportBatchMain = await lambda.invokeSync(_izContext,
|
|
93
|
+
await lambdaSharedLib.lambdaFunctionName(_izContext, "ImportBatchMainGetHdrInv"),
|
|
94
|
+
{
|
|
95
|
+
identifiers: {
|
|
96
|
+
importBatchId: importBatchId
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
_izContext.logger.debug("getImportBatchMain", getImportBatchMain)
|
|
102
|
+
_izContext.correlationIds.set(coreConsts.BASE_USER_ID, getImportBatchMain.fields.userId);
|
|
103
|
+
_izContext.correlationIds.set(coreConsts.TARGET_ID, getImportBatchMain.fields.submittedByUserId);
|
|
104
|
+
|
|
105
|
+
let userId = _izContext.correlationIds.get(coreConsts.BASE_USER_ID);
|
|
106
|
+
let targetId = _izContext.correlationIds.get(coreConsts.TARGET_ID);
|
|
107
|
+
|
|
108
|
+
if (Date.now() > getImportBatchMain.fields.expiryTimestamp) {
|
|
109
|
+
errorsFound.push("url expired can't upload")
|
|
110
|
+
let sendMessageUpdateUrlExpired = {
|
|
111
|
+
objInstanceFull: {
|
|
112
|
+
identifiers: {
|
|
113
|
+
importBatchId: importBatchId
|
|
114
|
+
},
|
|
115
|
+
fields: {
|
|
116
|
+
importBatchStatus: "urlExpired",
|
|
117
|
+
errorsFound: "url expired can't upload",
|
|
118
|
+
processingError: true
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
let sendMessageToInImportBatchUpdate = {
|
|
124
|
+
Message: JSON.stringify(sendMessageUpdateUrlExpired),
|
|
125
|
+
TopicArn: await snsSharedLib.snsTopicArn(_izContext, "InImportBatchMainUpdate")
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
_izContext.logger.debug("message param before send to updateImportBatchMain", sendMessageToInImportBatchUpdate);
|
|
129
|
+
await sns.publishAsync(_izContext, sendMessageToInImportBatchUpdate);
|
|
130
|
+
|
|
131
|
+
let deleteFileObjectS3 = await s3.send(new DeleteObjectCommand(objectS3Param));
|
|
132
|
+
_izContext.logger.debug("Delete object response: ", deleteFileObjectS3)
|
|
133
|
+
|
|
134
|
+
return
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
if (fileObjectS3) {
|
|
138
|
+
if (!importBatchId) {
|
|
139
|
+
errorsFound.push("cant't get importBatchId from S3 uploaded file");
|
|
140
|
+
}
|
|
141
|
+
} else {
|
|
142
|
+
errorsFound.push("cant't get fileObjectS3 from S3 uploaded file");
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
let fileS3Body = fileObjectS3.Body;
|
|
146
|
+
_izContext.logger.debug("fileS3Body", fileS3Body);
|
|
147
|
+
|
|
148
|
+
let fileS3Buffer = null;
|
|
149
|
+
|
|
150
|
+
if (fileS3Body instanceof Readable) {
|
|
151
|
+
fileS3Buffer = Buffer.concat(await fileS3Body.toArray());
|
|
152
|
+
_izContext.logger.debug("fileS3Buffer", fileS3Buffer)
|
|
153
|
+
} else {
|
|
154
|
+
errorsFound.push('unknow object stream type');
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// check file type
|
|
158
|
+
// can be strict in function.yml that only trigger if it specific type of file
|
|
159
|
+
const srcKey = field.key;
|
|
160
|
+
const importFieldType = srcKey.match(/\.([^.]*)$/);
|
|
161
|
+
_izContext.logger.debug("importFieldType", importFieldType);
|
|
162
|
+
if (!importFieldType) {
|
|
163
|
+
throw new NoRetryError("error fileType")
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const importKeyType = utils.firstLetterLowerCase(importFieldType[1]);
|
|
167
|
+
_izContext.logger.debug("importKeyType", importKeyType);
|
|
168
|
+
|
|
169
|
+
if (importKeyType === "csv") {
|
|
170
|
+
// check valid CSV file
|
|
171
|
+
let [validCsv, errorCheckCsv] = await isValidCsv(_izContext, fileObjectS3)
|
|
172
|
+
_izContext.logger.debug("validCsv check::", { validCsv, errorsFound })
|
|
173
|
+
if (errorCheckCsv.length) {
|
|
174
|
+
errorsFound.push(errorCheckCsv[0])
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// check file size
|
|
178
|
+
let reservedFileSize = getImportBatchMain.fields.fileSize;
|
|
179
|
+
_izContext.logger.debug("initialFileSize::", reservedFileSize)
|
|
180
|
+
let s3FileSize = fileObjectS3.ContentLength / 1048576 // convert back to byte unit
|
|
181
|
+
_izContext.logger.debug("s3FileSize in MiB::", s3FileSize)
|
|
182
|
+
|
|
183
|
+
if (s3FileSize < 0.5) { // round up to 1
|
|
184
|
+
s3FileSize = 1
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
let reservedData = await dynamodbSharedLib.getItem(_izContext,
|
|
188
|
+
await dynamodbSharedLib.tableName(_izContext, "ReservedDataMain"),
|
|
189
|
+
{
|
|
190
|
+
servicePendingId: importBatchId,
|
|
191
|
+
reservedDataId: `${consts.ACCOUNTLIMIT_TAG.reservedDynamic}_${getImportBatchMain.fields.userId}_${consts.LIMIT_TAG.uploadData}`
|
|
192
|
+
}
|
|
193
|
+
)
|
|
194
|
+
_izContext.logger.debug("reservedData::", reservedData);
|
|
195
|
+
|
|
196
|
+
let sizeDiff;
|
|
197
|
+
|
|
198
|
+
if (s3FileSize > reservedFileSize) {
|
|
199
|
+
sizeDiff = s3FileSize - reservedFileSize;
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
if (sizeDiff < 1) {
|
|
203
|
+
|
|
204
|
+
// send message to confirmUsage
|
|
205
|
+
let confirmUsageMessage = {
|
|
206
|
+
userId: userId,
|
|
207
|
+
limitTag: consts.LIMIT_TAG.uploadData,
|
|
208
|
+
uniqueIdentify: reservedData.uniqueIdentify,
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
let sendMessageToConfirmUsage = {
|
|
212
|
+
Message: JSON.stringify(confirmUsageMessage),
|
|
213
|
+
TopicArn: await snsSharedLib.snsTopicArn(_izContext, 'InConfirmUsage', consts.EXTERNAL_SERVICE_NAME.accountLimits)
|
|
214
|
+
};
|
|
215
|
+
_izContext.logger.debug("sendMessageToConfirmUsage", sendMessageToConfirmUsage);
|
|
216
|
+
await sns.publishAsync(_izContext, sendMessageToConfirmUsage);
|
|
217
|
+
|
|
218
|
+
let sendMessageToUpdateImportBatchStatus = {
|
|
219
|
+
objInstanceFull: {
|
|
220
|
+
identifiers: {
|
|
221
|
+
importBatchId: servicePendingId
|
|
222
|
+
},
|
|
223
|
+
fields: {
|
|
224
|
+
importBatchStatus: 'uploadComplete'
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
let sendMessageToUpdateImportBatch = {
|
|
230
|
+
Message: JSON.stringify(sendMessageToUpdateImportBatchStatus),
|
|
231
|
+
TopicArn: await snsSharedLib.snsTopicArn(_izContext, `InImportBatchMainUpdate`)
|
|
232
|
+
};
|
|
233
|
+
_izContext.logger.debug("sendMessageToUpdateImportBatch", sendMessageToUpdateImportBatch);
|
|
234
|
+
await sns.publishAsync(_izContext, sendMessageToUpdateImportBatch);
|
|
235
|
+
|
|
236
|
+
}
|
|
237
|
+
} else if (s3FileSize < reservedFileSize) {
|
|
238
|
+
sizeDiff = reservedFileSize - s3FileSize;
|
|
239
|
+
|
|
240
|
+
if (sizeDiff < 1) {
|
|
241
|
+
let confirmUsageMessage = {
|
|
242
|
+
userId: userId,
|
|
243
|
+
limitTag: consts.LIMIT_TAG.uploadData,
|
|
244
|
+
uniqueIdentify: reservedData.uniqueIdentify,
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
let sendMessageToConfirmUsage = {
|
|
248
|
+
Message: JSON.stringify(confirmUsageMessage),
|
|
249
|
+
TopicArn: await snsSharedLib.snsTopicArn(_izContext, 'InConfirmUsage', consts.EXTERNAL_SERVICE_NAME.accountLimits)
|
|
250
|
+
};
|
|
251
|
+
_izContext.logger.debug("sendMessageToConfirmUsage", sendMessageToConfirmUsage);
|
|
252
|
+
await sns.publishAsync(_izContext, sendMessageToConfirmUsage);
|
|
253
|
+
|
|
254
|
+
let sendMessageToUpdateImportBatchStatus = {
|
|
255
|
+
objInstanceFull: {
|
|
256
|
+
identifiers: {
|
|
257
|
+
importBatchId: servicePendingId
|
|
258
|
+
},
|
|
259
|
+
fields: {
|
|
260
|
+
importBatchStatus: 'uploadComplete'
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
let sendMessageToUpdateImportBatch = {
|
|
266
|
+
Message: JSON.stringify(sendMessageToUpdateImportBatchStatus),
|
|
267
|
+
TopicArn: await snsSharedLib.snsTopicArn(_izContext, `InImportBatchMainUpdate`)
|
|
268
|
+
};
|
|
269
|
+
_izContext.logger.debug("sendMessageToUpdateImportBatch", sendMessageToUpdateImportBatch);
|
|
270
|
+
await sns.publishAsync(_izContext, sendMessageToUpdateImportBatch);
|
|
271
|
+
|
|
272
|
+
} else {
|
|
273
|
+
let realFileSize = Math.round(s3FileSize);
|
|
274
|
+
// cancel reserved -> new reserved -> confirm
|
|
275
|
+
// cancel
|
|
276
|
+
let sendMessageToCancelReserved = {
|
|
277
|
+
Message: JSON.stringify({
|
|
278
|
+
userId: userId,
|
|
279
|
+
limitTag: consts.LIMIT_TAG.uploadData,
|
|
280
|
+
uniqueIdentify: reservedData.uniqueIdentify
|
|
281
|
+
}),
|
|
282
|
+
TopicArn: await snsSharedLib.snsTopicArn(_izContext, 'InCancelUsage', consts.EXTERNAL_SERVICE_NAME.accountLimits)
|
|
283
|
+
};
|
|
284
|
+
_izContext.logger.debug("sendMessageToCancelReserved", sendMessageToCancelReserved);
|
|
285
|
+
await sns.publishAsync(_izContext, sendMessageToCancelReserved);
|
|
286
|
+
|
|
287
|
+
// new reserved
|
|
288
|
+
let originTimestamp = Date.now();
|
|
289
|
+
let messageObjReserved = {
|
|
290
|
+
userId: userId,
|
|
291
|
+
limitTag: consts.LIMIT_TAG.uploadData,
|
|
292
|
+
value: realFileSize,
|
|
293
|
+
rbacType: consts.RBAC_TYPE.appLevel,
|
|
294
|
+
usedTimestamp: originTimestamp,
|
|
295
|
+
targetUserId: targetId
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
let callingFlowProperties = {
|
|
299
|
+
identifier: {
|
|
300
|
+
servicePendingId: importBatchId,
|
|
301
|
+
reservedDataId: `${consts.ACCOUNTLIMIT_TAG.reservedDynamic}_${getImportBatchMain.fields.userId}_${consts.LIMIT_TAG.uploadData}`,
|
|
302
|
+
userId: getImportBatchMain.fields.userId,
|
|
303
|
+
realSize: realFileSize
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
messageObjReserved = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
|
|
308
|
+
messageObjReserved,
|
|
309
|
+
callingFlowSharedLib.createCallingFlowConfig(
|
|
310
|
+
await lambdaSharedLib.lambdaFunctionName(_izContext, "ConfirmNewReservedHdrSqs"),
|
|
311
|
+
callingFlowProperties
|
|
312
|
+
)
|
|
313
|
+
)
|
|
314
|
+
_izContext.logger.debug('after add callingFlow: ', messageObjReserved)
|
|
315
|
+
|
|
316
|
+
let sendMessageToReservedDynamic = {
|
|
317
|
+
Message: JSON.stringify(messageObjReserved),
|
|
318
|
+
TopicArn: await snsSharedLib.snsTopicArn(_izContext, 'InReservedDynamicUsage', consts.EXTERNAL_SERVICE_NAME.accountLimits)
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
_izContext.logger.debug("sendMessageToReservedDynamic", sendMessageToReservedDynamic);
|
|
322
|
+
await sns.publishAsync(_izContext, sendMessageToReservedDynamic);
|
|
323
|
+
};
|
|
324
|
+
} else if (s3FileSize === reservedFileSize) {
|
|
325
|
+
let confirmUsageMessage = {
|
|
326
|
+
userId: getImportBatchMain.fields.userId,
|
|
327
|
+
limitTag: consts.LIMIT_TAG.uploadData,
|
|
328
|
+
uniqueIdentify: reservedData.uniqueIdentify,
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
let sendMessageToConfirmUsage = {
|
|
332
|
+
Message: JSON.stringify(confirmUsageMessage),
|
|
333
|
+
TopicArn: await snsSharedLib.snsTopicArn(_izContext, 'InConfirmUsage', consts.EXTERNAL_SERVICE_NAME.accountLimits)
|
|
334
|
+
};
|
|
335
|
+
_izContext.logger.debug("sendMessageToConfirmUsage", sendMessageToConfirmUsage);
|
|
336
|
+
await sns.publishAsync(_izContext, sendMessageToConfirmUsage);
|
|
337
|
+
|
|
338
|
+
let sendMessageToUpdateImportBatchStatus = {
|
|
339
|
+
objInstanceFull: {
|
|
340
|
+
identifiers: {
|
|
341
|
+
importBatchId: servicePendingId
|
|
342
|
+
},
|
|
343
|
+
fields: {
|
|
344
|
+
importBatchStatus: 'uploadComplete'
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
let sendMessageToUpdateImportBatch = {
|
|
350
|
+
Message: JSON.stringify(sendMessageToUpdateImportBatchStatus),
|
|
351
|
+
TopicArn: await snsSharedLib.snsTopicArn(_izContext, `InImportBatchMainUpdate`)
|
|
352
|
+
};
|
|
353
|
+
_izContext.logger.debug("sendMessageToUpdateImportBatch", sendMessageToUpdateImportBatch);
|
|
354
|
+
await sns.publishAsync(_izContext, sendMessageToUpdateImportBatch);
|
|
355
|
+
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
} else {
|
|
359
|
+
errorsFound.push("error importKeyType")
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
if (errorsFound.length) { // if error send message to update error in importBatchMain
|
|
363
|
+
let updateImportBatchMainError = {
|
|
364
|
+
objInstanceFull: {
|
|
365
|
+
identifiers: {
|
|
366
|
+
importBatchId: importBatchId
|
|
367
|
+
},
|
|
368
|
+
fields: {
|
|
369
|
+
importBatchStatus: "errorToUpload",
|
|
370
|
+
errorsFound: errorsFound,
|
|
371
|
+
processingError: true
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
let sendMessageToUpdateImportBatchMain = {
|
|
377
|
+
Message: JSON.stringify(updateImportBatchMainError),
|
|
378
|
+
TopicArn: await snsSharedLib.snsTopicArn(_izContext, "InImportBatchMainUpdate")
|
|
379
|
+
};
|
|
380
|
+
_izContext.logger.debug('sendMessageToUpdateImportBatchMain::', sendMessageToUpdateImportBatchMain);
|
|
381
|
+
await sns.publishAsync(_izContext, sendMessageToUpdateImportBatchMain);
|
|
382
|
+
|
|
383
|
+
let deleteFileObjectS3 = await s3.send(new DeleteObjectCommand(objectS3Param));
|
|
384
|
+
_izContext.logger.debug("Delete object response: ", deleteFileObjectS3)
|
|
385
|
+
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
} catch (err) {
|
|
389
|
+
_izContext.logger.error('error ProcessImageAfterUploadMain: ', err)
|
|
390
|
+
throw (err)
|
|
391
|
+
}
|
|
392
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
+
'use strict';
|
|
19
|
+
|
|
20
|
+
const path = require("path")
|
|
21
|
+
|
|
22
|
+
const { SOURCE_PATH, SAVE_FILE_NAME } = require('../../../../../../../MainLibs/src/Consts');
|
|
23
|
+
const { TOPIC_NAME_GENERATE_CODE } = require("../../../../../../../GenerateCodeLibs/src/Consts");
|
|
24
|
+
|
|
25
|
+
const s3TemplatePath = path.join(__dirname, './s3Template.ejs');
|
|
26
|
+
const dsqTemplatePath = path.join(__dirname, "./dsqTemplatePath.ejs")
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* create data for dynamoDbYaml tempalte from objectSchema
|
|
30
|
+
* return array of dynamoDb data
|
|
31
|
+
* because one objectSchema can create multiple dynamoDb table
|
|
32
|
+
*
|
|
33
|
+
* @param {Object} _izContext
|
|
34
|
+
* @param {Object} objectSchema
|
|
35
|
+
* @returns {Object[]} - data of multiple dynamoDb template
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
function data(_izContext, srcPath) {
|
|
39
|
+
let resultForCreateSqs = [];
|
|
40
|
+
const WebSocketSqsQueueNames = [];
|
|
41
|
+
const setting = {
|
|
42
|
+
initialData: "Resources:\n",
|
|
43
|
+
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
44
|
+
saveFileName: SAVE_FILE_NAME.snsInSqsYaml,
|
|
45
|
+
fileExtension: ".yml",
|
|
46
|
+
isAppend: true
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
WebSocketSqsQueueNames.push(
|
|
50
|
+
{
|
|
51
|
+
queueName: "ProcessAfterUploadS3"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
queueName: "ProcessAfterUploadHdrDsq"
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
for (let WebSocketSqsQueueName of WebSocketSqsQueueNames) {
|
|
59
|
+
if (WebSocketSqsQueueName.queueName.includes("HdrDsq")) {
|
|
60
|
+
resultForCreateSqs.push(
|
|
61
|
+
{
|
|
62
|
+
templatePath: dsqTemplatePath,
|
|
63
|
+
templateData: WebSocketSqsQueueName,
|
|
64
|
+
setting: setting
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
} else {
|
|
68
|
+
resultForCreateSqs.push(({
|
|
69
|
+
templatePath: s3TemplatePath,
|
|
70
|
+
templateData: WebSocketSqsQueueName,
|
|
71
|
+
setting: setting
|
|
72
|
+
}))
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return resultForCreateSqs
|
|
76
|
+
}
|
|
77
|
+
module.exports = data;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#----[Queue]
|
|
2
|
+
<%- queueName %>:
|
|
3
|
+
Type: "AWS::SQS::Queue"
|
|
4
|
+
Properties:
|
|
5
|
+
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>
|
|
6
|
+
RedrivePolicy:
|
|
7
|
+
deadLetterTargetArn: !GetAtt
|
|
8
|
+
- <%- queueName %>DLQ
|
|
9
|
+
- Arn
|
|
10
|
+
maxReceiveCount: 3
|
|
11
|
+
VisibilityTimeout: 120
|
|
12
|
+
#----[QueueDLQ]
|
|
13
|
+
<%- queueName %>DLQ:
|
|
14
|
+
Type: AWS::SQS::Queue
|
|
15
|
+
Properties:
|
|
16
|
+
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>DLQ
|
|
17
|
+
#----[DataPolicy]
|
|
18
|
+
<%- queueName %>Policy:
|
|
19
|
+
Type: AWS::SQS::QueuePolicy
|
|
20
|
+
Properties:
|
|
21
|
+
PolicyDocument:
|
|
22
|
+
Version: "2012-10-17"
|
|
23
|
+
Statement:
|
|
24
|
+
- Sid: "allow-sns-messages"
|
|
25
|
+
Effect: Allow
|
|
26
|
+
Principal: "*"
|
|
27
|
+
Resource: !GetAtt
|
|
28
|
+
- <%- queueName %>
|
|
29
|
+
- Arn
|
|
30
|
+
Action: "SQS:SendMessage"
|
|
31
|
+
Queues:
|
|
32
|
+
- Ref: <%- queueName %>
|
package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/queue/s3Template.ejs
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# ----- [Topic]
|
|
2
|
+
In<%- queueName %>:
|
|
3
|
+
Type: AWS::SNS::Topic
|
|
4
|
+
Properties:
|
|
5
|
+
DisplayName: "SNS Message in ProcessImageAfterUploadHdrSqs"
|
|
6
|
+
TopicName: ${self:custom.iz_resourcePrefix}In<%- queueName %>
|
|
7
|
+
# ----- [Subscription]
|
|
8
|
+
SNSSubscriptionIn<%- queueName %>:
|
|
9
|
+
Type: AWS::SNS::Subscription
|
|
10
|
+
Properties:
|
|
11
|
+
RawMessageDelivery: true
|
|
12
|
+
TopicArn: !Ref In<%- queueName %>
|
|
13
|
+
Endpoint: "arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- queueName %>"
|
|
14
|
+
Protocol: "sqs"
|
|
15
|
+
##===== [Queue]
|
|
16
|
+
<%- queueName %>:
|
|
17
|
+
Type: "AWS::SQS::Queue"
|
|
18
|
+
Properties:
|
|
19
|
+
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>
|
|
20
|
+
RedrivePolicy:
|
|
21
|
+
deadLetterTargetArn:
|
|
22
|
+
# !GetAtt
|
|
23
|
+
Fn::GetAtt:
|
|
24
|
+
- <%- queueName %>DLQ
|
|
25
|
+
- Arn
|
|
26
|
+
maxReceiveCount: 3
|
|
27
|
+
VisibilityTimeout: 120
|
|
28
|
+
##==== [QueueDLQ]
|
|
29
|
+
<%- queueName %>DLQ:
|
|
30
|
+
Type: AWS::SQS::Queue
|
|
31
|
+
Properties:
|
|
32
|
+
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>DLQ
|
|
33
|
+
##==== [QueuePolicy]
|
|
34
|
+
<%- queueName %>Policy:
|
|
35
|
+
Type: AWS::SQS::QueuePolicy
|
|
36
|
+
Properties:
|
|
37
|
+
PolicyDocument:
|
|
38
|
+
Version: "2012-10-17"
|
|
39
|
+
Statement:
|
|
40
|
+
- Sid: "allow-sns-messages"
|
|
41
|
+
Effect: Allow
|
|
42
|
+
Principal: "*"
|
|
43
|
+
Resource:
|
|
44
|
+
# !GetAtt
|
|
45
|
+
Fn::GetAtt:
|
|
46
|
+
- <%- queueName %>
|
|
47
|
+
- Arn
|
|
48
|
+
Action: "SQS:SendMessage"
|
|
49
|
+
Queues:
|
|
50
|
+
- Ref: <%- queueName %>
|
|
51
|
+
#<#<%- firstLetterUpperCase(queueName) %>QueueSetting#>
|
|
52
|
+
#<#/<%- firstLetterUpperCase(queueName) %>QueueSetting#>
|
|
53
|
+
|
|
54
|
+
<%_ function firstLetterUpperCase(text){
|
|
55
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
56
|
+
} _%>
|
|
57
|
+
<%_ function firstLetterLowerCase(str) {
|
|
58
|
+
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
59
|
+
} _%>
|