@izara_project/izara-core-generate-service-code 1.0.90 → 1.0.92
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 +7 -10
- package/src/compile/flowValidator.js +6 -0
- package/src/compile/loadSchemas.js +177 -69
- package/src/emit/crud/emitDynamicCrudFlowSchemas.js +2 -2
- package/src/emit/crud/generateCrudApplicationArtifacts.js +15 -17
- package/src/emit/crud/generateDynamicCrudFlowSchemas.js +16 -21
- package/src/emit/crud/loadLocalSchemaArrays.js +4 -8
- package/src/emit/crud/templates/CreateAfterHookCallback_Main.ejs +6 -6
- package/src/emit/crud/templates/CreateBeforeHookCallback_Main.ejs +3 -3
- package/src/emit/crud/templates/CreateComplete_Main.ejs +22 -22
- package/src/emit/crud/templates/CreateEndpoint_Main.ejs +18 -18
- package/src/emit/crud/templates/CreateLogicalLib.ejs +47 -47
- package/src/emit/crud/templates/CreateNodeCallback_Main.ejs +24 -24
- package/src/emit/crud/templates/DeleteAfterHookCallback_Main.ejs +5 -5
- package/src/emit/crud/templates/DeleteBeforeHookCallback_Main.ejs +3 -3
- package/src/emit/crud/templates/DeleteComplete_Main.ejs +23 -23
- package/src/emit/crud/templates/DeleteEndpoint_Main.ejs +15 -15
- package/src/emit/crud/templates/DeleteLogicalLib.ejs +19 -19
- package/src/emit/crud/templates/FlowEndpointRbacCallback_Main.ejs +3 -3
- package/src/emit/crud/templates/UpdateAfterHookCallback_Main.ejs +5 -5
- package/src/emit/crud/templates/UpdateBeforeHookCallback_Main.ejs +3 -3
- package/src/emit/crud/templates/UpdateComplete_Main.ejs +22 -22
- package/src/emit/crud/templates/UpdateEndpoint_Main.ejs +15 -15
- package/src/emit/crud/templates/UpdateLogicalLib.ejs +33 -33
- package/src/emit/custom/customFlowPaths.js +149 -0
- package/src/emit/custom/customFlowS3.js +156 -0
- package/src/emit/custom/customFlowSteps.js +385 -0
- package/src/emit/custom/customFlowTemplates.js +28 -0
- package/src/emit/custom/customFlows.js +48 -19
- package/src/emit/custom/emitCustomFlowApplicationArtifacts.js +57 -692
- package/src/emit/custom/generateCustomFlowApplicationArtifacts.js +27 -25
- package/src/emit/custom/templates/FlowEndpointRbacCallback_Main.ejs +7 -7
- package/src/emit/custom/templates/s3/ConfirmReserved_HdrSqs.ejs +3 -3
- package/src/emit/custom/templates/s3/ConfirmReserved_Main.ejs +3 -3
- package/src/emit/custom/templates/s3/CreatePreSignUrl_HdrSqs.ejs +3 -3
- package/src/emit/custom/templates/s3/CreatePreSignUrl_Main.ejs +4 -4
- package/src/emit/rbac/emitDynamicRbacFlowSchemas.js +26 -6
- package/src/emit/rbac/emitRbacApplicationArtifacts.js +40 -13
- package/src/emit/rbac/generateCreateTargetRoleHandler.js +11 -13
- package/src/emit/rbac/generateDynamicRbacFlowSchemas.js +14 -18
- package/src/emit/rbac/templates/UserRbacFlow_Main.ejs +13 -7
- package/src/emit/relationship/emitDynamicRelationshipFlowSchemas.js +1 -1
- package/src/emit/relationship/generateDynamicRelationshipFlowSchemas.js +16 -19
- package/src/emit/relationship/generateRelationshipApplicationArtifacts.js +19 -19
- package/src/emit/relationship/templates/ChangeRelationshipComplete_HdrSqs.ejs +2 -2
- package/src/emit/relationship/templates/ChangeRelationshipComplete_Main.ejs +6 -6
- package/src/emit/relationship/templates/ChangeRelationship_Main.ejs +17 -17
- package/src/emit/relationship/templates/CreateRelationshipComplete_HdrSqs.ejs +2 -2
- package/src/emit/relationship/templates/CreateRelationshipComplete_Main.ejs +6 -6
- package/src/emit/relationship/templates/CreateRelationship_Main.ejs +14 -14
- package/src/emit/relationship/templates/DeleteRelationshipComplete_HdrSqs.ejs +2 -2
- package/src/emit/relationship/templates/DeleteRelationshipComplete_Main.ejs +6 -6
- package/src/emit/relationship/templates/DeleteRelationship_Main.ejs +10 -10
- package/src/emit/relationship/templates/GetRelationshipComplete_HdrSqs.ejs +2 -2
- package/src/emit/relationship/templates/GetRelationshipComplete_Main.ejs +5 -5
- package/src/emit/relationship/templates/GetRelationship_Main.ejs +9 -9
- package/src/emit/relationship/templates/MoveRelationshipComplete_HdrSqs.ejs +2 -2
- package/src/emit/relationship/templates/MoveRelationshipComplete_Main.ejs +6 -6
- package/src/emit/relationship/templates/MoveRelationship_Main.ejs +15 -15
- package/src/emit/relationship/templates/UpdateRelationshipComplete_HdrSqs.ejs +2 -2
- package/src/emit/relationship/templates/UpdateRelationshipComplete_Main.ejs +6 -6
- package/src/emit/relationship/templates/UpdateRelationship_Main.ejs +11 -11
- package/src/emit/resource/dynamoResourceArtifacts.js +18 -0
- package/src/emit/resource/emitResourceArtifacts.js +13 -1251
- package/src/emit/resource/generateResourceArtifacts.js +20 -20
- package/src/emit/resource/iamResourceArtifacts.js +612 -0
- package/src/emit/resource/resourceState.js +564 -0
- package/src/emit/resource/resourceTemplate.js +30 -0
- package/src/emit/resource/s3ResourceArtifacts.js +14 -0
- package/src/emit/resource/sqsResourceArtifacts.js +113 -0
- package/src/emit/shared/runSubsystemGeneration.js +55 -0
- package/src/emit/shared/templates/FindData_Main.ejs +19 -19
- package/src/emit/shared/templates/PaginateProcessLogical_Main.ejs +3 -3
- package/src/emit/shared/templates/ProcessLogical_Main.ejs +15 -15
- package/src/emit/system/emitSystemWebSocketArtifacts.js +2 -1
- package/test/createTargetRoleHandler.test.js +62 -4
- package/test/crudApplicationArtifacts.test.js +75 -3
- package/test/customFlowApplicationArtifacts.test.js +98 -0
- package/test/dynamicCrudFlowSchemas.test.js +2 -2
- package/test/dynamicRbacFlowSchemas.test.js +32 -4
- package/test/relationshipApplicationArtifacts.test.js +1 -1
- package/test/resourceArtifacts.test.js +99 -0
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { buildGenerationPlan } from '../../plan/buildGenerationPlan.js';
|
|
2
|
-
import { commitArtifacts } from '../../output/commitArtifacts.js';
|
|
3
|
-
import { compileProject } from '../../compile/compileProject.js';
|
|
4
1
|
import { loadLocalSchemaDirectory } from '../../compile/loadSchemas.js';
|
|
2
|
+
import { runSubsystemGeneration } from '../shared/runSubsystemGeneration.js';
|
|
5
3
|
import {
|
|
6
4
|
customFlowApplicationManagedPaths,
|
|
7
5
|
emitCustomFlowApplicationArtifacts
|
|
@@ -16,27 +14,31 @@ export async function generateCustomFlowApplicationArtifacts(
|
|
|
16
14
|
rootPath,
|
|
17
15
|
options = {}
|
|
18
16
|
) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
return await runSubsystemGeneration({
|
|
18
|
+
rootPath,
|
|
19
|
+
options,
|
|
20
|
+
loadInputs: async (project) => {
|
|
21
|
+
const [flows, objects] = await Promise.all([
|
|
22
|
+
loadLocalSchemaDirectory(project, 'FlowSchemas'),
|
|
23
|
+
loadLocalSchemaDirectory(project, 'ObjectSchemas')
|
|
24
|
+
]);
|
|
25
|
+
return { flows, objects };
|
|
26
|
+
},
|
|
27
|
+
emitArtifacts: async ({ flows, objects }) => {
|
|
28
|
+
const system = await emitSystemWebSocketArtifacts(flows);
|
|
29
|
+
const custom = await emitCustomFlowApplicationArtifacts(flows, {
|
|
30
|
+
systemFunctions: system.functions,
|
|
31
|
+
objects
|
|
32
|
+
});
|
|
33
|
+
return [...system.artifacts, ...custom];
|
|
34
|
+
},
|
|
35
|
+
managedScope: 'custom-flow-application',
|
|
36
|
+
resolveManagedPaths: ({ flows, objects }) => [
|
|
37
|
+
...systemWebSocketManagedPaths(),
|
|
38
|
+
...customFlowApplicationManagedPaths(flows, {
|
|
39
|
+
includeYaml: hasSystemWebSocket(flows),
|
|
40
|
+
objects
|
|
41
|
+
})
|
|
42
|
+
]
|
|
28
43
|
});
|
|
29
|
-
const artifacts = [...system.artifacts, ...custom];
|
|
30
|
-
const files = await commitArtifacts(
|
|
31
|
-
buildGenerationPlan(project, artifacts, {
|
|
32
|
-
managedPaths: [
|
|
33
|
-
...systemWebSocketManagedPaths(),
|
|
34
|
-
...customFlowApplicationManagedPaths(flows, {
|
|
35
|
-
includeYaml: hasSystemWebSocket(flows), objects
|
|
36
|
-
})
|
|
37
|
-
],
|
|
38
|
-
managedScope: 'custom-flow-application'
|
|
39
|
-
})
|
|
40
|
-
);
|
|
41
|
-
return { project, files };
|
|
42
44
|
}
|
|
@@ -63,7 +63,7 @@ export default async function <%- functionName %>(
|
|
|
63
63
|
_izContext,
|
|
64
64
|
rbacPendingStepId,
|
|
65
65
|
currentAwaitingStepId,
|
|
66
|
-
requestParams.
|
|
66
|
+
requestParams.foundErrors,
|
|
67
67
|
{
|
|
68
68
|
returnValue: requestParams.returnValue,
|
|
69
69
|
rbacType
|
|
@@ -80,7 +80,7 @@ export default async function <%- functionName %>(
|
|
|
80
80
|
const {
|
|
81
81
|
isComplete,
|
|
82
82
|
collectedReturnValueByAwaitingStepId,
|
|
83
|
-
collectedErrors:
|
|
83
|
+
collectedErrors: foundErrors = [],
|
|
84
84
|
additionalAttributes
|
|
85
85
|
} = rbacAwaitingStepsResult;
|
|
86
86
|
|
|
@@ -129,7 +129,7 @@ export default async function <%- functionName %>(
|
|
|
129
129
|
const rbacCallbackResults = {};
|
|
130
130
|
const hasError = Object.entries(rbacResults).some(([type, result]) => {
|
|
131
131
|
if (result && result.error) {
|
|
132
|
-
|
|
132
|
+
foundErrors.push(result.error);
|
|
133
133
|
return true;
|
|
134
134
|
}
|
|
135
135
|
rbacCallbackResults[type] = result;
|
|
@@ -141,7 +141,7 @@ export default async function <%- functionName %>(
|
|
|
141
141
|
);
|
|
142
142
|
|
|
143
143
|
if (!isAllowed) {
|
|
144
|
-
|
|
144
|
+
foundErrors.push('Permission denied');
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
_izContext.logger.debug(
|
|
@@ -149,13 +149,13 @@ export default async function <%- functionName %>(
|
|
|
149
149
|
{
|
|
150
150
|
rbacCallbackResults,
|
|
151
151
|
isAllowed,
|
|
152
|
-
|
|
152
|
+
foundErrors
|
|
153
153
|
}
|
|
154
154
|
);
|
|
155
155
|
|
|
156
|
-
if (hasError ||
|
|
156
|
+
if (hasError || foundErrors.length > 0) {
|
|
157
157
|
const errorResult = {
|
|
158
|
-
|
|
158
|
+
foundErrors,
|
|
159
159
|
status: 'rejected',
|
|
160
160
|
requestParams: originalRequestParams
|
|
161
161
|
};
|
|
@@ -28,12 +28,12 @@ middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
|
|
|
28
28
|
// set schema for record.body.Message
|
|
29
29
|
let perRecordsValidatorSchema = {
|
|
30
30
|
type: 'object',
|
|
31
|
-
required: ['returnMessage', '
|
|
31
|
+
required: ['returnMessage', 'foundErrors', 'passStatus'],
|
|
32
32
|
properties: {
|
|
33
33
|
returnMessage: {
|
|
34
34
|
type: 'object'
|
|
35
35
|
},
|
|
36
|
-
|
|
36
|
+
foundErrors: {
|
|
37
37
|
type: 'array'
|
|
38
38
|
},
|
|
39
39
|
passStatus: {
|
|
@@ -83,7 +83,7 @@ export const main = middleware.wrap(async (event, context) => {
|
|
|
83
83
|
|
|
84
84
|
// add argument (to invoke lambda) to passOnProperties[]
|
|
85
85
|
passOnProperties.push(record.body.Message.returnMessage);
|
|
86
|
-
passOnProperties.push(record.body.Message.
|
|
86
|
+
passOnProperties.push(record.body.Message.foundErrors);
|
|
87
87
|
passOnProperties.push(record.body.Message.passStatus);
|
|
88
88
|
//(<additionalProperties>)
|
|
89
89
|
//(</additionalProperties>)
|
|
@@ -30,7 +30,7 @@ import { getNestObject } from '../../../libs/source/GenerateCodeLibs.js';
|
|
|
30
30
|
* @param {Logger} _izContext.logger - property of _izContext
|
|
31
31
|
* @param {Logger} _izContext.logger - property of _izContext
|
|
32
32
|
* @param {Object} returnMessage - limitValue or limitFound
|
|
33
|
-
* @param {Array}
|
|
33
|
+
* @param {Array} foundErrors - array
|
|
34
34
|
* @param {boolean} passStatus - true || false
|
|
35
35
|
* @param {Object} passBackProperties - identifier
|
|
36
36
|
|
|
@@ -41,7 +41,7 @@ import { getNestObject } from '../../../libs/source/GenerateCodeLibs.js';
|
|
|
41
41
|
export default async function confirmNewReserved(
|
|
42
42
|
_izContext,
|
|
43
43
|
returnMessage,
|
|
44
|
-
|
|
44
|
+
foundErrors,
|
|
45
45
|
passStatus,
|
|
46
46
|
//(<additionalProperties>)
|
|
47
47
|
//(</additionalProperties>)
|
|
@@ -51,7 +51,7 @@ export default async function confirmNewReserved(
|
|
|
51
51
|
_izContext.logger.debug('----- confirmNewReserved event params', {
|
|
52
52
|
_izContext: _izContext,
|
|
53
53
|
returnMessage: returnMessage,
|
|
54
|
-
|
|
54
|
+
foundErrors: foundErrors,
|
|
55
55
|
passStatus: passStatus,
|
|
56
56
|
passBackProperties: passBackProperties
|
|
57
57
|
});
|
|
@@ -28,12 +28,12 @@ middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
|
|
|
28
28
|
// set schema for record.body.Message
|
|
29
29
|
let perRecordsValidatorSchema = {
|
|
30
30
|
type: 'object',
|
|
31
|
-
required: ['returnMessage', '
|
|
31
|
+
required: ['returnMessage', 'foundErrors', 'passStatus'],
|
|
32
32
|
properties: {
|
|
33
33
|
returnMessage: {
|
|
34
34
|
type: 'object'
|
|
35
35
|
},
|
|
36
|
-
|
|
36
|
+
foundErrors: {
|
|
37
37
|
type: 'array'
|
|
38
38
|
},
|
|
39
39
|
passStatus: {
|
|
@@ -83,7 +83,7 @@ export const main = middleware.wrap(async (event, context) => {
|
|
|
83
83
|
|
|
84
84
|
// add argument (to invoke lambda) to passOnProperties[]
|
|
85
85
|
passOnProperties.push(record.body.Message.returnMessage);
|
|
86
|
-
passOnProperties.push(record.body.Message.
|
|
86
|
+
passOnProperties.push(record.body.Message.foundErrors);
|
|
87
87
|
passOnProperties.push(record.body.Message.passStatus);
|
|
88
88
|
//(<additionalProperties>)
|
|
89
89
|
//(</additionalProperties>)
|
|
@@ -51,7 +51,7 @@ const { createFlowTypeConcat } = utils;
|
|
|
51
51
|
* @param {Logger} _izContext.logger - property of _izContext
|
|
52
52
|
* @param {Logger} _izContext.logger - property of _izContext
|
|
53
53
|
* @param {Object} returnMessage - limitValue or limitFound
|
|
54
|
-
* @param {Array}
|
|
54
|
+
* @param {Array} foundErrors - array
|
|
55
55
|
* @param {boolean} passStatus - true || false
|
|
56
56
|
* @param {Object} passBackProperties - identifier
|
|
57
57
|
*
|
|
@@ -61,7 +61,7 @@ const { createFlowTypeConcat } = utils;
|
|
|
61
61
|
export default async function createPreSignUrl(
|
|
62
62
|
_izContext,
|
|
63
63
|
returnMessage,
|
|
64
|
-
|
|
64
|
+
foundErrors,
|
|
65
65
|
passStatus,
|
|
66
66
|
//(<additionalProperties>)
|
|
67
67
|
//(</additionalProperties>)
|
|
@@ -70,7 +70,7 @@ export default async function createPreSignUrl(
|
|
|
70
70
|
try {
|
|
71
71
|
_izContext.logger.debug('----- createPreSignUrl event params -----', {
|
|
72
72
|
returnMessage: returnMessage,
|
|
73
|
-
|
|
73
|
+
foundErrors: foundErrors,
|
|
74
74
|
passStatus: passStatus,
|
|
75
75
|
passBackProperties: passBackProperties
|
|
76
76
|
});
|
|
@@ -122,7 +122,7 @@ export default async function createPreSignUrl(
|
|
|
122
122
|
|
|
123
123
|
_izContext.logger.debug('reserved has reach limit');
|
|
124
124
|
|
|
125
|
-
|
|
125
|
+
foundErrors.push('reserved has reach limit');
|
|
126
126
|
// update status
|
|
127
127
|
let updateStatusField = {
|
|
128
128
|
objInstanceFull: {
|
|
@@ -149,19 +149,39 @@ function _createUserRbacFlow(flowTag, serviceTag, objectType) {
|
|
|
149
149
|
return {
|
|
150
150
|
flowTag,
|
|
151
151
|
objType: { serviceTag, objectType },
|
|
152
|
-
event: ['
|
|
153
|
-
initiateBy: '
|
|
152
|
+
event: ['lambdaSyncInv', 'lambdaSyncApi'],
|
|
153
|
+
initiateBy: 'systemWithUser',
|
|
154
154
|
handleObj: 'one',
|
|
155
155
|
statusType: 'none',
|
|
156
|
-
|
|
156
|
+
stepProperties: {
|
|
157
|
+
parentFlowId: {
|
|
158
|
+
propertyName: 'parentFlowId',
|
|
159
|
+
type: 'string'
|
|
160
|
+
},
|
|
161
|
+
flowTypeConcat: {
|
|
162
|
+
propertyName: 'flowTypeConcat',
|
|
163
|
+
type: 'string'
|
|
164
|
+
},
|
|
165
|
+
parameterGroups: {
|
|
166
|
+
propertyName: 'parameterGroups',
|
|
167
|
+
type: 'object'
|
|
168
|
+
}
|
|
169
|
+
},
|
|
157
170
|
stepMessageAttributes: {
|
|
158
|
-
|
|
159
|
-
|
|
171
|
+
submittedByUserId: {
|
|
172
|
+
propertyName: 'x-correlation-submitted-by-user-id',
|
|
173
|
+
type: 'string'
|
|
174
|
+
}
|
|
160
175
|
},
|
|
161
176
|
flowSteps: [
|
|
162
177
|
{
|
|
163
178
|
stepName: 'Start',
|
|
164
|
-
|
|
179
|
+
properties: [
|
|
180
|
+
{ key: 'parentFlowId', required: false },
|
|
181
|
+
{ key: 'flowTypeConcat', required: true },
|
|
182
|
+
{ key: 'parameterGroups', default: {} }
|
|
183
|
+
],
|
|
184
|
+
messageAttributes: [{ key: 'submittedByUserId', required: false }]
|
|
165
185
|
}
|
|
166
186
|
]
|
|
167
187
|
};
|
|
@@ -13,6 +13,7 @@ const FLOW_RBAC_YAML_PATH = 'app/sls_yaml/generatedCode/source/flow-rbac.yml';
|
|
|
13
13
|
const FLOW_LIMITS_YAML_PATH = 'app/sls_yaml/generatedCode/source/flow-limits.yml';
|
|
14
14
|
const CRUD_TEMPLATE_URL = new URL('../crud/templates/', import.meta.url);
|
|
15
15
|
const RBAC_TEMPLATE_URL = new URL('./templates/', import.meta.url);
|
|
16
|
+
const SHARED_TEMPLATE_URL = new URL('../shared/templates/', import.meta.url);
|
|
16
17
|
|
|
17
18
|
export async function emitRbacApplicationArtifacts(objects) {
|
|
18
19
|
if (!Array.isArray(objects)) {
|
|
@@ -146,9 +147,8 @@ const STATIC_RBAC_APPLICATION_PATHS = [
|
|
|
146
147
|
'app/src/generatedCode/FlowRbac/GetMyPermissions/source/GetMyPermissions_HdrSqs.js',
|
|
147
148
|
'app/src/generatedCode/FlowRbac/GetMyPermissions/source/GetMyPermissions_HdrApi.js',
|
|
148
149
|
'app/src/generatedCode/FlowRbac/ValidatorRbac/source/ValidatorRbac_Main.js',
|
|
149
|
-
'app/src/generatedCode/FlowRbac/ValidatorRbac/source/
|
|
150
|
-
'app/src/generatedCode/FlowRbac/ValidatorRbac/source/
|
|
151
|
-
'app/src/generatedCode/FlowRbac/ValidatorRbac/source/ValidatorRbac_HdrWbs.js',
|
|
150
|
+
'app/src/generatedCode/FlowRbac/ValidatorRbac/source/ValidatorRbac_HdrInv.js',
|
|
151
|
+
'app/src/generatedCode/FlowRbac/ValidatorRbac/source/ValidatorRbac_HdrApi.js',
|
|
152
152
|
...LIST_DEFINITIONS.flatMap(({ flowTag }) => [
|
|
153
153
|
`app/src/generatedCode/FlowRbac/${flowTag}/source/${flowTag}_Main.js`,
|
|
154
154
|
`app/src/generatedCode/FlowRbac/${flowTag}/source/${flowTag}_HdrSqs.js`,
|
|
@@ -189,7 +189,8 @@ export function rbacApplicationManagedPaths(objects = []) {
|
|
|
189
189
|
const sourcePath = `app/src/generatedCode/FlowRbac/${flowTag}/source`;
|
|
190
190
|
return [
|
|
191
191
|
`${sourcePath}/${flowTag}_Main.js`,
|
|
192
|
-
`${sourcePath}/${flowTag}
|
|
192
|
+
`${sourcePath}/${flowTag}_HdrInv.js`,
|
|
193
|
+
`${sourcePath}/${flowTag}_HdrApi.js`
|
|
193
194
|
];
|
|
194
195
|
});
|
|
195
196
|
return [
|
|
@@ -469,6 +470,19 @@ async function createUserRbacFlowHandler(flowTagOrObject) {
|
|
|
469
470
|
: rbacFlowTag(flowTagOrObject);
|
|
470
471
|
const sourcePath = `app/src/generatedCode/FlowRbac/${flowTag}/source`;
|
|
471
472
|
const handlerPath = `src/generatedCode/FlowRbac/${flowTag}/source`;
|
|
473
|
+
const shared = {
|
|
474
|
+
flowTag,
|
|
475
|
+
flowStepName: '',
|
|
476
|
+
mainFileName: `${flowTag}_Main`,
|
|
477
|
+
functionName: flowTag,
|
|
478
|
+
startConfig: {
|
|
479
|
+
properties: [
|
|
480
|
+
{ propertyName: 'parentFlowId', type: 'string', required: false },
|
|
481
|
+
{ propertyName: 'flowTypeConcat', type: 'string', required: true },
|
|
482
|
+
{ propertyName: 'parameterGroups', type: 'object', default: {} }
|
|
483
|
+
]
|
|
484
|
+
}
|
|
485
|
+
};
|
|
472
486
|
return {
|
|
473
487
|
artifacts: [
|
|
474
488
|
{
|
|
@@ -476,20 +490,29 @@ async function createUserRbacFlowHandler(flowTagOrObject) {
|
|
|
476
490
|
content: await renderRbacTemplate('UserRbacFlow_Main.ejs', { flowTag })
|
|
477
491
|
},
|
|
478
492
|
{
|
|
479
|
-
path: `${sourcePath}/${flowTag}
|
|
480
|
-
content: await
|
|
481
|
-
|
|
482
|
-
|
|
493
|
+
path: `${sourcePath}/${flowTag}_HdrInv.js`,
|
|
494
|
+
content: await renderSharedTemplate('FlowHandler_HdrInv.ejs', shared)
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
path: `${sourcePath}/${flowTag}_HdrApi.js`,
|
|
498
|
+
content: await renderSharedTemplate('FlowHandler_HdrApi.ejs', shared)
|
|
483
499
|
}
|
|
484
500
|
],
|
|
485
501
|
functions: [
|
|
486
502
|
{
|
|
487
|
-
type: '
|
|
488
|
-
functionName: `${flowTag}
|
|
489
|
-
handlerPath: `${handlerPath}/${flowTag}
|
|
503
|
+
type: 'inv',
|
|
504
|
+
functionName: `${flowTag}HdrInv`,
|
|
505
|
+
handlerPath: `${handlerPath}/${flowTag}_HdrInv.main`,
|
|
490
506
|
roleName: 'FlowRbacRole',
|
|
491
|
-
|
|
492
|
-
|
|
507
|
+
flowTag,
|
|
508
|
+
flowStepName: ''
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
type: 'api',
|
|
512
|
+
functionName: `${flowTag}HdrApi`,
|
|
513
|
+
handlerPath: `${handlerPath}/${flowTag}_HdrApi.main`,
|
|
514
|
+
roleName: 'FlowRbacRole',
|
|
515
|
+
flowTag,
|
|
493
516
|
flowStepName: ''
|
|
494
517
|
}
|
|
495
518
|
]
|
|
@@ -548,6 +571,10 @@ function renderRbacTemplate(templateName, data = {}) {
|
|
|
548
571
|
return renderTemplate(RBAC_TEMPLATE_URL, templateName, data);
|
|
549
572
|
}
|
|
550
573
|
|
|
574
|
+
function renderSharedTemplate(templateName, data = {}) {
|
|
575
|
+
return renderTemplate(SHARED_TEMPLATE_URL, templateName, data);
|
|
576
|
+
}
|
|
577
|
+
|
|
551
578
|
async function renderTemplate(templateUrl, templateName, data) {
|
|
552
579
|
return ejsLib.render(
|
|
553
580
|
await readFile(new URL(templateName, templateUrl), 'utf8'),
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
import { buildGenerationPlan } from '../../plan/buildGenerationPlan.js';
|
|
2
|
-
import { commitArtifacts } from '../../output/commitArtifacts.js';
|
|
3
|
-
import { compileProject } from '../../compile/compileProject.js';
|
|
4
1
|
import { loadLocalSchemaDirectory } from '../../compile/loadSchemas.js';
|
|
2
|
+
import { runSubsystemGeneration } from '../shared/runSubsystemGeneration.js';
|
|
5
3
|
import {
|
|
6
4
|
emitRbacApplicationArtifacts,
|
|
7
5
|
rbacApplicationManagedPaths
|
|
8
6
|
} from './emitRbacApplicationArtifacts.js';
|
|
9
7
|
|
|
10
8
|
export async function generateCreateTargetRoleHandler(rootPath, options = {}) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
return await runSubsystemGeneration({
|
|
10
|
+
rootPath,
|
|
11
|
+
options,
|
|
12
|
+
loadInputs: async (project) => ({
|
|
13
|
+
objects: await loadLocalSchemaDirectory(project, 'ObjectSchemas')
|
|
14
|
+
}),
|
|
15
|
+
emitArtifacts: ({ objects }) => emitRbacApplicationArtifacts(objects),
|
|
16
|
+
managedScope: 'rbac-application',
|
|
17
|
+
resolveManagedPaths: () => rbacApplicationManagedPaths()
|
|
18
|
+
});
|
|
21
19
|
}
|
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
import { buildGenerationPlan } from '../../plan/buildGenerationPlan.js';
|
|
2
|
-
import { commitArtifacts } from '../../output/commitArtifacts.js';
|
|
3
|
-
import { compileProject } from '../../compile/compileProject.js';
|
|
4
1
|
import { loadLocalSchemaDirectory } from '../../compile/loadSchemas.js';
|
|
2
|
+
import { runSubsystemGeneration } from '../shared/runSubsystemGeneration.js';
|
|
5
3
|
import {
|
|
6
4
|
emitDynamicRbacFlowSchemas,
|
|
7
5
|
rbacFlowSchemaManagedPaths
|
|
8
6
|
} from './emitDynamicRbacFlowSchemas.js';
|
|
9
7
|
|
|
10
8
|
export async function generateDynamicRbacFlowSchemas(rootPath, options = {}) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
project
|
|
15
|
-
|
|
16
|
-
objects,
|
|
17
|
-
serviceTag: project.serviceTag
|
|
9
|
+
return await runSubsystemGeneration({
|
|
10
|
+
rootPath,
|
|
11
|
+
options,
|
|
12
|
+
loadInputs: async (project) => ({
|
|
13
|
+
objects: await loadLocalSchemaDirectory(project, 'ObjectSchemas')
|
|
18
14
|
}),
|
|
19
|
-
{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
emitArtifacts: ({ objects, project }) =>
|
|
16
|
+
emitDynamicRbacFlowSchemas({
|
|
17
|
+
objects,
|
|
18
|
+
serviceTag: project.serviceTag
|
|
19
|
+
}),
|
|
20
|
+
managedScope: 'rbac-flow-schemas',
|
|
21
|
+
resolveManagedPaths: ({ objects }) => rbacFlowSchemaManagedPaths(objects)
|
|
22
|
+
});
|
|
27
23
|
}
|
|
@@ -62,7 +62,7 @@ async function _getL2Cache(_izContext, submittedByUserId, cacheSubKey) {
|
|
|
62
62
|
roleIdKey: result.roleIdKey || '',
|
|
63
63
|
rbacType: result.rbacType || 'target'
|
|
64
64
|
},
|
|
65
|
-
|
|
65
|
+
foundErrors: [],
|
|
66
66
|
status: 'Completed'
|
|
67
67
|
};
|
|
68
68
|
}
|
|
@@ -92,10 +92,13 @@ async function _setL2Cache(_izContext, submittedByUserId, cacheSubKey, value) {
|
|
|
92
92
|
export default async function <%- flowTag %>(_izContext, requestParams = {}) {
|
|
93
93
|
const submittedByUserId =
|
|
94
94
|
requestParams.submittedByUserId ||
|
|
95
|
+
requestParams.userId ||
|
|
95
96
|
requestParams.targetIdentifiers?.submittedByUserId ||
|
|
96
|
-
_izContext.correlationIds
|
|
97
|
+
_izContext.correlationIds?.get(consts.SUBMITTED_BY_USER_ID) ||
|
|
98
|
+
_izContext.correlationIds?.get(consts.BASE_USER_ID);
|
|
97
99
|
|
|
98
|
-
const targetIdentifiers =
|
|
100
|
+
const targetIdentifiers =
|
|
101
|
+
requestParams.targetIdentifiers || requestParams.identifiers;
|
|
99
102
|
let targetId = '';
|
|
100
103
|
if (targetIdentifiers) {
|
|
101
104
|
if (typeof targetIdentifiers === 'string') {
|
|
@@ -131,7 +134,10 @@ export default async function <%- flowTag %>(_izContext, requestParams = {}) {
|
|
|
131
134
|
throw new Error('Missing required request parameters: submittedByUserId or targetIdentifiers');
|
|
132
135
|
}
|
|
133
136
|
|
|
134
|
-
const
|
|
137
|
+
const flowTypeConcat = requestParams.flowTypeConcat;
|
|
138
|
+
const inputParameterGroups =
|
|
139
|
+
requestParams.parameterGroups || requestParams.inputParameterGroups || {};
|
|
140
|
+
const parentFlowId = requestParams.parentFlowId;
|
|
135
141
|
if (!flowTypeConcat) {
|
|
136
142
|
throw new Error('Missing flowTypeConcat in requestParams');
|
|
137
143
|
}
|
|
@@ -166,7 +172,7 @@ export default async function <%- flowTag %>(_izContext, requestParams = {}) {
|
|
|
166
172
|
roleIdKey: 'self_user',
|
|
167
173
|
rbacType: 'self_user'
|
|
168
174
|
},
|
|
169
|
-
|
|
175
|
+
foundErrors: [],
|
|
170
176
|
status: 'Completed'
|
|
171
177
|
};
|
|
172
178
|
_setL1Cache(fullCacheKey, result);
|
|
@@ -231,7 +237,7 @@ export default async function <%- flowTag %>(_izContext, requestParams = {}) {
|
|
|
231
237
|
roleIdKey: '',
|
|
232
238
|
rbacType: 'target'
|
|
233
239
|
},
|
|
234
|
-
|
|
240
|
+
foundErrors: [],
|
|
235
241
|
status: 'Completed'
|
|
236
242
|
};
|
|
237
243
|
_setL1Cache(fullCacheKey, result);
|
|
@@ -277,7 +283,7 @@ export default async function <%- flowTag %>(_izContext, requestParams = {}) {
|
|
|
277
283
|
roleIdKey: matched ? matched.roleIdKey : '',
|
|
278
284
|
rbacType: 'target'
|
|
279
285
|
},
|
|
280
|
-
|
|
286
|
+
foundErrors: [],
|
|
281
287
|
status: 'Completed'
|
|
282
288
|
};
|
|
283
289
|
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { buildGenerationPlan } from '../../plan/buildGenerationPlan.js';
|
|
2
|
-
import { commitArtifacts } from '../../output/commitArtifacts.js';
|
|
3
|
-
import { compileProject } from '../../compile/compileProject.js';
|
|
4
1
|
import { loadLocalSchemaDirectory } from '../../compile/loadSchemas.js';
|
|
2
|
+
import { runSubsystemGeneration } from '../shared/runSubsystemGeneration.js';
|
|
5
3
|
import {
|
|
6
4
|
dynamicRelationshipFlowSchemaManagedPaths,
|
|
7
5
|
emitDynamicRelationshipFlowSchemas
|
|
@@ -11,20 +9,19 @@ export async function generateDynamicRelationshipFlowSchemas(
|
|
|
11
9
|
rootPath,
|
|
12
10
|
options = {}
|
|
13
11
|
) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return { project, files };
|
|
12
|
+
return await runSubsystemGeneration({
|
|
13
|
+
rootPath,
|
|
14
|
+
options,
|
|
15
|
+
loadInputs: async (project) => ({
|
|
16
|
+
relationships: await loadLocalSchemaDirectory(
|
|
17
|
+
project,
|
|
18
|
+
'RelationshipSchemas'
|
|
19
|
+
)
|
|
20
|
+
}),
|
|
21
|
+
emitArtifacts: ({ relationships }) =>
|
|
22
|
+
emitDynamicRelationshipFlowSchemas({ relationships }),
|
|
23
|
+
managedScope: 'relationship-flow-schemas',
|
|
24
|
+
resolveManagedPaths: ({ relationships }) =>
|
|
25
|
+
dynamicRelationshipFlowSchemaManagedPaths(relationships)
|
|
26
|
+
});
|
|
30
27
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { buildGenerationPlan } from '../../plan/buildGenerationPlan.js';
|
|
2
|
-
import { commitArtifacts } from '../../output/commitArtifacts.js';
|
|
3
|
-
import { compileProject } from '../../compile/compileProject.js';
|
|
4
1
|
import { loadLocalSchemaDirectory } from '../../compile/loadSchemas.js';
|
|
2
|
+
import { runSubsystemGeneration } from '../shared/runSubsystemGeneration.js';
|
|
5
3
|
import {
|
|
6
4
|
emitRelationshipApplicationArtifacts,
|
|
7
5
|
relationshipApplicationManagedPaths
|
|
@@ -11,21 +9,23 @@ export async function generateRelationshipApplicationArtifacts(
|
|
|
11
9
|
rootPath,
|
|
12
10
|
options = {}
|
|
13
11
|
) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
return await runSubsystemGeneration({
|
|
13
|
+
rootPath,
|
|
14
|
+
options,
|
|
15
|
+
loadInputs: async (project) => {
|
|
16
|
+
const [relationships, flows] = await Promise.all([
|
|
17
|
+
loadLocalSchemaDirectory(project, 'RelationshipSchemas'),
|
|
18
|
+
loadLocalSchemaDirectory(project, 'FlowSchemas')
|
|
19
|
+
]);
|
|
20
|
+
return { relationships, flows };
|
|
21
|
+
},
|
|
22
|
+
emitArtifacts: ({ relationships, flows, project }) =>
|
|
23
|
+
emitRelationshipApplicationArtifacts({
|
|
24
|
+
relationships,
|
|
25
|
+
flows,
|
|
26
|
+
serviceTag: project.serviceTag
|
|
27
|
+
}),
|
|
28
|
+
managedScope: 'relationship-application',
|
|
29
|
+
resolveManagedPaths: () => relationshipApplicationManagedPaths()
|
|
23
30
|
});
|
|
24
|
-
const files = await commitArtifacts(
|
|
25
|
-
buildGenerationPlan(project, artifacts, {
|
|
26
|
-
managedPaths: relationshipApplicationManagedPaths(),
|
|
27
|
-
managedScope: 'relationship-application'
|
|
28
|
-
})
|
|
29
|
-
);
|
|
30
|
-
return { project, files };
|
|
31
31
|
}
|
|
@@ -20,7 +20,7 @@ let perRecordsValidatorSchema = {
|
|
|
20
20
|
status: {
|
|
21
21
|
type: 'string'
|
|
22
22
|
},
|
|
23
|
-
|
|
23
|
+
foundErrors: {
|
|
24
24
|
type: 'array'
|
|
25
25
|
},
|
|
26
26
|
graphServiceTag: {
|
|
@@ -31,7 +31,7 @@ let perRecordsValidatorSchema = {
|
|
|
31
31
|
'returnValue',
|
|
32
32
|
'parentFlowId',
|
|
33
33
|
'status',
|
|
34
|
-
'
|
|
34
|
+
'foundErrors',
|
|
35
35
|
'graphServiceTag'
|
|
36
36
|
]
|
|
37
37
|
//(<validatorSchema>)
|