@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
|
@@ -49,25 +49,35 @@ function createDataForSubscriptionOutAll(_izContext, allLocalFlowSchemas, srcPat
|
|
|
49
49
|
const result = []
|
|
50
50
|
for (const flowSchema of allLocalFlowSchemas.records) {
|
|
51
51
|
let event = flowSchema.event;
|
|
52
|
-
if (!event.includes("eventBridge")) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
52
|
+
if (!event.includes("eventBridge") || !event.includes("s3")) {
|
|
53
|
+
let flowSteps = flowSchema.flowSteps;
|
|
54
|
+
if (!flowSteps) {
|
|
55
|
+
return result
|
|
56
|
+
}
|
|
57
|
+
let queueName;
|
|
58
|
+
if (flowSchema.outputTopic) {
|
|
59
|
+
let flowStepOut = Object.keys(flowSchema.flowSteps)[1].split("_")
|
|
60
|
+
queueName = flowStepOut[3] + flowStepOut[2]
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (queueName) {
|
|
64
|
+
result.push({
|
|
65
|
+
templatePath: templatePath,
|
|
66
|
+
templateData: {
|
|
67
|
+
queueName: queueName,
|
|
68
|
+
endpoint: "Register",
|
|
69
|
+
firstLetterUpperCase: upperCase,
|
|
70
|
+
},
|
|
71
|
+
setting: {
|
|
72
|
+
initialData: "Resources:\n",
|
|
73
|
+
savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
|
|
74
|
+
saveFileName: SAVE_FILE_NAME.snsInSqsYaml,
|
|
75
|
+
fileExtension: ".yml",
|
|
76
|
+
isAppend: true
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
};
|
|
80
|
+
}
|
|
71
81
|
}
|
|
72
82
|
|
|
73
83
|
return result
|
|
@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
19
19
|
|
|
20
20
|
const path = require('path');
|
|
21
21
|
|
|
22
|
-
const { FLOW_SCHEMA_HOOK_STATE } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
22
|
+
const { FLOW_SCHEMA_HOOK_STATE, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
|
|
23
23
|
|
|
24
24
|
const { firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils");
|
|
25
25
|
const {
|
|
@@ -37,6 +37,7 @@ const {
|
|
|
37
37
|
SOURCE_GENERATE_IAM_ROLE,
|
|
38
38
|
LAMBDA_RESOURCE
|
|
39
39
|
} = require("../../../../../../MainLibs/src/Consts");
|
|
40
|
+
const { getLocalObjectSchemas } = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
|
|
40
41
|
|
|
41
42
|
const templatePath = path.join(__dirname, "template.ejs");
|
|
42
43
|
const hookTemplate = path.join(__dirname, "./hookTemplate.ejs");
|
|
@@ -47,7 +48,7 @@ const hookTemplate = path.join(__dirname, "./hookTemplate.ejs");
|
|
|
47
48
|
* @param {Object} objectSchema
|
|
48
49
|
* @return {{templatePath, templateData,setting}}
|
|
49
50
|
*/
|
|
50
|
-
function data(_izContext, allLocalFlowSchemas, srcPath) {
|
|
51
|
+
async function data(_izContext, allLocalFlowSchemas, srcPath) {
|
|
51
52
|
const handlerType = upperCase("hdrWbs");
|
|
52
53
|
const functionName = FUNCTION_NAME.flowSchemaRegister;
|
|
53
54
|
let functionNameConfig = upperCase(functionName) + upperCase(shortNameHandler(handlerType));
|
|
@@ -90,58 +91,35 @@ function data(_izContext, allLocalFlowSchemas, srcPath) {
|
|
|
90
91
|
)
|
|
91
92
|
)
|
|
92
93
|
|
|
93
|
-
let tableStoredCacheList =
|
|
94
|
-
|
|
94
|
+
let tableStoredCacheList = new Set();
|
|
95
|
+
await Promise.all(allLocalFlowSchemas.records.map(async (flowSchema) => {
|
|
95
96
|
if (flowSchema.statusType === "storedCache") {
|
|
96
|
-
|
|
97
|
+
let objectSchema = await getLocalObjectSchemas(_izContext, [flowSchema.objType.objectType], path.join(srcPath, "./schemas")).then(res => res.records[0]);
|
|
98
|
+
for (const storageResource of Object.values(objectSchema.storageResources)) {
|
|
99
|
+
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
100
|
+
tableStoredCacheList.add(storageResource.tableName);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
97
103
|
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
104
|
+
}))
|
|
105
|
+
if (tableStoredCacheList.size > 0) {
|
|
106
|
+
let tableNames = [...tableStoredCacheList]
|
|
107
|
+
additionalResourcePermission.push(
|
|
108
|
+
createIamRole(
|
|
109
|
+
{
|
|
110
|
+
[RESOURCE_CLASSES.dynamoDbTable]: [
|
|
111
|
+
DYNAMO_RESOURCE.getItem,
|
|
112
|
+
// DYNAMO_RESOURCE.putItem,
|
|
113
|
+
// DYNAMO_RESOURCE.query,
|
|
114
|
+
// DYNAMO_RESOURCE.deleteItem,
|
|
115
|
+
// DYNAMO_RESOURCE.updateItem
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
tableNames.map(tableName => resourceNames(RESOURCE_CLASSES.dynamoDbTable, tableName))
|
|
119
|
+
)
|
|
114
120
|
)
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
// if (flowSchema?.hook) {
|
|
118
|
-
// for (const [hookName, hookProperties] of Object.entries(flowSchema.hook)) {
|
|
119
|
-
// if (hookName === FLOW_SCHEMA_HOOK_STATE.beforeCreate) {
|
|
120
|
-
// for (const hookFunction of hookProperties.functionList) {
|
|
121
|
-
// if ((hookFunction.event.hasOwnProperty("initialEvent") && (hookFunction.event.initialEvent === true))) {
|
|
122
|
-
// if (hookFunction?.permission) {
|
|
123
|
-
// for (const permission of hookFunction.permission) {
|
|
124
|
-
// additionalResourcePermission.push(
|
|
125
|
-
// createIamRole(
|
|
126
|
-
// permission.action,
|
|
127
|
-
// permission.resource.map(resource =>
|
|
128
|
-
// externalResourceYaml(
|
|
129
|
-
// resource.resource,
|
|
130
|
-
// resource.resourceName,
|
|
131
|
-
// resource.serviceTag),
|
|
132
|
-
// permission.effect
|
|
133
|
-
// )
|
|
134
|
-
// )
|
|
135
|
-
// )
|
|
136
|
-
// }
|
|
137
|
-
// }
|
|
138
|
-
// }
|
|
139
|
-
// }
|
|
140
|
-
// }
|
|
141
|
-
// }
|
|
142
|
-
// }
|
|
121
|
+
}
|
|
143
122
|
|
|
144
|
-
// console.log("additionalResourcePermission in createObjectS3", JSON.stringify(additionalResourcePermission))
|
|
145
123
|
return [{
|
|
146
124
|
templatePath: templatePath,
|
|
147
125
|
templateData: {
|
|
@@ -22,7 +22,7 @@ const { middlewareHandler, consts } = require("@izara_project/izara-middleware")
|
|
|
22
22
|
// const api = new AWS.ApiGatewayManagementApi({ endpoint: process.env.iz_webSocketEndpoint });
|
|
23
23
|
const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
|
|
24
24
|
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
25
|
-
const hash = require('
|
|
25
|
+
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
26
26
|
// const coreConsts = require("@izara_project/izara-core-library-core/src/Consts");
|
|
27
27
|
const { postToConnection } = require("../../../libs/source/GenerateCodeLibs");
|
|
28
28
|
const { <%- functionName%>Main } = require("./<%- firstLetterUpperCase(functionName) %>_Main");
|
|
@@ -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,38 @@
|
|
|
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
|
+
|
|
25
|
+
let messageObject = requestParams
|
|
26
|
+
|
|
27
|
+
//(<beforeSendMessage>)
|
|
28
|
+
//(</beforeSendMessage>)
|
|
29
|
+
// create callingFlow
|
|
30
|
+
messageObject = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
|
|
31
|
+
messageObject,
|
|
32
|
+
callingFlowSharedLib.addParentCallingFlowConfig(
|
|
33
|
+
callingFlowConfig,
|
|
34
|
+
callingFlowSharedLib.createCallingFlowConfig(
|
|
35
|
+
await lambdaSharedLib.lambdaFunctionName(_izContext, "<%- flowSchemaComplete %>"), {}
|
|
36
|
+
)
|
|
37
|
+
)
|
|
38
|
+
)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<% if (triggerType === 'storedCache') { %>
|
|
2
|
+
let [mustValidate, validateCache] = await triggeredCacheSharedLib.checkTriggeredCache(
|
|
3
|
+
_izContext,
|
|
4
|
+
<%- tableName %>,
|
|
5
|
+
{
|
|
6
|
+
//(<keyValueTriggerCacheTable>)
|
|
7
|
+
//(</keyValueTriggerCacheTable>)
|
|
8
|
+
},
|
|
9
|
+
//(<triggerCacheConfig>)
|
|
10
|
+
//(</triggerCacheConfig>)
|
|
11
|
+
)
|
|
12
|
+
<% } else if (triggerType === "switch") { %>
|
|
13
|
+
|
|
14
|
+
<% } %>
|
|
15
|
+
|
|
16
|
+
//(<afterCheckTriggerCache>)
|
|
17
|
+
//(</afterCheckTriggerCache>)
|
|
18
|
+
|
|
19
|
+
if (mustValidate !== "process") {
|
|
20
|
+
if (mustValidate === "error" || mustValidate === "complete") {
|
|
21
|
+
//(<afterValidateTriggerCacheStatus>)
|
|
22
|
+
//(</afterValidateTriggerCacheStatus>)
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
let messageObject = requestParams
|
|
27
|
+
|
|
28
|
+
//(<beforeSendMessage>)
|
|
29
|
+
//(</beforeSendMessage>)
|
|
30
|
+
// create callingFlow
|
|
31
|
+
messageObject = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
|
|
32
|
+
messageObject,
|
|
33
|
+
callingFlowSharedLib.addParentCallingFlowConfig(
|
|
34
|
+
callingFlowConfig,
|
|
35
|
+
callingFlowSharedLib.createCallingFlowConfig(
|
|
36
|
+
await lambdaSharedLib.lambdaFunctionName(_izContext, "<%- flowSchemaComplete %>"), {}
|
|
37
|
+
)
|
|
38
|
+
)
|
|
39
|
+
)
|
|
@@ -1,33 +1,4 @@
|
|
|
1
1
|
#IAM Role for Upload Schema functionality
|
|
2
|
-
UploadSchemaRole:
|
|
3
|
-
Type: AWS::IAM::Role
|
|
4
|
-
Properties:
|
|
5
|
-
RoleName: ${self:custom.iz_resourcePrefix}UploadSchemaRole
|
|
6
|
-
AssumeRolePolicyDocument:
|
|
7
|
-
Version: "2012-10-17"
|
|
8
|
-
Statement:
|
|
9
|
-
- Effect: Allow
|
|
10
|
-
Principal:
|
|
11
|
-
Service: "lambda.amazonaws.com"
|
|
12
|
-
Action: sts:AssumeRole
|
|
13
|
-
# this is the managed policy for lambda basic execution ex. logging to cloudwatch
|
|
14
|
-
ManagedPolicyArns:
|
|
15
|
-
- arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
|
|
16
|
-
- arn:aws:iam::${self:custom.iz_accountId}:policy/UploadSchemaSharedPolicy
|
|
17
|
-
Policies:
|
|
18
|
-
- PolicyName: ${self:custom.iz_resourcePrefix}UploadSchemaPolicy
|
|
19
|
-
PolicyDocument:
|
|
20
|
-
Version: "2012-10-17"
|
|
21
|
-
Statement:
|
|
22
|
-
- Effect: Allow
|
|
23
|
-
Action:
|
|
24
|
-
- s3:PutObject
|
|
25
|
-
- s3:GetObject
|
|
26
|
-
- s3:ListBucket
|
|
27
|
-
- s3:DeleteObject
|
|
28
|
-
Resource:
|
|
29
|
-
- arn:aws:s3:::object-schema/*
|
|
30
|
-
- arn:aws:s3:::object-schema/perServiceSchemas/${self:custom.iz_serviceTag}/*
|
|
31
2
|
<% if (roles && roles.length > 0) { -%>
|
|
32
3
|
<% roles.forEach(function(role) { %>
|
|
33
4
|
<%= role.roleName %>Role:
|
|
@@ -21,7 +21,7 @@ const snsSharedLib = require('@izara_project/izara-shared/src/SnsSharedLib');
|
|
|
21
21
|
const sns = require('@izara_project/izara-core-library-external-request/src/resources/Sns');
|
|
22
22
|
const callingFlowSharedLib = require('@izara_project/izara-shared/src/CallingFlowSharedLib');
|
|
23
23
|
const _ = require('lodash');
|
|
24
|
-
const hash = require(
|
|
24
|
+
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
const PREFIX = {
|
|
@@ -21,7 +21,7 @@ const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
|
|
|
21
21
|
const snsSharedLib = require('@izara_project/izara-core-library-sns');
|
|
22
22
|
const sns = require('@izara_project/izara-core-library-external-request/src/resources/Sns');
|
|
23
23
|
const _ = require('lodash');
|
|
24
|
-
const hash = require(
|
|
24
|
+
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
25
25
|
const { TOPIC_NAME_GENERATE_CODE } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
26
26
|
const PREFIX = {
|
|
27
27
|
CREATE_OBJECT_ASYNC: "createObjectAsync",
|
|
@@ -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 asyncFlowSharedLib = require('@izara_project/izara-core-library-asynchronous-flow');
|
|
22
22
|
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
@@ -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 asyncFlowSharedLib = require('@izara_project/izara-core-library-asynchronous-flow');
|
|
22
22
|
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
@@ -116,6 +116,9 @@ module.exports.updateNodeComplete = async (
|
|
|
116
116
|
})
|
|
117
117
|
)
|
|
118
118
|
|
|
119
|
+
//(<beforeReturn>)
|
|
120
|
+
//(</beforeReturn>)
|
|
121
|
+
|
|
119
122
|
return {
|
|
120
123
|
objType: returnValue.objType,
|
|
121
124
|
objInstanceFull: returnValue.objInstanceFull,
|
|
@@ -16,8 +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(
|
|
20
|
-
|
|
19
|
+
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
21
20
|
const asyncFlowSharedLib = require('@izara_project/izara-core-library-asynchronous-flow');
|
|
22
21
|
const callingFlowSharedLib = require('@izara_project/izara-core-library-calling-flow');
|
|
23
22
|
const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
|
|
@@ -33,6 +32,8 @@ const {
|
|
|
33
32
|
TOPIC_NAME_GRAPH_HANDLER,
|
|
34
33
|
PREFIX
|
|
35
34
|
} = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
|
|
35
|
+
//(<optionalRequire>)
|
|
36
|
+
//(</optionalRequire>)
|
|
36
37
|
|
|
37
38
|
module.exports.updateNodeComplete = async (
|
|
38
39
|
_izContext,
|
|
@@ -115,6 +116,9 @@ module.exports.updateNodeComplete = async (
|
|
|
115
116
|
})
|
|
116
117
|
)
|
|
117
118
|
|
|
119
|
+
//(<beforeReturn>)
|
|
120
|
+
//(</beforeReturn>)
|
|
121
|
+
|
|
118
122
|
return {
|
|
119
123
|
objType: returnValue.objType,
|
|
120
124
|
objInstanceFull: returnValue.objInstanceFull,
|
|
@@ -21,7 +21,7 @@ const externalRequest = require('@izara_project/izara-core-library-external-requ
|
|
|
21
21
|
const lambda = externalRequest.lambda;
|
|
22
22
|
|
|
23
23
|
const inMemoryCacheLib = require('@izara_project/izara-shared/src/InMemoryCacheLib');
|
|
24
|
-
const hash = require('
|
|
24
|
+
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
25
25
|
|
|
26
26
|
async function checkPermission(_izContext, functionName, payload) {
|
|
27
27
|
return await lambda.invokeSync(_izContext, functionName, payload)
|
|
@@ -31,7 +31,7 @@ const serviceConfigLib = require('@izara_project/izara-core-library-service-sche
|
|
|
31
31
|
|
|
32
32
|
const uploadUseCase = require('@izara_project/izara-core-library-service-schemas/src/libs/UploadUseCase')
|
|
33
33
|
|
|
34
|
-
const hash = require(
|
|
34
|
+
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
35
35
|
const NoRetryError = require('@izara_project/izara-core-library-core/src/NoRetryError');
|
|
36
36
|
const path = require('path')
|
|
37
37
|
const schemasPath = path.join(__dirname, '../schemas');
|
|
@@ -29,7 +29,7 @@ const serviceConfigLib = require('@izara_project/izara-core-library-service-sche
|
|
|
29
29
|
|
|
30
30
|
const uploadUseCase = require('@izara_project/izara-core-library-service-schemas/src/libs/UploadUseCase')
|
|
31
31
|
|
|
32
|
-
const hash = require(
|
|
32
|
+
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
33
33
|
const NoRetryError = require('@izara_project/izara-core-library-core/src/NoRetryError');
|
|
34
34
|
const path = require('path')
|
|
35
35
|
const schemasPath = path.join(__dirname, '../schemas');
|
|
@@ -18,7 +18,7 @@ along with this program. If not, see
|
|
|
18
18
|
|
|
19
19
|
'use strict';
|
|
20
20
|
|
|
21
|
-
const hash = require(
|
|
21
|
+
const hash = require('@izara_project/izara-shared-core').objectHash;
|
|
22
22
|
const {
|
|
23
23
|
getObjSchemaS3WithHierarchy,
|
|
24
24
|
} = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
|
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
|
)
|