@izara_project/izara-market-library-service-schemas 1.0.53 → 1.0.54
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/GenerateCodeLibs.js +1 -1
- package/src/reStructure/TemplateConfig.js +4 -1
- package/src/reStructure/TemplateData/Auth/generateAuthYml/data.js +58 -0
- package/src/reStructure/TemplateData/Auth/generateAuthYml/template.ejs +17 -0
- package/src/reStructure/TemplateData/Auth/generateTemplateData.js +51 -0
- package/src/reStructure/TemplateData/EndpointPerService/handler/api/template.ejs +2 -1
- package/src/reStructure/TemplateData/EndpointPerService/handler/dsq/template.ejs +2 -1
- package/src/reStructure/TemplateData/EndpointPerService/handler/inv/template.ejs +2 -0
- package/src/reStructure/TemplateData/EndpointPerService/handler/sqs/template.ejs +2 -0
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +52 -41
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +3 -1
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +1 -1
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +1 -1
- package/src/reStructure/TemplateData/EndpointPerService/yaml/data.js +2 -2
- package/src/reStructure/TemplateData/EndpointPerService/yaml/template.ejs +12 -16
- package/src/reStructure/TemplateData/externalService/lambdaRole/data.js +22 -6
- package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/externalTopic/Process/functionYaml/data.js +13 -10
- package/src/reStructure/TemplateData/flowSchema/externalTopic/Process/handler/data.js +1 -46
- package/src/reStructure/TemplateData/flowSchema/externalTopic/Process/handler/template.ejs +4 -1
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/data.js +8 -12
- package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/EndpointComponent/mainFunction → flowSchemaMainFunction}/data.js +5 -5
- package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/EndpointComponent/mainFunction → flowSchemaMainFunction}/template.ejs +7 -12
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/data.js +12 -8
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/template.ejs +6 -2
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowStep/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowStep/handler/template.ejs +7 -1
- package/src/reStructure/TemplateData/flowSchema/flowStep/mainFunction/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/flowStep/mainFunction/template.ejs +2 -7
- package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +12 -16
- package/src/reStructure/TemplateData/flowSchema/lambdaSync/Api/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/lambdaSync/Api/functionYaml/template.ejs +11 -5
- package/src/reStructure/TemplateData/flowSchema/lambdaSync/Api/handler/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/lambdaSync/Api/handler/template.ejs +27 -23
- package/src/reStructure/TemplateData/flowSchema/lambdaSync/Inv/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/lambdaSync/Inv/handler/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/lambdaSync/Inv/handler/template.ejs +10 -4
- package/src/reStructure/TemplateData/flowSchema/webSocketComplete/functionYaml/data.js +0 -1
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/mainFunction/template.ejs +9 -1
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/template.ejs +5 -1
- package/src/reStructure/TemplateData/flowSchema/externalTopic/Process/mainFunction/data.js +0 -75
- package/src/reStructure/TemplateData/flowSchema/externalTopic/Process/mainFunction/template.ejs +0 -98
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/sqsTemplate.ejs +0 -52
- package/src/reStructure/TemplateData/flowSchema/lambdaSync/Api/mainFunction/data.js +0 -57
- package/src/reStructure/TemplateData/flowSchema/lambdaSync/Api/mainFunction/template.ejs +0 -81
- package/src/reStructure/TemplateData/flowSchema/lambdaSync/Inv/mainFunction/data.js +0 -58
- package/src/reStructure/TemplateData/flowSchema/lambdaSync/Inv/mainFunction/template.ejs +0 -81
- /package/src/reStructure/TemplateData/flowSchema/{templateBystatusType → templateByStatusType}/statusFieldTemplate.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{templateBystatusType → templateByStatusType}/storedCacheTemplate.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{templateBystatusType → templateByStatusType}/triggerCacheTemplate.ejs +0 -0
|
@@ -31,8 +31,6 @@ const STORAGE_TYPES = {
|
|
|
31
31
|
graph: "graph"
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
const snsTemplatePath = path.join(__dirname, '../../../resourceYaml/sns-in-sqs/snsTemplate.ejs');
|
|
35
|
-
const subscriptionSqsTemplatePath = path.join(__dirname, './sqsTemplate.ejs');
|
|
36
34
|
const template = path.join(__dirname, "./template.ejs") // !! <----- Add here
|
|
37
35
|
|
|
38
36
|
const { SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, HANDLER } = require('../../../../../MainLibs/src/Consts.js');
|
|
@@ -69,19 +67,17 @@ function createDataForDefaultSnsInSqs(_izContext, flowSchema, srcPath) {
|
|
|
69
67
|
)
|
|
70
68
|
}
|
|
71
69
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
70
|
+
if (flowSteps.includes("Out") && flowSchema.outputTopic === true) {
|
|
71
|
+
generatedSnsTopicInForFlowSchema.push(
|
|
72
|
+
{
|
|
73
|
+
queueName: upperCase(flowSchema.flowTag) + "Complete" + upperCase(HANDLER.hdrSqs)
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
}
|
|
81
77
|
|
|
82
78
|
for (let defaultSnsInSqsData of generatedSnsTopicInForFlowSchema) {
|
|
83
79
|
resultsForCreateDefaultSnsInSqs.push({
|
|
84
|
-
templatePath:
|
|
80
|
+
templatePath: template,
|
|
85
81
|
templateData: defaultSnsInSqsData,
|
|
86
82
|
setting: setting
|
|
87
83
|
})
|
|
@@ -18,14 +18,14 @@ 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 NoRetryError = require('@izara_project/izara-core-library-core').NoRetryError
|
|
21
|
-
const { SOURCE_PATH, FUNCTION_NAME, HANDLER } = require('
|
|
22
|
-
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("
|
|
21
|
+
const { SOURCE_PATH, FUNCTION_NAME, HANDLER } = require('../../../../MainLibs/src/Consts');
|
|
22
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../MainLibs/src/Utils")
|
|
23
23
|
const templatePath = path.join(__dirname, "template.ejs");
|
|
24
24
|
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
|
|
25
25
|
const { STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
26
|
-
const statusFieldTemplate = path.join(__dirname, "
|
|
27
|
-
const storedCacheTemplate = path.join(__dirname, "
|
|
28
|
-
const triggerCacheTemplate = path.join(__dirname, "
|
|
26
|
+
const statusFieldTemplate = path.join(__dirname, "../templateByStatusType/statusFieldTemplate.ejs")
|
|
27
|
+
const storedCacheTemplate = path.join(__dirname, "../templateByStatusType/storedCacheTemplate.ejs")
|
|
28
|
+
const triggerCacheTemplate = path.join(__dirname, "../templateByStatusType/triggerCacheTemplate.ejs")
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* receive objectSchema
|
|
@@ -18,29 +18,25 @@ along with this program. If not, see
|
|
|
18
18
|
|
|
19
19
|
'use strict';
|
|
20
20
|
|
|
21
|
-
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
22
21
|
const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
|
|
23
|
-
|
|
24
22
|
const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
|
|
25
23
|
const snsSharedLib = require('@izara_project/izara-core-library-sns');
|
|
26
24
|
const sqsSharedLib = require('@izara_project/izara-core-library-sqs');
|
|
27
25
|
const asyncFlowSharedLib = require('@izara_project/izara-core-library-asynchronous-flow');
|
|
28
26
|
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
29
27
|
const lambdaSharedLib = require('@izara_project/izara-core-library-lambda');
|
|
30
|
-
const storedCacheSharedLib = require('@izara_project/izara-core-library-stored-cache')
|
|
31
|
-
const triggeredCacheSharedLib = require('@izara_project/izara-core-library-trigger-cache')
|
|
32
28
|
const externalRequest = require('@izara_project/izara-core-library-external-request');
|
|
33
29
|
const sns = externalRequest.sns
|
|
34
30
|
const sqs = externalRequest.sqs
|
|
35
31
|
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
32
|
const NoRetryError = require('@izara_project/izara-core-library-core').NoRetryError
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
const consts = require('@izara_project/izara-middleware/src/MiddlewareCore/Consts')
|
|
33
|
+
<% if (statusType === "triggerCache") { -%>
|
|
34
|
+
const triggeredCacheSharedLib = require('@izara_project/izara-core-library-trigger-cache')
|
|
35
|
+
<% } else if (statusType === "statusField") { -%>
|
|
43
36
|
const { createFieldNamesFromRequestParamsByObjectSchema } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs.js')
|
|
37
|
+
<% } else if (statusType === "storedCache") { -%>
|
|
38
|
+
const storedCacheSharedLib = require('@izara_project/izara-core-library-stored-cache')
|
|
39
|
+
<% } %>
|
|
44
40
|
//(<optionalRequire>)
|
|
45
41
|
//(</optionalRequire>)
|
|
46
42
|
/**
|
|
@@ -63,7 +59,7 @@ module.exports.<%- functionName %> = async (
|
|
|
63
59
|
requestParams,
|
|
64
60
|
//(<additionalParams>)
|
|
65
61
|
//(</additionalParams>)
|
|
66
|
-
|
|
62
|
+
callingFlowConfig = {},
|
|
67
63
|
) => {
|
|
68
64
|
|
|
69
65
|
try {
|
|
@@ -87,7 +83,6 @@ module.exports.<%- functionName %> = async (
|
|
|
87
83
|
}) %>
|
|
88
84
|
<% } %>
|
|
89
85
|
|
|
90
|
-
|
|
91
86
|
//(<endpointHook>)
|
|
92
87
|
//(</endpointHook>)
|
|
93
88
|
|
|
@@ -59,6 +59,7 @@ async function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
|
59
59
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
60
60
|
let route = upperCase(flowSchema.flowTag);
|
|
61
61
|
let queueName = upperCase(flowSchema.flowTag) + handlerType;
|
|
62
|
+
|
|
62
63
|
additionalResourcePermission.push(
|
|
63
64
|
createIamRole(
|
|
64
65
|
{
|
|
@@ -69,14 +70,6 @@ async function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
|
69
70
|
resourceNames(RESOURCE_CLASSES.sqs, queueName + "DLQ")
|
|
70
71
|
]
|
|
71
72
|
),
|
|
72
|
-
createIamRole(
|
|
73
|
-
{
|
|
74
|
-
[RESOURCE_CLASSES.lambda]: Object.values(LAMBDA_RESOURCE)
|
|
75
|
-
},
|
|
76
|
-
[
|
|
77
|
-
resourceNames(RESOURCE_CLASSES.lambda, 'CreateHdrInv')
|
|
78
|
-
]
|
|
79
|
-
),
|
|
80
73
|
)
|
|
81
74
|
|
|
82
75
|
if (flowSchema.statusType === "storedCache") {
|
|
@@ -102,6 +95,17 @@ async function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
|
102
95
|
tableName => resourceNames(RESOURCE_CLASSES.dynamoDbTable, tableName))
|
|
103
96
|
)
|
|
104
97
|
)
|
|
98
|
+
} else if (flowSchema.statusType === "statusField") {
|
|
99
|
+
additionalResourcePermission.push(
|
|
100
|
+
createIamRole(
|
|
101
|
+
{
|
|
102
|
+
[RESOURCE_CLASSES.lambda]: Object.values(LAMBDA_RESOURCE)
|
|
103
|
+
},
|
|
104
|
+
[
|
|
105
|
+
resourceNames(RESOURCE_CLASSES.lambda, 'CreateHdrInv')
|
|
106
|
+
]
|
|
107
|
+
)
|
|
108
|
+
)
|
|
105
109
|
}
|
|
106
110
|
|
|
107
111
|
return {
|
|
@@ -24,11 +24,14 @@ const izara = require("@izara_project/izara-middleware");
|
|
|
24
24
|
const middleware = izara.middlewareHandler;
|
|
25
25
|
const recordHandlerSharedLib = require("@izara_project/izara-core-library-record-handler")
|
|
26
26
|
const Logger = require('@izara_project/izara-core-library-logger');
|
|
27
|
-
|
|
27
|
+
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
28
28
|
const <%- functionName %> = require('./<%- functionName %>_Main')
|
|
29
29
|
|
|
30
30
|
// validate event properties in body.Message of sqs event
|
|
31
|
-
let perRecordsValidatorSchema = {
|
|
31
|
+
let perRecordsValidatorSchema = {
|
|
32
|
+
//(<validatorSchema>)
|
|
33
|
+
//(</validatorSchema>)
|
|
34
|
+
}
|
|
32
35
|
middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
|
|
33
36
|
|
|
34
37
|
module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
@@ -55,6 +58,7 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
55
58
|
passOnProperties.push(record.body.Message)
|
|
56
59
|
//(<additionalParams>)
|
|
57
60
|
//(</additionalParams>)
|
|
61
|
+
passOnProperties.push(callingFlowSharedLib.addCallingFlowToPassOnProperties(record.body.Message));
|
|
58
62
|
record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
|
|
59
63
|
|
|
60
64
|
// call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
|
|
@@ -98,7 +98,7 @@ function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
|
98
98
|
return {
|
|
99
99
|
templatePath: templatePath,
|
|
100
100
|
templateData: {
|
|
101
|
-
resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema, flowSchema.flowTag, "source/"),
|
|
101
|
+
resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchema, upperCase(flowSchema.flowTag), "source/"),
|
|
102
102
|
functionName,
|
|
103
103
|
handlerType,
|
|
104
104
|
additionalResourcePermission,
|
|
@@ -61,9 +61,9 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
61
61
|
await <%- functionName %>.<%- functionName %>(
|
|
62
62
|
event._izContext,
|
|
63
63
|
eventParams,
|
|
64
|
-
callingFlowSharedLib.addCallingFlowToPassOnProperties(callingFlow)
|
|
65
64
|
//(<additionalParams>)
|
|
66
65
|
//(</additionalParams>)
|
|
66
|
+
callingFlowSharedLib.addCallingFlowToPassOnProperties(callingFlow)
|
|
67
67
|
)
|
|
68
68
|
|
|
69
69
|
break
|
|
@@ -55,9 +55,9 @@ const { postToConnection } = require('../../../libs/source/GenerateCodeLibs')
|
|
|
55
55
|
module.exports.<%- functionName %> = async (
|
|
56
56
|
_izContext,
|
|
57
57
|
requestParams,
|
|
58
|
-
callingFlowConfig = {},
|
|
59
58
|
//(<additionalParams>)
|
|
60
59
|
//(</additionalParams>)
|
|
60
|
+
callingFlowConfig = {},
|
|
61
61
|
) => {
|
|
62
62
|
|
|
63
63
|
try {
|
|
@@ -28,7 +28,10 @@ const Logger = require('@izara_project/izara-core-library-logger');
|
|
|
28
28
|
const <%- functionName %> = require('./<%- functionName %>_Main')
|
|
29
29
|
|
|
30
30
|
// validate event properties in body.Message of sqs event
|
|
31
|
-
let perRecordsValidatorSchema = {
|
|
31
|
+
let perRecordsValidatorSchema = {
|
|
32
|
+
//(<validatorSchema>)
|
|
33
|
+
//(</validatorSchema>)
|
|
34
|
+
}
|
|
32
35
|
middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
|
|
33
36
|
|
|
34
37
|
module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
@@ -53,6 +56,9 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
53
56
|
|
|
54
57
|
// add argument (to invoke lambda) to passOnProperties[]
|
|
55
58
|
passOnProperties.push(record.body.Message)
|
|
59
|
+
//(<additionalParams>)
|
|
60
|
+
//(</additionalParams>)
|
|
61
|
+
passOnProperties.push(callingFlowSharedLib.addCallingFlowToPassOnProperties(record.body.Message));
|
|
56
62
|
record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
|
|
57
63
|
|
|
58
64
|
// call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
|
|
@@ -73,8 +73,8 @@ function data(_izContext, flowSchema, srcPath) {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
function createParamsForCreateSource(_izContext, flowTag, flowStep, srcPath) {
|
|
76
|
-
let functionName = upperCase(
|
|
77
|
-
let topicArn = `${upperCase(flowStep)}
|
|
76
|
+
let functionName = upperCase(flowStep)
|
|
77
|
+
let topicArn = `${upperCase(flowStep)}`
|
|
78
78
|
|
|
79
79
|
return {
|
|
80
80
|
templatePath: templatePath,
|
|
@@ -26,15 +26,10 @@ const snsSharedLib = require('@izara_project/izara-core-library-sns');
|
|
|
26
26
|
const asyncFlowSharedLib = require('@izara_project/izara-core-library-asynchronous-flow');
|
|
27
27
|
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
28
28
|
const lambdaSharedLib = require('@izara_project/izara-core-library-lambda');
|
|
29
|
-
const storedCacheSharedLib = require('@izara_project/izara-core-library-stored-cache')
|
|
30
29
|
const externalRequest = require('@izara_project/izara-core-library-external-request');
|
|
31
30
|
const sns = externalRequest.sns
|
|
32
|
-
|
|
33
|
-
const utils = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Utils')
|
|
34
31
|
const NoRetryError = require('@izara_project/izara-core-library-core').NoRetryError
|
|
35
|
-
|
|
36
|
-
const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
37
|
-
const { postToConnection } = require('../../../libs/source/GenerateCodeLibs')
|
|
32
|
+
|
|
38
33
|
//(<optionalRequire>)
|
|
39
34
|
//(</optionalRequire>)
|
|
40
35
|
/**
|
|
@@ -55,9 +50,9 @@ const { postToConnection } = require('../../../libs/source/GenerateCodeLibs')
|
|
|
55
50
|
module.exports.<%- functionName %> = async (
|
|
56
51
|
_izContext,
|
|
57
52
|
requestParams,
|
|
58
|
-
callingFlowConfig = {},
|
|
59
53
|
//(<additionalParams>)
|
|
60
54
|
//(</additionalParams>)
|
|
55
|
+
callingFlowConfig = {},
|
|
61
56
|
) => {
|
|
62
57
|
|
|
63
58
|
try {
|
|
@@ -72,17 +72,18 @@ const createConfirmAfterUploadS3Queue = require('./components/upload/confirmRese
|
|
|
72
72
|
// flowSchema ExternalTopic components //
|
|
73
73
|
const createExternalSqsFunctionYaml = require('./externalTopic/Process/functionYaml/data');
|
|
74
74
|
const createExternalSqsHandler = require('./externalTopic/Process/handler/data');
|
|
75
|
-
const createExternalSqsMainFunction = require('./externalTopic/Process/mainFunction/data');
|
|
76
75
|
const createExternalSqsCompleteFunctionYaml = require("./externalTopic/Complete/functionYaml/data");
|
|
77
76
|
const createExternalSqsCompleteHandler = require("./externalTopic/Complete/handler/data");
|
|
78
77
|
const createExternalSqsCompleteMainFunction = require("./externalTopic/Complete/mainFunction/data");
|
|
79
78
|
const createExternalTopicSnsInSqs = require('./externalTopic/sns-in-sqs/data');
|
|
80
79
|
const createExternalTopicSnsOut = require('./externalTopic/sns-out/data')
|
|
81
80
|
|
|
81
|
+
const createFlowSchemaEndpointMainFunction = require('./flowSchemaMainFunction/data');
|
|
82
|
+
|
|
82
83
|
// flowSchema OwnTopic component
|
|
84
|
+
const createFlowSchemaOwnTopicMainFunction = require('./flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/data');
|
|
83
85
|
const createFlowSchemaOwnTopicFunctionYaml = require('./flowSchemaOwnTopic/FlowSchemaComponent/functionYaml/data');
|
|
84
86
|
const createFlowSchemaOwnTopicHandler = require('./flowSchemaOwnTopic/FlowSchemaComponent/handler/data');
|
|
85
|
-
const createFlowSchemaOwnTopicMainFunction = require('./flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/data');
|
|
86
87
|
|
|
87
88
|
// flowSchema OwnTopicComplete component
|
|
88
89
|
const createWebSocketCompleteMainFunctionYaml = require("./webSocketComplete/functionYaml/data");
|
|
@@ -93,7 +94,6 @@ const createWebSocketCompleteMainSqs = require('./webSocketComplete/sqs/data');
|
|
|
93
94
|
|
|
94
95
|
const createFlowSchemaOwnTopicEndpointFunctionYaml = require('./flowSchemaOwnTopic/EndpointComponent/functionYaml/data');
|
|
95
96
|
const createFlowSchemaOwnTopicEndpointHandler = require('./flowSchemaOwnTopic/EndpointComponent/handler/data');
|
|
96
|
-
const createFlowSchemaOwnTopicEndpointMainFunction = require('./flowSchemaOwnTopic/EndpointComponent/mainFunction/data');
|
|
97
97
|
|
|
98
98
|
// flowSchema OnwTopic flowStep component
|
|
99
99
|
const createFlowSchemaFlowStepFunctionYaml = require('./flowStep/functionYaml/data');
|
|
@@ -115,15 +115,13 @@ const createFlowSchemaEventBridgeMainFunction = require('./eventBridge/mainFunct
|
|
|
115
115
|
// flowSchema lambdaSync components
|
|
116
116
|
const createFlowSchemaLambdaSyncFunctionYamlInv = require('./lambdaSync/Inv/functionYaml/data');
|
|
117
117
|
const createFlowSchemaLambdaSyncHandlerInv = require('./lambdaSync/Inv/handler/data');
|
|
118
|
-
const createFlowSchemaLambdaSyncMainFunctionInv = require('./lambdaSync/Inv/mainFunction/data');
|
|
119
118
|
|
|
120
119
|
const createFlowSchemaLambdaSyncFunctionYamlApi = require("./lambdaSync/Api/functionYaml/data");
|
|
121
120
|
const createFlowSchemaLambdaSyncHandlerApi = require("./lambdaSync/Api/handler/data");
|
|
122
|
-
const createFlowSchemaLambdaSyncMainFunctionApi = require("./lambdaSync/Api/mainFunction/data")
|
|
123
121
|
|
|
124
122
|
const createAwaitingMultipleStepDynamoDbData = require('./dynamoDb/data');
|
|
125
123
|
// create record status Field Complete
|
|
126
|
-
const
|
|
124
|
+
const createCreateObjectCompleteFunctionYaml = require('./CreateRecordComplete/functionYaml/data');
|
|
127
125
|
const createCreateObjectCompleteHandler = require('./CreateRecordComplete/handler/data');
|
|
128
126
|
const createCreateObjectCompleteMainFunction = require('./CreateRecordComplete/mainFunction/data');
|
|
129
127
|
const createCreateObjectCompleteQueue = require('./CreateRecordComplete/queue/data');// flowSchema Register component //
|
|
@@ -180,7 +178,8 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
180
178
|
for (const flowSchema of allLocalFlowSchemas.records) {
|
|
181
179
|
// console.log("flowSchema in Generate TemplateData", flowSchema);
|
|
182
180
|
const webSocketGenerateCodeLibs = createWebSocketGenerateCodeLibs(_izContext, flowSchema, saveFilePath)
|
|
183
|
-
|
|
181
|
+
const flowSchemaEndpointMainFunction = await createFlowSchemaEndpointMainFunction(_izContext, flowSchema, saveFilePath);
|
|
182
|
+
createSourceParams.push(...webSocketGenerateCodeLibs, ...flowSchemaEndpointMainFunction)
|
|
184
183
|
|
|
185
184
|
// event has [s3, extTopic, ownTopic, eventBridge, lambdaSync]
|
|
186
185
|
for (const event of flowSchema.event) {
|
|
@@ -280,7 +279,7 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
280
279
|
// ** External Topic ** //
|
|
281
280
|
const externalSqsFunctionYaml = await createExternalSqsFunctionYaml(_izContext, flowSchema, saveFilePath);
|
|
282
281
|
const externalSqsHandler = await createExternalSqsHandler(_izContext, flowSchema, saveFilePath);
|
|
283
|
-
const externalSqsMainFunction = await createExternalSqsMainFunction(_izContext, flowSchema, saveFilePath);
|
|
282
|
+
// const externalSqsMainFunction = await createExternalSqsMainFunction(_izContext, flowSchema, saveFilePath);
|
|
284
283
|
const externalTopicSnsInSqs = createExternalTopicSnsInSqs(_izContext, flowSchema, saveFilePath);
|
|
285
284
|
const externalTopicSnsOut = createExternalTopicSnsOut(_izContext, flowSchema, saveFilePath);
|
|
286
285
|
|
|
@@ -291,14 +290,14 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
291
290
|
const externalTopic = [
|
|
292
291
|
...externalSqsFunctionYaml,
|
|
293
292
|
...externalSqsHandler,
|
|
294
|
-
...externalSqsMainFunction,
|
|
293
|
+
// ...externalSqsMainFunction,
|
|
295
294
|
...externalTopicSnsInSqs,
|
|
296
295
|
...externalTopicSnsOut,
|
|
297
296
|
// ...externalTopicCompleteFunctionYml, ...externalTopicCompleteHandler, ...externalTopicCompleteMainFunction
|
|
298
297
|
];
|
|
299
298
|
|
|
300
299
|
createSourceParams.push(...externalTopic)
|
|
301
|
-
|
|
300
|
+
console.log("flowSchema external topic generated")
|
|
302
301
|
} else if (event.includes("ownTopic")) {
|
|
303
302
|
|
|
304
303
|
// flowSchema OwnTopic components
|
|
@@ -310,8 +309,7 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
310
309
|
// flowSchemaOwnTopic Endpoint
|
|
311
310
|
const flowSchemaOwnTopicEndpointFunctionYaml = await createFlowSchemaOwnTopicEndpointFunctionYaml(_izContext, flowSchema, saveFilePath);
|
|
312
311
|
const flowSchemaOwnTopicEndpointHandler = createFlowSchemaOwnTopicEndpointHandler(_izContext, flowSchema, saveFilePath);
|
|
313
|
-
const
|
|
314
|
-
const flowSchemaOwnTopicEndpointComponent = [...flowSchemaOwnTopicEndpointFunctionYaml, ...flowSchemaOwnTopicEndpointHandler, ...flowSchemaOwnTopicEndpointMainFunction]
|
|
312
|
+
const flowSchemaOwnTopicEndpointComponent = [...flowSchemaOwnTopicEndpointFunctionYaml, ...flowSchemaOwnTopicEndpointHandler]
|
|
315
313
|
|
|
316
314
|
// flowSchemaOwnTopic EndpointComplete
|
|
317
315
|
// const flowSchemaOwnTopicEndpointCompleteFuntionYaml = createFlowSchemaOwnTopicEndpointCompleteFuntionYaml(_izContext, flowSchema, saveFilePath);
|
|
@@ -350,14 +348,14 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
350
348
|
} else if (event.includes("lambdaSyncInv")) {
|
|
351
349
|
const flowSchemaLambdaSyncFunctionYamlInv = createFlowSchemaLambdaSyncFunctionYamlInv(_izContext, flowSchema, saveFilePath);
|
|
352
350
|
const flowSchemaLambdaSyncHandlerInv = createFlowSchemaLambdaSyncHandlerInv(_izContext, flowSchema, saveFilePath);
|
|
353
|
-
const flowSchemaLambdaSyncMainFunctionInv = createFlowSchemaLambdaSyncMainFunctionInv(_izContext, flowSchema, saveFilePath);
|
|
351
|
+
// const flowSchemaLambdaSyncMainFunctionInv = createFlowSchemaLambdaSyncMainFunctionInv(_izContext, flowSchema, saveFilePath);
|
|
354
352
|
|
|
355
353
|
|
|
356
354
|
// Group the resources
|
|
357
355
|
const lambdaSyncInvResources = [
|
|
358
356
|
flowSchemaLambdaSyncFunctionYamlInv,
|
|
359
357
|
flowSchemaLambdaSyncHandlerInv,
|
|
360
|
-
flowSchemaLambdaSyncMainFunctionInv,
|
|
358
|
+
// flowSchemaLambdaSyncMainFunctionInv,
|
|
361
359
|
];
|
|
362
360
|
|
|
363
361
|
console.log("event lambdaSyncInv generated")
|
|
@@ -366,12 +364,10 @@ async function generateCodeWithTemplate(_izContext, objSchemaPath) {
|
|
|
366
364
|
} else if (event.includes("lambdaSyncApi")) {
|
|
367
365
|
const flowSchemaLambdaSyncFunctionYamlApi = createFlowSchemaLambdaSyncFunctionYamlApi(_izContext, flowSchema, saveFilePath);
|
|
368
366
|
const flowSchemaLambdaSyncHandlerApi = createFlowSchemaLambdaSyncHandlerApi(_izContext, flowSchema, saveFilePath);
|
|
369
|
-
const flowSchemaLambdaSyncMainFunctionApi = createFlowSchemaLambdaSyncMainFunctionApi(_izContext, flowSchema, saveFilePath);
|
|
370
367
|
|
|
371
368
|
const lambdaSyncApiResources = [
|
|
372
369
|
flowSchemaLambdaSyncFunctionYamlApi,
|
|
373
370
|
flowSchemaLambdaSyncHandlerApi,
|
|
374
|
-
flowSchemaLambdaSyncMainFunctionApi
|
|
375
371
|
];
|
|
376
372
|
createSourceParams.push(...lambdaSyncApiResources)
|
|
377
373
|
console.log("event lambdaSyncApi generated")
|
|
@@ -52,7 +52,7 @@ function data(_izContext, flowSchema, srcPath) {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
function createSourceParamsApi(_izContext, flowSchema, srcPath) {
|
|
55
|
-
let functionName = upperCase(flowSchema.flowTag)
|
|
55
|
+
let functionName = "Process" + upperCase(flowSchema.flowTag)
|
|
56
56
|
let handlerType = upperCase(HANDLER.hdrApi)
|
|
57
57
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
58
58
|
|
|
@@ -3,12 +3,18 @@
|
|
|
3
3
|
handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`) %>
|
|
4
4
|
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
5
5
|
events:
|
|
6
|
-
-
|
|
7
|
-
path:
|
|
6
|
+
- httpApi:
|
|
7
|
+
path: /<%- firstLetterLowerCase(functionName) %>/
|
|
8
8
|
method: <%- event %>
|
|
9
|
-
|
|
10
|
-
#<#<%- firstLetterUpperCase(functionName) _%><%- firstLetterUpperCase(handlerType) %>
|
|
11
|
-
#<#/<%- firstLetterUpperCase(functionName) _%><%- firstLetterUpperCase(handlerType) %>
|
|
9
|
+
authorizer: authorizerServiceSchema
|
|
10
|
+
#<#<%- firstLetterUpperCase(functionName) _%><%- firstLetterUpperCase(handlerType) %>AppLevelAuthorizer#>
|
|
11
|
+
#<#/<%- firstLetterUpperCase(functionName) _%><%- firstLetterUpperCase(handlerType) %>AppLevelAuthorizer#>
|
|
12
|
+
- httpApi:
|
|
13
|
+
path: /<%- firstLetterLowerCase(functionName) %>/{targetUserId}
|
|
14
|
+
method: <%- event %>
|
|
15
|
+
authorizer: authorizerServiceSchema
|
|
16
|
+
#<#<%- firstLetterUpperCase(functionName) _%><%- firstLetterUpperCase(handlerType) %>UserLevelAuthorizer#>
|
|
17
|
+
#<#/<%- firstLetterUpperCase(functionName) _%><%- firstLetterUpperCase(handlerType) %>UserLevelAuthorizer#>
|
|
12
18
|
role: <%- firstLetterUpperCase(roleName) _%>Role
|
|
13
19
|
#<#<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
14
20
|
#<#/<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>IamRole#>
|
|
@@ -36,7 +36,7 @@ function data(_izContext, flowSchema, srcPath) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
function createSourceParamsApi(_izContext, flowSchema, srcPath) {
|
|
39
|
-
let functionName = upperCase(flowSchema.flowTag)
|
|
39
|
+
let functionName = "Process" + upperCase(flowSchema.flowTag)
|
|
40
40
|
let handlerType = upperCase(HANDLER.hdrApi)
|
|
41
41
|
|
|
42
42
|
return {
|
|
@@ -22,25 +22,28 @@ const RBAC_TARGET_ID = process.env.iz_rbacTargetIdUser // iz_rbacTargetIdUser |
|
|
|
22
22
|
const izara = require("@izara_project/izara-middleware");
|
|
23
23
|
const middleware = izara.middlewareHandler;
|
|
24
24
|
const <%- functionName %> = require('./<%- functionName %>_Main')
|
|
25
|
-
|
|
26
|
-
// validate event params in
|
|
27
|
-
let validatorSchema = {
|
|
25
|
+
const callingFlowSharedLib = require("@izara_project/izara-core-library-calling-flow")
|
|
26
|
+
// validate event params in middleware before into function.
|
|
27
|
+
let validatorSchema = {
|
|
28
|
+
//(<validatorSchema>)
|
|
29
|
+
//(</validatorSchema>)
|
|
30
|
+
};
|
|
28
31
|
// NOTE: not sure about remap_when_flatten and remove_when_flatten function of api still require for validate or not? Tam(19-Nov) -- Yes
|
|
29
32
|
|
|
30
33
|
// for auth userLevel
|
|
31
|
-
if (process.env.iz_rbacTargetIdUser) {
|
|
32
|
-
validatorSchema
|
|
33
|
-
validatorSchema.properties.pathParameters = {
|
|
34
|
-
additionalProperties: false,
|
|
35
|
-
type: ['object', 'boolean'],
|
|
36
|
-
required: [process.env.iz_rbacTargetIdUser],
|
|
37
|
-
properties: {
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
validatorSchema.properties.pathParameters.properties[process.env.iz_rbacTargetIdUser] = {
|
|
41
|
-
type: 'string'
|
|
42
|
-
};
|
|
43
|
-
}
|
|
34
|
+
// if (process.env.iz_rbacTargetIdUser) {
|
|
35
|
+
// validatorSchema["required"] = ['pathParameters'];
|
|
36
|
+
// validatorSchema.properties.pathParameters = {
|
|
37
|
+
// additionalProperties: false,
|
|
38
|
+
// type: ['object', 'boolean'],
|
|
39
|
+
// required: [process.env.iz_rbacTargetIdUser],
|
|
40
|
+
// properties: {
|
|
41
|
+
// }
|
|
42
|
+
// };
|
|
43
|
+
// validatorSchema.properties.pathParameters.properties[process.env.iz_rbacTargetIdUser] = {
|
|
44
|
+
// type: 'string'
|
|
45
|
+
// };
|
|
46
|
+
//}
|
|
44
47
|
// If not have Authorizer set setMiddlewareSettings.
|
|
45
48
|
middleware.setValidatorSchema(validatorSchema, { noAuthorizer: true })
|
|
46
49
|
|
|
@@ -53,16 +56,17 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
53
56
|
try {
|
|
54
57
|
|
|
55
58
|
// for targetUserId
|
|
56
|
-
let targetUserId = null
|
|
57
|
-
if (process.env.iz_rbacTargetIdUser) {
|
|
58
|
-
|
|
59
|
-
}
|
|
59
|
+
// let targetUserId = null
|
|
60
|
+
// if (process.env.iz_rbacTargetIdUser) {
|
|
61
|
+
// targetUserId = event.pathParameters[process.env.iz_rbacTargetIdUser]
|
|
62
|
+
// }
|
|
60
63
|
// invoke LambdaFunction
|
|
61
|
-
let lambdaFunctionResponse = await <%- functionName %>.<%- functionName %>
|
|
64
|
+
let lambdaFunctionResponse = await <%- functionName %>.<%- functionName %>(
|
|
62
65
|
event._izContext, // correlationId/logger/integrationTestDetail/uniqueRequestId/userId
|
|
63
66
|
event.body,
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
//(<additionalParams>)
|
|
68
|
+
//(</additionalParams>)
|
|
69
|
+
callingFlowSharedLib.addCallingFlowToPassOnProperties(event)
|
|
66
70
|
);
|
|
67
71
|
|
|
68
72
|
// return error to client
|
|
@@ -53,7 +53,7 @@ function data(_izContext, flowSchema, srcPath) {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
function createSourceParamsInvoke(_izContext, flowSchema, srcPath) {
|
|
56
|
-
let functionName = upperCase(flowSchema.flowTag)
|
|
56
|
+
let functionName = "Process" + upperCase(flowSchema.flowTag)
|
|
57
57
|
let handlerType = upperCase(HANDLER.hdrInv)
|
|
58
58
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
59
59
|
|
|
@@ -36,7 +36,7 @@ function data(_izContext, flowSchema, srcPath) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
function createSourceParamsInvoke(_izContext, flowSchema, srcPath) {
|
|
39
|
-
let functionName = upperCase(flowSchema.flowTag)
|
|
39
|
+
let functionName = "Process" + upperCase(flowSchema.flowTag)
|
|
40
40
|
let handlerType = upperCase(HANDLER.hdrInv)
|
|
41
41
|
|
|
42
42
|
return {
|
|
@@ -21,11 +21,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
21
21
|
// const sqs = new AWS.SQS({ apiVersion: '2012-11-05' });
|
|
22
22
|
|
|
23
23
|
const middleware = require("@izara_project/izara-middleware").middlewareHandler;
|
|
24
|
-
|
|
24
|
+
const callingFlowSharedLib = require("@izara_project/izara-core-library-calling-flow")
|
|
25
25
|
const <%- functionName %> = require('./<%- functionName %>_Main')
|
|
26
26
|
|
|
27
27
|
// validate event params in middleware before into function.
|
|
28
|
-
const validatorSchema = {
|
|
28
|
+
const validatorSchema = {
|
|
29
|
+
//(<validatorSchema>)
|
|
30
|
+
//(</validatorSchema>)
|
|
31
|
+
};
|
|
29
32
|
middleware.setValidatorSchema(validatorSchema)
|
|
30
33
|
|
|
31
34
|
module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
@@ -35,9 +38,12 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
35
38
|
try {
|
|
36
39
|
|
|
37
40
|
// invoke LambdaFunction
|
|
38
|
-
return await <%- functionName %>.<%- functionName %>
|
|
41
|
+
return await <%- functionName %>.<%- functionName %>(
|
|
39
42
|
event._izContext, // correlationId/logger/integrationTestDetail/uniqueRequestId
|
|
40
|
-
event
|
|
43
|
+
event,
|
|
44
|
+
//(<additionalParams>)
|
|
45
|
+
//(</additionalParams>)
|
|
46
|
+
callingFlowSharedLib.addCallingFlowToPassOnProperties(event)
|
|
41
47
|
);
|
|
42
48
|
|
|
43
49
|
} catch (err) {
|
|
@@ -96,7 +96,6 @@ function createSourceParams(_izContext, allLocalFlowSchemas, srcPath) {
|
|
|
96
96
|
for (const flowSchema of allLocalFlowSchemas.records) {
|
|
97
97
|
console.log("flowSchema", flowSchema)
|
|
98
98
|
if (flowSchema.event.includes("ownTopic") || flowSchema.event.includes("extTopic")) {
|
|
99
|
-
console.log("this is topic")
|
|
100
99
|
additionalResourcePermission.push(
|
|
101
100
|
createIamRole(
|
|
102
101
|
{
|
package/src/reStructure/TemplateData/relationshipPerAction/create/action/mainFunction/template.ejs
CHANGED
|
@@ -299,7 +299,15 @@ module.exports.createRelationship = async (
|
|
|
299
299
|
// awaitingStepId per graphServiceTag
|
|
300
300
|
awaitingStepIds.push(
|
|
301
301
|
asyncFlowSharedLib.createAwaitingStepId(
|
|
302
|
-
hash({
|
|
302
|
+
hash({
|
|
303
|
+
linkTypeId,
|
|
304
|
+
relationshipProperties,
|
|
305
|
+
graphServiceTag: targetStorageResource.graphServiceTag,
|
|
306
|
+
callingFlowProperties: callingFlowConfig.callingFlowProperties || {},
|
|
307
|
+
firstObject: firstObject,
|
|
308
|
+
secondObject: secondObject,
|
|
309
|
+
relType: relType,
|
|
310
|
+
}), // hash id
|
|
303
311
|
PREFIX.createRel // prefix, use constant further
|
|
304
312
|
)
|
|
305
313
|
);
|
package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/template.ejs
CHANGED
|
@@ -68,7 +68,11 @@ module.exports.createRelationshipComplete = async (
|
|
|
68
68
|
hash({
|
|
69
69
|
linkTypeId,
|
|
70
70
|
relationshipProperties: returnValue.requestParams.relationshipProperties,
|
|
71
|
-
graphServiceTag: graphServiceTag
|
|
71
|
+
graphServiceTag: graphServiceTag,
|
|
72
|
+
callingFlowProperties: passBackProperties.passBackProperties.parentPassBackProperties.callingFlowProperties || {},
|
|
73
|
+
firstObject: returnValue.requestParams.firstObject,
|
|
74
|
+
secondObject: returnValue.requestParams.secondObject,
|
|
75
|
+
relType: returnValue.requestParams.relType,
|
|
72
76
|
}), // hash id
|
|
73
77
|
PREFIX.createRel // prefix, use constant further
|
|
74
78
|
)
|