@izara_project/izara-core-generate-service-code 1.0.73 → 1.0.74

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.
Files changed (33) hide show
  1. package/package.json +1 -1
  2. package/src/emit/coreFunction/emitCoreFunctionArtifacts.js +3 -0
  3. package/src/emit/coreFunction/templates/InitialSetupConfig.ejs +100 -28
  4. package/src/emit/coreFunction/templates/InitialSetupRunner_uploadSchema.ejs +2 -0
  5. package/src/emit/coreFunction/templates/UploadSchema_Main.ejs +2 -0
  6. package/src/emit/custom/customFlows.js +42 -0
  7. package/src/emit/custom/emitCustomFlowApplicationArtifacts.js +22 -9
  8. package/src/emit/custom/templates/triggerCache/CheckTriggerCache_HdrSqs.ejs +2 -1
  9. package/src/emit/function/functionYamlArtifact.js +8 -3
  10. package/src/emit/relationship/templates/ChangeRelationshipComplete_Main.ejs +8 -13
  11. package/src/emit/relationship/templates/ChangeRelationship_Main.ejs +5 -14
  12. package/src/emit/relationship/templates/CreateRelationshipComplete_Main.ejs +8 -13
  13. package/src/emit/relationship/templates/CreateRelationship_Main.ejs +7 -16
  14. package/src/emit/relationship/templates/DeleteRelationshipComplete_Main.ejs +8 -4
  15. package/src/emit/relationship/templates/DeleteRelationship_Main.ejs +6 -24
  16. package/src/emit/relationship/templates/GetRelationshipComplete_Main.ejs +8 -4
  17. package/src/emit/relationship/templates/MoveRelationshipComplete_Main.ejs +8 -15
  18. package/src/emit/relationship/templates/MoveRelationship_Main.ejs +6 -15
  19. package/src/emit/relationship/templates/UpdateRelationshipComplete_Main.ejs +9 -31
  20. package/src/emit/relationship/templates/UpdateRelationship_Main.ejs +6 -15
  21. package/src/emit/resource/emitResourceArtifacts.js +2 -1
  22. package/src/emit/resource/templates/DynamoDBTable_Yaml.ejs +3 -0
  23. package/src/emit/shared/templates/FlowHandler_HdrApi.ejs +1 -1
  24. package/src/emit/shared/templates/FlowHandler_HdrDsq.ejs +2 -1
  25. package/src/emit/shared/templates/FlowHandler_HdrInv.ejs +1 -1
  26. package/src/emit/shared/templates/FlowHandler_HdrSqs.ejs +2 -1
  27. package/src/emit/system/templates/WebSocketComplete_Yaml.ejs +2 -0
  28. package/test/crudApplicationArtifacts.test.js +22 -0
  29. package/test/customFlowApplicationArtifacts.test.js +135 -0
  30. package/test/functionYamlArtifact.test.js +5 -2
  31. package/test/publicApi.test.js +29 -0
  32. package/test/relationshipApplicationArtifacts.test.js +42 -8
  33. package/test/resourceArtifacts.test.js +34 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@izara_project/izara-core-generate-service-code",
3
- "version": "1.0.73",
3
+ "version": "1.0.74",
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": {
@@ -1,6 +1,8 @@
1
1
  import ejsLib from 'ejs';
2
2
  import { readFile } from 'node:fs/promises';
3
3
 
4
+ import { customFlowNextSteps } from '../custom/customFlows.js';
5
+
4
6
  const TEMPLATE_URL = new URL('./templates/', import.meta.url);
5
7
  const APP_ROOT = 'app/sls_yaml/generatedCode/source';
6
8
  const SRC_ROOT = 'app/src/generatedCode/CoreFunctions';
@@ -94,6 +96,7 @@ export async function emitCoreFunctionArtifacts({ project, objects = [], relatio
94
96
  objects,
95
97
  relationships,
96
98
  flows,
99
+ customFlowNextSteps: customFlowNextSteps(flows),
97
100
  objectGraphServiceTags,
98
101
  relationshipGraphServiceTags,
99
102
  crud,
@@ -50,9 +50,9 @@ const externalServices = {
50
50
  const tableConfigs = {
51
51
  prod: {
52
52
  Config: {},
53
- <% dynamoTableNames.forEach(tableName => { -%>
54
- <%= tableName %>: {}
55
- <% }); -%>
53
+ <% dynamoTableNames.forEach(tableName => { -%>
54
+ <%= tableName %>: {},
55
+ <% }); -%>
56
56
  // <#InitialSetupConfig_ExtraProdTableConfigs#>
57
57
  // <#/InitialSetupConfig_ExtraProdTableConfigs#>
58
58
  },
@@ -61,11 +61,11 @@ const tableConfigs = {
61
61
  clearDataWhenRefresh: true,
62
62
  rawSource: false
63
63
  },
64
- <% dynamoTableNames.forEach(tableName => { -%>
64
+ <% dynamoTableNames.forEach(tableName => { -%>
65
65
  <%= tableName %>: {
66
66
  clearDataWhenRefresh: true
67
- }
68
- <% }); -%>
67
+ },
68
+ <% }); -%>
69
69
  // <#InitialSetupConfig_ExtraTestTableConfigs#>
70
70
  // <#/InitialSetupConfig_ExtraTestTableConfigs#>
71
71
  }
@@ -91,31 +91,31 @@ const tableConfigs = {
91
91
  });
92
92
  -%>
93
93
  const snsTopicSubscriptions = [
94
- <% if (relSubs.length > 0) { -%>
94
+ <% if (relSubs.length > 0) { -%>
95
95
  // ------------------------------------------------------------
96
96
  // Relationship Subscriptions
97
97
  // ------------------------------------------------------------
98
- <% relSubs.forEach(function(sub, idx) { -%>
98
+ <% relSubs.forEach(function(sub, idx) { -%>
99
99
  {
100
100
  serviceTag: '<%= sub.serviceTag %>',
101
101
  topicName: '<%= sub.topicName %>',
102
102
  sqsEndpoint: '<%= sub.sqsEndpoint %>'
103
103
  },
104
- <% }); -%>
105
- <% } -%>
106
- <% if (nodeSubs.length > 0) { -%>
104
+ <% }); -%>
105
+ <% } -%>
106
+ <% if (nodeSubs.length > 0) { -%>
107
107
 
108
108
  // ------------------------------------------------------------
109
109
  // Node Subscriptions
110
110
  // ------------------------------------------------------------
111
- <% nodeSubs.forEach(function(sub, idx) { -%>
111
+ <% nodeSubs.forEach(function(sub, idx) { -%>
112
112
  {
113
113
  serviceTag: '<%= sub.serviceTag %>',
114
114
  topicName: '<%= sub.topicName %>',
115
115
  sqsEndpoint: '<%= sub.sqsEndpoint %>'
116
116
  },
117
- <% }); -%>
118
- <% } -%>
117
+ <% }); -%>
118
+ <% } -%>
119
119
 
120
120
  //(<additionalSubscription>)
121
121
  //(</additionalSubscription>)
@@ -126,11 +126,11 @@ const snsTopicSubscriptions = [
126
126
  // ============================================================
127
127
  function roleConfigs() {
128
128
  const externalLambdaRole = [
129
- <% if (crud && objectGraphServiceTags && objectGraphServiceTags.length > 0) { -%>
129
+ <% if (crud && objectGraphServiceTags && objectGraphServiceTags.length > 0) { -%>
130
130
  {
131
131
  roleName: 'FlowObjects',
132
132
  statement: [
133
- <% objectGraphServiceTags.forEach(function(tag, idx) { -%>
133
+ <% objectGraphServiceTags.forEach(function(tag, idx) { -%>
134
134
  {
135
135
  Sid: 'FlowObjectsInvokeGetNode<%= tag %>',
136
136
  Effect: 'Allow',
@@ -149,7 +149,7 @@ function roleConfigs() {
149
149
  `arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, 'CreateNode_In', '<%= tag %>')}`
150
150
  ]
151
151
  },
152
- <% }); -%>
152
+ <% }); -%>
153
153
  //(<createFlowObjectsRole>)
154
154
  //(</createFlowObjectsRole>)
155
155
  ]
@@ -158,7 +158,7 @@ function roleConfigs() {
158
158
  {
159
159
  roleName: 'ProcFindData',
160
160
  statement: [
161
- <% objectGraphServiceTags.forEach(function(tag, idx) { -%>
161
+ <% objectGraphServiceTags.forEach(function(tag, idx) { -%>
162
162
  {
163
163
  Sid: 'ProcFindDataInvokeGetNode<%= tag %>',
164
164
  Effect: 'Allow',
@@ -167,18 +167,17 @@ function roleConfigs() {
167
167
  `arn:aws:lambda:${process.env.iz_region}:${process.env.iz_accountId}:function:${lambdaSharedLib.lambdaFunctionName(_izContext, 'GetNodeHdrInv', '<%= tag %>')}`
168
168
  ]
169
169
  }
170
- <% }); -%>
170
+ <% }); -%>
171
171
  //(<createProcFindDataRole>)
172
172
  //(</createProcFindDataRole>)
173
173
  ]
174
174
  },
175
- <% } -%>
176
-
177
- <% if (hasRelationships && relationshipGraphServiceTags && relationshipGraphServiceTags.length > 0) { -%>
175
+ <% } -%>
176
+ <% if (hasRelationships && relationshipGraphServiceTags && relationshipGraphServiceTags.length > 0) { -%>
178
177
  {
179
178
  roleName: 'FlowRelationship',
180
179
  statement: [
181
- <% relationshipGraphServiceTags.forEach(function(tag, idx) { -%>
180
+ <% relationshipGraphServiceTags.forEach(function(tag, idx) { -%>
182
181
  {
183
182
  Sid: 'FlowRelationshipInvokeGetRelationship<%= tag %>',
184
183
  Effect: 'Allow',
@@ -200,13 +199,14 @@ function roleConfigs() {
200
199
  `arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, 'MoveRelationship_In', '<%= tag %>')}`
201
200
  ]
202
201
  }
203
- <% }); -%>
202
+ <% }); -%>
204
203
  //(<createFlowRelationshipRole>)
205
204
  //(</createFlowRelationshipRole>)
206
205
  ]
207
- }
208
- <% } -%>
209
- <% s3Flows.forEach(function(flow) { -%> {
206
+ },
207
+ <% } -%>
208
+ <% s3Flows.forEach(function(flow) { -%>
209
+ {
210
210
  roleName: '<%= flow.roleName %>',
211
211
  statement: [
212
212
  {
@@ -229,7 +229,79 @@ function roleConfigs() {
229
229
  //(<create<%= flow.roleName %>Role>)
230
230
  //(</create<%= flow.roleName %>Role>)
231
231
  ]
232
- } <% }); %>
232
+ },
233
+ <% }); -%>
234
+ <%
235
+ let nextStepsFlows = [];
236
+ if (typeof customFlowNextSteps !== 'undefined' && customFlowNextSteps) {
237
+ nextStepsFlows = customFlowNextSteps;
238
+ }
239
+ for (let flowIdx = 0; flowIdx < nextStepsFlows.length; flowIdx++) {
240
+ const flow = nextStepsFlows[flowIdx];
241
+ const snsTopicItems = [];
242
+ const lambdaInvItems = [];
243
+ for (const s of flow.nextSteps) {
244
+ if (s.targetType === 'extTopic' || s.targetType === 'ownTopic') {
245
+ snsTopicItems.push(s);
246
+ } else if (s.targetType === 'lambdaSyncInv') {
247
+ lambdaInvItems.push(s);
248
+ }
249
+ }
250
+ -%>
251
+ {
252
+ roleName: '<%= flow.roleName %>',
253
+ statement: [
254
+ <% if (snsTopicItems.length > 0) { -%>
255
+ {
256
+ Sid: '<%= flow.roleName %>PublishNextStepsTopics',
257
+ Effect: 'Allow',
258
+ Action: ['sns:Publish'],
259
+ Resource: [
260
+ <%
261
+ for (let idx = 0; idx < snsTopicItems.length; idx++) {
262
+ const item = snsTopicItems[idx];
263
+ let tagArg = '';
264
+ if (item.serviceTag) {
265
+ tagArg = `, '${item.serviceTag}'`;
266
+ }
267
+ let comma = '';
268
+ if (idx < snsTopicItems.length - 1) {
269
+ comma = ',';
270
+ }
271
+ -%>
272
+ `arn:aws:sns:${process.env.iz_region}:${process.env.iz_accountId}:${snsSharedLib.snsTopicNameByFlowSchema(_izContext, '<%- item.topic %>'<%- tagArg %>)}`<%= comma %>
273
+ <% } -%>
274
+ ]
275
+ }<% if (lambdaInvItems.length > 0) { %>,<% } %>
276
+ <% } -%>
277
+ <% if (lambdaInvItems.length > 0) { -%>
278
+ {
279
+ Sid: '<%= flow.roleName %>InvokeNextStepsFunctions',
280
+ Effect: 'Allow',
281
+ Action: ['lambda:InvokeFunction'],
282
+ Resource: [
283
+ <%
284
+ for (let idx = 0; idx < lambdaInvItems.length; idx++) {
285
+ const item = lambdaInvItems[idx];
286
+ let tagArg = '';
287
+ if (item.serviceTag) {
288
+ tagArg = `, '${item.serviceTag}'`;
289
+ }
290
+ let comma = '';
291
+ if (idx < lambdaInvItems.length - 1) {
292
+ comma = ',';
293
+ }
294
+ -%>
295
+ `arn:aws:lambda:${process.env.iz_region}:${process.env.iz_accountId}:function:${lambdaSharedLib.lambdaFunctionName(_izContext, '<%- item.topic %>'<%- tagArg %>)}`<%= comma %>
296
+ <% } -%>
297
+ ]
298
+ }
299
+ <% } -%>
300
+ //(<create<%= flow.roleName %>Role>)
301
+ //(</create<%= flow.roleName %>Role>)
302
+ ]
303
+ }<% if (flowIdx < nextStepsFlows.length - 1) { %>,<% } %>
304
+ <% } -%>
233
305
  //(<additionalRole>)
234
306
  //(</additionalRole>)
235
307
  ];
@@ -8,6 +8,7 @@ const SERVICE_TAG = {
8
8
  MEDIA: 'Media'
9
9
  };
10
10
 
11
+ //(<ignoreExternalServices>)
11
12
  const ignoreExternalServices = {
12
13
  [SERVICE_TAG.TRANSLATIONS]: false,
13
14
  [SERVICE_TAG.GRAPH_HANDLER]: false,
@@ -15,6 +16,7 @@ const ignoreExternalServices = {
15
16
  [SERVICE_TAG.TRANSLATE_IDS]: false,
16
17
  [SERVICE_TAG.MEDIA]: false
17
18
  };
19
+ //(</ignoreExternalServices>)
18
20
 
19
21
  export default async function uploadSchema(_izContext) {
20
22
  console.log('======== UploadSchema ========');
@@ -25,6 +25,7 @@ const SERVICE_TAG = {
25
25
  MEDIA: 'Media'
26
26
  };
27
27
 
28
+ //(<ignoreExternalServices>)
28
29
  const ignoreExternalServices = {
29
30
  [SERVICE_TAG.TRANSLATIONS]: false,
30
31
  [SERVICE_TAG.GRAPH_HANDLER]: false,
@@ -32,6 +33,7 @@ const ignoreExternalServices = {
32
33
  [SERVICE_TAG.TRANSLATE_IDS]: false,
33
34
  [SERVICE_TAG.MEDIA]: false
34
35
  };
36
+ //(</ignoreExternalServices>)
35
37
 
36
38
  const uploadSchema = async (_izContext) => {
37
39
  try {
@@ -159,3 +159,45 @@ export function triggerCacheQueueNames(flow) {
159
159
  }
160
160
  return queues;
161
161
  }
162
+
163
+ function _stepNextSteps(step) {
164
+ if (!step || !Array.isArray(step.nextSteps)) {
165
+ return [];
166
+ }
167
+ return step.nextSteps.filter(
168
+ (item) =>
169
+ typeof item === 'object' &&
170
+ item !== null &&
171
+ typeof item.targetType === 'string'
172
+ );
173
+ }
174
+
175
+ export function customFlowNextSteps(flows) {
176
+ if (!Array.isArray(flows)) {
177
+ return [];
178
+ }
179
+ const results = [];
180
+ for (const flow of flows) {
181
+ if (typeof flow?.flowTag !== 'string' || flow.flowTag === '') {
182
+ continue;
183
+ }
184
+ const roleName = customFlowRoleName(flow.flowTag);
185
+ const steps = flow.flowSteps ?? [];
186
+ const nextStepsList = [];
187
+ for (const step of steps) {
188
+ const items = _stepNextSteps(step);
189
+ for (const item of items) {
190
+ nextStepsList.push(item);
191
+ }
192
+ }
193
+ if (nextStepsList.length > 0) {
194
+ results.push({
195
+ flowTag: flow.flowTag,
196
+ roleName,
197
+ nextSteps: nextStepsList
198
+ });
199
+ }
200
+ }
201
+ return results;
202
+ }
203
+
@@ -112,7 +112,7 @@ async function emitFlow(flow, objects) {
112
112
  flowStepName: '',
113
113
  mainFileName: `${process}_Main`,
114
114
  functionName: process,
115
- startConfig: startConfig(flow)
115
+ startConfig: _startConfig(flow)
116
116
  };
117
117
  const artifacts = needsProcessMain(flow)
118
118
  ? [
@@ -319,7 +319,7 @@ async function emitExtTopicStep({ flow, step, flowTag, stepName }) {
319
319
  const artifacts = [
320
320
  {
321
321
  path: `${source}/${mainFileName}.js`,
322
- content: await renderStepMain(functionName)
322
+ content: await renderStepMain(functionName, _startConfig(flow))
323
323
  }
324
324
  ];
325
325
  const functions = [];
@@ -373,7 +373,7 @@ async function emitDsqStep({ flow, step, flowTag, stepName }) {
373
373
  if (!stepEvents.includes('extTopic')) {
374
374
  artifacts.push({
375
375
  path: `${source}/${mainFileName}.js`,
376
- content: await renderStepMain(functionName)
376
+ content: await renderStepMain(functionName, startConfig)
377
377
  });
378
378
  }
379
379
  const functions = [];
@@ -418,7 +418,7 @@ async function emitOwnTopicRoot(flow, objects) {
418
418
  flowTag: flow.flowTag,
419
419
  flowStepName: '',
420
420
  upperCaseFlowTag: tag,
421
- startConfig: startConfig(flow)
421
+ startConfig: _startConfig(flow)
422
422
  };
423
423
  return {
424
424
  artifacts: [
@@ -638,8 +638,20 @@ function _s3HandlerData({ action, flow, functionName, mainFileName, handler }) {
638
638
  return { functionName, handlerType: handler };
639
639
  }
640
640
 
641
- function startConfig(flow) {
642
- const start = flow.flowSteps?.[0];
641
+ function _startConfig(flow) {
642
+ const steps = flow.flowSteps ?? [];
643
+ const start =
644
+ steps.find(
645
+ (s) =>
646
+ typeof s?.stepName === 'string' &&
647
+ s.stepName.toLowerCase() === 'inprocess'
648
+ ) ??
649
+ steps.find(
650
+ (s) =>
651
+ typeof s?.stepName === 'string' &&
652
+ s.stepName.toLowerCase() === 'start'
653
+ ) ??
654
+ steps[0];
643
655
  if (start) {
644
656
  return stepConfig(flow, start);
645
657
  }
@@ -691,7 +703,8 @@ async function renderEndpointMain(flow, functionName, objects) {
691
703
  flowTag: flow.flowTag,
692
704
  upperCaseFlowTag: upperFirst(flow.flowTag),
693
705
  functionName,
694
- tableName: storedCacheTableName(flow, objects)
706
+ tableName: storedCacheTableName(flow, objects),
707
+ startConfig: _startConfig(flow)
695
708
  });
696
709
  }
697
710
 
@@ -715,8 +728,8 @@ function storedCacheTableName(flow, objects) {
715
728
  );
716
729
  }
717
730
 
718
- async function renderStepMain(functionName) {
719
- return renderCustom('FlowStep_Main.ejs', { functionName });
731
+ async function renderStepMain(functionName, startConfig = null) {
732
+ return renderCustom('FlowStep_Main.ejs', { functionName, startConfig });
720
733
  }
721
734
 
722
735
  function renderMain(functionName) {
@@ -11,7 +11,8 @@ let perRecordsValidatorSchema = {
11
11
  properties: {
12
12
  <%_ startConfig.properties.forEach((prop, index) => { _%>
13
13
  <%- /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(prop.propertyName) ? prop.propertyName : `'${prop.propertyName}'` %>: {
14
- type: '<%- prop.type || 'string' %>'
14
+ type: '<%- prop.type || 'string' %>'<% if (typeof prop.default !== 'undefined') { %>,
15
+ default: <%- typeof prop.default === 'string' ? `'${prop.default.replace(/'/g, "\\'")}'` : JSON.stringify(prop.default) %><% } %>
15
16
  }<%- index < startConfig.properties.length - 1 ? ',' : '' %>
16
17
  <%_ }) _%>
17
18
  },
@@ -305,17 +305,22 @@ function _functionSetting(functionName) {
305
305
  return ` #<#${functionName}FunctionSetting#>\n #<#/${functionName}FunctionSetting#>`;
306
306
  }
307
307
 
308
- function _sqsFilterPatterns(functionName) {
309
- return ` filterPatterns:
308
+ function _sqsFilterPatterns(
309
+ callingFlowName,
310
+ hookFunctionName = callingFlowName
311
+ ) {
312
+ return ` #<#${hookFunctionName}FilterPatterns#>
313
+ filterPatterns:
310
314
  - body:
311
315
  MessageAttributes:
312
316
  callingFlow:
313
317
  Value:
314
- - \${self:custom.iz_resourcePrefix}${functionName}
318
+ - \${self:custom.iz_resourcePrefix}${callingFlowName}
315
319
  - body:
316
320
  MessageAttributes:
317
321
  callingFlow:
318
322
  Value:
319
323
  - exists: false
324
+ #<#/${hookFunctionName}FilterPatterns#>
320
325
  `;
321
326
  }
@@ -36,13 +36,17 @@ const { TOPIC_NAME_GENERATE_CODE, PREFIX } = consts;
36
36
 
37
37
  export default async function changeRelationshipComplete(
38
38
  _izContext,
39
- returnValue,
40
- status,
41
- errorsFound,
42
- graphServiceTag,
39
+ requestParams,
43
40
  passBackProperties = {}
44
41
  ) {
45
42
  try {
43
+ const {
44
+ returnValue,
45
+ status,
46
+ errorsFound,
47
+ graphServiceTag
48
+ } = requestParams;
49
+
46
50
  _izContext.logger.debug('Function:ChangeRelationshipComplete', {
47
51
  returnValue: returnValue,
48
52
  status: status,
@@ -51,15 +55,6 @@ export default async function changeRelationshipComplete(
51
55
  passBackProperties: passBackProperties
52
56
  });
53
57
 
54
- // start create awaitingStepId
55
- const linkTypeId = createLinkTypeId(
56
- _izContext,
57
- returnValue.requestParams.firstObject.objType,
58
- returnValue.requestParams.secondObject.objType,
59
- returnValue.requestParams.newRelType,
60
- returnValue.requestParams.oldRelTypeAndDirection.relationshipDirection
61
- );
62
-
63
58
  let awaitingStepId = asyncFlowSharedLib.createAwaitingStepId(
64
59
  returnValue.parentFlowId, // hash id
65
60
  PREFIX.changeRel // prefix, use constant further
@@ -390,15 +390,6 @@ export default async function <%- functionName %>(
390
390
  return changeRelCompleteMsg;
391
391
  }
392
392
 
393
- // before create awaitingStepId per graph storageResource
394
- const linkTypeId = createLinkTypeId(
395
- _izContext,
396
- firstObject.objType,
397
- secondObject.objType,
398
- newRelType,
399
- oldRelTypeAndDirection.relationshipDirection
400
- );
401
-
402
393
  let usedGraphServiceTag = []; // collect used graph serviceTag, use to check duplicate graph serviceTag across graph serverTag
403
394
  let targetGraphStorageResources = []; // collect used graph storageResources, filtered duplicate graphServiceTag from graphServerTag out
404
395
  let awaitingStepIds = [];
@@ -412,12 +403,12 @@ export default async function <%- functionName %>(
412
403
  targetGraphStorageResources.push(targetStorageResource);
413
404
 
414
405
  // awaitingStepId per graphServiceTag
415
- awaitingStepIds.push(
416
- asyncFlowSharedLib.createAwaitingStepId(
406
+ awaitingStepIds.push({
407
+ awaitingStepId: asyncFlowSharedLib.createAwaitingStepId(
417
408
  parentFlowId, // hash id
418
409
  PREFIX.changeRel // prefix, use constant further
419
410
  )
420
- );
411
+ });
421
412
  }
422
413
  }
423
414
 
@@ -426,11 +417,11 @@ export default async function <%- functionName %>(
426
417
  await asyncFlowSharedLib.createAwaitingMultipleSteps(
427
418
  _izContext,
428
419
  asyncFlowSharedLib.createPendingStepId(
429
- // pendingStepId
430
420
  _izContext.uniqueRequestId, // hash id
431
421
  PREFIX.changeRel // prefix, use constant further
432
422
  ),
433
- awaitingStepIds // awaitingStepIds
423
+ awaitingStepIds,
424
+ {}
434
425
  );
435
426
 
436
427
  // prepare message body
@@ -36,13 +36,17 @@ const { TOPIC_NAME_GENERATE_CODE, PREFIX } = consts;
36
36
 
37
37
  export default async function createRelationshipComplete(
38
38
  _izContext,
39
- returnValue,
40
- status,
41
- errorsFound,
42
- graphServiceTag,
39
+ requestParams,
43
40
  passBackProperties = {}
44
41
  ) {
45
42
  try {
43
+ const {
44
+ returnValue,
45
+ status,
46
+ errorsFound,
47
+ graphServiceTag
48
+ } = requestParams;
49
+
46
50
  _izContext.logger.debug('Function:createRelationshipComplete', {
47
51
  returnValue: returnValue,
48
52
  status: status,
@@ -51,15 +55,6 @@ export default async function createRelationshipComplete(
51
55
  passBackProperties: passBackProperties
52
56
  });
53
57
 
54
- // start create awaitingStepId
55
- const linkTypeId = createLinkTypeId(
56
- _izContext,
57
- returnValue.requestParams.firstObject.objType,
58
- returnValue.requestParams.secondObject.objType,
59
- returnValue.requestParams.relType,
60
- returnValue.requestParams.relationshipDirection
61
- );
62
-
63
58
  let awaitingStepId = asyncFlowSharedLib.createAwaitingStepId(
64
59
  returnValue.parentFlowId, // hash id
65
60
  PREFIX.createRel // prefix, use constant further
@@ -83,7 +83,7 @@ export default async function createRelationship(
83
83
  relationshipDirection,
84
84
  relationshipProperties,
85
85
  deepPathConditional,
86
- settings
86
+ settings = {}
87
87
  //(<requestParamCreateRel>)
88
88
  //(</requestParamCreateRel>)
89
89
  } = requestParams;
@@ -376,15 +376,6 @@ export default async function createRelationship(
376
376
  return createRelCompleteMsg;
377
377
  }
378
378
 
379
- // before create awaitingStepId per graph storageResource
380
- const linkTypeId = createLinkTypeId(
381
- _izContext,
382
- firstObject.objType,
383
- secondObject.objType,
384
- relType,
385
- relationshipDirection
386
- );
387
-
388
379
  let usedGraphServiceTag = []; // collect used graph serviceTag, use to check duplicate graph serviceTag across graph serverTag
389
380
  let targetGraphStorageResources = []; // collect used graph storageResources, filtered duplicate graphServiceTag from graphServerTag out
390
381
  let awaitingStepIds = [];
@@ -398,12 +389,12 @@ export default async function createRelationship(
398
389
  targetGraphStorageResources.push(targetStorageResource);
399
390
 
400
391
  // awaitingStepId per graphServiceTag
401
- awaitingStepIds.push(
402
- asyncFlowSharedLib.createAwaitingStepId(
392
+ awaitingStepIds.push({
393
+ awaitingStepId: asyncFlowSharedLib.createAwaitingStepId(
403
394
  parentFlowId, // hash id
404
395
  PREFIX.createRel // prefix, use constant further
405
396
  )
406
- );
397
+ });
407
398
  }
408
399
 
409
400
  // if have storageResource.storageType === "dynamoDB" will create relationship here
@@ -453,12 +444,12 @@ export default async function createRelationship(
453
444
  // save awaiting
454
445
  await asyncFlowSharedLib.createAwaitingMultipleSteps(
455
446
  _izContext,
456
- awaitingStepIds, // awaitingStepIds
457
447
  asyncFlowSharedLib.createPendingStepId(
458
- // pendingStepId
459
448
  _izContext.uniqueRequestId, // hash id
460
449
  PREFIX.createRel // prefix, use constant further
461
- )
450
+ ),
451
+ awaitingStepIds,
452
+ {}
462
453
  );
463
454
 
464
455
  // prepare message body
@@ -36,13 +36,17 @@ const { TOPIC_NAME_GENERATE_CODE, PREFIX } = consts;
36
36
 
37
37
  export default async function deleteRelationshipComplete(
38
38
  _izContext,
39
- returnValue,
40
- status,
41
- errorsFound,
42
- graphServiceTag,
39
+ requestParams,
43
40
  passBackProperties = {}
44
41
  ) {
45
42
  try {
43
+ const {
44
+ returnValue,
45
+ status,
46
+ errorsFound,
47
+ graphServiceTag
48
+ } = requestParams;
49
+
46
50
  _izContext.logger.debug('Function:deleteRelationshipComplete', {
47
51
  returnValue: returnValue,
48
52
  status: status,