@izara_project/izara-core-generate-service-code 1.0.42 → 1.0.44
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/generateFlowStepWithPlugIn/firstFlowStep/mainFunction/template.ejs +1 -1
- package/src/generateCode/generateFlowStepWithPlugIn/firstFlowStep/queueNtopic/data.js +1 -1
- package/src/generateCode/generateFlowStepWithPlugIn/firstFlowStep/queueNtopic/dsqTemplate.ejs +43 -0
- package/src/generateCode/generateFlowStepWithPlugIn/firstFlowStep/queueNtopic/sqsTemplate.ejs +7 -7
- package/src/generateCode/generateFlowStepWithPlugIn/index.js +1 -1
- package/src/generateCode/generateInitialSetup/externalServiceComponent/lambdaRole/data.js +12 -12
- package/src/generateCode/generateSchema/actionEndpointCompleteComponent/create/mainFunction/template.ejs +2 -0
- package/src/generateCode/generateSchema/actionEndpointComponent/mainFunction/get/template.ejs +1 -1
- package/src/generateCode/generateSchema/findDataComponent/GetByStorage/getByGraph.ejs +1 -1
- package/src/libs/Libs.js +12 -15
package/package.json
CHANGED
|
@@ -55,7 +55,7 @@ export default async function <%- functionName %>(
|
|
|
55
55
|
_izContext.logger.debug('<%- functionName %> callingFlowConfig: ', callingFlowConfig);
|
|
56
56
|
|
|
57
57
|
//(<hookCode>)
|
|
58
|
-
//(
|
|
58
|
+
//(</hookCode>)
|
|
59
59
|
|
|
60
60
|
<% if (handleLogic === 'awaitingMultipleSteps') { %>
|
|
61
61
|
<%- include(templateAwaitingStep, { childFlow, mainObjType }) %>
|
|
@@ -26,7 +26,7 @@ import utils from '#libs/Utils.js';
|
|
|
26
26
|
const { firstLetterUpperCase: upperCase } = utils;
|
|
27
27
|
const { SOURCE_PATH, SAVE_FILE_NAME, HANDLER } = consts;
|
|
28
28
|
const templatePathByHandler = {
|
|
29
|
-
[HANDLER.hdrDsq]: path.join(__dirname, './
|
|
29
|
+
[HANDLER.hdrDsq]: path.join(__dirname, './dsqTemplate.ejs'),
|
|
30
30
|
[HANDLER.hdrSqs]: path.join(__dirname, './snsTemplate.ejs'),
|
|
31
31
|
queueNoTopic: path.join(__dirname, './sqsTemplate.ejs')
|
|
32
32
|
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
#------- queue ---------
|
|
2
|
+
<%- queueName %>HdrDsq:
|
|
3
|
+
Type: "AWS::SQS::Queue"
|
|
4
|
+
Properties:
|
|
5
|
+
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>HdrDsq
|
|
6
|
+
RedrivePolicy:
|
|
7
|
+
deadLetterTargetArn: #!GetAtt
|
|
8
|
+
Fn::GetAtt:
|
|
9
|
+
- <%- queueName %>HdrDsqDLQ
|
|
10
|
+
- Arn
|
|
11
|
+
maxReceiveCount: 3
|
|
12
|
+
VisibilityTimeout: 120
|
|
13
|
+
|
|
14
|
+
<%- queueName %>HdrDsqDLQ:
|
|
15
|
+
Type: AWS::SQS::Queue
|
|
16
|
+
Properties:
|
|
17
|
+
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>HdrDsqDLQ
|
|
18
|
+
|
|
19
|
+
<%- queueName %>HdrDsqPolicy:
|
|
20
|
+
Type: AWS::SQS::QueuePolicy
|
|
21
|
+
Properties:
|
|
22
|
+
PolicyDocument:
|
|
23
|
+
Version: "2012-10-17"
|
|
24
|
+
Statement:
|
|
25
|
+
- Sid: "allow-sns-messages"
|
|
26
|
+
Effect: Allow
|
|
27
|
+
Principal: "*"
|
|
28
|
+
Resource: #!GetAtt
|
|
29
|
+
Fn::GetAtt:
|
|
30
|
+
- <%- queueName %>HdrDsq
|
|
31
|
+
- Arn
|
|
32
|
+
Action: "SQS:SendMessage"
|
|
33
|
+
Queues:
|
|
34
|
+
- Ref: <%- queueName %>HdrDsq
|
|
35
|
+
#<#<%- firstLetterUpperCase(queueName) %>QueueSetting#>
|
|
36
|
+
#<#/<%- firstLetterUpperCase(queueName) %>QueueSetting#>
|
|
37
|
+
|
|
38
|
+
<%_ function firstLetterUpperCase(text){
|
|
39
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
40
|
+
} _%>
|
|
41
|
+
<%_ function firstLetterLowerCase(str) {
|
|
42
|
+
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
43
|
+
} _%>
|
package/src/generateCode/generateFlowStepWithPlugIn/firstFlowStep/queueNtopic/sqsTemplate.ejs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#------- queue ---------
|
|
2
|
-
<%- queueName
|
|
2
|
+
<%- queueName %>:
|
|
3
3
|
Type: "AWS::SQS::Queue"
|
|
4
4
|
Properties:
|
|
5
|
-
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>
|
|
5
|
+
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>
|
|
6
6
|
RedrivePolicy:
|
|
7
7
|
deadLetterTargetArn: #!GetAtt
|
|
8
8
|
Fn::GetAtt:
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
maxReceiveCount: 3
|
|
12
12
|
VisibilityTimeout: 120
|
|
13
13
|
|
|
14
|
-
<%- queueName %>
|
|
14
|
+
<%- queueName %>DLQ:
|
|
15
15
|
Type: AWS::SQS::Queue
|
|
16
16
|
Properties:
|
|
17
|
-
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>
|
|
17
|
+
QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>DLQ
|
|
18
18
|
|
|
19
|
-
<%- queueName %>
|
|
19
|
+
<%- queueName %>Policy:
|
|
20
20
|
Type: AWS::SQS::QueuePolicy
|
|
21
21
|
Properties:
|
|
22
22
|
PolicyDocument:
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
Principal: "*"
|
|
28
28
|
Resource: #!GetAtt
|
|
29
29
|
Fn::GetAtt:
|
|
30
|
-
- <%- queueName %>
|
|
30
|
+
- <%- queueName %>
|
|
31
31
|
- Arn
|
|
32
32
|
Action: "SQS:SendMessage"
|
|
33
33
|
Queues:
|
|
34
|
-
- Ref: <%- queueName %>
|
|
34
|
+
- Ref: <%- queueName %>
|
|
35
35
|
#<#<%- firstLetterUpperCase(queueName) %>QueueSetting#>
|
|
36
36
|
#<#/<%- firstLetterUpperCase(queueName) %>QueueSetting#>
|
|
37
37
|
|
|
@@ -129,7 +129,7 @@ async function generatePlunIg(
|
|
|
129
129
|
upperCase(flowSchema.flowTag) +
|
|
130
130
|
upperCase(flowStepName) +
|
|
131
131
|
upperCase(data.handlerType)),
|
|
132
|
-
queueName: upperCase(flowSchema.flowTag) + upperCase(flowStepName),
|
|
132
|
+
queueName: upperCase(flowSchema.flowTag) + upperCase(flowStepName) + upperCase(data.handlerType),
|
|
133
133
|
});
|
|
134
134
|
|
|
135
135
|
|
|
@@ -85,7 +85,7 @@ async function createExternalLambdaRole(
|
|
|
85
85
|
role(
|
|
86
86
|
lam,
|
|
87
87
|
LAMBDA_RESOURCE.invokeFunction,
|
|
88
|
-
extRes(lam, '
|
|
88
|
+
extRes(lam, 'GetNodeHdrInv', resourceGraphServiceTag)
|
|
89
89
|
),
|
|
90
90
|
role(
|
|
91
91
|
sns,
|
|
@@ -97,16 +97,16 @@ async function createExternalLambdaRole(
|
|
|
97
97
|
SNS_RESOURCE.publish,
|
|
98
98
|
extRes(sns, 'CreateNode_In', resourceGraphServiceTag)
|
|
99
99
|
),
|
|
100
|
-
role(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
),
|
|
105
|
-
role(
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
)
|
|
100
|
+
// role(
|
|
101
|
+
// lam,
|
|
102
|
+
// LAMBDA_RESOURCE.invokeFunction,
|
|
103
|
+
// extRes(lam, 'CreateNodeV2HdrInv', resourceGraphServiceTag)
|
|
104
|
+
// ),
|
|
105
|
+
// role(
|
|
106
|
+
// lam,
|
|
107
|
+
// LAMBDA_RESOURCE.invokeFunction,
|
|
108
|
+
// extRes(lam, 'UpdateNodeHdrInv', resourceGraphServiceTag)
|
|
109
|
+
// )
|
|
110
110
|
]
|
|
111
111
|
});
|
|
112
112
|
}
|
|
@@ -167,7 +167,7 @@ async function createExternalLambdaRole(
|
|
|
167
167
|
role(
|
|
168
168
|
lam,
|
|
169
169
|
LAMBDA_RESOURCE.invokeFunction,
|
|
170
|
-
extRes(lam, '
|
|
170
|
+
extRes(lam, 'GetNodeHdrInv', processTags)
|
|
171
171
|
)
|
|
172
172
|
]
|
|
173
173
|
});
|
|
@@ -256,6 +256,7 @@ export default async function createObjectComplete(
|
|
|
256
256
|
|
|
257
257
|
await Promise.all(
|
|
258
258
|
recordAwaitingStep.listOfRecords.map(async (listOfRecords) => {
|
|
259
|
+
if (status === 'complete') {
|
|
259
260
|
Object.entries(listOfRecords).map(async ([tableName, record]) => {
|
|
260
261
|
await dynamodbSharedLib.putItem(
|
|
261
262
|
_izContext,
|
|
@@ -269,6 +270,7 @@ export default async function createObjectComplete(
|
|
|
269
270
|
}
|
|
270
271
|
);
|
|
271
272
|
})
|
|
273
|
+
}
|
|
272
274
|
}))
|
|
273
275
|
|
|
274
276
|
const messageObject = buildMessageObject(
|
package/src/generateCode/generateSchema/actionEndpointComponent/mainFunction/get/template.ejs
CHANGED
|
@@ -109,7 +109,7 @@ export default async function getMain(
|
|
|
109
109
|
//(<beforeGetGraph>)
|
|
110
110
|
//(</beforeGetGraph>)
|
|
111
111
|
|
|
112
|
-
const dataFromGraph = await graphSharedLib.
|
|
112
|
+
const dataFromGraph = await graphSharedLib.getNode(
|
|
113
113
|
_izContext,
|
|
114
114
|
graphServiceName,
|
|
115
115
|
objType,
|
|
@@ -6,7 +6,7 @@ const graphHandlerServiceTag = await serviceConfig.getGraphServiceTagWithCache(
|
|
|
6
6
|
);
|
|
7
7
|
_izContext.logger.debug('graphHandlerServiceTag: ', graphHandlerServiceTag)
|
|
8
8
|
|
|
9
|
-
let getDataByGraph = await graphSharedLib.
|
|
9
|
+
let getDataByGraph = await graphSharedLib.getNode(
|
|
10
10
|
_izContext,
|
|
11
11
|
graphHandlerServiceTag,
|
|
12
12
|
objType,
|
package/src/libs/Libs.js
CHANGED
|
@@ -120,32 +120,29 @@ function externalResourceName(resourceClass, resourceName, serviceTag) {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
function externalResourceYaml(resourceClass, resourceName, serviceTag) {
|
|
123
|
-
|
|
124
|
-
// serviceTag = '${self:custom.iz_resourcePrefix}';
|
|
125
|
-
// } else {
|
|
126
|
-
// serviceTag = serviceTag + '${self:custom.iz_stage}';
|
|
127
|
-
// }
|
|
123
|
+
|
|
128
124
|
return {
|
|
129
125
|
[RESOURCE_CLASSES.dynamoDbTable]:
|
|
130
126
|
'arn:aws:dynamodb:${self:custom.iz_region}:${self:custom.iz_accountId}:table/' +
|
|
131
127
|
serviceTag ?
|
|
132
|
-
'${self:custom.iz_resourcePrefix}'
|
|
133
|
-
|
|
134
|
-
// `${serviceTag}` +
|
|
135
|
-
// `${resourceName}`,
|
|
128
|
+
'${self:custom.iz_resourcePrefix}' + resourceName :
|
|
129
|
+
serviceTag + '${self:custom.iz_stage}' + resourceName,
|
|
130
|
+
// `${ serviceTag } ` +
|
|
131
|
+
// `${ resourceName } `,
|
|
136
132
|
[RESOURCE_CLASSES.lambda]:
|
|
137
|
-
'arn:aws:lambda:${self:custom.iz_region}:${self:custom.iz_accountId}:function:' +
|
|
133
|
+
'arn:aws:lambda:${self: custom.iz_region}:${self:custom.iz_accountId}:function:' +
|
|
138
134
|
serviceTag ?
|
|
139
|
-
'${self:custom.iz_resourcePrefix}'
|
|
140
|
-
|
|
135
|
+
'${self:custom.iz_resourcePrefix}' + resourceName :
|
|
136
|
+
serviceTag + '${self:custom.iz_stage}' + resourceName,
|
|
141
137
|
[RESOURCE_CLASSES.sns]:
|
|
142
138
|
'arn:aws:sns:${self:custom.iz_region}:${self:custom.iz_accountId}:' +
|
|
143
|
-
|
|
139
|
+
serviceTag ? '${self:custom.iz_serviceTag}_${self:custom.iz_stage}_' + resourceName :
|
|
140
|
+
serviceTag + '_${self:custom.iz_stage}_' + resourceName,
|
|
144
141
|
[RESOURCE_CLASSES.sqs]:
|
|
145
142
|
'arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:' +
|
|
146
143
|
serviceTag ?
|
|
147
|
-
'${self:custom.iz_resourcePrefix}'
|
|
148
|
-
|
|
144
|
+
'${self:custom.iz_resourcePrefix}' + resourceName :
|
|
145
|
+
serviceTag + '${self:custom.iz_stage}' + resourceName,
|
|
149
146
|
}[resourceClass];
|
|
150
147
|
}
|
|
151
148
|
|