@izara_project/izara-market-library-service-schemas 1.0.23 → 1.0.24
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 +2 -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 +2 -3
- 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,131 @@
|
|
|
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 templatePath = path.join(__dirname, "./template.ejs")
|
|
23
|
+
|
|
24
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../../../MainLibs/src/Utils")
|
|
25
|
+
const {
|
|
26
|
+
HANDLER,
|
|
27
|
+
defaultIamRolePerAction,
|
|
28
|
+
createIamRole,
|
|
29
|
+
RESOURCE_CLASSES,
|
|
30
|
+
SQS_RESOURCE,
|
|
31
|
+
SNS_RESOURCE,
|
|
32
|
+
resourceNames,
|
|
33
|
+
shortNameHandler,
|
|
34
|
+
SOURCE_PATH,
|
|
35
|
+
SAVE_FILE_NAME,
|
|
36
|
+
awaitingMultipleStepsRole,
|
|
37
|
+
externalResourceSns,
|
|
38
|
+
externalResourceName,
|
|
39
|
+
DYNAMO_RESOURCE,
|
|
40
|
+
LAMBDA_RESOURCE
|
|
41
|
+
} = require('../../../../../../../../MainLibs/src/Consts');
|
|
42
|
+
|
|
43
|
+
const {
|
|
44
|
+
TOPIC_NAME_GENERATE_CODE
|
|
45
|
+
} = require('../../../../../../../../GenerateCodeLibs/src/Consts');
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* receive objectSchema
|
|
49
|
+
*
|
|
50
|
+
* @param {Object} flowSchema
|
|
51
|
+
* @return {{ templatePath, templateData, setting } }
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
function data(_izContext, srcPath) {
|
|
55
|
+
return [createSourceParams(_izContext, srcPath)]
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function createSourceParams(_izContext, srcPath) {
|
|
59
|
+
let functionName = "ReservedLimitComplete";
|
|
60
|
+
let handlerType = upperCase(HANDLER.hdrSqs);
|
|
61
|
+
let additionalResourcePermission = defaultIamRolePerAction();
|
|
62
|
+
|
|
63
|
+
additionalResourcePermission.push(
|
|
64
|
+
createIamRole(
|
|
65
|
+
{
|
|
66
|
+
[RESOURCE_CLASSES.sqs]: [
|
|
67
|
+
SQS_RESOURCE.receiveMessage,
|
|
68
|
+
SQS_RESOURCE.sendMessage,
|
|
69
|
+
SQS_RESOURCE.deleteMessage,
|
|
70
|
+
SQS_RESOURCE.getQueueAttributes
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
[
|
|
74
|
+
resourceNames(RESOURCE_CLASSES.sqs, functionName + handlerType),
|
|
75
|
+
resourceNames(RESOURCE_CLASSES.sqs, functionName + "DLQ"),
|
|
76
|
+
]
|
|
77
|
+
),
|
|
78
|
+
createIamRole(
|
|
79
|
+
{
|
|
80
|
+
[RESOURCE_CLASSES.dynamoDbTable]: [
|
|
81
|
+
DYNAMO_RESOURCE.query,
|
|
82
|
+
DYNAMO_RESOURCE.deleteItem,
|
|
83
|
+
DYNAMO_RESOURCE.updateItem,
|
|
84
|
+
DYNAMO_RESOURCE.putItem
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
[
|
|
88
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "WebSocketTask"),
|
|
89
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "ReservedDataMain"),
|
|
90
|
+
]
|
|
91
|
+
),
|
|
92
|
+
createIamRole(
|
|
93
|
+
{
|
|
94
|
+
"execute-api": "ManageConnections"
|
|
95
|
+
},
|
|
96
|
+
[
|
|
97
|
+
resourceNames(RESOURCE_CLASSES.webSocket)
|
|
98
|
+
]
|
|
99
|
+
),
|
|
100
|
+
createIamRole(
|
|
101
|
+
{
|
|
102
|
+
[RESOURCE_CLASSES.lambda]: [LAMBDA_RESOURCE.invokeFunction],
|
|
103
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
104
|
+
},
|
|
105
|
+
[
|
|
106
|
+
resourceNames(RESOURCE_CLASSES.lambda, "ImportBatchMainGetHdrInv"),
|
|
107
|
+
resourceNames(RESOURCE_CLASSES.sns, "InImportBatchMainUpdate")
|
|
108
|
+
]
|
|
109
|
+
)
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
return {
|
|
113
|
+
templatePath: templatePath,
|
|
114
|
+
templateData: {
|
|
115
|
+
functionName,
|
|
116
|
+
handlerType,
|
|
117
|
+
functionNameConfig: functionName + upperCase(handlerType),
|
|
118
|
+
resourceLocation: SOURCE_PATH.resourceLocationWebSocket,
|
|
119
|
+
additionalResourcePermission,
|
|
120
|
+
functionNameConfig: upperCase("ReservedLimitComp") + upperCase(shortNameHandler(handlerType)),
|
|
121
|
+
},
|
|
122
|
+
setting: {
|
|
123
|
+
saveFileName: upperCase(SAVE_FILE_NAME.flowSchema),
|
|
124
|
+
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
125
|
+
fileExtension: ".yml",
|
|
126
|
+
isAppend: true
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
module.exports = data
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<%_ const join = require('path').join; _%>
|
|
2
|
+
<%- firstLetterUpperCase(functionNameConfig) %>:
|
|
3
|
+
handler: <%- join(resourceLocation, `${functionName}_${firstLetterUpperCase(handlerType)}.main`)%>
|
|
4
|
+
name: ${self:custom.iz_resourcePrefix}<%- functionName %><%- firstLetterUpperCase(handlerType) %>
|
|
5
|
+
events:
|
|
6
|
+
- sqs:
|
|
7
|
+
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- functionName %><%- firstLetterUpperCase(handlerType) %>
|
|
8
|
+
batchSize: 10
|
|
9
|
+
filterPatterns: #**** need to update serverless framwork upper v.2.69.1
|
|
10
|
+
- body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>"]}}} # functionName of callingFlow
|
|
11
|
+
- body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
|
|
12
|
+
iamRoleStatements:
|
|
13
|
+
<%_ additionalResourcePermission.forEach(resourcePermission => { _%>
|
|
14
|
+
- Effect: <%- resourcePermission.effect %>
|
|
15
|
+
Action:
|
|
16
|
+
<%_ Object.keys(resourcePermission.action).forEach(resourcePerAction => { _%>
|
|
17
|
+
<%_ resourcePermission.action[resourcePerAction].forEach(permission => { _%>
|
|
18
|
+
- <%- resourcePerAction %>:<%- permission %>
|
|
19
|
+
<%_ }) _%>
|
|
20
|
+
<%_ }) _%>
|
|
21
|
+
Resource:
|
|
22
|
+
<%_ resourcePermission.resource.forEach(resource => { _%>
|
|
23
|
+
- "<%- resource %>"
|
|
24
|
+
<%_ }) _%>
|
|
25
|
+
<%_}) _%>
|
|
26
|
+
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
27
|
+
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
28
|
+
<%_ function firstLetterUpperCase(text){
|
|
29
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
30
|
+
} _%>
|
|
@@ -0,0 +1,57 @@
|
|
|
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 templatePath = path.join(__dirname, "./template.ejs")
|
|
23
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../../../MainLibs/src/Utils")
|
|
24
|
+
|
|
25
|
+
const { HANDLER, SOURCE_PATH } = require('../../../../../../../../MainLibs/src/Consts');
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* receive objectSchema
|
|
29
|
+
*
|
|
30
|
+
* @param {Object} flowSchema
|
|
31
|
+
* @return {{ templatePath, templateData, setting } }
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
function data(_izContext, srcPath) {
|
|
35
|
+
return [createSourceParams(_izContext, srcPath)]
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function createSourceParams(_izContext, srcPath) {
|
|
39
|
+
let functionName = "ReservedLimitComplete";
|
|
40
|
+
let handlerType = upperCase(HANDLER.hdrSqs);
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
templatePath: templatePath,
|
|
44
|
+
templateData: {
|
|
45
|
+
functionName,
|
|
46
|
+
handlerType,
|
|
47
|
+
},
|
|
48
|
+
setting: {
|
|
49
|
+
saveFileName: `${functionName}_${handlerType}`,
|
|
50
|
+
savePath: path.join(srcPath, SOURCE_PATH.webSocket),
|
|
51
|
+
fileExtension: ".js",
|
|
52
|
+
isAppend: true
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
module.exports = data
|
|
@@ -0,0 +1,126 @@
|
|
|
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 AWS = require('aws-sdk');
|
|
21
|
+
// const sqs = new AWS.SQS({ apiVersion: '2012-11-05' });
|
|
22
|
+
|
|
23
|
+
const izara = require("@izara_project/izara-middleware");
|
|
24
|
+
const middleware = izara.middlewareHandler;
|
|
25
|
+
const recordHandlerSharedLib = require("@izara_project/izara-shared").recordHandlerSharedLib;
|
|
26
|
+
const Logger = require('@izara_project/izara-core-library-logger');
|
|
27
|
+
const izaraShared = require('@izara_project/izara-shared');
|
|
28
|
+
const callingFlowSharedLib = izaraShared.callingFlowSharedLib;
|
|
29
|
+
|
|
30
|
+
const reservedLimitComplete = require('./ReservedLimitComplete_Main');
|
|
31
|
+
|
|
32
|
+
// validate event properties in body.Message of sqs event
|
|
33
|
+
middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
|
|
34
|
+
|
|
35
|
+
// set schema for record.body.Message
|
|
36
|
+
let perRecordsValidatorSchema = {
|
|
37
|
+
type: "object",
|
|
38
|
+
required: [
|
|
39
|
+
'returnMessage',
|
|
40
|
+
'errorsFound',
|
|
41
|
+
'passStatus'
|
|
42
|
+
],
|
|
43
|
+
properties: {
|
|
44
|
+
returnMessage: {
|
|
45
|
+
type: "object"
|
|
46
|
+
},
|
|
47
|
+
errorsFound: {
|
|
48
|
+
type: "array"
|
|
49
|
+
},
|
|
50
|
+
passStatus: {
|
|
51
|
+
type: 'boolean'
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// set schema for record.body.MessageAttributes
|
|
57
|
+
// const messageAttributeValidatorSchema = {
|
|
58
|
+
// type: "object",
|
|
59
|
+
// required: ['msgAtrrParam1', 'msgAtrrParam2'],
|
|
60
|
+
// properties: {
|
|
61
|
+
// msgAtrrParam1: {
|
|
62
|
+
// type: "string"
|
|
63
|
+
// },
|
|
64
|
+
// msgAtrrParam2: {
|
|
65
|
+
// type: "object"
|
|
66
|
+
// }
|
|
67
|
+
// }
|
|
68
|
+
// };
|
|
69
|
+
|
|
70
|
+
perRecordsValidatorSchema = callingFlowSharedLib.addOptionalPassBackPropertiesToValidatorSchema(perRecordsValidatorSchema)
|
|
71
|
+
|
|
72
|
+
module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
73
|
+
|
|
74
|
+
try {
|
|
75
|
+
|
|
76
|
+
let recordPromises = [];
|
|
77
|
+
|
|
78
|
+
// loop each record and send to mainFunction
|
|
79
|
+
await Promise.all(event.Records.map(async record => { // promise.all for map() function
|
|
80
|
+
|
|
81
|
+
let passOnProperties = []
|
|
82
|
+
record._izContext.logger.debug('record ReceiveMsgOutHdrSqs', record);
|
|
83
|
+
|
|
84
|
+
// validate message (and MessageAttributes)
|
|
85
|
+
await recordHandlerSharedLib.validateRecord(
|
|
86
|
+
record, // one record will send to mainFunction
|
|
87
|
+
"ReservedLimitCompleteHdrSqs", // queue name that need to retry or send to dlq
|
|
88
|
+
perRecordsValidatorSchema, // schema for record.Message
|
|
89
|
+
// messageAttributeValidatorSchema // ----- for msgAttr default is null -> do not send this parameter if not want to validate msgAtt
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
// add argument (to invoke lambda) to passOnProperties[]
|
|
93
|
+
passOnProperties.push(record.body.Message.returnMessage)
|
|
94
|
+
passOnProperties.push(record.body.Message.errorsFound)
|
|
95
|
+
passOnProperties.push(record.body.Message.passStatus)
|
|
96
|
+
passOnProperties.push(callingFlowSharedLib.addPassBackPropertiesToPassOnProperties(record.body.Message))
|
|
97
|
+
record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
|
|
98
|
+
|
|
99
|
+
// call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
|
|
100
|
+
let recordPromise = recordHandlerSharedLib.recordHandler(
|
|
101
|
+
record, // one record will send to mainFunction
|
|
102
|
+
reservedLimitComplete.reservedLimitComplete, // mainFunction that need to invoke.
|
|
103
|
+
"ReservedLimitCompleteHdrSqs", // queue name that need to retry or send to dlq
|
|
104
|
+
passOnProperties, // all parameters that mainFunction needed.
|
|
105
|
+
);
|
|
106
|
+
record._izContext.logger.debug('after recordPromise in handler');
|
|
107
|
+
recordPromises.push(recordPromise); // push promise to recordPromises
|
|
108
|
+
}))
|
|
109
|
+
|
|
110
|
+
Logger.debug('before Promise.all(recordPromises) in handler');
|
|
111
|
+
try {
|
|
112
|
+
// --- main await all promises
|
|
113
|
+
await Promise.all(recordPromises); // await all promises
|
|
114
|
+
|
|
115
|
+
return event.Records // return all for local test
|
|
116
|
+
|
|
117
|
+
} catch {
|
|
118
|
+
Logger.debug('Promise.all(recordPromises) in handler threw error (at least one record did no resolve)');
|
|
119
|
+
}
|
|
120
|
+
Logger.debug('after Promise.all(recordPromises) in handler');
|
|
121
|
+
|
|
122
|
+
} catch (err) {
|
|
123
|
+
Logger.error('Unhandled Error, ReservedImageLimitCompleteHdrSqs: ', err);
|
|
124
|
+
throw (err);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
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 templatePath = path.join(__dirname, "./template.ejs")
|
|
23
|
+
|
|
24
|
+
const { SOURCE_PATH } = require('../../../../../../../../MainLibs/src/Consts');
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* receive objectSchema
|
|
28
|
+
*
|
|
29
|
+
* @param {Object} flowSchema
|
|
30
|
+
* @return {{ templatePath, templateData, setting } }
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
function data(_izContext, flowSchema, srcPath) {
|
|
34
|
+
return [createSourceParams(_izContext, flowSchema, srcPath)]
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
38
|
+
let functionName = "ReservedLimitComplete"
|
|
39
|
+
let bucketName = flowSchema.bucketName
|
|
40
|
+
return {
|
|
41
|
+
templatePath: templatePath,
|
|
42
|
+
templateData: {
|
|
43
|
+
bucketName
|
|
44
|
+
},
|
|
45
|
+
setting: {
|
|
46
|
+
saveFileName: `${functionName}_Main`,
|
|
47
|
+
savePath: path.join(srcPath, SOURCE_PATH.webSocket),
|
|
48
|
+
fileExtension: ".js",
|
|
49
|
+
isAppend: false
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
module.exports = data
|
|
@@ -0,0 +1,254 @@
|
|
|
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 asyncFlowSharedLib = izaraShared.asyncFlowSharedLib;
|
|
22
|
+
const snsSharedLib = izaraShared.snsSharedLib;
|
|
23
|
+
const callingFlowSharedLib = izaraShared.callingFlowSharedLib;
|
|
24
|
+
const lambdaSharedLib = izaraShared.lambdaSharedLib;
|
|
25
|
+
const dynamodbSharedLib = izaraShared.dynamodbSharedLib;
|
|
26
|
+
|
|
27
|
+
const externalRequest = require('@izara_project/izara-core-library-external-request')
|
|
28
|
+
const lambda = externalRequest.lambda;
|
|
29
|
+
const sns = externalRequest.sns;
|
|
30
|
+
|
|
31
|
+
const { S3Client } = require('@aws-sdk/client-s3');
|
|
32
|
+
const client = new S3Client({ region: 'us-east-2' });
|
|
33
|
+
const { createPresignedPost } = require('@aws-sdk/s3-presigned-post');
|
|
34
|
+
const consts = require('@izara_project/izara-middleware/src/MiddlewareCore/Consts')
|
|
35
|
+
|
|
36
|
+
const { postToConnection } = require("../../libs/source/ImportDataLib");
|
|
37
|
+
const hash = require('object-hash');
|
|
38
|
+
const utils = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Utils');
|
|
39
|
+
const coreConsts = require('@izara_project/izara-core-library-core/src/Consts');
|
|
40
|
+
const { getNestObject } = require("../../libs/source/ImportDataLib");
|
|
41
|
+
const { EXTERNAL_SERVICE_NAME } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts');
|
|
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 - property of _izContext
|
|
48
|
+
* @param {Object} returnMessage - limitValue or limitFound
|
|
49
|
+
* @param {Array} errorsFound - array
|
|
50
|
+
* @param {boolean} passStatus - true || false
|
|
51
|
+
* @param {Object} passBackProperties - identifier
|
|
52
|
+
*
|
|
53
|
+
* @returns {object} returnResponse
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
module.exports.reservedLimitComplete = async (
|
|
57
|
+
_izContext,
|
|
58
|
+
returnMessage,
|
|
59
|
+
errorsFound,
|
|
60
|
+
passStatus,
|
|
61
|
+
passBackProperties
|
|
62
|
+
) => {
|
|
63
|
+
|
|
64
|
+
try {
|
|
65
|
+
|
|
66
|
+
_izContext.logger.debug('----- ReservedLimitComplete event params -----', {
|
|
67
|
+
returnMessage: returnMessage,
|
|
68
|
+
errorsFound: errorsFound,
|
|
69
|
+
passStatus: passStatus,
|
|
70
|
+
passBackProperties: passBackProperties
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const servicePendingId = passBackProperties.passBackProperties.identifier.servicePendingId; // importBatchId
|
|
74
|
+
const reservedDataId = passBackProperties.passBackProperties.identifier.reservedDataId;
|
|
75
|
+
const objType = passBackProperties.passBackProperties.objType
|
|
76
|
+
|
|
77
|
+
const correlationId = _izContext.correlationIds.get(consts.X_CORRELATION_ID)
|
|
78
|
+
const connectionId = _izContext.correlationIds.get(consts.CONNECTION_ID)
|
|
79
|
+
|
|
80
|
+
// getImportBatchMain from table
|
|
81
|
+
let importBatchMain = await lambda.invokeSync(_izContext,
|
|
82
|
+
await lambdaSharedLib.lambdaFunctionName(_izContext, "ImportBatchMainGetHdrInv"),
|
|
83
|
+
{
|
|
84
|
+
identifiers: {
|
|
85
|
+
importBatchId: servicePendingId
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
_izContext.logger.debug("importBatchMain", importBatchMain);
|
|
90
|
+
|
|
91
|
+
const {
|
|
92
|
+
importBatchId
|
|
93
|
+
} = importBatchMain.identifiers
|
|
94
|
+
|
|
95
|
+
const {
|
|
96
|
+
importBatchStatus,
|
|
97
|
+
importConfigId,
|
|
98
|
+
fileName,
|
|
99
|
+
fileSize,
|
|
100
|
+
importType,
|
|
101
|
+
startTime,
|
|
102
|
+
submittedByUserId,
|
|
103
|
+
userId
|
|
104
|
+
} = importBatchMain.fields
|
|
105
|
+
|
|
106
|
+
let uniqueIdentify = getNestObject(
|
|
107
|
+
_izContext,
|
|
108
|
+
returnMessage,
|
|
109
|
+
['limitFound', 'runningTotal', 'uniqueIdentify', 'usedTimestampId']
|
|
110
|
+
);
|
|
111
|
+
_izContext.logger.debug("uniqueIdentify", uniqueIdentify);
|
|
112
|
+
|
|
113
|
+
await dynamodbSharedLib.putItem(_izContext,
|
|
114
|
+
await dynamodbSharedLib.tableName(_izContext, "ReservedDataMain"),
|
|
115
|
+
{
|
|
116
|
+
servicePendingId: importBatchId, // importBatchId
|
|
117
|
+
reservedDataId: reservedDataId,
|
|
118
|
+
reservedValue: fileSize,
|
|
119
|
+
uniqueIdentify: uniqueIdentify
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
|
|
123
|
+
if (passStatus === false) { // if passStatus false post message to client
|
|
124
|
+
// use correlationId to get connectionId and use connectionId to post message to client
|
|
125
|
+
|
|
126
|
+
_izContext.logger.debug("reserved has reach limit");
|
|
127
|
+
|
|
128
|
+
errorsFound.push("reserved has reach limit")
|
|
129
|
+
// update importBatchMainTable
|
|
130
|
+
let updateImportBatchMainMsg = {
|
|
131
|
+
objInstanceFull: {
|
|
132
|
+
identifiers: {
|
|
133
|
+
importBatchId: importBatchId
|
|
134
|
+
},
|
|
135
|
+
fields: {
|
|
136
|
+
importBatchStatus: "error",
|
|
137
|
+
errorsFound: errorsFound
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
let sendMessageToUpdateImportBatch = {
|
|
143
|
+
Message: JSON.stringify(updateImportBatchMainMsg),
|
|
144
|
+
TopicArn: await snsSharedLib.snsTopicArn(_izContext, `InImportBatchMainUpdate`)
|
|
145
|
+
}
|
|
146
|
+
_izContext.logger.debug("sendMessageToUpdateImportBatch", sendMessageToUpdateImportBatch);
|
|
147
|
+
|
|
148
|
+
// cancel reserved
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
let cancelReservedMsg = {
|
|
152
|
+
userId: userId,
|
|
153
|
+
limitTag: returnMessage.limitTag,
|
|
154
|
+
uniqueIdentify: uniqueIdentify
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
let sendMessageToCancelReserved = {
|
|
158
|
+
Message: JSON.stringify(cancelReservedMsg),
|
|
159
|
+
TopicArn: await snsSharedLib.snsTopicArn(_izContext, 'InCancelUsage', EXTERNAL_SERVICE_NAME.accountLimits)
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
_izContext.logger.debug("sendMessageToCancelReserved", sendMessageToCancelReserved);
|
|
163
|
+
await sns.publishAsync(_izContext, sendMessageToCancelReserved);
|
|
164
|
+
|
|
165
|
+
await postToConnection({ message: "reserved has reach limit" }, connectionId)
|
|
166
|
+
// after post message delete websocket task
|
|
167
|
+
await dynamodbSharedLib.deleteItem(_izContext,
|
|
168
|
+
await dynamodbSharedLib.tableName(_izContext, "WebSocketTask"),
|
|
169
|
+
{
|
|
170
|
+
taskKey: correlationId,
|
|
171
|
+
connectionId: connectionId
|
|
172
|
+
}
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// store reservedDataId and servicePendingId in ReservedDataMain
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
const Key = `${fileName}.${importType}`
|
|
180
|
+
|
|
181
|
+
const maximumSize = fileSize * 1048576 // convert to byte unit for restrict
|
|
182
|
+
_izContext.logger.debug("maximumSize", maximumSize);
|
|
183
|
+
|
|
184
|
+
// create PresignUrl
|
|
185
|
+
let createPresignUrlParam = {
|
|
186
|
+
Bucket: "<%- bucketName %>",
|
|
187
|
+
Key: Key,
|
|
188
|
+
Conditions: [
|
|
189
|
+
["content-length-range", 0, maximumSize],
|
|
190
|
+
["starts-with", "$Content-Type", "file/csv"],
|
|
191
|
+
["eq", "$x-amz-meta-importBatchId", importBatchId]
|
|
192
|
+
],
|
|
193
|
+
fields: {},
|
|
194
|
+
expires: 86400
|
|
195
|
+
};
|
|
196
|
+
_izContext.logger.debug('createPresignUrlParam', createPresignUrlParam);
|
|
197
|
+
|
|
198
|
+
const uploadUrl = await createPresignedPost(client, createPresignUrlParam);
|
|
199
|
+
|
|
200
|
+
uploadUrl.fields['x-amz-meta-importBatchId'] = importBatchId;
|
|
201
|
+
uploadUrl.fields['Content-Type'] = `file/${importType}`;
|
|
202
|
+
|
|
203
|
+
_izContext.logger.debug('uploadUrlLimitSize: ', uploadUrl) // return as object type = {url, fields}
|
|
204
|
+
|
|
205
|
+
// update to waiting to upload
|
|
206
|
+
if (importBatchStatus === "processing") {
|
|
207
|
+
|
|
208
|
+
let updateImportBatchMainMsg = {
|
|
209
|
+
objInstanceFull: {
|
|
210
|
+
identifiers: {
|
|
211
|
+
importBatchId: importBatchId
|
|
212
|
+
},
|
|
213
|
+
fields: {
|
|
214
|
+
importBatchStatus: "waitingToUpload",
|
|
215
|
+
expiryTimestamp: (startTime + (createPresignUrlParam.expires * 1000))
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
updateImportBatchMainMsg = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
|
|
221
|
+
updateImportBatchMainMsg,
|
|
222
|
+
callingFlowSharedLib.addParentCallingFlowConfig(
|
|
223
|
+
returnMessage, // resive parent callingFlowConfig.
|
|
224
|
+
callingFlowSharedLib.createCallingFlowConfig( // callinfflow own service
|
|
225
|
+
await lambdaSharedLib.lambdaFunctionName(_izContext, `WebSocketTaskComplete`), {}
|
|
226
|
+
)
|
|
227
|
+
)
|
|
228
|
+
);
|
|
229
|
+
|
|
230
|
+
_izContext.logger.debug("after add callingFlow", updateImportBatchMainMsg)
|
|
231
|
+
|
|
232
|
+
let sendMessageToUpdateImportBatch = {
|
|
233
|
+
Message: JSON.stringify(updateImportBatchMainMsg),
|
|
234
|
+
TopicArn: await snsSharedLib.snsTopicArn(_izContext, `In${objType.objectType}Update`)
|
|
235
|
+
}
|
|
236
|
+
_izContext.logger.debug("sendMessageToUpdateImportBatch", sendMessageToUpdateImportBatch);
|
|
237
|
+
await sns.publishAsync(_izContext, sendMessageToUpdateImportBatch);
|
|
238
|
+
|
|
239
|
+
await dynamodbSharedLib.updateItem(_izContext,
|
|
240
|
+
await dynamodbSharedLib.tableName(_izContext, "WebSocketTask"),
|
|
241
|
+
{
|
|
242
|
+
taskKey: correlationId,
|
|
243
|
+
connectionId: connectionId
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
uploadUrl: uploadUrl
|
|
247
|
+
}
|
|
248
|
+
)
|
|
249
|
+
}
|
|
250
|
+
} catch (err) {
|
|
251
|
+
_izContext.logger.error('error ReservedImageLimitComplete: ', err)
|
|
252
|
+
throw (err)
|
|
253
|
+
}
|
|
254
|
+
}
|