@izara_project/izara-core-generate-service-code 1.0.66 → 1.0.67

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 (27) hide show
  1. package/docs/TriggeredCache Flow.drawio +193 -0
  2. package/docs/test.mmd +47 -0
  3. package/docs/test.png +0 -0
  4. package/package.json +2 -2
  5. package/src/compile/loadSchemas.js +23 -1
  6. package/src/emit/crud/emitCrudApplicationArtifacts.js +9 -5
  7. package/src/emit/crud/templates/CreateEndpoint_Main.ejs +5 -5
  8. package/src/emit/crud/templates/DeleteEndpoint_Main.ejs +5 -5
  9. package/src/emit/crud/templates/FlowEndpointComplete_Main.ejs +25 -4
  10. package/src/emit/crud/templates/FlowHandler_HdrApi.ejs +18 -0
  11. package/src/emit/crud/templates/GetEndpoint_Main.ejs +2 -2
  12. package/src/emit/crud/templates/UpdateEndpoint_Main.ejs +10 -8
  13. package/src/emit/custom/customFlows.js +76 -25
  14. package/src/emit/custom/emitCustomFlowApplicationArtifacts.js +92 -75
  15. package/src/emit/custom/templates/FlowEndpoint_Main.ejs +4 -4
  16. package/src/emit/custom/templates/triggerCache/CheckTriggerCache_Main.ejs +1 -1
  17. package/src/emit/function/functionYamlArtifact.js +26 -12
  18. package/src/emit/rbac/emitRbacApplicationArtifacts.js +21 -7
  19. package/src/emit/relationship/emitRelationshipApplicationArtifacts.js +6 -5
  20. package/src/emit/relationship/templates/ChangeRelationship_Main.ejs +2 -2
  21. package/src/emit/resource/emitResourceArtifacts.js +400 -105
  22. package/src/emit/system/emitSystemWebSocketArtifacts.js +2 -1
  23. package/src/generate.js +2 -2
  24. package/test/crudApplicationArtifacts.test.js +1 -1
  25. package/test/customFlowApplicationArtifacts.test.js +37 -34
  26. package/test/publicApi.test.js +9 -9
  27. package/test/resourceArtifacts.test.js +1 -1
@@ -68,7 +68,7 @@ async function emitAction(action, relationships, flows, serviceTag) {
68
68
  { path: `${source}/${action}_WbsMain.js`, content: await renderShared('FlowMain_Wbs.ejs', { flowTag: action, upperCaseFlowTag: action, functionName: action }) },
69
69
  { path: `${source}/${action}_HdrWbs.js`, content: await renderShared('FlowEndpoint_HdrWbs.ejs', { flowTag: action, upperCaseFlowTag: action, functionName: action, mainFileName: `${action}_WbsMain`, route: action }) }
70
70
  );
71
- functions.push({ type: 'wbs', functionName: `${action}HdrWbs`, handlerPath: `${handlerRoot}/${action}_HdrWbs.main`, roleName: 'FlowRelationshipRole', routeName: action });
71
+ functions.push({ type: 'wbs', functionName: `${action}HdrWbs`, handlerPath: `${handlerRoot}/${action}_HdrWbs.main`, roleName: 'FlowRelationshipRole', routeName: action, flowTag: action, flowStepName: '' });
72
72
  }
73
73
 
74
74
  for (const event of events) {
@@ -83,7 +83,7 @@ async function emitAction(action, relationships, flows, serviceTag) {
83
83
  { path: `${source}/${complete}_Main.js`, content: await render(`${action}Complete_Main.ejs`, { functionName: complete, upperFunctionName: complete }) },
84
84
  { path: `${source}/${complete}_HdrSqs.js`, content: await renderShared('FlowHandler_HdrSqs.ejs', { ...shared, flowStepName: 'Complete', mainFileName: `${complete}_Main`, functionName: complete, queueName: `${complete}HdrSqs` }) }
85
85
  );
86
- functions.push({ type: 'sqs', functionName: `${action}CompleteHdrSqs`, handlerPath: `${handlerRoot}/${complete}_HdrSqs.main`, roleName: 'FlowRelationshipRole', queueName: `${complete}HdrSqs` });
86
+ functions.push({ type: 'sqs', functionName: `${action}CompleteHdrSqs`, handlerPath: `${handlerRoot}/${complete}_HdrSqs.main`, roleName: 'FlowRelationshipRole', queueName: `${complete}HdrSqs`, flowTag: action, flowStepName: 'Complete' });
87
87
  return { artifacts, functions };
88
88
  }
89
89
 
@@ -91,19 +91,19 @@ function eventHandler(event, action, handlerRoot, relationships, serviceTag) {
91
91
  if (event === 'ownTopic' || event === 'extTopic') {
92
92
  return {
93
93
  fileName: `${action}_HdrSqs`, template: 'FlowHandler_HdrSqs.ejs', queueName: `${action}HdrSqs`,
94
- descriptor: { type: 'sqs', functionName: `${action.replace('Relationship', 'Rel')}HdrSqs`, handlerPath: `${handlerRoot}/${action}_HdrSqs.main`, roleName: 'FlowRelationshipRole', queueName: `${action}HdrSqs` }
94
+ descriptor: { type: 'sqs', functionName: `${action.replace('Relationship', 'Rel')}HdrSqs`, handlerPath: `${handlerRoot}/${action}_HdrSqs.main`, roleName: 'FlowRelationshipRole', queueName: `${action}HdrSqs`, flowTag: action, flowStepName: '' }
95
95
  };
96
96
  }
97
97
  if (event === 'dsq') {
98
98
  return {
99
99
  fileName: `${action}_HdrDsq`, template: 'FlowHandler_HdrDsq.ejs', queueName: `${action}HdrDsq`,
100
- descriptor: { type: 'sqs', functionName: `${action.replace('Relationship', 'Rel')}HdrDsq`, handlerPath: `${handlerRoot}/${action}_HdrDsq.main`, roleName: 'FlowRelationshipRole', queueName: `${action}HdrDsq` }
100
+ descriptor: { type: 'sqs', functionName: `${action.replace('Relationship', 'Rel')}HdrDsq`, handlerPath: `${handlerRoot}/${action}_HdrDsq.main`, roleName: 'FlowRelationshipRole', queueName: `${action}HdrDsq`, flowTag: action, flowStepName: '' }
101
101
  };
102
102
  }
103
103
  if (event === 'lambdaSyncInv') {
104
104
  return {
105
105
  fileName: `${action}_HdrInv`, template: 'FlowHandler_HdrInv.ejs',
106
- descriptor: { type: 'inv', functionName: `${action.replace('Relationship', 'Rel')}HdrInv`, handlerPath: `${handlerRoot}/${action}_HdrInv.main`, roleName: 'FlowRelationshipRole' }
106
+ descriptor: { type: 'inv', functionName: `${action.replace('Relationship', 'Rel')}HdrInv`, handlerPath: `${handlerRoot}/${action}_HdrInv.main`, roleName: 'FlowRelationshipRole', flowTag: action, flowStepName: '' }
107
107
  };
108
108
  }
109
109
  if (event === 'lambdaSyncApi') {
@@ -111,6 +111,7 @@ function eventHandler(event, action, handlerRoot, relationships, serviceTag) {
111
111
  fileName: `${action}_HdrApi`, template: 'FlowHandler_HdrApi.ejs',
112
112
  descriptor: {
113
113
  type: 'api', functionName: `${action.replace('Relationship', 'Rel')}HdrApi`, handlerPath: `${handlerRoot}/${action}_HdrApi.main`, roleName: 'FlowRelationshipRole',
114
+ flowTag: action, flowStepName: '',
114
115
  routes: relationships.map(relationship => {
115
116
  const name = relationship.relationshipTag ?? Object.keys(relationship)[0];
116
117
  return { path: `/${serviceTag ?? '${self:custom.iz_serviceName}'}/${name}/${action.toLowerCase().replace('relationship', '')}`, upperName: upperFirst(name) };
@@ -322,11 +322,11 @@ export default async function <%- functionName %> (
322
322
  // save awaiting
323
323
  await asyncFlowSharedLib.createAwaitingMultipleSteps(
324
324
  _izContext,
325
- awaitingStepIds, // awaitingStepIds
326
325
  asyncFlowSharedLib.createPendingStepId( // pendingStepId
327
326
  _izContext.uniqueRequestId, // hash id
328
327
  PREFIX.changeRel // prefix, use constant further
329
- )
328
+ ),
329
+ awaitingStepIds // awaitingStepIds
330
330
  );
331
331
 
332
332
  // prepare message body