@mitre/hdf-utilities 2.0.0 → 3.0.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/dist/index.d.ts CHANGED
@@ -8,4 +8,5 @@ export { parseXml, buildXml, isValidXml, parseXmlWithArrays, extractTextFromXml,
8
8
  export { parseCsv, parseCsvArray, buildCsv, buildCsvArray, isValidCsv, sanitizeCsvValue, sanitizeCsvArray, sanitizeCsvObject, extractCsvColumn, findCsvRows, type CsvParseOptions, type CsvBuildOptions, } from './csv/index.js';
9
9
  export { findValuesByKey, extractColumn, findRows } from './object/index.js';
10
10
  export { stripHtml, parseTimestamp } from './string/index.js';
11
+ export { severityToImpact, impactToSeverity } from './severity/index.js';
11
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAG/G,OAAO,EACL,YAAY,EACZ,MAAM,EACN,MAAM,EACN,UAAU,EACV,UAAU,EACV,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,WAAW,GACjB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,GACd,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,KAAK,eAAe,EACpB,KAAK,eAAe,GACrB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7E,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAG/G,OAAO,EACL,YAAY,EACZ,MAAM,EACN,MAAM,EACN,UAAU,EACV,UAAU,EACV,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,WAAW,GACjB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,GACd,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,KAAK,eAAe,EACpB,KAAK,eAAe,GACrB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7E,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAG9D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -14,4 +14,6 @@ export { parseCsv, parseCsvArray, buildCsv, buildCsvArray, isValidCsv, sanitizeC
14
14
  export { findValuesByKey, extractColumn, findRows } from './object/index.js';
15
15
  // String utilities
16
16
  export { stripHtml, parseTimestamp } from './string/index.js';
17
+ // Severity/impact mapping
18
+ export { severityToImpact, impactToSeverity } from './severity/index.js';
17
19
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,iBAAiB;AACjB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAyB,MAAM,iBAAiB,CAAC;AAE/G,iBAAiB;AACjB,OAAO,EACL,YAAY,EACZ,MAAM,EACN,MAAM,EACN,UAAU,EACV,UAAU,GAIX,MAAM,iBAAiB,CAAC;AAEzB,gBAAgB;AAChB,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,GACd,MAAM,gBAAgB,CAAC;AAExB,gBAAgB;AAChB,OAAO,EACL,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,GAGZ,MAAM,gBAAgB,CAAC;AAExB,uCAAuC;AACvC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7E,mBAAmB;AACnB,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,iBAAiB;AACjB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAyB,MAAM,iBAAiB,CAAC;AAE/G,iBAAiB;AACjB,OAAO,EACL,YAAY,EACZ,MAAM,EACN,MAAM,EACN,UAAU,EACV,UAAU,GAIX,MAAM,iBAAiB,CAAC;AAEzB,gBAAgB;AAChB,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,GACd,MAAM,gBAAgB,CAAC;AAExB,gBAAgB;AAChB,OAAO,EACL,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,GAGZ,MAAM,gBAAgB,CAAC;AAExB,uCAAuC;AACvC,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7E,mBAAmB;AACnB,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE9D,0BAA0B;AAC1B,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Severity-to-impact mapping utilities.
3
+ *
4
+ * These define the canonical bidirectional mapping between severity labels
5
+ * (critical, high, medium, low, informational) and HDF impact scores (0.0–1.0),
6
+ * aligned with CVSS 3.x severity bands normalized to 0–1.
7
+ *
8
+ * Threshold ranges (used by impactToSeverity):
9
+ * >=0.9 = critical (CVSS 9.0–10.0)
10
+ * [0.7, 0.9) = high (CVSS 7.0–8.9)
11
+ * [0.4, 0.7) = medium (CVSS 4.0–6.9)
12
+ * (0.0, 0.4) = low (CVSS 0.1–3.9)
13
+ * 0.0 = informational (CVSS 0.0)
14
+ */
15
+ /**
16
+ * Map a severity string to an impact score.
17
+ *
18
+ * @param severity - Severity level (case-insensitive)
19
+ * @returns Impact score between 0.0 and 1.0; defaults to 0.5 for unrecognized values
20
+ */
21
+ export declare function severityToImpact(severity: string): number;
22
+ /**
23
+ * Map an impact score to a severity string.
24
+ *
25
+ * @param impact - Impact score (0.0 to 1.0)
26
+ * @returns Severity level string
27
+ */
28
+ export declare function impactToSeverity(impact: number): string;
29
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/severity/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAaH;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAGzD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMvD"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Severity-to-impact mapping utilities.
3
+ *
4
+ * These define the canonical bidirectional mapping between severity labels
5
+ * (critical, high, medium, low, informational) and HDF impact scores (0.0–1.0),
6
+ * aligned with CVSS 3.x severity bands normalized to 0–1.
7
+ *
8
+ * Threshold ranges (used by impactToSeverity):
9
+ * >=0.9 = critical (CVSS 9.0–10.0)
10
+ * [0.7, 0.9) = high (CVSS 7.0–8.9)
11
+ * [0.4, 0.7) = medium (CVSS 4.0–6.9)
12
+ * (0.0, 0.4) = low (CVSS 0.1–3.9)
13
+ * 0.0 = informational (CVSS 0.0)
14
+ */
15
+ const severityMap = {
16
+ critical: 0.9,
17
+ high: 0.7,
18
+ medium: 0.5,
19
+ low: 0.3,
20
+ info: 0.0,
21
+ none: 0.0,
22
+ informational: 0.0,
23
+ information: 0.0,
24
+ };
25
+ /**
26
+ * Map a severity string to an impact score.
27
+ *
28
+ * @param severity - Severity level (case-insensitive)
29
+ * @returns Impact score between 0.0 and 1.0; defaults to 0.5 for unrecognized values
30
+ */
31
+ export function severityToImpact(severity) {
32
+ const normalized = severity.toLowerCase();
33
+ return severityMap[normalized] ?? 0.5;
34
+ }
35
+ /**
36
+ * Map an impact score to a severity string.
37
+ *
38
+ * @param impact - Impact score (0.0 to 1.0)
39
+ * @returns Severity level string
40
+ */
41
+ export function impactToSeverity(impact) {
42
+ if (impact >= 0.9)
43
+ return 'critical';
44
+ if (impact >= 0.7)
45
+ return 'high';
46
+ if (impact >= 0.4)
47
+ return 'medium';
48
+ if (impact > 0.0)
49
+ return 'low';
50
+ return 'informational';
51
+ }
52
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/severity/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,GAA2B;IAC1C,QAAQ,EAAE,GAAG;IACb,IAAI,EAAE,GAAG;IACT,MAAM,EAAE,GAAG;IACX,GAAG,EAAE,GAAG;IACR,IAAI,EAAE,GAAG;IACT,IAAI,EAAE,GAAG;IACT,aAAa,EAAE,GAAG;IAClB,WAAW,EAAE,GAAG;CACjB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAC/C,MAAM,UAAU,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;IAC1C,OAAO,WAAW,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC;AACxC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,IAAI,MAAM,IAAI,GAAG;QAAE,OAAO,UAAU,CAAC;IACrC,IAAI,MAAM,IAAI,GAAG;QAAE,OAAO,MAAM,CAAC;IACjC,IAAI,MAAM,IAAI,GAAG;QAAE,OAAO,QAAQ,CAAC;IACnC,IAAI,MAAM,GAAG,GAAG;QAAE,OAAO,KAAK,CAAC;IAC/B,OAAO,eAAe,CAAC;AACzB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mitre/hdf-utilities",
3
- "version": "2.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "Utility functions for HDF libraries (JSON parsing, validation helpers)",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -41,6 +41,18 @@
41
41
  "files": [
42
42
  "dist"
43
43
  ],
44
+ "scripts": {
45
+ "build": "pnpm clean && tsc",
46
+ "clean": "rimraf dist",
47
+ "test": "pnpm run test:ts",
48
+ "test:ts": "vitest run",
49
+ "test:go": "echo 'No Go tests in hdf-utilities'",
50
+ "test:watch": "vitest",
51
+ "test:coverage": "vitest run --coverage",
52
+ "type-check": "tsc --noEmit",
53
+ "lint": "eslint src test",
54
+ "lint:fix": "eslint src test --fix"
55
+ },
44
56
  "repository": {
45
57
  "type": "git",
46
58
  "url": "https://github.com/mitre/hdf-libs.git",
@@ -66,17 +78,5 @@
66
78
  "@stryker-mutator/core": "^9.5.1",
67
79
  "@stryker-mutator/vitest-runner": "^9.5.1",
68
80
  "@types/d3-dsv": "^3.0.7"
69
- },
70
- "scripts": {
71
- "build": "pnpm clean && tsc",
72
- "clean": "rimraf dist",
73
- "test": "pnpm run test:ts",
74
- "test:ts": "vitest run",
75
- "test:go": "echo 'No Go tests in hdf-utilities'",
76
- "test:watch": "vitest",
77
- "test:coverage": "vitest run --coverage",
78
- "type-check": "tsc --noEmit",
79
- "lint": "eslint src test",
80
- "lint:fix": "eslint src test --fix"
81
81
  }
82
- }
82
+ }
package/LICENSE.md DELETED
@@ -1,55 +0,0 @@
1
- # License
2
-
3
- Copyright © 2025 The MITRE Corporation.
4
-
5
- Approved for Public Release; Distribution Unlimited. Case Number 18-3678.
6
-
7
- Licensed under the Apache License, Version 2.0 (the "License"); you may
8
- not use this file except in compliance with the License. You may obtain a
9
- copy of the License at
10
-
11
- http://www.apache.org/licenses/LICENSE-2.0
12
-
13
- Unless required by applicable law or agreed to in writing, software
14
- distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
- WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
- License for the specific language governing permissions and limitations
17
- under the License.
18
-
19
- ## Redistribution Terms
20
-
21
- Redistribution and use in source and binary forms, with or without
22
- modification, are permitted provided that the following conditions are
23
- met:
24
-
25
- - Redistributions of source code must retain the above copyright/digital
26
- rights legend, this list of conditions and the following Notice.
27
- - Redistributions in binary form must reproduce the above
28
- copyright/digital rights legend, this list of conditions and the
29
- following Notice in the documentation and/or other materials provided
30
- with the distribution.
31
- - Neither the name of The MITRE Corporation nor the names of its contributors
32
- may be used to endorse or promote products derived from this software
33
- without specific prior written permission.
34
-
35
- ## Notice
36
-
37
- The MITRE Corporation grants permission to reproduce, distribute, modify, and
38
- otherwise use this software to the extent permitted by the licensed terms
39
- provided in the LICENSE file included with this project.
40
-
41
- This software was produced by The MITRE Corporation for the U.S. Government
42
- under contract. As such the U.S. Government has certain use and data
43
- rights in this software. No use other than those granted to the U.S.
44
- Government, or to those acting on behalf of the U.S. Government, under
45
- these contract arrangements is authorized without the express written
46
- permission of The MITRE Corporation.
47
-
48
- Some files in this codebase were generated by generative AI, under the
49
- direction and review of The MITRE Corporation employees, for the purpose of
50
- development efficiency. All AI-generated code functionality was validated
51
- by standard quality and assurance testing.
52
-
53
- For further information, please contact The MITRE Corporation,
54
- Contracts Management Office, 7515 Colshire Drive, McLean, VA 22102-7539,
55
- (703) 983-6000.