@izara_project/izara-market-library-service-schemas 1.0.29 → 1.0.31

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 (170) hide show
  1. package/package.json +1 -1
  2. package/src/GenerateCodeLibs/src/Consts.js +11 -9
  3. package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +54 -21
  4. package/src/MainLibs/src/Consts.js +43 -20
  5. package/src/reStructure/GenerateCode.js +2 -1
  6. package/src/reStructure/TemplateConfig.js +5 -1
  7. package/src/reStructure/TemplateData/EndpointPerService/generateTemplateData.js +108 -0
  8. package/src/reStructure/TemplateData/EndpointPerService/handler/api/data.js +76 -0
  9. package/src/reStructure/TemplateData/EndpointPerService/handler/api/request.json +7 -0
  10. package/src/reStructure/TemplateData/EndpointPerService/handler/api/template.ejs +73 -0
  11. package/src/reStructure/TemplateData/EndpointPerService/handler/dsq/data.js +81 -0
  12. package/src/reStructure/TemplateData/EndpointPerService/handler/dsq/request.json +7 -0
  13. package/src/reStructure/TemplateData/EndpointPerService/handler/dsq/template.ejs +125 -0
  14. package/src/reStructure/TemplateData/EndpointPerService/handler/inv/data.js +70 -0
  15. package/src/reStructure/TemplateData/EndpointPerService/handler/inv/request.json +7 -0
  16. package/src/reStructure/TemplateData/EndpointPerService/handler/inv/template.ejs +73 -0
  17. package/src/reStructure/TemplateData/EndpointPerService/handler/sqs/data.js +79 -0
  18. package/src/reStructure/TemplateData/EndpointPerService/handler/sqs/request.json +7 -0
  19. package/src/reStructure/TemplateData/EndpointPerService/handler/sqs/template.ejs +126 -0
  20. package/src/reStructure/TemplateData/{flowSchema/components/schema/inProcess/handler → EndpointPerService/mainFunction/create}/data.js +20 -13
  21. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +624 -0
  22. package/src/reStructure/TemplateData/{flowSchema/components/schema/inProcess/mainFunction → EndpointPerService/mainFunction/delete}/data.js +18 -11
  23. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +176 -0
  24. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/data.js +56 -0
  25. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +234 -0
  26. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/data.js +56 -0
  27. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +330 -0
  28. package/src/reStructure/TemplateData/EndpointPerService/yaml/data.js +177 -0
  29. package/src/reStructure/TemplateData/EndpointPerService/yaml/template.ejs +26 -0
  30. package/src/reStructure/TemplateData/externalService/generateTemplateData.js +1 -1
  31. package/src/reStructure/TemplateData/externalService/lambdaRole/data.js +91 -249
  32. package/src/reStructure/TemplateData/externalService/lambdaRole/template.ejs +1 -1
  33. package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/data.js +10 -8
  34. package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/template.ejs +1 -1
  35. package/src/reStructure/TemplateData/findData/findDataYaml/data.js +2 -2
  36. package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/functionYaml/data.js +8 -7
  37. package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/handler/data.js +4 -4
  38. package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/data.js +2 -2
  39. package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/functionYaml/data.js +5 -31
  40. package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/data.js +4 -22
  41. package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/template.ejs +3 -31
  42. package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/data.js +1 -1
  43. package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/functionYaml/data.js +6 -6
  44. package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/handler/data.js +4 -4
  45. package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/mainFunction/data.js +4 -4
  46. package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/sns-sqs/data.js +1 -1
  47. package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/sns-sqs/template.ejs +1 -1
  48. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/{getSignUrls → createPresignUrl}/functionYaml/data.js +45 -14
  49. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/{getSignUrls → createPresignUrl}/functionYaml/template.ejs +3 -0
  50. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/{getSignUrls → createPresignUrl}/handler/data.js +6 -6
  51. package/src/reStructure/TemplateData/flowSchema/{legacy/hookCode-old/handler/templateAsyncHandler.ejs → components/upload/preSignUrl/createPresignUrl/handler/template.ejs} +26 -11
  52. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/{getSignUrls → createPresignUrl}/mainFunction/data.js +11 -8
  53. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/template.ejs +253 -0
  54. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/{reservedLimit → createPresignUrl}/queue/data.js +1 -1
  55. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/functionYaml/data.js +14 -42
  56. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/functionYaml/template.ejs +0 -3
  57. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/handler/data.js +6 -6
  58. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/handler/template.ejs +40 -45
  59. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/data.js +5 -8
  60. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/template.ejs +100 -190
  61. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/{getSignUrls → reservedLimit}/sqs/data.js +4 -4
  62. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/{getSignUrls → reservedLimit}/sqs/template.ejs +2 -2
  63. package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/functionYml/HdrS3/data.js +9 -7
  64. package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/handler/handlerS3/data.js +4 -4
  65. package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/mainFunction/data.js +4 -4
  66. package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/queue/s3Template.ejs +1 -1
  67. package/src/reStructure/TemplateData/flowSchema/components/upload/relate/S3/data.js +5 -2
  68. package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/functionYaml/data.js +3 -3
  69. package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/functionYaml/template.ejs +2 -0
  70. package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/data.js +3 -2
  71. package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/template.ejs +4 -16
  72. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowSchema/functionYaml/data.js +115 -0
  73. package/src/reStructure/TemplateData/flowSchema/{components/schema/inProcess → flowSchemaOwnTopic/flowSchema}/functionYaml/template.ejs +1 -20
  74. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowSchema/handler/data.js +70 -0
  75. package/src/reStructure/TemplateData/flowSchema/{components/schema/inProcess → flowSchemaOwnTopic/flowSchema}/handler/template.ejs +14 -32
  76. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowSchema/mainFunction/data.js +64 -0
  77. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowSchema/mainFunction/template.ejs +104 -0
  78. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowSchemaComplete/functionYaml/data.js +115 -0
  79. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowSchemaComplete/functionYaml/template.ejs +20 -0
  80. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowSchemaComplete/handler/data.js +71 -0
  81. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowSchemaComplete/handler/template.ejs +85 -0
  82. package/src/reStructure/TemplateData/flowSchema/{components/upload/hook/hookLogic → flowSchemaOwnTopic/flowSchemaComplete/mainFunction}/data.js +30 -10
  83. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowSchemaComplete/mainFunction/template.ejs +105 -0
  84. package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +78 -55
  85. package/src/reStructure/TemplateData/generateRole/createSharedResource.js +21 -1
  86. package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/template.ejs +35 -44
  87. package/src/reStructure/TemplateData/perActionComplete/create/sns-out/template.ejs +1 -1
  88. package/src/reStructure/TemplateData/perActionComplete/create/yaml/data.js +4 -5
  89. package/src/reStructure/TemplateData/perActionComplete/delete/yaml/data.js +5 -4
  90. package/src/reStructure/TemplateData/perActionComplete/generateTemplateData.js +15 -2
  91. package/src/reStructure/TemplateData/perActionComplete/get/yaml/data.js +7 -4
  92. package/src/reStructure/TemplateData/perActionComplete/update/sns-out/data.js +1 -1
  93. package/src/reStructure/TemplateData/perActionComplete/update/yaml/data.js +5 -4
  94. package/src/reStructure/TemplateData/processLogical/yaml/data.js +3 -3
  95. package/src/reStructure/TemplateData/processLogicalPagination/yaml/dsq/data.js +1 -1
  96. package/src/reStructure/TemplateData/processLogicalPagination/yaml/sqs/data.js +2 -2
  97. package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/api/data.js +1 -1
  98. package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/dsq/data.js +1 -1
  99. package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/inv/data.js +1 -1
  100. package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/sqs/data.js +3 -3
  101. package/src/reStructure/TemplateData/relationshipPerAction/create/action/sns-in-sqs/snsTemplate.ejs +1 -1
  102. package/src/reStructure/TemplateData/relationshipPerAction/create/complete/functionYaml/data.js +2 -2
  103. package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/data.js +1 -1
  104. package/src/reStructure/TemplateData/relationshipPerAction/create/complete/sns-in-sqs/template.ejs +0 -1
  105. package/src/reStructure/TemplateData/relationshipPerAction/create/complete/sns-out/template.ejs +1 -1
  106. package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/api/data.js +1 -1
  107. package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/dsq/data.js +1 -1
  108. package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/inv/data.js +1 -1
  109. package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/sqs/data.js +3 -3
  110. package/src/reStructure/TemplateData/relationshipPerAction/delete/action/sns-in-sqs/snsTemplate.ejs +1 -1
  111. package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/functionYaml/data.js +2 -2
  112. package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/sns-out/template.ejs +1 -1
  113. package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/api/data.js +1 -1
  114. package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/dsq/data.js +1 -1
  115. package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/inv/data.js +1 -1
  116. package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/sqs/data.js +4 -4
  117. package/src/reStructure/TemplateData/relationshipPerAction/get/action/sns-in-sqs/snsTemplate.ejs +1 -1
  118. package/src/reStructure/TemplateData/relationshipPerAction/get/complete/functionYaml/data.js +2 -2
  119. package/src/reStructure/TemplateData/relationshipPerAction/get/complete/sns-out/template.ejs +1 -1
  120. package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/api/data.js +1 -1
  121. package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/data.js +1 -1
  122. package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/inv/data.js +1 -1
  123. package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/sqs/data.js +4 -4
  124. package/src/reStructure/TemplateData/relationshipPerAction/update/action/sns-in-sqs/snsTemplate.ejs +1 -1
  125. package/src/reStructure/TemplateData/relationshipPerAction/update/complete/functionYaml/data.js +2 -2
  126. package/src/reStructure/TemplateData/relationshipPerAction/update/complete/sns-out/template.ejs +1 -1
  127. package/src/reStructure/TemplateData/resourceYaml/dynamodb/defaultDynamoDbTable.js +1 -1
  128. package/src/reStructure/TemplateData/resourceYaml/dynamodb/generateDynamoPerLink.js +1 -1
  129. package/src/reStructure/TemplateData/resourceYaml/dynamodb/mainResourcePerObjectSchemaData.js +1 -1
  130. package/src/reStructure/TemplateData/resourceYaml/generateTemplateData.js +6 -12
  131. package/src/reStructure/TemplateData/resourceYaml/sns-in-sqs/defaultSnsInSqsForFindDataAndProcessLogical.js +1 -1
  132. package/src/reStructure/TemplateData/resourceYaml/sns-in-sqs/snsAndSqsPerActionData.js +22 -49
  133. package/src/reStructure/TemplateData/resourceYaml/sns-in-sqs/snsTemplate.ejs +1 -1
  134. package/src/reStructure/TemplateData/resourceYaml/sns-out/data.js +8 -24
  135. package/src/reStructure/TemplateData/resourceYaml/sns-out/template.ejs +1 -1
  136. package/src/reStructure/TemplateData/testTemplate/template.ejs +0 -5
  137. package/src/reStructure/TemplateData/flowSchema/components/schema/inProcess/functionYaml/data.js +0 -76
  138. package/src/reStructure/TemplateData/flowSchema/components/schema/inProcess/sns-sqs/data.js +0 -35
  139. package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/functionYaml/data.js +0 -34
  140. package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/functionYaml/template.ejs +0 -0
  141. package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/handler/data.js +0 -34
  142. package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/handler/template.ejs +0 -0
  143. package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/mainFunction/data.js +0 -34
  144. package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/mainFunction/template.ejs +0 -0
  145. package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/sns-sqs/data.js +0 -34
  146. package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/sns-sqs/template.ejs +0 -0
  147. package/src/reStructure/TemplateData/flowSchema/components/upload/hook/handler/data.js +0 -93
  148. package/src/reStructure/TemplateData/flowSchema/components/upload/hook/handler/templateAsyncHandler.ejs +0 -110
  149. package/src/reStructure/TemplateData/flowSchema/components/upload/hook/handler/templateSyncHandler.ejs +0 -49
  150. package/src/reStructure/TemplateData/flowSchema/components/upload/hook/mainFunction/data.js +0 -65
  151. package/src/reStructure/TemplateData/flowSchema/components/upload/hook/mainFunction/template.ejs +0 -7
  152. package/src/reStructure/TemplateData/flowSchema/components/upload/hook/queue/data.js +0 -72
  153. package/src/reStructure/TemplateData/flowSchema/components/upload/hook/queue/snsTemplate.ejs +0 -59
  154. package/src/reStructure/TemplateData/flowSchema/components/upload/hook/queue/sqsTemplate.ejs +0 -43
  155. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/getSignUrls/handler/template.ejs +0 -120
  156. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/getSignUrls/mainFunction/template.ejs +0 -163
  157. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/functionYaml/data.js +0 -101
  158. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/functionYaml/template.ejs +0 -43
  159. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/handler/data.js +0 -93
  160. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/handler/templateSyncHandler.ejs +0 -49
  161. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/hookLogic/data.js +0 -64
  162. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/mainFunction/data.js +0 -66
  163. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/mainFunction/template.ejs +0 -30
  164. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/queue/data.js +0 -124
  165. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/queue/snsTemplate.ejs +0 -59
  166. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/queue/sqsTemplate.ejs +0 -43
  167. package/src/reStructure/TemplateData/relationshipPerAction.zip +0 -0
  168. /package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/{reservedLimit → createPresignUrl}/queue/template.ejs +0 -0
  169. /package/src/reStructure/TemplateData/flowSchema/{components/schema/inProcess/mainFunction/template.ejs → flowSchemaOwnTopic/sns-in/data.js} +0 -0
  170. /package/src/reStructure/TemplateData/flowSchema/{components/schema/inProcess/sns-sqs/template.ejs → flowSchemaOwnTopic/sns-out/data.js} +0 -0
@@ -26,8 +26,8 @@ const path = require("path")
26
26
  // } = require('@izara_project/izara-core-library-service-schemas/src/Consts');
27
27
 
28
28
 
29
- const { ACTIONS, HANDLER, SOURCE_PATH, DEFAULT_HANDLER_PER_ACTION, SAVE_FILE_NAME } = require('../../../../MainLibs/index.js').consts
30
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require('../../../../MainLibs/index.js').utils;
29
+ const { ACTIONS, HANDLER, SOURCE_PATH, DEFAULT_HANDLER_PER_ACTION, SAVE_FILE_NAME } = require('../../../../MainLibs/src/Consts.js')
30
+ const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require('../../../../MainLibs/src/Utils.js');
31
31
  const snsTemplatePath = path.join(__dirname, './snsTemplate.ejs')
32
32
  const sqsTemplatePath = path.join(__dirname, './sqsTemplate.ejs')
33
33
 
@@ -41,20 +41,13 @@ const sqsTemplatePath = path.join(__dirname, './sqsTemplate.ejs')
41
41
  * @returns {Object[]} - data of multiple dynamoDb template
42
42
  */
43
43
 
44
- function dataForCreateSnsAndSqsQueueFromObjectSchema(_izContext, objectSchema, srcPath) {
44
+ function dataForCreateSnsAndSqsQueueFromObjectSchema(_izContext) {
45
45
  const snsAndSqsDataArray = [];
46
46
  for (const action of Object.values(ACTIONS)) {
47
- if (objectSchema.overWriteHandlers?.[action]) {
48
- for (const handler of objectSchema.overWriteHandlers[action]) {
47
+ for (const handler of DEFAULT_HANDLER_PER_ACTION[action]) {
48
+ if (handler === HANDLER.hdrSqs) {
49
49
  const snsAndSqsData = {
50
- queueName: createQueueNameForSnsAndSqsQueue(_izContext, objectSchema, action, handler, srcPath)
51
- }
52
- snsAndSqsData.queueName && snsAndSqsDataArray.push(snsAndSqsData);
53
- }
54
- } else {
55
- for (const handler of DEFAULT_HANDLER_PER_ACTION[action]) {
56
- const snsAndSqsData = {
57
- queueName: createQueueNameForSnsAndSqsQueue(_izContext, objectSchema, action, handler, srcPath)
50
+ queueName: upperCase(action)
58
51
  }
59
52
  snsAndSqsData.queueName && snsAndSqsDataArray.push(snsAndSqsData);
60
53
  }
@@ -63,46 +56,26 @@ function dataForCreateSnsAndSqsQueueFromObjectSchema(_izContext, objectSchema, s
63
56
  return snsAndSqsDataArray
64
57
  }
65
58
 
66
- function createQueueNameForSnsAndSqsQueue(_izContext, objectSchema, action, handler) {
67
- let objectType = objectSchema.objectType
68
- let queueName = upperCase(objectType) + upperCase(action) + upperCase(handler)
69
- if (queueName.includes('HdrSqs')) {
70
- queueName = upperCase(objectType) + upperCase(action)
71
- } else if (queueName.includes('HdrDsq')) {
72
- queueName = upperCase(objectType) + upperCase(action) + upperCase(handler)
73
- } else {
74
- return
75
- }
76
- return queueName
77
- }
78
-
79
-
80
- const createSourceSnsAndSqs = (_izContext, objectSchema, srcPath) => {
81
- let resultsForCreateSnsAndSqsSource = [];
82
- let setting = {
83
- initialData: 'Resources:\n',
84
- savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
85
- saveFileName: SAVE_FILE_NAME.snsInSqsYaml,
86
- fileExtension: '.yml',
87
- isAppend: true
88
- }
89
- const snsAndSqsDataList = dataForCreateSnsAndSqsQueueFromObjectSchema(_izContext, objectSchema, srcPath);
59
+ const createSourceSnsAndSqs = (_izContext, srcPath) => {
60
+ let resultsForCreateSnsAndSqsSource = new Set();
61
+ const snsAndSqsDataList = dataForCreateSnsAndSqsQueueFromObjectSchema(_izContext, srcPath);
90
62
  for (let snsAndSqsData of snsAndSqsDataList) {
91
- if (snsAndSqsData.queueName.includes('HdrDsq')) {
92
- resultsForCreateSnsAndSqsSource.push({
93
- templatePath: sqsTemplatePath,
94
- templateData: snsAndSqsData,
95
- setting: setting
96
- })
97
- } else {
98
- resultsForCreateSnsAndSqsSource.push({
63
+ resultsForCreateSnsAndSqsSource.add(
64
+ {
99
65
  templatePath: snsTemplatePath,
100
66
  templateData: snsAndSqsData,
101
- setting: setting
102
- })
103
- }
67
+ setting: {
68
+ initialData: 'Resources:\n',
69
+ savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
70
+ saveFileName: SAVE_FILE_NAME.snsInSqsYaml,
71
+ fileExtension: '.yml',
72
+ isAppend: true
73
+ }
74
+ }
75
+ )
104
76
  }
105
- return resultsForCreateSnsAndSqsSource
77
+ // console.log("resultsForCreateSnsAndSqsSource", resultsForCreateSnsAndSqsSource)
78
+ return [...resultsForCreateSnsAndSqsSource]
106
79
  }
107
80
 
108
81
  module.exports = createSourceSnsAndSqs
@@ -3,7 +3,7 @@
3
3
  Type: AWS::SNS::Topic
4
4
  Properties:
5
5
  DisplayName: "SNS Message in"
6
- TopicName: ${self:custom.iz_resourcePrefix}In<%- queueName %>
6
+ TopicName: ${self:custom.iz_serviceTag}_${self:custom.iz_stage}_<%- queueName %>_In
7
7
  ##===== SNS Subscription
8
8
  ##===== [Topic In]
9
9
  SubscriptionIn<%- queueName %>:
@@ -20,7 +20,7 @@ const path = require('path');
20
20
 
21
21
  const { ACTIONS, HANDLER } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
22
22
 
23
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase, firstLetterUpperCase } = require('../../../../MainLibs/src/Utils.js')
23
+ const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require('../../../../MainLibs/src/Utils.js')
24
24
  const { DEFAULT_HANDLER_PER_ACTION, SOURCE_PATH, SAVE_FILE_NAME } = require("../../../../MainLibs/src/Consts.js");
25
25
 
26
26
  const templatePath = path.join(__dirname, "./template.ejs")
@@ -31,41 +31,25 @@ const templatePath = path.join(__dirname, "./template.ejs")
31
31
  *
32
32
  * @return {{ templatePath, templateData, setting } }
33
33
  */
34
- function createDataForCreateSourceSnsOut(_izContext, objectSchema, srcPath) {
34
+ function createDataForCreateSourceSnsOut(_izContext) {
35
35
  const createSourceArray = [];
36
36
  for (const action of Object.values(ACTIONS)) {
37
- if (objectSchema.overWriteHandlers?.[action]) {
38
- for (const handler of objectSchema.overWriteHandlers[action]) {
37
+ for (const handler of DEFAULT_HANDLER_PER_ACTION[action]) {
38
+ if (handler === HANDLER.hdrSqs) {
39
39
  const snsOut = {
40
- queueName: createQueueName(_izContext, objectSchema, action, handler, srcPath)
41
- }
42
- snsOut.queueName && createSourceArray.push(snsOut)
43
- }
44
- } else {
45
- for (const handler of DEFAULT_HANDLER_PER_ACTION[action]) {
46
- const snsOut = {
47
- queueName: createQueueName(_izContext, objectSchema, action, handler, srcPath)
40
+ queueName: upperCase(action)
48
41
  }
49
42
  snsOut.queueName && createSourceArray.push(snsOut)
50
43
  }
51
44
  }
52
45
  }
53
- // console.log("createSourceArrayInCreateSourceSnsOut", createSourceArray)
46
+ // console.log("createSourceArray", createSourceArray)
54
47
  return createSourceArray;
55
48
  }
56
49
 
57
- function createQueueName(_izContext, objectSchema, action, handler) {
58
- let objectType = objectSchema.objectType
59
- let queueName = upperCase(objectType) + upperCase(action) + upperCase(handler)
60
- if (queueName.includes("HdrSqs")) {
61
- queueName = upperCase(objectType) + upperCase(action)
62
- } else
63
- return
64
- return queueName
65
- }
66
- function createSourceSnsOut(_izContext, objectSchema, srcPath) {
50
+ function createSourceSnsOut(_izContext, srcPath) {
67
51
  let resultsForCreateSnsOut = [];
68
- const snsOutDataList = createDataForCreateSourceSnsOut(_izContext, objectSchema, srcPath);
52
+ const snsOutDataList = createDataForCreateSourceSnsOut(_izContext);
69
53
  for (let snsOutData of snsOutDataList) {
70
54
  resultsForCreateSnsOut.push(
71
55
  {
@@ -3,7 +3,7 @@
3
3
  Type: AWS::SNS::Topic
4
4
  Properties:
5
5
  DisplayName: "SNS Message out"
6
- TopicName: ${self:custom.iz_resourcePrefix}Out<%- firstLetterUpperCase(queueName) %>
6
+ TopicName: ${self:custom.iz_serviceTag}_${self:custom.iz_stage}_<%- firstLetterUpperCase(queueName) %>_Out
7
7
 
8
8
  <%_ function firstLetterUpperCase(text) {
9
9
  return text.charAt(0).toUpperCase() + text.slice(1)
@@ -1,5 +0,0 @@
1
- module.exports = [
2
- {
3
- objectType: "<%- objectType %>",
4
- }
5
- ]
@@ -1,76 +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
- 'use strict';
19
- const path = require('path');
20
-
21
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils");
22
- const { SOURCE_PATH, defaultIamRolePerAction, shortNameHandler, SAVE_FILE_NAME, createIamRole, RESOURCE_CLASSES, SNS_RESOURCE, resourceNames, DYNAMO_RESOURCE } = require('../../../../libs/Consts');
23
- const templatePath = path.join(__dirname, "./template.ejs")
24
-
25
-
26
- function data(_izContext, flowSchema, srcPath) {
27
- return [createSourceParams(_izContext, srcPath)]
28
- }
29
-
30
- function createSourceParams(_izContext, flowSchema, srcPath) {
31
- let functionName = "InProcessWebSocket";
32
- let handlerType = "HdrWbs"
33
- let additionalResourcePermission = defaultIamRolePerAction();
34
- let functionNameConfig = upperCase(functionName) + upperCase(shortNameHandler(handlerType))
35
-
36
- additionalResourcePermission.push(
37
- createIamRole(
38
- {
39
- [RESOURCE_CLASSES.sns]: [SNS_RESOURCE.publish]
40
- },
41
- [
42
- resourceNames(RESOURCE_CLASSES.sns, `InProcess${flowSchema.flowTag}`)
43
- ]
44
- ),
45
- createIamRole(
46
- {
47
- [RESOURCE_CLASSES.dynamoDbTable]: [
48
- DYNAMO_RESOURCE.putItem,
49
- DYNAMO_RESOURCE.deleteItem
50
- ]
51
- },
52
- resourceNames(RESOURCE_CLASSES.dynamoDbTable, "WebSocketTask")
53
- )
54
- )
55
-
56
- return {
57
- templatePath: templatePath,
58
- templateData: {
59
- functionName,
60
- handlerType,
61
- functionNameConfig,
62
- additionalResourcePermission,
63
- resourceLocation: SOURCE_PATH.resourceLocationWebSocket,
64
- route: flowSchema.flowTag
65
- },
66
- setting: {
67
- savePath: path.join(srcPath, SOURCE_PATH.appYaml),
68
- saveFileName: upperCase(SAVE_FILE_NAME.flowSchema),
69
- fileExtension: '.yml',
70
- isAppend: true
71
- }
72
- }
73
- }
74
-
75
-
76
- module.exports = data;
@@ -1,35 +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
- 'use strict';
19
- const path = require('path');
20
-
21
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils");
22
- const { SOURCE_PATH } = require('../../../../libs/Consts');
23
- const templatePath = path.join(__dirname, './template.ejs')
24
-
25
-
26
- function data(_izContext, srcPath) {
27
- return [createSourceParams(_izContext, srcPath)]
28
- }
29
-
30
- function createSourceParams(_izContext, srcPath) {
31
-
32
- }
33
-
34
-
35
- module.exports = data;
@@ -1,34 +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
- 'use strict';
19
- const path = require('path');
20
-
21
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../MainLibs/src/Utils");
22
- const { SOURCE_PATH } = require('../../libs/Consts');
23
-
24
-
25
- function data(_izContext, srcPath) {
26
- return [createSourceParams(_izContext, srcPath)]
27
- }
28
-
29
- function createSourceParams(_izContext, srcPath) {
30
-
31
- }
32
-
33
-
34
- module.exports = data;
@@ -1,34 +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
- 'use strict';
19
- const path = require('path');
20
-
21
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../MainLibs/src/Utils");
22
- const { SOURCE_PATH } = require('../../libs/Consts');
23
-
24
-
25
- function data(_izContext, srcPath) {
26
- return [createSourceParams(_izContext, srcPath)]
27
- }
28
-
29
- function createSourceParams(_izContext, srcPath) {
30
-
31
- }
32
-
33
-
34
- module.exports = data;
@@ -1,34 +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
- 'use strict';
19
- const path = require('path');
20
-
21
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../MainLibs/src/Utils");
22
- const { SOURCE_PATH } = require('../../libs/Consts');
23
-
24
-
25
- function data(_izContext, srcPath) {
26
- return [createSourceParams(_izContext, srcPath)]
27
- }
28
-
29
- function createSourceParams(_izContext, srcPath) {
30
-
31
- }
32
-
33
-
34
- module.exports = data;
@@ -1,34 +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
- 'use strict';
19
- const path = require('path');
20
-
21
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../MainLibs/src/Utils");
22
- const { SOURCE_PATH } = require('../../libs/Consts');
23
-
24
-
25
- function data(_izContext, srcPath) {
26
- return [createSourceParams(_izContext, srcPath)]
27
- }
28
-
29
- function createSourceParams(_izContext, srcPath) {
30
-
31
- }
32
-
33
-
34
- module.exports = data;
@@ -1,93 +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
- 'use strict';
19
- const path = require('path');
20
- const { HANDLER } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
21
- const { createHookFunction } = require('../../../../../../SourceManager/src/Utils')
22
- const { FLOW_SCHEMA_HOOK_STATE } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
23
- const { firstLetterUpperCase: upperCase } = require('../../../../../../MainLibs/src/Utils')
24
- const { SOURCE_PATH, defaultIamRolePerAction, createIamRole, RESOURCE_CLASSES, SNS_RESOURCE, resourceNames, DYNAMO_RESOURCE, SAVE_FILE_NAME, FUNCTION_NAME, shortNameHandler, SQS_RESOURCE } = require("../../../../libs/Consts");
25
- const asyncTemplatePath = path.join(__dirname, "templateAsyncHandler.ejs")
26
- const syncTemplatePath = path.join(__dirname, "templateSyncHandler.ejs")
27
- /**
28
- * receive objectSchema
29
- * create data for WebScoket handler template
30
- *
31
- * @param {Object} objectSchema
32
- * @return {{templatePath, templateData,setting}}
33
- */
34
-
35
- function data(_izContext, flowSchema, srcPath) {
36
- return [createSourceParams(_izContext, flowSchema, srcPath)]
37
- }
38
-
39
- function createSourceParams(_izContext, flowSchema, srcPath) {
40
- let hook;
41
- let hookFunctionName
42
- let handlerType;
43
- let queueName;
44
- if (flowSchema?.hook) {
45
- for (const [hookName, hookProperties] of Object.entries(flowSchema.hook)) {
46
- for (const hookFunction of hookProperties.functionList) {
47
- if (hookName === FLOW_SCHEMA_HOOK_STATE.beforeCreate) {
48
- if (hookFunction.continueFlow === true && hookFunction.event.initialEvent === false) {
49
- hook = true
50
- hookFunctionName = upperCase(hookFunction.name)
51
- handlerType = upperCase(hookFunction.event.handlerType);
52
- if (upperCase(handlerType) === upperCase(HANDLER.hdrDsq)) {
53
- queueName = hookFunction.event.queueName;
54
- } else if (upperCase(handlerType) === upperCase(HANDLER.hdrSqs)) {
55
- queueName = hookFunction.event.topicName;
56
- }
57
- }
58
- }
59
- }
60
- }
61
- }
62
-
63
- if (upperCase(handlerType) === upperCase(HANDLER.hdrSqs) || upperCase(handlerType) === upperCase(HANDLER.hdrDsq)) {
64
- return {
65
- templatePath: asyncTemplatePath,
66
- templateData: {
67
- hookFunctionName,
68
- queueName
69
- },
70
- setting: {
71
- savePath: path.join(srcPath, SOURCE_PATH.generatedCodeWebSocketHook),
72
- saveFileName: `${upperCase(hookFunctionName)}_${upperCase(handlerType)}`,
73
- fileExtension: ".js",
74
- isAppend: false
75
- }
76
- }
77
- } else if (upperCase(handlerType) === upperCase(HANDLER.hdrApi) || upperCase(handlerType) === upperCase(HANDLER.hdrInv)) {
78
- return {
79
- templatePath: syncTemplatePath,
80
- templateData: {
81
- hookFunctionName,
82
- },
83
- setting: {
84
- savePath: path.join(srcPath, SOURCE_PATH.generatedCodeWebSocketHook),
85
- saveFileName: `${upperCase(hookFunctionName)}_${upperCase(handlerType)}`,
86
- fileExtension: ".js",
87
- isAppend: false
88
- }
89
- }
90
- }
91
- }
92
-
93
- module.exports = data;
@@ -1,110 +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
- 'use strict';
19
-
20
- // const AWS = require('aws-sdk');
21
- // const sqs = new AWS.SQS(firstLetterUpperCase{ apiVersion: '2012-11-05' });
22
-
23
- const izara = require("@izara_project/izara-middleware");
24
- const middleware = izara.middlewareHandler;
25
- const recordHandlerSharedLib = require("@izara_project/izara-shared").recordHandlerSharedLib;
26
- const Logger = require('@izara_project/izara-core-library-logger');
27
- const izaraShared = require('@izara_project/izara-shared');
28
- const callingFlowSharedLib = izaraShared.callingFlowSharedLib;
29
-
30
- const <%- hookFunctionName %> = require('./<%- hookFunctionName %>_Main')
31
-
32
- // validate event properties in body.Message of sqs event
33
- middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
34
-
35
- // set schema for record.body.Message
36
- let perRecordsValidatorSchema = {
37
- type: "object",
38
- required: [
39
- 'returnMessage',
40
- 'errorsFound',
41
- 'passStatus'
42
- ],
43
- properties: {
44
- returnMessage: {
45
- type: "object"
46
- },
47
- errorsFound: {
48
- type: "array"
49
- },
50
- passStatus: {
51
- type: 'boolean'
52
- }
53
- }
54
- };
55
-
56
- perRecordsValidatorSchema = callingFlowSharedLib.addOptionalPassBackPropertiesToValidatorSchema(perRecordsValidatorSchema)
57
-
58
- module.exports.main = middleware.wrap(async (event, context, callback) => {
59
-
60
- try {
61
-
62
- let recordPromises = [];
63
-
64
- // loop each record and send to mainFunction
65
- await Promise.all(event.Records.map(async record => { // promise.all for map() function
66
-
67
- let passOnProperties = []
68
- record._izContext.logger.debug('record ReceiveMsgOutHdrSqs', record);
69
-
70
- // validate message (and MessageAttributes)
71
- await recordHandlerSharedLib.validateRecord(
72
- record, // one record will send to mainFunction
73
- "<%- queueName %>", // queue name that need to retry or send to dlq
74
- perRecordsValidatorSchema, // schema for record.Message
75
- // messageAttributeValidatorSchema // ----- for msgAttr default is null -> do not send this parameter if not want to validate msgAtt
76
- );
77
-
78
- // add argument (to invoke lambda) to passOnProperties[]
79
- passOnProperties.push(record.body.Message)
80
- passOnProperties.push(callingFlowSharedLib.addPassBackPropertiesToPassOnProperties(record.body.Message))
81
- record._izContext.logger.debug('passOnProperties in handler', passOnProperties);
82
-
83
- // call recordHandlerSharedLib.recordHandler with 3 parameters and return promise(resolve)
84
- let recordPromise = recordHandlerSharedLib.recordHandler(
85
- record, // one record will send to mainFunction
86
- <%- hookFunctionName %>.<%- hookFunctionName %>, // mainFunction that need to invoke.
87
- "<%- queueName %>", // queue name that need to retry or send to dlq
88
- passOnProperties, // all parameters that mainFunction needed.
89
- );
90
- record._izContext.logger.debug('after recordPromise in handler');
91
- recordPromises.push(recordPromise); // push promise to recordPromises
92
- }))
93
-
94
- Logger.debug('before Promise.all(recordPromises) in handler');
95
- try {
96
- // --- main await all promises
97
- await Promise.all(recordPromises); // await all promises
98
-
99
- return event.Records // return all for local test
100
-
101
- } catch {
102
- Logger.debug('Promise.all(recordPromises) in handler threw error (at least one record did no resolve)');
103
- }
104
- Logger.debug('after Promise.all(recordPromises) in handler');
105
-
106
- } catch (err) {
107
- Logger.error('Unhandled Error, <%- hookFunctionName %>: ', err);
108
- throw (err);
109
- }
110
- });