@izara_project/izara-market-library-service-schemas 1.0.36 → 1.0.38

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 (150) hide show
  1. package/package.json +8 -7
  2. package/src/GenerateCodeLibs/src/Consts.js +2 -2
  3. package/src/GenerateCodeLibs/src/GenerateCodeLibs.js +36 -6
  4. package/src/MainLibs/src/Consts.js +5 -2
  5. package/src/MainLibs/src/GenerateCodeUtils.js +3 -1
  6. package/src/MainLibs/src/Utils.js +12 -0
  7. package/src/TemplateManager/src/flowSchema/DefaultWebSocketResource/webSocketConnect/handler/template.ejs +1 -1
  8. package/src/TemplateManager/src/flowSchema/FlowSchemaEndpoint/InProcessFlowSchema/handler/template.ejs +1 -1
  9. package/src/TemplateManager/src/flowSchema/UploadS3Case/createObject/handler/template.ejs +1 -1
  10. package/src/TemplateManager/src/flowSchema/UploadS3Case/createObject/mainFunction/template.ejs +1 -1
  11. package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/getsignUrlsAcc/mainFunction/template.ejs +1 -1
  12. package/src/TemplateManager/src/flowSchema/UploadS3Case/createPresignUrl/reservedLimitComplete/mainFunction/template.ejs +1 -1
  13. package/src/TemplateManager/src/flowSchema/UploadS3Case/processFileS3AfterUpload/mainFunction/template.ejs +1 -1
  14. package/src/TemplateManager/src/flowSchema/UploadS3Case/relate/libs/template.ejs +1 -1
  15. package/src/reStructure/GenerateCode.js +2 -2
  16. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/backupTemplate.ejs +1 -1
  17. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +37 -12
  18. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +25 -2
  19. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +26 -0
  20. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +23 -1
  21. package/src/reStructure/TemplateData/EndpointPerService/yaml/data.js +37 -7
  22. package/src/reStructure/TemplateData/externalService/lambdaRole/data.js +7 -7
  23. package/src/reStructure/TemplateData/externalService/lambdaRole/template.ejs +1 -1
  24. package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/data.js +4 -2
  25. package/src/reStructure/TemplateData/findData/GetByStorage/getByGraph.ejs +4 -3
  26. package/src/reStructure/TemplateData/findData/handler/template.ejs +2 -1
  27. package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/mainFunction/data.js +4 -10
  28. package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/mainFunction/template.ejs +1 -1
  29. package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/template.ejs +3 -1
  30. package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/data.js +3 -2
  31. package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/template.ejs +3 -12
  32. package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/template.ejs +6 -2
  33. package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/mainFunction/template.ejs +18 -2
  34. package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/sns-sqs/data.js +1 -1
  35. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/template.ejs +9 -6
  36. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/template.ejs +2 -2
  37. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/sqs/data.js +3 -3
  38. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/sqs/template.ejs +1 -1
  39. package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/mainFunction/template.ejs +2 -2
  40. package/src/reStructure/TemplateData/flowSchema/components/upload/relate/libs/template.ejs +2 -2
  41. package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/functionYaml/data.js +1 -1
  42. package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/data.js +1 -1
  43. package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/template.ejs +1 -1
  44. package/src/reStructure/TemplateData/flowSchema/externalTopic/functionYaml/data.js +127 -0
  45. package/src/reStructure/TemplateData/flowSchema/externalTopic/handler/data.js +121 -0
  46. package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/FlowSchemaCompleteComponent → externalTopic}/handler/template.ejs +4 -3
  47. package/src/reStructure/TemplateData/flowSchema/externalTopic/mainFunction/data.js +74 -0
  48. package/src/reStructure/TemplateData/flowSchema/externalTopic/mainFunction/template.ejs +131 -0
  49. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/data.js +61 -34
  50. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/template.ejs +1 -1
  51. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/data.js +9 -8
  52. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/data.js +3 -2
  53. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/data.js +19 -8
  54. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/template.ejs +19 -25
  55. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/functionYaml/data.js +2 -4
  56. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/handler/template.ejs +1 -1
  57. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/data.js +2 -5
  58. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/template.ejs +4 -3
  59. package/src/reStructure/TemplateData/flowSchema/{externalTopic/sqs → flowSchemaOwnTopic/flowStep}/functionYaml/data.js +43 -38
  60. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowStep/functionYaml/template.ejs +20 -0
  61. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowStep/handler/data.js +80 -0
  62. package/src/reStructure/TemplateData/flowSchema/{externalTopic/sqs → flowSchemaOwnTopic/flowStep}/handler/template.ejs +16 -61
  63. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowStep/mainFunction/data.js +92 -0
  64. package/src/reStructure/TemplateData/flowSchema/{externalTopic/websocket → flowSchemaOwnTopic/flowStep}/mainFunction/template.ejs +12 -14
  65. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-in/data.js +48 -30
  66. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-out/data.js +21 -24
  67. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/functionYaml/data.js +7 -22
  68. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/webSocketComplete/functionYaml/template.ejs +20 -0
  69. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/handler/data.js +2 -2
  70. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/webSocketComplete/handler/template.ejs +84 -0
  71. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/mainFunction/data.js +2 -2
  72. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/{FlowSchemaCompleteComponent → webSocketComplete}/mainFunction/template.ejs +27 -11
  73. package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +25 -30
  74. package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/functionYaml/data.js +0 -27
  75. package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/handler/template.ejs +1 -1
  76. package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/mainFunction/data.js +3 -3
  77. package/src/reStructure/TemplateData/flowSchema/register/complete/mainFunction/template.ejs +172 -0
  78. package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/dynamoDB/register.js +1 -1
  79. package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/subscriptionOutAll/data.js +29 -19
  80. package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/functionYaml/data.js +28 -50
  81. package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/handler/template.ejs +1 -1
  82. package/src/reStructure/TemplateData/flowSchema/register/wbs/mainFunction/template.ejs +165 -0
  83. package/src/reStructure/TemplateData/flowSchema/templateBystatusType/storedCacheTemplate.ejs +38 -0
  84. package/src/reStructure/TemplateData/flowSchema/templateBystatusType/triggerCacheTemplate.ejs +39 -0
  85. package/src/reStructure/TemplateData/generateRole/sharedResourceTemplate.ejs +0 -29
  86. package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/createObjectComplete_main.js +1 -1
  87. package/src/reStructure/TemplateData/perActionComplete/create/mainFunction/template.ejs +1 -1
  88. package/src/reStructure/TemplateData/perActionComplete/delete/mainFunction/template.ejs +1 -1
  89. package/src/reStructure/TemplateData/perActionComplete/get/mainFunction/template.ejs +4 -1
  90. package/src/reStructure/TemplateData/perActionComplete/update/mainFunction/template.ejs +6 -2
  91. package/src/reStructure/TemplateData/perActionEndpoint/libs/template.ejs +1 -1
  92. package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/create/template.ejs +1 -1
  93. package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/delete/template.ejs +1 -1
  94. package/src/reStructure/TemplateData/perActionEndpoint/mainFunction/update/template.ejs +1 -1
  95. package/src/reStructure/TemplateData/propertyValueSchema/relationshipPropertyValueSchema/data.js +2 -7
  96. package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/api/data.js +22 -3
  97. package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/dsq/data.js +14 -9
  98. package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/inv/data.js +26 -6
  99. package/src/reStructure/TemplateData/relationshipPerAction/create/action/functionYaml/sqs/data.js +11 -7
  100. package/src/reStructure/TemplateData/relationshipPerAction/create/action/mainFunction/template.ejs +1 -1
  101. package/src/reStructure/TemplateData/relationshipPerAction/create/complete/functionYaml/data.js +17 -7
  102. package/src/reStructure/TemplateData/relationshipPerAction/create/complete/mainFunction/template.ejs +1 -1
  103. package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/api/data.js +23 -4
  104. package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/dsq/data.js +14 -9
  105. package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/inv/data.js +26 -6
  106. package/src/reStructure/TemplateData/relationshipPerAction/delete/action/functionYaml/sqs/data.js +10 -7
  107. package/src/reStructure/TemplateData/relationshipPerAction/delete/action/mainFunction/template.ejs +1 -1
  108. package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/functionYaml/data.js +11 -7
  109. package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/mainFunction/template.ejs +1 -1
  110. package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/api/data.js +23 -4
  111. package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/dsq/data.js +14 -9
  112. package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/inv/data.js +26 -7
  113. package/src/reStructure/TemplateData/relationshipPerAction/get/action/functionYaml/sqs/data.js +10 -7
  114. package/src/reStructure/TemplateData/relationshipPerAction/get/action/mainFunction/template.ejs +1 -2
  115. package/src/reStructure/TemplateData/relationshipPerAction/get/complete/functionYaml/data.js +12 -7
  116. package/src/reStructure/TemplateData/relationshipPerAction/get/complete/mainFunction/template.ejs +1 -1
  117. package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/api/data.js +22 -3
  118. package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/dsq/data.js +14 -6
  119. package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/inv/data.js +20 -3
  120. package/src/reStructure/TemplateData/relationshipPerAction/update/action/functionYaml/sqs/data.js +9 -3
  121. package/src/reStructure/TemplateData/relationshipPerAction/update/action/mainFunction/template.ejs +1 -1
  122. package/src/reStructure/TemplateData/relationshipPerAction/update/complete/functionYaml/data.js +12 -6
  123. package/src/reStructure/TemplateData/relationshipPerAction/update/complete/mainFunction/template.ejs +1 -1
  124. package/src/reStructure/TemplateData/resourceYaml/dynamodb/mainResourcePerObjectSchemaData.js +6 -2
  125. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/complete/mainFunction/template.ejs +0 -131
  126. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/storedCacheTemplate.ejs +0 -11
  127. package/src/reStructure/TemplateData/flowSchema/createRecordByStatusType/wbs/mainFunction/template.ejs +0 -222
  128. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/data.js +0 -74
  129. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/template.ejs +0 -8
  130. package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/functionYaml/template.ejs +0 -17
  131. package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/handler/data.js +0 -64
  132. package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/mainFunction/data.js +0 -61
  133. package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/mainFunction/template.ejs +0 -45
  134. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/data.js +0 -110
  135. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/template.ejs +0 -18
  136. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/data.js +0 -57
  137. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/template.ejs +0 -40
  138. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/data.js +0 -67
  139. package/src/reStructure/TemplateData/testTemplate/data.js +0 -27
  140. package/src/reStructure/TemplateData/testTemplate/template.ejs +0 -0
  141. /package/src/reStructure/TemplateData/flowSchema/{flowSchemaOwnTopic/FlowSchemaCompleteComponent → externalTopic}/functionYaml/template.ejs +0 -0
  142. /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/functionYaml/template.ejs +0 -0
  143. /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/complete/handler/data.js +0 -0
  144. /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/sns-in/data.js +0 -0
  145. /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/sns-in/template.ejs +0 -0
  146. /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/subscriptionOutAll/template.ejs +0 -0
  147. /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/functionYaml/template.ejs +0 -0
  148. /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/handler/data.js +0 -0
  149. /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → register}/wbs/mainFunction/data.js +0 -0
  150. /package/src/reStructure/TemplateData/flowSchema/{createRecordByStatusType → templateBystatusType}/statusFieldTemplate.ejs +0 -0
@@ -1,17 +0,0 @@
1
- <%_ const join = require('path').join _%>
2
- <%- firstLetterUpperCase(functionNameConfig) %>:
3
- handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}Out_${firstLetterUpperCase(handlerType)}.main`) %>
4
- name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionNameConfig) %>
5
- events:
6
- - sqs:
7
- arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionName) + firstLetterUpperCase(handlerType) %>
8
- batchSize: 10
9
- role: <%- firstLetterUpperCase(roleName) _%>Role
10
- #<#<%- functionName %><%- handlerType %>IamRole#>
11
- #<#/<%- functionName %><%- handlerType %>IamRole#>
12
- <%_ function firstLetterUpperCase(text){
13
- return text.charAt(0).toUpperCase() + text.slice(1)
14
- } _%>
15
- <%_ function firstLetterLowerCase(str) {
16
- return str.charAt(0).toLowerCase() + str.slice(1)
17
- } _%>
@@ -1,64 +0,0 @@
1
- /*
2
- Copyright (C) 2020 Sven Mason <http://izara.io>
3
-
4
- This program is free software: you can redistribute it and/or modify
5
- it under the terms of the GNU Affero General Public License as
6
- published by the Free Software Foundation, either version 3 of the
7
- License, or (at your option) any later version.
8
-
9
- This program is distributed in the hope that it will be useful,
10
- but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- GNU Affero General Public License for more details.
13
-
14
- You should have received a copy of the GNU Affero General Public License
15
- along with this program. If not, see <http://www.gnu.org/licenses/>.
16
- */
17
-
18
- 'use strict';
19
-
20
- const path = require('path');
21
- const { FLOW_SCHEMA_HOOK_STATE, HANDLER } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
22
-
23
- const { SOURCE_PATH, FUNCTION_NAME, SOURCE_GENERATE_IAM_ROLE } = require("../../../../../../MainLibs/src/Consts");
24
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils");
25
- const templatePath = path.join(__dirname, "template.ejs")
26
-
27
- /**
28
- * receive objectSchema
29
- * create data for SQS handler template
30
- *
31
- * @param {Object} objectSchema
32
- * @return {{templatePath, templateData,setting}}
33
- */
34
- function data(_izContext, flowSchema, srcPath) {
35
- return [createParamsForCreateSource(_izContext, flowSchema, srcPath)]
36
- }
37
-
38
- function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
39
- const flowStepInSplitKey = Object.keys(flowSchema.flowSteps)[0].split('_');
40
- if (flowStepInSplitKey.length < 4) {
41
- _izContext.logger.error(`flowStepInSplitKey.length < 4: ${flowStepInSplitKey.length} ${flowSchema.flowTag}`);
42
- return null;
43
- }
44
- let functionName = upperCase(flowSchema.flowTag) + "ExternalTopicOut"
45
- let handlerType = upperCase(HANDLER.hdrSqs);
46
- return {
47
- templatePath: templatePath,
48
- templateData: {
49
- queueName: functionName + handlerType,
50
- fileName: functionName + '_Main',
51
- functionMain: functionName + 'Main',
52
- handler: HANDLER.hdrSqs,
53
- firstLetterUpperCase: upperCase,
54
- functionName
55
- },
56
- setting: {
57
- savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, 'source/'),
58
- saveFileName: `${functionName}_${handlerType}`,
59
- fileExtension: ".js",
60
- isAppend: false
61
- }
62
- }
63
- }
64
- module.exports = data
@@ -1,61 +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
-
20
- const path = require('path');
21
-
22
- const { SOURCE_PATH, FUNCTION_NAME, HANDLER } = require("../../../../../../MainLibs/src/Consts");
23
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils");
24
- const templatePath = path.join(__dirname, "template.ejs");
25
- const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema')
26
-
27
- /**
28
- * receive objectSchema
29
- * create data for Sqs Main template
30
- *
31
- * @param {Object} objectSchema
32
- * @return {{templatePath, templateData,setting}}
33
- */
34
-
35
-
36
- function data(_izContext, flowSchema, srcPath) {
37
- return [createParamsForCreateSource(_izContext, flowSchema, srcPath)]
38
- }
39
-
40
- function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
41
- let functionName = upperCase(flowSchema.flowTag) + "ExternalTopicOut";
42
- let snsTopicIn = Object.keys(flowSchema.flowSteps)
43
- let snsTopicInWithoutUnderscore = snsTopicIn[0].replace(/_/g, '')
44
- let handlerType = upperCase(HANDLER.hdrSqs);
45
- // let objectSchema = await getObjectSchema.getObjectSchemaCombineFieldNamesWithCache(_izContext, flowSchema.objType)
46
- // let fieldNames = Object.keys(objectSchema.fieldNames)
47
- return {
48
- templatePath: templatePath,
49
- templateData: {
50
- snsTopicIn: snsTopicInWithoutUnderscore,
51
- externalTopicOutMain: functionName,
52
- },
53
- setting: {
54
- savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, 'source/'),
55
- saveFileName: `${functionName}_Main`,
56
- fileExtension: ".js",
57
- isAppend: false
58
- }
59
- }
60
- }
61
- module.exports = data
@@ -1,45 +0,0 @@
1
- /* Copyright (C) 2020 Sven Mason <http: //izara.io> This program is free
2
- software: you can redistribute it and/or modify it under the terms of the GNU
3
- Affero General Public License as published by the Free Software Foundation,
4
- either version 3 of the License, or (at your option) any later version. This
5
- program is distributed in the hope that it will be useful, but WITHOUT ANY
6
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
7
- PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
8
- You should have received a copy of the GNU Affero General Public License along
9
- with this program. If not, see <http: //www.gnu.org/licenses />. */ 'use
10
- strict'; const hash = require("object-hash"); const getObjectSchema =
11
- require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema');
12
- const dynamodbSharedLib = require('@izara_project/izara-core-library-dynamodb');
13
- const snsSharedLib = require('@izara_project/izara-core-library-sns'); const
14
- asyncFlowSharedLib =
15
- require('@izara_project/izara-core-library-asynchronous-flow'); const
16
- callingFlowSharedLib =
17
- require('@izara_project/izara-core-library-calling-flow'); const lambdaSharedLib
18
- = require('@izara_project/izara-core-library-lambda'); const externalRequestSns
19
- = require('@izara_project/izara-core-library-external-request').sns; const utils
20
- =
21
- require('@izara_project/izara-market-library-service-schemas/src/MainLibs/src/Utils')
22
- const { NoRetryError, consts } =
23
- require('@izara_project/izara-core-library-core') const { v4: uuidv4 } =
24
- require('uuid') const { TOPIC_NAME_GENERATE_CODE } =
25
- require('@izara_project/izara-market-library-service-schemas/src/GenerateCodeLibs/src/Consts')
26
- const { postToConnection } = require("../../../libs/source/GenerateCodeLibs");
27
- /** * * * description of function. * @param {Object} _izContext * @param
28
- {CorrelationIds} _izContext.correlationIds - property of _izContext * @param
29
- {Logger} _izContext.logger - property of _izContext * @param {Object}
30
- requestParams - request params * @param {Object} requestParams.identifiers -
31
- identifiers for get data * @param {Object} requestParams.additionalRequest -
32
- additionalRequest * * * @returns {object} description of return value */
33
- module.exports.<%- externalTopicOutMain %>Main = async ( _izContext,
34
- requestParams, callingFlowConfig = {}, //(<additionalParams
35
- >) //(</additionalParams
36
- >) ) => { try { let connectionId =
37
- _izContext.correlationIds.get(coreConsts.CONNECTION_ID); let correlationId =
38
- _izContext.correlationIds.get(coreConsts.X_CORRELATION_ID); await
39
- postToConnection( { message: requestParams }, connectionId ) await
40
- dynamodbSharedLib.deleteItem(_izContext, await
41
- dynamodbSharedLib.tableName(_izContext, "WebSocketTask"), { taskKey:
42
- correlationId, connectionId: connectionId } ) //(<additionalParams
43
- >) //(</additionalParams
44
- >) } catch (err) { _izContext.logger.error('error WebSocketInvoke: ', err) throw
45
- (err) } }
@@ -1,110 +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
-
20
- const path = require('path');
21
-
22
- const { FLOW_SCHEMA_HOOK_STATE } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
23
-
24
- const { firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils");
25
- const {
26
- SOURCE_PATH,
27
- defaultIamRolePerAction,
28
- createIamRole,
29
- RESOURCE_CLASSES,
30
- SNS_RESOURCE,
31
- resourceNames,
32
- DYNAMO_RESOURCE,
33
- SAVE_FILE_NAME,
34
- FUNCTION_NAME,
35
- shortNameHandler,
36
- externalResourceYaml,
37
- SOURCE_GENERATE_IAM_ROLE
38
- } = require("../../../../../../MainLibs/src/Consts");
39
-
40
- const templatePath = path.join(__dirname, "template.ejs");
41
- const hookTemplate = path.join(__dirname, "./hookTemplate.ejs");
42
- /**
43
- * receive objectSchema
44
- * create data for WebSocket handler template
45
- *
46
- * @param {Object} objectSchema
47
- * @return {{templatePath, templateData,setting}}
48
- */
49
- function data(_izContext, flowSchema, srcPath) {
50
- return [createSourceParams(_izContext, flowSchema, srcPath)]
51
- }
52
-
53
- function createSourceParams(_izContext, flowSchema, srcPath) {
54
- let functionName = upperCase(flowSchema.flowTag);
55
- let handlerType = upperCase("hdrWbs");
56
- let functionConfig = functionName + "ExternalTopicIn" + upperCase(shortNameHandler(handlerType));
57
- let additionalResourcePermission = defaultIamRolePerAction();
58
- let route = flowSchema.flowTag;
59
-
60
- additionalResourcePermission.push(
61
- createIamRole(
62
- {
63
- [RESOURCE_CLASSES.dynamoDbTable]: [
64
- DYNAMO_RESOURCE.putItem,
65
- DYNAMO_RESOURCE.getItem,
66
- DYNAMO_RESOURCE.query,
67
- DYNAMO_RESOURCE.deleteItem,
68
- DYNAMO_RESOURCE.updateItem
69
- ]
70
- },
71
- [
72
- resourceNames(RESOURCE_CLASSES.dynamoDbTable, "WebSocketTask")
73
- ]
74
- ),
75
- createIamRole(
76
- {
77
- "execute-api": [
78
- "ManageConnections"
79
- ]
80
- },
81
- [
82
- resourceNames(RESOURCE_CLASSES.webSocket)
83
- ]
84
- ),
85
- )
86
-
87
-
88
-
89
- return {
90
- templatePath: templatePath,
91
- templateData: {
92
- resourceLocation: path.join(SOURCE_PATH.resourceLocationFlowSchemaExternalTopic, flowSchema.flowTag, "source/"),
93
- functionName,
94
- handlerType,
95
- functionNameConfig: functionConfig,
96
- additionalResourcePermission,
97
- route,
98
- roleName: SOURCE_GENERATE_IAM_ROLE.ExternalTopicRole,
99
- // externalTopicName
100
- },
101
- setting: {
102
- savePath: path.join(srcPath, SOURCE_PATH.appYaml),
103
- saveFileName: upperCase(SAVE_FILE_NAME.flowSchema),
104
- fileExtension: ".yml",
105
- isAppend: true
106
- }
107
- }
108
- }
109
-
110
- module.exports = data;
@@ -1,18 +0,0 @@
1
- <%_ const join = require('path').join; _%>
2
- <%- firstLetterUpperCase(functionNameConfig) %>:
3
- handler: <%- join(resourceLocation, `${firstLetterUpperCase(functionName)}_${firstLetterUpperCase(handlerType)}.main`)%>
4
- name: ${self:custom.iz_resourcePrefix}<%- firstLetterUpperCase(functionNameConfig) %>
5
- events:
6
- - websocket:
7
- route: <%- route %>
8
- # authorizer: ${self:custom.iz_authorizerAppLevel}
9
- # identifierResource: 'route.request.header.Auth'
10
- role: <%- roleName %>Role
11
- #<#<%- functionName %><%- handlerType %>IamRole#>
12
- #<#/<%- functionName %><%- handlerType %>IamRole#>
13
- <%_ function firstLetterUpperCase(text){
14
- return text.charAt(0).toUpperCase() + text.slice(1)
15
- } _%>
16
- <%_ function firstLetterLowerCase(str) {
17
- return str.charAt(0).toLowerCase() + str.slice(1)
18
- } _%>
@@ -1,57 +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
-
20
- const path = require('path');
21
- const { FLOW_SCHEMA_HOOK_STATE } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
22
-
23
- const { SOURCE_PATH, FUNCTION_NAME } = require("../../../../../../MainLibs/src/Consts");
24
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils");
25
- const templatePath = path.join(__dirname, "template.ejs")
26
-
27
- /**
28
- * receive objectSchema
29
- * create data for WebSocket handler template
30
- *
31
- * @param {Object} objectSchema
32
- * @return {{templatePath, templateData,setting}}
33
- */
34
- function data(_izContext, flowSchema, srcPath) {
35
- return [createParamsForCreateSource(_izContext, flowSchema, srcPath)]
36
- }
37
-
38
- function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
39
- let functionName = upperCase(flowSchema.flowTag) + "ExternalTopicIn"
40
- let handlerType = "HdrWbs"
41
- const flowTag = flowSchema.flowTag
42
- return {
43
- templatePath: templatePath,
44
- templateData: {
45
- functionName: functionName,
46
- fileName: upperCase(functionName),
47
- flowTag,
48
- },
49
- setting: {
50
- savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, 'source/'),
51
- saveFileName: `${upperCase(functionName)}_${handlerType}`,
52
- fileExtension: ".js",
53
- isAppend: false
54
- }
55
- }
56
- }
57
- module.exports = data
@@ -1,40 +0,0 @@
1
- /* Copyright (C) 2021 Sven Mason <http://izara.io> This program is free
2
- software: you can redistribute it and/or modify it under the terms of the GNU
3
- Affero General Public License as published by the Free Software Foundation,
4
- either version 3 of the License, or (at your option) any later version. This
5
- program is distributed in the hope that it will be useful, but WITHOUT ANY
6
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
7
- PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
8
- You should have received a copy of the GNU Affero General Public License along
9
- with this program. If not, see <http://www.gnu.org/licenses/>. */ 'use strict';
10
- const { middlewareHandler, consts } =
11
- require("@izara_project/izara-middleware"); // const AWS = require('aws-sdk');
12
- // const api = new AWS.ApiGatewayManagementApi({ endpoint:
13
- process.env.iz_webSocketEndpoint }); const dynamodbSharedLib =
14
- require('@izara_project/izara-core-library-dynamodb'); const
15
- callingFlowSharedLib =
16
- require('@izara_project/izara-core-library-calling-flow'); const hash =
17
- require('object-hash'); // const coreConsts =
18
- require("@izara_project/izara-core-library-core/src/Consts"); const {
19
- postToConnection } = require("../../../libs/source/GenerateCodeLibs"); const {
20
- <%- functionName%>Main } = require("./<%- fileName%>_Main"); module.exports.main
21
- = middlewareHandler.wrap(async (event, context, callback) => {
22
- event._izContext.logger.debug('Event:', event); try { if (event.requestContext)
23
- { const route = event.requestContext.routeKey; const connectionId =
24
- event.requestContext.connectionId; let correlationId =
25
- event._izContext.correlationIds.get(consts.X_CORRELATION_ID) switch (route) {
26
- case '<%- flowTag%>': console.log("event in route <%- flowTag%>", event); let
27
- eventParams = JSON.parse(event.body) await dynamodbSharedLib.putItem(
28
- event._izContext, await dynamodbSharedLib.tableName(event._izContext,
29
- "WebSocketTask"), { taskKey: correlationId, connectionId: connectionId,
30
- originTimestamp: Date.now() } ) let callingFlow = eventParams?.callingFlow ?
31
- eventParams.callingFlow : {}; await <%- functionName%>Main( event._izContext,
32
- eventParams, callingFlowSharedLib.addCallingFlowToPassOnProperties(callingFlow)
33
- //(<additionalParams>) //(</additionalParams>) ) break } } else { const connId =
34
- event.connId; // await postMessage({ message: event.message }, connId); await
35
- postToConnection({ message: event.message }, connId); } } catch (err) { const
36
- connId = event.requestContext.connectionId event._izContext.logger.error('Error,
37
- WebSocket: ', err); // await sendErrorMessage({ message: err.message }, connId);
38
- await postToConnection({ message: err.message }, connId); } }); <%_ const join =
39
- require('path').join _%> <%_ function upperCase (text) { return
40
- text.charAt(0).toUpperCase() + text.slice(1) } _%>
@@ -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
- 'use strict';
19
-
20
- const path = require('path');
21
-
22
- const { SOURCE_PATH, FUNCTION_NAME } = require("../../../../../../MainLibs/src/Consts");
23
- const { firstLetterLowerCase: lowerCase, firstLetterUpperCase: upperCase } = require("../../../../../../MainLibs/src/Utils");
24
- const templatePath = path.join(__dirname, "template.ejs");
25
- const getObjectSchema = require('@izara_project/izara-core-library-service-schemas/src/GetObjectSchema')
26
- const statusFieldTemplate = path.join(__dirname, "../../../createRecordByStatusType/statusFieldTemplate.ejs")
27
- const storedCacheTemplate = path.join(__dirname, "../../../createRecordByStatusType/storedCacheTemplate.ejs")
28
-
29
- /**
30
- * receive objectSchema
31
- * create data for WebSocket Main template
32
- *
33
- * @param {Object} objectSchema
34
- * @return {{templatePath, templateData,setting}}
35
- */
36
-
37
-
38
- function data(_izContext, flowSchema, srcPath) {
39
- return [createParamsForCreateSource(_izContext, flowSchema, srcPath)]
40
- }
41
-
42
- function createParamsForCreateSource(_izContext, flowSchema, srcPath) {
43
- let functionName = upperCase(flowSchema.flowTag) + "ExternalTopicIn"
44
- const splitKey = Object.keys(flowSchema.flowSteps)[0].split('_')
45
- // stockLocation_Test_flowStep_TopicName_In
46
- // let objectSchema = await getObjectSchema.getObjectSchemaCombineFieldNamesWithCache(_izContext, flowSchema.objType)
47
- // let fieldNames = Object.keys(objectSchema.fieldNames)
48
- return {
49
- templatePath: templatePath,
50
- templateData: {
51
- serviceTag: splitKey[0],
52
- topicName: splitKey[2] + '_' + splitKey[3],
53
- externalTopicMain: functionName + 'Main',
54
- storedCacheTemplate,
55
- statusFieldTemplate,
56
- statusType: flowSchema.statusType,
57
- flowTag: flowSchema.flowTag,
58
- },
59
- setting: {
60
- savePath: path.join(srcPath, SOURCE_PATH.flowSchema, flowSchema.flowTag, 'source/'),
61
- saveFileName: `${functionName}_Main`,
62
- fileExtension: ".js",
63
- isAppend: false
64
- }
65
- }
66
- }
67
- module.exports = data
@@ -1,27 +0,0 @@
1
- const { join } = require('path');
2
-
3
- const templatePath = join(__dirname, "template.ejs");
4
-
5
- module.exports = async (_izContext, objSchemaPath, settings) => {
6
- const srcPath = join(objSchemaPath, '../');
7
- let createSourceData = [];
8
-
9
- createSourceData.push(
10
- {
11
- templatePath: templatePath,
12
- templateData: {
13
- objectType: settings.objectType
14
- },
15
- setting: {
16
- savePath: join(srcPath, "test" + "/"),
17
- // hookPath: path.join(srcPath, "schemaHook", attributeTreeObjSchema.objectType, "/"),
18
- saveFileName: "testAttributeTree",
19
- fileExtension: ".js",
20
- isAppend: false
21
- }
22
- }
23
- )
24
-
25
-
26
- return createSourceData;
27
- }