@izara_project/izara-market-library-service-schemas 1.0.37 → 1.0.39
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/GenerateCodeLibs/src/GenerateCodeLibs.js +35 -5
- package/src/MainLibs/src/Consts.js +5 -2
- package/src/MainLibs/src/GenerateCodeUtils.js +2 -0
- package/src/MainLibs/src/Utils.js +12 -0
- package/src/reStructure/GenerateCode.js +2 -2
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +36 -11
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +24 -1
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +26 -0
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +22 -0
- package/src/reStructure/TemplateData/EndpointPerService/yaml/data.js +37 -7
- package/src/reStructure/TemplateData/findData/handler/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/template.ejs +2 -0
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/template.ejs +5 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/sns-sqs/data.js +1 -1
- 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/relate/libs/template.ejs +1 -1
- 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/externalTopic/functionYaml/data.js +127 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/handler/data.js +121 -0
- package/src/reStructure/TemplateData/flowSchema/externalTopic/{sqs/handler → handler}/template.ejs +16 -61
- 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 +3 -7
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/data.js +2 -5
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/data.js +13 -4
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/template.ejs +16 -37
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/functionYaml/data.js +2 -4
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/data.js +2 -5
- 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/flowSchemaOwnTopic/flowStep/handler/template.ejs +85 -0
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowStep/mainFunction/data.js +92 -0
- package/src/reStructure/TemplateData/flowSchema/{externalTopic/websocket → flowSchemaOwnTopic/flowStep}/mainFunction/template.ejs +11 -13
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-in/data.js +47 -37
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-out/data.js +23 -26
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/functionYaml/data.js +5 -21
- 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/{FlowSchemaCompleteComponent → webSocketComplete}/mainFunction/data.js +2 -2
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/mainFunction/template.ejs +24 -10
- package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +32 -34
- package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/register/complete/mainFunction/template.ejs +172 -0
- package/src/reStructure/TemplateData/flowSchema/register/wbs/mainFunction/template.ejs +165 -0
- package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → templateBystatusType}/statusFieldTemplate.ejs +0 -5
- package/src/reStructure/TemplateData/flowSchema/templateBystatusType/storedCacheTemplate.ejs +24 -0
- package/src/reStructure/TemplateData/flowSchema/templateBystatusType/triggerCacheTemplate.ejs +20 -0
- package/src/reStructure/TemplateData/perActionComplete/get/mainFunction/template.ejs +3 -0
- package/src/reStructure/TemplateData/perActionComplete/update/mainFunction/template.ejs +3 -0
- 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/complete/functionYaml/data.js +17 -7
- 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/complete/functionYaml/data.js +11 -7
- 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/complete/functionYaml/data.js +12 -7
- 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/complete/functionYaml/data.js +12 -6
- package/src/reStructure/TemplateData/resourceYaml/dynamodb/mainResourcePerObjectSchemaData.js +6 -2
- package/src/reStructure/TemplateData/resourceYaml/filterGenerateResource/data.js +20 -11
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/mainFunction/template.ejs +0 -184
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/storedCacheTemplate.ejs +0 -11
- package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/mainFunction/template.ejs +0 -210
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/data.js +0 -77
- 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 -74
- 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 -85
- package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/data.js +0 -67
- /package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/FlowSchemaCompleteComponent → externalTopic}/functionYaml/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/handler/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/functionYaml/data.js +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}/complete/mainFunction/data.js +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/dynamoDB/register.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/data.js +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/subscriptionOutAll/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/functionYaml/data.js +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/handler/template.ejs +0 -0
- /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/mainFunction/data.js +0 -0
|
@@ -0,0 +1,172 @@
|
|
|
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('@izara_project/izara-shared-core').objectHash;
|
|
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.registerCompleteMain = 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
|
+
// getflowSchema by using send topic name
|
|
65
|
+
// ! didn't got topicName from requestParams complete endpoint must send flowTag with identifiersTask
|
|
66
|
+
|
|
67
|
+
if (!requestParams.flowTag) {
|
|
68
|
+
throw new NoRetryError("not have flowTag in request")
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
let flowSchema = await getObjectSchema.getFlowSchemaS3WithCache(_izContext, {
|
|
72
|
+
flowTag: requestParams.flowTag,
|
|
73
|
+
serviceTag: process.env.iz_serviceTag
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
if (!flowSchema) {
|
|
77
|
+
throw new NoRetryError("not have flowSchema in S3")
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
let correlationId = _izContext.correlationIds.get(consts.X_CORRELATION_ID);
|
|
81
|
+
|
|
82
|
+
const getResult = async (objectType) => {
|
|
83
|
+
const objectSchema = await getObjectSchema.getObjSchemaS3WithCache(
|
|
84
|
+
_izContext,
|
|
85
|
+
{
|
|
86
|
+
objectType: objectType,
|
|
87
|
+
serviceTag: process.env.iz_serviceTag,
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
_izContext.logger.debug("==> objectSchema", objectSchema)
|
|
91
|
+
|
|
92
|
+
const result = await externalRequest.lambda.invokeSync(_izContext,
|
|
93
|
+
await lambdaSharedLib.lambdaFunctionName(_izContext, "GetHdrInv"),
|
|
94
|
+
{
|
|
95
|
+
identifiers: identifiersLibs.identifiersFromIdentifiersConcat(_izContext, objectType, requestParams.identifiersTask),
|
|
96
|
+
objectType: objectType
|
|
97
|
+
}
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
for (const [fieldName, fieldNameSetting] of Object.entries(objectSchema.fieldNames)) {
|
|
101
|
+
if (fieldNameSetting.hasOwnProperty("statusField") && fieldNameSetting.statusField === true) {
|
|
102
|
+
if (fieldName[result] !== "complete" || fieldName[result] !== "error") {
|
|
103
|
+
// if status is not complete or error will save data into table
|
|
104
|
+
await dynamodbSharedLib.putItem(_izContext,
|
|
105
|
+
await dynamodbSharedLib.tableName(_izContext, "RegisterRecord"),
|
|
106
|
+
{
|
|
107
|
+
identifiersTask: requestParams.identifiersTask,
|
|
108
|
+
connecttionId: connecttionId
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
} else {
|
|
112
|
+
if (!result) {
|
|
113
|
+
await generatedCodeLibs.postToConnection({ message: "not have record" }, connecttionId)
|
|
114
|
+
} else {
|
|
115
|
+
await generatedCodeLibs.postToConnection({ message: result }, connecttionId)
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// check statusType
|
|
123
|
+
switch (flowSchema.statusType) {
|
|
124
|
+
case "statusField":
|
|
125
|
+
await getResult(flowSchema.objType.objectType);
|
|
126
|
+
break;
|
|
127
|
+
case "storedCache":
|
|
128
|
+
await getResult(flowSchema.objType.objectType);
|
|
129
|
+
break;
|
|
130
|
+
|
|
131
|
+
case "none":
|
|
132
|
+
|
|
133
|
+
let identifier = {};
|
|
134
|
+
if (requestParams.hasOwnProperty("identifiersField") && Array.isArray(requestParams.identifierisField)) {
|
|
135
|
+
for (const fieldNames of requestParams.identifierisField) {
|
|
136
|
+
Object.assign(identifier, { [fieldNames]: requestParams[fieldNames] })
|
|
137
|
+
}
|
|
138
|
+
identifier = identifier;
|
|
139
|
+
} else {
|
|
140
|
+
identifier = requestParams
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// get task before putItem
|
|
144
|
+
let tasks = await dynamodbSharedLib.query(_izContext,
|
|
145
|
+
await dynamodbSharedLib.tableName(_izContext, "ResgisterRecords"),
|
|
146
|
+
{
|
|
147
|
+
identifiersTask: hash(identifier)
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
if (tasks && tasks.length > 0) {
|
|
151
|
+
await Promise.all(tasks.Items.map(async (task) => {
|
|
152
|
+
await generatedCodeLibs.postToConnection({ message: task }, task.connecttionId)
|
|
153
|
+
}))
|
|
154
|
+
} else {
|
|
155
|
+
await dynamodbSharedLib.putItem(_izContext,
|
|
156
|
+
await dynamodbSharedLib.tableName(_izContext, "RegisterRecords"),
|
|
157
|
+
{
|
|
158
|
+
identifiersTask: hash(identifier),
|
|
159
|
+
connecttionId: connecttionId
|
|
160
|
+
}
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
break
|
|
164
|
+
default:
|
|
165
|
+
throw new NoRetryError(`statusType not found ${getFlowSchema.statusType}`)
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
} catch (err) {
|
|
169
|
+
_izContext.logger.error('error WebSocketInvoke: ', err)
|
|
170
|
+
throw (err)
|
|
171
|
+
}
|
|
172
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
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('@izara_project/izara-shared-core').objectHash;
|
|
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
|
+
const generatedCodeLibs = require('../../../libs/source/GenerateCodeLibs')
|
|
39
|
+
/**
|
|
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
|
+
*
|
|
51
|
+
* @returns {object} description of return value
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
module.exports.registerMain = async (
|
|
55
|
+
_izContext,
|
|
56
|
+
requestParams,
|
|
57
|
+
callingFlowConfig = {},
|
|
58
|
+
//(<additionalParams>)
|
|
59
|
+
//(</additionalParams>)
|
|
60
|
+
) => {
|
|
61
|
+
try {
|
|
62
|
+
let connecttionId = _izContext.correlationIds.get(consts.CONNECTION_ID)
|
|
63
|
+
// receive flowTag and identifiers
|
|
64
|
+
let flowSchema = await getObjectSchema.getFlowSchemaS3WithCache(_izContext, {
|
|
65
|
+
flowTag: requestParams.flowTag,
|
|
66
|
+
serviceTag: process.env.iz_serviceTag,
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
_izContext.logger.debug("flowSchema", flowSchema)
|
|
70
|
+
if (!flowSchema) {
|
|
71
|
+
throw new NoRetryError(`flowTag not found ${requestParams.flowTag}`)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const getResult = async (objectType) => {
|
|
75
|
+
const objectSchema = await getObjectSchema.getObjSchemaS3WithCache(
|
|
76
|
+
_izContext,
|
|
77
|
+
{
|
|
78
|
+
objectType: objectType,
|
|
79
|
+
serviceTag: process.env.iz_serviceTag,
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
_izContext.logger.debug("==> objectSchema", objectSchema)
|
|
83
|
+
|
|
84
|
+
const result = await externalRequest.lambda.invokeSync(_izContext,
|
|
85
|
+
await lambdaSharedLib.lambdaFunctionName(_izContext, "GetHdrInv"),
|
|
86
|
+
{
|
|
87
|
+
identifiers: identifiersLibs.identifiersFromIdentifiersConcat(_izContext, objectType, requestParams.identifiersTask),
|
|
88
|
+
objectType: objectType
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
for (const [fieldName, fieldNameSetting] of Object.entries(objectSchema.fieldNames)) {
|
|
93
|
+
if (fieldNameSetting.hasOwnProperty("statusField") && fieldNameSetting.statusField === true) {
|
|
94
|
+
if (fieldName[result] !== "complete" || fieldName[result] !== "error") {
|
|
95
|
+
// if status is not complete or error will save data into table
|
|
96
|
+
await dynamodbSharedLib.putItem(_izContext,
|
|
97
|
+
await dynamodbSharedLib.tableName(_izContext, "RegisterRecord"),
|
|
98
|
+
{
|
|
99
|
+
identifiersTask: requestParams.identifiersTask,
|
|
100
|
+
connecttionId: connecttionId
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
} else {
|
|
104
|
+
if (!result) {
|
|
105
|
+
await generatedCodeLibs.postToConnection({ message: "not have record" }, connecttionId)
|
|
106
|
+
} else {
|
|
107
|
+
await generatedCodeLibs.postToConnection({ message: result }, connecttionId)
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Initialize storedCacheData variable that will be used in multiple switch cases
|
|
115
|
+
switch (flowSchema.statusType) {
|
|
116
|
+
case "statusField":
|
|
117
|
+
await getResult(flowSchema.objType.objectType)
|
|
118
|
+
break;
|
|
119
|
+
case "storedCache":
|
|
120
|
+
await getResult(flowSchema.objType.objectType)
|
|
121
|
+
break;
|
|
122
|
+
case "none":
|
|
123
|
+
let identifier = {};
|
|
124
|
+
if (requestParams.hasOwnProperty("identifiersField") && Array.isArray(requestParams.identifierisField)) {
|
|
125
|
+
for (const fieldNames of requestParams.identifierisField) {
|
|
126
|
+
Object.assign(identifier, { [fieldNames]: requestParams[fieldNames] })
|
|
127
|
+
}
|
|
128
|
+
identifier = identifier;
|
|
129
|
+
} else {
|
|
130
|
+
identifier = requestParams
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// get task before putItem
|
|
134
|
+
let tasks = await dynamodbSharedLib.query(_izContext,
|
|
135
|
+
await dynamodbSharedLib.tableName(_izContext, "ResgisterRecords"),
|
|
136
|
+
{
|
|
137
|
+
identifiersTask: hash(identifier)
|
|
138
|
+
}
|
|
139
|
+
)
|
|
140
|
+
if (tasks && tasks.length > 0) {
|
|
141
|
+
await Promise.all(tasks.Items.map(async (task) => {
|
|
142
|
+
await generatedCodeLibs.postToConnection({ message: task }, task.connecttionId)
|
|
143
|
+
}))
|
|
144
|
+
} else {
|
|
145
|
+
await dynamodbSharedLib.putItem(_izContext,
|
|
146
|
+
await dynamodbSharedLib.tableName(_izContext, "RegisterRecords"),
|
|
147
|
+
{
|
|
148
|
+
identifiersTask: hash(identifier),
|
|
149
|
+
connecttionId: connecttionId
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
break;
|
|
156
|
+
default:
|
|
157
|
+
throw new NoRetryError(`statusType not found ${flowSchema.statusType}`)
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// post result to connectionId
|
|
161
|
+
} catch (err) {
|
|
162
|
+
_izContext.logger.error('error WebSocketInvoke: ', err)
|
|
163
|
+
throw (err)
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//(<createKeyValuesStoredCacheTable>)
|
|
2
|
+
//(</createKeyValuesStoredCacheTable>)
|
|
3
|
+
|
|
4
|
+
let [ cacheMainStatus, cacheId, cacheMain ] = await storedCacheSharedLib.checkStoredCacheStatus(
|
|
5
|
+
_izContext,
|
|
6
|
+
"<%- tableName %>",
|
|
7
|
+
{
|
|
8
|
+
//(<keyValueStoredCacheTable>)
|
|
9
|
+
//(</keyValueStoredCacheTable>)
|
|
10
|
+
},
|
|
11
|
+
//(<storedCacheConfig>)
|
|
12
|
+
//(</storedCacheConfig>)
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
//(<afterCheckStoredCache>)
|
|
16
|
+
//(</afterCheckStoredCache>)
|
|
17
|
+
|
|
18
|
+
if (cacheMainStatus !== "process") {
|
|
19
|
+
if (cacheMainStatus === "error" || cacheMainStatus === "complete") {
|
|
20
|
+
//(<afterValidateStoredCacheStatus>)
|
|
21
|
+
//(</afterValidateStoredCacheStatus>)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
let [triggerCacheStatus, triggerCache] = await triggeredCacheSharedLib.checkTriggeredCache(
|
|
2
|
+
_izContext,
|
|
3
|
+
<%- tableName %>,
|
|
4
|
+
{
|
|
5
|
+
//(<keyValueTriggerCacheTable>)
|
|
6
|
+
//(</keyValueTriggerCacheTable>)
|
|
7
|
+
},
|
|
8
|
+
//(<triggerCacheConfig>)
|
|
9
|
+
//(</triggerCacheConfig>)
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
//(<afterCheckTriggerCache>)
|
|
13
|
+
//(</afterCheckTriggerCache>)
|
|
14
|
+
|
|
15
|
+
if (triggerCacheStatus !== "process") {
|
|
16
|
+
if (triggerCacheStatus === "error" || triggerCacheStatus === "complete") {
|
|
17
|
+
//(<afterValidateTriggerCacheStatus>)
|
|
18
|
+
//(</afterValidateTriggerCacheStatus>)
|
|
19
|
+
}
|
|
20
|
+
}
|
package/src/reStructure/TemplateData/propertyValueSchema/relationshipPropertyValueSchema/data.js
CHANGED
|
@@ -17,8 +17,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
17
17
|
|
|
18
18
|
'use strict';
|
|
19
19
|
|
|
20
|
-
console.log("=== relationship property value schema ===");
|
|
21
|
-
|
|
22
20
|
const path = require('path');
|
|
23
21
|
const fs = require('fs');
|
|
24
22
|
const {
|
|
@@ -33,7 +31,7 @@ const yaml = require("yaml")
|
|
|
33
31
|
|
|
34
32
|
const objectschemaLocalByPath = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema')
|
|
35
33
|
|
|
36
|
-
const { firstLetterUpperCase: upperCase } = require("../../../../MainLibs/src/Utils");
|
|
34
|
+
const { firstLetterUpperCase: upperCase, getLocalServiceTag } = require("../../../../MainLibs/src/Utils");
|
|
37
35
|
const { createBasicRelationshipsProperties } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/GenerateCodeLibs');
|
|
38
36
|
|
|
39
37
|
async function data(_izContext, settings, srcPath) {
|
|
@@ -84,10 +82,7 @@ function createSourceParams(
|
|
|
84
82
|
const attributeRelationships = [];
|
|
85
83
|
const objectType = objectSchema.objectType; // main objectType
|
|
86
84
|
const storageResources = objectSchema.storageResources // storageResource from main objectType
|
|
87
|
-
const
|
|
88
|
-
const serverlessConfig = fs.readFileSync(configPath, 'utf8');
|
|
89
|
-
const config = yaml.parse(serverlessConfig);
|
|
90
|
-
const serviceTag = config.main_config.iz_serviceTag;
|
|
85
|
+
const serviceTag = getLocalServiceTag(srcPath)
|
|
91
86
|
|
|
92
87
|
attributeRelationships.push(
|
|
93
88
|
{ // has{objectType}propertyValue
|
package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/api/data.js
CHANGED
|
@@ -36,7 +36,8 @@ const {
|
|
|
36
36
|
SOURCE_GENERATE_IAM_ROLE,
|
|
37
37
|
checkDynamoTypeRelationship,
|
|
38
38
|
createDynamoDbComponentByLinks,
|
|
39
|
-
DYNAMO_RESOURCE
|
|
39
|
+
DYNAMO_RESOURCE,
|
|
40
|
+
SQS_RESOURCE
|
|
40
41
|
} = require("../../../../../../../MainLibs").consts;
|
|
41
42
|
|
|
42
43
|
const templatePath = path.join(__dirname, "./template.ejs")
|
|
@@ -70,10 +71,28 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
|
|
|
70
71
|
additionalResourcePermission.push(
|
|
71
72
|
createIamRole(
|
|
72
73
|
{
|
|
73
|
-
[RESOURCE_CLASSES.
|
|
74
|
+
[RESOURCE_CLASSES.sqs]: [
|
|
75
|
+
SQS_RESOURCE.deleteMessage,
|
|
76
|
+
SQS_RESOURCE.getQueueAttributes,
|
|
77
|
+
SQS_RESOURCE.receiveMessage,
|
|
78
|
+
SQS_RESOURCE.sendMessage,
|
|
79
|
+
SQS_RESOURCE.getQueueUrl,
|
|
80
|
+
SQS_RESOURCE.deleteMessageBatch
|
|
81
|
+
],
|
|
74
82
|
},
|
|
75
83
|
[
|
|
76
|
-
resourceNames(RESOURCE_CLASSES.
|
|
84
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
|
|
85
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs) + "DLQ"),
|
|
86
|
+
]
|
|
87
|
+
),
|
|
88
|
+
createIamRole(
|
|
89
|
+
{
|
|
90
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe]
|
|
91
|
+
},
|
|
92
|
+
[
|
|
93
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.createRelComplete) + "_Out"),
|
|
94
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
|
95
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
|
|
77
96
|
]
|
|
78
97
|
)
|
|
79
98
|
)
|
package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/dsq/data.js
CHANGED
|
@@ -67,9 +67,6 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
|
|
|
67
67
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
68
68
|
|
|
69
69
|
additionalResourcePermission.push(
|
|
70
|
-
// createIamRole(
|
|
71
|
-
// { [RESOURCE_CLASSES.lambda]: ["InvokeFunction"] },
|
|
72
|
-
// [resourceNames(RESOURCE_CLASSES.lambda, "*GetNodeHdrInv")]),
|
|
73
70
|
createIamRole(
|
|
74
71
|
{
|
|
75
72
|
[RESOURCE_CLASSES.sqs]: [
|
|
@@ -77,15 +74,23 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
|
|
|
77
74
|
SQS_RESOURCE.getQueueAttributes,
|
|
78
75
|
SQS_RESOURCE.receiveMessage,
|
|
79
76
|
SQS_RESOURCE.sendMessage,
|
|
80
|
-
SQS_RESOURCE.
|
|
81
|
-
SQS_RESOURCE.
|
|
77
|
+
SQS_RESOURCE.getQueueUrl,
|
|
78
|
+
SQS_RESOURCE.deleteMessageBatch
|
|
82
79
|
],
|
|
83
|
-
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
|
|
84
80
|
},
|
|
85
81
|
[
|
|
86
|
-
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.
|
|
87
|
-
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.
|
|
88
|
-
|
|
82
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
|
|
83
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs) + "DLQ"),
|
|
84
|
+
]
|
|
85
|
+
),
|
|
86
|
+
createIamRole(
|
|
87
|
+
{
|
|
88
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe]
|
|
89
|
+
},
|
|
90
|
+
[
|
|
91
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.createRelComplete) + "_Out"),
|
|
92
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
|
93
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
|
|
89
94
|
]
|
|
90
95
|
)
|
|
91
96
|
)
|
package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/inv/data.js
CHANGED
|
@@ -18,7 +18,7 @@ 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 { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
21
|
+
const { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts');
|
|
22
22
|
|
|
23
23
|
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../../MainLibs/index.js").utils;
|
|
24
24
|
const {
|
|
@@ -36,7 +36,8 @@ const {
|
|
|
36
36
|
SOURCE_GENERATE_IAM_ROLE,
|
|
37
37
|
checkDynamoTypeRelationship,
|
|
38
38
|
createDynamoDbComponentByLinks,
|
|
39
|
-
DYNAMO_RESOURCE
|
|
39
|
+
DYNAMO_RESOURCE,
|
|
40
|
+
SQS_RESOURCE
|
|
40
41
|
} = require("../../../../../../../MainLibs/index.js").consts;
|
|
41
42
|
|
|
42
43
|
const templatePath = path.join(__dirname, './template.ejs')
|
|
@@ -68,11 +69,30 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
|
|
|
68
69
|
additionalResourcePermission.push(awaitingMultipleStepsRole())
|
|
69
70
|
|
|
70
71
|
additionalResourcePermission.push(
|
|
71
|
-
createIamRole(
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
createIamRole(
|
|
73
|
+
{
|
|
74
|
+
[RESOURCE_CLASSES.sqs]: [
|
|
75
|
+
SQS_RESOURCE.deleteMessage,
|
|
76
|
+
SQS_RESOURCE.getQueueAttributes,
|
|
77
|
+
SQS_RESOURCE.receiveMessage,
|
|
78
|
+
SQS_RESOURCE.sendMessage,
|
|
79
|
+
SQS_RESOURCE.getQueueUrl,
|
|
80
|
+
SQS_RESOURCE.deleteMessageBatch
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
[
|
|
84
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
|
|
85
|
+
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs) + "DLQ"),
|
|
86
|
+
]
|
|
87
|
+
),
|
|
88
|
+
createIamRole(
|
|
89
|
+
{
|
|
90
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe]
|
|
91
|
+
},
|
|
74
92
|
[
|
|
75
|
-
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.createRelComplete) + "_Out")
|
|
93
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.createRelComplete) + "_Out"),
|
|
94
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
|
95
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
|
|
76
96
|
]
|
|
77
97
|
)
|
|
78
98
|
)
|
package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/sqs/data.js
CHANGED
|
@@ -66,9 +66,6 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
|
|
|
66
66
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
67
67
|
|
|
68
68
|
additionalResourcePermission.push(
|
|
69
|
-
// createIamRole(
|
|
70
|
-
// { [RESOURCE_CLASSES.lambda]: ["InvokeFunction"] },
|
|
71
|
-
// [resourceNames(RESOURCE_CLASSES.lambda, "*GetNodeHdrInv")]),
|
|
72
69
|
createIamRole(
|
|
73
70
|
{
|
|
74
71
|
[RESOURCE_CLASSES.sqs]: [
|
|
@@ -78,18 +75,25 @@ function createParamForCreateSource(allObjectRelationships, srcPath) {
|
|
|
78
75
|
SQS_RESOURCE.sendMessage,
|
|
79
76
|
SQS_RESOURCE.getQueueUrl,
|
|
80
77
|
SQS_RESOURCE.deleteMessageBatch
|
|
81
|
-
],
|
|
82
|
-
[SNS_RESOURCE.publish, SNS_RESOURCE.subscribe]
|
|
78
|
+
],
|
|
83
79
|
},
|
|
84
80
|
[
|
|
85
81
|
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
|
|
86
82
|
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs) + "DLQ"),
|
|
83
|
+
]
|
|
84
|
+
),
|
|
85
|
+
createIamRole(
|
|
86
|
+
{
|
|
87
|
+
[RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe]
|
|
88
|
+
},
|
|
89
|
+
[
|
|
90
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.createRelComplete) + "_Out"),
|
|
87
91
|
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
|
88
92
|
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out"),
|
|
89
|
-
resourceNames(RESOURCE_CLASSES.sns, upperCase(FUNCTION_NAME.createRelComplete) + "_Out")
|
|
90
93
|
]
|
|
91
|
-
)
|
|
94
|
+
)
|
|
92
95
|
)
|
|
96
|
+
|
|
93
97
|
additionalResourcePermission.push(awaitingMultipleStepsRole())
|
|
94
98
|
|
|
95
99
|
for (const relationship of allObjectRelationships) {
|
package/src/reStructure/TemplateData/relationshipPerAction/create/complete/functionYaml/data.js
CHANGED
|
@@ -72,18 +72,28 @@ function createParamForCreateSource(srcPath) {
|
|
|
72
72
|
SQS_RESOURCE.deleteMessageBatch,
|
|
73
73
|
SQS_RESOURCE.getQueueUrl,
|
|
74
74
|
],
|
|
75
|
-
|
|
76
|
-
[
|
|
77
|
-
SNS_RESOURCE.publish, SNS_RESOURCE.subscribe
|
|
78
|
-
]
|
|
75
|
+
|
|
79
76
|
},
|
|
80
77
|
[
|
|
81
78
|
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName)),
|
|
82
79
|
resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + "DLQ"),
|
|
83
|
-
|
|
84
|
-
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out")
|
|
80
|
+
|
|
85
81
|
],
|
|
86
|
-
)
|
|
82
|
+
),
|
|
83
|
+
createIamRole(
|
|
84
|
+
{
|
|
85
|
+
[RESOURCE_CLASSES.sns]:
|
|
86
|
+
[
|
|
87
|
+
SNS_RESOURCE.publish, SNS_RESOURCE.subscribe
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_In"),
|
|
91
|
+
resourceNames(RESOURCE_CLASSES.sns, upperCase(functionName) + "_Out")
|
|
92
|
+
)
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
87
97
|
additionalResourcePermission.push(awaitingMultipleStepsRole())
|
|
88
98
|
|
|
89
99
|
return {
|