@contrast/route-coverage 1.9.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 CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2022 Contrast Security, Inc
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: 2022 Contrast Security, Inc
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);
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2022 Contrast Security, Inc
2
+ * Copyright: 2023 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2022 Contrast Security, Inc
2
+ * Copyright: 2023 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2022 Contrast Security, Inc
2
+ * Copyright: 2023 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Copyright: 2022 Contrast Security, Inc
2
+ * Copyright: 2023 Contrast Security, Inc
3
3
  * Contact: support@contrastsecurity.com
4
4
  * License: Commercial
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrast/route-coverage",
3
- "version": "1.9.0",
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.13.0"
17
+ "@contrast/common": "1.14.0"
18
18
  }
19
19
  }