@izara_project/izara-market-library-service-schemas 1.0.8 → 1.0.9
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 +2 -2
- package/src/GenerateCodeLibs/src/Consts.js +12 -12
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +1 -2
- package/src/MainLibs/src/Utils.js +13 -0
- package/src/TemplateManager/src/FindData/FindDataYaml/data.js +3 -2
- package/src/TemplateManager/src/FindData/FindDataYaml/template.ejs +1 -1
- package/src/TemplateManager/src/FindData/Handler/data.js +1 -6
- package/src/TemplateManager/src/GenerateCode.js +3 -5
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/functionYaml/data.js +1 -1
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/handler/data.js +1 -1
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/handler/template.ejs +11 -11
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/mainFunction/data.js +1 -1
- package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/mainFunction/template.ejs +5 -8
- package/src/TemplateManager/src/OutPerActionComplete/OutDeleteComplete/functionYaml/data.js +1 -1
- package/src/TemplateManager/src/OutPerActionComplete/OutDeleteComplete/handler/data.js +1 -1
- package/src/TemplateManager/src/OutPerActionComplete/OutDeleteComplete/mainFunction/data.js +1 -1
- package/src/TemplateManager/src/OutPerActionComplete/OutDeleteComplete/mainFunction/template.ejs +3 -3
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/functionYaml/data.js +1 -1
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/handler/data.js +1 -1
- package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/mainFunction/data.js +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrApi/data.js +12 -6
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrApi/template.ejs +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrDsq/data.js +12 -8
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrDsq/template.ejs +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrInv/data.js +9 -11
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrInv/template.ejs +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrSqs/data.js +10 -5
- package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrSqs/template.ejs +1 -1
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrApi/data.js +0 -2
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrDsq/data.js +1 -2
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrDsq/template.ejs +78 -66
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/data.js +0 -2
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/template.ejs +1 -2
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrSqs/data.js +2 -3
- package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrSqs/template.ejs +62 -53
- package/src/TemplateManager/src/ProcessLogical/Handler/data.js +0 -1
- package/src/TemplateManager/src/ProcessLogical/ProcessLogicalYaml/data.js +3 -2
- package/src/TemplateManager/src/ProcessLogical/ProcessLogicalYaml/template.ejs +1 -1
- package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrDsq/data.js +3 -2
- package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrDsq/template.ejs +1 -1
- package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrSqs/data.js +3 -2
- package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrSqs/template.ejs +1 -1
- package/src/TemplateManager/src/ProcessLogicalPagination/Handler/HdrDsq/data.js +1 -3
- package/src/TemplateManager/src/ProcessLogicalPagination/Handler/HdrSqs/data.js +1 -3
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrApi/data.js +3 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrApi/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrDsq/data.js +3 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrDsq/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrInv/data.js +3 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrInv/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrSqs/data.js +3 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrSqs/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/perAction/HdrApi/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/perAction/HdrDsq/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/perAction/HdrInv/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/perAction/HdrSqs/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationshipComplete/functionYaml/data.js +3 -2
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationshipComplete/functionYaml/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationshipComplete/handler/HdrSqs/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrApi/data.js +3 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrApi/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrDsq/data.js +3 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrDsq/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrInv/data.js +2 -1
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrInv/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrSqs/data.js +3 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrSqs/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/perAction/HdrApi/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/perAction/HdrDsq/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/perAction/HdrInv/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/perAction/HdrSqs/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/functionYaml/data.js +3 -2
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/functionYaml/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/handler/HdrSqs/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRalationshipComplete/functionYaml/data.js +3 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRalationshipComplete/functionYaml/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRalationshipComplete/handler/HdrSqs/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrApi/data.js +3 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrApi/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrDsq/data.js +3 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrDsq/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrInv/data.js +4 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrInv/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrSqs/data.js +3 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrSqs/template.ejs +1 -1
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/perAction/HdrApi/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/perAction/HdrDsq/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/perAction/HdrInv/data.js +0 -2
- package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/perAction/HdrSqs/data.js +0 -2
- package/src/TemplateManager/src/ResourceYaml/dynamodb/mainResourcePerObjectSchemaData.js +3 -3
- package/src/TemplateManager/src/ResourceYaml/sns-in-sqs/defaultSnsInSqsForFindDataAndProcessLogical.js +6 -6
- package/src/TemplateManager/src/ResourceYaml/sns-out/defaultSnsOutForFindDataAndProcessLogical.js +2 -2
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/functionYaml/data.js +3 -2
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/functionYaml/template.ejs +1 -1
- package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/handler/dataHdrDsq.js +0 -2
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrDsq/data.js +4 -3
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrDsq/template.ejs +30 -0
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrSqs/data.js +4 -3
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrSqs/template.ejs +30 -0
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrDsq/data.js +0 -2
- package/src/TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrSqs/data.js +0 -2
- package/src/TemplateManager/src/externalService/FunctionNameConfig/template.ejs +13 -2
- package/src/TemplateManager/src/externalService/LambdaRole/data.js +38 -38
- package/src/TemplateManager/src/externalService/SnsTopicSubscriotions/template.ejs +19 -0
- package/src/TemplateManager/src/libs/Consts.js +20 -17
|
@@ -21,8 +21,8 @@ const fs = require('fs');
|
|
|
21
21
|
|
|
22
22
|
const { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
23
23
|
|
|
24
|
-
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../MainLibs/src/Utils")
|
|
25
|
-
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, SNS_RESOURCE, FUNCTION_NAME, DYNAMO_RESOURCE, defaultIamRolePerAction, awaitingMultipleStepsRole } = require("../../../libs/Consts");
|
|
24
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase, renameObjectType } = require("../../../../../MainLibs/src/Utils")
|
|
25
|
+
const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, SNS_RESOURCE, FUNCTION_NAME, DYNAMO_RESOURCE, defaultIamRolePerAction, awaitingMultipleStepsRole, shortNameHandler } = require("../../../libs/Consts");
|
|
26
26
|
|
|
27
27
|
const templatePath = path.join(__dirname, "./template.ejs")
|
|
28
28
|
|
|
@@ -35,12 +35,13 @@ const templatePath = path.join(__dirname, "./template.ejs")
|
|
|
35
35
|
*/
|
|
36
36
|
function data(_izContext, objectSchema, srcPath) {
|
|
37
37
|
let createSourceArray = [];
|
|
38
|
+
let newObjectSchema = renameObjectType(objectSchema, srcPath)
|
|
38
39
|
for (const action of Object.values(ACTIONS)) {
|
|
39
40
|
if (objectSchema.overWriteHandlers?.[action]) {
|
|
40
41
|
// if have overWriteHander of action check hdrApi inside
|
|
41
42
|
if (objectSchema.overWriteHandlers[action].includes(HANDLER.hdrSqs)) {
|
|
42
43
|
// create template data
|
|
43
|
-
const createSourceParam = createParamForCreateSource(
|
|
44
|
+
const createSourceParam = createParamForCreateSource(newObjectSchema, action, srcPath)
|
|
44
45
|
createSourceArray.push(createSourceParam)
|
|
45
46
|
}
|
|
46
47
|
} else {
|
|
@@ -48,7 +49,7 @@ function data(_izContext, objectSchema, srcPath) {
|
|
|
48
49
|
const defaultHandler = DEFAULT_HANDLER_PER_ACTION[action]
|
|
49
50
|
if (defaultHandler.includes(HANDLER.hdrSqs)) {
|
|
50
51
|
// create template data and object for create source
|
|
51
|
-
const createSourceParam = createParamForCreateSource(
|
|
52
|
+
const createSourceParam = createParamForCreateSource(newObjectSchema, action, srcPath)
|
|
52
53
|
createSourceArray.push(createSourceParam)
|
|
53
54
|
}
|
|
54
55
|
}
|
|
@@ -65,6 +66,9 @@ function createParamForCreateSource(objectSchema, action, srcPath) {
|
|
|
65
66
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
66
67
|
let tableForGetItem = [];
|
|
67
68
|
let hasGraphStorage = false;
|
|
69
|
+
let functionNameObjectType = objectSchema?.shortNameObjectType ? objectSchema.shortNameObjectType : objectSchema.objectType
|
|
70
|
+
let functionNameConfig = upperCase(functionNameObjectType) + upperCase(action) + upperCase(shortNameHandler(HANDLER.hdrSqs))
|
|
71
|
+
|
|
68
72
|
for (let storageResource of Object.values(objectSchema.storageResources)) {
|
|
69
73
|
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
70
74
|
// add IamRole for dynamodb depend on tableName in storageResources of objectSchema
|
|
@@ -156,7 +160,8 @@ function createParamForCreateSource(objectSchema, action, srcPath) {
|
|
|
156
160
|
actionHandler: actionHandler,
|
|
157
161
|
resourceLocation: SOURCE_PATH.resourceLocationPerAction,
|
|
158
162
|
handlerType: HANDLER.hdrSqs,
|
|
159
|
-
additionalResourcePermission
|
|
163
|
+
additionalResourcePermission,
|
|
164
|
+
functionNameConfig
|
|
160
165
|
},
|
|
161
166
|
setting: {
|
|
162
167
|
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<%_ const join = require('path').join; _%>
|
|
2
|
-
<%- firstLetterUpperCase(
|
|
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
5
|
events:
|
|
@@ -62,7 +62,6 @@ function data(_izContext, objectSchema, srcPath) {
|
|
|
62
62
|
function createParamForCreateSource(objectSchema, action, handler, srcPath) {
|
|
63
63
|
let objectType = objectSchema.objectType;
|
|
64
64
|
let functionName = objectType + firstLetterUpperCase(action);
|
|
65
|
-
let functionNameConfig = `${objectType + upperCase(action)}${upperCase(handler)}`
|
|
66
65
|
return {
|
|
67
66
|
templatePath: templatePath,
|
|
68
67
|
templateData: {
|
|
@@ -70,7 +69,6 @@ function createParamForCreateSource(objectSchema, action, handler, srcPath) {
|
|
|
70
69
|
objectType: objectType,
|
|
71
70
|
action: action,
|
|
72
71
|
isCreateMainFunction: checkOverWriteGenerateMainFunction(objectSchema, action),
|
|
73
|
-
functionNameConfig
|
|
74
72
|
},
|
|
75
73
|
setting: {
|
|
76
74
|
savePath: path.join(srcPath, SOURCE_PATH.lambdaPerAction),
|
|
@@ -62,7 +62,6 @@ function createParamForCreateSourceHandlerGet(objectSchema, action, handler, src
|
|
|
62
62
|
let objectType = objectSchema.objectType;
|
|
63
63
|
let functionName = objectType + upperCase(action);
|
|
64
64
|
let queueName = objectType + firstLetterUpperCase(action) + upperCase(handler);
|
|
65
|
-
let functionNameConfig = `${objectType + upperCase(action)}${upperCase(handler)}`
|
|
66
65
|
return {
|
|
67
66
|
templatePath: templatePath,
|
|
68
67
|
templateData: {
|
|
@@ -71,7 +70,7 @@ function createParamForCreateSourceHandlerGet(objectSchema, action, handler, src
|
|
|
71
70
|
queueName,
|
|
72
71
|
action,
|
|
73
72
|
isCreateMainFunction: checkOverWriteGenerateMainFunction(objectSchema, action),
|
|
74
|
-
|
|
73
|
+
handler
|
|
75
74
|
},
|
|
76
75
|
setting: {
|
|
77
76
|
savePath: path.join(srcPath, SOURCE_PATH.lambdaPerAction),
|
|
@@ -18,12 +18,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
18
18
|
'use strict';
|
|
19
19
|
const izara = require("@izara_project/izara-middleware");
|
|
20
20
|
const middleware = izara.middlewareHandler;
|
|
21
|
-
const callingFlowSharedLib = require('@izara_project/izara-shared/src/CallingFlowSharedLib')
|
|
22
|
-
const recordHandlerSharedLib = require('@izara_project/izara-shared').recordHandlerSharedLib;
|
|
23
|
-
const {
|
|
24
|
-
validateSchemaMiddleware
|
|
25
|
-
} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs');
|
|
21
|
+
const callingFlowSharedLib = require('@izara_project/izara-shared/src/CallingFlowSharedLib')
|
|
26
22
|
const Logger = require('@izara_project/izara-core-library-logger');
|
|
23
|
+
const {validateSchemaPerRecord} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs')
|
|
24
|
+
const recordHandlerSharedLib = require('@izara_project/izara-shared').recordHandlerSharedLib
|
|
27
25
|
|
|
28
26
|
<%_ if (isCreateMainFunction == true) { _%>
|
|
29
27
|
// user generate main function
|
|
@@ -31,78 +29,92 @@ const Logger = require('@izara_project/izara-core-library-logger');
|
|
|
31
29
|
const <%- functionName %> =require('./<%- firstLetterUpperCase(objectType) %><%- firstLetterUpperCase(action) %>_Main')
|
|
32
30
|
<%_ } _%>
|
|
33
31
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
middleware,
|
|
37
|
-
"<%- firstLetterUpperCase(objectType) %>",
|
|
38
|
-
"<%- action %>"
|
|
39
|
-
//(<validateSchemaSetting>
|
|
40
|
-
//</validateSchemaSetting>)
|
|
41
|
-
)
|
|
42
|
-
// if need to validate authorizer or additional params , add code to hook tag below
|
|
32
|
+
//(<globalVarible>
|
|
33
|
+
//</globalVarible>)
|
|
43
34
|
|
|
44
|
-
|
|
45
|
-
|
|
35
|
+
//validate event params in middleware before into main function
|
|
36
|
+
middleware.setValidatorSchema(
|
|
37
|
+
recordHandlerSharedLib.baseValidatorSchema(),
|
|
38
|
+
//(<middlewareSettings>)
|
|
39
|
+
//(</middlewareSettings>)
|
|
40
|
+
)
|
|
46
41
|
|
|
47
|
-
|
|
42
|
+
//(<globalValidatorSchema>)
|
|
43
|
+
const perRecordsValidatorSchema = {
|
|
44
|
+
type: "object",
|
|
45
|
+
required: [],
|
|
46
|
+
properties: {},
|
|
47
|
+
}
|
|
48
|
+
//(</globalValidatorSchema>)
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
let recordPromises = []; // final return
|
|
52
|
-
|
|
53
|
-
// loop each record and send to mainFunction
|
|
54
|
-
await Promise.all(event.Records.map(async record => { // promise.all for map() function
|
|
55
|
-
|
|
56
|
-
// --- reforming record.body for Dsq request
|
|
57
|
-
record = recordHandlerSharedLib.reformatDsqMessage(record._izContext, record);
|
|
58
|
-
record._izContext.logger.debug('record LambdaFunctionHdrDsq after reform', record);
|
|
50
|
+
// if need to validate authorizer or additional params , add code to hook tag below
|
|
59
51
|
|
|
60
|
-
|
|
52
|
+
module.exports.main = middleware.wrap(async (event,context, callback) => {
|
|
61
53
|
|
|
62
|
-
|
|
63
|
-
await recordHandlerSharedLib.validateRecord(
|
|
64
|
-
record, // one record will send to mainFunction
|
|
65
|
-
"<%- queueName %>", // queue name that need to retry or send to dlq
|
|
66
|
-
perRecordsValidatorSchema, // schema for record.Message
|
|
67
|
-
// messageAttributeValidatorSchema // ----- for msgAttr default is null -> do not send this parameter if not want to validate msgAtt
|
|
68
|
-
);
|
|
54
|
+
try {
|
|
69
55
|
|
|
70
|
-
|
|
71
|
-
|
|
56
|
+
let recordPromises = [];
|
|
57
|
+
|
|
58
|
+
await Promise.all(event.Records.map(async record => {
|
|
59
|
+
record._izContext.logger.debug('record RecieveMsgOutHdrSqs', record);
|
|
60
|
+
|
|
61
|
+
let passOnProperties = [];
|
|
62
|
+
|
|
63
|
+
const OBJTYPE = {
|
|
64
|
+
objectType: "<%- objectType %>",
|
|
65
|
+
serviceTag: process.env.iz_serviceTag
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
await validateSchemaPerRecord(
|
|
69
|
+
record,
|
|
70
|
+
<%- functionName %>,
|
|
71
|
+
"OBJTYPE,
|
|
72
|
+
<%- action %>"
|
|
73
|
+
//(<validateSchemaSetting>)
|
|
74
|
+
//(</validateSchemaSetting>)
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
//for validate additional params
|
|
78
|
+
//(<afterGenerateValidatorSchema>)
|
|
79
|
+
/*
|
|
80
|
+
await recordHandlerSharedLib.validateRecord(
|
|
81
|
+
record,
|
|
82
|
+
<%- functionName %>,
|
|
83
|
+
perRecordsValidatorSchema
|
|
84
|
+
);
|
|
85
|
+
*/
|
|
86
|
+
//(</afterGenerateValidatorSchema>)
|
|
87
|
+
|
|
88
|
+
//(<additionalParams>)
|
|
89
|
+
//(</additionalParams>)
|
|
90
|
+
|
|
91
|
+
passOnProperties.push(record.body.Message);
|
|
92
|
+
passOnProperties.push(callingFlowSharedLib.addCallingFlowToPassOnProperties(record.body.Message));
|
|
72
93
|
record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
|
|
73
94
|
|
|
74
|
-
// call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
|
|
75
95
|
let recordPromise = recordHandlerSharedLib.recordHandler(
|
|
76
|
-
record,
|
|
77
|
-
<%- functionName %>.<%- functionName %>Main,
|
|
78
|
-
|
|
79
|
-
passOnProperties
|
|
96
|
+
record,
|
|
97
|
+
<%- functionName %>.<%- functionName %>Main, // mainFunction
|
|
98
|
+
'<%- firstLetterUpperCase(queueName) %>', // queueName
|
|
99
|
+
passOnProperties
|
|
80
100
|
);
|
|
81
|
-
record._izContext.logger.debug('after
|
|
82
|
-
recordPromises.push(recordPromise);
|
|
83
|
-
}))
|
|
101
|
+
record._izContext.logger.debug('after record Promise in handler');
|
|
102
|
+
recordPromises.push(recordPromise);
|
|
103
|
+
}))
|
|
84
104
|
|
|
85
|
-
Logger.debug('before Promise.all(
|
|
105
|
+
Logger.debug('before Promise.all(recordPromise) in handler');
|
|
86
106
|
try {
|
|
87
|
-
await Promise.all(recordPromises);
|
|
88
|
-
return event.Records // return all for local test
|
|
89
|
-
} catch {
|
|
90
|
-
Logger.debug('Promise.all(recordPromises) in handler threw error (at least one record did no resolve)');
|
|
91
|
-
}
|
|
92
|
-
Logger.debug('after Promise.all(recordPromises) in handler');
|
|
93
|
-
} catch (err) {
|
|
94
|
-
Logger.error('Unhandled Error, <%- firstLetterUpperCase(objectType) %><%- firstLetterUpperCase(action) %>Dsq :', err);
|
|
95
|
-
throw (err);
|
|
96
|
-
}
|
|
97
|
-
})
|
|
98
|
-
|
|
99
|
-
|
|
107
|
+
await Promise.all(recordPromises);
|
|
100
108
|
|
|
109
|
+
return event.Records
|
|
110
|
+
} catch {
|
|
111
|
+
Logger.debug('Promise.all(recordPromises) in handler threw error (at least one record did no resolve)');
|
|
112
|
+
}
|
|
113
|
+
Logger.debug('after Promise.all(recordPromises) in handler');
|
|
101
114
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
} _%>
|
|
115
|
+
} catch (err) {
|
|
116
|
+
Logger.debug('unhandled error <%- functionName %><%- handler %>')
|
|
117
|
+
throw err
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
)
|
|
@@ -63,7 +63,6 @@ function data(_izContext, objectSchema, srcPath) {
|
|
|
63
63
|
function createParamForCreateHandlerGet(objectSchema, action, handler, srcPath) {
|
|
64
64
|
let objectType = objectSchema.objectType;
|
|
65
65
|
let functionName = objectType + upperCase(action);
|
|
66
|
-
let functionNameConfig = `${objectType + upperCase(action)}${upperCase(handler)}`
|
|
67
66
|
return {
|
|
68
67
|
templatePath: templatePath,
|
|
69
68
|
templateData: {
|
|
@@ -71,7 +70,6 @@ function createParamForCreateHandlerGet(objectSchema, action, handler, srcPath)
|
|
|
71
70
|
objectType: objectType,
|
|
72
71
|
action: action,
|
|
73
72
|
isCreateMainFunction: checkOverWriteGenerateMainFunction(objectSchema, action),
|
|
74
|
-
functionNameConfig
|
|
75
73
|
},
|
|
76
74
|
setting: {
|
|
77
75
|
savePath: path.join(srcPath, SOURCE_PATH.lambdaPerAction),
|
|
@@ -40,12 +40,11 @@ const {
|
|
|
40
40
|
//validate event params in middleware before into function
|
|
41
41
|
validateSchemaMiddleware(
|
|
42
42
|
middleware,
|
|
43
|
-
"<%- firstLetterUpperCase(objectType) %>",
|
|
43
|
+
"<%- firstLetterUpperCase(objectType) %>", // objectType
|
|
44
44
|
"<%- action %>", // action
|
|
45
45
|
//(<validateSchemaSetting>)
|
|
46
46
|
//(</validateSchemaSetting>)
|
|
47
47
|
)
|
|
48
|
-
|
|
49
48
|
// if need to validate authorizer or additional params, add code to hook tag below
|
|
50
49
|
|
|
51
50
|
//(<afterValidateWithGenereatedSchema>)
|
|
@@ -61,8 +61,7 @@ function data(_izContext, objectSchema, srcPath) {
|
|
|
61
61
|
function createParamForCreateSourceGetHandler(objectSchema, action, handler, srcPath) {
|
|
62
62
|
let objectType = objectSchema.objectType;
|
|
63
63
|
let functionName = objectType + firstLetterUpperCase(action);
|
|
64
|
-
let queueName = functionName + handler;
|
|
65
|
-
let functionNameConfig = `${objectType + upperCase(action)}${upperCase(handler)}`
|
|
64
|
+
let queueName = functionName + upperCase(handler);
|
|
66
65
|
return {
|
|
67
66
|
templatePath: templatePath,
|
|
68
67
|
templateData: {
|
|
@@ -71,7 +70,7 @@ function createParamForCreateSourceGetHandler(objectSchema, action, handler, src
|
|
|
71
70
|
queueName,
|
|
72
71
|
action,
|
|
73
72
|
isCreateMainFunction: checkOverWriteGenerateMainFunction(objectSchema, action),
|
|
74
|
-
|
|
73
|
+
handler
|
|
75
74
|
},
|
|
76
75
|
setting: {
|
|
77
76
|
savePath: path.join(srcPath, SOURCE_PATH.lambdaPerAction),
|
|
@@ -19,10 +19,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
19
19
|
const izara = require("@izara_project/izara-middleware");
|
|
20
20
|
const middleware = izara.middlewareHandler;
|
|
21
21
|
const callingFlowSharedLib = require('@izara_project/izara-shared/src/CallingFlowSharedLib')
|
|
22
|
-
const {
|
|
23
|
-
validateSchemaMiddleware
|
|
24
|
-
} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs');
|
|
25
22
|
const Logger = require('@izara_project/izara-core-library-logger');
|
|
23
|
+
const {validateSchemaPerRecord} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs')
|
|
26
24
|
const recordHandlerSharedLib = require('@izara_project/izara-shared').recordHandlerSharedLib
|
|
27
25
|
|
|
28
26
|
<%_ if (isCreateMainFunction == true) { _%>
|
|
@@ -35,83 +33,94 @@ const recordHandlerSharedLib = require('@izara_project/izara-shared').recordHand
|
|
|
35
33
|
//</globalVarible>)
|
|
36
34
|
|
|
37
35
|
//validate event params in middleware before into main function
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
//(<validateSchemaSetting>
|
|
43
|
-
//</validateSchemaSetting>)
|
|
36
|
+
middleware.setValidatorSchema(
|
|
37
|
+
recordHandlerSharedLib.baseValidatorSchema(),
|
|
38
|
+
//(<middlewareSettings>)
|
|
39
|
+
//(</middlewareSettings>)
|
|
44
40
|
)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const messageAttributeValidatorSchema = {
|
|
52
|
-
type: "object",
|
|
53
|
-
require: ['msgAtrrParam1','msgAtrrParam2'],
|
|
54
|
-
properties: {
|
|
55
|
-
msgAtrrParam1: {
|
|
56
|
-
type: 'string'
|
|
57
|
-
},
|
|
58
|
-
msgAtrrParam2: {
|
|
59
|
-
type: 'string'
|
|
41
|
+
|
|
42
|
+
//(<globalValidatorSchema>)
|
|
43
|
+
const perRecordsValidatorSchema = {
|
|
44
|
+
type: "object",
|
|
45
|
+
required: [],
|
|
46
|
+
properties: {},
|
|
60
47
|
}
|
|
61
|
-
|
|
62
|
-
};
|
|
48
|
+
//(</globalValidatorSchema>)
|
|
63
49
|
|
|
64
50
|
// if need to validate authorizer or additional params , add code to hook tag below
|
|
65
51
|
|
|
66
|
-
|
|
67
|
-
|
|
52
|
+
module.exports.main = middleware.wrap(async (event,context, callback) => {
|
|
53
|
+
|
|
68
54
|
try {
|
|
69
55
|
|
|
70
56
|
let recordPromises = [];
|
|
71
57
|
|
|
72
58
|
await Promise.all(event.Records.map(async record => {
|
|
59
|
+
record._izContext.logger.debug('record RecieveMsgOutHdrSqs', record);
|
|
73
60
|
|
|
74
61
|
let passOnProperties = [];
|
|
75
|
-
record._izContext.logger.debug('record ReceiveMesOutHdrSqs' , record);
|
|
76
62
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
perRecordValidatorSchema,
|
|
82
|
-
// messageAttributeValidatorSchema
|
|
83
|
-
);
|
|
63
|
+
const OBJTYPE = {
|
|
64
|
+
objectType: "<%- objectType %>",
|
|
65
|
+
serviceTag: process.env.iz_serviceTag
|
|
66
|
+
}
|
|
84
67
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
68
|
+
await validateSchemaPerRecord(
|
|
69
|
+
record,
|
|
70
|
+
<%- functionName %>,
|
|
71
|
+
OBJTYPE,
|
|
72
|
+
"<%- action %>"
|
|
73
|
+
//(<validateSchemaSetting>)
|
|
74
|
+
//(</validateSchemaSetting>)
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
//for validate additional params
|
|
78
|
+
//(<afterGenerateValidatorSchema>)
|
|
79
|
+
/*
|
|
80
|
+
await recordHandlerSharedLib.validateRecord(
|
|
81
|
+
record,
|
|
82
|
+
<%- functionName %>,
|
|
83
|
+
perRecordsValidatorSchema
|
|
84
|
+
);
|
|
85
|
+
*/
|
|
86
|
+
//(</afterGenerateValidatorSchema>)
|
|
87
|
+
|
|
88
|
+
//(<additionalParams>)
|
|
89
|
+
//(</additionalParams>)
|
|
90
|
+
|
|
91
|
+
passOnProperties.push(record.body.Message);
|
|
92
|
+
passOnProperties.push(callingFlowSharedLib.addCallingFlowToPassOnProperties(record.body.Message));
|
|
93
|
+
record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
|
|
88
94
|
|
|
89
|
-
// call recordHandlerSharedLib.recordHandler with 3 parameters and return Promise (resolve)
|
|
90
95
|
let recordPromise = recordHandlerSharedLib.recordHandler(
|
|
91
96
|
record,
|
|
92
|
-
<%- functionName %>.<%- functionName %>Main,
|
|
93
|
-
|
|
94
|
-
passOnProperties
|
|
97
|
+
<%- functionName %>.<%- functionName %>Main, // mainFunction
|
|
98
|
+
'<%- firstLetterUpperCase(queueName) %>', // queueName
|
|
99
|
+
passOnProperties
|
|
95
100
|
);
|
|
96
|
-
record._izContext.logger.debug('after
|
|
101
|
+
record._izContext.logger.debug('after record Promise in handler');
|
|
97
102
|
recordPromises.push(recordPromise);
|
|
98
103
|
}))
|
|
99
104
|
|
|
100
|
-
Logger.debug('before Promise.all(
|
|
105
|
+
Logger.debug('before Promise.all(recordPromise) in handler');
|
|
101
106
|
try {
|
|
102
|
-
|
|
103
|
-
await Promise.all(recordPromises); // await all Promises
|
|
107
|
+
await Promise.all(recordPromises);
|
|
104
108
|
|
|
105
|
-
return event.Records
|
|
109
|
+
return event.Records
|
|
106
110
|
} catch {
|
|
107
|
-
Logger.debug('Promise.all(recordPromises) in handler threw error (at least one record did
|
|
111
|
+
Logger.debug('Promise.all(recordPromises) in handler threw error (at least one record did no resolve)');
|
|
108
112
|
}
|
|
109
|
-
Logger.debug('after Promise
|
|
113
|
+
Logger.debug('after Promise.all(recordPromises) in handler');
|
|
114
|
+
|
|
110
115
|
} catch (err) {
|
|
111
|
-
|
|
112
|
-
|
|
116
|
+
Logger.debug('unhandled error <%- functionName %><%- handler %>')
|
|
117
|
+
throw err
|
|
118
|
+
}
|
|
113
119
|
}
|
|
114
|
-
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
115
124
|
<%_ function firstLetterUpperCase(text){
|
|
116
125
|
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
117
126
|
} _%>
|
|
@@ -37,7 +37,6 @@ function data(_izContext, srcPath) {
|
|
|
37
37
|
return {
|
|
38
38
|
templatePath: templatePath,
|
|
39
39
|
templateData: {
|
|
40
|
-
functionNameConfig: `${upperCase(FUNCTION_NAME.processLogical)}${upperCase(HANDLER.hdrSqs)}`
|
|
41
40
|
},
|
|
42
41
|
setting: {
|
|
43
42
|
savePath: path.join(srcPath, SOURCE_PATH.processLogical),
|
|
@@ -26,7 +26,7 @@ const serviceConfig = serviceSchemas.serviceConfig;
|
|
|
26
26
|
|
|
27
27
|
const { HANDLER, STORAGE_TYPES, ACTIONS } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
28
28
|
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../MainLibs/src/Utils")
|
|
29
|
-
const { createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, LAMBDA_RESOURCE, FUNCTION_NAME, DYNAMO_RESOURCE, SNS_RESOURCE, defaultIamRolePerAction } = require("../../libs/Consts");
|
|
29
|
+
const { createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, LAMBDA_RESOURCE, FUNCTION_NAME, DYNAMO_RESOURCE, SNS_RESOURCE, defaultIamRolePerAction, shortNameHandler } = require("../../libs/Consts");
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* receive objectSchema
|
|
@@ -129,7 +129,8 @@ async function data(_izContext, objectSchemas, srcPath) {
|
|
|
129
129
|
functionName: functionName,
|
|
130
130
|
resourceLocation: SOURCE_PATH.resourceLocationProcessLogical,
|
|
131
131
|
handlerType: HANDLER.hdrSqs,
|
|
132
|
-
additionalResourcePermission
|
|
132
|
+
additionalResourcePermission,
|
|
133
|
+
functionNameConfig: upperCase(functionName) + upperCase(shortNameHandler(HANDLER.hdrSqs))
|
|
133
134
|
},
|
|
134
135
|
setting: {
|
|
135
136
|
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<%_ const join = require('path').join; _%>
|
|
2
|
-
<%-
|
|
2
|
+
<%- firstLetterUpperCase(functionNameConfig) %>:
|
|
3
3
|
handler: <%- join(resourceLocation, `${functionName}_${firstLetterUpperCase(handlerType)}.main`)%>
|
|
4
4
|
name: ${self:custom.iz_resourcePrefix}<%- functionName %><%- firstLetterUpperCase(handlerType) %>
|
|
5
5
|
events:
|
|
@@ -22,7 +22,7 @@ const path = require('path');
|
|
|
22
22
|
const templatePath = path.join(__dirname, "./template.ejs")
|
|
23
23
|
|
|
24
24
|
const { HANDLER, STORAGE_TYPES, ACTIONS } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
25
|
-
const { createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, defaultIamRolePerAction } = require("../../../libs/Consts");
|
|
25
|
+
const { createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, defaultIamRolePerAction, shortNameHandler } = require("../../../libs/Consts");
|
|
26
26
|
const { firstLetterUpperCase: upperCase } = require('../../../../../MainLibs/src/Utils');
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -122,7 +122,8 @@ async function data(_izContext, objectSchemas, srcPath) {
|
|
|
122
122
|
functionName: functionName,
|
|
123
123
|
resourceLocation: SOURCE_PATH.resourceLocationProcessLogical,
|
|
124
124
|
handlerType: HANDLER.hdrDsq,
|
|
125
|
-
additionalResourcePermission
|
|
125
|
+
additionalResourcePermission,
|
|
126
|
+
functionNameConfig: upperCase(functionName) + upperCase(shortNameHandler(HANDLER.hdrDsq))
|
|
126
127
|
},
|
|
127
128
|
setting: {
|
|
128
129
|
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<%_ const join = require('path').join; _%>
|
|
2
|
-
<%-
|
|
2
|
+
<%- firstLetterUpperCase(functionNameConfig) %>:
|
|
3
3
|
handler: <%- join(resourceLocation, `${functionName}_${firstLetterUpperCase(handlerType)}.main`)%>
|
|
4
4
|
name: ${self:custom.iz_resourcePrefix}<%- functionName %><%- firstLetterUpperCase(handlerType) %>
|
|
5
5
|
events:
|
|
@@ -22,7 +22,7 @@ const path = require('path');
|
|
|
22
22
|
const templatePath = path.join(__dirname, "./template.ejs")
|
|
23
23
|
|
|
24
24
|
const { HANDLER, STORAGE_TYPES, ACTIONS } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
25
|
-
const { createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, DYNAMO_RESOURCE, defaultIamRolePerAction, SNS_RESOURCE } = require("../../../libs/Consts");
|
|
25
|
+
const { createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, DYNAMO_RESOURCE, defaultIamRolePerAction, SNS_RESOURCE, shortNameHandler } = require("../../../libs/Consts");
|
|
26
26
|
const { firstLetterUpperCase: upperCase } = require('../../../../../MainLibs/src/Utils');
|
|
27
27
|
|
|
28
28
|
/**
|
|
@@ -124,7 +124,8 @@ async function data(_izContext, objectSchemas, srcPath) {
|
|
|
124
124
|
functionName: functionName,
|
|
125
125
|
resourceLocation: SOURCE_PATH.resourceLocationProcessLogical,
|
|
126
126
|
handlerType: HANDLER.hdrSqs,
|
|
127
|
-
additionalResourcePermission
|
|
127
|
+
additionalResourcePermission,
|
|
128
|
+
functionNameConfig: upperCase(functionName) + upperCase(shortNameHandler(HANDLER.hdrSqs))
|
|
128
129
|
},
|
|
129
130
|
setting: {
|
|
130
131
|
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<%_ const join = require('path').join; _%>
|
|
2
|
-
<%-
|
|
2
|
+
<%- firstLetterUpperCase(functionNameConfig) %>:
|
|
3
3
|
handler: <%- join(resourceLocation, `${functionName}_${firstLetterUpperCase(handlerType)}.main`)%>
|
|
4
4
|
name: ${self:custom.iz_resourcePrefix}<%- functionName %><%- firstLetterUpperCase(handlerType) %>
|
|
5
5
|
events:
|
|
@@ -35,9 +35,7 @@ function data(_izContext, srcPath) {
|
|
|
35
35
|
|
|
36
36
|
return {
|
|
37
37
|
templatePath: templatePath,
|
|
38
|
-
templateData: {
|
|
39
|
-
functionNameConfig: `${upperCase(FUNCTION_NAME.paginateProcessLogical)}${upperCase(HANDLER.hdrDsq)}`
|
|
40
|
-
},
|
|
38
|
+
templateData: {},
|
|
41
39
|
setting: {
|
|
42
40
|
savePath: path.join(srcPath, SOURCE_PATH.processLogical),
|
|
43
41
|
saveFileName: `${upperCase(FUNCTION_NAME.paginateProcessLogical)}_${upperCase(HANDLER.hdrDsq)}`,
|
|
@@ -35,9 +35,7 @@ function data(_izContext, srcPath) {
|
|
|
35
35
|
|
|
36
36
|
return {
|
|
37
37
|
templatePath: templatePath,
|
|
38
|
-
templateData: {
|
|
39
|
-
functionNameConfig: `${upperCase(FUNCTION_NAME.paginateProcessLogical)}${upperCase(HANDLER.hdrSqs)}`
|
|
40
|
-
},
|
|
38
|
+
templateData: {},
|
|
41
39
|
setting: {
|
|
42
40
|
savePath: path.join(srcPath, SOURCE_PATH.processLogical),
|
|
43
41
|
saveFileName: `${upperCase(FUNCTION_NAME.paginateProcessLogical)}_${upperCase(HANDLER.hdrSqs)}`,
|
|
@@ -22,7 +22,7 @@ const fs = require('fs');
|
|
|
22
22
|
const { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
23
23
|
|
|
24
24
|
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../../MainLibs/src/Utils")
|
|
25
|
-
const { createIamRole, resourceNames, RESOURCE_CLASSES, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, SNS_RESOURCE, defaultIamRolePerAction, awaitingMultipleStepsRole } = require("../../../../../libs/Consts");
|
|
25
|
+
const { createIamRole, resourceNames, RESOURCE_CLASSES, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, SNS_RESOURCE, defaultIamRolePerAction, awaitingMultipleStepsRole, shortNameHandler } = require("../../../../../libs/Consts");
|
|
26
26
|
|
|
27
27
|
const templatePath = path.join(__dirname, "./template.ejs")
|
|
28
28
|
|
|
@@ -69,7 +69,8 @@ function createParamForCreateSource(srcPath) {
|
|
|
69
69
|
functionName,
|
|
70
70
|
handlerType,
|
|
71
71
|
additionalResourcePermission,
|
|
72
|
-
resourceLocation: SOURCE_PATH.resourceLocationRelationshipPerAction
|
|
72
|
+
resourceLocation: SOURCE_PATH.resourceLocationRelationshipPerAction,
|
|
73
|
+
functionNameConfig: upperCase(functionName) + upperCase(shortNameHandler(handlerType))
|
|
73
74
|
},
|
|
74
75
|
setting: {
|
|
75
76
|
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<%_ const join = require('path').join; _%>
|
|
2
|
-
<%- firstLetterUpperCase(
|
|
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
5
|
events:
|
|
@@ -22,7 +22,7 @@ const fs = require('fs');
|
|
|
22
22
|
const { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
23
23
|
|
|
24
24
|
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../../MainLibs/src/Utils")
|
|
25
|
-
const { createIamRole, resourceNames, RESOURCE_CLASSES, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, SNS_RESOURCE, defaultIamRolePerAction, awaitingMultipleStepsRole } = require("../../../../../libs/Consts");
|
|
25
|
+
const { createIamRole, resourceNames, RESOURCE_CLASSES, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, SNS_RESOURCE, defaultIamRolePerAction, awaitingMultipleStepsRole, shortNameHandler } = require("../../../../../libs/Consts");
|
|
26
26
|
|
|
27
27
|
const templatePath = path.join(__dirname, './template.ejs')
|
|
28
28
|
|
|
@@ -82,7 +82,8 @@ function createParamForCreateSource(srcPath) {
|
|
|
82
82
|
functionName,
|
|
83
83
|
handlerType,
|
|
84
84
|
additionalResourcePermission,
|
|
85
|
-
resourceLocation: SOURCE_PATH.resourceLocationRelationshipPerAction
|
|
85
|
+
resourceLocation: SOURCE_PATH.resourceLocationRelationshipPerAction,
|
|
86
|
+
functionNameConfig: upperCase(functionName) + upperCase(shortNameHandler(handlerType))
|
|
86
87
|
},
|
|
87
88
|
setting: {
|
|
88
89
|
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|