@@ -441,13 +441,13 @@ export class DataConnectApiClient {
441441 * Generates both capitalized and camel-cased variations of a table name.
442442 * Capitalization matches the schema types, and camel-case matches mutations.
443443 */
444- private getTableNames ( tableName : string ) : { capitalized : string ; formatted : string } {
444+ private getTableNames ( tableName : string ) : { capitalized : string ; camelCase : string } {
445445 if ( ! tableName || tableName . length === 0 ) {
446- return { capitalized : tableName , formatted : tableName } ;
446+ return { capitalized : tableName , camelCase : tableName } ;
447447 }
448448 const capitalized = tableName . charAt ( 0 ) . toUpperCase ( ) + tableName . slice ( 1 ) ;
449- const formatted = tableName . charAt ( 0 ) . toLowerCase ( ) + tableName . slice ( 1 ) ;
450- return { capitalized, formatted } ;
449+ const camelCase = tableName . charAt ( 0 ) . toLowerCase ( ) + tableName . slice ( 1 ) ;
450+ return { capitalized, camelCase } ;
451451 }
452452
453453 /**
@@ -481,7 +481,7 @@ export class DataConnectApiClient {
481481 }
482482
483483 private handleBulkImportErrors ( err : FirebaseDataConnectError ) : never {
484- if ( err . code === `data-connect/${ DATA_CONNECT_ERROR_CODE_MAPPING . QUERY_ERROR } ` ) {
484+ if ( err . code === `data-connect/${ DATA_CONNECT_ERROR_CODE_MAPPING . QUERY_ERROR } ` ) {
485485 throw new FirebaseDataConnectError ( {
486486 code : DATA_CONNECT_ERROR_CODE_MAPPING . QUERY_ERROR ,
487487 message : `${ err . message } . Make sure that your table name passed in matches the type name in your `
@@ -520,11 +520,11 @@ export class DataConnectApiClient {
520520 }
521521
522522 try {
523- const { capitalized, formatted } = this . getTableNames ( tableName ) ;
523+ const { capitalized, camelCase } = this . getTableNames ( tableName ) ;
524524 const keys = this . getObjectKeys ( data ) ;
525- const mutation =
525+ const mutation =
526526 `mutation($data: ${ capitalized } _Data! @allow(fields: "${ keys } ")) {
527- ${ formatted } _insert(data: $data)
527+ ${ camelCase } _insert(data: $data)
528528 }` ;
529529
530530 return this . executeGraphql < GraphQlResponse , { data : Variables } > ( mutation , { variables : { data } } )
@@ -559,11 +559,11 @@ export class DataConnectApiClient {
559559 }
560560
561561 try {
562- const { capitalized, formatted } = this . getTableNames ( tableName ) ;
562+ const { capitalized, camelCase } = this . getTableNames ( tableName ) ;
563563 const keys = this . getArrayObjectsKeys ( data ) ;
564- const mutation =
564+ const mutation =
565565 `mutation($data: [${ capitalized } _Data!]! @allow(fields: "${ keys } ")) {
566- ${ formatted } _insertMany(data: $data)
566+ ${ camelCase } _insertMany(data: $data)
567567 }` ;
568568
569569 return this . executeGraphql < GraphQlResponse , { data : Variables } > ( mutation , { variables : { data } } )
@@ -605,11 +605,11 @@ export class DataConnectApiClient {
605605 }
606606
607607 try {
608- const { capitalized, formatted } = this . getTableNames ( tableName ) ;
608+ const { capitalized, camelCase } = this . getTableNames ( tableName ) ;
609609 const keys = this . getObjectKeys ( data ) ;
610- const mutation =
610+ const mutation =
611611 `mutation($data: ${ capitalized } _Data! @allow(fields: "${ keys } ")) {
612- ${ formatted } _upsert(data: $data)
612+ ${ camelCase } _upsert(data: $data)
613613 }` ;
614614
615615 return this . executeGraphql < GraphQlResponse , { data : Variables } > ( mutation , { variables : { data } } )
@@ -644,11 +644,11 @@ export class DataConnectApiClient {
644644 }
645645
646646 try {
647- const { capitalized, formatted } = this . getTableNames ( tableName ) ;
647+ const { capitalized, camelCase } = this . getTableNames ( tableName ) ;
648648 const keys = this . getArrayObjectsKeys ( data ) ;
649- const mutation =
649+ const mutation =
650650 `mutation($data: [${ capitalized } _Data!]! @allow(fields: "${ keys } ")) {
651- ${ formatted } _upsertMany(data: $data)
651+ ${ camelCase } _upsertMany(data: $data)
652652 }` ;
653653
654654 return this . executeGraphql < GraphQlResponse , { data : Variables } > ( mutation , { variables : { data } } )
0 commit comments