22 ParsedFile ,
33 Skip ,
44 UnparsedApexBundle ,
5- UnparsedCustomFieldBundle ,
6- UnparsedCustomObjectBundle ,
75 UnparsedSourceBundle ,
86 UserDefinedChangelogConfig ,
97} from '../shared/types' ;
@@ -21,6 +19,7 @@ import { skip } from '../shared/utils';
2119import { reflectCustomFieldsAndObjects } from '../reflection/sobject/reflectCustomFieldsAndObjects' ;
2220import { CustomObjectMetadata } from '../reflection/sobject/reflect-custom-object-sources' ;
2321import { Type } from '@cparra/apex-reflection' ;
22+ import { filterApexSourceFiles , filterCustomObjectsAndFields } from '#utils/source-bundle-utils' ;
2423
2524export type ChangeLogPageData = {
2625 content : string ;
@@ -55,27 +54,12 @@ export function generateChangeLog(
5554}
5655
5756function reflect ( bundles : UnparsedSourceBundle [ ] , config : Omit < UserDefinedChangelogConfig , 'targetGenerator' > ) {
58- // TODO: Move to utility and reuse
59- function filterApexSourceFiles ( sourceFiles : UnparsedSourceBundle [ ] ) : UnparsedApexBundle [ ] {
60- return sourceFiles . filter ( ( sourceFile ) : sourceFile is UnparsedApexBundle => sourceFile . type === 'apex' ) ;
61- }
62-
6357 const filterOutOfScopeApex = apply ( filterScope , config . scope ) ;
6458
6559 function reflectApexFiles ( sourceFiles : UnparsedApexBundle [ ] ) {
6660 return pipe ( reflectApexSource ( sourceFiles ) , TE . map ( filterOutOfScopeApex ) ) ;
6761 }
6862
69- // TODO: Move to utility and reuse
70- function filterCustomObjectsAndFields (
71- sourceFiles : UnparsedSourceBundle [ ] ,
72- ) : ( UnparsedCustomObjectBundle | UnparsedCustomFieldBundle ) [ ] {
73- return sourceFiles . filter (
74- ( sourceFile ) : sourceFile is UnparsedCustomObjectBundle =>
75- sourceFile . type === 'customobject' || sourceFile . type === 'customfield' ,
76- ) ;
77- }
78-
7963 return pipe (
8064 reflectApexFiles ( filterApexSourceFiles ( bundles ) ) ,
8165 TE . chain ( ( parsedApexFiles ) => {
0 commit comments