@izara_project/izara-market-library-service-schemas 1.0.78 → 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 +1 -1
- package/src/reStructure/GenerateTests.js +3 -1
- package/src/reStructure/TemplateData/EndpointPerService/mainFunction/create/template.ejs +2 -1
- package/src/reStructure/TemplateData/IntTest/generateResources/generateResources.js +11 -3
- package/src/reStructure/TemplateData/IntTest/generateResources/templateResources.ejs +14 -1
- package/src/reStructure/TemplateData/IntTest/generateTests/events/data.js +9 -2
- package/src/reStructure/TemplateData/IntTest/generateTests/tests/data.js +12 -0
- package/src/reStructure/TemplateData/IntTest/libs/libs.js +5 -5
- package/src/reStructure/TemplateData/findData/handler/template.ejs +1 -1
- package/src/reStructure/TemplateData/resourceYaml/filterGenerateResource/data.js +2 -2
- package/src/reStructure/TemplateData/IntTest/generateTests/bashScript/data.js +0 -45
- package/src/reStructure/TemplateData/IntTest/generateTests/bashScript/template.ejs +0 -0
- package/src.zip +0 -0
package/index.js
CHANGED
|
@@ -28,6 +28,11 @@ import mainLibUtils from './src/MainLibs/src/Utils.js';
|
|
|
28
28
|
import sourceManagerUtils from './src/SourceManager/src/Utils.js'
|
|
29
29
|
import createSource from './src/SourceManager/src/CreateSource.js'
|
|
30
30
|
|
|
31
|
+
import generateCode from './src/reStructure/GenerateCode.js';
|
|
32
|
+
import generateSchema from './src/reStructure/GenerateSchema.js';
|
|
33
|
+
import generateIntTest from './src/reStructure/GenerateTests.js';
|
|
34
|
+
import generateResourceIntTest from './src/reStructure/GenerateResources.js';
|
|
35
|
+
|
|
31
36
|
export {
|
|
32
37
|
// generatedCode Libs
|
|
33
38
|
constsGenerateCodeLibs, //generateCode Consts
|
|
@@ -44,4 +49,9 @@ export {
|
|
|
44
49
|
// Libs
|
|
45
50
|
checkPermission,
|
|
46
51
|
|
|
52
|
+
// main generateCode
|
|
53
|
+
generateCode,
|
|
54
|
+
generateSchema,
|
|
55
|
+
generateIntTest,
|
|
56
|
+
generateResourceIntTest
|
|
47
57
|
};
|
package/package.json
CHANGED
|
@@ -111,7 +111,9 @@ async function generateCodeWithTemplate(_izContext, savePath, settings) {
|
|
|
111
111
|
const intTestPath = join(saveFilePath, `../../src/generateIntegrationTest/${getLocalConfig("iz_serviceTag")}`)
|
|
112
112
|
console.log({ intTestPath })
|
|
113
113
|
|
|
114
|
-
uploadLib(intTestPath, settings)
|
|
114
|
+
// uploadLib(intTestPath, settings)
|
|
115
|
+
|
|
116
|
+
|
|
115
117
|
// exec(`bash ${ path.join(packagePath, "./frontEnd/NpmBash.bash") } `, (error, stdout, stderr) => {
|
|
116
118
|
// if (error) {
|
|
117
119
|
// console.error(`
|
|
@@ -53,7 +53,8 @@ const {
|
|
|
53
53
|
TOPIC_NAME_GRAPH_HANDLER
|
|
54
54
|
} = constsGenerateCodeLibs;
|
|
55
55
|
|
|
56
|
-
const { dynamoDbIdentifiersByStorageResource } = generateCodeLibs
|
|
56
|
+
const { dynamoDbIdentifiersByStorageResource, createDataDetailsLib } = generateCodeLibs
|
|
57
|
+
|
|
57
58
|
//(<optionalRequire>)
|
|
58
59
|
//(</optionalRequire>)
|
|
59
60
|
|
|
@@ -61,16 +61,24 @@ async function generateCodeWithTemplate(_izContext, savePath) {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
let functionComponent = {}
|
|
65
64
|
const generateFunctionComponent = directoryPath(slsYmlPath);
|
|
66
65
|
const mainFunctionComponent = directoryPath(functionPath);
|
|
67
66
|
// console.log({ mainFunctionComponent, generateFunctionComponent })
|
|
68
|
-
|
|
67
|
+
let lambdaComponent = { ...generateFunctionComponent, ...mainFunctionComponent }
|
|
68
|
+
let s3Component = {}
|
|
69
|
+
for (const lambdaFunctionName in lambdaComponent) {
|
|
70
|
+
if (lambdaFunctionName.endsWith("S3")) {
|
|
71
|
+
s3Component[lambdaFunctionName] = lambdaComponent[lambdaFunctionName]
|
|
72
|
+
delete lambdaComponent[lambdaFunctionName]
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
console.log(s3Component)
|
|
76
|
+
|
|
69
77
|
|
|
70
78
|
allCreateSource.push(
|
|
71
79
|
{
|
|
72
80
|
templatePath: templatePath,
|
|
73
|
-
templateData: { tableNames, functionComponent },
|
|
81
|
+
templateData: { tableNames, functionComponent: lambdaComponent, s3Component },
|
|
74
82
|
setting: {
|
|
75
83
|
generateHookFile: false,
|
|
76
84
|
savePath: path.join(savePath, `${serviceTag}/sharedResources/`),
|
|
@@ -7,7 +7,19 @@
|
|
|
7
7
|
"functionName": "<%= funcName %>"
|
|
8
8
|
}<%= index !== array.length - 1 ? ',' : '' %>
|
|
9
9
|
<% }); -%>
|
|
10
|
-
},
|
|
10
|
+
}, <% Object.keys(s3Component).length ? "," : "" %>
|
|
11
|
+
<% if (Object.keys(s3Component).length) { -%>
|
|
12
|
+
"S3": {
|
|
13
|
+
<% Object.entries(s3Component).forEach(([functionName,filePath],index) => { -%>
|
|
14
|
+
"<%- functionName %>": {
|
|
15
|
+
"localLocation": "/<%- filePath %>",
|
|
16
|
+
"localHandler": "main",
|
|
17
|
+
"functionName": "<%- functionName %>"
|
|
18
|
+
}<%= index < Object.keys(s3Component).length - 1 ? "," : "" %>
|
|
19
|
+
<% }); -%>
|
|
20
|
+
} <% Object.keys(tableNames).length ? "," : "" -%>
|
|
21
|
+
<% } -%>
|
|
22
|
+
<% if (Object.keys(tableNames).length) { -%>
|
|
11
23
|
"Dynamodb": {
|
|
12
24
|
<% tableNames.forEach(function(tableName, index) { %>
|
|
13
25
|
"<%= tableName %>": {
|
|
@@ -15,4 +27,5 @@
|
|
|
15
27
|
}<% if (index < tableNames.length - 1) { %>,<% } %>
|
|
16
28
|
<% }); %>
|
|
17
29
|
}
|
|
30
|
+
<% } %>
|
|
18
31
|
}
|
|
@@ -30,7 +30,6 @@ const {
|
|
|
30
30
|
setEventInvoke,
|
|
31
31
|
setEventDynamo,
|
|
32
32
|
getHandlerFromEventTag,
|
|
33
|
-
getIntTestConfig
|
|
34
33
|
} = libs;
|
|
35
34
|
|
|
36
35
|
|
|
@@ -74,6 +73,14 @@ async function data(_izContext, allIntTestConfig, srcPath) {
|
|
|
74
73
|
}
|
|
75
74
|
}
|
|
76
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
|
+
}
|
|
77
84
|
createEventSources.push({
|
|
78
85
|
templatePath: templatePath,
|
|
79
86
|
templateData: {
|
|
@@ -96,7 +103,7 @@ async function data(_izContext, allIntTestConfig, srcPath) {
|
|
|
96
103
|
}
|
|
97
104
|
|
|
98
105
|
}
|
|
99
|
-
|
|
106
|
+
|
|
100
107
|
return createEventSources
|
|
101
108
|
}
|
|
102
109
|
|
|
@@ -64,6 +64,8 @@ async function data(_izContext, allIntTestConfig, srcPath) {
|
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
66
|
|
|
67
|
+
console.log({ testConfig });
|
|
68
|
+
|
|
67
69
|
for (let idx = 0; idx < testConfig.testStages.length; idx++) {
|
|
68
70
|
const stage = testConfig.testStages[idx];
|
|
69
71
|
|
|
@@ -76,6 +78,7 @@ async function data(_izContext, allIntTestConfig, srcPath) {
|
|
|
76
78
|
if (handler === "S3") {
|
|
77
79
|
resourceType = "S3"
|
|
78
80
|
}
|
|
81
|
+
|
|
79
82
|
// baseIntTest.stage.push({
|
|
80
83
|
stages.push({
|
|
81
84
|
inputEventTag,
|
|
@@ -85,6 +88,15 @@ async function data(_izContext, allIntTestConfig, srcPath) {
|
|
|
85
88
|
resourceType: resourceType
|
|
86
89
|
});
|
|
87
90
|
|
|
91
|
+
if (testConfig.hasOwnProperty("s3Config") && Object.keys(testConfig.s3Config).length > 0) {
|
|
92
|
+
if (testConfig.s3Config.hasOwnProperty("destinationBucket") && testConfig.s3Config.hasOwnProperty("temporaryBucket")) {
|
|
93
|
+
Object.assign(stages[idx], {
|
|
94
|
+
destinationBucket: testConfig.s3Config.destinationBucket,
|
|
95
|
+
temporaryBucket: testConfig.s3Config.temporaryBucket
|
|
96
|
+
})
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
88
100
|
// const currentStageIdx = baseIntTest.stage.length - 1;
|
|
89
101
|
const currentStageIdx = stages.length - 1;
|
|
90
102
|
|
|
@@ -104,8 +104,9 @@ function setEvent(input, settings = {}) {
|
|
|
104
104
|
const forStageMatchs = settings?.forStageMatchs || [];
|
|
105
105
|
const testValueMatches = settings?.testValueMatches || [];
|
|
106
106
|
const isEqual = settings?.isEqual || [];
|
|
107
|
+
|
|
107
108
|
if (Array.isArray(input)) {
|
|
108
|
-
return { eventValue: input }
|
|
109
|
+
return { eventValue: input }
|
|
109
110
|
}
|
|
110
111
|
|
|
111
112
|
if (input === undefined) {
|
|
@@ -128,14 +129,13 @@ function setEvent(input, settings = {}) {
|
|
|
128
129
|
if (forStageMatchs.includes(key)) {
|
|
129
130
|
field.forStageMatching = true;
|
|
130
131
|
}
|
|
132
|
+
|
|
131
133
|
if (testValueMatches.includes(key)) {
|
|
132
134
|
field.testValueMatches = false;
|
|
133
135
|
}
|
|
134
136
|
|
|
135
|
-
if (
|
|
136
|
-
|
|
137
|
-
field.isEqual = true
|
|
138
|
-
}
|
|
137
|
+
if (isEqual.includes(key)) {
|
|
138
|
+
field.isEqual = true;
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
if (typeof transformatValue === "object" && !Array.isArray(transformatValue)) {
|
|
@@ -21,7 +21,7 @@ import { middlewareHandler as middleware, validatorSchema } from "@izara_project
|
|
|
21
21
|
import { recordHandlerSharedLib } from "@izara_project/izara-core-library-record-handler";
|
|
22
22
|
import Logger from '@izara_project/izara-core-library-logger';
|
|
23
23
|
|
|
24
|
-
import findData from './FindData_Main';
|
|
24
|
+
import findData from './FindData_Main.js';
|
|
25
25
|
|
|
26
26
|
// validate event properties in body.Message of sqs event
|
|
27
27
|
middleware.setValidatorSchema(recordHandlerSharedLib.baseValidatorSchema());
|
|
@@ -22,8 +22,8 @@ import path from 'path';
|
|
|
22
22
|
import { consts, utils } from '../../../../MainLibs/index.js';
|
|
23
23
|
const { STORAGE_TYPES } = consts;
|
|
24
24
|
const { firstLetterUpperCase: upperCase, getLocalConfig } = utils;
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
import { getObjectSchema } from '@izara_project/izara-core-library-service-schemas';
|
|
26
|
+
import { NoRetryError } from "@izara_project/izara-core-library-core";
|
|
27
27
|
|
|
28
28
|
async function filterCreateResourceYaml(_izContext, createSourceParams, objSchemaPath) {
|
|
29
29
|
try {
|
|
@@ -1,45 +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
|
-
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
|
-
getIntTestConfig
|
|
34
|
-
} = libs;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
async function data(_izContext, allIntTestConfig, srcPath) {
|
|
38
|
-
let createEventSources = [];
|
|
39
|
-
let serviceTag = getLocalConfig("iz_serviceTag")
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return createEventSources
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export default data
|
|
File without changes
|
package/src.zip
DELETED
|
Binary file
|