@izara_project/izara-core-generate-service-code 1.0.89 → 1.0.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/emit/crud/emitDynamicCrudFlowSchemas.js +2 -2
- 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 +153 -28
- package/src/emit/crud/templates/CreateEndpoint_Main.ejs +18 -18
- package/src/emit/crud/templates/CreateLogicalLib.ejs +83 -54
- package/src/emit/crud/templates/CreateNodeCallback_Main.ejs +32 -25
- 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 +20 -22
- 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 -36
- 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/templates/UserRbacFlow_Main.ejs +33 -20
- package/src/emit/relationship/emitDynamicRelationshipFlowSchemas.js +1 -1
- 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/emitResourceArtifacts.js +48 -18
- 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/test/createTargetRoleHandler.test.js +70 -9
- package/test/crudApplicationArtifacts.test.js +98 -3
- 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 +42 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@izara_project/izara-core-generate-service-code",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.91",
|
|
4
4
|
"description": "Code for locally generating per service files",
|
|
5
5
|
"homepage": "https://bitbucket.org/izara-core-support-services/izara-core-support-services-generate-service-code#readme",
|
|
6
6
|
"repository": {
|
|
@@ -175,7 +175,7 @@ function _createDynamicFlow(action, plan, serviceTag = '', initiateBy = 'user')
|
|
|
175
175
|
'returnValue',
|
|
176
176
|
'parentFlowId',
|
|
177
177
|
'status',
|
|
178
|
-
'
|
|
178
|
+
'foundErrors',
|
|
179
179
|
'graphServiceTag'
|
|
180
180
|
],
|
|
181
181
|
messageAttributes: MESSAGE_ATTRIBUTES
|
|
@@ -210,7 +210,7 @@ function _createDynamicFlow(action, plan, serviceTag = '', initiateBy = 'user')
|
|
|
210
210
|
'returnValue',
|
|
211
211
|
'parentFlowId',
|
|
212
212
|
'status',
|
|
213
|
-
'
|
|
213
|
+
'foundErrors',
|
|
214
214
|
'graphServiceTag'
|
|
215
215
|
]
|
|
216
216
|
: [],
|
|
@@ -49,12 +49,12 @@ export default async function CreateAfterHookCallbackMain(
|
|
|
49
49
|
|
|
50
50
|
const {
|
|
51
51
|
status,
|
|
52
|
-
|
|
52
|
+
foundErrors = [],
|
|
53
53
|
returnValue,
|
|
54
54
|
parentFlowId
|
|
55
55
|
} = requestParams;
|
|
56
56
|
|
|
57
|
-
const mergedErrors = Array.isArray(
|
|
57
|
+
const mergedErrors = Array.isArray(foundErrors) ? [...foundErrors] : [];
|
|
58
58
|
if (status === 'error' && mergedErrors.length === 0) {
|
|
59
59
|
mergedErrors.push('AfterHook execution reported error');
|
|
60
60
|
}
|
|
@@ -78,13 +78,13 @@ export default async function CreateAfterHookCallbackMain(
|
|
|
78
78
|
targetIdentifiers: requestParams?.targetIdentifiers,
|
|
79
79
|
parentFlowId: parentFlowId || returnValue?.parentFlowId,
|
|
80
80
|
status: mergedErrors.length > 0 ? 'error' : 'complete',
|
|
81
|
-
|
|
81
|
+
foundErrors: mergedErrors
|
|
82
82
|
};
|
|
83
83
|
|
|
84
84
|
if (quotaKeys) {
|
|
85
85
|
await forwardToQuotaConfirmation(_izContext, {
|
|
86
86
|
status: mergedErrors.length > 0 ? 'error' : 'complete',
|
|
87
|
-
|
|
87
|
+
foundErrors: mergedErrors,
|
|
88
88
|
quotaKeys,
|
|
89
89
|
actionData,
|
|
90
90
|
callingFlowConfig
|
|
@@ -97,7 +97,7 @@ export default async function CreateAfterHookCallbackMain(
|
|
|
97
97
|
const completionPayload = {
|
|
98
98
|
...actionData,
|
|
99
99
|
status: mergedErrors.length > 0 ? 'error' : 'complete',
|
|
100
|
-
|
|
100
|
+
foundErrors: mergedErrors
|
|
101
101
|
};
|
|
102
102
|
await sns.publishAsync(_izContext, {
|
|
103
103
|
TopicArn: topicArn,
|
|
@@ -112,7 +112,7 @@ export default async function CreateAfterHookCallbackMain(
|
|
|
112
112
|
return {
|
|
113
113
|
returnValue,
|
|
114
114
|
status: mergedErrors.length > 0 ? 'error' : 'complete',
|
|
115
|
-
|
|
115
|
+
foundErrors: mergedErrors
|
|
116
116
|
};
|
|
117
117
|
} catch (error) {
|
|
118
118
|
_izContext.logger.error('[CreateAfterHookCallback] error:', error);
|
|
@@ -45,12 +45,12 @@ export default async function <%- upperCaseFlowTag %>BeforeHookCallbackMain(
|
|
|
45
45
|
|
|
46
46
|
const {
|
|
47
47
|
status,
|
|
48
|
-
|
|
48
|
+
foundErrors = [],
|
|
49
49
|
returnValue,
|
|
50
50
|
parentFlowId
|
|
51
51
|
} = requestParams;
|
|
52
52
|
|
|
53
|
-
const mergedErrors = Array.isArray(
|
|
53
|
+
const mergedErrors = Array.isArray(foundErrors) ? [...foundErrors] : [];
|
|
54
54
|
if (status === 'error' && mergedErrors.length === 0) {
|
|
55
55
|
mergedErrors.push('BeforeHook execution reported error');
|
|
56
56
|
}
|
|
@@ -82,7 +82,7 @@ export default async function <%- upperCaseFlowTag %>BeforeHookCallbackMain(
|
|
|
82
82
|
},
|
|
83
83
|
requestParams: originalRequestParams || {},
|
|
84
84
|
callingFlowConfig,
|
|
85
|
-
|
|
85
|
+
foundErrors: mergedErrors
|
|
86
86
|
});
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import asyncFlowSharedLib from '@izara_project/izara-core-library-asynchronous-flow';
|
|
2
2
|
import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
|
|
3
3
|
import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
|
|
4
|
+
import lambdaSharedLib from '@izara_project/izara-core-library-lambda';
|
|
4
5
|
import snsSharedLib from '@izara_project/izara-core-library-sns';
|
|
5
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
sns,
|
|
8
|
+
lambda
|
|
9
|
+
} from '@izara_project/izara-core-library-external-request';
|
|
6
10
|
import { consts } from '@izara_project/izara-core-library-service-schemas';
|
|
7
11
|
import { NoRetryError } from '@izara_project/izara-core-library-core';
|
|
8
12
|
|
|
@@ -19,29 +23,29 @@ function empty(value) {
|
|
|
19
23
|
);
|
|
20
24
|
}
|
|
21
25
|
|
|
22
|
-
function validateInput(returnValue, status, graphServiceTag,
|
|
26
|
+
function validateInput(returnValue, status, graphServiceTag, foundErrors) {
|
|
23
27
|
if (!returnValue?.queryResult)
|
|
24
|
-
|
|
28
|
+
foundErrors.push(
|
|
25
29
|
'message is not have property queryResult, should be not happen'
|
|
26
30
|
);
|
|
27
31
|
if (!returnValue?.requestParams?.objType)
|
|
28
|
-
|
|
32
|
+
foundErrors.push(
|
|
29
33
|
'message is not have property objType, should be not happen'
|
|
30
34
|
);
|
|
31
35
|
if (!returnValue?.requestParams?.objInstanceFull)
|
|
32
|
-
|
|
36
|
+
foundErrors.push(
|
|
33
37
|
'message is not have property objInstance, should be not objInstance'
|
|
34
38
|
);
|
|
35
|
-
if (status === 'error' &&
|
|
36
|
-
|
|
37
|
-
'[invalid]status is error not have
|
|
39
|
+
if (status === 'error' && foundErrors.length === 0)
|
|
40
|
+
foundErrors.push(
|
|
41
|
+
'[invalid]status is error not have foundErrors form graphService'
|
|
38
42
|
);
|
|
39
|
-
if (status === 'complete' &&
|
|
40
|
-
|
|
41
|
-
'[Invalid] status is complete should be not have
|
|
43
|
+
if (status === 'complete' && foundErrors.length > 0)
|
|
44
|
+
foundErrors.push(
|
|
45
|
+
'[Invalid] status is complete should be not have foundErrors'
|
|
42
46
|
);
|
|
43
47
|
if (graphServiceTag == null)
|
|
44
|
-
|
|
48
|
+
foundErrors.push('[Invalid] graphServerTag is not empty string');
|
|
45
49
|
}
|
|
46
50
|
|
|
47
51
|
export default async function CreateComplete(
|
|
@@ -58,14 +62,14 @@ export default async function CreateComplete(
|
|
|
58
62
|
const {
|
|
59
63
|
returnValue,
|
|
60
64
|
status,
|
|
61
|
-
|
|
65
|
+
foundErrors = [],
|
|
62
66
|
graphServiceTag,
|
|
63
67
|
parentFlowId
|
|
64
68
|
} = requestParams;
|
|
65
69
|
if (empty(returnValue?.requestParams))
|
|
66
70
|
throw new NoRetryError('message not an object');
|
|
67
|
-
validateInput(returnValue, status, graphServiceTag,
|
|
68
|
-
if (
|
|
71
|
+
validateInput(returnValue, status, graphServiceTag, foundErrors);
|
|
72
|
+
if (foundErrors.length > 0) foundErrors.push(foundErrors.join(','));
|
|
69
73
|
|
|
70
74
|
const awaitingStepId = await asyncFlowSharedLib.createAwaitingStepId(
|
|
71
75
|
parentFlowId,
|
|
@@ -84,14 +88,14 @@ export default async function CreateComplete(
|
|
|
84
88
|
_izContext.logger.warn(
|
|
85
89
|
`No pending step found for awaitingStepId: ${awaitingStepId}`
|
|
86
90
|
);
|
|
87
|
-
return { returnValue, status,
|
|
91
|
+
return { returnValue, status, foundErrors };
|
|
88
92
|
}
|
|
89
93
|
const result =
|
|
90
94
|
await asyncFlowSharedLib.checkAllAwaitingStepsFinishedWithReturnParams(
|
|
91
95
|
_izContext,
|
|
92
96
|
pending.pendingStepId,
|
|
93
97
|
awaitingStepId,
|
|
94
|
-
|
|
98
|
+
foundErrors
|
|
95
99
|
);
|
|
96
100
|
_izContext.logger.debug(
|
|
97
101
|
'[CreateComplete] all awaiting steps result',
|
|
@@ -142,18 +146,138 @@ export default async function CreateComplete(
|
|
|
142
146
|
const callingFlowConfig =
|
|
143
147
|
result?.additionalAttributes?.callingFlowConfig ||
|
|
144
148
|
passBackProperties;
|
|
149
|
+
const actionData = {
|
|
150
|
+
objType: returnValue.requestParams.objType,
|
|
151
|
+
objInstanceFull: node.objInstanceFull,
|
|
152
|
+
relationships: node.relationships,
|
|
153
|
+
parentFlowId: parentFlowId || returnValue?.parentFlowId,
|
|
154
|
+
existsNode,
|
|
155
|
+
status,
|
|
156
|
+
foundErrors
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
<%_ if (plan?.hasAfterHookSync) { _%>
|
|
160
|
+
// ── Synchronous After Hooks ──
|
|
161
|
+
<%_ plan.afterHooks.filter(h => h?.generatedCodeConfig?.invocationType === 'lambdaSyncInv').forEach(hook => { _%>
|
|
162
|
+
<%_ if (hook.targetObjectTypes && hook.targetObjectTypes.length === 1) { _%>
|
|
163
|
+
if (returnValue.requestParams?.objType?.objectType === '<%= hook.targetObjectTypes[0] %>') {
|
|
164
|
+
<%_ } else if (hook.targetObjectTypes && hook.targetObjectTypes.length > 1) { _%>
|
|
165
|
+
if (<%- JSON.stringify(hook.targetObjectTypes) %>.includes(returnValue.requestParams?.objType?.objectType)) {
|
|
166
|
+
<%_ } _%>
|
|
167
|
+
try {
|
|
168
|
+
let hookPayload_<%= hook.flowTag %> = {
|
|
169
|
+
objType: returnValue.requestParams.objType,
|
|
170
|
+
objInstanceFull: node.objInstanceFull,
|
|
171
|
+
relationships: node.relationships || [],
|
|
172
|
+
targetIdentifiers: requestParams.targetIdentifiers,
|
|
173
|
+
submittedByUserId: returnValue?.requestParams?.submittedByUserId || requestParams?.submittedByUserId
|
|
174
|
+
};
|
|
175
|
+
//(<beforeSendHook_<%= hook.flowTag %>>)
|
|
176
|
+
//(</beforeSendHook_<%= hook.flowTag %>>)
|
|
177
|
+
const hookResult = await lambda.invokeSync(
|
|
178
|
+
_izContext,
|
|
179
|
+
await lambdaSharedLib.lambdaFunctionName(
|
|
180
|
+
_izContext,
|
|
181
|
+
'<%= hook.flowTag %>'
|
|
182
|
+
),
|
|
183
|
+
{
|
|
184
|
+
requestParams: hookPayload_<%= hook.flowTag %>,
|
|
185
|
+
callingFlowConfig
|
|
186
|
+
}
|
|
187
|
+
);
|
|
188
|
+
if (hookResult?.foundErrors?.length > 0 || hookResult?.status === 'error') {
|
|
189
|
+
foundErrors.push(...(hookResult.foundErrors || ['Hook <%= hook.flowTag %> failed']));
|
|
190
|
+
}
|
|
191
|
+
} catch (hookErr) {
|
|
192
|
+
_izContext.logger.error('[CreateComplete] Sync hook <%= hook.flowTag %> error:', hookErr);
|
|
193
|
+
foundErrors.push(hookErr.message || 'Hook <%= hook.flowTag %> failed');
|
|
194
|
+
}
|
|
195
|
+
<%_ if (hook.targetObjectTypes && hook.targetObjectTypes.length > 0) { _%>
|
|
196
|
+
}
|
|
197
|
+
<%_ } _%>
|
|
198
|
+
<%_ }) _%>
|
|
199
|
+
<%_ } _%>
|
|
200
|
+
|
|
201
|
+
<%_ if (plan?.hasAfterHookAsync) { _%>
|
|
202
|
+
// ── Asynchronous After Hooks ──
|
|
203
|
+
let afterHookDispatched = false;
|
|
204
|
+
<%_ plan.afterHooks.filter(h => h?.generatedCodeConfig?.invocationType === 'ownTopic').forEach(hook => { _%>
|
|
205
|
+
<%_ if (hook.targetObjectTypes && hook.targetObjectTypes.length === 1) { _%>
|
|
206
|
+
if (returnValue.requestParams?.objType?.objectType === '<%= hook.targetObjectTypes[0] %>') {
|
|
207
|
+
<%_ } else if (hook.targetObjectTypes && hook.targetObjectTypes.length > 1) { _%>
|
|
208
|
+
if (<%- JSON.stringify(hook.targetObjectTypes) %>.includes(returnValue.requestParams?.objType?.objectType)) {
|
|
209
|
+
<%_ } _%>
|
|
210
|
+
afterHookDispatched = true;
|
|
211
|
+
let hookPayload_<%= hook.flowTag %> = {
|
|
212
|
+
objType: returnValue.requestParams.objType,
|
|
213
|
+
objInstanceFull: node.objInstanceFull,
|
|
214
|
+
relationships: node.relationships || [],
|
|
215
|
+
targetIdentifiers: requestParams.targetIdentifiers,
|
|
216
|
+
submittedByUserId: returnValue?.requestParams?.submittedByUserId || requestParams?.submittedByUserId
|
|
217
|
+
};
|
|
218
|
+
//(<beforeSendHook_<%= hook.flowTag %>>)
|
|
219
|
+
//(</beforeSendHook_<%= hook.flowTag %>>)
|
|
220
|
+
const hookMsg_<%= hook.flowTag %> = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
|
|
221
|
+
hookPayload_<%= hook.flowTag %>,
|
|
222
|
+
callingFlowSharedLib.addParentCallingFlowConfig(
|
|
223
|
+
callingFlowConfig,
|
|
224
|
+
callingFlowSharedLib.createCallingFlowConfig(
|
|
225
|
+
await lambdaSharedLib.lambdaFunctionName(
|
|
226
|
+
_izContext,
|
|
227
|
+
'CreateAfterHookCallbackHdrSqs'
|
|
228
|
+
),
|
|
229
|
+
{
|
|
230
|
+
actionData
|
|
231
|
+
}
|
|
232
|
+
)
|
|
233
|
+
)
|
|
234
|
+
);
|
|
235
|
+
|
|
236
|
+
await sns.publishAsync(_izContext, {
|
|
237
|
+
TopicArn: snsSharedLib.snsTopicArnByFlowSchema(
|
|
238
|
+
_izContext,
|
|
239
|
+
'<%= hook.flowTag %>_In'
|
|
240
|
+
),
|
|
241
|
+
Message: JSON.stringify(hookMsg_<%= hook.flowTag %>),
|
|
242
|
+
MessageAttributes: sns.createStringMessageAttributes(_izContext, {})
|
|
243
|
+
});
|
|
244
|
+
<%_ if (hook.targetObjectTypes && hook.targetObjectTypes.length > 0) { _%>
|
|
245
|
+
}
|
|
246
|
+
<%_ } _%>
|
|
247
|
+
<%_ }) _%>
|
|
248
|
+
if (!afterHookDispatched) {
|
|
249
|
+
const message =
|
|
250
|
+
callingFlowSharedLib.addParentPassBackPropertiesToSnsResponseMessageObject(
|
|
251
|
+
callingFlowConfig,
|
|
252
|
+
actionData
|
|
253
|
+
);
|
|
254
|
+
const messageAttributes =
|
|
255
|
+
callingFlowSharedLib.addParentPassBackCallingFlowToSnsResponseMessageAttributes(
|
|
256
|
+
callingFlowConfig,
|
|
257
|
+
{}
|
|
258
|
+
);
|
|
259
|
+
const topicArn = snsSharedLib.snsTopicArnByFlowSchema(
|
|
260
|
+
_izContext,
|
|
261
|
+
TOPIC_NAME_GENERATE_CODE.outCreateNodeComplete
|
|
262
|
+
);
|
|
263
|
+
_izContext.logger.debug('[CreateComplete] publishing to SNS', {
|
|
264
|
+
TopicArn: topicArn,
|
|
265
|
+
message
|
|
266
|
+
});
|
|
267
|
+
await sns.publishAsync(_izContext, {
|
|
268
|
+
Message: JSON.stringify(message),
|
|
269
|
+
MessageAttributes: sns.createStringMessageAttributes(
|
|
270
|
+
_izContext,
|
|
271
|
+
messageAttributes
|
|
272
|
+
),
|
|
273
|
+
TopicArn: topicArn
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
<%_ } else { _%>
|
|
145
277
|
const message =
|
|
146
278
|
callingFlowSharedLib.addParentPassBackPropertiesToSnsResponseMessageObject(
|
|
147
279
|
callingFlowConfig,
|
|
148
|
-
|
|
149
|
-
objType: returnValue.requestParams.objType,
|
|
150
|
-
objInstanceFull: node.objInstanceFull,
|
|
151
|
-
relationships: node.relationships,
|
|
152
|
-
parentFlowId: parentFlowId || returnValue?.parentFlowId,
|
|
153
|
-
existsNode,
|
|
154
|
-
status,
|
|
155
|
-
errorsFound
|
|
156
|
-
}
|
|
280
|
+
actionData
|
|
157
281
|
);
|
|
158
282
|
const messageAttributes =
|
|
159
283
|
callingFlowSharedLib.addParentPassBackCallingFlowToSnsResponseMessageAttributes(
|
|
@@ -176,6 +300,7 @@ export default async function CreateComplete(
|
|
|
176
300
|
),
|
|
177
301
|
TopicArn: topicArn
|
|
178
302
|
});
|
|
303
|
+
<%_ } _%>
|
|
179
304
|
//(<afterSendMessage>)
|
|
180
305
|
//(</afterSendMessage>)
|
|
181
306
|
}
|
|
@@ -183,9 +308,9 @@ export default async function CreateComplete(
|
|
|
183
308
|
_izContext,
|
|
184
309
|
awaitingStepId,
|
|
185
310
|
pending.pendingStepId,
|
|
186
|
-
|
|
311
|
+
foundErrors
|
|
187
312
|
);
|
|
188
|
-
return { returnValue, status,
|
|
313
|
+
return { returnValue, status, foundErrors };
|
|
189
314
|
} catch (error) {
|
|
190
315
|
_izContext.logger.error('[CreateComplete] error:', error);
|
|
191
316
|
throw error;
|
|
@@ -76,11 +76,11 @@ export default async function <%- flowTag %>(
|
|
|
76
76
|
}
|
|
77
77
|
);
|
|
78
78
|
|
|
79
|
-
const
|
|
79
|
+
const foundErrors = [];
|
|
80
80
|
|
|
81
81
|
// Step 1: Resolve Schema & Identity
|
|
82
82
|
const { objType, objectSchema } =
|
|
83
|
-
await resolveSchemaAndIdentity(_izContext, requestParams,
|
|
83
|
+
await resolveSchemaAndIdentity(_izContext, requestParams, foundErrors);
|
|
84
84
|
|
|
85
85
|
//(<beforeQuery>)
|
|
86
86
|
//(</beforeQuery>)
|
|
@@ -90,27 +90,27 @@ export default async function <%- flowTag %>(
|
|
|
90
90
|
_izContext,
|
|
91
91
|
requestParams,
|
|
92
92
|
objectSchema,
|
|
93
|
-
|
|
93
|
+
foundErrors
|
|
94
94
|
);
|
|
95
95
|
|
|
96
|
-
if (
|
|
96
|
+
if (foundErrors.length > 0) {
|
|
97
97
|
return await <%- flowTag %>LogicalLib(
|
|
98
98
|
_izContext,
|
|
99
99
|
requestParams,
|
|
100
100
|
callingFlowConfig,
|
|
101
|
-
|
|
101
|
+
foundErrors
|
|
102
102
|
);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
// Step 3: Validate FieldNames
|
|
106
|
-
validateFieldNames(_izContext, requestParams, objectSchemas,
|
|
106
|
+
validateFieldNames(_izContext, requestParams, objectSchemas, foundErrors);
|
|
107
107
|
|
|
108
|
-
if (
|
|
108
|
+
if (foundErrors.length > 0) {
|
|
109
109
|
return await <%- flowTag %>LogicalLib(
|
|
110
110
|
_izContext,
|
|
111
111
|
requestParams,
|
|
112
112
|
callingFlowConfig,
|
|
113
|
-
|
|
113
|
+
foundErrors
|
|
114
114
|
);
|
|
115
115
|
}
|
|
116
116
|
|
|
@@ -178,12 +178,12 @@ export default async function <%- flowTag %>(
|
|
|
178
178
|
);
|
|
179
179
|
|
|
180
180
|
if (resultPermissionCheck && resultPermissionCheck.permission !== true) {
|
|
181
|
-
|
|
181
|
+
foundErrors.push('Permission denied');
|
|
182
182
|
return await <%- flowTag %>LogicalLib(
|
|
183
183
|
_izContext,
|
|
184
184
|
requestParams,
|
|
185
185
|
callingFlowConfig,
|
|
186
|
-
|
|
186
|
+
foundErrors
|
|
187
187
|
);
|
|
188
188
|
}
|
|
189
189
|
|
|
@@ -240,10 +240,10 @@ export default async function <%- flowTag %>(
|
|
|
240
240
|
flowTag: '<%= config.flowTag %>',
|
|
241
241
|
returnValue
|
|
242
242
|
});
|
|
243
|
-
if (returnValue?.
|
|
244
|
-
|
|
243
|
+
if (returnValue?.foundErrors?.length > 0) {
|
|
244
|
+
foundErrors.push(...returnValue.foundErrors);
|
|
245
245
|
} else if (returnValue?.status === 'error') {
|
|
246
|
-
|
|
246
|
+
foundErrors.push('Error from <%= config.flowTag %>');
|
|
247
247
|
} else {
|
|
248
248
|
if (returnValue?.fieldNames && requestParams?.fieldNames) {
|
|
249
249
|
Object.assign(requestParams.fieldNames, returnValue.fieldNames);
|
|
@@ -257,16 +257,16 @@ export default async function <%- flowTag %>(
|
|
|
257
257
|
'[<%- flowTag %>] Sync hook <%= config.flowTag %> error:',
|
|
258
258
|
hookErr
|
|
259
259
|
);
|
|
260
|
-
|
|
260
|
+
foundErrors.push(hookErr.message || 'Hook <%= config.flowTag %> failed');
|
|
261
261
|
}
|
|
262
262
|
<%_ } _%>
|
|
263
263
|
|
|
264
|
-
if (
|
|
264
|
+
if (foundErrors.length > 0) {
|
|
265
265
|
return await <%- flowTag %>LogicalLib(
|
|
266
266
|
_izContext,
|
|
267
267
|
requestParams,
|
|
268
268
|
callingFlowConfig,
|
|
269
|
-
|
|
269
|
+
foundErrors
|
|
270
270
|
);
|
|
271
271
|
}
|
|
272
272
|
<%_ } _%>
|
|
@@ -346,7 +346,7 @@ export default async function <%- flowTag %>(
|
|
|
346
346
|
_izContext,
|
|
347
347
|
requestParams,
|
|
348
348
|
callingFlowConfig,
|
|
349
|
-
|
|
349
|
+
foundErrors
|
|
350
350
|
);
|
|
351
351
|
<%_ } _%>
|
|
352
352
|
}
|
|
@@ -359,7 +359,7 @@ export default async function <%- flowTag %>(
|
|
|
359
359
|
_izContext,
|
|
360
360
|
requestParams,
|
|
361
361
|
callingFlowConfig,
|
|
362
|
-
|
|
362
|
+
foundErrors
|
|
363
363
|
);
|
|
364
364
|
} catch (err) {
|
|
365
365
|
_izContext.logger.error(
|