@izara_project/izara-market-library-service-schemas 1.0.1 → 1.0.2

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.
Files changed (31) hide show
  1. package/index.js +25 -0
  2. package/package.json +6 -2
  3. package/src/GenerateCodeLibs/index.js +24 -0
  4. package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +1373 -0
  5. package/src/MainLibs/index.js +24 -0
  6. package/src/MainLibs/src/Consts.js +0 -0
  7. package/src/MainLibs/src/Utils.js +27 -0
  8. package/src/SourceManager/index.js +23 -0
  9. package/src/SourceManager/src/CreateSource.js +182 -0
  10. package/src/SourceManager/src/Utils.js +50 -0
  11. package/src/TemplateManager/index.js +23 -0
  12. package/src/TemplateManager/src/GenerateCode.js +135 -0
  13. package/src/TemplateManager/src/MainResourcesYaml/CreateSourceData.js +76 -0
  14. package/src/TemplateManager/src/MainResourcesYaml/TemplateAndData/DynamoDbMain/Data/MainDynamoDbYamlData.js +153 -0
  15. package/src/TemplateManager/src/MainResourcesYaml/TemplateAndData/DynamoDbMain/Template/DynamoDb.ejs +31 -0
  16. package/src/TemplateManager/src/MainResourcesYaml/TemplateAndData/DynamoDbMain/Template/DynamoDb.exampleData.js +12 -0
  17. package/src/TemplateManager/src/PerActionEndpoint/CreateSourceData.js +131 -0
  18. package/src/TemplateManager/src/PerActionEndpoint/DataPerActionEndpoint.js +0 -0
  19. package/src/TemplateManager/src/PerActionEndpoint/TemplateAndData/Handler/Handler.js +0 -0
  20. package/src/TemplateManager/src/PerActionEndpoint/TemplateAndData/MainFunction/MainFunctionTemplate/Create.js +18 -0
  21. package/src/TemplateManager/src/PerActionEndpoint/TemplateAndData/MainFunction/MainFunctionTemplate/Delete.js +18 -0
  22. package/src/TemplateManager/src/PerActionEndpoint/TemplateAndData/MainFunction/MainFunctionTemplate/Get.js +18 -0
  23. package/src/TemplateManager/src/PerActionEndpoint/TemplateAndData/MainFunction/MainFunctionTemplate/Update.js +18 -0
  24. package/src/TemplateManager/src/PerActionEndpoint/TemplateAndData/MainFunction/MainFunctionTemplateData.js +0 -0
  25. package/src/TemplateManager/src/PerActionEndpoint/TemplateAndData/ResourceYaml/Lambda/Data/LambdaYamlData.js +166 -0
  26. package/src/TemplateManager/src/PerActionEndpoint/TemplateAndData/ResourceYaml/Lambda/Template/HdrApi.ejs +0 -0
  27. package/src/TemplateManager/src/PerActionEndpoint/TemplateAndData/ResourceYaml/Lambda/Template/HdrDsq.ejs +0 -0
  28. package/src/TemplateManager/src/PerActionEndpoint/TemplateAndData/ResourceYaml/Lambda/Template/HdrInv.ejs +26 -0
  29. package/src/TemplateManager/src/PerActionEndpoint/TemplateAndData/ResourceYaml/Lambda/Template/HdrInv.exampleData.js +15 -0
  30. package/src/TemplateManager/src/PerActionEndpoint/TemplateAndData/ResourceYaml/Lambda/Template/HdrSqs.ejs +0 -0
  31. package/src/TemplateManager/src/libs/Consts.js +108 -0
@@ -0,0 +1,24 @@
1
+ /*
2
+ Copyright (C) 2020 Sven Mason <http://izara.io>
3
+
4
+ This program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU Affero General Public License as
6
+ published by the Free Software Foundation, either version 3 of the
7
+ License, or (at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU Affero General Public License for more details.
13
+
14
+ You should have received a copy of the GNU Affero General Public License
15
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ // MainLibs use for contain shared logic and constant
21
+ module.exports = {
22
+ consts: require('./src/Consts'),
23
+ utils: require('./src/Utils')
24
+ };
File without changes
@@ -0,0 +1,27 @@
1
+ /*
2
+ Copyright (C) 2020 Sven Mason <http://izara.io>
3
+
4
+ This program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU Affero General Public License as
6
+ published by the Free Software Foundation, either version 3 of the
7
+ License, or (at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU Affero General Public License for more details.
13
+
14
+ You should have received a copy of the GNU Affero General Public License
15
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+
21
+ module.exports.firstLetterUpperCase = (text) => {
22
+ return text.charAt(0).toUpperCase() + text.slice(1)
23
+ }
24
+
25
+ module.exports.firstLetterLowerCase = (str) => {
26
+ return str.charAt(0).toLowerCase() + str.slice(1)
27
+ }
@@ -0,0 +1,23 @@
1
+ /*
2
+ Copyright(C) 2021 Sven Mason < http://izara.io>
3
+
4
+ This program is free software: you can redistribute it and / or modify
5
+ it under the terms of the GNU Affero General Public License as
6
+ published by the Free Software Foundation, either version 3 of the
7
+ License, or(at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
12
+ GNU Affero General Public License for more details.
13
+
14
+ You should have received a copy of the GNU Affero General Public License
15
+ along with this program.If not, see < http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ module.exports = {
21
+ utils: require('./src/Utils'),
22
+ createSource: require('./src/CreateSource')
23
+ }
@@ -0,0 +1,182 @@
1
+ /*
2
+ Copyright(C) 2021 Sven Mason < http://izara.io>
3
+
4
+ This program is free software: you can redistribute it and / or modify
5
+ it under the terms of the GNU Affero General Public License as
6
+ published by the Free Software Foundation, either version 3 of the
7
+ License, or(at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
12
+ GNU Affero General Public License for more details.
13
+
14
+ You should have received a copy of the GNU Affero General Public License
15
+ along with this program.If not, see < http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+
21
+ const fs = require('fs');
22
+ const ejs = require('ejs');
23
+ const join = require('path').join;
24
+ const beautify = require('js-beautify/js').js;
25
+
26
+
27
+ const beautifySetting = {
28
+ "indent_size": "2",
29
+ "indent_char": " ",
30
+ "max_preserve_newlines": "0",
31
+ // "preserve_newlines": true,
32
+ "keep_array_indentation": true,
33
+ "indent_scripts": "separate",
34
+ "brace_style": ["preserve-inline", "none"],
35
+ "space_before_conditional": true,
36
+ }
37
+
38
+ const TAG_CLASSES = {
39
+ doubleTag: 'doubleTag',
40
+ singleTag: 'singleTag',
41
+ nameTag: 'nameTag',
42
+ anyTag: 'anyTag',
43
+ anyDoubleTag: 'anyDoubleTag',
44
+ ymlDoubleTag: 'ymlDoubleTag',
45
+ ymlAnyDoubleTag: 'ymlAnyDoubleTag'
46
+ };
47
+
48
+
49
+ function tagList(tagClass = TAG_CLASSES.singleTag, tagName) {
50
+ return {
51
+ // return regex depend on tagClass
52
+ [TAG_CLASSES.singleTag]: new RegExp(`\/\/\\(<${tagName}>\\)`, 'gm'), // match //(<tagName>)
53
+ [TAG_CLASSES.doubleTag]: new RegExp(`\/\/\\(<${tagName}>\\)([\\s\\S]*?)\/\/\\(<\\/${tagName}>\\)`, 'gm'), // get data between tag -> //(<tagName>) data //(</tagName>)
54
+ [TAG_CLASSES.nameTag]: new RegExp(`__${tagName}`, 'gm'), // match //(<tagName>)
55
+ [TAG_CLASSES.anyTag]: new RegExp(`\/\/\\(<([^>]+)>\\)`, 'g'), // match //(<anyname>)
56
+ [TAG_CLASSES.anyDoubleTag]: new RegExp('\/\/\\(<(\\w+)>\\)([\\s\\S]*?)\/\/\\(<\/\\1>\\)', 'gm'),
57
+ [TAG_CLASSES.ymlDoubleTag]: new RegExp(`\#<#${tagName}#>([\\s\\S]*?)#<#\/${tagName}#>`, 'gm'), // match #<#tag#> #<#/tag#>
58
+ [TAG_CLASSES.ymlAnyDoubleTag]: new RegExp(`\#<#(\\w+)#>([\\s\\S]*?)#<#\/\\1#>`, 'gm'), // get tagName from doubleTag #<#tagName#> #<#/tagName#>
59
+ }[tagClass]
60
+ }
61
+
62
+
63
+ /**
64
+ *
65
+ * @param {string} template
66
+ * @param {object} data
67
+ * @returns
68
+ */
69
+ function generateDataFromTemplate(template, data,) {
70
+ let dataToSave = ejs.compile(template)(data);
71
+ return dataToSave;
72
+ }
73
+
74
+
75
+ /**
76
+ * generate code from template and data then save generated data
77
+ *
78
+ * @param {string} template
79
+ * @param {object} data
80
+ * @param {object} setting
81
+ * @param {string} setting.savePath
82
+ * @param {string} [setting.hookPath]
83
+ * @param {string} setting.saveFileName
84
+ * @param {string} setting.fileExtension
85
+ * @param {boolean} setting.isAppend
86
+ * @param {string} setting.initialData // initialData can use when isAppend = true
87
+ * @returns
88
+ */
89
+ async function createSource(template, data, { savePath, hookPath, saveFileName, fileExtension, initialData, isAppend = false }) {
90
+
91
+ try {
92
+
93
+ let dataToSave = generateDataFromTemplate(template, data);
94
+
95
+ let anyDoubleTagClass
96
+ let doubleTagClass
97
+
98
+ if (fileExtension === '.js') {
99
+ anyDoubleTagClass = TAG_CLASSES.anyDoubleTag;
100
+ doubleTagClass = TAG_CLASSES.doubleTag;
101
+ } else if (fileExtension === '.yml') {
102
+ anyDoubleTagClass = TAG_CLASSES.ymlAnyDoubleTag;
103
+ doubleTagClass = TAG_CLASSES.ymlDoubleTag;
104
+ }
105
+
106
+ let hookDataPath = hookPath ? hookPath : join(savePath, '../hook/');
107
+
108
+ if (!fs.existsSync(savePath)) fs.mkdirSync(savePath, { recursive: true });
109
+ if (!fs.existsSync(hookDataPath)) fs.mkdirSync(hookDataPath, { recursive: true });
110
+
111
+ // check saveFileName for Hook exists
112
+ if (fs.existsSync(`${hookDataPath}${saveFileName}${fileExtension}`.trim())) {
113
+ const hookData = fs.readFileSync(`${hookDataPath}${saveFileName}${fileExtension}`, 'utf8');
114
+
115
+ //replace data in tag from hook file to actual file
116
+ let dataAfterHook = dataToSave.replace(tagList(anyDoubleTagClass), (match, tagName, content) => {
117
+ let hookRegex = tagList(doubleTagClass, tagName);
118
+ let replaceData = hookData.match(hookRegex);
119
+
120
+ if (replaceData) {
121
+ return replaceData;
122
+ } else {
123
+ return match;
124
+ }
125
+ });
126
+
127
+ dataAfterHook = fileExtension === '.js' ? beautify(dataAfterHook, beautifySetting) : dataAfterHook
128
+ if (isAppend) {
129
+ if (!fs.existsSync(`${savePath}${saveFileName}${fileExtension}`) && initialData) {
130
+ fs.writeFileSync(`${savePath}${saveFileName}${fileExtension}`.trim(), initialData + dataAfterHook + '\n\n', 'utf8');
131
+ } else {
132
+ fs.appendFileSync(`${savePath}${saveFileName}${fileExtension}`.trim(), dataAfterHook + '\n\n', 'utf8');
133
+ }
134
+ } else {
135
+ fs.writeFileSync(`${savePath}${saveFileName}${fileExtension}`.trim(), dataAfterHook, 'utf8');
136
+ }
137
+
138
+ } else {
139
+ dataToSave = fileExtension === '.js' ? beautify(dataToSave, beautifySetting) : dataToSave
140
+ if (isAppend) {
141
+ if (!fs.existsSync(`${savePath}${saveFileName}${fileExtension}`) && initialData) {
142
+ fs.writeFileSync(`${savePath}${saveFileName}${fileExtension}`.trim(), initialData + dataToSave + '\n\n', 'utf8');
143
+ } else {
144
+ fs.appendFileSync(`${savePath}${saveFileName}${fileExtension}`.trim(), dataToSave + '\n\n', 'utf8');
145
+ }
146
+ } else {
147
+ fs.writeFileSync(`${savePath}${saveFileName}${fileExtension}`.trim(), dataToSave, 'utf8');
148
+ }
149
+ }
150
+
151
+ return;
152
+
153
+ } catch (err) {
154
+ console.log('error createSource: ', err);// generate
155
+ throw (err)
156
+ }
157
+ }
158
+
159
+
160
+
161
+
162
+
163
+ // Function to extract multiple code between tags
164
+ // function extractMultipleCodeBetweenTags(content, tagName) {
165
+ // const result = [];
166
+ // const startTag = `//(<${tagName}>)`;
167
+ // const endTag = `//(</${tagName}>)`;
168
+ // let startIndex = content.indexOf(startTag);
169
+ // let endIndex = content.indexOf(endTag, startIndex);
170
+ // while (startIndex >= 0 && endIndex >= 0) {
171
+ // result.push(content.substring(startIndex + startTag.length + 1, endIndex));
172
+ // startIndex = content.indexOf(startTag, endIndex);
173
+ // endIndex = content.indexOf(endTag, startIndex);
174
+ // }
175
+ // return result;
176
+ // }
177
+
178
+
179
+ module.exports = {
180
+ createSource,
181
+ generateDataFromTemplate
182
+ }
@@ -0,0 +1,50 @@
1
+ /*
2
+ Copyright(C) 2021 Sven Mason < http://izara.io>
3
+
4
+ This program is free software: you can redistribute it and / or modify
5
+ it under the terms of the GNU Affero General Public License as
6
+ published by the Free Software Foundation, either version 3 of the
7
+ License, or(at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
12
+ GNU Affero General Public License for more details.
13
+
14
+ You should have received a copy of the GNU Affero General Public License
15
+ along with this program.If not, see < http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+
21
+ const fs = require('fs');
22
+ // const { unlink, readdir } = require('node:fs/promises');
23
+
24
+
25
+ // empty dir
26
+ async function deleteFileInDir(directory) {
27
+ try {
28
+ if (fs.existsSync(directory)) {
29
+ fs.rmSync(directory, { recursive: true });
30
+ }
31
+ } catch (err) {
32
+ console.log(err);
33
+ }
34
+ }
35
+
36
+
37
+ module.exports = {
38
+ deleteFileInDir
39
+ }
40
+
41
+
42
+ // remove file
43
+ // async function deleteFileInDir(directory) {
44
+ // if (fs.existsSync(directory)) {
45
+ // for (const file of await readdir(directory)) {
46
+ // await unlink(path.join(directory, file));
47
+ // }
48
+ // }
49
+ // return;
50
+ // }
@@ -0,0 +1,23 @@
1
+ /*
2
+ Copyright (C) 2021 Sven Mason <http://izara.io>
3
+
4
+ This program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU Affero General Public License as
6
+ published by the Free Software Foundation, either version 3 of the
7
+ License, or (at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU Affero General Public License for more details.
13
+
14
+ You should have received a copy of the GNU Affero General Public License
15
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+
21
+ module.exports = {
22
+ generateCode: require('./src/GenerateCode'),
23
+ }
@@ -0,0 +1,135 @@
1
+ /*
2
+ Copyright (C) 2020 Sven Mason <http://izara.io>
3
+
4
+ This program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU Affero General Public License as
6
+ published by the Free Software Foundation, either version 3 of the
7
+ License, or (at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU Affero General Public License for more details.
13
+
14
+ You should have received a copy of the GNU Affero General Public License
15
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ const join = require('path').join;
21
+ const { readFileSync } = require('fs');
22
+
23
+
24
+ const {
25
+ getAllLocalObjectSchemasWithHierarchy,
26
+ getAllLocalRelationshipSchemas
27
+ } = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
28
+
29
+
30
+
31
+ const { createSource } = require("../../SourceManager/src/CreateSource");
32
+ const { deleteFileInDir } = require("../../SourceManager/src/Utils");
33
+
34
+ const perAction = require("./PerActionEndpoint/CreateSourceData");
35
+
36
+ const mainResources = require("./MainResourcesYaml/CreateSourceData");
37
+
38
+
39
+ /**
40
+ *
41
+ * get template and send to
42
+ *
43
+ * @param {object} objSchemaPath
44
+ * @returns
45
+ *
46
+ * add another param
47
+ * {string[]} objectTypes
48
+ * {string[]} templates
49
+ * {string} saveFilePath
50
+ */
51
+ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
52
+
53
+ try {
54
+
55
+ // point to app/src
56
+ let saveFilePath = join(objSchemaPath, `../`);
57
+
58
+ // define path for store yml file
59
+ const GENERATECODE_SOURCE_PATH = {
60
+ appYaml: join(saveFilePath, `../sls_yaml/generatedCode/source/`),
61
+ resourceYaml: join(saveFilePath, `../../resource/sls_yaml/generatedCode/source/`),
62
+ lambdaPerObjectTypePath: join(saveFilePath, `/generatedCode/lambdaPerObjectType/source/`), // test
63
+ lamdaPerCombindActionPath: join(saveFilePath, `/generatedCode/lamdaPerCombindAction/source/`), // test
64
+ };
65
+
66
+
67
+ // from app/src/shcemas
68
+ let allObjSchemas = await getAllLocalObjectSchemasWithHierarchy(_izContext, objSchemaPath);
69
+
70
+ const allObjectRelationships = await getAllLocalRelationshipSchemas(_izContext, objSchemaPath);
71
+
72
+ /*
73
+ Should we generateCode with objectSchema that not in hierarchy or not?
74
+ Should use objectSchema with hierarchy because we use storageResource of parent to create lambda iam role in .yml file
75
+ */
76
+
77
+ let createSourceParams = [];
78
+
79
+ for (const relTag in allObjectRelationships) {
80
+ const relTagData = allObjectRelationships[relTag];
81
+
82
+ // create main resource per relationshipSchema
83
+ const createSourceMainResourcesRelSchema = mainResources.createSourceDataRelSchema(_izContext, { [relTag]: relTagData }, saveFilePath);
84
+ console.log("createSourceMainResourcesRelSchema: ", createSourceMainResourcesRelSchema);
85
+
86
+ createSourceParams = createSourceParams.concat(createSourceMainResourcesRelSchema);
87
+ }
88
+
89
+
90
+ //
91
+ for (let objectSchema of allObjSchemas.records) {
92
+
93
+ // create main resource per objectSchema
94
+ let createSourceMainResourcesObjectSchema = mainResources.createSourceDataObjectSchema(_izContext, objectSchema, saveFilePath);
95
+ // console.log("createSourceMainResourcesObjectSchema: ", createSourceMainResourcesObjectSchema);
96
+
97
+ // mainFunction, handlerFunction, resourceYaml per action
98
+ let createSourcePerAction = perAction.createSourceDataObjectSchema(_izContext, objectSchema, saveFilePath);
99
+ // console.log("createSourcePerAction: ", createSourcePerAction)
100
+
101
+
102
+
103
+ // console.log("createSourceParams begore concat: ", createSourceParams);
104
+
105
+ createSourceParams = createSourceParams.concat([...createSourcePerAction, ...createSourceMainResourcesObjectSchema]);
106
+
107
+ // console.log("createSourceParams after concat: ", createSourceParams);
108
+ }
109
+
110
+
111
+ // delete file .yml before start to prevent confilct of data
112
+ for (let folderPathToEmpty of Object.keys(GENERATECODE_SOURCE_PATH)) {
113
+ await deleteFileInDir(GENERATECODE_SOURCE_PATH[folderPathToEmpty]);
114
+ }
115
+
116
+
117
+ // start create source
118
+ for (let { templatePath, templateData, setting } of createSourceParams) {
119
+ await createSource(
120
+ readFileSync(templatePath, 'utf8'),
121
+ templateData,
122
+ setting,
123
+ );
124
+ }
125
+
126
+
127
+ return "return values";
128
+
129
+ } catch (err) {
130
+ console.log('error templateManager: ', err);
131
+ throw (err);
132
+ }
133
+ };
134
+
135
+ module.exports = { generateCodeWithTemplate };
@@ -0,0 +1,76 @@
1
+ /*
2
+ Copyright (C) 2020 Sven Mason <http://izara.io>
3
+
4
+ This program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU Affero General Public License as
6
+ published by the Free Software Foundation, either version 3 of the
7
+ License, or (at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU Affero General Public License for more details.
13
+
14
+ You should have received a copy of the GNU Affero General Public License
15
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ const path = require('path');
21
+
22
+ const schemaConsts = require('@izara_project/izara-core-library-service-schemas/src/Consts');
23
+
24
+
25
+
26
+ // const lambdaYaml = require("./Template/Resource/Lambda/LambdaYamlTemplateData");
27
+
28
+ const config = require('../libs/Consts')
29
+
30
+
31
+ const dynamoDbMainYaml = require("./TemplateAndData/DynamoDbMain/Data/MainDynamoDbYamlData")
32
+
33
+ /**
34
+ * @param {Object} _izContext
35
+ * @param {Object} objectSchema
36
+ */
37
+ module.exports.createSourceDataObjectSchema = (_izContext, objectSchema, saveFilePath) => {
38
+
39
+ let resultsForCreateSource = [];
40
+
41
+
42
+ const dynamoDbMainYamlDataList = dynamoDbMainYaml.dynamoDbMainYamlFromObjectSchema.templateDataFunction(_izContext, objectSchema);
43
+ console.log("dynamoDbMainYamlDataList: ", dynamoDbMainYamlDataList);
44
+
45
+ for (let dynamoDbMainYamlData of dynamoDbMainYamlDataList) {
46
+ // create iam role of handler here
47
+ resultsForCreateSource.push({
48
+ templatePath: dynamoDbMainYaml.dynamoDbMainYamlFromObjectSchema.templatePath,
49
+ templateData: dynamoDbMainYamlData,
50
+ setting: {
51
+ initialData: 'Resources:\n',
52
+ savePath: path.join(saveFilePath, config.SOURCE_PATH.resourceYaml),
53
+ saveFileName: 'generate-dynamodb-table',
54
+ fileExtension: '.yml',
55
+ isAppend: true
56
+ }
57
+ });
58
+ }
59
+
60
+ console.log("resultsForCreateSource: ", resultsForCreateSource);
61
+
62
+ return resultsForCreateSource;
63
+ }
64
+
65
+
66
+ /**
67
+ *
68
+ * @param {Object} _izContext
69
+ * @param {Object} relSchema
70
+ * @param {String} saveFilePath
71
+ * @returns
72
+ */
73
+ module.exports.createSourceDataRelSchema = (_izContext, relSchema, saveFilePath) => {
74
+
75
+ return []
76
+ }