@izara_project/izara-market-library-service-schemas 1.0.18 → 1.0.20

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 (179) hide show
  1. package/package.json +2 -2
  2. package/src/GenerateCodeLibs/src/Consts.js +32 -2
  3. package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +3 -61
  4. package/src/SourceManager/src/Utils.js +40 -1
  5. package/src/TemplateManager/src/FindData/FindDataYaml/data.js +4 -1
  6. package/src/TemplateManager/src/FindData/FindDataYaml/template.ejs +1 -14
  7. package/src/TemplateManager/src/GenerateCode.js +152 -46
  8. package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/functionYaml/data.js +23 -3
  9. package/src/TemplateManager/src/OutPerActionComplete/OutCreateComplete/functionYaml/template.ejs +1 -14
  10. package/src/TemplateManager/src/OutPerActionComplete/OutDeleteComplete/functionYaml/data.js +22 -3
  11. package/src/TemplateManager/src/OutPerActionComplete/OutDeleteComplete/functionYaml/template.ejs +1 -14
  12. package/src/TemplateManager/src/OutPerActionComplete/OutGetComplete/functionYaml/data.js +23 -3
  13. package/src/TemplateManager/src/OutPerActionComplete/OutGetComplete/functionYaml/template.ejs +1 -14
  14. package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/functionYaml/data.js +23 -3
  15. package/src/TemplateManager/src/OutPerActionComplete/OutUpdateComplete/functionYaml/template.ejs +1 -14
  16. package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrApi/data.js +6 -6
  17. package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrApi/template.ejs +1 -14
  18. package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrDsq/data.js +2 -1
  19. package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrDsq/template.ejs +1 -14
  20. package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrInv/data.js +1 -1
  21. package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrInv/template.ejs +1 -14
  22. package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrSqs/data.js +3 -1
  23. package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrSqs/template.ejs +1 -14
  24. package/src/TemplateManager/src/PerActionEndpoint/FunctionYaml/HdrWbs/data.js +1 -1
  25. package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Create/template.ejs +65 -26
  26. package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Delete/template.ejs +0 -1
  27. package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Get/template.ejs +13 -11
  28. package/src/TemplateManager/src/PerActionEndpoint/MainFunction/Update/template.ejs +34 -18
  29. package/src/TemplateManager/src/{flowTag/webSocket/websocketHandler/mainFunction → PerActionEndpoint/libs}/data.js +12 -23
  30. package/src/TemplateManager/src/PerActionEndpoint/libs/template.ejs +46 -0
  31. package/src/TemplateManager/src/ProcessLogical/ProcessLogicalYaml/data.js +18 -2
  32. package/src/TemplateManager/src/ProcessLogical/ProcessLogicalYaml/template.ejs +1 -14
  33. package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrDsq/data.js +20 -3
  34. package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrDsq/template.ejs +1 -14
  35. package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrSqs/data.js +21 -3
  36. package/src/TemplateManager/src/ProcessLogicalPagination/FunctionYaml/HdrSqs/template.ejs +1 -14
  37. package/src/TemplateManager/src/ProcessLogicalPagination/mainFunction/template.ejs +1 -1
  38. package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrApi/data.js +16 -2
  39. package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrApi/template.ejs +1 -14
  40. package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrDsq/data.js +17 -2
  41. package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrDsq/template.ejs +1 -14
  42. package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrInv/data.js +16 -2
  43. package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrInv/template.ejs +1 -14
  44. package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrSqs/data.js +18 -3
  45. package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationship/functionYaml/HdrSqs/template.ejs +1 -14
  46. package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationshipComplete/functionYaml/data.js +18 -3
  47. package/src/TemplateManager/src/RelationshipPerAction/CreateRelationship/createRelationshipComplete/functionYaml/template.ejs +1 -14
  48. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrApi/data.js +15 -2
  49. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrApi/template.ejs +1 -14
  50. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrDsq/data.js +17 -2
  51. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrDsq/template.ejs +1 -14
  52. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrInv/data.js +16 -2
  53. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrInv/template.ejs +1 -14
  54. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrSqs/data.js +18 -3
  55. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationship/functionYaml/HdrSqs/template.ejs +1 -14
  56. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/functionYaml/data.js +18 -3
  57. package/src/TemplateManager/src/RelationshipPerAction/DeleteRelationship/DeleteRelationshipComplete/functionYaml/template.ejs +1 -14
  58. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRalationshipComplete/functionYaml/data.js +19 -4
  59. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRalationshipComplete/functionYaml/template.ejs +1 -14
  60. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrApi/data.js +19 -2
  61. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrApi/template.ejs +1 -14
  62. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrDsq/data.js +19 -2
  63. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrDsq/template.ejs +1 -14
  64. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrInv/data.js +20 -2
  65. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrInv/template.ejs +1 -14
  66. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrSqs/data.js +20 -2
  67. package/src/TemplateManager/src/RelationshipPerAction/UpdateRelationshipSchema/updateRelationship/functionYaml/HdrSqs/template.ejs +1 -14
  68. package/src/TemplateManager/src/Role/createSharedResource.js +270 -0
  69. package/src/TemplateManager/src/Role/sharedResourceTemplate.ejs +58 -0
  70. package/src/TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrDsq/data.js +1 -1
  71. package/src/TemplateManager/src/TranslateIdReq/TranslateIds/functionYaml/HdrSqs/data.js +1 -1
  72. package/src/TemplateManager/src/externalService/LambdaRole/data.js +119 -9
  73. package/src/TemplateManager/src/externalService/LambdaRole/template.ejs +3 -4
  74. package/src/TemplateManager/src/externalService/SnsTopicSubscriotions/data.js +31 -6
  75. package/src/TemplateManager/src/flowSchema/DefaultWebSocketResource/dynamoDb/ReservedTableData.js +65 -0
  76. package/src/TemplateManager/src/{flowTag/webSocket → flowSchema/DefaultWebSocketResource}/webSocketConnect/functionYaml/data.js +3 -2
  77. package/src/TemplateManager/src/{flowTag/webSocket → flowSchema/DefaultWebSocketResource}/webSocketConnect/handler/data.js +1 -1
  78. package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/InProcessFlowSchema/functionYaml/data.js +77 -0
  79. package/src/TemplateManager/src/{flowTag/webSocket/websocketHandler → flowSchema/FlowSchemaEndpoint/InProcessFlowSchema}/functionYaml/template.ejs +9 -3
  80. package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/InProcessFlowSchema/handler/data.js +47 -0
  81. package/src/TemplateManager/src/{flowTag/webSocket/websocketHandler → flowSchema/FlowSchemaEndpoint/InProcessFlowSchema}/handler/template.ejs +25 -52
  82. package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/InProcessFlowSchema/mainFunction/data.js +46 -0
  83. package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/InProcessFlowSchema/mainFunction/template.ejs +0 -0
  84. package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/InProcessFlowSchema/sns-sqs/data.js +36 -0
  85. package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/InProcessFlowSchema/sns-sqs/template.ejs +0 -0
  86. package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/OutComplete/functionYaml/data.js +35 -0
  87. package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/OutComplete/functionYaml/template.ejs +0 -0
  88. package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/OutComplete/handler/data.js +35 -0
  89. package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/OutComplete/handler/template.ejs +0 -0
  90. package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/OutComplete/mainFunction/data.js +35 -0
  91. package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/OutComplete/mainFunction/template.ejs +0 -0
  92. package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/OutComplete/sns-sqs/data.js +35 -0
  93. package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/OutComplete/sns-sqs/template.ejs +0 -0
  94. package/src/TemplateManager/src/flowSchema/UploadS3Case/confirmReservedAfterUpload/functionYaml/data.js +102 -0
  95. package/src/TemplateManager/src/flowSchema/UploadS3Case/confirmReservedAfterUpload/functionYaml/template.ejs +30 -0
  96. package/src/TemplateManager/src/flowSchema/UploadS3Case/confirmReservedAfterUpload/handler/data.js +58 -0
  97. package/src/TemplateManager/src/flowSchema/UploadS3Case/confirmReservedAfterUpload/handler/template.ejs +126 -0
  98. package/src/TemplateManager/src/flowSchema/UploadS3Case/confirmReservedAfterUpload/mainFunction/data.js +51 -0
  99. package/src/TemplateManager/src/flowSchema/UploadS3Case/confirmReservedAfterUpload/mainFunction/template.ejs +121 -0
  100. package/src/TemplateManager/src/flowSchema/UploadS3Case/confirmReservedAfterUpload/queue/data.js +64 -0
  101. package/src/TemplateManager/src/flowSchema/UploadS3Case/confirmReservedAfterUpload/queue/template.ejs +45 -0
  102. package/src/TemplateManager/src/{flowTag/webSocket/websocketHandler → flowSchema/UploadS3Case/createObject}/functionYaml/data.js +42 -13
  103. package/src/TemplateManager/src/flowSchema/UploadS3Case/createObject/functionYaml/template.ejs +37 -0
  104. package/src/TemplateManager/src/flowSchema/UploadS3Case/createObject/handler/data.js +75 -0
  105. package/src/TemplateManager/src/flowSchema/UploadS3Case/createObject/handler/template.ejs +120 -0
  106. package/src/TemplateManager/src/{flowTag/webSocket/websocketHandler/handler → flowSchema/UploadS3Case/createObject/mainFunction}/data.js +11 -15
  107. package/src/TemplateManager/src/{flowTag/webSocket/websocketHandler → flowSchema/UploadS3Case/createObject}/mainFunction/template.ejs +4 -4
  108. package/src/TemplateManager/src/{flowTag/webSocket/webSocketComplete → flowSchema/UploadS3Case/createObjectComplete}/functionYaml/data.js +6 -4
  109. package/src/TemplateManager/src/flowSchema/UploadS3Case/createObjectComplete/functionYaml/template.ejs +30 -0
  110. package/src/TemplateManager/src/{flowTag/webSocket/webSocketComplete → flowSchema/UploadS3Case/createObjectComplete}/handler/data.js +1 -1
  111. package/src/TemplateManager/src/{flowTag/webSocket/webSocketComplete → flowSchema/UploadS3Case/createObjectComplete}/handler/template.ejs +10 -10
  112. package/src/TemplateManager/src/{flowTag/webSocket/webSocketComplete → flowSchema/UploadS3Case/createObjectComplete}/mainFunction/data.js +3 -4
  113. package/src/TemplateManager/src/flowSchema/UploadS3Case/createObjectComplete/mainFunction/template.ejs +86 -0
  114. package/src/TemplateManager/src/{flowTag/webSocket/webSocketComplete → flowSchema/UploadS3Case/createObjectComplete}/sns-sqs/data.js +4 -2
  115. package/src/TemplateManager/src/flowSchema/UploadS3Case/createObjectComplete/sns-sqs/template.ejs +49 -0
  116. package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/getsignUrlsAcc/functionYaml/data.js +85 -0
  117. package/src/TemplateManager/src/{flowTag/webSocket/webSocketComplete → flowSchema/UploadS3Case/createPresignUrl/getsignUrlsAcc}/functionYaml/template.ejs +1 -1
  118. package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/getsignUrlsAcc/handler/data.js +57 -0
  119. package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/getsignUrlsAcc/handler/template.ejs +120 -0
  120. package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/getsignUrlsAcc/mainFunction/data.js +51 -0
  121. package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/getsignUrlsAcc/mainFunction/template.ejs +164 -0
  122. package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/getsignUrlsAcc/sqs/data.js +65 -0
  123. package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/getsignUrlsAcc/sqs/template.ejs +53 -0
  124. package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/reservedLimitComplete/functionYaml/data.js +112 -0
  125. package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/reservedLimitComplete/functionYaml/template.ejs +30 -0
  126. package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/reservedLimitComplete/handler/data.js +57 -0
  127. package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/reservedLimitComplete/handler/template.ejs +126 -0
  128. package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/reservedLimitComplete/mainFunction/data.js +54 -0
  129. package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/reservedLimitComplete/mainFunction/template.ejs +254 -0
  130. package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/reservedLimitComplete/queue/data.js +64 -0
  131. package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/reservedLimitComplete/queue/template.ejs +45 -0
  132. package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode/handler/data.js +94 -0
  133. package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode/handler/templateAsyncHandler.ejs +110 -0
  134. package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode/handler/templateSyncHandler.ejs +49 -0
  135. package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode/hookLogic/data.js +44 -0
  136. package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode/mainFunction/data.js +66 -0
  137. package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode/mainFunction/template.ejs +7 -0
  138. package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode/queue/data.js +73 -0
  139. package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode/queue/snsTemplate.ejs +59 -0
  140. package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode/queue/sqsTemplate.ejs +43 -0
  141. package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode(old)/functionYaml/data.js +102 -0
  142. package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode(old)/functionYaml/template.ejs +43 -0
  143. package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode(old)/handler/data.js +94 -0
  144. package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode(old)/handler/templateAsyncHandler.ejs +110 -0
  145. package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode(old)/handler/templateSyncHandler.ejs +49 -0
  146. package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode(old)/hookLogic/data.js +65 -0
  147. package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode(old)/mainFunction/data.js +67 -0
  148. package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode(old)/mainFunction/template.ejs +30 -0
  149. package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode(old)/queue/data.js +125 -0
  150. package/src/TemplateManager/src/flowSchema/UploadS3Case/hookCode(old)/queue/snsTemplate.ejs +59 -0
  151. package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/functionYml/HdrDsq/data.js +87 -0
  152. package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/functionYml/HdrDsq/template.ejs +30 -0
  153. package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/functionYml/HdrS3/data.js +112 -0
  154. package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/functionYml/HdrS3/template.ejs +38 -0
  155. package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/handler/handlerDsq/data.js +45 -0
  156. package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/handler/handlerDsq/template.ejs +151 -0
  157. package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/handler/handlerS3/data.js +43 -0
  158. package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/handler/handlerS3/template.ejs +68 -0
  159. package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/mainFunction/data.js +43 -0
  160. package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/mainFunction/template.ejs +392 -0
  161. package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/queue/data.js +77 -0
  162. package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/queue/dsqTemplatePath.ejs +32 -0
  163. package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/queue/s3Template.ejs +59 -0
  164. package/src/TemplateManager/src/flowSchema/UploadS3Case/relate/S3/data.js +51 -0
  165. package/src/TemplateManager/src/flowSchema/UploadS3Case/relate/S3/template.ejs +13 -0
  166. package/src/TemplateManager/src/flowSchema/UploadS3Case/relate/libs/data.js +42 -0
  167. package/src/TemplateManager/src/flowSchema/UploadS3Case/relate/libs/template.ejs +137 -0
  168. package/src/TemplateManager/src/libs/Consts.js +89 -34
  169. package/src/TemplateManager/src/reStructureExample/GenerateCodeTest.js +31 -0
  170. package/src/TemplateManager/src/reStructureExample/TemplateConfig.js +11 -0
  171. package/src/TemplateManager/src/reStructureExample/TemplateData/perAction/data.js +0 -0
  172. package/src/TemplateManager/src/reStructureExample/TemplateData/perAction/generateCodeShared.js +1 -0
  173. package/src/TemplateManager/src/reStructureExample/TemplateData/perAction/generatePerAction.js +5 -0
  174. package/src/TemplateManager/src/reStructureExample/TemplateData/perAction/template.ejs +0 -0
  175. package/src/TemplateManager/src/flowTag/webSocket/webSocketComplete/mainFunction/template.ejs +0 -180
  176. /package/src/TemplateManager/src/{flowTag/resources/dynamoDb/data.js → flowSchema/DefaultWebSocketResource/dynamoDb/WebSocketTaskData.js} +0 -0
  177. /package/src/TemplateManager/src/{flowTag/webSocket → flowSchema/DefaultWebSocketResource}/webSocketConnect/functionYaml/template.ejs +0 -0
  178. /package/src/TemplateManager/src/{flowTag/webSocket → flowSchema/DefaultWebSocketResource}/webSocketConnect/handler/template.ejs +0 -0
  179. /package/src/TemplateManager/src/{flowTag/webSocket/webSocketComplete/sns-sqs/template.ejs → flowSchema/UploadS3Case/hookCode(old)/queue/sqsTemplate.ejs} +0 -0
@@ -6,20 +6,7 @@
6
6
  - sqs:
7
7
  arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>
8
8
  batchSize: 10
9
- iamRoleStatements:
10
- <%_ additionalResourcePermission.forEach(resourcePermission => { _%>
11
- - Effect: <%- resourcePermission.effect %>
12
- Action:
13
- <%_ Object.keys(resourcePermission.action).forEach(resourcePerAction => { _%>
14
- <%_ resourcePermission.action[resourcePerAction].forEach(permission => { _%>
15
- - <%- resourcePerAction %>:<%- permission %>
16
- <%_}) _%>
17
- <%_ }) _%>
18
- Resource:
19
- <%_ resourcePermission.resource.forEach(resource => { _%>
20
- - <%- resource %>
21
- <%_ }) _%>
22
- <%_}) _%>
9
+ role: <%- roleName %>Role
23
10
  #<#<%- functionName %><%- handlerType %>IamRole#>
24
11
  #<#/<%- functionName %><%- handlerType %>IamRole#>
25
12
  <%_ function firstLetterUpperCase(text){
@@ -0,0 +1,270 @@
1
+ /*
2
+ Copyright (C) 2020 Sven Mason <http://izara.io>
3
+ This program is free software: you can redistribute it and/or modify
4
+ it under the terms of the GNU Affero General Public License as
5
+ published by the Free Software Foundation, either version 3 of the
6
+ License, or (at your option) any later version.
7
+ This program is distributed in the hope that it will be useful,
8
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
9
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
+ GNU Affero General Public License for more details.
11
+ You should have received a copy of the GNU Affero General Public License
12
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
13
+ */
14
+ 'use strict';
15
+ const { SOURCE_GENERATE_IAM_ROLE, SOURCE_PATH, SAVE_FILE_NAME } = require('../libs/Consts');
16
+ const { firstLetterUpperCase: upperCase } = require("../../../MainLibs/src/Utils")
17
+ const path = require('path');
18
+
19
+ /**
20
+ * Process additional resource permissions for an object type
21
+ * @param {Array} resourcePermissions - Array of resource permissions to process
22
+ * @param {Object} targetResources - Resources object to update
23
+ */
24
+ const processResourcePermissions = (resourcePermissions, targetResources) => {
25
+ if (!Array.isArray(resourcePermissions)) return;
26
+ resourcePermissions.forEach(resourcePermission => {
27
+ if (!resourcePermission.action) return;
28
+ const [key, value] = Object.entries(resourcePermission.action)[0];
29
+ if (!targetResources[key]) {
30
+ targetResources[key] = [];
31
+ }
32
+ const actionsList = Array.isArray(value) ? value : [value];
33
+ const resourcesList = Array.isArray(resourcePermission.resource)
34
+ ? resourcePermission.resource
35
+ : [resourcePermission.resource];
36
+ // Check if entry with same actions exists
37
+ const existingEntry = targetResources[key].find(entry =>
38
+ JSON.stringify(entry.actions) === JSON.stringify(actionsList)
39
+ );
40
+ if (existingEntry) {
41
+ // Merge resources without duplicates
42
+ existingEntry.resource = [
43
+ ...new Set([...existingEntry.resource, ...resourcesList])
44
+ ];
45
+ } else {
46
+ // Add new entry
47
+ targetResources[key].push({
48
+ actions: actionsList,
49
+ resource: resourcesList
50
+ });
51
+ }
52
+ });
53
+ };
54
+ /**
55
+ * Check if an item should be skipped based on templateData content
56
+ * @param {Object} templateData - Template data to check
57
+ * @returns {Boolean} True if item should be skipped
58
+ */
59
+ const shouldSkipItem = (templateData) => {
60
+ return !templateData ||
61
+ Object.keys(templateData).length === 0 ||
62
+ !templateData.additionalResourcePermission;
63
+ };
64
+ /**
65
+ * Initialize object type structure if it doesn't exist
66
+ * @param {Object} groupedByObjectType - The grouped object
67
+ * @param {String} objectType - Object type to initialize
68
+ * @param {Array} objectTypeList - List to track object types
69
+ */
70
+ const initializeObjectType = (groupedByObjectType, objectType, objectTypeList) => {
71
+ if (!groupedByObjectType[objectType]) {
72
+ groupedByObjectType[objectType] = {
73
+ functionNames: [],
74
+ actions: [],
75
+ resources: {},
76
+ actionHandler: []
77
+ };
78
+ objectTypeList.push(objectType);
79
+ }
80
+ };
81
+ module.exports.createSharedResource = (_izContext, createSourceParams, srcPath) => {
82
+ // Initialize data structure
83
+ const groupedByObjectType = {
84
+ [SOURCE_GENERATE_IAM_ROLE.ProcessFindDataRole]: {
85
+ handlerType: [],
86
+ resources: {}
87
+ },
88
+ [SOURCE_GENERATE_IAM_ROLE.ObjectCompleteRole]: {
89
+ functionNames: [],
90
+ handlerType: [],
91
+ resources: {}
92
+ },
93
+ [SOURCE_GENERATE_IAM_ROLE.RelationshipRole]: {
94
+ handlerType: [],
95
+ resources: {}
96
+ },
97
+ [SOURCE_GENERATE_IAM_ROLE.RelationshipCompleteRole]: {
98
+ handlerType: [],
99
+ resources: []
100
+ },
101
+ Other: []
102
+ };
103
+ const objectTypeList = [];
104
+ // Ensure data is defined - assuming it comes from createSourceParams
105
+ const data = createSourceParams || [];
106
+ // Process each item in data
107
+ data.map((item) => {
108
+ const templateData = item.templateData;
109
+ if (shouldSkipItem(templateData)) return;
110
+ if (templateData.objectType) {
111
+ // Handle items with objectType
112
+ initializeObjectType(groupedByObjectType, templateData.objectType, objectTypeList);
113
+ // Add function name if it doesn't exist
114
+ if (templateData.functionName &&
115
+ !groupedByObjectType[templateData.objectType].functionNames?.includes(templateData.functionName)) {
116
+ groupedByObjectType[templateData.objectType].functionNames.push(templateData.functionName);
117
+ }
118
+ // Add action if it doesn't exist
119
+ if (templateData.action !== null &&
120
+ !groupedByObjectType[templateData.objectType].actions.includes(templateData.action)) {
121
+ groupedByObjectType[templateData.objectType].actions.push(templateData.action);
122
+ }
123
+ // Process additionalResourcePermission
124
+ processResourcePermissions(
125
+ templateData.additionalResourcePermission,
126
+ groupedByObjectType[templateData.objectType].resources
127
+ );
128
+ }
129
+ else if (templateData.functionName &&
130
+ (templateData.functionName.includes('ObjectComplete') ||
131
+ templateData.functionName.includes('NodeComplete'))) {
132
+ // Handle ObjectComplete items
133
+ groupedByObjectType[SOURCE_GENERATE_IAM_ROLE.ObjectCompleteRole].functionNames.push(templateData.functionName);
134
+ groupedByObjectType[SOURCE_GENERATE_IAM_ROLE.ObjectCompleteRole].handlerType.push(templateData.handlerType);
135
+ processResourcePermissions(
136
+ templateData.additionalResourcePermission,
137
+ groupedByObjectType[SOURCE_GENERATE_IAM_ROLE.ObjectCompleteRole].resources
138
+ );
139
+ }
140
+ else if (templateData.functionName && templateData.functionName.includes([SOURCE_GENERATE_IAM_ROLE.RelationshipRole])) {
141
+ if (templateData.functionName.includes([SOURCE_GENERATE_IAM_ROLE.RelationshipCompleteRole])) {
142
+ // Handle RelationshipComplete items
143
+ if (templateData.handlerType &&
144
+ !groupedByObjectType[SOURCE_GENERATE_IAM_ROLE.RelationshipCompleteRole].handlerType.includes(templateData.handlerType)) {
145
+ groupedByObjectType[SOURCE_GENERATE_IAM_ROLE.RelationshipCompleteRole].handlerType.push(templateData.handlerType);
146
+ }
147
+ processResourcePermissions(
148
+ templateData.additionalResourcePermission,
149
+ groupedByObjectType[SOURCE_GENERATE_IAM_ROLE.RelationshipCompleteRole].resources
150
+ );
151
+ } else {
152
+ // Handle regular Relationship items
153
+ if (templateData.handlerType &&
154
+ !groupedByObjectType[SOURCE_GENERATE_IAM_ROLE.RelationshipRole].handlerType.includes(templateData.handlerType)) {
155
+ groupedByObjectType[SOURCE_GENERATE_IAM_ROLE.RelationshipRole].handlerType.push(templateData.handlerType);
156
+ }
157
+ processResourcePermissions(
158
+ templateData.additionalResourcePermission,
159
+ groupedByObjectType[SOURCE_GENERATE_IAM_ROLE.RelationshipRole].resources
160
+ );
161
+ }
162
+ }
163
+ else if (templateData.functionName &&
164
+ (templateData.functionName.includes('PaginateProcessLogical') ||
165
+ templateData.functionName.includes('FindData') ||
166
+ templateData.functionName.includes('ProcessLogical'))) {
167
+ // Handle ProcessFindData items
168
+ groupedByObjectType.ProcessFindData.handlerType.push(templateData.handlerType);
169
+ processResourcePermissions(
170
+ templateData.additionalResourcePermission,
171
+ groupedByObjectType.ProcessFindData.resources
172
+ );
173
+ }
174
+ else {
175
+ // Handle other items
176
+ groupedByObjectType.Other.push(item);
177
+ }
178
+ return item;
179
+ });
180
+ // Process "Other" items that might belong to existing object types
181
+ groupedByObjectType.Other = groupedByObjectType.Other.filter(item => {
182
+ const templateData = item.templateData;
183
+ if (!templateData.functionName) return true;
184
+ // Find matching objectType
185
+ const matchedObjectType = objectTypeList.find(objectType =>
186
+ templateData.functionName.toLowerCase().includes(objectType.toLowerCase()) ||
187
+ templateData.functionName.includes(objectType.charAt(0).toUpperCase() + objectType.slice(1))
188
+ );
189
+ if (matchedObjectType) {
190
+ // Move the item to the matched object type
191
+ groupedByObjectType[matchedObjectType].actionHandler.push(templateData.handlerType);
192
+ groupedByObjectType[matchedObjectType].resources = {
193
+ ...groupedByObjectType[matchedObjectType].resources,
194
+ ...templateData.additionalResourcePermission
195
+ };
196
+ return false; // Remove from Other
197
+ }
198
+ return true; // Keep in Other
199
+ });
200
+ // Prepare results
201
+
202
+
203
+ // Process and prepare data for role definitions and extract any resources
204
+ // that might be related to object types but weren't categorized properly
205
+ const roles = [];
206
+ const otherResources = []
207
+ Object.entries(groupedByObjectType).forEach(([objectType, data]) => {
208
+ if (objectType === 'Other' || !data.resources) return;
209
+ // สร้าง policy statements จาก resources
210
+ const rolePolicyStatement = [];
211
+ Object.entries(data.resources).forEach(([effect, permissionList]) => {
212
+ if (!Array.isArray(permissionList)) {
213
+ // permissionList might be in a different format
214
+ if (typeof permissionList === 'object' && !Array.isArray(permissionList)) {
215
+ // Handle non-standard format
216
+ const actions = [];
217
+ if (permissionList.action) {
218
+ const actionObj = permissionList.action;
219
+ Object.entries(actionObj).forEach(([service, actionList]) => {
220
+ const actionArray = Array.isArray(actionList) ? actionList : [actionList];
221
+ actionArray.forEach(action => actions.push(`${service}:${action}`));
222
+ });
223
+ }
224
+ rolePolicyStatement.push({
225
+ Effect: permissionList.effect || 'Allow',
226
+ Action: actions,
227
+ Resource: permissionList.resource
228
+ });
229
+ return;
230
+ }
231
+ rolePolicyStatement.push({
232
+ Effect: permissionList.effect,
233
+ Action: actions,
234
+ Resource: permission.resource
235
+ });
236
+ return;
237
+ };
238
+ permissionList.forEach(permission => {
239
+ const actions = permission.actions.map(action => `${effect}:${action}`);
240
+ rolePolicyStatement.push({
241
+ Effect: 'Allow',
242
+ Action: actions,
243
+ Resource: permission.resource
244
+ });
245
+ });
246
+ });
247
+ if (rolePolicyStatement.length > 0) {
248
+ roles.push({
249
+ roleName: upperCase(objectType),
250
+ rolePolicyStatement
251
+ });
252
+ }
253
+ });
254
+ const reformattedData = {
255
+ roles,
256
+ };
257
+ const sharedResourceTemplatePath = path.join(__dirname, './sharedResourceTemplate.ejs')
258
+
259
+ return {
260
+ templatePath: sharedResourceTemplatePath,
261
+ templateData: reformattedData,
262
+ setting: {
263
+ initialData: 'Resources:\n',
264
+ savePath: path.join(srcPath, SOURCE_PATH.appYaml),
265
+ saveFileName: SAVE_FILE_NAME.sharedResourceYaml,
266
+ fileExtension: '.yml',
267
+ isAppend: true
268
+ }
269
+ }
270
+ };
@@ -0,0 +1,58 @@
1
+ #IAM Role for Upload Schema functionality
2
+ UploadSchemaRole:
3
+ Type: AWS::IAM::Role
4
+ Properties:
5
+ RoleName: ${self:custom.iz_resourcePrefix}UploadSchemaRole
6
+ AssumeRolePolicyDocument:
7
+ Version: "2012-10-17"
8
+ Statement:
9
+ - Effect: Allow
10
+ Principal:
11
+ Service: "lambda.amazonaws.com"
12
+ Action: sts:AssumeRole
13
+ # this is the managed policy for lambda basic execution ex. logging to cloudwatch
14
+ ManagedPolicyArns:
15
+ - arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
16
+ - arn:aws:iam::${self:custom.iz_accountId}:policy/UploadSchemaSharedPolicy
17
+ Policies:
18
+ - PolicyName: ${self:custom.iz_resourcePrefix}UploadSchemaPolicy
19
+ PolicyDocument:
20
+ Version: "2012-10-17"
21
+ Statement:
22
+ - Effect: Allow
23
+ Action:
24
+ - s3:PutObject
25
+ - s3:GetObject
26
+ - s3:ListBucket
27
+ Resource:
28
+ - arn:aws:s3:::object-schema/*
29
+ - arn:aws:s3:::object-schema/perServiceSchemas/${self:custom.iz_serviceTag}/*
30
+ <% if (roles && roles.length > 0) { -%>
31
+ <% roles.forEach(function(role) { %>
32
+ <%= role.roleName %>Role:
33
+ Type: AWS::IAM::Role
34
+ Properties:
35
+ RoleName: ${self:custom.iz_resourcePrefix}<%= role.roleName %>Role
36
+ AssumeRolePolicyDocument:
37
+ Version: "2012-10-17"
38
+ Statement:
39
+ - Effect: Allow
40
+ Principal:
41
+ Service: "lambda.amazonaws.com"
42
+ Action: sts:AssumeRole
43
+ ManagedPolicyArns:
44
+ - arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
45
+ Policies:
46
+ - PolicyName: ${self:custom.iz_resourcePrefix}<%= role.roleName %>Policy
47
+ PolicyDocument:
48
+ Version: "2012-10-17"
49
+ Statement:<% role.rolePolicyStatement.forEach(function(statement) { %>
50
+ - Effect: <%= statement.Effect %><%_ if (Array.isArray(statement.Action)) { %>
51
+ Action:<% statement.Action.forEach(function(action) { %>
52
+ - <%= action %><% }); %><% } else { %>Action: <%= statement.Action %><% } -%>
53
+ <% if (Array.isArray(statement.Resource)) { %>
54
+ Resource:<% statement.Resource.forEach(function(resource) { %>
55
+ - <%= resource -%><% }); %><% } else { %>
56
+ Resource: <%= statement.Resource %><% } %><% }); %>
57
+ <% }); %>
58
+ <% } %>
@@ -50,7 +50,7 @@ function createTranslateIdFunctionYamlHdrDsq(srcPath) {
50
50
  ],
51
51
  [RESOURCE_CLASSES.sns]:
52
52
  [
53
- SNS_RESOURCE.publish, SNS_RESOURCE.subscription
53
+ SNS_RESOURCE.publish, SNS_RESOURCE.subscribe
54
54
  ]
55
55
  },
56
56
  [
@@ -50,7 +50,7 @@ function createTranslateIdFunctionYmlHdrSqs(srcPath) {
50
50
  ],
51
51
  [RESOURCE_CLASSES.sns]:
52
52
  [
53
- SNS_RESOURCE.publish, SNS_RESOURCE.subscription
53
+ SNS_RESOURCE.publish, SNS_RESOURCE.subscribe
54
54
  ]
55
55
  },
56
56
  [
@@ -25,12 +25,12 @@ const { getGraphServiceNameFromGraphServerTagWithCache,
25
25
  } = require('@izara_project/izara-core-library-service-schemas/src/ServiceConfig')
26
26
 
27
27
  const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../MainLibs/src/Utils")
28
- const { DEFAULT_HANDLER_PER_ACTION, createIamRole, RESOURCE_CLASSES, SOURCE_PATH, externalResourceName, externalResourceSns, getGraphServiceNameFromAllRelSchema, SAVE_FILE_NAME, LAMBDA_RESOURCE, SNS_RESOURCE, getGraphServiceNameFromObjectSchema, shortNameHandler, SHORT_FUNCTION_NAME, defaultIamRolePerAction } = require("../../libs/Consts");
28
+ const { DEFAULT_HANDLER_PER_ACTION, createIamRole, RESOURCE_CLASSES, SOURCE_PATH, externalResourceName, getGraphServiceNameFromAllRelSchema, SAVE_FILE_NAME, LAMBDA_RESOURCE, SNS_RESOURCE, getGraphServiceNameFromObjectSchema, shortNameHandler, SHORT_FUNCTION_NAME, defaultIamRolePerAction, resourceNames } = require("../../libs/Consts");
29
29
  // const templatePath = path.join(__dirname, "./template.ejs");
30
30
  const templatePath = path.join(__dirname, "./template.ejs");
31
31
  const { getAllLocalRelationshipSchemas } = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema')
32
-
33
- const createExternalLambdaRole = async (_izContext, allObjSchemas, allRelSchemas, srcPath) => {
32
+ const { EXTERNAL_SERVICE_NAME } = require("../../../../GenerateCodeLibs/src/Consts")
33
+ const createExternalLambdaRole = async (_izContext, allObjSchemas, allRelSchemas, allLocalFlowSchemas, srcPath) => {
34
34
  const allRelationshipSchemas = getAllLocalRelationshipSchemas(_izContext, srcPath)
35
35
  // console.log("allRelationshipSchemas", allRelationshipSchemas);
36
36
  const externalLambdaIamRoleArray = [];
@@ -88,7 +88,25 @@ const createExternalLambdaRole = async (_izContext, allObjSchemas, allRelSchemas
88
88
  externalLambdaIamRoleProcessLogical && externalLambdaIamRoleArray.push(externalLambdaIamRoleProcessLogical)
89
89
  }
90
90
 
91
- console.log("externalLambdaIamRoleArray", externalLambdaIamRoleArray)
91
+ if (allLocalFlowSchemas) {
92
+ for (const localFlowSchema of allLocalFlowSchemas) {
93
+ if (localFlowSchema.hasOwnProperty("uploadS3") && localFlowSchema.uploadS3 === true) {
94
+ const externalLambdaIamRoleGetPresignUrl = await externalLambdaIamRoleDataGetPresignUrl(_izContext);
95
+ externalLambdaIamRoleGetPresignUrl && externalLambdaIamRoleArray.push(externalLambdaIamRoleGetPresignUrl);
96
+
97
+ const externalLambdaIamRoleReservedLimitComplete = await externalLambdaIamRoleDataReservedLimitComplete(_izContext);
98
+ externalLambdaIamRoleReservedLimitComplete && externalLambdaIamRoleArray.push(externalLambdaIamRoleReservedLimitComplete);
99
+
100
+ const externalLambdaIamRoleProcessAfterUpload = await externalLambdaIamRoleDataProcessAfterUpload(_izContext);
101
+ externalLambdaIamRoleProcessAfterUpload && externalLambdaIamRoleArray.push(externalLambdaIamRoleProcessAfterUpload);
102
+
103
+ const externalLambdaIamRoleConfirmReservedAfterUpload = await externalLambdaIamRoleDataConfirmReservedAfterUpload(_izContext);
104
+ externalLambdaIamRoleConfirmReservedAfterUpload && externalLambdaIamRoleArray.push(externalLambdaIamRoleConfirmReservedAfterUpload);
105
+ }
106
+ }
107
+ }
108
+
109
+ // console.log("externalLambdaIamRoleArray", externalLambdaIamRoleArray)
92
110
  // console.log("createSourceArrayIamRole", JSON.stringify(externalLambdaIamRoleArray))
93
111
  // return externalLambdaIamRoleArray
94
112
 
@@ -141,7 +159,7 @@ async function externalLambdaIamRoleDataPerAction(_izContext, objectSchema, acti
141
159
  [RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
142
160
  },
143
161
  graphServiceNames.map(graphServiceName =>
144
- externalResourceSns("InUpdateNode", graphServiceName)
162
+ externalResourceName(RESOURCE_CLASSES.sns, "InUpdateNode", graphServiceName)
145
163
  )
146
164
  )
147
165
  )
@@ -153,7 +171,7 @@ async function externalLambdaIamRoleDataPerAction(_izContext, objectSchema, acti
153
171
  [RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
154
172
  },
155
173
  graphServiceNames.map(graphServiceName =>
156
- externalResourceSns("InCreateNodeV2", graphServiceName)
174
+ externalResourceName(RESOURCE_CLASSES.sns, "InCreateNodeV2", graphServiceName)
157
175
  )
158
176
  )
159
177
  )
@@ -197,7 +215,7 @@ async function externalLambdaIamRoleDataUpdateRelationshipSchema(_izContext, all
197
215
  [RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
198
216
  },
199
217
  graphServiceNamesFromAllRelSchemas.map(graphServiceName =>
200
- externalResourceSns("InUpdateRelationship", graphServiceName)
218
+ externalResourceName(RESOURCE_CLASSES.sns, "InUpdateRelationship", graphServiceName)
201
219
  )
202
220
  )
203
221
  )
@@ -222,7 +240,7 @@ async function externalLambdaIamRoleDataCreateRelationshipSchema(_izContext, all
222
240
  [RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
223
241
  },
224
242
  graphServiceNamesFromAllRelSchemas.map(graphServiceName =>
225
- externalResourceSns("InCreateRelationshipV2", graphServiceName)
243
+ externalResourceName(RESOURCE_CLASSES.sns, "InCreateRelationshipV2", graphServiceName)
226
244
  )
227
245
  )
228
246
  )
@@ -244,7 +262,7 @@ async function externalLambdaIamRoleDataDeleteRelationshipSchema(_izContext, all
244
262
  [RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
245
263
  },
246
264
  graphServiceNamesFromAllRelSchemas.map(graphServiceName =>
247
- externalResourceSns("InDeleteRelationshipV2", graphServiceName)
265
+ externalResourceName(RESOURCE_CLASSES.sns, "InDeleteRelationshipV2", graphServiceName)
248
266
  )
249
267
  )
250
268
  )
@@ -297,4 +315,96 @@ async function externalLambdaIamRoleDataProcessLogical(_izContext, allObjectSche
297
315
  }
298
316
  }
299
317
 
318
+ function externalLambdaIamRoleDataGetPresignUrl(_izContext) {
319
+ let functionName = "GetPresignUrl" + upperCase(shortNameHandler(HANDLER.hdrSqs));
320
+ let additionalResourcePermission = [];
321
+
322
+ additionalResourcePermission.push(
323
+ createIamRole(
324
+ {
325
+ [RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
326
+ },
327
+ [
328
+ externalResourceName(RESOURCE_CLASSES.sns, "InReservedDynamicUsage", EXTERNAL_SERVICE_NAME.accountLimits)
329
+ ]
330
+ ),
331
+ createIamRole(
332
+ {
333
+ [RESOURCE_CLASSES.lambda]: [LAMBDA_RESOURCE.invokeFunction]
334
+ },
335
+ [
336
+ externalResourceName(RESOURCE_CLASSES.lambda, "StaticLimitProcessHdrInv", EXTERNAL_SERVICE_NAME.accountLimits)
337
+ ]
338
+ )
339
+ )
340
+ // console.log("additionalResourcePermission GetPresignUrl::", JSON.stringify(additionalResourcePermission))
341
+ return {
342
+ functionName,
343
+ additionalResourcePermission
344
+ }
345
+ }
346
+
347
+ function externalLambdaIamRoleDataReservedLimitComplete(_izContext) {
348
+ let functionName = "ReservedLimitComp" + upperCase(shortNameHandler(HANDLER.hdrSqs));
349
+ let additionalResourcePermission = [];
350
+
351
+ additionalResourcePermission.push(
352
+ createIamRole(
353
+ {
354
+ [RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
355
+ },
356
+ [
357
+ externalResourceName(RESOURCE_CLASSES.sns, "InCancelUsage", EXTERNAL_SERVICE_NAME.accountLimits)
358
+ ]
359
+ )
360
+ )
361
+ return {
362
+ functionName,
363
+ additionalResourcePermission
364
+ }
365
+ }
366
+
367
+ function externalLambdaIamRoleDataConfirmReservedAfterUpload(_izContext) {
368
+ let functionName = "ConfirmNewReserved" + upperCase(shortNameHandler(HANDLER.hdrSqs));
369
+ let additionalResourcePermission = []
370
+
371
+ additionalResourcePermission.push(
372
+ createIamRole(
373
+ {
374
+ [RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
375
+ },
376
+ [
377
+ externalResourceName(RESOURCE_CLASSES.sns, "OutReservedDynamicUsageComplet", EXTERNAL_SERVICE_NAME.accountLimits),
378
+ externalResourceName(RESOURCE_CLASSES.sns, "InConfirmUsage", EXTERNAL_SERVICE_NAME.accountLimits)
379
+ ]
380
+ ),
381
+ )
382
+ return {
383
+ functionName,
384
+ additionalResourcePermission
385
+ }
386
+ }
387
+
388
+ function externalLambdaIamRoleDataProcessAfterUpload(_izContext) {
389
+ let functionName = "ProcessAfterUploadS3" + shortNameHandler(upperCase("HdrS3"));
390
+ let additionalResourcePermission = []
391
+
392
+ additionalResourcePermission.push(
393
+ createIamRole(
394
+ {
395
+ [RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
396
+ },
397
+ [
398
+ externalResourceName(RESOURCE_CLASSES.sns, "InCancelUsage", EXTERNAL_SERVICE_NAME.accountLimits),
399
+ externalResourceName(RESOURCE_CLASSES.sns, "InConfirmUsage", EXTERNAL_SERVICE_NAME.accountLimits),
400
+ externalResourceName(RESOURCE_CLASSES.sns, "InReservedDynamicUsage", EXTERNAL_SERVICE_NAME.accountLimits),
401
+ ]
402
+ )
403
+ )
404
+ return {
405
+ functionName,
406
+ additionalResourcePermission
407
+ }
408
+ }
409
+
300
410
  module.exports = createExternalLambdaRole;
@@ -41,12 +41,11 @@ module.exports.generatedLambdaRole = async () => {
41
41
  <%_ resourcePermission.action[resourcePerAction].forEach(permission => { _%>
42
42
  "<%- resourcePerAction %>:<%- permission %>",
43
43
  ],
44
- "Resource":
44
+ "Resource":[
45
45
  <%_ resourcePermission.resource.forEach(resource => { _%>
46
- [
47
46
  `<%- resource _%>`,
48
- ],
49
- <%_ }) _%>
47
+ <%_ }) _%>
48
+ ]
50
49
  <%_ }) _%>
51
50
  <%_ }) _%>
52
51
  }<% if(resourceIdx < data.additionalResourcePermission.length-1) {_%>, <%_} %>
@@ -23,14 +23,11 @@ const { ACTIONS, HANDLER, STORAGE_TYPES } = require('@izara_project/izara-core-l
23
23
  const { getGraphServiceNameFromGraphServerTagWithCache, getServiceNameWithCache } = require('@izara_project/izara-core-library-service-schemas/src/ServiceConfig')
24
24
  const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../MainLibs/src/Utils")
25
25
  const { DEFAULT_HANDLER_PER_ACTION, createIamRole, resourceNames, RESOURCE_CLASSES, DEFAULT_LAMBDA_ROLE_PER_ACTION, SOURCE_PATH, externalResourceName, getGraphServiceNameFromAllRelSchema, FUNCTION_NAME, SAVE_FILE_NAME, getGraphServiceNameFromObjectSchema } = require("../../libs/Consts");
26
- const {
27
- TOPIC_NAME_GRAPH_HANDLER,
28
- TOPIC_NAME_GENERATE_CODE
29
- } = require('../../../../GenerateCodeLibs/src/Consts')
26
+ const { TOPIC_NAME_GRAPH_HANDLER, TOPIC_NAME_GENERATE_CODE, EXTERNAL_SERVICE_NAME, TOPIC_NAME_EXTERNAL_SERVICE } = require('../../../../GenerateCodeLibs/src/Consts')
30
27
  const templatePath = path.join(__dirname, "./template.ejs");
31
28
 
32
29
 
33
- const createExternalSnsSubscriptions = async (_izContext, allObjSchemas, allRelSchemas, srcPath) => {
30
+ const createExternalSnsSubscriptions = async (_izContext, allObjSchemas, allRelSchemas, allLocalFlowSchemas, srcPath) => {
34
31
  const snsServiceConfigArray = [];
35
32
 
36
33
  const snsServiceConfigUpdateRelationshipComplete = await snsSubScriptionUpdateRelationshipComplete(_izContext, allRelSchemas)
@@ -51,7 +48,18 @@ const createExternalSnsSubscriptions = async (_izContext, allObjSchemas, allRelS
51
48
  const snsServiceConfigDeleteNodeComplete = await snsSubscriptionDeleteNodeComplate(_izContext, allObjSchemas)
52
49
  snsServiceConfigDeleteNodeComplete && snsServiceConfigArray.push(snsServiceConfigDeleteNodeComplete);
53
50
 
51
+ if (allLocalFlowSchemas) {
52
+ for (const flowSchema of allLocalFlowSchemas) {
53
+ if (flowSchema.hasOwnProperty("uploadS3") && flowSchema.uploadS3 === true) {
54
+ const snsServiceConfigForReservedDynamicUsage = await snsSubscriptionReservedLimitCompleteForReservedDynamicUsage(_izContext);
55
+ snsServiceConfigForReservedDynamicUsage && snsServiceConfigArray.push(snsServiceConfigForReservedDynamicUsage);
54
56
 
57
+ const snsServiceConfigForConfirmReserved = await snsSubscriptionConfirmReserved(_izContext);
58
+ snsServiceConfigForConfirmReserved && snsServiceConfigArray.push(snsServiceConfigForConfirmReserved);
59
+ }
60
+ }
61
+ }
62
+ // console.log("snsServiceConfigArray::", snsServiceConfigArray)
55
63
 
56
64
  return {
57
65
  templatePath: templatePath,
@@ -129,7 +137,24 @@ async function snsSubscriptionDeleteRelatipnshipComplete(_izContext, allRelSchem
129
137
  sqsEndpoint: TOPIC_NAME_GENERATE_CODE.deleteRelComplete
130
138
  }
131
139
  }
132
- // not done yet wait for comfirmation
133
140
 
141
+ function snsSubscriptionReservedLimitCompleteForReservedDynamicUsage(_izContext) {
142
+ let serviceNames = [EXTERNAL_SERVICE_NAME.accountLimits]
143
+ return {
144
+ serviceNames: serviceNames,
145
+ topicName: TOPIC_NAME_EXTERNAL_SERVICE.reservedDynamicUsageComplete,
146
+ sqsEndpoint: TOPIC_NAME_GENERATE_CODE.reservedLimitComplete + upperCase(HANDLER.hdrSqs)
147
+ }
148
+ }
149
+
150
+
151
+ function snsSubscriptionConfirmReserved(_izContext) {
152
+ let serviceNames = [EXTERNAL_SERVICE_NAME.accountLimits];
153
+ return {
154
+ serviceNames: serviceNames,
155
+ topicName: TOPIC_NAME_EXTERNAL_SERVICE.reservedDynamicUsageComplete,
156
+ sqsEndpoint: "ConfirmNewReserved" + upperCase(HANDLER.hdrSqs)
157
+ }
158
+ }
134
159
 
135
160
  module.exports = createExternalSnsSubscriptions;