@izara_project/izara-market-library-service-schemas 1.0.66 → 1.0.67
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 +3 -3
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +11 -1
- package/src/MainLibs/src/Consts.js +34 -1
- package/src/MainLibs/src/GenerateCodeUtils.js +6 -6
- package/src/reStructure/GenerateCode.js +2 -1
- package/src/reStructure/TemplateData/EndpointPerService/generateTemplateData.js +1 -1
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +19 -3
- package/src/reStructure/TemplateData/EndpointPerService/yaml/data.js +49 -5
- package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/data.js +3 -0
- package/src/reStructure/TemplateData/findData/findDataYaml/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/dynamoDb/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/flowStep/functionYaml/data.js +3 -3
- package/src/reStructure/TemplateData/flowSchema/flowStep/handler/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowStep/sns-in/data.js +4 -2
- package/src/reStructure/TemplateData/flowSchema/flowStep/sns-in/template.ejs +9 -9
- package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +24 -24
- package/src/reStructure/TemplateData/generateRole/data.js +38 -24
- package/src/reStructure/TemplateData/generateRole/template.ejs +5 -7
- package/src/reStructure/TemplateData/processLogical/yaml/data.js +2 -2
- package/src/reStructure/TemplateData/processLogicalPagination/yaml/dsq/data.js +1 -1
- package/src/reStructure/TemplateData/processLogicalPagination/yaml/sqs/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/data.js +26 -22
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/data.js +37 -29
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/data.js +36 -29
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/data.js +36 -29
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/functionYaml/data.js +37 -30
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/data.js +37 -27
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/mainResourcePerObjectSchemaData.js +8 -7
- package/src/reStructure/TemplateData/resourceYaml/filterGenerateResource/data.js +36 -30
- package/src/reStructure/TemplateData/resourceYaml/generateTemplateData.js +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@izara_project/izara-market-library-service-schemas",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.67",
|
|
4
4
|
"description": "Schemas for Izara Market project",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"@izara_project/izara-core-library-core": "^1.0.20",
|
|
25
25
|
"@izara_project/izara-core-library-external-request": "^1.0.20",
|
|
26
26
|
"@izara_project/izara-core-library-logger": "^1.0.7",
|
|
27
|
-
"@izara_project/izara-core-library-service-schemas": "^1.0.
|
|
27
|
+
"@izara_project/izara-core-library-service-schemas": "^1.0.95",
|
|
28
28
|
"@izara_project/izara-core-library-sns": "^1.0.6",
|
|
29
29
|
"@izara_project/izara-core-library-sqs": "^1.0.4",
|
|
30
30
|
"@izara_project/izara-shared": "^1.0.126",
|
|
31
|
-
"@izara_project/izara-shared-service-schemas": "^1.0.
|
|
31
|
+
"@izara_project/izara-shared-service-schemas": "^1.0.31",
|
|
32
32
|
"@izara_project/izara-shared-core": "^1.0.2",
|
|
33
33
|
"ejs": "^3.1.10",
|
|
34
34
|
"js-beautify": "^1.15.4",
|
|
@@ -889,7 +889,17 @@ async function createDataDetailsLib(_izContext, objectSchemas, settings = { buck
|
|
|
889
889
|
});
|
|
890
890
|
};
|
|
891
891
|
};
|
|
892
|
-
}
|
|
892
|
+
} else if (storageResources[eachStorageResourceTag].storageType === consts.STORAGE_TYPES.externalTopic) {
|
|
893
|
+
let topicName = storageResources[eachStorageResourceTag].serviceTag + storageResources[eachStorageResourceTag].stage + storageResources[eachStorageResourceTag].topicName
|
|
894
|
+
Object.assign(createDataDetails, {
|
|
895
|
+
[topicName]: {
|
|
896
|
+
storageType: consts.STORAGE_TYPES.externalTopic,
|
|
897
|
+
fieldNames: [keyFieldName],
|
|
898
|
+
accountId: storageResources[eachStorageResourceTag].accountId,
|
|
899
|
+
region: storageResources[eachStorageResourceTag].region,
|
|
900
|
+
}
|
|
901
|
+
});
|
|
902
|
+
}
|
|
893
903
|
};
|
|
894
904
|
}; // end loop storageResourceTags
|
|
895
905
|
}; // end loop
|
|
@@ -575,6 +575,38 @@ const FLOW_SCHEMA_EVENT_TYPE = {
|
|
|
575
575
|
eventBridge: "eventBridge",
|
|
576
576
|
}
|
|
577
577
|
|
|
578
|
+
async function getExternalTopicComponentFromAllObjectSchemas(_izContext, allObjSchemas) {
|
|
579
|
+
const externalTopicComponentSet = new Set();
|
|
580
|
+
for (const objectSchema of allObjSchemas) {
|
|
581
|
+
for (let storageResource of Object.values(objectSchema.storageResources)) {
|
|
582
|
+
|
|
583
|
+
if (storageResource.storageType === STORAGE_TYPES.externalTopic) {
|
|
584
|
+
let uniqueTag = hash({
|
|
585
|
+
accountId: storageResource.accountId,
|
|
586
|
+
region: storageResource.region,
|
|
587
|
+
serviceTag: storageResource.serviceTag,
|
|
588
|
+
stage: storageResource.stage
|
|
589
|
+
})
|
|
590
|
+
|
|
591
|
+
if (!externalTopicComponentSet.has(uniqueTag)) {
|
|
592
|
+
externalTopicComponentSet.add(
|
|
593
|
+
{
|
|
594
|
+
[uniqueTag]: {
|
|
595
|
+
accountId: storageResource.accountId,
|
|
596
|
+
region: storageResource.region,
|
|
597
|
+
serviceTag: storageResource.serviceTag,
|
|
598
|
+
stage: storageResource.stage
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
)
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
let externalTopicComponents = [...externalTopicComponentSet]
|
|
607
|
+
return externalTopicComponents
|
|
608
|
+
};
|
|
609
|
+
|
|
578
610
|
module.exports = {
|
|
579
611
|
STORAGE_TYPES,
|
|
580
612
|
ACTIONS,
|
|
@@ -610,5 +642,6 @@ module.exports = {
|
|
|
610
642
|
checkDynamoTypeRelationship,
|
|
611
643
|
createDynamoDbComponentByLinks,
|
|
612
644
|
getStorageResourceFromObjectSchemas,
|
|
613
|
-
FLOW_SCHEMA_EVENT_TYPE
|
|
645
|
+
FLOW_SCHEMA_EVENT_TYPE,
|
|
646
|
+
getExternalTopicComponentFromAllObjectSchemas
|
|
614
647
|
}
|
|
@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
18
18
|
'use strict';
|
|
19
19
|
|
|
20
20
|
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
21
|
-
|
|
21
|
+
const { firstLetterUpperCase: upperCase } = require('./Utils')
|
|
22
22
|
|
|
23
23
|
function checkValidTableYaml(_izContext, currentTableSetting, existsTableSetting) {
|
|
24
24
|
// console.log("checkValidTableYaml", JSON.stringify(currentTableSetting, null, 2), JSON.stringify(existsTableSetting, null, 2))
|
|
@@ -31,14 +31,14 @@ function checkValidTableYaml(_izContext, currentTableSetting, existsTableSetting
|
|
|
31
31
|
|
|
32
32
|
for (let i = 0, length = currentTableSetting.length; i < length; i++) {
|
|
33
33
|
let dynamoDbYamlSetting = currentTableSetting[i];
|
|
34
|
-
console.log("dynamoDbYamlSetting", dynamoDbYamlSetting)
|
|
35
|
-
if (existsTableSetting.hasOwnProperty(dynamoDbYamlSetting.templateData.tableName)) {
|
|
34
|
+
// console.log("dynamoDbYamlSetting", dynamoDbYamlSetting)
|
|
35
|
+
if (existsTableSetting.hasOwnProperty(upperCase(dynamoDbYamlSetting.templateData.tableName))) {
|
|
36
36
|
|
|
37
37
|
// exists table
|
|
38
|
-
if (hash(existsTableSetting[dynamoDbYamlSetting.templateData.tableName]) === hash(dynamoDbYamlSetting.templateData.attributes.sort())) {
|
|
38
|
+
if (hash(existsTableSetting[upperCase(dynamoDbYamlSetting.templateData.tableName)]) === hash(dynamoDbYamlSetting.templateData.attributes.sort())) {
|
|
39
39
|
continue;
|
|
40
40
|
} else {
|
|
41
|
-
throw Error(`tableName:${dynamoDbYamlSetting.templateData.tableName} have duplicate setting but not have same setting`)
|
|
41
|
+
throw Error(`tableName:${upperCase(dynamoDbYamlSetting.templateData.tableName)} have duplicate setting but not have same setting`)
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
} else {
|
|
@@ -48,7 +48,7 @@ function checkValidTableYaml(_izContext, currentTableSetting, existsTableSetting
|
|
|
48
48
|
Object.assign(
|
|
49
49
|
existsTableSetting,
|
|
50
50
|
{
|
|
51
|
-
[dynamoDbYamlSetting.templateData.tableName]: dynamoDbYamlSetting.templateData.attributes.sort()
|
|
51
|
+
[upperCase(dynamoDbYamlSetting.templateData.tableName)]: dynamoDbYamlSetting.templateData.attributes.sort()
|
|
52
52
|
}
|
|
53
53
|
);
|
|
54
54
|
}
|
|
@@ -84,7 +84,8 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath, settings = {}
|
|
|
84
84
|
const functionNameConfigs = functionNameConfigYamlData(_izContext, allCreateSource, saveFilePath);
|
|
85
85
|
allCreateSource.push(...functionNameConfigs);
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
let filterAllCreateSource = allCreateSource.filter((createSource) => createSource.templateData.hasOwnProperty("additionalResourcePermission") && createSource.templateData.hasOwnProperty("roleName"))
|
|
88
|
+
const generateRoleData = generateRole(_izContext, filterAllCreateSource, saveFilePath);
|
|
88
89
|
allCreateSource.push(...generateRoleData);
|
|
89
90
|
|
|
90
91
|
// ** create Generate-Shared-resource
|
|
@@ -60,7 +60,7 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
60
60
|
try {
|
|
61
61
|
const saveFilePath = join(objSchemaPath, `../`);
|
|
62
62
|
const allObjSchemas = await getAllLocalObjectSchemasWithHierarchy(_izContext, objSchemaPath);
|
|
63
|
-
|
|
63
|
+
console.log("allObjSchemas: ", allObjSchemas.records)
|
|
64
64
|
const createSourceParams = [];
|
|
65
65
|
|
|
66
66
|
for (const objectSchema of allObjSchemas.records) {
|
|
@@ -204,10 +204,10 @@ module.exports.createMain = async (
|
|
|
204
204
|
}
|
|
205
205
|
} else if (objectSchemas.fieldNames[identifier.fieldName].hasOwnProperty("optionalOnCreate")) {
|
|
206
206
|
if ((objectSchemas.fieldNames[identifier.fieldName].optionalOnCreate == true)) {
|
|
207
|
+
//(<createOptionalOnCreateIdentifiers>)
|
|
208
|
+
let optionalOnCreateIdentifiers
|
|
209
|
+
//(</createOptionalOnCreateIdentifiers>)
|
|
207
210
|
Object.assign(
|
|
208
|
-
//(<createOptionalOnCreateIdentifiers>)
|
|
209
|
-
let optionalOnCreateIdentifiers
|
|
210
|
-
//(</createOptionalOnCreateIdentifiers>)
|
|
211
211
|
requestParams.fieldNames, {
|
|
212
212
|
[identifier.fieldName]: hash(optionalOnCreateIdentifiers)
|
|
213
213
|
}
|
|
@@ -375,6 +375,22 @@ module.exports.createMain = async (
|
|
|
375
375
|
|
|
376
376
|
_izContext.logger.debug("FIRST", listOfObjectForCreates)
|
|
377
377
|
|
|
378
|
+
} else if (createDataDetail.storageType === consts.STORAGE_TYPES.externalTopic) {
|
|
379
|
+
_izContext.logger.debug("::::::externalTopic::::::", { storageTag, createDataDetail });
|
|
380
|
+
//(<beforeSendMessageToExternalTopic>)
|
|
381
|
+
//(</beforeSendMessageToExternalTopic>)
|
|
382
|
+
let messageObject = {
|
|
383
|
+
//(<messageObjectHook>)
|
|
384
|
+
//(</messageObjectHook>)
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
let sendToCreateExternalTopic = {
|
|
388
|
+
Message: JSON.stringify(messageObject),
|
|
389
|
+
TopicArn: `arn:aws:sns:${createDataDetail.region}:${createDataDetail.accountId}:${createDataDetail.serviceTag}_${createDataDetail.stage}_Create_In`
|
|
390
|
+
};
|
|
391
|
+
_izContext.logger.debug("Request params before send to create endpoint:", sendToCreateExternalTopic);
|
|
392
|
+
|
|
393
|
+
await sns.publishAsync(_izContext, sendToCreateExternalTopic)
|
|
378
394
|
}
|
|
379
395
|
};
|
|
380
396
|
_izContext.logger.debug("[1]listOfObjectForCreates:::", listOfObjectForCreates);
|
|
@@ -22,6 +22,7 @@ const fs = require('fs');
|
|
|
22
22
|
const yaml = require('yaml');
|
|
23
23
|
|
|
24
24
|
const { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
25
|
+
const hash = require('@izara_project/izara-shared-core').objectHash
|
|
25
26
|
const {
|
|
26
27
|
DEFAULT_HANDLER_PER_ACTION,
|
|
27
28
|
createIamRole,
|
|
@@ -82,7 +83,7 @@ async function createParamForCreateSource(_izContext, allObjSchemas, action, han
|
|
|
82
83
|
[RESOURCE_CLASSES.dynamoDbTable]: Object.values(DYNAMO_RESOURCE),
|
|
83
84
|
},
|
|
84
85
|
storageResourceAllLocalObjectSchemas.resourceDynamoTableName.map(tableName =>
|
|
85
|
-
resourceNames(RESOURCE_CLASSES.dynamoDbTable, tableName)
|
|
86
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, upperCase(tableName))
|
|
86
87
|
)
|
|
87
88
|
)
|
|
88
89
|
)
|
|
@@ -143,19 +144,44 @@ async function createParamForCreateSource(_izContext, allObjSchemas, action, han
|
|
|
143
144
|
const config = yaml.parse(serverlessConfig);
|
|
144
145
|
const ownServiceTag = config.main_config.iz_serviceTag;
|
|
145
146
|
let parentTables = [];
|
|
147
|
+
let externalTopicComponents = [];
|
|
146
148
|
// create lambdaRole for parent dynamo table if able
|
|
147
149
|
for (const objectSchema of allObjSchemas.records) {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
if (
|
|
150
|
+
for (const storageResource of Object.values(objectSchema.storageResources)) {
|
|
151
|
+
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
152
|
+
if (objectSchema.hasOwnProperty("extendObjType")) {
|
|
151
153
|
if (storageResource.serviceTag && storageResource.serviceTag !== ownServiceTag) {
|
|
152
|
-
parentTables.push({ tableName: storageResource.tableName, serviceTag: storageResource.serviceTag })
|
|
154
|
+
parentTables.push({ tableName: upperCase(storageResource.tableName), serviceTag: upperCase(storageResource.serviceTag) })
|
|
153
155
|
}
|
|
154
156
|
}
|
|
155
157
|
}
|
|
158
|
+
|
|
159
|
+
if (storageResource.storageType === STORAGE_TYPES.externalTopic) {
|
|
160
|
+
let uniqueTag = hash({
|
|
161
|
+
accountId: storageResource.accountId,
|
|
162
|
+
region: storageResource.region,
|
|
163
|
+
serviceTag: storageResource.serviceTag,
|
|
164
|
+
stage: storageResource.stage
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
if (!externalTopicComponents.includes(uniqueTag)) {
|
|
168
|
+
externalTopicComponents.push(
|
|
169
|
+
{
|
|
170
|
+
[uniqueTag]: {
|
|
171
|
+
accountId: storageResource.accountId,
|
|
172
|
+
region: storageResource.region,
|
|
173
|
+
serviceTag: storageResource.serviceTag,
|
|
174
|
+
stage: storageResource.stage
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
)
|
|
178
|
+
}
|
|
179
|
+
}
|
|
156
180
|
}
|
|
157
181
|
}
|
|
158
182
|
|
|
183
|
+
|
|
184
|
+
|
|
159
185
|
if (parentTables.length > 0) {
|
|
160
186
|
additionalResourcePermission.push(
|
|
161
187
|
createIamRole(
|
|
@@ -179,6 +205,24 @@ async function createParamForCreateSource(_izContext, allObjSchemas, action, han
|
|
|
179
205
|
}
|
|
180
206
|
}
|
|
181
207
|
|
|
208
|
+
if (externalTopicComponents.length > 0) {
|
|
209
|
+
if (action === ACTIONS.create) {
|
|
210
|
+
externalTopicComponents.map(component => {
|
|
211
|
+
for (const [_, compo] of Object.entries(component)) {
|
|
212
|
+
additionalResourcePermission.push(createIamRole(
|
|
213
|
+
{
|
|
214
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
215
|
+
},
|
|
216
|
+
[
|
|
217
|
+
`arn:aws:sns:${compo.region}:${compo.accountId}:${compo.serviceTag}_${compo.stage}_Create_In`
|
|
218
|
+
]
|
|
219
|
+
))
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
)
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
182
226
|
return {
|
|
183
227
|
templatePath: templatePath,
|
|
184
228
|
templateData: {
|
|
@@ -25,7 +25,7 @@ const { HANDLER, STORAGE_TYPES, ACTIONS } = require('@izara_project/izara-core-l
|
|
|
25
25
|
const {
|
|
26
26
|
firstLetterLowerCase: lowerCase,
|
|
27
27
|
firstLetterUpperCase: upperCase,
|
|
28
|
-
} = require("../../../../MainLibs/
|
|
28
|
+
} = require("../../../../MainLibs/src/Utils");
|
|
29
29
|
const {
|
|
30
30
|
createIamRole,
|
|
31
31
|
resourceNames,
|
|
@@ -90,7 +90,7 @@ async function data(_izContext, objectSchemas, srcPath, settings) {
|
|
|
90
90
|
additionalResourcePermission.push(
|
|
91
91
|
createIamRole(
|
|
92
92
|
{ [RESOURCE_CLASSES.dynamoDbTable]: [DEFAULT_LAMBDA_ROLE_PER_ACTION[ACTIONS.get].dynamoDbPermission] },
|
|
93
|
-
tableForGetItem
|
|
93
|
+
upperCase(tableForGetItem)
|
|
94
94
|
)
|
|
95
95
|
);
|
|
96
96
|
}
|
|
@@ -21,7 +21,7 @@ const path = require("path")
|
|
|
21
21
|
|
|
22
22
|
const templatePath = path.join(__dirname, '../../resourceYaml/dynamodb/template.ejs')
|
|
23
23
|
const { SOURCE_PATH, SAVE_FILE_NAME, defaultIamRolePerAction, createIamRole, DYNAMO_RESOURCE, resourceNames, RESOURCE_CLASSES, FUNCTION_NAME, SOURCE_GENERATE_IAM_ROLE } = require('../../../../MainLibs/src/Consts.js')
|
|
24
|
-
|
|
24
|
+
const { firstLetterUpperCase: upperCase } = require('../../../../MainLibs/src/Utils.js')
|
|
25
25
|
/**
|
|
26
26
|
* create param of crateSouce for FindData And processLogical
|
|
27
27
|
*
|
|
@@ -84,7 +84,7 @@ const createAwaitingMultipleStepDynamoDbData = (_izContext, flowSchema, allLocal
|
|
|
84
84
|
templatePath,
|
|
85
85
|
templateData: {
|
|
86
86
|
tableName,
|
|
87
|
-
resourceName: tableName,
|
|
87
|
+
resourceName: upperCase(tableName),
|
|
88
88
|
attributes,
|
|
89
89
|
},
|
|
90
90
|
setting: {
|
|
@@ -77,7 +77,7 @@ function data(_izContext, flowSchema, srcPath) {
|
|
|
77
77
|
function createSourceParams(_izContext, flowTag, flowStep, srcPath) {
|
|
78
78
|
let functionName = upperCase(flowStep);
|
|
79
79
|
let handlerType = upperCase(HANDLER.hdrSqs);
|
|
80
|
-
let topicIn = upperCase(flowStep)
|
|
80
|
+
let topicIn = `${upperCase(flowTag)}_${upperCase(flowStep)}`;
|
|
81
81
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
82
82
|
additionalResourcePermission.push(
|
|
83
83
|
createIamRole(
|
|
@@ -95,8 +95,8 @@ function createSourceParams(_izContext, flowTag, flowStep, srcPath) {
|
|
|
95
95
|
[RESOURCE_CLASSES.sqs]: [SQS_RESOURCE.sendMessage, SQS_RESOURCE.receiveMessage, SQS_RESOURCE.deleteMessage, SQS_RESOURCE.getQueueAttributes, SQS_RESOURCE.deleteMessageBatch, SQS_RESOURCE.getQueueUrl]
|
|
96
96
|
},
|
|
97
97
|
[
|
|
98
|
-
resourceNames(RESOURCE_CLASSES.sqs, upperCase(flowStep) + upperCase(handlerType)),
|
|
99
|
-
resourceNames(RESOURCE_CLASSES.sqs, upperCase(flowStep) + upperCase(handlerType) + "DLQ")
|
|
98
|
+
resourceNames(RESOURCE_CLASSES.sqs, `${upperCase(flowTag)}_${upperCase(flowStep)}` + upperCase(handlerType)),
|
|
99
|
+
resourceNames(RESOURCE_CLASSES.sqs, `${upperCase(flowTag)}_${upperCase(flowStep)}` + upperCase(handlerType) + "DLQ")
|
|
100
100
|
]
|
|
101
101
|
)
|
|
102
102
|
)
|
|
@@ -62,7 +62,7 @@ function data(_izContext, flowSchema, srcPath) {
|
|
|
62
62
|
function createParamsForCreateSource(_izContext, flowTag, flowStep, srcPath) {
|
|
63
63
|
let functionName = upperCase(flowStep)
|
|
64
64
|
let handlerType = upperCase(HANDLER.hdrSqs)
|
|
65
|
-
let queueName = upperCase(flowStep) + handlerType
|
|
65
|
+
let queueName = `${upperCase(flowTag)}_${upperCase(flowStep)}` + handlerType
|
|
66
66
|
return {
|
|
67
67
|
templatePath: templatePath,
|
|
68
68
|
templateData: {
|
|
@@ -55,7 +55,8 @@ function createDataForDefaultSnsInSqs(_izContext, flowSchema, srcPath) {
|
|
|
55
55
|
for (let i = 2; i < flowSteps.length; i++) {
|
|
56
56
|
generatedSnsTopicInForFlowSchema.add(
|
|
57
57
|
{
|
|
58
|
-
queueName: upperCase(flowSteps[i])
|
|
58
|
+
queueName: `${upperCase(flowSchema.flowTag)}_${upperCase(flowSteps[i])}`,
|
|
59
|
+
resourceName: upperCase(flowSchema.flowTag) + upperCase(flowSteps[i])
|
|
59
60
|
}
|
|
60
61
|
)
|
|
61
62
|
}
|
|
@@ -67,7 +68,8 @@ function createDataForDefaultSnsInSqs(_izContext, flowSchema, srcPath) {
|
|
|
67
68
|
for (let i = 2; i < flowSteps.length; i++) {
|
|
68
69
|
generatedSnsTopicInForFlowSchema.add(
|
|
69
70
|
{
|
|
70
|
-
queueName: upperCase(flowSteps[i])
|
|
71
|
+
queueName: `${upperCase(flowSchema.flowTag)}_${upperCase(flowSteps[i])}`,
|
|
72
|
+
resourceName: upperCase(flowSchema.flowTag) + upperCase(flowSteps[i])
|
|
71
73
|
}
|
|
72
74
|
)
|
|
73
75
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
##===== [Create topic in]
|
|
2
|
-
In<%-
|
|
2
|
+
In<%- resourceName %>:
|
|
3
3
|
Type: AWS::SNS::Topic
|
|
4
4
|
Properties:
|
|
5
5
|
DisplayName: "SNS Message in"
|
|
6
6
|
TopicName: ${self:custom.iz_serviceTag}_${self:custom.iz_stage}_<%- queueName %>
|
|
7
7
|
##===== SNS Subscription
|
|
8
8
|
##===== [Topic In]
|
|
9
|
-
SubscriptionIn<%-
|
|
9
|
+
SubscriptionIn<%- resourceName %>:
|
|
10
10
|
Type: AWS::SNS::Subscription
|
|
11
11
|
Properties:
|
|
12
|
-
TopicArn: !Ref In<%-
|
|
12
|
+
TopicArn: !Ref In<%- resourceName %>
|
|
13
13
|
Endpoint: "arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- queueName %>HdrSqs"
|
|
14
14
|
Protocol: "sqs"
|
|
15
15
|
##===== [Queue]
|
|
16
|
-
<%-
|
|
16
|
+
<%- resourceName %>HdrSqs:
|
|
17
17
|
Type: "AWS::SQS::Queue"
|
|
18
18
|
Properties:
|
|
19
19
|
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>HdrSqs
|
|
@@ -21,17 +21,17 @@
|
|
|
21
21
|
deadLetterTargetArn:
|
|
22
22
|
# !GetAtt
|
|
23
23
|
Fn::GetAtt:
|
|
24
|
-
- <%-
|
|
24
|
+
- <%- resourceName %>HdrSqsDLQ
|
|
25
25
|
- Arn
|
|
26
26
|
maxReceiveCount: 3
|
|
27
27
|
VisibilityTimeout: 120
|
|
28
28
|
##==== [QueueDLQ]
|
|
29
|
-
<%-
|
|
29
|
+
<%- resourceName %>HdrSqsDLQ:
|
|
30
30
|
Type: AWS::SQS::Queue
|
|
31
31
|
Properties:
|
|
32
32
|
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>HdrSqsDLQ
|
|
33
33
|
##==== [QueuePolicy]
|
|
34
|
-
<%-
|
|
34
|
+
<%- resourceName %>HdrSqsPolicy:
|
|
35
35
|
Type: AWS::SQS::QueuePolicy
|
|
36
36
|
Properties:
|
|
37
37
|
PolicyDocument:
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
Resource:
|
|
44
44
|
# !GetAtt
|
|
45
45
|
Fn::GetAtt:
|
|
46
|
-
- <%-
|
|
46
|
+
- <%- resourceName %>HdrSqs
|
|
47
47
|
- Arn
|
|
48
48
|
Action: "SQS:SendMessage"
|
|
49
49
|
Queues:
|
|
50
|
-
- Ref: <%-
|
|
50
|
+
- Ref: <%- resourceName %>HdrSqs
|
|
51
51
|
#<#<%- firstLetterUpperCase(queueName) %>QueueSetting#>
|
|
52
52
|
#<#/<%- firstLetterUpperCase(queueName) %>QueueSetting#>
|
|
53
53
|
|
|
@@ -386,30 +386,30 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
386
386
|
}
|
|
387
387
|
|
|
388
388
|
// statusType enum [storedCache, statusField]
|
|
389
|
-
if (flowSchema.statusType === "storedCache") {
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
} else if (flowSchema.statusType === "statusField") {
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
}
|
|
389
|
+
// if (flowSchema.statusType === "storedCache") {
|
|
390
|
+
// const flowSchemaDynamoDb = createAwaitingMultipleStepDynamoDbData(_izContext, flowSchema, allLocalObjectSchemas, saveFilePath)
|
|
391
|
+
// console.log("generated code storedCache flowSchema")
|
|
392
|
+
// createSourceParams.push(...flowSchemaDynamoDb);
|
|
393
|
+
// } else if (flowSchema.statusType === "statusField") {
|
|
394
|
+
// wait
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
// if (flowSchema.statusType === "statusField") {
|
|
398
|
+
// const createRecordCompleteFunctionYaml = createCreateObjectCompleteFuntionYaml(_izContext, flowSchema, saveFilePath);
|
|
399
|
+
// const createRecordCompleteHandler = createCreateObjectCompleteHandler(_izContext, flowSchema, saveFilePath);
|
|
400
|
+
// const createRecordCompleteMainFunction = createCreateObjectCompleteMainFunction(_izContext, flowSchema, saveFilePath);
|
|
401
|
+
// const createRecordCompleteQueue = createCreateObjectCompleteQueue(_izContext, flowSchema, saveFilePath);
|
|
402
|
+
|
|
403
|
+
// const recordCompleteResources = [
|
|
404
|
+
// ...createRecordCompleteFunctionYaml,
|
|
405
|
+
// ...createRecordCompleteHandler,
|
|
406
|
+
// ...createRecordCompleteMainFunction,
|
|
407
|
+
// ...createRecordCompleteQueue
|
|
408
|
+
// ];
|
|
409
|
+
// console.log("generated Code createRecordComplete")
|
|
410
|
+
// createSourceParams.push(...recordCompleteResources);
|
|
411
|
+
// }
|
|
412
|
+
// }
|
|
413
413
|
const flowSchemaFlowStepYml = createFlowSchemaFlowStepFunctionYaml(_izContext, flowSchema, saveFilePath);
|
|
414
414
|
const flowSchemaFlowStepHandler = createFlowSchemaFlowStepHandler(_izContext, flowSchema, saveFilePath);
|
|
415
415
|
const flowSchemaFlowStepMainFunction = createFlowSchemaFlowStepMainFunction(_izContext, flowSchema, saveFilePath);
|
|
@@ -21,36 +21,50 @@ const templatePath = path.join(__dirname, "./template.ejs")
|
|
|
21
21
|
|
|
22
22
|
function generateRole(_izContext, createSourceParams, srcPath) {
|
|
23
23
|
// console.log("createSourceParams", createSourceParams);
|
|
24
|
-
let
|
|
25
|
-
|
|
24
|
+
let createSourceRole = new Set();
|
|
25
|
+
const reformCreateSourceParams = {};
|
|
26
|
+
|
|
26
27
|
for (const createSource of createSourceParams) {
|
|
27
|
-
const { roleName, additionalResourcePermission } = createSource.templateData
|
|
28
|
-
if (additionalResourcePermission && roleName) {
|
|
29
|
-
if (!reformCreateSourceParams[roleName]) {
|
|
30
|
-
reformCreateSourceParams[roleName] = {
|
|
31
|
-
resourcePermissions: [...additionalResourcePermission]
|
|
32
|
-
};
|
|
33
|
-
} else {
|
|
34
|
-
let resourcePermission = reformCreateSourceParams[roleName].resourcePermissions
|
|
35
|
-
let mergeResource = [...resourcePermission, ...additionalResourcePermission]
|
|
28
|
+
const { roleName, additionalResourcePermission } = createSource.templateData;
|
|
36
29
|
|
|
37
|
-
|
|
38
|
-
const unique = [];
|
|
30
|
+
if (!roleName || !additionalResourcePermission) continue;
|
|
39
31
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
32
|
+
if (!reformCreateSourceParams[roleName]) {
|
|
33
|
+
reformCreateSourceParams[roleName] = { resourcePermissions: [] };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const rolePermissions = reformCreateSourceParams[roleName].resourcePermissions;
|
|
37
|
+
|
|
38
|
+
for (const newPerm of additionalResourcePermission) {
|
|
39
|
+
const normalizedActions = Object.entries(newPerm.action)
|
|
40
|
+
.flatMap(([service, actions]) => actions.map(action => `${service}:${action}`))
|
|
41
|
+
.sort();
|
|
42
|
+
|
|
43
|
+
const effect = newPerm.effect;
|
|
44
|
+
const resources = [...new Set(newPerm.resource)];
|
|
45
|
+
|
|
46
|
+
const existing = rolePermissions.find(
|
|
47
|
+
permission =>
|
|
48
|
+
permission.effect === effect &&
|
|
49
|
+
JSON.stringify([...permission.action].sort()) === JSON.stringify(normalizedActions)
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
if (existing) {
|
|
53
|
+
// Merge resources (deduplicate with Set)
|
|
54
|
+
existing.resource = Array.from(new Set([...existing.resource, ...resources]));
|
|
55
|
+
} else {
|
|
56
|
+
// Push new permission
|
|
57
|
+
rolePermissions.push({
|
|
58
|
+
effect: effect,
|
|
59
|
+
action: normalizedActions,
|
|
60
|
+
resource: resources
|
|
61
|
+
});
|
|
48
62
|
}
|
|
49
63
|
}
|
|
50
64
|
}
|
|
65
|
+
// console.log({ reformCreateSourceParams: JSON.stringify(reformCreateSourceParams, null, 2) })
|
|
51
66
|
for (const [roleName, roleData] of Object.entries(reformCreateSourceParams)) {
|
|
52
|
-
|
|
53
|
-
createSourceRole.push(
|
|
67
|
+
createSourceRole.add(
|
|
54
68
|
{
|
|
55
69
|
templatePath: templatePath,
|
|
56
70
|
templateData: { roleName, roleData },
|
|
@@ -71,4 +85,4 @@ function generateRole(_izContext, createSourceParams, srcPath) {
|
|
|
71
85
|
|
|
72
86
|
module.exports = {
|
|
73
87
|
generateRole
|
|
74
|
-
}
|
|
88
|
+
}
|
|
@@ -18,17 +18,15 @@
|
|
|
18
18
|
PolicyDocument:
|
|
19
19
|
Version: "2012-10-17"
|
|
20
20
|
Statement:
|
|
21
|
-
|
|
22
|
-
- Effect: <%- resourcePermission.effect
|
|
21
|
+
<%_ roleData.resourcePermissions.forEach(resourcePermission => { _%>
|
|
22
|
+
- Effect: <%- resourcePermission.effect %>
|
|
23
23
|
Action:
|
|
24
|
-
<%_
|
|
25
|
-
|
|
26
|
-
- <%- action.trim() %>:<%- permission.trim() %>
|
|
27
|
-
<%_ }) _%>
|
|
24
|
+
<%_ resourcePermission.action.forEach(action => { _%>
|
|
25
|
+
- <%- action %>
|
|
28
26
|
<%_ }) _%>
|
|
29
27
|
Resource:
|
|
30
28
|
<%_ resourcePermission.resource.forEach(resource => { _%>
|
|
31
|
-
|
|
29
|
+
- "<%- resource %>"
|
|
32
30
|
<%_ }) _%>
|
|
33
31
|
<%_ }) _%>
|
|
34
32
|
#<#<%- roleName %>Role#>
|
|
@@ -25,7 +25,7 @@ const serviceSchemas = require('@izara_project/izara-core-library-service-schema
|
|
|
25
25
|
const serviceConfig = serviceSchemas.serviceConfig;
|
|
26
26
|
|
|
27
27
|
const { HANDLER, STORAGE_TYPES, ACTIONS } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
28
|
-
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../MainLibs/
|
|
28
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../MainLibs/src/Utils.js");
|
|
29
29
|
const {
|
|
30
30
|
createIamRole,
|
|
31
31
|
resourceNames,
|
|
@@ -71,7 +71,7 @@ async function data(_izContext, objectSchemas, srcPath) {
|
|
|
71
71
|
additionalResourcePermission.push(
|
|
72
72
|
createIamRole(
|
|
73
73
|
{ [RESOURCE_CLASSES.dynamoDbTable]: DYNAMO_RESOURCE.query },
|
|
74
|
-
tableForQuery
|
|
74
|
+
upperCase(tableForQuery)
|
|
75
75
|
)
|
|
76
76
|
);
|
|
77
77
|
}
|
|
@@ -66,43 +66,47 @@ function data(_izContext, srcPath) {
|
|
|
66
66
|
|
|
67
67
|
|
|
68
68
|
function createParamForCreateSource(handlerType, srcPath) {
|
|
69
|
-
|
|
70
69
|
let functionName = upperCase(FUNCTION_NAME.changeRel)
|
|
71
70
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
72
71
|
|
|
73
72
|
additionalResourcePermission.push(awaitingMultipleStepsRole())
|
|
74
73
|
|
|
75
|
-
|
|
74
|
+
if (handlerType === HANDLER.hdrDsq) {
|
|
75
|
+
additionalResourcePermission.push(
|
|
76
|
+
createIamRole(
|
|
77
|
+
{
|
|
78
|
+
[RESOURCE_CLASSES.sqs]: [
|
|
79
|
+
SQS_RESOURCE.deleteMessage,
|
|
80
|
+
SQS_RESOURCE.getQueueAttributes,
|
|
81
|
+
SQS_RESOURCE.receiveMessage,
|
|
82
|
+
SQS_RESOURCE.sendMessage,
|
|
83
|
+
SQS_RESOURCE.getQueueUrl,
|
|
84
|
+
SQS_RESOURCE.deleteMessageBatch
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
[
|
|
88
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType)),
|
|
89
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType) + "DLQ"),
|
|
90
|
+
]
|
|
91
|
+
)
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (handlerType === HANDLER.hdrSqs) {
|
|
76
96
|
createIamRole(
|
|
77
97
|
{
|
|
78
|
-
[RESOURCE_CLASSES.
|
|
79
|
-
|
|
80
|
-
SQS_RESOURCE.getQueueAttributes,
|
|
81
|
-
SQS_RESOURCE.receiveMessage,
|
|
82
|
-
SQS_RESOURCE.sendMessage,
|
|
83
|
-
SQS_RESOURCE.getQueueUrl,
|
|
84
|
-
SQS_RESOURCE.deleteMessageBatch
|
|
85
|
-
],
|
|
98
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe],
|
|
99
|
+
[RESOURCE_CLASSES.sqs]: [SQS_RESOURCE.receiveMessage, SQS_RESOURCE.sendMessage]
|
|
86
100
|
},
|
|
87
101
|
[
|
|
102
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.changeRelComplete) + "_Out"),
|
|
88
103
|
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType)),
|
|
89
104
|
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType) + "DLQ"),
|
|
90
|
-
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType)),
|
|
91
|
-
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType) + "DLQ"),
|
|
92
|
-
]
|
|
93
|
-
),
|
|
94
|
-
createIamRole(
|
|
95
|
-
{
|
|
96
|
-
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe]
|
|
97
|
-
},
|
|
98
|
-
[
|
|
99
|
-
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.changeRelComplete) + "_Out"),
|
|
100
105
|
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
|
101
106
|
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
|
|
102
107
|
]
|
|
103
108
|
)
|
|
104
|
-
|
|
105
|
-
|
|
109
|
+
}
|
|
106
110
|
|
|
107
111
|
return {
|
|
108
112
|
templatePath: templatePath,
|
package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/data.js
CHANGED
|
@@ -72,36 +72,44 @@ function createParamForCreateSource(allObjectRelationships, handlerType, srcPath
|
|
|
72
72
|
|
|
73
73
|
additionalResourcePermission.push(awaitingMultipleStepsRole())
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
),
|
|
94
|
-
createIamRole(
|
|
95
|
-
{
|
|
96
|
-
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe]
|
|
97
|
-
},
|
|
98
|
-
[
|
|
99
|
-
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.createRelComplete) + "_Out"),
|
|
100
|
-
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
|
101
|
-
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
|
|
102
|
-
]
|
|
75
|
+
if (handlerType === HANDLER.hdrDsq) {
|
|
76
|
+
additionalResourcePermission.push(
|
|
77
|
+
createIamRole(
|
|
78
|
+
{
|
|
79
|
+
[RESOURCE_CLASSES.sqs]: [
|
|
80
|
+
SQS_RESOURCE.deleteMessage,
|
|
81
|
+
SQS_RESOURCE.getQueueAttributes,
|
|
82
|
+
SQS_RESOURCE.receiveMessage,
|
|
83
|
+
SQS_RESOURCE.sendMessage,
|
|
84
|
+
SQS_RESOURCE.getQueueUrl,
|
|
85
|
+
SQS_RESOURCE.deleteMessageBatch
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
[
|
|
89
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType)),
|
|
90
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType) + "DLQ"),
|
|
91
|
+
]
|
|
92
|
+
)
|
|
103
93
|
)
|
|
104
|
-
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (handlerType === HANDLER.hdrSqs) {
|
|
97
|
+
additionalResourcePermission.push(
|
|
98
|
+
createIamRole(
|
|
99
|
+
{
|
|
100
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe],
|
|
101
|
+
[RESOURCE_CLASSES.sqs]: [SQS_RESOURCE.receiveMessage, SQS_RESOURCE.sendMessage]
|
|
102
|
+
},
|
|
103
|
+
[
|
|
104
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.createRelComplete) + "_Out"),
|
|
105
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType)),
|
|
106
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType) + "DLQ"),
|
|
107
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
|
108
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
|
|
109
|
+
]
|
|
110
|
+
)
|
|
111
|
+
)
|
|
112
|
+
}
|
|
105
113
|
|
|
106
114
|
for (const relationship of allObjectRelationships) {
|
|
107
115
|
let [storageType, relationshipTag, links] = checkDynamoTypeRelationship(relationship)
|
package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/data.js
CHANGED
|
@@ -72,36 +72,43 @@ function createParamForCreateSource(allObjectRelationships, handlerType, srcPath
|
|
|
72
72
|
|
|
73
73
|
additionalResourcePermission.push(awaitingMultipleStepsRole())
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
),
|
|
94
|
-
createIamRole(
|
|
95
|
-
{
|
|
96
|
-
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe]
|
|
97
|
-
},
|
|
98
|
-
[
|
|
99
|
-
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.deleteRelComplete) + "_Out"),
|
|
100
|
-
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
|
101
|
-
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
|
|
102
|
-
]
|
|
75
|
+
if (handlerType === HANDLER.hdrDsq) {
|
|
76
|
+
additionalResourcePermission.push(
|
|
77
|
+
createIamRole(
|
|
78
|
+
{
|
|
79
|
+
[RESOURCE_CLASSES.sqs]: [
|
|
80
|
+
SQS_RESOURCE.deleteMessage,
|
|
81
|
+
SQS_RESOURCE.getQueueAttributes,
|
|
82
|
+
SQS_RESOURCE.receiveMessage,
|
|
83
|
+
SQS_RESOURCE.sendMessage,
|
|
84
|
+
SQS_RESOURCE.getQueueUrl,
|
|
85
|
+
SQS_RESOURCE.deleteMessageBatch
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
[
|
|
89
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType)),
|
|
90
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType) + "DLQ"),
|
|
91
|
+
]
|
|
92
|
+
)
|
|
103
93
|
)
|
|
104
|
-
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (handlerType === HANDLER.hdrSqs) {
|
|
97
|
+
additionalResourcePermission.push(
|
|
98
|
+
createIamRole(
|
|
99
|
+
{
|
|
100
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe],
|
|
101
|
+
[RESOURCE_CLASSES.sqs]: [SQS_RESOURCE.receiveMessage, SQS_RESOURCE.sendMessage] },
|
|
102
|
+
[
|
|
103
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.deleteRelComplete) + "_Out"),
|
|
104
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType)),
|
|
105
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType) + "DLQ"),
|
|
106
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
|
107
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
|
|
108
|
+
]
|
|
109
|
+
)
|
|
110
|
+
)
|
|
111
|
+
}
|
|
105
112
|
|
|
106
113
|
for (const relationship of allObjectRelationships) {
|
|
107
114
|
let [storageType, relationshipTag, links] = checkDynamoTypeRelationship(relationship)
|
|
@@ -72,36 +72,43 @@ function createParamForCreateSource(allObjectRelationships, handlerType, srcPath
|
|
|
72
72
|
|
|
73
73
|
additionalResourcePermission.push(awaitingMultipleStepsRole())
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
),
|
|
94
|
-
createIamRole(
|
|
95
|
-
{
|
|
96
|
-
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe]
|
|
97
|
-
},
|
|
98
|
-
[
|
|
99
|
-
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.getRelComplete) + "_Out"),
|
|
100
|
-
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
|
101
|
-
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
|
|
102
|
-
]
|
|
75
|
+
if (handlerType === HANDLER.hdrDsq) {
|
|
76
|
+
additionalResourcePermission.push(
|
|
77
|
+
createIamRole(
|
|
78
|
+
{
|
|
79
|
+
[RESOURCE_CLASSES.sqs]: [
|
|
80
|
+
SQS_RESOURCE.deleteMessage,
|
|
81
|
+
SQS_RESOURCE.getQueueAttributes,
|
|
82
|
+
SQS_RESOURCE.receiveMessage,
|
|
83
|
+
SQS_RESOURCE.sendMessage,
|
|
84
|
+
SQS_RESOURCE.getQueueUrl,
|
|
85
|
+
SQS_RESOURCE.deleteMessageBatch
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
[
|
|
89
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType)),
|
|
90
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType) + "DLQ"),
|
|
91
|
+
]
|
|
92
|
+
)
|
|
103
93
|
)
|
|
104
|
-
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (handlerType === HANDLER.hdrSqs) {
|
|
97
|
+
additionalResourcePermission.push(
|
|
98
|
+
createIamRole(
|
|
99
|
+
{
|
|
100
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe],
|
|
101
|
+
[RESOURCE_CLASSES.sqs]: [SQS_RESOURCE.receiveMessage, SQS_RESOURCE.sendMessage] },
|
|
102
|
+
[
|
|
103
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.getRelComplete) + "_Out"),
|
|
104
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType)),
|
|
105
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType) + "DLQ"),
|
|
106
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
|
107
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
|
|
108
|
+
]
|
|
109
|
+
)
|
|
110
|
+
)
|
|
111
|
+
}
|
|
105
112
|
|
|
106
113
|
for (const relationship of allObjectRelationships) {
|
|
107
114
|
let [storageType, relationshipTag, links] = checkDynamoTypeRelationship(relationship)
|
|
@@ -67,41 +67,48 @@ function data(_izContext, allObjectRelationships, srcPath) {
|
|
|
67
67
|
|
|
68
68
|
function createParamForCreateSource(allObjectRelationships, handlerType, srcPath) {
|
|
69
69
|
|
|
70
|
-
let functionName = upperCase(FUNCTION_NAME.
|
|
70
|
+
let functionName = upperCase(FUNCTION_NAME.moveRel)
|
|
71
71
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
72
72
|
|
|
73
73
|
additionalResourcePermission.push(awaitingMultipleStepsRole())
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
),
|
|
94
|
-
createIamRole(
|
|
95
|
-
{
|
|
96
|
-
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe]
|
|
97
|
-
},
|
|
98
|
-
[
|
|
99
|
-
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.moveRelComplete) + "_Out"),
|
|
100
|
-
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
|
101
|
-
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
|
|
102
|
-
]
|
|
75
|
+
if (handlerType === HANDLER.hdrDsq) {
|
|
76
|
+
additionalResourcePermission.push(
|
|
77
|
+
createIamRole(
|
|
78
|
+
{
|
|
79
|
+
[RESOURCE_CLASSES.sqs]: [
|
|
80
|
+
SQS_RESOURCE.deleteMessage,
|
|
81
|
+
SQS_RESOURCE.getQueueAttributes,
|
|
82
|
+
SQS_RESOURCE.receiveMessage,
|
|
83
|
+
SQS_RESOURCE.sendMessage,
|
|
84
|
+
SQS_RESOURCE.getQueueUrl,
|
|
85
|
+
SQS_RESOURCE.deleteMessageBatch
|
|
86
|
+
],
|
|
87
|
+
},
|
|
88
|
+
[
|
|
89
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType)),
|
|
90
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType) + "DLQ"),
|
|
91
|
+
]
|
|
92
|
+
)
|
|
103
93
|
)
|
|
104
|
-
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (handlerType === HANDLER.hdrSqs) {
|
|
97
|
+
additionalResourcePermission.push(
|
|
98
|
+
createIamRole(
|
|
99
|
+
{
|
|
100
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe],
|
|
101
|
+
[RESOURCE_CLASSES.sqs]: [SQS_RESOURCE.receiveMessage, SQS_RESOURCE.sendMessage] },
|
|
102
|
+
[
|
|
103
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.moveRelComplete) + "_Out"),
|
|
104
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType)),
|
|
105
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType) + "DLQ"),
|
|
106
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
|
107
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
|
|
108
|
+
]
|
|
109
|
+
)
|
|
110
|
+
)
|
|
111
|
+
}
|
|
105
112
|
|
|
106
113
|
for (const relationship of allObjectRelationships) {
|
|
107
114
|
let [storageType, relationshipTag, links] = checkDynamoTypeRelationship(relationship)
|
package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/data.js
CHANGED
|
@@ -75,35 +75,45 @@ function createParamForCreateSource(allObjectRelationships, handlerType, srcPath
|
|
|
75
75
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
76
76
|
|
|
77
77
|
additionalResourcePermission.push(awaitingMultipleStepsRole())
|
|
78
|
+
if (handlerType === HANDLER.hdrDsq) {
|
|
79
|
+
additionalResourcePermission.push(
|
|
80
|
+
createIamRole(
|
|
81
|
+
{
|
|
82
|
+
[RESOURCE_CLASSES.sqs]: [
|
|
83
|
+
SQS_RESOURCE.deleteMessage,
|
|
84
|
+
SQS_RESOURCE.getQueueAttributes,
|
|
85
|
+
SQS_RESOURCE.receiveMessage,
|
|
86
|
+
SQS_RESOURCE.sendMessage,
|
|
87
|
+
SQS_RESOURCE.getQueueUrl,
|
|
88
|
+
SQS_RESOURCE.deleteMessageBatch
|
|
89
|
+
],
|
|
90
|
+
},
|
|
91
|
+
[
|
|
92
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType)),
|
|
93
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType) + "DLQ"),
|
|
94
|
+
]
|
|
95
|
+
)
|
|
96
|
+
)
|
|
97
|
+
}
|
|
78
98
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
SQS_RESOURCE.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
]
|
|
95
|
-
),
|
|
96
|
-
createIamRole(
|
|
97
|
-
{
|
|
98
|
-
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe]
|
|
99
|
-
},
|
|
100
|
-
[
|
|
101
|
-
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.updateRelComplete) + "_Out"),
|
|
102
|
-
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
|
103
|
-
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
|
|
104
|
-
]
|
|
99
|
+
if (handlerType === HANDLER.hdrSqs) {
|
|
100
|
+
additionalResourcePermission.push(
|
|
101
|
+
createIamRole(
|
|
102
|
+
{
|
|
103
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe],
|
|
104
|
+
[RESOURCE_CLASSES.sqs]: [SQS_RESOURCE.receiveMessage, SQS_RESOURCE.sendMessage]
|
|
105
|
+
},
|
|
106
|
+
[
|
|
107
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.updateRelComplete) + "_Out"),
|
|
108
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType)),
|
|
109
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(handlerType) + "DLQ"),
|
|
110
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
|
111
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
|
|
112
|
+
]
|
|
113
|
+
)
|
|
105
114
|
)
|
|
106
|
-
|
|
115
|
+
}
|
|
116
|
+
|
|
107
117
|
for (const relationship of allObjectRelationships) {
|
|
108
118
|
let [storageType, relationshipTag, links] = checkDynamoTypeRelationship(relationship)
|
|
109
119
|
if (storageType === STORAGE_TYPES.dynamoDB) {
|
package/src/reStructure/TemplateData/resourceYaml/dynamodb/mainResourcePerObjectSchemaData.js
CHANGED
|
@@ -49,7 +49,7 @@ const { getLocalConfig } = require('../../../../MainLibs/src/Utils.js')
|
|
|
49
49
|
*/
|
|
50
50
|
|
|
51
51
|
function dataForMainDynamoDbYamlFromObjectSchema(_izContext, objectSchema, srcPath) {
|
|
52
|
-
let
|
|
52
|
+
let dynamoDbYamlTemplateData = [];
|
|
53
53
|
|
|
54
54
|
let identifierDetail = {};
|
|
55
55
|
for (let identifier of objectSchema.identifiers) { //check identifiers from objectSchema
|
|
@@ -119,10 +119,11 @@ function dataForMainDynamoDbYamlFromObjectSchema(_izContext, objectSchema, srcPa
|
|
|
119
119
|
// if (storageResource.hasOwnProperty("serviceTag") && storageResource.serviceTag !== getLocalConfig(srcPath)) {
|
|
120
120
|
// continue; // if serviceTag of storageResource not own service will skip
|
|
121
121
|
// }
|
|
122
|
+
|
|
122
123
|
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
123
124
|
let templateData = {
|
|
124
|
-
tableName: storageResource.tableName,
|
|
125
|
-
resourceName: storageResource.tableName,
|
|
125
|
+
tableName: upperCase(storageResource.tableName),
|
|
126
|
+
resourceName: upperCase(storageResource.tableName),
|
|
126
127
|
attributes: []
|
|
127
128
|
};
|
|
128
129
|
if (storageResource.hasOwnProperty("groupByPartitionKeyField")) {
|
|
@@ -145,11 +146,11 @@ function dataForMainDynamoDbYamlFromObjectSchema(_izContext, objectSchema, srcPa
|
|
|
145
146
|
}
|
|
146
147
|
}
|
|
147
148
|
// templateData.resourceName = upperCase(objectSchema.objectType)
|
|
148
|
-
|
|
149
|
+
dynamoDbYamlTemplateData.push(templateData)
|
|
149
150
|
}
|
|
150
151
|
}
|
|
151
|
-
|
|
152
|
-
return
|
|
152
|
+
// console.log("dynamoDbYamlTemplateData", dynamoDbYamlTemplateData)
|
|
153
|
+
return dynamoDbYamlTemplateData
|
|
153
154
|
}
|
|
154
155
|
|
|
155
156
|
const createSourceDataDynamoDB = (_izContext, objectSchema, srcPath) => {
|
|
@@ -158,7 +159,7 @@ const createSourceDataDynamoDB = (_izContext, objectSchema, srcPath) => {
|
|
|
158
159
|
|
|
159
160
|
|
|
160
161
|
const dynamoDbMainYamlDataList = dataForMainDynamoDbYamlFromObjectSchema(_izContext, objectSchema, srcPath)
|
|
161
|
-
|
|
162
|
+
// console.log("generateDynamoPerObjectSchema", objectSchema)
|
|
162
163
|
for (let dynamoDbMainYamlData of dynamoDbMainYamlDataList) {
|
|
163
164
|
resultsForCreateSource.push({
|
|
164
165
|
templatePath: templatePath,
|
|
@@ -30,53 +30,59 @@ const STORAGE_TYPES = {
|
|
|
30
30
|
graph: "graph"
|
|
31
31
|
}
|
|
32
32
|
const { SOURCE_PATH, SAVE_FILE_NAME } = require('../../../../MainLibs/src/Consts')
|
|
33
|
-
const {
|
|
33
|
+
const { firstLetterUpperCase: upperCase, getLocalConfig } = require('../../../../MainLibs/src/Utils')
|
|
34
34
|
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
|
|
35
35
|
const { NoRetryError } = require("@izara_project/izara-core-library-core");
|
|
36
36
|
|
|
37
37
|
async function filterCreateResourceYaml(_izContext, createSourceParams, objSchemaPath) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (storageResource
|
|
56
|
-
|
|
38
|
+
try {
|
|
39
|
+
let tableNamesToFilter = new Set();
|
|
40
|
+
let ownServiceTag = getLocalConfig(path.join(objSchemaPath, "../../"), "iz_serviceTag")
|
|
41
|
+
|
|
42
|
+
const allLocalFlowSchema = await getObjectSchema.getAllLocalFlowSchemas(_izContext, objSchemaPath);
|
|
43
|
+
await Promise.all(allLocalFlowSchema.records.map(async (flowSchema) => {
|
|
44
|
+
if (flowSchema.statusType === "storedCache") {
|
|
45
|
+
tableNamesToFilter.add(...await getTableNameFromFlowSchema(_izContext, flowSchema, objSchemaPath))
|
|
46
|
+
} else if (flowSchema.statusType === "triggerCache") {
|
|
47
|
+
tableNamesToFilter.add(...await getTableNameFromFlowSchema(_izContext, flowSchema, objSchemaPath))
|
|
48
|
+
}
|
|
49
|
+
}))
|
|
50
|
+
|
|
51
|
+
const allLocalObjSchema = await getObjectSchema.getAllLocalObjectSchemasWithHierarchy(_izContext, objSchemaPath);
|
|
52
|
+
await Promise.all(allLocalObjSchema.records.map(async (objSchema) => {
|
|
53
|
+
if (objSchema.hasOwnProperty("extendObjType")) {
|
|
54
|
+
for (const storageResource of Object.values(objSchema.storageResources)) {
|
|
55
|
+
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
56
|
+
if (storageResource?.serviceTag !== ownServiceTag) {
|
|
57
|
+
tableNamesToFilter.has(storageResource.tableName)
|
|
58
|
+
}
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
+
}))
|
|
63
|
+
|
|
62
64
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
65
|
+
console.log("tableNamesToFilter", tableNamesToFilter)
|
|
66
|
+
let filteredCreateSourceParams = createSourceParams.filter(
|
|
67
|
+
(result) => !tableNamesToFilter.has(result.templateData.tableName)
|
|
68
|
+
)
|
|
66
69
|
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
// console.log("filteredCreateSourceParams", filteredCreateSourceParams)
|
|
71
|
+
return filteredCreateSourceParams
|
|
72
|
+
} catch (err) {
|
|
73
|
+
console.log(err)
|
|
74
|
+
}
|
|
69
75
|
}
|
|
70
76
|
|
|
71
77
|
module.exports = filterCreateResourceYaml;
|
|
72
78
|
|
|
73
|
-
async function
|
|
74
|
-
let tableNameStoredCache =
|
|
79
|
+
async function getTableNameFromFlowSchema(_izContext, flowSchema, objSchemaPath) {
|
|
80
|
+
let tableNameStoredCache = [];
|
|
75
81
|
const objectSchema = await getObjectSchema.getLocalObjectSchemas(_izContext, [flowSchema.objType.objectType], objSchemaPath).then(res => res.records[0])
|
|
76
82
|
if (objectSchema) {
|
|
77
83
|
for (const storageResource of Object.values(objectSchema.storageResources)) {
|
|
78
84
|
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
79
|
-
tableNameStoredCache.
|
|
85
|
+
tableNameStoredCache.push(upperCase(storageResource.tableName));
|
|
80
86
|
}
|
|
81
87
|
}
|
|
82
88
|
} else {
|
|
@@ -61,7 +61,6 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
61
61
|
try {
|
|
62
62
|
|
|
63
63
|
let createSourceDynamoDb = createSourceDataDynamoDB(_izContext, objectSchema, saveFilePath)
|
|
64
|
-
|
|
65
64
|
const [dynamoResources, updatedTableYaml] = checkValidTableYaml(
|
|
66
65
|
_izContext,
|
|
67
66
|
createSourceDynamoDb,
|
|
@@ -78,7 +77,6 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
78
77
|
}
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
|
-
|
|
82
80
|
// Add default resources
|
|
83
81
|
const defaultDynamoDbResources = createDefaultDynamoDb(_izContext, saveFilePath);
|
|
84
82
|
const defaultSnsInSqsResources = createFindDataAndProcessLogicalDefaultSnsInSqs(_izContext, saveFilePath);
|
|
@@ -97,9 +95,11 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
97
95
|
...dynamoDbResourcePerRelationshipLink
|
|
98
96
|
)
|
|
99
97
|
}
|
|
98
|
+
|
|
99
|
+
// console.log("createSourceParams before filter", createSourceParams)
|
|
100
100
|
const filteredCreateSourceParams = await filterCreateResourceYaml(_izContext, createSourceParams, objSchemaPath);
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
console.log("filteredCreateSourceParams", filteredCreateSourceParams);
|
|
103
103
|
|
|
104
104
|
return filteredCreateSourceParams;
|
|
105
105
|
} catch (error) {
|