@izara_project/izara-market-library-service-schemas 1.0.4 → 1.0.6

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 (177) hide show
  1. package/package.json +2 -2
  2. package/src/GenerateCodeLibs/index.js +2 -1
  3. package/src/GenerateCodeLibs/src/Consts.js +20 -5
  4. package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +298 -12
  5. package/src/GenerateCodeLibs/src/TranslateIdsLibs.js +89 -0
  6. package/src/MainLibs/src/Utils.js +10 -0
  7. package/src/TemplateManager/src/CreateRelationship/createRelationship/functionYaml/HdrApi/data.js +119 -0
  8. package/src/TemplateManager/src/CreateRelationship/createRelationship/functionYaml/HdrDsq/data.js +133 -0
  9. package/src/TemplateManager/src/CreateRelationship/createRelationship/functionYaml/HdrInv/data.js +120 -0
  10. package/src/TemplateManager/src/CreateRelationship/createRelationship/functionYaml/HdrSqs/data.js +133 -0
  11. package/src/TemplateManager/src/CreateRelationship/createRelationship/mainFunction/data.js +59 -0
  12. package/src/TemplateManager/src/CreateRelationship/createRelationship/mainFunction/template.ejs +340 -0
  13. package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrApi/data.js +58 -0
  14. package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrApi/request.json +0 -0
  15. package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrApi/template.ejs +120 -0
  16. package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrDsq/data.js +59 -0
  17. package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrDsq/request.json +0 -0
  18. package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrDsq/template.ejs +167 -0
  19. package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrInv/data.js +60 -0
  20. package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrInv/request.json +0 -0
  21. package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrInv/template.ejs +107 -0
  22. package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrSqs/data.js +60 -0
  23. package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrSqs/request.json +0 -0
  24. package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/HdrSqs/template.ejs +146 -0
  25. package/src/TemplateManager/src/CreateRelationship/createRelationship/perAction/request.json +30 -0
  26. package/src/TemplateManager/src/CreateRelationship/createRelationship/sns-in-sqs/data.js +78 -0
  27. package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/functionYaml/data.js +133 -0
  28. package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/functionYaml/request.json +0 -0
  29. package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/functionYaml/template.ejs +33 -0
  30. package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/handler/HdrSqs/data.js +61 -0
  31. package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/handler/HdrSqs/request.json +0 -0
  32. package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/handler/HdrSqs/template.ejs +125 -0
  33. package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/mainFunction/data.js +56 -0
  34. package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/mainFunction/request.json +0 -0
  35. package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/mainFunction/template.ejs +137 -0
  36. package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/sns-in-sqs/data.js +72 -0
  37. package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/sns-in-sqs/request.json +0 -0
  38. package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/sns-in-sqs/template.ejs +47 -0
  39. package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/sns-out/data.js +72 -0
  40. package/src/TemplateManager/src/CreateRelationship/createRelationshipComplete/sns-out/request.json +0 -0
  41. package/src/TemplateManager/src/FindData/FindDataYaml/data.js +188 -0
  42. package/src/TemplateManager/src/FindData/FindDataYaml/template.ejs +27 -0
  43. package/src/TemplateManager/src/FindData/GetByStorage/getByDynamo.ejs +53 -0
  44. package/src/TemplateManager/src/FindData/GetByStorage/getByGraph.ejs +99 -0
  45. package/src/TemplateManager/src/FindData/Handler/data.js +48 -0
  46. package/src/TemplateManager/src/FindData/Handler/template.ejs +140 -0
  47. package/src/TemplateManager/src/FindData/mainFunction/data.js +279 -0
  48. package/src/TemplateManager/src/FindData/mainFunction/template.ejs +155 -0
  49. package/src/TemplateManager/src/GenerateCode(Old).js +1 -1
  50. package/src/TemplateManager/src/GenerateCode.js +205 -45
  51. package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/functionYaml/data.js +98 -0
  52. package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/functionYaml/template.ejs +33 -0
  53. package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/handler/data.js +0 -0
  54. package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/handler/template.ejs +0 -0
  55. package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/mainFunction/createObjectComplete_main.js +172 -0
  56. package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/mainFunction/data.js +0 -0
  57. package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/mainFunction/template.ejs +0 -0
  58. package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/sns-in-sqs/data.js +0 -0
  59. package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/sns-in-sqs/template.ejs +0 -0
  60. package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/sns-out/data.js +0 -0
  61. package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/sns-out/template.ejs +0 -0
  62. package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/functionYaml/data.js +98 -0
  63. package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/functionYaml/template.ejs +33 -0
  64. package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/handler/data.js +59 -0
  65. package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/handler/template.ejs +129 -0
  66. package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/mainFunction/data.js +53 -0
  67. package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/mainFunction/template.ejs +126 -0
  68. package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/sns-out/data.js +62 -0
  69. package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/sqs-in-sns/data.js +58 -0
  70. package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/sqs-in-sns/template.ejs +47 -0
  71. package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrApi/data.js +24 -20
  72. package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrApi/template.ejs +2 -2
  73. package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrDsq/data.js +27 -20
  74. package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrInv/data.js +54 -22
  75. package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrSqs/data.js +28 -23
  76. package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrSqs/template.ejs +30 -0
  77. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrApi/data.js +6 -22
  78. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrApi/getTemplate.ejs +76 -0
  79. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrApi/updateTemplate.ejs +67 -0
  80. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrDsq/data.js +47 -37
  81. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrDsq/getTemplate.ejs +105 -0
  82. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrDsq/updateTemplate.ejs +109 -0
  83. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/createTemplate.ejs +75 -0
  84. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/data.js +68 -33
  85. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/getTemplate.ejs +82 -0
  86. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/updateTemplate.ejs +75 -0
  87. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrSqs/data.js +46 -30
  88. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrSqs/getTemplate.ejs +124 -0
  89. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrSqs/updateTemplate.ejs +133 -0
  90. package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Create/CreateObject_main.js +760 -0
  91. package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Create/data.js +67 -0
  92. package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Create/request.json +0 -0
  93. package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Create/template.ejs +581 -0
  94. package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Get/data.js +0 -21
  95. package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Get/template.ejs +34 -31
  96. package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Get/testParam.json +5 -0
  97. package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Update/data.js +61 -0
  98. package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Update/request.json +0 -0
  99. package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Update/template.ejs +267 -0
  100. package/src/TemplateManager/src/ProcessLogical/Handler/data.js +49 -0
  101. package/src/TemplateManager/src/ProcessLogical/Handler/template.ejs +129 -0
  102. package/src/TemplateManager/src/ProcessLogical/ProcessLogicalYaml/data.js +175 -0
  103. package/src/TemplateManager/src/ProcessLogical/ProcessLogicalYaml/template.ejs +25 -0
  104. package/src/TemplateManager/src/ProcessLogical/mainFunction/data.js +47 -0
  105. package/src/TemplateManager/src/ProcessLogical/mainFunction/template.ejs +421 -0
  106. package/src/TemplateManager/src/ProcessLogicalPagination/DsqYaml/data.js +50 -0
  107. package/src/TemplateManager/src/ProcessLogicalPagination/DsqYaml/template.ejs +32 -0
  108. package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrDsq/data.js +167 -0
  109. package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrDsq/template.ejs +25 -0
  110. package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrSqs/data.js +169 -0
  111. package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrSqs/template.ejs +25 -0
  112. package/src/TemplateManager/src/ProcessLogicalPagination/Handler/HdrDsq/data.js +48 -0
  113. package/src/TemplateManager/src/ProcessLogicalPagination/Handler/HdrDsq/template.ejs +163 -0
  114. package/src/TemplateManager/src/ProcessLogicalPagination/Handler/HdrSqs/data.js +48 -0
  115. package/src/TemplateManager/src/ProcessLogicalPagination/Handler/HdrSqs/template.ejs +146 -0
  116. package/src/TemplateManager/src/ProcessLogicalPagination/mainFunction/data.js +48 -0
  117. package/src/TemplateManager/src/ProcessLogicalPagination/mainFunction/template.ejs +212 -0
  118. package/src/TemplateManager/src/ResourceYaml/CreateSourceData.js +2 -2
  119. package/src/TemplateManager/src/ResourceYaml/dynamodb/awaitingMultipleStepData.js +5 -8
  120. package/src/TemplateManager/src/ResourceYaml/dynamodb/mainResourcePerObjectSchemaData.js +4 -26
  121. package/src/TemplateManager/src/ResourceYaml/dynamodb/processLogicalAndFindData.js +6 -10
  122. package/src/TemplateManager/src/ResourceYaml/sns-in-sqs/defaultSnsInSqsForFindDataAndProcessLogical.js +28 -16
  123. package/src/TemplateManager/src/ResourceYaml/sns-in-sqs/snsAndSqsPerActiondata.js +5 -5
  124. package/src/TemplateManager/src/ResourceYaml/sns-out/data.js +3 -3
  125. package/src/TemplateManager/src/ResourceYaml/sns-out/defaultSnsOutForFindDataAndProcessLogical.js +75 -0
  126. package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/functionYaml/data.js +95 -0
  127. package/src/TemplateManager/src/{FunctionYaml/HdrSqs → TranslateIdReq/ProcessingTranslateIds/functionYaml}/template.ejs +1 -1
  128. package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/handler/dataHdrDsq.js +52 -0
  129. package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/handler/template.ejs +194 -0
  130. package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/mainFunction/data.js +48 -0
  131. package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/mainFunction/template.ejs +330 -0
  132. package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/sns-out/data.js +47 -0
  133. package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/sqs-sns/data.js +58 -0
  134. package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/sqs-sns/template.ejs +43 -0
  135. package/src/TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrDsq/data.js +116 -0
  136. package/src/TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrSqs/data.js +116 -0
  137. package/src/TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrDsq/data.js +60 -0
  138. package/src/TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrDsq/template.ejs +157 -0
  139. package/src/TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrSqs/data.js +59 -0
  140. package/src/TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrSqs/template.ejs +175 -0
  141. package/src/TemplateManager/src/TranslateIdReq/TranslateIds/mainFunction/data.js +61 -0
  142. package/src/TemplateManager/src/TranslateIdReq/TranslateIds/mainFunction/template.ejs +155 -0
  143. package/src/TemplateManager/src/TranslateIdReq/TranslateIds/resourceYaml/dynamoDb/data.js +120 -0
  144. package/src/TemplateManager/src/TranslateIdReq/TranslateIds/resourceYaml/sns-sqs/data.js +75 -0
  145. package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/functionYaml/data.js +8 -24
  146. package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/handler/HdrSqs/data.js +7 -21
  147. package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/mainFunction/data.js +4 -3
  148. package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/mainFunction/template.ejs +1 -1
  149. package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/sns-in-sqs/data.js +10 -13
  150. package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/sns-in-sqs/template.ejs +1 -0
  151. package/src/TemplateManager/src/UpdateRelationshipSchema/updateRalationshipComplete/sns-out/data.js +6 -5
  152. package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrApi/data.js +13 -21
  153. package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrDsq/data.js +11 -29
  154. package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrInv/data.js +16 -21
  155. package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrSqs/data.js +12 -27
  156. package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/mainFunction/data.js +3 -18
  157. package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/mainFunction/template.ejs +18 -11
  158. package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrApi/data.js +5 -18
  159. package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrDsq/data.js +5 -19
  160. package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrInv/data.js +7 -18
  161. package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/HdrSqs/data.js +6 -20
  162. package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/perAction/request.json +3 -4
  163. package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/sns-in-sqs/data.js +5 -6
  164. package/src/TemplateManager/src/UpdateRelationshipSchema/updateRelationship/sns-out/data.js +4 -4
  165. package/src/TemplateManager/src/externalService/LambdaRole/data.js +181 -59
  166. package/src/TemplateManager/src/externalService/LambdaRole/template.ejs +17 -15
  167. package/src/TemplateManager/src/externalService/SnsTopicSubscriotions/data.js +56 -44
  168. package/src/TemplateManager/src/externalService/SnsTopicSubscriotions/template.ejs +3 -4
  169. package/src/TemplateManager/src/libs/Consts.js +162 -13
  170. package/src/TemplateManager/src/PerActionEndpoint/Handler/testRequest.json +0 -5
  171. /package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrApi/request.json +0 -0
  172. /package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrDsq/request.json +0 -0
  173. /package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrDsq/template.ejs +0 -0
  174. /package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrInv/example req.js +0 -0
  175. /package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrInv/request.json +0 -0
  176. /package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrInv/template.ejs +0 -0
  177. /package/src/TemplateManager/src/{FunctionYaml → PerActionEndpoint/FunctionYaml}/HdrSqs/request.json +0 -0
@@ -0,0 +1,172 @@
1
+ /*
2
+ Copyright (C) 2021 Sven Mason <http://izara.io>
3
+
4
+ This program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU Affero General Public License as
6
+ published by the Free Software Foundation, either version 3 of the
7
+ License, or (at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU Affero General Public License for more details.
13
+
14
+ You should have received a copy of the GNU Affero General Public License
15
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ */
17
+ 'use strict';
18
+ const asyncFlowSharedLib = require('@izara_project/izara-shared/src/AsyncFlowSharedLib');
19
+ const dynamodbSharedLib = require('@izara_project/izara-shared/src/DynamodbSharedLib');
20
+ const snsSharedLib = require('@izara_project/izara-shared/src/SnsSharedLib');
21
+ const sns = require('@izara_project/izara-core-library-external-request/src/resources/Sns');
22
+ const callingFlowSharedLib = require('@izara_project/izara-shared/src/CallingFlowSharedLib');
23
+ const _ = require('lodash');
24
+ const hash = require("object-hash")
25
+
26
+
27
+ const PREFIX = {
28
+ CREATE_OBJECT_ASYNC: "createObjectAsync",
29
+ CREATE_OBJECT_ASYNC_COMPLETE: "createObjectAsyncComplete"
30
+ }
31
+
32
+ /**
33
+ *
34
+ * @param {*} _izContext
35
+ * @param {*} returnValue
36
+ * @param {*} status
37
+ * @param {*} errorsFounds
38
+ * @param {*} graphServiceTag
39
+ * @param {*} passBackProperties
40
+ * @param {*} callingFlowConfig
41
+ returnValue = {
42
+ queryResult: returnCreateNode,
43
+ objType,
44
+ objInstance,
45
+ relationships,
46
+ settings
47
+ }
48
+ */
49
+ module.exports.createObjectComplete = async (
50
+ _izContext,
51
+ returnValue,
52
+ status,
53
+ errorsFound,
54
+ graphServiceTag,
55
+ passBackProperties,
56
+ callingFlowConfig
57
+ ) => {
58
+ try {
59
+ _izContext.logger.debug("function createObjectComplete:", {
60
+ returnValue,
61
+ status,
62
+ errorsFound,
63
+ graphServiceTag,
64
+ passBackProperties,
65
+ callingFlowConfig
66
+ });
67
+
68
+ let errorFounds = [];
69
+
70
+ if (_.isEmpty(returnValue)) {
71
+ _izContext.logger.debug("message callingFlowProperties is empty");
72
+ throw new NoRetryError("message not an object")
73
+ };
74
+ // validate.
75
+ if (!returnValue.hasOwnProperty("queryResult")) {
76
+ errorFounds.push("message is not have property queryResult, should be not happen");
77
+ };
78
+ if (!returnValue.hasOwnProperty("objType")) {
79
+ errorFounds.push("message is not have property objType, should be not happen");
80
+ };
81
+ if (!returnValue.hasOwnProperty("objInstance")) {
82
+ errorFounds.push("message is not have property objInstance, should be not objInstance");
83
+ };
84
+
85
+ if (status == "error" && errorsFound.length > 0) {
86
+ errorFounds.push(errorsFound);
87
+ } else if (status == "error" && errorsFound.length == 0) {
88
+ errorFounds.push("[invalid]statur is error not have errorfound form graphService");
89
+
90
+ };
91
+ if (status === "complete" && errorsFound.length > 0) {
92
+ errorFounds.push("[Invalid] status is commplete should be not have errorsFound");
93
+ };
94
+ if (graphServiceTag == "") {
95
+ errorFounds.push("[Invalid] graphServiceTag is not empty string");
96
+ };
97
+
98
+ if (errorsFound.length > 0) {
99
+ _izContext.logger.debug("Have error form grapService:", errorsFound);
100
+ errorFounds = errorFounds.concat(errorsFound);
101
+ };
102
+
103
+ // check and remove awaitngStep finish.
104
+ let awaitingStepId = asyncFlowSharedLib.createAwaitingStepId((hash(
105
+ {
106
+ objType: returnValue.objType,
107
+ graphServerTag: graphServiceTag,
108
+ identifiers: returnValue.objInstance.identifiers
109
+ }
110
+ )),
111
+ PREFIX.CREATE_OBJECT_ASYNC
112
+ )
113
+ _izContext.logger.debug("awaitingStepId:", awaitingStepId);
114
+
115
+ let recordAwaitingSteps = await dynamodbSharedLib.query(
116
+ _izContext,
117
+ await dynamodbSharedLib.tableName(_izContext, "AwaitingMultipleSteps"),
118
+ {
119
+ awaitingStepId: awaitingStepId
120
+ }
121
+ );
122
+ _izContext.logger.debug("record awaitingSteps::", recordAwaitingSteps);
123
+
124
+ nextAwaitingAteps:
125
+ for (let listRecordAwaitingStep of recordAwaitingSteps.Items) {
126
+
127
+ _izContext.logger.debug("iterate RecordAwaitingStep:", listRecordAwaitingStep);
128
+
129
+
130
+ if (!await asyncFlowSharedLib.checkAllAwaitingStepsFinished(
131
+ _izContext,
132
+ listRecordAwaitingStep.pendingStepId,
133
+ awaitingStepId
134
+ )) {
135
+ _izContext.logger.debug("!Waiting record form other graph::")
136
+ // **** add step of remove awaitingMultiplestep!! ??
137
+ continue nextAwaitingAteps
138
+ };
139
+
140
+ await asyncFlowSharedLib.removeAwaitingMultipleStep(
141
+ _izContext,
142
+ awaitingStepId,
143
+ listRecordAwaitingStep.pendingStepId,
144
+ );
145
+ _izContext.logger.debug("Remove awaitingStep finish")
146
+ };
147
+
148
+ // seagame: problem about lambdaComplete is will missing errorsFound from request if have 2 request
149
+ // one send with errorsFound and one send without errorsFound
150
+ // this scenario can complete with or without errorsFound
151
+ let messageObject = {
152
+ objType: returnValue.objType,
153
+ identifierId: returnValue.objInstance.identifiers,
154
+ errorFounds: errorFounds
155
+ };
156
+
157
+ messageObject = callingFlowSharedLib.addParentPassBackPropertiesToSnsResponseMessageObject(passBackProperties, messageObject)
158
+ let messageAttributes = callingFlowSharedLib.addParentPassBackCallingFlowToSnsResponseMessageAttributes(passBackProperties, {})
159
+
160
+ let sendMessageOutCreateObjectComplete = {
161
+ Message: JSON.stringify(messageObject),
162
+ MessageAttributes: sns.createStringMessageAttributes(_izContext, messageAttributes),
163
+ TopicArn: await snsSharedLib.snsTopicArn(_izContext, "OutCreateObjectComplete")
164
+ };
165
+ _izContext.logger.debug("Send message to OutCreateObjectComplete :::>", sendMessageOutCreateObjectComplete)
166
+ await sns.publishAsync(_izContext, sendMessageOutCreateObjectComplete);
167
+
168
+
169
+ } catch (err) {
170
+ throw (err)
171
+ }
172
+ }
@@ -0,0 +1,98 @@
1
+ /*
2
+ Copyright (C) 2020 Sven Mason <http://izara.io>
3
+
4
+ This program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU Affero General Public License as
6
+ published by the Free Software Foundation, either version 3 of the
7
+ License, or (at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU Affero General Public License for more details.
13
+
14
+ You should have received a copy of the GNU Affero General Public License
15
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ 'use strict';
19
+ const path = require('path');
20
+ const fs = require('fs');
21
+
22
+ const { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
23
+ const { getGraphServiceNameFromGraphServerTagWithCache, getServiceNameWithCache } = require('@izara_project/izara-core-library-service-schemas/src/ServiceConfig')
24
+ const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../MainLibs/src/Utils")
25
+ const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SOURCE_PATH, externalResourceName, getGraphServiceNameFromAllRelSchema, FUNCTION_NAME, SAVE_FILE_NAME, getGraphServiceNameFromObjectSchema, defaultIamRolePerAction, SQS_RESOURCE, SNS_RESOURCE, DYNAMO_RESOURCE } = require("../../../libs/Consts");
26
+
27
+ const templatePath = path.join(__dirname, './template.ejs');
28
+
29
+ function data(_izContext, srcPath) {
30
+ return [createFunctionYamlOutUpdateComplete(_izContext, srcPath)]
31
+ }
32
+
33
+ function createFunctionYamlOutUpdateComplete(_izContext, srcPath) {
34
+ let functionName = upperCase(FUNCTION_NAME.updateNodeComplete)
35
+ let additionalResourcePermission = defaultIamRolePerAction();
36
+ let awaitingTables = ["AwaitingMultipleSteps", "AwaitingMultipleStepByPending"]
37
+ let handlerType = upperCase(HANDLER.hdrSqs)
38
+
39
+ additionalResourcePermission.push(
40
+ createIamRole(
41
+ {
42
+ [RESOURCE_CLASSES.sqs]: [
43
+ SQS_RESOURCE.deleteMessage,
44
+ SQS_RESOURCE.deleteMessageBatch,
45
+ SQS_RESOURCE.getQueueAttributes,
46
+ SQS_RESOURCE.getQueueUrl,
47
+ SQS_RESOURCE.receiveMessage,
48
+ SQS_RESOURCE.sendMessage
49
+ ],
50
+ [RESOURCE_CLASSES.sns]: [
51
+ SNS_RESOURCE.publish,
52
+ SNS_RESOURCE.subscription
53
+ ]
54
+ },
55
+ [
56
+ resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName)),
57
+ resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + "DLQ"),
58
+ resourceNames(RESOURCE_CLASSES.sns, "In" + upperCase(functionName)),
59
+ resourceNames(RESOURCE_CLASSES.sns, "Out" + upperCase(functionName)),
60
+ ]
61
+ )
62
+ )
63
+
64
+ additionalResourcePermission.push(
65
+ createIamRole(
66
+ {
67
+ [RESOURCE_CLASSES.dynamoDbTable]: [
68
+ DYNAMO_RESOURCE.updateItem,
69
+ DYNAMO_RESOURCE.query,
70
+ DYNAMO_RESOURCE.deleteItem
71
+ ]
72
+ },
73
+ awaitingTables.map(tableName =>
74
+ resourceNames(RESOURCE_CLASSES.dynamoDbTable, tableName)
75
+ )
76
+ )
77
+ )
78
+
79
+
80
+ return {
81
+ templatePath: templatePath,
82
+ templateData: {
83
+ functionName,
84
+ handlerType,
85
+ additionalResourcePermission,
86
+ resourceLocation: SOURCE_PATH.resourceLocationPerAction
87
+ },
88
+ setting: {
89
+ savePath: path.join(srcPath, SOURCE_PATH.appYaml),
90
+ saveFileName: SAVE_FILE_NAME.functionPerActionYaml,
91
+ fileExtension: '.yml',
92
+ isAppend: true
93
+ }
94
+
95
+ }
96
+ }
97
+
98
+ module.exports = data
@@ -0,0 +1,33 @@
1
+ <%_ const join = require('path').join; _%>
2
+ <%- firstLetterUpperCase(functionName) %>:
3
+ handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`)%>
4
+ name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %>
5
+ events:
6
+ - sqs:
7
+ arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %>
8
+ batchSize: 10
9
+ filterPatterns: #**** need to update serverless framwork upper v.2.69.1
10
+ - body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%-firstLetterUpperCase(functionName) %>"]}}} # functionName of callingFlow
11
+ - body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
12
+ iamRoleStatements:
13
+ <%_ additionalResourcePermission.forEach(resourcePermission => { _%>
14
+ - Effect: <%- resourcePermission.effect %>
15
+ Action:
16
+ <%_ Object.keys(resourcePermission.action).forEach(resourcePerAction => { _%>
17
+ <%_ resourcePermission.action[resourcePerAction].forEach(permission => { _%>
18
+ - <%- resourcePerAction %>:<%- permission %>
19
+ <%_}) _%>
20
+ <%_ }) _%>
21
+ Resource:
22
+ <%_ resourcePermission.resource.forEach(resource => { _%>
23
+ - <%- resource %>
24
+ <%_ }) _%>
25
+ <%_}) _%>
26
+ #<#<%- functionName %><%- handlerType %>IamRole#>
27
+ #<#/<%- functionName %><%- handlerType %>IamRole#>
28
+ <%_ function firstLetterUpperCase(text){
29
+ return text.charAt(0).toUpperCase() + text.slice(1)
30
+ } _%>
31
+ <%_ function firstLetterLowerCase(str) {
32
+ return str.charAt(0).toLowerCase() + str.slice(1)
33
+ } _%>
@@ -0,0 +1,59 @@
1
+ /*
2
+ Copyright (C) 2020 Sven Mason <http://izara.io>
3
+
4
+ This program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU Affero General Public License as
6
+ published by the Free Software Foundation, either version 3 of the
7
+ License, or (at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU Affero General Public License for more details.
13
+
14
+ You should have received a copy of the GNU Affero General Public License
15
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ 'use strict';
19
+ const path = require('path');
20
+ const fs = require('fs');
21
+
22
+ const { ACTIONS, HANDLER } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
23
+
24
+ const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase, firstLetterUpperCase } = require("../../../../../MainLibs/src/Utils")
25
+ const { DEFAULT_HANDLER_PER_ACTION, SOURCE_PATH, FUNCTION_NAME } = require("../../../libs/Consts");
26
+
27
+ const templatePath = path.join(__dirname, "./template.ejs")
28
+
29
+ /**
30
+ * receive objectSchema
31
+ * create data for hdrInv template
32
+ *
33
+ * @return {{ templatePath, templateData, setting } }
34
+ */
35
+ function data(_izContext, srcPath) {
36
+ const createSourceParams = createParamForCreateSource(srcPath)
37
+ return [createSourceParams];
38
+ }
39
+
40
+ function createParamForCreateSource(srcPath) {
41
+ const functionName = FUNCTION_NAME.updateNodeComplete;
42
+
43
+ return {
44
+ templatePath: templatePath,
45
+ templateData: {
46
+ functionName,
47
+ queueName: upperCase(functionName),
48
+ functionName
49
+ },
50
+ setting: {
51
+ savePath: path.join(srcPath, SOURCE_PATH.lambdaPerAction),
52
+ saveFileName: `${upperCase(functionName)}_${upperCase(HANDLER.hdrSqs)}`,
53
+ fileExtension: ".js",
54
+ isAppend: false
55
+ }
56
+ }
57
+ }
58
+
59
+ module.exports = data
@@ -0,0 +1,129 @@
1
+ /*
2
+ Copyright (C) 2020 Sven Mason <http://izara.io>
3
+
4
+ This program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU Affero General Public License as
6
+ published by the Free Software Foundation, either version 3 of the
7
+ License, or (at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU Affero General Public License for more details.
13
+
14
+ You should have received a copy of the GNU Affero General Public License
15
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ 'use strict';
19
+
20
+ // const AWS = require('aws-sdk');
21
+ // const sqs = new AWS.SQS({ apiVersion: '2012-11-05' });
22
+
23
+ const izara = require("@izara_project/izara-middleware");
24
+ const middleware = izara.middlewareHandler;
25
+ const izaraShared = require('@izara_project/izara-shared');
26
+ const recordHandlerSharedLib = izaraShared.recordHandlerSharedLib
27
+ const callingFlowSharedLib = izaraShared.callingFlowSharedLib;
28
+
29
+ const <%- functionName %> = require('./<%- firstLetterUpperCase(functionName) %>_Main');
30
+ const Logger = require('@izara_project/izara-core-library-logger');
31
+ // validate event properties in body.Message of sqs event
32
+ middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
33
+ // set schema for record.body.Message
34
+ let perRecordsValidatorSchema = {
35
+ type: "object",
36
+ required: [
37
+ 'returnValue',
38
+ 'status',
39
+ 'errorFounds'
40
+ ],
41
+ properties: {
42
+ returnValue: {
43
+ type: 'object',
44
+ },
45
+ status: {
46
+ type: 'string',
47
+ },
48
+ errorFounds: {
49
+ type: 'array',
50
+ default: []
51
+ }
52
+ }
53
+ };
54
+
55
+ // set schema for record.body.MessageAttributes
56
+ // const messageAttributeValidatorSchema = {
57
+ // type: "object",
58
+ // required: ['msgAtrrParam1', 'msgAtrrParam2'],
59
+ // properties: {
60
+ // msgAtrrParam1: {
61
+ // type: "string"
62
+ // },
63
+ // msgAtrrParam2: {
64
+ // type: "object"
65
+ // }
66
+ // }
67
+ // };
68
+
69
+ perRecordsValidatorSchema = callingFlowSharedLib.addOptionalPassBackPropertiesToValidatorSchema(perRecordsValidatorSchema); // is Ok passBackProperties
70
+ module.exports.main = middleware.wrap(async (event, context, callback) => {
71
+
72
+ try {
73
+
74
+ let recordPromises = [];
75
+
76
+ // loop each record and send to mainFunction
77
+ await Promise.all(event.Records.map(async record => { // promise.all for map() function
78
+
79
+ let passOnProperties = []
80
+ record._izContext.logger.debug('record ReceiveMsgOutHdrSqs', record);
81
+
82
+ //validate message (and MessageAttributes)
83
+ await recordHandlerSharedLib.validateRecord(
84
+ record, // one record will send to mainFunction
85
+ "<%- firstLetterUpperCase(queueName) %>", // queue name that need to retry or send to dlq
86
+ perRecordsValidatorSchema, // schema for record.Message
87
+ // messageAttributeValidatorSchema // ----- for msgAttr default is null -> do not send this parameter if not want to validate msgAtt
88
+ );
89
+
90
+ // add argument (to invoke lambda) to passOnProperties[]
91
+ passOnProperties.push(record.body.Message.returnValue)
92
+ passOnProperties.push(record.body.Message.status)
93
+ passOnProperties.push(record.body.Message.errorFounds)
94
+ passOnProperties.push(callingFlowSharedLib.addPassBackPropertiesToPassOnProperties(record.body.Message)) // is Ok PassBackProperties
95
+ // passOnProperties.push(callingFlowSharedLib.addCallingFlowToPassOnProperties(record.body.Message)) // is Ok callinfFlow
96
+ record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
97
+
98
+ // call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
99
+ let recordPromise = recordHandlerSharedLib.recordHandler(
100
+ record, // one record will send to mainFunction
101
+ <%- functionName %>.<%- functionName %>, // mainFunction that need to invoke.
102
+ "<%- firstLetterUpperCase(queueName) %>", // queue name that need to retry or send to dlq
103
+ passOnProperties, // all parameters that mainFunction needed.
104
+ );
105
+ record._izContext.logger.debug('after recordPromise in handler');
106
+ recordPromises.push(recordPromise); // push promise to recordPromises
107
+ }))
108
+
109
+ Logger.debug('before Promise.all(recordPromises) in handler');
110
+ try {
111
+ // --- main await all promises
112
+ await Promise.all(recordPromises); // await all promises
113
+
114
+ return event.Records // return all for local testing
115
+
116
+ } catch {
117
+ Logger.debug('Promise.all(recordPromises) in handler threw error (at least one record did no resolve)');
118
+ }
119
+ Logger.debug('after Promise.all(recordPromises) in handler');
120
+
121
+ } catch (err) {
122
+ Logger.error('Unhandled Error, updateNodeCompleteHdrSqs: ', err);
123
+ throw (err);
124
+ }
125
+ });
126
+
127
+ <%_ function firstLetterUpperCase(text){
128
+ return text.charAt(0).toUpperCase()+ text.slice(1)
129
+ } _%>
@@ -0,0 +1,53 @@
1
+ /*
2
+ Copyright (C) 2020 Sven Mason <http://izara.io>
3
+
4
+ This program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU Affero General Public License as
6
+ published by the Free Software Foundation, either version 3 of the
7
+ License, or (at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU Affero General Public License for more details.
13
+
14
+ You should have received a copy of the GNU Affero General Public License
15
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ 'use strict';
19
+ const path = require('path');
20
+ const fs = require('fs');
21
+
22
+ const { ACTIONS, HANDLER } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
23
+
24
+ const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase, firstLetterUpperCase } = require("../../../../../MainLibs/src/Utils")
25
+ const { DEFAULT_HANDLER_PER_ACTION, SOURCE_PATH, FUNCTION_NAME, SAVE_FILE_NAME } = require("../../../libs/Consts");
26
+
27
+ const templatePath = path.join(__dirname, "./template.ejs")
28
+
29
+ /**
30
+ * receive objectSchema
31
+ * create data for hdrInv template
32
+ *
33
+ * @return {{ templatePath, templateData, setting } }
34
+ */
35
+
36
+ function data(_izContext, srcPath) {
37
+ return [createMainFunctionUpdateComplete(_izContext, srcPath)]
38
+ }
39
+
40
+ function createMainFunctionUpdateComplete(_izContext, srcPath) {
41
+ return {
42
+ templatePath: templatePath,
43
+ templateData: {},
44
+ setting: {
45
+ savePath: path.join(srcPath, SOURCE_PATH.lambdaPerAction),
46
+ saveFileName: `${upperCase(FUNCTION_NAME.updateNodeComplete)}_Main`,
47
+ fileExtension: ".js",
48
+ isAppend: false
49
+ }
50
+ }
51
+ }
52
+
53
+ module.exports = data
@@ -0,0 +1,126 @@
1
+ /*
2
+ Copyright (C) 2020 Sven Mason <http://izara.io>
3
+
4
+ This program is free software: you can redistribute it and/or modify
5
+ it under the terms of the GNU Affero General Public License as
6
+ published by the Free Software Foundation, either version 3 of the
7
+ License, or (at your option) any later version.
8
+
9
+ This program is distributed in the hope that it will be useful,
10
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ GNU Affero General Public License for more details.
13
+
14
+ You should have received a copy of the GNU Affero General Public License
15
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ 'use strict';
19
+ const hash = require("object-hash");
20
+
21
+ const izaraShared = require('@izara_project/izara-shared');
22
+ const callingFlowSharedLib = izaraShared.callingFlowSharedLib;
23
+ const configSharedLib = izaraShared.configSharedLib;
24
+ const snsSharedLib = izaraShared.snsSharedLib;
25
+ const asyncFlowSharedLib = izaraShared.asyncFlowSharedLib;
26
+ const dynamodbSharedLib = izaraShared.dynamodbSharedLib;
27
+
28
+ const sns = require("@izara_project/izara-core-library-external-request").sns;
29
+ const NoRetryError = require("@izara_project/izara-core-library-core/src/NoRetryError");
30
+
31
+ const { explodedObjectTypeId, explodedRelationshipTypeId, createLinkTypeId } = require('@izara_project/izara-core-library-service-schemas/src/Utils');
32
+
33
+ const {
34
+ TOPIC_NAME_GENERATE_CODE,
35
+ TOPIC_NAME_GRAPH_HANDLER,
36
+ PREFIX
37
+ } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
38
+
39
+ module.exports.updateNodeComplete = async (
40
+ _izContext,
41
+ returnValue,
42
+ status,
43
+ errorsFound,
44
+ passBackProperties = {}
45
+ ) => {
46
+ try {
47
+ _izContext.logger.debug("Function:updateNodeComplete", {
48
+ _izContext: _izContext,
49
+ returnValue: returnValue,
50
+ status: status,
51
+ errorsFound: errorsFound,
52
+ passBackProperties: passBackProperties
53
+ });
54
+
55
+ // start create AwaitingStepId
56
+ let awaitingStepId = asyncFlowSharedLib.createAwaitingStepId(
57
+ hash({
58
+ objectType: returnValue.objType.objectType,
59
+ serviceTag: returnValue.objType.serviceTag,
60
+ identifiers: returnValue.objInstance.identifiers,
61
+ fields: returnValue.objInstance.fields
62
+ }),
63
+ PREFIX.updateNode
64
+ )
65
+
66
+ let updateNodePendingObjects = await dynamodbSharedLib.query(
67
+ _izContext,
68
+ await dynamodbSharedLib.tableName(_izContext, "AwaitingMultipleSteps"),
69
+ {
70
+ awaitingStepId: awaitingStepId
71
+ }
72
+ );
73
+ _izContext.logger.debug("updateNodePendingObjects", updateNodePendingObjects);
74
+
75
+ await Promise.all(
76
+ updateNodePendingObjects.Items.map(async ({ pendingStepId }) => {
77
+ if (await asyncFlowSharedLib.checkAllAwaitingStepsFinished(
78
+ _izContext,
79
+ pendingStepId,
80
+ awaitingStepId
81
+ )) {
82
+ _izContext.logger.debug("finished all awaitingStep");
83
+
84
+ let updateCompleteMsg = {
85
+ objType: {
86
+ objectType: returnValue.objType.objectType,
87
+ serviceTag: returnValue.objType.serviceTag
88
+ },
89
+ objInstance: {
90
+ identifiers: returnValue.objInstance.identifiers,
91
+ fields: returnValue.objInstance.fields
92
+ },
93
+ status: status,
94
+ errorsFound: errorsFound
95
+ };
96
+
97
+ updateCompleteMsg = callingFlowSharedLib.addParentPassBackPropertiesToSnsResponseMessageObject(passBackProperties, updateCompleteMsg);
98
+ _izContext.logger.debug("after addCallingFlow to SnsResponseMessageObject", updateCompleteMsg);
99
+
100
+ let messageAttributes = callingFlowSharedLib.addParentPassBackCallingFlowToSnsResponseMessageAttributes(passBackProperties, {});
101
+ _izContext.logger.debug("after addCallingFlow to SnsResponseMessageAttributes", updateCompleteMsg);
102
+
103
+ let sendMessageToOutUpdateNodeComplete = {
104
+ Message: JSON.stringify(updateCompleteMsg),
105
+ MessageAttributes: sns.createStringMessageAttributes(_izContext, messageAttributes),
106
+ TopicArn: await snsSharedLib.snsTopicArn(_izContext, TOPIC_NAME_GENERATE_CODE.outUpdateNodeComplete)
107
+ };
108
+ _izContext.logger.debug("Send Message to OutUpdateNodeComplete::", sendMessageToOutUpdateNodeComplete);
109
+ await sns.publishAsync(_izContext, sendMessageToOutUpdateNodeComplete)
110
+
111
+ await asyncFlowSharedLib.removeAwaitingMultipleStep(
112
+ _izContext,
113
+ awaitingStepId,
114
+ pendingStepId
115
+ );
116
+ }
117
+ })
118
+ )
119
+
120
+ return { returnValue: 'Function:UpdateNodeComplete' };
121
+
122
+ } catch (err) {
123
+ _izContext.logger.error("error UpdateNodeComplete : ", err)
124
+ throw (err)
125
+ }
126
+ }