Skip to content

Commit 9b363ee

Browse files
Add compliance category and security classification
Add compliance category and security classification to metadata that is retrieved for custom fields
1 parent 6cf4366 commit 9b363ee

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

src/core/changelog/__test__/helpers/custom-field-metadata-builder.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ export default class CustomFieldMetadataBuilder {
2323
description: this.description,
2424
parentName: 'MyObject',
2525
required: false,
26+
securityClassification: 'Internal',
27+
complianceCategory: 'PII',
2628
};
2729
}
2830
}

src/core/reflection/sobject/__test__/reflect-custom-field-sources.spec.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ const customFieldContent = `
1414
<trackFeedHistory>false</trackFeedHistory>
1515
<type>Url</type>
1616
<description>A Photo URL field</description>
17+
<securityClassification>Internal</securityClassification>
18+
<complianceCategory>PII</complianceCategory>
1719
</CustomField>`;
1820

1921
describe('when parsing custom field metadata', () => {
@@ -107,6 +109,34 @@ describe('when parsing custom field metadata', () => {
107109
assertEither(result, (data) => expect(data[0].type.description).toBe('A Photo URL field'));
108110
});
109111

112+
test('the resulting type contains the correct security classification', async () => {
113+
const unparsed: UnparsedCustomFieldBundle = {
114+
type: 'customfield',
115+
name: 'PhotoUrl__c',
116+
parentName: 'MyFirstObject__c',
117+
filePath: 'src/field/PhotoUrl__c.field-meta.xml',
118+
content: customFieldContent,
119+
};
120+
121+
const result = await reflectCustomFieldSources([unparsed])();
122+
123+
assertEither(result, (data) => expect(data[0].type.securityClassification).toBe('Internal'));
124+
});
125+
126+
test('the resulting type contains the correct compliance category', async () => {
127+
const unparsed: UnparsedCustomFieldBundle = {
128+
type: 'customfield',
129+
name: 'PhotoUrl__c',
130+
parentName: 'MyFirstObject__c',
131+
filePath: 'src/field/PhotoUrl__c.field-meta.xml',
132+
content: customFieldContent,
133+
};
134+
135+
const result = await reflectCustomFieldSources([unparsed])();
136+
137+
assertEither(result, (data) => expect(data[0].type.complianceCategory).toBe('PII'));
138+
});
139+
110140
test('can parse picklist values when there are multiple picklist values available', async () => {
111141
const unparsed: UnparsedCustomFieldBundle = {
112142
type: 'customfield',

src/core/reflection/sobject/reflect-custom-field-source.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ export type CustomFieldMetadata = {
1818
parentName: string;
1919
pickListValues?: string[];
2020
required: boolean;
21+
securityClassification: string | null;
22+
complianceCategory: string | null;
2123
};
2224

2325
export function reflectCustomFieldSources(
@@ -66,6 +68,8 @@ function toCustomFieldMetadata(parserResult: { CustomField: unknown }): CustomFi
6668
const defaultValues = {
6769
description: null,
6870
required: false,
71+
securityClassification: null,
72+
complianceCategory: null,
6973
};
7074

7175
return {

src/core/reflection/sobject/reflect-custom-object-sources.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ function convertInlineFieldsToCustomFieldMetadata(
109109
const label = inlineField.label ? (inlineField.label as string) : name;
110110
const type = inlineField.type ? (inlineField.type as string) : null;
111111
const required = inlineField.required ? (inlineField.required as boolean) : false;
112+
const securityClassification = inlineField.securityClassification ? (inlineField.securityClassification as string) : null;
113+
const complianceCategory = inlineField.complianceCategory ? (inlineField.complianceCategory as string) : null;
112114

113115
return {
114116
type_name: 'customfield',
@@ -118,6 +120,8 @@ function convertInlineFieldsToCustomFieldMetadata(
118120
parentName,
119121
type,
120122
required,
123+
securityClassification,
124+
complianceCategory,
121125
pickListValues: getPickListValues(inlineField),
122126
};
123127
}

0 commit comments

Comments
 (0)