Skip to content

Commit

Permalink
Remove fields from DiffableRule
Browse files Browse the repository at this point in the history
  • Loading branch information
jpdjere committed Oct 15, 2024
1 parent d542461 commit c4b2ca5
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,8 @@ import {
RequiredFieldArray,
RiskScore,
RiskScoreMapping,
RuleAuthorArray,
RuleDescription,
RuleExceptionList,
RuleFalsePositiveArray,
RuleLicense,
RuleName,
RuleReferenceArray,
RuleSignatureId,
Expand Down Expand Up @@ -82,12 +79,9 @@ export const DiffableCommonFields = z.object({
setup: SetupGuide,
related_integrations: RelatedIntegrationArray,
required_fields: RequiredFieldArray,
author: RuleAuthorArray,
license: RuleLicense,

// Other domain fields
rule_schedule: RuleSchedule, // NOTE: new field
exceptions_list: z.array(RuleExceptionList),
max_signals: MaxSignals,

// Optional fields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,7 @@ export const FIELDS_TO_UPGRADE_TO_CURRENT_VERSION = [
'items_per_search',
] as const;

export const NON_UPGRADEABLE_DIFFABLE_FIELDS = [
'type',
'rule_id',
'version',
'author',
'license',
] as const;
export const NON_UPGRADEABLE_DIFFABLE_FIELDS = ['type', 'rule_id', 'version'] as const;

type NON_UPGRADEABLE_DIFFABLE_FIELDS_TO_OMIT_TYPE = {
readonly [key in (typeof NON_UPGRADEABLE_DIFFABLE_FIELDS)[number]]: true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export const ABOUT_UPGRADE_FIELD_ORDER: Array<keyof DiffableAllFields> = [
'version',
'name',
'description',
'author',
'building_block',
'investigation_fields',
'severity',
Expand All @@ -23,7 +22,6 @@ export const ABOUT_UPGRADE_FIELD_ORDER: Array<keyof DiffableAllFields> = [
'risk_score_mapping',
'references',
'false_positives',
'license',
'rule_name_override',
'threat',
'threat_indicator_path',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,7 @@ const commonFieldsDiffAlgorithms: FieldsDiffAlgorithmsFor<DiffableCommonFields>
setup: multiLineStringDiffAlgorithm,
related_integrations: simpleDiffAlgorithm,
required_fields: simpleDiffAlgorithm,
author: scalarArrayDiffAlgorithm,
license: singleLineStringDiffAlgorithm,
rule_schedule: simpleDiffAlgorithm,
exceptions_list: simpleDiffAlgorithm,
max_signals: numberDiffAlgorithm,
rule_name_override: simpleDiffAlgorithm,
timestamp_override: simpleDiffAlgorithm,
Expand Down

0 comments on commit c4b2ca5

Please sign in to comment.