@izara_project/izara-core-generate-service-code 1.0.53 → 1.0.55

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 (146) hide show
  1. package/package.json +1 -2
  2. package/src/codeGenerators/app/initial_setup/InitialSetupGenerator.js +1 -1
  3. package/src/codeGenerators/app/sls_yaml/FindDataYamlGenerator.js +23 -0
  4. package/src/codeGenerators/app/sls_yaml/FunctionYamlGenerator.js +16 -16
  5. package/src/codeGenerators/app/sls_yaml/ProcessLogicalYamlGenerator.js +11 -25
  6. package/src/codeGenerators/app/sls_yaml/RoleNameConfigGenerator.js +1 -1
  7. package/src/codeGenerators/app/sls_yaml/SharedResourceYamlGenerator.js +3 -3
  8. package/src/codeGenerators/app/sls_yaml/renderYamlTemplate.js +13 -0
  9. package/src/codeGenerators/app/sls_yaml/templates/SharedResource_Yaml.ejs +6 -2
  10. package/src/codeGenerators/app/src/generatedCode/FindData/FindDataGenerator.js +10 -44
  11. package/src/codeGenerators/app/src/generatedCode/Flow/FlowEndpoints/EndpointsGenerator.js +119 -0
  12. package/src/codeGenerators/app/src/generatedCode/Flow/FlowRbac/RbacFlowGenerator.js +91 -52
  13. package/src/codeGenerators/app/src/generatedCode/Flow/FlowRelationshipEndpoints/RelationshipFlowGenerator.js +20 -16
  14. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/StatusFieldGenerator.js +2 -9
  15. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/WebSocketGenerator.js +1 -7
  16. package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/BaseSqsHandler.js +3 -3
  17. package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/s3Components/ConfirmAfterUploadS3Generator.js +2 -4
  18. package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/s3Components/CreateObjectGenerator.js +2 -4
  19. package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/s3Components/CreatePreSignUrlGenerator.js +2 -4
  20. package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/s3Components/ProcessAfterUploadS3Generator.js +5 -5
  21. package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/s3Components/ReservedLimitGenerator.js +2 -4
  22. package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowEntryPointBase.js +6 -6
  23. package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowMainFunctionBase.js +3 -3
  24. package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowStepBase.js +11 -11
  25. package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/triggerCacheBase.js +1 -7
  26. package/src/codeGenerators/app/src/generatedCode/ProcessLogical/ProcessLogicalGenerator.js +18 -15
  27. package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/{PaginateProcessLogical_HdrDsq.js → PaginateProcessLogical_HdrDsq.ejs} +1 -1
  28. package/src/codeGenerators/app/src/generatedCode/SystemFlowSchemas/RegisterGenerator.js +127 -149
  29. package/src/codeGenerators/app/src/generatedCode/libs/ConstsGenerator.js +16 -8
  30. package/src/codeGenerators/app/src/generatedCode/libs/GenerateCodeLibsGenerator.js +17 -9
  31. package/src/codeGenerators/resource/sls_yaml/DynamoDBGenerator.js +8 -8
  32. package/src/codeGenerators/resource/sls_yaml/FlowOutGenerator.js +60 -43
  33. package/src/codeGenerators/resource/sls_yaml/FlowResourceYamlGenerator.js +151 -151
  34. package/src/codeGenerators/resource/sls_yaml/templates/crud/ResourceYaml.ejs +10 -10
  35. package/src/core/renderTemplateFile.js +22 -0
  36. package/src/generateCode.js +146 -81
  37. package/src/generateIntTest.js +45 -69
  38. package/src/generateResourceIntTest.js +22 -47
  39. package/src/intTestGeneratorShared.js +36 -0
  40. package/src/schemaGenerators/app/src/schemas/FlowSchemas/templates/DynamicFlowSchemaTemplate.ejs +12 -10
  41. package/src/schemaGenerators/app/src/schemas/FlowSchemas/templates/RelationshipFlowSchemaTemplate.ejs +6 -5
  42. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/flowSchemaMainFunction/data.js +0 -119
  43. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/flowSchemaMainFunction/template.ejs +0 -89
  44. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/flowSchemaMainFunction/templateByStatusType/statusFieldTemplate.ejs +0 -30
  45. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/flowSchemaMainFunction/templateByStatusType/storedCacheTemplate.ejs +0 -26
  46. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/flowSchemaMainFunction/templateByStatusType/triggerCacheTemplate.ejs +0 -44
  47. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/index.js +0 -80
  48. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/functionYaml/data.js +0 -129
  49. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/functionYaml/template.ejs +0 -17
  50. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/handler/data.js +0 -63
  51. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/mainFunction/data.js +0 -54
  52. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/mainFunction/template.ejs +0 -129
  53. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/queue/data.js +0 -63
  54. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/confirmReserved/queue/template.ejs +0 -45
  55. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObject/functionYaml/data.js +0 -117
  56. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObject/functionYaml/template.ejs +0 -20
  57. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObject/handler/data.js +0 -64
  58. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObject/mainFunction/data.js +0 -64
  59. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObject/mainFunction/template.ejs +0 -131
  60. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/functionYaml/data.js +0 -122
  61. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/functionYaml/template.ejs +0 -17
  62. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/handler/data.js +0 -66
  63. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/handler/template.ejs +0 -99
  64. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/mainFunction/data.js +0 -64
  65. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/mainFunction/template.ejs +0 -82
  66. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/sns-sqs/data.js +0 -70
  67. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/createObjectComplete/sns-sqs/template.ejs +0 -49
  68. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/functionYaml/data.js +0 -139
  69. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/functionYaml/template.ejs +0 -18
  70. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/handler/data.js +0 -63
  71. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/mainFunction/data.js +0 -63
  72. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/mainFunction/template.ejs +0 -262
  73. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/queue/data.js +0 -63
  74. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/createPreSignUrl/queue/template.ejs +0 -45
  75. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/functionYaml/data.js +0 -146
  76. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/functionYaml/template.ejs +0 -14
  77. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/handler/data.js +0 -64
  78. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/mainFunction/data.js +0 -59
  79. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/mainFunction/template.ejs +0 -173
  80. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/sqs/data.js +0 -67
  81. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/preSignUrl/reservedLimit/sqs/template.ejs +0 -53
  82. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/functionYml/HdrS3/data.js +0 -140
  83. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/functionYml/HdrS3/template.ejs +0 -25
  84. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/handler/handlerS3/data.js +0 -49
  85. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/handler/handlerS3/template.ejs +0 -50
  86. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/mainFunction/ProcessCsvtemplate.ejs +0 -182
  87. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/mainFunction/data.js +0 -49
  88. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/mainFunction/template.ejs +0 -66
  89. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/queue/data.js +0 -77
  90. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/queue/dsqTemplatePath.ejs +0 -32
  91. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/processFile/queue/s3Template.ejs +0 -59
  92. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/relate/S3/data.js +0 -61
  93. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/relate/S3/template.ejs +0 -13
  94. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/upload/relate/sns-out/data.js +0 -70
  95. package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/s3Legacy/websocket/dynamoDb/ReservedTableData.js +0 -69
  96. package/src/codeGenerators/app/src/generatedCode/Flow/SystemFlowDescriptorBuilder.js +0 -151
  97. /package/src/codeGenerators/app/{src/generatedCode/FindData → sls_yaml}/templates/FindData_Yaml.ejs +0 -0
  98. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared/endpoint → FlowEndpoints/templates}/FlowEndpointBeforeLogical_Main.ejs +0 -0
  99. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/endpoint/FlowEndpoint_HdrWbs.ejs +0 -0
  100. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/endpoint/FlowEndpoint_Main.ejs +0 -0
  101. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/endpoint/FlowEntryPoint_Main.ejs +0 -0
  102. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/endpoint/FlowMain_Wbs.ejs +0 -0
  103. /package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/{s3Legacy/upload/confirmReserved/handler/template.ejs → s3/ConfirmReserved_HdrSqs.ejs} +0 -0
  104. /package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/{s3Legacy/upload/createObject/handler/template.ejs → s3/CreateObject_HdrWbs.ejs} +0 -0
  105. /package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/{s3Legacy/upload/preSignUrl/createPreSignUrl/handler/template.ejs → s3/CreatePreSignUrl_HdrSqs.ejs} +0 -0
  106. /package/src/codeGenerators/app/src/generatedCode/Flow/FlowSchemas/templates/{s3Legacy/upload/preSignUrl/reservedLimit/handler/template.ejs → s3/ReservedLimit_HdrSqs.ejs} +0 -0
  107. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/FlowEndpointComplete_Main.ejs +0 -0
  108. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/FlowStep_Main.ejs +0 -0
  109. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/plugIns/FlowStep_ByConfig_Awaiting_Main.ejs +0 -0
  110. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/plugIns/FlowStep_ByConfig_Paginated_Main.ejs +0 -0
  111. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/plugIns/FlowStep_PlugIn_Main.ejs +0 -0
  112. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/plugIns/FlowStep_RecievePlugIn_Main.ejs +0 -0
  113. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/plugIns/templateAwaitingStep.ejs +0 -0
  114. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → FlowSchemas/templates}/step/plugIns/templateSendPlugin.ejs +0 -0
  115. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/eventBridge.js +0 -0
  116. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/extTopic.js +0 -0
  117. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/lambdaSyncApi.js +0 -0
  118. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/lambdaSyncInv.js +0 -0
  119. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/ownTopic.js +0 -0
  120. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/registry.js +0 -0
  121. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/events/s3.js +0 -0
  122. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/handlers/FlowHandler_HdrApi.ejs +0 -0
  123. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/handlers/FlowHandler_HdrInv.ejs +0 -0
  124. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/handlers/FlowHandler_HdrSqs.ejs +0 -0
  125. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/eventTypes.js +0 -0
  126. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowClassifier.js +0 -0
  127. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowNaming.js +0 -0
  128. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowSelection.js +0 -0
  129. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowStepNormalizer.js +0 -0
  130. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/flowValidator.js +0 -0
  131. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal → _shared}/shared/registry.js +0 -0
  132. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/CheckTriggerCache_HdrSqs.ejs +0 -0
  133. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/CheckTriggerCache_Main.ejs +0 -0
  134. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/ProcessTriggerCache_HdrSqs.ejs +0 -0
  135. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/ProcessTriggerCache_Main.ejs +0 -0
  136. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/TriggerCacheComplete_HdrDsq.ejs +0 -0
  137. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/TriggerCacheComplete_HdrSqs.ejs +0 -0
  138. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/TriggerCacheComplete_Main.ejs +0 -0
  139. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/triggerCache/TriggerCacheQueue_Yaml.ejs +0 -0
  140. /package/src/codeGenerators/app/src/generatedCode/Flow/{_internal/_shared → _shared}/yaml/SharedFunctionSqs_Yaml.ejs +0 -0
  141. /package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/{PaginateProcessLogical_HdrSqs.js → PaginateProcessLogical_HdrSqs.ejs} +0 -0
  142. /package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/{PaginateProcessLogical_Main.js → PaginateProcessLogical_Main.ejs} +0 -0
  143. /package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/{ProcessLogical_HdrSqs.js → ProcessLogical_HdrSqs.ejs} +0 -0
  144. /package/src/codeGenerators/app/src/generatedCode/ProcessLogical/templates/{ProcessLogical_Main.js → ProcessLogical_Main.ejs} +0 -0
  145. /package/src/codeGenerators/app/src/generatedCode/libs/templates/{Consts.js → Consts.ejs} +0 -0
  146. /package/src/codeGenerators/app/src/generatedCode/libs/templates/{GenerateCodeLibs.js → GenerateCodeLibs.ejs} +0 -0
@@ -1,45 +0,0 @@
1
- ##===== [Queue]
2
- <%- queueName %>HdrSqs:
3
- Type: "AWS::SQS::Queue"
4
- Properties:
5
- QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>HdrSqs
6
- RedrivePolicy:
7
- deadLetterTargetArn:
8
- # !GetAtt
9
- Fn::GetAtt:
10
- - <%- queueName %>HdrSqsDLQ
11
- - Arn
12
- maxReceiveCount: 3
13
- VisibilityTimeout: 120
14
- ##==== [QueueDLQ]
15
- <%- queueName %>HdrSqsDLQ:
16
- Type: AWS::SQS::Queue
17
- Properties:
18
- QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>HdrSqsDLQ
19
- ##==== [QueuePolicy]
20
- <%- queueName %>HdrSqsPolicy:
21
- Type: AWS::SQS::QueuePolicy
22
- Properties:
23
- PolicyDocument:
24
- Version: "2012-10-17"
25
- Statement:
26
- - Sid: "allow-sns-messages"
27
- Effect: Allow
28
- Principal: "*"
29
- Resource:
30
- # !GetAtt
31
- Fn::GetAtt:
32
- - <%- queueName %>HdrSqs
33
- - Arn
34
- Action: "SQS:SendMessage"
35
- Queues:
36
- - Ref: <%- queueName %>HdrSqs
37
- #<#<%- firstLetterUpperCase(queueName) %>QueueSetting#>
38
- #<#/<%- firstLetterUpperCase(queueName) %>QueueSetting#>
39
-
40
- <%_ function firstLetterUpperCase(text){
41
- return text.charAt(0).toUpperCase() + text.slice(1)
42
- } _%>
43
- <%_ function firstLetterLowerCase(str) {
44
- return str.charAt(0).toLowerCase() + str.slice(1)
45
- } _%>
@@ -1,146 +0,0 @@
1
- /*
2
- Copyright (C) 2021 Sven Mason <http://izara.io>
3
-
4
- This program is free software: you can redistribute it and/or modify
5
- it under the terms of the GNU Affero General Public License as
6
- published by the Free Software Foundation, either version 3 of the
7
- License, or (at your option) any later version.
8
-
9
- This program is distributed in the hope that it will be useful,
10
- but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- GNU Affero General Public License for more details.
13
-
14
- You should have received a copy of the GNU Affero General Public License
15
- along with this program. If not, see <http://www.gnu.org/licenses/>.
16
- */
17
-
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
- import { getObjectSchema } from '@izara_project/izara-core-library-service-schemas';
24
-
25
- import consts from '#libs/Consts.js';
26
- import utils from '#libs/Utils.js';
27
- import libs from '#libs/Libs.js';
28
-
29
- const {
30
- firstLetterLowerCase: lowerCase,
31
- firstLetterUpperCase: upperCase,
32
- getLocalConfig
33
- } = utils;
34
- const {
35
- HANDLER,
36
- RESOURCE_CLASSES,
37
- SQS_RESOURCE,
38
- SNS_RESOURCE,
39
- SOURCE_PATH,
40
- SAVE_FILE_NAME,
41
- SOURCE_GENERATE_IAM_ROLE,
42
- FUNCTION_NAME,
43
- DYNAMO_RESOURCE,
44
- STORAGE_TYPES,
45
- TOPIC_NAME_GENERATE_CODE
46
- } = consts;
47
-
48
- const {
49
- defaultIamRolePerAction,
50
- createIamRole,
51
- awaitingMultipleStepsRole,
52
- resourceNames,
53
- shortNameHandler
54
- } = libs;
55
-
56
- const templatePath = path.join(__dirname, 'template.ejs');
57
-
58
- /**
59
- * receive objectSchema
60
- *
61
- * @param {Object} flowSchema
62
- * @return {{ templatePath, templateData, setting } }
63
- */
64
-
65
- async function createSourceParams(_izContext, flowSchema, appPath) {
66
- let iz_serviceSchemaBucketName = (await import('yaml')).default.parse((await import('fs')).default.readFileSync(path.resolve(appPath, '../config/serverless.config.yml'), 'utf8'))?.main_config?.iz_serviceSchemaBucketName;
67
-
68
- console.debug('iz_serviceSchemaBucketName:::: ', iz_serviceSchemaBucketName);
69
-
70
- let functionName = upperCase(FUNCTION_NAME.reservedLimit);
71
- let handlerType = upperCase(HANDLER.hdrSqs);
72
- let additionalResourcePermission = defaultIamRolePerAction();
73
- let tableNames = [];
74
- additionalResourcePermission.push(
75
- createIamRole(
76
- {
77
- [RESOURCE_CLASSES.sqs]: [
78
- SQS_RESOURCE.receiveMessage,
79
- SQS_RESOURCE.sendMessage,
80
- SQS_RESOURCE.deleteMessage,
81
- SQS_RESOURCE.getQueueAttributes
82
- ],
83
- [RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish, SNS_RESOURCE.subscribe]
84
- },
85
- [
86
- resourceNames(RESOURCE_CLASSES.sqs, functionName + handlerType),
87
- resourceNames(RESOURCE_CLASSES.sqs, functionName + handlerType + 'DLQ'),
88
- resourceNames(
89
- RESOURCE_CLASSES.sns,
90
- TOPIC_NAME_GENERATE_CODE.outCreateNodeComplete
91
- )
92
- ]
93
- )
94
- );
95
-
96
- additionalResourcePermission.push(awaitingMultipleStepsRole());
97
-
98
- let objectSchema = await getObjectSchema.getObjSchemaS3WithHierarchy(
99
- _izContext,
100
- flowSchema.objType,
101
- iz_serviceSchemaBucketName
102
- );
103
-
104
- for (const storageResource of Object.values(objectSchema.storageResources)) {
105
- if (storageResource.storageType === STORAGE_TYPES.dynamoDB) {
106
- tableNames.push(storageResource.tableName);
107
- }
108
- }
109
-
110
- additionalResourcePermission.push(
111
- createIamRole(
112
- {
113
- [RESOURCE_CLASSES.dynamoDbTable]: Object.values(DYNAMO_RESOURCE)
114
- },
115
- tableNames.map(tableName =>
116
- resourceNames(RESOURCE_CLASSES.dynamoDbTable, tableName)
117
- )
118
- )
119
- );
120
-
121
- return {
122
- templatePath: templatePath,
123
- templateData: {
124
- functionName,
125
- handlerType,
126
- functionNameConfig: functionName + upperCase(handlerType),
127
- resourceLocation: path.join(
128
- SOURCE_PATH.resourceLocationWebSocket,
129
- flowSchema.flowTag,
130
- '/source/'
131
- ),
132
- additionalResourcePermission,
133
- functionNameConfig:
134
- upperCase(functionName) + upperCase(shortNameHandler(handlerType)),
135
- roleName: SOURCE_GENERATE_IAM_ROLE.FlowSchemaUploadS3Role
136
- },
137
- setting: {
138
- saveFileName: SAVE_FILE_NAME.flowSchemaYaml,
139
- savePath: path.join(appPath, SOURCE_PATH.appYaml),
140
- fileExtension: '.yml',
141
- isAppend: true
142
- }
143
- };
144
- }
145
-
146
- export default createSourceParams;
@@ -1,14 +0,0 @@
1
- <%_ const join = require('path').join; _%>
2
- <%- firstLetterUpperCase(functionNameConfig) %>:
3
- handler: <%- join(resourceLocation, `${functionName}_${firstLetterUpperCase(handlerType)}.main`)%>
4
- name: ${self:custom.iz_resourcePrefix}<%- functionName %><%- firstLetterUpperCase(handlerType) %>
5
- role: <%- roleName %>Role
6
- #<#<%- functionName %><%- handlerType %>FunctionSetting#>
7
- #<#/<%- functionName %><%- handlerType %>FunctionSetting#>
8
- events:
9
- - sqs:
10
- arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- functionName %><%- firstLetterUpperCase(handlerType) %>
11
- batchSize: 10
12
- <%_ function firstLetterUpperCase(text){
13
- return text.charAt(0).toUpperCase() + text.slice(1)
14
- } _%>
@@ -1,64 +0,0 @@
1
- /*
2
- Copyright (C) 2021 Sven Mason <http://izara.io>
3
-
4
- This program is free software: you can redistribute it and/or modify
5
- it under the terms of the GNU Affero General Public License as
6
- published by the Free Software Foundation, either version 3 of the
7
- License, or (at your option) any later version.
8
-
9
- This program is distributed in the hope that it will be useful,
10
- but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- GNU Affero General Public License for more details.
13
-
14
- You should have received a copy of the GNU Affero General Public License
15
- along with this program. If not, see <http://www.gnu.org/licenses/>.
16
- */
17
-
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
- import consts from '#libs/Consts.js';
24
- import utils from '#libs/Utils.js';
25
-
26
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } =
27
- utils;
28
-
29
- const { HANDLER, SOURCE_PATH, FUNCTION_NAME } = consts;
30
-
31
- const templatePath = path.join(__dirname, 'template.ejs');
32
-
33
- /**
34
- * receive objectSchema
35
- *
36
- * @param {Object} flowSchema
37
- * @return {{ templatePath, templateData, setting } }
38
- */
39
-
40
- function createSourceParams(_izContext, flowSchema, appPath) {
41
- let functionName = upperCase(FUNCTION_NAME.reservedLimit);
42
- let handlerType = upperCase(HANDLER.hdrSqs);
43
-
44
- return {
45
- templatePath: templatePath,
46
- templateData: {
47
- functionName,
48
- handlerType
49
- },
50
- setting: {
51
- saveFileName: `${functionName}_${handlerType}`,
52
- savePath: path.join(
53
- appPath,
54
- SOURCE_PATH.webSocket,
55
- flowSchema.flowTag,
56
- 'source/'
57
- ),
58
- fileExtension: '.js',
59
- isAppend: true
60
- }
61
- };
62
- }
63
-
64
- export default createSourceParams;
@@ -1,59 +0,0 @@
1
- /*
2
- Copyright (C) 2021 Sven Mason <http://izara.io>
3
-
4
- This program is free software: you can redistribute it and/or modify
5
- it under the terms of the GNU Affero General Public License as
6
- published by the Free Software Foundation, either version 3 of the
7
- License, or (at your option) any later version.
8
-
9
- This program is distributed in the hope that it will be useful,
10
- but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- GNU Affero General Public License for more details.
13
-
14
- You should have received a copy of the GNU Affero General Public License
15
- along with this program. If not, see <http://www.gnu.org/licenses/>.
16
- */
17
-
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
- import consts from '#libs/Consts.js';
24
- import utils from '#libs/Utils.js';
25
-
26
- const { firstLetterUpperCase: upperCase } = utils;
27
- const { SOURCE_PATH, FUNCTION_NAME } = consts;
28
-
29
- const templatePath = path.join(__dirname, 'template.ejs');
30
-
31
- /**
32
- * receive objectSchema
33
- *
34
- * @param {Object} flowSchema
35
- * @return {{ templatePath, templateData, setting } }
36
- */
37
-
38
- function createSourceParams(_izContext, flowSchema, appPath) {
39
- let functionName = upperCase(FUNCTION_NAME.reservedLimit);
40
- return {
41
- templatePath: templatePath,
42
- templateData: {
43
- flowTag: flowSchema.flowTag
44
- },
45
- setting: {
46
- saveFileName: `${functionName}_Main`,
47
- savePath: path.join(
48
- appPath,
49
- SOURCE_PATH.webSocket,
50
- flowSchema.flowTag,
51
- 'source/'
52
- ),
53
- fileExtension: '.js',
54
- isAppend: false
55
- }
56
- };
57
- }
58
-
59
- export default createSourceParams;
@@ -1,173 +0,0 @@
1
- /*
2
- Copyright (C) 2021 Sven Mason <http://izara.io>
3
-
4
- This program is free software: you can redistribute it and/or modify
5
- it under the terms of the GNU Affero General Public License as
6
- published by the Free Software Foundation, either version 3 of the
7
- License, or (at your option) any later version.
8
-
9
- This program is distributed in the hope that it will be useful,
10
- but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- GNU Affero General Public License for more details.
13
-
14
- You should have received a copy of the GNU Affero General Public License
15
- along with this program. If not, see <http://www.gnu.org/licenses/>.
16
- */
17
-
18
-
19
-
20
- import callingFlowSharedLib from '@izara_project/izara-core-library-calling-flow';
21
- import lambdaSharedLib from '@izara_project/izara-core-library-lambda';
22
- import snsSharedLib from '@izara_project/izara-core-library-sns';
23
- import asyncFlowSharedLib from "@izara_project/izara-core-library-asynchronous-flow";
24
- import { sns, webSocket } from '@izara_project/izara-core-library-external-request';
25
- import { consts as generateCodeConsts } from '@izara_project/izara-core-generate-service-code';
26
- import { consts as coreConsts } from '@izara_project/izara-middleware';
27
- import { objectHash as hash } from '@izara_project/izara-shared-core';
28
- import dynamodbSharedLib from '@izara_project/izara-core-library-dynamodb';
29
- import { processStaticLimit } from '../../../../libs/source/GenerateCodeLibs.js';
30
- import { utils } from "@izara_project/izara-core-library-service-schemas";
31
- const { createFlowTypeConcat } = utils
32
- const { postToConnection } = webSocket;
33
-
34
- //(<optionalRequired>)
35
- //(</optionalRequired>)
36
-
37
- /**
38
- * description of function.
39
- * @param {Object} _izContext
40
- * @param {CorrelationIds} _izContext.correlationIds - property of _izContext
41
- * @param {Logger} _izContext.logger - property of _izContext
42
- * @param {string} userId - from client
43
- * @param {string} imageImportConfigId - from client
44
- * @param {string} fileName - name of image
45
- * @param {string} imageType - type of image
46
- * @param {numeric} imageSize - size of image
47
- *
48
- * @returns {object} return imageImportId
49
- */
50
- export default async function <%= functionName %>(
51
- _izContext,
52
- objType,
53
- objInstanceFull,
54
- //(<additionalProperties>)
55
- //(</additionalProperties>)
56
- callingFlowConfig = {}
57
- ) {
58
-
59
- try {
60
-
61
- _izContext.logger.debug('----- <%= functionName %> event params ----- ', {
62
- objType,
63
- objInstanceFull,
64
- callingFlowConfig
65
- });
66
-
67
- let connectionId = _izContext.correlationIds.get(coreConsts.CONNECTION_ID)
68
-
69
- //(<beforeReserved>)
70
- //(</beforeReserved>)
71
-
72
-
73
- // get static
74
- let payloadBeforeInvokeStaticLimit = {
75
- //(<additionalPropertiesStaticLimit>)
76
- //(</additionalPropertiesStaticLimit>)
77
- }
78
-
79
- let res = await processStaticLimit(_izContext,
80
- await lambdaSharedLib.lambdaFunctionName(_izContext, "StaticLimitProcessHdrInv", consts.EXTERNAL_SERVICE_NAME.accountLimits),
81
- payloadBeforeInvokeStaticLimit
82
- )
83
-
84
- _izContext.logger.debug("res::", res);
85
-
86
- if (res.passStatus === false) {
87
- postToConnection({ message: "static limit over" }, connectionId)
88
- let identifiers = hash({
89
- //(<hashIdentifiers>)
90
- //(</hashIdentifiers>)
91
- })
92
-
93
- // after post message delete websocket task
94
- await dynamodbSharedLib.deleteItem(_izContext,
95
- await dynamodbSharedLib.tableName(_izContext, "WebSocketTask"),
96
- {
97
- taskKey: `${createFlowTypeConcat(_izContext, { flowTag: "<%- flowTag %>", serviceTag: process.env.iz_serviceTag })}${identifiers}`,
98
- connectionId: connectionId
99
- }
100
- )
101
- //(<afterFailReservedStaticLimit>)
102
- return
103
- //(</afterFailReservedStaticLimit>)
104
- }
105
-
106
- // reservedDynamic
107
-
108
- let sendMsgReservedDynamic = {
109
- //(<additionalPropertiesReservedDynamic>)
110
- //(</additionalPropertiesReservedDynamic>)
111
- }
112
-
113
- let callingFlowProperties = {
114
- //(<baseCallingFlowProperties>)
115
- //(</baseCallingFlowProperties>)
116
- }
117
-
118
- _izContext.logger.debug("callingFlowProperties", callingFlowProperties);
119
-
120
- if (callingFlowConfig) {
121
- sendMsgReservedDynamic = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
122
- sendMsgReservedDynamic,
123
- callingFlowSharedLib.addParentCallingFlowConfig(
124
- callingFlowConfig,
125
- callingFlowSharedLib.createCallingFlowConfig(
126
- //(<callingFlowPropertiesIfHaveCallingFlowConfig>)
127
- await lambdaSharedLib.lambdaFunctionName(_izContext, "ReservedLimitCompleteHdrSqs"),
128
- //(</callingFlowPropertiesIfHaveCallingFlowConfig>)
129
- callingFlowProperties
130
- )
131
- )
132
- )
133
- } else {
134
- sendMsgReservedDynamic = callingFlowSharedLib.addCallingFlowToSnsRequestMessageObject(
135
- sendMsgReservedDynamic,
136
- callingFlowSharedLib.createCallingFlowConfig(
137
- //(<callingFlowPropertiesIfNotHaveCallingFlowConfig>)
138
- await lambdaSharedLib.lambdaFunctionName(_izContext, "ReservedLimitCompleteHdrSqs"),
139
- //(</callingFlowPropertiesIfNotHaveCallingFlowConfig>)
140
- callingFlowProperties
141
- )
142
- );
143
- }
144
-
145
- // create awaitingSteps
146
- await asyncFlowSharedLib.createAwaitingStep(_izContext,
147
- asyncFlowSharedLib.createAwaitingStepId(
148
- //(<createAwaitStepId>)
149
- //(</createAwaitStepId>)
150
- ),
151
- asyncFlowSharedLib.createPendingStepId(
152
- //(<createPendingStepId>)
153
- //(</createPendingStepId>)
154
- )
155
- )
156
-
157
-
158
- let sendMessageToReservedDynamic = {
159
- Message: JSON.stringify(sendMsgReservedDynamic),
160
- TopicArn: await snsSharedLib.snsTopicArnByFlowSchema(_izContext, "ReservedDynamicUsage_In", consts.EXTERNAL_SERVICE_NAME.accountLimits)
161
- };
162
- _izContext.logger.debug("sendMessageToReservedDynamic", sendMessageToReservedDynamic);
163
- await sns.publishAsync(_izContext, sendMessageToReservedDynamic);
164
-
165
- return {
166
- objType,
167
- objInstanceFull,
168
- }
169
- } catch (err) {
170
- _izContext.logger.error('error GetSignedUrlAccountLimit: ', err);
171
- throw (err)
172
- }
173
- }
@@ -1,67 +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
- import consts from '#libs/Consts.js';
24
- import utils from '#libs/Utils.js';
25
-
26
- const { firstLetterUpperCase: upperCase } = utils;
27
- const { SOURCE_PATH, SAVE_FILE_NAME, FUNCTION_NAME, HANDLER } = consts;
28
- const templatePath = path.join(__dirname, 'template.ejs');
29
-
30
- /**
31
- * create data for dynamoDbYaml tempalte from objectSchema
32
- * return array of dynamoDb data
33
- * because one objectSchema can create multiple dynamoDb table
34
- *
35
- * @param {Object} _izContext
36
- * @param {Object} objectSchema
37
- * @returns {Object[]} - data of multiple dynamoDb template
38
- */
39
-
40
- function data(_izContext, appPath) {
41
- let resultForCreateSqs = [];
42
- const WebSocketSqsQueueNames = [];
43
- const setting = {
44
- initialData: 'Resources:\n',
45
- savePath: path.join(appPath, SOURCE_PATH.resourceYaml),
46
- saveFileName: SAVE_FILE_NAME.snsInSqsYaml,
47
- fileExtension: '.yml',
48
- isAppend: true
49
- };
50
-
51
- WebSocketSqsQueueNames.push({
52
- queueName:
53
- upperCase(FUNCTION_NAME.reservedLimit) + upperCase(HANDLER.hdrSqs),
54
- queueNameSubscription: upperCase(FUNCTION_NAME.createObjectComplete)
55
- });
56
-
57
- for (let WebSocketSqsQueueName of WebSocketSqsQueueNames) {
58
- resultForCreateSqs.push({
59
- templatePath: templatePath,
60
- templateData: WebSocketSqsQueueName,
61
- setting: setting
62
- });
63
- }
64
- return resultForCreateSqs;
65
- }
66
-
67
- export default data;
@@ -1,53 +0,0 @@
1
- ##===== SNS Subscription
2
- SubscriptionOut<%- queueNameSubscription %>:
3
- Type: AWS::SNS::Subscription
4
- Properties:
5
- TopicArn: !Ref Out<%- queueNameSubscription %>
6
- Endpoint: "arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- queueName %>"
7
- Protocol: "sqs"
8
- ##===== [Queue]
9
- <%- queueName %>:
10
- Type: "AWS::SQS::Queue"
11
- Properties:
12
- QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>
13
- RedrivePolicy:
14
- deadLetterTargetArn:
15
- # !GetAtt
16
- Fn::GetAtt:
17
- - <%- queueName %>DLQ
18
- - Arn
19
- maxReceiveCount: 3
20
- VisibilityTimeout: 120
21
- ##==== [QueueDLQ]
22
- <%- queueName %>DLQ:
23
- Type: AWS::SQS::Queue
24
- Properties:
25
- QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>DLQ
26
- ##==== [QueuePolicy]
27
- <%- queueName %>Policy:
28
- Type: AWS::SQS::QueuePolicy
29
- Properties:
30
- PolicyDocument:
31
- Version: "2012-10-17"
32
- Statement:
33
- - Sid: "allow-sns-messages"
34
- Effect: Allow
35
- Principal: "*"
36
- Resource:
37
- # !GetAtt
38
- Fn::GetAtt:
39
- - <%- queueName %>
40
- - Arn
41
- Action: "SQS:SendMessage"
42
- Queues:
43
- - Ref: <%- queueName %>
44
- #<#<%- firstLetterUpperCase(queueName) %>QueueSetting#>
45
- #<#/<%- firstLetterUpperCase(queueName) %>QueueSetting#>
46
-
47
-
48
- <%_ function firstLetterUpperCase(text){
49
- return text.charAt(0).toUpperCase() + text.slice(1)
50
- } _%>
51
- <%_ function firstLetterLowerCase(str) {
52
- return str.charAt(0).toLowerCase() + str.slice(1)
53
- } _%>