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

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 (90) hide show
  1. package/.prettierrc +11 -0
  2. package/docs/TriggeredCache Flow.drawio +193 -0
  3. package/docs/TriggeredCacheFlow.mmd +47 -0
  4. package/package.json +16 -12
  5. package/scripts/format-ejs.js +105 -0
  6. package/src/compile/compileProject.js +16 -1
  7. package/src/compile/loadSchemas.js +108 -1
  8. package/src/emit/crud/emitCrudApplicationArtifacts.js +9 -5
  9. package/src/emit/crud/emitDynamicCrudFlowSchemas.js +1 -2
  10. package/src/emit/crud/templates/CreateEndpoint_Main.ejs +300 -109
  11. package/src/emit/crud/templates/DeleteEndpoint_Main.ejs +221 -143
  12. package/src/emit/crud/templates/FlowEndpointBeforeLogical_Main.ejs +22 -6
  13. package/src/emit/crud/templates/FlowEndpointComplete_Main.ejs +150 -38
  14. package/src/emit/crud/templates/FlowEndpoint_HdrWbs.ejs +51 -31
  15. package/src/emit/crud/templates/FlowHandler_HdrApi.ejs +57 -31
  16. package/src/emit/crud/templates/FlowHandler_HdrInv.ejs +28 -26
  17. package/src/emit/crud/templates/FlowHandler_HdrSqs.ejs +15 -11
  18. package/src/emit/crud/templates/FlowMain_Wbs.ejs +53 -38
  19. package/src/emit/crud/templates/GetEndpoint_Main.ejs +6 -3
  20. package/src/emit/crud/templates/GetRangeEndpoint_Main.ejs +2 -2
  21. package/src/emit/crud/templates/UpdateEndpoint_Main.ejs +407 -252
  22. package/src/emit/custom/customFlows.js +112 -31
  23. package/src/emit/custom/emitCustomFlowApplicationArtifacts.js +89 -77
  24. package/src/emit/custom/templates/FlowEndpoint_Main.ejs +49 -37
  25. package/src/emit/custom/templates/FlowStep_Main.ejs +7 -9
  26. package/src/emit/custom/templates/s3/ConfirmReserved_HdrSqs.ejs +59 -54
  27. package/src/emit/custom/templates/s3/ConfirmReserved_Main.ejs +33 -23
  28. package/src/emit/custom/templates/s3/CreateObject_HdrWbs.ejs +30 -23
  29. package/src/emit/custom/templates/s3/CreateObject_Main.ejs +56 -39
  30. package/src/emit/custom/templates/s3/CreatePreSignUrl_HdrSqs.ejs +56 -51
  31. package/src/emit/custom/templates/s3/CreatePreSignUrl_Main.ejs +112 -75
  32. package/src/emit/custom/templates/s3/FlowHandler_HdrS3.ejs +12 -7
  33. package/src/emit/custom/templates/s3/ProcessS3File_Main.ejs +11 -8
  34. package/src/emit/custom/templates/s3/ReservedLimit_HdrSqs.ejs +64 -55
  35. package/src/emit/custom/templates/s3/ReservedLimit_Main.ejs +74 -52
  36. package/src/emit/custom/templates/triggerCache/CheckTriggerCache_HdrSqs.ejs +58 -14
  37. package/src/emit/custom/templates/triggerCache/CheckTriggerCache_Main.ejs +12 -17
  38. package/src/emit/custom/templates/triggerCache/TriggerCacheComplete_Main.ejs +20 -13
  39. package/src/emit/custom/templates/triggerCache/TriggerCache_Main.ejs +4 -1
  40. package/src/emit/function/functionYamlArtifact.js +46 -12
  41. package/src/emit/rbac/emitDynamicRbacFlowSchemas.js +28 -15
  42. package/src/emit/rbac/emitRbacApplicationArtifacts.js +179 -66
  43. package/src/emit/rbac/templates/CreateTargetRole_HdrSqs.ejs +41 -18
  44. package/src/emit/rbac/templates/CreateTargetRole_Main.ejs +23 -3
  45. package/src/emit/rbac/templates/ListRbac_HdrApi.ejs +27 -5
  46. package/src/emit/rbac/templates/ListRbac_HdrSqs.ejs +41 -8
  47. package/src/emit/rbac/templates/ListRbac_Main.ejs +26 -6
  48. package/src/emit/rbac/templates/RbacMutation_Main.ejs +23 -3
  49. package/src/emit/rbac/templates/UserRbacFlow_HdrSqs.ejs +46 -0
  50. package/src/emit/rbac/templates/UserRbacFlow_Main.ejs +152 -33
  51. package/src/emit/rbac/templates/UserRoleMutation_Main.ejs +24 -4
  52. package/src/emit/relationship/emitDynamicRelationshipFlowSchemas.js +1 -2
  53. package/src/emit/relationship/emitRelationshipApplicationArtifacts.js +6 -5
  54. package/src/emit/relationship/templates/ChangeRelationshipComplete_Main.ejs +64 -37
  55. package/src/emit/relationship/templates/ChangeRelationship_Main.ejs +260 -144
  56. package/src/emit/relationship/templates/CreateRelationshipComplete_Main.ejs +68 -43
  57. package/src/emit/relationship/templates/CreateRelationship_Main.ejs +315 -171
  58. package/src/emit/relationship/templates/DeleteRelationshipComplete_Main.ejs +67 -41
  59. package/src/emit/relationship/templates/DeleteRelationship_Main.ejs +226 -115
  60. package/src/emit/relationship/templates/FlowHandler_HdrApi.ejs +41 -33
  61. package/src/emit/relationship/templates/FlowHandler_HdrDsq.ejs +15 -11
  62. package/src/emit/relationship/templates/FlowHandler_HdrInv.ejs +28 -26
  63. package/src/emit/relationship/templates/FlowHandler_HdrSqs.ejs +15 -11
  64. package/src/emit/relationship/templates/GetRelationshipComplete_Main.ejs +46 -26
  65. package/src/emit/relationship/templates/GetRelationship_Main.ejs +233 -126
  66. package/src/emit/relationship/templates/MoveRelationshipComplete_Main.ejs +72 -44
  67. package/src/emit/relationship/templates/MoveRelationship_Main.ejs +266 -150
  68. package/src/emit/relationship/templates/UpdateRelationshipComplete_Main.ejs +74 -45
  69. package/src/emit/relationship/templates/UpdateRelationship_Main.ejs +285 -152
  70. package/src/emit/resource/emitResourceArtifacts.js +499 -108
  71. package/src/emit/resource/templates/DynamoDBTable_Yaml.ejs +18 -18
  72. package/src/emit/resource/templates/FlowOut_Yaml.ejs +5 -5
  73. package/src/emit/resource/templates/GeneratedLambdaRoleServiceConfig.ejs +138 -0
  74. package/src/emit/resource/templates/ResourceBeforeLogicalYaml.ejs +44 -44
  75. package/src/emit/resource/templates/ResourceSqsYaml.ejs +36 -36
  76. package/src/emit/resource/templates/ResourceYaml.ejs +48 -48
  77. package/src/emit/resource/templates/S3Bucket_Yaml.ejs +19 -0
  78. package/src/emit/resource/templates/SharedResource_Yaml.ejs +11 -11
  79. package/src/emit/resource/templates/SystemDynamoDB_Yaml.ejs +105 -105
  80. package/src/emit/system/emitSystemWebSocketArtifacts.js +2 -1
  81. package/src/generate.js +8 -4
  82. package/test/createTargetRoleHandler.test.js +63 -14
  83. package/test/crudApplicationArtifacts.test.js +1 -1
  84. package/test/customFlowApplicationArtifacts.test.js +71 -43
  85. package/test/dynamicCrudFlowSchemas.test.js +6 -6
  86. package/test/dynamicRbacFlowSchemas.test.js +8 -12
  87. package/test/dynamicRelationshipFlowSchemas.test.js +3 -3
  88. package/test/publicApi.test.js +11 -13
  89. package/test/resourceArtifacts.test.js +13 -3
  90. package/src/emit/rbac/templates/UserRbacFlow_HdrInv.ejs +0 -10
@@ -15,22 +15,21 @@ You should have received a copy of the GNU Affero General Public License
15
15
  along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
  */
17
17
 
18
-
19
- import { objectHash as hash} from '@izara_project/izara-shared-core';
18
+ import { objectHash as hash } from '@izara_project/izara-shared-core';
20
19
 
21
20
  import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
22
- import snsSharedLib from "@izara_project/izara-core-library-sns";
23
- import dynamodbSharedLib from "@izara_project/izara-core-library-dynamodb";
24
- import asyncFlowSharedLib from "@izara_project/izara-core-library-asynchronous-flow";
25
-
26
- import { sns } from "@izara_project/izara-core-library-external-request";
27
- import { utils, consts } from '@izara_project/izara-core-library-service-schemas';
21
+ import snsSharedLib from '@izara_project/izara-core-library-sns';
22
+ import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
23
+ import asyncFlowSharedLib from '@izara_project/izara-core-library-asynchronous-flow';
24
+
25
+ import { sns } from '@izara_project/izara-core-library-external-request';
26
+ import {
27
+ utils,
28
+ consts
29
+ } from '@izara_project/izara-core-library-service-schemas';
28
30
  const { createLinkTypeId } = utils;
29
31
 
30
- const {
31
- TOPIC_NAME_GENERATE_CODE,
32
- PREFIX
33
- } = consts;
32
+ const { TOPIC_NAME_GENERATE_CODE, PREFIX } = consts;
34
33
 
35
34
  //(<optionalRequire>)
36
35
  //(</optionalRequire>)
@@ -41,42 +40,45 @@ export default async function deleteRelationshipComplete(
41
40
  status,
42
41
  errorsFound,
43
42
  graphServiceTag,
44
- passBackProperties = {},
43
+ passBackProperties = {}
45
44
  ) {
46
45
  try {
47
- _izContext.logger.debug("Function:deleteRelationshipComplete", {
46
+ _izContext.logger.debug('Function:deleteRelationshipComplete', {
48
47
  returnValue: returnValue,
49
48
  status: status,
50
49
  errorsFound: errorsFound,
51
50
  graphServiceTag: graphServiceTag,
52
- passBackProperties: passBackProperties,
51
+ passBackProperties: passBackProperties
53
52
  });
54
53
 
55
54
  let awaitingStepId = asyncFlowSharedLib.createAwaitingStepId(
56
55
  returnValue.parentFlowId, // hash id
57
56
  PREFIX.deleteRel // prefix, use constant further
58
- )
57
+ );
59
58
 
60
59
  let deleteRelPendingObjects = await dynamodbSharedLib.query(
61
60
  _izContext,
62
- await dynamodbSharedLib.tableName(_izContext, "AwaitingMultipleSteps"),
61
+ await dynamodbSharedLib.tableName(_izContext, 'AwaitingMultipleSteps'),
63
62
  {
64
63
  awaitingStepId: awaitingStepId
65
64
  }
66
65
  );
67
- _izContext.logger.debug("record of deleteRelPendingObjects ::", deleteRelPendingObjects);
68
-
69
-
66
+ _izContext.logger.debug(
67
+ 'record of deleteRelPendingObjects ::',
68
+ deleteRelPendingObjects
69
+ );
70
70
 
71
71
  await Promise.all(
72
72
  deleteRelPendingObjects.Items.map(async ({ pendingStepId }) => {
73
- if (await asyncFlowSharedLib.checkAllAwaitingStepsFinished(
74
- _izContext,
75
- pendingStepId, // task waiting
76
- awaitingStepId,
77
- errorsFound
78
- )) {
79
- _izContext.logger.debug("finished all awaitingStep");
73
+ if (
74
+ await asyncFlowSharedLib.checkAllAwaitingStepsFinished(
75
+ _izContext,
76
+ pendingStepId, // task waiting
77
+ awaitingStepId,
78
+ errorsFound
79
+ )
80
+ ) {
81
+ _izContext.logger.debug('finished all awaitingStep');
80
82
 
81
83
  let deleteRelComp = {
82
84
  firstObject: returnValue.requestParams.firstObject,
@@ -87,20 +89,45 @@ export default async function deleteRelationshipComplete(
87
89
  errorsFound: errorsFound
88
90
  };
89
91
 
90
- deleteRelComp = callingFlowSharedLib.addParentPassBackPropertiesToSnsResponseMessageObject(passBackProperties, deleteRelComp);
91
- _izContext.logger.debug("After addCallingFlowToSnsResponseMessageObject", deleteRelComp);
92
-
93
- let messageAttributes = callingFlowSharedLib.addParentPassBackCallingFlowToSnsResponseMessageAttributes(passBackProperties, {});
94
- _izContext.logger.debug("After addCallingFlowToSnsResponseMessageAttributes", deleteRelComp);
92
+ deleteRelComp =
93
+ callingFlowSharedLib.addParentPassBackPropertiesToSnsResponseMessageObject(
94
+ passBackProperties,
95
+ deleteRelComp
96
+ );
97
+ _izContext.logger.debug(
98
+ 'After addCallingFlowToSnsResponseMessageObject',
99
+ deleteRelComp
100
+ );
101
+
102
+ let messageAttributes =
103
+ callingFlowSharedLib.addParentPassBackCallingFlowToSnsResponseMessageAttributes(
104
+ passBackProperties,
105
+ {}
106
+ );
107
+ _izContext.logger.debug(
108
+ 'After addCallingFlowToSnsResponseMessageAttributes',
109
+ deleteRelComp
110
+ );
95
111
 
96
112
  let sendMessageToOutDeleteRelationshipComplete = {
97
113
  Message: JSON.stringify(deleteRelComp),
98
- MessageAttributes: sns.createStringMessageAttributes(_izContext, messageAttributes),
99
- TopicArn: await snsSharedLib.snsTopicArnByFlowSchema(_izContext, TOPIC_NAME_GENERATE_CODE.outDeleteRelComplete)
114
+ MessageAttributes: sns.createStringMessageAttributes(
115
+ _izContext,
116
+ messageAttributes
117
+ ),
118
+ TopicArn: snsSharedLib.snsTopicArnByFlowSchema(
119
+ _izContext,
120
+ TOPIC_NAME_GENERATE_CODE.outDeleteRelComplete
121
+ )
100
122
  };
101
- _izContext.logger.debug("Send message to OutDeleteRelationshipComplete :::>", sendMessageToOutDeleteRelationshipComplete);
102
- await sns.publishAsync(_izContext, sendMessageToOutDeleteRelationshipComplete);
103
-
123
+ _izContext.logger.debug(
124
+ 'Send message to OutDeleteRelationshipComplete :::>',
125
+ sendMessageToOutDeleteRelationshipComplete
126
+ );
127
+ await sns.publishAsync(
128
+ _izContext,
129
+ sendMessageToOutDeleteRelationshipComplete
130
+ );
104
131
  } // check pendingStepId finished
105
132
 
106
133
  // remove awaitingMultipleStep after finished
@@ -113,14 +140,13 @@ export default async function deleteRelationshipComplete(
113
140
  }) // end per pendingStep
114
141
  );
115
142
 
116
-
117
143
  return {
118
144
  returnValue,
119
145
  status,
120
146
  errorsFound
121
- }
147
+ };
122
148
  } catch (err) {
123
- _izContext.logger.error('error deleteRelationshipComplete:', err)
124
- throw (err)
149
+ _izContext.logger.error('error deleteRelationshipComplete:', err);
150
+ throw err;
125
151
  }
126
152
  }