@izara_project/izara-market-library-service-schemas 1.0.4 → 1.0.6
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/index.js +2 -1
- package/src/GenerateCodeLibs/src/Consts.js +20 -5
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +298 -12
- package/src/GenerateCodeLibs/src/TranslateIdsLibs.js +89 -0
- package/src/MainLibs/src/Utils.js +10 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/functionYaml/HdrApi/data.js +119 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/functionYaml/HdrDsq/data.js +133 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/functionYaml/HdrInv/data.js +120 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/functionYaml/HdrSqs/data.js +133 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/mainFunction/data.js +59 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/mainFunction/template.ejs +340 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrApi/data.js +58 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrApi/request.json +0 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrApi/template.ejs +120 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrDsq/data.js +59 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrDsq/request.json +0 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrDsq/template.ejs +167 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrInv/data.js +60 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrInv/request.json +0 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrInv/template.ejs +107 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrSqs/data.js +60 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrSqs/request.json +0 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrSqs/template.ejs +146 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/request.json +30 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationship/sns-in-sqs/data.js +78 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/functionYaml/data.js +133 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/functionYaml/request.json +0 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/functionYaml/template.ejs +33 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/handler/HdrSqs/data.js +61 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/handler/HdrSqs/request.json +0 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/handler/HdrSqs/template.ejs +125 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/mainFunction/data.js +56 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/mainFunction/request.json +0 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/mainFunction/template.ejs +137 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/sns-in-sqs/data.js +72 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/sns-in-sqs/request.json +0 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/sns-in-sqs/template.ejs +47 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/sns-out/data.js +72 -0
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/sns-out/request.json +0 -0
- package/src/TemplateManager/src/FindData/FindDataYaml/data.js +188 -0
- package/src/TemplateManager/src/FindData/FindDataYaml/template.ejs +27 -0
- package/src/TemplateManager/src/FindData/GetByStorage/getByDynamo.ejs +53 -0
- package/src/TemplateManager/src/FindData/GetByStorage/getByGraph.ejs +99 -0
- package/src/TemplateManager/src/FindData/Handler/data.js +48 -0
- package/src/TemplateManager/src/FindData/Handler/template.ejs +140 -0
- package/src/TemplateManager/src/FindData/mainFunction/data.js +279 -0
- package/src/TemplateManager/src/FindData/mainFunction/template.ejs +155 -0
- package/src/TemplateManager/src/GenerateCode(Old).js +1 -1
- package/src/TemplateManager/src/GenerateCode.js +205 -45
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/functionYaml/data.js +98 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/functionYaml/template.ejs +33 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/handler/data.js +0 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/handler/template.ejs +0 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/mainFunction/createObjectComplete_main.js +172 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/mainFunction/data.js +0 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/mainFunction/template.ejs +0 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/sns-in-sqs/data.js +0 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/sns-in-sqs/template.ejs +0 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/sns-out/data.js +0 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/sns-out/template.ejs +0 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/functionYaml/data.js +98 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/functionYaml/template.ejs +33 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/handler/data.js +59 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/handler/template.ejs +129 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/mainFunction/data.js +53 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/mainFunction/template.ejs +126 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/sns-out/data.js +62 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/sqs-in-sns/data.js +58 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/sqs-in-sns/template.ejs +47 -0
- package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrApi/data.js +24 -20
- package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrApi/template.ejs +2 -2
- package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrDsq/data.js +27 -20
- package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrInv/data.js +54 -22
- package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrSqs/data.js +28 -23
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrSqs/template.ejs +30 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrApi/data.js +6 -22
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrApi/getTemplate.ejs +76 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrApi/updateTemplate.ejs +67 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrDsq/data.js +47 -37
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrDsq/getTemplate.ejs +105 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrDsq/updateTemplate.ejs +109 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/createTemplate.ejs +75 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/data.js +68 -33
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/getTemplate.ejs +82 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/updateTemplate.ejs +75 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrSqs/data.js +46 -30
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrSqs/getTemplate.ejs +124 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrSqs/updateTemplate.ejs +133 -0
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Create/CreateObject_main.js +760 -0
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Create/data.js +67 -0
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Create/request.json +0 -0
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Create/template.ejs +581 -0
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Get/data.js +0 -21
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Get/template.ejs +34 -31
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Get/testParam.json +5 -0
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Update/data.js +61 -0
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Update/request.json +0 -0
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Update/template.ejs +267 -0
- package/src/TemplateManager/src/ProcessLogical/Handler/data.js +49 -0
- package/src/TemplateManager/src/ProcessLogical/Handler/template.ejs +129 -0
- package/src/TemplateManager/src/ProcessLogical/ProcessLogicalYaml/data.js +175 -0
- package/src/TemplateManager/src/ProcessLogical/ProcessLogicalYaml/template.ejs +25 -0
- package/src/TemplateManager/src/ProcessLogical/mainFunction/data.js +47 -0
- package/src/TemplateManager/src/ProcessLogical/mainFunction/template.ejs +421 -0
- package/src/TemplateManager/src/ProcessLogicalPagination/DsqYaml/data.js +50 -0
- package/src/TemplateManager/src/ProcessLogicalPagination/DsqYaml/template.ejs +32 -0
- package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrDsq/data.js +167 -0
- package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrDsq/template.ejs +25 -0
- package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrSqs/data.js +169 -0
- package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrSqs/template.ejs +25 -0
- package/src/TemplateManager/src/ProcessLogicalPagination/Handler/HdrDsq/data.js +48 -0
- package/src/TemplateManager/src/ProcessLogicalPagination/Handler/HdrDsq/template.ejs +163 -0
- package/src/TemplateManager/src/ProcessLogicalPagination/Handler/HdrSqs/data.js +48 -0
- package/src/TemplateManager/src/ProcessLogicalPagination/Handler/HdrSqs/template.ejs +146 -0
- package/src/TemplateManager/src/ProcessLogicalPagination/mainFunction/data.js +48 -0
- package/src/TemplateManager/src/ProcessLogicalPagination/mainFunction/template.ejs +212 -0
- package/src/TemplateManager/src/ResourceYaml/CreateSourceData.js +2 -2
- package/src/TemplateManager/src/ResourceYaml/dynamodb/awaitingMultipleStepData.js +5 -8
- package/src/TemplateManager/src/ResourceYaml/dynamodb/mainResourcePerObjectSchemaData.js +4 -26
- package/src/TemplateManager/src/ResourceYaml/dynamodb/processLogicalAndFindData.js +6 -10
- package/src/TemplateManager/src/ResourceYaml/sns-in-sqs/defaultSnsInSqsForFindDataAndProcessLogical.js +28 -16
- package/src/TemplateManager/src/ResourceYaml/sns-in-sqs/snsAndSqsPerActiondata.js +5 -5
- package/src/TemplateManager/src/ResourceYaml/sns-out/data.js +3 -3
- package/src/TemplateManager/src/ResourceYaml/sns-out/defaultSnsOutForFindDataAndProcessLogical.js +75 -0
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/functionYaml/data.js +95 -0
- package/src/TemplateManager/src/{FunctionYaml/HdrSqs → TranslateIdReq/ProcessingTranslateIds/functionYaml}/template.ejs +1 -1
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/handler/dataHdrDsq.js +52 -0
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/handler/template.ejs +194 -0
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/mainFunction/data.js +48 -0
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/mainFunction/template.ejs +330 -0
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/sns-out/data.js +47 -0
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/sqs-sns/data.js +58 -0
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/sqs-sns/template.ejs +43 -0
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrDsq/data.js +116 -0
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrSqs/data.js +116 -0
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrDsq/data.js +60 -0
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrDsq/template.ejs +157 -0
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrSqs/data.js +59 -0
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrSqs/template.ejs +175 -0
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/mainFunction/data.js +61 -0
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/mainFunction/template.ejs +155 -0
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/resourceYaml/dynamoDb/data.js +120 -0
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/resourceYaml/sns-sqs/data.js +75 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/functionYaml/data.js +8 -24
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/handler/HdrSqs/data.js +7 -21
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/mainFunction/data.js +4 -3
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/mainFunction/template.ejs +1 -1
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/sns-in-sqs/data.js +10 -13
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/sns-in-sqs/template.ejs +1 -0
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/sns-out/data.js +6 -5
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrApi/data.js +13 -21
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrDsq/data.js +11 -29
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrInv/data.js +16 -21
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrSqs/data.js +12 -27
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/mainFunction/data.js +3 -18
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/mainFunction/template.ejs +18 -11
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrApi/data.js +5 -18
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrDsq/data.js +5 -19
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrInv/data.js +7 -18
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrSqs/data.js +6 -20
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/request.json +3 -4
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/sns-in-sqs/data.js +5 -6
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/sns-out/data.js +4 -4
- package/src/TemplateManager/src/externalService/LambdaRole/data.js +181 -59
- package/src/TemplateManager/src/externalService/LambdaRole/template.ejs +17 -15
- package/src/TemplateManager/src/externalService/SnsTopicSubscriotions/data.js +56 -44
- package/src/TemplateManager/src/externalService/SnsTopicSubscriotions/template.ejs +3 -4
- package/src/TemplateManager/src/libs/Consts.js +162 -13
- package/src/TemplateManager/src/PerActionEndpoint/Handler/testRequest.json +0 -5
- /package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrApi/request.json +0 -0
- /package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrDsq/request.json +0 -0
- /package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrDsq/template.ejs +0 -0
- /package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrInv/example req.js +0 -0
- /package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrInv/request.json +0 -0
- /package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrInv/template.ejs +0 -0
- /package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrSqs/request.json +0 -0
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
const { SOURCE_PATH, FUNCTION_NAME, HANDLER } = require("../../../libs/Consts");
|
|
22
|
+
const { firstLetterUpperCase: upperCase } = require('../../../../../MainLibs/src/Utils');
|
|
23
|
+
const templatePath = path.join(__dirname, "./template.ejs");
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* receive srcPath
|
|
28
|
+
* not create data for ProcessLogical Main template
|
|
29
|
+
*
|
|
30
|
+
* @param {Object} srcPath
|
|
31
|
+
* @return {{ templatePath, templateData, setting } }
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
function data(_izContext, srcPath) {
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
templatePath: templatePath,
|
|
38
|
+
templateData: {},
|
|
39
|
+
setting: {
|
|
40
|
+
savePath: path.join(srcPath, SOURCE_PATH.processLogical),
|
|
41
|
+
saveFileName: `${upperCase(FUNCTION_NAME.paginateProcessLogical)}_${upperCase(HANDLER.hdrSqs)}`,
|
|
42
|
+
fileExtension: '.js',
|
|
43
|
+
isAppend: false
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
module.exports = data;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2020 Sven Mason <http://izara.io>
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify
|
|
5
|
+
it under the terms of the GNU Affero General Public License as
|
|
6
|
+
published by the Free Software Foundation, either version 3 of the
|
|
7
|
+
License, or (at your option) any later version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful,
|
|
10
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
+
GNU Affero General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU Affero General Public License
|
|
15
|
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
'use strict';
|
|
19
|
+
|
|
20
|
+
// const AWS = require('aws-sdk');
|
|
21
|
+
// const sqs = new AWS.SQS({ apiVersion: '2012-11-05' });
|
|
22
|
+
|
|
23
|
+
const izara = require("@izara_project/izara-middleware");
|
|
24
|
+
const middleware = izara.middlewareHandler;
|
|
25
|
+
const recordHandlerSharedLib = require("@izara_project/izara-shared").recordHandlerSharedLib;
|
|
26
|
+
const Logger = require('@izara_project/izara-core-library-logger');
|
|
27
|
+
|
|
28
|
+
const paginateProcessLogical = require('./PaginateProcessLogical_Main');
|
|
29
|
+
|
|
30
|
+
// validate event properties in body.Message of sqs event
|
|
31
|
+
middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
|
|
32
|
+
|
|
33
|
+
// set schema for record.body.Message
|
|
34
|
+
const perRecordsValidatorSchema = {
|
|
35
|
+
type: "object",
|
|
36
|
+
required: [
|
|
37
|
+
'logicalResultId',
|
|
38
|
+
'tableName',
|
|
39
|
+
'partitionKeyFieldName',
|
|
40
|
+
'sortKeyFieldName'
|
|
41
|
+
],
|
|
42
|
+
properties: {
|
|
43
|
+
logicalResultId: {
|
|
44
|
+
type: "string"
|
|
45
|
+
},
|
|
46
|
+
tableName: {
|
|
47
|
+
type: "string"
|
|
48
|
+
},
|
|
49
|
+
partitionKeyFieldName: {
|
|
50
|
+
type: "string"
|
|
51
|
+
},
|
|
52
|
+
sortKeyFieldName: {
|
|
53
|
+
type: "string"
|
|
54
|
+
},
|
|
55
|
+
comparison: {
|
|
56
|
+
type: "string",
|
|
57
|
+
default: ""
|
|
58
|
+
},
|
|
59
|
+
startKey: {
|
|
60
|
+
type: "object",
|
|
61
|
+
default: {}
|
|
62
|
+
},
|
|
63
|
+
overwriteUniqueRequestId: {
|
|
64
|
+
type: "string",
|
|
65
|
+
default: ""
|
|
66
|
+
},
|
|
67
|
+
callingFlow: {
|
|
68
|
+
type: 'string',
|
|
69
|
+
default: ""
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// set schema for record.body.MessageAttributes
|
|
75
|
+
// const messageAttributeValidatorSchema = {
|
|
76
|
+
// type: "object",
|
|
77
|
+
// required: ['msgAtrrParam1', 'msgAtrrParam2'],
|
|
78
|
+
// properties: {
|
|
79
|
+
// msgAtrrParam1: {
|
|
80
|
+
// type: "string"
|
|
81
|
+
// },
|
|
82
|
+
// msgAtrrParam2: {
|
|
83
|
+
// type: "object"
|
|
84
|
+
// }
|
|
85
|
+
// }
|
|
86
|
+
// };
|
|
87
|
+
|
|
88
|
+
module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
89
|
+
|
|
90
|
+
try {
|
|
91
|
+
|
|
92
|
+
let recordPromises = [];
|
|
93
|
+
|
|
94
|
+
// loop each record and send to mainFunction
|
|
95
|
+
await Promise.all(event.Records.map(async record => { // promise.all for map() function
|
|
96
|
+
|
|
97
|
+
let passOnProperties = []
|
|
98
|
+
record._izContext.logger.debug('record ReceiveMsgOutHdrSqs', record);
|
|
99
|
+
|
|
100
|
+
// validate message (and MessageAttributes)
|
|
101
|
+
await recordHandlerSharedLib.validateRecord(
|
|
102
|
+
record, // one record will send to mainFunction
|
|
103
|
+
"PaginateProcessLogicalHdrSqs", // queue name that need to retry or send to dlq
|
|
104
|
+
perRecordsValidatorSchema, // schema for record.Message
|
|
105
|
+
// messageAttributeValidatorSchema // ----- for msgAttr default is null -> do not send this parameter if not want to validate msgAtt
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
// add argument (to invoke lambda) to passOnProperties[]
|
|
109
|
+
passOnProperties.push(record.body.Message.logicalResultId)
|
|
110
|
+
passOnProperties.push(record.body.Message.tableName)
|
|
111
|
+
passOnProperties.push(record.body.Message.partitionKeyFieldName)
|
|
112
|
+
passOnProperties.push(record.body.Message.sortKeyFieldName)
|
|
113
|
+
passOnProperties.push(record.body.Message.comparison)
|
|
114
|
+
passOnProperties.push(record.body.Message.startKey)
|
|
115
|
+
passOnProperties.push(record.body.Message.overwriteUniqueRequestId)
|
|
116
|
+
passOnProperties.push(record.body.Message.callingFlow)
|
|
117
|
+
record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
|
|
118
|
+
|
|
119
|
+
// call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
|
|
120
|
+
let recordPromise = recordHandlerSharedLib.recordHandler(
|
|
121
|
+
record, // one record will send to mainFunction
|
|
122
|
+
paginateProcessLogical.paginateProcessLogical, // mainFunction that need to invoke.
|
|
123
|
+
"PaginateProcessLogicalHdrSqs", // queue name that need to retry or send to dlq
|
|
124
|
+
passOnProperties, // all parameters that mainFunction needed.
|
|
125
|
+
);
|
|
126
|
+
record._izContext.logger.debug('after recordPromise in handler');
|
|
127
|
+
recordPromises.push(recordPromise); // push promise to recordPromises
|
|
128
|
+
}))
|
|
129
|
+
|
|
130
|
+
Logger.debug('before Promise.all(recordPromises) in handler');
|
|
131
|
+
try {
|
|
132
|
+
// --- main await all promises
|
|
133
|
+
await Promise.all(recordPromises); // await all promises
|
|
134
|
+
|
|
135
|
+
return event.Records // return all for local testing
|
|
136
|
+
|
|
137
|
+
} catch {
|
|
138
|
+
Logger.debug('Promise.all(recordPromises) in handler threw error (at least one record did no resolve)');
|
|
139
|
+
}
|
|
140
|
+
Logger.debug('after Promise.all(recordPromises) in handler');
|
|
141
|
+
|
|
142
|
+
} catch (err) {
|
|
143
|
+
Logger.error('Unhandled Error, PaginateProcessLogicalHdrSqs: ', err);
|
|
144
|
+
throw (err);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
const { SOURCE_PATH, FUNCTION_NAME, HANDLER } = require("../../libs/Consts");
|
|
22
|
+
const { firstLetterUpperCase: upperCase } = require('../../../../MainLibs/src/Utils');
|
|
23
|
+
const templatePath = path.join(__dirname, "./template.ejs");
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* receive srcPath
|
|
28
|
+
* not create data for ProcessLogical Main template
|
|
29
|
+
*
|
|
30
|
+
* @param {Object} srcPath
|
|
31
|
+
* @return {{ templatePath, templateData, setting } }
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
function data(_izContext, srcPath) {
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
templatePath: templatePath,
|
|
38
|
+
templateData: {},
|
|
39
|
+
setting: {
|
|
40
|
+
savePath: path.join(srcPath, SOURCE_PATH.processLogical),
|
|
41
|
+
saveFileName: `${upperCase(FUNCTION_NAME.paginateProcessLogical)}_Main`,
|
|
42
|
+
fileExtension: '.js',
|
|
43
|
+
isAppend: false
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
module.exports = data;
|
|
@@ -0,0 +1,212 @@
|
|
|
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 izaraShared = require('@izara_project/izara-shared');
|
|
21
|
+
const dynamodbSharedLib = izaraShared.dynamodbSharedLib;
|
|
22
|
+
const logicalResultsSharedLib = izaraShared.logicalResultsSharedLib;
|
|
23
|
+
const asyncFlowSharedLib = izaraShared.asyncFlowSharedLib;
|
|
24
|
+
const sqsSharedLib = izaraShared.sqsSharedLib;
|
|
25
|
+
|
|
26
|
+
const sqs = require('@izara_project/izara-core-library-external-request').sqs;
|
|
27
|
+
|
|
28
|
+
const NoRetryError = require('@izara_project/izara-core-library-core').NoRetryError;
|
|
29
|
+
|
|
30
|
+
// set query limit
|
|
31
|
+
const limit = 2;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* performs the logical operation/filter/search in the element, saves into LogicalResultsData table
|
|
35
|
+
* @param {Object} _izContext
|
|
36
|
+
* @param {string} logicalResultId
|
|
37
|
+
* @param {string} tableName
|
|
38
|
+
* @param {string} partitionKeyFieldName
|
|
39
|
+
* @param {string} sortKeyFieldName
|
|
40
|
+
* @param {string} comparison
|
|
41
|
+
* @param {Object} startKey
|
|
42
|
+
* @param {string} overwriteUniqueRequestId
|
|
43
|
+
* @param {string} callingFlow
|
|
44
|
+
*
|
|
45
|
+
* @returns {string} description of return value
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
module.exports.paginateProcessLogical = async (
|
|
49
|
+
_izContext,
|
|
50
|
+
logicalResultId,
|
|
51
|
+
tableName,
|
|
52
|
+
partitionKeyFieldName,
|
|
53
|
+
sortKeyFieldName,
|
|
54
|
+
comparison, // optional
|
|
55
|
+
startKey, // optional
|
|
56
|
+
overwriteUniqueRequestId, // optional
|
|
57
|
+
callingFlow // optional
|
|
58
|
+
) => {
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
|
|
62
|
+
_izContext.logger.debug('----- PaginateProcessLogical event params -----', {
|
|
63
|
+
logicalResultId: logicalResultId,
|
|
64
|
+
tableName: tableName,
|
|
65
|
+
partitionKeyFieldName: partitionKeyFieldName,
|
|
66
|
+
sortKeyFieldName: sortKeyFieldName,
|
|
67
|
+
comparison: comparison,
|
|
68
|
+
startKey: startKey,
|
|
69
|
+
overwriteUniqueRequestId: overwriteUniqueRequestId,
|
|
70
|
+
callingFlow: callingFlow
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// Check/Create logicalResultsMain
|
|
74
|
+
let [checkUniqueRequestProcessingStatus, logicalResultsMain] = await asyncFlowSharedLib.checkUniqueRequestProcessing(
|
|
75
|
+
_izContext,
|
|
76
|
+
"LogicalResultsMain",
|
|
77
|
+
{
|
|
78
|
+
logicalResultId: logicalResultId
|
|
79
|
+
},
|
|
80
|
+
"paginateProcessLogical",
|
|
81
|
+
overwriteUniqueRequestId
|
|
82
|
+
);
|
|
83
|
+
_izContext.logger.debug("After check uniqueRequestProcessingStatus:", {
|
|
84
|
+
checkUniqueRequestProcessingStatus: checkUniqueRequestProcessingStatus,
|
|
85
|
+
logicalResultsMain: logicalResultsMain
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
if (checkUniqueRequestProcessingStatus == "stop") {
|
|
89
|
+
return;
|
|
90
|
+
} else if (checkUniqueRequestProcessingStatus == "recordNotFound") {
|
|
91
|
+
// should always have unless another request already completed it, in which case nothing to do
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
let errorsFound = [];
|
|
96
|
+
let standardErrorParams = [
|
|
97
|
+
_izContext,
|
|
98
|
+
logicalResultId,
|
|
99
|
+
logicalResultsMain.logicalElement,
|
|
100
|
+
logicalResultsMain.objType,
|
|
101
|
+
"error"
|
|
102
|
+
];
|
|
103
|
+
|
|
104
|
+
const partitionKeyValue = logicalResultsMain.logicalElement.partitionKey;
|
|
105
|
+
let queryElements = {
|
|
106
|
+
limit: limit
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
//if received startKey validate it, if not received will return null
|
|
110
|
+
startKey = asyncFlowSharedLib.validateStartKeyParam(
|
|
111
|
+
_izContext,
|
|
112
|
+
startKey,
|
|
113
|
+
partitionKeyFieldName,
|
|
114
|
+
sortKeyFieldName
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
if (startKey === false) {
|
|
118
|
+
throw new NoRetryError("split processing received invalid startKey");
|
|
119
|
+
}
|
|
120
|
+
_izContext.logger.debug("startKey :", startKey);
|
|
121
|
+
|
|
122
|
+
if (startKey) {
|
|
123
|
+
queryElements["exclusiveStartKey"] = {
|
|
124
|
+
[partitionKeyFieldName]: startKey[partitionKeyFieldName],
|
|
125
|
+
[sortKeyFieldName]: startKey[sortKeyFieldName]
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
if (comparison) {
|
|
131
|
+
const sortKeyValue = logicalResultsMain.logicalElement.sortKey;
|
|
132
|
+
|
|
133
|
+
queryElements["sortKeyCondition"] = {
|
|
134
|
+
comparison: comparison,
|
|
135
|
+
name: sortKeyFieldName,
|
|
136
|
+
value: sortKeyValue
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
let queryDatas = await dynamodbSharedLib.query(
|
|
141
|
+
_izContext,
|
|
142
|
+
await dynamodbSharedLib.tableName(_izContext, tableName),
|
|
143
|
+
{
|
|
144
|
+
[partitionKeyFieldName]: partitionKeyValue
|
|
145
|
+
},
|
|
146
|
+
queryElements
|
|
147
|
+
)
|
|
148
|
+
_izContext.logger.debug("queryDatas result: ", queryDatas)
|
|
149
|
+
|
|
150
|
+
if (!startKey && queryDatas.Items.length == 0) {
|
|
151
|
+
_izContext.logger.debug(`can't find data in table ${tableName} by query`)
|
|
152
|
+
errorsFound.push(`can't find data in table ${tableName} by query`)
|
|
153
|
+
standardErrorParams.push(errorsFound)
|
|
154
|
+
await logicalResultsSharedLib.completeLogicalResultsMain(...standardErrorParams);
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
for (const objInstanceBase of queryDatas.Items) {
|
|
159
|
+
|
|
160
|
+
await logicalResultsSharedLib.saveLogicalData(
|
|
161
|
+
_izContext,
|
|
162
|
+
logicalResultId,
|
|
163
|
+
logicalResultsMain.objType,
|
|
164
|
+
objInstanceBase
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
if (queryDatas.hasOwnProperty("LastEvaluatedKey")) {
|
|
169
|
+
|
|
170
|
+
if (!overwriteUniqueRequestId) {
|
|
171
|
+
overwriteUniqueRequestId = _izContext.uniqueRequestId
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
let continuePaginationMsg = {
|
|
175
|
+
MessageBody: JSON.stringify({
|
|
176
|
+
logicalResultId: logicalResultId,
|
|
177
|
+
tableName: tableName,
|
|
178
|
+
partitionKeyFieldName: partitionKeyFieldName,
|
|
179
|
+
sortKeyFieldName: sortKeyFieldName,
|
|
180
|
+
comparison: comparison,
|
|
181
|
+
overwriteUniqueRequestId: overwriteUniqueRequestId,
|
|
182
|
+
startKey: queryDatas.LastEvaluatedKey,
|
|
183
|
+
callingFlow: callingFlow
|
|
184
|
+
}),
|
|
185
|
+
QueueUrl: await sqsSharedLib.sqsQueueUrl(_izContext, "PaginateProcessLogicalHdrDsq"),
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
_izContext.logger.debug("continuePaginationMessage: ", continuePaginationMsg);
|
|
189
|
+
await sqs.sendMessage(_izContext, continuePaginationMsg).promise();
|
|
190
|
+
|
|
191
|
+
return "Continue PaginateProcessLogical"
|
|
192
|
+
|
|
193
|
+
} else {
|
|
194
|
+
|
|
195
|
+
await logicalResultsSharedLib.completeLogicalResultsMain(
|
|
196
|
+
_izContext,
|
|
197
|
+
logicalResultId,
|
|
198
|
+
logicalResultsMain.logicalElement,
|
|
199
|
+
logicalResultsMain.objType,
|
|
200
|
+
"complete",
|
|
201
|
+
[],
|
|
202
|
+
callingFlow
|
|
203
|
+
)
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
return "Function PaginateProcessLogical is Finished"
|
|
207
|
+
|
|
208
|
+
} catch (err) {
|
|
209
|
+
_izContext.logger.error('error PaginateProcessLogicalMain: ', err);
|
|
210
|
+
throw (err)
|
|
211
|
+
}
|
|
212
|
+
}
|
|
@@ -40,7 +40,7 @@ module.exports.createSourceDataObjectSchema = (_izContext, objectSchema, saveFil
|
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
const dynamoDbMainYamlDataList = dynamoDbMainYaml.dynamoDbMainYamlFromObjectSchema.templateDataFunction(_izContext, objectSchema);
|
|
43
|
-
console.log("dynamoDbMainYamlDataList: ", dynamoDbMainYamlDataList);
|
|
43
|
+
// console.log("dynamoDbMainYamlDataList: ", dynamoDbMainYamlDataList);
|
|
44
44
|
|
|
45
45
|
for (let dynamoDbMainYamlData of dynamoDbMainYamlDataList) {
|
|
46
46
|
// create iam role of handler here
|
|
@@ -57,7 +57,7 @@ module.exports.createSourceDataObjectSchema = (_izContext, objectSchema, saveFil
|
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
console.log("resultsForCreateSource: ", resultsForCreateSource);
|
|
60
|
+
// console.log("resultsForCreateSource: ", resultsForCreateSource);
|
|
61
61
|
|
|
62
62
|
return resultsForCreateSource;
|
|
63
63
|
}
|
|
@@ -30,7 +30,7 @@ const STORAGE_TYPES = {
|
|
|
30
30
|
graph: "graph"
|
|
31
31
|
}
|
|
32
32
|
const templatePath = path.join(__dirname, './template.ejs')
|
|
33
|
-
const { SOURCE_PATH } = require('../../libs/Consts');
|
|
33
|
+
const { SOURCE_PATH, SAVE_FILE_NAME } = require('../../libs/Consts');
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* create param of crateSouce for FindData And processLogical
|
|
@@ -39,7 +39,7 @@ const { SOURCE_PATH } = require('../../libs/Consts');
|
|
|
39
39
|
* @param {String} srcPath
|
|
40
40
|
* @returns {Object[]}
|
|
41
41
|
*/
|
|
42
|
-
|
|
42
|
+
const createAwaitingMultipleStepDynamoDbData = (_izContext, srcPath) => {
|
|
43
43
|
|
|
44
44
|
let resultsForCreateSource = [];
|
|
45
45
|
|
|
@@ -76,8 +76,6 @@ module.exports.createAwaitingMultipleStepDynamoDbData = (_izContext, srcPath) =>
|
|
|
76
76
|
}
|
|
77
77
|
];
|
|
78
78
|
|
|
79
|
-
// console.log("defaultlDynamoDataList: ", (awaitingStepDynamoDbDataList));
|
|
80
|
-
|
|
81
79
|
for (let defaultlDynamoData of awaitingStepDynamoDbDataList) {
|
|
82
80
|
resultsForCreateSource.push({
|
|
83
81
|
templatePath: templatePath,
|
|
@@ -85,14 +83,13 @@ module.exports.createAwaitingMultipleStepDynamoDbData = (_izContext, srcPath) =>
|
|
|
85
83
|
setting: {
|
|
86
84
|
initialData: 'Resources:\n',
|
|
87
85
|
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
88
|
-
saveFileName:
|
|
86
|
+
saveFileName: SAVE_FILE_NAME.dynamoDbYaml,
|
|
89
87
|
fileExtension: '.yml',
|
|
90
88
|
isAppend: true
|
|
91
89
|
}
|
|
92
90
|
});
|
|
93
91
|
}
|
|
94
|
-
|
|
95
|
-
// console.log("resultForCreateDefaultDynamoDb: ", (resultsForCreateSource));
|
|
96
|
-
|
|
97
92
|
return resultsForCreateSource;
|
|
98
93
|
}
|
|
94
|
+
|
|
95
|
+
module.exports = createAwaitingMultipleStepDynamoDbData
|
|
@@ -31,7 +31,7 @@ const STORAGE_TYPES = {
|
|
|
31
31
|
graph: "graph"
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
const { SOURCE_PATH } = require('../../libs/Consts')
|
|
34
|
+
const { SOURCE_PATH, SAVE_FILE_NAME } = require('../../libs/Consts')
|
|
35
35
|
const templatePath = path.join(__dirname, './template.ejs')
|
|
36
36
|
|
|
37
37
|
// ---------- End Per Lambda Handler IamRole Data ----------
|
|
@@ -85,7 +85,6 @@ function dataForMainDynamoDbYamlFromObjectSchema(_izContext, objectSchema, srcPa
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
// console.log("identifierDetail :", identifierDetail)
|
|
89
88
|
if (!identifierDetail.hasOwnProperty("partitionKey")) {
|
|
90
89
|
return []
|
|
91
90
|
}
|
|
@@ -123,51 +122,30 @@ function dataForMainDynamoDbYamlFromObjectSchema(_izContext, objectSchema, srcPa
|
|
|
123
122
|
return dynamoDbYamlTempleteData
|
|
124
123
|
}
|
|
125
124
|
|
|
126
|
-
|
|
127
|
-
// data for MainDynamo from RelSchema
|
|
128
|
-
// function dataForMainDynamoDbYamlFromRelSchema(_izContext, relSchema) {
|
|
129
|
-
// let relTag = Object.keys(relSchema)[0];
|
|
130
|
-
// let relData = relSchema[relTag];
|
|
131
|
-
|
|
132
|
-
// for (let parents of relData.parents) {
|
|
133
|
-
// let parentObjectType = parent.objType.objectType;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
// }
|
|
137
|
-
|
|
138
|
-
// return
|
|
139
|
-
// }
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
module.exports.createSourceDataDynamoDB = (_izContext, objectSchema, srcPath) => {
|
|
125
|
+
const createSourceDataDynamoDB = (_izContext, objectSchema, srcPath) => {
|
|
143
126
|
|
|
144
127
|
let resultsForCreateSource = [];
|
|
145
128
|
|
|
146
129
|
|
|
147
130
|
const dynamoDbMainYamlDataList = dataForMainDynamoDbYamlFromObjectSchema(_izContext, objectSchema, srcPath)
|
|
148
|
-
// console.log("dynamoDbMainYamlDataList: ", dynamoDbMainYamlDataList);
|
|
149
131
|
|
|
150
132
|
for (let dynamoDbMainYamlData of dynamoDbMainYamlDataList) {
|
|
151
|
-
// create iam role of handler here
|
|
152
133
|
resultsForCreateSource.push({
|
|
153
134
|
templatePath: templatePath,
|
|
154
135
|
templateData: dynamoDbMainYamlData,
|
|
155
136
|
setting: {
|
|
156
137
|
initialData: 'Resources:\n',
|
|
157
138
|
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
158
|
-
saveFileName:
|
|
139
|
+
saveFileName: SAVE_FILE_NAME.dynamoDbYaml,
|
|
159
140
|
fileExtension: '.yml',
|
|
160
141
|
isAppend: true
|
|
161
142
|
}
|
|
162
143
|
});
|
|
163
144
|
}
|
|
164
145
|
|
|
165
|
-
// console.log("resultsForCreateSource: ", resultsForCreateSource);
|
|
166
146
|
|
|
167
147
|
return resultsForCreateSource;
|
|
168
148
|
}
|
|
169
149
|
|
|
170
|
-
// module.exports.createSourceDataRelSchema = (_izContext, relSchema, saveFilePath) => {
|
|
171
150
|
|
|
172
|
-
|
|
173
|
-
// }
|
|
151
|
+
module.exports = createSourceDataDynamoDB
|
|
@@ -30,7 +30,7 @@ const STORAGE_TYPES = {
|
|
|
30
30
|
graph: "graph"
|
|
31
31
|
}
|
|
32
32
|
const templatePath = path.join(__dirname, './template.ejs')
|
|
33
|
-
const { SOURCE_PATH } = require('../../libs/Consts');
|
|
33
|
+
const { SOURCE_PATH, SAVE_FILE_NAME } = require('../../libs/Consts');
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* create param of crateSouce for FindData And processLogical
|
|
@@ -39,13 +39,13 @@ const { SOURCE_PATH } = require('../../libs/Consts');
|
|
|
39
39
|
* @param {String} srcPath
|
|
40
40
|
* @returns {Object[]}
|
|
41
41
|
*/
|
|
42
|
-
|
|
42
|
+
const createDefaultSourceDataDynamoDB = (_izContext, srcPath) => {
|
|
43
43
|
|
|
44
44
|
let resultsForCreateSource = [];
|
|
45
45
|
|
|
46
46
|
const defaultDynamoDataList = [
|
|
47
47
|
{
|
|
48
|
-
"tableName": "
|
|
48
|
+
"tableName": "FindDataMain",
|
|
49
49
|
"attributes": [
|
|
50
50
|
{
|
|
51
51
|
"keyType": "partitionKey",
|
|
@@ -74,15 +74,13 @@ module.exports.createDefaultSourceDataDynamoDB = (_izContext, srcPath) => {
|
|
|
74
74
|
},
|
|
75
75
|
{
|
|
76
76
|
"keyType": "sortKey",
|
|
77
|
-
"AttributeName": "
|
|
77
|
+
"AttributeName": "identifiersId",
|
|
78
78
|
"AttributeType": "S"
|
|
79
79
|
}
|
|
80
80
|
]
|
|
81
81
|
}
|
|
82
82
|
];
|
|
83
83
|
|
|
84
|
-
// console.log("defaultlDynamoDataList: ", (defaultDynamoDataList));
|
|
85
|
-
|
|
86
84
|
for (let defaultlDynamoData of defaultDynamoDataList) {
|
|
87
85
|
resultsForCreateSource.push({
|
|
88
86
|
templatePath: templatePath,
|
|
@@ -90,14 +88,12 @@ module.exports.createDefaultSourceDataDynamoDB = (_izContext, srcPath) => {
|
|
|
90
88
|
setting: {
|
|
91
89
|
initialData: 'Resources:\n',
|
|
92
90
|
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
93
|
-
saveFileName:
|
|
91
|
+
saveFileName: SAVE_FILE_NAME.dynamoDbYaml,
|
|
94
92
|
fileExtension: '.yml',
|
|
95
93
|
isAppend: true
|
|
96
94
|
}
|
|
97
95
|
});
|
|
98
96
|
}
|
|
99
|
-
|
|
100
|
-
// console.log("resultForCreateDefaultDynamoDb: ", (resultsForCreateSource));
|
|
101
|
-
|
|
102
97
|
return resultsForCreateSource;
|
|
103
98
|
}
|
|
99
|
+
module.exports = createDefaultSourceDataDynamoDB
|