@izara_project/izara-market-library-service-schemas 1.0.30 → 1.0.32

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 (103) hide show
  1. package/package.json +9 -9
  2. package/src/GenerateCodeLibs/src/Consts.js +29 -13
  3. package/src/MainLibs/src/Consts.js +16 -6
  4. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +3 -6
  5. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +2 -3
  6. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +2 -2
  7. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +3 -3
  8. package/src/reStructure/TemplateData/EndpointPerService/yaml/data.js +10 -8
  9. package/src/reStructure/TemplateData/externalService/lambdaRole/data.js +5 -5
  10. package/src/reStructure/TemplateData/externalService/snsTopicSubscriptions/data.js +22 -0
  11. package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/functionYaml/data.js +4 -4
  12. package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/handler/data.js +4 -4
  13. package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/data.js +2 -2
  14. package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/template.ejs +1 -1
  15. package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/functionYaml/data.js +2 -2
  16. package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/data.js +1 -1
  17. package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/template.ejs +1 -1
  18. package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/data.js +1 -1
  19. package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/functionYaml/data.js +4 -4
  20. package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/handler/data.js +4 -4
  21. package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/mainFunction/data.js +4 -4
  22. package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/mainFunction/template.ejs +1 -1
  23. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/functionYaml/data.js +4 -4
  24. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/handler/data.js +4 -4
  25. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/data.js +1 -1
  26. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/template.ejs +1 -2
  27. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/functionYaml/data.js +4 -4
  28. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/handler/data.js +4 -4
  29. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/data.js +4 -4
  30. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/template.ejs +1 -1
  31. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/sqs/template.ejs +18 -18
  32. package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/functionYml/HdrS3/data.js +1 -1
  33. package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/handler/handlerS3/data.js +4 -4
  34. package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/mainFunction/data.js +4 -4
  35. package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/mainFunction/template.ejs +1 -1
  36. package/src/reStructure/TemplateData/flowSchema/components/upload/relate/libs/data.js +1 -1
  37. package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/functionYaml/data.js +3 -3
  38. package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/functionYaml/template.ejs +2 -0
  39. package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/data.js +3 -2
  40. package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/template.ejs +4 -16
  41. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/data.js +73 -0
  42. package/src/reStructure/TemplateData/flowSchema/{legacy/hookCode-old/queue/sqsTemplate.ejs → externalTopic/sns-in-sqs/template.ejs} +21 -11
  43. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/data.js +75 -0
  44. package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-out/template.ejs +10 -0
  45. package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/functionYaml/data.js +83 -0
  46. package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/functionYaml/template.ejs +17 -0
  47. package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/handler/data.js +65 -0
  48. package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/handler/template copy.ejs +125 -0
  49. package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/handler/template.ejs +130 -0
  50. package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/mainFunction/data.js +61 -0
  51. package/src/reStructure/TemplateData/flowSchema/externalTopic/sqs/mainFunction/template.ejs +70 -0
  52. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/data.js +147 -0
  53. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/functionYaml/template.ejs +18 -0
  54. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/data.js +64 -0
  55. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/handler/template.ejs +86 -0
  56. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/data.js +60 -0
  57. package/src/reStructure/TemplateData/flowSchema/externalTopic/websocket/mainFunction/template.ejs +74 -0
  58. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/functionYaml/data.js +107 -0
  59. package/src/reStructure/TemplateData/flowSchema/{components/schema/inProcess → flowSchemaOwnTopic/EndpointComponent}/functionYaml/template.ejs +1 -14
  60. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/data.js +57 -0
  61. package/src/reStructure/TemplateData/flowSchema/{legacy/hookCode-old/handler/templateAsyncHandler.ejs → flowSchemaOwnTopic/EndpointComponent/handler/template.ejs} +11 -37
  62. package/src/reStructure/TemplateData/flowSchema/{components/schema/inProcess → flowSchemaOwnTopic/EndpointComponent}/mainFunction/data.js +20 -13
  63. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/mainFunction/template.ejs +73 -0
  64. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/functionYaml/data.js +117 -0
  65. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/functionYaml/template.ejs +24 -0
  66. package/src/reStructure/TemplateData/flowSchema/{legacy/hookCode-old/mainFunction → flowSchemaOwnTopic/FlowSchemaCompleteComponent/handler}/data.js +15 -24
  67. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/handler/template.ejs +84 -0
  68. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/mainFunction/data.js +52 -0
  69. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaCompleteComponent/mainFunction/template.ejs +88 -0
  70. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/functionYaml/data.js +117 -0
  71. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/functionYaml/template.ejs +24 -0
  72. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/handler/data.js +57 -0
  73. package/src/reStructure/TemplateData/flowSchema/{components/schema/inProcess → flowSchemaOwnTopic/FlowSchemaComponent}/handler/template.ejs +16 -33
  74. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/data.js +66 -0
  75. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/FlowSchemaComponent/mainFunction/template.ejs +104 -0
  76. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/sns-in/data.js +96 -0
  77. package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +167 -99
  78. package/src/reStructure/TemplateData/generateRole/createSharedResource.js +20 -0
  79. package/src/reStructure/TemplateData/relationshipPerAction/create/action/mainFunction/template.ejs +3 -3
  80. package/src/reStructure/TemplateData/relationshipPerAction/delete/action/mainFunction/template.ejs +3 -3
  81. package/src/reStructure/TemplateData/relationshipPerAction/get/action/mainFunction/template.ejs +13 -14
  82. package/src/reStructure/TemplateData/relationshipPerAction/update/action/mainFunction/template.ejs +3 -3
  83. package/src/reStructure/TemplateData/flowSchema/components/schema/inProcess/functionYaml/data.js +0 -76
  84. package/src/reStructure/TemplateData/flowSchema/components/schema/inProcess/handler/data.js +0 -46
  85. package/src/reStructure/TemplateData/flowSchema/components/schema/inProcess/sns-sqs/data.js +0 -35
  86. package/src/reStructure/TemplateData/flowSchema/components/schema/inProcess/sns-sqs/template.ejs +0 -0
  87. package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/functionYaml/data.js +0 -34
  88. package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/functionYaml/template.ejs +0 -0
  89. package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/handler/data.js +0 -34
  90. package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/handler/template.ejs +0 -0
  91. package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/mainFunction/data.js +0 -34
  92. package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/mainFunction/template.ejs +0 -0
  93. package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/sns-sqs/data.js +0 -34
  94. package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/sns-sqs/template.ejs +0 -0
  95. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/functionYaml/data.js +0 -101
  96. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/functionYaml/template.ejs +0 -43
  97. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/handler/data.js +0 -93
  98. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/handler/templateSyncHandler.ejs +0 -49
  99. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/hookLogic/data.js +0 -64
  100. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/mainFunction/template.ejs +0 -30
  101. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/queue/data.js +0 -124
  102. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/queue/snsTemplate.ejs +0 -59
  103. /package/src/reStructure/TemplateData/flowSchema/{components/schema/inProcess/mainFunction → flowSchemaOwnTopic/sns-in}/template.ejs +0 -0
@@ -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,101 +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 { FLOW_SCHEMA_HOOK_STATE } = require('@izara_project/izara-core-library-service-schemas/src/Consts')
22
- const { firstLetterUpperCase: upperCase } = require('../../../../../../MainLibs/src/Utils')
23
- const { SOURCE_PATH, defaultIamRolePerAction, createIamRole, RESOURCE_CLASSES, SNS_RESOURCE, resourceNames, DYNAMO_RESOURCE, SAVE_FILE_NAME, FUNCTION_NAME, shortNameHandler, SQS_RESOURCE } = require("../../../../libs/Consts");
24
- const templatePath = path.join(__dirname, "template.ejs")
25
- /**
26
- * receive objectSchema
27
- * create data for WebScoket handler template
28
- *
29
- * @param {Object} objectSchema
30
- * @return {{templatePath, templateData,setting}}
31
- */
32
-
33
- function data(_izContext, flowSchema, srcPath) {
34
- return [createSourceParams(_izContext, flowSchema, srcPath)]
35
- }
36
-
37
- function createSourceParams(_izContext, flowSchema, srcPath) {
38
- let hook;
39
- let hookFunctionName
40
- let handlerType;
41
- let queueName;
42
- let filterPattern;
43
- let additionalResourcePermission = defaultIamRolePerAction();
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.event.continueFlow === true && hookFunction.event.initialEvent === false) {
49
- hook = true
50
- hookFunctionName = upperCase(hookFunction.name)
51
- handlerType = upperCase(hookFunction.event.handlerType);
52
- filterPattern = hookFunction.event.filterPattern;
53
- additionalResourcePermission.push(
54
- createIamRole(
55
- {
56
- [RESOURCE_CLASSES.sns]: [
57
- SNS_RESOURCE.publish
58
- ]
59
- },
60
- [
61
- resourceNames(RESOURCE_CLASSES.sns, "InImportBatchMainCreate")
62
- ]
63
- )
64
- )
65
- if (upperCase(handlerType) === upperCase(HANDLER.hdrDsq)) {
66
- queueName = hookFunction.event.queueName;
67
- } else if (upperCase(handlerType) === upperCase(HANDLER.hdrSqs)) {
68
- if (hookFunction.event.topicName.includes("In")) {
69
- queueName = upperCase(hookFunction.event.topicName.slice(2));
70
- } else {
71
- queueName = hookFunction.event.topicName;
72
- }
73
- }
74
- }
75
- }
76
- }
77
- }
78
- }
79
- return {
80
- templatePath: templatePath,
81
- templateData: {
82
- hookFunctionName,
83
- handlerType,
84
- queueName,
85
- additionalResourcePermission,
86
- functionName: upperCase(hookFunctionName),
87
- functionNameConfig: upperCase(hookFunctionName) + upperCase(shortNameHandler(handlerType)),
88
- resourceLocation: SOURCE_PATH.resourceLocationGeneratedCodeHookFunction,
89
- filterPattern
90
- },
91
- setting: {
92
- savePath: path.join(srcPath, SOURCE_PATH.appYaml),
93
- saveFileName: upperCase(SAVE_FILE_NAME.flowSchema),
94
- fileExtension: ".yml",
95
- isAppend: true
96
- }
97
- }
98
-
99
- }
100
-
101
- module.exports = data;
@@ -1,43 +0,0 @@
1
- <%_ const join = require('path').join; _%>
2
- <%_ const { HANDLER } = require('@izara_project/izara-core-library-service-schemas/src/Consts'); _%>
3
- <%- firstLetterUpperCase(functionNameConfig) %>:
4
- handler: <%- join(resourceLocation, `${functionName}_${firstLetterUpperCase(handlerType)}.main`)%>
5
- name: ${self:custom.iz_resourcePrefix}<%- functionName %><%- firstLetterUpperCase(handlerType) %>
6
- <%_ if (handlerType === firstLetterUpperCase(HANDLER.hdrDsq) || handlerType === firstLetterUpperCase(HANDLER.hdrSqs)) { _%>
7
- events:
8
- - sqs:
9
- arn: arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- queueName %><%- firstLetterUpperCase(handlerType) %>
10
- batchSize: 10
11
- <%_ if (filterPattern) { _%>
12
- filterPatterns: #**** need to update serverless framwork upper v.2.69.1
13
- - body: {"MessageAttributes":{"callingFlow":{"Value":["${self:custom.iz_resourcePrefix}<%- filterPattern %>"]}}} # functionName of callingFlow
14
- - body: {"MessageAttributes":{"callingFlow":{"Value":[{"exists":false}]}}}
15
- <%_ } _%>
16
- <%_ } else if (handlerType === firstLetterUpperCase(HANDLER.hdrApi)) { _%>
17
- events:
18
- - http:
19
- path: <%- objectType %>/<%- firstLetterUpperCase(action) %>
20
- method: <%- event %>
21
- cors: true
22
- #<#<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>Authorizer#>
23
- #<#/<%- firstLetterUpperCase(functionName) %><%- firstLetterUpperCase(handlerType) %>Authorizer#>
24
- <%_ } _%>
25
- iamRoleStatements:
26
- <%_ additionalResourcePermission.forEach(resourcePermission => { _%>
27
- - Effect: <%- resourcePermission.effect %>
28
- Action:
29
- <%_ Object.keys(resourcePermission.action).forEach(resourcePerAction => { _%>
30
- <%_ resourcePermission.action[resourcePerAction].forEach(permission => { _%>
31
- - <%- resourcePerAction %>:<%- permission %>
32
- <%_ }) _%>
33
- <%_ }) _%>
34
- Resource:
35
- <%_ resourcePermission.resource.forEach(resource => { _%>
36
- - "<%- resource %>"
37
- <%_ }) _%>
38
- <%_}) _%>
39
- #<#<%- functionName %><%- handlerType %>IamRole#>
40
- #<#/<%- functionName %><%- handlerType %>IamRole#>
41
- <%_ function firstLetterUpperCase(text){
42
- return text.charAt(0).toUpperCase() + text.slice(1)
43
- } _%>
@@ -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.event.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.generatedCodeHookFunction),
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.generatedCodeHookFunction),
85
- saveFileName: `${upperCase(hookFunctionName)}_${upperCase(handlerType)}`,
86
- fileExtension: ".js",
87
- isAppend: false
88
- }
89
- }
90
- }
91
- }
92
-
93
- module.exports = data;
@@ -1,49 +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 izara = require("@izara_project/izara-middleware");
21
- const middleware = izara.middlewareHandler;
22
-
23
- // const CorrelationIds = require('@izara_project/izara-core-library-correlation-ids')
24
- // const Logger = require('@izara_project/izara-core-library-logger');
25
- // const IntegrationTestDetail = require('@izara_project/izara-core-library-integration-tests')
26
-
27
- const <%- hookFunctionName %> = require('./<%- hookFunctionName %>_Main');
28
-
29
- // validate event params in middlewware before into function.
30
- const validatorSchema = {};
31
- middleware.setValidatorSchema(validatorSchema);
32
-
33
- module.exports.main = middleware.wrap(async (event, context, callback) => {
34
- event._izContext.logger.debug('Event:', event);
35
- event._izContext.logger.debug('context:', context);
36
-
37
- try {
38
-
39
- // invoke LambdaFunction
40
- return await <%- hookFunctionName %>(
41
- event._izContext, // correlationId/logger/integrationTestDetail/uniqueRequestId
42
- event
43
- );
44
-
45
- } catch (err) {
46
- event._izContext.logger.error('Error, <%- hookFunctionName %>: ', err);
47
- throw (err);
48
- }
49
- });
@@ -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
- 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
- async function data(_izContext, flowSchema, srcPath) {
36
- return [await createSourceParams(_izContext, flowSchema, srcPath)]
37
- }
38
-
39
- async function createSourceParams(_izContext, flowSchema, srcPath) {
40
- if (flowSchema?.hook) {
41
- await Promise.all(
42
- Object.values(flowSchema.hook).map(hookProperties =>
43
- Promise.all(
44
- hookProperties.functionList.map(hookFunction =>
45
- createHookFunction(
46
- _izContext,
47
- hookFunction.logicFunction,
48
- {
49
- fileExtension: ".js",
50
- isAppend: false,
51
- saveFileName: `${hookFunction.name}`,
52
- destinationPath: path.join(srcPath, SOURCE_PATH.logicalFunctionHook),
53
- }
54
- )
55
- )
56
- )
57
- )
58
- );
59
- }
60
- }
61
-
62
-
63
-
64
- module.exports = data
@@ -1,30 +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 <%- hookFunctionName %> = require("../../HookLogicFunction/source/<%- upperCase(hookFunctionName) %>");
21
- const createObjectMain = require("../../../CreateObjectS3_Main")
22
-
23
- module.exports.main = async (event, callingFlow) => {
24
- const result = await <%- hookFunctionName %>(event);
25
- await createObjectMain(...result, callingFlow);
26
- }
27
-
28
- <%_ function upperCase(string) {
29
- return string.charAt(0).toUpperCase() + string.slice(1);
30
- } _%>