@@ -10,29 +10,30 @@ class Mapper
1010 :invitations
1111 ] . freeze
1212
13- def mount_graphql_devise_for ( resource , opts = { } )
14- custom_operations = opts . fetch ( :operations , { } )
15- skipped_operations = opts . fetch ( :skip , [ ] )
16- only_operations = opts . fetch ( :only , [ ] )
17- additional_mutations = opts . fetch ( :additional_mutations , { } )
18- additional_queries = opts . fetch ( :additional_queries , { } )
19- path = opts . fetch ( :at , '/graphql_auth' )
13+ def mount_graphql_devise_for ( resource , options = { } )
14+ custom_operations = options . fetch ( :operations , { } )
15+ skipped_operations = options . fetch ( :skip , [ ] )
16+ only_operations = options . fetch ( :only , [ ] )
17+ additional_mutations = options . fetch ( :additional_mutations , { } )
18+ additional_queries = options . fetch ( :additional_queries , { } )
19+ path = options . fetch ( :at , '/graphql_auth' )
2020 mapping_name = resource . underscore . tr ( '/' , '_' ) . to_sym
21- authenticatable_type = opts [ :authenticatable_type ] . presence ||
22- "Types::#{ resource } Type" . safe_constantize ||
23- GraphqlDevise ::Types ::AuthenticatableType
21+ authenticatable_type = options [ :authenticatable_type ] . presence ||
22+ "Types::#{ resource } Type" . safe_constantize ||
23+ GraphqlDevise ::Types ::AuthenticatableType
24+
25+ GraphqlDevise ::MountMethod ::OptionsValidator . new (
26+ [
27+ GraphqlDevise ::MountMethod ::OptionValidators ::SkipOnlyValidator . new ( options : options )
28+ ]
29+ ) . validate!
30+
2431 param_operations = {
2532 custom : custom_operations ,
2633 only : only_operations ,
2734 skipped : skipped_operations
2835 }
2936
30- GraphqlDevise ::OperationChecker . call (
31- mutations : GraphqlDevise ::DefaultOperations ::MUTATIONS ,
32- queries : GraphqlDevise ::DefaultOperations ::QUERIES ,
33- **param_operations
34- )
35-
3637 devise_for (
3738 resource . pluralize . underscore . tr ( '/' , '_' ) . to_sym ,
3839 module : :devise ,
@@ -61,7 +62,7 @@ def mount_graphql_devise_for(resource, opts = {})
6162 end
6263
6364 if ( prepared_mutations . present? || additional_mutations . present? ) &&
64- ( Gem ::Version . new ( GraphQL ::VERSION ) <= Gem ::Version . new ( '1.10.0' ) || GraphqlDevise ::Schema . mutation . nil? )
65+ ( Gem ::Version . new ( GraphQL ::VERSION ) <= Gem ::Version . new ( '1.10.0' ) || GraphqlDevise ::Schema . mutation . nil? )
6566 GraphqlDevise ::Schema . mutation ( GraphqlDevise ::Types ::MutationType )
6667 end
6768
0 commit comments