@izara_project/izara-core-generate-service-code 1.0.50 → 1.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/generateResources/IntTest/generateTests/pathIntTest/pathIntTest.js +1 -1
- package/src/generateResources/IntTest/upload/uploadIntTest.js +1 -1
- package/src/generators/fromFlowSchema/env/template.ejs +5 -0
- package/src/generators/fromFlowSchema/env/yaml.js +73 -0
- package/src/generators/fromFlowSchema/events/extTopic/process/handler/handler.js +0 -1
- package/src/generators/fromFlowSchema/events/lambdaSyncApi/handler/handler.js +0 -1
- package/src/generators/fromFlowSchema/events/lambdaSyncInv/handler/handler.js +0 -1
- package/src/generators/fromFlowSchema/events/ownTopic/endpoint/functionYaml/yaml.js +13 -11
- package/src/generators/fromFlowSchema/events/ownTopic/endpoint/handler/handler.js +0 -2
- package/src/generators/fromFlowSchema/events/ownTopic/flowSchema/handler/handler.js +0 -1
- package/src/generators/fromFlowSchema/events/ownTopic/flowSchema/mainFunction/main.js +0 -1
- package/src/generators/fromFlowSchema/flowSchemaMainFunction/main.js +0 -1
- package/src/generators/fromFlowSchema/flowStep/flowStep.js +2 -3
- package/src/generators/fromFlowSchema/index.js +10 -0
- package/src/generators/fromFlowSchema/webSocket/webSocketComplete/functionYaml/yaml.js +0 -2
- package/src/generators/fromObjectSchema/endpointComplete/create/yaml/yaml.js +31 -5
- package/src/generators/fromObjectSchema/endpointComplete/index.js +25 -4
- package/src/generators/fromObjectSchema/endpointComplete/update/yaml/yaml.js +32 -4
- package/src/generators/fromObjectSchema/index.js +1 -1
- package/src/generators/fromObjectSchema/relationship/create/action/mainFunction/template.ejs +7 -1
- package/src/generators/fromPlugIn/afterFirstFlowStep/recievePlugIn/handler/handler.js +1 -2
- package/src/generators/fromPlugIn/afterFirstFlowStep/recievePlugIn/mainFunction/main.js +1 -2
- package/src/generators/fromPlugIn/afterFirstFlowStep/recievePlugIn/yaml/yaml.js +4 -1
- package/src/generators/fromPlugIn/byConfig/handler/handler.js +1 -2
- package/src/generators/fromPlugIn/byConfig/mainFunction/main.js +1 -2
- package/src/generators/fromPlugIn/firstFlowStep/handler/handler.js +1 -2
- package/src/generators/fromPlugIn/firstFlowStep/mainFunction/main.js +1 -2
- package/src/generators/fromPlugIn/index.js +0 -1
- package/src/libs/Utils.js +0 -2
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.51",
|
|
4
4
|
"description": "Code for locally generating per service files",
|
|
5
5
|
"homepage": "https://bitbucket.org/izara-core-support-services/izara-core-support-services-generate-service-code#readme",
|
|
6
6
|
"repository": {
|
|
@@ -38,7 +38,7 @@ async function data(_izContext, srcPath, settings) {
|
|
|
38
38
|
|
|
39
39
|
for (const pathIntTestInBucket of pathIntTestInBuckets) {
|
|
40
40
|
if (pathIntTestInBucket.key.endsWith(".json")) {
|
|
41
|
-
let path = pathIntTestInBucket.key.replace(/(events|tests|resources|dynamoDBSeedDataTags|graphSeedDataTags).json$/,
|
|
41
|
+
let path = pathIntTestInBucket.key.replace(/(events|tests|resources|dynamoDBSeedDataTags|graphSeedDataTags).json$/,);
|
|
42
42
|
intTestPaths.push(`${path}`);
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -31,7 +31,7 @@ async function bucketPathForUpload(folderPath, settings) {
|
|
|
31
31
|
// console.log({ files })
|
|
32
32
|
for (const filePath of files) {
|
|
33
33
|
const fileContent = fs.readFileSync(filePath);
|
|
34
|
-
const index = filePath.
|
|
34
|
+
const index = filePath.lastIndexOf(settings.serviceTag);
|
|
35
35
|
|
|
36
36
|
let relativePath;
|
|
37
37
|
if (index !== -1) {
|
|
@@ -0,0 +1,73 @@
|
|
|
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
|
+
|
|
23
|
+
import consts from '#libs/Consts.js';
|
|
24
|
+
import utils from '#libs/Utils.js';
|
|
25
|
+
|
|
26
|
+
const { firstLetterUpperCase: upperCase } = utils;
|
|
27
|
+
const { SOURCE_PATH, HANDLER } = consts;
|
|
28
|
+
|
|
29
|
+
const templatePath = path.join(__dirname, 'template.ejs');
|
|
30
|
+
/**
|
|
31
|
+
* receive objectSchema
|
|
32
|
+
* create data for hdrInv template
|
|
33
|
+
*
|
|
34
|
+
* @param {Object} _izContext
|
|
35
|
+
* @param {Object} flowSchema
|
|
36
|
+
* @param {String} appPath
|
|
37
|
+
* @return {Object[]}
|
|
38
|
+
*/
|
|
39
|
+
function data(_izContext, allFlowSchemas, appPath) {
|
|
40
|
+
// console.log('allFlowSchemas', allFlowSchemas)
|
|
41
|
+
const flowTagWithFlowStepNames = {};
|
|
42
|
+
for (const flowSchema of allFlowSchemas) {
|
|
43
|
+
for (const flowStepName of Object.keys(flowSchema.flowSteps)) {
|
|
44
|
+
if (flowStepName === "In" || flowStepName === "Out") {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
if (!flowTagWithFlowStepNames.hasOwnProperty(flowSchema.flowTag)) {
|
|
48
|
+
flowTagWithFlowStepNames[flowSchema.flowTag] = [];
|
|
49
|
+
}
|
|
50
|
+
flowTagWithFlowStepNames[flowSchema.flowTag].push(flowStepName);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// console.log('flowTagWithFlowStepNames', flowTagWithFlowStepNames)
|
|
55
|
+
return {
|
|
56
|
+
templatePath: templatePath,
|
|
57
|
+
templateData: {
|
|
58
|
+
flowTagWithFlowStepNames: flowTagWithFlowStepNames,
|
|
59
|
+
},
|
|
60
|
+
setting: {
|
|
61
|
+
savePath: path.join(
|
|
62
|
+
appPath,
|
|
63
|
+
SOURCE_PATH.appYaml),
|
|
64
|
+
saveFileName: 'flowSchema-env',
|
|
65
|
+
fileExtension: '.yml',
|
|
66
|
+
isAppend: false
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
export default data;
|
|
@@ -41,7 +41,8 @@ const {
|
|
|
41
41
|
createIamRole,
|
|
42
42
|
shortNameHandler,
|
|
43
43
|
resourceNames,
|
|
44
|
-
tableRoleForFlowSchema
|
|
44
|
+
tableRoleForFlowSchema,
|
|
45
|
+
getLocalOrS3ObjectSchema
|
|
45
46
|
} = libs;
|
|
46
47
|
|
|
47
48
|
const { firstLetterUpperCase: upperCase } = utils;
|
|
@@ -78,7 +79,6 @@ async function createSourceParams(_izContext, flowSchema, appPath) {
|
|
|
78
79
|
handlerFilePath: path.join(
|
|
79
80
|
SOURCE_PATH.resourceLocationFlowSchema,
|
|
80
81
|
upperCase(flowSchema.flowTag),
|
|
81
|
-
'MainHandler/',
|
|
82
82
|
'source/'
|
|
83
83
|
),
|
|
84
84
|
functionName,
|
|
@@ -92,15 +92,17 @@ async function createSourceParams(_izContext, flowSchema, appPath) {
|
|
|
92
92
|
flowSchema.statusType === 'triggerCache' ||
|
|
93
93
|
flowSchema.statusType === 'statusField'
|
|
94
94
|
) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
95
|
+
|
|
96
|
+
let [objSchema, error] = await getLocalOrS3ObjectSchema(
|
|
97
|
+
_izContext,
|
|
98
|
+
flowSchema.objType,
|
|
99
|
+
path.join(
|
|
100
|
+
appPath,
|
|
101
|
+
'src/schemas')
|
|
102
|
+
)
|
|
103
|
+
objectSchema = objSchema;
|
|
104
|
+
if (error) {
|
|
105
|
+
console.log(error);
|
|
104
106
|
}
|
|
105
107
|
}
|
|
106
108
|
|
|
@@ -57,7 +57,6 @@ function createParamsForCreateSource(_izContext, flowSchema, appPath) {
|
|
|
57
57
|
appPath,
|
|
58
58
|
SOURCE_PATH.flowSchema,
|
|
59
59
|
upperCase(flowSchema.flowTag),
|
|
60
|
-
'MainHandler/',
|
|
61
60
|
'source/'
|
|
62
61
|
),
|
|
63
62
|
saveFileName: `${functionName}_${handlerTypeSqs}`,
|
|
@@ -80,7 +79,6 @@ function createParamsForCreateSource(_izContext, flowSchema, appPath) {
|
|
|
80
79
|
appPath,
|
|
81
80
|
SOURCE_PATH.flowSchema,
|
|
82
81
|
upperCase(flowSchema.flowTag),
|
|
83
|
-
'MainHandler/',
|
|
84
82
|
'source/'
|
|
85
83
|
),
|
|
86
84
|
saveFileName: `${functionName}_${handlerTypeDsq}`,
|
|
@@ -389,7 +389,6 @@ function buildNoPluginHookResources(
|
|
|
389
389
|
handlerFilePath: path.join(
|
|
390
390
|
SOURCE_PATH.resourceLocationFlowSchema,
|
|
391
391
|
upperCase(flowTag),
|
|
392
|
-
upperCase(flowStepName),
|
|
393
392
|
'source/',
|
|
394
393
|
`${upperCase(flowStepName)}_${upperCase(HANDLER.hdrSqs)}`
|
|
395
394
|
),
|
|
@@ -456,8 +455,8 @@ function buildFlowStepResources(_izContext, flowSchema, saveFilePath) {
|
|
|
456
455
|
const flowSchemaSourcePath = path.join(
|
|
457
456
|
saveFilePath,
|
|
458
457
|
consts.SOURCE_PATH.flowSchema,
|
|
459
|
-
upperCase(flowTag)
|
|
460
|
-
|
|
458
|
+
upperCase(flowTag),
|
|
459
|
+
`source/`
|
|
461
460
|
);
|
|
462
461
|
|
|
463
462
|
if (flowStepConfig.plugInHooks?.length) {
|
|
@@ -23,6 +23,8 @@ import createRegisterComponent from './register/index.js';
|
|
|
23
23
|
import createWebSocketGenerateCodeLibs from './shared/wsCodeLibs.js';
|
|
24
24
|
import createFlowSchemaEndpointMainFunction from './flowSchemaMainFunction/main.js';
|
|
25
25
|
|
|
26
|
+
import envYaml from './env/yaml.js';
|
|
27
|
+
|
|
26
28
|
import libs from '#libs/Libs.js';
|
|
27
29
|
|
|
28
30
|
// Build handler maps from registry export names (key = export alias in registry.js)
|
|
@@ -175,6 +177,8 @@ async function generateTemplateDataFromFlowSchema(
|
|
|
175
177
|
|
|
176
178
|
createSourceParams.push(...webSocketResults, ...registerResults);
|
|
177
179
|
|
|
180
|
+
|
|
181
|
+
|
|
178
182
|
const wsAndRegisterFiles = libs.toUniqueFilePaths([
|
|
179
183
|
...webSocketResults,
|
|
180
184
|
...registerResults
|
|
@@ -189,6 +193,12 @@ async function generateTemplateDataFromFlowSchema(
|
|
|
189
193
|
);
|
|
190
194
|
}
|
|
191
195
|
|
|
196
|
+
const generateYamlEnv = envYaml(_izContext, allLocalFlowSchemas, appPath);
|
|
197
|
+
|
|
198
|
+
createSourceParams.push(
|
|
199
|
+
generateYamlEnv,
|
|
200
|
+
);
|
|
201
|
+
|
|
192
202
|
console.info(
|
|
193
203
|
`[FlowSchema:*] all completed flows=${allLocalFlowSchemas.length} generated=${createSourceParams.length} elapsedMs=${Date.now() - startAllMs}`
|
|
194
204
|
);
|
|
@@ -124,10 +124,8 @@ function createSourceParams(_izContext, allLocalFlowSchemas, srcPath) {
|
|
|
124
124
|
functionName,
|
|
125
125
|
handlerType,
|
|
126
126
|
additionalResourcePermission,
|
|
127
|
-
|
|
128
127
|
functionNameConfig:
|
|
129
128
|
upperCase(functionName) + upperCase(shortNameHandler(handlerType)),
|
|
130
|
-
|
|
131
129
|
roleName: 'WebSocketMain',
|
|
132
130
|
queueName: queueName,
|
|
133
131
|
upperFunctionName: upperCase(functionName),
|
|
@@ -22,7 +22,7 @@ const __dirname = path.dirname(__filename);
|
|
|
22
22
|
import consts from '#libs/Consts.js';
|
|
23
23
|
import utils from '#libs/Utils.js';
|
|
24
24
|
import libs from '#libs/Libs.js';
|
|
25
|
-
|
|
25
|
+
import { getObjectSchema } from '@izara_project/izara-core-library-service-schemas';
|
|
26
26
|
const {
|
|
27
27
|
HANDLER,
|
|
28
28
|
RESOURCE_CLASSES,
|
|
@@ -42,16 +42,17 @@ const {
|
|
|
42
42
|
awaitingMultipleStepsRole,
|
|
43
43
|
defaultIamRolePerAction,
|
|
44
44
|
createIamRole,
|
|
45
|
-
resourceNames
|
|
45
|
+
resourceNames,
|
|
46
|
+
externalResourceYaml
|
|
46
47
|
} = libs;
|
|
47
48
|
|
|
48
49
|
const templatePath = path.join(__dirname, 'template.ejs');
|
|
49
50
|
|
|
50
|
-
function data(_izContext, srcPath) {
|
|
51
|
-
return [createFunctionYamlOutUpdateComplete(_izContext, srcPath)];
|
|
51
|
+
async function data(_izContext, allObjectSchema, srcPath) {
|
|
52
|
+
return [await createFunctionYamlOutUpdateComplete(_izContext, allObjectSchema, srcPath)];
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
function createFunctionYamlOutUpdateComplete(_izContext, srcPath) {
|
|
55
|
+
async function createFunctionYamlOutUpdateComplete(_izContext, allObjectSchema, srcPath) {
|
|
55
56
|
let functionName = upperCase(FUNCTION_NAME.createObjectComplete);
|
|
56
57
|
let additionalResourcePermission = defaultIamRolePerAction();
|
|
57
58
|
let handlerType = upperCase(HANDLER.hdrSqs);
|
|
@@ -89,6 +90,31 @@ function createFunctionYamlOutUpdateComplete(_izContext, srcPath) {
|
|
|
89
90
|
|
|
90
91
|
additionalResourcePermission.push(awaitingMultipleStepsRole());
|
|
91
92
|
|
|
93
|
+
for (const objSchema of allObjectSchema.records) {
|
|
94
|
+
if (objSchema.hasOwnProperty('extendObjType')) {
|
|
95
|
+
const parentObjSchema = await getObjectSchema.getObjSchemaS3WithCache(
|
|
96
|
+
_izContext,
|
|
97
|
+
objSchema.extendObjType
|
|
98
|
+
);
|
|
99
|
+
for (const parentStorage of Object.values(parentObjSchema.storageResources)) {
|
|
100
|
+
if (parentStorage.storageType === consts.STORAGE_TYPES.dynamoDB) {
|
|
101
|
+
if (parentStorage.tableName === `${parentObjSchema.objectType}Records`) {
|
|
102
|
+
additionalResourcePermission.push(
|
|
103
|
+
createIamRole({
|
|
104
|
+
[RESOURCE_CLASSES.dynamoDbAcrossService]:
|
|
105
|
+
DYNAMO_RESOURCE.putItem
|
|
106
|
+
},
|
|
107
|
+
externalResourceYaml(
|
|
108
|
+
[RESOURCE_CLASSES.dynamoDbAcrossService],
|
|
109
|
+
'Records',
|
|
110
|
+
objSchema.extendObjType.serviceTag)
|
|
111
|
+
))
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
92
118
|
const resourceLocation = SOURCE_PATH.resourceLocationOutPerActionComplete;
|
|
93
119
|
const roleName = SOURCE_GENERATE_IAM_ROLE.ObjectCompleteRole;
|
|
94
120
|
const upperFunctionName = upperCase(functionName);
|
|
@@ -34,12 +34,10 @@ import updateSnsOut from './update/sns-out/snsOut.js';
|
|
|
34
34
|
import updateFunctionYaml from './update/yaml/yaml.js';
|
|
35
35
|
|
|
36
36
|
const components = [
|
|
37
|
-
updateFunctionYaml,
|
|
38
37
|
updateHandler,
|
|
39
38
|
updateMainFunction,
|
|
40
39
|
updateSnsInSqs,
|
|
41
40
|
updateSnsOut,
|
|
42
|
-
createFunctionYaml,
|
|
43
41
|
createSnsInSqs,
|
|
44
42
|
createSnsOut,
|
|
45
43
|
createHandler,
|
|
@@ -51,9 +49,14 @@ const components = [
|
|
|
51
49
|
deleteSnsInSqs,
|
|
52
50
|
getSnsOut
|
|
53
51
|
];
|
|
52
|
+
const componentYml = [
|
|
53
|
+
updateFunctionYaml,
|
|
54
|
+
createFunctionYaml,
|
|
55
|
+
]
|
|
54
56
|
|
|
55
|
-
async function endpointCompleteComponent(_izContext, appPath) {
|
|
57
|
+
async function endpointCompleteComponent(_izContext, allObjSchemas, appPath) {
|
|
56
58
|
try {
|
|
59
|
+
const allCreateSource = [];
|
|
57
60
|
const results = await Promise.all(
|
|
58
61
|
components.map(async fn => {
|
|
59
62
|
try {
|
|
@@ -67,7 +70,25 @@ async function endpointCompleteComponent(_izContext, appPath) {
|
|
|
67
70
|
})
|
|
68
71
|
);
|
|
69
72
|
|
|
70
|
-
|
|
73
|
+
const resultsYml = await Promise.all(
|
|
74
|
+
componentYml.map(async fn => {
|
|
75
|
+
try {
|
|
76
|
+
return await fn(_izContext, allObjSchemas, appPath);
|
|
77
|
+
} catch (error) {
|
|
78
|
+
console.error(
|
|
79
|
+
`Error processing perActionComplete component: ${error.message}`
|
|
80
|
+
);
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
))
|
|
85
|
+
|
|
86
|
+
allCreateSource.push(...results, ...resultsYml)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
return allCreateSource.flat();
|
|
71
92
|
} catch (error) {
|
|
72
93
|
_izContext.logger.error(
|
|
73
94
|
'Error generating code with template perActionComplete:',
|
|
@@ -22,6 +22,8 @@ const __dirname = path.dirname(__filename);
|
|
|
22
22
|
import consts from '#libs/Consts.js';
|
|
23
23
|
import utils from '#libs/Utils.js';
|
|
24
24
|
import libs from '#libs/Libs.js';
|
|
25
|
+
import { getObjectSchema } from '@izara_project/izara-core-library-service-schemas';
|
|
26
|
+
import { DYNAMO_RESOURCE } from '#libs/consts/resources.js';
|
|
25
27
|
|
|
26
28
|
const {
|
|
27
29
|
HANDLER,
|
|
@@ -42,16 +44,17 @@ const {
|
|
|
42
44
|
awaitingMultipleStepsRole,
|
|
43
45
|
defaultIamRolePerAction,
|
|
44
46
|
createIamRole,
|
|
45
|
-
resourceNames
|
|
47
|
+
resourceNames,
|
|
48
|
+
externalResourceYaml
|
|
46
49
|
} = libs;
|
|
47
50
|
|
|
48
51
|
const templatePath = path.join(__dirname, 'template.ejs');
|
|
49
52
|
|
|
50
|
-
function data(_izContext, srcPath) {
|
|
51
|
-
return [createFunctionYamlOutUpdateComplete(_izContext, srcPath)];
|
|
53
|
+
async function data(_izContext, allObjectSchema, srcPath) {
|
|
54
|
+
return [await createFunctionYamlOutUpdateComplete(_izContext, allObjectSchema, srcPath)];
|
|
52
55
|
}
|
|
53
56
|
|
|
54
|
-
function createFunctionYamlOutUpdateComplete(_izContext, srcPath) {
|
|
57
|
+
async function createFunctionYamlOutUpdateComplete(_izContext, allObjectSchema, srcPath) {
|
|
55
58
|
let functionName = upperCase(FUNCTION_NAME.updateNodeComplete);
|
|
56
59
|
let functionNameConfig = upperCase(
|
|
57
60
|
SHORT_FUNCTION_NAME(FUNCTION_NAME.updateNodeComplete)
|
|
@@ -90,6 +93,31 @@ function createFunctionYamlOutUpdateComplete(_izContext, srcPath) {
|
|
|
90
93
|
// console.log("additionalResourcePermission in update", JSON.stringify(additionalResourcePermission, null, 2))
|
|
91
94
|
additionalResourcePermission.push(awaitingMultipleStepsRole());
|
|
92
95
|
|
|
96
|
+
for (const objSchema of allObjectSchema.records) {
|
|
97
|
+
if (objSchema.hasOwnProperty('extendObjType')) {
|
|
98
|
+
const parentObjSchema = await getObjectSchema.getObjSchemaS3WithCache(
|
|
99
|
+
_izContext,
|
|
100
|
+
objSchema.extendObjType
|
|
101
|
+
);
|
|
102
|
+
for (const parentStorage of Object.values(parentObjSchema.storageResources)) {
|
|
103
|
+
if (parentStorage.storageType === consts.STORAGE_TYPES.dynamoDB) {
|
|
104
|
+
if (parentStorage.tableName === `${parentObjSchema.objectType}Records`) {
|
|
105
|
+
additionalResourcePermission.push(
|
|
106
|
+
createIamRole({
|
|
107
|
+
[RESOURCE_CLASSES.dynamoDbAcrossService]:
|
|
108
|
+
DYNAMO_RESOURCE.updateItem
|
|
109
|
+
},
|
|
110
|
+
externalResourceYaml(
|
|
111
|
+
[RESOURCE_CLASSES.dynamoDbAcrossService],
|
|
112
|
+
'Records',
|
|
113
|
+
objSchema.extendObjType.serviceTag)
|
|
114
|
+
))
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
93
121
|
const resourceLocation = SOURCE_PATH.resourceLocationOutPerActionComplete;
|
|
94
122
|
const roleName = SOURCE_GENERATE_IAM_ROLE.ObjectCompleteRole;
|
|
95
123
|
const upperFunctionName = upperCase(functionName);
|
|
@@ -66,7 +66,7 @@ async function generateTemplateDataFromSchema(
|
|
|
66
66
|
console.error('[Schema] endpointComponent error:', error);
|
|
67
67
|
return [];
|
|
68
68
|
}),
|
|
69
|
-
endpointCompleteComponent(_izContext, appPath),
|
|
69
|
+
endpointCompleteComponent(_izContext, allObjSchemas, appPath),
|
|
70
70
|
resourceYamlComponent(
|
|
71
71
|
_izContext,
|
|
72
72
|
appPath,
|
package/src/generators/fromObjectSchema/relationship/create/action/mainFunction/template.ejs
CHANGED
|
@@ -80,11 +80,15 @@ export default async function createRelationship(
|
|
|
80
80
|
secondObject,
|
|
81
81
|
relType,
|
|
82
82
|
relationshipDirection,
|
|
83
|
-
relationshipProperties
|
|
83
|
+
relationshipProperties,
|
|
84
|
+
deepPathConditional
|
|
85
|
+
settings
|
|
84
86
|
//(<requestParamCreateRel>)
|
|
85
87
|
//(</requestParamCreateRel>)
|
|
86
88
|
} = requestParams;
|
|
87
89
|
|
|
90
|
+
const createOnConditionalFail = settings.createOnConditionalFail ?? false;
|
|
91
|
+
|
|
88
92
|
let errorsFound = [];
|
|
89
93
|
const parentFlowId = identifierUuid();
|
|
90
94
|
//(<beforeValidateCreateRel>)
|
|
@@ -349,7 +353,9 @@ export default async function createRelationship(
|
|
|
349
353
|
relType: relType,
|
|
350
354
|
relationshipDirection,
|
|
351
355
|
relationshipProperties,
|
|
356
|
+
deepPathConditional: deepPathConditional || [],
|
|
352
357
|
parentFlowId,
|
|
358
|
+
settings: {createOnConditionalFail: createOnConditionalFail}
|
|
353
359
|
//(<inCreateRelMessageBodyCreateRel>)
|
|
354
360
|
//(</inCreateRelMessageBodyCreateRel>)
|
|
355
361
|
|
|
@@ -52,8 +52,7 @@ async function data(_izContext, data, appPath) {
|
|
|
52
52
|
savePath: path.join(
|
|
53
53
|
appPath,
|
|
54
54
|
SOURCE_PATH.flowSchema,
|
|
55
|
-
|
|
56
|
-
`${upperCase(data.flowStepName)}`,
|
|
55
|
+
upperCase(data.flowTag),
|
|
57
56
|
'source/'
|
|
58
57
|
),
|
|
59
58
|
saveFileName: `${upperCase(functionName)}_${upperCase(handlerType)}`,
|
|
@@ -45,8 +45,7 @@ async function data(_izContext, data, appPath) {
|
|
|
45
45
|
savePath: path.join(
|
|
46
46
|
appPath,
|
|
47
47
|
SOURCE_PATH.flowSchema,
|
|
48
|
-
|
|
49
|
-
`${upperCase(data.flowStepName)}`,
|
|
48
|
+
upperCase(data.flowTag),
|
|
50
49
|
'source/'
|
|
51
50
|
),
|
|
52
51
|
saveFileName: `${upperCase(functionName)}${upperCase(data.recieveType)}_Main`,
|
|
@@ -67,7 +67,10 @@ async function data(_izContext, data, appPath) {
|
|
|
67
67
|
additionalResourcePermission,
|
|
68
68
|
roleName,
|
|
69
69
|
event: 'post',
|
|
70
|
-
resourceLocation: path.join(
|
|
70
|
+
resourceLocation: path.join(
|
|
71
|
+
SOURCE_PATH.resourceLocationFlowSchema,
|
|
72
|
+
data.flowTag,
|
|
73
|
+
'source/'),
|
|
71
74
|
handlerType: upperCase(handlerType),
|
|
72
75
|
lowerCase,
|
|
73
76
|
route: functionName,
|
|
@@ -39,8 +39,7 @@ function data(_izContext, data, appPath) {
|
|
|
39
39
|
savePath: path.join(
|
|
40
40
|
appPath,
|
|
41
41
|
SOURCE_PATH.flowSchema,
|
|
42
|
-
|
|
43
|
-
`${upperCase(data.flowStepName)}`,
|
|
42
|
+
upperCase(data.flowTag),
|
|
44
43
|
'source/'
|
|
45
44
|
),
|
|
46
45
|
saveFileName: upperCase(data.functionName) +
|
|
@@ -40,8 +40,7 @@ function data(_izContext, data, appPath) {
|
|
|
40
40
|
savePath: path.join(
|
|
41
41
|
appPath,
|
|
42
42
|
SOURCE_PATH.flowSchema,
|
|
43
|
-
|
|
44
|
-
`${upperCase(data.flowStepName)}`,
|
|
43
|
+
upperCase(data.flowTag),
|
|
45
44
|
'source/'
|
|
46
45
|
),
|
|
47
46
|
saveFileName: upperCase(data.functionName) + '_Main',
|
|
@@ -45,8 +45,7 @@ async function data(_izContext, data, appPath) {
|
|
|
45
45
|
savePath: path.join(
|
|
46
46
|
appPath,
|
|
47
47
|
SOURCE_PATH.flowSchema,
|
|
48
|
-
|
|
49
|
-
`${upperCase(data.flowStepName)}`,
|
|
48
|
+
upperCase(data.flowTag),
|
|
50
49
|
'source/'
|
|
51
50
|
),
|
|
52
51
|
saveFileName: `${upperCase(data.functionName)}_${upperCase(data.handlerType)}`,
|
|
@@ -54,8 +54,7 @@ async function data(_izContext, data, appPath) {
|
|
|
54
54
|
savePath: path.join(
|
|
55
55
|
appPath,
|
|
56
56
|
SOURCE_PATH.flowSchema,
|
|
57
|
-
|
|
58
|
-
`${upperCase(data.flowStepName)}`,
|
|
57
|
+
upperCase(data.flowTag),
|
|
59
58
|
'source/'
|
|
60
59
|
),
|
|
61
60
|
saveFileName: `${upperCase(data.functionName)}_Main`,
|
|
@@ -125,7 +125,6 @@ async function generatePlunIg(
|
|
|
125
125
|
handlerPath: path.join(
|
|
126
126
|
SOURCE_PATH.resourceLocationFlowSchema,
|
|
127
127
|
upperCase(flowSchema.flowTag),
|
|
128
|
-
upperCase(flowStepName),
|
|
129
128
|
'source/',
|
|
130
129
|
`${upperCase(flowTag)}${upperCase(flowStepName)}_${upperCase(data.handlerType)}`
|
|
131
130
|
),
|
package/src/libs/Utils.js
CHANGED
|
@@ -140,7 +140,6 @@ const savePath = {
|
|
|
140
140
|
appPath,
|
|
141
141
|
SOURCE_PATH.flowSchema,
|
|
142
142
|
firstLetterUpperCase(flowTag),
|
|
143
|
-
'MainHandler/',
|
|
144
143
|
'source/'
|
|
145
144
|
);
|
|
146
145
|
},
|
|
@@ -148,7 +147,6 @@ const savePath = {
|
|
|
148
147
|
return path.join(
|
|
149
148
|
SOURCE_PATH.resourceLocationFlowSchema,
|
|
150
149
|
firstLetterUpperCase(flowTag),
|
|
151
|
-
'MainHandler/',
|
|
152
150
|
'source/'
|
|
153
151
|
);
|
|
154
152
|
}
|