@izara_project/izara-core-generate-service-code 1.0.2 → 1.0.3

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 (390) hide show
  1. package/package.json +3 -3
  2. package/src/GenerateCode.js +5 -4
  3. package/src/GenerateResources.js +4 -3
  4. package/src/GenerateSchema.js +5 -4
  5. package/src/GenerateTests.js +6 -7
  6. package/src/TemplateConfig.js +18 -18
  7. package/src/TemplateData/EndpointPerService/generateTemplateData.js +1 -1
  8. package/src/TemplateData/EndpointPerService/mainFunction/create/template.ejs +6 -17
  9. package/src/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +7 -12
  10. package/src/TemplateData/EndpointPerService/mainFunction/get/template.ejs +7 -10
  11. package/src/TemplateData/EndpointPerService/mainFunction/update/template.ejs +5 -17
  12. package/src/TemplateData/IntTest/generateResources/generateResources.js +4 -3
  13. package/src/TemplateData/IntTest/generateTests/events/data.js +3 -1
  14. package/src/TemplateData/IntTest/generateTests/generateTemplate.js +4 -2
  15. package/src/TemplateData/IntTest/generateTests/pathIntTest/data.js +2 -2
  16. package/src/TemplateData/IntTest/generateTests/tests/data.js +9 -8
  17. package/src/TemplateData/IntTest/libs/libs.js +4 -35
  18. package/src/TemplateData/IntTest/upload/uploadIntTest.js +4 -3
  19. package/src/TemplateData/externalService/lambdaRole/template.ejs +1 -3
  20. package/src/TemplateData/externalService/snsTopicSubscriptions/template.ejs +0 -2
  21. package/src/TemplateData/findData/findDataYaml/data.js +2 -1
  22. package/src/TemplateData/findData/mainFunction/data.js +1 -1
  23. package/src/TemplateData/flowSchema/CreateRecordComplete/functionYaml/data.js +9 -5
  24. package/src/TemplateData/flowSchema/CreateRecordComplete/handler/data.js +3 -3
  25. package/src/TemplateData/flowSchema/CreateRecordComplete/mainFunction/data.js +3 -3
  26. package/src/TemplateData/flowSchema/CreateRecordComplete/queue/data.js +3 -3
  27. package/src/TemplateData/flowSchema/components/upload/confirmReserved/functionYaml/data.js +11 -8
  28. package/src/TemplateData/flowSchema/components/upload/confirmReserved/handler/data.js +3 -3
  29. package/src/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/data.js +1 -1
  30. package/src/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/template.ejs +1 -1
  31. package/src/TemplateData/flowSchema/components/upload/confirmReserved/queue/data.js +3 -2
  32. package/src/TemplateData/flowSchema/components/upload/createObject/functionYaml/data.js +11 -7
  33. package/src/TemplateData/flowSchema/components/upload/createObject/handler/data.js +3 -3
  34. package/src/TemplateData/flowSchema/components/upload/createObject/mainFunction/data.js +4 -3
  35. package/src/TemplateData/flowSchema/components/upload/createObject/mainFunction/template.ejs +2 -2
  36. package/src/TemplateData/flowSchema/components/upload/createObjectComplete/functionYaml/data.js +9 -7
  37. package/src/TemplateData/flowSchema/components/upload/createObjectComplete/handler/data.js +3 -3
  38. package/src/TemplateData/flowSchema/components/upload/createObjectComplete/mainFunction/data.js +3 -3
  39. package/src/TemplateData/flowSchema/components/upload/createObjectComplete/sns-sqs/data.js +3 -3
  40. package/src/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/functionYaml/data.js +11 -7
  41. package/src/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/handler/data.js +3 -3
  42. package/src/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/data.js +3 -3
  43. package/src/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/template.ejs +2 -2
  44. package/src/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/queue/data.js +2 -4
  45. package/src/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/functionYaml/data.js +15 -9
  46. package/src/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/handler/data.js +3 -3
  47. package/src/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/data.js +2 -1
  48. package/src/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/template.ejs +1 -1
  49. package/src/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/sqs/data.js +3 -5
  50. package/src/TemplateData/flowSchema/components/upload/processFile/functionYml/HdrS3/data.js +10 -5
  51. package/src/TemplateData/flowSchema/components/upload/processFile/handler/handlerS3/data.js +2 -1
  52. package/src/TemplateData/flowSchema/components/upload/processFile/mainFunction/data.js +2 -1
  53. package/src/TemplateData/flowSchema/components/upload/processFile/mainFunction/template.ejs +0 -2
  54. package/src/TemplateData/flowSchema/components/upload/processFile/queue/data.js +1 -1
  55. package/src/TemplateData/flowSchema/components/upload/relate/S3/data.js +1 -1
  56. package/src/TemplateData/flowSchema/components/upload/relate/libs/data.js +1 -1
  57. package/src/TemplateData/flowSchema/components/upload/relate/sns-out/data.js +2 -1
  58. package/src/TemplateData/flowSchema/components/websocket/connect/functionYaml/data.js +9 -4
  59. package/src/TemplateData/flowSchema/components/websocket/connect/handler/data.js +1 -1
  60. package/src/TemplateData/flowSchema/components/websocket/dynamoDb/ReservedTableData.js +1 -2
  61. package/src/TemplateData/flowSchema/components/websocket/dynamoDb/WebSocketTaskData.js +1 -1
  62. package/src/TemplateData/flowSchema/components/websocket/dynamoDb/userUploadRecords.js +1 -1
  63. package/src/TemplateData/flowSchema/dynamoDb/data.js +2 -1
  64. package/src/TemplateData/flowSchema/eventBridge/functionYaml/data.js +9 -4
  65. package/src/TemplateData/flowSchema/eventBridge/handler/inv/data.js +2 -1
  66. package/src/TemplateData/flowSchema/eventBridge/mainFunction/data.js +2 -1
  67. package/src/TemplateData/flowSchema/externalTopic/Complete/functionYaml/data.js +9 -6
  68. package/src/TemplateData/flowSchema/externalTopic/Complete/handler/data.js +2 -19
  69. package/src/TemplateData/flowSchema/externalTopic/Complete/mainFunction/data.js +3 -1
  70. package/src/TemplateData/flowSchema/externalTopic/Process/functionYaml/data.js +12 -5
  71. package/src/TemplateData/flowSchema/externalTopic/Process/handler/data.js +4 -1
  72. package/src/TemplateData/flowSchema/externalTopic/sns-in-sqs/data.js +3 -1
  73. package/src/TemplateData/flowSchema/externalTopic/sns-out/data.js +5 -6
  74. package/src/TemplateData/flowSchema/flowSchemaMainFunction/data.js +5 -9
  75. package/src/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/functionYaml/data.js +10 -5
  76. package/src/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/handler/data.js +3 -3
  77. package/src/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/mainFunction/data.js +3 -3
  78. package/src/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/data.js +65 -58
  79. package/src/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/template.ejs +0 -4
  80. package/src/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/DsqHandlerTemplate.ejs +91 -0
  81. package/src/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/data.js +31 -16
  82. package/src/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/functionYaml/data.js +10 -5
  83. package/src/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/handler/data.js +4 -3
  84. package/src/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/handler/template.ejs +5 -6
  85. package/src/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/data.js +3 -1
  86. package/src/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/template.ejs +3 -3
  87. package/src/TemplateData/flowSchema/flowSchemaOwnTopic/sns-in/data.js +3 -3
  88. package/src/TemplateData/flowSchema/flowSchemaOwnTopic/sns-out/data.js +3 -3
  89. package/src/TemplateData/flowSchema/flowStep/functionYaml/data.js +13 -8
  90. package/src/TemplateData/flowSchema/flowStep/handler/data.js +3 -3
  91. package/src/TemplateData/flowSchema/flowStep/mainFunction/data.js +2 -1
  92. package/src/TemplateData/flowSchema/flowStep/sns-in/data.js +3 -3
  93. package/src/TemplateData/flowSchema/generateTemplateData.js +1 -6
  94. package/src/TemplateData/flowSchema/lambdaSync/Api/functionYaml/data.js +10 -3
  95. package/src/TemplateData/flowSchema/lambdaSync/Api/handler/data.js +3 -1
  96. package/src/TemplateData/flowSchema/lambdaSync/Inv/functionYaml/data.js +9 -3
  97. package/src/TemplateData/flowSchema/lambdaSync/Inv/handler/data.js +2 -1
  98. package/src/TemplateData/flowSchema/register/complete/functionYaml/data.js +11 -5
  99. package/src/TemplateData/flowSchema/register/complete/handler/data.js +2 -1
  100. package/src/TemplateData/flowSchema/register/complete/mainFunction/data.js +2 -1
  101. package/src/TemplateData/flowSchema/register/dynamoDB/register.js +2 -4
  102. package/src/TemplateData/flowSchema/register/sns-in/data.js +3 -4
  103. package/src/TemplateData/flowSchema/register/subscriptionOutAll/data.js +3 -3
  104. package/src/TemplateData/flowSchema/register/wbs/functionYaml/data.js +10 -5
  105. package/src/TemplateData/flowSchema/register/wbs/handler/data.js +2 -1
  106. package/src/TemplateData/flowSchema/register/wbs/mainFunction/data.js +2 -1
  107. package/src/TemplateData/flowSchema/statusFieldComponent/FunctionYaml/data.js +14 -6
  108. package/src/TemplateData/flowSchema/statusFieldComponent/Handler/data.js +4 -7
  109. package/src/TemplateData/flowSchema/statusFieldComponent/MainFunction/data.js +4 -3
  110. package/src/TemplateData/flowSchema/statusFieldComponent/sns/data.js +3 -3
  111. package/src/TemplateData/flowSchema/triggerCacheComponent/checkTriggerCacheComplete/functionYaml/data.js +12 -8
  112. package/src/TemplateData/flowSchema/triggerCacheComponent/checkTriggerCacheComplete/handler/data.js +3 -3
  113. package/src/TemplateData/flowSchema/triggerCacheComponent/checkTriggerCacheComplete/mainFunction/data.js +3 -3
  114. package/src/TemplateData/flowSchema/triggerCacheComponent/processTriggerCache/functionYaml/data.js +12 -6
  115. package/src/TemplateData/flowSchema/triggerCacheComponent/processTriggerCache/handler/data.js +2 -1
  116. package/src/TemplateData/flowSchema/triggerCacheComponent/processTriggerCache/mainFunction/data.js +2 -1
  117. package/src/TemplateData/flowSchema/triggerCacheComponent/triggerCacheComplete/functionYaml/data.js +11 -8
  118. package/src/TemplateData/flowSchema/triggerCacheComponent/triggerCacheComplete/handler/data.js +2 -1
  119. package/src/TemplateData/flowSchema/triggerCacheComponent/triggerCacheComplete/mainFunction/data.js +3 -3
  120. package/src/TemplateData/flowSchema/triggerCacheComponent/triggerCacheQueue/data.js +4 -11
  121. package/src/TemplateData/flowSchema/webSocketComplete/functionYaml/data.js +11 -8
  122. package/src/TemplateData/flowSchema/webSocketComplete/handler/data.js +2 -1
  123. package/src/TemplateData/flowSchema/webSocketComplete/mainFunction/data.js +1 -1
  124. package/src/TemplateData/flowSchema/webSocketComplete/sqs/data.js +3 -3
  125. package/src/TemplateData/generateRole/data.js +7 -2
  126. package/src/TemplateData/perActionComplete/create/handler/data.js +3 -3
  127. package/src/TemplateData/perActionComplete/create/mainFunction/data.js +3 -3
  128. package/src/TemplateData/perActionComplete/create/mainFunction/template.ejs +2 -2
  129. package/src/TemplateData/perActionComplete/create/sns-in-sqs/data.js +3 -3
  130. package/src/TemplateData/perActionComplete/create/sns-out/data.js +3 -3
  131. package/src/TemplateData/perActionComplete/create/yaml/data.js +11 -7
  132. package/src/TemplateData/perActionComplete/delete/handler/data.js +3 -3
  133. package/src/TemplateData/perActionComplete/delete/mainFunction/data.js +4 -3
  134. package/src/TemplateData/perActionComplete/delete/mainFunction/template.ejs +3 -4
  135. package/src/TemplateData/perActionComplete/delete/sns-in-sqs/data.js +4 -3
  136. package/src/TemplateData/perActionComplete/delete/sns-out/data.js +3 -3
  137. package/src/TemplateData/perActionComplete/delete/yaml/data.js +11 -7
  138. package/src/TemplateData/perActionComplete/get/handler/data.js +3 -3
  139. package/src/TemplateData/perActionComplete/get/mainFunction/data.js +3 -4
  140. package/src/TemplateData/perActionComplete/get/mainFunction/template.ejs +2 -2
  141. package/src/TemplateData/perActionComplete/get/sns-in-sqs/data.js +3 -3
  142. package/src/TemplateData/perActionComplete/get/sns-out/data.js +3 -3
  143. package/src/TemplateData/perActionComplete/get/yaml/data.js +12 -7
  144. package/src/TemplateData/perActionComplete/update/handler/data.js +3 -3
  145. package/src/TemplateData/perActionComplete/update/mainFunction/data.js +3 -3
  146. package/src/TemplateData/perActionComplete/update/mainFunction/template.ejs +2 -2
  147. package/src/TemplateData/perActionComplete/update/sns-in-sqs/data.js +3 -3
  148. package/src/TemplateData/perActionComplete/update/sns-out/data.js +4 -6
  149. package/src/TemplateData/perActionComplete/update/yaml/data.js +11 -7
  150. package/src/TemplateData/processLogical/handler/data.js +3 -3
  151. package/src/TemplateData/processLogical/mainFunction/data.js +2 -1
  152. package/src/TemplateData/processLogical/yaml/data.js +10 -7
  153. package/src/TemplateData/processLogicalPagination/DsqYaml/data.js +1 -1
  154. package/src/TemplateData/processLogicalPagination/handler/dsq/data.js +2 -1
  155. package/src/TemplateData/processLogicalPagination/handler/sqs/data.js +2 -1
  156. package/src/TemplateData/processLogicalPagination/mainFunction/data.js +2 -1
  157. package/src/TemplateData/processLogicalPagination/yaml/dsq/data.js +11 -7
  158. package/src/TemplateData/processLogicalPagination/yaml/sqs/data.js +9 -6
  159. package/src/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/data.js +12 -7
  160. package/src/TemplateData/relationshipPerAction/changeRelationship/action/handler/data.js +3 -3
  161. package/src/TemplateData/relationshipPerAction/changeRelationship/action/mainFunction/data.js +3 -3
  162. package/src/TemplateData/relationshipPerAction/changeRelationship/action/mainFunction/template.ejs +2 -2
  163. package/src/TemplateData/relationshipPerAction/changeRelationship/action/sns-in-sqs/data.js +5 -3
  164. package/src/TemplateData/relationshipPerAction/changeRelationship/complete/functionYaml/data.js +11 -7
  165. package/src/TemplateData/relationshipPerAction/changeRelationship/complete/handler/sqs/data.js +3 -3
  166. package/src/TemplateData/relationshipPerAction/changeRelationship/complete/mainFunction/data.js +3 -3
  167. package/src/TemplateData/relationshipPerAction/changeRelationship/complete/mainFunction/template.ejs +12 -11
  168. package/src/TemplateData/relationshipPerAction/changeRelationship/complete/sns-in-sqs/data.js +3 -3
  169. package/src/TemplateData/relationshipPerAction/changeRelationship/complete/sns-out/data.js +2 -1
  170. package/src/TemplateData/relationshipPerAction/create/action/functionYaml/data.js +20 -15
  171. package/src/TemplateData/relationshipPerAction/create/action/handler/data.js +4 -3
  172. package/src/TemplateData/relationshipPerAction/create/action/mainFunction/data.js +4 -3
  173. package/src/TemplateData/relationshipPerAction/create/action/mainFunction/template.ejs +2 -2
  174. package/src/TemplateData/relationshipPerAction/create/action/sns-in-sqs/data.js +6 -4
  175. package/src/TemplateData/relationshipPerAction/create/complete/functionYaml/data.js +14 -10
  176. package/src/TemplateData/relationshipPerAction/create/complete/handler/sqs/data.js +3 -3
  177. package/src/TemplateData/relationshipPerAction/create/complete/mainFunction/data.js +3 -3
  178. package/src/TemplateData/relationshipPerAction/create/complete/mainFunction/template.ejs +3 -2
  179. package/src/TemplateData/relationshipPerAction/create/complete/sns-in-sqs/data.js +3 -3
  180. package/src/TemplateData/relationshipPerAction/create/complete/sns-out/data.js +3 -4
  181. package/src/TemplateData/relationshipPerAction/delete/action/functionYaml/data.js +20 -15
  182. package/src/TemplateData/relationshipPerAction/delete/action/handler/data.js +4 -4
  183. package/src/TemplateData/relationshipPerAction/delete/action/mainFunction/data.js +4 -7
  184. package/src/TemplateData/relationshipPerAction/delete/action/mainFunction/template.ejs +2 -2
  185. package/src/TemplateData/relationshipPerAction/delete/action/sns-in-sqs/data.js +5 -3
  186. package/src/TemplateData/relationshipPerAction/delete/complete/functionYaml/data.js +11 -7
  187. package/src/TemplateData/relationshipPerAction/delete/complete/handler/sqs/data.js +2 -1
  188. package/src/TemplateData/relationshipPerAction/delete/complete/mainFunction/data.js +3 -3
  189. package/src/TemplateData/relationshipPerAction/delete/complete/mainFunction/template.ejs +4 -5
  190. package/src/TemplateData/relationshipPerAction/delete/complete/sns-in-sqs/data.js +3 -3
  191. package/src/TemplateData/relationshipPerAction/delete/complete/sns-out/data.js +3 -3
  192. package/src/TemplateData/relationshipPerAction/generateTemplateData.js +1 -1
  193. package/src/TemplateData/relationshipPerAction/get/action/functionYaml/data.js +19 -16
  194. package/src/TemplateData/relationshipPerAction/get/action/handler/data.js +4 -4
  195. package/src/TemplateData/relationshipPerAction/get/action/mainFunction/data.js +3 -4
  196. package/src/TemplateData/relationshipPerAction/get/action/mainFunction/template.ejs +6 -3
  197. package/src/TemplateData/relationshipPerAction/get/action/sns-in-sqs/data.js +5 -3
  198. package/src/TemplateData/relationshipPerAction/get/complete/functionYaml/data.js +13 -9
  199. package/src/TemplateData/relationshipPerAction/get/complete/handler/sqs/data.js +2 -1
  200. package/src/TemplateData/relationshipPerAction/get/complete/mainFunction/data.js +3 -3
  201. package/src/TemplateData/relationshipPerAction/get/complete/mainFunction/template.ejs +3 -2
  202. package/src/TemplateData/relationshipPerAction/get/complete/sns-in-sqs/data.js +2 -1
  203. package/src/TemplateData/relationshipPerAction/get/complete/sns-out/data.js +3 -3
  204. package/src/TemplateData/relationshipPerAction/moveRelationship/action/functionYaml/data.js +17 -13
  205. package/src/TemplateData/relationshipPerAction/moveRelationship/action/handler/data.js +4 -3
  206. package/src/TemplateData/relationshipPerAction/moveRelationship/action/mainFunction/data.js +6 -4
  207. package/src/TemplateData/relationshipPerAction/moveRelationship/action/mainFunction/template.ejs +6 -3
  208. package/src/TemplateData/relationshipPerAction/moveRelationship/action/sns-in-sqs/data.js +6 -4
  209. package/src/TemplateData/relationshipPerAction/moveRelationship/complete/functionYaml/data.js +13 -9
  210. package/src/TemplateData/relationshipPerAction/moveRelationship/complete/handler/sqs/data.js +3 -3
  211. package/src/TemplateData/relationshipPerAction/moveRelationship/complete/mainFunction/data.js +3 -3
  212. package/src/TemplateData/relationshipPerAction/moveRelationship/complete/mainFunction/template.ejs +3 -2
  213. package/src/TemplateData/relationshipPerAction/moveRelationship/complete/sns-in-sqs/data.js +3 -3
  214. package/src/TemplateData/relationshipPerAction/moveRelationship/complete/sns-out/data.js +3 -3
  215. package/src/TemplateData/relationshipPerAction/update/action/functionYaml/data.js +20 -15
  216. package/src/TemplateData/relationshipPerAction/update/action/handler/data.js +4 -4
  217. package/src/TemplateData/relationshipPerAction/update/action/mainFunction/data.js +4 -4
  218. package/src/TemplateData/relationshipPerAction/update/action/mainFunction/template.ejs +6 -3
  219. package/src/TemplateData/relationshipPerAction/update/action/sns-in-sqs/data.js +4 -3
  220. package/src/TemplateData/relationshipPerAction/update/action/sns-out/data.js +5 -6
  221. package/src/TemplateData/relationshipPerAction/update/complete/functionYaml/data.js +13 -10
  222. package/src/TemplateData/relationshipPerAction/update/complete/handler/sqs/data.js +3 -3
  223. package/src/TemplateData/relationshipPerAction/update/complete/mainFunction/data.js +2 -1
  224. package/src/TemplateData/relationshipPerAction/update/complete/mainFunction/template.ejs +3 -2
  225. package/src/TemplateData/relationshipPerAction/update/complete/sns-in-sqs/data.js +3 -3
  226. package/src/TemplateData/relationshipPerAction/update/complete/sns-out/data.js +3 -3
  227. package/src/TemplateData/resourceYaml/dynamodb/defaultDynamoDbTable.js +1 -1
  228. package/src/TemplateData/resourceYaml/dynamodb/generateDynamoPerLink.js +7 -3
  229. package/src/TemplateData/resourceYaml/dynamodb/mainResourcePerObjectSchemaData.js +2 -1
  230. package/src/TemplateData/resourceYaml/filterGenerateResource/data.js +5 -3
  231. package/src/TemplateData/resourceYaml/generateTemplateData.js +5 -2
  232. package/src/TemplateData/resourceYaml/sns-in-sqs/defaultSnsInSqsForFindDataAndProcessLogical.js +3 -3
  233. package/src/TemplateData/resourceYaml/sns-in-sqs/snsAndSqsPerActionData.js +4 -3
  234. package/src/TemplateData/resourceYaml/sns-out/data.js +3 -3
  235. package/src/TemplateData/resourceYaml/sns-out/defaultSnsOutForFindDataAndProcessLogical.js +2 -1
  236. package/src/libs/GenerateCodeLibs.js +1 -1
  237. package/src/libs/Libs.js +22 -0
  238. package/src/libs/Utils.js +4 -4
  239. package/src/TemplateData/EndpointPerService/mainFunction/create/backupTemplate.ejs +0 -358
  240. package/src/TemplateData/perActionEndpoint/generateTemplateData.js +0 -112
  241. package/src/TemplateData/perActionEndpoint/handler/api/data.js +0 -109
  242. package/src/TemplateData/perActionEndpoint/handler/api/request.json +0 -7
  243. package/src/TemplateData/perActionEndpoint/handler/api/template.ejs +0 -36
  244. package/src/TemplateData/perActionEndpoint/handler/dsq/data.js +0 -118
  245. package/src/TemplateData/perActionEndpoint/handler/dsq/request.json +0 -7
  246. package/src/TemplateData/perActionEndpoint/handler/dsq/template.ejs +0 -55
  247. package/src/TemplateData/perActionEndpoint/handler/inv/data.js +0 -112
  248. package/src/TemplateData/perActionEndpoint/handler/inv/request.json +0 -7
  249. package/src/TemplateData/perActionEndpoint/handler/inv/template.ejs +0 -37
  250. package/src/TemplateData/perActionEndpoint/handler/sqs/data.js +0 -116
  251. package/src/TemplateData/perActionEndpoint/handler/sqs/request.json +0 -7
  252. package/src/TemplateData/perActionEndpoint/handler/sqs/template.ejs +0 -57
  253. package/src/TemplateData/perActionEndpoint/handler/webSocket/data.js +0 -94
  254. package/src/TemplateData/perActionEndpoint/handler/webSocket/template.ejs +0 -61
  255. package/src/TemplateData/perActionEndpoint/handler/webSocketConnect/data.js +0 -54
  256. package/src/TemplateData/perActionEndpoint/handler/webSocketConnect/template.ejs +0 -55
  257. package/src/TemplateData/perActionEndpoint/libs/data.js +0 -60
  258. package/src/TemplateData/perActionEndpoint/libs/template.ejs +0 -46
  259. package/src/TemplateData/perActionEndpoint/mainFunction/create/data.js +0 -91
  260. package/src/TemplateData/perActionEndpoint/mainFunction/create/request.json +0 -0
  261. package/src/TemplateData/perActionEndpoint/mainFunction/create/template.ejs +0 -339
  262. package/src/TemplateData/perActionEndpoint/mainFunction/delete/data.js +0 -91
  263. package/src/TemplateData/perActionEndpoint/mainFunction/delete/template.ejs +0 -99
  264. package/src/TemplateData/perActionEndpoint/mainFunction/get/data.js +0 -92
  265. package/src/TemplateData/perActionEndpoint/mainFunction/get/request.json +0 -5
  266. package/src/TemplateData/perActionEndpoint/mainFunction/get/template.ejs +0 -116
  267. package/src/TemplateData/perActionEndpoint/mainFunction/get/testParam.json +0 -5
  268. package/src/TemplateData/perActionEndpoint/mainFunction/update/data.js +0 -85
  269. package/src/TemplateData/perActionEndpoint/mainFunction/update/request.json +0 -0
  270. package/src/TemplateData/perActionEndpoint/mainFunction/update/template.ejs +0 -166
  271. package/src/TemplateData/perActionEndpoint/yaml/api/data.js +0 -229
  272. package/src/TemplateData/perActionEndpoint/yaml/api/request.json +0 -14
  273. package/src/TemplateData/perActionEndpoint/yaml/api/template.ejs +0 -20
  274. package/src/TemplateData/perActionEndpoint/yaml/dsq/data.js +0 -234
  275. package/src/TemplateData/perActionEndpoint/yaml/dsq/request.json +0 -19
  276. package/src/TemplateData/perActionEndpoint/yaml/dsq/template.ejs +0 -17
  277. package/src/TemplateData/perActionEndpoint/yaml/inv/data.js +0 -207
  278. package/src/TemplateData/perActionEndpoint/yaml/inv/example req.js +0 -15
  279. package/src/TemplateData/perActionEndpoint/yaml/inv/request.json +0 -14
  280. package/src/TemplateData/perActionEndpoint/yaml/inv/template.ejs +0 -13
  281. package/src/TemplateData/perActionEndpoint/yaml/sqs/data.js +0 -237
  282. package/src/TemplateData/perActionEndpoint/yaml/sqs/request.json +0 -19
  283. package/src/TemplateData/perActionEndpoint/yaml/sqs/template.ejs +0 -17
  284. package/src/TemplateData/perActionEndpoint/yaml/wbs/data.js +0 -204
  285. package/src/TemplateData/perActionEndpoint/yaml/wbs/request.json +0 -19
  286. package/src/TemplateData/perActionEndpoint/yaml/wbs/template.ejs +0 -29
  287. package/src/TemplateData/perActionEndpoint/yaml/webSocketConnect/data.js +0 -58
  288. package/src/TemplateData/perActionEndpoint/yaml/webSocketConnect/template.ejs +0 -10
  289. package/src/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/api/data.js +0 -146
  290. package/src/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/api/template.ejs +0 -20
  291. package/src/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/dsq/data.js +0 -146
  292. package/src/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/dsq/template.ejs +0 -17
  293. package/src/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/inv/data.js +0 -146
  294. package/src/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/inv/template.ejs +0 -13
  295. package/src/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/sqs/data.js +0 -147
  296. package/src/TemplateData/relationshipPerAction/changeRelationship/action/functionYaml/sqs/template.ejs +0 -17
  297. package/src/TemplateData/relationshipPerAction/changeRelationship/action/handler/api/data.js +0 -62
  298. package/src/TemplateData/relationshipPerAction/changeRelationship/action/handler/api/template.ejs +0 -59
  299. package/src/TemplateData/relationshipPerAction/changeRelationship/action/handler/dsq/data.js +0 -63
  300. package/src/TemplateData/relationshipPerAction/changeRelationship/action/handler/dsq/template.ejs +0 -202
  301. package/src/TemplateData/relationshipPerAction/changeRelationship/action/handler/inv/data.js +0 -64
  302. package/src/TemplateData/relationshipPerAction/changeRelationship/action/handler/inv/template.ejs +0 -144
  303. package/src/TemplateData/relationshipPerAction/changeRelationship/action/handler/sqs/data.js +0 -64
  304. package/src/TemplateData/relationshipPerAction/changeRelationship/action/handler/sqs/template.ejs +0 -77
  305. package/src/TemplateData/relationshipPerAction/create/action/functionYaml/api/data.js +0 -175
  306. package/src/TemplateData/relationshipPerAction/create/action/functionYaml/api/template.ejs +0 -20
  307. package/src/TemplateData/relationshipPerAction/create/action/functionYaml/dsq/data.js +0 -176
  308. package/src/TemplateData/relationshipPerAction/create/action/functionYaml/dsq/template.ejs +0 -17
  309. package/src/TemplateData/relationshipPerAction/create/action/functionYaml/inv/data.js +0 -175
  310. package/src/TemplateData/relationshipPerAction/create/action/functionYaml/inv/template.ejs +0 -13
  311. package/src/TemplateData/relationshipPerAction/create/action/functionYaml/sqs/data.js +0 -177
  312. package/src/TemplateData/relationshipPerAction/create/action/functionYaml/sqs/template.ejs +0 -17
  313. package/src/TemplateData/relationshipPerAction/create/action/handler/api/data.js +0 -62
  314. package/src/TemplateData/relationshipPerAction/create/action/handler/api/request.json +0 -0
  315. package/src/TemplateData/relationshipPerAction/create/action/handler/api/template.ejs +0 -57
  316. package/src/TemplateData/relationshipPerAction/create/action/handler/dsq/data.js +0 -63
  317. package/src/TemplateData/relationshipPerAction/create/action/handler/dsq/request.json +0 -0
  318. package/src/TemplateData/relationshipPerAction/create/action/handler/dsq/template.ejs +0 -184
  319. package/src/TemplateData/relationshipPerAction/create/action/handler/inv/data.js +0 -64
  320. package/src/TemplateData/relationshipPerAction/create/action/handler/inv/request.json +0 -0
  321. package/src/TemplateData/relationshipPerAction/create/action/handler/inv/template.ejs +0 -126
  322. package/src/TemplateData/relationshipPerAction/create/action/handler/sqs/data.js +0 -64
  323. package/src/TemplateData/relationshipPerAction/create/action/handler/sqs/request.json +0 -0
  324. package/src/TemplateData/relationshipPerAction/create/action/handler/sqs/template.ejs +0 -75
  325. package/src/TemplateData/relationshipPerAction/delete/action/functionYaml/api/data.js +0 -178
  326. package/src/TemplateData/relationshipPerAction/delete/action/functionYaml/api/template.ejs +0 -20
  327. package/src/TemplateData/relationshipPerAction/delete/action/functionYaml/dsq/data.js +0 -176
  328. package/src/TemplateData/relationshipPerAction/delete/action/functionYaml/dsq/template.ejs +0 -17
  329. package/src/TemplateData/relationshipPerAction/delete/action/functionYaml/inv/data.js +0 -178
  330. package/src/TemplateData/relationshipPerAction/delete/action/functionYaml/inv/template.ejs +0 -13
  331. package/src/TemplateData/relationshipPerAction/delete/action/functionYaml/sqs/data.js +0 -176
  332. package/src/TemplateData/relationshipPerAction/delete/action/functionYaml/sqs/template.ejs +0 -17
  333. package/src/TemplateData/relationshipPerAction/delete/action/handler/api/data.js +0 -62
  334. package/src/TemplateData/relationshipPerAction/delete/action/handler/api/request.json +0 -0
  335. package/src/TemplateData/relationshipPerAction/delete/action/handler/api/template.ejs +0 -139
  336. package/src/TemplateData/relationshipPerAction/delete/action/handler/dsq/data.js +0 -63
  337. package/src/TemplateData/relationshipPerAction/delete/action/handler/dsq/request.json +0 -0
  338. package/src/TemplateData/relationshipPerAction/delete/action/handler/dsq/template.ejs +0 -182
  339. package/src/TemplateData/relationshipPerAction/delete/action/handler/inv/data.js +0 -64
  340. package/src/TemplateData/relationshipPerAction/delete/action/handler/inv/request.json +0 -0
  341. package/src/TemplateData/relationshipPerAction/delete/action/handler/inv/template.ejs +0 -124
  342. package/src/TemplateData/relationshipPerAction/delete/action/handler/sqs/data.js +0 -64
  343. package/src/TemplateData/relationshipPerAction/delete/action/handler/sqs/request.json +0 -0
  344. package/src/TemplateData/relationshipPerAction/delete/action/handler/sqs/template.ejs +0 -162
  345. package/src/TemplateData/relationshipPerAction/get/action/functionYaml/api/data.js +0 -168
  346. package/src/TemplateData/relationshipPerAction/get/action/functionYaml/api/template.ejs +0 -20
  347. package/src/TemplateData/relationshipPerAction/get/action/functionYaml/dsq/data.js +0 -177
  348. package/src/TemplateData/relationshipPerAction/get/action/functionYaml/dsq/template.ejs +0 -17
  349. package/src/TemplateData/relationshipPerAction/get/action/functionYaml/inv/data.js +0 -167
  350. package/src/TemplateData/relationshipPerAction/get/action/functionYaml/inv/template.ejs +0 -13
  351. package/src/TemplateData/relationshipPerAction/get/action/functionYaml/sqs/data.js +0 -166
  352. package/src/TemplateData/relationshipPerAction/get/action/functionYaml/sqs/template.ejs +0 -17
  353. package/src/TemplateData/relationshipPerAction/get/action/handler/api/data.js +0 -62
  354. package/src/TemplateData/relationshipPerAction/get/action/handler/api/request.json +0 -0
  355. package/src/TemplateData/relationshipPerAction/get/action/handler/api/template.ejs +0 -138
  356. package/src/TemplateData/relationshipPerAction/get/action/handler/dsq/data.js +0 -63
  357. package/src/TemplateData/relationshipPerAction/get/action/handler/dsq/request.json +0 -0
  358. package/src/TemplateData/relationshipPerAction/get/action/handler/dsq/template.ejs +0 -185
  359. package/src/TemplateData/relationshipPerAction/get/action/handler/inv/data.js +0 -64
  360. package/src/TemplateData/relationshipPerAction/get/action/handler/inv/request.json +0 -0
  361. package/src/TemplateData/relationshipPerAction/get/action/handler/inv/template.ejs +0 -127
  362. package/src/TemplateData/relationshipPerAction/get/action/handler/sqs/data.js +0 -64
  363. package/src/TemplateData/relationshipPerAction/get/action/handler/sqs/request.json +0 -0
  364. package/src/TemplateData/relationshipPerAction/get/action/handler/sqs/template.ejs +0 -165
  365. package/src/TemplateData/relationshipPerAction/update/action/functionYaml/api/data.js +0 -167
  366. package/src/TemplateData/relationshipPerAction/update/action/functionYaml/api/request.json +0 -0
  367. package/src/TemplateData/relationshipPerAction/update/action/functionYaml/api/template.ejs +0 -20
  368. package/src/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/data.js +0 -196
  369. package/src/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/request.json +0 -0
  370. package/src/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/template.ejs +0 -17
  371. package/src/TemplateData/relationshipPerAction/update/action/functionYaml/inv/data.js +0 -186
  372. package/src/TemplateData/relationshipPerAction/update/action/functionYaml/inv/request.json +0 -0
  373. package/src/TemplateData/relationshipPerAction/update/action/functionYaml/inv/template.ejs +0 -13
  374. package/src/TemplateData/relationshipPerAction/update/action/functionYaml/sqs/data.js +0 -187
  375. package/src/TemplateData/relationshipPerAction/update/action/functionYaml/sqs/request.json +0 -0
  376. package/src/TemplateData/relationshipPerAction/update/action/functionYaml/sqs/template.ejs +0 -17
  377. package/src/TemplateData/relationshipPerAction/update/action/handler/api/data.js +0 -78
  378. package/src/TemplateData/relationshipPerAction/update/action/handler/api/request.json +0 -7
  379. package/src/TemplateData/relationshipPerAction/update/action/handler/api/template.ejs +0 -142
  380. package/src/TemplateData/relationshipPerAction/update/action/handler/dsq/data.js +0 -79
  381. package/src/TemplateData/relationshipPerAction/update/action/handler/dsq/request.json +0 -7
  382. package/src/TemplateData/relationshipPerAction/update/action/handler/dsq/template.ejs +0 -188
  383. package/src/TemplateData/relationshipPerAction/update/action/handler/inv/data.js +0 -80
  384. package/src/TemplateData/relationshipPerAction/update/action/handler/inv/request.json +0 -5
  385. package/src/TemplateData/relationshipPerAction/update/action/handler/inv/template.ejs +0 -147
  386. package/src/TemplateData/relationshipPerAction/update/action/handler/sqs/data.js +0 -79
  387. package/src/TemplateData/relationshipPerAction/update/action/handler/sqs/request.json +0 -7
  388. package/src/TemplateData/relationshipPerAction/update/action/handler/sqs/template.ejs +0 -163
  389. package/src/TemplateData/resourceYaml/CreateSourceData.js +0 -79
  390. /package/src/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/{template.ejs → SqsHandlerTemplate.ejs} +0 -0
@@ -1,182 +0,0 @@
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
-
19
-
20
- import { middlewareHandler } from "@izara_project/izara-middleware";
21
- import Logger from '@izara_project/izara-core-library-logger';
22
- import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
23
- import recordHandlerSharedLib from '@izara_project/izara-core-library-record-handler';
24
-
25
- //(<optionalRequire>)
26
- //(</optionalRequire>)
27
-
28
- import <%- functionName %>Main from './<%- firstLetterUpperCase(functionName) %>_Main.js'
29
-
30
- // validate event properties in body.Message of sqs event
31
- middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema(
32
- {
33
- type: "object",
34
- required: ['body', 'messageAttributes'],
35
- properties: {
36
- body: {
37
- type: 'object',
38
- },
39
- messageAttributes: {
40
- type: 'object'
41
- }
42
- }
43
- }
44
- ));
45
-
46
- // validate event params in middlewware before into function.
47
- let validatorSchema = {
48
- type: "object",
49
- required: ["firstObject","secondObject", "relType", "relationshipProperties","relationshipDirection"],
50
- properties: {
51
- firstObject: {
52
- type: "object",
53
- required: ["objType","identifiers"],
54
- properties: {
55
- objType: {
56
- type: "object",
57
- required: ["serviceTag","objectType"],
58
- properties: {
59
- serviceTag: izara.validatorSchema.stringNotEmpty(),
60
- objectType: izara.validatorSchema.stringNotEmpty(),
61
- }
62
- },
63
- identifiers: {
64
- type: "object",
65
- minProperties: 1
66
- }
67
- }
68
- },
69
- secondObject: {
70
- type: "object",
71
- required: ["objType","identifiers"],
72
- properties: {
73
- objType: {
74
- type: "object",
75
- required: ["serviceTag","objectType"],
76
- properties: {
77
- serviceTag: izara.validatorSchema.stringNotEmpty(),
78
- objectType: izara.validatorSchema.stringNotEmpty(),
79
- }
80
- },
81
- identifiers: {
82
- type: "object",
83
- minProperties: 1
84
- }
85
- }
86
- },
87
- relType: {
88
- type: "object",
89
- required: ["relationshipTag", "serviceTag"],
90
- properties: {
91
- relationshipTag: izara.validatorSchema.stringNotEmpty(),
92
- serviceTag: {
93
- type: 'string',
94
- pattern: "^[a-zA-Z0-9_-]+$",
95
- enum: [process.env.iz_serviceTag]
96
- }
97
- }
98
- },
99
- relationshipProperties: {
100
- type: "object",
101
- minProperties: 1
102
- },
103
- relationshipDirection: {
104
- type: "string",
105
- enum: ['from','to']
106
- }
107
- }
108
- };
109
-
110
-
111
- //(<globalVariable>
112
- //</globalVariable>)
113
-
114
- // validate event params in middleware before into main function
115
- validatorSchema = callingFlowSharedLib.addOptionalCallingFlowToValidatorSchema(validatorSchema);
116
- // if need to validate authorizer or additional params , add code to hook tag below
117
-
118
- //(<afterValidateWith>)
119
- //(</afterValidateWith>)
120
-
121
-
122
- export const main = middleware.wrap(async (event, context) => {
123
- Logger.debug('event:', event);
124
- Logger.debug('context:', context);
125
- try {
126
-
127
- let recordPromises = []; // final return
128
-
129
- // loop each record and send to mainFunction
130
- await Promise.all(event.Records.map(async record => { // promise.all for map() function
131
-
132
- // --- reforming record.body for Dsq request
133
- record = recordHandlerSharedLib.reformatDsqMessage(record._izContext, record);
134
- record._izContext.logger.debug('record LambdaFunctionHdrDsq after reform', record);
135
-
136
- let passOnProperties = []
137
-
138
- // --- validate message (and MessageAttributes)
139
- await recordHandlerSharedLib.validateRecord(
140
- record, // one record will send to mainFunction
141
- "<%- queueName %>", // queue name that need to retry or send to dlq
142
- validatorSchema, // schema for record.Message
143
- // messageAttributeValidatorSchema // ----- for msgAttr default is null -> do not send this parameter if not want to validate msgAtt
144
- );
145
-
146
- // add argument (to invoke lambda) to passOnProperties[]
147
- passOnProperties.push(record.body.Message)
148
- passOnProperties.push(callingFlowSharedLib.addCallingFlowToPassOnProperties(record.body.Message));
149
- //(<afterPutParamIntoMainFunction>)
150
- //(</afterPutParamIntoMainFunction>)
151
- record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
152
-
153
- // call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
154
- let recordPromise = recordHandlerSharedLib.recordHandler(
155
- record, // one record will send to mainFunction
156
- <%- functionName %>, // mainFunction that need to invoke.
157
- "<%- queueName %>", // queue name that need to retry or send to dlq
158
- passOnProperties, // all parameters that mainFunction needed.
159
- );
160
- record._izContext.logger.debug('after recordPromise in handler');
161
- recordPromises.push(recordPromise); // push promise to recordPromises
162
- })) //end record
163
-
164
- Logger.debug('before Promise.all(recordPromises) in handler');
165
- try {
166
- await Promise.all(recordPromises); // await all promises
167
- return event.Records // return all for local test
168
- } catch {
169
- Logger.debug('Promise.all(recordPromises) in handler threw error (at least one record did no resolve)');
170
- }
171
- Logger.debug('after Promise.all(recordPromises) in handler');
172
- } catch (err) {
173
- Logger.error('Unhandled Error, updateRelationshipHdrDsq:', err);
174
- throw (err);
175
- }
176
- });
177
- <%_ function firstLetterUpperCase(text) {
178
- return text.charAt(0).toUpperCase() + text.slice(1)
179
- } _%>
180
- <%_ function firstLetterLowerCase(str) {
181
- return str.charAt(0).toLowerCase() + str.slice(1)
182
- } _%>
@@ -1,64 +0,0 @@
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
- import path from 'path';
19
- import { fileURLToPath } from 'url';
20
- const __filename = fileURLToPath(import.meta.url);
21
- const __dirname = path.dirname(__filename);
22
-
23
- const {
24
- ACTIONS,
25
- HANDLER
26
- } = require('@izara_project/izara-core-library-service-schemas/src/Consts');
27
-
28
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } =
29
- require('../../../../../../../MainLibs/src/Consts.js').utils;
30
- const { SOURCE_PATH, FUNCTION_NAME } =
31
- require('../../../../../../../MainLibs/src/Consts.js').consts;
32
-
33
- const templatePath = path.join(__dirname, 'template.ejs');
34
-
35
- /**
36
- * receive objectSchema
37
- * create data for hdrInv template
38
- *
39
- * @return {{ templatePath, templateData, setting } }
40
- */
41
- function data(_izContext, srcPath) {
42
- const createSourceParams = createParamForCreateSource(srcPath);
43
- return [createSourceParams];
44
- }
45
-
46
- function createParamForCreateSource(srcPath) {
47
- let functionName = FUNCTION_NAME.deleteRel;
48
- let handler = HANDLER.hdrInv;
49
- return {
50
- templatePath: templatePath,
51
- templateData: {
52
- functionName,
53
- handler
54
- },
55
- setting: {
56
- savePath: path.join(srcPath, SOURCE_PATH.relationshipPerAction),
57
- saveFileName: upperCase(functionName) + '_' + upperCase(handler),
58
- fileExtension: '.js',
59
- isAppend: false
60
- }
61
- };
62
- }
63
-
64
- module.exports = data;
@@ -1,124 +0,0 @@
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
-
19
-
20
- import { middlewareHandler, validatorSchema } from "@izara_project/izara-middleware";
21
- import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
22
-
23
- //(<optionalRequire>)
24
- //(</optionalRequire>)
25
-
26
- import <%- functionName %>Main from './<%- firstLetterUpperCase(functionName) %>_Main.js'
27
-
28
-
29
- // validate event params in middlewware before into function.
30
- let validatorSchema = {
31
- type: "object",
32
- required: ["firstObject","secondObject", "relType", "relationshipProperties","relationshipDirection"],
33
- properties: {
34
- firstObject: {
35
- type: "object",
36
- required: ["objType","identifiers"],
37
- properties: {
38
- objType: {
39
- type: "object",
40
- required: ["serviceTag","objectType"],
41
- properties: {
42
- serviceTag: validatorSchema.stringNotEmpty(),
43
- objectType: validatorSchema.stringNotEmpty(),
44
- }
45
- },
46
- identifiers: {
47
- type: "object",
48
- minProperties: 1
49
- }
50
- }
51
- },
52
- secondObject: {
53
- type: "object",
54
- required: ["objType","identifiers"],
55
- properties: {
56
- objType: {
57
- type: "object",
58
- required: ["serviceTag","objectType"],
59
- properties: {
60
- serviceTag: validatorSchema.stringNotEmpty(),
61
- objectType: validatorSchema.stringNotEmpty(),
62
- }
63
- },
64
- identifiers: {
65
- type: "object",
66
- minProperties: 1
67
- }
68
- }
69
- },
70
- relType: {
71
- type: "object",
72
- required: ["relationshipTag", "serviceTag"],
73
- properties: {
74
- relationshipTag: validatorSchema.stringNotEmpty(),
75
- serviceTag: {
76
- type: 'string',
77
- pattern: "^[a-zA-Z0-9_-]+$",
78
- enum: [process.env.iz_serviceTag]
79
- }
80
- }
81
- },
82
- relationshipProperties: {
83
- type: "object",
84
- minProperties: 1
85
- },
86
- relationshipDirection: {
87
- type: "string",
88
- enum: ['from','to']
89
- }
90
- }
91
- };
92
-
93
- validatorSchema = callingFlowSharedLib.addOptionalCallingFlowToValidatorSchema(validatorSchema); // is Ok callinfFlow
94
- middleware.setValidatorSchema(validatorSchema)
95
-
96
- export const main = middleware.wrap(async (event, context) => {
97
- event._izContext.logger.debug('Event:', event);
98
- event._izContext.logger.debug('context:', context);
99
-
100
- try {
101
- // invoke LambdaFunction
102
- return await <%- functionName %>(
103
- event._izContext, // correlationId/logger/integrationTestDetail/uniqueRequestId
104
- {
105
- firstObject: event.firstObject,
106
- secondObject: event.secondObject,
107
- relType: event.relType,
108
- relationshipDirection: event.relationshipDirection,
109
- relationshipProperties: event.relationshipProperties,
110
- },
111
- callingFlowSharedLib.addCallingFlowToPassOnProperties(event)
112
- );
113
-
114
- } catch (err) {
115
- event._izContext.logger.error('Error, <%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handler) %> : ', err);
116
- throw (err);
117
- }
118
- });
119
- <%_ function firstLetterUpperCase(text) {
120
- return text.charAt(0).toUpperCase() + text.slice(1)
121
- } _%>
122
- <%_ function firstLetterLowerCase(str) {
123
- return str.charAt(0).toLowerCase() + str.slice(1)
124
- } _%>
@@ -1,64 +0,0 @@
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
- import path from 'path';
19
- import { fileURLToPath } from 'url';
20
- const __filename = fileURLToPath(import.meta.url);
21
- const __dirname = path.dirname(__filename);
22
-
23
- const {
24
- ACTIONS,
25
- HANDLER
26
- } = require('@izara_project/izara-core-library-service-schemas/src/Consts');
27
-
28
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } =
29
- require('../../../../../../../MainLibs/src/Consts.js').utils;
30
- const { SOURCE_PATH, FUNCTION_NAME } =
31
- require('../../../../../../../MainLibs/src/Consts.js').consts;
32
-
33
- const templatePath = path.join(__dirname, 'template.ejs');
34
-
35
- /**
36
- * receive objectSchema
37
- * create data for sqs template
38
- *
39
- * @return {{ templatePath, templateData, setting } }
40
- */
41
- function data(_izContext, srcPath) {
42
- const createSourceParams = createParamForCreateSource(srcPath);
43
- return [createSourceParams];
44
- }
45
-
46
- function createParamForCreateSource(srcPath) {
47
- let functionName = FUNCTION_NAME.deleteRel;
48
- let queueName = functionName + upperCase(HANDLER.hdrSqs);
49
- return {
50
- templatePath: templatePath,
51
- templateData: {
52
- functionName,
53
- queueName
54
- },
55
- setting: {
56
- savePath: path.join(srcPath, SOURCE_PATH.relationshipPerAction),
57
- saveFileName: upperCase(functionName) + '_' + upperCase(HANDLER.hdrSqs),
58
- fileExtension: '.js',
59
- isAppend: false
60
- }
61
- };
62
- }
63
-
64
- module.exports = data;
@@ -1,162 +0,0 @@
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
-
19
-
20
- import { middlewareHandler } from "@izara_project/izara-middleware";
21
- import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
22
- import Logger from '@izara_project/izara-core-library-logger';
23
- import recordHandlerSharedLib from '@izara_project/izara-core-library-record-handler';
24
-
25
- //(<optionalRequire>)
26
- //(</optionalRequire>)
27
-
28
- import <%- functionName %>Main from './<%- firstLetterUpperCase(functionName) %>_Main.js';
29
-
30
- middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
31
-
32
- // validate event params in middleware before into function
33
- let validatorSchema = {
34
- type: "object",
35
- required: ["firstObject","secondObject", "relType", "relationshipProperties","relationshipDirection"],
36
- properties: {
37
- firstObject: {
38
- type: "object",
39
- required: ["objType","identifiers"],
40
- properties: {
41
- objType: {
42
- type: "object",
43
- required: ["serviceTag","objectType"],
44
- properties: {
45
- serviceTag: izara.validatorSchema.stringNotEmpty(),
46
- objectType: izara.validatorSchema.stringNotEmpty(),
47
- }
48
- },
49
- identifiers: {
50
- type: "object",
51
- minProperties: 1
52
- }
53
- }
54
- },
55
- secondObject: {
56
- type: "object",
57
- required: ["objType","identifiers"],
58
- properties: {
59
- objType: {
60
- type: "object",
61
- required: ["serviceTag","objectType"],
62
- properties: {
63
- serviceTag: izara.validatorSchema.stringNotEmpty(),
64
- objectType: izara.validatorSchema.stringNotEmpty(),
65
- }
66
- },
67
- identifiers: {
68
- type: "object",
69
- minProperties: 1
70
- }
71
- }
72
- },
73
- relType: {
74
- type: "object",
75
- required: ["relationshipTag", "serviceTag"],
76
- properties: {
77
- relationshipTag: izara.validatorSchema.stringNotEmpty(),
78
- serviceTag: {
79
- type: 'string',
80
- pattern: "^[a-zA-Z0-9_-]+$",
81
- enum: [process.env.iz_serviceTag]
82
- }
83
- }
84
- },
85
- relationshipProperties: {
86
- type: "object",
87
- minProperties: 1
88
- },
89
- relationshipDirection: {
90
- type: "string",
91
- enum: ['from','to']
92
- }
93
- }
94
- };
95
-
96
- //(<globalVariable>
97
- //</globalVariable>)
98
-
99
- // validate event params in middleware before into main function
100
- validatorSchema = callingFlowSharedLib.addOptionalCallingFlowToValidatorSchema(validatorSchema);
101
- // if need to validate authorizer or additional params , add code to hook tag below
102
-
103
- //(<afterValidateWith>)
104
- //(</afterValidateWith>)
105
-
106
- module.exports.main = middleware.wrap(async (event, context, callback) => {
107
-
108
- try {
109
-
110
- let recordPromises = []; // final return
111
-
112
- // loop each record and send to mainFunction
113
- await Promise.all(event.Records.map(async record => { // promise.all for map() function
114
-
115
- let passOnProperties = []
116
-
117
- // --- validate message (and MessageAttributes)
118
- await recordHandlerSharedLib.validateRecord(
119
- record, // one record will send to mainFunction
120
- "<%-firstLetterUpperCase(queueName) %>", // queue name that need to retry or send to dlq
121
- validatorSchema, // schema for record.Message
122
- // messageAttributeValidatorSchema // ----- for msgAttr default is null -> do not send this parameter if not want to validate msgAtt
123
- );
124
-
125
- // add argument (to invoke lambda) to passOnProperties[]
126
- passOnProperties.push(record.body.Message)
127
- passOnProperties.push(callingFlowSharedLib.addCallingFlowToPassOnProperties(record.body.Message));
128
- //(<afterPutParamIntoMainFunction>)
129
- //(</afterPutParamIntoMainFunction>)
130
-
131
- record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
132
-
133
- // call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
134
- let recordPromise = recordHandlerSharedLib.recordHandler(
135
- record, // one record will send to mainFunction
136
- <%- functionName %>.<%- functionName %>, // mainFunction that need to invoke.
137
- "<%-firstLetterUpperCase(queueName) %>", // queue name that need to retry or send to dlq
138
- passOnProperties, // all parameters that mainFunction needed.
139
- );
140
- record._izContext.logger.debug('after recordPromise in handler');
141
- recordPromises.push(recordPromise); // push promise to recordPromises
142
- })) //end record
143
-
144
- Logger.debug('before Promise.all(recordPromises) in handler');
145
- try {
146
- await Promise.all(recordPromises); // await all promises
147
- return event.Records // return all for local test
148
- } catch {
149
- Logger.debug('Promise.all(recordPromises) in handler threw error (at least one record did no resolve)');
150
- }
151
- Logger.debug('after Promise.all(recordPromises) in handler');
152
- } catch (err) {
153
- Logger.error('Unhandled Error, updateRelationshipHdrDsq:', err);
154
- throw (err);
155
- }
156
- });
157
- <%_ function firstLetterUpperCase(text) {
158
- return text.charAt(0).toUpperCase() + text.slice(1)
159
- } _%>
160
- <%_ function firstLetterLowerCase(str) {
161
- return str.charAt(0).toLowerCase() + str.slice(1)
162
- } _%>