@izara_project/izara-market-library-service-schemas 1.0.20 → 1.0.22
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 +4 -3
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +54 -1
- package/src/TemplateManager/src/FindData/mainFunction/data.js +25 -25
- package/src/TemplateManager/src/GenerateCode.js +5 -5
- package/src/TemplateManager/src/GenerateSchema.js +88 -0
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrApi/data.js +9 -6
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrApi/template.ejs +2 -2
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrDsq/data.js +5 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrDsq/template.ejs +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrInv/data.js +5 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrInv/template.ejs +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrSqs/data.js +3 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrSqs/template.ejs +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrApi/data.js +4 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrDsq/data.js +3 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/data.js +3 -0
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrSqs/data.js +3 -0
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Create/data.js +3 -0
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Delete/data.js +3 -0
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Get/data.js +3 -0
- package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Update/data.js +3 -1
- package/src/TemplateManager/src/Role/createSharedResource.js +19 -17
- package/src/TemplateManager/src/attributeTree/objectSchema/data.js +125 -0
- package/src/TemplateManager/src/attributeTree/objectSchema/template.ejs +20 -0
- package/src/TemplateManager/src/attributeTree/refRelationshipSchema/data.js +36 -0
- package/src/TemplateManager/src/attributeTree/refRelationshipSchema/template.ejs +0 -0
- package/src/TemplateManager/src/attributeTree/relationshipSchema/data.js +92 -0
- package/src/TemplateManager/src/attributeTree/relationshipSchema/template.ejs +40 -0
- package/src/TemplateManager/src/externalService/FunctionNameConfig/data.js +104 -23
- package/src/TemplateManager/src/externalService/FunctionNameConfig/templateIntTesting.ejs +5 -5
- package/src/TemplateManager/src/externalService/FunctionNameConfig/templateYaml.ejs +2 -2
- package/src/TemplateManager/src/externalService/LambdaRole/data.js +22 -12
- package/src/TemplateManager/src/externalService/LambdaRole/template.ejs +1 -1
- package/src/TemplateManager/src/libs/Consts.js +97 -7
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.22",
|
|
4
4
|
"description": "Schemas for Izara Market project",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -22,11 +22,12 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@izara_project/izara-core-library-core": "^1.0.14",
|
|
24
24
|
"@izara_project/izara-core-library-external-request": "^1.0.17",
|
|
25
|
-
"@izara_project/izara-core-library-service-schemas": "^1.0.
|
|
25
|
+
"@izara_project/izara-core-library-service-schemas": "^1.0.41",
|
|
26
26
|
"@izara_project/izara-shared": "^1.0.116",
|
|
27
27
|
"ejs": "^3.1.10",
|
|
28
28
|
"js-beautify": "^1.15.1",
|
|
29
29
|
"lodash": "^4.17.21",
|
|
30
|
-
"object-hash": "^3.0.0"
|
|
30
|
+
"object-hash": "^3.0.0",
|
|
31
|
+
"yaml": "^2.7.0"
|
|
31
32
|
}
|
|
32
33
|
}
|
|
@@ -46,6 +46,8 @@ const {
|
|
|
46
46
|
const Logger = require("@izara_project/izara-core-library-logger");
|
|
47
47
|
|
|
48
48
|
const nodeLabelRegexPattern = "^[a-zA-Z0-9_-]+(?:\:[a-zA-Z0-9_-]+)?$"
|
|
49
|
+
const { validateObjType } = require('@izara_project/izara-core-library-service-schemas').validateObjType;
|
|
50
|
+
|
|
49
51
|
|
|
50
52
|
|
|
51
53
|
const schemaFunctionPerAction = {
|
|
@@ -931,6 +933,56 @@ function createFieldForUpdateDynamoDb(_izContext, objectSchema, dynamoDataDetail
|
|
|
931
933
|
return fieldsForUpdateDynamo
|
|
932
934
|
}
|
|
933
935
|
|
|
936
|
+
|
|
937
|
+
/**
|
|
938
|
+
*
|
|
939
|
+
* @param {Object} fromObjType
|
|
940
|
+
* @param {String} fromObjType.objectType
|
|
941
|
+
* @param {String} fromObjType.serviceTag
|
|
942
|
+
* @param {Object} toObjType
|
|
943
|
+
* @param {String} toObjType.objectType
|
|
944
|
+
* @param {String} toObjType.serviceTag
|
|
945
|
+
* @param {Object} storageResources
|
|
946
|
+
*/
|
|
947
|
+
function createLinksObjectRelationshipAttributeTree(fromObjType, toObjType, storageResources, direction) {
|
|
948
|
+
validateObjType(fromObjType);
|
|
949
|
+
validateObjType(toObjType);
|
|
950
|
+
|
|
951
|
+
if (direction === from) {
|
|
952
|
+
|
|
953
|
+
}
|
|
954
|
+
return {
|
|
955
|
+
fieldNames: {
|
|
956
|
+
originTimeStamp: {
|
|
957
|
+
type: 'number',
|
|
958
|
+
requiredOnCreate: true,
|
|
959
|
+
canUpdate: false,
|
|
960
|
+
validation: {
|
|
961
|
+
minimum: 1111111111111,
|
|
962
|
+
maximum: 9999999999999
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
},
|
|
966
|
+
storageResources: storageResources,
|
|
967
|
+
links: [
|
|
968
|
+
{
|
|
969
|
+
storageResourceTag: Object.keys(storageResources),
|
|
970
|
+
from: {
|
|
971
|
+
objType: fromObjType,
|
|
972
|
+
linkType: "one",
|
|
973
|
+
direction: direction
|
|
974
|
+
},
|
|
975
|
+
to: {
|
|
976
|
+
objType: toObjType,
|
|
977
|
+
linkType: "many"
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
]
|
|
981
|
+
|
|
982
|
+
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
|
|
934
986
|
module.exports = {
|
|
935
987
|
sendMsgOutComplete,
|
|
936
988
|
messageToDlq,
|
|
@@ -948,7 +1000,8 @@ module.exports = {
|
|
|
948
1000
|
createDataDetailsLib,
|
|
949
1001
|
createDeleteDataDetail,
|
|
950
1002
|
|
|
951
|
-
createFieldForUpdateDynamoDb
|
|
1003
|
+
createFieldForUpdateDynamoDb,
|
|
1004
|
+
createLinksObjectRelationshipAttributeTree
|
|
952
1005
|
}
|
|
953
1006
|
|
|
954
1007
|
|
|
@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
19
19
|
|
|
20
20
|
const path = require('path');
|
|
21
21
|
|
|
22
|
-
const { SOURCE_PATH, FUNCTION_NAME } = require("../../libs/Consts");
|
|
22
|
+
const { SOURCE_PATH, FUNCTION_NAME, ADD_ON_DATA_STRUCTURE_TYPE } = require("../../libs/Consts");
|
|
23
23
|
const { firstLetterUpperCase: upperCase } = require("../../../../MainLibs/src/Utils")
|
|
24
24
|
|
|
25
25
|
const serviceSchemas = require('@izara_project/izara-core-library-service-schemas');
|
|
@@ -154,42 +154,42 @@ async function data(_izContext, srcPath) {
|
|
|
154
154
|
// fieldName in versionedData
|
|
155
155
|
if (objectSchema.hasOwnProperty("addOnDataStructure")) { // array
|
|
156
156
|
// console.log(("objectSchemas have addOnDataStructure: ", objectSchema.addOnDataStructure)
|
|
157
|
-
|
|
158
157
|
for (const versionedData of objectSchema.addOnDataStructure) { // object // loop versionedData
|
|
159
158
|
// console.log("versionedData: ", versionedData)
|
|
159
|
+
if (versionedData === ADD_ON_DATA_STRUCTURE_TYPE.versionedData) {
|
|
160
160
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
161
|
+
let versionedStorageDetail = {};
|
|
162
|
+
let versioendStorageResourceTag = versionedData.storageResourceTag;
|
|
163
|
+
let versionedFieldNames = versionedData.fieldNames; // array
|
|
164
164
|
|
|
165
|
-
|
|
165
|
+
Object.entries(storageResources).map(([storageTag, storageDetail]) => {
|
|
166
166
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
167
|
+
if (versioendStorageResourceTag === storageTag) {
|
|
168
|
+
if (storageDetail.storageType === STORAGE_TYPES.graph) {
|
|
169
|
+
versionedStorageDetail = {
|
|
170
|
+
[storageDetail.storageType]: {
|
|
171
|
+
graphServerTag: storageDetail.graphServerTag,
|
|
172
|
+
versionedDataLabel: versionedData.versionedDataLabel
|
|
173
|
+
}
|
|
173
174
|
}
|
|
175
|
+
} else {
|
|
176
|
+
throw new NoRetryError(`storageType of versionedData isn't graph`)
|
|
174
177
|
}
|
|
175
|
-
} else {
|
|
176
|
-
throw new NoRetryError(`storageType of versionedData isn't graph`)
|
|
177
178
|
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// console.log(("versionedStorageDetail: ", versionedStorageDetail)
|
|
181
|
-
|
|
182
|
-
for (const versionedFieldName of versionedFieldNames) { // object // loop versionedFieldNames
|
|
179
|
+
})
|
|
180
|
+
// console.log(("versionedStorageDetail: ", versionedStorageDetail)
|
|
183
181
|
|
|
184
|
-
|
|
185
|
-
fieldNameDatas.push({ [versionedFieldName.fieldName]: versionedStorageDetail })
|
|
186
|
-
}
|
|
182
|
+
for (const versionedFieldName of versionedFieldNames) { // object // loop versionedFieldNames
|
|
187
183
|
|
|
188
|
-
|
|
184
|
+
if (versionedFieldName.type === "string" || versionedFieldName.type === "number") {
|
|
185
|
+
fieldNameDatas.push({ [versionedFieldName.fieldName]: versionedStorageDetail })
|
|
186
|
+
}
|
|
189
187
|
|
|
190
|
-
|
|
191
|
-
//fieldNameDatas.push(collectVersionedFieldNames)
|
|
188
|
+
} // end loop versionedFieldNames
|
|
192
189
|
|
|
190
|
+
} // end loop versionedData
|
|
191
|
+
//fieldNameDatas.push(collectVersionedFieldNames)
|
|
192
|
+
}
|
|
193
193
|
}
|
|
194
194
|
// console.log(("fieldNameDatas: ", fieldNameDatas)
|
|
195
195
|
|
|
@@ -23,7 +23,8 @@ const { readFileSync } = require('fs');
|
|
|
23
23
|
|
|
24
24
|
const {
|
|
25
25
|
getAllLocalObjectSchemasWithHierarchy,
|
|
26
|
-
getAllLocalRelationshipSchemas,
|
|
26
|
+
// getAllLocalRelationshipSchemas,
|
|
27
|
+
getAllLocalRelationshipSchema,
|
|
27
28
|
getAllLocalFlowSchemas
|
|
28
29
|
} = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
|
|
29
30
|
|
|
@@ -227,7 +228,6 @@ const functionNameConfigYamldata = require('./externalService/FunctionNameConfig
|
|
|
227
228
|
// create shared resource
|
|
228
229
|
const { createSharedResource } = require('./Role/createSharedResource');
|
|
229
230
|
|
|
230
|
-
|
|
231
231
|
//lib of generateCode
|
|
232
232
|
const { checkValidTableYaml,
|
|
233
233
|
} = require('./libs/GenerateCodeUtils');
|
|
@@ -261,7 +261,7 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
261
261
|
externalService: join(saveFilePath, SOURCE_PATH.externalService),
|
|
262
262
|
relationshipPerAction: join(saveFilePath, SOURCE_PATH.relationshipPerAction),
|
|
263
263
|
webSocketEndpoint: join(saveFilePath, SOURCE_PATH.webSocket),
|
|
264
|
-
generateCodeLib: join(saveFilePath, SOURCE_PATH.generateCodeLib)
|
|
264
|
+
generateCodeLib: join(saveFilePath, SOURCE_PATH.generateCodeLib),
|
|
265
265
|
};
|
|
266
266
|
|
|
267
267
|
let createSourceParams = [];
|
|
@@ -277,7 +277,7 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
277
277
|
const processLogicalPaginateFunctionYamlHdrDsq = await createProcessLogicalPaginateFunctionYamlHdrDsq(_izContext, allObjSchemas, saveFilePath);
|
|
278
278
|
const processLogicalPaginateFunctionYamlHdrSqs = await createProcessLogicalPaginateFunctionYamlHdrSqs(_izContext, allObjSchemas, saveFilePath);
|
|
279
279
|
|
|
280
|
-
const allObjectRelationships = await
|
|
280
|
+
const allObjectRelationships = await getAllLocalRelationshipSchema(_izContext, objSchemaPath);
|
|
281
281
|
// _izContext.logger.debug("allObjectRelationships::", allObjectRelationships);
|
|
282
282
|
|
|
283
283
|
const allLocalFlowSchemas = await getAllLocalFlowSchemas(_izContext, objSchemaPath);
|
|
@@ -631,6 +631,7 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
631
631
|
)
|
|
632
632
|
}
|
|
633
633
|
// console.log("createSourceParams templatePath in GenerateCode", createSourceParams.templatePath)
|
|
634
|
+
// console.log("template Data createSourceParams:", createSourceParams.templateData)
|
|
634
635
|
|
|
635
636
|
const createFunctionNameConfig = functionNameConfigYamldata(_izContext, createSourceParams, saveFilePath);
|
|
636
637
|
createSourceParams = createSourceParams.concat(...createFunctionNameConfig);
|
|
@@ -645,7 +646,6 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
645
646
|
// for (const flowSchema of allLocalFlowSchemas.records) {
|
|
646
647
|
// await createHookFunction(_izContext, flowSchema, saveFilePath);
|
|
647
648
|
// }
|
|
648
|
-
// console.log(""createSourceParams": ", createSourceParams)
|
|
649
649
|
// start create source
|
|
650
650
|
for (let { templatePath, templateData, setting } of createSourceParams) {
|
|
651
651
|
// console.log("setting.saveFileName in GenerateCode", setting.saveFileName);
|
|
@@ -0,0 +1,88 @@
|
|
|
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
|
+
const join = require('path').join;
|
|
20
|
+
const { readFileSync } = require('fs');
|
|
21
|
+
const { SOURCE_PATH } = require('./libs/Consts')
|
|
22
|
+
const { createSource } = require("../../SourceManager/src/CreateSource");
|
|
23
|
+
const { deleteFileInDir } = require('../../SourceManager/src/Utils')
|
|
24
|
+
const {
|
|
25
|
+
getAllLocalObjectSchemasWithHierarchy,
|
|
26
|
+
} = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
|
|
27
|
+
|
|
28
|
+
const createAttributeTreeObjSchemas = require('./attributeTree/objectSchema/data');
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* get template and send to
|
|
33
|
+
*
|
|
34
|
+
* @param {object} objSchemaPath
|
|
35
|
+
* @returns
|
|
36
|
+
*
|
|
37
|
+
* add another param
|
|
38
|
+
* {string[]} objectTypes
|
|
39
|
+
* {string[]} templates
|
|
40
|
+
* {string} saveFilePath
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
async function generateSchemaWithTemplate(_izContext, objSchemaPath) {
|
|
44
|
+
try {
|
|
45
|
+
|
|
46
|
+
let saveFilePath = join(objSchemaPath, `../`);
|
|
47
|
+
|
|
48
|
+
// define path for store yml file
|
|
49
|
+
const GENERATECODE_SOURCE_PATH = {
|
|
50
|
+
generateAttributeTree: join(saveFilePath, SOURCE_PATH.generatedAttributeTree)
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
let createSourceParams = [];
|
|
54
|
+
|
|
55
|
+
const allObjectSchemas = await getAllLocalObjectSchemasWithHierarchy(_izContext, objSchemaPath);
|
|
56
|
+
|
|
57
|
+
for (const objectSchema of allObjectSchemas.records) {
|
|
58
|
+
const attributeTreeObjSchema = createAttributeTreeObjSchemas(_izContext, objectSchema, saveFilePath);
|
|
59
|
+
const attributeTreeGenerator = [...attributeTreeObjSchema]
|
|
60
|
+
createSourceParams.push(...attributeTreeGenerator)
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
for (let folderPathToEmpty of Object.keys(GENERATECODE_SOURCE_PATH)) {
|
|
64
|
+
await deleteFileInDir(GENERATECODE_SOURCE_PATH[folderPathToEmpty]);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
for (let { templatePath, templateData, setting } of createSourceParams) {
|
|
69
|
+
// console.log("setting.saveFileName in GenerateSchema", setting.saveFileName);
|
|
70
|
+
// console.log("templatePath in GenerateSchema", templatePath);
|
|
71
|
+
// console.log("setting.savePath in GenerateSchema", setting.savePath)
|
|
72
|
+
await createSource(
|
|
73
|
+
readFileSync(templatePath, 'utf8'),
|
|
74
|
+
templateData,
|
|
75
|
+
setting,
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return "Generate Schema Complete"
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
} catch (err) {
|
|
83
|
+
console.log('error templateManager: ', err);
|
|
84
|
+
throw (err);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
module.exports = { generateSchemaWithTemplate };
|
|
@@ -57,7 +57,9 @@ function data(_izContext, objectSchema, srcPath) {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
function createParamForCreateSource(objectSchema, action, srcPath) {
|
|
60
|
-
let objectType = objectSchema.objectType
|
|
60
|
+
// let objectType = objectSchema.objectType
|
|
61
|
+
let objectType = objectSchema.objectType;
|
|
62
|
+
let groupBy = objectSchema?.shortNameObjectType ? objectSchema.shortNameObjectType : objectSchema.objectType;
|
|
61
63
|
let functionName = upperCase(objectType) + upperCase(action);
|
|
62
64
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
63
65
|
let tableForGetItem = [];
|
|
@@ -160,15 +162,16 @@ function createParamForCreateSource(objectSchema, action, srcPath) {
|
|
|
160
162
|
additionalResourcePermission,
|
|
161
163
|
event: event,
|
|
162
164
|
objectType: objectType,
|
|
165
|
+
roleName: groupBy,
|
|
163
166
|
action: action,
|
|
164
167
|
functionNameConfig,
|
|
165
168
|
},
|
|
166
|
-
setting: {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
+
setting: {
|
|
170
|
+
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
171
|
+
saveFileName: SAVE_FILE_NAME.functionPerActionYaml,
|
|
169
172
|
fileExtension: '.yml',
|
|
170
|
-
|
|
171
|
-
}
|
|
173
|
+
isAppend: true
|
|
174
|
+
}
|
|
172
175
|
}
|
|
173
176
|
}
|
|
174
177
|
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
5
5
|
events:
|
|
6
6
|
- http:
|
|
7
|
-
path: <%- objectType %>/<%- firstLetterUpperCase(action) %>
|
|
7
|
+
path: <%- firstLetterUpperCase(objectType) %>/<%- firstLetterUpperCase(action) %>
|
|
8
8
|
method: <%- event %>
|
|
9
9
|
cors: true
|
|
10
10
|
#<#<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>Authorizer#>
|
|
11
11
|
#<#/<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>Authorizer#>
|
|
12
|
-
role: <%-
|
|
12
|
+
role: <%- firstLetterUpperCase(roleName) %>Role
|
|
13
13
|
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
14
14
|
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
15
15
|
<%_ function firstLetterUpperCase(text){
|
|
@@ -59,7 +59,10 @@ function data(_izContext, objectSchema, srcPath) {
|
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
function createParamForCreateSource(objectSchema, action, srcPath) {
|
|
62
|
+
// let objectType = objectSchema.objectType;
|
|
63
|
+
|
|
62
64
|
let objectType = objectSchema.objectType;
|
|
65
|
+
let groupBy = objectSchema?.shortNameObjectType ? objectSchema.shortNameObjectType : objectSchema.objectType;
|
|
63
66
|
let functionName = upperCase(objectType) + upperCase(action);
|
|
64
67
|
let functionNameObjectType = objectSchema?.shortNameObjectType ? objectSchema.shortNameObjectType : objectSchema.objectType;
|
|
65
68
|
let functionNameConfig = upperCase(functionNameObjectType) + upperCase(action) + upperCase(shortNameHandler(HANDLER.hdrDsq))
|
|
@@ -169,7 +172,8 @@ function createParamForCreateSource(objectSchema, action, srcPath) {
|
|
|
169
172
|
handlerType: HANDLER.hdrDsq,
|
|
170
173
|
additionalResourcePermission,
|
|
171
174
|
functionNameConfig,
|
|
172
|
-
roleName:
|
|
175
|
+
roleName: objectType,
|
|
176
|
+
roleName: groupBy,
|
|
173
177
|
},
|
|
174
178
|
setting: {
|
|
175
179
|
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
- sqs:
|
|
7
7
|
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
8
8
|
batchSize: 10
|
|
9
|
-
role: <%- roleName %>Role
|
|
9
|
+
role: <%- firstLetterUpperCase(roleName) %>Role
|
|
10
10
|
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
11
11
|
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
12
12
|
<%_ function firstLetterUpperCase(text){
|
|
@@ -61,7 +61,9 @@ function data(_izContext, objectSchema, srcPath) {
|
|
|
61
61
|
|
|
62
62
|
function createParamForCreateSource(objectSchema, action, srcPath) {
|
|
63
63
|
let functionNameObjectType = objectSchema?.shortNameObjectType ? objectSchema.shortNameObjectType : objectSchema.objectType;
|
|
64
|
+
// let objectType = objectSchema.objectType;
|
|
64
65
|
let objectType = objectSchema.objectType;
|
|
66
|
+
let groupBy = objectSchema?.shortNameObjectType ? objectSchema.shortNameObjectType : objectSchema.objectType;
|
|
65
67
|
let actionHandler = action;
|
|
66
68
|
let functionName = upperCase(objectType) + upperCase(actionHandler);
|
|
67
69
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
@@ -150,7 +152,9 @@ function createParamForCreateSource(objectSchema, action, srcPath) {
|
|
|
150
152
|
resourceLocation: SOURCE_PATH.resourceLocationPerAction,
|
|
151
153
|
handlerType: HANDLER.hdrInv,
|
|
152
154
|
additionalResourcePermission,
|
|
153
|
-
objectType,
|
|
155
|
+
objectType: objectType,
|
|
156
|
+
roleName: groupBy,
|
|
157
|
+
|
|
154
158
|
// functionNameConfig: upperCase(objectType) + upperCase(action) + upperCase(shortNameHandler(HANDLER.hdrInv))
|
|
155
159
|
functionNameConfig: upperCase(functionNameObjectType) + upperCase(action) + upperCase(shortNameHandler(HANDLER.hdrInv)),
|
|
156
160
|
},
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<%- firstLetterUpperCase(functionNameConfig) %>:
|
|
3
3
|
handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`)%>
|
|
4
4
|
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
5
|
-
role: <%-
|
|
5
|
+
role: <%- firstLetterUpperCase(roleName) %>Role
|
|
6
6
|
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
7
7
|
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
8
8
|
<%_ function firstLetterUpperCase(text){
|
|
@@ -59,7 +59,9 @@ function data(_izContext, objectSchema, srcPath) {
|
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
function createParamForCreateSource(objectSchema, action, srcPath) {
|
|
62
|
+
// let objectType = objectSchema.objectType;
|
|
62
63
|
let objectType = objectSchema.objectType;
|
|
64
|
+
let groupBy = objectSchema?.shortNameObjectType ? objectSchema.shortNameObjectType : objectSchema.objectType;
|
|
63
65
|
let actionHandler = action;
|
|
64
66
|
let functionName = upperCase(objectType) + upperCase(actionHandler);
|
|
65
67
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
@@ -173,7 +175,7 @@ function createParamForCreateSource(objectSchema, action, srcPath) {
|
|
|
173
175
|
additionalResourcePermission,
|
|
174
176
|
functionNameConfig,
|
|
175
177
|
objectType,
|
|
176
|
-
roleName:
|
|
178
|
+
roleName: groupBy,
|
|
177
179
|
},
|
|
178
180
|
setting: {
|
|
179
181
|
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
- sqs:
|
|
7
7
|
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
8
8
|
batchSize: 10
|
|
9
|
-
role: <%- roleName %>Role
|
|
9
|
+
role: <%- firstLetterUpperCase(roleName) %>Role
|
|
10
10
|
#<#<%- functionName %><%- handlerType %>IamRole#>
|
|
11
11
|
#<#/<%- functionName %><%- handlerType %>IamRole#>
|
|
12
12
|
<%_ function firstLetterUpperCase(text){
|
|
@@ -60,13 +60,17 @@ function data(_izContext, objectSchema, srcPath) {
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
function createParamForCreateSource(objectSchema, action, handler, srcPath) {
|
|
63
|
+
// let objectType = objectSchema.objectType;
|
|
63
64
|
let objectType = objectSchema.objectType;
|
|
65
|
+
let groupBy = objectSchema?.shortNameObjectType ? objectSchema.shortNameObjectType : objectSchema.objectType;
|
|
66
|
+
|
|
64
67
|
let functionName = objectType + firstLetterUpperCase(action);
|
|
65
68
|
return {
|
|
66
69
|
templatePath: templatePath,
|
|
67
70
|
templateData: {
|
|
68
71
|
functionName: functionName,
|
|
69
72
|
objectType: objectType,
|
|
73
|
+
roleName: groupBy,
|
|
70
74
|
action: action,
|
|
71
75
|
isCreateMainFunction: checkOverWriteGenerateMainFunction(objectSchema, action),
|
|
72
76
|
},
|
|
@@ -59,7 +59,9 @@ function data(_izContext, objectSchema, srcPath) {
|
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
function createParamForCreateSourceHandlerGet(objectSchema, action, handler, srcPath) {
|
|
62
|
+
// let objectType = objectSchema.objectType;
|
|
62
63
|
let objectType = objectSchema.objectType;
|
|
64
|
+
let groupBy = objectSchema?.shortNameObjectType ? objectSchema.shortNameObjectType : objectSchema.objectType;
|
|
63
65
|
let functionName = objectType + upperCase(action);
|
|
64
66
|
let queueName = objectType + firstLetterUpperCase(action) + upperCase(handler);
|
|
65
67
|
return {
|
|
@@ -67,6 +69,7 @@ function createParamForCreateSourceHandlerGet(objectSchema, action, handler, src
|
|
|
67
69
|
templateData: {
|
|
68
70
|
functionName: functionName,
|
|
69
71
|
objectType: objectType,
|
|
72
|
+
roleName: groupBy,
|
|
70
73
|
queueName,
|
|
71
74
|
action,
|
|
72
75
|
isCreateMainFunction: checkOverWriteGenerateMainFunction(objectSchema, action),
|
|
@@ -61,13 +61,16 @@ function data(_izContext, objectSchema, srcPath) {
|
|
|
61
61
|
|
|
62
62
|
|
|
63
63
|
function createParamForCreateHandlerGet(objectSchema, action, handler, srcPath) {
|
|
64
|
+
// let objectType = objectSchema.objectType;
|
|
64
65
|
let objectType = objectSchema.objectType;
|
|
66
|
+
let groupBy = objectSchema?.shortNameObjectType ? objectSchema.shortNameObjectType : objectSchema.objectType;
|
|
65
67
|
let functionName = objectType + upperCase(action);
|
|
66
68
|
return {
|
|
67
69
|
templatePath: templatePath,
|
|
68
70
|
templateData: {
|
|
69
71
|
functionName: functionName,
|
|
70
72
|
objectType: objectType,
|
|
73
|
+
roleName: groupBy,
|
|
71
74
|
action: action,
|
|
72
75
|
isCreateMainFunction: checkOverWriteGenerateMainFunction(objectSchema, action),
|
|
73
76
|
},
|
|
@@ -59,7 +59,9 @@ function data(_izContext, objectSchema, srcPath) {
|
|
|
59
59
|
|
|
60
60
|
|
|
61
61
|
function createParamForCreateSourceGetHandler(objectSchema, action, handler, srcPath) {
|
|
62
|
+
// let objectType = objectSchema.objectType;
|
|
62
63
|
let objectType = objectSchema.objectType;
|
|
64
|
+
let groupBy = objectSchema?.shortNameObjectType ? objectSchema.shortNameObjectType : objectSchema.objectType;
|
|
63
65
|
let functionName = objectType + firstLetterUpperCase(action);
|
|
64
66
|
let queueName = functionName + upperCase(handler);
|
|
65
67
|
return {
|
|
@@ -67,6 +69,7 @@ function createParamForCreateSourceGetHandler(objectSchema, action, handler, src
|
|
|
67
69
|
templateData: {
|
|
68
70
|
functionName: functionName,
|
|
69
71
|
objectType: objectType,
|
|
72
|
+
roleName: groupBy,
|
|
70
73
|
queueName,
|
|
71
74
|
action,
|
|
72
75
|
isCreateMainFunction: checkOverWriteGenerateMainFunction(objectSchema, action),
|
|
@@ -44,13 +44,16 @@ async function data(_izContext, objectSchema, srcPath) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
async function createParamForCreateSource(_izContext, objectSchema, action, srcPath) {
|
|
47
|
+
// let objectType = objectSchema.objectType;
|
|
47
48
|
let objectType = objectSchema.objectType;
|
|
49
|
+
let groupBy = objectSchema?.shortNameObjectType ? objectSchema.shortNameObjectType : objectSchema.objectType;
|
|
48
50
|
let functionName = objectType + upperCase(action);
|
|
49
51
|
return {
|
|
50
52
|
templatePath: templatePath,
|
|
51
53
|
templateData: {
|
|
52
54
|
functionName: functionName,
|
|
53
55
|
objectType: objectType,
|
|
56
|
+
roleName: groupBy,
|
|
54
57
|
actionHandler: action,
|
|
55
58
|
},
|
|
56
59
|
setting: {
|
|
@@ -44,13 +44,16 @@ async function data(_izContext, objectSchema, srcPath) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
async function createParamForCreateSource(_izContext, objectSchema, action, srcPath) {
|
|
47
|
+
// let objectType = objectSchema.objectType;
|
|
47
48
|
let objectType = objectSchema.objectType;
|
|
49
|
+
let groupBy = objectSchema?.shortNameObjectType ? objectSchema.shortNameObjectType : objectSchema.objectType;
|
|
48
50
|
let functionName = objectType + upperCase(action);
|
|
49
51
|
return {
|
|
50
52
|
templatePath: templatePath,
|
|
51
53
|
templateData: {
|
|
52
54
|
functionName: functionName,
|
|
53
55
|
objectType: objectType,
|
|
56
|
+
roleName: groupBy,
|
|
54
57
|
action: action
|
|
55
58
|
},
|
|
56
59
|
setting: {
|
|
@@ -44,13 +44,16 @@ async function data(_izContext, objectSchema, srcPath) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
async function createParamForCreateSource(_izContext, objectSchema, action, srcPath) {
|
|
47
|
+
// let objectType = objectSchema.objectType;
|
|
47
48
|
let objectType = objectSchema.objectType;
|
|
49
|
+
let groupBy = objectSchema?.shortNameObjectType ? objectSchema.shortNameObjectType : objectSchema.objectType;
|
|
48
50
|
let functionName = objectType + upperCase(action);
|
|
49
51
|
return {
|
|
50
52
|
templatePath: templatePath,
|
|
51
53
|
templateData: {
|
|
52
54
|
functionName: functionName,
|
|
53
55
|
objectType: objectType,
|
|
56
|
+
roleName: groupBy,
|
|
54
57
|
action: action
|
|
55
58
|
},
|
|
56
59
|
setting: {
|
|
@@ -38,7 +38,9 @@ async function data(_izContext, objectSchema, srcPath) {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
async function createMainFunctionUpdateEndpoint(_izContext, objectSchema, action, srcPath) {
|
|
41
|
-
let objectType = objectSchema.objectType
|
|
41
|
+
// let objectType = objectSchema.objectType
|
|
42
|
+
let objectType = objectSchema?.shortNameObjectType ? objectSchema.shortNameObjectType : objectSchema.objectType
|
|
43
|
+
|
|
42
44
|
let actionHandler = action;
|
|
43
45
|
let functionName = (objectType) + upperCase(actionHandler);
|
|
44
46
|
return {
|