@izara_project/izara-market-library-service-schemas 1.0.7 → 1.0.9

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 (221) hide show
  1. package/package.json +2 -2
  2. package/src/GenerateCodeLibs/src/Consts.js +27 -12
  3. package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +41 -50
  4. package/src/MainLibs/src/Utils.js +13 -0
  5. package/src/TemplateManager/src/FindData/FindDataYaml/data.js +3 -2
  6. package/src/TemplateManager/src/FindData/FindDataYaml/template.ejs +1 -1
  7. package/src/TemplateManager/src/FindData/Handler/data.js +1 -2
  8. package/src/TemplateManager/src/FindData/mainFunction/data.js +1 -1
  9. package/src/TemplateManager/src/GenerateCode.js +120 -47
  10. package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/functionYaml/data.js +3 -16
  11. package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/handler/data.js +4 -2
  12. package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/handler/template.ejs +11 -10
  13. package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/mainFunction/data.js +1 -1
  14. package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/mainFunction/template.ejs +9 -14
  15. package/src/TemplateManager/src/OutPerActionComplete/OutDeleteComplete/functionYaml/data.js +82 -0
  16. package/src/TemplateManager/src/OutPerActionComplete/OutDeleteComplete/handler/data.js +61 -0
  17. package/src/TemplateManager/src/OutPerActionComplete/OutDeleteComplete/handler/template.ejs +129 -0
  18. package/src/TemplateManager/src/{CreateRelationship/createRelationship → OutPerActionComplete/OutDeleteComplete}/mainFunction/data.js +9 -15
  19. package/src/TemplateManager/src/OutPerActionComplete/OutDeleteComplete/mainFunction/template.ejs +90 -0
  20. package/src/TemplateManager/src/OutPerActionComplete/OutDeleteComplete/sns-out/data.js +62 -0
  21. package/src/TemplateManager/src/OutPerActionComplete/OutDeleteComplete/sqs-in-sns/data.js +58 -0
  22. package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/functionYaml/data.js +3 -17
  23. package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/handler/data.js +4 -2
  24. package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/mainFunction/data.js +1 -1
  25. package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/mainFunction/template.ejs +4 -4
  26. package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrApi/data.js +41 -46
  27. package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrApi/template.ejs +1 -1
  28. package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrDsq/data.js +31 -43
  29. package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrDsq/template.ejs +1 -1
  30. package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrInv/data.js +22 -67
  31. package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrInv/template.ejs +1 -1
  32. package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrSqs/data.js +31 -43
  33. package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrSqs/template.ejs +1 -1
  34. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrApi/data.js +6 -7
  35. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrApi/template.ejs +2 -2
  36. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrDsq/data.js +8 -42
  37. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrDsq/template.ejs +80 -65
  38. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/data.js +12 -65
  39. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/template.ejs +3 -4
  40. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrSqs/data.js +11 -45
  41. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrSqs/template.ejs +64 -59
  42. package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Create/data.js +1 -2
  43. package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Create/template.ejs +141 -183
  44. package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Delete/data.js +66 -0
  45. package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Delete/template.ejs +194 -0
  46. package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Get/data.js +1 -2
  47. package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Update/template.ejs +2 -3
  48. package/src/TemplateManager/src/ProcessLogical/Handler/data.js +2 -1
  49. package/src/TemplateManager/src/ProcessLogical/ProcessLogicalYaml/data.js +49 -80
  50. package/src/TemplateManager/src/ProcessLogical/ProcessLogicalYaml/template.ejs +1 -1
  51. package/src/TemplateManager/src/ProcessLogical/mainFunction/template.ejs +1 -1
  52. package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrDsq/data.js +42 -72
  53. package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrDsq/template.ejs +1 -1
  54. package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrSqs/data.js +44 -74
  55. package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrSqs/template.ejs +1 -1
  56. package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrApi/data.js +85 -0
  57. package/src/TemplateManager/src/{UpdateRelationshipSchema/updateRelationship → RelationshipPerAction/CreateRelationship/createRelationship}/functionYaml/HdrApi/template.ejs +3 -3
  58. package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationship/functionYaml/HdrDsq/data.js +6 -42
  59. package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrDsq/template.ejs +30 -0
  60. package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationship/functionYaml/HdrInv/data.js +6 -42
  61. package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrInv/template.ejs +26 -0
  62. package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationship/functionYaml/HdrSqs/data.js +6 -42
  63. package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrSqs/template.ejs +26 -0
  64. package/src/TemplateManager/src/{UpdateRelationshipSchema/updateRelationship/perAction/HdrApi → RelationshipPerAction/CreateRelationship/createRelationship/mainFunction}/data.js +4 -5
  65. package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationship/mainFunction/template.ejs +2 -2
  66. package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationship/perAction/HdrApi/data.js +3 -3
  67. package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationship/perAction/HdrDsq/data.js +3 -3
  68. package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationship/perAction/HdrInv/data.js +3 -3
  69. package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationship/perAction/HdrSqs/data.js +3 -3
  70. package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationship/sns-in-sqs/data.js +4 -4
  71. package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/sns-in-sqs/snsTemplate.ejs +59 -0
  72. package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/sns-in-sqs/sqsTemplate.ejs +43 -0
  73. package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationshipComplete/functionYaml/data.js +10 -47
  74. package/src/TemplateManager/src/{UpdateRelationshipSchema/updateRalationshipComplete → RelationshipPerAction/CreateRelationship/createRelationshipComplete}/functionYaml/template.ejs +1 -1
  75. package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationshipComplete/handler/HdrSqs/data.js +2 -2
  76. package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationshipComplete/mainFunction/data.js +2 -2
  77. package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationshipComplete/sns-in-sqs/data.js +2 -2
  78. package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationshipComplete/sns-in-sqs/template.ejs +47 -0
  79. package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationshipComplete/sns-out/data.js +3 -3
  80. package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationshipComplete/sns-out/template.ejs +10 -0
  81. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrApi/data.js +86 -0
  82. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrApi/template.ejs +33 -0
  83. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrDsq/data.js +97 -0
  84. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrDsq/template.ejs +30 -0
  85. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrInv/data.js +84 -0
  86. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrInv/template.ejs +26 -0
  87. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrSqs/data.js +97 -0
  88. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrSqs/template.ejs +26 -0
  89. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/mainFunction/data.js +58 -0
  90. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/mainFunction/template.ejs +329 -0
  91. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/perAction/HdrApi/data.js +58 -0
  92. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/perAction/HdrApi/template.ejs +119 -0
  93. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/perAction/HdrDsq/data.js +59 -0
  94. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/perAction/HdrDsq/template.ejs +167 -0
  95. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/perAction/HdrInv/data.js +60 -0
  96. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/perAction/HdrInv/template.ejs +107 -0
  97. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/perAction/HdrSqs/data.js +60 -0
  98. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/perAction/HdrSqs/template.ejs +146 -0
  99. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/perAction/request.json +30 -0
  100. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/sns-in-sqs/data.js +78 -0
  101. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/sns-in-sqs/snsTemplate.ejs +59 -0
  102. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/sns-in-sqs/sqsTemplate.ejs +43 -0
  103. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/functionYaml/data.js +96 -0
  104. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/functionYaml/template.ejs +33 -0
  105. package/src/TemplateManager/src/{UpdateRelationshipSchema/updateRelationship/perAction → RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/handler}/HdrSqs/data.js +7 -5
  106. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/handler/HdrSqs/request.json +0 -0
  107. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/handler/HdrSqs/template.ejs +125 -0
  108. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/mainFunction/data.js +56 -0
  109. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/mainFunction/request.json +0 -0
  110. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/mainFunction/template.ejs +137 -0
  111. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/sns-in-sqs/data.js +72 -0
  112. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/sns-in-sqs/request.json +0 -0
  113. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/sns-in-sqs/template.ejs +47 -0
  114. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/sns-out/data.js +72 -0
  115. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/sns-out/request.json +0 -0
  116. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/sns-out/template.ejs +10 -0
  117. package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRalationshipComplete/functionYaml/data.js +6 -45
  118. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRalationshipComplete/functionYaml/template.ejs +33 -0
  119. package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRalationshipComplete/handler/HdrSqs/data.js +3 -3
  120. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRalationshipComplete/handler/HdrSqs/request.json +0 -0
  121. package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRalationshipComplete/mainFunction/data.js +2 -2
  122. package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRalationshipComplete/sns-in-sqs/data.js +2 -2
  123. package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRalationshipComplete/sns-out/data.js +3 -3
  124. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRalationshipComplete/sns-out/template.ejs +10 -0
  125. package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRelationship/functionYaml/HdrApi/data.js +6 -42
  126. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrApi/request.json +0 -0
  127. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrApi/template.ejs +33 -0
  128. package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRelationship/functionYaml/HdrDsq/data.js +6 -42
  129. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrDsq/request.json +0 -0
  130. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrDsq/template.ejs +30 -0
  131. package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRelationship/functionYaml/HdrInv/data.js +7 -42
  132. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrInv/request.json +0 -0
  133. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrInv/template.ejs +26 -0
  134. package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRelationship/functionYaml/HdrSqs/data.js +7 -43
  135. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrSqs/request.json +0 -0
  136. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrSqs/template.ejs +26 -0
  137. package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRelationship/mainFunction/data.js +3 -4
  138. package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRelationship/mainFunction/template.ejs +14 -15
  139. package/src/TemplateManager/src/{UpdateRelationshipSchema/updateRelationship/perAction/HdrInv → RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/perAction/HdrApi}/data.js +3 -6
  140. package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRelationship/perAction/HdrDsq/data.js +3 -3
  141. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/perAction/HdrInv/data.js +62 -0
  142. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/perAction/HdrSqs/data.js +59 -0
  143. package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRelationship/sns-in-sqs/data.js +4 -4
  144. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/sns-in-sqs/snsTemplate.ejs +59 -0
  145. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/sns-in-sqs/sqsTemplate.ejs +43 -0
  146. package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRelationship/sns-out/data.js +2 -2
  147. package/src/TemplateManager/src/ResourceYaml/dynamodb/mainResourcePerObjectSchemaData.js +30 -3
  148. package/src/TemplateManager/src/ResourceYaml/dynamodb/template.ejs +1 -1
  149. package/src/TemplateManager/src/ResourceYaml/sns-in-sqs/defaultSnsInSqsForFindDataAndProcessLogical.js +6 -6
  150. package/src/TemplateManager/src/ResourceYaml/sns-out/defaultSnsOutForFindDataAndProcessLogical.js +2 -2
  151. package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/functionYaml/data.js +5 -6
  152. package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/functionYaml/template.ejs +1 -1
  153. package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/handler/dataHdrDsq.js +1 -1
  154. package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/handler/template.ejs +3 -5
  155. package/src/TemplateManager/src/TranslateIdReq/ProcessingTranslateIds/mainFunction/template.ejs +42 -39
  156. package/src/TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrDsq/data.js +6 -31
  157. package/src/TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrDsq/template.ejs +30 -0
  158. package/src/TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrSqs/data.js +6 -31
  159. package/src/TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrSqs/template.ejs +30 -0
  160. package/src/TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrDsq/data.js +2 -2
  161. package/src/TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrDsq/template.ejs +3 -5
  162. package/src/TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrSqs/data.js +1 -1
  163. package/src/TemplateManager/src/TranslateIdReq/TranslateIds/handler/HdrSqs/template.ejs +22 -34
  164. package/src/TemplateManager/src/TranslateIdReq/TranslateIds/mainFunction/template.ejs +5 -5
  165. package/src/TemplateManager/src/externalService/FunctionNameConfig/data.js +50 -0
  166. package/src/TemplateManager/src/externalService/FunctionNameConfig/template.ejs +14 -0
  167. package/src/TemplateManager/src/externalService/LambdaRole/data.js +94 -53
  168. package/src/TemplateManager/src/externalService/SnsTopicSubscriotions/data.js +13 -0
  169. package/src/TemplateManager/src/externalService/SnsTopicSubscriotions/template.ejs +19 -0
  170. package/src/TemplateManager/src/libs/Consts.js +41 -15
  171. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrApi/getTemplate.ejs +0 -76
  172. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrApi/updateTemplate.ejs +0 -67
  173. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrDsq/getTemplate.ejs +0 -105
  174. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrDsq/updateTemplate.ejs +0 -109
  175. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/createTemplate.ejs +0 -75
  176. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/getTemplate.ejs +0 -82
  177. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrInv/updateTemplate.ejs +0 -75
  178. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrSqs/getTemplate.ejs +0 -124
  179. package/src/TemplateManager/src/PerActionEndpoint/Handler/HdrSqs/updateTemplate.ejs +0 -133
  180. /package/src/TemplateManager/src/{CreateRelationship/createRelationshipComplete → OutPerActionComplete/OutDeleteComplete}/functionYaml/template.ejs +0 -0
  181. /package/src/TemplateManager/src/{CreateRelationship/createRelationshipComplete/sns-in-sqs → OutPerActionComplete/OutDeleteComplete/sqs-in-sns}/template.ejs +0 -0
  182. /package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationship/perAction/HdrApi/request.json +0 -0
  183. /package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationship/perAction/HdrApi/template.ejs +0 -0
  184. /package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationship/perAction/HdrDsq/request.json +0 -0
  185. /package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationship/perAction/HdrDsq/template.ejs +0 -0
  186. /package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationship/perAction/HdrInv/request.json +0 -0
  187. /package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationship/perAction/HdrInv/template.ejs +0 -0
  188. /package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationship/perAction/HdrSqs/request.json +0 -0
  189. /package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationship/perAction/HdrSqs/template.ejs +0 -0
  190. /package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationship/perAction/request.json +0 -0
  191. /package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationshipComplete/functionYaml/request.json +0 -0
  192. /package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationshipComplete/handler/HdrSqs/request.json +0 -0
  193. /package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationshipComplete/handler/HdrSqs/template.ejs +0 -0
  194. /package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationshipComplete/mainFunction/request.json +0 -0
  195. /package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationshipComplete/mainFunction/template.ejs +0 -0
  196. /package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationshipComplete/sns-in-sqs/request.json +0 -0
  197. /package/src/TemplateManager/src/{CreateRelationship → RelationshipPerAction/CreateRelationship}/createRelationshipComplete/sns-out/request.json +0 -0
  198. /package/src/TemplateManager/src/{UpdateRelationshipSchema/updateRalationshipComplete/handler/HdrSqs → RelationshipPerAction/DeleteRelationship/DeleteRelationship/perAction/HdrApi}/request.json +0 -0
  199. /package/src/TemplateManager/src/{UpdateRelationshipSchema/updateRelationship/functionYaml/HdrApi → RelationshipPerAction/DeleteRelationship/DeleteRelationship/perAction/HdrDsq}/request.json +0 -0
  200. /package/src/TemplateManager/src/{UpdateRelationshipSchema/updateRelationship/functionYaml/HdrDsq → RelationshipPerAction/DeleteRelationship/DeleteRelationship/perAction/HdrInv}/request.json +0 -0
  201. /package/src/TemplateManager/src/{UpdateRelationshipSchema/updateRelationship/functionYaml/HdrInv → RelationshipPerAction/DeleteRelationship/DeleteRelationship/perAction/HdrSqs}/request.json +0 -0
  202. /package/src/TemplateManager/src/{UpdateRelationshipSchema/updateRelationship/functionYaml/HdrSqs → RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/functionYaml}/request.json +0 -0
  203. /package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRalationshipComplete/functionYaml/request.json +0 -0
  204. /package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRalationshipComplete/handler/HdrSqs/template.ejs +0 -0
  205. /package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRalationshipComplete/mainFunction/request.json +0 -0
  206. /package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRalationshipComplete/mainFunction/template.ejs +0 -0
  207. /package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRalationshipComplete/sns-in-sqs/request.json +0 -0
  208. /package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRalationshipComplete/sns-in-sqs/template.ejs +0 -0
  209. /package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRalationshipComplete/sns-out/request.json +0 -0
  210. /package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRelationship/mainFunction/request.json +0 -0
  211. /package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRelationship/perAction/HdrApi/request.json +0 -0
  212. /package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRelationship/perAction/HdrApi/template.ejs +0 -0
  213. /package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRelationship/perAction/HdrDsq/request.json +0 -0
  214. /package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRelationship/perAction/HdrDsq/template.ejs +0 -0
  215. /package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRelationship/perAction/HdrInv/request.json +0 -0
  216. /package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRelationship/perAction/HdrInv/template.ejs +0 -0
  217. /package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRelationship/perAction/HdrSqs/request.json +0 -0
  218. /package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRelationship/perAction/HdrSqs/template.ejs +0 -0
  219. /package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRelationship/perAction/request.json +0 -0
  220. /package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRelationship/sns-in-sqs/request.json +0 -0
  221. /package/src/TemplateManager/src/{UpdateRelationshipSchema → RelationshipPerAction/UpdateRelationshipSchema}/updateRelationship/sns-out/request.json +0 -0
@@ -0,0 +1,84 @@
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
+
24
+ const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../../MainLibs/src/Utils")
25
+ const { createIamRole, resourceNames, RESOURCE_CLASSES, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, SNS_RESOURCE, defaultIamRolePerAction, awaitingMultipleStepsRole } = require("../../../../../libs/Consts");
26
+
27
+ const templatePath = path.join(__dirname, './template.ejs')
28
+
29
+ /**
30
+ * receive objectSchema
31
+ * create data for updateRelationshipSchema
32
+ *
33
+ * @param {Object} objectSchema
34
+ * @return {{ templatePath, templateData, setting } }
35
+ */
36
+
37
+ function data(_izContext, srcPath) {
38
+ let createSourceArray = [];
39
+
40
+ const createSourceParam = createParamForCreateSource(srcPath);
41
+ createSourceArray.push(createSourceParam);
42
+ // console.log("createSourceArrayInUpdaterelationShipSchemahdrSqs", createSourceArray)
43
+ return createSourceArray
44
+ }
45
+
46
+
47
+ function createParamForCreateSource(srcPath) {
48
+
49
+ let handlerType = HANDLER.hdrInv
50
+ let functionName = FUNCTION_NAME.deleteRel
51
+ let additionalResourcePermission = defaultIamRolePerAction();
52
+
53
+ additionalResourcePermission.push(awaitingMultipleStepsRole())
54
+
55
+ additionalResourcePermission.push(
56
+ createIamRole({
57
+ [RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
58
+ },
59
+ [
60
+ resourceNames(RESOURCE_CLASSES.sns, "Out" + upperCase(FUNCTION_NAME.deleteRelComplete))
61
+ ]
62
+ )
63
+ )
64
+ return {
65
+ templatePath: templatePath,
66
+ templateData: {
67
+ functionName,
68
+ handlerType,
69
+ additionalResourcePermission,
70
+ resourceLocation: SOURCE_PATH.resourceLocationRelationshipPerAction,
71
+ functionNameConfig: upperCase(functionName) + upperCase(handlerType)
72
+ },
73
+ setting: {
74
+ savePath: path.join(srcPath, SOURCE_PATH.appYaml),
75
+ saveFileName: SAVE_FILE_NAME.functionRelationshipYaml,
76
+ fileExtension: '.yml',
77
+ isAppend: true
78
+ }
79
+
80
+ }
81
+ }
82
+
83
+
84
+ module.exports = data;
@@ -0,0 +1,26 @@
1
+ <%_ const join = require('path').join; _%>
2
+ <%- firstLetterUpperCase(functionNameConfig) %>:
3
+ handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`)%>
4
+ name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
5
+ iamRoleStatements:
6
+ <%_ additionalResourcePermission.forEach(resourcePermission => { _%>
7
+ - Effect: <%- resourcePermission.effect %>
8
+ Action:
9
+ <%_ Object.keys(resourcePermission.action).forEach(resourcePerAction => { _%>
10
+ <%_ resourcePermission.action[resourcePerAction].forEach(permission => { _%>
11
+ - <%- resourcePerAction %>:<%- permission %>
12
+ <%_}) _%>
13
+ <%_ }) _%>
14
+ Resource:
15
+ <%_ resourcePermission.resource.forEach(resource => { _%>
16
+ - <%- resource %>
17
+ <%_ }) _%>
18
+ <%_}) _%>
19
+ #<#<%- functionName %><%- handlerType %>IamRole#>
20
+ #<#/<%- functionName %><%- handlerType %>IamRole#>
21
+ <%_ function firstLetterUpperCase(text){
22
+ return text.charAt(0).toUpperCase() + text.slice(1)
23
+ } _%>
24
+ <%_ function firstLetterLowerCase(str) {
25
+ return str.charAt(0).toLowerCase() + str.slice(1)
26
+ } _%>
@@ -0,0 +1,97 @@
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
+
24
+ const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../../MainLibs/src/Utils")
25
+ const { createIamRole, resourceNames, RESOURCE_CLASSES, SQS_RESOURCE, SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, SNS_RESOURCE, defaultIamRolePerAction, awaitingMultipleStepsRole, shortNameHandler } = require("../../../../../libs/Consts");
26
+
27
+ const templatePath = path.join(__dirname, './template.ejs')
28
+
29
+ /**
30
+ * receive objectSchema
31
+ * create data for updateRelationshipSchema
32
+ *
33
+ * @param {Object} objectSchema
34
+ * @return {{ templatePath, templateData, setting } }
35
+ */
36
+
37
+ function data(_izContext, srcPath) {
38
+ let createSourceArray = [];
39
+ const createSourceParam = createParamForCreateSource(srcPath);
40
+ createSourceArray.push(createSourceParam);
41
+ // console.log("createSourceArrayInUpdaterelationShipSchemahdrSqs", createSourceArray)
42
+ return createSourceArray
43
+ }
44
+
45
+
46
+ function createParamForCreateSource(srcPath) {
47
+
48
+ let handlerType = HANDLER.hdrSqs
49
+ let functionName = FUNCTION_NAME.deleteRel
50
+ let additionalResourcePermission = defaultIamRolePerAction();
51
+
52
+ additionalResourcePermission.push(
53
+ // createIamRole(
54
+ // { [RESOURCE_CLASSES.lambda]: ["InvokeFunction"] },
55
+ // [resourceNames(RESOURCE_CLASSES.lambda, "*GetNodeHdrInv")]),
56
+ createIamRole(
57
+ {
58
+ [RESOURCE_CLASSES.sqs]: [
59
+ SQS_RESOURCE.deleteMessage,
60
+ SQS_RESOURCE.getQueueAttributes,
61
+ SQS_RESOURCE.receiveMessage,
62
+ SQS_RESOURCE.sendMessage,
63
+ SQS_RESOURCE.getQueueUrl,
64
+ SQS_RESOURCE.deleteMessageBatch
65
+ ], [RESOURCE_CLASSES.sns]:
66
+ [SNS_RESOURCE.publish, SNS_RESOURCE.subscription]
67
+ },
68
+ [
69
+ resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
70
+ resourceNames(RESOURCE_CLASSES.sqs, upperCase(functionName) + upperCase(HANDLER.hdrSqs) + "DLQ"),
71
+ resourceNames(RESOURCE_CLASSES.sns, "In" + upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
72
+ resourceNames(RESOURCE_CLASSES.sns, "Out" + upperCase(functionName) + upperCase(HANDLER.hdrSqs)),
73
+ resourceNames(RESOURCE_CLASSES.sns, "Out" + upperCase(FUNCTION_NAME.deleteRelComplete))
74
+ ]
75
+ ),
76
+ )
77
+ additionalResourcePermission.push(awaitingMultipleStepsRole())
78
+ return {
79
+ templatePath: templatePath,
80
+ templateData: {
81
+ functionName,
82
+ handlerType,
83
+ additionalResourcePermission,
84
+ resourceLocation: SOURCE_PATH.resourceLocationRelationshipPerAction,
85
+ functionNameConfig: upperCase(functionName) + upperCase(shortNameHandler(handlerType))
86
+ },
87
+ setting: {
88
+ savePath: path.join(srcPath, SOURCE_PATH.appYaml),
89
+ saveFileName: SAVE_FILE_NAME.functionRelationshipYaml,
90
+ fileExtension: '.yml',
91
+ isAppend: true
92
+ }
93
+
94
+ }
95
+ }
96
+
97
+ module.exports = data;
@@ -0,0 +1,26 @@
1
+ <%_ const join = require('path').join; _%>
2
+ <%- firstLetterUpperCase(functionNameConfig) %>:
3
+ handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`)%>
4
+ name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
5
+ iamRoleStatements:
6
+ <%_ additionalResourcePermission.forEach(resourcePermission => { _%>
7
+ - Effect: <%- resourcePermission.effect %>
8
+ Action:
9
+ <%_ Object.keys(resourcePermission.action).forEach(resourcePerAction => { _%>
10
+ <%_ resourcePermission.action[resourcePerAction].forEach(permission => { _%>
11
+ - <%- resourcePerAction %>:<%- permission %>
12
+ <%_}) _%>
13
+ <%_ }) _%>
14
+ Resource:
15
+ <%_ resourcePermission.resource.forEach(resource => { _%>
16
+ - <%- resource %>
17
+ <%_ }) _%>
18
+ <%_}) _%>
19
+ #<#<%- functionName %><%- handlerType %>IamRole#>
20
+ #<#/<%- functionName %><%- handlerType %>IamRole#>
21
+ <%_ function firstLetterUpperCase(text){
22
+ return text.charAt(0).toUpperCase() + text.slice(1)
23
+ } _%>
24
+ <%_ function firstLetterLowerCase(str) {
25
+ return str.charAt(0).toLowerCase() + str.slice(1)
26
+ } _%>
@@ -0,0 +1,58 @@
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 { SOURCE_PATH, FUNCTION_NAME } = require("../../../../libs/Consts");
26
+
27
+
28
+ const templatePath = path.join(__dirname, "./template.ejs")
29
+
30
+ /**
31
+ * receive objectSchema
32
+ * create data for hdrInv template
33
+ *
34
+ * @param {Object} objectSchema
35
+ * @return {{ templatePath, templateData, setting } }
36
+ */
37
+ function data(_izContext, srcPath) {
38
+ const createSourceParams = createParamForCreateSource(srcPath)
39
+ return [createSourceParams];
40
+ }
41
+
42
+
43
+ function createParamForCreateSource(srcPath) {
44
+ return {
45
+ templatePath: templatePath,
46
+ templateData: {
47
+ },
48
+ setting: {
49
+ savePath: path.join(srcPath, SOURCE_PATH.relationshipPerAction),
50
+ saveFileName: `${upperCase(FUNCTION_NAME.deleteRel)}_Main`,
51
+ fileExtension: '.js',
52
+ isAppend: false
53
+ }
54
+ }
55
+ }
56
+
57
+
58
+ module.exports = data;
@@ -0,0 +1,329 @@
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 hash = require("object-hash");
21
+
22
+ const callingFlowSharedLib = require('@izara_project/izara-shared/src/CallingFlowSharedLib');
23
+ const lambdaSharedLib = require('@izara_project/izara-shared/src/LambdaSharedLib');
24
+
25
+ const snsSharedLib = require('@izara_project/izara-shared/src/SnsSharedLib');
26
+ const sns = require("@izara_project/izara-core-library-external-request/src/resources/Sns");
27
+
28
+ const asyncFlowSharedLib = require('@izara_project/izara-shared/src/AsyncFlowSharedLib');
29
+
30
+ // const NoRetryError = require('@izara_project/izara-core-library-core/src/NoRetryError');
31
+
32
+ const {
33
+ getRelationshipSchemaWithCache,
34
+ getObjSchemaS3WithHierarchy
35
+ } = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
36
+
37
+ const {
38
+ createLinkTypeId
39
+ } = require('@izara_project/izara-core-library-service-schemas/src/Utils');
40
+
41
+ const {
42
+ getGraphServiceTagWithCache
43
+ } = require('@izara_project/izara-core-library-service-schemas/src/ServiceConfig');
44
+
45
+ const consts = require('@izara_project/izara-core-library-service-schemas/src/Consts');
46
+ const {
47
+ PREFIX,
48
+ TOPIC_NAME_GENERATE_CODE,
49
+ TOPIC_NAME_GRAPH_HANDLER
50
+ } = require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
51
+
52
+ /**
53
+ * update relationship endpoint
54
+ *
55
+ * @param {Object} _izContext
56
+ * @param {CorrelationIds} _izContext.correlationIds - property of _izContext
57
+ * @param {Logger} _izContext.logger - property of _izContext
58
+ * @param {Object} requestParams - request params
59
+ * @param {Object} callingFlowConfig
60
+ *
61
+ * @returns {object} description of return value
62
+ */
63
+ module.exports.createRelationship = async (
64
+ _izContext,
65
+ requestParams,
66
+ callingFlowConfig = {},
67
+ //(<additionalParams>)
68
+ //(</additionalParams>)
69
+ ) => {
70
+
71
+
72
+ try {
73
+ _izContext.logger.debug('createRelationship _izContext: ', _izContext);
74
+ _izContext.logger.debug('createRelationship requestParams: ', requestParams);
75
+ _izContext.logger.debug('createRelationship callingFlowConfig: ', callingFlowConfig);
76
+
77
+
78
+ const {
79
+ objects,
80
+ relType,
81
+ relationshipProperties
82
+ //(<requestparamDeleteRel>)
83
+ //(</requestparamDeleteRel>)
84
+ } = requestParams;
85
+
86
+ let errorsFound = [];
87
+
88
+ //(<beforeValidateDeleteRel>)
89
+ //(</beforeValidateDeleteRel>)
90
+ // validate object and identifiers
91
+ async function validateIdentifiersExists(_izContext, objType, identifiersObject) {
92
+
93
+ const objTypeString = `objType:{ serviceTag:${objType.serviceTag}, objectType:${objType.objectType} }`;
94
+ const objectSchema = await getObjSchemaS3WithHierarchy(_izContext, objType);
95
+
96
+ if (!objectSchema) {
97
+ errorsFound.push(`validateIdentifiers, not found schema of ${objTypeString}`);
98
+ }
99
+
100
+ for (const schemaIdentifier of objectSchema.identifiers) {
101
+ let identifierNames = schemaIdentifier.fieldNames || [schemaIdentifier.fieldName];
102
+ for (const identifierName of identifierNames) {
103
+ if (!identifiersObject.hasOwnProperty(identifierName)) {
104
+ errorsFound.push(`validateIdentifiers, ${objTypeString} property:${identifierName} not exists`);
105
+ } else {
106
+ if (
107
+ typeof (identifiersObject[identifierName]) !== "string" &&
108
+ typeof (identifiersObject[identifierName]) !== "number"
109
+ ) {
110
+ errorsFound.push(`validateIdentifiers, ${objTypeString} property:${identifierName} should be string or number`);
111
+ }
112
+ }
113
+ }
114
+ }
115
+ }
116
+
117
+ await validateIdentifiersExists(_izContext, objects[0].objType, objects[0].identifiers);
118
+ await validateIdentifiersExists(_izContext, objects[1].objType, objects[1].identifiers);
119
+ // finished validate object and identifiers
120
+
121
+ //(<afterValidateDeleteRel>)
122
+ //(</afterValidateDeleteRel>)
123
+
124
+ //(<beforeDeleteRel>)
125
+ //(</beforeDeleteRel>)
126
+
127
+ const relationshipSchema = await getRelationshipSchemaWithCache(_izContext, relType);
128
+ _izContext.logger.debug("relationshipSchema: ", relationshipSchema);
129
+
130
+ let targetStorageResources = [];
131
+
132
+ if (relationshipSchema) {
133
+ // find targetStorageResources and validate each storageResources
134
+ await Promise.all(
135
+ relationshipSchema.links.map(async ({ from, to, storageResourceTags }) => {
136
+ const { serviceTag: fromServiceTag, objectType: fromObjectType } = from.objType
137
+ const { serviceTag: toServiceTag, objectType: toObjectType } = to.objType
138
+
139
+ const { serviceTag: firstServiceTag, objectType: firstObjectType } = objects[0].objType;
140
+ const { serviceTag: secondServiceTag, objectType: secondObjectType } = objects[1].objType;
141
+
142
+ // find exists link
143
+ if (
144
+ (
145
+ (firstServiceTag === fromServiceTag && firstObjectType === fromObjectType) &&
146
+ (secondServiceTag === toServiceTag && secondObjectType === toObjectType)
147
+ ) ||
148
+ (
149
+ (firstServiceTag === toServiceTag && firstObjectType === toObjectType) &&
150
+ (secondServiceTag === fromServiceTag && secondObjectType === fromObjectType)
151
+ )
152
+ ) {
153
+
154
+ // check founded storageResource of link and collect used storageResources
155
+ await Promise.all(storageResourceTags.map(async storageResourceTag => {
156
+ const usedStorageResource = relationshipSchema.storageResources[storageResourceTag];
157
+
158
+ if (usedStorageResource.storageType === consts.STORAGE_TYPES.graph) {
159
+ const graphServiceTag = await getGraphServiceTagWithCache(_izContext, usedStorageResource.graphServerTag);
160
+ if (!graphServiceTag) {
161
+ errorsFound.push(`storageResourceTag:${storageResourceTag} invalid, not found graph serviceTag from graphServerTag:${usedStorageResource.graphServerTag}`)
162
+ }
163
+
164
+ targetStorageResources.push({
165
+ ...usedStorageResource,
166
+ graphServiceTag: graphServiceTag
167
+ });
168
+ } else {
169
+ targetStorageResources.push(usedStorageResource);
170
+ }
171
+ }));
172
+ }
173
+ })
174
+ );
175
+ //(<afterDeleteRel>)
176
+ //(</afterDeleteRel>)
177
+ _izContext.logger.debug("targetStorageResources: ", targetStorageResources);
178
+
179
+ if (!targetStorageResources.length) {
180
+ errorsFound.push(`Not found link from relationship schema`);
181
+ }
182
+
183
+
184
+ // validate properties exists with schema
185
+ for (const propKey in relationshipProperties) {
186
+ if (!relationshipSchema.fieldNames.hasOwnProperty(propKey)) {
187
+ errorsFound.push(`property:${propKey} not exists in relationshipSchema`);
188
+ }
189
+ }
190
+
191
+ // validate canCreate properties relationship
192
+ for (const [propName, propSetting] of Object.entries(relationshipSchema.properties)) {
193
+ if (propSetting.requiredOnCreate === true) {
194
+ if (!relationshipProperties.hasOwnProperty(propName)) {
195
+ errorsFound.push(`Missing requiredOnCreate property:${propKey}`);
196
+ }
197
+ }
198
+
199
+ if (!propSetting.optionalOnCreate && !propSetting.requiredOnCreate && relationshipProperties.hasOwnProperty(propName)) {
200
+ errorsFound.push(`property:${propName} cannot create`);
201
+ }
202
+ }
203
+
204
+ } else {
205
+ errorsFound.push(`relationshipSchema not exists`);
206
+ }
207
+
208
+
209
+ // if found errors will stop processing
210
+ if (errorsFound.length) {
211
+
212
+ let deleteRelCompleteMsg = {
213
+ objects: objects,
214
+ relType: relType,
215
+ relationshipProperties: relationshipProperties,
216
+ //(<inDeleteRelCompleteMsg>)
217
+ //(</inDeleteRelCompleteMsg>)
218
+ status: 'error',
219
+ errorFounds: errorsFound
220
+ };
221
+
222
+ // if have callingFlow will send to message complete
223
+ if (callingFlowConfig[callingFlowSharedLib.consts.CALLINGFLOW_PROPERTYNAME]) {
224
+ _izContext.logger.debug("HAVE CallingFlow");
225
+
226
+ deleteRelCompleteMsg = callingFlowSharedLib.addPassBackPropertiesToSnsResponseMessageObject(callingFlowConfig, deleteRelCompleteMsg);
227
+ let messageAttributes = callingFlowSharedLib.addCallingFlowToSnsResponseMessageAttributes(callingFlowConfig, {});
228
+
229
+ let messageParams = {
230
+ Message: JSON.stringify(deleteRelCompleteMsg),
231
+ MessageAttributes: sns.createStringMessageAttributes(_izContext, messageAttributes),
232
+ TopicArn: await snsSharedLib.snsTopicArn(_izContext, TOPIC_NAME_GENERATE_CODE.outDeleteRelComplete),
233
+ };
234
+
235
+ _izContext.logger.debug("messageParams OutCreateRelationshipComplete ::::::: ", messageParams);
236
+ await sns.publishAsync(_izContext, messageParams);
237
+ }
238
+
239
+ return deleteRelCompleteMsg;
240
+ }
241
+
242
+
243
+ // before create awaitingStepId per graph storageResource
244
+ const linkTypeId = createLinkTypeId(_izContext, [objects[0].objType, objects[1].objType], relType);
245
+
246
+ let usedGraphServiceTag = []; // collect used graph serviceTag, use to check duplicate graph serviceTag across graph serverTag
247
+ let targetGraphStorageResources = []; // collect used graph storageResources, filtered duplicate graphServiceTag from graphServerTag out
248
+ let awaitingStepIds = [];
249
+
250
+ for (const targetStorageResource of targetStorageResources) {
251
+ if (targetStorageResource.storageType === consts.STORAGE_TYPES.graph &&
252
+ !usedGraphServiceTag.includes(targetStorageResource.graphServiceTag)
253
+ ) {
254
+ usedGraphServiceTag.push(targetStorageResource.graphServiceTag);
255
+ targetGraphStorageResources.push(targetStorageResource);
256
+
257
+ // awaitingStepId per graphServiceTag
258
+ awaitingStepIds.push(
259
+ asyncFlowSharedLib.createAwaitingStepId(
260
+ hash({ linkTypeId, relationshipProperties, graphServiceTag: targetStorageResource.graphServiceTag }), // hash id
261
+ PREFIX.deleteRel // prefix, use constant further
262
+ )
263
+ );
264
+ }
265
+ }
266
+
267
+ if (awaitingStepIds.length) {
268
+ // save awaiting
269
+ await asyncFlowSharedLib.createAwaitingMultipleSteps(
270
+ _izContext,
271
+ awaitingStepIds, // awaitingStepIds
272
+ asyncFlowSharedLib.createPendingStepId( // pendingStepId
273
+ hash({ linkTypeId, relationshipProperties, correlationId: _izContext.correlationIds.get("id") }), // hash id
274
+ PREFIX.deleteRel // prefix, use constant further
275
+ )
276
+ );
277
+
278
+ // prepare message body
279
+ let deleteRelMessageBody = {
280
+ objects: objects,
281
+ relType: relType,
282
+ relationshipProperties
283
+ //(<inDeleteRelMessageBody>)
284
+ //(</inDeleteRelMessageBody>)
285
+ }
286
+ _izContext.logger.debug('deleteRelMessageBody: ', deleteRelMessageBody);
287
+
288
+ await Promise.all(
289
+ targetGraphStorageResources.map(async (storageResource) => {
290
+ if (storageResource.storageType === consts.STORAGE_TYPES.graph) {
291
+
292
+ deleteRelMessageBody = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
293
+ deleteRelMessageBody,
294
+ callingFlowSharedLib.addParentCallingFlowConfig(
295
+ callingFlowConfig, // receive parent callingFlowConfig.
296
+ callingFlowSharedLib.createCallingFlowConfig( // callinfflow own service
297
+ await lambdaSharedLib.lambdaFunctionName(_izContext, TOPIC_NAME_GENERATE_CODE.deleteRelComplete), {}
298
+ )
299
+ )
300
+ );
301
+ _izContext.logger.debug("messageObject before send message:", deleteRelMessageBody)
302
+
303
+ let messageToInUpdateRelationship = {
304
+ Message: JSON.stringify(deleteRelMessageBody),
305
+ TopicArn: await snsSharedLib.snsTopicArn(_izContext, TOPIC_NAME_GRAPH_HANDLER.inDeleteRel, storageResource.graphServiceTag),
306
+ };
307
+ _izContext.logger.debug("RequestParams before send to sqs messageToInUpdateRelationship ::::::: ", messageToInUpdateRelationship);
308
+ await sns.publishAsync(_izContext, messageToInUpdateRelationship);
309
+ }
310
+ })
311
+ )
312
+
313
+ } else {
314
+ // if relationshipSchema stored in dynamoDB only will send message to outComplete
315
+ }
316
+
317
+ return {
318
+ objects,
319
+ relType,
320
+ relationshipProperties,
321
+ errorFounds: errorsFound
322
+ };
323
+
324
+
325
+ } catch (err) {
326
+ _izContext.logger.error('error deleteRelationship: ', err)
327
+ throw (err)
328
+ }
329
+ }
@@ -0,0 +1,58 @@
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 } = require("../../../../../../../MainLibs/src/Utils")
25
+ const { 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
+
41
+ function createParamForCreateSource(srcPath) {
42
+ let functionName = FUNCTION_NAME.deleteRel;
43
+ return {
44
+ templatePath: templatePath,
45
+ templateData: {
46
+ functionName,
47
+ },
48
+ setting: {
49
+ savePath: path.join(srcPath, SOURCE_PATH.relationshipPerAction),
50
+ saveFileName: upperCase(functionName) + "_" + upperCase(HANDLER.hdrApi),
51
+ fileExtension: '.js',
52
+ isAppend: false
53
+ }
54
+ }
55
+ }
56
+
57
+
58
+ module.exports = data;