From a9ffec6b3e59b96e225f01c84eaaa9aad6b50618 Mon Sep 17 00:00:00 2001 From: juanmardefago Date: Wed, 31 Jan 2024 18:12:11 -0300 Subject: [PATCH] fix: workaround query type issues if entity is named Metadata --- schema.graphql | 22 +++++++++++----------- src/mappings/ipfs.ts | 12 ++++++------ subgraph.template.yaml | 6 +++--- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/schema.graphql b/schema.graphql index 3f59a52..8ebedb3 100644 --- a/schema.graphql +++ b/schema.graphql @@ -247,8 +247,8 @@ type GraphAccount @entity { "Default display name is the current default name. Used for filtered queries in the explorer" defaultDisplayName: String - # IPFS Metadata. - metadata: GraphAccountMetadata + # IPFS Meta. + metadata: GraphAccountMeta # Operator info "Operator of other Graph Accounts" @@ -301,7 +301,7 @@ type GraphAccount @entity { tokenLockWallets: [TokenLockWallet!]! } -type GraphAccountMetadata @entity(immutable:true) { +type GraphAccountMeta @entity(immutable:true) { "IPFS hash with account metadata details" id: ID! "Account that reference this metadata file. For compatibility purposes. For the full list use graphAccounts" @@ -433,17 +433,17 @@ type Subgraph @entity { "Total amount of NameSignal entities" nameSignalCount: Int! - # Metadata from IPFS linked in GNS + # Meta from IPFS linked in GNS "Subgraph metadata" metadataHash: Bytes "Subgraph metadata ipfs hash and entity" - metadata: SubgraphMetadata + metadata: SubgraphMeta # Auxiliary fields currentVersionRelationEntity: CurrentSubgraphDeploymentRelation } -type SubgraphMetadata @entity(immutable:true) { +type SubgraphMeta @entity(immutable:true) { "Subgraph metadata ipfs hash" id: ID! "Subgraph that reference this metadata. For compatibility purposes. For the full list use subgraphs" @@ -500,15 +500,15 @@ type SubgraphVersion @entity { createdAt: Int! metadataHash: Bytes - # Metadata from IPFS linked in GNS - metadata: SubgraphVersionMetadata + # Meta from IPFS linked in GNS + metadata: SubgraphVersionMeta entityVersion: Int! "[DEPRECATED] Used for duplicate entities to enable old IDs from before the subgraph NFT update" linkedEntity: SubgraphVersion } -type SubgraphVersionMetadata @entity(immutable:true) { +type SubgraphVersionMeta @entity(immutable:true) { "Subgraph version metadata ipfs hash" id: ID! "SubgraphVersion entity that references this metadata. For compatibility purposes. For the full list use subgraphVersions" @@ -654,7 +654,7 @@ type SubgraphDeploymentManifest @entity(immutable:true) { # } """ -Metadata for the Indexer along with parameters and staking data +Meta for the Indexer along with parameters and staking data """ type Indexer @entity { "Eth address of Indexer" @@ -1452,7 +1452,7 @@ type _Schema_ name: "subgraphMetadataSearch" language: en algorithm: rank - include: [{ entity: "SubgraphMetadata", fields: [{ name: "displayName" }, { name: "description" }] }] + include: [{ entity: "SubgraphMeta", fields: [{ name: "displayName" }, { name: "description" }] }] ) @fulltext( name: "curatorSearch" diff --git a/src/mappings/ipfs.ts b/src/mappings/ipfs.ts index d237e00..af99c7a 100644 --- a/src/mappings/ipfs.ts +++ b/src/mappings/ipfs.ts @@ -1,8 +1,8 @@ import { json, Bytes, dataSource, JSONValueKind, log, DataSourceContext } from '@graphprotocol/graph-ts' import { - SubgraphMetadata, - SubgraphVersionMetadata, - GraphAccountMetadata, + SubgraphMeta, + SubgraphVersionMeta, + GraphAccountMeta, SubgraphDeploymentSchema, SubgraphDeploymentManifest, } from '../types/schema' @@ -13,7 +13,7 @@ import { jsonToString } from './utils' export function handleSubgraphMetadata(content: Bytes): void { let id = dataSource.context().getString("id") - let subgraphMetadata = new SubgraphMetadata(id) + let subgraphMetadata = new SubgraphMeta(id) let tryData = json.try_fromBytes(content) if (tryData.isOk) { let data = tryData.value.toObject() @@ -41,7 +41,7 @@ export function handleSubgraphMetadata(content: Bytes): void { export function handleSubgraphVersionMetadata(content: Bytes): void { let id = dataSource.context().getString("id") - let subgraphVersionMetadata = new SubgraphVersionMetadata(id) + let subgraphVersionMetadata = new SubgraphVersionMeta(id) let tryData = json.try_fromBytes(content) if (tryData.isOk) { let data = tryData.value.toObject() @@ -53,7 +53,7 @@ export function handleSubgraphVersionMetadata(content: Bytes): void { export function handleGraphAccountMetadata(content: Bytes): void { let id = dataSource.context().getString("id") - let graphAccountMetadata = new GraphAccountMetadata(id) + let graphAccountMetadata = new GraphAccountMeta(id) let tryData = json.try_fromBytes(content) if (tryData.isOk) { let data = tryData.value.toObject() diff --git a/subgraph.template.yaml b/subgraph.template.yaml index a68da6f..920e14a 100644 --- a/subgraph.template.yaml +++ b/subgraph.template.yaml @@ -726,7 +726,7 @@ templates: file: ./src/mappings/ipfs.ts handler: handleSubgraphMetadata entities: - - SubgraphMetadata + - SubgraphMeta abis: - name: EpochManager file: ./node_modules/@graphprotocol/contracts/dist/abis/EpochManager.json @@ -738,7 +738,7 @@ templates: file: ./src/mappings/ipfs.ts handler: handleSubgraphVersionMetadata entities: - - SubgraphVersionMetadata + - SubgraphVersionMeta abis: - name: EpochManager file: ./node_modules/@graphprotocol/contracts/dist/abis/EpochManager.json @@ -750,7 +750,7 @@ templates: file: ./src/mappings/ipfs.ts handler: handleGraphAccountMetadata entities: - - GraphAccountMetadata + - GraphAccountMeta abis: - name: EpochManager file: ./node_modules/@graphprotocol/contracts/dist/abis/EpochManager.json