@izara_project/izara-market-library-service-schemas 1.0.22 → 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 +6 -6
- package/src/GenerateCodeLibs/index.js +1 -0
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +65 -22
- 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/SourceManager/src/CreateSource.js +11 -1
- package/src/TemplateManager/src/FindData/mainFunction/data.js +3 -2
- package/src/TemplateManager/src/GenerateCode.js +1 -0
- package/src/TemplateManager/src/GenerateSchema.js +20 -5
- 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/attributeTree/objectSchema/data.js +23 -20
- package/src/TemplateManager/src/attributeTree/objectSchema/template.ejs +6 -5
- package/src/TemplateManager/src/attributeTree/relationshipSchema/data.js +169 -55
- package/src/TemplateManager/src/attributeTree/relationshipSchema/template.ejs +5 -38
- package/src/TemplateManager/src/externalService/FunctionNameConfig/data.js +2 -3
- package/src/TemplateManager/src/externalService/SnsTopicSubscriotions/data.js +1 -1
- 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 -11
- package/src/TemplateManager/src/reStructureExample/TemplateData/perAction/generateCodeShared.js +0 -1
- package/src/TemplateManager/src/reStructureExample/TemplateData/perAction/generatePerAction.js +0 -5
- /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,28 @@
|
|
|
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
|
+
module.exports.generatedSnsTopicSubscription = [ <% datas.forEach(data => { -%>
|
|
21
|
+
<% data.serviceNames.forEach(serviceName => { -%>
|
|
22
|
+
{
|
|
23
|
+
serviceName: "<%- serviceName %>",
|
|
24
|
+
topicName: "<%- data.topicName %>",
|
|
25
|
+
sqsEndpoint: "<%- data.sqsEndpoint %>"
|
|
26
|
+
},
|
|
27
|
+
<% }) _%>
|
|
28
|
+
<% }) _%>]
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
let identifiersBase = await identifierObj.identifiersBaseFromIdentifiers(
|
|
2
|
+
_izContext,
|
|
3
|
+
objType,
|
|
4
|
+
identifiers
|
|
5
|
+
);
|
|
6
|
+
_izContext.logger.debug("create identifiersBase from identifiers: ", identifiersBase) // object
|
|
7
|
+
|
|
8
|
+
<%- createNameTagBefore(objectType, fieldName) %>
|
|
9
|
+
|
|
10
|
+
let objInstanceBase = await dynamodbSharedLib.getItem(
|
|
11
|
+
_izContext,
|
|
12
|
+
await dynamodbSharedLib.tableName(_izContext, <%- JSON.stringify(tableName) %>),
|
|
13
|
+
identifiersBase
|
|
14
|
+
);
|
|
15
|
+
_izContext.logger.debug("objInstanceBase: ", objInstanceBase)
|
|
16
|
+
|
|
17
|
+
if (!objInstanceBase) {
|
|
18
|
+
errorsFound.push(`can't get data in dynamo by ${identifiersBase}`)
|
|
19
|
+
standardErrorParams.push(errorsFound)
|
|
20
|
+
await findDataSharedLib.completeFindDataMain(...standardErrorParams);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (!objInstanceBase.hasOwnProperty(fieldName)) {
|
|
25
|
+
errorsFound.push(`data in dynamoDB have no ${fieldName}`)
|
|
26
|
+
standardErrorParams.push(errorsFound)
|
|
27
|
+
await findDataSharedLib.completeFindDataMain(...standardErrorParams);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
<%- createNameTagAfter(objectType, fieldName) %>
|
|
32
|
+
|
|
33
|
+
let dataValue = objInstanceBase[fieldName];
|
|
34
|
+
_izContext.logger.debug("dataValue: ", dataValue)
|
|
35
|
+
|
|
36
|
+
await findDataSharedLib.completeFindDataMain(
|
|
37
|
+
_izContext,
|
|
38
|
+
findDataMain.fieldName,
|
|
39
|
+
findDataMain.objType,
|
|
40
|
+
findDataMain.identifiers,
|
|
41
|
+
findDataMain.requestProperties,
|
|
42
|
+
dataValue,
|
|
43
|
+
"complete"
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
<%_ function createNameTagBefore(objectType, fieldName){
|
|
47
|
+
return `//(<beforeGetItem${objectType}${fieldName}>)
|
|
48
|
+
//(</beforeGetItem${objectType}${fieldName}>)`
|
|
49
|
+
} _%>
|
|
50
|
+
<%_ function createNameTagAfter(objectType, fieldName){
|
|
51
|
+
return `//(<afterGetItem${objectType}${fieldName}>)
|
|
52
|
+
//(</afterGetItem${objectType}${fieldName}>)`
|
|
53
|
+
} _%>
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
<%- createNameTagBefore(objectType, fieldName) %>
|
|
2
|
+
|
|
3
|
+
const graphHandlerServiceTag = await serviceConfig.getGraphServiceTagWithCache(
|
|
4
|
+
_izContext,
|
|
5
|
+
<%- JSON.stringify(graphServerTag) %>
|
|
6
|
+
);
|
|
7
|
+
_izContext.logger.debug("graphHandlerServiceTag: ", graphHandlerServiceTag)
|
|
8
|
+
|
|
9
|
+
let getDataByGraph = await graphSharedLib.getNodeV2(
|
|
10
|
+
_izContext,
|
|
11
|
+
graphHandlerServiceTag,
|
|
12
|
+
objType,
|
|
13
|
+
{
|
|
14
|
+
...identifiers,
|
|
15
|
+
...fieldName
|
|
16
|
+
},
|
|
17
|
+
<%- JSON.stringify(versionedDataLabel) %>
|
|
18
|
+
);
|
|
19
|
+
_izContext.logger.debug("getDataByGraph: ", getDataByGraph)
|
|
20
|
+
|
|
21
|
+
if (!getDataByGraph) {
|
|
22
|
+
errorsFound.push(`can't get data of ${objType.objectType} in graph`)
|
|
23
|
+
standardErrorParams.push(errorsFound)
|
|
24
|
+
await findDataSharedLib.completeFindDataMain(...standardErrorParams);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
<%- createNameTagAfter(objectType, fieldName) %>
|
|
29
|
+
|
|
30
|
+
<% if (versionedDataLabel.length > 0) { _%>
|
|
31
|
+
// The fieldName is a key in the versionedData object.
|
|
32
|
+
let versionedDataLabel = getDataByGraph.versionedDatas<%- JSON.stringify(versionedDataLabel) %>;
|
|
33
|
+
|
|
34
|
+
if (versionedDataLabel == null) {
|
|
35
|
+
errorsFound.push(`can't find versionedData of ${objType.objectType}`)
|
|
36
|
+
standardErrorParams.push(errorsFound)
|
|
37
|
+
await findDataSharedLib.completeFindDataMain(...standardErrorParams);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
let versionedProperties = versionedDataLabel.properties;
|
|
42
|
+
|
|
43
|
+
if (!versionedProperties.hasOwnProperty(fieldName)) {
|
|
44
|
+
errorsFound.push(`versionedData have no ${fieldName}`)
|
|
45
|
+
standardErrorParams.push(errorsFound)
|
|
46
|
+
await findDataSharedLib.completeFindDataMain(...standardErrorParams);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
let dataValue = versionedProperties[fieldName];
|
|
51
|
+
_izContext.logger.debug("dataValue: ", dataValue)
|
|
52
|
+
<% } else { _%>
|
|
53
|
+
let objInstanceFull = getDataByGraph.objInstanceFull;
|
|
54
|
+
_izContext.logger.debug("objInstanceFull: ", objInstanceFull)
|
|
55
|
+
<% if (getInIdentifiers) { _%>
|
|
56
|
+
|
|
57
|
+
// objInstanceFull.identifiers // Object
|
|
58
|
+
if (!objInstanceFull.identifiers.hasOwnProperty(fieldName)) {
|
|
59
|
+
errorsFound.push(`nodeProperties have no this ${fieldName}`)
|
|
60
|
+
standardErrorParams.push(errorsFound)
|
|
61
|
+
await findDataSharedLib.completeFindDataMain(...standardErrorParams);
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
let dataValue = objInstanceFull.identifiers[fieldName];
|
|
66
|
+
_izContext.logger.debug("this fieldName is identifier, get dataValue in identifiers: ", dataValue)
|
|
67
|
+
|
|
68
|
+
<% } else { _%>
|
|
69
|
+
|
|
70
|
+
// objInstanceFull.fields // Object
|
|
71
|
+
if (!objInstanceFull.fields.hasOwnProperty(fieldName)) {
|
|
72
|
+
errorsFound.push(`nodeProperties have no this ${fieldName}`)
|
|
73
|
+
standardErrorParams.push(errorsFound)
|
|
74
|
+
await findDataSharedLib.completeFindDataMain(...standardErrorParams);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
let dataValue = objInstanceFull.fields[fieldName];
|
|
79
|
+
_izContext.logger.debug("this fieldName is not identifier, get dataValue in fields: ", dataValue)
|
|
80
|
+
|
|
81
|
+
<% }_%>
|
|
82
|
+
<% } _%>
|
|
83
|
+
await findDataSharedLib.completeFindDataMain(
|
|
84
|
+
_izContext,
|
|
85
|
+
findDataMain.fieldName,
|
|
86
|
+
findDataMain.objType,
|
|
87
|
+
findDataMain.identifiers,
|
|
88
|
+
findDataMain.requestProperties,
|
|
89
|
+
dataValue,
|
|
90
|
+
"complete"
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
<%_ function createNameTagBefore(objectType, fieldName){
|
|
94
|
+
return `//(<beforeGetNode${objectType}${fieldName}>)
|
|
95
|
+
//(</beforeGetNode${objectType}${fieldName}>)`
|
|
96
|
+
} _%>
|
|
97
|
+
<%_ function createNameTagAfter(objectType, fieldName){
|
|
98
|
+
return `//(<afterGetNode${objectType}${fieldName}>)
|
|
99
|
+
//(</afterGetNode${objectType}${fieldName}>)`
|
|
100
|
+
} _%>
|
|
@@ -0,0 +1,195 @@
|
|
|
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 templatePath = path.join(__dirname, "./template.ejs")
|
|
23
|
+
|
|
24
|
+
const { HANDLER, STORAGE_TYPES, ACTIONS } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
25
|
+
const {
|
|
26
|
+
firstLetterLowerCase: lowerCase,
|
|
27
|
+
firstLetterUpperCase: upperCase,
|
|
28
|
+
} = require("../../../../MainLibs/index.js").utils;
|
|
29
|
+
const {
|
|
30
|
+
createIamRole,
|
|
31
|
+
resourceNames,
|
|
32
|
+
RESOURCE_CLASSES,
|
|
33
|
+
DEFAULT_LAMBDA_ROLE_PER_ACTION,
|
|
34
|
+
SQS_RESOURCE,
|
|
35
|
+
SOURCE_PATH,
|
|
36
|
+
SAVE_FILE_NAME,
|
|
37
|
+
FUNCTION_NAME,
|
|
38
|
+
SOURCE_GENERATE_IAM_ROLE,
|
|
39
|
+
shortNameHandler,
|
|
40
|
+
} = require("../../../../MainLibs/src/Consts");
|
|
41
|
+
|
|
42
|
+
const serviceSchemas = require('@izara_project/izara-core-library-service-schemas');
|
|
43
|
+
const serviceConfig = serviceSchemas.serviceConfig;
|
|
44
|
+
|
|
45
|
+
function defaultIamRolePerAction() {
|
|
46
|
+
|
|
47
|
+
let defaultIamRole = [];
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
defaultIamRole.push(
|
|
51
|
+
createIamRole(
|
|
52
|
+
{
|
|
53
|
+
[RESOURCE_CLASSES.s3]: ["GetObject", "GetObjectVersion"],
|
|
54
|
+
},
|
|
55
|
+
[
|
|
56
|
+
resourceNames(RESOURCE_CLASSES.s3, "object-schema/perServiceSchemas/*"),
|
|
57
|
+
resourceNames(RESOURCE_CLASSES.s3, "object-schema/serviceConfig/ServiceNameConfig.json"),
|
|
58
|
+
resourceNames(RESOURCE_CLASSES.s3, "object-schema/serviceConfig/GraphServerTags.json"),
|
|
59
|
+
]
|
|
60
|
+
)
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
defaultIamRole.push(
|
|
64
|
+
createIamRole(
|
|
65
|
+
{ [RESOURCE_CLASSES.s3]: ["ListBucket"] },
|
|
66
|
+
[
|
|
67
|
+
resourceNames(RESOURCE_CLASSES.s3, "object-schema"),
|
|
68
|
+
]
|
|
69
|
+
)
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
defaultIamRole.push(
|
|
73
|
+
createIamRole(
|
|
74
|
+
{
|
|
75
|
+
[RESOURCE_CLASSES.sns]: ["Publish"]
|
|
76
|
+
},
|
|
77
|
+
[
|
|
78
|
+
resourceNames(RESOURCE_CLASSES.sns, "InFindData"),
|
|
79
|
+
resourceNames(RESOURCE_CLASSES.sns, "OutFindDataComplete")
|
|
80
|
+
]
|
|
81
|
+
)
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
defaultIamRole.push(
|
|
87
|
+
createIamRole(
|
|
88
|
+
{
|
|
89
|
+
[RESOURCE_CLASSES.dynamoDbTable]: [
|
|
90
|
+
DEFAULT_LAMBDA_ROLE_PER_ACTION[ACTIONS.get].dynamoDbPermission,
|
|
91
|
+
DEFAULT_LAMBDA_ROLE_PER_ACTION[ACTIONS.update].dynamoDbPermission,
|
|
92
|
+
DEFAULT_LAMBDA_ROLE_PER_ACTION[ACTIONS.delete].dynamoDbPermission
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
[
|
|
96
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "FindDataMain")
|
|
97
|
+
]
|
|
98
|
+
)
|
|
99
|
+
)
|
|
100
|
+
// console.log("defaultIamRole Api", defaultIamRole)
|
|
101
|
+
return defaultIamRole
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* receive objectSchema
|
|
106
|
+
* create data for FindData Yaml template
|
|
107
|
+
*
|
|
108
|
+
* @param {Object} objectSchemas
|
|
109
|
+
* @return {{ templatePath, templateData, setting } }
|
|
110
|
+
*/
|
|
111
|
+
async function data(_izContext, objectSchemas, srcPath) {
|
|
112
|
+
|
|
113
|
+
let additionalResourcePermission = defaultIamRolePerAction();
|
|
114
|
+
let tableForGetItem = [];
|
|
115
|
+
let graphForGetNode = [];
|
|
116
|
+
let hasGraphStorage = false;
|
|
117
|
+
let functionName = upperCase(FUNCTION_NAME.findData);
|
|
118
|
+
|
|
119
|
+
// =======================================================================================
|
|
120
|
+
for (let objectSchema of objectSchemas.records) {
|
|
121
|
+
// console.log("objectSchema", objectSchemas)
|
|
122
|
+
|
|
123
|
+
for (let storageResource of Object.values(objectSchema.storageResources)) {
|
|
124
|
+
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
125
|
+
// add IamRole for dynamodb depend on tableName in storageResources of objectSchema
|
|
126
|
+
tableForGetItem.push(resourceNames(RESOURCE_CLASSES.dynamoDbTable, storageResource.tableName));
|
|
127
|
+
|
|
128
|
+
} else if (storageResource.storageType === STORAGE_TYPES.graph) {
|
|
129
|
+
// find graph serviceName from graphServerTag or *GetNodeHdrInv ?
|
|
130
|
+
|
|
131
|
+
const graphHandlerServiceTag = await serviceConfig.getGraphServiceTagWithCache(
|
|
132
|
+
_izContext,
|
|
133
|
+
storageResource.graphServerTag
|
|
134
|
+
);
|
|
135
|
+
// _izContext.logger.debug("graphHandlerServiceTag: ", graphHandlerServiceTag)
|
|
136
|
+
|
|
137
|
+
if (hasGraphStorage) {
|
|
138
|
+
continue;
|
|
139
|
+
} else {
|
|
140
|
+
graphForGetNode.push(resourceNames(RESOURCE_CLASSES.lambda, graphHandlerServiceTag + "TestGetNodeV2HdrInv"))
|
|
141
|
+
hasGraphStorage = true;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
// =======================================================================================
|
|
147
|
+
if (tableForGetItem.length) {
|
|
148
|
+
additionalResourcePermission.push(
|
|
149
|
+
createIamRole(
|
|
150
|
+
{ [RESOURCE_CLASSES.dynamoDbTable]: [DEFAULT_LAMBDA_ROLE_PER_ACTION[ACTIONS.get].dynamoDbPermission] },
|
|
151
|
+
tableForGetItem
|
|
152
|
+
)
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
additionalResourcePermission.push(
|
|
157
|
+
createIamRole({
|
|
158
|
+
[RESOURCE_CLASSES.sqs]:
|
|
159
|
+
[
|
|
160
|
+
SQS_RESOURCE.deleteMessage,
|
|
161
|
+
SQS_RESOURCE.getQueueAttributes,
|
|
162
|
+
SQS_RESOURCE.receiveMessage,
|
|
163
|
+
SQS_RESOURCE.sendMessage,
|
|
164
|
+
SQS_RESOURCE.deleteMessageBatch,
|
|
165
|
+
SQS_RESOURCE.getQueueUrl
|
|
166
|
+
]
|
|
167
|
+
}, [
|
|
168
|
+
resourceNames(RESOURCE_CLASSES.sqs, functionName + upperCase(HANDLER.hdrSqs)),
|
|
169
|
+
resourceNames(RESOURCE_CLASSES.sqs, functionName + upperCase(HANDLER.hdrSqs) + "DLQ")
|
|
170
|
+
]
|
|
171
|
+
)
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
// console.log("additionalResourcePermission", additionalResourcePermission)
|
|
175
|
+
|
|
176
|
+
return {
|
|
177
|
+
templatePath: templatePath,
|
|
178
|
+
templateData: {
|
|
179
|
+
functionName: functionName,
|
|
180
|
+
resourceLocation: SOURCE_PATH.resourceLocationFindData,
|
|
181
|
+
handlerType: HANDLER.hdrSqs,
|
|
182
|
+
additionalResourcePermission,
|
|
183
|
+
functionNameConfig: upperCase(functionName) + upperCase(shortNameHandler(HANDLER.hdrSqs)),
|
|
184
|
+
roleName: SOURCE_GENERATE_IAM_ROLE.ProcessFindDataRole
|
|
185
|
+
},
|
|
186
|
+
setting: {
|
|
187
|
+
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
188
|
+
saveFileName: upperCase(SAVE_FILE_NAME.findData),
|
|
189
|
+
fileExtension: '.yml',
|
|
190
|
+
isAppend: false
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
module.exports = data;
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
role: <%- roleName %>Role
|
|
10
|
+
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
11
|
+
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
12
|
+
<%_ function firstLetterUpperCase(text){
|
|
13
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
14
|
+
} _%>
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
// Import required modules
|
|
21
|
+
const { join } = require('path');
|
|
22
|
+
|
|
23
|
+
const {
|
|
24
|
+
getAllLocalObjectSchemasWithHierarchy,
|
|
25
|
+
// getAllLocalRelationshipSchemas,
|
|
26
|
+
getAllLocalRelationshipSchema,
|
|
27
|
+
getAllLocalFlowSchemas
|
|
28
|
+
} = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
|
|
29
|
+
|
|
30
|
+
// findData
|
|
31
|
+
const createFindDataFunctionYaml = require('./findDataYaml/data');
|
|
32
|
+
const createFindDataHandler = require('./handler/data');
|
|
33
|
+
const createFindDataMainFunction = require('./mainFunction/data');
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Generates code with templates for different actions
|
|
37
|
+
* @param {Object} _izContext - Context object
|
|
38
|
+
* @param {string} objSchemaPath - Path to the schema
|
|
39
|
+
* @returns {Array} Array of generated code parameters
|
|
40
|
+
*/
|
|
41
|
+
async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
42
|
+
try {
|
|
43
|
+
const saveFilePath = join(objSchemaPath, '../');
|
|
44
|
+
const createSourceParams = [];
|
|
45
|
+
let allObjSchemas = await getAllLocalObjectSchemasWithHierarchy(_izContext, objSchemaPath);
|
|
46
|
+
|
|
47
|
+
const findDataFunctionYaml = await createFindDataFunctionYaml(_izContext, allObjSchemas, saveFilePath);
|
|
48
|
+
const findDataHandlerSqs = createFindDataHandler(_izContext, saveFilePath);
|
|
49
|
+
const findDataMainFunction = await createFindDataMainFunction(_izContext, saveFilePath);
|
|
50
|
+
|
|
51
|
+
// Combine all resources into a single array and add to createSourceParams
|
|
52
|
+
createSourceParams.push(
|
|
53
|
+
findDataHandlerSqs,
|
|
54
|
+
findDataMainFunction,
|
|
55
|
+
findDataFunctionYaml
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
return createSourceParams;
|
|
59
|
+
} catch (error) {
|
|
60
|
+
_izContext.logger.error('Error generating code with template:', error);
|
|
61
|
+
return [];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
module.exports = generateCodeWithTemplate;
|
|
@@ -0,0 +1,63 @@
|
|
|
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 templatePath = path.join(__dirname, "./template.ejs")
|
|
23
|
+
|
|
24
|
+
// const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../MainLibs/index.js").utils;
|
|
25
|
+
// const { SOURCE_PATH, FUNCTION_NAME, HANDLER } = require("../../../../MainLibs/src/Consts");
|
|
26
|
+
const {
|
|
27
|
+
firstLetterLowerCase: lowerCase,
|
|
28
|
+
firstLetterUpperCase: upperCase,
|
|
29
|
+
} = require("../../../../MainLibs/index.js").utils;
|
|
30
|
+
const {
|
|
31
|
+
createIamRole,
|
|
32
|
+
resourceNames,
|
|
33
|
+
RESOURCE_CLASSES,
|
|
34
|
+
DEFAULT_LAMBDA_ROLE_PER_ACTION,
|
|
35
|
+
SQS_RESOURCE,
|
|
36
|
+
SOURCE_PATH,
|
|
37
|
+
SAVE_FILE_NAME,
|
|
38
|
+
FUNCTION_NAME,
|
|
39
|
+
shortNameHandler,
|
|
40
|
+
HANDLER,
|
|
41
|
+
} = require("../../../../MainLibs/src/Consts");
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* receive srcPath
|
|
45
|
+
* create data for FindData Handler template
|
|
46
|
+
*
|
|
47
|
+
* @param {Object} srcPath
|
|
48
|
+
* @return {{ templatePath, templateData, setting } }
|
|
49
|
+
*/
|
|
50
|
+
function data(_izContext, srcPath) {
|
|
51
|
+
return {
|
|
52
|
+
templatePath: templatePath,
|
|
53
|
+
templateData: {},
|
|
54
|
+
setting: {
|
|
55
|
+
savePath: path.join(srcPath, SOURCE_PATH.findData),
|
|
56
|
+
saveFileName: upperCase(FUNCTION_NAME.findData) + "_" + upperCase(HANDLER.hdrSqs),
|
|
57
|
+
fileExtension: '.js',
|
|
58
|
+
isAppend: false
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
module.exports = data;
|
|
@@ -0,0 +1,140 @@
|
|
|
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 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
|
+
|
|
28
|
+
const findData = require('./FindData_Main');
|
|
29
|
+
|
|
30
|
+
// validate event properties in body.Message of sqs event
|
|
31
|
+
middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
|
|
32
|
+
|
|
33
|
+
// set schema for record.body.Message
|
|
34
|
+
const perRecordsValidatorSchema = {
|
|
35
|
+
type: "object",
|
|
36
|
+
required: [
|
|
37
|
+
'fieldName',
|
|
38
|
+
'objType',
|
|
39
|
+
'identifiers',
|
|
40
|
+
],
|
|
41
|
+
properties: {
|
|
42
|
+
fieldName: {
|
|
43
|
+
type: 'string'
|
|
44
|
+
},
|
|
45
|
+
objType: {
|
|
46
|
+
type: 'object',
|
|
47
|
+
required: ["serviceTag", "objectType"],
|
|
48
|
+
properties: {
|
|
49
|
+
serviceTag: {
|
|
50
|
+
type: "string",
|
|
51
|
+
enum: [process.env.iz_serviceTag]
|
|
52
|
+
},
|
|
53
|
+
objectType: izara.validatorSchema.stringNotEmpty()
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
identifiers: {
|
|
57
|
+
type: 'object'
|
|
58
|
+
},
|
|
59
|
+
requestProperties: {
|
|
60
|
+
type: 'object',
|
|
61
|
+
default: {}
|
|
62
|
+
},
|
|
63
|
+
callingFlow: {
|
|
64
|
+
type: 'string',
|
|
65
|
+
default: ''
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
// set schema for record.body.MessageAttributes
|
|
72
|
+
// const messageAttributeValidatorSchema = {
|
|
73
|
+
// type: "object",
|
|
74
|
+
// required: ['msgAtrrParam1', 'msgAtrrParam2'],
|
|
75
|
+
// properties: {
|
|
76
|
+
// msgAtrrParam1: {
|
|
77
|
+
// type: "string"
|
|
78
|
+
// },
|
|
79
|
+
// msgAtrrParam2: {
|
|
80
|
+
// type: "object"
|
|
81
|
+
// }
|
|
82
|
+
// }
|
|
83
|
+
// };
|
|
84
|
+
|
|
85
|
+
module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
86
|
+
|
|
87
|
+
try {
|
|
88
|
+
|
|
89
|
+
let recordPromises = [];
|
|
90
|
+
|
|
91
|
+
// loop each record and send to mainFunction
|
|
92
|
+
await Promise.all(event.Records.map(async record => { // promise.all for map() function
|
|
93
|
+
|
|
94
|
+
let passOnProperties = [];
|
|
95
|
+
record._izContext.logger.debug('record ReceiveMsgOutHdrSqs', record);
|
|
96
|
+
|
|
97
|
+
// validate message (and MessageAttributes)
|
|
98
|
+
await recordHandlerSharedLib.validateRecord(
|
|
99
|
+
record, // one record will send to mainFunction
|
|
100
|
+
"FindDataHdrSqs", // queue name that need to retry or send to dlq
|
|
101
|
+
perRecordsValidatorSchema, // schema for record.Message
|
|
102
|
+
// messageAttributeValidatorSchema // ----- for msgAttr default is null -> do not send this parameter if not want to validate msgAtt
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
// add argument (to invoke lambda) to passOnProperties[]
|
|
106
|
+
passOnProperties.push(record.body.Message.fieldName)
|
|
107
|
+
passOnProperties.push(record.body.Message.objType)
|
|
108
|
+
passOnProperties.push(record.body.Message.identifiers)
|
|
109
|
+
passOnProperties.push(record.body.Message.requestProperties)
|
|
110
|
+
passOnProperties.push(record.body.Message.callingFlow)
|
|
111
|
+
record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
|
|
112
|
+
|
|
113
|
+
// call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
|
|
114
|
+
let recordPromise = recordHandlerSharedLib.recordHandler(
|
|
115
|
+
record, // one record will send to mainFunction
|
|
116
|
+
findData.findData, // mainFunction that need to invoke.
|
|
117
|
+
"FindDataHdrSqs", // queue name that need to retry or send to dlq
|
|
118
|
+
passOnProperties, // all parameters that mainFunction needed.
|
|
119
|
+
);
|
|
120
|
+
record._izContext.logger.debug('after recordPromise in handler');
|
|
121
|
+
recordPromises.push(recordPromise); // push promise to recordPromises
|
|
122
|
+
}))
|
|
123
|
+
|
|
124
|
+
Logger.debug('before Promise.all(recordPromises) in handler');
|
|
125
|
+
try {
|
|
126
|
+
// --- main await all promises
|
|
127
|
+
await Promise.all(recordPromises); // await all promises
|
|
128
|
+
|
|
129
|
+
return event.Records // return all for local testing
|
|
130
|
+
|
|
131
|
+
} catch {
|
|
132
|
+
Logger.debug('Promise.all(recordPromises) in handler threw error (at least one record did no resolve)');
|
|
133
|
+
}
|
|
134
|
+
Logger.debug('after Promise.all(recordPromises) in handler');
|
|
135
|
+
|
|
136
|
+
} catch (err) {
|
|
137
|
+
Logger.error('Unhandled Error, FindDataHdrSqs: ', err);
|
|
138
|
+
throw (err);
|
|
139
|
+
}
|
|
140
|
+
});
|