@izara_project/izara-market-library-service-schemas 1.0.18 → 1.0.20
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/package.json +2 -2
- package/src/GenerateCodeLibs/src/Consts.js +32 -2
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +3 -61
- package/src/SourceManager/src/Utils.js +40 -1
- package/src/TemplateManager/src/FindData/FindDataYaml/data.js +4 -1
- package/src/TemplateManager/src/FindData/FindDataYaml/template.ejs +1 -14
- package/src/TemplateManager/src/GenerateCode.js +152 -46
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/functionYaml/data.js +23 -3
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/functionYaml/template.ejs +1 -14
- package/src/TemplateManager/src/OutPerActionComplete/OutDeleteComplete/functionYaml/data.js +22 -3
- package/src/TemplateManager/src/OutPerActionComplete/OutDeleteComplete/functionYaml/template.ejs +1 -14
- package/src/TemplateManager/src/OutPerActionComplete/OutGetComplete/functionYaml/data.js +23 -3
- package/src/TemplateManager/src/OutPerActionComplete/OutGetComplete/functionYaml/template.ejs +1 -14
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/functionYaml/data.js +23 -3
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/functionYaml/template.ejs +1 -14
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrApi/data.js +6 -6
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrApi/template.ejs +1 -14
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrDsq/data.js +2 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrDsq/template.ejs +1 -14
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrInv/data.js +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrInv/template.ejs +1 -14
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrSqs/data.js +3 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrSqs/template.ejs +1 -14
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrWbs/data.js +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Create/template.ejs +65 -26
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Delete/template.ejs +0 -1
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Get/template.ejs +13 -11
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Update/template.ejs +34 -18
- package/src/TemplateManager/src/{flowTag/webSocket/websocketHandler/mainFunction → PerActionEndpoint/libs}/data.js +12 -23
- package/src/TemplateManager/src/PerActionEndpoint/libs/template.ejs +46 -0
- package/src/TemplateManager/src/ProcessLogical/ProcessLogicalYaml/data.js +18 -2
- package/src/TemplateManager/src/ProcessLogical/ProcessLogicalYaml/template.ejs +1 -14
- package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrDsq/data.js +20 -3
- package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrDsq/template.ejs +1 -14
- package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrSqs/data.js +21 -3
- package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrSqs/template.ejs +1 -14
- package/src/TemplateManager/src/ProcessLogicalPagination/mainFunction/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrApi/data.js +16 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrApi/template.ejs +1 -14
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrDsq/data.js +17 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrDsq/template.ejs +1 -14
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrInv/data.js +16 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrInv/template.ejs +1 -14
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrSqs/data.js +18 -3
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrSqs/template.ejs +1 -14
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationshipComplete/functionYaml/data.js +18 -3
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationshipComplete/functionYaml/template.ejs +1 -14
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrApi/data.js +15 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrApi/template.ejs +1 -14
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrDsq/data.js +17 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrDsq/template.ejs +1 -14
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrInv/data.js +16 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrInv/template.ejs +1 -14
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrSqs/data.js +18 -3
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrSqs/template.ejs +1 -14
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/functionYaml/data.js +18 -3
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/functionYaml/template.ejs +1 -14
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRalationshipComplete/functionYaml/data.js +19 -4
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRalationshipComplete/functionYaml/template.ejs +1 -14
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrApi/data.js +19 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrApi/template.ejs +1 -14
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrDsq/data.js +19 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrDsq/template.ejs +1 -14
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrInv/data.js +20 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrInv/template.ejs +1 -14
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrSqs/data.js +20 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrSqs/template.ejs +1 -14
- package/src/TemplateManager/src/Role/createSharedResource.js +270 -0
- package/src/TemplateManager/src/Role/sharedResourceTemplate.ejs +58 -0
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrDsq/data.js +1 -1
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrSqs/data.js +1 -1
- package/src/TemplateManager/src/externalService/LambdaRole/data.js +119 -9
- package/src/TemplateManager/src/externalService/LambdaRole/template.ejs +3 -4
- package/src/TemplateManager/src/externalService/SnsTopicSubscriotions/data.js +31 -6
- package/src/TemplateManager/src/flowSchema/DefaultWebSocketResource/dynamoDb/ReservedTableData.js +65 -0
- package/src/TemplateManager/src/{flowTag/webSocket → flowSchema/DefaultWebSocketResource}/webSocketConnect/functionYaml/data.js +3 -2
- package/src/TemplateManager/src/{flowTag/webSocket → flowSchema/DefaultWebSocketResource}/webSocketConnect/handler/data.js +1 -1
- package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/InProcessFlowSchema/functionYaml/data.js +77 -0
- package/src/TemplateManager/src/{flowTag/webSocket/websocketHandler → flowSchema/FlowSchemaEndpoint/InProcessFlowSchema}/functionYaml/template.ejs +9 -3
- package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/InProcessFlowSchema/handler/data.js +47 -0
- package/src/TemplateManager/src/{flowTag/webSocket/websocketHandler → flowSchema/FlowSchemaEndpoint/InProcessFlowSchema}/handler/template.ejs +25 -52
- package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/InProcessFlowSchema/mainFunction/data.js +46 -0
- package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/InProcessFlowSchema/mainFunction/template.ejs +0 -0
- package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/InProcessFlowSchema/sns-sqs/data.js +36 -0
- package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/InProcessFlowSchema/sns-sqs/template.ejs +0 -0
- package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/OutComplete/functionYaml/data.js +35 -0
- package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/OutComplete/functionYaml/template.ejs +0 -0
- package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/OutComplete/handler/data.js +35 -0
- package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/OutComplete/handler/template.ejs +0 -0
- package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/OutComplete/mainFunction/data.js +35 -0
- package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/OutComplete/mainFunction/template.ejs +0 -0
- package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/OutComplete/sns-sqs/data.js +35 -0
- package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/OutComplete/sns-sqs/template.ejs +0 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/confirmReservedAfterUpload/functionYaml/data.js +102 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/confirmReservedAfterUpload/functionYaml/template.ejs +30 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/confirmReservedAfterUpload/handler/data.js +58 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/confirmReservedAfterUpload/handler/template.ejs +126 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/confirmReservedAfterUpload/mainFunction/data.js +51 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/confirmReservedAfterUpload/mainFunction/template.ejs +121 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/confirmReservedAfterUpload/queue/data.js +64 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/confirmReservedAfterUpload/queue/template.ejs +45 -0
- package/src/TemplateManager/src/{flowTag/webSocket/websocketHandler → flowSchema/UploadS3Case/createObject}/functionYaml/data.js +42 -13
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createObject/functionYaml/template.ejs +37 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createObject/handler/data.js +75 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createObject/handler/template.ejs +120 -0
- package/src/TemplateManager/src/{flowTag/webSocket/websocketHandler/handler → flowSchema/UploadS3Case/createObject/mainFunction}/data.js +11 -15
- package/src/TemplateManager/src/{flowTag/webSocket/websocketHandler → flowSchema/UploadS3Case/createObject}/mainFunction/template.ejs +4 -4
- package/src/TemplateManager/src/{flowTag/webSocket/webSocketComplete → flowSchema/UploadS3Case/createObjectComplete}/functionYaml/data.js +6 -4
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createObjectComplete/functionYaml/template.ejs +30 -0
- package/src/TemplateManager/src/{flowTag/webSocket/webSocketComplete → flowSchema/UploadS3Case/createObjectComplete}/handler/data.js +1 -1
- package/src/TemplateManager/src/{flowTag/webSocket/webSocketComplete → flowSchema/UploadS3Case/createObjectComplete}/handler/template.ejs +10 -10
- package/src/TemplateManager/src/{flowTag/webSocket/webSocketComplete → flowSchema/UploadS3Case/createObjectComplete}/mainFunction/data.js +3 -4
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createObjectComplete/mainFunction/template.ejs +86 -0
- package/src/TemplateManager/src/{flowTag/webSocket/webSocketComplete → flowSchema/UploadS3Case/createObjectComplete}/sns-sqs/data.js +4 -2
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createObjectComplete/sns-sqs/template.ejs +49 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/getsignUrlsAcc/functionYaml/data.js +85 -0
- package/src/TemplateManager/src/{flowTag/webSocket/webSocketComplete → flowSchema/UploadS3Case/createPresignUrl/getsignUrlsAcc}/functionYaml/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/getsignUrlsAcc/handler/data.js +57 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/getsignUrlsAcc/handler/template.ejs +120 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/getsignUrlsAcc/mainFunction/data.js +51 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/getsignUrlsAcc/mainFunction/template.ejs +164 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/getsignUrlsAcc/sqs/data.js +65 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/getsignUrlsAcc/sqs/template.ejs +53 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/reservedLimitComplete/functionYaml/data.js +112 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/reservedLimitComplete/functionYaml/template.ejs +30 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/reservedLimitComplete/handler/data.js +57 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/reservedLimitComplete/handler/template.ejs +126 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/reservedLimitComplete/mainFunction/data.js +54 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/reservedLimitComplete/mainFunction/template.ejs +254 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/reservedLimitComplete/queue/data.js +64 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/reservedLimitComplete/queue/template.ejs +45 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode/handler/data.js +94 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode/handler/templateAsyncHandler.ejs +110 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode/handler/templateSyncHandler.ejs +49 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode/hookLogic/data.js +44 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode/mainFunction/data.js +66 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode/mainFunction/template.ejs +7 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode/queue/data.js +73 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode/queue/snsTemplate.ejs +59 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode/queue/sqsTemplate.ejs +43 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode(old)/functionYaml/data.js +102 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode(old)/functionYaml/template.ejs +43 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode(old)/handler/data.js +94 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode(old)/handler/templateAsyncHandler.ejs +110 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode(old)/handler/templateSyncHandler.ejs +49 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode(old)/hookLogic/data.js +65 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode(old)/mainFunction/data.js +67 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode(old)/mainFunction/template.ejs +30 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode(old)/queue/data.js +125 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode(old)/queue/snsTemplate.ejs +59 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/functionYml/HdrDsq/data.js +87 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/functionYml/HdrDsq/template.ejs +30 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/functionYml/HdrS3/data.js +112 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/functionYml/HdrS3/template.ejs +38 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/handler/handlerDsq/data.js +45 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/handler/handlerDsq/template.ejs +151 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/handler/handlerS3/data.js +43 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/handler/handlerS3/template.ejs +68 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/mainFunction/data.js +43 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/mainFunction/template.ejs +392 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/queue/data.js +77 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/queue/dsqTemplatePath.ejs +32 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/queue/s3Template.ejs +59 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/relate/S3/data.js +51 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/relate/S3/template.ejs +13 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/relate/libs/data.js +42 -0
- package/src/TemplateManager/src/flowSchema/UploadS3Case/relate/libs/template.ejs +137 -0
- package/src/TemplateManager/src/libs/Consts.js +89 -34
- package/src/TemplateManager/src/reStructureExample/GenerateCodeTest.js +31 -0
- package/src/TemplateManager/src/reStructureExample/TemplateConfig.js +11 -0
- package/src/TemplateManager/src/reStructureExample/TemplateData/perAction/data.js +0 -0
- package/src/TemplateManager/src/reStructureExample/TemplateData/perAction/generateCodeShared.js +1 -0
- package/src/TemplateManager/src/reStructureExample/TemplateData/perAction/generatePerAction.js +5 -0
- package/src/TemplateManager/src/reStructureExample/TemplateData/perAction/template.ejs +0 -0
- package/src/TemplateManager/src/flowTag/webSocket/webSocketComplete/mainFunction/template.ejs +0 -180
- /package/src/TemplateManager/src/{flowTag/resources/dynamoDb/data.js → flowSchema/DefaultWebSocketResource/dynamoDb/WebSocketTaskData.js} +0 -0
- /package/src/TemplateManager/src/{flowTag/webSocket → flowSchema/DefaultWebSocketResource}/webSocketConnect/functionYaml/template.ejs +0 -0
- /package/src/TemplateManager/src/{flowTag/webSocket → flowSchema/DefaultWebSocketResource}/webSocketConnect/handler/template.ejs +0 -0
- /package/src/TemplateManager/src/{flowTag/webSocket/webSocketComplete/sns-sqs/template.ejs → flowSchema/UploadS3Case/hookCode(old)/queue/sqsTemplate.ejs} +0 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2021 Sven Mason <http://izara.io>
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU Affero General Public License as
|
|
6
|
+
published by the Free Software Foundation, either version 3 of the
|
|
7
|
+
License, or (at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU Affero General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
'use strict';
|
|
19
|
+
|
|
20
|
+
const path = require('path');
|
|
21
|
+
|
|
22
|
+
const templatePath = path.join(__dirname, "./template.ejs")
|
|
23
|
+
|
|
24
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils")
|
|
25
|
+
const { HANDLER, defaultIamRolePerAction, createIamRole, RESOURCE_CLASSES, SQS_RESOURCE, SNS_RESOURCE, resourceNames, shortNameHandler, SOURCE_PATH, SAVE_FILE_NAME, awaitingMultipleStepsRole, externalResourceSns, externalResourceName, DYNAMO_RESOURCE, LAMBDA_RESOURCE } = require('../../../../libs/Consts');
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* receive objectSchema
|
|
29
|
+
*
|
|
30
|
+
* @param {Object} flowSchema
|
|
31
|
+
* @return {{ templatePath, templateData, setting } }
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
function data(_izContext, srcPath) {
|
|
35
|
+
return [createSourceParams(_izContext, srcPath)]
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function createSourceParams(_izContext, srcPath) {
|
|
39
|
+
let functionName = "ConfirmNewReserved";
|
|
40
|
+
let handlerType = upperCase(HANDLER.hdrSqs);
|
|
41
|
+
let additionalResourcePermission = defaultIamRolePerAction();
|
|
42
|
+
|
|
43
|
+
additionalResourcePermission.push(
|
|
44
|
+
createIamRole(
|
|
45
|
+
{
|
|
46
|
+
[RESOURCE_CLASSES.sqs]: [
|
|
47
|
+
SQS_RESOURCE.receiveMessage,
|
|
48
|
+
SQS_RESOURCE.sendMessage,
|
|
49
|
+
SQS_RESOURCE.deleteMessage,
|
|
50
|
+
SQS_RESOURCE.getQueueAttributes
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
[
|
|
54
|
+
resourceNames(RESOURCE_CLASSES.sqs, functionName + handlerType),
|
|
55
|
+
resourceNames(RESOURCE_CLASSES.sqs, functionName + "DLQ"),
|
|
56
|
+
]
|
|
57
|
+
),
|
|
58
|
+
createIamRole(
|
|
59
|
+
{
|
|
60
|
+
[RESOURCE_CLASSES.dynamoDbTable]: [
|
|
61
|
+
DYNAMO_RESOURCE.query,
|
|
62
|
+
DYNAMO_RESOURCE.deleteItem,
|
|
63
|
+
DYNAMO_RESOURCE.updateItem,
|
|
64
|
+
DYNAMO_RESOURCE.putItem
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
[
|
|
68
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "ReservedDataMain"),
|
|
69
|
+
]
|
|
70
|
+
),
|
|
71
|
+
createIamRole(
|
|
72
|
+
{
|
|
73
|
+
[RESOURCE_CLASSES.lambda]: [LAMBDA_RESOURCE.invokeFunction],
|
|
74
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
75
|
+
},
|
|
76
|
+
[
|
|
77
|
+
resourceNames(RESOURCE_CLASSES.lambda, "ImportBatchMainGetHdrInv"),
|
|
78
|
+
resourceNames(RESOURCE_CLASSES.sns, "InImportBatchMainUpdate")
|
|
79
|
+
]
|
|
80
|
+
)
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
return {
|
|
84
|
+
templatePath: templatePath,
|
|
85
|
+
templateData: {
|
|
86
|
+
functionName,
|
|
87
|
+
handlerType,
|
|
88
|
+
functionNameConfig: functionName + upperCase(handlerType),
|
|
89
|
+
resourceLocation: SOURCE_PATH.resourceLocationWebSocket,
|
|
90
|
+
additionalResourcePermission,
|
|
91
|
+
functionNameConfig: upperCase(functionName) + upperCase(shortNameHandler(handlerType)),
|
|
92
|
+
},
|
|
93
|
+
setting: {
|
|
94
|
+
saveFileName: upperCase(SAVE_FILE_NAME.flowSchema),
|
|
95
|
+
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
96
|
+
fileExtension: ".yml",
|
|
97
|
+
isAppend: true
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
module.exports = data
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<%_ const join = require('path').join; _%>
|
|
2
|
+
<%- firstLetterUpperCase(functionNameConfig) %>:
|
|
3
|
+
handler: <%- join(resourceLocation, `${functionName}_${firstLetterUpperCase(handlerType)}.main`)%>
|
|
4
|
+
name: ${self:custom.iz_resourcePrefix}<%- functionName %><%- firstLetterUpperCase(handlerType) %>
|
|
5
|
+
events:
|
|
6
|
+
- sqs:
|
|
7
|
+
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- functionName %><%- firstLetterUpperCase(handlerType) %>
|
|
8
|
+
batchSize: 10
|
|
9
|
+
filterPatterns: #**** need to update serverless framwork upper v.2.69.1
|
|
10
|
+
- body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>"]}}} # functionName of callingFlow
|
|
11
|
+
- body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
|
|
12
|
+
iamRoleStatements:
|
|
13
|
+
<%_ additionalResourcePermission.forEach(resourcePermission => { _%>
|
|
14
|
+
- Effect: <%- resourcePermission.effect %>
|
|
15
|
+
Action:
|
|
16
|
+
<%_ Object.keys(resourcePermission.action).forEach(resourcePerAction => { _%>
|
|
17
|
+
<%_ resourcePermission.action[resourcePerAction].forEach(permission => { _%>
|
|
18
|
+
- <%- resourcePerAction %>:<%- permission %>
|
|
19
|
+
<%_ }) _%>
|
|
20
|
+
<%_ }) _%>
|
|
21
|
+
Resource:
|
|
22
|
+
<%_ resourcePermission.resource.forEach(resource => { _%>
|
|
23
|
+
- "<%- resource %>"
|
|
24
|
+
<%_ }) _%>
|
|
25
|
+
<%_}) _%>
|
|
26
|
+
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
27
|
+
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
28
|
+
<%_ function firstLetterUpperCase(text){
|
|
29
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
30
|
+
} _%>
|
package/src/TemplateManager/src/flowSchema/UploadS3Case/confirmReservedAfterUpload/handler/data.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2021 Sven Mason <http://izara.io>
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU Affero General Public License as
|
|
6
|
+
published by the Free Software Foundation, either version 3 of the
|
|
7
|
+
License, or (at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU Affero General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
'use strict';
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
const path = require('path');
|
|
23
|
+
|
|
24
|
+
const templatePath = path.join(__dirname, "./template.ejs")
|
|
25
|
+
const { firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils")
|
|
26
|
+
const { HANDLER, SOURCE_PATH } = require('../../../../libs/Consts');
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* receive objectSchema
|
|
30
|
+
*
|
|
31
|
+
* @param {Object} flowSchema
|
|
32
|
+
* @return {{ templatePath, templateData, setting } }
|
|
33
|
+
*/
|
|
34
|
+
|
|
35
|
+
function data(_izContext, srcPath) {
|
|
36
|
+
return [createSourceParams(_izContext, srcPath)]
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function createSourceParams(_izContext, srcPath) {
|
|
40
|
+
let functionName = "ConfirmNewReserved";
|
|
41
|
+
let handlerType = upperCase(HANDLER.hdrSqs);
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
templatePath: templatePath,
|
|
45
|
+
templateData: {
|
|
46
|
+
functionName,
|
|
47
|
+
handlerType,
|
|
48
|
+
},
|
|
49
|
+
setting: {
|
|
50
|
+
saveFileName: `${functionName}_${handlerType}`,
|
|
51
|
+
savePath: path.join(srcPath, SOURCE_PATH.webSocket),
|
|
52
|
+
fileExtension: ".js",
|
|
53
|
+
isAppend: true
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
module.exports = data
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2021 Sven Mason <http://izara.io>
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU Affero General Public License as
|
|
6
|
+
published by the Free Software Foundation, either version 3 of the
|
|
7
|
+
License, or (at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU Affero General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
'use strict';
|
|
19
|
+
|
|
20
|
+
// const AWS = require('aws-sdk');
|
|
21
|
+
// const sqs = new AWS.SQS({ apiVersion: '2012-11-05' });
|
|
22
|
+
|
|
23
|
+
const izara = require("@izara_project/izara-middleware");
|
|
24
|
+
const middleware = izara.middlewareHandler;
|
|
25
|
+
const recordHandlerSharedLib = require("@izara_project/izara-shared").recordHandlerSharedLib;
|
|
26
|
+
const Logger = require('@izara_project/izara-core-library-logger');
|
|
27
|
+
const izaraShared = require('@izara_project/izara-shared');
|
|
28
|
+
const callingFlowSharedLib = izaraShared.callingFlowSharedLib;
|
|
29
|
+
|
|
30
|
+
const confirmNewReserved = require('./ConfirmNewReserved_Main')
|
|
31
|
+
|
|
32
|
+
// validate event properties in body.Message of sqs event
|
|
33
|
+
middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
|
|
34
|
+
|
|
35
|
+
// set schema for record.body.Message
|
|
36
|
+
let perRecordsValidatorSchema = {
|
|
37
|
+
type: "object",
|
|
38
|
+
required: [
|
|
39
|
+
'returnMessage',
|
|
40
|
+
'errorsFound',
|
|
41
|
+
'passStatus'
|
|
42
|
+
],
|
|
43
|
+
properties: {
|
|
44
|
+
returnMessage: {
|
|
45
|
+
type: "object"
|
|
46
|
+
},
|
|
47
|
+
errorsFound: {
|
|
48
|
+
type: "array"
|
|
49
|
+
},
|
|
50
|
+
passStatus: {
|
|
51
|
+
type: 'boolean'
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// set schema for record.body.MessageAttributes
|
|
57
|
+
// const messageAttributeValidatorSchema = {
|
|
58
|
+
// type: "object",
|
|
59
|
+
// required: ['msgAtrrParam1', 'msgAtrrParam2'],
|
|
60
|
+
// properties: {
|
|
61
|
+
// msgAtrrParam1: {
|
|
62
|
+
// type: "string"
|
|
63
|
+
// },
|
|
64
|
+
// msgAtrrParam2: {
|
|
65
|
+
// type: "object"
|
|
66
|
+
// }
|
|
67
|
+
// }
|
|
68
|
+
// };
|
|
69
|
+
|
|
70
|
+
perRecordsValidatorSchema = callingFlowSharedLib.addOptionalPassBackPropertiesToValidatorSchema(perRecordsValidatorSchema)
|
|
71
|
+
|
|
72
|
+
module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
73
|
+
|
|
74
|
+
try {
|
|
75
|
+
|
|
76
|
+
let recordPromises = [];
|
|
77
|
+
|
|
78
|
+
// loop each record and send to mainFunction
|
|
79
|
+
await Promise.all(event.Records.map(async record => { // promise.all for map() function
|
|
80
|
+
|
|
81
|
+
let passOnProperties = []
|
|
82
|
+
record._izContext.logger.debug('record ReceiveMsgOutHdrSqs', record);
|
|
83
|
+
|
|
84
|
+
// validate message (and MessageAttributes)
|
|
85
|
+
await recordHandlerSharedLib.validateRecord(
|
|
86
|
+
record, // one record will send to mainFunction
|
|
87
|
+
"ConfirmNewReservedHdrSqs", // queue name that need to retry or send to dlq
|
|
88
|
+
perRecordsValidatorSchema, // schema for record.Message
|
|
89
|
+
// messageAttributeValidatorSchema // ----- for msgAttr default is null -> do not send this parameter if not want to validate msgAtt
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
// add argument (to invoke lambda) to passOnProperties[]
|
|
93
|
+
passOnProperties.push(record.body.Message.returnMessage)
|
|
94
|
+
passOnProperties.push(record.body.Message.errorsFound)
|
|
95
|
+
passOnProperties.push(record.body.Message.passStatus)
|
|
96
|
+
passOnProperties.push(callingFlowSharedLib.addPassBackPropertiesToPassOnProperties(record.body.Message))
|
|
97
|
+
record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
|
|
98
|
+
|
|
99
|
+
// call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
|
|
100
|
+
let recordPromise = recordHandlerSharedLib.recordHandler(
|
|
101
|
+
record, // one record will send to mainFunction
|
|
102
|
+
confirmNewReserved.confirmNewReserved, // mainFunction that need to invoke.
|
|
103
|
+
"ConfirmNewReservedHdrSqs", // queue name that need to retry or send to dlq
|
|
104
|
+
passOnProperties, // all parameters that mainFunction needed.
|
|
105
|
+
);
|
|
106
|
+
record._izContext.logger.debug('after recordPromise in handler');
|
|
107
|
+
recordPromises.push(recordPromise); // push promise to recordPromises
|
|
108
|
+
}))
|
|
109
|
+
|
|
110
|
+
Logger.debug('before Promise.all(recordPromises) in handler');
|
|
111
|
+
try {
|
|
112
|
+
// --- main await all promises
|
|
113
|
+
await Promise.all(recordPromises); // await all promises
|
|
114
|
+
|
|
115
|
+
return event.Records // return all for local test
|
|
116
|
+
|
|
117
|
+
} catch {
|
|
118
|
+
Logger.debug('Promise.all(recordPromises) in handler threw error (at least one record did no resolve)');
|
|
119
|
+
}
|
|
120
|
+
Logger.debug('after Promise.all(recordPromises) in handler');
|
|
121
|
+
|
|
122
|
+
} catch (err) {
|
|
123
|
+
Logger.error('Unhandled Error, ConfirmNewReservedHdrSqs: ', err);
|
|
124
|
+
throw (err);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2021 Sven Mason <http://izara.io>
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU Affero General Public License as
|
|
6
|
+
published by the Free Software Foundation, either version 3 of the
|
|
7
|
+
License, or (at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU Affero General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
'use strict';
|
|
19
|
+
|
|
20
|
+
const path = require('path');
|
|
21
|
+
|
|
22
|
+
const templatePath = path.join(__dirname, "./template.ejs")
|
|
23
|
+
|
|
24
|
+
const { SOURCE_PATH } = require("../../../../libs/Consts");
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* receive objectSchema
|
|
28
|
+
*
|
|
29
|
+
* @param {Object} flowSchema
|
|
30
|
+
* @return {{ templatePath, templateData, setting } }
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
function data(_izContext, flowSchema, srcPath) {
|
|
34
|
+
return [createSourceParams(_izContext, flowSchema, srcPath)]
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function createSourceParams(_izContext, srcPath) {
|
|
38
|
+
let functionName = "ConfirmNewReserved"
|
|
39
|
+
return {
|
|
40
|
+
templatePath: templatePath,
|
|
41
|
+
templateData: {},
|
|
42
|
+
setting: {
|
|
43
|
+
saveFileName: `${functionName}_Main`,
|
|
44
|
+
savePath: path.join(srcPath, SOURCE_PATH.webSocket),
|
|
45
|
+
fileExtension: ".js",
|
|
46
|
+
isAppend: false
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
module.exports = data
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2021 Sven Mason <http://izara.io>
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU Affero General Public License as
|
|
6
|
+
published by the Free Software Foundation, either version 3 of the
|
|
7
|
+
License, or (at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU Affero General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
'use strict';
|
|
19
|
+
|
|
20
|
+
const izaraShared = require('@izara_project/izara-shared');
|
|
21
|
+
const dynamodbSharedLib = izaraShared.dynamodbSharedLib;
|
|
22
|
+
const snsSharedLib = izaraShared.snsSharedLib;
|
|
23
|
+
const sns = require('@izara_project/izara-core-library-external-request').sns
|
|
24
|
+
const consts = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
25
|
+
const { getNestObject } = require('../../libs/source/ImportDataLib')
|
|
26
|
+
/**
|
|
27
|
+
* description of function.
|
|
28
|
+
* @param {Object} _izContext
|
|
29
|
+
* @param {CorrelationIds} _izContext.correlationIds - property of _izContext
|
|
30
|
+
* @param {Logger} _izContext.logger - property of _izContext
|
|
31
|
+
* @param {Logger} _izContext.logger - property of _izContext
|
|
32
|
+
* @param {Object} returnMessage - limitValue or limitFound
|
|
33
|
+
* @param {Array} errorsFound - array
|
|
34
|
+
* @param {boolean} passStatus - true || false
|
|
35
|
+
* @param {Object} passBackProperties - identifier
|
|
36
|
+
|
|
37
|
+
*
|
|
38
|
+
* @returns {object} returnResponse
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
module.exports.confirmNewReserved = async (
|
|
42
|
+
_izContext,
|
|
43
|
+
returnMessage,
|
|
44
|
+
errorsFound,
|
|
45
|
+
passStatus,
|
|
46
|
+
passBackProperties
|
|
47
|
+
|
|
48
|
+
) => {
|
|
49
|
+
try {
|
|
50
|
+
_izContext.logger.debug('----- confirmNewReserved event params', {
|
|
51
|
+
_izContext: _izContext,
|
|
52
|
+
returnMessage: returnMessage,
|
|
53
|
+
errorsFound: errorsFound,
|
|
54
|
+
passStatus: passStatus,
|
|
55
|
+
passBackProperties: passBackProperties
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
let servicePendingId = passBackProperties.passBackProperties.identifier.servicePendingId;
|
|
59
|
+
let reservedDataId = passBackProperties.passBackProperties.identifier.reservedDataId;
|
|
60
|
+
let userId = passBackProperties.passBackProperties.identifier.userId;
|
|
61
|
+
let realFileSize = passBackProperties.passBackProperties.identifier.realFileSize;
|
|
62
|
+
|
|
63
|
+
let uniqueIdentify = getNestObject(
|
|
64
|
+
_izContext,
|
|
65
|
+
returnMessage.limitFound,
|
|
66
|
+
["runningTotal", "uniqueIdentify", "usedTimestampId"]
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
// confirmUsage
|
|
70
|
+
let confirmUsageMessage = {
|
|
71
|
+
userId: userId,
|
|
72
|
+
limitTag: consts.LIMIT_TAG.uploadData,
|
|
73
|
+
uniqueIdentify: uniqueIdentify,
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
let sendMessageToConfirmUsage = {
|
|
77
|
+
Message: JSON.stringify(confirmUsageMessage),
|
|
78
|
+
TopicArn: await snsSharedLib.snsTopicArn(_izContext, 'InConfirmUsage', consts.EXTERNAL_SERVICE_NAME.accountLimits)
|
|
79
|
+
};
|
|
80
|
+
_izContext.logger.debug("sendMessageToConfirmUsage", sendMessageToConfirmUsage);
|
|
81
|
+
await sns.publishAsync(_izContext, sendMessageToConfirmUsage);
|
|
82
|
+
|
|
83
|
+
// update reservedDataValue as real size in ReservedDataMain table
|
|
84
|
+
await dynamodbSharedLib.updateItem(
|
|
85
|
+
_izContext,
|
|
86
|
+
await dynamodbSharedLib.tableName(_izContext, 'ReservedDataMain'),
|
|
87
|
+
{
|
|
88
|
+
servicePendingId: servicePendingId,
|
|
89
|
+
reservedDataId: reservedDataId
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
reservedValue: realFileSize
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
// update importBatchMainTable
|
|
97
|
+
let sendMessageToUpdateImportBatchStatus = {
|
|
98
|
+
objInstanceFull: {
|
|
99
|
+
identifiers: {
|
|
100
|
+
importBatchId: servicePendingId
|
|
101
|
+
},
|
|
102
|
+
fields: {
|
|
103
|
+
importBatchStatus: 'uploadComplete'
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
let sendMessageToUpdateImportBatch = {
|
|
109
|
+
Message: JSON.stringify(sendMessageToUpdateImportBatchStatus),
|
|
110
|
+
TopicArn: await snsSharedLib.snsTopicArn(_izContext, `InImportBatchMainUpdate`)
|
|
111
|
+
};
|
|
112
|
+
_izContext.logger.debug("sendMessageToUpdateImportBatch", sendMessageToUpdateImportBatch);
|
|
113
|
+
await sns.publishAsync(_izContext, sendMessageToUpdateImportBatch);
|
|
114
|
+
|
|
115
|
+
return { returnResponse: 'success' }
|
|
116
|
+
|
|
117
|
+
} catch (err) {
|
|
118
|
+
_izContext.logger.debug('error ConfirmNewReservedMain: ', err)
|
|
119
|
+
throw (err)
|
|
120
|
+
}
|
|
121
|
+
}
|
package/src/TemplateManager/src/flowSchema/UploadS3Case/confirmReservedAfterUpload/queue/data.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2020 Sven Mason <http://izara.io>
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU Affero General Public License as
|
|
6
|
+
published by the Free Software Foundation, either version 3 of the
|
|
7
|
+
License, or (at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU Affero General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
'use strict';
|
|
19
|
+
|
|
20
|
+
const path = require("path")
|
|
21
|
+
|
|
22
|
+
const { SOURCE_PATH, SAVE_FILE_NAME } = require('../../../../libs/Consts');
|
|
23
|
+
const { TOPIC_NAME_GENERATE_CODE } = require("../../../../../../GenerateCodeLibs/src/Consts");
|
|
24
|
+
|
|
25
|
+
const templatePath = path.join(__dirname, './template.ejs');
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* create data for dynamoDbYaml tempalte from objectSchema
|
|
30
|
+
* return array of dynamoDb data
|
|
31
|
+
* because one objectSchema can create multiple dynamoDb table
|
|
32
|
+
*
|
|
33
|
+
* @param {Object} _izContext
|
|
34
|
+
* @param {Object} objectSchema
|
|
35
|
+
* @returns {Object[]} - data of multiple dynamoDb template
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
function data(_izContext, srcPath) {
|
|
39
|
+
let resultForCreateSqs = [];
|
|
40
|
+
const WebSocketSqsQueueNames = [];
|
|
41
|
+
const setting = {
|
|
42
|
+
initialData: "Resources:\n",
|
|
43
|
+
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
44
|
+
saveFileName: SAVE_FILE_NAME.snsInSqsYaml,
|
|
45
|
+
fileExtension: ".yml",
|
|
46
|
+
isAppend: true
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
WebSocketSqsQueueNames.push(
|
|
50
|
+
{
|
|
51
|
+
queueName: "ConfirmNewReserved"
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
for (let WebSocketSqsQueueName of WebSocketSqsQueueNames) {
|
|
56
|
+
resultForCreateSqs.push(({
|
|
57
|
+
templatePath: templatePath,
|
|
58
|
+
templateData: WebSocketSqsQueueName,
|
|
59
|
+
setting: setting
|
|
60
|
+
}))
|
|
61
|
+
}
|
|
62
|
+
return resultForCreateSqs
|
|
63
|
+
}
|
|
64
|
+
module.exports = data;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
##===== [Queue]
|
|
2
|
+
<%- queueName %>HdrSqs:
|
|
3
|
+
Type: "AWS::SQS::Queue"
|
|
4
|
+
Properties:
|
|
5
|
+
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>HdrSqs
|
|
6
|
+
RedrivePolicy:
|
|
7
|
+
deadLetterTargetArn:
|
|
8
|
+
# !GetAtt
|
|
9
|
+
Fn::GetAtt:
|
|
10
|
+
- <%- queueName %>HdrSqsDLQ
|
|
11
|
+
- Arn
|
|
12
|
+
maxReceiveCount: 3
|
|
13
|
+
VisibilityTimeout: 120
|
|
14
|
+
##==== [QueueDLQ]
|
|
15
|
+
<%- queueName %>HdrSqsDLQ:
|
|
16
|
+
Type: AWS::SQS::Queue
|
|
17
|
+
Properties:
|
|
18
|
+
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>HdrSqsDLQ
|
|
19
|
+
##==== [QueuePolicy]
|
|
20
|
+
<%- queueName %>HdrSqsPolicy:
|
|
21
|
+
Type: AWS::SQS::QueuePolicy
|
|
22
|
+
Properties:
|
|
23
|
+
PolicyDocument:
|
|
24
|
+
Version: "2012-10-17"
|
|
25
|
+
Statement:
|
|
26
|
+
- Sid: "allow-sns-messages"
|
|
27
|
+
Effect: Allow
|
|
28
|
+
Principal: "*"
|
|
29
|
+
Resource:
|
|
30
|
+
# !GetAtt
|
|
31
|
+
Fn::GetAtt:
|
|
32
|
+
- <%- queueName %>HdrSqs
|
|
33
|
+
- Arn
|
|
34
|
+
Action: "SQS:SendMessage"
|
|
35
|
+
Queues:
|
|
36
|
+
- Ref: <%- queueName %>HdrSqs
|
|
37
|
+
#<#<%- firstLetterUpperCase(queueName) %>QueueSetting#>
|
|
38
|
+
#<#/<%- firstLetterUpperCase(queueName) %>QueueSetting#>
|
|
39
|
+
|
|
40
|
+
<%_ function firstLetterUpperCase(text){
|
|
41
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
42
|
+
} _%>
|
|
43
|
+
<%_ function firstLetterLowerCase(str) {
|
|
44
|
+
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
45
|
+
} _%>
|