@izara_project/izara-market-library-service-schemas 1.0.30 → 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 (69) hide show
  1. package/package.json +1 -1
  2. package/src/GenerateCodeLibs/src/Consts.js +2 -1
  3. package/src/MainLibs/src/Consts.js +11 -4
  4. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +3 -3
  5. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +1 -2
  6. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/get/template.ejs +2 -2
  7. package/src/reStructure/TemplateData/EndpointPerService/mainFunction/update/template.ejs +2 -2
  8. package/src/reStructure/TemplateData/EndpointPerService/yaml/data.js +10 -8
  9. package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/functionYaml/data.js +4 -4
  10. package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/handler/data.js +4 -4
  11. package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/mainFunction/data.js +2 -2
  12. package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/functionYaml/data.js +2 -2
  13. package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/handler/data.js +1 -1
  14. package/src/reStructure/TemplateData/flowSchema/components/upload/createObject/mainFunction/data.js +1 -1
  15. package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/functionYaml/data.js +4 -4
  16. package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/handler/data.js +4 -4
  17. package/src/reStructure/TemplateData/flowSchema/components/upload/createObjectComplete/mainFunction/data.js +4 -4
  18. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/functionYaml/data.js +4 -4
  19. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/handler/data.js +4 -4
  20. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/createPresignUrl/mainFunction/data.js +1 -1
  21. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/functionYaml/data.js +4 -4
  22. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/handler/data.js +4 -4
  23. package/src/reStructure/TemplateData/flowSchema/components/upload/preSignUrl/reservedLimit/mainFunction/data.js +4 -4
  24. package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/functionYml/HdrS3/data.js +1 -1
  25. package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/handler/handlerS3/data.js +4 -4
  26. package/src/reStructure/TemplateData/flowSchema/components/upload/processFile/mainFunction/data.js +4 -4
  27. package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/functionYaml/data.js +3 -3
  28. package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/functionYaml/template.ejs +2 -0
  29. package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/data.js +3 -2
  30. package/src/reStructure/TemplateData/flowSchema/components/websocket/connect/handler/template.ejs +4 -16
  31. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowSchema/functionYaml/data.js +115 -0
  32. package/src/reStructure/TemplateData/flowSchema/{components/schema/inProcess → flowSchemaOwnTopic/flowSchema}/functionYaml/template.ejs +1 -20
  33. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowSchema/handler/data.js +70 -0
  34. package/src/reStructure/TemplateData/flowSchema/{components/schema/inProcess → flowSchemaOwnTopic/flowSchema}/handler/template.ejs +14 -32
  35. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowSchema/mainFunction/data.js +64 -0
  36. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowSchema/mainFunction/template.ejs +104 -0
  37. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowSchemaComplete/functionYaml/data.js +115 -0
  38. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowSchemaComplete/functionYaml/template.ejs +20 -0
  39. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowSchemaComplete/handler/data.js +71 -0
  40. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowSchemaComplete/handler/template.ejs +85 -0
  41. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowSchemaComplete/mainFunction/data.js +63 -0
  42. package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/flowSchemaComplete/mainFunction/template.ejs +105 -0
  43. package/src/reStructure/TemplateData/flowSchema/generateTemplateData.js +55 -35
  44. package/src/reStructure/TemplateData/generateRole/createSharedResource.js +10 -0
  45. package/src/reStructure/TemplateData/flowSchema/components/schema/inProcess/functionYaml/data.js +0 -76
  46. package/src/reStructure/TemplateData/flowSchema/components/schema/inProcess/handler/data.js +0 -46
  47. package/src/reStructure/TemplateData/flowSchema/components/schema/inProcess/mainFunction/data.js +0 -45
  48. package/src/reStructure/TemplateData/flowSchema/components/schema/inProcess/sns-sqs/data.js +0 -35
  49. package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/functionYaml/data.js +0 -34
  50. package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/functionYaml/template.ejs +0 -0
  51. package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/handler/data.js +0 -34
  52. package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/handler/template.ejs +0 -0
  53. package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/mainFunction/data.js +0 -34
  54. package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/mainFunction/template.ejs +0 -0
  55. package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/sns-sqs/data.js +0 -34
  56. package/src/reStructure/TemplateData/flowSchema/components/schema/outComplete/sns-sqs/template.ejs +0 -0
  57. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/functionYaml/data.js +0 -101
  58. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/functionYaml/template.ejs +0 -43
  59. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/handler/data.js +0 -93
  60. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/handler/templateAsyncHandler.ejs +0 -110
  61. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/handler/templateSyncHandler.ejs +0 -49
  62. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/hookLogic/data.js +0 -64
  63. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/mainFunction/data.js +0 -66
  64. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/mainFunction/template.ejs +0 -30
  65. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/queue/data.js +0 -124
  66. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/queue/snsTemplate.ejs +0 -59
  67. package/src/reStructure/TemplateData/flowSchema/legacy/hookCode-old/queue/sqsTemplate.ejs +0 -43
  68. /package/src/reStructure/TemplateData/flowSchema/{components/schema/inProcess/mainFunction/template.ejs → flowSchemaOwnTopic/sns-in/data.js} +0 -0
  69. /package/src/reStructure/TemplateData/flowSchema/{components/schema/inProcess/sns-sqs/template.ejs → flowSchemaOwnTopic/sns-out/data.js} +0 -0
@@ -1,66 +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 { createHookFunction } = require('../../../../../../GenerateCodeLibs/src/GenerateCodeLibs')
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 } = 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
- if (flowSchema?.hook) {
41
- for (const [hookName, hookProperties] of Object.entries(flowSchema.hook)) {
42
- for (const hookFunction of hookProperties.functionList) {
43
- if (hookName === FLOW_SCHEMA_HOOK_STATE.beforeCreate) {
44
- if (hookFunction.event.continueFlow === true) {
45
- hook = true
46
- hookFunctionName = hookFunction.name
47
- }
48
- }
49
- }
50
- }
51
- }
52
- return {
53
- templatePath: templatePath,
54
- templateData: {
55
- hookFunctionName
56
- },
57
- setting: {
58
- savePath: path.join(srcPath, SOURCE_PATH.generatedCodeHookFunction),
59
- saveFileName: `${upperCase(hookFunctionName)}_Main`,
60
- fileExtension: ".js",
61
- isAppend: false
62
- }
63
- }
64
- }
65
-
66
- 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
- } _%>
@@ -1,124 +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 { firstLetterUpperCase: upperCase } = require('../../../../../../MainLibs/src/Utils')
22
- const { SOURCE_PATH, defaultIamRolePerAction, createIamRole, RESOURCE_CLASSES, SNS_RESOURCE, resourceNames, DYNAMO_RESOURCE, SAVE_FILE_NAME, FUNCTION_NAME, shortNameHandler, SQS_RESOURCE } = require("../../../../libs/Consts");
23
- const snsTemplatePath = path.join(__dirname, "./snsTemplate.ejs");
24
- const sqsTemplatePath = path.join(__dirname, "./sqsTemplate.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 createSourceParams(_izContext, flowSchema, srcPath) {
34
- let queueNames = [];
35
- let resultForCreateQueueHook = []
36
- const settings = {
37
- saveFileName: SAVE_FILE_NAME.snsInSqsYaml,
38
- savePath: path.join(srcPath, SOURCE_PATH.resourceYaml),
39
- fileExtension: ".yml",
40
- isAppend: true
41
- }
42
- if (flowSchema?.hook) {
43
- for (const hookProperties of Object.values(flowSchema.hook)) {
44
- for (const hookFunction of hookProperties.functionList) {
45
- if (hookFunction.event.continueFlow === true) {
46
- if (hookFunction.event.handlerType === HANDLER.hdrSqs) {
47
- queueNames.push(
48
- {
49
- queueName: "In" + createResourceSqsAndSns(
50
- hookFunction.event.handlerType,
51
- upperCase(hookProperties.name)
52
- )
53
- }
54
- )
55
- } else if (hookFunction.event.handlerType === HANDLER.hdrDsq) {
56
- queueNames.push(
57
- {
58
- queueName: createResourceSqsAndSns(
59
- hookFunction.event.handlerType,
60
- upperCase(hookFunction.name)
61
- )
62
- }
63
- )
64
- }
65
- if (hookFunction.event.createNewTopic === true) {
66
- if (hookFunction.event.handlerType === HANDLER.hdrSqs) {
67
- queueNames.push(
68
- {
69
- queueName: createResourceSqsAndSns(
70
- hookFunction.event.handlerType,
71
- upperCase(hookFunction.event.topicName)
72
- )
73
- }
74
- )
75
- } else if (hookFunction.event.handlerType === HANDLER.hdrDsq) {
76
- queueNames.push(
77
- {
78
- queueName: createResourceSqsAndSns(
79
- hookFunction.event.handlerType,
80
- upperCase(hookFunction.event.queueName)
81
-
82
- )
83
- }
84
- )
85
- }
86
- }
87
- }
88
- }
89
- }
90
- }
91
-
92
-
93
- for (const queueName of queueNames) {
94
- if (queueName.queueName.includes(upperCase(HANDLER.hdrDsq))) {
95
- resultForCreateQueueHook.push({
96
- templatePath: sqsTemplatePath,
97
- templateData: queueName.queueName,
98
- setting: settings
99
- })
100
- } else {
101
- resultForCreateQueueHook.push({
102
- templatePath: snsTemplatePath,
103
- templateData: queueName,
104
- setting: settings
105
- })
106
- }
107
- }
108
- console.log("resultForCreateQueueHook: ", resultForCreateQueueHook);
109
- return resultForCreateQueueHook;
110
- }
111
-
112
- function createResourceSqsAndSns(handlerType, resourceName) {
113
- let queueName
114
- if (handlerType === HANDLER.hdrDsq) {
115
- queueName = upperCase(resourceName) + handlerType
116
- } else if (handlerType === HANDLER.hdrSqs) {
117
- if (resourceName.includes("In")) {
118
- resourceName.slice(2)
119
- }
120
- queueName = resourceName
121
- }
122
- return queueName
123
- }
124
- module.exports = createSourceParams;
@@ -1,59 +0,0 @@
1
- ##===== [Create topic in]
2
- In<%- queueName %>:
3
- Type: AWS::SNS::Topic
4
- Properties:
5
- DisplayName: "SNS Message in"
6
- TopicName: ${self:custom.iz_serviceTag}_${self:custom.iz_stage}_<%- queueName %>_In
7
- ##===== SNS Subscription
8
- ##===== [Topic In]
9
- SubscriptionIn<%- queueName %>:
10
- Type: AWS::SNS::Subscription
11
- Properties:
12
- TopicArn: !Ref In<%- queueName %>
13
- Endpoint: "arn:aws:sqs:${self:custom.iz_region}:${self:custom.iz_accountId}:${self:custom.iz_resourcePrefix}<%- queueName %>HdrSqs"
14
- Protocol: "sqs"
15
- ##===== [Queue]
16
- <%- queueName %>HdrSqs:
17
- Type: "AWS::SQS::Queue"
18
- Properties:
19
- QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>HdrSqs
20
- RedrivePolicy:
21
- deadLetterTargetArn:
22
- # !GetAtt
23
- Fn::GetAtt:
24
- - <%- queueName %>HdrSqsDLQ
25
- - Arn
26
- maxReceiveCount: 3
27
- VisibilityTimeout: 120
28
- ##==== [QueueDLQ]
29
- <%- queueName %>HdrSqsDLQ:
30
- Type: AWS::SQS::Queue
31
- Properties:
32
- QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>HdrSqsDLQ
33
- ##==== [QueuePolicy]
34
- <%- queueName %>HdrSqsPolicy:
35
- Type: AWS::SQS::QueuePolicy
36
- Properties:
37
- PolicyDocument:
38
- Version: "2012-10-17"
39
- Statement:
40
- - Sid: "allow-sns-messages"
41
- Effect: Allow
42
- Principal: "*"
43
- Resource:
44
- # !GetAtt
45
- Fn::GetAtt:
46
- - <%- queueName %>HdrSqs
47
- - Arn
48
- Action: "SQS:SendMessage"
49
- Queues:
50
- - Ref: <%- queueName %>HdrSqs
51
- #<#<%- firstLetterUpperCase(queueName) %>QueueSetting#>
52
- #<#/<%- firstLetterUpperCase(queueName) %>QueueSetting#>
53
-
54
- <%_ function firstLetterUpperCase(text){
55
- return text.charAt(0).toUpperCase() + text.slice(1)
56
- } _%>
57
- <%_ function firstLetterLowerCase(str) {
58
- return str.charAt(0).toLowerCase() + str.slice(1)
59
- } _%>
@@ -1,43 +0,0 @@
1
- #------- queue ---------
2
- <%- queueName %>:
3
- Type: "AWS::SQS::Queue"
4
- Properties:
5
- QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>
6
- RedrivePolicy:
7
- deadLetterTargetArn: #!GetAtt
8
- Fn::GetAtt:
9
- - <%- queueName %>DLQ
10
- - Arn
11
- maxReceiveCount: 3
12
- VisibilityTimeout: 120
13
-
14
- <%- queueName %>DLQ:
15
- Type: AWS::SQS::Queue
16
- Properties:
17
- QueueName: ${self:custom.iz_resourcePrefix}<%- queueName %>DLQ
18
-
19
- <%- queueName %>Policy:
20
- Type: AWS::SQS::QueuePolicy
21
- Properties:
22
- PolicyDocument:
23
- Version: "2012-10-17"
24
- Statement:
25
- - Sid: "allow-sns-messages"
26
- Effect: Allow
27
- Principal: "*"
28
- Resource: #!GetAtt
29
- Fn::GetAtt:
30
- - <%- queueName %>
31
- - Arn
32
- Action: "SQS:SendMessage"
33
- Queues:
34
- - Ref: <%- queueName %>
35
- #<#<%- firstLetterUpperCase(queueName) %>QueueSetting#>
36
- #<#/<%- firstLetterUpperCase(queueName) %>QueueSetting#>
37
-
38
- <%_ function firstLetterUpperCase(text){
39
- return text.charAt(0).toUpperCase() + text.slice(1)
40
- } _%>
41
- <%_ function firstLetterLowerCase(str) {
42
- return str.charAt(0).toLowerCase() + str.slice(1)
43
- } _%>