From daa16e3ae4186bae0025153ebc96b871bb23a3ac Mon Sep 17 00:00:00 2001 From: Joyce Quach Date: Wed, 23 Oct 2024 11:42:26 -0400 Subject: [PATCH] Fix typo in interface field member and add typing for consts Signed-off-by: Joyce Quach --- .../components/cards/controltable/ControlRowHeader.vue | 2 +- apps/frontend/src/utilities/nist_util.ts | 6 ++++-- .../src/converters-from-hdf/caat/reverse-caat-mapper.ts | 2 +- libs/inspecjs/src/nist.ts | 8 ++++---- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/frontend/src/components/cards/controltable/ControlRowHeader.vue b/apps/frontend/src/components/cards/controltable/ControlRowHeader.vue index e8fb9f6742..76ab6f1104 100644 --- a/apps/frontend/src/components/cards/controltable/ControlRowHeader.vue +++ b/apps/frontend/src/components/cards/controltable/ControlRowHeader.vue @@ -243,7 +243,7 @@ export default class ControlRowHeader extends mixins(HtmlSanitizeMixin) { if (is_control(nisted)) { url = nisted.canonize({ max_specifiers: 2, - pad_zeros: false, + pad_zeroes: false, add_spaces: false, allow_letters: false }); diff --git a/apps/frontend/src/utilities/nist_util.ts b/apps/frontend/src/utilities/nist_util.ts index 6c3e81cae1..c49ef70f7f 100644 --- a/apps/frontend/src/utilities/nist_util.ts +++ b/apps/frontend/src/utilities/nist_util.ts @@ -1,8 +1,10 @@ -export const nistCanonConfig = { +import {CanonizationConfig} from 'inspecjs'; + +export const nistCanonConfig: Required = { add_spaces: true, allow_letters: true, max_specifiers: 5, - pad_zeros: true, + pad_zeroes: true, add_periods: false, add_parens: false }; diff --git a/libs/hdf-converters/src/converters-from-hdf/caat/reverse-caat-mapper.ts b/libs/hdf-converters/src/converters-from-hdf/caat/reverse-caat-mapper.ts index 6b2a4cd89f..62f9d6a3f0 100644 --- a/libs/hdf-converters/src/converters-from-hdf/caat/reverse-caat-mapper.ts +++ b/libs/hdf-converters/src/converters-from-hdf/caat/reverse-caat-mapper.ts @@ -52,7 +52,7 @@ export class FromHDFToCAATMapper { static readonly NistCanonizationConfig: CanonizationConfig = { max_specifiers: 3, - pad_zeros: true, + pad_zeroes: true, allow_letters: false, add_spaces: false }; diff --git a/libs/inspecjs/src/nist.ts b/libs/inspecjs/src/nist.ts index 6eec502f2a..8ff80af7c6 100644 --- a/libs/inspecjs/src/nist.ts +++ b/libs/inspecjs/src/nist.ts @@ -14,16 +14,16 @@ type ParseNist = NistControl | NistRevision | null; export interface CanonizationConfig { max_specifiers?: number; // default 5: $ rg '' SP_800-53_v5_1_XML.xml | awk -F'[^ ]' '{print length($1)}' | sort -nr | head -1 | xargs -I{} expr \( {} - 6 \) / 3 # this equals 5 as of rev5 - pad_zeros?: boolean; // default false + pad_zeroes?: boolean; // default false allow_letters?: boolean; // default true add_spaces?: boolean; // default true add_parens?: boolean; // default true add_periods?: boolean; // default true } -export const DEFAULT_CANONIZATION_CONFIG = { +export const DEFAULT_CANONIZATION_CONFIG: Required = { max_specifiers: 5, - pad_zeros: false, + pad_zeroes: false, allow_letters: true, add_spaces: true, add_parens: true, @@ -144,7 +144,7 @@ export class NistControl { // Handle numbers if (!Number.isNaN(Number.parseInt(spec))) { // If we need to, pad zeros - if (config.pad_zeros && spec.length < 2) { + if (config.pad_zeroes && spec.length < 2) { spec = '0' + spec; }