@izara_project/izara-core-generate-service-code 1.0.30 → 1.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/generateCode/generateSchema/actionEndpointComponent/mainFunction/get/template.ejs +0 -9
- package/src/generateCode/generateSchema/rbac/dynamoDb/data.js +1 -39
- package/src/generateCode/generateSchema/rbac/index.js +7 -13
- package/src/generateCode/generateSchema/rbac/lambda/{authApi → handler}/data.js +4 -4
- package/src/generateCode/generateSchema/rbac/lambda/{authApi/templateInv.ejs → handler/template.ejs} +1 -1
- package/src/generateCode/generateSchema/rbac/lambda/mainFunction/template.ejs +111 -0
- package/src/generateCode/generateSchema/rbac/lambda/yaml/data.js +26 -48
- package/src/generateCode/generateSchema/rbac/lambda/authInv/handler/data.js +0 -70
- package/src/generateCode/generateSchema/rbac/lambda/authInv/handler/templateInv.ejs +0 -52
- package/src/generateCode/generateSchema/rbac/lambda/authInv/mainFunction/template.ejs +0 -42
- /package/src/generateCode/generateSchema/rbac/lambda/{authInv/mainFunction → mainFunction}/data.js +0 -0
package/package.json
CHANGED
package/src/generateCode/generateSchema/actionEndpointComponent/mainFunction/get/template.ejs
CHANGED
|
@@ -84,15 +84,6 @@ export default async function getMain(
|
|
|
84
84
|
const objectSchema = await getObjSchemaS3WithHierarchy(_izContext, objType);
|
|
85
85
|
_izContext.logger.debug('objectSchema:', objectSchema);
|
|
86
86
|
|
|
87
|
-
// ── Validate user context ─────────────────────────────────────────────────
|
|
88
|
-
if (objectSchema.generatedBy === 'userGenerated') {
|
|
89
|
-
const userId = _izContext.correlationIds.get(coreConsts.BASE_USER_ID);
|
|
90
|
-
const targetId = _izContext.correlationIds.get(coreConsts.TARGET_ID);
|
|
91
|
-
if (!userId) throw new Error('Not have userId');
|
|
92
|
-
if (objectSchema.hasOwnProperty('belongTo') && !targetId)
|
|
93
|
-
throw new Error('not have targetId');
|
|
94
|
-
}
|
|
95
|
-
|
|
96
87
|
// ── Build getDataDetails ──────────────────────────────────────────────────
|
|
97
88
|
const getDataDetails = await createGetDataDetails(_izContext, objectSchema);
|
|
98
89
|
_izContext.logger.debug('getDataDetails:', getDataDetails);
|
|
@@ -36,47 +36,9 @@ const createAwaitingMultipleStepDynamoDbData = (_izContext, srcPath) => {
|
|
|
36
36
|
const defaultDynamoDataLists = [];
|
|
37
37
|
|
|
38
38
|
defaultDynamoDataLists.push(
|
|
39
|
-
{
|
|
40
|
-
tableName: 'Permission',
|
|
41
|
-
resourceName: 'Permission',
|
|
42
|
-
attributes: [
|
|
43
|
-
{
|
|
44
|
-
keyType: 'partitionKey',
|
|
45
|
-
AttributeName: 'targetObjTypeConcat',
|
|
46
|
-
AttributeType: 'S'
|
|
47
|
-
}
|
|
48
|
-
]
|
|
49
|
-
},
|
|
50
39
|
{
|
|
51
40
|
tableName: 'RolePermissions',
|
|
52
41
|
resourceName: 'RolePermissions',
|
|
53
|
-
attributes: [
|
|
54
|
-
{
|
|
55
|
-
keyType: 'partitionKey',
|
|
56
|
-
AttributeName: 'roleIdKey',
|
|
57
|
-
AttributeType: 'S'
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
keyType: 'sortKey',
|
|
61
|
-
AttributeName: 'service_resource_action',
|
|
62
|
-
AttributeType: 'S'
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
tableName: 'Roles',
|
|
68
|
-
resourceName: 'Roles',
|
|
69
|
-
attributes: [
|
|
70
|
-
{
|
|
71
|
-
keyType: 'partitionKey',
|
|
72
|
-
AttributeName: 'roleIdKey',
|
|
73
|
-
AttributeType: 'S'
|
|
74
|
-
}
|
|
75
|
-
]
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
tableName: 'UserRoles',
|
|
79
|
-
resourceName: 'UserRoles',
|
|
80
42
|
attributes: [
|
|
81
43
|
{
|
|
82
44
|
keyType: 'partitionKey',
|
|
@@ -85,7 +47,7 @@ const createAwaitingMultipleStepDynamoDbData = (_izContext, srcPath) => {
|
|
|
85
47
|
},
|
|
86
48
|
{
|
|
87
49
|
keyType: 'sortKey',
|
|
88
|
-
AttributeName: '
|
|
50
|
+
AttributeName: 'flowTypeWithTargetIdConcat',
|
|
89
51
|
AttributeType: 'S'
|
|
90
52
|
}
|
|
91
53
|
]
|
|
@@ -20,12 +20,9 @@ import { join } from 'path';
|
|
|
20
20
|
import { getObjectSchema } from '@izara_project/izara-core-library-service-schemas';
|
|
21
21
|
const { getAllLocalObjectSchemasWithHierarchy } = getObjectSchema;
|
|
22
22
|
|
|
23
|
-
// lambda
|
|
24
|
-
import authInvHandler from './lambda/authInv/handler/data.js'
|
|
25
|
-
import authInvMain from './lambda/authInv/mainFunction/data.js'
|
|
26
|
-
|
|
27
23
|
// auth for api
|
|
28
|
-
import
|
|
24
|
+
import authHandler from './lambda/handler/data.js'
|
|
25
|
+
import authMainFunction from './lambda/mainFunction/data.js'
|
|
29
26
|
// yaml
|
|
30
27
|
import authYaml from './lambda/yaml/data.js';
|
|
31
28
|
// dynamo
|
|
@@ -45,19 +42,16 @@ async function generateCodeWithTemplate(
|
|
|
45
42
|
try {
|
|
46
43
|
const createSourceParams = [];
|
|
47
44
|
if (allObjSchemas.records.some(objectSchema => objectSchema.addOnDataStructure?.some(addOn => addOn.type === 'rbac'))) {
|
|
48
|
-
const handlerInvComponent = authInvHandler(_izContext, appPath);
|
|
49
|
-
const mainFunctionInvComponent = authInvMain(_izContext, appPath);
|
|
50
|
-
const authApiComponent = authApi(_izContext, appPath);
|
|
51
45
|
const yamlInvComponent = await authYaml(_izContext, appPath);
|
|
52
46
|
const dynamoRbacPermission = dynamo(_izContext, appPath);
|
|
53
|
-
|
|
47
|
+
const handler = authHandler(_izContext, appPath);
|
|
48
|
+
const mainFunction = authMainFunction(_izContext, appPath);
|
|
54
49
|
|
|
55
50
|
createSourceParams.push(
|
|
56
|
-
mainFunctionInvComponent,
|
|
57
|
-
handlerInvComponent,
|
|
58
|
-
authApiComponent,
|
|
59
51
|
...yamlInvComponent,
|
|
60
|
-
...dynamoRbacPermission
|
|
52
|
+
...dynamoRbacPermission,
|
|
53
|
+
handler,
|
|
54
|
+
mainFunction
|
|
61
55
|
);
|
|
62
56
|
|
|
63
57
|
}
|
|
@@ -27,12 +27,14 @@ const __dirname = path.dirname(__filename);
|
|
|
27
27
|
|
|
28
28
|
const {
|
|
29
29
|
SOURCE_PATH,
|
|
30
|
+
HANDLER
|
|
30
31
|
} = consts;
|
|
31
32
|
|
|
32
33
|
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } =
|
|
33
34
|
utils;
|
|
34
35
|
|
|
35
|
-
const templatePathInv = path.join(__dirname, '
|
|
36
|
+
const templatePathInv = path.join(__dirname, 'template.ejs');
|
|
37
|
+
|
|
36
38
|
|
|
37
39
|
/**
|
|
38
40
|
* Generates yaml source params for a given action and handler
|
|
@@ -50,9 +52,7 @@ function data(
|
|
|
50
52
|
appPath,
|
|
51
53
|
) {
|
|
52
54
|
const functionName = "Authorization";
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const fileName = upperCase(functionName);
|
|
55
|
+
const fileName = `${upperCase(functionName)}_${upperCase(HANDLER.hdrInv)}`;
|
|
56
56
|
|
|
57
57
|
return {
|
|
58
58
|
templatePath: templatePathInv,
|
package/src/generateCode/generateSchema/rbac/lambda/{authApi/templateInv.ejs → handler/template.ejs}
RENAMED
|
@@ -37,7 +37,7 @@ export const main = middleware.wrap(async (event, context, callback) => {
|
|
|
37
37
|
try {
|
|
38
38
|
|
|
39
39
|
// invoke LambdaFunction
|
|
40
|
-
return await <%- functionName
|
|
40
|
+
return await <%- functionName %>(
|
|
41
41
|
event._izContext, // correlationId/logger/integrationTestDetail/uniqueRequestId
|
|
42
42
|
event,
|
|
43
43
|
callingFlowSharedLib.addCallingFlowToPassOnProperties(event)
|
|
@@ -0,0 +1,111 @@
|
|
|
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
|
|
16
|
+
<http: //www.gnu.org/licenses />.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { consts } from '@izara_project/izara-core-library-core';
|
|
20
|
+
import dynamoDBSharedLibs from '@izara_project/izara-core-library-dynamodb';
|
|
21
|
+
import { utils } from '@izara_project/izara-core-library-service-schemas';
|
|
22
|
+
import snsSharedLib from '@izara_project/izara-core-library-sns';
|
|
23
|
+
import { sns } from '@izara_project/izara-core-library-external-request';
|
|
24
|
+
import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
|
|
25
|
+
|
|
26
|
+
//(<optionalRequire>)
|
|
27
|
+
//(</optionalRequire>)
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Gets an object by processing storage resources (DynamoDB, Graph)
|
|
31
|
+
* @param {Object} _izContext - Context object with logger
|
|
32
|
+
* @param {Object} requestParams - { objectType, identifiers, additionalParams }
|
|
33
|
+
* @param {Object} callingFlowConfig - Calling flow configuration
|
|
34
|
+
* @returns {Promise<Object>} Collected get result
|
|
35
|
+
*/
|
|
36
|
+
export default async function Authorization(
|
|
37
|
+
_izContext,
|
|
38
|
+
requestParams,
|
|
39
|
+
callingFlowConfig = {}
|
|
40
|
+
) {
|
|
41
|
+
try {
|
|
42
|
+
_izContext.logger.debug('rbacValidator ::: ', {
|
|
43
|
+
requestParams,
|
|
44
|
+
callingFlowConfig
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const identifier = requestParams?.identifier || null;
|
|
48
|
+
let flowTypeConcat = requestParams?.flowTypeConcat || null;
|
|
49
|
+
|
|
50
|
+
if (!identifier || !flowTypeConcat) {
|
|
51
|
+
throw new Error(
|
|
52
|
+
'Missing required request parameters: identifier or flowTagConcat'
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
if (typeof flowTypeConcat === 'object') {
|
|
56
|
+
flowTypeConcat = utils.createFlowTypeConcat(flowTypeConcat)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (typeof flowTypeConcat !== 'string') {
|
|
60
|
+
throw new Error('flowTypeConcat must be a string');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const userId = _izContext.correlationIds.get(consts.BASE_USER_ID);
|
|
64
|
+
_izContext.logger.debug('userId', userId);
|
|
65
|
+
|
|
66
|
+
if (!userId) {
|
|
67
|
+
throw new Error('User ID not found in correlation IDs');
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const targetId = _izContext.correlationIds.get(consts.TARGET_ID);
|
|
71
|
+
_izContext.logger.debug('targetId', targetId);
|
|
72
|
+
|
|
73
|
+
if (!targetId) {
|
|
74
|
+
throw new Error('Target ID not found in correlation IDs');
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const rolePermissionTableName = dynamoDBSharedLibs.tableName(_izContext, "RolePermission");
|
|
78
|
+
|
|
79
|
+
const resultRolePermissions = await dynamoDBSharedLibs.getItem(_izContext, rolePermissionTableName, {
|
|
80
|
+
userId: userId,
|
|
81
|
+
flowTypeWithTargetIdConcat: `${flowTypeConcat}_${targetId}`
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
if (!resultRolePermissions) {
|
|
85
|
+
throw new Error('User roles not found for the given user');
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
if (resultRolePermissions.permission === true) {
|
|
89
|
+
// will check app level permission
|
|
90
|
+
const messageObject = {
|
|
91
|
+
requestParams: {
|
|
92
|
+
identifier: identifier,
|
|
93
|
+
flowTypeConcat: flowTypeConcat,
|
|
94
|
+
},
|
|
95
|
+
callingFlow: callingFlowConfig || {}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
const sendMessageToCheckRbacAppLevel = {
|
|
100
|
+
Message: JSON.stringify(messageObject),
|
|
101
|
+
TopicArn: snsSharedLib.snsTopicArnByFlowSchema(_izContext, "RbacValidator_In", "TestRbac")
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
await sns.publishAsync(_izContext, sendMessageToCheckRbacAppLevel)
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
} catch (err) {
|
|
108
|
+
_izContext.logger.error('error GetMain:', err);
|
|
109
|
+
throw err;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -29,9 +29,8 @@ const {
|
|
|
29
29
|
RESOURCE_CLASSES,
|
|
30
30
|
SOURCE_PATH,
|
|
31
31
|
SAVE_FILE_NAME,
|
|
32
|
-
LAMBDA_RESOURCE,
|
|
33
32
|
DYNAMO_RESOURCE,
|
|
34
|
-
|
|
33
|
+
SNS_RESOURCE
|
|
35
34
|
} = consts;
|
|
36
35
|
|
|
37
36
|
const {
|
|
@@ -46,11 +45,6 @@ const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } =
|
|
|
46
45
|
|
|
47
46
|
const templatePath = path.join(__dirname, 'template.ejs');
|
|
48
47
|
|
|
49
|
-
const HANDLER = {
|
|
50
|
-
hdrInv: "hdrInv",
|
|
51
|
-
hdrApi: "hdrApi"
|
|
52
|
-
}
|
|
53
|
-
|
|
54
48
|
/**
|
|
55
49
|
* Generates yaml source params for a given action and handler
|
|
56
50
|
* @param {Object} _izContext - Context object with logger
|
|
@@ -72,56 +66,40 @@ async function data(
|
|
|
72
66
|
|
|
73
67
|
additionalResourcePermission.push(
|
|
74
68
|
createIamRole({
|
|
75
|
-
[RESOURCE_CLASSES.
|
|
69
|
+
[RESOURCE_CLASSES.sns]: SNS_RESOURCE.publish,
|
|
76
70
|
},
|
|
77
|
-
externalResourceYaml(RESOURCE_CLASSES.
|
|
71
|
+
externalResourceYaml(RESOURCE_CLASSES.sns, "RbacValidator_In", "TestRbac")),
|
|
78
72
|
createIamRole({
|
|
79
73
|
[RESOURCE_CLASSES.dynamoDbTable]: [DYNAMO_RESOURCE.getItem, DYNAMO_RESOURCE.putItem]
|
|
80
74
|
},
|
|
81
75
|
[
|
|
82
|
-
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "
|
|
83
|
-
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "UserRoles"),
|
|
84
|
-
]),
|
|
85
|
-
createIamRole({
|
|
86
|
-
[RESOURCE_CLASSES.s3]: [S3_RESOURCE.getObject]
|
|
87
|
-
},
|
|
88
|
-
[
|
|
89
|
-
resourceNames(RESOURCE_CLASSES.s3, "perServiceSchemas/*/Relationships/*.json"),
|
|
90
|
-
resourceNames(RESOURCE_CLASSES.s3, "perServiceSchemas/*/ObjectSchemaAll/*.json"),
|
|
91
|
-
resourceNames(RESOURCE_CLASSES.s3, "perServiceSchemas/*/FlowSchema/*.json"),
|
|
76
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, "RolePermissions"),
|
|
92
77
|
])
|
|
93
78
|
);
|
|
94
79
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
functionNameConfig
|
|
115
|
-
},
|
|
116
|
-
setting: {
|
|
117
|
-
savePath: path.join(appPath, SOURCE_PATH.appYaml),
|
|
118
|
-
saveFileName: SAVE_FILE_NAME.rbac,
|
|
119
|
-
fileExtension: '.yml',
|
|
120
|
-
isAppend: true
|
|
121
|
-
}
|
|
80
|
+
allCreateSources.push(
|
|
81
|
+
{
|
|
82
|
+
templatePath,
|
|
83
|
+
templateData: {
|
|
84
|
+
functionName: functionName,
|
|
85
|
+
handlerPath: path.join(
|
|
86
|
+
SOURCE_PATH.resourceLocationRbac,
|
|
87
|
+
`${functionName}.main`
|
|
88
|
+
),
|
|
89
|
+
additionalResourcePermission,
|
|
90
|
+
roleName: "Authorization",
|
|
91
|
+
hookTagSetting: `${functionName}FunctionSetting`,
|
|
92
|
+
functionNameConfig: functionName
|
|
93
|
+
},
|
|
94
|
+
setting: {
|
|
95
|
+
savePath: path.join(appPath, SOURCE_PATH.appYaml),
|
|
96
|
+
saveFileName: SAVE_FILE_NAME.rbac,
|
|
97
|
+
fileExtension: '.yml',
|
|
98
|
+
isAppend: true
|
|
122
99
|
}
|
|
123
|
-
|
|
124
|
-
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
|
|
125
103
|
return allCreateSources;
|
|
126
104
|
};
|
|
127
105
|
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (C) 2020 Sven Mason <http://izara.io>
|
|
3
|
-
|
|
4
|
-
This program is free software: you can redistribute it and/or modify
|
|
5
|
-
it under the terms of the GNU Affero General Public License as
|
|
6
|
-
published by the Free Software Foundation, either version 3 of the
|
|
7
|
-
License, or (at your option) any later version.
|
|
8
|
-
|
|
9
|
-
This program is distributed in the hope that it will be useful,
|
|
10
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
GNU Affero General Public License for more details.
|
|
13
|
-
|
|
14
|
-
You should have received a copy of the GNU Affero General Public License
|
|
15
|
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
// yaml data.js
|
|
19
|
-
import path from 'path';
|
|
20
|
-
import { fileURLToPath } from 'url';
|
|
21
|
-
import consts from '#libs/Consts.js';
|
|
22
|
-
import utils from '#libs/Utils.js';
|
|
23
|
-
import libs from '#libs/Libs.js';
|
|
24
|
-
|
|
25
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
26
|
-
const __dirname = path.dirname(__filename);
|
|
27
|
-
|
|
28
|
-
const {
|
|
29
|
-
SOURCE_PATH,
|
|
30
|
-
HANDLER
|
|
31
|
-
} = consts;
|
|
32
|
-
|
|
33
|
-
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } =
|
|
34
|
-
utils;
|
|
35
|
-
|
|
36
|
-
const templatePathInv = path.join(__dirname, 'templateInv.ejs');
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Generates yaml source params for a given action and handler
|
|
41
|
-
* @param {Object} _izContext - Context object with logger
|
|
42
|
-
* @param {Array} allObjSchemas - All object schemas
|
|
43
|
-
* @param {string} appPath - Source path
|
|
44
|
-
* @param {string} action - Action name (create/update/get/delete)
|
|
45
|
-
* @param {string} handler - Handler type (hdrApi/hdrSqs/hdrDsq/hdrInv)
|
|
46
|
-
* @param {string|null} functionNameConfig - Override for yaml key (null = derive from action+handler)
|
|
47
|
-
* @param {string} handlerSuffix - Suffix for fnName across all fields (e.g. 'BeforeLogical')
|
|
48
|
-
* @returns {Promise<Array>} Array containing source param object
|
|
49
|
-
*/
|
|
50
|
-
function data(
|
|
51
|
-
_izContext,
|
|
52
|
-
appPath,
|
|
53
|
-
) {
|
|
54
|
-
const functionName = "Authorization";
|
|
55
|
-
const handler = HANDLER.hdrInv;
|
|
56
|
-
const fileName = upperCase(functionName) + '_' + upperCase(handler);
|
|
57
|
-
|
|
58
|
-
return {
|
|
59
|
-
templatePath: templatePathInv,
|
|
60
|
-
templateData: { functionName },
|
|
61
|
-
setting: {
|
|
62
|
-
savePath: path.join(appPath, SOURCE_PATH.rbac),
|
|
63
|
-
saveFileName: fileName,
|
|
64
|
-
fileExtension: '.js',
|
|
65
|
-
isAppend: true
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export default data;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (C) 2020 Sven Mason <http://izara.io>
|
|
3
|
-
|
|
4
|
-
This program is free software: you can redistribute it and/or modify
|
|
5
|
-
it under the terms of the GNU Affero General Public License as
|
|
6
|
-
published by the Free Software Foundation, either version 3 of the
|
|
7
|
-
License, or (at your option) any later version.
|
|
8
|
-
|
|
9
|
-
This program is distributed in the hope that it will be useful,
|
|
10
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
GNU Affero General Public License for more details.
|
|
13
|
-
|
|
14
|
-
You should have received a copy of the GNU Affero General Public License
|
|
15
|
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
import { middlewareHandler as middleware } from "@izara_project/izara-middleware";
|
|
21
|
-
import Logger from '@izara_project/izara-core-library-logger';
|
|
22
|
-
import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
|
|
23
|
-
|
|
24
|
-
import <%- functionName %> from './<%- functionName %>_Main.js';
|
|
25
|
-
|
|
26
|
-
// validate event params in middleware before into function.
|
|
27
|
-
const validatorSchema = {
|
|
28
|
-
//(<validatorSchema>)
|
|
29
|
-
//(</validatorSchema>)
|
|
30
|
-
};
|
|
31
|
-
middleware.setValidatorSchema(validatorSchema)
|
|
32
|
-
|
|
33
|
-
export const main = middleware.wrap(async (event, context, callback) => {
|
|
34
|
-
event._izContext.logger.debug('Event:', event);
|
|
35
|
-
event._izContext.logger.debug('context:', context);
|
|
36
|
-
|
|
37
|
-
try {
|
|
38
|
-
|
|
39
|
-
// invoke LambdaFunction
|
|
40
|
-
return await <%- functionName %>.<%- functionName %>(
|
|
41
|
-
event._izContext, // correlationId/logger/integrationTestDetail/uniqueRequestId
|
|
42
|
-
event,
|
|
43
|
-
callingFlowSharedLib.addCallingFlowToPassOnProperties(event)
|
|
44
|
-
//(<additionalParams>)
|
|
45
|
-
//(</additionalParams>)
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
} catch (err) {
|
|
49
|
-
event._izContext.logger.error('Error, LambdaFunctionHdrInv: ', err);
|
|
50
|
-
throw (err);
|
|
51
|
-
}
|
|
52
|
-
});
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (C) 2020 Sven Mason <http: //izara.io>
|
|
3
|
-
|
|
4
|
-
This program is free software: you can redistribute it and/or modify
|
|
5
|
-
it under the terms of the GNU Affero General Public License as
|
|
6
|
-
published by the Free Software Foundation, either version 3 of the
|
|
7
|
-
License, or (at your option) any later version.
|
|
8
|
-
|
|
9
|
-
This program is distributed in the hope that it will be useful,
|
|
10
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
GNU Affero General Public License for more details.
|
|
13
|
-
|
|
14
|
-
You should have received a copy of the GNU Affero General Public License
|
|
15
|
-
along with this program. If not, see
|
|
16
|
-
<http: //www.gnu.org/licenses />.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
//(<optionalRequire>)
|
|
21
|
-
//(</optionalRequire>)
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Gets an object by processing storage resources (DynamoDB, Graph)
|
|
25
|
-
* @param {Object} _izContext - Context object with logger
|
|
26
|
-
* @param {Object} requestParams - { objectType, identifiers, additionalParams }
|
|
27
|
-
* @param {Object} callingFlowConfig - Calling flow configuration
|
|
28
|
-
* @returns {Promise<Object>} Collected get result
|
|
29
|
-
*/
|
|
30
|
-
export default async function <%- functionName %>(
|
|
31
|
-
_izContext,
|
|
32
|
-
requestParams,
|
|
33
|
-
callingFlowConfig = {}
|
|
34
|
-
|
|
35
|
-
) {
|
|
36
|
-
try {
|
|
37
|
-
|
|
38
|
-
} catch (err) {
|
|
39
|
-
_izContext.logger.error('error GetMain:', err);
|
|
40
|
-
throw err;
|
|
41
|
-
}
|
|
42
|
-
}
|
/package/src/generateCode/generateSchema/rbac/lambda/{authInv/mainFunction → mainFunction}/data.js
RENAMED
|
File without changes
|