@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
|
@@ -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,13 +172,13 @@ 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);
|
|
173
179
|
await _setL2Cache(_izContext, submittedByUserId, cacheSubKey, result);
|
|
174
180
|
await _publicMessageOut(_izContext, { ...result, parentFlowId });
|
|
175
|
-
return
|
|
181
|
+
return result;
|
|
176
182
|
}
|
|
177
183
|
|
|
178
184
|
// 1. Check L1 In-Memory Cache
|
|
@@ -180,7 +186,7 @@ export default async function <%- flowTag %>(_izContext, requestParams = {}) {
|
|
|
180
186
|
if (l1Hit) {
|
|
181
187
|
_izContext.logger.debug(`[${process.env.iz_serviceTag}:<%- flowTag %>] L1 Cache hit:`, l1Hit);
|
|
182
188
|
await _publicMessageOut(_izContext, { ...l1Hit, parentFlowId });
|
|
183
|
-
return;
|
|
189
|
+
return l1Hit;
|
|
184
190
|
}
|
|
185
191
|
|
|
186
192
|
// 2. Check L2 Shared DynamoDB Cache
|
|
@@ -189,7 +195,7 @@ export default async function <%- flowTag %>(_izContext, requestParams = {}) {
|
|
|
189
195
|
_izContext.logger.debug(`[${process.env.iz_serviceTag}:<%- flowTag %>] L2 Cache hit:`, l2Hit);
|
|
190
196
|
_setL1Cache(fullCacheKey, l2Hit);
|
|
191
197
|
await _publicMessageOut(_izContext, { ...l2Hit, parentFlowId });
|
|
192
|
-
return;
|
|
198
|
+
return l2Hit;
|
|
193
199
|
}
|
|
194
200
|
|
|
195
201
|
_izContext.logger.debug(`[${process.env.iz_serviceTag}:<%- flowTag %>] Cache miss — querying DynamoDB`);
|
|
@@ -231,13 +237,13 @@ 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);
|
|
238
244
|
await _setL2Cache(_izContext, submittedByUserId, cacheSubKey, result);
|
|
239
245
|
await _publicMessageOut(_izContext, { ...result, parentFlowId });
|
|
240
|
-
return;
|
|
246
|
+
return result;
|
|
241
247
|
}
|
|
242
248
|
|
|
243
249
|
const rolePermissionsTable = dynamodbSharedLib.tableName(
|
|
@@ -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
|
|
|
@@ -289,19 +295,26 @@ export default async function <%- flowTag %>(_izContext, requestParams = {}) {
|
|
|
289
295
|
|
|
290
296
|
await _publicMessageOut(_izContext, { ...cacheResult, parentFlowId });
|
|
291
297
|
|
|
292
|
-
return
|
|
298
|
+
return cacheResult;
|
|
293
299
|
}
|
|
294
300
|
|
|
295
301
|
async function _publicMessageOut(_izContext, message) {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
302
|
+
try {
|
|
303
|
+
const topicOut = snsSharedLib.snsTopicArnByFlowSchema(
|
|
304
|
+
_izContext,
|
|
305
|
+
process.env.iz_flowTag + '_Out'
|
|
306
|
+
);
|
|
300
307
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
308
|
+
await sns.publishAsync(_izContext, {
|
|
309
|
+
TopicArn: topicOut,
|
|
310
|
+
Message: JSON.stringify(message)
|
|
311
|
+
});
|
|
312
|
+
} catch (error) {
|
|
313
|
+
_izContext.logger.warn(
|
|
314
|
+
`[${process.env.iz_serviceTag}:_publicMessageOut] Failed to publish message out:`,
|
|
315
|
+
error
|
|
316
|
+
);
|
|
317
|
+
}
|
|
305
318
|
}
|
|
306
319
|
|
|
307
320
|
function _matchesParameterGroups(groups, input) {
|
|
@@ -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>)
|
|
@@ -44,7 +44,7 @@ export default async function changeRelationshipComplete(
|
|
|
44
44
|
returnValue,
|
|
45
45
|
parentFlowId,
|
|
46
46
|
status,
|
|
47
|
-
|
|
47
|
+
foundErrors,
|
|
48
48
|
graphServiceTag
|
|
49
49
|
} = requestParams;
|
|
50
50
|
|
|
@@ -52,7 +52,7 @@ export default async function changeRelationshipComplete(
|
|
|
52
52
|
returnValue: returnValue,
|
|
53
53
|
parentFlowId: parentFlowId,
|
|
54
54
|
status: status,
|
|
55
|
-
|
|
55
|
+
foundErrors: foundErrors,
|
|
56
56
|
graphServiceTag: graphServiceTag,
|
|
57
57
|
passBackProperties: passBackProperties
|
|
58
58
|
});
|
|
@@ -76,7 +76,7 @@ export default async function changeRelationshipComplete(
|
|
|
76
76
|
_izContext.logger.warn(
|
|
77
77
|
`No pending step found for awaitingStepId: ${awaitingStepId}`
|
|
78
78
|
);
|
|
79
|
-
return { returnValue, status,
|
|
79
|
+
return { returnValue, status, foundErrors };
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
const result =
|
|
@@ -84,7 +84,7 @@ export default async function changeRelationshipComplete(
|
|
|
84
84
|
_izContext,
|
|
85
85
|
pending.pendingStepId,
|
|
86
86
|
awaitingStepId,
|
|
87
|
-
|
|
87
|
+
foundErrors
|
|
88
88
|
);
|
|
89
89
|
_izContext.logger.debug(
|
|
90
90
|
'[ChangeRelationshipComplete] all awaiting steps result',
|
|
@@ -107,7 +107,7 @@ export default async function changeRelationshipComplete(
|
|
|
107
107
|
newRelType: returnValue.requestParams.newRelType,
|
|
108
108
|
parentFlowId: parentFlowId || returnValue?.parentFlowId,
|
|
109
109
|
status: status,
|
|
110
|
-
|
|
110
|
+
foundErrors: foundErrors
|
|
111
111
|
};
|
|
112
112
|
|
|
113
113
|
const callingFlowConfig =
|
|
@@ -165,7 +165,7 @@ export default async function changeRelationshipComplete(
|
|
|
165
165
|
return {
|
|
166
166
|
returnValue,
|
|
167
167
|
status,
|
|
168
|
-
|
|
168
|
+
foundErrors
|
|
169
169
|
};
|
|
170
170
|
} catch (err) {
|
|
171
171
|
_izContext.logger.error('error createRelationshipComplete:', err);
|
|
@@ -89,7 +89,7 @@ export default async function <%- functionName %>(
|
|
|
89
89
|
//(</requestParamCreateRel>)
|
|
90
90
|
} = requestParams;
|
|
91
91
|
|
|
92
|
-
let
|
|
92
|
+
let foundErrors = [];
|
|
93
93
|
const parentFlowId = identifierUuid();
|
|
94
94
|
//(<beforeValidateChangeRel>)
|
|
95
95
|
//(</beforeValidateChangeRel>).
|
|
@@ -106,7 +106,7 @@ export default async function <%- functionName %>(
|
|
|
106
106
|
);
|
|
107
107
|
|
|
108
108
|
if (!objectSchema) {
|
|
109
|
-
|
|
109
|
+
foundErrors.push(
|
|
110
110
|
`validateIdentifiers, not found schema of ${objTypeString}`
|
|
111
111
|
);
|
|
112
112
|
}
|
|
@@ -117,7 +117,7 @@ export default async function <%- functionName %>(
|
|
|
117
117
|
];
|
|
118
118
|
for (const identifierName of identifierNames) {
|
|
119
119
|
if (!identifiersObject.hasOwnProperty(identifierName)) {
|
|
120
|
-
|
|
120
|
+
foundErrors.push(
|
|
121
121
|
`validateIdentifiers, ${objTypeString} property:${identifierName} not exists`
|
|
122
122
|
);
|
|
123
123
|
} else {
|
|
@@ -125,7 +125,7 @@ export default async function <%- functionName %>(
|
|
|
125
125
|
typeof identifiersObject[identifierName] !== 'string' &&
|
|
126
126
|
typeof identifiersObject[identifierName] !== 'number'
|
|
127
127
|
) {
|
|
128
|
-
|
|
128
|
+
foundErrors.push(
|
|
129
129
|
`validateIdentifiers, ${objTypeString} property:${identifierName} should be string or number`
|
|
130
130
|
);
|
|
131
131
|
}
|
|
@@ -162,12 +162,12 @@ export default async function <%- functionName %>(
|
|
|
162
162
|
);
|
|
163
163
|
_izContext.logger.debug('newRelationshipSchema: ', newRelationshipSchema);
|
|
164
164
|
if (!oldRelationshipSchema.hasOwnProperty('canChangeToRelTypes')) {
|
|
165
|
-
|
|
165
|
+
foundErrors.push(
|
|
166
166
|
`${oldRelTypeAndDirection.relType} not have property to change to another relType`
|
|
167
167
|
);
|
|
168
168
|
} else {
|
|
169
169
|
if (!newRelationshipSchema) {
|
|
170
|
-
|
|
170
|
+
foundErrors.push(
|
|
171
171
|
`${newRelationshipSchema} not exists can't changeToRelType`
|
|
172
172
|
);
|
|
173
173
|
} else {
|
|
@@ -184,7 +184,7 @@ export default async function <%- functionName %>(
|
|
|
184
184
|
// if changeBy is user will check for importBatch callingFlow
|
|
185
185
|
if (callingFlowConfig) {
|
|
186
186
|
if (callingFlowConfig.callingFlow !== "ImportDataTestExternalUpdateRelationshipHdrSqs") {
|
|
187
|
-
|
|
187
|
+
foundErrors.push(`CanChangeToRelType changeBy is user but it's not user process with importData`);
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
}
|
|
@@ -194,11 +194,11 @@ export default async function <%- functionName %>(
|
|
|
194
194
|
const isUserProcess = Boolean(_izContext.correlationIds?.get(consts.SUBMITTED_BY_USER_ID));
|
|
195
195
|
if (isUserProcess) {
|
|
196
196
|
if (canChangeToRelType.changeBy !== 'user' && canChangeToRelType.changeBy !== 'systemWithUser') {
|
|
197
|
-
|
|
197
|
+
foundErrors.push(`CanChangeToRelType changeBy is not user or systemWithUser`);
|
|
198
198
|
}
|
|
199
199
|
} else {
|
|
200
200
|
if (canChangeToRelType.changeBy !== 'systemNoUser') {
|
|
201
|
-
|
|
201
|
+
foundErrors.push(`CanChangeToRelType changeBy is not systemNoUser`);
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
}
|
|
@@ -213,7 +213,7 @@ export default async function <%- functionName %>(
|
|
|
213
213
|
);
|
|
214
214
|
_izContext.logger.debug('links', links);
|
|
215
215
|
if (!links.length) {
|
|
216
|
-
|
|
216
|
+
foundErrors.push(
|
|
217
217
|
`not found link between ${JSON.stringify({ firstObject: firstObject.objType })} ${JSON.stringify({ secondObject: secondObject.objType })}`
|
|
218
218
|
);
|
|
219
219
|
}
|
|
@@ -253,7 +253,7 @@ export default async function <%- functionName %>(
|
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
if (checkCorrectLink == false) {
|
|
256
|
-
|
|
256
|
+
foundErrors.push(`Wrong Relationship Direction`);
|
|
257
257
|
}
|
|
258
258
|
|
|
259
259
|
let targetStorageResources = [];
|
|
@@ -301,7 +301,7 @@ export default async function <%- functionName %>(
|
|
|
301
301
|
usedStorageResource.graphServerTag
|
|
302
302
|
);
|
|
303
303
|
if (!graphServiceTag) {
|
|
304
|
-
|
|
304
|
+
foundErrors.push(
|
|
305
305
|
`storageResourceTag: ${storageResourceTag} invalid, not found graph serviceTag from graphServerTag: ${usedStorageResource.graphServerTag}`
|
|
306
306
|
);
|
|
307
307
|
}
|
|
@@ -327,23 +327,23 @@ export default async function <%- functionName %>(
|
|
|
327
327
|
);
|
|
328
328
|
|
|
329
329
|
if (!targetStorageResources.length) {
|
|
330
|
-
|
|
330
|
+
foundErrors.push(`Not found link from relationship schema`);
|
|
331
331
|
}
|
|
332
332
|
|
|
333
333
|
// validate properties exists with schema
|
|
334
334
|
for (const propKey in oldRelTypeAndDirection.fieldNames) {
|
|
335
335
|
if (!newRelationshipSchema.fieldNames.hasOwnProperty(propKey)) {
|
|
336
|
-
|
|
336
|
+
foundErrors.push(
|
|
337
337
|
`property: ${propKey} not exists in relationshipSchema`
|
|
338
338
|
);
|
|
339
339
|
}
|
|
340
340
|
}
|
|
341
341
|
} else {
|
|
342
|
-
|
|
342
|
+
foundErrors.push(`relationshipSchema not exists`);
|
|
343
343
|
}
|
|
344
344
|
|
|
345
345
|
// if found errors will stop processing
|
|
346
|
-
if (
|
|
346
|
+
if (foundErrors.length) {
|
|
347
347
|
let changeRelCompleteMsg = {
|
|
348
348
|
firstObject,
|
|
349
349
|
secondObject,
|
|
@@ -354,7 +354,7 @@ export default async function <%- functionName %>(
|
|
|
354
354
|
//(<inChangeRelCompleteMsg>)
|
|
355
355
|
//(</inChangeRelCompleteMsg>)
|
|
356
356
|
status: 'error',
|
|
357
|
-
|
|
357
|
+
foundErrors: foundErrors,
|
|
358
358
|
parentFlowId
|
|
359
359
|
};
|
|
360
360
|
|
|
@@ -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>)
|
|
@@ -44,7 +44,7 @@ export default async function createRelationshipComplete(
|
|
|
44
44
|
returnValue,
|
|
45
45
|
parentFlowId,
|
|
46
46
|
status,
|
|
47
|
-
|
|
47
|
+
foundErrors,
|
|
48
48
|
graphServiceTag
|
|
49
49
|
} = requestParams;
|
|
50
50
|
|
|
@@ -52,7 +52,7 @@ export default async function createRelationshipComplete(
|
|
|
52
52
|
returnValue: returnValue,
|
|
53
53
|
parentFlowId: parentFlowId,
|
|
54
54
|
status: status,
|
|
55
|
-
|
|
55
|
+
foundErrors: foundErrors,
|
|
56
56
|
graphServiceTag: graphServiceTag,
|
|
57
57
|
passBackProperties: passBackProperties
|
|
58
58
|
});
|
|
@@ -76,7 +76,7 @@ export default async function createRelationshipComplete(
|
|
|
76
76
|
_izContext.logger.warn(
|
|
77
77
|
`No pending step found for awaitingStepId: ${awaitingStepId}`
|
|
78
78
|
);
|
|
79
|
-
return { returnValue, status,
|
|
79
|
+
return { returnValue, status, foundErrors };
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
const result =
|
|
@@ -84,7 +84,7 @@ export default async function createRelationshipComplete(
|
|
|
84
84
|
_izContext,
|
|
85
85
|
pending.pendingStepId,
|
|
86
86
|
awaitingStepId,
|
|
87
|
-
|
|
87
|
+
foundErrors
|
|
88
88
|
);
|
|
89
89
|
_izContext.logger.debug(
|
|
90
90
|
'[CreateRelationshipComplete] all awaiting steps result',
|
|
@@ -106,7 +106,7 @@ export default async function createRelationshipComplete(
|
|
|
106
106
|
returnValue.requestParams.relationshipProperties,
|
|
107
107
|
parentFlowId: parentFlowId || returnValue?.parentFlowId,
|
|
108
108
|
status: status,
|
|
109
|
-
|
|
109
|
+
foundErrors: foundErrors
|
|
110
110
|
};
|
|
111
111
|
|
|
112
112
|
const callingFlowConfig =
|
|
@@ -164,7 +164,7 @@ export default async function createRelationshipComplete(
|
|
|
164
164
|
return {
|
|
165
165
|
returnValue,
|
|
166
166
|
status,
|
|
167
|
-
|
|
167
|
+
foundErrors
|
|
168
168
|
};
|
|
169
169
|
} catch (err) {
|
|
170
170
|
_izContext.logger.error('error createRelationshipComplete:', err);
|
|
@@ -90,7 +90,7 @@ export default async function createRelationship(
|
|
|
90
90
|
|
|
91
91
|
const createOnConditionalFail = settings.createOnConditionalFail ?? false;
|
|
92
92
|
|
|
93
|
-
let
|
|
93
|
+
let foundErrors = [];
|
|
94
94
|
const parentFlowId = identifierUuid();
|
|
95
95
|
//(<beforeValidateCreateRel>)
|
|
96
96
|
//(</beforeValidateCreateRel>).
|
|
@@ -107,7 +107,7 @@ export default async function createRelationship(
|
|
|
107
107
|
);
|
|
108
108
|
|
|
109
109
|
if (!objectSchema) {
|
|
110
|
-
|
|
110
|
+
foundErrors.push(
|
|
111
111
|
`validateIdentifiers, not found schema of ${objTypeString}`
|
|
112
112
|
);
|
|
113
113
|
}
|
|
@@ -118,7 +118,7 @@ export default async function createRelationship(
|
|
|
118
118
|
];
|
|
119
119
|
for (const identifierName of identifierNames) {
|
|
120
120
|
if (!identifiersObject.hasOwnProperty(identifierName)) {
|
|
121
|
-
|
|
121
|
+
foundErrors.push(
|
|
122
122
|
`validateIdentifiers, ${objTypeString} property:${identifierName} not exists`
|
|
123
123
|
);
|
|
124
124
|
} else {
|
|
@@ -126,7 +126,7 @@ export default async function createRelationship(
|
|
|
126
126
|
typeof identifiersObject[identifierName] !== 'string' &&
|
|
127
127
|
typeof identifiersObject[identifierName] !== 'number'
|
|
128
128
|
) {
|
|
129
|
-
|
|
129
|
+
foundErrors.push(
|
|
130
130
|
`validateIdentifiers, ${objTypeString} property:${identifierName} should be string or number`
|
|
131
131
|
);
|
|
132
132
|
}
|
|
@@ -175,7 +175,7 @@ export default async function createRelationship(
|
|
|
175
175
|
);
|
|
176
176
|
_izContext.logger.debug('links', links);
|
|
177
177
|
if (!links.length) {
|
|
178
|
-
|
|
178
|
+
foundErrors.push(
|
|
179
179
|
`not found link between ${JSON.stringify({ firstObject: firstObject.objType })} ${JSON.stringify({ secondObject: secondObject.objType })}`
|
|
180
180
|
);
|
|
181
181
|
}
|
|
@@ -214,7 +214,7 @@ export default async function createRelationship(
|
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
if (checkCorrectLink == false) {
|
|
217
|
-
|
|
217
|
+
foundErrors.push(`Wrong Relationship Direction`);
|
|
218
218
|
}
|
|
219
219
|
|
|
220
220
|
let targetStorageResources = [];
|
|
@@ -262,7 +262,7 @@ export default async function createRelationship(
|
|
|
262
262
|
usedStorageResource.graphServerTag
|
|
263
263
|
);
|
|
264
264
|
if (!graphServiceTag) {
|
|
265
|
-
|
|
265
|
+
foundErrors.push(
|
|
266
266
|
`storageResourceTag: ${storageResourceTag} invalid, not found graph serviceTag from graphServerTag: ${usedStorageResource.graphServerTag}`
|
|
267
267
|
);
|
|
268
268
|
}
|
|
@@ -288,13 +288,13 @@ export default async function createRelationship(
|
|
|
288
288
|
);
|
|
289
289
|
|
|
290
290
|
if (!targetStorageResources.length) {
|
|
291
|
-
|
|
291
|
+
foundErrors.push(`Not found link from relationship schema`);
|
|
292
292
|
}
|
|
293
293
|
|
|
294
294
|
// validate properties exists with schema
|
|
295
295
|
for (const propKey in relationshipProperties) {
|
|
296
296
|
if (!relationshipSchema.fieldNames.hasOwnProperty(propKey)) {
|
|
297
|
-
|
|
297
|
+
foundErrors.push(
|
|
298
298
|
`property: ${propKey} not exists in relationshipSchema`
|
|
299
299
|
);
|
|
300
300
|
}
|
|
@@ -306,7 +306,7 @@ export default async function createRelationship(
|
|
|
306
306
|
)) {
|
|
307
307
|
if (propSetting.requiredOnCreate === true) {
|
|
308
308
|
if (!relationshipProperties.hasOwnProperty(propName)) {
|
|
309
|
-
|
|
309
|
+
foundErrors.push(`Missing requiredOnCreate property: ${propName}`);
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
312
|
|
|
@@ -315,15 +315,15 @@ export default async function createRelationship(
|
|
|
315
315
|
!propSetting.requiredOnCreate &&
|
|
316
316
|
relationshipProperties.hasOwnProperty(propName)
|
|
317
317
|
) {
|
|
318
|
-
|
|
318
|
+
foundErrors.push(`property: ${propName} cannot create`);
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
321
|
} else {
|
|
322
|
-
|
|
322
|
+
foundErrors.push(`relationshipSchema not exists`);
|
|
323
323
|
}
|
|
324
324
|
|
|
325
325
|
// if found errors will stop processing
|
|
326
|
-
if (
|
|
326
|
+
if (foundErrors.length) {
|
|
327
327
|
let createRelCompleteMsg = {
|
|
328
328
|
firstObject: firstObject,
|
|
329
329
|
secondObject: secondObject,
|
|
@@ -333,7 +333,7 @@ export default async function createRelationship(
|
|
|
333
333
|
//(<inCreateRelCompleteMsgCrateRel>)
|
|
334
334
|
//(</inCreateRelCompleteMsgCrateRel>)
|
|
335
335
|
status: 'error',
|
|
336
|
-
|
|
336
|
+
foundErrors: foundErrors,
|
|
337
337
|
parentFlowId: parentFlowId
|
|
338
338
|
};
|
|
339
339
|
|
|
@@ -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>)
|
|
@@ -44,7 +44,7 @@ export default async function deleteRelationshipComplete(
|
|
|
44
44
|
returnValue,
|
|
45
45
|
parentFlowId,
|
|
46
46
|
status,
|
|
47
|
-
|
|
47
|
+
foundErrors,
|
|
48
48
|
graphServiceTag
|
|
49
49
|
} = requestParams;
|
|
50
50
|
|
|
@@ -52,7 +52,7 @@ export default async function deleteRelationshipComplete(
|
|
|
52
52
|
returnValue: returnValue,
|
|
53
53
|
parentFlowId: parentFlowId,
|
|
54
54
|
status: status,
|
|
55
|
-
|
|
55
|
+
foundErrors: foundErrors,
|
|
56
56
|
graphServiceTag: graphServiceTag,
|
|
57
57
|
passBackProperties: passBackProperties
|
|
58
58
|
});
|
|
@@ -76,7 +76,7 @@ export default async function deleteRelationshipComplete(
|
|
|
76
76
|
_izContext.logger.warn(
|
|
77
77
|
`No pending step found for awaitingStepId: ${awaitingStepId}`
|
|
78
78
|
);
|
|
79
|
-
return { returnValue, status,
|
|
79
|
+
return { returnValue, status, foundErrors };
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
const result =
|
|
@@ -84,7 +84,7 @@ export default async function deleteRelationshipComplete(
|
|
|
84
84
|
_izContext,
|
|
85
85
|
pending.pendingStepId,
|
|
86
86
|
awaitingStepId,
|
|
87
|
-
|
|
87
|
+
foundErrors
|
|
88
88
|
);
|
|
89
89
|
_izContext.logger.debug(
|
|
90
90
|
'[DeleteRelationshipComplete] all awaiting steps result',
|
|
@@ -104,7 +104,7 @@ export default async function deleteRelationshipComplete(
|
|
|
104
104
|
relType: returnValue.requestParams.relType,
|
|
105
105
|
parentFlowId: parentFlowId || returnValue?.parentFlowId,
|
|
106
106
|
status: status,
|
|
107
|
-
|
|
107
|
+
foundErrors: foundErrors
|
|
108
108
|
};
|
|
109
109
|
|
|
110
110
|
const callingFlowConfig =
|
|
@@ -156,7 +156,7 @@ export default async function deleteRelationshipComplete(
|
|
|
156
156
|
return {
|
|
157
157
|
returnValue,
|
|
158
158
|
status,
|
|
159
|
-
|
|
159
|
+
foundErrors
|
|
160
160
|
};
|
|
161
161
|
} catch (err) {
|
|
162
162
|
_izContext.logger.error('error deleteRelationshipComplete:', err);
|
|
@@ -87,7 +87,7 @@ export default async function deleteRelationship(
|
|
|
87
87
|
} = requestParams;
|
|
88
88
|
|
|
89
89
|
const parentFlowId = identifierUuid();
|
|
90
|
-
let
|
|
90
|
+
let foundErrors = [];
|
|
91
91
|
|
|
92
92
|
//(<beforeValidateDeleteRel>)
|
|
93
93
|
//(</beforeValidateDeleteRel>)
|
|
@@ -104,7 +104,7 @@ export default async function deleteRelationship(
|
|
|
104
104
|
);
|
|
105
105
|
|
|
106
106
|
if (!objectSchema) {
|
|
107
|
-
|
|
107
|
+
foundErrors.push(
|
|
108
108
|
`validateIdentifiers, not found schema of ${objTypeString}`
|
|
109
109
|
);
|
|
110
110
|
}
|
|
@@ -115,7 +115,7 @@ export default async function deleteRelationship(
|
|
|
115
115
|
];
|
|
116
116
|
for (const identifierName of identifierNames) {
|
|
117
117
|
if (!identifiersObject.hasOwnProperty(identifierName)) {
|
|
118
|
-
|
|
118
|
+
foundErrors.push(
|
|
119
119
|
`validateIdentifiers, ${objTypeString} property:${identifierName} not exists`
|
|
120
120
|
);
|
|
121
121
|
} else {
|
|
@@ -123,7 +123,7 @@ export default async function deleteRelationship(
|
|
|
123
123
|
typeof identifiersObject[identifierName] !== 'string' &&
|
|
124
124
|
typeof identifiersObject[identifierName] !== 'number'
|
|
125
125
|
) {
|
|
126
|
-
|
|
126
|
+
foundErrors.push(
|
|
127
127
|
`validateIdentifiers, ${objTypeString} property:${identifierName} should be string or number`
|
|
128
128
|
);
|
|
129
129
|
}
|
|
@@ -178,7 +178,7 @@ export default async function deleteRelationship(
|
|
|
178
178
|
usedStorageResource.graphServerTag
|
|
179
179
|
);
|
|
180
180
|
if (!graphServiceTag) {
|
|
181
|
-
|
|
181
|
+
foundErrors.push(
|
|
182
182
|
`storageResourceTag:${storageResourceTag} invalid, not found graph serviceTag from graphServerTag:${usedStorageResource.graphServerTag}`
|
|
183
183
|
);
|
|
184
184
|
}
|
|
@@ -202,14 +202,14 @@ export default async function deleteRelationship(
|
|
|
202
202
|
);
|
|
203
203
|
|
|
204
204
|
if (!targetStorageResources.length) {
|
|
205
|
-
|
|
205
|
+
foundErrors.push(`Not found link from relationship schema`);
|
|
206
206
|
}
|
|
207
207
|
} else {
|
|
208
|
-
|
|
208
|
+
foundErrors.push(`relationshipSchema not exists`);
|
|
209
209
|
}
|
|
210
210
|
|
|
211
211
|
// if found errors will stop processing
|
|
212
|
-
if (
|
|
212
|
+
if (foundErrors.length) {
|
|
213
213
|
let deleteRelCompleteMsg = {
|
|
214
214
|
firstObject: firstObject,
|
|
215
215
|
secondObject: secondObject,
|
|
@@ -219,7 +219,7 @@ export default async function deleteRelationship(
|
|
|
219
219
|
//(<inDeleteRelCompleteMsg>)
|
|
220
220
|
//(</inDeleteRelCompleteMsg>)
|
|
221
221
|
status: 'error',
|
|
222
|
-
|
|
222
|
+
foundErrors: foundErrors,
|
|
223
223
|
parentFlowId
|
|
224
224
|
};
|
|
225
225
|
|
|
@@ -444,7 +444,7 @@ export default async function deleteRelationship(
|
|
|
444
444
|
relType,
|
|
445
445
|
relationshipProperties,
|
|
446
446
|
relationshipDirection,
|
|
447
|
-
|
|
447
|
+
foundErrors
|
|
448
448
|
};
|
|
449
449
|
} catch (err) {
|
|
450
450
|
_izContext.logger.error('error deleteRelationship: ', err);
|