@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,629 @@
|
|
|
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
|
+
const izaraShared = require('@izara_project/izara-shared');
|
|
20
|
+
const asyncFlowSharedLib = izaraShared.asyncFlowSharedLib;
|
|
21
|
+
const dynamodbSharedLib = izaraShared.dynamodbSharedLib;
|
|
22
|
+
const lambdaSharedLib = izaraShared.lambdaSharedLib;
|
|
23
|
+
const callingFlowSharedLib = izaraShared.callingFlowSharedLib;
|
|
24
|
+
const snsSharedLib = require('@izara_project/izara-shared/src/SnsSharedLib');
|
|
25
|
+
|
|
26
|
+
const externalRequest = require('@izara_project/izara-core-library-external-request');
|
|
27
|
+
const sns = externalRequest.sns;
|
|
28
|
+
const lambda = externalRequest.lambda
|
|
29
|
+
|
|
30
|
+
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
|
|
31
|
+
const serviceConfigLib = require('@izara_project/izara-core-library-service-schemas/src/ServiceConfig')
|
|
32
|
+
|
|
33
|
+
const uploadUseCase = require('@izara_project/izara-core-library-service-schemas/src/libs/UploadUseCase')
|
|
34
|
+
|
|
35
|
+
const hash = require("object-hash")
|
|
36
|
+
const NoRetryError = require('@izara_project/izara-core-library-core/src/NoRetryError');
|
|
37
|
+
const path = require('path')
|
|
38
|
+
const schemasPath = path.join(__dirname, '../schemas');
|
|
39
|
+
const consts = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
40
|
+
const coreConsts = require("@izara_project/izara-core-library-core/src/Consts");
|
|
41
|
+
|
|
42
|
+
const {
|
|
43
|
+
generateDynamoDbIdentifiers,
|
|
44
|
+
dynamoDbIdentifiersByStorageResource,
|
|
45
|
+
collectGetData
|
|
46
|
+
} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs');
|
|
47
|
+
|
|
48
|
+
const {
|
|
49
|
+
getGraphServiceTagWithCache,
|
|
50
|
+
getServiceNameWithCache
|
|
51
|
+
} = require('@izara_project/izara-core-library-service-schemas/src/ServiceConfig');
|
|
52
|
+
|
|
53
|
+
//-----------------------------------------------------------------------------------------------------------
|
|
54
|
+
const PREFIX = {
|
|
55
|
+
ONE: "one",
|
|
56
|
+
MANY: "many",
|
|
57
|
+
CREATE_OBJECT_ASYNC: "createObjectAsync",
|
|
58
|
+
CREATE_OBJECT_ASYNC_COMPLETE: "createObjectAsyncComplete"
|
|
59
|
+
}
|
|
60
|
+
//-----------------------------------------------------------------------------------------------------------
|
|
61
|
+
const { TOPIC_NAME_GENERATE_CODE, TOPIC_NAME_GRAPH_HANDLER, GRAPH_HANDLER_SERVICE_NAME } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
62
|
+
const { createDataDetailsLib } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs')
|
|
63
|
+
const { createLinkTypeId } = require('@izara_project/izara-core-library-service-schemas/src/Utils');
|
|
64
|
+
const { findLinksByObjTypes } = require("@izara_project/izara-core-library-service-schemas/src/libs/RelSchemaLib")
|
|
65
|
+
const lodash = require("lodash")
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
- all storageType( DB and Graph) use objInstance({identifiers,fields})
|
|
70
|
+
- storageType[DB] async
|
|
71
|
+
- storageType[Graph] sync (should be have lambda complete)
|
|
72
|
+
-- before DB and Graph have boolend check (allStorageTagComplete = true) if storageType == graph set allStorageTagComplete = false,
|
|
73
|
+
and save awaitingMultiplastep prefix(serviceTag_CreateObject{identifierId})
|
|
74
|
+
|
|
75
|
+
>>> in lambdaComplete resive message from GrapHandler
|
|
76
|
+
1.1 check have returnValue.errorsFould.length > 0
|
|
77
|
+
-- Delete all awitingMultiplestep and senf message to callingFlow have errorFound.
|
|
78
|
+
1.2 check awaitingmultipleStepall finish
|
|
79
|
+
-- Delete awaitingStep in come if have other multiplestep(not finish)== not send message.
|
|
80
|
+
--- if check awaitingmultipleStepall finish not have record ===> sendmessage to callingFlow.
|
|
81
|
+
*/
|
|
82
|
+
//=========================================================================================
|
|
83
|
+
/**
|
|
84
|
+
*
|
|
85
|
+
* @param {*} _izContext
|
|
86
|
+
* @param {Object} requestParams = {fieldNames,relationships = []}
|
|
87
|
+
* @param {*} callingFlowConfig
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
module.exports.<%- functionName %>Main = async (
|
|
91
|
+
_izContext,
|
|
92
|
+
requestParams,
|
|
93
|
+
callingFlowConfig
|
|
94
|
+
) => {
|
|
95
|
+
try {
|
|
96
|
+
_izContext.logger.debug("function <%- functionName %>:", {
|
|
97
|
+
requestParams,
|
|
98
|
+
callingFlowConfig
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
let errorsFound = [];
|
|
102
|
+
|
|
103
|
+
const userId = _izContext.correlationIds.get(coreConsts.BASE_USER_ID);
|
|
104
|
+
const targetId = _izContext.correlationIds.get(coreConsts.TARGET_ID)
|
|
105
|
+
if (!userId) {
|
|
106
|
+
errorsFound.push("Not have userId")
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const OBJECT_TYPE = "<%- objectType %>";
|
|
110
|
+
const SERVICE_TAG = process.env.iz_serviceTag;
|
|
111
|
+
//(<beforeQuery>)
|
|
112
|
+
//(</beforeQuery>)
|
|
113
|
+
const MAIN_OBJTYPE = {
|
|
114
|
+
objectType: OBJECT_TYPE,
|
|
115
|
+
serviceTag: SERVICE_TAG
|
|
116
|
+
}
|
|
117
|
+
let objectSchema = await getObjectSchema.getObjSchemaS3WithCache(
|
|
118
|
+
_izContext,
|
|
119
|
+
MAIN_OBJTYPE
|
|
120
|
+
);
|
|
121
|
+
_izContext.logger.debug("objectSchema", objectSchema);
|
|
122
|
+
|
|
123
|
+
let objectSchemas = uploadUseCase.generateObjectSchemaForCombineFieldNames(
|
|
124
|
+
_izContext,
|
|
125
|
+
objectSchema
|
|
126
|
+
);
|
|
127
|
+
_izContext.logger.debug("objectSchemas", objectSchemas);
|
|
128
|
+
|
|
129
|
+
if (objectSchema.hasOwnProperty("belongTo") && !targetId) {
|
|
130
|
+
errorsFound.push('not have targetId')
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
let createDataDetails = await createDataDetailsLib(_izContext, objectSchemas);
|
|
134
|
+
_izContext.logger.debug("createDataDetails is =", createDataDetails);
|
|
135
|
+
|
|
136
|
+
let checkCorrectLinks = [];
|
|
137
|
+
|
|
138
|
+
//validate linkType
|
|
139
|
+
if ((requestParams.hasOwnProperty("relationships")) && (requestParams.relationships.length > 0)) {
|
|
140
|
+
|
|
141
|
+
for (let relationshipProperties of requestParams.relationships) {
|
|
142
|
+
_izContext.logger.debug("relationshipProperties", relationshipProperties);
|
|
143
|
+
_izContext.logger.debug("relType", relationshipProperties.relType);
|
|
144
|
+
let getObjectRelationship = await getObjectSchema.getRelationshipSchemaWithCache(
|
|
145
|
+
_izContext,
|
|
146
|
+
relationshipProperties.relType
|
|
147
|
+
)
|
|
148
|
+
_izContext.logger.debug("getObjectRelationship", getObjectRelationship)
|
|
149
|
+
|
|
150
|
+
for (const relationshipLink of Object.values(getObjectRelationship.links)) {
|
|
151
|
+
if (relationshipLink.from.linkType === "many" && relationshipLink.to.linkType === "many") {
|
|
152
|
+
if (relationshipLink.from.requiredOnCreate === true || relationshipLink.to.requiredOnCreate === true) {
|
|
153
|
+
errorsFound.push("error many to many linkType can't have requireOnCreate === true")
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
const links = await findLinksByObjTypes(_izContext, [MAIN_OBJTYPE, relationshipProperties.targetObjType], getObjectRelationship.links);
|
|
158
|
+
_izContext.logger.debug("links", links)
|
|
159
|
+
|
|
160
|
+
if (!links.length) {
|
|
161
|
+
errorsFound.push(`not found link between ${JSON.stringify({ mainObjType: MAIN_OBJTYPE })} and ${JSON.stringify({ toObjType: relationshipProperties.targetObjType })} `)
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
for (let link of links) {
|
|
165
|
+
const { serviceTag: fromServiceTag, objectType: fromObjectType } = MAIN_OBJTYPE;
|
|
166
|
+
const { serviceTag: toServiceTag, objectType: toObjectType } = relationshipProperties.targetObjType
|
|
167
|
+
|
|
168
|
+
const { serviceTag: firstServiceTag, objectType: firstObjectType } = link.from.objType;
|
|
169
|
+
const { serviceTag: secondServiceTag, objectType: secondObjectType } = link.to.objType
|
|
170
|
+
|
|
171
|
+
const matchesFromTo =
|
|
172
|
+
fromServiceTag === firstServiceTag && fromObjectType === firstObjectType &&
|
|
173
|
+
toServiceTag === secondServiceTag && toObjectType === secondObjectType;
|
|
174
|
+
|
|
175
|
+
const matchesToFrom =
|
|
176
|
+
fromServiceTag === secondServiceTag && fromObjectType === secondObjectType &&
|
|
177
|
+
toServiceTag === firstServiceTag && toObjectType === firstObjectType
|
|
178
|
+
|
|
179
|
+
if ((relationshipProperties.relationshipDirection === "from" && matchesFromTo) ||
|
|
180
|
+
(relationshipProperties.relationshipDirection === "to" && matchesToFrom)) {
|
|
181
|
+
checkCorrectLinks.push(true)
|
|
182
|
+
} else {
|
|
183
|
+
checkCorrectLinks.push(false)
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
for (const [index, checkCorrectLink] of checkCorrectLinks.entries()) {
|
|
189
|
+
if (checkCorrectLink === false) {
|
|
190
|
+
errorsFound.push(`relationship direction ${JSON.stringify(requestParams.relationships[index])} is invalid`)
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
_izContext.logger.debug("finish validate Relationships from RequestParams")
|
|
194
|
+
let requiredOnCreateLinks = {};
|
|
195
|
+
let createLinkTypeIds = [];
|
|
196
|
+
// validate relationships link
|
|
197
|
+
let objectRelationshipSchema = await getObjectSchema.getRequiredOnCreateLinksWithCache(_izContext, MAIN_OBJTYPE);
|
|
198
|
+
_izContext.logger.debug("objectRelationshipSchema", objectRelationshipSchema);
|
|
199
|
+
|
|
200
|
+
// validate requiredOnCreateLinks
|
|
201
|
+
let filteredRequiredOnCreatedLinks = [];
|
|
202
|
+
|
|
203
|
+
await Promise.all(
|
|
204
|
+
objectRelationshipSchema.map(async (requiredLink) => {
|
|
205
|
+
const serviceTag = await Promise.all(
|
|
206
|
+
requiredLink.storageResourceTags.map(async (storageTag) => {
|
|
207
|
+
let storageResource = requiredLink.storageResources[storageTag];
|
|
208
|
+
if (storageResource.storageType === consts.STORAGE_TYPES.graph) {
|
|
209
|
+
return await getGraphServiceTagWithCache(_izContext, storageResource.graphServerTag);
|
|
210
|
+
}
|
|
211
|
+
})
|
|
212
|
+
);
|
|
213
|
+
if (serviceTag.includes(GRAPH_HANDLER_SERVICE_NAME.graphHandler)) {
|
|
214
|
+
filteredRequiredOnCreatedLinks.push(requiredLink);
|
|
215
|
+
}
|
|
216
|
+
})
|
|
217
|
+
)
|
|
218
|
+
_izContext.logger.debug("filteredRequiredOnCreatedLinks", filteredRequiredOnCreatedLinks);
|
|
219
|
+
|
|
220
|
+
if (filteredRequiredOnCreatedLinks.length) {
|
|
221
|
+
if (!requestParams.relationships || !requestParams.relationships.length) {
|
|
222
|
+
// in case not send relationship to create with
|
|
223
|
+
for (const requireLink of filteredRequiredOnCreatedLinks) {
|
|
224
|
+
errorsFound.push(`missing required relationship of relType ${JSON.stringify(requireLink.relType)} when create`)
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
for (const requireLink of filteredRequiredOnCreatedLinks) {
|
|
229
|
+
const requiredOnCreateLinkTypeId = createLinkTypeId(
|
|
230
|
+
_izContext,
|
|
231
|
+
MAIN_OBJTYPE,
|
|
232
|
+
requireLink.other.objType,
|
|
233
|
+
requireLink.relType,
|
|
234
|
+
requireLink.base.direction
|
|
235
|
+
);
|
|
236
|
+
|
|
237
|
+
Object.assign(requiredOnCreateLinks, {
|
|
238
|
+
[requiredOnCreateLinkTypeId]: requireLink
|
|
239
|
+
})
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
if (requestParams.hasOwnProperty("relationships") && requestParams.relationships.length) {
|
|
243
|
+
for (const createRelationship of requestParams.relationships) {
|
|
244
|
+
const onCreateLinkTypeId = createLinkTypeId(
|
|
245
|
+
_izContext,
|
|
246
|
+
MAIN_OBJTYPE,
|
|
247
|
+
createRelationship.targetObjType,
|
|
248
|
+
createRelationship.relType,
|
|
249
|
+
createRelationship.relationshipDirection
|
|
250
|
+
);
|
|
251
|
+
|
|
252
|
+
if (!requiredOnCreateLinks.hasOwnProperty(onCreateLinkTypeId)) {
|
|
253
|
+
errorsFound.push(`relType:${JSON.stringify(createRelationship.relType)} not allow to create when use create action`)
|
|
254
|
+
continue;
|
|
255
|
+
} else {
|
|
256
|
+
createLinkTypeIds.push(onCreateLinkTypeId);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
// validate missing relType when create that should create
|
|
264
|
+
const remainRequiredOnCreateLinkTypeIds = Object.keys(requiredOnCreateLinks)
|
|
265
|
+
.filter(requiredInCreateLinkTypeId => !createLinkTypeIds.includes(requiredInCreateLinkTypeId))
|
|
266
|
+
|
|
267
|
+
if (remainRequiredOnCreateLinkTypeIds.length) {
|
|
268
|
+
for (const remainRequiredOnCreateLinkTypeId of remainRequiredOnCreateLinkTypeIds) {
|
|
269
|
+
const missingLink = {
|
|
270
|
+
relType: requiredOnCreateLinks[remainRequiredOnCreateLinkTypeId].relType,
|
|
271
|
+
base: requiredOnCreateLinks[remainRequiredOnCreateLinkTypeId].base.objType,
|
|
272
|
+
other: requiredOnCreateLinks[remainRequiredOnCreateLinkTypeId].other.objType
|
|
273
|
+
};
|
|
274
|
+
errorsFound.push(`Missing Link:: ${JSON.stringify(missingLink)} when create`)
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
_izContext.logger.debug("createLinkTypeIds", createLinkTypeIds);
|
|
278
|
+
_izContext.logger.debug("requiredOnCreateLinks", requiredOnCreateLinks);
|
|
279
|
+
// end validate
|
|
280
|
+
|
|
281
|
+
let objInstanceFull = {
|
|
282
|
+
identifiers: {},
|
|
283
|
+
fields: {}
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
let listOfRequiredOnCreate = [];
|
|
287
|
+
let listOfOptionalOnCreate = [];
|
|
288
|
+
|
|
289
|
+
let allAwaitingStepsId = [];
|
|
290
|
+
|
|
291
|
+
// validate single identifiers
|
|
292
|
+
if (objectSchemas.identifiers.length === 1 && !objectSchemas.identifiers[0].hasOwnProperty("fieldNames")) {
|
|
293
|
+
|
|
294
|
+
const identifier = objectSchemas.identifiers[0];
|
|
295
|
+
_izContext.logger.debug(":::::case single identifer:::::", identifier);
|
|
296
|
+
|
|
297
|
+
if (objectSchemas.fieldNames[identifier.fieldName].hasOwnProperty("randomOnCreate")) {
|
|
298
|
+
if ((objectSchemas.fieldNames[identifier.fieldName].randomOnCreate == true)) {
|
|
299
|
+
Object.assign(requestParams.fieldNames, {
|
|
300
|
+
[identifier.fieldName]: hash({
|
|
301
|
+
fieldNames: identifier, //
|
|
302
|
+
uniqueRequestId: _izContext.uniqueRequestId,
|
|
303
|
+
callingFlowConfig: callingFlowConfig
|
|
304
|
+
})
|
|
305
|
+
});
|
|
306
|
+
_izContext.logger.debug("Assign requestParams", requestParams)
|
|
307
|
+
|
|
308
|
+
} else if ((objectSchemas.fieldNames[identifier.fieldName].randomOnCreate == false) ||
|
|
309
|
+
(objectSchemas.fieldNames[identifier.fieldName].randomOnCreate == null)) {
|
|
310
|
+
|
|
311
|
+
if ((objectSchemas.fieldNames[identifier.fieldName].requiredOnCreate == true) &&
|
|
312
|
+
(objectSchemas.fieldNames[identifier.fieldName].canUpdate == false)) {
|
|
313
|
+
// check Fns have resive
|
|
314
|
+
|
|
315
|
+
if (requestParams.fieldNames.hasOwnProperty([identifier.fieldName])) {
|
|
316
|
+
_izContext.logger.debug("identifier is exist:", {
|
|
317
|
+
[identifier.fieldName]: requestParams.fieldNames[identifier.fieldName]
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
} else {
|
|
321
|
+
errorsFound.push("[invalid]requestParams not have data fieldNames of requriedOnCreate");
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
} else if (objectSchemas.fieldNames[identifier.fieldName].hasOwnProperty("hashOnCreate")) {
|
|
326
|
+
if (objectSchemas.fieldNames[identifier.fieldName].hashOnCreate.length &&
|
|
327
|
+
objectSchemas.fieldNames[identifier.fieldName].hashOnCreate.length > 0) {
|
|
328
|
+
for (const fieldName of objectSchemas.fieldNames[identifier.fieldName].hashOnCreate) {
|
|
329
|
+
Object.assign(
|
|
330
|
+
requestParams.fieldNames, {
|
|
331
|
+
[identifier.fieldName]: hash({
|
|
332
|
+
[fieldName]: requestParams.fieldNames[fieldName]
|
|
333
|
+
})
|
|
334
|
+
}
|
|
335
|
+
)
|
|
336
|
+
}
|
|
337
|
+
} else {
|
|
338
|
+
errorsFound.push("[invalid] no data to hash for create")
|
|
339
|
+
}
|
|
340
|
+
} else {
|
|
341
|
+
if ((objectSchemas.fieldNames[identifier.fieldName].requiredOnCreate === false) &&
|
|
342
|
+
(objectSchemas.fieldNames[identifier.fieldName].optionalOnCreate === false) &&
|
|
343
|
+
(objectSchemas.fieldNames[identifier.fieldName].canUpdate === false) &&
|
|
344
|
+
objectSchemas.fieldNames[identifier.fieldName].hashOnCreate === false) {
|
|
345
|
+
errorsFound.push("[invalid]case single identifier invalid objectSchemass");
|
|
346
|
+
};
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
_izContext.logger.debug("requestParams is:", requestParams);
|
|
351
|
+
|
|
352
|
+
// check settingObjSchemas
|
|
353
|
+
for (let [keyFieldNames, valueFieldNames] of Object.entries(objectSchemas.fieldNames)) {
|
|
354
|
+
|
|
355
|
+
if (valueFieldNames.hasOwnProperty("randomOnCreate") && valueFieldNames.randomOnCreate === true) {
|
|
356
|
+
listOfRequiredOnCreate.push(keyFieldNames)
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
if (valueFieldNames.hasOwnProperty("requiredOnCreate") && valueFieldNames.requiredOnCreate === true) {
|
|
360
|
+
listOfRequiredOnCreate.push(keyFieldNames)
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
if (valueFieldNames.hasOwnProperty("hashOnCreate") && valueFieldNames.hashOnCreate.length) {
|
|
364
|
+
listOfRequiredOnCreate.push(keyFieldNames)
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
if (valueFieldNames.hasOwnProperty("optionalOnCreate") && valueFieldNames.optionalOnCreate === true) {
|
|
368
|
+
if ((valueFieldNames.requiredOnCreate === false) && valueFieldNames.optionalOnCreate === true) {
|
|
369
|
+
listOfOptionalOnCreate.push(keyFieldNames)
|
|
370
|
+
};
|
|
371
|
+
};
|
|
372
|
+
|
|
373
|
+
}; // end iteration of fieldNames
|
|
374
|
+
|
|
375
|
+
_izContext.logger.debug("listOfRequriedOnCreate", listOfRequiredOnCreate);
|
|
376
|
+
_izContext.logger.debug("listOfOptionalOnCreate", listOfOptionalOnCreate);
|
|
377
|
+
for (let fieldName of Object.keys(requestParams.fieldNames)) {
|
|
378
|
+
|
|
379
|
+
if (!listOfRequiredOnCreate.includes(fieldName)) {
|
|
380
|
+
if (!listOfOptionalOnCreate.includes(fieldName)) {
|
|
381
|
+
errorsFound.push("[invalid] over fieldNames create object");
|
|
382
|
+
}
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
if (listOfOptionalOnCreate.length > 0 && listOfRequiredOnCreate.includes(fieldName)) {
|
|
386
|
+
//(<optionalParams>)
|
|
387
|
+
//(</optionalParams>)
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
if (objectSchemas.identifierFieldNames.includes(fieldName)) {
|
|
391
|
+
_izContext.logger.debug("identifiers is", fieldName);
|
|
392
|
+
Object.assign(objInstanceFull.identifiers, {
|
|
393
|
+
[fieldName]: requestParams.fieldNames[fieldName]
|
|
394
|
+
});
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
if (errorsFound.length > 0) {
|
|
398
|
+
_izContext.logger.debug("HaveError::", errorsFound);
|
|
399
|
+
break
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
}; // end loop
|
|
403
|
+
|
|
404
|
+
let listOfObjectForCreates = [];
|
|
405
|
+
|
|
406
|
+
let objInstanceFullForDynamoDb = lodash.cloneDeep(objInstanceFull)
|
|
407
|
+
let objInstanceFullForGraph = lodash.cloneDeep(objInstanceFull)
|
|
408
|
+
|
|
409
|
+
if (errorsFound.length == 0) {
|
|
410
|
+
|
|
411
|
+
for (let [storageTag, createDataDetail] of Object.entries(createDataDetails)) {
|
|
412
|
+
|
|
413
|
+
if (createDataDetail.storageType == consts.STORAGE_TYPES.dynamoDB) {
|
|
414
|
+
_izContext.logger.debug("::::::DynamoDB::::::", { storageTag, objInstanceFull });
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
Object.assign(objInstanceFullForDynamoDb.fields, createObjInstanceFullFieldsByStorageTag(_izContext, storageTag, createDataDetail))
|
|
418
|
+
_izContext.logger.debug("objInstanceFull before create item in dynamoDB", objInstanceFullForDynamoDb)
|
|
419
|
+
|
|
420
|
+
let identifiersForCreateData = await dynamoDbIdentifiersByStorageResource(
|
|
421
|
+
_izContext,
|
|
422
|
+
objectSchema,
|
|
423
|
+
createDataDetails,
|
|
424
|
+
objInstanceFullForDynamoDb.identifiers
|
|
425
|
+
)
|
|
426
|
+
_izContext.logger.debug("identifiersForCreateData", identifiersForCreateData);
|
|
427
|
+
|
|
428
|
+
await dynamodbSharedLib.putItem(
|
|
429
|
+
_izContext,
|
|
430
|
+
await dynamodbSharedLib.tableName(
|
|
431
|
+
_izContext,
|
|
432
|
+
createDataDetail.tableName
|
|
433
|
+
),
|
|
434
|
+
{
|
|
435
|
+
...identifiersForCreateData,
|
|
436
|
+
...objInstanceFullForDynamoDb.fields
|
|
437
|
+
}
|
|
438
|
+
);
|
|
439
|
+
} else if (createDataDetail.storageType == consts.STORAGE_TYPES.graph) {
|
|
440
|
+
_izContext.logger.debug("::::::Graph::::::", { storageTag, objInstanceFull });
|
|
441
|
+
|
|
442
|
+
Object.assign(objInstanceFullForGraph.fields, createObjInstanceFullFieldsByStorageTag(_izContext, storageTag, createDataDetail))
|
|
443
|
+
_izContext.logger.debug("objInstanceFull before send to Graph", objInstanceFullForGraph)
|
|
444
|
+
|
|
445
|
+
// allStorageTagComplete = false;
|
|
446
|
+
allAwaitingStepsId.push(await asyncFlowSharedLib.createAwaitingStepId(
|
|
447
|
+
(hash({
|
|
448
|
+
objType: MAIN_OBJTYPE,
|
|
449
|
+
graphServerTag: storageTag,
|
|
450
|
+
identifiers: objInstanceFullForGraph.identifiers
|
|
451
|
+
})),
|
|
452
|
+
PREFIX.CREATE_OBJECT_ASYNC
|
|
453
|
+
));
|
|
454
|
+
listOfObjectForCreates.push({
|
|
455
|
+
[storageTag]: {
|
|
456
|
+
objInstanceFull: {
|
|
457
|
+
identifiers: objInstanceFullForGraph.identifiers,
|
|
458
|
+
fields: objInstanceFullForGraph.fields
|
|
459
|
+
},
|
|
460
|
+
allStorageTagComplete: false
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
_izContext.logger.debug("FIRST", listOfObjectForCreates)
|
|
465
|
+
|
|
466
|
+
};
|
|
467
|
+
_izContext.logger.debug("[1]listOfObjectForCreates:::", listOfObjectForCreates);
|
|
468
|
+
};
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
function createObjInstanceFullFieldsByStorageTag(_izContext, storageTag, createDataDetail) {
|
|
472
|
+
_izContext.logger.debug("createObjInstanceFullFieldsByStorageTag : ", { storageTag, createDataDetail })
|
|
473
|
+
let fields = {};
|
|
474
|
+
for (let fieldName of Object.keys(requestParams.fieldNames)) {
|
|
475
|
+
if ((createDataDetails[storageTag].fieldNames.includes(fieldName)) &&
|
|
476
|
+
(createDataDetail.fieldNames.includes(fieldName))) {
|
|
477
|
+
if (!objInstanceFull.identifiers.hasOwnProperty(fieldName)) {
|
|
478
|
+
if (!fields.hasOwnProperty(fieldName)) {
|
|
479
|
+
Object.assign(fields, {
|
|
480
|
+
[fieldName]: requestParams.fieldNames[fieldName]
|
|
481
|
+
})
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
_izContext.logger.debug({ fields })
|
|
487
|
+
return fields
|
|
488
|
+
}
|
|
489
|
+
/// step save awiatingMultipleStep of storageType graph ...........................................................
|
|
490
|
+
|
|
491
|
+
await asyncFlowSharedLib.createAwaitingMultipleSteps(
|
|
492
|
+
_izContext,
|
|
493
|
+
allAwaitingStepsId,
|
|
494
|
+
asyncFlowSharedLib.createPendingStepId((hash({ objType: MAIN_OBJTYPE, identifiers: objInstanceFull.identifiers })), PREFIX.CREATE_OBJECT_ASYNC_COMPLETE)
|
|
495
|
+
);
|
|
496
|
+
//............................................................................................................
|
|
497
|
+
|
|
498
|
+
// process storageType : graph
|
|
499
|
+
let messageObject = {};
|
|
500
|
+
for (let objectCreate of listOfObjectForCreates) {
|
|
501
|
+
|
|
502
|
+
for (let [graphServiceName, objecForCreate] of Object.entries(objectCreate)) {
|
|
503
|
+
_izContext.logger.debug("Loop each graph:", {
|
|
504
|
+
[graphServiceName]: objecForCreate
|
|
505
|
+
});
|
|
506
|
+
|
|
507
|
+
if (objecForCreate.allStorageTagComplete == false) { // needless check because in listOfObjectForCreates push case graph only!
|
|
508
|
+
|
|
509
|
+
messageObject = {
|
|
510
|
+
objType: MAIN_OBJTYPE,
|
|
511
|
+
objInstanceFull: objecForCreate.objInstanceFull,
|
|
512
|
+
relationships: requestParams.relationships || []
|
|
513
|
+
};
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
if (errorsFound.length > 0) {
|
|
517
|
+
break;
|
|
518
|
+
} else {
|
|
519
|
+
_izContext.logger.debug("SENT MESSAGE EACH GRAPH::::", { graphServiceName, messageObject, callingFlowConfig })
|
|
520
|
+
|
|
521
|
+
Object.assign(messageObject, {
|
|
522
|
+
settings: { updatePropertiesOnMatch: false },
|
|
523
|
+
originTimestamp: Date.now()
|
|
524
|
+
});
|
|
525
|
+
|
|
526
|
+
messageObject = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
|
|
527
|
+
messageObject,
|
|
528
|
+
callingFlowSharedLib.addParentCallingFlowConfig(
|
|
529
|
+
callingFlowConfig, // resive parent callingFlowConfig.
|
|
530
|
+
callingFlowSharedLib.createCallingFlowConfig( // callinfflow own service
|
|
531
|
+
await lambdaSharedLib.lambdaFunctionName(_izContext, TOPIC_NAME_GENERATE_CODE.createNodeComplete), {}
|
|
532
|
+
)
|
|
533
|
+
)
|
|
534
|
+
);
|
|
535
|
+
|
|
536
|
+
let messageToCreateObject = {
|
|
537
|
+
Message: JSON.stringify(messageObject),
|
|
538
|
+
TopicArn: await snsSharedLib.snsTopicArn(_izContext, TOPIC_NAME_GRAPH_HANDLER.inCreateNode, graphServiceName)
|
|
539
|
+
};
|
|
540
|
+
_izContext.logger.debug("RequestParams before send to sqs messageToCreateObject ::::::: ", messageToCreateObject);
|
|
541
|
+
await sns.publishAsync(_izContext, messageToCreateObject);
|
|
542
|
+
};
|
|
543
|
+
}; // end loop of objectCreate.
|
|
544
|
+
if (errorsFound.length > 0) {
|
|
545
|
+
break;
|
|
546
|
+
}
|
|
547
|
+
}; // end loop listOfObjectForCreates
|
|
548
|
+
|
|
549
|
+
if (errorsFound.length > 0) {
|
|
550
|
+
_izContext.logger.debug("Case have errorFound:::", errorsFound);
|
|
551
|
+
|
|
552
|
+
// remove awaitngMultiplestep. [[[[[[[open when not test lolcal.]]]]]]]
|
|
553
|
+
await asyncFlowSharedLib.clearAllAwaitingSteps(
|
|
554
|
+
_izContext,
|
|
555
|
+
asyncFlowSharedLib.createPendingStepId((hash({
|
|
556
|
+
objType: MAIN_OBJTYPE,
|
|
557
|
+
identifiers: objInstanceFull.identifiers
|
|
558
|
+
})), PREFIX.CREATE_OBJECT_ASYNC_COMPLETE)); // pendingStepId
|
|
559
|
+
|
|
560
|
+
// send message to OutCreateObjectComplete.
|
|
561
|
+
//..
|
|
562
|
+
messageObject = {
|
|
563
|
+
objType: MAIN_OBJTYPE,
|
|
564
|
+
identifiers: null, // or {}
|
|
565
|
+
errorsFound: errorsFound
|
|
566
|
+
};
|
|
567
|
+
|
|
568
|
+
// pass back property.
|
|
569
|
+
messageObject = callingFlowSharedLib.addPassBackPropertiesToSnsResponseMessageObject(callingFlowConfig, messageObject);
|
|
570
|
+
let messageAttributes = callingFlowSharedLib.addCallingFlowToSnsResponseMessageAttributes(callingFlowConfig, {});
|
|
571
|
+
|
|
572
|
+
let sendMessageOutCreateObjectComplete = {
|
|
573
|
+
Message: JSON.stringify(messageObject),
|
|
574
|
+
MessageAttributes: sns.createStringMessageAttributes(_izContext, messageAttributes),
|
|
575
|
+
TopicArn: await snsSharedLib.snsTopicArn(_izContext, TOPIC_NAME_GENERATE_CODE.outCreateNodeComplete)
|
|
576
|
+
};
|
|
577
|
+
_izContext.logger.debug("Send message to OutCreateObjectComplete :::>", sendMessageOutCreateObjectComplete)
|
|
578
|
+
await sns.publishAsync(_izContext, sendMessageOutCreateObjectComplete);
|
|
579
|
+
|
|
580
|
+
return {
|
|
581
|
+
objType: MAIN_OBJTYPE,
|
|
582
|
+
fieldNames: requestParams.fieldNames,
|
|
583
|
+
relationship: requestParams.relationships,
|
|
584
|
+
status: "error",
|
|
585
|
+
errorsFound: errorsFound
|
|
586
|
+
}
|
|
587
|
+
} else {
|
|
588
|
+
|
|
589
|
+
if (allAwaitingStepsId.length == 0 && listOfObjectForCreates.length == 0) {
|
|
590
|
+
let messageObject = {
|
|
591
|
+
objType: {
|
|
592
|
+
objectType: OBJECT_TYPE,
|
|
593
|
+
serviceTag: SERVICE_TAG
|
|
594
|
+
},
|
|
595
|
+
objInstanceFull: {
|
|
596
|
+
identifiers: objInstanceFullForDynamoDb.identifiers,
|
|
597
|
+
fields: objInstanceFullForDynamoDb.fields
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
if (callingFlowConfig[callingFlowSharedLib.consts.CALLINGFLOW_PROPERTYNAME]) {
|
|
602
|
+
// send message to SNS OutCreateNodeComplete
|
|
603
|
+
_izContext.logger.debug("HAVE CallingFlow");
|
|
604
|
+
messageObject = callingFlowSharedLib.addPassBackPropertiesToSnsResponseMessageObject(callingFlowConfig, messageObject);
|
|
605
|
+
|
|
606
|
+
let messageAttributes = callingFlowSharedLib.addCallingFlowToSnsResponseMessageAttributes(callingFlowConfig, {});
|
|
607
|
+
let outCreateNodeCompleteTopic = await snsSharedLib.snsTopicArn(_izContext, TOPIC_NAME_GENERATE_CODE.outCreateNodeComplete)
|
|
608
|
+
let messageParams = {
|
|
609
|
+
Message: JSON.stringify(messageObject),
|
|
610
|
+
MessageAttributes: sns.createStringMessageAttributes(_izContext, messageAttributes),
|
|
611
|
+
TopicArn: outCreateNodeCompleteTopic,
|
|
612
|
+
};
|
|
613
|
+
|
|
614
|
+
_izContext.logger.debug("messageParams OutCreateNode ::::::: ", messageParams);
|
|
615
|
+
await sns.publishAsync(_izContext, messageParams);
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
return {
|
|
619
|
+
objType: MAIN_OBJTYPE,
|
|
620
|
+
fieldNames: requestParams.fieldNames,
|
|
621
|
+
relationship: requestParams.relationships,
|
|
622
|
+
status: "complete",
|
|
623
|
+
errorsFound: errorsFound
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
} catch (err) {
|
|
627
|
+
throw (err)
|
|
628
|
+
}
|
|
629
|
+
}
|