Update codegen templates (#347)

Co-authored-by: Dhruv Srivastava <dhruvdhs.ds@gmail.com>
This commit is contained in:
Nabarun Gogoi 2023-03-30 11:47:39 +05:30 committed by GitHub
parent 91816db6f3
commit 622e49915f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 16 deletions

View File

@ -37,7 +37,7 @@ export const SUBGRAPH_ENTITIES = new Set([
{{~/each}}]);
{{/if}}
export const ENTITIES = [
{{~#each queries as | query |}}{{query.entityName}}, {{/each}}
{{~#each queries as | query |}}{{~#if @index }}, {{/if}}{{query.entityName}}{{/each}}
{{~#if (subgraphPath)}}...SUBGRAPH_ENTITIES{{/if}}];
{{#if (subgraphPath)}}
// Map: Entity to suitable query type.
@ -50,7 +50,7 @@ export class Database implements DatabaseInterface {
_config: ConnectionOptions;
_conn!: Connection;
_baseDatabase: BaseDatabase;
_propColMaps: { [key: string]: Map<string, string>; }
_propColMaps: { [key: string]: Map<string, string>; };
constructor (config: ConnectionOptions) {
assert(config);

View File

@ -32,7 +32,7 @@ export class {{className}} {{~#if implements}} implements {{implements}} {{~/if}
{{~#unless @last}},{{/unless}}
{{~/each}} }
{{~/if}})
{{column.name}}!: {{column.tsType}};
{{column.name}}!: {{column.tsType}};
{{~#unless @last}}
{{/unless}}

View File

@ -72,24 +72,24 @@ const {{capitalize event}}_EVENT = '{{event}}';
{{/each}}
export class Indexer implements IndexerInterface {
_db: Database
_ethClient: EthClient
_ethProvider: BaseProvider
_baseIndexer: BaseIndexer
_serverConfig: ServerConfig
_db: Database;
_ethClient: EthClient;
_ethProvider: BaseProvider;
_baseIndexer: BaseIndexer;
_serverConfig: ServerConfig;
{{#if (subgraphPath)}}
_graphWatcher: GraphWatcher;
{{/if}}
_abiMap: Map<string, JsonFragment[]>
_storageLayoutMap: Map<string, StorageLayout>
_contractMap: Map<string, ethers.utils.Interface>
_abiMap: Map<string, JsonFragment[]>;
_storageLayoutMap: Map<string, StorageLayout>;
_contractMap: Map<string, ethers.utils.Interface>;
{{#if (subgraphPath)}}
_entityTypesMap: Map<string, { [key: string]: string }>
_relationsMap: Map<any, { [key: string]: any }>
_entityTypesMap: Map<string, { [key: string]: string }>;
_relationsMap: Map<any, { [key: string]: any }>;
_subgraphStateMap: Map<string, any>
_subgraphStateMap: Map<string, any>;
{{/if}}
constructor (serverConfig: ServerConfig, db: DatabaseInterface, clients: Clients, ethProvider: BaseProvider, jobQueue: JobQueue{{#if (subgraphPath)}}, graphWatcher?: GraphWatcherInterface{{/if}}) {

View File

@ -63,7 +63,7 @@
"@types/yargs": "^17.0.0",
"@typescript-eslint/eslint-plugin": "^5.47.1",
"@typescript-eslint/parser": "^5.47.1",
"eslint": "^7.27.0",
"eslint": "^8.35.0",
"eslint-config-semistandard": "^15.0.1",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.27.5",
@ -71,7 +71,7 @@
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-standard": "^5.0.0",
"ts-node": "^10.2.1",
"typescript": "^4.3.2",
"typescript": "^5.0.2",
"copyfiles": "^2.4.1"
}
}