@izara_project/izara-market-library-service-schemas 1.0.5 → 1.0.7
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 +12 -3
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +232 -7
- 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 +10 -2
- package/src/TemplateManager/src/CreateRelationship/createRelationship/functionYaml/HdrDsq/data.js +5 -4
- package/src/TemplateManager/src/CreateRelationship/createRelationship/functionYaml/HdrInv/data.js +11 -1
- package/src/TemplateManager/src/CreateRelationship/createRelationship/functionYaml/HdrSqs/data.js +4 -3
- package/src/TemplateManager/src/CreateRelationship/createRelationship/mainFunction/template.ejs +24 -22
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrDsq/data.js +0 -1
- package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrSqs/data.js +1 -1
- package/src/TemplateManager/src/CreateRelationship/createRelationship/sns-in-sqs/data.js +0 -2
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/functionYaml/data.js +2 -2
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/handler/HdrSqs/data.js +0 -1
- package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/sns-out/data.js +1 -1
- 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 +158 -0
- package/src/TemplateManager/src/GenerateCode(Old).js +1 -1
- package/src/TemplateManager/src/GenerateCode.js +163 -42
- 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 +59 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/handler/template.ejs +129 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/mainFunction/createObjectComplete_main.js +172 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/mainFunction/data.js +53 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/mainFunction/template.ejs +172 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/sns-in-sqs/data.js +58 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/sns-in-sqs/template.ejs +47 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/sns-out/data.js +62 -0
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/sns-out/template.ejs +10 -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/PerActionEndpoint/FunctionYaml/HdrApi/data.js +22 -3
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrApi/template.ejs +2 -2
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrDsq/data.js +24 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrInv/data.js +53 -2
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrSqs/data.js +25 -3
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrApi/data.js +5 -8
- 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 -23
- 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 +69 -21
- 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 -17
- 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 +575 -0
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Get/data.js +0 -6
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Get/template.ejs +17 -12
- 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 +429 -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/processLogicalAndFindData.js +2 -2
- package/src/TemplateManager/src/ResourceYaml/sns-in-sqs/defaultSnsInSqsForFindDataAndProcessLogical.js +27 -12
- package/src/TemplateManager/src/ResourceYaml/sns-out/data.js +1 -1
- 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/TranslateIdReq/ProcessingTranslateIds/functionYaml/template.ejs +30 -0
- 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 +2 -2
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/sns-out/data.js +1 -1
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrApi/data.js +10 -3
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrDsq/data.js +6 -4
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrInv/data.js +11 -1
- package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrSqs/data.js +7 -5
- package/src/TemplateManager/src/externalService/LambdaRole/data.js +150 -32
- package/src/TemplateManager/src/externalService/LambdaRole/template.ejs +16 -15
- package/src/TemplateManager/src/externalService/SnsTopicSubscriotions/data.js +35 -6
- package/src/TemplateManager/src/externalService/SnsTopicSubscriotions/template.ejs +3 -4
- package/src/TemplateManager/src/libs/Consts.js +122 -11
- package/src/TemplateManager/src/PerActionEndpoint/Handler/testRequest.json +0 -5
|
@@ -0,0 +1,155 @@
|
|
|
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 configSharedLib = izaraShared.configSharedLib;
|
|
22
|
+
const dynamodbSharedLib = izaraShared.dynamodbSharedLib;
|
|
23
|
+
const lambdaSharedLib = izaraShared.lambdaSharedLib;
|
|
24
|
+
const graphSharedLib = izaraShared.graphSharedLib;
|
|
25
|
+
const sqsSharedLib = izaraShared.sqsSharedLib;
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
const externalRequest = require('@izara_project/izara-core-library-external-request')
|
|
29
|
+
const translateIdsSharedLib = require('@izara_project/izara-translateids/src/TranslateIdsLib');
|
|
30
|
+
const NoRetryError = require('@izara_project/izara-core-library-core/src/NoRetryError');
|
|
31
|
+
const lambda = require('@izara_project/izara-core-library-external-request/src/resources/Lambda');
|
|
32
|
+
const serviceSchemas = require("@izara_project/izara-core-library-service-schemas");
|
|
33
|
+
const identifiersObject = require('@izara_project/izara-core-library-service-schemas/src/IdentifiersObject');
|
|
34
|
+
const getObjectSchema = require("@izara_project/izara-core-library-service-schemas/src/GetObjectSchema");
|
|
35
|
+
const sqs = externalRequest.sqs
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* translate ids from one object to another related object
|
|
40
|
+
* @param {Object} _izContext
|
|
41
|
+
* @param {object} fromObjType - the type of object we are translating ids from
|
|
42
|
+
* @param {string} concatinateIdentifier
|
|
43
|
+
* @param {string} fromTypeId - the type of object we are translating ids from
|
|
44
|
+
* @param {string} fromTable - table name
|
|
45
|
+
* @param {string} fromPartitionKeyId - partition key value
|
|
46
|
+
* @param {string} fromPartitionKeyFieldName - partition key field/attribute name
|
|
47
|
+
* @param {string} fromDataFieldName - data field/attribute name
|
|
48
|
+
* @param {object} toObjType - the type of object we are translating ids to
|
|
49
|
+
* @param {string} toTypeId - the type of object we are translating ids to
|
|
50
|
+
* @param {Object} [additionalData={}] - additional data to send back in completed message
|
|
51
|
+
* @param {Object} [startKey={}] - first invoke will be empty
|
|
52
|
+
* @param {Nummic} invocationCount
|
|
53
|
+
* @param {string[]} passOnStatus
|
|
54
|
+
* @param {string[]} passOnErrorsFound
|
|
55
|
+
* @param {string} callingFlow
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
module.exports.translateIdsRequest = async (
|
|
59
|
+
_izContext,
|
|
60
|
+
fromObjType,
|
|
61
|
+
fromTypeId,
|
|
62
|
+
concatinateIdentifier,
|
|
63
|
+
fromTable,
|
|
64
|
+
fromPartitionKeyId,
|
|
65
|
+
fromPartitionKeyFieldName,
|
|
66
|
+
fromDataFieldName,
|
|
67
|
+
toObjType,
|
|
68
|
+
toTypeId,
|
|
69
|
+
relType,
|
|
70
|
+
// startKey ,
|
|
71
|
+
// invocationCount,
|
|
72
|
+
// passOnStatus,
|
|
73
|
+
// passOnErrorsFound,
|
|
74
|
+
callingFlow = "",
|
|
75
|
+
) => {
|
|
76
|
+
// translateIds request to change from propertyIds to mediaLinkIds.
|
|
77
|
+
// MediaLinkProperty: filter dataId is propertyIds
|
|
78
|
+
// MediaLinkPropertyTranslation: filter dataId is propertyIds
|
|
79
|
+
// translate 2 time , propertyIds from MediaLinkProperty and propertyIds from MediaLinkPropertyTranslation
|
|
80
|
+
try {
|
|
81
|
+
_izContext.logger.debug("=== Function:TranslateIdsRequest ===", {
|
|
82
|
+
fromObjType: fromObjType,
|
|
83
|
+
fromTypeId: fromTypeId,
|
|
84
|
+
concatinateIdentifier: concatinateIdentifier,
|
|
85
|
+
fromTable: fromTable,
|
|
86
|
+
fromPartitionKeyId: fromPartitionKeyId,
|
|
87
|
+
fromPartitionKeyFieldName: fromPartitionKeyFieldName,
|
|
88
|
+
fromDataFieldName: fromDataFieldName,
|
|
89
|
+
toObjType: toObjType,
|
|
90
|
+
toTypeId: toTypeId,
|
|
91
|
+
relType: relType,
|
|
92
|
+
|
|
93
|
+
callingFlow: callingFlow
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
/*
|
|
97
|
+
receive params
|
|
98
|
+
check main cache for all param that send in
|
|
99
|
+
use concatinateIdentifier to check cache
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
//check cache per filterMain
|
|
103
|
+
let [translateIdsCacheMainStatus, translateIdsCacheId, translateIdsCacheMain] = await translateIdsSharedLib.translateIdsCheckCacheMain(
|
|
104
|
+
_izContext,
|
|
105
|
+
fromObjType,
|
|
106
|
+
concatinateIdentifier,
|
|
107
|
+
fromTable,
|
|
108
|
+
fromPartitionKeyId,
|
|
109
|
+
fromPartitionKeyFieldName,
|
|
110
|
+
fromDataFieldName,
|
|
111
|
+
toObjType,
|
|
112
|
+
relType,
|
|
113
|
+
callingFlow
|
|
114
|
+
);
|
|
115
|
+
_izContext.logger.debug("After translateIdsCheckCache main status:", {
|
|
116
|
+
translateIdsCacheMainStatus: translateIdsCacheMainStatus,
|
|
117
|
+
translateIdsCacheId: translateIdsCacheId,
|
|
118
|
+
translateIdsCacheMain: translateIdsCacheMain
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
if (translateIdsCacheMainStatus !== "process") {
|
|
122
|
+
return;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
let sendMessageToProcessingTranslateIdsHdrDsq = {
|
|
126
|
+
MessageBody: JSON.stringify({
|
|
127
|
+
fromObjType: fromObjType,
|
|
128
|
+
fromTypeId: fromTypeId,
|
|
129
|
+
concatinateIdentifier: concatinateIdentifier,
|
|
130
|
+
fromTable: fromTable,
|
|
131
|
+
fromPartitionKeyId: fromPartitionKeyId,
|
|
132
|
+
fromPartitionKeyFieldName: fromPartitionKeyFieldName,
|
|
133
|
+
fromDataFieldName: fromDataFieldName,
|
|
134
|
+
toObjType: toObjType,
|
|
135
|
+
toTypeId: toTypeId,
|
|
136
|
+
relType: relType,
|
|
137
|
+
invocationCount: 1,
|
|
138
|
+
translateIdsCacheId: translateIdsCacheId,
|
|
139
|
+
uniqueRequestId: translateIdsCacheMain.cacheUniqueRequestId,
|
|
140
|
+
callingFlow: callingFlow,
|
|
141
|
+
}),
|
|
142
|
+
QueueUrl: await sqsSharedLib.sqsQueueUrl(_izContext, "ProcessTranslateIdsHdrDsq")
|
|
143
|
+
}
|
|
144
|
+
await sqs.sendMessage(_izContext, sendMessageToProcessingTranslateIdsHdrDsq).promise();
|
|
145
|
+
|
|
146
|
+
_izContext.logger.debug("sendMessageToProcessingTranslateIdsHdrDsq", sendMessageToProcessingTranslateIdsHdrDsq)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
return "success"
|
|
150
|
+
|
|
151
|
+
} catch (err) {
|
|
152
|
+
_izContext.logger.error('error TranslateIdsRequest: ', err)
|
|
153
|
+
throw (err)
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
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
|
+
|
|
23
|
+
// const {
|
|
24
|
+
// HANDLER,
|
|
25
|
+
// STORAGE_TYPES
|
|
26
|
+
// } = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
27
|
+
|
|
28
|
+
const STORAGE_TYPES = {
|
|
29
|
+
dynamoDB: "dynamoDB",
|
|
30
|
+
graph: "graph"
|
|
31
|
+
}
|
|
32
|
+
const templatePath = path.join(__dirname, '../../../../ResourceYaml/dynamodb/template.ejs')
|
|
33
|
+
const { SOURCE_PATH, SAVE_FILE_NAME } = require('../../../../libs/Consts');
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* create param of crateSouce for FindData And processLogical
|
|
37
|
+
*
|
|
38
|
+
* @param {Object} _izContext
|
|
39
|
+
* @param {String} srcPath
|
|
40
|
+
* @returns {Object[]}
|
|
41
|
+
*/
|
|
42
|
+
const createAwaitingMultipleStepDynamoDbData = (_izContext, srcPath) => {
|
|
43
|
+
|
|
44
|
+
let resultsForCreateSource = [];
|
|
45
|
+
|
|
46
|
+
const TranslateIdsTables =
|
|
47
|
+
[
|
|
48
|
+
{
|
|
49
|
+
tableName: "TranslateIdsCacheMain",
|
|
50
|
+
attributes:
|
|
51
|
+
[
|
|
52
|
+
{
|
|
53
|
+
keyType: "partitionKey",
|
|
54
|
+
AttributeName: "translateIdsCacheId",
|
|
55
|
+
AttributeType: "S"
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
tableName: "TranslateIdsCacheFromIdMain",
|
|
61
|
+
attributes:
|
|
62
|
+
[
|
|
63
|
+
{
|
|
64
|
+
keyType: "partitionKey",
|
|
65
|
+
AttributeName: "translateIdsCacheFromId",
|
|
66
|
+
AttributeType: "S"
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
tableName: "TranslateIdsCacheFromIdData",
|
|
72
|
+
attributes:
|
|
73
|
+
[
|
|
74
|
+
{
|
|
75
|
+
keyType: "partitionKey",
|
|
76
|
+
AttributeName: "translateIdsCacheFromId",
|
|
77
|
+
AttributeType: "S"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
keyType: "sortKey",
|
|
81
|
+
AttributeName: "toDataId",
|
|
82
|
+
AttributeType: "S"
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
tableName: "TranslateIdsCacheData",
|
|
88
|
+
attributes:
|
|
89
|
+
[
|
|
90
|
+
{
|
|
91
|
+
keyType: "partitionKey",
|
|
92
|
+
AttributeName: "translateIdsCacheId",
|
|
93
|
+
AttributeType: "S"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
keyType: "sortKey",
|
|
97
|
+
AttributeName: "toDataId",
|
|
98
|
+
AttributeType: "S"
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
];
|
|
103
|
+
|
|
104
|
+
for (let TranslateIdsTable of TranslateIdsTables) {
|
|
105
|
+
resultsForCreateSource.push({
|
|
106
|
+
templatePath: templatePath,
|
|
107
|
+
templateData: TranslateIdsTable,
|
|
108
|
+
setting: {
|
|
109
|
+
initialData: 'Resources:\n',
|
|
110
|
+
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
111
|
+
saveFileName: SAVE_FILE_NAME.dynamoDbYaml,
|
|
112
|
+
fileExtension: '.yml',
|
|
113
|
+
isAppend: true
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
return resultsForCreateSource;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
module.exports = createAwaitingMultipleStepDynamoDbData
|
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
|
|
23
|
+
const {
|
|
24
|
+
HANDLER,
|
|
25
|
+
} = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
26
|
+
|
|
27
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils")
|
|
28
|
+
const { DEFAULT_HANDLER_PER_ACTION, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME } = require("../../../../libs/Consts");
|
|
29
|
+
const snsTemplatePath = path.join(__dirname, "../../../../ResourceYaml/sns-in-sqs/snsTemplate.ejs")
|
|
30
|
+
const sqsTemplatePath = path.join(__dirname, "../../../../ResourceYaml/sns-in-sqs/sqsTemplate.ejs")
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* create data for sns and sqs template
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
function data(_izContext, srcPath) {
|
|
37
|
+
let resultForCreateTranslateIdsQueueName = [];
|
|
38
|
+
const setting = {
|
|
39
|
+
initialSetup: "Resources\n",
|
|
40
|
+
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
41
|
+
saveFileName: SAVE_FILE_NAME.snsInSqsYaml,
|
|
42
|
+
fileExtension: ".yml",
|
|
43
|
+
isAppend: true
|
|
44
|
+
}
|
|
45
|
+
const createTranslateIdsQueueNames = [
|
|
46
|
+
{
|
|
47
|
+
queueName: upperCase(FUNCTION_NAME.translateId)
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
queueName: upperCase(FUNCTION_NAME.translateId) + upperCase(HANDLER.hdrDsq)
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
for (let createTranslateIdsQueueName of createTranslateIdsQueueNames) {
|
|
54
|
+
if (createTranslateIdsQueueName.queueName.includes("HdrDsq")) {
|
|
55
|
+
resultForCreateTranslateIdsQueueName.push(
|
|
56
|
+
{
|
|
57
|
+
templatePath: sqsTemplatePath,
|
|
58
|
+
templateData: createTranslateIdsQueueName,
|
|
59
|
+
setting: setting
|
|
60
|
+
}
|
|
61
|
+
)
|
|
62
|
+
} else {
|
|
63
|
+
resultForCreateTranslateIdsQueueName.push(
|
|
64
|
+
{
|
|
65
|
+
templatePath: snsTemplatePath,
|
|
66
|
+
templateData: createTranslateIdsQueueName,
|
|
67
|
+
setting: setting
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return resultForCreateTranslateIdsQueueName
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
module.exports = data;
|
|
@@ -96,8 +96,8 @@ function createParamForCreateSource(srcPath) {
|
|
|
96
96
|
]
|
|
97
97
|
},
|
|
98
98
|
[
|
|
99
|
-
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName)
|
|
100
|
-
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName)
|
|
99
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName)),
|
|
100
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName)),
|
|
101
101
|
resourceNames(RESOURCE_CLASSES.sns, "In" + upperCase(functionName)),
|
|
102
102
|
resourceNames(RESOURCE_CLASSES.sns, "Out" + upperCase(functionName))
|
|
103
103
|
],
|
package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/sns-out/data.js
CHANGED
|
@@ -47,7 +47,7 @@ const templatePath = path.join(__dirname, '../../../ResourceYaml/sns-out/templat
|
|
|
47
47
|
|
|
48
48
|
function createDefaultSnsOut(_izContext, srcPath) {
|
|
49
49
|
const createSourceParams = createParamsForCreateSource(_izContext, srcPath)
|
|
50
|
-
console.log("createSourceParamUpdateRelationshipComplete", createSourceParams)
|
|
50
|
+
// console.log("createSourceParamUpdateRelationshipComplete", createSourceParams)
|
|
51
51
|
return [createSourceParams]
|
|
52
52
|
}
|
|
53
53
|
|
|
@@ -22,7 +22,7 @@ const fs = require('fs');
|
|
|
22
22
|
const { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
23
23
|
|
|
24
24
|
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils")
|
|
25
|
-
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME } = require("../../../../libs/Consts");
|
|
25
|
+
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, SNS_RESOURCE, DYNAMO_RESOURCE } = require("../../../../libs/Consts");
|
|
26
26
|
|
|
27
27
|
const templatePath = path.join(__dirname, "./template.ejs")
|
|
28
28
|
|
|
@@ -81,14 +81,21 @@ function createParamForCreateSource(srcPath) {
|
|
|
81
81
|
|
|
82
82
|
additionalResourcePermission.push(
|
|
83
83
|
createIamRole(
|
|
84
|
-
{ [RESOURCE_CLASSES.dynamoDbTable]: [
|
|
84
|
+
{ [RESOURCE_CLASSES.dynamoDbTable]: [DYNAMO_RESOURCE.putItem] },
|
|
85
85
|
[
|
|
86
86
|
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "AwaitingMultipleSteps"),
|
|
87
87
|
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "AwaitingMultipleStepByPending")
|
|
88
88
|
]
|
|
89
89
|
))
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
additionalResourcePermission.push(
|
|
92
|
+
createIamRole(
|
|
93
|
+
{ [RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish] },
|
|
94
|
+
[
|
|
95
|
+
resourceNames(RESOURCE_CLASSES.sns, "Out" + upperCase(FUNCTION_NAME.updateRelComplete))
|
|
96
|
+
]
|
|
97
|
+
)
|
|
98
|
+
)
|
|
92
99
|
return {
|
|
93
100
|
templatePath: templatePath,
|
|
94
101
|
templateData: {
|
|
@@ -22,7 +22,7 @@ const fs = require('fs');
|
|
|
22
22
|
const { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
23
23
|
|
|
24
24
|
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils")
|
|
25
|
-
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME } = require("../../../../libs/Consts");
|
|
25
|
+
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, DYNAMO_RESOURCE, SNS_RESOURCE } = require("../../../../libs/Consts");
|
|
26
26
|
|
|
27
27
|
const templatePath = path.join(__dirname, '../../../../PerActionEndpoint/FunctionYaml/HdrDsq/template.ejs')
|
|
28
28
|
|
|
@@ -89,18 +89,20 @@ function createParamForCreateSource(srcPath) {
|
|
|
89
89
|
SQS_RESOURCE.sendMessage,
|
|
90
90
|
SQS_RESOURCE.deleteMessageBatch,
|
|
91
91
|
SQS_RESOURCE.getQueueUrl
|
|
92
|
-
]
|
|
92
|
+
],
|
|
93
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
93
94
|
},
|
|
94
95
|
[
|
|
95
96
|
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq)),
|
|
96
|
-
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq) + "DLQ")
|
|
97
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrDsq) + "DLQ"),
|
|
98
|
+
resourceNames(RESOURCE_CLASSES.sns, "Out" + upperCase(FUNCTION_NAME.updateRelComplete))
|
|
97
99
|
]
|
|
98
100
|
)
|
|
99
101
|
)
|
|
100
102
|
|
|
101
103
|
additionalResourcePermission.push(
|
|
102
104
|
createIamRole(
|
|
103
|
-
{ [RESOURCE_CLASSES.dynamoDbTable]: [
|
|
105
|
+
{ [RESOURCE_CLASSES.dynamoDbTable]: [DYNAMO_RESOURCE.putItem] },
|
|
104
106
|
[
|
|
105
107
|
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "AwaitingMultipleSteps"),
|
|
106
108
|
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "AwaitingMultipleStepByPending")
|
|
@@ -22,7 +22,7 @@ const fs = require('fs');
|
|
|
22
22
|
const { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
23
23
|
|
|
24
24
|
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils")
|
|
25
|
-
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME } = require("../../../../libs/Consts");
|
|
25
|
+
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, SNS_RESOURCE } = require("../../../../libs/Consts");
|
|
26
26
|
|
|
27
27
|
const templatePath = path.join(__dirname, '../../../../PerActionEndpoint/FunctionYaml/HdrInv/template.ejs')
|
|
28
28
|
|
|
@@ -87,6 +87,16 @@ function createParamForCreateSource(srcPath) {
|
|
|
87
87
|
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "AwaitingMultipleStepByPending")
|
|
88
88
|
]
|
|
89
89
|
))
|
|
90
|
+
additionalResourcePermission.push(
|
|
91
|
+
createIamRole(
|
|
92
|
+
{
|
|
93
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
94
|
+
},
|
|
95
|
+
[
|
|
96
|
+
resourceNames(RESOURCE_CLASSES.sns, "Out" + upperCase(FUNCTION_NAME.updateRelComplete))
|
|
97
|
+
]
|
|
98
|
+
)
|
|
99
|
+
)
|
|
90
100
|
return {
|
|
91
101
|
templatePath: templatePath,
|
|
92
102
|
templateData: {
|
|
@@ -22,8 +22,8 @@ const fs = require('fs');
|
|
|
22
22
|
const { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
23
23
|
|
|
24
24
|
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils")
|
|
25
|
-
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME } = require("../../../../libs/Consts");
|
|
26
|
-
|
|
25
|
+
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, SNS_RESOURCE } = require("../../../../libs/Consts");
|
|
26
|
+
const { checkLocalRelationshipSchemas } = require('../../../../../../GenerateCodeLibs/src/GenerateCodeLibs')
|
|
27
27
|
const templatePath = path.join(__dirname, '../../../../PerActionEndpoint/FunctionYaml/HdrSqs/template.ejs')
|
|
28
28
|
|
|
29
29
|
function defaultIamRolePerAction() {
|
|
@@ -73,6 +73,7 @@ function data(_izContext, srcPath) {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
|
|
76
|
+
|
|
76
77
|
function createParamForCreateSource(srcPath) {
|
|
77
78
|
|
|
78
79
|
let handlerType = HANDLER.hdrSqs
|
|
@@ -89,14 +90,15 @@ function createParamForCreateSource(srcPath) {
|
|
|
89
90
|
SQS_RESOURCE.sendMessage,
|
|
90
91
|
SQS_RESOURCE.getQueueUrl,
|
|
91
92
|
SQS_RESOURCE.deleteMessageBatch
|
|
92
|
-
],
|
|
93
|
-
|
|
93
|
+
],
|
|
94
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
94
95
|
},
|
|
95
96
|
[
|
|
96
97
|
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
|
|
97
98
|
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs) + "DLQ"),
|
|
98
99
|
resourceNames(RESOURCE_CLASSES.sns, "In" + upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
|
|
99
|
-
resourceNames(RESOURCE_CLASSES.sns, "Out" + upperCase(functionName) + upperCase(HANDLER.hdrSqs))
|
|
100
|
+
resourceNames(RESOURCE_CLASSES.sns, "Out" + upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
|
|
101
|
+
resourceNames(RESOURCE_CLASSES.sns, "Out" + upperCase(FUNCTION_NAME.updateRelComplete))
|
|
100
102
|
]
|
|
101
103
|
),
|
|
102
104
|
)
|