@contrast/config 1.25.0 → 1.26.1

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
@@ -184,10 +184,20 @@ export interface Config {
184
184
  node: {
185
185
  /** Location to look for the app's package.json. Default: `process.cwd()` */
186
186
  app_root: string;
187
- /** Default: `true` */
188
- enable_rewrite: boolean;
189
- /** Default: `true` */
190
- enable_source_maps: boolean;
187
+ rewrite: {
188
+ /** Default: `true` */
189
+ enable: boolean;
190
+ cache: {
191
+ /** Default: `true` */
192
+ enable: boolean;
193
+ /** Default: `./.contrast` */
194
+ path: string;
195
+ }
196
+ };
197
+ source_maps: {
198
+ /** Default: `true` */
199
+ enable: boolean;
200
+ };
191
201
  library_usage: {
192
202
  reporting: {
193
203
  /** Default: `true` */
@@ -296,10 +306,6 @@ export interface Config {
296
306
  setValue(name: string, value: any, source: ConfigSource): void;
297
307
  }
298
308
 
299
- interface Core {
300
- config: Config;
301
- }
302
-
303
- declare function init(core: Core): Config;
309
+ declare function init(core: { config?: Config }): Config;
304
310
 
305
311
  export = init;
package/lib/options.js CHANGED
@@ -77,7 +77,7 @@ const parseNum = (val) => {
77
77
  * The module currently houses all new common config settings.
78
78
  *
79
79
  * Other settings include:
80
- * - fn: a function to run on the original value (eg type coercion or sanitizing). returns undefined if it can't do anything with the value it is given.
80
+ * - fn: a function to run on the original value (eg type coercion or sanitizing). Returns undefined if it can't do anything with the value it is given.
81
81
  * - enum: validation of whether type matches enumerated value
82
82
  *
83
83
  * NOTE: I'm not sure if validation should also be specified and handled here.
@@ -411,7 +411,7 @@ Example - \`/opt/Contrast/contrast.log\` creates a log in the \`/opt/Contrast\`
411
411
  name: 'agent.node.cmd_ignore_list',
412
412
  arg: '<commands>',
413
413
  default: '',
414
- fn: (arg) => arg.split(',').filter((v)=> v),
414
+ fn: (arg) => arg.split(',').filter((v) => v),
415
415
  desc: 'comma-separated list of commands that will not startup the agent if agent is required; npm* will ignore all npm executables but not your application\'s scripts'
416
416
  },
417
417
  {
@@ -422,7 +422,7 @@ Example - \`/opt/Contrast/contrast.log\` creates a log in the \`/opt/Contrast\`
422
422
  },
423
423
  {
424
424
  // NOTE: not in common config.
425
- name: 'agent.node.enable_rewrite',
425
+ name: 'agent.node.rewrite.enable',
426
426
  arg: '[false]',
427
427
  default: true,
428
428
  fn: castBoolean,
@@ -430,11 +430,28 @@ Example - \`/opt/Contrast/contrast.log\` creates a log in the \`/opt/Contrast\`
430
430
  },
431
431
  {
432
432
  // NOTE: not in common config.
433
- name: 'agent.node.enable_source_maps',
433
+ name: 'agent.node.rewrite.cache.enable',
434
434
  arg: '[false]',
435
435
  default: true,
436
436
  fn: castBoolean,
437
- desc: 'Set to `true` to enable source map support in reporting.',
437
+ desc: 'Set to `false` to disable caching rewritten source code files.',
438
+ },
439
+ {
440
+ // NOTE: not in common config.
441
+ name: 'agent.node.rewrite.cache.path',
442
+ arg: '<path>',
443
+ default: '.contrast',
444
+ fn: toAbsolutePath,
445
+ desc: "Set the directory in which to cache rewritten source code files. Defaults to `.contrast/` in the application's current working directory.",
446
+ },
447
+ {
448
+ // NOTE: not in common config.
449
+ name: 'agent.node.source_maps.enable',
450
+ arg: '[false]',
451
+ default: true,
452
+ fn: castBoolean,
453
+ // TODO: update description once we support handling and chaining source maps.
454
+ desc: 'Set to `false` to disable source map generation.',
438
455
  },
439
456
  // agent.node.library_usage.reporting
440
457
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrast/config",
3
- "version": "1.25.0",
3
+ "version": "1.26.1",
4
4
  "description": "An API for discovering Contrast agent configuration data",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
@@ -17,7 +17,7 @@
17
17
  "test": "../scripts/test.sh"
18
18
  },
19
19
  "dependencies": {
20
- "@contrast/common": "1.18.0",
20
+ "@contrast/common": "1.19.0",
21
21
  "yaml": "^2.2.2"
22
22
  }
23
23
  }