@contrast/config 1.26.0 → 1.26.2

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.
@@ -89,6 +89,13 @@ const parseNum = (val) => {
89
89
  * @type {import('.').ConfigOption[]}
90
90
  */
91
91
  const options = [
92
+ {
93
+ name: 'enable',
94
+ arg: '[true]',
95
+ default: true,
96
+ fn: castBoolean,
97
+ desc: 'Set to `false` to disable Contrast agent.',
98
+ },
92
99
  // api
93
100
  {
94
101
  name: 'api.enable',
@@ -411,7 +418,7 @@ Example - \`/opt/Contrast/contrast.log\` creates a log in the \`/opt/Contrast\`
411
418
  name: 'agent.node.cmd_ignore_list',
412
419
  arg: '<commands>',
413
420
  default: '',
414
- fn: (arg) => arg.split(',').filter((v)=> v),
421
+ fn: (arg) => arg.split(',').filter((v) => v),
415
422
  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
423
  },
417
424
  {
@@ -422,7 +429,7 @@ Example - \`/opt/Contrast/contrast.log\` creates a log in the \`/opt/Contrast\`
422
429
  },
423
430
  {
424
431
  // NOTE: not in common config.
425
- name: 'agent.node.enable_rewrite',
432
+ name: 'agent.node.rewrite.enable',
426
433
  arg: '[false]',
427
434
  default: true,
428
435
  fn: castBoolean,
@@ -430,11 +437,28 @@ Example - \`/opt/Contrast/contrast.log\` creates a log in the \`/opt/Contrast\`
430
437
  },
431
438
  {
432
439
  // NOTE: not in common config.
433
- name: 'agent.node.enable_source_maps',
440
+ name: 'agent.node.rewrite.cache.enable',
441
+ arg: '[false]',
442
+ default: true,
443
+ fn: castBoolean,
444
+ desc: 'Set to `false` to disable caching rewritten source code files.',
445
+ },
446
+ {
447
+ // NOTE: not in common config.
448
+ name: 'agent.node.rewrite.cache.path',
449
+ arg: '<path>',
450
+ default: '.contrast',
451
+ fn: toAbsolutePath,
452
+ desc: "Set the directory in which to cache rewritten source code files. Defaults to `.contrast/` in the application's current working directory.",
453
+ },
454
+ {
455
+ // NOTE: not in common config.
456
+ name: 'agent.node.source_maps.enable',
434
457
  arg: '[false]',
435
458
  default: true,
436
459
  fn: castBoolean,
437
- desc: 'Set to `true` to enable source map support in reporting.',
460
+ // TODO: update description once we support handling and chaining source maps.
461
+ desc: 'Set to `false` to disable source map generation.',
438
462
  },
439
463
  // agent.node.library_usage.reporting
440
464
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrast/config",
3
- "version": "1.26.0",
3
+ "version": "1.26.2",
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)",