File tree Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -845,6 +845,16 @@ function isScalar(type: any): boolean {
845
845
) ;
846
846
}
847
847
848
+ export function getGraphModels ( graphSchema : gql . GraphQLSchema ) : string [ ] {
849
+ const models : string [ ] = [ ] ;
850
+ for ( const [ name , type ] of Object . entries ( graphSchema . getTypeMap ( ) ) ) {
851
+ if ( isV2ModelType ( type ) ) {
852
+ models . push ( name ) ;
853
+ }
854
+ }
855
+ return models ;
856
+ }
857
+
848
858
interface IncrementalQueryConfig {
849
859
readonly type : gql . GraphQLObjectType ;
850
860
readonly resolvedPrimaryKeys ?: Dictionary < string > ;
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ export {
61
61
crossMerge ,
62
62
flattenIterable ,
63
63
flattenV2 ,
64
+ getGraphModels ,
64
65
paginatedQueryV2 ,
65
66
pathToModelV2 ,
66
67
readerFromQuery ,
Original file line number Diff line number Diff line change @@ -476,4 +476,12 @@ describe('graphql', () => {
476
476
incremental : false ,
477
477
} ) ;
478
478
} ) ;
479
+
480
+ test ( 'get graph models' , ( ) => {
481
+ expect ( sut . getGraphModels ( graphSchemaV2 ) ) . toIncludeAllMembers ( [
482
+ 'cicd_Artifact' ,
483
+ 'cicd_Build' ,
484
+ 'cicd_Pipeline' ,
485
+ ] ) ;
486
+ } ) ;
479
487
} ) ;
You can’t perform that action at this time.
0 commit comments