@mitre/hdf-extension-graph 2.0.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/LICENSE.md ADDED
@@ -0,0 +1,55 @@
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.
package/README.md ADDED
@@ -0,0 +1,144 @@
1
+ # @mitre/hdf-extension-graph
2
+
3
+ Bidirectional extension graph processing for HDF baseline hierarchies. Builds a navigable graph from `HdfResults` files that reveals how baselines (profiles) and requirements (controls) relate across extension/overlay layers.
4
+
5
+ Ports the algorithm from Heimdall2's `context.ts` to the HDF v2 schema.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ pnpm add @mitre/hdf-extension-graph
11
+ ```
12
+
13
+ Requires `@mitre/hdf-schema` as a peer dependency.
14
+
15
+ ## Usage
16
+
17
+ ### Build the graph
18
+
19
+ ```typescript
20
+ import { buildExtensionGraph } from '@mitre/hdf-extension-graph';
21
+ import type { HdfResults } from '@mitre/hdf-schema';
22
+
23
+ const hdfResults: HdfResults = JSON.parse(fileContents);
24
+ const graph = buildExtensionGraph(hdfResults);
25
+ ```
26
+
27
+ ### Navigate baselines
28
+
29
+ ```typescript
30
+ // Find root baselines (no parent)
31
+ const roots = graph.rootBaselines;
32
+
33
+ // Find a specific baseline
34
+ const stig = graph.findBaseline('rhel9-stig-baseline');
35
+
36
+ // See what extends it
37
+ for (const overlay of stig.extendedBy) {
38
+ console.log(`${overlay.data.name} extends ${stig.data.name}`);
39
+ }
40
+ ```
41
+
42
+ ### Navigate requirements
43
+
44
+ ```typescript
45
+ // Find all instances of a control across all baselines
46
+ const controls = graph.findRequirements('SV-238196');
47
+
48
+ // Get the root (base) control
49
+ const root = controls[1].root; // walks up the chain
50
+
51
+ // Get the full code with all layers
52
+ console.log(controls[1].fullCode);
53
+ // # my-overlay
54
+ // describe sshd_config do
55
+ // its("ClientAliveInterval") { should cmp <= 300 }
56
+ // end
57
+ //
58
+ // # rhel9-stig-baseline
59
+ // describe sshd_config do
60
+ // its("ClientAliveInterval") { should cmp <= 600 }
61
+ // end
62
+ ```
63
+
64
+ ### Detect changes
65
+
66
+ ```typescript
67
+ const overlay = graph.baselines[1].requirements[0];
68
+
69
+ // Is this overlay just inheriting, or did it change something?
70
+ if (!overlay.isRedundant) {
71
+ console.log('This overlay modifies the base control');
72
+ }
73
+
74
+ // What specifically changed?
75
+ for (const mod of overlay.modifications) {
76
+ console.log(`${mod.field}: ${mod.originalValue} → ${mod.newValue}`);
77
+ }
78
+ // impact: 0.5 → 0.9
79
+ // title: SSH timeout → SSH timeout (project)
80
+ ```
81
+
82
+ ### Walk the chain
83
+
84
+ ```typescript
85
+ // Ordered list of baselines from root to current
86
+ const chain = overlay.extensionChain;
87
+ console.log(chain.map(b => b.data.name));
88
+ // ['disa-rhel7-stig', 'cms-rhel7-overlay', 'project-overlay']
89
+ ```
90
+
91
+ ## API
92
+
93
+ ### `buildExtensionGraph(results: HdfResults): ExtensionGraph`
94
+
95
+ Builds a bidirectional extension graph from an HDF Results file. Links baselines via `parentBaseline` and requirements by matching `id` across linked baselines.
96
+
97
+ ### `ExtensionGraph`
98
+
99
+ | Property / Method | Type | Description |
100
+ |---|---|---|
101
+ | `baselines` | `ContextualizedBaseline[]` | All baselines in the graph |
102
+ | `requirements` | `ContextualizedRequirement[]` | All requirements across all baselines |
103
+ | `rootBaselines` | `ContextualizedBaseline[]` | Baselines with no parent |
104
+ | `findBaseline(name)` | `ContextualizedBaseline \| undefined` | Find baseline by name |
105
+ | `findRequirements(id)` | `ContextualizedRequirement[]` | Find all requirements with given id |
106
+
107
+ ### `ContextualizedBaseline`
108
+
109
+ | Property | Type | Description |
110
+ |---|---|---|
111
+ | `data` | `EvaluatedBaseline` | Original baseline data |
112
+ | `sourcedFrom` | `HdfResults` | The results file this came from |
113
+ | `extendsFrom` | `ContextualizedBaseline[]` | Parent baselines |
114
+ | `extendedBy` | `ContextualizedBaseline[]` | Child baselines |
115
+ | `requirements` | `ContextualizedRequirement[]` | Wrapped requirements |
116
+
117
+ ### `ContextualizedRequirement`
118
+
119
+ | Property | Type | Description |
120
+ |---|---|---|
121
+ | `data` | `EvaluatedRequirement` | Original requirement data |
122
+ | `sourcedFrom` | `ContextualizedBaseline` | Owning baseline |
123
+ | `extendsFrom` | `ContextualizedRequirement[]` | Parent requirements |
124
+ | `extendedBy` | `ContextualizedRequirement[]` | Child requirements |
125
+ | `root` | `ContextualizedRequirement` | Base requirement at bottom of chain |
126
+ | `isRedundant` | `boolean` | True if code is empty or matches root |
127
+ | `fullCode` | `string` | Concatenated code from all layers |
128
+ | `extensionChain` | `ContextualizedBaseline[]` | Baselines from root to leaf |
129
+ | `modifications` | `Modification[]` | Fields changed vs immediate parent |
130
+
131
+ ### `Modification`
132
+
133
+ ```typescript
134
+ interface Modification {
135
+ field: string; // 'impact', 'title', or 'severity'
136
+ originalValue: unknown;
137
+ newValue: unknown;
138
+ inBaseline: string; // Name of the baseline making the change
139
+ }
140
+ ```
141
+
142
+ ## License
143
+
144
+ Apache-2.0
@@ -0,0 +1,81 @@
1
+ import type { HdfResults, EvaluatedBaseline, EvaluatedRequirement } from '@mitre/hdf-schema';
2
+ /** A detected change between an overlay requirement and its parent. */
3
+ export interface Modification {
4
+ field: string;
5
+ originalValue: unknown;
6
+ newValue: unknown;
7
+ inBaseline: string;
8
+ }
9
+ /**
10
+ * Wraps an EvaluatedRequirement with bidirectional extension links
11
+ * and derived properties for navigating extension chains.
12
+ */
13
+ export declare class ContextualizedRequirement {
14
+ /** The original requirement data. */
15
+ readonly data: EvaluatedRequirement;
16
+ /** The baseline this requirement belongs to. */
17
+ readonly sourcedFrom: ContextualizedBaseline;
18
+ /** Requirements in parent baselines that this requirement extends (overlays). */
19
+ readonly extendsFrom: ContextualizedRequirement[];
20
+ /** Requirements in child baselines that extend this requirement. */
21
+ readonly extendedBy: ContextualizedRequirement[];
22
+ constructor(data: EvaluatedRequirement, sourcedFrom: ContextualizedBaseline);
23
+ /** The root (base) requirement at the bottom of the extension chain. */
24
+ get root(): ContextualizedRequirement;
25
+ /** True if this overlay adds no new code (empty/undefined or matches root). */
26
+ get isRedundant(): boolean;
27
+ /**
28
+ * Full code concatenated from all layers, with baseline name headers.
29
+ * Skips redundant overlay layers. Returns empty string if no code exists.
30
+ */
31
+ get fullCode(): string;
32
+ /** Ordered chain of baselines from root to this requirement's baseline. */
33
+ get extensionChain(): ContextualizedBaseline[];
34
+ /** Fields that differ between this requirement and its immediate parent. */
35
+ get modifications(): Modification[];
36
+ }
37
+ /**
38
+ * Wraps an EvaluatedBaseline with bidirectional extension links
39
+ * and contextualized requirements.
40
+ */
41
+ export declare class ContextualizedBaseline {
42
+ /** The original baseline data. */
43
+ readonly data: EvaluatedBaseline;
44
+ /** The HdfResults this baseline was sourced from. */
45
+ readonly sourcedFrom: HdfResults;
46
+ /** Parent baselines that this baseline extends. */
47
+ readonly extendsFrom: ContextualizedBaseline[];
48
+ /** Child baselines that extend this baseline. */
49
+ readonly extendedBy: ContextualizedBaseline[];
50
+ /** Contextualized wrappers for each requirement in this baseline. */
51
+ readonly requirements: ContextualizedRequirement[];
52
+ constructor(data: EvaluatedBaseline, sourcedFrom: HdfResults);
53
+ }
54
+ /**
55
+ * A bidirectional extension graph built from an HDF Results file.
56
+ * Contains all baselines and requirements with their extension relationships.
57
+ */
58
+ export declare class ExtensionGraph {
59
+ /** All contextualized baselines in the graph. */
60
+ readonly baselines: readonly ContextualizedBaseline[];
61
+ /** All contextualized requirements across all baselines. */
62
+ readonly requirements: readonly ContextualizedRequirement[];
63
+ constructor(baselines: readonly ContextualizedBaseline[], requirements: readonly ContextualizedRequirement[]);
64
+ /** Find a baseline by name. Returns undefined if not found. */
65
+ findBaseline(name: string): ContextualizedBaseline | undefined;
66
+ /** Find all requirements with the given id across all baselines. */
67
+ findRequirements(id: string): ContextualizedRequirement[];
68
+ /** Baselines that have no parent (root of extension chains). */
69
+ get rootBaselines(): ContextualizedBaseline[];
70
+ }
71
+ /**
72
+ * Build a bidirectional extension graph from an HDF Results file.
73
+ *
74
+ * Four phases:
75
+ * 1. Wrap each EvaluatedBaseline in a ContextualizedBaseline
76
+ * 2. Link baselines via parentBaseline name matching (bidirectional)
77
+ * 3. Collect all requirements into a flat array
78
+ * 4. Link requirements by id matching across linked baselines
79
+ */
80
+ export declare function buildExtensionGraph(results: HdfResults): ExtensionGraph;
81
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAK7F,uEAAuE;AACvE,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,qBAAa,yBAAyB;IACpC,qCAAqC;IACrC,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;IAEpC,gDAAgD;IAChD,QAAQ,CAAC,WAAW,EAAE,sBAAsB,CAAC;IAE7C,iFAAiF;IACjF,QAAQ,CAAC,WAAW,EAAE,yBAAyB,EAAE,CAAM;IAEvD,oEAAoE;IACpE,QAAQ,CAAC,UAAU,EAAE,yBAAyB,EAAE,CAAM;gBAE1C,IAAI,EAAE,oBAAoB,EAAE,WAAW,EAAE,sBAAsB;IAK3E,wEAAwE;IACxE,IAAI,IAAI,IAAI,yBAAyB,CAMpC;IAED,+EAA+E;IAC/E,IAAI,WAAW,IAAI,OAAO,CASzB;IAED;;;OAGG;IACH,IAAI,QAAQ,IAAI,MAAM,CAcrB;IAED,2EAA2E;IAC3E,IAAI,cAAc,IAAI,sBAAsB,EAAE,CAK7C;IAED,4EAA4E;IAC5E,IAAI,aAAa,IAAI,YAAY,EAAE,CAmBlC;CACF;AAED;;;GAGG;AACH,qBAAa,sBAAsB;IACjC,kCAAkC;IAClC,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IAEjC,qDAAqD;IACrD,QAAQ,CAAC,WAAW,EAAE,UAAU,CAAC;IAEjC,mDAAmD;IACnD,QAAQ,CAAC,WAAW,EAAE,sBAAsB,EAAE,CAAM;IAEpD,iDAAiD;IACjD,QAAQ,CAAC,UAAU,EAAE,sBAAsB,EAAE,CAAM;IAEnD,qEAAqE;IACrE,QAAQ,CAAC,YAAY,EAAE,yBAAyB,EAAE,CAAC;gBAEvC,IAAI,EAAE,iBAAiB,EAAE,WAAW,EAAE,UAAU;CAO7D;AAED;;;GAGG;AACH,qBAAa,cAAc;IACzB,iDAAiD;IACjD,QAAQ,CAAC,SAAS,EAAE,SAAS,sBAAsB,EAAE,CAAC;IAEtD,4DAA4D;IAC5D,QAAQ,CAAC,YAAY,EAAE,SAAS,yBAAyB,EAAE,CAAC;gBAG1D,SAAS,EAAE,SAAS,sBAAsB,EAAE,EAC5C,YAAY,EAAE,SAAS,yBAAyB,EAAE;IAMpD,+DAA+D;IAC/D,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,sBAAsB,GAAG,SAAS;IAI9D,oEAAoE;IACpE,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,yBAAyB,EAAE;IAIzD,gEAAgE;IAChE,IAAI,aAAa,IAAI,sBAAsB,EAAE,CAE5C;CACF;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,UAAU,GAAG,cAAc,CAgDvE"}
package/dist/index.js ADDED
@@ -0,0 +1,171 @@
1
+ /** Fields compared for modification detection between overlay and parent. */
2
+ const TRACKED_FIELDS = ['impact', 'title', 'severity'];
3
+ /**
4
+ * Wraps an EvaluatedRequirement with bidirectional extension links
5
+ * and derived properties for navigating extension chains.
6
+ */
7
+ export class ContextualizedRequirement {
8
+ constructor(data, sourcedFrom) {
9
+ /** Requirements in parent baselines that this requirement extends (overlays). */
10
+ this.extendsFrom = [];
11
+ /** Requirements in child baselines that extend this requirement. */
12
+ this.extendedBy = [];
13
+ this.data = data;
14
+ this.sourcedFrom = sourcedFrom;
15
+ }
16
+ /** The root (base) requirement at the bottom of the extension chain. */
17
+ get root() {
18
+ if (this.extendsFrom.length === 0) {
19
+ return this;
20
+ }
21
+ // Walk to the first parent's root (first match, like Heimdall2)
22
+ return this.extendsFrom[0].root;
23
+ }
24
+ /** True if this overlay adds no new code (empty/undefined or matches root). */
25
+ get isRedundant() {
26
+ if (this.extendsFrom.length === 0) {
27
+ return false;
28
+ }
29
+ const code = this.data.code;
30
+ if (!code) {
31
+ return true;
32
+ }
33
+ return code === this.root.data.code;
34
+ }
35
+ /**
36
+ * Full code concatenated from all layers, with baseline name headers.
37
+ * Skips redundant overlay layers. Returns empty string if no code exists.
38
+ */
39
+ get fullCode() {
40
+ if (this.isRedundant && this.extendsFrom.length > 0) {
41
+ return this.extendsFrom[0].fullCode;
42
+ }
43
+ const code = this.data.code;
44
+ if (!code) {
45
+ return '';
46
+ }
47
+ const header = `# ${this.sourcedFrom.data.name}\n${code}`;
48
+ if (this.extendsFrom.length === 0) {
49
+ return header;
50
+ }
51
+ const parentCode = this.extendsFrom[0].fullCode;
52
+ return parentCode ? `${header}\n\n${parentCode}` : header;
53
+ }
54
+ /** Ordered chain of baselines from root to this requirement's baseline. */
55
+ get extensionChain() {
56
+ if (this.extendsFrom.length === 0) {
57
+ return [this.sourcedFrom];
58
+ }
59
+ return [...this.extendsFrom[0].extensionChain, this.sourcedFrom];
60
+ }
61
+ /** Fields that differ between this requirement and its immediate parent. */
62
+ get modifications() {
63
+ if (this.extendsFrom.length === 0) {
64
+ return [];
65
+ }
66
+ const parent = this.extendsFrom[0];
67
+ const mods = [];
68
+ for (const field of TRACKED_FIELDS) {
69
+ const parentVal = parent.data[field];
70
+ const thisVal = this.data[field];
71
+ if (parentVal !== thisVal) {
72
+ mods.push({
73
+ field,
74
+ originalValue: parentVal,
75
+ newValue: thisVal,
76
+ inBaseline: this.sourcedFrom.data.name,
77
+ });
78
+ }
79
+ }
80
+ return mods;
81
+ }
82
+ }
83
+ /**
84
+ * Wraps an EvaluatedBaseline with bidirectional extension links
85
+ * and contextualized requirements.
86
+ */
87
+ export class ContextualizedBaseline {
88
+ constructor(data, sourcedFrom) {
89
+ /** Parent baselines that this baseline extends. */
90
+ this.extendsFrom = [];
91
+ /** Child baselines that extend this baseline. */
92
+ this.extendedBy = [];
93
+ this.data = data;
94
+ this.sourcedFrom = sourcedFrom;
95
+ this.requirements = data.requirements.map((req) => new ContextualizedRequirement(req, this));
96
+ }
97
+ }
98
+ /**
99
+ * A bidirectional extension graph built from an HDF Results file.
100
+ * Contains all baselines and requirements with their extension relationships.
101
+ */
102
+ export class ExtensionGraph {
103
+ constructor(baselines, requirements) {
104
+ this.baselines = baselines;
105
+ this.requirements = requirements;
106
+ }
107
+ /** Find a baseline by name. Returns undefined if not found. */
108
+ findBaseline(name) {
109
+ return this.baselines.find((b) => b.data.name === name);
110
+ }
111
+ /** Find all requirements with the given id across all baselines. */
112
+ findRequirements(id) {
113
+ return this.requirements.filter((r) => r.data.id === id);
114
+ }
115
+ /** Baselines that have no parent (root of extension chains). */
116
+ get rootBaselines() {
117
+ return this.baselines.filter((b) => !b.data.parentBaseline);
118
+ }
119
+ }
120
+ /**
121
+ * Build a bidirectional extension graph from an HDF Results file.
122
+ *
123
+ * Four phases:
124
+ * 1. Wrap each EvaluatedBaseline in a ContextualizedBaseline
125
+ * 2. Link baselines via parentBaseline name matching (bidirectional)
126
+ * 3. Collect all requirements into a flat array
127
+ * 4. Link requirements by id matching across linked baselines
128
+ */
129
+ export function buildExtensionGraph(results) {
130
+ // Phase 1: Wrap baselines
131
+ const baselineMap = new Map();
132
+ const baselines = [];
133
+ for (const baseline of results.baselines) {
134
+ const ctx = new ContextualizedBaseline(baseline, results);
135
+ baselines.push(ctx);
136
+ baselineMap.set(baseline.name, ctx);
137
+ }
138
+ // Phase 2: Link baselines via parentBaseline
139
+ for (const ctx of baselines) {
140
+ const parentName = ctx.data.parentBaseline;
141
+ if (parentName) {
142
+ const parent = baselineMap.get(parentName);
143
+ if (parent) {
144
+ ctx.extendsFrom.push(parent);
145
+ parent.extendedBy.push(ctx);
146
+ }
147
+ }
148
+ }
149
+ // Phase 3: Collect all requirements
150
+ const allRequirements = [];
151
+ for (const ctx of baselines) {
152
+ allRequirements.push(...ctx.requirements);
153
+ }
154
+ // Phase 4: Link requirements by id across linked baselines
155
+ for (const ctx of baselines) {
156
+ if (ctx.extendsFrom.length === 0) {
157
+ continue;
158
+ }
159
+ for (const childReq of ctx.requirements) {
160
+ for (const parentBaseline of ctx.extendsFrom) {
161
+ const parentReq = parentBaseline.requirements.find((r) => r.data.id === childReq.data.id);
162
+ if (parentReq) {
163
+ childReq.extendsFrom.push(parentReq);
164
+ parentReq.extendedBy.push(childReq);
165
+ }
166
+ }
167
+ }
168
+ }
169
+ return new ExtensionGraph(baselines, allRequirements);
170
+ }
171
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,6EAA6E;AAC7E,MAAM,cAAc,GAAsB,CAAC,QAAQ,EAAE,OAAO,EAAE,UAAU,CAAU,CAAC;AAUnF;;;GAGG;AACH,MAAM,OAAO,yBAAyB;IAapC,YAAY,IAA0B,EAAE,WAAmC;QAN3E,iFAAiF;QACxE,gBAAW,GAAgC,EAAE,CAAC;QAEvD,oEAAoE;QAC3D,eAAU,GAAgC,EAAE,CAAC;QAGpD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;IAED,wEAAwE;IACxE,IAAI,IAAI;QACN,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAClC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,gEAAgE;QAChE,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC,CAAE,CAAC,IAAI,CAAC;IACnC,CAAC;IAED,+E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,0 +1,52 @@
1
+ {
2
+ "name": "@mitre/hdf-extension-graph",
3
+ "version": "2.0.0",
4
+ "description": "Bidirectional extension graph processing for HDF profile/baseline hierarchies",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "type": "module",
9
+ "main": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/index.js",
14
+ "types": "./dist/index.d.ts"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "https://github.com/mitre/hdf-libs.git",
23
+ "directory": "hdf-extension-graph"
24
+ },
25
+ "author": "MITRE Corporation",
26
+ "license": "Apache-2.0",
27
+ "dependencies": {
28
+ "@mitre/hdf-schema": "2.0.0"
29
+ },
30
+ "engines": {
31
+ "node": ">=20.0.0"
32
+ },
33
+ "keywords": [
34
+ "hdf",
35
+ "heimdall",
36
+ "extension",
37
+ "overlay",
38
+ "profile",
39
+ "graph"
40
+ ],
41
+ "scripts": {
42
+ "build": "pnpm clean && tsc",
43
+ "clean": "rimraf dist",
44
+ "test": "pnpm run test:ts",
45
+ "test:ts": "vitest run",
46
+ "test:watch": "vitest",
47
+ "test:coverage": "vitest run --coverage",
48
+ "type-check": "tsc --noEmit",
49
+ "lint": "eslint src test",
50
+ "lint:fix": "eslint src test --fix"
51
+ }
52
+ }