@contrast/route-coverage 1.8.0 → 1.10.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/lib/index.d.ts +3 -1
- package/lib/index.js +6 -3
- package/lib/install/express.js +1 -1
- package/lib/install/fastify.js +1 -1
- package/lib/install/koa.js +1 -1
- package/lib/utils/route-info.js +1 -1
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright:
|
|
2
|
+
* Copyright: 2023 Contrast Security, Inc
|
|
3
3
|
* Contact: support@contrastsecurity.com
|
|
4
4
|
* License: Commercial
|
|
5
5
|
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import { Installable, Messages, RouteInfo } from '@contrast/common';
|
|
17
|
+
import { Config } from '@contrast/config';
|
|
17
18
|
import { Logger } from '@contrast/logger';
|
|
18
19
|
import { Patcher } from '@contrast/patcher';
|
|
19
20
|
import RequireHook from '@contrast/require-hook';
|
|
@@ -29,6 +30,7 @@ export interface RouteCoverage extends Installable {
|
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
export interface Core {
|
|
33
|
+
readonly config: Config;
|
|
32
34
|
readonly depHooks: RequireHook;
|
|
33
35
|
readonly logger: Logger;
|
|
34
36
|
readonly messages: Messages;
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright:
|
|
2
|
+
* Copyright: 2023 Contrast Security, Inc
|
|
3
3
|
* Contact: support@contrastsecurity.com
|
|
4
4
|
* License: Commercial
|
|
5
5
|
|
|
@@ -24,13 +24,16 @@ const { routeIdentifier } = require('./utils/route-info');
|
|
|
24
24
|
* }} core
|
|
25
25
|
*/
|
|
26
26
|
module.exports = function init(core) {
|
|
27
|
-
const { logger, messages, scopes } = core;
|
|
27
|
+
const { config, logger, messages, scopes } = core;
|
|
28
|
+
|
|
29
|
+
if (!config.agent.route_coverage.enable) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
28
32
|
|
|
29
33
|
/** @type {Map<string, import('@contrast/common').RouteInfo>} */
|
|
30
34
|
const routeInfo = new Map();
|
|
31
35
|
|
|
32
36
|
core.routeCoverage = {
|
|
33
|
-
|
|
34
37
|
discover(info) {
|
|
35
38
|
routeInfo.set(routeIdentifier(info), info);
|
|
36
39
|
messages.emit(Event.ROUTE_COVERAGE_DISCOVERY, info);
|
package/lib/install/express.js
CHANGED
package/lib/install/fastify.js
CHANGED
package/lib/install/koa.js
CHANGED
package/lib/utils/route-info.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/route-coverage",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
|
|
@@ -14,6 +14,6 @@
|
|
|
14
14
|
"test": "../scripts/test.sh"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@contrast/common": "1.
|
|
17
|
+
"@contrast/common": "1.14.0"
|
|
18
18
|
}
|
|
19
19
|
}
|