@izara_project/izara-core-generate-service-code 1.0.67 → 1.0.68
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/.prettierrc +11 -0
- package/package.json +16 -12
- package/scripts/format-ejs.js +105 -0
- package/src/compile/compileProject.js +16 -1
- package/src/compile/loadSchemas.js +89 -4
- package/src/emit/crud/emitDynamicCrudFlowSchemas.js +1 -2
- package/src/emit/crud/templates/CreateEndpoint_Main.ejs +296 -105
- package/src/emit/crud/templates/DeleteEndpoint_Main.ejs +222 -144
- package/src/emit/crud/templates/FlowEndpointBeforeLogical_Main.ejs +22 -6
- package/src/emit/crud/templates/FlowEndpointComplete_Main.ejs +134 -43
- package/src/emit/crud/templates/FlowEndpoint_HdrWbs.ejs +51 -31
- package/src/emit/crud/templates/FlowHandler_HdrApi.ejs +53 -45
- package/src/emit/crud/templates/FlowHandler_HdrInv.ejs +28 -26
- package/src/emit/crud/templates/FlowHandler_HdrSqs.ejs +15 -11
- package/src/emit/crud/templates/FlowMain_Wbs.ejs +53 -38
- package/src/emit/crud/templates/GetEndpoint_Main.ejs +5 -2
- package/src/emit/crud/templates/GetRangeEndpoint_Main.ejs +2 -2
- package/src/emit/crud/templates/UpdateEndpoint_Main.ejs +402 -249
- package/src/emit/custom/customFlows.js +51 -21
- package/src/emit/custom/emitCustomFlowApplicationArtifacts.js +13 -18
- package/src/emit/custom/templates/FlowEndpoint_Main.ejs +48 -36
- package/src/emit/custom/templates/FlowStep_Main.ejs +7 -9
- package/src/emit/custom/templates/s3/ConfirmReserved_HdrSqs.ejs +59 -54
- package/src/emit/custom/templates/s3/ConfirmReserved_Main.ejs +33 -23
- package/src/emit/custom/templates/s3/CreateObject_HdrWbs.ejs +30 -23
- package/src/emit/custom/templates/s3/CreateObject_Main.ejs +56 -39
- package/src/emit/custom/templates/s3/CreatePreSignUrl_HdrSqs.ejs +56 -51
- package/src/emit/custom/templates/s3/CreatePreSignUrl_Main.ejs +112 -75
- package/src/emit/custom/templates/s3/FlowHandler_HdrS3.ejs +12 -7
- package/src/emit/custom/templates/s3/ProcessS3File_Main.ejs +11 -8
- package/src/emit/custom/templates/s3/ReservedLimit_HdrSqs.ejs +64 -55
- package/src/emit/custom/templates/s3/ReservedLimit_Main.ejs +74 -52
- package/src/emit/custom/templates/triggerCache/CheckTriggerCache_HdrSqs.ejs +58 -14
- package/src/emit/custom/templates/triggerCache/CheckTriggerCache_Main.ejs +12 -17
- package/src/emit/custom/templates/triggerCache/TriggerCacheComplete_Main.ejs +20 -13
- package/src/emit/custom/templates/triggerCache/TriggerCache_Main.ejs +4 -1
- package/src/emit/function/functionYamlArtifact.js +20 -0
- package/src/emit/rbac/emitDynamicRbacFlowSchemas.js +28 -15
- package/src/emit/rbac/emitRbacApplicationArtifacts.js +168 -69
- package/src/emit/rbac/templates/CreateTargetRole_HdrSqs.ejs +41 -18
- package/src/emit/rbac/templates/CreateTargetRole_Main.ejs +23 -3
- package/src/emit/rbac/templates/ListRbac_HdrApi.ejs +27 -5
- package/src/emit/rbac/templates/ListRbac_HdrSqs.ejs +41 -8
- package/src/emit/rbac/templates/ListRbac_Main.ejs +26 -6
- package/src/emit/rbac/templates/RbacMutation_Main.ejs +23 -3
- package/src/emit/rbac/templates/UserRbacFlow_HdrSqs.ejs +46 -0
- package/src/emit/rbac/templates/UserRbacFlow_Main.ejs +152 -33
- package/src/emit/rbac/templates/UserRoleMutation_Main.ejs +24 -4
- package/src/emit/relationship/emitDynamicRelationshipFlowSchemas.js +1 -2
- package/src/emit/relationship/templates/ChangeRelationshipComplete_Main.ejs +64 -37
- package/src/emit/relationship/templates/ChangeRelationship_Main.ejs +258 -142
- package/src/emit/relationship/templates/CreateRelationshipComplete_Main.ejs +68 -43
- package/src/emit/relationship/templates/CreateRelationship_Main.ejs +315 -171
- package/src/emit/relationship/templates/DeleteRelationshipComplete_Main.ejs +67 -41
- package/src/emit/relationship/templates/DeleteRelationship_Main.ejs +226 -115
- package/src/emit/relationship/templates/FlowHandler_HdrApi.ejs +41 -33
- package/src/emit/relationship/templates/FlowHandler_HdrDsq.ejs +15 -11
- package/src/emit/relationship/templates/FlowHandler_HdrInv.ejs +28 -26
- package/src/emit/relationship/templates/FlowHandler_HdrSqs.ejs +15 -11
- package/src/emit/relationship/templates/GetRelationshipComplete_Main.ejs +46 -26
- package/src/emit/relationship/templates/GetRelationship_Main.ejs +233 -126
- package/src/emit/relationship/templates/MoveRelationshipComplete_Main.ejs +72 -44
- package/src/emit/relationship/templates/MoveRelationship_Main.ejs +266 -150
- package/src/emit/relationship/templates/UpdateRelationshipComplete_Main.ejs +74 -45
- package/src/emit/relationship/templates/UpdateRelationship_Main.ejs +285 -152
- package/src/emit/resource/emitResourceArtifacts.js +107 -11
- package/src/emit/resource/templates/DynamoDBTable_Yaml.ejs +18 -18
- package/src/emit/resource/templates/FlowOut_Yaml.ejs +5 -5
- package/src/emit/resource/templates/GeneratedLambdaRoleServiceConfig.ejs +138 -0
- package/src/emit/resource/templates/ResourceBeforeLogicalYaml.ejs +44 -44
- package/src/emit/resource/templates/ResourceSqsYaml.ejs +36 -36
- package/src/emit/resource/templates/ResourceYaml.ejs +48 -48
- package/src/emit/resource/templates/S3Bucket_Yaml.ejs +19 -0
- package/src/emit/resource/templates/SharedResource_Yaml.ejs +11 -11
- package/src/emit/resource/templates/SystemDynamoDB_Yaml.ejs +105 -105
- package/src/generate.js +6 -2
- package/test/createTargetRoleHandler.test.js +63 -14
- package/test/customFlowApplicationArtifacts.test.js +48 -23
- package/test/dynamicCrudFlowSchemas.test.js +6 -6
- package/test/dynamicRbacFlowSchemas.test.js +8 -12
- package/test/dynamicRelationshipFlowSchemas.test.js +3 -3
- package/test/publicApi.test.js +10 -12
- package/test/resourceArtifacts.test.js +12 -2
- package/docs/test.png +0 -0
- package/src/emit/rbac/templates/UserRbacFlow_HdrInv.ejs +0 -10
- /package/docs/{test.mmd → TriggeredCacheFlow.mmd} +0 -0
|
@@ -15,41 +15,40 @@ You should have received a copy of the GNU Affero General Public License
|
|
|
15
15
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
|
|
19
18
|
import { objectHash as hash } from '@izara_project/izara-shared-core';
|
|
20
19
|
|
|
21
20
|
import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
|
|
22
|
-
import snsSharedLib from
|
|
23
|
-
import dynamodbSharedLib from
|
|
24
|
-
import asyncFlowSharedLib from
|
|
25
|
-
|
|
26
|
-
import { sns } from
|
|
27
|
-
import {
|
|
21
|
+
import snsSharedLib from '@izara_project/izara-core-library-sns';
|
|
22
|
+
import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
|
|
23
|
+
import asyncFlowSharedLib from '@izara_project/izara-core-library-asynchronous-flow';
|
|
24
|
+
|
|
25
|
+
import { sns } from '@izara_project/izara-core-library-external-request';
|
|
26
|
+
import {
|
|
27
|
+
utils,
|
|
28
|
+
consts
|
|
29
|
+
} from '@izara_project/izara-core-library-service-schemas';
|
|
28
30
|
const { createLinkTypeId } = utils;
|
|
29
31
|
|
|
30
|
-
const {
|
|
31
|
-
TOPIC_NAME_GENERATE_CODE,
|
|
32
|
-
PREFIX
|
|
33
|
-
} = consts;
|
|
32
|
+
const { TOPIC_NAME_GENERATE_CODE, PREFIX } = consts;
|
|
34
33
|
|
|
35
34
|
//(<optionalRequire>)
|
|
36
35
|
//(</optionalRequire>)
|
|
37
36
|
|
|
38
|
-
export default async function <%- functionName %>
|
|
37
|
+
export default async function <%- functionName %>(
|
|
39
38
|
_izContext,
|
|
40
39
|
returnValue,
|
|
41
40
|
status,
|
|
42
41
|
errorsFound,
|
|
43
42
|
graphServiceTag,
|
|
44
|
-
passBackProperties = {}
|
|
43
|
+
passBackProperties = {}
|
|
45
44
|
) {
|
|
46
45
|
try {
|
|
47
|
-
_izContext.logger.debug(
|
|
46
|
+
_izContext.logger.debug('Function:<%- functionName %>', {
|
|
48
47
|
returnValue: returnValue,
|
|
49
48
|
status: status,
|
|
50
49
|
errorsFound: errorsFound,
|
|
51
50
|
graphServiceTag: graphServiceTag,
|
|
52
|
-
passBackProperties: passBackProperties
|
|
51
|
+
passBackProperties: passBackProperties
|
|
53
52
|
});
|
|
54
53
|
|
|
55
54
|
// start create awaitingStepId
|
|
@@ -60,61 +59,91 @@ export default async function <%- functionName %> (
|
|
|
60
59
|
returnValue.requestParams.relType,
|
|
61
60
|
returnValue.requestParams.relationshipProperties,
|
|
62
61
|
returnValue.requestParams.relationshipDirection,
|
|
63
|
-
returnValue.requestParams.moveObject
|
|
62
|
+
returnValue.requestParams.moveObject
|
|
64
63
|
);
|
|
65
64
|
|
|
66
65
|
let awaitingStepId = asyncFlowSharedLib.createAwaitingStepId(
|
|
67
66
|
returnValue.parentFlowId, // hash id
|
|
68
67
|
PREFIX.changeRel // prefix, use constant further
|
|
69
|
-
)
|
|
70
|
-
|
|
68
|
+
);
|
|
71
69
|
|
|
72
70
|
let moveRelPendingObjects = await dynamodbSharedLib.query(
|
|
73
71
|
_izContext,
|
|
74
|
-
await dynamodbSharedLib.tableName(_izContext,
|
|
72
|
+
await dynamodbSharedLib.tableName(_izContext, 'AwaitingMultipleSteps'),
|
|
75
73
|
{
|
|
76
74
|
awaitingStepId: awaitingStepId
|
|
77
75
|
}
|
|
78
76
|
);
|
|
79
|
-
_izContext.logger.debug(
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
_izContext.logger.debug(
|
|
78
|
+
'record of moveRelPendingObjects ::',
|
|
79
|
+
moveRelPendingObjects
|
|
80
|
+
);
|
|
82
81
|
|
|
83
82
|
await Promise.all(
|
|
84
83
|
moveRelPendingObjects.Items.map(async ({ pendingStepId }) => {
|
|
85
|
-
if (
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
84
|
+
if (
|
|
85
|
+
await asyncFlowSharedLib.checkAllAwaitingStepsFinished(
|
|
86
|
+
_izContext,
|
|
87
|
+
pendingStepId, // task waiting
|
|
88
|
+
awaitingStepId,
|
|
89
|
+
errorsFound
|
|
90
|
+
)
|
|
91
|
+
) {
|
|
92
|
+
_izContext.logger.debug('finished all awaitingStep');
|
|
92
93
|
|
|
93
94
|
let moveRelCompleteMsg = {
|
|
94
95
|
firstObject: returnValue.requestParams.firstObject,
|
|
95
96
|
secondObject: returnValue.requestParams.secondObject,
|
|
96
97
|
relType: returnValue.requestParams.relType,
|
|
97
|
-
relationshipProperties:
|
|
98
|
-
|
|
98
|
+
relationshipProperties:
|
|
99
|
+
returnValue.requestParams.relationshipProperties,
|
|
100
|
+
relationshipDirection:
|
|
101
|
+
returnValue.requestParams.relationshipDirection,
|
|
99
102
|
moveObject: returnValue.requestParams.moveObject,
|
|
100
103
|
status: status,
|
|
101
104
|
parentFlowId: returnValue.parentFlowId,
|
|
102
105
|
errorsFound: errorsFound
|
|
103
106
|
};
|
|
104
107
|
|
|
105
|
-
moveRelCompleteMsg =
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
moveRelCompleteMsg =
|
|
109
|
+
callingFlowSharedLib.addParentPassBackPropertiesToSnsResponseMessageObject(
|
|
110
|
+
passBackProperties,
|
|
111
|
+
moveRelCompleteMsg
|
|
112
|
+
);
|
|
113
|
+
_izContext.logger.debug(
|
|
114
|
+
'After addCallingFlowToSnsResponseMessageObject',
|
|
115
|
+
moveRelCompleteMsg
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
let messageAttributes =
|
|
119
|
+
callingFlowSharedLib.addParentPassBackCallingFlowToSnsResponseMessageAttributes(
|
|
120
|
+
passBackProperties,
|
|
121
|
+
{}
|
|
122
|
+
);
|
|
123
|
+
_izContext.logger.debug(
|
|
124
|
+
'After addCallingFlowToSnsResponseMessageAttributes',
|
|
125
|
+
moveRelCompleteMsg
|
|
126
|
+
);
|
|
110
127
|
|
|
111
128
|
let sendMessageToOutMoveRelationshipComplete = {
|
|
112
129
|
Message: JSON.stringify(moveRelCompleteMsg),
|
|
113
|
-
MessageAttributes: sns.createStringMessageAttributes(
|
|
114
|
-
|
|
130
|
+
MessageAttributes: sns.createStringMessageAttributes(
|
|
131
|
+
_izContext,
|
|
132
|
+
messageAttributes
|
|
133
|
+
),
|
|
134
|
+
TopicArn: snsSharedLib.snsTopicArnByFlowSchema(
|
|
135
|
+
_izContext,
|
|
136
|
+
TOPIC_NAME_GENERATE_CODE.outMoveRelComplete
|
|
137
|
+
)
|
|
115
138
|
};
|
|
116
|
-
_izContext.logger.debug(
|
|
117
|
-
|
|
139
|
+
_izContext.logger.debug(
|
|
140
|
+
'Send message to OutCreateRelationshipComplete :::>',
|
|
141
|
+
sendMessageToOutMoveRelationshipComplete
|
|
142
|
+
);
|
|
143
|
+
await sns.publishAsync(
|
|
144
|
+
_izContext,
|
|
145
|
+
sendMessageToOutMoveRelationshipComplete
|
|
146
|
+
);
|
|
118
147
|
|
|
119
148
|
//(<afterCheckAwaitingStep>)
|
|
120
149
|
//(</afterCheckAwaitingStep>)
|
|
@@ -137,10 +166,9 @@ export default async function <%- functionName %> (
|
|
|
137
166
|
returnValue,
|
|
138
167
|
status,
|
|
139
168
|
errorsFound
|
|
140
|
-
}
|
|
141
|
-
|
|
169
|
+
};
|
|
142
170
|
} catch (err) {
|
|
143
|
-
_izContext.logger.error('error createRelationshipComplete:', err)
|
|
144
|
-
throw
|
|
171
|
+
_izContext.logger.error('error createRelationshipComplete:', err);
|
|
172
|
+
throw err;
|
|
145
173
|
}
|
|
146
174
|
}
|