@izara_project/izara-core-generate-service-code 1.0.22 → 1.0.23
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 +3 -3
- package/src/generateCode/generateFlowSchema/event/eventBridgeComponent/functionYaml/data.js +2 -2
- package/src/generateCode/generateFlowSchema/event/eventBridgeComponent/handler/inv/data.js +3 -3
- package/src/generateCode/generateFlowSchema/event/eventBridgeComponent/index.js +4 -13
- package/src/generateCode/generateFlowSchema/event/eventBridgeComponent/mainFunction/data.js +2 -2
- package/src/generateCode/generateFlowSchema/event/extTopicComponent/index.js +5 -9
- package/src/generateCode/generateFlowSchema/event/extTopicComponent/process/functionYaml/data.js +4 -4
- package/src/generateCode/generateFlowSchema/event/extTopicComponent/process/handler/data.js +2 -2
- package/src/generateCode/generateFlowSchema/event/extTopicComponent/sns-in-sqs/data.js +2 -2
- package/src/generateCode/generateFlowSchema/event/extTopicComponent/sns-out/data.js +2 -2
- package/src/generateCode/generateFlowSchema/event/lambdaSyncApiComponent/functionYaml/data.js +3 -3
- package/src/generateCode/generateFlowSchema/event/lambdaSyncApiComponent/handler/data.js +2 -2
- package/src/generateCode/generateFlowSchema/event/lambdaSyncApiComponent/index.js +3 -7
- package/src/generateCode/generateFlowSchema/event/lambdaSyncInvComponent/functionYaml/data.js +2 -2
- package/src/generateCode/generateFlowSchema/event/lambdaSyncInvComponent/handler/data.js +2 -2
- package/src/generateCode/generateFlowSchema/event/lambdaSyncInvComponent/index.js +3 -7
- package/src/generateCode/generateFlowSchema/event/ownTopicComponent/endpointComponent/functionYaml/data.js +3 -3
- package/src/generateCode/generateFlowSchema/event/ownTopicComponent/endpointComponent/handler/data.js +3 -3
- package/src/generateCode/generateFlowSchema/event/ownTopicComponent/flowSchemaComponent/functionYaml/data.js +3 -3
- package/src/generateCode/generateFlowSchema/event/ownTopicComponent/flowSchemaComponent/handler/data.js +2 -2
- package/src/generateCode/generateFlowSchema/event/ownTopicComponent/flowSchemaComponent/mainFunction/data.js +2 -2
- package/src/generateCode/generateFlowSchema/event/ownTopicComponent/index.js +8 -24
- package/src/generateCode/generateFlowSchema/event/ownTopicComponent/sns-in/data.js +2 -2
- package/src/generateCode/generateFlowSchema/event/ownTopicComponent/sns-out/data.js +2 -2
- package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/data.js +3 -3
- package/src/generateCode/generateFlowSchema/event/s3Component/index.js +23 -55
- package/src/generateCode/generateFlowSchema/event/s3Component/upload/confirmReserved/functionYaml/data.js +3 -7
- package/src/generateCode/generateFlowSchema/event/s3Component/upload/confirmReserved/handler/data.js +3 -7
- package/src/generateCode/generateFlowSchema/event/s3Component/upload/confirmReserved/mainFunction/data.js +3 -7
- package/src/generateCode/generateFlowSchema/event/s3Component/upload/confirmReserved/queue/data.js +2 -2
- package/src/generateCode/generateFlowSchema/event/s3Component/upload/createObject/functionYaml/data.js +3 -7
- package/src/generateCode/generateFlowSchema/event/s3Component/upload/createObject/handler/data.js +3 -7
- package/src/generateCode/generateFlowSchema/event/s3Component/upload/createObject/mainFunction/data.js +3 -7
- package/src/generateCode/generateFlowSchema/event/s3Component/upload/preSignUrl/createPreSignUrl/functionYaml/data.js +3 -7
- package/src/generateCode/generateFlowSchema/event/s3Component/upload/preSignUrl/createPreSignUrl/handler/data.js +3 -7
- package/src/generateCode/generateFlowSchema/event/s3Component/upload/preSignUrl/createPreSignUrl/mainFunction/data.js +3 -7
- package/src/generateCode/generateFlowSchema/event/s3Component/upload/preSignUrl/createPreSignUrl/queue/data.js +2 -2
- package/src/generateCode/generateFlowSchema/event/s3Component/upload/preSignUrl/reservedLimit/functionYaml/data.js +6 -10
- package/src/generateCode/generateFlowSchema/event/s3Component/upload/preSignUrl/reservedLimit/handler/data.js +3 -7
- package/src/generateCode/generateFlowSchema/event/s3Component/upload/preSignUrl/reservedLimit/mainFunction/data.js +3 -7
- package/src/generateCode/generateFlowSchema/event/s3Component/upload/preSignUrl/reservedLimit/sqs/data.js +2 -2
- package/src/generateCode/generateFlowSchema/event/s3Component/upload/processFile/functionYml/HdrS3/data.js +3 -7
- package/src/generateCode/generateFlowSchema/event/s3Component/upload/processFile/handler/handlerS3/data.js +3 -7
- package/src/generateCode/generateFlowSchema/event/s3Component/upload/processFile/mainFunction/data.js +3 -7
- package/src/generateCode/generateFlowSchema/event/s3Component/upload/relate/S3/data.js +4 -4
- package/src/generateCode/generateFlowSchema/event/s3Component/upload/relate/sns-out/data.js +2 -2
- package/src/generateCode/generateFlowSchema/event/s3Component/websocket/dynamoDb/ReservedTableData.js +2 -2
- package/src/generateCode/generateFlowSchema/flowSchemaMainFunction/data.js +4 -8
- package/src/generateCode/generateFlowSchema/flowStep/flowStep.js +7 -2
- package/src/generateCode/generateFlowSchema/libs/data.js +3 -7
- package/src/generateCode/generateSchema/actionEndpointComponent/mainFunction/create/main/template.ejs +1 -1
- package/src/libs/Consts.js +9 -12
package/package.json
CHANGED
|
@@ -85,14 +85,14 @@ async function generateTemplateDataFromFlowSchema(
|
|
|
85
85
|
|
|
86
86
|
// ── per-flowSchema resources ─────────────────────────────────────────
|
|
87
87
|
const perFlowParams = [
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
createWebSocketGenerateCodeLibs(_izContext, flowSchema, appPath),
|
|
89
|
+
!flowSchema.event.includes('s3')
|
|
90
90
|
? await createFlowSchemaEndpointMainFunction(
|
|
91
91
|
_izContext,
|
|
92
92
|
flowSchema,
|
|
93
93
|
appPath
|
|
94
94
|
)
|
|
95
|
-
:
|
|
95
|
+
: {},
|
|
96
96
|
...buildFlowStepResources(_izContext, flowSchema, appPath)
|
|
97
97
|
];
|
|
98
98
|
|
|
@@ -45,7 +45,7 @@ const templatePath = path.join(__dirname, 'template.ejs');
|
|
|
45
45
|
* @param {Object} objectSchema
|
|
46
46
|
* @return {{templatePath, templateData,setting}}
|
|
47
47
|
*/
|
|
48
|
-
function createSourceParams(_izContext, flowSchema,
|
|
48
|
+
function createSourceParams(_izContext, flowSchema, appPath) {
|
|
49
49
|
const functionName = upperCase(FUNCTION_NAME.flowSchemaEventBridge);
|
|
50
50
|
// const action = SOURCE_GENERATE_IAM_ROLE.EventBridge;
|
|
51
51
|
const functionNameConfig = upperCase(SOURCE_GENERATE_IAM_ROLE.EventBridge);
|
|
@@ -153,7 +153,7 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
|
153
153
|
schedules
|
|
154
154
|
},
|
|
155
155
|
setting: {
|
|
156
|
-
savePath: path.join(
|
|
156
|
+
savePath: path.join(appPath, SOURCE_PATH.appYaml),
|
|
157
157
|
saveFileName: SAVE_FILE_NAME.flowSchemaYaml,
|
|
158
158
|
fileExtension: '.yml',
|
|
159
159
|
isAppend: true
|
|
@@ -33,10 +33,10 @@ const templatePath = path.join(__dirname, 'template.ejs');
|
|
|
33
33
|
*
|
|
34
34
|
* @param {Object} _izContext
|
|
35
35
|
* @param {Object} flowSchema
|
|
36
|
-
* @param {String}
|
|
36
|
+
* @param {String} appPath
|
|
37
37
|
* @return {Object[]}
|
|
38
38
|
*/
|
|
39
|
-
function data(_izContext, flowSchema,
|
|
39
|
+
function data(_izContext, flowSchema, appPath) {
|
|
40
40
|
const handler = HANDLER.hdrInv;
|
|
41
41
|
const flowTag = flowSchema.flowTag;
|
|
42
42
|
// const action = SOURCE_GENERATE_IAM_ROLE.EventBridge;
|
|
@@ -54,7 +54,7 @@ function data(_izContext, flowSchema, srcPath) {
|
|
|
54
54
|
},
|
|
55
55
|
setting: {
|
|
56
56
|
savePath: path.join(
|
|
57
|
-
|
|
57
|
+
appPath,
|
|
58
58
|
SOURCE_PATH.flowSchemaEventBridge,
|
|
59
59
|
flowSchema.flowTag,
|
|
60
60
|
'source/'
|
|
@@ -2,22 +2,13 @@ import createFlowSchemaEventBridgeFunctionYaml from './functionYaml/data.js';
|
|
|
2
2
|
import createFlowSchemaEventBridgeHandler from './handler/inv/data.js';
|
|
3
3
|
import createFlowSchemaEventBridgeMainFunction from './mainFunction/data.js';
|
|
4
4
|
|
|
5
|
-
function createEventBridgeComponent(_izContext, flowSchema,
|
|
5
|
+
function createEventBridgeComponent(_izContext, flowSchema, appPath) {
|
|
6
6
|
const component = [
|
|
7
|
-
createFlowSchemaEventBridgeHandler(_izContext, flowSchema,
|
|
8
|
-
createFlowSchemaEventBridgeMainFunction(
|
|
9
|
-
|
|
10
|
-
flowSchema,
|
|
11
|
-
saveFilePath
|
|
12
|
-
),
|
|
13
|
-
createFlowSchemaEventBridgeFunctionYaml(
|
|
14
|
-
_izContext,
|
|
15
|
-
flowSchema,
|
|
16
|
-
saveFilePath
|
|
17
|
-
)
|
|
7
|
+
createFlowSchemaEventBridgeHandler(_izContext, flowSchema, appPath),
|
|
8
|
+
createFlowSchemaEventBridgeMainFunction(_izContext, flowSchema, appPath),
|
|
9
|
+
createFlowSchemaEventBridgeFunctionYaml(_izContext, flowSchema, appPath)
|
|
18
10
|
];
|
|
19
11
|
|
|
20
|
-
console.info('generateEventBridgeComponent ✅');
|
|
21
12
|
return component;
|
|
22
13
|
}
|
|
23
14
|
|
|
@@ -35,7 +35,7 @@ const templatePath = path.join(__dirname, 'template.ejs');
|
|
|
35
35
|
* @param {Object} flowSchema
|
|
36
36
|
* @return {{ templatePath, templateData, setting } }
|
|
37
37
|
*/
|
|
38
|
-
function data(_izContext, flowSchema,
|
|
38
|
+
function data(_izContext, flowSchema, appPath) {
|
|
39
39
|
// const handler = HANDLER.hdrInv;
|
|
40
40
|
const flowTag = flowSchema.flowTag;
|
|
41
41
|
// const functionName = "EventBridge" + upperCase(handler);
|
|
@@ -52,7 +52,7 @@ function data(_izContext, flowSchema, srcPath) {
|
|
|
52
52
|
},
|
|
53
53
|
setting: {
|
|
54
54
|
savePath: path.join(
|
|
55
|
-
|
|
55
|
+
appPath,
|
|
56
56
|
SOURCE_PATH.flowSchemaEventBridge,
|
|
57
57
|
flowSchema.flowTag,
|
|
58
58
|
'source/'
|
|
@@ -3,16 +3,12 @@ import createExternalSqsHandler from './process/handler/data.js';
|
|
|
3
3
|
import createExternalTopicSnsInSqs from './sns-in-sqs/data.js';
|
|
4
4
|
import createExternalTopicSnsOut from './sns-out/data.js';
|
|
5
5
|
|
|
6
|
-
async function createExternalTopicComponent(
|
|
7
|
-
_izContext,
|
|
8
|
-
flowSchema,
|
|
9
|
-
saveFilePath
|
|
10
|
-
) {
|
|
6
|
+
async function createExternalTopicComponent(_izContext, flowSchema, appPath) {
|
|
11
7
|
const component = [
|
|
12
|
-
createExternalSqsFunctionYaml(_izContext, flowSchema,
|
|
13
|
-
createExternalSqsHandler(_izContext, flowSchema,
|
|
14
|
-
...createExternalTopicSnsInSqs(_izContext, flowSchema,
|
|
15
|
-
...createExternalTopicSnsOut(_izContext, flowSchema,
|
|
8
|
+
createExternalSqsFunctionYaml(_izContext, flowSchema, appPath),
|
|
9
|
+
createExternalSqsHandler(_izContext, flowSchema, appPath),
|
|
10
|
+
...createExternalTopicSnsInSqs(_izContext, flowSchema, appPath),
|
|
11
|
+
...createExternalTopicSnsOut(_izContext, flowSchema, appPath)
|
|
16
12
|
];
|
|
17
13
|
|
|
18
14
|
return component;
|
package/src/generateCode/generateFlowSchema/event/extTopicComponent/process/functionYaml/data.js
CHANGED
|
@@ -53,10 +53,10 @@ const templatePath = path.join(__dirname, 'template.ejs');
|
|
|
53
53
|
* Creates source parameters for function YAML generation
|
|
54
54
|
* @param {Object} _izContext - The Izara context object
|
|
55
55
|
* @param {Object} flowSchema - The flow schema configuration
|
|
56
|
-
* @param {string}
|
|
56
|
+
* @param {string} appPath - The source path for the project
|
|
57
57
|
* @returns {Promise<Array>} Array containing template configuration object
|
|
58
58
|
*/
|
|
59
|
-
async function createSourceParams(_izContext, flowSchema,
|
|
59
|
+
async function createSourceParams(_izContext, flowSchema, appPath) {
|
|
60
60
|
let functionName = 'Process' + upperCase(flowSchema.flowTag);
|
|
61
61
|
let handlerType = upperCase(HANDLER.hdrSqs);
|
|
62
62
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
@@ -92,7 +92,7 @@ async function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
|
92
92
|
.getLocalObjectSchemas(
|
|
93
93
|
_izContext,
|
|
94
94
|
[flowSchema.objType.objectType],
|
|
95
|
-
path.join(
|
|
95
|
+
path.join(appPath, 'src/schemas')
|
|
96
96
|
)
|
|
97
97
|
.then(res => res.records[0]);
|
|
98
98
|
if (!objectSchema) {
|
|
@@ -147,7 +147,7 @@ async function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
|
147
147
|
queueName
|
|
148
148
|
},
|
|
149
149
|
setting: {
|
|
150
|
-
savePath: path.join(
|
|
150
|
+
savePath: path.join(appPath, SOURCE_PATH.appYaml),
|
|
151
151
|
saveFileName: SAVE_FILE_NAME.flowSchemaYaml,
|
|
152
152
|
fileExtension: '.yml',
|
|
153
153
|
isAppend: true
|
|
@@ -35,7 +35,7 @@ const templatePath = path.join(__dirname, 'template.ejs');
|
|
|
35
35
|
* @return {{templatePath, templateData,setting}}
|
|
36
36
|
*/
|
|
37
37
|
|
|
38
|
-
function createSourceParams(_izContext, flowSchema,
|
|
38
|
+
function createSourceParams(_izContext, flowSchema, appPath) {
|
|
39
39
|
let functionName = 'Process' + upperCase(flowSchema.flowTag);
|
|
40
40
|
let handlerType = upperCase(HANDLER.hdrSqs);
|
|
41
41
|
let queueName = 'Process' + upperCase(flowSchema.flowTag) + handlerType;
|
|
@@ -49,7 +49,7 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
|
49
49
|
},
|
|
50
50
|
setting: {
|
|
51
51
|
savePath: path.join(
|
|
52
|
-
|
|
52
|
+
appPath,
|
|
53
53
|
SOURCE_PATH.flowSchema,
|
|
54
54
|
upperCase(flowSchema.flowTag),
|
|
55
55
|
'MainHandler/',
|
|
@@ -37,12 +37,12 @@ const templatePath = path.join(__dirname, 'template.ejs');
|
|
|
37
37
|
* @returns {Object[]} - data of multiple dynamoDb template
|
|
38
38
|
*/
|
|
39
39
|
|
|
40
|
-
function createDataForDefaultSnsInSqs(_izContext, flowSchema,
|
|
40
|
+
function createDataForDefaultSnsInSqs(_izContext, flowSchema, appPath) {
|
|
41
41
|
let resultsForCreateDefaultSnsInSqs = [];
|
|
42
42
|
let flowSteps = Object.keys(flowSchema.flowSteps);
|
|
43
43
|
const setting = {
|
|
44
44
|
initialData: 'Resources:\n',
|
|
45
|
-
savePath: path.join(
|
|
45
|
+
savePath: path.join(appPath, SOURCE_PATH.resourceYaml),
|
|
46
46
|
saveFileName: SAVE_FILE_NAME.snsInSqsYaml,
|
|
47
47
|
fileExtension: '.yml',
|
|
48
48
|
isAppend: true
|
|
@@ -41,12 +41,12 @@ const templatePath = path.join(
|
|
|
41
41
|
* @returns {Object[]} - data of multiple dynamoDb template
|
|
42
42
|
*/
|
|
43
43
|
|
|
44
|
-
function createDataForDefaultSnsInSqs(_izContext, flowSchema,
|
|
44
|
+
function createDataForDefaultSnsInSqs(_izContext, flowSchema, appPath) {
|
|
45
45
|
let resultsForCreateDefaultSnsInSqs = [];
|
|
46
46
|
let flowSteps = Object.keys(flowSchema.flowSteps);
|
|
47
47
|
const setting = {
|
|
48
48
|
initialData: 'Resources:\n',
|
|
49
|
-
savePath: path.join(
|
|
49
|
+
savePath: path.join(appPath, SOURCE_PATH.resourceYaml),
|
|
50
50
|
saveFileName: SAVE_FILE_NAME.snsOutYaml,
|
|
51
51
|
fileExtension: '.yml',
|
|
52
52
|
isAppend: true
|
package/src/generateCode/generateFlowSchema/event/lambdaSyncApiComponent/functionYaml/data.js
CHANGED
|
@@ -41,12 +41,12 @@ const templatePath = path.join(__dirname, 'template.ejs');
|
|
|
41
41
|
* @param {Object} objectSchema
|
|
42
42
|
* @return {{templatePath, templateData,setting}}
|
|
43
43
|
*/
|
|
44
|
-
function createSourceParamsApi(_izContext, flowSchema,
|
|
44
|
+
function createSourceParamsApi(_izContext, flowSchema, appPath) {
|
|
45
45
|
let functionName = 'Process' + upperCase(flowSchema.flowTag);
|
|
46
46
|
let handlerType = upperCase(HANDLER.hdrApi);
|
|
47
47
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
48
48
|
|
|
49
|
-
const configPath = path.join(
|
|
49
|
+
const configPath = path.join(appPath, '../config/serverless.config.yml');
|
|
50
50
|
const serverlessConfig = fs.readFileSync(configPath, 'utf8');
|
|
51
51
|
const config = yaml.parse(serverlessConfig);
|
|
52
52
|
const serviceTag = config.main_config.iz_serviceTag;
|
|
@@ -69,7 +69,7 @@ function createSourceParamsApi(_izContext, flowSchema, srcPath) {
|
|
|
69
69
|
serviceTag: serviceTag
|
|
70
70
|
},
|
|
71
71
|
setting: {
|
|
72
|
-
savePath: path.join(
|
|
72
|
+
savePath: path.join(appPath, SOURCE_PATH.appYaml),
|
|
73
73
|
saveFileName: SAVE_FILE_NAME.flowSchemaYaml,
|
|
74
74
|
fileExtension: '.yml',
|
|
75
75
|
isAppend: true
|
|
@@ -35,7 +35,7 @@ const templatePath = path.join(__dirname, 'template.ejs');
|
|
|
35
35
|
* @param {Object} objectSchema
|
|
36
36
|
* @return {{templatePath, templateData,setting}}
|
|
37
37
|
*/
|
|
38
|
-
function createSourceParamsApi(_izContext, flowSchema,
|
|
38
|
+
function createSourceParamsApi(_izContext, flowSchema, appPath) {
|
|
39
39
|
const functionName = 'Process' + upperCase(flowSchema.flowTag);
|
|
40
40
|
const handlerType = upperCase(HANDLER.hdrApi);
|
|
41
41
|
|
|
@@ -49,7 +49,7 @@ function createSourceParamsApi(_izContext, flowSchema, srcPath) {
|
|
|
49
49
|
},
|
|
50
50
|
setting: {
|
|
51
51
|
savePath: path.join(
|
|
52
|
-
|
|
52
|
+
appPath,
|
|
53
53
|
SOURCE_PATH.flowSchema,
|
|
54
54
|
upperCase(flowSchema.flowTag),
|
|
55
55
|
'MainHandler/',
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import createFlowSchemaLambdaSyncFunctionYamlApi from './functionYaml/data.js';
|
|
2
2
|
import createFlowSchemaLambdaSyncHandlerApi from './handler/data.js';
|
|
3
3
|
|
|
4
|
-
function createLambdaSyncApiComponent(_izContext, flowSchema,
|
|
4
|
+
function createLambdaSyncApiComponent(_izContext, flowSchema, appPath) {
|
|
5
5
|
const component = [
|
|
6
|
-
createFlowSchemaLambdaSyncFunctionYamlApi(
|
|
7
|
-
|
|
8
|
-
flowSchema,
|
|
9
|
-
saveFilePath
|
|
10
|
-
),
|
|
11
|
-
createFlowSchemaLambdaSyncHandlerApi(_izContext, flowSchema, saveFilePath)
|
|
6
|
+
createFlowSchemaLambdaSyncFunctionYamlApi(_izContext, flowSchema, appPath),
|
|
7
|
+
createFlowSchemaLambdaSyncHandlerApi(_izContext, flowSchema, appPath)
|
|
12
8
|
];
|
|
13
9
|
|
|
14
10
|
return component;
|
package/src/generateCode/generateFlowSchema/event/lambdaSyncInvComponent/functionYaml/data.js
CHANGED
|
@@ -38,7 +38,7 @@ const templatePath = path.join(__dirname, 'template.ejs');
|
|
|
38
38
|
* @param {Object} objectSchema
|
|
39
39
|
* @return {{templatePath, templateData,setting}}
|
|
40
40
|
*/
|
|
41
|
-
function createSourceParamsInvoke(_izContext, flowSchema,
|
|
41
|
+
function createSourceParamsInvoke(_izContext, flowSchema, appPath) {
|
|
42
42
|
const functionName = 'Process' + upperCase(flowSchema.flowTag);
|
|
43
43
|
const handlerType = upperCase(HANDLER.hdrInv);
|
|
44
44
|
const additionalResourcePermission = defaultIamRolePerAction();
|
|
@@ -59,7 +59,7 @@ function createSourceParamsInvoke(_izContext, flowSchema, srcPath) {
|
|
|
59
59
|
roleName: upperCase(flowSchema.flowTag)
|
|
60
60
|
},
|
|
61
61
|
setting: {
|
|
62
|
-
savePath: path.join(
|
|
62
|
+
savePath: path.join(appPath, SOURCE_PATH.appYaml),
|
|
63
63
|
saveFileName: SAVE_FILE_NAME.flowSchemaYaml,
|
|
64
64
|
fileExtension: '.yml',
|
|
65
65
|
isAppend: true
|
|
@@ -35,7 +35,7 @@ const templatePath = path.join(__dirname, 'template.ejs');
|
|
|
35
35
|
* @return {{templatePath, templateData,setting}}
|
|
36
36
|
*/
|
|
37
37
|
|
|
38
|
-
function createSourceParamsInvoke(_izContext, flowSchema,
|
|
38
|
+
function createSourceParamsInvoke(_izContext, flowSchema, appPath) {
|
|
39
39
|
const functionName = 'Process' + upperCase(flowSchema.flowTag);
|
|
40
40
|
const handlerType = upperCase(HANDLER.hdrInv);
|
|
41
41
|
|
|
@@ -47,7 +47,7 @@ function createSourceParamsInvoke(_izContext, flowSchema, srcPath) {
|
|
|
47
47
|
},
|
|
48
48
|
setting: {
|
|
49
49
|
savePath: path.join(
|
|
50
|
-
|
|
50
|
+
appPath,
|
|
51
51
|
SOURCE_PATH.flowSchema,
|
|
52
52
|
upperCase(flowSchema.flowTag),
|
|
53
53
|
'MainHandler/',
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import createFlowSchemaLambdaSyncFunctionYamlInv from './functionYaml/data.js';
|
|
2
2
|
import createFlowSchemaLambdaSyncHandlerInv from './handler/data.js';
|
|
3
3
|
|
|
4
|
-
function CreateLambdaSyncInvokeComponent(_izContext, flowSchema,
|
|
4
|
+
function CreateLambdaSyncInvokeComponent(_izContext, flowSchema, appPath) {
|
|
5
5
|
const component = [
|
|
6
|
-
createFlowSchemaLambdaSyncFunctionYamlInv(
|
|
7
|
-
|
|
8
|
-
flowSchema,
|
|
9
|
-
saveFilePath
|
|
10
|
-
),
|
|
11
|
-
createFlowSchemaLambdaSyncHandlerInv(_izContext, flowSchema, saveFilePath)
|
|
6
|
+
createFlowSchemaLambdaSyncFunctionYamlInv(_izContext, flowSchema, appPath),
|
|
7
|
+
createFlowSchemaLambdaSyncHandlerInv(_izContext, flowSchema, appPath)
|
|
12
8
|
];
|
|
13
9
|
|
|
14
10
|
return component.flat();
|
|
@@ -55,7 +55,7 @@ const templatePath = path.join(__dirname, 'template.ejs');
|
|
|
55
55
|
* @return {{templatePath, templateData,setting}}
|
|
56
56
|
*/
|
|
57
57
|
|
|
58
|
-
async function createSourceParams(_izContext, flowSchema,
|
|
58
|
+
async function createSourceParams(_izContext, flowSchema, appPath) {
|
|
59
59
|
let createSources = [];
|
|
60
60
|
let functionName = 'Process' + upperCase(flowSchema.flowTag);
|
|
61
61
|
let handlerType = upperCase(HANDLER.hdrSqs);
|
|
@@ -64,7 +64,7 @@ async function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
|
64
64
|
let objectSchema;
|
|
65
65
|
|
|
66
66
|
let setting = {
|
|
67
|
-
savePath: path.join(
|
|
67
|
+
savePath: path.join(appPath, SOURCE_PATH.appYaml),
|
|
68
68
|
saveFileName: SAVE_FILE_NAME.flowSchemaYaml,
|
|
69
69
|
fileExtension: '.yml',
|
|
70
70
|
isAppend: true
|
|
@@ -95,7 +95,7 @@ async function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
|
95
95
|
.getLocalObjectSchemas(
|
|
96
96
|
_izContext,
|
|
97
97
|
[flowSchema.objType.objectType],
|
|
98
|
-
path.join(
|
|
98
|
+
path.join(appPath, 'src/schemas')
|
|
99
99
|
)
|
|
100
100
|
.then(res => res.records[0]);
|
|
101
101
|
if (!objectSchema) {
|
|
@@ -36,7 +36,7 @@ const dsqTemplatePath = path.join(__dirname, 'DsqHandlerTemplate.ejs');
|
|
|
36
36
|
* @param {Object} objectSchema
|
|
37
37
|
* @return {{templatePath, templateData,setting}}
|
|
38
38
|
*/
|
|
39
|
-
function createParamsForCreateSource(_izContext, flowSchema,
|
|
39
|
+
function createParamsForCreateSource(_izContext, flowSchema, appPath) {
|
|
40
40
|
const createSources = [];
|
|
41
41
|
const functionName = 'Process' + upperCase(flowSchema.flowTag);
|
|
42
42
|
const handlerTypeSqs = upperCase(HANDLER.hdrSqs);
|
|
@@ -52,7 +52,7 @@ function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
|
52
52
|
},
|
|
53
53
|
setting: {
|
|
54
54
|
savePath: path.join(
|
|
55
|
-
|
|
55
|
+
appPath,
|
|
56
56
|
SOURCE_PATH.flowSchema,
|
|
57
57
|
upperCase(flowSchema.flowTag),
|
|
58
58
|
'MainHandler/',
|
|
@@ -74,7 +74,7 @@ function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
|
74
74
|
},
|
|
75
75
|
setting: {
|
|
76
76
|
savePath: path.join(
|
|
77
|
-
|
|
77
|
+
appPath,
|
|
78
78
|
SOURCE_PATH.flowSchema,
|
|
79
79
|
upperCase(flowSchema.flowTag),
|
|
80
80
|
'MainHandler/',
|
|
@@ -48,13 +48,13 @@ const templatePath = path.join(__dirname, 'template.ejs');
|
|
|
48
48
|
*
|
|
49
49
|
* @param {object} _izContext - Izara context object, carrying environment and configuration info.
|
|
50
50
|
* @param {object} flowSchema - The schema object describing the flow; should at least contain `flowTag` and relevant route information.
|
|
51
|
-
* @param {string}
|
|
51
|
+
* @param {string} appPath - The file path for saving or referencing generated source artifacts.
|
|
52
52
|
* @returns {Array<Object>} Array of objects, each containing:
|
|
53
53
|
* - {string} templatePath: Path to the function EJS template.
|
|
54
54
|
* - {Object} templateData: Data passed to EJS when generating the function yaml.
|
|
55
55
|
* - {Object} setting: Save file and related parameters.
|
|
56
56
|
*/
|
|
57
|
-
function createSourceParams(_izContext, flowSchema,
|
|
57
|
+
function createSourceParams(_izContext, flowSchema, appPath) {
|
|
58
58
|
const additionalResourcePermission = defaultIamRolePerAction();
|
|
59
59
|
|
|
60
60
|
additionalResourcePermission.push(
|
|
@@ -119,7 +119,7 @@ function createSourceParams(_izContext, flowSchema, rootServicePath) {
|
|
|
119
119
|
roleName: upperCase(flowSchema.flowTag)
|
|
120
120
|
},
|
|
121
121
|
setting: {
|
|
122
|
-
savePath: path.join(
|
|
122
|
+
savePath: path.join(appPath, SOURCE_PATH.appYaml),
|
|
123
123
|
saveFileName: SAVE_FILE_NAME.flowSchemaYaml,
|
|
124
124
|
fileExtension: '.yml',
|
|
125
125
|
isAppend: true
|
|
@@ -36,7 +36,7 @@ const templatePath = path.join(__dirname, 'template.ejs');
|
|
|
36
36
|
* @return {{templatePath, templateData,setting}}
|
|
37
37
|
*/
|
|
38
38
|
|
|
39
|
-
function createParamsForCreateSource(_izContext, flowSchema,
|
|
39
|
+
function createParamsForCreateSource(_izContext, flowSchema, appPath) {
|
|
40
40
|
let functionName = upperCase(flowSchema.flowTag);
|
|
41
41
|
let handlerType = 'HdrWbs';
|
|
42
42
|
let route = flowSchema.flowTag;
|
|
@@ -49,7 +49,7 @@ function createParamsForCreateSource(_izContext, flowSchema, rootServicePath) {
|
|
|
49
49
|
},
|
|
50
50
|
setting: {
|
|
51
51
|
savePath: path.join(
|
|
52
|
-
|
|
52
|
+
appPath,
|
|
53
53
|
SOURCE_PATH.flowSchema,
|
|
54
54
|
upperCase(flowSchema.flowTag),
|
|
55
55
|
'MainHandler/',
|
|
@@ -36,7 +36,7 @@ const templatePath = path.join(__dirname, 'template.ejs');
|
|
|
36
36
|
* @return {{templatePath, templateData,setting}}
|
|
37
37
|
*/
|
|
38
38
|
|
|
39
|
-
function createParamsForCreateSource(_izContext, flowSchema,
|
|
39
|
+
function createParamsForCreateSource(_izContext, flowSchema, appPath) {
|
|
40
40
|
let functionName = upperCase(flowSchema.flowTag);
|
|
41
41
|
let topicArn = `${upperCase(flowSchema.flowTag)}_In`;
|
|
42
42
|
|
|
@@ -49,7 +49,7 @@ function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
|
49
49
|
},
|
|
50
50
|
setting: {
|
|
51
51
|
savePath: path.join(
|
|
52
|
-
|
|
52
|
+
appPath,
|
|
53
53
|
SOURCE_PATH.flowSchema,
|
|
54
54
|
upperCase(flowSchema.flowTag),
|
|
55
55
|
'MainHandler/',
|
|
@@ -9,38 +9,22 @@ import createFlowSchemaOwnTopicEndpointHandler from './endpointComponent/handler
|
|
|
9
9
|
import createFlowSchemaOwnTopicQueue from './sns-in/data.js';
|
|
10
10
|
import createFlowSchemaOwnTopicSnsOut from './sns-out/data.js';
|
|
11
11
|
|
|
12
|
-
async function createOwnTopicComponent(
|
|
13
|
-
_izContext,
|
|
14
|
-
flowSchema,
|
|
15
|
-
rootServicePath
|
|
16
|
-
) {
|
|
12
|
+
async function createOwnTopicComponent(_izContext, flowSchema, appPath) {
|
|
17
13
|
const component = [
|
|
18
14
|
// * OwnTopic
|
|
19
|
-
createFlowSchemaOwnTopicFunctionYaml(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
rootServicePath
|
|
23
|
-
),
|
|
24
|
-
createFlowSchemaOwnTopicHandler(_izContext, flowSchema, rootServicePath),
|
|
25
|
-
createFlowSchemaOwnTopicMainFunction(
|
|
26
|
-
_izContext,
|
|
27
|
-
flowSchema,
|
|
28
|
-
rootServicePath
|
|
29
|
-
),
|
|
15
|
+
createFlowSchemaOwnTopicFunctionYaml(_izContext, flowSchema, appPath),
|
|
16
|
+
createFlowSchemaOwnTopicHandler(_izContext, flowSchema, appPath),
|
|
17
|
+
createFlowSchemaOwnTopicMainFunction(_izContext, flowSchema, appPath),
|
|
30
18
|
// * Endpoint
|
|
31
19
|
...(await createFlowSchemaOwnTopicEndpointFunctionYaml(
|
|
32
20
|
_izContext,
|
|
33
21
|
flowSchema,
|
|
34
|
-
|
|
22
|
+
appPath
|
|
35
23
|
)),
|
|
36
|
-
...createFlowSchemaOwnTopicEndpointHandler(
|
|
37
|
-
_izContext,
|
|
38
|
-
flowSchema,
|
|
39
|
-
rootServicePath
|
|
40
|
-
),
|
|
24
|
+
...createFlowSchemaOwnTopicEndpointHandler(_izContext, flowSchema, appPath),
|
|
41
25
|
// * SNS Resources
|
|
42
|
-
...createFlowSchemaOwnTopicQueue(_izContext, flowSchema,
|
|
43
|
-
...createFlowSchemaOwnTopicSnsOut(_izContext, flowSchema,
|
|
26
|
+
...createFlowSchemaOwnTopicQueue(_izContext, flowSchema, appPath),
|
|
27
|
+
...createFlowSchemaOwnTopicSnsOut(_izContext, flowSchema, appPath)
|
|
44
28
|
];
|
|
45
29
|
|
|
46
30
|
return component;
|
|
@@ -43,13 +43,13 @@ const subscriptionSqsTemplatePath = path.join(__dirname, './sqsTemplate.ejs');
|
|
|
43
43
|
* @returns {Object[]} - data of multiple dynamoDb template
|
|
44
44
|
*/
|
|
45
45
|
|
|
46
|
-
function createDataForDefaultSnsInSqs(_izContext, flowSchema,
|
|
46
|
+
function createDataForDefaultSnsInSqs(_izContext, flowSchema, appPath) {
|
|
47
47
|
let resultsForCreateDefaultSnsInSqs = [];
|
|
48
48
|
let flowSteps = Object.keys(flowSchema.flowSteps);
|
|
49
49
|
// console.log("create topic by flowSteps", flowSteps)
|
|
50
50
|
const setting = {
|
|
51
51
|
initialData: 'Resources:\n',
|
|
52
|
-
savePath: path.join(
|
|
52
|
+
savePath: path.join(appPath, SOURCE_PATH.resourceYaml),
|
|
53
53
|
saveFileName: SAVE_FILE_NAME.snsInSqsYaml,
|
|
54
54
|
fileExtension: '.yml',
|
|
55
55
|
isAppend: true
|
|
@@ -42,7 +42,7 @@ const templatePath = path.join(
|
|
|
42
42
|
* @returns {Object[]} - data of multiple dynamoDb template
|
|
43
43
|
*/
|
|
44
44
|
|
|
45
|
-
function createDataForSnsOut(_izContext, flowSchema,
|
|
45
|
+
function createDataForSnsOut(_izContext, flowSchema, appPath) {
|
|
46
46
|
const resultsForCreateDefaultSnsInSqs = [];
|
|
47
47
|
|
|
48
48
|
const generatedSnsTopicOutForFlowSchema = [];
|
|
@@ -61,7 +61,7 @@ function createDataForSnsOut(_izContext, flowSchema, rootServicePath) {
|
|
|
61
61
|
templateData: defaultSnsOutData,
|
|
62
62
|
setting: {
|
|
63
63
|
initialData: 'Resources:\n',
|
|
64
|
-
savePath: path.join(
|
|
64
|
+
savePath: path.join(appPath, SOURCE_PATH.resourceYaml),
|
|
65
65
|
saveFileName: SAVE_FILE_NAME.snsOutYaml,
|
|
66
66
|
fileExtension: '.yml',
|
|
67
67
|
isAppend: true
|
package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/data.js
CHANGED
|
@@ -53,7 +53,7 @@ const triggerCacheTemplate = path.join(
|
|
|
53
53
|
* @param {Object} objectSchema
|
|
54
54
|
* @return {{templatePath, templateData,setting}}
|
|
55
55
|
*/
|
|
56
|
-
async function createParamsForCreateSource(_izContext, flowSchema,
|
|
56
|
+
async function createParamsForCreateSource(_izContext, flowSchema, appPath) {
|
|
57
57
|
let functionName = 'Process' + upperCase(flowSchema.flowTag);
|
|
58
58
|
let tableName = null;
|
|
59
59
|
if (
|
|
@@ -64,7 +64,7 @@ async function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
|
64
64
|
.getLocalObjectSchemas(
|
|
65
65
|
_izContext,
|
|
66
66
|
[flowSchema.objType.objectType],
|
|
67
|
-
path.join(
|
|
67
|
+
path.join(appPath, 'src/schemas')
|
|
68
68
|
)
|
|
69
69
|
.then(res => res.records[0]);
|
|
70
70
|
if (!objectSchema)
|
|
@@ -103,7 +103,7 @@ async function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
|
103
103
|
},
|
|
104
104
|
setting: {
|
|
105
105
|
savePath: path.join(
|
|
106
|
-
|
|
106
|
+
appPath,
|
|
107
107
|
SOURCE_PATH.flowSchema,
|
|
108
108
|
upperCase(flowSchema.flowTag),
|
|
109
109
|
'source/'
|