miqro 1.7.4 → 1.7.8
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/dist/cli.js +4 -2
- package/dist/cmds/doc-md.js +14 -15
- package/dist/cmds/handler-apiroute-new.js +27 -14
- package/dist/cmds/handler-main-new.js +1 -0
- package/dist/cmds/{test.d.ts → new-test.d.ts} +0 -0
- package/dist/cmds/new-test.js +46 -0
- package/dist/cmds/new.js +39 -14
- package/dist/cmds/serve.d.ts +1 -0
- package/dist/cmds/serve.js +26 -0
- package/dist/utils/db/index.js +3 -2
- package/dist/utils/doc/index.d.ts +6 -5
- package/dist/utils/doc/index.js +11 -2
- package/dist/utils/index.js +1 -0
- package/package.json +6 -5
- package/dist/cmds/test.js +0 -15
package/dist/cli.js
CHANGED
|
@@ -6,7 +6,6 @@ const utils_1 = require("./utils");
|
|
|
6
6
|
const start_1 = require("./cmds/start");
|
|
7
7
|
const new_1 = require("./cmds/new");
|
|
8
8
|
const new_2 = require("./cmds/new");
|
|
9
|
-
const test_1 = require("./cmds/test");
|
|
10
9
|
const doc_json_1 = require("./cmds/doc-json");
|
|
11
10
|
const doc_md_1 = require("./cmds/doc-md");
|
|
12
11
|
const config_init_1 = require("./cmds/config-init");
|
|
@@ -14,6 +13,8 @@ const config_1 = require("./cmds/config");
|
|
|
14
13
|
const config_bash_1 = require("./cmds/config-bash");
|
|
15
14
|
const config_env_1 = require("./cmds/config-env");
|
|
16
15
|
const handler_apiroute_new_1 = require("./cmds/handler-apiroute-new");
|
|
16
|
+
const new_test_1 = require("./cmds/new-test");
|
|
17
|
+
const serve_1 = require("./cmds/serve");
|
|
17
18
|
const handler_main_new_1 = require("./cmds/handler-main-new");
|
|
18
19
|
//@miqro/database
|
|
19
20
|
const db_init_1 = require("./cmds/db-init");
|
|
@@ -37,9 +38,10 @@ const db_dump_data_1 = require("./cmds/db-dump-data");
|
|
|
37
38
|
["config:env"]: { cb: config_env_1.main, description: "\t\t\toutputs to stdout the config as a env file" },
|
|
38
39
|
["config:init"]: { cb: config_init_1.main, description: "\t\t\tinits your config folder" },
|
|
39
40
|
["start"]: { section: "cluster start", cb: start_1.main, description: "\t\t\t\tstart a nodejs script in cluster mode and restart if crash." },
|
|
41
|
+
["serve"]: { section: "serve static files", cb: serve_1.main, description: "\t\t\t\tserve static files." },
|
|
40
42
|
["doc"]: { section: "api documentation", cb: doc_json_1.main, description: "\t\t\t\toutputs to stdout an api folder auto doc as a json" },
|
|
41
43
|
["doc:md"]: { cb: doc_md_1.main, description: "\t\t\t\toutputs to a file an api folder auto doc as a markdown" },
|
|
42
|
-
["test"]: { cb:
|
|
44
|
+
["test:new"]: { section: "testing", cb: new_test_1.main, description: "\t\t\tcreate new test.js file." },
|
|
43
45
|
["db:console"]: { section: "sequelize helpers", cb: db_console_1.main, description: "\t\t\truns a readline interface that send the input as a query" },
|
|
44
46
|
["db:dump:data"]: { cb: db_dump_data_1.main, description: "\t\t\tdump the data of the database (only defined models)" },
|
|
45
47
|
["db:push:data"]: { cb: db_push_data_1.main, description: "\t\t\tpush a dump to the database" },
|
package/dist/cmds/doc-md.js
CHANGED
|
@@ -105,7 +105,7 @@ const main = () => {
|
|
|
105
105
|
return range;
|
|
106
106
|
};
|
|
107
107
|
const parseOptionTable = (options, subName = "", tableHeaders = 0) => {
|
|
108
|
-
if (options) {
|
|
108
|
+
if (typeof options !== "boolean" && options) {
|
|
109
109
|
let padding = "";
|
|
110
110
|
for (let i = 0; i < tableHeaders; i++) {
|
|
111
111
|
padding += "| ";
|
|
@@ -155,13 +155,12 @@ const main = () => {
|
|
|
155
155
|
const param = doc.params instanceof Array ? doc.params : [doc.params];
|
|
156
156
|
const paramsTable = [];
|
|
157
157
|
for (const q of param) {
|
|
158
|
-
let paramTable = parseOptionTable(q);
|
|
159
|
-
// let paramsTable = parseOptionTable(doc.params);
|
|
158
|
+
let paramTable = typeof q === "string" ? `${q}` : parseOptionTable(q);
|
|
160
159
|
if (paramTable.split("\n").length > 1) {
|
|
161
|
-
paramTable = `### params${q && q.description ? ` (${q.description})` : ""}\n\n${paramTable}`;
|
|
160
|
+
paramTable = `### params${typeof q !== "boolean" && typeof q !== "string" && q && q.description ? ` (${q.description})` : ""}\n\n${paramTable}`;
|
|
162
161
|
}
|
|
163
162
|
else {
|
|
164
|
-
paramTable = paramTable === "" ? "" : `### params${q && q.description ? ` (${q.description})` : ""}: ${paramTable}`;
|
|
163
|
+
paramTable = paramTable === "" ? "" : `### params${typeof q !== "boolean" && typeof q !== "string" && q && q.description ? ` (${q.description})` : ""}: ${paramTable}`;
|
|
165
164
|
}
|
|
166
165
|
if (paramTable !== "") {
|
|
167
166
|
paramsTable.push(paramTable);
|
|
@@ -170,13 +169,13 @@ const main = () => {
|
|
|
170
169
|
const query = doc.query instanceof Array ? doc.query : [doc.query];
|
|
171
170
|
const queryTables = [];
|
|
172
171
|
for (const q of query) {
|
|
173
|
-
let queryTable = parseOptionTable(q);
|
|
172
|
+
let queryTable = typeof q === "string" ? `${q}` : parseOptionTable(q);
|
|
174
173
|
// let paramsTable = parseOptionTable(doc.params);
|
|
175
174
|
if (queryTable.split("\n").length > 1) {
|
|
176
|
-
queryTable = `### query${q && q.description ? ` (${q.description})` : ""}\n\n${queryTable}`;
|
|
175
|
+
queryTable = `### query${typeof q !== "boolean" && typeof q !== "string" && q && q.description ? ` (${q.description})` : ""}\n\n${queryTable}`;
|
|
177
176
|
}
|
|
178
177
|
else {
|
|
179
|
-
queryTable = queryTable === "" ? "" : `### query${q && q.description ? ` (${q.description})` : ""}: ${queryTable}`;
|
|
178
|
+
queryTable = queryTable === "" ? "" : `### query${typeof q !== "boolean" && typeof q !== "string" && q && q.description ? ` (${q.description})` : ""}: ${queryTable}`;
|
|
180
179
|
}
|
|
181
180
|
if (queryTable !== "") {
|
|
182
181
|
queryTables.push(queryTable);
|
|
@@ -190,29 +189,29 @@ const main = () => {
|
|
|
190
189
|
const body = doc.body instanceof Array ? doc.body : [doc.body];
|
|
191
190
|
const bodyTables = [];
|
|
192
191
|
for (const b of body) {
|
|
193
|
-
let bodyTable = parseOptionTable(b);
|
|
192
|
+
let bodyTable = typeof b === "string" ? `${b}` : parseOptionTable(b);
|
|
194
193
|
if (bodyTable.split("\n").length > 1) {
|
|
195
|
-
bodyTable = `### body${b && b.description ? ` (${b.description})` : ""}\n\n${bodyTable}`;
|
|
194
|
+
bodyTable = `### body${typeof b !== "boolean" && typeof b !== "string" && b && b.description ? ` (${b.description})` : ""}\n\n${bodyTable}`;
|
|
196
195
|
}
|
|
197
196
|
else {
|
|
198
|
-
bodyTable = bodyTable === "" ? "" : `### body${b && b.description ? ` (${b.description})` : ""}: ${bodyTable}`;
|
|
197
|
+
bodyTable = bodyTable === "" ? "" : `### body${typeof b !== "boolean" && typeof b !== "string" && b && b.description ? ` (${b.description})` : ""}: ${bodyTable}`;
|
|
199
198
|
}
|
|
200
199
|
if (bodyTable !== "") {
|
|
201
200
|
bodyTables.push(bodyTable);
|
|
202
201
|
}
|
|
203
202
|
}
|
|
204
|
-
const results = doc.
|
|
203
|
+
const results = doc.response instanceof Array ? doc.response : [doc.response];
|
|
205
204
|
const resultTables = [];
|
|
206
205
|
for (const r of results) {
|
|
207
206
|
if (!r) {
|
|
208
207
|
continue;
|
|
209
208
|
}
|
|
210
|
-
let resultsTable =
|
|
209
|
+
let resultsTable = r && typeof r !== "string" && typeof r !== "boolean" ? parseOptionTable(r) : r;
|
|
211
210
|
if (resultsTable.split("\n").length > 1) {
|
|
212
|
-
resultsTable = `### response${r.description ? ` (${r.description})` : ""}\n\n${resultsTable}`;
|
|
211
|
+
resultsTable = `### response${typeof r !== "boolean" && typeof r !== "string" && r.description ? ` (${r.description})` : ""}\n\n${resultsTable}`;
|
|
213
212
|
}
|
|
214
213
|
else {
|
|
215
|
-
resultsTable = resultsTable === "" ? "" : `### response${r.description ? ` (${r.description})` : ""}: ${resultsTable}`;
|
|
214
|
+
resultsTable = resultsTable === "" ? "" : `### response${typeof r !== "boolean" && typeof r !== "string" && r.description ? ` (${r.description})` : ""}: ${resultsTable}`;
|
|
216
215
|
}
|
|
217
216
|
if (resultsTable !== "") {
|
|
218
217
|
resultTables.push(resultsTable);
|
|
@@ -5,26 +5,38 @@ const core_1 = require("@miqro/core");
|
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const templates = {
|
|
8
|
-
ts: (
|
|
8
|
+
ts: (noMethod = false) => noMethod ? `import { APIRoute } from "@miqro/core";
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
handler: async (ctx: Context) => {
|
|
10
|
+
export default {
|
|
11
|
+
method: "GET",
|
|
12
|
+
handler: async (ctx) => {
|
|
14
13
|
return {
|
|
15
|
-
text: \`Hello
|
|
14
|
+
text: \`Hello\`
|
|
16
15
|
}
|
|
17
16
|
}
|
|
18
|
-
};
|
|
17
|
+
} as APIRoute;
|
|
18
|
+
` : `import { APIRoute } from "@miqro/core";
|
|
19
19
|
|
|
20
|
-
export default
|
|
20
|
+
export default {
|
|
21
|
+
handler: async (ctx) => {
|
|
22
|
+
return {
|
|
23
|
+
text: \`Hello\`
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
} as APIRoute;
|
|
21
27
|
`,
|
|
22
|
-
js: (
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
js: (noMethod = false) => noMethod ? `module.exports = {
|
|
29
|
+
method: "GET
|
|
30
|
+
handler: async (ctx) => {
|
|
31
|
+
return {
|
|
32
|
+
text: \`Hello\`
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
` : `module.exports = {
|
|
25
37
|
handler: async (ctx) => {
|
|
26
38
|
return {
|
|
27
|
-
text: \`Hello
|
|
39
|
+
text: \`Hello\`
|
|
28
40
|
}
|
|
29
41
|
}
|
|
30
42
|
};
|
|
@@ -35,7 +47,7 @@ const main = () => {
|
|
|
35
47
|
throw new Error(`arguments: <identifier ex: SRC_API_V1_HEALTH>`);
|
|
36
48
|
}
|
|
37
49
|
const identifier = process.argv[3].toLocaleLowerCase();
|
|
38
|
-
const split = identifier.split("_");
|
|
50
|
+
const split = identifier.split("_").map(s => s.trim()).filter(s => s);
|
|
39
51
|
const dots = split.filter(s => s.indexOf(".") !== -1);
|
|
40
52
|
if (dots.length > 0) {
|
|
41
53
|
throw new Error(`identifier cannot contain dots\narguments: <identifier ex: SRC_API_V1_HEALTH>`);
|
|
@@ -43,6 +55,7 @@ const main = () => {
|
|
|
43
55
|
(0, core_1.loadConfig)();
|
|
44
56
|
const path = (0, path_1.resolve)(core_1.ConfigPathResolver.getBaseDirname(), ...split.splice(0, split.length - 1));
|
|
45
57
|
const ext = (0, fs_1.existsSync)((0, path_1.resolve)(core_1.ConfigPathResolver.getBaseDirname(), "tsconfig.json")) ? "ts" : "js";
|
|
58
|
+
const noMethod = ["post", "get", "put", "delete", "patch", "options"].indexOf(split[0].toLocaleLowerCase()) === -1;
|
|
46
59
|
const filePath = (0, path_1.resolve)(path, `${split[0]}.${ext}`);
|
|
47
60
|
if ((0, fs_1.existsSync)(filePath)) {
|
|
48
61
|
throw new Error(`file ${filePath} already exists! doing nothing`);
|
|
@@ -51,6 +64,6 @@ const main = () => {
|
|
|
51
64
|
(0, fs_1.mkdirSync)(path, {
|
|
52
65
|
recursive: true
|
|
53
66
|
});
|
|
54
|
-
(0, fs_1.writeFileSync)(filePath, templates[ext](
|
|
67
|
+
(0, fs_1.writeFileSync)(filePath, templates[ext](noMethod));
|
|
55
68
|
};
|
|
56
69
|
exports.main = main;
|
|
File without changes
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.main = void 0;
|
|
4
|
+
const core_1 = require("@miqro/core");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const testTemplates = {
|
|
8
|
+
js: (category) => `const options = {
|
|
9
|
+
category: "${category}",
|
|
10
|
+
before: async () => {
|
|
11
|
+
|
|
12
|
+
},
|
|
13
|
+
after: async () => {
|
|
14
|
+
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
it("happy path", async () => {
|
|
19
|
+
|
|
20
|
+
}, options)
|
|
21
|
+
`
|
|
22
|
+
};
|
|
23
|
+
const main = () => {
|
|
24
|
+
if (process.argv.length !== 4 || process.argv[3].length < 1) {
|
|
25
|
+
throw new Error(`arguments: <identifier ex: SRC_MAIN>`);
|
|
26
|
+
}
|
|
27
|
+
const identifier = process.argv[3].toLocaleLowerCase();
|
|
28
|
+
const split = identifier.split("_");
|
|
29
|
+
const dots = split.filter(s => s.indexOf(".") !== -1);
|
|
30
|
+
if (dots.length > 0) {
|
|
31
|
+
throw new Error(`identifier cannot contain dots\narguments: <identifier ex: TEST_SOMETEST>`);
|
|
32
|
+
}
|
|
33
|
+
(0, core_1.loadConfig)();
|
|
34
|
+
const path = (0, path_1.resolve)(core_1.ConfigPathResolver.getBaseDirname(), ...split.splice(0, split.length - 1));
|
|
35
|
+
const filePath = (0, path_1.resolve)(path, `${split[0]}.test.js`);
|
|
36
|
+
if ((0, fs_1.existsSync)(filePath)) {
|
|
37
|
+
throw new Error(`file ${filePath} already exists! doing nothing`);
|
|
38
|
+
}
|
|
39
|
+
console.log(`creating ${filePath}`);
|
|
40
|
+
(0, fs_1.mkdirSync)(path, {
|
|
41
|
+
recursive: true
|
|
42
|
+
});
|
|
43
|
+
(0, fs_1.writeFileSync)(filePath, testTemplates.js(split[0]));
|
|
44
|
+
console.log(`file ${filePath} created`);
|
|
45
|
+
};
|
|
46
|
+
exports.main = main;
|
package/dist/cmds/new.js
CHANGED
|
@@ -4,6 +4,12 @@ exports.mainTS = exports.mainJS = void 0;
|
|
|
4
4
|
const fs_1 = require("fs");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const utils_1 = require("../utils");
|
|
7
|
+
const gitignoreTemplate = {
|
|
8
|
+
ts: () => `node_modules/
|
|
9
|
+
dist/
|
|
10
|
+
`,
|
|
11
|
+
js: () => `node_modules/`
|
|
12
|
+
};
|
|
7
13
|
const packageTemplate = {
|
|
8
14
|
ts: (name) => `{
|
|
9
15
|
"name": "${name}",
|
|
@@ -12,8 +18,12 @@ const packageTemplate = {
|
|
|
12
18
|
"private": true,
|
|
13
19
|
"main": "dist/main.js",
|
|
14
20
|
"scripts": {
|
|
21
|
+
"prebuild": "rm -Rf dist/;",
|
|
15
22
|
"build": "tsc",
|
|
16
|
-
"
|
|
23
|
+
"prestart": "npm run build",
|
|
24
|
+
"start": "node dist/main.js",
|
|
25
|
+
"pretest": "npm run build",
|
|
26
|
+
"test": "miqro-test -r test/ -n"
|
|
17
27
|
},
|
|
18
28
|
"devDependencies": {
|
|
19
29
|
},
|
|
@@ -29,7 +39,8 @@ const packageTemplate = {
|
|
|
29
39
|
"private": true,
|
|
30
40
|
"main": "src/main.js",
|
|
31
41
|
"scripts": {
|
|
32
|
-
"start": "node src/main.js"
|
|
42
|
+
"start": "node src/main.js",
|
|
43
|
+
"test": "miqro-test -r test/ -n"
|
|
33
44
|
},
|
|
34
45
|
"devDependencies": {
|
|
35
46
|
},
|
|
@@ -63,6 +74,10 @@ const mainJS = (typescript = false) => {
|
|
|
63
74
|
(0, fs_1.writeFileSync)((0, path_1.resolve)(appFolder, "tsconfig.json"), `{
|
|
64
75
|
"compileOnSave": true,
|
|
65
76
|
"compilerOptions": {
|
|
77
|
+
"lib": ["es2021"],
|
|
78
|
+
"module": "commonjs",
|
|
79
|
+
"moduleResolution": "node",
|
|
80
|
+
"target": "es2021",
|
|
66
81
|
"strict": false,
|
|
67
82
|
"outDir": "./dist/",
|
|
68
83
|
"removeComments": true,
|
|
@@ -70,13 +85,7 @@ const mainJS = (typescript = false) => {
|
|
|
70
85
|
"preserveConstEnums": true,
|
|
71
86
|
"sourceMap": true,
|
|
72
87
|
"esModuleInterop": true,
|
|
73
|
-
"declaration": true
|
|
74
|
-
"moduleResolution": "node",
|
|
75
|
-
"module": "commonjs",
|
|
76
|
-
"target": "es2017",
|
|
77
|
-
"lib": [
|
|
78
|
-
"es2017"
|
|
79
|
-
]
|
|
88
|
+
"declaration": true
|
|
80
89
|
},
|
|
81
90
|
"exclude": [
|
|
82
91
|
"node_modules",
|
|
@@ -86,19 +95,35 @@ const mainJS = (typescript = false) => {
|
|
|
86
95
|
"src"
|
|
87
96
|
]
|
|
88
97
|
}`);
|
|
89
|
-
|
|
90
|
-
|
|
98
|
+
(0, utils_1.execSync)(`npm install typescript --save-dev`, {
|
|
99
|
+
cwd: appFolder
|
|
100
|
+
});
|
|
101
|
+
(0, utils_1.execSync)(`npm install @types/node --save-dev`, {
|
|
102
|
+
cwd: appFolder
|
|
91
103
|
});
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
104
|
+
(0, fs_1.writeFileSync)((0, path_1.resolve)(appFolder, ".gitignore"), gitignoreTemplate.ts());
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
(0, fs_1.writeFileSync)((0, path_1.resolve)(appFolder, ".gitignore"), gitignoreTemplate.js());
|
|
95
108
|
}
|
|
109
|
+
(0, utils_1.execSync)(`npm install @miqro/test --save-dev`, {
|
|
110
|
+
cwd: appFolder
|
|
111
|
+
});
|
|
96
112
|
(0, utils_1.execSync)(`npx miqro new:main src_main`, {
|
|
97
113
|
cwd: appFolder
|
|
98
114
|
});
|
|
99
115
|
(0, utils_1.execSync)(`npx miqro new:route src_api_health`, {
|
|
100
116
|
cwd: appFolder
|
|
101
117
|
});
|
|
118
|
+
(0, fs_1.mkdirSync)((0, path_1.resolve)(appFolder, "test"), {
|
|
119
|
+
recursive: true
|
|
120
|
+
});
|
|
121
|
+
(0, utils_1.execSync)(`npx miqro test:new test_api_health`, {
|
|
122
|
+
cwd: appFolder
|
|
123
|
+
});
|
|
124
|
+
console.log(`new project created on ${appFolder}`);
|
|
125
|
+
console.log(`cd ${identifier}`);
|
|
126
|
+
console.log(`npm run start`);
|
|
102
127
|
};
|
|
103
128
|
exports.mainJS = mainJS;
|
|
104
129
|
const mainTS = () => (0, exports.mainJS)(true);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const main: () => void;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.main = void 0;
|
|
4
|
+
const core_1 = require("@miqro/core");
|
|
5
|
+
const main = () => {
|
|
6
|
+
if (process.argv.length <= 3 || process.argv.length > 5) {
|
|
7
|
+
throw new Error(`invalid number of args\nusage: [PORT=8080] npx miqro serve <directory> [path=/]`);
|
|
8
|
+
}
|
|
9
|
+
const directory = process.argv[3];
|
|
10
|
+
const path = process.argv[4] ? process.argv[4] : "/";
|
|
11
|
+
(0, core_1.loadConfig)();
|
|
12
|
+
const PORT = process.env.PORT ? process.env.PORT : 8080;
|
|
13
|
+
if (PORT === undefined) {
|
|
14
|
+
throw new Error("PORT env var not defined");
|
|
15
|
+
}
|
|
16
|
+
const app = new core_1.App();
|
|
17
|
+
app.use((0, core_1.LoggerHandler)());
|
|
18
|
+
app.use((0, core_1.Static)({
|
|
19
|
+
directory,
|
|
20
|
+
list: true
|
|
21
|
+
}), path);
|
|
22
|
+
app.listen(PORT, () => {
|
|
23
|
+
console.log("serving " + directory + " on " + path + " on port " + PORT);
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
exports.main = main;
|
package/dist/utils/db/index.js
CHANGED
|
@@ -6,6 +6,7 @@ const fs_1 = require("fs");
|
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
const templates_1 = require("../../utils/templates");
|
|
8
8
|
const core_1 = require("@miqro/core");
|
|
9
|
+
const parser_1 = require("@miqro/parser");
|
|
9
10
|
const logger = console;
|
|
10
11
|
const loadSequelizeRC = (sequelizercPath = core_1.ConfigPathResolver.getSequelizeRCFilePath(), logger) => {
|
|
11
12
|
// noinspection SpellCheckingInspection
|
|
@@ -20,12 +21,12 @@ const loadSequelizeRC = (sequelizercPath = core_1.ConfigPathResolver.getSequeliz
|
|
|
20
21
|
// noinspection SpellCheckingInspection
|
|
21
22
|
/* eslint-disable @typescript-eslint/no-var-requires */
|
|
22
23
|
const sequelizerc = require(sequelizercPath);
|
|
23
|
-
return (0,
|
|
24
|
+
return (0, parser_1.parse)(sequelizerc, [
|
|
24
25
|
{ name: "config", type: "string", required: true },
|
|
25
26
|
{ name: "migrations-path", type: "string", required: true },
|
|
26
27
|
{ name: "seeders-path", type: "string", required: true },
|
|
27
28
|
{ name: "models-path", type: "string", required: true }
|
|
28
|
-
], "no_extra");
|
|
29
|
+
], "no_extra", sequelizercPath);
|
|
29
30
|
}
|
|
30
31
|
};
|
|
31
32
|
exports.loadSequelizeRC = loadSequelizeRC;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GroupPolicy, Logger, Method, SessionHandlerOptions } from "@miqro/core";
|
|
2
|
+
import { ParseOptions } from "@miqro/parser";
|
|
2
3
|
export declare const getDOCJSON: ({ dirname, subPath }: {
|
|
3
4
|
dirname: string;
|
|
4
5
|
subPath: string;
|
|
@@ -9,9 +10,9 @@ export declare const getDOCJSON: ({ dirname, subPath }: {
|
|
|
9
10
|
policy?: GroupPolicy;
|
|
10
11
|
headers?: ParseOptions | ParseOptions[];
|
|
11
12
|
session?: false | true | SessionHandlerOptions;
|
|
12
|
-
params?:
|
|
13
|
-
query?:
|
|
14
|
-
body?:
|
|
15
|
-
|
|
13
|
+
params?: boolean | ParseOptions | ParseOptions[] | string;
|
|
14
|
+
query?: boolean | ParseOptions | ParseOptions[] | string;
|
|
15
|
+
body?: boolean | ParseOptions | ParseOptions[] | string;
|
|
16
|
+
response?: ParseOptions | ParseOptions[] | string;
|
|
16
17
|
featureName: string;
|
|
17
18
|
}[];
|
package/dist/utils/doc/index.js
CHANGED
|
@@ -8,8 +8,17 @@ const getDOCJSON = ({ dirname, subPath }, logger) => {
|
|
|
8
8
|
const apiTraverse = (0, api_router_utils_1.traverseAPIRouteDir)((0, path_1.basename)(dirname).toUpperCase(), (0, path_1.resolve)(core_1.ConfigPathResolver.getBaseDirname(), dirname), subPath, undefined, logger);
|
|
9
9
|
const docJSON = Object.keys(apiTraverse).map(featureName => {
|
|
10
10
|
const { path, method, options } = apiTraverse[featureName];
|
|
11
|
-
const { session, policy, description } = options ? options : {
|
|
12
|
-
|
|
11
|
+
const { session, policy, description } = options ? options : {
|
|
12
|
+
session: undefined,
|
|
13
|
+
policy: undefined,
|
|
14
|
+
description: undefined
|
|
15
|
+
};
|
|
16
|
+
const { params, query, body, headers } = options && options.request ? options.request : {
|
|
17
|
+
params: undefined,
|
|
18
|
+
query: undefined,
|
|
19
|
+
body: undefined,
|
|
20
|
+
headers: undefined
|
|
21
|
+
};
|
|
13
22
|
const result = options && options.response !== true ? options.response : undefined;
|
|
14
23
|
return {
|
|
15
24
|
path,
|
package/dist/utils/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "miqro",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -17,16 +17,17 @@
|
|
|
17
17
|
"author": "claukers",
|
|
18
18
|
"license": "ISC",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@miqro/core": "^1.5.
|
|
21
|
-
"@miqro/
|
|
22
|
-
"@miqro/
|
|
20
|
+
"@miqro/core": "^1.5.4",
|
|
21
|
+
"@miqro/parser": "^0.0.2",
|
|
22
|
+
"@miqro/runner": "^1.2.4",
|
|
23
|
+
"@miqro/test": "^0.0.9",
|
|
23
24
|
"deep-diff": "1.0.2"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|
|
26
27
|
"@types/cookie": "^0.4.1",
|
|
27
28
|
"@types/deep-diff": "1.0.1",
|
|
28
29
|
"@types/node": "^16.7.10",
|
|
29
|
-
"typescript": "^4.
|
|
30
|
+
"typescript": "^4.5.4"
|
|
30
31
|
},
|
|
31
32
|
"engines": {
|
|
32
33
|
"node": ">=14.0.0",
|
package/dist/cmds/test.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.main = void 0;
|
|
4
|
-
const utils_1 = require("../utils");
|
|
5
|
-
const test_1 = require("@miqro/test");
|
|
6
|
-
const core_1 = require("@miqro/core");
|
|
7
|
-
const main = () => {
|
|
8
|
-
if (process.argv.length <= 3) {
|
|
9
|
-
throw new Error(`invalid number of args\nusage: npx miqro test <test/*.test.js> [...args]`);
|
|
10
|
-
}
|
|
11
|
-
(0, core_1.loadConfig)();
|
|
12
|
-
//execSync(`npx @miqro/test ${process.argv.slice(3).join(" ")}`);
|
|
13
|
-
(0, utils_1.execSync)(`${process.argv[0]} ${(0, test_1.mainPath)()} ${process.argv.slice(3).join(" ")}`);
|
|
14
|
-
};
|
|
15
|
-
exports.main = main;
|