@izara_project/izara-market-library-service-schemas 1.0.77 → 1.0.79
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.
- package/index.js +10 -0
- package/package.json +3 -2
- package/src/MainLibs/src/Consts.js +14 -1
- package/src/MainLibs/src/Utils.js +4 -3
- package/src/reStructure/GenerateResources.js +127 -0
- package/src/reStructure/GenerateTests.js +23 -22
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +4 -2
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/delete/template.ejs +1 -1
- package/src/reStructure/TemplateData/IntTest/generateResources/generateResources.js +84 -41
- package/src/reStructure/TemplateData/IntTest/generateResources/templateResources.ejs +31 -0
- package/src/reStructure/TemplateData/IntTest/generateTests/events/data.js +110 -100
- package/src/reStructure/TemplateData/IntTest/generateTests/events/templateEvents.ejs +8 -7
- package/src/reStructure/TemplateData/IntTest/generateTests/generateTemplate.js +59 -61
- package/src/reStructure/TemplateData/IntTest/generateTests/tests/data.js +180 -260
- package/src/reStructure/TemplateData/IntTest/generateTests/tests/templateTests.ejs +3 -1
- package/src/reStructure/TemplateData/IntTest/libs/{generateTestsLibs.js → libs.js} +82 -84
- package/src/reStructure/TemplateData/IntTest/upload/uploadIntTest.js +60 -0
- package/src/reStructure/TemplateData/externalService/functionNameConfig/data.js +1 -1
- package/src/reStructure/TemplateData/findData/handler/template.ejs +2 -2
- package/src/reStructure/TemplateData/flowSchema/CreateRecordComplete/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/components/upload/confirmReserved/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/externalTopic/Complete/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/externalTopic/Complete/mainFunction/data.js +3 -2
- package/src/reStructure/TemplateData/flowSchema/externalTopic/Process/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/externalTopic/sns-in-sqs/data.js +2 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaMainFunction/template.ejs +7 -7
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComplete/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowSchemaOwnTopic/EndpointComponent/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/flowStep/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/register/complete/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/statusFieldComponent/Handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/triggerCacheComponent/checkTriggerCacheComplete/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/triggerCacheComponent/processTriggerCache/functionYaml/data.js +1 -0
- package/src/reStructure/TemplateData/flowSchema/triggerCacheComponent/processTriggerCache/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/triggerCacheComponent/processTriggerCache/mainFunction/data.js +1 -0
- package/src/reStructure/TemplateData/flowSchema/triggerCacheComponent/triggerCacheComplete/functionYaml/data.js +1 -0
- package/src/reStructure/TemplateData/flowSchema/triggerCacheComponent/triggerCacheComplete/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/flowSchema/webSocketComplete/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionComplete/create/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionComplete/delete/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionComplete/get/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/perActionComplete/update/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/processLogical/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/processLogicalPagination/handler/dsq/template.ejs +1 -1
- package/src/reStructure/TemplateData/processLogicalPagination/handler/sqs/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/handler/templateByHandler/dsqTemplate.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/action/handler/templateByHandler/sqsTemplate.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/changeRelationship/complete/handler/sqs/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/templateByHandler/dsqTemplate.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/handler/templateByHandler/sqsTemplate.ejs +2 -2
- package/src/reStructure/TemplateData/relationshipPerAction/create/action/mainFunction/template.ejs +4 -3
- package/src/reStructure/TemplateData/relationshipPerAction/create/complete/handler/sqs/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/templateByHandler/dsqTemplate.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/action/handler/templateByHandler/sqsTemplate.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/delete/complete/handler/sqs/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/templateByHandler/dsqTemplate.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/handler/templateByHandler/sqsTemplate.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/get/action/mainFunction/template.ejs +2 -1
- package/src/reStructure/TemplateData/relationshipPerAction/get/complete/handler/sqs/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/handler/templateByHandler/dsqTemplate.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/handler/templateByHandler/sqsTemplate.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/action/mainFunction/template.ejs +2 -1
- package/src/reStructure/TemplateData/relationshipPerAction/moveRelationship/complete/handler/sqs/template.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/templateByHandler/dsqTemplate.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/handler/templateByHandler/sqsTemplate.ejs +1 -1
- package/src/reStructure/TemplateData/relationshipPerAction/update/action/mainFunction/template.ejs +2 -1
- package/src/reStructure/TemplateData/relationshipPerAction/update/complete/handler/sqs/template.ejs +1 -1
- package/src/reStructure/TemplateData/resourceYaml/filterGenerateResource/data.js +2 -2
- package/src/reStructure/TemplateData/IntTest/generateResources/resources/data.js +0 -74
- package/src/reStructure/TemplateData/IntTest/generateResources/resources/templateresources.ejs +0 -18
- package/src/reStructure/TemplateData/IntTest/generateResources.js +0 -144
- package/src/reStructure/TemplateData/IntTest/generateUpload/genetateTempleteUpload.js +0 -52
- package/src/reStructure/TemplateData/IntTest/generateUpload/upload/data.js +0 -40
- package/src/reStructure/TemplateData/IntTest/generateUpload/upload/libs/generateTestUploadLibs.js +0 -39
- package/src/reStructure/TemplateData/IntTest/generateUpload.js +0 -145
|
@@ -1,100 +1,110 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
//
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
//
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
+
import path, { join } from 'path';
|
|
21
|
+
import { fileURLToPath } from 'url';
|
|
22
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
23
|
+
const __dirname = path.dirname(__filename);
|
|
24
|
+
const templatePath = path.join(__dirname, "./templateEvents.ejs")
|
|
25
|
+
import libs from '../../libs/libs.js';
|
|
26
|
+
const {
|
|
27
|
+
setEvent,
|
|
28
|
+
createEventCaseByHandler,
|
|
29
|
+
getLocalConfig,
|
|
30
|
+
setEventInvoke,
|
|
31
|
+
setEventDynamo,
|
|
32
|
+
getHandlerFromEventTag,
|
|
33
|
+
} = libs;
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
async function data(_izContext, allIntTestConfig, srcPath) {
|
|
37
|
+
let createEventSources = [];
|
|
38
|
+
let serviceTag = getLocalConfig("iz_serviceTag")
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
// console.log({ allIntegrationTestConfig })
|
|
42
|
+
|
|
43
|
+
for (const intTest of allIntTestConfig) {
|
|
44
|
+
for (const [testTag, config] of Object.entries(intTest)) {
|
|
45
|
+
// console.log(testTag, config)
|
|
46
|
+
for (const eachStage of config.testStages) {
|
|
47
|
+
let inputEventTag = eachStage.eventTag;
|
|
48
|
+
let outputEventTag = `Output_${inputEventTag}`;
|
|
49
|
+
|
|
50
|
+
let inputConfig = {
|
|
51
|
+
...setEvent(eachStage.inputConfig.inputEvent, eachStage.inputConfig.inputEventSettings),
|
|
52
|
+
...createEventCaseByHandler(getHandlerFromEventTag(inputEventTag), eachStage.inputConfig.messageAttributes)
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
let outputConfig = {
|
|
56
|
+
...setEvent(eachStage.outputConfig.outputEvent, eachStage.outputConfig.outputEventSettings)
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
let eventDynamos = [];
|
|
60
|
+
if (eachStage.dynamoDBConfig && eachStage.dynamoDBConfig.length > 0) { // validate Dynamo
|
|
61
|
+
// console.log("have dynamoConfig", inputEventTag, eachStage.dynamoDBConfig)
|
|
62
|
+
for (const dynamoDBConfig of eachStage.dynamoDBConfig) {
|
|
63
|
+
let eventDynamo = { keyValues: dynamoDBConfig.dynamoEvent.identifiers, forStageMatching: true, ...setEventDynamo(dynamoDBConfig.dynamoEvent.fields, dynamoDBConfig.dynamoEventSettings) }
|
|
64
|
+
eventDynamos.push({ eventTag: inputEventTag + "__Dynamodb_" + dynamoDBConfig.eventDynamoTag, event: eventDynamo })
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
let eventInvokes = [];
|
|
69
|
+
if (eachStage.invokeConfig && eachStage.invokeConfig.length > 0) { // Validate Invokes
|
|
70
|
+
for (const invokeConfig of eachStage.invokeConfig) {
|
|
71
|
+
let invokeEventComponents = setEventInvoke(invokeConfig)
|
|
72
|
+
eventInvokes.push(...invokeEventComponents)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (getHandlerFromEventTag(testTag) === "S3") {
|
|
77
|
+
if (config.hasOwnProperty("s3Config") && Object.keys(config.s3Config).length > 0) {
|
|
78
|
+
Object.assign(inputConfig, {
|
|
79
|
+
uploadS3: true,
|
|
80
|
+
uploadS3Setting: config.s3Config
|
|
81
|
+
})
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
createEventSources.push({
|
|
85
|
+
templatePath: templatePath,
|
|
86
|
+
templateData: {
|
|
87
|
+
inputEventTag,
|
|
88
|
+
outputEventTag,
|
|
89
|
+
inputConfig,
|
|
90
|
+
outputConfig,
|
|
91
|
+
eventDynamos,
|
|
92
|
+
eventInvokes: eventInvokes || []
|
|
93
|
+
},
|
|
94
|
+
setting: {
|
|
95
|
+
generateHookFile: false,
|
|
96
|
+
savePath: path.join(srcPath, `./${serviceTag}/${testTag}/${inputEventTag}/`),
|
|
97
|
+
saveFileName: 'events',
|
|
98
|
+
fileExtension: ".json",
|
|
99
|
+
isAppend: false
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
return createEventSources
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export default data
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"<%-
|
|
3
|
-
"<%-
|
|
4
|
-
<%
|
|
5
|
-
|
|
6
|
-
<%
|
|
7
|
-
|
|
8
|
-
"<%- invokeEventComponent
|
|
2
|
+
"<%- inputEventTag %>": <%- JSON.stringify(inputConfig, null, 2) %>,
|
|
3
|
+
"<%- outputEventTag %>": <%- JSON.stringify(outputConfig, null, 2) %> <% eventDynamos.length ? "," : "" -%>
|
|
4
|
+
<% eventDynamos.forEach((eventDynamo,idx) => { %>
|
|
5
|
+
"<%- eventDynamo.eventTag %>": <%- JSON.stringify(eventDynamo.event,null,2) %> <% idx < eventDynamos.length - 1 ? ",": "" -%>
|
|
6
|
+
<% }) %> <% eventInvokes.length ? "," : "" %>
|
|
7
|
+
<% eventInvokes.forEach((invokeEventComponent,index) => { %>
|
|
8
|
+
"<%- invokeEventComponent.inputInvokeName %>": <%- JSON.stringify(invokeEventComponent.inputInvoke,null,2) %>,
|
|
9
|
+
"<%- invokeEventComponent.outputInvokeName %>": <%- JSON.stringify(invokeEventComponent.outputInvoke,null,2) %><%= index < eventInvokes.length - 1 ? ',': "" -%>
|
|
9
10
|
<% }) %>
|
|
10
11
|
}
|
|
@@ -1,61 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
//
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
//
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
//
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
//
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
//
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
// module.exports = generateCodeWithTemplate;
|
|
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
|
+
import { join } from 'path';
|
|
21
|
+
import generateEvent from './events/data.js'
|
|
22
|
+
import generateTest from "./tests/data.js"
|
|
23
|
+
// import generateBashScript from './bashScript/data.js'
|
|
24
|
+
import libs from '../libs/libs.js'
|
|
25
|
+
const { getIntTestConfig } = libs;
|
|
26
|
+
/**
|
|
27
|
+
* Generates code with templates for different actions
|
|
28
|
+
* @param {Object} _izContext - Context object
|
|
29
|
+
* @param {string} savePath - Path to the schema
|
|
30
|
+
* @returns {Array} Array of generated code parameters
|
|
31
|
+
*/
|
|
32
|
+
async function generateCodeWithTemplate(_izContext, savePath) {
|
|
33
|
+
try {
|
|
34
|
+
// console.log({ savePath })
|
|
35
|
+
// console.log("settings generateCodeWithTemplate", settings)
|
|
36
|
+
let allCreateSource = [];
|
|
37
|
+
// console.log("oo:", process.env.iz_resourcePrefix);
|
|
38
|
+
let allIntTestConfig = await getIntTestConfig(_izContext, join(savePath, "./libs/"))
|
|
39
|
+
// console.log({ settings })
|
|
40
|
+
const event = await generateEvent(_izContext, allIntTestConfig, savePath)
|
|
41
|
+
// console.log("event", event);
|
|
42
|
+
// console.log("event", JSON.stringify(event, null, 2))
|
|
43
|
+
const test = await generateTest(_izContext, allIntTestConfig, savePath)
|
|
44
|
+
// console.log("test", JSON.stringify(test, null, 2));
|
|
45
|
+
|
|
46
|
+
allCreateSource.push(
|
|
47
|
+
...event,
|
|
48
|
+
...test
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
// console.log("allCreateSource", allCreateSource)
|
|
52
|
+
return allCreateSource;
|
|
53
|
+
} catch (error) {
|
|
54
|
+
_izContext.logger.error('Error generating code with template propertyNode schema:', error);
|
|
55
|
+
return [];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export default generateCodeWithTemplate;
|