@izara_project/izara-core-generate-service-code 1.0.23 → 1.0.25
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 +1 -1
- package/src/generateCode/generateFlowSchema/GenerateCodeFlowSchema.js +10 -7
- package/src/generateCode/generateFlowSchema/event/eventBridgeComponent/functionYaml/template.ejs +3 -10
- package/src/generateCode/generateFlowSchema/event/eventBridgeComponent/handler/inv/data.js +2 -1
- package/src/generateCode/generateFlowSchema/event/eventBridgeComponent/handler/inv/template.ejs +8 -15
- package/src/generateCode/generateFlowSchema/event/extTopicComponent/index.js +1 -1
- package/src/generateCode/generateFlowSchema/event/extTopicComponent/process/functionYaml/data.js +2 -6
- package/src/generateCode/generateFlowSchema/event/extTopicComponent/process/functionYaml/template.ejs +4 -11
- package/src/generateCode/generateFlowSchema/event/extTopicComponent/process/handler/template.ejs +2 -2
- package/src/generateCode/generateFlowSchema/event/extTopicComponent/sns-out/data.js +2 -1
- package/src/generateCode/generateFlowSchema/event/lambdaSyncApiComponent/functionYaml/data.js +1 -5
- package/src/generateCode/generateFlowSchema/event/lambdaSyncApiComponent/functionYaml/template.ejs +12 -21
- package/src/generateCode/generateFlowSchema/event/lambdaSyncApiComponent/handler/template.ejs +1 -3
- package/src/generateCode/generateFlowSchema/event/lambdaSyncInvComponent/functionYaml/data.js +9 -7
- package/src/generateCode/generateFlowSchema/event/lambdaSyncInvComponent/functionYaml/template.ejs +3 -10
- package/src/generateCode/generateFlowSchema/event/lambdaSyncInvComponent/handler/template.ejs +1 -1
- package/src/generateCode/generateFlowSchema/event/ownTopicComponent/endpointComponent/functionYaml/data.js +1 -0
- package/src/generateCode/generateFlowSchema/event/ownTopicComponent/endpointComponent/handler/DsqHandlerTemplate.ejs +2 -2
- package/src/generateCode/generateFlowSchema/event/ownTopicComponent/endpointComponent/handler/SqsHandlerTemplate.ejs +2 -2
- package/src/generateCode/generateFlowSchema/event/ownTopicComponent/flowSchemaComponent/functionYaml/data.js +5 -8
- package/src/generateCode/generateFlowSchema/event/ownTopicComponent/sns-out/data.js +2 -1
- package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/data.js +12 -10
- package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/template.ejs +6 -9
- package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/templateByStatusType/statusFieldTemplate.ejs +30 -0
- package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/templateByStatusType/storedCacheTemplate.ejs +26 -0
- package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/templateByStatusType/triggerCacheTemplate.ejs +44 -0
- package/src/generateCode/generateFlowSchema/event/s3Component/index.js +17 -17
- package/src/generateCode/generateFlowSchema/event/s3Component/upload/confirmReserved/handler/data.js +1 -1
- package/src/generateCode/generateFlowSchema/event/s3Component/upload/relate/sns-out/data.js +3 -1
- package/src/generateCode/generateFlowSchema/event/s3Component/websocket/dynamoDb/ReservedTableData.js +1 -1
- package/src/generateCode/generateFlowSchema/flowSchemaMainFunction/template.ejs +4 -6
- package/src/generateCode/generateFlowSchema/statusType/statusFieldComponent/functionYaml/data.js +9 -9
- package/src/generateCode/generateFlowSchema/statusType/statusFieldComponent/handler/data.js +1 -5
- package/src/generateCode/generateFlowSchema/statusType/statusFieldComponent/index.js +6 -18
- package/src/generateCode/generateFlowSchema/statusType/statusFieldComponent/mainFunction/data.js +15 -14
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/checkTriggerCacheComplete/functionYaml/data.js +4 -8
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/checkTriggerCacheComplete/handler/data.js +15 -15
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/checkTriggerCacheComplete/mainFunction/data.js +15 -15
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/index.js +13 -33
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/processTriggerCache/functionYaml/data.js +4 -8
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/processTriggerCache/handler/data.js +12 -14
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/processTriggerCache/mainFunction/data.js +11 -14
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/functionYaml/dsq/data.js +4 -9
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/functionYaml/sqs/data.js +4 -9
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/handler/dsq/data.js +11 -14
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/handler/sqs/data.js +11 -14
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/mainFunction/data.js +15 -15
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheQueue/data.js +2 -3
- package/src/generateCode/generateSchema/actionEndpointCompleteComponent/create/mainFunction/template.ejs +185 -103
- package/src/generateCode/generateSchema/actionEndpointCompleteComponent/create/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/actionEndpointCompleteComponent/delete/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/actionEndpointCompleteComponent/get/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/actionEndpointCompleteComponent/update/mainFunction/template.ejs +137 -71
- package/src/generateCode/generateSchema/actionEndpointCompleteComponent/update/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/actionEndpointComponent/mainFunction/beforeLogical/template.ejs +14 -6
- package/src/generateCode/generateSchema/actionEndpointComponent/mainFunction/create/main/template.ejs +21 -3
- package/src/generateCode/generateSchema/actionEndpointComponent/mainFunction/delete/main/template.ejs +24 -4
- package/src/generateCode/generateSchema/actionEndpointComponent/mainFunction/update/main/template.ejs +25 -4
- package/src/generateCode/generateSchema/actionEndpointComponent/yaml/data.js +6 -4
- package/src/generateCode/generateSchema/findDataComponent/mainFunction/data.js +1 -1
- package/src/generateCode/generateSchema/relationshipPerActionComponent/changeRelationship/complete/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/relationshipPerActionComponent/create/action/functionYaml/data.js +1 -0
- package/src/generateCode/generateSchema/relationshipPerActionComponent/create/complete/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/relationshipPerActionComponent/delete/action/functionYaml/data.js +1 -0
- package/src/generateCode/generateSchema/relationshipPerActionComponent/delete/complete/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/relationshipPerActionComponent/get/action/functionYaml/data.js +1 -0
- package/src/generateCode/generateSchema/relationshipPerActionComponent/get/complete/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/relationshipPerActionComponent/moveRelationship/complete/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/relationshipPerActionComponent/update/action/functionYaml/data.js +1 -0
- package/src/generateCode/generateSchema/relationshipPerActionComponent/update/action/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/relationshipPerActionComponent/update/complete/mainFunction/template.ejs +1 -1
- package/src/generateCode/generateSchema/relationshipPerActionComponent/update/complete/sns-out/data.js +2 -1
- package/src/generateCode/resourceYamlComponent/sns-out/data.js +2 -1
- package/src/generateCode/resourceYamlComponent/sns-out/defaultSnsOutForFindDataAndProcessLogical.js +2 -1
- package/src/generateCode/resourceYamlComponent/sns-out/template.ejs +2 -6
- package/src/generateCode.js +9 -7
- package/src/libs/Utils.js +26 -1
- package/src/__TemplateData/flowSchema/event/externalTopic/Process/handler/data.js +0 -64
- package/src/__TemplateData/flowSchema/event/externalTopic/sns-out/data.js +0 -75
package/src/generateCode/generateSchema/relationshipPerActionComponent/update/action/sns-out/data.js
CHANGED
|
@@ -60,7 +60,8 @@ function createParamsForCreateSource(_izContext, srcPath) {
|
|
|
60
60
|
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
61
61
|
saveFileName: SAVE_FILE_NAME.snsOutYaml,
|
|
62
62
|
fileExtension: '.yml',
|
|
63
|
-
isAppend: true
|
|
63
|
+
isAppend: true,
|
|
64
|
+
fromFile: 'relationShip/update/sns-out/data.js'
|
|
64
65
|
}
|
|
65
66
|
};
|
|
66
67
|
}
|
|
@@ -75,7 +75,7 @@ export default async function updateRelationshipComplete(
|
|
|
75
75
|
hash({
|
|
76
76
|
linkTypeId,
|
|
77
77
|
relId: returnValue.requestParams.relId,
|
|
78
|
-
relationshipProperties: returnValue.requestParams.
|
|
78
|
+
relationshipProperties: returnValue.requestParams.relationshipProperties
|
|
79
79
|
graphServiceTag: graphServiceTag
|
|
80
80
|
}), // hash id
|
|
81
81
|
PREFIX.updateRel // prefix, use constant further
|
|
@@ -49,7 +49,8 @@ function createParamsForCreateSource(_izContext, appPath) {
|
|
|
49
49
|
savePath: path.join(appPath, SOURCE_PATH.resourceYaml),
|
|
50
50
|
saveFileName: SAVE_FILE_NAME.snsOutYaml,
|
|
51
51
|
fileExtension: '.yml',
|
|
52
|
-
isAppend: true
|
|
52
|
+
isAppend: true,
|
|
53
|
+
fromFile: 'relationShip/updateComplete/sns-out/data.js'
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
];
|
|
@@ -69,7 +69,8 @@ function createSourceSnsOut(_izContext, srcPath) {
|
|
|
69
69
|
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
70
70
|
saveFileName: SAVE_FILE_NAME.snsOutYaml,
|
|
71
71
|
fileExtension: '.yml',
|
|
72
|
-
isAppend: true
|
|
72
|
+
isAppend: true,
|
|
73
|
+
fromFile: 'resourceYaml/sns-out/data.js'
|
|
73
74
|
}
|
|
74
75
|
});
|
|
75
76
|
}
|
package/src/generateCode/resourceYamlComponent/sns-out/defaultSnsOutForFindDataAndProcessLogical.js
CHANGED
|
@@ -55,7 +55,8 @@ function createDataForDefaultSnsOut(_izContext, srcPath) {
|
|
|
55
55
|
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
56
56
|
saveFileName: SAVE_FILE_NAME.snsOutYaml,
|
|
57
57
|
fileExtension: '.yml',
|
|
58
|
-
isAppend: true
|
|
58
|
+
isAppend: true,
|
|
59
|
+
fromFile: 'resourceYaml/sns-out/defaultSnsOut.js'
|
|
59
60
|
}
|
|
60
61
|
});
|
|
61
62
|
}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
##--------- [Create Topic Out]
|
|
2
|
-
Out<%-
|
|
2
|
+
Out<%- queueName %>:
|
|
3
3
|
Type: AWS::SNS::Topic
|
|
4
4
|
Properties:
|
|
5
5
|
DisplayName: "SNS Message out"
|
|
6
|
-
TopicName: ${self:custom.iz_serviceTag}_${self:custom.iz_stage}_<%-
|
|
7
|
-
|
|
8
|
-
<%_ function firstLetterUpperCase(text) {
|
|
9
|
-
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
10
|
-
} _%>
|
|
6
|
+
TopicName: ${self:custom.iz_serviceTag}_${self:custom.iz_stage}_<%- queueName %>_Out
|
package/src/generateCode.js
CHANGED
|
@@ -64,6 +64,7 @@ async function generateCodeWithTemplate(
|
|
|
64
64
|
try {
|
|
65
65
|
const startTime = Date.now();
|
|
66
66
|
const appPath = path.join(rootServicePath, '/app');
|
|
67
|
+
const schemasPath = path.join(appPath, '/src/schemas');
|
|
67
68
|
console.info(
|
|
68
69
|
`[INFO] [generateCode] STATUS=START | path=${rootServicePath}`
|
|
69
70
|
);
|
|
@@ -73,15 +74,12 @@ async function generateCodeWithTemplate(
|
|
|
73
74
|
const fetchStartTime = Date.now();
|
|
74
75
|
const [allLocalFlowSchemas, allObjSchemas, allLocalRelationshipSchemas] =
|
|
75
76
|
await Promise.all([
|
|
76
|
-
getObjectSchema.getAllLocalFlowSchemas(_izContext,
|
|
77
|
+
getObjectSchema.getAllLocalFlowSchemas(_izContext, schemasPath),
|
|
77
78
|
getObjectSchema.getAllLocalObjectSchemasWithHierarchy(
|
|
78
79
|
_izContext,
|
|
79
|
-
|
|
80
|
+
schemasPath
|
|
80
81
|
),
|
|
81
|
-
getObjectSchema.getAllLocalRelationshipSchema(
|
|
82
|
-
_izContext,
|
|
83
|
-
rootServicePath
|
|
84
|
-
)
|
|
82
|
+
getObjectSchema.getAllLocalRelationshipSchema(_izContext, schemasPath)
|
|
85
83
|
]);
|
|
86
84
|
|
|
87
85
|
const fetchDuration = Date.now() - fetchStartTime;
|
|
@@ -145,6 +143,7 @@ async function generateCodeWithTemplate(
|
|
|
145
143
|
appPath,
|
|
146
144
|
allCreateSource
|
|
147
145
|
);
|
|
146
|
+
|
|
148
147
|
allCreateSource.push(...createSourceRole);
|
|
149
148
|
const roleStr = `items=${allCreateSource.length} roles=${createSourceRole.length}`;
|
|
150
149
|
console.info(
|
|
@@ -156,6 +155,7 @@ async function generateCodeWithTemplate(
|
|
|
156
155
|
console.info('[INFO] [generateCode] STATUS=VALIDATING| source items...');
|
|
157
156
|
for (const item of allCreateSource) {
|
|
158
157
|
if (!item?.templatePath || !item?.templateData || !item?.setting) {
|
|
158
|
+
console.debug('###### error item:', item);
|
|
159
159
|
throw new Error(
|
|
160
160
|
`[generateCode] invalid source item: ${JSON.stringify(item)}`
|
|
161
161
|
);
|
|
@@ -163,6 +163,8 @@ async function generateCodeWithTemplate(
|
|
|
163
163
|
const { templatePath, templateData, setting } = item;
|
|
164
164
|
setting.checkCreateSourcePass = true;
|
|
165
165
|
|
|
166
|
+
// console.debug('####### item:', item);
|
|
167
|
+
|
|
166
168
|
const [status, errors] = await createSource(
|
|
167
169
|
readFileSync(templatePath, 'utf8'),
|
|
168
170
|
templateData,
|
|
@@ -170,7 +172,7 @@ async function generateCodeWithTemplate(
|
|
|
170
172
|
);
|
|
171
173
|
if (!status) {
|
|
172
174
|
console.error('[generateCode] validation failed:', errors);
|
|
173
|
-
|
|
175
|
+
console.debug('###### item:', item);
|
|
174
176
|
throw new Error(errors);
|
|
175
177
|
}
|
|
176
178
|
|
package/src/libs/Utils.js
CHANGED
|
@@ -18,8 +18,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
18
18
|
import yaml from 'yaml';
|
|
19
19
|
import fs from 'fs';
|
|
20
20
|
import path from 'path';
|
|
21
|
+
|
|
21
22
|
import { objectHash as hash } from '@izara_project/izara-shared-core';
|
|
22
23
|
|
|
24
|
+
import consts from '#libs/Consts.js';
|
|
25
|
+
const { SOURCE_PATH } = consts;
|
|
26
|
+
|
|
23
27
|
function firstLetterUpperCase(text) {
|
|
24
28
|
return text.charAt(0).toUpperCase() + text.slice(1);
|
|
25
29
|
}
|
|
@@ -128,6 +132,26 @@ function deleteFile(filePath) {
|
|
|
128
132
|
}
|
|
129
133
|
}
|
|
130
134
|
|
|
135
|
+
const savePath = {
|
|
136
|
+
resourceYamlFlowSchemaFlowTag: function (appPath, flowTag) {
|
|
137
|
+
return path.join(
|
|
138
|
+
appPath,
|
|
139
|
+
SOURCE_PATH.flowSchema,
|
|
140
|
+
firstLetterUpperCase(flowTag),
|
|
141
|
+
'MainHandler/',
|
|
142
|
+
'source/'
|
|
143
|
+
);
|
|
144
|
+
},
|
|
145
|
+
flowSchemaFlowTag: function (flowTag) {
|
|
146
|
+
return path.join(
|
|
147
|
+
SOURCE_PATH.flowSchema,
|
|
148
|
+
firstLetterUpperCase(flowTag),
|
|
149
|
+
'MainHandler/',
|
|
150
|
+
'source/'
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
|
|
131
155
|
export default {
|
|
132
156
|
firstLetterUpperCase,
|
|
133
157
|
firstLetterLowerCase,
|
|
@@ -135,5 +159,6 @@ export default {
|
|
|
135
159
|
getLocalConfig,
|
|
136
160
|
checkValidTableYaml,
|
|
137
161
|
deleteFileInDir,
|
|
138
|
-
deleteFile
|
|
162
|
+
deleteFile,
|
|
163
|
+
savePath
|
|
139
164
|
};
|
|
@@ -1,64 +0,0 @@
|
|
|
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
|
-
import path from 'path';
|
|
19
|
-
import { fileURLToPath } from 'url';
|
|
20
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
21
|
-
const __dirname = path.dirname(__filename);
|
|
22
|
-
|
|
23
|
-
import consts from '../../../../../../libs/Consts.js';
|
|
24
|
-
import utils from '../../../../../../libs/Utils.js';
|
|
25
|
-
|
|
26
|
-
const { SOURCE_PATH, HANDLER } = consts;
|
|
27
|
-
const { firstLetterUpperCase: upperCase } = utils;
|
|
28
|
-
|
|
29
|
-
const templatePath = path.join(__dirname, 'template.ejs');
|
|
30
|
-
/**
|
|
31
|
-
* receive objectSchema
|
|
32
|
-
* create data for WebScoket handler template
|
|
33
|
-
*
|
|
34
|
-
* @param {Object} objectSchema
|
|
35
|
-
* @return {{templatePath, templateData,setting}}
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
39
|
-
let functionName = 'Process' + upperCase(flowSchema.flowTag);
|
|
40
|
-
let handlerType = upperCase(HANDLER.hdrSqs);
|
|
41
|
-
let queueName = 'Process' + upperCase(flowSchema.flowTag) + handlerType;
|
|
42
|
-
|
|
43
|
-
return {
|
|
44
|
-
templatePath: templatePath,
|
|
45
|
-
templateData: {
|
|
46
|
-
functionName,
|
|
47
|
-
handlerType,
|
|
48
|
-
queueName
|
|
49
|
-
},
|
|
50
|
-
setting: {
|
|
51
|
-
savePath: path.join(
|
|
52
|
-
srcPath,
|
|
53
|
-
SOURCE_PATH.flowSchema,
|
|
54
|
-
upperCase(flowSchema.flowTag),
|
|
55
|
-
'source/'
|
|
56
|
-
),
|
|
57
|
-
saveFileName: `${functionName}_${handlerType}`,
|
|
58
|
-
fileExtension: '.js',
|
|
59
|
-
isAppend: false
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export default createSourceParams;
|
|
@@ -1,75 +0,0 @@
|
|
|
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
|
-
import path from 'path';
|
|
19
|
-
import { fileURLToPath } from 'url';
|
|
20
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
21
|
-
const __dirname = path.dirname(__filename);
|
|
22
|
-
|
|
23
|
-
import consts from '../../../../../libs/Consts.js';
|
|
24
|
-
import utils from '../../../../../libs/Utils.js';
|
|
25
|
-
|
|
26
|
-
const { SOURCE_PATH, SAVE_FILE_NAME } = consts;
|
|
27
|
-
const { firstLetterUpperCase: upperCase } = utils;
|
|
28
|
-
|
|
29
|
-
const templatePath = path.join(
|
|
30
|
-
__dirname,
|
|
31
|
-
'../../../../resourceYaml/sns-out/template.ejs'
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* create data for dynamoDbYaml tempalte from objectSchema
|
|
36
|
-
* return array of dynamoDb data
|
|
37
|
-
* because one objectSchema can create multiple dynamoDb table
|
|
38
|
-
*
|
|
39
|
-
* @param {Object} _izContext
|
|
40
|
-
* @param {String} saveFilePath
|
|
41
|
-
* @returns {Object[]} - data of multiple dynamoDb template
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
|
-
function createDataForDefaultSnsInSqs(_izContext, flowSchema, srcPath) {
|
|
45
|
-
let resultsForCreateDefaultSnsInSqs = [];
|
|
46
|
-
let flowSteps = Object.keys(flowSchema.flowSteps);
|
|
47
|
-
const setting = {
|
|
48
|
-
initialData: 'Resources:\n',
|
|
49
|
-
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
50
|
-
saveFileName: SAVE_FILE_NAME.snsOutYaml,
|
|
51
|
-
fileExtension: '.yml',
|
|
52
|
-
isAppend: true
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
let topicOut = `${upperCase(flowSchema.flowTag)}`;
|
|
56
|
-
|
|
57
|
-
const generatedSnsTopicInForFlowSchema = [];
|
|
58
|
-
if (flowSteps.includes('Out')) {
|
|
59
|
-
generatedSnsTopicInForFlowSchema.push({
|
|
60
|
-
queueName: upperCase(topicOut)
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
for (let defaultSnsInSqsData of generatedSnsTopicInForFlowSchema) {
|
|
65
|
-
resultsForCreateDefaultSnsInSqs.push({
|
|
66
|
-
templatePath: templatePath,
|
|
67
|
-
templateData: defaultSnsInSqsData,
|
|
68
|
-
setting: setting
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return resultsForCreateDefaultSnsInSqs;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export default createDataForDefaultSnsInSqs;
|