@mitre/hdf-generators 3.6.0 → 3.7.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/README.md +6 -0
- package/dist/index.d.ts +13 -13
- package/dist/index.d.ts.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -11,6 +11,12 @@ Takes an HDF Baseline JSON document (requirement definitions with metadata, desc
|
|
|
11
11
|
|
|
12
12
|
This bridges from HDF's tool-agnostic baseline format to InSpec's executable compliance-as-code format.
|
|
13
13
|
|
|
14
|
+
It also carries the **upgrade engine**: given a current baseline or InSpec profile and a newer
|
|
15
|
+
upstream one, it matches requirements between them and smart-merges the fields, so local
|
|
16
|
+
customizations survive a guidance version bump instead of being overwritten. Requirements the
|
|
17
|
+
upstream adds arrive as new controls; the delta between the two is reportable. The CLI reaches
|
|
18
|
+
it as `hdf generate upgrade <current> <upstream>`.
|
|
19
|
+
|
|
14
20
|
## Relationship to other packages
|
|
15
21
|
|
|
16
22
|
| Package | Relationship |
|
package/dist/index.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ type PreferSide = 'current' | 'upstream' | undefined;
|
|
|
46
46
|
* prefer "current": scalars from current, current wins tag/desc conflicts
|
|
47
47
|
* prefer "upstream": everything from upstream (full replacement)
|
|
48
48
|
*/
|
|
49
|
-
declare function mergeRequirement(current: BaselineRequirement, upstream: BaselineRequirement, prefer?: PreferSide): BaselineRequirement;
|
|
49
|
+
export declare function mergeRequirement(current: BaselineRequirement, upstream: BaselineRequirement, prefer?: PreferSide): BaselineRequirement;
|
|
50
50
|
/**
|
|
51
51
|
* Merge two tag maps.
|
|
52
52
|
*
|
|
@@ -54,7 +54,7 @@ declare function mergeRequirement(current: BaselineRequirement, upstream: Baseli
|
|
|
54
54
|
* prefer "current": union; current wins on key conflicts.
|
|
55
55
|
* prefer "upstream": upstream replaces all.
|
|
56
56
|
*/
|
|
57
|
-
declare function mergeTags(current: Record<string, any> // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
57
|
+
export declare function mergeTags(current: Record<string, any> // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
58
58
|
, upstream: Record<string, any> // eslint-disable-line @typescript-eslint/no-explicit-any
|
|
59
59
|
, prefer?: PreferSide): Record<string, any>;
|
|
60
60
|
/**
|
|
@@ -64,7 +64,7 @@ declare function mergeTags(current: Record<string, any> // eslint-disable-line @
|
|
|
64
64
|
* prefer "current": union; current wins on label conflicts.
|
|
65
65
|
* prefer "upstream": upstream replaces all.
|
|
66
66
|
*/
|
|
67
|
-
declare function mergeDescriptions(current: Description[], upstream: Description[], prefer?: PreferSide): Description[];
|
|
67
|
+
export declare function mergeDescriptions(current: Description[], upstream: Description[], prefer?: PreferSide): Description[];
|
|
68
68
|
/**
|
|
69
69
|
* Merge two reference arrays.
|
|
70
70
|
*
|
|
@@ -72,7 +72,7 @@ declare function mergeDescriptions(current: Description[], upstream: Description
|
|
|
72
72
|
* prefer "current": current only.
|
|
73
73
|
* prefer "upstream": upstream only.
|
|
74
74
|
*/
|
|
75
|
-
declare function mergeRefs(current?: Reference[], upstream?: Reference[], prefer?: PreferSide): Reference[] | undefined;
|
|
75
|
+
export declare function mergeRefs(current?: Reference[], upstream?: Reference[], prefer?: PreferSide): Reference[] | undefined;
|
|
76
76
|
//#endregion
|
|
77
77
|
//#region src/delta-types.d.ts
|
|
78
78
|
/**
|
|
@@ -160,7 +160,7 @@ type DeltaOptions = UpgradeOptions;
|
|
|
160
160
|
* Ported from ts-inspec-objects escapeQuotes(), cross-referenced with
|
|
161
161
|
* inspec-parser's RubyRebuilder.
|
|
162
162
|
*/
|
|
163
|
-
declare function escapeQuotes(s: string): string;
|
|
163
|
+
export declare function escapeQuotes(s: string): string;
|
|
164
164
|
//#endregion
|
|
165
165
|
//#region src/control-stub.d.ts
|
|
166
166
|
/**
|
|
@@ -176,7 +176,7 @@ declare function escapeQuotes(s: string): string;
|
|
|
176
176
|
* <code or stub comment>
|
|
177
177
|
* end
|
|
178
178
|
*/
|
|
179
|
-
declare function generateControlStub(req: BaselineRequirement): string;
|
|
179
|
+
export declare function generateControlStub(req: BaselineRequirement): string;
|
|
180
180
|
//#endregion
|
|
181
181
|
//#region src/inspec-yml.d.ts
|
|
182
182
|
/**
|
|
@@ -185,7 +185,7 @@ declare function generateControlStub(req: BaselineRequirement): string;
|
|
|
185
185
|
* Uses string interpolation — no YAML library needed since the structure
|
|
186
186
|
* is fixed and shallow.
|
|
187
187
|
*/
|
|
188
|
-
declare function generateInSpecYml(baseline: HDFBaseline, options?: GeneratorOptions): string;
|
|
188
|
+
export declare function generateInSpecYml(baseline: HDFBaseline, options?: GeneratorOptions): string;
|
|
189
189
|
//#endregion
|
|
190
190
|
//#region src/profile-generator.d.ts
|
|
191
191
|
/**
|
|
@@ -195,7 +195,7 @@ declare function generateInSpecYml(baseline: HDFBaseline, options?: GeneratorOpt
|
|
|
195
195
|
* control filenames to Ruby source code. No file I/O — the CLI
|
|
196
196
|
* is responsible for writing files to disk.
|
|
197
197
|
*/
|
|
198
|
-
declare function generateInSpecProfile(baseline: HDFBaseline, options?: GeneratorOptions): InSpecProfile;
|
|
198
|
+
export declare function generateInSpecProfile(baseline: HDFBaseline, options?: GeneratorOptions): InSpecProfile;
|
|
199
199
|
//#endregion
|
|
200
200
|
//#region src/delta.d.ts
|
|
201
201
|
/**
|
|
@@ -209,13 +209,13 @@ declare function generateInSpecProfile(baseline: HDFBaseline, options?: Generato
|
|
|
209
209
|
* (a control removed from upstream should not survive the upgrade).
|
|
210
210
|
* Set opts.keepUnmatched to retain them instead.
|
|
211
211
|
*/
|
|
212
|
-
declare function generateUpgrade(currentBaseline: HDFBaseline, upstreamBaseline: HDFBaseline, linkRecords: LinkRecord[], opts?: UpgradeOptions): UpgradeResult;
|
|
212
|
+
export declare function generateUpgrade(currentBaseline: HDFBaseline, upstreamBaseline: HDFBaseline, linkRecords: LinkRecord[], opts?: UpgradeOptions): UpgradeResult;
|
|
213
213
|
/**
|
|
214
214
|
* Legacy entry point. Wraps generateUpgrade for backward compatibility.
|
|
215
215
|
*
|
|
216
216
|
* @deprecated Use generateUpgrade instead.
|
|
217
217
|
*/
|
|
218
|
-
declare function generateDelta(newBaseline: HDFBaseline, linkRecords: LinkRecord[], oldCodeMap: Map<string, string>, opts?: DeltaOptions, oldControlCount?: number): DeltaResult;
|
|
218
|
+
export declare function generateDelta(newBaseline: HDFBaseline, linkRecords: LinkRecord[], oldCodeMap: Map<string, string>, opts?: DeltaOptions, oldControlCount?: number): DeltaResult;
|
|
219
219
|
//#endregion
|
|
220
220
|
//#region src/delta-report.d.ts
|
|
221
221
|
/**
|
|
@@ -229,13 +229,13 @@ interface DeltaJsonReport {
|
|
|
229
229
|
* Generate a structured JSON report from a delta result.
|
|
230
230
|
* Matches SAF CLI's delta.json format: { ...diff, links }.
|
|
231
231
|
*/
|
|
232
|
-
declare function generateDeltaJson(result: DeltaResult): DeltaJsonReport;
|
|
232
|
+
export declare function generateDeltaJson(result: DeltaResult): DeltaJsonReport;
|
|
233
233
|
/**
|
|
234
234
|
* Generate a Markdown report from a delta result.
|
|
235
235
|
* Matches SAF CLI's delta.md format: mapping table, control counts,
|
|
236
236
|
* match statistics, and statistics validation.
|
|
237
237
|
*/
|
|
238
|
-
declare function generateDeltaMarkdown(result: DeltaResult): string;
|
|
238
|
+
export declare function generateDeltaMarkdown(result: DeltaResult): string;
|
|
239
239
|
//#endregion
|
|
240
|
-
export {
|
|
240
|
+
export type { DeltaJsonReport, DeltaOptions, DeltaResult, DeltaStatistics, GeneratorOptions, InSpecProfile, LinkRecord, PreferSide, ProfileMetadata, UpgradeOptions, UpgradeResult };
|
|
241
241
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/merge.ts","../src/delta-types.ts","../src/ruby-escape.ts","../src/control-stub.ts","../src/inspec-yml.ts","../src/profile-generator.ts","../src/delta.ts","../src/delta-report.ts"],"mappings":";;;;;UAGiB;;EAEf;;EAEA,WAAW;;EAEX;;;;;UAMe;EACf;EACA;EACA;EACA;;;;;UAMe;;EAEf;;EAEA,UAAU;;;;KC3BA;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/merge.ts","../src/delta-types.ts","../src/ruby-escape.ts","../src/control-stub.ts","../src/inspec-yml.ts","../src/profile-generator.ts","../src/delta.ts","../src/delta-report.ts"],"mappings":";;;;;UAGiB;;EAEf;;EAEA,WAAW;;EAEX;;;;;UAMe;EACf;EACA;EACA;EACA;;;;;UAMe;;EAEf;;EAEA,UAAU;;;;KC3BA;;;;;;;;;;;;;;;wBAgBI,iBACd,SAAS,qBACT,UAAU,qBACV,SAAS,aACR;;;;;;;;wBAwCa,UACd,SAAS;EACT,UAAU;EACV,SAAS,aACR;;;;;;;;wBA4Ba,kBACd,SAAS,eACT,UAAU,eACV,SAAS,aACR;;;;;;;;wBAqCa,UACd,UAAU,aACV,WAAW,aACX,SAAS,aACR;;;;;;UCpIc;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;;;;;;;;;;;;;;UAgBe;EACf;EACA;EACA;EACA;EACA;EACA;EACA;;;;;UAMe;EACf,UAAU;EACV,UAAU;EACV,aAAa;EACb,YAAY;;;KAIF,cAAc;;;;UAKT;;EAEf,SAAS;;EAET;;EAEA;;EAEA;;EAEA,WAAW;;EAEX;;;;;;;;EAQA;;;KAIU,eAAe;;;;;;;;;;;;;;wBCrEX,aAAa;;;;;;;;;;;;;;;;wBCWb,oBAAoB,KAAK;;;;;;;;;wBCbzB,kBACd,UAAU,aACV,UAAU;;;;;;;;;;wBCCI,sBACd,UAAU,aACV,UAAU,mBACT;;;;;;;;;;;;;;wBCGa,gBACd,iBAAiB,aACjB,kBAAkB,aAClB,aAAa,cACb,OAAO,iBACN;;;;;;wBAmFa,cACd,aAAa,aACb,aAAa,cACb,YAAY,qBACZ,OAAO,cACP,2BACC;;;;;;;UC1Gc;EACf,OAAO;;;;;;wBAOO,kBAAkB,QAAQ,cAAc;;;;;;wBAoCxC,sBAAsB,QAAQ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mitre/hdf-generators",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"description": "Generate InSpec profile stubs from HDF Baseline definitions",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"author": "MITRE Corporation",
|
|
26
26
|
"license": "Apache-2.0",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@mitre/hdf-schema": "^3.
|
|
28
|
+
"@mitre/hdf-schema": "^3.7.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@mitre/hdf-fixtures": "^3.
|
|
31
|
+
"@mitre/hdf-fixtures": "^3.7.0"
|
|
32
32
|
},
|
|
33
33
|
"engines": {
|
|
34
34
|
"node": ">=22.0.0"
|