Skip to content

Commit

Permalink
Update codegen templates (#347)
Browse files Browse the repository at this point in the history
Co-authored-by: Dhruv Srivastava <dhruvdhs.ds@gmail.com>
  • Loading branch information
nikugogoi and dafaqdhruv committed Mar 30, 2023
1 parent 91816db commit 622e499
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions packages/codegen/src/templates/database-template.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion packages/codegen/src/templates/entity-template.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
22 changes: 11 additions & 11 deletions packages/codegen/src/templates/indexer-template.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -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}}) {
Expand Down
4 changes: 2 additions & 2 deletions packages/codegen/src/templates/package-template.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@
"@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",
"eslint-plugin-node": "^11.1.0",
"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"
}
}

0 comments on commit 622e499

Please sign in to comment.