@izara_project/izara-core-generate-service-code 1.0.23 → 1.0.25
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/generateFlowSchema/GenerateCodeFlowSchema.js +10 -7
- package/src/generateCode/generateFlowSchema/event/eventBridgeComponent/functionYaml/template.ejs +3 -10
- package/src/generateCode/generateFlowSchema/event/eventBridgeComponent/handler/inv/data.js +2 -1
- package/src/generateCode/generateFlowSchema/event/eventBridgeComponent/handler/inv/template.ejs +8 -15
- package/src/generateCode/generateFlowSchema/event/extTopicComponent/index.js +1 -1
- package/src/generateCode/generateFlowSchema/event/extTopicComponent/process/functionYaml/data.js +2 -6
- package/src/generateCode/generateFlowSchema/event/extTopicComponent/process/functionYaml/template.ejs +4 -11
- package/src/generateCode/generateFlowSchema/event/extTopicComponent/process/handler/template.ejs +2 -2
- package/src/generateCode/generateFlowSchema/event/extTopicComponent/sns-out/data.js +2 -1
- package/src/generateCode/generateFlowSchema/event/lambdaSyncApiComponent/functionYaml/data.js +1 -5
- package/src/generateCode/generateFlowSchema/event/lambdaSyncApiComponent/functionYaml/template.ejs +12 -21
- package/src/generateCode/generateFlowSchema/event/lambdaSyncApiComponent/handler/template.ejs +1 -3
- package/src/generateCode/generateFlowSchema/event/lambdaSyncInvComponent/functionYaml/data.js +9 -7
- package/src/generateCode/generateFlowSchema/event/lambdaSyncInvComponent/functionYaml/template.ejs +3 -10
- package/src/generateCode/generateFlowSchema/event/lambdaSyncInvComponent/handler/template.ejs +1 -1
- package/src/generateCode/generateFlowSchema/event/ownTopicComponent/endpointComponent/functionYaml/data.js +1 -0
- package/src/generateCode/generateFlowSchema/event/ownTopicComponent/endpointComponent/handler/DsqHandlerTemplate.ejs +2 -2
- package/src/generateCode/generateFlowSchema/event/ownTopicComponent/endpointComponent/handler/SqsHandlerTemplate.ejs +2 -2
- package/src/generateCode/generateFlowSchema/event/ownTopicComponent/flowSchemaComponent/functionYaml/data.js +5 -8
- package/src/generateCode/generateFlowSchema/event/ownTopicComponent/sns-out/data.js +2 -1
- package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/data.js +12 -10
- package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/template.ejs +6 -9
- package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/templateByStatusType/statusFieldTemplate.ejs +30 -0
- package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/templateByStatusType/storedCacheTemplate.ejs +26 -0
- package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/templateByStatusType/triggerCacheTemplate.ejs +44 -0
- package/src/generateCode/generateFlowSchema/event/s3Component/index.js +17 -17
- package/src/generateCode/generateFlowSchema/event/s3Component/upload/confirmReserved/handler/data.js +1 -1
- package/src/generateCode/generateFlowSchema/event/s3Component/upload/relate/sns-out/data.js +3 -1
- package/src/generateCode/generateFlowSchema/event/s3Component/websocket/dynamoDb/ReservedTableData.js +1 -1
- package/src/generateCode/generateFlowSchema/flowSchemaMainFunction/template.ejs +4 -6
- package/src/generateCode/generateFlowSchema/statusType/statusFieldComponent/functionYaml/data.js +9 -9
- package/src/generateCode/generateFlowSchema/statusType/statusFieldComponent/handler/data.js +1 -5
- package/src/generateCode/generateFlowSchema/statusType/statusFieldComponent/index.js +6 -18
- package/src/generateCode/generateFlowSchema/statusType/statusFieldComponent/mainFunction/data.js +15 -14
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/checkTriggerCacheComplete/functionYaml/data.js +4 -8
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/checkTriggerCacheComplete/handler/data.js +15 -15
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/checkTriggerCacheComplete/mainFunction/data.js +15 -15
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/index.js +13 -33
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/processTriggerCache/functionYaml/data.js +4 -8
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/processTriggerCache/handler/data.js +12 -14
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/processTriggerCache/mainFunction/data.js +11 -14
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/functionYaml/dsq/data.js +4 -9
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/functionYaml/sqs/data.js +4 -9
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/handler/dsq/data.js +11 -14
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/handler/sqs/data.js +11 -14
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheComplete/mainFunction/data.js +15 -15
- package/src/generateCode/generateFlowSchema/statusType/triggerCacheComponent/triggerCacheQueue/data.js +2 -3
- package/src/generateCode/generateSchema/actionEndpointCompleteComponent/create/mainFunction/template.ejs +185 -103
- package/src/generateCode/generateSchema/actionEndpointCompleteComponent/create/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/actionEndpointCompleteComponent/delete/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/actionEndpointCompleteComponent/get/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/actionEndpointCompleteComponent/update/mainFunction/template.ejs +137 -71
- package/src/generateCode/generateSchema/actionEndpointCompleteComponent/update/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/actionEndpointComponent/mainFunction/beforeLogical/template.ejs +14 -6
- package/src/generateCode/generateSchema/actionEndpointComponent/mainFunction/create/main/template.ejs +21 -3
- package/src/generateCode/generateSchema/actionEndpointComponent/mainFunction/delete/main/template.ejs +24 -4
- package/src/generateCode/generateSchema/actionEndpointComponent/mainFunction/update/main/template.ejs +25 -4
- package/src/generateCode/generateSchema/actionEndpointComponent/yaml/data.js +6 -4
- package/src/generateCode/generateSchema/findDataComponent/mainFunction/data.js +1 -1
- package/src/generateCode/generateSchema/relationshipPerActionComponent/changeRelationship/complete/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/relationshipPerActionComponent/create/action/functionYaml/data.js +1 -0
- package/src/generateCode/generateSchema/relationshipPerActionComponent/create/complete/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/relationshipPerActionComponent/delete/action/functionYaml/data.js +1 -0
- package/src/generateCode/generateSchema/relationshipPerActionComponent/delete/complete/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/relationshipPerActionComponent/get/action/functionYaml/data.js +1 -0
- package/src/generateCode/generateSchema/relationshipPerActionComponent/get/complete/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/relationshipPerActionComponent/moveRelationship/complete/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/relationshipPerActionComponent/update/action/functionYaml/data.js +1 -0
- package/src/generateCode/generateSchema/relationshipPerActionComponent/update/action/sns-out/data.js +2 -1
- package/src/generateCode/generateSchema/relationshipPerActionComponent/update/complete/mainFunction/template.ejs +1 -1
- package/src/generateCode/generateSchema/relationshipPerActionComponent/update/complete/sns-out/data.js +2 -1
- package/src/generateCode/resourceYamlComponent/sns-out/data.js +2 -1
- package/src/generateCode/resourceYamlComponent/sns-out/defaultSnsOutForFindDataAndProcessLogical.js +2 -1
- package/src/generateCode/resourceYamlComponent/sns-out/template.ejs +2 -6
- package/src/generateCode.js +9 -7
- package/src/libs/Utils.js +26 -1
- package/src/__TemplateData/flowSchema/event/externalTopic/Process/handler/data.js +0 -64
- package/src/__TemplateData/flowSchema/event/externalTopic/sns-out/data.js +0 -75
package/package.json
CHANGED
|
@@ -86,16 +86,19 @@ async function generateTemplateDataFromFlowSchema(
|
|
|
86
86
|
// ── per-flowSchema resources ─────────────────────────────────────────
|
|
87
87
|
const perFlowParams = [
|
|
88
88
|
createWebSocketGenerateCodeLibs(_izContext, flowSchema, appPath),
|
|
89
|
-
!flowSchema.event.includes('s3')
|
|
90
|
-
? await createFlowSchemaEndpointMainFunction(
|
|
91
|
-
_izContext,
|
|
92
|
-
flowSchema,
|
|
93
|
-
appPath
|
|
94
|
-
)
|
|
95
|
-
: {},
|
|
96
89
|
...buildFlowStepResources(_izContext, flowSchema, appPath)
|
|
97
90
|
];
|
|
98
91
|
|
|
92
|
+
if (!flowSchema.event.includes('s3')) {
|
|
93
|
+
perFlowParams.push(
|
|
94
|
+
await createFlowSchemaEndpointMainFunction(
|
|
95
|
+
_izContext,
|
|
96
|
+
flowSchema,
|
|
97
|
+
appPath
|
|
98
|
+
)
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
99
102
|
// ── event handlers ───────────────────────────────────────────────────
|
|
100
103
|
const eventPromises = events
|
|
101
104
|
.filter(event => {
|
package/src/generateCode/generateFlowSchema/event/eventBridgeComponent/functionYaml/template.ejs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
<%-
|
|
3
|
-
|
|
4
|
-
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionNameConfig) %>
|
|
1
|
+
<%- functionNameConfig %>:
|
|
2
|
+
handler: <%- `${resourceLocation}${functionName}_${handlerType}.main` %>
|
|
3
|
+
name: ${self:custom.iz_resourcePrefix}<%- functionNameConfig %>
|
|
5
4
|
role: <%- roleName %>Role
|
|
6
5
|
#<#<%- functionName %>FunctionSetting#>
|
|
7
6
|
#<#/<%- functionName %>FunctionSetting#>
|
|
@@ -13,9 +12,3 @@
|
|
|
13
12
|
rate: <%- schedule.rate %>
|
|
14
13
|
input: <%- JSON.stringify(schedule.input) %>
|
|
15
14
|
<%_ }) _%>
|
|
16
|
-
<%_ function firstLetterUpperCase(text){
|
|
17
|
-
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
18
|
-
} _%>
|
|
19
|
-
<%_ function firstLetterLowerCase(str) {
|
|
20
|
-
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
21
|
-
} _%>
|
|
@@ -46,7 +46,8 @@ function data(_izContext, flowSchema, appPath) {
|
|
|
46
46
|
templatePath: templatePath,
|
|
47
47
|
templateData: {
|
|
48
48
|
functionName: functionName,
|
|
49
|
-
flowTag: flowTag,
|
|
49
|
+
flowTag: upperCase(flowTag),
|
|
50
|
+
// flowTag: ,
|
|
50
51
|
// action: action,
|
|
51
52
|
handler
|
|
52
53
|
// roleName: SOURCE_GENERATE_IAM_ROLE.EventBridge,
|
package/src/generateCode/generateFlowSchema/event/eventBridgeComponent/handler/inv/template.ejs
CHANGED
|
@@ -15,12 +15,10 @@ You should have received a copy of the GNU Affero General Public License
|
|
|
15
15
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
import { middlewareHandleras middlewar } from "@izara_project/izara-middleware";
|
|
18
|
+
import { middlewareHandler as middleware } from "@izara_project/izara-middleware";
|
|
21
19
|
import callingFlowSharedLib from '@izara_project/zara-core-library-calling-flow';
|
|
22
20
|
|
|
23
|
-
import <%- functionName %>Main from './<%-
|
|
21
|
+
import <%- functionName %>Main from './<%- functionName %>_Main.js'
|
|
24
22
|
|
|
25
23
|
//(<globalVariable>
|
|
26
24
|
//</globalVariable>)
|
|
@@ -40,21 +38,16 @@ export const main = middlewareHandler.wrap(async (event, context) => {
|
|
|
40
38
|
//(</beforeInvoke>)
|
|
41
39
|
|
|
42
40
|
// invoke LambdaFunction
|
|
43
|
-
return await
|
|
41
|
+
return await <%- functionName %> Main(
|
|
44
42
|
event._izContext, // correlationId/logger/integrationTestDetail/uniqueRequestId
|
|
45
43
|
event,
|
|
46
|
-
callingFlowSharedLib.addCallingFlowToPassOnProperties(event)
|
|
44
|
+
callingFlowSharedLib.addCallingFlowToPassOnProperties(event),
|
|
45
|
+
//(<additionalParams>)
|
|
46
|
+
//(</additionalParams>)
|
|
47
47
|
);
|
|
48
48
|
|
|
49
49
|
} catch (err) {
|
|
50
|
-
event._izContext.logger.error('Error, <%-
|
|
50
|
+
event._izContext.logger.error('Error, <%- flowTag %>: ', err);
|
|
51
51
|
throw (err);
|
|
52
52
|
}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
<% _ function firstLetterUpperCase(text) {
|
|
56
|
-
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
57
|
-
} _ %>
|
|
58
|
-
<% _ function firstLetterLowerCase(str) {
|
|
59
|
-
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
60
|
-
} _ %>
|
|
53
|
+
});
|
|
@@ -5,7 +5,7 @@ import createExternalTopicSnsOut from './sns-out/data.js';
|
|
|
5
5
|
|
|
6
6
|
async function createExternalTopicComponent(_izContext, flowSchema, appPath) {
|
|
7
7
|
const component = [
|
|
8
|
-
createExternalSqsFunctionYaml(_izContext, flowSchema, appPath),
|
|
8
|
+
await createExternalSqsFunctionYaml(_izContext, flowSchema, appPath),
|
|
9
9
|
createExternalSqsHandler(_izContext, flowSchema, appPath),
|
|
10
10
|
...createExternalTopicSnsInSqs(_izContext, flowSchema, appPath),
|
|
11
11
|
...createExternalTopicSnsOut(_izContext, flowSchema, appPath)
|
package/src/generateCode/generateFlowSchema/event/extTopicComponent/process/functionYaml/data.js
CHANGED
|
@@ -38,7 +38,7 @@ const {
|
|
|
38
38
|
LAMBDA_RESOURCE
|
|
39
39
|
} = consts;
|
|
40
40
|
|
|
41
|
-
const { firstLetterUpperCase: upperCase } = utils;
|
|
41
|
+
const { firstLetterUpperCase: upperCase, savePath } = utils;
|
|
42
42
|
|
|
43
43
|
const {
|
|
44
44
|
shortNameHandler,
|
|
@@ -132,11 +132,7 @@ async function createSourceParams(_izContext, flowSchema, appPath) {
|
|
|
132
132
|
return {
|
|
133
133
|
templatePath: templatePath,
|
|
134
134
|
templateData: {
|
|
135
|
-
resourceLocation:
|
|
136
|
-
SOURCE_PATH.resourceLocationFlowSchema,
|
|
137
|
-
upperCase(flowSchema.flowTag),
|
|
138
|
-
'source/'
|
|
139
|
-
),
|
|
135
|
+
resourceLocation: savePath.flowSchemaFlowTag(flowSchema.flowTag),
|
|
140
136
|
functionName,
|
|
141
137
|
handlerType,
|
|
142
138
|
additionalResourcePermission,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
<%-
|
|
3
|
-
|
|
4
|
-
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
1
|
+
<%- functionNameConfig %>:
|
|
2
|
+
handler: <%- `${resourceLocation}${functionName}_${handlerType}.main`%>
|
|
3
|
+
name: ${self:custom.iz_resourcePrefix}<%- functionName %><%- handlerType %>
|
|
5
4
|
role: <%- roleName %>Role
|
|
6
5
|
#<#<%- functionName %><%- handlerType %>FunctionSetting#>
|
|
7
6
|
#<#/<%- functionName %><%- handlerType %>FunctionSetting#>
|
|
@@ -11,10 +10,4 @@
|
|
|
11
10
|
batchSize: 10
|
|
12
11
|
filterPatterns: #**** need to update serverless framework upper v.2.69.1
|
|
13
12
|
- body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%- functionName %>"]}}} # functionName of callingFlow
|
|
14
|
-
- body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
|
|
15
|
-
<%_ function firstLetterUpperCase(text){
|
|
16
|
-
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
17
|
-
} _%>
|
|
18
|
-
<%_ function firstLetterLowerCase(str) {
|
|
19
|
-
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
20
|
-
} _%>
|
|
13
|
+
- body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
|
package/src/generateCode/generateFlowSchema/event/extTopicComponent/process/handler/template.ejs
CHANGED
|
@@ -65,10 +65,10 @@ export const main = middleware.wrap(async (event, context) => {
|
|
|
65
65
|
);
|
|
66
66
|
|
|
67
67
|
// add argument (to invoke lambda) to passOnProperties[]
|
|
68
|
-
passOnProperties.push(record.body.Message)
|
|
68
|
+
passOnProperties.push(record.body.Message);
|
|
69
|
+
passOnProperties.push(callingFlowSharedLib.addCallingFlowToPassOnProperties(record.body.Message));
|
|
69
70
|
//(<additionalParams>)
|
|
70
71
|
//(</additionalParams>)
|
|
71
|
-
passOnProperties.push(callingFlowSharedLib.addCallingFlowToPassOnProperties(record.body.Message));
|
|
72
72
|
record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
|
|
73
73
|
|
|
74
74
|
// call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
|
|
@@ -49,7 +49,8 @@ function createDataForDefaultSnsInSqs(_izContext, flowSchema, appPath) {
|
|
|
49
49
|
savePath: path.join(appPath, SOURCE_PATH.resourceYaml),
|
|
50
50
|
saveFileName: SAVE_FILE_NAME.snsOutYaml,
|
|
51
51
|
fileExtension: '.yml',
|
|
52
|
-
isAppend: true
|
|
52
|
+
isAppend: true,
|
|
53
|
+
fromFile: 'external/sns-out/data.js'
|
|
53
54
|
};
|
|
54
55
|
|
|
55
56
|
let topicOut = `${upperCase(flowSchema.flowTag)}`;
|
package/src/generateCode/generateFlowSchema/event/lambdaSyncApiComponent/functionYaml/data.js
CHANGED
|
@@ -54,11 +54,7 @@ function createSourceParamsApi(_izContext, flowSchema, appPath) {
|
|
|
54
54
|
return {
|
|
55
55
|
templatePath: templatePath,
|
|
56
56
|
templateData: {
|
|
57
|
-
|
|
58
|
-
SOURCE_PATH.resourceLocationFlowSchema,
|
|
59
|
-
upperCase(flowSchema.flowTag),
|
|
60
|
-
'source/'
|
|
61
|
-
),
|
|
57
|
+
resourceYamlFlowSchemaFlowTag,
|
|
62
58
|
functionName,
|
|
63
59
|
handlerType,
|
|
64
60
|
additionalResourcePermission,
|
package/src/generateCode/generateFlowSchema/event/lambdaSyncApiComponent/functionYaml/template.ejs
CHANGED
|
@@ -1,28 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
<%-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
#<#/<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>FunctionSetting#>
|
|
1
|
+
<%- functionNameConfig %>:
|
|
2
|
+
handler: <%- `${resourceLocation}${functionName}_${handlerType}.main` %>
|
|
3
|
+
name: ${self:custom.iz_resourcePrefix}<%- functionName %><%- handlerType %>
|
|
4
|
+
role: <%- roleName %>Role
|
|
5
|
+
#<#<%- functionName %><%- handlerType %>FunctionSetting#>
|
|
6
|
+
#<#/<%- functionName %><%- handlerType %>FunctionSetting#>
|
|
8
7
|
events:
|
|
9
8
|
- httpApi:
|
|
10
|
-
path: /<%- serviceTag %>/<%-
|
|
9
|
+
path: /<%- serviceTag %>/<%- functionName %>/<%- functionName %>
|
|
11
10
|
method: <%- event %>
|
|
12
11
|
authorizer: authorizerServiceSchema
|
|
13
|
-
#<#<%-
|
|
14
|
-
#<#/<%-
|
|
12
|
+
#<#<%- functionName %><%- handlerType %>AppLevelAuthorizer#>
|
|
13
|
+
#<#/<%- functionName %><%- handlerType %>AppLevelAuthorizer#>
|
|
15
14
|
- httpApi:
|
|
16
|
-
path: /<%- serviceTag %>/<%-
|
|
15
|
+
path: /<%- serviceTag %>/<%- functionName %>/<%- functionName %>/{targetUserId}
|
|
17
16
|
method: <%- event %>
|
|
18
17
|
authorizer: authorizerServiceSchema
|
|
19
|
-
#<#<%-
|
|
20
|
-
#<#/<%-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
<%_ function firstLetterUpperCase(text){
|
|
24
|
-
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
25
|
-
} _%>
|
|
26
|
-
<%_ function firstLetterLowerCase(str) {
|
|
27
|
-
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
28
|
-
} _%>
|
|
18
|
+
#<#<%- functionName %><%- handlerType %>UserLevelAuthorizer#>
|
|
19
|
+
#<#/<%- functionName %><%- handlerType %>UserLevelAuthorizer#>
|
package/src/generateCode/generateFlowSchema/event/lambdaSyncApiComponent/handler/template.ejs
CHANGED
|
@@ -15,8 +15,6 @@ You should have received a copy of the GNU Affero General Public License
|
|
|
15
15
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
18
|
const RBAC_TARGET_ID = process.env.iz_rbacTargetIdUser // iz_rbacTargetIdUser | iz_rbacDeliveryMethodId
|
|
21
19
|
|
|
22
20
|
import { middlewareHandler as middleware } from "@izara_project/izara-middleware";
|
|
@@ -66,9 +64,9 @@ export const main = middleware.wrap(async (event, context, callback) => {
|
|
|
66
64
|
let lambdaFunctionResponse = await <%- functionName %>.<%- functionName %>(
|
|
67
65
|
event._izContext, // correlationId/logger/integrationTestDetail/uniqueRequestId/userId
|
|
68
66
|
event.body,
|
|
67
|
+
callingFlowSharedLib.addCallingFlowToPassOnProperties(event)
|
|
69
68
|
//(<additionalParams>)
|
|
70
69
|
//(</additionalParams>)
|
|
71
|
-
callingFlowSharedLib.addCallingFlowToPassOnProperties(event)
|
|
72
70
|
);
|
|
73
71
|
|
|
74
72
|
// return error to client
|
package/src/generateCode/generateFlowSchema/event/lambdaSyncInvComponent/functionYaml/data.js
CHANGED
|
@@ -28,7 +28,7 @@ const { HANDLER, SOURCE_PATH, SAVE_FILE_NAME } = consts;
|
|
|
28
28
|
|
|
29
29
|
const { shortNameHandler, defaultIamRolePerAction } = libs;
|
|
30
30
|
|
|
31
|
-
const { firstLetterUpperCase: upperCase } = utils;
|
|
31
|
+
const { firstLetterUpperCase: upperCase, savePath } = utils;
|
|
32
32
|
|
|
33
33
|
const templatePath = path.join(__dirname, 'template.ejs');
|
|
34
34
|
/**
|
|
@@ -46,12 +46,14 @@ function createSourceParamsInvoke(_izContext, flowSchema, appPath) {
|
|
|
46
46
|
return {
|
|
47
47
|
templatePath: templatePath,
|
|
48
48
|
templateData: {
|
|
49
|
-
resourceLocation:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
resourceLocation:
|
|
50
|
+
// path.join(
|
|
51
|
+
// SOURCE_PATH.resourceLocationFlowSchema,
|
|
52
|
+
// upperCase(flowSchema.flowTag),
|
|
53
|
+
// 'MainHandler/',
|
|
54
|
+
// 'source/'
|
|
55
|
+
// ),
|
|
56
|
+
savePath.flowSchemaFlowTag(flowSchema.flowTag),
|
|
55
57
|
handlerType,
|
|
56
58
|
additionalResourcePermission,
|
|
57
59
|
functionNameConfig:
|
package/src/generateCode/generateFlowSchema/event/lambdaSyncInvComponent/functionYaml/template.ejs
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
<%-
|
|
3
|
-
|
|
4
|
-
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
1
|
+
<%- functionNameConfig %>:
|
|
2
|
+
handler: <%- `${resourceLocation}${functionName}_${handlerType}.main` %>
|
|
3
|
+
name: ${self:custom.iz_resourcePrefix}<%- functionName %><%- handlerType %>
|
|
5
4
|
role: <%- roleName %>Role
|
|
6
5
|
#<#<%- functionName %><%- handlerType %>FunctionSetting#>
|
|
7
6
|
#<#/<%- functionName %><%- handlerType %>FunctionSetting#>
|
|
8
|
-
<%_ function firstLetterUpperCase(text){
|
|
9
|
-
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
10
|
-
} _%>
|
|
11
|
-
<%_ function firstLetterLowerCase(str) {
|
|
12
|
-
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
13
|
-
} _%>
|
package/src/generateCode/generateFlowSchema/event/lambdaSyncInvComponent/handler/template.ejs
CHANGED
|
@@ -40,9 +40,9 @@ export const main = middleware.wrap(async (event, context, callback) => {
|
|
|
40
40
|
return await <%- functionName %>.<%- functionName %>(
|
|
41
41
|
event._izContext, // correlationId/logger/integrationTestDetail/uniqueRequestId
|
|
42
42
|
event,
|
|
43
|
+
callingFlowSharedLib.addCallingFlowToPassOnProperties(event)
|
|
43
44
|
//(<additionalParams>)
|
|
44
45
|
//(</additionalParams>)
|
|
45
|
-
callingFlowSharedLib.addCallingFlowToPassOnProperties(event)
|
|
46
46
|
);
|
|
47
47
|
|
|
48
48
|
} catch (err) {
|
|
@@ -69,10 +69,10 @@ export const main = middleware.wrap(async (event, context) => {
|
|
|
69
69
|
);
|
|
70
70
|
|
|
71
71
|
// add argument (to invoke lambda) to passOnProperties[]
|
|
72
|
-
passOnProperties.push(record.body.Message)
|
|
72
|
+
passOnProperties.push(record.body.Message);
|
|
73
|
+
passOnProperties.push(callingFlowSharedLib.addCallingFlowToPassOnProperties(record.body.Message));
|
|
73
74
|
//(<additionalParams>)
|
|
74
75
|
//(</additionalParams>)
|
|
75
|
-
passOnProperties.push(callingFlowSharedLib.addCallingFlowToPassOnProperties(record.body.Message));
|
|
76
76
|
record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
|
|
77
77
|
|
|
78
78
|
// call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
|
|
@@ -51,10 +51,10 @@ export const main = middleware.wrap(async (event, context) => {
|
|
|
51
51
|
);
|
|
52
52
|
|
|
53
53
|
// add argument (to invoke lambda) to passOnProperties[]
|
|
54
|
-
passOnProperties.push(record.body.Message)
|
|
54
|
+
passOnProperties.push(record.body.Message);
|
|
55
|
+
passOnProperties.push(callingFlowSharedLib.addCallingFlowToPassOnProperties(record.body.Message));
|
|
55
56
|
//(<additionalParams>)
|
|
56
57
|
//(</additionalParams>)
|
|
57
|
-
passOnProperties.push(callingFlowSharedLib.addCallingFlowToPassOnProperties(record.body.Message));
|
|
58
58
|
record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
|
|
59
59
|
|
|
60
60
|
// call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
|
|
@@ -39,7 +39,7 @@ const {
|
|
|
39
39
|
createIamRole
|
|
40
40
|
} = libs;
|
|
41
41
|
|
|
42
|
-
const { firstLetterUpperCase: upperCase } = utils;
|
|
42
|
+
const { firstLetterUpperCase: upperCase, savePath } = utils;
|
|
43
43
|
|
|
44
44
|
const templatePath = path.join(__dirname, 'template.ejs');
|
|
45
45
|
|
|
@@ -103,13 +103,10 @@ function createSourceParams(_izContext, flowSchema, appPath) {
|
|
|
103
103
|
return {
|
|
104
104
|
templatePath: templatePath,
|
|
105
105
|
templateData: {
|
|
106
|
-
resourceLocation:
|
|
107
|
-
|
|
108
|
-
upperCase(flowSchema.flowTag)
|
|
109
|
-
'
|
|
110
|
-
upperCase(flowSchema.flowTag),
|
|
111
|
-
upperCase('hdrWbs')
|
|
112
|
-
),
|
|
106
|
+
resourceLocation:
|
|
107
|
+
savePath.flowSchemaFlowTag(flowSchema.flowTag) +
|
|
108
|
+
upperCase(flowSchema.flowTag) +
|
|
109
|
+
upperCase('hdrWbs'),
|
|
113
110
|
functionName: upperCase(flowSchema.flowTag),
|
|
114
111
|
handlerType: upperCase('hdrWbs'),
|
|
115
112
|
additionalResourcePermission,
|
|
@@ -64,7 +64,8 @@ function createDataForSnsOut(_izContext, flowSchema, appPath) {
|
|
|
64
64
|
savePath: path.join(appPath, SOURCE_PATH.resourceYaml),
|
|
65
65
|
saveFileName: SAVE_FILE_NAME.snsOutYaml,
|
|
66
66
|
fileExtension: '.yml',
|
|
67
|
-
isAppend: true
|
|
67
|
+
isAppend: true,
|
|
68
|
+
fromFile: 'ownTopic/sns-out/data.js'
|
|
68
69
|
}
|
|
69
70
|
});
|
|
70
71
|
}
|
package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/data.js
CHANGED
|
@@ -30,20 +30,20 @@ const { createFlowTypeConcat } = coreUtils;
|
|
|
30
30
|
import consts from '#libs/Consts.js';
|
|
31
31
|
import utils from '#libs/Utils.js';
|
|
32
32
|
const { SOURCE_PATH, STORAGE_TYPES } = consts;
|
|
33
|
-
const { firstLetterUpperCase: upperCase, getLocalConfig } = utils;
|
|
33
|
+
const { firstLetterUpperCase: upperCase, getLocalConfig, savePath } = utils;
|
|
34
34
|
|
|
35
35
|
const templatePath = path.join(__dirname, 'template.ejs');
|
|
36
36
|
const statusFieldTemplate = path.join(
|
|
37
37
|
__dirname,
|
|
38
|
-
'
|
|
38
|
+
'./templateByStatusType/statusFieldTemplate.ejs'
|
|
39
39
|
);
|
|
40
40
|
const storedCacheTemplate = path.join(
|
|
41
41
|
__dirname,
|
|
42
|
-
'
|
|
42
|
+
'./templateByStatusType/storedCacheTemplate.ejs'
|
|
43
43
|
);
|
|
44
44
|
const triggerCacheTemplate = path.join(
|
|
45
45
|
__dirname,
|
|
46
|
-
'
|
|
46
|
+
'./templateByStatusType/triggerCacheTemplate.ejs'
|
|
47
47
|
);
|
|
48
48
|
|
|
49
49
|
/**
|
|
@@ -102,12 +102,14 @@ async function createParamsForCreateSource(_izContext, flowSchema, appPath) {
|
|
|
102
102
|
queueName: `${createFlowTypeConcat(_izContext, { serviceTag: getLocalConfig('iz_serviceTag'), flowTag: upperCase(flowSchema.flowTag) })}_Main`
|
|
103
103
|
},
|
|
104
104
|
setting: {
|
|
105
|
-
savePath:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
105
|
+
savePath:
|
|
106
|
+
// path.join(
|
|
107
|
+
// appPath,
|
|
108
|
+
// SOURCE_PATH.flowSchema,
|
|
109
|
+
// upperCase(flowSchema.flowTag),
|
|
110
|
+
// 'source/'
|
|
111
|
+
// ),
|
|
112
|
+
savePath.resourceYamlFlowSchemaFlowTag(appPath, flowSchema.flowTag),
|
|
111
113
|
saveFileName: `${functionName}_Main`,
|
|
112
114
|
fileExtension: '.js',
|
|
113
115
|
isAppend: false
|
package/src/generateCode/generateFlowSchema/event/s3Component/flowSchemaMainFunction/template.ejs
CHANGED
|
@@ -16,8 +16,6 @@ along with this program. If not, see
|
|
|
16
16
|
<http: //www.gnu.org/licenses />.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
19
|
import { getObjectSchema } from '@izara_project/izara-core-library-service-schemas';
|
|
22
20
|
import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
|
|
23
21
|
import snsSharedLib from '@izara_project/izara-core-library-sns';
|
|
@@ -27,7 +25,7 @@ import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow
|
|
|
27
25
|
import lambdaSharedLib from '@izara_project/izara-core-library-lambda';
|
|
28
26
|
import { lambda,sns,sqs } from '@izara_project/izara-core-library-external-request';
|
|
29
27
|
import { NoRetryError } from '@izara_project/izara-core-library-core';
|
|
30
|
-
import { utils} from '@izara_project/izara-core-library-service-schemas';
|
|
28
|
+
import { utils } from '@izara_project/izara-core-library-service-schemas';
|
|
31
29
|
const { createFlowTypeConcat } = utils;
|
|
32
30
|
<% if (statusType === "triggerCache") { -%>
|
|
33
31
|
import { triggeredCacheSharedLibV2 } from '@izara_project/izara-core-library-trigger-cache';
|
|
@@ -57,9 +55,9 @@ import storedCacheSharedLib from '@izara_project/izara-core-library-stored-cache
|
|
|
57
55
|
export default async function <%- functionName %> (
|
|
58
56
|
_izContext,
|
|
59
57
|
requestParams,
|
|
58
|
+
callingFlowConfig = {},
|
|
60
59
|
//(<additionalParams>)
|
|
61
60
|
//(</additionalParams>)
|
|
62
|
-
callingFlowConfig = {},
|
|
63
61
|
) {
|
|
64
62
|
|
|
65
63
|
try {
|
|
@@ -68,18 +66,17 @@ export default async function <%- functionName %> (
|
|
|
68
66
|
_izContext.logger.debug("<%- functionName %> callingFlowConfig", callingFlowConfig)
|
|
69
67
|
|
|
70
68
|
<% if (statusType === "statusField") { %>
|
|
71
|
-
|
|
69
|
+
<% include(statusFieldTemplate, { tableName:tableName, flowTag: flowTag }) %>
|
|
72
70
|
<% } else if (statusType === "storedCache") { %>
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
<% include(storedCacheTemplate, { tableName:tableName, flowSchemaComplete:flowSchemaComplete, flowTag }) %>
|
|
75
72
|
<% } else if (statusType === "triggerCache") { %>
|
|
76
|
-
|
|
73
|
+
<% include(triggerCacheTemplate, {
|
|
77
74
|
tableName: tableName,
|
|
78
75
|
flowSchemaComplete: flowSchemaComplete,
|
|
79
76
|
triggerType: triggerType,
|
|
80
77
|
flowTag,
|
|
81
78
|
queueName
|
|
82
|
-
|
|
79
|
+
}) %>
|
|
83
80
|
<% } %>
|
|
84
81
|
|
|
85
82
|
//(<endpointHook>)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//(<beforeCheckedStatusField>)
|
|
2
|
+
//(</beforeCheckedStatusField>)
|
|
3
|
+
|
|
4
|
+
let [status, flowStatusFieldRecord] = await statusFieldSharedLib.checkStatusField(
|
|
5
|
+
_izContext,
|
|
6
|
+
{
|
|
7
|
+
flowTag: "<%- flowTag %>",
|
|
8
|
+
serviceTag: process.env.iz_serviceTag
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
//(<identifiers>)
|
|
12
|
+
//(</identifiers>)
|
|
13
|
+
},
|
|
14
|
+
//(<errorsFounds>)
|
|
15
|
+
//(<errorsFounds>)
|
|
16
|
+
//(<overwriteUniqueRequestId>)
|
|
17
|
+
//(</overwriteUniqueRequestId>)
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
//(<afterCheckStatusField>)
|
|
21
|
+
//(</afterCheckStatusField>)
|
|
22
|
+
|
|
23
|
+
if (status !== "process") {
|
|
24
|
+
if (status === "error" || status === "complete") {
|
|
25
|
+
//(<afterValidateStatusField>)
|
|
26
|
+
//(</afterValidateStatusField>)
|
|
27
|
+
}
|
|
28
|
+
//(<checkStatusFieldHook>)
|
|
29
|
+
//(</checkStatusFieldHook>)
|
|
30
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
let [ cacheMainStatus, cacheMain, cacheExist ] = await storedCacheSharedLib.checkStoredCacheStatus(
|
|
2
|
+
_izContext,
|
|
3
|
+
"<%- tableName %>",
|
|
4
|
+
{
|
|
5
|
+
//(<keyValueStoredCacheTable>)
|
|
6
|
+
//(</keyValueStoredCacheTable>)
|
|
7
|
+
},
|
|
8
|
+
//(<additionalAttributesWhenCreateStoredCache>)
|
|
9
|
+
//(</additionalAttributesWhenCreateStoredCache>),
|
|
10
|
+
createFlowTypeConcat(_izContext,{flowTag: "<%- flowTag %>", serviceTag: process.env.iz_serviceTag}),
|
|
11
|
+
//(<storedCacheConfig>)
|
|
12
|
+
//(</storedCacheConfig>)
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
//(<afterCheckStoredCache>)
|
|
16
|
+
//(</afterCheckStoredCache>)
|
|
17
|
+
|
|
18
|
+
if (cacheMainStatus !== "process") {
|
|
19
|
+
if (cacheMainStatus === "error" || cacheMainStatus === "complete") {
|
|
20
|
+
//(<afterValidateStoredCacheStatus>)
|
|
21
|
+
//(</afterValidateStoredCacheStatus>)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
//(<checkStoredCacheHook>)
|
|
25
|
+
//(</checkStoredCacheHook>)
|
|
26
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
let [triggerCacheStatus, triggerCache] = await triggeredCacheSharedLibV2.checkTriggeredCacheV2(
|
|
2
|
+
_izContext,
|
|
3
|
+
{
|
|
4
|
+
serviceTag: process.env.iz_serviceTag,
|
|
5
|
+
flowTag: "<%- flowTag %>"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
//(<identifiersTriggerCacheTable>)
|
|
9
|
+
//(</identifiersTriggerCacheTable>)
|
|
10
|
+
},
|
|
11
|
+
//(<additionalCheckTriggerCacheSetting>)
|
|
12
|
+
"", // overWriteUniqueRequestId
|
|
13
|
+
{}, //flowParams
|
|
14
|
+
false, // createIfNotHave
|
|
15
|
+
{} // triggerFlowIdentifiers
|
|
16
|
+
//(</additionalCheckTriggerCacheSetting>)
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
//(<afterCheckTriggerCache>)
|
|
20
|
+
//(</afterCheckTriggerCache>)
|
|
21
|
+
|
|
22
|
+
if (triggerCacheStatus !== "process") {
|
|
23
|
+
if (triggerCacheStatus === "error" || triggerCacheStatus === "complete") {
|
|
24
|
+
//(<afterValidateTriggerCacheStatus>)
|
|
25
|
+
//(</afterValidateTriggerCacheStatus>)
|
|
26
|
+
}
|
|
27
|
+
//(<checkTriggerCacheHook>)
|
|
28
|
+
//(</checkTriggerCacheHook>)
|
|
29
|
+
|
|
30
|
+
// send message to ProcessTriggerCache
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//(<processTriggerCacheHook>)
|
|
34
|
+
//(</processTriggerCacheHook>)
|
|
35
|
+
let sendMessageToProcessTriggerCache = {
|
|
36
|
+
MessageBody: JSON.stringify(
|
|
37
|
+
//(<messageBody>)
|
|
38
|
+
//(</messageBody>)
|
|
39
|
+
),
|
|
40
|
+
QueueUrl: await sqsSharedLib.sqsQueueUrl(_izContext, "<%- queueName %>")
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
await sqs.sendMessage(_izContext, sendMessageToProcessTriggerCache)
|
|
44
|
+
_izContext.logger.debug("after send message to <%- queueName %>", sendMessageToProcessTriggerCache)
|