@izara_project/izara-core-generate-service-code 1.0.66 → 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/docs/TriggeredCache Flow.drawio +193 -0
- package/docs/TriggeredCacheFlow.mmd +47 -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 +108 -1
- package/src/emit/crud/emitCrudApplicationArtifacts.js +9 -5
- package/src/emit/crud/emitDynamicCrudFlowSchemas.js +1 -2
- package/src/emit/crud/templates/CreateEndpoint_Main.ejs +300 -109
- package/src/emit/crud/templates/DeleteEndpoint_Main.ejs +221 -143
- package/src/emit/crud/templates/FlowEndpointBeforeLogical_Main.ejs +22 -6
- package/src/emit/crud/templates/FlowEndpointComplete_Main.ejs +150 -38
- package/src/emit/crud/templates/FlowEndpoint_HdrWbs.ejs +51 -31
- package/src/emit/crud/templates/FlowHandler_HdrApi.ejs +57 -31
- 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 +6 -3
- package/src/emit/crud/templates/GetRangeEndpoint_Main.ejs +2 -2
- package/src/emit/crud/templates/UpdateEndpoint_Main.ejs +407 -252
- package/src/emit/custom/customFlows.js +112 -31
- package/src/emit/custom/emitCustomFlowApplicationArtifacts.js +89 -77
- package/src/emit/custom/templates/FlowEndpoint_Main.ejs +49 -37
- 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 +46 -12
- package/src/emit/rbac/emitDynamicRbacFlowSchemas.js +28 -15
- package/src/emit/rbac/emitRbacApplicationArtifacts.js +179 -66
- 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/emitRelationshipApplicationArtifacts.js +6 -5
- package/src/emit/relationship/templates/ChangeRelationshipComplete_Main.ejs +64 -37
- package/src/emit/relationship/templates/ChangeRelationship_Main.ejs +260 -144
- 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 +499 -108
- 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/emit/system/emitSystemWebSocketArtifacts.js +2 -1
- package/src/generate.js +8 -4
- package/test/createTargetRoleHandler.test.js +63 -14
- package/test/crudApplicationArtifacts.test.js +1 -1
- package/test/customFlowApplicationArtifacts.test.js +71 -43
- 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 +11 -13
- package/test/resourceArtifacts.test.js +13 -3
- package/src/emit/rbac/templates/UserRbacFlow_HdrInv.ejs +0 -10
|
@@ -18,18 +18,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
18
18
|
import { objectHash as hash } from '@izara_project/izara-shared-core';
|
|
19
19
|
|
|
20
20
|
import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
|
|
21
|
-
import snsSharedLib from
|
|
22
|
-
import dynamodbSharedLib from
|
|
23
|
-
import asyncFlowSharedLib from
|
|
24
|
-
|
|
25
|
-
import { sns } from
|
|
26
|
-
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';
|
|
27
30
|
const { createLinkTypeId } = utils;
|
|
28
31
|
|
|
29
|
-
const {
|
|
30
|
-
TOPIC_NAME_GENERATE_CODE,
|
|
31
|
-
PREFIX
|
|
32
|
-
} = consts;
|
|
32
|
+
const { TOPIC_NAME_GENERATE_CODE, PREFIX } = consts;
|
|
33
33
|
|
|
34
34
|
//(<optionalRequire>)
|
|
35
35
|
//(</optionalRequire>)
|
|
@@ -40,22 +40,25 @@ export default async function updateRelationshipComplete(
|
|
|
40
40
|
status,
|
|
41
41
|
errorsFound,
|
|
42
42
|
graphServiceTag,
|
|
43
|
-
passBackProperties = {}
|
|
43
|
+
passBackProperties = {}
|
|
44
44
|
// callingFlowConfig = {}
|
|
45
45
|
) {
|
|
46
46
|
try {
|
|
47
|
-
_izContext.logger.debug(
|
|
47
|
+
_izContext.logger.debug('Function:updateRelationshipComplete', {
|
|
48
48
|
returnValue: returnValue,
|
|
49
49
|
status: status,
|
|
50
50
|
errorsFound: errorsFound,
|
|
51
51
|
graphServiceTag: graphServiceTag,
|
|
52
|
-
passBackProperties: passBackProperties
|
|
52
|
+
passBackProperties: passBackProperties
|
|
53
53
|
// callingFlowConfig: callingFlowConfig
|
|
54
54
|
});
|
|
55
55
|
|
|
56
56
|
let linkTypeId;
|
|
57
57
|
// start create awaitingStepId
|
|
58
|
-
if (
|
|
58
|
+
if (
|
|
59
|
+
returnValue.requestParams.hasOwnProperty('secondObject') &&
|
|
60
|
+
Object.values(returnValue.requestParams.secondObject.objType).length > 0
|
|
61
|
+
) {
|
|
59
62
|
linkTypeId = createLinkTypeId(
|
|
60
63
|
_izContext,
|
|
61
64
|
returnValue.requestParams.firstObject.objType,
|
|
@@ -66,41 +69,44 @@ export default async function updateRelationshipComplete(
|
|
|
66
69
|
} else {
|
|
67
70
|
linkTypeId = hash({
|
|
68
71
|
firstObject: returnValue.requestParams.firstObject.objType,
|
|
69
|
-
relType: returnValue.requestParams.relType
|
|
72
|
+
relType: returnValue.requestParams.relType
|
|
70
73
|
});
|
|
71
|
-
}
|
|
74
|
+
}
|
|
72
75
|
|
|
73
76
|
let awaitingStepId = asyncFlowSharedLib.createAwaitingStepId(
|
|
74
77
|
hash({
|
|
75
78
|
linkTypeId,
|
|
76
79
|
relId: returnValue.requestParams.relId,
|
|
77
|
-
relationshipProperties:
|
|
80
|
+
relationshipProperties:
|
|
81
|
+
returnValue.requestParams.relationshipProperties,
|
|
78
82
|
graphServiceTag: graphServiceTag
|
|
79
83
|
}), // hash id
|
|
80
84
|
PREFIX.updateRel // prefix, use constant further
|
|
81
|
-
)
|
|
82
|
-
|
|
85
|
+
);
|
|
83
86
|
|
|
84
87
|
let updateRelPendingObjects = await dynamodbSharedLib.query(
|
|
85
88
|
_izContext,
|
|
86
|
-
await dynamodbSharedLib.tableName(_izContext,
|
|
89
|
+
await dynamodbSharedLib.tableName(_izContext, 'AwaitingMultipleSteps'),
|
|
87
90
|
{
|
|
88
91
|
awaitingStepId: awaitingStepId
|
|
89
92
|
}
|
|
90
93
|
);
|
|
91
|
-
_izContext.logger.debug(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
_izContext.logger.debug(
|
|
95
|
+
'record of updateRelPendingObjects ::',
|
|
96
|
+
updateRelPendingObjects
|
|
97
|
+
);
|
|
94
98
|
|
|
95
99
|
await Promise.all(
|
|
96
100
|
updateRelPendingObjects.Items.map(async ({ pendingStepId }) => {
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
if (
|
|
102
|
+
await asyncFlowSharedLib.checkAllAwaitingStepsFinished(
|
|
103
|
+
_izContext,
|
|
104
|
+
pendingStepId, // task waiting
|
|
105
|
+
awaitingStepId,
|
|
106
|
+
errorsFound
|
|
107
|
+
)
|
|
108
|
+
) {
|
|
109
|
+
_izContext.logger.debug('finished all awaitingStep');
|
|
104
110
|
|
|
105
111
|
let updateCompleteMsg = {
|
|
106
112
|
relId: returnValue.requestParams.relId,
|
|
@@ -111,20 +117,45 @@ export default async function updateRelationshipComplete(
|
|
|
111
117
|
//(</inUpdateCompleteMsg>)
|
|
112
118
|
};
|
|
113
119
|
|
|
114
|
-
updateCompleteMsg =
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
120
|
+
updateCompleteMsg =
|
|
121
|
+
callingFlowSharedLib.addParentPassBackPropertiesToSnsResponseMessageObject(
|
|
122
|
+
passBackProperties,
|
|
123
|
+
updateCompleteMsg
|
|
124
|
+
);
|
|
125
|
+
_izContext.logger.debug(
|
|
126
|
+
'After addCallingFlowToSnsResponseMessageObject',
|
|
127
|
+
updateCompleteMsg
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
let messageAttributes =
|
|
131
|
+
callingFlowSharedLib.addParentPassBackCallingFlowToSnsResponseMessageAttributes(
|
|
132
|
+
passBackProperties,
|
|
133
|
+
{}
|
|
134
|
+
);
|
|
135
|
+
_izContext.logger.debug(
|
|
136
|
+
'After addCallingFlowToSnsResponseMessageAttributes',
|
|
137
|
+
updateCompleteMsg
|
|
138
|
+
);
|
|
119
139
|
|
|
120
140
|
let sendMessageToOutUpdateRelationshipComplete = {
|
|
121
141
|
Message: JSON.stringify(updateCompleteMsg),
|
|
122
|
-
MessageAttributes: sns.createStringMessageAttributes(
|
|
123
|
-
|
|
142
|
+
MessageAttributes: sns.createStringMessageAttributes(
|
|
143
|
+
_izContext,
|
|
144
|
+
messageAttributes
|
|
145
|
+
),
|
|
146
|
+
TopicArn: snsSharedLib.snsTopicArnByFlowSchema(
|
|
147
|
+
_izContext,
|
|
148
|
+
TOPIC_NAME_GENERATE_CODE.outUpdateRelComplete
|
|
149
|
+
)
|
|
124
150
|
};
|
|
125
|
-
_izContext.logger.debug(
|
|
126
|
-
|
|
127
|
-
|
|
151
|
+
_izContext.logger.debug(
|
|
152
|
+
'Send message to OutUpdateRelationshipComplete :::>',
|
|
153
|
+
sendMessageToOutUpdateRelationshipComplete
|
|
154
|
+
);
|
|
155
|
+
await sns.publishAsync(
|
|
156
|
+
_izContext,
|
|
157
|
+
sendMessageToOutUpdateRelationshipComplete
|
|
158
|
+
);
|
|
128
159
|
} // check pendingStepId finished
|
|
129
160
|
|
|
130
161
|
// remove awaitingMultipleStep after finished
|
|
@@ -137,15 +168,13 @@ export default async function updateRelationshipComplete(
|
|
|
137
168
|
}) // end per pendingStep
|
|
138
169
|
);
|
|
139
170
|
|
|
140
|
-
|
|
141
171
|
return {
|
|
142
172
|
returnValue,
|
|
143
173
|
status,
|
|
144
174
|
errorsFound
|
|
145
|
-
}
|
|
146
|
-
|
|
175
|
+
};
|
|
147
176
|
} catch (err) {
|
|
148
|
-
_izContext.logger.error('error updateRelationshipComplete:', err)
|
|
149
|
-
throw
|
|
177
|
+
_izContext.logger.error('error updateRelationshipComplete:', err);
|
|
178
|
+
throw err;
|
|
150
179
|
}
|
|
151
180
|
}
|