@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
@@ -262,24 +262,6 @@ export default async function deleteRelationship(
262
262
  return deleteRelCompleteMsg;
263
263
  }
264
264
 
265
- // before create awaitingStepId per graph storageResource
266
- let linkTypeId;
267
- if (
268
- secondObject &&
269
- secondObject.hasOwnProperty('objType') &&
270
- Object.values(secondObject.objType).length > 0
271
- ) {
272
- linkTypeId = createLinkTypeId(
273
- _izContext,
274
- firstObject.objType,
275
- secondObject.objType,
276
- relType,
277
- relationshipDirection
278
- );
279
- } else {
280
- linkTypeId = hash({ objType: firstObject.objType, relType: relType });
281
- }
282
-
283
265
  let usedGraphServiceTag = []; // collect used graph serviceTag, use to check duplicate graph serviceTag across graph serverTag
284
266
  let targetGraphStorageResources = []; // collect used graph storageResources, filtered duplicate graphServiceTag from graphServerTag out
285
267
  let awaitingStepIds = [];
@@ -293,12 +275,12 @@ export default async function deleteRelationship(
293
275
  targetGraphStorageResources.push(targetStorageResource);
294
276
 
295
277
  // awaitingStepId per graphServiceTag
296
- awaitingStepIds.push(
297
- asyncFlowSharedLib.createAwaitingStepId(
278
+ awaitingStepIds.push({
279
+ awaitingStepId: asyncFlowSharedLib.createAwaitingStepId(
298
280
  parentFlowId, // hash id
299
281
  PREFIX.deleteRel // prefix, use constant further
300
282
  )
301
- );
283
+ });
302
284
  } else if (
303
285
  targetStorageResource.storageType === consts.STORAGE_TYPES.dynamoDB
304
286
  ) {
@@ -345,12 +327,12 @@ export default async function deleteRelationship(
345
327
  // save awaiting
346
328
  await asyncFlowSharedLib.createAwaitingMultipleSteps(
347
329
  _izContext,
348
- awaitingStepIds, // awaitingStepIds
349
330
  asyncFlowSharedLib.createPendingStepId(
350
- // pendingStepId
351
331
  _izContext.uniqueRequestId, // hash id
352
332
  PREFIX.deleteRel // prefix, use constant further
353
- )
333
+ ),
334
+ awaitingStepIds,
335
+ {}
354
336
  );
355
337
 
356
338
  // prepare message body
@@ -36,13 +36,17 @@ const { TOPIC_NAME_GENERATE_CODE, PREFIX } = consts;
36
36
 
37
37
  export default async function getRelationshipComplete(
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:getRelationshipComplete', {
47
51
  returnValue: returnValue,
48
52
  status: status,
@@ -36,13 +36,17 @@ const { TOPIC_NAME_GENERATE_CODE, PREFIX } = consts;
36
36
 
37
37
  export default async function <%- functionName %>(
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:<%- functionName %>', {
47
51
  returnValue: returnValue,
48
52
  status: status,
@@ -51,17 +55,6 @@ export default async function <%- functionName %>(
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.relationshipProperties,
61
- returnValue.requestParams.relationshipDirection,
62
- returnValue.requestParams.moveObject
63
- );
64
-
65
58
  let awaitingStepId = asyncFlowSharedLib.createAwaitingStepId(
66
59
  returnValue.parentFlowId, // hash id
67
60
  PREFIX.changeRel // prefix, use constant further
@@ -382,15 +382,6 @@ export default async function moveRelationship(
382
382
  return moveRelCompleteMsg;
383
383
  }
384
384
 
385
- // before create awaitingStepId per graph storageResource
386
- const linkTypeId = createLinkTypeId(
387
- _izContext,
388
- firstObject.objType,
389
- secondObject.objType,
390
- relType,
391
- relationshipDirection
392
- );
393
-
394
385
  let usedGraphServiceTag = []; // collect used graph serviceTag, use to check duplicate graph serviceTag across graph serverTag
395
386
  let targetGraphStorageResources = []; // collect used graph storageResources, filtered duplicate graphServiceTag from graphServerTag out
396
387
  let awaitingStepIds = [];
@@ -404,12 +395,12 @@ export default async function moveRelationship(
404
395
  targetGraphStorageResources.push(targetStorageResource);
405
396
 
406
397
  // awaitingStepId per graphServiceTag
407
- awaitingStepIds.push(
408
- asyncFlowSharedLib.createAwaitingStepId(
398
+ awaitingStepIds.push({
399
+ awaitingStepId: asyncFlowSharedLib.createAwaitingStepId(
409
400
  parentFlowId, // hash id
410
401
  PREFIX.changeRel // prefix, use constant further
411
402
  )
412
- );
403
+ });
413
404
  }
414
405
  }
415
406
 
@@ -417,12 +408,12 @@ export default async function moveRelationship(
417
408
  // save awaiting
418
409
  await asyncFlowSharedLib.createAwaitingMultipleSteps(
419
410
  _izContext,
420
- awaitingStepIds, // awaitingStepIds
421
411
  asyncFlowSharedLib.createPendingStepId(
422
- // pendingStepId
423
412
  _izContext.uniqueRequestId, // hash id
424
413
  PREFIX.changeRel // prefix, use constant further
425
- )
414
+ ),
415
+ awaitingStepIds,
416
+ {}
426
417
  );
427
418
 
428
419
  // prepare message body
@@ -36,14 +36,18 @@ const { TOPIC_NAME_GENERATE_CODE, PREFIX } = consts;
36
36
 
37
37
  export default async function updateRelationshipComplete(
38
38
  _izContext,
39
- returnValue,
40
- status,
41
- errorsFound,
42
- graphServiceTag,
39
+ requestParams,
43
40
  passBackProperties = {}
44
41
  // callingFlowConfig = {}
45
42
  ) {
46
43
  try {
44
+ const {
45
+ returnValue,
46
+ status,
47
+ errorsFound,
48
+ graphServiceTag
49
+ } = requestParams;
50
+
47
51
  _izContext.logger.debug('Function:updateRelationshipComplete', {
48
52
  returnValue: returnValue,
49
53
  status: status,
@@ -53,34 +57,8 @@ export default async function updateRelationshipComplete(
53
57
  // callingFlowConfig: callingFlowConfig
54
58
  });
55
59
 
56
- let linkTypeId;
57
- // start create awaitingStepId
58
- if (
59
- returnValue.requestParams.hasOwnProperty('secondObject') &&
60
- Object.values(returnValue.requestParams.secondObject.objType).length > 0
61
- ) {
62
- linkTypeId = createLinkTypeId(
63
- _izContext,
64
- returnValue.requestParams.firstObject.objType,
65
- returnValue.requestParams.secondObject.objType,
66
- returnValue.requestParams.relType,
67
- returnValue.requestParams.relationshipDirection
68
- );
69
- } else {
70
- linkTypeId = hash({
71
- firstObject: returnValue.requestParams.firstObject.objType,
72
- relType: returnValue.requestParams.relType
73
- });
74
- }
75
-
76
60
  let awaitingStepId = asyncFlowSharedLib.createAwaitingStepId(
77
- hash({
78
- linkTypeId,
79
- relId: returnValue.requestParams.relId,
80
- relationshipProperties:
81
- returnValue.requestParams.relationshipProperties,
82
- graphServiceTag: graphServiceTag
83
- }), // hash id
61
+ returnValue.parentFlowId, // hash id
84
62
  PREFIX.updateRel // prefix, use constant further
85
63
  );
86
64
 
@@ -338,15 +338,6 @@ export default async function updateRelationship(
338
338
  return updateCompleteMsg;
339
339
  }
340
340
 
341
- // before create awaitingStepId per graph storageResource
342
- const linkTypeId = createLinkTypeId(
343
- _izContext,
344
- firstObject.objType,
345
- secondObject.objType,
346
- relType,
347
- relationshipDirection
348
- );
349
-
350
341
  let usedGraphServiceTag = []; // collect used graph serviceName, use to check duplicate graph serviceName across graph serverTag
351
342
  let targetGraphStorageResources = []; // collect used graph storageResources, filtered duplicate graphServiceTag from graphServerTag out
352
343
  let awaitingStepIds = [];
@@ -360,12 +351,12 @@ export default async function updateRelationship(
360
351
  targetGraphStorageResources.push(targetStorageResource);
361
352
 
362
353
  // awaitingStepId per graphServiceTag
363
- awaitingStepIds.push(
364
- asyncFlowSharedLib.createAwaitingStepId(
354
+ awaitingStepIds.push({
355
+ awaitingStepId: asyncFlowSharedLib.createAwaitingStepId(
365
356
  parentFlowId, // hash id
366
357
  PREFIX.updateRel // prefix, use constant further
367
358
  )
368
- );
359
+ });
369
360
  } else if (
370
361
  storageResource.storageType === consts.STORAGE_TYPES.dynamoDB
371
362
  ) {
@@ -411,12 +402,12 @@ export default async function updateRelationship(
411
402
  // save awaiting
412
403
  await asyncFlowSharedLib.createAwaitingMultipleSteps(
413
404
  _izContext,
414
- awaitingStepIds, // awaitingStepIds
415
405
  asyncFlowSharedLib.createPendingStepId(
416
- // pendingStepId
417
406
  _izContext.uniqueRequestId, // hash id
418
407
  PREFIX.updateRel // prefix, use constant further
419
- )
408
+ ),
409
+ awaitingStepIds,
410
+ {}
420
411
  );
421
412
 
422
413
  // prepare message body
@@ -255,7 +255,8 @@ function createResourceState({ objects, relationships, flows }) {
255
255
  const relationshipTableNames = [...collectTables(relationships).keys()];
256
256
  const tableMap = new Map([
257
257
  ...collectTables(objects),
258
- ...collectTables(relationships)
258
+ ...collectTables(relationships),
259
+ ...collectTables(flows)
259
260
  ]);
260
261
  const externalDynamoTables = objects.flatMap(
261
262
  (object) => object.externalDynamoResources ?? []
@@ -18,3 +18,6 @@
18
18
  - AttributeName: '<%- sk %>'
19
19
  KeyType: 'RANGE'
20
20
  <% } %>
21
+ #<#<%- tableName %>TableSetting#>
22
+ #<#/<%- tableName %>TableSetting#>
23
+
@@ -13,7 +13,7 @@ const validatorSchema = {
13
13
  type: 'object',
14
14
  properties: {
15
15
  <%_ startConfig.properties.forEach((prop, index) => { _%>
16
- <%- /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(prop.propertyName) ? prop.propertyName : `'${prop.propertyName}'` %>: { type: '<%- prop.type || 'string' %>' }<%- index < startConfig.properties.length - 1 ? ',' : '' %>
16
+ <%- /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(prop.propertyName) ? prop.propertyName : `'${prop.propertyName}'` %>: { type: '<%- prop.type || 'string' %>'<% if (typeof prop.default !== 'undefined') { %>, default: <%- typeof prop.default === 'string' ? `'${prop.default.replace(/'/g, "\\'")}'` : JSON.stringify(prop.default) %><% } %> }<%- index < startConfig.properties.length - 1 ? ',' : '' %>
17
17
  <%_ }) _%>
18
18
  },
19
19
  required: [<%- startConfig.properties.filter(p => p.required === true).map(p => `'${p.propertyName}'`).join(', ') %>]
@@ -31,7 +31,8 @@ let perRecordsValidatorSchema = {
31
31
  properties: {
32
32
  <%_ startConfig.properties.forEach((prop, index) => { _%>
33
33
  <%- /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(prop.propertyName) ? prop.propertyName : `'${prop.propertyName}'` %>: {
34
- type: '<%- prop.type || 'string' %>'
34
+ type: '<%- prop.type || 'string' %>'<% if (typeof prop.default !== 'undefined') { %>,
35
+ default: <%- typeof prop.default === 'string' ? `'${prop.default.replace(/'/g, "\\'")}'` : JSON.stringify(prop.default) %><% } %>
35
36
  }<%- index < startConfig.properties.length - 1 ? ',' : '' %>
36
37
  <%_ }) _%>
37
38
  },
@@ -10,7 +10,7 @@ const validatorSchema = {
10
10
  type: 'object',
11
11
  properties: {
12
12
  <%_ startConfig.properties.forEach((prop, index) => { _%>
13
- <%- /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(prop.propertyName) ? prop.propertyName : `'${prop.propertyName}'` %>: { type: '<%- prop.type || 'string' %>' }<%- index < startConfig.properties.length - 1 ? ',' : '' %>
13
+ <%- /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(prop.propertyName) ? prop.propertyName : `'${prop.propertyName}'` %>: { type: '<%- prop.type || 'string' %>'<% if (typeof prop.default !== 'undefined') { %>, default: <%- typeof prop.default === 'string' ? `'${prop.default.replace(/'/g, "\\'")}'` : JSON.stringify(prop.default) %><% } %> }<%- index < startConfig.properties.length - 1 ? ',' : '' %>
14
14
  <%_ }) _%>
15
15
  },
16
16
  required: [<%- startConfig.properties.filter(p => p.required === true).map(p => `'${p.propertyName}'`).join(', ') %>]
@@ -31,7 +31,8 @@ let perRecordsValidatorSchema = {
31
31
  properties: {
32
32
  <%_ startConfig.properties.forEach((prop, index) => { _%>
33
33
  <%- /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(prop.propertyName) ? prop.propertyName : `'${prop.propertyName}'` %>: {
34
- type: '<%- prop.type || 'string' %>'
34
+ type: '<%- prop.type || 'string' %>'<% if (typeof prop.default !== 'undefined') { %>,
35
+ default: <%- typeof prop.default === 'string' ? `'${prop.default.replace(/'/g, "\\'")}'` : JSON.stringify(prop.default) %><% } %>
35
36
  }<%- index < startConfig.properties.length - 1 ? ',' : '' %>
36
37
  <%_ }) _%>
37
38
  },
@@ -6,6 +6,7 @@ WebSocketCompleteHdrSqs:
6
6
  - sqs:
7
7
  arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}WebSocketCompleteHdrSqs
8
8
  batchSize: 10
9
+ #<#WebSocketCompleteHdrSqsFilterPatterns#>
9
10
  filterPatterns:
10
11
  - body:
11
12
  MessageAttributes:
@@ -17,3 +18,4 @@ WebSocketCompleteHdrSqs:
17
18
  callingFlow:
18
19
  Value:
19
20
  - exists: false
21
+ #<#/WebSocketCompleteHdrSqsFilterPatterns#>
@@ -137,6 +137,27 @@ test('preserves function-setting hooks across CRUD regeneration', async () => {
137
137
  /#<#CreateCompleteHdrSqsFunctionSetting#>\n memorySize: 512\n #<#\/CreateCompleteHdrSqsFunctionSetting#>/
138
138
  );
139
139
 
140
+ const customFilterHook =
141
+ ' #<#CreateCompleteHdrSqsFilterPatterns#>\n filterPatterns:\n - body: custom\n #<#/CreateCompleteHdrSqsFilterPatterns#>';
142
+ const withFilterHook = yaml.replace(
143
+ / #<#CreateCompleteHdrSqsFilterPatterns#>[\s\S]*?#<#\/CreateCompleteHdrSqsFilterPatterns#>/,
144
+ customFilterHook
145
+ );
146
+ assert.notEqual(
147
+ yaml,
148
+ withFilterHook,
149
+ 'filterPatterns hook placeholder must exist in generated YAML'
150
+ );
151
+ await writeFile(yamlPath, withFilterHook);
152
+
153
+ await generateCrudApplicationArtifacts(rootPath, { serviceTag: 'orders' });
154
+
155
+ yaml = await readFile(yamlPath, 'utf8');
156
+ assert.match(
157
+ yaml,
158
+ /#<#CreateCompleteHdrSqsFilterPatterns#>\n filterPatterns:\n - body: custom\n #<#\/CreateCompleteHdrSqsFilterPatterns#>/
159
+ );
160
+
140
161
  const conflictPath = join(
141
162
  rootPath,
142
163
  'app/src/generatedCode/FlowObjects/Create/source/Create_Main.js'
@@ -151,6 +172,7 @@ test('preserves function-setting hooks across CRUD regeneration', async () => {
151
172
  assert.equal(await readFile(yamlPath, 'utf8'), yaml);
152
173
  });
153
174
 
175
+
154
176
  test('removes managed CRUD artifacts when no applicable object remains', async () => {
155
177
  const rootPath = await createProject(true);
156
178
  await generateCrudApplicationArtifacts(rootPath, { serviceTag: 'orders' });
@@ -673,3 +673,138 @@ test('supports step-level required overrides in flowSteps properties and message
673
673
  /messageAttributeValidatorSchema = {[\s\S]*required: \[\]/
674
674
  );
675
675
  });
676
+
677
+ test(
678
+ 'picks properties from inProcess flowStep and renders default keys ' +
679
+ 'in handler validator schema',
680
+ async () => {
681
+ const rootPath = await mkdtemp(
682
+ join(tmpdir(), 'generate-service-code-v2-inprocess-')
683
+ );
684
+ roots.add(rootPath);
685
+ const schemaRoot = join(rootPath, 'app/src/schemas/FlowSchemas');
686
+ await mkdir(schemaRoot, { recursive: true });
687
+
688
+ await writeFile(
689
+ join(schemaRoot, 'InProcessFlow.js'),
690
+ `export default {
691
+ flowTag: 'InProcessFlow',
692
+ event: ['extTopic', 'lambdaSyncApi'],
693
+ stepProperties: {
694
+ status: { propertyName: 'status', type: 'string', default: 'ACTIVE' },
695
+ retryCount: { propertyName: 'retryCount', type: 'number', default: 0 }
696
+ },
697
+ flowSteps: [
698
+ {
699
+ stepName: 'inProcess',
700
+ properties: ['status', { key: 'retryCount', default: 3 }]
701
+ }
702
+ ]
703
+ };\n`
704
+ );
705
+
706
+ const result = await generateCustomFlowApplicationArtifacts(rootPath);
707
+ assert.ok(result);
708
+
709
+ const sqsHdrContent = await readFile(
710
+ join(
711
+ rootPath,
712
+ 'app/src/generatedCode/FlowSchemas/InProcessFlow/source/' +
713
+ 'InProcessFlow_HdrSqs.js'
714
+ ),
715
+ 'utf8'
716
+ );
717
+ assert.match(
718
+ sqsHdrContent,
719
+ /status: {[\s\S]*type: 'string',[\s\S]*default: 'ACTIVE'/
720
+ );
721
+ assert.match(
722
+ sqsHdrContent,
723
+ /retryCount: {[\s\S]*type: 'number',[\s\S]*default: 3/
724
+ );
725
+
726
+ const apiHdrContent = await readFile(
727
+ join(
728
+ rootPath,
729
+ 'app/src/generatedCode/FlowSchemas/InProcessFlow/source/' +
730
+ 'InProcessFlow_HdrApi.js'
731
+ ),
732
+ 'utf8'
733
+ );
734
+ assert.match(
735
+ apiHdrContent,
736
+ /status: { type: 'string', default: 'ACTIVE' }/
737
+ );
738
+ assert.match(apiHdrContent, /retryCount: { type: 'number', default: 3 }/);
739
+ }
740
+ );
741
+
742
+ test('renders nextSteps IAM permissions in InitialSetupConfig', async () => {
743
+ const { generate } = await import('../src/generate.js');
744
+ const rootPath = await mkdtemp(
745
+ join(tmpdir(), 'generate-service-code-v2-nextsteps-')
746
+ );
747
+ roots.add(rootPath);
748
+ const schemaRoot = join(rootPath, 'app/src/schemas/FlowSchemas');
749
+ await mkdir(schemaRoot, { recursive: true });
750
+
751
+ await writeFile(
752
+ join(schemaRoot, 'Reservations.js'),
753
+ `export default {
754
+ flowTag: 'Reservations',
755
+ event: ['ownTopic'],
756
+ flowSteps: [
757
+ {
758
+ stepName: 'Start',
759
+ nextSteps: [
760
+ {
761
+ targetType: 'extTopic',
762
+ serviceTag: 'GraphHandler',
763
+ topic: 'GetDeepPathSearch_In'
764
+ }
765
+ ]
766
+ },
767
+ {
768
+ stepName: 'GetDeepPathSearch',
769
+ event: ['extTopic'],
770
+ nextSteps: [
771
+ {
772
+ targetType: 'ownTopic',
773
+ topic: 'Create_In'
774
+ }
775
+ ]
776
+ },
777
+ {
778
+ stepName: 'Complete',
779
+ event: ['extTopic']
780
+ }
781
+ ]
782
+ };\n`
783
+ );
784
+
785
+ const result = await generate(rootPath, {
786
+ serviceTag: 'ReservationsService'
787
+ });
788
+ assert.ok(result);
789
+
790
+ const initialSetupConfigContent = await readFile(
791
+ join(
792
+ rootPath,
793
+ 'app/src/generatedCode/CoreFunctions/InitialSetupConfig.js'
794
+ ),
795
+ 'utf8'
796
+ );
797
+ assert.match(initialSetupConfigContent, /roleName: 'ReservationsRole'/);
798
+ assert.match(
799
+ initialSetupConfigContent,
800
+ /ReservationsRolePublishNextStepsTopics/
801
+ );
802
+ assert.match(
803
+ initialSetupConfigContent,
804
+ /snsTopicNameByFlowSchema\(_izContext, 'GetDeepPathSearch_In', 'GraphHandler'\)/
805
+ );
806
+ assert.match(
807
+ initialSetupConfigContent,
808
+ /snsTopicNameByFlowSchema\(\s*_izContext,\s*'Create_In'\)/
809
+ );
810
+ });
@@ -80,12 +80,15 @@ test('filters all SQS functions by their calling flow', () => {
80
80
 
81
81
  assert.match(
82
82
  completion,
83
- /filterPatterns:[\s\S]*\$\{self:custom\.iz_resourcePrefix\}CreateCompleteHdrSqs/
83
+ /#<#CreateCompleteHdrSqsFilterPatterns#>[\s\S]*filterPatterns:[\s\S]*\$\{self:custom\.iz_resourcePrefix\}CreateCompleteHdrSqs/
84
84
  );
85
+ assert.match(completion, /#<#\/CreateCompleteHdrSqsFilterPatterns#>/);
85
86
  assert.match(completion, /exists: false/);
86
87
  assert.match(
87
88
  ordinary,
88
- /filterPatterns:[\s\S]*\$\{self:custom\.iz_resourcePrefix\}CreateHdrSqs/
89
+ /#<#CreateHdrSqsFilterPatterns#>[\s\S]*filterPatterns:[\s\S]*\$\{self:custom\.iz_resourcePrefix\}CreateHdrSqs/
89
90
  );
91
+ assert.match(ordinary, /#<#\/CreateHdrSqsFilterPatterns#>/);
90
92
  assert.match(ordinary, /exists: false/);
91
93
  });
94
+
@@ -347,3 +347,32 @@ async function createTriggerCacheProject() {
347
347
  );
348
348
  return rootPath;
349
349
  }
350
+
351
+ test(
352
+ 'emits ignoreExternalServices hooks in UploadSchema_Main.js and ' +
353
+ 'commands/uploadSchema.js',
354
+ async () => {
355
+ const rootPath = await createCrudProject();
356
+ await generate(rootPath);
357
+
358
+ const uploadSchemaMain = await readFile(
359
+ join(
360
+ rootPath,
361
+ 'app/src/generatedCode/CoreFunctions/UploadSchema_Main.js'
362
+ ),
363
+ 'utf8'
364
+ );
365
+ assert.match(uploadSchemaMain, /\/\/\(<ignoreExternalServices>\)/);
366
+ assert.match(uploadSchemaMain, /\/\/\(<\/ignoreExternalServices>\)/);
367
+
368
+ const commandUploadSchema = await readFile(
369
+ join(
370
+ rootPath,
371
+ 'app/initial_setup/generatedCode/source/commands/uploadSchema.js'
372
+ ),
373
+ 'utf8'
374
+ );
375
+ assert.match(commandUploadSchema, /\/\/\(<ignoreExternalServices>\)/);
376
+ assert.match(commandUploadSchema, /\/\/\(<\/ignoreExternalServices>\)/);
377
+ }
378
+ );
@@ -74,20 +74,54 @@ test('emits relationship action and complete handlers with data-first function Y
74
74
  readFile(
75
75
  join(
76
76
  rootPath,
77
- 'app/src/generatedCode/FlowRelationships/CreateRelationship/source/ProcessCreateRelationship_Main.js'
77
+ 'app/src/generatedCode/FlowRelationships/CreateRelationship/' +
78
+ 'source/ProcessCreateRelationship_Main.js'
78
79
  )
79
80
  )
80
81
  );
81
- assert.match(
82
- await readFile(
83
- join(
84
- rootPath,
85
- 'app/src/generatedCode/FlowRelationships/CreateRelationship/source/CreateRelationship_Main.js'
86
- ),
87
- 'utf8'
82
+ const createMainContent = await readFile(
83
+ join(
84
+ rootPath,
85
+ 'app/src/generatedCode/FlowRelationships/CreateRelationship/' +
86
+ 'source/CreateRelationship_Main.js'
88
87
  ),
88
+ 'utf8'
89
+ );
90
+ assert.match(
91
+ createMainContent,
89
92
  /export default async function createRelationship/
90
93
  );
94
+ assert.match(
95
+ createMainContent,
96
+ /awaitingStepIds\.push\(\{[\s\S]*awaitingStepId:/
97
+ );
98
+ assert.match(
99
+ createMainContent,
100
+ /createAwaitingMultipleSteps\(\s*_izContext,\s*asyncFlowSharedLib\.createPendingStepId/
101
+ );
102
+ assert.doesNotMatch(createMainContent, /const linkTypeId = createLinkTypeId/);
103
+
104
+ const createCompleteContent = await readFile(
105
+ join(
106
+ rootPath,
107
+ 'app/src/generatedCode/FlowRelationships/CreateRelationship/' +
108
+ 'source/CreateRelationshipComplete_Main.js'
109
+ ),
110
+ 'utf8'
111
+ );
112
+ assert.match(
113
+ createCompleteContent,
114
+ /export default async function createRelationshipComplete\(\s*_izContext,\s*requestParams,/
115
+ );
116
+ assert.match(
117
+ createCompleteContent,
118
+ /const {\s*returnValue,\s*status,\s*errorsFound,\s*graphServiceTag\s*} = requestParams;/
119
+ );
120
+ assert.doesNotMatch(
121
+ createCompleteContent,
122
+ /const linkTypeId = createLinkTypeId/
123
+ );
124
+
91
125
  assert.match(yaml, /CreateRelationshipCompleteHdrSqs:/);
92
126
  });
93
127