@izara_project/izara-market-library-service-schemas 1.0.30 → 1.0.32
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 +9 -9
- package/src/GenerateCodeLibs/src/Consts.js +29 -13
- package/src/MainLibs/src/Consts.js +16 -6
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +3 -6
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +2 -3
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +2 -2
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +3 -3
- package/src/reStructure/TemplateData/EndpointPerService/yaml/data.js +10 -8
- package/src/reStructure/TemplateData/externalService/lambdaRole/data.js +5 -5
- package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/data.js +22 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/functionYaml/data.js +4 -4
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/handler/data.js +4 -4
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/functionYaml/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/functionYaml/data.js +4 -4
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/handler/data.js +4 -4
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/mainFunction/data.js +4 -4
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/functionYaml/data.js +4 -4
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/handler/data.js +4 -4
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/template.ejs +1 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/functionYaml/data.js +4 -4
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/handler/data.js +4 -4
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/data.js +4 -4
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/sqs/template.ejs +18 -18
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/functionYml/HdrS3/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/handler/handlerS3/data.js +4 -4
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/mainFunction/data.js +4 -4
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/libs/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/functionYaml/data.js +3 -3
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/functionYaml/template.ejs +2 -0
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/data.js +3 -2
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/template.ejs +4 -16
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/data.js +73 -0
- package/src/reStructure/TemplateData/flowSchema/{legacy/hookCode-old/queue/sqsTemplate.ejs → externalTopic/sns-in-sqs/template.ejs} +21 -11
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/data.js +75 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/template.ejs +10 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/functionYaml/data.js +83 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/functionYaml/template.ejs +17 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/handler/data.js +65 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/handler/template copy.ejs +125 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/handler/template.ejs +130 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/mainFunction/data.js +61 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/mainFunction/template.ejs +70 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/data.js +147 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/template.ejs +18 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/data.js +64 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/template.ejs +86 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/data.js +60 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/template.ejs +74 -0
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/data.js +107 -0
- package/src/reStructure/TemplateData/flowSchema/{components/schema/inProcess → flowSchemaOwnTopic/EndpointComponent}/functionYaml/template.ejs +1 -14
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/data.js +57 -0
- package/src/reStructure/TemplateData/flowSchema/{legacy/hookCode-old/handler/templateAsyncHandler.ejs → flowSchemaOwnTopic/EndpointComponent/handler/template.ejs} +11 -37
- package/src/reStructure/TemplateData/flowSchema/{components/schema/inProcess → flowSchemaOwnTopic/EndpointComponent}/mainFunction/data.js +20 -13
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/template.ejs +73 -0
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/functionYaml/data.js +117 -0
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/functionYaml/template.ejs +24 -0
- package/src/reStructure/TemplateData/flowSchema/{legacy/hookCode-old/mainFunction → flowSchemaOwnTopic/FlowSchemaCompleteComponent/handler}/data.js +15 -24
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/handler/template.ejs +84 -0
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/mainFunction/data.js +52 -0
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/mainFunction/template.ejs +88 -0
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/functionYaml/data.js +117 -0
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/functionYaml/template.ejs +24 -0
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/handler/data.js +57 -0
- package/src/reStructure/TemplateData/flowSchema/{components/schema/inProcess → flowSchemaOwnTopic/FlowSchemaComponent}/handler/template.ejs +16 -33
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/data.js +66 -0
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/template.ejs +104 -0
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-in/data.js +96 -0
- package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +167 -99
- package/src/reStructure/TemplateData/generateRole/createSharedResource.js +20 -0
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/mainFunction/template.ejs +3 -3
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/mainFunction/template.ejs +3 -3
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/mainFunction/template.ejs +13 -14
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/mainFunction/template.ejs +3 -3
- package/src/reStructure/TemplateData/flowSchema/components/schema/inProcess/functionYaml/data.js +0 -76
- package/src/reStructure/TemplateData/flowSchema/components/schema/inProcess/handler/data.js +0 -46
- package/src/reStructure/TemplateData/flowSchema/components/schema/inProcess/sns-sqs/data.js +0 -35
- package/src/reStructure/TemplateData/flowSchema/components/schema/inProcess/sns-sqs/template.ejs +0 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/functionYaml/data.js +0 -34
- package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/functionYaml/template.ejs +0 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/handler/data.js +0 -34
- package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/handler/template.ejs +0 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/mainFunction/data.js +0 -34
- package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/mainFunction/template.ejs +0 -0
- package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/sns-sqs/data.js +0 -34
- package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/sns-sqs/template.ejs +0 -0
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/functionYaml/data.js +0 -101
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/functionYaml/template.ejs +0 -43
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/handler/data.js +0 -93
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/handler/templateSyncHandler.ejs +0 -49
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/hookLogic/data.js +0 -64
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/mainFunction/template.ejs +0 -30
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/queue/data.js +0 -124
- package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/queue/snsTemplate.ejs +0 -59
- /package/src/reStructure/TemplateData/flowSchema/{components/schema/inProcess/mainFunction → flowSchemaOwnTopic/sns-in}/template.ejs +0 -0
|
@@ -32,11 +32,10 @@ const client = new S3Client({ region: 'us-east-2' });
|
|
|
32
32
|
const { createPresignedPost } = require('@aws-sdk/s3-presigned-post');
|
|
33
33
|
const consts = require('@izara_project/izara-middleware/src/MiddlewareCore/Consts')
|
|
34
34
|
|
|
35
|
-
const { postToConnection } = require("../../libs/source/
|
|
35
|
+
const { postToConnection,getNestObject } = require("../../libs/source/GenerateCodeLibs");
|
|
36
36
|
const hash = require('object-hash');
|
|
37
37
|
const utils = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Utils');
|
|
38
38
|
const coreConsts = require('@izara_project/izara-core-library-core/src/Consts');
|
|
39
|
-
const { getNestObject } = require("../../libs/source/ImportDataLib");
|
|
40
39
|
const { EXTERNAL_SERVICE_NAME } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts');
|
|
41
40
|
/**
|
|
42
41
|
* description of function.
|
|
@@ -51,11 +51,11 @@ const {
|
|
|
51
51
|
* @return {{ templatePath, templateData, setting } }
|
|
52
52
|
*/
|
|
53
53
|
|
|
54
|
-
function data(_izContext, srcPath) {
|
|
55
|
-
return [createSourceParams(_izContext, srcPath)]
|
|
54
|
+
function data(_izContext, flowSchema, srcPath) {
|
|
55
|
+
return [createSourceParams(_izContext, flowSchema, srcPath)]
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
function createSourceParams(_izContext, srcPath) {
|
|
58
|
+
function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
59
59
|
let functionName = upperCase(FUNCTION_NAME.reservedLimit);
|
|
60
60
|
let handlerType = upperCase(HANDLER.hdrSqs);
|
|
61
61
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
@@ -88,7 +88,7 @@ function createSourceParams(_izContext, srcPath) {
|
|
|
88
88
|
functionName,
|
|
89
89
|
handlerType,
|
|
90
90
|
functionNameConfig: functionName + upperCase(handlerType),
|
|
91
|
-
resourceLocation: SOURCE_PATH.resourceLocationWebSocket,
|
|
91
|
+
resourceLocation: path.join(SOURCE_PATH.resourceLocationWebSocket, flowSchema.flowTag, "/source/"),
|
|
92
92
|
additionalResourcePermission,
|
|
93
93
|
functionNameConfig: upperCase(functionName) + upperCase(shortNameHandler(handlerType)),
|
|
94
94
|
roleName: SOURCE_GENERATE_IAM_ROLE.FlowSchemaUploadS3Role
|
|
@@ -31,11 +31,11 @@ const { HANDLER, SOURCE_PATH, FUNCTION_NAME } = require('../../../../../../../..
|
|
|
31
31
|
* @return {{ templatePath, templateData, setting } }
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
|
-
function data(_izContext, srcPath) {
|
|
35
|
-
return [createSourceParams(_izContext, srcPath)]
|
|
34
|
+
function data(_izContext, flowSchema, srcPath) {
|
|
35
|
+
return [createSourceParams(_izContext, flowSchema, srcPath)]
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
function createSourceParams(_izContext, srcPath) {
|
|
38
|
+
function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
39
39
|
let functionName = upperCase(FUNCTION_NAME.reservedLimit);
|
|
40
40
|
let handlerType = upperCase(HANDLER.hdrSqs);
|
|
41
41
|
|
|
@@ -47,7 +47,7 @@ function createSourceParams(_izContext, srcPath) {
|
|
|
47
47
|
},
|
|
48
48
|
setting: {
|
|
49
49
|
saveFileName: `${functionName}_${handlerType}`,
|
|
50
|
-
savePath: path.join(srcPath, SOURCE_PATH.webSocket),
|
|
50
|
+
savePath: path.join(srcPath, SOURCE_PATH.webSocket, flowSchema.flowTag, "source/"),
|
|
51
51
|
fileExtension: ".js",
|
|
52
52
|
isAppend: true
|
|
53
53
|
}
|
|
@@ -30,18 +30,18 @@ const { SOURCE_PATH, FUNCTION_NAME } = require('../../../../../../../../MainLibs
|
|
|
30
30
|
* @return {{ templatePath, templateData, setting } }
|
|
31
31
|
*/
|
|
32
32
|
|
|
33
|
-
function data(_izContext, srcPath) {
|
|
34
|
-
return [createSourceParams(_izContext, srcPath)]
|
|
33
|
+
function data(_izContext, flowSchema, srcPath) {
|
|
34
|
+
return [createSourceParams(_izContext, flowSchema, srcPath)]
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
function createSourceParams(_izContext, srcPath) {
|
|
37
|
+
function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
38
38
|
let functionName = upperCase(FUNCTION_NAME.reservedLimit)
|
|
39
39
|
return {
|
|
40
40
|
templatePath: templatePath,
|
|
41
41
|
templateData: {},
|
|
42
42
|
setting: {
|
|
43
43
|
saveFileName: `${functionName}_Main`,
|
|
44
|
-
savePath: path.join(srcPath, SOURCE_PATH.webSocket),
|
|
44
|
+
savePath: path.join(srcPath, SOURCE_PATH.webSocket, flowSchema.flowTag, "source/"),
|
|
45
45
|
fileExtension: ".js",
|
|
46
46
|
isAppend: false
|
|
47
47
|
}
|
|
@@ -27,7 +27,7 @@ const lambda = externalRequest.lambda
|
|
|
27
27
|
const consts = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
28
28
|
const coreConsts = require('@izara_project/izara-middleware/src/MiddlewareCore/Consts')
|
|
29
29
|
const hash = require('object-hash');
|
|
30
|
-
const importDataLibs = require('../../libs/source/
|
|
30
|
+
const importDataLibs = require('../../libs/source/GenerateCodeLibs')
|
|
31
31
|
/**
|
|
32
32
|
* description of function.
|
|
33
33
|
* @param {Object} _izContext
|
|
@@ -1,31 +1,30 @@
|
|
|
1
1
|
##===== SNS Subscription
|
|
2
|
-
|
|
3
|
-
Subscription<%- queueName %>:
|
|
2
|
+
SubscriptionOut<%- queueNameSubscription %>:
|
|
4
3
|
Type: AWS::SNS::Subscription
|
|
5
4
|
Properties:
|
|
6
|
-
TopicArn: !Ref <%-
|
|
7
|
-
Endpoint: "arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%-
|
|
5
|
+
TopicArn: !Ref Out<%- queueNameSubscription %>
|
|
6
|
+
Endpoint: "arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- queueNameSubscription %>Out"
|
|
8
7
|
Protocol: "sqs"
|
|
9
8
|
##===== [Queue]
|
|
10
|
-
<%- queueName
|
|
9
|
+
<%- queueName %>:
|
|
11
10
|
Type: "AWS::SQS::Queue"
|
|
12
11
|
Properties:
|
|
13
|
-
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>
|
|
12
|
+
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>
|
|
14
13
|
RedrivePolicy:
|
|
15
14
|
deadLetterTargetArn:
|
|
16
15
|
# !GetAtt
|
|
17
16
|
Fn::GetAtt:
|
|
18
|
-
- <%- queueName %>
|
|
17
|
+
- <%- queueName %>DLQ
|
|
19
18
|
- Arn
|
|
20
19
|
maxReceiveCount: 3
|
|
21
20
|
VisibilityTimeout: 120
|
|
22
21
|
##==== [QueueDLQ]
|
|
23
|
-
<%- queueName %>
|
|
22
|
+
<%- queueName %>DLQ:
|
|
24
23
|
Type: AWS::SQS::Queue
|
|
25
24
|
Properties:
|
|
26
|
-
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>
|
|
25
|
+
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>DLQ
|
|
27
26
|
##==== [QueuePolicy]
|
|
28
|
-
<%- queueName %>
|
|
27
|
+
<%- queueName %>Policy:
|
|
29
28
|
Type: AWS::SQS::QueuePolicy
|
|
30
29
|
Properties:
|
|
31
30
|
PolicyDocument:
|
|
@@ -37,17 +36,18 @@
|
|
|
37
36
|
Resource:
|
|
38
37
|
# !GetAtt
|
|
39
38
|
Fn::GetAtt:
|
|
40
|
-
- <%- queueName %>
|
|
39
|
+
- <%- queueName %>
|
|
41
40
|
- Arn
|
|
42
41
|
Action: "SQS:SendMessage"
|
|
43
42
|
Queues:
|
|
44
|
-
- Ref: <%- queueName %>
|
|
43
|
+
- Ref: <%- queueName %>
|
|
45
44
|
#<#<%- firstLetterUpperCase(queueName) %>QueueSetting#>
|
|
46
45
|
#<#/<%- firstLetterUpperCase(queueName) %>QueueSetting#>
|
|
47
46
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
|
|
48
|
+
<%_ function firstLetterUpperCase(text){
|
|
49
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
50
|
+
} _%>
|
|
51
|
+
<%_ function firstLetterLowerCase(str) {
|
|
52
|
+
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
53
|
+
} _%>
|
|
@@ -114,7 +114,7 @@ function createSourceParam(_izContext, flowSchema, srcPath) {
|
|
|
114
114
|
functionName,
|
|
115
115
|
handlerType,
|
|
116
116
|
additionalResourcePermission,
|
|
117
|
-
resourceLocation: SOURCE_PATH.resourceLocationWebSocket,
|
|
117
|
+
resourceLocation: path.join(SOURCE_PATH.resourceLocationWebSocket, flowSchema.flowTag, "source/"),
|
|
118
118
|
bucketName,
|
|
119
119
|
functionNameConfig: upperCase(functionName) + upperCase(shortNameHandler(handlerType)),
|
|
120
120
|
roleName: SOURCE_GENERATE_IAM_ROLE.FlowSchemaUploadS3Role
|
|
@@ -38,18 +38,18 @@ const {
|
|
|
38
38
|
|
|
39
39
|
const templatePath = path.join(__dirname, "./template.ejs")
|
|
40
40
|
|
|
41
|
-
function data(_izContext, srcPath) {
|
|
42
|
-
return [createSourceData(_izContext, srcPath)]
|
|
41
|
+
function data(_izContext, flowSchema, srcPath) {
|
|
42
|
+
return [createSourceData(_izContext, flowSchema, srcPath)]
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
function createSourceData(_izContext, srcPath) {
|
|
45
|
+
function createSourceData(_izContext, flowSchema, srcPath) {
|
|
46
46
|
let functionName = FUNCTION_NAME.processAfterUploadS3
|
|
47
47
|
let handlerType = "HdrS3"
|
|
48
48
|
return {
|
|
49
49
|
templatePath: templatePath,
|
|
50
50
|
templateData: {},
|
|
51
51
|
setting: {
|
|
52
|
-
savePath: path.join(srcPath, SOURCE_PATH.webSocket),
|
|
52
|
+
savePath: path.join(srcPath, SOURCE_PATH.webSocket, flowSchema.flowTag, "source/"),
|
|
53
53
|
saveFileName: `${upperCase(functionName)}_${upperCase(handlerType)}`,
|
|
54
54
|
fileExtension: ".js",
|
|
55
55
|
}
|
package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/mainFunction/data.js
CHANGED
|
@@ -38,18 +38,18 @@ const {
|
|
|
38
38
|
|
|
39
39
|
const templatePath = path.join(__dirname, "./template.ejs")
|
|
40
40
|
|
|
41
|
-
function data(_izContext, srcPath) {
|
|
42
|
-
return [createSourceParams(_izContext, srcPath)]
|
|
41
|
+
function data(_izContext, flowSchema, srcPath) {
|
|
42
|
+
return [createSourceParams(_izContext, flowSchema, srcPath)]
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
function createSourceParams(_izContext, srcPath) {
|
|
45
|
+
function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
46
46
|
let functionName = upperCase(FUNCTION_NAME.processAfterUploadS3)
|
|
47
47
|
return {
|
|
48
48
|
templatePath: templatePath,
|
|
49
49
|
templateData: {},
|
|
50
50
|
setting: {
|
|
51
51
|
saveFileName: `${functionName}_Main`,
|
|
52
|
-
savePath: path.join(srcPath, SOURCE_PATH.webSocket),
|
|
52
|
+
savePath: path.join(srcPath, SOURCE_PATH.webSocket, flowSchema.flowTag, "source/"),
|
|
53
53
|
fileExtension: ".js",
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -33,7 +33,7 @@ const s3 = new S3Client({ region: 'us-east-2' });
|
|
|
33
33
|
|
|
34
34
|
const hash = require('object-hash');
|
|
35
35
|
const Readable = require('stream');
|
|
36
|
-
const { isValidCsv, getNestObject } = require('../../libs/source/
|
|
36
|
+
const { isValidCsv, getNestObject } = require('../../libs/source/GenerateCodeLibs')
|
|
37
37
|
const consts = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
38
38
|
const coreConsts = require('@izara_project/izara-core-library-core/src/Consts');
|
|
39
39
|
|
|
@@ -31,7 +31,7 @@ function createSourceParams(_izContext, srcPath) {
|
|
|
31
31
|
templatePath: templatePath,
|
|
32
32
|
templateData: {},
|
|
33
33
|
setting: {
|
|
34
|
-
saveFileName: "
|
|
34
|
+
saveFileName: "GenerateCodeLibs",
|
|
35
35
|
savePath: path.join(srcPath, SOURCE_PATH.generateCodeLib),
|
|
36
36
|
fileExtension: ".js",
|
|
37
37
|
isAppend: false
|
package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/functionYaml/data.js
CHANGED
|
@@ -18,8 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
18
18
|
'use strict';
|
|
19
19
|
const path = require('path');
|
|
20
20
|
|
|
21
|
-
const { SOURCE_PATH, SAVE_FILE_NAME, defaultIamRolePerAction, createIamRole, RESOURCE_CLASSES, DYNAMO_RESOURCE, resourceNames, SOURCE_GENERATE_IAM_ROLE } = require("
|
|
22
|
-
const { firstLetterUpperCase: upperCase } = require('
|
|
21
|
+
const { SOURCE_PATH, SAVE_FILE_NAME, defaultIamRolePerAction, createIamRole, RESOURCE_CLASSES, DYNAMO_RESOURCE, resourceNames, SOURCE_GENERATE_IAM_ROLE } = require("../../../../../../../MainLibs/src/Consts");
|
|
22
|
+
const { firstLetterUpperCase: upperCase } = require('../../../../../../../MainLibs/src/Utils');
|
|
23
23
|
|
|
24
24
|
const templatePath = path.join(__dirname, "./template.ejs")
|
|
25
25
|
|
|
@@ -59,7 +59,7 @@ function createWebSocketConnectYaml(_izContext, srcPath) {
|
|
|
59
59
|
templatePath: templatePath,
|
|
60
60
|
templateData: {
|
|
61
61
|
functionName,
|
|
62
|
-
resourceLocation:
|
|
62
|
+
resourceLocation: "src/generatedCode/FlowSchema/WebSocketConnect/source/",
|
|
63
63
|
additionalResourcePermission,
|
|
64
64
|
roleName: SOURCE_GENERATE_IAM_ROLE.FlowSchemaUploadS3Role
|
|
65
65
|
|
package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/data.js
CHANGED
|
@@ -18,7 +18,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
18
18
|
'use strict';
|
|
19
19
|
const path = require('path');
|
|
20
20
|
|
|
21
|
-
const { SOURCE_PATH } = require("
|
|
21
|
+
const { SOURCE_PATH, SAVE_FILE_NAME, defaultIamRolePerAction, createIamRole, RESOURCE_CLASSES, DYNAMO_RESOURCE, resourceNames, SOURCE_GENERATE_IAM_ROLE } = require("../../../../../../../MainLibs/src/Consts");
|
|
22
|
+
const { firstLetterUpperCase: upperCase } = require('../../../../../../../MainLibs/src/Utils');
|
|
22
23
|
|
|
23
24
|
const templatePath = path.join(__dirname, "./template.ejs")
|
|
24
25
|
|
|
@@ -44,7 +45,7 @@ function createWebSocketConnectYaml(_izContext, srcPath) {
|
|
|
44
45
|
functionName,
|
|
45
46
|
},
|
|
46
47
|
setting: {
|
|
47
|
-
savePath: path.join(srcPath,
|
|
48
|
+
savePath: path.join(srcPath, "../src/generatedCode/FlowSchema/WebSocketConnect/source/"),
|
|
48
49
|
saveFileName: functionName,
|
|
49
50
|
fileExtension: ".js",
|
|
50
51
|
isAppend: false
|
package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/template.ejs
CHANGED
|
@@ -32,25 +32,13 @@ module.exports.main = middleware.wrap(async (event, context, callback) => {
|
|
|
32
32
|
switch (eventType) {
|
|
33
33
|
case 'CONNECT':
|
|
34
34
|
console.log('Connect websocket')
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
// await dynamodbSharedLib.tableName(event._izContext, "WebSocketTask"),
|
|
38
|
-
// {
|
|
39
|
-
// taskKey: "connect" + connectionId,
|
|
40
|
-
// connectionId: connectionId,
|
|
41
|
-
// }
|
|
42
|
-
// )
|
|
35
|
+
//(<additionalParams>)
|
|
36
|
+
//(</additionalParams>)
|
|
43
37
|
break
|
|
44
38
|
case 'DISCONNECT':
|
|
45
39
|
console.log('Websocket are Disconnection')
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
-
// await dynamodbSharedLib.tableName(event._izContext, "WebSocketTask"),
|
|
49
|
-
// {
|
|
50
|
-
// taskKey: "connect" + connectionId,
|
|
51
|
-
// connectionid: connectionId
|
|
52
|
-
// }
|
|
53
|
-
// );
|
|
40
|
+
//(<additionalParams>)
|
|
41
|
+
//(</additionalParams>)
|
|
54
42
|
break
|
|
55
43
|
case '$default':
|
|
56
44
|
console.log('Received unknown route:', route)
|
|
@@ -0,0 +1,73 @@
|
|
|
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
|
+
|
|
20
|
+
const path = require("path")
|
|
21
|
+
|
|
22
|
+
const templatePath = path.join(__dirname, './template.ejs');
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
firstLetterLowerCase: lowerCase,
|
|
26
|
+
firstLetterUpperCase: upperCase,
|
|
27
|
+
firstLetterUpperCase,
|
|
28
|
+
} = require("../../../../../MainLibs/src/Utils");
|
|
29
|
+
const {
|
|
30
|
+
DEFAULT_HANDLER_PER_ACTION,
|
|
31
|
+
SOURCE_PATH,
|
|
32
|
+
FUNCTION_NAME,
|
|
33
|
+
SAVE_FILE_NAME,
|
|
34
|
+
SOURCE_GENERATE_IAM_ROLE,
|
|
35
|
+
} = require("../../../../../MainLibs/src/Consts");
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* create data for dynamoDbYaml tempalte from objectSchema
|
|
39
|
+
* return array of dynamoDb data
|
|
40
|
+
* because one objectSchema can create multiple dynamoDb table
|
|
41
|
+
*
|
|
42
|
+
* @param {Object} _izContext
|
|
43
|
+
* @param {String} saveFilePath
|
|
44
|
+
* @returns {Object[]} - data of multiple dynamoDb template
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
function data(_izContext, flowSchema, srcPath) {
|
|
48
|
+
const flowStepSplitKey = Object.keys(flowSchema.flowSteps)[0].split("_");
|
|
49
|
+
let queueName;
|
|
50
|
+
let queueNameSubscription;
|
|
51
|
+
if (Object.keys(flowSchema.flowSteps).length > 3) {
|
|
52
|
+
queueName = flowStepSplitKey[3] + 'Out';
|
|
53
|
+
queueNameSubscription = flowStepSplitKey[3]
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return [{
|
|
57
|
+
templatePath,
|
|
58
|
+
templateData: {
|
|
59
|
+
queueName: upperCase(queueName),
|
|
60
|
+
queueNameSubscription: upperCase(queueNameSubscription),
|
|
61
|
+
roleName: SOURCE_GENERATE_IAM_ROLE.ExternalTopicRole,
|
|
62
|
+
},
|
|
63
|
+
setting: {
|
|
64
|
+
initialData: "Resource\n",
|
|
65
|
+
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
66
|
+
saveFileName: SAVE_FILE_NAME.snsInSqsYaml,
|
|
67
|
+
fileExtension: ".yml",
|
|
68
|
+
isAppend: true
|
|
69
|
+
}
|
|
70
|
+
}]
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
module.exports = data
|
|
@@ -1,21 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
##===== SNS Subscription
|
|
2
|
+
SubscriptionOut<%- queueNameSubscription %>:
|
|
3
|
+
Type: AWS::SNS::Subscription
|
|
4
|
+
Properties:
|
|
5
|
+
TopicArn: !Ref Out<%- queueNameSubscription %>
|
|
6
|
+
Endpoint: "arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- queueNameSubscription %>Out"
|
|
7
|
+
Protocol: "sqs"
|
|
8
|
+
##===== [Queue]
|
|
2
9
|
<%- queueName %>:
|
|
3
10
|
Type: "AWS::SQS::Queue"
|
|
4
11
|
Properties:
|
|
5
12
|
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>
|
|
6
13
|
RedrivePolicy:
|
|
7
|
-
deadLetterTargetArn:
|
|
14
|
+
deadLetterTargetArn:
|
|
15
|
+
# !GetAtt
|
|
8
16
|
Fn::GetAtt:
|
|
9
17
|
- <%- queueName %>DLQ
|
|
10
18
|
- Arn
|
|
11
19
|
maxReceiveCount: 3
|
|
12
20
|
VisibilityTimeout: 120
|
|
13
|
-
|
|
21
|
+
##==== [QueueDLQ]
|
|
14
22
|
<%- queueName %>DLQ:
|
|
15
23
|
Type: AWS::SQS::Queue
|
|
16
24
|
Properties:
|
|
17
25
|
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>DLQ
|
|
18
|
-
|
|
26
|
+
##==== [QueuePolicy]
|
|
19
27
|
<%- queueName %>Policy:
|
|
20
28
|
Type: AWS::SQS::QueuePolicy
|
|
21
29
|
Properties:
|
|
@@ -25,7 +33,8 @@
|
|
|
25
33
|
- Sid: "allow-sns-messages"
|
|
26
34
|
Effect: Allow
|
|
27
35
|
Principal: "*"
|
|
28
|
-
Resource:
|
|
36
|
+
Resource:
|
|
37
|
+
# !GetAtt
|
|
29
38
|
Fn::GetAtt:
|
|
30
39
|
- <%- queueName %>
|
|
31
40
|
- Arn
|
|
@@ -35,9 +44,10 @@
|
|
|
35
44
|
#<#<%- firstLetterUpperCase(queueName) %>QueueSetting#>
|
|
36
45
|
#<#/<%- firstLetterUpperCase(queueName) %>QueueSetting#>
|
|
37
46
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
|
|
48
|
+
<%_ function firstLetterUpperCase(text){
|
|
49
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
50
|
+
} _%>
|
|
51
|
+
<%_ function firstLetterLowerCase(str) {
|
|
52
|
+
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
53
|
+
} _%>
|
|
@@ -0,0 +1,75 @@
|
|
|
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
|
+
|
|
20
|
+
const path = require('path');
|
|
21
|
+
|
|
22
|
+
// const { ACTIONS, HANDLER } = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
firstLetterLowerCase: lowerCase,
|
|
26
|
+
firstLetterUpperCase: upperCase,
|
|
27
|
+
} = require("../../../../../MainLibs/src/Utils");
|
|
28
|
+
const {
|
|
29
|
+
DEFAULT_HANDLER_PER_ACTION,
|
|
30
|
+
SOURCE_PATH,
|
|
31
|
+
SAVE_FILE_NAME,
|
|
32
|
+
FUNCTION_NAME,
|
|
33
|
+
SOURCE_GENERATE_IAM_ROLE
|
|
34
|
+
} = require("../../../../../MainLibs/src/Consts");
|
|
35
|
+
|
|
36
|
+
const templatePath = path.join(__dirname, "../../../../TemplateData/resourceYaml/sns-out/template.ejs");
|
|
37
|
+
// /ResourceYaml/sns-out/template.ejs
|
|
38
|
+
// /OutPerActionComplete/OutUpdateComplete/sns-out/data.js
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* create data for dynamoDbYaml tempalte from objectSchema
|
|
42
|
+
* return array of dynamoDb data
|
|
43
|
+
* because one objectSchema can create multiple dynamoDb table
|
|
44
|
+
*
|
|
45
|
+
* @param {Object} _izContext
|
|
46
|
+
* @param {String} saveFilePath
|
|
47
|
+
* @returns {Object[]} - data of multiple dynamoDb template
|
|
48
|
+
*/
|
|
49
|
+
function data(_izContext, flowSchema, srcPath) {
|
|
50
|
+
const createSourceParams = createParamsForCreateSource(_izContext, flowSchema, srcPath)
|
|
51
|
+
return createSourceParams
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
|
|
55
|
+
const flowStepSplitKey = Object.keys(flowSchema.flowSteps)[1].split('_');
|
|
56
|
+
const queueName = flowStepSplitKey[3]
|
|
57
|
+
return [
|
|
58
|
+
{
|
|
59
|
+
templatePath: templatePath,
|
|
60
|
+
templateData: {
|
|
61
|
+
queueName: upperCase(queueName),
|
|
62
|
+
roleName: SOURCE_GENERATE_IAM_ROLE.ExternalTopicRole,
|
|
63
|
+
},
|
|
64
|
+
setting: {
|
|
65
|
+
initialData: 'Resources:\n',
|
|
66
|
+
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
67
|
+
saveFileName: SAVE_FILE_NAME.snsOutYaml,
|
|
68
|
+
fileExtension: '.yml',
|
|
69
|
+
isAppend: true
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
module.exports = data
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
##--------- [Create Topic Out]
|
|
2
|
+
Out<%- firstLetterUpperCase(queueName) %>:
|
|
3
|
+
Type: AWS::SNS::Topic
|
|
4
|
+
Properties:
|
|
5
|
+
DisplayName: "SNS Message out"
|
|
6
|
+
TopicName: ${self:custom.iz_serviceTag}_${self:custom.iz_stage}_<%- firstLetterUpperCase(queueName) %>_Out
|
|
7
|
+
|
|
8
|
+
<%_ function firstLetterUpperCase(text) {
|
|
9
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
10
|
+
} _%>
|
|
@@ -0,0 +1,83 @@
|
|
|
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
|
+
|
|
20
|
+
const path = require('path');
|
|
21
|
+
|
|
22
|
+
const { FLOW_SCHEMA_HOOK_STATE, HANDLER } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
23
|
+
const { firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils");
|
|
24
|
+
const {
|
|
25
|
+
SOURCE_PATH,
|
|
26
|
+
defaultIamRolePerAction,
|
|
27
|
+
createIamRole,
|
|
28
|
+
RESOURCE_CLASSES,
|
|
29
|
+
SNS_RESOURCE,
|
|
30
|
+
resourceNames,
|
|
31
|
+
DYNAMO_RESOURCE,
|
|
32
|
+
SAVE_FILE_NAME,
|
|
33
|
+
FUNCTION_NAME,
|
|
34
|
+
shortNameHandler,
|
|
35
|
+
externalResourceYaml,
|
|
36
|
+
SOURCE_GENERATE_IAM_ROLE
|
|
37
|
+
} = require("../../../../../../MainLibs/src/Consts");
|
|
38
|
+
|
|
39
|
+
const templatePath = path.join(__dirname, "template.ejs");
|
|
40
|
+
const hookTemplate = path.join(__dirname, "./hookTemplate.ejs");
|
|
41
|
+
/**
|
|
42
|
+
* receive objectSchema
|
|
43
|
+
* create data for WebScoket handler template
|
|
44
|
+
*
|
|
45
|
+
* @param {Object} objectSchema
|
|
46
|
+
* @return {{templatePath, templateData,setting}}
|
|
47
|
+
*/
|
|
48
|
+
function data(_izContext, flowSchema, srcPath) {
|
|
49
|
+
return [createSourceParams(_izContext, flowSchema, srcPath)]
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
53
|
+
let functionName = upperCase(flowSchema.flowTag);
|
|
54
|
+
let handlerType = upperCase(HANDLER.hdrSqs);
|
|
55
|
+
let externalTopicName = FUNCTION_NAME.flowSchemaExternalTopic + 'Out';
|
|
56
|
+
let externalTopicShortName = 'ExtTopicOut';
|
|
57
|
+
let functionConfig = upperCase(flowSchema.flowTag) + externalTopicShortName + upperCase(shortNameHandler(handlerType));
|
|
58
|
+
let additionalResourcePermission = defaultIamRolePerAction();
|
|
59
|
+
const handler = HANDLER.hdrSqs; // Using hdrSqs as the default handler
|
|
60
|
+
const action = flowSchema.flowTag || 'defaultAction'; // Using flowTag as the action name
|
|
61
|
+
const event = resourceNames(RESOURCE_CLASSES.sqs, upperCase(action) + upperCase(handler));
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
templatePath: templatePath,
|
|
65
|
+
templateData: {
|
|
66
|
+
resourceLocation: SOURCE_PATH.resourceLocationWebSocket,
|
|
67
|
+
event,
|
|
68
|
+
functionName,
|
|
69
|
+
handlerType,
|
|
70
|
+
functionNameConfig: functionConfig,
|
|
71
|
+
roleName: SOURCE_GENERATE_IAM_ROLE.ExternalTopicRole,
|
|
72
|
+
externalTopicName
|
|
73
|
+
},
|
|
74
|
+
setting: {
|
|
75
|
+
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
76
|
+
saveFileName: upperCase(SAVE_FILE_NAME.flowSchema),
|
|
77
|
+
fileExtension: ".yml",
|
|
78
|
+
isAppend: true
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
module.exports = data;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<%_ const join = require('path').join _%>
|
|
2
|
+
<%- firstLetterUpperCase(functionNameConfig) %>:
|
|
3
|
+
handler: <%- join(resourceLocation, functionName, `${firstLetterUpperCase(externalTopicName)}_${firstLetterUpperCase(handlerType)}.main`) %>
|
|
4
|
+
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionNameConfig) %>
|
|
5
|
+
events:
|
|
6
|
+
- sqs:
|
|
7
|
+
arn: <%- event %>
|
|
8
|
+
batchSize: 10
|
|
9
|
+
role: <%- firstLetterUpperCase(roleName) _%>Role
|
|
10
|
+
#<#<%_ functionName _%><%_ handlerType _%>IamRole#>
|
|
11
|
+
#<#/<%_ functionName _%><%_ handlerType _%>IamRole#>
|
|
12
|
+
<%_ function firstLetterUpperCase(text){
|
|
13
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
14
|
+
} _%>
|
|
15
|
+
<%_ function firstLetterLowerCase(str) {
|
|
16
|
+
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
17
|
+
} _%>
|