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

View File

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

View File

@ -72,24 +72,24 @@ const {{capitalize event}}_EVENT = '{{event}}';
{{/each}} {{/each}}
export class Indexer implements IndexerInterface { export class Indexer implements IndexerInterface {
_db: Database _db: Database;
_ethClient: EthClient _ethClient: EthClient;
_ethProvider: BaseProvider _ethProvider: BaseProvider;
_baseIndexer: BaseIndexer _baseIndexer: BaseIndexer;
_serverConfig: ServerConfig _serverConfig: ServerConfig;
{{#if (subgraphPath)}} {{#if (subgraphPath)}}
_graphWatcher: GraphWatcher; _graphWatcher: GraphWatcher;
{{/if}} {{/if}}
_abiMap: Map<string, JsonFragment[]> _abiMap: Map<string, JsonFragment[]>;
_storageLayoutMap: Map<string, StorageLayout> _storageLayoutMap: Map<string, StorageLayout>;
_contractMap: Map<string, ethers.utils.Interface> _contractMap: Map<string, ethers.utils.Interface>;
{{#if (subgraphPath)}} {{#if (subgraphPath)}}
_entityTypesMap: Map<string, { [key: string]: string }> _entityTypesMap: Map<string, { [key: string]: string }>;
_relationsMap: Map<any, { [key: string]: any }> _relationsMap: Map<any, { [key: string]: any }>;
_subgraphStateMap: Map<string, any> _subgraphStateMap: Map<string, any>;
{{/if}} {{/if}}
constructor (serverConfig: ServerConfig, db: DatabaseInterface, clients: Clients, ethProvider: BaseProvider, jobQueue: JobQueue{{#if (subgraphPath)}}, graphWatcher?: GraphWatcherInterface{{/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", "@types/yargs": "^17.0.0",
"@typescript-eslint/eslint-plugin": "^5.47.1", "@typescript-eslint/eslint-plugin": "^5.47.1",
"@typescript-eslint/parser": "^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-semistandard": "^15.0.1",
"eslint-config-standard": "^16.0.3", "eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.27.5", "eslint-plugin-import": "^2.27.5",
@ -71,7 +71,7 @@
"eslint-plugin-promise": "^5.1.0", "eslint-plugin-promise": "^5.1.0",
"eslint-plugin-standard": "^5.0.0", "eslint-plugin-standard": "^5.0.0",
"ts-node": "^10.2.1", "ts-node": "^10.2.1",
"typescript": "^4.3.2", "typescript": "^5.0.2",
"copyfiles": "^2.4.1" "copyfiles": "^2.4.1"
} }
} }