@izara_project/izara-market-library-service-schemas 1.0.36 → 1.0.38
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 +8 -7
- package/src/GenerateCodeLibs/src/Consts.js +2 -2
- package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +36 -6
- package/src/MainLibs/src/Consts.js +5 -2
- package/src/MainLibs/src/GenerateCodeUtils.js +3 -1
- package/src/MainLibs/src/Utils.js +12 -0
- package/src/TemplateManager/src/flowSchema/DefaultWebSocketResource/webSocketConnect/handler/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/InProcessFlowSchema/handler/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createObject/handler/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createObject/mainFunction/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/getsignUrlsAcc/mainFunction/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/reservedLimitComplete/mainFunction/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/mainFunction/template.ejs +1 -1
- package/src/TemplateManager/src/flowSchema/UploadS3Case/relate/libs/template.ejs +1 -1
- package/src/reStructure/GenerateCode.js +2 -2
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/backupTemplate.ejs +1 -1
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +37 -12
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +25 -2
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +26 -0
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +23 -1
- package/src/reStructure/TemplateData/EndpointPerService/yaml/data.js +37 -7
- package/src/reStructure/TemplateData/externalService/lambdaRole/data.js +7 -7
- package/src/reStructure/TemplateData/externalService/lambdaRole/template.ejs +1 -1
- package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/data.js +4 -2
- package/src/reStructure/TemplateData/findData/GetByStorage/getByGraph.ejs +4 -3
- package/src/reStructure/TemplateData/findData/handler/template.ejs +2 -1
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/mainFunction/data.js +4 -10
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/template.ejs +3 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/data.js +3 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/template.ejs +3 -12
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/template.ejs +6 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/mainFunction/template.ejs +18 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/sns-sqs/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/template.ejs +9 -6
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/sqs/data.js +3 -3
- package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/sqs/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/mainFunction/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/relate/libs/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/functionYaml/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/data.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/externalTopic/functionYaml/data.js +127 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/handler/data.js +121 -0
- package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/FlowSchemaCompleteComponent → externalTopic}/handler/template.ejs +4 -3
- package/src/reStructure/TemplateData/flowSchema/externalTopic/mainFunction/data.js +74 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/mainFunction/template.ejs +131 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/data.js +61 -34
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/data.js +9 -8
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/data.js +3 -2
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/data.js +19 -8
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/template.ejs +19 -25
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/functionYaml/data.js +2 -4
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/data.js +2 -5
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/template.ejs +4 -3
- package/src/reStructure/TemplateData/flowSchema/{externalTopic/sqs → flowSchemaOwnTopic/flowStep}/functionYaml/data.js +43 -38
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowStep/functionYaml/template.ejs +20 -0
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowStep/handler/data.js +80 -0
- package/src/reStructure/TemplateData/flowSchema/{externalTopic/sqs → flowSchemaOwnTopic/flowStep}/handler/template.ejs +16 -61
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowStep/mainFunction/data.js +92 -0
- package/src/reStructure/TemplateData/flowSchema/{externalTopic/websocket → flowSchemaOwnTopic/flowStep}/mainFunction/template.ejs +12 -14
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-in/data.js +48 -30
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-out/data.js +21 -24
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/functionYaml/data.js +7 -22
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/webSocketComplete/functionYaml/template.ejs +20 -0
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/handler/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/webSocketComplete/handler/template.ejs +84 -0
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/mainFunction/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/mainFunction/template.ejs +27 -11
- package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +25 -30
- package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/functionYaml/data.js +0 -27
- package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/mainFunction/data.js +3 -3
- package/src/reStructure/TemplateData/flowSchema/register/complete/mainFunction/template.ejs +172 -0
- package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/dynamoDB/register.js +1 -1
- package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/subscriptionOutAll/data.js +29 -19
- package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/functionYaml/data.js +28 -50
- package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/register/wbs/mainFunction/template.ejs +165 -0
- package/src/reStructure/TemplateData/flowSchema/templateBystatusType/storedCacheTemplate.ejs +38 -0
- package/src/reStructure/TemplateData/flowSchema/templateBystatusType/triggerCacheTemplate.ejs +39 -0
- package/src/reStructure/TemplateData/generateRole/sharedResourceTemplate.ejs +0 -29
- package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/createObjectComplete_main.js +1 -1
- package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionComplete/delete/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionComplete/get/mainFunction/template.ejs +4 -1
- package/src/reStructure/TemplateData/perActionComplete/update/mainFunction/template.ejs +6 -2
- package/src/reStructure/TemplateData/perActionEndpoint/libs/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/create/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/delete/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/update/template.ejs +1 -1
- package/src/reStructure/TemplateData/propertyValueSchema/relationshipPropertyValueSchema/data.js +2 -7
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/api/data.js +22 -3
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/dsq/data.js +14 -9
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/inv/data.js +26 -6
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/sqs/data.js +11 -7
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/functionYaml/data.js +17 -7
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/api/data.js +23 -4
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/dsq/data.js +14 -9
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/inv/data.js +26 -6
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/sqs/data.js +10 -7
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/functionYaml/data.js +11 -7
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/api/data.js +23 -4
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/dsq/data.js +14 -9
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/inv/data.js +26 -7
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/sqs/data.js +10 -7
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/mainFunction/template.ejs +1 -2
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/functionYaml/data.js +12 -7
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/api/data.js +22 -3
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/data.js +14 -6
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/inv/data.js +20 -3
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/sqs/data.js +9 -3
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/functionYaml/data.js +12 -6
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/mainFunction/template.ejs +1 -1
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/mainResourcePerObjectSchemaData.js +6 -2
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/mainFunction/template.ejs +0 -131
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/storedCacheTemplate.ejs +0 -11
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/mainFunction/template.ejs +0 -222
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/data.js +0 -74
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/template.ejs +0 -8
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/functionYaml/template.ejs +0 -17
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/handler/data.js +0 -64
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/mainFunction/data.js +0 -61
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/mainFunction/template.ejs +0 -45
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/data.js +0 -110
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/template.ejs +0 -18
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/data.js +0 -57
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/template.ejs +0 -40
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/data.js +0 -67
- package/src/reStructure/TemplateData/testTemplate/data.js +0 -27
- package/src/reStructure/TemplateData/testTemplate/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/FlowSchemaCompleteComponent → externalTopic}/functionYaml/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/functionYaml/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/handler/data.js +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/sns-in/data.js +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/sns-in/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/subscriptionOutAll/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/functionYaml/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/handler/data.js +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/mainFunction/data.js +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → templateBystatusType}/statusFieldTemplate.ejs +0 -0
package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/api/data.js
CHANGED
|
@@ -73,13 +73,32 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
|
|
|
73
73
|
|
|
74
74
|
additionalResourcePermission.push(
|
|
75
75
|
createIamRole(
|
|
76
|
-
{
|
|
76
|
+
{
|
|
77
|
+
[RESOURCE_CLASSES.sqs]: [
|
|
78
|
+
SQS_RESOURCE.deleteMessage,
|
|
79
|
+
SQS_RESOURCE.getQueueAttributes,
|
|
80
|
+
SQS_RESOURCE.receiveMessage,
|
|
81
|
+
SQS_RESOURCE.sendMessage,
|
|
82
|
+
SQS_RESOURCE.getQueueUrl,
|
|
83
|
+
SQS_RESOURCE.deleteMessageBatch
|
|
84
|
+
],
|
|
85
|
+
},
|
|
77
86
|
[
|
|
78
|
-
resourceNames(RESOURCE_CLASSES.
|
|
87
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
|
|
88
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs) + "DLQ"),
|
|
89
|
+
]
|
|
90
|
+
),
|
|
91
|
+
createIamRole(
|
|
92
|
+
{
|
|
93
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe]
|
|
94
|
+
},
|
|
95
|
+
[
|
|
96
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.updateRelComplete) + "_Out"),
|
|
97
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
|
98
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
|
|
79
99
|
]
|
|
80
100
|
)
|
|
81
101
|
)
|
|
82
|
-
|
|
83
102
|
for (const relationship of allObjectRelationships) {
|
|
84
103
|
let [storageType, relationshipTag, links] = checkDynamoTypeRelationship(relationship)
|
|
85
104
|
if (storageType === STORAGE_TYPES.dynamoDB) {
|
package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/data.js
CHANGED
|
@@ -95,15 +95,23 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
|
|
|
95
95
|
SQS_RESOURCE.getQueueAttributes,
|
|
96
96
|
SQS_RESOURCE.receiveMessage,
|
|
97
97
|
SQS_RESOURCE.sendMessage,
|
|
98
|
-
SQS_RESOURCE.
|
|
99
|
-
SQS_RESOURCE.
|
|
98
|
+
SQS_RESOURCE.getQueueUrl,
|
|
99
|
+
SQS_RESOURCE.deleteMessageBatch
|
|
100
100
|
],
|
|
101
|
-
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
102
101
|
},
|
|
103
102
|
[
|
|
104
|
-
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.
|
|
105
|
-
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.
|
|
106
|
-
|
|
103
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
|
|
104
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs) + "DLQ"),
|
|
105
|
+
]
|
|
106
|
+
),
|
|
107
|
+
createIamRole(
|
|
108
|
+
{
|
|
109
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe]
|
|
110
|
+
},
|
|
111
|
+
[
|
|
112
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.updateRelComplete) + "_Out"),
|
|
113
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
|
114
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
|
|
107
115
|
]
|
|
108
116
|
)
|
|
109
117
|
)
|
package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/inv/data.js
CHANGED
|
@@ -93,14 +93,31 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
|
|
|
93
93
|
additionalResourcePermission.push(
|
|
94
94
|
createIamRole(
|
|
95
95
|
{
|
|
96
|
-
[RESOURCE_CLASSES.
|
|
96
|
+
[RESOURCE_CLASSES.sqs]: [
|
|
97
|
+
SQS_RESOURCE.deleteMessage,
|
|
98
|
+
SQS_RESOURCE.getQueueAttributes,
|
|
99
|
+
SQS_RESOURCE.receiveMessage,
|
|
100
|
+
SQS_RESOURCE.sendMessage,
|
|
101
|
+
SQS_RESOURCE.getQueueUrl,
|
|
102
|
+
SQS_RESOURCE.deleteMessageBatch
|
|
103
|
+
],
|
|
97
104
|
},
|
|
98
105
|
[
|
|
99
|
-
resourceNames(RESOURCE_CLASSES.
|
|
106
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
|
|
107
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs) + "DLQ"),
|
|
108
|
+
]
|
|
109
|
+
),
|
|
110
|
+
createIamRole(
|
|
111
|
+
{
|
|
112
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe]
|
|
113
|
+
},
|
|
114
|
+
[
|
|
115
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.updateRelComplete) + "_Out"),
|
|
116
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
|
117
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
|
|
100
118
|
]
|
|
101
119
|
)
|
|
102
120
|
)
|
|
103
|
-
|
|
104
121
|
for (const relationship of allObjectRelationships) {
|
|
105
122
|
let [storageType, relationshipTag, links] = checkDynamoTypeRelationship(relationship)
|
|
106
123
|
if (storageType === STORAGE_TYPES.dynamoDB) {
|
package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/sqs/data.js
CHANGED
|
@@ -99,16 +99,22 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
|
|
|
99
99
|
SQS_RESOURCE.getQueueUrl,
|
|
100
100
|
SQS_RESOURCE.deleteMessageBatch
|
|
101
101
|
],
|
|
102
|
-
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
103
102
|
},
|
|
104
103
|
[
|
|
105
104
|
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
|
|
106
105
|
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs) + "DLQ"),
|
|
106
|
+
]
|
|
107
|
+
),
|
|
108
|
+
createIamRole(
|
|
109
|
+
{
|
|
110
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe]
|
|
111
|
+
},
|
|
112
|
+
[
|
|
113
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.updateRelComplete) + "_Out"),
|
|
107
114
|
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
|
108
115
|
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
|
|
109
|
-
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.updateRelComplete) + "_Out")
|
|
110
116
|
]
|
|
111
|
-
)
|
|
117
|
+
)
|
|
112
118
|
)
|
|
113
119
|
|
|
114
120
|
additionalResourcePermission.push(awaitingMultipleStepsRole())
|
package/src/reStructure/TemplateData/relationshipPerAction/update/action/mainFunction/template.ejs
CHANGED
|
@@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
17
17
|
|
|
18
18
|
'use strict';
|
|
19
19
|
|
|
20
|
-
const hash = require(
|
|
20
|
+
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
21
21
|
|
|
22
22
|
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
23
23
|
const lambdaSharedLib = require("@izara_project/izara-core-library-lambda");
|
package/src/reStructure/TemplateData/relationshipPerAction/update/complete/functionYaml/data.js
CHANGED
|
@@ -62,7 +62,6 @@ function createParamForCreateSource(srcPath) {
|
|
|
62
62
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
63
63
|
|
|
64
64
|
additionalResourcePermission.push(
|
|
65
|
-
|
|
66
65
|
createIamRole(
|
|
67
66
|
{
|
|
68
67
|
[RESOURCE_CLASSES.sqs]: [
|
|
@@ -72,19 +71,26 @@ function createParamForCreateSource(srcPath) {
|
|
|
72
71
|
SQS_RESOURCE.sendMessage,
|
|
73
72
|
SQS_RESOURCE.deleteMessageBatch,
|
|
74
73
|
SQS_RESOURCE.getQueueUrl,
|
|
75
|
-
],
|
|
76
|
-
[RESOURCE_CLASSES.sns]: [
|
|
77
|
-
SNS_RESOURCE.publish, SNS_RESOURCE.subscribe
|
|
78
74
|
]
|
|
79
75
|
},
|
|
80
76
|
[
|
|
81
77
|
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName)),
|
|
82
78
|
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + "DLQ"),
|
|
83
|
-
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
|
84
|
-
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out")
|
|
85
79
|
],
|
|
80
|
+
),
|
|
81
|
+
createIamRole(
|
|
82
|
+
{
|
|
83
|
+
[RESOURCE_CLASSES.sns]:
|
|
84
|
+
[
|
|
85
|
+
SNS_RESOURCE.publish, SNS_RESOURCE.subscribe
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
|
89
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out")
|
|
86
90
|
))
|
|
91
|
+
|
|
87
92
|
additionalResourcePermission.push(awaitingMultipleStepsRole())
|
|
93
|
+
|
|
88
94
|
return {
|
|
89
95
|
templatePath: templatePath,
|
|
90
96
|
templateData: {
|
package/src/reStructure/TemplateData/relationshipPerAction/update/complete/mainFunction/template.ejs
CHANGED
|
@@ -16,7 +16,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
'use strict';
|
|
19
|
-
const hash = require(
|
|
19
|
+
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
20
20
|
|
|
21
21
|
const izaraShared = require('@izara_project/izara-shared');
|
|
22
22
|
const callingFlowSharedLib = izaraShared.callingFlowSharedLib;
|
package/src/reStructure/TemplateData/resourceYaml/dynamodb/mainResourcePerObjectSchemaData.js
CHANGED
|
@@ -33,7 +33,7 @@ const STORAGE_TYPES = {
|
|
|
33
33
|
const { firstLetterUpperCase: upperCase } = require('../../../../MainLibs/src/Utils.js')
|
|
34
34
|
const { SOURCE_PATH, SAVE_FILE_NAME } = require('../../../../MainLibs/index.js').consts
|
|
35
35
|
const templatePath = path.join(__dirname, './template.ejs')
|
|
36
|
-
|
|
36
|
+
const { getLocalServiceTag } = require('../../../../MainLibs/src/Utils.js')
|
|
37
37
|
// ---------- End Per Lambda Handler IamRole Data ----------
|
|
38
38
|
|
|
39
39
|
|
|
@@ -116,9 +116,13 @@ function dataForMainDynamoDbYamlFromObjectSchema(_izContext, objectSchema, srcPa
|
|
|
116
116
|
// }
|
|
117
117
|
|
|
118
118
|
for (let storageResource of Object.values(objectSchema.storageResources)) {
|
|
119
|
+
// if (storageResource.hasOwnProperty("serviceTag") && storageResource.serviceTag !== getLocalServiceTag(srcPath)) {
|
|
120
|
+
// continue; // if serviceTag of storageResource not own service will skip
|
|
121
|
+
// }
|
|
119
122
|
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
120
123
|
let templateData = {
|
|
121
124
|
tableName: storageResource.tableName,
|
|
125
|
+
resourceName: storageResource.tableName,
|
|
122
126
|
attributes: []
|
|
123
127
|
};
|
|
124
128
|
if (storageResource.hasOwnProperty("groupByPartitionKeyField")) {
|
|
@@ -140,7 +144,7 @@ function dataForMainDynamoDbYamlFromObjectSchema(_izContext, objectSchema, srcPa
|
|
|
140
144
|
)
|
|
141
145
|
}
|
|
142
146
|
}
|
|
143
|
-
templateData.resourceName = upperCase(objectSchema.objectType)
|
|
147
|
+
// templateData.resourceName = upperCase(objectSchema.objectType)
|
|
144
148
|
dynamoDbYamlTempleteData.push(templateData)
|
|
145
149
|
}
|
|
146
150
|
}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (C) 2020 Sven Mason <http: //izara.io>
|
|
3
|
-
|
|
4
|
-
This program is free software: you can redistribute it and/or modify
|
|
5
|
-
it under the terms of the GNU Affero General Public License as
|
|
6
|
-
published by the Free Software Foundation, either version 3 of the
|
|
7
|
-
License, or (at your option) any later version.
|
|
8
|
-
|
|
9
|
-
This program is distributed in the hope that it will be useful,
|
|
10
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
GNU Affero General Public License for more details.
|
|
13
|
-
|
|
14
|
-
You should have received a copy of the GNU Affero General Public License
|
|
15
|
-
along with this program. If not, see
|
|
16
|
-
<http: //www.gnu.org/licenses />.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
'use strict';
|
|
20
|
-
|
|
21
|
-
const hash = require("object-hash");
|
|
22
|
-
const { getObjectSchema } = require('@izara_project/izara-core-library-service-schemas');
|
|
23
|
-
|
|
24
|
-
const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
|
|
25
|
-
const snsSharedLib = require('@izara_project/izara-core-library-sns');
|
|
26
|
-
const asyncFlowSharedLib = require('@izara_project/izara-core-library-asynchronous-flow');
|
|
27
|
-
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
28
|
-
const lambdaSharedLib = require('@izara_project/izara-core-library-lambda');
|
|
29
|
-
|
|
30
|
-
const externalRequest = require('@izara_project/izara-core-library-external-request');
|
|
31
|
-
const sns = externalRequest.sns
|
|
32
|
-
const { postToConnection } = require("../../../libs/source/GenerateCodeLibs");
|
|
33
|
-
|
|
34
|
-
const utils = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Utils')
|
|
35
|
-
const { NoRetryError } = require('@izara_project/izara-core-library-core')
|
|
36
|
-
const { v4: uuidv4 } = require('uuid')
|
|
37
|
-
const coreConsts = require("@izara_project/izara-core-library-core/src/Consts");
|
|
38
|
-
// const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
39
|
-
const { generateCodeLibs: { consts: TOPIC_NAME_GENERATE_CODE } } = require('@izara_project/izara-market-library-service-schemas')
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* description of function.
|
|
43
|
-
* @param {Object} _izContext
|
|
44
|
-
* @param {CorrelationIds} _izContext.correlationIds - property of _izContext
|
|
45
|
-
* @param {Logger} _izContext.logger - property of _izContext
|
|
46
|
-
* @param {Object} requestParams - request params
|
|
47
|
-
* @param {Object} requestParams.identifiers - identifiers for get data
|
|
48
|
-
* @param {Object} requestParams.additionalRequest - additionalRequest
|
|
49
|
-
*
|
|
50
|
-
* @returns {object} description of return value
|
|
51
|
-
*/
|
|
52
|
-
module.exports.<%- functionMain%> = async (
|
|
53
|
-
_izContext,
|
|
54
|
-
requestParams,
|
|
55
|
-
callingFlowConfig = {},
|
|
56
|
-
//(<additionalParams>)
|
|
57
|
-
//(</additionalParams>)
|
|
58
|
-
) => {
|
|
59
|
-
try {
|
|
60
|
-
_izContext.logger.debug("WebSocketInvoke _izContext", _izContext)
|
|
61
|
-
_izContext.logger.debug("WebSocketInvoke requestParams", requestParams)
|
|
62
|
-
_izContext.logger.debug("WebSocketInvoke callingFlowConfig", callingFlowConfig)
|
|
63
|
-
|
|
64
|
-
const connectionId = requestContext.connectionId;
|
|
65
|
-
let correlationId = _izContext.correlationIds.get(consts.X_CORRELATION_ID);
|
|
66
|
-
|
|
67
|
-
const getRegisterRecords = await dynamodbSharedLib.getItem(
|
|
68
|
-
_izContext,
|
|
69
|
-
await dynamodbSharedLib.tableName(_izContext, "RegisterRecords"),
|
|
70
|
-
{
|
|
71
|
-
taskKey: correlationId,
|
|
72
|
-
connectionId: connectionId,
|
|
73
|
-
}
|
|
74
|
-
);
|
|
75
|
-
_izContext.logger.debug("getRegisterRecords", getRegisterRecords)
|
|
76
|
-
if (!getRegisterRecords) {
|
|
77
|
-
throw new NoRetryError(`connectionId not found ${connectionId}`)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const flowType = getRegisterRecords.flowType;
|
|
81
|
-
const flowTag = flowType.split('_')[0];
|
|
82
|
-
const getFlowSchema = await getObjectSchema.getFlowSchemaS3WithCache(_izContext, {
|
|
83
|
-
flowTag: flowTag,
|
|
84
|
-
serviceTag: process.env.iz_serviceTag
|
|
85
|
-
})
|
|
86
|
-
_izContext.logger.debug("getFlowSchema", getFlowSchema)
|
|
87
|
-
if (!getFlowSchema) {
|
|
88
|
-
throw new NoRetryError(`flowTag not found ${flowTag}`)
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
switch (flowSchema.statusType) {
|
|
92
|
-
case "statusField":
|
|
93
|
-
let payload = {
|
|
94
|
-
identifiers: requestParams.identifiers,
|
|
95
|
-
objectType: flowSchema.objType.objectType
|
|
96
|
-
}
|
|
97
|
-
let result = await externalRequest.lambda.invokeSync(
|
|
98
|
-
_izContext,
|
|
99
|
-
await lambdaSharedLib.lambdaFunctionName(_izContext, "GetHdrInv", flowSchema.objType.serviceTag),
|
|
100
|
-
payload
|
|
101
|
-
)
|
|
102
|
-
if (!result) {
|
|
103
|
-
throw new NoRetryError(`statusField not found ${requestParams.identifiers}`)
|
|
104
|
-
}
|
|
105
|
-
return result
|
|
106
|
-
case "storedCache":
|
|
107
|
-
// if statusType=storedCache then query storedCache > post message to client -> remove connectionId if status = error || complete
|
|
108
|
-
const getStoredCache = await dynamodbSharedLib.getItem(
|
|
109
|
-
_izContext,
|
|
110
|
-
await dynamodbSharedLib.tableName(_izContext, flowSchema.flowTag + "Main"),
|
|
111
|
-
{
|
|
112
|
-
taskKey: requestParams.identifiers,
|
|
113
|
-
connectionId: requestParams.connectionId
|
|
114
|
-
}
|
|
115
|
-
)
|
|
116
|
-
if (!getStoredCache) {
|
|
117
|
-
throw new NoRetryError(`storedCache not found ${requestParams.identifiers}`)
|
|
118
|
-
}
|
|
119
|
-
return getStoredCache
|
|
120
|
-
case "none":
|
|
121
|
-
// if statusType=none -> post message to client ---- not remove connectionId when post message, can remove connectionId when cannot use connectionId only(user disconnect)
|
|
122
|
-
break
|
|
123
|
-
default:
|
|
124
|
-
throw new NoRetryError(`statusType not found ${flowSchema.statusType}`)
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
} catch (err) {
|
|
128
|
-
_izContext.logger.error('error WebSocketInvoke: ', err)
|
|
129
|
-
throw (err)
|
|
130
|
-
}
|
|
131
|
-
}
|
package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/storedCacheTemplate.ejs
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
let expiryTime = storedCacheSharedLib.createExpiryTime(_izContext, 31536000);
|
|
2
|
-
|
|
3
|
-
let createCacheId = hash({
|
|
4
|
-
//(<optionalParams>)
|
|
5
|
-
//(</optionalParams>)
|
|
6
|
-
})
|
|
7
|
-
let [ cacheMainStauts, cacheId, cacheMain ] = await storedCacheSharedLib.checkStoredCacheStatus(
|
|
8
|
-
_izContext,
|
|
9
|
-
"<%- tableName %>",
|
|
10
|
-
createCacheId
|
|
11
|
-
)
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (C) 2020 Sven Mason <http: //izara.io>
|
|
3
|
-
|
|
4
|
-
This program is free software: you can redistribute it and/or modify
|
|
5
|
-
it under the terms of the GNU Affero General Public License as
|
|
6
|
-
published by the Free Software Foundation, either version 3 of the
|
|
7
|
-
License, or (at your option) any later version.
|
|
8
|
-
|
|
9
|
-
This program is distributed in the hope that it will be useful,
|
|
10
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
GNU Affero General Public License for more details.
|
|
13
|
-
|
|
14
|
-
You should have received a copy of the GNU Affero General Public License
|
|
15
|
-
along with this program. If not, see
|
|
16
|
-
<http: //www.gnu.org/licenses />.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
'use strict';
|
|
20
|
-
|
|
21
|
-
const hash = require("object-hash");
|
|
22
|
-
const { getObjectSchema } = require('@izara_project/izara-core-library-service-schemas');
|
|
23
|
-
|
|
24
|
-
const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
|
|
25
|
-
const snsSharedLib = require('@izara_project/izara-core-library-sns');
|
|
26
|
-
const asyncFlowSharedLib = require('@izara_project/izara-core-library-asynchronous-flow');
|
|
27
|
-
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
28
|
-
const lambdaSharedLib = require('@izara_project/izara-core-library-lambda');
|
|
29
|
-
|
|
30
|
-
const externalRequest = require('@izara_project/izara-core-library-external-request');
|
|
31
|
-
const sns = externalRequest.sns
|
|
32
|
-
|
|
33
|
-
const utils = require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Utils')
|
|
34
|
-
const NoRetryError = require('@izara_project/izara-core-library-core').NoRetryError
|
|
35
|
-
const { v4: uuidv4 } = require('uuid')
|
|
36
|
-
const consts = require('@izara_project/izara-middleware/src/MiddlewareCore/Consts')
|
|
37
|
-
const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
38
|
-
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* description of function.
|
|
42
|
-
* @param {Object} _izContext
|
|
43
|
-
* @param {CorrelationIds} _izContext.correlationIds - property of _izContext
|
|
44
|
-
* @param {Logger} _izContext.logger - property of _izContext
|
|
45
|
-
* @param {Object} requestParams - request params
|
|
46
|
-
* @param {Object} requestParams.identifiers - identifiers for get data
|
|
47
|
-
* @param {Object} requestParams.additionalRequest - additionalRequest
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* @returns {object} description of return value
|
|
51
|
-
*/
|
|
52
|
-
|
|
53
|
-
module.exports.<%- functionMain%> = async (
|
|
54
|
-
_izContext,
|
|
55
|
-
requestParams,
|
|
56
|
-
callingFlowConfig = {},
|
|
57
|
-
//(<additionalParams>)
|
|
58
|
-
//(</additionalParams>)
|
|
59
|
-
) => {
|
|
60
|
-
try {
|
|
61
|
-
//param {
|
|
62
|
-
// "action":register
|
|
63
|
-
// flowTag:"xxx"
|
|
64
|
-
// identifierTask:"xxxx",
|
|
65
|
-
// ...something
|
|
66
|
-
//}
|
|
67
|
-
|
|
68
|
-
// receive flowTag and identifiers
|
|
69
|
-
let flowSchema = await getObjectSchema.getFlowSchemaS3WithCache(_izContext, {
|
|
70
|
-
flowTag: requestParams.flowTag,
|
|
71
|
-
serviceTag: process.env.iz_serviceTag,
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
_izContext.logger.debug("flowSchema", flowSchema)
|
|
75
|
-
if (!flowSchema) {
|
|
76
|
-
throw new NoRetryError(`flowTag not found ${requestParams.flowTag}`)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// get data from dynamoDB of objectType of flowSchema
|
|
80
|
-
const getStoredCache = async (objectType) => {
|
|
81
|
-
const objectSchema = await getObjectSchema.getObjSchemaS3WithCache(
|
|
82
|
-
_izContext,
|
|
83
|
-
{
|
|
84
|
-
objectType: objectType,
|
|
85
|
-
serviceTag: process.env.iz_serviceTag,
|
|
86
|
-
})
|
|
87
|
-
|
|
88
|
-
_izContext.logger.debug("==> objectSchema", objectSchema)
|
|
89
|
-
|
|
90
|
-
// this returns the table name of the first storage resource with storageType "dynamoDB"
|
|
91
|
-
const tableName = Object.values(objectSchema.storageResources).find(
|
|
92
|
-
(storageResource) => storageResource.storageType === "dynamoDB"
|
|
93
|
-
)?.tableName
|
|
94
|
-
_izContext.logger.debug("==> tableName", tableName)
|
|
95
|
-
|
|
96
|
-
// const identifierPK = objectSchema[identifierPK].find(
|
|
97
|
-
// (identifier) => identifier.type === "partitionKey"
|
|
98
|
-
// )?.fieldName
|
|
99
|
-
|
|
100
|
-
// const identifierSK = objectSchema[identifierSK].find(
|
|
101
|
-
// (identifier) => identifier.type === "sortKey"
|
|
102
|
-
// )?.fieldName
|
|
103
|
-
|
|
104
|
-
let identifierPK = null
|
|
105
|
-
let identifierSK = null
|
|
106
|
-
objectSchema.identifiers.map((identifier) => {
|
|
107
|
-
if (identifier.type === "partitionKey") {
|
|
108
|
-
identifierPK = identifier.fieldName
|
|
109
|
-
} else if (identifier.type === "sortKey") {
|
|
110
|
-
identifierSK = identifier.fieldName
|
|
111
|
-
}
|
|
112
|
-
})
|
|
113
|
-
|
|
114
|
-
_izContext.logger.debug("==> identifierPK", identifierPK)
|
|
115
|
-
_izContext.logger.debug("==> identifierSK", identifierSK)
|
|
116
|
-
|
|
117
|
-
const payloadGetStoredCache = {
|
|
118
|
-
[identifierPK]: requestParams.identifiers[identifierPK],
|
|
119
|
-
}
|
|
120
|
-
if (identifierSK) {
|
|
121
|
-
payloadGetStoredCache[identifierSK] = requestParams.identifiers[identifierSK]
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
_izContext.logger.debug("==> payloadGetStoredCache", payloadGetStoredCache)
|
|
125
|
-
|
|
126
|
-
// const getStoredCache = await dynamodbSharedLib.getItem(
|
|
127
|
-
// _izContext,
|
|
128
|
-
// await dynamodbSharedLib.tableName(_izContext, tableName),
|
|
129
|
-
// payloadGetStoredCache
|
|
130
|
-
// )
|
|
131
|
-
|
|
132
|
-
const getStoredCache = await dynamodbSharedLib.query(
|
|
133
|
-
_izContext,
|
|
134
|
-
await dynamodbSharedLib.tableName(_izContext, tableName),
|
|
135
|
-
payloadGetStoredCache
|
|
136
|
-
)
|
|
137
|
-
_izContext.logger.debug("==> getStoredCache:::", getStoredCache)
|
|
138
|
-
return ({
|
|
139
|
-
data: getStoredCache.Items[0],
|
|
140
|
-
identifierPK: identifierPK,
|
|
141
|
-
})
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// Initialize storedCacheData variable that will be used in multiple switch cases
|
|
145
|
-
let storedCacheData = null;
|
|
146
|
-
switch (flowSchema.statusType) {
|
|
147
|
-
case "statusField":
|
|
148
|
-
const payload = {
|
|
149
|
-
identifiers: requestParams.identifiers,
|
|
150
|
-
objectType: flowSchema.objType.objectType
|
|
151
|
-
}
|
|
152
|
-
const result = await externalRequest.lambda.invokeSync(
|
|
153
|
-
_izContext,
|
|
154
|
-
await lambdaSharedLib.lambdaFunctionName(_izContext, "GetHdrInv", flowSchema.objType.serviceTag),
|
|
155
|
-
payload
|
|
156
|
-
)
|
|
157
|
-
if (!result) {
|
|
158
|
-
throw new NoRetryError(`statusField not found ${requestParams.identifiers}`)
|
|
159
|
-
}
|
|
160
|
-
return result
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
case "storedCache":
|
|
164
|
-
// if statusType=storedCache then query storedCache > post message to client -> remove connectionId if status = error || complete
|
|
165
|
-
|
|
166
|
-
storedCacheData = await getStoredCache(flowSchema.objType.objectType)
|
|
167
|
-
_izContext.logger.debug("==> storedCacheData", storedCacheData)
|
|
168
|
-
|
|
169
|
-
if (!storedCacheData) {
|
|
170
|
-
throw new NoRetryError(`storedCache not found ${requestParams.identifiers} ${requestParams.sortKey}`)
|
|
171
|
-
}
|
|
172
|
-
let payloadPostMessage = {
|
|
173
|
-
identifierTask: requestParams.identifiers[storedCacheData.identifierPK],
|
|
174
|
-
connectionId: _izContext.correlationIds.get(consts.CONNECTION_ID),
|
|
175
|
-
flowType: {
|
|
176
|
-
flowTag: flowSchema.flowTag,
|
|
177
|
-
serviceTag: process.env.iz_serviceTag,
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
_izContext.logger.debug('==> payloadPostMessage', payloadPostMessage)
|
|
182
|
-
if (storedCacheData.data.cacheStatus !== "error" && storedCacheData.data.cacheStatus != "complete") {
|
|
183
|
-
await dynamodbSharedLib.putItem(
|
|
184
|
-
_izContext,
|
|
185
|
-
await dynamodbSharedLib.tableName(_izContext, "FlowTagRegisterRecords"),
|
|
186
|
-
payloadPostMessage
|
|
187
|
-
)
|
|
188
|
-
|
|
189
|
-
return payloadPostMessage;
|
|
190
|
-
} else {
|
|
191
|
-
await dynamodbSharedLib.deleteItem(
|
|
192
|
-
_izContext,
|
|
193
|
-
await dynamodbSharedLib.tableName(_izContext, "FlowTagRegisterRecords"),
|
|
194
|
-
{
|
|
195
|
-
identifierTask: requestParams.identifiers[storedCacheData.identifierPK],
|
|
196
|
-
connectionId: _izContext.correlationIds.get(consts.CONNECTION_ID)
|
|
197
|
-
}
|
|
198
|
-
)
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
return storedCacheData;
|
|
202
|
-
|
|
203
|
-
case "none":
|
|
204
|
-
// if statusType=none -> post message to client ---- not remove connectionId when post message, can remove connectionId when cannot use connectionId only(user disconnect)
|
|
205
|
-
storedCacheData = await getStoredCache(flowSchema.objType.objectType)
|
|
206
|
-
|
|
207
|
-
_izContext.logger.debug("==> objectSchema", storedCacheData)
|
|
208
|
-
if (!storedCacheData) {
|
|
209
|
-
throw new NoRetryError(`none not found ${requestParams.identifiers}`)
|
|
210
|
-
}
|
|
211
|
-
return storedCacheData
|
|
212
|
-
|
|
213
|
-
default:
|
|
214
|
-
throw new NoRetryError(`statusType not found ${flowSchema.statusType}`)
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// post result to connectionId
|
|
218
|
-
} catch (err) {
|
|
219
|
-
_izContext.logger.error('error WebSocketInvoke: ', err)
|
|
220
|
-
throw (err)
|
|
221
|
-
}
|
|
222
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright (C) 2020 Sven Mason <http://izara.io>
|
|
3
|
-
|
|
4
|
-
This program is free software: you can redistribute it and/or modify
|
|
5
|
-
it under the terms of the GNU Affero General Public License as
|
|
6
|
-
published by the Free Software Foundation, either version 3 of the
|
|
7
|
-
License, or (at your option) any later version.
|
|
8
|
-
|
|
9
|
-
This program is distributed in the hope that it will be useful,
|
|
10
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12
|
-
GNU Affero General Public License for more details.
|
|
13
|
-
|
|
14
|
-
You should have received a copy of the GNU Affero General Public License
|
|
15
|
-
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
'use strict';
|
|
19
|
-
|
|
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, "./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 queueName = upperCase(flowSchema.flowTag)
|
|
56
|
-
return [
|
|
57
|
-
{
|
|
58
|
-
templatePath: templatePath,
|
|
59
|
-
templateData: {
|
|
60
|
-
queueName: upperCase(queueName),
|
|
61
|
-
roleName: SOURCE_GENERATE_IAM_ROLE.ExternalTopicRole,
|
|
62
|
-
},
|
|
63
|
-
setting: {
|
|
64
|
-
initialData: 'Resources:\n',
|
|
65
|
-
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
66
|
-
saveFileName: SAVE_FILE_NAME.snsOutYaml,
|
|
67
|
-
fileExtension: '.yml',
|
|
68
|
-
isAppend: true
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
]
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
module.exports = data
|
|
@@ -1,8 +0,0 @@
|
|
|
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_resourcePrefix}<%- firstLetterUpperCase(queueName) %>
|
|
7
|
-
|
|
8
|
-
<%_ function firstLetterUpperCase(text) { return text.charAt(0).toUpperCase() + text.slice(1) } _%>
|