@izara_project/izara-market-library-service-schemas 1.0.52 → 1.0.53
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 +5 -5
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +3 -3
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +3 -0
- package/src/reStructure/TemplateData/EndpointPerService/yaml/template.ejs +6 -4
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/handler/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +31 -14
- package/src/reStructure/TemplateData/flowSchema/lambdaSync/Api/functionYaml/data.js +79 -0
- package/src/reStructure/TemplateData/flowSchema/lambdaSync/{handler → Api/handler}/data.js +6 -32
- package/src/reStructure/TemplateData/flowSchema/lambdaSync/{handler/templateApi.ejs → Api/handler/template.ejs} +2 -2
- package/src/reStructure/TemplateData/flowSchema/lambdaSync/{mainFunction → Api/mainFunction}/data.js +9 -26
- package/src/reStructure/TemplateData/flowSchema/lambdaSync/{mainFunction → Api/mainFunction}/template.ejs +0 -15
- package/src/reStructure/TemplateData/flowSchema/lambdaSync/Inv/functionYaml/data.js +78 -0
- package/src/reStructure/TemplateData/flowSchema/lambdaSync/Inv/handler/data.js +58 -0
- package/src/reStructure/TemplateData/flowSchema/lambdaSync/{handler/templateInv.ejs → Inv/handler/template.ejs} +2 -2
- package/src/reStructure/TemplateData/flowSchema/lambdaSync/Inv/mainFunction/data.js +58 -0
- package/src/reStructure/TemplateData/flowSchema/lambdaSync/Inv/mainFunction/template.ejs +81 -0
- package/src/reStructure/TemplateData/flowSchema/webSocketComplete/functionYaml/data.js +16 -7
- package/src/reStructure/TemplateData/propertyValueSchema/relationshipPropertyValueSchema/data.js +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/mainFunction/template.ejs +9 -10
- package/src/reStructure/TemplateData/flowSchema/lambdaSync/functionYaml/data.js +0 -128
- /package/src/reStructure/TemplateData/flowSchema/lambdaSync/{functionYaml/templateApi.ejs → Api/functionYaml/template.ejs} +0 -0
- /package/src/reStructure/TemplateData/flowSchema/lambdaSync/{functionYaml/templateInv.ejs → Inv/functionYaml/template.ejs} +0 -0
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.53",
|
|
4
4
|
"description": "Schemas for Izara Market project",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -14,21 +14,21 @@
|
|
|
14
14
|
"license": "AGPL-3.0-or-later",
|
|
15
15
|
"homepage": "https://bitbucket.org/izara-market-libraries/izara-market-library-service-schemas/src/master/README.md",
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"jest": "^30.0.
|
|
17
|
+
"jest": "^30.0.5"
|
|
18
18
|
},
|
|
19
19
|
"jest": {
|
|
20
20
|
"testEnvironment": "node"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@izara_project/izara-core-library-calling-flow": "^1.0.3",
|
|
24
|
-
"@izara_project/izara-core-library-core": "^1.0.
|
|
24
|
+
"@izara_project/izara-core-library-core": "^1.0.20",
|
|
25
25
|
"@izara_project/izara-core-library-external-request": "^1.0.20",
|
|
26
26
|
"@izara_project/izara-core-library-logger": "^1.0.7",
|
|
27
|
-
"@izara_project/izara-core-library-service-schemas": "^1.0.
|
|
27
|
+
"@izara_project/izara-core-library-service-schemas": "^1.0.83",
|
|
28
28
|
"@izara_project/izara-core-library-sns": "^1.0.6",
|
|
29
29
|
"@izara_project/izara-core-library-sqs": "^1.0.4",
|
|
30
30
|
"@izara_project/izara-shared": "^1.0.126",
|
|
31
|
-
"@izara_project/izara-shared-service-schemas": "^1.0.
|
|
31
|
+
"@izara_project/izara-shared-service-schemas": "^1.0.26",
|
|
32
32
|
"@izara_project/izara-shared-core": "^1.0.2",
|
|
33
33
|
"ejs": "^3.1.10",
|
|
34
34
|
"js-beautify": "^1.15.4",
|
|
@@ -29,7 +29,7 @@ const {
|
|
|
29
29
|
const consts = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
30
30
|
|
|
31
31
|
const {
|
|
32
|
-
|
|
32
|
+
objInstanceFromObjInstanceBase
|
|
33
33
|
} = require('@izara_project/izara-core-library-service-schemas/src/IdentifiersObject');
|
|
34
34
|
|
|
35
35
|
const {
|
|
@@ -155,7 +155,7 @@ module.exports.getMain = async (
|
|
|
155
155
|
|
|
156
156
|
let messageObject = {
|
|
157
157
|
objType: objType,
|
|
158
|
-
objInstanceFull: dataFromGraph.objInstanceFull
|
|
158
|
+
objInstanceFull: dataFromGraph.queryResults.refactoredNodes.objInstanceFull
|
|
159
159
|
}
|
|
160
160
|
// send message to SNS ProcessFindRequiredData
|
|
161
161
|
_izContext.logger.debug("HAVE CallingFlow");
|
|
@@ -199,7 +199,7 @@ module.exports.getMain = async (
|
|
|
199
199
|
|
|
200
200
|
|
|
201
201
|
if (dataFromDynamoDb) {
|
|
202
|
-
dataFromDynamoDb = await
|
|
202
|
+
dataFromDynamoDb = await objInstanceFromObjInstanceBase(
|
|
203
203
|
_izContext,
|
|
204
204
|
objType,
|
|
205
205
|
dataFromDynamoDb
|
|
@@ -283,6 +283,9 @@ module.exports.updateMain = async (
|
|
|
283
283
|
_izContext.logger.debug("identifiersForUpdateData", identifiersForUpdateData)
|
|
284
284
|
_izContext.logger.debug("fieldForUpdateTableDynamo", fieldForUpdateTableDynamo)
|
|
285
285
|
|
|
286
|
+
//(<beforeUpdateDynamoDb>)
|
|
287
|
+
//(</beforeUpdateDynamoDb>)
|
|
288
|
+
|
|
286
289
|
let updateItem = await dynamodbSharedLib.updateItem(
|
|
287
290
|
_izContext,
|
|
288
291
|
await dynamodbSharedLib.tableName(_izContext, updateDataDetail.tableName),
|
|
@@ -12,15 +12,17 @@
|
|
|
12
12
|
- http:
|
|
13
13
|
path: <%- firstLetterUpperCase(resourceApi.event) %>/<%- action %>
|
|
14
14
|
method: <%- resourceApi.method %>
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
authorizer:
|
|
16
|
+
arn: arn:aws:lambda:${self:custom.iz_region}:${self:custom.iz_accountId}:function:UserAccountTestAuthorizerServiceSchema
|
|
17
|
+
resultTtlInSecond: 300
|
|
17
18
|
#<#<%- firstLetterUpperCase(resourceApi.event) _%><%- firstLetterUpperCase(handlerType) %>AppLevelAuthorizer#>
|
|
18
19
|
#<#/<%- firstLetterUpperCase(resourceApi.event) _%><%- firstLetterUpperCase(handlerType) %>AppLevelAuthorizer#>
|
|
19
20
|
- http:
|
|
20
21
|
path: <%- firstLetterUpperCase(resourceApi.event) %>/<%- action %>/{targetUserId}
|
|
21
22
|
method: <%- resourceApi.method %>
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
authorizer:
|
|
24
|
+
arn: arn:aws:lambda:${self:custom.iz_region}:${self:custom.iz_accountId}:function:UserAccountTestAuthorizerServiceSchema
|
|
25
|
+
resultTtlInSecond: 300
|
|
24
26
|
#<#<%- firstLetterUpperCase(resourceApi.event) _%><%- firstLetterUpperCase(handlerType) %>UserLevelAuthorizer#>
|
|
25
27
|
#<#/<%- firstLetterUpperCase(resourceApi.event) _%><%- firstLetterUpperCase(handlerType) %>UserLevelAuthorizer#>
|
|
26
28
|
<%_ }) _%>
|
|
@@ -47,7 +47,7 @@ function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
|
47
47
|
route
|
|
48
48
|
},
|
|
49
49
|
setting: {
|
|
50
|
-
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, "source/"),
|
|
50
|
+
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, upperCase(flowSchema.flowTag), "source/"),
|
|
51
51
|
saveFileName: `${functionName}_${handlerType}`,
|
|
52
52
|
fileExtension: ".js",
|
|
53
53
|
isAppend: false
|
|
@@ -60,7 +60,7 @@ function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
|
60
60
|
functionName
|
|
61
61
|
},
|
|
62
62
|
setting: {
|
|
63
|
-
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, "source/"),
|
|
63
|
+
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, upperCase(flowSchema.flowTag), "source/"),
|
|
64
64
|
saveFileName: `${functionName}_Main`,
|
|
65
65
|
fileExtension: ".js",
|
|
66
66
|
isAppend: false
|
|
@@ -69,7 +69,6 @@ const createConfirmAfterUploadS3FunctionYaml = require('./components/upload/conf
|
|
|
69
69
|
const createConfirmAfterUploadS3Handler = require('./components/upload/confirmReserved/handler/data');
|
|
70
70
|
const createConfirmAfterUploadS3MainFunction = require('./components/upload/confirmReserved/mainFunction/data');
|
|
71
71
|
const createConfirmAfterUploadS3Queue = require('./components/upload/confirmReserved/queue/data');
|
|
72
|
-
|
|
73
72
|
// flowSchema ExternalTopic components //
|
|
74
73
|
const createExternalSqsFunctionYaml = require('./externalTopic/Process/functionYaml/data');
|
|
75
74
|
const createExternalSqsHandler = require('./externalTopic/Process/handler/data');
|
|
@@ -114,9 +113,13 @@ const createFlowSchemaEventBridgeHandler = require('./eventBridge/handler/inv/da
|
|
|
114
113
|
const createFlowSchemaEventBridgeMainFunction = require('./eventBridge/mainFunction/data');
|
|
115
114
|
|
|
116
115
|
// flowSchema lambdaSync components
|
|
117
|
-
const
|
|
118
|
-
const
|
|
119
|
-
const
|
|
116
|
+
const createFlowSchemaLambdaSyncFunctionYamlInv = require('./lambdaSync/Inv/functionYaml/data');
|
|
117
|
+
const createFlowSchemaLambdaSyncHandlerInv = require('./lambdaSync/Inv/handler/data');
|
|
118
|
+
const createFlowSchemaLambdaSyncMainFunctionInv = require('./lambdaSync/Inv/mainFunction/data');
|
|
119
|
+
|
|
120
|
+
const createFlowSchemaLambdaSyncFunctionYamlApi = require("./lambdaSync/Api/functionYaml/data");
|
|
121
|
+
const createFlowSchemaLambdaSyncHandlerApi = require("./lambdaSync/Api/handler/data");
|
|
122
|
+
const createFlowSchemaLambdaSyncMainFunctionApi = require("./lambdaSync/Api/mainFunction/data")
|
|
120
123
|
|
|
121
124
|
const createAwaitingMultipleStepDynamoDbData = require('./dynamoDb/data');
|
|
122
125
|
// create record status Field Complete
|
|
@@ -344,20 +347,34 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
344
347
|
// console.log("event eventBridge generated", JSON.stringify(eventBridgeResources, null, 2))
|
|
345
348
|
console.log("event eventBridge generated")
|
|
346
349
|
createSourceParams.push(...eventBridgeResources);
|
|
347
|
-
} else if (event.includes("
|
|
348
|
-
const
|
|
349
|
-
const
|
|
350
|
-
const
|
|
350
|
+
} else if (event.includes("lambdaSyncInv")) {
|
|
351
|
+
const flowSchemaLambdaSyncFunctionYamlInv = createFlowSchemaLambdaSyncFunctionYamlInv(_izContext, flowSchema, saveFilePath);
|
|
352
|
+
const flowSchemaLambdaSyncHandlerInv = createFlowSchemaLambdaSyncHandlerInv(_izContext, flowSchema, saveFilePath);
|
|
353
|
+
const flowSchemaLambdaSyncMainFunctionInv = createFlowSchemaLambdaSyncMainFunctionInv(_izContext, flowSchema, saveFilePath);
|
|
354
|
+
|
|
351
355
|
|
|
352
356
|
// Group the resources
|
|
353
|
-
const
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
+
const lambdaSyncInvResources = [
|
|
358
|
+
flowSchemaLambdaSyncFunctionYamlInv,
|
|
359
|
+
flowSchemaLambdaSyncHandlerInv,
|
|
360
|
+
flowSchemaLambdaSyncMainFunctionInv,
|
|
357
361
|
];
|
|
358
362
|
|
|
359
|
-
console.log("event
|
|
360
|
-
createSourceParams.push(...
|
|
363
|
+
console.log("event lambdaSyncInv generated")
|
|
364
|
+
createSourceParams.push(...lambdaSyncInvResources);
|
|
365
|
+
|
|
366
|
+
} else if (event.includes("lambdaSyncApi")) {
|
|
367
|
+
const flowSchemaLambdaSyncFunctionYamlApi = createFlowSchemaLambdaSyncFunctionYamlApi(_izContext, flowSchema, saveFilePath);
|
|
368
|
+
const flowSchemaLambdaSyncHandlerApi = createFlowSchemaLambdaSyncHandlerApi(_izContext, flowSchema, saveFilePath);
|
|
369
|
+
const flowSchemaLambdaSyncMainFunctionApi = createFlowSchemaLambdaSyncMainFunctionApi(_izContext, flowSchema, saveFilePath);
|
|
370
|
+
|
|
371
|
+
const lambdaSyncApiResources = [
|
|
372
|
+
flowSchemaLambdaSyncFunctionYamlApi,
|
|
373
|
+
flowSchemaLambdaSyncHandlerApi,
|
|
374
|
+
flowSchemaLambdaSyncMainFunctionApi
|
|
375
|
+
];
|
|
376
|
+
createSourceParams.push(...lambdaSyncApiResources)
|
|
377
|
+
console.log("event lambdaSyncApi generated")
|
|
361
378
|
}
|
|
362
379
|
}
|
|
363
380
|
|
|
@@ -0,0 +1,79 @@
|
|
|
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 path = require('path');
|
|
20
|
+
|
|
21
|
+
const { FLOW_SCHEMA_HOOK_STATE, ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
22
|
+
const { firstLetterUpperCase: upperCase } = require('../../../../../../MainLibs/src/Utils')
|
|
23
|
+
const {
|
|
24
|
+
SOURCE_PATH,
|
|
25
|
+
defaultIamRolePerAction,
|
|
26
|
+
createIamRole,
|
|
27
|
+
RESOURCE_CLASSES,
|
|
28
|
+
SNS_RESOURCE,
|
|
29
|
+
resourceNames,
|
|
30
|
+
DYNAMO_RESOURCE,
|
|
31
|
+
SAVE_FILE_NAME,
|
|
32
|
+
FUNCTION_NAME,
|
|
33
|
+
shortNameHandler,
|
|
34
|
+
externalResourceYaml,
|
|
35
|
+
SOURCE_GENERATE_IAM_ROLE,
|
|
36
|
+
SQS_RESOURCE,
|
|
37
|
+
LAMBDA_RESOURCE
|
|
38
|
+
} = require('../../../../../../MainLibs/src/Consts');
|
|
39
|
+
const { NoRetryError } = require('@izara_project/izara-core-library-core');
|
|
40
|
+
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas').getObjectSchema;
|
|
41
|
+
|
|
42
|
+
const templatePath = path.join(__dirname, "./template.ejs");
|
|
43
|
+
/**
|
|
44
|
+
* receive objectSchema
|
|
45
|
+
*
|
|
46
|
+
* @param {Object} objectSchema
|
|
47
|
+
* @return {{templatePath, templateData,setting}}
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
function data(_izContext, flowSchema, srcPath) {
|
|
51
|
+
return createSourceParamsApi(_izContext, flowSchema, srcPath)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function createSourceParamsApi(_izContext, flowSchema, srcPath) {
|
|
55
|
+
let functionName = upperCase(flowSchema.flowTag)
|
|
56
|
+
let handlerType = upperCase(HANDLER.hdrApi)
|
|
57
|
+
let additionalResourcePermission = defaultIamRolePerAction();
|
|
58
|
+
|
|
59
|
+
return {
|
|
60
|
+
templatePath: templatePath,
|
|
61
|
+
templateData: {
|
|
62
|
+
resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema, upperCase(flowSchema.flowTag), "source/"),
|
|
63
|
+
functionName,
|
|
64
|
+
handlerType,
|
|
65
|
+
additionalResourcePermission,
|
|
66
|
+
functionNameConfig: upperCase(functionName) + upperCase(shortNameHandler(handlerType)),
|
|
67
|
+
roleName: upperCase(flowSchema.flowTag),
|
|
68
|
+
event: "post"
|
|
69
|
+
},
|
|
70
|
+
setting: {
|
|
71
|
+
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
72
|
+
saveFileName: upperCase(SAVE_FILE_NAME.flowSchema),
|
|
73
|
+
fileExtension: ".yml",
|
|
74
|
+
isAppend: true
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
module.exports = data;
|
|
@@ -19,11 +19,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
19
19
|
const path = require('path');
|
|
20
20
|
|
|
21
21
|
const { FLOW_SCHEMA_HOOK_STATE, ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
22
|
-
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("
|
|
23
|
-
const { SOURCE_PATH } = require('
|
|
22
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils")
|
|
23
|
+
const { SOURCE_PATH } = require('../../../../../../MainLibs/src/Consts');
|
|
24
24
|
|
|
25
|
-
const
|
|
26
|
-
const templatePathApi = path.join(__dirname, "./templateApi.ejs");
|
|
25
|
+
const templatePath = path.join(__dirname, "./template.ejs");
|
|
27
26
|
/**
|
|
28
27
|
* receive objectSchema
|
|
29
28
|
* create data for WebScoket handler template
|
|
@@ -33,40 +32,15 @@ const templatePathApi = path.join(__dirname, "./templateApi.ejs");
|
|
|
33
32
|
*/
|
|
34
33
|
|
|
35
34
|
function data(_izContext, flowSchema, srcPath) {
|
|
36
|
-
|
|
37
|
-
returnCreateSource.push(createSourceParamsInvoke(_izContext, flowSchema, srcPath))
|
|
38
|
-
if (flowSchema.externalEndpoint) {
|
|
39
|
-
returnCreateSource.push(createSourceParamsApi(_izContext, flowSchema, srcPath))
|
|
40
|
-
}
|
|
41
|
-
return returnCreateSource
|
|
35
|
+
return createSourceParamsApi(_izContext, flowSchema, srcPath)
|
|
42
36
|
}
|
|
43
37
|
|
|
44
|
-
function createSourceParamsInvoke(_izContext, flowSchema, srcPath) {
|
|
45
|
-
let functionName = upperCase(flowSchema.flowTag)
|
|
46
|
-
let handlerType = upperCase(HANDLER.hdrInv)
|
|
47
|
-
|
|
48
|
-
return {
|
|
49
|
-
templatePath: templatePathInvoke,
|
|
50
|
-
templateData: {
|
|
51
|
-
functionName,
|
|
52
|
-
handlerType,
|
|
53
|
-
},
|
|
54
|
-
setting: {
|
|
55
|
-
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, "source/"),
|
|
56
|
-
saveFileName: `${functionName}_${handlerType}`,
|
|
57
|
-
fileExtension: ".js",
|
|
58
|
-
isAppend: false
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
38
|
function createSourceParamsApi(_izContext, flowSchema, srcPath) {
|
|
65
39
|
let functionName = upperCase(flowSchema.flowTag)
|
|
66
40
|
let handlerType = upperCase(HANDLER.hdrApi)
|
|
67
41
|
|
|
68
42
|
return {
|
|
69
|
-
templatePath:
|
|
43
|
+
templatePath: templatePath,
|
|
70
44
|
templateData: {
|
|
71
45
|
functionName,
|
|
72
46
|
handlerType,
|
|
@@ -74,7 +48,7 @@ function createSourceParamsApi(_izContext, flowSchema, srcPath) {
|
|
|
74
48
|
// properties
|
|
75
49
|
},
|
|
76
50
|
setting: {
|
|
77
|
-
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, "source/"),
|
|
51
|
+
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, upperCase(flowSchema.flowTag), "source/"),
|
|
78
52
|
saveFileName: `${functionName}_${handlerType}`,
|
|
79
53
|
fileExtension: ".js",
|
|
80
54
|
isAppend: false
|
|
@@ -21,7 +21,7 @@ const RBAC_TARGET_ID = process.env.iz_rbacTargetIdUser // iz_rbacTargetIdUser |
|
|
|
21
21
|
|
|
22
22
|
const izara = require("@izara_project/izara-middleware");
|
|
23
23
|
const middleware = izara.middlewareHandler;
|
|
24
|
-
const
|
|
24
|
+
const <%- functionName %> = require('./<%- functionName %>_Main')
|
|
25
25
|
|
|
26
26
|
// validate event params in middlewware before into function.
|
|
27
27
|
let validatorSchema = {};
|
|
@@ -58,7 +58,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
58
58
|
targetUserId = event.pathParameters[process.env.iz_rbacTargetIdUser]
|
|
59
59
|
}
|
|
60
60
|
// invoke LambdaFunction
|
|
61
|
-
let lambdaFunctionResponse = await
|
|
61
|
+
let lambdaFunctionResponse = await <%- functionName %>.<%- functionName %>Main(
|
|
62
62
|
event._izContext, // correlationId/logger/integrationTestDetail/uniqueRequestId/userId
|
|
63
63
|
event.body,
|
|
64
64
|
event._izContext.userId, // send userId last element
|
package/src/reStructure/TemplateData/flowSchema/lambdaSync/{mainFunction → Api/mainFunction}/data.js
RENAMED
|
@@ -18,13 +18,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
18
18
|
'use strict';
|
|
19
19
|
const path = require('path');
|
|
20
20
|
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas').getObjectSchema
|
|
21
|
-
const { SOURCE_PATH, FUNCTION_NAME, HANDLER } = require('
|
|
21
|
+
const { SOURCE_PATH, FUNCTION_NAME, HANDLER } = require('../../../../../../MainLibs/src/Consts');
|
|
22
22
|
const { STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
23
|
-
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("
|
|
23
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils")
|
|
24
24
|
const templatePath = path.join(__dirname, "./template.ejs");
|
|
25
|
-
const statusFieldTemplate = path.join(__dirname, "
|
|
26
|
-
const storedCacheTemplate = path.join(__dirname, "
|
|
27
|
-
const triggerCacheTemplate = path.join(__dirname, "
|
|
25
|
+
const statusFieldTemplate = path.join(__dirname, "../../../templateBystatusType/statusFieldTemplate.ejs")
|
|
26
|
+
const storedCacheTemplate = path.join(__dirname, "../../../templateBystatusType/storedCacheTemplate.ejs")
|
|
27
|
+
const triggerCacheTemplate = path.join(__dirname, "../../../templateBystatusType/triggerCacheTemplate.ejs");
|
|
28
28
|
/**
|
|
29
29
|
* receive objectSchema
|
|
30
30
|
* create data for WebScoket handler template
|
|
@@ -34,37 +34,20 @@ const triggerCacheTemplate = path.join(__dirname, "../../templateBystatusType/tr
|
|
|
34
34
|
*/
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
return
|
|
37
|
+
function data(_izContext, flowSchema, srcPath) {
|
|
38
|
+
return createParamsForCreateSource(_izContext, flowSchema, srcPath)
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
42
42
|
let functionName = upperCase(flowSchema.flowTag);
|
|
43
|
-
let statusType = flowSchema.statusType;
|
|
44
|
-
let triggerType = flowSchema.triggerType;
|
|
45
|
-
let tableName = null;
|
|
46
|
-
if (flowSchema.statusType === "storedCache") {
|
|
47
|
-
let objectSchema = await getObjectSchema.getLocalObjectSchemas(_izContext, [flowSchema.objType.objectType], path.join(srcPath, "./schemas")).then(res => res.records[0]);
|
|
48
|
-
for (const storageResource of Object.values(objectSchema.storageResources)) {
|
|
49
|
-
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
50
|
-
tableName = storageResource.tableName
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
43
|
return {
|
|
55
44
|
templatePath: templatePath,
|
|
56
45
|
templateData: {
|
|
57
46
|
flowTag: flowSchema.flowTag,
|
|
58
47
|
functionName,
|
|
59
|
-
statusFieldTemplate,
|
|
60
|
-
storedCacheTemplate,
|
|
61
|
-
triggerCacheTemplate,
|
|
62
|
-
statusType,
|
|
63
|
-
tableName,
|
|
64
|
-
triggerType
|
|
65
48
|
},
|
|
66
49
|
setting: {
|
|
67
|
-
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, "source/"),
|
|
50
|
+
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, upperCase(flowSchema.flowTag), "source/"),
|
|
68
51
|
saveFileName: `${functionName}_Main`,
|
|
69
52
|
fileExtension: ".js",
|
|
70
53
|
isAppend: false
|
|
@@ -71,21 +71,6 @@ module.exports.<%- functionName %>Main = async (
|
|
|
71
71
|
_izContext.logger.debug("<%- functionName %>Main requestParams", requestParams)
|
|
72
72
|
_izContext.logger.debug("<%- functionName %>Main callingFlowConfig", callingFlowConfig)
|
|
73
73
|
|
|
74
|
-
//(<beforeCheckStatus>)
|
|
75
|
-
//(</beforeCheckStatus>)
|
|
76
|
-
|
|
77
|
-
<% if (statusType === "statusField") { %>
|
|
78
|
-
<%- include(statusFieldTemplate) %>
|
|
79
|
-
<% } else if (statusType === "storedCache") { %>
|
|
80
|
-
<%- include(storedCacheTemplate, {tableName:tableName}) %>
|
|
81
|
-
|
|
82
|
-
<% } else if (statusType === "triggerCache") { %>
|
|
83
|
-
<%- include(triggerCacheTemplate, {
|
|
84
|
-
tableName: tableName,
|
|
85
|
-
triggerType: triggerType
|
|
86
|
-
}) %>
|
|
87
|
-
<% } %>
|
|
88
|
-
|
|
89
74
|
//(<endpointHook>)
|
|
90
75
|
//(</endpointHook>)
|
|
91
76
|
|
|
@@ -0,0 +1,78 @@
|
|
|
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 path = require('path');
|
|
20
|
+
|
|
21
|
+
const { FLOW_SCHEMA_HOOK_STATE, ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
22
|
+
const { firstLetterUpperCase: upperCase } = require('../../../../../../MainLibs/src/Utils')
|
|
23
|
+
const {
|
|
24
|
+
SOURCE_PATH,
|
|
25
|
+
defaultIamRolePerAction,
|
|
26
|
+
createIamRole,
|
|
27
|
+
RESOURCE_CLASSES,
|
|
28
|
+
SNS_RESOURCE,
|
|
29
|
+
resourceNames,
|
|
30
|
+
DYNAMO_RESOURCE,
|
|
31
|
+
SAVE_FILE_NAME,
|
|
32
|
+
FUNCTION_NAME,
|
|
33
|
+
shortNameHandler,
|
|
34
|
+
externalResourceYaml,
|
|
35
|
+
SOURCE_GENERATE_IAM_ROLE,
|
|
36
|
+
SQS_RESOURCE,
|
|
37
|
+
LAMBDA_RESOURCE
|
|
38
|
+
} = require('../../../../../../MainLibs/src/Consts');
|
|
39
|
+
const { NoRetryError } = require('@izara_project/izara-core-library-core');
|
|
40
|
+
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas').getObjectSchema;
|
|
41
|
+
|
|
42
|
+
const templatePath = path.join(__dirname, "./template.ejs");
|
|
43
|
+
/**
|
|
44
|
+
* receive objectSchema
|
|
45
|
+
* create data for WebScoket handler template
|
|
46
|
+
*
|
|
47
|
+
* @param {Object} objectSchema
|
|
48
|
+
* @return {{templatePath, templateData,setting}}
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
function data(_izContext, flowSchema, srcPath) {
|
|
52
|
+
return createSourceParamsInvoke(_izContext, flowSchema, srcPath)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function createSourceParamsInvoke(_izContext, flowSchema, srcPath) {
|
|
56
|
+
let functionName = upperCase(flowSchema.flowTag)
|
|
57
|
+
let handlerType = upperCase(HANDLER.hdrInv)
|
|
58
|
+
let additionalResourcePermission = defaultIamRolePerAction();
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
templatePath: templatePath,
|
|
62
|
+
templateData: {
|
|
63
|
+
resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema, upperCase(flowSchema.flowTag), "source/"),
|
|
64
|
+
functionName,
|
|
65
|
+
handlerType,
|
|
66
|
+
additionalResourcePermission,
|
|
67
|
+
functionNameConfig: upperCase(functionName) + upperCase(shortNameHandler(handlerType)),
|
|
68
|
+
roleName: upperCase(flowSchema.flowTag)
|
|
69
|
+
},
|
|
70
|
+
setting: {
|
|
71
|
+
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
72
|
+
saveFileName: upperCase(SAVE_FILE_NAME.flowSchema),
|
|
73
|
+
fileExtension: ".yml",
|
|
74
|
+
isAppend: true
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
module.exports = data;
|
|
@@ -0,0 +1,58 @@
|
|
|
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 path = require('path');
|
|
20
|
+
|
|
21
|
+
const { FLOW_SCHEMA_HOOK_STATE, ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
22
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils")
|
|
23
|
+
const { SOURCE_PATH } = require('../../../../../../MainLibs/src/Consts');
|
|
24
|
+
|
|
25
|
+
const templatePath = path.join(__dirname, "./template.ejs");
|
|
26
|
+
/**
|
|
27
|
+
* receive objectSchema
|
|
28
|
+
* create data for WebScoket handler template
|
|
29
|
+
*
|
|
30
|
+
* @param {Object} objectSchema
|
|
31
|
+
* @return {{templatePath, templateData,setting}}
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
function data(_izContext, flowSchema, srcPath) {
|
|
35
|
+
return createSourceParamsInvoke(_izContext, flowSchema, srcPath)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function createSourceParamsInvoke(_izContext, flowSchema, srcPath) {
|
|
39
|
+
let functionName = upperCase(flowSchema.flowTag)
|
|
40
|
+
let handlerType = upperCase(HANDLER.hdrInv)
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
templatePath: templatePath,
|
|
44
|
+
templateData: {
|
|
45
|
+
functionName,
|
|
46
|
+
handlerType,
|
|
47
|
+
},
|
|
48
|
+
setting: {
|
|
49
|
+
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, upperCase(flowSchema.flowTag), "source/"),
|
|
50
|
+
saveFileName: `${functionName}_${handlerType}`,
|
|
51
|
+
fileExtension: ".js",
|
|
52
|
+
isAppend: false
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
module.exports = data;
|
|
@@ -24,7 +24,7 @@ const middleware = require("@izara_project/izara-middleware").middlewareHandler;
|
|
|
24
24
|
|
|
25
25
|
const <%- functionName %> = require('./<%- functionName %>_Main')
|
|
26
26
|
|
|
27
|
-
// validate event params in
|
|
27
|
+
// validate event params in middleware before into function.
|
|
28
28
|
const validatorSchema = {};
|
|
29
29
|
middleware.setValidatorSchema(validatorSchema)
|
|
30
30
|
|
|
@@ -35,7 +35,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
35
35
|
try {
|
|
36
36
|
|
|
37
37
|
// invoke LambdaFunction
|
|
38
|
-
return await
|
|
38
|
+
return await <%- functionName %>.<%- functionName %>Main(
|
|
39
39
|
event._izContext, // correlationId/logger/integrationTestDetail/uniqueRequestId
|
|
40
40
|
event
|
|
41
41
|
);
|
|
@@ -0,0 +1,58 @@
|
|
|
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 path = require('path');
|
|
20
|
+
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas').getObjectSchema
|
|
21
|
+
const { SOURCE_PATH, FUNCTION_NAME, HANDLER } = require('../../../../../../MainLibs/src/Consts');
|
|
22
|
+
const { STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
23
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils")
|
|
24
|
+
const templatePath = path.join(__dirname, "./template.ejs");
|
|
25
|
+
const statusFieldTemplate = path.join(__dirname, "../../../templateBystatusType/statusFieldTemplate.ejs")
|
|
26
|
+
const storedCacheTemplate = path.join(__dirname, "../../../templateBystatusType/storedCacheTemplate.ejs")
|
|
27
|
+
const triggerCacheTemplate = path.join(__dirname, "../../../templateBystatusType/triggerCacheTemplate.ejs");
|
|
28
|
+
/**
|
|
29
|
+
* receive objectSchema
|
|
30
|
+
* create data for WebScoket handler template
|
|
31
|
+
*
|
|
32
|
+
* @param {Object} objectSchema
|
|
33
|
+
* @return {{templatePath, templateData,setting}}
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
function data(_izContext, flowSchema, srcPath) {
|
|
38
|
+
return createParamsForCreateSource(_izContext, flowSchema, srcPath)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
42
|
+
let functionName = upperCase(flowSchema.flowTag);
|
|
43
|
+
|
|
44
|
+
return {
|
|
45
|
+
templatePath: templatePath,
|
|
46
|
+
templateData: {
|
|
47
|
+
flowTag: flowSchema.flowTag,
|
|
48
|
+
functionName,
|
|
49
|
+
},
|
|
50
|
+
setting: {
|
|
51
|
+
savePath: path.join(srcPath, SOURCE_PATH.flowSchema, upperCase(flowSchema.flowTag), "source/"),
|
|
52
|
+
saveFileName: `${functionName}_Main`,
|
|
53
|
+
fileExtension: ".js",
|
|
54
|
+
isAppend: false
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
module.exports = data
|
|
@@ -0,0 +1,81 @@
|
|
|
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
|
+
'use strict';
|
|
20
|
+
|
|
21
|
+
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
22
|
+
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
|
|
23
|
+
|
|
24
|
+
const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
|
|
25
|
+
const snsSharedLib = require('@izara_project/izara-core-library-sns');
|
|
26
|
+
const sqsSharedLib = require('@izara_project/izara-core-library-sqs');
|
|
27
|
+
const asyncFlowSharedLib = require('@izara_project/izara-core-library-asynchronous-flow');
|
|
28
|
+
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
29
|
+
const lambdaSharedLib = require('@izara_project/izara-core-library-lambda');
|
|
30
|
+
const storedCacheSharedLib = require('@izara_project/izara-core-library-stored-cache')
|
|
31
|
+
|
|
32
|
+
const externalRequest = require('@izara_project/izara-core-library-external-request');
|
|
33
|
+
const sns = externalRequest.sns
|
|
34
|
+
const sqs = externalRequest.sqs
|
|
35
|
+
const lambda = externalRequest.lambda
|
|
36
|
+
const { postToConnection } = require("../../../libs/source/GenerateCodeLibs");
|
|
37
|
+
const utils = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Utils')
|
|
38
|
+
const NoRetryError = require('@izara_project/izara-core-library-core').NoRetryError
|
|
39
|
+
const { v4: uuidv4 } = require('uuid')
|
|
40
|
+
const coreConsts = require("@izara_project/izara-core-library-core/src/Consts");
|
|
41
|
+
const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
42
|
+
const consts = require('@izara_project/izara-middleware/src/MiddlewareCore/Consts')
|
|
43
|
+
const { createFieldNamesFromRequestParamsByObjectSchema } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs.js')
|
|
44
|
+
//(<optionalRequire>)
|
|
45
|
+
//(</optionalRequire>)
|
|
46
|
+
/**
|
|
47
|
+
*
|
|
48
|
+
*
|
|
49
|
+
* description of function.
|
|
50
|
+
* @param {Object} _izContext
|
|
51
|
+
* @param {CorrelationIds} _izContext.correlationIds - property of _izContext
|
|
52
|
+
* @param {Logger} _izContext.logger - property of _izContext
|
|
53
|
+
* @param {Object} requestParams - request params
|
|
54
|
+
* @param {Object} requestParams.identifiers - identifiers for get data
|
|
55
|
+
* @param {Object} requestParams.additionalRequest - additionalRequest
|
|
56
|
+
*
|
|
57
|
+
*
|
|
58
|
+
* @returns {object} description of return value
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
module.exports.<%- functionName %>Main = async (
|
|
62
|
+
_izContext,
|
|
63
|
+
requestParams,
|
|
64
|
+
callingFlowConfig = {},
|
|
65
|
+
//(<additionalParams>)
|
|
66
|
+
//(</additionalParams>)
|
|
67
|
+
) => {
|
|
68
|
+
|
|
69
|
+
try {
|
|
70
|
+
_izContext.logger.debug("<%- functionName %>Main _izContext", _izContext)
|
|
71
|
+
_izContext.logger.debug("<%- functionName %>Main requestParams", requestParams)
|
|
72
|
+
_izContext.logger.debug("<%- functionName %>Main callingFlowConfig", callingFlowConfig)
|
|
73
|
+
|
|
74
|
+
//(<endpointHook>)
|
|
75
|
+
//(</endpointHook>)
|
|
76
|
+
|
|
77
|
+
} catch (err) {
|
|
78
|
+
_izContext.logger.error('error WebSocketInvoke: ', err)
|
|
79
|
+
throw (err)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -90,16 +90,25 @@ function createSourceParams(_izContext, allLocalFlowSchemas, srcPath) {
|
|
|
90
90
|
resourceNames(RESOURCE_CLASSES.sqs, queueName),
|
|
91
91
|
resourceNames(RESOURCE_CLASSES.sqs, queueName + "DLQ")
|
|
92
92
|
]
|
|
93
|
-
),
|
|
94
|
-
createIamRole(
|
|
95
|
-
{
|
|
96
|
-
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.subscribe]
|
|
97
|
-
},
|
|
98
|
-
allLocalFlowSchemas.records.map(flowSchema => resourceNames(RESOURCE_CLASSES.sns, flowSchema.flowTag + "_Out"))
|
|
99
93
|
)
|
|
100
94
|
)
|
|
101
95
|
|
|
102
|
-
|
|
96
|
+
for (const flowSchema of allLocalFlowSchemas.records) {
|
|
97
|
+
console.log("flowSchema", flowSchema)
|
|
98
|
+
if (flowSchema.event.includes("ownTopic") || flowSchema.event.includes("extTopic")) {
|
|
99
|
+
console.log("this is topic")
|
|
100
|
+
additionalResourcePermission.push(
|
|
101
|
+
createIamRole(
|
|
102
|
+
{
|
|
103
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.subscribe]
|
|
104
|
+
},
|
|
105
|
+
[
|
|
106
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(flowSchema.flowTag) + "_Out")
|
|
107
|
+
]
|
|
108
|
+
)
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
}
|
|
103
112
|
return {
|
|
104
113
|
templatePath: templatePath,
|
|
105
114
|
templateData: {
|
package/src/reStructure/TemplateData/propertyValueSchema/relationshipPropertyValueSchema/data.js
CHANGED
|
@@ -24,7 +24,7 @@ const {
|
|
|
24
24
|
PREFIX_RELATIONSHIP,
|
|
25
25
|
PROPERTY_VALUE_TAG,
|
|
26
26
|
SAVE_FILE_NAME
|
|
27
|
-
} = require('
|
|
27
|
+
} = require('../../../../MainLibs/src/Consts');
|
|
28
28
|
|
|
29
29
|
const templatePath = path.join(__dirname, "./tempRelationship.ejs");
|
|
30
30
|
|
package/src/reStructure/TemplateData/relationshipPerAction/get/action/mainFunction/template.ejs
CHANGED
|
@@ -52,6 +52,7 @@ const {
|
|
|
52
52
|
TOPIC_NAME_GENERATE_CODE,
|
|
53
53
|
TOPIC_NAME_GRAPH_HANDLER
|
|
54
54
|
} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts');
|
|
55
|
+
const graphSharedLib = require('@izara_project/izara-core-library-graph-service')
|
|
55
56
|
//(<optionalRequire>)
|
|
56
57
|
//(</optionalRequire>)
|
|
57
58
|
/**
|
|
@@ -246,17 +247,15 @@ module.exports.getRelationship = async (
|
|
|
246
247
|
await Promise.all(
|
|
247
248
|
targetGraphStorageResources.map(async (storageResource) => {
|
|
248
249
|
if (storageResource.storageType === consts.STORAGE_TYPES.graph) {
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
}
|
|
250
|
+
result = await graphSharedLib.getRelationshipV2(
|
|
251
|
+
_izContext,
|
|
252
|
+
storageResource.graphServiceTag,
|
|
253
|
+
firstObject,
|
|
254
|
+
secondObject,
|
|
255
|
+
relType,
|
|
256
|
+
relId,
|
|
257
|
+
relationshipDirection
|
|
258
258
|
)
|
|
259
|
-
result = getResultFromGraph;
|
|
260
259
|
} else if (storageResource.storageType === consts.STORAGE_TYPES.dynamoDB) {
|
|
261
260
|
|
|
262
261
|
// if have storageResource.storageType === "dynamoDB" will create relationship here
|
|
@@ -1,128 +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
|
-
'use strict';
|
|
19
|
-
const path = require('path');
|
|
20
|
-
|
|
21
|
-
const { FLOW_SCHEMA_HOOK_STATE, ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
22
|
-
const { firstLetterUpperCase: upperCase } = require('../../../../../MainLibs/src/Utils')
|
|
23
|
-
const {
|
|
24
|
-
SOURCE_PATH,
|
|
25
|
-
defaultIamRolePerAction,
|
|
26
|
-
createIamRole,
|
|
27
|
-
RESOURCE_CLASSES,
|
|
28
|
-
SNS_RESOURCE,
|
|
29
|
-
resourceNames,
|
|
30
|
-
DYNAMO_RESOURCE,
|
|
31
|
-
SAVE_FILE_NAME,
|
|
32
|
-
FUNCTION_NAME,
|
|
33
|
-
shortNameHandler,
|
|
34
|
-
externalResourceYaml,
|
|
35
|
-
SOURCE_GENERATE_IAM_ROLE,
|
|
36
|
-
SQS_RESOURCE,
|
|
37
|
-
LAMBDA_RESOURCE
|
|
38
|
-
} = require('../../../../../MainLibs/src/Consts');
|
|
39
|
-
const { NoRetryError } = require('@izara_project/izara-core-library-core');
|
|
40
|
-
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas').getObjectSchema;
|
|
41
|
-
|
|
42
|
-
const templatePathInv = path.join(__dirname, "templateInv.ejs");
|
|
43
|
-
const templatePathApi = path.join(__dirname, "templateApi.ejs");
|
|
44
|
-
/**
|
|
45
|
-
* receive objectSchema
|
|
46
|
-
* create data for WebScoket handler template
|
|
47
|
-
*
|
|
48
|
-
* @param {Object} objectSchema
|
|
49
|
-
* @return {{templatePath, templateData,setting}}
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
async function data(_izContext, flowSchema, srcPath) {
|
|
53
|
-
let returnCreateSource = [];
|
|
54
|
-
returnCreateSource.push(await createSourceParamsInvoke(_izContext, flowSchema, srcPath))
|
|
55
|
-
if (flowSchema.externalEndpoint) {
|
|
56
|
-
returnCreateSource.push(await createSourceParamsApi(_izContext, flowSchema, srcPath))
|
|
57
|
-
}
|
|
58
|
-
return returnCreateSource
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
async function createSourceParamsInvoke(_izContext, flowSchema, srcPath) {
|
|
62
|
-
let functionName = upperCase(flowSchema.flowTag)
|
|
63
|
-
let handlerType = upperCase(HANDLER.hdrInv)
|
|
64
|
-
let additionalResourcePermission = defaultIamRolePerAction();
|
|
65
|
-
let tableName = null;
|
|
66
|
-
if (flowSchema.statusType === "storedCache") {
|
|
67
|
-
let objectSchema = await getObjectSchema.getLocalObjectSchemas(_izContext, [flowSchema.objType.objectType], path.join(srcPath, "./schemas")).then(res => res.records[0]);
|
|
68
|
-
for (const storageResource of Object.values(objectSchema.storageResources)) {
|
|
69
|
-
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
70
|
-
tableName = storageResource.tableName
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return {
|
|
76
|
-
templatePath: templatePathInv,
|
|
77
|
-
templateData: {
|
|
78
|
-
resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema, upperCase(flowSchema.flowTag), "source/"),
|
|
79
|
-
functionName,
|
|
80
|
-
handlerType,
|
|
81
|
-
additionalResourcePermission,
|
|
82
|
-
functionNameConfig: upperCase(functionName) + upperCase(shortNameHandler(handlerType)),
|
|
83
|
-
roleName: upperCase(flowSchema.flowTag)
|
|
84
|
-
},
|
|
85
|
-
setting: {
|
|
86
|
-
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
87
|
-
saveFileName: upperCase(SAVE_FILE_NAME.flowSchema),
|
|
88
|
-
fileExtension: ".yml",
|
|
89
|
-
isAppend: true
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
async function createSourceParamsApi(_izContext, flowSchema, srcPath) {
|
|
95
|
-
let functionName = upperCase(flowSchema.flowTag)
|
|
96
|
-
let handlerType = upperCase(HANDLER.hdrApi)
|
|
97
|
-
let additionalResourcePermission = defaultIamRolePerAction();
|
|
98
|
-
let tableName = null;
|
|
99
|
-
if (flowSchema.statusType === "storedCache") {
|
|
100
|
-
let objectSchema = await getObjectSchema.getLocalObjectSchemas(_izContext, [flowSchema.objType.objectType], path.join(srcPath, "./schemas")).then(res => res.records[0]);
|
|
101
|
-
for (const storageResource of Object.values(objectSchema.storageResources)) {
|
|
102
|
-
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
103
|
-
tableName = storageResource.tableName
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return {
|
|
109
|
-
templatePath: templatePathApi,
|
|
110
|
-
templateData: {
|
|
111
|
-
resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema, upperCase(flowSchema.flowTag), "source/"),
|
|
112
|
-
functionName,
|
|
113
|
-
handlerType,
|
|
114
|
-
additionalResourcePermission,
|
|
115
|
-
functionNameConfig: upperCase(functionName) + upperCase(shortNameHandler(handlerType)),
|
|
116
|
-
roleName: upperCase(flowSchema.flowTag),
|
|
117
|
-
event: "post"
|
|
118
|
-
},
|
|
119
|
-
setting: {
|
|
120
|
-
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
121
|
-
saveFileName: upperCase(SAVE_FILE_NAME.flowSchema),
|
|
122
|
-
fileExtension: ".yml",
|
|
123
|
-
isAppend: true
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
module.exports = data;
|
|
File without changes
|