11import { DocumentNode , print as gqlPrint } from 'graphql' ;
2- import { toCamelCase , toPascalCase , pluralize , underscore } from 'inflekt' ;
2+ import { toCamelCase , toPascalCase , pluralize } from 'inflekt' ;
3+ import { toSnakeCase } from 'komoji' ;
34
45import {
56 createOne ,
@@ -194,7 +195,7 @@ export class QueryBuilder {
194195 this . _key = this . _findQuery ( ) ;
195196
196197 this . queryName (
197- toCamelCase ( [ 'get' , underscore ( this . _key ) , 'query' ] . join ( '_' ) ) ,
198+ toCamelCase ( [ 'get' , toSnakeCase ( this . _key ) , 'query' ] . join ( '_' ) ) ,
198199 ) ;
199200
200201 const defn = this . _introspection [ this . _key ] ;
@@ -216,7 +217,7 @@ export class QueryBuilder {
216217 this . _key = this . _findQuery ( ) ;
217218
218219 this . queryName (
219- toCamelCase ( [ 'get' , underscore ( this . _key ) , 'query' , 'all' ] . join ( '_' ) ) ,
220+ toCamelCase ( [ 'get' , toSnakeCase ( this . _key ) , 'query' , 'all' ] . join ( '_' ) ) ,
220221 ) ;
221222
222223 const defn = this . _introspection [ this . _key ] ;
@@ -238,7 +239,7 @@ export class QueryBuilder {
238239
239240 this . queryName (
240241 toCamelCase (
241- [ 'get' , underscore ( this . _key ) , 'count' , 'query' ] . join ( '_' ) ,
242+ [ 'get' , toSnakeCase ( this . _key ) , 'count' , 'query' ] . join ( '_' ) ,
242243 ) ,
243244 ) ;
244245
@@ -258,7 +259,7 @@ export class QueryBuilder {
258259 this . _key = this . _findQuery ( ) ;
259260
260261 this . queryName (
261- toCamelCase ( [ 'get' , underscore ( this . _key ) , 'query' ] . join ( '_' ) ) ,
262+ toCamelCase ( [ 'get' , toSnakeCase ( this . _key ) , 'query' ] . join ( '_' ) ) ,
262263 ) ;
263264
264265 const defn = this . _introspection [ this . _key ] ;
@@ -280,7 +281,7 @@ export class QueryBuilder {
280281 this . _key = this . _findMutation ( ) ;
281282
282283 this . queryName (
283- toCamelCase ( [ underscore ( this . _key ) , 'mutation' ] . join ( '_' ) ) ,
284+ toCamelCase ( [ toSnakeCase ( this . _key ) , 'mutation' ] . join ( '_' ) ) ,
284285 ) ;
285286
286287 const defn = this . _introspection [ this . _key ] as MutationDefinition ;
@@ -301,7 +302,7 @@ export class QueryBuilder {
301302 this . _key = this . _findMutation ( ) ;
302303
303304 this . queryName (
304- toCamelCase ( [ underscore ( this . _key ) , 'mutation' ] . join ( '_' ) ) ,
305+ toCamelCase ( [ toSnakeCase ( this . _key ) , 'mutation' ] . join ( '_' ) ) ,
305306 ) ;
306307
307308 const defn = this . _introspection [ this . _key ] as MutationDefinition ;
@@ -322,7 +323,7 @@ export class QueryBuilder {
322323 this . _key = this . _findMutation ( ) ;
323324
324325 this . queryName (
325- toCamelCase ( [ underscore ( this . _key ) , 'mutation' ] . join ( '_' ) ) ,
326+ toCamelCase ( [ toSnakeCase ( this . _key ) , 'mutation' ] . join ( '_' ) ) ,
326327 ) ;
327328
328329 const defn = this . _introspection [ this . _key ] as MutationDefinition ;
@@ -559,5 +560,5 @@ function isRelationalField(fieldName: string, modelMeta: MetaTable): boolean {
559560// Get getMany op name from model
560561// ie. UserSetting => userSettings
561562function modelNameToGetMany ( model : string ) : string {
562- return toCamelCase ( pluralize ( underscore ( model ) ) ) ;
563+ return toCamelCase ( pluralize ( toSnakeCase ( model ) ) ) ;
563564}
0 commit comments