@mitre/hdf-extension-graph 3.1.0 → 3.2.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;;UAMiB,YAAA;EACf,KAAA;EACA,aAAA;EACA,QAAA;EACA,UAAA;AAAA;;;;;cAOW,yBAAA;EAAA;EAAA,SAEF,IAAA,EAAM,oBAAA;;WAGN,WAAA,EAAa,sBAAA;EAAA;EAAA,SAGb,WAAA,EAAa,yBAAA;EAGD;EAAA,SAAZ,UAAA,EAAY,yBAAA;cAET,IAAA,EAAM,oBAAA,EAAsB,WAAA,EAAa,sBAAA;EAMzC;EAAA,IAAR,IAAA,CAAA,GAAQ,yBAAA;EAiDS;EAAA,IAxCjB,WAAA,CAAA;EAwC6B;;;;EAAA,IAzB7B,QAAA,CAAA;EAnCK;EAAA,IAoDL,cAAA,CAAA,GAAkB,sBAAA;EAjDb;EAAA,IAyDL,aAAA,CAAA,GAAiB,YAAA;AAAA;;;;;cA0BV,sBAAA;EA3EC;EAAA,SA6EH,IAAA,EAAM,iBAAA;EArDX;EAAA,SAwDK,WAAA,EAAa,UAAA;EAvCA;EAAA,SA0Cb,WAAA,EAAa,sBAAA;EAlCD;EAAA,SAqCZ,UAAA,EAAY,sBAAA;EArCY;EAAA,SAwCxB,YAAA,EAAc,yBAAA;cAEX,IAAA,EAAM,iBAAA,EAAmB,WAAA,EAAa,UAAA;AAAA;;;;;cAavC,cAAA;EAbO;EAAA,SAeT,SAAA,WAAoB,sBAAA;EAf+B;EAAA,SAkBnD,YAAA,WAAuB,yBAAA;cAG9B,SAAA,WAAoB,sBAAA,IACpB,YAAA,WAAuB,yBAAA;EApCV;EA2Cf,YAAA,CAAa,IAAA,WAAe,sBAAA;EAxCN;EA6CtB,gBAAA,CAAiB,EAAA,WAAa,yBAAA;EA1CR;EAAA,IA+ClB,aAAA,CAAA,G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mBAAA,CAAoB,OAAA,EAAS,UAAA,GAAa,cAAc"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { HdfResults, EvaluatedBaseline, EvaluatedRequirement } from '@mitre/hdf-schema';\n\n/** Fields compared for modification detection between overlay and parent. */\nconst TRACKED_FIELDS: readonly (string & keyof EvaluatedRequirement)[] = ['impact', 'title', 'severity', 'effectiveImpact', 'disposition'];\n\n/** A detected change between an overlay requirement and its parent. */\nexport interface Modification {\n field: string;\n originalValue: unknown;\n newValue: unknown;\n inBaseline: string;\n}\n\n/**\n * Wraps an EvaluatedRequirement with bidirectional extension links\n * and derived properties for navigating extension chains.\n */\nexport class ContextualizedRequirement {\n /** The original requirement data. */\n readonly data: EvaluatedRequirement;\n\n /** The baseline this requirement belongs to. */\n readonly sourcedFrom: ContextualizedBaseline;\n\n /** Requirements in parent baselines that this requirement extends (overlays). */\n readonly extendsFrom: ContextualizedRequirement[] = [];\n\n /** Requirements in child baselines that extend this requirement. */\n readonly extendedBy: ContextualizedRequirement[] = [];\n\n constructor(data: EvaluatedRequirement, sourcedFrom: ContextualizedBaseline) {\n this.data = data;\n this.sourcedFrom = sourcedFrom;\n }\n\n /** The root (base) requirement at the bottom of the extension chain. */\n get root(): ContextualizedRequirement {\n if (this.extendsFrom.length === 0) {\n return this;\n }\n // Walk to the first parent's root (first match, like Heimdall2)\n return this.extendsFrom[0]!.root;\n }\n\n /** True if this overlay adds no new code (empty/undefined or matches root). */\n get isRedundant(): boolean {\n if (this.extendsFrom.length === 0) {\n return false;\n }\n const code = this.data.code;\n if (!code) {\n return true;\n }\n return code === this.root.data.code;\n }\n\n /**\n * Full code concatenated from all layers, with baseline name headers.\n * Skips redundant overlay layers. Returns empty string if no code exists.\n */\n get fullCode(): string {\n if (this.isRedundant && this.extendsFrom.length > 0) {\n return this.extendsFrom[0]!.fullCode;\n }\n const code = this.data.code;\n if (!code) {\n return '';\n }\n const header = `# ${this.sourcedFrom.data.name}\\n${code}`;\n if (this.extendsFrom.length === 0) {\n return header;\n }\n const parentCode = this.extendsFrom[0]!.fullCode;\n return parentCode ? `${header}\\n\\n${parentCode}` : header;\n }\n\n /** Ordered chain of baselines from root to this requirement's baseline. */\n get extensionChain(): ContextualizedBaseline[] {\n if (this.extendsFrom.length === 0) {\n return [this.sourcedFrom];\n }\n return [...this.extendsFrom[0]!.extensionChain, this.sourcedFrom];\n }\n\n /** Fields that differ between this requirement and its immediate parent. */\n get modifications(): Modification[] {\n if (this.extendsFrom.length === 0) {\n return [];\n }\n const parent = this.extendsFrom[0]!;\n const mods: Modification[] = [];\n for (const field of TRACKED_FIELDS) {\n const parentVal = (parent.data as Record<string, unknown>)[field];\n const thisVal = (this.data as Record<string, unknown>)[field];\n if (parentVal !== thisVal) {\n mods.push({\n field,\n originalValue: parentVal,\n newValue: thisVal,\n inBaseline: this.sourcedFrom.data.name,\n });\n }\n }\n return mods;\n }\n}\n\n/**\n * Wraps an EvaluatedBaseline with bidirectional extension links\n * and contextualized requirements.\n */\nexport class ContextualizedBaseline {\n /** The original baseline data. */\n readonly data: EvaluatedBaseline;\n\n /** The HdfResults this baseline was sourced from. */\n readonly sourcedFrom: HdfResults;\n\n /** Parent baselines that this baseline extends. */\n readonly extendsFrom: ContextualizedBaseline[] = [];\n\n /** Child baselines that extend this baseline. */\n readonly extendedBy: ContextualizedBaseline[] = [];\n\n /** Contextualized wrappers for each requirement in this baseline. */\n readonly requirements: ContextualizedRequirement[];\n\n constructor(data: EvaluatedBaseline, sourcedFrom: HdfResults) {\n this.data = data;\n this.sourcedFrom = sourcedFrom;\n this.requirements = data.requirements.map(\n (req) => new ContextualizedRequirement(req, this)\n );\n }\n}\n\n/**\n * A bidirectional extension graph built from an HDF Results file.\n * Contains all baselines and requirements with their extension relationships.\n */\nexport class ExtensionGraph {\n /** All contextualized baselines in the graph. */\n readonly baselines: readonly ContextualizedBaseline[];\n\n /** All contextualized requirements across all baselines. */\n readonly requirements: readonly ContextualizedRequirement[];\n\n constructor(\n baselines: readonly ContextualizedBaseline[],\n requirements: readonly ContextualizedRequirement[]\n ) {\n this.baselines = baselines;\n this.requirements = requirements;\n }\n\n /** Find a baseline by name. Returns undefined if not found. */\n findBaseline(name: string): ContextualizedBaseline | undefined {\n return this.baselines.find((b) => b.data.name === name);\n }\n\n /** Find all requirements with the given id across all baselines. */\n findRequirements(id: string): ContextualizedRequirement[] {\n return this.requirements.filter((r) => r.data.id === id);\n }\n\n /** Baselines that have no parent (root of extension chains). */\n get rootBaselines(): ContextualizedBaseline[] {\n return this.baselines.filter((b) => !b.data.parentBaseline);\n }\n}\n\n/**\n * Build a bidirectional extension graph from an HDF Results file.\n *\n * Four phases:\n * 1. Wrap each EvaluatedBaseline in a ContextualizedBaseline\n * 2. Link baselines via parentBaseline name matching (bidirectional)\n * 3. Collect all requirements into a flat array\n * 4. Link requirements by id matching across linked baselines\n */\nexport function buildExtensionGraph(results: HdfResults): ExtensionGraph {\n // Phase 1: Wrap baselines\n const baselineMap = new Map<string, ContextualizedBaseline>();\n const baselines: ContextualizedBaseline[] = [];\n\n for (const baseline of results.baselines) {\n const ctx = new ContextualizedBaseline(baseline, results);\n baselines.push(ctx);\n baselineMap.set(baseline.name, ctx);\n }\n\n // Phase 2: Link baselines via parentBaseline\n for (const ctx of baselines) {\n const parentName = ctx.data.parentBaseline;\n if (parentName) {\n const parent = baselineMap.get(parentName);\n if (parent) {\n ctx.extendsFrom.push(parent);\n parent.extendedBy.push(ctx);\n }\n }\n }\n\n // Phase 3: Collect all requirements\n const allRequirements: ContextualizedRequirement[] = [];\n for (const ctx of baselines) {\n allRequirements.push(...ctx.requirements);\n }\n\n // Phase 4: Link requirements by id across linked baselines\n for (const ctx of baselines) {\n if (ctx.extendsFrom.length === 0) {\n continue;\n }\n for (const childReq of ctx.requirements) {\n for (const parentBaseline of ctx.extendsFrom) {\n const parentReq = parentBaseline.requirements.find(\n (r) => r.data.id === childReq.data.id\n );\n if (parentReq) {\n childReq.extendsFrom.push(parentReq);\n parentReq.extendedBy.push(childReq);\n }\n }\n }\n }\n\n return new ExtensionGraph(baselines, allRequirements);\n}\n"],"mappings":";;AAGA,MAAM,iBAAmE;CAAC;CAAU;CAAS;CAAY;CAAmB;CAAc;;;;;AAc1I,IAAa,4BAAb,MAAuC;CAarC,YAAY,MAA4B,aAAqC;qBALzB,EAAE;oBAGH,EAAE;AAGnD,OAAK,OAAO;AACZ,OAAK,cAAc;;;CAIrB,IAAI,OAAkC;AACpC,MAAI,KAAK,YAAY,WAAW,EAC9B,QAAO;AAGT,SAAO,KAAK,YAAY,GAAI;;;CAI9B,IAAI,cAAuB;AACzB,MAAI,KAAK,YAAY,WAAW,EAC9B,QAAO;EAET,MAAM,OAAO,KAAK,KAAK;AACvB,MAAI,CAAC,KACH,QAAO;AAET,SAAO,SAAS,KAAK,KAAK,KAAK;;;;;;CAOjC,IAAI,WAAmB;AACrB,MAAI,KAAK,eAAe,KAAK,YAAY,SAAS,EAChD,QAAO,KAAK,YAAY,GAAI;EAE9B,MAAM,OAAO,KAAK,KAAK;AACvB,MAAI,CAAC,KACH,QAAO;EAET,MAAM,SAAS,KAAK,KAAK,YAAY,KAAK,KAAK,IAAI;AACnD,MAAI,KAAK,YAAY,WAAW,EAC9B,QAAO;EAET,MAAM,aAAa,KAAK,YAAY,GAAI;AACxC,SAAO,aAAa,GAAG,OAAO,MAAM,eAAe;;;CAIrD,IAAI,iBAA2C;AAC7C,MAAI,KAAK,YAAY,WAAW,EAC9B,QAAO,CAAC,KAAK,YAAY;AAE3B,SAAO,CAAC,GAAG,KAAK,YAAY,GAAI,gBAAgB,KAAK,YAAY;;;CAInE,IAAI,gBAAgC;AAClC,MAAI,KAAK,YAAY,WAAW,EAC9B,QAAO,EAAE;EAEX,MAAM,SAAS,KAAK,YAAY;EAChC,MAAM,OAAuB,EAAE;AAC/B,OAAK,MAAM,SAAS,gBAAgB;GAClC,MAAM,YAAa,OAAO,KAA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I,aAAa;AAI3C,MAAK,MAAM,OAAO,WAAW;AAC3B,MAAI,IAAI,YAAY,WAAW,EAC7B;AAEF,OAAK,MAAM,YAAY,IAAI,aACzB,MAAK,MAAM,kBAAkB,IAAI,aAAa;GAC5C,MAAM,YAAY,eAAe,aAAa,MAC3C,MAAM,EAAE,KAAK,OAAO,SAAS,KAAK,GACpC;AACD,OAAI,WAAW;AACb,aAAS,YAAY,KAAK,UAAU;AACpC,cAAU,WAAW,KAAK,SAAS;;;;AAM3C,QAAO,IAAI,eAAe,WAAW,gBAAgB"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { HdfResults, EvaluatedBaseline, EvaluatedRequirement } from '@mitre/hdf-schema';\n\n/** Fields compared for modification detection between overlay and parent. */\nconst TRACKED_FIELDS: readonly (string & keyof EvaluatedRequirement)[] = ['impact', 'title', 'severity', 'effectiveImpact', 'disposition'];\n\n/** A detected change between an overlay requirement and its parent. */\nexport interface Modification {\n field: string;\n originalValue: unknown;\n newValue: unknown;\n inBaseline: string;\n}\n\n/**\n * Wraps an EvaluatedRequirement with bidirectional extension links\n * and derived properties for navigating extension chains.\n */\nexport class ContextualizedRequirement {\n /** The original requirement data. */\n readonly data: EvaluatedRequirement;\n\n /** The baseline this requirement belongs to. */\n readonly sourcedFrom: ContextualizedBaseline;\n\n /** Requirements in parent baselines that this requirement extends (overlays). */\n readonly extendsFrom: ContextualizedRequirement[] = [];\n\n /** Requirements in child baselines that extend this requirement. */\n readonly extendedBy: ContextualizedRequirement[] = [];\n\n constructor(data: EvaluatedRequirement, sourcedFrom: ContextualizedBaseline) {\n this.data = data;\n this.sourcedFrom = sourcedFrom;\n }\n\n /** The root (base) requirement at the bottom of the extension chain. */\n get root(): ContextualizedRequirement {\n if (this.extendsFrom.length === 0) {\n return this;\n }\n // Walk to the first parent's root (first match, like Heimdall2)\n return this.extendsFrom[0]!.root;\n }\n\n /** True if this overlay adds no new code (empty/undefined or matches root). */\n get isRedundant(): boolean {\n if (this.extendsFrom.length === 0) {\n return false;\n }\n const code = this.data.code;\n if (!code) {\n return true;\n }\n return code === this.root.data.code;\n }\n\n /**\n * Full code concatenated from all layers, with baseline name headers.\n * Skips redundant overlay layers. Returns empty string if no code exists.\n */\n get fullCode(): string {\n if (this.isRedundant && this.extendsFrom.length > 0) {\n return this.extendsFrom[0]!.fullCode;\n }\n const code = this.data.code;\n if (!code) {\n return '';\n }\n const header = `# ${this.sourcedFrom.data.name}\\n${code}`;\n if (this.extendsFrom.length === 0) {\n return header;\n }\n const parentCode = this.extendsFrom[0]!.fullCode;\n return parentCode ? `${header}\\n\\n${parentCode}` : header;\n }\n\n /** Ordered chain of baselines from root to this requirement's baseline. */\n get extensionChain(): ContextualizedBaseline[] {\n if (this.extendsFrom.length === 0) {\n return [this.sourcedFrom];\n }\n return [...this.extendsFrom[0]!.extensionChain, this.sourcedFrom];\n }\n\n /** Fields that differ between this requirement and its immediate parent. */\n get modifications(): Modification[] {\n if (this.extendsFrom.length === 0) {\n return [];\n }\n const parent = this.extendsFrom[0]!;\n const mods: Modification[] = [];\n for (const field of TRACKED_FIELDS) {\n const parentVal = (parent.data as Record<string, unknown>)[field];\n const thisVal = (this.data as Record<string, unknown>)[field];\n if (parentVal !== thisVal) {\n mods.push({\n field,\n originalValue: parentVal,\n newValue: thisVal,\n inBaseline: this.sourcedFrom.data.name,\n });\n }\n }\n return mods;\n }\n}\n\n/**\n * Wraps an EvaluatedBaseline with bidirectional extension links\n * and contextualized requirements.\n */\nexport class ContextualizedBaseline {\n /** The original baseline data. */\n readonly data: EvaluatedBaseline;\n\n /** The HdfResults this baseline was sourced from. */\n readonly sourcedFrom: HdfResults;\n\n /** Parent baselines that this baseline extends. */\n readonly extendsFrom: ContextualizedBaseline[] = [];\n\n /** Child baselines that extend this baseline. */\n readonly extendedBy: ContextualizedBaseline[] = [];\n\n /** Contextualized wrappers for each requirement in this baseline. */\n readonly requirements: ContextualizedRequirement[];\n\n constructor(data: EvaluatedBaseline, sourcedFrom: HdfResults) {\n this.data = data;\n this.sourcedFrom = sourcedFrom;\n this.requirements = data.requirements.map(\n (req) => new ContextualizedRequirement(req, this)\n );\n }\n}\n\n/**\n * A bidirectional extension graph built from an HDF Results file.\n * Contains all baselines and requirements with their extension relationships.\n */\nexport class ExtensionGraph {\n /** All contextualized baselines in the graph. */\n readonly baselines: readonly ContextualizedBaseline[];\n\n /** All contextualized requirements across all baselines. */\n readonly requirements: readonly ContextualizedRequirement[];\n\n constructor(\n baselines: readonly ContextualizedBaseline[],\n requirements: readonly ContextualizedRequirement[]\n ) {\n this.baselines = baselines;\n this.requirements = requirements;\n }\n\n /** Find a baseline by name. Returns undefined if not found. */\n findBaseline(name: string): ContextualizedBaseline | undefined {\n return this.baselines.find((b) => b.data.name === name);\n }\n\n /** Find all requirements with the given id across all baselines. */\n findRequirements(id: string): ContextualizedRequirement[] {\n return this.requirements.filter((r) => r.data.id === id);\n }\n\n /** Baselines that have no parent (root of extension chains). */\n get rootBaselines(): ContextualizedBaseline[] {\n return this.baselines.filter((b) => !b.data.parentBaseline);\n }\n}\n\n/**\n * Build a bidirectional extension graph from an HDF Results file.\n *\n * Four phases:\n * 1. Wrap each EvaluatedBaseline in a ContextualizedBaseline\n * 2. Link baselines via parentBaseline name matching (bidirectional)\n * 3. Collect all requirements into a flat array\n * 4. Link requirements by id matching across linked baselines\n */\nexport function buildExtensionGraph(results: HdfResults): ExtensionGraph {\n // Phase 1: Wrap baselines\n const baselineMap = new Map<string, ContextualizedBaseline>();\n const baselines: ContextualizedBaseline[] = [];\n\n for (const baseline of results.baselines) {\n const ctx = new ContextualizedBaseline(baseline, results);\n baselines.push(ctx);\n baselineMap.set(baseline.name, ctx);\n }\n\n // Phase 2: Link baselines via parentBaseline\n for (const ctx of baselines) {\n const parentName = ctx.data.parentBaseline;\n if (parentName) {\n const parent = baselineMap.get(parentName);\n if (parent) {\n ctx.extendsFrom.push(parent);\n parent.extendedBy.push(ctx);\n }\n }\n }\n\n // Phase 3: Collect all requirements\n const allRequirements: ContextualizedRequirement[] = [];\n for (const ctx of baselines) {\n allRequirements.push(...ctx.requirements);\n }\n\n // Phase 4: Link requirements by id across linked baselines\n for (const ctx of baselines) {\n if (ctx.extendsFrom.length === 0) {\n continue;\n }\n for (const childReq of ctx.requirements) {\n for (const parentBaseline of ctx.extendsFrom) {\n const parentReq = parentBaseline.requirements.find(\n (r) => r.data.id === childReq.data.id\n );\n if (parentReq) {\n childReq.extendsFrom.push(parentReq);\n parentReq.extendedBy.push(childReq);\n }\n }\n }\n }\n\n return new ExtensionGraph(baselines, allRequirements);\n}\n"],"mappings":";;AAGA,MAAM,iBAAmE;CAAC;CAAU;CAAS;CAAY;CAAmB;AAAa;;;;;AAczI,IAAa,4BAAb,MAAuC;CAarC,YAAY,MAA4B,aAAqC;qBALzB,CAAC;oBAGF,CAAC;EAGlD,KAAK,OAAO;EACZ,KAAK,cAAc;CACrB;;CAGA,IAAI,OAAkC;EACpC,IAAI,KAAK,YAAY,WAAW,GAC9B,OAAO;EAGT,OAAO,KAAK,YAAY,GAAI;CAC9B;;CAGA,IAAI,cAAuB;EACzB,IAAI,KAAK,YAAY,WAAW,GAC9B,OAAO;EAET,MAAM,OAAO,KAAK,KAAK;EACvB,IAAI,CAAC,MACH,OAAO;EAET,OAAO,SAAS,KAAK,KAAK,KAAK;CACjC;;;;;CAMA,IAAI,WAAmB;EACrB,IAAI,KAAK,eAAe,KAAK,YAAY,SAAS,GAChD,OAAO,KAAK,YAAY,GAAI;EAE9B,MAAM,OAAO,KAAK,KAAK;EACvB,IAAI,CAAC,MACH,OAAO;EAET,MAAM,SAAS,KAAK,KAAK,YAAY,KAAK,KAAK,IAAI;EACnD,IAAI,KAAK,YAAY,WAAW,GAC9B,OAAO;EAET,MAAM,aAAa,KAAK,YAAY,GAAI;EACxC,OAAO,aAAa,GAAG,OAAO,MAAM,eAAe;CACrD;;CAGA,IAAI,iBAA2C;EAC7C,IAAI,KAAK,YAAY,WAAW,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GAAG;EAClB,YAAY,IAAI,SAAS,MAAM,GAAG;CACpC;CAGA,KAAK,MAAM,OAAO,WAAW;EAC3B,MAAM,aAAa,IAAI,KAAK;EAC5B,IAAI,YAAY;GACd,MAAM,SAAS,YAAY,IAAI,UAAU;GACzC,IAAI,QAAQ;IACV,IAAI,YAAY,KAAK,MAAM;IAC3B,OAAO,WAAW,KAAK,GAAG;GAC5B;EACF;CACF;CAGA,MAAM,kBAA+C,CAAC;CACtD,KAAK,MAAM,OAAO,WAChB,gBAAgB,KAAK,GAAG,IAAI,YAAY;CAI1C,KAAK,MAAM,OAAO,WAAW;EAC3B,IAAI,IAAI,YAAY,WAAW,GAC7B;EAEF,KAAK,MAAM,YAAY,IAAI,cACzB,KAAK,MAAM,kBAAkB,IAAI,aAAa;GAC5C,MAAM,YAAY,eAAe,aAAa,MAC3C,MAAM,EAAE,KAAK,OAAO,SAAS,KAAK,EACrC;GACA,IAAI,WAAW;IACb,SAAS,YAAY,KAAK,SAAS;IACnC,UAAU,WAAW,KAAK,QAAQ;GACpC;EACF;CAEJ;CAEA,OAAO,IAAI,eAAe,WAAW,eAAe;AACtD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mitre/hdf-extension-graph",
3
- "version": "3.1.0",
3
+ "version": "3.2.0",
4
4
  "description": "Bidirectional extension graph processing for HDF profile/baseline hierarchies",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -25,7 +25,7 @@
25
25
  "author": "MITRE Corporation",
26
26
  "license": "Apache-2.0",
27
27
  "dependencies": {
28
- "@mitre/hdf-schema": "^3.1.0"
28
+ "@mitre/hdf-schema": "^3.2.0"
29
29
  },
30
30
  "engines": {
31
31
  "node": ">=22.0.0"