@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
|
@@ -17,11 +17,24 @@ along with this program. If not, see
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
// ==================== Shared Core Utilities ====================
|
|
20
|
-
import {
|
|
21
|
-
|
|
20
|
+
import {
|
|
21
|
+
objectHash as hash,
|
|
22
|
+
identifierUuid
|
|
23
|
+
} from '@izara_project/izara-shared-core';
|
|
24
|
+
import {
|
|
25
|
+
consts as coreConsts,
|
|
26
|
+
NoRetryError
|
|
27
|
+
} from '@izara_project/izara-core-library-core';
|
|
22
28
|
|
|
23
29
|
// ==================== Core Service Schemas ====================
|
|
24
|
-
import {
|
|
30
|
+
import {
|
|
31
|
+
getObjectSchema,
|
|
32
|
+
consts,
|
|
33
|
+
utils,
|
|
34
|
+
identifiersObject,
|
|
35
|
+
dataDetailsLib,
|
|
36
|
+
uploadUseCase
|
|
37
|
+
} from '@izara_project/izara-core-library-service-schemas';
|
|
25
38
|
const { createObjType } = utils;
|
|
26
39
|
const { dynamoDbIdentifiersByStorageResource } = identifiersObject;
|
|
27
40
|
const { createUpdateDataDetail } = dataDetailsLib;
|
|
@@ -35,7 +48,10 @@ import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow
|
|
|
35
48
|
import lambdaSharedLib from '@izara_project/izara-core-library-lambda';
|
|
36
49
|
|
|
37
50
|
// ==================== External Services ====================
|
|
38
|
-
import {
|
|
51
|
+
import {
|
|
52
|
+
sns,
|
|
53
|
+
lambda
|
|
54
|
+
} from '@izara_project/izara-core-library-external-request';
|
|
39
55
|
|
|
40
56
|
//(<optionalRequire>)
|
|
41
57
|
//(</optionalRequire>)
|
|
@@ -57,7 +73,11 @@ export async function <%- flowTag %>MainLogical(
|
|
|
57
73
|
beforeLogicalResults = {}
|
|
58
74
|
) {
|
|
59
75
|
try {
|
|
60
|
-
_izContext.logger.debug('
|
|
76
|
+
_izContext.logger.debug('[<%- flowTag %>MainLogical] started', {
|
|
77
|
+
requestParams,
|
|
78
|
+
callingFlowConfig,
|
|
79
|
+
beforeLogicalResults
|
|
80
|
+
});
|
|
61
81
|
|
|
62
82
|
//(<beforeUpdateMainLogical>)
|
|
63
83
|
//(</beforeUpdateMainLogical>)
|
|
@@ -65,37 +85,52 @@ export async function <%- flowTag %>MainLogical(
|
|
|
65
85
|
// ── Settings ──────────────────────────────────────────────────────────────
|
|
66
86
|
const settings = requestParams.additionalParams?.settings ?? {};
|
|
67
87
|
const returnSystemFieldsName = settings.returnSystemFieldsName === true;
|
|
68
|
-
const returnOldData
|
|
88
|
+
const returnOldData = settings.returnOldData === true;
|
|
69
89
|
|
|
70
|
-
const objType
|
|
71
|
-
const identifiers
|
|
72
|
-
const fields
|
|
90
|
+
const objType = createObjType(requestParams.objectType);
|
|
91
|
+
const identifiers = requestParams.objInstanceFull.identifiers;
|
|
92
|
+
const fields = requestParams.objInstanceFull.fields;
|
|
73
93
|
const versionedDataIds = requestParams.versionedDataIds ?? {};
|
|
74
94
|
const parentFlowId = identifierUuid();
|
|
75
95
|
// ── Load schema ───────────────────────────────────────────────────────────
|
|
76
|
-
const objectSchema = await getObjectSchema.getObjSchemaS3WithHierarchy(
|
|
96
|
+
const objectSchema = await getObjectSchema.getObjSchemaS3WithHierarchy(
|
|
97
|
+
_izContext,
|
|
98
|
+
objType
|
|
99
|
+
);
|
|
77
100
|
_izContext.logger.debug('objectSchema', objectSchema);
|
|
78
101
|
|
|
79
|
-
const objectSchemas =
|
|
102
|
+
const objectSchemas =
|
|
103
|
+
await uploadUseCase.generateObjectSchemaForCombineFieldNames(
|
|
104
|
+
_izContext,
|
|
105
|
+
objectSchema
|
|
106
|
+
);
|
|
80
107
|
_izContext.logger.debug('objectSchemas', objectSchemas);
|
|
81
108
|
|
|
82
109
|
// ── Build updateDataDetails ───────────────────────────────────────────────
|
|
83
|
-
const updateDataDetails = await createUpdateDataDetail(
|
|
110
|
+
const updateDataDetails = await createUpdateDataDetail(
|
|
111
|
+
_izContext,
|
|
112
|
+
objectSchemas
|
|
113
|
+
);
|
|
84
114
|
_izContext.logger.debug('updateDataDetails', updateDataDetails);
|
|
85
115
|
|
|
86
116
|
const originTimestamp = Date.now();
|
|
87
117
|
|
|
88
118
|
// ── Validate versionedDataIds ─────────────────────────────────────────────
|
|
89
|
-
const haveVersionedDataIdsToUpdate =
|
|
119
|
+
const haveVersionedDataIdsToUpdate =
|
|
120
|
+
Object.keys(versionedDataIds).length > 0;
|
|
90
121
|
if (haveVersionedDataIdsToUpdate) {
|
|
91
|
-
const updateMainNodeData
|
|
122
|
+
const updateMainNodeData = {};
|
|
92
123
|
const updateVersionedData = {};
|
|
93
124
|
|
|
94
|
-
for (const [fieldProp, fieldVal] of Object.entries(
|
|
125
|
+
for (const [fieldProp, fieldVal] of Object.entries(
|
|
126
|
+
requestParams.objInstanceFull.fields
|
|
127
|
+
)) {
|
|
95
128
|
const fieldSetting = objectSchema.fieldNames[fieldProp];
|
|
96
129
|
if (fieldSetting.hasOwnProperty('versionedDataLabel')) {
|
|
97
130
|
updateVersionedData[fieldSetting.versionedDataLabel] ??= {};
|
|
98
|
-
Object.assign(updateVersionedData[fieldSetting.versionedDataLabel], {
|
|
131
|
+
Object.assign(updateVersionedData[fieldSetting.versionedDataLabel], {
|
|
132
|
+
[fieldProp]: fieldVal
|
|
133
|
+
});
|
|
99
134
|
} else {
|
|
100
135
|
Object.assign(updateMainNodeData, { [fieldProp]: fieldVal });
|
|
101
136
|
}
|
|
@@ -104,15 +139,26 @@ export async function <%- flowTag %>MainLogical(
|
|
|
104
139
|
_izContext.logger.debug('updateMainNodeData::', updateMainNodeData);
|
|
105
140
|
_izContext.logger.debug('updateVersionedData::', updateVersionedData);
|
|
106
141
|
|
|
107
|
-
const versionedDataIdLabelKeys
|
|
142
|
+
const versionedDataIdLabelKeys = Object.keys(versionedDataIds);
|
|
108
143
|
const updateVersionedDataLabelKeys = Object.keys(updateVersionedData);
|
|
109
144
|
|
|
110
|
-
const missingVersionedDataIdLabels
|
|
111
|
-
|
|
145
|
+
const missingVersionedDataIdLabels = updateVersionedDataLabelKeys.filter(
|
|
146
|
+
(l) => !versionedDataIdLabelKeys.includes(l)
|
|
147
|
+
);
|
|
148
|
+
const missingDataVersionedDataLabels = versionedDataIdLabelKeys.filter(
|
|
149
|
+
(l) => !updateVersionedDataLabelKeys.includes(l)
|
|
150
|
+
);
|
|
112
151
|
|
|
113
|
-
if (missingVersionedDataIdLabels.length)
|
|
114
|
-
|
|
115
|
-
|
|
152
|
+
if (missingVersionedDataIdLabels.length)
|
|
153
|
+
errorsFound.push(
|
|
154
|
+
`missing versionedDataIds of versionedDataLabel '${missingVersionedDataIdLabels.join(', ')}'`
|
|
155
|
+
);
|
|
156
|
+
if (missingDataVersionedDataLabels.length)
|
|
157
|
+
errorsFound.push(
|
|
158
|
+
`missing data of versionedDataLabels '${missingDataVersionedDataLabels.join(', ')}'`
|
|
159
|
+
);
|
|
160
|
+
if (Object.keys(updateMainNodeData).length)
|
|
161
|
+
errorsFound.push('cannot update mainNode if have versionedDataIds');
|
|
116
162
|
}
|
|
117
163
|
|
|
118
164
|
//(<validateBeforeUpdate>)
|
|
@@ -120,35 +166,59 @@ export async function <%- flowTag %>MainLogical(
|
|
|
120
166
|
|
|
121
167
|
// ── Early exit on errors ──────────────────────────────────────────────────
|
|
122
168
|
if (errorsFound.length) {
|
|
123
|
-
const updateNodeCompleteMessage =
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
169
|
+
const updateNodeCompleteMessage =
|
|
170
|
+
callingFlowSharedLib.addPassBackPropertiesToSnsResponseMessageObject(
|
|
171
|
+
callingFlowConfig,
|
|
172
|
+
{
|
|
173
|
+
objType,
|
|
174
|
+
objInstanceFull: { identifiers, fields },
|
|
175
|
+
versionedDataIds,
|
|
176
|
+
status: 'error',
|
|
177
|
+
errorsFound
|
|
178
|
+
}
|
|
179
|
+
);
|
|
127
180
|
|
|
128
|
-
_izContext.logger.debug(
|
|
181
|
+
_izContext.logger.debug(
|
|
182
|
+
'messageParams OutUpdateNodeComplete:::',
|
|
183
|
+
updateNodeCompleteMessage
|
|
184
|
+
);
|
|
129
185
|
await sns.publishAsync(_izContext, {
|
|
130
|
-
Message:
|
|
186
|
+
Message: JSON.stringify(updateNodeCompleteMessage),
|
|
131
187
|
MessageAttributes: sns.createStringMessageAttributes(
|
|
132
188
|
_izContext,
|
|
133
|
-
callingFlowSharedLib.addCallingFlowToSnsResponseMessageAttributes(
|
|
189
|
+
callingFlowSharedLib.addCallingFlowToSnsResponseMessageAttributes(
|
|
190
|
+
callingFlowConfig,
|
|
191
|
+
{}
|
|
192
|
+
)
|
|
134
193
|
),
|
|
135
|
-
TopicArn:
|
|
194
|
+
TopicArn: snsSharedLib.snsTopicArnByFlowSchema(
|
|
195
|
+
_izContext,
|
|
196
|
+
TOPIC_NAME_GENERATE_CODE.outUpdateNodeComplete
|
|
197
|
+
)
|
|
136
198
|
});
|
|
137
199
|
|
|
138
200
|
return updateNodeCompleteMessage;
|
|
139
201
|
}
|
|
140
202
|
|
|
141
203
|
// ── Helper: extract fields per storageTag ─────────────────────────────────
|
|
142
|
-
function createObjInstanceFullFieldsByStorageTag(
|
|
204
|
+
function createObjInstanceFullFieldsByStorageTag(
|
|
205
|
+
_izContext,
|
|
206
|
+
storageTag,
|
|
207
|
+
updateDataDetail
|
|
208
|
+
) {
|
|
143
209
|
const result = {};
|
|
144
|
-
for (const fieldName of Object.keys(
|
|
210
|
+
for (const fieldName of Object.keys(
|
|
211
|
+
requestParams.objInstanceFull.fields
|
|
212
|
+
)) {
|
|
145
213
|
if (
|
|
146
214
|
updateDataDetails[storageTag].fieldNames.includes(fieldName) &&
|
|
147
215
|
updateDataDetail.fieldNames.includes(fieldName) &&
|
|
148
216
|
!identifiers.hasOwnProperty(fieldName) &&
|
|
149
217
|
!result.hasOwnProperty(fieldName)
|
|
150
218
|
) {
|
|
151
|
-
Object.assign(result, {
|
|
219
|
+
Object.assign(result, {
|
|
220
|
+
[fieldName]: requestParams.objInstanceFull.fields[fieldName]
|
|
221
|
+
});
|
|
152
222
|
}
|
|
153
223
|
}
|
|
154
224
|
return result;
|
|
@@ -159,10 +229,14 @@ export async function <%- flowTag %>MainLogical(
|
|
|
159
229
|
const objInstanceFull = { identifiers: {}, fields: {} };
|
|
160
230
|
for (const field of Object.keys(object)) {
|
|
161
231
|
if (requestParams.objInstanceFull.identifiers.hasOwnProperty(field)) {
|
|
162
|
-
Object.assign(objInstanceFull.identifiers, {
|
|
232
|
+
Object.assign(objInstanceFull.identifiers, {
|
|
233
|
+
[field]: requestParams.objInstanceFull.identifiers[field]
|
|
234
|
+
});
|
|
163
235
|
}
|
|
164
236
|
if (requestParams.objInstanceFull.fields.hasOwnProperty(field)) {
|
|
165
|
-
Object.assign(objInstanceFull.fields, {
|
|
237
|
+
Object.assign(objInstanceFull.fields, {
|
|
238
|
+
[field]: requestParams.objInstanceFull.fields[field]
|
|
239
|
+
});
|
|
166
240
|
}
|
|
167
241
|
}
|
|
168
242
|
return objInstanceFull;
|
|
@@ -174,148 +248,223 @@ export async function <%- flowTag %>MainLogical(
|
|
|
174
248
|
let updateItem;
|
|
175
249
|
|
|
176
250
|
await Promise.all(
|
|
177
|
-
Object.entries(updateDataDetails).map(
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
251
|
+
Object.entries(updateDataDetails).map(
|
|
252
|
+
async ([storageTag, updateDataDetail]) => {
|
|
253
|
+
// ── Graph ─────────────────────────────────────────────────────────────
|
|
254
|
+
if (updateDataDetail.storageType === consts.STORAGE_TYPES.graph) {
|
|
255
|
+
//(<beforeUpdateGraph>)
|
|
256
|
+
//(</beforeUpdateGraph>)
|
|
257
|
+
|
|
258
|
+
const graphFields = createObjInstanceFullFieldsByStorageTag(
|
|
259
|
+
_izContext,
|
|
260
|
+
storageTag,
|
|
261
|
+
updateDataDetail
|
|
262
|
+
);
|
|
263
|
+
if (!Object.keys(graphFields).length) return;
|
|
264
|
+
|
|
265
|
+
//(<beforeUpdateNode>)
|
|
266
|
+
//(</beforeUpdateNode>)
|
|
267
|
+
|
|
268
|
+
//(<additionalAttributes>)
|
|
269
|
+
const additionalAttributes = {};
|
|
270
|
+
//(</additionalAttributes>)
|
|
271
|
+
|
|
272
|
+
const records = awaitingStepIds.length === 0 ? listOfRecords : [];
|
|
273
|
+
awaitingStepIds.push({
|
|
274
|
+
awaitingStepId: asyncFlowSharedLib.createAwaitingStepId(
|
|
275
|
+
parentFlowId,
|
|
276
|
+
PREFIX.updateNode
|
|
277
|
+
),
|
|
278
|
+
additionalAttributes: {
|
|
279
|
+
listOfRecords: records,
|
|
280
|
+
additionalAttributes: additionalAttributes
|
|
281
|
+
}
|
|
282
|
+
});
|
|
189
283
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
284
|
+
if (awaitingStepIds.length) {
|
|
285
|
+
const awaitingMultipleStep =
|
|
286
|
+
await asyncFlowSharedLib.createAwaitingMultipleSteps(
|
|
287
|
+
_izContext,
|
|
288
|
+
asyncFlowSharedLib.createPendingStepId(
|
|
289
|
+
_izContext.uniqueRequestId
|
|
290
|
+
),
|
|
291
|
+
awaitingStepIds
|
|
292
|
+
);
|
|
293
|
+
_izContext.logger.debug(
|
|
294
|
+
'awaitingMultipleStep',
|
|
295
|
+
awaitingMultipleStep
|
|
296
|
+
);
|
|
297
|
+
}
|
|
193
298
|
|
|
299
|
+
let updateNodeParams = {
|
|
300
|
+
objType,
|
|
301
|
+
objInstanceFull: { identifiers, fields: graphFields },
|
|
302
|
+
versionedDataIds,
|
|
303
|
+
originTimestamp,
|
|
304
|
+
settings: { returnSystemFieldsName, returnOldData },
|
|
305
|
+
parentFlowId
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
updateNodeParams =
|
|
309
|
+
callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
|
|
310
|
+
updateNodeParams,
|
|
311
|
+
callingFlowSharedLib.addParentCallingFlowConfig(
|
|
312
|
+
callingFlowConfig,
|
|
313
|
+
callingFlowSharedLib.createCallingFlowConfig(
|
|
314
|
+
//(<callingFlowProperties>)
|
|
315
|
+
await lambdaSharedLib.lambdaFunctionName(
|
|
316
|
+
_izContext,
|
|
317
|
+
TOPIC_NAME_GENERATE_CODE.updateNodeComplete
|
|
318
|
+
),
|
|
319
|
+
{}
|
|
320
|
+
//(</callingFlowProperties>)
|
|
321
|
+
)
|
|
322
|
+
)
|
|
323
|
+
);
|
|
324
|
+
|
|
325
|
+
_izContext.logger.debug(
|
|
326
|
+
'messageObject before send message:',
|
|
327
|
+
updateNodeParams
|
|
328
|
+
);
|
|
194
329
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
330
|
+
const resSNS = await sns.publishAsync(_izContext, {
|
|
331
|
+
Message: JSON.stringify(updateNodeParams),
|
|
332
|
+
MessageAttributes: sns.createStringMessageAttributes(
|
|
333
|
+
_izContext,
|
|
334
|
+
callingFlowSharedLib.addCallingFlowToSnsResponseMessageAttributes(
|
|
335
|
+
callingFlowConfig,
|
|
336
|
+
{}
|
|
337
|
+
)
|
|
338
|
+
),
|
|
339
|
+
TopicArn: snsSharedLib.snsTopicArnByFlowSchema(
|
|
340
|
+
_izContext,
|
|
341
|
+
TOPIC_NAME_GRAPH_HANDLER.inUpdateNode,
|
|
342
|
+
storageTag
|
|
343
|
+
)
|
|
344
|
+
});
|
|
345
|
+
_izContext.logger.debug(
|
|
346
|
+
'resSNS send to topic InUpdateNode finish!',
|
|
347
|
+
resSNS
|
|
348
|
+
);
|
|
203
349
|
|
|
204
|
-
|
|
205
|
-
|
|
350
|
+
// ── DynamoDB ──────────────────────────────────────────────────────────
|
|
351
|
+
} else if (
|
|
352
|
+
updateDataDetail.storageType === consts.STORAGE_TYPES.dynamoDB
|
|
353
|
+
) {
|
|
354
|
+
const dynamoFields = createObjInstanceFullFieldsByStorageTag(
|
|
206
355
|
_izContext,
|
|
207
|
-
|
|
208
|
-
|
|
356
|
+
storageTag,
|
|
357
|
+
updateDataDetail
|
|
358
|
+
);
|
|
359
|
+
if (!Object.keys(dynamoFields).length) return;
|
|
360
|
+
|
|
361
|
+
//(<beforeUpdateDynamoDb>)
|
|
362
|
+
//(</beforeUpdateDynamoDb>)
|
|
363
|
+
|
|
364
|
+
const identifiersForUpdateData =
|
|
365
|
+
await dynamoDbIdentifiersByStorageResource(
|
|
366
|
+
_izContext,
|
|
367
|
+
objectSchema,
|
|
368
|
+
updateDataDetail,
|
|
369
|
+
identifiers
|
|
370
|
+
);
|
|
371
|
+
_izContext.logger.debug(
|
|
372
|
+
'identifiersForUpdateData',
|
|
373
|
+
identifiersForUpdateData
|
|
209
374
|
);
|
|
210
|
-
_izContext.logger.debug('awaitingMultipleStep', awaitingMultipleStep);
|
|
211
|
-
}
|
|
212
375
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
originTimestamp,
|
|
218
|
-
settings: { returnSystemFieldsName, returnOldData },
|
|
219
|
-
parentFlowId
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
updateNodeParams = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
|
|
223
|
-
updateNodeParams,
|
|
224
|
-
callingFlowSharedLib.addParentCallingFlowConfig(
|
|
225
|
-
callingFlowConfig,
|
|
226
|
-
callingFlowSharedLib.createCallingFlowConfig(
|
|
227
|
-
//(<callingFlowProperties>)
|
|
228
|
-
await lambdaSharedLib.lambdaFunctionName(_izContext, TOPIC_NAME_GENERATE_CODE.updateNodeComplete), {}
|
|
229
|
-
//(</callingFlowProperties>)
|
|
376
|
+
if (
|
|
377
|
+
Object.values(updateDataDetails).some(
|
|
378
|
+
(updateDataDetail) =>
|
|
379
|
+
updateDataDetail.storageType === consts.STORAGE_TYPES.graph
|
|
230
380
|
)
|
|
231
|
-
)
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
_izContext.logger.debug('resSNS send to topic InUpdateNode finish!', resSNS);
|
|
242
|
-
|
|
243
|
-
// ── DynamoDB ──────────────────────────────────────────────────────────
|
|
244
|
-
} else if (updateDataDetail.storageType === consts.STORAGE_TYPES.dynamoDB) {
|
|
245
|
-
const dynamoFields = createObjInstanceFullFieldsByStorageTag(_izContext, storageTag, updateDataDetail);
|
|
246
|
-
if (!Object.keys(dynamoFields).length) return;
|
|
247
|
-
|
|
248
|
-
//(<beforeUpdateDynamoDb>)
|
|
249
|
-
//(</beforeUpdateDynamoDb>)
|
|
250
|
-
|
|
251
|
-
const identifiersForUpdateData = await dynamoDbIdentifiersByStorageResource(_izContext, objectSchema, updateDataDetail, identifiers);
|
|
252
|
-
_izContext.logger.debug('identifiersForUpdateData', identifiersForUpdateData);
|
|
253
|
-
|
|
254
|
-
if (Object.values(updateDataDetails).some(
|
|
255
|
-
updateDataDetail => updateDataDetail.storageType === consts.STORAGE_TYPES.graph)) {
|
|
256
|
-
_izContext.logger.debug('must process graph first');
|
|
257
|
-
listOfRecords.push({
|
|
258
|
-
[storageTag]: {
|
|
259
|
-
serviceTag: updateDataDetail.serviceTag,
|
|
260
|
-
tableName: updateDataDetail.tableName,
|
|
261
|
-
objInstanceFull: {
|
|
262
|
-
identifiers: identifiersForUpdateData,
|
|
263
|
-
fields: dynamoFields
|
|
381
|
+
) {
|
|
382
|
+
_izContext.logger.debug('must process graph first');
|
|
383
|
+
listOfRecords.push({
|
|
384
|
+
[storageTag]: {
|
|
385
|
+
serviceTag: updateDataDetail.serviceTag,
|
|
386
|
+
tableName: updateDataDetail.tableName,
|
|
387
|
+
objInstanceFull: {
|
|
388
|
+
identifiers: identifiersForUpdateData,
|
|
389
|
+
fields: dynamoFields
|
|
390
|
+
}
|
|
264
391
|
}
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
_izContext.logger.debug('can process record dynamo')
|
|
392
|
+
});
|
|
393
|
+
} else {
|
|
394
|
+
_izContext.logger.debug('can process record dynamo');
|
|
269
395
|
updateItem = await dynamodbSharedLib.updateItem(
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
396
|
+
_izContext,
|
|
397
|
+
await dynamodbSharedLib.tableName(
|
|
398
|
+
_izContext,
|
|
399
|
+
updateDataDetail.tableName,
|
|
400
|
+
updateDataDetail.serviceTag
|
|
401
|
+
),
|
|
402
|
+
identifiersForUpdateData,
|
|
403
|
+
dynamoFields,
|
|
404
|
+
{ returnValues: 'ALL_NEW' }
|
|
405
|
+
);
|
|
278
406
|
|
|
407
|
+
_izContext.logger.debug('updateItem:', updateItem);
|
|
408
|
+
}
|
|
279
409
|
}
|
|
280
|
-
|
|
281
410
|
}
|
|
282
|
-
|
|
411
|
+
)
|
|
283
412
|
);
|
|
284
413
|
|
|
285
414
|
// ── DynamoDB-only complete path ───────────────────────────────────────────
|
|
286
415
|
if (awaitingStepIds.length === 0) {
|
|
287
416
|
let messageObject = {
|
|
288
417
|
objType,
|
|
289
|
-
objInstanceFull: createObjInstanceFullFromParams(
|
|
418
|
+
objInstanceFull: createObjInstanceFullFromParams(
|
|
419
|
+
updateItem,
|
|
420
|
+
requestParams
|
|
421
|
+
)
|
|
290
422
|
};
|
|
291
423
|
|
|
292
424
|
//(<additionalProperties>)
|
|
293
425
|
//(</additionalProperties>)
|
|
294
426
|
|
|
295
|
-
if (
|
|
427
|
+
if (
|
|
428
|
+
callingFlowConfig[
|
|
429
|
+
callingFlowSharedLib.consts.CALLINGFLOWPROPERTIES_PROPERTYNAME
|
|
430
|
+
]
|
|
431
|
+
) {
|
|
296
432
|
_izContext.logger.debug('HAVE CALLING FLOW');
|
|
297
|
-
messageObject =
|
|
433
|
+
messageObject =
|
|
434
|
+
callingFlowSharedLib.addPassBackPropertiesToSnsResponseMessageObject(
|
|
435
|
+
callingFlowConfig,
|
|
436
|
+
messageObject
|
|
437
|
+
);
|
|
298
438
|
|
|
299
439
|
_izContext.logger.debug('after create callingFlow', messageObject);
|
|
300
440
|
await sns.publishAsync(_izContext, {
|
|
301
|
-
Message:
|
|
441
|
+
Message: JSON.stringify(messageObject),
|
|
302
442
|
MessageAttributes: sns.createStringMessageAttributes(
|
|
303
443
|
_izContext,
|
|
304
|
-
callingFlowSharedLib.addCallingFlowToSnsResponseMessageAttributes(
|
|
444
|
+
callingFlowSharedLib.addCallingFlowToSnsResponseMessageAttributes(
|
|
445
|
+
callingFlowConfig,
|
|
446
|
+
{}
|
|
447
|
+
)
|
|
305
448
|
),
|
|
306
|
-
TopicArn:
|
|
449
|
+
TopicArn: snsSharedLib.snsTopicArnByFlowSchema(
|
|
450
|
+
_izContext,
|
|
451
|
+
TOPIC_NAME_GENERATE_CODE.outUpdateNodeComplete
|
|
452
|
+
)
|
|
307
453
|
});
|
|
308
454
|
}
|
|
309
455
|
}
|
|
310
456
|
|
|
311
457
|
return {
|
|
312
|
-
returnValues: {
|
|
313
|
-
|
|
458
|
+
returnValues: {
|
|
459
|
+
objType,
|
|
460
|
+
objInstanceFull: { identifiers, fields },
|
|
461
|
+
versionedDataIds
|
|
462
|
+
},
|
|
463
|
+
status: 'complete',
|
|
314
464
|
errorsFound
|
|
315
465
|
};
|
|
316
|
-
|
|
317
466
|
} catch (err) {
|
|
318
|
-
_izContext.logger.error('error
|
|
467
|
+
_izContext.logger.error('[<%- flowTag %>MainLogical] error:', err);
|
|
319
468
|
throw err;
|
|
320
469
|
}
|
|
321
470
|
}
|
|
@@ -335,22 +484,25 @@ export default async function <%- flowTag %>(
|
|
|
335
484
|
//(</additionalParams>)
|
|
336
485
|
) {
|
|
337
486
|
try {
|
|
338
|
-
_izContext.logger.debug('
|
|
487
|
+
_izContext.logger.debug('[<%- flowTag %>] started', {
|
|
488
|
+
requestParams,
|
|
489
|
+
callingFlowConfig
|
|
490
|
+
});
|
|
339
491
|
|
|
340
492
|
// ── Build identifiers (used for hash in beforeLogical) ──────────────────
|
|
341
493
|
const identifiers = requestParams.objInstanceFull.identifiers;
|
|
342
|
-
const errorsFound
|
|
494
|
+
const errorsFound = [];
|
|
343
495
|
|
|
344
496
|
//(<validateBeforeUpdate>)
|
|
345
497
|
//(</validateBeforeUpdate>)
|
|
346
498
|
|
|
347
499
|
if (errorsFound.length > 0)
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
500
|
+
return await createMainLogical(
|
|
501
|
+
_izContext,
|
|
502
|
+
requestParams,
|
|
503
|
+
callingFlowConfig,
|
|
504
|
+
errorsFound
|
|
505
|
+
);
|
|
354
506
|
|
|
355
507
|
// ── beforeLogical phase check ─────────────────────────────────────────────
|
|
356
508
|
<%_
|
|
@@ -364,134 +516,138 @@ export default async function <%- flowTag %>(
|
|
|
364
516
|
}, {});
|
|
365
517
|
_%>
|
|
366
518
|
<%_ Object.entries(groupedByObjType).forEach(([objectType, configs]) => { _%>
|
|
367
|
-
|
|
519
|
+
<%_
|
|
368
520
|
const hasOwnTopic = configs.some(c => c.invocationType === 'ownTopic');
|
|
369
521
|
const hasLambdaSyncInv = configs.some(c => c.invocationType === 'lambdaSyncInv');
|
|
370
522
|
_%>
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
523
|
+
if (requestParams.objectType === '<%= objectType %>') {
|
|
524
|
+
<%_ if (hasLambdaSyncInv) { _%>
|
|
525
|
+
const lambdaSyncInvResults = await Promise.all([
|
|
526
|
+
<%_ configs.filter(c => c.invocationType === 'lambdaSyncInv').forEach((config, index, arr) => { _%>
|
|
527
|
+
// lambdaSyncInv <%= config.flowTag %>
|
|
528
|
+
lambda
|
|
529
|
+
.invokeSync(
|
|
378
530
|
_izContext,
|
|
379
531
|
await lambdaSharedLib.lambdaFunctionName(
|
|
380
532
|
_izContext,
|
|
381
533
|
'Process<%= config.flowTag %>HdrInv'
|
|
382
534
|
),
|
|
383
535
|
{ requestParams, callingFlowConfig }
|
|
384
|
-
)
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
536
|
+
)
|
|
537
|
+
.then((returnValue) => ({
|
|
538
|
+
flowTag: '<%= config.flowTag %>',
|
|
539
|
+
returnValue
|
|
540
|
+
})) /*__EJS_COMMA_14__*/
|
|
541
|
+
// lambdaSyncInv <%= config.flowTag %>
|
|
542
|
+
<%_ }) _%>
|
|
543
|
+
]);
|
|
544
|
+
<%_ } _%>
|
|
545
|
+
|
|
546
|
+
//(<afterBeforeLogical_<%= objectType %>>)
|
|
547
|
+
//(</afterBeforeLogical_<%= objectType %>>)
|
|
548
|
+
|
|
549
|
+
<%_ if (hasOwnTopic) { _%>
|
|
550
|
+
// ── ownTopic (async — create awaitingSteps and then publish) ──────────
|
|
551
|
+
const awaitingMultipleStepIds = [];
|
|
552
|
+
const recordMsgs = [];
|
|
553
|
+
|
|
554
|
+
<%_ configs.filter(c => c.invocationType === 'ownTopic').forEach(config => { _%>
|
|
555
|
+
// ownTopic <%= config.flowTag %>
|
|
556
|
+
awaitingMultipleStepIds.push({
|
|
557
|
+
awaitingStepId: await asyncFlowSharedLib.createAwaitingStepId(
|
|
558
|
+
hash(identifiers),
|
|
559
|
+
'<%= config.codeHookTag %>_<%= objectType %>_<%= config.flowTag.charAt(0).toUpperCase() + config.flowTag.slice(1) %>'
|
|
560
|
+
),
|
|
561
|
+
additionalAttributes: {}
|
|
562
|
+
});
|
|
563
|
+
|
|
564
|
+
recordMsgs.push({
|
|
565
|
+
msg: callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
|
|
566
|
+
requestParams,
|
|
567
|
+
callingFlowSharedLib.addParentCallingFlowConfig(
|
|
568
|
+
callingFlowConfig,
|
|
569
|
+
callingFlowSharedLib.createCallingFlowConfig(
|
|
570
|
+
//(<callingFlowProperties_<%= config.flowTag %>>)
|
|
571
|
+
await lambdaSharedLib.lambdaFunctionName(
|
|
572
|
+
_izContext,
|
|
573
|
+
'<%= config.generatedCodeTag %><%= config.codeHookTag.charAt(0).toUpperCase() + config.codeHookTag.slice(1) %>'
|
|
574
|
+
),
|
|
575
|
+
{}
|
|
576
|
+
//(</callingFlowProperties_<%= config.flowTag %>>)
|
|
577
|
+
)
|
|
578
|
+
)
|
|
579
|
+
),
|
|
580
|
+
flowTag: '<%= config.flowTag.charAt(0).toUpperCase() + config.flowTag.slice(1) %>'
|
|
581
|
+
});
|
|
582
|
+
<%_ }) _%>
|
|
583
|
+
|
|
584
|
+
<%_ if (hasLambdaSyncInv) { _%>
|
|
585
|
+
// ── Add lambdaSyncInv results to awaitingSteps ────────────────────────
|
|
586
|
+
for (const syncResult of lambdaSyncInvResults) {
|
|
400
587
|
awaitingMultipleStepIds.push({
|
|
401
588
|
awaitingStepId: await asyncFlowSharedLib.createAwaitingStepId(
|
|
402
589
|
hash(identifiers),
|
|
403
|
-
'<%=
|
|
590
|
+
'<%= configs[0].codeHookTag %>_<%= objectType %>_' + syncResult.flowTag
|
|
404
591
|
),
|
|
405
|
-
additionalAttributes: {
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
requestParams,
|
|
411
|
-
callingFlowSharedLib.addParentCallingFlowConfig(
|
|
412
|
-
callingFlowConfig,
|
|
413
|
-
callingFlowSharedLib.createCallingFlowConfig(
|
|
414
|
-
//(<callingFlowProperties_<%= config.flowTag %>>)
|
|
415
|
-
await lambdaSharedLib.lambdaFunctionName(
|
|
416
|
-
_izContext,
|
|
417
|
-
'<%= config.generatedCodeTag %><%= config.codeHookTag.charAt(0).toUpperCase() + config.codeHookTag.slice(1) %>'
|
|
418
|
-
),
|
|
419
|
-
{}
|
|
420
|
-
//(</callingFlowProperties_<%= config.flowTag %>>)
|
|
421
|
-
)
|
|
422
|
-
)
|
|
423
|
-
),
|
|
424
|
-
flowTag: '<%= config.flowTag.charAt(0).toUpperCase() + config.flowTag.slice(1) %>'
|
|
592
|
+
additionalAttributes: {
|
|
593
|
+
complete: true,
|
|
594
|
+
errorsFound: [],
|
|
595
|
+
returnValue: syncResult.returnValue
|
|
596
|
+
}
|
|
425
597
|
});
|
|
426
|
-
|
|
598
|
+
}
|
|
599
|
+
<%_ } _%>
|
|
600
|
+
|
|
601
|
+
await asyncFlowSharedLib.initAwaitingStepsWithAttrs(
|
|
602
|
+
_izContext,
|
|
603
|
+
awaitingMultipleStepIds,
|
|
604
|
+
asyncFlowSharedLib.createPendingStepId(
|
|
605
|
+
_izContext.uniqueRequestId,
|
|
606
|
+
'beforeLogical_<%= objectType %>'
|
|
607
|
+
)
|
|
608
|
+
);
|
|
427
609
|
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
for (const syncResult of lambdaSyncInvResults) {
|
|
431
|
-
awaitingMultipleStepIds.push({
|
|
432
|
-
awaitingStepId: await asyncFlowSharedLib.createAwaitingStepId(
|
|
433
|
-
hash(identifiers),
|
|
434
|
-
'<%= configs[0].codeHookTag %>_<%= objectType %>_' + syncResult.flowTag
|
|
435
|
-
),
|
|
436
|
-
additionalAttributes: {
|
|
437
|
-
complete: true,
|
|
438
|
-
errorsFound: [],
|
|
439
|
-
returnValue: syncResult.returnValue
|
|
440
|
-
}
|
|
441
|
-
});
|
|
442
|
-
}
|
|
443
|
-
<%_ } _%>
|
|
610
|
+
//(<beforePublish_<%= objectType %>>)
|
|
611
|
+
//(</beforePublish_<%= objectType %>>)
|
|
444
612
|
|
|
445
|
-
|
|
613
|
+
for (const recordMsg of recordMsgs) {
|
|
614
|
+
const messageAttributes = sns.createStringMessageAttributes(
|
|
446
615
|
_izContext,
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
'beforeLogical_<%= objectType %>'
|
|
616
|
+
callingFlowSharedLib.addCallingFlowToSnsResponseMessageAttributes(
|
|
617
|
+
callingFlowConfig,
|
|
618
|
+
{}
|
|
451
619
|
)
|
|
452
620
|
);
|
|
453
621
|
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
const messageAttributes = sns.createStringMessageAttributes(
|
|
459
|
-
_izContext,
|
|
460
|
-
callingFlowSharedLib.addCallingFlowToSnsResponseMessageAttributes(
|
|
461
|
-
callingFlowConfig,
|
|
462
|
-
{}
|
|
463
|
-
)
|
|
464
|
-
);
|
|
465
|
-
|
|
466
|
-
const topicArn = snsSharedLib.snsTopicArnByFlowSchema(
|
|
467
|
-
_izContext,
|
|
468
|
-
`${recordMsg.flowTag}_In`
|
|
469
|
-
);
|
|
622
|
+
const topicArn = snsSharedLib.snsTopicArnByFlowSchema(
|
|
623
|
+
_izContext,
|
|
624
|
+
`${recordMsg.flowTag}_In`
|
|
625
|
+
);
|
|
470
626
|
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
627
|
+
await sns.publishAsync(_izContext, {
|
|
628
|
+
Message: JSON.stringify(recordMsg.msg),
|
|
629
|
+
MessageAttributes: messageAttributes,
|
|
630
|
+
TopicArn: topicArn
|
|
631
|
+
});
|
|
632
|
+
}
|
|
477
633
|
|
|
478
|
-
|
|
634
|
+
return 'complete beforeLogical <%= objectType %>';
|
|
479
635
|
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
636
|
+
<%_ } else { _%>
|
|
637
|
+
// ── lambdaSyncInv only — collect results and proceed to updateMainLogical
|
|
638
|
+
const beforeLogicalResults = lambdaSyncInvResults.reduce((acc, r) => {
|
|
639
|
+
acc[r.flowTag] = r.returnValue;
|
|
640
|
+
return acc;
|
|
641
|
+
}, {});
|
|
486
642
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
643
|
+
return await <%- flowTag %>MainLogical(
|
|
644
|
+
_izContext,
|
|
645
|
+
requestParams,
|
|
646
|
+
callingFlowConfig,
|
|
647
|
+
beforeLogicalResults
|
|
648
|
+
);
|
|
649
|
+
<%_ } _%>
|
|
650
|
+
}
|
|
495
651
|
<%_ }) _%>
|
|
496
652
|
|
|
497
653
|
//(<beforeUpdateMainLogical>)
|
|
@@ -503,9 +659,8 @@ export default async function <%- flowTag %>(
|
|
|
503
659
|
requestParams,
|
|
504
660
|
callingFlowConfig
|
|
505
661
|
);
|
|
506
|
-
|
|
507
662
|
} catch (err) {
|
|
508
|
-
_izContext.logger.error('error
|
|
663
|
+
_izContext.logger.error('[<%- flowTag %>] error:', err);
|
|
509
664
|
throw err;
|
|
510
665
|
}
|
|
511
666
|
}
|