@adaptivestone/framework 4.6.0 → 4.7.0
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/CHANGELOG.md +5 -0
- package/cluster.js +1 -2
- package/commands/GetOpenApiJson.js +1 -2
- package/commands/migration/Migrate.js +2 -2
- package/controllers/index.js +0 -1
- package/modules/AbstractController.js +1 -1
- package/modules/Base.js +2 -63
- package/modules/BaseCli.js +0 -1
- package/package.json +1 -1
- package/server.d.ts +8 -1
- package/server.js +83 -9
- package/services/documentation/DocumentationGenerator.js +18 -20
- package/services/validate/ValidateService.js +3 -7
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/clover.xml +0 -3433
- package/coverage/coverage-final.json +0 -41
- package/coverage/favicon.png +0 -0
- package/coverage/framework/config/auth.js.html +0 -100
- package/coverage/framework/config/http.js.html +0 -112
- package/coverage/framework/config/i18n.js.html +0 -121
- package/coverage/framework/config/index.html +0 -236
- package/coverage/framework/config/log.js.html +0 -151
- package/coverage/framework/config/mail.js.html +0 -172
- package/coverage/framework/config/mongo.js.html +0 -94
- package/coverage/framework/config/rateLimiter.js.html +0 -133
- package/coverage/framework/config/redis.js.html +0 -97
- package/coverage/framework/config/validate.js.html +0 -94
- package/coverage/framework/controllers/Auth.js.html +0 -721
- package/coverage/framework/controllers/Home.js.html +0 -169
- package/coverage/framework/controllers/index.html +0 -146
- package/coverage/framework/controllers/index.js.html +0 -268
- package/coverage/framework/controllers/test/SomeController.js.html +0 -616
- package/coverage/framework/controllers/test/index.html +0 -116
- package/coverage/framework/helpers/redis/clearNamespace.js.html +0 -127
- package/coverage/framework/helpers/redis/index.html +0 -116
- package/coverage/framework/index.html +0 -116
- package/coverage/framework/models/Sequence.js.html +0 -151
- package/coverage/framework/models/User.js.html +0 -859
- package/coverage/framework/models/index.html +0 -131
- package/coverage/framework/modules/AbstractController.js.html +0 -1315
- package/coverage/framework/modules/AbstractModel.js.html +0 -268
- package/coverage/framework/modules/Base.js.html +0 -577
- package/coverage/framework/modules/index.html +0 -146
- package/coverage/framework/server.js.html +0 -820
- package/coverage/framework/services/cache/Cache.js.html +0 -430
- package/coverage/framework/services/cache/index.html +0 -116
- package/coverage/framework/services/documentation/DocumentationGenerator.js.html +0 -598
- package/coverage/framework/services/documentation/index.html +0 -116
- package/coverage/framework/services/http/HttpServer.js.html +0 -373
- package/coverage/framework/services/http/index.html +0 -116
- package/coverage/framework/services/http/middleware/AbstractMiddleware.js.html +0 -238
- package/coverage/framework/services/http/middleware/Auth.js.html +0 -145
- package/coverage/framework/services/http/middleware/GetUserByToken.js.html +0 -223
- package/coverage/framework/services/http/middleware/I18n.js.html +0 -442
- package/coverage/framework/services/http/middleware/Pagination.js.html +0 -253
- package/coverage/framework/services/http/middleware/PrepareAppInfo.js.html +0 -139
- package/coverage/framework/services/http/middleware/RateLimiter.js.html +0 -472
- package/coverage/framework/services/http/middleware/RequestLogger.js.html +0 -151
- package/coverage/framework/services/http/middleware/RequestParser.js.html +0 -199
- package/coverage/framework/services/http/middleware/Role.js.html +0 -172
- package/coverage/framework/services/http/middleware/index.html +0 -251
- package/coverage/framework/services/http/middleware/test/CheckFlag.js.html +0 -139
- package/coverage/framework/services/http/middleware/test/index.html +0 -116
- package/coverage/framework/services/messaging/email/index.html +0 -116
- package/coverage/framework/services/messaging/email/index.js.html +0 -739
- package/coverage/framework/services/messaging/index.html +0 -116
- package/coverage/framework/services/messaging/index.js.html +0 -100
- package/coverage/framework/services/validate/ValidateService.js.html +0 -568
- package/coverage/framework/services/validate/drivers/AbstractValidator.js.html +0 -196
- package/coverage/framework/services/validate/drivers/CustomValidator.js.html +0 -241
- package/coverage/framework/services/validate/drivers/YupValidator.js.html +0 -394
- package/coverage/framework/services/validate/drivers/index.html +0 -146
- package/coverage/framework/services/validate/index.html +0 -116
- package/coverage/index.html +0 -341
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -196
package/CHANGELOG.md
CHANGED
package/cluster.js
CHANGED
|
@@ -13,8 +13,7 @@ class GetOpenApiJson extends AbstractCommand {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
try {
|
|
16
|
-
|
|
17
|
-
jsonFile = require(jsonFile);
|
|
16
|
+
jsonFile = JSON.parse(await fs.readFile(jsonFile, 'utf8'));
|
|
18
17
|
} catch (e) {
|
|
19
18
|
this.logger.error(
|
|
20
19
|
'No npm package detected. Please start this command via NPM as it depends on package.json',
|
|
@@ -31,8 +31,8 @@ class Migrate extends AbstractCommand {
|
|
|
31
31
|
|
|
32
32
|
for (const migration of migrations) {
|
|
33
33
|
this.logger.info(`=== Start migration ${migration.file} ===`);
|
|
34
|
-
// eslint-disable-next-line
|
|
35
|
-
const MigrationCommand =
|
|
34
|
+
// eslint-disable-next-line no-await-in-loop
|
|
35
|
+
const MigrationCommand = await import(migration.path);
|
|
36
36
|
const migrationCommand = new MigrationCommand(this.app);
|
|
37
37
|
// eslint-disable-next-line no-await-in-loop
|
|
38
38
|
await migrationCommand.up();
|
package/controllers/index.js
CHANGED
|
@@ -33,7 +33,6 @@ class ControllerManager extends Base {
|
|
|
33
33
|
// TODO wait until https://github.com/nodejs/node/issues/35889
|
|
34
34
|
controllers.push(
|
|
35
35
|
import(controller.path).then(({ default: ControllerModule }) => {
|
|
36
|
-
// eslint-disable-next-line import/no-dynamic-require, global-require
|
|
37
36
|
// const ControllerModule = require(controller.path);
|
|
38
37
|
const contollerName = ControllerModule.name.toLowerCase();
|
|
39
38
|
let prefix = path.dirname(controller.file);
|
|
@@ -271,7 +271,7 @@ class AbstractController extends Base {
|
|
|
271
271
|
*/
|
|
272
272
|
if (!this.app.httpServer) {
|
|
273
273
|
this.app.documentation.push(
|
|
274
|
-
DocumentationGenerator.convertDataToDocumentationElement(
|
|
274
|
+
new DocumentationGenerator(this.app).convertDataToDocumentationElement(
|
|
275
275
|
this.getConstructorName(),
|
|
276
276
|
routesInfo,
|
|
277
277
|
middlewaresInfo,
|
package/modules/Base.js
CHANGED
|
@@ -29,71 +29,10 @@ class Base {
|
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* Get winston loger for given label
|
|
32
|
-
* @param {
|
|
32
|
+
* @param {string} label name of logger
|
|
33
33
|
*/
|
|
34
34
|
getLogger(label) {
|
|
35
|
-
|
|
36
|
-
const winston = require('winston'); // speed up optimisation
|
|
37
|
-
const alignColorsAndTime = winston.format.combine(
|
|
38
|
-
winston.format.colorize({
|
|
39
|
-
all: true,
|
|
40
|
-
}),
|
|
41
|
-
winston.format.label({
|
|
42
|
-
label: ` \x1B[32m[${label}]\x1B[39m`,
|
|
43
|
-
}),
|
|
44
|
-
winston.format.timestamp(),
|
|
45
|
-
winston.format.printf(
|
|
46
|
-
(info) =>
|
|
47
|
-
`(${process.pid}) ${info.label} ${info.timestamp} ${info.level} : ${info.message}`,
|
|
48
|
-
),
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
const logConfig = this.app.getConfig('log').transports;
|
|
52
|
-
|
|
53
|
-
function IsConstructor(f) {
|
|
54
|
-
try {
|
|
55
|
-
Reflect.construct(String, [], f);
|
|
56
|
-
} catch (e) {
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
return true;
|
|
60
|
-
}
|
|
61
|
-
const transports = [];
|
|
62
|
-
for (const log of logConfig) {
|
|
63
|
-
if (log.enable) {
|
|
64
|
-
if (log.transport === 'console') {
|
|
65
|
-
transports.push(
|
|
66
|
-
new winston.transports.Console({
|
|
67
|
-
level: log.transportOptions.level,
|
|
68
|
-
format: winston.format.combine(
|
|
69
|
-
winston.format.colorize(),
|
|
70
|
-
alignColorsAndTime,
|
|
71
|
-
),
|
|
72
|
-
}),
|
|
73
|
-
);
|
|
74
|
-
} else {
|
|
75
|
-
// eslint-disable-next-line global-require, import/no-dynamic-require
|
|
76
|
-
let Tr = require(log.transport);
|
|
77
|
-
if (!IsConstructor(Tr) && Tr.default) {
|
|
78
|
-
Tr = Tr.default;
|
|
79
|
-
} else {
|
|
80
|
-
// eslint-disable-next-line no-console
|
|
81
|
-
console.error(
|
|
82
|
-
`${log.transport} not a constructor. Please check it`,
|
|
83
|
-
);
|
|
84
|
-
// eslint-disable-next-line no-continue
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
transports.push(new Tr(log.transportOptions));
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return winston.createLogger({
|
|
94
|
-
level: 'silly',
|
|
95
|
-
transports,
|
|
96
|
-
});
|
|
35
|
+
return this.app.logger.child({ label });
|
|
97
36
|
}
|
|
98
37
|
|
|
99
38
|
async getFilesPathWithInheritance(internalFolder, externalFolder) {
|
package/modules/BaseCli.js
CHANGED
|
@@ -50,7 +50,6 @@ class Cli extends Base {
|
|
|
50
50
|
// TODO wait until https://github.com/nodejs/node/issues/35889
|
|
51
51
|
const { default: Command } = await import(this.commands[command]);
|
|
52
52
|
|
|
53
|
-
// eslint-disable-next-line import/no-dynamic-require, global-require
|
|
54
53
|
// const Command = require(this.commands[command]);
|
|
55
54
|
|
|
56
55
|
const c = new Command(this.app, this.commands, args);
|
package/package.json
CHANGED
package/server.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { Model as MongooseModel, Schema } from 'mongoose';
|
|
|
7
7
|
|
|
8
8
|
import BaseCli from './modules/BaseCli';
|
|
9
9
|
import Cache from './services/cache/Cache';
|
|
10
|
+
import winston from 'winston';
|
|
10
11
|
|
|
11
12
|
type ServerConfig = {
|
|
12
13
|
folders: ExpandDeep<TFolderConfig>;
|
|
@@ -22,6 +23,7 @@ declare class Server {
|
|
|
22
23
|
foldersConfig: Server['config']['folders'];
|
|
23
24
|
events: EventEmitter;
|
|
24
25
|
get cache(): Server['cacheService'];
|
|
26
|
+
get logger(): winston.Logger;
|
|
25
27
|
httpServer: null;
|
|
26
28
|
controllerManager: null;
|
|
27
29
|
};
|
|
@@ -39,7 +41,7 @@ declare class Server {
|
|
|
39
41
|
constructor(config: ExpandDeep<ServerConfig>);
|
|
40
42
|
|
|
41
43
|
/**
|
|
42
|
-
* Start server (http
|
|
44
|
+
* Start server (http + init all http ralated functions)
|
|
43
45
|
*/
|
|
44
46
|
startServer(callbackBefore404?: Promise<null>): Promise<null>;
|
|
45
47
|
|
|
@@ -54,6 +56,11 @@ declare class Server {
|
|
|
54
56
|
*/
|
|
55
57
|
getConfig(configName: string): {};
|
|
56
58
|
|
|
59
|
+
/**
|
|
60
|
+
* Return or create new logger instance. This is a main logger instance
|
|
61
|
+
*/
|
|
62
|
+
getLogger(): winston.Logger;
|
|
63
|
+
|
|
57
64
|
/**
|
|
58
65
|
* Primary designed for tests when we need to update some configs before start testing
|
|
59
66
|
* Should be called before any initialization was done
|
package/server.js
CHANGED
|
@@ -3,11 +3,14 @@ const EventEmitter = require('node:events');
|
|
|
3
3
|
|
|
4
4
|
require('dotenv').config();
|
|
5
5
|
const merge = require('deepmerge');
|
|
6
|
+
const winston = require('winston');
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Main framework class.
|
|
9
10
|
*/
|
|
10
11
|
class Server {
|
|
12
|
+
#realLogger = null;
|
|
13
|
+
|
|
11
14
|
/**
|
|
12
15
|
* Construct new server
|
|
13
16
|
* @param {Object} config main config object
|
|
@@ -33,6 +36,9 @@ class Server {
|
|
|
33
36
|
get cache() {
|
|
34
37
|
return that.getCache();
|
|
35
38
|
},
|
|
39
|
+
get logger() {
|
|
40
|
+
return that.getLogger();
|
|
41
|
+
},
|
|
36
42
|
httpServer: null,
|
|
37
43
|
controllerManager: null,
|
|
38
44
|
};
|
|
@@ -46,21 +52,17 @@ class Server {
|
|
|
46
52
|
}
|
|
47
53
|
|
|
48
54
|
/**
|
|
49
|
-
* Start server (http
|
|
55
|
+
* Start server (http + init all http ralated functions)
|
|
50
56
|
* @param <Promise>callbackBefore404 code that should be executed before adding page 404
|
|
51
57
|
* @returns {Promise}
|
|
52
58
|
*/
|
|
53
59
|
async startServer(callbackBefore404 = async () => Promise.resolve()) {
|
|
54
|
-
// eslint-disable-next-line global-require
|
|
55
60
|
// const HttpServer = require('./services/http/HttpServer');
|
|
56
|
-
// eslint-disable-next-line global-require
|
|
57
61
|
// const ControllerManager = require('./controllers/index');
|
|
58
62
|
// TODO wait until https://github.com/nodejs/node/issues/35889
|
|
59
63
|
const [{ default: HttpServer }, { default: ControllerManager }] =
|
|
60
64
|
await Promise.all([
|
|
61
|
-
// eslint-disable-next-line import/extensions
|
|
62
65
|
import('./services/http/HttpServer.js'), // Speed optimisation
|
|
63
|
-
// eslint-disable-next-line import/extensions
|
|
64
66
|
import('./controllers/index.js'), // Speed optimisation
|
|
65
67
|
]);
|
|
66
68
|
|
|
@@ -126,6 +128,80 @@ class Server {
|
|
|
126
128
|
return this.cache.configs.get(configName);
|
|
127
129
|
}
|
|
128
130
|
|
|
131
|
+
/**
|
|
132
|
+
* Return or create new logger instance. This is a main logger instance
|
|
133
|
+
*/
|
|
134
|
+
getLogger() {
|
|
135
|
+
if (!this.#realLogger) {
|
|
136
|
+
this.#realLogger = this.#createLogger();
|
|
137
|
+
}
|
|
138
|
+
return this.#realLogger;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
#createLogger() {
|
|
142
|
+
const alignColorsAndTime = winston.format.combine(
|
|
143
|
+
winston.format.colorize({
|
|
144
|
+
all: true,
|
|
145
|
+
}),
|
|
146
|
+
winston.format.timestamp(),
|
|
147
|
+
winston.format.printf(
|
|
148
|
+
(info) =>
|
|
149
|
+
`(${process.pid}) \x1B[32m[${info.label ?? 'SERVER'}]\x1B[39m ${
|
|
150
|
+
info.timestamp
|
|
151
|
+
} ${info.level} : ${info.message} ${info?.stack ?? ''} ${
|
|
152
|
+
info.durationMs ? `Duration: ${info.durationMs}ms` : ''
|
|
153
|
+
}`,
|
|
154
|
+
),
|
|
155
|
+
);
|
|
156
|
+
const logConfig = this.app.getConfig('log').transports;
|
|
157
|
+
function IsConstructor(f) {
|
|
158
|
+
try {
|
|
159
|
+
Reflect.construct(String, [], f);
|
|
160
|
+
} catch (e) {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
const logger = winston.createLogger({
|
|
167
|
+
format: winston.format.errors({ stack: true }),
|
|
168
|
+
level: 'silly',
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
for (const log of logConfig) {
|
|
172
|
+
if (log.enable) {
|
|
173
|
+
if (log.transport === 'console') {
|
|
174
|
+
logger.add(
|
|
175
|
+
new winston.transports.Console({
|
|
176
|
+
level: log.transportOptions.level,
|
|
177
|
+
format: winston.format.combine(
|
|
178
|
+
winston.format.colorize(),
|
|
179
|
+
alignColorsAndTime,
|
|
180
|
+
),
|
|
181
|
+
}),
|
|
182
|
+
);
|
|
183
|
+
} else {
|
|
184
|
+
import(log.transport).then((Tr) => {
|
|
185
|
+
let Transport = Tr.default;
|
|
186
|
+
if (!IsConstructor(Transport) && Transport.default) {
|
|
187
|
+
Transport = Transport.default;
|
|
188
|
+
} else {
|
|
189
|
+
console.error(
|
|
190
|
+
`${log.transport} not a constructor. Please check it`,
|
|
191
|
+
);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
logger.profile(`Adding new logger ${log.transport}`);
|
|
195
|
+
logger.add(new Transport(log.transportOptions));
|
|
196
|
+
logger.profile(`Adding new logger ${log.transport}`);
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return logger;
|
|
203
|
+
}
|
|
204
|
+
|
|
129
205
|
/**
|
|
130
206
|
* Primary designed for tests when we need to update some configs before start testing
|
|
131
207
|
* Should be called before any initialization was done
|
|
@@ -178,11 +254,9 @@ class Server {
|
|
|
178
254
|
*/
|
|
179
255
|
async runCliCommand(commandName, args) {
|
|
180
256
|
if (!this.cli) {
|
|
181
|
-
// eslint-disable-next-line import/extensions
|
|
182
257
|
// TODO wait until https://github.com/nodejs/node/issues/35889
|
|
183
|
-
|
|
184
|
-
//
|
|
185
|
-
const BaseCli = require('./modules/BaseCli');
|
|
258
|
+
const { default: BaseCli } = await import('./modules/BaseCli.js'); // Speed optimisation
|
|
259
|
+
// const BaseCli = require('./modules/BaseCli');
|
|
186
260
|
this.cli = new BaseCli(this);
|
|
187
261
|
}
|
|
188
262
|
return this.cli.run(commandName, args);
|
|
@@ -2,7 +2,8 @@ const Base = require('../../modules/Base');
|
|
|
2
2
|
const ValidateService = require('../validate/ValidateService');
|
|
3
3
|
|
|
4
4
|
class DocumentationGenerator extends Base {
|
|
5
|
-
|
|
5
|
+
// eslint-disable-next-line class-methods-use-this
|
|
6
|
+
processingFields(fieldsByRoute) {
|
|
6
7
|
const fields = [];
|
|
7
8
|
if (!fieldsByRoute) {
|
|
8
9
|
return fields;
|
|
@@ -36,7 +37,8 @@ class DocumentationGenerator extends Base {
|
|
|
36
37
|
return fields;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
// eslint-disable-next-line class-methods-use-this
|
|
41
|
+
selectUniqueFields(fields) {
|
|
40
42
|
return Array.from(
|
|
41
43
|
new Map(fields.map((item) => [item.name, item])).values(),
|
|
42
44
|
).reduce((uniqueArray, item) => {
|
|
@@ -52,7 +54,7 @@ class DocumentationGenerator extends Base {
|
|
|
52
54
|
}, []);
|
|
53
55
|
}
|
|
54
56
|
|
|
55
|
-
|
|
57
|
+
groupFieldsFromSchemas(schemas) {
|
|
56
58
|
const result = [];
|
|
57
59
|
schemas.forEach((schema) => {
|
|
58
60
|
const convertedSchema = new ValidateService(this.app, schema).validator;
|
|
@@ -71,7 +73,7 @@ class DocumentationGenerator extends Base {
|
|
|
71
73
|
return result;
|
|
72
74
|
}
|
|
73
75
|
|
|
74
|
-
|
|
76
|
+
convertDataToDocumentationElement(
|
|
75
77
|
controllerName,
|
|
76
78
|
routesInfo,
|
|
77
79
|
middlewaresInfo,
|
|
@@ -80,23 +82,19 @@ class DocumentationGenerator extends Base {
|
|
|
80
82
|
return {
|
|
81
83
|
contollerName: controllerName,
|
|
82
84
|
routesInfo: routesInfo.map((route) => {
|
|
83
|
-
const middlewareQueryParams = ValidateService
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
},
|
|
90
|
-
).query;
|
|
85
|
+
const middlewareQueryParams = new ValidateService(
|
|
86
|
+
this.app,
|
|
87
|
+
).getMiddlewareParams(middlewaresInfo, routeMiddlewaresReg, {
|
|
88
|
+
method: route.method.toLowerCase(),
|
|
89
|
+
path: route.fullPath,
|
|
90
|
+
}).query;
|
|
91
91
|
|
|
92
|
-
const middlewareRequestParams = ValidateService
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
},
|
|
99
|
-
).request;
|
|
92
|
+
const middlewareRequestParams = new ValidateService(
|
|
93
|
+
this.app,
|
|
94
|
+
).getMiddlewareParams(middlewaresInfo, routeMiddlewaresReg, {
|
|
95
|
+
method: route.method.toLowerCase(),
|
|
96
|
+
path: route.fullPath,
|
|
97
|
+
}).request;
|
|
100
98
|
|
|
101
99
|
const queryParams = this.groupFieldsFromSchemas(middlewareQueryParams);
|
|
102
100
|
|
|
@@ -41,7 +41,7 @@ class ValidateService extends Base {
|
|
|
41
41
|
/**
|
|
42
42
|
* Filter middlewares by route path and select all parameters
|
|
43
43
|
*/
|
|
44
|
-
|
|
44
|
+
filterRelatedParametersByRoute(middlewares, method, path) {
|
|
45
45
|
const middlewaresParams = middlewares
|
|
46
46
|
.filter(
|
|
47
47
|
(middleware) =>
|
|
@@ -63,11 +63,7 @@ class ValidateService extends Base {
|
|
|
63
63
|
/**
|
|
64
64
|
* Group all middleware(routes + controller) parameters
|
|
65
65
|
*/
|
|
66
|
-
|
|
67
|
-
controllerMiddlewares,
|
|
68
|
-
AllrouteMiddlewares,
|
|
69
|
-
options,
|
|
70
|
-
) {
|
|
66
|
+
getMiddlewareParams(controllerMiddlewares, AllrouteMiddlewares, options) {
|
|
71
67
|
const { method, path } = options;
|
|
72
68
|
const routeMiddlewaresParams = this.filterRelatedParametersByRoute(
|
|
73
69
|
AllrouteMiddlewares,
|
|
@@ -134,7 +130,7 @@ class ValidateService extends Base {
|
|
|
134
130
|
this.validator,
|
|
135
131
|
selectedReqData,
|
|
136
132
|
);
|
|
137
|
-
const additionalMiddlewareSchemas = this.
|
|
133
|
+
const additionalMiddlewareSchemas = this.getMiddlewareParams(
|
|
138
134
|
middlewaresInfo,
|
|
139
135
|
routeMiddlewaresReg,
|
|
140
136
|
routeOptions,
|
package/coverage/base.css
DELETED
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
body, html {
|
|
2
|
-
margin:0; padding: 0;
|
|
3
|
-
height: 100%;
|
|
4
|
-
}
|
|
5
|
-
body {
|
|
6
|
-
font-family: Helvetica Neue, Helvetica, Arial;
|
|
7
|
-
font-size: 14px;
|
|
8
|
-
color:#333;
|
|
9
|
-
}
|
|
10
|
-
.small { font-size: 12px; }
|
|
11
|
-
*, *:after, *:before {
|
|
12
|
-
-webkit-box-sizing:border-box;
|
|
13
|
-
-moz-box-sizing:border-box;
|
|
14
|
-
box-sizing:border-box;
|
|
15
|
-
}
|
|
16
|
-
h1 { font-size: 20px; margin: 0;}
|
|
17
|
-
h2 { font-size: 14px; }
|
|
18
|
-
pre {
|
|
19
|
-
font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
|
20
|
-
margin: 0;
|
|
21
|
-
padding: 0;
|
|
22
|
-
-moz-tab-size: 2;
|
|
23
|
-
-o-tab-size: 2;
|
|
24
|
-
tab-size: 2;
|
|
25
|
-
}
|
|
26
|
-
a { color:#0074D9; text-decoration:none; }
|
|
27
|
-
a:hover { text-decoration:underline; }
|
|
28
|
-
.strong { font-weight: bold; }
|
|
29
|
-
.space-top1 { padding: 10px 0 0 0; }
|
|
30
|
-
.pad2y { padding: 20px 0; }
|
|
31
|
-
.pad1y { padding: 10px 0; }
|
|
32
|
-
.pad2x { padding: 0 20px; }
|
|
33
|
-
.pad2 { padding: 20px; }
|
|
34
|
-
.pad1 { padding: 10px; }
|
|
35
|
-
.space-left2 { padding-left:55px; }
|
|
36
|
-
.space-right2 { padding-right:20px; }
|
|
37
|
-
.center { text-align:center; }
|
|
38
|
-
.clearfix { display:block; }
|
|
39
|
-
.clearfix:after {
|
|
40
|
-
content:'';
|
|
41
|
-
display:block;
|
|
42
|
-
height:0;
|
|
43
|
-
clear:both;
|
|
44
|
-
visibility:hidden;
|
|
45
|
-
}
|
|
46
|
-
.fl { float: left; }
|
|
47
|
-
@media only screen and (max-width:640px) {
|
|
48
|
-
.col3 { width:100%; max-width:100%; }
|
|
49
|
-
.hide-mobile { display:none!important; }
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.quiet {
|
|
53
|
-
color: #7f7f7f;
|
|
54
|
-
color: rgba(0,0,0,0.5);
|
|
55
|
-
}
|
|
56
|
-
.quiet a { opacity: 0.7; }
|
|
57
|
-
|
|
58
|
-
.fraction {
|
|
59
|
-
font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
|
|
60
|
-
font-size: 10px;
|
|
61
|
-
color: #555;
|
|
62
|
-
background: #E8E8E8;
|
|
63
|
-
padding: 4px 5px;
|
|
64
|
-
border-radius: 3px;
|
|
65
|
-
vertical-align: middle;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
div.path a:link, div.path a:visited { color: #333; }
|
|
69
|
-
table.coverage {
|
|
70
|
-
border-collapse: collapse;
|
|
71
|
-
margin: 10px 0 0 0;
|
|
72
|
-
padding: 0;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
table.coverage td {
|
|
76
|
-
margin: 0;
|
|
77
|
-
padding: 0;
|
|
78
|
-
vertical-align: top;
|
|
79
|
-
}
|
|
80
|
-
table.coverage td.line-count {
|
|
81
|
-
text-align: right;
|
|
82
|
-
padding: 0 5px 0 20px;
|
|
83
|
-
}
|
|
84
|
-
table.coverage td.line-coverage {
|
|
85
|
-
text-align: right;
|
|
86
|
-
padding-right: 10px;
|
|
87
|
-
min-width:20px;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
table.coverage td span.cline-any {
|
|
91
|
-
display: inline-block;
|
|
92
|
-
padding: 0 5px;
|
|
93
|
-
width: 100%;
|
|
94
|
-
}
|
|
95
|
-
.missing-if-branch {
|
|
96
|
-
display: inline-block;
|
|
97
|
-
margin-right: 5px;
|
|
98
|
-
border-radius: 3px;
|
|
99
|
-
position: relative;
|
|
100
|
-
padding: 0 4px;
|
|
101
|
-
background: #333;
|
|
102
|
-
color: yellow;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.skip-if-branch {
|
|
106
|
-
display: none;
|
|
107
|
-
margin-right: 10px;
|
|
108
|
-
position: relative;
|
|
109
|
-
padding: 0 4px;
|
|
110
|
-
background: #ccc;
|
|
111
|
-
color: white;
|
|
112
|
-
}
|
|
113
|
-
.missing-if-branch .typ, .skip-if-branch .typ {
|
|
114
|
-
color: inherit !important;
|
|
115
|
-
}
|
|
116
|
-
.coverage-summary {
|
|
117
|
-
border-collapse: collapse;
|
|
118
|
-
width: 100%;
|
|
119
|
-
}
|
|
120
|
-
.coverage-summary tr { border-bottom: 1px solid #bbb; }
|
|
121
|
-
.keyline-all { border: 1px solid #ddd; }
|
|
122
|
-
.coverage-summary td, .coverage-summary th { padding: 10px; }
|
|
123
|
-
.coverage-summary tbody { border: 1px solid #bbb; }
|
|
124
|
-
.coverage-summary td { border-right: 1px solid #bbb; }
|
|
125
|
-
.coverage-summary td:last-child { border-right: none; }
|
|
126
|
-
.coverage-summary th {
|
|
127
|
-
text-align: left;
|
|
128
|
-
font-weight: normal;
|
|
129
|
-
white-space: nowrap;
|
|
130
|
-
}
|
|
131
|
-
.coverage-summary th.file { border-right: none !important; }
|
|
132
|
-
.coverage-summary th.pct { }
|
|
133
|
-
.coverage-summary th.pic,
|
|
134
|
-
.coverage-summary th.abs,
|
|
135
|
-
.coverage-summary td.pct,
|
|
136
|
-
.coverage-summary td.abs { text-align: right; }
|
|
137
|
-
.coverage-summary td.file { white-space: nowrap; }
|
|
138
|
-
.coverage-summary td.pic { min-width: 120px !important; }
|
|
139
|
-
.coverage-summary tfoot td { }
|
|
140
|
-
|
|
141
|
-
.coverage-summary .sorter {
|
|
142
|
-
height: 10px;
|
|
143
|
-
width: 7px;
|
|
144
|
-
display: inline-block;
|
|
145
|
-
margin-left: 0.5em;
|
|
146
|
-
background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent;
|
|
147
|
-
}
|
|
148
|
-
.coverage-summary .sorted .sorter {
|
|
149
|
-
background-position: 0 -20px;
|
|
150
|
-
}
|
|
151
|
-
.coverage-summary .sorted-desc .sorter {
|
|
152
|
-
background-position: 0 -10px;
|
|
153
|
-
}
|
|
154
|
-
.status-line { height: 10px; }
|
|
155
|
-
/* yellow */
|
|
156
|
-
.cbranch-no { background: yellow !important; color: #111; }
|
|
157
|
-
/* dark red */
|
|
158
|
-
.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 }
|
|
159
|
-
.low .chart { border:1px solid #C21F39 }
|
|
160
|
-
.highlighted,
|
|
161
|
-
.highlighted .cstat-no, .highlighted .fstat-no, .highlighted .cbranch-no{
|
|
162
|
-
background: #C21F39 !important;
|
|
163
|
-
}
|
|
164
|
-
/* medium red */
|
|
165
|
-
.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE }
|
|
166
|
-
/* light red */
|
|
167
|
-
.low, .cline-no { background:#FCE1E5 }
|
|
168
|
-
/* light green */
|
|
169
|
-
.high, .cline-yes { background:rgb(230,245,208) }
|
|
170
|
-
/* medium green */
|
|
171
|
-
.cstat-yes { background:rgb(161,215,106) }
|
|
172
|
-
/* dark green */
|
|
173
|
-
.status-line.high, .high .cover-fill { background:rgb(77,146,33) }
|
|
174
|
-
.high .chart { border:1px solid rgb(77,146,33) }
|
|
175
|
-
/* dark yellow (gold) */
|
|
176
|
-
.status-line.medium, .medium .cover-fill { background: #f9cd0b; }
|
|
177
|
-
.medium .chart { border:1px solid #f9cd0b; }
|
|
178
|
-
/* light yellow */
|
|
179
|
-
.medium { background: #fff4c2; }
|
|
180
|
-
|
|
181
|
-
.cstat-skip { background: #ddd; color: #111; }
|
|
182
|
-
.fstat-skip { background: #ddd; color: #111 !important; }
|
|
183
|
-
.cbranch-skip { background: #ddd !important; color: #111; }
|
|
184
|
-
|
|
185
|
-
span.cline-neutral { background: #eaeaea; }
|
|
186
|
-
|
|
187
|
-
.coverage-summary td.empty {
|
|
188
|
-
opacity: .5;
|
|
189
|
-
padding-top: 4px;
|
|
190
|
-
padding-bottom: 4px;
|
|
191
|
-
line-height: 1;
|
|
192
|
-
color: #888;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
.cover-fill, .cover-empty {
|
|
196
|
-
display:inline-block;
|
|
197
|
-
height: 12px;
|
|
198
|
-
}
|
|
199
|
-
.chart {
|
|
200
|
-
line-height: 0;
|
|
201
|
-
}
|
|
202
|
-
.cover-empty {
|
|
203
|
-
background: white;
|
|
204
|
-
}
|
|
205
|
-
.cover-full {
|
|
206
|
-
border-right: none !important;
|
|
207
|
-
}
|
|
208
|
-
pre.prettyprint {
|
|
209
|
-
border: none !important;
|
|
210
|
-
padding: 0 !important;
|
|
211
|
-
margin: 0 !important;
|
|
212
|
-
}
|
|
213
|
-
.com { color: #999 !important; }
|
|
214
|
-
.ignore-none { color: #999; font-weight: normal; }
|
|
215
|
-
|
|
216
|
-
.wrapper {
|
|
217
|
-
min-height: 100%;
|
|
218
|
-
height: auto !important;
|
|
219
|
-
height: 100%;
|
|
220
|
-
margin: 0 auto -48px;
|
|
221
|
-
}
|
|
222
|
-
.footer, .push {
|
|
223
|
-
height: 48px;
|
|
224
|
-
}
|