@izara_project/izara-core-generate-service-code 1.0.5 → 1.0.7
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 +2 -1
- package/src/GenerateTests.js +2 -1
- package/src/TemplateData/EndpointPerService/handler/sqs/template.ejs +1 -1
- package/src/TemplateData/EndpointPerService/mainFunction/create/template.ejs +10 -12
- package/src/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +2 -4
- package/src/TemplateData/EndpointPerService/mainFunction/get/template.ejs +13 -17
- package/src/TemplateData/EndpointPerService/mainFunction/update/template.ejs +4 -5
- package/src/TemplateData/IntTest/generateTests/events/data.js +11 -4
- package/src/TemplateData/IntTest/generateTests/events/templateEvents.ejs +4 -4
- package/src/TemplateData/IntTest/generateTests/pathIntTest/data.js +6 -1
- package/src/TemplateData/IntTest/generateTests/tests/data.js +8 -17
- package/src/TemplateData/IntTest/libs/libs.js +1 -1
- package/src/TemplateData/externalService/lambdaRole/data.js +1 -7
- package/src/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/handler/template.ejs +1 -1
- package/src/TemplateData/flowSchema/generateTemplateData.js +8 -4
- package/src/TemplateData/flowSchema/triggerCacheComponent/triggerCacheComplete/functionYaml/dsq/data.js +134 -0
- package/src/TemplateData/flowSchema/triggerCacheComponent/triggerCacheComplete/functionYaml/{data.js → sqs/data.js} +3 -3
- package/src/TemplateData/flowSchema/triggerCacheComponent/triggerCacheComplete/functionYaml/sqs/template.ejs +21 -0
- package/src/TemplateData/flowSchema/triggerCacheComponent/triggerCacheComplete/handler/dsq/data.js +69 -0
- package/src/TemplateData/flowSchema/triggerCacheComponent/triggerCacheComplete/handler/dsq/template.ejs +104 -0
- package/src/TemplateData/flowSchema/triggerCacheComponent/triggerCacheComplete/handler/{data.js → sqs/data.js} +2 -2
- package/src/TemplateData/flowSchema/triggerCacheComponent/triggerCacheQueue/data.js +3 -0
- package/src/TemplateData/perActionComplete/create/mainFunction/template.ejs +3 -3
- package/src/TemplateData/perActionComplete/delete/mainFunction/template.ejs +2 -2
- package/src/TemplateData/perActionComplete/get/mainFunction/template.ejs +3 -2
- package/src/TemplateData/perActionComplete/update/mainFunction/template.ejs +2 -2
- package/src/TemplateData/relationshipPerAction/changeRelationship/action/mainFunction/template.ejs +1 -2
- package/src/TemplateData/relationshipPerAction/changeRelationship/complete/handler/sqs/template.ejs +1 -1
- package/src/TemplateData/relationshipPerAction/changeRelationship/complete/mainFunction/template.ejs +8 -9
- package/src/TemplateData/relationshipPerAction/create/action/mainFunction/template.ejs +1 -2
- package/src/TemplateData/relationshipPerAction/create/complete/mainFunction/template.ejs +2 -3
- package/src/TemplateData/relationshipPerAction/delete/action/mainFunction/template.ejs +1 -2
- package/src/TemplateData/relationshipPerAction/delete/complete/mainFunction/template.ejs +2 -3
- package/src/TemplateData/relationshipPerAction/get/action/mainFunction/template.ejs +2 -3
- package/src/TemplateData/relationshipPerAction/get/complete/mainFunction/template.ejs +2 -3
- package/src/TemplateData/relationshipPerAction/moveRelationship/action/mainFunction/template.ejs +2 -3
- package/src/TemplateData/relationshipPerAction/moveRelationship/complete/mainFunction/template.ejs +2 -3
- package/src/TemplateData/relationshipPerAction/update/action/mainFunction/template.ejs +2 -3
- package/src/TemplateData/relationshipPerAction/update/complete/mainFunction/template.ejs +2 -3
- package/src/libs/Consts.js +3 -10
- /package/src/TemplateData/flowSchema/triggerCacheComponent/triggerCacheComplete/functionYaml/{template.ejs → dsq/template.ejs} +0 -0
- /package/src/TemplateData/flowSchema/triggerCacheComponent/triggerCacheComplete/handler/{template.ejs → sqs/template.ejs} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@izara_project/izara-core-generate-service-code",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Code for locally generating per service files",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"jest": {
|
|
20
20
|
"testEnvironment": "node"
|
|
21
21
|
},
|
|
22
|
+
"type": "module",
|
|
22
23
|
"dependencies": {
|
|
23
24
|
"@izara_project/izara-core-library-core": "^1.0.31",
|
|
24
25
|
"@izara_project/izara-core-library-service-schemas": "^1.0.108",
|
package/src/GenerateTests.js
CHANGED
|
@@ -111,7 +111,8 @@ async function generateCodeWithTemplate(_izContext, savePath, settings) {
|
|
|
111
111
|
|
|
112
112
|
console.log('upload file to S3');
|
|
113
113
|
|
|
114
|
-
await uploadLib.uploadTos3(
|
|
114
|
+
await uploadLib.uploadTos3(
|
|
115
|
+
join(saveFilePath, `../src/generateIntegrationTest/${serviceTag}`), //intTest path
|
|
115
116
|
{ s3Prefix: settings, serviceTag: serviceTag } // settings
|
|
116
117
|
);
|
|
117
118
|
|
|
@@ -21,7 +21,7 @@ import { middlewareHandler } from "@izara_project/izara-middleware";
|
|
|
21
21
|
import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
|
|
22
22
|
import Logger from '@izara_project/izara-core-library-logger';
|
|
23
23
|
import { recordHandlerSharedLib } from '@izara_project/izara-core-library-record-handler';
|
|
24
|
-
import { validator } from '@izara-core-library-service-schemas';
|
|
24
|
+
import { validator } from '@izara_project/izara-core-library-service-schemas';
|
|
25
25
|
|
|
26
26
|
//(<optionalRequire>)
|
|
27
27
|
//(</optionalRequire>)
|
|
@@ -27,7 +27,7 @@ import snsSharedLib from '@izara_project/izara-core-library-sns';
|
|
|
27
27
|
import asyncFlowSharedLib from '@izara_project/izara-core-library-asynchronous-flow';
|
|
28
28
|
import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
|
|
29
29
|
import lambdaSharedLib from '@izara_project/izara-core-library-lambda';
|
|
30
|
-
import { consts as coreConsts } from '@izara_project/izara-core-library-core';
|
|
30
|
+
import { consts as coreConsts, NoRetryError } from '@izara_project/izara-core-library-core';
|
|
31
31
|
import identifierLib from '@izara_project/izara-core-library-identifiers';
|
|
32
32
|
const { createRandomIdentifier } = identifierLib
|
|
33
33
|
|
|
@@ -38,21 +38,17 @@ import { sns } from '@izara_project/izara-core-library-external-request';
|
|
|
38
38
|
|
|
39
39
|
// ──────────────────────── Service Schemas ────────────────────────
|
|
40
40
|
import { utils, createNodeLib, uploadUseCase, consts, getObjectSchema, identifiersObject, dataDetailsLib } from '@izara_project/izara-core-library-service-schemas';
|
|
41
|
-
const { createObjType } = utils
|
|
42
|
-
const { createDataDetailsLib } = dataDetailsLib
|
|
43
|
-
const { dynamoDbIdentifiersByStorageResource } = identifiersObject
|
|
44
|
-
// ──────────────────────── Graph Service Libraries ────────────────────────
|
|
45
|
-
import graphSharedLibs from '@izara_project/izara-core-library-graph-service';
|
|
46
|
-
|
|
47
|
-
// ──────────────────────── Market Library Service Schemas ────────────────────────
|
|
48
|
-
import { consts as generateCodeConsts, utils as generateCodeUtils } from '@izara_project/izara-core-generate-service-code';
|
|
49
|
-
|
|
41
|
+
const { createObjType, firstLetterUpperCase } = utils;
|
|
42
|
+
const { createDataDetailsLib } = dataDetailsLib;
|
|
43
|
+
const { dynamoDbIdentifiersByStorageResource } = identifiersObject;
|
|
50
44
|
const {
|
|
51
45
|
TOPIC_NAME_GENERATE_CODE,
|
|
52
46
|
TOPIC_NAME_GRAPH_HANDLER
|
|
53
|
-
} =
|
|
47
|
+
} = consts;
|
|
48
|
+
|
|
49
|
+
// ──────────────────────── Graph Service Libraries ────────────────────────
|
|
50
|
+
import graphSharedLibs from '@izara_project/izara-core-library-graph-service';
|
|
54
51
|
|
|
55
|
-
const { firstLetterUpperCase } = generateCodeUtils;
|
|
56
52
|
|
|
57
53
|
//(<optionalRequire>)
|
|
58
54
|
//(</optionalRequire>)
|
|
@@ -110,6 +106,8 @@ export default async function createMain(
|
|
|
110
106
|
if (objectSchema.hasOwnProperty("belongTo") && !targetId) {
|
|
111
107
|
errorsFound.push('not have targetId')
|
|
112
108
|
}
|
|
109
|
+
} else if (objectSchema.generatedBy === "searchResultGenerated") {
|
|
110
|
+
throw new NoRetryError("error searchResultGenerated should not happen here")
|
|
113
111
|
}
|
|
114
112
|
|
|
115
113
|
//(<beforeQuery>)
|
|
@@ -22,12 +22,10 @@ import { consts as coreConsts } from '@izara_project/izara-core-library-core';
|
|
|
22
22
|
// ==================== Core Service Schemas ====================
|
|
23
23
|
import { getObjectSchema, consts, createObjType, dataDetailsLib, identifiersObject } from '@izara_project/izara-core-library-service-schemas'
|
|
24
24
|
const { createDeleteDataDetail } = dataDetailsLib;
|
|
25
|
-
const { dynamoDbIdentifiersByStorageResource } = identifiersObject
|
|
26
|
-
// ==================== Market Service Schemas ====================
|
|
27
|
-
import { consts as generateCodeConsts } from '@izara_project/izara-core-generate-service-code';
|
|
25
|
+
const { dynamoDbIdentifiersByStorageResource } = identifiersObject;
|
|
28
26
|
const {
|
|
29
27
|
TOPIC_NAME_GENERATE_CODE,
|
|
30
|
-
} =
|
|
28
|
+
} = consts;
|
|
31
29
|
|
|
32
30
|
// ==================== Shared Libraries ====================
|
|
33
31
|
import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
/*
|
|
2
2
|
Copyright (C) 2020 Sven Mason <http: //izara.io>
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
*/
|
|
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.
|
|
18
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.
|
|
19
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
|
+
*/
|
|
20
18
|
|
|
21
19
|
// ==================== Izara Core Service Schemas ====================
|
|
22
20
|
import { getObjectSchema, serviceConfig, consts, identifiersObject, utils, dataDetailsLib } from '@izara_project/izara-core-library-service-schemas'
|
|
@@ -29,11 +27,9 @@ const {
|
|
|
29
27
|
createGetDataDetails
|
|
30
28
|
} = dataDetailsLib;
|
|
31
29
|
|
|
32
|
-
import { consts as generateCodeConsts } from '@izara_project/izara-core-generate-service-code'
|
|
33
|
-
|
|
34
30
|
const {
|
|
35
31
|
TOPIC_NAME_GENERATE_CODE,
|
|
36
|
-
} =
|
|
32
|
+
} = consts;
|
|
37
33
|
|
|
38
34
|
|
|
39
35
|
// ==================== Shared Core Libraries ====================
|
|
@@ -18,21 +18,18 @@ along with this program. If not, see
|
|
|
18
18
|
|
|
19
19
|
// ==================== Shared Core Utilities ====================
|
|
20
20
|
import { objectHash as hash } from '@izara_project/izara-shared-core';
|
|
21
|
-
import { consts as coreConsts } from '@izara_project/izara-core-library-core';
|
|
21
|
+
import { consts as coreConsts, NoRetryError } from '@izara_project/izara-core-library-core';
|
|
22
22
|
|
|
23
23
|
// ==================== Core Service Schemas ====================
|
|
24
24
|
import { getObjectSchema, consts, utils, identifiersObject, dataDetailsLib } from '@izara_project/izara-core-library-service-schemas';
|
|
25
25
|
const { createObjType } = utils;
|
|
26
26
|
const { dynamoDbIdentifiersByStorageResource } = identifiersObject;
|
|
27
27
|
const { createUpdateDataDetail } = dataDetailsLib;
|
|
28
|
-
|
|
29
|
-
import { consts as generateCodeConsts } from '@izara_project/izara-core-generate-service-code'
|
|
30
|
-
|
|
31
28
|
const {
|
|
32
29
|
PREFIX,
|
|
33
30
|
TOPIC_NAME_GENERATE_CODE,
|
|
34
31
|
TOPIC_NAME_GRAPH_HANDLER,
|
|
35
|
-
} =
|
|
32
|
+
} = consts;
|
|
36
33
|
|
|
37
34
|
|
|
38
35
|
// ==================== Shared Libraries ====================
|
|
@@ -118,6 +115,8 @@ export default async function updateMain(
|
|
|
118
115
|
if (objectSchema.hasOwnProperty("belongTo") && !targetId) {
|
|
119
116
|
errorsFound.push('not have targetId')
|
|
120
117
|
}
|
|
118
|
+
} else if (objectSchema.generatedBy === "searchResultGenerated") {
|
|
119
|
+
throw new NoRetryError("error searchResultGenerated should not happen here")
|
|
121
120
|
}
|
|
122
121
|
|
|
123
122
|
//(<beforeQuery>)
|
|
@@ -41,7 +41,9 @@ async function data(_izContext, allIntTestConfig, srcPath) {
|
|
|
41
41
|
for (const intTest of allIntTestConfig) {
|
|
42
42
|
for (const [testTag, config] of Object.entries(intTest)) {
|
|
43
43
|
// console.log(testTag, config)
|
|
44
|
-
for (
|
|
44
|
+
for (let stageIdx = 0; stageIdx < config.testStages.length; stageIdx++) {
|
|
45
|
+
let eachStage = config.testStages[stageIdx];
|
|
46
|
+
|
|
45
47
|
let inputEventTag = eachStage.eventTag;
|
|
46
48
|
let outputEventTag = `Output_${inputEventTag}`;
|
|
47
49
|
|
|
@@ -57,6 +59,10 @@ async function data(_izContext, allIntTestConfig, srcPath) {
|
|
|
57
59
|
)
|
|
58
60
|
};
|
|
59
61
|
|
|
62
|
+
if (stageIdx === 0) {
|
|
63
|
+
inputConfig.snsSqsTrigger = true
|
|
64
|
+
}
|
|
65
|
+
|
|
60
66
|
let outputConfig = {
|
|
61
67
|
forStageMatching: true,
|
|
62
68
|
...setEvent(
|
|
@@ -71,9 +77,9 @@ async function data(_izContext, allIntTestConfig, srcPath) {
|
|
|
71
77
|
// console.log("have dynamoConfig", inputEventTag, eachStage.dynamoDBConfig)
|
|
72
78
|
for (const dynamoDBConfig of eachStage.dynamoDBConfig) {
|
|
73
79
|
let eventDynamo = {
|
|
74
|
-
keyValues: dynamoDBConfig.dynamoEvent.identifiers,
|
|
75
80
|
forStageMatching: true,
|
|
76
|
-
|
|
81
|
+
keyValues: dynamoDBConfig.dynamoEvent.identifiers,
|
|
82
|
+
...setEvent(
|
|
77
83
|
dynamoDBConfig.dynamoEvent.fields,
|
|
78
84
|
dynamoDBConfig.dynamoEventSettings
|
|
79
85
|
)
|
|
@@ -106,6 +112,7 @@ async function data(_izContext, allIntTestConfig, srcPath) {
|
|
|
106
112
|
});
|
|
107
113
|
}
|
|
108
114
|
}
|
|
115
|
+
|
|
109
116
|
createEventSources.push({
|
|
110
117
|
templatePath: templatePath,
|
|
111
118
|
templateData: {
|
|
@@ -130,7 +137,7 @@ async function data(_izContext, allIntTestConfig, srcPath) {
|
|
|
130
137
|
}
|
|
131
138
|
}
|
|
132
139
|
}
|
|
133
|
-
|
|
140
|
+
// console.log("createEventSources", JSON.stringify(createEventSources, null, 2))
|
|
134
141
|
return createEventSources;
|
|
135
142
|
}
|
|
136
143
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"<%- inputEventTag %>": <%- JSON.stringify(inputConfig, null, 2) %>,
|
|
3
|
-
"<%- outputEventTag %>": <%- JSON.stringify(outputConfig, null, 2) %>
|
|
3
|
+
"<%- outputEventTag %>": <%- JSON.stringify(outputConfig, null, 2) %> <%- eventDynamos.length ? "," : "" -%>
|
|
4
4
|
<% eventDynamos.forEach((eventDynamo,idx) => { %>
|
|
5
|
-
"<%- eventDynamo.eventTag %>": <%- JSON.stringify(eventDynamo.event,null,2) %>
|
|
6
|
-
<% }) %>
|
|
5
|
+
"<%- eventDynamo.eventTag %>": <%- JSON.stringify(eventDynamo.event,null,2) %> <%- idx < eventDynamos.length - 1 ? ",": "" -%>
|
|
6
|
+
<% }) %> <%- eventInvokes.length ? "," : "" -%>
|
|
7
7
|
<% eventInvokes.forEach((invokeEventComponent,index) => { %>
|
|
8
8
|
"<%- invokeEventComponent.inputInvokeName %>": <%- JSON.stringify(invokeEventComponent.inputInvoke,null,2) %>,
|
|
9
|
-
"<%- invokeEventComponent.outputInvokeName %>": <%- JSON.stringify(invokeEventComponent.outputInvoke,null,2)
|
|
9
|
+
"<%- invokeEventComponent.outputInvokeName %>": <%- JSON.stringify(invokeEventComponent.outputInvoke,null,2) %><%- index < eventInvokes.length - 1 ? ",": "" -%>
|
|
10
10
|
<% }) %>
|
|
11
11
|
}
|
|
@@ -25,12 +25,17 @@ const { bucketPathForUpload } = uploadIntTest;
|
|
|
25
25
|
|
|
26
26
|
async function data(_izContext, srcPath, settings) {
|
|
27
27
|
// console.log('settingsInData', settings);
|
|
28
|
+
let intTestPaths = [];
|
|
29
|
+
|
|
28
30
|
let pathIntTestInBuckets = await bucketPathForUpload(
|
|
29
31
|
join(srcPath, `../../src/generateIntegrationTest/${settings.serviceTag}`),
|
|
30
32
|
settings
|
|
31
33
|
);
|
|
32
34
|
// console.log({ pathIntTestInBuckets });
|
|
33
|
-
|
|
35
|
+
if (!pathIntTestInBuckets || pathIntTestInBuckets.length === 0) {
|
|
36
|
+
return []
|
|
37
|
+
}
|
|
38
|
+
|
|
34
39
|
for (const pathIntTestInBucket of pathIntTestInBuckets) {
|
|
35
40
|
if (pathIntTestInBucket.key.endsWith(".json")) {
|
|
36
41
|
let path = pathIntTestInBucket.key.replace(/(events|tests|resources|dynamoDBSeedDataTags|graphSeedDataTags).json$/, '/');
|
|
@@ -60,11 +60,10 @@ async function data(_izContext, allIntTestConfig, srcPath) {
|
|
|
60
60
|
// 'testConfig.seedDataConfig[seedDataTag]',
|
|
61
61
|
// testConfig.seedDataConfig[seedDataTag]
|
|
62
62
|
// );
|
|
63
|
-
if (
|
|
64
|
-
testConfig.seedDataConfig.hasOwnProperty(seedDataTag) &&
|
|
65
|
-
testConfig.seedDataConfig[seedDataTag].length > 0
|
|
66
|
-
) {
|
|
63
|
+
if (testConfig.seedDataConfig.hasOwnProperty(seedDataTag) && testConfig.seedDataConfig[seedDataTag].length > 0) {
|
|
67
64
|
baseIntTest[seedDataTag] = testConfig.seedDataConfig[seedDataTag];
|
|
65
|
+
} else {
|
|
66
|
+
baseIntTest[seedDataTag] = [];
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
69
|
}
|
|
@@ -158,25 +157,17 @@ async function data(_izContext, allIntTestConfig, srcPath) {
|
|
|
158
157
|
);
|
|
159
158
|
if (dynamoEventStage.length > 0) {
|
|
160
159
|
// baseIntTest.stage[currentStageIdx]["dynamodbOutputEventIdentifiers"] = dynamoEventStage;
|
|
161
|
-
stages[currentStageIdx]['dynamodbOutputEventIdentifiers'] =
|
|
162
|
-
dynamoEventStage;
|
|
160
|
+
stages[currentStageIdx]['dynamodbOutputEventIdentifiers'] = dynamoEventStage;
|
|
163
161
|
}
|
|
164
162
|
}
|
|
165
163
|
|
|
166
164
|
// generatedSeedData
|
|
167
|
-
if (
|
|
168
|
-
|
|
169
|
-
Object.keys(stage.generatedSeedData).length > 0
|
|
170
|
-
) {
|
|
171
|
-
for (const generateSeedType of Object.values(
|
|
172
|
-
GENERATE_SEED_DATA_TYPE
|
|
173
|
-
)) {
|
|
165
|
+
if (stage.generatedSeedData && Object.keys(stage.generatedSeedData).length > 0) {
|
|
166
|
+
for (const generateSeedType of Object.values(GENERATE_SEED_DATA_TYPE)) {
|
|
174
167
|
if (stage.generatedSeedData.hasOwnProperty(generateSeedType)) {
|
|
175
168
|
// baseIntTest.stage[currentStageIdx]["generateSeedDatas"] = {
|
|
176
|
-
stages[currentStageIdx]['
|
|
177
|
-
[generateSeedType]: [
|
|
178
|
-
...stage.generatedSeedData[generateSeedType]
|
|
179
|
-
]
|
|
169
|
+
stages[currentStageIdx]['generateSeedData'] = {
|
|
170
|
+
[generateSeedType]: [...stage.generatedSeedData[generateSeedType]]
|
|
180
171
|
};
|
|
181
172
|
}
|
|
182
173
|
}
|
|
@@ -107,6 +107,7 @@ function setEvent(input, settings = {}) {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
if (isEqual.includes(key)) {
|
|
110
|
+
field.forStageMatching = true;
|
|
110
111
|
field.isEqual = true;
|
|
111
112
|
}
|
|
112
113
|
|
|
@@ -301,7 +302,6 @@ function createEventCaseByHandler(handler, messageAttributes = {}) {
|
|
|
301
302
|
[HANDLER.hdrDsq]: { DirectSqs: true },
|
|
302
303
|
[HANDLER.hdrInv]: {},
|
|
303
304
|
[HANDLER.hdrSqs]: {
|
|
304
|
-
snsSqsTrigger: true,
|
|
305
305
|
...(messageAttributes && Object.keys(messageAttributes).length > 0
|
|
306
306
|
? { messageAttributes: setEventMessageAttributes(messageAttributes) }
|
|
307
307
|
: {})
|
|
@@ -45,13 +45,7 @@ const {
|
|
|
45
45
|
|
|
46
46
|
const templatePath = path.join(__dirname, 'template.ejs');
|
|
47
47
|
|
|
48
|
-
const createExternalLambdaRole = async (
|
|
49
|
-
_izContext,
|
|
50
|
-
allObjSchemas,
|
|
51
|
-
allRelSchemas,
|
|
52
|
-
allLocalFlowSchemas,
|
|
53
|
-
srcPath
|
|
54
|
-
) => {
|
|
48
|
+
const createExternalLambdaRole = async (_izContext, allObjSchemas, allRelSchemas, allLocalFlowSchemas, srcPath) => {
|
|
55
49
|
// console.log("allRelationshipSchemas", allRelationshipSchemas);
|
|
56
50
|
const externalLambdaIamRoleArray = [];
|
|
57
51
|
// per action external lambda role
|
package/src/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/handler/template.ejs
CHANGED
|
@@ -22,7 +22,7 @@ import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
|
|
|
22
22
|
import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
|
|
23
23
|
import { objectHash as hash } from '@izara_project/izara-shared-core';
|
|
24
24
|
import { postToConnection } from '../../../libs/source/GenerateCodeLibs.js';
|
|
25
|
-
import
|
|
25
|
+
import <%- functionName %> from './<%- functionName %>_Main.js';
|
|
26
26
|
import { utils, getObjectSchema } from "@izara_project/izara-core-library-service-schemas";
|
|
27
27
|
const { createFlowTypeConcat } = utils
|
|
28
28
|
|
|
@@ -133,21 +133,25 @@ import createFlowSchemaRegisterDynamoDb from './register/dynamoDB/register.js';
|
|
|
133
133
|
|
|
134
134
|
import createProcessTriggerCacheYaml from './triggerCacheComponent/processTriggerCache/functionYaml/data.js';
|
|
135
135
|
import createCheckTriggerCacheYaml from './triggerCacheComponent/checkTriggerCacheComplete/functionYaml/data.js';
|
|
136
|
-
import
|
|
136
|
+
import createTriggerCacheCompleteYamlSqs from './triggerCacheComponent/triggerCacheComplete/functionYaml/sqs/data.js';
|
|
137
|
+
import createTriggerCacheCompleteYamlDsq from './triggerCacheComponent/triggerCacheComplete/functionYaml/dsq/data.js';
|
|
137
138
|
const createFlowSchemaTriggerCacheFunctionYaml = {
|
|
138
139
|
createProcessTriggerCacheYaml,
|
|
139
140
|
createCheckTriggerCacheYaml,
|
|
140
|
-
|
|
141
|
+
createTriggerCacheCompleteYamlSqs,
|
|
142
|
+
createTriggerCacheCompleteYamlDsq
|
|
141
143
|
};
|
|
142
144
|
|
|
143
145
|
import createProcessTriggerCacheHandler from './triggerCacheComponent/processTriggerCache/handler/data.js';
|
|
144
146
|
import createCheckTriggerCacheHandler from './triggerCacheComponent/checkTriggerCacheComplete/handler/data.js';
|
|
145
|
-
import
|
|
147
|
+
import createTriggerCacheCompleteHandlerSqs from './triggerCacheComponent/triggerCacheComplete/handler/sqs/data.js';
|
|
148
|
+
import createTriggerCacheCompleteHandlerDsq from './triggerCacheComponent/triggerCacheComplete/handler/dsq/data.js';
|
|
146
149
|
|
|
147
150
|
const createFlowSchemaTriggerCacheHandler = {
|
|
148
151
|
createProcessTriggerCacheHandler,
|
|
149
152
|
createCheckTriggerCacheHandler,
|
|
150
|
-
|
|
153
|
+
createTriggerCacheCompleteHandlerSqs,
|
|
154
|
+
createTriggerCacheCompleteHandlerDsq
|
|
151
155
|
};
|
|
152
156
|
|
|
153
157
|
import createProcessTriggerCacheMainFunction from './triggerCacheComponent/processTriggerCache/mainFunction/data.js';
|
|
@@ -0,0 +1,134 @@
|
|
|
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
|
+
import path from 'path';
|
|
19
|
+
import { fileURLToPath } from 'url';
|
|
20
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
21
|
+
const __dirname = path.dirname(__filename);
|
|
22
|
+
import { NoRetryError } from '@izara_project/izara-core-library-core';
|
|
23
|
+
import { getObjectSchema } from '@izara_project/izara-core-library-service-schemas';
|
|
24
|
+
import consts from '../../../../../../libs/Consts.js';
|
|
25
|
+
import utils from '../../../../../../libs/Utils.js';
|
|
26
|
+
import libs from '../../../../../../libs/Libs.js';
|
|
27
|
+
|
|
28
|
+
const {
|
|
29
|
+
SOURCE_PATH,
|
|
30
|
+
SAVE_FILE_NAME,
|
|
31
|
+
HANDLER,
|
|
32
|
+
RESOURCE_CLASSES,
|
|
33
|
+
SQS_RESOURCE,
|
|
34
|
+
DYNAMO_RESOURCE,
|
|
35
|
+
STORAGE_TYPES
|
|
36
|
+
} = consts;
|
|
37
|
+
const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = utils;
|
|
38
|
+
const {
|
|
39
|
+
awaitingMultipleStepsRole,
|
|
40
|
+
resourceNames,
|
|
41
|
+
defaultIamRolePerAction,
|
|
42
|
+
createIamRole,
|
|
43
|
+
shortNameHandler
|
|
44
|
+
} = libs;
|
|
45
|
+
const templatePath = path.join(__dirname, './template.ejs');
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* receive objectSchema
|
|
49
|
+
*
|
|
50
|
+
* @param {Object} objectSchema
|
|
51
|
+
* @return {{templatePath, templateData,setting}}
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
async function data(_izContext, flowSchema, srcPath) {
|
|
55
|
+
return [await createSourceParams(_izContext, flowSchema, srcPath)];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
59
|
+
let functionName =
|
|
60
|
+
'TriggerCache' + upperCase(flowSchema.flowTag) + 'Complete';
|
|
61
|
+
let handlerType = upperCase(HANDLER.hdrDsq);
|
|
62
|
+
let additionalResourcePermission = defaultIamRolePerAction();
|
|
63
|
+
let queueName =
|
|
64
|
+
'TriggerCache' + upperCase(flowSchema.flowTag) + 'Complete' + handlerType;
|
|
65
|
+
|
|
66
|
+
additionalResourcePermission.push(
|
|
67
|
+
createIamRole(
|
|
68
|
+
{
|
|
69
|
+
[RESOURCE_CLASSES.sqs]: Object.values(SQS_RESOURCE)
|
|
70
|
+
},
|
|
71
|
+
[
|
|
72
|
+
resourceNames(RESOURCE_CLASSES.sqs, queueName),
|
|
73
|
+
resourceNames(RESOURCE_CLASSES.sqs, queueName + 'DLQ')
|
|
74
|
+
]
|
|
75
|
+
)
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
let tableTriggerCache = new Set();
|
|
79
|
+
let objectSchema = await getObjectSchema
|
|
80
|
+
.getLocalObjectSchemas(
|
|
81
|
+
_izContext,
|
|
82
|
+
[flowSchema.objType.objectType],
|
|
83
|
+
path.join(srcPath, './schemas')
|
|
84
|
+
)
|
|
85
|
+
.then(res => res.records[0]);
|
|
86
|
+
if (!objectSchema) {
|
|
87
|
+
throw new NoRetryError('ObjectSchema not found');
|
|
88
|
+
}
|
|
89
|
+
for (const storageResource of Object.values(objectSchema.storageResources)) {
|
|
90
|
+
if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
|
|
91
|
+
if (!tableTriggerCache.has(storageResource.tableName)) {
|
|
92
|
+
tableTriggerCache.add(storageResource.tableName);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
additionalResourcePermission.push(
|
|
98
|
+
createIamRole(
|
|
99
|
+
{
|
|
100
|
+
[RESOURCE_CLASSES.dynamoDbTable]: Object.values(DYNAMO_RESOURCE)
|
|
101
|
+
},
|
|
102
|
+
[...tableTriggerCache].map(tableName =>
|
|
103
|
+
resourceNames(RESOURCE_CLASSES.dynamoDbTable, tableName)
|
|
104
|
+
)
|
|
105
|
+
)
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
additionalResourcePermission.push(awaitingMultipleStepsRole());
|
|
109
|
+
return {
|
|
110
|
+
templatePath: templatePath,
|
|
111
|
+
templateData: {
|
|
112
|
+
resourceLocation: path.join(
|
|
113
|
+
SOURCE_PATH.resourceLocationFlowSchema,
|
|
114
|
+
upperCase(flowSchema.flowTag),
|
|
115
|
+
'source/'
|
|
116
|
+
),
|
|
117
|
+
functionName,
|
|
118
|
+
handlerType,
|
|
119
|
+
additionalResourcePermission,
|
|
120
|
+
functionNameConfig:
|
|
121
|
+
upperCase(functionName) + upperCase(shortNameHandler(handlerType)),
|
|
122
|
+
roleName: upperCase(flowSchema.flowTag),
|
|
123
|
+
queueName
|
|
124
|
+
},
|
|
125
|
+
setting: {
|
|
126
|
+
savePath: path.join(srcPath, SOURCE_PATH.appYaml),
|
|
127
|
+
saveFileName: upperCase(SAVE_FILE_NAME.flowSchema),
|
|
128
|
+
fileExtension: '.yml',
|
|
129
|
+
isAppend: true
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export default data;
|
|
@@ -21,9 +21,9 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
21
21
|
const __dirname = path.dirname(__filename);
|
|
22
22
|
import { NoRetryError } from '@izara_project/izara-core-library-core';
|
|
23
23
|
import { getObjectSchema } from '@izara_project/izara-core-library-service-schemas';
|
|
24
|
-
import consts from '
|
|
25
|
-
import utils from '
|
|
26
|
-
import libs from '
|
|
24
|
+
import consts from '../../../../../../libs/Consts.js';
|
|
25
|
+
import utils from '../../../../../../libs/Utils.js';
|
|
26
|
+
import libs from '../../../../../../libs/Libs.js';
|
|
27
27
|
|
|
28
28
|
const {
|
|
29
29
|
SOURCE_PATH,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<%_ const join = require('path').join; _%>
|
|
2
|
+
<%- firstLetterUpperCase(functionNameConfig) %>:
|
|
3
|
+
handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`)%>
|
|
4
|
+
name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
|
|
5
|
+
role: <%- roleName %>Role
|
|
6
|
+
#<#<%- functionName %><%- handlerType %>FunctionSetting#>
|
|
7
|
+
#<#/<%- functionName %><%- handlerType %>FunctionSetting#>
|
|
8
|
+
events:
|
|
9
|
+
- sqs:
|
|
10
|
+
arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- queueName %>
|
|
11
|
+
batchSize: 10
|
|
12
|
+
filterPatterns: #**** need to update serverless framework upper v.2.69.1
|
|
13
|
+
- body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%- functionName %>"]}}} # functionName of callingFlow
|
|
14
|
+
- body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
|
|
15
|
+
|
|
16
|
+
<%_ function firstLetterUpperCase(text){
|
|
17
|
+
return text.charAt(0).toUpperCase() + text.slice(1)
|
|
18
|
+
} _%>
|
|
19
|
+
<%_ function firstLetterLowerCase(str) {
|
|
20
|
+
return str.charAt(0).toLowerCase() + str.slice(1)
|
|
21
|
+
} _%>
|
package/src/TemplateData/flowSchema/triggerCacheComponent/triggerCacheComplete/handler/dsq/data.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
import path from 'path';
|
|
19
|
+
import { fileURLToPath } from 'url';
|
|
20
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
21
|
+
const __dirname = path.dirname(__filename);
|
|
22
|
+
import consts from '../../../../../../libs/Consts.js';
|
|
23
|
+
import utils from '../../../../../../libs/Utils.js';
|
|
24
|
+
const { SOURCE_PATH, HANDLER } = consts;
|
|
25
|
+
const {
|
|
26
|
+
firstLetterLowerCase: lowerCase,
|
|
27
|
+
firstLetterUpperCase: upperCase,
|
|
28
|
+
getLocalConfig
|
|
29
|
+
} = utils;
|
|
30
|
+
const templatePath = path.join(__dirname, 'template.ejs');
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* receive objectSchema
|
|
34
|
+
*
|
|
35
|
+
* @param {Object} objectSchema
|
|
36
|
+
* @return {{templatePath, templateData,setting}}
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
function data(_izContext, flowSchema, srcPath) {
|
|
40
|
+
return [createSourceParams(_izContext, flowSchema, srcPath)];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function createSourceParams(_izContext, flowSchema, srcPath) {
|
|
44
|
+
let functionName =
|
|
45
|
+
'TriggerCache' + upperCase(flowSchema.flowTag) + 'Complete';
|
|
46
|
+
let handlerType = upperCase(HANDLER.hdrDsq);
|
|
47
|
+
let queueName = 'TriggerCache' + upperCase(flowSchema.flowTag) + 'Complete' + handlerType;
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
templatePath: templatePath,
|
|
51
|
+
templateData: {
|
|
52
|
+
functionName,
|
|
53
|
+
queueName
|
|
54
|
+
},
|
|
55
|
+
setting: {
|
|
56
|
+
savePath: path.join(
|
|
57
|
+
srcPath,
|
|
58
|
+
SOURCE_PATH.flowSchema,
|
|
59
|
+
upperCase(flowSchema.flowTag),
|
|
60
|
+
'source/'
|
|
61
|
+
),
|
|
62
|
+
saveFileName: `${upperCase(functionName)}_${upperCase(handlerType)}`,
|
|
63
|
+
fileExtension: '.js',
|
|
64
|
+
isAppend: true
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export default data;
|
|
@@ -0,0 +1,104 @@
|
|
|
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
|
+
|
|
19
|
+
|
|
20
|
+
import { middlewareHandler as middleware } from "@izara_project/izara-middleware";
|
|
21
|
+
import Logger from '@izara_project/izara-core-library-logger';
|
|
22
|
+
import { recordHandlerSharedLib } from "@izara_project/izara-core-library-record-handler";
|
|
23
|
+
import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
|
|
24
|
+
|
|
25
|
+
import <%- functionName %> from './<%- functionName %>_Main.js';
|
|
26
|
+
|
|
27
|
+
// validate event properties in body.Message of sqs event
|
|
28
|
+
let perRecordsValidatorSchema = {
|
|
29
|
+
//(<validatorSchema>)
|
|
30
|
+
//(</validatorSchema>)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema(
|
|
34
|
+
{
|
|
35
|
+
type: "object",
|
|
36
|
+
required: ['body', 'messageAttributes'],
|
|
37
|
+
properties: {
|
|
38
|
+
body: {
|
|
39
|
+
type: 'object',
|
|
40
|
+
},
|
|
41
|
+
messageAttributes: {
|
|
42
|
+
type: 'object'
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}));
|
|
46
|
+
|
|
47
|
+
middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
|
|
48
|
+
|
|
49
|
+
export const main = middleware.wrap(async (event, context, callback) => {
|
|
50
|
+
|
|
51
|
+
try {
|
|
52
|
+
|
|
53
|
+
let recordPromises = [];
|
|
54
|
+
|
|
55
|
+
// loop each record and send to mainFunction
|
|
56
|
+
await Promise.all(event.Records.map(async record => { // promise.all for map() function
|
|
57
|
+
|
|
58
|
+
let passOnProperties = []
|
|
59
|
+
record = recordHandlerSharedLib.reformatDsqMessage(record._izContext, record);
|
|
60
|
+
record._izContext.logger.debug('record ReceiveMsgOutHdrSqs', record);
|
|
61
|
+
|
|
62
|
+
//validate message (and MessageAttributes)
|
|
63
|
+
await recordHandlerSharedLib.validateRecord(
|
|
64
|
+
record, // one record will send to mainFunction
|
|
65
|
+
"<%- queueName %>", // queue name that need to retry or send to dlq
|
|
66
|
+
perRecordsValidatorSchema, // schema for record.Message
|
|
67
|
+
// messageAttributeValidatorSchema // ----- for msgAttr default is null -> do not send this parameter if not want to validate msgAtt
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
// add argument (to invoke lambda) to passOnProperties[]
|
|
71
|
+
passOnProperties.push(record.body.Message)
|
|
72
|
+
//(<additionalParams>)
|
|
73
|
+
//(</additionalParams>)
|
|
74
|
+
passOnProperties.push(callingFlowSharedLib.addCallingFlowToPassOnProperties(record.body.Message));
|
|
75
|
+
record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
|
|
76
|
+
|
|
77
|
+
// call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
|
|
78
|
+
let recordPromise = recordHandlerSharedLib.recordHandler(
|
|
79
|
+
record, // one record will send to mainFunction
|
|
80
|
+
<%- functionName %>, // mainFunction that need to invoke.
|
|
81
|
+
"<%- queueName %>", // queue name that need to retry or send to dlq
|
|
82
|
+
passOnProperties, // all parameters that mainFunction needed.
|
|
83
|
+
);
|
|
84
|
+
record._izContext.logger.debug('after recordPromise in handler');
|
|
85
|
+
recordPromises.push(recordPromise); // push promise to recordPromises
|
|
86
|
+
}))
|
|
87
|
+
|
|
88
|
+
Logger.debug('before Promise.all(recordPromises) in handler');
|
|
89
|
+
try {
|
|
90
|
+
// --- main await all promises
|
|
91
|
+
await Promise.all(recordPromises); // await all promises
|
|
92
|
+
|
|
93
|
+
return event.Records // return all for local testing
|
|
94
|
+
|
|
95
|
+
} catch {
|
|
96
|
+
Logger.debug('Promise.all(recordPromises) in handler threw error (at least one record did no resolve)');
|
|
97
|
+
}
|
|
98
|
+
Logger.debug('after Promise.all(recordPromises) in handler');
|
|
99
|
+
|
|
100
|
+
} catch (err) {
|
|
101
|
+
Logger.error('Unhandled Error, LambdaFunctionHdrSqs: ', err);
|
|
102
|
+
throw (err);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
@@ -19,8 +19,8 @@ import path from 'path';
|
|
|
19
19
|
import { fileURLToPath } from 'url';
|
|
20
20
|
const __filename = fileURLToPath(import.meta.url);
|
|
21
21
|
const __dirname = path.dirname(__filename);
|
|
22
|
-
import consts from '
|
|
23
|
-
import utils from '
|
|
22
|
+
import consts from '../../../../../../libs/Consts.js';
|
|
23
|
+
import utils from '../../../../../../libs/Utils.js';
|
|
24
24
|
const { SOURCE_PATH, HANDLER } = consts;
|
|
25
25
|
const {
|
|
26
26
|
firstLetterLowerCase: lowerCase,
|
|
@@ -66,6 +66,9 @@ function createDataForDefaultSnsInSqs(_izContext, flowSchema, srcPath) {
|
|
|
66
66
|
},
|
|
67
67
|
{
|
|
68
68
|
queueName: 'TriggerCache' + upperCase(flowTag) + 'Complete' + upperCase(HANDLER.hdrSqs)
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
queueName: 'TriggerCache' + upperCase(flowTag) + 'Complete' + upperCase(HANDLER.hdrDsq)
|
|
69
72
|
}
|
|
70
73
|
];
|
|
71
74
|
|
|
@@ -22,8 +22,8 @@ import snsSharedLib from '@izara_project/izara-core-library-sns';
|
|
|
22
22
|
import { sns } from '@izara_project/izara-core-library-external-request';
|
|
23
23
|
import _ from 'lodash';
|
|
24
24
|
import { objectHash as hash } from '@izara_project/izara-shared-core';
|
|
25
|
-
import { consts
|
|
26
|
-
const { TOPIC_NAME_GENERATE_CODE
|
|
25
|
+
import { consts } from '@izara_project/izara-core-library-service-schemas';
|
|
26
|
+
const { TOPIC_NAME_GENERATE_CODE } = consts;
|
|
27
27
|
const PREFIX = {
|
|
28
28
|
CREATE_OBJECT_ASYNC: "createObjectAsync",
|
|
29
29
|
CREATE_OBJECT_ASYNC_COMPLETE: "createObjectAsyncComplete"
|
|
@@ -41,7 +41,7 @@ const PREFIX = {
|
|
|
41
41
|
* @param {*} passBackProperties
|
|
42
42
|
*/
|
|
43
43
|
|
|
44
|
-
export default async function createObjectComplete
|
|
44
|
+
export default async function createObjectComplete(
|
|
45
45
|
_izContext,
|
|
46
46
|
returnValue,
|
|
47
47
|
status,
|
|
@@ -21,8 +21,8 @@ import snsSharedLib from '@izara_project/izara-core-library-sns';
|
|
|
21
21
|
|
|
22
22
|
import { sns } from "@izara_project/izara-core-library-external-request";
|
|
23
23
|
|
|
24
|
-
import { consts
|
|
25
|
-
const { TOPIC_NAME_GENERATE_CODE
|
|
24
|
+
import { consts } from '@izara_project/izara-core-library-service-schemas';
|
|
25
|
+
const { TOPIC_NAME_GENERATE_CODE } = consts;
|
|
26
26
|
|
|
27
27
|
//(<optionalRequire>)
|
|
28
28
|
//(</optionalRequire>)
|
|
@@ -20,9 +20,10 @@ import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow
|
|
|
20
20
|
import snsSharedLib from '@izara_project/izara-core-library-sns';
|
|
21
21
|
|
|
22
22
|
import { sns } from "@izara_project/izara-core-library-external-request";
|
|
23
|
-
import { consts as generateCodeConsts } from '@izara_project/izara-core-generate-service-code'
|
|
24
23
|
|
|
25
|
-
|
|
24
|
+
import { consts } from '@izara_project/izara-core-library-service-schemas';
|
|
25
|
+
const { TOPIC_NAME_GENERATE_CODE, PREFIX } = consts;
|
|
26
|
+
|
|
26
27
|
import { objectHash as hash } from '@izara_project/izara-shared-core';
|
|
27
28
|
|
|
28
29
|
import asyncFlowSharedLib from '@izara_project/izara-core-library-asynchronous-flow';
|
|
@@ -24,8 +24,8 @@ import asyncFlowSharedLib from '@izara_project/izara-core-library-asynchronous-f
|
|
|
24
24
|
import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
|
|
25
25
|
import { sns } from "@izara_project/izara-core-library-external-request";
|
|
26
26
|
|
|
27
|
-
import { consts
|
|
28
|
-
const { TOPIC_NAME_GENERATE_CODE
|
|
27
|
+
import { consts } from '@izara_project/izara-core-library-service-schemas';
|
|
28
|
+
const { TOPIC_NAME_GENERATE_CODE } = consts;
|
|
29
29
|
|
|
30
30
|
//(<optionalRequire>)
|
|
31
31
|
//(</optionalRequire>)
|
package/src/TemplateData/relationshipPerAction/changeRelationship/action/mainFunction/template.ejs
CHANGED
|
@@ -42,12 +42,11 @@ const { getGraphServiceTagWithCache } = serviceConfig;
|
|
|
42
42
|
|
|
43
43
|
const { findLinksByObjTypes } = relSchemaLib;
|
|
44
44
|
|
|
45
|
-
import { consts as generateCodeConsts } from '@izara_project/izara-core-generate-service-code';
|
|
46
45
|
const {
|
|
47
46
|
PREFIX,
|
|
48
47
|
TOPIC_NAME_GENERATE_CODE,
|
|
49
48
|
TOPIC_NAME_GRAPH_HANDLER
|
|
50
|
-
} =
|
|
49
|
+
} = consts;
|
|
51
50
|
|
|
52
51
|
import { consts as coreConsts } from '@izara_project/izara-core-library-core';
|
|
53
52
|
|
package/src/TemplateData/relationshipPerAction/changeRelationship/complete/handler/sqs/template.ejs
CHANGED
|
@@ -99,7 +99,7 @@ export const main = middleware.wrap(async (event, context) => {
|
|
|
99
99
|
// call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
|
|
100
100
|
let recordPromise = recordHandlerSharedLib.recordHandler(
|
|
101
101
|
record, // one record will send to mainFunction
|
|
102
|
-
changeRelationshipComplete
|
|
102
|
+
changeRelationshipComplete, // mainFunction that need to invoke.
|
|
103
103
|
"ChangeRelationshipComplete", // queue name that need to retry or send to dlq
|
|
104
104
|
passOnProperties, // all parameters that mainFunction needed.
|
|
105
105
|
);
|
package/src/TemplateData/relationshipPerAction/changeRelationship/complete/mainFunction/template.ejs
CHANGED
|
@@ -24,14 +24,13 @@ import dynamodbSharedLib from "@izara_project/izara-core-library-dynamodb";
|
|
|
24
24
|
import asyncFlowSharedLib from "@izara_project/izara-core-library-asynchronous-flow";
|
|
25
25
|
|
|
26
26
|
import { sns } from "@izara_project/izara-core-library-external-request";
|
|
27
|
-
import { utils } from '@izara_project/izara-core-library-service-schemas';
|
|
27
|
+
import { utils, consts } from '@izara_project/izara-core-library-service-schemas';
|
|
28
28
|
const { createLinkTypeId } = utils;
|
|
29
|
-
import { consts as generateCodeConsts } from '@izara_project/izara-core-generate-service-code';
|
|
30
29
|
|
|
31
30
|
const {
|
|
32
31
|
TOPIC_NAME_GENERATE_CODE,
|
|
33
32
|
PREFIX
|
|
34
|
-
} =
|
|
33
|
+
} = consts;
|
|
35
34
|
|
|
36
35
|
//(<optionalRequire>)
|
|
37
36
|
//(</optionalRequire>)
|
|
@@ -56,8 +55,8 @@ export default async function changeRelationshipComplete(
|
|
|
56
55
|
// start create awaitingStepId
|
|
57
56
|
const linkTypeId = createLinkTypeId(
|
|
58
57
|
_izContext,
|
|
59
|
-
returnValue.requestParams.
|
|
60
|
-
returnValue.requestParams.
|
|
58
|
+
returnValue.requestParams.firstObject.objType,
|
|
59
|
+
returnValue.requestParams.secondObject.objType,
|
|
61
60
|
returnValue.requestParams.newRelType,
|
|
62
61
|
returnValue.requestParams.oldRelTypeAndDirection.relationshipDirection
|
|
63
62
|
);
|
|
@@ -67,8 +66,8 @@ export default async function changeRelationshipComplete(
|
|
|
67
66
|
linkTypeId,
|
|
68
67
|
graphServiceTag: graphServiceTag,
|
|
69
68
|
callingFlowProperties: passBackProperties.passBackProperties.parentPassBackProperties.callingFlowProperties || {},
|
|
70
|
-
firstObject: returnValue.requestParams.
|
|
71
|
-
secondObject: returnValue.requestParams.
|
|
69
|
+
firstObject: returnValue.requestParams.firstObject,
|
|
70
|
+
secondObject: returnValue.requestParams.secondObject,
|
|
72
71
|
oldRelTypeAndDirection: returnValue.requestParams.oldRelTypeAndDirection,
|
|
73
72
|
newRelType: returnValue.requestParams.newRelType,
|
|
74
73
|
}), // hash id
|
|
@@ -98,8 +97,8 @@ export default async function changeRelationshipComplete(
|
|
|
98
97
|
_izContext.logger.debug("finished all awaitingStep");
|
|
99
98
|
|
|
100
99
|
let createCompleteMsg = {
|
|
101
|
-
firstObject: returnValue.requestParams.
|
|
102
|
-
secondObject: returnValue.requestParams.
|
|
100
|
+
firstObject: returnValue.requestParams.firstObject,
|
|
101
|
+
secondObject: returnValue.requestParams.secondObject,
|
|
103
102
|
relType: returnValue.requestParams.relType,
|
|
104
103
|
oldRelTypeAndDirection: returnValue.requestParams.oldRelTypeAndDirection,
|
|
105
104
|
newRelType: returnValue.requestParams.newRelType,
|
|
@@ -40,12 +40,11 @@ const {
|
|
|
40
40
|
getGraphServiceTagWithCache
|
|
41
41
|
} = serviceConfig;
|
|
42
42
|
|
|
43
|
-
import { consts as generateCodeConsts } from '@izara_project/izara-core-generate-service-code';
|
|
44
43
|
const {
|
|
45
44
|
PREFIX,
|
|
46
45
|
TOPIC_NAME_GENERATE_CODE,
|
|
47
46
|
TOPIC_NAME_GRAPH_HANDLER
|
|
48
|
-
} =
|
|
47
|
+
} = consts;
|
|
49
48
|
|
|
50
49
|
|
|
51
50
|
//(<optionalRequire>)
|
|
@@ -24,14 +24,13 @@ import dynamodbSharedLib from "@izara_project/izara-core-library-dynamodb";
|
|
|
24
24
|
import asyncFlowSharedLib from "@izara_project/izara-core-library-asynchronous-flow";
|
|
25
25
|
|
|
26
26
|
import { sns } from "@izara_project/izara-core-library-external-request";
|
|
27
|
-
import { utils } from '@izara_project/izara-core-library-service-schemas';
|
|
27
|
+
import { utils, consts } from '@izara_project/izara-core-library-service-schemas';
|
|
28
28
|
const { createLinkTypeId } = utils;
|
|
29
|
-
import { consts as generateCodeConsts } from '@izara_project/izara-core-generate-service-code';
|
|
30
29
|
|
|
31
30
|
const {
|
|
32
31
|
TOPIC_NAME_GENERATE_CODE,
|
|
33
32
|
PREFIX
|
|
34
|
-
} =
|
|
33
|
+
} = consts;
|
|
35
34
|
|
|
36
35
|
//(<optionalRequire>)
|
|
37
36
|
//(</optionalRequire>)
|
|
@@ -40,12 +40,11 @@ const {
|
|
|
40
40
|
getGraphServiceTagWithCache
|
|
41
41
|
} = serviceConfig;
|
|
42
42
|
|
|
43
|
-
import { consts as generateCodeConsts } from '@izara_project/izara-core-generate-service-code';
|
|
44
43
|
const {
|
|
45
44
|
PREFIX,
|
|
46
45
|
TOPIC_NAME_GENERATE_CODE,
|
|
47
46
|
TOPIC_NAME_GRAPH_HANDLER
|
|
48
|
-
} =
|
|
47
|
+
} = consts;
|
|
49
48
|
|
|
50
49
|
//(<optionalRequire>)
|
|
51
50
|
//(</optionalRequire>)
|
|
@@ -24,14 +24,13 @@ import dynamodbSharedLib from "@izara_project/izara-core-library-dynamodb";
|
|
|
24
24
|
import asyncFlowSharedLib from "@izara_project/izara-core-library-asynchronous-flow";
|
|
25
25
|
|
|
26
26
|
import { sns } from "@izara_project/izara-core-library-external-request";
|
|
27
|
-
import { utils } from '@izara_project/izara-core-library-service-schemas';
|
|
27
|
+
import { utils, consts } from '@izara_project/izara-core-library-service-schemas';
|
|
28
28
|
const { createLinkTypeId } = utils;
|
|
29
|
-
import { consts as generateCodeConsts } from '@izara_project/izara-core-generate-service-code';
|
|
30
29
|
|
|
31
30
|
const {
|
|
32
31
|
TOPIC_NAME_GENERATE_CODE,
|
|
33
32
|
PREFIX
|
|
34
|
-
} =
|
|
33
|
+
} = consts;
|
|
35
34
|
|
|
36
35
|
//(<optionalRequire>)
|
|
37
36
|
//(</optionalRequire>)
|
|
@@ -25,7 +25,7 @@ import snsSharedLib from "@izara_project/izara-core-library-sns";
|
|
|
25
25
|
import asyncFlowSharedLib from "@izara_project/izara-core-library-asynchronous-flow";
|
|
26
26
|
import dynamodbSharedLib from "@izara_project/izara-core-library-dynamodb";
|
|
27
27
|
|
|
28
|
-
import { sns,lambda } from "@izara_project/izara-core-library-external-request";
|
|
28
|
+
import { sns, lambda } from "@izara_project/izara-core-library-external-request";
|
|
29
29
|
|
|
30
30
|
import { getObjectSchema, utils, serviceConfig, consts, relSchemaLib, identifiersObject } from '@izara_project/izara-core-library-service-schemas'
|
|
31
31
|
const { findLinksByObjTypes } = relSchemaLib;
|
|
@@ -43,12 +43,11 @@ const {
|
|
|
43
43
|
getGraphServiceTagWithCache
|
|
44
44
|
} = serviceConfig;
|
|
45
45
|
|
|
46
|
-
import { consts as generateCodeConsts } from '@izara_project/izara-core-generate-service-code';
|
|
47
46
|
const {
|
|
48
47
|
PREFIX,
|
|
49
48
|
TOPIC_NAME_GENERATE_CODE,
|
|
50
49
|
TOPIC_NAME_GRAPH_HANDLER
|
|
51
|
-
} =
|
|
50
|
+
} = consts;
|
|
52
51
|
|
|
53
52
|
import { consts as coreConsts } from '@izara_project/izara-core-library-core';
|
|
54
53
|
|
|
@@ -24,14 +24,13 @@ import dynamodbSharedLib from "@izara_project/izara-core-library-dynamodb";
|
|
|
24
24
|
import asyncFlowSharedLib from "@izara_project/izara-core-library-asynchronous-flow";
|
|
25
25
|
|
|
26
26
|
import { sns } from "@izara_project/izara-core-library-external-request";
|
|
27
|
-
import { utils } from '@izara_project/izara-core-library-service-schemas';
|
|
27
|
+
import { utils, consts } from '@izara_project/izara-core-library-service-schemas';
|
|
28
28
|
const { createLinkTypeId } = utils;
|
|
29
|
-
import { consts as generateCodeConsts } from '@izara_project/izara-core-generate-service-code';
|
|
30
29
|
|
|
31
30
|
const {
|
|
32
31
|
TOPIC_NAME_GENERATE_CODE,
|
|
33
32
|
PREFIX
|
|
34
|
-
} =
|
|
33
|
+
} = consts;
|
|
35
34
|
|
|
36
35
|
//(<optionalRequire>)
|
|
37
36
|
//(</optionalRequire>)
|
package/src/TemplateData/relationshipPerAction/moveRelationship/action/mainFunction/template.ejs
CHANGED
|
@@ -24,7 +24,7 @@ import snsSharedLib from "@izara_project/izara-core-library-sns";
|
|
|
24
24
|
import asyncFlowSharedLib from "@izara_project/izara-core-library-asynchronous-flow";
|
|
25
25
|
import dynamodbSharedLib from "@izara_project/izara-core-library-dynamodb";
|
|
26
26
|
|
|
27
|
-
import { sns,lambda } from "@izara_project/izara-core-library-external-request";
|
|
27
|
+
import { sns, lambda } from "@izara_project/izara-core-library-external-request";
|
|
28
28
|
|
|
29
29
|
import { getObjectSchema, utils, serviceConfig, consts, relSchemaLib, identifiersObject } from '@izara_project/izara-core-library-service-schemas'
|
|
30
30
|
const { findLinksByObjTypes } = relSchemaLib;
|
|
@@ -42,12 +42,11 @@ const {
|
|
|
42
42
|
getGraphServiceTagWithCache
|
|
43
43
|
} = serviceConfig;
|
|
44
44
|
|
|
45
|
-
import { consts as generateCodeConsts } from '@izara_project/izara-core-generate-service-code';
|
|
46
45
|
const {
|
|
47
46
|
PREFIX,
|
|
48
47
|
TOPIC_NAME_GENERATE_CODE,
|
|
49
48
|
TOPIC_NAME_GRAPH_HANDLER
|
|
50
|
-
} =
|
|
49
|
+
} = consts;
|
|
51
50
|
|
|
52
51
|
import { consts as coreConsts } from '@izara_project/izara-core-library-core';
|
|
53
52
|
|
package/src/TemplateData/relationshipPerAction/moveRelationship/complete/mainFunction/template.ejs
CHANGED
|
@@ -24,14 +24,13 @@ import dynamodbSharedLib from "@izara_project/izara-core-library-dynamodb";
|
|
|
24
24
|
import asyncFlowSharedLib from "@izara_project/izara-core-library-asynchronous-flow";
|
|
25
25
|
|
|
26
26
|
import { sns } from "@izara_project/izara-core-library-external-request";
|
|
27
|
-
import { utils } from '@izara_project/izara-core-library-service-schemas';
|
|
27
|
+
import { utils, consts } from '@izara_project/izara-core-library-service-schemas';
|
|
28
28
|
const { createLinkTypeId } = utils;
|
|
29
|
-
import { consts as generateCodeConsts } from '@izara_project/izara-core-generate-service-code';
|
|
30
29
|
|
|
31
30
|
const {
|
|
32
31
|
TOPIC_NAME_GENERATE_CODE,
|
|
33
32
|
PREFIX
|
|
34
|
-
} =
|
|
33
|
+
} = consts;
|
|
35
34
|
|
|
36
35
|
//(<optionalRequire>)
|
|
37
36
|
//(</optionalRequire>)
|
|
@@ -25,7 +25,7 @@ import snsSharedLib from "@izara_project/izara-core-library-sns";
|
|
|
25
25
|
import asyncFlowSharedLib from "@izara_project/izara-core-library-asynchronous-flow";
|
|
26
26
|
import dynamodbSharedLib from "@izara_project/izara-core-library-dynamodb";
|
|
27
27
|
|
|
28
|
-
import { sns,lambda } from "@izara_project/izara-core-library-external-request";
|
|
28
|
+
import { sns, lambda } from "@izara_project/izara-core-library-external-request";
|
|
29
29
|
|
|
30
30
|
import { getObjectSchema, utils, serviceConfig, consts, relSchemaLib, identifiersObject } from '@izara_project/izara-core-library-service-schemas'
|
|
31
31
|
const { findLinksByObjTypes } = relSchemaLib;
|
|
@@ -43,12 +43,11 @@ const {
|
|
|
43
43
|
getGraphServiceTagWithCache
|
|
44
44
|
} = serviceConfig;
|
|
45
45
|
|
|
46
|
-
import { consts as generateCodeConsts } from '@izara_project/izara-core-generate-service-code';
|
|
47
46
|
const {
|
|
48
47
|
PREFIX,
|
|
49
48
|
TOPIC_NAME_GENERATE_CODE,
|
|
50
49
|
TOPIC_NAME_GRAPH_HANDLER
|
|
51
|
-
} =
|
|
50
|
+
} = consts;
|
|
52
51
|
|
|
53
52
|
import { consts as coreConsts } from '@izara_project/izara-core-library-core';
|
|
54
53
|
|
|
@@ -24,14 +24,13 @@ import dynamodbSharedLib from "@izara_project/izara-core-library-dynamodb";
|
|
|
24
24
|
import asyncFlowSharedLib from "@izara_project/izara-core-library-asynchronous-flow";
|
|
25
25
|
|
|
26
26
|
import { sns } from "@izara_project/izara-core-library-external-request";
|
|
27
|
-
import { utils } from '@izara_project/izara-core-library-service-schemas';
|
|
27
|
+
import { utils, consts } from '@izara_project/izara-core-library-service-schemas';
|
|
28
28
|
const { createLinkTypeId } = utils;
|
|
29
|
-
import { consts as generateCodeConsts } from '@izara_project/izara-core-generate-service-code';
|
|
30
29
|
|
|
31
30
|
const {
|
|
32
31
|
TOPIC_NAME_GENERATE_CODE,
|
|
33
32
|
PREFIX
|
|
34
|
-
} =
|
|
33
|
+
} = consts;
|
|
35
34
|
|
|
36
35
|
//(<optionalRequire>)
|
|
37
36
|
//(</optionalRequire>)
|
package/src/libs/Consts.js
CHANGED
|
@@ -275,15 +275,9 @@ const GENERATE_SEED_DATA_TYPE = {
|
|
|
275
275
|
|
|
276
276
|
const SEED_DATA_TAG = {
|
|
277
277
|
dynamoDBSeedDataTags: "dynamoDBSeedDataTags",
|
|
278
|
-
graphSeedDataTags: "graphSeedDataTags"
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
const FLOW_SCHEMA_EVENT_TYPE = {
|
|
283
|
-
s3: "s3",
|
|
284
|
-
ownTopic: "ownTopic",
|
|
285
|
-
extTopic: "extTopic",
|
|
286
|
-
eventBridge: "eventBridge",
|
|
278
|
+
graphSeedDataTags: "graphSeedDataTags",
|
|
279
|
+
cleaningeDynamoOneRecordsTags: "cleaningeDynamoOneRecordsTags",
|
|
280
|
+
cleaningeDynamoManyRecordsTags: "cleaningeDynamoManyRecordsTags"
|
|
287
281
|
}
|
|
288
282
|
|
|
289
283
|
const DEFAULT_LAMBDA_ROLE_PER_ACTION = {
|
|
@@ -417,7 +411,6 @@ export default {
|
|
|
417
411
|
ADD_ON_DATA_STRUCTURE_TYPE,
|
|
418
412
|
ATTRIBUTE_TAG,
|
|
419
413
|
PROPERTY_VALUE_TAG,
|
|
420
|
-
FLOW_SCHEMA_EVENT_TYPE,
|
|
421
414
|
GENERATE_SEED_DATA_TYPE,
|
|
422
415
|
SEED_DATA_TAG,
|
|
423
416
|
TOPIC_NAME_GENERATE_CODE,
|
|
File without changes
|