@@ -13,29 +13,23 @@ export const generateFieldAssignments = ({ index, input }: { index: number; inpu
1313        [ input . name  ||  `param${ index }  ` ] , 
1414      ) ; 
1515
16- type  BlacklistDictionary  =  Record < string ,  string > ; 
17- 
1816/** 
1917 * Map of input names that are reserved so we do not use them as field names to avoid conflicts 
18+  * see https://github.com/graphprotocol/graph-tooling/issues/710 
19+  * name => mappedName 
2020 */ 
21- export   const  INPUT_NAMES_BLACKLIST  =  { 
22-   /** Related to https://github.com/graphprotocol/graph-tooling/issues/710 */ 
23-   id : 'id ' , 
21+ const  NAMES_REMAP_DICTIONARY :  Record < string ,   string >  =  { 
22+   id :  'internal_id' , 
23+   _id : 'internal__id ' , 
2424}  as  const ; 
2525
26- export  const  renameInput  =  ( name : string ,  subgraphName : string )  =>  { 
27-   const  inputMap : BlacklistDictionary  =  { 
28-     [ INPUT_NAMES_BLACKLIST . id ] : `${ subgraphName }  _id` , 
29-   } ; 
30- 
31-   return  inputMap ?. [ name ]  ??  name ; 
26+ export  const  renameNameIfNeeded  =  ( name : string )  =>  { 
27+   return  NAMES_REMAP_DICTIONARY [ name ]  ??  name ; 
3228} ; 
3329
34- export  const  generateEventFieldAssignments  =  ( event : any ,  contractName : string )  => 
30+ export  const  generateEventFieldAssignments  =  ( event : any ,  _contractName : string )  => 
3531  event . inputs . reduce ( ( acc : any [ ] ,  input : any ,  index : number )  =>  { 
36-     if  ( Object . values ( INPUT_NAMES_BLACKLIST ) . includes ( input . name ) )  { 
37-       input . mappedName  =  renameInput ( input . name ,  contractName  ??  'contract' ) ; 
38-     } 
32+     input . mappedName  =  renameNameIfNeeded ( input . name ) ; 
3933    return  acc . concat ( generateFieldAssignments ( {  input,  index } ) ) ; 
4034  } ,  [ ] ) ; 
4135
0 commit comments